From 01b5b8220dd91ff2ebcd46095acf5d054d52e526 Mon Sep 17 00:00:00 2001 From: SONOLET Aymeric Date: Fri, 15 Dec 2023 15:44:54 +0100 Subject: [PATCH] format: Format python files --- dev-tools/format | 6 +- doc/gui/General/tutorial.py | 118 +- doc/gui/build_index.py | 84 +- salome_pid.py | 10 +- scripts/doxy2swig.py | 659 +-- shaper_test.py | 72 +- src/BuildPlugin/Test/Test19056.py | 312 +- src/BuildPlugin/Test/Test1920.py | 73 +- src/BuildPlugin/Test/Test20469.py | 675 ++- src/BuildPlugin/Test/Test20513_1.py | 103 +- src/BuildPlugin/Test/Test20513_2.py | 1500 ++++-- src/BuildPlugin/Test/Test2398.py | 180 +- src/BuildPlugin/Test/Test2409.py | 34 +- src/BuildPlugin/Test/Test2415.py | 85 +- src/BuildPlugin/Test/Test2439.py | 39 +- src/BuildPlugin/Test/Test2454.py | 17 +- src/BuildPlugin/Test/Test3125.py | 26 +- src/BuildPlugin/Test/Test3271.py | 183 +- src/BuildPlugin/Test/TestCompSolid.py | 292 +- src/BuildPlugin/Test/TestCompound.py | 153 +- src/BuildPlugin/Test/TestCompound_ErrorMsg.py | 5 +- src/BuildPlugin/Test/TestCompound_History.py | 68 +- src/BuildPlugin/Test/TestEdge.py | 17 +- src/BuildPlugin/Test/TestEdge_ByPoints.py | 61 +- src/BuildPlugin/Test/TestEdge_ErrorMsg.py | 7 +- .../Test/TestEdge_WholeSketch_1.py | 19 +- .../Test/TestEdge_WholeSketch_2.py | 19 +- .../Test/TestEdge_WholeSketch_3.py | 19 +- .../Test/TestEdge_WholeSketch_4.py | 19 +- src/BuildPlugin/Test/TestFace.py | 21 +- src/BuildPlugin/Test/TestFace_ErrorMsg.py | 28 +- .../Test/TestFace_WholeSketch_1.py | 18 +- .../Test/TestFace_WholeSketch_2.py | 26 +- src/BuildPlugin/Test/TestFilling.py | 39 +- src/BuildPlugin/Test/TestFilling_ByEdges.py | 45 +- src/BuildPlugin/Test/TestFilling_ByWires.py | 43 +- src/BuildPlugin/Test/TestFilling_ErrorMsg.py | 94 +- src/BuildPlugin/Test/TestFilling_Mixed.py | 45 +- src/BuildPlugin/Test/TestInterpolation.py | 57 +- src/BuildPlugin/Test/TestNonPlanarFace.py | 24 +- .../Test/TestNonPlanarFace_Edges.py | 52 +- src/BuildPlugin/Test/TestPolyline.py | 32 +- src/BuildPlugin/Test/TestShell.py | 27 +- .../Test/TestShell_WholeSketch_1.py | 18 +- .../Test/TestShell_WholeSketch_2.py | 26 +- src/BuildPlugin/Test/TestSolid.py | 238 +- src/BuildPlugin/Test/TestSolid_ErrorMsg.py | 3 +- src/BuildPlugin/Test/TestSubShapes.py | 36 +- .../Test/TestSubShapes_ErrorMsg.py | 69 +- src/BuildPlugin/Test/TestVertex.py | 15 +- src/BuildPlugin/Test/TestVertex_ErrorMsg.py | 5 +- .../Test/TestVertex_WholeSketch_1.py | 19 +- .../Test/TestVertex_WholeSketch_2.py | 19 +- src/BuildPlugin/Test/TestWire.py | 44 +- src/BuildPlugin/Test/TestWire_ErrorMsg.py | 21 +- .../Test/TestWire_WholeSketch_1.py | 19 +- .../Test/TestWire_WholeSketch_2.py | 19 +- .../Test/TestWire_WholeSketch_3.py | 50 +- .../Test/TestWire_WholeSketch_4.py | 50 +- .../Test/TestWire_WholeSketch_5.py | 50 +- .../Test/TestWire_WholeSketch_6.py | 50 +- src/BuildPlugin/doc/examples/compound.py | 6 +- src/BuildPlugin/doc/examples/edge.py | 4 +- src/BuildPlugin/doc/examples/face.py | 6 +- src/BuildPlugin/doc/examples/filling.py | 8 +- src/BuildPlugin/doc/examples/interpolation.py | 11 +- .../doc/examples/interpolationAnalytical.py | 4 +- src/BuildPlugin/doc/examples/polyline.py | 6 +- src/BuildPlugin/doc/examples/segment.py | 7 +- src/BuildPlugin/doc/examples/shell.py | 6 +- src/BuildPlugin/doc/examples/solid.py | 14 +- src/BuildPlugin/doc/examples/subshapes.py | 59 +- src/BuildPlugin/doc/examples/vertex.py | 6 +- src/BuildPlugin/doc/examples/wire.py | 7 +- src/CollectionPlugin/Test/Test18739.py | 55 +- src/CollectionPlugin/Test/Test2977.py | 23 +- src/CollectionPlugin/Test/Test3031.py | 22 +- src/CollectionPlugin/Test/Test3114.py | 109 +- .../Test/TestCreateShapesFromGroups.py | 73 +- src/CollectionPlugin/Test/TestField.py | 113 +- src/CollectionPlugin/Test/TestGroup.py | 193 +- src/CollectionPlugin/Test/TestGroup1799.py | 279 +- src/CollectionPlugin/Test/TestGroup2.py | 152 +- .../Test/TestGroupAddition.py | 17 +- .../Test/TestGroupAddition_Error.py | 25 +- .../Test/TestGroupIntersection.py | 28 +- .../Test/TestGroupIntersection_Error.py | 30 +- src/CollectionPlugin/Test/TestGroupMove01.py | 21 +- src/CollectionPlugin/Test/TestGroupMove02.py | 24 +- src/CollectionPlugin/Test/TestGroupMove03.py | 88 +- src/CollectionPlugin/Test/TestGroupMove04.py | 58 +- src/CollectionPlugin/Test/TestGroupMove05.py | 91 +- src/CollectionPlugin/Test/TestGroupMove06.py | 215 +- src/CollectionPlugin/Test/TestGroupMove07.py | 67 +- src/CollectionPlugin/Test/TestGroupMove08.py | 117 +- src/CollectionPlugin/Test/TestGroupMove09.py | 177 +- src/CollectionPlugin/Test/TestGroupMove10.py | 55 +- src/CollectionPlugin/Test/TestGroupMove11.py | 251 +- src/CollectionPlugin/Test/TestGroupMove12.py | 147 +- src/CollectionPlugin/Test/TestGroupMove13.py | 150 +- src/CollectionPlugin/Test/TestGroupMove14.py | 142 +- src/CollectionPlugin/Test/TestGroupMove15.py | 135 +- src/CollectionPlugin/Test/TestGroupMove16.py | 64 +- src/CollectionPlugin/Test/TestGroupMove17.py | 65 +- src/CollectionPlugin/Test/TestGroupMove18.py | 73 +- src/CollectionPlugin/Test/TestGroupMove19.py | 91 +- src/CollectionPlugin/Test/TestGroupMove20.py | 20 +- src/CollectionPlugin/Test/TestGroupMove21.py | 71 +- src/CollectionPlugin/Test/TestGroupMove22.py | 79 +- src/CollectionPlugin/Test/TestGroupMove23.py | 71 +- src/CollectionPlugin/Test/TestGroupMove24.py | 79 +- src/CollectionPlugin/Test/TestGroupMove25.py | 160 +- src/CollectionPlugin/Test/TestGroupMove26.py | 33 +- .../Test/TestGroupMoveAndSplit1.py | 51 +- .../Test/TestGroupMoveAndSplit2.py | 127 +- .../Test/TestGroupMoveAndSplit3.py | 110 +- .../Test/TestGroupMoveAndSplit4.py | 85 +- src/CollectionPlugin/Test/TestGroupShape.py | 17 +- .../Test/TestGroupShareTopology.py | 27 +- .../Test/TestGroupSubstraction.py | 36 +- .../Test/TestGroupSubstraction2.py | 90 +- .../Test/TestGroupSubstraction_Error1.py | 20 +- .../Test/TestGroupSubstraction_Error2.py | 23 +- .../Test/TestGroupWholeFeature1.py | 49 +- .../Test/TestGroupWholeFeature2.py | 54 +- .../Test/TestGroupWholeResult1.py | 47 +- .../Test/TestGroupWholeResult2.py | 31 +- src/CollectionPlugin/doc/examples/field.py | 10 +- src/CollectionPlugin/doc/examples/group.py | 17 +- .../doc/examples/group_addition.py | 18 +- .../doc/examples/group_intersection.py | 35 +- .../doc/examples/group_shape.py | 18 +- .../doc/examples/group_substraction.py | 50 +- src/Config/Test/TestConfig.py | 36 +- src/ConnectorAPI/Test/Test17917.py | 32 +- src/ConnectorAPI/Test/Test18887.py | 100 +- src/ConnectorAPI/Test/Test2882.py | 148 +- src/ConnectorAPI/Test/Test3195.py | 13 +- src/ConnectorAPI/Test/TestExportSTL.py | 128 +- src/ConnectorAPI/Test/TestExportToGEOM.py | 215 +- .../TestExportToGEOMAllGroupsAndFields.py | 528 +- .../Test/TestExportToGEOMPartSet.py | 155 +- .../Test/TestExportToGEOMWholeFeature.py | 234 +- .../Test/TestExportToGEOMWholeResult.py | 182 +- src/ConnectorAPI/Test/TestExportXAOMem.py | 73 +- src/ConnectorAPI/Test/TestImportSTEP.py | 44 +- src/ConnectorAPI/Test/TestImportSTL.py | 58 +- src/ConnectorAPI/Test/TestImportXAOMem.py | 69 +- src/ConnectorAPI/Test/testme.py | 26 +- src/ConnectorPlugin/ConnectorPlugin.py | 3 +- .../ConnectorPlugin_ExportFeature.py | 114 +- .../ConnectorPlugin_PublishToStudyFeature.py | 424 +- src/ConstructionAPI/Test/TestAxis.py | 62 +- src/ConstructionAPI/Test/TestPoint.py | 13 +- src/ConstructionPlugin/Test/Test19207.py | 19 +- src/ConstructionPlugin/Test/Test19471.py | 12 +- .../Test/TestAxisCreation.py | 90 +- .../Test/TestAxis_ErrorMsg.py | 13 +- src/ConstructionPlugin/Test/TestPlane.py | 20 +- .../Test/TestPlane_Copies.py | 12 +- .../Test/TestPlane_ErrorMsg.py | 17 +- .../Test/TestPlane_FaceValidator.py | 17 +- src/ConstructionPlugin/Test/TestPointName.py | 9 +- .../Test/TestPoint_34658.py | 105 +- src/ConstructionPlugin/Test/TestPoint_Edge.py | 66 +- .../Test/TestPoint_ErrorMsg.py | 3 +- .../Test/TestPoint_FiniteValidator.py | 6 +- ...Point_GeometricalPropertyCenterOfCircle.py | 36 +- ...oint_GeometricalPropertyCenterOfGravity.py | 22 +- .../Test/TestPoint_IntersectLineAndPlane.py | 24 +- .../Test/TestPoint_IntersectLines.py | 26 +- .../Test/TestPoint_IntersectPlanes.py | 45 +- .../Test/TestPoint_ProjectOnEdge.py | 22 +- .../Test/TestPoint_ProjectOnFace.py | 22 +- .../Test/TestPoint_VertexSelection.py | 51 +- src/ConstructionPlugin/Test/TestPoint_XYZ.py | 4 +- src/ConstructionPlugin/Test/UnitTestAxis.py | 21 +- src/ConstructionPlugin/doc/examples/axis2.py | 6 +- src/ConstructionPlugin/doc/examples/axis4.py | 8 +- src/ConstructionPlugin/doc/examples/axis5.py | 6 +- src/ConstructionPlugin/doc/examples/axis6.py | 6 +- src/ConstructionPlugin/doc/examples/plane1.py | 7 +- src/ConstructionPlugin/doc/examples/plane2.py | 7 +- src/ConstructionPlugin/doc/examples/plane4.py | 6 +- src/ConstructionPlugin/doc/examples/point2.py | 8 +- src/ConstructionPlugin/doc/examples/point3.py | 6 +- src/ConstructionPlugin/doc/examples/point4.py | 16 +- src/ConstructionPlugin/doc/examples/point5.py | 8 +- src/ExchangeAPI/Test/TestExchange.py | 7 +- src/ExchangePlugin/Test/Test18710.py | 17 +- src/ExchangePlugin/Test/Test2290.py | 18 +- src/ExchangePlugin/Test/Test2459.py | 255 +- src/ExchangePlugin/Test/TestExport.py | 203 +- .../Test/TestExportPart_Failure_1.py | 85 +- .../Test/TestExportPart_Failure_2.py | 91 +- .../Test/TestExportPart_Failure_3.py | 15 +- .../Test/TestExportPart_FullPartSet.py | 85 +- .../Test/TestExportPart_FullPart_1.py | 85 +- .../Test/TestExportPart_FullPart_2.py | 89 +- .../Test/TestExportPart_PartSet.py | 85 +- .../Test/TestExportPart_Results_1.py | 89 +- .../Test/TestExportPart_Results_2.py | 89 +- .../Test/TestExportPart_Results_3.py | 89 +- .../Test/TestExportPart_Results_4.py | 89 +- .../Test/TestExportPart_Results_5.py | 89 +- .../Test/TestExportPart_Results_6.py | 89 +- .../Test/TestExportPart_Results_7.py | 89 +- .../Test/TestExportPart_Results_8.py | 89 +- .../Test/TestExportToXAOWithFields.py | 33 +- .../TestExportToXAOWithGroupNotUpdated.py | 82 +- .../Test/TestExport_FiniteValidator.py | 2 +- src/ExchangePlugin/Test/TestImport.py | 107 +- src/ExchangePlugin/Test/TestImportImage_1.py | 95 +- src/ExchangePlugin/Test/TestImportImage_2.py | 93 +- src/ExchangePlugin/Test/TestImportImage_3.py | 94 +- .../Test/TestImportPart_AfterCurrent_1.py | 98 +- .../Test/TestImportPart_AfterCurrent_2.py | 96 +- .../Test/TestImportPart_AfterLast_1.py | 151 +- .../Test/TestImportPart_AfterLast_2.py | 151 +- .../Test/TestImportPart_AfterLast_3.py | 151 +- .../Test/TestImportPart_AfterLast_4.py | 151 +- .../Test/TestImportPart_AfterLast_5.py | 158 +- .../Test/TestImportPart_AfterLast_6.py | 158 +- .../Test/TestImportPart_Construction_1.py | 24 +- .../Test/TestImportPart_Construction_2.py | 24 +- .../Test/TestImportPart_Construction_3.py | 30 +- .../Test/TestImportPart_Construction_4.py | 30 +- .../Test/TestImportPart_Multiple.py | 76 +- .../Test/TestImportPart_ToEmptyPart.py | 94 +- .../Test/TestImportPart_ToEmptyPartSet.py | 98 +- src/ExchangePlugin/Test/TestStep1.py | 193 +- src/ExchangePlugin/Test/TestStep2.py | 46 +- src/ExchangePlugin/Test/testme.py | 38 +- src/ExchangePlugin/doc/examples/export.py | 12 +- src/ExchangePlugin/doc/examples/exportSTL.py | 5 +- .../doc/examples/export_part.py | 12 +- src/ExchangePlugin/doc/examples/importStep.py | 6 +- src/FeaturesPlugin/Test/Test1379.py | 292 +- src/FeaturesPlugin/Test/Test1467.py | 116 +- src/FeaturesPlugin/Test/Test17000.py | 561 +- src/FeaturesPlugin/Test/Test17261.py | 327 +- src/FeaturesPlugin/Test/Test17281.py | 69 +- src/FeaturesPlugin/Test/Test17909.py | 100 +- src/FeaturesPlugin/Test/Test1816.py | 183 +- src/FeaturesPlugin/Test/Test1876.py | 89 +- src/FeaturesPlugin/Test/Test18836.py | 122 +- src/FeaturesPlugin/Test/Test19065.py | 122 +- src/FeaturesPlugin/Test/Test19066.py | 241 +- src/FeaturesPlugin/Test/Test19115.py | 69 +- src/FeaturesPlugin/Test/Test1915.py | 35 +- src/FeaturesPlugin/Test/Test19196.py | 368 +- src/FeaturesPlugin/Test/Test1922.py | 361 +- src/FeaturesPlugin/Test/Test1942.py | 407 +- src/FeaturesPlugin/Test/Test19931.py | 656 ++- src/FeaturesPlugin/Test/Test20027.py | 412 +- src/FeaturesPlugin/Test/Test2023.py | 107 +- src/FeaturesPlugin/Test/Test20245_1.py | 261 +- src/FeaturesPlugin/Test/Test20245_2.py | 50 +- src/FeaturesPlugin/Test/Test20245_3.py | 2097 ++++++-- .../Test/Test20245_3_geometrical.py | 1638 ++++-- src/FeaturesPlugin/Test/Test20247.py | 27 +- src/FeaturesPlugin/Test/Test2038.py | 153 +- src/FeaturesPlugin/Test/Test2046.py | 54 +- src/FeaturesPlugin/Test/Test2172.py | 201 +- src/FeaturesPlugin/Test/Test2194.py | 71 +- src/FeaturesPlugin/Test/Test2197_1.py | 53 +- src/FeaturesPlugin/Test/Test2197_2.py | 56 +- src/FeaturesPlugin/Test/Test2197_3.py | 63 +- src/FeaturesPlugin/Test/Test2197_4.py | 95 +- src/FeaturesPlugin/Test/Test2215.py | 136 +- src/FeaturesPlugin/Test/Test2222.py | 44 +- src/FeaturesPlugin/Test/Test2225.py | 78 +- src/FeaturesPlugin/Test/Test2231.py | 138 +- src/FeaturesPlugin/Test/Test2233.py | 60 +- src/FeaturesPlugin/Test/Test2240.py | 394 +- src/FeaturesPlugin/Test/Test2246.py | 67 +- src/FeaturesPlugin/Test/Test2248.py | 317 +- src/FeaturesPlugin/Test/Test2251.py | 243 +- src/FeaturesPlugin/Test/Test2255.py | 109 +- src/FeaturesPlugin/Test/Test22847.py | 46 +- src/FeaturesPlugin/Test/Test2289.py | 74 +- src/FeaturesPlugin/Test/Test2304.py | 93 +- src/FeaturesPlugin/Test/Test2304_2.py | 243 +- src/FeaturesPlugin/Test/Test2375.py | 470 +- src/FeaturesPlugin/Test/Test2377.py | 59 +- src/FeaturesPlugin/Test/Test23885.py | 37 +- src/FeaturesPlugin/Test/Test2394.py | 513 +- src/FeaturesPlugin/Test/Test2395.py | 57 +- src/FeaturesPlugin/Test/Test2419_1.py | 182 +- src/FeaturesPlugin/Test/Test2419_2.py | 395 +- src/FeaturesPlugin/Test/Test2419_3.py | 395 +- src/FeaturesPlugin/Test/Test2465.py | 19 +- src/FeaturesPlugin/Test/Test2495.py | 987 +++- src/FeaturesPlugin/Test/Test2514.py | 386 +- src/FeaturesPlugin/Test/Test2520.py | 109 +- src/FeaturesPlugin/Test/Test2545.py | 12 +- src/FeaturesPlugin/Test/Test2588.py | 43 +- src/FeaturesPlugin/Test/Test2592.py | 16 +- src/FeaturesPlugin/Test/Test2596.py | 57 +- src/FeaturesPlugin/Test/Test2617.py | 33 +- src/FeaturesPlugin/Test/Test2631.py | 70 +- src/FeaturesPlugin/Test/Test2636.py | 717 ++- src/FeaturesPlugin/Test/Test2650.py | 97 +- src/FeaturesPlugin/Test/Test2681.py | 64 +- src/FeaturesPlugin/Test/Test2686.py | 415 +- src/FeaturesPlugin/Test/Test2689.py | 205 +- src/FeaturesPlugin/Test/Test2692.py | 37 +- src/FeaturesPlugin/Test/Test2693.py | 257 +- src/FeaturesPlugin/Test/Test2698.py | 636 ++- src/FeaturesPlugin/Test/Test2701.py | 200 +- src/FeaturesPlugin/Test/Test2724.py | 122 +- src/FeaturesPlugin/Test/Test2729.py | 383 +- src/FeaturesPlugin/Test/Test2738.py | 85 +- src/FeaturesPlugin/Test/Test2751.py | 128 +- src/FeaturesPlugin/Test/Test2817.py | 186 +- src/FeaturesPlugin/Test/Test2826.py | 901 +++- src/FeaturesPlugin/Test/Test2854.py | 108 +- src/FeaturesPlugin/Test/Test2878.py | 49 +- src/FeaturesPlugin/Test/Test2918.py | 813 ++- src/FeaturesPlugin/Test/Test2920.py | 258 +- src/FeaturesPlugin/Test/Test2971.py | 713 ++- src/FeaturesPlugin/Test/Test3014.py | 53 +- src/FeaturesPlugin/Test/Test3033.py | 36 +- src/FeaturesPlugin/Test/Test3076.py | 331 +- src/FeaturesPlugin/Test/Test3137_1.py | 108 +- src/FeaturesPlugin/Test/Test3137_2.py | 52 +- src/FeaturesPlugin/Test/Test3139.py | 223 +- src/FeaturesPlugin/Test/TestBoolean1.py | 62 +- src/FeaturesPlugin/Test/TestBoolean2.py | 25 +- src/FeaturesPlugin/Test/TestBoolean3.py | 25 +- ...mon_CompSolidCompound_CompSolidCompound.py | 212 +- ...estBooleanCommon_CompSolidCompound_Face.py | 151 +- ...stBooleanCommon_CompSolidCompound_Shell.py | 170 +- .../TestBooleanCommon_CompSolid_CompSolid.py | 108 +- .../Test/TestBooleanCommon_CompSolid_Face.py | 102 +- .../Test/TestBooleanCommon_CompSolid_Shell.py | 118 +- ...BooleanCommon_EdgeCompound_EdgeCompound.py | 70 +- .../Test/TestBooleanCommon_Edge_Edge.py | 33 +- .../Test/TestBooleanCommon_ErrorMsg.py | 7 +- ...BooleanCommon_FaceCompound_FaceCompound.py | 178 +- .../Test/TestBooleanCommon_Face_Face.py | 87 +- .../Test/TestBooleanCommon_Face_Plane.py | 52 +- .../Test/TestBooleanCommon_Fuzzy.py | 11 +- ...stBooleanCommon_MultiLevelCompound_v0_1.py | 136 +- ...stBooleanCommon_MultiLevelCompound_v0_2.py | 177 +- ...anCommon_MultiLevelCompound_v20190506_1.py | 137 +- ...anCommon_MultiLevelCompound_v20190506_2.py | 178 +- ...oleanCommon_ShellCompound_ShellCompound.py | 228 +- .../Test/TestBooleanCommon_Shell_Shell.py | 125 +- .../TestBooleanCommon_SolidCompound_Face.py | 127 +- .../TestBooleanCommon_SolidCompound_Shell.py | 162 +- ...oleanCommon_SolidCompound_SolidCompound.py | 164 +- .../Test/TestBooleanCommon_Solid_Face.py | 17 +- .../Test/TestBooleanCommon_Solid_Shell.py | 67 +- .../Test/TestBooleanCommon_Solid_Solid.py | 17 +- .../Test/TestBooleanCommon_SolidsHistory.py | 201 +- .../TestBooleanCommon_SubCompound_Solid.py | 33 +- .../Test/TestBooleanCommon_SubSolid_Solid.py | 17 +- ...eanCommon_VertexCompound_VertexCompound.py | 38 +- .../Test/TestBooleanCommon_Vertex_Vertex.py | 38 +- ...BooleanCommon_WireCompound_WireCompound.py | 142 +- .../Test/TestBooleanCommon_Wire_Wire.py | 69 +- .../Test/TestBooleanCompSolids.py | 58 +- ...Cut_CompSolidCompound_CompSolidCompound.py | 98 +- .../TestBooleanCut_CompSolid_CompSolid.py | 50 +- .../Test/TestBooleanCut_Compound_Solid.py | 22 +- ...estBooleanCut_EdgeCompound_EdgeCompound.py | 42 +- .../Test/TestBooleanCut_EdgeCompound_Solid.py | 58 +- .../Test/TestBooleanCut_Edge_Edge.py | 26 +- .../Test/TestBooleanCut_Edge_Face.py | 56 +- .../Test/TestBooleanCut_ErrorMsg.py | 11 +- ...estBooleanCut_FaceCompound_FaceCompound.py | 52 +- .../Test/TestBooleanCut_Face_Face.py | 34 +- .../Test/TestBooleanCut_Face_Solid.py | 82 +- .../Test/TestBooleanCut_Fuzzy_1.py | 22 +- .../Test/TestBooleanCut_Fuzzy_2.py | 20 +- .../TestBooleanCut_MultiLevelCompound_v0_1.py | 69 +- .../TestBooleanCut_MultiLevelCompound_v0_2.py | 177 +- ...oleanCut_MultiLevelCompound_v20190506_1.py | 70 +- ...oleanCut_MultiLevelCompound_v20190506_2.py | 178 +- ...tBooleanCut_ShellCompound_ShellCompound.py | 106 +- .../Test/TestBooleanCut_Shell_Shell.py | 53 +- ...tBooleanCut_SolidCompound_SolidCompound.py | 50 +- .../Test/TestBooleanCut_Solid_Compound.py | 67 +- .../Test/TestBooleanCut_Solid_Solid.py | 82 +- .../Test/TestBooleanCut_SolidsHistory.py | 96 +- .../TestBooleanCut_VertexCompound_Solid.py | 60 +- ...ooleanCut_VertexCompound_VertexCompound.py | 25 +- .../Test/TestBooleanCut_Vertex_Vertex.py | 32 +- ...estBooleanCut_WireCompound_WireCompound.py | 100 +- .../Test/TestBooleanCut_Wire_Face.py | 44 +- .../Test/TestBooleanCut_Wire_Wire.py | 56 +- ...use_CompSolidCompound_CompSolidCompound.py | 213 +- .../TestBooleanFuse_CompSolid_CompSolid.py | 109 +- .../Test/TestBooleanFuse_CompSolid_Face.py | 81 +- ...stBooleanFuse_EdgeCompound_EdgeCompound.py | 45 +- .../Test/TestBooleanFuse_Edge_Edge.py | 25 +- .../Test/TestBooleanFuse_ErrorMsg.py | 36 +- ...stBooleanFuse_FaceCompound_FaceCompound.py | 55 +- .../Test/TestBooleanFuse_Face_Face.py | 26 +- .../Test/TestBooleanFuse_Fuzzy.py | 17 +- ...TestBooleanFuse_MultiLevelCompound_v0_1.py | 134 +- ...TestBooleanFuse_MultiLevelCompound_v0_2.py | 116 +- ...TestBooleanFuse_MultiLevelCompound_v0_3.py | 118 +- ...TestBooleanFuse_MultiLevelCompound_v0_4.py | 116 +- ...leanFuse_MultiLevelCompound_v20190506_1.py | 136 +- ...leanFuse_MultiLevelCompound_v20190506_2.py | 118 +- ...leanFuse_MultiLevelCompound_v20190506_3.py | 119 +- ...leanFuse_MultiLevelCompound_v20190506_4.py | 118 +- .../Test/TestBooleanFuse_RemoveEdges.py | 17 +- ...BooleanFuse_ShellCompound_ShellCompound.py | 217 +- .../Test/TestBooleanFuse_Shell_Shell.py | 105 +- .../Test/TestBooleanFuse_SimpleMode.py | 16 +- ...BooleanFuse_SolidCompound_SolidCompound.py | 164 +- .../Test/TestBooleanFuse_Solid_Solid.py | 102 +- .../Test/TestBooleanFuse_SolidsHistory.py | 98 +- ...oleanFuse_VertexCompound_VertexCompound.py | 29 +- .../Test/TestBooleanFuse_Vertex_Vertex.py | 17 +- ...stBooleanFuse_WireCompound_WireCompound.py | 102 +- .../Test/TestBooleanFuse_Wire_Wire.py | 49 +- src/FeaturesPlugin/Test/TestBooleanSmash.py | 62 +- .../Test/TestBooleanSmash_CompSolid_Solid.py | 21 +- .../Test/TestBooleanSmash_ErrorMsg.py | 63 +- .../Test/TestBooleanSmash_Face_Face.py | 26 +- ...estBooleanSmash_MultiLevelCompound_v0_1.py | 137 +- ...estBooleanSmash_MultiLevelCompound_v0_2.py | 177 +- ...eanSmash_MultiLevelCompound_v20190506_1.py | 138 +- ...eanSmash_MultiLevelCompound_v20190506_2.py | 178 +- .../Test/TestBooleanSmash_SolidsHistory.py | 209 +- .../Test/TestBooleanSmash_SubSolid_Solid.py | 17 +- src/FeaturesPlugin/Test/TestBooleanSplit.py | 18 +- .../Test/TestBooleanSplitWithPlane.py | 91 +- .../Test/TestBooleanSplit_ErrorMsg.py | 3 +- ...estBooleanSplit_MultiLevelCompound_v0_1.py | 134 +- ...estBooleanSplit_MultiLevelCompound_v0_2.py | 177 +- ...eanSplit_MultiLevelCompound_v20190506_1.py | 135 +- ...eanSplit_MultiLevelCompound_v20190506_2.py | 178 +- .../Test/TestBoolean_ErrorMsg.py | 25 +- src/FeaturesPlugin/Test/TestBoundingBox.py | 47 +- src/FeaturesPlugin/Test/TestChamfer.py | 43 +- .../TestChamfer_MultiLevelCompound_v0_1.py | 282 +- .../TestChamfer_MultiLevelCompound_v0_2.py | 295 +- .../TestChamfer_MultiLevelCompound_v0_3.py | 282 +- .../TestChamfer_MultiLevelCompound_v0_4.py | 291 +- .../TestChamfer_MultiLevelCompound_v95_1.py | 297 +- .../TestChamfer_MultiLevelCompound_v95_2.py | 316 +- .../TestChamfer_MultiLevelCompound_v95_3.py | 297 +- .../TestChamfer_MultiLevelCompound_v95_4.py | 316 +- .../Test/TestCheckSharedFaces.py | 86 +- .../Test/TestCompositeFeaturesOnCompSolids.py | 132 +- src/FeaturesPlugin/Test/TestCopyFeature.py | 40 +- .../Test/TestCopyFeatureMoveGroupOfFeature.py | 35 +- src/FeaturesPlugin/Test/TestCopyMoveResult.py | 85 +- .../Test/TestCopyMoveSubShapes.py | 54 +- src/FeaturesPlugin/Test/TestCopyNames.py | 79 +- src/FeaturesPlugin/Test/TestCopySubShapes.py | 62 +- .../Test/TestCopyWholeFeature.py | 119 +- src/FeaturesPlugin/Test/TestCopy_ErrorMsg.py | 13 +- .../Test/TestDefeaturing_ErrorMsg.py | 41 +- .../Test/TestDefeaturing_OnCompound.py | 50 +- .../Test/TestDefeaturing_OnCompsolid1.py | 33 +- .../Test/TestDefeaturing_OnCompsolid2.py | 36 +- .../Test/TestDefeaturing_OnCompsolid3.py | 104 +- .../Test/TestDefeaturing_OnSolid1.py | 21 +- .../Test/TestDefeaturing_OnSolid2.py | 139 +- .../Test/TestDefeaturing_OnSolid3.py | 143 +- src/FeaturesPlugin/Test/TestExtrusion.py | 145 +- src/FeaturesPlugin/Test/TestExtrusionCut.py | 60 +- .../Test/TestExtrusionCut_ByFaces.py | 307 +- .../TestExtrusionCut_ByPlanesAndOffsets.py | 61 +- .../Test/TestExtrusionCut_BySize.py | 44 +- .../Test/TestExtrusionCut_ThroughAll.py | 44 +- src/FeaturesPlugin/Test/TestExtrusionFuse.py | 60 +- .../TestExtrusionFuse_ByPlanesAndOffsets.py | 64 +- .../Test/TestExtrusionFuse_BySize.py | 40 +- .../Test/TestExtrusionFuse_ThroughAll.py | 58 +- .../Test/TestExtrusionOfCompound.py | 32 +- .../Test/TestExtrusion_ByFaces01.py | 51 +- .../Test/TestExtrusion_ByFaces02.py | 62 +- .../Test/TestExtrusion_ByFaces03.py | 101 +- .../Test/TestExtrusion_ByFaces04.py | 109 +- .../Test/TestExtrusion_ByFaces05.py | 40 +- .../Test/TestExtrusion_ByFaces06.py | 77 +- .../Test/TestExtrusion_ByFaces07.py | 67 +- .../Test/TestExtrusion_ByFaces08.py | 87 +- .../Test/TestExtrusion_ByFaces09.py | 110 +- .../Test/TestExtrusion_ByFaces10.py | 117 +- .../Test/TestExtrusion_ByFaces11.py | 57 +- .../Test/TestExtrusion_ByFaces12.py | 81 +- .../Test/TestExtrusion_ByFaces13.py | 83 +- .../Test/TestExtrusion_ByFaces14.py | 94 +- .../Test/TestExtrusion_ByFaces15.py | 109 +- .../Test/TestExtrusion_ByFaces16.py | 117 +- .../Test/TestExtrusion_ByFaces17.py | 44 +- .../Test/TestExtrusion_ByFaces18.py | 85 +- .../Test/TestExtrusion_ByFaces19.py | 58 +- .../Test/TestExtrusion_ErrorMsg.py | 98 +- .../Test/TestExtrusion_ZeroOffsetError.py | 58 +- src/FeaturesPlugin/Test/TestFillet.py | 51 +- src/FeaturesPlugin/Test/TestFillet1.py | 12 +- .../Test/TestFillet1D_ErrorMsg.py | 52 +- .../Test/TestFillet1D_Vertices_1.py | 25 +- .../Test/TestFillet1D_Vertices_2.py | 39 +- .../Test/TestFillet1D_Vertices_3.py | 34 +- .../Test/TestFillet1D_Vertices_4.py | 48 +- .../Test/TestFillet1D_Vertices_5.py | 19 +- .../Test/TestFillet1D_Vertices_6.py | 23 +- .../Test/TestFillet1D_Vertices_7.py | 28 +- .../Test/TestFillet1D_Vertices_8.py | 41 +- .../Test/TestFillet1D_Vertices_9.py | 47 +- .../Test/TestFillet1D_Wire_1.py | 10 +- .../Test/TestFillet1D_Wire_2.py | 13 +- .../Test/TestFillet1D_Wire_3.py | 19 +- .../Test/TestFillet1D_Wire_4.py | 26 +- .../Test/TestFillet1D_Wire_5.py | 29 +- .../Test/TestFillet_ErrorMsg.py | 37 +- src/FeaturesPlugin/Test/TestFillet_History.py | 114 +- .../TestFillet_MultiLevelCompound_v0_1.py | 264 +- .../TestFillet_MultiLevelCompound_v0_2.py | 277 +- .../TestFillet_MultiLevelCompound_v0_3.py | 275 +- .../TestFillet_MultiLevelCompound_v0_4.py | 284 +- .../TestFillet_MultiLevelCompound_v95_1.py | 278 +- .../TestFillet_MultiLevelCompound_v95_2.py | 297 +- .../TestFillet_MultiLevelCompound_v95_3.py | 289 +- .../TestFillet_MultiLevelCompound_v95_4.py | 308 +- src/FeaturesPlugin/Test/TestFusionFaces.py | 109 +- .../Test/TestFusionFaces2697.py | 375 +- .../Test/TestFusionFaces32443.py | 102 +- .../Test/TestGeometryCalculation.py | 37 +- .../Test/TestGlueFaces_Compound.py | 51 +- .../Test/TestGlueFaces_Faces.py | 43 +- .../Test/TestGlueFaces_Shell.py | 68 +- .../Test/TestGlueFaces_Solids.py | 58 +- src/FeaturesPlugin/Test/TestImportResult.py | 36 +- .../Test/TestImportResultWithGroups1.py | 43 +- .../Test/TestImportResultWithGroups2.py | 68 +- .../Test/TestImportResultWithGroups3.py | 72 +- src/FeaturesPlugin/Test/TestIntersection.py | 75 +- .../Test/TestIntersection_ErrorMsg.py | 6 +- ...estIntersection_MultiLevelCompound_v0_1.py | 38 +- ...estIntersection_MultiLevelCompound_v0_2.py | 34 +- ...stIntersection_MultiLevelCompound_v95_1.py | 41 +- ...stIntersection_MultiLevelCompound_v95_2.py | 37 +- src/FeaturesPlugin/Test/TestLimitTolerance.py | 36 +- .../Test/TestLimitTolerance_Face.py | 13 +- src/FeaturesPlugin/Test/TestLoft.py | 199 +- .../Test/TestMeasurementAngle.py | 141 +- .../Test/TestMeasurementAngle3Points.py | 197 +- .../Test/TestMeasurementDistance.py | 272 +- .../Test/TestMeasurementLength.py | 109 +- .../Test/TestMeasurementPresentation.py | 103 +- .../Test/TestMeasurementRadius.py | 94 +- src/FeaturesPlugin/Test/TestMultiBoolean.py | 79 +- .../Test/TestMultiRotation_ErrorMsg.py | 9 +- ...stMultiRotation_MultiLevelCompound_v0_1.py | 201 +- ...stMultiRotation_MultiLevelCompound_v0_2.py | 197 +- ...stMultiRotation_MultiLevelCompound_v0_3.py | 254 +- ...stMultiRotation_MultiLevelCompound_v0_4.py | 265 +- ...tMultiRotation_MultiLevelCompound_v95_1.py | 193 +- ...tMultiRotation_MultiLevelCompound_v95_2.py | 189 +- ...tMultiRotation_MultiLevelCompound_v95_3.py | 263 +- ...tMultiRotation_MultiLevelCompound_v95_4.py | 273 +- .../Test/TestMultiRotation_Part.py | 4 +- .../Test/TestMultiTranslation_ErrorMsg.py | 21 +- ...ultiTranslation_MultiLevelCompound_v0_1.py | 227 +- ...ultiTranslation_MultiLevelCompound_v0_2.py | 239 +- ...ultiTranslation_MultiLevelCompound_v0_3.py | 262 +- ...ultiTranslation_MultiLevelCompound_v0_4.py | 277 +- ...ltiTranslation_MultiLevelCompound_v95_1.py | 193 +- ...ltiTranslation_MultiLevelCompound_v95_2.py | 204 +- ...ltiTranslation_MultiLevelCompound_v95_3.py | 271 +- ...ltiTranslation_MultiLevelCompound_v95_4.py | 281 +- .../Test/TestMultiTranslation_Part.py | 19 +- src/FeaturesPlugin/Test/TestNormalToFace.py | 38 +- src/FeaturesPlugin/Test/TestPartition.py | 90 +- .../Test/TestPartition2Faces.py | 58 +- .../Test/TestPartition2Solids.py | 125 +- .../Test/TestPartition2Wires.py | 113 +- .../Test/TestPartitionArgsUpdate.py | 588 ++- .../Test/TestPartitionBox4Planes.py | 14 +- .../Test/TestPartitionEdgeSolid.py | 31 +- .../Test/TestPartitionFace2Solid.py | 176 +- .../Test/TestPartitionFaceSolid.py | 119 +- .../Test/TestPartitionFaceWire.py | 132 +- .../Test/TestPartitionInclinedFaceSolid.py | 77 +- ...TestPartitionSubCompsolidWithCompSolid1.py | 34 +- ...TestPartitionSubCompsolidWithCompSolid2.py | 32 +- ...TestPartitionSubCompsolidWithCompSolid3.py | 33 +- .../TestPartitionSubCompsolidWithFace1.py | 48 +- .../TestPartitionSubCompsolidWithFace2.py | 48 +- .../TestPartitionSubCompsolidWithFace3.py | 48 +- .../TestPartitionSubCompsolidWithFace4.py | 49 +- .../TestPartitionSubCompsolidWithFace5.py | 49 +- .../TestPartitionSubCompsolidWithPlane1.py | 16 +- .../TestPartitionSubCompsolidWithPlane2.py | 16 +- .../TestPartitionSubCompsolidWithPlane3.py | 16 +- .../TestPartitionSubCompsolidWithPlane4.py | 14 +- .../TestPartitionSubCompsolidWithPlane5.py | 14 +- .../TestPartitionSubCompsolidWithSolid1.py | 13 +- .../TestPartitionSubCompsolidWithSolid2.py | 14 +- .../TestPartitionSubCompsolidWithSolid3.py | 14 +- .../TestPartitionSubCompsolidWithSolid4.py | 14 +- .../TestPartitionSubCompsolidWithSolid5.py | 14 +- .../Test/TestPartitionWireFaceSolid.py | 103 +- .../Test/TestPartition_ErrorMsg.py | 29 +- .../TestPartition_MultiLevelCompound_v0_1.py | 136 +- .../TestPartition_MultiLevelCompound_v0_2.py | 177 +- .../TestPartition_MultiLevelCompound_v0_3.py | 141 +- ...artition_MultiLevelCompound_v20190506_1.py | 137 +- ...artition_MultiLevelCompound_v20190506_2.py | 178 +- ...artition_MultiLevelCompound_v20190506_3.py | 143 +- .../Test/TestPartition_SolidsHistory.py | 125 +- src/FeaturesPlugin/Test/TestPipe.py | 9 +- src/FeaturesPlugin/Test/TestPipe_Compound.py | 14 +- .../Test/TestPipe_DoNotMovePath.py | 300 +- src/FeaturesPlugin/Test/TestPipe_Edge.py | 27 +- src/FeaturesPlugin/Test/TestPipe_ErrorMsg.py | 10 +- src/FeaturesPlugin/Test/TestPipe_Wire.py | 48 +- .../Test/TestPlacement_BodyShapesValidator.py | 11 +- .../Test/TestPlacement_Complex.py | 94 +- .../Test/TestPlacement_Edge_Edge.py | 53 +- .../Test/TestPlacement_Edge_Vertex.py | 53 +- .../Test/TestPlacement_ErrorMsg.py | 69 +- .../Test/TestPlacement_Face_Edge.py | 52 +- .../Test/TestPlacement_Face_Face.py | 51 +- .../Test/TestPlacement_Face_Vertex.py | 52 +- .../TestPlacement_MultiLevelCompound_v0_1.py | 161 +- .../TestPlacement_MultiLevelCompound_v0_2.py | 161 +- .../TestPlacement_MultiLevelCompound_v0_3.py | 164 +- .../TestPlacement_MultiLevelCompound_v0_4.py | 169 +- .../TestPlacement_MultiLevelCompound_v0_5.py | 270 +- .../TestPlacement_MultiLevelCompound_v0_6.py | 281 +- .../TestPlacement_MultiLevelCompound_v95_1.py | 171 +- .../TestPlacement_MultiLevelCompound_v95_2.py | 172 +- .../TestPlacement_MultiLevelCompound_v95_3.py | 191 +- .../TestPlacement_MultiLevelCompound_v95_4.py | 181 +- .../TestPlacement_MultiLevelCompound_v95_5.py | 263 +- .../TestPlacement_MultiLevelCompound_v95_6.py | 273 +- .../Test/TestPlacement_Part_Part.py | 17 +- .../Test/TestPlacement_Vertex_Vertex.py | 32 +- src/FeaturesPlugin/Test/TestPointCloud.py | 8 +- .../Test/TestPointCoordinates.py | 40 +- src/FeaturesPlugin/Test/TestRecover.py | 12 +- src/FeaturesPlugin/Test/TestRecover1798.py | 351 +- .../Test/TestRecover_Compound.py | 53 +- .../Test/TestRecover_Compsolid1.py | 86 +- .../Test/TestRecover_Compsolid2.py | 22 +- .../Test/TestRemoveResultsBody.py | 14 +- .../Test/TestRemoveResultsConstruction.py | 19 +- .../Test/TestRemoveResultsPart.py | 3 +- .../Test/TestRemoveSubShapes.py | 31 +- .../Test/TestRemoveSubShapes2.py | 18 +- .../Test/TestRemoveSubShapes3.py | 99 +- .../Test/TestRemoveSubShapes4.py | 71 +- .../Test/TestRemoveSubShapes5.py | 80 +- .../Test/TestRemoveSubShapes6.py | 76 +- src/FeaturesPlugin/Test/TestRevolution.py | 110 +- src/FeaturesPlugin/Test/TestRevolutionCut.py | 64 +- .../Test/TestRevolutionCut_ByAngle.py | 36 +- .../TestRevolutionCut_ByPlanesAndOffsets.py | 43 +- .../Test/TestRevolutionCut_ThroughAll.py | 68 +- src/FeaturesPlugin/Test/TestRevolutionFuse.py | 72 +- .../Test/TestRevolutionFuse_ByAngle.py | 36 +- .../TestRevolutionFuse_ByPlanesAndOffsets.py | 43 +- .../Test/TestRevolutionFuse_ThroughAll.py | 68 +- .../Test/TestRevolutionOfCompound.py | 54 +- .../Test/TestRevolutionOfEdge.py | 22 +- .../Test/TestRevolutionOfPoint.py | 36 +- .../Test/TestRevolution_ByAngle.py | 24 +- src/FeaturesPlugin/Test/TestRotation.py | 55 +- .../Test/TestRotation_ByAxis.py | 27 +- .../Test/TestRotation_ByPoints.py | 28 +- .../Test/TestRotation_ErrorMsg.py | 17 +- .../TestRotation_MultiLevelCompound_v0_1.py | 197 +- .../TestRotation_MultiLevelCompound_v0_2.py | 205 +- .../TestRotation_MultiLevelCompound_v0_3.py | 254 +- .../TestRotation_MultiLevelCompound_v0_4.py | 289 +- .../TestRotation_MultiLevelCompound_v95_1.py | 189 +- .../TestRotation_MultiLevelCompound_v95_2.py | 223 +- .../TestRotation_MultiLevelCompound_v95_3.py | 263 +- .../TestRotation_MultiLevelCompound_v95_4.py | 273 +- src/FeaturesPlugin/Test/TestScale1.py | 30 +- src/FeaturesPlugin/Test/TestScale2.py | 33 +- .../Test/TestScale_MultiLevelCompound_v0_1.py | 206 +- .../Test/TestScale_MultiLevelCompound_v0_2.py | 226 +- .../Test/TestScale_MultiLevelCompound_v0_3.py | 286 +- .../Test/TestScale_MultiLevelCompound_v0_4.py | 345 +- .../TestScale_MultiLevelCompound_v95_1.py | 204 +- .../TestScale_MultiLevelCompound_v95_2.py | 244 +- .../TestScale_MultiLevelCompound_v95_3.py | 295 +- .../TestScale_MultiLevelCompound_v95_4.py | 273 +- .../Test/TestScriptSolidEdge.py | 24 +- src/FeaturesPlugin/Test/TestSerialBoolean.py | 83 +- src/FeaturesPlugin/Test/TestSewing_Groups.py | 81 +- .../Test/TestSewing_Manifold.py | 110 +- .../Test/TestSewing_NonManifold.py | 38 +- .../Test/TestSplitCompFaceSolid.py | 71 +- .../Test/TestSplitCompsolidPlane.py | 25 +- src/FeaturesPlugin/Test/TestSplitEdgeEdge.py | 32 +- .../Test/TestSplitEdgeEdgeIntersected.py | 20 +- src/FeaturesPlugin/Test/TestSplitEdgeFace.py | 58 +- src/FeaturesPlugin/Test/TestSplitEdgeShell.py | 66 +- src/FeaturesPlugin/Test/TestSplitEdgeSolid.py | 24 +- .../Test/TestSplitEdgeSolidIntersected.py | 33 +- .../Test/TestSplitEdgeVertex.py | 20 +- src/FeaturesPlugin/Test/TestSplitEdgeWire.py | 51 +- src/FeaturesPlugin/Test/TestSplitFaceEdge.py | 62 +- .../Test/TestSplitFaceEdgeInside.py | 76 +- .../Test/TestSplitFaceEdgePerpendicular.py | 73 +- src/FeaturesPlugin/Test/TestSplitFaceFace.py | 114 +- src/FeaturesPlugin/Test/TestSplitFaceShell.py | 155 +- src/FeaturesPlugin/Test/TestSplitFaceSolid.py | 61 +- .../Test/TestSplitFaceVertex.py | 51 +- src/FeaturesPlugin/Test/TestSplitFaceWire.py | 109 +- .../Test/TestSplitShellConstrPlane.py | 66 +- src/FeaturesPlugin/Test/TestSplitShellEdge.py | 70 +- src/FeaturesPlugin/Test/TestSplitShellFace.py | 155 +- .../Test/TestSplitShellShell.py | 174 +- .../Test/TestSplitShellSolid.py | 76 +- .../Test/TestSplitShellVertex.py | 60 +- src/FeaturesPlugin/Test/TestSplitShellWire.py | 118 +- .../Test/TestSplitSolid2ConstructionPlanes.py | 21 +- .../Test/TestSplitSolidCompFace.py | 71 +- .../Test/TestSplitSolidCompShell.py | 84 +- src/FeaturesPlugin/Test/TestSplitSolidEdge.py | 24 +- src/FeaturesPlugin/Test/TestSplitSolidFace.py | 61 +- .../Test/TestSplitSolidShell.py | 76 +- src/FeaturesPlugin/Test/TestSplitWireEdge.py | 55 +- src/FeaturesPlugin/Test/TestSplitWireFace.py | 121 +- src/FeaturesPlugin/Test/TestSplitWireShell.py | 155 +- src/FeaturesPlugin/Test/TestSplitWireSolid.py | 61 +- .../Test/TestSplitWireVertex.py | 46 +- src/FeaturesPlugin/Test/TestSplitWireWire.py | 114 +- .../TestSymmetry_MultiLevelCompound_v0_1.py | 259 +- .../TestSymmetry_MultiLevelCompound_v0_2.py | 289 +- .../TestSymmetry_MultiLevelCompound_v0_3.py | 281 +- .../TestSymmetry_MultiLevelCompound_v0_4.py | 255 +- .../TestSymmetry_MultiLevelCompound_v0_5.py | 265 +- .../TestSymmetry_MultiLevelCompound_v95_1.py | 257 +- .../TestSymmetry_MultiLevelCompound_v95_2.py | 244 +- .../TestSymmetry_MultiLevelCompound_v95_3.py | 246 +- .../TestSymmetry_MultiLevelCompound_v95_4.py | 264 +- .../TestSymmetry_MultiLevelCompound_v95_5.py | 273 +- src/FeaturesPlugin/Test/TestSymmetry_Part.py | 21 +- src/FeaturesPlugin/Test/TestTranslation.py | 55 +- ...TestTranslation_MultiLevelCompound_v0_1.py | 201 +- ...TestTranslation_MultiLevelCompound_v0_2.py | 195 +- ...TestTranslation_MultiLevelCompound_v0_3.py | 209 +- ...TestTranslation_MultiLevelCompound_v0_4.py | 254 +- ...TestTranslation_MultiLevelCompound_v0_5.py | 265 +- ...estTranslation_MultiLevelCompound_v95_1.py | 189 +- ...estTranslation_MultiLevelCompound_v95_2.py | 195 +- ...estTranslation_MultiLevelCompound_v95_3.py | 199 +- ...estTranslation_MultiLevelCompound_v95_4.py | 263 +- ...estTranslation_MultiLevelCompound_v95_5.py | 273 +- .../Test/TestTranslation_Part.py | 19 +- src/FeaturesPlugin/Test/TestUnion.py | 35 +- .../Test/TestUnion4CurvedFaces.py | 58 +- .../Test/TestUnion4CurvedFaces_2.py | 54 +- src/FeaturesPlugin/Test/TestUnion4Faces.py | 128 +- src/FeaturesPlugin/Test/TestUnionFaces.py | 24 +- .../Test/TestUnionFaces_v20190506.py | 25 +- src/FeaturesPlugin/Test/TestUnionOfUnion.py | 28 +- src/FeaturesPlugin/Test/TestUnion_ErrorMsg.py | 14 +- .../Test/TestUnion_MultiLevelCompound_v0.py | 108 +- .../TestUnion_MultiLevelCompound_v20190506.py | 110 +- .../doc/examples/angularcopy.py | 16 +- src/FeaturesPlugin/doc/examples/bool_split.py | 18 +- src/FeaturesPlugin/doc/examples/chamfer1.py | 4 +- src/FeaturesPlugin/doc/examples/chamfer2.py | 7 +- .../doc/examples/check_shared_faces.py | 15 +- src/FeaturesPlugin/doc/examples/common.py | 18 +- src/FeaturesPlugin/doc/examples/copy.py | 17 +- .../doc/examples/create_bounding_box.py | 9 +- .../create_normal_to_face_at_vertex.py | 9 +- src/FeaturesPlugin/doc/examples/cut.py | 18 +- .../doc/examples/defeaturing.py | 17 +- .../examples/extrusion_by_bounding_planes.py | 36 +- .../doc/examples/extrusion_by_sizes.py | 8 +- .../extrusion_cut_by_bounding_planes.py | 18 +- .../doc/examples/extrusion_cut_by_sizes.py | 12 +- .../doc/examples/extrusion_cut_through_all.py | 10 +- .../extrusion_fuse_by_bounding_planes.py | 18 +- .../doc/examples/extrusion_fuse_by_sizes.py | 12 +- .../examples/extrusion_fuse_through_all.py | 36 +- src/FeaturesPlugin/doc/examples/fillet1.py | 6 +- .../doc/examples/fillet1d_vertices.py | 16 +- .../doc/examples/fillet1d_wire.py | 10 +- src/FeaturesPlugin/doc/examples/fillet2.py | 4 +- src/FeaturesPlugin/doc/examples/fuse.py | 18 +- src/FeaturesPlugin/doc/examples/fuse_faces.py | 89 +- .../doc/examples/geometry_calculation.py | 6 +- src/FeaturesPlugin/doc/examples/glue_faces.py | 15 +- .../doc/examples/import_result.py | 12 +- .../doc/examples/intersection.py | 17 +- .../doc/examples/limit_tolerance.py | 44 +- src/FeaturesPlugin/doc/examples/linearcopy.py | 11 +- src/FeaturesPlugin/doc/examples/loft.py | 36 +- src/FeaturesPlugin/doc/examples/partition.py | 16 +- .../doc/examples/pipe_binormal.py | 54 +- .../doc/examples/pipe_locations.py | 58 +- .../doc/examples/pipe_simple.py | 30 +- src/FeaturesPlugin/doc/examples/placement.py | 17 +- .../doc/examples/point_coordinates.py | 4 +- .../doc/examples/recover_compound.py | 24 +- .../doc/examples/recover_default.py | 24 +- .../doc/examples/remove_subshapes.py | 13 +- .../doc/examples/revolution_by_angles.py | 12 +- .../examples/revolution_by_bounding_planes.py | 16 +- .../doc/examples/revolution_cut_by_angles.py | 9 +- .../revolution_cut_by_bounding_planes.py | 11 +- .../examples/revolution_cut_through_all.py | 7 +- .../doc/examples/revolution_fuse_by_angles.py | 9 +- .../revolution_fuse_by_bounding_planes.py | 11 +- .../examples/revolution_fuse_through_all.py | 7 +- src/FeaturesPlugin/doc/examples/rotation1.py | 16 +- src/FeaturesPlugin/doc/examples/rotation2.py | 17 +- src/FeaturesPlugin/doc/examples/scaleXYZ.py | 9 +- .../doc/examples/scalefactor.py | 15 +- src/FeaturesPlugin/doc/examples/sewing.py | 52 +- src/FeaturesPlugin/doc/examples/smash.py | 18 +- .../doc/examples/symmetryaxis.py | 18 +- .../doc/examples/symmetryplane.py | 15 +- .../doc/examples/symmetrypoint.py | 15 +- .../doc/examples/translation2points.py | 16 +- .../doc/examples/translationDXDYDZ.py | 13 +- .../doc/examples/translationvector.py | 19 +- src/FeaturesPlugin/doc/examples/union.py | 49 +- .../FiltersPlugin_TopoConnectedFaces.py | 198 +- src/FiltersPlugin/Test/Test17924.py | 113 +- src/FiltersPlugin/Test/Test17962.py | 97 +- src/FiltersPlugin/Test/Test19190.py | 104 +- src/FiltersPlugin/Test/Test2946.py | 528 +- src/FiltersPlugin/Test/Test2951.py | 484 +- src/FiltersPlugin/Test/Test3241.py | 79 +- .../Test/TestFilter_BelongsTo.py | 75 +- .../Test/TestFilter_BelongsTo_Exclude.py | 76 +- .../Test/TestFilter_ContinuousFaces.py | 58 +- src/FiltersPlugin/Test/TestFilter_EdgeSize.py | 50 +- .../Test/TestFilter_ExternalFaces1.py | 69 +- .../Test/TestFilter_ExternalFaces2.py | 86 +- .../Test/TestFilter_ExternalFaces_Exclude1.py | 71 +- .../Test/TestFilter_ExternalFaces_Exclude2.py | 88 +- src/FiltersPlugin/Test/TestFilter_FaceSize.py | 59 +- .../Test/TestFilter_FeatureEdges.py | 63 +- .../Test/TestFilter_HorizontalFaces.py | 40 +- .../TestFilter_HorizontalFaces_Exclude.py | 42 +- .../Test/TestFilter_OnGeometry_Edge1.py | 212 +- .../Test/TestFilter_OnGeometry_Edge2.py | 289 +- .../TestFilter_OnGeometry_Exclude_Edge1.py | 213 +- .../TestFilter_OnGeometry_Exclude_Edge2.py | 290 +- .../TestFilter_OnGeometry_Exclude_Face1.py | 103 +- .../TestFilter_OnGeometry_Exclude_Face2.py | 168 +- .../TestFilter_OnGeometry_Exclude_Face3.py | 164 +- .../TestFilter_OnGeometry_Exclude_Face4.py | 58 +- .../Test/TestFilter_OnGeometry_Face1.py | 102 +- .../Test/TestFilter_OnGeometry_Face2.py | 167 +- .../Test/TestFilter_OnGeometry_Face3.py | 162 +- .../Test/TestFilter_OnGeometry_Face4.py | 54 +- src/FiltersPlugin/Test/TestFilter_OnLine.py | 262 +- .../Test/TestFilter_OnLine_Exclude.py | 263 +- .../Test/TestFilter_OnLine_Multi.py | 24 +- src/FiltersPlugin/Test/TestFilter_OnPlane.py | 256 +- .../TestFilter_OnPlaneSide_Exclude_Face.py | 419 +- .../TestFilter_OnPlaneSide_Exclude_Plane.py | 415 +- .../Test/TestFilter_OnPlaneSide_Face.py | 418 +- .../Test/TestFilter_OnPlaneSide_Multi.py | 193 +- .../Test/TestFilter_OnPlaneSide_Plane.py | 411 +- .../Test/TestFilter_OnPlane_Exclude.py | 257 +- .../Test/TestFilter_OnPlane_Multi.py | 364 +- .../Test/TestFilter_OnShapeName.py | 243 +- .../Test/TestFilter_OppositeToEdge.py | 369 +- .../Test/TestFilter_OppositeToEdge_Exclude.py | 370 +- .../TestFilter_RelativeToSolid_Exclude_In.py | 472 +- ...tFilter_RelativeToSolid_Exclude_InAndOn.py | 488 +- ...estFilter_RelativeToSolid_Exclude_NotOn.py | 480 +- .../TestFilter_RelativeToSolid_Exclude_On.py | 488 +- .../TestFilter_RelativeToSolid_Exclude_Out.py | 480 +- ...Filter_RelativeToSolid_Exclude_OutAndOn.py | 496 +- .../Test/TestFilter_RelativeToSolid_In.py | 495 +- .../TestFilter_RelativeToSolid_InAndOn.py | 479 +- .../Test/TestFilter_RelativeToSolid_Multi.py | 66 +- .../Test/TestFilter_RelativeToSolid_NotOn.py | 487 +- .../Test/TestFilter_RelativeToSolid_On.py | 479 +- .../Test/TestFilter_RelativeToSolid_Out.py | 487 +- .../TestFilter_RelativeToSolid_OutAndOn.py | 471 +- .../TestFilter_TopoConnectedFaces_Edge1.py | 78 +- .../TestFilter_TopoConnectedFaces_Edge2.py | 91 +- .../TestFilter_TopoConnectedFaces_Edge3.py | 69 +- ...Filter_TopoConnectedFaces_Exclude_Edge1.py | 79 +- ...Filter_TopoConnectedFaces_Exclude_Edge2.py | 92 +- ...Filter_TopoConnectedFaces_Exclude_Edge3.py | 70 +- ...Filter_TopoConnectedFaces_Exclude_Face1.py | 90 +- ...Filter_TopoConnectedFaces_Exclude_Face2.py | 118 +- ...Filter_TopoConnectedFaces_Exclude_Face3.py | 64 +- ...lter_TopoConnectedFaces_Exclude_Vertex1.py | 79 +- ...lter_TopoConnectedFaces_Exclude_Vertex2.py | 121 +- ...lter_TopoConnectedFaces_Exclude_Vertex3.py | 67 +- .../TestFilter_TopoConnectedFaces_Face1.py | 89 +- .../TestFilter_TopoConnectedFaces_Face2.py | 117 +- .../TestFilter_TopoConnectedFaces_Face3.py | 63 +- .../TestFilter_TopoConnectedFaces_Multi.py | 174 +- ...estFilter_TopoConnectedFaces_Prop_Edge1.py | 64 +- ...estFilter_TopoConnectedFaces_Prop_Edge2.py | 63 +- ...estFilter_TopoConnectedFaces_Prop_Edge3.py | 64 +- ...r_TopoConnectedFaces_Prop_Exclude_Edge1.py | 65 +- ...r_TopoConnectedFaces_Prop_Exclude_Edge2.py | 64 +- ...r_TopoConnectedFaces_Prop_Exclude_Edge3.py | 65 +- ...r_TopoConnectedFaces_Prop_Exclude_Face1.py | 62 +- ...r_TopoConnectedFaces_Prop_Exclude_Face2.py | 62 +- ...r_TopoConnectedFaces_Prop_Exclude_Face3.py | 59 +- ...TopoConnectedFaces_Prop_Exclude_Vertex1.py | 65 +- ...TopoConnectedFaces_Prop_Exclude_Vertex2.py | 65 +- ...TopoConnectedFaces_Prop_Exclude_Vertex3.py | 62 +- ...estFilter_TopoConnectedFaces_Prop_Face1.py | 61 +- ...estFilter_TopoConnectedFaces_Prop_Face2.py | 61 +- ...estFilter_TopoConnectedFaces_Prop_Face3.py | 58 +- ...tFilter_TopoConnectedFaces_Prop_Vertex1.py | 64 +- ...tFilter_TopoConnectedFaces_Prop_Vertex2.py | 64 +- ...tFilter_TopoConnectedFaces_Prop_Vertex3.py | 61 +- .../TestFilter_TopoConnectedFaces_Vertex1.py | 78 +- .../TestFilter_TopoConnectedFaces_Vertex2.py | 120 +- .../TestFilter_TopoConnectedFaces_Vertex3.py | 66 +- .../Test/TestFilter_VerticalFaces.py | 40 +- .../Test/TestFilter_VerticalFaces_Exclude.py | 42 +- .../Test/TestFilter_VolumeSize.py | 65 +- src/FiltersPlugin/Test/TestFilters.py | 21 +- .../Test/TestFilters_FilterName.py | 8 +- .../Test/TestFilters_IsReversed.py | 35 +- src/FiltersPlugin/Test/TestFilters_Mixed1.py | 81 +- src/FiltersPlugin/Test/TestFilters_Mixed2.py | 303 +- src/FiltersPlugin/Test/TestFilters_Remove.py | 329 +- src/FiltersPlugin/Test/TestFilters_Select.py | 27 +- .../Test/TestFilters_Supported.py | 80 +- .../Test/TestFilters_Validator.py | 17 +- src/FiltersPlugin/Test/TestFilters_Xml.py | 28 +- src/GDMLPlugin/Test/TestCone.py | 2 +- src/GDMLPlugin/Test/TestEllipsoid.py | 14 +- src/GDMLPlugin/doc/examples/cone.py | 2 +- src/GeomAPI/Test/Test2675.py | 151 +- src/GeomAPI/Test/Test2879.py | 39 +- src/GeomAPI/Test/TestAx123.py | 48 +- src/GeomAPI/Test/TestBox.py | 281 +- src/GeomAPI/Test/TestBuilders.py | 52 +- src/GeomAPI/Test/TestCone.py | 714 ++- src/GeomAPI/Test/TestCylinder.py | 392 +- src/GeomAPI/Test/TestEllipse2d.py | 32 +- src/GeomAPI/Test/TestLine.py | 10 +- src/GeomAPI/Test/TestPlanarEdge.py | 15 +- src/GeomAPI/Test/TestPolygon.py | 52 +- src/GeomAPI/Test/TestSphere.py | 206 +- src/GeomAPI/Test/TestTorus.py | 175 +- src/GeomDataAPI/Test/TestConstants.py | 11 +- src/Locale/Test/TestUTF8.py | 17 +- src/ModelAPI/Test/Test1064.py | 51 +- src/ModelAPI/Test/Test1512.py | 87 +- src/ModelAPI/Test/Test1562.py | 135 +- src/ModelAPI/Test/Test1757.py | 202 +- src/ModelAPI/Test/Test19019_1.py | 44 +- src/ModelAPI/Test/Test19019_2.py | 1152 ++++- src/ModelAPI/Test/Test19031.py | 426 +- src/ModelAPI/Test/Test19058.py | 595 ++- src/ModelAPI/Test/Test19217.py | 25 +- src/ModelAPI/Test/Test19707.py | 99 +- src/ModelAPI/Test/Test19726.py | 36 +- src/ModelAPI/Test/Test19912.py | 30 +- src/ModelAPI/Test/Test19932.py | 38 +- src/ModelAPI/Test/Test1995.py | 65 +- src/ModelAPI/Test/Test1998.py | 14 +- src/ModelAPI/Test/Test19989.py | 46 +- src/ModelAPI/Test/Test20170.py | 39 +- src/ModelAPI/Test/Test2170.py | 94 +- src/ModelAPI/Test/Test2228.py | 145 +- src/ModelAPI/Test/Test2241.py | 457 +- src/ModelAPI/Test/Test2252.py | 56 +- src/ModelAPI/Test/Test2276.py | 30 +- src/ModelAPI/Test/Test2358_1.py | 63 +- src/ModelAPI/Test/Test2358_2.py | 231 +- src/ModelAPI/Test/Test2389.py | 60 +- src/ModelAPI/Test/Test2391.py | 412 +- src/ModelAPI/Test/Test2396.py | 88 +- src/ModelAPI/Test/Test2401.py | 134 +- src/ModelAPI/Test/Test2413.py | 107 +- src/ModelAPI/Test/Test2491.py | 110 +- src/ModelAPI/Test/Test2493.py | 372 +- src/ModelAPI/Test/Test2496.py | 54 +- src/ModelAPI/Test/Test2510.py | 866 +++- src/ModelAPI/Test/Test2607.py | 42 +- src/ModelAPI/Test/Test2627.py | 141 +- src/ModelAPI/Test/Test26745.py | 345 +- src/ModelAPI/Test/Test2685.py | 58 +- src/ModelAPI/Test/Test2828.py | 47 +- src/ModelAPI/Test/Test2859.py | 643 ++- src/ModelAPI/Test/Test2873.py | 33 +- src/ModelAPI/Test/Test2901.py | 136 +- src/ModelAPI/Test/Test2903.py | 41 +- src/ModelAPI/Test/Test3020.py | 26 +- src/ModelAPI/Test/Test3116.py | 9 +- src/ModelAPI/Test/TestBlockRecalculation.py | 155 +- src/ModelAPI/Test/TestConstants.py | 17 +- src/ModelAPI/Test/TestContainerSelector.py | 12 +- .../Test/TestCustomName_BooleanCut.py | 97 +- .../Test/TestCustomName_CommonCompSolid.py | 56 +- .../Test/TestCustomName_CutCompSolid.py | 119 +- src/ModelAPI/Test/TestCustomName_CutGroup.py | 174 +- .../Test/TestCustomName_DefaultName.py | 8 +- .../Test/TestCustomName_ExtrudeFace.py | 42 +- .../Test/TestCustomName_ExtrusionCut.py | 75 +- .../Test/TestCustomName_ExtrusionCutFace.py | 21 +- .../Test/TestCustomName_MultiTranslation.py | 43 +- src/ModelAPI/Test/TestCustomName_Partition.py | 26 +- src/ModelAPI/Test/TestCustomName_Placement.py | 90 +- src/ModelAPI/Test/TestCustomName_Recover.py | 30 +- src/ModelAPI/Test/TestCustomName_Rename.py | 44 +- .../Test/TestCustomName_RotateGroup.py | 85 +- .../Test/TestCustomName_Translation.py | 26 +- src/ModelAPI/Test/TestDocument.py | 71 +- src/ModelAPI/Test/TestDoubleArray.py | 18 +- src/ModelAPI/Test/TestExternalConstruction.py | 22 +- src/ModelAPI/Test/TestFeatureSelection_1.py | 14 +- src/ModelAPI/Test/TestFeatureSelection_2.py | 54 +- src/ModelAPI/Test/TestFolder_Create.py | 68 +- src/ModelAPI/Test/TestFolder_CustomName.py | 56 +- src/ModelAPI/Test/TestFolder_Empty.py | 54 +- src/ModelAPI/Test/TestFolder_Remove.py | 189 +- src/ModelAPI/Test/TestFolder_Sketch.py | 174 +- src/ModelAPI/Test/TestFolder_Stability.py | 58 +- src/ModelAPI/Test/TestFolder_Update.py | 497 +- .../Test/TestGeomNamingBoxWithFillet.py | 136 +- .../Test/TestGeomNamingEdgeByFilter.py | 34 +- src/ModelAPI/Test/TestGeomNamingPlacement.py | 138 +- src/ModelAPI/Test/TestGeomNamingRevolution.py | 103 +- .../Test/TestGeomNamingSketchPlane.py | 175 +- src/ModelAPI/Test/TestIntArray.py | 14 +- src/ModelAPI/Test/TestMovePart1.py | 146 +- src/ModelAPI/Test/TestMovePart2.py | 89 +- src/ModelAPI/Test/TestResults.py | 33 +- src/ModelAPI/Test/TestSaveOpen1.py | 30 +- src/ModelAPI/Test/TestSaveOpen2.py | 84 +- .../Test/TestSelectionCircleCenter.py | 96 +- src/ModelAPI/Test/TestSelectionInPart.py | 300 +- .../Test/TestSelectionInitialization.py | 40 +- src/ModelAPI/Test/TestSelectionRestore.py | 580 ++- src/ModelAPI/Test/TestSelectionScope.py | 133 +- src/ModelAPI/Test/TestSelectorShell.py | 9 +- src/ModelAPI/Test/TestUndoRedo.py | 29 +- src/ModelAPI/Test/TestWeakNaming2125.py | 127 +- src/ModelAPI/Test/TestWeakNaming2222.py | 571 ++- src/ModelAPI/Test/TestWeakNaming2245.py | 44 +- src/ModelAPI/Test/TestWeakNaming2247.py | 78 +- src/ModelAPI/Test/TestWeakNaming2248.py | 76 +- src/ModelAPI/Test/TestWeakNaming2261.py | 127 +- src/ModelAPI/Test/TestWeakNaming2291.py | 105 +- src/ModelAPI/Test/TestWeakNaming2335.py | 13 +- src/ModelAPI/Test/TestWeakNaming2375.py | 468 +- src/ModelAPI/Test/TestWeakNaming2437.py | 308 +- src/ModelAPI/Test/TestWeakNaming2445.py | 178 +- src/ModelAPI/Test/TestWeakNaming2446.py | 38 +- src/ModelAPI/Test/TestWeakNaming2452.py | 194 +- src/ModelAPI/Test/TestWeakNamingSortOrder.py | 71 +- src/ModelGeomAlgo/Test/TestPoint2D.py | 7 +- src/ModelHighAPI/Test/Test18451.py | 824 ++- src/ModelHighAPI/Test/Test19031.py | 899 +++- src/ModelHighAPI/Test/Test19990_1.py | 55 +- src/ModelHighAPI/Test/Test19990_2.py | 6 +- src/ModelHighAPI/Test/Test20167.py | 734 ++- src/ModelHighAPI/Test/Test2488.py | 252 +- src/ModelHighAPI/Test/TestDeflectionDump.py | 14 +- src/ModelHighAPI/Test/TestDouble.py | 4 +- src/ModelHighAPI/Test/TestInteger.py | 2 +- src/ModelHighAPI/Test/TestRefAttr.py | 3 +- src/ModelHighAPI/Test/TestReference.py | 3 +- src/ModelHighAPI/Test/TestSetColors.py | 14 +- src/ModelHighAPI/Test/TestUndoRedo.py | 6 +- src/ParametersPlugin/Test/Test1806.py | 21 +- src/ParametersPlugin/Test/Test19036.py | 8 +- src/ParametersPlugin/Test/Test2392.py | 16 +- src/ParametersPlugin/Test/Test2474.py | 34 +- .../Test/TestImportInvalidParameters.py | 2 +- .../Test/TestImportParameters.py | 6 +- .../Test/TestParameterChangeValue.py | 50 +- .../Test/TestParameterCreation.py | 65 +- .../Test/TestParameterCreationError.py | 6 +- .../Test/TestParameterDelete.py | 11 +- .../Test/TestParameterErrorMsg.py | 8 +- .../Test/TestParameterRename.py | 71 +- .../Test/TestParametersMgr.py | 8 +- .../Test/TestQuotesInComment.py | 10 +- src/PartSetAPI/Test/TestRemoveDuplicate.py | 18 +- src/PrimitivesPlugin/doc/examples/box2.py | 6 +- src/PrimitivesPlugin/doc/examples/cone.py | 9 +- .../doc/examples/cylinder1.py | 8 +- .../doc/examples/cylinder2.py | 9 +- src/PrimitivesPlugin/doc/examples/sphere2.py | 2 +- src/PrimitivesPlugin/doc/examples/torus.py | 8 +- src/PythonAPI/Test/Test2044.py | 35 +- src/PythonAPI/Test/TestAddRectangle.py | 2 +- src/PythonAPI/Test/TestCR.py | 100 +- src/PythonAPI/Test/TestFeatures.py | 18 +- src/PythonAPI/Test/TestFeaturesExtrusion.py | 71 +- src/PythonAPI/Test/TestFeaturesRevolution.py | 70 +- src/PythonAPI/Test/TestModel.py | 4 +- src/PythonAPI/Test/TestPrimitivesBox.py | 26 +- src/PythonAPI/Test/TestShapeInfo.py | 236 +- src/PythonAPI/Test/TestSketcher.py | 3 +- src/PythonAPI/Test/TestSketcherAddArc.py | 1 + src/PythonAPI/Test/TestSketcherAddCircle.py | 1 + src/PythonAPI/Test/TestSketcherAddLine.py | 3 +- src/PythonAPI/Test/TestSketcherAddMirror.py | 2 + src/PythonAPI/Test/TestSketcherAddPoint.py | 4 +- src/PythonAPI/Test/TestSketcherSetAngle.py | 29 +- .../Test/TestSketcherSetCoincident.py | 4 +- src/PythonAPI/Test/TestSketcherSetEqual.py | 18 +- src/PythonAPI/Test/TestSketcherSetFillet.py | 4 +- src/PythonAPI/Test/TestSketcherSetFixed.py | 2 + .../Test/TestSketcherSetHorizontal.py | 4 +- src/PythonAPI/Test/TestSketcherSetLength.py | 10 +- src/PythonAPI/Test/TestSketcherSetParallel.py | 4 +- .../Test/TestSketcherSetPerpendicular.py | 14 +- src/PythonAPI/Test/TestSketcherSetRadius.py | 4 +- src/PythonAPI/Test/TestSketcherSetTangent.py | 8 +- src/PythonAPI/Test/TestSketcherSetVertical.py | 4 +- src/PythonAPI/doc/source/conf.py | 187 +- src/PythonAPI/examples/MakeBrick1.py | 2 +- src/PythonAPI/examples/MakeBrick2.py | 2 +- src/PythonAPI/examples/Platine.py | 55 +- src/PythonAPI/geom/CanonicalRecognition.py | 52 +- src/PythonAPI/geom/ShapeInfo.py | 23 +- src/PythonAPI/geom/__init__.py | 20 +- src/PythonAPI/initConfig.py | 2 +- src/PythonAPI/model/__init__.py | 6 +- src/PythonAPI/model/addons/__init__.py | 2 +- src/PythonAPI/model/build/__init__.py | 13 +- src/PythonAPI/model/collection/__init__.py | 7 +- src/PythonAPI/model/connection/__init__.py | 2 +- src/PythonAPI/model/dump/DumpAssistant.py | 39 +- src/PythonAPI/model/exchange/tools.py | 7 +- src/PythonAPI/model/gdml/__init__.py | 1 - .../model/parameter/import_parameter.py | 19 +- src/PythonAPI/model/partset/__init__.py | 2 +- src/PythonAPI/model/roots.py | 5 +- src/PythonAPI/model/services/__init__.py | 80 +- src/PythonAPI/model/sketcher/tests.py | 157 +- src/PythonAPI/model/sketcher/tools.py | 30 +- src/PythonAPI/model/tests/__init__.py | 2 +- src/PythonAPI/model/tests/tests.py | 932 ++-- src/PythonAddons/Test/TestRectangle.py | 2 +- .../Test/TestRectangleCentered.py | 128 +- src/PythonAddons/Test/TestcompoundVertices.py | 6 +- src/PythonAddons/Test/TestimportParameters.py | 8 +- src/PythonAddons/Test/TestmidSurface_1.py | 26 +- src/PythonAddons/Test/TestmidSurface_2.py | 26 +- .../Test/TestpipeNetwork_2par2.py | 14 +- .../Test/TestpipeNetwork_parligne.py | 14 +- src/PythonAddons/__init__.py | 2 +- src/PythonAddons/addons_Features.py | 1 + src/PythonAddons/doc/examples/pipeNetwork.py | 7 +- .../doc/examples/rectangle/feature.py | 55 +- src/PythonAddons/macros/__init__.py | 2 +- .../macros/compoundVertices/__init__.py | 1 - .../macros/compoundVertices/feature.py | 41 +- .../macros/importParameters/__init__.py | 1 - .../macros/importParameters/feature.py | 41 +- .../macros/midSurface/__init__.py | 1 - src/PythonAddons/macros/midSurface/feature.py | 28 +- .../macros/midSurface/midSurface_1.py | 59 +- .../macros/midSurface/midSurface_2.py | 423 +- .../macros/midSurface/surfaceMediane.py | 4507 +++++++++-------- .../macros/pipeNetwork/__init__.py | 1 - .../macros/pipeNetwork/feature.py | 723 ++- src/PythonAddons/macros/rectangle/feature.py | 158 +- src/SketchAPI/Test/TestFreePoints.py | 32 +- src/SketchAPI/Test/TestSketch.py | 128 +- src/SketchPlugin/Test/Test1061.py | 12 +- src/SketchPlugin/Test/Test1577.py | 145 +- src/SketchPlugin/Test/Test1578.py | 356 +- src/SketchPlugin/Test/Test1673.py | 246 +- src/SketchPlugin/Test/Test1779.py | 331 +- src/SketchPlugin/Test/Test19089.py | 1109 +++- src/SketchPlugin/Test/Test19101.py | 29 +- src/SketchPlugin/Test/Test1924.py | 6 +- src/SketchPlugin/Test/Test1963.py | 124 +- src/SketchPlugin/Test/Test1966.py | 589 ++- src/SketchPlugin/Test/Test1967.py | 552 +- src/SketchPlugin/Test/Test2018.py | 41 +- src/SketchPlugin/Test/Test20274_1.py | 85 +- src/SketchPlugin/Test/Test20274_2.py | 76 +- src/SketchPlugin/Test/Test20274_3.py | 73 +- src/SketchPlugin/Test/Test2034_1.py | 32 +- src/SketchPlugin/Test/Test2034_2.py | 32 +- src/SketchPlugin/Test/Test2034_3.py | 60 +- src/SketchPlugin/Test/Test2062.py | 12 +- src/SketchPlugin/Test/Test2095.py | 24 +- src/SketchPlugin/Test/Test2115.py | 78 +- src/SketchPlugin/Test/Test2119.py | 222 +- src/SketchPlugin/Test/Test2134.py | 408 +- src/SketchPlugin/Test/Test2157.py | 24 +- src/SketchPlugin/Test/Test2157_2.py | 20 +- src/SketchPlugin/Test/Test2224.py | 22 +- src/SketchPlugin/Test/Test2229.py | 10 +- src/SketchPlugin/Test/Test2239.py | 50 +- src/SketchPlugin/Test/Test2273.py | 43 +- src/SketchPlugin/Test/Test2280.py | 20 +- src/SketchPlugin/Test/Test2287.py | 12 +- src/SketchPlugin/Test/Test2341.py | 278 +- src/SketchPlugin/Test/Test2376.py | 14 +- src/SketchPlugin/Test/Test2390.py | 159 +- src/SketchPlugin/Test/Test2393.py | 20 +- src/SketchPlugin/Test/Test24015.py | 34 +- src/SketchPlugin/Test/Test2425.py | 82 +- src/SketchPlugin/Test/Test2427.py | 188 +- src/SketchPlugin/Test/Test2440.py | 23 +- src/SketchPlugin/Test/Test2481.py | 30 +- src/SketchPlugin/Test/Test2654.py | 297 +- src/SketchPlugin/Test/Test2711.py | 46 +- src/SketchPlugin/Test/Test2741.py | 16 +- src/SketchPlugin/Test/Test2810.py | 6 +- src/SketchPlugin/Test/Test2824.py | 32 +- src/SketchPlugin/Test/Test2860.py | 14 +- src/SketchPlugin/Test/Test2894.py | 150 +- src/SketchPlugin/Test/Test3019.py | 68 +- src/SketchPlugin/Test/Test3087_1.py | 17 +- src/SketchPlugin/Test/Test3087_2.py | 21 +- src/SketchPlugin/Test/Test3132.py | 108 +- src/SketchPlugin/Test/Test3154.py | 26 +- src/SketchPlugin/Test/Test3170.py | 40 +- src/SketchPlugin/Test/Test3240.py | 25 +- src/SketchPlugin/Test/TestArcBehavior.py | 148 +- src/SketchPlugin/Test/TestBSplineAddPole.py | 93 +- .../Test/TestCenteredRectangle.py | 95 +- .../Test/TestChangeSketchPlane1.py | 46 +- .../Test/TestChangeSketchPlane2.py | 168 +- .../Test/TestChangeSketchPlane3.py | 38 +- .../Test/TestChangeSketchPlane4.py | 79 +- src/SketchPlugin/Test/TestConstraintAngle.py | 103 +- .../TestConstraintAngleBehaviorBackward_1.py | 77 +- .../TestConstraintAngleBehaviorBackward_2.py | 71 +- .../Test/TestConstraintAngleBehaviorDirect.py | 71 +- ...tConstraintAngleBehaviorSupplementary_1.py | 75 +- ...tConstraintAngleBehaviorSupplementary_2.py | 71 +- .../Test/TestConstraintAngleEllipse.py | 201 +- .../Test/TestConstraintAngle_v0_1.py | 837 ++- .../Test/TestConstraintAngle_v0_2.py | 837 ++- .../Test/TestConstraintAngle_v20191210_1.py | 837 ++- .../Test/TestConstraintAngle_v20191210_2.py | 837 ++- .../Test/TestConstraintCoincidence.py | 222 +- .../Test/TestConstraintCoincidenceBSpline.py | 284 +- .../Test/TestConstraintCoincidenceEllipse.py | 446 +- .../TestConstraintCoincidenceEllipticArc.py | 556 +- .../Test/TestConstraintCollinear.py | 307 +- .../Test/TestConstraintCollinearEllipse.py | 205 +- .../Test/TestConstraintDistance.py | 174 +- .../Test/TestConstraintDistanceBehavior.py | 43 +- .../Test/TestConstraintDistanceEllipse.py | 349 +- .../Test/TestConstraintDistanceHorizontal.py | 189 +- .../TestConstraintDistanceHorizontalZero.py | 199 +- .../Test/TestConstraintDistanceVertical.py | 189 +- .../TestConstraintDistanceVerticalZero.py | 199 +- .../Test/TestConstraintDistanceZero.py | 308 +- src/SketchPlugin/Test/TestConstraintEqual.py | 134 +- .../Test/TestConstraintEqualEllipse.py | 190 +- src/SketchPlugin/Test/TestConstraintFixed.py | 274 +- .../Test/TestConstraintHorizontal.py | 62 +- .../Test/TestConstraintHorizontalValidator.py | 41 +- src/SketchPlugin/Test/TestConstraintLength.py | 79 +- .../Test/TestConstraintMiddlePoint.py | 138 +- .../Test/TestConstraintMiddlePointOnArc.py | 509 +- .../TestConstraintMiddlePointOnEllipticArc.py | 677 +-- .../Test/TestConstraintParallel.py | 80 +- .../Test/TestConstraintPerpendicular.py | 86 +- .../TestConstraintPerpendicularArcLine.py | 28 +- .../TestConstraintPerpendicularEllipseLine.py | 84 +- src/SketchPlugin/Test/TestConstraintRadius.py | 108 +- .../Test/TestConstraintRadiusFailure.py | 2 +- .../Test/TestConstraintTangent.py | 210 +- .../Test/TestConstraintTangentBSpline.py | 910 ++-- .../Test/TestConstraintTangentEllipse.py | 670 +-- .../Test/TestConstraintTangentEllipticArc.py | 888 ++-- .../Test/TestConstraintVertical.py | 62 +- .../Test/TestCreateArcByCenterStartEnd.py | 156 +- .../Test/TestCreateArcByTangentEdge.py | 69 +- .../Test/TestCreateArcByThreePoints.py | 119 +- .../Test/TestCreateArcByTransversalLine.py | 58 +- .../Test/TestCreateArcChangeType.py | 137 +- src/SketchPlugin/Test/TestCreateBSpline.py | 341 +- .../Test/TestCreateBSplinePeriodic.py | 314 +- .../Test/TestCreateCircleByCenterAndPassed.py | 136 +- .../Test/TestCreateCircleByThreePoints.py | 147 +- .../Test/TestCreateCircleChangeType.py | 108 +- ...tCreateEllipseByCenterSemiaxisAndPassed.py | 669 +-- .../Test/TestCreateEllipseByExternal.py | 87 +- .../TestCreateEllipseByMajorAxisAndPassed.py | 630 ++- .../Test/TestCreateEllipticArc.py | 743 +-- .../Test/TestCreateEllipticArcByExternal.py | 171 +- .../Test/TestCreateMacroBSpline.py | 259 +- src/SketchPlugin/Test/TestCurveFitting1.py | 267 +- src/SketchPlugin/Test/TestCurveFitting2.py | 273 +- src/SketchPlugin/Test/TestCurveFitting3.py | 405 +- src/SketchPlugin/Test/TestCurveFitting4.py | 411 +- .../Test/TestDegeneratedGeometry.py | 32 +- src/SketchPlugin/Test/TestDistanceDump.py | 62 +- .../Test/TestDistanceSignedVsUnsigned01.py | 31 +- .../Test/TestDistanceSignedVsUnsigned02.py | 31 +- .../Test/TestDistanceSignedVsUnsigned03.py | 31 +- .../Test/TestDistanceSignedVsUnsigned04.py | 31 +- .../Test/TestDistanceSignedVsUnsigned05.py | 47 +- src/SketchPlugin/Test/TestEdgesOrder.py | 373 +- src/SketchPlugin/Test/TestFillet.py | 131 +- .../Test/TestFilletAfterFolder.py | 73 +- .../Test/TestFilletInteracting.py | 1269 ++--- src/SketchPlugin/Test/TestHighload.py | 36 +- .../Test/TestIntersectionChangeEdge.py | 207 +- .../Test/TestIntersectionWithCircle.py | 173 +- .../Test/TestIntersectionWithLine.py | 110 +- .../Test/TestIntersectionWithSpline.py | 182 +- src/SketchPlugin/Test/TestMirror.py | 147 +- src/SketchPlugin/Test/TestMoveArc.py | 613 ++- src/SketchPlugin/Test/TestMoveBSpline.py | 775 +-- .../Test/TestMoveBSplinePeriodic.py | 337 +- src/SketchPlugin/Test/TestMoveCircle.py | 234 +- src/SketchPlugin/Test/TestMoveEllipse.py | 482 +- src/SketchPlugin/Test/TestMoveEllipticArc.py | 621 ++- src/SketchPlugin/Test/TestMoveLine.py | 201 +- src/SketchPlugin/Test/TestMovePoint.py | 147 +- src/SketchPlugin/Test/TestMovementComplex.py | 448 +- src/SketchPlugin/Test/TestMultiRotation.py | 139 +- src/SketchPlugin/Test/TestMultiRotation01.py | 10 +- src/SketchPlugin/Test/TestMultiRotation02.py | 12 +- src/SketchPlugin/Test/TestMultiRotation03.py | 50 +- src/SketchPlugin/Test/TestMultiRotation04.py | 67 +- src/SketchPlugin/Test/TestMultiRotation05.py | 75 +- .../Test/TestMultiRotationWithParameter.py | 66 +- src/SketchPlugin/Test/TestMultiTranslation.py | 151 +- src/SketchPlugin/Test/TestOffset1.py | 128 +- src/SketchPlugin/Test/TestOffset2.py | 14 +- src/SketchPlugin/Test/TestOffset3.py | 61 +- src/SketchPlugin/Test/TestOffset4.py | 334 +- src/SketchPlugin/Test/TestPresentation.py | 239 +- src/SketchPlugin/Test/TestProjection.py | 118 +- .../Test/TestProjectionBSpline.py | 45 +- .../Test/TestProjectionBSplinePeriodic.py | 45 +- .../TestProjectionBSplinePeriodicError.py | 48 +- .../Test/TestProjectionEllipse.py | 61 +- .../Test/TestProjectionEllipticArc.py | 79 +- .../Test/TestProjectionIntoResult.py | 243 +- src/SketchPlugin/Test/TestProjectionUpdate.py | 4 +- .../Test/TestProjectionWithoutReference.py | 234 +- src/SketchPlugin/Test/TestRectangle1.py | 89 +- src/SketchPlugin/Test/TestRemainingDoF.py | 23 +- src/SketchPlugin/Test/TestRemoveBSpline.py | 82 +- .../Test/TestRemoveBSplinePeriodic.py | 82 +- src/SketchPlugin/Test/TestRemoveEllipse.py | 122 +- .../Test/TestRemoveEllipticArc.py | 134 +- src/SketchPlugin/Test/TestRemoveSketch.py | 12 +- .../Test/TestSignedDistancePointLine.py | 291 +- .../Test/TestSignedDistancePointPoint.py | 255 +- src/SketchPlugin/Test/TestSketchCopy01.py | 300 +- src/SketchPlugin/Test/TestSketchCopy02.py | 310 +- src/SketchPlugin/Test/TestSketchCopy03.py | 323 +- src/SketchPlugin/Test/TestSketchCopy04.py | 315 +- src/SketchPlugin/Test/TestSketchCopy05.py | 318 +- src/SketchPlugin/Test/TestSketchCopy06.py | 331 +- src/SketchPlugin/Test/TestSketchCopy07.py | 323 +- src/SketchPlugin/Test/TestSketchCopy08.py | 333 +- src/SketchPlugin/Test/TestSketchCopy09.py | 333 +- src/SketchPlugin/Test/TestSketchCopy10.py | 60 +- src/SketchPlugin/Test/TestSketchCopy11.py | 72 +- src/SketchPlugin/Test/TestSketchCopy12.py | 38 +- src/SketchPlugin/Test/TestSketchCopy13.py | 33 +- src/SketchPlugin/Test/TestSketchCopy14.py | 28 +- src/SketchPlugin/Test/TestSketchDrawer.py | 116 +- src/SketchPlugin/Test/TestSketchPointLine.py | 97 +- src/SketchPlugin/Test/TestSnowflake.py | 100 +- src/SketchPlugin/Test/TestSplit.py | 106 +- src/SketchPlugin/Test/TestSplitEllipse.py | 90 +- src/SketchPlugin/Test/TestSplitLine.py | 20 +- src/SketchPlugin/Test/TestSplitPreview.py | 45 +- src/SketchPlugin/Test/TestTrimArc01.py | 88 +- src/SketchPlugin/Test/TestTrimArc02.py | 94 +- src/SketchPlugin/Test/TestTrimArc03.py | 104 +- src/SketchPlugin/Test/TestTrimArc04.py | 104 +- src/SketchPlugin/Test/TestTrimArc05.py | 104 +- src/SketchPlugin/Test/TestTrimArc06.py | 102 +- src/SketchPlugin/Test/TestTrimArc07.py | 38 +- src/SketchPlugin/Test/TestTrimArc08.py | 30 +- src/SketchPlugin/Test/TestTrimCircle01.py | 76 +- src/SketchPlugin/Test/TestTrimCircle02.py | 76 +- src/SketchPlugin/Test/TestTrimCircle03.py | 90 +- src/SketchPlugin/Test/TestTrimCircle04.py | 90 +- src/SketchPlugin/Test/TestTrimCircle05.py | 100 +- .../Test/TestTrimCircleAndArc01.py | 138 +- src/SketchPlugin/Test/TestTrimEllipse.py | 88 +- src/SketchPlugin/Test/TestTrimLine01.py | 42 +- src/SketchPlugin/Test/TestTrimLine02.py | 76 +- src/SketchPlugin/Test/TestTrimLine03.py | 20 +- src/SketchPlugin/Test/TestTrimPreview.py | 13 +- src/SketchPlugin/Test/TestUpdateSketch.py | 62 +- src/SketchPlugin/doc/examples/angle.py | 6 +- .../doc/examples/approximation.py | 20 +- src/SketchPlugin/doc/examples/bspline.py | 39 +- src/SketchPlugin/doc/examples/coincident.py | 4 +- src/SketchPlugin/doc/examples/collinear.py | 4 +- src/SketchPlugin/doc/examples/distance.py | 6 +- src/SketchPlugin/doc/examples/elliptic_arc.py | 34 +- src/SketchPlugin/doc/examples/equal.py | 4 +- src/SketchPlugin/doc/examples/fillet.py | 4 +- src/SketchPlugin/doc/examples/fixed.py | 2 +- src/SketchPlugin/doc/examples/hdistance.py | 6 +- src/SketchPlugin/doc/examples/horizontal.py | 2 +- .../doc/examples/interpolation.py | 14 +- src/SketchPlugin/doc/examples/intersection.py | 10 +- src/SketchPlugin/doc/examples/length.py | 2 +- src/SketchPlugin/doc/examples/middle.py | 4 +- src/SketchPlugin/doc/examples/mirror.py | 6 +- src/SketchPlugin/doc/examples/offset.py | 7 +- src/SketchPlugin/doc/examples/parallel.py | 6 +- .../doc/examples/perpendicular.py | 6 +- src/SketchPlugin/doc/examples/point.py | 2 +- src/SketchPlugin/doc/examples/projection.py | 10 +- src/SketchPlugin/doc/examples/radius.py | 2 +- src/SketchPlugin/doc/examples/rotation.py | 4 +- src/SketchPlugin/doc/examples/sketchcopy.py | 18 +- src/SketchPlugin/doc/examples/split.py | 12 +- src/SketchPlugin/doc/examples/tangent.py | 4 +- src/SketchPlugin/doc/examples/translation.py | 9 +- src/SketchPlugin/doc/examples/trim.py | 4 +- src/SketchPlugin/doc/examples/vdistance.py | 6 +- src/SketchPlugin/doc/examples/vertical.py | 2 +- test.API/SHAPER/GDML/TestAPI_ConeSegment.py | 62 +- test.API/SHAPER/GDML/TestConeSegment.py | 53 +- test.API/SHAPER/Primitives/TestAPI_Box.py | 98 +- test.API/SHAPER/Primitives/TestAPI_Cone.py | 34 +- .../SHAPER/Primitives/TestAPI_Cylinder.py | 88 +- test.API/SHAPER/Primitives/TestAPI_Sphere.py | 18 +- test.API/SHAPER/Primitives/TestAPI_Torus.py | 38 +- test.API/SHAPER/Primitives/TestBox.py | 122 +- test.API/SHAPER/Primitives/TestCone.py | 139 +- test.API/SHAPER/Primitives/TestCylinder.py | 241 +- test.API/SHAPER/Primitives/TestSphere.py | 12 +- test.API/SHAPER/Primitives/TestTorus.py | 85 +- test.API/SHAPER/Primitives/TestTube.py | 8 +- .../Transformations/TestAPI_MultiRotation.py | 54 +- .../TestAPI_MultiTranslation.py | 75 +- .../Transformations/TestAPI_Rotation.py | 66 +- .../SHAPER/Transformations/TestAPI_Scale.py | 114 +- .../Transformations/TestAPI_Symmetry.py | 76 +- .../Transformations/TestAPI_Translation.py | 124 +- .../Transformations/TestMultiRotation.py | 57 +- .../Transformations/TestMultiTranslation.py | 196 +- .../SHAPER/Transformations/TestRotation.py | 181 +- test.API/SHAPER/Transformations/TestScale.py | 251 +- .../SHAPER/Transformations/TestSymmetry.py | 241 +- .../SHAPER/Transformations/TestTranslation.py | 23 +- .../Transformations/TestTranslation_1.py | 534 +- .../Transformations/TestTranslation_2.py | 425 +- .../Transformations/TestTranslation_3.py | 795 ++- .../Transformations/TestTranslation_4.py | 34 +- .../Transformations/TestTranslation_5.py | 89 +- test.compatibility/CSWA.py | 637 ++- test.compatibility/angle30.py | 1203 ++++- test.compatibility/bearing_puller.py | 1236 ++++- test.compatibility/bobine_film_reel.py | 206 +- test.compatibility/bracket32.py | 998 +++- test.compatibility/bushing.py | 874 +++- test.compatibility/case24.py | 1145 ++++- test.compatibility/clothespin.py | 2625 ++++++++-- test.compatibility/ecran.py | 1517 +++++- test.compatibility/flange.py | 331 +- test.compatibility/gear.py | 370 +- test.compatibility/idler_plate.py | 522 +- test.compatibility/piece_02.py | 1097 +++- test.compatibility/piece_09.py | 1053 +++- test.compatibility/piece_12.py | 973 +++- test.compatibility/plug.py | 701 ++- test.compatibility/sprocket.py | 649 ++- test.compatibility/wheel_rim.py | 444 +- test.hdfs/BearingSeparator.py | 20 +- test.hdfs/CuveN4_Tubulures.py | 16 +- test.hdfs/Sketch_MiddlePoint_9_10.py | 12 +- test.hdfs/Test20456.py | 18 +- test.hdfs/Test2971.py | 24 +- test.hdfs/Test3061.py | 16 +- test.hdfs/Test3139.py | 32 +- test.hdfs/delta_p.py | 16 +- test.hdfs/horseshoe.py | 160 +- test.hdfs/roselend.py | 16 +- test.hdfs/te_fluide.py | 16 +- test.hdfs/te_solide.py | 16 +- test.hdfs/test_hdf.py | 125 +- test.hdfs/testme.py | 114 +- test.hdfs/usine.py | 16 +- test.models/CSWA.py | 639 ++- test.models/angle30.py | 1209 ++++- test.models/bearing_puller.py | 1247 ++++- test.models/bobine_film_reel.py | 206 +- test.models/bracket32.py | 1000 +++- test.models/bushing.py | 876 +++- test.models/case24.py | 1147 ++++- test.models/clothespin.py | 2627 ++++++++-- test.models/coronavirus.py | 484 +- test.models/ecran.py | 1479 +++++- test.models/flange.py | 333 +- test.models/gear.py | 372 +- test.models/idler_plate.py | 524 +- test.models/piece_02.py | 1099 +++- test.models/piece_09.py | 1055 +++- test.models/piece_12.py | 965 +++- test.models/plug.py | 674 ++- test.models/sprocket.py | 692 ++- test.models/stair_with_cycle.py | 139 +- test.models/visor_support.py | 1266 ++++- test.models/wheel_rim.py | 446 +- test.squish/shared/scripts/common.py | 506 +- .../suite_ERROR_NOTIFICATION/tst_679/test.py | 16 +- .../tst_boolean_001/test.py | 18 +- .../tst_boolean_002/test.py | 18 +- .../tst_boolean_003/test.py | 18 +- .../tst_construction_001/test.py | 18 +- .../tst_STL-import/import.py | 9 +- .../tst_XAO-export/test.py | 155 +- .../tst_XAO-import/test.py | 41 +- .../tst_extrusion_001/test.py | 26 +- .../tst_extrusion_002/test.py | 58 +- .../tst_extrusion_003/test.py | 30 +- .../tst_extrusion_004/test.py | 30 +- .../tst_extrusion_006/test.py | 38 +- .../shared/scripts/bdd_hooks.py | 2 +- .../shared/steps/steps.py | 207 +- .../suite_FEATURE_PARAMETERS/tst_1127/test.py | 9 +- .../suite_FEATURE_PARAMETERS/tst_1157/test.py | 9 +- .../suite_FEATURE_PARAMETERS/tst_474/test.py | 17 +- .../suite_FEATURE_PARAMETERS/tst_576/test.py | 24 +- .../suite_FEATURE_PARAMETERS/tst_903/test.py | 59 +- .../tst_partition_001/test.py | 27 +- .../tst_revolution_001/test.py | 62 +- .../tst_revolution_003/test.py | 94 +- .../tst_revolution_004/test.py | 96 +- .../tst_revolution_005/test.py | 116 +- .../tst_revolution_006/test.py | 96 +- .../tst_sketch_001/test.py | 103 +- .../tst_sketch_002/test.py | 36 +- .../tst_sketch_003/test.py | 95 +- .../tst_sketch_004/test.py | 95 +- .../tst_sketch_005/test.py | 51 +- .../tst_sketch_006/test.py | 82 +- .../tst_sketch_007/test.py | 87 +- .../tst_sketch_008/test.py | 41 +- .../tst_sketch_009/test.py | 45 +- .../tst_sketch_010/test.py | 43 +- .../tst_sketch_011/test.py | 41 +- .../tst_sketch_012/test.py | 65 +- .../tst_sketch_013/test.py | 47 +- .../tst_sketch_014/test.py | 65 +- .../tst_sketch_015/test.py | 65 +- .../tst_sketch_016/test.py | 174 +- .../tst_sketch_017/test.py | 182 +- .../tst_sketch_018/test.py | 39 +- .../suite_ISSUES_SALOME/tst_532/test.py | 129 +- .../tst_ACTIVE_DOC_MANAGEMENT/test.py | 192 +- .../tst_Platine/test.py | 47 +- .../suite_STANDALONE/shared/scripts/common.py | 194 +- test.squish/suite_STANDALONE/tst_532/test.py | 54 +- test.squish/suite_STANDALONE/tst_818/test.py | 32 +- test.squish/suite_STANDALONE/tst_BASE/test.py | 15 +- .../suite_STANDALONE/tst_DISTANCE/test.py | 27 +- .../suite_STANDALONE/tst_PARALLEL_1/test.py | 15 +- .../suite_STANDALONE/tst_PARALLEL_2/test.py | 30 +- .../tst_PERPENDICULAR_1/test.py | 4 +- .../suite_STANDALONE/tst_RADIUS/test.py | 14 +- test.squish/suite_STANDALONE/tst_c/test.py | 121 +- .../suite_STANDALONE/tst_common_1/test.py | 131 +- .../suite_STANDALONE/tst_crash_1/test.py | 1 + utils.py | 119 +- 1573 files changed, 165354 insertions(+), 55982 deletions(-) diff --git a/dev-tools/format b/dev-tools/format index a2fb8123e..d705bac35 100755 --- a/dev-tools/format +++ b/dev-tools/format @@ -60,9 +60,7 @@ if __name__ == "__main__": cpp_files: list[str] = [] for path, dirs, files in os.walk(os.getcwd()): cpp_files += [ - os.path.join(path, file) - for file in files - if file.endswith(CPP_EXTENSIONS) + os.path.join(path, file) for file in files if file.endswith(CPP_EXTENSIONS) ] clang_format_options: list[str] = ["-style=file", "-i"] @@ -81,5 +79,5 @@ if __name__ == "__main__": ) sp.run( - args=[args.black_bin] + black_options + [os.getcwd()] , + args=[args.black_bin] + black_options + [os.getcwd()], ) diff --git a/doc/gui/General/tutorial.py b/doc/gui/General/tutorial.py index ade5fc561..154f481ce 100644 --- a/doc/gui/General/tutorial.py +++ b/doc/gui/General/tutorial.py @@ -13,24 +13,52 @@ model.addParameter(Part_1_doc, "a", "115.4") # Step1. Sketch. Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(-57.69999999999999, 99.93933159672423, 57.70000000000001, 99.93933159672423) +SketchLine_1 = Sketch_1.addLine( + -57.69999999999999, 99.93933159672423, 57.70000000000001, 99.93933159672423 +) SketchLine_2 = Sketch_1.addLine(57.70000000000001, 99.93933159672423, 0, 0) SketchLine_2.setAuxiliary(True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(0, 0, -57.69999999999999, 99.93933159672423) SketchLine_3.setAuxiliary(True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_4 = SketchProjection_2.createdFeature() -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_4.result(), SketchLine_1.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_1.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result()) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_1.result()], SketchAPI_Line(SketchLine_4).startPoint(), 360, 6, True) -[SketchLine_5, SketchLine_6, SketchLine_7, SketchLine_8, SketchLine_9] = SketchMultiRotation_1.rotated() +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_4.result(), SketchLine_1.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_1.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_1.result() +) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchLine_1.result()], SketchAPI_Line(SketchLine_4).startPoint(), 360, 6, True +) +[ + SketchLine_5, + SketchLine_6, + SketchLine_7, + SketchLine_8, + SketchLine_9, +] = SketchMultiRotation_1.rotated() SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "a") model.do() @@ -49,42 +77,84 @@ Point_7 = model.addPoint(Part_1_doc, "80", "0", "h") Point_7.result().setColor(0, 0, 255) Point_8 = model.addPoint(Part_1_doc, "50", "0", "h") Point_8.result().setColor(0, 0, 255) -Polyline_1_objects = [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2"), - model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_4"), - model.selection("VERTEX", "Point_5"), model.selection("VERTEX", "Point_6"), - model.selection("VERTEX", "Point_7")] +Polyline_1_objects = [ + model.selection("VERTEX", "Point_1"), + model.selection("VERTEX", "Point_2"), + model.selection("VERTEX", "Point_3"), + model.selection("VERTEX", "Point_4"), + model.selection("VERTEX", "Point_5"), + model.selection("VERTEX", "Point_6"), + model.selection("VERTEX", "Point_7"), +] Polyline_1 = model.addPolyline3D(Part_1_doc, Polyline_1_objects, True) # Step3. Face. Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Polyline_1_1")]) # Step4. Revolution. -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), 360, 0) +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/Face-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_1r_wire") +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&Point_4/Point_4") From = model.selection("FACE", "Revolution_1_1/Generated_Face&Point_1/Point_1") -Extrusion_1 = model.addExtrusion(Part_1_doc, [Wire], model.selection("EDGE", "PartSet/OZ"), To, 0, From, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [Wire], model.selection("EDGE", "PartSet/OZ"), To, 0, From, 0 +) # Step6. Common. -Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Revolution_1_1"), model.selection("SOLID", "Extrusion_1_1")]) +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&Point_6/Point_6][Common_1_1/Modified_Face&Point_7/Point_7]")], 10) +Fillet_1 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Point_6/Point_6][Common_1_1/Modified_Face&Point_7/Point_7]", + ) + ], + 10, +) # Step8. Box. Box_1 = model.addBox(Part_1_doc, 20, 120, 20) # Step9. Translation. -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], -10, 20, 70) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_1_1")], -10, 20, 70 +) # Step10. Angular Copy. -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OZ"), 6) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 6, +) # Step11. Cut. -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Fillet_1_1")], [model.selection("COMPOUND", "AngularCopy_1_1")]) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Fillet_1_1")], + [model.selection("COMPOUND", "AngularCopy_1_1")], +) Cut_1.result().setColor(255, 214, 0) model.end() diff --git a/doc/gui/build_index.py b/doc/gui/build_index.py index 0caf21e02..35f253092 100755 --- a/doc/gui/build_index.py +++ b/doc/gui/build_index.py @@ -30,6 +30,7 @@ import shutil import sys from xml.dom.minidom import parse + def find_dir(src_path, cfg_file): """Find a name of a directory where the given config file exists""" entities = os.listdir(src_path) @@ -38,16 +39,17 @@ def find_dir(src_path, cfg_file): cfg_path = osp.join(path, cfg_file) if not osp.isdir(path): continue - if not osp.exists(cfg_path) and not osp.exists(cfg_path + '.in'): + if not osp.exists(cfg_path) and not osp.exists(cfg_path + ".in"): continue - if osp.exists(osp.join(path, 'doc')): - return osp.join(path, 'doc') + if osp.exists(osp.join(path, "doc")): + return osp.join(path, "doc") return None + def main(src_dir, build_dir): """Main function""" - src_path = osp.realpath(osp.join(src_dir, *[os.pardir]*2, 'src')) - config_file = osp.join(src_path, 'Config', 'plugins.xml.in') + src_path = osp.realpath(osp.join(src_dir, *[os.pardir] * 2, "src")) + config_file = osp.join(src_path, "Config", "plugins.xml.in") ## Find accessible plugins from plugins.xml configuration file processed = [] @@ -56,14 +58,14 @@ def main(src_dir, build_dir): tui_scripts = [] doc = parse(config_file) - plugins = doc.getElementsByTagName('plugin') + plugins = doc.getElementsByTagName("plugin") for plugin in plugins: - plugin_name = plugin.getAttribute('library') + plugin_name = plugin.getAttribute("library") if not plugin_name: - plugin_name = plugin.getAttribute('script') + plugin_name = plugin.getAttribute("script") if not plugin_name or plugin_name in processed: continue - config = plugin.getAttribute('configuration') + config = plugin.getAttribute("configuration") if not config: continue lib_dir = find_dir(src_path, config) @@ -76,46 +78,54 @@ def main(src_dir, build_dir): ## Collect index file ## For Sphinks type of slash is important. ## Even for Windows the slash direction has to be the same - indices.append(plugin_name + "/" + plugin_name + '.rst') + indices.append(plugin_name + "/" + plugin_name + ".rst") ## Collect TUI scripts - tui_files = sorted(f for f in os.listdir(lib_dir) if \ - osp.isfile(osp.join(lib_dir, f)) and re.match('TUI_.*\.rst', f)) + tui_files = sorted( + f + for f in os.listdir(lib_dir) + if osp.isfile(osp.join(lib_dir, f)) and re.match("TUI_.*\.rst", f) + ) if tui_files: - tui_list_file = osp.join(dist_dir, 'TUI_examples.rst') - with open(tui_list_file, 'w') as flist: - flist.write('.. _tui_{}:\n\n'.format(plugin_name.lower())) - title = plugin_name.replace('Plugin', ' plug-in') - flist.write('{}\n'.format(title)) - flist.write('{}\n\n'.format('='*len(title))) - flist.write('.. toctree::\n') - flist.write(' :titlesonly:\n') - flist.write(' :maxdepth: 1\n\n') - flist.writelines([' {}\n'.format(i) for i in tui_files]) - tui_scripts.append(osp.join('..', plugin_name, 'TUI_examples.rst')) + tui_list_file = osp.join(dist_dir, "TUI_examples.rst") + with open(tui_list_file, "w") as flist: + flist.write(".. _tui_{}:\n\n".format(plugin_name.lower())) + title = plugin_name.replace("Plugin", " plug-in") + flist.write("{}\n".format(title)) + flist.write("{}\n\n".format("=" * len(title))) + flist.write(".. toctree::\n") + flist.write(" :titlesonly:\n") + flist.write(" :maxdepth: 1\n\n") + flist.writelines([" {}\n".format(i) for i in tui_files]) + tui_scripts.append(osp.join("..", plugin_name, "TUI_examples.rst")) ## Mark plugin as processed processed.append(plugin_name) ## Generate index file - in_file = osp.join(src_dir, 'index.rst.in') - out_file = osp.join(build_dir, 'index.rst') - with open(in_file, 'r') as fin, open(out_file, 'w') as fout: + in_file = osp.join(src_dir, "index.rst.in") + out_file = osp.join(build_dir, "index.rst") + with open(in_file, "r") as fin, open(out_file, "w") as fout: lines = fin.readlines() - idx = lines.index('\n') - lines = lines[:idx] + [' {}\n'.format(i) for i in indices] + lines[idx+1:] + idx = lines.index("\n") + lines = lines[:idx] + [" {}\n".format(i) for i in indices] + lines[idx + 1 :] fout.writelines(lines) ## Generate TUI scripts index - in_file = osp.join(src_dir, 'TUI_scripts.rst.in') - out_file = osp.join(build_dir, 'General', 'TUI_scripts.rst') - with open(in_file, 'r') as fin, open(out_file, 'w') as fout: + in_file = osp.join(src_dir, "TUI_scripts.rst.in") + out_file = osp.join(build_dir, "General", "TUI_scripts.rst") + with open(in_file, "r") as fin, open(out_file, "w") as fout: lines = fin.readlines() - idx = lines.index('\n') - lines = lines[:idx] + [' {}\n'.format(i) for i in tui_scripts] + lines[idx+1:] + idx = lines.index("\n") + lines = ( + lines[:idx] + [" {}\n".format(i) for i in tui_scripts] + lines[idx + 1 :] + ) fout.writelines(lines) -if __name__ == '__main__': - parser = argparse.ArgumentParser(description='Generate index file from source directory') - parser.add_argument('build_dir', help='build directory') - parser.add_argument('src_dir', help='source directory') + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description="Generate index file from source directory" + ) + parser.add_argument("build_dir", help="build directory") + parser.add_argument("src_dir", help="source directory") args = parser.parse_args() sys.exit(main(args.src_dir, args.build_dir)) diff --git a/salome_pid.py b/salome_pid.py index f68419c48..bda690c95 100755 --- a/salome_pid.py +++ b/salome_pid.py @@ -22,16 +22,16 @@ import sys, pickle from killSalome import * -process = sys.argv[2] #SALOME_Session_Server" +process = sys.argv[2] # SALOME_Session_Server" salome_port = sys.argv[1] filedict = getPiDict(salome_port) -process_ids = pickle.load(open(filedict, 'r')) +process_ids = pickle.load(open(filedict, "r")) pid = -1 for list_item in process_ids: - for _pid, name_list in list_item.items(): - if process in name_list: - pid = _pid + for _pid, name_list in list_item.items(): + if process in name_list: + pid = _pid print(pid) diff --git a/scripts/doxy2swig.py b/scripts/doxy2swig.py index 646d8668b..ba9e28d54 100755 --- a/scripts/doxy2swig.py +++ b/scripts/doxy2swig.py @@ -58,21 +58,23 @@ def my_open_read(source): return source else: try: - return open(source, encoding='utf-8') + return open(source, encoding="utf-8") except TypeError: return open(source) + def my_open_write(dest): if hasattr(dest, "write"): return dest else: try: - return open(dest, 'w', encoding='utf-8') + return open(dest, "w", encoding="utf-8") except TypeError: - return open(dest, 'w') + return open(dest, "w") + # MARK: Text handling: -def shift(txt, indent = ' ', prepend = ''): +def shift(txt, indent=" ", prepend=""): """Return a list corresponding to the lines of text in the `txt` list indented by `indent`. Prepend instead the string given in `prepend` to the beginning of the first line. Note that if len(prepend) > len(indent), then @@ -80,22 +82,23 @@ def shift(txt, indent = ' ', prepend = ''): special '' entry at the end of `txt` (see `do_para` for the meaning). """ if type(indent) is int: - indent = indent * ' ' - special_end = txt[-1:] == [''] - lines = ''.join(txt).splitlines(True) - for i in range(1,len(lines)): + indent = indent * " " + special_end = txt[-1:] == [""] + lines = "".join(txt).splitlines(True) + for i in range(1, len(lines)): if lines[i].strip() or indent.strip(): lines[i] = indent + lines[i] if not lines: return prepend - prepend = prepend[:len(indent)] - indent = indent[len(prepend):] + prepend = prepend[: len(indent)] + indent = indent[len(prepend) :] lines[0] = prepend + indent + lines[0] - ret = [''.join(lines)] + ret = ["".join(lines)] if special_end: - ret.append('') + ret.append("") return ret + class Doxy2SWIG: """Converts Doxygen generated XML files into a file containing docstrings that can be used by SWIG-1.3.x that have support for @@ -104,14 +107,17 @@ class Doxy2SWIG: """ - def __init__(self, src, - with_function_signature = False, - with_type_info = False, - with_constructor_list = False, - with_attribute_list = False, - with_overloaded_functions = False, - textwidth = 80, - quiet = False): + def __init__( + self, + src, + with_function_signature=False, + with_type_info=False, + with_constructor_list=False, + with_attribute_list=False, + with_overloaded_functions=False, + textwidth=80, + quiet=False, + ): """Initialize the instance given a source object. `src` can be a file or filename. If you do not want to include function definitions from doxygen then set @@ -131,7 +137,7 @@ class Doxy2SWIG: # state: self.indent = 0 - self.listitem = '' + self.listitem = "" self.pieces = [] f = my_open_read(src) @@ -139,21 +145,35 @@ class Doxy2SWIG: self.xmldoc = minidom.parse(f).documentElement f.close() - self.pieces.append('\n// File: %s\n' % - os.path.basename(f.name)) + self.pieces.append("\n// File: %s\n" % os.path.basename(f.name)) - self.space_re = re.compile(r'\s+') + self.space_re = re.compile(r"\s+") self.lead_spc = re.compile(r'^(%feature\S+\s+\S+\s*?)"\s+(\S)') self.multi = 0 - self.ignores = ['inheritancegraph', 'param', 'listofallmembers', - 'innerclass', 'name', 'declname', 'incdepgraph', - 'invincdepgraph', 'programlisting', 'type', - 'references', 'referencedby', 'location', - 'collaborationgraph', 'reimplements', - 'reimplementedby', 'derivedcompoundref', - 'basecompoundref', - 'argsstring', 'definition', 'exceptions'] - #self.generics = [] + self.ignores = [ + "inheritancegraph", + "param", + "listofallmembers", + "innerclass", + "name", + "declname", + "incdepgraph", + "invincdepgraph", + "programlisting", + "type", + "references", + "referencedby", + "location", + "collaborationgraph", + "reimplements", + "reimplementedby", + "derivedcompoundref", + "basecompoundref", + "argsstring", + "definition", + "exceptions", + ] + # self.generics = [] def generate(self): """Parses the file set in the initialization. The resulting @@ -164,8 +184,8 @@ class Doxy2SWIG: def write(self, fname): o = my_open_write(fname) - o.write(''.join(self.pieces)) - o.write('\n') + o.write("".join(self.pieces)) + o.write("\n") o.close() def parse(self, node): @@ -182,14 +202,14 @@ class Doxy2SWIG: def parse_Text(self, node): txt = node.data - if txt == ' ': + if txt == " ": # this can happen when two tags follow in a text, e.g., # " ... $..." etc. # here we want to keep the space. self.add_text(txt) return - txt = txt.replace('\\', r'\\') - txt = txt.replace('"', r'\"') + txt = txt.replace("\\", r"\\") + txt = txt.replace('"', r"\"") # ignore pure whitespace m = self.space_re.match(txt) if m and len(m.group()) == len(txt): @@ -218,9 +238,9 @@ class Doxy2SWIG: handlerMethod(node) else: self.subnode_parse(node) - #if name not in self.generics: self.generics.append(name) + # if name not in self.generics: self.generics.append(name) -# MARK: Special format parsing + # MARK: Special format parsing def subnode_parse(self, node, pieces=None, indent=0, ignore=[], restrict=None): """Parse the subnodes of a given node. Subnodes with tags in the `ignore` list are ignored. If pieces is given, use this as target for @@ -232,14 +252,14 @@ class Doxy2SWIG: else: old_pieces = [] if type(indent) is int: - indent = indent * ' ' + indent = indent * " " if len(indent) > 0: - pieces = ''.join(self.pieces) - i_piece = pieces[:len(indent)] - if self.pieces[-1:] == ['']: - self.pieces = [pieces[len(indent):]] + [''] + pieces = "".join(self.pieces) + i_piece = pieces[: len(indent)] + if self.pieces[-1:] == [""]: + self.pieces = [pieces[len(indent) :]] + [""] elif self.pieces != []: - self.pieces = [pieces[len(indent):]] + self.pieces = [pieces[len(indent) :]] self.indent += len(indent) for n in node.childNodes: if restrict is not None: @@ -261,7 +281,7 @@ class Doxy2SWIG: self.subnode_parse(node) self.add_text(post_char) -# MARK: Helper functions + # MARK: Helper functions def get_specific_subnodes(self, node, name, recursive=0): """Given a node and a name, return a list of child `ELEMENT_NODEs`, that have a `tagName` matching the `name`. Search recursively for `recursive` @@ -271,7 +291,7 @@ class Doxy2SWIG: ret = [x for x in children if x.tagName == name] if recursive > 0: for x in children: - ret.extend(self.get_specific_subnodes(x, name, recursive-1)) + ret.extend(self.get_specific_subnodes(x, name, recursive - 1)) return ret def get_specific_nodes(self, node, names): @@ -280,9 +300,11 @@ class Doxy2SWIG: `ELEMENT_NODEs`, that have a `tagName` equal to the name. """ - nodes = [(x.tagName, x) for x in node.childNodes - if x.nodeType == x.ELEMENT_NODE and - x.tagName in names] + nodes = [ + (x.tagName, x) + for x in node.childNodes + if x.nodeType == x.ELEMENT_NODE and x.tagName in names + ] return dict(nodes) def add_text(self, value): @@ -296,28 +318,28 @@ class Doxy2SWIG: """Make sure to create an empty line. This is overridden, if the previous text ends with the special marker ''. In that case, nothing is done. """ - if self.pieces[-1:] == ['']: # respect special marker + if self.pieces[-1:] == [""]: # respect special marker return - elif self.pieces == []: # first paragraph, add '\n', override with '' - self.pieces = ['\n'] - elif self.pieces[-1][-1:] != '\n': # previous line not ended - self.pieces.extend([' \n' ,'\n']) - else: #default - self.pieces.append('\n') + elif self.pieces == []: # first paragraph, add '\n', override with '' + self.pieces = ["\n"] + elif self.pieces[-1][-1:] != "\n": # previous line not ended + self.pieces.extend([" \n", "\n"]) + else: # default + self.pieces.append("\n") def add_line_with_subsequent_indent(self, line, indent=4): """Add line of text and wrap such that subsequent lines are indented by `indent` spaces. """ if isinstance(line, (list, tuple)): - line = ''.join(line) + line = "".join(line) line = line.strip() - width = self.textwidth-self.indent-indent + width = self.textwidth - self.indent - indent wrapped_lines = textwrap.wrap(line[indent:], width=width) for i in range(len(wrapped_lines)): - if wrapped_lines[i] != '': - wrapped_lines[i] = indent * ' ' + wrapped_lines[i] - self.pieces.append(line[:indent] + '\n'.join(wrapped_lines)[indent:] + ' \n') + if wrapped_lines[i] != "": + wrapped_lines[i] = indent * " " + wrapped_lines[i] + self.pieces.append(line[:indent] + "\n".join(wrapped_lines)[indent:] + " \n") def extract_text(self, node): """Return the string representation of the node or list of nodes by parsing the @@ -326,70 +348,79 @@ class Doxy2SWIG: """ if not isinstance(node, (list, tuple)): node = [node] - pieces, self.pieces = self.pieces, [''] + pieces, self.pieces = self.pieces, [""] for n in node: for sn in n.childNodes: self.parse(sn) - ret = ''.join(self.pieces) + ret = "".join(self.pieces) self.pieces = pieces return ret def get_function_signature(self, node): """Returns the function signature string for memberdef nodes.""" - name = self.extract_text(self.get_specific_subnodes(node, 'name')) + name = self.extract_text(self.get_specific_subnodes(node, "name")) if self.with_type_info: - argsstring = self.extract_text(self.get_specific_subnodes(node, 'argsstring')) + argsstring = self.extract_text( + self.get_specific_subnodes(node, "argsstring") + ) else: argsstring = [] param_id = 1 - for n_param in self.get_specific_subnodes(node, 'param'): - declname = self.extract_text(self.get_specific_subnodes(n_param, 'declname')) + for n_param in self.get_specific_subnodes(node, "param"): + declname = self.extract_text( + self.get_specific_subnodes(n_param, "declname") + ) if not declname: - declname = 'arg' + str(param_id) - defval = self.extract_text(self.get_specific_subnodes(n_param, 'defval')) + declname = "arg" + str(param_id) + defval = self.extract_text( + self.get_specific_subnodes(n_param, "defval") + ) if defval: - defval = '=' + defval + defval = "=" + defval argsstring.append(declname + defval) param_id = param_id + 1 - argsstring = '(' + ', '.join(argsstring) + ')' - type = self.extract_text(self.get_specific_subnodes(node, 'type')) + argsstring = "(" + ", ".join(argsstring) + ")" + type = self.extract_text(self.get_specific_subnodes(node, "type")) function_definition = name + argsstring - if type != '' and type != 'void': - function_definition = function_definition + ' -> ' + type - return '`' + function_definition + '` ' + if type != "" and type != "void": + function_definition = function_definition + " -> " + type + return "`" + function_definition + "` " -# MARK: Special parsing tasks (need to be called manually) + # MARK: Special parsing tasks (need to be called manually) def make_constructor_list(self, constructor_nodes, classname): """Produces the "Constructors" section and the constructor signatures (since swig does not do so for classes) for class docstrings.""" if constructor_nodes == []: return - self.add_text(['\n', 'Constructors', - '\n', '------------']) + self.add_text(["\n", "Constructors", "\n", "------------"]) for n in constructor_nodes: - self.add_text('\n') - self.add_line_with_subsequent_indent('* ' + self.get_function_signature(n)) - self.subnode_parse(n, pieces = [], indent=4, ignore=['definition', 'name']) + self.add_text("\n") + self.add_line_with_subsequent_indent("* " + self.get_function_signature(n)) + self.subnode_parse(n, pieces=[], indent=4, ignore=["definition", "name"]) def make_attribute_list(self, node): """Produces the "Attributes" section in class docstrings for public member variables (attributes). """ atr_nodes = [] - for n in self.get_specific_subnodes(node, 'memberdef', recursive=2): - if n.attributes['kind'].value == 'variable' and n.attributes['prot'].value == 'public': + for n in self.get_specific_subnodes(node, "memberdef", recursive=2): + if ( + n.attributes["kind"].value == "variable" + and n.attributes["prot"].value == "public" + ): atr_nodes.append(n) if not atr_nodes: return - self.add_text(['\n', 'Attributes', - '\n', '----------']) + self.add_text(["\n", "Attributes", "\n", "----------"]) for n in atr_nodes: - name = self.extract_text(self.get_specific_subnodes(n, 'name')) - self.add_text(['\n* ', '`', name, '`', ' : ']) - self.add_text(['`', self.extract_text(self.get_specific_subnodes(n, 'type')), '`']) - self.add_text(' \n') - restrict = ['briefdescription', 'detaileddescription'] - self.subnode_parse(n, pieces=[''], indent=4, restrict=restrict) + name = self.extract_text(self.get_specific_subnodes(n, "name")) + self.add_text(["\n* ", "`", name, "`", " : "]) + self.add_text( + ["`", self.extract_text(self.get_specific_subnodes(n, "type")), "`"] + ) + self.add_text(" \n") + restrict = ["briefdescription", "detaileddescription"] + self.subnode_parse(n, pieces=[""], indent=4, restrict=restrict) def get_memberdef_nodes_and_signatures(self, node, kind): """Collects the memberdef nodes and corresponding signatures that @@ -398,28 +429,28 @@ class Doxy2SWIG: function signatures (what swig expects after the %feature directive) as keys, and a list of corresponding memberdef nodes as values.""" sig_dict = {} - sig_prefix = '' - if kind in ('file', 'namespace'): - ns_node = node.getElementsByTagName('innernamespace') - if not ns_node and kind == 'namespace': - ns_node = node.getElementsByTagName('compoundname') + sig_prefix = "" + if kind in ("file", "namespace"): + ns_node = node.getElementsByTagName("innernamespace") + if not ns_node and kind == "namespace": + ns_node = node.getElementsByTagName("compoundname") if ns_node: - sig_prefix = self.extract_text(ns_node[0]) + '::' - elif kind in ('class', 'struct'): + sig_prefix = self.extract_text(ns_node[0]) + "::" + elif kind in ("class", "struct"): # Get the full function name. - cn_node = node.getElementsByTagName('compoundname') - sig_prefix = self.extract_text(cn_node[0]) + '::' + cn_node = node.getElementsByTagName("compoundname") + sig_prefix = self.extract_text(cn_node[0]) + "::" - md_nodes = self.get_specific_subnodes(node, 'memberdef', recursive=2) + md_nodes = self.get_specific_subnodes(node, "memberdef", recursive=2) for n in md_nodes: - if n.attributes['prot'].value != 'public': + if n.attributes["prot"].value != "public": continue - if n.attributes['kind'].value in ['variable', 'typedef']: + if n.attributes["kind"].value in ["variable", "typedef"]: continue - if not self.get_specific_subnodes(n, 'definition'): + if not self.get_specific_subnodes(n, "definition"): continue - name = self.extract_text(self.get_specific_subnodes(n, 'name')) - if name[:8] == 'operator': + name = self.extract_text(self.get_specific_subnodes(n, "name")) + if name[:8] == "operator": continue sig = sig_prefix + name if sig in sig_dict: @@ -431,11 +462,11 @@ class Doxy2SWIG: def handle_typical_memberdefs_no_overload(self, signature, memberdef_nodes): """Produce standard documentation for memberdef_nodes.""" for n in memberdef_nodes: - self.add_text(['\n', '%feature("docstring") ', signature, ' "', '\n']) + self.add_text(["\n", '%feature("docstring") ', signature, ' "', "\n"]) if self.with_function_signature: self.add_line_with_subsequent_indent(self.get_function_signature(n)) - self.subnode_parse(n, pieces=[], ignore=['definition', 'name']) - self.add_text(['";', '\n']) + self.subnode_parse(n, pieces=[], ignore=["definition", "name"]) + self.add_text(['";', "\n"]) def handle_typical_memberdefs(self, signature, memberdef_nodes): """Produces docstring entries containing an "Overloaded function" @@ -447,73 +478,71 @@ class Doxy2SWIG: self.handle_typical_memberdefs_no_overload(signature, memberdef_nodes) return - self.add_text(['\n', '%feature("docstring") ', signature, ' "', '\n']) + self.add_text(["\n", '%feature("docstring") ', signature, ' "', "\n"]) if self.with_function_signature: for n in memberdef_nodes: self.add_line_with_subsequent_indent(self.get_function_signature(n)) - self.add_text('\n') - self.add_text(['Overloaded function', '\n', - '-------------------']) + self.add_text("\n") + self.add_text(["Overloaded function", "\n", "-------------------"]) for n in memberdef_nodes: - self.add_text('\n') - self.add_line_with_subsequent_indent('* ' + self.get_function_signature(n)) - self.subnode_parse(n, pieces=[], indent=4, ignore=['definition', 'name']) - self.add_text(['";', '\n']) - + self.add_text("\n") + self.add_line_with_subsequent_indent("* " + self.get_function_signature(n)) + self.subnode_parse(n, pieces=[], indent=4, ignore=["definition", "name"]) + self.add_text(['";', "\n"]) -# MARK: Tag handlers + # MARK: Tag handlers def do_linebreak(self, node): - self.add_text(' ') + self.add_text(" ") def do_ndash(self, node): - self.add_text('--') + self.add_text("--") def do_mdash(self, node): - self.add_text('---') + self.add_text("---") def do_emphasis(self, node): - self.surround_parse(node, '*', '*') + self.surround_parse(node, "*", "*") def do_bold(self, node): - self.surround_parse(node, '**', '**') + self.surround_parse(node, "**", "**") def do_computeroutput(self, node): - self.surround_parse(node, '`', '`') + self.surround_parse(node, "`", "`") def do_heading(self, node): self.start_new_paragraph() - pieces, self.pieces = self.pieces, [''] - level = int(node.attributes['level'].value) + pieces, self.pieces = self.pieces, [""] + level = int(node.attributes["level"].value) self.subnode_parse(node) if level == 1: - self.pieces.insert(0, '\n') - self.add_text(['\n', len(''.join(self.pieces).strip()) * '=']) + self.pieces.insert(0, "\n") + self.add_text(["\n", len("".join(self.pieces).strip()) * "="]) elif level == 2: - self.add_text(['\n', len(''.join(self.pieces).strip()) * '-']) + self.add_text(["\n", len("".join(self.pieces).strip()) * "-"]) elif level >= 3: - self.pieces.insert(0, level * '#' + ' ') + self.pieces.insert(0, level * "#" + " ") # make following text have no gap to the heading: - pieces.extend([''.join(self.pieces) + ' \n', '']) + pieces.extend(["".join(self.pieces) + " \n", ""]) self.pieces = pieces def do_verbatim(self, node): self.start_new_paragraph() - self.subnode_parse(node, pieces=[''], indent=4) + self.subnode_parse(node, pieces=[""], indent=4) def do_blockquote(self, node): self.start_new_paragraph() - self.subnode_parse(node, pieces=[''], indent='> ') + self.subnode_parse(node, pieces=[""], indent="> ") def do_hruler(self, node): self.start_new_paragraph() - self.add_text('* * * * * \n') + self.add_text("* * * * * \n") def do_includes(self, node): - self.add_text('\nC++ includes: ') + self.add_text("\nC++ includes: ") self.subnode_parse(node) - self.add_text('\n') + self.add_text("\n") -# MARK: Para tag handler + # MARK: Para tag handler def do_para(self, node): """This is the only place where text wrapping is automatically performed. Generally, this function parses the node (locally), wraps the text, and @@ -526,52 +555,52 @@ class Doxy2SWIG: Paragraphs always end with ' \n', but if the parsed content ends with the special symbol '', this is passed on. """ - if self.pieces[-1:] == ['']: + if self.pieces[-1:] == [""]: pieces, self.pieces = self.pieces[:-2], self.pieces[-2:-1] else: - self.add_text('\n') - pieces, self.pieces = self.pieces, [''] + self.add_text("\n") + pieces, self.pieces = self.pieces, [""] self.subnode_parse(node) - dont_end_paragraph = self.pieces[-1:] == [''] + dont_end_paragraph = self.pieces[-1:] == [""] # Now do the text wrapping: width = self.textwidth - self.indent wrapped_para = [] - for line in ''.join(self.pieces).splitlines(): - keep_markdown_newline = line[-2:] == ' ' + for line in "".join(self.pieces).splitlines(): + keep_markdown_newline = line[-2:] == " " w_line = textwrap.wrap(line, width=width, break_long_words=False) if w_line == []: - w_line = [''] + w_line = [""] if keep_markdown_newline: - w_line[-1] = w_line[-1] + ' ' + w_line[-1] = w_line[-1] + " " for wl in w_line: - wrapped_para.append(wl + '\n') + wrapped_para.append(wl + "\n") if wrapped_para: - if wrapped_para[-1][-3:] != ' \n': - wrapped_para[-1] = wrapped_para[-1][:-1] + ' \n' + if wrapped_para[-1][-3:] != " \n": + wrapped_para[-1] = wrapped_para[-1][:-1] + " \n" if dont_end_paragraph: - wrapped_para.append('') + wrapped_para.append("") pieces.extend(wrapped_para) self.pieces = pieces -# MARK: List tag handlers + # MARK: List tag handlers def do_itemizedlist(self, node): - if self.listitem == '': + if self.listitem == "": self.start_new_paragraph() - elif self.pieces != [] and self.pieces[-1:] != ['']: - self.add_text('\n') + elif self.pieces != [] and self.pieces[-1:] != [""]: + self.add_text("\n") listitem = self.listitem - if self.listitem in ['*', '-']: - self.listitem = '-' + if self.listitem in ["*", "-"]: + self.listitem = "-" else: - self.listitem = '*' + self.listitem = "*" self.subnode_parse(node) self.listitem = listitem def do_orderedlist(self, node): - if self.listitem == '': + if self.listitem == "": self.start_new_paragraph() - elif self.pieces != [] and self.pieces[-1:] != ['']: - self.add_text('\n') + elif self.pieces != [] and self.pieces[-1:] != [""]: + self.add_text("\n") listitem = self.listitem self.listitem = 0 self.subnode_parse(node) @@ -580,96 +609,103 @@ class Doxy2SWIG: def do_listitem(self, node): try: self.listitem = int(self.listitem) + 1 - item = str(self.listitem) + '. ' + item = str(self.listitem) + ". " except: - item = str(self.listitem) + ' ' + item = str(self.listitem) + " " self.subnode_parse(node, item, indent=4) -# MARK: Parameter list tag handlers + # MARK: Parameter list tag handlers def do_parameterlist(self, node): self.start_new_paragraph() - text = 'unknown' + text = "unknown" for key, val in node.attributes.items(): - if key == 'kind': - if val == 'param': - text = 'Parameters' - elif val == 'exception': - text = 'Exceptions' - elif val == 'retval': - text = 'Returns' + if key == "kind": + if val == "param": + text = "Parameters" + elif val == "exception": + text = "Exceptions" + elif val == "retval": + text = "Returns" else: text = val break if self.indent == 0: - self.add_text([text, '\n', len(text) * '-', '\n']) + self.add_text([text, "\n", len(text) * "-", "\n"]) else: - self.add_text([text, ': \n']) + self.add_text([text, ": \n"]) self.subnode_parse(node) def do_parameteritem(self, node): - self.subnode_parse(node, pieces=['* ', '']) + self.subnode_parse(node, pieces=["* ", ""]) def do_parameternamelist(self, node): self.subnode_parse(node) - self.add_text([' :', ' \n']) + self.add_text([" :", " \n"]) def do_parametername(self, node): - if self.pieces != [] and self.pieces != ['* ', '']: - self.add_text(', ') + if self.pieces != [] and self.pieces != ["* ", ""]: + self.add_text(", ") data = self.extract_text(node) - self.add_text(['`', data, '`']) + self.add_text(["`", data, "`"]) def do_parameterdescription(self, node): - self.subnode_parse(node, pieces=[''], indent=4) + self.subnode_parse(node, pieces=[""], indent=4) -# MARK: Section tag handler + # MARK: Section tag handler def do_simplesect(self, node): - kind = node.attributes['kind'].value - if kind in ('date', 'rcs', 'version'): + kind = node.attributes["kind"].value + if kind in ("date", "rcs", "version"): return self.start_new_paragraph() - if kind == 'warning': - self.subnode_parse(node, pieces=['**Warning**: ',''], indent=4) - elif kind == 'see': - self.subnode_parse(node, pieces=['See also: ',''], indent=4) - elif kind == 'return': + if kind == "warning": + self.subnode_parse(node, pieces=["**Warning**: ", ""], indent=4) + elif kind == "see": + self.subnode_parse(node, pieces=["See also: ", ""], indent=4) + elif kind == "return": if self.indent == 0: - pieces = ['Returns', '\n', len('Returns') * '-', '\n', ''] + pieces = ["Returns", "\n", len("Returns") * "-", "\n", ""] else: - pieces = ['Returns:', '\n', ''] + pieces = ["Returns:", "\n", ""] self.subnode_parse(node, pieces=pieces) else: - self.subnode_parse(node, pieces=[kind + ': ',''], indent=4) + self.subnode_parse(node, pieces=[kind + ": ", ""], indent=4) -# MARK: %feature("docstring") producing tag handlers + # MARK: %feature("docstring") producing tag handlers def do_compounddef(self, node): """This produces %feature("docstring") entries for classes, and handles class, namespace and file memberdef entries specially to allow for overloaded functions. For other cases, passes parsing on to standard handlers (which may produce unexpected results). """ - kind = node.attributes['kind'].value - if kind in ('class', 'struct'): - prot = node.attributes['prot'].value - if prot != 'public': + kind = node.attributes["kind"].value + if kind in ("class", "struct"): + prot = node.attributes["prot"].value + if prot != "public": return - self.add_text('\n\n') - classdefn = self.extract_text(self.get_specific_subnodes(node, 'compoundname')) - classname = classdefn.split('::')[-1] + self.add_text("\n\n") + classdefn = self.extract_text( + self.get_specific_subnodes(node, "compoundname") + ) + classname = classdefn.split("::")[-1] self.add_text('%%feature("docstring") %s "\n' % classdefn) if self.with_constructor_list: constructor_nodes = [] - for n in self.get_specific_subnodes(node, 'memberdef', recursive=2): - if n.attributes['prot'].value == 'public': - if self.extract_text(self.get_specific_subnodes(n, 'definition')) == classdefn + '::' + classname: + for n in self.get_specific_subnodes(node, "memberdef", recursive=2): + if n.attributes["prot"].value == "public": + if ( + self.extract_text( + self.get_specific_subnodes(n, "definition") + ) + == classdefn + "::" + classname + ): constructor_nodes.append(n) for n in constructor_nodes: self.add_line_with_subsequent_indent(self.get_function_signature(n)) - names = ('briefdescription','detaileddescription') + names = ("briefdescription", "detaileddescription") sub_dict = self.get_specific_nodes(node, names) - for n in ('briefdescription','detaileddescription'): + for n in ("briefdescription", "detaileddescription"): if n in sub_dict: self.parse(sub_dict[n]) if self.with_constructor_list: @@ -677,21 +713,26 @@ class Doxy2SWIG: if self.with_attribute_list: self.make_attribute_list(node) - sub_list = self.get_specific_subnodes(node, 'includes') + sub_list = self.get_specific_subnodes(node, "includes") if sub_list: self.parse(sub_list[0]) - self.add_text(['";', '\n']) - - names = ['compoundname', 'briefdescription','detaileddescription', 'includes'] - self.subnode_parse(node, ignore = names) - - elif kind in ('file', 'namespace'): - nodes = node.getElementsByTagName('sectiondef') + self.add_text(['";', "\n"]) + + names = [ + "compoundname", + "briefdescription", + "detaileddescription", + "includes", + ] + self.subnode_parse(node, ignore=names) + + elif kind in ("file", "namespace"): + nodes = node.getElementsByTagName("sectiondef") for n in nodes: self.parse(n) # now explicitely handle possibly overloaded member functions. - if kind in ['class', 'struct','file', 'namespace']: + if kind in ["class", "struct", "file", "namespace"]: md_nodes = self.get_memberdef_nodes_and_signatures(node, kind) for sig in md_nodes: self.handle_typical_memberdefs(sig, md_nodes[sig]) @@ -701,38 +742,38 @@ class Doxy2SWIG: now dealt with by `handle_overloaded_memberfunction`. Do these even exist??? """ - prot = node.attributes['prot'].value - id = node.attributes['id'].value - kind = node.attributes['kind'].value + prot = node.attributes["prot"].value + id = node.attributes["id"].value + kind = node.attributes["kind"].value tmp = node.parentNode.parentNode.parentNode - compdef = tmp.getElementsByTagName('compounddef')[0] - cdef_kind = compdef.attributes['kind'].value - if cdef_kind in ('file', 'namespace', 'class', 'struct'): + compdef = tmp.getElementsByTagName("compounddef")[0] + cdef_kind = compdef.attributes["kind"].value + if cdef_kind in ("file", "namespace", "class", "struct"): # These cases are now handled by `handle_typical_memberdefs` return - if prot != 'public': + if prot != "public": return - first = self.get_specific_nodes(node, ('definition', 'name')) - name = self.extract_text(first['name']) - if name[:8] == 'operator': # Don't handle operators yet. + first = self.get_specific_nodes(node, ("definition", "name")) + name = self.extract_text(first["name"]) + if name[:8] == "operator": # Don't handle operators yet. return - if not 'definition' in first or kind in ['variable', 'typedef']: + if not "definition" in first or kind in ["variable", "typedef"]: return - data = self.extract_text(first['definition']) - self.add_text('\n') - self.add_text(['/* where did this entry come from??? */', '\n']) + data = self.extract_text(first["definition"]) + self.add_text("\n") + self.add_text(["/* where did this entry come from??? */", "\n"]) self.add_text('%feature("docstring") %s "\n%s' % (data, data)) for n in node.childNodes: if n not in first.values(): self.parse(n) - self.add_text(['";', '\n']) + self.add_text(['";', "\n"]) -# MARK: Entry tag handlers (dont print anything meaningful) + # MARK: Entry tag handlers (dont print anything meaningful) def do_sectiondef(self, node): - kind = node.attributes['kind'].value - if kind in ('public-func', 'func', 'user-defined', ''): + kind = node.attributes["kind"].value + if kind in ("public-func", "func", "user-defined", ""): self.subnode_parse(node) def do_header(self, node): @@ -740,7 +781,7 @@ class Doxy2SWIG: which should not be printed as such, so we comment it in the output.""" data = self.extract_text(node) - self.add_text('\n/*\n %s \n*/\n' % data) + self.add_text("\n/*\n %s \n*/\n" % data) # If our immediate sibling is a 'description' node then we # should comment that out also and remove it from the parent # node's children. @@ -748,93 +789,121 @@ class Doxy2SWIG: idx = parent.childNodes.index(node) if len(parent.childNodes) >= idx + 2: nd = parent.childNodes[idx + 2] - if nd.nodeName == 'description': + if nd.nodeName == "description": nd = parent.removeChild(nd) - self.add_text('\n/*') + self.add_text("\n/*") self.subnode_parse(nd) - self.add_text('\n*/\n') + self.add_text("\n*/\n") def do_member(self, node): - kind = node.attributes['kind'].value - refid = node.attributes['refid'].value - if kind == 'function' and refid[:9] == 'namespace': + kind = node.attributes["kind"].value + refid = node.attributes["refid"].value + if kind == "function" and refid[:9] == "namespace": self.subnode_parse(node) def do_doxygenindex(self, node): self.multi = 1 - comps = node.getElementsByTagName('compound') + comps = node.getElementsByTagName("compound") for c in comps: - refid = c.attributes['refid'].value - fname = refid + '.xml' + refid = c.attributes["refid"].value + fname = refid + ".xml" if not os.path.exists(fname): - fname = os.path.join(self.my_dir, fname) + fname = os.path.join(self.my_dir, fname) if not self.quiet: print("parsing file: %s" % fname) - p = Doxy2SWIG(fname, - with_function_signature = self.with_function_signature, - with_type_info = self.with_type_info, - with_constructor_list = self.with_constructor_list, - with_attribute_list = self.with_attribute_list, - with_overloaded_functions = self.with_overloaded_functions, - textwidth = self.textwidth, - quiet = self.quiet) + p = Doxy2SWIG( + fname, + with_function_signature=self.with_function_signature, + with_type_info=self.with_type_info, + with_constructor_list=self.with_constructor_list, + with_attribute_list=self.with_attribute_list, + with_overloaded_functions=self.with_overloaded_functions, + textwidth=self.textwidth, + quiet=self.quiet, + ) p.generate() self.pieces.extend(p.pieces) + # MARK: main def main(): usage = __doc__ parser = optparse.OptionParser(usage) - parser.add_option("-f", '--function-signature', - action='store_true', - default=False, - dest='f', - help='include function signature in the documentation. This is handy when not using swig auto-generated function definitions %feature("autodoc", [0,1])') - parser.add_option("-t", '--type-info', - action='store_true', - default=False, - dest='t', - help='include type information for arguments in function signatures. This is similar to swig autodoc level 1') - parser.add_option("-c", '--constructor-list', - action='store_true', - default=False, - dest='c', - help='generate a constructor list for class documentation. Useful for target languages where the object construction should be documented in the class documentation.') - parser.add_option("-a", '--attribute-list', - action='store_true', - default=False, - dest='a', - help='generate an attributes list for class documentation. Useful for target languages where class attributes should be documented in the class documentation.') - parser.add_option("-o", '--overloaded-functions', - action='store_true', - default=False, - dest='o', - help='collect all documentation for overloaded functions. Useful for target languages that have no concept of overloaded functions, but also to avoid having to attach the correct docstring to each function overload manually') - parser.add_option("-w", '--width', type="int", - action='store', - dest='w', - default=80, - help='textwidth for wrapping (default: 80). Note that the generated lines may include 2 additional spaces (for markdown).') - parser.add_option("-q", '--quiet', - action='store_true', - default=False, - dest='q', - help='be quiet and minimize output') + parser.add_option( + "-f", + "--function-signature", + action="store_true", + default=False, + dest="f", + help='include function signature in the documentation. This is handy when not using swig auto-generated function definitions %feature("autodoc", [0,1])', + ) + parser.add_option( + "-t", + "--type-info", + action="store_true", + default=False, + dest="t", + help="include type information for arguments in function signatures. This is similar to swig autodoc level 1", + ) + parser.add_option( + "-c", + "--constructor-list", + action="store_true", + default=False, + dest="c", + help="generate a constructor list for class documentation. Useful for target languages where the object construction should be documented in the class documentation.", + ) + parser.add_option( + "-a", + "--attribute-list", + action="store_true", + default=False, + dest="a", + help="generate an attributes list for class documentation. Useful for target languages where class attributes should be documented in the class documentation.", + ) + parser.add_option( + "-o", + "--overloaded-functions", + action="store_true", + default=False, + dest="o", + help="collect all documentation for overloaded functions. Useful for target languages that have no concept of overloaded functions, but also to avoid having to attach the correct docstring to each function overload manually", + ) + parser.add_option( + "-w", + "--width", + type="int", + action="store", + dest="w", + default=80, + help="textwidth for wrapping (default: 80). Note that the generated lines may include 2 additional spaces (for markdown).", + ) + parser.add_option( + "-q", + "--quiet", + action="store_true", + default=False, + dest="q", + help="be quiet and minimize output", + ) options, args = parser.parse_args() if len(args) != 2: parser.error("no input and output specified") - p = Doxy2SWIG(args[0], - with_function_signature = options.f, - with_type_info = options.t, - with_constructor_list = options.c, - with_attribute_list = options.a, - with_overloaded_functions = options.o, - textwidth = options.w, - quiet = options.q) + p = Doxy2SWIG( + args[0], + with_function_signature=options.f, + with_type_info=options.t, + with_constructor_list=options.c, + with_attribute_list=options.a, + with_overloaded_functions=options.o, + textwidth=options.w, + quiet=options.q, + ) p.generate() p.write(args[1]) -if __name__ == '__main__': + +if __name__ == "__main__": main() diff --git a/shaper_test.py b/shaper_test.py index d984d439c..cefc7c1b6 100644 --- a/shaper_test.py +++ b/shaper_test.py @@ -20,64 +20,96 @@ import unittest -class TestShaper(unittest.TestCase): +class TestShaper(unittest.TestCase): def setUp(self): import salome + salome.salome_init() def test_shaper(self): """Quick test for Shaper module""" print() - print('Testing Shaper module') + print("Testing Shaper module") from SketchAPI import SketchAPI_Point from salome.shaper import model model.begin() - print('... Create Part document') + print("... Create Part document") partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() self.assertIsNotNone(Part_1_doc) - print('... Create Sketch') + print("... Create Sketch") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) self.assertIsNotNone(Sketch_1) SketchLine_1 = Sketch_1.addLine(10, 10, -10, 10) SketchLine_2 = Sketch_1.addLine(-10, 10, -10, 30) - SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) + SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() + ) SketchArc_1 = Sketch_1.addArc(10, 30, 10, 10, -10, 30, False) - SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.startPoint()) - SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.endPoint()) - SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_1.result()) - SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_2.result(), SketchArc_1.results()[1]) - SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_2.result()) + SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_1.startPoint() + ) + SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_2.endPoint() + ) + SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_1.result() + ) + SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_2.result(), SketchArc_1.results()[1] + ) + SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_1.result(), SketchLine_2.result() + ) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 20) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) - SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) + SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False + ) SketchPoint_1 = SketchProjection_1.createdFeature() - SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.endPoint(), 10) - SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_1.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10) + SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.endPoint(), 10 + ) + SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_1.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10 + ) model.do() self.assertEqual(len(Sketch_1.results()), 1) - print('... Create Extrusion') - Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 10, 0) + print("... Create Extrusion") + Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection(), + 10, + 0, + ) model.do() self.assertIsNotNone(Extrusion_1) self.assertEqual(len(Extrusion_1.results()), 1) - self.assertEqual(Extrusion_1.result().shapeType(), 'SOLID') + self.assertEqual(Extrusion_1.result().shapeType(), "SOLID") - print('... Create Partition') - Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("FACE", "PartSet/YOZ")]) + print("... Create Partition") + Partition_1 = model.addPartition( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_1"), + model.selection("FACE", "PartSet/YOZ"), + ], + ) model.end() self.assertIsNotNone(Partition_1) self.assertEqual(len(Partition_1.results()), 1) - self.assertEqual(Partition_1.result().shapeType(), 'COMPSOLID') + self.assertEqual(Partition_1.result().shapeType(), "COMPSOLID") self.assertEqual(Partition_1.result().numberOfSubs(), 2) -if __name__ == '__main__': + +if __name__ == "__main__": unittest.main() diff --git a/src/BuildPlugin/Test/Test19056.py b/src/BuildPlugin/Test/Test19056.py index 5a020dbc9..4be5f4ca4 100644 --- a/src/BuildPlugin/Test/Test19056.py +++ b/src/BuildPlugin/Test/Test19056.py @@ -29,28 +29,112 @@ model.addParameter(Part_1_doc, "r", "30") model.addParameter(Part_1_doc, "nb", "8") model.addParameter(Part_1_doc, "r2", "40") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchArc_1 = Sketch_1.addArc(7.762830395025333, 33.0188035531048, -7.554428638438673, 29.03326726268915, -2.687344813323973, 44.9056350037167, True) -SketchLine_2 = Sketch_1.addLine(-2.687344813323973, 44.9056350037167, 0, 44.9056350037167) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_2.result()) -SketchLine_3 = Sketch_1.addLine(-7.554428638438673, 29.03326726268915, -12.16952563119684, 27.83242339707059) +SketchArc_1 = Sketch_1.addArc( + 7.762830395025333, + 33.0188035531048, + -7.554428638438673, + 29.03326726268915, + -2.687344813323973, + 44.9056350037167, + True, +) +SketchLine_2 = Sketch_1.addLine( + -2.687344813323973, 44.9056350037167, 0, 44.9056350037167 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_1.result() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_1.result(), SketchLine_2.result() +) +SketchLine_3 = Sketch_1.addLine( + -7.554428638438673, 29.03326726268915, -12.16952563119684, 27.83242339707059 +) SketchLine_3.setAuxiliary(True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.startPoint()) -SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular(SketchArc_1.results()[1], SketchLine_3.result()) -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_1.result(), [SketchLine_2.result(), SketchArc_1.results()[1]]) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_3.startPoint() +) +SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular( + SketchArc_1.results()[1], SketchLine_3.result() +) +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_1.result(), [SketchLine_2.result(), SketchArc_1.results()[1]] +) [SketchLine_4, SketchArc_2] = SketchConstraintMirror_1.mirrored() -SketchArc_3 = Sketch_1.addArc(0, 0, -7.554428638438673, 29.03326726268915, -15.18783244321905, 25.87140787967874, False) +SketchArc_3 = Sketch_1.addArc( + 0, + 0, + -7.554428638438673, + 29.03326726268915, + -15.18783244321905, + 25.87140787967874, + False, +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_3.results()[1], "r") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_3.center(), SketchAPI_Line(SketchLine_1).startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_3.results()[1]) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_3.result()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchArc_3.startPoint()) -SketchMultiRotation_1_objects = [SketchArc_1.results()[1], SketchLine_2.result(), SketchLine_4.result(), SketchArc_2.results()[1]] -SketchMultiRotation_1 = Sketch_1.addRotation(SketchMultiRotation_1_objects, SketchAPI_Line(SketchLine_1).startPoint(), 360, "nb", True) -[SketchArc_4, SketchArc_5, SketchArc_6, SketchArc_7, SketchArc_8, SketchArc_9, SketchArc_10, SketchLine_5, SketchLine_6, SketchLine_7, SketchLine_8, SketchLine_9, SketchLine_10, SketchLine_11, SketchLine_4, SketchLine_12, SketchLine_13, SketchLine_14, SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18, SketchArc_2, SketchArc_11, SketchArc_12, SketchArc_13, SketchArc_14, SketchArc_15, SketchArc_16, SketchArc_17] = SketchMultiRotation_1.rotated() +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchAPI_Line(SketchLine_1).startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_3.results()[1] +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchLine_3.result() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchArc_3.startPoint() +) +SketchMultiRotation_1_objects = [ + SketchArc_1.results()[1], + SketchLine_2.result(), + SketchLine_4.result(), + SketchArc_2.results()[1], +] +SketchMultiRotation_1 = Sketch_1.addRotation( + SketchMultiRotation_1_objects, + SketchAPI_Line(SketchLine_1).startPoint(), + 360, + "nb", + True, +) +[ + SketchArc_4, + SketchArc_5, + SketchArc_6, + SketchArc_7, + SketchArc_8, + SketchArc_9, + SketchArc_10, + SketchLine_5, + SketchLine_6, + SketchLine_7, + SketchLine_8, + SketchLine_9, + SketchLine_10, + SketchLine_11, + SketchLine_4, + SketchLine_12, + SketchLine_13, + SketchLine_14, + SketchLine_15, + SketchLine_16, + SketchLine_17, + SketchLine_18, + SketchArc_2, + SketchArc_11, + SketchArc_12, + SketchArc_13, + SketchArc_14, + SketchArc_15, + SketchArc_16, + SketchArc_17, +] = SketchMultiRotation_1.rotated() SketchArc_13.setName("SketchArc_9") SketchArc_13.result().setName("SketchArc_9") SketchArc_13.results()[1].setName("SketchArc_9_2") @@ -86,47 +170,163 @@ SketchArc_8.results()[1].setName("SketchArc_11_2") SketchArc_7.setName("SketchArc_10") SketchArc_7.result().setName("SketchArc_10") SketchArc_7.results()[1].setName("SketchArc_10_2") -SketchArc_18 = Sketch_1.addArc(0, 0, -25.87140787967873, 15.18783244321905, -29.03326726268915, 7.554428638438678, False) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_3.results()[1], SketchArc_18.results()[1]) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_3.center(), SketchArc_18.center()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_18.startPoint(), SketchArc_4.results()[1]) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchArc_11.results()[1]) -SketchArc_19 = Sketch_1.addArc(0, 0, 15.18783244321906, 25.87140787967872, 7.554428638438674, 29.03326726268915, False) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_19.endPoint(), SketchArc_2.results()[1]) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchArc_18.results()[1], SketchArc_19.results()[1]) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_18.center(), SketchArc_19.center()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_19.startPoint(), SketchArc_10.results()[1]) -SketchArc_20 = Sketch_1.addArc(0, 0, -29.03326726268915, -7.55442863843867, -25.87140787967874, -15.18783244321904, False) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchArc_18.results()[1], SketchArc_20.results()[1]) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_18.center(), SketchArc_20.center()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_20.startPoint(), SketchArc_5.results()[1]) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_18.endPoint(), SketchArc_12.results()[1]) -SketchArc_21 = Sketch_1.addArc(0, 0, -15.18783244321905, -25.87140787967873, -7.554428638438704, -29.03326726268914, False) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchArc_20.results()[1], SketchArc_21.results()[1]) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_20.center(), SketchArc_21.center()) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_20.endPoint(), SketchArc_13.results()[1]) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_21.startPoint(), SketchArc_6.results()[1]) -SketchArc_22 = Sketch_1.addArc(0, 0, 25.87140787967873, -15.18783244321906, 29.03326726268915, -7.55442863843869, False) -SketchConstraintEqual_5 = Sketch_1.setEqual(SketchArc_21.results()[1], SketchArc_22.results()[1]) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchArc_21.center(), SketchArc_22.center()) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchArc_22.startPoint(), SketchArc_8.results()[1]) -SketchArc_23 = Sketch_1.addArc(0, 0, 29.03326726268915, 7.554428638438663, 25.87140787967874, 15.18783244321903, False) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchArc_23.endPoint(), SketchArc_17.results()[1]) -SketchConstraintEqual_6 = Sketch_1.setEqual(SketchArc_22.results()[1], SketchArc_23.results()[1]) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_22.center(), SketchArc_23.center()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchArc_22.endPoint(), SketchArc_16.results()[1]) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchArc_23.startPoint(), SketchArc_9.results()[1]) -SketchArc_24 = Sketch_1.addArc(0, 0, 7.554428638438642, -29.03326726268916, 15.18783244321904, -25.87140787967875, False) +SketchArc_18 = Sketch_1.addArc( + 0, + 0, + -25.87140787967873, + 15.18783244321905, + -29.03326726268915, + 7.554428638438678, + False, +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchArc_3.results()[1], SketchArc_18.results()[1] +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchArc_18.center() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_18.startPoint(), SketchArc_4.results()[1] +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchArc_11.results()[1] +) +SketchArc_19 = Sketch_1.addArc( + 0, + 0, + 15.18783244321906, + 25.87140787967872, + 7.554428638438674, + 29.03326726268915, + False, +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_19.endPoint(), SketchArc_2.results()[1] +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchArc_18.results()[1], SketchArc_19.results()[1] +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_18.center(), SketchArc_19.center() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_19.startPoint(), SketchArc_10.results()[1] +) +SketchArc_20 = Sketch_1.addArc( + 0, + 0, + -29.03326726268915, + -7.55442863843867, + -25.87140787967874, + -15.18783244321904, + False, +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchArc_18.results()[1], SketchArc_20.results()[1] +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_18.center(), SketchArc_20.center() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_20.startPoint(), SketchArc_5.results()[1] +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_18.endPoint(), SketchArc_12.results()[1] +) +SketchArc_21 = Sketch_1.addArc( + 0, + 0, + -15.18783244321905, + -25.87140787967873, + -7.554428638438704, + -29.03326726268914, + False, +) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchArc_20.results()[1], SketchArc_21.results()[1] +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_20.center(), SketchArc_21.center() +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchArc_20.endPoint(), SketchArc_13.results()[1] +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchArc_21.startPoint(), SketchArc_6.results()[1] +) +SketchArc_22 = Sketch_1.addArc( + 0, + 0, + 25.87140787967873, + -15.18783244321906, + 29.03326726268915, + -7.55442863843869, + False, +) +SketchConstraintEqual_5 = Sketch_1.setEqual( + SketchArc_21.results()[1], SketchArc_22.results()[1] +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchArc_21.center(), SketchArc_22.center() +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchArc_22.startPoint(), SketchArc_8.results()[1] +) +SketchArc_23 = Sketch_1.addArc( + 0, + 0, + 29.03326726268915, + 7.554428638438663, + 25.87140787967874, + 15.18783244321903, + False, +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchArc_23.endPoint(), SketchArc_17.results()[1] +) +SketchConstraintEqual_6 = Sketch_1.setEqual( + SketchArc_22.results()[1], SketchArc_23.results()[1] +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchArc_22.center(), SketchArc_23.center() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchArc_22.endPoint(), SketchArc_16.results()[1] +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchArc_23.startPoint(), SketchArc_9.results()[1] +) +SketchArc_24 = Sketch_1.addArc( + 0, + 0, + 7.554428638438642, + -29.03326726268916, + 15.18783244321904, + -25.87140787967875, + False, +) SketchArc_24.setName("SketchArc_47") SketchArc_24.result().setName("SketchArc_47") SketchArc_24.results()[1].setName("SketchArc_47_2") -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchArc_24.endPoint(), SketchArc_15.results()[1]) -SketchConstraintEqual_7 = Sketch_1.setEqual(SketchArc_21.results()[1], SketchArc_24.results()[1]) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_21.center(), SketchArc_24.center()) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchArc_21.endPoint(), SketchArc_14.results()[1]) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_24.startPoint(), SketchArc_7.results()[1]) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchArc_24.endPoint(), SketchArc_15.results()[1] +) +SketchConstraintEqual_7 = Sketch_1.setEqual( + SketchArc_21.results()[1], SketchArc_24.results()[1] +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchArc_21.center(), SketchArc_24.center() +) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchArc_21.endPoint(), SketchArc_14.results()[1] +) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchArc_24.startPoint(), SketchArc_7.results()[1] +) model.do() -Wire_1 = model.addWire(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], False) +Wire_1 = model.addWire( + Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], False +) model.end() @@ -141,4 +341,4 @@ model.testNbSubShapes(Wire_1, GeomAPI_Shape.EDGE, [40]) model.testNbSubShapes(Wire_1, GeomAPI_Shape.VERTEX, [80]) model.testResultsVolumes(Wire_1, [0]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/Test1920.py b/src/BuildPlugin/Test/Test1920.py index 54b2b93f9..ab2307f71 100644 --- a/src/BuildPlugin/Test/Test1920.py +++ b/src/BuildPlugin/Test/Test1920.py @@ -28,31 +28,76 @@ SketchLine_1 = Sketch_1.addLine(0, 50, 100, 50) SketchLine_2 = Sketch_1.addLine(100, 50, 100, 0) SketchLine_3 = Sketch_1.addLine(100, 0, 0, 0) SketchLine_4 = Sketch_1.addLine(0, 0, 0, 50) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.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(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()) +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/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/ME:Translated&Sketch_1/SketchLine_4"), model.selection("EDGE", "Translation_1_1/ME:Translated&Sketch_1/SketchLine_1"), model.selection("EDGE", "Translation_1_1/ME:Translated&Sketch_1/SketchLine_5"), model.selection("EDGE", "Translation_1_1/ME:Translated&Sketch_1/SketchLine_3"), model.selection("EDGE", "Translation_1_2/ME:Translated&Sketch_1/SketchLine_1"), model.selection("EDGE", "Translation_1_2/ME:Translated&Sketch_1/SketchLine_2"), model.selection("EDGE", "Translation_1_2/ME:Translated&Sketch_1/SketchLine_3"), model.selection("EDGE", "Translation_1_2/ME:Translated&Sketch_1/SketchLine_5")]) +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/ME:Translated&Sketch_1/SketchLine_4"), + model.selection("EDGE", "Translation_1_1/ME:Translated&Sketch_1/SketchLine_1"), + model.selection("EDGE", "Translation_1_1/ME:Translated&Sketch_1/SketchLine_5"), + model.selection("EDGE", "Translation_1_1/ME:Translated&Sketch_1/SketchLine_3"), + model.selection("EDGE", "Translation_1_2/ME:Translated&Sketch_1/SketchLine_1"), + model.selection("EDGE", "Translation_1_2/ME:Translated&Sketch_1/SketchLine_2"), + model.selection("EDGE", "Translation_1_2/ME:Translated&Sketch_1/SketchLine_3"), + model.selection("EDGE", "Translation_1_2/ME:Translated&Sketch_1/SketchLine_5"), + ], +) aGroupFeature = Group_1.feature() aSelectionList = aGroupFeature.selectionList("group_list") model.end() -assert(aSelectionList.size() == 8) +assert aSelectionList.size() == 8 for index in range(0, aSelectionList.size()): attrSelection = aSelectionList.value(index) shape = attrSelection.value() name = attrSelection.namingName() - assert(shape.isEdge()) - assert(name) + assert shape.isEdge() + assert name -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/Test20469.py b/src/BuildPlugin/Test/Test20469.py index 2e67a0a8a..131d294e1 100644 --- a/src/BuildPlugin/Test/Test20469.py +++ b/src/BuildPlugin/Test/Test20469.py @@ -28,7 +28,9 @@ Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "ep", "0.055") ### Create Plane -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 2.8667, False) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "PartSet/XOY"), 2.8667, False +) ### Create Sketch Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) @@ -107,66 +109,246 @@ SketchPoint_55 = Sketch_2.addPoint(0.04439808000000001, -0.17296752) SketchPoint_56 = Sketch_2.addPoint(0.009866240000000002, -0.08397866) ### Create SketchBSpline -SketchBSpline_1_poles = [(0, 0), - (9.014752251795682e-05, 0.05451214529317949), - (0.02532271171862411, 0.15579971775632), - (0.1083431350565314, 0.2748971692083296), - (0.2055162110916063, 0.3762476714704591), - (0.3226869043516477, 0.4417758873955893), - (0.4396106030030269, 0.5114950821406695), - (0.5686113665746824, 0.5543315380381274), - (0.7080109281378321, 0.6032643908580265), - (0.8627418437966349, 0.6310529967664337), - (1.038760710497959, 0.658153841986185), - (1.22044861142381, 0.6481760900098785), - (1.409221724680022, 0.652722089409154), - (1.576578009046891, 0.6165884029638471), - (1.750622207371201, 0.6101568179490738), - (1.923498511038718, 0.5633997285939256), - (2.101468637706691, 0.5160168977121142), - (2.26756869845679, 0.4799182653430439), - (2.415109663038519, 0.4380247760586003), - (2.559003214216268, 0.3937264274604114), - (2.717970834232034, 0.3510185960290838), - (2.881379255194576, 0.2994130045705585), - (3.044331614256414, 0.2554589350745441), - (3.196663224032949, 0.2002205281261157), - (3.35069087314937, 0.1557508658621287), - (3.498630901739528, 0.1100749985226144), - (3.626758629069007, 0.07354615416618171), - (3.739427723854896, 0.03597634464461345), - (3.813716543275791, 0.02837078095396758), - (3.876876038873482, -0.02879298081488075), - (3.682323148493558, 0.01775150116288641), - (3.59938700895519, 0.01042701260276317), - (3.435447203044759, 0.007149079513330234), - (3.314513764134776, -0.02220772128681932), - (3.18286942455218, -0.05232760411385905), - (3.042896269666392, -0.1005145549495807), - (2.881422363667546, -0.1529357624091193), - (2.715356347244343, -0.2233467064370982), - (2.550824101050534, -0.2921770145750037), - (2.405271709687024, -0.3565989754466209), - (2.262755596022538, -0.4148284616351946), - (2.100460548562433, -0.4902544331640812), - (1.907228846399618, -0.5500679945393977), - (1.712805296024295, -0.6276431801884527), - (1.52116538281023, -0.6672841271228219), - (1.336949021174942, -0.6896647034143828), - (1.155869430538025, -0.7022133885319179), - (0.9881819820589015, -0.7038770986545503), - (0.8328846107160076, -0.6739914241952796), - (0.6860347780845882, -0.6386140063120748), - (0.5400707121799601, -0.6015647674456689), - (0.4182774376387844, -0.5270750025520176), - (0.3022771427307028, -0.4533773192679936), - (0.1872763782990937, -0.3753721045244912), - (0.1041307066426412, -0.2741285283554168), - (0.04291862690830676, -0.177004007658222), - (0.0185030859727657, -0.1148400743684852), - (0.009866240000000002, -0.08397866) - ] -SketchBSpline_1 = Sketch_2.addSpline(degree = 3, poles = SketchBSpline_1_poles, weights = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], knots = [0, 0.01860336163521267, 0.03677344027717935, 0.0508363049754388, 0.0681916392804011, 0.08415184938325194, 0.09913917386834825, 0.1163349772413292, 0.1366359422890603, 0.1549131538674821, 0.1794784236049427, 0.2011245430557611, 0.2218086624397829, 0.2400252925906828, 0.2628042259083713, 0.2851566328948674, 0.3055900477586722, 0.3231961160252453, 0.3396727392234426, 0.359121125995382, 0.3817088598254108, 0.4005953257674918, 0.4190986615685892, 0.4392741570447567, 0.4576031798532225, 0.4740798030514198, 0.4868598578148062, 0.4991917342048151, 0.5017244814860118, 0.5116864156093297, 0.5366035207975692, 0.5509627564215326, 0.5658707575129726, 0.5815411201190975, 0.5987369234920785, 0.6185207473608354, 0.641866954108396, 0.6628243946707135, 0.6819452440086935, 0.6984518054499047, 0.7175684625877018, 0.7454946578808465, 0.7702707840614231, 0.7918372885014108, 0.8148270864302183, 0.836225083387823, 0.8564032777714525, 0.8741988374599583, 0.8922207646184928, 0.910267059554588, 0.9272947229425885, 0.9425596161747006, 0.9593069836005957, 0.9763298627094416, 0.9886868701731323, 1], multiplicities = [4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4]) +SketchBSpline_1_poles = [ + (0, 0), + (9.014752251795682e-05, 0.05451214529317949), + (0.02532271171862411, 0.15579971775632), + (0.1083431350565314, 0.2748971692083296), + (0.2055162110916063, 0.3762476714704591), + (0.3226869043516477, 0.4417758873955893), + (0.4396106030030269, 0.5114950821406695), + (0.5686113665746824, 0.5543315380381274), + (0.7080109281378321, 0.6032643908580265), + (0.8627418437966349, 0.6310529967664337), + (1.038760710497959, 0.658153841986185), + (1.22044861142381, 0.6481760900098785), + (1.409221724680022, 0.652722089409154), + (1.576578009046891, 0.6165884029638471), + (1.750622207371201, 0.6101568179490738), + (1.923498511038718, 0.5633997285939256), + (2.101468637706691, 0.5160168977121142), + (2.26756869845679, 0.4799182653430439), + (2.415109663038519, 0.4380247760586003), + (2.559003214216268, 0.3937264274604114), + (2.717970834232034, 0.3510185960290838), + (2.881379255194576, 0.2994130045705585), + (3.044331614256414, 0.2554589350745441), + (3.196663224032949, 0.2002205281261157), + (3.35069087314937, 0.1557508658621287), + (3.498630901739528, 0.1100749985226144), + (3.626758629069007, 0.07354615416618171), + (3.739427723854896, 0.03597634464461345), + (3.813716543275791, 0.02837078095396758), + (3.876876038873482, -0.02879298081488075), + (3.682323148493558, 0.01775150116288641), + (3.59938700895519, 0.01042701260276317), + (3.435447203044759, 0.007149079513330234), + (3.314513764134776, -0.02220772128681932), + (3.18286942455218, -0.05232760411385905), + (3.042896269666392, -0.1005145549495807), + (2.881422363667546, -0.1529357624091193), + (2.715356347244343, -0.2233467064370982), + (2.550824101050534, -0.2921770145750037), + (2.405271709687024, -0.3565989754466209), + (2.262755596022538, -0.4148284616351946), + (2.100460548562433, -0.4902544331640812), + (1.907228846399618, -0.5500679945393977), + (1.712805296024295, -0.6276431801884527), + (1.52116538281023, -0.6672841271228219), + (1.336949021174942, -0.6896647034143828), + (1.155869430538025, -0.7022133885319179), + (0.9881819820589015, -0.7038770986545503), + (0.8328846107160076, -0.6739914241952796), + (0.6860347780845882, -0.6386140063120748), + (0.5400707121799601, -0.6015647674456689), + (0.4182774376387844, -0.5270750025520176), + (0.3022771427307028, -0.4533773192679936), + (0.1872763782990937, -0.3753721045244912), + (0.1041307066426412, -0.2741285283554168), + (0.04291862690830676, -0.177004007658222), + (0.0185030859727657, -0.1148400743684852), + (0.009866240000000002, -0.08397866), +] +SketchBSpline_1 = Sketch_2.addSpline( + degree=3, + poles=SketchBSpline_1_poles, + weights=[ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + ], + knots=[ + 0, + 0.01860336163521267, + 0.03677344027717935, + 0.0508363049754388, + 0.0681916392804011, + 0.08415184938325194, + 0.09913917386834825, + 0.1163349772413292, + 0.1366359422890603, + 0.1549131538674821, + 0.1794784236049427, + 0.2011245430557611, + 0.2218086624397829, + 0.2400252925906828, + 0.2628042259083713, + 0.2851566328948674, + 0.3055900477586722, + 0.3231961160252453, + 0.3396727392234426, + 0.359121125995382, + 0.3817088598254108, + 0.4005953257674918, + 0.4190986615685892, + 0.4392741570447567, + 0.4576031798532225, + 0.4740798030514198, + 0.4868598578148062, + 0.4991917342048151, + 0.5017244814860118, + 0.5116864156093297, + 0.5366035207975692, + 0.5509627564215326, + 0.5658707575129726, + 0.5815411201190975, + 0.5987369234920785, + 0.6185207473608354, + 0.641866954108396, + 0.6628243946707135, + 0.6819452440086935, + 0.6984518054499047, + 0.7175684625877018, + 0.7454946578808465, + 0.7702707840614231, + 0.7918372885014108, + 0.8148270864302183, + 0.836225083387823, + 0.8564032777714525, + 0.8741988374599583, + 0.8922207646184928, + 0.910267059554588, + 0.9272947229425885, + 0.9425596161747006, + 0.9593069836005957, + 0.9763298627094416, + 0.9886868701731323, + 1, + ], + multiplicities=[ + 4, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 4, + ], +) Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchBSpline_1.startPoint()) Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchBSpline_1.result()) Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchBSpline_1.result()) @@ -281,67 +463,250 @@ Sketch_2.setCoincident(SketchPoint_55.coordinates(), SketchBSpline_1.result()) Sketch_2.setCoincident(SketchPoint_56.coordinates(), SketchBSpline_1.endPoint()) ### Create SketchBSpline -SketchBSpline_2_poles = [(0, 0), - (9.014752251795682e-05, 0.05451214529317949), - (0.02532271171862411, 0.15579971775632), - (0.1083431350565314, 0.2748971692083296), - (0.2055162110916063, 0.3762476714704591), - (0.3226869043516477, 0.4417758873955893), - (0.4396106030030269, 0.5114950821406695), - (0.5686113665746824, 0.5543315380381274), - (0.7080109281378321, 0.6032643908580265), - (0.8627418437966349, 0.6310529967664337), - (1.038760710497959, 0.658153841986185), - (1.22044861142381, 0.6481760900098785), - (1.409221724680022, 0.652722089409154), - (1.576578009046891, 0.6165884029638471), - (1.750622207371201, 0.6101568179490738), - (1.923498511038718, 0.5633997285939256), - (2.101468637706691, 0.5160168977121142), - (2.26756869845679, 0.4799182653430439), - (2.415109663038519, 0.4380247760586003), - (2.559003214216268, 0.3937264274604114), - (2.717970834232034, 0.3510185960290838), - (2.881379255194576, 0.2994130045705585), - (3.044331614256414, 0.2554589350745441), - (3.196663224032949, 0.2002205281261157), - (3.35069087314937, 0.1557508658621287), - (3.498630901739528, 0.1100749985226144), - (3.626758629069007, 0.07354615416618171), - (3.739427723854896, 0.03597634464461345), - (3.813716543275791, 0.02837078095396758), - (3.876876038873482, -0.02879298081488075), - (3.682323148493558, 0.01775150116288641), - (3.59938700895519, 0.01042701260276316), - (3.435447203044759, 0.007149079513330239), - (3.314513764134776, -0.02220772128681934), - (3.182869424552179, -0.05232760411385898), - (3.042896269666394, -0.100514554949581), - (2.881422363667536, -0.1529357624091178), - (2.715356347244389, -0.2233467064371046), - (2.550824101050389, -0.2921770145749832), - (2.405271709687486, -0.3565989754466863), - (2.262755596020973, -0.4148284616349733), - (2.100460548570712, -0.490254433165252), - (1.907228846355101, -0.5500679945331017), - (1.712805296160232, -0.627643180207678), - (1.521165382362285, -0.66728412705947), - (1.336949022926033, -0.6896647036620358), - (1.155869424658838, -0.7022133877004375), - (0.9881820016357848, -0.7038771014232653), - (0.8328845467272493, -0.6739914151454918), - (0.6860350214810707, -0.638614040735098), - (0.5400698242489836, -0.6015646418675653), - (0.4182804086275665, -0.5270754227323547), - (0.302266907807943, -0.4533758717656259), - (0.1873191972961234, -0.3753781603200299), - (0.1039872761267704, -0.2741082432964857), - (0.04328037620103962, -0.1770551690563165), - (0.006988972040230026, -0.08835445483623842), - (-0.0008115069204040052, -0.02871741534942534), - (0, 0) - ] -SketchBSpline_2 = Sketch_2.addSpline(degree = 3, poles = SketchBSpline_2_poles, weights = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], knots = [0, 0.01841877717868692, 0.03640857044229438, 0.0503319019589481, 0.06751503486217877, 0.08331688612829682, 0.09815550484724707, 0.1151806897007172, 0.1352802264972665, 0.1533760897133781, 0.1776976203324573, 0.1991289647725509, 0.2196078542088847, 0.2376437370925934, 0.2601966555045284, 0.2823272796231457, 0.3025579520551492, 0.3199893311119836, 0.3363024715699076, 0.3555578894595023, 0.3779215054846461, 0.3966205779803185, 0.4149403217914447, 0.43491563393835, 0.453062794308183, 0.4693759347661071, 0.4820291845192418, 0.4942387027706504, 0.496746319874324, 0.5066094106685624, 0.5312792857910991, 0.5454960476108249, 0.5602561299909423, 0.5757710096568369, 0.592796194510307, 0.6123837212555427, 0.6354982845523691, 0.6562477832463178, 0.6751789135618669, 0.6915216952124962, 0.7104486749233012, 0.7380977836510125, 0.762628078574017, 0.7839805979515587, 0.8067422887543781, 0.8279279725980087, 0.8479059568735401, 0.8655249471990413, 0.8833680589533851, 0.9012352967057089, 0.9180940098763235, 0.9332074432767975, 0.9497886416105058, 0.9666426179720728, 0.9788770179440802, 0.9900778977399243, 1], multiplicities = [4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4]) +SketchBSpline_2_poles = [ + (0, 0), + (9.014752251795682e-05, 0.05451214529317949), + (0.02532271171862411, 0.15579971775632), + (0.1083431350565314, 0.2748971692083296), + (0.2055162110916063, 0.3762476714704591), + (0.3226869043516477, 0.4417758873955893), + (0.4396106030030269, 0.5114950821406695), + (0.5686113665746824, 0.5543315380381274), + (0.7080109281378321, 0.6032643908580265), + (0.8627418437966349, 0.6310529967664337), + (1.038760710497959, 0.658153841986185), + (1.22044861142381, 0.6481760900098785), + (1.409221724680022, 0.652722089409154), + (1.576578009046891, 0.6165884029638471), + (1.750622207371201, 0.6101568179490738), + (1.923498511038718, 0.5633997285939256), + (2.101468637706691, 0.5160168977121142), + (2.26756869845679, 0.4799182653430439), + (2.415109663038519, 0.4380247760586003), + (2.559003214216268, 0.3937264274604114), + (2.717970834232034, 0.3510185960290838), + (2.881379255194576, 0.2994130045705585), + (3.044331614256414, 0.2554589350745441), + (3.196663224032949, 0.2002205281261157), + (3.35069087314937, 0.1557508658621287), + (3.498630901739528, 0.1100749985226144), + (3.626758629069007, 0.07354615416618171), + (3.739427723854896, 0.03597634464461345), + (3.813716543275791, 0.02837078095396758), + (3.876876038873482, -0.02879298081488075), + (3.682323148493558, 0.01775150116288641), + (3.59938700895519, 0.01042701260276316), + (3.435447203044759, 0.007149079513330239), + (3.314513764134776, -0.02220772128681934), + (3.182869424552179, -0.05232760411385898), + (3.042896269666394, -0.100514554949581), + (2.881422363667536, -0.1529357624091178), + (2.715356347244389, -0.2233467064371046), + (2.550824101050389, -0.2921770145749832), + (2.405271709687486, -0.3565989754466863), + (2.262755596020973, -0.4148284616349733), + (2.100460548570712, -0.490254433165252), + (1.907228846355101, -0.5500679945331017), + (1.712805296160232, -0.627643180207678), + (1.521165382362285, -0.66728412705947), + (1.336949022926033, -0.6896647036620358), + (1.155869424658838, -0.7022133877004375), + (0.9881820016357848, -0.7038771014232653), + (0.8328845467272493, -0.6739914151454918), + (0.6860350214810707, -0.638614040735098), + (0.5400698242489836, -0.6015646418675653), + (0.4182804086275665, -0.5270754227323547), + (0.302266907807943, -0.4533758717656259), + (0.1873191972961234, -0.3753781603200299), + (0.1039872761267704, -0.2741082432964857), + (0.04328037620103962, -0.1770551690563165), + (0.006988972040230026, -0.08835445483623842), + (-0.0008115069204040052, -0.02871741534942534), + (0, 0), +] +SketchBSpline_2 = Sketch_2.addSpline( + degree=3, + poles=SketchBSpline_2_poles, + weights=[ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + ], + knots=[ + 0, + 0.01841877717868692, + 0.03640857044229438, + 0.0503319019589481, + 0.06751503486217877, + 0.08331688612829682, + 0.09815550484724707, + 0.1151806897007172, + 0.1352802264972665, + 0.1533760897133781, + 0.1776976203324573, + 0.1991289647725509, + 0.2196078542088847, + 0.2376437370925934, + 0.2601966555045284, + 0.2823272796231457, + 0.3025579520551492, + 0.3199893311119836, + 0.3363024715699076, + 0.3555578894595023, + 0.3779215054846461, + 0.3966205779803185, + 0.4149403217914447, + 0.43491563393835, + 0.453062794308183, + 0.4693759347661071, + 0.4820291845192418, + 0.4942387027706504, + 0.496746319874324, + 0.5066094106685624, + 0.5312792857910991, + 0.5454960476108249, + 0.5602561299909423, + 0.5757710096568369, + 0.592796194510307, + 0.6123837212555427, + 0.6354982845523691, + 0.6562477832463178, + 0.6751789135618669, + 0.6915216952124962, + 0.7104486749233012, + 0.7380977836510125, + 0.762628078574017, + 0.7839805979515587, + 0.8067422887543781, + 0.8279279725980087, + 0.8479059568735401, + 0.8655249471990413, + 0.8833680589533851, + 0.9012352967057089, + 0.9180940098763235, + 0.9332074432767975, + 0.9497886416105058, + 0.9666426179720728, + 0.9788770179440802, + 0.9900778977399243, + 1, + ], + multiplicities=[ + 4, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 4, + ], +) Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchBSpline_2.startPoint()) Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchBSpline_2.endPoint()) Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchBSpline_2.result()) @@ -458,7 +823,69 @@ Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchBSpline_2.endPoint()) ### Create SketchOffset SketchOffset_1 = Sketch_2.addOffset([SketchBSpline_2.result()], 0.055, False) -[SketchBSpline_3, SketchBSpline_4, SketchBSpline_5, SketchBSpline_6, SketchBSpline_7, SketchBSpline_8, SketchBSpline_9, SketchBSpline_10, SketchBSpline_11, SketchBSpline_12, SketchBSpline_13, SketchBSpline_14, SketchBSpline_15, SketchBSpline_16, SketchBSpline_17, SketchBSpline_18, SketchBSpline_19, SketchBSpline_20, SketchBSpline_21, SketchBSpline_22, SketchBSpline_23, SketchBSpline_24, SketchBSpline_25, SketchBSpline_26, SketchBSpline_27, SketchBSpline_28, SketchBSpline_29, SketchBSpline_30, SketchBSpline_31, SketchBSpline_32, SketchBSpline_33, SketchBSpline_34, SketchBSpline_35, SketchBSpline_36, SketchBSpline_37, SketchBSpline_38, SketchBSpline_39, SketchBSpline_40, SketchBSpline_41, SketchBSpline_42, SketchBSpline_43, SketchBSpline_44, SketchBSpline_45, SketchBSpline_46, SketchBSpline_47, SketchBSpline_48, SketchBSpline_49, SketchBSpline_50, SketchBSpline_51, SketchBSpline_52, SketchBSpline_53, SketchBSpline_54, SketchBSpline_55, SketchBSpline_56, SketchBSpline_57, SketchBSpline_58, SketchBSpline_59, SketchBSpline_60, SketchBSpline_61, SketchBSpline_62, SketchBSpline_63] = SketchOffset_1.offset() +[ + SketchBSpline_3, + SketchBSpline_4, + SketchBSpline_5, + SketchBSpline_6, + SketchBSpline_7, + SketchBSpline_8, + SketchBSpline_9, + SketchBSpline_10, + SketchBSpline_11, + SketchBSpline_12, + SketchBSpline_13, + SketchBSpline_14, + SketchBSpline_15, + SketchBSpline_16, + SketchBSpline_17, + SketchBSpline_18, + SketchBSpline_19, + SketchBSpline_20, + SketchBSpline_21, + SketchBSpline_22, + SketchBSpline_23, + SketchBSpline_24, + SketchBSpline_25, + SketchBSpline_26, + SketchBSpline_27, + SketchBSpline_28, + SketchBSpline_29, + SketchBSpline_30, + SketchBSpline_31, + SketchBSpline_32, + SketchBSpline_33, + SketchBSpline_34, + SketchBSpline_35, + SketchBSpline_36, + SketchBSpline_37, + SketchBSpline_38, + SketchBSpline_39, + SketchBSpline_40, + SketchBSpline_41, + SketchBSpline_42, + SketchBSpline_43, + SketchBSpline_44, + SketchBSpline_45, + SketchBSpline_46, + SketchBSpline_47, + SketchBSpline_48, + SketchBSpline_49, + SketchBSpline_50, + SketchBSpline_51, + SketchBSpline_52, + SketchBSpline_53, + SketchBSpline_54, + SketchBSpline_55, + SketchBSpline_56, + SketchBSpline_57, + SketchBSpline_58, + SketchBSpline_59, + SketchBSpline_60, + SketchBSpline_61, + SketchBSpline_62, + SketchBSpline_63, +] = SketchOffset_1.offset() model.do() ### Create Wire @@ -475,4 +902,4 @@ model.testNbSubShapes(Wire_1, GeomAPI_Shape.FACE, [0, 0]) model.testNbSubShapes(Wire_1, GeomAPI_Shape.EDGE, [2, 61]) model.testNbSubShapes(Wire_1, GeomAPI_Shape.VERTEX, [4, 122]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/Test20513_1.py b/src/BuildPlugin/Test/Test20513_1.py index eb587e37c..dc5ebd3b9 100644 --- a/src/BuildPlugin/Test/Test20513_1.py +++ b/src/BuildPlugin/Test/Test20513_1.py @@ -32,55 +32,100 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() ### Create SketchBSpline -SketchBSpline_1_poles = [(0, 0), - (64.69989977297864, 3.820449445888325), - (63.227018959685, 42.02181716036146), - (19.7442263567145, 66.94290132940253), - (0, 0) - ] -SketchBSpline_1 = Sketch_1.addSpline(poles = SketchBSpline_1_poles) -[SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6] = SketchBSpline_1.controlPoles(auxiliary = [0, 1, 2, 3, 4]) -[SketchLine_1, SketchLine_2, SketchLine_3, SketchLine_4] = SketchBSpline_1.controlPolygon(auxiliary = [0, 1, 2, 3]) -Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchPoint_1.result()) -Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_6).coordinates(), SketchPoint_1.result()) +SketchBSpline_1_poles = [ + (0, 0), + (64.69989977297864, 3.820449445888325), + (63.227018959685, 42.02181716036146), + (19.7442263567145, 66.94290132940253), + (0, 0), +] +SketchBSpline_1 = Sketch_1.addSpline(poles=SketchBSpline_1_poles) +[ + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, +] = SketchBSpline_1.controlPoles(auxiliary=[0, 1, 2, 3, 4]) +[ + SketchLine_1, + SketchLine_2, + SketchLine_3, + SketchLine_4, +] = SketchBSpline_1.controlPolygon(auxiliary=[0, 1, 2, 3]) +Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchPoint_1.result() +) +Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_6).coordinates(), SketchPoint_1.result() +) model.do() ### Create Plane -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchBSpline_1f"), 10, False) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchBSpline_1f"), 10, False +) ### Create Sketch Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) ### Create SketchProjection -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_7 = SketchProjection_2.createdFeature() ### Create SketchBSpline -SketchBSpline_2_poles = [(0, 0), - (8.839087148173476, 45.21301708610518), - (53.18579907801947, 39.22586299994072), - (47.99568029170977, 4.506542817571567), - (0, 0) - ] -SketchBSpline_2 = Sketch_2.addSpline(poles = SketchBSpline_2_poles) -[SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11, SketchPoint_12] = SketchBSpline_2.controlPoles(auxiliary = [0, 1, 2, 3, 4]) -[SketchLine_5, SketchLine_6, SketchLine_7, SketchLine_8] = SketchBSpline_2.controlPolygon(auxiliary = [0, 1, 2, 3]) -Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_8).coordinates(), SketchPoint_7.result()) -Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_12).coordinates(), SketchPoint_7.result()) +SketchBSpline_2_poles = [ + (0, 0), + (8.839087148173476, 45.21301708610518), + (53.18579907801947, 39.22586299994072), + (47.99568029170977, 4.506542817571567), + (0, 0), +] +SketchBSpline_2 = Sketch_2.addSpline(poles=SketchBSpline_2_poles) +[ + SketchPoint_8, + SketchPoint_9, + SketchPoint_10, + SketchPoint_11, + SketchPoint_12, +] = SketchBSpline_2.controlPoles(auxiliary=[0, 1, 2, 3, 4]) +[ + SketchLine_5, + SketchLine_6, + SketchLine_7, + SketchLine_8, +] = SketchBSpline_2.controlPolygon(auxiliary=[0, 1, 2, 3]) +Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_8).coordinates(), SketchPoint_7.result() +) +Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_12).coordinates(), SketchPoint_7.result() +) model.do() ### Create Wire -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchBSpline_1")], False) +Wire_1 = model.addWire( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchBSpline_1")], False +) ### Create Wire -Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchBSpline_2")], False) +Wire_2 = model.addWire( + Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchBSpline_2")], False +) ### Create Filling -Filling_1 = model.addFilling(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")]) +Filling_1 = model.addFilling( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")], +) model.end() @@ -94,4 +139,4 @@ model.testNbSubShapes(Filling_1, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Filling_1, GeomAPI_Shape.VERTEX, [8]) model.testResultsAreas(Filling_1, [1872.0403629667237]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/Test20513_2.py b/src/BuildPlugin/Test/Test20513_2.py index 8250f78e4..8630ebe14 100644 --- a/src/BuildPlugin/Test/Test20513_2.py +++ b/src/BuildPlugin/Test/Test20513_2.py @@ -27,7 +27,9 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() ### Create Plane -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 36.35, False) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "PartSet/XOY"), 36.35, False +) ### Create Sketch Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) @@ -289,75 +291,282 @@ SketchPoint_64 = Sketch_1.addPoint(3.4715326, -0.06510218) SketchPoint_64.setAuxiliary(True) ### Create SketchBSpline -SketchBSpline_1_poles = [(3.502, 0), - (3.501708060470513, 0.03160465459957851), - (3.482306354808988, 0.08478594846732339), - (3.416982460484224, 0.1463028723964636), - (3.330867828938158, 0.1897725095120994), - (3.23691571256371, 0.2438885707817408), - (3.132475493449838, 0.2847168793431304), - (3.028693716669709, 0.3242771718865035), - (2.935991590725414, 0.3481773438606656), - (2.846302117977083, 0.3714272918230952), - (2.761971777722034, 0.3876700086132496), - (2.670901019132808, 0.3971222319904175), - (2.577912212391188, 0.4199064802107029), - (2.47138895770733, 0.4307739368475885), - (2.347934842807255, 0.4411206976945238), - (2.208393417939975, 0.4367094703481399), - (2.066490356928406, 0.4424654746602308), - (1.931861446733529, 0.4266278861079822), - (1.813439066878724, 0.4202402668802049), - (1.706149087521655, 0.3984156148279285), - (1.600151931908012, 0.381280150658782), - (1.487912755840739, 0.3651602028428825), - (1.37022484781707, 0.343451145226399), - (1.248225848031129, 0.3155391742155946), - (1.122361457008797, 0.2925847187390579), - (1.003957496481461, 0.2621074537257155), - (0.8961617237627484, 0.2345532360663585), - (0.7918988749704297, 0.211845235390749), - (0.6808742181768952, 0.1856161550032198), - (0.5591323563208087, 0.1555837712922512), - (0.4432312945768512, 0.1299207001590713), - (0.3369105879407892, 0.1005196423732715), - (0.2422714917388343, 0.0789561461823229), - (0.1454129368472911, 0.05575321928504596), - (0.07867537192801388, 0.04292748679362836), - (-0.03801510663679483, -0.009036231961024368), - (0.09668159902862462, 0.02124137982940557), - (0.1631020115172611, 0.02544418940840985), - (0.2670052837801755, 0.02725755100255278), - (0.3669396449571852, 0.02499900964975237), - (0.4758196106561338, 0.02860804255883151), - (0.587520466545792, 0.01701112796086315), - (0.696501264135322, 0.003600344371230613), - (0.8046893603429499, -0.01419519074507264), - (0.9160129303585658, -0.03746502686037816), - (1.03084989928976, -0.05621611703810876), - (1.15892564877219, -0.09721235004459683), - (1.293587814245105, -0.1248468755833264), - (1.432121846768275, -0.1540096476220431), - (1.560708865933035, -0.187062827568635), - (1.686271640551389, -0.2189476512659969), - (1.814669465172142, -0.2409413298907317), - (1.94672182252948, -0.2618358185518865), - (2.083258581034335, -0.2785950467488627), - (2.222670155691588, -0.2918735040977562), - (2.366549046533922, -0.297866371507273), - (2.504656418820893, -0.3018436275465021), - (2.643344514150033, -0.2930128256147972), - (2.769720467648912, -0.2834650455787363), - (2.896386200659248, -0.2699367156705364), - (3.025904808388414, -0.2471667438643729), - (3.168089816001797, -0.2147033470830538), - (3.297598829858346, -0.1692120751505936), - (3.4021366076639, -0.1232968436621545), - (3.474062839110283, -0.07177094713741811), - (3.497525008229238, -0.02562138888775374), - (3.502, 0) - ] -SketchBSpline_1 = Sketch_1.addSpline(degree = 3, poles = SketchBSpline_1_poles, weights = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], knots = [0, 0.01183488863837179, 0.0231901864984856, 0.03559858893144927, 0.05144916515834002, 0.06759531467622239, 0.0815379341596944, 0.09700677492797639, 0.1068321569610141, 0.1195693666101132, 0.1322085557927937, 0.1443579416201434, 0.1587691279665198, 0.1760903712525299, 0.1951577895815503, 0.2160169703364635, 0.2342490967534491, 0.2507056052742759, 0.2646118431448987, 0.2791077011690486, 0.2947823396709444, 0.3111417859997592, 0.3282046159595691, 0.3461398429174012, 0.3636238095657637, 0.3783618826153202, 0.391801869278653, 0.4074107325669362, 0.4251844860013295, 0.4432460569026663, 0.4561791711061376, 0.4702697244163377, 0.4837214559733177, 0.4948377859291224, 0.5047442665271804, 0.5143904392393579, 0.5287967600422182, 0.5400951120443203, 0.5549899587260146, 0.5704834338205002, 0.5845372797011691, 0.601053244848017, 0.6155483198902286, 0.6295130832805995, 0.6477395111687876, 0.6632083519370694, 0.6845974067707579, 0.7041119934399063, 0.7213087363026549, 0.7390824897370483, 0.7572531654218201, 0.7747391660376208, 0.7939534892917685, 0.8137003452650871, 0.8321903971419141, 0.8530516926114459, 0.8703550992317159, 0.8891841498048808, 0.9050749088751692, 0.9226079659764084, 0.9431244997359293, 0.9648828024586863, 0.9787328512217585, 0.9901668364115462, 1], multiplicities = [4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4]) +SketchBSpline_1_poles = [ + (3.502, 0), + (3.501708060470513, 0.03160465459957851), + (3.482306354808988, 0.08478594846732339), + (3.416982460484224, 0.1463028723964636), + (3.330867828938158, 0.1897725095120994), + (3.23691571256371, 0.2438885707817408), + (3.132475493449838, 0.2847168793431304), + (3.028693716669709, 0.3242771718865035), + (2.935991590725414, 0.3481773438606656), + (2.846302117977083, 0.3714272918230952), + (2.761971777722034, 0.3876700086132496), + (2.670901019132808, 0.3971222319904175), + (2.577912212391188, 0.4199064802107029), + (2.47138895770733, 0.4307739368475885), + (2.347934842807255, 0.4411206976945238), + (2.208393417939975, 0.4367094703481399), + (2.066490356928406, 0.4424654746602308), + (1.931861446733529, 0.4266278861079822), + (1.813439066878724, 0.4202402668802049), + (1.706149087521655, 0.3984156148279285), + (1.600151931908012, 0.381280150658782), + (1.487912755840739, 0.3651602028428825), + (1.37022484781707, 0.343451145226399), + (1.248225848031129, 0.3155391742155946), + (1.122361457008797, 0.2925847187390579), + (1.003957496481461, 0.2621074537257155), + (0.8961617237627484, 0.2345532360663585), + (0.7918988749704297, 0.211845235390749), + (0.6808742181768952, 0.1856161550032198), + (0.5591323563208087, 0.1555837712922512), + (0.4432312945768512, 0.1299207001590713), + (0.3369105879407892, 0.1005196423732715), + (0.2422714917388343, 0.0789561461823229), + (0.1454129368472911, 0.05575321928504596), + (0.07867537192801388, 0.04292748679362836), + (-0.03801510663679483, -0.009036231961024368), + (0.09668159902862462, 0.02124137982940557), + (0.1631020115172611, 0.02544418940840985), + (0.2670052837801755, 0.02725755100255278), + (0.3669396449571852, 0.02499900964975237), + (0.4758196106561338, 0.02860804255883151), + (0.587520466545792, 0.01701112796086315), + (0.696501264135322, 0.003600344371230613), + (0.8046893603429499, -0.01419519074507264), + (0.9160129303585658, -0.03746502686037816), + (1.03084989928976, -0.05621611703810876), + (1.15892564877219, -0.09721235004459683), + (1.293587814245105, -0.1248468755833264), + (1.432121846768275, -0.1540096476220431), + (1.560708865933035, -0.187062827568635), + (1.686271640551389, -0.2189476512659969), + (1.814669465172142, -0.2409413298907317), + (1.94672182252948, -0.2618358185518865), + (2.083258581034335, -0.2785950467488627), + (2.222670155691588, -0.2918735040977562), + (2.366549046533922, -0.297866371507273), + (2.504656418820893, -0.3018436275465021), + (2.643344514150033, -0.2930128256147972), + (2.769720467648912, -0.2834650455787363), + (2.896386200659248, -0.2699367156705364), + (3.025904808388414, -0.2471667438643729), + (3.168089816001797, -0.2147033470830538), + (3.297598829858346, -0.1692120751505936), + (3.4021366076639, -0.1232968436621545), + (3.474062839110283, -0.07177094713741811), + (3.497525008229238, -0.02562138888775374), + (3.502, 0), +] +SketchBSpline_1 = Sketch_1.addSpline( + degree=3, + poles=SketchBSpline_1_poles, + weights=[ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + ], + knots=[ + 0, + 0.01183488863837179, + 0.0231901864984856, + 0.03559858893144927, + 0.05144916515834002, + 0.06759531467622239, + 0.0815379341596944, + 0.09700677492797639, + 0.1068321569610141, + 0.1195693666101132, + 0.1322085557927937, + 0.1443579416201434, + 0.1587691279665198, + 0.1760903712525299, + 0.1951577895815503, + 0.2160169703364635, + 0.2342490967534491, + 0.2507056052742759, + 0.2646118431448987, + 0.2791077011690486, + 0.2947823396709444, + 0.3111417859997592, + 0.3282046159595691, + 0.3461398429174012, + 0.3636238095657637, + 0.3783618826153202, + 0.391801869278653, + 0.4074107325669362, + 0.4251844860013295, + 0.4432460569026663, + 0.4561791711061376, + 0.4702697244163377, + 0.4837214559733177, + 0.4948377859291224, + 0.5047442665271804, + 0.5143904392393579, + 0.5287967600422182, + 0.5400951120443203, + 0.5549899587260146, + 0.5704834338205002, + 0.5845372797011691, + 0.601053244848017, + 0.6155483198902286, + 0.6295130832805995, + 0.6477395111687876, + 0.6632083519370694, + 0.6845974067707579, + 0.7041119934399063, + 0.7213087363026549, + 0.7390824897370483, + 0.7572531654218201, + 0.7747391660376208, + 0.7939534892917685, + 0.8137003452650871, + 0.8321903971419141, + 0.8530516926114459, + 0.8703550992317159, + 0.8891841498048808, + 0.9050749088751692, + 0.9226079659764084, + 0.9431244997359293, + 0.9648828024586863, + 0.9787328512217585, + 0.9901668364115462, + 1, + ], + multiplicities=[ + 4, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 4, + ], +) Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchBSpline_1.startPoint()) Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchBSpline_1.endPoint()) Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchBSpline_1.result()) @@ -426,146 +635,278 @@ Sketch_1.setCoincident(SketchPoint_64.coordinates(), SketchBSpline_1.result()) ### Create SketchOffset SketchOffset_1 = Sketch_1.addOffset([SketchBSpline_1.result()], 0.01, False) -[SketchBSpline_2, SketchBSpline_3, SketchBSpline_4, SketchBSpline_5, SketchBSpline_6, SketchBSpline_7, SketchBSpline_8, SketchBSpline_9, SketchBSpline_10, SketchBSpline_11, SketchBSpline_12, SketchBSpline_13, SketchBSpline_14, SketchBSpline_15, SketchBSpline_16, SketchBSpline_17, SketchBSpline_18, SketchBSpline_19, SketchBSpline_20, SketchBSpline_21, SketchBSpline_22, SketchBSpline_23, SketchBSpline_24, SketchBSpline_25, SketchBSpline_26, SketchBSpline_27, SketchBSpline_28, SketchBSpline_29, SketchBSpline_30, SketchBSpline_31, SketchBSpline_32, SketchBSpline_33, SketchBSpline_34, SketchBSpline_35, SketchBSpline_36, SketchBSpline_37, SketchBSpline_38, SketchBSpline_39, SketchBSpline_40, SketchBSpline_41, SketchBSpline_42, SketchBSpline_43, SketchBSpline_44, SketchBSpline_45, SketchBSpline_46, SketchBSpline_47, SketchBSpline_48, SketchBSpline_49, SketchBSpline_50, SketchBSpline_51, SketchBSpline_52, SketchBSpline_53, SketchBSpline_54, SketchBSpline_55, SketchBSpline_56, SketchBSpline_57, SketchBSpline_58, SketchBSpline_59, SketchBSpline_60, SketchBSpline_61, SketchArc_1] = SketchOffset_1.offset() +[ + SketchBSpline_2, + SketchBSpline_3, + SketchBSpline_4, + SketchBSpline_5, + SketchBSpline_6, + SketchBSpline_7, + SketchBSpline_8, + SketchBSpline_9, + SketchBSpline_10, + SketchBSpline_11, + SketchBSpline_12, + SketchBSpline_13, + SketchBSpline_14, + SketchBSpline_15, + SketchBSpline_16, + SketchBSpline_17, + SketchBSpline_18, + SketchBSpline_19, + SketchBSpline_20, + SketchBSpline_21, + SketchBSpline_22, + SketchBSpline_23, + SketchBSpline_24, + SketchBSpline_25, + SketchBSpline_26, + SketchBSpline_27, + SketchBSpline_28, + SketchBSpline_29, + SketchBSpline_30, + SketchBSpline_31, + SketchBSpline_32, + SketchBSpline_33, + SketchBSpline_34, + SketchBSpline_35, + SketchBSpline_36, + SketchBSpline_37, + SketchBSpline_38, + SketchBSpline_39, + SketchBSpline_40, + SketchBSpline_41, + SketchBSpline_42, + SketchBSpline_43, + SketchBSpline_44, + SketchBSpline_45, + SketchBSpline_46, + SketchBSpline_47, + SketchBSpline_48, + SketchBSpline_49, + SketchBSpline_50, + SketchBSpline_51, + SketchBSpline_52, + SketchBSpline_53, + SketchBSpline_54, + SketchBSpline_55, + SketchBSpline_56, + SketchBSpline_57, + SketchBSpline_58, + SketchBSpline_59, + SketchBSpline_60, + SketchBSpline_61, + SketchArc_1, +] = SketchOffset_1.offset() ### Create SketchOffset -SketchOffset_2 = Sketch_1.addOffset([SketchBSpline_1.result()], 0.07000000000000001, False) -[SketchBSpline_62, SketchBSpline_63, SketchBSpline_64, SketchBSpline_65, SketchBSpline_66, SketchBSpline_67, SketchBSpline_68, SketchBSpline_69, SketchBSpline_70, SketchBSpline_71, SketchBSpline_72, SketchBSpline_73, SketchBSpline_74, SketchBSpline_75, SketchBSpline_76, SketchBSpline_77, SketchBSpline_78, SketchBSpline_79, SketchBSpline_80, SketchBSpline_81, SketchBSpline_82, SketchBSpline_83, SketchBSpline_84, SketchBSpline_85, SketchBSpline_86, SketchBSpline_87, SketchBSpline_88, SketchBSpline_89, SketchBSpline_90, SketchBSpline_91, SketchBSpline_92, SketchBSpline_93, SketchBSpline_94, SketchBSpline_95, SketchBSpline_96, SketchBSpline_97, SketchBSpline_98, SketchBSpline_99, SketchBSpline_100, SketchBSpline_101, SketchBSpline_102, SketchBSpline_103, SketchBSpline_104, SketchBSpline_105, SketchBSpline_106, SketchBSpline_107, SketchBSpline_108, SketchBSpline_109, SketchBSpline_110, SketchBSpline_111, SketchBSpline_112, SketchBSpline_113, SketchBSpline_114, SketchBSpline_115, SketchBSpline_116, SketchBSpline_117, SketchBSpline_118, SketchBSpline_119, SketchBSpline_120, SketchBSpline_121, SketchArc_2] = SketchOffset_2.offset() +SketchOffset_2 = Sketch_1.addOffset( + [SketchBSpline_1.result()], 0.07000000000000001, False +) +[ + SketchBSpline_62, + SketchBSpline_63, + SketchBSpline_64, + SketchBSpline_65, + SketchBSpline_66, + SketchBSpline_67, + SketchBSpline_68, + SketchBSpline_69, + SketchBSpline_70, + SketchBSpline_71, + SketchBSpline_72, + SketchBSpline_73, + SketchBSpline_74, + SketchBSpline_75, + SketchBSpline_76, + SketchBSpline_77, + SketchBSpline_78, + SketchBSpline_79, + SketchBSpline_80, + SketchBSpline_81, + SketchBSpline_82, + SketchBSpline_83, + SketchBSpline_84, + SketchBSpline_85, + SketchBSpline_86, + SketchBSpline_87, + SketchBSpline_88, + SketchBSpline_89, + SketchBSpline_90, + SketchBSpline_91, + SketchBSpline_92, + SketchBSpline_93, + SketchBSpline_94, + SketchBSpline_95, + SketchBSpline_96, + SketchBSpline_97, + SketchBSpline_98, + SketchBSpline_99, + SketchBSpline_100, + SketchBSpline_101, + SketchBSpline_102, + SketchBSpline_103, + SketchBSpline_104, + SketchBSpline_105, + SketchBSpline_106, + SketchBSpline_107, + SketchBSpline_108, + SketchBSpline_109, + SketchBSpline_110, + SketchBSpline_111, + SketchBSpline_112, + SketchBSpline_113, + SketchBSpline_114, + SketchBSpline_115, + SketchBSpline_116, + SketchBSpline_117, + SketchBSpline_118, + SketchBSpline_119, + SketchBSpline_120, + SketchBSpline_121, + SketchArc_2, +] = SketchOffset_2.offset() model.do() ### Create Wire Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "SketchBSpline_1")], False) ### Create Wire -Wire_2_objects = [model.selection("EDGE", "SketchBSpline_2"), - model.selection("EDGE", "SketchBSpline_3"), - model.selection("EDGE", "SketchBSpline_4"), - model.selection("EDGE", "SketchBSpline_5"), - model.selection("EDGE", "SketchBSpline_6"), - model.selection("EDGE", "SketchBSpline_7"), - model.selection("EDGE", "SketchBSpline_8"), - model.selection("EDGE", "SketchBSpline_9"), - model.selection("EDGE", "SketchBSpline_10"), - model.selection("EDGE", "SketchBSpline_11"), - model.selection("EDGE", "SketchBSpline_12"), - model.selection("EDGE", "SketchBSpline_13"), - model.selection("EDGE", "SketchBSpline_14"), - model.selection("EDGE", "SketchBSpline_15"), - model.selection("EDGE", "SketchBSpline_16"), - model.selection("EDGE", "SketchBSpline_17"), - model.selection("EDGE", "SketchBSpline_18"), - model.selection("EDGE", "SketchBSpline_19"), - model.selection("EDGE", "SketchBSpline_20"), - model.selection("EDGE", "SketchBSpline_21"), - model.selection("EDGE", "SketchBSpline_22"), - model.selection("EDGE", "SketchBSpline_23"), - model.selection("EDGE", "SketchBSpline_24"), - model.selection("EDGE", "SketchBSpline_25"), - model.selection("EDGE", "SketchBSpline_26"), - model.selection("EDGE", "SketchBSpline_27"), - model.selection("EDGE", "SketchBSpline_28"), - model.selection("EDGE", "SketchBSpline_29"), - model.selection("EDGE", "SketchBSpline_30"), - model.selection("EDGE", "SketchBSpline_31"), - model.selection("EDGE", "SketchBSpline_32"), - model.selection("EDGE", "SketchBSpline_33"), - model.selection("EDGE", "SketchBSpline_34"), - model.selection("EDGE", "SketchBSpline_35"), - model.selection("EDGE", "SketchBSpline_36"), - model.selection("EDGE", "SketchBSpline_37"), - model.selection("EDGE", "SketchBSpline_38"), - model.selection("EDGE", "SketchBSpline_39"), - model.selection("EDGE", "SketchBSpline_40"), - model.selection("EDGE", "SketchBSpline_41"), - model.selection("EDGE", "SketchBSpline_42"), - model.selection("EDGE", "SketchBSpline_43"), - model.selection("EDGE", "SketchBSpline_44"), - model.selection("EDGE", "SketchBSpline_45"), - model.selection("EDGE", "SketchBSpline_46"), - model.selection("EDGE", "SketchBSpline_47"), - model.selection("EDGE", "SketchBSpline_48"), - model.selection("EDGE", "SketchBSpline_49"), - model.selection("EDGE", "SketchBSpline_50"), - model.selection("EDGE", "SketchBSpline_51"), - model.selection("EDGE", "SketchBSpline_52"), - model.selection("EDGE", "SketchBSpline_53"), - model.selection("EDGE", "SketchBSpline_54"), - model.selection("EDGE", "SketchBSpline_55"), - model.selection("EDGE", "SketchBSpline_56"), - model.selection("EDGE", "SketchBSpline_57"), - model.selection("EDGE", "SketchBSpline_58"), - model.selection("EDGE", "SketchBSpline_59"), - model.selection("EDGE", "SketchBSpline_60"), - model.selection("EDGE", "SketchBSpline_61"), - model.selection("EDGE", "SketchArc_1_2")] +Wire_2_objects = [ + model.selection("EDGE", "SketchBSpline_2"), + model.selection("EDGE", "SketchBSpline_3"), + model.selection("EDGE", "SketchBSpline_4"), + model.selection("EDGE", "SketchBSpline_5"), + model.selection("EDGE", "SketchBSpline_6"), + model.selection("EDGE", "SketchBSpline_7"), + model.selection("EDGE", "SketchBSpline_8"), + model.selection("EDGE", "SketchBSpline_9"), + model.selection("EDGE", "SketchBSpline_10"), + model.selection("EDGE", "SketchBSpline_11"), + model.selection("EDGE", "SketchBSpline_12"), + model.selection("EDGE", "SketchBSpline_13"), + model.selection("EDGE", "SketchBSpline_14"), + model.selection("EDGE", "SketchBSpline_15"), + model.selection("EDGE", "SketchBSpline_16"), + model.selection("EDGE", "SketchBSpline_17"), + model.selection("EDGE", "SketchBSpline_18"), + model.selection("EDGE", "SketchBSpline_19"), + model.selection("EDGE", "SketchBSpline_20"), + model.selection("EDGE", "SketchBSpline_21"), + model.selection("EDGE", "SketchBSpline_22"), + model.selection("EDGE", "SketchBSpline_23"), + model.selection("EDGE", "SketchBSpline_24"), + model.selection("EDGE", "SketchBSpline_25"), + model.selection("EDGE", "SketchBSpline_26"), + model.selection("EDGE", "SketchBSpline_27"), + model.selection("EDGE", "SketchBSpline_28"), + model.selection("EDGE", "SketchBSpline_29"), + model.selection("EDGE", "SketchBSpline_30"), + model.selection("EDGE", "SketchBSpline_31"), + model.selection("EDGE", "SketchBSpline_32"), + model.selection("EDGE", "SketchBSpline_33"), + model.selection("EDGE", "SketchBSpline_34"), + model.selection("EDGE", "SketchBSpline_35"), + model.selection("EDGE", "SketchBSpline_36"), + model.selection("EDGE", "SketchBSpline_37"), + model.selection("EDGE", "SketchBSpline_38"), + model.selection("EDGE", "SketchBSpline_39"), + model.selection("EDGE", "SketchBSpline_40"), + model.selection("EDGE", "SketchBSpline_41"), + model.selection("EDGE", "SketchBSpline_42"), + model.selection("EDGE", "SketchBSpline_43"), + model.selection("EDGE", "SketchBSpline_44"), + model.selection("EDGE", "SketchBSpline_45"), + model.selection("EDGE", "SketchBSpline_46"), + model.selection("EDGE", "SketchBSpline_47"), + model.selection("EDGE", "SketchBSpline_48"), + model.selection("EDGE", "SketchBSpline_49"), + model.selection("EDGE", "SketchBSpline_50"), + model.selection("EDGE", "SketchBSpline_51"), + model.selection("EDGE", "SketchBSpline_52"), + model.selection("EDGE", "SketchBSpline_53"), + model.selection("EDGE", "SketchBSpline_54"), + model.selection("EDGE", "SketchBSpline_55"), + model.selection("EDGE", "SketchBSpline_56"), + model.selection("EDGE", "SketchBSpline_57"), + model.selection("EDGE", "SketchBSpline_58"), + model.selection("EDGE", "SketchBSpline_59"), + model.selection("EDGE", "SketchBSpline_60"), + model.selection("EDGE", "SketchBSpline_61"), + model.selection("EDGE", "SketchArc_1_2"), +] Wire_2 = model.addWire(Part_1_doc, Wire_2_objects, False) ### Create Wire -Wire_3_objects = [model.selection("EDGE", "SketchBSpline_62"), - model.selection("EDGE", "SketchBSpline_63"), - model.selection("EDGE", "SketchBSpline_64"), - model.selection("EDGE", "SketchBSpline_65"), - model.selection("EDGE", "SketchBSpline_66"), - model.selection("EDGE", "SketchBSpline_67"), - model.selection("EDGE", "SketchBSpline_68"), - model.selection("EDGE", "SketchBSpline_69"), - model.selection("EDGE", "SketchBSpline_70"), - model.selection("EDGE", "SketchBSpline_71"), - model.selection("EDGE", "SketchBSpline_72"), - model.selection("EDGE", "SketchBSpline_73"), - model.selection("EDGE", "SketchBSpline_74"), - model.selection("EDGE", "SketchBSpline_75"), - model.selection("EDGE", "SketchBSpline_76"), - model.selection("EDGE", "SketchBSpline_77"), - model.selection("EDGE", "SketchBSpline_78"), - model.selection("EDGE", "SketchBSpline_79"), - model.selection("EDGE", "SketchBSpline_80"), - model.selection("EDGE", "SketchBSpline_81"), - model.selection("EDGE", "SketchBSpline_82"), - model.selection("EDGE", "SketchBSpline_83"), - model.selection("EDGE", "SketchBSpline_84"), - model.selection("EDGE", "SketchBSpline_85"), - model.selection("EDGE", "SketchBSpline_86"), - model.selection("EDGE", "SketchBSpline_87"), - model.selection("EDGE", "SketchBSpline_88"), - model.selection("EDGE", "SketchBSpline_89"), - model.selection("EDGE", "SketchBSpline_90"), - model.selection("EDGE", "SketchBSpline_91"), - model.selection("EDGE", "SketchBSpline_92"), - model.selection("EDGE", "SketchBSpline_93"), - model.selection("EDGE", "SketchBSpline_94"), - model.selection("EDGE", "SketchBSpline_95"), - model.selection("EDGE", "SketchBSpline_96"), - model.selection("EDGE", "SketchBSpline_97"), - model.selection("EDGE", "SketchBSpline_98"), - model.selection("EDGE", "SketchBSpline_99"), - model.selection("EDGE", "SketchBSpline_100"), - model.selection("EDGE", "SketchBSpline_101"), - model.selection("EDGE", "SketchBSpline_102"), - model.selection("EDGE", "SketchBSpline_103"), - model.selection("EDGE", "SketchBSpline_104"), - model.selection("EDGE", "SketchBSpline_105"), - model.selection("EDGE", "SketchBSpline_106"), - model.selection("EDGE", "SketchBSpline_107"), - model.selection("EDGE", "SketchBSpline_108"), - model.selection("EDGE", "SketchBSpline_109"), - model.selection("EDGE", "SketchBSpline_110"), - model.selection("EDGE", "SketchBSpline_111"), - model.selection("EDGE", "SketchBSpline_112"), - model.selection("EDGE", "SketchBSpline_113"), - model.selection("EDGE", "SketchBSpline_114"), - model.selection("EDGE", "SketchBSpline_115"), - model.selection("EDGE", "SketchBSpline_116"), - model.selection("EDGE", "SketchBSpline_117"), - model.selection("EDGE", "SketchBSpline_118"), - model.selection("EDGE", "SketchBSpline_119"), - model.selection("EDGE", "SketchBSpline_120"), - model.selection("EDGE", "SketchBSpline_121"), - model.selection("EDGE", "SketchArc_2_2")] +Wire_3_objects = [ + model.selection("EDGE", "SketchBSpline_62"), + model.selection("EDGE", "SketchBSpline_63"), + model.selection("EDGE", "SketchBSpline_64"), + model.selection("EDGE", "SketchBSpline_65"), + model.selection("EDGE", "SketchBSpline_66"), + model.selection("EDGE", "SketchBSpline_67"), + model.selection("EDGE", "SketchBSpline_68"), + model.selection("EDGE", "SketchBSpline_69"), + model.selection("EDGE", "SketchBSpline_70"), + model.selection("EDGE", "SketchBSpline_71"), + model.selection("EDGE", "SketchBSpline_72"), + model.selection("EDGE", "SketchBSpline_73"), + model.selection("EDGE", "SketchBSpline_74"), + model.selection("EDGE", "SketchBSpline_75"), + model.selection("EDGE", "SketchBSpline_76"), + model.selection("EDGE", "SketchBSpline_77"), + model.selection("EDGE", "SketchBSpline_78"), + model.selection("EDGE", "SketchBSpline_79"), + model.selection("EDGE", "SketchBSpline_80"), + model.selection("EDGE", "SketchBSpline_81"), + model.selection("EDGE", "SketchBSpline_82"), + model.selection("EDGE", "SketchBSpline_83"), + model.selection("EDGE", "SketchBSpline_84"), + model.selection("EDGE", "SketchBSpline_85"), + model.selection("EDGE", "SketchBSpline_86"), + model.selection("EDGE", "SketchBSpline_87"), + model.selection("EDGE", "SketchBSpline_88"), + model.selection("EDGE", "SketchBSpline_89"), + model.selection("EDGE", "SketchBSpline_90"), + model.selection("EDGE", "SketchBSpline_91"), + model.selection("EDGE", "SketchBSpline_92"), + model.selection("EDGE", "SketchBSpline_93"), + model.selection("EDGE", "SketchBSpline_94"), + model.selection("EDGE", "SketchBSpline_95"), + model.selection("EDGE", "SketchBSpline_96"), + model.selection("EDGE", "SketchBSpline_97"), + model.selection("EDGE", "SketchBSpline_98"), + model.selection("EDGE", "SketchBSpline_99"), + model.selection("EDGE", "SketchBSpline_100"), + model.selection("EDGE", "SketchBSpline_101"), + model.selection("EDGE", "SketchBSpline_102"), + model.selection("EDGE", "SketchBSpline_103"), + model.selection("EDGE", "SketchBSpline_104"), + model.selection("EDGE", "SketchBSpline_105"), + model.selection("EDGE", "SketchBSpline_106"), + model.selection("EDGE", "SketchBSpline_107"), + model.selection("EDGE", "SketchBSpline_108"), + model.selection("EDGE", "SketchBSpline_109"), + model.selection("EDGE", "SketchBSpline_110"), + model.selection("EDGE", "SketchBSpline_111"), + model.selection("EDGE", "SketchBSpline_112"), + model.selection("EDGE", "SketchBSpline_113"), + model.selection("EDGE", "SketchBSpline_114"), + model.selection("EDGE", "SketchBSpline_115"), + model.selection("EDGE", "SketchBSpline_116"), + model.selection("EDGE", "SketchBSpline_117"), + model.selection("EDGE", "SketchBSpline_118"), + model.selection("EDGE", "SketchBSpline_119"), + model.selection("EDGE", "SketchBSpline_120"), + model.selection("EDGE", "SketchBSpline_121"), + model.selection("EDGE", "SketchArc_2_2"), +] Wire_3 = model.addWire(Part_1_doc, Wire_3_objects, False) ### Create Plane -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 40.45, False) +Plane_5 = model.addPlane( + Part_1_doc, model.selection("FACE", "PartSet/XOY"), 40.45, False +) ### Create Sketch Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2")) @@ -827,75 +1168,282 @@ SketchPoint_128 = Sketch_2.addPoint(3.2276728, -0.06052903999999999) SketchPoint_128.setAuxiliary(True) ### Create SketchBSpline -SketchBSpline_122_poles = [(3.256, 0), - (3.255728567930323, 0.02938456749749511), - (3.237689746218751, 0.07883011085368516), - (3.176954566343984, 0.1360257431533082), - (3.09688910651703, 0.1764418306600214), - (3.00953671048185, 0.2267564781454451), - (2.912432954503905, 0.2647167787382159), - (2.815941388200049, 0.3014981358259439), - (2.729751176299813, 0.3237194265020923), - (2.646361992042657, 0.3453361685254134), - (2.567955484940874, 0.3604379063520104), - (2.483282044059514, 0.3692261528728723), - (2.396825289419105, 0.3904099084997285), - (2.297784821900362, 0.4005139744076952), - (2.183002812158886, 0.4101339211003338), - (2.05326355477229, 0.406032562950755), - (1.921328555727838, 0.4113842334362396), - (1.796156730600904, 0.3966591653819502), - (1.686052998788443, 0.3907202481330517), - (1.586299665611225, 0.3704286812906156), - (1.487748341031549, 0.3544969076370629), - (1.383393470307667, 0.3395093148076599), - (1.273972616931005, 0.319325222403528), - (1.160543506907297, 0.2933739438166694), - (1.043520532273171, 0.2720319372399694), - (0.9334339259119463, 0.2436955652001511), - (0.833210329118078, 0.2180769093752324), - (0.7362714839816442, 0.1969640452405135), - (0.6330458179280327, 0.1725774416591901), - (0.5198557830327111, 0.1446546999793175), - (0.4120962578932688, 0.1207943460074061), - (0.313244110318449, 0.09345858240073433), - (0.2252529917480424, 0.07340982637625464), - (0.1351983216375724, 0.05183680239637619), - (0.07314877527059195, 0.03991202084524661), - (-0.03534471365202863, -0.00840147666050696), - (0.08989014461370692, 0.01974926691163458), - (0.1516448171045691, 0.0236568477195267), - (0.2482493443712883, 0.02534282868769613), - (0.3411637589893189, 0.02324293986853048), - (0.4423953890052463, 0.02659845418947896), - (0.5462497541613646, 0.01581617151358379), - (0.6475751330738458, 0.003347436114427953), - (0.7481634943679742, -0.01319804142374542), - (0.8516670763128179, -0.03483327454522876), - (0.9584372564498741, -0.05226718363109152), - (1.077516251399843, -0.09038361271993345), - (1.202718995768721, -0.1160769351511452), - (1.331521625664622, -0.1431911515298037), - (1.451075975864637, -0.1739224918799187), - (1.567818521312199, -0.2035675478361183), - (1.687196967047543, -0.2240162678824165), - (1.809973230769842, -0.2434430111950148), - (1.936918886307194, -0.259024977788206), - (2.066537414886297, -0.2713706822793528), - (2.200309450461007, -0.2769425772780358), - (2.328715391113886, -0.2806404486840122), - (2.457661261585523, -0.2724299715025069), - (2.575159863696419, -0.2635528807551016), - (2.692927889590666, -0.2509748561459927), - (2.81334838838169, -0.2298043740783547), - (2.945545528527086, -0.1996213872365573), - (3.065957107372579, -0.1573256758110601), - (3.163151568975917, -0.114635786111929), - (3.230025301011729, -0.0667293557622594), - (3.251839356594632, -0.02382159971973897), - (3.256, 0) - ] -SketchBSpline_122 = Sketch_2.addSpline(degree = 3, poles = SketchBSpline_122_poles, weights = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], knots = [0, 0.01183488863837179, 0.02319018649848563, 0.03559858893144933, 0.05144916515834002, 0.06759531467622243, 0.0815379341596944, 0.09700677492797637, 0.1068321569610141, 0.1195693666101132, 0.1322085557927938, 0.1443579416201434, 0.1587691279665199, 0.17609037125253, 0.1951577895815503, 0.2160169703364635, 0.2342490967534491, 0.2507056052742759, 0.2646118431448987, 0.2791077011690486, 0.2947823396709444, 0.3111417859997592, 0.3282046159595691, 0.3461398429174012, 0.3636238095657636, 0.3783618826153202, 0.3918018692786528, 0.4074107325669361, 0.4251844860013295, 0.4432460569026663, 0.4561791711061376, 0.4702697244163377, 0.4837214559733176, 0.4948377859291223, 0.5047442665271803, 0.514390439239358, 0.5287967600422183, 0.5400951120443203, 0.5549899587260146, 0.5704834338205, 0.584537279701169, 0.6010532448480169, 0.6155483198902286, 0.6295130832805996, 0.6477395111687876, 0.6632083519370696, 0.6845974067707581, 0.7041119934399064, 0.721308736302655, 0.7390824897370484, 0.7572531654218201, 0.7747391660376209, 0.7939534892917686, 0.8137003452650872, 0.8321903971419143, 0.8530516926114459, 0.8703550992317159, 0.8891841498048809, 0.9050749088751692, 0.9226079659764083, 0.9431244997359293, 0.9648828024586862, 0.9787328512217585, 0.9901668364115461, 1], multiplicities = [4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4]) +SketchBSpline_122_poles = [ + (3.256, 0), + (3.255728567930323, 0.02938456749749511), + (3.237689746218751, 0.07883011085368516), + (3.176954566343984, 0.1360257431533082), + (3.09688910651703, 0.1764418306600214), + (3.00953671048185, 0.2267564781454451), + (2.912432954503905, 0.2647167787382159), + (2.815941388200049, 0.3014981358259439), + (2.729751176299813, 0.3237194265020923), + (2.646361992042657, 0.3453361685254134), + (2.567955484940874, 0.3604379063520104), + (2.483282044059514, 0.3692261528728723), + (2.396825289419105, 0.3904099084997285), + (2.297784821900362, 0.4005139744076952), + (2.183002812158886, 0.4101339211003338), + (2.05326355477229, 0.406032562950755), + (1.921328555727838, 0.4113842334362396), + (1.796156730600904, 0.3966591653819502), + (1.686052998788443, 0.3907202481330517), + (1.586299665611225, 0.3704286812906156), + (1.487748341031549, 0.3544969076370629), + (1.383393470307667, 0.3395093148076599), + (1.273972616931005, 0.319325222403528), + (1.160543506907297, 0.2933739438166694), + (1.043520532273171, 0.2720319372399694), + (0.9334339259119463, 0.2436955652001511), + (0.833210329118078, 0.2180769093752324), + (0.7362714839816442, 0.1969640452405135), + (0.6330458179280327, 0.1725774416591901), + (0.5198557830327111, 0.1446546999793175), + (0.4120962578932688, 0.1207943460074061), + (0.313244110318449, 0.09345858240073433), + (0.2252529917480424, 0.07340982637625464), + (0.1351983216375724, 0.05183680239637619), + (0.07314877527059195, 0.03991202084524661), + (-0.03534471365202863, -0.00840147666050696), + (0.08989014461370692, 0.01974926691163458), + (0.1516448171045691, 0.0236568477195267), + (0.2482493443712883, 0.02534282868769613), + (0.3411637589893189, 0.02324293986853048), + (0.4423953890052463, 0.02659845418947896), + (0.5462497541613646, 0.01581617151358379), + (0.6475751330738458, 0.003347436114427953), + (0.7481634943679742, -0.01319804142374542), + (0.8516670763128179, -0.03483327454522876), + (0.9584372564498741, -0.05226718363109152), + (1.077516251399843, -0.09038361271993345), + (1.202718995768721, -0.1160769351511452), + (1.331521625664622, -0.1431911515298037), + (1.451075975864637, -0.1739224918799187), + (1.567818521312199, -0.2035675478361183), + (1.687196967047543, -0.2240162678824165), + (1.809973230769842, -0.2434430111950148), + (1.936918886307194, -0.259024977788206), + (2.066537414886297, -0.2713706822793528), + (2.200309450461007, -0.2769425772780358), + (2.328715391113886, -0.2806404486840122), + (2.457661261585523, -0.2724299715025069), + (2.575159863696419, -0.2635528807551016), + (2.692927889590666, -0.2509748561459927), + (2.81334838838169, -0.2298043740783547), + (2.945545528527086, -0.1996213872365573), + (3.065957107372579, -0.1573256758110601), + (3.163151568975917, -0.114635786111929), + (3.230025301011729, -0.0667293557622594), + (3.251839356594632, -0.02382159971973897), + (3.256, 0), +] +SketchBSpline_122 = Sketch_2.addSpline( + degree=3, + poles=SketchBSpline_122_poles, + weights=[ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + ], + knots=[ + 0, + 0.01183488863837179, + 0.02319018649848563, + 0.03559858893144933, + 0.05144916515834002, + 0.06759531467622243, + 0.0815379341596944, + 0.09700677492797637, + 0.1068321569610141, + 0.1195693666101132, + 0.1322085557927938, + 0.1443579416201434, + 0.1587691279665199, + 0.17609037125253, + 0.1951577895815503, + 0.2160169703364635, + 0.2342490967534491, + 0.2507056052742759, + 0.2646118431448987, + 0.2791077011690486, + 0.2947823396709444, + 0.3111417859997592, + 0.3282046159595691, + 0.3461398429174012, + 0.3636238095657636, + 0.3783618826153202, + 0.3918018692786528, + 0.4074107325669361, + 0.4251844860013295, + 0.4432460569026663, + 0.4561791711061376, + 0.4702697244163377, + 0.4837214559733176, + 0.4948377859291223, + 0.5047442665271803, + 0.514390439239358, + 0.5287967600422183, + 0.5400951120443203, + 0.5549899587260146, + 0.5704834338205, + 0.584537279701169, + 0.6010532448480169, + 0.6155483198902286, + 0.6295130832805996, + 0.6477395111687876, + 0.6632083519370696, + 0.6845974067707581, + 0.7041119934399064, + 0.721308736302655, + 0.7390824897370484, + 0.7572531654218201, + 0.7747391660376209, + 0.7939534892917686, + 0.8137003452650872, + 0.8321903971419143, + 0.8530516926114459, + 0.8703550992317159, + 0.8891841498048809, + 0.9050749088751692, + 0.9226079659764083, + 0.9431244997359293, + 0.9648828024586862, + 0.9787328512217585, + 0.9901668364115461, + 1, + ], + multiplicities=[ + 4, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 4, + ], +) Sketch_2.setCoincident(SketchPoint_65.coordinates(), SketchBSpline_122.startPoint()) Sketch_2.setCoincident(SketchPoint_65.coordinates(), SketchBSpline_122.endPoint()) Sketch_2.setCoincident(SketchPoint_66.coordinates(), SketchBSpline_122.result()) @@ -964,152 +1512,314 @@ Sketch_2.setCoincident(SketchPoint_128.coordinates(), SketchBSpline_122.result() ### Create SketchOffset SketchOffset_3 = Sketch_2.addOffset([SketchBSpline_122.result()], 0.01, False) -[SketchBSpline_123, SketchBSpline_124, SketchBSpline_125, SketchBSpline_126, SketchBSpline_127, SketchBSpline_128, SketchBSpline_129, SketchBSpline_130, SketchBSpline_131, SketchBSpline_132, SketchBSpline_133, SketchBSpline_134, SketchBSpline_135, SketchBSpline_136, SketchBSpline_137, SketchBSpline_138, SketchBSpline_139, SketchBSpline_140, SketchBSpline_141, SketchBSpline_142, SketchBSpline_143, SketchBSpline_144, SketchBSpline_145, SketchBSpline_146, SketchBSpline_147, SketchBSpline_148, SketchBSpline_149, SketchBSpline_150, SketchBSpline_151, SketchBSpline_152, SketchBSpline_153, SketchBSpline_154, SketchBSpline_155, SketchBSpline_156, SketchBSpline_157, SketchBSpline_158, SketchBSpline_159, SketchBSpline_160, SketchBSpline_161, SketchBSpline_162, SketchBSpline_163, SketchBSpline_164, SketchBSpline_165, SketchBSpline_166, SketchBSpline_167, SketchBSpline_168, SketchBSpline_169, SketchBSpline_170, SketchBSpline_171, SketchBSpline_172, SketchBSpline_173, SketchBSpline_174, SketchBSpline_175, SketchBSpline_176, SketchBSpline_177, SketchBSpline_178, SketchBSpline_179, SketchBSpline_180, SketchBSpline_181, SketchBSpline_182, SketchArc_3] = SketchOffset_3.offset() +[ + SketchBSpline_123, + SketchBSpline_124, + SketchBSpline_125, + SketchBSpline_126, + SketchBSpline_127, + SketchBSpline_128, + SketchBSpline_129, + SketchBSpline_130, + SketchBSpline_131, + SketchBSpline_132, + SketchBSpline_133, + SketchBSpline_134, + SketchBSpline_135, + SketchBSpline_136, + SketchBSpline_137, + SketchBSpline_138, + SketchBSpline_139, + SketchBSpline_140, + SketchBSpline_141, + SketchBSpline_142, + SketchBSpline_143, + SketchBSpline_144, + SketchBSpline_145, + SketchBSpline_146, + SketchBSpline_147, + SketchBSpline_148, + SketchBSpline_149, + SketchBSpline_150, + SketchBSpline_151, + SketchBSpline_152, + SketchBSpline_153, + SketchBSpline_154, + SketchBSpline_155, + SketchBSpline_156, + SketchBSpline_157, + SketchBSpline_158, + SketchBSpline_159, + SketchBSpline_160, + SketchBSpline_161, + SketchBSpline_162, + SketchBSpline_163, + SketchBSpline_164, + SketchBSpline_165, + SketchBSpline_166, + SketchBSpline_167, + SketchBSpline_168, + SketchBSpline_169, + SketchBSpline_170, + SketchBSpline_171, + SketchBSpline_172, + SketchBSpline_173, + SketchBSpline_174, + SketchBSpline_175, + SketchBSpline_176, + SketchBSpline_177, + SketchBSpline_178, + SketchBSpline_179, + SketchBSpline_180, + SketchBSpline_181, + SketchBSpline_182, + SketchArc_3, +] = SketchOffset_3.offset() ### Create SketchOffset -SketchOffset_4 = Sketch_2.addOffset([SketchBSpline_122.result()], 0.07000000000000001, False) -[SketchBSpline_183, SketchBSpline_184, SketchBSpline_185, SketchBSpline_186, SketchBSpline_187, SketchBSpline_188, SketchBSpline_189, SketchBSpline_190, SketchBSpline_191, SketchBSpline_192, SketchBSpline_193, SketchBSpline_194, SketchBSpline_195, SketchBSpline_196, SketchBSpline_197, SketchBSpline_198, SketchBSpline_199, SketchBSpline_200, SketchBSpline_201, SketchBSpline_202, SketchBSpline_203, SketchBSpline_204, SketchBSpline_205, SketchBSpline_206, SketchBSpline_207, SketchBSpline_208, SketchBSpline_209, SketchBSpline_210, SketchBSpline_211, SketchBSpline_212, SketchBSpline_213, SketchBSpline_214, SketchBSpline_215, SketchBSpline_216, SketchBSpline_217, SketchBSpline_218, SketchBSpline_219, SketchBSpline_220, SketchBSpline_221, SketchBSpline_222, SketchBSpline_223, SketchBSpline_224, SketchBSpline_225, SketchBSpline_226, SketchBSpline_227, SketchBSpline_228, SketchBSpline_229, SketchBSpline_230, SketchBSpline_231, SketchBSpline_232, SketchBSpline_233, SketchBSpline_234, SketchBSpline_235, SketchBSpline_236, SketchBSpline_237, SketchBSpline_238, SketchBSpline_239, SketchBSpline_240, SketchBSpline_241, SketchBSpline_242, SketchArc_4] = SketchOffset_4.offset() +SketchOffset_4 = Sketch_2.addOffset( + [SketchBSpline_122.result()], 0.07000000000000001, False +) +[ + SketchBSpline_183, + SketchBSpline_184, + SketchBSpline_185, + SketchBSpline_186, + SketchBSpline_187, + SketchBSpline_188, + SketchBSpline_189, + SketchBSpline_190, + SketchBSpline_191, + SketchBSpline_192, + SketchBSpline_193, + SketchBSpline_194, + SketchBSpline_195, + SketchBSpline_196, + SketchBSpline_197, + SketchBSpline_198, + SketchBSpline_199, + SketchBSpline_200, + SketchBSpline_201, + SketchBSpline_202, + SketchBSpline_203, + SketchBSpline_204, + SketchBSpline_205, + SketchBSpline_206, + SketchBSpline_207, + SketchBSpline_208, + SketchBSpline_209, + SketchBSpline_210, + SketchBSpline_211, + SketchBSpline_212, + SketchBSpline_213, + SketchBSpline_214, + SketchBSpline_215, + SketchBSpline_216, + SketchBSpline_217, + SketchBSpline_218, + SketchBSpline_219, + SketchBSpline_220, + SketchBSpline_221, + SketchBSpline_222, + SketchBSpline_223, + SketchBSpline_224, + SketchBSpline_225, + SketchBSpline_226, + SketchBSpline_227, + SketchBSpline_228, + SketchBSpline_229, + SketchBSpline_230, + SketchBSpline_231, + SketchBSpline_232, + SketchBSpline_233, + SketchBSpline_234, + SketchBSpline_235, + SketchBSpline_236, + SketchBSpline_237, + SketchBSpline_238, + SketchBSpline_239, + SketchBSpline_240, + SketchBSpline_241, + SketchBSpline_242, + SketchArc_4, +] = SketchOffset_4.offset() model.do() ### Create Wire -Wire_4 = model.addWire(Part_1_doc, [model.selection("EDGE", "SketchBSpline_122")], False) +Wire_4 = model.addWire( + Part_1_doc, [model.selection("EDGE", "SketchBSpline_122")], False +) ### Create Wire -Wire_5_objects = [model.selection("EDGE", "SketchBSpline_123"), - model.selection("EDGE", "SketchBSpline_124"), - model.selection("EDGE", "SketchBSpline_125"), - model.selection("EDGE", "SketchBSpline_126"), - model.selection("EDGE", "SketchBSpline_127"), - model.selection("EDGE", "SketchBSpline_128"), - model.selection("EDGE", "SketchBSpline_129"), - model.selection("EDGE", "SketchBSpline_130"), - model.selection("EDGE", "SketchBSpline_131"), - model.selection("EDGE", "SketchBSpline_132"), - model.selection("EDGE", "SketchBSpline_133"), - model.selection("EDGE", "SketchBSpline_134"), - model.selection("EDGE", "SketchBSpline_135"), - model.selection("EDGE", "SketchBSpline_136"), - model.selection("EDGE", "SketchBSpline_137"), - model.selection("EDGE", "SketchBSpline_138"), - model.selection("EDGE", "SketchBSpline_139"), - model.selection("EDGE", "SketchBSpline_140"), - model.selection("EDGE", "SketchBSpline_141"), - model.selection("EDGE", "SketchBSpline_142"), - model.selection("EDGE", "SketchBSpline_143"), - model.selection("EDGE", "SketchBSpline_144"), - model.selection("EDGE", "SketchBSpline_145"), - model.selection("EDGE", "SketchBSpline_146"), - model.selection("EDGE", "SketchBSpline_147"), - model.selection("EDGE", "SketchBSpline_148"), - model.selection("EDGE", "SketchBSpline_149"), - model.selection("EDGE", "SketchBSpline_150"), - model.selection("EDGE", "SketchBSpline_151"), - model.selection("EDGE", "SketchBSpline_152"), - model.selection("EDGE", "SketchBSpline_153"), - model.selection("EDGE", "SketchBSpline_154"), - model.selection("EDGE", "SketchBSpline_155"), - model.selection("EDGE", "SketchBSpline_156"), - model.selection("EDGE", "SketchBSpline_157"), - model.selection("EDGE", "SketchBSpline_158"), - model.selection("EDGE", "SketchBSpline_159"), - model.selection("EDGE", "SketchBSpline_160"), - model.selection("EDGE", "SketchBSpline_161"), - model.selection("EDGE", "SketchBSpline_162"), - model.selection("EDGE", "SketchBSpline_163"), - model.selection("EDGE", "SketchBSpline_164"), - model.selection("EDGE", "SketchBSpline_165"), - model.selection("EDGE", "SketchBSpline_166"), - model.selection("EDGE", "SketchBSpline_167"), - model.selection("EDGE", "SketchBSpline_168"), - model.selection("EDGE", "SketchBSpline_169"), - model.selection("EDGE", "SketchBSpline_170"), - model.selection("EDGE", "SketchBSpline_171"), - model.selection("EDGE", "SketchBSpline_172"), - model.selection("EDGE", "SketchBSpline_173"), - model.selection("EDGE", "SketchBSpline_174"), - model.selection("EDGE", "SketchBSpline_175"), - model.selection("EDGE", "SketchBSpline_176"), - model.selection("EDGE", "SketchBSpline_177"), - model.selection("EDGE", "SketchBSpline_178"), - model.selection("EDGE", "SketchBSpline_179"), - model.selection("EDGE", "SketchBSpline_180"), - model.selection("EDGE", "SketchBSpline_181"), - model.selection("EDGE", "SketchBSpline_182"), - model.selection("EDGE", "SketchArc_3_2")] +Wire_5_objects = [ + model.selection("EDGE", "SketchBSpline_123"), + model.selection("EDGE", "SketchBSpline_124"), + model.selection("EDGE", "SketchBSpline_125"), + model.selection("EDGE", "SketchBSpline_126"), + model.selection("EDGE", "SketchBSpline_127"), + model.selection("EDGE", "SketchBSpline_128"), + model.selection("EDGE", "SketchBSpline_129"), + model.selection("EDGE", "SketchBSpline_130"), + model.selection("EDGE", "SketchBSpline_131"), + model.selection("EDGE", "SketchBSpline_132"), + model.selection("EDGE", "SketchBSpline_133"), + model.selection("EDGE", "SketchBSpline_134"), + model.selection("EDGE", "SketchBSpline_135"), + model.selection("EDGE", "SketchBSpline_136"), + model.selection("EDGE", "SketchBSpline_137"), + model.selection("EDGE", "SketchBSpline_138"), + model.selection("EDGE", "SketchBSpline_139"), + model.selection("EDGE", "SketchBSpline_140"), + model.selection("EDGE", "SketchBSpline_141"), + model.selection("EDGE", "SketchBSpline_142"), + model.selection("EDGE", "SketchBSpline_143"), + model.selection("EDGE", "SketchBSpline_144"), + model.selection("EDGE", "SketchBSpline_145"), + model.selection("EDGE", "SketchBSpline_146"), + model.selection("EDGE", "SketchBSpline_147"), + model.selection("EDGE", "SketchBSpline_148"), + model.selection("EDGE", "SketchBSpline_149"), + model.selection("EDGE", "SketchBSpline_150"), + model.selection("EDGE", "SketchBSpline_151"), + model.selection("EDGE", "SketchBSpline_152"), + model.selection("EDGE", "SketchBSpline_153"), + model.selection("EDGE", "SketchBSpline_154"), + model.selection("EDGE", "SketchBSpline_155"), + model.selection("EDGE", "SketchBSpline_156"), + model.selection("EDGE", "SketchBSpline_157"), + model.selection("EDGE", "SketchBSpline_158"), + model.selection("EDGE", "SketchBSpline_159"), + model.selection("EDGE", "SketchBSpline_160"), + model.selection("EDGE", "SketchBSpline_161"), + model.selection("EDGE", "SketchBSpline_162"), + model.selection("EDGE", "SketchBSpline_163"), + model.selection("EDGE", "SketchBSpline_164"), + model.selection("EDGE", "SketchBSpline_165"), + model.selection("EDGE", "SketchBSpline_166"), + model.selection("EDGE", "SketchBSpline_167"), + model.selection("EDGE", "SketchBSpline_168"), + model.selection("EDGE", "SketchBSpline_169"), + model.selection("EDGE", "SketchBSpline_170"), + model.selection("EDGE", "SketchBSpline_171"), + model.selection("EDGE", "SketchBSpline_172"), + model.selection("EDGE", "SketchBSpline_173"), + model.selection("EDGE", "SketchBSpline_174"), + model.selection("EDGE", "SketchBSpline_175"), + model.selection("EDGE", "SketchBSpline_176"), + model.selection("EDGE", "SketchBSpline_177"), + model.selection("EDGE", "SketchBSpline_178"), + model.selection("EDGE", "SketchBSpline_179"), + model.selection("EDGE", "SketchBSpline_180"), + model.selection("EDGE", "SketchBSpline_181"), + model.selection("EDGE", "SketchBSpline_182"), + model.selection("EDGE", "SketchArc_3_2"), +] Wire_5 = model.addWire(Part_1_doc, Wire_5_objects, False) ### Create Wire -Wire_6_objects = [model.selection("EDGE", "SketchBSpline_183"), - model.selection("EDGE", "SketchBSpline_184"), - model.selection("EDGE", "SketchBSpline_185"), - model.selection("EDGE", "SketchBSpline_186"), - model.selection("EDGE", "SketchBSpline_187"), - model.selection("EDGE", "SketchBSpline_188"), - model.selection("EDGE", "SketchBSpline_189"), - model.selection("EDGE", "SketchBSpline_190"), - model.selection("EDGE", "SketchBSpline_191"), - model.selection("EDGE", "SketchBSpline_192"), - model.selection("EDGE", "SketchBSpline_193"), - model.selection("EDGE", "SketchBSpline_194"), - model.selection("EDGE", "SketchBSpline_195"), - model.selection("EDGE", "SketchBSpline_196"), - model.selection("EDGE", "SketchBSpline_197"), - model.selection("EDGE", "SketchBSpline_198"), - model.selection("EDGE", "SketchBSpline_199"), - model.selection("EDGE", "SketchBSpline_200"), - model.selection("EDGE", "SketchBSpline_201"), - model.selection("EDGE", "SketchBSpline_202"), - model.selection("EDGE", "SketchBSpline_203"), - model.selection("EDGE", "SketchBSpline_204"), - model.selection("EDGE", "SketchBSpline_205"), - model.selection("EDGE", "SketchBSpline_206"), - model.selection("EDGE", "SketchBSpline_207"), - model.selection("EDGE", "SketchBSpline_208"), - model.selection("EDGE", "SketchBSpline_209"), - model.selection("EDGE", "SketchBSpline_210"), - model.selection("EDGE", "SketchBSpline_211"), - model.selection("EDGE", "SketchBSpline_212"), - model.selection("EDGE", "SketchBSpline_213"), - model.selection("EDGE", "SketchBSpline_214"), - model.selection("EDGE", "SketchBSpline_215"), - model.selection("EDGE", "SketchBSpline_216"), - model.selection("EDGE", "SketchBSpline_217"), - model.selection("EDGE", "SketchBSpline_218"), - model.selection("EDGE", "SketchBSpline_219"), - model.selection("EDGE", "SketchBSpline_220"), - model.selection("EDGE", "SketchBSpline_221"), - model.selection("EDGE", "SketchBSpline_222"), - model.selection("EDGE", "SketchBSpline_223"), - model.selection("EDGE", "SketchBSpline_224"), - model.selection("EDGE", "SketchBSpline_225"), - model.selection("EDGE", "SketchBSpline_226"), - model.selection("EDGE", "SketchBSpline_227"), - model.selection("EDGE", "SketchBSpline_228"), - model.selection("EDGE", "SketchBSpline_229"), - model.selection("EDGE", "SketchBSpline_230"), - model.selection("EDGE", "SketchBSpline_231"), - model.selection("EDGE", "SketchBSpline_232"), - model.selection("EDGE", "SketchBSpline_233"), - model.selection("EDGE", "SketchBSpline_234"), - model.selection("EDGE", "SketchBSpline_235"), - model.selection("EDGE", "SketchBSpline_236"), - model.selection("EDGE", "SketchBSpline_237"), - model.selection("EDGE", "SketchBSpline_238"), - model.selection("EDGE", "SketchBSpline_239"), - model.selection("EDGE", "SketchBSpline_240"), - model.selection("EDGE", "SketchBSpline_241"), - model.selection("EDGE", "SketchBSpline_242"), - model.selection("EDGE", "SketchArc_4_2")] +Wire_6_objects = [ + model.selection("EDGE", "SketchBSpline_183"), + model.selection("EDGE", "SketchBSpline_184"), + model.selection("EDGE", "SketchBSpline_185"), + model.selection("EDGE", "SketchBSpline_186"), + model.selection("EDGE", "SketchBSpline_187"), + model.selection("EDGE", "SketchBSpline_188"), + model.selection("EDGE", "SketchBSpline_189"), + model.selection("EDGE", "SketchBSpline_190"), + model.selection("EDGE", "SketchBSpline_191"), + model.selection("EDGE", "SketchBSpline_192"), + model.selection("EDGE", "SketchBSpline_193"), + model.selection("EDGE", "SketchBSpline_194"), + model.selection("EDGE", "SketchBSpline_195"), + model.selection("EDGE", "SketchBSpline_196"), + model.selection("EDGE", "SketchBSpline_197"), + model.selection("EDGE", "SketchBSpline_198"), + model.selection("EDGE", "SketchBSpline_199"), + model.selection("EDGE", "SketchBSpline_200"), + model.selection("EDGE", "SketchBSpline_201"), + model.selection("EDGE", "SketchBSpline_202"), + model.selection("EDGE", "SketchBSpline_203"), + model.selection("EDGE", "SketchBSpline_204"), + model.selection("EDGE", "SketchBSpline_205"), + model.selection("EDGE", "SketchBSpline_206"), + model.selection("EDGE", "SketchBSpline_207"), + model.selection("EDGE", "SketchBSpline_208"), + model.selection("EDGE", "SketchBSpline_209"), + model.selection("EDGE", "SketchBSpline_210"), + model.selection("EDGE", "SketchBSpline_211"), + model.selection("EDGE", "SketchBSpline_212"), + model.selection("EDGE", "SketchBSpline_213"), + model.selection("EDGE", "SketchBSpline_214"), + model.selection("EDGE", "SketchBSpline_215"), + model.selection("EDGE", "SketchBSpline_216"), + model.selection("EDGE", "SketchBSpline_217"), + model.selection("EDGE", "SketchBSpline_218"), + model.selection("EDGE", "SketchBSpline_219"), + model.selection("EDGE", "SketchBSpline_220"), + model.selection("EDGE", "SketchBSpline_221"), + model.selection("EDGE", "SketchBSpline_222"), + model.selection("EDGE", "SketchBSpline_223"), + model.selection("EDGE", "SketchBSpline_224"), + model.selection("EDGE", "SketchBSpline_225"), + model.selection("EDGE", "SketchBSpline_226"), + model.selection("EDGE", "SketchBSpline_227"), + model.selection("EDGE", "SketchBSpline_228"), + model.selection("EDGE", "SketchBSpline_229"), + model.selection("EDGE", "SketchBSpline_230"), + model.selection("EDGE", "SketchBSpline_231"), + model.selection("EDGE", "SketchBSpline_232"), + model.selection("EDGE", "SketchBSpline_233"), + model.selection("EDGE", "SketchBSpline_234"), + model.selection("EDGE", "SketchBSpline_235"), + model.selection("EDGE", "SketchBSpline_236"), + model.selection("EDGE", "SketchBSpline_237"), + model.selection("EDGE", "SketchBSpline_238"), + model.selection("EDGE", "SketchBSpline_239"), + model.selection("EDGE", "SketchBSpline_240"), + model.selection("EDGE", "SketchBSpline_241"), + model.selection("EDGE", "SketchBSpline_242"), + model.selection("EDGE", "SketchArc_4_2"), +] Wire_6 = model.addWire(Part_1_doc, Wire_6_objects, False) ### Create Filling -Filling_1 = model.addFilling(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_4_1")], "curve_info", 2, 12, 0, 1e-06, 1e-06, False) +Filling_1 = model.addFilling( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_4_1")], + "curve_info", + 2, + 12, + 0, + 1e-06, + 1e-06, + False, +) ### Create Filling -Filling_2 = model.addFilling(Part_1_doc, [model.selection("WIRE", "Wire_2_1"), model.selection("WIRE", "Wire_5_1")], "curve_info", 2, 12, 0, 1e-06, 1e-06, False) +Filling_2 = model.addFilling( + Part_1_doc, + [model.selection("WIRE", "Wire_2_1"), model.selection("WIRE", "Wire_5_1")], + "curve_info", + 2, + 12, + 0, + 1e-06, + 1e-06, + False, +) ### Create Filling -Filling_3 = model.addFilling(Part_1_doc, [model.selection("WIRE", "Wire_3_1"), model.selection("WIRE", "Wire_6_1")], "curve_info", 2, 5, 0, 0.001, 0.001, False) +Filling_3 = model.addFilling( + Part_1_doc, + [model.selection("WIRE", "Wire_3_1"), model.selection("WIRE", "Wire_6_1")], + "curve_info", + 2, + 5, + 0, + 0.001, + 0.001, + False, +) model.end() @@ -1139,4 +1849,4 @@ model.testNbSubShapes(Filling_3, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Filling_3, GeomAPI_Shape.VERTEX, [8]) model.testResultsAreas(Filling_3, [30.744277238]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/Test2398.py b/src/BuildPlugin/Test/Test2398.py index 17468979b..8b45e71c1 100755 --- a/src/BuildPlugin/Test/Test2398.py +++ b/src/BuildPlugin/Test/Test2398.py @@ -27,74 +27,174 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30.79356776198042) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +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/Face-SketchCircle_1_2f_wire")], 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) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() SketchCircle_2 = Sketch_2.addCircle(0, 0, 25.19116787687743) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchCircle_2.center()) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchPoint_2.result(), SketchCircle_2.center() +) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 100, 0) -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OX"), 90) - -Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "Rotation_1_1"), model.selection("SOLID", "Extrusion_2_1")]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], + model.selection(), + 100, + 0, +) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OX"), + 90, +) + +Intersection_1 = model.addIntersection( + Part_1_doc, + [ + model.selection("SOLID", "Rotation_1_1"), + model.selection("SOLID", "Extrusion_2_1"), + ], +) Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_3.addLine(7.903534676574237, 7.903534676574236, -7.903534676574236, 7.903534676574236) -SketchLine_2 = Sketch_3.addLine(-7.903534676574236, 7.903534676574236, -7.903534676574236, -7.903534676574237) -SketchLine_3 = Sketch_3.addLine(-7.903534676574236, -7.903534676574237, 7.903534676574237, -7.903534676574237) -SketchLine_4 = Sketch_3.addLine(7.903534676574237, -7.903534676574237, 7.903534676574237, 7.903534676574236) -SketchConstraintCoincidence_3 = Sketch_3.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_4 = Sketch_3.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_1 = Sketch_3.addLine( + 7.903534676574237, 7.903534676574236, -7.903534676574236, 7.903534676574236 +) +SketchLine_2 = Sketch_3.addLine( + -7.903534676574236, 7.903534676574236, -7.903534676574236, -7.903534676574237 +) +SketchLine_3 = Sketch_3.addLine( + -7.903534676574236, -7.903534676574237, 7.903534676574237, -7.903534676574237 +) +SketchLine_4 = Sketch_3.addLine( + 7.903534676574237, -7.903534676574237, 7.903534676574237, 7.903534676574236 +) +SketchConstraintCoincidence_3 = Sketch_3.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_3.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_3.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_3.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintHorizontal_1 = Sketch_3.setHorizontal(SketchLine_1.result()) SketchConstraintVertical_1 = Sketch_3.setVertical(SketchLine_2.result()) SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_4.result()) -SketchConstraintEqual_1 = Sketch_3.setEqual(SketchLine_4.result(), SketchLine_1.result()) -SketchLine_5 = Sketch_3.addLine(-7.903534676574236, 7.903534676574236, 7.903534676574237, -7.903534676574237) +SketchConstraintEqual_1 = Sketch_3.setEqual( + SketchLine_4.result(), SketchLine_1.result() +) +SketchLine_5 = Sketch_3.addLine( + -7.903534676574236, 7.903534676574236, 7.903534676574237, -7.903534676574237 +) SketchLine_5.setAuxiliary(True) -SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_1.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_3.endPoint(), SketchLine_5.endPoint()) -SketchProjection_3 = Sketch_3.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_7 = Sketch_3.setCoincident( + SketchLine_1.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_3.setCoincident( + SketchLine_3.endPoint(), SketchLine_5.endPoint() +) +SketchProjection_3 = Sketch_3.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_3 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_5.result(), SketchAPI_Point(SketchPoint_3).coordinates()) -SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_5.result()) +SketchConstraintCoincidence_9 = Sketch_3.setCoincident( + SketchLine_5.result(), SketchAPI_Point(SketchPoint_3).coordinates() +) +SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_5.result() +) model.do() -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_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) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_1"), model.selection("EDGE", "PartSet/OZ"), 90) - -Partition_1_objects = [model.selection("EDGE", "Intersection_1_1"), model.selection("FACE", "Plane_2"), model.selection("FACE", "Plane_1")] +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOZ"), + model.selection("EDGE", "PartSet/OZ"), + 135, +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Plane_1"), + model.selection("EDGE", "PartSet/OZ"), + 90, +) + +Partition_1_objects = [ + model.selection("EDGE", "Intersection_1_1"), + model.selection("FACE", "Plane_2"), + model.selection("FACE", "Plane_1"), +] Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects) -Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Partition_1_1_2"), model.selection("EDGE", "Edge_1_2")]) -Filling_2 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Partition_1_1_3"), model.selection("EDGE", "Edge_1_1")]) -Filling_3 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Partition_1_1_4"), model.selection("EDGE", "Edge_1_4")]) - -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Partition_1_1_1"), model.selection("EDGE", "Partition_1_1_5")]) -Filling_4 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Edge_1_3"), model.selection("WIRE", "Wire_1_1")]) +Filling_1 = model.addFilling( + Part_1_doc, + [model.selection("EDGE", "Partition_1_1_2"), model.selection("EDGE", "Edge_1_2")], +) +Filling_2 = model.addFilling( + Part_1_doc, + [model.selection("EDGE", "Partition_1_1_3"), model.selection("EDGE", "Edge_1_1")], +) +Filling_3 = model.addFilling( + Part_1_doc, + [model.selection("EDGE", "Partition_1_1_4"), model.selection("EDGE", "Edge_1_4")], +) + +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Partition_1_1_1"), + model.selection("EDGE", "Partition_1_1_5"), + ], +) +Filling_4 = model.addFilling( + Part_1_doc, + [model.selection("EDGE", "Edge_1_3"), model.selection("WIRE", "Wire_1_1")], +) model.do() from GeomAPI import * # check fillings -REF_DATA = [(Filling_1, 719.149788883378505488508380949), - (Filling_2, 910.894525282186464210099074990), - (Filling_3, 719.149788883378505488508380949), - (Filling_4, 911.056740330659408755309414119)] +REF_DATA = [ + (Filling_1, 719.149788883378505488508380949), + (Filling_2, 910.894525282186464210099074990), + (Filling_3, 719.149788883378505488508380949), + (Filling_4, 911.056740330659408755309414119), +] for ref in REF_DATA: model.testNbResults(ref[0], 1) model.testNbSubResults(ref[0], [0]) @@ -106,4 +206,4 @@ for ref in REF_DATA: model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/Test2409.py b/src/BuildPlugin/Test/Test2409.py index 06db5cbfb..65fc5033d 100644 --- a/src/BuildPlugin/Test/Test2409.py +++ b/src/BuildPlugin/Test/Test2409.py @@ -33,31 +33,47 @@ SketchLine_1 = Sketch_1.addLine(80, 10, 10, 10) SketchLine_2 = Sketch_1.addLine(10, 10, 10, 60) SketchLine_3 = Sketch_1.addLine(10, 60, 80, 60) SketchLine_4 = Sketch_1.addLine(80, 60, 80, 10) -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()) +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_2")]) +Filling_1 = model.addFilling( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_2")] +) model.do() # check error is reported -assert(Filling_1.feature().error() != "") +assert Filling_1.feature().error() != "" -Filling_1.setBase([model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_4")]) +Filling_1.setBase( + [ + model.selection("EDGE", "Sketch_1/SketchLine_2"), + model.selection("EDGE", "Sketch_1/SketchLine_4"), + ] +) model.do() # check there is no error -assert(Filling_1.feature().error() == "") +assert Filling_1.feature().error() == "" from GeomAPI import GeomAPI_Shape + model.testNbResults(Filling_1, 1) model.testNbSubShapes(Filling_1, GeomAPI_Shape.FACE, [1]) model.testResultsAreas(Filling_1, [3500]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/Test2415.py b/src/BuildPlugin/Test/Test2415.py index 81d63087a..2e36c5a83 100644 --- a/src/BuildPlugin/Test/Test2415.py +++ b/src/BuildPlugin/Test/Test2415.py @@ -27,39 +27,88 @@ 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(0, 80, 0, 150) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) SketchLine_3 = Sketch_1.addLine(0, 150, 150, 150) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(150, 150, 150, 0) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(150, 0, 80, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +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()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.result() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) -SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular(SketchLine_4.result(), SketchLine_5.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_5.result()) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) +SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular( + SketchLine_4.result(), SketchLine_5.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_5.result() +) SketchArc_1 = Sketch_1.addArc(0, 0, 80, 0, 0, 80, False) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_6).startPoint(), SketchArc_1.center()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_6).startPoint(), SketchArc_1.center() +) 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-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")] +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/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_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() -model.testHaveNamingSubshapes(Compound_2,model,Part_1_doc) +model.testHaveNamingSubshapes(Compound_2, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/Test2439.py b/src/BuildPlugin/Test/Test2439.py index 8d2f82da2..03359cbd0 100644 --- a/src/BuildPlugin/Test/Test2439.py +++ b/src/BuildPlugin/Test/Test2439.py @@ -28,17 +28,44 @@ SketchLine_1 = Sketch_1.addLine(200, 200, -200, 200) SketchLine_2 = Sketch_1.addLine(-200, 200, -200, -200) SketchLine_3 = Sketch_1.addLine(-200, -200, 200, -200) SketchLine_4 = Sketch_1.addLine(200, -200, 200, 200) -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()) +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("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]")]) +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) diff --git a/src/BuildPlugin/Test/Test2454.py b/src/BuildPlugin/Test/Test2454.py index c9092c945..2991d1f26 100644 --- a/src/BuildPlugin/Test/Test2454.py +++ b/src/BuildPlugin/Test/Test2454.py @@ -24,10 +24,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(0.1822176134072968, -1.34047565209109, 35.08968954114807) +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/SketchCircle_1_2")]) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 100, 0) +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")]) @@ -35,7 +41,8 @@ Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_2_1")]) model.end() from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Face_2.feature())) +assert aFactory.validate(Face_2.feature()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/Test3125.py b/src/BuildPlugin/Test/Test3125.py index d55a043bc..bd8ead98d 100644 --- a/src/BuildPlugin/Test/Test3125.py +++ b/src/BuildPlugin/Test/Test3125.py @@ -23,12 +23,24 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOZ")) -SketchLine_1 = Sketch_1.addLine(-24.8768472906404, 33.33497536945814, 36.81773399014779, 23.38423645320196) -SketchLine_2 = Sketch_1.addLine(36.81773399014779, 23.38423645320196, 11.31896551724138, -27.61330049261085) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(11.31896551724138, -27.61330049261085, -24.8768472906404, 33.33497536945814) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) +SketchLine_1 = Sketch_1.addLine( + -24.8768472906404, 33.33497536945814, 36.81773399014779, 23.38423645320196 +) +SketchLine_2 = Sketch_1.addLine( + 36.81773399014779, 23.38423645320196, 11.31896551724138, -27.61330049261085 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 11.31896551724138, -27.61330049261085, -24.8768472906404, 33.33497536945814 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) model.do() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() @@ -41,7 +53,7 @@ from ModelAPI import * from GeomAPI import * aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Wire_1.feature())) +assert aFactory.validate(Wire_1.feature()) model.testNbResults(Wire_1, 1) model.testNbSubShapes(Wire_1, GeomAPI_Shape.EDGE, [3]) diff --git a/src/BuildPlugin/Test/Test3271.py b/src/BuildPlugin/Test/Test3271.py index 8211c3c21..e60b22b5d 100644 --- a/src/BuildPlugin/Test/Test3271.py +++ b/src/BuildPlugin/Test/Test3271.py @@ -24,33 +24,154 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/XOY")) -SketchLine_1 = Sketch_1.addLine(0.0004311969126985509, -0.007674652873749346, 0.002931492667495096, -0.004255130738512952) -SketchLine_2 = Sketch_1.addLine(0.002931492667495096, -0.004255130738512952, 0.008777772447092769, -0.005450125033084811) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchArc_1 = Sketch_1.addArc(0.008423929073579738, -0.007181235691194688, 0.008777772447092769, -0.005450125033084811, 0.01017499654536136, -0.007417269487226177, True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_2.result(), SketchArc_1.results()[1]) -SketchArc_2 = Sketch_1.addArc(0.008003525163087695, -0.007124567668711833, 0.01017499654536136, -0.007417269487226177, 0.007858546066652927, -0.00931087583093235, True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1]) -SketchArc_3 = Sketch_1.addArc(0.007693833531605691, -0.01179476743082126, 0.007858546066652927, -0.00931087583093235, 0.005279452926115063, -0.01118845563724384, False) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1]) -SketchEllipticArc_1 = Sketch_1.addEllipticArc(0.003574951141940773, -0.01155552979705393, 0.002239383243347156, -0.01179560634192411, 0.005279452926115063, -0.01118845563724384, 0.002020289862486981, -0.01123808958696058, False) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_3, SketchLine_4] = SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchEllipticArc_1.startPoint()) -SketchLine_5 = Sketch_1.addLine(0.002020289862504265, -0.0112380895869727, 0.0004311969126985505, -0.007674652873749346) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchEllipticArc_1.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint()) -SketchCircle_1 = Sketch_1.addCircle(0.003364447146935956, -0.00551738944900832, 0.001819824088768701) -SketchCircle_2 = Sketch_1.addCircle(0.007829307057027779, -0.01091774381645273, 0.003225214826443006) +SketchLine_1 = Sketch_1.addLine( + 0.0004311969126985509, + -0.007674652873749346, + 0.002931492667495096, + -0.004255130738512952, +) +SketchLine_2 = Sketch_1.addLine( + 0.002931492667495096, + -0.004255130738512952, + 0.008777772447092769, + -0.005450125033084811, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchArc_1 = Sketch_1.addArc( + 0.008423929073579738, + -0.007181235691194688, + 0.008777772447092769, + -0.005450125033084811, + 0.01017499654536136, + -0.007417269487226177, + True, +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_2.result(), SketchArc_1.results()[1] +) +SketchArc_2 = Sketch_1.addArc( + 0.008003525163087695, + -0.007124567668711833, + 0.01017499654536136, + -0.007417269487226177, + 0.007858546066652927, + -0.00931087583093235, + True, +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchArc_2.results()[1] +) +SketchArc_3 = Sketch_1.addArc( + 0.007693833531605691, + -0.01179476743082126, + 0.007858546066652927, + -0.00931087583093235, + 0.005279452926115063, + -0.01118845563724384, + False, +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) +SketchEllipticArc_1 = Sketch_1.addEllipticArc( + 0.003574951141940773, + -0.01155552979705393, + 0.002239383243347156, + -0.01179560634192411, + 0.005279452926115063, + -0.01118845563724384, + 0.002020289862486981, + -0.01123808958696058, + False, +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_3, + SketchLine_4, +] = SketchEllipticArc_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchEllipticArc_1.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 0.002020289862504265, + -0.0112380895869727, + 0.0004311969126985505, + -0.007674652873749346, +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchEllipticArc_1.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.endPoint() +) +SketchCircle_1 = Sketch_1.addCircle( + 0.003364447146935956, -0.00551738944900832, 0.001819824088768701 +) +SketchCircle_2 = Sketch_1.addCircle( + 0.007829307057027779, -0.01091774381645273, 0.003225214826443006 +) model.do() -Sketch_1.changeFacesOrder([[SketchLine_5.result(), SketchEllipticArc_1.result(), SketchCircle_2.results()[1], SketchArc_2.results()[1], SketchArc_1.results()[1], SketchLine_2.result(), SketchCircle_1.results()[1], SketchLine_1.result()], - [SketchCircle_1.results()[1], SketchLine_2.result(), SketchLine_1.result()], - [SketchLine_1.result(), SketchLine_2.result(), SketchCircle_1.results()[1], SketchCircle_1.results()[1]], - [SketchArc_2.results()[1], SketchCircle_2.results()[1], SketchEllipticArc_1.result(), SketchArc_3.results()[1]], - [SketchArc_3.results()[1], SketchEllipticArc_1.result(), SketchCircle_2.results()[1], SketchCircle_2.results()[1], SketchArc_2.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchLine_5.result(), + SketchEllipticArc_1.result(), + SketchCircle_2.results()[1], + SketchArc_2.results()[1], + SketchArc_1.results()[1], + SketchLine_2.result(), + SketchCircle_1.results()[1], + SketchLine_1.result(), + ], + [SketchCircle_1.results()[1], SketchLine_2.result(), SketchLine_1.result()], + [ + SketchLine_1.result(), + SketchLine_2.result(), + SketchCircle_1.results()[1], + SketchCircle_1.results()[1], + ], + [ + SketchArc_2.results()[1], + SketchCircle_2.results()[1], + SketchEllipticArc_1.result(), + SketchArc_3.results()[1], + ], + [ + SketchArc_3.results()[1], + SketchEllipticArc_1.result(), + SketchCircle_2.results()[1], + SketchCircle_2.results()[1], + SketchArc_2.results()[1], + ], + ] +) model.do() Face_1 = model.addFace(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")]) Vertex_1 = model.addVertex(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], True) @@ -59,9 +180,9 @@ Wire_1 = model.addWire(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], Tr model.end() -assert(len(Face_1.results()) == 5) -assert(len(Vertex_1.results()) == 25) -assert(len(Edge_1.results()) == 17) -assert(len(Wire_1.results()) == 3) +assert len(Face_1.results()) == 5 +assert len(Vertex_1.results()) == 25 +assert len(Edge_1.results()) == 17 +assert len(Wire_1.results()) == 3 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestCompSolid.py b/src/BuildPlugin/Test/TestCompSolid.py index 4faff065f..ccde74944 100644 --- a/src/BuildPlugin/Test/TestCompSolid.py +++ b/src/BuildPlugin/Test/TestCompSolid.py @@ -27,82 +27,193 @@ 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(40, 0, 0, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 40) SketchLine_3 = Sketch_1.addLine(0, 40, 40, 40) SketchLine_4 = Sketch_1.addLine(40, 40, 40, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.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/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")]) +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) SketchLine_7 = Sketch_2.addLine(0, 20, 20, 20) SketchLine_8 = Sketch_2.addLine(20, 20, 20, 0) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) 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/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()) -SketchConstraintEqual_2 = Sketch_2.setEqual(SketchLine_5.result(), SketchLine_6.result()) +SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint( + SketchLine_5.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchAPI_Line(SketchLine_9).startPoint(), SketchLine_5.endPoint() +) +SketchConstraintEqual_2 = Sketch_2.setEqual( + SketchLine_5.result(), SketchLine_6.result() +) SketchLine_10 = Sketch_2.addLine(20, 20, 20, 40) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_10.startPoint() +) SketchLine_11 = Sketch_2.addLine(20, 40, 0, 40) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchLine_12 = Sketch_2.addLine(0, 40, 0, 20) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_12.endPoint()) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_12.endPoint() +) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_10.result()) 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()) +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/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) +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, +) Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchLine_13 = Sketch_3.addLine(40, 0, 20, 0) SketchLine_14 = Sketch_3.addLine(20, 0, 20, 40) SketchLine_15 = Sketch_3.addLine(20, 40, 40, 40) SketchLine_16 = Sketch_3.addLine(40, 40, 40, 0) -SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_15 = Sketch_3.setCoincident( + SketchLine_16.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_3.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_3.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) +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/SketchLine_5_StartVertex"), 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/SketchLine_10_EndVertex"), False) +SketchConstraintCoincidence_19 = Sketch_3.setCoincident( + SketchLine_13.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates() +) +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/SketchLine_2_EndVertex"), False) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident( + SketchLine_14.endPoint(), SketchAPI_Point(SketchPoint_3).coordinates() +) +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()) +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_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r")], 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() + def createCompSolidStepByStep(theSelection, theExpectedType): CompSolid = model.addCompSolid(Part_1_doc, [theSelection[0]]) aList = [] @@ -110,38 +221,50 @@ def createCompSolidStepByStep(theSelection, theExpectedType): aList.append(selection) CompSolid.setBase(aList) if expected == GeomAPI_Shape.SHAPE: - assert(len(CompSolid.results()) == 0), "FAILED: CompSolid should not be built" + assert ( + len(CompSolid.results()) == 0 + ), "FAILED: CompSolid should not be built" else: - assert(len(CompSolid.results()) > 0), "FAILED: CompSolid is not built" - resultType = CompSolid.results()[0].resultSubShapePair()[0].shape().shapeType() - assert(resultType == expected), "FAILED: Result has unexpected type" + assert len(CompSolid.results()) > 0, "FAILED: CompSolid is not built" + resultType = ( + CompSolid.results()[0].resultSubShapePair()[0].shape().shapeType() + ) + assert resultType == expected, "FAILED: Result has unexpected type" # remove solid if it is not built if len(CompSolid.results()) == 0: Part_1_doc.removeFeature(CompSolid.feature()) return None return CompSolid + # ============================================================================= # Test 1. Build compsolid cointaining 2 solids # ============================================================================= -boundaries1 = [model.selection("FACE", "Face_1_1"), - model.selection("SHELL", "Shell_1_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, - GeomAPI_Shape.SHAPE, - GeomAPI_Shape.SHAPE, - GeomAPI_Shape.SHAPE, - GeomAPI_Shape.SHAPE, - GeomAPI_Shape.SHAPE, - GeomAPI_Shape.SOLID, - GeomAPI_Shape.COMPSOLID] +boundaries1 = [ + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_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, + GeomAPI_Shape.SHAPE, + GeomAPI_Shape.SHAPE, + GeomAPI_Shape.SHAPE, + GeomAPI_Shape.SHAPE, + GeomAPI_Shape.SHAPE, + GeomAPI_Shape.SOLID, + GeomAPI_Shape.COMPSOLID, +] CompSolid_1 = createCompSolidStepByStep(boundaries1, expectType1) model.checkResult(CompSolid_1, model, 1, [2], [2], [13], [54], [108]) @@ -156,28 +279,35 @@ model.undo() # ============================================================================= # Test 2. Build compsolid containing 3 solids # ============================================================================= -boundaries2 = [model.selection("FACE", "Face_1_1"), - model.selection("SHELL", "Shell_1_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&Sketch_3/SketchLine_14"), - model.selection("SOLID", "Extrusion_1_1")] -expectType2 = [GeomAPI_Shape.SHAPE, - GeomAPI_Shape.SHAPE, - GeomAPI_Shape.SHAPE, - GeomAPI_Shape.SHAPE, - GeomAPI_Shape.SHAPE, - GeomAPI_Shape.SHAPE, - GeomAPI_Shape.SHAPE, - GeomAPI_Shape.SHAPE, - GeomAPI_Shape.SOLID, - GeomAPI_Shape.COMPSOLID, - GeomAPI_Shape.COMPSOLID] +boundaries2 = [ + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_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&Sketch_3/SketchLine_14"), + model.selection("SOLID", "Extrusion_1_1"), +] +expectType2 = [ + GeomAPI_Shape.SHAPE, + GeomAPI_Shape.SHAPE, + GeomAPI_Shape.SHAPE, + GeomAPI_Shape.SHAPE, + GeomAPI_Shape.SHAPE, + GeomAPI_Shape.SHAPE, + GeomAPI_Shape.SHAPE, + GeomAPI_Shape.SHAPE, + GeomAPI_Shape.SOLID, + GeomAPI_Shape.COMPSOLID, + GeomAPI_Shape.COMPSOLID, +] CompSolid_2 = createCompSolidStepByStep(boundaries2, expectType2) model.checkResult(CompSolid_2, model, 1, [3], [3], [21], [88], [176]) @@ -185,4 +315,4 @@ model.testHaveNamingSubshapes(CompSolid_2, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestCompound.py b/src/BuildPlugin/Test/TestCompound.py index 3cc49d9da..a5a8249a4 100644 --- a/src/BuildPlugin/Test/TestCompound.py +++ b/src/BuildPlugin/Test/TestCompound.py @@ -26,60 +26,137 @@ 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(-19.49406233194174, -69.37451616542793, -72.71146724766345, -69.37451616542793) -SketchLine_2 = Sketch_1.addLine(-72.71146724766345, -69.37451616542793, -72.71146724766345, -28.67067780808921) -SketchLine_3 = Sketch_1.addLine(-72.71146724766345, -28.67067780808921, -19.49406233194174, -28.67067780808921) -SketchLine_4 = Sketch_1.addLine(-19.49406233194174, -28.67067780808921, -19.49406233194174, -69.37451616542793) -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()) +SketchLine_1 = Sketch_1.addLine( + -19.49406233194174, -69.37451616542793, -72.71146724766345, -69.37451616542793 +) +SketchLine_2 = Sketch_1.addLine( + -72.71146724766345, -69.37451616542793, -72.71146724766345, -28.67067780808921 +) +SketchLine_3 = Sketch_1.addLine( + -72.71146724766345, -28.67067780808921, -19.49406233194174, -28.67067780808921 +) +SketchLine_4 = Sketch_1.addLine( + -19.49406233194174, -28.67067780808921, -19.49406233194174, -69.37451616542793 +) +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(16.67888107989752, -75.92151145213565, 19.40636912075787, -34.81908596556777) +SketchLine_5 = Sketch_1.addLine( + 16.67888107989752, -75.92151145213565, 19.40636912075787, -34.81908596556777 +) SketchPoint_1 = Sketch_1.addPoint(0.6128545881206371, -78.63973361497078) -SketchCircle_1 = Sketch_1.addCircle(51.0302184611028, -58.25492948210744, 14.6764214847306) -SketchCircle_2 = Sketch_1.addCircle(57.27434431552349, -55.3477547099222, 30.40870102508203) +SketchCircle_1 = Sketch_1.addCircle( + 51.0302184611028, -58.25492948210744, 14.6764214847306 +) +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/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")]) +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) -SketchLine_8 = Sketch_2.addLine(29.86213888681927, 46.16063196348271, 73.69205241424749, 46.16063196348271) -SketchLine_9 = Sketch_2.addLine(73.69205241424749, 46.16063196348271, 73.69205241424749, 19.68979803478298) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +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 +) +SketchLine_8 = Sketch_2.addLine( + 29.86213888681927, 46.16063196348271, 73.69205241424749, 46.16063196348271 +) +SketchLine_9 = Sketch_2.addLine( + 73.69205241424749, 46.16063196348271, 73.69205241424749, 19.68979803478298 +) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result()) 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/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")]) +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) +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/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"), - model.selection("FACE", "Face_1_1"), - model.selection("SHELL", "Shell_1_1"), - model.selection("SOLID", "Translation_1_1"), - model.selection("COMPSOLID", "Partition_1_1")] +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/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"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.do() @@ -87,4 +164,4 @@ model.checkResult(Compound_1, model, 1, [11], [3], [22], [92], [186]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestCompound_ErrorMsg.py b/src/BuildPlugin/Test/TestCompound_ErrorMsg.py index d3ecfa021..f19b38b9f 100644 --- a/src/BuildPlugin/Test/TestCompound_ErrorMsg.py +++ b/src/BuildPlugin/Test/TestCompound_ErrorMsg.py @@ -18,6 +18,7 @@ # from ModelAPI import * + aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -31,12 +32,12 @@ aPart = aPartResult.partDoc() aSession.startOperation() Compound_1 = aPart.addFeature("Compound") Compound_1.execute() -assert(Compound_1.error() != "") +assert Compound_1.error() != "" aSession.finishOperation() aSession.startOperation() aBaseObjectsList = Compound_1.selectionList("base_objects") aBaseObjectsList.append("", "EDGE") Compound_1.execute() -assert(Compound_1.error() != "") +assert Compound_1.error() != "" aSession.finishOperation() diff --git a/src/BuildPlugin/Test/TestCompound_History.py b/src/BuildPlugin/Test/TestCompound_History.py index 723deb48d..6f7dd9ed0 100644 --- a/src/BuildPlugin/Test/TestCompound_History.py +++ b/src/BuildPlugin/Test/TestCompound_History.py @@ -29,17 +29,51 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(-19.03078817733991, 40.92241379310347) -SketchLine_1 = Sketch_1.addLine(-0.7463054187192111, 38.55911330049261, -18.03571428571429, 28.48399014778325) -SketchCircle_1 = Sketch_1.addCircle(-2.238916256157633, 23.13546798029557, 5.523556488740459) +SketchLine_1 = Sketch_1.addLine( + -0.7463054187192111, 38.55911330049261, -18.03571428571429, 28.48399014778325 +) +SketchCircle_1 = Sketch_1.addCircle( + -2.238916256157633, 23.13546798029557, 5.523556488740459 +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_1")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_1")] +) Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")]) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0) -Group_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Edge_1_1/Modified_Vertex&Sketch_1/SketchLine_1_EndVertex"), model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection(), + 10, + 0, +) +Group_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection( + "VERTEX", "Edge_1_1/Modified_Vertex&Sketch_1/SketchLine_1_EndVertex" + ), + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]", + ), +] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) -Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]")]) +Group_2 = model.addGroup( + Part_1_doc, + [ + model.selection("EDGE", "Edge_1_1"), + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]", + ), + ], +) Group_3 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")]) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("SOLID", "Extrusion_1_1")] +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("SOLID", "Extrusion_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.do() # move groups after the compound @@ -51,20 +85,20 @@ model.end() # check groups are correct aFactory = ModelAPI_Session.get().validators() selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 3) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 3 +assert aFactory.validate(Group_1.feature()) for i in range(3): - assert(Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.VERTEX) + assert Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.VERTEX selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 2) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 2 +assert aFactory.validate(Group_2.feature()) for i in range(2): - assert(Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.EDGE) + assert Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.EDGE selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_3.feature())) -assert(Group_3.groupList().value(0).value().shapeType() == GeomAPI_Shape.SOLID) +assert selectionList.size() == 1 +assert aFactory.validate(Group_3.feature()) +assert Group_3.groupList().value(0).value().shapeType() == GeomAPI_Shape.SOLID -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestEdge.py b/src/BuildPlugin/Test/TestEdge.py index d842b56f2..44e2b36c6 100644 --- a/src/BuildPlugin/Test/TestEdge.py +++ b/src/BuildPlugin/Test/TestEdge.py @@ -25,13 +25,17 @@ from GeomAPI import * import random + def createLine(theSketchFeature): aSketchLineFeature = theSketchFeature.addFeature("SketchLine") - aSketchLineStartPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("StartPoint")) + aSketchLineStartPoint = geomDataAPI_Point2D( + aSketchLineFeature.attribute("StartPoint") + ) aSketchLineEndPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("EndPoint")) aSketchLineStartPoint.setValue(random.uniform(0, 100), random.uniform(0, 100)) aSketchLineEndPoint.setValue(random.uniform(0, 100), random.uniform(0, 100)) + # Get document aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -72,7 +76,7 @@ while aShapeExplorer.more(): aSession.finishOperation() # Test results -assert (len(anEdgeFeature.results()) == aNumOfLines) +assert len(anEdgeFeature.results()) == aNumOfLines # Test edge building on edge of another result aSession.startOperation() @@ -108,7 +112,7 @@ for s in aShapes: aSession.finishOperation() # Test results -assert (len(anEdgeFeature2.results()) == 12) +assert len(anEdgeFeature2.results()) == 12 # Check Edge feature failed on incorrect input aSession.startOperation() @@ -118,7 +122,7 @@ aShapeExplorer = GeomAPI_ShapeExplorer(aBoxShape, GeomAPI_Shape.VERTEX) aShape = aShapeExplorer.current() aBaseObjectsList.append(aBoxResult, aShape) aSession.finishOperation() -assert (len(anEdgeFeature3.results()) == 0) +assert len(anEdgeFeature3.results()) == 0 aSession.startOperation() aBaseObjectsList.clear() @@ -126,7 +130,7 @@ aShapeExplorer = GeomAPI_ShapeExplorer(aBoxShape, GeomAPI_Shape.FACE) aShape = aShapeExplorer.current() aBaseObjectsList.append(aBoxResult, aShape) aSession.finishOperation() -assert (len(anEdgeFeature3.results()) == 0) +assert len(anEdgeFeature3.results()) == 0 # remove failed feature aSession.startOperation() @@ -134,4 +138,5 @@ aPart.removeFeature(anEdgeFeature3) aSession.finishOperation() from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestEdge_ByPoints.py b/src/BuildPlugin/Test/TestEdge_ByPoints.py index 83269f087..bfbc2609f 100644 --- a/src/BuildPlugin/Test/TestEdge_ByPoints.py +++ b/src/BuildPlugin/Test/TestEdge_ByPoints.py @@ -28,24 +28,61 @@ SketchLine_1 = Sketch_1.addLine(30, -30, -20, -30) SketchLine_2 = Sketch_1.addLine(-20, -30, -20, 35) SketchLine_3 = Sketch_1.addLine(-20, 35, 30, 35) SketchLine_4 = Sketch_1.addLine(30, 35, 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()) +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() -Edge_1 = model.addEdge(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchLine_2_StartVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_4_StartVertex")) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Edge_2 = model.addEdge(Part_1_doc, model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][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_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]")) -Edge_3_objects = [model.selection("EDGE", "[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_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]")] +Edge_1 = model.addEdge( + Part_1_doc, + model.selection("VERTEX", "Sketch_1/SketchLine_2_StartVertex"), + model.selection("VERTEX", "Sketch_1/SketchLine_4_StartVertex"), +) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Edge_2 = model.addEdge( + Part_1_doc, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][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_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ), +) +Edge_3_objects = [ + model.selection( + "EDGE", + "[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_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ), +] Edge_3 = model.addEdge(Part_1_doc, Edge_3_objects) model.end() -assert(Edge_1.feature().error() == "") -assert(Edge_2.feature().error() == "") -assert(Edge_3.feature().error() == "") +assert Edge_1.feature().error() == "" +assert Edge_2.feature().error() == "" +assert Edge_3.feature().error() == "" -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestEdge_ErrorMsg.py b/src/BuildPlugin/Test/TestEdge_ErrorMsg.py index 9cae966f6..16ad47edc 100644 --- a/src/BuildPlugin/Test/TestEdge_ErrorMsg.py +++ b/src/BuildPlugin/Test/TestEdge_ErrorMsg.py @@ -18,6 +18,7 @@ # from ModelAPI import * + aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -42,19 +43,19 @@ aBoxShape = aBoxResult.shape() aSession.startOperation() Edge_1 = aPart.addFeature("Edge") Edge_1.execute() -assert(Edge_1.error() != "") +assert Edge_1.error() != "" aSession.finishOperation() aSession.startOperation() aBaseObjectsList = Edge_1.selectionList("base_objects") aBaseObjectsList.append("", "EDGE") Edge_1.execute() -assert(Edge_1.error() != "") +assert Edge_1.error() != "" aSession.finishOperation() aSession.startOperation() aBaseObjectsList.removeLast() aBaseObjectsList.append("Box_1_1/Top", "FACE") Edge_1.execute() -assert(Edge_1.error() != "") +assert Edge_1.error() != "" aSession.finishOperation() diff --git a/src/BuildPlugin/Test/TestEdge_WholeSketch_1.py b/src/BuildPlugin/Test/TestEdge_WholeSketch_1.py index 4490db63e..757a86d9f 100644 --- a/src/BuildPlugin/Test/TestEdge_WholeSketch_1.py +++ b/src/BuildPlugin/Test/TestEdge_WholeSketch_1.py @@ -27,18 +27,29 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, -20, 45, -15) SketchLine_2 = Sketch_1.addLine(45, -15, 10, 15) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(10, 15, 25, -40) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchArc_1 = Sketch_2.addArc(-5, 10, -5, -10, 15, 10, False) model.do() -Edge_1 = model.addEdge(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1"), model.selection("COMPOUND", "Sketch_2")], False) +Edge_1 = model.addEdge( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Sketch_1"), + model.selection("COMPOUND", "Sketch_2"), + ], + False, +) model.end() model.testNbResults(Edge_1, 4) model.testNbSubShapes(Edge_1, GeomAPI_Shape.EDGE, [1, 1, 1, 1]) model.testNbSubShapes(Edge_1, GeomAPI_Shape.VERTEX, [2, 2, 2, 2]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestEdge_WholeSketch_2.py b/src/BuildPlugin/Test/TestEdge_WholeSketch_2.py index ed29d8f25..d29101f20 100644 --- a/src/BuildPlugin/Test/TestEdge_WholeSketch_2.py +++ b/src/BuildPlugin/Test/TestEdge_WholeSketch_2.py @@ -27,18 +27,29 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, -20, 45, -15) SketchLine_2 = Sketch_1.addLine(45, -15, 10, 15) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(10, 15, 25, -40) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchArc_1 = Sketch_2.addArc(-5, 10, -5, -10, 15, 10, False) model.do() -Edge_1 = model.addEdge(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1"), model.selection("COMPOUND", "Sketch_2")], True) +Edge_1 = model.addEdge( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Sketch_1"), + model.selection("COMPOUND", "Sketch_2"), + ], + True, +) model.end() model.testNbResults(Edge_1, 8) model.testNbSubShapes(Edge_1, GeomAPI_Shape.EDGE, [1, 1, 1, 1, 1, 1, 1, 1]) model.testNbSubShapes(Edge_1, GeomAPI_Shape.VERTEX, [2, 2, 2, 2, 2, 2, 2, 2]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestEdge_WholeSketch_3.py b/src/BuildPlugin/Test/TestEdge_WholeSketch_3.py index 2876037e1..73bc9fb73 100644 --- a/src/BuildPlugin/Test/TestEdge_WholeSketch_3.py +++ b/src/BuildPlugin/Test/TestEdge_WholeSketch_3.py @@ -27,18 +27,29 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, -20, 45, -15) SketchLine_2 = Sketch_1.addLine(45, -15, 10, 15) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(10, 15, 25, -40) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchArc_1 = Sketch_2.addArc(-5, 10, -5, -10, 15, 10, False) model.do() -Edge_1 = model.addEdge(Part_1_doc, [model.selection("COMPOUND", "Sketch_1"), model.selection("EDGE", "Sketch_2/SketchArc_1_2")], False) +Edge_1 = model.addEdge( + Part_1_doc, + [ + model.selection("COMPOUND", "Sketch_1"), + model.selection("EDGE", "Sketch_2/SketchArc_1_2"), + ], + False, +) model.end() model.testNbResults(Edge_1, 4) model.testNbSubShapes(Edge_1, GeomAPI_Shape.EDGE, [1, 1, 1, 1]) model.testNbSubShapes(Edge_1, GeomAPI_Shape.VERTEX, [2, 2, 2, 2]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestEdge_WholeSketch_4.py b/src/BuildPlugin/Test/TestEdge_WholeSketch_4.py index 6a90a8819..85558c0b9 100644 --- a/src/BuildPlugin/Test/TestEdge_WholeSketch_4.py +++ b/src/BuildPlugin/Test/TestEdge_WholeSketch_4.py @@ -27,18 +27,29 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, -20, 45, -15) SketchLine_2 = Sketch_1.addLine(45, -15, 10, 15) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(10, 15, 25, -40) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchArc_1 = Sketch_2.addArc(-5, 10, -5, -10, 15, 10, False) model.do() -Edge_1 = model.addEdge(Part_1_doc, [model.selection("COMPOUND", "Sketch_1"), model.selection("EDGE", "Sketch_2/SketchArc_1_2")], True) +Edge_1 = model.addEdge( + Part_1_doc, + [ + model.selection("COMPOUND", "Sketch_1"), + model.selection("EDGE", "Sketch_2/SketchArc_1_2"), + ], + True, +) model.end() model.testNbResults(Edge_1, 8) model.testNbSubShapes(Edge_1, GeomAPI_Shape.EDGE, [1, 1, 1, 1, 1, 1, 1, 1]) model.testNbSubShapes(Edge_1, GeomAPI_Shape.VERTEX, [2, 2, 2, 2, 2, 2, 2, 2]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestFace.py b/src/BuildPlugin/Test/TestFace.py index e0d569ba3..37a0dcd44 100644 --- a/src/BuildPlugin/Test/TestFace.py +++ b/src/BuildPlugin/Test/TestFace.py @@ -84,7 +84,7 @@ while aShapeExplorer.more(): aSession.finishOperation() # Test results -assert (len(aFaceFeature.results()) > 0) +assert len(aFaceFeature.results()) > 0 # ============================================================================= # Test 2. Create face from edges of solid @@ -108,7 +108,7 @@ aFaceFeature2 = aPart.addFeature("Face") aBaseObjectsList = aFaceFeature2.selectionList("base_objects") aBaseObjectsList.append("[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]", "EDGE") aSession.finishOperation() -assert (len(aFaceFeature2.results()) > 0) +assert len(aFaceFeature2.results()) > 0 # ============================================================================= # Test 3. Create face from face of solid @@ -129,7 +129,7 @@ aFaceFeature3 = aPart.addFeature("Face") aBaseObjectsList = aFaceFeature3.selectionList("base_objects") aBaseObjectsList.append("Cylinder_2_1/Face_1", "FACE") aSession.finishOperation() -assert (len(aFaceFeature3.results()) > 0) +assert len(aFaceFeature3.results()) > 0 # ============================================================================= # Test 4. Verify error is reported if selection of face feature is mixed (edges and face) @@ -155,7 +155,7 @@ while aShapeExplorer.more(): aShapeExplorer.next() aBaseObjectsList.append("Cylinder_3_1/Face_3", "FACE") aSession.finishOperation() -assert (len(aFaceFeature4.results()) == 0) +assert len(aFaceFeature4.results()) == 0 # remove failed feature aSession.startOperation() aPart.removeFeature(aFaceFeature4) @@ -170,7 +170,7 @@ aFaceFeature5 = aPart.addFeature("Face") aBaseObjectsList = aFaceFeature5.selectionList("base_objects") aBaseObjectsList.append(aCylinderResult, None) aSession.finishOperation() -assert (len(aFaceFeature5.results()) == 0) +assert len(aFaceFeature5.results()) == 0 aSession.startOperation() aBaseObjectsList.clear() @@ -178,15 +178,17 @@ aShapeExplorer = GeomAPI_ShapeExplorer(aCylinderShape, GeomAPI_Shape.VERTEX) aShape = aShapeExplorer.current() aBaseObjectsList.append(aCylinderResult, aShape) aSession.finishOperation() -assert (len(aFaceFeature5.results()) == 0) +assert len(aFaceFeature5.results()) == 0 aSession.startOperation() aBaseObjectsList.clear() -aShapeExplorer = GeomAPI_ShapeExplorer(aFaceFeature.lastResult().shape(), GeomAPI_Shape.EDGE) +aShapeExplorer = GeomAPI_ShapeExplorer( + aFaceFeature.lastResult().shape(), GeomAPI_Shape.EDGE +) aShape = aShapeExplorer.current() aBaseObjectsList.append(aFaceFeature.lastResult(), aShape) aSession.finishOperation() -assert (len(aFaceFeature5.results()) == 0) +assert len(aFaceFeature5.results()) == 0 # remove failed feature aSession.startOperation() @@ -194,4 +196,5 @@ aPart.removeFeature(aFaceFeature5) aSession.finishOperation() from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestFace_ErrorMsg.py b/src/BuildPlugin/Test/TestFace_ErrorMsg.py index d72e6963a..afbd1e8a5 100644 --- a/src/BuildPlugin/Test/TestFace_ErrorMsg.py +++ b/src/BuildPlugin/Test/TestFace_ErrorMsg.py @@ -28,22 +28,36 @@ 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()) +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() != "") +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() != "") +assert Face_1.feature().error() != "" Part_1_doc.removeFeature(Face_1.feature()) model.end() diff --git a/src/BuildPlugin/Test/TestFace_WholeSketch_1.py b/src/BuildPlugin/Test/TestFace_WholeSketch_1.py index 8b1ad6bb4..9641b4bcd 100644 --- a/src/BuildPlugin/Test/TestFace_WholeSketch_1.py +++ b/src/BuildPlugin/Test/TestFace_WholeSketch_1.py @@ -27,15 +27,23 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, -20, 45, -15) SketchLine_2 = Sketch_1.addLine(45, -15, 10, 15) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(10, 15, 25, -40) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_2.addCircle(-5, 10, 20) SketchLine_4 = Sketch_2.addLine(-25, 10, 15, 10) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_4.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchCircle_1.results()[1] +) model.do() Face_1 = model.addFace(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")]) model.end() @@ -46,4 +54,4 @@ model.testNbSubShapes(Face_1, GeomAPI_Shape.EDGE, [3]) model.testNbSubShapes(Face_1, GeomAPI_Shape.VERTEX, [6]) model.testResultsAreas(Face_1, [441.0539215686274]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestFace_WholeSketch_2.py b/src/BuildPlugin/Test/TestFace_WholeSketch_2.py index ee3f3cade..456db769f 100644 --- a/src/BuildPlugin/Test/TestFace_WholeSketch_2.py +++ b/src/BuildPlugin/Test/TestFace_WholeSketch_2.py @@ -27,17 +27,31 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, -20, 45, -15) SketchLine_2 = Sketch_1.addLine(45, -15, 10, 15) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(10, 15, 25, -40) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_2.addCircle(-5, 10, 20) SketchLine_4 = Sketch_2.addLine(-25, 10, 15, 10) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_4.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchCircle_1.results()[1] +) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1"), model.selection("COMPOUND", "Sketch_2")]) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Sketch_1"), + model.selection("COMPOUND", "Sketch_2"), + ], +) model.end() model.testNbResults(Face_1, 3) @@ -46,4 +60,4 @@ model.testNbSubShapes(Face_1, GeomAPI_Shape.EDGE, [3, 2, 2]) model.testNbSubShapes(Face_1, GeomAPI_Shape.VERTEX, [6, 4, 4]) model.testResultsAreas(Face_1, [441.0539215686274, 628.318530717958, 628.318530717958]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestFilling.py b/src/BuildPlugin/Test/TestFilling.py index f3ed43f9c..0ae08c439 100644 --- a/src/BuildPlugin/Test/TestFilling.py +++ b/src/BuildPlugin/Test/TestFilling.py @@ -27,13 +27,40 @@ 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) +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() == "") +assert Filling_1.feature().error() == "" +assert Filling_2.feature().error() == "" model.end() diff --git a/src/BuildPlugin/Test/TestFilling_ByEdges.py b/src/BuildPlugin/Test/TestFilling_ByEdges.py index d525933cd..69678017d 100644 --- a/src/BuildPlugin/Test/TestFilling_ByEdges.py +++ b/src/BuildPlugin/Test/TestFilling_ByEdges.py @@ -89,7 +89,7 @@ aSession.finishOperation() # ============================================================================= # Test 1. Filling on one edge is failed (no result is built) # ============================================================================= -assert(len(aFillingFeature.results()) == 0) +assert len(aFillingFeature.results()) == 0 # ============================================================================= # Test 2. Add another edge, filling should be completed @@ -97,7 +97,7 @@ assert(len(aFillingFeature.results()) == 0) aSession.startOperation() aBaseObjectsList.append(anEdge.lastResult(), None) aSession.finishOperation() -assert(len(aFillingFeature.results()) > 0) +assert len(aFillingFeature.results()) > 0 # ============================================================================= # Test 3. Change parameters one-by-one and check validity of result @@ -108,22 +108,26 @@ aSession.finishOperation() orientations = ["auto_correct", "curve_info", "edge_orient"] tolerances = [0.0001, 0.001] for ori in orientations: - for minDeg in range(2, 4): - for maxDeg in range(5, 7): - for nbIter in range(0, 3, 2): - for tol2d in tolerances: - for tol3d in tolerances: - for approx in [False, True]: - aSession.startOperation() - aFillingFeature.string("orientation").setValue(ori) - aFillingFeature.integer("min_degree").setValue(minDeg) - aFillingFeature.integer("max_degree").setValue(maxDeg) - aFillingFeature.integer("nb_iter").setValue(nbIter) - aFillingFeature.real("tol_2d").setValue(tol2d) - aFillingFeature.real("tol_3d").setValue(tol3d) - aFillingFeature.boolean("approximation").setValue(approx) - aSession.finishOperation() - assert(len(aFillingFeature.results()) > 0), "Filling feature failed with parameters:\n orientation={}\n min deg={}\n max deg={}\n nb iter={}\n tol 2d={}\n tol 3d={}\n approximation={}".format(ori, minDeg, maxDeg, nbIter, tol2d, tol3d, approx) + for minDeg in range(2, 4): + for maxDeg in range(5, 7): + for nbIter in range(0, 3, 2): + for tol2d in tolerances: + for tol3d in tolerances: + for approx in [False, True]: + aSession.startOperation() + aFillingFeature.string("orientation").setValue(ori) + aFillingFeature.integer("min_degree").setValue(minDeg) + aFillingFeature.integer("max_degree").setValue(maxDeg) + aFillingFeature.integer("nb_iter").setValue(nbIter) + aFillingFeature.real("tol_2d").setValue(tol2d) + aFillingFeature.real("tol_3d").setValue(tol3d) + aFillingFeature.boolean("approximation").setValue(approx) + aSession.finishOperation() + assert ( + len(aFillingFeature.results()) > 0 + ), "Filling feature failed with parameters:\n orientation={}\n min deg={}\n max deg={}\n nb iter={}\n tol 2d={}\n tol 3d={}\n approximation={}".format( + ori, minDeg, maxDeg, nbIter, tol2d, tol3d, approx + ) # ============================================================================= # Test 4. Discard parameters to default and add one more edge @@ -147,7 +151,8 @@ aSession.startOperation() aPart.setCurrentFeature(aFillingFeature, True) aBaseObjectsList.append(aSketch1Result, anArc2.lastResult().shape()) aSession.finishOperation() -assert(len(aFillingFeature.results()) > 0) +assert len(aFillingFeature.results()) > 0 from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestFilling_ByWires.py b/src/BuildPlugin/Test/TestFilling_ByWires.py index 38372d2da..7f49ce995 100644 --- a/src/BuildPlugin/Test/TestFilling_ByWires.py +++ b/src/BuildPlugin/Test/TestFilling_ByWires.py @@ -111,7 +111,7 @@ aSession.finishOperation() # ============================================================================= # Test 1. Filling on one wire is failed (no result is built) # ============================================================================= -assert(len(aFillingFeature.results()) == 0) +assert len(aFillingFeature.results()) == 0 # ============================================================================= # Test 2. Add another wire, filling should be completed @@ -119,7 +119,7 @@ assert(len(aFillingFeature.results()) == 0) aSession.startOperation() aBaseObjectsList.append(aWire2.lastResult(), None) aSession.finishOperation() -assert(len(aFillingFeature.results()) > 0) +assert len(aFillingFeature.results()) > 0 # ============================================================================= # Test 3. Change parameters one-by-one and check validity of result @@ -130,22 +130,27 @@ aSession.finishOperation() orientations = ["auto_correct", "curve_info", "edge_orient"] tolerances = [0.0001, 0.001] for ori in orientations: - for minDeg in range(2, 4): - for maxDeg in range(5, 7): - for nbIter in range(0, 3, 2): - for tol2d in tolerances: - for tol3d in tolerances: - for approx in [False, True]: - aSession.startOperation() - aFillingFeature.string("orientation").setValue(ori) - aFillingFeature.integer("min_degree").setValue(minDeg) - aFillingFeature.integer("max_degree").setValue(maxDeg) - aFillingFeature.integer("nb_iter").setValue(nbIter) - aFillingFeature.real("tol_2d").setValue(tol2d) - aFillingFeature.real("tol_3d").setValue(tol3d) - aFillingFeature.boolean("approximation").setValue(approx) - aSession.finishOperation() - assert(len(aFillingFeature.results()) > 0), "Filling feature failed with parameters:\n orientation={}\n min deg={}\n max deg={}\n nb iter={}\n tol 2d={}\n tol 3d={}\n approximation={}".format(ori, minDeg, maxDeg, nbIter, tol2d, tol3d, approx) + for minDeg in range(2, 4): + for maxDeg in range(5, 7): + for nbIter in range(0, 3, 2): + for tol2d in tolerances: + for tol3d in tolerances: + for approx in [False, True]: + aSession.startOperation() + aFillingFeature.string("orientation").setValue(ori) + aFillingFeature.integer("min_degree").setValue(minDeg) + aFillingFeature.integer("max_degree").setValue(maxDeg) + aFillingFeature.integer("nb_iter").setValue(nbIter) + aFillingFeature.real("tol_2d").setValue(tol2d) + aFillingFeature.real("tol_3d").setValue(tol3d) + aFillingFeature.boolean("approximation").setValue(approx) + aSession.finishOperation() + assert ( + len(aFillingFeature.results()) > 0 + ), "Filling feature failed with parameters:\n orientation={}\n min deg={}\n max deg={}\n nb iter={}\n tol 2d={}\n tol 3d={}\n approximation={}".format( + ori, minDeg, maxDeg, nbIter, tol2d, tol3d, approx + ) from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestFilling_ErrorMsg.py b/src/BuildPlugin/Test/TestFilling_ErrorMsg.py index 734ac0916..37280c1cc 100644 --- a/src/BuildPlugin/Test/TestFilling_ErrorMsg.py +++ b/src/BuildPlugin/Test/TestFilling_ErrorMsg.py @@ -27,34 +27,58 @@ 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) +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() != "") +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() != "") +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() != "") +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() != "") +assert aFillingFeature.error() != "" aSession.finishOperation() aSession.startOperation() @@ -62,7 +86,7 @@ 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() != "") +assert aFillingFeature.error() != "" aSession.finishOperation() @@ -72,20 +96,56 @@ 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()) +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() != "") +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() != "") +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() diff --git a/src/BuildPlugin/Test/TestFilling_Mixed.py b/src/BuildPlugin/Test/TestFilling_Mixed.py index 216a1008e..161791fd5 100644 --- a/src/BuildPlugin/Test/TestFilling_Mixed.py +++ b/src/BuildPlugin/Test/TestFilling_Mixed.py @@ -96,7 +96,7 @@ aSession.finishOperation() # ============================================================================= # Test 1. Filling on one edge is failed (no result is built) # ============================================================================= -assert(len(aFillingFeature.results()) == 0) +assert len(aFillingFeature.results()) == 0 # ============================================================================= # Test 2. Add a wire, filling should be completed @@ -104,7 +104,7 @@ assert(len(aFillingFeature.results()) == 0) aSession.startOperation() aBaseObjectsList.append(aWire.lastResult(), None) aSession.finishOperation() -assert(len(aFillingFeature.results()) > 0) +assert len(aFillingFeature.results()) > 0 # ============================================================================= # Test 3. Change parameters one-by-one and check validity of result @@ -115,22 +115,26 @@ aSession.finishOperation() orientations = ["auto_correct", "curve_info", "edge_orient"] tolerances = [0.0001, 0.001] for ori in orientations: - for minDeg in range(2, 4): - for maxDeg in range(5, 7): - for nbIter in range(0, 3, 2): - for tol2d in tolerances: - for tol3d in tolerances: - for approx in [False, True]: - aSession.startOperation() - aFillingFeature.string("orientation").setValue(ori) - aFillingFeature.integer("min_degree").setValue(minDeg) - aFillingFeature.integer("max_degree").setValue(maxDeg) - aFillingFeature.integer("nb_iter").setValue(nbIter) - aFillingFeature.real("tol_2d").setValue(tol2d) - aFillingFeature.real("tol_3d").setValue(tol3d) - aFillingFeature.boolean("approximation").setValue(approx) - aSession.finishOperation() - assert(len(aFillingFeature.results()) > 0), "Filling feature failed with parameters:\n orientation={}\n min deg={}\n max deg={}\n nb iter={}\n tol 2d={}\n tol 3d={}\n approximation={}".format(ori, minDeg, maxDeg, nbIter, tol2d, tol3d, approx) + for minDeg in range(2, 4): + for maxDeg in range(5, 7): + for nbIter in range(0, 3, 2): + for tol2d in tolerances: + for tol3d in tolerances: + for approx in [False, True]: + aSession.startOperation() + aFillingFeature.string("orientation").setValue(ori) + aFillingFeature.integer("min_degree").setValue(minDeg) + aFillingFeature.integer("max_degree").setValue(maxDeg) + aFillingFeature.integer("nb_iter").setValue(nbIter) + aFillingFeature.real("tol_2d").setValue(tol2d) + aFillingFeature.real("tol_3d").setValue(tol3d) + aFillingFeature.boolean("approximation").setValue(approx) + aSession.finishOperation() + assert ( + len(aFillingFeature.results()) > 0 + ), "Filling feature failed with parameters:\n orientation={}\n min deg={}\n max deg={}\n nb iter={}\n tol 2d={}\n tol 3d={}\n approximation={}".format( + ori, minDeg, maxDeg, nbIter, tol2d, tol3d, approx + ) # ============================================================================= # Test 4. Discard parameters to default and add one more edge @@ -161,7 +165,8 @@ aSession.startOperation() aPart.setCurrentFeature(aFillingFeature, True) aBaseObjectsList.append(anEdge.lastResult(), None) aSession.finishOperation() -assert(len(aFillingFeature.results()) > 0) +assert len(aFillingFeature.results()) > 0 from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestInterpolation.py b/src/BuildPlugin/Test/TestInterpolation.py index 1e5bdbf41..3ae3839e9 100644 --- a/src/BuildPlugin/Test/TestInterpolation.py +++ b/src/BuildPlugin/Test/TestInterpolation.py @@ -47,7 +47,9 @@ model.do() # Get sketch points 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)] +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/SketchLine_1") @@ -56,7 +58,9 @@ Tangent_2 = model.selection("EDGE", "Sketch_1/SketchLine_2") # ============================================================================= # Test 1. Create curve 1-2-3-4-5, closed off, reorder off, without tangents # ============================================================================= -Interpolation_1 = model.addInterpolation(Part_1_doc, [p_1, p_2, p_3, p_4, p_5], False, False) +Interpolation_1 = model.addInterpolation( + Part_1_doc, [p_1, p_2, p_3, p_4, p_5], False, False +) model.do() model.checkResult(Interpolation_1, model, 1, [0], [0], [0], [1], [2]) @@ -64,7 +68,9 @@ model.checkResult(Interpolation_1, model, 1, [0], [0], [0], [1], [2]) # ============================================================================= # Test 2. Create curve 1-2-3-4-5-1, closed on, reorder off, without tangents # ============================================================================= -Interpolation_2 = model.addInterpolation(Part_1_doc, [p_1, p_2, p_3, p_4, p_5], True, False) +Interpolation_2 = model.addInterpolation( + Part_1_doc, [p_1, p_2, p_3, p_4, p_5], True, False +) model.do() model.checkResult(Interpolation_2, model, 1, [0], [0], [0], [1], [2]) @@ -89,8 +95,9 @@ model.checkResult(Interpolation_4, model, 1, [0], [0], [0], [1], [2]) # Test 5. Create curve 1-2-3-4-5, closed off, reorder off, with tangents # ============================================================================= -Interpolation_5 = model.addInterpolation(Part_1_doc, [p_1, p_2, p_3, p_4, p_5], - Tangent_1, Tangent_2, False, False) +Interpolation_5 = model.addInterpolation( + Part_1_doc, [p_1, p_2, p_3, p_4, p_5], Tangent_1, Tangent_2, False, False +) model.do() model.checkResult(Interpolation_5, model, 1, [0], [0], [0], [1], [2]) @@ -118,14 +125,16 @@ 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) @@ -144,8 +153,9 @@ 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]") -Interpolation_9 = model.addInterpolation(Part_3_doc, points, - Tangent_1, Tangent_2, False, False) +Interpolation_9 = model.addInterpolation( + Part_3_doc, points, Tangent_1, Tangent_2, False, False +) model.do() model.checkResult(Interpolation_9, model, 1, [0], [0], [0], [1], [2]) @@ -161,8 +171,7 @@ Point_2 = model.addPoint(Part_4_doc, 0, 0, 0) P_1 = model.selection("VERTEX", "Point_1") P_2 = model.selection("VERTEX", "Point_2") -Interpolation_10 = model.addInterpolation(Part_4_doc, [P_1, P_2], - False, False) +Interpolation_10 = model.addInterpolation(Part_4_doc, [P_1, P_2], False, False) model.do() model.testNbResults(Interpolation_10, 0) @@ -179,17 +188,23 @@ model.end() Part_5 = model.addPart(partSet) Part_5_doc = Part_5.document() -Interpolation_11 = model.addInterpolation(Part_5_doc, "sin(t)","cos(t)","t", 0, 100, 100) +Interpolation_11 = model.addInterpolation( + Part_5_doc, "sin(t)", "cos(t)", "t", 0, 100, 100 +) model.do() model.testNbResults(Interpolation_11, 1) myDelta = 1e-6 -Props = model.getGeometryCalculation(Part_5_doc,model.selection("EDGE", "Interpolation_1_1")) +Props = model.getGeometryCalculation( + Part_5_doc, model.selection("EDGE", "Interpolation_1_1") +) model.do() aRefLength = 141.32010978124 aResLength = Props[0] -assert (math.fabs(aResLength - aRefLength) < myDelta), "The length is wrong: expected = {0}, real = {1}".format(aRefLength, aResLength) +assert ( + math.fabs(aResLength - aRefLength) < myDelta +), "The length is wrong: expected = {0}, real = {1}".format(aRefLength, aResLength) model.end() # ============================================================================= # Test 13. Check Python dump # ============================================================================= -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/BuildPlugin/Test/TestNonPlanarFace.py b/src/BuildPlugin/Test/TestNonPlanarFace.py index f0ffbe570..9e535a0d4 100755 --- a/src/BuildPlugin/Test/TestNonPlanarFace.py +++ b/src/BuildPlugin/Test/TestNonPlanarFace.py @@ -42,21 +42,25 @@ l_coo.append((1, 8, 0)) l_coo.append((3, 10, 4)) l_coo.append((5, 5, 5)) l_coo.append((2, 3, 1)) -for iaux, (coo_x,coo_y,coo_z) in enumerate(l_coo): - point = model.addPoint(Part_1_doc, coo_x,coo_y,coo_z) - nom = "P_{}".format(iaux) - point.setName(nom) - point.result().setName(nom) - l_noms.append(nom) +for iaux, (coo_x, coo_y, coo_z) in enumerate(l_coo): + point = model.addPoint(Part_1_doc, coo_x, coo_y, coo_z) + nom = "P_{}".format(iaux) + point.setName(nom) + point.result().setName(nom) + l_noms.append(nom) ### Create Interpolation Interpolation_1_objects = list() for nom in l_noms: - Interpolation_1_objects.append(model.selection("VERTEX", "all-in-{}".format(nom))) -Interpolation_1 = model.addInterpolation(Part_1_doc, Interpolation_1_objects, True, False) + Interpolation_1_objects.append(model.selection("VERTEX", "all-in-{}".format(nom))) +Interpolation_1 = model.addInterpolation( + Part_1_doc, Interpolation_1_objects, True, False +) ### Create Wire -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Interpolation_1_1")], False) +Wire_1 = model.addWire( + Part_1_doc, [model.selection("EDGE", "Interpolation_1_1")], False +) ### Create Face Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_1_1")]) @@ -64,4 +68,4 @@ Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_1_1")]) model.end() if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser() + salome.sg.updateObjBrowser() diff --git a/src/BuildPlugin/Test/TestNonPlanarFace_Edges.py b/src/BuildPlugin/Test/TestNonPlanarFace_Edges.py index 12090f50c..380b01535 100644 --- a/src/BuildPlugin/Test/TestNonPlanarFace_Edges.py +++ b/src/BuildPlugin/Test/TestNonPlanarFace_Edges.py @@ -22,8 +22,9 @@ import salome salome.salome_init() import salome_notebook + notebook = salome_notebook.NoteBook() -sys.path.insert(0, r'/home/eksu/S2') +sys.path.insert(0, r"/home/eksu/S2") ### ### SHAPER component @@ -45,23 +46,43 @@ Point_4 = model.addPoint(Part_1_doc, 0, 10, 0) Point_5 = model.addPoint(Part_1_doc, 10, 10, 3) ### Create Edges -Edge_1 = model.addEdge(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")) -Edge_2 = model.addEdge(Part_1_doc, model.selection("VERTEX", "Edge_1_1/Modified_Vertex&Point_2/Point_2"), model.selection("VERTEX", "Point_4")) -Edge_3 = model.addEdge(Part_1_doc, model.selection("VERTEX", "Edge_2_1/Modified_Vertex&Point_4/Point_4"), model.selection("VERTEX", "Point_3")) -Edge_4 = model.addEdge(Part_1_doc, model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_1")) +Edge_1 = model.addEdge( + Part_1_doc, + model.selection("VERTEX", "Point_1"), + model.selection("VERTEX", "Point_2"), +) +Edge_2 = model.addEdge( + Part_1_doc, + model.selection("VERTEX", "Edge_1_1/Modified_Vertex&Point_2/Point_2"), + model.selection("VERTEX", "Point_4"), +) +Edge_3 = model.addEdge( + Part_1_doc, + model.selection("VERTEX", "Edge_2_1/Modified_Vertex&Point_4/Point_4"), + model.selection("VERTEX", "Point_3"), +) +Edge_4 = model.addEdge( + Part_1_doc, + model.selection("VERTEX", "Point_3"), + model.selection("VERTEX", "Point_1"), +) ### Create Wire -Wire_1_objects = [model.selection("EDGE", "Edge_1_1"), - model.selection("EDGE", "Edge_2_1"), - model.selection("EDGE", "Edge_4_1"), - model.selection("EDGE", "Edge_3_1")] +Wire_1_objects = [ + model.selection("EDGE", "Edge_1_1"), + model.selection("EDGE", "Edge_2_1"), + model.selection("EDGE", "Edge_4_1"), + model.selection("EDGE", "Edge_3_1"), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) ### Create Face -Face_1_objects = [model.selection("EDGE", "Wire_1_1/Modified_Edge&Edge_1_1/Edge_1_1"), - model.selection("EDGE", "Wire_1_1/Modified_Edge&Edge_2_1/Edge_2_1"), - model.selection("EDGE", "Wire_1_1/Modified_Edge&Edge_4_1/Edge_4_1"), - model.selection("EDGE", "Wire_1_1/Modified_Edge&Edge_3_1/Edge_3_1")] +Face_1_objects = [ + model.selection("EDGE", "Wire_1_1/Modified_Edge&Edge_1_1/Edge_1_1"), + model.selection("EDGE", "Wire_1_1/Modified_Edge&Edge_2_1/Edge_2_1"), + model.selection("EDGE", "Wire_1_1/Modified_Edge&Edge_4_1/Edge_4_1"), + model.selection("EDGE", "Wire_1_1/Modified_Edge&Edge_3_1/Edge_3_1"), +] Face_1 = model.addFace(Part_1_doc, Face_1_objects) model.end() @@ -72,7 +93,8 @@ model.end() model.publishToShaperStudy() import SHAPERSTUDY -Face_1_1, = SHAPERSTUDY.shape(model.featureStringId(Face_1)) + +(Face_1_1,) = SHAPERSTUDY.shape(model.featureStringId(Face_1)) if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser() + salome.sg.updateObjBrowser() diff --git a/src/BuildPlugin/Test/TestPolyline.py b/src/BuildPlugin/Test/TestPolyline.py index 6fc7a365b..3f9f9913e 100644 --- a/src/BuildPlugin/Test/TestPolyline.py +++ b/src/BuildPlugin/Test/TestPolyline.py @@ -42,7 +42,9 @@ model.do() # Get sketch points 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)] +p_1, p_2, p_3, p_4, p_5 = [ + model.selection("VERTEX", base_name + str(i + 1)) for i in range(0, 5) +] # ============================================================================= # Test 1. Create unclosed polyline 1-2-3-4-5 @@ -50,7 +52,7 @@ p_1, p_2, p_3, p_4, p_5 = [model.selection("VERTEX", base_name + str(i + 1)) for Polyline_1 = model.addPolyline3D(Part_1_doc, [p_1, p_2, p_3, p_4, p_5], False) model.do() -model.checkResult(Polyline_1, model, 1, [0], [0], [0], [4], [4*2]) +model.checkResult(Polyline_1, model, 1, [0], [0], [0], [4], [4 * 2]) # ============================================================================= # Test 2. Create closed polyline 1-2-3-4-5-1 @@ -58,7 +60,7 @@ model.checkResult(Polyline_1, model, 1, [0], [0], [0], [4], [4*2]) Polyline_2 = model.addPolyline3D(Part_1_doc, [p_1, p_2, p_3, p_4, p_5], True) model.do() -model.checkResult(Polyline_2, model, 1, [0], [0], [0], [5], [5*2]) +model.checkResult(Polyline_2, model, 1, [0], [0], [0], [5], [5 * 2]) # ============================================================================= # Test 3. Try to create self-intersected unclosed polyline 2-5-4-1 @@ -99,20 +101,22 @@ 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) model.do() -model.checkResult(Polyline_7, model, 1, [0], [0], [0], [7], [7*2]) +model.checkResult(Polyline_7, model, 1, [0], [0], [0], [7], [7 * 2]) # ============================================================================= # Test 8. Create closed polyline on box vertices @@ -126,7 +130,7 @@ points = [model.selection("VERTEX", name) for name in point_names] Polyline_8 = model.addPolyline3D(Part_3_doc, points, True) model.do() -model.checkResult(Polyline_8, model, 1, [0], [0], [0], [8], [8*2]) +model.checkResult(Polyline_8, model, 1, [0], [0], [0], [8], [8 * 2]) # ============================================================================= # Test 9. Create polyline using equal vertices @@ -153,4 +157,4 @@ model.end() # ============================================================================= # Test 11. Check Python dump # ============================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestShell.py b/src/BuildPlugin/Test/TestShell.py index 9e732f23b..69c0e15e0 100644 --- a/src/BuildPlugin/Test/TestShell.py +++ b/src/BuildPlugin/Test/TestShell.py @@ -23,6 +23,7 @@ from GeomDataAPI import * from GeomAlgoAPI import * from GeomAPI import * + def createFace(thePart, theNormX, theNormY, theNormZ): # Create a sketch aSession.startOperation() @@ -36,22 +37,30 @@ def createFace(thePart, theNormX, theNormY, theNormZ): # Create lines aSketchLineFeature = aSketchFeature.addFeature("SketchLine") - aSketchLineStartPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("StartPoint")) + aSketchLineStartPoint = geomDataAPI_Point2D( + aSketchLineFeature.attribute("StartPoint") + ) aSketchLineEndPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("EndPoint")) aSketchLineStartPoint.setValue(0, 0) aSketchLineEndPoint.setValue(0, 50) aSketchLineFeature = aSketchFeature.addFeature("SketchLine") - aSketchLineStartPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("StartPoint")) + aSketchLineStartPoint = geomDataAPI_Point2D( + aSketchLineFeature.attribute("StartPoint") + ) aSketchLineEndPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("EndPoint")) aSketchLineStartPoint.setValue(0, 50) aSketchLineEndPoint.setValue(50, 50) aSketchLineFeature = aSketchFeature.addFeature("SketchLine") - aSketchLineStartPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("StartPoint")) + aSketchLineStartPoint = geomDataAPI_Point2D( + aSketchLineFeature.attribute("StartPoint") + ) aSketchLineEndPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("EndPoint")) aSketchLineStartPoint.setValue(50, 50) aSketchLineEndPoint.setValue(50, 0) aSketchLineFeature = aSketchFeature.addFeature("SketchLine") - aSketchLineStartPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("StartPoint")) + aSketchLineStartPoint = geomDataAPI_Point2D( + aSketchLineFeature.attribute("StartPoint") + ) aSketchLineEndPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("EndPoint")) aSketchLineStartPoint.setValue(50, 0) aSketchLineEndPoint.setValue(0, 0) @@ -70,6 +79,7 @@ def createFace(thePart, theNormX, theNormY, theNormZ): aSession.finishOperation() return aFaceFeature.firstResult() + # Get document aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -95,7 +105,7 @@ for aFaceResult in aFaceResults: aSession.finishOperation() # Test results -assert (len(aShellFeature.results()) > 0) +assert len(aShellFeature.results()) > 0 # Test shell building on set of faces from another result @@ -120,7 +130,7 @@ aBaseObjectsList.append("Cylinder_1_1/Face_3", "FACE") aSession.finishOperation() # Test results -assert (len(aShellFeature2.results()) > 0) +assert len(aShellFeature2.results()) > 0 # Check Shell feature failed on incorrect input aShellResult = aShellFeature.firstResult() @@ -132,7 +142,7 @@ while aShapeExplorer.more(): aBaseObjectsList.append(aShellResult, aShapeExplorer.current()) aShapeExplorer.next() aSession.finishOperation() -assert (len(aShellFeature3.results()) == 0) +assert len(aShellFeature3.results()) == 0 # remove failed feature aSession.startOperation() @@ -140,4 +150,5 @@ aPart.removeFeature(aShellFeature3) aSession.finishOperation() from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestShell_WholeSketch_1.py b/src/BuildPlugin/Test/TestShell_WholeSketch_1.py index fdfb2d4ca..a3ab39155 100644 --- a/src/BuildPlugin/Test/TestShell_WholeSketch_1.py +++ b/src/BuildPlugin/Test/TestShell_WholeSketch_1.py @@ -27,15 +27,23 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, -20, 45, -15) SketchLine_2 = Sketch_1.addLine(45, -15, 10, 15) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(10, 15, 25, -40) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_2.addCircle(-5, 10, 20) SketchLine_4 = Sketch_2.addLine(-25, 10, 15, 10) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_4.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchCircle_1.results()[1] +) model.do() Shell_1 = model.addShell(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")]) model.end() @@ -46,4 +54,4 @@ model.testNbSubShapes(Shell_1, GeomAPI_Shape.EDGE, [3]) model.testNbSubShapes(Shell_1, GeomAPI_Shape.VERTEX, [6]) model.testResultsAreas(Shell_1, [441.0539215686274]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestShell_WholeSketch_2.py b/src/BuildPlugin/Test/TestShell_WholeSketch_2.py index cb3bc0be4..0633dd16f 100644 --- a/src/BuildPlugin/Test/TestShell_WholeSketch_2.py +++ b/src/BuildPlugin/Test/TestShell_WholeSketch_2.py @@ -27,17 +27,31 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, -20, 45, -15) SketchLine_2 = Sketch_1.addLine(45, -15, 10, 15) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(10, 15, 25, -40) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_2.addCircle(-5, 10, 20) SketchLine_4 = Sketch_2.addLine(-25, 10, 15, 10) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_4.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchCircle_1.results()[1] +) model.do() -Shell_1 = model.addShell(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1"), model.selection("COMPOUND", "Sketch_2")]) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Sketch_1"), + model.selection("COMPOUND", "Sketch_2"), + ], +) model.end() model.testNbResults(Shell_1, 2) @@ -46,4 +60,4 @@ model.testNbSubShapes(Shell_1, GeomAPI_Shape.EDGE, [3, 4]) model.testNbSubShapes(Shell_1, GeomAPI_Shape.VERTEX, [6, 8]) model.testResultsAreas(Shell_1, [441.0539215686274, 1256.637061435917]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestSolid.py b/src/BuildPlugin/Test/TestSolid.py index 5072ec06b..5963b0aa1 100644 --- a/src/BuildPlugin/Test/TestSolid.py +++ b/src/BuildPlugin/Test/TestSolid.py @@ -27,82 +27,193 @@ 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(40, 0, 0, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 40) SketchLine_3 = Sketch_1.addLine(0, 40, 40, 40) SketchLine_4 = Sketch_1.addLine(40, 40, 40, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.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/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")]) +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) SketchLine_7 = Sketch_2.addLine(0, 20, 20, 20) SketchLine_8 = Sketch_2.addLine(20, 20, 20, 0) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) 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/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()) -SketchConstraintEqual_2 = Sketch_2.setEqual(SketchLine_5.result(), SketchLine_6.result()) +SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint( + SketchLine_5.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchAPI_Line(SketchLine_9).startPoint(), SketchLine_5.endPoint() +) +SketchConstraintEqual_2 = Sketch_2.setEqual( + SketchLine_5.result(), SketchLine_6.result() +) SketchLine_10 = Sketch_2.addLine(20, 20, 20, 40) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_10.startPoint() +) SketchLine_11 = Sketch_2.addLine(20, 40, 0, 40) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchLine_12 = Sketch_2.addLine(0, 40, 0, 20) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_12.endPoint()) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_12.endPoint() +) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_10.result()) 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()) +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/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) +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, +) Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchLine_13 = Sketch_3.addLine(40, 0, 20, 0) SketchLine_14 = Sketch_3.addLine(20, 0, 20, 40) SketchLine_15 = Sketch_3.addLine(20, 40, 40, 40) SketchLine_16 = Sketch_3.addLine(40, 40, 40, 0) -SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_15 = Sketch_3.setCoincident( + SketchLine_16.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_3.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_3.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) +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/SketchLine_5_StartVertex"), 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/SketchLine_10_EndVertex"), False) +SketchConstraintCoincidence_19 = Sketch_3.setCoincident( + SketchLine_13.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates() +) +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/SketchLine_2_EndVertex"), False) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident( + SketchLine_14.endPoint(), SketchAPI_Point(SketchPoint_3).coordinates() +) +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()) +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_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r")], 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() + def createSolidStepByStep(theSelection, theExpected): Solid = model.addSolid(Part_1_doc, [theSelection[0]]) aList = [] @@ -110,43 +221,54 @@ def createSolidStepByStep(theSelection, theExpected): aList.append(selection) Solid.setBase(aList) if expected: - assert(len(Solid.results()) > 0), "FAILED: Solid is not built" + assert len(Solid.results()) > 0, "FAILED: Solid is not built" else: - assert(len(Solid.results()) == 0), "FAILED: Solid should not be built" + assert len(Solid.results()) == 0, "FAILED: Solid should not be built" # remove solid if it is not built if len(Solid.results()) == 0: Part_1_doc.removeFeature(Solid.feature()) return None return Solid + # ============================================================================= # Test 1. Build solid from faces applicable for compsolid # ============================================================================= -boundaries1 = [model.selection("FACE", "Face_1_1"), - model.selection("SHELL", "Shell_1_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")] +boundaries1 = [ + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_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) -assert(Solid_1 is None) +assert Solid_1 is None # ============================================================================= # Test 2. Build correct solid # ============================================================================= -boundaries2 = [model.selection("FACE", "Face_1_1"), - model.selection("SHELL", "Shell_1_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")] +boundaries2 = [ + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_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) @@ -155,4 +277,4 @@ model.testHaveNamingSubshapes(Solid_2, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestSolid_ErrorMsg.py b/src/BuildPlugin/Test/TestSolid_ErrorMsg.py index ceebf3719..dc6bc0d9b 100644 --- a/src/BuildPlugin/Test/TestSolid_ErrorMsg.py +++ b/src/BuildPlugin/Test/TestSolid_ErrorMsg.py @@ -18,6 +18,7 @@ # from ModelAPI import * + aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -31,4 +32,4 @@ aPart = aPartResult.partDoc() aSession.startOperation() Solid_1 = aPart.addFeature("Solid") aSession.finishOperation() -assert(Solid_1.error() != "") +assert Solid_1.error() != "" diff --git a/src/BuildPlugin/Test/TestSubShapes.py b/src/BuildPlugin/Test/TestSubShapes.py index 5ecd81c73..e5f39ffa0 100644 --- a/src/BuildPlugin/Test/TestSubShapes.py +++ b/src/BuildPlugin/Test/TestSubShapes.py @@ -25,20 +25,27 @@ from GeomAPI import * import random + def createPoint(theSketchFeature): aSketchPointFeature = theSketchFeature.addFeature("SketchPoint") - aPointCoordinates = geomDataAPI_Point2D(aSketchPointFeature.attribute("PointCoordinates")) + aPointCoordinates = geomDataAPI_Point2D( + aSketchPointFeature.attribute("PointCoordinates") + ) aPointCoordinates.setValue(random.uniform(0, 50), random.uniform(0, 50)) return aSketchPointFeature + def createLine(theSketchFeature): aSketchLineFeature = theSketchFeature.addFeature("SketchLine") - aSketchLineStartPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("StartPoint")) + aSketchLineStartPoint = geomDataAPI_Point2D( + aSketchLineFeature.attribute("StartPoint") + ) aSketchLineEndPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("EndPoint")) aSketchLineStartPoint.setValue(random.uniform(0, 50), random.uniform(0, 50)) aSketchLineEndPoint.setValue(random.uniform(0, 50), random.uniform(0, 50)) return aSketchLineFeature + # Get document aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -144,7 +151,7 @@ while aShapeExplorer.more(): aSession.finishOperation() # Test results -assert (len(aSubShapesFeature.results()) > 0) +assert len(aSubShapesFeature.results()) > 0 from salome.shaper import model @@ -155,14 +162,27 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(-454.545454545455, 50.600343053173, 137.95899463189) SketchCircle_2 = Sketch_1.addCircle(-454.545454545455, 50.600343053173, 62.129572131303) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchCircle_2.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchCircle_2.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("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")]) +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() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestSubShapes_ErrorMsg.py b/src/BuildPlugin/Test/TestSubShapes_ErrorMsg.py index a16d8be4e..b7ff70fab 100644 --- a/src/BuildPlugin/Test/TestSubShapes_ErrorMsg.py +++ b/src/BuildPlugin/Test/TestSubShapes_ErrorMsg.py @@ -24,26 +24,41 @@ 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_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() != "") +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() == "") +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() == "") +assert SubShapes_2.error() == "" aSession.finishOperation() model.begin() @@ -52,26 +67,48 @@ 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()) +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() != "") +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() != "") +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() != "") +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.py b/src/BuildPlugin/Test/TestVertex.py index 1e23427a9..6193563cd 100644 --- a/src/BuildPlugin/Test/TestVertex.py +++ b/src/BuildPlugin/Test/TestVertex.py @@ -25,12 +25,16 @@ from GeomAPI import * import random + def createPoint(theSketchFeature): aSketchPointFeature = theSketchFeature.addFeature("SketchPoint") - aPointCoordinates = geomDataAPI_Point2D(aSketchPointFeature.attribute("PointCoordinates")) + aPointCoordinates = geomDataAPI_Point2D( + aSketchPointFeature.attribute("PointCoordinates") + ) aPointCoordinates.setValue(random.uniform(0, 100), random.uniform(0, 100)) return aSketchPointFeature + # Get document aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -73,7 +77,7 @@ for aPoint in aPoints: aSession.finishOperation() # Test results -assert (len(aVertexFeature.results()) == aNumOfPoints) +assert len(aVertexFeature.results()) == aNumOfPoints # Check Vertex feature correct on a whole sketch aSession.startOperation() @@ -81,7 +85,7 @@ aVertexFeature2 = aPart.addFeature("Vertex") aBaseObjectsList = aVertexFeature2.selectionList("base_objects") aBaseObjectsList.append(aSketchResult, None) aSession.finishOperation() -assert (len(aVertexFeature2.results()) == aNumOfPoints) +assert len(aVertexFeature2.results()) == aNumOfPoints # Check Vertex feature failed on incorrect input aSession.startOperation() @@ -97,7 +101,7 @@ aVertexFeature3 = aPart.addFeature("Vertex") aBaseObjectsList = aVertexFeature3.selectionList("base_objects") aBaseObjectsList.append(aSketchResult, aLine.lastResult().shape()) aSession.finishOperation() -assert (len(aVertexFeature3.results()) == 0) +assert len(aVertexFeature3.results()) == 0 # remove failed feature aSession.startOperation() @@ -105,4 +109,5 @@ aPart.removeFeature(aVertexFeature3) aSession.finishOperation() from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestVertex_ErrorMsg.py b/src/BuildPlugin/Test/TestVertex_ErrorMsg.py index 96e568a1e..9f159c990 100644 --- a/src/BuildPlugin/Test/TestVertex_ErrorMsg.py +++ b/src/BuildPlugin/Test/TestVertex_ErrorMsg.py @@ -18,6 +18,7 @@ # from ModelAPI import * + aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -31,12 +32,12 @@ aPart = aPartResult.partDoc() aSession.startOperation() Vertex_1 = aPart.addFeature("Vertex") Vertex_1.execute() -assert(Vertex_1.error() != "") +assert Vertex_1.error() != "" aSession.finishOperation() aSession.startOperation() aBaseObjectsList = Vertex_1.selectionList("base_objects") aBaseObjectsList.append("", "EDGE") Vertex_1.execute() -assert(Vertex_1.error() != "") +assert Vertex_1.error() != "" aSession.finishOperation() diff --git a/src/BuildPlugin/Test/TestVertex_WholeSketch_1.py b/src/BuildPlugin/Test/TestVertex_WholeSketch_1.py index 22a0038a5..d0c7a74e8 100644 --- a/src/BuildPlugin/Test/TestVertex_WholeSketch_1.py +++ b/src/BuildPlugin/Test/TestVertex_WholeSketch_1.py @@ -27,17 +27,28 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, -20, 45, -15) SketchLine_2 = Sketch_1.addLine(45, -15, 10, 15) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(10, 15, 25, -40) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchArc_1 = Sketch_2.addArc(-5, 10, -5, -10, 15, 10, False) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1"), model.selection("COMPOUND", "Sketch_2")], False) +Vertex_1 = model.addVertex( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Sketch_1"), + model.selection("COMPOUND", "Sketch_2"), + ], + False, +) model.end() model.testNbResults(Vertex_1, 7) model.testNbSubShapes(Vertex_1, GeomAPI_Shape.VERTEX, [1, 1, 1, 1, 1, 1, 1]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestVertex_WholeSketch_2.py b/src/BuildPlugin/Test/TestVertex_WholeSketch_2.py index ff0fee1ed..f56c9fd10 100644 --- a/src/BuildPlugin/Test/TestVertex_WholeSketch_2.py +++ b/src/BuildPlugin/Test/TestVertex_WholeSketch_2.py @@ -27,17 +27,28 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, -20, 45, -15) SketchLine_2 = Sketch_1.addLine(45, -15, 10, 15) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(10, 15, 25, -40) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchArc_1 = Sketch_2.addArc(-5, 10, -5, -10, 15, 10, False) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1"), model.selection("COMPOUND", "Sketch_2")], True) +Vertex_1 = model.addVertex( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Sketch_1"), + model.selection("COMPOUND", "Sketch_2"), + ], + True, +) model.end() model.testNbResults(Vertex_1, 9) model.testNbSubShapes(Vertex_1, GeomAPI_Shape.VERTEX, [1, 1, 1, 1, 1, 1, 1, 1, 1]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestWire.py b/src/BuildPlugin/Test/TestWire.py index d1fcacca4..8bb6fe531 100644 --- a/src/BuildPlugin/Test/TestWire.py +++ b/src/BuildPlugin/Test/TestWire.py @@ -84,7 +84,7 @@ aWireFeature.customAction("add_contour") aSession.finishOperation() # Test results -assert (len(aWireFeature.results()) > 0) +assert len(aWireFeature.results()) > 0 from salome.shaper import model @@ -97,14 +97,30 @@ 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(-68.61063464837, 232.418524871355, -488.85077186964, 232.418524871355) -SketchLine_2 = Sketch_1.addLine(-488.85077186964, 232.418524871355, -488.85077186964, -153.516295025729) -SketchLine_3 = Sketch_1.addLine(-488.85077186964, -153.516295025729, -68.61063464837, -153.516295025729) -SketchLine_4 = Sketch_1.addLine(-68.61063464837, -153.516295025729, -68.61063464837, 232.418524871355) -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()) +SketchLine_1 = Sketch_1.addLine( + -68.61063464837, 232.418524871355, -488.85077186964, 232.418524871355 +) +SketchLine_2 = Sketch_1.addLine( + -488.85077186964, 232.418524871355, -488.85077186964, -153.516295025729 +) +SketchLine_3 = Sketch_1.addLine( + -488.85077186964, -153.516295025729, -68.61063464837, -153.516295025729 +) +SketchLine_4 = Sketch_1.addLine( + -68.61063464837, -153.516295025729, -68.61063464837, 232.418524871355 +) +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()) @@ -142,7 +158,7 @@ aBaseObjectsList.append("[Box_1_1/Left][Box_1_1/Bottom]", "EDGE") aSession.finishOperation() # Test results -assert (len(aWireFeature2.results()) == 1) +assert len(aWireFeature2.results()) == 1 # ============================================================================= # Test 4. Check Wire feature on the whole sketch @@ -153,7 +169,7 @@ aWireFeature3 = aPart.addFeature("Wire") aBaseObjectsList = aWireFeature3.selectionList("base_objects") aBaseObjectsList.append(aSketchResult, None) aSession.finishOperation() -assert (len(aWireFeature3.results()) == 1) +assert len(aWireFeature3.results()) == 1 # ============================================================================= # Test 5. Check Wire feature failed on incorrect input @@ -166,7 +182,7 @@ aShapeExplorer = GeomAPI_ShapeExplorer(aBoxShape, GeomAPI_Shape.VERTEX) aShape = aShapeExplorer.current() aBaseObjectsList.append(aBoxResult, aShape) aSession.finishOperation() -assert (len(aWireFeature3.results()) == 0) +assert len(aWireFeature3.results()) == 0 aSession.startOperation() aBaseObjectsList.clear() @@ -174,11 +190,11 @@ aShapeExplorer = GeomAPI_ShapeExplorer(aBoxShape, GeomAPI_Shape.FACE) aShape = aShapeExplorer.current() aBaseObjectsList.append(aBoxResult, aShape) aSession.finishOperation() -assert (len(aWireFeature3.results()) == 0) +assert len(aWireFeature3.results()) == 0 # remove failed feature aSession.startOperation() aPart.removeFeature(aWireFeature3) aSession.finishOperation() -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/BuildPlugin/Test/TestWire_ErrorMsg.py b/src/BuildPlugin/Test/TestWire_ErrorMsg.py index cdf0abbc6..ba29b6de6 100644 --- a/src/BuildPlugin/Test/TestWire_ErrorMsg.py +++ b/src/BuildPlugin/Test/TestWire_ErrorMsg.py @@ -18,6 +18,7 @@ # from ModelAPI import * + aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -42,7 +43,7 @@ aBoxShape = aBoxResult.shape() aSession.startOperation() Wire_1 = aPart.addFeature("Wire") Wire_1.execute() -assert(Wire_1.error() != "") +assert Wire_1.error() != "" aSession.finishOperation() aSession.startOperation() @@ -50,7 +51,7 @@ 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() != "") +assert Wire_1.error() != "" aSession.finishOperation() @@ -66,7 +67,9 @@ 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 = 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()) @@ -75,9 +78,15 @@ 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()) +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")]) diff --git a/src/BuildPlugin/Test/TestWire_WholeSketch_1.py b/src/BuildPlugin/Test/TestWire_WholeSketch_1.py index 9ccac2636..633ed7488 100644 --- a/src/BuildPlugin/Test/TestWire_WholeSketch_1.py +++ b/src/BuildPlugin/Test/TestWire_WholeSketch_1.py @@ -27,18 +27,29 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, -20, 45, -15) SketchLine_2 = Sketch_1.addLine(45, -15, 10, 15) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(10, 15, 25, -40) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchArc_1 = Sketch_2.addArc(-5, 10, -5, -10, 15, 10, False) model.do() -Wire_1 = model.addWire(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1"), model.selection("COMPOUND", "Sketch_2")], False) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Sketch_1"), + model.selection("COMPOUND", "Sketch_2"), + ], + False, +) model.end() model.testNbResults(Wire_1, 2) model.testNbSubShapes(Wire_1, GeomAPI_Shape.EDGE, [3, 1]) model.testNbSubShapes(Wire_1, GeomAPI_Shape.VERTEX, [6, 2]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestWire_WholeSketch_2.py b/src/BuildPlugin/Test/TestWire_WholeSketch_2.py index 25d6d6901..76639b5a2 100644 --- a/src/BuildPlugin/Test/TestWire_WholeSketch_2.py +++ b/src/BuildPlugin/Test/TestWire_WholeSketch_2.py @@ -27,18 +27,29 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, -20, 45, -15) SketchLine_2 = Sketch_1.addLine(45, -15, 10, 15) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(10, 15, 25, -40) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchArc_1 = Sketch_2.addArc(-5, 10, -5, -10, 15, 10, False) model.do() -Wire_1 = model.addWire(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1"), model.selection("COMPOUND", "Sketch_2")], True) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Sketch_1"), + model.selection("COMPOUND", "Sketch_2"), + ], + True, +) model.end() model.testNbResults(Wire_1, 3) model.testNbSubShapes(Wire_1, GeomAPI_Shape.EDGE, [3, 2, 1]) model.testNbSubShapes(Wire_1, GeomAPI_Shape.VERTEX, [6, 4, 2]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestWire_WholeSketch_3.py b/src/BuildPlugin/Test/TestWire_WholeSketch_3.py index f9d46e4ae..d94f99239 100644 --- a/src/BuildPlugin/Test/TestWire_WholeSketch_3.py +++ b/src/BuildPlugin/Test/TestWire_WholeSketch_3.py @@ -25,18 +25,42 @@ 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(-20.12530657814797, -34.87380706737215, -10.13449613893172, -4.005160196312613) -SketchLine_2 = Sketch_1.addLine(-15.5320876476665, -20.68212021382587, -37.87121169090271, -18.01751586506584) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_1.result()) -SketchLine_3 = Sketch_1.addLine(-37.87121169090271, -18.01751586506584, -28.23126689685475, -46.70782775211335) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-10.13449613893172, -4.005160196312613, -17.3289483797767, 22.37844327189705) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(-17.3289483797767, 22.37844327189705, -36.60883796787262, 2.754269941156556) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(-36.60883796787262, 2.754269941156556, -10.13449613893172, -4.005160196312613) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_6.endPoint()) +SketchLine_1 = Sketch_1.addLine( + -20.12530657814797, -34.87380706737215, -10.13449613893172, -4.005160196312613 +) +SketchLine_2 = Sketch_1.addLine( + -15.5320876476665, -20.68212021382587, -37.87121169090271, -18.01751586506584 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_1.result() +) +SketchLine_3 = Sketch_1.addLine( + -37.87121169090271, -18.01751586506584, -28.23126689685475, -46.70782775211335 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -10.13449613893172, -4.005160196312613, -17.3289483797767, 22.37844327189705 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + -17.3289483797767, 22.37844327189705, -36.60883796787262, 2.754269941156556 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + -36.60883796787262, 2.754269941156556, -10.13449613893172, -4.005160196312613 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_6.endPoint() +) model.do() Wire_1 = model.addWire(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")]) model.end() @@ -45,4 +69,4 @@ model.testNbResults(Wire_1, 2) model.testNbSubShapes(Wire_1, GeomAPI_Shape.EDGE, [4, 2]) model.testNbSubShapes(Wire_1, GeomAPI_Shape.VERTEX, [8, 4]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestWire_WholeSketch_4.py b/src/BuildPlugin/Test/TestWire_WholeSketch_4.py index 390b500ea..4e00991b1 100644 --- a/src/BuildPlugin/Test/TestWire_WholeSketch_4.py +++ b/src/BuildPlugin/Test/TestWire_WholeSketch_4.py @@ -25,18 +25,42 @@ 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(-20.12530657814797, -34.87380706737215, -10.13449613893172, -4.005160196312613) -SketchLine_2 = Sketch_1.addLine(-15.5320876476665, -20.68212021382587, -37.87121169090271, -18.01751586506584) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_1.result()) -SketchLine_3 = Sketch_1.addLine(-37.87121169090271, -18.01751586506584, -28.23126689685475, -46.70782775211335) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-10.13449613893172, -4.005160196312613, -17.3289483797767, 22.37844327189705) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(-17.3289483797767, 22.37844327189705, -36.60883796787262, 2.754269941156556) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(-36.60883796787262, 2.754269941156556, -10.13449613893172, -4.005160196312613) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_6.endPoint()) +SketchLine_1 = Sketch_1.addLine( + -20.12530657814797, -34.87380706737215, -10.13449613893172, -4.005160196312613 +) +SketchLine_2 = Sketch_1.addLine( + -15.5320876476665, -20.68212021382587, -37.87121169090271, -18.01751586506584 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_1.result() +) +SketchLine_3 = Sketch_1.addLine( + -37.87121169090271, -18.01751586506584, -28.23126689685475, -46.70782775211335 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -10.13449613893172, -4.005160196312613, -17.3289483797767, 22.37844327189705 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + -17.3289483797767, 22.37844327189705, -36.60883796787262, 2.754269941156556 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + -36.60883796787262, 2.754269941156556, -10.13449613893172, -4.005160196312613 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_6.endPoint() +) model.do() Wire_1 = model.addWire(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], True) model.end() @@ -45,4 +69,4 @@ model.testNbResults(Wire_1, 3) model.testNbSubShapes(Wire_1, GeomAPI_Shape.EDGE, [3, 2, 2]) model.testNbSubShapes(Wire_1, GeomAPI_Shape.VERTEX, [6, 4, 4]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestWire_WholeSketch_5.py b/src/BuildPlugin/Test/TestWire_WholeSketch_5.py index 723b22ea4..b53064a39 100644 --- a/src/BuildPlugin/Test/TestWire_WholeSketch_5.py +++ b/src/BuildPlugin/Test/TestWire_WholeSketch_5.py @@ -25,18 +25,42 @@ 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(-20.13297844091623, -34.87132400696332, -10.14115693918956, -4.003004374441855) -SketchLine_2 = Sketch_1.addLine(-15.36017779982175, -20.12643132586926, -37.81263639928755, -17.52358908612689) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_1.result()) -SketchLine_3 = Sketch_1.addLine(-37.81263639928755, -17.52358908612689, -28.23126689685475, -46.70782775211335) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-10.14115693918956, -4.003004374441855, -17.3289483797767, 22.37844327189705) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(-17.3289483797767, 22.37844327189705, -39.00238825664131, 1.575954908729718) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(-39.00238825664131, 1.575954908729718, -25.86766799285223, -18.90833134866903) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_2.result()) +SketchLine_1 = Sketch_1.addLine( + -20.13297844091623, -34.87132400696332, -10.14115693918956, -4.003004374441855 +) +SketchLine_2 = Sketch_1.addLine( + -15.36017779982175, -20.12643132586926, -37.81263639928755, -17.52358908612689 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_1.result() +) +SketchLine_3 = Sketch_1.addLine( + -37.81263639928755, -17.52358908612689, -28.23126689685475, -46.70782775211335 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -10.14115693918956, -4.003004374441855, -17.3289483797767, 22.37844327189705 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + -17.3289483797767, 22.37844327189705, -39.00238825664131, 1.575954908729718 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + -39.00238825664131, 1.575954908729718, -25.86766799285223, -18.90833134866903 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_2.result() +) model.do() Wire_1 = model.addWire(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")]) model.end() @@ -45,4 +69,4 @@ model.testNbResults(Wire_1, 2) model.testNbSubShapes(Wire_1, GeomAPI_Shape.EDGE, [4, 2]) model.testNbSubShapes(Wire_1, GeomAPI_Shape.VERTEX, [8, 4]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/Test/TestWire_WholeSketch_6.py b/src/BuildPlugin/Test/TestWire_WholeSketch_6.py index d3fa1cb60..e6405209f 100644 --- a/src/BuildPlugin/Test/TestWire_WholeSketch_6.py +++ b/src/BuildPlugin/Test/TestWire_WholeSketch_6.py @@ -25,18 +25,42 @@ 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(-20.13297844091623, -34.87132400696332, -10.14115693918956, -4.003004374441855) -SketchLine_2 = Sketch_1.addLine(-15.36017779982175, -20.12643132586926, -37.81263639928755, -17.52358908612689) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_1.result()) -SketchLine_3 = Sketch_1.addLine(-37.81263639928755, -17.52358908612689, -28.23126689685475, -46.70782775211335) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-10.14115693918956, -4.003004374441855, -17.3289483797767, 22.37844327189705) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(-17.3289483797767, 22.37844327189705, -39.00238825664131, 1.575954908729718) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(-39.00238825664131, 1.575954908729718, -25.86766799285223, -18.90833134866903) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_2.result()) +SketchLine_1 = Sketch_1.addLine( + -20.13297844091623, -34.87132400696332, -10.14115693918956, -4.003004374441855 +) +SketchLine_2 = Sketch_1.addLine( + -15.36017779982175, -20.12643132586926, -37.81263639928755, -17.52358908612689 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_1.result() +) +SketchLine_3 = Sketch_1.addLine( + -37.81263639928755, -17.52358908612689, -28.23126689685475, -46.70782775211335 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -10.14115693918956, -4.003004374441855, -17.3289483797767, 22.37844327189705 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + -17.3289483797767, 22.37844327189705, -39.00238825664131, 1.575954908729718 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + -39.00238825664131, 1.575954908729718, -25.86766799285223, -18.90833134866903 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_2.result() +) model.do() Wire_1 = model.addWire(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], True) model.end() @@ -45,4 +69,4 @@ model.testNbResults(Wire_1, 3) model.testNbSubShapes(Wire_1, GeomAPI_Shape.EDGE, [5, 1, 2]) model.testNbSubShapes(Wire_1, GeomAPI_Shape.VERTEX, [10, 2, 4]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/BuildPlugin/doc/examples/compound.py b/src/BuildPlugin/doc/examples/compound.py index 5b26d0f6b..b7ad4bb8d 100644 --- a/src/BuildPlugin/doc/examples/compound.py +++ b/src/BuildPlugin/doc/examples/compound.py @@ -5,7 +5,11 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Compound_1_objects = [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")] +Compound_1_objects = [ + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Left"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.do() model.end() diff --git a/src/BuildPlugin/doc/examples/edge.py b/src/BuildPlugin/doc/examples/edge.py index de4acc094..636e8a408 100644 --- a/src/BuildPlugin/doc/examples/edge.py +++ b/src/BuildPlugin/doc/examples/edge.py @@ -5,6 +5,8 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]")]) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]")] +) model.do() model.end() diff --git a/src/BuildPlugin/doc/examples/face.py b/src/BuildPlugin/doc/examples/face.py index 66507b484..3b81f259f 100644 --- a/src/BuildPlugin/doc/examples/face.py +++ b/src/BuildPlugin/doc/examples/face.py @@ -5,7 +5,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) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), - model.selection("FACE", "Box_1_1/Front")]) +Face_1 = model.addFace( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Front")], +) model.do() model.end() diff --git a/src/BuildPlugin/doc/examples/filling.py b/src/BuildPlugin/doc/examples/filling.py index b53de3bb8..676a87513 100644 --- a/src/BuildPlugin/doc/examples/filling.py +++ b/src/BuildPlugin/doc/examples/filling.py @@ -5,6 +5,12 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]")]) +Filling_1 = model.addFilling( + Part_1_doc, + [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), + ], +) model.do() model.end() diff --git a/src/BuildPlugin/doc/examples/interpolation.py b/src/BuildPlugin/doc/examples/interpolation.py index 53f83bc1c..530660d0c 100644 --- a/src/BuildPlugin/doc/examples/interpolation.py +++ b/src/BuildPlugin/doc/examples/interpolation.py @@ -5,7 +5,14 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Interpolation_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/Top]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]")] -Interpolation_1 = model.addInterpolation(Part_1_doc, Interpolation_1_objects, True, False) +Interpolation_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/Top]"), + model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"), +] +Interpolation_1 = model.addInterpolation( + Part_1_doc, Interpolation_1_objects, True, False +) model.do() model.end() diff --git a/src/BuildPlugin/doc/examples/interpolationAnalytical.py b/src/BuildPlugin/doc/examples/interpolationAnalytical.py index f39fe81ed..26be5f249 100644 --- a/src/BuildPlugin/doc/examples/interpolationAnalytical.py +++ b/src/BuildPlugin/doc/examples/interpolationAnalytical.py @@ -4,6 +4,8 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Interpolation_1 = model.addInterpolation(Part_1_doc, "5*sin(t)","5*cos(t)","t*0.2", 0, 25, 100) +Interpolation_1 = model.addInterpolation( + Part_1_doc, "5*sin(t)", "5*cos(t)", "t*0.2", 0, 25, 100 +) model.do() model.end() diff --git a/src/BuildPlugin/doc/examples/polyline.py b/src/BuildPlugin/doc/examples/polyline.py index cba083208..5187d0dc1 100644 --- a/src/BuildPlugin/doc/examples/polyline.py +++ b/src/BuildPlugin/doc/examples/polyline.py @@ -7,7 +7,11 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Point_2 = model.addPoint(Part_1_doc, -10, -5, -7) Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_1")]) -Polyline_1_objects = [model.selection("VERTEX", "Point_1"), 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]")] +Polyline_1_objects = [ + model.selection("VERTEX", "Point_1"), + 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]"), +] Polyline_1 = model.addPolyline3D(Part_1_doc, Polyline_1_objects, False) model.do() model.end() diff --git a/src/BuildPlugin/doc/examples/segment.py b/src/BuildPlugin/doc/examples/segment.py index 6ccf085e4..1e06c7e35 100644 --- a/src/BuildPlugin/doc/examples/segment.py +++ b/src/BuildPlugin/doc/examples/segment.py @@ -5,7 +5,10 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Edge_1 = model.addEdge(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/Right][Box_1_1/Bottom]")) +Edge_1 = model.addEdge( + 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/Right][Box_1_1/Bottom]"), +) model.do() model.end() diff --git a/src/BuildPlugin/doc/examples/shell.py b/src/BuildPlugin/doc/examples/shell.py index bee4ed8c0..c69a67832 100644 --- a/src/BuildPlugin/doc/examples/shell.py +++ b/src/BuildPlugin/doc/examples/shell.py @@ -5,7 +5,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) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), - model.selection("FACE", "Box_1_1/Front")]) +Shell_1 = model.addShell( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Front")], +) model.do() model.end() diff --git a/src/BuildPlugin/doc/examples/solid.py b/src/BuildPlugin/doc/examples/solid.py index bdab1f20a..abb85c466 100644 --- a/src/BuildPlugin/doc/examples/solid.py +++ b/src/BuildPlugin/doc/examples/solid.py @@ -5,12 +5,14 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Solid_1_objects = [model.selection("FACE", "Box_1_1/Top"), - model.selection("FACE", "Box_1_1/Front"), - model.selection("FACE", "Box_1_1/Left"), - model.selection("FACE", "Box_1_1/Back"), - model.selection("FACE", "Box_1_1/Right"), - model.selection("FACE", "Box_1_1/Bottom")] +Solid_1_objects = [ + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Back"), + model.selection("FACE", "Box_1_1/Right"), + model.selection("FACE", "Box_1_1/Bottom"), +] Solid_1 = model.addSolid(Part_1_doc, Solid_1_objects) model.do() model.end() diff --git a/src/BuildPlugin/doc/examples/subshapes.py b/src/BuildPlugin/doc/examples/subshapes.py index 27b17fc77..1278630cd 100644 --- a/src/BuildPlugin/doc/examples/subshapes.py +++ b/src/BuildPlugin/doc/examples/subshapes.py @@ -5,18 +5,53 @@ 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(-56.65008576329333, 13.33962264150944, 9.528301886792452, 66.69811320754719) -SketchLine_2 = Sketch_1.addLine(9.528301886792452, 66.69811320754719, 78.47855917667239, -27.54545454545455) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(78.47855917667239, -27.54545454545455, 7.795883361921087, -89.2195540308748) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(7.795883361921087, -89.2195540308748, 12.64665523156088, -20.9622641509434) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(12.64665523156088, -20.9622641509434, -56.65008576329333, 13.33962264150944) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.startPoint()) +SketchLine_1 = Sketch_1.addLine( + -56.65008576329333, 13.33962264150944, 9.528301886792452, 66.69811320754719 +) +SketchLine_2 = Sketch_1.addLine( + 9.528301886792452, 66.69811320754719, 78.47855917667239, -27.54545454545455 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 78.47855917667239, -27.54545454545455, 7.795883361921087, -89.2195540308748 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + 7.795883361921087, -89.2195540308748, 12.64665523156088, -20.9622641509434 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 12.64665523156088, -20.9622641509434, -56.65008576329333, 13.33962264150944 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_1.startPoint() +) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")]) -SubShapes_1 = model.addSubShapes(Part_1_doc, model.selection("FACE", "Face_1_1"), [model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_5")]) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], +) +SubShapes_1 = model.addSubShapes( + Part_1_doc, + model.selection("FACE", "Face_1_1"), + [ + model.selection("EDGE", "Sketch_1/SketchLine_4"), + model.selection("EDGE", "Sketch_1/SketchLine_5"), + ], +) model.do() model.end() diff --git a/src/BuildPlugin/doc/examples/vertex.py b/src/BuildPlugin/doc/examples/vertex.py index be7522448..233c28f7a 100644 --- a/src/BuildPlugin/doc/examples/vertex.py +++ b/src/BuildPlugin/doc/examples/vertex.py @@ -5,7 +5,11 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Vertex_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/Top]")] +Vertex_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/Top]"), +] Vertex_1 = model.addVertex(Part_1_doc, Vertex_1_objects) model.do() model.end() diff --git a/src/BuildPlugin/doc/examples/wire.py b/src/BuildPlugin/doc/examples/wire.py index 362a9386b..ff5a4dc38 100644 --- a/src/BuildPlugin/doc/examples/wire.py +++ b/src/BuildPlugin/doc/examples/wire.py @@ -5,7 +5,12 @@ 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_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]")] +Wire_1_objects = [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects) model.do() model.end() diff --git a/src/CollectionPlugin/Test/Test18739.py b/src/CollectionPlugin/Test/Test18739.py index 57f8b1fc1..f3c1686bf 100644 --- a/src/CollectionPlugin/Test/Test18739.py +++ b/src/CollectionPlugin/Test/Test18739.py @@ -30,18 +30,55 @@ model.addParameter(Part_1_doc, "nb", "3") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(-34, 28, 1) SketchCircle_2 = Sketch_1.addCircle(-34, 28, 3) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchCircle_2.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchCircle_2.center() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_1_2r_wire_2")], model.selection(), 2, -1) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_1_2r_wire")], model.selection(), 5, 0) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1"), model.selection("COMPOUND", "all-in-Extrusion_2")]) -Group_1 = model.addGroup(Part_1_doc, "Solids", [model.selection("SOLID", "Partition_1_1_1")]) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("EDGE", "PartSet/OX"), "d", "nb", model.selection("EDGE", "PartSet/OY"), "d", "nb") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "WIRE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_1_2r_wire_2" + ) + ], + model.selection(), + 2, + -1, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_1_2r_wire")], + model.selection(), + 5, + 0, +) +Partition_1 = model.addPartition( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Extrusion_1"), + model.selection("COMPOUND", "all-in-Extrusion_2"), + ], +) +Group_1 = model.addGroup( + Part_1_doc, "Solids", [model.selection("SOLID", "Partition_1_1_1")] +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + model.selection("EDGE", "PartSet/OX"), + "d", + "nb", + model.selection("EDGE", "PartSet/OY"), + "d", + "nb", +) model.do() Part_1_doc.moveFeature(Group_1.feature(), LinearCopy_1.feature(), True) model.end() for a in range(9): - aGroup = Part_1_doc.objectByName("Features", "Group_1_" + str(a + 1)) - aSelName = aGroup.data().selectionList("group_list").value(0).context().data().name() - assert(aSelName == "LinearCopy_1_1_" + str(a + 1) + "_1") + aGroup = Part_1_doc.objectByName("Features", "Group_1_" + str(a + 1)) + aSelName = ( + aGroup.data().selectionList("group_list").value(0).context().data().name() + ) + assert aSelName == "LinearCopy_1_1_" + str(a + 1) + "_1" diff --git a/src/CollectionPlugin/Test/Test2977.py b/src/CollectionPlugin/Test/Test2977.py index 13d1676c8..6c00b2156 100644 --- a/src/CollectionPlugin/Test/Test2977.py +++ b/src/CollectionPlugin/Test/Test2977.py @@ -24,11 +24,24 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Top")]) -Group_2 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")]) +Group_1 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Top")], +) +Group_2 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")], +) Group_3 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Top")]) -GroupAddition_1 = model.addGroupAddition(Part_1_doc, [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")]) -GroupSubstraction_1 = model.addGroupSubstraction(Part_1_doc, [model.selection("COMPOUND", "GroupAddition_1")], [model.selection("COMPOUND", "Group_3")]) +GroupAddition_1 = model.addGroupAddition( + Part_1_doc, + [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")], +) +GroupSubstraction_1 = model.addGroupSubstraction( + Part_1_doc, + [model.selection("COMPOUND", "GroupAddition_1")], + [model.selection("COMPOUND", "Group_3")], +) model.end() from GeomAPI import * @@ -41,4 +54,4 @@ model.testNbSubShapes(GroupSubstraction_1, GeomAPI_Shape.EDGE, [8]) model.testNbSubShapes(GroupSubstraction_1, GeomAPI_Shape.VERTEX, [16]) model.testResultsAreas(GroupSubstraction_1, [200]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/Test3031.py b/src/CollectionPlugin/Test/Test3031.py index 85a0adebf..1636aba59 100644 --- a/src/CollectionPlugin/Test/Test3031.py +++ b/src/CollectionPlugin/Test/Test3031.py @@ -26,22 +26,32 @@ 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(17.20575221238938, 2.793141592920342, 8.375699762004958) +SketchCircle_1 = Sketch_1.addCircle( + 17.20575221238938, 2.793141592920342, 8.375699762004958 +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) -SketchLine_1 = Sketch_2.addLine(24.25155410709516, 6.639479956172791, 20.59251568321609, -12.31511385947313) +SketchLine_1 = Sketch_2.addLine( + 24.25155410709516, 6.639479956172791, 20.59251568321609, -12.31511385947313 +) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")]) +Face_1 = model.addFace( + Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")] +) Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_1")]) Group_1 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "Edge_1_1")]) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("EDGE", "Edge_1_1")], keepSubResults = True) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("FACE", "Face_1_1"), model.selection("EDGE", "Edge_1_1")], + keepSubResults=True, +) model.do() # move group after the partition Part_1_doc.moveFeature(Group_1.feature(), Partition_1.feature()) model.end() # check that only two edges are in the group result, no face -assert(len(Group_1.feature().results())==1) +assert len(Group_1.feature().results()) == 1 model.testNbSubShapes(Group_1, GeomAPI_Shape.EDGE, [2]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/Test3114.py b/src/CollectionPlugin/Test/Test3114.py index c0772272e..54a66bb6a 100644 --- a/src/CollectionPlugin/Test/Test3114.py +++ b/src/CollectionPlugin/Test/Test3114.py @@ -26,46 +26,107 @@ 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(45.19889502762433, 34.03867403314917, -47.9889502762431, 34.03867403314917) -SketchLine_2 = Sketch_1.addLine(-47.9889502762431, 34.03867403314917, -47.9889502762431, -32.64364640883979) -SketchLine_3 = Sketch_1.addLine(-47.9889502762431, -32.64364640883979, 45.19889502762433, -32.64364640883979) -SketchLine_4 = Sketch_1.addLine(45.19889502762433, -32.64364640883979, 45.19889502762433, 34.03867403314917) -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()) +SketchLine_1 = Sketch_1.addLine( + 45.19889502762433, 34.03867403314917, -47.9889502762431, 34.03867403314917 +) +SketchLine_2 = Sketch_1.addLine( + -47.9889502762431, 34.03867403314917, -47.9889502762431, -32.64364640883979 +) +SketchLine_3 = Sketch_1.addLine( + -47.9889502762431, -32.64364640883979, 45.19889502762433, -32.64364640883979 +) +SketchLine_4 = Sketch_1.addLine( + 45.19889502762433, -32.64364640883979, 45.19889502762433, 34.03867403314917 +) +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(-0.27900552486187, -3.9060773480663, 16.61196177134834) +SketchCircle_1 = Sketch_1.addCircle( + -0.27900552486187, -3.9060773480663, 16.61196177134834 +) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchCircle_1_2r")]) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchCircle_1_2r", + ) + ], +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) Recover_1 = model.addRecover(Part_1_doc, Translation_1, [Face_1.result()]) -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("FACE", "Translation_1_1")], model.selection("EDGE", "PartSet/OZ"), True) -Extrusion_1_objects = [model.selection("FACE", "Recover_1_1"), model.selection("FACE", "Symmetry_1_1_1"), model.selection("FACE", "Symmetry_1_1_2")] -Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection(), 50, 0) -Group_3 = model.addGroup(Part_1_doc, "Edges", [model.selection("COMPOUND", "all-in-Extrusion_1")]) -Group_5 = model.addGroup(Part_1_doc, "Faces", [model.selection("COMPOUND", "all-in-Extrusion_1")]) -Group_6 = model.addGroup(Part_1_doc, "Solids", [model.selection("COMPOUND", "all-in-Extrusion_1")]) -LinearCopy_1_objects = [model.selection("SOLID", "Extrusion_1_3"), model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")] -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, LinearCopy_1_objects, model.selection("EDGE", "PartSet/OY"), 80, 2, model.selection("EDGE", "PartSet/OZ"), 70, 3) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("FACE", "Translation_1_1")], + model.selection("EDGE", "PartSet/OZ"), + True, +) +Extrusion_1_objects = [ + model.selection("FACE", "Recover_1_1"), + model.selection("FACE", "Symmetry_1_1_1"), + model.selection("FACE", "Symmetry_1_1_2"), +] +Extrusion_1 = model.addExtrusion( + Part_1_doc, Extrusion_1_objects, model.selection(), 50, 0 +) +Group_3 = model.addGroup( + Part_1_doc, "Edges", [model.selection("COMPOUND", "all-in-Extrusion_1")] +) +Group_5 = model.addGroup( + Part_1_doc, "Faces", [model.selection("COMPOUND", "all-in-Extrusion_1")] +) +Group_6 = model.addGroup( + Part_1_doc, "Solids", [model.selection("COMPOUND", "all-in-Extrusion_1")] +) +LinearCopy_1_objects = [ + model.selection("SOLID", "Extrusion_1_3"), + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_1_2"), +] +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + LinearCopy_1_objects, + model.selection("EDGE", "PartSet/OY"), + 80, + 2, + model.selection("EDGE", "PartSet/OZ"), + 70, + 3, +) model.do() Part_1_doc.moveFeature(Group_3.feature(), LinearCopy_1.feature(), True) Part_1_doc.moveFeature(Group_5.feature(), LinearCopy_1.feature(), True) Part_1_doc.moveFeature(Group_6.feature(), LinearCopy_1.feature(), True) model.end() -assert(Part_1_doc.size("Groups") == 3) # equal to the number of original groups +assert Part_1_doc.size("Groups") == 3 # equal to the number of original groups # check names of results from ModelAPI import * aFactory = ModelAPI_Session.get().validators() for group in [Group_3, Group_5, Group_6]: - assert(aFactory.validate(group.feature())) - selectionList = group.feature().selectionList("group_list") - assert(selectionList.size() == 1) + assert aFactory.validate(group.feature()) + selectionList = group.feature().selectionList("group_list") + assert selectionList.size() == 1 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestCreateShapesFromGroups.py b/src/CollectionPlugin/Test/TestCreateShapesFromGroups.py index 05ded2043..1e38085e0 100755 --- a/src/CollectionPlugin/Test/TestCreateShapesFromGroups.py +++ b/src/CollectionPlugin/Test/TestCreateShapesFromGroups.py @@ -30,7 +30,14 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 1) ### Create RevolutionFuse -RevolutionFuse_1 = model.addRevolutionFuse(Part_1_doc, [], model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), 80, 0, [model.selection("SOLID", "Box_1_1")]) +RevolutionFuse_1 = model.addRevolutionFuse( + Part_1_doc, + [], + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), + 80, + 0, + [model.selection("SOLID", "Box_1_1")], +) ### Create Sketch Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) @@ -58,16 +65,20 @@ Sketch_1.setRadius(SketchArc_2.results()[1], 4) RevolutionFuse_1.setNestedSketch(Sketch_1) ### Create Group -Group_1_objects = [model.selection("FACE", "RevolutionFuse_1_1/Modified_Face&Box_1_1/Top"), - model.selection("FACE", "RevolutionFuse_1_1/Generated_Face&Sketch_1/SketchArc_1_2"), - model.selection("FACE", "RevolutionFuse_1_1/Generated_Face&Sketch_1/SketchArc_2_2"), - model.selection("FACE", "RevolutionFuse_1_1/To_Face")] +Group_1_objects = [ + model.selection("FACE", "RevolutionFuse_1_1/Modified_Face&Box_1_1/Top"), + model.selection("FACE", "RevolutionFuse_1_1/Generated_Face&Sketch_1/SketchArc_1_2"), + model.selection("FACE", "RevolutionFuse_1_1/Generated_Face&Sketch_1/SketchArc_2_2"), + model.selection("FACE", "RevolutionFuse_1_1/To_Face"), +] Group_1 = model.addGroup(Part_1_doc, "Faces", Group_1_objects) Group_1.setName("Group_faces") Group_1.result().setName("Group_faces") ### Create GroupShape -GroupShape_1 = model.addGroupShape(Part_1_doc, [model.selection("COMPOUND", "Group_faces")]) +GroupShape_1 = model.addGroupShape( + Part_1_doc, [model.selection("COMPOUND", "Group_faces")] +) GroupShape_1.result().setName("GroupShape_1") ### Create Shell @@ -75,40 +86,48 @@ Shell_1 = model.addShell(Part_1_doc, [model.selection("COMPOUND", "GroupShape_1" Shell_1.result().setName("Shell_1_1") ### Create Group -Group_2_objects = [model.selection("EDGE", "[RevolutionFuse_1_1/To_Face][GroupShape_1_1_3/GroupShape_1_1_3]"), - model.selection("EDGE", "[GroupShape_1_1_3/GroupShape_1_1_3][new_weak_name_1]"), - model.selection("EDGE", "[GroupShape_1_1_3/GroupShape_1_1_3][new_weak_name_4]")] +Group_2_objects = [ + model.selection( + "EDGE", "[RevolutionFuse_1_1/To_Face][GroupShape_1_1_3/GroupShape_1_1_3]" + ), + model.selection("EDGE", "[GroupShape_1_1_3/GroupShape_1_1_3][new_weak_name_1]"), + model.selection("EDGE", "[GroupShape_1_1_3/GroupShape_1_1_3][new_weak_name_4]"), +] Group_2 = model.addGroup(Part_1_doc, "Edges", Group_2_objects) Group_2.setName("Group_edges") Group_2.result().setName("Group_edges") ### Create GroupShape -GroupShape_2 = model.addGroupShape(Part_1_doc, [model.selection("COMPOUND", "Group_edges")]) +GroupShape_2 = model.addGroupShape( + Part_1_doc, [model.selection("COMPOUND", "Group_edges")] +) GroupShape_2.result().setName("GroupShape_2") ### Create Wire -Wire_1_objects = [model.selection("EDGE", "GroupShape_2_1_2"), - model.selection("EDGE", "GroupShape_2_1_3"), - model.selection("EDGE", "GroupShape_2_1_1")] +Wire_1_objects = [ + model.selection("EDGE", "GroupShape_2_1_2"), + model.selection("EDGE", "GroupShape_2_1_3"), + model.selection("EDGE", "GroupShape_2_1_1"), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) Wire_1.result().setName("Wire_1_1") model.end() -#============================================================================= +# ============================================================================= # Tests : -#============================================================================= +# ============================================================================= # Group of edges : model.checkResult(Wire_1, model, 1, [0], [0], [0], [3], [6]) -r=Wire_1.defaultResult() -s=r.shape() -dim=s.computeSize() -dim=dim[1:] -dx=abs(dim[3]-dim[0]) -dy=abs(dim[4]-dim[1]) -dz=abs(dim[5]-dim[2]) -print(dx,dy,dz) -tol=1e-06 -assert(abs(dx-7.0000002) <= tol) -assert(abs(dy-2.6261643) <= tol) -assert(abs(dz-8.46802318) <= tol) +r = Wire_1.defaultResult() +s = r.shape() +dim = s.computeSize() +dim = dim[1:] +dx = abs(dim[3] - dim[0]) +dy = abs(dim[4] - dim[1]) +dz = abs(dim[5] - dim[2]) +print(dx, dy, dz) +tol = 1e-06 +assert abs(dx - 7.0000002) <= tol +assert abs(dy - 2.6261643) <= tol +assert abs(dz - 8.46802318) <= tol diff --git a/src/CollectionPlugin/Test/TestField.py b/src/CollectionPlugin/Test/TestField.py index 9989b6b89..fda81672d 100644 --- a/src/CollectionPlugin/Test/TestField.py +++ b/src/CollectionPlugin/Test/TestField.py @@ -27,9 +27,9 @@ data()->addAttribute(FeaturesPlugin_Group::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -43,9 +43,9 @@ aSession.startOperation() aPartFeature = aSession.moduleDocument().addFeature("Part") aSession.finishOperation() aPart = aSession.activeDocument() -#========================================================================= +# ========================================================================= # Create a sketch with triangle and extrude it -#========================================================================= +# ========================================================================= aSession.startOperation() aTriangleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin")) @@ -63,12 +63,12 @@ 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(-100., 0.) -aLineAEndPoint.setValue(100., 0.) -aLineBStartPoint.setValue(100., 0.) -aLineBEndPoint.setValue(0., 173.2) -aLineCStartPoint.setValue(0., 173.2) -aLineCEndPoint.setValue(-100., 0.) +aLineAStartPoint.setValue(-100.0, 0.0) +aLineAEndPoint.setValue(100.0, 0.0) +aLineBStartPoint.setValue(100.0, 0.0) +aLineBEndPoint.setValue(0.0, 173.2) +aLineCStartPoint.setValue(0.0, 173.2) +aLineCEndPoint.setValue(-100.0, 0.0) aSession.finishOperation() # Build sketch faces aSession.startOperation() @@ -84,27 +84,37 @@ anExtrusionFt.real("from_offset").setValue(0) anExtrusionFt.execute() aSession.finishOperation() anExtrusionBody = modelAPI_ResultBody(anExtrusionFt.firstResult()) -#========================================================================= +# ========================================================================= # Create doubles field on vertices -#========================================================================= +# ========================================================================= aSession.startOperation() aField = aSession.activeDocument().addFeature("Field") aSelectionListAttr = aField.selectionList("selected") aSelectionListAttr.setSelectionType("vertex") -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]") +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.setSize(2) # two components aComponentNames.setValue(0, "temperatue") aComponentNames.setValue(1, "porosity") aStamps = aField.intArray("stamps") -aStamps.setSize(1) # one step +aStamps.setSize(1) # one step aStamps.setValue(0, 10) aTables = aField.tables("values") -aTables.setType(2) # double -aTables.setSize(1 + 3, 2, 1) # default row + number of selected, number of compoents, number of steps (tables) -aTables.setValue(20, 0, 0, 0) # value, index of selection, index of component, index of step +aTables.setType(2) # double +aTables.setSize( + 1 + 3, 2, 1 +) # default row + number of selected, number of compoents, number of steps (tables) +aTables.setValue( + 20, 0, 0, 0 +) # value, index of selection, index of component, index of step aTables.setValue(35, 1, 0, 0) aTables.setValue(27, 2, 0, 0) aTables.setValue(28, 3, 0, 0) @@ -113,79 +123,92 @@ aTables.setValue(0.55, 1, 1, 0) aTables.setValue(0.39, 2, 1, 0) aTables.setValue(0.40, 3, 1, 0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create strings field on faces -#========================================================================= +# ========================================================================= aSession.startOperation() aField = aSession.activeDocument().addFeature("Field") aSelectionListAttr = aField.selectionList("selected") aSelectionListAttr.setSelectionType("face") aSelectionListAttr.append("Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1") aComponentNames = aField.stringArray("components_names") -aComponentNames.setSize(1) # one component +aComponentNames.setSize(1) # one component aComponentNames.setValue(0, "description") aStamps = aField.intArray("stamps") -aStamps.setSize(2) # two steps +aStamps.setSize(2) # two steps aStamps.setValue(0, 1) aStamps.setValue(1, 3) aTables = aField.tables("values") -aTables.setType(3) # string -aTables.setSize(1 + 1, 1, 2) # default row + number of selected, number of compoents, number of steps (tables) -aTables.setValue("-default-", 0, 0, 0) # value, index of selection, index of component, index of step +aTables.setType(3) # string +aTables.setSize( + 1 + 1, 1, 2 +) # default row + number of selected, number of compoents, number of steps (tables) +aTables.setValue( + "-default-", 0, 0, 0 +) # value, index of selection, index of component, index of step aTables.setValue("-default-", 0, 0, 1) aTables.setValue("Face one", 1, 0, 0) aTables.setValue("Face two", 1, 0, 1) aSession.finishOperation() aFieldResult = aField.firstResult() -assert(aFieldResult) -#========================================================================= +assert aFieldResult +# ========================================================================= # Create integer field on faces -#========================================================================= +# ========================================================================= aSession.startOperation() aField = aSession.activeDocument().addFeature("Field") aSelectionListAttr = aField.selectionList("selected") aSelectionListAttr.setSelectionType("face") aSelectionListAttr.append("Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1") aComponentNames = aField.stringArray("components_names") -aComponentNames.setSize(1) # one component +aComponentNames.setSize(1) # one component aComponentNames.setValue(0, "description") aStamps = aField.intArray("stamps") -aStamps.setSize(1) # one step +aStamps.setSize(1) # one step aStamps.setValue(0, 0) aTables = aField.tables("values") -aTables.setType(1) # integer -aTables.setSize(1 + 1, 1, 1) # default row + number of selected, number of compoents, number of steps (tables) -aTables.setValue(0, 0, 0, 0) # value, index of selection, index of component, index of step +aTables.setType(1) # integer +aTables.setSize( + 1 + 1, 1, 1 +) # default row + number of selected, number of compoents, number of steps (tables) +aTables.setValue( + 0, 0, 0, 0 +) # value, index of selection, index of component, index of step aTables.setValue(2, 1, 0, 0) aSession.finishOperation() aFieldResult = aField.firstResult() -assert(aFieldResult) +assert aFieldResult -#========================================================================= +# ========================================================================= # Create Boolean field on faces -#========================================================================= +# ========================================================================= aSession.startOperation() aField = aSession.activeDocument().addFeature("Field") aSelectionListAttr = aField.selectionList("selected") aSelectionListAttr.setSelectionType("face") aSelectionListAttr.append("Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1") aComponentNames = aField.stringArray("components_names") -aComponentNames.setSize(1) # one component +aComponentNames.setSize(1) # one component aComponentNames.setValue(0, "description") aStamps = aField.intArray("stamps") -aStamps.setSize(1) # one step +aStamps.setSize(1) # one step aStamps.setValue(0, 0) aTables = aField.tables("values") -aTables.setType(0) # boolean -aTables.setSize(1 + 1, 1, 1) # default row + number of selected, number of compoents, number of steps (tables) -aTables.setValue(True, 0, 0, 0) # value, index of selection, index of component, index of step +aTables.setType(0) # boolean +aTables.setSize( + 1 + 1, 1, 1 +) # default row + number of selected, number of compoents, number of steps (tables) +aTables.setValue( + True, 0, 0, 0 +) # value, index of selection, index of component, index of step aTables.setValue(False, 1, 0, 0) aSession.finishOperation() aFieldResult = aField.firstResult() -assert(aFieldResult) +assert aFieldResult from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroup.py b/src/CollectionPlugin/Test/TestGroup.py index e8745305e..3b51d37fc 100644 --- a/src/CollectionPlugin/Test/TestGroup.py +++ b/src/CollectionPlugin/Test/TestGroup.py @@ -27,9 +27,9 @@ data()->addAttribute(FeaturesPlugin_Group::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -43,9 +43,9 @@ aSession.startOperation() aPartFeature = aSession.moduleDocument().addFeature("Part") aSession.finishOperation() aPart = aSession.activeDocument() -#========================================================================= +# ========================================================================= # Create a sketch with triangle and extrude it -#========================================================================= +# ========================================================================= aSession.startOperation() aTriangleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin")) @@ -63,12 +63,12 @@ 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(-100., 0.) -aLineAEndPoint.setValue(100., 0.) -aLineBStartPoint.setValue(100., 0.) -aLineBEndPoint.setValue(0., 173.2) -aLineCStartPoint.setValue(0., 173.2) -aLineCEndPoint.setValue(-100., 0.) +aLineAStartPoint.setValue(-100.0, 0.0) +aLineAEndPoint.setValue(100.0, 0.0) +aLineBStartPoint.setValue(100.0, 0.0) +aLineBEndPoint.setValue(0.0, 173.2) +aLineCStartPoint.setValue(0.0, 173.2) +aLineCEndPoint.setValue(-100.0, 0.0) aSession.finishOperation() # Build sketch faces aSession.startOperation() @@ -82,102 +82,132 @@ anExtrusionFt.real("from_size").setValue(50) anExtrusionFt.execute() aSession.finishOperation() anExtrusionBody = modelAPI_ResultBody(anExtrusionFt.firstResult()) -#========================================================================= +# ========================================================================= # Create group of vertex -#========================================================================= +# ========================================================================= aSession.startOperation() aGroupFeature = aSession.activeDocument().addFeature("Group") aSelectionListAttr = aGroupFeature.selectionList("group_list") aSelectionListAttr.setSelectionType("vertex") -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]") +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 -#========================================================================= -assert(aSelectionListAttr.size() == 6) +# ========================================================================= +assert aSelectionListAttr.size() == 6 aGroupResult = aGroupFeature.firstResult() -assert(aGroupResult) -#========================================================================= +assert aGroupResult +# ========================================================================= # Create group of edges -#========================================================================= +# ========================================================================= aSession.startOperation() aGroupFeature = aSession.activeDocument().addFeature("Group") aSelectionListAttr = aGroupFeature.selectionList("group_list") aSelectionListAttr.setSelectionType("edge") -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]") +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 -#========================================================================= -assert(aSelectionListAttr.size() == 9) +# ========================================================================= +assert aSelectionListAttr.size() == 9 aGroupResult = aGroupFeature.firstResult() -assert(aGroupResult) -#========================================================================= +assert aGroupResult +# ========================================================================= # Create group of faces -#========================================================================= +# ========================================================================= aSession.startOperation() aGroupFeature = aSession.activeDocument().addFeature("Group") aSelectionListAttr = aGroupFeature.selectionList("group_list") aSelectionListAttr.setSelectionType("face") aShapeExplorer = GeomAPI_ShapeExplorer(anExtrusionBody.shape(), GeomAPI_Shape.FACE) while aShapeExplorer.more(): - aSelectionListAttr.append(anExtrusionBody, aShapeExplorer.current()) - aShapeExplorer.next(); + aSelectionListAttr.append(anExtrusionBody, aShapeExplorer.current()) + aShapeExplorer.next() aSession.finishOperation() -#========================================================================= +# ========================================================================= # Check results -#========================================================================= -assert(aSelectionListAttr.size() == 5) +# ========================================================================= +assert aSelectionListAttr.size() == 5 aGroupResult = aGroupFeature.firstResult() -assert(aGroupResult) -#========================================================================= +assert aGroupResult +# ========================================================================= # Create group of solids -#========================================================================= +# ========================================================================= aSession.startOperation() aGroupFeature = aSession.activeDocument().addFeature("Group") aSelectionListAttr = aGroupFeature.selectionList("group_list") aSelectionListAttr.setSelectionType("face") aSelectionListAttr.append(anExtrusionBody, None) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Check results -#========================================================================= -assert(aSelectionListAttr.size() == 1) +# ========================================================================= +assert aSelectionListAttr.size() == 1 aGroupResult = aGroupFeature.firstResult() -assert(aGroupResult) +assert aGroupResult -#========================================================================= +# ========================================================================= # Create group of face -#========================================================================= +# ========================================================================= aSession.startOperation() aGroupFeature = aSession.activeDocument().addFeature("Group") aSelectionListAttr = aGroupFeature.selectionList("group_list") aSelectionListAttr.setSelectionType("face") aSelectionListAttr.append("Extrusion_1_1/To_Face") aSession.finishOperation() -#========================================================================= +# ========================================================================= # Check results -#========================================================================= -assert(aSelectionListAttr.size() == 1) +# ========================================================================= +assert aSelectionListAttr.size() == 1 aGroupResult = aGroupFeature.firstResult() -assert(aGroupResult) +assert aGroupResult -#========================================================================= +# ========================================================================= # Create a sketch circle to extrude -#========================================================================= +# ========================================================================= aSession.startOperation() aCircleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")) @@ -190,21 +220,23 @@ norm.setValue(0, 0, 1) aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle") anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center")) aCircleRadius = aSketchCircle.real("circle_radius") -anCircleCentr.setValue(0., 57.74) -aCircleRadius.setValue(50.) +anCircleCentr.setValue(0.0, 57.74) +aCircleRadius.setValue(50.0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on circle -#========================================================================= +# ========================================================================= # Build shape from sketcher results aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult()) -assert(aCircleSketchResult.facesNum() > 0) +assert aCircleSketchResult.facesNum() > 0 # Create extrusion aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "Extrusion") +assert anExtrusionFt.getKind() == "Extrusion" # selection type FACE=4 -anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(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) @@ -212,9 +244,9 @@ anExtrusionFt.execute() aSession.finishOperation() aCylinderBody = modelAPI_ResultBody(anExtrusionFt.firstResult()) -#========================================================================= +# ========================================================================= # Create a cut -#========================================================================= +# ========================================================================= aSession.startOperation() aBooleanFt = aPart.addFeature("Cut") aBooleanFt.selectionList("main_objects").append(anExtrusionBody, None) @@ -222,26 +254,27 @@ aBooleanFt.selectionList("tool_objects").append(aCylinderBody, None) aBooleanFt.execute() aSession.finishOperation() -#========================================================================= +# ========================================================================= # Move group feature -#========================================================================= +# ========================================================================= aSession.startOperation() aPart.moveFeature(aGroupFeature, aBooleanFt) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Check results -#========================================================================= +# ========================================================================= aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(aGroupFeature)) -assert(aSelectionListAttr.size() == 1) -assert(len(aGroupFeature.results()) > 0) +assert aFactory.validate(aGroupFeature) +assert aSelectionListAttr.size() == 1 +assert len(aGroupFeature.results()) > 0 aGroupResult = aGroupFeature.firstResult() -assert(aGroupResult) -assert(aGroupResult.shape()) -#========================================================================= +assert aGroupResult +assert aGroupResult.shape() +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroup1799.py b/src/CollectionPlugin/Test/TestGroup1799.py index 4fc7f0dfc..f76d43cb7 100644 --- a/src/CollectionPlugin/Test/TestGroup1799.py +++ b/src/CollectionPlugin/Test/TestGroup1799.py @@ -37,101 +37,260 @@ SketchLine_4 = Sketch_1.addLine(350, -250, 350, 1.720151798778602e-014) SketchLine_5 = Sketch_1.addLine(350, 1.720151798778602e-014, 350, 250) SketchLine_5.setName("SketchLine_7") SketchLine_5.result().setName("SketchLine_7") -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_1.startPoint() +) SketchLine_6 = Sketch_1.addLine(1.524660639134633e-014, 250, -350, 250) SketchLine_6.setName("SketchLine_5") SketchLine_6.result().setName("SketchLine_5") SketchLine_7 = Sketch_1.addLine(-350, 250, -350, 1.720151798778602e-014) SketchLine_7.setName("SketchLine_6") SketchLine_7.result().setName("SketchLine_6") -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_8 = Sketch_1.addLine(1.524660628546721e-014, -250, 350, -250) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_8.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(0, 0, 101.5814068355669) SketchPoint_1 = Sketch_1.addPoint(1.524660639134633e-014, 250) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.endPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_1.endPoint() +) SketchPoint_2 = Sketch_1.addPoint(-350, 1.720151798778602e-014) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_2.startPoint() +) SketchPoint_3 = Sketch_1.addPoint(1.524660628546721e-014, -250) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_3.endPoint() +) SketchPoint_4 = Sketch_1.addPoint(101.5814068355669, 1.720151798778602e-014) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchCircle_1.results()[1] +) SketchPoint_5 = Sketch_1.addPoint(-101.5814068355669, 1.720151798778602e-014) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchPoint_5.coordinates(), SketchCircle_1.results()[1] +) SketchPoint_6 = Sketch_1.addPoint(1.524660639134633e-014, 101.5814068355669) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchCircle_1.results()[1] +) SketchPoint_7 = Sketch_1.addPoint(1.524660628546721e-014, -101.5814068355669) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchPoint_7.coordinates(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchPoint_7.coordinates(), SketchCircle_1.results()[1] +) SketchPoint_8 = Sketch_1.addPoint(350, 1.720151798778602e-014) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchPoint_8.coordinates(), SketchLine_4.endPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_6.startPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_1.result(), SketchLine_6.result()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_2.startPoint()) -#SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_7.result()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintParallel_3 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_5.result()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_8.startPoint()) -SketchConstraintParallel_4 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_8.result()) -SketchLine_9 = Sketch_1.addLine(1.524660639134633e-014, 250, 1.524660639134633e-014, 101.5814068355669) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_9.endPoint()) -SketchLine_10 = Sketch_1.addLine(-101.5814068355669, 1.720151798778602e-014, -350, 1.720151798778602e-014) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_10.endPoint()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_10.endPoint()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_10.endPoint()) -SketchLine_11 = Sketch_1.addLine(1.524660628546721e-014, -250, 1.524660628546721e-014, -101.5814068355669) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchPoint_7.coordinates(), SketchLine_11.endPoint()) -SketchLine_12 = Sketch_1.addLine(350, 1.720151798778602e-014, 101.5814068355669, 1.720151798778602e-014) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchPoint_8.coordinates(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchPoint_8.coordinates(), SketchLine_4.endPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_1.result(), SketchLine_6.result() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_2.startPoint() +) +# SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_7.result()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintParallel_3 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_5.result() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintParallel_4 = Sketch_1.setParallel( + SketchLine_3.result(), SketchLine_8.result() +) +SketchLine_9 = Sketch_1.addLine( + 1.524660639134633e-014, 250, 1.524660639134633e-014, 101.5814068355669 +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_9.endPoint() +) +SketchLine_10 = Sketch_1.addLine( + -101.5814068355669, 1.720151798778602e-014, -350, 1.720151798778602e-014 +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchPoint_5.coordinates(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_10.endPoint() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_10.endPoint() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_10.endPoint() +) +SketchLine_11 = Sketch_1.addLine( + 1.524660628546721e-014, -250, 1.524660628546721e-014, -101.5814068355669 +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_8.startPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchPoint_7.coordinates(), SketchLine_11.endPoint() +) +SketchLine_12 = Sketch_1.addLine( + 350, 1.720151798778602e-014, 101.5814068355669, 1.720151798778602e-014 +) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchPoint_8.coordinates(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_12.startPoint() +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_11.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_10.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_12.result()) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchLine_9.result(), SketchLine_11.endPoint()) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchLine_10.result(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_12.endPoint()) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchLine_9.result(), SketchLine_11.endPoint() +) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchLine_10.result(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_12.endPoint() +) SketchPoint_9 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchPoint_9.coordinates()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_6.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_8.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_10.result(), SketchLine_12.result()) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchPoint_9.coordinates() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_6.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_8.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_10.result(), SketchLine_12.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_6.result(), 350) 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()) +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-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&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")]) +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&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() # check that group contains only 4 faces selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 4) +assert selectionList.size() == 4 aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) +assert aFactory.validate(Group_1.feature()) # move group to the end: it must be recomputed, faces are splitted Part_1_doc.moveFeature(Group_1.feature(), Partition_2.feature()) model.end() # check that number of faces becomes 4*4=16 and Group is valid -assert(selectionList.size() == 16) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 16 +assert aFactory.validate(Group_1.feature()) diff --git a/src/CollectionPlugin/Test/TestGroup2.py b/src/CollectionPlugin/Test/TestGroup2.py index 70011c2f8..4465ddd8f 100644 --- a/src/CollectionPlugin/Test/TestGroup2.py +++ b/src/CollectionPlugin/Test/TestGroup2.py @@ -31,58 +31,134 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() param_p = model.addParameter(Part_1_doc, "r", "15") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchArc_1 = Sketch_1.addArc(7.5, 7.5, 22.5, 7.499992770095306, 7.499999582962127, 22.5, False) +SketchArc_1 = Sketch_1.addArc( + 7.5, 7.5, 22.5, 7.499992770095306, 7.499999582962127, 22.5, False +) SketchLine_1 = Sketch_1.addLine(7.499999582962127, 22.5, 7.499999582962127, 52.5) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.startPoint() +) SketchLine_2 = Sketch_1.addLine(22.5, 7.499992770095306, 52.5, 7.499992770095306) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint()) -SketchArc_2 = Sketch_1.addArc(7.5, 7.5, 52.5, 7.499992770095306, 7.499999582962127, 52.5, False) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.center(), SketchArc_2.center()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_1.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_2.startPoint() +) +SketchArc_2 = Sketch_1.addArc( + 7.5, 7.5, 52.5, 7.499992770095306, 7.499999582962127, 52.5, False +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchArc_2.center() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_1.endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), "r*2") -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "r") SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], "3*r") -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_2.center(), "r/2") -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_1.center(), "r/2") +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_2.center(), "r/2" +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_1.center(), "r/2" +) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchArc_2_2f-SketchLine_1r-SketchArc_1_2r")]) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchArc_2_2f-SketchLine_1r-SketchArc_1_2r")) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_2f-SketchArc_2_2f-SketchLine_1r-SketchArc_1_2r", + ) + ], +) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_2f-SketchArc_2_2f-SketchLine_1r-SketchArc_1_2r", + ), +) SketchCircle_1 = Sketch_2.addCircle(27.71638597484288, 11.4805029721516, 3) SketchCircle_2 = Sketch_2.addCircle(45.03912720992525, 18.6558173277981, 3) SketchLine_3 = Sketch_2.addLine(0, 0, 45.03912720992525, 18.6558173277981) SketchLine_3.setAuxiliary(True) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_3.startPoint(), SketchPoint_2.result()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchCircle_2.center(), SketchLine_3.endPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_3.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_3.startPoint(), SketchPoint_2.result() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchCircle_2.center(), SketchLine_3.endPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_3.result(), SketchCircle_1.center() +) SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_1.results()[1], "r/5") SketchConstraintRadius_4 = Sketch_2.setRadius(SketchCircle_2.results()[1], "r/5") -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchLine_3.startPoint(), SketchCircle_1.center(), "2*r", True) -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_3.endPoint(), "r*1.25", True) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchLine_3.startPoint(), SketchCircle_1.center(), "2*r", True +) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_3.endPoint(), "r*1.25", True +) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_4 = SketchProjection_3.createdFeature() -SketchConstraintAngle_1 = Sketch_2.setAngle(SketchLine_4.result(), SketchLine_3.result(), "r*1.5") +SketchConstraintAngle_1 = Sketch_2.setAngle( + SketchLine_4.result(), SketchLine_3.result(), "r*1.5" +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "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.-r*3", 2) -Cut_1 = model.addCut(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("COMPOUND", "AngularCopy_1_1")]) -Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchArc_1_2")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "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.-r*3", + 2, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + [model.selection("COMPOUND", "AngularCopy_1_1")], +) +Group_1 = model.addGroup( + Part_1_doc, + [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchArc_1_2")], +) Group_1.setName("edge_int") Group_1.result().setName("edge_int") -Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_2")]) +Group_2 = model.addGroup( + Part_1_doc, + [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_2")], +) Group_2.setName("edge_bottom") Group_2.result().setName("edge_bottom") -Group_3 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_1")]) +Group_3 = model.addGroup( + Part_1_doc, + [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_1")], +) Group_3.setName("edge_left") Group_3.result().setName("edge_left") -Group_4 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchArc_2_2")]) +Group_4 = model.addGroup( + Part_1_doc, + [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchArc_2_2")], +) Group_4.setName("edge_ext") Group_4.result().setName("edge_ext") model.do() @@ -94,16 +170,16 @@ model.end() aFactory = ModelAPI_Session.get().validators() for group in [Group_1, Group_4]: - assert(aFactory.validate(group.feature())) - selectionList = group.feature().selectionList("group_list") - assert(selectionList.size() == 1) - assert(group.groupList().value(0).value().shapeType() == GeomAPI_Shape.EDGE) + assert aFactory.validate(group.feature()) + selectionList = group.feature().selectionList("group_list") + assert selectionList.size() == 1 + assert group.groupList().value(0).value().shapeType() == GeomAPI_Shape.EDGE for group in [Group_2, Group_3]: - assert(aFactory.validate(group.feature())) - selectionList = group.feature().selectionList("group_list") - assert(selectionList.size() == 2) - assert(group.groupList().value(0).value().shapeType() == GeomAPI_Shape.EDGE) - assert(group.groupList().value(1).value().shapeType() == GeomAPI_Shape.EDGE) + assert aFactory.validate(group.feature()) + selectionList = group.feature().selectionList("group_list") + assert selectionList.size() == 2 + assert group.groupList().value(0).value().shapeType() == GeomAPI_Shape.EDGE + assert group.groupList().value(1).value().shapeType() == GeomAPI_Shape.EDGE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupAddition.py b/src/CollectionPlugin/Test/TestGroupAddition.py index e1ac8f19d..837b363bf 100644 --- a/src/CollectionPlugin/Test/TestGroupAddition.py +++ b/src/CollectionPlugin/Test/TestGroupAddition.py @@ -24,9 +24,18 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")]) -Group_2 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")]) -GroupAddition_1 = model.addGroupAddition(Part_1_doc, [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")]) +Group_1 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")], +) +Group_2 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")], +) +GroupAddition_1 = model.addGroupAddition( + Part_1_doc, + [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")], +) model.end() from GeomAPI import * @@ -39,4 +48,4 @@ model.testNbSubShapes(GroupAddition_1, GeomAPI_Shape.EDGE, [12]) model.testNbSubShapes(GroupAddition_1, GeomAPI_Shape.VERTEX, [24]) model.testResultsAreas(GroupAddition_1, [300]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupAddition_Error.py b/src/CollectionPlugin/Test/TestGroupAddition_Error.py index cd3592fdc..c1f737e3c 100644 --- a/src/CollectionPlugin/Test/TestGroupAddition_Error.py +++ b/src/CollectionPlugin/Test/TestGroupAddition_Error.py @@ -24,10 +24,25 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")]) -Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]")]) -GroupAddition_1 = model.addGroupAddition(Part_1_doc, [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")]) -GroupAddition_2 = model.addGroupAddition(Part_1_doc, [model.selection("COMPOUND", "Group_1"), model.selection("FACE", "Box_1_1/Front")]) +Group_1 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")], +) +Group_2 = model.addGroup( + Part_1_doc, + [ + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + ], +) +GroupAddition_1 = model.addGroupAddition( + Part_1_doc, + [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")], +) +GroupAddition_2 = model.addGroupAddition( + Part_1_doc, + [model.selection("COMPOUND", "Group_1"), model.selection("FACE", "Box_1_1/Front")], +) model.end() -assert(GroupAddition_1.feature().error() != "") +assert GroupAddition_1.feature().error() != "" diff --git a/src/CollectionPlugin/Test/TestGroupIntersection.py b/src/CollectionPlugin/Test/TestGroupIntersection.py index 0d5e7a4e8..51b9aa34f 100644 --- a/src/CollectionPlugin/Test/TestGroupIntersection.py +++ b/src/CollectionPlugin/Test/TestGroupIntersection.py @@ -24,12 +24,28 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")]) -Group_2 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")]) -Group_3_objects = [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Right"), model.selection("FACE", "Box_1_1/Top")] +Group_1 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")], +) +Group_2 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")], +) +Group_3_objects = [ + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Right"), + model.selection("FACE", "Box_1_1/Top"), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -GroupIntersection_1_objects = [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2"), model.selection("COMPOUND", "Group_3")] -GroupIntersection_1 = model.addGroupIntersection(Part_1_doc, GroupIntersection_1_objects) +GroupIntersection_1_objects = [ + model.selection("COMPOUND", "Group_1"), + model.selection("COMPOUND", "Group_2"), + model.selection("COMPOUND", "Group_3"), +] +GroupIntersection_1 = model.addGroupIntersection( + Part_1_doc, GroupIntersection_1_objects +) model.end() from GeomAPI import * @@ -42,4 +58,4 @@ model.testNbSubShapes(GroupIntersection_1, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(GroupIntersection_1, GeomAPI_Shape.VERTEX, [8]) model.testResultsAreas(GroupIntersection_1, [100]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupIntersection_Error.py b/src/CollectionPlugin/Test/TestGroupIntersection_Error.py index b3dcb362b..251322408 100644 --- a/src/CollectionPlugin/Test/TestGroupIntersection_Error.py +++ b/src/CollectionPlugin/Test/TestGroupIntersection_Error.py @@ -24,11 +24,29 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")]) -Group_2 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")]) -Group_3 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Right")]) -GroupIntersection_1_objects = [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2"), model.selection("COMPOUND", "Group_3")] -GroupIntersection_1 = model.addGroupIntersection(Part_1_doc, GroupIntersection_1_objects) +Group_1 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")], +) +Group_2 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")], +) +Group_3 = model.addGroup( + Part_1_doc, + [ + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Right"), + ], +) +GroupIntersection_1_objects = [ + model.selection("COMPOUND", "Group_1"), + model.selection("COMPOUND", "Group_2"), + model.selection("COMPOUND", "Group_3"), +] +GroupIntersection_1 = model.addGroupIntersection( + Part_1_doc, GroupIntersection_1_objects +) model.end() -assert(GroupIntersection_1.feature().error() != "") +assert GroupIntersection_1.feature().error() != "" diff --git a/src/CollectionPlugin/Test/TestGroupMove01.py b/src/CollectionPlugin/Test/TestGroupMove01.py index 14052c8b8..d08620a1b 100644 --- a/src/CollectionPlugin/Test/TestGroupMove01.py +++ b/src/CollectionPlugin/Test/TestGroupMove01.py @@ -29,9 +29,16 @@ 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]")]) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")]) +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 Part_1_doc.moveFeature(Group_1.feature(), Partition_1.feature()) @@ -41,9 +48,9 @@ model.end() # Check groups aFactory = ModelAPI_Session.get().validators() selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 2) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 2 +assert aFactory.validate(Group_1.feature()) selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 1 +assert aFactory.validate(Group_2.feature()) diff --git a/src/CollectionPlugin/Test/TestGroupMove02.py b/src/CollectionPlugin/Test/TestGroupMove02.py index 28f0691d9..2ee58b7b2 100644 --- a/src/CollectionPlugin/Test/TestGroupMove02.py +++ b/src/CollectionPlugin/Test/TestGroupMove02.py @@ -27,10 +27,22 @@ 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]")]) -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")) +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")]) model.do() # move group @@ -40,5 +52,5 @@ model.end() # Check group aFactory = ModelAPI_Session.get().validators() selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 0) -assert(aFactory.validate(Group_1.feature()) == False) +assert selectionList.size() == 0 +assert aFactory.validate(Group_1.feature()) == False diff --git a/src/CollectionPlugin/Test/TestGroupMove03.py b/src/CollectionPlugin/Test/TestGroupMove03.py index 3c7393fa6..fb7b76f8a 100644 --- a/src/CollectionPlugin/Test/TestGroupMove03.py +++ b/src/CollectionPlugin/Test/TestGroupMove03.py @@ -31,30 +31,58 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) -SketchArc_1 = Sketch_1.addArc(-1.103476974288834e-12, 24.99999999999979, 24.49489742783218, 30, 0, 50, False) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchArc_1 = Sketch_1.addArc( + -1.103476974288834e-12, 24.99999999999979, 24.49489742783218, 30, 0, 50, False +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 50, -10, 50) SketchLine_2.setAuxiliary(True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_2.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_2.result()) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_2.result() +) SketchLine_3 = Sketch_1.addLine(24.49489742783218, 30, 24.49489742783218, 5) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(24.49489742783218, 5, 34.49489742783218, 5) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(34.49489742783218, 5, 34.49489742783218, 0) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_5 = 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_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.result() +) SketchLine_7 = Sketch_1.addLine(34.49489742783218, 0, 0, 0) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint() +) SketchLine_8 = Sketch_1.addLine(0, 50, 0, 0) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.endPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result()) @@ -65,9 +93,27 @@ SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 50) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_2.result(), 10) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 25) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchLine_8f-SketchLine_7r-SketchLine_5r-SketchLine_4r-SketchLine_3r")], model.selection("EDGE", "PartSet/OZ"), 360, 0) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3")]) -Partition_1_objects = [model.selection("SOLID", "Revolution_1_1"), model.selection("FACE", "PartSet/XOZ"), model.selection("FACE", "PartSet/YOZ")] +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchArc_1_2r-SketchLine_8f-SketchLine_7r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], + model.selection("EDGE", "PartSet/OZ"), + 360, + 0, +) +Group_1 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3")], +) +Partition_1_objects = [ + model.selection("SOLID", "Revolution_1_1"), + model.selection("FACE", "PartSet/XOZ"), + model.selection("FACE", "PartSet/YOZ"), +] Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects) model.do() @@ -78,9 +124,9 @@ model.end() # Check group: result must be four faces aFactory = ModelAPI_Session.get().validators() selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 4) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 4 +assert aFactory.validate(Group_1.feature()) for i in range(4): - assert(Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE) + assert Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove04.py b/src/CollectionPlugin/Test/TestGroupMove04.py index 97ac16049..fc346cf97 100644 --- a/src/CollectionPlugin/Test/TestGroupMove04.py +++ b/src/CollectionPlugin/Test/TestGroupMove04.py @@ -30,19 +30,51 @@ 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(-4.602216748768477, 10.94581280788177, 9.660420057801511) +SketchCircle_1 = Sketch_1.addCircle( + -4.602216748768477, 10.94581280788177, 9.660420057801511 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], + model.selection(), + 10, + 0, +) +Group_1 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2")], +) Group_2 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")]) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 1, True) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchCircle_2 = Sketch_2.addCircle(-5.643073116097736, 11.91382008305256, 15.03576198961618) +SketchCircle_2 = Sketch_2.addCircle( + -5.643073116097736, 11.91382008305256, 15.03576198961618 +) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r")], model.selection(), 2, -4) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1")]) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("COMPOUND", "Cut_1_1"), model.selection("FACE", "Plane_1")]) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPSOLID", "Partition_1_2")]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r")], + model.selection(), + 2, + -4, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + [model.selection("SOLID", "Extrusion_2_1")], +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("COMPOUND", "Cut_1_1"), model.selection("FACE", "Plane_1")], +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPSOLID", "Partition_1_2"), + ], +) model.do() # move groups to the end Part_1_doc.moveFeature(Group_1.feature(), Compound_1.feature()) @@ -52,12 +84,12 @@ model.end() aFactory = ModelAPI_Session.get().validators() # check group 1: cylindical face is divided to 6 (because of seam edge) selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 6) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 6 +assert aFactory.validate(Group_1.feature()) # check group 2: solid is divided to 4 solids selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 4) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 4 +assert aFactory.validate(Group_2.feature()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove05.py b/src/CollectionPlugin/Test/TestGroupMove05.py index 6793f5b89..e830a36a6 100644 --- a/src/CollectionPlugin/Test/TestGroupMove05.py +++ b/src/CollectionPlugin/Test/TestGroupMove05.py @@ -29,11 +29,37 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Box_1_1")]) -Group_2_objects = [model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Right"), model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Bottom"), model.selection("FACE", "Box_1_1/Front")] +Group_2_objects = [ + model.selection("FACE", "Box_1_1/Back"), + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Right"), + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Bottom"), + model.selection("FACE", "Box_1_1/Front"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")] +Group_3_objects = [ + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 15, 2) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 15, + 2, +) model.do() # move groups to the end Part_1_doc.moveFeature(Group_1.feature(), LinearCopy_1.feature()) @@ -46,19 +72,28 @@ from ModelAPI import * aFactory = ModelAPI_Session.get().validators() # check group 1: all solids in compound should be selected selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 2) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 2 +assert aFactory.validate(Group_1.feature()) # check group 2: number of faces is multiplied twice than original selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 12) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 12 +assert aFactory.validate(Group_2.feature()) # check group 3: number of edges is multiplied twice than original selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 24) -assert(aFactory.validate(Group_3.feature())) +assert selectionList.size() == 24 +assert aFactory.validate(Group_3.feature()) model.begin() -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 15, 2, model.selection("EDGE", "PartSet/OZ"), 15, 2) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 15, + 2, + model.selection("EDGE", "PartSet/OZ"), + 15, + 2, +) # move groups to the end Part_1_doc.moveFeature(Group_1.feature(), LinearCopy_2.feature()) Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) @@ -67,19 +102,27 @@ model.end() # check group 1: all solids in compound should be selected selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 8) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 8 +assert aFactory.validate(Group_1.feature()) # check group 2: number of faces is multiplied twice than original selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 48) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 48 +assert aFactory.validate(Group_2.feature()) # check group 3: number of edges is multiplied twice than original selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 96) -assert(aFactory.validate(Group_3.feature())) +assert selectionList.size() == 96 +assert aFactory.validate(Group_3.feature()) model.begin() -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "LinearCopy_2_1_1_1"), model.selection("SOLID", "LinearCopy_2_1_1_2")], model.selection("EDGE", "PartSet/OZ"), 2) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [ + model.selection("SOLID", "LinearCopy_2_1_1_1"), + model.selection("SOLID", "LinearCopy_2_1_1_2"), + ], + model.selection("EDGE", "PartSet/OZ"), + 2, +) # move groups to the end Part_1_doc.moveFeature(Group_1.feature(), AngularCopy_1.feature()) Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) @@ -88,15 +131,15 @@ model.end() # check group 1: all solids in compound should be selected selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 4) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 4 +assert aFactory.validate(Group_1.feature()) # check group 2: number of faces is multiplied twice than original selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 24) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 24 +assert aFactory.validate(Group_2.feature()) # check group 3: number of edges is multiplied twice than original selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 48) -assert(aFactory.validate(Group_3.feature())) +assert selectionList.size() == 48 +assert aFactory.validate(Group_3.feature()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove06.py b/src/CollectionPlugin/Test/TestGroupMove06.py index 914e2c3ed..41d9479fc 100644 --- a/src/CollectionPlugin/Test/TestGroupMove06.py +++ b/src/CollectionPlugin/Test/TestGroupMove06.py @@ -29,20 +29,150 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -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]")) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "Axis_1"), 10, 2) +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]"), +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "Axis_1"), + 10, + 2, +) Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_1")]) -Group_2_objects = [model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Back"), model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Top"), model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Right"), model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Left"), model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom"), model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Front")] +Group_2_objects = [ + model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Back"), + model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Top"), + model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Right"), + model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Left"), + model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom"), + model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Front"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]")] +Group_3_objects = [ + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) Group_4 = model.addGroup(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_2")]) -Group_5_objects = [model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Back"), model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Top"), model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Right"), model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Left"), model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom"), model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Front")] +Group_5_objects = [ + model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Back"), + model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Top"), + model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Right"), + model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Left"), + model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom"), + model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Front"), +] Group_5 = model.addGroup(Part_1_doc, Group_5_objects) -Group_6_objects = [model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Right]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Left]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Right][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Left][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Left][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Right][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Left]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Right]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]")] +Group_6_objects = [ + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Right]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Left]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Right][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Left][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Left][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Right][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Left]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Right]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]", + ), +] Group_6 = model.addGroup(Part_1_doc, Group_6_objects) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Left"), model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Right")) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_1")], [model.selection("SOLID", "LinearCopy_1_1_2"), model.selection("FACE", "Plane_1")]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Left"), + model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Right"), +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "LinearCopy_1_1_1")], + [model.selection("SOLID", "LinearCopy_1_1_2"), model.selection("FACE", "Plane_1")], +) model.do() # move groups to the end Part_1_doc.moveFeature(Group_1.feature(), Split_1.feature()) @@ -59,34 +189,49 @@ aFactory = ModelAPI_Session.get().validators() # groups related to original box should be split selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 3) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 3 +assert aFactory.validate(Group_1.feature()) selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 13) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 13 +assert aFactory.validate(Group_2.feature()) selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 19) -assert(aFactory.validate(Group_3.feature())) +assert selectionList.size() == 19 +assert aFactory.validate(Group_3.feature()) # groups related to the copied box should contain only the elements connected with the original box selectionList = Group_4.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_4.feature())) +assert selectionList.size() == 1 +assert aFactory.validate(Group_4.feature()) selectionList = Group_5.feature().selectionList("group_list") -assert(selectionList.size() == 3) -assert(aFactory.validate(Group_5.feature())) +assert selectionList.size() == 3 +assert aFactory.validate(Group_5.feature()) selectionList = Group_6.feature().selectionList("group_list") -assert(selectionList.size() == 3) -assert(aFactory.validate(Group_6.feature())) +assert selectionList.size() == 3 +assert aFactory.validate(Group_6.feature()) model.begin() -Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Split_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"), model.selection("EDGE", "[Split_1_1_2/Modified_Face&Box_1_1/Right][(Split_1_1_2/Modified_Face&Box_1_1/Right)(Split_1_1_2/Modified_Face&Plane_1/Plane_1)(Split_1_1_2/Modified_Face&Box_1_1/Front)(Split_1_1_2/Modified_Face&Box_1_1/Top)2(Split_1_1_2/Modified_Face&Box_1_1/Left)2]")]) -Split_2 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Split_1_1_2")], [model.selection("FACE", "Filling_1_1")]) +Filling_1 = model.addFilling( + Part_1_doc, + [ + model.selection( + "EDGE", "Split_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top" + ), + model.selection( + "EDGE", + "[Split_1_1_2/Modified_Face&Box_1_1/Right][(Split_1_1_2/Modified_Face&Box_1_1/Right)(Split_1_1_2/Modified_Face&Plane_1/Plane_1)(Split_1_1_2/Modified_Face&Box_1_1/Front)(Split_1_1_2/Modified_Face&Box_1_1/Top)2(Split_1_1_2/Modified_Face&Box_1_1/Left)2]", + ), + ], +) +Split_2 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Split_1_1_2")], + [model.selection("FACE", "Filling_1_1")], +) model.do() # move groups to the end once again Part_1_doc.moveFeature(Group_1.feature(), Split_2.feature()) @@ -99,29 +244,29 @@ model.end() # groups related to original box should be split selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 4) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 4 +assert aFactory.validate(Group_1.feature()) selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 16) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 16 +assert aFactory.validate(Group_2.feature()) selectionList = Group_3.feature().selectionList("group_list") # one of edges should disappear, due to its belonging to the face of the filling -assert(selectionList.size() == 18) -assert(aFactory.validate(Group_3.feature())) +assert selectionList.size() == 18 +assert aFactory.validate(Group_3.feature()) # groups related to the copied box should be split correspondingly selectionList = Group_4.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_4.feature())) +assert selectionList.size() == 1 +assert aFactory.validate(Group_4.feature()) selectionList = Group_5.feature().selectionList("group_list") -assert(selectionList.size() == 6) -assert(aFactory.validate(Group_5.feature())) +assert selectionList.size() == 6 +assert aFactory.validate(Group_5.feature()) selectionList = Group_6.feature().selectionList("group_list") -assert(selectionList.size() == 5) -assert(aFactory.validate(Group_6.feature())) +assert selectionList.size() == 5 +assert aFactory.validate(Group_6.feature()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove07.py b/src/CollectionPlugin/Test/TestGroupMove07.py index 98d67b3ae..366a7d8d6 100644 --- a/src/CollectionPlugin/Test/TestGroupMove07.py +++ b/src/CollectionPlugin/Test/TestGroupMove07.py @@ -29,11 +29,36 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Box_1_1")]) -Group_2_objects = [model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Right"), model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Bottom"), model.selection("FACE", "Box_1_1/Front")] +Group_2_objects = [ + model.selection("FACE", "Box_1_1/Back"), + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Right"), + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Bottom"), + model.selection("FACE", "Box_1_1/Front"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")] +Group_3_objects = [ + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("FACE", "Box_1_1/Left"), False) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("FACE", "Box_1_1/Left"), + False, +) model.do() # move groups to the end Part_1_doc.moveFeature(Group_1.feature(), Symmetry_1.feature()) @@ -46,19 +71,27 @@ from ModelAPI import * aFactory = ModelAPI_Session.get().validators() # check group 1: solids should be selected selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 1 +assert aFactory.validate(Group_1.feature()) # check group 2: number of faces is the same selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 6) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 6 +assert aFactory.validate(Group_2.feature()) # check group 3: number of edges is the same selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 12) -assert(aFactory.validate(Group_3.feature())) +assert selectionList.size() == 12 +assert aFactory.validate(Group_3.feature()) model.begin() -Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_1_1")], model.selection("VERTEX", "[Symmetry_1_1/MF:Symmetried&Box_1_1/Front][Symmetry_1_1/MF:Symmetried&Box_1_1/Left][Symmetry_1_1/MF:Symmetried&Box_1_1/Bottom]"), True) +Symmetry_2 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Symmetry_1_1")], + model.selection( + "VERTEX", + "[Symmetry_1_1/MF:Symmetried&Box_1_1/Front][Symmetry_1_1/MF:Symmetried&Box_1_1/Left][Symmetry_1_1/MF:Symmetried&Box_1_1/Bottom]", + ), + True, +) model.do() # move groups to the end Part_1_doc.moveFeature(Group_1.feature(), Symmetry_2.feature()) @@ -68,15 +101,15 @@ model.end() # check group 1: all solids in compound should be selected selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 2) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 2 +assert aFactory.validate(Group_1.feature()) # check group 2: number of faces is multiplied twice than original selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 12) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 12 +assert aFactory.validate(Group_2.feature()) # check group 3: number of edges is multiplied twice than original selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 24) -assert(aFactory.validate(Group_3.feature())) +assert selectionList.size() == 24 +assert aFactory.validate(Group_3.feature()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove08.py b/src/CollectionPlugin/Test/TestGroupMove08.py index 95b904730..f6abc8a3d 100644 --- a/src/CollectionPlugin/Test/TestGroupMove08.py +++ b/src/CollectionPlugin/Test/TestGroupMove08.py @@ -29,17 +29,56 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Box_1_1")]) -Group_2_objects = [model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Right"), model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Bottom"), model.selection("FACE", "Box_1_1/Front")] +Group_2_objects = [ + model.selection("FACE", "Box_1_1/Back"), + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Right"), + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Bottom"), + model.selection("FACE", "Box_1_1/Front"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")] +Group_3_objects = [ + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "PartSet/OZ"), 5, 10) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) Group_4 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")]) -Group_5_objects = [model.selection("FACE", "Cylinder_1_1/Face_1"), model.selection("FACE", "Cylinder_1_1/Face_2"), model.selection("FACE", "Cylinder_1_1/Face_3")] +Group_5_objects = [ + model.selection("FACE", "Cylinder_1_1/Face_1"), + model.selection("FACE", "Cylinder_1_1/Face_2"), + model.selection("FACE", "Cylinder_1_1/Face_3"), +] Group_5 = model.addGroup(Part_1_doc, Group_5_objects) -Group_6_objects = [model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]"), model.selection("EDGE", "([Cylinder_1_1/Face_1][Cylinder_1_1/Face_2])([Cylinder_1_1/Face_1][Cylinder_1_1/Face_3])")] +Group_6_objects = [ + model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), + model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]"), + model.selection( + "EDGE", + "([Cylinder_1_1/Face_1][Cylinder_1_1/Face_2])([Cylinder_1_1/Face_1][Cylinder_1_1/Face_3])", + ), +] Group_6 = model.addGroup(Part_1_doc, Group_6_objects) -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")], 2) +Fillet_1 = model.addFillet( + Part_1_doc, [model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")], 2 +) model.do() # move groups to the end Part_1_doc.moveFeature(Group_1.feature(), Fillet_1.feature()) @@ -53,19 +92,21 @@ aFactory = ModelAPI_Session.get().validators() # groups related to original box should be split selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 1 +assert aFactory.validate(Group_1.feature()) selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 6) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 6 +assert aFactory.validate(Group_2.feature()) selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 11) -assert(aFactory.validate(Group_3.feature())) +assert selectionList.size() == 11 +assert aFactory.validate(Group_3.feature()) model.begin() -Fillet_2 = model.addFillet(Part_1_doc, [model.selection("FACE", "Cylinder_1_1/Face_2")], 2) +Fillet_2 = model.addFillet( + Part_1_doc, [model.selection("FACE", "Cylinder_1_1/Face_2")], 2 +) model.do() # move groups to the end Part_1_doc.moveFeature(Group_4.feature(), Fillet_2.feature()) @@ -75,19 +116,29 @@ model.end() # groups related to original cylinder should be split selectionList = Group_4.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_4.feature())) +assert selectionList.size() == 1 +assert aFactory.validate(Group_4.feature()) selectionList = Group_5.feature().selectionList("group_list") -assert(selectionList.size() == 3) -assert(aFactory.validate(Group_5.feature())) +assert selectionList.size() == 3 +assert aFactory.validate(Group_5.feature()) selectionList = Group_6.feature().selectionList("group_list") -assert(selectionList.size() == 2) # edge selected for the fillet become removed -assert(aFactory.validate(Group_6.feature())) +assert selectionList.size() == 2 # edge selected for the fillet become removed +assert aFactory.validate(Group_6.feature()) model.begin() -Fillet_3 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Fillet_1_1/MF:Fillet&Box_1_1/Front][Fillet_1_1/MF:Fillet&Box_1_1/Left]")], 1, 2) +Fillet_3 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Fillet_1_1/MF:Fillet&Box_1_1/Front][Fillet_1_1/MF:Fillet&Box_1_1/Left]", + ) + ], + 1, + 2, +) model.do() # move groups to the end Part_1_doc.moveFeature(Group_1.feature(), Fillet_3.feature()) @@ -100,28 +151,28 @@ model.end() # groups related to original box should be split selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 1 +assert aFactory.validate(Group_1.feature()) selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 6) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 6 +assert aFactory.validate(Group_2.feature()) selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 9) -assert(aFactory.validate(Group_3.feature())) +assert selectionList.size() == 9 +assert aFactory.validate(Group_3.feature()) # groups related to original cylinder should stay untouched selectionList = Group_4.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_4.feature())) +assert selectionList.size() == 1 +assert aFactory.validate(Group_4.feature()) selectionList = Group_5.feature().selectionList("group_list") -assert(selectionList.size() == 3) -assert(aFactory.validate(Group_5.feature())) +assert selectionList.size() == 3 +assert aFactory.validate(Group_5.feature()) selectionList = Group_6.feature().selectionList("group_list") -assert(selectionList.size() == 2) -assert(aFactory.validate(Group_6.feature())) +assert selectionList.size() == 2 +assert aFactory.validate(Group_6.feature()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove09.py b/src/CollectionPlugin/Test/TestGroupMove09.py index 3e0d56993..af14525e0 100644 --- a/src/CollectionPlugin/Test/TestGroupMove09.py +++ b/src/CollectionPlugin/Test/TestGroupMove09.py @@ -28,16 +28,163 @@ 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("SOLID", "Cylinder_1_1"), model.selection("SOLID", "Box_1_1")]) -Union_1_objects = [model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Partition_1_1_2"), model.selection("SOLID", "Partition_1_1_3")] +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("SOLID", "Box_1_1")], +) +Union_1_objects = [ + model.selection("SOLID", "Partition_1_1_1"), + model.selection("SOLID", "Partition_1_1_2"), + model.selection("SOLID", "Partition_1_1_3"), +] Union_1 = model.addUnion(Part_1_doc, Union_1_objects) Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Union_1_1")]) -Group_2_objects = [model.selection("FACE", "Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1"), model.selection("FACE", "Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2"), model.selection("FACE", "Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2"), model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Back"), model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Top"), model.selection("FACE", "Box_1_1/Right"), model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Left"), model.selection("FACE", "Box_1_1/Front")] +Group_2_objects = [ + model.selection("FACE", "Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1"), + model.selection("FACE", "Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2"), + model.selection("FACE", "Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3"), + model.selection( + "FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3" + ), + model.selection( + "FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2" + ), + model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Back"), + model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Bottom"), + model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Right"), + model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Front"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3]"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1]"), model.selection("EDGE", "([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3])(Partition_1_1_3/Generated_Edge&Box_1_1/Back&Cylinder_1_1/Face_1)([Partition_1_1_3/Modified_Face&Box_1_1/Back][Partition_1_1_3/Modified_Face&Box_1_1/Bottom])([Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3])_Union_1_1"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Back][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Back][Box_1_1/Right]"), model.selection("EDGE", "Partition_1_1_3/Generated_Edge&Box_1_1/Back&Cylinder_1_1/Face_1"), model.selection("EDGE", "([Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top])([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1])([Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Back])(Partition_1_1_3/Generated_Edge&Box_1_1/Back&Cylinder_1_1/Face_1)_Union_1_1"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Back]"), model.selection("EDGE", "([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left])([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3])([Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom])([Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3])_Union_1_1"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3]"), model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top]"), model.selection("EDGE", "([Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top])([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1])([Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Left])([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left])_Union_1_1"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Right][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Front]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Box_1_1/Front]")] +Group_3_objects = [ + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3]", + ), + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1]", + ), + model.selection( + "EDGE", + "([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3])(Partition_1_1_3/Generated_Edge&Box_1_1/Back&Cylinder_1_1/Face_1)([Partition_1_1_3/Modified_Face&Box_1_1/Back][Partition_1_1_3/Modified_Face&Box_1_1/Bottom])([Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3])_Union_1_1", + ), + model.selection( + "EDGE", + "[Partition_1_1_3/Modified_Face&Box_1_1/Back][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]", + ), + model.selection( + "EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Back][Box_1_1/Right]" + ), + model.selection( + "EDGE", "Partition_1_1_3/Generated_Edge&Box_1_1/Back&Cylinder_1_1/Face_1" + ), + model.selection( + "EDGE", + "([Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top])([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1])([Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Back])(Partition_1_1_3/Generated_Edge&Box_1_1/Back&Cylinder_1_1/Face_1)_Union_1_1", + ), + model.selection( + "EDGE", + "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Back]", + ), + model.selection( + "EDGE", + "([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left])([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3])([Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom])([Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3])_Union_1_1", + ), + model.selection( + "EDGE", + "[Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3]", + ), + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top]", + ), + model.selection( + "EDGE", + "([Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top])([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1])([Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Left])([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left])_Union_1_1", + ), + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left]", + ), + model.selection( + "EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Box_1_1/Right]" + ), + model.selection( + "EDGE", "[Box_1_1/Right][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]" + ), + model.selection( + "EDGE", + "[Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]", + ), + model.selection( + "EDGE", "[Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]" + ), + model.selection( + "EDGE", + "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Left]", + ), + model.selection( + "EDGE", "[Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]" + ), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Front]"), + model.selection( + "EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Box_1_1/Front]" + ), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Group_4_objects = [model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("VERTEX", "[Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "[_weak_name_10_Union_1_1]e[_weak_name_4_Union_1_1]e"), model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Box_1_1/Right][Box_1_1/Front]"), model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3][Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3]"), model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Back]"), model.selection("VERTEX", "[Box_1_1/Right][Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "[_weak_name_3_Union_1_1]e[_weak_name_9_Union_1_1]e"), model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Back][Box_1_1/Right]"), model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3][Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3]"), model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Back][Box_1_1/Right][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]")] +Group_4_objects = [ + model.selection( + "VERTEX", + "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]", + ), + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left]", + ), + model.selection( + "VERTEX", + "[Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]", + ), + model.selection("VERTEX", "[_weak_name_10_Union_1_1]e[_weak_name_4_Union_1_1]e"), + model.selection( + "VERTEX", + "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Box_1_1/Right][Box_1_1/Front]", + ), + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3][Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3]", + ), + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Back]", + ), + model.selection( + "VERTEX", + "[Box_1_1/Right][Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]", + ), + model.selection("VERTEX", "[_weak_name_3_Union_1_1]e[_weak_name_9_Union_1_1]e"), + model.selection( + "VERTEX", + "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Back][Box_1_1/Right]", + ), + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3][Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3]", + ), + model.selection( + "VERTEX", + "[Partition_1_1_3/Modified_Face&Box_1_1/Back][Box_1_1/Right][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]", + ), +] Group_4 = model.addGroup(Part_1_doc, Group_4_objects) FusionFaces_1 = model.addFusionFaces(Part_1_doc, model.selection("SOLID", "Union_1_1")) model.do() @@ -54,21 +201,21 @@ aFactory = ModelAPI_Session.get().validators() # number of solids should be the same selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 1 +assert aFactory.validate(Group_1.feature()) # same-plane faces should be merged selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 7) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 7 +assert aFactory.validate(Group_2.feature()) # shared edges of merged faces should be deleted selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 15) -assert(aFactory.validate(Group_3.feature())) +assert selectionList.size() == 15 +assert aFactory.validate(Group_3.feature()) selectionList = Group_4.feature().selectionList("group_list") -assert(selectionList.size() == 10) -assert(aFactory.validate(Group_4.feature())) +assert selectionList.size() == 10 +assert aFactory.validate(Group_4.feature()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove10.py b/src/CollectionPlugin/Test/TestGroupMove10.py index cab4c013b..eb6c0ac9f 100644 --- a/src/CollectionPlugin/Test/TestGroupMove10.py +++ b/src/CollectionPlugin/Test/TestGroupMove10.py @@ -30,30 +30,53 @@ SketchLine_1 = Sketch_1.addLine(40, 32, -5, 32) SketchLine_2 = Sketch_1.addLine(-5, 32, -5, 5) SketchLine_3 = Sketch_1.addLine(-5, 5, 40, 5) SketchLine_4 = Sketch_1.addLine(40, 5, 40, 32) -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()) +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) -Group_1_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_3")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Group_1_objects = [ + model.selection("SOLID", "Extrusion_1_1_2"), + model.selection("SOLID", "Extrusion_1_1_1"), + model.selection("SOLID", "Extrusion_1_1_3"), +] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) # to create groups of faces, edges and vertices model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.do() -Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPSOLID", "Extrusion_1_1")) -Remove_SubShapes_1.setSubShapesToRemove([model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3")]) +Remove_SubShapes_1 = model.addRemoveSubShapes( + Part_1_doc, model.selection("COMPSOLID", "Extrusion_1_1") +) +Remove_SubShapes_1.setSubShapesToRemove( + [ + model.selection("SOLID", "Extrusion_1_1_2"), + model.selection("SOLID", "Extrusion_1_1_3"), + ] +) model.do() # move groups to the end LastFeature = Remove_SubShapes_1.feature() for i in range(Part_1_doc.size("Groups")): - GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", 0))) # move always the very first group - Part_1_doc.moveFeature(GroupFeature, LastFeature) - LastFeature = GroupFeature + GroupFeature = Part_1_doc.feature( + objectToResult(Part_1_doc.object("Groups", 0)) + ) # move always the very first group + Part_1_doc.moveFeature(GroupFeature, LastFeature) + LastFeature = GroupFeature model.end() aFactory = ModelAPI_Session.get().validators() @@ -62,9 +85,9 @@ aFactory = ModelAPI_Session.get().validators() a = 0 num_in_groups = [1, 10, 15, 7] for i in range(Part_1_doc.size("Groups")): - GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", i))) - assert(aFactory.validate(GroupFeature)) - assert(GroupFeature.selectionList("group_list").size() == num_in_groups[a]) - a = a + 1 + GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", i))) + assert aFactory.validate(GroupFeature) + assert GroupFeature.selectionList("group_list").size() == num_in_groups[a] + a = a + 1 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove11.py b/src/CollectionPlugin/Test/TestGroupMove11.py index 83ca40a72..4b457e4aa 100644 --- a/src/CollectionPlugin/Test/TestGroupMove11.py +++ b/src/CollectionPlugin/Test/TestGroupMove11.py @@ -30,16 +30,237 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(-15, 30, 30) SketchCircle_2 = Sketch_1.addCircle(15, 25, 25) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Group_1_objects = [model.selection("SOLID", "Extrusion_1_1_3"), model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Group_1_objects = [ + model.selection("SOLID", "Extrusion_1_1_3"), + model.selection("SOLID", "Extrusion_1_1_1"), + model.selection("SOLID", "Extrusion_1_1_2"), +] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) -Group_2_objects = [model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_2_2"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2"), model.selection("FACE", "Extrusion_1_1_3/From_Face"), model.selection("FACE", "Extrusion_1_1_3/To_Face"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1"), model.selection("FACE", "Extrusion_1_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_2"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1"), model.selection("FACE", "Extrusion_1_1_2/From_Face"), model.selection("FACE", "Extrusion_1_1_2/To_Face"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2")] +Group_2_objects = [ + model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_2_2"), + model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2"), + model.selection("FACE", "Extrusion_1_1_3/From_Face"), + model.selection("FACE", "Extrusion_1_1_3/To_Face"), + model.selection( + "FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1" + ), + model.selection("FACE", "Extrusion_1_1_1/To_Face"), + model.selection("FACE", "Extrusion_1_1_1/From_Face"), + model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_2"), + model.selection( + "FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2" + ), + model.selection( + "FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1" + ), + model.selection( + "FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1" + ), + model.selection("FACE", "Extrusion_1_1_2/From_Face"), + model.selection("FACE", "Extrusion_1_1_2/To_Face"), + model.selection( + "FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2" + ), + model.selection( + "FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2" + ), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_2_2][weak_name_1]"), model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_2_2][Extrusion_1_1_3/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_2_2][Extrusion_1_1_3/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_3/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_3/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_2_2][weak_name_2]"), 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/SketchCircle_2_2]"), 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_2_2][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/SketchCircle_1_2&weak_name_2]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_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/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_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_2]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][Extrusion_1_1_2/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_2/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_2/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][Extrusion_1_1_2/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2]")] +Group_3_objects = [ + model.selection( + "EDGE", + "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_2_2][weak_name_1]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_2_2][Extrusion_1_1_3/From_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_2_2][Extrusion_1_1_3/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_3/From_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_3/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_2_2][weak_name_2]", + ), + 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/SketchCircle_2_2]", + ), + 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_2_2][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/SketchCircle_1_2&weak_name_2]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_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/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_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_2]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][Extrusion_1_1_2/From_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][Extrusion_1_1_2/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_2/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_2/From_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_2/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_2/From_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][Extrusion_1_1_2/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][Extrusion_1_1_2/From_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2]", + ), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Group_4_objects = [model.selection("VERTEX", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][Extrusion_1_1_2/To_Face]"), model.selection("VERTEX", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][Extrusion_1_1_2/From_Face]"), model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_2][Extrusion_1_1_1/To_Face]"), model.selection("VERTEX", "[_weak_name_5_Extrusion_1_1_3]e[_weak_name_2_Extrusion_1_1_3]e[_weak_name_4_Extrusion_1_1_3]e"), model.selection("VERTEX", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][Extrusion_1_1_2/To_Face]"), model.selection("VERTEX", "[_weak_name_5_Extrusion_1_1_3]e[_weak_name_1_Extrusion_1_1_3]e[_weak_name_3_Extrusion_1_1_3]e"), model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_2][Extrusion_1_1_1/From_Face]"), model.selection("VERTEX", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][Extrusion_1_1_2/From_Face]"), model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_2/To_Face]"), model.selection("VERTEX", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_2/From_Face]"), model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]"), model.selection("VERTEX", "[_weak_name_6_Extrusion_1_1_3]e[_weak_name_2_Extrusion_1_1_3]e[_weak_name_4_Extrusion_1_1_3]e"), model.selection("VERTEX", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_2/To_Face]"), model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_2][Extrusion_1_1_1/To_Face]"), model.selection("VERTEX", "[_weak_name_6_Extrusion_1_1_3]e[_weak_name_1_Extrusion_1_1_3]e[_weak_name_3_Extrusion_1_1_3]e"), model.selection("VERTEX", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_2/From_Face]"), model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_2][Extrusion_1_1_1/From_Face]")] +Group_4_objects = [ + model.selection( + "VERTEX", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][Extrusion_1_1_2/To_Face]", + ), + model.selection( + "VERTEX", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][Extrusion_1_1_2/From_Face]", + ), + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_2][Extrusion_1_1_1/To_Face]", + ), + model.selection( + "VERTEX", + "[_weak_name_5_Extrusion_1_1_3]e[_weak_name_2_Extrusion_1_1_3]e[_weak_name_4_Extrusion_1_1_3]e", + ), + model.selection( + "VERTEX", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][Extrusion_1_1_2/To_Face]", + ), + model.selection( + "VERTEX", + "[_weak_name_5_Extrusion_1_1_3]e[_weak_name_1_Extrusion_1_1_3]e[_weak_name_3_Extrusion_1_1_3]e", + ), + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_2][Extrusion_1_1_1/From_Face]", + ), + model.selection( + "VERTEX", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][Extrusion_1_1_2/From_Face]", + ), + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]", + ), + model.selection( + "VERTEX", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_2/To_Face]", + ), + model.selection( + "VERTEX", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_2/From_Face]", + ), + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]", + ), + model.selection( + "VERTEX", + "[_weak_name_6_Extrusion_1_1_3]e[_weak_name_2_Extrusion_1_1_3]e[_weak_name_4_Extrusion_1_1_3]e", + ), + model.selection( + "VERTEX", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_2/To_Face]", + ), + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_2][Extrusion_1_1_1/To_Face]", + ), + model.selection( + "VERTEX", + "[_weak_name_6_Extrusion_1_1_3]e[_weak_name_1_Extrusion_1_1_3]e[_weak_name_3_Extrusion_1_1_3]e", + ), + model.selection( + "VERTEX", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_2/From_Face]", + ), + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_2][Extrusion_1_1_1/From_Face]", + ), +] Group_4 = model.addGroup(Part_1_doc, Group_4_objects) -Scale_1 = model.addScale(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1")] , model.selection("VERTEX", "PartSet/Origin"), 2) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + 2, +) model.do() # move groups to the end Part_1_doc.moveFeature(Group_1.feature(), Scale_1.feature()) @@ -53,19 +274,19 @@ from ModelAPI import * aFactory = ModelAPI_Session.get().validators() selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 1 +assert aFactory.validate(Group_1.feature()) selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 5) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 5 +assert aFactory.validate(Group_2.feature()) selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 9) -assert(aFactory.validate(Group_3.feature())) +assert selectionList.size() == 9 +assert aFactory.validate(Group_3.feature()) selectionList = Group_4.feature().selectionList("group_list") -assert(selectionList.size() == 6) -assert(aFactory.validate(Group_4.feature())) +assert selectionList.size() == 6 +assert aFactory.validate(Group_4.feature()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove12.py b/src/CollectionPlugin/Test/TestGroupMove12.py index 86ef63196..1f108a48a 100644 --- a/src/CollectionPlugin/Test/TestGroupMove12.py +++ b/src/CollectionPlugin/Test/TestGroupMove12.py @@ -26,12 +26,15 @@ from ModelAPI import * aFactory = ModelAPI_Session.get().validators() + def moveGroupsAndVerify(thePart, theLastFeature, theRefNumInGroups): # move groups to the end model.begin() LastFeature = theLastFeature for i in range(thePart.size("Groups")): - GroupFeature = thePart.feature(objectToResult(thePart.object("Groups", 0))) # move always the very first group + GroupFeature = thePart.feature( + objectToResult(thePart.object("Groups", 0)) + ) # move always the very first group Part_1_doc.moveFeature(GroupFeature, LastFeature) LastFeature = GroupFeature model.end() @@ -39,8 +42,8 @@ def moveGroupsAndVerify(thePart, theLastFeature, theRefNumInGroups): a = 0 for i in range(thePart.size("Groups")): GroupFeature = thePart.feature(objectToResult(thePart.object("Groups", i))) - assert(aFactory.validate(GroupFeature)) - assert(GroupFeature.selectionList("group_list").size() == theRefNumInGroups[a]) + assert aFactory.validate(GroupFeature) + assert GroupFeature.selectionList("group_list").size() == theRefNumInGroups[a] a = a + 1 @@ -49,18 +52,124 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")] +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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) -Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Partition_1_1_3"), model.selection("SOLID", "Partition_1_1_1")]) -Group_2_objects = [model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Front"), model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Top"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Right")] +Group_1 = model.addGroup( + Part_1_doc, + [ + model.selection("SOLID", "Partition_1_1_3"), + model.selection("SOLID", "Partition_1_1_1"), + ], +) +Group_2_objects = [ + model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Front"), + model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Top"), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top"), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Right"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Front]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top]"), model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"), model.selection("EDGE", "Partition_1_1_3/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"), model.selection("EDGE", "[Partition_1_1_4/Modified_Face&Box_1_1/Top][Partition_1_1_4/Modified_Face&Box_1_1/Front]"), model.selection("EDGE", "[Partition_1_1_4/Modified_Face&Box_1_1/Top][Partition_1_1_4/Modified_Face&Box_1_1/Right]"), model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top"), model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top]"), model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Box_1_1/Right]")] +Group_3_objects = [ + model.selection( + "EDGE", + "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Front]", + ), + model.selection( + "EDGE", + "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Left]", + ), + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top" + ), + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Left]", + ), + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top]", + ), + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top" + ), + model.selection( + "EDGE", "Partition_1_1_3/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top" + ), + model.selection( + "EDGE", + "[Partition_1_1_4/Modified_Face&Box_1_1/Top][Partition_1_1_4/Modified_Face&Box_1_1/Front]", + ), + model.selection( + "EDGE", + "[Partition_1_1_4/Modified_Face&Box_1_1/Top][Partition_1_1_4/Modified_Face&Box_1_1/Right]", + ), + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top" + ), + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top]", + ), + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Box_1_1/Right]", + ), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Group_4_objects = [model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "Partition_1_1_4/Generated_Vertex&Plane_1/Plane_1&weak_name_1"), model.selection("VERTEX", "[Partition_1_1_4/Modified_Face&Box_1_1/Front][Partition_1_1_4/Modified_Face&Box_1_1/Bottom][Partition_1_1_4/Modified_Face&Box_1_1/Right]"), model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_2/Plane_2&weak_name_1"), model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Plane_1/Plane_1][Partition_1_1_2/Modified_Face&Plane_2/Plane_2]"), model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_2/Plane_2&weak_name_1"), model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Partition_1_1_1/Modified_Face&Box_1_1/Left]"), model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_1"), model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]")] +Group_4_objects = [ + model.selection( + "VERTEX", + "[Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]", + ), + model.selection( + "VERTEX", "Partition_1_1_4/Generated_Vertex&Plane_1/Plane_1&weak_name_1" + ), + model.selection( + "VERTEX", + "[Partition_1_1_4/Modified_Face&Box_1_1/Front][Partition_1_1_4/Modified_Face&Box_1_1/Bottom][Partition_1_1_4/Modified_Face&Box_1_1/Right]", + ), + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_2/Plane_2&weak_name_1" + ), + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Plane_1/Plane_1][Partition_1_1_2/Modified_Face&Plane_2/Plane_2]", + ), + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_2/Plane_2&weak_name_1" + ), + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Partition_1_1_1/Modified_Face&Box_1_1/Left]", + ), + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_1" + ), + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]", + ), +] Group_4 = model.addGroup(Part_1_doc, Group_4_objects) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("EDGE", "PartSet/OX"), 20) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, +) model.do() model.end() @@ -68,13 +177,23 @@ num_in_groups = [2, 4, 12, 9] moveGroupsAndVerify(Part_1_doc, Translation_1.feature(), num_in_groups) model.begin() -Translation_2 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Translation_1_1")], 10, 10, 0) +Translation_2 = model.addTranslation( + Part_1_doc, [model.selection("COMPSOLID", "Translation_1_1")], 10, 10, 0 +) model.end() moveGroupsAndVerify(Part_1_doc, Translation_2.feature(), num_in_groups) model.begin() -Translation_3 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Translation_2_1")], model.selection("VERTEX", "[Translation_2_1_1/MF:Translated&Box_1_1/Back][Translation_2_1_1/MF:Translated&Box_1_1/Bottom][Translation_2_1_1/MF:Translated&Box_1_1/Left]"), model.selection("VERTEX", "PartSet/Origin")) +Translation_3 = model.addTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Translation_2_1")], + model.selection( + "VERTEX", + "[Translation_2_1_1/MF:Translated&Box_1_1/Back][Translation_2_1_1/MF:Translated&Box_1_1/Bottom][Translation_2_1_1/MF:Translated&Box_1_1/Left]", + ), + model.selection("VERTEX", "PartSet/Origin"), +) model.end() moveGroupsAndVerify(Part_1_doc, Translation_3.feature(), num_in_groups) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove13.py b/src/CollectionPlugin/Test/TestGroupMove13.py index 928bd57e1..cd74d3832 100644 --- a/src/CollectionPlugin/Test/TestGroupMove13.py +++ b/src/CollectionPlugin/Test/TestGroupMove13.py @@ -26,12 +26,15 @@ from ModelAPI import * aFactory = ModelAPI_Session.get().validators() + def moveGroupsAndVerify(thePart, theLastFeature, theRefNumInGroups): # move groups to the end model.begin() LastFeature = theLastFeature for i in range(thePart.size("Groups")): - GroupFeature = thePart.feature(objectToResult(thePart.object("Groups", 0))) # move always the very first group + GroupFeature = thePart.feature( + objectToResult(thePart.object("Groups", 0)) + ) # move always the very first group Part_1_doc.moveFeature(GroupFeature, LastFeature) LastFeature = GroupFeature model.end() @@ -39,8 +42,8 @@ def moveGroupsAndVerify(thePart, theLastFeature, theRefNumInGroups): a = 0 for i in range(thePart.size("Groups")): GroupFeature = thePart.feature(objectToResult(thePart.object("Groups", i))) - assert(aFactory.validate(GroupFeature)) - assert(GroupFeature.selectionList("group_list").size() == theRefNumInGroups[a]) + assert aFactory.validate(GroupFeature) + assert GroupFeature.selectionList("group_list").size() == theRefNumInGroups[a] a = a + 1 @@ -49,26 +52,147 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")] +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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) -Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Partition_1_1_3"), model.selection("SOLID", "Partition_1_1_1")]) -Group_2_objects = [model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Front"), model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Top"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Right")] +Group_1 = model.addGroup( + Part_1_doc, + [ + model.selection("SOLID", "Partition_1_1_3"), + model.selection("SOLID", "Partition_1_1_1"), + ], +) +Group_2_objects = [ + model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Front"), + model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Top"), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top"), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Right"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Front]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top]"), model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"), model.selection("EDGE", "Partition_1_1_3/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"), model.selection("EDGE", "[Partition_1_1_4/Modified_Face&Box_1_1/Top][Partition_1_1_4/Modified_Face&Box_1_1/Front]"), model.selection("EDGE", "[Partition_1_1_4/Modified_Face&Box_1_1/Top][Partition_1_1_4/Modified_Face&Box_1_1/Right]"), model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top"), model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top]"), model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Box_1_1/Right]")] +Group_3_objects = [ + model.selection( + "EDGE", + "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Front]", + ), + model.selection( + "EDGE", + "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Left]", + ), + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top" + ), + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Left]", + ), + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top]", + ), + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top" + ), + model.selection( + "EDGE", "Partition_1_1_3/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top" + ), + model.selection( + "EDGE", + "[Partition_1_1_4/Modified_Face&Box_1_1/Top][Partition_1_1_4/Modified_Face&Box_1_1/Front]", + ), + model.selection( + "EDGE", + "[Partition_1_1_4/Modified_Face&Box_1_1/Top][Partition_1_1_4/Modified_Face&Box_1_1/Right]", + ), + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top" + ), + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top]", + ), + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Box_1_1/Right]", + ), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Group_4_objects = [model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "Partition_1_1_4/Generated_Vertex&Plane_1/Plane_1&weak_name_1"), model.selection("VERTEX", "[Partition_1_1_4/Modified_Face&Box_1_1/Front][Partition_1_1_4/Modified_Face&Box_1_1/Bottom][Partition_1_1_4/Modified_Face&Box_1_1/Right]"), model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_2/Plane_2&weak_name_1"), model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Plane_1/Plane_1][Partition_1_1_2/Modified_Face&Plane_2/Plane_2]"), model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_2/Plane_2&weak_name_1"), model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Partition_1_1_1/Modified_Face&Box_1_1/Left]"), model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_1"), model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]")] +Group_4_objects = [ + model.selection( + "VERTEX", + "[Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]", + ), + model.selection( + "VERTEX", "Partition_1_1_4/Generated_Vertex&Plane_1/Plane_1&weak_name_1" + ), + model.selection( + "VERTEX", + "[Partition_1_1_4/Modified_Face&Box_1_1/Front][Partition_1_1_4/Modified_Face&Box_1_1/Bottom][Partition_1_1_4/Modified_Face&Box_1_1/Right]", + ), + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_2/Plane_2&weak_name_1" + ), + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Plane_1/Plane_1][Partition_1_1_2/Modified_Face&Plane_2/Plane_2]", + ), + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_2/Plane_2&weak_name_1" + ), + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Partition_1_1_1/Modified_Face&Box_1_1/Left]", + ), + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_1" + ), + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]", + ), +] Group_4 = model.addGroup(Part_1_doc, Group_4_objects) -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("EDGE", "PartSet/OX"), 45) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + model.selection("EDGE", "PartSet/OX"), + 45, +) model.end() num_in_groups = [2, 4, 12, 9] moveGroupsAndVerify(Part_1_doc, Rotation_1.feature(), num_in_groups) model.begin() -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("COMPSOLID", "Rotation_1_1")], model.selection("VERTEX", "[Rotation_1_1_3/MF:Rotated&Box_1_1/Top][Rotation_1_1_3/MF:Rotated&Box_1_1/Front][Rotation_1_1_3/MF:Rotated&Box_1_1/Left]"), model.selection("VERTEX", "[Rotation_1_1_4/MF:Rotated&Box_1_1/Front][Rotation_1_1_4/MF:Rotated&Box_1_1/Bottom][Rotation_1_1_4/MF:Rotated&Box_1_1/Right]"), model.selection("VERTEX", "[Rotation_1_1_2/MF:Rotated&Box_1_1/Back][Rotation_1_1_2/MF:Rotated&Box_1_1/Right][Rotation_1_1_2/MF:Rotated&Box_1_1/Bottom]")) +Rotation_2 = model.addRotation( + Part_1_doc, + [model.selection("COMPSOLID", "Rotation_1_1")], + model.selection( + "VERTEX", + "[Rotation_1_1_3/MF:Rotated&Box_1_1/Top][Rotation_1_1_3/MF:Rotated&Box_1_1/Front][Rotation_1_1_3/MF:Rotated&Box_1_1/Left]", + ), + model.selection( + "VERTEX", + "[Rotation_1_1_4/MF:Rotated&Box_1_1/Front][Rotation_1_1_4/MF:Rotated&Box_1_1/Bottom][Rotation_1_1_4/MF:Rotated&Box_1_1/Right]", + ), + model.selection( + "VERTEX", + "[Rotation_1_1_2/MF:Rotated&Box_1_1/Back][Rotation_1_1_2/MF:Rotated&Box_1_1/Right][Rotation_1_1_2/MF:Rotated&Box_1_1/Bottom]", + ), +) model.end() moveGroupsAndVerify(Part_1_doc, Rotation_2.feature(), num_in_groups) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove14.py b/src/CollectionPlugin/Test/TestGroupMove14.py index 2269c70eb..9b18786a0 100644 --- a/src/CollectionPlugin/Test/TestGroupMove14.py +++ b/src/CollectionPlugin/Test/TestGroupMove14.py @@ -26,12 +26,15 @@ from ModelAPI import * aFactory = ModelAPI_Session.get().validators() + def moveGroupsAndVerify(thePart, theLastFeature, theRefNumInGroups): # move groups to the end model.begin() LastFeature = theLastFeature for i in range(thePart.size("Groups")): - GroupFeature = thePart.feature(objectToResult(thePart.object("Groups", 0))) # move always the very first group + GroupFeature = thePart.feature( + objectToResult(thePart.object("Groups", 0)) + ) # move always the very first group Part_1_doc.moveFeature(GroupFeature, LastFeature) LastFeature = GroupFeature model.end() @@ -39,8 +42,8 @@ def moveGroupsAndVerify(thePart, theLastFeature, theRefNumInGroups): a = 0 for i in range(thePart.size("Groups")): GroupFeature = thePart.feature(objectToResult(thePart.object("Groups", i))) - assert(aFactory.validate(GroupFeature)) - assert(GroupFeature.selectionList("group_list").size() == theRefNumInGroups[a]) + assert aFactory.validate(GroupFeature) + assert GroupFeature.selectionList("group_list").size() == theRefNumInGroups[a] a = a + 1 @@ -49,26 +52,139 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")] +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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) -Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Partition_1_1_3"), model.selection("SOLID", "Partition_1_1_1")]) -Group_2_objects = [model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Front"), model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Top"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Right")] +Group_1 = model.addGroup( + Part_1_doc, + [ + model.selection("SOLID", "Partition_1_1_3"), + model.selection("SOLID", "Partition_1_1_1"), + ], +) +Group_2_objects = [ + model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Front"), + model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Top"), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top"), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Right"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Front]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top]"), model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"), model.selection("EDGE", "Partition_1_1_3/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"), model.selection("EDGE", "[Partition_1_1_4/Modified_Face&Box_1_1/Top][Partition_1_1_4/Modified_Face&Box_1_1/Front]"), model.selection("EDGE", "[Partition_1_1_4/Modified_Face&Box_1_1/Top][Partition_1_1_4/Modified_Face&Box_1_1/Right]"), model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top"), model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top]"), model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Box_1_1/Right]")] +Group_3_objects = [ + model.selection( + "EDGE", + "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Front]", + ), + model.selection( + "EDGE", + "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Left]", + ), + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top" + ), + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Left]", + ), + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top]", + ), + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top" + ), + model.selection( + "EDGE", "Partition_1_1_3/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top" + ), + model.selection( + "EDGE", + "[Partition_1_1_4/Modified_Face&Box_1_1/Top][Partition_1_1_4/Modified_Face&Box_1_1/Front]", + ), + model.selection( + "EDGE", + "[Partition_1_1_4/Modified_Face&Box_1_1/Top][Partition_1_1_4/Modified_Face&Box_1_1/Right]", + ), + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top" + ), + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top]", + ), + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Box_1_1/Right]", + ), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Group_4_objects = [model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "Partition_1_1_4/Generated_Vertex&Plane_1/Plane_1&weak_name_1"), model.selection("VERTEX", "[Partition_1_1_4/Modified_Face&Box_1_1/Front][Partition_1_1_4/Modified_Face&Box_1_1/Bottom][Partition_1_1_4/Modified_Face&Box_1_1/Right]"), model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_2/Plane_2&weak_name_1"), model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Plane_1/Plane_1][Partition_1_1_2/Modified_Face&Plane_2/Plane_2]"), model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_2/Plane_2&weak_name_1"), model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Partition_1_1_1/Modified_Face&Box_1_1/Left]"), model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_1"), model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]")] +Group_4_objects = [ + model.selection( + "VERTEX", + "[Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]", + ), + model.selection( + "VERTEX", "Partition_1_1_4/Generated_Vertex&Plane_1/Plane_1&weak_name_1" + ), + model.selection( + "VERTEX", + "[Partition_1_1_4/Modified_Face&Box_1_1/Front][Partition_1_1_4/Modified_Face&Box_1_1/Bottom][Partition_1_1_4/Modified_Face&Box_1_1/Right]", + ), + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_2/Plane_2&weak_name_1" + ), + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Plane_1/Plane_1][Partition_1_1_2/Modified_Face&Plane_2/Plane_2]", + ), + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_2/Plane_2&weak_name_1" + ), + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Partition_1_1_1/Modified_Face&Box_1_1/Left]", + ), + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_1" + ), + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]", + ), +] Group_4 = model.addGroup(Part_1_doc, Group_4_objects) -Scale_1 = model.addScale(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")] , model.selection("VERTEX", "PartSet/Origin"), 2) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + 2, +) model.end() num_in_groups = [2, 4, 12, 9] moveGroupsAndVerify(Part_1_doc, Scale_1.feature(), num_in_groups) model.begin() -Scale_2 = model.addScale(Part_1_doc, [model.selection("COMPSOLID", "Scale_1_1")] , model.selection("VERTEX", "PartSet/Origin"), 1 , 2, 3) +Scale_2 = model.addScale( + Part_1_doc, + [model.selection("COMPSOLID", "Scale_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + 1, + 2, + 3, +) model.end() moveGroupsAndVerify(Part_1_doc, Scale_2.feature(), num_in_groups) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove15.py b/src/CollectionPlugin/Test/TestGroupMove15.py index 0dc8ebc93..acb5c9b07 100644 --- a/src/CollectionPlugin/Test/TestGroupMove15.py +++ b/src/CollectionPlugin/Test/TestGroupMove15.py @@ -26,12 +26,15 @@ from ModelAPI import * aFactory = ModelAPI_Session.get().validators() + def moveGroupsAndVerify(thePart, theLastFeature, theRefNumInGroups): # move groups to the end model.begin() LastFeature = theLastFeature for i in range(thePart.size("Groups")): - GroupFeature = thePart.feature(objectToResult(thePart.object("Groups", 0))) # move always the very first group + GroupFeature = thePart.feature( + objectToResult(thePart.object("Groups", 0)) + ) # move always the very first group Part_1_doc.moveFeature(GroupFeature, LastFeature) LastFeature = GroupFeature model.end() @@ -39,8 +42,8 @@ def moveGroupsAndVerify(thePart, theLastFeature, theRefNumInGroups): a = 0 for i in range(thePart.size("Groups")): GroupFeature = thePart.feature(objectToResult(thePart.object("Groups", i))) - assert(aFactory.validate(GroupFeature)) - assert(GroupFeature.selectionList("group_list").size() == theRefNumInGroups[a]) + assert aFactory.validate(GroupFeature) + assert GroupFeature.selectionList("group_list").size() == theRefNumInGroups[a] a = a + 1 @@ -49,22 +52,130 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -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")] +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +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) -Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Partition_1_1_3"), model.selection("SOLID", "Partition_1_1_1")]) -Group_2_objects = [model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Front"), model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Top"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Right")] +Group_1 = model.addGroup( + Part_1_doc, + [ + model.selection("SOLID", "Partition_1_1_3"), + model.selection("SOLID", "Partition_1_1_1"), + ], +) +Group_2_objects = [ + model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Front"), + model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Top"), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top"), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Right"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Front]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top]"), model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"), model.selection("EDGE", "Partition_1_1_3/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"), model.selection("EDGE", "[Partition_1_1_4/Modified_Face&Box_1_1/Top][Partition_1_1_4/Modified_Face&Box_1_1/Front]"), model.selection("EDGE", "[Partition_1_1_4/Modified_Face&Box_1_1/Top][Partition_1_1_4/Modified_Face&Box_1_1/Right]"), model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top"), model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top]"), model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Box_1_1/Right]")] +Group_3_objects = [ + model.selection( + "EDGE", + "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Front]", + ), + model.selection( + "EDGE", + "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Left]", + ), + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top" + ), + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Left]", + ), + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top]", + ), + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top" + ), + model.selection( + "EDGE", "Partition_1_1_3/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top" + ), + model.selection( + "EDGE", + "[Partition_1_1_4/Modified_Face&Box_1_1/Top][Partition_1_1_4/Modified_Face&Box_1_1/Front]", + ), + model.selection( + "EDGE", + "[Partition_1_1_4/Modified_Face&Box_1_1/Top][Partition_1_1_4/Modified_Face&Box_1_1/Right]", + ), + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top" + ), + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top]", + ), + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Box_1_1/Right]", + ), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Group_4_objects = [model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "Partition_1_1_4/Generated_Vertex&Plane_1/Plane_1&weak_name_1"), model.selection("VERTEX", "[Partition_1_1_4/Modified_Face&Box_1_1/Front][Partition_1_1_4/Modified_Face&Box_1_1/Bottom][Partition_1_1_4/Modified_Face&Box_1_1/Right]"), model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_2/Plane_2&weak_name_1"), model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Plane_1/Plane_1][Partition_1_1_2/Modified_Face&Plane_2/Plane_2]"), model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_2/Plane_2&weak_name_1"), model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Partition_1_1_1/Modified_Face&Box_1_1/Left]"), model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_1"), model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]")] +Group_4_objects = [ + model.selection( + "VERTEX", + "[Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]", + ), + model.selection( + "VERTEX", "Partition_1_1_4/Generated_Vertex&Plane_1/Plane_1&weak_name_1" + ), + model.selection( + "VERTEX", + "[Partition_1_1_4/Modified_Face&Box_1_1/Front][Partition_1_1_4/Modified_Face&Box_1_1/Bottom][Partition_1_1_4/Modified_Face&Box_1_1/Right]", + ), + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_2/Plane_2&weak_name_1" + ), + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Plane_1/Plane_1][Partition_1_1_2/Modified_Face&Plane_2/Plane_2]", + ), + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_2/Plane_2&weak_name_1" + ), + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Partition_1_1_1/Modified_Face&Box_1_1/Left]", + ), + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_1" + ), + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]", + ), +] Group_4 = model.addGroup(Part_1_doc, Group_4_objects) -Placement_1 = model.addPlacement(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Top"), False, True) +Placement_1 = model.addPlacement( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Bottom"), + model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Top"), + False, + True, +) model.do() model.end() num_in_groups = [2, 4, 12, 9] moveGroupsAndVerify(Part_1_doc, Placement_1.feature(), num_in_groups) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove16.py b/src/CollectionPlugin/Test/TestGroupMove16.py index c3f91d3e8..6fd2f7618 100644 --- a/src/CollectionPlugin/Test/TestGroupMove16.py +++ b/src/CollectionPlugin/Test/TestGroupMove16.py @@ -25,12 +25,15 @@ from ModelAPI import * aFactory = ModelAPI_Session.get().validators() + def moveGroupsAndVerify(thePart, theLastFeature, theRefNumInGroups): # move groups to the end model.begin() LastFeature = theLastFeature for i in range(thePart.size("Groups")): - GroupFeature = thePart.feature(objectToResult(thePart.object("Groups", 0))) # move always the very first group + GroupFeature = thePart.feature( + objectToResult(thePart.object("Groups", 0)) + ) # move always the very first group Part_1_doc.moveFeature(GroupFeature, LastFeature) LastFeature = GroupFeature model.end() @@ -38,8 +41,8 @@ def moveGroupsAndVerify(thePart, theLastFeature, theRefNumInGroups): a = 0 for i in range(thePart.size("Groups")): GroupFeature = thePart.feature(objectToResult(thePart.object("Groups", i))) - assert(aFactory.validate(GroupFeature)) - assert(GroupFeature.selectionList("group_list").size() == theRefNumInGroups[a]) + assert aFactory.validate(GroupFeature) + assert GroupFeature.selectionList("group_list").size() == theRefNumInGroups[a] a = a + 1 @@ -49,21 +52,62 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Box_1_1")]) -Group_2_objects = [model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Right"), model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Bottom"), model.selection("FACE", "Box_1_1/Front")] +Group_2_objects = [ + model.selection("FACE", "Box_1_1/Back"), + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Right"), + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Bottom"), + model.selection("FACE", "Box_1_1/Front"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")] +Group_3_objects = [ + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Group_4_objects = [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/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"), 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/Bottom]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]")] +Group_4_objects = [ + 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/Top]"), + model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"), + 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/Bottom]"), + model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"), + model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]"), +] Group_4 = model.addGroup(Part_1_doc, Group_4_objects) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), model.selection("FACE", "Box_1_1/Top")) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Bottom"), + model.selection("FACE", "Box_1_1/Top"), +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchCircle_1 = Sketch_1.addCircle(3.528942405489753, -5.938455554641368, 11.4411217503133) +SketchCircle_1 = Sketch_1.addCircle( + 3.528942405489753, -5.938455554641368, 11.4411217503133 +) model.do() -CompSolid_1 = model.addCompSolid(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")]) +CompSolid_1 = model.addCompSolid( + Part_1_doc, + [ + model.selection("SOLID", "Box_1_1"), + model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), + ], +) model.do() model.end() num_in_groups = [2, 10, 16, 8] moveGroupsAndVerify(Part_1_doc, CompSolid_1.feature(), num_in_groups) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove17.py b/src/CollectionPlugin/Test/TestGroupMove17.py index 2f945882c..9e1793921 100644 --- a/src/CollectionPlugin/Test/TestGroupMove17.py +++ b/src/CollectionPlugin/Test/TestGroupMove17.py @@ -25,12 +25,15 @@ from ModelAPI import * aFactory = ModelAPI_Session.get().validators() + def moveGroupsAndVerify(thePart, theLastFeature, theRefNumInGroups): # move groups to the end model.begin() LastFeature = theLastFeature for i in range(thePart.size("Groups")): - GroupFeature = thePart.feature(objectToResult(thePart.object("Groups", 0))) # move always the very first group + GroupFeature = thePart.feature( + objectToResult(thePart.object("Groups", 0)) + ) # move always the very first group Part_1_doc.moveFeature(GroupFeature, LastFeature) LastFeature = GroupFeature model.end() @@ -38,8 +41,8 @@ def moveGroupsAndVerify(thePart, theLastFeature, theRefNumInGroups): a = 0 for i in range(thePart.size("Groups")): GroupFeature = thePart.feature(objectToResult(thePart.object("Groups", i))) - assert(aFactory.validate(GroupFeature)) - assert(GroupFeature.selectionList("group_list").size() == theRefNumInGroups[a]) + assert aFactory.validate(GroupFeature) + assert GroupFeature.selectionList("group_list").size() == theRefNumInGroups[a] a = a + 1 @@ -49,17 +52,59 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Box_1_1")]) -Group_2_objects = [model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Right"), model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Bottom"), model.selection("FACE", "Box_1_1/Front")] +Group_2_objects = [ + model.selection("FACE", "Box_1_1/Back"), + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Right"), + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Bottom"), + model.selection("FACE", "Box_1_1/Front"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")] +Group_3_objects = [ + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Group_4_objects = [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/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"), 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/Bottom]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]")] +Group_4_objects = [ + 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/Top]"), + model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"), + 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/Bottom]"), + model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"), + model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]"), +] Group_4 = model.addGroup(Part_1_doc, Group_4_objects) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), model.selection("FACE", "Box_1_1/Top")) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Bottom"), + model.selection("FACE", "Box_1_1/Top"), +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchCircle_1 = Sketch_1.addCircle(3.528942405489753, -5.938455554641368, 11.4411217503133) +SketchCircle_1 = Sketch_1.addCircle( + 3.528942405489753, -5.938455554641368, 11.4411217503133 +) model.do() -Solid_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Bottom"), model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Right")] +Solid_1_objects = [ + model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Bottom"), + model.selection("FACE", "Box_1_1/Back"), + model.selection("FACE", "Box_1_1/Right"), +] Solid_1 = model.addSolid(Part_1_doc, Solid_1_objects) model.do() model.end() @@ -67,4 +112,4 @@ model.end() num_in_groups = [1, 5, 8, 4] moveGroupsAndVerify(Part_1_doc, Solid_1.feature(), num_in_groups) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove18.py b/src/CollectionPlugin/Test/TestGroupMove18.py index 744494c33..46d20650c 100644 --- a/src/CollectionPlugin/Test/TestGroupMove18.py +++ b/src/CollectionPlugin/Test/TestGroupMove18.py @@ -25,12 +25,15 @@ from ModelAPI import * aFactory = ModelAPI_Session.get().validators() + def moveGroupsAndVerify(thePart, theLastFeature, theRefNumInGroups): # move groups to the end model.begin() LastFeature = theLastFeature for i in range(thePart.size("Groups")): - GroupFeature = thePart.feature(objectToResult(thePart.object("Groups", 0))) # move always the very first group + GroupFeature = thePart.feature( + objectToResult(thePart.object("Groups", 0)) + ) # move always the very first group Part_1_doc.moveFeature(GroupFeature, LastFeature) LastFeature = GroupFeature model.end() @@ -38,8 +41,8 @@ def moveGroupsAndVerify(thePart, theLastFeature, theRefNumInGroups): a = 0 for i in range(thePart.size("Groups")): GroupFeature = thePart.feature(objectToResult(thePart.object("Groups", i))) - assert(aFactory.validate(GroupFeature)) - assert(GroupFeature.selectionList("group_list").size() == theRefNumInGroups[a]) + assert aFactory.validate(GroupFeature) + assert GroupFeature.selectionList("group_list").size() == theRefNumInGroups[a] a = a + 1 @@ -48,17 +51,65 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1_objects = [model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Right"), model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Bottom"), model.selection("FACE", "Box_1_1/Front")] +Group_1_objects = [ + model.selection("FACE", "Box_1_1/Back"), + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Right"), + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Bottom"), + model.selection("FACE", "Box_1_1/Front"), +] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) -Group_2_objects = [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")] +Group_2_objects = [ + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [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/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"), 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/Bottom]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]")] +Group_3_objects = [ + 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/Top]"), + model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"), + model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"), + 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/Bottom]"), + model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]"), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")] +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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) -Shell_1_objects = [model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Back"), model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Left"), model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Top"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Back"), model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Front"), model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Right")] +Shell_1_objects = [ + model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Back"), + model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Left"), + model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Top"), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Back"), + model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Front"), + model.selection("FACE", "Partition_1_1_4/Modified_Face&Box_1_1/Right"), +] Shell_1 = model.addShell(Part_1_doc, Shell_1_objects) model.do() model.end() @@ -66,4 +117,4 @@ model.end() num_in_groups = [6, 13, 6] moveGroupsAndVerify(Part_1_doc, Shell_1.feature(), num_in_groups) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove19.py b/src/CollectionPlugin/Test/TestGroupMove19.py index d3b7dfbc7..5ec791bea 100644 --- a/src/CollectionPlugin/Test/TestGroupMove19.py +++ b/src/CollectionPlugin/Test/TestGroupMove19.py @@ -25,12 +25,15 @@ from ModelAPI import * aFactory = ModelAPI_Session.get().validators() + def moveGroupsAndVerify(thePart, theLastFeature, theRefNumInGroups): # move groups to the end model.begin() LastFeature = theLastFeature for i in range(thePart.size("Groups")): - GroupFeature = thePart.feature(objectToResult(thePart.object("Groups", 0))) # move always the very first group + GroupFeature = thePart.feature( + objectToResult(thePart.object("Groups", 0)) + ) # move always the very first group Part_1_doc.moveFeature(GroupFeature, LastFeature) LastFeature = GroupFeature model.end() @@ -38,8 +41,8 @@ def moveGroupsAndVerify(thePart, theLastFeature, theRefNumInGroups): a = 0 for i in range(thePart.size("Groups")): GroupFeature = thePart.feature(objectToResult(thePart.object("Groups", i))) - assert(aFactory.validate(GroupFeature)) - assert(GroupFeature.selectionList("group_list").size() == theRefNumInGroups[a]) + assert aFactory.validate(GroupFeature) + assert GroupFeature.selectionList("group_list").size() == theRefNumInGroups[a] a = a + 1 @@ -48,26 +51,82 @@ 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(37.25033050129738, -29.31988879634488, -32.3129114537045, -29.31988879634488) -SketchLine_2 = Sketch_1.addLine(-32.3129114537045, -29.31988879634488, -32.3129114537045, 42.23870159689701) -SketchLine_3 = Sketch_1.addLine(-32.3129114537045, 42.23870159689701, 37.25033050129738, 42.23870159689701) -SketchLine_4 = Sketch_1.addLine(37.25033050129738, 42.23870159689701, 37.25033050129738, -29.31988879634488) -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()) +SketchLine_1 = Sketch_1.addLine( + 37.25033050129738, -29.31988879634488, -32.3129114537045, -29.31988879634488 +) +SketchLine_2 = Sketch_1.addLine( + -32.3129114537045, -29.31988879634488, -32.3129114537045, 42.23870159689701 +) +SketchLine_3 = Sketch_1.addLine( + -32.3129114537045, 42.23870159689701, 37.25033050129738, 42.23870159689701 +) +SketchLine_4 = Sketch_1.addLine( + 37.25033050129738, 42.23870159689701, 37.25033050129738, -29.31988879634488 +) +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() -Edge_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3")] +Edge_1_objects = [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_4"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + model.selection("EDGE", "Sketch_1/SketchLine_3"), +] Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects) -Group_1_objects = [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_3"), model.selection("EDGE", "Edge_1_4"), model.selection("EDGE", "Edge_1_2")] +Group_1_objects = [ + model.selection("EDGE", "Edge_1_1"), + model.selection("EDGE", "Edge_1_3"), + model.selection("EDGE", "Edge_1_4"), + model.selection("EDGE", "Edge_1_2"), +] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) -Group_2_objects = [model.selection("VERTEX", "Edge_1_1/Modified_Vertex&Sketch_1/SketchLine_1_StartVertex"), model.selection("VERTEX", "Edge_1_2/Modified_Vertex&Sketch_1/SketchLine_4_EndVertex"), model.selection("VERTEX", "Edge_1_1/Modified_Vertex&Sketch_1/SketchLine_1_EndVertex"), model.selection("VERTEX", "Edge_1_3/Modified_Vertex&Sketch_1/SketchLine_2_StartVertex"), model.selection("VERTEX", "Edge_1_4/Modified_Vertex&Sketch_1/SketchLine_3_EndVertex"), model.selection("VERTEX", "Edge_1_2/Modified_Vertex&Sketch_1/SketchLine_4_StartVertex"), model.selection("VERTEX", "Edge_1_3/Modified_Vertex&Sketch_1/SketchLine_2_EndVertex"), model.selection("VERTEX", "Edge_1_4/Modified_Vertex&Sketch_1/SketchLine_3_StartVertex")] +Group_2_objects = [ + model.selection( + "VERTEX", "Edge_1_1/Modified_Vertex&Sketch_1/SketchLine_1_StartVertex" + ), + model.selection( + "VERTEX", "Edge_1_2/Modified_Vertex&Sketch_1/SketchLine_4_EndVertex" + ), + model.selection( + "VERTEX", "Edge_1_1/Modified_Vertex&Sketch_1/SketchLine_1_EndVertex" + ), + model.selection( + "VERTEX", "Edge_1_3/Modified_Vertex&Sketch_1/SketchLine_2_StartVertex" + ), + model.selection( + "VERTEX", "Edge_1_4/Modified_Vertex&Sketch_1/SketchLine_3_EndVertex" + ), + model.selection( + "VERTEX", "Edge_1_2/Modified_Vertex&Sketch_1/SketchLine_4_StartVertex" + ), + model.selection( + "VERTEX", "Edge_1_3/Modified_Vertex&Sketch_1/SketchLine_2_EndVertex" + ), + model.selection( + "VERTEX", "Edge_1_4/Modified_Vertex&Sketch_1/SketchLine_3_StartVertex" + ), +] Group_2 = model.addGroup(Part_1_doc, Group_2_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_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) model.do() model.end() @@ -75,4 +134,4 @@ model.end() num_in_groups = [4, 4] moveGroupsAndVerify(Part_1_doc, Face_1.feature(), num_in_groups) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove20.py b/src/CollectionPlugin/Test/TestGroupMove20.py index a174b858d..29088cddd 100644 --- a/src/CollectionPlugin/Test/TestGroupMove20.py +++ b/src/CollectionPlugin/Test/TestGroupMove20.py @@ -31,9 +31,17 @@ 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"), 2, True) Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), 7, True) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("FACE", "Plane_2")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + [model.selection("FACE", "Plane_2")], +) Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Split_1_1_1")]) -Split_2 = model.addSplit(Part_1_doc, [model.selection("COMPSOLID", "Split_1_1")], [model.selection("FACE", "Plane_1")]) +Split_2 = model.addSplit( + Part_1_doc, + [model.selection("COMPSOLID", "Split_1_1")], + [model.selection("FACE", "Plane_1")], +) model.do() # move group @@ -43,8 +51,8 @@ model.end() # Check group: result must be four faces aFactory = ModelAPI_Session.get().validators() selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_1.feature())) -assert(Group_1.groupList().value(0).value().shapeType() == GeomAPI_Shape.SOLID) +assert selectionList.size() == 1 +assert aFactory.validate(Group_1.feature()) +assert Group_1.groupList().value(0).value().shapeType() == GeomAPI_Shape.SOLID -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove21.py b/src/CollectionPlugin/Test/TestGroupMove21.py index 7a9369c4b..c63ce2b5b 100644 --- a/src/CollectionPlugin/Test/TestGroupMove21.py +++ b/src/CollectionPlugin/Test/TestGroupMove21.py @@ -27,26 +27,67 @@ 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(35.07635467980296, 23.01108374384237, -25.74753694581282, 23.01108374384237) -SketchLine_2 = Sketch_1.addLine(-25.74753694581282, 23.01108374384237, -25.74753694581282, -23.13546798029557) -SketchLine_3 = Sketch_1.addLine(-25.74753694581282, -23.13546798029557, 35.07635467980296, -23.13546798029557) -SketchLine_4 = Sketch_1.addLine(35.07635467980296, -23.13546798029557, 35.07635467980296, 23.01108374384237) -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()) +SketchLine_1 = Sketch_1.addLine( + 35.07635467980296, 23.01108374384237, -25.74753694581282, 23.01108374384237 +) +SketchLine_2 = Sketch_1.addLine( + -25.74753694581282, 23.01108374384237, -25.74753694581282, -23.13546798029557 +) +SketchLine_3 = Sketch_1.addLine( + -25.74753694581282, -23.13546798029557, 35.07635467980296, -23.13546798029557 +) +SketchLine_4 = Sketch_1.addLine( + 35.07635467980296, -23.13546798029557, 35.07635467980296, 23.01108374384237 +) +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(), 80, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f", + ) + ], + model.selection(), + 80, + 0, +) # selection of a whole result: 6 faces of a box -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("SOLID", "Extrusion_1_1")]) +Group_1 = model.addGroup( + Part_1_doc, "Faces", [model.selection("SOLID", "Extrusion_1_1")] +) model.testNbSubShapes(Group_1, GeomAPI_Shape.FACE, [6]) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 10, [model.selection("SOLID", "Extrusion_1_1")]) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3")) -SketchCircle_1 = Sketch_2.addCircle(-7.736745115674536, 52.14422040986419, 6.760003867274182) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [], + model.selection(), + 0, + 10, + [model.selection("SOLID", "Extrusion_1_1")], +) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"), +) +SketchCircle_1 = Sketch_2.addCircle( + -7.736745115674536, 52.14422040986419, 6.760003867274182 +) ExtrusionCut_1.setNestedSketch(Sketch_2) model.do() # move group after the extrusion-cut, so, it refers to it @@ -54,7 +95,7 @@ Part_1_doc.moveFeature(Group_1.feature(), ExtrusionCut_1.feature()) model.end() # check that there is a hole appeared in the group-results -assert(len(Group_1.feature().results())==1) +assert len(Group_1.feature().results()) == 1 model.testNbSubShapes(Group_1, GeomAPI_Shape.FACE, [8]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove22.py b/src/CollectionPlugin/Test/TestGroupMove22.py index e84b59573..f9492cc27 100644 --- a/src/CollectionPlugin/Test/TestGroupMove22.py +++ b/src/CollectionPlugin/Test/TestGroupMove22.py @@ -27,28 +27,69 @@ 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.00123152709361, 27.48891625615764, 27.86206896551725, 27.48891625615764) +SketchLine_1 = Sketch_1.addLine( + -25.00123152709361, 27.48891625615764, 27.86206896551725, 27.48891625615764 +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchLine_2 = Sketch_1.addLine(27.86206896551725, 27.48891625615764, -23.88177339901478, -20.02586206896552) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(-23.88177339901478, -20.02586206896552, 28.73275862068966, -20.02586206896552) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_2 = Sketch_1.addLine( + 27.86206896551725, 27.48891625615764, -23.88177339901478, -20.02586206896552 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + -23.88177339901478, -20.02586206896552, 28.73275862068966, -20.02586206896552 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) -SketchLine_4 = Sketch_1.addLine(28.73275862068966, -20.02586206896552, 27.86206896551725, 27.48891625615764) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_4.endPoint()) -SketchLine_5 = Sketch_1.addLine(-25.00123152709361, 27.48891625615764, 28.73275862068966, -20.02586206896552) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_5.endPoint()) +SketchLine_4 = Sketch_1.addLine( + 28.73275862068966, -20.02586206896552, 27.86206896551725, 27.48891625615764 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_4.endPoint() +) +SketchLine_5 = Sketch_1.addLine( + -25.00123152709361, 27.48891625615764, 28.73275862068966, -20.02586206896552 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_5.endPoint() +) model.do() -Extrusion_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_2r-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_5f-SketchLine_4f"), model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_3f-SketchLine_5r")] -Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection(), 10, 0) +Extrusion_1_objects = [ + model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_2r-SketchLine_1r"), + model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_5f-SketchLine_4f"), + model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_3f-SketchLine_5r"), +] +Extrusion_1 = model.addExtrusion( + Part_1_doc, Extrusion_1_objects, model.selection(), 10, 0 +) # selection of a whole result: 5x3-2 faces (2 faces are shared) -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("COMPSOLID", "Extrusion_1_1")]) +Group_1 = model.addGroup( + Part_1_doc, "Faces", [model.selection("COMPSOLID", "Extrusion_1_1")] +) model.testNbSubShapes(Group_1, GeomAPI_Shape.FACE, [13]) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 10, [model.selection("COMPSOLID", "Extrusion_1_1")]) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1_1/To_Face")) -SketchCircle_1 = Sketch_2.addCircle(13.4282260278248, 11.79859034244854, 3.718064241992405) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [], + model.selection(), + 0, + 10, + [model.selection("COMPSOLID", "Extrusion_1_1")], +) +Sketch_2 = model.addSketch( + Part_1_doc, model.selection("FACE", "Extrusion_1_1_1/To_Face") +) +SketchCircle_1 = Sketch_2.addCircle( + 13.4282260278248, 11.79859034244854, 3.718064241992405 +) ExtrusionCut_1.setNestedSketch(Sketch_2) model.do() # move group after the extrusion-cut, so, it refers to it @@ -56,7 +97,7 @@ Part_1_doc.moveFeature(Group_1.feature(), ExtrusionCut_1.feature()) model.end() # check that there is a hole appeared in two solids: +4 faces (1 splitted planar, 3 faces of cylinder, divided by seam) -assert(len(Group_1.feature().results())==1) +assert len(Group_1.feature().results()) == 1 model.testNbSubShapes(Group_1, GeomAPI_Shape.FACE, [17]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove23.py b/src/CollectionPlugin/Test/TestGroupMove23.py index 1f06c05b2..709024e73 100644 --- a/src/CollectionPlugin/Test/TestGroupMove23.py +++ b/src/CollectionPlugin/Test/TestGroupMove23.py @@ -27,26 +27,67 @@ 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(35.07635467980296, 23.01108374384237, -25.74753694581282, 23.01108374384237) -SketchLine_2 = Sketch_1.addLine(-25.74753694581282, 23.01108374384237, -25.74753694581282, -23.13546798029557) -SketchLine_3 = Sketch_1.addLine(-25.74753694581282, -23.13546798029557, 35.07635467980296, -23.13546798029557) -SketchLine_4 = Sketch_1.addLine(35.07635467980296, -23.13546798029557, 35.07635467980296, 23.01108374384237) -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()) +SketchLine_1 = Sketch_1.addLine( + 35.07635467980296, 23.01108374384237, -25.74753694581282, 23.01108374384237 +) +SketchLine_2 = Sketch_1.addLine( + -25.74753694581282, 23.01108374384237, -25.74753694581282, -23.13546798029557 +) +SketchLine_3 = Sketch_1.addLine( + -25.74753694581282, -23.13546798029557, 35.07635467980296, -23.13546798029557 +) +SketchLine_4 = Sketch_1.addLine( + 35.07635467980296, -23.13546798029557, 35.07635467980296, 23.01108374384237 +) +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(), 80, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f", + ) + ], + model.selection(), + 80, + 0, +) # selection of a whole feature: 6 faces of a box -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("COMPOUND", "all-in-Extrusion_1")]) +Group_1 = model.addGroup( + Part_1_doc, "Faces", [model.selection("COMPOUND", "all-in-Extrusion_1")] +) model.testNbSubShapes(Group_1, GeomAPI_Shape.FACE, [6]) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 10, [model.selection("SOLID", "Extrusion_1_1")]) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3")) -SketchCircle_1 = Sketch_2.addCircle(-7.736745115674536, 52.14422040986419, 6.760003867274182) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [], + model.selection(), + 0, + 10, + [model.selection("SOLID", "Extrusion_1_1")], +) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"), +) +SketchCircle_1 = Sketch_2.addCircle( + -7.736745115674536, 52.14422040986419, 6.760003867274182 +) ExtrusionCut_1.setNestedSketch(Sketch_2) model.do() # move group after the extrusion-cut, so, it refers to it @@ -54,7 +95,7 @@ Part_1_doc.moveFeature(Group_1.feature(), ExtrusionCut_1.feature()) model.end() # check that there is a hole appeared in the group-results -assert(len(Group_1.feature().results())==1) +assert len(Group_1.feature().results()) == 1 model.testNbSubShapes(Group_1, GeomAPI_Shape.FACE, [8]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove24.py b/src/CollectionPlugin/Test/TestGroupMove24.py index eba1213d2..23cc04015 100644 --- a/src/CollectionPlugin/Test/TestGroupMove24.py +++ b/src/CollectionPlugin/Test/TestGroupMove24.py @@ -27,28 +27,69 @@ 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.00123152709361, 27.48891625615764, 27.86206896551725, 27.48891625615764) +SketchLine_1 = Sketch_1.addLine( + -25.00123152709361, 27.48891625615764, 27.86206896551725, 27.48891625615764 +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchLine_2 = Sketch_1.addLine(27.86206896551725, 27.48891625615764, -23.88177339901478, -20.02586206896552) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(-23.88177339901478, -20.02586206896552, 28.73275862068966, -20.02586206896552) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_2 = Sketch_1.addLine( + 27.86206896551725, 27.48891625615764, -23.88177339901478, -20.02586206896552 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + -23.88177339901478, -20.02586206896552, 28.73275862068966, -20.02586206896552 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) -SketchLine_4 = Sketch_1.addLine(28.73275862068966, -20.02586206896552, 27.86206896551725, 27.48891625615764) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_4.endPoint()) -SketchLine_5 = Sketch_1.addLine(-25.00123152709361, 27.48891625615764, 28.73275862068966, -20.02586206896552) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_5.endPoint()) +SketchLine_4 = Sketch_1.addLine( + 28.73275862068966, -20.02586206896552, 27.86206896551725, 27.48891625615764 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_4.endPoint() +) +SketchLine_5 = Sketch_1.addLine( + -25.00123152709361, 27.48891625615764, 28.73275862068966, -20.02586206896552 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_5.endPoint() +) model.do() -Extrusion_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_2r-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_5f-SketchLine_4f"), model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_3f-SketchLine_5r")] -Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection(), 10, 0) +Extrusion_1_objects = [ + model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_2r-SketchLine_1r"), + model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_5f-SketchLine_4f"), + model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_3f-SketchLine_5r"), +] +Extrusion_1 = model.addExtrusion( + Part_1_doc, Extrusion_1_objects, model.selection(), 10, 0 +) # selection of a whole result: 5x3-2 faces (2 faces are shared) -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("COMPOUND", "all-in-Extrusion_1")]) +Group_1 = model.addGroup( + Part_1_doc, "Faces", [model.selection("COMPOUND", "all-in-Extrusion_1")] +) model.testNbSubShapes(Group_1, GeomAPI_Shape.FACE, [13]) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 10, [model.selection("COMPSOLID", "Extrusion_1_1")]) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1_1/To_Face")) -SketchCircle_1 = Sketch_2.addCircle(13.4282260278248, 11.79859034244854, 3.718064241992405) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [], + model.selection(), + 0, + 10, + [model.selection("COMPSOLID", "Extrusion_1_1")], +) +Sketch_2 = model.addSketch( + Part_1_doc, model.selection("FACE", "Extrusion_1_1_1/To_Face") +) +SketchCircle_1 = Sketch_2.addCircle( + 13.4282260278248, 11.79859034244854, 3.718064241992405 +) ExtrusionCut_1.setNestedSketch(Sketch_2) model.do() # move group after the extrusion-cut, so, it refers to it @@ -56,7 +97,7 @@ Part_1_doc.moveFeature(Group_1.feature(), ExtrusionCut_1.feature()) model.end() # check that there is a hole appeared in two solids: +4 faces (1 splitted planar, 3 faces of cylinder, divided by seam) -assert(len(Group_1.feature().results())==1) +assert len(Group_1.feature().results()) == 1 model.testNbSubShapes(Group_1, GeomAPI_Shape.FACE, [17]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMove25.py b/src/CollectionPlugin/Test/TestGroupMove25.py index bcb73d322..5d9c6e078 100644 --- a/src/CollectionPlugin/Test/TestGroupMove25.py +++ b/src/CollectionPlugin/Test/TestGroupMove25.py @@ -34,49 +34,151 @@ SketchLine_1 = Sketch_1.addLine(-20, 9.999999999999998, -40, 10) SketchLine_2 = Sketch_1.addLine(-40, 10, -40, -10) SketchLine_3 = Sketch_1.addLine(-40, -10, -20, -9.999999999999998) SketchLine_4 = Sketch_1.addLine(-20, -9.999999999999998, -20, 9.999999999999998) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 10) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_1.result(), SketchCircle_1.results()[1]) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_3.result(), SketchCircle_1.results()[1]) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), 20, True) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_1.result(), SketchCircle_1.results()[1] +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_3.result(), SketchCircle_1.results()[1] +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), 20, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_4.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), 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(), 30, 0) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 15, 0) -Group_1 = model.addGroup(Part_1_doc, "Vertices", [model.selection("COMPOUND", "all-in-Extrusion_1")]) -Group_2 = model.addGroup(Part_1_doc, "Vertices", [model.selection("COMPOUND", "all-in-Extrusion_2")]) -Group_3 = model.addGroup(Part_1_doc, "Faces", [model.selection("COMPOUND", "all-in-Extrusion_1"), model.selection("COMPOUND", "all-in-Extrusion_2")]) -ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [], model.selection(), 12, 0, [model.selection("SOLID", "Extrusion_1_1")]) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4")) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f", + ) + ], + model.selection(), + 30, + 0, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection(), + 15, + 0, +) +Group_1 = model.addGroup( + Part_1_doc, "Vertices", [model.selection("COMPOUND", "all-in-Extrusion_1")] +) +Group_2 = model.addGroup( + Part_1_doc, "Vertices", [model.selection("COMPOUND", "all-in-Extrusion_2")] +) +Group_3 = model.addGroup( + Part_1_doc, + "Faces", + [ + model.selection("COMPOUND", "all-in-Extrusion_1"), + model.selection("COMPOUND", "all-in-Extrusion_2"), + ], +) +ExtrusionFuse_1 = model.addExtrusionFuse( + Part_1_doc, + [], + model.selection(), + 12, + 0, + [model.selection("SOLID", "Extrusion_1_1")], +) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), +) SketchCircle_2 = Sketch_2.addCircle(-2.3396523840492e-15, 15, 7) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], 7) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]", + ), + False, +) SketchLine_5 = SketchProjection_2.createdFeature() -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_2.center(), SketchLine_5.result(), 10, True) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"), False) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_2.center(), SketchLine_5.result(), 10, True +) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_6 = SketchProjection_3.createdFeature() -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchCircle_2.center(), SketchLine_6.result(), 15, True) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchCircle_2.center(), SketchLine_6.result(), 15, True +) ExtrusionFuse_1.setNestedSketch(Sketch_2) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 50, 50, [model.selection("SOLID", "ExtrusionFuse_1_1"), model.selection("SOLID", "Extrusion_2_1")]) -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_1_1/To_Face")) -SketchProjection_4 = Sketch_3.addProjection(model.selection("VERTEX", "[ExtrusionFuse_1_1/Generated_Face&Sketch_2/SketchCircle_2_2][ExtrusionFuse_1_1/To_Face]__cc"), False) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [], + model.selection(), + 50, + 50, + [ + model.selection("SOLID", "ExtrusionFuse_1_1"), + model.selection("SOLID", "Extrusion_2_1"), + ], +) +Sketch_3 = model.addSketch( + Part_1_doc, model.selection("FACE", "ExtrusionFuse_1_1/To_Face") +) +SketchProjection_4 = Sketch_3.addProjection( + model.selection( + "VERTEX", + "[ExtrusionFuse_1_1/Generated_Face&Sketch_2/SketchCircle_2_2][ExtrusionFuse_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_4.createdFeature() SketchCircle_3 = Sketch_3.addCircle(-2.3396523840492e-15, 15, 5) -SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchPoint_2.result(), SketchCircle_3.center()) +SketchConstraintCoincidence_6 = Sketch_3.setCoincident( + SketchPoint_2.result(), SketchCircle_3.center() +) SketchConstraintRadius_3 = Sketch_3.setRadius(SketchCircle_3.results()[1], 5) ExtrusionCut_1.setNestedSketch(Sketch_3) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "ExtrusionCut_1_1"), model.selection("SOLID", "ExtrusionCut_1_2")], True, keepSubResults = True) +Fuse_1 = model.addFuse( + Part_1_doc, + [ + model.selection("SOLID", "ExtrusionCut_1_1"), + model.selection("SOLID", "ExtrusionCut_1_2"), + ], + True, + keepSubResults=True, +) model.do() # move groups after the final fuse Part_1_doc.moveFeature(Group_1.feature(), Fuse_1.feature()) @@ -86,6 +188,6 @@ model.end() aFactory = ModelAPI_Session.get().validators() for group in [Group_1, Group_2, Group_3]: - selectionList = group.feature().selectionList("group_list") - assert(selectionList.size() == 1) - assert(aFactory.validate(group.feature())) + selectionList = group.feature().selectionList("group_list") + assert selectionList.size() == 1 + assert aFactory.validate(group.feature()) diff --git a/src/CollectionPlugin/Test/TestGroupMove26.py b/src/CollectionPlugin/Test/TestGroupMove26.py index 2bd308e2a..48f08d6c3 100644 --- a/src/CollectionPlugin/Test/TestGroupMove26.py +++ b/src/CollectionPlugin/Test/TestGroupMove26.py @@ -28,19 +28,36 @@ 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.07512315270936, 19.52832512315271, 5.646825151450413) -SketchCircle_2 = Sketch_1.addCircle(-17.04064039408868, -4.229064039408867, 10.0065552781921) +SketchCircle_1 = Sketch_1.addCircle( + 10.07512315270936, 19.52832512315271, 5.646825151450413 +) +SketchCircle_2 = Sketch_1.addCircle( + -17.04064039408868, -4.229064039408867, 10.0065552781921 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0) -Group_1 = model.addGroup(Part_1_doc, "Solids", [model.selection("SOLID", "Extrusion_1_1")]) -RemoveResults_1 = model.addRemoveResults(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f"), + model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), + ], + model.selection(), + 10, + 0, +) +Group_1 = model.addGroup( + Part_1_doc, "Solids", [model.selection("SOLID", "Extrusion_1_1")] +) +RemoveResults_1 = model.addRemoveResults( + Part_1_doc, [model.selection("SOLID", "Extrusion_1_2")] +) model.do() Part_1_doc.moveFeature(Group_1.feature(), RemoveResults_1.feature()) model.end() aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) +assert aFactory.validate(Group_1.feature()) selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 1) +assert selectionList.size() == 1 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMoveAndSplit1.py b/src/CollectionPlugin/Test/TestGroupMoveAndSplit1.py index 753c261ad..d8a2cbc70 100644 --- a/src/CollectionPlugin/Test/TestGroupMoveAndSplit1.py +++ b/src/CollectionPlugin/Test/TestGroupMoveAndSplit1.py @@ -33,31 +33,48 @@ SketchCircle_1 = Sketch_1.addCircle(33.32502963835739, 19.24021483244179, 5) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) SketchLine_1 = Sketch_1.addLine(0, 0, 33.32502963835739, 19.24021483244179) SketchLine_1.setAuxiliary(True) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.endPoint()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchPoint_1.result() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.endPoint() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_2 = SketchProjection_2.createdFeature() -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_2.result(), SketchLine_1.result(), 30) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_2.result(), SketchLine_1.result(), 30 +) Extrusion_1.setNestedSketch(Sketch_1) -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Extrusion_1_1/To_Face")]) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OZ"), 12) +Group_1 = model.addGroup( + Part_1_doc, "Faces", [model.selection("FACE", "Extrusion_1_1/To_Face")] +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 12, +) model.do() Part_1_doc.moveFeature(Group_1.feature(), AngularCopy_1.feature(), True) model.end() # must be created 12 groups of faces, 12 results -assert(Part_1_doc.size("Groups") == 12) +assert Part_1_doc.size("Groups") == 12 for i in range(12): - resShape = modelAPI_Result(Part_1_doc.object("Groups", i)).shape() - assert(not resShape.isNull()) - # the group result is a compund, check that this is a compound of one face - aShapeExplorer = GeomAPI_ShapeExplorer(resShape, GeomAPI_Shape.FACE) - assert(aShapeExplorer.more()) - assert(aShapeExplorer.current().isFace()) - aShapeExplorer.next() - assert(not aShapeExplorer.more()) + resShape = modelAPI_Result(Part_1_doc.object("Groups", i)).shape() + assert not resShape.isNull() + # the group result is a compund, check that this is a compound of one face + aShapeExplorer = GeomAPI_ShapeExplorer(resShape, GeomAPI_Shape.FACE) + assert aShapeExplorer.more() + assert aShapeExplorer.current().isFace() + aShapeExplorer.next() + assert not aShapeExplorer.more() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMoveAndSplit2.py b/src/CollectionPlugin/Test/TestGroupMoveAndSplit2.py index f1f741dbd..9cb9f0710 100644 --- a/src/CollectionPlugin/Test/TestGroupMoveAndSplit2.py +++ b/src/CollectionPlugin/Test/TestGroupMoveAndSplit2.py @@ -28,52 +28,127 @@ 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), 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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0) -Group_1 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]")]) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 5, [model.selection("SOLID", "Extrusion_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection(), + 10, + 0, +) +Group_1 = model.addGroup( + Part_1_doc, + "Edges", + [ + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]", + ) + ], +) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, [], model.selection(), 0, 5, [model.selection("SOLID", "Extrusion_1_1")] +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]", + ), + False, +) SketchCircle_2 = SketchProjection_2.createdFeature() SketchCircle_3 = Sketch_2.addCircle(0, 10, 3) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchCircle_2.results()[1], SketchCircle_3.center()) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchCircle_2.results()[1], SketchCircle_3.center() +) SketchCircle_4 = Sketch_2.addCircle(0, -10, 3) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchCircle_2.results()[1], SketchCircle_4.center()) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchCircle_2.results()[1], SketchCircle_4.center() +) SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), True) SketchLine_1 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchLine_1.result()) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchCircle_4.center(), SketchLine_1.result()) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchCircle_3.center(), SketchLine_1.result() +) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchCircle_4.center(), SketchLine_1.result() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_3.results()[1], 3) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchCircle_3.results()[1], SketchCircle_4.results()[1]) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchCircle_3.results()[1], SketchCircle_4.results()[1] +) ExtrusionCut_1.setNestedSketch(Sketch_2) -ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 3, [model.selection("SOLID", "ExtrusionCut_1_1")]) -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face")) +ExtrusionCut_2 = model.addExtrusionCut( + Part_1_doc, + [], + model.selection(), + 0, + 3, + [model.selection("SOLID", "ExtrusionCut_1_1")], +) +Sketch_3 = model.addSketch( + Part_1_doc, + model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face"), +) SketchLine_2 = Sketch_3.addLine(10, 2, -10, 2) SketchLine_3 = Sketch_3.addLine(-10, 2, -10, -2) SketchLine_4 = Sketch_3.addLine(-10, -2, 10, -2) SketchLine_5 = Sketch_3.addLine(10, -2, 10, 2) -SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_5.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_3.setCoincident( + SketchLine_5.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_3.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_3.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_3.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchConstraintHorizontal_1 = Sketch_3.setHorizontal(SketchLine_2.result()) SketchConstraintVertical_1 = Sketch_3.setVertical(SketchLine_3.result()) SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_4.result()) SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_5.result()) -SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face])2(ExtrusionCut_1_1/Generated_Edge&ExtrusionCut_1_1/From_Face_1)2([ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchCircle_4_2])2"), False) +SketchProjection_4 = Sketch_3.addProjection( + model.selection( + "EDGE", + "([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face])2(ExtrusionCut_1_1/Generated_Edge&ExtrusionCut_1_1/From_Face_1)2([ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchCircle_4_2])2", + ), + False, +) SketchArc_1 = SketchProjection_4.createdFeature() -SketchConstraintTangent_1 = Sketch_3.setTangent(SketchLine_5.result(), SketchArc_1.results()[1]) -SketchProjection_5 = Sketch_3.addProjection(model.selection("EDGE", "([ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchCircle_4_2])(ExtrusionCut_1_1/Generated_Edge&ExtrusionCut_1_1/From_Face_3)2(ExtrusionCut_1_1/Generated_Edge&ExtrusionCut_1_1/From_Face_2)2([ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchCircle_4_2][ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face_3])2"), False) +SketchConstraintTangent_1 = Sketch_3.setTangent( + SketchLine_5.result(), SketchArc_1.results()[1] +) +SketchProjection_5 = Sketch_3.addProjection( + model.selection( + "EDGE", + "([ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchCircle_4_2])(ExtrusionCut_1_1/Generated_Edge&ExtrusionCut_1_1/From_Face_3)2(ExtrusionCut_1_1/Generated_Edge&ExtrusionCut_1_1/From_Face_2)2([ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchCircle_4_2][ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face_3])2", + ), + False, +) SketchArc_2 = SketchProjection_5.createdFeature() -SketchConstraintTangent_2 = Sketch_3.setTangent(SketchArc_2.results()[1], SketchLine_3.result()) -SketchConstraintDistanceVertical_1 = Sketch_3.setVerticalDistance(SketchAPI_Arc(SketchArc_1).center(), SketchLine_2.startPoint(), 2) -SketchConstraintDistanceVertical_2 = Sketch_3.setVerticalDistance(SketchAPI_Arc(SketchArc_1).center(), SketchLine_4.endPoint(), 2) +SketchConstraintTangent_2 = Sketch_3.setTangent( + SketchArc_2.results()[1], SketchLine_3.result() +) +SketchConstraintDistanceVertical_1 = Sketch_3.setVerticalDistance( + SketchAPI_Arc(SketchArc_1).center(), SketchLine_2.startPoint(), 2 +) +SketchConstraintDistanceVertical_2 = Sketch_3.setVerticalDistance( + SketchAPI_Arc(SketchArc_1).center(), SketchLine_4.endPoint(), 2 +) ExtrusionCut_2.setNestedSketch(Sketch_3) model.do() # move only after the first extrusion-cut @@ -81,7 +156,7 @@ Part_1_doc.setCurrentFeature(ExtrusionCut_1.feature(), True) model.do() Part_1_doc.moveFeature(Group_1.feature(), ExtrusionCut_1.feature(), True) model.end() -assert(Part_1_doc.size("Groups") == 3) # 3 edges in groups results +assert Part_1_doc.size("Groups") == 3 # 3 edges in groups results # check that simple move to the end provides 4 edges (no duplicates) model.undo() @@ -90,6 +165,6 @@ model.undo() model.begin() Part_1_doc.moveFeature(Group_1.feature(), ExtrusionCut_2.feature(), True) model.end() -assert(Part_1_doc.size("Groups") == 4) # 4 edges in groups results +assert Part_1_doc.size("Groups") == 4 # 4 edges in groups results -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMoveAndSplit3.py b/src/CollectionPlugin/Test/TestGroupMoveAndSplit3.py index 849f10510..49f9416f4 100644 --- a/src/CollectionPlugin/Test/TestGroupMoveAndSplit3.py +++ b/src/CollectionPlugin/Test/TestGroupMoveAndSplit3.py @@ -27,50 +27,112 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(-8.333743842364534, 20.52339901477833, -20.15024630541872, 20.52339901477833) -SketchLine_2 = Sketch_1.addLine(-20.15024630541872, 20.52339901477833, -20.15024630541872, 3.980295566502462) -SketchLine_3 = Sketch_1.addLine(-20.15024630541872, 3.980295566502462, -8.333743842364534, 3.980295566502462) -SketchLine_4 = Sketch_1.addLine(-8.333743842364534, 3.980295566502462, -8.333743842364534, 20.52339901477833) -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()) +SketchLine_1 = Sketch_1.addLine( + -8.333743842364534, 20.52339901477833, -20.15024630541872, 20.52339901477833 +) +SketchLine_2 = Sketch_1.addLine( + -20.15024630541872, 20.52339901477833, -20.15024630541872, 3.980295566502462 +) +SketchLine_3 = Sketch_1.addLine( + -20.15024630541872, 3.980295566502462, -8.333743842364534, 3.980295566502462 +) +SketchLine_4 = Sketch_1.addLine( + -8.333743842364534, 3.980295566502462, -8.333743842364534, 20.52339901477833 +) +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(5.721674876847291, 12.81157635467982, 6.421166795138789) +SketchCircle_1 = Sketch_1.addCircle( + 5.721674876847291, 12.81157635467982, 6.421166795138789 +) Extrusion_1.setNestedSketch(Sketch_1) -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")]) +Group_1 = model.addGroup( + Part_1_doc, + "Faces", + [ + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_1_2"), + ], +) Group_1.setName("GroupResult") Group_1.result().setName("GroupResult") Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_5 = Sketch_2.addLine(3.924377723198604, 15.23693857548147, -14.36967929032953, 15.23693857548147) -SketchLine_6 = Sketch_2.addLine(-14.36967929032953, 15.23693857548147, -14.36967929032953, 11.61585476914922) -SketchLine_7 = Sketch_2.addLine(-14.36967929032953, 11.61585476914922, 3.924377723198604, 11.61585476914922) -SketchLine_8 = Sketch_2.addLine(3.924377723198604, 11.61585476914922, 3.924377723198604, 15.23693857548147) -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()) +SketchLine_5 = Sketch_2.addLine( + 3.924377723198604, 15.23693857548147, -14.36967929032953, 15.23693857548147 +) +SketchLine_6 = Sketch_2.addLine( + -14.36967929032953, 15.23693857548147, -14.36967929032953, 11.61585476914922 +) +SketchLine_7 = Sketch_2.addLine( + -14.36967929032953, 11.61585476914922, 3.924377723198604, 11.61585476914922 +) +SketchLine_8 = Sketch_2.addLine( + 3.924377723198604, 11.61585476914922, 3.924377723198604, 15.23693857548147 +) +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()) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchLine_7f-SketchLine_8f_wire")], model.selection(), 2, 5) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")], keepSubResults = True) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "WIRE", + "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchLine_7f-SketchLine_8f_wire", + ) + ], + model.selection(), + 2, + 5, +) +Fuse_1 = model.addFuse( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_2_1"), + ], + keepSubResults=True, +) model.do() Part_1_doc.moveFeature(Group_1.feature(), Fuse_1.feature(), True) model.end() -assert(Part_1_doc.size("Groups") == 2) # 2 results because initially 2 results were selected +assert ( + Part_1_doc.size("Groups") == 2 +) # 2 results because initially 2 results were selected # check names of results from ModelAPI import * + res1 = modelAPI_Result(Part_1_doc.object("Groups", 0)) -assert(res1.data().name() == "GroupResult_1") +assert res1.data().name() == "GroupResult_1" res2 = modelAPI_Result(Part_1_doc.object("Groups", 1)) -assert(res2.data().name() == "GroupResult_2") +assert res2.data().name() == "GroupResult_2" -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupMoveAndSplit4.py b/src/CollectionPlugin/Test/TestGroupMoveAndSplit4.py index 4b8db3df2..4fb233087 100644 --- a/src/CollectionPlugin/Test/TestGroupMoveAndSplit4.py +++ b/src/CollectionPlugin/Test/TestGroupMoveAndSplit4.py @@ -29,36 +29,75 @@ 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(45.88138045990679, 57.99590690678009, 10.80094646219014) -SketchLine_1 = Sketch_1.addLine(40.23195449216883, 67.2015807394968, 46.4026355638949, 47.20754569686197) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) +SketchCircle_1 = Sketch_1.addCircle( + 45.88138045990679, 57.99590690678009, 10.80094646219014 +) +SketchLine_1 = Sketch_1.addLine( + 40.23195449216883, 67.2015807394968, 46.4026355638949, 47.20754569686197 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) model.do() -Sketch_1.changeFacesOrder([[SketchCircle_1.results()[1], SketchCircle_1.results()[1], SketchLine_1.result()], - [SketchCircle_1.results()[1], SketchLine_1.result()] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchCircle_1.results()[1], + SketchCircle_1.results()[1], + SketchLine_1.result(), + ], + [SketchCircle_1.results()[1], SketchLine_1.result()], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [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(), 10, 0) -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Extrusion_1_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1_2/To_Face")]) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OZ"), 5, keepSubResults = True) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + 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(), + 10, + 0, +) +Group_1 = model.addGroup( + Part_1_doc, + "Faces", + [ + model.selection("FACE", "Extrusion_1_1_1/To_Face"), + model.selection("FACE", "Extrusion_1_1_2/To_Face"), + ], +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("COMPSOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 5, + keepSubResults=True, +) model.do() Part_1_doc.moveFeature(Group_1.feature(), AngularCopy_1.feature(), True) model.end() # must be created 5 groups of faces, 2 faces in each -assert(Part_1_doc.size("Groups") == 5) +assert Part_1_doc.size("Groups") == 5 for i in range(5): - resShape = modelAPI_Result(Part_1_doc.object("Groups", i)).shape() - assert(not resShape.isNull()) - # the group result is a compund, check that this is a compound of two faces - aShapeExplorer = GeomAPI_ShapeExplorer(resShape, GeomAPI_Shape.FACE) - assert(aShapeExplorer.more()) - assert(aShapeExplorer.current().isFace()) - aShapeExplorer.next() - assert(aShapeExplorer.more()) - assert(aShapeExplorer.current().isFace()) - aShapeExplorer.next() - assert(not aShapeExplorer.more()) + resShape = modelAPI_Result(Part_1_doc.object("Groups", i)).shape() + assert not resShape.isNull() + # the group result is a compund, check that this is a compound of two faces + aShapeExplorer = GeomAPI_ShapeExplorer(resShape, GeomAPI_Shape.FACE) + assert aShapeExplorer.more() + assert aShapeExplorer.current().isFace() + aShapeExplorer.next() + assert aShapeExplorer.more() + assert aShapeExplorer.current().isFace() + aShapeExplorer.next() + assert not aShapeExplorer.more() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupShape.py b/src/CollectionPlugin/Test/TestGroupShape.py index 1386aaa2b..9eebd717f 100644 --- a/src/CollectionPlugin/Test/TestGroupShape.py +++ b/src/CollectionPlugin/Test/TestGroupShape.py @@ -24,9 +24,18 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")]) -Group_2 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")]) -GroupShape_1 = model.addGroupShape(Part_1_doc, [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")]) +Group_1 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")], +) +Group_2 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")], +) +GroupShape_1 = model.addGroupShape( + Part_1_doc, + [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")], +) model.end() from GeomAPI import * @@ -38,4 +47,4 @@ model.testNbSubShapes(GroupShape_1, GeomAPI_Shape.EDGE, [12]) model.testNbSubShapes(GroupShape_1, GeomAPI_Shape.VERTEX, [24]) model.testResultsVolumes(GroupShape_1, [300]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupShareTopology.py b/src/CollectionPlugin/Test/TestGroupShareTopology.py index 1013fa35f..a6c2d8bdc 100644 --- a/src/CollectionPlugin/Test/TestGroupShareTopology.py +++ b/src/CollectionPlugin/Test/TestGroupShareTopology.py @@ -25,24 +25,31 @@ 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")]) +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) +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")]) +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) +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) +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 diff --git a/src/CollectionPlugin/Test/TestGroupSubstraction.py b/src/CollectionPlugin/Test/TestGroupSubstraction.py index 3660a33f4..1df863196 100644 --- a/src/CollectionPlugin/Test/TestGroupSubstraction.py +++ b/src/CollectionPlugin/Test/TestGroupSubstraction.py @@ -24,15 +24,39 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]")] +Group_1_objects = [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), +] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) -Group_2_objects = [model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")] +Group_2_objects = [ + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]")] +Group_3_objects = [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Group_4_objects = [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]")] +Group_4_objects = [ + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), +] Group_4 = model.addGroup(Part_1_doc, Group_4_objects) -GroupSubstraction_1 = model.addGroupSubstraction(Part_1_doc, [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")], [model.selection("COMPOUND", "Group_3"), model.selection("COMPOUND", "Group_4")]) +GroupSubstraction_1 = model.addGroupSubstraction( + Part_1_doc, + [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")], + [model.selection("COMPOUND", "Group_3"), model.selection("COMPOUND", "Group_4")], +) model.end() from GeomAPI import * @@ -44,4 +68,4 @@ model.testNbSubShapes(GroupSubstraction_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(GroupSubstraction_1, GeomAPI_Shape.EDGE, [3]) model.testNbSubShapes(GroupSubstraction_1, GeomAPI_Shape.VERTEX, [6]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupSubstraction2.py b/src/CollectionPlugin/Test/TestGroupSubstraction2.py index 9a4541d8f..71a950fdc 100644 --- a/src/CollectionPlugin/Test/TestGroupSubstraction2.py +++ b/src/CollectionPlugin/Test/TestGroupSubstraction2.py @@ -28,33 +28,85 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(-30, -17.32050807568877, 30, -17.32050807568877) SketchLine_2 = Sketch_1.addLine(30, -17.32050807568877, 0, 34.64101615137755) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(0, 34.64101615137755, -30, -17.32050807568877) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_3.result()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchLine_4 = Sketch_1.addLine(30, -17.32050807568877, 0, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(0, 0, 0, 34.64101615137755) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_5.endPoint() +) SketchLine_6 = Sketch_1.addLine(-30, -17.32050807568877, 0, 0) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_6.endPoint()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_5.result()) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_6.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_6.endPoint() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_4.result(), SketchLine_5.result() +) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_4.result(), SketchLine_6.result() +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 60) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Group_1_objects = [model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_6"), model.selection("FACE", "Extrusion_1_1_3/To_Face"), model.selection("FACE", "Extrusion_1_1_3/From_Face"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_5"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_6"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_4"), model.selection("FACE", "Extrusion_1_1_2/To_Face"), model.selection("FACE", "Extrusion_1_1_2/From_Face"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_5")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Group_1_objects = [ + model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_6"), + model.selection("FACE", "Extrusion_1_1_3/To_Face"), + model.selection("FACE", "Extrusion_1_1_3/From_Face"), + model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3"), + model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_5"), + model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_6"), + model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1"), + model.selection("FACE", "Extrusion_1_1_1/From_Face"), + model.selection("FACE", "Extrusion_1_1_1/To_Face"), + model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4"), + model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_4"), + model.selection("FACE", "Extrusion_1_1_2/To_Face"), + model.selection("FACE", "Extrusion_1_1_2/From_Face"), + model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2"), + model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_5"), +] Group_1 = model.addGroup(Part_1_doc, "Faces", Group_1_objects) -Group_2 = model.addGroup(Part_1_doc, "Faces", [model.selection("SOLID", "Extrusion_1_1_2")]) -GroupSubstraction_1 = model.addGroupSubstraction(Part_1_doc, [model.selection("COMPOUND", "Group_1")], [model.selection("COMPOUND", "Group_2")]) +Group_2 = model.addGroup( + Part_1_doc, "Faces", [model.selection("SOLID", "Extrusion_1_1_2")] +) +GroupSubstraction_1 = model.addGroupSubstraction( + Part_1_doc, + [model.selection("COMPOUND", "Group_1")], + [model.selection("COMPOUND", "Group_2")], +) model.end() from GeomAPI import * @@ -66,4 +118,4 @@ model.testNbSubShapes(GroupSubstraction_1, GeomAPI_Shape.FACE, [7]) model.testNbSubShapes(GroupSubstraction_1, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(GroupSubstraction_1, GeomAPI_Shape.VERTEX, [48]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupSubstraction_Error1.py b/src/CollectionPlugin/Test/TestGroupSubstraction_Error1.py index 25d641cde..7f4fcee55 100644 --- a/src/CollectionPlugin/Test/TestGroupSubstraction_Error1.py +++ b/src/CollectionPlugin/Test/TestGroupSubstraction_Error1.py @@ -24,10 +24,22 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")]) -Group_2_objects = [model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]")] +Group_1 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")], +) +Group_2_objects = [ + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -GroupSubstraction_1 = model.addGroupSubstraction(Part_1_doc, [model.selection("COMPOUND", "Group_1")], [model.selection("COMPOUND", "Group_2")]) +GroupSubstraction_1 = model.addGroupSubstraction( + Part_1_doc, + [model.selection("COMPOUND", "Group_1")], + [model.selection("COMPOUND", "Group_2")], +) model.end() -assert(GroupSubstraction_1.feature().error() != "") +assert GroupSubstraction_1.feature().error() != "" diff --git a/src/CollectionPlugin/Test/TestGroupSubstraction_Error2.py b/src/CollectionPlugin/Test/TestGroupSubstraction_Error2.py index 26adeb6d3..f92d492e2 100644 --- a/src/CollectionPlugin/Test/TestGroupSubstraction_Error2.py +++ b/src/CollectionPlugin/Test/TestGroupSubstraction_Error2.py @@ -24,10 +24,23 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")]) -Group_2 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Front")]) -Group_3 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")]) -GroupSubstraction_1 = model.addGroupSubstraction(Part_1_doc, [model.selection("COMPOUND", "Group_1")], [model.selection("COMPOUND", "Group_2"), model.selection("COMPOUND", "Group_3")]) +Group_1 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")], +) +Group_2 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Front")], +) +Group_3 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")], +) +GroupSubstraction_1 = model.addGroupSubstraction( + Part_1_doc, + [model.selection("COMPOUND", "Group_1")], + [model.selection("COMPOUND", "Group_2"), model.selection("COMPOUND", "Group_3")], +) model.end() -assert(GroupSubstraction_1.feature().error() != "") +assert GroupSubstraction_1.feature().error() != "" diff --git a/src/CollectionPlugin/Test/TestGroupWholeFeature1.py b/src/CollectionPlugin/Test/TestGroupWholeFeature1.py index b1a5344ad..85f98e098 100644 --- a/src/CollectionPlugin/Test/TestGroupWholeFeature1.py +++ b/src/CollectionPlugin/Test/TestGroupWholeFeature1.py @@ -28,16 +28,24 @@ Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 10) Extrusion_1.setNestedSketch(Sketch_1) -Group_1 = model.addGroup(Part_1_doc, "Vertices", [model.selection("COMPOUND", "all-in-Extrusion_1")]) +Group_1 = model.addGroup( + Part_1_doc, "Vertices", [model.selection("COMPOUND", "all-in-Extrusion_1")] +) Group_1.setName("CylVertices") Group_1.result().setName("CylVertices") -Group_2 = model.addGroup(Part_1_doc, "Edges", [model.selection("COMPOUND", "all-in-Extrusion_1")]) +Group_2 = model.addGroup( + Part_1_doc, "Edges", [model.selection("COMPOUND", "all-in-Extrusion_1")] +) Group_2.setName("CylEdges") Group_2.result().setName("CylEdges") -Group_3 = model.addGroup(Part_1_doc, "Faces", [model.selection("COMPOUND", "all-in-Extrusion_1")]) +Group_3 = model.addGroup( + Part_1_doc, "Faces", [model.selection("COMPOUND", "all-in-Extrusion_1")] +) Group_3.setName("CylFaces") Group_3.result().setName("CylFaces") -Group_4 = model.addGroup(Part_1_doc, "Solids", [model.selection("COMPOUND", "all-in-Extrusion_1")]) +Group_4 = model.addGroup( + Part_1_doc, "Solids", [model.selection("COMPOUND", "all-in-Extrusion_1")] +) Group_4.setName("CylSolid") Group_4.result().setName("CylSolid") model.end() @@ -45,21 +53,26 @@ model.end() from GeomAPI import GeomAPI_ShapeIterator # group variable, type of selection, number of expected sub-shapes, sub-shapes type -test_list = [(Group_1, "Vertices", 2, 7), (Group_2, "Edges", 3, 6), (Group_3, "Faces", 3, 4), (Group_4, "Solids", 1, 2)] +test_list = [ + (Group_1, "Vertices", 2, 7), + (Group_2, "Edges", 3, 6), + (Group_3, "Faces", 3, 4), + (Group_4, "Solids", 1, 2), +] for test in test_list: - assert(test[0].groupList().selectionType() == test[1]) - assert(len(test[0].results()) == 1) - assert(test[0].result().shapeType() == "COMPOUND") + assert test[0].groupList().selectionType() == test[1] + assert len(test[0].results()) == 1 + assert test[0].result().shapeType() == "COMPOUND" - aResultShape = test[0].feature().firstResult().shape() - anIter = GeomAPI_ShapeIterator(aResultShape) - aNum = 0 - while anIter.more(): - aShape = anIter.current() - assert(aShape.shapeType() == test[3]) - aNum = aNum + 1 - anIter.next() + aResultShape = test[0].feature().firstResult().shape() + anIter = GeomAPI_ShapeIterator(aResultShape) + aNum = 0 + while anIter.more(): + aShape = anIter.current() + assert aShape.shapeType() == test[3] + aNum = aNum + 1 + anIter.next() - assert(aNum == test[2]) + assert aNum == test[2] -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupWholeFeature2.py b/src/CollectionPlugin/Test/TestGroupWholeFeature2.py index 70c9f199e..d256c61eb 100644 --- a/src/CollectionPlugin/Test/TestGroupWholeFeature2.py +++ b/src/CollectionPlugin/Test/TestGroupWholeFeature2.py @@ -27,32 +27,56 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(-12, 15, -12, -15) SketchLine_2 = Sketch_1.addLine(-12, -15, 12, 15) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(12, 15, 12, -15) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(12, -15, -12, 15) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_4.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_4f"), model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r")], model.selection(), 10, 0) -Group_1 = model.addGroup(Part_1_doc, "Vertices", [model.selection("COMPOUND", "all-in-Extrusion_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_4f" + ), + model.selection( + "FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r" + ), + ], + model.selection(), + 10, + 0, +) +Group_1 = model.addGroup( + Part_1_doc, "Vertices", [model.selection("COMPOUND", "all-in-Extrusion_1")] +) model.end() # check the group result: it must be compound of 12 vertices -assert(Group_1.groupList().selectionType() == "Vertices") -assert(len(Group_1.results()) == 1) -assert(Group_1.result().shapeType() == "COMPOUND") +assert Group_1.groupList().selectionType() == "Vertices" +assert len(Group_1.results()) == 1 +assert Group_1.result().shapeType() == "COMPOUND" from GeomAPI import GeomAPI_ShapeIterator + aResultShape = Group_1.feature().firstResult().shape() anIter = GeomAPI_ShapeIterator(aResultShape) aNum = 0 while anIter.more(): - anEdge = anIter.current() - assert(anEdge.isVertex()) - aNum = aNum + 1 - anIter.next() + anEdge = anIter.current() + assert anEdge.isVertex() + aNum = aNum + 1 + anIter.next() -assert(aNum == 12) +assert aNum == 12 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupWholeResult1.py b/src/CollectionPlugin/Test/TestGroupWholeResult1.py index 17fc87380..8b74a849d 100644 --- a/src/CollectionPlugin/Test/TestGroupWholeResult1.py +++ b/src/CollectionPlugin/Test/TestGroupWholeResult1.py @@ -28,30 +28,49 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(-16, -4, -4, 29) SketchLine_2 = Sketch_1.addLine(-4, 29, 21, -9) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(21, -9, -16, -4) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) +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_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 10, 0) -Group_1 = model.addGroup(Part_1_doc, "EDGE", [model.selection("SOLID", "Extrusion_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r" + ) + ], + model.selection(), + 10, + 0, +) +Group_1 = model.addGroup( + Part_1_doc, "EDGE", [model.selection("SOLID", "Extrusion_1_1")] +) model.end() # check the group result: it must be compound of 9 edges -assert(Group_1.groupList().selectionType() == "EDGE") -assert(len(Group_1.results()) == 1) -assert(Group_1.result().shapeType() == "COMPOUND") +assert Group_1.groupList().selectionType() == "EDGE" +assert len(Group_1.results()) == 1 +assert Group_1.result().shapeType() == "COMPOUND" from GeomAPI import GeomAPI_ShapeIterator + aResultShape = Group_1.feature().firstResult().shape() anIter = GeomAPI_ShapeIterator(aResultShape) aNum = 0 while anIter.more(): - anEdge = anIter.current() - assert(anEdge.isEdge()) - aNum = aNum + 1 - anIter.next() + anEdge = anIter.current() + assert anEdge.isEdge() + aNum = aNum + 1 + anIter.next() -assert(aNum == 9) +assert aNum == 9 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/Test/TestGroupWholeResult2.py b/src/CollectionPlugin/Test/TestGroupWholeResult2.py index a721dd4ef..4452d1a45 100644 --- a/src/CollectionPlugin/Test/TestGroupWholeResult2.py +++ b/src/CollectionPlugin/Test/TestGroupWholeResult2.py @@ -25,23 +25,36 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("COMPOUND", "all-in-Box_1")]) -Group_2 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Top")]) -GroupSubstraction_1 = model.addGroupSubstraction(Part_1_doc, [model.selection("COMPOUND", "Group_1")], [model.selection("COMPOUND", "Group_2")]) +Group_1 = model.addGroup( + Part_1_doc, "Faces", [model.selection("COMPOUND", "all-in-Box_1")] +) +Group_2 = model.addGroup( + Part_1_doc, + "Faces", + [model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Top")], +) +GroupSubstraction_1 = model.addGroupSubstraction( + Part_1_doc, + [model.selection("COMPOUND", "Group_1")], + [model.selection("COMPOUND", "Group_2")], +) model.end() aResultShape = GroupSubstraction_1.feature().firstResult().shape() from GeomAPI import GeomAPI_ShapeIterator + anIter = GeomAPI_ShapeIterator(aResultShape) aNum = 0 while anIter.more(): - aFace = anIter.current() - assert(aFace.isFace()) - aNum = aNum + 1 - anIter.next() + aFace = anIter.current() + assert aFace.isFace() + aNum = aNum + 1 + anIter.next() -assert(aNum == 4) # 6 from the whole result minus 2 from the second group (local selection) +assert ( + aNum == 4 +) # 6 from the whole result minus 2 from the second group (local selection) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/CollectionPlugin/doc/examples/field.py b/src/CollectionPlugin/doc/examples/field.py index eb4448793..18bc8774a 100644 --- a/src/CollectionPlugin/doc/examples/field.py +++ b/src/CollectionPlugin/doc/examples/field.py @@ -5,8 +5,14 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Field_1_objects = [model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Front")] -Field_1 = model.addField(Part_1_doc, 2, "DOUBLE", 2, ["Comp 1", "Comp 2"], Field_1_objects) +Field_1_objects = [ + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Front"), +] +Field_1 = model.addField( + Part_1_doc, 2, "DOUBLE", 2, ["Comp 1", "Comp 2"], Field_1_objects +) Field_1.addStep(0, 0, [[0, 0], [0.1, 0.2], [2.1, 1.7], [3.7, 1.95]]) Field_1.addStep(1, 0, [[0, 0], [0.1, 0.2], [1.1, 2.1], [0.75, 3.1]]) model.do() diff --git a/src/CollectionPlugin/doc/examples/group.py b/src/CollectionPlugin/doc/examples/group.py index 30bc64a5b..4318deac6 100644 --- a/src/CollectionPlugin/doc/examples/group.py +++ b/src/CollectionPlugin/doc/examples/group.py @@ -4,8 +4,21 @@ 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) -Group_1 = 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][Cone_1_1/Face_3]")]) +Cone_1 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 5, + 10, +) +Group_1 = 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][Cone_1_1/Face_3]"), + ], +) Group_1.result().setName("edges_cone") model.do() model.end() diff --git a/src/CollectionPlugin/doc/examples/group_addition.py b/src/CollectionPlugin/doc/examples/group_addition.py index 20f80fce8..223e17fc9 100644 --- a/src/CollectionPlugin/doc/examples/group_addition.py +++ b/src/CollectionPlugin/doc/examples/group_addition.py @@ -5,10 +5,16 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), - model.selection("FACE", "Box_1_1/Left")]) -Group_2 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Front"), - model.selection("FACE", "Box_1_1/Top")]) -GroupAddition_1 = model.addGroupAddition(Part_1_doc, [model.selection("COMPOUND", "Group_1"), - model.selection("COMPOUND", "Group_2")]) +Group_1 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")], +) +Group_2 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")], +) +GroupAddition_1 = model.addGroupAddition( + Part_1_doc, + [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")], +) model.end() diff --git a/src/CollectionPlugin/doc/examples/group_intersection.py b/src/CollectionPlugin/doc/examples/group_intersection.py index 84cb476e0..c72df3121 100644 --- a/src/CollectionPlugin/doc/examples/group_intersection.py +++ b/src/CollectionPlugin/doc/examples/group_intersection.py @@ -5,15 +5,28 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), - model.selection("FACE", "Box_1_1/Left")]) -Group_2 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Front"), - model.selection("FACE", "Box_1_1/Top")]) -Group_3 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Front"), - model.selection("FACE", "Box_1_1/Right"), - model.selection("FACE", "Box_1_1/Top")]) -GroupIntersection_1_objects = [model.selection("COMPOUND", "Group_1"), - model.selection("COMPOUND", "Group_2"), - model.selection("COMPOUND", "Group_3")] -GroupIntersection_1 = model.addGroupIntersection(Part_1_doc, GroupIntersection_1_objects) +Group_1 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")], +) +Group_2 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")], +) +Group_3 = model.addGroup( + Part_1_doc, + [ + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Right"), + model.selection("FACE", "Box_1_1/Top"), + ], +) +GroupIntersection_1_objects = [ + model.selection("COMPOUND", "Group_1"), + model.selection("COMPOUND", "Group_2"), + model.selection("COMPOUND", "Group_3"), +] +GroupIntersection_1 = model.addGroupIntersection( + Part_1_doc, GroupIntersection_1_objects +) model.end() diff --git a/src/CollectionPlugin/doc/examples/group_shape.py b/src/CollectionPlugin/doc/examples/group_shape.py index 20e4bde3f..66e90dec0 100644 --- a/src/CollectionPlugin/doc/examples/group_shape.py +++ b/src/CollectionPlugin/doc/examples/group_shape.py @@ -5,10 +5,16 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), - model.selection("FACE", "Box_1_1/Left")]) -Group_2 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Front"), - model.selection("FACE", "Box_1_1/Top")]) -GroupShape_1 = model.addGroupShape(Part_1_doc, [model.selection("COMPOUND", "Group_1"), - model.selection("COMPOUND", "Group_2")]) +Group_1 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")], +) +Group_2 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")], +) +GroupShape_1 = model.addGroupShape( + Part_1_doc, + [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")], +) model.end() diff --git a/src/CollectionPlugin/doc/examples/group_substraction.py b/src/CollectionPlugin/doc/examples/group_substraction.py index 75cf55690..a52ac66ea 100644 --- a/src/CollectionPlugin/doc/examples/group_substraction.py +++ b/src/CollectionPlugin/doc/examples/group_substraction.py @@ -5,29 +5,37 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), - model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), - model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), - model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]")] +Group_1_objects = [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), +] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) -Group_2_objects = [model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), - model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), - model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), - model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")] +Group_2_objects = [ + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), - model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), - model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), - model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]")] +Group_3_objects = [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Group_4_objects = [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), - model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), - model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), - model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]")] +Group_4_objects = [ + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), +] Group_4 = model.addGroup(Part_1_doc, Group_4_objects) -GroupSubstraction_1 = model.addGroupSubstraction(Part_1_doc, - [model.selection("COMPOUND", "Group_1"), - model.selection("COMPOUND", "Group_2")], - [model.selection("COMPOUND", "Group_3"), - model.selection("COMPOUND", "Group_4")]) +GroupSubstraction_1 = model.addGroupSubstraction( + Part_1_doc, + [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")], + [model.selection("COMPOUND", "Group_3"), model.selection("COMPOUND", "Group_4")], +) model.end() diff --git a/src/Config/Test/TestConfig.py b/src/Config/Test/TestConfig.py index eaf07f26b..3f4e2301e 100644 --- a/src/Config/Test/TestConfig.py +++ b/src/Config/Test/TestConfig.py @@ -21,33 +21,41 @@ from ModelAPI import * from ConfigAPI import * # register boolean property -Config_PropManager().registerProp("TestSection", "PropBool", "PropTitle", Config_Prop.Boolean) +Config_PropManager().registerProp( + "TestSection", "PropBool", "PropTitle", Config_Prop.Boolean +) # check property once again -Config_PropManager().registerProp("TestSection", "PropBool", "PropTitle", Config_Prop.Boolean, "true") +Config_PropManager().registerProp( + "TestSection", "PropBool", "PropTitle", Config_Prop.Boolean, "true" +) # check property value -assert(Config_PropManager().boolean("TestSection", "PropBool")) +assert Config_PropManager().boolean("TestSection", "PropBool") # register real property -Config_PropManager().registerProp("TestSection", "PropDouble", "PropTitle", Config_Prop.Double, "12,5") +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) +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) +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) +assert len(Config_PropManager().getSections()) > 0 +assert len(Config_PropManager().getProperties()) > 0 # verify the property prop = Config_PropManager().findProp("TestSection", "PropDouble") -assert(prop is not None) +assert prop is not None prop.setTitle("PropTitle") -assert(prop.title() == "PropTitle") +assert prop.title() == "PropTitle" prop.setMin("0") -assert(prop.min() == "0") +assert prop.min() == "0" prop.setMax("100") -assert(prop.max() == "100") +assert prop.max() == "100" prop.setType(Config_Prop.String) -assert(prop.type() == Config_Prop.String) +assert prop.type() == Config_Prop.String diff --git a/src/ConnectorAPI/Test/Test17917.py b/src/ConnectorAPI/Test/Test17917.py index 3d604422a..dbf54e014 100644 --- a/src/ConnectorAPI/Test/Test17917.py +++ b/src/ConnectorAPI/Test/Test17917.py @@ -18,6 +18,7 @@ # import salome + salome.standalone() salome.salome_init(1) @@ -34,10 +35,31 @@ Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Box_1_1/ 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, 45) -Group_2 = model.addGroup(Part_2_doc, "Faces", [model.selection("FACE", "Cylinder_1_1/Face_4"), model.selection("FACE", "Cylinder_1_1/Face_2")]) +Cylinder_1 = model.addCylinder( + Part_2_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, + 45, +) +Group_2 = model.addGroup( + Part_2_doc, + "Faces", + [ + model.selection("FACE", "Cylinder_1_1/Face_4"), + model.selection("FACE", "Cylinder_1_1/Face_2"), + ], +) model.do() -Placement_1 = model.addPlacement(partSet, [model.selection("COMPOUND", "Part_2/")], model.selection("FACE", "Part_2/Cylinder_1_1/Face_3"), model.selection("FACE", "Part_1/Box_1_1/Top"), False, True) +Placement_1 = model.addPlacement( + partSet, + [model.selection("COMPOUND", "Part_2/")], + model.selection("FACE", "Part_2/Cylinder_1_1/Face_3"), + model.selection("FACE", "Part_1/Box_1_1/Top"), + False, + True, +) model.do() aSession = ModelAPI_Session.get() @@ -57,8 +79,8 @@ aComp = salome.myStudy.FindComponent("GEOM") iterator = salome.myStudy.NewChildIterator(aComp) aComponents = [] while iterator.More(): - aComponents.append(iterator.Value()) - iterator.Next() + aComponents.append(iterator.Value()) + iterator.Next() assert len(aComponents) == 2 diff --git a/src/ConnectorAPI/Test/Test18887.py b/src/ConnectorAPI/Test/Test18887.py index 6eb93260a..bb3124e61 100644 --- a/src/ConnectorAPI/Test/Test18887.py +++ b/src/ConnectorAPI/Test/Test18887.py @@ -22,11 +22,13 @@ import salome salome.standalone() salome.salome_init() import salome_notebook + ### ### SHAPER component ### from SketchAPI import * from salome.shaper import model + model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) @@ -34,47 +36,95 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(30, 0, 0, 0) SketchLine_1.setAuxiliary(True) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 26) SketchLine_2.setAuxiliary(True) SketchLine_3 = Sketch_1.addLine(0, 26, 30, 26) SketchLine_3.setAuxiliary(True) SketchLine_4 = Sketch_1.addLine(30, 26, 30, 0) SketchLine_4.setAuxiliary(True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 26) -SketchBSplinePeriodic_1 = Sketch_1.addSpline(poles = [(5, 26), (-1.697788041973476e-26, 13), (5, 0), (30, 13)], periodic = True) -[SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5] = SketchBSplinePeriodic_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_5, SketchLine_6, SketchLine_7, SketchLine_8] = SketchBSplinePeriodic_1.controlPolygon(auxiliary = [0, 1, 2, 3]) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_6).startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_3.result()) +SketchBSplinePeriodic_1 = Sketch_1.addSpline( + poles=[(5, 26), (-1.697788041973476e-26, 13), (5, 0), (30, 13)], periodic=True +) +[ + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, +] = SketchBSplinePeriodic_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[ + SketchLine_5, + SketchLine_6, + SketchLine_7, + SketchLine_8, +] = SketchBSplinePeriodic_1.controlPolygon(auxiliary=[0, 1, 2, 3]) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_6).startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_3.result() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_7).endPoint(), SketchLine_4.result()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_7).endPoint(), SketchLine_4.result() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_9") -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchAPI_Line(SketchLine_7).endPoint(), SketchLine_4.result()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_6).endPoint(), SketchLine_1.result()) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchAPI_Line(SketchLine_7).endPoint(), SketchLine_4.result() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_6).endPoint(), SketchLine_1.result() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10") -SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint(SketchAPI_Line(SketchLine_6).startPoint(), SketchLine_2.result()) +SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint( + SketchAPI_Line(SketchLine_6).startPoint(), SketchLine_2.result() +) SketchLine_9 = Sketch_1.addLine(5, 26, 5, 0) SketchLine_9.setAuxiliary(True) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_9.startPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_9.endPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_9.endPoint() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_12") SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_9.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_6).endPoint(), SketchLine_2.result(), 5, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_6).endPoint(), SketchLine_2.result(), 5, True +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchBSplinePeriodic_1f")], model.selection(), 1, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchBSplinePeriodic_1f")], + model.selection(), + 1, + 0, +) model.end() ### @@ -84,7 +134,17 @@ model.publishToShaperStudy() # from the issue scenario: make fillet and two publications (caused by dump and save) model.begin() -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchBSplinePeriodic_1][Extrusion_1_1/To_Face]")], 0.4999, keepSubResults = True) +Fillet_1 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchBSplinePeriodic_1][Extrusion_1_1/To_Face]", + ) + ], + 0.4999, + keepSubResults=True, +) model.end() model.publishToShaperStudy() diff --git a/src/ConnectorAPI/Test/Test2882.py b/src/ConnectorAPI/Test/Test2882.py index 4b47dcacd..3178fa236 100644 --- a/src/ConnectorAPI/Test/Test2882.py +++ b/src/ConnectorAPI/Test/Test2882.py @@ -22,6 +22,7 @@ from SketchAPI import * from salome.shaper import model import salome + salome.standalone() salome.salome_init(1) @@ -32,57 +33,136 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(-20, -11.54700538379252, -40, 11.54700538379252) SketchLine_2 = Sketch_1.addLine(-40, 11.54700538379252, -20, 11.54700538379251) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(-20, 11.54700538379251, -40, -11.54700538379252) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(-40, -11.54700538379252, -20, -11.54700538379252) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_4.endPoint() +) SketchLine_5 = Sketch_1.addLine(-20, 11.54700538379251, -20, -11.54700538379252) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.endPoint() +) SketchLine_6 = Sketch_1.addLine(-15, 8.660254037844391, -15, -8.660254037844384) SketchLine_7 = Sketch_1.addLine(-15, -8.660254037844384, 0, 0) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(0, 0, -15, 8.660254037844391) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchLine_8.endPoint() +) SketchCircle_1 = Sketch_1.addCircle(12, 0, 10) SketchLine_9 = Sketch_1.addLine(7, 8.660254037844386, 17, 8.660254037844386) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchCircle_1.results()[1] +) SketchLine_10 = Sketch_1.addLine(7, -8.660254037844386, 17, -8.660254037844386) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_10.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_8.result(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_7.result()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_9.result(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_10.result(), SketchLine_6.endPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_4.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_10.result(), SketchLine_9.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_4.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_7.result(), SketchLine_8.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_10.result(), SketchLine_9.result()) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_1.result()) -SketchConstraintParallel_3 = Sketch_1.setParallel(SketchLine_6.result(), SketchLine_5.result()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_10.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_8.result(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_7.result() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_9.result(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_10.result(), SketchLine_6.endPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_2.result(), SketchLine_4.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_10.result(), SketchLine_9.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_4.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_7.result(), SketchLine_8.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_10.result(), SketchLine_9.result() +) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_1.result() +) +SketchConstraintParallel_3 = Sketch_1.setParallel( + SketchLine_6.result(), SketchLine_5.result() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_9.result(), 10) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_7.endPoint(), 12, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_7.endPoint(), SketchLine_5.result(), 20, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_7.endPoint(), 12, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_7.endPoint(), SketchLine_5.result(), 20, True +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_9.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) -SketchConstraintEqual_5 = Sketch_1.setEqual(SketchLine_6.result(), SketchLine_8.result()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates() +) +SketchConstraintEqual_5 = Sketch_1.setEqual( + SketchLine_6.result(), SketchLine_8.result() +) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 10, 0) -Group_1_objects = [model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_4"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_5"), 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_1"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_6"), model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7"), model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection(), + 10, + 0, +) +Group_1_objects = [ + model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_4"), + model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_5"), + 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_1"), + model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3"), + model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_6"), + model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7"), + model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8"), +] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) Group_1.setName("planar") Group_1.result().setName("planar") -Group_2 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_2/From_Face"), model.selection("FACE", "Extrusion_1_2/To_Face")]) +Group_2 = model.addGroup( + Part_1_doc, + [ + model.selection("FACE", "Extrusion_1_2/From_Face"), + model.selection("FACE", "Extrusion_1_2/To_Face"), + ], +) Group_2.setName("triangle_top_bottom") Group_2.result().setName("triangle_top_bottom") model.do() @@ -100,8 +180,8 @@ aComp = salome.myStudy.FindComponent("GEOM") iterator = salome.myStudy.NewChildIterator(aComp) aComponents = [] while iterator.More(): - aComponents.append(iterator.Value()) - iterator.Next() + aComponents.append(iterator.Value()) + iterator.Next() assert len(aComponents) == 3 diff --git a/src/ConnectorAPI/Test/Test3195.py b/src/ConnectorAPI/Test/Test3195.py index 9d8dd4eae..fec82341c 100644 --- a/src/ConnectorAPI/Test/Test3195.py +++ b/src/ConnectorAPI/Test/Test3195.py @@ -25,14 +25,20 @@ salome.salome_init() ### SHAPER component ### 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) Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Box_1_1/Left")]) -Group_2 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Box_1_1/Front")]) -GroupAddition_1 = model.addGroupAddition(Part_1_doc, [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")]) +Group_2 = model.addGroup( + Part_1_doc, "Faces", [model.selection("FACE", "Box_1_1/Front")] +) +GroupAddition_1 = model.addGroupAddition( + Part_1_doc, + [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")], +) model.end() ### @@ -43,6 +49,7 @@ model.publishToShaperStudy() # check that addition is in the SHAPERSTUDY from SHAPERSTUDY_utils import findOrCreateComponent, getStudy + c = findOrCreateComponent() aSOIter = getStudy().NewChildIterator(c) aSO = aSOIter.Value() @@ -50,4 +57,4 @@ aSOIter = getStudy().NewChildIterator(aSO) aSOIter.Next() aSOIter.Next() aSOIter.Next() -assert(aSOIter.Value().GetName() == GroupAddition_1.name()) +assert aSOIter.Value().GetName() == GroupAddition_1.name() diff --git a/src/ConnectorAPI/Test/TestExportSTL.py b/src/ConnectorAPI/Test/TestExportSTL.py index 26ee03d56..25685eb3b 100644 --- a/src/ConnectorAPI/Test/TestExportSTL.py +++ b/src/ConnectorAPI/Test/TestExportSTL.py @@ -21,11 +21,12 @@ TestExport.py Unit test of ExchangePlugin_TestExport class """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= import salome + salome.standalone() import os @@ -47,20 +48,24 @@ __updated__ = "2015-05-22" salome.salome_init(1) geompy = geomBuilder.New() -#========================================================================= + +# ========================================================================= # Help functions -#========================================================================= +# ========================================================================= def removeFile(theFileName): - try: os.remove(theFileName) - except OSError: pass - assert not os.path.exists(theFileName), \ - "Can not remove file {0}".format(theFileName) - -#========================================================================= -# test Export STL -#========================================================================= -def testExportSTL(theFile, theDelta, theErrorExpected = False): - + try: + os.remove(theFileName) + except OSError: + pass + assert not os.path.exists(theFileName), "Can not remove file {0}".format( + theFileName + ) + + +# ========================================================================= +# test Export STL +# ========================================================================= +def testExportSTL(theFile, theDelta, theErrorExpected=False): model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) @@ -75,13 +80,21 @@ def testExportSTL(theFile, theDelta, theErrorExpected = False): theSurface = 600 - print("theFile=",theFile) + print("theFile=", theFile) + + # deflection relative 0.0001 et Ascii + model.exportToSTL( + Part_1_doc, + theFile, + model.selection("SOLID", "Box_1_1"), + 0.0001, + 0.5, + True, + False, + ) - # deflection relative 0.0001 et Ascii - model.exportToSTL(Part_1_doc, theFile, model.selection("SOLID","Box_1_1"),0.0001, 0.5, True,False) + # == assert os.path.exists(theFile) - #== assert os.path.exists(theFile) - # Check results test_stl_1 = geompy.ImportSTL(theFile) Props = geompy.BasicProperties(test_stl_1) @@ -92,13 +105,25 @@ def testExportSTL(theFile, theDelta, theErrorExpected = False): aRefSurface = theSurface aResSurface = Props[1] - assert (math.fabs(aResSurface - aRefSurface) < theDelta), "The volume is wrong: expected = {0}, real = {1}".format(aRefSurface, aResSurface) - + assert ( + math.fabs(aResSurface - aRefSurface) < theDelta + ), "The volume is wrong: expected = {0}, real = {1}".format( + aRefSurface, aResSurface + ) + removeFile(theFile) - theSurface = 600 + theSurface = 600 # deflection relative 0.0001 et binaire - model.exportToSTL(Part_1_doc, theFile, model.selection("SOLID", "Box_1_1" ),0.0001, 0.5, True,True) + model.exportToSTL( + Part_1_doc, + theFile, + model.selection("SOLID", "Box_1_1"), + 0.0001, + 0.5, + True, + True, + ) # Check results test_stl_1 = geompy.ImportSTL(theFile) @@ -110,13 +135,25 @@ def testExportSTL(theFile, theDelta, theErrorExpected = False): aRefSurface = theSurface aResSurface = Props[1] - assert (math.fabs(aResSurface - aRefSurface) < theDelta), "The volume is wrong: expected = {0}, real = {1}".format(aRefSurface, aResSurface) - + assert ( + math.fabs(aResSurface - aRefSurface) < theDelta + ), "The volume is wrong: expected = {0}, real = {1}".format( + aRefSurface, aResSurface + ) + removeFile(theFile) - theSurface = 600 + theSurface = 600 # deflection absolue et AScii - model.exportToSTL(Part_1_doc, theFile, model.selection("SOLID", "Box_1_1" ),0.0001, 0.5, False, False) + model.exportToSTL( + Part_1_doc, + theFile, + model.selection("SOLID", "Box_1_1"), + 0.0001, + 0.5, + False, + False, + ) # Check results test_stl_1 = geompy.ImportSTL(theFile) @@ -128,11 +165,23 @@ def testExportSTL(theFile, theDelta, theErrorExpected = False): aRefSurface = theSurface aResSurface = Props[1] - assert (math.fabs(aResSurface - aRefSurface) < theDelta), "The volume is wrong: expected = {0}, real = {1}".format(aRefSurface, aResSurface) + assert ( + math.fabs(aResSurface - aRefSurface) < theDelta + ), "The volume is wrong: expected = {0}, real = {1}".format( + aRefSurface, aResSurface + ) - theSurface = 600 + theSurface = 600 # deflection absolue et binaire - model.exportToSTL(Part_1_doc, theFile, model.selection("SOLID", "Box_1_1" ),0.0001, 0.5, False,True) + model.exportToSTL( + Part_1_doc, + theFile, + model.selection("SOLID", "Box_1_1"), + 0.0001, + 0.5, + False, + True, + ) # Check results test_stl_1 = geompy.ImportSTL(theFile) @@ -144,17 +193,22 @@ def testExportSTL(theFile, theDelta, theErrorExpected = False): aRefSurface = theSurface aResSurface = Props[1] - assert (math.fabs(aResSurface - aRefSurface) < theDelta), "The volume is wrong: expected = {0}, real = {1}".format(aRefSurface, aResSurface) + assert ( + math.fabs(aResSurface - aRefSurface) < theDelta + ), "The volume is wrong: expected = {0}, real = {1}".format( + aRefSurface, aResSurface + ) model.end() -if __name__ == '__main__': + +if __name__ == "__main__": with TemporaryDirectory() as tmp_dir: aRealSurface = 0.00192878 - #========================================================================= + # ========================================================================= # Export a shape into STL - #========================================================================= - testExportSTL(os.path.join(tmp_dir, "export.stl"), 10 ** -5, True) - #========================================================================= + # ========================================================================= + testExportSTL(os.path.join(tmp_dir, "export.stl"), 10**-5, True) + # ========================================================================= # End of test - #========================================================================= + # ========================================================================= diff --git a/src/ConnectorAPI/Test/TestExportToGEOM.py b/src/ConnectorAPI/Test/TestExportToGEOM.py index 3628b69d3..16117d077 100644 --- a/src/ConnectorAPI/Test/TestExportToGEOM.py +++ b/src/ConnectorAPI/Test/TestExportToGEOM.py @@ -25,46 +25,51 @@ import tempfile salome.standalone() from salome.geom import geomBuilder + salome.salome_init(1) geompy = geomBuilder.New() + ## Get the last object published in the GEOM section of the object browser def getLastGEOMShape(): - sb = salome.myStudy.NewBuilder() - comp = salome.myStudy.FindComponent("GEOM") - obj = None - if comp: - iterator = salome.myStudy.NewChildIterator( comp ) - sobj = None - while iterator.More(): - sobj = iterator.Value() - iterator.Next() - if sobj: - obj = sobj.GetObject() - else: - raise Exception("GEOM component not found.") - return obj + sb = salome.myStudy.NewBuilder() + comp = salome.myStudy.FindComponent("GEOM") + obj = None + if comp: + iterator = salome.myStudy.NewChildIterator(comp) + sobj = None + while iterator.More(): + sobj = iterator.Value() + iterator.Next() + if sobj: + obj = sobj.GetObject() + else: + raise Exception("GEOM component not found.") + return obj + ## Get the sub-object i of an object in the object browser # Numerotation starts at 1 def getSubObject(obj, i): - ok, sub_sobj = salome.ObjectToSObject(obj).FindSubObject(i) - if not ok: - raise Exception("No child found at %i for %s"%(i, obj.GetName())) - sub_obj = sub_sobj.GetObject() - return sub_obj + ok, sub_sobj = salome.ObjectToSObject(obj).FindSubObject(i) + if not ok: + raise Exception("No child found at %i for %s" % (i, obj.GetName())) + sub_obj = sub_sobj.GetObject() + return sub_obj + def dumpShaper(fileName): - model.begin() - dump=model.moduleDocument().addFeature("Dump") - dump.string("file_path").setValue(fileName) - dump.string("file_format").setValue("py") - dump.boolean("topological_naming").setValue(True) - dump.boolean("geometric_selection").setValue(False) - dump.boolean("weak_naming").setValue(False) - model.do() - model.end() - pass + model.begin() + dump = model.moduleDocument().addFeature("Dump") + dump.string("file_path").setValue(fileName) + dump.string("file_format").setValue("py") + dump.boolean("topological_naming").setValue(True) + dump.boolean("geometric_selection").setValue(False) + dump.boolean("weak_naming").setValue(False) + model.do() + model.end() + pass + # Create 2 boxes # Create a group of faces @@ -73,69 +78,89 @@ def dumpShaper(fileName): # Check the result # Check the dump def testSeveralExportsToGEOM(): - - 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, 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", "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() - - # First export to GEOM - model.exportToGEOM(Part_1_doc) - model.end() - - # Check that the GEOM object has 1 compsolid and 2 solids - geomObject_1 = getLastGEOMShape() - assert geompy.NumberOfSubShapes(geomObject_1, geompy.ShapeType["COMPSOLID"]) == 1 - assert geompy.NumberOfSolids(geomObject_1) == 2 - - # Check that the group has 2 faces - geomGroup_1 = getSubObject(geomObject_1, 1) - assert geompy.NumberOfFaces(geomGroup_1) == 2 - - # Add a third box - model.begin() - 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) - model.do() - - # Second export to GEOM - model.exportToGEOM(Part_1_doc) - model.end() - - # Check that the last exported GEOM object is 1 solids - geomObject_2 = getLastGEOMShape() - assert geompy.NumberOfSolids(geomObject_2) == 1 - - # Dump the salome study (only CORBA modules, SHAPER dump is not in it) - tempdir = tempfile.gettempdir() - dumpFileGeomBase = "dump_test_geom" - dumpFileGeom = os.path.join(tempdir, "%s.py"%dumpFileGeomBase) - salome.myStudy.DumpStudy(tempdir, dumpFileGeomBase, True, False) - - # Dump SHAPER - dumpFileShaper = os.path.join(tempdir, "dump_test_shaper.py") - dumpShaper(dumpFileShaper) - - # Load SHAPER dump - exec(compile(open(dumpFileShaper).read(), dumpFileShaper, 'exec')) - - # Load GEOM dump - exec(compile(open(dumpFileGeom).read(), dumpFileGeom, 'exec')) - - # Clean files - files = [dumpFileGeom, dumpFileShaper] - for f in files: - os.remove(f) - - pass - - - -if __name__ == '__main__': - testSeveralExportsToGEOM() + 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, 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", "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() + + # First export to GEOM + model.exportToGEOM(Part_1_doc) + model.end() + + # Check that the GEOM object has 1 compsolid and 2 solids + geomObject_1 = getLastGEOMShape() + assert geompy.NumberOfSubShapes(geomObject_1, geompy.ShapeType["COMPSOLID"]) == 1 + assert geompy.NumberOfSolids(geomObject_1) == 2 + + # Check that the group has 2 faces + geomGroup_1 = getSubObject(geomObject_1, 1) + assert geompy.NumberOfFaces(geomGroup_1) == 2 + + # Add a third box + model.begin() + 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, + ) + model.do() + + # Second export to GEOM + model.exportToGEOM(Part_1_doc) + model.end() + + # Check that the last exported GEOM object is 1 solids + geomObject_2 = getLastGEOMShape() + assert geompy.NumberOfSolids(geomObject_2) == 1 + + # Dump the salome study (only CORBA modules, SHAPER dump is not in it) + tempdir = tempfile.gettempdir() + dumpFileGeomBase = "dump_test_geom" + dumpFileGeom = os.path.join(tempdir, "%s.py" % dumpFileGeomBase) + salome.myStudy.DumpStudy(tempdir, dumpFileGeomBase, True, False) + + # Dump SHAPER + dumpFileShaper = os.path.join(tempdir, "dump_test_shaper.py") + dumpShaper(dumpFileShaper) + + # Load SHAPER dump + exec(compile(open(dumpFileShaper).read(), dumpFileShaper, "exec")) + + # Load GEOM dump + exec(compile(open(dumpFileGeom).read(), dumpFileGeom, "exec")) + + # Clean files + files = [dumpFileGeom, dumpFileShaper] + for f in files: + os.remove(f) + + pass + + +if __name__ == "__main__": + testSeveralExportsToGEOM() diff --git a/src/ConnectorAPI/Test/TestExportToGEOMAllGroupsAndFields.py b/src/ConnectorAPI/Test/TestExportToGEOMAllGroupsAndFields.py index 1ced591d5..f1e8f02eb 100644 --- a/src/ConnectorAPI/Test/TestExportToGEOMAllGroupsAndFields.py +++ b/src/ConnectorAPI/Test/TestExportToGEOMAllGroupsAndFields.py @@ -30,179 +30,421 @@ theStudy = salome.myStudy from salome.shaper import model from salome.geom import geomBuilder + geompy = geomBuilder.New() + ## Get the last object published in the GEOM section of the object browser def getLastGEOMShape(): - sb = salome.myStudy.NewBuilder() - comp = salome.myStudy.FindComponent("GEOM") - obj = None - if comp: - iterator = salome.myStudy.NewChildIterator( comp ) - sobj = None - while iterator.More(): - sobj = iterator.Value() - iterator.Next() - if sobj: - obj = sobj.GetObject() - else: - raise Exception("GEOM component not found.") - return obj + sb = salome.myStudy.NewBuilder() + comp = salome.myStudy.FindComponent("GEOM") + obj = None + if comp: + iterator = salome.myStudy.NewChildIterator(comp) + sobj = None + while iterator.More(): + sobj = iterator.Value() + iterator.Next() + if sobj: + obj = sobj.GetObject() + else: + raise Exception("GEOM component not found.") + return obj + ## Get the sub-object i of an object in the object browser # Numerotation starts at 1 def getSubObject(obj, i): - ok, sub_sobj = salome.ObjectToSObject(obj).FindSubObject(i) - if not ok: - raise Exception("No child found at %i for %s"%(i, obj.GetName())) - sub_obj = sub_sobj.GetObject() - return sub_obj + ok, sub_sobj = salome.ObjectToSObject(obj).FindSubObject(i) + if not ok: + raise Exception("No child found at %i for %s" % (i, obj.GetName())) + sub_obj = sub_sobj.GetObject() + return sub_obj + def dumpShaper(fileName): - model.begin() - dump=model.moduleDocument().addFeature("Dump") - dump.string("file_path").setValue(fileName) - dump.string("file_format").setValue("py") - dump.boolean("topological_naming").setValue(True) - dump.boolean("geometric_selection").setValue(False) - dump.boolean("weak_naming").setValue(False) - model.do() - model.end() - pass + model.begin() + dump = model.moduleDocument().addFeature("Dump") + dump.string("file_path").setValue(fileName) + dump.string("file_format").setValue("py") + dump.boolean("topological_naming").setValue(True) + dump.boolean("geometric_selection").setValue(False) + dump.boolean("weak_naming").setValue(False) + model.do() + model.end() + pass + def testGroupsAndFieldsExportToGEOM(): - 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, 20, 20, 20) - Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), -10) - Translation_1.result().setName("Translation_1_1") - Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Translation_1_1"), model.selection("SOLID", "Box_2_1")]) - Partition_1.result().setName("Partition_1_1") - 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/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&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/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")]) - Group_4.result().setName("solids_small") - Field_1_objects = [model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Partition_1_1_2"), model.selection("SOLID", "Translation_2_1")] - 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&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/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/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]]) - model.do() - model.exportToGEOM(Part_1_doc) - model.end() + 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, 20, 20, 20) + Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + -10, + ) + Translation_1.result().setName("Translation_1_1") + Partition_1 = model.addPartition( + Part_1_doc, + [ + model.selection("SOLID", "Translation_1_1"), + model.selection("SOLID", "Box_2_1"), + ], + ) + Partition_1.result().setName("Partition_1_1") + 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/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&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/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"), + ], + ) + Group_4.result().setName("solids_small") + Field_1_objects = [ + model.selection("SOLID", "Partition_1_1_1"), + model.selection("SOLID", "Partition_1_1_2"), + model.selection("SOLID", "Translation_2_1"), + ] + 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&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/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/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], + ], + ) + model.do() + model.exportToGEOM(Part_1_doc) + model.end() + # check the groups content by the coordinates of a point on its sub-shapes def checkGroupByCoords(group, coords, tolerance=1e-7): - for coord in coords: - p = geompy.MakeVertex(*coord) - assert geompy.MinDistance(group, p) < tolerance - pass + for coord in coords: + p = geompy.MakeVertex(*coord) + assert geompy.MinDistance(group, p) < tolerance + pass + ## Check the result imported in GEOM def checkResultInGEOM(): - geomObject_1 = getLastGEOMShape() # the second, translation result + geomObject_1 = getLastGEOMShape() # the second, translation result - group_1_GEOM = getSubObject(geomObject_1, 1) - assert group_1_GEOM.GetName() == 'faces_top' - assert geompy.NumberOfFaces(group_1_GEOM) == 1 # 2 faces are in the first result, only one here + group_1_GEOM = getSubObject(geomObject_1, 1) + assert group_1_GEOM.GetName() == "faces_top" + assert ( + geompy.NumberOfFaces(group_1_GEOM) == 1 + ) # 2 faces are in the first result, only one here - # coordinates of the barycenters of the faces of Group_1 - coords_1 = [[25, 5, 10]] - checkGroupByCoords(group_1_GEOM, coords_1) + # coordinates of the barycenters of the faces of Group_1 + coords_1 = [[25, 5, 10]] + checkGroupByCoords(group_1_GEOM, coords_1) - group_2_GEOM = getSubObject(geomObject_1, 2) - assert group_2_GEOM.GetName() == 'edges_x' - assert geompy.NumberOfEdges(group_2_GEOM) == 1 # 2 edges are in the first result, only one here + group_2_GEOM = getSubObject(geomObject_1, 2) + assert group_2_GEOM.GetName() == "edges_x" + assert ( + geompy.NumberOfEdges(group_2_GEOM) == 1 + ) # 2 edges are in the first result, only one here - # coordinates of the barycenters of the edges of Group_2 - coords_2 = [[25, 0, 0]] - checkGroupByCoords(group_2_GEOM, coords_2) + # coordinates of the barycenters of the edges of Group_2 + coords_2 = [[25, 0, 0]] + checkGroupByCoords(group_2_GEOM, coords_2) - group_3_GEOM = getSubObject(geomObject_1, 3) - assert group_3_GEOM.GetName() == 'vertices_bottom' - assert geompy.NumberOfSubShapes(group_3_GEOM, geompy.ShapeType["VERTEX"]) == 3 # 3 of 8 + group_3_GEOM = getSubObject(geomObject_1, 3) + assert group_3_GEOM.GetName() == "vertices_bottom" + assert ( + geompy.NumberOfSubShapes(group_3_GEOM, geompy.ShapeType["VERTEX"]) == 3 + ) # 3 of 8 - # coordinates of the points of of Group_3 - coords_3 = [[20, 10, 0], [30, 10, 0], [30, 0, 0]] - checkGroupByCoords(group_3_GEOM, coords_3) + # coordinates of the points of of Group_3 + coords_3 = [[20, 10, 0], [30, 10, 0], [30, 0, 0]] + checkGroupByCoords(group_3_GEOM, coords_3) - group_4_GEOM = getSubObject(geomObject_1, 4) - assert group_4_GEOM.GetName() == 'solids_small' - assert geompy.NumberOfSolids(group_4_GEOM) == 1 # 1 of 2 + group_4_GEOM = getSubObject(geomObject_1, 4) + assert group_4_GEOM.GetName() == "solids_small" + assert geompy.NumberOfSolids(group_4_GEOM) == 1 # 1 of 2 - # coordinates of the barycenters of the solids of Group_4 - coords_4 = [[25, 5, 5]] - checkGroupByCoords(group_4_GEOM, coords_4) + # coordinates of the barycenters of the solids of Group_4 + coords_4 = [[25, 5, 5]] + checkGroupByCoords(group_4_GEOM, coords_4) - field_1_GEOM = getSubObject(geomObject_1, 5) - assert field_1_GEOM.GetName() == 'Field_solids' - assert field_1_GEOM.GetStep(1).GetValues() == [3.0] + field_1_GEOM = getSubObject(geomObject_1, 5) + assert field_1_GEOM.GetName() == "Field_solids" + assert field_1_GEOM.GetStep(1).GetValues() == [3.0] - field_2_GEOM = getSubObject(geomObject_1, 6) - assert field_2_GEOM.GetName() == 'Field_faces' - assert field_2_GEOM.GetStep(1).GetValues() == [0.0, 0.0, 0.0, 0.0, 1.0, 2.0] + field_2_GEOM = getSubObject(geomObject_1, 6) + assert field_2_GEOM.GetName() == "Field_faces" + assert field_2_GEOM.GetStep(1).GetValues() == [0.0, 0.0, 0.0, 0.0, 1.0, 2.0] - field_3_GEOM = getSubObject(geomObject_1, 7) - assert field_3_GEOM.GetName() == 'Field_edges' - assert field_3_GEOM.GetStep(1).GetValues() == [0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 2.0, 0.0, 1.0, 0.0, 0.0, 0.0] + field_3_GEOM = getSubObject(geomObject_1, 7) + assert field_3_GEOM.GetName() == "Field_edges" + assert field_3_GEOM.GetStep(1).GetValues() == [ + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 2.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + ] - field_4_GEOM = getSubObject(geomObject_1, 8) - assert field_4_GEOM.GetName() == 'Field_vertices' - assert field_4_GEOM.GetStep(1).GetValues() == [0.0, 0.0, 0.0, 1.0, 3.0, 1.0, 3.0, 1.0] + field_4_GEOM = getSubObject(geomObject_1, 8) + assert field_4_GEOM.GetName() == "Field_vertices" + assert field_4_GEOM.GetStep(1).GetValues() == [ + 0.0, + 0.0, + 0.0, + 1.0, + 3.0, + 1.0, + 3.0, + 1.0, + ] + + pass - pass def checkDump(): - # Dump the salome study (only CORBA modules, SHAPER dump is not in it) - with tempfile.TemporaryDirectory() as tempdir: - dumpFileGeomBase = "dump_test_geom" - dumpFileGeom = os.path.join(tempdir, "%s.py"%dumpFileGeomBase) - salome.myStudy.DumpStudy(tempdir, dumpFileGeomBase, True, False) - - # Dump SHAPER - dumpFileShaper = os.path.join(tempdir, "dump_test_shaper.py") - dumpShaper(dumpFileShaper) - - # Load SHAPER dump - exec(compile(open(dumpFileShaper).read(), dumpFileShaper, 'exec')) - - # Load GEOM dump - exec(compile(open(dumpFileGeom).read(), dumpFileGeom, 'exec')) - - # Clean files - files = [dumpFileGeom, dumpFileShaper] - pass - -if __name__ == '__main__': - # create 3 boxes with groups and fields - testGroupsAndFieldsExportToGEOM() - # check the result in GEOM - checkResultInGEOM() - # check that dump produces no error and can be reloaded - checkDump() - # check the result of the dump - checkResultInGEOM() + # Dump the salome study (only CORBA modules, SHAPER dump is not in it) + with tempfile.TemporaryDirectory() as tempdir: + dumpFileGeomBase = "dump_test_geom" + dumpFileGeom = os.path.join(tempdir, "%s.py" % dumpFileGeomBase) + salome.myStudy.DumpStudy(tempdir, dumpFileGeomBase, True, False) + + # Dump SHAPER + dumpFileShaper = os.path.join(tempdir, "dump_test_shaper.py") + dumpShaper(dumpFileShaper) + + # Load SHAPER dump + exec(compile(open(dumpFileShaper).read(), dumpFileShaper, "exec")) + + # Load GEOM dump + exec(compile(open(dumpFileGeom).read(), dumpFileGeom, "exec")) + + # Clean files + files = [dumpFileGeom, dumpFileShaper] + pass + + +if __name__ == "__main__": + # create 3 boxes with groups and fields + testGroupsAndFieldsExportToGEOM() + # check the result in GEOM + checkResultInGEOM() + # check that dump produces no error and can be reloaded + checkDump() + # check the result of the dump + checkResultInGEOM() diff --git a/src/ConnectorAPI/Test/TestExportToGEOMPartSet.py b/src/ConnectorAPI/Test/TestExportToGEOMPartSet.py index 461fed024..b738fd322 100644 --- a/src/ConnectorAPI/Test/TestExportToGEOMPartSet.py +++ b/src/ConnectorAPI/Test/TestExportToGEOMPartSet.py @@ -27,27 +27,30 @@ import tempfile salome.standalone() from salome.geom import geomBuilder + salome.salome_init(1) geompy = geomBuilder.New() + ## Get the last object published in the GEOM section of the object browser def getGEOMShape(index): - sb = salome.myStudy.NewBuilder() - comp = salome.myStudy.FindComponent("GEOM") - obj = None - if comp: - iterator = salome.myStudy.NewChildIterator( comp ) - sobj = None - i = index + 1 - while iterator.More() and i: - sobj = iterator.Value() - iterator.Next() - i = i - 1 - if i == 0 and sobj: - obj = sobj.GetObject() - else: - raise Exception("GEOM component " + str(index) + " not found.") - return obj + sb = salome.myStudy.NewBuilder() + comp = salome.myStudy.FindComponent("GEOM") + obj = None + if comp: + iterator = salome.myStudy.NewChildIterator(comp) + sobj = None + i = index + 1 + while iterator.More() and i: + sobj = iterator.Value() + iterator.Next() + i = i - 1 + if i == 0 and sobj: + obj = sobj.GetObject() + else: + raise Exception("GEOM component " + str(index) + " not found.") + return obj + # create 4 parts: # just an extrusiob @@ -61,14 +64,24 @@ Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(7, 0, 0, 0) SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Origin"), False) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 9) SketchLine_3 = Sketch_1.addLine(0, 9, 7, 9) SketchLine_4 = Sketch_1.addLine(7, 9, 7, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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()) @@ -76,31 +89,79 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 7) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_4.result(), 9) SketchCircle_1 = Sketch_1.addCircle(3, 5, 2) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchCircle_1.center(), SketchLine_1.startPoint(), 5) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchCircle_1.center(), SketchLine_1.endPoint(), 3) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchCircle_1.center(), SketchLine_1.startPoint(), 5 +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchCircle_1.center(), SketchLine_1.endPoint(), 3 +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 2) 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-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r-SketchCircle_1_2r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "PartSet/Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r-SketchCircle_1_2r", + ) + ], + model.selection(), + 10, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() -Extrusion_2 = model.addExtrusion(Part_2_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0) -Group_1 = model.addGroup(Part_2_doc, [model.selection("FACE", "Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchCircle_1_2"), model.selection("FACE", "Extrusion_1_1/To_Face")]) +Extrusion_2 = model.addExtrusion( + Part_2_doc, + [model.selection("FACE", "PartSet/Sketch_1/Face-SketchCircle_1_2f")], + model.selection(), + 10, + 0, +) +Group_1 = model.addGroup( + Part_2_doc, + [ + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchCircle_1_2" + ), + model.selection("FACE", "Extrusion_1_1/To_Face"), + ], +) model.do() Part_3 = model.addPart(partSet) Part_3_doc = Part_3.document() -Polyline_1_objects = [model.selection("VERTEX", "PartSet/Sketch_1/SketchLine_3_StartVertex"), model.selection("VERTEX", "PartSet/Sketch_1/SketchLine_4_EndVertex"), model.selection("VERTEX", "PartSet/Sketch_1/SketchLine_3_EndVertex")] +Polyline_1_objects = [ + model.selection("VERTEX", "PartSet/Sketch_1/SketchLine_3_StartVertex"), + model.selection("VERTEX", "PartSet/Sketch_1/SketchLine_4_EndVertex"), + model.selection("VERTEX", "PartSet/Sketch_1/SketchLine_3_EndVertex"), +] Polyline_1 = model.addPolyline3D(Part_3_doc, Polyline_1_objects, True) -Field_1_objects = [model.selection("VERTEX", "[Polyline_1_1/Generated_Edge&PartSet/Sketch_1/SketchLine_3_StartVertex]e[Polyline_1_1/Generated_Edge&PartSet/Sketch_1/SketchLine_4_EndVertex]e"), model.selection("VERTEX", "[Polyline_1_1/Generated_Edge&PartSet/Sketch_1/SketchLine_4_EndVertex]e[Polyline_1_1/Generated_Edge&PartSet/Sketch_1/SketchLine_3_EndVertex]e"), model.selection("VERTEX", "[Polyline_1_1/Generated_Edge&PartSet/Sketch_1/SketchLine_3_StartVertex]e[Polyline_1_1/Generated_Edge&PartSet/Sketch_1/SketchLine_3_EndVertex]e")] +Field_1_objects = [ + model.selection( + "VERTEX", + "[Polyline_1_1/Generated_Edge&PartSet/Sketch_1/SketchLine_3_StartVertex]e[Polyline_1_1/Generated_Edge&PartSet/Sketch_1/SketchLine_4_EndVertex]e", + ), + model.selection( + "VERTEX", + "[Polyline_1_1/Generated_Edge&PartSet/Sketch_1/SketchLine_4_EndVertex]e[Polyline_1_1/Generated_Edge&PartSet/Sketch_1/SketchLine_3_EndVertex]e", + ), + model.selection( + "VERTEX", + "[Polyline_1_1/Generated_Edge&PartSet/Sketch_1/SketchLine_3_StartVertex]e[Polyline_1_1/Generated_Edge&PartSet/Sketch_1/SketchLine_3_EndVertex]e", + ), +] Field_1 = model.addField(Part_3_doc, 2, "DOUBLE", 1, ["Comp 1"], Field_1_objects) Field_1.addStep(0, 0, [[1.5], [1.1], [2.4], [3]]) Field_1.addStep(1, 2, [[1], [7], [5], [1.9]]) model.do() Part_4 = model.addPart(partSet) Part_4_doc = Part_4.document() -Point_2 = model.addPoint(Part_4_doc, model.selection("EDGE", "PartSet/Sketch_1/SketchCircle_1_2")) +Point_2 = model.addPoint( + Part_4_doc, model.selection("EDGE", "PartSet/Sketch_1/SketchCircle_1_2") +) model.end() # Activate Partset to export to geom all Parts with group and filed where it is needed @@ -120,29 +181,29 @@ model.end() # extrusion with group of the second part # extrusion with filed of the third part shape1 = getGEOMShape(0) -assert(shape1) -assert(shape1.GetName() == "Part_1") -assert(geompy.NumberOfSolids(shape1) == 1) -assert(not salome.ObjectToSObject(shape1).FindSubObject(1)[1]) +assert shape1 +assert shape1.GetName() == "Part_1" +assert geompy.NumberOfSolids(shape1) == 1 +assert not salome.ObjectToSObject(shape1).FindSubObject(1)[1] shape2 = getGEOMShape(1) -assert(shape2) -assert(shape2.GetName() == "Part_2") -assert(geompy.NumberOfSolids(shape2) == 1) +assert shape2 +assert shape2.GetName() == "Part_2" +assert geompy.NumberOfSolids(shape2) == 1 group = salome.ObjectToSObject(shape2).FindSubObject(1)[1].GetObject() -assert(group) -assert(group.GetName() == "Group_1") -assert(geompy.NumberOfFaces(group) == 2) +assert group +assert group.GetName() == "Group_1" +assert geompy.NumberOfFaces(group) == 2 shape3 = getGEOMShape(2) -assert(shape3) -assert(shape3.GetName() == "Part_3") -assert(geompy.NumberOfSolids(shape3) == 0) -assert(geompy.NumberOfSubShapes(shape3, geompy.ShapeType["VERTEX"]) == 3) +assert shape3 +assert shape3.GetName() == "Part_3" +assert geompy.NumberOfSolids(shape3) == 0 +assert geompy.NumberOfSubShapes(shape3, geompy.ShapeType["VERTEX"]) == 3 field = salome.ObjectToSObject(shape3).FindSubObject(1)[1].GetObject() -assert(field) -assert(field.GetName() == "Field_1") -assert(field.GetSteps() == [1, 2]) +assert field +assert field.GetName() == "Field_1" +assert field.GetSteps() == [1, 2] shape4 = getGEOMShape(3) -assert(not shape4) +assert not shape4 diff --git a/src/ConnectorAPI/Test/TestExportToGEOMWholeFeature.py b/src/ConnectorAPI/Test/TestExportToGEOMWholeFeature.py index 05f601dde..cee76d03b 100644 --- a/src/ConnectorAPI/Test/TestExportToGEOMWholeFeature.py +++ b/src/ConnectorAPI/Test/TestExportToGEOMWholeFeature.py @@ -27,105 +27,159 @@ import tempfile salome.standalone() from salome.geom import geomBuilder + salome.salome_init(1) geompy = geomBuilder.New() + ## Get the last object published in the GEOM section of the object browser def getGEOMShape(index): - sb = salome.myStudy.NewBuilder() - comp = salome.myStudy.FindComponent("GEOM") - obj = None - if comp: - iterator = salome.myStudy.NewChildIterator( comp ) - sobj = None - i = index + 1 - while iterator.More() and i: - sobj = iterator.Value() - iterator.Next() - i = i - 1 - if i == 0 and sobj: - obj = sobj.GetObject() - else: - raise Exception("GEOM component " + str(index) + " not found.") - return obj + sb = salome.myStudy.NewBuilder() + comp = salome.myStudy.FindComponent("GEOM") + obj = None + if comp: + iterator = salome.myStudy.NewChildIterator(comp) + sobj = None + i = index + 1 + while iterator.More() and i: + sobj = iterator.Value() + iterator.Next() + i = i - 1 + if i == 0 and sobj: + obj = sobj.GetObject() + else: + raise Exception("GEOM component " + str(index) + " not found.") + return obj + ## Get the sub-object i of an object in the object browser # Numerotation starts at 1 def getSubObject(obj, i): - ok, sub_sobj = salome.ObjectToSObject(obj).FindSubObject(i) - if not ok: - raise Exception("No child found at %i for %s"%(i, obj.GetName())) - sub_obj = sub_sobj.GetObject() - return sub_obj + ok, sub_sobj = salome.ObjectToSObject(obj).FindSubObject(i) + if not ok: + raise Exception("No child found at %i for %s" % (i, obj.GetName())) + sub_obj = sub_sobj.GetObject() + return sub_obj def testExportToGEOM(): - 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("YOZ")) - SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) - SketchPoint_1 = SketchProjection_1.createdFeature() - SketchCircle_1 = Sketch_1.addCircle(0, 0, 25) - SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) - SketchCircle_2 = Sketch_1.addCircle(20, -15, 20) - SketchCircle_3 = Sketch_1.addCircle(0, 25, 24.7213595499958) - SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.results()[1], SketchCircle_3.center()) - SketchCircle_4 = Sketch_1.addCircle(-20, -15, 20) - SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchCircle_1.results()[1], SketchCircle_4.center()) - SketchConstraintTangent_1 = Sketch_1.setTangent(SketchCircle_4.results()[1], SketchCircle_2.results()[1]) - SketchConstraintTangent_2 = Sketch_1.setTangent(SketchCircle_3.results()[1], SketchCircle_2.results()[1]) - SketchConstraintTangent_3 = Sketch_1.setTangent(SketchCircle_4.results()[1], SketchCircle_3.results()[1]) - SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchCircle_1.results()[1]) - SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_2.results()[1], SketchCircle_4.results()[1]) - SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], 20) - SketchConstraintRadius_2 = Sketch_1.setRadius(SketchCircle_1.results()[1], 25) - SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) - SketchLine_1 = SketchProjection_2.createdFeature() - SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_3.center()) - model.do() - Extrusion_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_4_2r-SketchCircle_4_2r-SketchCircle_3_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_3_2r-SketchCircle_2_2r-SketchCircle_2_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_2_2r-SketchCircle_4_2r")] - Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection(), 10, 0) - # select all results of an extrusion feature - Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("COMPSOLID", "all-in-Extrusion_1")]) - Group_2 = model.addGroup(Part_1_doc, "Faces", [model.selection("SOLID", "Extrusion_1_2")]) - GroupSubstraction_1 = model.addGroupSubstraction(Part_1_doc, [model.selection("COMPOUND", "Group_1")], [model.selection("COMPOUND", "Group_2")]) - model.do() - model.exportToGEOM(Part_1_doc) - model.end() - - # check that in GEOM module there are 3-SOLIDs-reuslts, with 2 groups each - shape1 = getGEOMShape(0) - assert(shape1) - assert(shape1.GetName() == "Extrusion_1_1") - assert(geompy.NumberOfSolids(shape1) == 1) - assert(salome.ObjectToSObject(shape1).FindSubObject(1)[1]) - assert(salome.ObjectToSObject(shape1).FindSubObject(1)[1].GetName() == "Group_1") - assert(salome.ObjectToSObject(shape1).FindSubObject(2)[1]) - assert(salome.ObjectToSObject(shape1).FindSubObject(2)[1].GetName() == "GroupSubstraction_1") - - shape2 = getGEOMShape(1) - assert(shape2) - assert(shape2.GetName() == "Extrusion_1_2") - assert(geompy.NumberOfSolids(shape2) == 1) - assert(salome.ObjectToSObject(shape2).FindSubObject(1)[1]) - assert(salome.ObjectToSObject(shape2).FindSubObject(1)[1].GetName() == "Group_1") - assert(salome.ObjectToSObject(shape2).FindSubObject(2)[1]) - assert(salome.ObjectToSObject(shape2).FindSubObject(2)[1].GetName() == "Group_2") - - shape3 = getGEOMShape(2) - assert(shape3) - assert(shape3.GetName() == "Extrusion_1_3") - assert(geompy.NumberOfSolids(shape3) == 1) - assert(salome.ObjectToSObject(shape3).FindSubObject(1)[1]) - assert(salome.ObjectToSObject(shape3).FindSubObject(1)[1].GetName() == "Group_1") - assert(salome.ObjectToSObject(shape3).FindSubObject(2)[1]) - assert(salome.ObjectToSObject(shape3).FindSubObject(2)[1].GetName() == "GroupSubstraction_1") - - shape4 = getGEOMShape(3) - assert(not shape4) - - -if __name__ == '__main__': - testExportToGEOM() + 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("YOZ")) + SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False + ) + SketchPoint_1 = SketchProjection_1.createdFeature() + SketchCircle_1 = Sketch_1.addCircle(0, 0, 25) + SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() + ) + SketchCircle_2 = Sketch_1.addCircle(20, -15, 20) + SketchCircle_3 = Sketch_1.addCircle(0, 25, 24.7213595499958) + SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.results()[1], SketchCircle_3.center() + ) + SketchCircle_4 = Sketch_1.addCircle(-20, -15, 20) + SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchCircle_1.results()[1], SketchCircle_4.center() + ) + SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchCircle_4.results()[1], SketchCircle_2.results()[1] + ) + SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchCircle_3.results()[1], SketchCircle_2.results()[1] + ) + SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchCircle_4.results()[1], SketchCircle_3.results()[1] + ) + SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchCircle_2.center(), SketchCircle_1.results()[1] + ) + SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchCircle_2.results()[1], SketchCircle_4.results()[1] + ) + SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], 20) + SketchConstraintRadius_2 = Sketch_1.setRadius(SketchCircle_1.results()[1], 25) + SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False + ) + SketchLine_1 = SketchProjection_2.createdFeature() + SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_3.center() + ) + model.do() + Extrusion_1_objects = [ + model.selection( + "FACE", + "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_4_2r-SketchCircle_4_2r-SketchCircle_3_2r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_3_2r-SketchCircle_2_2r-SketchCircle_2_2r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_2_2r-SketchCircle_4_2r", + ), + ] + Extrusion_1 = model.addExtrusion( + Part_1_doc, Extrusion_1_objects, model.selection(), 10, 0 + ) + # select all results of an extrusion feature + Group_1 = model.addGroup( + Part_1_doc, "Faces", [model.selection("COMPSOLID", "all-in-Extrusion_1")] + ) + Group_2 = model.addGroup( + Part_1_doc, "Faces", [model.selection("SOLID", "Extrusion_1_2")] + ) + GroupSubstraction_1 = model.addGroupSubstraction( + Part_1_doc, + [model.selection("COMPOUND", "Group_1")], + [model.selection("COMPOUND", "Group_2")], + ) + model.do() + model.exportToGEOM(Part_1_doc) + model.end() + + # check that in GEOM module there are 3-SOLIDs-reuslts, with 2 groups each + shape1 = getGEOMShape(0) + assert shape1 + assert shape1.GetName() == "Extrusion_1_1" + assert geompy.NumberOfSolids(shape1) == 1 + assert salome.ObjectToSObject(shape1).FindSubObject(1)[1] + assert salome.ObjectToSObject(shape1).FindSubObject(1)[1].GetName() == "Group_1" + assert salome.ObjectToSObject(shape1).FindSubObject(2)[1] + assert ( + salome.ObjectToSObject(shape1).FindSubObject(2)[1].GetName() + == "GroupSubstraction_1" + ) + + shape2 = getGEOMShape(1) + assert shape2 + assert shape2.GetName() == "Extrusion_1_2" + assert geompy.NumberOfSolids(shape2) == 1 + assert salome.ObjectToSObject(shape2).FindSubObject(1)[1] + assert salome.ObjectToSObject(shape2).FindSubObject(1)[1].GetName() == "Group_1" + assert salome.ObjectToSObject(shape2).FindSubObject(2)[1] + assert salome.ObjectToSObject(shape2).FindSubObject(2)[1].GetName() == "Group_2" + + shape3 = getGEOMShape(2) + assert shape3 + assert shape3.GetName() == "Extrusion_1_3" + assert geompy.NumberOfSolids(shape3) == 1 + assert salome.ObjectToSObject(shape3).FindSubObject(1)[1] + assert salome.ObjectToSObject(shape3).FindSubObject(1)[1].GetName() == "Group_1" + assert salome.ObjectToSObject(shape3).FindSubObject(2)[1] + assert ( + salome.ObjectToSObject(shape3).FindSubObject(2)[1].GetName() + == "GroupSubstraction_1" + ) + + shape4 = getGEOMShape(3) + assert not shape4 + + +if __name__ == "__main__": + testExportToGEOM() diff --git a/src/ConnectorAPI/Test/TestExportToGEOMWholeResult.py b/src/ConnectorAPI/Test/TestExportToGEOMWholeResult.py index 33b6202a2..d6caab9d2 100644 --- a/src/ConnectorAPI/Test/TestExportToGEOMWholeResult.py +++ b/src/ConnectorAPI/Test/TestExportToGEOMWholeResult.py @@ -26,46 +26,51 @@ import tempfile salome.standalone() from salome.geom import geomBuilder + salome.salome_init(1) geompy = geomBuilder.New() + ## Get the last object published in the GEOM section of the object browser def getLastGEOMShape(): - sb = salome.myStudy.NewBuilder() - comp = salome.myStudy.FindComponent("GEOM") - obj = None - if comp: - iterator = salome.myStudy.NewChildIterator( comp ) - sobj = None - while iterator.More(): - sobj = iterator.Value() - iterator.Next() - if sobj: - obj = sobj.GetObject() - else: - raise Exception("GEOM component not found.") - return obj + sb = salome.myStudy.NewBuilder() + comp = salome.myStudy.FindComponent("GEOM") + obj = None + if comp: + iterator = salome.myStudy.NewChildIterator(comp) + sobj = None + while iterator.More(): + sobj = iterator.Value() + iterator.Next() + if sobj: + obj = sobj.GetObject() + else: + raise Exception("GEOM component not found.") + return obj + ## Get the sub-object i of an object in the object browser # Numerotation starts at 1 def getSubObject(obj, i): - ok, sub_sobj = salome.ObjectToSObject(obj).FindSubObject(i) - if not ok: - raise Exception("No child found at %i for %s"%(i, obj.GetName())) - sub_obj = sub_sobj.GetObject() - return sub_obj + ok, sub_sobj = salome.ObjectToSObject(obj).FindSubObject(i) + if not ok: + raise Exception("No child found at %i for %s" % (i, obj.GetName())) + sub_obj = sub_sobj.GetObject() + return sub_obj + def dumpShaper(fileName): - model.begin() - dump=model.moduleDocument().addFeature("Dump") - dump.string("file_path").setValue(fileName) - dump.string("file_format").setValue("py") - dump.boolean("topological_naming").setValue(True) - dump.boolean("geometric_selection").setValue(False) - dump.boolean("weak_naming").setValue(False) - model.do() - model.end() - pass + model.begin() + dump = model.moduleDocument().addFeature("Dump") + dump.string("file_path").setValue(fileName) + dump.string("file_format").setValue("py") + dump.boolean("topological_naming").setValue(True) + dump.boolean("geometric_selection").setValue(False) + dump.boolean("weak_naming").setValue(False) + model.do() + model.end() + pass + # Create 2 boxes # Create a group of all edges of the first box (whole result) @@ -74,55 +79,70 @@ def dumpShaper(fileName): # Check the result # Check the dump def testExportToGEOM(): - - 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, 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", "Translation_1_1"), model.selection("SOLID", "Box_2_1")]) - Group_1 = model.addGroup(Part_1_doc, "EDGE", [model.selection("COMPSOLID", "Partition_1_1_1")]) - Group_2 = model.addGroup(Part_1_doc, "FACE", [model.selection("COMPSOLID", "Partition_1_1")]) - model.do() - - model.exportToGEOM(Part_1_doc) - model.end() - - # Check that the GEOM object has 1 compsolid and 2 solids - geomObject_1 = getLastGEOMShape() - assert geompy.NumberOfSubShapes(geomObject_1, geompy.ShapeType["COMPSOLID"]) == 1 - assert geompy.NumberOfSolids(geomObject_1) == 2 - - # Check that the group has 12 edges - geomGroup_1 = getSubObject(geomObject_1, 1) - assert geompy.NumberOfEdges(geomGroup_1) == 12 - - # Check that the group has 6+6 faces - geomGroup_2 = getSubObject(geomObject_1, 2) - assert geompy.NumberOfFaces(geomGroup_2) == 12 - - with tempfile.TemporaryDirectory() as tempdir: - # Dump the salome study (only CORBA modules, SHAPER dump is not in it) - dumpFileGeomBase = "dump_test_geom" - dumpFileGeom = os.path.join(tempdir, "%s.py"%dumpFileGeomBase) - salome.myStudy.DumpStudy(tempdir, dumpFileGeomBase, True, False) - - # Dump SHAPER - dumpFileShaper = os.path.join(tempdir, "dump_test_shaper.py") - dumpShaper(dumpFileShaper) - - # Load SHAPER dump - exec(compile(open(dumpFileShaper).read(), dumpFileShaper, 'exec')) - - # Load GEOM dump - exec(compile(open(dumpFileGeom).read(), dumpFileGeom, 'exec')) - - # Clean files - files = [dumpFileGeom, dumpFileShaper] - - pass - -if __name__ == '__main__': - testExportToGEOM() + 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, 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", "Translation_1_1"), + model.selection("SOLID", "Box_2_1"), + ], + ) + Group_1 = model.addGroup( + Part_1_doc, "EDGE", [model.selection("COMPSOLID", "Partition_1_1_1")] + ) + Group_2 = model.addGroup( + Part_1_doc, "FACE", [model.selection("COMPSOLID", "Partition_1_1")] + ) + model.do() + + model.exportToGEOM(Part_1_doc) + model.end() + + # Check that the GEOM object has 1 compsolid and 2 solids + geomObject_1 = getLastGEOMShape() + assert geompy.NumberOfSubShapes(geomObject_1, geompy.ShapeType["COMPSOLID"]) == 1 + assert geompy.NumberOfSolids(geomObject_1) == 2 + + # Check that the group has 12 edges + geomGroup_1 = getSubObject(geomObject_1, 1) + assert geompy.NumberOfEdges(geomGroup_1) == 12 + + # Check that the group has 6+6 faces + geomGroup_2 = getSubObject(geomObject_1, 2) + assert geompy.NumberOfFaces(geomGroup_2) == 12 + + with tempfile.TemporaryDirectory() as tempdir: + # Dump the salome study (only CORBA modules, SHAPER dump is not in it) + dumpFileGeomBase = "dump_test_geom" + dumpFileGeom = os.path.join(tempdir, "%s.py" % dumpFileGeomBase) + salome.myStudy.DumpStudy(tempdir, dumpFileGeomBase, True, False) + + # Dump SHAPER + dumpFileShaper = os.path.join(tempdir, "dump_test_shaper.py") + dumpShaper(dumpFileShaper) + + # Load SHAPER dump + exec(compile(open(dumpFileShaper).read(), dumpFileShaper, "exec")) + + # Load GEOM dump + exec(compile(open(dumpFileGeom).read(), dumpFileGeom, "exec")) + + # Clean files + files = [dumpFileGeom, dumpFileShaper] + + pass + + +if __name__ == "__main__": + testExportToGEOM() diff --git a/src/ConnectorAPI/Test/TestExportXAOMem.py b/src/ConnectorAPI/Test/TestExportXAOMem.py index 482e37207..885b6a570 100644 --- a/src/ConnectorAPI/Test/TestExportXAOMem.py +++ b/src/ConnectorAPI/Test/TestExportXAOMem.py @@ -22,11 +22,12 @@ Unit test of ExchangePlugin_ExportFeature class """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= import salome + salome.standalone() salome.salome_init(1) @@ -40,69 +41,89 @@ from salome.shaper import model import GEOM from salome.geom import geomBuilder + geompy = geomBuilder.New() -#========================================================================= -# test Export XAO to memory buffer (bytes array) -#========================================================================= -def testExportXAOMem(): +# ========================================================================= +# test Export XAO to memory buffer (bytes array) +# ========================================================================= +def testExportXAOMem(): 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) - Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Box_1_1/Top")]) + Group_1 = model.addGroup( + Part_1_doc, "Faces", [model.selection("FACE", "Box_1_1/Top")] + ) Box_2 = model.addBox(Part_1_doc, 20, 20, 20) model.do() # Export to memory buffer (bytes array) - Export_buff1 = model.exportToXAOMem(Part_1_doc, model.selection("SOLID", "Box_1_1"), 'XAO') - Export_buff2 = model.exportToXAOMem(Part_1_doc, model.selection("SOLID", "Box_2_1"), 'XAO') + Export_buff1 = model.exportToXAOMem( + Part_1_doc, model.selection("SOLID", "Box_1_1"), "XAO" + ) + Export_buff2 = model.exportToXAOMem( + Part_1_doc, model.selection("SOLID", "Box_2_1"), "XAO" + ) model.end() # check buffer length # export to XAO file and compare size of file and size of buffer - #assert(len(Export_buff1) == 4392) - #assert(len(Export_buff2) == 4287) + # assert(len(Export_buff1) == 4392) + # assert(len(Export_buff2) == 4287) with tempfile.TemporaryDirectory() as tmpdirname: tmpfilename = os.path.join(tmpdirname, "Box.xao") - Export_1 = model.exportToXAO(Part_1_doc, tmpfilename, model.selection("SOLID", "Box_1_1"), 'XAO') + Export_1 = model.exportToXAO( + Part_1_doc, tmpfilename, model.selection("SOLID", "Box_1_1"), "XAO" + ) file_stats = os.stat(tmpfilename) - assert(len(Export_buff1) == file_stats.st_size) + assert len(Export_buff1) == file_stats.st_size - Export_2 = model.exportToXAO(Part_1_doc, tmpfilename, model.selection("SOLID", "Box_2_1"), 'XAO') + Export_2 = model.exportToXAO( + Part_1_doc, tmpfilename, model.selection("SOLID", "Box_2_1"), "XAO" + ) file_stats = os.stat(tmpfilename) - assert(len(Export_buff2) == file_stats.st_size) + assert len(Export_buff2) == file_stats.st_size pass # Import to GEOM - (imported1, b1, [], [Group_1], []) = geompy.ImportXAOMem(Export_buff1, theName="Box1") - (imported2, b2, [], [] , []) = geompy.ImportXAOMem(Export_buff2, theName="Box2") + (imported1, b1, [], [Group_1], []) = geompy.ImportXAOMem( + Export_buff1, theName="Box1" + ) + (imported2, b2, [], [], []) = geompy.ImportXAOMem(Export_buff2, theName="Box2") # Check result 1 - aTol = 1.e-7 + aTol = 1.0e-7 Props = geompy.BasicProperties(b1) # surface area aSurface = 600 - assert (math.fabs(Props[1] - aSurface) < aTol), "The surface is wrong: expected = {0}, real = {1}".format(aSurface, Props[1]) + assert ( + math.fabs(Props[1] - aSurface) < aTol + ), "The surface is wrong: expected = {0}, real = {1}".format(aSurface, Props[1]) Props = geompy.BasicProperties(Group_1) # surface area aSurface = 100 - assert (math.fabs(Props[1] - aSurface) < aTol), "The surface is wrong: expected = {0}, real = {1}".format(aSurface, Props[1]) + assert ( + math.fabs(Props[1] - aSurface) < aTol + ), "The surface is wrong: expected = {0}, real = {1}".format(aSurface, Props[1]) # Check result 2 Props = geompy.BasicProperties(b2) # surface area aSurface = 2400 - assert (math.fabs(Props[1] - aSurface) < aTol), "The surface is wrong: expected = {0}, real = {1}".format(aSurface, Props[1]) + assert ( + math.fabs(Props[1] - aSurface) < aTol + ), "The surface is wrong: expected = {0}, real = {1}".format(aSurface, Props[1]) + -if __name__ == '__main__': - #========================================================================= +if __name__ == "__main__": + # ========================================================================= # Export a shape into XAO memory buffer - #========================================================================= + # ========================================================================= testExportXAOMem() - #========================================================================= + # ========================================================================= # End of test - #========================================================================= + # ========================================================================= diff --git a/src/ConnectorAPI/Test/TestImportSTEP.py b/src/ConnectorAPI/Test/TestImportSTEP.py index decc9100d..7cd15dc66 100644 --- a/src/ConnectorAPI/Test/TestImportSTEP.py +++ b/src/ConnectorAPI/Test/TestImportSTEP.py @@ -21,9 +21,9 @@ TestImportStep.py Unit test of ExchangePlugin_ImportFeature class for STEP """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= import salome @@ -44,33 +44,39 @@ __updated__ = "2015-05-22" salome.standalone() salome.salome_init(1) -#========================================================================= + +# ========================================================================= # Help functions -#========================================================================= +# ========================================================================= def removeFile(theFileName): - try: os.remove(theFileName) - except OSError: pass - assert not os.path.exists(theFileName), \ - "Can not remove file {0}".format(theFileName) - -#========================================================================= -# test Import STEP -#========================================================================= + try: + os.remove(theFileName) + except OSError: + pass + assert not os.path.exists(theFileName), "Can not remove file {0}".format( + theFileName + ) + + +# ========================================================================= +# test Import STEP +# ========================================================================= def testImportSTEP(): - model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() - aShapePath = os.path.join(os.getenv("DATA_DIR"), "Shapes", "Step", "black_and_white.step") - print("aShapePath=",aShapePath) - Import_1 = model.addImportSTEP(Part_1_doc,aShapePath, True, True, True) + aShapePath = os.path.join( + os.getenv("DATA_DIR"), "Shapes", "Step", "black_and_white.step" + ) + print("aShapePath=", aShapePath) + Import_1 = model.addImportSTEP(Part_1_doc, aShapePath, True, True, True) model.do() # Check results Import_1_Feature = Import_1.feature() - assert Import_1_Feature.error() == '' + assert Import_1_Feature.error() == "" assert Import_1_Feature.name() == "black_and_white" assert len(Import_1_Feature.results()) == 1 model.testNbSubShapes(Import_1, GeomAPI_Shape.SOLID, [2]) @@ -99,7 +105,6 @@ def testImportSTEP(): aSelectionList = aFeature1.selectionList("group_list") assert aSelectionList.size() == 1 - aFeature1 = aCompositeFeature.subFeature(3, False) assert aFeature1.getKind() == "Group" assert aFeature1.name() == "Material_white" @@ -109,6 +114,7 @@ def testImportSTEP(): model.end() -if __name__ == '__main__': + +if __name__ == "__main__": with TemporaryDirectory() as tmp_dir: testImportSTEP() diff --git a/src/ConnectorAPI/Test/TestImportSTL.py b/src/ConnectorAPI/Test/TestImportSTL.py index f8e6a4bb3..493bd8fe7 100644 --- a/src/ConnectorAPI/Test/TestImportSTL.py +++ b/src/ConnectorAPI/Test/TestImportSTL.py @@ -21,11 +21,13 @@ import os from salome.shaper import model import salome + salome.standalone() salome.salome_init(1) data_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data") + def testImportSTL(): model.begin() partSet = model.moduleDocument() @@ -39,7 +41,9 @@ def testImportSTL(): model.do() Import_1.setName("cube_ascii") Import_1.result().setName("cube_ascii") - BoundingBox_1 = model.getBoundingBox(Part_1_doc, model.selection("SOLID", "cube_ascii")) + BoundingBox_1 = model.getBoundingBox( + Part_1_doc, model.selection("SOLID", "cube_ascii") + ) Import_2 = model.addImport(Part_1_doc, os.path.join(data_dir, "cube_binary.stl")) model.do() @@ -48,38 +52,38 @@ def testImportSTL(): model.end() - #============================================================================= + # ============================================================================= # Tests : - #============================================================================= + # ============================================================================= # ASCII STL file : model.checkResult(Import_1, model, 1, [0], [1], [12], [36], [72]) - r=Import_1.defaultResult() - s=r.shape() - dim=s.computeSize() - dim=dim[1:] - dx=abs(dim[3]-dim[0]) - dy=abs(dim[4]-dim[1]) - dz=abs(dim[5]-dim[2]) - tol=1e-06 - assert(abs(dx-14) <= tol) - assert(abs(dy-8) <= tol) - assert(abs(dz-5) <= tol) - model.testResultsVolumes(Import_1, [560.0000222], theNbSignificantDigits = 7) + r = Import_1.defaultResult() + s = r.shape() + dim = s.computeSize() + dim = dim[1:] + dx = abs(dim[3] - dim[0]) + dy = abs(dim[4] - dim[1]) + dz = abs(dim[5] - dim[2]) + tol = 1e-06 + assert abs(dx - 14) <= tol + assert abs(dy - 8) <= tol + assert abs(dz - 5) <= tol + model.testResultsVolumes(Import_1, [560.0000222], theNbSignificantDigits=7) # Binary STL file : model.checkResult(Import_2, model, 1, [0], [1], [12], [36], [72]) - r=Import_2.defaultResult() - s=r.shape() - dim=s.computeSize() - dim=dim[1:] - dx=abs(dim[3]-dim[0]) - dy=abs(dim[4]-dim[1]) - dz=abs(dim[5]-dim[2]) - assert(abs(dx-10) <= tol) - assert(abs(dy-10) <= tol) - assert(abs(dz-10) <= tol) - model.testResultsVolumes(Import_2, [1000], theNbSignificantDigits = 7) + r = Import_2.defaultResult() + s = r.shape() + dim = s.computeSize() + dim = dim[1:] + dx = abs(dim[3] - dim[0]) + dy = abs(dim[4] - dim[1]) + dz = abs(dim[5] - dim[2]) + assert abs(dx - 10) <= tol + assert abs(dy - 10) <= tol + assert abs(dz - 10) <= tol + model.testResultsVolumes(Import_2, [1000], theNbSignificantDigits=7) -if __name__ == '__main__': +if __name__ == "__main__": testImportSTL() diff --git a/src/ConnectorAPI/Test/TestImportXAOMem.py b/src/ConnectorAPI/Test/TestImportXAOMem.py index 01a4de2bf..4287b51fc 100644 --- a/src/ConnectorAPI/Test/TestImportXAOMem.py +++ b/src/ConnectorAPI/Test/TestImportXAOMem.py @@ -22,11 +22,12 @@ Unit test of ExchangePlugin_ImportFeature class """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= import salome + salome.standalone() salome.salome_init(1) @@ -41,19 +42,20 @@ from salome.shaper import model import GEOM from salome.geom import geomBuilder + geompy = geomBuilder.New() -#========================================================================= -# test Import XAO from memory buffer (bytes array) -#========================================================================= -def testImportXAOMem(): +# ========================================================================= +# test Import XAO from memory buffer (bytes array) +# ========================================================================= +def testImportXAOMem(): # Export from GEOM Box_1 = geompy.MakeBoxDXDYDZ(10, 10, 10) Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"]) geompy.UnionIDs(Group_1, [33]) - geompy.addToStudy( Box_1, 'Box10x10x10' ) - geompy.addToStudyInFather( Box_1, Group_1, 'GroupTopFace' ) + geompy.addToStudy(Box_1, "Box10x10x10") + geompy.addToStudyInFather(Box_1, Group_1, "GroupTopFace") Export_buff = geompy.ExportXAOMem(Box_1, [Group_1], [], "XAO") @@ -63,7 +65,7 @@ def testImportXAOMem(): tmpfilename = os.path.join(tmpdirname, "Box.xao") exported = geompy.ExportXAO(Box_1, [Group_1], [], "XAO", tmpfilename, "") file_stats = os.stat(tmpfilename) - assert(len(Export_buff) == file_stats.st_size) + assert len(Export_buff) == file_stats.st_size pass # Import to SHAPER @@ -76,7 +78,7 @@ def testImportXAOMem(): model.end() # Check result - assert(Import_1.feature().error() == "") + assert Import_1.feature().error() == "" model.testNbResults(Import_1, 1) model.testNbSubResults(Import_1, [0]) model.testNbSubShapes(Import_1, GeomAPI_Shape.SOLID, [1]) @@ -86,27 +88,31 @@ def testImportXAOMem(): model.testResultsVolumes(Import_1, [1000]) model.testResultsAreas(Import_1, [600]) - assert(Import_1.name() == "Box10x10x10") - assert(Import_1.result().name() == "Box10x10x10_1") - assert(Import_1.subFeature(0).name() == "GroupTopFace") - assert(Import_1.subFeature(0).result().name() == "GroupTopFace") + assert Import_1.name() == "Box10x10x10" + assert Import_1.result().name() == "Box10x10x10_1" + assert Import_1.subFeature(0).name() == "GroupTopFace" + assert Import_1.subFeature(0).result().name() == "GroupTopFace" # check group - assert(Part_1_doc.size("Groups") == 1) + assert Part_1_doc.size("Groups") == 1 res1 = objectToResult(Part_1_doc.object("Groups", 0)) - assert(res1 is not None) + assert res1 is not None res1It = GeomAPI_ShapeExplorer(res1.shape(), GeomAPI_Shape.FACE) - assert(res1It.more()) + assert res1It.more() shape1 = res1It.current() res1It.next() - assert(not res1It.more()) + assert not res1It.more() p1 = res1.shape().middlePoint() - aTol = 1.e-7 - assert(math.fabs(p1.x() - 5) <= aTol and math.fabs(p1.y() - 5) <= aTol and math.fabs(p1.z() - 10) <= aTol), "({}, {}, {}) != ({}, {}, {})".format(p1.x(), p1.y(), p1.z(), 5, 5, 10) + aTol = 1.0e-7 + assert ( + math.fabs(p1.x() - 5) <= aTol + and math.fabs(p1.y() - 5) <= aTol + and math.fabs(p1.z() - 10) <= aTol + ), "({}, {}, {}) != ({}, {}, {})".format(p1.x(), p1.y(), p1.z(), 5, 5, 10) pass -def testImportXAOMem_EmptyName(): +def testImportXAOMem_EmptyName(): # Export from GEOM Box_1 = geompy.MakeBoxDXDYDZ(10, 10, 10) Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"]) @@ -125,20 +131,21 @@ def testImportXAOMem_EmptyName(): model.end() # Check result - assert(Import_1.feature().error() == "") + assert Import_1.feature().error() == "" model.testNbResults(Import_1, 1) - assert(Import_1.name() == "ImportXAOMem") - assert(Import_1.result().name() == "ImportXAOMem_1") - assert(Import_1.subFeature(0).name() == "Group_1") - assert(Import_1.subFeature(0).result().name() == "Group_1") + assert Import_1.name() == "ImportXAOMem" + assert Import_1.result().name() == "ImportXAOMem_1" + assert Import_1.subFeature(0).name() == "Group_1" + assert Import_1.subFeature(0).result().name() == "Group_1" + -if __name__ == '__main__': - #========================================================================= +if __name__ == "__main__": + # ========================================================================= # Import a shape from XAO memory buffer - #========================================================================= + # ========================================================================= testImportXAOMem() testImportXAOMem_EmptyName() - #========================================================================= + # ========================================================================= # End of test - #========================================================================= + # ========================================================================= diff --git a/src/ConnectorAPI/Test/testme.py b/src/ConnectorAPI/Test/testme.py index 2dea5657c..9769bf580 100755 --- a/src/ConnectorAPI/Test/testme.py +++ b/src/ConnectorAPI/Test/testme.py @@ -21,36 +21,44 @@ import unittest, sys, os + class SalomeSession(object): def __init__(self, script): import runSalome + run_script = "runSalome.py" - if sys.platform == 'win32': + if sys.platform == "win32": module_dir = os.getenv("KERNEL_ROOT_DIR") - if module_dir: run_script = os.path.join(module_dir, "bin", "salome", run_script) + if module_dir: + run_script = os.path.join(module_dir, "bin", "salome", run_script) pass - sys.argv = [run_script] + sys.argv = [run_script] sys.argv += ["--terminal"] sys.argv += ["--modules=SHAPER,GEOM,SHAPERSTUDY,SMESH"] sys.argv += ["%s" % script] - if sys.platform == 'win32': - main_module_path = sys.modules['__main__'].__file__ - sys.modules['__main__'].__file__ = '' + if sys.platform == "win32": + main_module_path = sys.modules["__main__"].__file__ + sys.modules["__main__"].__file__ = "" clt, d = runSalome.main() - if sys.platform == 'win32': - sys.modules['__main__'].__file__ = main_module_path + if sys.platform == "win32": + sys.modules["__main__"].__file__ = main_module_path return def __del__(self): - port = os.getenv('NSPORT') + port = os.getenv("NSPORT") import killSalomeWithPort + killSalomeWithPort.killMyPort(port) return + pass + class MyTest(unittest.TestCase): def testFunction(self): SalomeSession(sys.argv[1]) + pass + unittest.main(argv=sys.argv[:1]) diff --git a/src/ConnectorPlugin/ConnectorPlugin.py b/src/ConnectorPlugin/ConnectorPlugin.py index f689f7494..2f37e4ae0 100644 --- a/src/ConnectorPlugin/ConnectorPlugin.py +++ b/src/ConnectorPlugin/ConnectorPlugin.py @@ -25,10 +25,10 @@ import ModelAPI from ConnectorPlugin_ExportFeature import ExportFeature from ConnectorPlugin_PublishToStudyFeature import PublishToStudyFeature + ## @ingroup Plugins # The main class for management the construction features as plugin. class ConnectorPlugin(ModelAPI.ModelAPI_Plugin): - ## The constructor. def __init__(self): ModelAPI.ModelAPI_Plugin.__init__(self) @@ -43,6 +43,7 @@ class ConnectorPlugin(ModelAPI.ModelAPI_Plugin): else: print("ConnectorPlugin: No such feature %s" % theFeatureID) + ## The plugin created on module importing (from c++) plugin = ConnectorPlugin() ## Main session of the application diff --git a/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py b/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py index fe08b8e00..afe558119 100644 --- a/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py +++ b/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py @@ -31,10 +31,10 @@ from salome.shaper import model import os + ## @ingroup Plugins # Feature to export all shapes and groups into the GEOM module class ExportFeature(ModelAPI.ModelAPI_Feature): - ## The constructor. def __init__(self): ModelAPI.ModelAPI_Feature.__init__(self) @@ -55,60 +55,76 @@ class ExportFeature(ModelAPI.ModelAPI_Feature): ## This feature has no attributes, as it is action. def initAttributes(self): - pass + pass ## Export the results, groups and fields via XAO def exportViaXAO(self): # if part-set is active, iterate also parts for isPart in (True, False): - aResultType = model.ModelAPI_ResultBody.group() - if isPart: - aResultType = model.ModelAPI_ResultPart.group() - # iterate all results of Part, export one by one due to issue 2882 - for aResIndex in range(self.Part.size(aResultType)): - anObject = self.Part.object(aResultType, aResIndex) - aResult = model.objectToResult(anObject) - # do not export picture - if aResult.hasTexture() is True: - continue - if not aResult is None: - if (not aResult.shape() or aResult.shape().isNull()) and isPart: - aPart = model.modelAPI_ResultPart(aResult) - aPartDoc = aPart.partDoc() - if not aPartDoc or not aPartDoc.isOpened(): - EventsAPI.Events_InfoMessage("ExportToGEOM", "For export to GEOM some Part is not activated", self).send() - return - - if not aResult.shape() or aResult.shape().isNull(): - continue - tmpXAOFile = model.getTmpFileName("shaper_", ".xao") - self.tmpXAOFile = tmpXAOFile - #print "Export to %s"%tmpXAOFile - exportXAO = ExchangeAPI.exportToXAO(self.Part, tmpXAOFile, model.selection(aResult), "automatic_shaper_export_to_XAO") - if not os.path.exists(tmpXAOFile) or os.stat(tmpXAOFile).st_size == 0: - exportXAO.feature().setError("Error in exportToXAO. No XAO file has been created.") - return - imported, shape, subShapes, groups, fields = self.geompy.ImportXAO(tmpXAOFile) - self.geompy.addToStudy( shape, shape.GetName() ) - # add sub-shapes and groups to the object browser - for obj in subShapes + groups: - name = obj.GetName() - self.geompy.addToStudyInFather(shape, obj, name) - # add fields to the object browser - for field in fields: - name = field.GetName() - self.geompy.addToStudyInFather(shape, field, name) - # add steps to the object browser - steps = field.getSteps() - for i_step in steps: - step = field.getStep(i_step) - i_stamp = step.GetStamp() - step_name = "Step %i %i"%(i_step, i_stamp) - self.geompy.addToStudyInFather( field, step, step_name ) - # Remove the temporary file - os.remove(tmpXAOFile) + aResultType = model.ModelAPI_ResultBody.group() + if isPart: + aResultType = model.ModelAPI_ResultPart.group() + # iterate all results of Part, export one by one due to issue 2882 + for aResIndex in range(self.Part.size(aResultType)): + anObject = self.Part.object(aResultType, aResIndex) + aResult = model.objectToResult(anObject) + # do not export picture + if aResult.hasTexture() is True: + continue + if not aResult is None: + if (not aResult.shape() or aResult.shape().isNull()) and isPart: + aPart = model.modelAPI_ResultPart(aResult) + aPartDoc = aPart.partDoc() + if not aPartDoc or not aPartDoc.isOpened(): + EventsAPI.Events_InfoMessage( + "ExportToGEOM", + "For export to GEOM some Part is not activated", + self, + ).send() + return + + if not aResult.shape() or aResult.shape().isNull(): + continue + tmpXAOFile = model.getTmpFileName("shaper_", ".xao") + self.tmpXAOFile = tmpXAOFile + # print "Export to %s"%tmpXAOFile + exportXAO = ExchangeAPI.exportToXAO( + self.Part, + tmpXAOFile, + model.selection(aResult), + "automatic_shaper_export_to_XAO", + ) + if ( + not os.path.exists(tmpXAOFile) + or os.stat(tmpXAOFile).st_size == 0 + ): + exportXAO.feature().setError( + "Error in exportToXAO. No XAO file has been created." + ) + return + imported, shape, subShapes, groups, fields = self.geompy.ImportXAO( + tmpXAOFile + ) + self.geompy.addToStudy(shape, shape.GetName()) + # add sub-shapes and groups to the object browser + for obj in subShapes + groups: + name = obj.GetName() + self.geompy.addToStudyInFather(shape, obj, name) + # add fields to the object browser + for field in fields: + name = field.GetName() + self.geompy.addToStudyInFather(shape, field, name) + # add steps to the object browser + steps = field.getSteps() + for i_step in steps: + step = field.getStep(i_step) + i_stamp = step.GetStamp() + step_name = "Step %i %i" % (i_step, i_stamp) + self.geompy.addToStudyInFather(field, step, step_name) + # Remove the temporary file + os.remove(tmpXAOFile) + pass pass - pass pass ## Exports all shapes and groups into the GEOM module. diff --git a/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py index c9fa8c715..2f11fcca0 100644 --- a/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py +++ b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py @@ -32,10 +32,10 @@ from salome.shaper import model import SHAPERSTUDY_ORB import SHAPERSTUDY_utils + ## @ingroup Plugins # Feature to export all shapes and groups into the GEOM module class PublishToStudyFeature(ModelAPI.ModelAPI_Feature): - ## The constructor. def __init__(self): ModelAPI.ModelAPI_Feature.__init__(self) @@ -65,11 +65,20 @@ class PublishToStudyFeature(ModelAPI.ModelAPI_Feature): # check that the PartSet document current feature is the last to avoid problems with all # features update if aPartSet.size(model.ModelAPI_Feature.group()) > 0: - aLastFeature = ModelAPI.objectToFeature(aPartSet.object(model.ModelAPI_Feature.group(), aPartSet.size(model.ModelAPI_Feature.group()) - 1)) - aCurrentFeature = aPartSet.currentFeature(True) - if aLastFeature.data().featureId() != aCurrentFeature.data().featureId(): - EventsAPI.Events_InfoMessage("PublishToStudy", "Not all PartSet parts are up-to-date, nothing is published. Please, make the last PartSet feature as current.", self).send() - return + aLastFeature = ModelAPI.objectToFeature( + aPartSet.object( + model.ModelAPI_Feature.group(), + aPartSet.size(model.ModelAPI_Feature.group()) - 1, + ) + ) + aCurrentFeature = aPartSet.currentFeature(True) + if aLastFeature.data().featureId() != aCurrentFeature.data().featureId(): + EventsAPI.Events_InfoMessage( + "PublishToStudy", + "Not all PartSet parts are up-to-date, nothing is published. Please, make the last PartSet feature as current.", + self, + ).send() + return # find a shaper-study component salome.salome_init(1) aComponent = SHAPERSTUDY_utils.findOrCreateComponent() @@ -79,193 +88,238 @@ class PublishToStudyFeature(ModelAPI.ModelAPI_Feature): # iterate all parts and all results to publish them in SHAPER_STUDY for aPartId in range(aPartSet.size(model.ModelAPI_ResultPart.group())): - aPartObject = aPartSet.object(model.ModelAPI_ResultPart.group(), aPartId) - aPartRes = ModelAPI.modelAPI_ResultPart(ModelAPI.modelAPI_Result(aPartObject)) - aPartDoc = aPartRes.partDoc() - if aPartDoc is None and aPartObject is not None: - EventsAPI.Events_InfoMessage("PublishToStudy", "To publish to SHAPER-STUDY, activate Parts in SHAPER", self).send() - break - aPartFeatureId = aPartSet.feature(aPartRes.original()).data().featureId() - # Collects all features of exported results to find results of the same features and extend id. - # Map from feature index to index of result. If index is zero (initial), no surrfix to entry is added. - aFeaturesIndices = {} - for aResId in range(aPartDoc.size(model.ModelAPI_ResultBody.group())): - aResObject = aPartDoc.object(model.ModelAPI_ResultBody.group(), aResId) - aRes = model.objectToResult(aResObject) - #do not export images - if aRes.hasTexture() is True: - continue - aResFeatureId = str(aPartDoc.feature(aRes).data().featureId()) - if aResFeatureId in aFeaturesIndices: - aFeaturesIndices[aResFeatureId] += 1 - aResFeatureId += ":" + str(aFeaturesIndices[aResFeatureId]) - else: - aFeaturesIndices[aResFeatureId] = 0 - aSSEntry = str(aPartFeatureId) + ":" + aResFeatureId - aSShape = anEngine.FindOrCreateShape(aSSEntry) - aSShape.SetShapeByStream(aRes.shape().getShapeStream(False)) - if not aSShape.GetSO(): # publish in case it is a new shape - anEngine.AddInStudy(aSShape, aRes.data().name(), None) - else: # restore a red reference if it was deleted - aDone, aSO2 = aSShape.GetSO().FindSubObject(1) - if aDone: - aDone, aRef = aSO2.ReferencedObject() - if not aDone: - aBuilder = SHAPERSTUDY_utils.getStudy().NewBuilder() - aBuilder.Addreference(aSO2, aSShape.GetSO()) - allProcessed.append(aSSEntry) - # Groups - self.processGroups(aRes, anEngine, aPartFeatureId, aSShape, False) - # Fields - self.processGroups(aRes, anEngine, aPartFeatureId, aSShape, True) + aPartObject = aPartSet.object(model.ModelAPI_ResultPart.group(), aPartId) + aPartRes = ModelAPI.modelAPI_ResultPart( + ModelAPI.modelAPI_Result(aPartObject) + ) + aPartDoc = aPartRes.partDoc() + if aPartDoc is None and aPartObject is not None: + EventsAPI.Events_InfoMessage( + "PublishToStudy", + "To publish to SHAPER-STUDY, activate Parts in SHAPER", + self, + ).send() + break + aPartFeatureId = aPartSet.feature(aPartRes.original()).data().featureId() + # Collects all features of exported results to find results of the same features and extend id. + # Map from feature index to index of result. If index is zero (initial), no surrfix to entry is added. + aFeaturesIndices = {} + for aResId in range(aPartDoc.size(model.ModelAPI_ResultBody.group())): + aResObject = aPartDoc.object(model.ModelAPI_ResultBody.group(), aResId) + aRes = model.objectToResult(aResObject) + # do not export images + if aRes.hasTexture() is True: + continue + aResFeatureId = str(aPartDoc.feature(aRes).data().featureId()) + if aResFeatureId in aFeaturesIndices: + aFeaturesIndices[aResFeatureId] += 1 + aResFeatureId += ":" + str(aFeaturesIndices[aResFeatureId]) + else: + aFeaturesIndices[aResFeatureId] = 0 + aSSEntry = str(aPartFeatureId) + ":" + aResFeatureId + aSShape = anEngine.FindOrCreateShape(aSSEntry) + aSShape.SetShapeByStream(aRes.shape().getShapeStream(False)) + if not aSShape.GetSO(): # publish in case it is a new shape + anEngine.AddInStudy(aSShape, aRes.data().name(), None) + else: # restore a red reference if it was deleted + aDone, aSO2 = aSShape.GetSO().FindSubObject(1) + if aDone: + aDone, aRef = aSO2.ReferencedObject() + if not aDone: + aBuilder = SHAPERSTUDY_utils.getStudy().NewBuilder() + aBuilder.Addreference(aSO2, aSShape.GetSO()) + allProcessed.append(aSSEntry) + # Groups + self.processGroups(aRes, anEngine, aPartFeatureId, aSShape, False) + # Fields + self.processGroups(aRes, anEngine, aPartFeatureId, aSShape, True) # process all SHAPER-STUDY shapes to find dead aSOIter = SHAPERSTUDY_utils.getStudy().NewChildIterator(aComponent) while aSOIter.More(): - aSO = aSOIter.Value() - aSOIter.Next() # here because there is continue inside the loop - anIOR = aSO.GetIOR() - if len(anIOR): - anObj = salome.orb.string_to_object(anIOR) - if isinstance(anObj, SHAPERSTUDY_ORB._objref_SHAPER_Object): - anEntry = anObj.GetEntry() - if len(anEntry) == 0: - continue; - elif anEntry not in allProcessed: # found a removed shape: make it dead for the moment - # remove the reference - red node - aRes, aSO2 = aSO.FindSubObject(1) - if aRes: - aRes, aRef = aSO2.ReferencedObject() - if aRes: - aBuilder = SHAPERSTUDY_utils.getStudy().NewBuilder() - aBuilder.RemoveReference(aSO2) - # if the object is not marked as dead, mark it (#3201) to make all entries unique - aDeadEntry = anObj.GetEntry() - if not aDeadEntry.startswith("dead"): - anIndex = aSO.Tag() - anObj.SetEntry("dead0" + str(anIndex) + "_" + aDeadEntry) + aSO = aSOIter.Value() + aSOIter.Next() # here because there is continue inside the loop + anIOR = aSO.GetIOR() + if len(anIOR): + anObj = salome.orb.string_to_object(anIOR) + if isinstance(anObj, SHAPERSTUDY_ORB._objref_SHAPER_Object): + anEntry = anObj.GetEntry() + if len(anEntry) == 0: + continue + elif ( + anEntry not in allProcessed + ): # found a removed shape: make it dead for the moment + # remove the reference - red node + aRes, aSO2 = aSO.FindSubObject(1) + if aRes: + aRes, aRef = aSO2.ReferencedObject() + if aRes: + aBuilder = SHAPERSTUDY_utils.getStudy().NewBuilder() + aBuilder.RemoveReference(aSO2) + # if the object is not marked as dead, mark it (#3201) to make all entries unique + aDeadEntry = anObj.GetEntry() + if not aDeadEntry.startswith("dead"): + anIndex = aSO.Tag() + anObj.SetEntry("dead0" + str(anIndex) + "_" + aDeadEntry) - # also for groups - aGrSOIter = SHAPERSTUDY_utils.getStudy().NewChildIterator(aSO) - while aGrSOIter.More(): - aGroupSO = aGrSOIter.Value() - aGrSOIter.Next() - anIOR = aGroupSO.GetIOR() - if len(anIOR): - aGroup = salome.orb.string_to_object(anIOR) - if isinstance(aGroup, SHAPERSTUDY_ORB._objref_SHAPER_Group) or \ - isinstance(aGroup, SHAPERSTUDY_ORB._objref_SHAPER_Field): - if not aGroup.GetEntry().startswith("dead"): - aDeadGroupEntry = "dead0" + str(anIndex) + "_" + aGroup.GetEntry() - aGroup.SetEntry(aDeadGroupEntry) + # also for groups + aGrSOIter = SHAPERSTUDY_utils.getStudy().NewChildIterator( + aSO + ) + while aGrSOIter.More(): + aGroupSO = aGrSOIter.Value() + aGrSOIter.Next() + anIOR = aGroupSO.GetIOR() + if len(anIOR): + aGroup = salome.orb.string_to_object(anIOR) + if isinstance( + aGroup, SHAPERSTUDY_ORB._objref_SHAPER_Group + ) or isinstance( + aGroup, SHAPERSTUDY_ORB._objref_SHAPER_Field + ): + if not aGroup.GetEntry().startswith("dead"): + aDeadGroupEntry = ( + "dead0" + + str(anIndex) + + "_" + + aGroup.GetEntry() + ) + aGroup.SetEntry(aDeadGroupEntry) # Part of the "execute" method: processes the Groups of theRes result publication. # If theFields is true, the same is performed for Fields. - def processGroups(self, theRes, theEngine, thePartFeatureId, theStudyShape, theFields): - allGroupsProcessed = [] - allRefGroups = [] - if theFields: - allRefGroups.append(ModelAPI.referencedFeatures(theRes, "Field", True)) - else: - allRefGroups.append(ModelAPI.referencedFeatures(theRes, "Group", True)) - allRefGroups.append(ModelAPI.referencedFeatures(theRes, "Shared_faces", True)) - for aRefGroups in allRefGroups: - for aRef in aRefGroups: - aGroupIndices = [] - aGroupHasIndex = {} - aResShape = theRes.shape() - if theFields: - aSelList = aRef.selectionList("selected") - else: - aSelList = aRef.selectionList("group_list") - aSelType = GeomAPI_Shape.shapeTypeByStr(aSelList.selectionType()) - for aGroupRes in aRef.results(): - aShape = aGroupRes.shape() - anExplorer = GeomAPI_ShapeExplorer(aShape, aSelType) - while anExplorer.more(): - anId = GeomAlgoAPI.GeomAlgoAPI_CompoundBuilder.id(aResShape, anExplorer.current()) - if anId > 0 and not anId in aGroupHasIndex: - aGroupIndices.append(anId) - aGroupHasIndex[anId] = 0 - anExplorer.next() - if len(aGroupIndices): # create group - aGroupFeatureId = aRef.data().featureId() - if theFields: - aFieldOp = theEngine.GetIFieldOperations() - aGroupEntry = "field" + str(thePartFeatureId) + ":" + str(aGroupFeatureId) - aGroup = aFieldOp.FindField(theStudyShape, aGroupEntry) - else: - aGroupOp = theEngine.GetIGroupOperations() - aGroupEntry = "group" + str(thePartFeatureId) + ":" + str(aGroupFeatureId) - aGroup = aGroupOp.FindGroup(theStudyShape, aGroupEntry) - if not aGroup: # create a new - if theFields: - aGroup = aFieldOp.CreateFieldByType(theStudyShape, aSelType) - else: - aGroup = aGroupOp.CreateGroup(theStudyShape, aSelType) - aGroup.SetEntry(aGroupEntry) - theEngine.AddInStudy(aGroup, aRef.firstResult().data().name(), theStudyShape) - aGroup.SetSelection(aGroupIndices) - if theFields: - self.fillField(aGroup, aRef, theEngine, aGroupIndices) - # a group takes shape from the main result - #aGroup.SetShapeByStream(aRef.firstResult().shape().getShapeStream(False)) # group shape - allGroupsProcessed.append(aGroupEntry) - # check all existing groups: if some does not processed, remove it from the tree - aSOIter = SHAPERSTUDY_utils.getStudy().NewChildIterator(theStudyShape.GetSO()) - while aSOIter.More(): - aSO = aSOIter.Value() - anIOR = aSO.GetIOR() - if len(anIOR): - anObj = salome.orb.string_to_object(anIOR) - if (theFields and isinstance(anObj, SHAPERSTUDY_ORB._objref_SHAPER_Field)) or \ - (not theFields and type(anObj) == SHAPERSTUDY_ORB._objref_SHAPER_Group): - anEntry = anObj.GetEntry() - if anEntry not in allGroupsProcessed: # found a removed group => remove - aBuilder = SHAPERSTUDY_utils.getStudy().NewBuilder() - aBuilder.RemoveObject(anObj.GetSO()) - aSOIter.Next() + def processGroups( + self, theRes, theEngine, thePartFeatureId, theStudyShape, theFields + ): + allGroupsProcessed = [] + allRefGroups = [] + if theFields: + allRefGroups.append(ModelAPI.referencedFeatures(theRes, "Field", True)) + else: + allRefGroups.append(ModelAPI.referencedFeatures(theRes, "Group", True)) + allRefGroups.append( + ModelAPI.referencedFeatures(theRes, "Shared_faces", True) + ) + for aRefGroups in allRefGroups: + for aRef in aRefGroups: + aGroupIndices = [] + aGroupHasIndex = {} + aResShape = theRes.shape() + if theFields: + aSelList = aRef.selectionList("selected") + else: + aSelList = aRef.selectionList("group_list") + aSelType = GeomAPI_Shape.shapeTypeByStr(aSelList.selectionType()) + for aGroupRes in aRef.results(): + aShape = aGroupRes.shape() + anExplorer = GeomAPI_ShapeExplorer(aShape, aSelType) + while anExplorer.more(): + anId = GeomAlgoAPI.GeomAlgoAPI_CompoundBuilder.id( + aResShape, anExplorer.current() + ) + if anId > 0 and not anId in aGroupHasIndex: + aGroupIndices.append(anId) + aGroupHasIndex[anId] = 0 + anExplorer.next() + if len(aGroupIndices): # create group + aGroupFeatureId = aRef.data().featureId() + if theFields: + aFieldOp = theEngine.GetIFieldOperations() + aGroupEntry = ( + "field" + str(thePartFeatureId) + ":" + str(aGroupFeatureId) + ) + aGroup = aFieldOp.FindField(theStudyShape, aGroupEntry) + else: + aGroupOp = theEngine.GetIGroupOperations() + aGroupEntry = ( + "group" + str(thePartFeatureId) + ":" + str(aGroupFeatureId) + ) + aGroup = aGroupOp.FindGroup(theStudyShape, aGroupEntry) + if not aGroup: # create a new + if theFields: + aGroup = aFieldOp.CreateFieldByType(theStudyShape, aSelType) + else: + aGroup = aGroupOp.CreateGroup(theStudyShape, aSelType) + aGroup.SetEntry(aGroupEntry) + theEngine.AddInStudy( + aGroup, aRef.firstResult().data().name(), theStudyShape + ) + aGroup.SetSelection(aGroupIndices) + if theFields: + self.fillField(aGroup, aRef, theEngine, aGroupIndices) + # a group takes shape from the main result + # aGroup.SetShapeByStream(aRef.firstResult().shape().getShapeStream(False)) # group shape + allGroupsProcessed.append(aGroupEntry) + # check all existing groups: if some does not processed, remove it from the tree + aSOIter = SHAPERSTUDY_utils.getStudy().NewChildIterator(theStudyShape.GetSO()) + while aSOIter.More(): + aSO = aSOIter.Value() + anIOR = aSO.GetIOR() + if len(anIOR): + anObj = salome.orb.string_to_object(anIOR) + if ( + theFields + and isinstance(anObj, SHAPERSTUDY_ORB._objref_SHAPER_Field) + ) or ( + not theFields + and type(anObj) == SHAPERSTUDY_ORB._objref_SHAPER_Group + ): + anEntry = anObj.GetEntry() + if ( + anEntry not in allGroupsProcessed + ): # found a removed group => remove + aBuilder = SHAPERSTUDY_utils.getStudy().NewBuilder() + aBuilder.RemoveObject(anObj.GetSO()) + aSOIter.Next() # Part of the "execute" method: theFiled fields filling. def fillField(self, theField, theFeature, theEngine, theSelectionIndices): - aTables = theFeature.tables("values") - aValType = aTables.type() # type of the values - aValTypeToSet = aValType - if aValType == 3: # strings do not supported by SMESH, so, make them empty boolean table - aValTypeToSet = 0 - theField.SetValuesType(aValTypeToSet) - aNumSteps = aTables.tables() # number of steps is number of tables - aSteps = [] - for aVal in range(aNumSteps): - aSteps.append(aVal + 1) - theField.SetSteps(aSteps) - aCompNames = [] - aCompNamesAttr = theFeature.stringArray("components_names") - for anIndex in range(aCompNamesAttr.size()): - aCompNames.append(aCompNamesAttr.value(anIndex)) - theField.SetComponents(aCompNames) - # prepare the sub-shapes indices: all values for all sub-shapes must be defined - aShapeOp = theEngine.GetIShapesOperations() - allIndices = aShapeOp.GetAllSubShapesIDs(theField.GetShape(), theField.GetSelectionType(), False) - # define steps - theField.ClearFieldSteps() - for aVal in range(aNumSteps): - aVals = [] - for aCol in range(aTables.columns()): - #for aRow in range(aTables.rows()): - for anIndex in allIndices: - if anIndex in theSelectionIndices: - aRow = theSelectionIndices.index(anIndex) + 1 # starting from the first line - else: - aRow = 0 # default value - aStrVal = aTables.valueStr(aRow, aCol, aVal) - if aValType == 0: # boolean - if aStrVal == "True": - aVals.append(1) - else: - aVals.append(0) - elif aValType == 1: # int - aVals.append(int(aStrVal)) - elif aValType == 2: # double - aVals.append(float(aStrVal)) - theField.AddFieldStep(theFeature.intArray("stamps").value(aVal), aVal + 1, aVals) + aTables = theFeature.tables("values") + aValType = aTables.type() # type of the values + aValTypeToSet = aValType + if ( + aValType == 3 + ): # strings do not supported by SMESH, so, make them empty boolean table + aValTypeToSet = 0 + theField.SetValuesType(aValTypeToSet) + aNumSteps = aTables.tables() # number of steps is number of tables + aSteps = [] + for aVal in range(aNumSteps): + aSteps.append(aVal + 1) + theField.SetSteps(aSteps) + aCompNames = [] + aCompNamesAttr = theFeature.stringArray("components_names") + for anIndex in range(aCompNamesAttr.size()): + aCompNames.append(aCompNamesAttr.value(anIndex)) + theField.SetComponents(aCompNames) + # prepare the sub-shapes indices: all values for all sub-shapes must be defined + aShapeOp = theEngine.GetIShapesOperations() + allIndices = aShapeOp.GetAllSubShapesIDs( + theField.GetShape(), theField.GetSelectionType(), False + ) + # define steps + theField.ClearFieldSteps() + for aVal in range(aNumSteps): + aVals = [] + for aCol in range(aTables.columns()): + # for aRow in range(aTables.rows()): + for anIndex in allIndices: + if anIndex in theSelectionIndices: + aRow = ( + theSelectionIndices.index(anIndex) + 1 + ) # starting from the first line + else: + aRow = 0 # default value + aStrVal = aTables.valueStr(aRow, aCol, aVal) + if aValType == 0: # boolean + if aStrVal == "True": + aVals.append(1) + else: + aVals.append(0) + elif aValType == 1: # int + aVals.append(int(aStrVal)) + elif aValType == 2: # double + aVals.append(float(aStrVal)) + theField.AddFieldStep( + theFeature.intArray("stamps").value(aVal), aVal + 1, aVals + ) diff --git a/src/ConstructionAPI/Test/TestAxis.py b/src/ConstructionAPI/Test/TestAxis.py index c14ef9d45..233491a9d 100644 --- a/src/ConstructionAPI/Test/TestAxis.py +++ b/src/ConstructionAPI/Test/TestAxis.py @@ -22,14 +22,14 @@ from salome.shaper import model from GeomAPI import * from ModelAPI import * -class AxisTestCase(unittest.TestCase): +class AxisTestCase(unittest.TestCase): def setUp(self): self.doc = model.moduleDocument() def tearDown(self): model.end() - assert(model.checkPythonDump()) + assert model.checkPythonDump() ModelAPI_Session.get().closeAll() def checkAxis(self, axis, x1, y1, z1, x2, y2, z2): @@ -46,60 +46,76 @@ class AxisTestCase(unittest.TestCase): self.assertAlmostEqual(p2.y(), y2, 6) self.assertAlmostEqual(p2.z(), z2, 6) - def test_axis_by_dimensions(self): - """ Test 1. Create axis starting from Origin with the given dimensions - """ + """Test 1. Create axis starting from Origin with the given dimensions""" axis = model.addAxis(self.doc, 10, 50, 100) self.checkAxis(axis, 0, 0, 0, 10, 50, 100) def test_axis_by_points(self): - """ Test 2. Create axis between pair of points - """ + """Test 2. Create axis between pair of points""" model.addPoint(self.doc, 10, 0, 0) - axis = model.addAxis(self.doc, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) + axis = model.addAxis( + self.doc, + model.selection("VERTEX", "Origin"), + model.selection("VERTEX", "Point_2"), + ) self.checkAxis(axis, 0, 0, 0, 10, 0, 0) def test_axis_by_point_and_plane(self): - """ Test 3. Create axis orthogonal to a plane and passing through a point - """ + """Test 3. Create axis orthogonal to a plane and passing through a point""" model.addPoint(self.doc, 10, 0, 0) - axis = model.addAxis(self.doc, model.selection("FACE", "YOZ"), model.selection("VERTEX", "Point_2")) + axis = model.addAxis( + self.doc, + model.selection("FACE", "YOZ"), + model.selection("VERTEX", "Point_2"), + ) self.checkAxis(axis, 10, 0, 0, 0, 0, 0) def test_axis_by_line(self): - """ Test 4. Create axis by edge on a box - """ + """Test 4. Create axis by edge on a box""" partDoc = model.addPart(self.doc).document() model.addBox(partDoc, 10, 10, 10) - axis = model.addAxis(partDoc, model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]")) + axis = model.addAxis( + partDoc, model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]") + ) self.checkAxis(axis, 10, 0, 0, 10, 0, 10) def test_axis_by_cylinder(self): - """ Test 5. Create axis by cylindrical face - """ + """Test 5. Create axis by cylindrical face""" partDoc = model.addPart(self.doc).document() model.addCylinder(partDoc, 5, 10) axis = model.addAxis(partDoc, model.selection("FACE", "Cylinder_1_1/Face_1")) self.checkAxis(axis, 0, 0, -1, 0, 0, 11) def test_axis_by_point_and_direction(self): - """ Test 6. Create axis starting from a point with a given direction - """ + """Test 6. Create axis starting from a point with a given direction""" model.addPoint(self.doc, 10, 0, 0) axis = model.addAxis(self.doc, model.selection("VERTEX", "Point_2"), 10, 20, 30) self.checkAxis(axis, 10, 0, 0, 20, 20, 30) def test_axis_by_planes(self): - """ Test 7. Create axis as intersection of two planes - """ - axis = model.addAxis(self.doc, model.selection("FACE", "XOZ"), model.selection("FACE", "YOZ")) + """Test 7. Create axis as intersection of two planes""" + axis = model.addAxis( + self.doc, model.selection("FACE", "XOZ"), model.selection("FACE", "YOZ") + ) self.checkAxis(axis, 0, 0, 0, 0, 0, 100) - axis = model.addAxis(self.doc, model.selection("FACE", "XOZ"), 10, False, model.selection("FACE", "YOZ")) + axis = model.addAxis( + self.doc, + model.selection("FACE", "XOZ"), + 10, + False, + model.selection("FACE", "YOZ"), + ) self.checkAxis(axis, 0, -10, 0, 0, -10, 100) - axis = model.addAxis(self.doc, model.selection("FACE", "XOZ"), model.selection("FACE", "YOZ"), 10, False) + axis = model.addAxis( + self.doc, + model.selection("FACE", "XOZ"), + model.selection("FACE", "YOZ"), + 10, + False, + ) self.checkAxis(axis, 10, 0, 0, 10, 0, 100) diff --git a/src/ConstructionAPI/Test/TestPoint.py b/src/ConstructionAPI/Test/TestPoint.py index 60ff01fc1..7c759e4e4 100644 --- a/src/ConstructionAPI/Test/TestPoint.py +++ b/src/ConstructionAPI/Test/TestPoint.py @@ -23,8 +23,8 @@ import ModelAPI import ConstructionAPI from salome.shaper import model -class PointTestCase(unittest.TestCase): +class PointTestCase(unittest.TestCase): def setUp(self): self.session = ModelAPI.ModelAPI_Session.get() self.doc = self.session.moduleDocument() @@ -33,18 +33,18 @@ class PointTestCase(unittest.TestCase): def tearDown(self): self.session.finishOperation() - assert(model.checkPythonDump()) + assert model.checkPythonDump() self.session.closeAll() def test_ConstructorWithValues(self): point = ConstructionAPI.ConstructionAPI_Point(self.feature, 10, "20", "x + 30") - #self.assertEqual(10, point.x().value()) - #self.assertEqual("20", point.y().text()) - #self.assertEqual("x + 30", point.z().text()) + # self.assertEqual(10, point.x().value()) + # self.assertEqual("20", point.y().text()) + # self.assertEqual("x + 30", point.z().text()) def test_setValue(self): point = ConstructionAPI.ConstructionAPI_Point(self.feature) - assert(point.point().isInitialized() == False) + assert point.point().isInitialized() == False point.setByXYZ(10, "20", "x + 30") print(dir(point.point())) @@ -52,6 +52,7 @@ class PointTestCase(unittest.TestCase): self.assertEqual("20", point.point().textY()) self.assertEqual("x + 30", point.point().textZ()) + if __name__ == "__main__": test_program = unittest.main(exit=False) assert test_program.result.wasSuccessful(), "Test failed" diff --git a/src/ConstructionPlugin/Test/Test19207.py b/src/ConstructionPlugin/Test/Test19207.py index b81c438f0..9bc20c46f 100644 --- a/src/ConstructionPlugin/Test/Test19207.py +++ b/src/ConstructionPlugin/Test/Test19207.py @@ -24,13 +24,24 @@ 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(-27.27564593372983, -98.06529667720862, 118.6032908025252, -158.4943424420008) -SketchLine_2 = Sketch_1.addLine(48.47982068764622, 136.9061129612801, 209.0029126232743, 12.63448992263632) +SketchLine_1 = Sketch_1.addLine( + -27.27564593372983, -98.06529667720862, 118.6032908025252, -158.4943424420008 +) +SketchLine_2 = Sketch_1.addLine( + 48.47982068764622, 136.9061129612801, 209.0029126232743, 12.63448992263632 +) model.do() -Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")]) +Filling_1 = model.addFilling( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], +) Plane_1 = model.addPlane(Part_1_doc, model.selection("FACE", "Filling_1_1"), 10, False) model.end() from ModelAPI import * + factory = ModelAPI_Session.get().validators() -assert(factory.validate(Plane_1.feature())) +assert factory.validate(Plane_1.feature()) diff --git a/src/ConstructionPlugin/Test/Test19471.py b/src/ConstructionPlugin/Test/Test19471.py index 49746a550..8fe80d646 100644 --- a/src/ConstructionPlugin/Test/Test19471.py +++ b/src/ConstructionPlugin/Test/Test19471.py @@ -25,8 +25,14 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Point_2 = model.addPoint(Part_1_doc, 5, 0, 0) Point_3 = model.addPoint(Part_1_doc, 20, 0, 0) -Edge_1 = model.addEdge(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")) -Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "all-in-Edge_1"), 10, False, False) +Edge_1 = model.addEdge( + Part_1_doc, + model.selection("VERTEX", "Point_1"), + model.selection("VERTEX", "Point_2"), +) +Point_4 = model.addPoint( + Part_1_doc, model.selection("EDGE", "all-in-Edge_1"), 10, False, False +) model.end() -assert(Point_4.feature().error() != "") +assert Point_4.feature().error() != "" diff --git a/src/ConstructionPlugin/Test/TestAxisCreation.py b/src/ConstructionPlugin/Test/TestAxisCreation.py index 6080d9dcb..44941dc02 100644 --- a/src/ConstructionPlugin/Test/TestAxisCreation.py +++ b/src/ConstructionPlugin/Test/TestAxisCreation.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -36,56 +36,58 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +assert len(aPartFeature.results()) == 1 aPartResult = modelAPI_ResultPart(aPartFeature.firstResult()) aPart = aPartResult.partDoc() -#========================================================================= +# ========================================================================= # Create a first point -#========================================================================= +# ========================================================================= aSession.startOperation() aPointFeature = aPart.addFeature("Point") aPointFeatureData = aPointFeature.data() -assert(aPointFeatureData is not None) -geomDataAPI_Point(aPointFeatureData.attribute("point3d")).setValue(0., 0., 0.) +assert aPointFeatureData is not None +geomDataAPI_Point(aPointFeatureData.attribute("point3d")).setValue(0.0, 0.0, 0.0) aPointFeatureData.string("creation_method").setValue("by_xyz") aPointFeature.execute() aSession.finishOperation() -aPoint1Result = aPointFeature.firstResult(); +aPoint1Result = aPointFeature.firstResult() -#========================================================================= +# ========================================================================= # Create a second point -#========================================================================= +# ========================================================================= aSession.startOperation() aPointFeature = aPart.addFeature("Point") aPointFeatureData = aPointFeature.data() -assert(aPointFeatureData is not None) -geomDataAPI_Point(aPointFeatureData.attribute("point3d")).setValue(0., 0., 100.) +assert aPointFeatureData is not None +geomDataAPI_Point(aPointFeatureData.attribute("point3d")).setValue(0.0, 0.0, 100.0) aPointFeatureData.string("creation_method").setValue("by_xyz") aPointFeature.execute() aSession.finishOperation() -aPoint2Result = aPointFeature.firstResult(); +aPoint2Result = aPointFeature.firstResult() -#========================================================================= +# ========================================================================= # Create axis by two points -#========================================================================= +# ========================================================================= aSession.startOperation() anAxisFeature = aPart.addFeature("Axis") anAxisFeatureData = anAxisFeature.data() -assert(anAxisFeatureData is not None) +assert anAxisFeatureData is not None anAxisFeatureData.string("CreationMethod").setValue("AxisByPointsCase") anAxisFeatureData.selection("FirstPoint").setValue(aPoint1Result, aPoint1Result.shape()) -anAxisFeatureData.selection("SecondPoint").setValue(aPoint2Result, aPoint2Result.shape()) +anAxisFeatureData.selection("SecondPoint").setValue( + aPoint2Result, aPoint2Result.shape() +) anAxisFeature.execute() aSession.finishOperation() -assert (len(anAxisFeature.results()) > 0) +assert len(anAxisFeature.results()) > 0 anAxisResult = modelAPI_ResultConstruction(anAxisFeature.firstResult()) -assert (anAxisResult is not None) +assert anAxisResult is not None -#========================================================================= +# ========================================================================= # Create a sketch circle to extrude -#========================================================================= +# ========================================================================= aSession.startOperation() aCircleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")) @@ -102,48 +104,52 @@ anCircleCentr.setValue(0, 0) aCircleRadius.setValue(50) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on circle -#========================================================================= +# ========================================================================= # Build shape from sketcher results aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult()) -assert (aCircleSketchResult.facesNum() > 0) +assert aCircleSketchResult.facesNum() > 0 # Create extrusion aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "Extrusion") +assert anExtrusionFt.getKind() == "Extrusion" # selection type FACE=4 -anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(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) -anExtrusionFt.real("to_offset").setValue(0) #TODO: remove -anExtrusionFt.real("from_offset").setValue(0) #TODO: remove +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() == 100.0) +assert anExtrusionFt.real("to_size").value() == 100.0 # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult is not None) +assert anExtrusionResult is not None -#========================================================================= +# ========================================================================= # Create axis by cylinder -#========================================================================= +# ========================================================================= aSession.startOperation() anAxisFeature = aPart.addFeature("Axis") anAxisFeatureData = anAxisFeature.data() -assert(anAxisFeatureData is not None) +assert anAxisFeatureData is not None anAxisFeatureData.string("CreationMethod").setValue("AxisByCylindricalFaceCase") -anAxisFeatureData.selection("CylindricalFace").selectSubShape("face", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2") +anAxisFeatureData.selection("CylindricalFace").selectSubShape( + "face", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2" +) anAxisFeature.execute() aSession.finishOperation() -assert (len(anAxisFeature.results()) > 0) +assert len(anAxisFeature.results()) > 0 anAxisResult = modelAPI_ResultConstruction(anAxisFeature.firstResult()) -assert (anAxisResult is not None) +assert anAxisResult is not None # Create a sketch with line aSession.startOperation() @@ -158,7 +164,7 @@ aSession.finishOperation() aSession.startOperation() anAxis = model.addAxis(aPart, aSketchLine.result()) aSession.finishOperation() -assert (len(anAxis.results()) > 0) +assert len(anAxis.results()) > 0 # Create plane aSession.startOperation() @@ -178,7 +184,7 @@ aSession.finishOperation() aSession.startOperation() anAxis = model.addAxis(aPart, aPlane1.result(), aSketchPoint.result()) aSession.finishOperation() -assert (len(anAxis.results()) > 0) +assert len(anAxis.results()) > 0 # Create plane aSession.startOperation() @@ -189,12 +195,12 @@ aSession.finishOperation() aSession.startOperation() anAxis = model.addAxis(aPart, aPlane1.result(), aPlane2.result()) aSession.finishOperation() -assert (len(anAxis.results()) > 0) +assert len(anAxis.results()) > 0 # Test an axis by two planes and offsets aSession.startOperation() anAxis = model.addAxis(aPart, aPlane1.result(), 50, False, aPlane2.result(), 100, True) aSession.finishOperation() -assert (len(anAxis.results()) > 0) +assert len(anAxis.results()) > 0 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ConstructionPlugin/Test/TestAxis_ErrorMsg.py b/src/ConstructionPlugin/Test/TestAxis_ErrorMsg.py index 4e1f18013..1753f5b82 100644 --- a/src/ConstructionPlugin/Test/TestAxis_ErrorMsg.py +++ b/src/ConstructionPlugin/Test/TestAxis_ErrorMsg.py @@ -19,6 +19,7 @@ from ModelAPI import * + aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -71,7 +72,7 @@ Axis_1.string("CreationMethod").setValue("AxisByCylindricalFaceCase") Axis_1.selection("CylindricalFace").selectSubShape("COMPOUND", "Compound_2_1") Axis_1.execute() aSession.finishOperation() -assert(Axis_1.error() != "") +assert Axis_1.error() != "" # Axis by dimensions aSession.startOperation() @@ -80,7 +81,7 @@ 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() != "") +assert Axis_1.error() != "" aSession.finishOperation() # Axis by line @@ -88,7 +89,7 @@ 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() != "") +assert Axis_1.error() != "" aSession.finishOperation() # Axis by plane and point @@ -97,7 +98,7 @@ 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() != "") +assert Axis_1.error() != "" aSession.finishOperation() # Axis by two planes @@ -106,7 +107,7 @@ 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() != "") +assert Axis_1.error() != "" aSession.finishOperation() aSession.startOperation() @@ -115,5 +116,5 @@ 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() != "") +assert Axis_1.error() != "" aSession.finishOperation() diff --git a/src/ConstructionPlugin/Test/TestPlane.py b/src/ConstructionPlugin/Test/TestPlane.py index 2cc9de6c5..54908ba99 100644 --- a/src/ConstructionPlugin/Test/TestPlane.py +++ b/src/ConstructionPlugin/Test/TestPlane.py @@ -39,7 +39,7 @@ aSession.finishOperation() aSession.startOperation() aPlane = model.addPlane(aDocument, 1, 1, 1, 0) aSession.finishOperation() -assert (len(aPlane.results()) > 0) +assert len(aPlane.results()) > 0 # Create a point 1 aSession.startOperation() @@ -60,7 +60,7 @@ aSession.finishOperation() aSession.startOperation() aPlane = model.addPlane(aDocument, aPoint1.result(), aPoint2.result(), aPoint3.result()) aSession.finishOperation() -assert (len(aPlane.results()) > 0) +assert len(aPlane.results()) > 0 # Create an axis aSession.startOperation() @@ -71,19 +71,19 @@ aSession.finishOperation() aSession.startOperation() aPlane = model.addPlane(aDocument, anAxis.result(), aPoint3.result(), True) aSession.finishOperation() -assert (len(aPlane.results()) > 0) +assert len(aPlane.results()) > 0 # Test a plane by distance from other aSession.startOperation() aPlane = model.addPlane(aDocument, aPlane.result(), 50, False) aSession.finishOperation() -assert (len(aPlane.results()) > 0) +assert len(aPlane.results()) > 0 # Test a plane by coincidence to point aSession.startOperation() aCoincidentPlane = model.addPlane(aDocument, aPlane.result(), aPoint2.result()) aSession.finishOperation() -assert (len(aCoincidentPlane.results()) > 0) +assert len(aCoincidentPlane.results()) > 0 # Create an axis aSession.startOperation() @@ -92,14 +92,16 @@ aSession.finishOperation() # Test a plane by rotation aSession.startOperation() -aRotatedPlane = model.addPlane(aDocument, aCoincidentPlane.result(), anAxis.result(), 45) +aRotatedPlane = model.addPlane( + aDocument, aCoincidentPlane.result(), anAxis.result(), 45 +) aSession.finishOperation() -assert (len(aRotatedPlane.results()) > 0) +assert len(aRotatedPlane.results()) > 0 # Test plane by two parallel planes aSession.startOperation() aPlane = model.addPlane(aDocument, aCoincidentPlane.result(), aPlane.result()) aSession.finishOperation() -assert (len(aPlane.results()) > 0) +assert len(aPlane.results()) > 0 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ConstructionPlugin/Test/TestPlane_Copies.py b/src/ConstructionPlugin/Test/TestPlane_Copies.py index 014169067..19fe9149a 100644 --- a/src/ConstructionPlugin/Test/TestPlane_Copies.py +++ b/src/ConstructionPlugin/Test/TestPlane_Copies.py @@ -39,7 +39,7 @@ aSession.finishOperation() aSession.startOperation() aPlane = model.addPlane(aDocument, 1, 1, 1, 0) aSession.finishOperation() -assert (len(aPlane.results()) > 0) +assert len(aPlane.results()) > 0 # Create an axis aSession.startOperation() @@ -51,15 +51,15 @@ aSession.startOperation() aRotatedPlane = model.addPlane(aDocument, aPlane.result(), anAxis.result(), 45) aRotatedPlanes = model.addPlane(aDocument, aPlane.result(), anAxis.result(), 45, 5) aSession.finishOperation() -assert (len(aRotatedPlane.results()) > 0) -assert (len(aRotatedPlanes.results()) == 5) +assert len(aRotatedPlane.results()) > 0 +assert len(aRotatedPlanes.results()) == 5 # Test a plane by distance from other aSession.startOperation() anOnlyPlane = model.addPlane(aDocument, aPlane.result(), 50, False) -assert (len(anOnlyPlane.results()) > 0) +assert len(anOnlyPlane.results()) > 0 aPlane = model.addPlane(aDocument, aPlane.result(), 50, False, 10) aSession.finishOperation() -assert (len(aPlane.results()) == 10) +assert len(aPlane.results()) == 10 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ConstructionPlugin/Test/TestPlane_ErrorMsg.py b/src/ConstructionPlugin/Test/TestPlane_ErrorMsg.py index f1f3275fc..458a45000 100644 --- a/src/ConstructionPlugin/Test/TestPlane_ErrorMsg.py +++ b/src/ConstructionPlugin/Test/TestPlane_ErrorMsg.py @@ -19,6 +19,7 @@ from ModelAPI import * + aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -71,7 +72,7 @@ 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() != "") +assert Plane_1.error() != "" aSession.finishOperation() # Unsupported type @@ -80,7 +81,7 @@ 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() != "") +assert Plane_1.error() != "" aSession.finishOperation() # By two parallel planes @@ -89,13 +90,13 @@ 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() != "") +assert Plane_1.error() != "" aSession.finishOperation() aSession.startOperation() Plane_1.selection("plane1").selectSubShape("COMPOUND", "Compound_1_1") Plane_1.execute() -assert(Plane_1.error() != "") +assert Plane_1.error() != "" aSession.finishOperation() # By distance from other plane @@ -105,7 +106,7 @@ 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() != "") +assert Plane_1.error() != "" aSession.finishOperation() # By coincident point @@ -113,7 +114,7 @@ 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() != "") +assert Plane_1.error() != "" aSession.finishOperation() # By rotation @@ -122,11 +123,11 @@ 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() != "") +assert Plane_1.error() != "" aSession.finishOperation() aSession.startOperation() Plane_1.selection("plane").selectSubShape("COMPOUND", "Compound_1_1") Plane_1.execute() -assert(Plane_1.error() != "") +assert Plane_1.error() != "" aSession.finishOperation() diff --git a/src/ConstructionPlugin/Test/TestPlane_FaceValidator.py b/src/ConstructionPlugin/Test/TestPlane_FaceValidator.py index 17220c452..a7248b955 100644 --- a/src/ConstructionPlugin/Test/TestPlane_FaceValidator.py +++ b/src/ConstructionPlugin/Test/TestPlane_FaceValidator.py @@ -24,14 +24,23 @@ 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")]) +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() != "") +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() != "") +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() diff --git a/src/ConstructionPlugin/Test/TestPointName.py b/src/ConstructionPlugin/Test/TestPointName.py index d9a9b4d92..c48d2b047 100644 --- a/src/ConstructionPlugin/Test/TestPointName.py +++ b/src/ConstructionPlugin/Test/TestPointName.py @@ -26,8 +26,8 @@ aDoc = aSession.moduleDocument() aSession.startOperation() aFeature = aDoc.addFeature("Point") aFeatureData = aFeature.data() -assert(aFeatureData is not None) -geomDataAPI_Point(aFeatureData.attribute("point3d")).setValue(0., 0., 0.) +assert aFeatureData is not None +geomDataAPI_Point(aFeatureData.attribute("point3d")).setValue(0.0, 0.0, 0.0) aFeatureData.string("creation_method").setValue("by_xyz") aFeatureName = aFeature.name() aFeature.execute() @@ -37,7 +37,8 @@ aSession.finishOperation() aFeature1 = aDoc.object("Construction", 7) aFeature1Name = aFeature1.data().name() -assert (aFeatureName == aFeature1Name) +assert aFeatureName == aFeature1Name from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/ConstructionPlugin/Test/TestPoint_34658.py b/src/ConstructionPlugin/Test/TestPoint_34658.py index 4ef89778f..141bbbb2f 100644 --- a/src/ConstructionPlugin/Test/TestPoint_34658.py +++ b/src/ConstructionPlugin/Test/TestPoint_34658.py @@ -21,13 +21,14 @@ import sys import salome from ModelAPI import * + def assertPoint(aPoint): - assert(aPoint is not None) - aPointFeature = aPoint.feature() - assert(len(aPointFeature.results()) > 0) - aPointResult = modelAPI_ResultConstruction(aPointFeature.firstResult()) - assert(aPointResult is not None) - assert(aPointResult.isInfinite()) + assert aPoint is not None + aPointFeature = aPoint.feature() + assert len(aPointFeature.results()) > 0 + aPointResult = modelAPI_ResultConstruction(aPointFeature.firstResult()) + assert aPointResult is not None + assert aPointResult.isInfinite() salome.salome_init() @@ -56,10 +57,22 @@ model.do() Edge_1 = model.addEdge(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], False) ### Create LinearCopy -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OX"), 4, 5, keepSubResults = True) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OX"), + 4, + 5, + keepSubResults=True, +) ### Create Plane -Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), True) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), + True, +) Plane_4.setName("Plane_2") Plane_4.result().setName("Plane_2") Plane_4.result().setTransparency(0.6) @@ -71,7 +84,14 @@ Plane_5.result().setName("Plane_3") Plane_5.result().setTransparency(0.6) ### Create Plane -Plane_6 = model.addPlane(Part_1_doc, model.selection("EDGE", "LinearCopy_1_1_2"), model.selection("VERTEX", "LinearCopy_1_1_2/MV:Translated&Sketch_1/SketchLine_1_EndVertex"), True) +Plane_6 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "LinearCopy_1_1_2"), + model.selection( + "VERTEX", "LinearCopy_1_1_2/MV:Translated&Sketch_1/SketchLine_1_EndVertex" + ), + True, +) Plane_6.setName("Plane_4") Plane_6.result().setName("Plane_4") Plane_6.result().setTransparency(0.6) @@ -83,7 +103,14 @@ Plane_7.result().setName("Plane_5") Plane_7.result().setTransparency(0.6) ### Create Plane -Plane_8 = model.addPlane(Part_1_doc, model.selection("EDGE", "LinearCopy_1_1_3"), model.selection("VERTEX", "LinearCopy_1_1_3/MV:Translated&Sketch_1/SketchLine_1_EndVertex"), True) +Plane_8 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "LinearCopy_1_1_3"), + model.selection( + "VERTEX", "LinearCopy_1_1_3/MV:Translated&Sketch_1/SketchLine_1_EndVertex" + ), + True, +) Plane_8.setName("Plane_6") Plane_8.result().setName("Plane_6") Plane_8.result().setTransparency(0.6) @@ -98,19 +125,33 @@ Plane_9.result().setTransparency(0.6) Point_1 = model.addPoint(Part_1_doc, 16, 0.5, 1.3) ### Create Point (by position on edge) -Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "LinearCopy_1_1_4"), 2.5, False, False) +Point_2 = model.addPoint( + Part_1_doc, model.selection("EDGE", "LinearCopy_1_1_4"), 2.5, False, False +) ### Create Point (by projection of point on plane) -Point_3 = model.addPoint(Part_1_doc, model.selection("VERTEX", "LinearCopy_1_1_3/MV:Translated&Sketch_1/SketchLine_1_EndVertex"), model.selection("FACE", "Plane_7")) +Point_3 = model.addPoint( + Part_1_doc, + model.selection( + "VERTEX", "LinearCopy_1_1_3/MV:Translated&Sketch_1/SketchLine_1_EndVertex" + ), + model.selection("FACE", "Plane_7"), +) ### Create Point (by intersection of axis and plane) -Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "LinearCopy_1_1_2"), model.selection("FACE", "Plane_5")) +Point_4 = model.addPoint( + Part_1_doc, + model.selection("EDGE", "LinearCopy_1_1_2"), + model.selection("FACE", "Plane_5"), +) ### Create Sketch Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2")) ### Create SketchProjection -SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False) +SketchProjection_1 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() ### Create SketchCircle @@ -120,7 +161,16 @@ Sketch_2.setRadius(SketchCircle_1.results()[1], 0.6) model.do() ### Create Extrusion -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], model.selection(), model.selection("FACE", "Plane_3"), 0, model.selection(), 0, "Faces|Wires") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], + model.selection(), + model.selection("FACE", "Plane_3"), + 0, + model.selection(), + 0, + "Faces|Wires", +) Extrusion_1.result().setTransparency(0.6) ### Create Point (by center of gravity) @@ -130,13 +180,32 @@ Point_5 = model.addPoint(Part_1_doc, model.selection("SOLID", "Extrusion_1_1")) Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "Point_1"), 0.8) ### Create Cylinder -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Point_2"), model.selection("EDGE", "LinearCopy_1_1_2"), 0.8, 1) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "Point_2"), + model.selection("EDGE", "LinearCopy_1_1_2"), + 0.8, + 1, +) ### Create Torus -Torus_1 = model.addTorus(Part_1_doc, model.selection("VERTEX", "Point_3"), model.selection("EDGE", "LinearCopy_1_1_3"), 0.8, 0.25) +Torus_1 = model.addTorus( + Part_1_doc, + model.selection("VERTEX", "Point_3"), + model.selection("EDGE", "LinearCopy_1_1_3"), + 0.8, + 0.25, +) ### Create Cone -Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "Point_4"), model.selection("EDGE", "LinearCopy_1_1_4"), 0.8, 0.3, 1) +Cone_1 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "Point_4"), + model.selection("EDGE", "LinearCopy_1_1_4"), + 0.8, + 0.3, + 1, +) ### Create Sphere Sphere_2 = model.addSphere(Part_1_doc, model.selection("VERTEX", "Point_5"), 0.8) diff --git a/src/ConstructionPlugin/Test/TestPoint_Edge.py b/src/ConstructionPlugin/Test/TestPoint_Edge.py index 70273db2c..3412f7d8c 100644 --- a/src/ConstructionPlugin/Test/TestPoint_Edge.py +++ b/src/ConstructionPlugin/Test/TestPoint_Edge.py @@ -29,39 +29,67 @@ 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(0, 0, 100, 100) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +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/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_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, +) model.do() model.end() from GeomAPI import GeomAPI_Vertex -assert (len(Point_2.results()) > 0) +assert len(Point_2.results()) > 0 rightPosition = GeomAPI_Vertex(35.3553390593, 35.3553390593, 0) -assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()) -assert (len(Point_3.results()) > 0) +assert len(Point_3.results()) > 0 rightPosition = GeomAPI_Vertex(40, 40, 0) -assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()) -assert (len(Point_4.results()) > 0) +assert len(Point_4.results()) > 0 rightPosition = GeomAPI_Vertex(60, 60, 0) -assert(rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape()) -assert (len(Point_5.results()) > 0) +assert len(Point_5.results()) > 0 rightPosition = GeomAPI_Vertex(0, 50, 10) -assert(rightPosition.isEqual(Point_5.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_5.results()[0].resultSubShapePair()[0].shape()) -assert (len(Point_6.results()) > 0) +assert len(Point_6.results()) > 0 rightPosition = GeomAPI_Vertex(0, -50, 10) -assert(rightPosition.isEqual(Point_6.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_6.results()[0].resultSubShapePair()[0].shape()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ConstructionPlugin/Test/TestPoint_ErrorMsg.py b/src/ConstructionPlugin/Test/TestPoint_ErrorMsg.py index e10062725..2b321a573 100644 --- a/src/ConstructionPlugin/Test/TestPoint_ErrorMsg.py +++ b/src/ConstructionPlugin/Test/TestPoint_ErrorMsg.py @@ -19,6 +19,7 @@ from ModelAPI import * + aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -72,5 +73,5 @@ Point_1.string("intersection_type").setValue("intersection_type_by_line_and_plan 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() != "") +assert Point_1.error() != "" aSession.finishOperation() diff --git a/src/ConstructionPlugin/Test/TestPoint_FiniteValidator.py b/src/ConstructionPlugin/Test/TestPoint_FiniteValidator.py index 0a536b72c..ddcc19334 100644 --- a/src/ConstructionPlugin/Test/TestPoint_FiniteValidator.py +++ b/src/ConstructionPlugin/Test/TestPoint_FiniteValidator.py @@ -24,7 +24,9 @@ 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() != "") +Point_2 = model.addPoint( + Part_1_doc, model.selection("EDGE", "PartSet/OZ"), 10, False, False +) +assert Point_2.feature().error() != "" model.end() diff --git a/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfCircle.py b/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfCircle.py index 378bfcd86..a02ec823a 100644 --- a/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfCircle.py +++ b/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfCircle.py @@ -31,25 +31,39 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) 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/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) +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/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) +assert len(Point_2.results()) > 0 rightPosition = GeomAPI_Vertex(-50, 25, 0) -assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()) -assert (len(Point_3.results()) > 0) +assert len(Point_3.results()) > 0 rightPosition = GeomAPI_Vertex(50, 25, 0) -assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()) -assert (len(Point_4.results()) > 0) +assert len(Point_4.results()) > 0 rightPosition = GeomAPI_Vertex(0, 0, 100) -assert(rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfGravity.py b/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfGravity.py index 79e14719e..cfd002468 100644 --- a/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfGravity.py +++ b/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfGravity.py @@ -35,26 +35,28 @@ 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) +assert len(Point_2.results()) > 0 rightPosition = GeomAPI_Vertex(0, 0, 25) -assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()) -assert (len(Point_3.results()) > 0) +assert len(Point_3.results()) > 0 rightPosition = GeomAPI_Vertex(25, 25, 25) -assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()) -assert (len(Point_4.results()) > 0) +assert len(Point_4.results()) > 0 rightPosition = GeomAPI_Vertex(25, 25, 50) -assert(rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape()) -assert (len(Point_5.results()) > 0) +assert len(Point_5.results()) > 0 rightPosition = GeomAPI_Vertex(25, 0, 50) -assert(rightPosition.isEqual(Point_5.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_5.results()[0].resultSubShapePair()[0].shape()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ConstructionPlugin/Test/TestPoint_IntersectLineAndPlane.py b/src/ConstructionPlugin/Test/TestPoint_IntersectLineAndPlane.py index 1f4401d87..588a250a7 100644 --- a/src/ConstructionPlugin/Test/TestPoint_IntersectLineAndPlane.py +++ b/src/ConstructionPlugin/Test/TestPoint_IntersectLineAndPlane.py @@ -29,7 +29,9 @@ partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "Origin")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 60) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) model.do() Sketch_2 = model.addSketch(partSet, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_2.addLine(60, 100, 0, 20) @@ -37,18 +39,28 @@ 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/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())) +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/SketchArc_1_2"), 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())) +assert rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ConstructionPlugin/Test/TestPoint_IntersectLines.py b/src/ConstructionPlugin/Test/TestPoint_IntersectLines.py index 577ceeab2..0a28e898f 100644 --- a/src/ConstructionPlugin/Test/TestPoint_IntersectLines.py +++ b/src/ConstructionPlugin/Test/TestPoint_IntersectLines.py @@ -28,24 +28,34 @@ 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) 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/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]")) +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) +assert len(Point_2.results()) > 0 rightPosition = GeomAPI_Vertex(0, 50, 0) -assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()) -assert (len(Point_3.results()) > 0) +assert len(Point_3.results()) > 0 rightPosition = GeomAPI_Vertex(25, 50, 0) -assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ConstructionPlugin/Test/TestPoint_IntersectPlanes.py b/src/ConstructionPlugin/Test/TestPoint_IntersectPlanes.py index 58e6dbec1..7d740efbd 100644 --- a/src/ConstructionPlugin/Test/TestPoint_IntersectPlanes.py +++ b/src/ConstructionPlugin/Test/TestPoint_IntersectPlanes.py @@ -29,21 +29,46 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Point_2 = model.addPoint(Part_1_doc, 50, 50, 50) -Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OY"), model.selection("VERTEX", "Point_1"), False) -Plane_5 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OX"), model.selection("VERTEX", "Point_1"), False) -Plane_6 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OZ"), model.selection("VERTEX", "Point_1"), True) -Point_3 = model.addPoint(Part_1_doc, model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2"), model.selection("FACE", "Plane_3")) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "PartSet/OY"), + model.selection("VERTEX", "Point_1"), + False, +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "PartSet/OX"), + model.selection("VERTEX", "Point_1"), + False, +) +Plane_6 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "PartSet/OZ"), + model.selection("VERTEX", "Point_1"), + True, +) +Point_3 = model.addPoint( + Part_1_doc, + model.selection("FACE", "Plane_1"), + model.selection("FACE", "Plane_2"), + model.selection("FACE", "Plane_3"), +) Box_1 = model.addBox(Part_1_doc, 50, 25, 100) -Point_4 = model.addPoint(Part_1_doc, model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_3"), model.selection("FACE", "Box_1_1/Right")) +Point_4 = model.addPoint( + Part_1_doc, + model.selection("FACE", "Plane_1"), + model.selection("FACE", "Plane_3"), + model.selection("FACE", "Box_1_1/Right"), +) model.do() model.end() -assert (len(Point_3.results()) > 0) +assert len(Point_3.results()) > 0 rightPosition = GeomAPI_Vertex(50, 50, 50) -assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()) -assert (len(Point_4.results()) > 0) +assert len(Point_4.results()) > 0 rightPosition = GeomAPI_Vertex(50, 25, 50) -assert(rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ConstructionPlugin/Test/TestPoint_ProjectOnEdge.py b/src/ConstructionPlugin/Test/TestPoint_ProjectOnEdge.py index f3cc10d0e..b54ba6e98 100644 --- a/src/ConstructionPlugin/Test/TestPoint_ProjectOnEdge.py +++ b/src/ConstructionPlugin/Test/TestPoint_ProjectOnEdge.py @@ -32,19 +32,27 @@ 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/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]")) +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) +assert len(Point_2.results()) > 0 rightPosition = GeomAPI_Vertex(70.7106781187, 70.7106781187, 0) -assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()) -assert (len(Point_3.results()) > 0) +assert len(Point_3.results()) > 0 rightPosition = GeomAPI_Vertex(50, 50, 0) -assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ConstructionPlugin/Test/TestPoint_ProjectOnFace.py b/src/ConstructionPlugin/Test/TestPoint_ProjectOnFace.py index 002fe6408..70f5d6290 100644 --- a/src/ConstructionPlugin/Test/TestPoint_ProjectOnFace.py +++ b/src/ConstructionPlugin/Test/TestPoint_ProjectOnFace.py @@ -31,19 +31,27 @@ 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/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")) +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) +assert len(Point_2.results()) > 0 rightPosition = GeomAPI_Vertex(10, 0, 50) -assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()) -assert (len(Point_3.results()) > 0) +assert len(Point_3.results()) > 0 rightPosition = GeomAPI_Vertex(50, 0, 0) -assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ConstructionPlugin/Test/TestPoint_VertexSelection.py b/src/ConstructionPlugin/Test/TestPoint_VertexSelection.py index b1f79fc0b..87eb03e29 100644 --- a/src/ConstructionPlugin/Test/TestPoint_VertexSelection.py +++ b/src/ConstructionPlugin/Test/TestPoint_VertexSelection.py @@ -30,28 +30,57 @@ SketchLine_1 = Sketch_1.addLine(10, 10, 0, 10) SketchLine_2 = Sketch_1.addLine(0, 10, 0, 0) SketchLine_3 = Sketch_1.addLine(0, 0, 10, 0) SketchLine_4 = Sketch_1.addLine(10, 0, 10, 10) -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()) +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()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 10) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_4.result(), 10) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates() +) 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) -Point_2 = model.addPointXYZ(Part_1_doc, model.selection("VERTEX", "[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 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f", + ) + ], + model.selection(), + 10, + 0, +) +Point_2 = model.addPointXYZ( + Part_1_doc, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]", + ), +) model.end() from GeomAPI import GeomAPI_Vertex -assert (len(Point_2.results()) > 0) +assert len(Point_2.results()) > 0 rightPosition = GeomAPI_Vertex(10, 0, 10) -assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape())) +assert rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ConstructionPlugin/Test/TestPoint_XYZ.py b/src/ConstructionPlugin/Test/TestPoint_XYZ.py index 72c2347fa..9233dc1dd 100644 --- a/src/ConstructionPlugin/Test/TestPoint_XYZ.py +++ b/src/ConstructionPlugin/Test/TestPoint_XYZ.py @@ -39,6 +39,6 @@ aSession.finishOperation() aSession.startOperation() aPoint = model.addPoint(aDocument, 50, 50, 50) aSession.finishOperation() -assert (len(aPoint.results()) > 0) +assert len(aPoint.results()) > 0 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ConstructionPlugin/Test/UnitTestAxis.py b/src/ConstructionPlugin/Test/UnitTestAxis.py index 23f917b32..d9a2acf11 100644 --- a/src/ConstructionPlugin/Test/UnitTestAxis.py +++ b/src/ConstructionPlugin/Test/UnitTestAxis.py @@ -46,9 +46,9 @@ """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -63,13 +63,13 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +assert len(aPartFeature.results()) == 1 aPartResult = modelAPI_ResultPart(aPartFeature.firstResult()) aPart = aPartResult.partDoc() -#========================================================================= +# ========================================================================= # Creation of an Axis by coordinates -#========================================================================= +# ========================================================================= aSession.startOperation() anAxisByDimensions = aPart.addFeature("Axis") anAxisByDimensions.string("CreationMethod").setValue("AxisByDimensionsCase") @@ -79,14 +79,15 @@ anAxisByDimensions.real("DZ").setValue(1.4) anAxisByDimensions.execute() -assert(len(anAxisByDimensions.results()) > 0) +assert len(anAxisByDimensions.results()) > 0 anAxisByDimensions = modelAPI_ResultConstruction(anAxisByDimensions.firstResult()) -assert(anAxisByDimensions is not None) +assert anAxisByDimensions is not None aSession.finishOperation() -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/ConstructionPlugin/doc/examples/axis2.py b/src/ConstructionPlugin/doc/examples/axis2.py index f3640db62..377b97b02 100644 --- a/src/ConstructionPlugin/doc/examples/axis2.py +++ b/src/ConstructionPlugin/doc/examples/axis2.py @@ -6,6 +6,10 @@ 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, 0, 10, 10) -Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + Part_1_doc, + model.selection("VERTEX", "Point_1"), + model.selection("VERTEX", "Point_2"), +) model.do() model.end() diff --git a/src/ConstructionPlugin/doc/examples/axis4.py b/src/ConstructionPlugin/doc/examples/axis4.py index 63e48efcf..c2a65339b 100644 --- a/src/ConstructionPlugin/doc/examples/axis4.py +++ b/src/ConstructionPlugin/doc/examples/axis4.py @@ -4,7 +4,13 @@ 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) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "Cylinder_1_1/Face_1")) model.do() model.end() diff --git a/src/ConstructionPlugin/doc/examples/axis5.py b/src/ConstructionPlugin/doc/examples/axis5.py index 2c794345c..5e1a43c50 100644 --- a/src/ConstructionPlugin/doc/examples/axis5.py +++ b/src/ConstructionPlugin/doc/examples/axis5.py @@ -4,6 +4,10 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "PartSet/XOY"), model.selection("VERTEX", "PartSet/Origin")) +Axis_4 = model.addAxis( + Part_1_doc, + model.selection("FACE", "PartSet/XOY"), + model.selection("VERTEX", "PartSet/Origin"), +) model.do() model.end() diff --git a/src/ConstructionPlugin/doc/examples/axis6.py b/src/ConstructionPlugin/doc/examples/axis6.py index 9a4bfc90c..0ec4b930e 100644 --- a/src/ConstructionPlugin/doc/examples/axis6.py +++ b/src/ConstructionPlugin/doc/examples/axis6.py @@ -5,6 +5,10 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Left")) +Axis_4 = model.addAxis( + Part_1_doc, + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Left"), +) model.do() model.end() diff --git a/src/ConstructionPlugin/doc/examples/plane1.py b/src/ConstructionPlugin/doc/examples/plane1.py index bdc899edd..248c7dbfc 100644 --- a/src/ConstructionPlugin/doc/examples/plane1.py +++ b/src/ConstructionPlugin/doc/examples/plane1.py @@ -5,6 +5,11 @@ 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("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]")) +Plane_4 = model.addPlane( + Part_1_doc, + 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.do() model.end() diff --git a/src/ConstructionPlugin/doc/examples/plane2.py b/src/ConstructionPlugin/doc/examples/plane2.py index 857d07a3e..a0e40524b 100644 --- a/src/ConstructionPlugin/doc/examples/plane2.py +++ b/src/ConstructionPlugin/doc/examples/plane2.py @@ -5,6 +5,11 @@ 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("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]"), False) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]"), + False, +) model.do() model.end() diff --git a/src/ConstructionPlugin/doc/examples/plane4.py b/src/ConstructionPlugin/doc/examples/plane4.py index 7da2d9f4a..82ad2185f 100644 --- a/src/ConstructionPlugin/doc/examples/plane4.py +++ b/src/ConstructionPlugin/doc/examples/plane4.py @@ -5,6 +5,10 @@ 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/Top"), model.selection("FACE", "Box_1_1/Bottom")) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Bottom"), +) model.do() model.end() diff --git a/src/ConstructionPlugin/doc/examples/point2.py b/src/ConstructionPlugin/doc/examples/point2.py index b10612e45..94138dce1 100644 --- a/src/ConstructionPlugin/doc/examples/point2.py +++ b/src/ConstructionPlugin/doc/examples/point2.py @@ -5,6 +5,12 @@ 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("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), 0.4, True, False) +Point_2 = model.addPoint( + Part_1_doc, + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + 0.4, + True, + False, +) model.do() model.end() diff --git a/src/ConstructionPlugin/doc/examples/point3.py b/src/ConstructionPlugin/doc/examples/point3.py index 2cf1277f6..366ed448f 100644 --- a/src/ConstructionPlugin/doc/examples/point3.py +++ b/src/ConstructionPlugin/doc/examples/point3.py @@ -5,6 +5,10 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Point_2 = model.addPoint(Part_1_doc, 10, 10, 10) -Point_3 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("FACE", "PartSet/XOY")) +Point_3 = model.addPoint( + Part_1_doc, + model.selection("VERTEX", "Point_1"), + model.selection("FACE", "PartSet/XOY"), +) model.do() model.end() diff --git a/src/ConstructionPlugin/doc/examples/point4.py b/src/ConstructionPlugin/doc/examples/point4.py index a760bcc5b..996d00007 100644 --- a/src/ConstructionPlugin/doc/examples/point4.py +++ b/src/ConstructionPlugin/doc/examples/point4.py @@ -5,8 +5,18 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -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_5 = model.addAxis(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]")) -Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("EDGE", "Axis_2")) +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_5 = model.addAxis( + Part_1_doc, + model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]"), + model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]"), +) +Point_2 = model.addPoint( + Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("EDGE", "Axis_2") +) model.do() model.end() diff --git a/src/ConstructionPlugin/doc/examples/point5.py b/src/ConstructionPlugin/doc/examples/point5.py index 29d9b679d..4776923b5 100644 --- a/src/ConstructionPlugin/doc/examples/point5.py +++ b/src/ConstructionPlugin/doc/examples/point5.py @@ -4,7 +4,13 @@ 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) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) Point_2 = model.addPoint(Part_1_doc, model.selection("FACE", "Cylinder_1_1/Face_1")) model.do() model.end() diff --git a/src/ExchangeAPI/Test/TestExchange.py b/src/ExchangeAPI/Test/TestExchange.py index b9a97af0f..0ad78a01f 100644 --- a/src/ExchangeAPI/Test/TestExchange.py +++ b/src/ExchangeAPI/Test/TestExchange.py @@ -23,8 +23,8 @@ import ModelAPI import ExchangeAPI from salome.shaper import model -class ExchangeTestCase(unittest.TestCase): +class ExchangeTestCase(unittest.TestCase): def setUp(self): self.session = ModelAPI.ModelAPI_Session.get() self.doc = self.session.moduleDocument() @@ -42,9 +42,12 @@ class ExchangeTestCase(unittest.TestCase): def test_addExport(self): self.session.startOperation() - self.feature = ExchangeAPI.exportToFile(self.doc, "file_path", [], "file_format") + self.feature = ExchangeAPI.exportToFile( + self.doc, "file_path", [], "file_format" + ) self.session.finishOperation() + if __name__ == "__main__": test_program = unittest.main(exit=False) assert test_program.result.wasSuccessful(), "Test failed" diff --git a/src/ExchangePlugin/Test/Test18710.py b/src/ExchangePlugin/Test/Test18710.py index fe5dcb743..2592f8e3e 100644 --- a/src/ExchangePlugin/Test/Test18710.py +++ b/src/ExchangePlugin/Test/Test18710.py @@ -27,8 +27,19 @@ 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) -Export_1 = model.exportToXAO(Part_1_doc, '/tmp/shaper_vcnhioqf.xao', model.selection("SOLID", "Cylinder_1_1"), 'XAO') +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Export_1 = model.exportToXAO( + Part_1_doc, + "/tmp/shaper_vcnhioqf.xao", + model.selection("SOLID", "Cylinder_1_1"), + "XAO", +) Export_1.setName("XAO") Box_1 = model.addBox(Part_1_doc, 10, 10, 10) model.end() @@ -53,4 +64,4 @@ model.testNbSubShapes(Part_1, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(Part_1, GeomAPI_Shape.VERTEX, [48]) model.testResultsVolumes(Part_1, [1000]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ExchangePlugin/Test/Test2290.py b/src/ExchangePlugin/Test/Test2290.py index 0f02224ec..853c44382 100644 --- a/src/ExchangePlugin/Test/Test2290.py +++ b/src/ExchangePlugin/Test/Test2290.py @@ -25,13 +25,25 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 5, 10, 10) Box_2 = model.addBox(Part_1_doc, 10, 50, 8) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_2_1"), model.selection("SOLID", "Box_1_1")]) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Left&Box_2_1/Left"), model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Front")]) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Box_2_1"), model.selection("SOLID", "Box_1_1")], +) +Group_1 = model.addGroup( + Part_1_doc, + [ + model.selection( + "FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Left&Box_2_1/Left" + ), + model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Front"), + ], +) model.do() from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) +assert aFactory.validate(Group_1.feature()) # test export to XAO anExportFeature = Part_1_doc.addFeature("Export") anExportFeature.string("xao_file_path").setValue("Data/export2290.xao") diff --git a/src/ExchangePlugin/Test/Test2459.py b/src/ExchangePlugin/Test/Test2459.py index 0ee2320aa..d7fb13bb5 100644 --- a/src/ExchangePlugin/Test/Test2459.py +++ b/src/ExchangePlugin/Test/Test2459.py @@ -26,58 +26,166 @@ 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchLine_1 = Sketch_1.addLine(-7.500000000000001, -17.0293863659264, -7.500000000000001, -27) +SketchLine_1 = Sketch_1.addLine( + -7.500000000000001, -17.0293863659264, -7.500000000000001, -27 +) SketchLine_1.setName("SketchLine_2") SketchLine_1.result().setName("SketchLine_2") SketchLine_2 = Sketch_1.addLine(-4.500000000000001, -30, 4.500000000000001, -30) SketchLine_2.setName("SketchLine_3") SketchLine_2.result().setName("SketchLine_3") -SketchLine_3 = Sketch_1.addLine(7.500000000000001, -27, 7.500000000000001, -17.0293863659264) +SketchLine_3 = Sketch_1.addLine( + 7.500000000000001, -27, 7.500000000000001, -17.0293863659264 +) SketchLine_3.setName("SketchLine_4") SketchLine_3.result().setName("SketchLine_4") SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) -SketchArc_1 = Sketch_1.addArc(-4.500000000000001, -27, -7.500000000000001, -27, -4.500000000000001, -30, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.startPoint()) -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(4.500000000000001, -27, 4.500000000000001, -30, 7.500000000000001, -27, False) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_2.endPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_3.result()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_2.result()) +SketchArc_1 = Sketch_1.addArc( + -4.500000000000001, -27, -7.500000000000001, -27, -4.500000000000001, -30, False +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_1.endPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_2.startPoint() +) +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( + 4.500000000000001, -27, 4.500000000000001, -30, 7.500000000000001, -27, False +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_2.endPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_3.result() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_2.result() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 3) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_1.results()[1], SketchArc_2.results()[1]) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchArc_1.results()[1], SketchArc_2.results()[1] +) SketchPoint_2 = Sketch_1.addPoint(-2.952241104523109e-048, -30) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_2.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchPoint_2.coordinates(), SketchLine_2.result()) -SketchArc_3 = Sketch_1.addArc(0, 0, 8.525641025641026, -15.2827826360878, 17.49809851618825, 0.2579696062919406, False) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_3.center()) -SketchArc_4 = Sketch_1.addArc(-9.500000000000002, -17.0293863659264, -7.500000000000001, -17.0293863659264, -8.525641025641027, -15.2827826360878, False) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchLine_1.startPoint()) -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_1.result()) -SketchArc_5 = Sketch_1.addArc(9.5, -17.0293863659264, 8.525641025641026, -15.2827826360878, 7.500000000000001, -17.0293863659264, False) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_5.startPoint(), SketchArc_3.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_3.endPoint()) -SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchLine_3.result()) -SketchConstraintTangent_7 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchArc_3.results()[1]) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_2.result() +) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchPoint_2.coordinates(), SketchLine_2.result() +) +SketchArc_3 = Sketch_1.addArc( + 0, + 0, + 8.525641025641026, + -15.2827826360878, + 17.49809851618825, + 0.2579696062919406, + False, +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchArc_3.center() +) +SketchArc_4 = Sketch_1.addArc( + -9.500000000000002, + -17.0293863659264, + -7.500000000000001, + -17.0293863659264, + -8.525641025641027, + -15.2827826360878, + False, +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchArc_4.startPoint(), SketchLine_1.startPoint() +) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchLine_1.result() +) +SketchArc_5 = Sketch_1.addArc( + 9.5, + -17.0293863659264, + 8.525641025641026, + -15.2827826360878, + 7.500000000000001, + -17.0293863659264, + False, +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_5.startPoint(), SketchArc_3.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchLine_3.endPoint() +) +SketchConstraintTangent_6 = Sketch_1.setTangent( + SketchArc_5.results()[1], SketchLine_3.result() +) +SketchConstraintTangent_7 = Sketch_1.setTangent( + SketchArc_5.results()[1], SketchArc_3.results()[1] +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_4.results()[1], 2) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchArc_4.results()[1], SketchArc_5.results()[1]) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.startPoint(), SketchLine_3.result(), 15, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), 30, True) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchArc_4.results()[1], SketchArc_5.results()[1] +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.startPoint(), SketchLine_3.result(), 15, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), 30, True +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_4 = SketchProjection_2.createdFeature() SketchLine_4.setName("SketchLine_5") SketchLine_4.result().setName("SketchLine_5") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_4.result(), SketchPoint_2.coordinates()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_4.result(), SketchPoint_2.coordinates() +) SketchCircle_1 = Sketch_1.addCircle(0, -24, 4) -SketchMultiRotation_1_objects = [SketchArc_4.results()[1], SketchLine_1.result(), SketchArc_1.results()[1], SketchLine_2.result(), SketchArc_2.results()[1], SketchLine_3.result(), SketchArc_5.results()[1], SketchCircle_1.results()[1]] -SketchMultiRotation_1 = Sketch_1.addRotation(SketchMultiRotation_1_objects, SketchAPI_Line(SketchLine_4).startPoint(), "360/3", 3) -[SketchArc_6, SketchArc_7, SketchLine_5, SketchLine_6, SketchArc_8, SketchArc_9, SketchLine_7, SketchLine_8, SketchArc_10, SketchArc_11, SketchLine_9, SketchLine_10, SketchArc_12, SketchArc_13, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1_objects = [ + SketchArc_4.results()[1], + SketchLine_1.result(), + SketchArc_1.results()[1], + SketchLine_2.result(), + SketchArc_2.results()[1], + SketchLine_3.result(), + SketchArc_5.results()[1], + SketchCircle_1.results()[1], +] +SketchMultiRotation_1 = Sketch_1.addRotation( + SketchMultiRotation_1_objects, SketchAPI_Line(SketchLine_4).startPoint(), "360/3", 3 +) +[ + SketchArc_6, + SketchArc_7, + SketchLine_5, + SketchLine_6, + SketchArc_8, + SketchArc_9, + SketchLine_7, + SketchLine_8, + SketchArc_10, + SketchArc_11, + SketchLine_9, + SketchLine_10, + SketchArc_12, + SketchArc_13, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() SketchLine_10.setName("SketchLine_11") SketchLine_10.result().setName("SketchLine_11") SketchLine_9.setName("SketchLine_10") @@ -90,26 +198,75 @@ SketchLine_6.setName("SketchLine_7") SketchLine_6.result().setName("SketchLine_7") SketchLine_5.setName("SketchLine_6") SketchLine_5.result().setName("SketchLine_6") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_4.result()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_4.result() +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchCircle_1.results()[1], 4) -SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_3 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_11 = SketchProjection_3.createdFeature() SketchLine_11.setName("SketchLine_12") SketchLine_11.result().setName("SketchLine_12") -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_11.result(), 24, True) -SketchArc_14 = Sketch_1.addArc(0, 0, -17.49809851618825, 0.2579696062919513, -8.525641025641027, -15.2827826360878, False) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchArc_14.endPoint()) -SketchConstraintTangent_8 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchArc_14.results()[1]) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchArc_3.results()[1], SketchArc_14.results()[1]) -SketchArc_15 = Sketch_1.addArc(0, 0, 8.97245749054723, 15.02481302979584, -8.972457490547235, 15.02481302979584, False) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchArc_3.results()[1], SketchArc_15.results()[1]) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchAPI_Arc(SketchArc_13).startPoint(), SketchArc_14.startPoint()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_15.endPoint(), SketchAPI_Arc(SketchArc_7).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()) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_11.result(), 24, True +) +SketchArc_14 = Sketch_1.addArc( + 0, + 0, + -17.49809851618825, + 0.2579696062919513, + -8.525641025641027, + -15.2827826360878, + False, +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchArc_14.endPoint() +) +SketchConstraintTangent_8 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchArc_14.results()[1] +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchArc_3.results()[1], SketchArc_14.results()[1] +) +SketchArc_15 = Sketch_1.addArc( + 0, + 0, + 8.97245749054723, + 15.02481302979584, + -8.972457490547235, + 15.02481302979584, + False, +) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchArc_3.results()[1], SketchArc_15.results()[1] +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchAPI_Arc(SketchArc_13).startPoint(), SketchArc_14.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_15.endPoint(), SketchAPI_Arc(SketchArc_7).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-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) +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() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ExchangePlugin/Test/TestExport.py b/src/ExchangePlugin/Test/TestExport.py index b3fdf14c4..d8cf60254 100755 --- a/src/ExchangePlugin/Test/TestExport.py +++ b/src/ExchangePlugin/Test/TestExport.py @@ -21,9 +21,9 @@ TestExport.py Unit test of ExchangePlugin_TestExport class """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= import os import math from tempfile import TemporaryDirectory @@ -37,19 +37,27 @@ from salome.shaper import model __updated__ = "2015-05-22" aSession = ModelAPI_Session.get() -#========================================================================= + + +# ========================================================================= # Help functions -#========================================================================= +# ========================================================================= def removeFile(theFileName): - try: os.remove(theFileName) - except OSError: pass - assert not os.path.exists(theFileName), \ - "Can not remove file {0}".format(theFileName) + try: + os.remove(theFileName) + except OSError: + pass + assert not os.path.exists(theFileName), "Can not remove file {0}".format( + theFileName + ) + -#========================================================================= +# ========================================================================= # Common test function -#========================================================================= -def testExport(theType, theFormat, theFile, theVolume, theArea, theDelta, theErrorExpected = False): +# ========================================================================= +def testExport( + theType, theFormat, theFile, theVolume, theArea, theDelta, theErrorExpected=False +): # Import a reference part aSession.startOperation("Add part") aPartFeature = aSession.moduleDocument().addFeature("Part") @@ -69,12 +77,14 @@ def testExport(theType, theFormat, theFile, theVolume, theArea, theDelta, theErr aSession.startOperation("Export part") anExportFeature = aPart.addFeature("Export") anExportFeature.string("file_format").setValue(theFormat) - print("theFile=",theFile) + print("theFile=", theFile) anExportFeature.string("file_path").setValue(theFile) anExportFeature.string("ExportType").setValue("Regular") aSelectionListAttr = anExportFeature.selectionList("selection_list") aSelectionListAttr.setSelectionType("solids") - aSelectionListAttr.append(anImportFeature.firstResult(), anImportFeature.firstResult().shape()) + aSelectionListAttr.append( + anImportFeature.firstResult(), anImportFeature.firstResult().shape() + ) aSession.finishOperation() if theErrorExpected: @@ -86,7 +96,8 @@ def testExport(theType, theFormat, theFile, theVolume, theArea, theDelta, theErr # Test exported file by importing testImport(theType, theFile, theVolume, theArea, theDelta) -def testExportXAO(theFile, theEmptyFormat = False): + +def testExportXAO(theFile, theEmptyFormat=False): type = "XAO" format = "XAO" if theEmptyFormat: @@ -131,21 +142,25 @@ def testExportXAO(theFile, theEmptyFormat = False): aSelectionListAttr.append("box1_1/Shape_1") aSelectionListAttr.append("box1_1/Shape_2") aComponentNames = aField.stringArray("components_names") - aComponentNames.setSize(2) # two components + aComponentNames.setSize(2) # two components aComponentNames.setValue(0, "temperatue") aComponentNames.setValue(1, "porosity") aStamps = aField.intArray("stamps") - aStamps.setSize(1) # one step + aStamps.setSize(1) # one step aStamps.setValue(0, 10) aTables = aField.tables("values") - aTables.setType(2) # double - aTables.setSize(1 + 2, 2, 1) # default row + number of selected, number of compoents, number of steps (tables) - aTables.setValue(1., 0, 0, 0) # value, index of selection, index of component, index of step - aTables.setValue(2., 1, 0, 0) - aTables.setValue(3., 2, 0, 0) - aTables.setValue(4., 0, 1, 0) - aTables.setValue(5., 1, 1, 0) - aTables.setValue(6., 2, 1, 0) + aTables.setType(2) # double + aTables.setSize( + 1 + 2, 2, 1 + ) # default row + number of selected, number of compoents, number of steps (tables) + aTables.setValue( + 1.0, 0, 0, 0 + ) # value, index of selection, index of component, index of step + aTables.setValue(2.0, 1, 0, 0) + aTables.setValue(3.0, 2, 0, 0) + aTables.setValue(4.0, 0, 1, 0) + aTables.setValue(5.0, 1, 1, 0) + aTables.setValue(6.0, 2, 1, 0) aSession.finishOperation() # Export @@ -162,7 +177,7 @@ def testExportXAO(theFile, theEmptyFormat = False): aRefPath = os.path.join(os.getenv("DATA_DIR"), "Shapes", "Xao", "box2.xao") # endlines may be different on different platforms, thus compare files line-by-line areFilesEqual = True - with open(theFile, 'r') as file, open(aRefPath, 'r') as ref: + with open(theFile, "r") as file, open(aRefPath, "r") as ref: l1 = l2 = True while l1 and l2 and areFilesEqual: l1 = file.readline() @@ -170,40 +185,126 @@ def testExportXAO(theFile, theEmptyFormat = False): areFilesEqual = l1 == l2 assert areFilesEqual -if __name__ == '__main__': + +if __name__ == "__main__": with TemporaryDirectory() as tmp_dir: - #========================================================================= + # ========================================================================= # Export a shape into BREP - #========================================================================= + # ========================================================================= aRealVolume = 3.78827401738e-06 - testExport("BREP", "BREP", os.path.join(tmp_dir, "screw_export.brep"), aRealVolume, 0.0019293313778547098, 10 ** -17) - testExport("BRP", "BREP", os.path.join(tmp_dir, "screw_export.brp"), aRealVolume, 0.0019293313778547098, 10 ** -17) - testExport("BREP", "", os.path.join(tmp_dir, "screw_export.brep"), aRealVolume, 0.0019293313778547098, 10 ** -17) - #========================================================================= + testExport( + "BREP", + "BREP", + os.path.join(tmp_dir, "screw_export.brep"), + aRealVolume, + 0.0019293313778547098, + 10**-17, + ) + testExport( + "BRP", + "BREP", + os.path.join(tmp_dir, "screw_export.brp"), + aRealVolume, + 0.0019293313778547098, + 10**-17, + ) + testExport( + "BREP", + "", + os.path.join(tmp_dir, "screw_export.brep"), + aRealVolume, + 0.0019293313778547098, + 10**-17, + ) + # ========================================================================= # Export a shape into STEP - #========================================================================= - testExport("STEP", "STEP", os.path.join(tmp_dir, "screw_export.step"), 3.788258075329978e-06, 0.0019293304476337928, 10 ** -17) - testExport("STEP", "STEP", os.path.join(tmp_dir, "screw_export.stp"), 3.788258075329978e-06, 0.0019293304476337928, 10 ** -17) - testExport("STEP", "", os.path.join(tmp_dir, "screw_export.step"), 3.788258075329978e-06, 0.0019293304476337928, 10 ** -17) - #========================================================================= + # ========================================================================= + testExport( + "STEP", + "STEP", + os.path.join(tmp_dir, "screw_export.step"), + 3.788258075329978e-06, + 0.0019293304476337928, + 10**-17, + ) + testExport( + "STEP", + "STEP", + os.path.join(tmp_dir, "screw_export.stp"), + 3.788258075329978e-06, + 0.0019293304476337928, + 10**-17, + ) + testExport( + "STEP", + "", + os.path.join(tmp_dir, "screw_export.step"), + 3.788258075329978e-06, + 0.0019293304476337928, + 10**-17, + ) + # ========================================================================= # Export a shape into IGES - #========================================================================= - testExport("IGES", "IGES-5.1", os.path.join(tmp_dir, "screw_export-5.1.iges"), 0.0, 0.0019293313766693052, 10 ** -17) - testExport("IGS", "IGES-5.1", os.path.join(tmp_dir, "screw_export-5.1.igs"), 0.0, 0.0019293313766693052, 10 ** -17) - testExport("IGES", "", os.path.join(tmp_dir, "screw_export-5.1.iges"), 0.0, 0.0019293313766693052, 10 ** -17) - testExport("IGES", "IGES-5.3", os.path.join(tmp_dir, "screw_export-5.3.iges"), 3.78827401651e-06, 0.001929331377591282, 10 ** -17) - testExport("IGS", "IGES-5.3", os.path.join(tmp_dir, "screw_export-5.3.igs"), 3.78827401651e-06, 0.001929331377591282, 10 ** -17) - #========================================================================= + # ========================================================================= + testExport( + "IGES", + "IGES-5.1", + os.path.join(tmp_dir, "screw_export-5.1.iges"), + 0.0, + 0.0019293313766693052, + 10**-17, + ) + testExport( + "IGS", + "IGES-5.1", + os.path.join(tmp_dir, "screw_export-5.1.igs"), + 0.0, + 0.0019293313766693052, + 10**-17, + ) + testExport( + "IGES", + "", + os.path.join(tmp_dir, "screw_export-5.1.iges"), + 0.0, + 0.0019293313766693052, + 10**-17, + ) + testExport( + "IGES", + "IGES-5.3", + os.path.join(tmp_dir, "screw_export-5.3.iges"), + 3.78827401651e-06, + 0.001929331377591282, + 10**-17, + ) + testExport( + "IGS", + "IGES-5.3", + os.path.join(tmp_dir, "screw_export-5.3.igs"), + 3.78827401651e-06, + 0.001929331377591282, + 10**-17, + ) + # ========================================================================= # Export a shape into XAO - #========================================================================= + # ========================================================================= testExportXAO(os.path.join(tmp_dir, "export.xao")) testExportXAO(os.path.join(tmp_dir, "export.xao"), True) - #========================================================================= + # ========================================================================= # Check error when export to unsupported format - #========================================================================= - testExport("BREP", "", os.path.join(tmp_dir, "screw_export.dwg"), 3.78825807533e-06, 0.0019293313766693052, 10 ** -17, True) - #========================================================================= + # ========================================================================= + testExport( + "BREP", + "", + os.path.join(tmp_dir, "screw_export.dwg"), + 3.78825807533e-06, + 0.0019293313766693052, + 10**-17, + True, + ) + # ========================================================================= # End of test - #========================================================================= + # ========================================================================= - assert(model.checkPythonDump()) + assert model.checkPythonDump() diff --git a/src/ExchangePlugin/Test/TestExportPart_Failure_1.py b/src/ExchangePlugin/Test/TestExportPart_Failure_1.py index ebf03396b..4743d1120 100644 --- a/src/ExchangePlugin/Test/TestExportPart_Failure_1.py +++ b/src/ExchangePlugin/Test/TestExportPart_Failure_1.py @@ -24,46 +24,97 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) model.do() model.end() import os -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) model.begin() diff --git a/src/ExchangePlugin/Test/TestExportPart_Failure_2.py b/src/ExchangePlugin/Test/TestExportPart_Failure_2.py index a8b81bf2d..42820e159 100644 --- a/src/ExchangePlugin/Test/TestExportPart_Failure_2.py +++ b/src/ExchangePlugin/Test/TestExportPart_Failure_2.py @@ -24,46 +24,97 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) model.do() model.end() import os -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) featureToExport = Box_1 @@ -71,4 +122,8 @@ featureToExport = Box_1 model.begin() model.exportPart(Part_1_doc, filename, [featureToExport.result()]) model.end() -assert not os.path.exists(filename), "ERROR: Exporting of {} from document {} should fail".format(featureToExport.name(), Part_1.name()) +assert not os.path.exists( + filename +), "ERROR: Exporting of {} from document {} should fail".format( + featureToExport.name(), Part_1.name() +) diff --git a/src/ExchangePlugin/Test/TestExportPart_Failure_3.py b/src/ExchangePlugin/Test/TestExportPart_Failure_3.py index 8ec80e664..ca14d69aa 100644 --- a/src/ExchangePlugin/Test/TestExportPart_Failure_3.py +++ b/src/ExchangePlugin/Test/TestExportPart_Failure_3.py @@ -25,13 +25,22 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) model.do() -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Part_1/[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]")) -Translation_1 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("EDGE", "Axis_4"), 10) +Axis_4 = model.addAxis( + partSet, + model.selection("VERTEX", "Origin"), + model.selection("VERTEX", "Part_1/[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"), +) +Translation_1 = model.addTranslation( + partSet, + [model.selection("COMPOUND", "Part_1/")], + model.selection("EDGE", "Axis_4"), + 10, +) model.end() import os -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) model.begin() diff --git a/src/ExchangePlugin/Test/TestExportPart_FullPartSet.py b/src/ExchangePlugin/Test/TestExportPart_FullPartSet.py index 90196c953..1fbb1a1a2 100644 --- a/src/ExchangePlugin/Test/TestExportPart_FullPartSet.py +++ b/src/ExchangePlugin/Test/TestExportPart_FullPartSet.py @@ -24,46 +24,97 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) model.do() model.end() import os -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) model.begin() diff --git a/src/ExchangePlugin/Test/TestExportPart_FullPart_1.py b/src/ExchangePlugin/Test/TestExportPart_FullPart_1.py index ba5f25c69..d708069a5 100644 --- a/src/ExchangePlugin/Test/TestExportPart_FullPart_1.py +++ b/src/ExchangePlugin/Test/TestExportPart_FullPart_1.py @@ -24,46 +24,97 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) model.do() model.end() import os -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) model.begin() diff --git a/src/ExchangePlugin/Test/TestExportPart_FullPart_2.py b/src/ExchangePlugin/Test/TestExportPart_FullPart_2.py index 728123880..601f9f00f 100644 --- a/src/ExchangePlugin/Test/TestExportPart_FullPart_2.py +++ b/src/ExchangePlugin/Test/TestExportPart_FullPart_2.py @@ -24,51 +24,104 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) model.do() model.end() import os -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) model.begin() model.exportPart(Part_2_doc, filename) model.end() -assert os.path.exists(filename), "ERROR: Cannot export Part_2 to file {}".format(filename) +assert os.path.exists(filename), "ERROR: Cannot export Part_2 to file {}".format( + filename +) model.removeTmpFile(filename) diff --git a/src/ExchangePlugin/Test/TestExportPart_PartSet.py b/src/ExchangePlugin/Test/TestExportPart_PartSet.py index 80bd61f10..5dcad15ef 100644 --- a/src/ExchangePlugin/Test/TestExportPart_PartSet.py +++ b/src/ExchangePlugin/Test/TestExportPart_PartSet.py @@ -24,46 +24,97 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) model.do() model.end() import os -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) model.begin() diff --git a/src/ExchangePlugin/Test/TestExportPart_Results_1.py b/src/ExchangePlugin/Test/TestExportPart_Results_1.py index 5177e52e2..4a6470588 100644 --- a/src/ExchangePlugin/Test/TestExportPart_Results_1.py +++ b/src/ExchangePlugin/Test/TestExportPart_Results_1.py @@ -24,46 +24,97 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) model.do() model.end() import os -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) featureToExport = Point_2 @@ -71,6 +122,8 @@ featureToExport = Point_2 model.begin() model.exportPart(partSet, filename, [featureToExport.result()]) model.end() -assert os.path.exists(filename), "ERROR: Cannot export feature {}".format(featureToExport.name()) +assert os.path.exists(filename), "ERROR: Cannot export feature {}".format( + featureToExport.name() +) model.removeTmpFile(filename) diff --git a/src/ExchangePlugin/Test/TestExportPart_Results_2.py b/src/ExchangePlugin/Test/TestExportPart_Results_2.py index f6a29b9c1..4b9643d5f 100644 --- a/src/ExchangePlugin/Test/TestExportPart_Results_2.py +++ b/src/ExchangePlugin/Test/TestExportPart_Results_2.py @@ -24,46 +24,97 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) model.do() model.end() import os -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) featureToExport = Axis_4 @@ -71,6 +122,8 @@ featureToExport = Axis_4 model.begin() model.exportPart(partSet, filename, [featureToExport.result()]) model.end() -assert os.path.exists(filename), "ERROR: Cannot export feature {}".format(featureToExport.name()) +assert os.path.exists(filename), "ERROR: Cannot export feature {}".format( + featureToExport.name() +) model.removeTmpFile(filename) diff --git a/src/ExchangePlugin/Test/TestExportPart_Results_3.py b/src/ExchangePlugin/Test/TestExportPart_Results_3.py index f06b4968a..fc770dcae 100644 --- a/src/ExchangePlugin/Test/TestExportPart_Results_3.py +++ b/src/ExchangePlugin/Test/TestExportPart_Results_3.py @@ -24,46 +24,97 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) model.do() model.end() import os -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) featureToExport = Sketch_1 @@ -71,6 +122,8 @@ featureToExport = Sketch_1 model.begin() model.exportPart(Part_1_doc, filename, [featureToExport.result()]) model.end() -assert os.path.exists(filename), "ERROR: Cannot export feature {}".format(featureToExport.name()) +assert os.path.exists(filename), "ERROR: Cannot export feature {}".format( + featureToExport.name() +) model.removeTmpFile(filename) diff --git a/src/ExchangePlugin/Test/TestExportPart_Results_4.py b/src/ExchangePlugin/Test/TestExportPart_Results_4.py index a8e22f66f..19b89fb36 100644 --- a/src/ExchangePlugin/Test/TestExportPart_Results_4.py +++ b/src/ExchangePlugin/Test/TestExportPart_Results_4.py @@ -24,46 +24,97 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) model.do() model.end() import os -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) featureToExport = Extrusion_1 @@ -71,4 +122,6 @@ featureToExport = Extrusion_1 model.begin() model.exportPart(Part_1_doc, filename, [featureToExport.result()]) model.end() -assert not os.path.exists(filename), "ERROR: Exporting of {} should fail".format(featureToExport.name()) +assert not os.path.exists(filename), "ERROR: Exporting of {} should fail".format( + featureToExport.name() +) diff --git a/src/ExchangePlugin/Test/TestExportPart_Results_5.py b/src/ExchangePlugin/Test/TestExportPart_Results_5.py index eea2a0ebd..dd1fdd79d 100644 --- a/src/ExchangePlugin/Test/TestExportPart_Results_5.py +++ b/src/ExchangePlugin/Test/TestExportPart_Results_5.py @@ -24,46 +24,97 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) model.do() model.end() import os -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) featureToExport = Sketch_2 @@ -71,4 +122,6 @@ featureToExport = Sketch_2 model.begin() model.exportPart(Part_1_doc, filename, [featureToExport.result()]) model.end() -assert not os.path.exists(filename), "ERROR: Exporting of {} should fail".format(featureToExport.name()) +assert not os.path.exists(filename), "ERROR: Exporting of {} should fail".format( + featureToExport.name() +) diff --git a/src/ExchangePlugin/Test/TestExportPart_Results_6.py b/src/ExchangePlugin/Test/TestExportPart_Results_6.py index 60fd4da87..1df1337db 100644 --- a/src/ExchangePlugin/Test/TestExportPart_Results_6.py +++ b/src/ExchangePlugin/Test/TestExportPart_Results_6.py @@ -24,46 +24,97 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) model.do() model.end() import os -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) featureToExport = Revolution_1 @@ -71,4 +122,6 @@ featureToExport = Revolution_1 model.begin() model.exportPart(Part_1_doc, filename, [featureToExport.result()]) model.end() -assert not os.path.exists(filename), "ERROR: Exporting of {} should fail".format(featureToExport.name()) +assert not os.path.exists(filename), "ERROR: Exporting of {} should fail".format( + featureToExport.name() +) diff --git a/src/ExchangePlugin/Test/TestExportPart_Results_7.py b/src/ExchangePlugin/Test/TestExportPart_Results_7.py index 1333ca3df..e3bc60a45 100644 --- a/src/ExchangePlugin/Test/TestExportPart_Results_7.py +++ b/src/ExchangePlugin/Test/TestExportPart_Results_7.py @@ -24,46 +24,97 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) model.do() model.end() import os -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) featureToExport = Box_1 @@ -71,6 +122,8 @@ featureToExport = Box_1 model.begin() model.exportPart(Part_2_doc, filename, [featureToExport.result()]) model.end() -assert os.path.exists(filename), "ERROR: Cannot export feature {}".format(featureToExport.name()) +assert os.path.exists(filename), "ERROR: Cannot export feature {}".format( + featureToExport.name() +) model.removeTmpFile(filename) diff --git a/src/ExchangePlugin/Test/TestExportPart_Results_8.py b/src/ExchangePlugin/Test/TestExportPart_Results_8.py index fc73219f0..a0f8b4c45 100644 --- a/src/ExchangePlugin/Test/TestExportPart_Results_8.py +++ b/src/ExchangePlugin/Test/TestExportPart_Results_8.py @@ -24,46 +24,97 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) model.do() model.end() import os -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) featureToExport = Translation_1 @@ -71,5 +122,7 @@ featureToExport = Translation_1 model.begin() model.exportPart(Part_2_doc, filename, [featureToExport.result()]) model.end() -assert os.path.exists(filename), "ERROR: Cannot export feature {}".format(featureToExport.name()) +assert os.path.exists(filename), "ERROR: Cannot export feature {}".format( + featureToExport.name() +) model.removeTmpFile(filename) diff --git a/src/ExchangePlugin/Test/TestExportToXAOWithFields.py b/src/ExchangePlugin/Test/TestExportToXAOWithFields.py index a59fec014..ab39c77d5 100644 --- a/src/ExchangePlugin/Test/TestExportToXAOWithFields.py +++ b/src/ExchangePlugin/Test/TestExportToXAOWithFields.py @@ -22,11 +22,15 @@ from salome.shaper import model import tempfile import os + def getTmpFileName(ext): - tempdir = tempfile.gettempdir() - tmp_file = tempfile.NamedTemporaryFile(suffix=".%s"%ext, prefix='shaper_', dir=tempdir, delete=False) - tmp_filename = tmp_file.name - return tmp_filename + tempdir = tempfile.gettempdir() + tmp_file = tempfile.NamedTemporaryFile( + suffix=".%s" % ext, prefix="shaper_", dir=tempdir, delete=False + ) + tmp_filename = tmp_file.name + return tmp_filename + tmp_file1 = getTmpFileName("xao") @@ -35,18 +39,27 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Field_1 = model.addField(Part_1_doc, 1, "BOOLEAN", 1, ["Comp 1"], [model.selection("FACE", "Box_1_1/Front")]) +Field_1 = model.addField( + Part_1_doc, 1, "BOOLEAN", 1, ["Comp 1"], [model.selection("FACE", "Box_1_1/Front")] +) Field_1.addStep(0, 0, [[False], [False]]) -Field_2_objects = [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/Left][Box_1_1/Bottom]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]")] +Field_2_objects = [ + 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/Left][Box_1_1/Bottom]"), + model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]"), + model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"), +] Field_2 = model.addField(Part_1_doc, 1, "DOUBLE", 1, ["Comp 1"], Field_2_objects) Field_2.addStep(0, 0, [[0], [1], [0], [0], [0]]) -Field_3 = model.addField(Part_1_doc, 1, "STRING", 1, ["Comp 1"], [model.selection("SOLID", "Box_1_1")]) +Field_3 = model.addField( + Part_1_doc, 1, "STRING", 1, ["Comp 1"], [model.selection("SOLID", "Box_1_1")] +) Field_3.addStep(0, 0, [[""], ["box"]]) Export_1 = model.exportToXAO(Part_1_doc, tmp_file1) # due to the issue 2530, the export feature is removed after execution, so, if export was performed correctly, # the feature must become invalid -#assert(Export_1.feature().error() == "") -assert(not Export_1.feature().data().isValid()) -assert(os.path.isfile(tmp_file1)) +# assert(Export_1.feature().error() == "") +assert not Export_1.feature().data().isValid() +assert os.path.isfile(tmp_file1) model.end() diff --git a/src/ExchangePlugin/Test/TestExportToXAOWithGroupNotUpdated.py b/src/ExchangePlugin/Test/TestExportToXAOWithGroupNotUpdated.py index f8c73f4ba..24a4a18b1 100644 --- a/src/ExchangePlugin/Test/TestExportToXAOWithGroupNotUpdated.py +++ b/src/ExchangePlugin/Test/TestExportToXAOWithGroupNotUpdated.py @@ -25,11 +25,15 @@ from GeomAPI import GeomAPI_Shape import tempfile import os + def getTmpFileName(ext): - tempdir = tempfile.gettempdir() - tmp_file = tempfile.NamedTemporaryFile(suffix=".%s"%ext, prefix='shaper_', dir=tempdir, delete=False) - tmp_filename = tmp_file.name - return tmp_filename + tempdir = tempfile.gettempdir() + tmp_file = tempfile.NamedTemporaryFile( + suffix=".%s" % ext, prefix="shaper_", dir=tempdir, delete=False + ) + tmp_filename = tmp_file.name + return tmp_filename + tmp_file1 = getTmpFileName("xao") tmp_file2 = getTmpFileName("xao") @@ -42,34 +46,76 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 0, 50) SketchLine_2 = Sketch_1.addLine(0, 50, 50, 50) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(50, 50, 50, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(50, 0, 0, 0) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) SketchConstraintRigid_1 = Sketch_1.setFixed(SketchLine_1.startPoint()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), 50) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 50) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_1.result(), SketchLine_3.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_4.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result()) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_1.result(), SketchLine_3.result() +) +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_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], 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&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_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&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_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 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 25, False) # Split the Box in two parts -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("FACE", "Plane_1")]) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1"), model.selection("FACE", "Plane_1")], +) # Export the shape with the group and field not updated with the new result Export_1 = model.exportToXAO(Part_1_doc, tmp_file1) # Update the group and the field with the last result @@ -88,7 +134,7 @@ model.do() # Check results Import_1_Feature = Import_1.feature() -assert Import_1_Feature.error() == '' +assert Import_1_Feature.error() == "" assert Import_1_Feature.name() == "Partition_1_1" assert len(Import_1_Feature.results()) == 1 model.testNbSubShapes(Import_1, GeomAPI_Shape.SOLID, [2]) @@ -106,7 +152,7 @@ model.do() # Check results Import_2_Feature = Import_2.feature() -assert Import_2_Feature.error() == '' +assert Import_2_Feature.error() == "" assert Import_2_Feature.name() == "Partition_1_1" assert len(Import_2_Feature.results()) == 1 model.testNbSubShapes(Import_2, GeomAPI_Shape.SOLID, [2]) @@ -130,7 +176,7 @@ assert aFeature2.intArray("stamps").size() == 1 assert aFeature2.tables("values").rows() == 7 assert aFeature2.tables("values").columns() == 1 assert aFeature2.tables("values").tables() == 1 -assert aFeature2.tables("values").type() == 2 # double +assert aFeature2.tables("values").type() == 2 # double assert aFeature2.selectionList("selected").size() == 6 model.do() model.end() diff --git a/src/ExchangePlugin/Test/TestExport_FiniteValidator.py b/src/ExchangePlugin/Test/TestExport_FiniteValidator.py index 508897404..35c868253 100644 --- a/src/ExchangePlugin/Test/TestExport_FiniteValidator.py +++ b/src/ExchangePlugin/Test/TestExport_FiniteValidator.py @@ -37,4 +37,4 @@ aSelectionListAttr = anExportFeature.selectionList("selection_list") aSelectionListAttr.setSelectionType("solids") aSelectionListAttr.append("PartSet/OX", "EDGE") aSession.finishOperation() -assert(anExportFeature.error() != "") +assert anExportFeature.error() != "" diff --git a/src/ExchangePlugin/Test/TestImport.py b/src/ExchangePlugin/Test/TestImport.py index 56d89bf88..deeaa1d96 100644 --- a/src/ExchangePlugin/Test/TestImport.py +++ b/src/ExchangePlugin/Test/TestImport.py @@ -21,9 +21,9 @@ TestImport.py Unit test of ExchangePlugin_TestImport class """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomAlgoAPI import * @@ -36,14 +36,16 @@ __updated__ = "2015-05-22" aSession = ModelAPI_Session.get() -#========================================================================= + +# ========================================================================= # Common test function -#========================================================================= +# ========================================================================= def getShapePath(path): shapes_dir = os.path.join(os.getenv("DATA_DIR"), "Shapes") return os.path.join(shapes_dir, path) -def testImport(theType, theFile, theVolume, theArea, theDelta, theErrorExpected = False): + +def testImport(theType, theFile, theVolume, theArea, theDelta, theErrorExpected=False): # Create a part for import aSession.startOperation("Create part for import") aPartFeature = aSession.moduleDocument().addFeature("Part") @@ -53,15 +55,19 @@ def testImport(theType, theFile, theVolume, theArea, theDelta, theErrorExpected aSession.startOperation("Import file") aFeatureKind = "Import" anImportFeature = aPart.addFeature(aFeatureKind) - assert anImportFeature, "{0}: Can not create a feature {1}".format(theType, aFeatureKind) + assert anImportFeature, "{0}: Can not create a feature {1}".format( + theType, aFeatureKind + ) if theType == "STP" or theType == "STEP": - aFieldName = "step_file_path" + aFieldName = "step_file_path" file = anImportFeature.string(aFieldName) assert file, "{0}: Can not receive string field {1}".format(theType, aFieldName) file.setValue(theFile) aFieldName = "step_scale_inter_units" units = anImportFeature.boolean(aFieldName) - assert units, "{0}: Can not receive string field {1}".format(theType, aFieldName) + assert units, "{0}: Can not receive string field {1}".format( + theType, aFieldName + ) units.setValue(True) aFieldName = "file_path" file = anImportFeature.string(aFieldName) @@ -74,11 +80,19 @@ def testImport(theType, theFile, theVolume, theArea, theDelta, theErrorExpected aSession.finishOperation() if theErrorExpected: - assert anImportFeature.error() != '' + assert anImportFeature.error() != "" else: # Check results - assert anImportFeature.error() == '', "{0}: The error after execution: {1}".format(theType, anImportFeature.error()) - assert len(anImportFeature.results()) == 1, "{0}: Wrong number of results: expected = 1, real = {1}".format(theType, len(anImportFeature.results())) + assert ( + anImportFeature.error() == "" + ), "{0}: The error after execution: {1}".format( + theType, anImportFeature.error() + ) + assert ( + len(anImportFeature.results()) == 1 + ), "{0}: Wrong number of results: expected = 1, real = {1}".format( + theType, len(anImportFeature.results()) + ) aResultBody = modelAPI_ResultBody(anImportFeature.firstResult()) assert aResultBody, "{0}: The result is not a body".format(theType) aShape = aResultBody.shape() @@ -87,11 +101,20 @@ def testImport(theType, theFile, theVolume, theArea, theDelta, theErrorExpected # Check shape volume aRefVolume = theVolume aResVolume = GeomAlgoAPI_ShapeTools.volume(aShape) - assert (math.fabs(aResVolume - aRefVolume) < theDelta), "{0}: The volume is wrong: expected = {1}, real = {2}".format(theType, aRefVolume, aResVolume) + assert ( + math.fabs(aResVolume - aRefVolume) < theDelta + ), "{0}: The volume is wrong: expected = {1}, real = {2}".format( + theType, aRefVolume, aResVolume + ) # Check shape area aRefArea = theArea aResArea = GeomAlgoAPI_ShapeTools.area(aShape) - assert (math.fabs(aResArea - aRefArea) < theDelta), "{0}: The area is wrong: expected = {1}, real = {2}".format(theType, aRefArea, aResArea) + assert ( + math.fabs(aResArea - aRefArea) < theDelta + ), "{0}: The area is wrong: expected = {1}, real = {2}".format( + theType, aRefArea, aResArea + ) + def testImportXAO(): # Create a part for import @@ -109,7 +132,7 @@ def testImportXAO(): aSession.finishOperation() # Check results - assert anImportFeature.error() == '' + assert anImportFeature.error() == "" assert anImportFeature.name() == "mygeom" assert len(anImportFeature.results()) == 1 assert modelAPI_ResultBody(anImportFeature.firstResult()) @@ -144,52 +167,58 @@ def testImportXAO(): assert aFeature3.tables("values").rows() == 2 assert aFeature3.tables("values").columns() == 3 assert aFeature3.tables("values").tables() == 2 - assert aFeature3.tables("values").type() == 1 # integer + assert aFeature3.tables("values").type() == 1 # integer assert aFeature3.selectionList("selected").size() == 1 -if __name__ == '__main__': + +if __name__ == "__main__": with TemporaryDirectory() as tmp_dir: - #========================================================================= + # ========================================================================= # Create a shape imported from BREP - #========================================================================= + # ========================================================================= shape_path = getShapePath("Brep/solid.brep") - testImport("BREP", shape_path, 259982.297176, 39481.415022205365, 10 ** -5) + testImport("BREP", shape_path, 259982.297176, 39481.415022205365, 10**-5) shape_path = shutil.copyfile(shape_path, os.path.join(tmp_dir, "solid.brp")) - testImport("BRP", shape_path, 259982.297176, 39481.415022205365, 10 ** -5) + testImport("BRP", shape_path, 259982.297176, 39481.415022205365, 10**-5) shape_path = shutil.copyfile(shape_path, os.path.join(tmp_dir, "pièce.brep")) - testImport("BREP", shape_path, 259982.297176, 39481.415022205365, 10 ** -5) - #========================================================================= + testImport("BREP", shape_path, 259982.297176, 39481.415022205365, 10**-5) + # ========================================================================= # Create a shape imported from STEP - #========================================================================= + # ========================================================================= shape_path = getShapePath("Step/screw.step") - testImport("STEP", shape_path, 3.78827401738e-06, 0.0019293313778547085, 10 ** -17) + testImport( + "STEP", shape_path, 3.78827401738e-06, 0.0019293313778547085, 10**-17 + ) shape_path = shutil.copyfile(shape_path, os.path.join(tmp_dir, "screw.stp")) - testImport("STEP", shape_path, 3.78827401738e-06, 0.0019293313778547085, 10 ** -17) - #========================================================================= + testImport( + "STEP", shape_path, 3.78827401738e-06, 0.0019293313778547085, 10**-17 + ) + # ========================================================================= # Create a shape imported from IGES - #========================================================================= + # ========================================================================= shape_path = getShapePath("Iges/bearing.igs") - testImport("IGS", shape_path, 0.0, 1.3407098545036494e-08, 10 ** -25) + testImport("IGS", shape_path, 0.0, 1.3407098545036494e-08, 10**-25) shape_path = shutil.copyfile(shape_path, os.path.join(tmp_dir, "bearing.iges")) - testImport("IGES", shape_path, 0.0, 1.3407098545036494e-08, 10 ** -25) + testImport("IGES", shape_path, 0.0, 1.3407098545036494e-08, 10**-25) - #========================================================================= + # ========================================================================= # Create a shape imported from XAO - #========================================================================= + # ========================================================================= testImportXAO() - #========================================================================= + # ========================================================================= # End of test - #========================================================================= + # ========================================================================= from salome.shaper import model - assert(model.checkPythonDump()) - #========================================================================= + assert model.checkPythonDump() + + # ========================================================================= # Check import errors - #========================================================================= - testImport("BREP", "", 0, 0, 10 ** -25, True) + # ========================================================================= + testImport("BREP", "", 0, 0, 10**-25, True) shape_path = getShapePath("Brep/solid.dwg") - testImport("BREP", shape_path, 0, 0, 10 ** -25, True) + testImport("BREP", shape_path, 0, 0, 10**-25, True) shape_path = getShapePath("Xao/wrong_file.xao") - testImport("XAO", shape_path, 0, 0, 10 ** -25, True) + testImport("XAO", shape_path, 0, 0, 10**-25, True) diff --git a/src/ExchangePlugin/Test/TestImportImage_1.py b/src/ExchangePlugin/Test/TestImportImage_1.py index 96478a1f4..161d8794a 100755 --- a/src/ExchangePlugin/Test/TestImportImage_1.py +++ b/src/ExchangePlugin/Test/TestImportImage_1.py @@ -23,10 +23,11 @@ from salome.shaper import model from PyQt5.Qt import QApplication import salome + salome.salome_init_without_session() salome.salome_init(1) if QApplication.instance() is None: - app = QApplication([]) + app = QApplication([]) data_dir = os.path.join(os.path.dirname(inspect.getfile(lambda: None)), "data") @@ -44,35 +45,47 @@ ImportImage_1.setName("drawing") ImportImage_1.result().setName("drawing") ### Create Translation -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "drawing")], startPoint = model.selection("VERTEX", "[drawing/Shape_1]e[drawing/Shape_4]e"), endPoint = model.selection("VERTEX", "PartSet/Origin"), keepSubResults = True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("FACE", "drawing")], + startPoint=model.selection("VERTEX", "[drawing/Shape_1]e[drawing/Shape_4]e"), + endPoint=model.selection("VERTEX", "PartSet/Origin"), + keepSubResults=True, +) ### Create Scale -Scale_1 = model.addScale(Part_1_doc, [model.selection("FACE", "drawing")] , model.selection("VERTEX", "PartSet/Origin"), 0.5, keepSubResults = True) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("FACE", "drawing")], + model.selection("VERTEX", "PartSet/Origin"), + 0.5, + keepSubResults=True, +) model.end() -#============================================================================= +# ============================================================================= # Tests : -#============================================================================= +# ============================================================================= model.checkResult(Scale_1, model, 1, [0], [0], [1], [4], [8]) -r=Scale_1.defaultResult() -s=r.shape() -dim=s.computeSize() -dim=dim[1:] -dx=abs(dim[3]-dim[0]) -dy=abs(dim[4]-dim[1]) -dz=abs(dim[5]-dim[2]) -tol=1e-06 -assert(abs(dx-400) <= tol) -assert(abs(dy-258.5) <= tol) -assert(abs(dz-0) <= tol) -assert(ImportImage_1.result().resultSubShapePair()[0].hasTexture()) -assert(Translation_1.result().resultSubShapePair()[0].hasTexture()) -assert(Scale_1.result().resultSubShapePair()[0].hasTexture()) - -#============================================================================= +r = Scale_1.defaultResult() +s = r.shape() +dim = s.computeSize() +dim = dim[1:] +dx = abs(dim[3] - dim[0]) +dy = abs(dim[4] - dim[1]) +dz = abs(dim[5] - dim[2]) +tol = 1e-06 +assert abs(dx - 400) <= tol +assert abs(dy - 258.5) <= tol +assert abs(dz - 0) <= tol +assert ImportImage_1.result().resultSubShapePair()[0].hasTexture() +assert Translation_1.result().resultSubShapePair()[0].hasTexture() +assert Scale_1.result().resultSubShapePair()[0].hasTexture() + +# ============================================================================= # Change the image : -#============================================================================= +# ============================================================================= model.begin() ImportImage_1.setFilePath(os.path.join(data_dir, "2.png")) ImportImage_1.execute() @@ -83,26 +96,26 @@ model.do() model.end() salome.sg.UpdateView() -#============================================================================= +# ============================================================================= # Tests : -#============================================================================= +# ============================================================================= model.checkResult(Scale_1, model, 1, [0], [0], [1], [4], [8]) -r=Scale_1.defaultResult() -s=r.shape() -dim=s.computeSize() -dim=dim[1:] -dx=abs(dim[3]-dim[0]) -dy=abs(dim[4]-dim[1]) -dz=abs(dim[5]-dim[2]) -tol=1e-06 -assert(abs(dx-448) <= tol) -assert(abs(dy-296.8) <= tol) -assert(abs(dz-0) <= tol) -assert(ImportImage_1.result().resultSubShapePair()[0].hasTexture()) -assert(Translation_1.result().resultSubShapePair()[0].hasTexture()) -assert(Scale_1.result().resultSubShapePair()[0].hasTexture()) - -assert(model.checkPythonDump()) +r = Scale_1.defaultResult() +s = r.shape() +dim = s.computeSize() +dim = dim[1:] +dx = abs(dim[3] - dim[0]) +dy = abs(dim[4] - dim[1]) +dz = abs(dim[5] - dim[2]) +tol = 1e-06 +assert abs(dx - 448) <= tol +assert abs(dy - 296.8) <= tol +assert abs(dz - 0) <= tol +assert ImportImage_1.result().resultSubShapePair()[0].hasTexture() +assert Translation_1.result().resultSubShapePair()[0].hasTexture() +assert Scale_1.result().resultSubShapePair()[0].hasTexture() + +assert model.checkPythonDump() # Close SALOME GUI import salome_utils @@ -110,4 +123,4 @@ import killSalomeWithPort port = salome_utils.getPortNumber(False) if port: - killSalomeWithPort.killMyPort(port) + killSalomeWithPort.killMyPort(port) diff --git a/src/ExchangePlugin/Test/TestImportImage_2.py b/src/ExchangePlugin/Test/TestImportImage_2.py index a95cb228c..b9462bbbf 100755 --- a/src/ExchangePlugin/Test/TestImportImage_2.py +++ b/src/ExchangePlugin/Test/TestImportImage_2.py @@ -23,18 +23,21 @@ from salome.shaper import model from PyQt5.Qt import QApplication import salome + salome.salome_init_without_session() salome.salome_init(1) if QApplication.instance() is None: - app = QApplication([]) + app = QApplication([]) data_dir = os.path.join(os.path.dirname(inspect.getfile(lambda: None)), "data") from tempfile import TemporaryDirectory + tmp_dir = TemporaryDirectory() img_file = os.path.join(tmp_dir.name, "1.jpg") from shutil import copyfile + copyfile(os.path.join(data_dir, "1.jpg"), img_file) @@ -52,35 +55,47 @@ ImportImage_1.setName("drawing") ImportImage_1.result().setName("drawing") ### Create Translation -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "drawing")], startPoint = model.selection("VERTEX", "[drawing/Shape_1]e[drawing/Shape_4]e"), endPoint = model.selection("VERTEX", "PartSet/Origin"), keepSubResults = True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("FACE", "drawing")], + startPoint=model.selection("VERTEX", "[drawing/Shape_1]e[drawing/Shape_4]e"), + endPoint=model.selection("VERTEX", "PartSet/Origin"), + keepSubResults=True, +) ### Create Scale -Scale_1 = model.addScale(Part_1_doc, [model.selection("FACE", "drawing")] , model.selection("VERTEX", "PartSet/Origin"), 0.5, keepSubResults = True) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("FACE", "drawing")], + model.selection("VERTEX", "PartSet/Origin"), + 0.5, + keepSubResults=True, +) model.end() -#============================================================================= +# ============================================================================= # Tests : -#============================================================================= +# ============================================================================= model.checkResult(Scale_1, model, 1, [0], [0], [1], [4], [8]) -r=Scale_1.defaultResult() -s=r.shape() -dim=s.computeSize() -dim=dim[1:] -dx=abs(dim[3]-dim[0]) -dy=abs(dim[4]-dim[1]) -dz=abs(dim[5]-dim[2]) -tol=1e-06 -assert(abs(dx-400) <= tol) -assert(abs(dy-258.5) <= tol) -assert(abs(dz-0) <= tol) -assert(ImportImage_1.result().resultSubShapePair()[0].hasTexture()) -assert(Translation_1.result().resultSubShapePair()[0].hasTexture()) -assert(Scale_1.result().resultSubShapePair()[0].hasTexture()) - -#============================================================================= +r = Scale_1.defaultResult() +s = r.shape() +dim = s.computeSize() +dim = dim[1:] +dx = abs(dim[3] - dim[0]) +dy = abs(dim[4] - dim[1]) +dz = abs(dim[5] - dim[2]) +tol = 1e-06 +assert abs(dx - 400) <= tol +assert abs(dy - 258.5) <= tol +assert abs(dz - 0) <= tol +assert ImportImage_1.result().resultSubShapePair()[0].hasTexture() +assert Translation_1.result().resultSubShapePair()[0].hasTexture() +assert Scale_1.result().resultSubShapePair()[0].hasTexture() + +# ============================================================================= # Change the image : -#============================================================================= +# ============================================================================= os.rename(img_file, os.path.join(tmp_dir.name, "1_new.jpg")) model.begin() @@ -89,24 +104,24 @@ Scale_1.execute() model.do() model.end() -#============================================================================= +# ============================================================================= # Tests : -#============================================================================= +# ============================================================================= model.checkResult(Scale_1, model, 1, [0], [0], [1], [4], [8]) -r=Scale_1.defaultResult() -s=r.shape() -dim=s.computeSize() -dim=dim[1:] -dx=abs(dim[3]-dim[0]) -dy=abs(dim[4]-dim[1]) -dz=abs(dim[5]-dim[2]) -tol=1e-06 -assert(abs(dx-560) <= tol) -assert(abs(dy-361.9) <= tol) -assert(abs(dz-0) <= tol) -assert(ImportImage_1.result().resultSubShapePair()[0].hasTexture()) -assert(Translation_1.result().resultSubShapePair()[0].hasTexture()) -assert(Scale_1.result().resultSubShapePair()[0].hasTexture()) +r = Scale_1.defaultResult() +s = r.shape() +dim = s.computeSize() +dim = dim[1:] +dx = abs(dim[3] - dim[0]) +dy = abs(dim[4] - dim[1]) +dz = abs(dim[5] - dim[2]) +tol = 1e-06 +assert abs(dx - 560) <= tol +assert abs(dy - 361.9) <= tol +assert abs(dz - 0) <= tol +assert ImportImage_1.result().resultSubShapePair()[0].hasTexture() +assert Translation_1.result().resultSubShapePair()[0].hasTexture() +assert Scale_1.result().resultSubShapePair()[0].hasTexture() # Close SALOME GUI @@ -115,4 +130,4 @@ import killSalomeWithPort port = salome_utils.getPortNumber(False) if port: - killSalomeWithPort.killMyPort(port) + killSalomeWithPort.killMyPort(port) diff --git a/src/ExchangePlugin/Test/TestImportImage_3.py b/src/ExchangePlugin/Test/TestImportImage_3.py index 1f0cdca24..017738e01 100755 --- a/src/ExchangePlugin/Test/TestImportImage_3.py +++ b/src/ExchangePlugin/Test/TestImportImage_3.py @@ -23,10 +23,11 @@ from salome.shaper import model from PyQt5.Qt import QApplication import salome + salome.salome_init_without_session() salome.salome_init(1) if QApplication.instance() is None: - app = QApplication([]) + app = QApplication([]) from tempfile import TemporaryDirectory from ModelAPI import * @@ -47,62 +48,75 @@ ImportImage_1.setName("drawing") ImportImage_1.result().setName("drawing") ### Create Translation -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "drawing")], startPoint = model.selection("VERTEX", "[drawing/Shape_1]e[drawing/Shape_4]e"), endPoint = model.selection("VERTEX", "PartSet/Origin"), keepSubResults = True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("FACE", "drawing")], + startPoint=model.selection("VERTEX", "[drawing/Shape_1]e[drawing/Shape_4]e"), + endPoint=model.selection("VERTEX", "PartSet/Origin"), + keepSubResults=True, +) Translation_1.setName("translation") ### Create Scale -Scale_1 = model.addScale(Part_1_doc, [model.selection("FACE", "drawing")] , model.selection("VERTEX", "PartSet/Origin"), 0.5, keepSubResults = True) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("FACE", "drawing")], + model.selection("VERTEX", "PartSet/Origin"), + 0.5, + keepSubResults=True, +) Scale_1.setName("scale") model.end() -#============================================================================= +# ============================================================================= # Tests : -#============================================================================= +# ============================================================================= model.checkResult(Scale_1, model, 1, [0], [0], [1], [4], [8]) -r=Scale_1.defaultResult() -s=r.shape() -dim=s.computeSize() -dim=dim[1:] -dx=abs(dim[3]-dim[0]) -dy=abs(dim[4]-dim[1]) -dz=abs(dim[5]-dim[2]) -tol=1e-06 -assert(abs(dx-400) <= tol) -assert(abs(dy-258.5) <= tol) -assert(abs(dz-0) <= tol) -assert(ImportImage_1.result().resultSubShapePair()[0].hasTexture()) -assert(Translation_1.result().resultSubShapePair()[0].hasTexture()) -assert(Scale_1.result().resultSubShapePair()[0].hasTexture()) +r = Scale_1.defaultResult() +s = r.shape() +dim = s.computeSize() +dim = dim[1:] +dx = abs(dim[3] - dim[0]) +dy = abs(dim[4] - dim[1]) +dz = abs(dim[5] - dim[2]) +tol = 1e-06 +assert abs(dx - 400) <= tol +assert abs(dy - 258.5) <= tol +assert abs(dz - 0) <= tol +assert ImportImage_1.result().resultSubShapePair()[0].hasTexture() +assert Translation_1.result().resultSubShapePair()[0].hasTexture() +assert Scale_1.result().resultSubShapePair()[0].hasTexture() aDr = objectToFeature(Part_1_doc.objectByName("Features", "drawing")) -assert(aDr.firstResult().hasTexture()) +assert aDr.firstResult().hasTexture() # check save/load document with an image with TemporaryDirectory() as tmp_dir: - aSession = ModelAPI_Session.get() - aFiles = StringList() - aSession.save(tmp_dir, aFiles) - aSession.closeAll() - assert(aSession.load(tmp_dir)) - model.begin() - partSet = model.moduleDocument() - assert(partSet.size("Features") == 1) - aPart = objectToFeature(partSet.object("Features", 0)) - aPartResult = modelAPI_ResultPart(aPart.results()[0]) - aPartResult.activate() - aPartDoc = aPartResult.partDoc() - aSession.setActiveDocument(aPartDoc, True) - model.end() - aDr = objectToFeature(aPartDoc.objectByName("Features", "drawing")) - aTr = objectToFeature(aPartDoc.objectByName("Features", "translation")) - aSc = objectToFeature(aPartDoc.objectByName("Features", "scale")) - assert(aDr.firstResult().hasTexture()) - assert(aTr.firstResult().hasTexture()) - assert(aSc.firstResult().hasTexture()) + aSession = ModelAPI_Session.get() + aFiles = StringList() + aSession.save(tmp_dir, aFiles) + aSession.closeAll() + assert aSession.load(tmp_dir) + model.begin() + partSet = model.moduleDocument() + assert partSet.size("Features") == 1 + aPart = objectToFeature(partSet.object("Features", 0)) + aPartResult = modelAPI_ResultPart(aPart.results()[0]) + aPartResult.activate() + aPartDoc = aPartResult.partDoc() + aSession.setActiveDocument(aPartDoc, True) + model.end() + aDr = objectToFeature(aPartDoc.objectByName("Features", "drawing")) + aTr = objectToFeature(aPartDoc.objectByName("Features", "translation")) + aSc = objectToFeature(aPartDoc.objectByName("Features", "scale")) + assert aDr.firstResult().hasTexture() + assert aTr.firstResult().hasTexture() + assert aSc.firstResult().hasTexture() # Close SALOME GUI import salome_utils import subprocess + port = salome_utils.getPortNumber() proc = subprocess.Popen(["killSalomeWithPort.py", "{}".format(port)]) diff --git a/src/ExchangePlugin/Test/TestImportPart_AfterCurrent_1.py b/src/ExchangePlugin/Test/TestImportPart_AfterCurrent_1.py index f86281c33..35ca35d40 100644 --- a/src/ExchangePlugin/Test/TestImportPart_AfterCurrent_1.py +++ b/src/ExchangePlugin/Test/TestImportPart_AfterCurrent_1.py @@ -29,12 +29,22 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() 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"), 100) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), model.selection("EDGE", "PartSet/OY"), 45) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/YOZ"), + model.selection("EDGE", "PartSet/OY"), + 45, +) model.do() model.end() -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) # store the reference data @@ -44,13 +54,15 @@ for feat in features: res = [] for r in feat.results(): res.append(GeomAlgoAPI_ShapeTools.volume(r.shape())) - refData.append( (feat.getKind(), res) ) + refData.append((feat.getKind(), res)) # export all features from Part_1 model.begin() model.exportPart(Part_1_doc, filename) model.end() -assert os.path.exists(filename), "ERROR: Cannot export features from {}".format(Part_1.name()) +assert os.path.exists(filename), "ERROR: Cannot export features from {}".format( + Part_1.name() +) # close all documents model.reset() @@ -65,29 +77,61 @@ SketchLine_1 = Sketch_1.addLine(-20, -40, -50, -40) SketchLine_2 = Sketch_1.addLine(-50, -40, -50, -10) SketchLine_3 = Sketch_1.addLine(-50, -10, -20, -10) SketchLine_4 = Sketch_1.addLine(-20, -10, -20, -40) -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()) +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()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 30, 0) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OX"), 50) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 30, + 0, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OX"), + 50, +) model.end() # store features before the import featuresBeforeImportBegin = Part_1_doc.allFeatures() -featuresBeforeImportBegin.pop_back() # remove Translation_1 -featuresBeforeImportBegin.pop_back() # remove Extrusion_1 +featuresBeforeImportBegin.pop_back() # remove Translation_1 +featuresBeforeImportBegin.pop_back() # remove Extrusion_1 featuresBeforeImportFinish = [Translation_1.feature(), Extrusion_1.feature()] # import the document after Sketch_1 @@ -98,18 +142,24 @@ model.end() model.removeTmpFile(filename) # compare results with the reference data -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 features = Part_1_doc.allFeatures() for feat in featuresBeforeImportBegin: - if features.front().getKind() == feat.getKind() and features.front().name() == feat.name(): + if ( + features.front().getKind() == feat.getKind() + and features.front().name() == feat.name() + ): features.pop_front() for feat in featuresBeforeImportFinish: - if features.back().getKind() == feat.getKind() and features.back().name() == feat.name(): + if ( + features.back().getKind() == feat.getKind() + and features.back().name() == feat.name() + ): features.pop_back() -assert(len(features) == len(refData)) +assert len(features) == len(refData) for feat, ref in zip(features, refData): - assert(feat.getKind() == ref[0]) + assert feat.getKind() == ref[0] for fv, rv in zip(feat.results(), ref[1]): - assert(math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE) + assert math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ExchangePlugin/Test/TestImportPart_AfterCurrent_2.py b/src/ExchangePlugin/Test/TestImportPart_AfterCurrent_2.py index 3fadd6629..3d701fd9b 100644 --- a/src/ExchangePlugin/Test/TestImportPart_AfterCurrent_2.py +++ b/src/ExchangePlugin/Test/TestImportPart_AfterCurrent_2.py @@ -29,12 +29,22 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() 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"), 100) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), model.selection("EDGE", "PartSet/OY"), 45) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/YOZ"), + model.selection("EDGE", "PartSet/OY"), + 45, +) model.do() model.end() -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) # store the reference data @@ -44,13 +54,15 @@ for feat in features: res = [] for r in feat.results(): res.append(GeomAlgoAPI_ShapeTools.volume(r.shape())) - refData.append( (feat.getKind(), res) ) + refData.append((feat.getKind(), res)) # export all features from Part_1 model.begin() model.exportPart(Part_1_doc, filename) model.end() -assert os.path.exists(filename), "ERROR: Cannot export features from {}".format(Part_1.name()) +assert os.path.exists(filename), "ERROR: Cannot export features from {}".format( + Part_1.name() +) # close all documents model.reset() @@ -65,28 +77,60 @@ SketchLine_1 = Sketch_1.addLine(-20, -40, -50, -40) SketchLine_2 = Sketch_1.addLine(-50, -40, -50, -10) SketchLine_3 = Sketch_1.addLine(-50, -10, -20, -10) SketchLine_4 = Sketch_1.addLine(-20, -10, -20, -40) -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()) +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()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 30, 0) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OX"), 50) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 30, + 0, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OX"), + 50, +) model.end() # store features before the import featuresBeforeImportBegin = Part_1_doc.allFeatures() -featuresBeforeImportBegin.pop_back() # remove Translation_1 +featuresBeforeImportBegin.pop_back() # remove Translation_1 featuresBeforeImportFinish = [Translation_1.feature()] # import the document after Extrusion_1 @@ -97,18 +141,24 @@ model.end() model.removeTmpFile(filename) # compare results with the reference data -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 features = Part_1_doc.allFeatures() for feat in featuresBeforeImportBegin: - if features.front().getKind() == feat.getKind() and features.front().name() == feat.name(): + if ( + features.front().getKind() == feat.getKind() + and features.front().name() == feat.name() + ): features.pop_front() for feat in featuresBeforeImportFinish: - if features.back().getKind() == feat.getKind() and features.back().name() == feat.name(): + if ( + features.back().getKind() == feat.getKind() + and features.back().name() == feat.name() + ): features.pop_back() -assert(len(features) == len(refData)) +assert len(features) == len(refData) for feat, ref in zip(features, refData): - assert(feat.getKind() == ref[0]) + assert feat.getKind() == ref[0] for fv, rv in zip(feat.results(), ref[1]): - assert(math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE) + assert math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ExchangePlugin/Test/TestImportPart_AfterLast_1.py b/src/ExchangePlugin/Test/TestImportPart_AfterLast_1.py index 68fe20a44..5488e29fe 100644 --- a/src/ExchangePlugin/Test/TestImportPart_AfterLast_1.py +++ b/src/ExchangePlugin/Test/TestImportPart_AfterLast_1.py @@ -27,44 +27,95 @@ import math model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) model.do() model.end() -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) # store the reference data @@ -74,14 +125,16 @@ for feat in features: res = [] for r in feat.results(): res.append(GeomAlgoAPI_ShapeTools.volume(r.shape())) - refData.append( (feat.getKind(), res) ) + refData.append((feat.getKind(), res)) # export feature from PartSet featureToExport = Axis_4 model.begin() model.exportPart(partSet, filename, [featureToExport.result()]) model.end() -assert os.path.exists(filename), "ERROR: Cannot export feature {}".format(featureToExport.name()) +assert os.path.exists(filename), "ERROR: Cannot export feature {}".format( + featureToExport.name() +) # close all documents model.reset() @@ -96,22 +149,49 @@ SketchLine_1 = Sketch_1.addLine(-20, -40, -50, -40) SketchLine_2 = Sketch_1.addLine(-50, -40, -50, -10) SketchLine_3 = Sketch_1.addLine(-50, -10, -20, -10) SketchLine_4 = Sketch_1.addLine(-20, -10, -20, -40) -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()) +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()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 30, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 30, + 0, +) model.end() # store features before the import @@ -125,15 +205,18 @@ model.end() model.removeTmpFile(filename) # compare results with the reference data -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 features = Part_1_doc.allFeatures() for feat in featuresBeforeImport: - if features.front().getKind() == feat.getKind() and features.front().name() == feat.name(): + if ( + features.front().getKind() == feat.getKind() + and features.front().name() == feat.name() + ): features.pop_front() -assert(len(features) == len(refData)) +assert len(features) == len(refData) for feat, ref in zip(features, refData): - assert(feat.getKind() == ref[0]) + assert feat.getKind() == ref[0] for fv, rv in zip(feat.results(), ref[1]): - assert(math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE) + assert math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ExchangePlugin/Test/TestImportPart_AfterLast_2.py b/src/ExchangePlugin/Test/TestImportPart_AfterLast_2.py index 76200f43c..0935381ed 100644 --- a/src/ExchangePlugin/Test/TestImportPart_AfterLast_2.py +++ b/src/ExchangePlugin/Test/TestImportPart_AfterLast_2.py @@ -28,44 +28,95 @@ import math model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) model.do() model.end() -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) featureToExport = Sketch_1 @@ -80,13 +131,15 @@ for feat in features: res = [] for r in feat.results(): res.append(GeomAlgoAPI_ShapeTools.volume(r.shape())) - refData.append( (feat.getKind(), res) ) + refData.append((feat.getKind(), res)) # export sketch from Part_1 model.begin() model.exportPart(Part_1_doc, filename, [featureToExport.result()]) model.end() -assert os.path.exists(filename), "ERROR: Cannot export feature {}".format(featureToExport.name()) +assert os.path.exists(filename), "ERROR: Cannot export feature {}".format( + featureToExport.name() +) # close all documents model.reset() @@ -101,22 +154,49 @@ SketchLine_1 = Sketch_1.addLine(-20, -40, -50, -40) SketchLine_2 = Sketch_1.addLine(-50, -40, -50, -10) SketchLine_3 = Sketch_1.addLine(-50, -10, -20, -10) SketchLine_4 = Sketch_1.addLine(-20, -10, -20, -40) -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()) +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()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 30, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 30, + 0, +) model.end() # store features before the import @@ -130,15 +210,18 @@ model.end() model.removeTmpFile(filename) # compare results with the reference data -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 features = Part_1_doc.allFeatures() for feat in featuresBeforeImport: - if features.front().getKind() == feat.getKind() and features.front().name() == feat.name(): + if ( + features.front().getKind() == feat.getKind() + and features.front().name() == feat.name() + ): features.pop_front() -assert(len(features) == len(refData)) +assert len(features) == len(refData) for feat, ref in zip(features, refData): - assert(feat.getKind() == ref[0]) + assert feat.getKind() == ref[0] for fv, rv in zip(feat.results(), ref[1]): - assert(math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE) + assert math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ExchangePlugin/Test/TestImportPart_AfterLast_3.py b/src/ExchangePlugin/Test/TestImportPart_AfterLast_3.py index adadfa36b..0e740d309 100644 --- a/src/ExchangePlugin/Test/TestImportPart_AfterLast_3.py +++ b/src/ExchangePlugin/Test/TestImportPart_AfterLast_3.py @@ -27,44 +27,95 @@ import math model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) model.do() model.end() -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) featureToExport = Box_1 @@ -76,13 +127,15 @@ for feat in features: res = [] for r in feat.results(): res.append(GeomAlgoAPI_ShapeTools.volume(r.shape())) - refData.append( (feat.getKind(), res) ) + refData.append((feat.getKind(), res)) # export feature from Part_2 model.begin() model.exportPart(Part_2_doc, filename, [featureToExport.result()]) model.end() -assert os.path.exists(filename), "ERROR: Cannot export feature {}".format(featureToExport.name()) +assert os.path.exists(filename), "ERROR: Cannot export feature {}".format( + featureToExport.name() +) # close all documents model.reset() @@ -97,22 +150,49 @@ SketchLine_1 = Sketch_1.addLine(-20, -40, -50, -40) SketchLine_2 = Sketch_1.addLine(-50, -40, -50, -10) SketchLine_3 = Sketch_1.addLine(-50, -10, -20, -10) SketchLine_4 = Sketch_1.addLine(-20, -10, -20, -40) -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()) +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()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 30, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 30, + 0, +) model.end() # store features before the import @@ -126,15 +206,18 @@ model.end() model.removeTmpFile(filename) # compare results with the reference data -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 features = Part_1_doc.allFeatures() for feat in featuresBeforeImport: - if features.front().getKind() == feat.getKind() and features.front().name() == feat.name(): + if ( + features.front().getKind() == feat.getKind() + and features.front().name() == feat.name() + ): features.pop_front() -assert(len(features) == len(refData)) +assert len(features) == len(refData) for feat, ref in zip(features, refData): - assert(feat.getKind() == ref[0]) + assert feat.getKind() == ref[0] for fv, rv in zip(feat.results(), ref[1]): - assert(math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE) + assert math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ExchangePlugin/Test/TestImportPart_AfterLast_4.py b/src/ExchangePlugin/Test/TestImportPart_AfterLast_4.py index bea4048cf..65b5e9019 100644 --- a/src/ExchangePlugin/Test/TestImportPart_AfterLast_4.py +++ b/src/ExchangePlugin/Test/TestImportPart_AfterLast_4.py @@ -27,44 +27,95 @@ import math model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) model.do() model.end() -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) featureToExport = Translation_1 @@ -76,13 +127,15 @@ for feat in features: res = [] for r in feat.results(): res.append(GeomAlgoAPI_ShapeTools.volume(r.shape())) - refData.append( (feat.getKind(), res) ) + refData.append((feat.getKind(), res)) # export all features from Part_2 model.begin() model.exportPart(Part_2_doc, filename) model.end() -assert os.path.exists(filename), "ERROR: Cannot export feature {}".format(featureToExport.name()) +assert os.path.exists(filename), "ERROR: Cannot export feature {}".format( + featureToExport.name() +) # close all documents model.reset() @@ -97,22 +150,49 @@ SketchLine_1 = Sketch_1.addLine(-20, -40, -50, -40) SketchLine_2 = Sketch_1.addLine(-50, -40, -50, -10) SketchLine_3 = Sketch_1.addLine(-50, -10, -20, -10) SketchLine_4 = Sketch_1.addLine(-20, -10, -20, -40) -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()) +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()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 30, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 30, + 0, +) model.end() # store features before the import @@ -126,15 +206,18 @@ model.end() model.removeTmpFile(filename) # compare results with the reference data -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 features = Part_1_doc.allFeatures() for feat in featuresBeforeImport: - if features.front().getKind() == feat.getKind() and features.front().name() == feat.name(): + if ( + features.front().getKind() == feat.getKind() + and features.front().name() == feat.name() + ): features.pop_front() -assert(len(features) == len(refData)) +assert len(features) == len(refData) for feat, ref in zip(features, refData): - assert(feat.getKind() == ref[0]) + assert feat.getKind() == ref[0] for fv, rv in zip(feat.results(), ref[1]): - assert(math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE) + assert math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ExchangePlugin/Test/TestImportPart_AfterLast_5.py b/src/ExchangePlugin/Test/TestImportPart_AfterLast_5.py index 2c47c4b29..3e9245fc5 100644 --- a/src/ExchangePlugin/Test/TestImportPart_AfterLast_5.py +++ b/src/ExchangePlugin/Test/TestImportPart_AfterLast_5.py @@ -27,45 +27,101 @@ import math model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) -Plane_4 = model.addPlane(Part_2_doc, model.selection("FACE", "PartSet/YOZ"), model.selection("EDGE", "PartSet/OY"), 45) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) +Plane_4 = model.addPlane( + Part_2_doc, + model.selection("FACE", "PartSet/YOZ"), + model.selection("EDGE", "PartSet/OY"), + 45, +) model.do() model.end() -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) # store the reference data @@ -75,13 +131,15 @@ for feat in features: res = [] for r in feat.results(): res.append(GeomAlgoAPI_ShapeTools.volume(r.shape())) - refData.append( (feat.getKind(), res) ) + refData.append((feat.getKind(), res)) # export specified features from Part_2 model.begin() model.exportPart(Part_2_doc, filename, [Box_1.result(), Plane_4.result()]) model.end() -assert os.path.exists(filename), "ERROR: Cannot export features {} and {}".format(feature[0].name(), features[1].name()) +assert os.path.exists(filename), "ERROR: Cannot export features {} and {}".format( + feature[0].name(), features[1].name() +) # close all documents model.reset() @@ -96,22 +154,49 @@ SketchLine_1 = Sketch_1.addLine(-20, -40, -50, -40) SketchLine_2 = Sketch_1.addLine(-50, -40, -50, -10) SketchLine_3 = Sketch_1.addLine(-50, -10, -20, -10) SketchLine_4 = Sketch_1.addLine(-20, -10, -20, -40) -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()) +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()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 30, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 30, + 0, +) model.end() # store features before the import @@ -125,15 +210,18 @@ model.end() model.removeTmpFile(filename) # compare results with the reference data -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 features = Part_1_doc.allFeatures() for feat in featuresBeforeImport: - if features.front().getKind() == feat.getKind() and features.front().name() == feat.name(): + if ( + features.front().getKind() == feat.getKind() + and features.front().name() == feat.name() + ): features.pop_front() -assert(len(features) == len(refData)) +assert len(features) == len(refData) for feat, ref in zip(features, refData): - assert(feat.getKind() == ref[0]) + assert feat.getKind() == ref[0] for fv, rv in zip(feat.results(), ref[1]): - assert(math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE) + assert math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ExchangePlugin/Test/TestImportPart_AfterLast_6.py b/src/ExchangePlugin/Test/TestImportPart_AfterLast_6.py index 154749c25..bd9637375 100644 --- a/src/ExchangePlugin/Test/TestImportPart_AfterLast_6.py +++ b/src/ExchangePlugin/Test/TestImportPart_AfterLast_6.py @@ -27,45 +27,101 @@ import math model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 100, 100) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/Axis_4"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "PartSet/Axis_4"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 100) -Plane_4 = model.addPlane(Part_2_doc, model.selection("FACE", "PartSet/YOZ"), model.selection("EDGE", "PartSet/OY"), 45) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) +Plane_4 = model.addPlane( + Part_2_doc, + model.selection("FACE", "PartSet/YOZ"), + model.selection("EDGE", "PartSet/OY"), + 45, +) model.do() model.end() -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) # store the reference data @@ -75,14 +131,16 @@ for feat in features: res = [] for r in feat.results(): res.append(GeomAlgoAPI_ShapeTools.volume(r.shape())) - refData.append( (feat.getKind(), res) ) + refData.append((feat.getKind(), res)) # export all features before the history line from Part_2 model.begin() Part_2_doc.setCurrentFeature(Translation_1.feature(), False) model.exportPart(Part_2_doc, filename) model.end() -assert os.path.exists(filename), "ERROR: Cannot export features {} and {}".format(feature[0].name(), features[1].name()) +assert os.path.exists(filename), "ERROR: Cannot export features {} and {}".format( + feature[0].name(), features[1].name() +) # close all documents model.reset() @@ -97,22 +155,49 @@ SketchLine_1 = Sketch_1.addLine(-20, -40, -50, -40) SketchLine_2 = Sketch_1.addLine(-50, -40, -50, -10) SketchLine_3 = Sketch_1.addLine(-50, -10, -20, -10) SketchLine_4 = Sketch_1.addLine(-20, -10, -20, -40) -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()) +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()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 30, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 30, + 0, +) model.end() # store features before the import @@ -126,15 +211,18 @@ model.end() model.removeTmpFile(filename) # compare results with the reference data -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 features = Part_1_doc.allFeatures() for feat in featuresBeforeImport: - if features.front().getKind() == feat.getKind() and features.front().name() == feat.name(): + if ( + features.front().getKind() == feat.getKind() + and features.front().name() == feat.name() + ): features.pop_front() -assert(len(features) == len(refData)) +assert len(features) == len(refData) for feat, ref in zip(features, refData): - assert(feat.getKind() == ref[0]) + assert feat.getKind() == ref[0] for fv, rv in zip(feat.results(), ref[1]): - assert(math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE) + assert math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ExchangePlugin/Test/TestImportPart_Construction_1.py b/src/ExchangePlugin/Test/TestImportPart_Construction_1.py index 8a0153457..8f972f96e 100644 --- a/src/ExchangePlugin/Test/TestImportPart_Construction_1.py +++ b/src/ExchangePlugin/Test/TestImportPart_Construction_1.py @@ -34,10 +34,14 @@ Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Origin"), False) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Axis_1 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_1 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) model.end() # store the reference data @@ -47,9 +51,9 @@ for feat in features: res = [] for r in feat.results(): res.append(GeomAlgoAPI_ShapeTools.volume(r.shape())) - refData.append( (feat.getKind(), res) ) + refData.append((feat.getKind(), res)) -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) # emport the document @@ -70,15 +74,15 @@ model.end() model.removeTmpFile(filename) # Test 1. No Part should be created -assert(partSet.size(ModelAPI_ResultPart.group()) == 0) +assert partSet.size(ModelAPI_ResultPart.group()) == 0 # Test 2. Compare results with the reference data -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 features = partSet.allFeatures() -assert(len(features) == len(refData)) +assert len(features) == len(refData) for feat, ref in zip(features, refData): - assert(feat.getKind() == ref[0]) + assert feat.getKind() == ref[0] for fv, rv in zip(feat.results(), ref[1]): - assert(math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE) + assert math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ExchangePlugin/Test/TestImportPart_Construction_2.py b/src/ExchangePlugin/Test/TestImportPart_Construction_2.py index f4bad9d26..a843f5b05 100644 --- a/src/ExchangePlugin/Test/TestImportPart_Construction_2.py +++ b/src/ExchangePlugin/Test/TestImportPart_Construction_2.py @@ -34,10 +34,14 @@ Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Origin"), False) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Axis_1 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) +Axis_1 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) model.end() # store the reference data (without Origin, coordinate axes and planes) @@ -49,9 +53,9 @@ for feat in features: res = [] for r in feat.results(): res.append(GeomAlgoAPI_ShapeTools.volume(r.shape())) - refData.append( (feat.getKind(), res) ) + refData.append((feat.getKind(), res)) -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) # emport the document @@ -74,15 +78,15 @@ model.end() model.removeTmpFile(filename) # Test 1. No Part should be created -assert(partSet.size(ModelAPI_ResultPart.group()) == 1) +assert partSet.size(ModelAPI_ResultPart.group()) == 1 # Test 2. Compare results with the reference data -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 features = Part_1_doc.allFeatures() -assert(len(features) == len(refData)) +assert len(features) == len(refData) for feat, ref in zip(features, refData): - assert(feat.getKind() == ref[0]) + assert feat.getKind() == ref[0] for fv, rv in zip(feat.results(), ref[1]): - assert(math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE) + assert math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ExchangePlugin/Test/TestImportPart_Construction_3.py b/src/ExchangePlugin/Test/TestImportPart_Construction_3.py index b88673734..a3628ca31 100644 --- a/src/ExchangePlugin/Test/TestImportPart_Construction_3.py +++ b/src/ExchangePlugin/Test/TestImportPart_Construction_3.py @@ -33,13 +33,21 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Point_1 = model.addPoint(Part_1_doc, 100, 100, 100) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Axis_1 = model.addAxis(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Point_1")) +Axis_1 = model.addAxis( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("VERTEX", "Point_1"), +) model.end() # store the reference data @@ -49,9 +57,9 @@ for feat in features: res = [] for r in feat.results(): res.append(GeomAlgoAPI_ShapeTools.volume(r.shape())) - refData.append( (feat.getKind(), res) ) + refData.append((feat.getKind(), res)) -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) # emport the document @@ -72,18 +80,18 @@ model.end() model.removeTmpFile(filename) # Test 1. No new Part should be created -assert(partSet.size(ModelAPI_ResultPart.group()) == 0) +assert partSet.size(ModelAPI_ResultPart.group()) == 0 # Test 2. Compare results with the reference data -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 features = partSet.allFeatures() for i in range(0, 7): # exclude Origin, coordinate axes and planes features.pop_front() -assert(len(features) == len(refData)) +assert len(features) == len(refData) for feat, ref in zip(features, refData): - assert(feat.getKind() == ref[0]) + assert feat.getKind() == ref[0] for fv, rv in zip(feat.results(), ref[1]): - assert(math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE) + assert math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ExchangePlugin/Test/TestImportPart_Construction_4.py b/src/ExchangePlugin/Test/TestImportPart_Construction_4.py index 883d8c3cf..ca896687e 100644 --- a/src/ExchangePlugin/Test/TestImportPart_Construction_4.py +++ b/src/ExchangePlugin/Test/TestImportPart_Construction_4.py @@ -33,13 +33,21 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Point_1 = model.addPoint(Part_1_doc, 100, 100, 100) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Axis_1 = model.addAxis(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Point_1")) +Axis_1 = model.addAxis( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("VERTEX", "Point_1"), +) model.end() # store the reference data @@ -49,9 +57,9 @@ for feat in features: res = [] for r in feat.results(): res.append(GeomAlgoAPI_ShapeTools.volume(r.shape())) - refData.append( (feat.getKind(), res) ) + refData.append((feat.getKind(), res)) -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) # emport the document @@ -74,15 +82,15 @@ model.end() model.removeTmpFile(filename) # Test 1. No new Part should be created -assert(partSet.size(ModelAPI_ResultPart.group()) == 1) +assert partSet.size(ModelAPI_ResultPart.group()) == 1 # Test 2. Compare results with the reference data -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 features = Part_1_doc.allFeatures() -assert(len(features) == len(refData)) +assert len(features) == len(refData) for feat, ref in zip(features, refData): - assert(feat.getKind() == ref[0]) + assert feat.getKind() == ref[0] for fv, rv in zip(feat.results(), ref[1]): - assert(math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE) + assert math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ExchangePlugin/Test/TestImportPart_Multiple.py b/src/ExchangePlugin/Test/TestImportPart_Multiple.py index ef0908f15..34fa1acd5 100644 --- a/src/ExchangePlugin/Test/TestImportPart_Multiple.py +++ b/src/ExchangePlugin/Test/TestImportPart_Multiple.py @@ -30,20 +30,32 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() 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"), 100) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 100, +) Translation_1.setName("MovedBox") -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), model.selection("EDGE", "PartSet/OY"), 45) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/YOZ"), + model.selection("EDGE", "PartSet/OY"), + 45, +) model.do() model.end() -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) # export all features from Part_1 model.begin() model.exportPart(Part_1_doc, filename) model.end() -assert os.path.exists(filename), "ERROR: Cannot export features from {}".format(Part_1.name()) +assert os.path.exists(filename), "ERROR: Cannot export features from {}".format( + Part_1.name() +) # close all documents model.reset() @@ -58,23 +70,55 @@ SketchLine_1 = Sketch_1.addLine(-20, -40, -50, -40) SketchLine_2 = Sketch_1.addLine(-50, -40, -50, -10) SketchLine_3 = Sketch_1.addLine(-50, -10, -20, -10) SketchLine_4 = Sketch_1.addLine(-20, -10, -20, -40) -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()) +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()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_3.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 30, 0) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OX"), 50) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 30, + 0, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OX"), + 50, +) model.end() @@ -84,7 +128,7 @@ def checkUniqueNames(theDocument): for feat in features: name = feat.data().name() if not name == "": - assert(not name in names), "'{}' already exists in {}".format(name, names) + assert not name in names, "'{}' already exists in {}".format(name, names) names.add(name) @@ -114,4 +158,4 @@ checkUniqueNames(Part_1_doc) model.removeTmpFile(filename) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ExchangePlugin/Test/TestImportPart_ToEmptyPart.py b/src/ExchangePlugin/Test/TestImportPart_ToEmptyPart.py index fe88770a5..a1f512d84 100644 --- a/src/ExchangePlugin/Test/TestImportPart_ToEmptyPart.py +++ b/src/ExchangePlugin/Test/TestImportPart_ToEmptyPart.py @@ -31,30 +31,78 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Point_1 = model.addPoint(Part_1_doc, 100, 100, 100) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Axis_1 = model.addAxis(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Point_1")) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "Axis_1"), 100, 0) +Axis_1 = model.addAxis( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("VERTEX", "Point_1"), +) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "Axis_1"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() model.end() @@ -65,9 +113,9 @@ for feat in features: res = [] for r in feat.results(): res.append(GeomAlgoAPI_ShapeTools.volume(r.shape())) - refData.append( (feat.getKind(), res) ) + refData.append((feat.getKind(), res)) -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) # emport the document @@ -90,15 +138,15 @@ model.end() model.removeTmpFile(filename) # Test 1. No new Part should be created -assert(partSet.size(ModelAPI_ResultPart.group()) == 1) +assert partSet.size(ModelAPI_ResultPart.group()) == 1 # Test 2. Compare results with the reference data -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 features = Part_1_doc.allFeatures() -assert(len(features) == len(refData)) +assert len(features) == len(refData) for feat, ref in zip(features, refData): - assert(feat.getKind() == ref[0]) + assert feat.getKind() == ref[0] for fv, rv in zip(feat.results(), ref[1]): - assert(math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE) + assert math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ExchangePlugin/Test/TestImportPart_ToEmptyPartSet.py b/src/ExchangePlugin/Test/TestImportPart_ToEmptyPartSet.py index 1d8bda0f6..df4a6308a 100644 --- a/src/ExchangePlugin/Test/TestImportPart_ToEmptyPartSet.py +++ b/src/ExchangePlugin/Test/TestImportPart_ToEmptyPartSet.py @@ -31,30 +31,78 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Point_1 = model.addPoint(Part_1_doc, 100, 100, 100) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Axis_1 = model.addAxis(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Point_1")) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection("EDGE", "Axis_1"), 100, 0) +Axis_1 = model.addAxis( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("VERTEX", "Point_1"), +) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection("EDGE", "Axis_1"), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_1 = Sketch_2.addLine(57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163) -SketchLine_2 = Sketch_2.addLine(71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchLine_1 = Sketch_2.addLine( + 57.73502691896258, 57.73502691896258, 71.87716254269353, 43.59289129523163 +) +SketchLine_2 = Sketch_2.addLine( + 71.87716254269353, 43.59289129523163, 71.87716254269353, 71.87716254269353 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 71.87716254269353, 71.87716254269353, 57.73502691896258, 57.73502691896258 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 20) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection("EDGE", "PartSet/OX"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection("EDGE", "PartSet/OX"), + 180, + 0, +) model.do() model.end() @@ -65,9 +113,9 @@ for feat in features: res = [] for r in feat.results(): res.append(GeomAlgoAPI_ShapeTools.volume(r.shape())) - refData.append( (feat.getKind(), res) ) + refData.append((feat.getKind(), res)) -filename = model.getTmpFileName('check_export', '.shaperpart') +filename = model.getTmpFileName("check_export", ".shaperpart") model.removeTmpFile(filename) # emport the document @@ -88,17 +136,19 @@ model.end() model.removeTmpFile(filename) # Test 1. New Part should be created -assert(partSet.size(ModelAPI_ResultPart.group()) == 1) -newPart = modelAPI_ResultPart(objectToResult(partSet.object(ModelAPI_ResultPart.group(), 0))) +assert partSet.size(ModelAPI_ResultPart.group()) == 1 +newPart = modelAPI_ResultPart( + objectToResult(partSet.object(ModelAPI_ResultPart.group(), 0)) +) newPart_doc = newPart.partDoc() # Test 2. Compare results with the reference data -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 features = newPart_doc.allFeatures() -assert(len(features) == len(refData)) +assert len(features) == len(refData) for feat, ref in zip(features, refData): - assert(feat.getKind() == ref[0]) + assert feat.getKind() == ref[0] for fv, rv in zip(feat.results(), ref[1]): - assert(math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE) + assert math.fabs(GeomAlgoAPI_ShapeTools.volume(fv.shape()) - rv) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ExchangePlugin/Test/TestStep1.py b/src/ExchangePlugin/Test/TestStep1.py index 527f3bddd..f747cc71c 100644 --- a/src/ExchangePlugin/Test/TestStep1.py +++ b/src/ExchangePlugin/Test/TestStep1.py @@ -27,9 +27,9 @@ partSet = model.moduleDocument() ### Create Part Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -model.addParameter(Part_1_doc, "LGX", '3.0') -model.addParameter(Part_1_doc, "LGY", '2.825') -model.addParameter(Part_1_doc, "HTR", '1.2') +model.addParameter(Part_1_doc, "LGX", "3.0") +model.addParameter(Part_1_doc, "LGY", "2.825") +model.addParameter(Part_1_doc, "HTR", "1.2") ### Create Sketch Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) @@ -38,12 +38,16 @@ Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) SketchLine_1 = Sketch_1.addLine(0, 0, 1.165, 0) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result()) ### Create SketchProjection -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) @@ -77,7 +81,9 @@ SketchLine_8 = Sketch_1.addLine(2.825, 1.2, 0, 1.2) Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) ### Create SketchProjection -SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_3 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_9 = SketchProjection_3.createdFeature() Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.result()) Sketch_1.setHorizontal(SketchLine_8.result()) @@ -104,12 +110,16 @@ Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) SketchLine_11 = Sketch_2.addLine(0, 0, 0.9999999999999999, 0) ### Create SketchProjection -SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_10_EndVertex"), False) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_10_EndVertex"), False +) SketchPoint_2 = SketchProjection_4.createdFeature() Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchPoint_2.result()) ### Create SketchProjection -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_12 = SketchProjection_5.createdFeature() Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.result()) @@ -142,7 +152,9 @@ SketchLine_18 = Sketch_2.addLine(3, 1.2, 0, 1.2) Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) ### Create SketchProjection -SketchProjection_6 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_10_StartVertex"), False) +SketchProjection_6 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_10_StartVertex"), False +) SketchPoint_3 = SketchProjection_6.createdFeature() Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchPoint_3.result()) Sketch_2.setHorizontal(SketchLine_18.result()) @@ -170,7 +182,13 @@ SketchLine_20 = Sketch_3.addLine(1.325, 0, 0, 0) Sketch_3.setHorizontal(SketchLine_20.result()) ### Create SketchProjection -SketchProjection_7 = Sketch_3.addProjection(model.selection("VERTEX", "Face_1_1/Modified_Vertex&Sketch_1/SketchLine_10_EndVertex&Sketch_1/SketchLine_1_StartVertex"), False) +SketchProjection_7 = Sketch_3.addProjection( + model.selection( + "VERTEX", + "Face_1_1/Modified_Vertex&Sketch_1/SketchLine_10_EndVertex&Sketch_1/SketchLine_1_StartVertex", + ), + False, +) SketchPoint_4 = SketchProjection_7.createdFeature() Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchPoint_4.result()) @@ -192,7 +210,9 @@ Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) Sketch_3.setVertical(SketchLine_23.result()) ### Create SketchProjection -SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_8"), False) +SketchProjection_8 = Sketch_3.addProjection( + model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_8"), False +) SketchLine_24 = SketchProjection_8.createdFeature() Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_24.result()) model.do() @@ -201,10 +221,27 @@ model.do() Face_3 = model.addFace(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_3")]) ### Create Translation -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "all-in-Face_3")], axis = model.selection("EDGE", "PartSet/OX"), distance = "LGX", keepSubResults = True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Face_3")], + axis=model.selection("EDGE", "PartSet/OX"), + distance="LGX", + keepSubResults=True, +) ### Create Plane -Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Sketch_2/SketchLine_17_EndVertex"), model.selection("VERTEX", "Translation_1_1_1/MV:Translated&Sketch_3/SketchLine_22_EndVertex&Sketch_3/SketchLine_23_StartVertex"), model.selection("VERTEX", "Face_1_1/Modified_Vertex&Sketch_1/SketchLine_8_StartVertex&Sketch_1/SketchLine_7_EndVertex")) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("VERTEX", "Sketch_2/SketchLine_17_EndVertex"), + model.selection( + "VERTEX", + "Translation_1_1_1/MV:Translated&Sketch_3/SketchLine_22_EndVertex&Sketch_3/SketchLine_23_StartVertex", + ), + model.selection( + "VERTEX", + "Face_1_1/Modified_Vertex&Sketch_1/SketchLine_8_StartVertex&Sketch_1/SketchLine_7_EndVertex", + ), +) ### Create Sketch Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) @@ -213,12 +250,16 @@ Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) SketchLine_25 = Sketch_4.addLine(0, 0, 3, 0) ### Create SketchProjection -SketchProjection_9 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_3/SketchLine_21_EndVertex"), False) +SketchProjection_9 = Sketch_4.addProjection( + model.selection("VERTEX", "Sketch_3/SketchLine_21_EndVertex"), False +) SketchPoint_5 = SketchProjection_9.createdFeature() Sketch_4.setCoincident(SketchLine_25.startPoint(), SketchPoint_5.result()) ### Create SketchProjection -SketchProjection_10 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_2/SketchLine_17_EndVertex"), False) +SketchProjection_10 = Sketch_4.addProjection( + model.selection("VERTEX", "Sketch_2/SketchLine_17_EndVertex"), False +) SketchPoint_6 = SketchProjection_10.createdFeature() Sketch_4.setCoincident(SketchLine_25.endPoint(), SketchPoint_6.result()) @@ -227,7 +268,13 @@ SketchLine_26 = Sketch_4.addLine(3, 0, 3, 1.325) Sketch_4.setCoincident(SketchLine_25.endPoint(), SketchLine_26.startPoint()) ### Create SketchProjection -SketchProjection_11 = Sketch_4.addProjection(model.selection("VERTEX", "Translation_1_1_1/MV:Translated&Sketch_3/SketchLine_22_EndVertex&Sketch_3/SketchLine_23_StartVertex"), False) +SketchProjection_11 = Sketch_4.addProjection( + model.selection( + "VERTEX", + "Translation_1_1_1/MV:Translated&Sketch_3/SketchLine_22_EndVertex&Sketch_3/SketchLine_23_StartVertex", + ), + False, +) SketchPoint_7 = SketchProjection_11.createdFeature() Sketch_4.setCoincident(SketchLine_26.endPoint(), SketchPoint_7.result()) @@ -236,7 +283,9 @@ SketchLine_27 = Sketch_4.addLine(3, 1.325, 0, 2.825) Sketch_4.setCoincident(SketchLine_26.endPoint(), SketchLine_27.startPoint()) ### Create SketchProjection -SketchProjection_12 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_7_EndVertex"), False) +SketchProjection_12 = Sketch_4.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_7_EndVertex"), False +) SketchPoint_8 = SketchProjection_12.createdFeature() Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchPoint_8.result()) @@ -247,7 +296,15 @@ Sketch_4.setCoincident(SketchLine_25.startPoint(), SketchLine_28.endPoint()) model.do() ### Create Face -Face_4 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchLine_25r-SketchLine_26f-SketchLine_27f-SketchLine_28f")]) +Face_4 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_4/Face-SketchLine_25r-SketchLine_26f-SketchLine_27f-SketchLine_28f", + ) + ], +) ### Create Sketch Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Face_4_1")) @@ -256,39 +313,70 @@ Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Face_4_1")) SketchLine_29 = Sketch_5.addLine(1.5, 0, 1.5, 1.6) ### Create SketchProjection -SketchProjection_13 = Sketch_5.addProjection(model.selection("EDGE", "Face_4_1/Modified_Edge&Sketch_4/SketchLine_25"), False) +SketchProjection_13 = Sketch_5.addProjection( + model.selection("EDGE", "Face_4_1/Modified_Edge&Sketch_4/SketchLine_25"), False +) SketchLine_30 = SketchProjection_13.createdFeature() Sketch_5.setCoincident(SketchLine_29.startPoint(), SketchLine_30.result()) Sketch_5.setVertical(SketchLine_29.result()) Sketch_5.setLength(SketchLine_29.result(), "LGY/2.825*1.6") -Sketch_5.setHorizontalDistance(SketchAPI_Line(SketchLine_30).startPoint(), SketchLine_29.startPoint(), "LGX*0.5") +Sketch_5.setHorizontalDistance( + SketchAPI_Line(SketchLine_30).startPoint(), SketchLine_29.startPoint(), "LGX*0.5" +) model.do() ### Create Partition -Partition_1_objects = [model.selection("FACE", "Face_1_1"), - model.selection("FACE", "Face_2_1"), - model.selection("COMPOUND", "Translation_1_1"), - model.selection("FACE", "Face_4_1")] -Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults = True) +Partition_1_objects = [ + model.selection("FACE", "Face_1_1"), + model.selection("FACE", "Face_2_1"), + model.selection("COMPOUND", "Translation_1_1"), + model.selection("FACE", "Face_4_1"), +] +Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults=True) ### Create Extrusion -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Partition_1_1_4")], model.selection(), "HTR", 0, "Faces|Wires") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Partition_1_1_4")], + model.selection(), + "HTR", + 0, + "Faces|Wires", +) ### Create Recover Recover_1 = model.addRecover(Part_1_doc, Extrusion_1, [Partition_1.result()], True) ### Create Extrusion -Extrusion_2_objects = [model.selection("VERTEX", "Recover_1_1_3/Modified_Vertex&Sketch_3/SketchLine_20_StartVertex&Sketch_3/SketchLine_23_EndVertex"), - model.selection("VERTEX", "[Recover_1_1_2/Modified_Edge&Sketch_2/SketchLine_16]e[Recover_1_1_2/Modified_Edge&Sketch_3/SketchLine_21&Sketch_2/SketchLine_17]e"), - model.selection("VERTEX", "[Recover_1_1_1/Modified_Edge&Sketch_1/SketchLine_1]e[Recover_1_1_1/Modified_Edge&Sketch_2/SketchLine_19&Sketch_1/SketchLine_10]e"), - model.selection("VERTEX", "Recover_1_1_1/Modified_Vertex&Sketch_1/SketchLine_7_StartVertex&Sketch_1/SketchLine_6_EndVertex")] -Extrusion_2 = model.addExtrusion(Part_1_doc, Extrusion_2_objects, model.selection("EDGE", "PartSet/OZ"), 0, "HTR") +Extrusion_2_objects = [ + model.selection( + "VERTEX", + "Recover_1_1_3/Modified_Vertex&Sketch_3/SketchLine_20_StartVertex&Sketch_3/SketchLine_23_EndVertex", + ), + model.selection( + "VERTEX", + "[Recover_1_1_2/Modified_Edge&Sketch_2/SketchLine_16]e[Recover_1_1_2/Modified_Edge&Sketch_3/SketchLine_21&Sketch_2/SketchLine_17]e", + ), + model.selection( + "VERTEX", + "[Recover_1_1_1/Modified_Edge&Sketch_1/SketchLine_1]e[Recover_1_1_1/Modified_Edge&Sketch_2/SketchLine_19&Sketch_1/SketchLine_10]e", + ), + model.selection( + "VERTEX", + "Recover_1_1_1/Modified_Vertex&Sketch_1/SketchLine_7_StartVertex&Sketch_1/SketchLine_6_EndVertex", + ), +] +Extrusion_2 = model.addExtrusion( + Part_1_doc, Extrusion_2_objects, model.selection("EDGE", "PartSet/OZ"), 0, "HTR" +) ### Create Partition -Partition_2_objects = [model.selection("COMPOUND", "all-in-Extrusion_1"), - model.selection("COMPOUND", "all-in-Recover_1"), - model.selection("COMPOUND", "all-in-Extrusion_2")] -Partition_2 = model.addPartition(Part_1_doc, Partition_2_objects, keepSubResults = True) +Partition_2_objects = [ + model.selection("COMPOUND", "all-in-Extrusion_1"), + model.selection("COMPOUND", "all-in-Recover_1"), + model.selection("COMPOUND", "all-in-Extrusion_2"), +] +Partition_2 = model.addPartition(Part_1_doc, Partition_2_objects, keepSubResults=True) Partition_2.result().setName("Structure") Partition_2.result().subResult(0).setName("Hangar") Partition_2.result().subResult(0).setColor(170, 0, 0) @@ -300,11 +388,12 @@ Partition_2.result().subResult(5).setName("Poteau_2") Partition_2.result().subResult(6).setName("Poteau_3") Partition_2.result().subResult(7).setName("Poteau_4") -file_name = model.getTmpFileName('teststep1', '.stp') +file_name = model.getTmpFileName("teststep1", ".stp") ### Export to STEP format -Export_1 = model.exportToFile(Part_1_doc, file_name, - [model.selection("COMPOUND", "Structure")]) +Export_1 = model.exportToFile( + Part_1_doc, file_name, [model.selection("COMPOUND", "Structure")] +) ### Import from step Import_1 = model.addImportSTEP(Part_1_doc, file_name, True, True, True) @@ -313,18 +402,20 @@ model.end() # Check the imported names and colors correspond to the exported ones res = Import_1.result() -assert(file_name.find(res.name()[:-3]) > 0) # the higher level compound name equals to the file name -assert(res.subResult(0).name() == "Hangar") -assert(res.subResult(1).name() == "Mur_1") -assert(res.subResult(2).name() == "Mur_2") -assert(res.subResult(3).name() == "Mur_3") -assert(res.subResult(4).name() == "Poteau_1") -assert(res.subResult(5).name() == "Poteau_2") -assert(res.subResult(6).name() == "Poteau_3") -assert(res.subResult(7).name() == "Poteau_4") +assert ( + file_name.find(res.name()[:-3]) > 0 +) # the higher level compound name equals to the file name +assert res.subResult(0).name() == "Hangar" +assert res.subResult(1).name() == "Mur_1" +assert res.subResult(2).name() == "Mur_2" +assert res.subResult(3).name() == "Mur_3" +assert res.subResult(4).name() == "Poteau_1" +assert res.subResult(5).name() == "Poteau_2" +assert res.subResult(6).name() == "Poteau_3" +assert res.subResult(7).name() == "Poteau_4" # get color of "Hangar": 3 components in the array attribute hangarBody = model.modelAPI_ResultBody(Import_1.feature().firstResult()).subResult(0) -assert(hangarBody.data().intArray("Color").size() == 3) -assert(hangarBody.data().intArray("Color").value(0) == 170) -assert(hangarBody.data().intArray("Color").value(1) == 0) -assert(hangarBody.data().intArray("Color").value(2) == 0) +assert hangarBody.data().intArray("Color").size() == 3 +assert hangarBody.data().intArray("Color").value(0) == 170 +assert hangarBody.data().intArray("Color").value(1) == 0 +assert hangarBody.data().intArray("Color").value(2) == 0 diff --git a/src/ExchangePlugin/Test/TestStep2.py b/src/ExchangePlugin/Test/TestStep2.py index a2fbe8c0f..2941578f2 100644 --- a/src/ExchangePlugin/Test/TestStep2.py +++ b/src/ExchangePlugin/Test/TestStep2.py @@ -29,31 +29,41 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() ### Import from step data_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data") -#data_dir = os.path.join(os.path.dirname(os.path.abspath("C:\\NewGEOM\\SALOME-9.8.0D\\MODULES\\SRC\\SHAPER_SRC\\src\\ExchangePlugin\\Test\\TestStep2.py")), "data") -Import_1 = model.addImportSTEP(Part_1_doc, os.path.join(data_dir, "pipe_with_colors_and_names.stp"), True, True, True) +# data_dir = os.path.join(os.path.dirname(os.path.abspath("C:\\NewGEOM\\SALOME-9.8.0D\\MODULES\\SRC\\SHAPER_SRC\\src\\ExchangePlugin\\Test\\TestStep2.py")), "data") +Import_1 = model.addImportSTEP( + Part_1_doc, + os.path.join(data_dir, "pipe_with_colors_and_names.stp"), + True, + True, + True, +) model.end() + def checkColor(body, rComponent, gComponent, bComponent): - assert(body.data().intArray("Color").size() == 3) - assert(body.data().intArray("Color").value(0) == rComponent) - assert(body.data().intArray("Color").value(1) == gComponent) - assert(body.data().intArray("Color").value(2) == bComponent) + assert body.data().intArray("Color").size() == 3 + assert body.data().intArray("Color").value(0) == rComponent + assert body.data().intArray("Color").value(1) == gComponent + assert body.data().intArray("Color").value(2) == bComponent + # Check the imported names and colors correspond to the exported ones res = Import_1.result() -assert(res.name() == "pipe_with_colors_and_names_1") # the higher level compound name equals to the file name -assert(res.subResult(0).name() == "2WCL-2.0-316-7-01") -assert(res.subResult(1).name() == "2WCL-2.0-316-7-01__1") -assert(res.subResult(2).name() == "2WCL-2.0-316-7-01__2") -assert(res.subResult(3).name() == "B7WWW-2.0-304-7-01") -assert(res.subResult(4).name() == "B7WWW-2.0-304-7-01__1") -assert(res.subResult(5).name() == "2WCL-2.0-316-7-01__3") -assert(res.subResult(6).name() == "RNT-304-2.000-0.065-WL-7_oa_0") -assert(res.subResult(7).name() == "RNT-304-2.000-0.065-WL-7_oa_1") -assert(res.subResult(8).name() == "RNT-304-2.000-0.065-WL-7_oa_2") -assert(res.subResult(9).name() == "RNT-304-2.000-0.065-WL-7_oa_3") -assert(res.subResult(10).name() == "RNT-304-2.000-0.065-WL-7_oa_4") +assert ( + res.name() == "pipe_with_colors_and_names_1" +) # the higher level compound name equals to the file name +assert res.subResult(0).name() == "2WCL-2.0-316-7-01" +assert res.subResult(1).name() == "2WCL-2.0-316-7-01__1" +assert res.subResult(2).name() == "2WCL-2.0-316-7-01__2" +assert res.subResult(3).name() == "B7WWW-2.0-304-7-01" +assert res.subResult(4).name() == "B7WWW-2.0-304-7-01__1" +assert res.subResult(5).name() == "2WCL-2.0-316-7-01__3" +assert res.subResult(6).name() == "RNT-304-2.000-0.065-WL-7_oa_0" +assert res.subResult(7).name() == "RNT-304-2.000-0.065-WL-7_oa_1" +assert res.subResult(8).name() == "RNT-304-2.000-0.065-WL-7_oa_2" +assert res.subResult(9).name() == "RNT-304-2.000-0.065-WL-7_oa_3" +assert res.subResult(10).name() == "RNT-304-2.000-0.065-WL-7_oa_4" rootBody = model.modelAPI_ResultBody(Import_1.feature().firstResult()) checkColor(rootBody.subResult(0), 153, 33, 0) checkColor(rootBody.subResult(1), 153, 33, 0) diff --git a/src/ExchangePlugin/Test/testme.py b/src/ExchangePlugin/Test/testme.py index f47c59303..042853684 100755 --- a/src/ExchangePlugin/Test/testme.py +++ b/src/ExchangePlugin/Test/testme.py @@ -24,12 +24,25 @@ import subprocess testTimeout = 600 + class SalomeSession(object): def __init__(self, script): isOk = True - proc = subprocess.Popen(["runSalome.py", "--modules", "SHAPER,GEOM,SHAPERSTUDY", "--gui", "--splash", "0", script], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + proc = subprocess.Popen( + [ + "runSalome.py", + "--modules", + "SHAPER,GEOM,SHAPERSTUDY", + "--gui", + "--splash", + "0", + script, + ], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + ) try: - out, err = proc.communicate(timeout = testTimeout) + out, err = proc.communicate(timeout=testTimeout) except TimeoutExpired: isOk = False proc.kill() @@ -43,33 +56,38 @@ class SalomeSession(object): # # import runSalome # # run_script = "runSalome.py" # # if sys.platform == 'win32': - # # module_dir = os.getenv("KERNEL_ROOT_DIR") - # # if module_dir: run_script = os.path.join(module_dir, "bin", "salome", run_script) - # # pass + # # module_dir = os.getenv("KERNEL_ROOT_DIR") + # # if module_dir: run_script = os.path.join(module_dir, "bin", "salome", run_script) + # # pass # # sys.argv = [run_script] # # sys.argv += ["--gui"] # # sys.argv += ["--splash=0"] # # sys.argv += ["--modules=SHAPER,GEOM,SHAPERSTUDY,SMESH"] # # sys.argv += ["%s" % script] # # if sys.platform == 'win32': - # # main_module_path = sys.modules['__main__'].__file__ - # # sys.modules['__main__'].__file__ = '' + # # main_module_path = sys.modules['__main__'].__file__ + # # sys.modules['__main__'].__file__ = '' # # clt, d = runSalome.main() # # if sys.platform == 'win32': - # # sys.modules['__main__'].__file__ = main_module_path + # # sys.modules['__main__'].__file__ = main_module_path return def __del__(self): - port = os.getenv('NSPORT') + port = os.getenv("NSPORT") import killSalomeWithPort + if port: - killSalomeWithPort.killMyPort(port) + killSalomeWithPort.killMyPort(port) return + pass + class MyTest(unittest.TestCase): def testFunction(self): SalomeSession(sys.argv[1]) + pass + unittest.main(argv=sys.argv[:1]) diff --git a/src/ExchangePlugin/doc/examples/export.py b/src/ExchangePlugin/doc/examples/export.py index 2a807f263..45632e344 100644 --- a/src/ExchangePlugin/doc/examples/export.py +++ b/src/ExchangePlugin/doc/examples/export.py @@ -1,5 +1,5 @@ from salome.shaper import model -import os +import os model.begin() file_path = os.path.join(os.getenv("DATA_DIR"), "test.step") @@ -7,11 +7,13 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Export_1 = model.exportToFile(Part_1_doc, file_path, - [model.selection("SOLID", "Box_1_1")]) +Export_1 = model.exportToFile( + Part_1_doc, file_path, [model.selection("SOLID", "Box_1_1")] +) file_xao = os.path.join(os.getenv("DATA_DIR"), "test.xao") -Export_2 = model.exportToXAO(Part_1_doc, file_xao, - model.selection("SOLID", "Box_1_1"), "author", "box") +Export_2 = model.exportToXAO( + Part_1_doc, file_xao, model.selection("SOLID", "Box_1_1"), "author", "box" +) model.do() model.end() diff --git a/src/ExchangePlugin/doc/examples/exportSTL.py b/src/ExchangePlugin/doc/examples/exportSTL.py index a152c4a2e..ef9efbcbd 100644 --- a/src/ExchangePlugin/doc/examples/exportSTL.py +++ b/src/ExchangePlugin/doc/examples/exportSTL.py @@ -7,7 +7,8 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Export_1 = model.exportToSTL(Part_1_doc, file_path, - model.selection("SOLID", "Box_1_1"),0.0001,0.5,True,False) +Export_1 = model.exportToSTL( + Part_1_doc, file_path, model.selection("SOLID", "Box_1_1"), 0.0001, 0.5, True, False +) model.do() model.end() diff --git a/src/ExchangePlugin/doc/examples/export_part.py b/src/ExchangePlugin/doc/examples/export_part.py index 72dc439b4..55a607fca 100644 --- a/src/ExchangePlugin/doc/examples/export_part.py +++ b/src/ExchangePlugin/doc/examples/export_part.py @@ -4,7 +4,15 @@ 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) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Export_1 = model.exportPart(Part_1_doc, "~/box.shaperpart", [model.selection("SOLID", "Box_1_1")]) +Export_1 = model.exportPart( + Part_1_doc, "~/box.shaperpart", [model.selection("SOLID", "Box_1_1")] +) model.end() diff --git a/src/ExchangePlugin/doc/examples/importStep.py b/src/ExchangePlugin/doc/examples/importStep.py index 0adc73a7a..2f3ea5142 100644 --- a/src/ExchangePlugin/doc/examples/importStep.py +++ b/src/ExchangePlugin/doc/examples/importStep.py @@ -2,10 +2,12 @@ from salome.shaper import model import os model.begin() -file_path = os.path.join(os.getenv("DATA_DIR"),"Shapes","Step","black_and_white.step") +file_path = os.path.join( + os.getenv("DATA_DIR"), "Shapes", "Step", "black_and_white.step" +) partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Import_1 = model.addImportSTEP(Part_1_doc,file_path, True, True, True) +Import_1 = model.addImportSTEP(Part_1_doc, file_path, True, True, True) model.do() model.end() diff --git a/src/FeaturesPlugin/Test/Test1379.py b/src/FeaturesPlugin/Test/Test1379.py index 5c3b2a1a7..2d49cac95 100644 --- a/src/FeaturesPlugin/Test/Test1379.py +++ b/src/FeaturesPlugin/Test/Test1379.py @@ -26,84 +26,144 @@ 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-35) +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) SketchLine_3 = SketchProjection_2.createdFeature() SketchLine_3.setName("SketchLine_10") SketchLine_3.result().setName("SketchLine_10") -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.result()) +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-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()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_13") -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_3.result() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_14") SketchLine_5 = Sketch_1.addLine(0.005, 0, 0.005, 0.02) SketchLine_5.setName("SketchLine_12") SketchLine_5.result().setName("SketchLine_12") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_15") SketchLine_6 = Sketch_1.addLine(0.005, 0.02, 0, 0.02) SketchLine_6.setName("SketchLine_13") SketchLine_6.result().setName("SketchLine_13") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_16") 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.00000000000001) +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") SketchLine_7 = Sketch_1.addLine(0.008, 0.0005000000000000006, 0.008, 0.03) SketchLine_7.setName("SketchLine_7") SketchLine_7.result().setName("SketchLine_7") -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_7.startPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_6") SketchLine_8 = Sketch_1.addLine(0.008, 0.03, 0.007500000000000001, 0.03) SketchLine_8.setName("SketchLine_8") SketchLine_8.result().setName("SketchLine_8") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_7") -SketchArc_1 = Sketch_1.addArc(0.007500000000000001, 0.031, 0.007500000000000001, 0.03, 0.006500000000000001, 0.031, True) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchArc_1.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 0.007500000000000001, + 0.031, + 0.007500000000000001, + 0.03, + 0.006500000000000001, + 0.031, + True, +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchArc_1.startPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_8") -SketchLine_9 = Sketch_1.addLine(0.006500000000000001, 0.031, 0.006500000000000001, 0.032) +SketchLine_9 = Sketch_1.addLine( + 0.006500000000000001, 0.031, 0.006500000000000001, 0.032 +) SketchLine_9.setName("SketchLine_14") SketchLine_9.result().setName("SketchLine_14") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_9.startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_9") -SketchArc_2 = Sketch_1.addArc(0.007500000000000001, 0.032, 0.006500000000000001, 0.032, 0.007500000000000001, 0.033, True) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchArc_2.startPoint()) +SketchArc_2 = Sketch_1.addArc( + 0.007500000000000001, + 0.032, + 0.006500000000000001, + 0.032, + 0.007500000000000001, + 0.033, + True, +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchArc_2.startPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_10") -SketchLine_10 = Sketch_1.addLine(0.007500000000000001, 0.033, 0.008999999999999999, 0.033) +SketchLine_10 = Sketch_1.addLine( + 0.007500000000000001, 0.033, 0.008999999999999999, 0.033 +) SketchLine_10.setName("SketchLine_15") SketchLine_10.result().setName("SketchLine_15") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_10.startPoint() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_11") -SketchLine_11 = Sketch_1.addLine(0.008999999999999999, 0.033, 0.008999999999999999, 0.042) +SketchLine_11 = Sketch_1.addLine( + 0.008999999999999999, 0.033, 0.008999999999999999, 0.042 +) SketchLine_11.setName("SketchLine_16") SketchLine_11.result().setName("SketchLine_16") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +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-36, 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 = 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 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_1.result() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_19") 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()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_20") -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_13.endPoint()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_13.endPoint() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_21") SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_12.result()) SketchConstraintHorizontal_2.setName("SketchConstraintHorizontal_2") @@ -117,81 +177,185 @@ SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintVertical_3.setName("SketchConstraintVertical_4") SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintVertical_4.setName("SketchConstraintVertical_5") -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_9.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_9.result()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchLine_10.result(), SketchArc_2.results()[1]) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_8.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_1.result(), 0.008, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_4.startPoint(), SketchLine_7.result(), 0.0005, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_9.endPoint(), SketchLine_13.result(), 0.0065, True) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_9.result() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_9.result() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchLine_10.result(), SketchArc_2.results()[1] +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_8.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_2.startPoint(), SketchLine_1.result(), 0.008, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_4.startPoint(), SketchLine_7.result(), 0.0005, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_9.endPoint(), SketchLine_13.result(), 0.0065, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 0.001) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 0.001) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchArc_2.endPoint(), SketchArc_1.startPoint(), 0.003, True) -SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_11.result(), 0.008999999999999999) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchArc_2.endPoint(), SketchArc_1.startPoint(), 0.003, True +) +SketchConstraintLength_3 = Sketch_1.setLength( + SketchLine_11.result(), 0.008999999999999999 +) SketchConstraintLength_3.setName("SketchConstraintLength_3") -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_13.startPoint(), SketchLine_3.result(), 0.042, True) -SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_12.result(), 0.008999999999999999) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_13.startPoint(), SketchLine_3.result(), 0.042, True +) +SketchConstraintLength_4 = Sketch_1.setLength( + SketchLine_12.result(), 0.008999999999999999 +) SketchConstraintLength_4.setName("SketchConstraintLength_5") -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_1.result() +) 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_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) +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-36, 0.042, 5.172728347136208e-22, 0.03963932022500211) -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Sketch_1/SketchLine_17_EndVertex"), 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/SketchLine_18"), False) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchPoint_1.result() +) +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-22, 0.03963932022500211, 0.02, 0.032, False) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchArc_3.startPoint()) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.result() +) +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()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchArc_3.endPoint(), SketchLine_16.startPoint() +) SketchLine_17 = Sketch_2.addLine(0.02, 0.042, 0, 0.042) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchLine_17.endPoint()) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchLine_17.endPoint() +) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_17.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_16.result()) SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_3.results()[1], 0.03) SketchConstraintLength_5 = Sketch_2.setLength(SketchLine_17.result(), 0.02) -SketchConstraintDistance_6 = Sketch_2.setDistance(SketchLine_14.result(), SketchArc_3.center(), 0.02, True) -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintDistance_6 = Sketch_2.setDistance( + SketchLine_14.result(), SketchArc_3.center(), 0.02, True +) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_18 = SketchProjection_5.createdFeature() -SketchConstraintDistance_7 = Sketch_2.setDistance(SketchLine_18.result(), SketchArc_3.center(), 0.062, True) +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_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&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")]) +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&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) SketchLine_19.setName("SketchLine_7") SketchLine_19.result().setName("SketchLine_7") -SketchLine_20 = Sketch_3.addLine(0.029, 0.03267384683690003, 0.008999999999999999, 0.042) +SketchLine_20 = Sketch_3.addLine( + 0.029, 0.03267384683690003, 0.008999999999999999, 0.042 +) SketchLine_20.setName("SketchLine_8") SketchLine_20.result().setName("SketchLine_8") -SketchConstraintCoincidence_24 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_24 = Sketch_3.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_8") 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/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") -SketchConstraintCoincidence_25 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_22.result()) +SketchConstraintCoincidence_25 = Sketch_3.setCoincident( + SketchLine_21.startPoint(), SketchLine_22.result() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_9") -SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchLine_19.startPoint(), SketchLine_21.endPoint()) +SketchConstraintCoincidence_26 = Sketch_3.setCoincident( + SketchLine_19.startPoint(), SketchLine_21.endPoint() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_10") -SketchConstraintCoincidence_27 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_20.endPoint()) +SketchConstraintCoincidence_27 = Sketch_3.setCoincident( + SketchLine_21.startPoint(), SketchLine_20.endPoint() +) 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/SketchLine_16_EndVertex"), False) +SketchConstraintAngle_2 = Sketch_3.setAngle( + SketchLine_20.result(), SketchLine_21.result(), 25 +) +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) @@ -199,6 +363,6 @@ model.do() model.end() # check that result was created -assert(RevolutionCut_1.feature().results().size() == 1) +assert RevolutionCut_1.feature().results().size() == 1 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test1467.py b/src/FeaturesPlugin/Test/Test1467.py index 5a0523037..cb27099ef 100644 --- a/src/FeaturesPlugin/Test/Test1467.py +++ b/src/FeaturesPlugin/Test/Test1467.py @@ -31,63 +31,131 @@ Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "PartSet/Origi Vertex_3 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_2")]) Vertex_4 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_3")]) Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) -SketchLine_1 = Sketch_1.addLine(14.65001594578831, -16.75950688440132, 21.53989436538019, 4.084511469683225) +SketchLine_1 = Sketch_1.addLine( + 14.65001594578831, -16.75950688440132, 21.53989436538019, 4.084511469683225 +) SketchLine_1.setName("SketchLine_2") SketchLine_1.result().setName("SketchLine_1") -SketchLine_2 = Sketch_1.addLine(21.53989436538019, 4.084511469683225, 17.92440575878417, 20.67042582762886) +SketchLine_2 = Sketch_1.addLine( + 21.53989436538019, 4.084511469683225, 17.92440575878417, 20.67042582762886 +) SketchLine_2.setName("SketchLine_3") SketchLine_2.result().setName("SketchLine_3") -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_2") -SketchLine_3 = Sketch_1.addLine(17.92440575878417, 20.67042582762886, 6.041293582700577, 31.26820121140768) +SketchLine_3 = Sketch_1.addLine( + 17.92440575878417, 20.67042582762886, 6.041293582700577, 31.26820121140768 +) SketchLine_3.setName("SketchLine_4") SketchLine_3.result().setName("SketchLine_4") -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3") -SketchArc_1 = Sketch_1.addArc(15.73021805614924, 42.13223372900752, 6.041293582700577, 31.26820121140768, 1.302016307518145, 40.2010542198842, True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.endPoint()) +SketchArc_1 = Sketch_1.addArc( + 15.73021805614924, + 42.13223372900752, + 6.041293582700577, + 31.26820121140768, + 1.302016307518145, + 40.2010542198842, + True, +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_3.endPoint() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_4") -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_3.result()) -SketchArc_2 = Sketch_1.addArc(5.884297127208473, -13.86204556507233, 14.65001594578831, -16.75950688440132, -3.31891814825968, -14.59275556007859, True) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_1.startPoint()) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_3.result() +) +SketchArc_2 = Sketch_1.addArc( + 5.884297127208473, + -13.86204556507233, + 14.65001594578831, + -16.75950688440132, + -3.31891814825968, + -14.59275556007859, + True, +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_1.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_9") -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_1.result()) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_1.result() +) 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/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_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) +SketchLine_4 = Sketch_2.addLine( + 9.525599451781, 2.539525405208, -21.231656152164, 2.539525405208 +) SketchLine_4.setName("SketchLine_5") SketchLine_4.result().setName("SketchLine_5") -SketchLine_5 = Sketch_2.addLine(-21.231656152164, 2.539525405208, -21.231656152164, -7.57049842757) +SketchLine_5 = Sketch_2.addLine( + -21.231656152164, 2.539525405208, -21.231656152164, -7.57049842757 +) SketchLine_5.setName("SketchLine_6") SketchLine_5.result().setName("SketchLine_6") -SketchLine_6 = Sketch_2.addLine(-21.231656152164, -7.57049842757, 9.525599451781, -7.57049842757) +SketchLine_6 = Sketch_2.addLine( + -21.231656152164, -7.57049842757, 9.525599451781, -7.57049842757 +) SketchLine_6.setName("SketchLine_7") SketchLine_6.result().setName("SketchLine_7") -SketchLine_7 = Sketch_2.addLine(9.525599451781, -7.57049842757, 9.525599451781, 2.539525405208) +SketchLine_7 = Sketch_2.addLine( + 9.525599451781, -7.57049842757, 9.525599451781, 2.539525405208 +) SketchLine_7.setName("SketchLine_8") SketchLine_7.result().setName("SketchLine_8") -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_5") -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_6") -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_7") -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_8") SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_4.result()) 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() -Pipe_1 = model.addPipe(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("WIRE", "Wire_1_1")) -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")]) +Pipe_1 = model.addPipe( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_2")], + model.selection("WIRE", "Wire_1_1"), +) +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) +assert len(Cut_1.results()) == 0 diff --git a/src/FeaturesPlugin/Test/Test17000.py b/src/FeaturesPlugin/Test/Test17000.py index c1b5475a9..5c9d2b065 100644 --- a/src/FeaturesPlugin/Test/Test17000.py +++ b/src/FeaturesPlugin/Test/Test17000.py @@ -33,20 +33,36 @@ model.addParameter(Part_1_doc, "ep_dalles", "0.12") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(-0.375, 3.325, 0.275, 3.325) SketchLine_2 = Sketch_1.addLine(0.275, 3.325, 0.275, 0.325) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(0.275, 0.325, 3.625, 0.325) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(3.625, 0.325, 3.625, 1.325) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(3.625, 1.325, 4.275, 1.325) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(4.275, 1.325, 4.275, -0.325) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(4.275, -0.325, -0.375, -0.325) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(-0.375, -0.325, -0.375, 3.325) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_8.endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_2.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_4.result()) @@ -59,165 +75,513 @@ SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), "ep_base") SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_6.result(), 1.65) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_7.result(), 4.65) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_5.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_7.result(), "ep_base", True) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_5.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_7.result(), "ep_base", True +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_9 = SketchProjection_1.createdFeature() -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_9.result(), "0.275+ep_voiles/2", True) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_7.startPoint(), SketchLine_9.result(), "0.275+ep_voiles/2", True +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_10 = SketchProjection_2.createdFeature() -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_10.result(), "0.325+ep_voiles/2", True) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_10.result(), "0.325+ep_voiles/2", True +) 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(), 0, 0.3) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face")) +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(), + 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) SketchLine_14 = Sketch_2.addLine(2.26, -1.69, 2.26, -2.31) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_12.result()) SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_13.result()) SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_14.result()) -SketchConstraintEqual_2 = Sketch_2.setEqual(SketchLine_11.result(), SketchLine_12.result()) +SketchConstraintEqual_2 = Sketch_2.setEqual( + SketchLine_11.result(), SketchLine_12.result() +) SketchPoint_1 = Sketch_2.addPoint(1.925, -1.875) -SketchConstraintDistance_4 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_12.result(), "0.210+ep_poteau/2", True) -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_13.result(), "0.11+ep_poteau/2", True) +SketchConstraintDistance_4 = Sketch_2.setDistance( + SketchPoint_1.coordinates(), SketchLine_12.result(), "0.210+ep_poteau/2", True +) +SketchConstraintDistance_5 = Sketch_2.setDistance( + SketchPoint_1.coordinates(), SketchLine_13.result(), "0.11+ep_poteau/2", True +) SketchConstraintLength_5 = Sketch_2.setLength(SketchLine_11.result(), 0.62) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_15 = SketchProjection_3.createdFeature() -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_16 = SketchProjection_4.createdFeature() -SketchConstraintDistance_6 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_16.result(), "1.8+ep_poteau/2+ep_voiles/2", True) -SketchConstraintDistance_7 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_15.result(), "1.75+ep_poteau/2+ep_voiles/2", True) +SketchConstraintDistance_6 = Sketch_2.setDistance( + SketchPoint_1.coordinates(), + SketchLine_16.result(), + "1.8+ep_poteau/2+ep_voiles/2", + True, +) +SketchConstraintDistance_7 = Sketch_2.setDistance( + SketchPoint_1.coordinates(), + SketchLine_15.result(), + "1.75+ep_poteau/2+ep_voiles/2", + True, +) model.do() -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_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")) +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_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ), +) SketchLine_17 = Sketch_3.addLine(0, 2.95, 0, 1.7) -SketchProjection_5 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_5 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_18 = SketchProjection_5.createdFeature() -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_17.startPoint(), SketchLine_18.result()) -SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchLine_18.result()) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_17.startPoint(), SketchLine_18.result() +) +SketchConstraintCoincidence_14 = Sketch_3.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.result() +) SketchLine_19 = Sketch_3.addLine(0, 1.2, 0, 0) -SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_19.startPoint(), SketchLine_18.result()) -SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_18).startPoint(), SketchLine_19.endPoint()) +SketchConstraintCoincidence_15 = Sketch_3.setCoincident( + SketchLine_19.startPoint(), SketchLine_18.result() +) +SketchConstraintCoincidence_16 = Sketch_3.setCoincident( + SketchAPI_Line(SketchLine_18).startPoint(), SketchLine_19.endPoint() +) SketchLine_20 = Sketch_3.addLine(0, 0, 0.95, 0) -SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_18).startPoint(), SketchLine_20.startPoint()) -SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_17 = Sketch_3.setCoincident( + SketchAPI_Line(SketchLine_18).startPoint(), SketchLine_20.startPoint() +) +SketchProjection_6 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_21 = SketchProjection_6.createdFeature() -SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_21.result()) +SketchConstraintCoincidence_18 = Sketch_3.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.result() +) SketchLine_22 = Sketch_3.addLine(2.525, 0, 3.975, 0) -SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchLine_21.result()) -SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_21.result()) +SketchConstraintCoincidence_19 = Sketch_3.setCoincident( + SketchLine_22.startPoint(), SketchLine_21.result() +) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident( + SketchLine_22.endPoint(), SketchLine_21.result() +) SketchLine_23 = Sketch_3.addLine(3.975, 0, 3.975, 0.95) -SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) +SketchConstraintCoincidence_21 = Sketch_3.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.startPoint() +) SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_23.result()) SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_23.result(), "1-ep_voiles/2") SketchConstraintLength_7 = Sketch_3.setLength(SketchLine_22.result(), "1.5-ep_voiles/2") SketchConstraintLength_8 = Sketch_3.setLength(SketchLine_20.result(), "1-ep_voiles/2") -SketchConstraintLength_9 = Sketch_3.setLength(SketchLine_19.result(), "1.25-ep_voiles/2") +SketchConstraintLength_9 = Sketch_3.setLength( + SketchLine_19.result(), "1.25-ep_voiles/2" +) SketchConstraintLength_10 = Sketch_3.setLength(SketchLine_17.result(), 1.25) -SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"), False) +SketchProjection_7 = Sketch_3.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_24 = SketchProjection_7.createdFeature() -SketchConstraintDistance_8 = Sketch_3.setDistance(SketchLine_17.startPoint(), SketchLine_24.result(), 0.375, True) -SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_6"), False) +SketchConstraintDistance_8 = Sketch_3.setDistance( + SketchLine_17.startPoint(), SketchLine_24.result(), 0.375, True +) +SketchProjection_8 = Sketch_3.addProjection( + model.selection("EDGE", "Sketch_1/SketchLine_6"), False +) SketchLine_25 = SketchProjection_8.createdFeature() -SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_22.endPoint(), SketchLine_25.result(), "0.25+ep_voiles/2", True) +SketchConstraintDistance_9 = Sketch_3.setDistance( + SketchLine_22.endPoint(), SketchLine_25.result(), "0.25+ep_voiles/2", True +) model.do() -Edge_1_objects = [model.selection("EDGE", "Sketch_3/SketchLine_17"), model.selection("EDGE", "Sketch_3/SketchLine_19"), model.selection("EDGE", "Sketch_3/SketchLine_20"), model.selection("EDGE", "Sketch_3/SketchLine_22"), model.selection("EDGE", "Sketch_3/SketchLine_23")] +Edge_1_objects = [ + model.selection("EDGE", "Sketch_3/SketchLine_17"), + model.selection("EDGE", "Sketch_3/SketchLine_19"), + model.selection("EDGE", "Sketch_3/SketchLine_20"), + model.selection("EDGE", "Sketch_3/SketchLine_22"), + model.selection("EDGE", "Sketch_3/SketchLine_23"), +] Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects) -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Edge_1")], model.selection("EDGE", "PartSet/OZ"), "h_ouverture", 0) -Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_3_1_1/Generated_Edge&Sketch_3/SketchLine_17_StartVertex]e[Extrusion_3_1_1/To_Edge]e"), model.selection("VERTEX", "[Extrusion_3_1_3/Generated_Edge&Sketch_3/SketchLine_20_StartVertex]e[Extrusion_3_1_3/To_Edge]e"), model.selection("VERTEX", "[Extrusion_3_1_4/Generated_Edge&Sketch_3/SketchLine_22_EndVertex]e[Extrusion_3_1_4/To_Edge]e")) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Edge_1")], + model.selection("EDGE", "PartSet/OZ"), + "h_ouverture", + 0, +) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection( + "VERTEX", + "[Extrusion_3_1_1/Generated_Edge&Sketch_3/SketchLine_17_StartVertex]e[Extrusion_3_1_1/To_Edge]e", + ), + model.selection( + "VERTEX", + "[Extrusion_3_1_3/Generated_Edge&Sketch_3/SketchLine_20_StartVertex]e[Extrusion_3_1_3/To_Edge]e", + ), + model.selection( + "VERTEX", + "[Extrusion_3_1_4/Generated_Edge&Sketch_3/SketchLine_22_EndVertex]e[Extrusion_3_1_4/To_Edge]e", + ), +) Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) SketchLine_26 = Sketch_4.addLine(0, 2.95, 0, 0) -SketchProjection_9 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_3_1_1/Generated_Edge&Sketch_3/SketchLine_17_StartVertex]e[Extrusion_3_1_1/To_Edge]e"), False) +SketchProjection_9 = Sketch_4.addProjection( + model.selection( + "VERTEX", + "[Extrusion_3_1_1/Generated_Edge&Sketch_3/SketchLine_17_StartVertex]e[Extrusion_3_1_1/To_Edge]e", + ), + False, +) SketchPoint_2 = SketchProjection_9.createdFeature() -SketchConstraintCoincidence_22 = Sketch_4.setCoincident(SketchLine_26.startPoint(), SketchPoint_2.result()) -SketchProjection_10 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_3_1_3/Generated_Edge&Sketch_3/SketchLine_20_StartVertex]e[Extrusion_3_1_3/To_Edge]e"), False) +SketchConstraintCoincidence_22 = Sketch_4.setCoincident( + SketchLine_26.startPoint(), SketchPoint_2.result() +) +SketchProjection_10 = Sketch_4.addProjection( + model.selection( + "VERTEX", + "[Extrusion_3_1_3/Generated_Edge&Sketch_3/SketchLine_20_StartVertex]e[Extrusion_3_1_3/To_Edge]e", + ), + False, +) SketchPoint_3 = SketchProjection_10.createdFeature() -SketchConstraintCoincidence_23 = Sketch_4.setCoincident(SketchLine_26.endPoint(), SketchPoint_3.result()) +SketchConstraintCoincidence_23 = Sketch_4.setCoincident( + SketchLine_26.endPoint(), SketchPoint_3.result() +) SketchLine_27 = Sketch_4.addLine(0, 0, 3.975, 0) -SketchConstraintCoincidence_24 = Sketch_4.setCoincident(SketchLine_26.endPoint(), SketchLine_27.startPoint()) -SketchProjection_11 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_3_1_4/Generated_Edge&Sketch_3/SketchLine_22_EndVertex]e[Extrusion_3_1_4/To_Edge]e"), False) +SketchConstraintCoincidence_24 = Sketch_4.setCoincident( + SketchLine_26.endPoint(), SketchLine_27.startPoint() +) +SketchProjection_11 = Sketch_4.addProjection( + model.selection( + "VERTEX", + "[Extrusion_3_1_4/Generated_Edge&Sketch_3/SketchLine_22_EndVertex]e[Extrusion_3_1_4/To_Edge]e", + ), + False, +) SketchPoint_4 = SketchProjection_11.createdFeature() -SketchConstraintCoincidence_25 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchPoint_4.result()) +SketchConstraintCoincidence_25 = Sketch_4.setCoincident( + SketchLine_27.endPoint(), SketchPoint_4.result() +) SketchLine_28 = Sketch_4.addLine(3.975, 0, 3.975, 0.95) -SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchLine_28.startPoint()) -SketchProjection_12 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_3_1_5/Generated_Edge&Sketch_3/SketchLine_23_EndVertex]e[Extrusion_3_1_5/To_Edge]e"), False) +SketchConstraintCoincidence_26 = Sketch_4.setCoincident( + SketchLine_27.endPoint(), SketchLine_28.startPoint() +) +SketchProjection_12 = Sketch_4.addProjection( + model.selection( + "VERTEX", + "[Extrusion_3_1_5/Generated_Edge&Sketch_3/SketchLine_23_EndVertex]e[Extrusion_3_1_5/To_Edge]e", + ), + False, +) SketchPoint_5 = SketchProjection_12.createdFeature() -SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchLine_28.endPoint(), SketchPoint_5.result()) +SketchConstraintCoincidence_27 = Sketch_4.setCoincident( + SketchLine_28.endPoint(), SketchPoint_5.result() +) model.do() -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_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 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Edge_2")], 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_1/Generated_Edge&Sketch_4/SketchLine_26_StartVertex]e[Extrusion_4_1_1/To_Edge]e"), model.selection("VERTEX", "[Extrusion_4_1_1/Generated_Edge&Sketch_4/SketchLine_26_EndVertex]e[Extrusion_4_1_1/To_Edge]e"), model.selection("VERTEX", "[Extrusion_4_1_2/Generated_Edge&Sketch_4/SketchLine_27_EndVertex]e[Extrusion_4_1_2/To_Edge]e")) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Edge_2")], + 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_1/Generated_Edge&Sketch_4/SketchLine_26_StartVertex]e[Extrusion_4_1_1/To_Edge]e", + ), + model.selection( + "VERTEX", + "[Extrusion_4_1_1/Generated_Edge&Sketch_4/SketchLine_26_EndVertex]e[Extrusion_4_1_1/To_Edge]e", + ), + model.selection( + "VERTEX", + "[Extrusion_4_1_2/Generated_Edge&Sketch_4/SketchLine_27_EndVertex]e[Extrusion_4_1_2/To_Edge]e", + ), +) Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2")) SketchLine_29 = Sketch_5.addLine(0, 2.95, 0, 0) -SketchProjection_13 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_4_1_1/Generated_Edge&Sketch_4/SketchLine_26_StartVertex]e[Extrusion_4_1_1/To_Edge]e"), False) +SketchProjection_13 = Sketch_5.addProjection( + model.selection( + "VERTEX", + "[Extrusion_4_1_1/Generated_Edge&Sketch_4/SketchLine_26_StartVertex]e[Extrusion_4_1_1/To_Edge]e", + ), + False, +) SketchPoint_6 = SketchProjection_13.createdFeature() -SketchConstraintCoincidence_28 = Sketch_5.setCoincident(SketchLine_29.startPoint(), SketchPoint_6.result()) -SketchProjection_14 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_4_1_1/Generated_Edge&Sketch_4/SketchLine_26_EndVertex]e[Extrusion_4_1_1/To_Edge]e"), False) +SketchConstraintCoincidence_28 = Sketch_5.setCoincident( + SketchLine_29.startPoint(), SketchPoint_6.result() +) +SketchProjection_14 = Sketch_5.addProjection( + model.selection( + "VERTEX", + "[Extrusion_4_1_1/Generated_Edge&Sketch_4/SketchLine_26_EndVertex]e[Extrusion_4_1_1/To_Edge]e", + ), + False, +) SketchPoint_7 = SketchProjection_14.createdFeature() -SketchConstraintCoincidence_29 = Sketch_5.setCoincident(SketchLine_29.endPoint(), SketchPoint_7.result()) +SketchConstraintCoincidence_29 = Sketch_5.setCoincident( + SketchLine_29.endPoint(), SketchPoint_7.result() +) SketchLine_30 = Sketch_5.addLine(0, 0, 3.975, 0) -SketchConstraintCoincidence_30 = Sketch_5.setCoincident(SketchLine_29.endPoint(), SketchLine_30.startPoint()) -SketchProjection_15 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_4_1_2/Generated_Edge&Sketch_4/SketchLine_27_EndVertex]e[Extrusion_4_1_2/To_Edge]e"), False) +SketchConstraintCoincidence_30 = Sketch_5.setCoincident( + SketchLine_29.endPoint(), SketchLine_30.startPoint() +) +SketchProjection_15 = Sketch_5.addProjection( + model.selection( + "VERTEX", + "[Extrusion_4_1_2/Generated_Edge&Sketch_4/SketchLine_27_EndVertex]e[Extrusion_4_1_2/To_Edge]e", + ), + False, +) SketchPoint_8 = SketchProjection_15.createdFeature() -SketchConstraintCoincidence_31 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchPoint_8.result()) +SketchConstraintCoincidence_31 = Sketch_5.setCoincident( + SketchLine_30.endPoint(), SketchPoint_8.result() +) SketchLine_31 = Sketch_5.addLine(3.975, 0, 3.975, 0.95) -SketchConstraintCoincidence_32 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) -SketchProjection_16 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_4_1_3/Generated_Edge&Sketch_4/SketchLine_28_EndVertex]e[Extrusion_4_1_3/To_Edge]e"), False) +SketchConstraintCoincidence_32 = Sketch_5.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) +SketchProjection_16 = Sketch_5.addProjection( + model.selection( + "VERTEX", + "[Extrusion_4_1_3/Generated_Edge&Sketch_4/SketchLine_28_EndVertex]e[Extrusion_4_1_3/To_Edge]e", + ), + False, +) SketchPoint_9 = SketchProjection_16.createdFeature() -SketchConstraintCoincidence_33 = Sketch_5.setCoincident(SketchLine_31.endPoint(), SketchPoint_9.result()) +SketchConstraintCoincidence_33 = Sketch_5.setCoincident( + SketchLine_31.endPoint(), SketchPoint_9.result() +) SketchLine_32 = Sketch_5.addLine(3.975, 0.95, 0, 2.95) -SketchConstraintCoincidence_34 = Sketch_5.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) -SketchConstraintCoincidence_35 = Sketch_5.setCoincident(SketchLine_29.startPoint(), SketchLine_32.endPoint()) +SketchConstraintCoincidence_34 = Sketch_5.setCoincident( + SketchLine_31.endPoint(), SketchLine_32.startPoint() +) +SketchConstraintCoincidence_35 = Sketch_5.setCoincident( + SketchLine_29.startPoint(), SketchLine_32.endPoint() +) SketchLine_33 = Sketch_5.addLine(1.85, 2.019182389937107, 1.85, 0) -SketchConstraintCoincidence_36 = Sketch_5.setCoincident(SketchLine_33.startPoint(), SketchLine_32.result()) -SketchConstraintCoincidence_37 = Sketch_5.setCoincident(SketchLine_33.endPoint(), SketchLine_30.result()) +SketchConstraintCoincidence_36 = Sketch_5.setCoincident( + SketchLine_33.startPoint(), SketchLine_32.result() +) +SketchConstraintCoincidence_37 = Sketch_5.setCoincident( + SketchLine_33.endPoint(), SketchLine_30.result() +) SketchLine_34 = Sketch_5.addLine(2.075, 1.905974842767296, 2.075, 0) -SketchConstraintCoincidence_38 = Sketch_5.setCoincident(SketchLine_34.startPoint(), SketchLine_32.result()) -SketchConstraintCoincidence_39 = Sketch_5.setCoincident(SketchLine_34.endPoint(), SketchLine_30.result()) +SketchConstraintCoincidence_38 = Sketch_5.setCoincident( + SketchLine_34.startPoint(), SketchLine_32.result() +) +SketchConstraintCoincidence_39 = Sketch_5.setCoincident( + SketchLine_34.endPoint(), SketchLine_30.result() +) SketchConstraintVertical_8 = Sketch_5.setVertical(SketchLine_33.result()) SketchConstraintVertical_9 = Sketch_5.setVertical(SketchLine_34.result()) -SketchConstraintDistance_10 = Sketch_5.setDistance(SketchLine_33.startPoint(), SketchLine_29.result(), 1.85, True) -SketchConstraintDistance_11 = Sketch_5.setDistance(SketchLine_34.startPoint(), SketchLine_31.result(), 1.9, True) +SketchConstraintDistance_10 = Sketch_5.setDistance( + SketchLine_33.startPoint(), SketchLine_29.result(), 1.85, True +) +SketchConstraintDistance_11 = Sketch_5.setDistance( + SketchLine_34.startPoint(), SketchLine_31.result(), 1.9, True +) model.do() -Face_1_objects = [model.selection("FACE", "Sketch_5/Face-SketchLine_29r-SketchLine_30f-SketchLine_33r-SketchLine_32f"), model.selection("FACE", "Sketch_5/Face-SketchLine_30f-SketchLine_34r-SketchLine_32f-SketchLine_33f"), model.selection("FACE", "Sketch_5/Face-SketchLine_30f-SketchLine_31f-SketchLine_32f-SketchLine_34f")] +Face_1_objects = [ + model.selection( + "FACE", + "Sketch_5/Face-SketchLine_29r-SketchLine_30f-SketchLine_33r-SketchLine_32f", + ), + model.selection( + "FACE", + "Sketch_5/Face-SketchLine_30f-SketchLine_34r-SketchLine_32f-SketchLine_33f", + ), + model.selection( + "FACE", + "Sketch_5/Face-SketchLine_30f-SketchLine_31f-SketchLine_32f-SketchLine_34f", + ), +] Face_1 = model.addFace(Part_1_doc, Face_1_objects) -LinearCopy_1_objects = [model.selection("COMPOUND", "Extrusion_3_1"), model.selection("COMPOUND", "Extrusion_4_1"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_1_2"), model.selection("FACE", "Face_1_3")] -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, LinearCopy_1_objects, model.selection("EDGE", "PartSet/OZ"), "h_ouverture+h_apres_ouverture-ep_dalles/2", 3) -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", "LinearCopy_1_3_3"), 0, model.selection("FACE", "Sketch_2/Face-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r"), 0) -Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("EDGE", "Extrusion_5_1"), model.selection("COMPOUND", "LinearCopy_1_1"), model.selection("COMPOUND", "LinearCopy_1_2"), model.selection("COMPOUND", "LinearCopy_1_3"), model.selection("COMPOUND", "LinearCopy_1_4"), model.selection("COMPOUND", "LinearCopy_1_5")] +LinearCopy_1_objects = [ + model.selection("COMPOUND", "Extrusion_3_1"), + model.selection("COMPOUND", "Extrusion_4_1"), + model.selection("FACE", "Face_1_1"), + model.selection("FACE", "Face_1_2"), + model.selection("FACE", "Face_1_3"), +] +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + LinearCopy_1_objects, + model.selection("EDGE", "PartSet/OZ"), + "h_ouverture+h_apres_ouverture-ep_dalles/2", + 3, +) +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", "LinearCopy_1_3_3"), + 0, + model.selection( + "FACE", + "Sketch_2/Face-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r", + ), + 0, +) +Partition_1_objects = [ + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_2_1"), + model.selection("EDGE", "Extrusion_5_1"), + model.selection("COMPOUND", "LinearCopy_1_1"), + model.selection("COMPOUND", "LinearCopy_1_2"), + model.selection("COMPOUND", "LinearCopy_1_3"), + model.selection("COMPOUND", "LinearCopy_1_4"), + model.selection("COMPOUND", "LinearCopy_1_5"), +] Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects) -Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Partition_1_1_2")]) +Group_1 = model.addGroup( + Part_1_doc, + [ + model.selection("SOLID", "Partition_1_1_1"), + model.selection("SOLID", "Partition_1_1_2"), + ], +) Group_1.setName("base") Group_1.result().setName("base") Group_1.result().setColor(170, 0, 0) -Group_2_objects = [model.selection("EDGE", "Partition_1_1_2/Modified_Edge&Sketch_2/SketchPoint_1"), model.selection("EDGE", "Partition_1_1_3"), model.selection("EDGE", "Partition_1_1_4"), model.selection("EDGE", "Partition_1_1_5")] +Group_2_objects = [ + model.selection("EDGE", "Partition_1_1_2/Modified_Edge&Sketch_2/SketchPoint_1"), + model.selection("EDGE", "Partition_1_1_3"), + model.selection("EDGE", "Partition_1_1_4"), + model.selection("EDGE", "Partition_1_1_5"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) Group_2.setName("poteau") Group_2.result().setName("poteau") Group_2.result().setColor(0, 170, 0) -Group_3_objects = [model.selection("FACE", "Partition_1_1_38"), model.selection("FACE", "Partition_1_1_32"), model.selection("FACE", "Partition_1_1_37"), model.selection("FACE", "Partition_1_1_31"), model.selection("FACE", "Partition_1_1_36"), model.selection("FACE", "Partition_1_1_30")] +Group_3_objects = [ + model.selection("FACE", "Partition_1_1_38"), + model.selection("FACE", "Partition_1_1_32"), + model.selection("FACE", "Partition_1_1_37"), + model.selection("FACE", "Partition_1_1_31"), + model.selection("FACE", "Partition_1_1_36"), + model.selection("FACE", "Partition_1_1_30"), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) Group_3.setName("dalles") Group_3.result().setName("dalles") Group_3.result().setColor(97, 97, 116) -Group_4_objects = [model.selection("FACE", "Partition_1_1_29"), model.selection("FACE", "Partition_1_1_20"), model.selection("FACE", "Partition_1_1_26"), model.selection("FACE", "Partition_1_1_15"), model.selection("FACE", "Partition_1_1_23"), model.selection("FACE", "Partition_1_1_10"), model.selection("FACE", "Partition_1_1_7"), model.selection("FACE", "Partition_1_1_21"), model.selection("FACE", "Partition_1_1_6"), model.selection("FACE", "Partition_1_1_12"), model.selection("FACE", "Partition_1_1_24"), model.selection("FACE", "Partition_1_1_11"), model.selection("FACE", "Partition_1_1_17"), model.selection("FACE", "Partition_1_1_27"), model.selection("FACE", "Partition_1_1_16"), model.selection("FACE", "Partition_1_1_28"), model.selection("FACE", "Partition_1_1_18"), model.selection("FACE", "Partition_1_1_19"), model.selection("FACE", "Partition_1_1_25"), model.selection("FACE", "Partition_1_1_13"), model.selection("FACE", "Partition_1_1_14"), model.selection("FACE", "Partition_1_1_22"), model.selection("FACE", "Partition_1_1_8"), model.selection("FACE", "Partition_1_1_9")] +Group_4_objects = [ + model.selection("FACE", "Partition_1_1_29"), + model.selection("FACE", "Partition_1_1_20"), + model.selection("FACE", "Partition_1_1_26"), + model.selection("FACE", "Partition_1_1_15"), + model.selection("FACE", "Partition_1_1_23"), + model.selection("FACE", "Partition_1_1_10"), + model.selection("FACE", "Partition_1_1_7"), + model.selection("FACE", "Partition_1_1_21"), + model.selection("FACE", "Partition_1_1_6"), + model.selection("FACE", "Partition_1_1_12"), + model.selection("FACE", "Partition_1_1_24"), + model.selection("FACE", "Partition_1_1_11"), + model.selection("FACE", "Partition_1_1_17"), + model.selection("FACE", "Partition_1_1_27"), + model.selection("FACE", "Partition_1_1_16"), + model.selection("FACE", "Partition_1_1_28"), + model.selection("FACE", "Partition_1_1_18"), + model.selection("FACE", "Partition_1_1_19"), + model.selection("FACE", "Partition_1_1_25"), + model.selection("FACE", "Partition_1_1_13"), + model.selection("FACE", "Partition_1_1_14"), + model.selection("FACE", "Partition_1_1_22"), + model.selection("FACE", "Partition_1_1_8"), + model.selection("FACE", "Partition_1_1_9"), +] Group_4 = model.addGroup(Part_1_doc, Group_4_objects) Group_4.setName("voiles") Group_4.result().setName("voiles") -Group_5_objects = [model.selection("FACE", "Partition_1_1_35"), model.selection("FACE", "Partition_1_1_34"), model.selection("FACE", "Partition_1_1_33")] +Group_5_objects = [ + model.selection("FACE", "Partition_1_1_35"), + model.selection("FACE", "Partition_1_1_34"), + model.selection("FACE", "Partition_1_1_33"), +] Group_5 = model.addGroup(Part_1_doc, Group_5_objects) Group_5.setName("poutre_centrale") Group_5.result().setName("poutre_centrale") Group_5.result().setColor(0, 85, 255) -Group_6_objects = [model.selection("EDGE", "Partition_1_1_38/Modified_Edge&Sketch_5/SketchLine_32"), model.selection("EDGE", "Partition_1_1_35/Modified_Edge&Sketch_5/SketchLine_32"), model.selection("EDGE", "Partition_1_1_32/Modified_Edge&Sketch_5/SketchLine_32"), model.selection("EDGE", "Partition_1_1_37/Modified_Edge&Sketch_5/SketchLine_32"), model.selection("EDGE", "Partition_1_1_34/Modified_Edge&Sketch_5/SketchLine_32"), model.selection("EDGE", "Partition_1_1_31/Modified_Edge&Sketch_5/SketchLine_32"), model.selection("EDGE", "Partition_1_1_36/Modified_Edge&Sketch_5/SketchLine_32"), model.selection("EDGE", "Partition_1_1_33/Modified_Edge&Sketch_5/SketchLine_32"), model.selection("EDGE", "Partition_1_1_30/Modified_Edge&Sketch_5/SketchLine_32")] +Group_6_objects = [ + model.selection("EDGE", "Partition_1_1_38/Modified_Edge&Sketch_5/SketchLine_32"), + model.selection("EDGE", "Partition_1_1_35/Modified_Edge&Sketch_5/SketchLine_32"), + model.selection("EDGE", "Partition_1_1_32/Modified_Edge&Sketch_5/SketchLine_32"), + model.selection("EDGE", "Partition_1_1_37/Modified_Edge&Sketch_5/SketchLine_32"), + model.selection("EDGE", "Partition_1_1_34/Modified_Edge&Sketch_5/SketchLine_32"), + model.selection("EDGE", "Partition_1_1_31/Modified_Edge&Sketch_5/SketchLine_32"), + model.selection("EDGE", "Partition_1_1_36/Modified_Edge&Sketch_5/SketchLine_32"), + model.selection("EDGE", "Partition_1_1_33/Modified_Edge&Sketch_5/SketchLine_32"), + model.selection("EDGE", "Partition_1_1_30/Modified_Edge&Sketch_5/SketchLine_32"), +] Group_6 = model.addGroup(Part_1_doc, Group_6_objects) Group_6.setName("poutres_transversales") Group_6.result().setName("poutres_transversales") @@ -235,12 +599,17 @@ model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [499]) import math from GeomAlgoAPI import * -aResultArea = GeomAlgoAPI_ShapeTools.area(Partition_1.results()[0].resultSubShapePair()[0].shape()) + +aResultArea = GeomAlgoAPI_ShapeTools.area( + Partition_1.results()[0].resultSubShapePair()[0].shape() +) anExpectedArea = 70.18465 -assert(math.fabs(aResultArea-anExpectedArea)/anExpectedArea<1e-7) +assert math.fabs(aResultArea - anExpectedArea) / anExpectedArea < 1e-7 -assert(Partition_1.feature().error() == '') +assert Partition_1.feature().error() == "" for gr in [Group_1, Group_2, Group_3, Group_4, Group_5, Group_6]: - assert(gr.feature().error() == ''), "The group {0} is in error: {1}".format(gr.name(), gr.feature().error()) + assert gr.feature().error() == "", "The group {0} is in error: {1}".format( + gr.name(), gr.feature().error() + ) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test17261.py b/src/FeaturesPlugin/Test/Test17261.py index ae474b07b..0877f7b2c 100644 --- a/src/FeaturesPlugin/Test/Test17261.py +++ b/src/FeaturesPlugin/Test/Test17261.py @@ -27,13 +27,19 @@ 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(0.5, 0, 0, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 37.39521866225591, 0, 40) SketchLine_3 = Sketch_1.addLine(0, 40, 0.5, 40) SketchLine_4 = Sketch_1.addLine(1, 40, 1, 0.5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.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()) @@ -41,97 +47,282 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 2.604781337744086) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_3.result(), 0.5) SketchPoint_2 = Sketch_1.addPoint(0.5, 40) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_3.endPoint() +) SketchLine_5 = Sketch_1.addLine(1, 40, 0.5, 40) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_5.endPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_5.result()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.startPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_5.endPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_4.startPoint(), SketchLine_5.result() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_5.endPoint() +) SketchPoint_3 = Sketch_1.addPoint(0, 36.39521866225591) SketchPoint_4 = Sketch_1.addPoint(0, 37.39521866225591) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchPoint_4.coordinates(), SketchPoint_3.coordinates(), 1) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_2.startPoint()) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchPoint_4.coordinates(), SketchPoint_3.coordinates(), 1 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_2.startPoint() +) SketchLine_6 = Sketch_1.addLine(0, 36.39521866225591, 0, 37.39521866225591) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_6.endPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_6.endPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_2.result() +) SketchLine_7 = Sketch_1.addLine(0, 0, 0, 36.39521866225591) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_7.endPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_6.result()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_7.result(), SketchLine_1.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_7.endPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_6.result() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_7.result(), SketchLine_1.endPoint() +) SketchLine_8 = Sketch_1.addLine(1, 0.5, 0.5, 0) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchLine_4.endPoint()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchLine_4.endPoint()) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchLine_4.endPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_7.result(), SketchLine_4.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_6.result()) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_2.result(), SketchLine_6.endPoint()) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_6.result()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_3.result(), SketchLine_2.endPoint()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_8.startPoint(), SketchLine_4.endPoint() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_8.startPoint(), SketchLine_4.endPoint() +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_8.startPoint(), SketchLine_4.endPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_7.result(), SketchLine_4.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_2.result(), SketchLine_6.result() +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchLine_6.endPoint() +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_6.result() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchLine_2.endPoint() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_3.result() +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_1.result(), 0.5) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_9 = SketchProjection_2.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_8.startPoint(), SketchLine_9.result(), 0.5, True) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_4.result(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.result()) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_8.result(), SketchLine_8.startPoint()) -SketchConstraintParallel_3 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_5.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_8.startPoint(), SketchLine_9.result(), 0.5, True +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_4.result(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_8.result() +) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_8.result(), SketchLine_8.startPoint() +) +SketchConstraintParallel_3 = Sketch_1.setParallel( + SketchLine_3.result(), SketchLine_5.result() +) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_5.result(), 0.5) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchLine_5.result(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_5.result(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchLine_5.result(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_5.result(), SketchLine_3.endPoint() +) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_4.result(), 39.5) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection("EDGE", "Sketch_1/SketchLine_4"), 360, 0) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1")) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection("EDGE", "Sketch_1/SketchLine_4"), + 360, + 0, +) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1"), +) SketchLine_10 = Sketch_2.addLine(1, 1, 1, -1) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]", + ), + False, +) SketchCircle_1 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_30 = Sketch_2.setCoincident( + SketchLine_10.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_31 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchCircle_1.results()[1] +) SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_10.result()) -SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchAPI_Circle(SketchCircle_1).center(), SketchLine_10.result()) +SketchConstraintCoincidence_32 = Sketch_2.setCoincident( + SketchAPI_Circle(SketchCircle_1).center(), SketchLine_10.result() +) SketchLine_11 = Sketch_2.addLine(0, 0, 2, 0) -SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]"), False) +SketchProjection_4 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]", + ), + False, +) SketchPoint_5 = SketchProjection_4.createdFeature() -SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchPoint_5.result()) -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]"), False) +SketchConstraintCoincidence_33 = Sketch_2.setCoincident( + SketchLine_11.startPoint(), SketchPoint_5.result() +) +SketchProjection_5 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]", + ), + False, +) SketchCircle_2 = SketchProjection_5.createdFeature() -SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchCircle_2.results()[1]) -SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchAPI_Circle(SketchCircle_1).center(), SketchLine_11.result()) +SketchConstraintCoincidence_34 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchCircle_2.results()[1] +) +SketchConstraintCoincidence_35 = Sketch_2.setCoincident( + SketchAPI_Circle(SketchCircle_1).center(), SketchLine_11.result() +) SketchLine_12 = Sketch_2.addLine(1.25, 0, 1.176776695296637, 0.1767766952966369) -SketchConstraintCoincidence_36 = Sketch_2.setCoincident(SketchLine_12.startPoint(), SketchLine_11.result()) +SketchConstraintCoincidence_36 = Sketch_2.setCoincident( + SketchLine_12.startPoint(), SketchLine_11.result() +) SketchLine_13 = Sketch_2.addLine(1.176776695296637, 0.1767766952966369, 1, 0.25) -SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_10.result()) -SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]"), True) +SketchConstraintCoincidence_37 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_38 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_10.result() +) +SketchProjection_6 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]", + ), + True, +) SketchCircle_3 = SketchProjection_6.createdFeature() -SketchLine_14 = Sketch_2.addLine(1.176776695296637, 0.1767766952966369, 1.738436468990353, 0.6743230541046004) -SketchConstraintCoincidence_39 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_14.startPoint()) -SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]"), False) +SketchLine_14 = Sketch_2.addLine( + 1.176776695296637, 0.1767766952966369, 1.738436468990353, 0.6743230541046004 +) +SketchConstraintCoincidence_39 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_14.startPoint() +) +SketchProjection_7 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]", + ), + False, +) SketchCircle_4 = SketchProjection_7.createdFeature() -SketchConstraintCoincidence_40 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchCircle_4.results()[1]) +SketchConstraintCoincidence_40 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchCircle_4.results()[1] +) SketchCircle_5 = Sketch_2.addCircle(1, 0, 0.25) SketchCircle_5.setAuxiliary(True) -SketchConstraintCoincidence_41 = Sketch_2.setCoincident(SketchAPI_Circle(SketchCircle_1).center(), SketchCircle_5.center()) -SketchConstraintCoincidence_42 = Sketch_2.setCoincident(SketchLine_12.startPoint(), SketchCircle_5.results()[1]) -SketchConstraintCoincidence_43 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchCircle_5.results()[1]) +SketchConstraintCoincidence_41 = Sketch_2.setCoincident( + SketchAPI_Circle(SketchCircle_1).center(), SketchCircle_5.center() +) +SketchConstraintCoincidence_42 = Sketch_2.setCoincident( + SketchLine_12.startPoint(), SketchCircle_5.results()[1] +) +SketchConstraintCoincidence_43 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchCircle_5.results()[1] +) SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_5.results()[1], 0.25) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_13.result(), SketchLine_12.result()) -SketchConstraintCoincidence_44 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchCircle_5.results()[1]) -SketchConstraintMirror_1_objects = [SketchLine_13.result(), SketchLine_12.result(), SketchLine_14.result()] -SketchConstraintMirror_1 = Sketch_2.addMirror(SketchLine_10.result(), SketchConstraintMirror_1_objects) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_13.result(), SketchLine_12.result() +) +SketchConstraintCoincidence_44 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchCircle_5.results()[1] +) +SketchConstraintMirror_1_objects = [ + SketchLine_13.result(), + SketchLine_12.result(), + SketchLine_14.result(), +] +SketchConstraintMirror_1 = Sketch_2.addMirror( + SketchLine_10.result(), SketchConstraintMirror_1_objects +) [SketchLine_15, SketchLine_16, SketchLine_17] = SketchConstraintMirror_1.mirrored() -SketchConstraintMirror_2_objects = [SketchLine_14.result(), SketchLine_12.result(), SketchLine_13.result(), SketchLine_15.result(), SketchLine_16.result(), SketchLine_17.result()] -SketchConstraintMirror_2 = Sketch_2.addMirror(SketchLine_11.result(), SketchConstraintMirror_2_objects) -[SketchLine_18, SketchLine_19, SketchLine_20, SketchLine_21, SketchLine_22, SketchLine_23] = SketchConstraintMirror_2.mirrored() +SketchConstraintMirror_2_objects = [ + SketchLine_14.result(), + SketchLine_12.result(), + SketchLine_13.result(), + SketchLine_15.result(), + SketchLine_16.result(), + SketchLine_17.result(), +] +SketchConstraintMirror_2 = Sketch_2.addMirror( + SketchLine_11.result(), SketchConstraintMirror_2_objects +) +[ + SketchLine_18, + SketchLine_19, + SketchLine_20, + SketchLine_21, + SketchLine_22, + SketchLine_23, +] = SketchConstraintMirror_2.mirrored() model.do() -Edge_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_23"), model.selection("EDGE", "Sketch_2/SketchLine_21"), model.selection("EDGE", "Sketch_2/SketchLine_22"), model.selection("EDGE", "Sketch_2/SketchLine_10"), model.selection("EDGE", "Sketch_2/SketchLine_15"), model.selection("EDGE", "Sketch_2/SketchLine_16"), model.selection("EDGE", "Sketch_2/SketchLine_17"), model.selection("EDGE", "Sketch_2/SketchLine_11"), model.selection("EDGE", "Sketch_2/SketchLine_12"), 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/SketchLine_13"), model.selection("EDGE", "Sketch_2/SketchLine_14"), model.selection("EDGE", "Sketch_2/SketchProjection_6")] +Edge_1_objects = [ + model.selection("EDGE", "Sketch_2/SketchLine_23"), + model.selection("EDGE", "Sketch_2/SketchLine_21"), + model.selection("EDGE", "Sketch_2/SketchLine_22"), + model.selection("EDGE", "Sketch_2/SketchLine_10"), + model.selection("EDGE", "Sketch_2/SketchLine_15"), + model.selection("EDGE", "Sketch_2/SketchLine_16"), + model.selection("EDGE", "Sketch_2/SketchLine_17"), + model.selection("EDGE", "Sketch_2/SketchLine_11"), + model.selection("EDGE", "Sketch_2/SketchLine_12"), + 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/SketchLine_13"), + model.selection("EDGE", "Sketch_2/SketchLine_14"), + model.selection("EDGE", "Sketch_2/SketchProjection_6"), +] Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Edge_1")], model.selection("EDGE", "PartSet/OY"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3"), 0, model.selection(), 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Edge_1")], + model.selection("EDGE", "PartSet/OY"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3"), + 0, + model.selection(), + 0, +) model.end() from GeomAPI import * @@ -144,4 +335,4 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [102]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [204]) model.testResultsAreas(Extrusion_1, [466.947878]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test17281.py b/src/FeaturesPlugin/Test/Test17281.py index d026b86b4..f5b20631e 100644 --- a/src/FeaturesPlugin/Test/Test17281.py +++ b/src/FeaturesPlugin/Test/Test17281.py @@ -41,37 +41,88 @@ Point_6.result().setName("Point_34") Point_7 = model.addPoint(Part_1_doc, -82.6510873528, 45.946338858, 320.314271667) Point_7.setName("Point_35") Point_7.result().setName("Point_35") -Polyline_1_objects = [model.selection("VERTEX", "Point_30"), model.selection("VERTEX", "Point_31"), model.selection("VERTEX", "Point_32"), model.selection("VERTEX", "Point_33"), model.selection("VERTEX", "Point_34"), model.selection("VERTEX", "Point_35")] +Polyline_1_objects = [ + model.selection("VERTEX", "Point_30"), + model.selection("VERTEX", "Point_31"), + model.selection("VERTEX", "Point_32"), + model.selection("VERTEX", "Point_33"), + model.selection("VERTEX", "Point_34"), + model.selection("VERTEX", "Point_35"), +] Polyline_1 = model.addPolyline3D(Part_1_doc, Polyline_1_objects, True) Polyline_1.setName("Polyline_8") Polyline_1.result().setName("Polyline_8_1") -Polyline_2 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_31"), model.selection("VERTEX", "Point_34")], False) +Polyline_2 = model.addPolyline3D( + Part_1_doc, + [model.selection("VERTEX", "Point_31"), model.selection("VERTEX", "Point_34")], + False, +) Polyline_2.setName("Polyline_11") Polyline_2.result().setName("Polyline_11_1") -Point_8 = model.addPoint(Part_1_doc, model.selection("EDGE", "Polyline_11_1/Generated_Edge&Point_31/Point_31"), 0.5, True, False) +Point_8 = model.addPoint( + Part_1_doc, + model.selection("EDGE", "Polyline_11_1/Generated_Edge&Point_31/Point_31"), + 0.5, + True, + False, +) Point_8.setName("Point_36") Point_8.result().setName("Point_36") -Scale_1 = model.addScale(Part_1_doc, [model.selection("WIRE", "Polyline_8_1")] , model.selection("VERTEX", "Point_36"), 1.05) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("WIRE", "Polyline_8_1")], + model.selection("VERTEX", "Point_36"), + 1.05, +) Scale_1.setName("Scale_4") Scale_1.result().setName("Scale_4_1") -Polyline_3 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "[Scale_4_1/ME:Scaled&Point_33/Point_33]e[Scale_4_1/ME:Scaled&Point_35/Point_35]e"), model.selection("VERTEX", "[Scale_4_1/ME:Scaled&Point_30/Point_30]e[Scale_4_1/ME:Scaled&Point_32/Point_32]e")], False) +Polyline_3 = model.addPolyline3D( + Part_1_doc, + [ + model.selection( + "VERTEX", + "[Scale_4_1/ME:Scaled&Point_33/Point_33]e[Scale_4_1/ME:Scaled&Point_35/Point_35]e", + ), + model.selection( + "VERTEX", + "[Scale_4_1/ME:Scaled&Point_30/Point_30]e[Scale_4_1/ME:Scaled&Point_32/Point_32]e", + ), + ], + False, +) Polyline_3.setName("Polyline_10") Polyline_3.result().setName("Polyline_10_1") Recover_1 = model.addRecover(Part_1_doc, Polyline_3, [Scale_1.result()]) Recover_1.setName("Recover_10") Recover_1.result().setName("Recover_10_1") -Pipe_1 = model.addPipe(Part_1_doc, [model.selection("EDGE", "Recover_10_1/Modified_Edge&Point_31/Point_31"), model.selection("EDGE", "Polyline_10_1/Generated_Edge&weak_name_1")], model.selection("EDGE", "Recover_10_1/Modified_Edge&Point_33/Point_33"), []) +Pipe_1 = model.addPipe( + Part_1_doc, + [ + model.selection("EDGE", "Recover_10_1/Modified_Edge&Point_31/Point_31"), + model.selection("EDGE", "Polyline_10_1/Generated_Edge&weak_name_1"), + ], + model.selection("EDGE", "Recover_10_1/Modified_Edge&Point_33/Point_33"), + [], +) Pipe_1.setName("Pipe_3") Pipe_1.result().setName("Pipe_3_1") Recover_2 = model.addRecover(Part_1_doc, Pipe_1, [Recover_1.result()]) Recover_2.setName("Recover_11") Recover_2.result().setName("Recover_11_1") -Pipe_2 = model.addPipe(Part_1_doc, [model.selection("EDGE", "Recover_11_1/Modified_Edge&Point_32/Point_32"), model.selection("EDGE", "Recover_11_1/Modified_Edge&Point_35/Point_35")], model.selection("EDGE", "Pipe_3_1/From_Edge_1"), []) +Pipe_2 = model.addPipe( + Part_1_doc, + [ + model.selection("EDGE", "Recover_11_1/Modified_Edge&Point_32/Point_32"), + model.selection("EDGE", "Recover_11_1/Modified_Edge&Point_35/Point_35"), + ], + model.selection("EDGE", "Pipe_3_1/From_Edge_1"), + [], +) Pipe_2.setName("Pipe_4") Pipe_2.result().setName("Pipe_4_1") model.end() -assert(Pipe_2.feature().error() == "") +assert Pipe_2.feature().error() == "" from GeomAPI import * @@ -83,4 +134,4 @@ model.testNbSubShapes(Pipe_2, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Pipe_2, GeomAPI_Shape.VERTEX, [8]) model.testResultsAreas(Pipe_2, [280.91366299542733]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test17909.py b/src/FeaturesPlugin/Test/Test17909.py index d22208591..0395a8d22 100644 --- a/src/FeaturesPlugin/Test/Test17909.py +++ b/src/FeaturesPlugin/Test/Test17909.py @@ -33,28 +33,70 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(15, -8.660254037843767, 15, 8.660254037843762) SketchLine_2 = Sketch_1.addLine(15, 8.660254037843762, 0, 0) SketchLine_2.setAuxiliary(True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(0, 0, 15, -8.660254037843767) SketchLine_3.setAuxiliary(True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_1.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_1.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_1.result() +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.startPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.startPoint(), SketchLine_1.result(), "k/2", True) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_1.result()], SketchLine_3.startPoint(), 360, 6, True) -[SketchLine_4, SketchLine_5, SketchLine_6, SketchLine_7, SketchLine_8] = SketchMultiRotation_1.rotated() +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.startPoint(), SketchLine_1.result(), "k/2", True +) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchLine_1.result()], SketchLine_3.startPoint(), 360, 6, True +) +[ + SketchLine_4, + SketchLine_5, + SketchLine_6, + SketchLine_7, + SketchLine_8, +] = SketchMultiRotation_1.rotated() SketchCircle_1 = Sketch_1.addCircle(0, 0, 10) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "M") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_3.startPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchCircle_1_2r")], model.selection(), "h", 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchCircle_1_2r", + ) + ], + model.selection(), + "h", + 0, +) model.do() # fillet with only one edge to make correct result and put all edges to results sub-tree -Fillet_1_objects = [model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7]")] +Fillet_1_objects = [ + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7]", + ) +] Fillet_1 = model.addFillet(Part_1_doc, Fillet_1_objects, 2) model.do() # select all edges as a fillet arguments @@ -62,26 +104,28 @@ aResult = Extrusion_1.results()[0].resultSubShapePair()[0] aShape = aResult.shape() aShapeExplorer = GeomAPI_ShapeExplorer(aShape, GeomAPI_Shape.EDGE) aSelectionList = [] -aLocations = {} # for unique locations support +aLocations = {} # for unique locations support while aShapeExplorer.more(): - # select only vertical lines - anEdge = aShapeExplorer.current() - if not anEdge.edge().isLine() or anEdge.edge().line().direction().z() < 0.999: + # select only vertical lines + anEdge = aShapeExplorer.current() + if not anEdge.edge().isLine() or anEdge.edge().line().direction().z() < 0.999: + aShapeExplorer.next() + continue + aLoc = anEdge.edge().line().location() + aLocStr = str(aLoc.x()) + " " + str(aLoc.y()) + " " + str(aLoc.z()) + if aLocStr in aLocations: + aShapeExplorer.next() + continue + aLocations[aLocStr] = "" + aSelection = model.selection( + aResult, aShapeExplorer.current() + ) # First argument should be result/sub-result, second is sub-shape on this result/sub-result + aSelectionList.append(aSelection) aShapeExplorer.next() - continue - aLoc = anEdge.edge().line().location() - aLocStr = str(aLoc.x()) + " " + str(aLoc.y()) + " " + str(aLoc.z()) - if aLocStr in aLocations: - aShapeExplorer.next() - continue - aLocations[aLocStr] = "" - aSelection = model.selection(aResult, aShapeExplorer.current()) # First argument should be result/sub-result, second is sub-shape on this result/sub-result - aSelectionList.append(aSelection) - aShapeExplorer.next() # Set the fillet arguments: all edges Fillet_1.setBase(aSelectionList) model.end() # if in the fillet base edges names the fillet is used, the python dump should fail -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test1816.py b/src/FeaturesPlugin/Test/Test1816.py index 246876c73..adb7dda6b 100644 --- a/src/FeaturesPlugin/Test/Test1816.py +++ b/src/FeaturesPlugin/Test/Test1816.py @@ -33,69 +33,178 @@ model.addParameter(Part_1_doc, "Lgy", "60") model.addParameter(Part_1_doc, "Lgz", "75") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(0, 0, 0, 75) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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/OZ"), False) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchPoint_1.result() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) SketchLine_3 = Sketch_1.addLine(0, 75, 37.5, 75) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) SketchArc_1 = Sketch_1.addArc(37.5, 62.5, 37.5, 75, 50, 62.5, True) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_1.startPoint() +) SketchLine_4 = Sketch_1.addLine(50, 62.5, 50, 0) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_4.startPoint()) -SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_4.startPoint() +) +SketchProjection_3 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_5 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.result() +) SketchLine_6 = Sketch_1.addLine(50, 0, 0, 0) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.endPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_6.endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_1.results()[1]) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_1.results()[1]) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_1.results()[1] +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_4.result(), SketchArc_1.results()[1] +) 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_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")) +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/SketchLine_1_EndVertex"), 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&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"), False) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_7.startPoint(), SketchPoint_2.result() +) +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()) +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&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]"), False) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +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()) +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&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]"), False) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +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()) +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&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"), False) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_7.startPoint(), SketchLine_11.startPoint() +) +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) -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchArc_2.startPoint()) +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 +) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchArc_2.startPoint() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchArc_2.results()[1], "Ray") -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_11.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]) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchArc_2.endPoint(), SketchLine_11.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_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")]) +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) +assert len(Common_1.results()) == 1 model.testResultsVolumes(Common_1, [221498.777690970688126981258392334]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test1876.py b/src/FeaturesPlugin/Test/Test1876.py index 2eec2bc24..050d025b7 100644 --- a/src/FeaturesPlugin/Test/Test1876.py +++ b/src/FeaturesPlugin/Test/Test1876.py @@ -25,27 +25,68 @@ 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(396.8373493975904, 115.9638554216867, -225.1506024096385, 115.9638554216867) -SketchLine_2 = Sketch_1.addLine(-225.1506024096385, 115.9638554216867, -225.1506024096385, -149.0963855421687) -SketchLine_3 = Sketch_1.addLine(-225.1506024096385, -149.0963855421687, 396.8373493975904, -149.0963855421687) -SketchLine_4 = Sketch_1.addLine(396.8373493975904, -149.0963855421687, 396.8373493975904, 115.9638554216867) -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()) +SketchLine_1 = Sketch_1.addLine( + 396.8373493975904, 115.9638554216867, -225.1506024096385, 115.9638554216867 +) +SketchLine_2 = Sketch_1.addLine( + -225.1506024096385, 115.9638554216867, -225.1506024096385, -149.0963855421687 +) +SketchLine_3 = Sketch_1.addLine( + -225.1506024096385, -149.0963855421687, 396.8373493975904, -149.0963855421687 +) +SketchLine_4 = Sketch_1.addLine( + 396.8373493975904, -149.0963855421687, 396.8373493975904, 115.9638554216867 +) +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() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_1 = Sketch_2.addCircle(-348.644578313253, 155.1204819277109, 207.6894050099908) +SketchCircle_1 = Sketch_2.addCircle( + -348.644578313253, 155.1204819277109, 207.6894050099908 +) 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(), 100, 0) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], 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", + ) + ], + model.selection(), + 100, + 0, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + 100, + 0, +) Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")]) Group_2 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")]) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")]) +Partition_1 = model.addPartition( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_2_1"), + ], +) model.end() # move groups @@ -57,15 +98,19 @@ model.end() # check each group contain two results: one is related to original body only, another - common part aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) -assert(aFactory.validate(Group_2.feature())) +assert aFactory.validate(Group_1.feature()) +assert aFactory.validate(Group_2.feature()) aList1 = Group_1.feature().selectionList("group_list") aList2 = Group_2.feature().selectionList("group_list") -assert(aList1.size() == 2) -assert(aList2.size() == 2) -assert(aList1.value(0).value().shapeTypeStr() == "SOLID") -assert(aList1.value(1).value().shapeTypeStr() == "SOLID") -assert(aList2.value(0).value().shapeTypeStr() == "SOLID") -assert(aList2.value(1).value().shapeTypeStr() == "SOLID") -assert(aList1.value(0).value().isSame(aList2.value(0).value()) or aList1.value(1).value().isSame(aList2.value(0).value()) or -aList1.value(0).value().isSame(aList2.value(1).value()) or aList1.value(1).value().isSame(aList2.value(1).value())) +assert aList1.size() == 2 +assert aList2.size() == 2 +assert aList1.value(0).value().shapeTypeStr() == "SOLID" +assert aList1.value(1).value().shapeTypeStr() == "SOLID" +assert aList2.value(0).value().shapeTypeStr() == "SOLID" +assert aList2.value(1).value().shapeTypeStr() == "SOLID" +assert ( + aList1.value(0).value().isSame(aList2.value(0).value()) + or aList1.value(1).value().isSame(aList2.value(0).value()) + or aList1.value(0).value().isSame(aList2.value(1).value()) + or aList1.value(1).value().isSame(aList2.value(1).value()) +) diff --git a/src/FeaturesPlugin/Test/Test18836.py b/src/FeaturesPlugin/Test/Test18836.py index ec6655614..05cda15ef 100644 --- a/src/FeaturesPlugin/Test/Test18836.py +++ b/src/FeaturesPlugin/Test/Test18836.py @@ -25,49 +25,113 @@ 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(141.7325102880659, 0, 0, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 87.1454046639232) -SketchLine_3 = Sketch_1.addLine(0, 87.1454046639232, 141.7325102880659, 87.1454046639232) -SketchLine_4 = Sketch_1.addLine(141.7325102880659, 87.1454046639232, 141.7325102880659, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_3 = Sketch_1.addLine( + 0, 87.1454046639232, 141.7325102880659, 87.1454046639232 +) +SketchLine_4 = Sketch_1.addLine( + 141.7325102880659, 87.1454046639232, 141.7325102880659, 0 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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(48.25918560939968, 36.68732867484031, -63.06551064348577, 36.68732867484031) -SketchLine_6 = Sketch_1.addLine(-63.06551064348577, 36.68732867484031, -63.06551064348577, -40.64885412030576) -SketchLine_7 = Sketch_1.addLine(-63.06551064348577, -40.64885412030576, 48.25918560939968, -40.64885412030576) -SketchLine_8 = Sketch_1.addLine(48.25918560939968, -40.64885412030576, 48.25918560939968, 36.68732867484031) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchLine_5 = Sketch_1.addLine( + 48.25918560939968, 36.68732867484031, -63.06551064348577, 36.68732867484031 +) +SketchLine_6 = Sketch_1.addLine( + -63.06551064348577, 36.68732867484031, -63.06551064348577, -40.64885412030576 +) +SketchLine_7 = Sketch_1.addLine( + -63.06551064348577, -40.64885412030576, 48.25918560939968, -40.64885412030576 +) +SketchLine_8 = Sketch_1.addLine( + 48.25918560939968, -40.64885412030576, 48.25918560939968, 36.68732867484031 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_9 = 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(-12.82162118421888, 83.48310807317709, -70.45431791690731, 83.48310807317709) -SketchLine_10 = Sketch_1.addLine(-70.45431791690731, 83.48310807317709, -70.45431791690731, 46.53907170606908) -SketchLine_11 = Sketch_1.addLine(-70.45431791690731, 46.53907170606908, -12.82162118421888, 46.53907170606908) -SketchLine_12 = Sketch_1.addLine(-12.82162118421888, 46.53907170606908, -12.82162118421888, 83.48310807317709) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchLine_9 = Sketch_1.addLine( + -12.82162118421888, 83.48310807317709, -70.45431791690731, 83.48310807317709 +) +SketchLine_10 = Sketch_1.addLine( + -70.45431791690731, 83.48310807317709, -70.45431791690731, 46.53907170606908 +) +SketchLine_11 = Sketch_1.addLine( + -70.45431791690731, 46.53907170606908, -12.82162118421888, 46.53907170606908 +) +SketchLine_12 = Sketch_1.addLine( + -12.82162118421888, 46.53907170606908, -12.82162118421888, 83.48310807317709 +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_13 = 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()) model.do() -Wire_1 = model.addWire(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], True) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Wire_1")], model.selection("EDGE", "PartSet/OZ"), 10, 0) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], True) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Edge_1")], model.selection("EDGE", "PartSet/OZ"), -10, 0) +Wire_1 = model.addWire( + Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], True +) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Wire_1")], + model.selection("EDGE", "PartSet/OZ"), + 10, + 0, +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], True +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Edge_1")], + model.selection("EDGE", "PartSet/OZ"), + -10, + 0, +) model.end() from GeomAPI import * @@ -88,4 +152,4 @@ model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.EDGE, [64]) model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.VERTEX, [128]) model.testResultsAreas(Extrusion_2, [10242.31054]) -assert(model.checkPythonDump()) \ No newline at end of file +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test19065.py b/src/FeaturesPlugin/Test/Test19065.py index 2b2fdd655..70510f5e6 100644 --- a/src/FeaturesPlugin/Test/Test19065.py +++ b/src/FeaturesPlugin/Test/Test19065.py @@ -25,47 +25,121 @@ 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(102.3744998618265, 0, 0, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 83.57481045461809) -SketchLine_3 = Sketch_1.addLine(0, 83.57481045461809, 102.3744998618265, 83.57481045461809) -SketchLine_4 = Sketch_1.addLine(102.3744998618265, 83.57481045461809, 102.3744998618265, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_3 = Sketch_1.addLine( + 0, 83.57481045461809, 102.3744998618265, 83.57481045461809 +) +SketchLine_4 = Sketch_1.addLine( + 102.3744998618265, 83.57481045461809, 102.3744998618265, 0 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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(0, 83.57481045461809, 102.3744998618265, 0) SketchLine_5.setAuxiliary(True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.endPoint() +) SketchLine_6 = Sketch_1.addLine(0, 0, 102.3744998618265, 83.57481045461809) SketchLine_6.setAuxiliary(True) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_6.endPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_6.endPoint() +) SketchPoint_2 = Sketch_1.addPoint(51.18724993091325, 41.78740522730904) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_5.result()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_6.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_5.result() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_6.result() +) model.do() -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r"), 100, False) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection( + "FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r" + ), + 100, + False, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchCircle_1 = Sketch_2.addCircle(46.03714617613203, 29.83511540776045, 23.21299794073264) +SketchCircle_1 = Sketch_2.addCircle( + 46.03714617613203, 29.83511540776045, 23.21299794073264 +) model.do() -Edge_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3")] +Edge_1_objects = [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_4"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + model.selection("EDGE", "Sketch_1/SketchLine_3"), +] Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects, False) -Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchCircle_1_2")], False) -Edge_3 = model.addEdge(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchPoint_2"), model.selection("VERTEX", "Sketch_2/SketchCircle_1")) -Pipe_1 = model.addPipe(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection("EDGE", "Edge_3_1"), []) -Wire_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")] +Edge_2 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchCircle_1_2")], False +) +Edge_3 = model.addEdge( + Part_1_doc, + model.selection("VERTEX", "Sketch_1/SketchPoint_2"), + model.selection("VERTEX", "Sketch_2/SketchCircle_1"), +) +Pipe_1 = model.addPipe( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ), + model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r"), + ], + model.selection("EDGE", "Edge_3_1"), + [], +) +Wire_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"), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) Recover_1 = model.addRecover(Part_1_doc, Pipe_1, [Edge_3.result()]) -Pipe_2 = model.addPipe(Part_1_doc, [model.selection("EDGE", "Edge_2_1"), model.selection("WIRE", "Wire_1_1")], model.selection("EDGE", "Recover_1_1"), []) +Pipe_2 = model.addPipe( + Part_1_doc, + [model.selection("EDGE", "Edge_2_1"), model.selection("WIRE", "Wire_1_1")], + model.selection("EDGE", "Recover_1_1"), + [], +) Pipe_2.result().setColor(255, 0, 0) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SHELL", "Pipe_2_1")], [model.selection("SOLID", "Pipe_1_1")], keepSubResults = True) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SHELL", "Pipe_2_1")], + [model.selection("SOLID", "Pipe_1_1")], + keepSubResults=True, +) model.end() @@ -90,4 +164,4 @@ model.testResultsAreas(Pipe_2, [26549.49767585]) # Cut should have no results model.testNbResults(Cut_1, 0) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test19066.py b/src/FeaturesPlugin/Test/Test19066.py index aa80e7f78..378c33843 100644 --- a/src/FeaturesPlugin/Test/Test19066.py +++ b/src/FeaturesPlugin/Test/Test19066.py @@ -24,80 +24,215 @@ 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(19.10387596899224, 5.793798449612405, 19.10387596899224, 27.4031007751938) +SketchLine_1 = Sketch_1.addLine( + 19.10387596899224, 5.793798449612405, 19.10387596899224, 27.4031007751938 +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) -SketchLine_2 = Sketch_1.addLine(19.10387596899224, 27.4031007751938, 74.84961240310078, 27.4031007751938) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_2 = Sketch_1.addLine( + 19.10387596899224, 27.4031007751938, 74.84961240310078, 27.4031007751938 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) -SketchLine_3 = Sketch_1.addLine(74.84961240310078, 27.4031007751938, 74.84961240310078, 54.0232558139535) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_3 = Sketch_1.addLine( + 74.84961240310078, 27.4031007751938, 74.84961240310078, 54.0232558139535 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) -SketchLine_4 = Sketch_1.addLine(74.84961240310078, 54.0232558139535, 102.0961240310078, 54.0232558139535) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_4 = Sketch_1.addLine( + 74.84961240310078, 54.0232558139535, 102.0961240310078, 54.0232558139535 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) -SketchLine_5 = Sketch_1.addLine(102.0961240310078, 54.0232558139535, 102.0961240310078, 26.77674418604651) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchLine_5 = Sketch_1.addLine( + 102.0961240310078, 54.0232558139535, 102.0961240310078, 26.77674418604651 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_5.result()) -SketchLine_6 = Sketch_1.addLine(102.0961240310078, 26.77674418604651, 136.2325581395349, 26.77674418604651) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchLine_6 = Sketch_1.addLine( + 102.0961240310078, 26.77674418604651, 136.2325581395349, 26.77674418604651 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(136.2325581395349, 26.77674418604651, 136.2325581395349, 0.4697674418604749) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchLine_7 = Sketch_1.addLine( + 136.2325581395349, 26.77674418604651, 136.2325581395349, 0.4697674418604749 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_7.result()) -SketchLine_8 = Sketch_1.addLine(136.2325581395349, 0.4697674418604749, 103.9751937984496, 0.4697674418604749) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchLine_8 = Sketch_1.addLine( + 136.2325581395349, 0.4697674418604749, 103.9751937984496, 0.4697674418604749 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result()) -SketchLine_9 = Sketch_1.addLine(103.9751937984496, 0.4697674418604749, 103.9751937984496, -20.82635658914729) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchLine_9 = Sketch_1.addLine( + 103.9751937984496, 0.4697674418604749, 103.9751937984496, -20.82635658914729 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_9.result()) -SketchLine_10 = Sketch_1.addLine(103.9751937984496, -20.82635658914729, 77.35503875968993, -18.63410852713179) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchLine_11 = Sketch_1.addLine(77.35503875968993, -18.63410852713179, 76.10232558139535, 9.238759689922478) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) -SketchLine_12 = Sketch_1.addLine(76.10232558139535, 9.238759689922478, 19.10387596899224, 5.793798449612405) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_12.endPoint()) +SketchLine_10 = Sketch_1.addLine( + 103.9751937984496, -20.82635658914729, 77.35503875968993, -18.63410852713179 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchLine_11 = Sketch_1.addLine( + 77.35503875968993, -18.63410852713179, 76.10232558139535, 9.238759689922478 +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) +SketchLine_12 = Sketch_1.addLine( + 76.10232558139535, 9.238759689922478, 19.10387596899224, 5.793798449612405 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_12.endPoint() +) SketchPoint_1 = Sketch_1.addPoint(88.97935811509896, 16.06459344588224) model.do() -Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_7"), model.selection("EDGE", "Sketch_1/SketchLine_9"), model.selection("EDGE", "Sketch_1/SketchLine_6"), model.selection("EDGE", "Sketch_1/SketchLine_8"), model.selection("EDGE", "Sketch_1/SketchLine_10"), model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_1/SketchLine_11"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_12"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("WIRE", "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_wire")] +Wire_1_objects = [ + model.selection("EDGE", "Sketch_1/SketchLine_7"), + model.selection("EDGE", "Sketch_1/SketchLine_9"), + model.selection("EDGE", "Sketch_1/SketchLine_6"), + model.selection("EDGE", "Sketch_1/SketchLine_8"), + model.selection("EDGE", "Sketch_1/SketchLine_10"), + model.selection("EDGE", "Sketch_1/SketchLine_5"), + model.selection("EDGE", "Sketch_1/SketchLine_11"), + model.selection("EDGE", "Sketch_1/SketchLine_4"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + model.selection("EDGE", "Sketch_1/SketchLine_3"), + model.selection("EDGE", "Sketch_1/SketchLine_12"), + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection( + "WIRE", + "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_wire", + ), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 100, False) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchLine_13 = Sketch_2.addLine(54.51293454413378, 26.90644687116999, 78.22337943042922, 26.90644687116999) +SketchLine_13 = Sketch_2.addLine( + 54.51293454413378, 26.90644687116999, 78.22337943042922, 26.90644687116999 +) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_13.result()) -SketchLine_14 = Sketch_2.addLine(78.22337943042922, 26.90644687116999, 78.22337943042922, 42.49687638544646) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchLine_14 = Sketch_2.addLine( + 78.22337943042922, 26.90644687116999, 78.22337943042922, 42.49687638544646 +) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_14.result()) -SketchLine_15 = Sketch_2.addLine(78.22337943042922, 42.49687638544646, 92.18980587030188, 42.49687638544646) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchLine_15 = Sketch_2.addLine( + 78.22337943042922, 42.49687638544646, 92.18980587030188, 42.49687638544646 +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_15.result()) -SketchLine_16 = Sketch_2.addLine(92.18980587030188, 42.49687638544646, 92.18980587030188, 26.25684564140846) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) +SketchLine_16 = Sketch_2.addLine( + 92.18980587030188, 42.49687638544646, 92.18980587030188, 26.25684564140846 +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_16.result()) -SketchLine_17 = Sketch_2.addLine(92.18980587030188, 26.25684564140846, 103.5578273911285, 24.63284256700466) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) -SketchLine_18 = Sketch_2.addLine(103.5578273911285, 24.63284256700466, 103.5578273911285, 15.21362473546265) -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) +SketchLine_17 = Sketch_2.addLine( + 92.18980587030188, 26.25684564140846, 103.5578273911285, 24.63284256700466 +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) +SketchLine_18 = Sketch_2.addLine( + 103.5578273911285, 24.63284256700466, 103.5578273911285, 15.21362473546265 +) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_18.result()) -SketchLine_19 = Sketch_2.addLine(103.5578273911285, 15.21362473546265, 94.13860955958643, 16.83762780986643) -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -SketchLine_20 = Sketch_2.addLine(94.13860955958643, 16.83762780986643, 94.78821078934796, 9.367213667608976) -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) -SketchLine_21 = Sketch_2.addLine(94.78821078934796, 9.367213667608976, 83.42018926852137, 11.96561858665505) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) -SketchLine_22 = Sketch_2.addLine(83.42018926852137, 11.96561858665505, 83.09538865364063, 18.13683026938948) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint()) -SketchLine_23 = Sketch_2.addLine(83.09538865364063, 18.13683026938948, 60.03454499710668, 20.08563395867403) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) -SketchLine_24 = Sketch_2.addLine(60.03454499710668, 20.08563395867403, 54.51293454413378, 26.90644687116999) -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_13.startPoint(), SketchLine_24.endPoint()) +SketchLine_19 = Sketch_2.addLine( + 103.5578273911285, 15.21362473546265, 94.13860955958643, 16.83762780986643 +) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) +SketchLine_20 = Sketch_2.addLine( + 94.13860955958643, 16.83762780986643, 94.78821078934796, 9.367213667608976 +) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) +SketchLine_21 = Sketch_2.addLine( + 94.78821078934796, 9.367213667608976, 83.42018926852137, 11.96561858665505 +) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.startPoint() +) +SketchLine_22 = Sketch_2.addLine( + 83.42018926852137, 11.96561858665505, 83.09538865364063, 18.13683026938948 +) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchLine_21.endPoint(), SketchLine_22.startPoint() +) +SketchLine_23 = Sketch_2.addLine( + 83.09538865364063, 18.13683026938948, 60.03454499710668, 20.08563395867403 +) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.startPoint() +) +SketchLine_24 = Sketch_2.addLine( + 60.03454499710668, 20.08563395867403, 54.51293454413378, 26.90644687116999 +) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_23.endPoint(), SketchLine_24.startPoint() +) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchLine_13.startPoint(), SketchLine_24.endPoint() +) SketchPoint_2 = Sketch_2.addPoint(86.98316963342577, 22.7185550514595) model.do() -Wire_2_objects = [model.selection("EDGE", "Sketch_2/SketchLine_13"), model.selection("EDGE", "Sketch_2/SketchLine_24"), model.selection("EDGE", "Sketch_2/SketchLine_23"), model.selection("EDGE", "Sketch_2/SketchLine_22"), model.selection("EDGE", "Sketch_2/SketchLine_21"), 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/SketchLine_17"), model.selection("EDGE", "Sketch_2/SketchLine_16"), model.selection("EDGE", "Sketch_2/SketchLine_15"), model.selection("EDGE", "Sketch_2/SketchLine_14")] +Wire_2_objects = [ + model.selection("EDGE", "Sketch_2/SketchLine_13"), + model.selection("EDGE", "Sketch_2/SketchLine_24"), + model.selection("EDGE", "Sketch_2/SketchLine_23"), + model.selection("EDGE", "Sketch_2/SketchLine_22"), + model.selection("EDGE", "Sketch_2/SketchLine_21"), + 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/SketchLine_17"), + model.selection("EDGE", "Sketch_2/SketchLine_16"), + model.selection("EDGE", "Sketch_2/SketchLine_15"), + model.selection("EDGE", "Sketch_2/SketchLine_14"), +] Wire_2 = model.addWire(Part_1_doc, Wire_2_objects, False) -Edge_1 = model.addEdge(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("VERTEX", "Sketch_2/SketchPoint_2")) -Pipe_1 = model.addPipe(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")], model.selection("EDGE", "Edge_1_1"), []) +Edge_1 = model.addEdge( + Part_1_doc, + model.selection("VERTEX", "Sketch_1/SketchPoint_1"), + model.selection("VERTEX", "Sketch_2/SketchPoint_2"), +) +Pipe_1 = model.addPipe( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")], + model.selection("EDGE", "Edge_1_1"), + [], +) model.end() @@ -111,4 +246,4 @@ model.testNbSubShapes(Pipe_1, GeomAPI_Shape.EDGE, [48]) model.testNbSubShapes(Pipe_1, GeomAPI_Shape.VERTEX, [96]) model.testResultsAreas(Pipe_1, [27370.29819]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test19115.py b/src/FeaturesPlugin/Test/Test19115.py index 63a4a47cf..b86b5a2e7 100644 --- a/src/FeaturesPlugin/Test/Test19115.py +++ b/src/FeaturesPlugin/Test/Test19115.py @@ -25,22 +25,65 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "h", "1") -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 0.5, "h") -Cylinder_2 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 0.1, "h") -Cylinder_3 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 0.4, "h") +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 0.5, + "h", +) +Cylinder_2 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 0.1, + "h", +) +Cylinder_3 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 0.4, + "h", +) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 0.1, False) -Partition_1_objects = [model.selection("SOLID", "Cylinder_1_1"), model.selection("SOLID", "Cylinder_2_1"), model.selection("SOLID", "Cylinder_3_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ")] -Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults = True) +Partition_1_objects = [ + model.selection("SOLID", "Cylinder_1_1"), + model.selection("SOLID", "Cylinder_2_1"), + model.selection("SOLID", "Cylinder_3_1"), + model.selection("FACE", "Plane_1"), + model.selection("FACE", "PartSet/YOZ"), + model.selection("FACE", "PartSet/XOZ"), +] +Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults=True) Box_1 = model.addBox(Part_1_doc, 0.7, 0.1, 0.05) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], 0, -0.05, "0.75*h") +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_1_1")], 0, -0.05, "0.75*h" +) Recover_1 = model.addRecover(Part_1_doc, Partition_1, [Cylinder_1.result()]) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], [model.selection("SOLID", "Recover_1_1")], keepSubResults = True) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Partition_1_1_14/Modified_Face&PartSet/XOZ/XOZ")]) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + [model.selection("SOLID", "Recover_1_1")], + keepSubResults=True, +) +Face_1 = model.addFace( + Part_1_doc, + [model.selection("FACE", "Partition_1_1_14/Modified_Face&PartSet/XOZ/XOZ")], +) Recover_2 = model.addRecover(Part_1_doc, Face_1, [Partition_1.result()], True) -Partition_2 = model.addPartition(Part_1_doc, [model.selection("COMPSOLID", "Recover_2_1"), model.selection("SOLID", "Cut_1_1")], keepSubResults = True) +Partition_2 = model.addPartition( + Part_1_doc, + [model.selection("COMPSOLID", "Recover_2_1"), model.selection("SOLID", "Cut_1_1")], + keepSubResults=True, +) model.end() -Fuse_objects = [model.selection("SOLID", "Partition_2_1_14"), model.selection("SOLID", "Partition_2_1_25"), model.selection("SOLID", "Partition_2_1_24")] +Fuse_objects = [ + model.selection("SOLID", "Partition_2_1_14"), + model.selection("SOLID", "Partition_2_1_25"), + model.selection("SOLID", "Partition_2_1_24"), +] import time @@ -48,7 +91,7 @@ import time tStart = time.time() model.begin() -Union_1 = model.addUnion(Part_1_doc, Fuse_objects, keepSubResults = True) +Union_1 = model.addUnion(Part_1_doc, Fuse_objects, keepSubResults=True) model.do() tUnion = time.time() - tStart @@ -68,7 +111,7 @@ model.end() tStart = time.time() model.begin() -Fuse_1 = model.addFuse(Part_1_doc, Fuse_objects, keepSubResults = True) +Fuse_1 = model.addFuse(Part_1_doc, Fuse_objects, keepSubResults=True) model.do() tFuse = time.time() - tStart @@ -84,4 +127,4 @@ model.testResultsVolumes(Fuse_1, [0.78640233633346512398532]) print("Elapsed time of Union: {}".format(tUnion)) print("Elapsed time of Fuse: {}".format(tFuse)) -assert(tFuse <= tUnion * 1.5) +assert tFuse <= tUnion * 1.5 diff --git a/src/FeaturesPlugin/Test/Test1915.py b/src/FeaturesPlugin/Test/Test1915.py index 7f5b31d0f..315c9f306 100644 --- a/src/FeaturesPlugin/Test/Test1915.py +++ b/src/FeaturesPlugin/Test/Test1915.py @@ -24,16 +24,37 @@ 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(-143.8658546926619, 0.1897622851492952, 114.0641755357124) -SketchLine_1 = Sketch_1.addLine(-141.3317208711381, 114.2257842537203, -143.8607239569611, -118.2013550640528) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) +SketchCircle_1 = Sketch_1.addCircle( + -143.8658546926619, 0.1897622851492952, 114.0641755357124 +) +SketchLine_1 = Sketch_1.addLine( + -141.3317208711381, 114.2257842537203, -143.8607239569611, -118.2013550640528 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_2 = Sketch_2.addCircle(-111.0503834053735, -148.4878232655183, 89.21253106334201) +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) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_1")], [model.selection("SOLID", "Extrusion_1_2")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1"), model.selection("COMPOUND", "Sketch_2")], + model.selection(), + 10, + 0, +) +Cut_1 = model.addCut( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_1_2"), + model.selection("SOLID", "Extrusion_1_1_1"), + ], + [model.selection("SOLID", "Extrusion_1_2")], +) model.do() model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test19196.py b/src/FeaturesPlugin/Test/Test19196.py index da7decb78..e6cc5c7ec 100644 --- a/src/FeaturesPlugin/Test/Test19196.py +++ b/src/FeaturesPlugin/Test/Test19196.py @@ -31,107 +31,343 @@ model.addParameter(Part_1_doc, "r_int", "60") model.addParameter(Part_1_doc, "r_cut", "30") model.addParameter(Part_1_doc, "h", "200") ParamSize = model.addParameter(Part_1_doc, "size", "r_int*3/4") -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "r_int", "h") -Cylinder_2 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "r_ext", "h") -Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "r_ext") -Sphere_2 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "r_int") -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Sphere_1_1")], axis = model.selection("EDGE", "PartSet/OY"), angle = 90, keepSubResults = True) -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Sphere_2_1")], axis = model.selection("EDGE", "PartSet/OY"), angle = 90, keepSubResults = True) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Rotation_1_1"), model.selection("SOLID", "Rotation_2_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = "h", keepSubResults = True) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1"), model.selection("SOLID", "Translation_1_2")], removeEdges = True, keepSubResults = True) -Fuse_2 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cylinder_2_1"), model.selection("SOLID", "Translation_1_1")], removeEdges = True, keepSubResults = True) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Fuse_1_1"), model.selection("SOLID", "Fuse_2_1")], keepSubResults = True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "r_int", + "h", +) +Cylinder_2 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "r_ext", + "h", +) +Sphere_1 = model.addSphere( + Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "r_ext" +) +Sphere_2 = model.addSphere( + Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "r_int" +) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Sphere_1_1")], + axis=model.selection("EDGE", "PartSet/OY"), + angle=90, + keepSubResults=True, +) +Rotation_2 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Sphere_2_1")], + axis=model.selection("EDGE", "PartSet/OY"), + angle=90, + keepSubResults=True, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [ + model.selection("SOLID", "Rotation_1_1"), + model.selection("SOLID", "Rotation_2_1"), + ], + axis=model.selection("EDGE", "PartSet/OZ"), + distance="h", + keepSubResults=True, +) +Fuse_1 = model.addFuse( + Part_1_doc, + [ + model.selection("SOLID", "Cylinder_1_1"), + model.selection("SOLID", "Translation_1_2"), + ], + removeEdges=True, + keepSubResults=True, +) +Fuse_2 = model.addFuse( + Part_1_doc, + [ + model.selection("SOLID", "Cylinder_2_1"), + model.selection("SOLID", "Translation_1_1"), + ], + removeEdges=True, + keepSubResults=True, +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Fuse_1_1"), model.selection("SOLID", "Fuse_2_1")], + keepSubResults=True, +) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 124.9999999998943, 0, 45.00000000000152) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchLine_3 = Sketch_1.addLine(0, 45.00000000000152, -45, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(-45, 0, 0, -45.00000000000152) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(0, -45.00000000000152, 44.99999999998636, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(44.99999999998636, 0, 0, 45.00000000000152) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_6.endPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_6.endPoint() +) SketchLine_7 = Sketch_1.addLine(0, -45.00000000000152, 0, -124.9999999997331) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_7.startPoint() +) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_7.result()) SketchLine_8 = Sketch_1.addLine(-45, 0, -125, 0) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_8.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_8.result()) SketchLine_9 = Sketch_1.addLine(44.99999999998636, 0, 124.9999999999994, 0) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_10 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.result()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_10.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchLine_10.result()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_2.result()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_5.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_3.result(), SketchLine_4.result()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.result() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_10.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_8.startPoint(), SketchLine_10.result() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_2.result() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_3.result(), SketchLine_5.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_3.result(), SketchLine_4.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_8.result(), "r_ext") -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_8.startPoint(), SketchLine_7.result(), "size", True) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_8.result(), SketchLine_1.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_9.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_7.result(), SketchLine_9.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_8.startPoint(), SketchLine_7.result(), "size", True +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_8.result(), SketchLine_1.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_9.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_7.result(), SketchLine_9.result() +) model.do() -Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_8"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_7"), model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_1/SketchLine_9"), model.selection("EDGE", "Sketch_1/SketchLine_6"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_1")] +Wire_1_objects = [ + model.selection("EDGE", "Sketch_1/SketchLine_8"), + model.selection("EDGE", "Sketch_1/SketchLine_4"), + model.selection("EDGE", "Sketch_1/SketchLine_7"), + model.selection("EDGE", "Sketch_1/SketchLine_5"), + model.selection("EDGE", "Sketch_1/SketchLine_9"), + model.selection("EDGE", "Sketch_1/SketchLine_6"), + model.selection("EDGE", "Sketch_1/SketchLine_3"), + model.selection("EDGE", "Sketch_1/SketchLine_1"), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), "h", 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), "h", 0 +) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), "h", False) -Split_1 = model.addSplit(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], [model.selection("FACE", "Plane_1"), model.selection("SHELL", "Extrusion_1_1")], keepSubResults = True) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Split_1_1_7/Modified_Face&Plane_1/Plane_1&new_weak_name_3")) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Extrusion_1_1/To_Edge_2"), True) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + [model.selection("FACE", "Plane_1"), model.selection("SHELL", "Extrusion_1_1")], + keepSubResults=True, +) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection( + "FACE", "Split_1_1_7/Modified_Face&Plane_1/Plane_1&new_weak_name_3" + ), +) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("EDGE", "Extrusion_1_1/To_Edge_2"), True +) SketchLine_11 = SketchProjection_3.createdFeature() -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Extrusion_1_1/To_Edge_5"), True) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("EDGE", "Extrusion_1_1/To_Edge_5"), True +) SketchLine_12 = SketchProjection_4.createdFeature() -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "Extrusion_1_1/To_Edge_6"), True) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("EDGE", "Extrusion_1_1/To_Edge_6"), True +) SketchLine_13 = SketchProjection_5.createdFeature() -SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "Extrusion_1_1/To_Edge_3"), True) +SketchProjection_6 = Sketch_2.addProjection( + model.selection("EDGE", "Extrusion_1_1/To_Edge_3"), True +) SketchLine_14 = SketchProjection_6.createdFeature() model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), "r_cut/sqrt(2)", 0) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_2")], + model.selection(), + "r_cut/sqrt(2)", + 0, +) Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "Split_1_1_3/Modified_Edge&Extrusion_1_1/To_Edge_4"), True) +SketchProjection_7 = Sketch_3.addProjection( + model.selection("EDGE", "Split_1_1_3/Modified_Edge&Extrusion_1_1/To_Edge_4"), True +) SketchLine_15 = SketchProjection_7.createdFeature() -SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Split_1_1_9/Modified_Edge&Extrusion_1_1/To_Edge_4"), True) +SketchProjection_8 = Sketch_3.addProjection( + model.selection("EDGE", "Split_1_1_9/Modified_Edge&Extrusion_1_1/To_Edge_4"), True +) SketchLine_16 = SketchProjection_8.createdFeature() -SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchProjection_3][Extrusion_2_1/Generated_Face&Sketch_2/SketchProjection_4]"), True) +SketchProjection_9 = Sketch_3.addProjection( + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchProjection_3][Extrusion_2_1/Generated_Face&Sketch_2/SketchProjection_4]", + ), + True, +) SketchLine_17 = SketchProjection_9.createdFeature() -SketchLine_18 = Sketch_3.addLine(-45.00000000000152, 221.2132034355964, -99.71358592313776, 275.9267893638306) +SketchLine_18 = Sketch_3.addLine( + -45.00000000000152, 221.2132034355964, -99.71358592313776, 275.9267893638306 +) SketchLine_19 = Sketch_3.addLine(-99.71358592313776, 275.9267893638306, -80, 200) -SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_16).endPoint(), SketchLine_19.endPoint()) -SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchLine_18.startPoint(), SketchAPI_Line(SketchLine_17).endPoint()) -SketchConstraintAngle_1 = Sketch_3.setAngle(SketchLine_18.result(), SketchLine_16.result(), 45, type = "") +SketchConstraintCoincidence_14 = Sketch_3.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_3.setCoincident( + SketchAPI_Line(SketchLine_16).endPoint(), SketchLine_19.endPoint() +) +SketchConstraintCoincidence_16 = Sketch_3.setCoincident( + SketchLine_18.startPoint(), SketchAPI_Line(SketchLine_17).endPoint() +) +SketchConstraintAngle_1 = Sketch_3.setAngle( + SketchLine_18.result(), SketchLine_16.result(), 45, type="" +) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchProjection_9f-SketchLine_18f-SketchLine_19f-SketchProjection_8r-SketchProjection_7r")]) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), 4, keepSubResults = True) -Plane_5 = model.addPlane(Part_1_doc, model.selection("VERTEX", "AngularCopy_1_1_1/MV:Rotated&Sketch_3/SketchLine_19_StartVertex&Sketch_3/SketchLine_18_EndVertex"), model.selection("VERTEX", "AngularCopy_1_1_4/MV:Rotated&Sketch_3/SketchLine_19_StartVertex&Sketch_3/SketchLine_18_EndVertex"), model.selection("VERTEX", "AngularCopy_1_1_4/MV:Rotated&Sketch_3/SketchLine_18_StartVertex&Sketch_3/SketchProjection_9_EndVertex")) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchProjection_9f-SketchLine_18f-SketchLine_19f-SketchProjection_8r-SketchProjection_7r", + ) + ], +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 4, + keepSubResults=True, +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection( + "VERTEX", + "AngularCopy_1_1_1/MV:Rotated&Sketch_3/SketchLine_19_StartVertex&Sketch_3/SketchLine_18_EndVertex", + ), + model.selection( + "VERTEX", + "AngularCopy_1_1_4/MV:Rotated&Sketch_3/SketchLine_19_StartVertex&Sketch_3/SketchLine_18_EndVertex", + ), + model.selection( + "VERTEX", + "AngularCopy_1_1_4/MV:Rotated&Sketch_3/SketchLine_18_StartVertex&Sketch_3/SketchProjection_9_EndVertex", + ), +) Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2")) -SketchLine_20 = Sketch_4.addLine(-71.93873905691365, 265.6178566586798, -194.0624420262377, 195.1097038792864) -SketchProjection_10 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_3/SketchLine_18_EndVertex"), False) +SketchLine_20 = Sketch_4.addLine( + -71.93873905691365, 265.6178566586798, -194.0624420262377, 195.1097038792864 +) +SketchProjection_10 = Sketch_4.addProjection( + model.selection("VERTEX", "Sketch_3/SketchLine_18_EndVertex"), False +) SketchPoint_1 = SketchProjection_10.createdFeature() -SketchConstraintCoincidence_17 = Sketch_4.setCoincident(SketchLine_20.startPoint(), SketchPoint_1.result()) -SketchProjection_11 = Sketch_4.addProjection(model.selection("VERTEX", "AngularCopy_1_1_4/MV:Rotated&Sketch_3/SketchLine_19_StartVertex&Sketch_3/SketchLine_18_EndVertex"), False) +SketchConstraintCoincidence_17 = Sketch_4.setCoincident( + SketchLine_20.startPoint(), SketchPoint_1.result() +) +SketchProjection_11 = Sketch_4.addProjection( + model.selection( + "VERTEX", + "AngularCopy_1_1_4/MV:Rotated&Sketch_3/SketchLine_19_StartVertex&Sketch_3/SketchLine_18_EndVertex", + ), + False, +) SketchPoint_2 = SketchProjection_11.createdFeature() -SketchConstraintCoincidence_18 = Sketch_4.setCoincident(SketchLine_20.endPoint(), SketchPoint_2.result()) -SketchProjection_12 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_3/SketchLine_18"), True) +SketchConstraintCoincidence_18 = Sketch_4.setCoincident( + SketchLine_20.endPoint(), SketchPoint_2.result() +) +SketchProjection_12 = Sketch_4.addProjection( + model.selection("EDGE", "Sketch_3/SketchLine_18"), True +) SketchLine_21 = SketchProjection_12.createdFeature() -SketchProjection_13 = Sketch_4.addProjection(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchProjection_3][Extrusion_2_1/To_Face]"), True) +SketchProjection_13 = Sketch_4.addProjection( + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchProjection_3][Extrusion_2_1/To_Face]", + ), + True, +) SketchLine_22 = SketchProjection_13.createdFeature() -SketchProjection_14 = Sketch_4.addProjection(model.selection("EDGE", "AngularCopy_1_1_4/ME:Rotated&Sketch_3/SketchLine_18"), True) +SketchProjection_14 = Sketch_4.addProjection( + model.selection("EDGE", "AngularCopy_1_1_4/ME:Rotated&Sketch_3/SketchLine_18"), True +) SketchLine_23 = SketchProjection_14.createdFeature() model.do() -Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchLine_20r-SketchProjection_14r-SketchProjection_13f-SketchProjection_12f")]) -AngularCopy_2 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OZ"), 4, keepSubResults = True) -Split_2_objects_2 = [model.selection("SOLID", "Extrusion_2_1"), model.selection("COMPOUND", "AngularCopy_1_1"), model.selection("COMPOUND", "AngularCopy_2_1")] -Split_2 = model.addSplit(Part_1_doc, [model.selection("COMPSOLID", "Split_1_1")], Split_2_objects_2, keepSubResults = True) -Group_1_objects = [model.selection("FACE", "Split_2_1_7/Modified_Face&Cylinder_1_1/Face_1"), model.selection("FACE", "Split_2_1_8/Modified_Face&Cylinder_1_1/Face_1"), model.selection("FACE", "Split_2_1_9/Modified_Face&Cylinder_1_1/Face_1"), model.selection("FACE", "Split_2_1_10/Modified_Face&Cylinder_1_1/Face_1")] +Face_2 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_4/Face-SketchLine_20r-SketchProjection_14r-SketchProjection_13f-SketchProjection_12f", + ) + ], +) +AngularCopy_2 = model.addMultiRotation( + Part_1_doc, + [model.selection("FACE", "Face_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 4, + keepSubResults=True, +) +Split_2_objects_2 = [ + model.selection("SOLID", "Extrusion_2_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + model.selection("COMPOUND", "AngularCopy_2_1"), +] +Split_2 = model.addSplit( + Part_1_doc, + [model.selection("COMPSOLID", "Split_1_1")], + Split_2_objects_2, + keepSubResults=True, +) +Group_1_objects = [ + model.selection("FACE", "Split_2_1_7/Modified_Face&Cylinder_1_1/Face_1"), + model.selection("FACE", "Split_2_1_8/Modified_Face&Cylinder_1_1/Face_1"), + model.selection("FACE", "Split_2_1_9/Modified_Face&Cylinder_1_1/Face_1"), + model.selection("FACE", "Split_2_1_10/Modified_Face&Cylinder_1_1/Face_1"), +] Group_1 = model.addGroup(Part_1_doc, "Faces", Group_1_objects) Group_1.setName("shared_face_cyl") Group_1.result().setName("shared_face_cyl") @@ -157,4 +393,4 @@ model.testNbSubShapes(Split_2, GeomAPI_Shape.EDGE, [492]) model.testNbSubShapes(Split_2, GeomAPI_Shape.VERTEX, [984]) model.testResultsVolumes(Split_2, [5093568.888962713]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test1922.py b/src/FeaturesPlugin/Test/Test1922.py index 94ac6aed4..8e04a3c7b 100644 --- a/src/FeaturesPlugin/Test/Test1922.py +++ b/src/FeaturesPlugin/Test/Test1922.py @@ -24,24 +24,48 @@ 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(-717.0963364993213, -45.06817090071282, -254.8675173043772, -45.06817090071281) +SketchLine_1 = Sketch_1.addLine( + -717.0963364993213, -45.06817090071282, -254.8675173043772, -45.06817090071281 +) SketchLine_1.setAuxiliary(True) -SketchLine_2 = Sketch_1.addLine(-254.8675173043772, -45.06817090071281, -254.8675173043772, 193.0685819822336) +SketchLine_2 = Sketch_1.addLine( + -254.8675173043772, -45.06817090071281, -254.8675173043772, 193.0685819822336 +) SketchLine_2.setAuxiliary(True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(-254.8675173043772, 193.0685819822336, -102.0809741405142, 193.0685819822336) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + -254.8675173043772, 193.0685819822336, -102.0809741405142, 193.0685819822336 +) SketchLine_3.setAuxiliary(True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-102.0809741405142, 193.0685819822336, -102.0809741405142, -180.9380775505473) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -102.0809741405142, 193.0685819822336, -102.0809741405142, -180.9380775505473 +) SketchLine_4.setAuxiliary(True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(-102.0809741405142, -180.9380775505473, -717.0963364993213, -180.9380775505473) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + -102.0809741405142, -180.9380775505473, -717.0963364993213, -180.9380775505473 +) SketchLine_5.setAuxiliary(True) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(-717.0963364993213, -180.9380775505473, -717.0963364993213, -45.06817090071282) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + -717.0963364993213, -180.9380775505473, -717.0963364993213, -45.06817090071282 +) SketchLine_6.setAuxiliary(True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.endPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_6.endPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) @@ -49,119 +73,313 @@ SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_2.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) SketchPoint_1 = Sketch_1.addPoint(-684.5318860244231, -45.06817090071282) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_1.result() +) SketchPoint_2 = Sketch_1.addPoint(-599.0502035278153, -45.06817090071282) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.result()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_1.result() +) SketchPoint_3 = Sketch_1.addPoint(-509.4979647218452, -45.06817090071282) SketchPoint_3.setName("SketchPoint_4") SketchPoint_3.result().setName("SketchPoint_4") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_1.result()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_1.result() +) SketchPoint_4 = Sketch_1.addPoint(-429.4436906377204, -45.06817090071282) SketchPoint_4.setName("SketchPoint_5") SketchPoint_4.result().setName("SketchPoint_5") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_1.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_1.result() +) SketchPoint_5 = Sketch_1.addPoint(-356.1736770691994, -45.06817090071282) SketchPoint_5.setName("SketchPoint_6") SketchPoint_5.result().setName("SketchPoint_6") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_1.result()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchPoint_5.coordinates(), SketchLine_1.result() +) SketchPoint_6 = Sketch_1.addPoint(-254.8675173043772, 25.10176390773411) SketchPoint_6.setName("SketchPoint_7") SketchPoint_6.result().setName("SketchPoint_7") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_2.result()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_2.result() +) SketchPoint_7 = Sketch_1.addPoint(-254.8675173043772, 103.7991858887381) SketchPoint_7.setName("SketchPoint_8") SketchPoint_7.result().setName("SketchPoint_8") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchPoint_7.coordinates(), SketchLine_2.result()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchPoint_7.coordinates(), SketchLine_2.result() +) SketchPoint_8 = Sketch_1.addPoint(-196.0651289009498, 193.0685819822336) SketchPoint_8.setName("SketchPoint_9") SketchPoint_8.result().setName("SketchPoint_9") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchPoint_8.coordinates(), SketchLine_3.result()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchPoint_8.coordinates(), SketchLine_3.result() +) SketchPoint_9 = Sketch_1.addPoint(-102.0809741405142, 116.0108548168249) SketchPoint_9.setName("SketchPoint_10") SketchPoint_9.result().setName("SketchPoint_10") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_9.coordinates(), SketchLine_4.result()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchPoint_9.coordinates(), SketchLine_4.result() +) SketchPoint_10 = Sketch_1.addPoint(-102.0809741405142, -118.7245590230665) SketchPoint_10.setName("SketchPoint_11") SketchPoint_10.result().setName("SketchPoint_11") -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchPoint_10.coordinates(), SketchLine_4.result()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchPoint_10.coordinates(), SketchLine_4.result() +) 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()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchPoint_11.coordinates(), SketchLine_5.result() +) 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()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchPoint_12.coordinates(), SketchLine_5.result() +) model.do() -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_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")) +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")) +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") +) SketchPoint_13.setName("SketchPoint_15") SketchPoint_13.result().setName("SketchPoint_15") -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchPoint_13.result()) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_7.startPoint(), SketchPoint_13.result() +) 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()) +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")) 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")) +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") +) 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()) +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")) 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()) +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")) SketchPoint_18.setName("SketchPoint_20") SketchPoint_18.result().setName("SketchPoint_20") -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchPoint_18.result()) -SketchLine_12 = Sketch_2.addLine(-254.8675173043772, -45.06817090071281, -717.0963364993213, -45.06817090071282) -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.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")) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchPoint_18.result() +) +SketchLine_12 = Sketch_2.addLine( + -254.8675173043772, -45.06817090071281, -717.0963364993213, -45.06817090071282 +) +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.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") +) 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")) +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") +) 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")) +SketchConstraintCoincidence_34 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchPoint_20.result() +) +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()) -SketchLine_15 = Sketch_2.addLine(-254.8675173043772, -45.06817090071281, -102.0809741405142, -49.89915168208545) -SketchConstraintCoincidence_36 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchPoint_18.coordinates(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchLine_12.startPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_39 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_9.result()) +SketchConstraintCoincidence_35 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchPoint_21.result() +) +SketchLine_15 = Sketch_2.addLine( + -254.8675173043772, -45.06817090071281, -102.0809741405142, -49.89915168208545 +) +SketchConstraintCoincidence_36 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_37 = Sketch_2.setCoincident( + SketchPoint_18.coordinates(), SketchLine_15.startPoint() +) +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/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")] +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() @@ -169,9 +387,8 @@ model.end() from ModelAPI import * PartitionFeature = Partition_1.feature() -assert(len(PartitionFeature.results()) == 1) +assert len(PartitionFeature.results()) == 1 PartitionResult = modelAPI_ResultBody(PartitionFeature.firstResult()) -assert(PartitionResult.numberOfSubs() == 22) - -assert(model.checkPythonDump()) +assert PartitionResult.numberOfSubs() == 22 +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test1942.py b/src/FeaturesPlugin/Test/Test1942.py index 832c20b9c..f7b331f02 100644 --- a/src/FeaturesPlugin/Test/Test1942.py +++ b/src/FeaturesPlugin/Test/Test1942.py @@ -22,112 +22,229 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Point_2 = model.addPoint(partSet, 100, 40, 70) -Axis_4 = model.addAxis(partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2")) -Plane_4 = model.addPlane(partSet, model.selection("EDGE", "Axis_4"), model.selection("VERTEX", "Point_2"), True) +Axis_4 = model.addAxis( + partSet, model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2") +) +Plane_4 = model.addPlane( + partSet, + model.selection("EDGE", "Axis_4"), + model.selection("VERTEX", "Point_2"), + True, +) 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.024014514861164, -46.57477619916804, -15.03025649976126, -42.91660461599292) +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(-34.15308715195452, -20.5925185611531, -39.51293324824182, 6.356619200673476) +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.024014514861164, -46.57477619916804, -30.86442523156243, -37.12780736470863) +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.86442523156243, -37.12780736470863, -39.51293324824182, 6.356619200673476) +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(-21.88471935002519, 39.79243387785534, 5.516674902531107, 51.5099134867221) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +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.516674902531107, 51.5099134867221, 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()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_4") -SketchLine_7 = Sketch_1.addLine(32.11790618078412, 35.7788047045564, 51.23593736581751, -10.42185420425237) +SketchLine_7 = Sketch_1.addLine( + 32.11790618078412, 35.7788047045564, 51.23593736581751, -10.42185420425237 +) SketchLine_7.setName("SketchLine_6") SketchLine_7.result().setName("SketchLine_6") -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +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.52471395405271, -30.09043472300023) +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 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_6") -SketchLine_9 = Sketch_1.addLine(33.52471395405271, -30.09043472300023, -5.024014514861164, -46.57477619916804) +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 = 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 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_9.endPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_8") -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()) +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()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.endPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_10") -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_1.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_2.result()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_1.startPoint()) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_1.result() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_2.result() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_1.startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_11") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_2.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_2.endPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_12") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.result() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_13") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_4.result()) +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(-10.08923472882396, 12.20862445002239, -39.51293324824182, 6.356619200673476, -21.88471935002519, 39.79243387785534, 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 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_2.endPoint() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_15") -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_2.result()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchArc_2.endPoint()) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_2.result() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchArc_2.endPoint() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_16") -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_5.result(), SketchArc_2.results()[1]) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_5.result(), SketchLine_9.result()) -SketchCircle_1 = Sketch_1.addCircle(2.333185352801025, 5.209035955269018, 34.7006180228472) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchLine_5.result(), SketchArc_2.results()[1] +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_5.result(), SketchLine_9.result() +) +SketchCircle_1 = Sketch_1.addCircle( + 2.333185352801025, 5.209035955269018, 34.7006180228472 +) SketchCircle_1.setName("SketchCircle_2") SketchCircle_1.result().setName("SketchCircle_2") SketchCircle_1.results()[1].setName("SketchCircle_2_2") SketchCircle_1.setAuxiliary(True) -SketchArc_3 = Sketch_1.addArc(2.333185352801025, 5.209035955269018, 9.336485740095949, 23.71540254943274, 4.745637396078732, -14.43051332599376, True) +SketchArc_3 = Sketch_1.addArc( + 2.333185352801025, + 5.209035955269018, + 9.336485740095949, + 23.71540254943274, + 4.745637396078732, + -14.43051332599376, + True, +) SketchArc_3.setName("SketchArc_4") SketchArc_3.result().setName("SketchArc_4") SketchArc_3.results()[1].setName("SketchArc_4_2") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_3.center(), SketchCircle_1.center()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchCircle_1.center() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_17") SketchPoint_1 = Sketch_1.addPoint(-30.48122876352205, 16.49385395867538) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchCircle_1.results()[1] +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_18") SketchPoint_2 = Sketch_1.addPoint(33.38569114717736, 20.69692719513029) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchCircle_1.results()[1] +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_19") SketchPoint_3 = Sketch_1.addPoint(4.745637396078732, -14.43051332599376) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchArc_3.endPoint()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchArc_3.endPoint() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_20") SketchPoint_4 = Sketch_1.addPoint(9.336485740095949, 23.71540254943274) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchArc_3.startPoint()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchArc_3.startPoint() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_21") -SketchArc_4 = Sketch_1.addArc(2.333185352801027, 5.209035955269019, 9.336485740095949, 23.71540254943274, 4.745637396078732, -14.43051332599376, False) +SketchArc_4 = Sketch_1.addArc( + 2.333185352801027, + 5.209035955269019, + 9.336485740095949, + 23.71540254943274, + 4.745637396078732, + -14.43051332599376, + False, +) SketchArc_4.setName("SketchArc_3") SketchArc_4.result().setName("SketchArc_3") SketchArc_4.results()[1].setName("SketchArc_3_2") -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchArc_4.endPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchArc_4.endPoint() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_22") -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchArc_4.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchArc_4.startPoint() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_23") -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchArc_3.results()[1]) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchPoint_3.coordinates()) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchArc_3.results()[1] +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchPoint_3.coordinates() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_24") -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchPoint_4.coordinates()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchArc_4.startPoint(), SketchPoint_4.coordinates() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_25") SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), "a/2") model.do() @@ -135,89 +252,199 @@ Sketch_1.result().setColor(85, 255, 0) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_5 = Sketch_2.addPoint(27.94100551732842, 60.77708330244815) SketchPoint_5.setAuxiliary(True) -SketchArc_5 = Sketch_2.addArc(29.50596093963414, 45.389553391128, 31.03624924456759, 29.99853718200911, 27.94100551732842, 60.77708330244815, True) +SketchArc_5 = Sketch_2.addArc( + 29.50596093963414, + 45.389553391128, + 31.03624924456759, + 29.99853718200911, + 27.94100551732842, + 60.77708330244815, + True, +) SketchArc_5.setName("SketchArc_6") SketchArc_5.result().setName("SketchArc_6") SketchArc_5.results()[1].setName("SketchArc_6_2") -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchPoint_5.coordinates(), SketchArc_5.endPoint()) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchPoint_5.coordinates(), SketchArc_5.endPoint() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_26") SketchPoint_6 = Sketch_2.addPoint(31.03624924456759, 29.99853718200911) SketchPoint_6.setAuxiliary(True) -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchPoint_6.coordinates(), SketchArc_5.startPoint()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchPoint_6.coordinates(), SketchArc_5.startPoint() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_27") -SketchArc_6 = Sketch_2.addArc(29.50596093963414, 45.389553391128, 31.03624924456759, 29.99853718200911, 27.94100551732842, 60.77708330244815, False) +SketchArc_6 = Sketch_2.addArc( + 29.50596093963414, + 45.389553391128, + 31.03624924456759, + 29.99853718200911, + 27.94100551732842, + 60.77708330244815, + False, +) SketchArc_6.setName("SketchArc_5") SketchArc_6.result().setName("SketchArc_5") SketchArc_6.results()[1].setName("SketchArc_5_2") -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchArc_6.endPoint()) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchArc_5.endPoint(), SketchArc_6.endPoint() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_28") -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchArc_5.startPoint(), SketchArc_6.startPoint()) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchArc_5.startPoint(), SketchArc_6.startPoint() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_29") -SketchConstraintTangent_6 = Sketch_2.setTangent(SketchArc_6.results()[1], SketchArc_5.results()[1]) -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchArc_6.startPoint(), SketchPoint_6.coordinates()) +SketchConstraintTangent_6 = Sketch_2.setTangent( + SketchArc_6.results()[1], SketchArc_5.results()[1] +) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchArc_6.startPoint(), SketchPoint_6.coordinates() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_30") -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchArc_6.endPoint(), SketchPoint_5.coordinates()) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchArc_6.endPoint(), SketchPoint_5.coordinates() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_31") -SketchLine_10 = Sketch_2.addLine(28.46272147483239, 70.73361683339229, 38.77955906494226, 70.73651278326217) +SketchLine_10 = Sketch_2.addLine( + 28.46272147483239, 70.73361683339229, 38.77955906494226, 70.73651278326217 +) SketchLine_10.setName("SketchLine_11") SketchLine_10.result().setName("SketchLine_11") SketchLine_10.setAuxiliary(True) SketchPoint_7 = Sketch_2.addPoint(28.46272147483239, 70.73361683339229) -SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchPoint_7.coordinates(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_30 = Sketch_2.setCoincident( + SketchPoint_7.coordinates(), SketchLine_10.startPoint() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_32") -SketchLine_11 = Sketch_2.addLine(16.42641095303756, 70.73023822521078, 28.46272147483239, 70.73361683339229) +SketchLine_11 = Sketch_2.addLine( + 16.42641095303756, 70.73023822521078, 28.46272147483239, 70.73361683339229 +) SketchLine_11.setName("SketchLine_12") SketchLine_11.result().setName("SketchLine_12") -SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_31 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_10.startPoint() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_33") -SketchConstraintParallel_2 = Sketch_2.setParallel(SketchLine_10.result(), SketchLine_11.result()) -SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchPoint_7.coordinates()) +SketchConstraintParallel_2 = Sketch_2.setParallel( + SketchLine_10.result(), SketchLine_11.result() +) +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_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")]) +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_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")] +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "PartSet/Axis_4"), + model.selection("VERTEX", "PartSet/Point_2"), + True, +) +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")]) +Intersection_1 = model.addIntersection( + Part_1_doc, + [model.selection("SOLID", "Recover_1_1"), model.selection("FACE", "Face_1_1")], +) Group_1_objects = [ -model.selection("VERTEX", "Intersection_1_1_3/Modified_Vertex&Sketch_1/SketchLine_1_StartVertex&Sketch_1/SketchLine_8_EndVertex"), -model.selection("VERTEX", "[Intersection_1_1_1/Intersection_1_1_1]e[weak_name_2]"), -model.selection("VERTEX", "Intersection_1_1_9/Modified_Vertex&Sketch_1/SketchLine_5_StartVertex&Sketch_1/SketchLine_4_EndVertex"), -model.selection("VERTEX", "Intersection_1_1_7/Modified_Vertex&Sketch_1/SketchLine_7_StartVertex&Sketch_1/SketchLine_6_EndVertex"), -model.selection("VERTEX", "[Intersection_1_1_4/Intersection_1_1_4]e[weak_name_2]"), -model.selection("VERTEX", "[Intersection_1_1_1/Intersection_1_1_1]e[weak_name_1]"), -model.selection("VERTEX", "Intersection_1_1_2/Modified_Vertex&Sketch_1/SketchLine_2_EndVertex&Sketch_1/SketchArc_2_2_EndVertex"), -model.selection("VERTEX", "[Intersection_1_1_4/Intersection_1_1_4]e[weak_name_1]"), -model.selection("VERTEX", "Intersection_1_1_6/Modified_Vertex&Sketch_1/SketchLine_8_StartVertex&Sketch_1/SketchLine_7_EndVertex"), -model.selection("VERTEX", "Intersection_1_1_10/Modified_Vertex&Sketch_1/SketchLine_4_StartVertex&Sketch_1/SketchArc_2_2_StartVertex"), -model.selection("VERTEX", "Intersection_1_1_8/Modified_Vertex&Sketch_1/SketchLine_6_StartVertex&Sketch_1/SketchLine_5_EndVertex")] + model.selection( + "VERTEX", + "Intersection_1_1_3/Modified_Vertex&Sketch_1/SketchLine_1_StartVertex&Sketch_1/SketchLine_8_EndVertex", + ), + model.selection("VERTEX", "[Intersection_1_1_1/Intersection_1_1_1]e[weak_name_2]"), + model.selection( + "VERTEX", + "Intersection_1_1_9/Modified_Vertex&Sketch_1/SketchLine_5_StartVertex&Sketch_1/SketchLine_4_EndVertex", + ), + model.selection( + "VERTEX", + "Intersection_1_1_7/Modified_Vertex&Sketch_1/SketchLine_7_StartVertex&Sketch_1/SketchLine_6_EndVertex", + ), + model.selection("VERTEX", "[Intersection_1_1_4/Intersection_1_1_4]e[weak_name_2]"), + model.selection("VERTEX", "[Intersection_1_1_1/Intersection_1_1_1]e[weak_name_1]"), + model.selection( + "VERTEX", + "Intersection_1_1_2/Modified_Vertex&Sketch_1/SketchLine_2_EndVertex&Sketch_1/SketchArc_2_2_EndVertex", + ), + model.selection("VERTEX", "[Intersection_1_1_4/Intersection_1_1_4]e[weak_name_1]"), + model.selection( + "VERTEX", + "Intersection_1_1_6/Modified_Vertex&Sketch_1/SketchLine_8_StartVertex&Sketch_1/SketchLine_7_EndVertex", + ), + model.selection( + "VERTEX", + "Intersection_1_1_10/Modified_Vertex&Sketch_1/SketchLine_4_StartVertex&Sketch_1/SketchArc_2_2_StartVertex", + ), + model.selection( + "VERTEX", + "Intersection_1_1_8/Modified_Vertex&Sketch_1/SketchLine_6_StartVertex&Sketch_1/SketchLine_5_EndVertex", + ), +] 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_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() aSelectionList = aGroupFeature.selectionList("group_list") -assert(aSelectionList.size() == 11) +assert aSelectionList.size() == 11 for index in range(0, aSelectionList.size()): - attrSelection = aSelectionList.value(index) - shape = attrSelection.value() - name = attrSelection.namingName() - assert(shape.isVertex()) - assert(name) + attrSelection = aSelectionList.value(index) + shape = attrSelection.value() + name = attrSelection.namingName() + assert shape.isVertex() + assert name aGroupFeature = Group_2.feature() aSelectionList = aGroupFeature.selectionList("group_list") -assert(aSelectionList.size() == 11) +assert aSelectionList.size() == 11 for index in range(0, aSelectionList.size()): - attrSelection = aSelectionList.value(index) - shape = attrSelection.value() - name = attrSelection.namingName() - assert(shape.isEdge()) - assert(name) + attrSelection = aSelectionList.value(index) + shape = attrSelection.value() + name = attrSelection.namingName() + assert shape.isEdge() + assert name -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test19931.py b/src/FeaturesPlugin/Test/Test19931.py index 915fcff23..842fa5dbd 100644 --- a/src/FeaturesPlugin/Test/Test19931.py +++ b/src/FeaturesPlugin/Test/Test19931.py @@ -40,17 +40,29 @@ SketchLine_2 = Sketch_1.addLine(35, 66, 35, 87.99999999999999) Sketch_1.setVertical(SketchLine_2.result()) ### Create SketchLine -SketchLine_3 = Sketch_1.addLine(35, 87.99999999999999, 75.00000000000001, 87.99999999999999) +SketchLine_3 = Sketch_1.addLine( + 35, 87.99999999999999, 75.00000000000001, 87.99999999999999 +) Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) Sketch_1.setHorizontal(SketchLine_3.result()) ### Create SketchLine -SketchLine_4 = Sketch_1.addLine(75.00000000000001, 87.99999999999999, 75.00000000000001, 78) +SketchLine_4 = Sketch_1.addLine( + 75.00000000000001, 87.99999999999999, 75.00000000000001, 78 +) Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) Sketch_1.setVertical(SketchLine_4.result()) ### Create SketchArc -SketchArc_1 = Sketch_1.addArc(75.00000000000004, 71.99999999999689, 75.00000000000001, 78, 69, 71.99999999999613, False) +SketchArc_1 = Sketch_1.addArc( + 75.00000000000004, + 71.99999999999689, + 75.00000000000001, + 78, + 69, + 71.99999999999613, + False, +) Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchArc_1.startPoint()) ### Create SketchLine @@ -59,12 +71,16 @@ Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_5.startPoint()) Sketch_1.setVertical(SketchLine_5.result()) ### Create SketchArc -SketchArc_2 = Sketch_1.addArc(57, 52.00000000001324, 69, 52.00000000001324, 57.0000000000007, 40, True) +SketchArc_2 = Sketch_1.addArc( + 57, 52.00000000001324, 69, 52.00000000001324, 57.0000000000007, 40, True +) Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchArc_2.startPoint()) Sketch_1.setTangent(SketchLine_5.result(), SketchArc_2.results()[1]) ### Create SketchArc -SketchArc_3 = Sketch_1.addArc(57, 27.99999999998618, 57.0000000000007, 40, 45, 27.99999999998618, False) +SketchArc_3 = Sketch_1.addArc( + 57, 27.99999999998618, 57.0000000000007, 40, 45, 27.99999999998618, False +) Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.startPoint()) Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1]) @@ -73,7 +89,9 @@ SketchLine_6 = Sketch_1.addLine(45, 27.99999999998618, 45, 0) Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_6.startPoint()) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_7 = SketchProjection_1.createdFeature() Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.result()) Sketch_1.setVertical(SketchLine_6.result()) @@ -81,10 +99,14 @@ Sketch_1.setVertical(SketchLine_6.result()) ### Create SketchLine SketchLine_8 = Sketch_1.addLine(45, 0, 0, 0) Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_8.startPoint()) -Sketch_1.setCoincident(SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_8.endPoint()) +Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_8.endPoint() +) ### Create SketchProjection -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_9 = SketchProjection_2.createdFeature() Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_9.result()) Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_6.result()) @@ -100,13 +122,17 @@ Sketch_1.setVerticalDistance(SketchArc_3.startPoint(), SketchArc_1.startPoint(), Sketch_1.setDistance(SketchLine_9.result(), SketchLine_5.startPoint(), "138/2", True) ### Create SketchLine -SketchLine_10 = Sketch_1.addLine(-75.00000000000001, 77.99999999999693, -50.99999999999996, 78) +SketchLine_10 = Sketch_1.addLine( + -75.00000000000001, 77.99999999999693, -50.99999999999996, 78 +) SketchLine_10.setName("SketchLine_17") SketchLine_10.result().setName("SketchLine_17") Sketch_1.setHorizontal(SketchLine_10.result()) ### Create SketchArc -SketchArc_4 = Sketch_1.addArc(-50.99999999999996, 72, -50.99999999999996, 78, -44.99999999999996, 72, True) +SketchArc_4 = Sketch_1.addArc( + -50.99999999999996, 72, -50.99999999999996, 78, -44.99999999999996, 72, True +) SketchArc_4.setName("SketchArc_7") SketchArc_4.result().setName("SketchArc_7") SketchArc_4.results()[1].setName("SketchArc_7_2") @@ -114,7 +140,9 @@ Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_4.startPoint()) Sketch_1.setTangent(SketchLine_10.result(), SketchArc_4.results()[1]) ### Create SketchArc -SketchArc_5 = Sketch_1.addArc(-28, 49.99999999999999, -28, 52.99999999999999, -25, 49.99999999999999, True) +SketchArc_5 = Sketch_1.addArc( + -28, 49.99999999999999, -28, 52.99999999999999, -25, 49.99999999999999, True +) SketchArc_5.setName("SketchArc_9") SketchArc_5.result().setName("SketchArc_9") SketchArc_5.results()[1].setName("SketchArc_9_2") @@ -141,21 +169,33 @@ Sketch_1.setRadius(SketchCircle_1.results()[1], 25) Sketch_1.setRadius(SketchCircle_2.results()[1], 16) ### Create SketchLine -SketchLine_12 = Sketch_1.addLine(-44.99999999999996, 72, -44.99999999999998, 64.99999999999999) +SketchLine_12 = Sketch_1.addLine( + -44.99999999999996, 72, -44.99999999999998, 64.99999999999999 +) SketchLine_12.setName("SketchLine_19") SketchLine_12.result().setName("SketchLine_19") Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_12.startPoint()) Sketch_1.setVertical(SketchLine_12.result()) ### Create SketchLine -SketchLine_13 = Sketch_1.addLine(-28, 52.99999999999999, -32.99999999999998, 52.99999999999999) +SketchLine_13 = Sketch_1.addLine( + -28, 52.99999999999999, -32.99999999999998, 52.99999999999999 +) SketchLine_13.setName("SketchLine_20") SketchLine_13.result().setName("SketchLine_20") Sketch_1.setCoincident(SketchArc_5.startPoint(), SketchLine_13.startPoint()) Sketch_1.setHorizontal(SketchLine_13.result()) ### Create SketchArc -SketchArc_6 = Sketch_1.addArc(-32.99999999999998, 64.99999999999999, -44.99999999999998, 64.99999999999999, -32.99999999999998, 52.99999999999999, False) +SketchArc_6 = Sketch_1.addArc( + -32.99999999999998, + 64.99999999999999, + -44.99999999999998, + 64.99999999999999, + -32.99999999999998, + 52.99999999999999, + False, +) SketchArc_6.setName("SketchArc_10") SketchArc_6.result().setName("SketchArc_10") SketchArc_6.results()[1].setName("SketchArc_10_2") @@ -184,9 +224,35 @@ SketchArc_7.result().setName("SketchArc_11") SketchArc_7.results()[1].setName("SketchArc_11_2") ### Create SketchConstraintMirror -SketchConstraintMirror_1_objects = [SketchLine_4.result(), SketchLine_5.result(), SketchLine_1.result(), SketchLine_3.result(), SketchLine_2.result(), SketchLine_6.result(), SketchLine_8.result(), SketchArc_1.results()[1], SketchArc_3.results()[1], SketchArc_2.results()[1], SketchArc_7.results()[1]] -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_9.result(), SketchConstraintMirror_1_objects) -[SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18, SketchLine_19, SketchLine_20, SketchLine_21, SketchArc_8, SketchArc_9, SketchArc_10, SketchArc_11] = SketchConstraintMirror_1.mirrored() +SketchConstraintMirror_1_objects = [ + SketchLine_4.result(), + SketchLine_5.result(), + SketchLine_1.result(), + SketchLine_3.result(), + SketchLine_2.result(), + SketchLine_6.result(), + SketchLine_8.result(), + SketchArc_1.results()[1], + SketchArc_3.results()[1], + SketchArc_2.results()[1], + SketchArc_7.results()[1], +] +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_9.result(), SketchConstraintMirror_1_objects +) +[ + SketchLine_15, + SketchLine_16, + SketchLine_17, + SketchLine_18, + SketchLine_19, + SketchLine_20, + SketchLine_21, + SketchArc_8, + SketchArc_9, + SketchArc_10, + SketchArc_11, +] = SketchConstraintMirror_1.mirrored() SketchArc_11.setName("SketchArc_12") SketchArc_11.result().setName("SketchArc_12") SketchArc_11.results()[1].setName("SketchArc_12_2") @@ -213,8 +279,12 @@ SketchLine_16.setName("SketchLine_11") SketchLine_16.result().setName("SketchLine_11") SketchLine_15.setName("SketchLine_10") SketchLine_15.result().setName("SketchLine_10") -Sketch_1.setCoincident(SketchAPI_Line(SketchLine_15).endPoint(), SketchLine_10.startPoint()) -Sketch_1.setDistance(SketchLine_12.result(), SketchAPI_Line(SketchLine_17).startPoint(), 45, True) +Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_15).endPoint(), SketchLine_10.startPoint() +) +Sketch_1.setDistance( + SketchLine_12.result(), SketchAPI_Line(SketchLine_17).startPoint(), 45, True +) Sketch_1.setDistance(SketchLine_18.result(), SketchLine_14.endPoint(), 60, True) Sketch_1.setDistance(SketchLine_17.result(), SketchLine_13.startPoint(), 10, True) @@ -232,9 +302,27 @@ Sketch_1.setTangent(SketchArc_7.results()[1], SketchLine_2.result()) Sketch_1.setRadius(SketchArc_7.results()[1], 3) ### Create SketchConstraintMirror -SketchConstraintMirror_2_objects = [SketchLine_10.result(), SketchArc_4.results()[1], SketchLine_12.result(), SketchArc_6.results()[1], SketchLine_13.result(), SketchArc_5.results()[1], SketchLine_11.result()] -SketchConstraintMirror_2 = Sketch_1.addMirror(SketchLine_9.result(), SketchConstraintMirror_2_objects) -[SketchLine_22, SketchArc_12, SketchLine_23, SketchArc_13, SketchLine_24, SketchArc_14, SketchLine_25] = SketchConstraintMirror_2.mirrored() +SketchConstraintMirror_2_objects = [ + SketchLine_10.result(), + SketchArc_4.results()[1], + SketchLine_12.result(), + SketchArc_6.results()[1], + SketchLine_13.result(), + SketchArc_5.results()[1], + SketchLine_11.result(), +] +SketchConstraintMirror_2 = Sketch_1.addMirror( + SketchLine_9.result(), SketchConstraintMirror_2_objects +) +[ + SketchLine_22, + SketchArc_12, + SketchLine_23, + SketchArc_13, + SketchLine_24, + SketchArc_14, + SketchLine_25, +] = SketchConstraintMirror_2.mirrored() SketchArc_14.setName("SketchArc_15") SketchArc_14.result().setName("SketchArc_15") SketchArc_14.results()[1].setName("SketchArc_15_2") @@ -247,41 +335,93 @@ SketchArc_12.results()[1].setName("SketchArc_13_2") model.do() ### Create Extrusion -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_22f-SketchArc_13_2f-SketchLine_23f-SketchArc_14_2r-SketchLine_24r-SketchArc_15_2f-SketchLine_25f-SketchCircle_1_2r-SketchLine_18r-SketchArc_9_2f-SketchLine_20f-SketchArc_10_2r-SketchLine_19r-SketchArc_7_2f-SketchLine_17r-SketchArc_4_2r-SketchLine_11f-SketchArc_6_2f-SketchArc_5_2r-SketchLine_15f-SketchLine_16f-SketchLine_8r-SketchLine_6r-SketchArc_3_2r-SketchArc_2_2f-SketchLine_5r-SketchArc_1_2r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_22f-SketchArc_13_2f-SketchLine_23f-SketchArc_14_2r-SketchLine_24r-SketchArc_15_2f-SketchLine_25f-SketchCircle_1_2r-SketchLine_18r-SketchArc_9_2f-SketchLine_20f-SketchArc_10_2r-SketchLine_19r-SketchArc_7_2f-SketchLine_17r-SketchArc_4_2r-SketchLine_11f-SketchArc_6_2f-SketchArc_5_2r-SketchLine_15f-SketchLine_16f-SketchLine_8r-SketchLine_6r-SketchArc_3_2r-SketchArc_2_2f-SketchLine_5r-SketchArc_1_2r", + ) + ], + model.selection(), + 10, + 0, +) ### Create Extrusion -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_12f-SketchArc_12_2r-SketchLine_14f-SketchLine_13f-SketchLine_10f-SketchLine_17f-SketchArc_7_2r-SketchLine_19f-SketchArc_10_2f-SketchLine_20r-SketchArc_9_2r-SketchLine_18f-SketchCircle_1_2r-SketchLine_25r-SketchArc_15_2r-SketchLine_24f-SketchArc_14_2f-SketchLine_23r-SketchArc_13_2r-SketchLine_22r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchArc_11_2r-SketchLine_1r")], model.selection(), 35, 0) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_12f-SketchArc_12_2r-SketchLine_14f-SketchLine_13f-SketchLine_10f-SketchLine_17f-SketchArc_7_2r-SketchLine_19f-SketchArc_10_2f-SketchLine_20r-SketchArc_9_2r-SketchLine_18f-SketchCircle_1_2r-SketchLine_25r-SketchArc_15_2r-SketchLine_24f-SketchArc_14_2f-SketchLine_23r-SketchArc_13_2r-SketchLine_22r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchArc_11_2r-SketchLine_1r", + ) + ], + model.selection(), + 35, + 0, +) ### Create Extrusion -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_1_2f-SketchCircle_2_2r")], model.selection(), 45, 0) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_1_2f-SketchCircle_2_2r", + ) + ], + model.selection(), + 45, + 0, +) ### Create Sketch -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_1/SketchLine_22")) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_1/SketchLine_22"), +) ### Create SketchCircle SketchCircle_3 = Sketch_2.addCircle(63, 23, 5) Sketch_2.setRadius(SketchCircle_3.results()[1], 5) ### Create SketchProjection -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_26 = SketchProjection_3.createdFeature() Sketch_2.setDistance(SketchCircle_3.center(), SketchLine_26.result(), "126/2", True) ### Create SketchProjection -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_27 = SketchProjection_4.createdFeature() Sketch_2.setDistance(SketchCircle_3.center(), SketchLine_27.result(), 23, True) ### Create SketchConstraintMirror -SketchConstraintMirror_3 = Sketch_2.addMirror(SketchLine_26.result(), [SketchCircle_3.results()[1]]) +SketchConstraintMirror_3 = Sketch_2.addMirror( + SketchLine_26.result(), [SketchCircle_3.results()[1]] +) [SketchCircle_4] = SketchConstraintMirror_3.mirrored() model.do() ### Create ExtrusionCut -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_2")], model.selection(), 0, 10, [model.selection("SOLID", "Extrusion_2_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_2")], + model.selection(), + 0, + 10, + [model.selection("SOLID", "Extrusion_2_1")], +) ### Create Sketch -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6")) +Sketch_3 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6"), +) ### Create SketchLine SketchLine_28 = Sketch_3.addLine(0, 0, 9, -55.99999999999999) @@ -295,18 +435,34 @@ SketchCircle_6 = Sketch_3.addCircle(28, -56, 10) Sketch_3.setCoincident(SketchCircle_5.center(), SketchCircle_6.center()) ### Create SketchLine -SketchLine_29 = Sketch_3.addLine(47, -55.99999999999999, 56.26584765647708, -18.93660937409168) +SketchLine_29 = Sketch_3.addLine( + 47, -55.99999999999999, 56.26584765647708, -18.93660937409168 +) Sketch_3.setCoincident(SketchLine_29.startPoint(), SketchCircle_5.results()[1]) Sketch_3.setRadius(SketchCircle_5.results()[1], "38/2") Sketch_3.setRadius(SketchCircle_6.results()[1], 10) ### Create SketchProjection -SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"), False) +SketchProjection_5 = Sketch_3.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ), + False, +) SketchPoint_2 = SketchProjection_5.createdFeature() -Sketch_3.setCoincident(SketchLine_28.startPoint(), SketchAPI_Point(SketchPoint_2).coordinates()) +Sketch_3.setCoincident( + SketchLine_28.startPoint(), SketchAPI_Point(SketchPoint_2).coordinates() +) ### Create SketchProjection -SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"), False) +SketchProjection_6 = Sketch_3.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ), + False, +) SketchLine_30 = SketchProjection_6.createdFeature() Sketch_3.setDistance(SketchCircle_5.center(), SketchLine_30.result(), 56, True) @@ -321,7 +477,13 @@ Sketch_3.setCoincident(SketchLine_28.endPoint(), SketchLine_31.startPoint()) Sketch_3.setCoincident(SketchLine_29.startPoint(), SketchLine_31.endPoint()) ### Create SketchProjection -SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"), False) +SketchProjection_7 = Sketch_3.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ), + False, +) SketchLine_32 = SketchProjection_7.createdFeature() Sketch_3.setDistance(SketchCircle_6.center(), SketchLine_32.result(), 28, True) @@ -334,11 +496,25 @@ Sketch_3.setCollinear(SketchLine_33.result(), SketchLine_29.result()) Sketch_3.setHorizontalDistance(SketchCircle_5.center(), SketchLine_33.endPoint(), 33) ### Create SketchProjection -SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_23][Extrusion_1_1/From_Face]"), False) +SketchProjection_8 = Sketch_3.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_23][Extrusion_1_1/From_Face]", + ), + False, +) SketchLine_34 = SketchProjection_8.createdFeature() ### Create SketchArc -SketchArc_15 = Sketch_3.addArc(80.51941016011038, -25, 56.26584765647708, -18.93660937409168, 80.519344153399, 0, True) +SketchArc_15 = Sketch_3.addArc( + 80.51941016011038, + -25, + 56.26584765647708, + -18.93660937409168, + 80.519344153399, + 0, + True, +) SketchArc_15.setName("SketchArc_16") SketchArc_15.result().setName("SketchArc_16") SketchArc_15.results()[1].setName("SketchArc_16_2") @@ -353,27 +529,77 @@ SketchLine_35 = Sketch_3.addLine(0, 0, 80.519344153399, 0) Sketch_3.setCoincident(SketchLine_28.startPoint(), SketchLine_35.startPoint()) Sketch_3.setCoincident(SketchArc_15.endPoint(), SketchLine_35.endPoint()) model.do() -Sketch_3.changeFacesOrder([[SketchCircle_6.results()[1]], - [SketchLine_28.result(), SketchCircle_5.results()[1], SketchCircle_5.results()[1], SketchLine_29.result(), SketchArc_15.results()[1], SketchLine_35.result()], - [SketchCircle_5.results()[1], SketchCircle_5.results()[1], SketchCircle_5.results()[1], SketchCircle_6.results()[1]] - ]) +Sketch_3.changeFacesOrder( + [ + [SketchCircle_6.results()[1]], + [ + SketchLine_28.result(), + SketchCircle_5.results()[1], + SketchCircle_5.results()[1], + SketchLine_29.result(), + SketchArc_15.results()[1], + SketchLine_35.result(), + ], + [ + SketchCircle_5.results()[1], + SketchCircle_5.results()[1], + SketchCircle_5.results()[1], + SketchCircle_6.results()[1], + ], + ] +) model.do() ### Create Extrusion -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_28r-SketchCircle_5_2r-SketchCircle_5_2r-SketchLine_29f-SketchArc_16_2r-SketchLine_35r")], model.selection(), 0, 10) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_28r-SketchCircle_5_2r-SketchCircle_5_2r-SketchLine_29f-SketchArc_16_2r-SketchLine_35r", + ) + ], + model.selection(), + 0, + 10, +) ### Create Extrusion -Extrusion_5 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_5_2f-SketchCircle_5_2f-SketchCircle_5_2f-SketchCircle_6_2r")], model.selection(), 3, 13) +Extrusion_5 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchCircle_5_2f-SketchCircle_5_2f-SketchCircle_5_2f-SketchCircle_6_2r", + ) + ], + model.selection(), + 3, + 13, +) ### Create Symmetry -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_4"), model.selection("COMPOUND", "all-in-Extrusion_5")], model.selection("FACE", "PartSet/YOZ"), keepOriginal = True, keepSubResults = True) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Extrusion_4"), + model.selection("COMPOUND", "all-in-Extrusion_5"), + ], + model.selection("FACE", "PartSet/YOZ"), + keepOriginal=True, + keepSubResults=True, +) ### Create Fuse -Fuse_1_objects_1 = [model.selection("COMPOUND", "all-in-Extrusion_1"), - model.selection("COMPOUND", "all-in-Extrusion_3"), - model.selection("COMPOUND", "all-in-ExtrusionCut_1"), - model.selection("COMPOUND", "all-in-Symmetry_1")] -Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1, removeEdges = True, keepSubResults = True) +Fuse_1_objects_1 = [ + model.selection("COMPOUND", "all-in-Extrusion_1"), + model.selection("COMPOUND", "all-in-Extrusion_3"), + model.selection("COMPOUND", "all-in-ExtrusionCut_1"), + model.selection("COMPOUND", "all-in-Symmetry_1"), +] +Fuse_1 = model.addFuse( + Part_1_doc, Fuse_1_objects_1, removeEdges=True, keepSubResults=True +) model.do() @@ -394,17 +620,29 @@ SketchLine_37 = Sketch_4.addLine(35, 66, 35, 87.99999999999999) Sketch_4.setVertical(SketchLine_37.result()) ### Create SketchLine -SketchLine_38 = Sketch_4.addLine(35, 87.99999999999999, 75.00000000000001, 87.99999999999999) +SketchLine_38 = Sketch_4.addLine( + 35, 87.99999999999999, 75.00000000000001, 87.99999999999999 +) Sketch_4.setCoincident(SketchLine_37.endPoint(), SketchLine_38.startPoint()) Sketch_4.setHorizontal(SketchLine_38.result()) ### Create SketchLine -SketchLine_39 = Sketch_4.addLine(75.00000000000001, 87.99999999999999, 75.00000000000001, 78) +SketchLine_39 = Sketch_4.addLine( + 75.00000000000001, 87.99999999999999, 75.00000000000001, 78 +) Sketch_4.setCoincident(SketchLine_38.endPoint(), SketchLine_39.startPoint()) Sketch_4.setVertical(SketchLine_39.result()) ### Create SketchArc -SketchArc_16 = Sketch_4.addArc(75.00000000000004, 71.99999999999689, 75.00000000000001, 78, 69, 71.99999999999613, False) +SketchArc_16 = Sketch_4.addArc( + 75.00000000000004, + 71.99999999999689, + 75.00000000000001, + 78, + 69, + 71.99999999999613, + False, +) Sketch_4.setCoincident(SketchLine_39.endPoint(), SketchArc_16.startPoint()) ### Create SketchLine @@ -413,12 +651,16 @@ Sketch_4.setCoincident(SketchArc_16.endPoint(), SketchLine_40.startPoint()) Sketch_4.setVertical(SketchLine_40.result()) ### Create SketchArc -SketchArc_17 = Sketch_4.addArc(57, 52.00000000001324, 69, 52.00000000001324, 57.0000000000007, 40, True) +SketchArc_17 = Sketch_4.addArc( + 57, 52.00000000001324, 69, 52.00000000001324, 57.0000000000007, 40, True +) Sketch_4.setCoincident(SketchLine_40.endPoint(), SketchArc_17.startPoint()) Sketch_4.setTangent(SketchLine_40.result(), SketchArc_17.results()[1]) ### Create SketchArc -SketchArc_18 = Sketch_4.addArc(57, 27.99999999998618, 57.0000000000007, 40, 45, 27.99999999998618, False) +SketchArc_18 = Sketch_4.addArc( + 57, 27.99999999998618, 57.0000000000007, 40, 45, 27.99999999998618, False +) Sketch_4.setCoincident(SketchArc_17.endPoint(), SketchArc_18.startPoint()) Sketch_4.setTangent(SketchArc_17.results()[1], SketchArc_18.results()[1]) @@ -427,7 +669,9 @@ SketchLine_41 = Sketch_4.addLine(45, 27.99999999998618, 45, 0) Sketch_4.setCoincident(SketchArc_18.endPoint(), SketchLine_41.startPoint()) ### Create SketchProjection -SketchProjection_9 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_9 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_42 = SketchProjection_9.createdFeature() Sketch_4.setCoincident(SketchLine_41.endPoint(), SketchLine_42.result()) Sketch_4.setVertical(SketchLine_41.result()) @@ -435,10 +679,14 @@ Sketch_4.setVertical(SketchLine_41.result()) ### Create SketchLine SketchLine_43 = Sketch_4.addLine(45, 0, 0, 0) Sketch_4.setCoincident(SketchLine_41.endPoint(), SketchLine_43.startPoint()) -Sketch_4.setCoincident(SketchAPI_Line(SketchLine_42).startPoint(), SketchLine_43.endPoint()) +Sketch_4.setCoincident( + SketchAPI_Line(SketchLine_42).startPoint(), SketchLine_43.endPoint() +) ### Create SketchProjection -SketchProjection_10 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_10 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_44 = SketchProjection_10.createdFeature() Sketch_4.setCoincident(SketchLine_36.startPoint(), SketchLine_44.result()) Sketch_4.setTangent(SketchArc_18.results()[1], SketchLine_41.result()) @@ -454,13 +702,17 @@ Sketch_4.setVerticalDistance(SketchArc_18.startPoint(), SketchArc_16.startPoint( Sketch_4.setDistance(SketchLine_44.result(), SketchLine_40.startPoint(), "138/2", True) ### Create SketchLine -SketchLine_45 = Sketch_4.addLine(-75.00000000000001, 77.99999999999693, -50.99999999999996, 78) +SketchLine_45 = Sketch_4.addLine( + -75.00000000000001, 77.99999999999693, -50.99999999999996, 78 +) SketchLine_45.setName("SketchLine_17") SketchLine_45.result().setName("SketchLine_17") Sketch_4.setHorizontal(SketchLine_45.result()) ### Create SketchArc -SketchArc_19 = Sketch_4.addArc(-50.99999999999996, 72, -50.99999999999996, 78, -44.99999999999996, 72, True) +SketchArc_19 = Sketch_4.addArc( + -50.99999999999996, 72, -50.99999999999996, 78, -44.99999999999996, 72, True +) SketchArc_19.setName("SketchArc_7") SketchArc_19.result().setName("SketchArc_7") SketchArc_19.results()[1].setName("SketchArc_7_2") @@ -468,7 +720,9 @@ Sketch_4.setCoincident(SketchLine_45.endPoint(), SketchArc_19.startPoint()) Sketch_4.setTangent(SketchLine_45.result(), SketchArc_19.results()[1]) ### Create SketchArc -SketchArc_20 = Sketch_4.addArc(-28, 49.99999999999999, -28, 52.99999999999999, -25, 49.99999999999999, True) +SketchArc_20 = Sketch_4.addArc( + -28, 49.99999999999999, -28, 52.99999999999999, -25, 49.99999999999999, True +) SketchArc_20.setName("SketchArc_9") SketchArc_20.result().setName("SketchArc_9") SketchArc_20.results()[1].setName("SketchArc_9_2") @@ -495,21 +749,33 @@ Sketch_4.setRadius(SketchCircle_7.results()[1], 25) Sketch_4.setRadius(SketchCircle_8.results()[1], 16) ### Create SketchLine -SketchLine_47 = Sketch_4.addLine(-44.99999999999996, 72, -44.99999999999998, 64.99999999999999) +SketchLine_47 = Sketch_4.addLine( + -44.99999999999996, 72, -44.99999999999998, 64.99999999999999 +) SketchLine_47.setName("SketchLine_19") SketchLine_47.result().setName("SketchLine_19") Sketch_4.setCoincident(SketchArc_19.endPoint(), SketchLine_47.startPoint()) Sketch_4.setVertical(SketchLine_47.result()) ### Create SketchLine -SketchLine_48 = Sketch_4.addLine(-28, 52.99999999999999, -32.99999999999998, 52.99999999999999) +SketchLine_48 = Sketch_4.addLine( + -28, 52.99999999999999, -32.99999999999998, 52.99999999999999 +) SketchLine_48.setName("SketchLine_20") SketchLine_48.result().setName("SketchLine_20") Sketch_4.setCoincident(SketchArc_20.startPoint(), SketchLine_48.startPoint()) Sketch_4.setHorizontal(SketchLine_48.result()) ### Create SketchArc -SketchArc_21 = Sketch_4.addArc(-32.99999999999998, 64.99999999999999, -44.99999999999998, 64.99999999999999, -32.99999999999998, 52.99999999999999, False) +SketchArc_21 = Sketch_4.addArc( + -32.99999999999998, + 64.99999999999999, + -44.99999999999998, + 64.99999999999999, + -32.99999999999998, + 52.99999999999999, + False, +) SketchArc_21.setName("SketchArc_10") SketchArc_21.result().setName("SketchArc_10") SketchArc_21.results()[1].setName("SketchArc_10_2") @@ -538,9 +804,35 @@ SketchArc_22.result().setName("SketchArc_11") SketchArc_22.results()[1].setName("SketchArc_11_2") ### Create SketchConstraintMirror -SketchConstraintMirror_4_objects = [SketchLine_39.result(), SketchLine_40.result(), SketchLine_36.result(), SketchLine_38.result(), SketchLine_37.result(), SketchLine_41.result(), SketchLine_43.result(), SketchArc_16.results()[1], SketchArc_18.results()[1], SketchArc_17.results()[1], SketchArc_22.results()[1]] -SketchConstraintMirror_4 = Sketch_4.addMirror(SketchLine_44.result(), SketchConstraintMirror_4_objects) -[SketchLine_50, SketchLine_51, SketchLine_52, SketchLine_53, SketchLine_54, SketchLine_55, SketchLine_56, SketchArc_23, SketchArc_24, SketchArc_25, SketchArc_26] = SketchConstraintMirror_4.mirrored() +SketchConstraintMirror_4_objects = [ + SketchLine_39.result(), + SketchLine_40.result(), + SketchLine_36.result(), + SketchLine_38.result(), + SketchLine_37.result(), + SketchLine_41.result(), + SketchLine_43.result(), + SketchArc_16.results()[1], + SketchArc_18.results()[1], + SketchArc_17.results()[1], + SketchArc_22.results()[1], +] +SketchConstraintMirror_4 = Sketch_4.addMirror( + SketchLine_44.result(), SketchConstraintMirror_4_objects +) +[ + SketchLine_50, + SketchLine_51, + SketchLine_52, + SketchLine_53, + SketchLine_54, + SketchLine_55, + SketchLine_56, + SketchArc_23, + SketchArc_24, + SketchArc_25, + SketchArc_26, +] = SketchConstraintMirror_4.mirrored() SketchArc_26.setName("SketchArc_12") SketchArc_26.result().setName("SketchArc_12") SketchArc_26.results()[1].setName("SketchArc_12_2") @@ -567,8 +859,12 @@ SketchLine_51.setName("SketchLine_11") SketchLine_51.result().setName("SketchLine_11") SketchLine_50.setName("SketchLine_10") SketchLine_50.result().setName("SketchLine_10") -Sketch_4.setCoincident(SketchAPI_Line(SketchLine_50).endPoint(), SketchLine_45.startPoint()) -Sketch_4.setDistance(SketchLine_47.result(), SketchAPI_Line(SketchLine_52).startPoint(), 45, True) +Sketch_4.setCoincident( + SketchAPI_Line(SketchLine_50).endPoint(), SketchLine_45.startPoint() +) +Sketch_4.setDistance( + SketchLine_47.result(), SketchAPI_Line(SketchLine_52).startPoint(), 45, True +) Sketch_4.setDistance(SketchLine_53.result(), SketchLine_49.endPoint(), 60, True) Sketch_4.setDistance(SketchLine_52.result(), SketchLine_48.startPoint(), 10, True) @@ -586,9 +882,27 @@ Sketch_4.setTangent(SketchArc_22.results()[1], SketchLine_37.result()) Sketch_4.setRadius(SketchArc_22.results()[1], 3) ### Create SketchConstraintMirror -SketchConstraintMirror_5_objects = [SketchLine_45.result(), SketchArc_19.results()[1], SketchLine_47.result(), SketchArc_21.results()[1], SketchLine_48.result(), SketchArc_20.results()[1], SketchLine_46.result()] -SketchConstraintMirror_5 = Sketch_4.addMirror(SketchLine_44.result(), SketchConstraintMirror_5_objects) -[SketchLine_57, SketchArc_27, SketchLine_58, SketchArc_28, SketchLine_59, SketchArc_29, SketchLine_60] = SketchConstraintMirror_5.mirrored() +SketchConstraintMirror_5_objects = [ + SketchLine_45.result(), + SketchArc_19.results()[1], + SketchLine_47.result(), + SketchArc_21.results()[1], + SketchLine_48.result(), + SketchArc_20.results()[1], + SketchLine_46.result(), +] +SketchConstraintMirror_5 = Sketch_4.addMirror( + SketchLine_44.result(), SketchConstraintMirror_5_objects +) +[ + SketchLine_57, + SketchArc_27, + SketchLine_58, + SketchArc_28, + SketchLine_59, + SketchArc_29, + SketchLine_60, +] = SketchConstraintMirror_5.mirrored() SketchArc_29.setName("SketchArc_15") SketchArc_29.result().setName("SketchArc_15") SketchArc_29.results()[1].setName("SketchArc_15_2") @@ -601,41 +915,93 @@ SketchArc_27.results()[1].setName("SketchArc_13_2") model.do() ### Create Extrusion -Extrusion_6 = model.addExtrusion(Part_2_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_22f-SketchArc_13_2f-SketchLine_23f-SketchArc_14_2r-SketchLine_24r-SketchArc_15_2f-SketchLine_25f-SketchCircle_1_2r-SketchLine_18r-SketchArc_9_2f-SketchLine_20f-SketchArc_10_2r-SketchLine_19r-SketchArc_7_2f-SketchLine_17r-SketchArc_4_2r-SketchLine_11f-SketchArc_6_2f-SketchArc_5_2r-SketchLine_15f-SketchLine_16f-SketchLine_8r-SketchLine_6r-SketchArc_3_2r-SketchArc_2_2f-SketchLine_5r-SketchArc_1_2r")], model.selection(), 10, 0) +Extrusion_6 = model.addExtrusion( + Part_2_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_22f-SketchArc_13_2f-SketchLine_23f-SketchArc_14_2r-SketchLine_24r-SketchArc_15_2f-SketchLine_25f-SketchCircle_1_2r-SketchLine_18r-SketchArc_9_2f-SketchLine_20f-SketchArc_10_2r-SketchLine_19r-SketchArc_7_2f-SketchLine_17r-SketchArc_4_2r-SketchLine_11f-SketchArc_6_2f-SketchArc_5_2r-SketchLine_15f-SketchLine_16f-SketchLine_8r-SketchLine_6r-SketchArc_3_2r-SketchArc_2_2f-SketchLine_5r-SketchArc_1_2r", + ) + ], + model.selection(), + 10, + 0, +) ### Create Extrusion -Extrusion_7 = model.addExtrusion(Part_2_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_12f-SketchArc_12_2r-SketchLine_14f-SketchLine_13f-SketchLine_10f-SketchLine_17f-SketchArc_7_2r-SketchLine_19f-SketchArc_10_2f-SketchLine_20r-SketchArc_9_2r-SketchLine_18f-SketchCircle_1_2r-SketchLine_25r-SketchArc_15_2r-SketchLine_24f-SketchArc_14_2f-SketchLine_23r-SketchArc_13_2r-SketchLine_22r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchArc_11_2r-SketchLine_1r")], model.selection(), 35, 0) +Extrusion_7 = model.addExtrusion( + Part_2_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_12f-SketchArc_12_2r-SketchLine_14f-SketchLine_13f-SketchLine_10f-SketchLine_17f-SketchArc_7_2r-SketchLine_19f-SketchArc_10_2f-SketchLine_20r-SketchArc_9_2r-SketchLine_18f-SketchCircle_1_2r-SketchLine_25r-SketchArc_15_2r-SketchLine_24f-SketchArc_14_2f-SketchLine_23r-SketchArc_13_2r-SketchLine_22r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchArc_11_2r-SketchLine_1r", + ) + ], + model.selection(), + 35, + 0, +) ### Create Extrusion -Extrusion_8 = model.addExtrusion(Part_2_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_1_2f-SketchCircle_2_2r")], model.selection(), 45, 0) +Extrusion_8 = model.addExtrusion( + Part_2_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_1_2f-SketchCircle_2_2r", + ) + ], + model.selection(), + 45, + 0, +) ### Create Sketch -Sketch_5 = model.addSketch(Part_2_doc, model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_1/SketchLine_22")) +Sketch_5 = model.addSketch( + Part_2_doc, + model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_1/SketchLine_22"), +) ### Create SketchCircle SketchCircle_9 = Sketch_5.addCircle(63, 23, 5) Sketch_5.setRadius(SketchCircle_9.results()[1], 5) ### Create SketchProjection -SketchProjection_11 = Sketch_5.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_11 = Sketch_5.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_61 = SketchProjection_11.createdFeature() Sketch_5.setDistance(SketchCircle_9.center(), SketchLine_61.result(), "126/2", True) ### Create SketchProjection -SketchProjection_12 = Sketch_5.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_12 = Sketch_5.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_62 = SketchProjection_12.createdFeature() Sketch_5.setDistance(SketchCircle_9.center(), SketchLine_62.result(), 23, True) ### Create SketchConstraintMirror -SketchConstraintMirror_6 = Sketch_5.addMirror(SketchLine_61.result(), [SketchCircle_9.results()[1]]) +SketchConstraintMirror_6 = Sketch_5.addMirror( + SketchLine_61.result(), [SketchCircle_9.results()[1]] +) [SketchCircle_10] = SketchConstraintMirror_6.mirrored() model.do() ### Create ExtrusionCut -ExtrusionCut_2 = model.addExtrusionCut(Part_2_doc, [model.selection("COMPOUND", "all-in-Sketch_2")], model.selection(), 0, 10, [model.selection("SOLID", "Extrusion_2_1")]) +ExtrusionCut_2 = model.addExtrusionCut( + Part_2_doc, + [model.selection("COMPOUND", "all-in-Sketch_2")], + model.selection(), + 0, + 10, + [model.selection("SOLID", "Extrusion_2_1")], +) ### Create Sketch -Sketch_6 = model.addSketch(Part_2_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6")) +Sketch_6 = model.addSketch( + Part_2_doc, + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6"), +) ### Create SketchLine SketchLine_63 = Sketch_6.addLine(0, 0, 9, -55.99999999999999) @@ -649,18 +1015,34 @@ SketchCircle_12 = Sketch_6.addCircle(28, -56, 10) Sketch_6.setCoincident(SketchCircle_11.center(), SketchCircle_12.center()) ### Create SketchLine -SketchLine_64 = Sketch_6.addLine(47, -55.99999999999999, 56.26584765647708, -18.93660937409168) +SketchLine_64 = Sketch_6.addLine( + 47, -55.99999999999999, 56.26584765647708, -18.93660937409168 +) Sketch_6.setCoincident(SketchLine_64.startPoint(), SketchCircle_11.results()[1]) Sketch_6.setRadius(SketchCircle_11.results()[1], "38/2") Sketch_6.setRadius(SketchCircle_12.results()[1], 10) ### Create SketchProjection -SketchProjection_13 = Sketch_6.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"), False) +SketchProjection_13 = Sketch_6.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ), + False, +) SketchPoint_4 = SketchProjection_13.createdFeature() -Sketch_6.setCoincident(SketchLine_63.startPoint(), SketchAPI_Point(SketchPoint_4).coordinates()) +Sketch_6.setCoincident( + SketchLine_63.startPoint(), SketchAPI_Point(SketchPoint_4).coordinates() +) ### Create SketchProjection -SketchProjection_14 = Sketch_6.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"), False) +SketchProjection_14 = Sketch_6.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ), + False, +) SketchLine_65 = SketchProjection_14.createdFeature() Sketch_6.setDistance(SketchCircle_11.center(), SketchLine_65.result(), 56, True) @@ -675,7 +1057,13 @@ Sketch_6.setCoincident(SketchLine_63.endPoint(), SketchLine_66.startPoint()) Sketch_6.setCoincident(SketchLine_64.startPoint(), SketchLine_66.endPoint()) ### Create SketchProjection -SketchProjection_15 = Sketch_6.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"), False) +SketchProjection_15 = Sketch_6.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ), + False, +) SketchLine_67 = SketchProjection_15.createdFeature() Sketch_6.setDistance(SketchCircle_12.center(), SketchLine_67.result(), 28, True) @@ -688,11 +1076,25 @@ Sketch_6.setCollinear(SketchLine_68.result(), SketchLine_64.result()) Sketch_6.setHorizontalDistance(SketchCircle_11.center(), SketchLine_68.endPoint(), 33) ### Create SketchProjection -SketchProjection_16 = Sketch_6.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_23][Extrusion_1_1/From_Face]"), False) +SketchProjection_16 = Sketch_6.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_23][Extrusion_1_1/From_Face]", + ), + False, +) SketchLine_69 = SketchProjection_16.createdFeature() ### Create SketchArc -SketchArc_30 = Sketch_6.addArc(80.51941016011038, -25, 56.26584765647708, -18.93660937409168, 80.519344153399, 0, True) +SketchArc_30 = Sketch_6.addArc( + 80.51941016011038, + -25, + 56.26584765647708, + -18.93660937409168, + 80.519344153399, + 0, + True, +) SketchArc_30.setName("SketchArc_16") SketchArc_30.result().setName("SketchArc_16") SketchArc_30.results()[1].setName("SketchArc_16_2") @@ -707,28 +1109,78 @@ SketchLine_70 = Sketch_6.addLine(0, 0, 80.519344153399, 0) Sketch_6.setCoincident(SketchLine_63.startPoint(), SketchLine_70.startPoint()) Sketch_6.setCoincident(SketchArc_30.endPoint(), SketchLine_70.endPoint()) model.do() -Sketch_6.changeFacesOrder([[SketchCircle_12.results()[1]], - [SketchLine_63.result(), SketchCircle_11.results()[1], SketchCircle_11.results()[1], SketchLine_64.result(), SketchArc_30.results()[1], SketchLine_70.result()], - [SketchCircle_11.results()[1], SketchCircle_11.results()[1], SketchCircle_11.results()[1], SketchCircle_12.results()[1]] - ]) +Sketch_6.changeFacesOrder( + [ + [SketchCircle_12.results()[1]], + [ + SketchLine_63.result(), + SketchCircle_11.results()[1], + SketchCircle_11.results()[1], + SketchLine_64.result(), + SketchArc_30.results()[1], + SketchLine_70.result(), + ], + [ + SketchCircle_11.results()[1], + SketchCircle_11.results()[1], + SketchCircle_11.results()[1], + SketchCircle_12.results()[1], + ], + ] +) model.do() ### Create Extrusion -Extrusion_9 = model.addExtrusion(Part_2_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_28r-SketchCircle_5_2r-SketchCircle_5_2r-SketchLine_29f-SketchArc_16_2r-SketchLine_35r")], model.selection(), 0, 10) +Extrusion_9 = model.addExtrusion( + Part_2_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_28r-SketchCircle_5_2r-SketchCircle_5_2r-SketchLine_29f-SketchArc_16_2r-SketchLine_35r", + ) + ], + model.selection(), + 0, + 10, +) ### Create Extrusion -Extrusion_10 = model.addExtrusion(Part_2_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_5_2f-SketchCircle_5_2f-SketchCircle_5_2f-SketchCircle_6_2r")], model.selection(), 3, 13) +Extrusion_10 = model.addExtrusion( + Part_2_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchCircle_5_2f-SketchCircle_5_2f-SketchCircle_5_2f-SketchCircle_6_2r", + ) + ], + model.selection(), + 3, + 13, +) ### Create Symmetry -Symmetry_2 = model.addSymmetry(Part_2_doc, [model.selection("COMPOUND", "all-in-Extrusion_4"), model.selection("COMPOUND", "all-in-Extrusion_5")], model.selection("FACE", "PartSet/YOZ"), keepOriginal = True, keepSubResults = True) +Symmetry_2 = model.addSymmetry( + Part_2_doc, + [ + model.selection("COMPOUND", "all-in-Extrusion_4"), + model.selection("COMPOUND", "all-in-Extrusion_5"), + ], + model.selection("FACE", "PartSet/YOZ"), + keepOriginal=True, + keepSubResults=True, +) ### Create Fuse -Fuse_2_objects_1 = [model.selection("SOLID", "Extrusion_1_1"), - model.selection("SOLID", "Extrusion_3_1"), - model.selection("SOLID", "ExtrusionCut_1_1"), - model.selection("COMPOUND", "Symmetry_1_1"), - model.selection("COMPOUND", "Symmetry_1_2")] -Fuse_2 = model.addFuse(Part_2_doc, Fuse_2_objects_1, removeEdges = True, keepSubResults = True) +Fuse_2_objects_1 = [ + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_3_1"), + model.selection("SOLID", "ExtrusionCut_1_1"), + model.selection("COMPOUND", "Symmetry_1_1"), + model.selection("COMPOUND", "Symmetry_1_2"), +] +Fuse_2 = model.addFuse( + Part_2_doc, Fuse_2_objects_1, removeEdges=True, keepSubResults=True +) model.do() @@ -740,4 +1192,4 @@ model.testResultsVolumes(Fuse_1, [244644.913443274]) model.checkResult(Fuse_2, model, 1, [0], [1], [58], [326], [652]) model.testResultsVolumes(Fuse_2, [244644.913443274]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test20027.py b/src/FeaturesPlugin/Test/Test20027.py index b801794a9..b43b0bdb3 100644 --- a/src/FeaturesPlugin/Test/Test20027.py +++ b/src/FeaturesPlugin/Test/Test20027.py @@ -28,43 +28,101 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 0, -99) SketchLine_1.setAuxiliary(True) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchPoint_1.result() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchLine_2 = Sketch_1.addLine(0, 0, -44, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchLine_3 = Sketch_1.addLine(-44, 0, -44, -57.48528137423859) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 44) -SketchArc_1 = Sketch_1.addArc(-31, -57.48528137423859, -44, -57.48528137423859, -40.19238815542511, -66.6776695296637, False) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_1.results()[1]) +SketchArc_1 = Sketch_1.addArc( + -31, + -57.48528137423859, + -44, + -57.48528137423859, + -40.19238815542511, + -66.6776695296637, + False, +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_1.results()[1] +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 13) -SketchLine_4 = Sketch_1.addLine(-40.19238815542511, -66.6776695296637, -13.4350288425444, -93.43502884254441) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_4.startPoint()) -SketchArc_2 = Sketch_1.addArc(0, -80, -13.4350288425444, -93.43502884254441, 0, -99, False) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_2.center()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_2.endPoint()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_4.result()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_2.results()[1]) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_2.endPoint()) +SketchLine_4 = Sketch_1.addLine( + -40.19238815542511, -66.6776695296637, -13.4350288425444, -93.43502884254441 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_4.startPoint() +) +SketchArc_2 = Sketch_1.addArc( + 0, -80, -13.4350288425444, -93.43502884254441, 0, -99, False +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_2.center() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_2.endPoint() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_4.result() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchLine_4.result(), SketchArc_2.results()[1] +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchArc_2.endPoint() +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 19) SketchLine_5 = Sketch_1.addLine(0, -80, -13.4350288425444, -93.43502884254441) SketchLine_5.setName("SketchLine_6") SketchLine_5.result().setName("SketchLine_6") SketchLine_5.setAuxiliary(True) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_12") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.endPoint() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_13") -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_5.result(), SketchLine_1.result(), 45, type = "Supplementary") -SketchConstraintMirror_1_objects = [SketchLine_2.result(), SketchLine_3.result(), SketchArc_1.results()[1], SketchLine_4.result(), SketchArc_2.results()[1]] -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_1.result(), SketchConstraintMirror_1_objects) -[SketchLine_6, SketchLine_7, SketchArc_3, SketchLine_8, SketchArc_4] = SketchConstraintMirror_1.mirrored() +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_5.result(), SketchLine_1.result(), 45, type="Supplementary" +) +SketchConstraintMirror_1_objects = [ + SketchLine_2.result(), + SketchLine_3.result(), + SketchArc_1.results()[1], + SketchLine_4.result(), + SketchArc_2.results()[1], +] +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_1.result(), SketchConstraintMirror_1_objects +) +[ + SketchLine_6, + SketchLine_7, + SketchArc_3, + SketchLine_8, + SketchArc_4, +] = SketchConstraintMirror_1.mirrored() SketchLine_8.setName("SketchLine_9") SketchLine_8.result().setName("SketchLine_9") SketchLine_7.setName("SketchLine_8") @@ -79,126 +137,247 @@ SketchCircle_2 = Sketch_1.addCircle(25, -44, 5) SketchCircle_2.setName("SketchCircle_3") SketchCircle_2.result().setName("SketchCircle_3") SketchCircle_2.results()[1].setName("SketchCircle_3_2") -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) SketchConstraintRadius_3.setName("SketchConstraintRadius_7") -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchCircle_2.center(), 50, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchCircle_2.center(), 50, True +) SketchConstraintDistance_1.setName("SketchConstraintDistance_4") SketchLine_9 = Sketch_1.addLine(-25, -44, 25, -44) SketchLine_9.setName("SketchLine_21") SketchLine_9.result().setName("SketchLine_21") SketchLine_9.setAuxiliary(True) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_9.startPoint() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_28") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchLine_9.endPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchCircle_2.center(), SketchLine_9.endPoint() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_29") SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintHorizontal_2.setName("SketchConstraintHorizontal_4") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Arc(SketchArc_4).center(), SketchLine_9.result(), 36, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Arc(SketchArc_4).center(), SketchLine_9.result(), 36, True +) SketchConstraintDistance_2.setName("SketchConstraintDistance_5") SketchPoint_2 = Sketch_1.addPoint(2.896598636358403e-31, -44) SketchPoint_2.setName("SketchPoint_4") SketchPoint_2.result().setName("SketchPoint_4") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_9.result()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_9.result() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_30") -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_9.result(), SketchPoint_2.coordinates()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.result()) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchLine_9.result(), SketchPoint_2.coordinates() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_1.result() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_31") -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.result(), SketchLine_5.startPoint(), 80, True) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.result(), SketchLine_5.startPoint(), 80, True +) SketchConstraintDistance_3.setName("SketchConstraintDistance_8") model.do() -Sketch_1.changeFacesOrder([[SketchLine_2.result(), SketchLine_3.result(), SketchArc_1.results()[1], SketchLine_4.result(), SketchArc_2.results()[1], SketchArc_4.results()[1], SketchLine_8.result(), SketchArc_3.results()[1], SketchLine_7.result(), SketchLine_6.result(), SketchCircle_1.results()[1], SketchCircle_2.results()[1]], - [SketchCircle_2.results()[1]], - [SketchCircle_1.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchLine_2.result(), + SketchLine_3.result(), + SketchArc_1.results()[1], + SketchLine_4.result(), + SketchArc_2.results()[1], + SketchArc_4.results()[1], + SketchLine_8.result(), + SketchArc_3.results()[1], + SketchLine_7.result(), + SketchLine_6.result(), + SketchCircle_1.results()[1], + SketchCircle_2.results()[1], + ], + [SketchCircle_2.results()[1]], + [SketchCircle_1.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_3f-SketchArc_1_2f-SketchLine_4f-SketchArc_2_2f-SketchArc_4_2f-SketchLine_9r-SketchArc_3_2f-SketchLine_8r-SketchLine_7r-SketchCircle_2_2r-SketchCircle_3_2r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_2f-SketchLine_3f-SketchArc_1_2f-SketchLine_4f-SketchArc_2_2f-SketchArc_4_2f-SketchLine_9r-SketchArc_3_2f-SketchLine_8r-SketchLine_7r-SketchCircle_2_2r-SketchCircle_3_2r", + ) + ], + model.selection(), + 10, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) SketchLine_10 = Sketch_2.addLine(0, 0, 0, -16) SketchLine_10.setName("SketchLine_10") SketchLine_10.result().setName("SketchLine_10") SketchLine_10.setAuxiliary(True) -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_7][Extrusion_1_1/To_Face]"), False) +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_7][Extrusion_1_1/To_Face]", + ), + False, +) SketchPoint_3 = SketchProjection_2.createdFeature() SketchPoint_3.setName("SketchPoint_2") SketchPoint_3.result().setName("SketchPoint_2") -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchPoint_3.result()) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_10.startPoint(), SketchPoint_3.result() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_14") SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_10.result()) SketchLine_11 = Sketch_2.addLine(-44, 0, -44, -13) SketchLine_11.setName("SketchLine_11") SketchLine_11.result().setName("SketchLine_11") -SketchProjection_3 = 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) +SketchProjection_3 = 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_4 = SketchProjection_3.createdFeature() SketchPoint_4.setName("SketchPoint_3") SketchPoint_4.result().setName("SketchPoint_3") -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchPoint_4.result()) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchLine_11.startPoint(), SketchPoint_4.result() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_15") SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_11.result()) SketchLine_12 = Sketch_2.addLine(-44, -13, -21.99999999999997, -13) SketchLine_12.setName("SketchLine_12") SketchLine_12.result().setName("SketchLine_12") -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_16") SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_12.result()) SketchConstraintHorizontal_3.setName("SketchConstraintHorizontal_2") -SketchArc_5 = Sketch_2.addArc(-22, -16.00000000000039, -21.99999999999997, -13, -19, -16, True) -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchArc_5.startPoint()) +SketchArc_5 = Sketch_2.addArc( + -22, -16.00000000000039, -21.99999999999997, -13, -19, -16, True +) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchArc_5.startPoint() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_17") -SketchConstraintTangent_4 = Sketch_2.setTangent(SketchLine_12.result(), SketchArc_5.results()[1]) +SketchConstraintTangent_4 = Sketch_2.setTangent( + SketchLine_12.result(), SketchArc_5.results()[1] +) SketchLine_13 = Sketch_2.addLine(-19, -16, 0, -16) SketchLine_13.setName("SketchLine_13") SketchLine_13.result().setName("SketchLine_13") -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchArc_5.endPoint(), SketchLine_13.startPoint() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_18") -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_10.result()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_10.result() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_19") SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_13.result()) SketchConstraintHorizontal_4.setName("SketchConstraintHorizontal_3") SketchConstraintRadius_4 = Sketch_2.setRadius(SketchArc_5.results()[1], 3) SketchConstraintRadius_4.setName("SketchConstraintRadius_3") SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_13.result(), "38/2") -SketchConstraintDistance_4 = Sketch_2.setDistance(SketchLine_13.result(), SketchLine_12.endPoint(), 3, True) +SketchConstraintDistance_4 = Sketch_2.setDistance( + SketchLine_13.result(), SketchLine_12.endPoint(), 3, True +) SketchConstraintDistance_4.setName("SketchConstraintDistance_2") SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_11.result(), 13) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_10.endPoint() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_20") SketchLine_14 = Sketch_2.addLine(-44, 0, -25, 0) SketchLine_14.setName("SketchLine_14") SketchLine_14.result().setName("SketchLine_14") -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_11.startPoint(), SketchLine_14.startPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_21") -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False) +SketchProjection_4 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_15 = SketchProjection_4.createdFeature() SketchLine_15.setName("SketchLine_15") SketchLine_15.result().setName("SketchLine_15") -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.result()) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.result() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_22") -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_16 = SketchProjection_5.createdFeature() SketchLine_16.setName("SketchLine_16") SketchLine_16.result().setName("SketchLine_16") SketchArc_6 = Sketch_2.addArc(-25, 6, -25, 0, -19, 6, False) -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchArc_6.startPoint()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchArc_6.startPoint() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_23") -SketchConstraintTangent_5 = Sketch_2.setTangent(SketchLine_14.result(), SketchArc_6.results()[1]) +SketchConstraintTangent_5 = Sketch_2.setTangent( + SketchLine_14.result(), SketchArc_6.results()[1] +) SketchArc_7 = Sketch_2.addArc(0, 5.999999999999997, -19, 6, 0, 25, True) -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchArc_6.endPoint(), SketchArc_7.startPoint()) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchArc_6.endPoint(), SketchArc_7.startPoint() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_24") -SketchConstraintTangent_6 = Sketch_2.setTangent(SketchArc_6.results()[1], SketchArc_7.results()[1]) -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchArc_7.endPoint(), SketchLine_16.result()) +SketchConstraintTangent_6 = Sketch_2.setTangent( + SketchArc_6.results()[1], SketchArc_7.results()[1] +) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchArc_7.endPoint(), SketchLine_16.result() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_25") -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchArc_7.center(), SketchLine_16.result()) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchArc_7.center(), SketchLine_16.result() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_26") SketchConstraintRadius_5 = Sketch_2.setRadius(SketchArc_7.results()[1], 19) SketchConstraintRadius_5.setName("SketchConstraintRadius_4") SketchConstraintRadius_6 = Sketch_2.setRadius(SketchArc_6.results()[1], 6) SketchConstraintRadius_6.setName("SketchConstraintRadius_5") -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchArc_7.center(), SketchLine_12.result(), 19, True) +SketchConstraintDistance_5 = Sketch_2.setDistance( + SketchArc_7.center(), SketchLine_12.result(), 19, True +) SketchConstraintDistance_5.setName("SketchConstraintDistance_3") -SketchConstraintMirror_2_objects = [SketchArc_5.results()[1], SketchLine_12.result(), SketchLine_11.result(), SketchArc_6.results()[1], SketchArc_7.results()[1], SketchLine_13.result(), SketchLine_14.result()] -SketchConstraintMirror_2 = Sketch_2.addMirror(SketchLine_10.result(), SketchConstraintMirror_2_objects) -[SketchArc_8, SketchLine_17, SketchLine_18, SketchArc_9, SketchArc_10, SketchLine_19, SketchLine_20] = SketchConstraintMirror_2.mirrored() +SketchConstraintMirror_2_objects = [ + SketchArc_5.results()[1], + SketchLine_12.result(), + SketchLine_11.result(), + SketchArc_6.results()[1], + SketchArc_7.results()[1], + SketchLine_13.result(), + SketchLine_14.result(), +] +SketchConstraintMirror_2 = Sketch_2.addMirror( + SketchLine_10.result(), SketchConstraintMirror_2_objects +) +[ + SketchArc_8, + SketchLine_17, + SketchLine_18, + SketchArc_9, + SketchArc_10, + SketchLine_19, + SketchLine_20, +] = SketchConstraintMirror_2.mirrored() SketchLine_20.setName("SketchLine_20") SketchLine_20.result().setName("SketchLine_20") SketchLine_19.setName("SketchLine_19") @@ -211,56 +390,118 @@ SketchCircle_3 = Sketch_2.addCircle(0, 5.999999999999997, 9.5) SketchCircle_3.setName("SketchCircle_1") SketchCircle_3.result().setName("SketchCircle_1") SketchCircle_3.results()[1].setName("SketchCircle_1_2") -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchArc_7.center(), SketchCircle_3.center()) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchArc_7.center(), SketchCircle_3.center() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_27") SketchConstraintRadius_7 = Sketch_2.setRadius(SketchCircle_3.results()[1], "19/2") SketchConstraintRadius_7.setName("SketchConstraintRadius_6") model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchLine_12f-SketchArc_5_2r-SketchLine_13f-SketchLine_19r-SketchArc_8_2r-SketchLine_17r-SketchLine_18r-SketchLine_20f-SketchArc_9_2r-SketchArc_10_2f-SketchArc_7_2f-SketchArc_6_2r-SketchLine_14r-SketchCircle_1_2r")], model.selection(), 40, 10) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_2/Face-SketchLine_11f-SketchLine_12f-SketchArc_5_2r-SketchLine_13f-SketchLine_19r-SketchArc_8_2r-SketchLine_17r-SketchLine_18r-SketchLine_20f-SketchArc_9_2r-SketchArc_10_2f-SketchArc_7_2f-SketchArc_6_2r-SketchLine_14r-SketchCircle_1_2r", + ) + ], + model.selection(), + 40, + 10, +) Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) SketchLine_21 = Sketch_3.addLine(-16, 50, -20, 50) SketchLine_21.setName("SketchLine_22") SketchLine_21.result().setName("SketchLine_22") -SketchProjection_6 = Sketch_3.addProjection(model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_13][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_19][Extrusion_2_1/To_Face]"), False) +SketchProjection_6 = Sketch_3.addProjection( + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_13][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_19][Extrusion_2_1/To_Face]", + ), + False, +) SketchPoint_5 = SketchProjection_6.createdFeature() -SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchPoint_5.result()) +SketchConstraintCoincidence_30 = Sketch_3.setCoincident( + SketchLine_21.startPoint(), SketchPoint_5.result() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_32") SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_21.result()) SketchLine_22 = Sketch_3.addLine(-20, 50, -80, 10) SketchLine_22.setName("SketchLine_23") SketchLine_22.result().setName("SketchLine_23") -SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint()) +SketchConstraintCoincidence_31 = Sketch_3.setCoincident( + SketchLine_21.endPoint(), SketchLine_22.startPoint() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_33") -SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchArc_5_2][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_13]"), True) +SketchProjection_7 = Sketch_3.addProjection( + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchArc_5_2][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_13]", + ), + True, +) SketchLine_23 = SketchProjection_7.createdFeature() SketchLine_23.setName("SketchLine_24") SketchLine_23.result().setName("SketchLine_24") SketchLine_24 = Sketch_3.addLine(-16, 9.999999999999996, -80, 10) SketchLine_24.setName("SketchLine_25") SketchLine_24.result().setName("SketchLine_25") -SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchLine_24.startPoint(), SketchLine_23.result()) +SketchConstraintCoincidence_32 = Sketch_3.setCoincident( + SketchLine_24.startPoint(), SketchLine_23.result() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_34") SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_24.result()) -SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_24.endPoint()) +SketchConstraintCoincidence_33 = Sketch_3.setCoincident( + SketchLine_22.endPoint(), SketchLine_24.endPoint() +) SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_35") -SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_8 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_25 = SketchProjection_8.createdFeature() SketchLine_25.setName("SketchLine_26") SketchLine_25.result().setName("SketchLine_26") -SketchConstraintDistance_6 = Sketch_3.setDistance(SketchLine_22.startPoint(), SketchLine_25.result(), 20, True) +SketchConstraintDistance_6 = Sketch_3.setDistance( + SketchLine_22.startPoint(), SketchLine_25.result(), 20, True +) SketchConstraintDistance_6.setName("SketchConstraintDistance_6") -SketchConstraintDistance_7 = Sketch_3.setDistance(SketchAPI_Point(SketchPoint_5).coordinates(), SketchLine_24.startPoint(), 40, True) +SketchConstraintDistance_7 = Sketch_3.setDistance( + SketchAPI_Point(SketchPoint_5).coordinates(), SketchLine_24.startPoint(), 40, True +) SketchConstraintDistance_7.setName("SketchConstraintDistance_7") SketchConstraintLength_4 = Sketch_3.setLength(SketchLine_24.result(), "67-3") model.do() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_22r-SketchLine_23f-SketchLine_25r-SketchProjection_7f")], model.selection(), 5, 5) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], model.selection(), [model.selection("SOLID", "Extrusion_1_1")]) -Fuse_1_objects_1 = [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "ExtrusionCut_1_1"), model.selection("SOLID", "Extrusion_3_1")] -Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1, removeEdges = True, keepSubResults = True) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_22r-SketchLine_23f-SketchLine_25r-SketchProjection_7f", + ) + ], + model.selection(), + 5, + 5, +) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], + model.selection(), + [model.selection("SOLID", "Extrusion_1_1")], +) +Fuse_1_objects_1 = [ + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "ExtrusionCut_1_1"), + model.selection("SOLID", "Extrusion_3_1"), +] +Fuse_1 = model.addFuse( + Part_1_doc, Fuse_1_objects_1, removeEdges=True, keepSubResults=True +) model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) model.end() from GeomAPI import GeomAPI_Shape + model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [0]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [1]) @@ -270,16 +511,19 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [300]) model.testResultsVolumes(Fuse_1, [162690.939657109178369864821434021]) from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() # Check that the features are not in error for i in range(Part_1_doc.size("Features")): - feature = objectToFeature(Part_1_doc.object("Features", i)) - name = feature.name() - error = feature.error() - assert(error == ''), "The feature {0} is in error: {1}".format(name, error) - assert(aFactory.validate(feature)), "The feature {0} is in error: {1}".format(name, error) + feature = objectToFeature(Part_1_doc.object("Features", i)) + name = feature.name() + error = feature.error() + assert error == "", "The feature {0} is in error: {1}".format(name, error) + assert aFactory.validate(feature), "The feature {0} is in error: {1}".format( + name, error + ) -assert(Part_1_doc.size("Groups") == 3) +assert Part_1_doc.size("Groups") == 3 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2023.py b/src/FeaturesPlugin/Test/Test2023.py index 0d36bf136..836be8528 100644 --- a/src/FeaturesPlugin/Test/Test2023.py +++ b/src/FeaturesPlugin/Test/Test2023.py @@ -24,38 +24,103 @@ 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(178.3876500857632, 167.2384219554031, -133.7907375643225, 167.2384219554031) -SketchLine_2 = Sketch_1.addLine(-133.7907375643225, 167.2384219554031, -133.7907375643225, -134.6483704974271) -SketchLine_3 = Sketch_1.addLine(-133.7907375643225, -134.6483704974271, 178.3876500857632, -134.6483704974271) -SketchLine_4 = Sketch_1.addLine(178.3876500857632, -134.6483704974271, 178.3876500857632, 167.2384219554031) -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()) +SketchLine_1 = Sketch_1.addLine( + 178.3876500857632, 167.2384219554031, -133.7907375643225, 167.2384219554031 +) +SketchLine_2 = Sketch_1.addLine( + -133.7907375643225, 167.2384219554031, -133.7907375643225, -134.6483704974271 +) +SketchLine_3 = Sketch_1.addLine( + -133.7907375643225, -134.6483704974271, 178.3876500857632, -134.6483704974271 +) +SketchLine_4 = Sketch_1.addLine( + 178.3876500857632, -134.6483704974271, 178.3876500857632, 167.2384219554031 +) +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(), 100, 0) +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) -SketchLine_8 = Sketch_2.addLine(99.48542024013722, -62.60720411663805, 99.48542024013722, 69.46826758147516) -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()) +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 +) +SketchLine_8 = Sketch_2.addLine( + 99.48542024013722, -62.60720411663805, 99.48542024013722, 69.46826758147516 +) +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()) 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(), 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) +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()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test20245_1.py b/src/FeaturesPlugin/Test/Test20245_1.py index b8ff894d0..90ba4cfa6 100644 --- a/src/FeaturesPlugin/Test/Test20245_1.py +++ b/src/FeaturesPlugin/Test/Test20245_1.py @@ -33,34 +33,89 @@ model.addParameter(Part_1_doc, "r_cut", "30") model.addParameter(Part_1_doc, "h", "200") ### Create Cylinder -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "r_ext", "h") +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "r_ext", + "h", +) ### Create Cylinder -Cylinder_2 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "r_int", "h") +Cylinder_2 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "r_int", + "h", +) ### Create Sphere -Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "r_ext") +Sphere_1 = model.addSphere( + Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "r_ext" +) ### Create Sphere -Sphere_2 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "r_int") +Sphere_2 = model.addSphere( + Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "r_int" +) ### Create Rotation -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("COMPOUND", "all-in-Sphere_1")], axis = model.selection("EDGE", "PartSet/OY"), angle = 90, keepSubResults = True) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sphere_1")], + axis=model.selection("EDGE", "PartSet/OY"), + angle=90, + keepSubResults=True, +) ### Create Rotation -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("COMPOUND", "all-in-Sphere_2")], axis = model.selection("EDGE", "PartSet/OY"), angle = 90, keepSubResults = True) +Rotation_2 = model.addRotation( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sphere_2")], + axis=model.selection("EDGE", "PartSet/OY"), + angle=90, + keepSubResults=True, +) ### Create Translation -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "Rotation_1_1"), model.selection("COMPOUND", "Rotation_2_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = "h", keepSubResults = True) +Translation_1 = model.addTranslation( + Part_1_doc, + [ + model.selection("COMPOUND", "Rotation_1_1"), + model.selection("COMPOUND", "Rotation_2_1"), + ], + axis=model.selection("EDGE", "PartSet/OZ"), + distance="h", + keepSubResults=True, +) ### Create Fuse -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Translation_1_1_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +Fuse_1 = model.addFuse( + Part_1_doc, + [ + model.selection("SOLID", "Translation_1_1_1"), + model.selection("SOLID", "Cylinder_1_1"), + ], + keepSubResults=True, +) ### Create Fuse -Fuse_2 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cylinder_2_1"), model.selection("SOLID", "Translation_1_2_1")], keepSubResults = True) +Fuse_2 = model.addFuse( + Part_1_doc, + [ + model.selection("SOLID", "Cylinder_2_1"), + model.selection("SOLID", "Translation_1_2_1"), + ], + keepSubResults=True, +) ### Create Partition -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Fuse_1_1"), model.selection("SOLID", "Fuse_2_1")], keepSubResults = True) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Fuse_1_1"), model.selection("SOLID", "Fuse_2_1")], + keepSubResults=True, +) ### Create Sketch Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) @@ -69,7 +124,9 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 30, -30, 0) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) @@ -82,7 +139,9 @@ SketchLine_4 = Sketch_1.addLine(0, -30, 30, 0) Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) ### Create SketchProjection -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_5 = SketchProjection_2.createdFeature() Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.result()) @@ -123,112 +182,222 @@ Sketch_1.setEqual(SketchLine_9.result(), SketchLine_10.result()) model.do() ### Create Extrusion -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), "h", 0, "Edges") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection(), + "h", + 0, + "Edges", +) ### Create Plane Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), "h", False) ### Create Split -Split_1 = model.addSplit(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], [model.selection("FACE", "Plane_1"), model.selection("COMPOUND", "Extrusion_1_1")], keepSubResults = True) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + [model.selection("FACE", "Plane_1"), model.selection("COMPOUND", "Extrusion_1_1")], + keepSubResults=True, +) ### Create Sketch Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) ### Create SketchProjection -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Split_1_1_10/Modified_Edge&Extrusion_1_1_1/To_Edge"), True) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("EDGE", "Split_1_1_10/Modified_Edge&Extrusion_1_1_1/To_Edge"), True +) SketchLine_11 = SketchProjection_3.createdFeature() ### Create SketchProjection -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Split_1_1_9/Modified_Edge&Extrusion_1_1_4/To_Edge"), True) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("EDGE", "Split_1_1_9/Modified_Edge&Extrusion_1_1_4/To_Edge"), True +) SketchLine_12 = SketchProjection_4.createdFeature() ### Create SketchProjection -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "Split_1_1_8/Modified_Edge&Extrusion_1_1_3/To_Edge"), True) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("EDGE", "Split_1_1_8/Modified_Edge&Extrusion_1_1_3/To_Edge"), True +) SketchLine_13 = SketchProjection_5.createdFeature() ### Create SketchProjection -SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "Split_1_1_7/Modified_Edge&Extrusion_1_1_2/To_Edge"), True) +SketchProjection_6 = Sketch_2.addProjection( + model.selection("EDGE", "Split_1_1_7/Modified_Edge&Extrusion_1_1_2/To_Edge"), True +) SketchLine_14 = SketchProjection_6.createdFeature() model.do() ### Create Extrusion -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), "r_cut/sqrt(2)", 0, "Faces|Wires") +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_2")], + model.selection(), + "r_cut/sqrt(2)", + 0, + "Faces|Wires", +) ### Create Sketch Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) ### Create SketchProjection -SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchProjection_6][Extrusion_2_1/Generated_Face&Sketch_2/SketchProjection_5]"), True) +SketchProjection_7 = Sketch_3.addProjection( + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchProjection_6][Extrusion_2_1/Generated_Face&Sketch_2/SketchProjection_5]", + ), + True, +) SketchLine_15 = SketchProjection_7.createdFeature() ### Create SketchProjection -SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Split_1_1_7/Modified_Edge&Extrusion_1_1_6/To_Edge"), True) +SketchProjection_8 = Sketch_3.addProjection( + model.selection("EDGE", "Split_1_1_7/Modified_Edge&Extrusion_1_1_6/To_Edge"), True +) SketchLine_16 = SketchProjection_8.createdFeature() ### Create SketchProjection -SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "Split_1_1_2/Modified_Edge&Extrusion_1_1_6/To_Edge"), True) +SketchProjection_9 = Sketch_3.addProjection( + model.selection("EDGE", "Split_1_1_2/Modified_Edge&Extrusion_1_1_6/To_Edge"), True +) SketchLine_17 = SketchProjection_9.createdFeature() ### Create SketchLine -SketchLine_18 = Sketch_3.addLine(-30, 221.2132034355964, -136.4686528504195, 327.681856286016) -Sketch_3.setCoincident(SketchAPI_Line(SketchLine_15).endPoint(), SketchLine_18.startPoint()) +SketchLine_18 = Sketch_3.addLine( + -30, 221.2132034355964, -136.4686528504195, 327.681856286016 +) +Sketch_3.setCoincident( + SketchAPI_Line(SketchLine_15).endPoint(), SketchLine_18.startPoint() +) ### Create SketchLine SketchLine_19 = Sketch_3.addLine(-136.4686528504195, 327.681856286016, -80, 200) Sketch_3.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -Sketch_3.setCoincident(SketchAPI_Line(SketchLine_17).endPoint(), SketchLine_19.endPoint()) +Sketch_3.setCoincident( + SketchAPI_Line(SketchLine_17).endPoint(), SketchLine_19.endPoint() +) ### Create SketchConstraintAngle -Sketch_3.setAngle(SketchLine_15.result(), SketchLine_18.result(), 135, type = "Direct") +Sketch_3.setAngle(SketchLine_15.result(), SketchLine_18.result(), 135, type="Direct") model.do() ### Create Face -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchProjection_7r-SketchLine_18f-SketchLine_19f-SketchProjection_9r-SketchProjection_8r")]) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchProjection_7r-SketchLine_18f-SketchLine_19f-SketchProjection_9r-SketchProjection_8r", + ) + ], +) ### Create AngularCopy -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), 4, keepSubResults = True) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 4, + keepSubResults=True, +) ### Create Plane -Plane_5 = model.addPlane(Part_1_doc, model.selection("VERTEX", "AngularCopy_1_1_3/MV:Rotated&Sketch_3/SketchLine_19_StartVertex&Sketch_3/SketchLine_18_EndVertex"), model.selection("VERTEX", "AngularCopy_1_1_4/MV:Rotated&Sketch_3/SketchLine_19_StartVertex&Sketch_3/SketchLine_18_EndVertex"), model.selection("VERTEX", "AngularCopy_1_1_4/MV:Rotated&Sketch_3/SketchLine_18_StartVertex&Sketch_3/SketchProjection_7_EndVertex")) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection( + "VERTEX", + "AngularCopy_1_1_3/MV:Rotated&Sketch_3/SketchLine_19_StartVertex&Sketch_3/SketchLine_18_EndVertex", + ), + model.selection( + "VERTEX", + "AngularCopy_1_1_4/MV:Rotated&Sketch_3/SketchLine_19_StartVertex&Sketch_3/SketchLine_18_EndVertex", + ), + model.selection( + "VERTEX", + "AngularCopy_1_1_4/MV:Rotated&Sketch_3/SketchLine_18_StartVertex&Sketch_3/SketchProjection_7_EndVertex", + ), +) ### Create Sketch Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2")) ### Create SketchProjection -SketchProjection_10 = Sketch_4.addProjection(model.selection("EDGE", "AngularCopy_1_1_3/ME:Rotated&Sketch_3/SketchLine_18"), True) +SketchProjection_10 = Sketch_4.addProjection( + model.selection("EDGE", "AngularCopy_1_1_3/ME:Rotated&Sketch_3/SketchLine_18"), True +) SketchLine_20 = SketchProjection_10.createdFeature() ### Create SketchProjection -SketchProjection_11 = Sketch_4.addProjection(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchProjection_3][Extrusion_2_1/To_Face]"), True) +SketchProjection_11 = Sketch_4.addProjection( + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchProjection_3][Extrusion_2_1/To_Face]", + ), + True, +) SketchLine_21 = SketchProjection_11.createdFeature() ### Create SketchProjection -SketchProjection_12 = Sketch_4.addProjection(model.selection("EDGE", "AngularCopy_1_1_4/ME:Rotated&Sketch_3/SketchLine_18"), True) +SketchProjection_12 = Sketch_4.addProjection( + model.selection("EDGE", "AngularCopy_1_1_4/ME:Rotated&Sketch_3/SketchLine_18"), True +) SketchLine_22 = SketchProjection_12.createdFeature() ### Create SketchLine -SketchLine_23 = Sketch_4.addLine(-245.2017461009716, 231.7060626516377, -78.06246341670106, 328.2039725015621) -Sketch_4.setCoincident(SketchAPI_Line(SketchLine_22).endPoint(), SketchLine_23.startPoint()) -Sketch_4.setCoincident(SketchAPI_Line(SketchLine_20).endPoint(), SketchLine_23.endPoint()) +SketchLine_23 = Sketch_4.addLine( + -245.2017461009716, 231.7060626516377, -78.06246341670106, 328.2039725015621 +) +Sketch_4.setCoincident( + SketchAPI_Line(SketchLine_22).endPoint(), SketchLine_23.startPoint() +) +Sketch_4.setCoincident( + SketchAPI_Line(SketchLine_20).endPoint(), SketchLine_23.endPoint() +) model.do() ### Create Face -Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchProjection_10r-SketchLine_23r-SketchProjection_12r-SketchProjection_11r")]) +Face_2 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_4/Face-SketchProjection_10r-SketchLine_23r-SketchProjection_12r-SketchProjection_11r", + ) + ], +) ### Create AngularCopy -AngularCopy_2 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OZ"), 4, keepSubResults = True) +AngularCopy_2 = model.addMultiRotation( + Part_1_doc, + [model.selection("FACE", "Face_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 4, + keepSubResults=True, +) ### Create Split -Split_2_objects_2 = [model.selection("COMPOUND", "AngularCopy_1_1"), - model.selection("COMPOUND", "AngularCopy_2_1"), - model.selection("SOLID", "Extrusion_2_1")] -Split_2 = model.addSplit(Part_1_doc, [model.selection("COMPSOLID", "Split_1_1")], Split_2_objects_2, keepSubResults = True) +Split_2_objects_2 = [ + model.selection("COMPOUND", "AngularCopy_1_1"), + model.selection("COMPOUND", "AngularCopy_2_1"), + model.selection("SOLID", "Extrusion_2_1"), +] +Split_2 = model.addSplit( + Part_1_doc, + [model.selection("COMPSOLID", "Split_1_1")], + Split_2_objects_2, + keepSubResults=True, +) ### Create Group -Group_1_objects = [model.selection("FACE", "Split_2_1_16/Modified_Face&Cylinder_2_1/Face_1"), - model.selection("FACE", "Split_2_1_17/Modified_Face&Cylinder_2_1/Face_1"), - model.selection("FACE", "Split_2_1_18/Modified_Face&Cylinder_2_1/Face_1"), - model.selection("FACE", "Split_2_1_19/Modified_Face&Cylinder_2_1/Face_1")] +Group_1_objects = [ + model.selection("FACE", "Split_2_1_16/Modified_Face&Cylinder_2_1/Face_1"), + model.selection("FACE", "Split_2_1_17/Modified_Face&Cylinder_2_1/Face_1"), + model.selection("FACE", "Split_2_1_18/Modified_Face&Cylinder_2_1/Face_1"), + model.selection("FACE", "Split_2_1_19/Modified_Face&Cylinder_2_1/Face_1"), +] Group_1 = model.addGroup(Part_1_doc, "Faces", Group_1_objects) Group_1.setName("shared_face_cyl") Group_1.result().setName("shared_face_cyl") @@ -245,4 +414,4 @@ model.testNbSubShapes(Split_2, GeomAPI_Shape.EDGE, [492]) model.testNbSubShapes(Split_2, GeomAPI_Shape.VERTEX, [984]) model.testResultsVolumes(Split_2, [5093568.889]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test20245_2.py b/src/FeaturesPlugin/Test/Test20245_2.py index f6eb28ebe..de1d46bf9 100644 --- a/src/FeaturesPlugin/Test/Test20245_2.py +++ b/src/FeaturesPlugin/Test/Test20245_2.py @@ -33,16 +33,24 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) ### Create SketchLine -SketchLine_1 = Sketch_1.addLine(7.071067811865538, 2.928932188134462, 2.928932188134676, 2.928932188134462) +SketchLine_1 = Sketch_1.addLine( + 7.071067811865538, 2.928932188134462, 2.928932188134676, 2.928932188134462 +) ### Create SketchLine -SketchLine_2 = Sketch_1.addLine(2.928932188134676, 2.928932188134462, 2.928932188134676, 7.071067811865324) +SketchLine_2 = Sketch_1.addLine( + 2.928932188134676, 2.928932188134462, 2.928932188134676, 7.071067811865324 +) ### Create SketchLine -SketchLine_3 = Sketch_1.addLine(2.928932188134676, 7.071067811865324, 7.071067811865538, 7.071067811865324) +SketchLine_3 = Sketch_1.addLine( + 2.928932188134676, 7.071067811865324, 7.071067811865538, 7.071067811865324 +) ### Create SketchLine -SketchLine_4 = Sketch_1.addLine(7.071067811865538, 7.071067811865324, 7.071067811865538, 2.928932188134462) +SketchLine_4 = Sketch_1.addLine( + 7.071067811865538, 7.071067811865324, 7.071067811865538, 2.928932188134462 +) Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) @@ -56,7 +64,9 @@ Sketch_1.setVertical(SketchLine_4.result()) SketchLine_5 = Sketch_1.addLine(0, 0, 2.928932188134676, 2.928932188134462) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchPoint_1.result()) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.endPoint()) @@ -65,7 +75,9 @@ Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.endPoint()) SketchLine_6 = Sketch_1.addLine(10, 0, 7.071067811865538, 2.928932188134462) ### Create SketchProjection -SketchProjection_2 = Sketch_1.addProjection(model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]"), False) +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() Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchPoint_2.result()) Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.endPoint()) @@ -74,7 +86,9 @@ Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.endPoint()) SketchLine_7 = Sketch_1.addLine(10, 10, 7.071067811865538, 7.071067811865324) ### Create SketchProjection -SketchProjection_3 = Sketch_1.addProjection(model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"), False) +SketchProjection_3 = Sketch_1.addProjection( + model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"), False +) SketchPoint_3 = SketchProjection_3.createdFeature() Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchPoint_3.result()) Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_7.endPoint()) @@ -83,7 +97,9 @@ Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_7.endPoint()) SketchLine_8 = Sketch_1.addLine(0, 10, 2.928932188134676, 7.071067811865324) ### Create SketchProjection -SketchProjection_4 = Sketch_1.addProjection(model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"), False) +SketchProjection_4 = Sketch_1.addProjection( + model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"), False +) SketchPoint_4 = SketchProjection_4.createdFeature() Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchPoint_4.result()) Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_8.endPoint()) @@ -94,10 +110,22 @@ Sketch_1.setEqual(SketchLine_5.result(), SketchLine_2.result()) model.do() ### Create Revolution -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), 0, 90, "Edges") +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), + 0, + 90, + "Edges", +) ### Create Split -Split_1 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "Revolution_1_1")], keepSubResults = True) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + [model.selection("COMPOUND", "Revolution_1_1")], + keepSubResults=True, +) model.end() @@ -111,4 +139,4 @@ model.testNbSubShapes(Split_1, GeomAPI_Shape.EDGE, [124]) model.testNbSubShapes(Split_1, GeomAPI_Shape.VERTEX, [248]) model.testResultsVolumes(Split_1, [1000]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test20245_3.py b/src/FeaturesPlugin/Test/Test20245_3.py index c946b5416..6d042bcaa 100644 --- a/src/FeaturesPlugin/Test/Test20245_3.py +++ b/src/FeaturesPlugin/Test/Test20245_3.py @@ -82,15 +82,21 @@ Sketch_1.setHorizontal(SketchLine_4.result()) Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchLine_2.result()) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_11 = SketchProjection_1.createdFeature() Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_11.result()) Sketch_1.setLength(SketchLine_5.result(), 3) -Sketch_1.setDistance(SketchAPI_Line(SketchLine_11).startPoint(), SketchLine_1.result(), 6.188, True) +Sketch_1.setDistance( + SketchAPI_Line(SketchLine_11).startPoint(), SketchLine_1.result(), 6.188, True +) Sketch_1.setVertical(SketchLine_7.result()) ### Create SketchProjection -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_12 = SketchProjection_2.createdFeature() Sketch_1.setDistance(SketchLine_9.endPoint(), SketchLine_12.result(), 9.028, True) Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_9.result(), 0.188, True) @@ -103,13 +109,19 @@ Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_12.result(), 2.25, True SketchLine_13 = Sketch_1.addLine(7.031999999999999, -4.05, 5.531999999999999, -4.05) ### Create SketchLine -SketchLine_14 = Sketch_1.addLine(5.531999999999999, -4.05, 5.531999999999999, -5.850000000000001) +SketchLine_14 = Sketch_1.addLine( + 5.531999999999999, -4.05, 5.531999999999999, -5.850000000000001 +) ### Create SketchLine -SketchLine_15 = Sketch_1.addLine(5.531999999999999, -5.850000000000001, 7.031999999999999, -5.850000000000001) +SketchLine_15 = Sketch_1.addLine( + 5.531999999999999, -5.850000000000001, 7.031999999999999, -5.850000000000001 +) ### Create SketchLine -SketchLine_16 = Sketch_1.addLine(7.031999999999999, -5.850000000000001, 7.031999999999999, -4.05) +SketchLine_16 = Sketch_1.addLine( + 7.031999999999999, -5.850000000000001, 7.031999999999999, -4.05 +) Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_13.startPoint()) Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) @@ -122,7 +134,9 @@ Sketch_1.setLength(SketchLine_14.result(), 1.8) Sketch_1.setLength(SketchLine_15.result(), 1.5) ### Create SketchLine -SketchLine_17 = Sketch_1.addLine(6.281999999999999, -4.050000000000001, 6.281999999999999, 9.028000000000002) +SketchLine_17 = Sketch_1.addLine( + 6.281999999999999, -4.050000000000001, 6.281999999999999, 9.028000000000002 +) SketchLine_17.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_17.startPoint(), SketchLine_13.result()) Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_10.result()) @@ -133,11 +147,15 @@ Sketch_1.setMiddlePoint(SketchLine_10.result(), SketchLine_17.endPoint()) Sketch_1.setDistance(SketchLine_14.startPoint(), SketchLine_2.result(), 0.6, True) ### Create SketchLine -SketchLine_18 = Sketch_1.addLine(6.375999999999999, 9.028, 6.534999999999997, 9.186999999999999) +SketchLine_18 = Sketch_1.addLine( + 6.375999999999999, 9.028, 6.534999999999997, 9.186999999999999 +) Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_18.startPoint()) ### Create SketchLine -SketchLine_19 = Sketch_1.addLine(6.534999999999997, 9.186999999999999, 6.534999999999997, 10.256) +SketchLine_19 = Sketch_1.addLine( + 6.534999999999997, 9.186999999999999, 6.534999999999997, 10.256 +) Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) ### Create SketchLine @@ -145,18 +163,24 @@ SketchLine_20 = Sketch_1.addLine(6.534999999999997, 10.256, 6.184999999999998, 1 Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) ### Create SketchLine -SketchLine_21 = Sketch_1.addLine(6.184999999999998, 10.256, 4.917500000000027, 10.94235984621998) +SketchLine_21 = Sketch_1.addLine( + 6.184999999999998, 10.256, 4.917500000000027, 10.94235984621998 +) Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) Sketch_1.setHorizontal(SketchLine_20.result()) Sketch_1.setVertical(SketchLine_19.result()) ### Create SketchConstraintAngle -Sketch_1.setAngle(SketchLine_10.result(), SketchLine_18.result(), 45, type = "Supplementary") +Sketch_1.setAngle( + SketchLine_10.result(), SketchLine_18.result(), 45, type="Supplementary" +) Sketch_1.setLength(SketchLine_20.result(), 0.35) Sketch_1.setDistance(SketchLine_19.endPoint(), SketchLine_12.result(), 10.256, True) ### Create SketchArc -SketchArc_1 = Sketch_1.addArc(0, 2.425, 4.917500000000027, 10.94235984621998, 0, 12.26, False) +SketchArc_1 = Sketch_1.addArc( + 0, 2.425, 4.917500000000027, 10.94235984621998, 0, 12.26, False +) Sketch_1.setCoincident(SketchLine_11.result(), SketchArc_1.center()) Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchArc_1.startPoint()) Sketch_1.setCoincident(SketchLine_11.result(), SketchArc_1.endPoint()) @@ -166,25 +190,35 @@ SketchLine_22 = Sketch_1.addLine(6.188000000000001, 9.028, 6.082, 9.532) Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_22.startPoint()) ### Create SketchArc -SketchArc_2 = Sketch_1.addArc(4.79378612024245, 9.263, 6.082, 9.532, 5.676067550792229, 10.23944020672391, False) +SketchArc_2 = Sketch_1.addArc( + 4.79378612024245, 9.263, 6.082, 9.532, 5.676067550792229, 10.23944020672391, False +) Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchArc_2.startPoint()) Sketch_1.setRadius(SketchArc_2.results()[1], 1.316) Sketch_1.setDistance(SketchArc_2.startPoint(), SketchLine_1.result(), 0.106, True) ### Create SketchLine -SketchLine_23 = Sketch_1.addLine(5.676067550792229, 10.23944020672391, 5.405090045827156, 10.43837553323928) +SketchLine_23 = Sketch_1.addLine( + 5.676067550792229, 10.23944020672391, 5.405090045827156, 10.43837553323928 +) Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_23.startPoint()) ### Create SketchLine -SketchLine_24 = Sketch_1.addLine(5.405090045827156, 10.43837553323928, 5.126644475052085, 10.62934617154252) +SketchLine_24 = Sketch_1.addLine( + 5.405090045827156, 10.43837553323928, 5.126644475052085, 10.62934617154252 +) Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) ### Create SketchLine -SketchLine_25 = Sketch_1.addLine(5.126644475052085, 10.62934617154252, 4.83550000000003, 10.80033167999934) +SketchLine_25 = Sketch_1.addLine( + 5.126644475052085, 10.62934617154252, 4.83550000000003, 10.80033167999934 +) Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint()) ### Create SketchArc -SketchArc_3 = Sketch_1.addArc(0, 2.425, 4.83550000000003, 10.80033167999934, 0, 12.096, False) +SketchArc_3 = Sketch_1.addArc( + 0, 2.425, 4.83550000000003, 10.80033167999934, 0, 12.096, False +) Sketch_1.setCoincident(SketchLine_11.result(), SketchArc_3.center()) Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchArc_3.startPoint()) Sketch_1.setCoincident(SketchLine_11.result(), SketchArc_3.endPoint()) @@ -221,57 +255,82 @@ Sketch_1.setDistance(SketchLine_25.startPoint(), SketchLine_28.endPoint(), 0.176 Sketch_1.setDistance(SketchLine_24.startPoint(), SketchLine_29.endPoint(), 0.212, True) ### Create SketchConstraintAngle -Sketch_1.setAngle(SketchLine_28.result(), SketchLine_11.result(), 32, type = "Direct") +Sketch_1.setAngle(SketchLine_28.result(), SketchLine_11.result(), 32, type="Direct") ### Create SketchConstraintAngle -Sketch_1.setAngle(SketchLine_29.result(), SketchLine_11.result(), 34, type = "Direct") +Sketch_1.setAngle(SketchLine_29.result(), SketchLine_11.result(), 34, type="Direct") ### Create SketchConstraintAngle -Sketch_1.setAngle(SketchLine_27.result(), SketchLine_11.result(), 30, type = "Direct") +Sketch_1.setAngle(SketchLine_27.result(), SketchLine_11.result(), 30, type="Direct") ### Create SketchLine -SketchLine_30 = Sketch_1.addLine(4.79378612024245, 9.263, 5.676067550792229, 10.23944020672391) +SketchLine_30 = Sketch_1.addLine( + 4.79378612024245, 9.263, 5.676067550792229, 10.23944020672391 +) SketchLine_30.setAuxiliary(True) Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_30.startPoint()) Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_30.endPoint()) ### Create SketchLine -SketchLine_31 = Sketch_1.addLine(4.79378612024245, 9.263, 4.79378612024245, 10.72808112087839) +SketchLine_31 = Sketch_1.addLine( + 4.79378612024245, 9.263, 4.79378612024245, 10.72808112087839 +) SketchLine_31.setAuxiliary(True) Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_31.startPoint()) Sketch_1.setVertical(SketchLine_31.result()) ### Create SketchConstraintAngle -Sketch_1.setAngle(SketchLine_30.result(), SketchLine_31.result(), 42.1, type = "Direct") +Sketch_1.setAngle(SketchLine_30.result(), SketchLine_31.result(), 42.1, type="Direct") Sketch_1.setDistance(SketchArc_2.center(), SketchLine_12.result(), 9.263, True) Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchLine_27.result()) Sketch_1.setDistance(SketchLine_22.endPoint(), SketchLine_12.result(), 9.532, True) -Sketch_1.setDistance(SketchLine_18.endPoint(), SketchLine_12.result(), 9.186999999999999, True) +Sketch_1.setDistance( + SketchLine_18.endPoint(), SketchLine_12.result(), 9.186999999999999, True +) Sketch_1.setRadius(SketchArc_1.results()[1], 9.835000000000001) model.do() ### Create Revolution -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_18f-SketchLine_19f-SketchLine_20f-SketchLine_21f-SketchArc_1_2f-SketchLine_26r-SketchArc_3_2r-SketchLine_25r-SketchLine_24r-SketchLine_23r-SketchArc_2_2r-SketchLine_22r-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r")], model.selection("EDGE", "PartSet/OZ"), 360, 0) +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_18f-SketchLine_19f-SketchLine_20f-SketchLine_21f-SketchArc_1_2f-SketchLine_26r-SketchArc_3_2r-SketchLine_25r-SketchLine_24r-SketchLine_23r-SketchArc_2_2r-SketchLine_22r-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r", + ) + ], + model.selection("EDGE", "PartSet/OZ"), + 360, + 0, +) ### Create Sketch Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) ### Create SketchProjection -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_29_StartVertex"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_29_StartVertex"), False +) SketchPoint_1 = SketchProjection_3.createdFeature() ### Create SketchProjection -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_26"), False) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchLine_26"), False +) SketchLine_32 = SketchProjection_4.createdFeature() ### Create SketchArc -SketchArc_4 = Sketch_2.addArc(0, 2.425, 0, 12.178, 5.453808387550563, 10.51060344512907, True) +SketchArc_4 = Sketch_2.addArc( + 0, 2.425, 0, 12.178, 5.453808387550563, 10.51060344512907, True +) SketchArc_4.setAuxiliary(True) Sketch_2.setCoincident(SketchPoint_1.result(), SketchArc_4.center()) Sketch_2.setCoincident(SketchLine_32.result(), SketchArc_4.startPoint()) ### Create SketchProjection -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_29"), False) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchLine_29"), False +) SketchLine_33 = SketchProjection_5.createdFeature() Sketch_2.setCoincident(SketchArc_4.endPoint(), SketchLine_33.result()) Sketch_2.setMiddlePoint(SketchArc_4.startPoint(), SketchLine_32.result()) @@ -279,10 +338,14 @@ Sketch_2.setMiddlePoint(SketchArc_4.startPoint(), SketchLine_32.result()) ### Create SketchLine SketchLine_34 = Sketch_2.addLine(0, 2.425, 3.282538500974084, 11.74164236673399) SketchLine_34.setAuxiliary(True) -Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_34.startPoint()) +Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_34.startPoint() +) ### Create SketchLine -SketchLine_35 = Sketch_2.addLine(3.282538500974084, 11.74164236673399, 3.199461499025965, 11.50584963625379) +SketchLine_35 = Sketch_2.addLine( + 3.282538500974084, 11.74164236673399, 3.199461499025965, 11.50584963625379 +) Sketch_2.setCoincident(SketchLine_34.endPoint(), SketchLine_35.startPoint()) Sketch_2.setCoincident(SketchLine_35.endPoint(), SketchLine_34.result()) Sketch_2.setLength(SketchLine_35.result(), 0.25) @@ -293,61 +356,97 @@ Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchArc_4.results()[1]) Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_35.result()) ### Create SketchProjection -SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_6 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_36 = SketchProjection_6.createdFeature() Sketch_2.setDistance(SketchPoint_2.coordinates(), SketchLine_36.result(), 3.241, True) ### Create SketchArc -SketchArc_5 = Sketch_2.addArc(0, 2.425, 3.282538500974084, 11.74164236673399, 4.1398177019328, 11.393656164374, True) -Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_5.center()) +SketchArc_5 = Sketch_2.addArc( + 0, + 2.425, + 3.282538500974084, + 11.74164236673399, + 4.1398177019328, + 11.393656164374, + True, +) +Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_5.center() +) Sketch_2.setCoincident(SketchLine_34.endPoint(), SketchArc_5.startPoint()) ### Create SketchArc -SketchArc_6 = Sketch_2.addArc(0, 2.425, 3.199461499025965, 11.50584963625379, 4.035044020470642, 11.16667053559353, True) +SketchArc_6 = Sketch_2.addArc( + 0, + 2.425, + 3.199461499025965, + 11.50584963625379, + 4.035044020470642, + 11.16667053559353, + True, +) Sketch_2.setCoincident(SketchAPI_Line(SketchLine_33).startPoint(), SketchArc_6.center()) Sketch_2.setCoincident(SketchLine_35.endPoint(), SketchArc_6.startPoint()) ### Create SketchLine SketchLine_37 = Sketch_2.addLine(0, 2.425, 3.911506014428326, 11.49555702253677) SketchLine_37.setAuxiliary(True) -Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_37.startPoint()) +Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_37.startPoint() +) Sketch_2.setCoincident(SketchLine_37.endPoint(), SketchArc_5.results()[1]) ### Create SketchLine SketchLine_38 = Sketch_2.addLine(0, 2.425, 4.1398177019328, 11.393656164374) SketchLine_38.setAuxiliary(True) -Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_38.startPoint()) +Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_38.startPoint() +) Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_38.endPoint()) Sketch_2.setCoincident(SketchArc_6.endPoint(), SketchLine_38.result()) Sketch_2.setDistance(SketchLine_35.startPoint(), SketchLine_37.result(), 0.675, True) Sketch_2.setMiddlePoint(SketchPoint_2.coordinates(), SketchLine_35.result()) ### Create SketchLine -SketchLine_39 = Sketch_2.addLine(3.911506014428326, 11.49555702253677, 3.81251062025875, 11.26599240868435) +SketchLine_39 = Sketch_2.addLine( + 3.911506014428326, 11.49555702253677, 3.81251062025875, 11.26599240868435 +) Sketch_2.setCoincident(SketchLine_37.endPoint(), SketchLine_39.startPoint()) Sketch_2.setCoincident(SketchLine_39.endPoint(), SketchArc_6.results()[1]) Sketch_2.setCoincident(SketchLine_39.endPoint(), SketchLine_37.result()) ### Create SketchLine -SketchLine_40 = Sketch_2.addLine(4.1398177019328, 11.393656164374, 4.459277785066647, 11.19096067956113) +SketchLine_40 = Sketch_2.addLine( + 4.1398177019328, 11.393656164374, 4.459277785066647, 11.19096067956113 +) Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_40.startPoint()) ### Create SketchProjection -SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchArc_1_2"), False) +SketchProjection_7 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchArc_1_2"), False +) SketchArc_7 = SketchProjection_7.createdFeature() Sketch_2.setCoincident(SketchLine_40.endPoint(), SketchArc_7.results()[1]) ### Create SketchLine -SketchLine_41 = Sketch_2.addLine(4.459277785066647, 11.19096067956113, 4.390495384356095, 11.04194790978503) +SketchLine_41 = Sketch_2.addLine( + 4.459277785066647, 11.19096067956113, 4.390495384356095, 11.04194790978503 +) Sketch_2.setCoincident(SketchLine_40.endPoint(), SketchLine_41.startPoint()) ### Create SketchProjection -SketchProjection_8 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchArc_3_2"), False) +SketchProjection_8 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchArc_3_2"), False +) SketchArc_8 = SketchProjection_8.createdFeature() Sketch_2.setCoincident(SketchLine_41.endPoint(), SketchArc_8.results()[1]) ### Create SketchLine -SketchLine_42 = Sketch_2.addLine(4.390495384356095, 11.04194790978503, 4.035044020470642, 11.16667053559353) +SketchLine_42 = Sketch_2.addLine( + 4.390495384356095, 11.04194790978503, 4.035044020470642, 11.16667053559353 +) Sketch_2.setCoincident(SketchLine_41.endPoint(), SketchLine_42.startPoint()) Sketch_2.setCoincident(SketchLine_42.endPoint(), SketchLine_38.result()) Sketch_2.setCoincident(SketchLine_42.endPoint(), SketchArc_6.endPoint()) @@ -357,19 +456,57 @@ Sketch_2.setParallel(SketchLine_41.result(), SketchLine_38.result()) model.do() ### Create Revolution -Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_35f-SketchArc_6_2r-SketchLine_39r-SketchArc_5_2f_wire")], model.selection("EDGE", "Sketch_2/SketchLine_35"), 360, 0) +Revolution_2 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "WIRE", + "Sketch_2/Face-SketchLine_35f-SketchArc_6_2r-SketchLine_39r-SketchArc_5_2f_wire", + ) + ], + model.selection("EDGE", "Sketch_2/SketchLine_35"), + 360, + 0, +) ### Create Revolution -Revolution_3 = model.addRevolution(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchArc_5_2f-SketchLine_39f-SketchArc_6_2r-SketchLine_42r-SketchLine_41r-SketchLine_40r_wire")], model.selection("EDGE", "Sketch_2/SketchLine_35"), 360, 0) +Revolution_3 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "WIRE", + "Sketch_2/Face-SketchArc_5_2f-SketchLine_39f-SketchArc_6_2r-SketchLine_42r-SketchLine_41r-SketchLine_40r_wire", + ) + ], + model.selection("EDGE", "Sketch_2/SketchLine_35"), + 360, + 0, +) ### Create Symmetry -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Revolution_2_1"), model.selection("SOLID", "Revolution_3_1")], model.selection("FACE", "PartSet/YOZ"), keepOriginal = True) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [ + model.selection("SOLID", "Revolution_2_1"), + model.selection("SOLID", "Revolution_3_1"), + ], + model.selection("FACE", "PartSet/YOZ"), + keepOriginal=True, +) ### Create Cut -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("COMPOUND", "Symmetry_1_1")]) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Revolution_1_1")], + [model.selection("COMPOUND", "Symmetry_1_1")], +) ### Create Fuse -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cut_1_1"), model.selection("COMPOUND", "Symmetry_1_2")], removeEdges = True) +Fuse_1 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Cut_1_1"), model.selection("COMPOUND", "Symmetry_1_2")], + removeEdges=True, +) ### Create Plane Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 3.6, False) @@ -378,11 +515,23 @@ Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 3.6 Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) ### Create SketchProjection -SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2]"), True) +SketchProjection_9 = Sketch_3.addProjection( + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2]", + ), + True, +) SketchCircle_1 = SketchProjection_9.createdFeature() ### Create SketchProjection -SketchProjection_10 = Sketch_3.addProjection(model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_9][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8]"), True) +SketchProjection_10 = Sketch_3.addProjection( + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_9][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8]", + ), + True, +) SketchCircle_2 = SketchProjection_10.createdFeature() ### Create SketchArc @@ -390,7 +539,9 @@ SketchArc_9 = Sketch_3.addArc(0, 0, 6.094, 0, 5.859569950090201, -1.674, True) Sketch_3.setCoincident(SketchAPI_Circle(SketchCircle_1).center(), SketchArc_9.center()) ### Create SketchProjection -SketchProjection_11 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_11 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_43 = SketchProjection_11.createdFeature() Sketch_3.setCoincident(SketchArc_9.startPoint(), SketchLine_43.result()) @@ -402,17 +553,23 @@ Sketch_3.setDistance(SketchArc_9.startPoint(), SketchPoint_3.coordinates(), 0.09 Sketch_3.setDistance(SketchArc_9.endPoint(), SketchLine_43.result(), 1.674, True) ### Create SketchLine -SketchLine_44 = Sketch_3.addLine(5.859569950090201, -1.674, 5.870724657144867, -1.956000000000001) +SketchLine_44 = Sketch_3.addLine( + 5.859569950090201, -1.674, 5.870724657144867, -1.956000000000001 +) Sketch_3.setCoincident(SketchArc_9.endPoint(), SketchLine_44.startPoint()) Sketch_3.setCoincident(SketchLine_44.endPoint(), SketchCircle_1.results()[1]) ### Create SketchArc -SketchArc_10 = Sketch_3.addArc(0, 0, 6.470000000000001, 0, 6.167249305809295, -1.955999999999993, True) +SketchArc_10 = Sketch_3.addArc( + 0, 0, 6.470000000000001, 0, 6.167249305809295, -1.955999999999993, True +) Sketch_3.setCoincident(SketchAPI_Circle(SketchCircle_1).center(), SketchArc_10.center()) Sketch_3.setCoincident(SketchLine_43.result(), SketchArc_10.startPoint()) ### Create SketchLine -SketchLine_45 = Sketch_3.addLine(6.167249305809295, -1.955999999999993, 6.068561608816571, -1.956000000000005) +SketchLine_45 = Sketch_3.addLine( + 6.167249305809295, -1.955999999999993, 6.068561608816571, -1.956000000000005 +) Sketch_3.setCoincident(SketchArc_10.endPoint(), SketchLine_45.startPoint()) Sketch_3.setCoincident(SketchLine_45.endPoint(), SketchCircle_2.results()[1]) Sketch_3.setHorizontal(SketchLine_45.result()) @@ -423,16 +580,45 @@ Sketch_3.setDistance(SketchArc_10.startPoint(), SketchLine_45.result(), 1.956, T SketchPoint_4 = Sketch_3.addPoint(6.376, 0) Sketch_3.setCoincident(SketchPoint_4.coordinates(), SketchCircle_2.results()[1]) Sketch_3.setCoincident(SketchPoint_4.coordinates(), SketchLine_43.result()) -Sketch_3.setDistance(SketchPoint_4.coordinates(), SketchArc_10.startPoint(), 0.094, True) +Sketch_3.setDistance( + SketchPoint_4.coordinates(), SketchArc_10.startPoint(), 0.094, True +) ### Create SketchConstraintMirror -SketchConstraintMirror_1_objects = [SketchArc_9.results()[1], SketchLine_44.result(), SketchArc_10.results()[1], SketchLine_45.result()] -SketchConstraintMirror_1 = Sketch_3.addMirror(SketchLine_43.result(), SketchConstraintMirror_1_objects) -[SketchArc_11, SketchLine_46, SketchArc_12, SketchLine_47] = SketchConstraintMirror_1.mirrored() +SketchConstraintMirror_1_objects = [ + SketchArc_9.results()[1], + SketchLine_44.result(), + SketchArc_10.results()[1], + SketchLine_45.result(), +] +SketchConstraintMirror_1 = Sketch_3.addMirror( + SketchLine_43.result(), SketchConstraintMirror_1_objects +) +[ + SketchArc_11, + SketchLine_46, + SketchArc_12, + SketchLine_47, +] = SketchConstraintMirror_1.mirrored() model.do() ### Create Extrusion -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchProjection_9r-SketchProjection_9r-SketchLine_46r-SketchArc_11_2r-SketchArc_9_2r-SketchLine_44f"), model.selection("WIRE", "Sketch_3/Face-SketchProjection_10r-SketchLine_45r-SketchArc_10_2f-SketchArc_12_2f-SketchLine_47f-SketchProjection_10r_wire")], model.selection(), 0, 4.2) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchProjection_9r-SketchProjection_9r-SketchLine_46r-SketchArc_11_2r-SketchArc_9_2r-SketchLine_44f", + ), + model.selection( + "WIRE", + "Sketch_3/Face-SketchProjection_10r-SketchLine_45r-SketchArc_10_2f-SketchArc_12_2f-SketchLine_47f-SketchProjection_10r_wire", + ), + ], + model.selection(), + 0, + 4.2, +) ### Create Sketch Sketch_4 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) @@ -458,7 +644,9 @@ Sketch_4.setHorizontal(SketchLine_50.result()) Sketch_4.setVertical(SketchLine_51.result()) ### Create SketchProjection -SketchProjection_12 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_12 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_52 = SketchProjection_12.createdFeature() Sketch_4.setDistance(SketchLine_52.result(), SketchLine_50.endPoint(), 0.3, True) Sketch_4.setDistance(SketchLine_51.endPoint(), SketchLine_52.result(), 2.1, True) @@ -469,329 +657,939 @@ Sketch_4.setCoincident(SketchPoint_5.coordinates(), SketchLine_48.result()) Sketch_4.setMiddlePoint(SketchLine_48.result(), SketchPoint_5.coordinates()) ### Create SketchProjection -SketchProjection_13 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_13 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_53 = SketchProjection_13.createdFeature() Sketch_4.setCoincident(SketchPoint_5.coordinates(), SketchLine_53.result()) Sketch_4.setDistance(SketchPoint_5.coordinates(), SketchLine_51.endPoint(), 0.75, True) model.do() ### Create Extrusion -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchLine_48r-SketchLine_49f-SketchLine_50f-SketchLine_51f")], model.selection(), 10, 0) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_4/Face-SketchLine_48r-SketchLine_49f-SketchLine_50f-SketchLine_51f", + ) + ], + model.selection(), + 10, + 0, +) ### Create Rotation -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1")], axis = model.selection("EDGE", "PartSet/OZ"), angle = -90) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Extrusion_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=-90, +) ### Create Rotation -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], axis = model.selection("EDGE", "PartSet/OZ"), angle = -90) +Rotation_2 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_2_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=-90, +) ### Create Fuse -Fuse_2 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Fuse_1_1"), model.selection("COMPOUND", "Rotation_1_1")], removeEdges = True) +Fuse_2 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Fuse_1_1"), model.selection("COMPOUND", "Rotation_1_1")], + removeEdges=True, +) ### Create Cut -Cut_2 = model.addCut(Part_1_doc, [model.selection("SOLID", "Fuse_2_1")], [model.selection("SOLID", "Rotation_2_1")]) +Cut_2 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Fuse_2_1")], + [model.selection("SOLID", "Rotation_2_1")], +) ### Create Group -Group_1_objects = [model.selection("VERTEX", "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40]"), - model.selection("VERTEX", "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2][(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1]"), - model.selection("VERTEX", "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40][Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2]"), - model.selection("VERTEX", "[(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2]"), - model.selection("VERTEX", "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21]"), - model.selection("VERTEX", "[_new_weak_name_87_Cut_2_1]e[_new_weak_name_78_Cut_2_1]e[_new_weak_name_77_Cut_2_1]e[_new_weak_name_85_Cut_2_1]e"), - model.selection("VERTEX", "[_new_weak_name_78_Cut_2_1]e[_new_weak_name_64_Cut_2_1]e[_new_weak_name_77_Cut_2_1]e"), - model.selection("VERTEX", "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][new_weak_name_2]"), - model.selection("VERTEX", "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42]"), - model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20]"), - model.selection("VERTEX", "[Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2]"), - model.selection("VERTEX", "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42][Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2]"), - model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19]"), - model.selection("VERTEX", "[Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2][(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1]"), - model.selection("VERTEX", "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25]"), - model.selection("VERTEX", "[_new_weak_name_86_Cut_2_1]e[_new_weak_name_75_Cut_2_1]e[_new_weak_name_74_Cut_2_1]e[_new_weak_name_84_Cut_2_1]e"), - model.selection("VERTEX", "[_new_weak_name_75_Cut_2_1]e[_new_weak_name_63_Cut_2_1]e[_new_weak_name_74_Cut_2_1]e"), - model.selection("VERTEX", "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][new_weak_name_2]"), - model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_18]"), - model.selection("VERTEX", "[(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2]"), - model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24]"), - model.selection("VERTEX", "[Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2]"), - model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_18][Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9]"), - model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23]"), - model.selection("VERTEX", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8]"), - model.selection("VERTEX", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Fuse_2_1/Modified_Face&Extrusion_1_2/From_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_47]"), - model.selection("VERTEX", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Fuse_2_1/Modified_Face&Extrusion_1_2/From_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_45]"), - model.selection("VERTEX", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_45][Fuse_2_1/Modified_Face&Extrusion_1_2/To_Face]"), - model.selection("VERTEX", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Fuse_2_1/Modified_Face&Extrusion_1_2/To_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_47]"), - model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23][Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2]"), - model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7]"), - model.selection("VERTEX", "[Fuse_2_1/Modified_Face&Extrusion_1_2/From_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_45][Cut_2_1/Modified_Face&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2]"), - model.selection("VERTEX", "[Fuse_2_1/Modified_Face&Extrusion_1_2/From_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_47][Cut_2_1/Modified_Face&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2]"), - model.selection("VERTEX", "[Fuse_2_1/Modified_Face&Sketch_3/SketchLine_45][Fuse_2_1/Modified_Face&Extrusion_1_2/To_Face][Cut_2_1/Modified_Face&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2]"), - model.selection("VERTEX", "[Fuse_2_1/Modified_Face&Extrusion_1_2/To_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_47][Cut_2_1/Modified_Face&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2]"), - model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22]"), - model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6]"), - model.selection("VERTEX", "Cut_2_1/Generated_Vertex&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2&new_weak_name_4"), - model.selection("VERTEX", "Cut_2_1/Generated_Vertex&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2&new_weak_name_3"), - model.selection("VERTEX", "Cut_2_1/Generated_Vertex&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2&new_weak_name_1"), - model.selection("VERTEX", "Cut_2_1/Generated_Vertex&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2&new_weak_name_2"), - model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22][Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1]"), - model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5]"), - model.selection("VERTEX", "Cut_2_1/Generated_Vertex&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2&new_weak_name_4"), - model.selection("VERTEX", "Cut_2_1/Generated_Vertex&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2&new_weak_name_3"), - model.selection("VERTEX", "Cut_2_1/Generated_Vertex&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2&new_weak_name_1"), - model.selection("VERTEX", "Cut_2_1/Generated_Vertex&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2&new_weak_name_2"), - model.selection("VERTEX", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2]"), - model.selection("VERTEX", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_44][Fuse_2_1/Modified_Face&Extrusion_1_1/From_Face]"), - model.selection("VERTEX", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_44][Fuse_2_1/Modified_Face&Extrusion_1_1/To_Face]"), - model.selection("VERTEX", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Fuse_2_1/Modified_Face&Extrusion_1_1/From_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_46]"), - model.selection("VERTEX", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_46][Fuse_2_1/Modified_Face&Extrusion_1_1/To_Face]"), - model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_4]"), - model.selection("VERTEX", "[Cut_2_1/Modified_Face&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_44][Fuse_2_1/Modified_Face&Extrusion_1_1/From_Face]"), - model.selection("VERTEX", "[Cut_2_1/Modified_Face&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_44][Fuse_2_1/Modified_Face&Extrusion_1_1/To_Face]"), - model.selection("VERTEX", "[Cut_2_1/Modified_Face&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2][Fuse_2_1/Modified_Face&Extrusion_1_1/From_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_46]"), - model.selection("VERTEX", "[Cut_2_1/Modified_Face&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_46][Fuse_2_1/Modified_Face&Extrusion_1_1/To_Face]"), - model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_16][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_15]"), - model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_16][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13]"), - model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_15][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_14]"), - model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_14]")] +Group_1_objects = [ + model.selection( + "VERTEX", + "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40]", + ), + model.selection( + "VERTEX", + "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2][(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1]", + ), + model.selection( + "VERTEX", + "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40][Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2]", + ), + model.selection( + "VERTEX", + "[(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2]", + ), + model.selection( + "VERTEX", + "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21]", + ), + model.selection( + "VERTEX", + "[_new_weak_name_87_Cut_2_1]e[_new_weak_name_78_Cut_2_1]e[_new_weak_name_77_Cut_2_1]e[_new_weak_name_85_Cut_2_1]e", + ), + model.selection( + "VERTEX", + "[_new_weak_name_78_Cut_2_1]e[_new_weak_name_64_Cut_2_1]e[_new_weak_name_77_Cut_2_1]e", + ), + model.selection( + "VERTEX", "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][new_weak_name_2]" + ), + model.selection( + "VERTEX", + "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42]", + ), + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20]", + ), + model.selection( + "VERTEX", + "[Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2]", + ), + model.selection( + "VERTEX", + "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42][Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2]", + ), + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19]", + ), + model.selection( + "VERTEX", + "[Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2][(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1]", + ), + model.selection( + "VERTEX", + "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25]", + ), + model.selection( + "VERTEX", + "[_new_weak_name_86_Cut_2_1]e[_new_weak_name_75_Cut_2_1]e[_new_weak_name_74_Cut_2_1]e[_new_weak_name_84_Cut_2_1]e", + ), + model.selection( + "VERTEX", + "[_new_weak_name_75_Cut_2_1]e[_new_weak_name_63_Cut_2_1]e[_new_weak_name_74_Cut_2_1]e", + ), + model.selection( + "VERTEX", "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][new_weak_name_2]" + ), + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_18]", + ), + model.selection( + "VERTEX", + "[(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2]", + ), + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24]", + ), + model.selection( + "VERTEX", + "[Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2]", + ), + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_18][Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9]", + ), + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23]", + ), + model.selection( + "VERTEX", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8]", + ), + model.selection( + "VERTEX", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Fuse_2_1/Modified_Face&Extrusion_1_2/From_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_47]", + ), + model.selection( + "VERTEX", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Fuse_2_1/Modified_Face&Extrusion_1_2/From_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_45]", + ), + model.selection( + "VERTEX", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_45][Fuse_2_1/Modified_Face&Extrusion_1_2/To_Face]", + ), + model.selection( + "VERTEX", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Fuse_2_1/Modified_Face&Extrusion_1_2/To_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_47]", + ), + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23][Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2]", + ), + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7]", + ), + model.selection( + "VERTEX", + "[Fuse_2_1/Modified_Face&Extrusion_1_2/From_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_45][Cut_2_1/Modified_Face&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2]", + ), + model.selection( + "VERTEX", + "[Fuse_2_1/Modified_Face&Extrusion_1_2/From_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_47][Cut_2_1/Modified_Face&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2]", + ), + model.selection( + "VERTEX", + "[Fuse_2_1/Modified_Face&Sketch_3/SketchLine_45][Fuse_2_1/Modified_Face&Extrusion_1_2/To_Face][Cut_2_1/Modified_Face&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2]", + ), + model.selection( + "VERTEX", + "[Fuse_2_1/Modified_Face&Extrusion_1_2/To_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_47][Cut_2_1/Modified_Face&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2]", + ), + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22]", + ), + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ), + model.selection( + "VERTEX", + "Cut_2_1/Generated_Vertex&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2&new_weak_name_4", + ), + model.selection( + "VERTEX", + "Cut_2_1/Generated_Vertex&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2&new_weak_name_3", + ), + model.selection( + "VERTEX", + "Cut_2_1/Generated_Vertex&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2&new_weak_name_1", + ), + model.selection( + "VERTEX", + "Cut_2_1/Generated_Vertex&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2&new_weak_name_2", + ), + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22][Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1]", + ), + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5]", + ), + model.selection( + "VERTEX", + "Cut_2_1/Generated_Vertex&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2&new_weak_name_4", + ), + model.selection( + "VERTEX", + "Cut_2_1/Generated_Vertex&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2&new_weak_name_3", + ), + model.selection( + "VERTEX", + "Cut_2_1/Generated_Vertex&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2&new_weak_name_1", + ), + model.selection( + "VERTEX", + "Cut_2_1/Generated_Vertex&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2&new_weak_name_2", + ), + model.selection( + "VERTEX", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2]", + ), + model.selection( + "VERTEX", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_44][Fuse_2_1/Modified_Face&Extrusion_1_1/From_Face]", + ), + model.selection( + "VERTEX", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_44][Fuse_2_1/Modified_Face&Extrusion_1_1/To_Face]", + ), + model.selection( + "VERTEX", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Fuse_2_1/Modified_Face&Extrusion_1_1/From_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_46]", + ), + model.selection( + "VERTEX", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_46][Fuse_2_1/Modified_Face&Extrusion_1_1/To_Face]", + ), + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_4]", + ), + model.selection( + "VERTEX", + "[Cut_2_1/Modified_Face&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_44][Fuse_2_1/Modified_Face&Extrusion_1_1/From_Face]", + ), + model.selection( + "VERTEX", + "[Cut_2_1/Modified_Face&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_44][Fuse_2_1/Modified_Face&Extrusion_1_1/To_Face]", + ), + model.selection( + "VERTEX", + "[Cut_2_1/Modified_Face&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2][Fuse_2_1/Modified_Face&Extrusion_1_1/From_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_46]", + ), + model.selection( + "VERTEX", + "[Cut_2_1/Modified_Face&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_46][Fuse_2_1/Modified_Face&Extrusion_1_1/To_Face]", + ), + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_16][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_15]", + ), + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_16][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13]", + ), + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_15][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_14]", + ), + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_14]", + ), +] Group_1 = model.addGroup(Part_1_doc, "VERTEX", Group_1_objects) ### Create Group -Group_2_objects = [model.selection("EDGE", "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40]"), - model.selection("EDGE", "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2][(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1]"), - model.selection("EDGE", "([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40])([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40][Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2_Cut_2_1"), - model.selection("EDGE", "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40][Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2]"), - model.selection("EDGE", "([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40])([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40][Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2])_Cut_2_1"), - model.selection("EDGE", "([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40])2([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42])2_Cut_2_1"), - model.selection("EDGE", "[(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2]"), - model.selection("EDGE", "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21]"), - model.selection("EDGE", "([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20])2([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2])2_Cut_2_1"), - model.selection("EDGE", "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][new_weak_name_2]"), - model.selection("EDGE", "([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21])3([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2])3_Cut_2_1"), - model.selection("EDGE", "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][new_weak_name_1]"), - model.selection("EDGE", "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42]"), - model.selection("EDGE", "([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42])([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42][Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2])2_Cut_2_1"), - model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20]"), - model.selection("EDGE", "([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20])_Cut_2_1"), - model.selection("EDGE", "([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2])([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21])2_Cut_2_1"), - model.selection("EDGE", "[Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2]"), - model.selection("EDGE", "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42][Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2]"), - model.selection("EDGE", "([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42])([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42][Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2])_Cut_2_1"), - model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19]"), - model.selection("EDGE", "[Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2][(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1]"), - model.selection("EDGE", "([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2])([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21])3([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2])3_Cut_2_1"), - model.selection("EDGE", "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25]"), - model.selection("EDGE", "([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24])2([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2])2_Cut_2_1"), - model.selection("EDGE", "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][new_weak_name_2]"), - model.selection("EDGE", "([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25])3([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2])3_Cut_2_1"), - model.selection("EDGE", "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][new_weak_name_1]"), - model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_18]"), - model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_18])_Cut_2_1"), - model.selection("EDGE", "([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2])2([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2])2_Cut_2_1"), - model.selection("EDGE", "[(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2]"), - model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24]"), - model.selection("EDGE", "([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24])_Cut_2_1"), - model.selection("EDGE", "([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2])([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25])2_Cut_2_1"), - model.selection("EDGE", "[Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2]"), - model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_18][Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9]"), - model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_18])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_18][Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9])_Cut_2_1"), - model.selection("EDGE", "([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2])([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2])3([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25])3_Cut_2_1"), - model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23]"), - model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23])_Cut_2_1"), - model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_18][Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9])([Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8])_Cut_2_1"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Fuse_2_1/Modified_Face&Extrusion_1_2/From_Face]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_45]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Fuse_2_1/Modified_Face&Extrusion_1_2/To_Face]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_47]"), - model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23][Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2]"), - model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23][Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2])_Cut_2_1"), - model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7]"), - model.selection("EDGE", "([Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7])_Cut_2_1"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Extrusion_1_2/From_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_45]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Extrusion_1_2/From_Face][Cut_2_1/Modified_Face&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Extrusion_1_2/From_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_47]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Sketch_3/SketchLine_45][Cut_2_1/Modified_Face&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Sketch_3/SketchLine_45][Fuse_2_1/Modified_Face&Extrusion_1_2/To_Face]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Extrusion_1_2/To_Face][Cut_2_1/Modified_Face&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Extrusion_1_2/To_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_47]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Sketch_3/SketchLine_47][Cut_2_1/Modified_Face&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2]"), - model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22]"), - model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23][Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2])([Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22])_Cut_2_1"), - model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6]"), - model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8][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_6])_Cut_2_1"), - model.selection("EDGE", "Cut_2_1/Generated_Edge&Sketch_4/SketchLine_51&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2"), - model.selection("EDGE", "Cut_2_1/Generated_Edge&Sketch_4/SketchLine_50&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2"), - model.selection("EDGE", "Cut_2_1/Generated_Edge&Sketch_4/SketchLine_49&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2"), - model.selection("EDGE", "Cut_2_1/Generated_Edge&Sketch_4/SketchLine_48&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2"), - model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22][Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1]"), - model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22][Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1])_Cut_2_1"), - model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5]"), - model.selection("EDGE", "Cut_2_1/Generated_Edge&Sketch_4/SketchLine_51&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2"), - model.selection("EDGE", "[Cut_2_1/Modified_Face&Sketch_4/SketchLine_51][Cut_2_1/Modified_Face&Sketch_4/SketchLine_48]"), - model.selection("EDGE", "[Cut_2_1/Modified_Face&Sketch_4/SketchLine_51][Cut_2_1/Modified_Face&Sketch_4/SketchLine_50]"), - model.selection("EDGE", "Cut_2_1/Generated_Edge&Sketch_4/SketchLine_50&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2"), - model.selection("EDGE", "[Cut_2_1/Modified_Face&Sketch_4/SketchLine_50][Cut_2_1/Modified_Face&Sketch_4/SketchLine_49]"), - model.selection("EDGE", "Cut_2_1/Generated_Edge&Sketch_4/SketchLine_49&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2"), - model.selection("EDGE", "[Cut_2_1/Modified_Face&Sketch_4/SketchLine_49][Cut_2_1/Modified_Face&Sketch_4/SketchLine_48]"), - model.selection("EDGE", "Cut_2_1/Generated_Edge&Sketch_4/SketchLine_48&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2"), - model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22][Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1])([Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2])_Cut_2_1"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_44]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Fuse_2_1/Modified_Face&Extrusion_1_1/From_Face]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_46]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Fuse_2_1/Modified_Face&Extrusion_1_1/To_Face]"), - model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_4]"), - 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_4])_Cut_2_1"), - model.selection("EDGE", "[Cut_2_1/Modified_Face&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_44]"), - model.selection("EDGE", "[Cut_2_1/Modified_Face&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2][Fuse_2_1/Modified_Face&Extrusion_1_1/From_Face]"), - model.selection("EDGE", "[Cut_2_1/Modified_Face&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2][Fuse_2_1/Modified_Face&Extrusion_1_1/To_Face]"), - model.selection("EDGE", "[Cut_2_1/Modified_Face&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_46]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Sketch_3/SketchLine_44][Fuse_2_1/Modified_Face&Extrusion_1_1/From_Face]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Sketch_3/SketchLine_44][Fuse_2_1/Modified_Face&Extrusion_1_1/To_Face]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Extrusion_1_1/From_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_46]"), - model.selection("EDGE", "[Fuse_2_1/Modified_Face&Sketch_3/SketchLine_46][Fuse_2_1/Modified_Face&Extrusion_1_1/To_Face]"), - model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_16][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_15]"), - model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_16][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13]"), - model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_16][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_15])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_16][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13])_Cut_2_1"), - model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_15][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_14]"), - model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_14]"), - model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_15][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_14])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_14])_Cut_2_1")] +Group_2_objects = [ + model.selection( + "EDGE", + "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40]", + ), + model.selection( + "EDGE", + "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2][(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1]", + ), + model.selection( + "EDGE", + "([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40])([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40][Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2_Cut_2_1", + ), + model.selection( + "EDGE", + "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40][Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2]", + ), + model.selection( + "EDGE", + "([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40])([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40][Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2])_Cut_2_1", + ), + model.selection( + "EDGE", + "([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40])2([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42])2_Cut_2_1", + ), + model.selection( + "EDGE", + "[(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2]", + ), + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21]", + ), + model.selection( + "EDGE", + "([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20])2([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2])2_Cut_2_1", + ), + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][new_weak_name_2]", + ), + model.selection( + "EDGE", + "([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21])3([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2])3_Cut_2_1", + ), + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][new_weak_name_1]", + ), + model.selection( + "EDGE", + "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42]", + ), + model.selection( + "EDGE", + "([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42])([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42][Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2])2_Cut_2_1", + ), + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20]", + ), + model.selection( + "EDGE", + "([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20])_Cut_2_1", + ), + model.selection( + "EDGE", + "([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2])([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21])2_Cut_2_1", + ), + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2]", + ), + model.selection( + "EDGE", + "[Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42][Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2]", + ), + model.selection( + "EDGE", + "([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2][Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42])([Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42][Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2])_Cut_2_1", + ), + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19]", + ), + model.selection( + "EDGE", + "[Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2][(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1]", + ), + model.selection( + "EDGE", + "([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2])([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21])3([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2])3_Cut_2_1", + ), + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25]", + ), + model.selection( + "EDGE", + "([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24])2([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2])2_Cut_2_1", + ), + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][new_weak_name_2]", + ), + model.selection( + "EDGE", + "([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25])3([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2])3_Cut_2_1", + ), + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][new_weak_name_1]", + ), + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_18]", + ), + model.selection( + "EDGE", + "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_18])_Cut_2_1", + ), + model.selection( + "EDGE", + "([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2])2([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2])2_Cut_2_1", + ), + model.selection( + "EDGE", + "[(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2]", + ), + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24]", + ), + model.selection( + "EDGE", + "([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24])_Cut_2_1", + ), + model.selection( + "EDGE", + "([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2])([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25])2_Cut_2_1", + ), + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2]", + ), + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_18][Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9]", + ), + model.selection( + "EDGE", + "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_18])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_18][Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9])_Cut_2_1", + ), + model.selection( + "EDGE", + "([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2])([Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40][Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2])3([Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25])3_Cut_2_1", + ), + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23]", + ), + model.selection( + "EDGE", + "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23])_Cut_2_1", + ), + model.selection( + "EDGE", + "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_18][Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9])([Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8])_Cut_2_1", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Fuse_2_1/Modified_Face&Extrusion_1_2/From_Face]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_45]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Fuse_2_1/Modified_Face&Extrusion_1_2/To_Face]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_47]", + ), + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23][Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2]", + ), + model.selection( + "EDGE", + "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23][Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2])_Cut_2_1", + ), + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7]", + ), + model.selection( + "EDGE", + "([Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7])_Cut_2_1", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Extrusion_1_2/From_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_45]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Extrusion_1_2/From_Face][Cut_2_1/Modified_Face&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Extrusion_1_2/From_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_47]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Sketch_3/SketchLine_45][Cut_2_1/Modified_Face&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Sketch_3/SketchLine_45][Fuse_2_1/Modified_Face&Extrusion_1_2/To_Face]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Extrusion_1_2/To_Face][Cut_2_1/Modified_Face&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Extrusion_1_2/To_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_47]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Sketch_3/SketchLine_47][Cut_2_1/Modified_Face&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2]", + ), + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22]", + ), + model.selection( + "EDGE", + "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23][Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2])([Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22])_Cut_2_1", + ), + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ), + model.selection( + "EDGE", + "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8][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_6])_Cut_2_1", + ), + model.selection( + "EDGE", + "Cut_2_1/Generated_Edge&Sketch_4/SketchLine_51&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2", + ), + model.selection( + "EDGE", + "Cut_2_1/Generated_Edge&Sketch_4/SketchLine_50&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2", + ), + model.selection( + "EDGE", + "Cut_2_1/Generated_Edge&Sketch_4/SketchLine_49&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2", + ), + model.selection( + "EDGE", + "Cut_2_1/Generated_Edge&Sketch_4/SketchLine_48&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2", + ), + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22][Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1]", + ), + model.selection( + "EDGE", + "([Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22][Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1])_Cut_2_1", + ), + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5]", + ), + model.selection( + "EDGE", + "Cut_2_1/Generated_Edge&Sketch_4/SketchLine_51&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2", + ), + model.selection( + "EDGE", + "[Cut_2_1/Modified_Face&Sketch_4/SketchLine_51][Cut_2_1/Modified_Face&Sketch_4/SketchLine_48]", + ), + model.selection( + "EDGE", + "[Cut_2_1/Modified_Face&Sketch_4/SketchLine_51][Cut_2_1/Modified_Face&Sketch_4/SketchLine_50]", + ), + model.selection( + "EDGE", + "Cut_2_1/Generated_Edge&Sketch_4/SketchLine_50&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2", + ), + model.selection( + "EDGE", + "[Cut_2_1/Modified_Face&Sketch_4/SketchLine_50][Cut_2_1/Modified_Face&Sketch_4/SketchLine_49]", + ), + model.selection( + "EDGE", + "Cut_2_1/Generated_Edge&Sketch_4/SketchLine_49&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2", + ), + model.selection( + "EDGE", + "[Cut_2_1/Modified_Face&Sketch_4/SketchLine_49][Cut_2_1/Modified_Face&Sketch_4/SketchLine_48]", + ), + model.selection( + "EDGE", + "Cut_2_1/Generated_Edge&Sketch_4/SketchLine_48&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2", + ), + model.selection( + "EDGE", + "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22][Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1])([Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2])_Cut_2_1", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_44]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Fuse_2_1/Modified_Face&Extrusion_1_1/From_Face]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_46]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1][Fuse_2_1/Modified_Face&Extrusion_1_1/To_Face]", + ), + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_4]", + ), + 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_4])_Cut_2_1", + ), + model.selection( + "EDGE", + "[Cut_2_1/Modified_Face&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_44]", + ), + model.selection( + "EDGE", + "[Cut_2_1/Modified_Face&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2][Fuse_2_1/Modified_Face&Extrusion_1_1/From_Face]", + ), + model.selection( + "EDGE", + "[Cut_2_1/Modified_Face&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2][Fuse_2_1/Modified_Face&Extrusion_1_1/To_Face]", + ), + model.selection( + "EDGE", + "[Cut_2_1/Modified_Face&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_46]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Sketch_3/SketchLine_44][Fuse_2_1/Modified_Face&Extrusion_1_1/From_Face]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Sketch_3/SketchLine_44][Fuse_2_1/Modified_Face&Extrusion_1_1/To_Face]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Extrusion_1_1/From_Face][Fuse_2_1/Modified_Face&Sketch_3/SketchLine_46]", + ), + model.selection( + "EDGE", + "[Fuse_2_1/Modified_Face&Sketch_3/SketchLine_46][Fuse_2_1/Modified_Face&Extrusion_1_1/To_Face]", + ), + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_16][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_15]", + ), + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_16][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13]", + ), + model.selection( + "EDGE", + "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_16][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_15])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_16][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13])_Cut_2_1", + ), + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_15][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_14]", + ), + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_14]", + ), + model.selection( + "EDGE", + "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_15][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_14])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_14])_Cut_2_1", + ), +] Group_2 = model.addGroup(Part_1_doc, "EDGE", Group_2_objects) ### Create Group -Group_3_objects = [model.selection("FACE", "Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2"), - model.selection("FACE", "Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40"), - model.selection("FACE", "(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1"), - model.selection("FACE", "Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2"), - model.selection("FACE", "Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21"), - model.selection("FACE", "Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40"), - model.selection("FACE", "Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20"), - model.selection("FACE", "Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2"), - model.selection("FACE", "Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19"), - model.selection("FACE", "(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25"), - model.selection("FACE", "Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_18"), - model.selection("FACE", "Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24"), - model.selection("FACE", "Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8"), - model.selection("FACE", "Fuse_2_1/Modified_Face&Extrusion_1_2/From_Face"), - model.selection("FACE", "Fuse_2_1/Modified_Face&Sketch_3/SketchLine_45"), - model.selection("FACE", "Fuse_2_1/Modified_Face&Extrusion_1_2/To_Face"), - model.selection("FACE", "Fuse_2_1/Modified_Face&Sketch_3/SketchLine_47"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7"), - model.selection("FACE", "Cut_2_1/Modified_Face&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6"), - model.selection("FACE", "Cut_2_1/Modified_Face&Sketch_4/SketchLine_51"), - model.selection("FACE", "Cut_2_1/Modified_Face&Sketch_4/SketchLine_50"), - model.selection("FACE", "Cut_2_1/Modified_Face&Sketch_4/SketchLine_49"), - model.selection("FACE", "Cut_2_1/Modified_Face&Sketch_4/SketchLine_48"), - model.selection("FACE", "Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5"), - model.selection("FACE", "Cut_2_1/Modified_Face&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2"), - model.selection("FACE", "Fuse_2_1/Modified_Face&Sketch_3/SketchLine_44"), - model.selection("FACE", "Fuse_2_1/Modified_Face&Extrusion_1_1/From_Face"), - model.selection("FACE", "Fuse_2_1/Modified_Face&Sketch_3/SketchLine_46"), - model.selection("FACE", "Fuse_2_1/Modified_Face&Extrusion_1_1/To_Face"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_4"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_16"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_15"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13"), - model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_14")] +Group_3_objects = [ + model.selection("FACE", "Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2"), + model.selection("FACE", "Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_40"), + model.selection( + "FACE", + "(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1", + ), + model.selection("FACE", "Fuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2"), + model.selection("FACE", "Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchArc_6_2"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21"), + model.selection("FACE", "Fuse_1_1/Modified_Face&Sketch_2/SketchLine_40"), + model.selection("FACE", "Symmetry_1_2_2/MF:Symmetried&Sketch_2/SketchLine_42"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20"), + model.selection("FACE", "Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2"), + model.selection("FACE", "Fuse_1_1/Modified_Face&Sketch_1/SketchArc_3_2"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19"), + model.selection( + "FACE", + "(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_5_2)(Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2)_Cut_2_1", + ), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25"), + model.selection("FACE", "Fuse_1_1/Modified_Face&Sketch_2/SketchLine_42"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_18"), + model.selection("FACE", "Symmetry_1_2_1/MF:Symmetried&Sketch_2/SketchArc_6_2"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24"), + model.selection("FACE", "Fuse_2_1/Modified_Face&Sketch_1/SketchLine_9"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8"), + model.selection("FACE", "Fuse_2_1/Modified_Face&Extrusion_1_2/From_Face"), + model.selection("FACE", "Fuse_2_1/Modified_Face&Sketch_3/SketchLine_45"), + model.selection("FACE", "Fuse_2_1/Modified_Face&Extrusion_1_2/To_Face"), + model.selection("FACE", "Fuse_2_1/Modified_Face&Sketch_3/SketchLine_47"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7"), + model.selection( + "FACE", "Cut_2_1/Modified_Face&Sketch_3/SketchArc_12_2&Sketch_3/SketchArc_10_2" + ), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6"), + model.selection("FACE", "Cut_2_1/Modified_Face&Sketch_4/SketchLine_51"), + model.selection("FACE", "Cut_2_1/Modified_Face&Sketch_4/SketchLine_50"), + model.selection("FACE", "Cut_2_1/Modified_Face&Sketch_4/SketchLine_49"), + model.selection("FACE", "Cut_2_1/Modified_Face&Sketch_4/SketchLine_48"), + model.selection("FACE", "Fuse_2_1/Modified_Face&Sketch_1/SketchLine_1"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5"), + model.selection( + "FACE", "Cut_2_1/Modified_Face&Sketch_3/SketchArc_9_2&Sketch_3/SketchArc_11_2" + ), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2"), + model.selection("FACE", "Fuse_2_1/Modified_Face&Sketch_3/SketchLine_44"), + model.selection("FACE", "Fuse_2_1/Modified_Face&Extrusion_1_1/From_Face"), + model.selection("FACE", "Fuse_2_1/Modified_Face&Sketch_3/SketchLine_46"), + model.selection("FACE", "Fuse_2_1/Modified_Face&Extrusion_1_1/To_Face"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_4"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_16"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_15"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_14"), +] Group_3 = model.addGroup(Part_1_doc, "FACE", Group_3_objects) ### Create Partition -Partition_1_objects = [model.selection("SOLID", "Cut_2_1"), - model.selection("FACE", "PartSet/XOZ"), - model.selection("FACE", "PartSet/YOZ")] -Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults = True) +Partition_1_objects = [ + model.selection("SOLID", "Cut_2_1"), + model.selection("FACE", "PartSet/XOZ"), + model.selection("FACE", "PartSet/YOZ"), +] +Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults=True) ### Create Revolution -Revolution_4 = model.addRevolution(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_35")], model.selection("EDGE", "PartSet/OZ"), 360, 0) +Revolution_4 = model.addRevolution( + Part_1_doc, + [model.selection("EDGE", "Sketch_2/SketchLine_35")], + model.selection("EDGE", "PartSet/OZ"), + 360, + 0, +) ### Create Split -Split_1 = model.addSplit(Part_1_doc, [model.selection("COMPOUND", "all-in-Partition_1")], [model.selection("FACE", "Revolution_4_1")], keepSubResults = True) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Partition_1")], + [model.selection("FACE", "Revolution_4_1")], + keepSubResults=True, +) ### Create Plane -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), model.selection("EDGE", "Sketch_2/SketchLine_34"), 45) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOZ"), + model.selection("EDGE", "Sketch_2/SketchLine_34"), + 45, +) ### Create Sketch Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2")) ### Create SketchLine -SketchLine_54 = Sketch_5.addLine(5.509213645269787, 10.82082332930156, 5.382690082387538, 10.60520378465038) +SketchLine_54 = Sketch_5.addLine( + 5.509213645269787, 10.82082332930156, 5.382690082387538, 10.60520378465038 +) ### Create SketchLine -SketchLine_55 = Sketch_5.addLine(5.382690082387538, 10.60520378465038, 5.5912917558727, 10.4792224745154) +SketchLine_55 = Sketch_5.addLine( + 5.382690082387538, 10.60520378465038, 5.5912917558727, 10.4792224745154 +) Sketch_5.setCoincident(SketchLine_54.endPoint(), SketchLine_55.startPoint()) ### Create SketchLine -SketchLine_56 = Sketch_5.addLine(5.5912917558727, 10.4792224745154, 5.928669438910004, 10.31165844357506) +SketchLine_56 = Sketch_5.addLine( + 5.5912917558727, 10.4792224745154, 5.928669438910004, 10.31165844357506 +) Sketch_5.setCoincident(SketchLine_55.endPoint(), SketchLine_56.startPoint()) ### Create SketchIntersectionPoint -SketchIntersectionPoint_1 = Sketch_5.addIntersectionPoint(model.selection("EDGE", "[Split_1_1_7/Modified_Face&Sketch_2/SketchLine_39][Split_1_1_7/Modified_Face&Sketch_2/SketchArc_5_2]"), True) +SketchIntersectionPoint_1 = Sketch_5.addIntersectionPoint( + model.selection( + "EDGE", + "[Split_1_1_7/Modified_Face&Sketch_2/SketchLine_39][Split_1_1_7/Modified_Face&Sketch_2/SketchArc_5_2]", + ), + True, +) [SketchPoint_6] = SketchIntersectionPoint_1.intersectionPoints() ### Create SketchIntersectionPoint -SketchIntersectionPoint_2 = Sketch_5.addIntersectionPoint(model.selection("EDGE", "[Split_1_1_7/Modified_Face&Sketch_2/SketchArc_5_2][Split_1_1_7/Modified_Face&Sketch_2/SketchLine_40]"), True) +SketchIntersectionPoint_2 = Sketch_5.addIntersectionPoint( + model.selection( + "EDGE", + "[Split_1_1_7/Modified_Face&Sketch_2/SketchArc_5_2][Split_1_1_7/Modified_Face&Sketch_2/SketchLine_40]", + ), + True, +) [SketchPoint_7] = SketchIntersectionPoint_2.intersectionPoints() ### Create SketchIntersectionPoint -SketchIntersectionPoint_3 = Sketch_5.addIntersectionPoint(model.selection("EDGE", "[Split_1_1_7/Modified_Face&Sketch_1/SketchArc_1_2][Split_1_1_7/Modified_Face&Sketch_2/SketchLine_40]"), True) +SketchIntersectionPoint_3 = Sketch_5.addIntersectionPoint( + model.selection( + "EDGE", + "[Split_1_1_7/Modified_Face&Sketch_1/SketchArc_1_2][Split_1_1_7/Modified_Face&Sketch_2/SketchLine_40]", + ), + True, +) [SketchPoint_8] = SketchIntersectionPoint_3.intersectionPoints() ### Create SketchIntersectionPoint -SketchIntersectionPoint_4 = Sketch_5.addIntersectionPoint(model.selection("EDGE", "[Split_1_1_7/Modified_Face&Sketch_2/SketchArc_6_2][Split_1_1_7/Modified_Face&Sketch_2/SketchLine_39]"), True) +SketchIntersectionPoint_4 = Sketch_5.addIntersectionPoint( + model.selection( + "EDGE", + "[Split_1_1_7/Modified_Face&Sketch_2/SketchArc_6_2][Split_1_1_7/Modified_Face&Sketch_2/SketchLine_39]", + ), + True, +) [SketchPoint_9] = SketchIntersectionPoint_4.intersectionPoints() -Sketch_5.setCoincident(SketchLine_54.startPoint(), SketchAPI_Point(SketchPoint_6).coordinates()) -Sketch_5.setCoincident(SketchLine_55.startPoint(), SketchAPI_Point(SketchPoint_9).coordinates()) +Sketch_5.setCoincident( + SketchLine_54.startPoint(), SketchAPI_Point(SketchPoint_6).coordinates() +) +Sketch_5.setCoincident( + SketchLine_55.startPoint(), SketchAPI_Point(SketchPoint_9).coordinates() +) ### Create SketchIntersectionPoint -SketchIntersectionPoint_5 = Sketch_5.addIntersectionPoint(model.selection("EDGE", "[Split_1_1_7/Modified_Face&Sketch_2/SketchLine_42][Split_1_1_7/Modified_Face&Sketch_2/SketchArc_6_2]"), True) +SketchIntersectionPoint_5 = Sketch_5.addIntersectionPoint( + model.selection( + "EDGE", + "[Split_1_1_7/Modified_Face&Sketch_2/SketchLine_42][Split_1_1_7/Modified_Face&Sketch_2/SketchArc_6_2]", + ), + True, +) [SketchPoint_10] = SketchIntersectionPoint_5.intersectionPoints() ### Create SketchIntersectionPoint -SketchIntersectionPoint_6 = Sketch_5.addIntersectionPoint(model.selection("EDGE", "[Split_1_1_7/Modified_Face&Sketch_1/SketchArc_3_2][Split_1_1_7/Modified_Face&Sketch_2/SketchLine_42]"), True) +SketchIntersectionPoint_6 = Sketch_5.addIntersectionPoint( + model.selection( + "EDGE", + "[Split_1_1_7/Modified_Face&Sketch_1/SketchArc_3_2][Split_1_1_7/Modified_Face&Sketch_2/SketchLine_42]", + ), + True, +) [SketchPoint_11] = SketchIntersectionPoint_6.intersectionPoints() -Sketch_5.setCoincident(SketchLine_55.endPoint(), SketchAPI_Point(SketchPoint_10).coordinates()) -Sketch_5.setCoincident(SketchLine_56.endPoint(), SketchAPI_Point(SketchPoint_11).coordinates()) +Sketch_5.setCoincident( + SketchLine_55.endPoint(), SketchAPI_Point(SketchPoint_10).coordinates() +) +Sketch_5.setCoincident( + SketchLine_56.endPoint(), SketchAPI_Point(SketchPoint_11).coordinates() +) ### Create SketchLine -SketchLine_57 = Sketch_5.addLine(5.723231855768999, 10.69157079694662, 5.5912917558727, 10.4792224745154) +SketchLine_57 = Sketch_5.addLine( + 5.723231855768999, 10.69157079694662, 5.5912917558727, 10.4792224745154 +) SketchLine_57.setName("SketchLine_72") SketchLine_57.result().setName("SketchLine_72") Sketch_5.setCoincident(SketchLine_55.endPoint(), SketchLine_57.endPoint()) ### Create SketchLine -SketchLine_58 = Sketch_5.addLine(5.928669438910005, 10.31165844357506, 6.034221518827074, 10.48153710152002) +SketchLine_58 = Sketch_5.addLine( + 5.928669438910005, 10.31165844357506, 6.034221518827074, 10.48153710152002 +) SketchLine_58.setName("SketchLine_109") SketchLine_58.result().setName("SketchLine_109") Sketch_5.setCoincident(SketchLine_56.endPoint(), SketchLine_58.startPoint()) ### Create SketchLine -SketchLine_59 = Sketch_5.addLine(6.034221518827074, 10.48153710152002, 5.723231855768999, 10.69157079694662) +SketchLine_59 = Sketch_5.addLine( + 6.034221518827074, 10.48153710152002, 5.723231855768999, 10.69157079694662 +) SketchLine_59.setName("SketchLine_113") SketchLine_59.result().setName("SketchLine_113") Sketch_5.setCoincident(SketchLine_58.endPoint(), SketchLine_59.startPoint()) -Sketch_5.setCoincident(SketchLine_58.result(), SketchAPI_Point(SketchPoint_8).coordinates()) +Sketch_5.setCoincident( + SketchLine_58.result(), SketchAPI_Point(SketchPoint_8).coordinates() +) Sketch_5.setLength(SketchLine_58.result(), 0.2) ### Create SketchLine -SketchLine_60 = Sketch_5.addLine(5.723231855768999, 10.69157079694662, 5.514274587785066, 10.82944811108761) +SketchLine_60 = Sketch_5.addLine( + 5.723231855768999, 10.69157079694662, 5.514274587785066, 10.82944811108761 +) SketchLine_60.setName("SketchLine_114") SketchLine_60.result().setName("SketchLine_114") -Sketch_5.setCoincident(SketchAPI_Point(SketchPoint_7).coordinates(), SketchLine_60.startPoint()) +Sketch_5.setCoincident( + SketchAPI_Point(SketchPoint_7).coordinates(), SketchLine_60.startPoint() +) ### Create SketchLine -SketchLine_61 = Sketch_5.addLine(5.514274587785066, 10.82944811108761, 5.509213645269788, 10.82082332930156) +SketchLine_61 = Sketch_5.addLine( + 5.514274587785066, 10.82944811108761, 5.509213645269788, 10.82082332930156 +) SketchLine_61.setName("SketchLine_115") SketchLine_61.result().setName("SketchLine_115") Sketch_5.setCoincident(SketchLine_60.endPoint(), SketchLine_61.startPoint()) @@ -806,29 +1604,80 @@ model.do() Face_1 = model.addFace(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_5")]) ### Create Revolution -Revolution_5 = model.addRevolution(Part_1_doc, [model.selection("EDGE", "Face_1_2/Modified_Edge&Sketch_5/SketchLine_109")], model.selection("EDGE", "PartSet/OZ"), model.selection("FACE", "PartSet/YOZ"), 0, model.selection(), 0) +Revolution_5 = model.addRevolution( + Part_1_doc, + [model.selection("EDGE", "Face_1_2/Modified_Edge&Sketch_5/SketchLine_109")], + model.selection("EDGE", "PartSet/OZ"), + model.selection("FACE", "PartSet/YOZ"), + 0, + model.selection(), + 0, +) ### Create Symmetry -Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "all-in-Face_1"), model.selection("COMPOUND", "all-in-Revolution_5")], model.selection("FACE", "PartSet/YOZ"), keepOriginal = True, keepSubResults = True) +Symmetry_2 = model.addSymmetry( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Face_1"), + model.selection("COMPOUND", "all-in-Revolution_5"), + ], + model.selection("FACE", "PartSet/YOZ"), + keepOriginal=True, + keepSubResults=True, +) ### Create Symmetry -Symmetry_3 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "all-in-Symmetry_2")], model.selection("FACE", "PartSet/XOZ"), keepOriginal = True, keepSubResults = True) +Symmetry_3 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Symmetry_2")], + model.selection("FACE", "PartSet/XOZ"), + keepOriginal=True, + keepSubResults=True, +) ### Create Point -Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "[Split_1_1_7/Modified_Face&Sketch_1/SketchArc_1_2][Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_21]"), 1.25, False, False) +Point_2 = model.addPoint( + Part_1_doc, + model.selection( + "EDGE", + "[Split_1_1_7/Modified_Face&Sketch_1/SketchArc_1_2][Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_21]", + ), + 1.25, + False, + False, +) ### Create Plane -Plane_6 = model.addPlane(Part_1_doc, model.selection("EDGE", "Symmetry_3_1_1_1_1_2/ME:Symmetried&Sketch_5/SketchLine_109"), model.selection("VERTEX", "Point_1"), False) +Plane_6 = model.addPlane( + Part_1_doc, + model.selection( + "EDGE", "Symmetry_3_1_1_1_1_2/ME:Symmetried&Sketch_5/SketchLine_109" + ), + model.selection("VERTEX", "Point_1"), + False, +) ### Create Sketch Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_3")) ### Create SketchIntersectionPoint -SketchIntersectionPoint_7 = Sketch_6.addIntersectionPoint(model.selection("EDGE", "[Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_25][Split_1_1_7/Modified_Face&Sketch_1/SketchArc_3_2]"), True) +SketchIntersectionPoint_7 = Sketch_6.addIntersectionPoint( + model.selection( + "EDGE", + "[Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_25][Split_1_1_7/Modified_Face&Sketch_1/SketchArc_3_2]", + ), + True, +) [SketchPoint_12] = SketchIntersectionPoint_7.intersectionPoints() ### Create SketchIntersectionPoint -SketchIntersectionPoint_8 = Sketch_6.addIntersectionPoint(model.selection("EDGE", "[Split_1_1_7/Modified_Face&Sketch_1/SketchArc_1_2][Split_1_1_7/Modified_Face&Sketch_2/SketchLine_40]"), True) +SketchIntersectionPoint_8 = Sketch_6.addIntersectionPoint( + model.selection( + "EDGE", + "[Split_1_1_7/Modified_Face&Sketch_1/SketchArc_1_2][Split_1_1_7/Modified_Face&Sketch_2/SketchLine_40]", + ), + True, +) SketchIntersectionPoint_8.setName("SketchIntersectionPoint_9") SketchIntersectionPoint_8.result().setName("SketchIntersectionPoint_9") [SketchPoint_13] = SketchIntersectionPoint_8.intersectionPoints() @@ -836,7 +1685,13 @@ SketchPoint_13.setName("SketchPoint_14") SketchPoint_13.result().setName("SketchPoint_14") ### Create SketchIntersectionPoint -SketchIntersectionPoint_9 = Sketch_6.addIntersectionPoint(model.selection("EDGE", "[Split_1_1_7/Modified_Face&Sketch_1/SketchArc_3_2][Split_1_1_7/Modified_Face&Sketch_2/SketchLine_42]"), True) +SketchIntersectionPoint_9 = Sketch_6.addIntersectionPoint( + model.selection( + "EDGE", + "[Split_1_1_7/Modified_Face&Sketch_1/SketchArc_3_2][Split_1_1_7/Modified_Face&Sketch_2/SketchLine_42]", + ), + True, +) SketchIntersectionPoint_9.setName("SketchIntersectionPoint_10") SketchIntersectionPoint_9.result().setName("SketchIntersectionPoint_10") [SketchPoint_14] = SketchIntersectionPoint_9.intersectionPoints() @@ -844,38 +1699,84 @@ SketchPoint_14.setName("SketchPoint_15") SketchPoint_14.result().setName("SketchPoint_15") ### Create SketchProjection -SketchProjection_14 = Sketch_6.addProjection(model.selection("VERTEX", "Point_1"), False) +SketchProjection_14 = Sketch_6.addProjection( + model.selection("VERTEX", "Point_1"), False +) SketchPoint_15 = SketchProjection_14.createdFeature() SketchPoint_15.setName("SketchPoint_16") SketchPoint_15.result().setName("SketchPoint_16") ### Create SketchLine -SketchLine_62 = Sketch_6.addLine(5.246389275102901, -10.59990828317982, 5.359721474154084, -10.7814541886472) +SketchLine_62 = Sketch_6.addLine( + 5.246389275102901, -10.59990828317982, 5.359721474154084, -10.7814541886472 +) SketchLine_62.setName("SketchLine_60") SketchLine_62.result().setName("SketchLine_60") -Sketch_6.setCoincident(SketchLine_62.result(), SketchAPI_Point(SketchPoint_15).coordinates()) -Sketch_6.setCoincident(SketchLine_62.result(), SketchAPI_Point(SketchPoint_12).coordinates()) -Sketch_6.setDistance(SketchAPI_Point(SketchPoint_15).coordinates(), SketchLine_62.endPoint(), 0.05, True) -Sketch_6.setCoincident(SketchLine_62.startPoint(), SketchAPI_Point(SketchPoint_12).coordinates()) +Sketch_6.setCoincident( + SketchLine_62.result(), SketchAPI_Point(SketchPoint_15).coordinates() +) +Sketch_6.setCoincident( + SketchLine_62.result(), SketchAPI_Point(SketchPoint_12).coordinates() +) +Sketch_6.setDistance( + SketchAPI_Point(SketchPoint_15).coordinates(), SketchLine_62.endPoint(), 0.05, True +) +Sketch_6.setCoincident( + SketchLine_62.startPoint(), SketchAPI_Point(SketchPoint_12).coordinates() +) model.do() ### Create Filling -Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Sketch_6/SketchLine_60"), model.selection("EDGE", "Symmetry_3_1_1_1_1_2/ME:Symmetried&Sketch_5/SketchLine_109")]) +Filling_1 = model.addFilling( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_6/SketchLine_60"), + model.selection( + "EDGE", "Symmetry_3_1_1_1_1_2/ME:Symmetried&Sketch_5/SketchLine_109" + ), + ], +) ### Create Revolution -Revolution_6 = model.addRevolution(Part_1_doc, [model.selection("EDGE", "Sketch_6/SketchLine_60")], model.selection("EDGE", "PartSet/OZ"), 360, 0) +Revolution_6 = model.addRevolution( + Part_1_doc, + [model.selection("EDGE", "Sketch_6/SketchLine_60")], + model.selection("EDGE", "PartSet/OZ"), + 360, + 0, +) ### Create Point -Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "[Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_21][Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_20]"), 1.5, False, False) +Point_3 = model.addPoint( + Part_1_doc, + model.selection( + "EDGE", + "[Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_21][Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_20]", + ), + 1.5, + False, + False, +) ### Create Plane -Plane_7 = model.addPlane(Part_1_doc, model.selection("EDGE", "Sketch_6/SketchLine_60"), model.selection("VERTEX", "Point_2"), False) +Plane_7 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "Sketch_6/SketchLine_60"), + model.selection("VERTEX", "Point_2"), + False, +) ### Create Sketch Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_4")) ### Create SketchIntersectionPoint -SketchIntersectionPoint_10 = Sketch_7.addIntersectionPoint(model.selection("EDGE", "[Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_20][Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_19]"), True) +SketchIntersectionPoint_10 = Sketch_7.addIntersectionPoint( + model.selection( + "EDGE", + "[Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_20][Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_19]", + ), + True, +) SketchIntersectionPoint_10.setName("SketchIntersectionPoint_11") SketchIntersectionPoint_10.result().setName("SketchIntersectionPoint_11") [SketchPoint_16] = SketchIntersectionPoint_10.intersectionPoints() @@ -883,7 +1784,13 @@ SketchPoint_16.setName("SketchPoint_17") SketchPoint_16.result().setName("SketchPoint_17") ### Create SketchIntersectionPoint -SketchIntersectionPoint_11 = Sketch_7.addIntersectionPoint(model.selection("EDGE", "[Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_19][Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_18]"), True) +SketchIntersectionPoint_11 = Sketch_7.addIntersectionPoint( + model.selection( + "EDGE", + "[Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_19][Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_18]", + ), + True, +) SketchIntersectionPoint_11.setName("SketchIntersectionPoint_12") SketchIntersectionPoint_11.result().setName("SketchIntersectionPoint_12") [SketchPoint_17] = SketchIntersectionPoint_11.intersectionPoints() @@ -891,7 +1798,13 @@ SketchPoint_17.setName("SketchPoint_18") SketchPoint_17.result().setName("SketchPoint_18") ### Create SketchIntersectionPoint -SketchIntersectionPoint_12 = Sketch_7.addIntersectionPoint(model.selection("EDGE", "[Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_18][Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_9]"), True) +SketchIntersectionPoint_12 = Sketch_7.addIntersectionPoint( + model.selection( + "EDGE", + "[Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_18][Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_9]", + ), + True, +) SketchIntersectionPoint_12.setName("SketchIntersectionPoint_13") SketchIntersectionPoint_12.result().setName("SketchIntersectionPoint_13") [SketchPoint_18] = SketchIntersectionPoint_12.intersectionPoints() @@ -899,13 +1812,19 @@ SketchPoint_18.setName("SketchPoint_19") SketchPoint_18.result().setName("SketchPoint_19") ### Create SketchLine -SketchLine_63 = Sketch_7.addLine(6.348502432487296, -9.04671367200557, 6.153596006787127, -10.27430623369788) +SketchLine_63 = Sketch_7.addLine( + 6.348502432487296, -9.04671367200557, 6.153596006787127, -10.27430623369788 +) SketchLine_63.setName("SketchLine_65") SketchLine_63.result().setName("SketchLine_65") -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_18).coordinates(), SketchLine_63.startPoint()) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_18).coordinates(), SketchLine_63.startPoint() +) ### Create SketchProjection -SketchProjection_15 = Sketch_7.addProjection(model.selection("VERTEX", "Point_2"), False) +SketchProjection_15 = Sketch_7.addProjection( + model.selection("VERTEX", "Point_2"), False +) SketchProjection_15.setName("SketchProjection_16") SketchProjection_15.result().setName("SketchProjection_16") SketchPoint_19 = SketchProjection_15.createdFeature() @@ -914,7 +1833,13 @@ SketchPoint_19.result().setName("SketchPoint_20") Sketch_7.setCoincident(SketchLine_63.endPoint(), SketchPoint_19.result()) ### Create SketchIntersectionPoint -SketchIntersectionPoint_13 = Sketch_7.addIntersectionPoint(model.selection("EDGE", "[Partition_1_1_4/Modified_Face&Sketch_1/SketchArc_2_2][Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_23]"), True) +SketchIntersectionPoint_13 = Sketch_7.addIntersectionPoint( + model.selection( + "EDGE", + "[Partition_1_1_4/Modified_Face&Sketch_1/SketchArc_2_2][Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_23]", + ), + True, +) SketchIntersectionPoint_13.setName("SketchIntersectionPoint_14") SketchIntersectionPoint_13.result().setName("SketchIntersectionPoint_14") [SketchPoint_20] = SketchIntersectionPoint_13.intersectionPoints() @@ -922,7 +1847,13 @@ SketchPoint_20.setName("SketchPoint_21") SketchPoint_20.result().setName("SketchPoint_21") ### Create SketchIntersectionPoint -SketchIntersectionPoint_14 = Sketch_7.addIntersectionPoint(model.selection("EDGE", "[Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_22][Partition_1_1_4/Modified_Face&Sketch_1/SketchArc_2_2]"), True) +SketchIntersectionPoint_14 = Sketch_7.addIntersectionPoint( + model.selection( + "EDGE", + "[Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_22][Partition_1_1_4/Modified_Face&Sketch_1/SketchArc_2_2]", + ), + True, +) SketchIntersectionPoint_14.setName("SketchIntersectionPoint_15") SketchIntersectionPoint_14.result().setName("SketchIntersectionPoint_15") [SketchPoint_21] = SketchIntersectionPoint_14.intersectionPoints() @@ -930,41 +1861,65 @@ SketchPoint_21.setName("SketchPoint_22") SketchPoint_21.result().setName("SketchPoint_22") ### Create SketchLine -SketchLine_64 = Sketch_7.addLine(5.644308024489205, -10.25641345263865, 6.15359600678713, -10.27430623369788) +SketchLine_64 = Sketch_7.addLine( + 5.644308024489205, -10.25641345263865, 6.15359600678713, -10.27430623369788 +) SketchLine_64.setName("SketchLine_67") SketchLine_64.result().setName("SketchLine_67") SketchLine_64.setAuxiliary(True) -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_20).coordinates(), SketchLine_64.startPoint()) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_20).coordinates(), SketchLine_64.startPoint() +) Sketch_7.setCoincident(SketchLine_63.endPoint(), SketchLine_64.endPoint()) ### Create SketchLine -SketchLine_65 = Sketch_7.addLine(6.15359600678713, -10.27430623369788, 6.052762716433288, -9.549982350617446) +SketchLine_65 = Sketch_7.addLine( + 6.15359600678713, -10.27430623369788, 6.052762716433288, -9.549982350617446 +) SketchLine_65.setName("SketchLine_68") SketchLine_65.result().setName("SketchLine_68") SketchLine_65.setAuxiliary(True) Sketch_7.setCoincident(SketchLine_63.endPoint(), SketchLine_65.startPoint()) -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_21).coordinates(), SketchLine_65.endPoint()) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_21).coordinates(), SketchLine_65.endPoint() +) ### Create SketchLine -SketchLine_66 = Sketch_7.addLine(5.644308024489205, -10.25641345263865, 6.052762716433288, -9.549982350617446) +SketchLine_66 = Sketch_7.addLine( + 5.644308024489205, -10.25641345263865, 6.052762716433288, -9.549982350617446 +) SketchLine_66.setName("SketchLine_69") SketchLine_66.result().setName("SketchLine_69") SketchLine_66.setAuxiliary(True) -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_20).coordinates(), SketchLine_66.startPoint()) -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_21).coordinates(), SketchLine_66.endPoint()) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_20).coordinates(), SketchLine_66.startPoint() +) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_21).coordinates(), SketchLine_66.endPoint() +) ### Create SketchLine -SketchLine_67 = Sketch_7.addLine(6.15359600678713, -10.27430623369788, 5.812047228248534, -9.966304921873915) +SketchLine_67 = Sketch_7.addLine( + 6.15359600678713, -10.27430623369788, 5.812047228248534, -9.966304921873915 +) SketchLine_67.setName("SketchLine_70") SketchLine_67.result().setName("SketchLine_70") Sketch_7.setCoincident(SketchLine_63.endPoint(), SketchLine_67.startPoint()) Sketch_7.setCoincident(SketchLine_67.endPoint(), SketchLine_66.result()) ### Create SketchConstraintAngle -Sketch_7.setAngle(SketchLine_67.result(), SketchLine_64.result(), "80.0626341144/2", type = "Direct") +Sketch_7.setAngle( + SketchLine_67.result(), SketchLine_64.result(), "80.0626341144/2", type="Direct" +) ### Create SketchIntersectionPoint -SketchIntersectionPoint_15 = Sketch_7.addIntersectionPoint(model.selection("EDGE", "[Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_1][Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_22]"), True) +SketchIntersectionPoint_15 = Sketch_7.addIntersectionPoint( + model.selection( + "EDGE", + "[Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_1][Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_22]", + ), + True, +) SketchIntersectionPoint_15.setName("SketchIntersectionPoint_16") SketchIntersectionPoint_15.result().setName("SketchIntersectionPoint_16") [SketchPoint_22] = SketchIntersectionPoint_15.intersectionPoints() @@ -972,87 +1927,171 @@ SketchPoint_22.setName("SketchPoint_23") SketchPoint_22.result().setName("SketchPoint_23") ### Create SketchLine -SketchLine_68 = Sketch_7.addLine(6.348502432487296, -9.04671367200557, 6.160385566110681, -9.046221812193464) +SketchLine_68 = Sketch_7.addLine( + 6.348502432487296, -9.04671367200557, 6.160385566110681, -9.046221812193464 +) SketchLine_68.setName("SketchLine_71") SketchLine_68.result().setName("SketchLine_71") -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_18).coordinates(), SketchLine_68.startPoint()) -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_22).coordinates(), SketchLine_68.endPoint()) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_18).coordinates(), SketchLine_68.startPoint() +) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_22).coordinates(), SketchLine_68.endPoint() +) ### Create SketchLine -SketchLine_69 = Sketch_7.addLine(6.348502432487297, -9.046713672005572, 6.603839274138267, -9.303368522147153) +SketchLine_69 = Sketch_7.addLine( + 6.348502432487297, -9.046713672005572, 6.603839274138267, -9.303368522147153 +) SketchLine_69.setName("SketchLine_83") SketchLine_69.result().setName("SketchLine_83") -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_18).coordinates(), SketchLine_69.startPoint()) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_18).coordinates(), SketchLine_69.startPoint() +) ### Create SketchLine -SketchLine_70 = Sketch_7.addLine(6.603839274138267, -9.303368522147153, 6.603839274138267, -10.27548346237037) +SketchLine_70 = Sketch_7.addLine( + 6.603839274138267, -9.303368522147153, 6.603839274138267, -10.27548346237037 +) SketchLine_70.setName("SketchLine_85") SketchLine_70.result().setName("SketchLine_85") Sketch_7.setCoincident(SketchLine_69.endPoint(), SketchLine_70.startPoint()) Sketch_7.setVertical(SketchLine_70.result()) ### Create SketchLine -SketchLine_71 = Sketch_7.addLine(6.603839274138267, -10.27548346237037, 6.153596006787128, -10.27430623369788) +SketchLine_71 = Sketch_7.addLine( + 6.603839274138267, -10.27548346237037, 6.153596006787128, -10.27430623369788 +) SketchLine_71.setName("SketchLine_86") SketchLine_71.result().setName("SketchLine_86") Sketch_7.setCoincident(SketchLine_70.endPoint(), SketchLine_71.startPoint()) Sketch_7.setCoincident(SketchLine_63.endPoint(), SketchLine_71.endPoint()) -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_16).coordinates(), SketchLine_71.result()) -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_69.result()) -Sketch_7.setDistance(SketchAPI_Point(SketchPoint_16).coordinates(), SketchLine_70.result(), 0.1, True) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_16).coordinates(), SketchLine_71.result() +) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_69.result() +) +Sketch_7.setDistance( + SketchAPI_Point(SketchPoint_16).coordinates(), SketchLine_70.result(), 0.1, True +) model.do() ### Create Filling -Filling_2 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Sketch_7/SketchLine_70"), model.selection("EDGE", "Revolution_6_1/From_Edge")]) +Filling_2 = model.addFilling( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_7/SketchLine_70"), + model.selection("EDGE", "Revolution_6_1/From_Edge"), + ], +) ### Create Face Face_2 = model.addFace(Part_1_doc, [model.selection("COMPOUND", "Sketch_7")]) ### Create Filling -Filling_3 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Sketch_7/SketchLine_71"), model.selection("EDGE", "Sketch_7/SketchLine_70")]) +Filling_3 = model.addFilling( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_7/SketchLine_71"), + model.selection("EDGE", "Sketch_7/SketchLine_70"), + ], +) ### Create Symmetry -Symmetry_4_objects = [model.selection("FACE", "Filling_1_1"), - model.selection("FACE", "Filling_2_1"), - model.selection("FACE", "Filling_3_1"), - model.selection("FACE", "Face_2_1")] -Symmetry_4 = model.addSymmetry(Part_1_doc, Symmetry_4_objects, model.selection("FACE", "PartSet/YOZ"), keepOriginal = True, keepSubResults = True) +Symmetry_4_objects = [ + model.selection("FACE", "Filling_1_1"), + model.selection("FACE", "Filling_2_1"), + model.selection("FACE", "Filling_3_1"), + model.selection("FACE", "Face_2_1"), +] +Symmetry_4 = model.addSymmetry( + Part_1_doc, + Symmetry_4_objects, + model.selection("FACE", "PartSet/YOZ"), + keepOriginal=True, + keepSubResults=True, +) ### Create Symmetry -Symmetry_5 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "all-in-Symmetry_4")], model.selection("FACE", "PartSet/XOZ"), keepOriginal = True, keepSubResults = True) +Symmetry_5 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Symmetry_4")], + model.selection("FACE", "PartSet/XOZ"), + keepOriginal=True, + keepSubResults=True, +) ### Create Revolution -Revolution_7_objects = [model.selection("EDGE", "Sketch_7/SketchLine_70"), - model.selection("EDGE", "Sketch_7/SketchLine_71"), - model.selection("EDGE", "Symmetry_5_1_1_3_1/ME:Symmetried&Filling_3_1/Edge_0_1")] -Revolution_7 = model.addRevolution(Part_1_doc, Revolution_7_objects, model.selection("EDGE", "PartSet/OZ"), 360, 0) +Revolution_7_objects = [ + model.selection("EDGE", "Sketch_7/SketchLine_70"), + model.selection("EDGE", "Sketch_7/SketchLine_71"), + model.selection("EDGE", "Symmetry_5_1_1_3_1/ME:Symmetried&Filling_3_1/Edge_0_1"), +] +Revolution_7 = model.addRevolution( + Part_1_doc, Revolution_7_objects, model.selection("EDGE", "PartSet/OZ"), 360, 0 +) ### Create Split -Split_2_objects_2 = [model.selection("COMPOUND", "all-in-Revolution_7"), - model.selection("COMPOUND", "all-in-Symmetry_5"), - model.selection("COMPOUND", "all-in-Revolution_6"), - model.selection("COMPOUND", "all-in-Symmetry_3")] -Split_2 = model.addSplit(Part_1_doc, [model.selection("COMPOUND", "all-in-Split_1")], Split_2_objects_2, keepSubResults = True) +Split_2_objects_2 = [ + model.selection("COMPOUND", "all-in-Revolution_7"), + model.selection("COMPOUND", "all-in-Symmetry_5"), + model.selection("COMPOUND", "all-in-Revolution_6"), + model.selection("COMPOUND", "all-in-Symmetry_3"), +] +Split_2 = model.addSplit( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Split_1")], + Split_2_objects_2, + keepSubResults=True, +) ### Create Revolution -Revolution_8 = model.addRevolution(Part_1_doc, [model.selection("EDGE", "Split_2_1_43/Modified_Edge&Sketch_5/SketchLine_72"), model.selection("EDGE", "Split_2_1_43/Modified_Edge&Revolution_5_1/From_Edge&Sketch_5/SketchLine_109&Filling_1_1/Edge_0_4")], model.selection("EDGE", "Sketch_2/SketchLine_34"), 360, 0) +Revolution_8 = model.addRevolution( + Part_1_doc, + [ + model.selection("EDGE", "Split_2_1_43/Modified_Edge&Sketch_5/SketchLine_72"), + model.selection( + "EDGE", + "Split_2_1_43/Modified_Edge&Revolution_5_1/From_Edge&Sketch_5/SketchLine_109&Filling_1_1/Edge_0_4", + ), + ], + model.selection("EDGE", "Sketch_2/SketchLine_34"), + 360, + 0, +) ### Create Symmetry -Symmetry_6 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "all-in-Revolution_8")], model.selection("FACE", "PartSet/YOZ"), keepOriginal = True, keepSubResults = True) +Symmetry_6 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Revolution_8")], + model.selection("FACE", "PartSet/YOZ"), + keepOriginal=True, + keepSubResults=True, +) ### Create Split -Split_3 = model.addSplit(Part_1_doc, [model.selection("COMPOUND", "all-in-Split_2")], [model.selection("COMPOUND", "all-in-Symmetry_6")], keepSubResults = True) +Split_3 = model.addSplit( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Split_2")], + [model.selection("COMPOUND", "all-in-Symmetry_6")], + keepSubResults=True, +) ### Create Sketch Sketch_8 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) ### Create SketchLine -SketchLine_72 = Sketch_8.addLine(5.126644475052088, 10.62934617154252, 5.215654385578071, 10.78090722433818) +SketchLine_72 = Sketch_8.addLine( + 5.126644475052088, 10.62934617154252, 5.215654385578071, 10.78090722433818 +) SketchLine_72.setName("SketchLine_74") SketchLine_72.result().setName("SketchLine_74") ### Create SketchLine -SketchLine_73 = Sketch_8.addLine(5.405090045827155, 10.43837553323928, 5.525091876190383, 10.61334472455802) +SketchLine_73 = Sketch_8.addLine( + 5.405090045827155, 10.43837553323928, 5.525091876190383, 10.61334472455802 +) SketchLine_73.setName("SketchLine_76") SketchLine_73.result().setName("SketchLine_76") @@ -1063,7 +2102,12 @@ SketchLine_74.result().setName("SketchLine_78") Sketch_8.setHorizontal(SketchLine_74.result()) ### Create SketchProjection -SketchProjection_16 = Sketch_8.addProjection(model.selection("EDGE", "Partition_1_1_4/Generated_Edge&PartSet/YOZ/YOZ&Sketch_1/SketchLine_25"), False) +SketchProjection_16 = Sketch_8.addProjection( + model.selection( + "EDGE", "Partition_1_1_4/Generated_Edge&PartSet/YOZ/YOZ&Sketch_1/SketchLine_25" + ), + False, +) SketchProjection_16.setName("SketchProjection_33") SketchProjection_16.result().setName("SketchProjection_33") SketchLine_75 = SketchProjection_16.createdFeature() @@ -1071,7 +2115,12 @@ SketchLine_75.setName("SketchLine_116") SketchLine_75.result().setName("SketchLine_116") ### Create SketchProjection -SketchProjection_17 = Sketch_8.addProjection(model.selection("EDGE", "Partition_1_1_4/Generated_Edge&PartSet/YOZ/YOZ&Sketch_1/SketchLine_24"), False) +SketchProjection_17 = Sketch_8.addProjection( + model.selection( + "EDGE", "Partition_1_1_4/Generated_Edge&PartSet/YOZ/YOZ&Sketch_1/SketchLine_24" + ), + False, +) SketchProjection_17.setName("SketchProjection_38") SketchProjection_17.result().setName("SketchProjection_38") SketchLine_76 = SketchProjection_17.createdFeature() @@ -1079,7 +2128,12 @@ SketchLine_76.setName("SketchLine_117") SketchLine_76.result().setName("SketchLine_117") ### Create SketchProjection -SketchProjection_18 = Sketch_8.addProjection(model.selection("EDGE", "Partition_1_1_4/Generated_Edge&PartSet/YOZ/YOZ&Sketch_1/SketchLine_23"), False) +SketchProjection_18 = Sketch_8.addProjection( + model.selection( + "EDGE", "Partition_1_1_4/Generated_Edge&PartSet/YOZ/YOZ&Sketch_1/SketchLine_23" + ), + False, +) SketchProjection_18.setName("SketchProjection_39") SketchProjection_18.result().setName("SketchProjection_39") SketchLine_77 = SketchProjection_18.createdFeature() @@ -1087,29 +2141,50 @@ SketchLine_77.setName("SketchLine_118") SketchLine_77.result().setName("SketchLine_118") ### Create SketchProjection -SketchProjection_19 = Sketch_8.addProjection(model.selection("EDGE", "Split_2_1_17/Modified_Edge&PartSet/YOZ/YOZ&Sketch_1/SketchArc_2_2"), False) +SketchProjection_19 = Sketch_8.addProjection( + model.selection( + "EDGE", "Split_2_1_17/Modified_Edge&PartSet/YOZ/YOZ&Sketch_1/SketchArc_2_2" + ), + False, +) SketchProjection_19.setName("SketchProjection_40") SketchProjection_19.result().setName("SketchProjection_40") SketchBSpline_1 = SketchProjection_19.createdFeature() ### Create SketchProjection -SketchProjection_20 = Sketch_8.addProjection(model.selection("EDGE", "Partition_1_1_4/Generated_Edge&PartSet/YOZ/YOZ&Sketch_1/SketchLine_19"), False) +SketchProjection_20 = Sketch_8.addProjection( + model.selection( + "EDGE", "Partition_1_1_4/Generated_Edge&PartSet/YOZ/YOZ&Sketch_1/SketchLine_19" + ), + False, +) SketchProjection_20.setName("SketchProjection_41") SketchProjection_20.result().setName("SketchProjection_41") SketchLine_78 = SketchProjection_20.createdFeature() SketchLine_78.setName("SketchLine_119") SketchLine_78.result().setName("SketchLine_119") Sketch_8.setCoincident(SketchLine_74.endPoint(), SketchLine_78.result()) -Sketch_8.setCoincident(SketchLine_74.startPoint(), SketchAPI_BSpline(SketchBSpline_1).startPoint()) +Sketch_8.setCoincident( + SketchLine_74.startPoint(), SketchAPI_BSpline(SketchBSpline_1).startPoint() +) ### Create SketchLine -SketchLine_79 = Sketch_8.addLine(5.676067550792231, 10.23944020672391, 5.829536340268943, 10.44848598250872) +SketchLine_79 = Sketch_8.addLine( + 5.676067550792231, 10.23944020672391, 5.829536340268943, 10.44848598250872 +) SketchLine_79.setName("SketchLine_120") SketchLine_79.result().setName("SketchLine_120") -Sketch_8.setCoincident(SketchAPI_Line(SketchLine_77).endPoint(), SketchLine_79.startPoint()) +Sketch_8.setCoincident( + SketchAPI_Line(SketchLine_77).endPoint(), SketchLine_79.startPoint() +) ### Create SketchProjection -SketchProjection_21 = Sketch_8.addProjection(model.selection("EDGE", "Partition_1_1_4/Generated_Edge&PartSet/YOZ/YOZ&Sketch_1/SketchLine_21"), False) +SketchProjection_21 = Sketch_8.addProjection( + model.selection( + "EDGE", "Partition_1_1_4/Generated_Edge&PartSet/YOZ/YOZ&Sketch_1/SketchLine_21" + ), + False, +) SketchProjection_21.setName("SketchProjection_42") SketchProjection_21.result().setName("SketchProjection_42") SketchLine_80 = SketchProjection_21.createdFeature() @@ -1119,28 +2194,55 @@ Sketch_8.setCoincident(SketchLine_79.endPoint(), SketchLine_80.result()) Sketch_8.setPerpendicular(SketchLine_79.result(), SketchLine_77.result()) Sketch_8.setPerpendicular(SketchLine_73.result(), SketchLine_76.result()) Sketch_8.setPerpendicular(SketchLine_72.result(), SketchLine_75.result()) -Sketch_8.setCoincident(SketchLine_73.startPoint(), SketchAPI_Line(SketchLine_76).endPoint()) -Sketch_8.setCoincident(SketchLine_72.startPoint(), SketchAPI_Line(SketchLine_75).endPoint()) +Sketch_8.setCoincident( + SketchLine_73.startPoint(), SketchAPI_Line(SketchLine_76).endPoint() +) +Sketch_8.setCoincident( + SketchLine_72.startPoint(), SketchAPI_Line(SketchLine_75).endPoint() +) Sketch_8.setCoincident(SketchLine_72.endPoint(), SketchLine_80.result()) Sketch_8.setCoincident(SketchLine_73.endPoint(), SketchLine_80.result()) model.do() ### Create Revolution -Revolution_9 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_8")], model.selection("EDGE", "PartSet/OZ"), 360, 0, "Edges") +Revolution_9 = model.addRevolution( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_8")], + model.selection("EDGE", "PartSet/OZ"), + 360, + 0, + "Edges", +) ### Create Split -Split_4 = model.addSplit(Part_1_doc, [model.selection("COMPOUND", "all-in-Split_3")], [model.selection("COMPOUND", "all-in-Revolution_9")], keepSubResults = True) +Split_4 = model.addSplit( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Split_3")], + [model.selection("COMPOUND", "all-in-Revolution_9")], + keepSubResults=True, +) ### Create Sketch -Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "Partition_1_1_2/Modified_Face&Sketch_1/SketchLine_4")) +Sketch_9 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Partition_1_1_2/Modified_Face&Sketch_1/SketchLine_4"), +) ### Create SketchLine -SketchLine_81 = Sketch_9.addLine(5.502704971193711, -5.502704971193713, 3.192087844797337, -3.192087844797337) +SketchLine_81 = Sketch_9.addLine( + 5.502704971193711, -5.502704971193713, 3.192087844797337, -3.192087844797337 +) SketchLine_81.setName("SketchLine_87") SketchLine_81.result().setName("SketchLine_87") ### Create SketchProjection -SketchProjection_22 = Sketch_9.addProjection(model.selection("EDGE", "[Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_5][Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_4]"), False) +SketchProjection_22 = Sketch_9.addProjection( + model.selection( + "EDGE", + "[Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_5][Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_4]", + ), + False, +) SketchProjection_22.setName("SketchProjection_26") SketchProjection_22.result().setName("SketchProjection_26") SketchArc_13 = SketchProjection_22.createdFeature() @@ -1153,7 +2255,12 @@ SketchLine_82.result().setName("SketchLine_88") Sketch_9.setCoincident(SketchLine_81.endPoint(), SketchLine_82.startPoint()) ### Create SketchProjection -SketchProjection_23 = Sketch_9.addProjection(model.selection("EDGE", "Partition_1_1_4/Generated_Edge&PartSet/XOZ/XOZ&Sketch_1/SketchLine_4"), False) +SketchProjection_23 = Sketch_9.addProjection( + model.selection( + "EDGE", "Partition_1_1_4/Generated_Edge&PartSet/XOZ/XOZ&Sketch_1/SketchLine_4" + ), + False, +) SketchProjection_23.setName("SketchProjection_27") SketchProjection_23.result().setName("SketchProjection_27") SketchLine_83 = SketchProjection_23.createdFeature() @@ -1168,7 +2275,12 @@ SketchLine_84.result().setName("SketchLine_90") Sketch_9.setCoincident(SketchLine_81.endPoint(), SketchLine_84.startPoint()) ### Create SketchProjection -SketchProjection_24 = Sketch_9.addProjection(model.selection("EDGE", "Partition_1_1_4/Generated_Edge&PartSet/YOZ/YOZ&Sketch_1/SketchLine_4"), False) +SketchProjection_24 = Sketch_9.addProjection( + model.selection( + "EDGE", "Partition_1_1_4/Generated_Edge&PartSet/YOZ/YOZ&Sketch_1/SketchLine_4" + ), + False, +) SketchProjection_24.setName("SketchProjection_28") SketchProjection_24.result().setName("SketchProjection_28") SketchLine_85 = SketchProjection_24.createdFeature() @@ -1182,9 +2294,29 @@ Sketch_9.setMiddlePoint(SketchLine_82.endPoint(), SketchLine_83.result()) Sketch_9.setMiddlePoint(SketchLine_81.startPoint(), SketchArc_13.results()[1]) ### Create SketchMultiRotation -SketchMultiRotation_1_objects = [SketchLine_81.result(), SketchLine_84.result(), SketchLine_82.result()] -SketchMultiRotation_1 = Sketch_9.addRotation(SketchMultiRotation_1_objects, SketchAPI_Line(SketchLine_83).endPoint(), 360, 4, True) -[SketchLine_86, SketchLine_87, SketchLine_88, SketchLine_89, SketchLine_90, SketchLine_91, SketchLine_92, SketchLine_93, SketchLine_94] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1_objects = [ + SketchLine_81.result(), + SketchLine_84.result(), + SketchLine_82.result(), +] +SketchMultiRotation_1 = Sketch_9.addRotation( + SketchMultiRotation_1_objects, + SketchAPI_Line(SketchLine_83).endPoint(), + 360, + 4, + True, +) +[ + SketchLine_86, + SketchLine_87, + SketchLine_88, + SketchLine_89, + SketchLine_90, + SketchLine_91, + SketchLine_92, + SketchLine_93, + SketchLine_94, +] = SketchMultiRotation_1.rotated() SketchLine_94.setName("SketchLine_100") SketchLine_94.result().setName("SketchLine_100") SketchLine_93.setName("SketchLine_99") @@ -1206,19 +2338,47 @@ SketchLine_86.result().setName("SketchLine_92") model.do() ### Create Extrusion -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_9")], model.selection(), model.selection("FACE", "Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_2"), 0, model.selection(), 0, "Edges") +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_9")], + model.selection(), + model.selection("FACE", "Partition_1_1_4/Modified_Face&Sketch_1/SketchLine_2"), + 0, + model.selection(), + 0, + "Edges", +) ### Create Plane -Plane_8 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OZ"), model.selection("VERTEX", "Split_2_1_10/Modified_Vertex&Sketch_7/SketchLine_83_StartVertex&Sketch_7/SketchLine_65_StartVertex"), False) +Plane_8 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "PartSet/OZ"), + model.selection( + "VERTEX", + "Split_2_1_10/Modified_Vertex&Sketch_7/SketchLine_83_StartVertex&Sketch_7/SketchLine_65_StartVertex", + ), + False, +) ### Create Split -Split_5 = model.addSplit(Part_1_doc, [model.selection("COMPOUND", "all-in-Split_4")], [model.selection("COMPOUND", "all-in-Extrusion_3")], keepSubResults = True) +Split_5 = model.addSplit( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Split_4")], + [model.selection("COMPOUND", "all-in-Extrusion_3")], + keepSubResults=True, +) ### Create Sketch Sketch_10 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_5")) ### Create SketchProjection -SketchProjection_25 = Sketch_10.addProjection(model.selection("VERTEX", "Split_2_1_10/Modified_Vertex&Sketch_7/SketchLine_83_StartVertex&Sketch_7/SketchLine_65_StartVertex"), False) +SketchProjection_25 = Sketch_10.addProjection( + model.selection( + "VERTEX", + "Split_2_1_10/Modified_Vertex&Sketch_7/SketchLine_83_StartVertex&Sketch_7/SketchLine_65_StartVertex", + ), + False, +) SketchProjection_25.setName("SketchProjection_35") SketchProjection_25.result().setName("SketchProjection_35") SketchPoint_23 = SketchProjection_25.createdFeature() @@ -1236,7 +2396,13 @@ SketchLine_96.setName("SketchLine_108") SketchLine_96.result().setName("SketchLine_108") ### Create SketchIntersectionPoint -SketchIntersectionPoint_16 = Sketch_10.addIntersectionPoint(model.selection("EDGE", "[Split_5_1_21/Modified_Face&Sketch_1/SketchLine_5&new_weak_name_1][(Split_5_1_21/Modified_Face&PartSet/XOZ/XOZ)(Split_5_1_21/Modified_Face&Sketch_1/SketchLine_7)(Split_5_1_21/Modified_Face&Extrusion_3_1_5/Extrusion_3_1_5)]"), True) +SketchIntersectionPoint_16 = Sketch_10.addIntersectionPoint( + model.selection( + "EDGE", + "[Split_5_1_21/Modified_Face&Sketch_1/SketchLine_5&new_weak_name_1][(Split_5_1_21/Modified_Face&PartSet/XOZ/XOZ)(Split_5_1_21/Modified_Face&Sketch_1/SketchLine_7)(Split_5_1_21/Modified_Face&Extrusion_3_1_5/Extrusion_3_1_5)]", + ), + True, +) SketchIntersectionPoint_16.setName("SketchIntersectionPoint_17") SketchIntersectionPoint_16.result().setName("SketchIntersectionPoint_17") [SketchPoint_24] = SketchIntersectionPoint_16.intersectionPoints() @@ -1244,17 +2410,29 @@ SketchPoint_24.setName("SketchPoint_25") SketchPoint_24.result().setName("SketchPoint_25") ### Create SketchIntersectionPoint -SketchIntersectionPoint_17 = Sketch_10.addIntersectionPoint(model.selection("EDGE", "Extrusion_3_1_11/To_Edge"), True) +SketchIntersectionPoint_17 = Sketch_10.addIntersectionPoint( + model.selection("EDGE", "Extrusion_3_1_11/To_Edge"), True +) SketchIntersectionPoint_17.setName("SketchIntersectionPoint_18") SketchIntersectionPoint_17.result().setName("SketchIntersectionPoint_18") [SketchPoint_25] = SketchIntersectionPoint_17.intersectionPoints() SketchPoint_25.setName("SketchPoint_26") SketchPoint_25.result().setName("SketchPoint_26") -Sketch_10.setCoincident(SketchLine_95.startPoint(), SketchAPI_Point(SketchPoint_24).coordinates()) -Sketch_10.setCoincident(SketchLine_95.endPoint(), SketchAPI_Point(SketchPoint_25).coordinates()) +Sketch_10.setCoincident( + SketchLine_95.startPoint(), SketchAPI_Point(SketchPoint_24).coordinates() +) +Sketch_10.setCoincident( + SketchLine_95.endPoint(), SketchAPI_Point(SketchPoint_25).coordinates() +) ### Create SketchIntersectionPoint -SketchIntersectionPoint_18 = Sketch_10.addIntersectionPoint(model.selection("EDGE", "[(Split_5_1_21/Modified_Face&PartSet/XOZ/XOZ)(Split_5_1_21/Modified_Face&Sketch_1/SketchLine_7)(Split_5_1_21/Modified_Face&Extrusion_3_1_5/Extrusion_3_1_5)][Split_5_1_21/Modified_Face&Sketch_1/SketchLine_7]"), True) +SketchIntersectionPoint_18 = Sketch_10.addIntersectionPoint( + model.selection( + "EDGE", + "[(Split_5_1_21/Modified_Face&PartSet/XOZ/XOZ)(Split_5_1_21/Modified_Face&Sketch_1/SketchLine_7)(Split_5_1_21/Modified_Face&Extrusion_3_1_5/Extrusion_3_1_5)][Split_5_1_21/Modified_Face&Sketch_1/SketchLine_7]", + ), + True, +) SketchIntersectionPoint_18.setName("SketchIntersectionPoint_19") SketchIntersectionPoint_18.result().setName("SketchIntersectionPoint_19") [SketchPoint_26] = SketchIntersectionPoint_18.intersectionPoints() @@ -1262,33 +2440,74 @@ SketchPoint_26.setName("SketchPoint_28") SketchPoint_26.result().setName("SketchPoint_28") ### Create SketchIntersectionPoint -SketchIntersectionPoint_19 = Sketch_10.addIntersectionPoint(model.selection("EDGE", "[Split_5_1_21/Modified_Face&Sketch_1/SketchLine_1][(Split_5_1_21/Modified_Face&PartSet/XOZ/XOZ)(Split_5_1_21/Modified_Face&Sketch_1/SketchLine_1)(Split_5_1_21/Modified_Face&Extrusion_3_1_11/Extrusion_3_1_11)(Split_5_1_21/Modified_Face&Extrusion_3_1_5/Extrusion_3_1_5)]"), True) +SketchIntersectionPoint_19 = Sketch_10.addIntersectionPoint( + model.selection( + "EDGE", + "[Split_5_1_21/Modified_Face&Sketch_1/SketchLine_1][(Split_5_1_21/Modified_Face&PartSet/XOZ/XOZ)(Split_5_1_21/Modified_Face&Sketch_1/SketchLine_1)(Split_5_1_21/Modified_Face&Extrusion_3_1_11/Extrusion_3_1_11)(Split_5_1_21/Modified_Face&Extrusion_3_1_5/Extrusion_3_1_5)]", + ), + True, +) SketchIntersectionPoint_19.setName("SketchIntersectionPoint_20") SketchIntersectionPoint_19.result().setName("SketchIntersectionPoint_20") [SketchPoint_27] = SketchIntersectionPoint_19.intersectionPoints() SketchPoint_27.setName("SketchPoint_29") SketchPoint_27.result().setName("SketchPoint_29") -Sketch_10.setCoincident(SketchAPI_Point(SketchPoint_26).coordinates(), SketchLine_96.endPoint()) -Sketch_10.setCoincident(SketchAPI_Point(SketchPoint_27).coordinates(), SketchLine_96.startPoint()) +Sketch_10.setCoincident( + SketchAPI_Point(SketchPoint_26).coordinates(), SketchLine_96.endPoint() +) +Sketch_10.setCoincident( + SketchAPI_Point(SketchPoint_27).coordinates(), SketchLine_96.startPoint() +) model.do() Sketch_10.result().setName("Sketch_10_Copy") ### Create Filling -Filling_4 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Sketch_10_Copy/SketchLine_108"), model.selection("EDGE", "Split_2_1_9/Modified_Edge&Filling_3_1/Edge_0_2")]) +Filling_4 = model.addFilling( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_10_Copy/SketchLine_108"), + model.selection("EDGE", "Split_2_1_9/Modified_Edge&Filling_3_1/Edge_0_2"), + ], +) ### Create Extrusion -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Sketch_10_Copy/SketchLine_107")], model.selection("EDGE", "PartSet/OZ"), model.selection("FACE", "(Split_5_1_21/Modified_Face&PartSet/XOZ/XOZ)(Split_5_1_21/Modified_Face&Extrusion_3_1_11/Extrusion_3_1_11)(Split_5_1_21/Modified_Face&Extrusion_3_1_5/Extrusion_3_1_5)(Split_5_1_21/Modified_Face&Sketch_1/SketchLine_7)2(Partition_1_1_1/Modified_Face&Sketch_1/SketchLine_8)2(Split_2_1_8/Modified_Face&Sketch_1/SketchLine_9)2(Split_5_1_21/Modified_Face&Sketch_1/SketchLine_1)2(Split_5_1_21/Modified_Face&PartSet/YOZ/YOZ)2(Split_5_1_21/Modified_Face&Extrusion_3_1_8/Extrusion_3_1_8)2"), 0, model.selection(), 0) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [model.selection("EDGE", "Sketch_10_Copy/SketchLine_107")], + model.selection("EDGE", "PartSet/OZ"), + model.selection( + "FACE", + "(Split_5_1_21/Modified_Face&PartSet/XOZ/XOZ)(Split_5_1_21/Modified_Face&Extrusion_3_1_11/Extrusion_3_1_11)(Split_5_1_21/Modified_Face&Extrusion_3_1_5/Extrusion_3_1_5)(Split_5_1_21/Modified_Face&Sketch_1/SketchLine_7)2(Partition_1_1_1/Modified_Face&Sketch_1/SketchLine_8)2(Split_2_1_8/Modified_Face&Sketch_1/SketchLine_9)2(Split_5_1_21/Modified_Face&Sketch_1/SketchLine_1)2(Split_5_1_21/Modified_Face&PartSet/YOZ/YOZ)2(Split_5_1_21/Modified_Face&Extrusion_3_1_8/Extrusion_3_1_8)2", + ), + 0, + model.selection(), + 0, +) ### Create Sketch -Sketch_11 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_9/Face-SketchLine_88f-SketchLine_95r-SketchLine_98f-SketchLine_96r-SketchLine_99f-SketchLine_97r-SketchLine_100f-SketchLine_90r")) - -### Create SketchLine -SketchLine_97 = Sketch_11.addLine(-3.693983753048041, 0.8998171836933224, 0, 1.098155695798001) +Sketch_11 = model.addSketch( + Part_1_doc, + model.selection( + "FACE", + "Sketch_9/Face-SketchLine_88f-SketchLine_95r-SketchLine_98f-SketchLine_96r-SketchLine_99f-SketchLine_97r-SketchLine_100f-SketchLine_90r", + ), +) + +### Create SketchLine +SketchLine_97 = Sketch_11.addLine( + -3.693983753048041, 0.8998171836933224, 0, 1.098155695798001 +) SketchLine_97.setName("SketchLine_111") SketchLine_97.result().setName("SketchLine_111") ### Create SketchProjection -SketchProjection_26 = Sketch_11.addProjection(model.selection("VERTEX", "[Extrusion_4_1/To_Edge]e[Extrusion_4_1/Generated_Edge&Sketch_10_Copy/SketchLine_107_EndVertex]e"), False) +SketchProjection_26 = Sketch_11.addProjection( + model.selection( + "VERTEX", + "[Extrusion_4_1/To_Edge]e[Extrusion_4_1/Generated_Edge&Sketch_10_Copy/SketchLine_107_EndVertex]e", + ), + False, +) SketchProjection_26.setName("SketchProjection_34") SketchProjection_26.result().setName("SketchProjection_34") SketchPoint_28 = SketchProjection_26.createdFeature() @@ -1297,30 +2516,68 @@ SketchPoint_28.result().setName("SketchPoint_30") Sketch_11.setCoincident(SketchLine_97.startPoint(), SketchPoint_28.result()) ### Create SketchProjection -SketchProjection_27 = Sketch_11.addProjection(model.selection("EDGE", "Split_5_1_20/Modified_Edge&PartSet/YOZ/YOZ&Sketch_1/SketchLine_4"), False) +SketchProjection_27 = Sketch_11.addProjection( + model.selection( + "EDGE", "Split_5_1_20/Modified_Edge&PartSet/YOZ/YOZ&Sketch_1/SketchLine_4" + ), + False, +) SketchProjection_27.setName("SketchProjection_29") SketchProjection_27.result().setName("SketchProjection_29") SketchLine_98 = SketchProjection_27.createdFeature() SketchLine_98.setName("SketchLine_101") SketchLine_98.result().setName("SketchLine_101") Sketch_11.setCoincident(SketchLine_97.endPoint(), SketchLine_98.result()) -Sketch_11.setDistance(SketchAPI_Line(SketchLine_98).startPoint(), SketchLine_97.result(), "0.921*3.891/3.268", True) +Sketch_11.setDistance( + SketchAPI_Line(SketchLine_98).startPoint(), + SketchLine_97.result(), + "0.921*3.891/3.268", + True, +) model.do() ### Create Extrusion -Extrusion_5 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_11")], model.selection("EDGE", "PartSet/OZ"), model.selection("FACE", "Split_5_1_20/Modified_Face&Sketch_1/SketchLine_2"), 0, model.selection(), 0, "Edges") +Extrusion_5 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_11")], + model.selection("EDGE", "PartSet/OZ"), + model.selection("FACE", "Split_5_1_20/Modified_Face&Sketch_1/SketchLine_2"), + 0, + model.selection(), + 0, + "Edges", +) ### Create Symmetry -Symmetry_7_objects = [model.selection("FACE", "Extrusion_5_1"), - model.selection("FACE", "Extrusion_4_1"), - model.selection("FACE", "Filling_4_1")] -Symmetry_7 = model.addSymmetry(Part_1_doc, Symmetry_7_objects, model.selection("FACE", "PartSet/YOZ"), keepOriginal = True, keepSubResults = True) +Symmetry_7_objects = [ + model.selection("FACE", "Extrusion_5_1"), + model.selection("FACE", "Extrusion_4_1"), + model.selection("FACE", "Filling_4_1"), +] +Symmetry_7 = model.addSymmetry( + Part_1_doc, + Symmetry_7_objects, + model.selection("FACE", "PartSet/YOZ"), + keepOriginal=True, + keepSubResults=True, +) ### Create Symmetry -Symmetry_8 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "all-in-Symmetry_7")], model.selection("FACE", "PartSet/XOZ"), keepOriginal = True, keepSubResults = True) +Symmetry_8 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Symmetry_7")], + model.selection("FACE", "PartSet/XOZ"), + keepOriginal=True, + keepSubResults=True, +) ### Create Split -Split_6 = model.addSplit(Part_1_doc, [model.selection("COMPOUND", "all-in-Split_5")], [model.selection("COMPOUND", "all-in-Symmetry_8")], keepSubResults = True) +Split_6 = model.addSplit( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Split_5")], + [model.selection("COMPOUND", "all-in-Symmetry_8")], + keepSubResults=True, +) model.end() @@ -1335,5 +2592,5 @@ model.testNbSubShapes(Split_6, GeomAPI_Shape.VERTEX, [7272]) model.testResultsVolumes(Split_6, [612.72746616262998]) # After fixing bos #30178 with OCCT 33006: loading GEOMETRICAL dump gives different result (differ names of the same entities) -#assert(model.checkPythonDump()) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +# assert(model.checkPythonDump()) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/Test20245_3_geometrical.py b/src/FeaturesPlugin/Test/Test20245_3_geometrical.py index 621480dc0..7b1b77086 100644 --- a/src/FeaturesPlugin/Test/Test20245_3_geometrical.py +++ b/src/FeaturesPlugin/Test/Test20245_3_geometrical.py @@ -82,15 +82,21 @@ Sketch_1.setHorizontal(SketchLine_4.result()) Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchLine_2.result()) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_11 = SketchProjection_1.createdFeature() Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_11.result()) Sketch_1.setLength(SketchLine_5.result(), 3) -Sketch_1.setDistance(SketchAPI_Line(SketchLine_11).startPoint(), SketchLine_1.result(), 6.188, True) +Sketch_1.setDistance( + SketchAPI_Line(SketchLine_11).startPoint(), SketchLine_1.result(), 6.188, True +) Sketch_1.setVertical(SketchLine_7.result()) ### Create SketchProjection -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_12 = SketchProjection_2.createdFeature() Sketch_1.setDistance(SketchLine_9.endPoint(), SketchLine_12.result(), 9.028, True) Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_9.result(), 0.188, True) @@ -103,13 +109,19 @@ Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_12.result(), 2.25, True SketchLine_13 = Sketch_1.addLine(7.031999999999999, -4.05, 5.531999999999999, -4.05) ### Create SketchLine -SketchLine_14 = Sketch_1.addLine(5.531999999999999, -4.05, 5.531999999999999, -5.850000000000001) +SketchLine_14 = Sketch_1.addLine( + 5.531999999999999, -4.05, 5.531999999999999, -5.850000000000001 +) ### Create SketchLine -SketchLine_15 = Sketch_1.addLine(5.531999999999999, -5.850000000000001, 7.031999999999999, -5.850000000000001) +SketchLine_15 = Sketch_1.addLine( + 5.531999999999999, -5.850000000000001, 7.031999999999999, -5.850000000000001 +) ### Create SketchLine -SketchLine_16 = Sketch_1.addLine(7.031999999999999, -5.850000000000001, 7.031999999999999, -4.05) +SketchLine_16 = Sketch_1.addLine( + 7.031999999999999, -5.850000000000001, 7.031999999999999, -4.05 +) Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_13.startPoint()) Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) @@ -122,7 +134,9 @@ Sketch_1.setLength(SketchLine_14.result(), 1.8) Sketch_1.setLength(SketchLine_15.result(), 1.5) ### Create SketchLine -SketchLine_17 = Sketch_1.addLine(6.281999999999999, -4.050000000000001, 6.281999999999999, 9.028000000000002) +SketchLine_17 = Sketch_1.addLine( + 6.281999999999999, -4.050000000000001, 6.281999999999999, 9.028000000000002 +) SketchLine_17.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_17.startPoint(), SketchLine_13.result()) Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_10.result()) @@ -133,11 +147,15 @@ Sketch_1.setMiddlePoint(SketchLine_10.result(), SketchLine_17.endPoint()) Sketch_1.setDistance(SketchLine_14.startPoint(), SketchLine_2.result(), 0.6, True) ### Create SketchLine -SketchLine_18 = Sketch_1.addLine(6.375999999999999, 9.028, 6.534999999999997, 9.186999999999999) +SketchLine_18 = Sketch_1.addLine( + 6.375999999999999, 9.028, 6.534999999999997, 9.186999999999999 +) Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_18.startPoint()) ### Create SketchLine -SketchLine_19 = Sketch_1.addLine(6.534999999999997, 9.186999999999999, 6.534999999999997, 10.256) +SketchLine_19 = Sketch_1.addLine( + 6.534999999999997, 9.186999999999999, 6.534999999999997, 10.256 +) Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) ### Create SketchLine @@ -145,18 +163,24 @@ SketchLine_20 = Sketch_1.addLine(6.534999999999997, 10.256, 6.184999999999998, 1 Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) ### Create SketchLine -SketchLine_21 = Sketch_1.addLine(6.184999999999998, 10.256, 4.917500000000027, 10.94235984621998) +SketchLine_21 = Sketch_1.addLine( + 6.184999999999998, 10.256, 4.917500000000027, 10.94235984621998 +) Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) Sketch_1.setHorizontal(SketchLine_20.result()) Sketch_1.setVertical(SketchLine_19.result()) ### Create SketchConstraintAngle -Sketch_1.setAngle(SketchLine_10.result(), SketchLine_18.result(), 45, type = "Supplementary") +Sketch_1.setAngle( + SketchLine_10.result(), SketchLine_18.result(), 45, type="Supplementary" +) Sketch_1.setLength(SketchLine_20.result(), 0.35) Sketch_1.setDistance(SketchLine_19.endPoint(), SketchLine_12.result(), 10.256, True) ### Create SketchArc -SketchArc_1 = Sketch_1.addArc(0, 2.425, 4.917500000000027, 10.94235984621998, 0, 12.26, False) +SketchArc_1 = Sketch_1.addArc( + 0, 2.425, 4.917500000000027, 10.94235984621998, 0, 12.26, False +) Sketch_1.setCoincident(SketchLine_11.result(), SketchArc_1.center()) Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchArc_1.startPoint()) Sketch_1.setCoincident(SketchLine_11.result(), SketchArc_1.endPoint()) @@ -166,25 +190,35 @@ SketchLine_22 = Sketch_1.addLine(6.188000000000001, 9.028, 6.082, 9.532) Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_22.startPoint()) ### Create SketchArc -SketchArc_2 = Sketch_1.addArc(4.79378612024245, 9.263, 6.082, 9.532, 5.676067550792229, 10.23944020672391, False) +SketchArc_2 = Sketch_1.addArc( + 4.79378612024245, 9.263, 6.082, 9.532, 5.676067550792229, 10.23944020672391, False +) Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchArc_2.startPoint()) Sketch_1.setRadius(SketchArc_2.results()[1], 1.316) Sketch_1.setDistance(SketchArc_2.startPoint(), SketchLine_1.result(), 0.106, True) ### Create SketchLine -SketchLine_23 = Sketch_1.addLine(5.676067550792229, 10.23944020672391, 5.405090045827156, 10.43837553323928) +SketchLine_23 = Sketch_1.addLine( + 5.676067550792229, 10.23944020672391, 5.405090045827156, 10.43837553323928 +) Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_23.startPoint()) ### Create SketchLine -SketchLine_24 = Sketch_1.addLine(5.405090045827156, 10.43837553323928, 5.126644475052085, 10.62934617154252) +SketchLine_24 = Sketch_1.addLine( + 5.405090045827156, 10.43837553323928, 5.126644475052085, 10.62934617154252 +) Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) ### Create SketchLine -SketchLine_25 = Sketch_1.addLine(5.126644475052085, 10.62934617154252, 4.83550000000003, 10.80033167999934) +SketchLine_25 = Sketch_1.addLine( + 5.126644475052085, 10.62934617154252, 4.83550000000003, 10.80033167999934 +) Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint()) ### Create SketchArc -SketchArc_3 = Sketch_1.addArc(0, 2.425, 4.83550000000003, 10.80033167999934, 0, 12.096, False) +SketchArc_3 = Sketch_1.addArc( + 0, 2.425, 4.83550000000003, 10.80033167999934, 0, 12.096, False +) Sketch_1.setCoincident(SketchLine_11.result(), SketchArc_3.center()) Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchArc_3.startPoint()) Sketch_1.setCoincident(SketchLine_11.result(), SketchArc_3.endPoint()) @@ -221,57 +255,77 @@ Sketch_1.setDistance(SketchLine_25.startPoint(), SketchLine_28.endPoint(), 0.176 Sketch_1.setDistance(SketchLine_24.startPoint(), SketchLine_29.endPoint(), 0.212, True) ### Create SketchConstraintAngle -Sketch_1.setAngle(SketchLine_28.result(), SketchLine_11.result(), 32, type = "Direct") +Sketch_1.setAngle(SketchLine_28.result(), SketchLine_11.result(), 32, type="Direct") ### Create SketchConstraintAngle -Sketch_1.setAngle(SketchLine_29.result(), SketchLine_11.result(), 34, type = "Direct") +Sketch_1.setAngle(SketchLine_29.result(), SketchLine_11.result(), 34, type="Direct") ### Create SketchConstraintAngle -Sketch_1.setAngle(SketchLine_27.result(), SketchLine_11.result(), 30, type = "Direct") +Sketch_1.setAngle(SketchLine_27.result(), SketchLine_11.result(), 30, type="Direct") ### Create SketchLine -SketchLine_30 = Sketch_1.addLine(4.79378612024245, 9.263, 5.676067550792229, 10.23944020672391) +SketchLine_30 = Sketch_1.addLine( + 4.79378612024245, 9.263, 5.676067550792229, 10.23944020672391 +) SketchLine_30.setAuxiliary(True) Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_30.startPoint()) Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_30.endPoint()) ### Create SketchLine -SketchLine_31 = Sketch_1.addLine(4.79378612024245, 9.263, 4.79378612024245, 10.72808112087839) +SketchLine_31 = Sketch_1.addLine( + 4.79378612024245, 9.263, 4.79378612024245, 10.72808112087839 +) SketchLine_31.setAuxiliary(True) Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_31.startPoint()) Sketch_1.setVertical(SketchLine_31.result()) ### Create SketchConstraintAngle -Sketch_1.setAngle(SketchLine_30.result(), SketchLine_31.result(), 42.1, type = "Direct") +Sketch_1.setAngle(SketchLine_30.result(), SketchLine_31.result(), 42.1, type="Direct") Sketch_1.setDistance(SketchArc_2.center(), SketchLine_12.result(), 9.263, True) Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchLine_27.result()) Sketch_1.setDistance(SketchLine_22.endPoint(), SketchLine_12.result(), 9.532, True) -Sketch_1.setDistance(SketchLine_18.endPoint(), SketchLine_12.result(), 9.186999999999999, True) +Sketch_1.setDistance( + SketchLine_18.endPoint(), SketchLine_12.result(), 9.186999999999999, True +) Sketch_1.setRadius(SketchArc_1.results()[1], 9.835000000000001) model.do() ### Create Revolution -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", (3.891, 0, 2.905000000000017))], model.selection("EDGE", "PartSet/OZ"), 360, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("FACE", (3.891, 0, 2.905000000000017))], + model.selection("EDGE", "PartSet/OZ"), + 360, + 0, +) ### Create Sketch Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) ### Create SketchProjection -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX_7", (0, 0, 2.425)), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("VERTEX_7", (0, 0, 2.425)), False +) SketchPoint_1 = SketchProjection_3.createdFeature() ### Create SketchProjection -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", (0, 0, 12.178)), False) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("EDGE", (0, 0, 12.178)), False +) SketchLine_32 = SketchProjection_4.createdFeature() ### Create SketchArc -SketchArc_4 = Sketch_2.addArc(0, 2.425, 0, 12.178, 5.453808387550563, 10.51060344512907, True) +SketchArc_4 = Sketch_2.addArc( + 0, 2.425, 0, 12.178, 5.453808387550563, 10.51060344512907, True +) SketchArc_4.setAuxiliary(True) Sketch_2.setCoincident(SketchPoint_1.result(), SketchArc_4.center()) Sketch_2.setCoincident(SketchLine_32.result(), SketchArc_4.startPoint()) ### Create SketchProjection -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", (2.761819470681477, 0, 6.519565749310471)), False) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("EDGE", (2.761819470681477, 0, 6.519565749310471)), False +) SketchLine_33 = SketchProjection_5.createdFeature() Sketch_2.setCoincident(SketchArc_4.endPoint(), SketchLine_33.result()) Sketch_2.setMiddlePoint(SketchArc_4.startPoint(), SketchLine_32.result()) @@ -279,10 +333,14 @@ Sketch_2.setMiddlePoint(SketchArc_4.startPoint(), SketchLine_32.result()) ### Create SketchLine SketchLine_34 = Sketch_2.addLine(0, 2.425, 3.282538500974084, 11.74164236673399) SketchLine_34.setAuxiliary(True) -Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_34.startPoint()) +Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_34.startPoint() +) ### Create SketchLine -SketchLine_35 = Sketch_2.addLine(3.282538500974084, 11.74164236673399, 3.199461499025965, 11.50584963625379) +SketchLine_35 = Sketch_2.addLine( + 3.282538500974084, 11.74164236673399, 3.199461499025965, 11.50584963625379 +) Sketch_2.setCoincident(SketchLine_34.endPoint(), SketchLine_35.startPoint()) Sketch_2.setCoincident(SketchLine_35.endPoint(), SketchLine_34.result()) Sketch_2.setLength(SketchLine_35.result(), 0.25) @@ -293,61 +351,97 @@ Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchArc_4.results()[1]) Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_35.result()) ### Create SketchProjection -SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_6 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_36 = SketchProjection_6.createdFeature() Sketch_2.setDistance(SketchPoint_2.coordinates(), SketchLine_36.result(), 3.241, True) ### Create SketchArc -SketchArc_5 = Sketch_2.addArc(0, 2.425, 3.282538500974084, 11.74164236673399, 4.1398177019328, 11.393656164374, True) -Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_5.center()) +SketchArc_5 = Sketch_2.addArc( + 0, + 2.425, + 3.282538500974084, + 11.74164236673399, + 4.1398177019328, + 11.393656164374, + True, +) +Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_5.center() +) Sketch_2.setCoincident(SketchLine_34.endPoint(), SketchArc_5.startPoint()) ### Create SketchArc -SketchArc_6 = Sketch_2.addArc(0, 2.425, 3.199461499025965, 11.50584963625379, 4.035044020470642, 11.16667053559353, True) +SketchArc_6 = Sketch_2.addArc( + 0, + 2.425, + 3.199461499025965, + 11.50584963625379, + 4.035044020470642, + 11.16667053559353, + True, +) Sketch_2.setCoincident(SketchAPI_Line(SketchLine_33).startPoint(), SketchArc_6.center()) Sketch_2.setCoincident(SketchLine_35.endPoint(), SketchArc_6.startPoint()) ### Create SketchLine SketchLine_37 = Sketch_2.addLine(0, 2.425, 3.911506014428326, 11.49555702253677) SketchLine_37.setAuxiliary(True) -Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_37.startPoint()) +Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_37.startPoint() +) Sketch_2.setCoincident(SketchLine_37.endPoint(), SketchArc_5.results()[1]) ### Create SketchLine SketchLine_38 = Sketch_2.addLine(0, 2.425, 4.1398177019328, 11.393656164374) SketchLine_38.setAuxiliary(True) -Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_38.startPoint()) +Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_38.startPoint() +) Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_38.endPoint()) Sketch_2.setCoincident(SketchArc_6.endPoint(), SketchLine_38.result()) Sketch_2.setDistance(SketchLine_35.startPoint(), SketchLine_37.result(), 0.675, True) Sketch_2.setMiddlePoint(SketchPoint_2.coordinates(), SketchLine_35.result()) ### Create SketchLine -SketchLine_39 = Sketch_2.addLine(3.911506014428326, 11.49555702253677, 3.81251062025875, 11.26599240868435) +SketchLine_39 = Sketch_2.addLine( + 3.911506014428326, 11.49555702253677, 3.81251062025875, 11.26599240868435 +) Sketch_2.setCoincident(SketchLine_37.endPoint(), SketchLine_39.startPoint()) Sketch_2.setCoincident(SketchLine_39.endPoint(), SketchArc_6.results()[1]) Sketch_2.setCoincident(SketchLine_39.endPoint(), SketchLine_37.result()) ### Create SketchLine -SketchLine_40 = Sketch_2.addLine(4.1398177019328, 11.393656164374, 4.459277785066647, 11.19096067956113) +SketchLine_40 = Sketch_2.addLine( + 4.1398177019328, 11.393656164374, 4.459277785066647, 11.19096067956113 +) Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_40.startPoint()) ### Create SketchProjection -SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE_3", (2.545485308583308, 0, 11.92488050155302)), False) +SketchProjection_7 = Sketch_2.addProjection( + model.selection("EDGE_3", (2.545485308583308, 0, 11.92488050155302)), False +) SketchArc_7 = SketchProjection_7.createdFeature() Sketch_2.setCoincident(SketchLine_40.endPoint(), SketchArc_7.results()[1]) ### Create SketchLine -SketchLine_41 = Sketch_2.addLine(4.459277785066647, 11.19096067956113, 4.390495384356095, 11.04194790978503) +SketchLine_41 = Sketch_2.addLine( + 4.459277785066647, 11.19096067956113, 4.390495384356095, 11.04194790978503 +) Sketch_2.setCoincident(SketchLine_40.endPoint(), SketchLine_41.startPoint()) ### Create SketchProjection -SketchProjection_8 = Sketch_2.addProjection(model.selection("EDGE_3", (2.503038985186497, 0, 11.76646866604162)), False) +SketchProjection_8 = Sketch_2.addProjection( + model.selection("EDGE_3", (2.503038985186497, 0, 11.76646866604162)), False +) SketchArc_8 = SketchProjection_8.createdFeature() Sketch_2.setCoincident(SketchLine_41.endPoint(), SketchArc_8.results()[1]) ### Create SketchLine -SketchLine_42 = Sketch_2.addLine(4.390495384356095, 11.04194790978503, 4.035044020470642, 11.16667053559353) +SketchLine_42 = Sketch_2.addLine( + 4.390495384356095, 11.04194790978503, 4.035044020470642, 11.16667053559353 +) Sketch_2.setCoincident(SketchLine_41.endPoint(), SketchLine_42.startPoint()) Sketch_2.setCoincident(SketchLine_42.endPoint(), SketchLine_38.result()) Sketch_2.setCoincident(SketchLine_42.endPoint(), SketchArc_6.endPoint()) @@ -357,19 +451,60 @@ Sketch_2.setParallel(SketchLine_41.result(), SketchLine_38.result()) model.do() ### Create Revolution -Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("WIRE", (3.862008317343538, 0, 11.38077471561056))], model.selection("EDGE", (3.241000000000025, 0, 11.62374600149389)), 360, 0) +Revolution_2 = model.addRevolution( + Part_1_doc, + [model.selection("WIRE", (3.862008317343538, 0, 11.38077471561056))], + model.selection("EDGE", (3.241000000000025, 0, 11.62374600149389)), + 360, + 0, +) ### Create Revolution -Revolution_3 = model.addRevolution(Part_1_doc, [model.selection("WIRE", (4.212769702413368, 0, 11.10430922268928))], model.selection("EDGE", (3.241000000000025, 0, 11.62374600149389)), 360, 0) +Revolution_3 = model.addRevolution( + Part_1_doc, + [model.selection("WIRE", (4.212769702413368, 0, 11.10430922268928))], + model.selection("EDGE", (3.241000000000025, 0, 11.62374600149389)), + 360, + 0, +) ### Create Symmetry -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", (3.237566604725065, 1.012489110826635e-16, 11.61400119092393)), model.selection("SOLID", (3.223802337712571, 1.605864674679632e-16, 11.57493485456337))], model.selection("FACE", "PartSet/YOZ"), keepOriginal = True) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [ + model.selection( + "SOLID", (3.237566604725065, 1.012489110826635e-16, 11.61400119092393) + ), + model.selection( + "SOLID", (3.223802337712571, 1.605864674679632e-16, 11.57493485456337) + ), + ], + model.selection("FACE", "PartSet/YOZ"), + keepOriginal=True, +) ### Create Cut -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", (-0.02393444277354129, -2.619925842544883e-15, -2.580701826672511))], [model.selection("COMPOUND", (0, 0, 11.60508262087049))]) +Cut_1 = model.addCut( + Part_1_doc, + [ + model.selection( + "SOLID", (-0.02393444277354129, -2.619925842544883e-15, -2.580701826672511) + ) + ], + [model.selection("COMPOUND", (0, 0, 11.60508262087049))], +) ### Create Fuse -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", (-0.02010673966564346, 1.098068506034238e-08, -2.591493279117804)), model.selection("COMPOUND", (0, 0, 11.54608275997197))], removeEdges = True) +Fuse_1 = model.addFuse( + Part_1_doc, + [ + model.selection( + "SOLID", (-0.02010673966564346, 1.098068506034238e-08, -2.591493279117804) + ), + model.selection("COMPOUND", (0, 0, 11.54608275997197)), + ], + removeEdges=True, +) ### Create Plane Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 3.6, False) @@ -378,11 +513,15 @@ Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 3.6 Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", (0, 0, 3.6))) ### Create SketchProjection -SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", (-6.188000000000001, 7.578114393123822e-16, -3.45)), True) +SketchProjection_9 = Sketch_3.addProjection( + model.selection("EDGE", (-6.188000000000001, 7.578114393123822e-16, -3.45)), True +) SketchCircle_1 = SketchProjection_9.createdFeature() ### Create SketchProjection -SketchProjection_10 = Sketch_3.addProjection(model.selection("EDGE", (-6.376, 7.808347991363525e-16, -2.25)), True) +SketchProjection_10 = Sketch_3.addProjection( + model.selection("EDGE", (-6.376, 7.808347991363525e-16, -2.25)), True +) SketchCircle_2 = SketchProjection_10.createdFeature() ### Create SketchArc @@ -390,7 +529,9 @@ SketchArc_9 = Sketch_3.addArc(0, 0, 6.094, 0, 5.859569950090201, -1.674, True) Sketch_3.setCoincident(SketchAPI_Circle(SketchCircle_1).center(), SketchArc_9.center()) ### Create SketchProjection -SketchProjection_11 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_11 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_43 = SketchProjection_11.createdFeature() Sketch_3.setCoincident(SketchArc_9.startPoint(), SketchLine_43.result()) @@ -402,17 +543,23 @@ Sketch_3.setDistance(SketchArc_9.startPoint(), SketchPoint_3.coordinates(), 0.09 Sketch_3.setDistance(SketchArc_9.endPoint(), SketchLine_43.result(), 1.674, True) ### Create SketchLine -SketchLine_44 = Sketch_3.addLine(5.859569950090201, -1.674, 5.870724657144867, -1.956000000000001) +SketchLine_44 = Sketch_3.addLine( + 5.859569950090201, -1.674, 5.870724657144867, -1.956000000000001 +) Sketch_3.setCoincident(SketchArc_9.endPoint(), SketchLine_44.startPoint()) Sketch_3.setCoincident(SketchLine_44.endPoint(), SketchCircle_1.results()[1]) ### Create SketchArc -SketchArc_10 = Sketch_3.addArc(0, 0, 6.470000000000001, 0, 6.167249305809295, -1.955999999999993, True) +SketchArc_10 = Sketch_3.addArc( + 0, 0, 6.470000000000001, 0, 6.167249305809295, -1.955999999999993, True +) Sketch_3.setCoincident(SketchAPI_Circle(SketchCircle_1).center(), SketchArc_10.center()) Sketch_3.setCoincident(SketchLine_43.result(), SketchArc_10.startPoint()) ### Create SketchLine -SketchLine_45 = Sketch_3.addLine(6.167249305809295, -1.955999999999993, 6.068561608816571, -1.956000000000005) +SketchLine_45 = Sketch_3.addLine( + 6.167249305809295, -1.955999999999993, 6.068561608816571, -1.956000000000005 +) Sketch_3.setCoincident(SketchArc_10.endPoint(), SketchLine_45.startPoint()) Sketch_3.setCoincident(SketchLine_45.endPoint(), SketchCircle_2.results()[1]) Sketch_3.setHorizontal(SketchLine_45.result()) @@ -423,16 +570,39 @@ Sketch_3.setDistance(SketchArc_10.startPoint(), SketchLine_45.result(), 1.956, T SketchPoint_4 = Sketch_3.addPoint(6.376, 0) Sketch_3.setCoincident(SketchPoint_4.coordinates(), SketchCircle_2.results()[1]) Sketch_3.setCoincident(SketchPoint_4.coordinates(), SketchLine_43.result()) -Sketch_3.setDistance(SketchPoint_4.coordinates(), SketchArc_10.startPoint(), 0.094, True) +Sketch_3.setDistance( + SketchPoint_4.coordinates(), SketchArc_10.startPoint(), 0.094, True +) ### Create SketchConstraintMirror -SketchConstraintMirror_1_objects = [SketchArc_9.results()[1], SketchLine_44.result(), SketchArc_10.results()[1], SketchLine_45.result()] -SketchConstraintMirror_1 = Sketch_3.addMirror(SketchLine_43.result(), SketchConstraintMirror_1_objects) -[SketchArc_11, SketchLine_46, SketchArc_12, SketchLine_47] = SketchConstraintMirror_1.mirrored() +SketchConstraintMirror_1_objects = [ + SketchArc_9.results()[1], + SketchLine_44.result(), + SketchArc_10.results()[1], + SketchLine_45.result(), +] +SketchConstraintMirror_1 = Sketch_3.addMirror( + SketchLine_43.result(), SketchConstraintMirror_1_objects +) +[ + SketchArc_11, + SketchLine_46, + SketchArc_12, + SketchLine_47, +] = SketchConstraintMirror_1.mirrored() model.do() ### Create Extrusion -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", (6.023784975045098, 0, 3.6)), model.selection("WIRE", (6.393864363926704, 0.9896456414839456, 3.6))], model.selection(), 0, 4.2) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection("FACE", (6.023784975045098, 0, 3.6)), + model.selection("WIRE", (6.393864363926704, 0.9896456414839456, 3.6)), + ], + model.selection(), + 0, + 4.2, +) ### Create Sketch Sketch_4 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) @@ -458,7 +628,9 @@ Sketch_4.setHorizontal(SketchLine_50.result()) Sketch_4.setVertical(SketchLine_51.result()) ### Create SketchProjection -SketchProjection_12 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_12 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_52 = SketchProjection_12.createdFeature() Sketch_4.setDistance(SketchLine_52.result(), SketchLine_50.endPoint(), 0.3, True) Sketch_4.setDistance(SketchLine_51.endPoint(), SketchLine_52.result(), 2.1, True) @@ -469,329 +641,545 @@ Sketch_4.setCoincident(SketchPoint_5.coordinates(), SketchLine_48.result()) Sketch_4.setMiddlePoint(SketchLine_48.result(), SketchPoint_5.coordinates()) ### Create SketchProjection -SketchProjection_13 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_13 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_53 = SketchProjection_13.createdFeature() Sketch_4.setCoincident(SketchPoint_5.coordinates(), SketchLine_53.result()) Sketch_4.setDistance(SketchPoint_5.coordinates(), SketchLine_51.endPoint(), 0.75, True) model.do() ### Create Extrusion -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", (0, 0, 1.2))], model.selection(), 10, 0) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("FACE", (0, 0, 1.2))], model.selection(), 10, 0 +) ### Create Rotation -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1")], axis = model.selection("EDGE", "PartSet/OZ"), angle = -90) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Extrusion_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=-90, +) ### Create Rotation -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", (5, 0, 1.2))], axis = model.selection("EDGE", "PartSet/OZ"), angle = -90) +Rotation_2 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", (5, 0, 1.2))], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=-90, +) ### Create Fuse -Fuse_2 = model.addFuse(Part_1_doc, [model.selection("SOLID", (-0.01517504751343968, 2.050041270815023e-08, -2.581926283264154)), model.selection("COMPOUND", (6.661338147750939e-16, -6.164784975045299, 1.5))], removeEdges = True) +Fuse_2 = model.addFuse( + Part_1_doc, + [ + model.selection( + "SOLID", (-0.01517504751343968, 2.050041270815023e-08, -2.581926283264154) + ), + model.selection("COMPOUND", (6.661338147750939e-16, -6.164784975045299, 1.5)), + ], + removeEdges=True, +) ### Create Cut -Cut_2 = model.addCut(Part_1_doc, [model.selection("SOLID", (-0.01123484393534465, -0.0370107755507461, -2.561989939908471))], [model.selection("SOLID", (6.683953801956267e-16, -5, 1.2))]) +Cut_2 = model.addCut( + Part_1_doc, + [ + model.selection( + "SOLID", (-0.01123484393534465, -0.0370107755507461, -2.561989939908471) + ) + ], + [model.selection("SOLID", (6.683953801956267e-16, -5, 1.2))], +) ### Create Group -Group_1_objects = [model.selection("VERTEX", (-4.1398177019328, 0, 11.393656164374)), - model.selection("VERTEX", (-3.911506014428326, 0, 11.49555702253677)), - model.selection("VERTEX", (-4.459277785066647, 0, 11.19096067956113)), - model.selection("VERTEX", (-3.81251062025875, 0, 11.26599240868435)), - model.selection("VERTEX", (4.917500000000027, 0, 10.94235984621998)), - model.selection("VERTEX", (4.459277785066647, 0, 11.19096067956113)), - model.selection("VERTEX", (2.020497700342232, -3.596329980388322e-14, 12.05021761015889)), - model.selection("VERTEX", (0, 0, 12.26000000000002)), - model.selection("VERTEX", (-4.035044020470642, 0, 11.16667053559353)), - model.selection("VERTEX", (6.184999999999998, 0, 10.256)), - model.selection("VERTEX", (4.1398177019328, 0, 11.393656164374)), - model.selection("VERTEX", (-4.390495384356095, 0, 11.04194790978503)), - model.selection("VERTEX", (6.534999999999997, 0, 10.256)), - model.selection("VERTEX", (3.911506014428326, 0, 11.49555702253677)), - model.selection("VERTEX", (4.83550000000003, 0, 10.80033167999934)), - model.selection("VERTEX", (4.390495384356095, 0, 11.04194790978503)), - model.selection("VERTEX", (1.980680877755172, -3.581982442331714e-14, 11.89099937991209)), - model.selection("VERTEX", (0, 0, 12.09600000000002)), - model.selection("VERTEX", (6.534999999999997, 0, 9.186999999999999)), - model.selection("VERTEX", (3.81251062025875, 0, 11.26599240868435)), - model.selection("VERTEX", (5.126644475052085, 0, 10.62934617154252)), - model.selection("VERTEX", (4.035044020470642, 0, 11.16667053559353)), - model.selection("VERTEX", (6.375999999999999, 0, 9.028)), - model.selection("VERTEX", (5.405090045827156, 0, 10.43837553323928)), - model.selection("VERTEX", (6.376, 0, -2.25)), - model.selection("VERTEX", (1.956000000000006, -6.068561608816571, -0.6000000000000001)), - model.selection("VERTEX", (-1.956000000000004, -6.068561608816571, -0.6000000000000001)), - model.selection("VERTEX", (-1.956000000000004, -6.068561608816571, 3.6)), - model.selection("VERTEX", (1.956000000000006, -6.068561608816571, 3.6)), - model.selection("VERTEX", (5.676067550792229, 0, 10.23944020672391)), - model.selection("VERTEX", (6.538000000000002, 0, -2.4)), - model.selection("VERTEX", (-1.955999999999992, -6.167249305809295, -0.6000000000000001)), - model.selection("VERTEX", (1.955999999999933, -6.167249305809104, -0.6000000000000001)), - model.selection("VERTEX", (-1.955999999999992, -6.167249305809295, 3.6)), - model.selection("VERTEX", (1.955999999999933, -6.167249305809104, 3.6)), - model.selection("VERTEX", (6.082, 0, 9.532)), - model.selection("VERTEX", (6.538000000000001, 0, -3.45)), - model.selection("VERTEX", (0.7500000000000007, -6.426383119609755, 2.1)), - model.selection("VERTEX", (0.7500000000000007, -6.426383119609755, 0.3)), - model.selection("VERTEX", (-0.7499999999999993, -6.426383119609755, 0.3)), - model.selection("VERTEX", (-0.7499999999999993, -6.426383119609755, 2.1)), - model.selection("VERTEX", (6.188000000000001, 0, 9.028)), - model.selection("VERTEX", (7.781999999999999, 0, -3.45)), - model.selection("VERTEX", (0.7500000000000007, -6.047671948775005, 2.1)), - model.selection("VERTEX", (0.7500000000000007, -6.047671948775005, 0.3)), - model.selection("VERTEX", (-0.7499999999999993, -6.047671948775005, 0.3)), - model.selection("VERTEX", (-0.7499999999999993, -6.047671948775005, 2.1)), - model.selection("VERTEX", (6.188000000000001, 0, -3.45)), - model.selection("VERTEX", (-1.956, -5.870724657144867, -0.6000000000000001)), - model.selection("VERTEX", (-1.956, -5.870724657144867, 3.6)), - model.selection("VERTEX", (1.956000000000002, -5.870724657144867, -0.6000000000000001)), - model.selection("VERTEX", (1.956000000000002, -5.870724657144867, 3.6)), - model.selection("VERTEX", (7.781999999999999, 0, -6.45)), - model.selection("VERTEX", (-1.673999999999999, -5.859569950090201, -0.6000000000000001)), - model.selection("VERTEX", (-1.673999999999999, -5.859569950090201, 3.6)), - model.selection("VERTEX", (1.674, -5.859569950090198, -0.6000000000000001)), - model.selection("VERTEX", (1.674, -5.859569950090198, 3.6)), - model.selection("VERTEX", (7.031999999999999, 0, -5.850000000000001)), - model.selection("VERTEX", (7.031999999999999, 0, -4.05)), - model.selection("VERTEX", (5.531999999999999, 0, -5.850000000000001)), - model.selection("VERTEX", (5.531999999999999, 0, -4.05))] +Group_1_objects = [ + model.selection("VERTEX", (-4.1398177019328, 0, 11.393656164374)), + model.selection("VERTEX", (-3.911506014428326, 0, 11.49555702253677)), + model.selection("VERTEX", (-4.459277785066647, 0, 11.19096067956113)), + model.selection("VERTEX", (-3.81251062025875, 0, 11.26599240868435)), + model.selection("VERTEX", (4.917500000000027, 0, 10.94235984621998)), + model.selection("VERTEX", (4.459277785066647, 0, 11.19096067956113)), + model.selection( + "VERTEX", (2.020497700342232, -3.596329980388322e-14, 12.05021761015889) + ), + model.selection("VERTEX", (0, 0, 12.26000000000002)), + model.selection("VERTEX", (-4.035044020470642, 0, 11.16667053559353)), + model.selection("VERTEX", (6.184999999999998, 0, 10.256)), + model.selection("VERTEX", (4.1398177019328, 0, 11.393656164374)), + model.selection("VERTEX", (-4.390495384356095, 0, 11.04194790978503)), + model.selection("VERTEX", (6.534999999999997, 0, 10.256)), + model.selection("VERTEX", (3.911506014428326, 0, 11.49555702253677)), + model.selection("VERTEX", (4.83550000000003, 0, 10.80033167999934)), + model.selection("VERTEX", (4.390495384356095, 0, 11.04194790978503)), + model.selection( + "VERTEX", (1.980680877755172, -3.581982442331714e-14, 11.89099937991209) + ), + model.selection("VERTEX", (0, 0, 12.09600000000002)), + model.selection("VERTEX", (6.534999999999997, 0, 9.186999999999999)), + model.selection("VERTEX", (3.81251062025875, 0, 11.26599240868435)), + model.selection("VERTEX", (5.126644475052085, 0, 10.62934617154252)), + model.selection("VERTEX", (4.035044020470642, 0, 11.16667053559353)), + model.selection("VERTEX", (6.375999999999999, 0, 9.028)), + model.selection("VERTEX", (5.405090045827156, 0, 10.43837553323928)), + model.selection("VERTEX", (6.376, 0, -2.25)), + model.selection( + "VERTEX", (1.956000000000006, -6.068561608816571, -0.6000000000000001) + ), + model.selection( + "VERTEX", (-1.956000000000004, -6.068561608816571, -0.6000000000000001) + ), + model.selection("VERTEX", (-1.956000000000004, -6.068561608816571, 3.6)), + model.selection("VERTEX", (1.956000000000006, -6.068561608816571, 3.6)), + model.selection("VERTEX", (5.676067550792229, 0, 10.23944020672391)), + model.selection("VERTEX", (6.538000000000002, 0, -2.4)), + model.selection( + "VERTEX", (-1.955999999999992, -6.167249305809295, -0.6000000000000001) + ), + model.selection( + "VERTEX", (1.955999999999933, -6.167249305809104, -0.6000000000000001) + ), + model.selection("VERTEX", (-1.955999999999992, -6.167249305809295, 3.6)), + model.selection("VERTEX", (1.955999999999933, -6.167249305809104, 3.6)), + model.selection("VERTEX", (6.082, 0, 9.532)), + model.selection("VERTEX", (6.538000000000001, 0, -3.45)), + model.selection("VERTEX", (0.7500000000000007, -6.426383119609755, 2.1)), + model.selection("VERTEX", (0.7500000000000007, -6.426383119609755, 0.3)), + model.selection("VERTEX", (-0.7499999999999993, -6.426383119609755, 0.3)), + model.selection("VERTEX", (-0.7499999999999993, -6.426383119609755, 2.1)), + model.selection("VERTEX", (6.188000000000001, 0, 9.028)), + model.selection("VERTEX", (7.781999999999999, 0, -3.45)), + model.selection("VERTEX", (0.7500000000000007, -6.047671948775005, 2.1)), + model.selection("VERTEX", (0.7500000000000007, -6.047671948775005, 0.3)), + model.selection("VERTEX", (-0.7499999999999993, -6.047671948775005, 0.3)), + model.selection("VERTEX", (-0.7499999999999993, -6.047671948775005, 2.1)), + model.selection("VERTEX", (6.188000000000001, 0, -3.45)), + model.selection("VERTEX", (-1.956, -5.870724657144867, -0.6000000000000001)), + model.selection("VERTEX", (-1.956, -5.870724657144867, 3.6)), + model.selection( + "VERTEX", (1.956000000000002, -5.870724657144867, -0.6000000000000001) + ), + model.selection("VERTEX", (1.956000000000002, -5.870724657144867, 3.6)), + model.selection("VERTEX", (7.781999999999999, 0, -6.45)), + model.selection( + "VERTEX", (-1.673999999999999, -5.859569950090201, -0.6000000000000001) + ), + model.selection("VERTEX", (-1.673999999999999, -5.859569950090201, 3.6)), + model.selection("VERTEX", (1.674, -5.859569950090198, -0.6000000000000001)), + model.selection("VERTEX", (1.674, -5.859569950090198, 3.6)), + model.selection("VERTEX", (7.031999999999999, 0, -5.850000000000001)), + model.selection("VERTEX", (7.031999999999999, 0, -4.05)), + model.selection("VERTEX", (5.531999999999999, 0, -5.850000000000001)), + model.selection("VERTEX", (5.531999999999999, 0, -4.05)), +] Group_1 = model.addGroup(Part_1_doc, "VERTEX", Group_1_objects) ### Create Group -Group_2_objects = [model.selection("EDGE", (-2.396461671558512, -1.131817856525968e-16, 12.00789389781351)), - model.selection("EDGE", (-2.638225269835214, -8.266365894244581e-17, 11.94417283305663)), - model.selection("EDGE", (-4.025984270042958, 0, 11.44532896613902)), - model.selection("EDGE", (-2.020497700342235, -1.583299567007201e-16, 12.05021761015891)), - model.selection("EDGE", (-4.299547743499724, 0, 11.29230842196757)), - model.selection("EDGE", (-3.862008317343538, 0, 11.38077471561056)), - model.selection("EDGE", (-2.571455041301211, -8.057154366246956e-17, 11.70325430620259)), - model.selection("EDGE", (-4.917500000000027, 6.022200634807143e-16, 10.94235984621998)), - model.selection("EDGE", (4.690036353933139, 0, 11.06969687142275)), - model.selection("EDGE", (3.239887742704441, 1.292862209830259, 11.62058914486002)), - model.selection("EDGE", (1.015679527234812, 0, 12.20741381755836)), - model.selection("EDGE", (3.239887742704441, -1.292862209830259, 11.62058914486002)), - model.selection("EDGE", (-2.335810181591952, -1.103172942157527e-16, 11.7653626693813)), - model.selection("EDGE", (-3.924091572380405, 0, 11.21703556246067)), - model.selection("EDGE", (-6.184999999999998, 7.574440452726377e-16, 10.256)), - model.selection("EDGE", (5.551250000000012, 0, 10.59917992310999)), - model.selection("EDGE", (4.299547743499724, 0, 11.29230842196757)), - model.selection("EDGE", (2.396461671558512, -1.131817856525968e-16, 12.00789389781351)), - model.selection("EDGE", (-1.980680877755174, -1.56449459660897e-16, 11.89099937991211)), - model.selection("EDGE", (-4.212769702413368, 0, 11.10430922268928)), - model.selection("EDGE", (-6.534999999999997, 8.003066832427949e-16, 10.256)), - model.selection("EDGE", (2.638225269835214, -8.266365894244581e-17, 11.94417283305663)), - model.selection("EDGE", (4.025984270042958, 0, 11.44532896613902)), - model.selection("EDGE", (-4.83550000000003, 5.921779597277063e-16, 10.80033167999934)), - model.selection("EDGE", (4.61457932087684, 0, 10.9240528114218)), - model.selection("EDGE", (3.185588131055634, 1.277506786200096, 11.46647364484857)), - model.selection("EDGE", (0.9956307038432277, 0, 12.04461332391097)), - model.selection("EDGE", (3.185588131055634, -1.277506786200096, 11.46647364484857)), - model.selection("EDGE", (-6.534999999999997, 8.003066832427949e-16, 9.186999999999999)), - model.selection("EDGE", (6.534999999999997, 0, 9.721499999999999)), - model.selection("EDGE", (3.862008317343538, 0, 11.38077471561056)), - model.selection("EDGE", (2.571455041301211, -8.057154366246956e-17, 11.70325430620259)), - model.selection("EDGE", (-5.126644475052085, 6.278328746739e-16, 10.62934617154252)), - model.selection("EDGE", (4.981072237526058, 0, 10.71483892577093)), - model.selection("EDGE", (4.212769702413368, 0, 11.10430922268928)), - model.selection("EDGE", (2.335810181591952, -1.103172942157527e-16, 11.7653626693813)), - model.selection("EDGE", (-6.375999999999999, 7.808347991363523e-16, 9.028)), - model.selection("EDGE", (6.455499999999997, 0, 9.1075)), - model.selection("EDGE", (3.924091572380405, 0, 11.21703556246067)), - model.selection("EDGE", (-5.405090045827156, 6.619326223725447e-16, 10.43837553323928)), - model.selection("EDGE", (5.26586726043962, 0, 10.5338608523909)), - model.selection("EDGE", (6.375999999999999, 0, 3.389)), - model.selection("EDGE", (-6.376, 7.808347991363525e-16, -2.25)), - model.selection("EDGE", (8.881784197001252e-16, -6.376, -0.6000000000000001)), - model.selection("EDGE", (-1.956000000000004, -6.068561608816571, 1.5)), - model.selection("EDGE", (0, -6.376, 3.6)), - model.selection("EDGE", (1.956000000000006, -6.068561608816571, 1.5)), - model.selection("EDGE", (-5.676067550792229, 6.95117795782186e-16, 10.23944020672391)), - model.selection("EDGE", (5.540578798309692, 0, 10.33890786998159)), - model.selection("EDGE", (-6.538000000000002, 8.006740772825398e-16, -2.4)), - model.selection("EDGE", (6.457000000000001, 0, -2.325)), - model.selection("EDGE", (-1.955999999999998, -6.117905457312933, -0.6000000000000001)), - model.selection("EDGE", (6.661338147750939e-16, -6.47, -0.6000000000000001)), - model.selection("EDGE", (1.956, -6.117905457312933, -0.6000000000000001)), - model.selection("EDGE", (-1.955999999999992, -6.167249305809295, 1.5)), - model.selection("EDGE", (-1.955999999999998, -6.117905457312933, 3.6)), - model.selection("EDGE", (1.110223024625157e-15, -6.470000000000402, 3.6)), - model.selection("EDGE", (1.956, -6.117905457312933, 3.6)), - model.selection("EDGE", (1.955999999999933, -6.167249305809104, 1.5)), - model.selection("EDGE", (-6.082, 7.448301832414202e-16, 9.532)), - model.selection("EDGE", (5.93522397862061, 0, 9.917962300793777)), - model.selection("EDGE", (-6.538000000000001, 8.006740772825397e-16, -3.45)), - model.selection("EDGE", (6.538000000000002, 0, -2.925)), - model.selection("EDGE", (0.7500000000000007, -6.426383119609755, 1.2)), - model.selection("EDGE", (2.303007255029294e-15, -6.470000000000402, 0.3)), - model.selection("EDGE", (-0.7499999999999993, -6.426383119609755, 1.2)), - model.selection("EDGE", (2.303007255029294e-15, -6.470000000000402, 2.1)), - model.selection("EDGE", (-6.188000000000001, 7.578114393123822e-16, 9.028)), - model.selection("EDGE", (6.135, 0, 9.280000000000001)), - model.selection("EDGE", (-7.781999999999999, 9.530201390964701e-16, -3.45)), - model.selection("EDGE", (0.7500000000000007, -6.047671948775005, 1.2)), - model.selection("EDGE", (0.7500000000000007, -6.23702753419238, 2.1)), - model.selection("EDGE", (0.7500000000000007, -6.23702753419238, 0.3)), - model.selection("EDGE", (2.169169430007367e-15, -6.094000000000006, 0.3)), - model.selection("EDGE", (-0.7499999999999993, -6.23702753419238, 0.3)), - model.selection("EDGE", (-0.7499999999999993, -6.047671948775005, 1.2)), - model.selection("EDGE", (-0.7499999999999993, -6.23702753419238, 2.1)), - model.selection("EDGE", (2.169169430007367e-15, -6.094000000000006, 2.1)), - model.selection("EDGE", (6.188000000000001, 0, 2.789)), - model.selection("EDGE", (-6.188000000000001, 7.578114393123822e-16, -3.45)), - model.selection("EDGE", (-1.956, -5.870724657144867, 1.5)), - model.selection("EDGE", (1.554312234475219e-15, -6.188000000000001, -0.6000000000000001)), - model.selection("EDGE", (1.956000000000002, -5.870724657144867, 1.5)), - model.selection("EDGE", (-4.440892098500626e-16, -6.188000000000001, 3.6)), - model.selection("EDGE", (-7.781999999999999, 9.530201390964701e-16, -6.45)), - model.selection("EDGE", (7.781999999999999, 0, -4.95)), - model.selection("EDGE", (-1.673999999999999, -5.859569950090201, 1.5)), - model.selection("EDGE", (1.110223024625157e-15, -6.094000000000006, -0.6000000000000001)), - model.selection("EDGE", (2.220446049250313e-16, -6.094, 3.6)), - model.selection("EDGE", (1.674, -5.859569950090198, 1.5)), - model.selection("EDGE", (-1.815, -5.865147303617534, -0.6000000000000001)), - model.selection("EDGE", (-1.815, -5.865147303617534, 3.6)), - model.selection("EDGE", (1.815000000000001, -5.865147303617533, -0.6000000000000001)), - model.selection("EDGE", (1.815000000000001, -5.865147303617533, 3.6)), - model.selection("EDGE", (-7.031999999999999, 8.611716291604186e-16, -5.850000000000001)), - model.selection("EDGE", (-7.031999999999999, 8.611716291604186e-16, -4.05)), - model.selection("EDGE", (7.031999999999999, 0, -4.950000000000001)), - model.selection("EDGE", (-5.531999999999999, 6.774746092883157e-16, -5.850000000000001)), - model.selection("EDGE", (-5.531999999999999, 6.774746092883157e-16, -4.05)), - model.selection("EDGE", (5.531999999999999, 0, -4.950000000000001))] +Group_2_objects = [ + model.selection( + "EDGE", (-2.396461671558512, -1.131817856525968e-16, 12.00789389781351) + ), + model.selection( + "EDGE", (-2.638225269835214, -8.266365894244581e-17, 11.94417283305663) + ), + model.selection("EDGE", (-4.025984270042958, 0, 11.44532896613902)), + model.selection( + "EDGE", (-2.020497700342235, -1.583299567007201e-16, 12.05021761015891) + ), + model.selection("EDGE", (-4.299547743499724, 0, 11.29230842196757)), + model.selection("EDGE", (-3.862008317343538, 0, 11.38077471561056)), + model.selection( + "EDGE", (-2.571455041301211, -8.057154366246956e-17, 11.70325430620259) + ), + model.selection( + "EDGE", (-4.917500000000027, 6.022200634807143e-16, 10.94235984621998) + ), + model.selection("EDGE", (4.690036353933139, 0, 11.06969687142275)), + model.selection("EDGE", (3.239887742704441, 1.292862209830259, 11.62058914486002)), + model.selection("EDGE", (1.015679527234812, 0, 12.20741381755836)), + model.selection("EDGE", (3.239887742704441, -1.292862209830259, 11.62058914486002)), + model.selection( + "EDGE", (-2.335810181591952, -1.103172942157527e-16, 11.7653626693813) + ), + model.selection("EDGE", (-3.924091572380405, 0, 11.21703556246067)), + model.selection("EDGE", (-6.184999999999998, 7.574440452726377e-16, 10.256)), + model.selection("EDGE", (5.551250000000012, 0, 10.59917992310999)), + model.selection("EDGE", (4.299547743499724, 0, 11.29230842196757)), + model.selection( + "EDGE", (2.396461671558512, -1.131817856525968e-16, 12.00789389781351) + ), + model.selection( + "EDGE", (-1.980680877755174, -1.56449459660897e-16, 11.89099937991211) + ), + model.selection("EDGE", (-4.212769702413368, 0, 11.10430922268928)), + model.selection("EDGE", (-6.534999999999997, 8.003066832427949e-16, 10.256)), + model.selection( + "EDGE", (2.638225269835214, -8.266365894244581e-17, 11.94417283305663) + ), + model.selection("EDGE", (4.025984270042958, 0, 11.44532896613902)), + model.selection( + "EDGE", (-4.83550000000003, 5.921779597277063e-16, 10.80033167999934) + ), + model.selection("EDGE", (4.61457932087684, 0, 10.9240528114218)), + model.selection("EDGE", (3.185588131055634, 1.277506786200096, 11.46647364484857)), + model.selection("EDGE", (0.9956307038432277, 0, 12.04461332391097)), + model.selection("EDGE", (3.185588131055634, -1.277506786200096, 11.46647364484857)), + model.selection( + "EDGE", (-6.534999999999997, 8.003066832427949e-16, 9.186999999999999) + ), + model.selection("EDGE", (6.534999999999997, 0, 9.721499999999999)), + model.selection("EDGE", (3.862008317343538, 0, 11.38077471561056)), + model.selection( + "EDGE", (2.571455041301211, -8.057154366246956e-17, 11.70325430620259) + ), + model.selection( + "EDGE", (-5.126644475052085, 6.278328746739e-16, 10.62934617154252) + ), + model.selection("EDGE", (4.981072237526058, 0, 10.71483892577093)), + model.selection("EDGE", (4.212769702413368, 0, 11.10430922268928)), + model.selection( + "EDGE", (2.335810181591952, -1.103172942157527e-16, 11.7653626693813) + ), + model.selection("EDGE", (-6.375999999999999, 7.808347991363523e-16, 9.028)), + model.selection("EDGE", (6.455499999999997, 0, 9.1075)), + model.selection("EDGE", (3.924091572380405, 0, 11.21703556246067)), + model.selection( + "EDGE", (-5.405090045827156, 6.619326223725447e-16, 10.43837553323928) + ), + model.selection("EDGE", (5.26586726043962, 0, 10.5338608523909)), + model.selection("EDGE", (6.375999999999999, 0, 3.389)), + model.selection("EDGE", (-6.376, 7.808347991363525e-16, -2.25)), + model.selection("EDGE", (8.881784197001252e-16, -6.376, -0.6000000000000001)), + model.selection("EDGE", (-1.956000000000004, -6.068561608816571, 1.5)), + model.selection("EDGE", (0, -6.376, 3.6)), + model.selection("EDGE", (1.956000000000006, -6.068561608816571, 1.5)), + model.selection( + "EDGE", (-5.676067550792229, 6.95117795782186e-16, 10.23944020672391) + ), + model.selection("EDGE", (5.540578798309692, 0, 10.33890786998159)), + model.selection("EDGE", (-6.538000000000002, 8.006740772825398e-16, -2.4)), + model.selection("EDGE", (6.457000000000001, 0, -2.325)), + model.selection( + "EDGE", (-1.955999999999998, -6.117905457312933, -0.6000000000000001) + ), + model.selection("EDGE", (6.661338147750939e-16, -6.47, -0.6000000000000001)), + model.selection("EDGE", (1.956, -6.117905457312933, -0.6000000000000001)), + model.selection("EDGE", (-1.955999999999992, -6.167249305809295, 1.5)), + model.selection("EDGE", (-1.955999999999998, -6.117905457312933, 3.6)), + model.selection("EDGE", (1.110223024625157e-15, -6.470000000000402, 3.6)), + model.selection("EDGE", (1.956, -6.117905457312933, 3.6)), + model.selection("EDGE", (1.955999999999933, -6.167249305809104, 1.5)), + model.selection("EDGE", (-6.082, 7.448301832414202e-16, 9.532)), + model.selection("EDGE", (5.93522397862061, 0, 9.917962300793777)), + model.selection("EDGE", (-6.538000000000001, 8.006740772825397e-16, -3.45)), + model.selection("EDGE", (6.538000000000002, 0, -2.925)), + model.selection("EDGE", (0.7500000000000007, -6.426383119609755, 1.2)), + model.selection("EDGE", (2.303007255029294e-15, -6.470000000000402, 0.3)), + model.selection("EDGE", (-0.7499999999999993, -6.426383119609755, 1.2)), + model.selection("EDGE", (2.303007255029294e-15, -6.470000000000402, 2.1)), + model.selection("EDGE", (-6.188000000000001, 7.578114393123822e-16, 9.028)), + model.selection("EDGE", (6.135, 0, 9.280000000000001)), + model.selection("EDGE", (-7.781999999999999, 9.530201390964701e-16, -3.45)), + model.selection("EDGE", (0.7500000000000007, -6.047671948775005, 1.2)), + model.selection("EDGE", (0.7500000000000007, -6.23702753419238, 2.1)), + model.selection("EDGE", (0.7500000000000007, -6.23702753419238, 0.3)), + model.selection("EDGE", (2.169169430007367e-15, -6.094000000000006, 0.3)), + model.selection("EDGE", (-0.7499999999999993, -6.23702753419238, 0.3)), + model.selection("EDGE", (-0.7499999999999993, -6.047671948775005, 1.2)), + model.selection("EDGE", (-0.7499999999999993, -6.23702753419238, 2.1)), + model.selection("EDGE", (2.169169430007367e-15, -6.094000000000006, 2.1)), + model.selection("EDGE", (6.188000000000001, 0, 2.789)), + model.selection("EDGE", (-6.188000000000001, 7.578114393123822e-16, -3.45)), + model.selection("EDGE", (-1.956, -5.870724657144867, 1.5)), + model.selection( + "EDGE", (1.554312234475219e-15, -6.188000000000001, -0.6000000000000001) + ), + model.selection("EDGE", (1.956000000000002, -5.870724657144867, 1.5)), + model.selection("EDGE", (-4.440892098500626e-16, -6.188000000000001, 3.6)), + model.selection("EDGE", (-7.781999999999999, 9.530201390964701e-16, -6.45)), + model.selection("EDGE", (7.781999999999999, 0, -4.95)), + model.selection("EDGE", (-1.673999999999999, -5.859569950090201, 1.5)), + model.selection( + "EDGE", (1.110223024625157e-15, -6.094000000000006, -0.6000000000000001) + ), + model.selection("EDGE", (2.220446049250313e-16, -6.094, 3.6)), + model.selection("EDGE", (1.674, -5.859569950090198, 1.5)), + model.selection("EDGE", (-1.815, -5.865147303617534, -0.6000000000000001)), + model.selection("EDGE", (-1.815, -5.865147303617534, 3.6)), + model.selection( + "EDGE", (1.815000000000001, -5.865147303617533, -0.6000000000000001) + ), + model.selection("EDGE", (1.815000000000001, -5.865147303617533, 3.6)), + model.selection( + "EDGE", (-7.031999999999999, 8.611716291604186e-16, -5.850000000000001) + ), + model.selection("EDGE", (-7.031999999999999, 8.611716291604186e-16, -4.05)), + model.selection("EDGE", (7.031999999999999, 0, -4.950000000000001)), + model.selection( + "EDGE", (-5.531999999999999, 6.774746092883157e-16, -5.850000000000001) + ), + model.selection("EDGE", (-5.531999999999999, 6.774746092883157e-16, -4.05)), + model.selection("EDGE", (5.531999999999999, 0, -4.950000000000001)), +] Group_2 = model.addGroup(Part_1_doc, "EDGE", Group_2_objects) ### Create Group -Group_3_objects = [model.selection("FACE_4", (-2.517545082612181, -9.793056484573228e-17, 11.9767982996405)), - model.selection("FACE", (-2.208479685950373, -1.357558711766585e-16, 12.02905575398621)), - model.selection("FACE", (-2.604840155568212, -8.161760130245771e-17, 11.82371356962961)), - model.selection("FACE", (-2.545485308583307, 3.11732043543316e-16, 11.92488050155302)), - model.selection("FACE_4", (-2.453829120812922, -9.545206300209715e-17, 11.73505406245584)), - model.selection("FACE", (-5.551250000000012, 6.798320543766759e-16, 10.59917992310999)), - model.selection("FACE", (2.208479685950373, -1.357558711766585e-16, 12.02905575398621)), - model.selection("FACE", (-2.158245529673563, -1.333833769383248e-16, 11.8281810246467)), - model.selection("FACE", (0, 0, 10.256)), - model.selection("FACE_4", (2.517545082612181, -9.793056484573228e-17, 11.9767982996405)), - model.selection("FACE", (-2.503038985186496, 3.065338681349682e-16, 11.76646866604162)), - model.selection("FACE", (-6.534999999999997, 8.003066832427949e-16, 9.721499999999999)), - model.selection("FACE", (2.604840155568212, -8.161760130245771e-17, 11.82371356962961)), - model.selection("FACE", (-4.981072237526058, 6.100054172008031e-16, 10.71483892577093)), - model.selection("FACE", (2.158245529673563, -1.333833769383248e-16, 11.8281810246467)), - model.selection("FACE", (-6.455499999999997, 7.905707411895736e-16, 9.1075)), - model.selection("FACE_4", (2.453829120812922, -9.545206300209715e-17, 11.73505406245584)), - model.selection("FACE", (-5.26586726043962, 6.448827485232222e-16, 10.5338608523909)), - model.selection("FACE", (-6.376, 7.808347991363525e-16, 3.389)), - model.selection("FACE", (-5.540578798309692, 6.785252090773653e-16, 10.33890786998159)), - model.selection("FACE", (-6.457000000000002, 7.907544382094462e-16, -2.325)), - model.selection("FACE", (6.960299896894503e-16, -6.269280804408197, -0.6000000000000001)), - model.selection("FACE", (-1.955999999999998, -6.117905457312933, 1.5)), - model.selection("FACE", (6.960299896894726e-16, -6.269280804408398, 3.6)), - model.selection("FACE", (1.956, -6.117905457312933, 1.5)), - model.selection("FACE", (-5.93522397862061, 7.268553047640348e-16, 9.917962300793777)), - model.selection("FACE", (-6.538000000000001, 8.006740772825397e-16, -2.925)), - model.selection("FACE", (-8.663786611642525e-16, -6.470000000000402, 1.5)), - model.selection("FACE", (-6.135, 7.513208112769011e-16, 9.280000000000001)), - model.selection("FACE", (0, 0, -3.45)), - model.selection("FACE", (0.7500000000000007, -6.23702753419238, 1.2)), - model.selection("FACE", (1.998401444325282e-15, -6.258835974387703, 0.3)), - model.selection("FACE", (-0.7499999999999993, -6.23702753419238, 1.2)), - model.selection("FACE", (1.998401444325282e-15, -6.258835974387703, 2.1)), - model.selection("FACE", (-6.188000000000001, 7.578114393123822e-16, 2.789)), - model.selection("FACE", (-7.781999999999999, 9.530201390964701e-16, -4.95)), - model.selection("FACE", (-8.160296075942244e-16, -6.094000000000006, 1.5)), - model.selection("FACE_2", (0, 0, -3.45)), - model.selection("FACE", (-1.815, -5.865147303617534, 1.5)), - model.selection("FACE", (6.687744774686146e-16, -6.023784975045102, -0.6000000000000001)), - model.selection("FACE", (1.815000000000001, -5.865147303617533, 1.5)), - model.selection("FACE", (6.687744774686142e-16, -6.023784975045098, 3.6)), - model.selection("FACE", (0, 0, -6.45)), - model.selection("FACE", (-7.031999999999999, 8.611716291604186e-16, -4.950000000000001)), - model.selection("FACE", (0, 0, -5.850000000000001)), - model.selection("FACE", (0, 0, -4.05)), - model.selection("FACE", (-5.531999999999999, 6.774746092883157e-16, -4.950000000000001))] +Group_3_objects = [ + model.selection( + "FACE_4", (-2.517545082612181, -9.793056484573228e-17, 11.9767982996405) + ), + model.selection( + "FACE", (-2.208479685950373, -1.357558711766585e-16, 12.02905575398621) + ), + model.selection( + "FACE", (-2.604840155568212, -8.161760130245771e-17, 11.82371356962961) + ), + model.selection( + "FACE", (-2.545485308583307, 3.11732043543316e-16, 11.92488050155302) + ), + model.selection( + "FACE_4", (-2.453829120812922, -9.545206300209715e-17, 11.73505406245584) + ), + model.selection( + "FACE", (-5.551250000000012, 6.798320543766759e-16, 10.59917992310999) + ), + model.selection( + "FACE", (2.208479685950373, -1.357558711766585e-16, 12.02905575398621) + ), + model.selection( + "FACE", (-2.158245529673563, -1.333833769383248e-16, 11.8281810246467) + ), + model.selection("FACE", (0, 0, 10.256)), + model.selection( + "FACE_4", (2.517545082612181, -9.793056484573228e-17, 11.9767982996405) + ), + model.selection( + "FACE", (-2.503038985186496, 3.065338681349682e-16, 11.76646866604162) + ), + model.selection( + "FACE", (-6.534999999999997, 8.003066832427949e-16, 9.721499999999999) + ), + model.selection( + "FACE", (2.604840155568212, -8.161760130245771e-17, 11.82371356962961) + ), + model.selection( + "FACE", (-4.981072237526058, 6.100054172008031e-16, 10.71483892577093) + ), + model.selection( + "FACE", (2.158245529673563, -1.333833769383248e-16, 11.8281810246467) + ), + model.selection("FACE", (-6.455499999999997, 7.905707411895736e-16, 9.1075)), + model.selection( + "FACE_4", (2.453829120812922, -9.545206300209715e-17, 11.73505406245584) + ), + model.selection( + "FACE", (-5.26586726043962, 6.448827485232222e-16, 10.5338608523909) + ), + model.selection("FACE", (-6.376, 7.808347991363525e-16, 3.389)), + model.selection( + "FACE", (-5.540578798309692, 6.785252090773653e-16, 10.33890786998159) + ), + model.selection("FACE", (-6.457000000000002, 7.907544382094462e-16, -2.325)), + model.selection( + "FACE", (6.960299896894503e-16, -6.269280804408197, -0.6000000000000001) + ), + model.selection("FACE", (-1.955999999999998, -6.117905457312933, 1.5)), + model.selection("FACE", (6.960299896894726e-16, -6.269280804408398, 3.6)), + model.selection("FACE", (1.956, -6.117905457312933, 1.5)), + model.selection( + "FACE", (-5.93522397862061, 7.268553047640348e-16, 9.917962300793777) + ), + model.selection("FACE", (-6.538000000000001, 8.006740772825397e-16, -2.925)), + model.selection("FACE", (-8.663786611642525e-16, -6.470000000000402, 1.5)), + model.selection("FACE", (-6.135, 7.513208112769011e-16, 9.280000000000001)), + model.selection("FACE", (0, 0, -3.45)), + model.selection("FACE", (0.7500000000000007, -6.23702753419238, 1.2)), + model.selection("FACE", (1.998401444325282e-15, -6.258835974387703, 0.3)), + model.selection("FACE", (-0.7499999999999993, -6.23702753419238, 1.2)), + model.selection("FACE", (1.998401444325282e-15, -6.258835974387703, 2.1)), + model.selection("FACE", (-6.188000000000001, 7.578114393123822e-16, 2.789)), + model.selection("FACE", (-7.781999999999999, 9.530201390964701e-16, -4.95)), + model.selection("FACE", (-8.160296075942244e-16, -6.094000000000006, 1.5)), + model.selection("FACE_2", (0, 0, -3.45)), + model.selection("FACE", (-1.815, -5.865147303617534, 1.5)), + model.selection( + "FACE", (6.687744774686146e-16, -6.023784975045102, -0.6000000000000001) + ), + model.selection("FACE", (1.815000000000001, -5.865147303617533, 1.5)), + model.selection("FACE", (6.687744774686142e-16, -6.023784975045098, 3.6)), + model.selection("FACE", (0, 0, -6.45)), + model.selection( + "FACE", (-7.031999999999999, 8.611716291604186e-16, -4.950000000000001) + ), + model.selection("FACE", (0, 0, -5.850000000000001)), + model.selection("FACE", (0, 0, -4.05)), + model.selection( + "FACE", (-5.531999999999999, 6.774746092883157e-16, -4.950000000000001) + ), +] Group_3 = model.addGroup(Part_1_doc, "FACE", Group_3_objects) ### Create Partition -Partition_1_objects = [model.selection("SOLID", (-0.01000739040276288, -0.02886888807097911, -2.568297753475152)), - model.selection("FACE", "PartSet/XOZ"), - model.selection("FACE", "PartSet/YOZ")] -Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults = True) +Partition_1_objects = [ + model.selection( + "SOLID", (-0.01000739040276288, -0.02886888807097911, -2.568297753475152) + ), + model.selection("FACE", "PartSet/XOZ"), + model.selection("FACE", "PartSet/YOZ"), +] +Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults=True) ### Create Revolution -Revolution_4 = model.addRevolution(Part_1_doc, [model.selection("EDGE", (3.241000000000025, 0, 11.62374600149389))], model.selection("EDGE", "PartSet/OZ"), 360, 0) +Revolution_4 = model.addRevolution( + Part_1_doc, + [model.selection("EDGE", (3.241000000000025, 0, 11.62374600149389))], + model.selection("EDGE", "PartSet/OZ"), + 360, + 0, +) ### Create Split -Split_1 = model.addSplit(Part_1_doc, [model.selection("COMPOUND", "all-in-Partition_1")], [model.selection("FACE", (-3.241000000000025, 3.969080276036602e-16, 11.62374600149389))], keepSubResults = True) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Partition_1")], + [ + model.selection( + "FACE", (-3.241000000000025, 3.969080276036602e-16, 11.62374600149389) + ) + ], + keepSubResults=True, +) ### Create Plane -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), model.selection("EDGE", (1.641269250487042, 0, 7.083321183366995)), 45) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOZ"), + model.selection("EDGE", (1.641269250487042, 0, 7.083321183366995)), + 45, +) ### Create Sketch -Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", (-0.2226138955685692, 0.569819820950182, 0.07843369470366612))) +Sketch_5 = model.addSketch( + Part_1_doc, + model.selection( + "FACE", (-0.2226138955685692, 0.569819820950182, 0.07843369470366612) + ), +) ### Create SketchLine -SketchLine_54 = Sketch_5.addLine(5.509213645269787, 10.82082332930156, 5.382690082387538, 10.60520378465038) +SketchLine_54 = Sketch_5.addLine( + 5.509213645269787, 10.82082332930156, 5.382690082387538, 10.60520378465038 +) ### Create SketchLine -SketchLine_55 = Sketch_5.addLine(5.382690082387538, 10.60520378465038, 5.5912917558727, 10.4792224745154) +SketchLine_55 = Sketch_5.addLine( + 5.382690082387538, 10.60520378465038, 5.5912917558727, 10.4792224745154 +) Sketch_5.setCoincident(SketchLine_54.endPoint(), SketchLine_55.startPoint()) ### Create SketchLine -SketchLine_56 = Sketch_5.addLine(5.5912917558727, 10.4792224745154, 5.928669438910004, 10.31165844357506) +SketchLine_56 = Sketch_5.addLine( + 5.5912917558727, 10.4792224745154, 5.928669438910004, 10.31165844357506 +) Sketch_5.setCoincident(SketchLine_55.endPoint(), SketchLine_56.startPoint()) ### Create SketchIntersectionPoint -SketchIntersectionPoint_1 = Sketch_5.addIntersectionPoint(model.selection("EDGE", (3.702627511927584, 0.4999301855486544, 11.56915131750861)), True) +SketchIntersectionPoint_1 = Sketch_5.addIntersectionPoint( + model.selection("EDGE", (3.702627511927584, 0.4999301855486544, 11.56915131750861)), + True, +) [SketchPoint_6] = SketchIntersectionPoint_1.intersectionPoints() ### Create SketchIntersectionPoint -SketchIntersectionPoint_2 = Sketch_5.addIntersectionPoint(model.selection("EDGE", (3.842036619330953, 0.6956302444411427, 11.49857356165358)), True) +SketchIntersectionPoint_2 = Sketch_5.addIntersectionPoint( + model.selection("EDGE", (3.842036619330953, 0.6956302444411427, 11.49857356165358)), + True, +) [SketchPoint_7] = SketchIntersectionPoint_2.intersectionPoints() ### Create SketchIntersectionPoint -SketchIntersectionPoint_3 = Sketch_5.addIntersectionPoint(model.selection("EDGE", (4.017164528771908, 0.996160155893292, 11.34673072293646)), True) +SketchIntersectionPoint_3 = Sketch_5.addIntersectionPoint( + model.selection("EDGE", (4.017164528771908, 0.996160155893292, 11.34673072293646)), + True, +) [SketchPoint_8] = SketchIntersectionPoint_3.intersectionPoints() ### Create SketchIntersectionPoint -SketchIntersectionPoint_4 = Sketch_5.addIntersectionPoint(model.selection("EDGE", (3.6089185751001, 0.4872775689878997, 11.33772412279539)), True) +SketchIntersectionPoint_4 = Sketch_5.addIntersectionPoint( + model.selection("EDGE", (3.6089185751001, 0.4872775689878997, 11.33772412279539)), + True, +) [SketchPoint_9] = SketchIntersectionPoint_4.intersectionPoints() -Sketch_5.setCoincident(SketchLine_54.startPoint(), SketchAPI_Point(SketchPoint_6).coordinates()) -Sketch_5.setCoincident(SketchLine_55.startPoint(), SketchAPI_Point(SketchPoint_9).coordinates()) +Sketch_5.setCoincident( + SketchLine_54.startPoint(), SketchAPI_Point(SketchPoint_6).coordinates() +) +Sketch_5.setCoincident( + SketchLine_55.startPoint(), SketchAPI_Point(SketchPoint_9).coordinates() +) ### Create SketchIntersectionPoint -SketchIntersectionPoint_5 = Sketch_5.addIntersectionPoint(model.selection("EDGE", (3.744799409892532, 0.6780247006964295, 11.26893260291564)), True) +SketchIntersectionPoint_5 = Sketch_5.addIntersectionPoint( + model.selection("EDGE", (3.744799409892532, 0.6780247006964295, 11.26893260291564)), + True, +) [SketchPoint_10] = SketchIntersectionPoint_5.intersectionPoints() ### Create SketchIntersectionPoint -SketchIntersectionPoint_6 = Sketch_5.addIntersectionPoint(model.selection("EDGE", (3.953197175833091, 0.9847109023550349, 11.19602146433181)), True) +SketchIntersectionPoint_6 = Sketch_5.addIntersectionPoint( + model.selection("EDGE", (3.953197175833091, 0.9847109023550349, 11.19602146433181)), + True, +) [SketchPoint_11] = SketchIntersectionPoint_6.intersectionPoints() -Sketch_5.setCoincident(SketchLine_55.endPoint(), SketchAPI_Point(SketchPoint_10).coordinates()) -Sketch_5.setCoincident(SketchLine_56.endPoint(), SketchAPI_Point(SketchPoint_11).coordinates()) +Sketch_5.setCoincident( + SketchLine_55.endPoint(), SketchAPI_Point(SketchPoint_10).coordinates() +) +Sketch_5.setCoincident( + SketchLine_56.endPoint(), SketchAPI_Point(SketchPoint_11).coordinates() +) ### Create SketchLine -SketchLine_57 = Sketch_5.addLine(5.723231855768999, 10.69157079694662, 5.5912917558727, 10.4792224745154) +SketchLine_57 = Sketch_5.addLine( + 5.723231855768999, 10.69157079694662, 5.5912917558727, 10.4792224745154 +) SketchLine_57.setName("SketchLine_72") SketchLine_57.result().setName("SketchLine_72") Sketch_5.setCoincident(SketchLine_55.endPoint(), SketchLine_57.endPoint()) ### Create SketchLine -SketchLine_58 = Sketch_5.addLine(5.928669438910005, 10.31165844357506, 6.034221518827074, 10.48153710152002) +SketchLine_58 = Sketch_5.addLine( + 5.928669438910005, 10.31165844357506, 6.034221518827074, 10.48153710152002 +) SketchLine_58.setName("SketchLine_109") SketchLine_58.result().setName("SketchLine_109") Sketch_5.setCoincident(SketchLine_56.endPoint(), SketchLine_58.startPoint()) ### Create SketchLine -SketchLine_59 = Sketch_5.addLine(6.034221518827074, 10.48153710152002, 5.723231855768999, 10.69157079694662) +SketchLine_59 = Sketch_5.addLine( + 6.034221518827074, 10.48153710152002, 5.723231855768999, 10.69157079694662 +) SketchLine_59.setName("SketchLine_113") SketchLine_59.result().setName("SketchLine_113") Sketch_5.setCoincident(SketchLine_58.endPoint(), SketchLine_59.startPoint()) -Sketch_5.setCoincident(SketchLine_58.result(), SketchAPI_Point(SketchPoint_8).coordinates()) +Sketch_5.setCoincident( + SketchLine_58.result(), SketchAPI_Point(SketchPoint_8).coordinates() +) Sketch_5.setLength(SketchLine_58.result(), 0.2) ### Create SketchLine -SketchLine_60 = Sketch_5.addLine(5.723231855768999, 10.69157079694662, 5.514274587785066, 10.82944811108761) +SketchLine_60 = Sketch_5.addLine( + 5.723231855768999, 10.69157079694662, 5.514274587785066, 10.82944811108761 +) SketchLine_60.setName("SketchLine_114") SketchLine_60.result().setName("SketchLine_114") -Sketch_5.setCoincident(SketchAPI_Point(SketchPoint_7).coordinates(), SketchLine_60.startPoint()) +Sketch_5.setCoincident( + SketchAPI_Point(SketchPoint_7).coordinates(), SketchLine_60.startPoint() +) ### Create SketchLine -SketchLine_61 = Sketch_5.addLine(5.514274587785066, 10.82944811108761, 5.509213645269788, 10.82082332930156) +SketchLine_61 = Sketch_5.addLine( + 5.514274587785066, 10.82944811108761, 5.509213645269788, 10.82082332930156 +) SketchLine_61.setName("SketchLine_115") SketchLine_61.result().setName("SketchLine_115") Sketch_5.setCoincident(SketchLine_60.endPoint(), SketchLine_61.startPoint()) @@ -806,29 +1194,78 @@ model.do() Face_1 = model.addFace(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_5")]) ### Create Revolution -Revolution_5 = model.addRevolution(Part_1_doc, [model.selection("EDGE", (4.076911075012474, 0.9099495009061933, 11.2579935104532))], model.selection("EDGE", "PartSet/OZ"), model.selection("FACE", "PartSet/YOZ"), 0, model.selection(), 0) +Revolution_5 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "EDGE", (4.076911075012474, 0.9099495009061933, 11.2579935104532) + ) + ], + model.selection("EDGE", "PartSet/OZ"), + model.selection("FACE", "PartSet/YOZ"), + 0, + model.selection(), + 0, +) ### Create Symmetry -Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "all-in-Face_1"), model.selection("COMPOUND", "all-in-Revolution_5")], model.selection("FACE", "PartSet/YOZ"), keepOriginal = True, keepSubResults = True) +Symmetry_2 = model.addSymmetry( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Face_1"), + model.selection("COMPOUND", "all-in-Revolution_5"), + ], + model.selection("FACE", "PartSet/YOZ"), + keepOriginal=True, + keepSubResults=True, +) ### Create Symmetry -Symmetry_3 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "all-in-Symmetry_2")], model.selection("FACE", "PartSet/XOZ"), keepOriginal = True, keepSubResults = True) +Symmetry_3 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Symmetry_2")], + model.selection("FACE", "PartSet/XOZ"), + keepOriginal=True, + keepSubResults=True, +) ### Create Point -Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", (3.477197596484867, 3.477197596484866, 10.94235984621998)), 1.25, False, False) +Point_2 = model.addPoint( + Part_1_doc, + model.selection("EDGE", (3.477197596484867, 3.477197596484866, 10.94235984621998)), + 1.25, + False, + False, +) ### Create Plane -Plane_6 = model.addPlane(Part_1_doc, model.selection("EDGE", (4.076911075012474, 0.9099495009061933, 11.2579935104532)), model.selection("VERTEX", (4.759482234014627, 1.236582028859954, 10.94235984621998)), False) +Plane_6 = model.addPlane( + Part_1_doc, + model.selection("EDGE", (4.076911075012474, 0.9099495009061933, 11.2579935104532)), + model.selection( + "VERTEX", (4.759482234014627, 1.236582028859954, 10.94235984621998) + ), + False, +) ### Create Sketch -Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", (4.402175028097471, 1.06143508289953, 11.14508272976159))) +Sketch_6 = model.addSketch( + Part_1_doc, + model.selection("FACE", (4.402175028097471, 1.06143508289953, 11.14508272976159)), +) ### Create SketchIntersectionPoint -SketchIntersectionPoint_7 = Sketch_6.addIntersectionPoint(model.selection("EDGE", (3.419214840427572, 3.419214840427571, 10.80033167999934)), True) +SketchIntersectionPoint_7 = Sketch_6.addIntersectionPoint( + model.selection("EDGE", (3.419214840427572, 3.419214840427571, 10.80033167999934)), + True, +) [SketchPoint_12] = SketchIntersectionPoint_7.intersectionPoints() ### Create SketchIntersectionPoint -SketchIntersectionPoint_8 = Sketch_6.addIntersectionPoint(model.selection("EDGE", (4.017164528771908, 0.996160155893292, 11.34673072293646)), True) +SketchIntersectionPoint_8 = Sketch_6.addIntersectionPoint( + model.selection("EDGE", (4.017164528771908, 0.996160155893292, 11.34673072293646)), + True, +) SketchIntersectionPoint_8.setName("SketchIntersectionPoint_9") SketchIntersectionPoint_8.result().setName("SketchIntersectionPoint_9") [SketchPoint_13] = SketchIntersectionPoint_8.intersectionPoints() @@ -836,7 +1273,10 @@ SketchPoint_13.setName("SketchPoint_14") SketchPoint_13.result().setName("SketchPoint_14") ### Create SketchIntersectionPoint -SketchIntersectionPoint_9 = Sketch_6.addIntersectionPoint(model.selection("EDGE", (3.953197175833091, 0.9847109023550349, 11.19602146433181)), True) +SketchIntersectionPoint_9 = Sketch_6.addIntersectionPoint( + model.selection("EDGE", (3.953197175833091, 0.9847109023550349, 11.19602146433181)), + True, +) SketchIntersectionPoint_9.setName("SketchIntersectionPoint_10") SketchIntersectionPoint_9.result().setName("SketchIntersectionPoint_10") [SketchPoint_14] = SketchIntersectionPoint_9.intersectionPoints() @@ -844,38 +1284,91 @@ SketchPoint_14.setName("SketchPoint_15") SketchPoint_14.result().setName("SketchPoint_15") ### Create SketchProjection -SketchProjection_14 = Sketch_6.addProjection(model.selection("VERTEX", (4.759482234014627, 1.236582028859954, 10.94235984621998)), False) +SketchProjection_14 = Sketch_6.addProjection( + model.selection( + "VERTEX", (4.759482234014627, 1.236582028859954, 10.94235984621998) + ), + False, +) SketchPoint_15 = SketchProjection_14.createdFeature() SketchPoint_15.setName("SketchPoint_16") SketchPoint_15.result().setName("SketchPoint_16") ### Create SketchLine -SketchLine_62 = Sketch_6.addLine(5.246389275102901, -10.59990828317982, 5.359721474154084, -10.7814541886472) +SketchLine_62 = Sketch_6.addLine( + 5.246389275102901, -10.59990828317982, 5.359721474154084, -10.7814541886472 +) SketchLine_62.setName("SketchLine_60") SketchLine_62.result().setName("SketchLine_60") -Sketch_6.setCoincident(SketchLine_62.result(), SketchAPI_Point(SketchPoint_15).coordinates()) -Sketch_6.setCoincident(SketchLine_62.result(), SketchAPI_Point(SketchPoint_12).coordinates()) -Sketch_6.setDistance(SketchAPI_Point(SketchPoint_15).coordinates(), SketchLine_62.endPoint(), 0.05, True) -Sketch_6.setCoincident(SketchLine_62.startPoint(), SketchAPI_Point(SketchPoint_12).coordinates()) +Sketch_6.setCoincident( + SketchLine_62.result(), SketchAPI_Point(SketchPoint_15).coordinates() +) +Sketch_6.setCoincident( + SketchLine_62.result(), SketchAPI_Point(SketchPoint_12).coordinates() +) +Sketch_6.setDistance( + SketchAPI_Point(SketchPoint_15).coordinates(), SketchLine_62.endPoint(), 0.05, True +) +Sketch_6.setCoincident( + SketchLine_62.startPoint(), SketchAPI_Point(SketchPoint_12).coordinates() +) model.do() ### Create Filling -Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", (4.731694417794685, 1.230193210543086, 10.89299420755799)), model.selection("EDGE", (4.076911075012474, 0.9099495009061933, 11.2579935104532))]) +Filling_1 = model.addFilling( + Part_1_doc, + [ + model.selection( + "EDGE", (4.731694417794685, 1.230193210543086, 10.89299420755799) + ), + model.selection( + "EDGE", (4.076911075012474, 0.9099495009061933, 11.2579935104532) + ), + ], +) ### Create Revolution -Revolution_6 = model.addRevolution(Part_1_doc, [model.selection("EDGE_2", (4.731694417794685, 1.230193210543086, 10.89299420755799))], model.selection("EDGE", "PartSet/OZ"), 360, 0) +Revolution_6 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "EDGE_2", (4.731694417794685, 1.230193210543086, 10.89299420755799) + ) + ], + model.selection("EDGE", "PartSet/OZ"), + 360, + 0, +) ### Create Point -Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", (4.373455441638796, 4.373455441638795, 10.256)), 1.5, False, False) +Point_3 = model.addPoint( + Part_1_doc, + model.selection("EDGE", (4.373455441638796, 4.373455441638795, 10.256)), + 1.5, + False, + False, +) ### Create Plane -Plane_7 = model.addPlane(Part_1_doc, model.selection("EDGE_4", (4.731694417794685, 1.230193210543086, 10.89299420755799)), model.selection("VERTEX", (6.003998107905526, 1.485338924376133, 10.256)), False) +Plane_7 = model.addPlane( + Part_1_doc, + model.selection( + "EDGE_4", (4.731694417794685, 1.230193210543086, 10.89299420755799) + ), + model.selection("VERTEX", (6.003998107905526, 1.485338924376133, 10.256)), + False, +) ### Create Sketch -Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", (5.34152925833792, 1.352916016182442, 10.62081358317238))) +Sketch_7 = model.addSketch( + Part_1_doc, + model.selection("FACE", (5.34152925833792, 1.352916016182442, 10.62081358317238)), +) ### Create SketchIntersectionPoint -SketchIntersectionPoint_10 = Sketch_7.addIntersectionPoint(model.selection("EDGE", (4.620942815054086, 4.620942815054085, 10.256)), True) +SketchIntersectionPoint_10 = Sketch_7.addIntersectionPoint( + model.selection("EDGE", (4.620942815054086, 4.620942815054085, 10.256)), True +) SketchIntersectionPoint_10.setName("SketchIntersectionPoint_11") SketchIntersectionPoint_10.result().setName("SketchIntersectionPoint_11") [SketchPoint_16] = SketchIntersectionPoint_10.intersectionPoints() @@ -883,7 +1376,10 @@ SketchPoint_16.setName("SketchPoint_17") SketchPoint_16.result().setName("SketchPoint_17") ### Create SketchIntersectionPoint -SketchIntersectionPoint_11 = Sketch_7.addIntersectionPoint(model.selection("EDGE", (4.620942815054086, 4.620942815054085, 9.186999999999999)), True) +SketchIntersectionPoint_11 = Sketch_7.addIntersectionPoint( + model.selection("EDGE", (4.620942815054086, 4.620942815054085, 9.186999999999999)), + True, +) SketchIntersectionPoint_11.setName("SketchIntersectionPoint_12") SketchIntersectionPoint_11.result().setName("SketchIntersectionPoint_12") [SketchPoint_17] = SketchIntersectionPoint_11.intersectionPoints() @@ -891,7 +1387,9 @@ SketchPoint_17.setName("SketchPoint_18") SketchPoint_17.result().setName("SketchPoint_18") ### Create SketchIntersectionPoint -SketchIntersectionPoint_12 = Sketch_7.addIntersectionPoint(model.selection("EDGE", (4.508512836845426, 4.508512836845425, 9.028)), True) +SketchIntersectionPoint_12 = Sketch_7.addIntersectionPoint( + model.selection("EDGE", (4.508512836845426, 4.508512836845425, 9.028)), True +) SketchIntersectionPoint_12.setName("SketchIntersectionPoint_13") SketchIntersectionPoint_12.result().setName("SketchIntersectionPoint_13") [SketchPoint_18] = SketchIntersectionPoint_12.intersectionPoints() @@ -899,13 +1397,19 @@ SketchPoint_18.setName("SketchPoint_19") SketchPoint_18.result().setName("SketchPoint_19") ### Create SketchLine -SketchLine_63 = Sketch_7.addLine(6.348502432487296, -9.04671367200557, 6.153596006787127, -10.27430623369788) +SketchLine_63 = Sketch_7.addLine( + 6.348502432487296, -9.04671367200557, 6.153596006787127, -10.27430623369788 +) SketchLine_63.setName("SketchLine_65") SketchLine_63.result().setName("SketchLine_65") -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_18).coordinates(), SketchLine_63.startPoint()) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_18).coordinates(), SketchLine_63.startPoint() +) ### Create SketchProjection -SketchProjection_15 = Sketch_7.addProjection(model.selection("VERTEX", (6.003998107905526, 1.485338924376133, 10.256)), False) +SketchProjection_15 = Sketch_7.addProjection( + model.selection("VERTEX", (6.003998107905526, 1.485338924376133, 10.256)), False +) SketchProjection_15.setName("SketchProjection_16") SketchProjection_15.result().setName("SketchProjection_16") SketchPoint_19 = SketchProjection_15.createdFeature() @@ -914,7 +1418,10 @@ SketchPoint_19.result().setName("SketchPoint_20") Sketch_7.setCoincident(SketchLine_63.endPoint(), SketchPoint_19.result()) ### Create SketchIntersectionPoint -SketchIntersectionPoint_13 = Sketch_7.addIntersectionPoint(model.selection("EDGE", (4.013585855638104, 4.013585855638103, 10.23944020672391)), True) +SketchIntersectionPoint_13 = Sketch_7.addIntersectionPoint( + model.selection("EDGE", (4.013585855638104, 4.013585855638103, 10.23944020672391)), + True, +) SketchIntersectionPoint_13.setName("SketchIntersectionPoint_14") SketchIntersectionPoint_13.result().setName("SketchIntersectionPoint_14") [SketchPoint_20] = SketchIntersectionPoint_13.intersectionPoints() @@ -922,7 +1429,9 @@ SketchPoint_20.setName("SketchPoint_21") SketchPoint_20.result().setName("SketchPoint_21") ### Create SketchIntersectionPoint -SketchIntersectionPoint_14 = Sketch_7.addIntersectionPoint(model.selection("EDGE", (4.300623443176582, 4.300623443176582, 9.532)), True) +SketchIntersectionPoint_14 = Sketch_7.addIntersectionPoint( + model.selection("EDGE", (4.300623443176582, 4.300623443176582, 9.532)), True +) SketchIntersectionPoint_14.setName("SketchIntersectionPoint_15") SketchIntersectionPoint_14.result().setName("SketchIntersectionPoint_15") [SketchPoint_21] = SketchIntersectionPoint_14.intersectionPoints() @@ -930,41 +1439,61 @@ SketchPoint_21.setName("SketchPoint_22") SketchPoint_21.result().setName("SketchPoint_22") ### Create SketchLine -SketchLine_64 = Sketch_7.addLine(5.644308024489205, -10.25641345263865, 6.15359600678713, -10.27430623369788) +SketchLine_64 = Sketch_7.addLine( + 5.644308024489205, -10.25641345263865, 6.15359600678713, -10.27430623369788 +) SketchLine_64.setName("SketchLine_67") SketchLine_64.result().setName("SketchLine_67") SketchLine_64.setAuxiliary(True) -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_20).coordinates(), SketchLine_64.startPoint()) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_20).coordinates(), SketchLine_64.startPoint() +) Sketch_7.setCoincident(SketchLine_63.endPoint(), SketchLine_64.endPoint()) ### Create SketchLine -SketchLine_65 = Sketch_7.addLine(6.15359600678713, -10.27430623369788, 6.052762716433288, -9.549982350617446) +SketchLine_65 = Sketch_7.addLine( + 6.15359600678713, -10.27430623369788, 6.052762716433288, -9.549982350617446 +) SketchLine_65.setName("SketchLine_68") SketchLine_65.result().setName("SketchLine_68") SketchLine_65.setAuxiliary(True) Sketch_7.setCoincident(SketchLine_63.endPoint(), SketchLine_65.startPoint()) -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_21).coordinates(), SketchLine_65.endPoint()) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_21).coordinates(), SketchLine_65.endPoint() +) ### Create SketchLine -SketchLine_66 = Sketch_7.addLine(5.644308024489205, -10.25641345263865, 6.052762716433288, -9.549982350617446) +SketchLine_66 = Sketch_7.addLine( + 5.644308024489205, -10.25641345263865, 6.052762716433288, -9.549982350617446 +) SketchLine_66.setName("SketchLine_69") SketchLine_66.result().setName("SketchLine_69") SketchLine_66.setAuxiliary(True) -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_20).coordinates(), SketchLine_66.startPoint()) -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_21).coordinates(), SketchLine_66.endPoint()) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_20).coordinates(), SketchLine_66.startPoint() +) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_21).coordinates(), SketchLine_66.endPoint() +) ### Create SketchLine -SketchLine_67 = Sketch_7.addLine(6.15359600678713, -10.27430623369788, 5.812047228248534, -9.966304921873915) +SketchLine_67 = Sketch_7.addLine( + 6.15359600678713, -10.27430623369788, 5.812047228248534, -9.966304921873915 +) SketchLine_67.setName("SketchLine_70") SketchLine_67.result().setName("SketchLine_70") Sketch_7.setCoincident(SketchLine_63.endPoint(), SketchLine_67.startPoint()) Sketch_7.setCoincident(SketchLine_67.endPoint(), SketchLine_66.result()) ### Create SketchConstraintAngle -Sketch_7.setAngle(SketchLine_67.result(), SketchLine_64.result(), "80.0626341144/2", type = "Direct") +Sketch_7.setAngle( + SketchLine_67.result(), SketchLine_64.result(), "80.0626341144/2", type="Direct" +) ### Create SketchIntersectionPoint -SketchIntersectionPoint_15 = Sketch_7.addIntersectionPoint(model.selection("EDGE", (4.375576761982357, 4.375576761982356, 9.028)), True) +SketchIntersectionPoint_15 = Sketch_7.addIntersectionPoint( + model.selection("EDGE", (4.375576761982357, 4.375576761982356, 9.028)), True +) SketchIntersectionPoint_15.setName("SketchIntersectionPoint_16") SketchIntersectionPoint_15.result().setName("SketchIntersectionPoint_16") [SketchPoint_22] = SketchIntersectionPoint_15.intersectionPoints() @@ -972,87 +1501,189 @@ SketchPoint_22.setName("SketchPoint_23") SketchPoint_22.result().setName("SketchPoint_23") ### Create SketchLine -SketchLine_68 = Sketch_7.addLine(6.348502432487296, -9.04671367200557, 6.160385566110681, -9.046221812193464) +SketchLine_68 = Sketch_7.addLine( + 6.348502432487296, -9.04671367200557, 6.160385566110681, -9.046221812193464 +) SketchLine_68.setName("SketchLine_71") SketchLine_68.result().setName("SketchLine_71") -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_18).coordinates(), SketchLine_68.startPoint()) -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_22).coordinates(), SketchLine_68.endPoint()) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_18).coordinates(), SketchLine_68.startPoint() +) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_22).coordinates(), SketchLine_68.endPoint() +) ### Create SketchLine -SketchLine_69 = Sketch_7.addLine(6.348502432487297, -9.046713672005572, 6.603839274138267, -9.303368522147153) +SketchLine_69 = Sketch_7.addLine( + 6.348502432487297, -9.046713672005572, 6.603839274138267, -9.303368522147153 +) SketchLine_69.setName("SketchLine_83") SketchLine_69.result().setName("SketchLine_83") -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_18).coordinates(), SketchLine_69.startPoint()) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_18).coordinates(), SketchLine_69.startPoint() +) ### Create SketchLine -SketchLine_70 = Sketch_7.addLine(6.603839274138267, -9.303368522147153, 6.603839274138267, -10.27548346237037) +SketchLine_70 = Sketch_7.addLine( + 6.603839274138267, -9.303368522147153, 6.603839274138267, -10.27548346237037 +) SketchLine_70.setName("SketchLine_85") SketchLine_70.result().setName("SketchLine_85") Sketch_7.setCoincident(SketchLine_69.endPoint(), SketchLine_70.startPoint()) Sketch_7.setVertical(SketchLine_70.result()) ### Create SketchLine -SketchLine_71 = Sketch_7.addLine(6.603839274138267, -10.27548346237037, 6.153596006787128, -10.27430623369788) +SketchLine_71 = Sketch_7.addLine( + 6.603839274138267, -10.27548346237037, 6.153596006787128, -10.27430623369788 +) SketchLine_71.setName("SketchLine_86") SketchLine_71.result().setName("SketchLine_86") Sketch_7.setCoincident(SketchLine_70.endPoint(), SketchLine_71.startPoint()) Sketch_7.setCoincident(SketchLine_63.endPoint(), SketchLine_71.endPoint()) -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_16).coordinates(), SketchLine_71.result()) -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_69.result()) -Sketch_7.setDistance(SketchAPI_Point(SketchPoint_16).coordinates(), SketchLine_70.result(), 0.1, True) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_16).coordinates(), SketchLine_71.result() +) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_69.result() +) +Sketch_7.setDistance( + SketchAPI_Point(SketchPoint_16).coordinates(), SketchLine_70.result(), 0.1, True +) model.do() ### Create Filling -Filling_2 = model.addFilling(Part_1_doc, [model.selection("EDGE", (5.836768269385303, 1.448742145032643, 10.10245863455805)), model.selection("EDGE", (4.731694417794685, 1.230193210543086, 10.89299420755799))]) +Filling_2 = model.addFilling( + Part_1_doc, + [ + model.selection( + "EDGE", (5.836768269385303, 1.448742145032643, 10.10245863455805) + ), + model.selection( + "EDGE", (4.731694417794685, 1.230193210543086, 10.89299420755799) + ), + ], +) ### Create Face -Face_2 = model.addFace(Part_1_doc, [model.selection("COMPOUND", (6.057217334424248, 1.494374437754447, 9.641999999999889))]) +Face_2 = model.addFace( + Part_1_doc, + [ + model.selection( + "COMPOUND", (6.057217334424248, 1.494374437754447, 9.641999999999889) + ) + ], +) ### Create Filling -Filling_3 = model.addFilling(Part_1_doc, [model.selection("EDGE", (6.10275292456776, 1.489939492847348, 9.027999999999889)), model.selection("EDGE_2", (5.836768269385303, 1.448742145032643, 10.10245863455805))]) +Filling_3 = model.addFilling( + Part_1_doc, + [ + model.selection( + "EDGE", (6.10275292456776, 1.489939492847348, 9.027999999999889) + ), + model.selection( + "EDGE_2", (5.836768269385303, 1.448742145032643, 10.10245863455805) + ), + ], +) ### Create Symmetry -Symmetry_4_objects = [model.selection("FACE", (4.404302746403579, 1.07007135572464, 11.07549385900559)), - model.selection("FACE", (5.284231343589994, 1.339467677787865, 10.49772642105802)), - model.selection("FACE", (5.969760596976531, 1.469340818939996, 9.565229317278968)), - model.selection("FACE", (6.224447172944647, 1.523053813239908, 9.642254784868452))] -Symmetry_4 = model.addSymmetry(Part_1_doc, Symmetry_4_objects, model.selection("FACE", "PartSet/YOZ"), keepOriginal = True, keepSubResults = True) +Symmetry_4_objects = [ + model.selection("FACE", (4.404302746403579, 1.07007135572464, 11.07549385900559)), + model.selection("FACE", (5.284231343589994, 1.339467677787865, 10.49772642105802)), + model.selection("FACE", (5.969760596976531, 1.469340818939996, 9.565229317278968)), + model.selection("FACE", (6.224447172944647, 1.523053813239908, 9.642254784868452)), +] +Symmetry_4 = model.addSymmetry( + Part_1_doc, + Symmetry_4_objects, + model.selection("FACE", "PartSet/YOZ"), + keepOriginal=True, + keepSubResults=True, +) ### Create Symmetry -Symmetry_5 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "all-in-Symmetry_4")], model.selection("FACE", "PartSet/XOZ"), keepOriginal = True, keepSubResults = True) +Symmetry_5 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Symmetry_4")], + model.selection("FACE", "PartSet/XOZ"), + keepOriginal=True, + keepSubResults=True, +) ### Create Revolution -Revolution_7_objects = [model.selection("EDGE_9", (5.836768269385303, 1.448742145032643, 10.10245863455805)), - model.selection("EDGE_5", (6.10275292456776, 1.489939492847348, 9.027999999999889)), - model.selection("EDGE", (6.099428606108299, 1.49717205955577, 9.641999999999889))] -Revolution_7 = model.addRevolution(Part_1_doc, Revolution_7_objects, model.selection("EDGE", "PartSet/OZ"), 360, 0) +Revolution_7_objects = [ + model.selection( + "EDGE_9", (5.836768269385303, 1.448742145032643, 10.10245863455805) + ), + model.selection("EDGE_5", (6.10275292456776, 1.489939492847348, 9.027999999999889)), + model.selection("EDGE", (6.099428606108299, 1.49717205955577, 9.641999999999889)), +] +Revolution_7 = model.addRevolution( + Part_1_doc, Revolution_7_objects, model.selection("EDGE", "PartSet/OZ"), 360, 0 +) ### Create Split -Split_2_objects_2 = [model.selection("COMPOUND", "all-in-Revolution_7"), - model.selection("COMPOUND", "all-in-Symmetry_5"), - model.selection("COMPOUND", "all-in-Revolution_6"), - model.selection("COMPOUND", "all-in-Symmetry_3")] -Split_2 = model.addSplit(Part_1_doc, [model.selection("COMPOUND", "all-in-Split_1")], Split_2_objects_2, keepSubResults = True) +Split_2_objects_2 = [ + model.selection("COMPOUND", "all-in-Revolution_7"), + model.selection("COMPOUND", "all-in-Symmetry_5"), + model.selection("COMPOUND", "all-in-Revolution_6"), + model.selection("COMPOUND", "all-in-Symmetry_3"), +] +Split_2 = model.addSplit( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Split_1")], + Split_2_objects_2, + keepSubResults=True, +) ### Create Revolution -Revolution_8 = model.addRevolution(Part_1_doc, [model.selection("EDGE_3", (3.8353530542367, 0.6452379374767312, 11.36897808323556)), model.selection("EDGE_5", (4.069856465567689, 0.9087626736223701, 11.24154228122667))], model.selection("EDGE", (1.641269250487042, 0, 7.083321183366995)), 360, 0) +Revolution_8 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "EDGE_3", (3.8353530542367, 0.6452379374767312, 11.36897808323556) + ), + model.selection( + "EDGE_5", (4.069856465567689, 0.9087626736223701, 11.24154228122667) + ), + ], + model.selection("EDGE", (1.641269250487042, 0, 7.083321183366995)), + 360, + 0, +) ### Create Symmetry -Symmetry_6 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "all-in-Revolution_8")], model.selection("FACE", "PartSet/YOZ"), keepOriginal = True, keepSubResults = True) +Symmetry_6 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Revolution_8")], + model.selection("FACE", "PartSet/YOZ"), + keepOriginal=True, + keepSubResults=True, +) ### Create Split -Split_3 = model.addSplit(Part_1_doc, [model.selection("COMPOUND", "all-in-Split_2")], [model.selection("COMPOUND", "all-in-Symmetry_6")], keepSubResults = True) +Split_3 = model.addSplit( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Split_2")], + [model.selection("COMPOUND", "all-in-Symmetry_6")], + keepSubResults=True, +) ### Create Sketch Sketch_8 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) ### Create SketchLine -SketchLine_72 = Sketch_8.addLine(5.126644475052088, 10.62934617154252, 5.215654385578071, 10.78090722433818) +SketchLine_72 = Sketch_8.addLine( + 5.126644475052088, 10.62934617154252, 5.215654385578071, 10.78090722433818 +) SketchLine_72.setName("SketchLine_74") SketchLine_72.result().setName("SketchLine_74") ### Create SketchLine -SketchLine_73 = Sketch_8.addLine(5.405090045827155, 10.43837553323928, 5.525091876190383, 10.61334472455802) +SketchLine_73 = Sketch_8.addLine( + 5.405090045827155, 10.43837553323928, 5.525091876190383, 10.61334472455802 +) SketchLine_73.setName("SketchLine_76") SketchLine_73.result().setName("SketchLine_76") @@ -1063,7 +1694,9 @@ SketchLine_74.result().setName("SketchLine_78") Sketch_8.setHorizontal(SketchLine_74.result()) ### Create SketchProjection -SketchProjection_16 = Sketch_8.addProjection(model.selection("EDGE", (0, 4.98107223752606, 10.71483892577093)), False) +SketchProjection_16 = Sketch_8.addProjection( + model.selection("EDGE", (0, 4.98107223752606, 10.71483892577093)), False +) SketchProjection_16.setName("SketchProjection_33") SketchProjection_16.result().setName("SketchProjection_33") SketchLine_75 = SketchProjection_16.createdFeature() @@ -1071,7 +1704,9 @@ SketchLine_75.setName("SketchLine_116") SketchLine_75.result().setName("SketchLine_116") ### Create SketchProjection -SketchProjection_17 = Sketch_8.addProjection(model.selection("EDGE", (0, 5.26586726043962, 10.5338608523909)), False) +SketchProjection_17 = Sketch_8.addProjection( + model.selection("EDGE", (0, 5.26586726043962, 10.5338608523909)), False +) SketchProjection_17.setName("SketchProjection_38") SketchProjection_17.result().setName("SketchProjection_38") SketchLine_76 = SketchProjection_17.createdFeature() @@ -1079,7 +1714,9 @@ SketchLine_76.setName("SketchLine_117") SketchLine_76.result().setName("SketchLine_117") ### Create SketchProjection -SketchProjection_18 = Sketch_8.addProjection(model.selection("EDGE", (0, 5.540578798309692, 10.33890786998159)), False) +SketchProjection_18 = Sketch_8.addProjection( + model.selection("EDGE", (0, 5.540578798309692, 10.33890786998159)), False +) SketchProjection_18.setName("SketchProjection_39") SketchProjection_18.result().setName("SketchProjection_39") SketchLine_77 = SketchProjection_18.createdFeature() @@ -1087,29 +1724,41 @@ SketchLine_77.setName("SketchLine_118") SketchLine_77.result().setName("SketchLine_118") ### Create SketchProjection -SketchProjection_19 = Sketch_8.addProjection(model.selection("EDGE", (0, 5.790750667181333, 10.12202136327199)), False) +SketchProjection_19 = Sketch_8.addProjection( + model.selection("EDGE", (0, 5.790750667181333, 10.12202136327199)), False +) SketchProjection_19.setName("SketchProjection_40") SketchProjection_19.result().setName("SketchProjection_40") SketchBSpline_1 = SketchProjection_19.createdFeature() ### Create SketchProjection -SketchProjection_20 = Sketch_8.addProjection(model.selection("EDGE", (0, 6.534999999999997, 9.721499999999999)), False) +SketchProjection_20 = Sketch_8.addProjection( + model.selection("EDGE", (0, 6.534999999999997, 9.721499999999999)), False +) SketchProjection_20.setName("SketchProjection_41") SketchProjection_20.result().setName("SketchProjection_41") SketchLine_78 = SketchProjection_20.createdFeature() SketchLine_78.setName("SketchLine_119") SketchLine_78.result().setName("SketchLine_119") Sketch_8.setCoincident(SketchLine_74.endPoint(), SketchLine_78.result()) -Sketch_8.setCoincident(SketchLine_74.startPoint(), SketchAPI_BSpline(SketchBSpline_1).startPoint()) +Sketch_8.setCoincident( + SketchLine_74.startPoint(), SketchAPI_BSpline(SketchBSpline_1).startPoint() +) ### Create SketchLine -SketchLine_79 = Sketch_8.addLine(5.676067550792231, 10.23944020672391, 5.829536340268943, 10.44848598250872) +SketchLine_79 = Sketch_8.addLine( + 5.676067550792231, 10.23944020672391, 5.829536340268943, 10.44848598250872 +) SketchLine_79.setName("SketchLine_120") SketchLine_79.result().setName("SketchLine_120") -Sketch_8.setCoincident(SketchAPI_Line(SketchLine_77).endPoint(), SketchLine_79.startPoint()) +Sketch_8.setCoincident( + SketchAPI_Line(SketchLine_77).endPoint(), SketchLine_79.startPoint() +) ### Create SketchProjection -SketchProjection_21 = Sketch_8.addProjection(model.selection("EDGE", (0, 5.551250000000013, 10.59917992310999)), False) +SketchProjection_21 = Sketch_8.addProjection( + model.selection("EDGE", (0, 5.551250000000013, 10.59917992310999)), False +) SketchProjection_21.setName("SketchProjection_42") SketchProjection_21.result().setName("SketchProjection_42") SketchLine_80 = SketchProjection_21.createdFeature() @@ -1119,28 +1768,50 @@ Sketch_8.setCoincident(SketchLine_79.endPoint(), SketchLine_80.result()) Sketch_8.setPerpendicular(SketchLine_79.result(), SketchLine_77.result()) Sketch_8.setPerpendicular(SketchLine_73.result(), SketchLine_76.result()) Sketch_8.setPerpendicular(SketchLine_72.result(), SketchLine_75.result()) -Sketch_8.setCoincident(SketchLine_73.startPoint(), SketchAPI_Line(SketchLine_76).endPoint()) -Sketch_8.setCoincident(SketchLine_72.startPoint(), SketchAPI_Line(SketchLine_75).endPoint()) +Sketch_8.setCoincident( + SketchLine_73.startPoint(), SketchAPI_Line(SketchLine_76).endPoint() +) +Sketch_8.setCoincident( + SketchLine_72.startPoint(), SketchAPI_Line(SketchLine_75).endPoint() +) Sketch_8.setCoincident(SketchLine_72.endPoint(), SketchLine_80.result()) Sketch_8.setCoincident(SketchLine_73.endPoint(), SketchLine_80.result()) model.do() ### Create Revolution -Revolution_9 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", (0, 5.830822237526045, 10.15645361216909))], model.selection("EDGE", "PartSet/OZ"), 360, 0, "Edges") +Revolution_9 = model.addRevolution( + Part_1_doc, + [model.selection("COMPOUND", (0, 5.830822237526045, 10.15645361216909))], + model.selection("EDGE", "PartSet/OZ"), + 360, + 0, + "Edges", +) ### Create Split -Split_4 = model.addSplit(Part_1_doc, [model.selection("COMPOUND", "all-in-Split_3")], [model.selection("COMPOUND", "all-in-Revolution_9")], keepSubResults = True) +Split_4 = model.addSplit( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Split_3")], + [model.selection("COMPOUND", "all-in-Revolution_9")], + keepSubResults=True, +) ### Create Sketch -Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", (-3.890999999999999, 3.891, -6.45))) +Sketch_9 = model.addSketch( + Part_1_doc, model.selection("FACE", (-3.890999999999999, 3.891, -6.45)) +) ### Create SketchLine -SketchLine_81 = Sketch_9.addLine(5.502704971193711, -5.502704971193713, 3.192087844797337, -3.192087844797337) +SketchLine_81 = Sketch_9.addLine( + 5.502704971193711, -5.502704971193713, 3.192087844797337, -3.192087844797337 +) SketchLine_81.setName("SketchLine_87") SketchLine_81.result().setName("SketchLine_87") ### Create SketchProjection -SketchProjection_22 = Sketch_9.addProjection(model.selection("EDGE", (5.502704971193713, 5.502704971193712, -6.45)), False) +SketchProjection_22 = Sketch_9.addProjection( + model.selection("EDGE", (5.502704971193713, 5.502704971193712, -6.45)), False +) SketchProjection_22.setName("SketchProjection_26") SketchProjection_22.result().setName("SketchProjection_26") SketchArc_13 = SketchProjection_22.createdFeature() @@ -1153,7 +1824,9 @@ SketchLine_82.result().setName("SketchLine_88") Sketch_9.setCoincident(SketchLine_81.endPoint(), SketchLine_82.startPoint()) ### Create SketchProjection -SketchProjection_23 = Sketch_9.addProjection(model.selection("EDGE", (3.891, 0, -6.45)), False) +SketchProjection_23 = Sketch_9.addProjection( + model.selection("EDGE", (3.891, 0, -6.45)), False +) SketchProjection_23.setName("SketchProjection_27") SketchProjection_23.result().setName("SketchProjection_27") SketchLine_83 = SketchProjection_23.createdFeature() @@ -1168,7 +1841,9 @@ SketchLine_84.result().setName("SketchLine_90") Sketch_9.setCoincident(SketchLine_81.endPoint(), SketchLine_84.startPoint()) ### Create SketchProjection -SketchProjection_24 = Sketch_9.addProjection(model.selection("EDGE", (0, 3.891, -6.45)), False) +SketchProjection_24 = Sketch_9.addProjection( + model.selection("EDGE", (0, 3.891, -6.45)), False +) SketchProjection_24.setName("SketchProjection_28") SketchProjection_24.result().setName("SketchProjection_28") SketchLine_85 = SketchProjection_24.createdFeature() @@ -1182,9 +1857,29 @@ Sketch_9.setMiddlePoint(SketchLine_82.endPoint(), SketchLine_83.result()) Sketch_9.setMiddlePoint(SketchLine_81.startPoint(), SketchArc_13.results()[1]) ### Create SketchMultiRotation -SketchMultiRotation_1_objects = [SketchLine_81.result(), SketchLine_84.result(), SketchLine_82.result()] -SketchMultiRotation_1 = Sketch_9.addRotation(SketchMultiRotation_1_objects, SketchAPI_Line(SketchLine_83).endPoint(), 360, 4, True) -[SketchLine_86, SketchLine_87, SketchLine_88, SketchLine_89, SketchLine_90, SketchLine_91, SketchLine_92, SketchLine_93, SketchLine_94] = SketchMultiRotation_1.rotatedList() +SketchMultiRotation_1_objects = [ + SketchLine_81.result(), + SketchLine_84.result(), + SketchLine_82.result(), +] +SketchMultiRotation_1 = Sketch_9.addRotation( + SketchMultiRotation_1_objects, + SketchAPI_Line(SketchLine_83).endPoint(), + 360, + 4, + True, +) +[ + SketchLine_86, + SketchLine_87, + SketchLine_88, + SketchLine_89, + SketchLine_90, + SketchLine_91, + SketchLine_92, + SketchLine_93, + SketchLine_94, +] = SketchMultiRotation_1.rotatedList() SketchLine_94.setName("SketchLine_100") SketchLine_94.result().setName("SketchLine_100") SketchLine_93.setName("SketchLine_99") @@ -1206,19 +1901,47 @@ SketchLine_86.result().setName("SketchLine_92") model.do() ### Create Extrusion -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", (0, 0, -6.45))], model.selection(), model.selection("FACE", (3.094, 3.094, -3.45)), 0, model.selection(), 0, "Edges") +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", (0, 0, -6.45))], + model.selection(), + model.selection("FACE", (3.094, 3.094, -3.45)), + 0, + model.selection(), + 0, + "Edges", +) ### Create Plane -Plane_8 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OZ"), model.selection("VERTEX", (-6.194859104310897, -1.509005194735372, 9.02799999999989)), False) +Plane_8 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "PartSet/OZ"), + model.selection( + "VERTEX", (-6.194859104310897, -1.509005194735372, 9.02799999999989) + ), + False, +) ### Create Split -Split_5 = model.addSplit(Part_1_doc, [model.selection("COMPOUND", "all-in-Split_4")], [model.selection("COMPOUND", "all-in-Extrusion_3")], keepSubResults = True) +Split_5 = model.addSplit( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Split_4")], + [model.selection("COMPOUND", "all-in-Extrusion_3")], + keepSubResults=True, +) ### Create Sketch -Sketch_10 = model.addSketch(Part_1_doc, model.selection("FACE", (-3.097429552155449, -0.754502597367686, 50))) +Sketch_10 = model.addSketch( + Part_1_doc, model.selection("FACE", (-3.097429552155449, -0.754502597367686, 50)) +) ### Create SketchProjection -SketchProjection_25 = Sketch_10.addProjection(model.selection("VERTEX", (-6.194859104310897, -1.509005194735372, 9.02799999999989)), False) +SketchProjection_25 = Sketch_10.addProjection( + model.selection( + "VERTEX", (-6.194859104310897, -1.509005194735372, 9.02799999999989) + ), + False, +) SketchProjection_25.setName("SketchProjection_35") SketchProjection_25.result().setName("SketchProjection_35") SketchPoint_23 = SketchProjection_25.createdFeature() @@ -1236,7 +1959,9 @@ SketchLine_96.setName("SketchLine_108") SketchLine_96.result().setName("SketchLine_108") ### Create SketchIntersectionPoint -SketchIntersectionPoint_16 = Sketch_10.addIntersectionPoint(model.selection("EDGE", (-7.189630522002833, -2.978042470665128, -3.45)), True) +SketchIntersectionPoint_16 = Sketch_10.addIntersectionPoint( + model.selection("EDGE", (-7.189630522002833, -2.978042470665128, -3.45)), True +) SketchIntersectionPoint_16.setName("SketchIntersectionPoint_17") SketchIntersectionPoint_16.result().setName("SketchIntersectionPoint_17") [SketchPoint_24] = SketchIntersectionPoint_16.intersectionPoints() @@ -1244,17 +1969,25 @@ SketchPoint_24.setName("SketchPoint_25") SketchPoint_24.result().setName("SketchPoint_25") ### Create SketchIntersectionPoint -SketchIntersectionPoint_17 = Sketch_10.addIntersectionPoint(model.selection("EDGE", (-3.541543922398668, -1.596043922398668, -3.45)), True) +SketchIntersectionPoint_17 = Sketch_10.addIntersectionPoint( + model.selection("EDGE", (-3.541543922398668, -1.596043922398668, -3.45)), True +) SketchIntersectionPoint_17.setName("SketchIntersectionPoint_18") SketchIntersectionPoint_17.result().setName("SketchIntersectionPoint_18") [SketchPoint_25] = SketchIntersectionPoint_17.intersectionPoints() SketchPoint_25.setName("SketchPoint_26") SketchPoint_25.result().setName("SketchPoint_26") -Sketch_10.setCoincident(SketchLine_95.startPoint(), SketchAPI_Point(SketchPoint_24).coordinates()) -Sketch_10.setCoincident(SketchLine_95.endPoint(), SketchAPI_Point(SketchPoint_25).coordinates()) +Sketch_10.setCoincident( + SketchLine_95.startPoint(), SketchAPI_Point(SketchPoint_24).coordinates() +) +Sketch_10.setCoincident( + SketchLine_95.endPoint(), SketchAPI_Point(SketchPoint_25).coordinates() +) ### Create SketchIntersectionPoint -SketchIntersectionPoint_18 = Sketch_10.addIntersectionPoint(model.selection("EDGE", (-6.04032438355878, -2.501984280802992, -3.45)), True) +SketchIntersectionPoint_18 = Sketch_10.addIntersectionPoint( + model.selection("EDGE", (-6.04032438355878, -2.501984280802992, -3.45)), True +) SketchIntersectionPoint_18.setName("SketchIntersectionPoint_19") SketchIntersectionPoint_18.result().setName("SketchIntersectionPoint_19") [SketchPoint_26] = SketchIntersectionPoint_18.intersectionPoints() @@ -1262,33 +1995,59 @@ SketchPoint_26.setName("SketchPoint_28") SketchPoint_26.result().setName("SketchPoint_28") ### Create SketchIntersectionPoint -SketchIntersectionPoint_19 = Sketch_10.addIntersectionPoint(model.selection("EDGE", (-5.716966547179859, -2.368045079475137, -3.45)), True) +SketchIntersectionPoint_19 = Sketch_10.addIntersectionPoint( + model.selection("EDGE", (-5.716966547179859, -2.368045079475137, -3.45)), True +) SketchIntersectionPoint_19.setName("SketchIntersectionPoint_20") SketchIntersectionPoint_19.result().setName("SketchIntersectionPoint_20") [SketchPoint_27] = SketchIntersectionPoint_19.intersectionPoints() SketchPoint_27.setName("SketchPoint_29") SketchPoint_27.result().setName("SketchPoint_29") -Sketch_10.setCoincident(SketchAPI_Point(SketchPoint_26).coordinates(), SketchLine_96.endPoint()) -Sketch_10.setCoincident(SketchAPI_Point(SketchPoint_27).coordinates(), SketchLine_96.startPoint()) +Sketch_10.setCoincident( + SketchAPI_Point(SketchPoint_26).coordinates(), SketchLine_96.endPoint() +) +Sketch_10.setCoincident( + SketchAPI_Point(SketchPoint_27).coordinates(), SketchLine_96.startPoint() +) model.do() Sketch_10.result().setName("Sketch_10_Copy") ### Create Filling -Filling_4 = model.addFilling(Part_1_doc, [model.selection("EDGE", (-6.182228431732952, -1.505928490291867, -3.45)), model.selection("EDGE", (-6.10275292456776, -1.489939492847349, 9.027999999999889))]) +Filling_4 = model.addFilling( + Part_1_doc, + [ + model.selection("EDGE", (-6.182228431732952, -1.505928490291867, -3.45)), + model.selection( + "EDGE", (-6.10275292456776, -1.489939492847349, 9.027999999999889) + ), + ], +) ### Create Extrusion -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", (-5.627449338075726, -1.370789898733462, -3.45))], model.selection("EDGE", "PartSet/OZ"), model.selection("FACE", (-5.487043922398668, -2.751352485596856, -6.45)), 0, model.selection(), 0) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [model.selection("EDGE", (-5.627449338075726, -1.370789898733462, -3.45))], + model.selection("EDGE", "PartSet/OZ"), + model.selection("FACE", (-5.487043922398668, -2.751352485596856, -6.45)), + 0, + model.selection(), + 0, +) ### Create Sketch Sketch_11 = model.addSketch(Part_1_doc, model.selection("FACE", (0, 0, -6.45))) ### Create SketchLine -SketchLine_97 = Sketch_11.addLine(-3.693983753048041, 0.8998171836933224, 0, 1.098155695798001) +SketchLine_97 = Sketch_11.addLine( + -3.693983753048041, 0.8998171836933224, 0, 1.098155695798001 +) SketchLine_97.setName("SketchLine_111") SketchLine_97.result().setName("SketchLine_111") ### Create SketchProjection -SketchProjection_26 = Sketch_11.addProjection(model.selection("VERTEX", (-3.693983753041943, -0.8998171836917707, -6.45)), False) +SketchProjection_26 = Sketch_11.addProjection( + model.selection("VERTEX", (-3.693983753041943, -0.8998171836917707, -6.45)), False +) SketchProjection_26.setName("SketchProjection_34") SketchProjection_26.result().setName("SketchProjection_34") SketchPoint_28 = SketchProjection_26.createdFeature() @@ -1297,30 +2056,67 @@ SketchPoint_28.result().setName("SketchPoint_30") Sketch_11.setCoincident(SketchLine_97.startPoint(), SketchPoint_28.result()) ### Create SketchProjection -SketchProjection_27 = Sketch_11.addProjection(model.selection("EDGE", (0, -1.9455, -6.45)), False) +SketchProjection_27 = Sketch_11.addProjection( + model.selection("EDGE", (0, -1.9455, -6.45)), False +) SketchProjection_27.setName("SketchProjection_29") SketchProjection_27.result().setName("SketchProjection_29") SketchLine_98 = SketchProjection_27.createdFeature() SketchLine_98.setName("SketchLine_101") SketchLine_98.result().setName("SketchLine_101") Sketch_11.setCoincident(SketchLine_97.endPoint(), SketchLine_98.result()) -Sketch_11.setDistance(SketchAPI_Line(SketchLine_98).startPoint(), SketchLine_97.result(), "0.921*3.891/3.268", True) +Sketch_11.setDistance( + SketchAPI_Line(SketchLine_98).startPoint(), + SketchLine_97.result(), + "0.921*3.891/3.268", + True, +) model.do() ### Create Extrusion -Extrusion_5 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", (-1.846991876524021, -0.9989864397456618, -6.45))], model.selection("EDGE", "PartSet/OZ"), model.selection("FACE", (-1.9455, -1.9455, -3.45)), 0, model.selection(), 0, "Edges") +Extrusion_5 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", (-1.846991876524021, -0.9989864397456618, -6.45))], + model.selection("EDGE", "PartSet/OZ"), + model.selection("FACE", (-1.9455, -1.9455, -3.45)), + 0, + model.selection(), + 0, + "Edges", +) ### Create Symmetry -Symmetry_7_objects = [model.selection("FACE", (-1.846991876524021, -0.9989864397456617, -4.95)), - model.selection("FACE", (-5.627449338075726, -1.370789898733462, -4.95)), - model.selection("FACE", (-6.142490678150356, -1.497933991569608, 2.788999999999944))] -Symmetry_7 = model.addSymmetry(Part_1_doc, Symmetry_7_objects, model.selection("FACE", "PartSet/YOZ"), keepOriginal = True, keepSubResults = True) +Symmetry_7_objects = [ + model.selection("FACE", (-1.846991876524021, -0.9989864397456617, -4.95)), + model.selection("FACE", (-5.627449338075726, -1.370789898733462, -4.95)), + model.selection( + "FACE", (-6.142490678150356, -1.497933991569608, 2.788999999999944) + ), +] +Symmetry_7 = model.addSymmetry( + Part_1_doc, + Symmetry_7_objects, + model.selection("FACE", "PartSet/YOZ"), + keepOriginal=True, + keepSubResults=True, +) ### Create Symmetry -Symmetry_8 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "all-in-Symmetry_7")], model.selection("FACE", "PartSet/XOZ"), keepOriginal = True, keepSubResults = True) +Symmetry_8 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Symmetry_7")], + model.selection("FACE", "PartSet/XOZ"), + keepOriginal=True, + keepSubResults=True, +) ### Create Split -Split_6 = model.addSplit(Part_1_doc, [model.selection("COMPOUND", "all-in-Split_5")], [model.selection("COMPOUND", "all-in-Symmetry_8")], keepSubResults = True) +Split_6 = model.addSplit( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Split_5")], + [model.selection("COMPOUND", "all-in-Symmetry_8")], + keepSubResults=True, +) model.end() @@ -1334,4 +2130,4 @@ model.testNbSubShapes(Split_6, GeomAPI_Shape.EDGE, [3636]) model.testNbSubShapes(Split_6, GeomAPI_Shape.VERTEX, [7272]) model.testResultsVolumes(Split_6, [612.72746616262998]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test20247.py b/src/FeaturesPlugin/Test/Test20247.py index b4e23f5e6..5535471c0 100644 --- a/src/FeaturesPlugin/Test/Test20247.py +++ b/src/FeaturesPlugin/Test/Test20247.py @@ -30,10 +30,20 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Translation -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], vector = [200, 100, 0], keepSubResults = True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + vector=[200, 100, 0], + keepSubResults=True, +) ### Create Plane -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), 3, False) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), + 3, + False, +) ### Create Sketch Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) @@ -43,7 +53,16 @@ SketchCircle_1 = Sketch_1.addCircle(205, 105, 3) model.do() ### Create Extrusion -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), 0, model.selection(), 0, "Faces|Wires") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), + 0, + model.selection(), + 0, + "Faces|Wires", +) model.end() @@ -57,4 +76,4 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Extrusion_1, [84.823001647]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2038.py b/src/FeaturesPlugin/Test/Test2038.py index 3b72d3882..bacee7e40 100644 --- a/src/FeaturesPlugin/Test/Test2038.py +++ b/src/FeaturesPlugin/Test/Test2038.py @@ -24,24 +24,133 @@ 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(-379.073756432247, 108.9193825042881, -672.3842195540308, -33.44768439108059) -SketchLine_2 = Sketch_1.addLine(-672.3842195540308, -33.44768439108059, -360.2058319039451, -146.6552315608919) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(-360.2058319039451, -146.6552315608919, -78.9022298456261, -14.57975986277871) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-78.9022298456261, -14.57975986277871, -379.073756432247, 108.9193825042881) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint()) -SketchLine_5 = Sketch_1.addLine(-379.073756432247, 108.9193825042881, -360.2058319039451, -146.6552315608919) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_5.endPoint()) +SketchLine_1 = Sketch_1.addLine( + -379.073756432247, 108.9193825042881, -672.3842195540308, -33.44768439108059 +) +SketchLine_2 = Sketch_1.addLine( + -672.3842195540308, -33.44768439108059, -360.2058319039451, -146.6552315608919 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + -360.2058319039451, -146.6552315608919, -78.9022298456261, -14.57975986277871 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -78.9022298456261, -14.57975986277871, -379.073756432247, 108.9193825042881 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_4.endPoint() +) +SketchLine_5 = Sketch_1.addLine( + -379.073756432247, 108.9193825042881, -360.2058319039451, -146.6552315608919 +) +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_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_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")] +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_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() @@ -49,8 +158,8 @@ model.end() groupFeature = Group_1.feature() groupSelectionList = groupFeature.selectionList("group_list") for index in range(0, groupSelectionList.size()): - attrSelection = groupSelectionList.value(index) - shape = attrSelection.value() - name = attrSelection.namingName() - assert(shape.isFace()) - assert(name != ""), "Empty shape name" + attrSelection = groupSelectionList.value(index) + shape = attrSelection.value() + name = attrSelection.namingName() + assert shape.isFace() + assert name != "", "Empty shape name" diff --git a/src/FeaturesPlugin/Test/Test2046.py b/src/FeaturesPlugin/Test/Test2046.py index 58eb744fe..91648c4f2 100644 --- a/src/FeaturesPlugin/Test/Test2046.py +++ b/src/FeaturesPlugin/Test/Test2046.py @@ -22,28 +22,54 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(-1154.716981132076, -199.5283018867925, -849.0566037735849, 128.7735849056603) -SketchLine_2 = Sketch_1.addLine(-849.0566037735849, 128.7735849056603, -563.2075471698113, -69.33962264150945) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(-563.2075471698113, -69.33962264150945, -70.75471698113215, 326.8867924528301) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_1 = Sketch_1.addLine( + -1154.716981132076, -199.5283018867925, -849.0566037735849, 128.7735849056603 +) +SketchLine_2 = Sketch_1.addLine( + -849.0566037735849, 128.7735849056603, -563.2075471698113, -69.33962264150945 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + -563.2075471698113, -69.33962264150945, -70.75471698113215, 326.8867924528301 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) model.do() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -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_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_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")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 100, 0 +) +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() groupFeature = Group_1.feature() groupSelectionList = groupFeature.selectionList("group_list") -assert(groupSelectionList.size() == 3) +assert groupSelectionList.size() == 3 for index in range(0, groupSelectionList.size()): - attrSelection = groupSelectionList.value(index) - shape = attrSelection.value() - name = attrSelection.namingName() - assert(shape.isFace()) - assert(name != ""), "Empty shape name" + attrSelection = groupSelectionList.value(index) + shape = attrSelection.value() + name = attrSelection.namingName() + assert shape.isFace() + assert name != "", "Empty shape name" diff --git a/src/FeaturesPlugin/Test/Test2172.py b/src/FeaturesPlugin/Test/Test2172.py index d16324975..1eb260dc0 100644 --- a/src/FeaturesPlugin/Test/Test2172.py +++ b/src/FeaturesPlugin/Test/Test2172.py @@ -24,20 +24,54 @@ partSet = model.moduleDocument() 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(-85.62958302127123, 51.64856737222455, 159.4430553521271, 401.6485673722245) -SketchLine_2 = Sketch_1.addLine(159.4430553521271, 401.6485673722245, 909.4430553521272, 401.6485673722245) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(909.4430553521272, 401.6485673722245, 909.4430553521272, -98.35143262777548) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(909.4430553521272, -98.35143262777548, 551.916977573864, -398.3514326277755) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(551.916977573864, -398.3514326277755, -18.08302242613596, -398.3514326277755) -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-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()) +SketchLine_1 = Sketch_1.addLine( + -85.62958302127123, 51.64856737222455, 159.4430553521271, 401.6485673722245 +) +SketchLine_2 = Sketch_1.addLine( + 159.4430553521271, 401.6485673722245, 909.4430553521272, 401.6485673722245 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 909.4430553521272, 401.6485673722245, 909.4430553521272, -98.35143262777548 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + 909.4430553521272, -98.35143262777548, 551.916977573864, -398.3514326277755 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 551.916977573864, -398.3514326277755, -18.08302242613596, -398.3514326277755 +) +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-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()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) @@ -46,45 +80,134 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 100) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 750) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_3.result(), 500) 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) +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, False) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_4.startPoint(), SketchLine_5.result(), 300, False) +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()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchPoint_1.coordinates() +) SketchCircle_1 = Sketch_1.addCircle(623.3624504738834, 247.4315530304268, 75) SketchCircle_2 = Sketch_1.addCircle(267.9975824521076, 55.86558171402226, 100) -SketchLine_7 = Sketch_1.addLine(-18.08302242613596, -98.35143262777552, 356.0223839531057, 103.3169707422677) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchLine_8 = Sketch_1.addLine(557.3438493481349, 211.8430112592427, 909.4430553521272, 401.6485673722245) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_8.endPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchLine_7.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_7.result()) +SketchLine_7 = Sketch_1.addLine( + -18.08302242613596, -98.35143262777552, 356.0223839531057, 103.3169707422677 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchLine_8 = Sketch_1.addLine( + 557.3438493481349, 211.8430112592427, 909.4430553521272, 401.6485673722245 +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_8.endPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchCircle_2.center(), SketchLine_7.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_7.result() +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchCircle_2.results()[1], 100) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchCircle_1.results()[1], 75) 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, 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, False) +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, 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, 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-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]")] +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-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 from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) -assert(Group_1.groupList().size() == 10) +assert aFactory.validate(Group_1.feature()) +assert Group_1.groupList().size() == 10 for a in range(10): - assert(Group_1.groupList().value(a).value().shapeTypeStr() == "EDGE") - assert(len(Group_1.groupList().value(a).namingName()) > 0) + assert Group_1.groupList().value(a).value().shapeTypeStr() == "EDGE" + assert len(Group_1.groupList().value(a).namingName()) > 0 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2194.py b/src/FeaturesPlugin/Test/Test2194.py index 1f245dbc2..9b97ce0a3 100644 --- a/src/FeaturesPlugin/Test/Test2194.py +++ b/src/FeaturesPlugin/Test/Test2194.py @@ -24,28 +24,71 @@ 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(-79.57211859899775, 93.0358363165245, 69.46562387481423) +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_2r")], model.selection(), 10, 0) +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) +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_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)_Smash_1_1_1"), 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")] +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)_Smash_1_1_1", + ), + 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() groupFeature = Group_1.feature() groupSelectionList = groupFeature.selectionList("group_list") -assert(groupSelectionList.size() == 11) +assert groupSelectionList.size() == 11 for index in range(0, groupSelectionList.size()): - attrSelection = groupSelectionList.value(index) - shape = attrSelection.value() - name = attrSelection.namingName() - assert(shape.isFace()) - assert(name != ""), "Empty shape name" + attrSelection = groupSelectionList.value(index) + shape = attrSelection.value() + name = attrSelection.namingName() + assert shape.isFace() + assert name != "", "Empty shape name" -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2197_1.py b/src/FeaturesPlugin/Test/Test2197_1.py index faa0f8acc..01a42cc86 100644 --- a/src/FeaturesPlugin/Test/Test2197_1.py +++ b/src/FeaturesPlugin/Test/Test2197_1.py @@ -27,21 +27,58 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) 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]")] +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_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() model.end() # check that resulting group selection is valid from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() for aGroupIter in [Group_1, Group_2]: - assert(aFactory.validate(aGroupIter.feature())) - assert(aGroupIter.groupList().size() == 3) - for a in range(3): - assert(aGroupIter.groupList().value(a).value().shapeTypeStr() == "EDGE") + assert aFactory.validate(aGroupIter.feature()) + assert aGroupIter.groupList().size() == 3 + for a in range(3): + assert aGroupIter.groupList().value(a).value().shapeTypeStr() == "EDGE" -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2197_2.py b/src/FeaturesPlugin/Test/Test2197_2.py index 876e390a9..93f841e72 100644 --- a/src/FeaturesPlugin/Test/Test2197_2.py +++ b/src/FeaturesPlugin/Test/Test2197_2.py @@ -26,23 +26,55 @@ 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/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/Generated_Face&Sketch_1/SketchCircle_1_2][weak_name_1]")]) -Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][weak_name_2]")]) -Group_3 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/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/Generated_Face&Sketch_1/SketchCircle_1_2][weak_name_1]", + ) + ], +) +Group_2 = model.addGroup( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][weak_name_2]", + ) + ], +) +Group_3 = model.addGroup( + Part_1_doc, + [ + model.selection( + "VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_1_2]" + ) + ], +) model.do() model.end() # check that resulting group selection is valid from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() for aGroupIter in [Group_1, Group_2, Group_3]: - assert(aFactory.validate(aGroupIter.feature())) - assert(aGroupIter.groupList().size() == 1) - if aGroupIter == Group_3: - assert(aGroupIter.groupList().value(0).value().shapeTypeStr() == "VERTEX") - else: - assert(aGroupIter.groupList().value(0).value().shapeTypeStr() == "EDGE") + assert aFactory.validate(aGroupIter.feature()) + assert aGroupIter.groupList().size() == 1 + if aGroupIter == Group_3: + assert aGroupIter.groupList().value(0).value().shapeTypeStr() == "VERTEX" + else: + assert aGroupIter.groupList().value(0).value().shapeTypeStr() == "EDGE" -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2197_3.py b/src/FeaturesPlugin/Test/Test2197_3.py index b429497ce..61ff3ed51 100644 --- a/src/FeaturesPlugin/Test/Test2197_3.py +++ b/src/FeaturesPlugin/Test/Test2197_3.py @@ -28,26 +28,67 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(138, 47, 265, 35) SketchLine_2 = Sketch_1.addLine(265, 35, 248, 186) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(248, 186, 138, 234) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) 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()) +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_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][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])2"), 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_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2])2")] +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][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])2", + ), + 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_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2])2", + ), +] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) model.do() model.end() # check that resulting group selection is valid from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) -assert(Group_1.groupList().size() == 5) +assert aFactory.validate(Group_1.feature()) +assert Group_1.groupList().size() == 5 for a in range(5): - assert(Group_1.groupList().value(a).value().shapeTypeStr() == "EDGE") - assert(len(Group_1.groupList().value(a).namingName()) > 0) + assert Group_1.groupList().value(a).value().shapeTypeStr() == "EDGE" + assert len(Group_1.groupList().value(a).namingName()) > 0 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2197_4.py b/src/FeaturesPlugin/Test/Test2197_4.py index cb8d2cb05..e1474420e 100644 --- a/src/FeaturesPlugin/Test/Test2197_4.py +++ b/src/FeaturesPlugin/Test/Test2197_4.py @@ -26,43 +26,104 @@ partSet = model.moduleDocument() 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(138.1074168797953, 47.3145780051151, 265.9846547314579, 35.80562659846547) -SketchLine_2 = Sketch_1.addLine(248.0818414322251, 186.7007672634271, 138.1074168797954, 234.0153452685422) +SketchLine_1 = Sketch_1.addLine( + 138.1074168797953, 47.3145780051151, 265.9846547314579, 35.80562659846547 +) +SketchLine_2 = Sketch_1.addLine( + 248.0818414322251, 186.7007672634271, 138.1074168797954, 234.0153452685422 +) SketchLine_2.setName("SketchLine_3") SketchLine_2.result().setName("SketchLine_3") -SketchLine_3 = Sketch_1.addLine(138.1074168797954, 234.0153452685422, 138.1074168797953, 47.3145780051151) +SketchLine_3 = Sketch_1.addLine( + 138.1074168797954, 234.0153452685422, 138.1074168797953, 47.3145780051151 +) SketchLine_3.setName("SketchLine_4") SketchLine_3.result().setName("SketchLine_4") -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_3") -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_4") -SketchLine_4 = Sketch_1.addLine(248.0818414322251, 186.7007672634271, 215.8394027534853, 111.2328618876045) +SketchLine_4 = Sketch_1.addLine( + 248.0818414322251, 186.7007672634271, 215.8394027534853, 111.2328618876045 +) SketchLine_4.setName("SketchLine_5") SketchLine_4.result().setName("SketchLine_5") -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_5") -SketchLine_5 = Sketch_1.addLine(215.8394027534853, 111.2328618876045, 265.9846547314579, 35.80562659846547) +SketchLine_5 = Sketch_1.addLine( + 215.8394027534853, 111.2328618876045, 265.9846547314579, 35.80562659846547 +) SketchLine_5.setName("SketchLine_6") SketchLine_5.result().setName("SketchLine_6") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_6") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.endPoint()) +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_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_5][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5])2"), 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])2"), 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])")] +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_5][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5])2", + ), + 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])2", + ), + 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 from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) -assert(Group_1.groupList().size() == 7) +assert aFactory.validate(Group_1.feature()) +assert Group_1.groupList().size() == 7 for a in range(7): - assert(Group_1.groupList().value(a).value().shapeTypeStr() == "EDGE") - assert(len(Group_1.groupList().value(a).namingName()) > 0) + assert Group_1.groupList().value(a).value().shapeTypeStr() == "EDGE" + assert len(Group_1.groupList().value(a).namingName()) > 0 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2215.py b/src/FeaturesPlugin/Test/Test2215.py index d836d1bc3..dc3a3b385 100644 --- a/src/FeaturesPlugin/Test/Test2215.py +++ b/src/FeaturesPlugin/Test/Test2215.py @@ -26,58 +26,138 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 0, 50) SketchLine_2 = Sketch_1.addLine(0, 50, 50, 50) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(50, 50, 50, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(50, 0, 0, 0) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) SketchConstraintRigid_1 = Sketch_1.setFixed(SketchLine_1.startPoint()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), 50) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 50) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_1.result(), SketchLine_3.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_4.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result()) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_1.result(), SketchLine_3.result() +) +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_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) +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) -SketchLine_7 = Sketch_2.addLine(-28.95543815719345, 10.01640181835304, 84.67753244325934, 10.01640181835304) -SketchLine_8 = Sketch_2.addLine(84.67753244325934, 10.01640181835304, 84.67753244325934, -72.65003691291119) -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()) +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 +) +SketchLine_7 = Sketch_2.addLine( + -28.95543815719345, 10.01640181835304, 84.67753244325934, 10.01640181835304 +) +SketchLine_8 = Sketch_2.addLine( + 84.67753244325934, 10.01640181835304, 84.67753244325934, -72.65003691291119 +) +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_1 = Sketch_2.setHorizontal(SketchLine_5.result()) 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_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_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")]) +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")) SketchLine_9 = Sketch_3.addLine(0, 0, 0, 10) SketchLine_10 = Sketch_3.addLine(0, 10, 10, 10) -SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_9 = Sketch_3.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchLine_11 = Sketch_3.addLine(10, 10, 10, 0) -SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_10 = Sketch_3.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchLine_12 = Sketch_3.addLine(10, 0, 0, 0) -SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_11 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_3.setCoincident( + SketchLine_12.endPoint(), SketchLine_9.startPoint() +) SketchConstraintRigid_2 = Sketch_3.setFixed(SketchLine_9.startPoint()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_3.setLength(SketchLine_12.result(), 10) SketchConstraintLength_4 = Sketch_3.setLength(SketchLine_9.result(), 10) -SketchConstraintParallel_3 = Sketch_3.setParallel(SketchLine_9.result(), SketchLine_11.result()) -SketchConstraintParallel_4 = Sketch_3.setParallel(SketchLine_10.result(), SketchLine_12.result()) -SketchConstraintPerpendicular_2 = Sketch_3.setPerpendicular(SketchLine_9.result(), SketchLine_12.result()) +SketchConstraintParallel_3 = Sketch_3.setParallel( + SketchLine_9.result(), SketchLine_11.result() +) +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_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")]) +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() diff --git a/src/FeaturesPlugin/Test/Test2222.py b/src/FeaturesPlugin/Test/Test2222.py index 86d6282d3..f178caf30 100644 --- a/src/FeaturesPlugin/Test/Test2222.py +++ b/src/FeaturesPlugin/Test/Test2222.py @@ -30,29 +30,49 @@ SketchLine_1 = Sketch_1.addLine(173, 265, -254, 265) SketchLine_2 = Sketch_1.addLine(-254, 265, -254, 118) SketchLine_3 = Sketch_1.addLine(-254, 118, 173, 118) SketchLine_4 = Sketch_1.addLine(173, 118, 173, 265) -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()) +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_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_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&Sketch_1/SketchLine_1")]) +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&Sketch_1/SketchLine_1")], +) model.do() model.end() # check that resulting group selection is valid from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) -assert(Group_1.groupList().size() == 1) -assert(Group_1.groupList().value(0).value().shapeTypeStr() == "EDGE") -assert(len(Group_1.groupList().value(0).namingName()) > 0) +assert aFactory.validate(Group_1.feature()) +assert Group_1.groupList().size() == 1 +assert Group_1.groupList().value(0).value().shapeTypeStr() == "EDGE" +assert len(Group_1.groupList().value(0).namingName()) > 0 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2225.py b/src/FeaturesPlugin/Test/Test2225.py index 8a21ae22a..381251f4e 100644 --- a/src/FeaturesPlugin/Test/Test2225.py +++ b/src/FeaturesPlugin/Test/Test2225.py @@ -24,35 +24,77 @@ 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(-55.80357142857143, 252.2321428571429, -250, 252.2321428571429) +SketchLine_1 = Sketch_1.addLine( + -55.80357142857143, 252.2321428571429, -250, 252.2321428571429 +) SketchLine_2 = Sketch_1.addLine(-250, 252.2321428571429, -250, 4.464285714285698) -SketchLine_3 = Sketch_1.addLine(-250, 4.464285714285698, -55.80357142857143, 4.464285714285698) -SketchLine_4 = Sketch_1.addLine(-55.80357142857143, 4.464285714285698, -55.80357142857143, 252.2321428571429) -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()) +SketchLine_3 = Sketch_1.addLine( + -250, 4.464285714285698, -55.80357142857143, 4.464285714285698 +) +SketchLine_4 = Sketch_1.addLine( + -55.80357142857143, 4.464285714285698, -55.80357142857143, 252.2321428571429 +) +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_objects = [model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_1")] +Face_1_objects = [ + model.selection("EDGE", "Sketch_1/SketchLine_3"), + model.selection("EDGE", "Sketch_1/SketchLine_4"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + model.selection("EDGE", "Sketch_1/SketchLine_1"), +] 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(-247.7678571428571, 71.42857142857137, -160.7142857142857, 167.4107142857142) -SketchLine_6 = Sketch_2.addLine(-160.7142857142857, 167.4107142857142, -276.7857142857143, 267.8571428571428) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchLine_7 = Sketch_2.addLine(-276.7857142857143, 267.8571428571428, -154.0178571428571, 350.4464285714285) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchLine_8 = Sketch_2.addLine(-154.0178571428571, 350.4464285714285, -294.6428571428572, 428.5714285714284) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchLine_5 = Sketch_2.addLine( + -247.7678571428571, 71.42857142857137, -160.7142857142857, 167.4107142857142 +) +SketchLine_6 = Sketch_2.addLine( + -160.7142857142857, 167.4107142857142, -276.7857142857143, 267.8571428571428 +) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchLine_7 = Sketch_2.addLine( + -276.7857142857143, 267.8571428571428, -154.0178571428571, 350.4464285714285 +) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchLine_8 = Sketch_2.addLine( + -154.0178571428571, 350.4464285714285, -294.6428571428572, 428.5714285714284 +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) model.do() -Wire_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_6"), model.selection("EDGE", "Sketch_2/SketchLine_7"), model.selection("EDGE", "Sketch_2/SketchLine_8")] +Wire_1_objects = [ + model.selection("EDGE", "Sketch_2/SketchLine_5"), + model.selection("EDGE", "Sketch_2/SketchLine_6"), + model.selection("EDGE", "Sketch_2/SketchLine_7"), + model.selection("EDGE", "Sketch_2/SketchLine_8"), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects) -Pipe_1 = model.addPipe(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("WIRE", "Wire_1_1")) +Pipe_1 = model.addPipe( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("WIRE", "Wire_1_1"), +) model.do() model.testHaveNamingSubshapes(Pipe_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2231.py b/src/FeaturesPlugin/Test/Test2231.py index 353f63c85..f05b6dc1f 100644 --- a/src/FeaturesPlugin/Test/Test2231.py +++ b/src/FeaturesPlugin/Test/Test2231.py @@ -26,55 +26,131 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(306.7092651757188, 0, 0, 0) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 127.7955271565495) -SketchLine_3 = Sketch_1.addLine(0, 127.7955271565495, 306.7092651757188, 127.7955271565495) -SketchLine_4 = Sketch_1.addLine(306.7092651757188, 127.7955271565495, 306.7092651757188, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_3 = Sketch_1.addLine( + 0, 127.7955271565495, 306.7092651757188, 127.7955271565495 +) +SketchLine_4 = Sketch_1.addLine( + 306.7092651757188, 127.7955271565495, 306.7092651757188, 0 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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(0, 127.7955271565495, -349.8402555910542, 127.7955271565495) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(-349.8402555910542, 127.7955271565495, -349.8402555910542, 0) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchLine_5 = Sketch_1.addLine( + 0, 127.7955271565495, -349.8402555910542, 127.7955271565495 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + -349.8402555910542, 127.7955271565495, -349.8402555910542, 0 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(-349.8402555910542, 0, 0, 0) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_7.endPoint() +) SketchLine_8 = Sketch_1.addLine(0, 0, 0, -164.5367412140575) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_8.startPoint()) -SketchLine_9 = Sketch_1.addLine(0, -164.5367412140575, -349.8402555910542, -164.5367412140575) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchLine_10 = Sketch_1.addLine(-349.8402555910542, -164.5367412140575, -349.8402555910542, 0) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_8.startPoint() +) +SketchLine_9 = Sketch_1.addLine( + 0, -164.5367412140575, -349.8402555910542, -164.5367412140575 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchLine_10 = Sketch_1.addLine( + -349.8402555910542, -164.5367412140575, -349.8402555910542, 0 +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_10.endPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_8.result()) -SketchLine_11 = Sketch_1.addLine(527.1565495207667, -78.27476038338659, 81.46964856230041, -78.27476038338659) -SketchLine_12 = Sketch_1.addLine(81.46964856230041, -78.27476038338659, 81.46964856230041, -285.9424920127795) -SketchLine_13 = Sketch_1.addLine(81.46964856230041, -285.9424920127795, 527.1565495207667, -285.9424920127795) -SketchLine_14 = Sketch_1.addLine(527.1565495207667, -285.9424920127795, 527.1565495207667, -78.27476038338659) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchLine_11 = Sketch_1.addLine( + 527.1565495207667, -78.27476038338659, 81.46964856230041, -78.27476038338659 +) +SketchLine_12 = Sketch_1.addLine( + 81.46964856230041, -78.27476038338659, 81.46964856230041, -285.9424920127795 +) +SketchLine_13 = Sketch_1.addLine( + 81.46964856230041, -285.9424920127795, 527.1565495207667, -285.9424920127795 +) +SketchLine_14 = Sketch_1.addLine( + 527.1565495207667, -285.9424920127795, 527.1565495207667, -78.27476038338659 +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_11.result()) 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_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")]) +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() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2233.py b/src/FeaturesPlugin/Test/Test2233.py index 7338a2efe..5a583a2f5 100644 --- a/src/FeaturesPlugin/Test/Test2233.py +++ b/src/FeaturesPlugin/Test/Test2233.py @@ -27,26 +27,58 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) SketchLine_1 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OZ")) SketchArc_1 = Sketch_1.addArc(0, 0, 0, 50, 0, -50, True) -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(SketchArc_1.endPoint(), SketchLine_1.result()) +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( + SketchArc_1.endPoint(), SketchLine_1.result() +) 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()) +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/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]")]) +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 from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) -assert(Group_1.groupList().size() == 2) -assert(Group_1.groupList().value(0).value().shapeTypeStr() == "VERTEX") -assert(len(Group_1.groupList().value(0).namingName()) > 0) -assert(Group_1.groupList().value(1).value().shapeTypeStr() == "VERTEX") -assert(Group_1.groupList().value(0).namingName() != Group_1.groupList().value(1).namingName()) +assert aFactory.validate(Group_1.feature()) +assert Group_1.groupList().size() == 2 +assert Group_1.groupList().value(0).value().shapeTypeStr() == "VERTEX" +assert len(Group_1.groupList().value(0).namingName()) > 0 +assert Group_1.groupList().value(1).value().shapeTypeStr() == "VERTEX" +assert ( + Group_1.groupList().value(0).namingName() + != Group_1.groupList().value(1).namingName() +) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2240.py b/src/FeaturesPlugin/Test/Test2240.py index 14f2e7bbc..a2750e9ff 100644 --- a/src/FeaturesPlugin/Test/Test2240.py +++ b/src/FeaturesPlugin/Test/Test2240.py @@ -27,80 +27,246 @@ model.addParameter(Part_1_doc, "length_assemblage", "10") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 60, 10, 60) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) SketchLine_3 = Sketch_1.addLine(10, 60, 10, 40) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(10, 40, 20, 40) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(20, 40, 20, 20) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(20, 20, 30, 20) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(30, 20, 30, 0) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.result()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.result() +) SketchLine_9 = Sketch_1.addLine(30, 0, 81.26217508737108, 0) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_8.result()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_8.result() +) SketchLine_10 = Sketch_1.addLine(0, 60, 0, 81.26217508737108) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_2.result() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) 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-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()) +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-34, -3.089278765476956e-34, 76.26217508737108, 0, 0, 76.26217508737108, False) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_2.center()) +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 = 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 = 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, False) -SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), "2*length_assemblage") +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") +SketchConstraintLength_2 = Sketch_1.setLength( + SketchLine_6.result(), "length_assemblage" +) SketchConstraintLength_2.setName("SketchConstraintLength_3") -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_7.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_7.result() +) SketchConstraintEqual_1.setName("SketchConstraintEqual_2") -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_6.result(), SketchLine_4.result()) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_6.result(), SketchLine_4.result() +) SketchConstraintEqual_2.setName("SketchConstraintEqual_3") -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_3.result()) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_3.result() +) SketchConstraintEqual_3.setName("SketchConstraintEqual_4") -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_1.result()) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_4.result(), SketchLine_1.result() +) SketchConstraintEqual_4.setName("SketchConstraintEqual_5") model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_1 = Sketch_2.addCircle(9.082839147404137, 71.32948234489588, 2.005056553640547) -SketchCircle_2 = Sketch_2.addCircle(20.11065019242717, 63.7102674410618, 2.268462537186828) -SketchCircle_3 = Sketch_2.addCircle(26.52683116407693, 51.67992811921848, 2.727171758268866) -SketchCircle_4 = Sketch_2.addCircle(38.35666483055617, 58.29661474623231, 3.007584830460834) -SketchCircle_5 = Sketch_2.addCircle(33.94554041254697, 44.0607132153844, 3.054011155390377) -SketchCircle_6 = Sketch_2.addCircle(48.58245325412298, 42.45666797247195, 2.346858526438435) -SketchCircle_7 = Sketch_2.addCircle(38.95818179664835, 31.42885692744893, 3.547307159201095) -SketchCircle_8 = Sketch_2.addCircle(63.82088306179116, 27.41874382016783, 4.536925074373651) -SketchCircle_9 = Sketch_2.addCircle(50.18649849703544, 28.4212720969881, 4.820482891521984) -SketchCircle_10 = Sketch_2.addCircle(49.58498153094326, 15.18789884296047, 2.552020354335177) -SketchCircle_11 = Sketch_2.addCircle(66.22695092615982, 10.77677442495125, 4.536925074373645) -SketchCircle_12 = Sketch_2.addCircle(50.98852111849166, 6.165144351577979, 3.547307159201085) +SketchCircle_1 = Sketch_2.addCircle( + 9.082839147404137, 71.32948234489588, 2.005056553640547 +) +SketchCircle_2 = Sketch_2.addCircle( + 20.11065019242717, 63.7102674410618, 2.268462537186828 +) +SketchCircle_3 = Sketch_2.addCircle( + 26.52683116407693, 51.67992811921848, 2.727171758268866 +) +SketchCircle_4 = Sketch_2.addCircle( + 38.35666483055617, 58.29661474623231, 3.007584830460834 +) +SketchCircle_5 = Sketch_2.addCircle( + 33.94554041254697, 44.0607132153844, 3.054011155390377 +) +SketchCircle_6 = Sketch_2.addCircle( + 48.58245325412298, 42.45666797247195, 2.346858526438435 +) +SketchCircle_7 = Sketch_2.addCircle( + 38.95818179664835, 31.42885692744893, 3.547307159201095 +) +SketchCircle_8 = Sketch_2.addCircle( + 63.82088306179116, 27.41874382016783, 4.536925074373651 +) +SketchCircle_9 = Sketch_2.addCircle( + 50.18649849703544, 28.4212720969881, 4.820482891521984 +) +SketchCircle_10 = Sketch_2.addCircle( + 49.58498153094326, 15.18789884296047, 2.552020354335177 +) +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/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_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_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_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_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) @@ -109,52 +275,146 @@ 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) -SketchPoint_1 = Sketch_3.addPoint(model.selection("VERTEX", "[Partition_1_1_1/Modified_Edge&Sketch_1/SketchLine_9]e[Partition_1_1_1/Modified_Edge&Sketch_1/SketchLine_7]e")) -SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchPoint_1.result()) +SketchPoint_1 = Sketch_3.addPoint( + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Edge&Sketch_1/SketchLine_9]e[Partition_1_1_1/Modified_Edge&Sketch_1/SketchLine_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 = 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 = 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 = 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 = Sketch_3.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_26") SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_12.result()) SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_13.result()) SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_14.result()) -SketchConstraintLength_3 = Sketch_3.setLength(SketchLine_13.result(), "length_assemblage") +SketchConstraintLength_3 = Sketch_3.setLength( + SketchLine_13.result(), "length_assemblage" +) SketchConstraintLength_3.setName("SketchConstraintLength_1") -SketchConstraintEqual_5 = Sketch_3.setEqual(SketchLine_13.result(), SketchLine_14.result()) +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/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) +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) +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) +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/MV:Translated&Sketch_3/SketchLine_13_EndVertex&Sketch_3/SketchLine_14_StartVertex")) -LinearCopy_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_3_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 3) +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/MV:Translated&Sketch_3/SketchLine_13_EndVertex&Sketch_3/SketchLine_14_StartVertex", + ), +) +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")] +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 from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Partition_2.feature())) -assert(Partition_2.feature().results().size() == 1) +assert aFactory.validate(Partition_2.feature()) +assert Partition_2.feature().results().size() == 1 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2246.py b/src/FeaturesPlugin/Test/Test2246.py index 55765c0b7..9ea0dbf4b 100644 --- a/src/FeaturesPlugin/Test/Test2246.py +++ b/src/FeaturesPlugin/Test/Test2246.py @@ -29,27 +29,64 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) SketchLine_1 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OZ")) SketchArc_1 = Sketch_1.addArc(0, 0, 0, 62, 0, -62, 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(SketchArc_1.endPoint(), SketchLine_1.result()) +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( + SketchArc_1.endPoint(), SketchLine_1.result() +) 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()) +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/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/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]")]) +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/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 from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) -assert(Group_1.groupList().size() == 2) -assert(Group_1.groupList().value(0).value().shapeTypeStr() == "VERTEX") -assert(len(Group_1.groupList().value(0).namingName()) > 0) -assert(Group_1.groupList().value(1).value().shapeTypeStr() == "VERTEX") -assert(Group_1.groupList().value(0).namingName() != Group_1.groupList().value(1).namingName()) +assert aFactory.validate(Group_1.feature()) +assert Group_1.groupList().size() == 2 +assert Group_1.groupList().value(0).value().shapeTypeStr() == "VERTEX" +assert len(Group_1.groupList().value(0).namingName()) > 0 +assert Group_1.groupList().value(1).value().shapeTypeStr() == "VERTEX" +assert ( + Group_1.groupList().value(0).namingName() + != Group_1.groupList().value(1).namingName() +) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2248.py b/src/FeaturesPlugin/Test/Test2248.py index f2e003635..11c513eeb 100644 --- a/src/FeaturesPlugin/Test/Test2248.py +++ b/src/FeaturesPlugin/Test/Test2248.py @@ -26,74 +26,256 @@ 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(394.1014919414247, 282.461820162796, -355.0948596332293, 282.461820162796) -SketchLine_2 = Sketch_1.addLine(-355.0948596332293, 282.461820162796, -355.0948596332293, -224.6243998437472) -SketchLine_3 = Sketch_1.addLine(-355.0948596332293, -224.6243998437472, 394.1014919414247, -224.6243998437472) -SketchLine_4 = Sketch_1.addLine(394.1014919414247, -224.6243998437472, 394.1014919414247, 282.461820162796) -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()) +SketchLine_1 = Sketch_1.addLine( + 394.1014919414247, 282.461820162796, -355.0948596332293, 282.461820162796 +) +SketchLine_2 = Sketch_1.addLine( + -355.0948596332293, 282.461820162796, -355.0948596332293, -224.6243998437472 +) +SketchLine_3 = Sketch_1.addLine( + -355.0948596332293, -224.6243998437472, 394.1014919414247, -224.6243998437472 +) +SketchLine_4 = Sketch_1.addLine( + 394.1014919414247, -224.6243998437472, 394.1014919414247, 282.461820162796 +) +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.174842024158346, 282.461820162796, -355.0948596332293, 282.461820162796, 143.9210226543769, -30.9362945892586, False) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_1.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_2.result(), SketchArc_1.results()[1]) -SketchArc_2 = Sketch_1.addArc(394.1014919414247, 441.436567364073, 394.1014919414247, -224.6243998437472, -125.0902346435239, 24.21101315681109, True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_2.startPoint()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_2.results()[1]) -SketchCircle_1 = Sketch_1.addCircle(-13.45056286489504, 169.4770920976776, 150.6703210346195) +SketchArc_1 = Sketch_1.addArc( + -7.174842024158346, + 282.461820162796, + -355.0948596332293, + 282.461820162796, + 143.9210226543769, + -30.9362945892586, + False, +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchArc_1.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_2.result(), SketchArc_1.results()[1] +) +SketchArc_2 = Sketch_1.addArc( + 394.1014919414247, + 441.436567364073, + 394.1014919414247, + -224.6243998437472, + -125.0902346435239, + 24.21101315681109, + True, +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_2.results()[1] +) +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) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) 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_4)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)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/SketchArc_1_2)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4)2]"), -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/SketchArc_1_2)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4)2][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_4)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_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/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)2][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)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)2][Extrusion_1_1_1/From_Face]"), -model.selection("EDGE", "[(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)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/SketchArc_1_2)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4)2]"), -model.selection("EDGE", "[(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4)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)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4)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/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4)2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2]") + 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_4)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)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/SketchArc_1_2)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4)2]", + ), + 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/SketchArc_1_2)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4)2][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_4)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_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/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)2][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)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)2][Extrusion_1_1_1/From_Face]", + ), + model.selection( + "EDGE", + "[(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)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/SketchArc_1_2)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4)2]", + ), + model.selection( + "EDGE", + "[(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4)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)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4)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/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4)2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2]", + ), ] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) model.do() @@ -101,11 +283,12 @@ model.end() # check that resulting group selection is valid from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) -assert(Group_1.groupList().size() == 46) +assert aFactory.validate(Group_1.feature()) +assert Group_1.groupList().size() == 46 for a in range(46): - assert(Group_1.groupList().value(a).value().shapeTypeStr() == "EDGE") - assert(len(Group_1.groupList().value(a).namingName()) > 0) + assert Group_1.groupList().value(a).value().shapeTypeStr() == "EDGE" + assert len(Group_1.groupList().value(a).namingName()) > 0 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2251.py b/src/FeaturesPlugin/Test/Test2251.py index 0621aa020..937c9957d 100644 --- a/src/FeaturesPlugin/Test/Test2251.py +++ b/src/FeaturesPlugin/Test/Test2251.py @@ -26,80 +26,176 @@ 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(500.0000311770457, 317.8294573643411, -308.1395348837211, 317.8294573643411) -SketchLine_2 = Sketch_1.addLine(-308.1395348837211, 317.8294573643411, -308.1395348837211, -263.9724263224183) -SketchLine_3 = Sketch_1.addLine(-308.1395348837211, -263.9724263224183, 500.0000311770457, -263.9724263224183) -SketchLine_4 = Sketch_1.addLine(500.0000311770457, -263.9724263224183, 500.0000311770457, 317.8294573643411) -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()) +SketchLine_1 = Sketch_1.addLine( + 500.0000311770457, 317.8294573643411, -308.1395348837211, 317.8294573643411 +) +SketchLine_2 = Sketch_1.addLine( + -308.1395348837211, 317.8294573643411, -308.1395348837211, -263.9724263224183 +) +SketchLine_3 = Sketch_1.addLine( + -308.1395348837211, -263.9724263224183, 500.0000311770457, -263.9724263224183 +) +SketchLine_4 = Sketch_1.addLine( + 500.0000311770457, -263.9724263224183, 500.0000311770457, 317.8294573643411 +) +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(-118.2170542635659, 222.8682170542636, 141.685090902591) -SketchCircle_2 = Sketch_1.addCircle(294.5736434108529, -40.69767441860468, 113.2187726277406) -SketchArc_1 = Sketch_1.addArc(500.0000311770867, -335287.7996679137, 500.0000311770457, -263.9724263224183, -639.534183538502, -265.9104108427558, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_1.results()[1]) -SketchArc_2 = Sketch_1.addArc(-638.1195022375863, -681.8252609710054, -639.534183538502, -265.9104108427558, -316.014851248167, -418.6983758160058, True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1]) -SketchArc_3 = Sketch_1.addArc(-167.5780303038277, -297.4405230733651, -316.014851248167, -418.6983758160058, -17.4411870157839, -178.2940378070349, False) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1]) -SketchArc_4 = Sketch_1.addArc(-301.8048538198685, -403.9610406236078, -17.4411870157839, -178.2940378070349, -637.5573748460384, -265.908384788777, False) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchArc_4.startPoint()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchArc_4.results()[1]) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_2.results()[1], SketchArc_4.endPoint()) +SketchCircle_1 = Sketch_1.addCircle( + -118.2170542635659, 222.8682170542636, 141.685090902591 +) +SketchCircle_2 = Sketch_1.addCircle( + 294.5736434108529, -40.69767441860468, 113.2187726277406 +) +SketchArc_1 = Sketch_1.addArc( + 500.0000311770867, + -335287.7996679137, + 500.0000311770457, + -263.9724263224183, + -639.534183538502, + -265.9104108427558, + True, +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_1.results()[1] +) +SketchArc_2 = Sketch_1.addArc( + -638.1195022375863, + -681.8252609710054, + -639.534183538502, + -265.9104108427558, + -316.014851248167, + -418.6983758160058, + True, +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchArc_2.results()[1] +) +SketchArc_3 = Sketch_1.addArc( + -167.5780303038277, + -297.4405230733651, + -316.014851248167, + -418.6983758160058, + -17.4411870157839, + -178.2940378070349, + False, +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) +SketchArc_4 = Sketch_1.addArc( + -301.8048538198685, + -403.9610406236078, + -17.4411870157839, + -178.2940378070349, + -637.5573748460384, + -265.908384788777, + False, +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchArc_4.results()[1] +) +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) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 100, 0 +) Group_1_objects = [ -model.selection("FACE", "(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_4_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_2)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_2)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_4_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_2)2"), -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_4)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_4_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_2)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_1_2)(Extrusion_1_1_6/From_Face)(Extrusion_1_1_6/To_Face)(Extrusion_1_1_6/Generated_Face&Sketch_1/SketchArc_3_2)2(Extrusion_1_1_6/Generated_Face&Sketch_1/SketchLine_3)2"), -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_3_2)(Extrusion_1_1_6/From_Face)(Extrusion_1_1_6/To_Face)(Extrusion_1_1_6/Generated_Face&Sketch_1/SketchArc_1_2)2(Extrusion_1_1_6/Generated_Face&Sketch_1/SketchLine_3)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_3_2)(Extrusion_1_1_6/From_Face)(Extrusion_1_1_6/To_Face)(Extrusion_1_1_6/Generated_Face&Sketch_1/SketchArc_1_2)2(Extrusion_1_1_6/Generated_Face&Sketch_1/SketchLine_3)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") + model.selection( + "FACE", + "(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_4_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_2)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_2)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_4_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_2)2", + ), + 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_4)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_4_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_2_2)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_1_2)(Extrusion_1_1_6/From_Face)(Extrusion_1_1_6/To_Face)(Extrusion_1_1_6/Generated_Face&Sketch_1/SketchArc_3_2)2(Extrusion_1_1_6/Generated_Face&Sketch_1/SketchLine_3)2", + ), + 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_3_2)(Extrusion_1_1_6/From_Face)(Extrusion_1_1_6/To_Face)(Extrusion_1_1_6/Generated_Face&Sketch_1/SketchArc_1_2)2(Extrusion_1_1_6/Generated_Face&Sketch_1/SketchLine_3)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_3_2)(Extrusion_1_1_6/From_Face)(Extrusion_1_1_6/To_Face)(Extrusion_1_1_6/Generated_Face&Sketch_1/SketchArc_1_2)2(Extrusion_1_1_6/Generated_Face&Sketch_1/SketchLine_3)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() @@ -107,11 +203,12 @@ model.end() # check that resulting group selection is valid from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) -assert(Group_1.groupList().size() == 44) +assert aFactory.validate(Group_1.feature()) +assert Group_1.groupList().size() == 44 for a in range(44): - assert(Group_1.groupList().value(a).value().shapeTypeStr() == "FACE") - assert(len(Group_1.groupList().value(a).namingName()) > 0) + assert Group_1.groupList().value(a).value().shapeTypeStr() == "FACE" + assert len(Group_1.groupList().value(a).namingName()) > 0 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2255.py b/src/FeaturesPlugin/Test/Test2255.py index 4da32204a..5341eba10 100644 --- a/src/FeaturesPlugin/Test/Test2255.py +++ b/src/FeaturesPlugin/Test/Test2255.py @@ -26,46 +26,106 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(40.12837458064153, 0, 0, 0) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 44.52500071883479) -SketchLine_3 = Sketch_1.addLine(0, 44.52500071883479, 40.12837458064153, 44.52500071883479) -SketchLine_4 = Sketch_1.addLine(40.12837458064153, 44.52500071883479, 40.12837458064153, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_3 = Sketch_1.addLine( + 0, 44.52500071883479, 40.12837458064153, 44.52500071883479 +) +SketchLine_4 = Sketch_1.addLine( + 40.12837458064153, 44.52500071883479, 40.12837458064153, 0 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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(0, 0, 24.97092001270093) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.center()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.center() +) model.do() -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_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")]) +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) +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.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) -SketchLine_8 = Sketch_2.addLine(49.62901186301215, 38.96586914453801, 49.62901186301215, 25.3130971701971) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +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 +) +SketchLine_8 = Sketch_2.addLine( + 49.62901186301215, 38.96586914453801, 49.62901186301215, 25.3130971701971 +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_10 = 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()) model.do() -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")]) +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() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(ExtrusionCut_1, 2) model.testNbSubResults(ExtrusionCut_1, [0, 0]) @@ -73,6 +133,9 @@ model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.SOLID, [1, 1]) model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.FACE, [10, 3]) model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.EDGE, [48, 6]) model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.VERTEX, [96, 12]) -model.testResultsVolumes(ExtrusionCut_1, [86396.175406624068273231387138367, 97946.509572227776516228914260864]) +model.testResultsVolumes( + ExtrusionCut_1, + [86396.175406624068273231387138367, 97946.509572227776516228914260864], +) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test22847.py b/src/FeaturesPlugin/Test/Test22847.py index 916b4d1b6..7a4620d1a 100644 --- a/src/FeaturesPlugin/Test/Test22847.py +++ b/src/FeaturesPlugin/Test/Test22847.py @@ -38,15 +38,40 @@ Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_3.result()) Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_2.startPoint()) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 10, 0, "Faces|Wires") -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OY"), 60, 2, model.selection("EDGE", "PartSet/OX"), 75, 2, keepSubResults = True) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection(), + 10, + 0, + "Faces|Wires", +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OY"), + 60, + 2, + model.selection("EDGE", "PartSet/OX"), + 75, + 2, + keepSubResults=True, +) ### Create Group -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "LinearCopy_1_1_1_2/MF:Translated&Sketch_1/SketchLine_2")]) +Group_1 = model.addGroup( + Part_1_doc, + "Faces", + [model.selection("FACE", "LinearCopy_1_1_1_2/MF:Translated&Sketch_1/SketchLine_2")], +) ### Create Remove_SubShapes -Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPOUND", "LinearCopy_1_1")) -Remove_SubShapes_1.setSubShapesToRemove([model.selection("SOLID", "LinearCopy_1_1_4_2")]) +Remove_SubShapes_1 = model.addRemoveSubShapes( + Part_1_doc, model.selection("COMPOUND", "LinearCopy_1_1") +) +Remove_SubShapes_1.setSubShapesToRemove( + [model.selection("SOLID", "LinearCopy_1_1_4_2")] +) model.end() # Move the group to the end of history @@ -56,11 +81,12 @@ model.end() # check that all groups are correct from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) -assert(Group_1.groupList().size() == 1) -assert(Group_1.groupList().value(0).value().shapeTypeStr() == "FACE") -assert(len(Group_1.groupList().value(0).namingName()) > 0) +assert aFactory.validate(Group_1.feature()) +assert Group_1.groupList().size() == 1 +assert Group_1.groupList().value(0).value().shapeTypeStr() == "FACE" +assert len(Group_1.groupList().value(0).namingName()) > 0 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2289.py b/src/FeaturesPlugin/Test/Test2289.py index f9a91a5c5..6bc0dd8ff 100644 --- a/src/FeaturesPlugin/Test/Test2289.py +++ b/src/FeaturesPlugin/Test/Test2289.py @@ -24,33 +24,71 @@ 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(55.30809111108014, 52.50335568234566, -47.4076783683968, 52.50335568234566) -SketchLine_2 = Sketch_1.addLine(-47.4076783683968, 52.50335568234566, -77.7205049049542, 0) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(-77.7205049049542, 0, -47.4076783683968, -52.50335568234565) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-47.4076783683968, -52.50335568234565, 55.30809111108014, -52.50335568234565) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(55.30809111108014, -52.50335568234565, 55.30809111108014, 52.50335568234566) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint()) +SketchLine_1 = Sketch_1.addLine( + 55.30809111108014, 52.50335568234566, -47.4076783683968, 52.50335568234566 +) +SketchLine_2 = Sketch_1.addLine( + -47.4076783683968, 52.50335568234566, -77.7205049049542, 0 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + -77.7205049049542, 0, -47.4076783683968, -52.50335568234565 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -47.4076783683968, -52.50335568234565, 55.30809111108014, -52.50335568234565 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 55.30809111108014, -52.50335568234565, 55.30809111108014, 52.50335568234566 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_6 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.result(), SketchLine_3.startPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngleBackward(SketchLine_2.result(), SketchLine_3.result(), 120) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_3.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_4.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.result(), SketchLine_3.startPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngleBackward( + SketchLine_2.result(), SketchLine_3.result(), 120 +) +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_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_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) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 10, 0 +) model.do() model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2304.py b/src/FeaturesPlugin/Test/Test2304.py index 3b16e2fad..57f3d0f71 100644 --- a/src/FeaturesPlugin/Test/Test2304.py +++ b/src/FeaturesPlugin/Test/Test2304.py @@ -24,39 +24,90 @@ 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(64.44596912521442, 49.72041166380789, -52.66552315608919, 49.72041166380789) -SketchLine_2 = Sketch_1.addLine(-52.66552315608919, 49.72041166380789, -52.66552315608919, -67.3910806174957) -SketchLine_3 = Sketch_1.addLine(-52.66552315608919, -67.3910806174957, 64.44596912521442, -67.3910806174957) -SketchLine_4 = Sketch_1.addLine(64.44596912521442, -67.3910806174957, 64.44596912521442, 49.72041166380789) -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()) +SketchLine_1 = Sketch_1.addLine( + 64.44596912521442, 49.72041166380789, -52.66552315608919, 49.72041166380789 +) +SketchLine_2 = Sketch_1.addLine( + -52.66552315608919, 49.72041166380789, -52.66552315608919, -67.3910806174957 +) +SketchLine_3 = Sketch_1.addLine( + -52.66552315608919, -67.3910806174957, 64.44596912521442, -67.3910806174957 +) +SketchLine_4 = Sketch_1.addLine( + 64.44596912521442, -67.3910806174957, 64.44596912521442, 49.72041166380789 +) +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.99485420240136, 11.60720411663807, -11.7804459691252, 11.60720411663807) -SketchLine_6 = Sketch_1.addLine(-11.7804459691252, 11.60720411663807, -11.7804459691252, -33.78216123499142) -SketchLine_7 = Sketch_1.addLine(-11.7804459691252, -33.78216123499142, 34.99485420240136, -33.78216123499142) -SketchLine_8 = Sketch_1.addLine(34.99485420240136, -33.78216123499142, 34.99485420240136, 11.60720411663807) -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()) +SketchLine_5 = Sketch_1.addLine( + 34.99485420240136, 11.60720411663807, -11.7804459691252, 11.60720411663807 +) +SketchLine_6 = Sketch_1.addLine( + -11.7804459691252, 11.60720411663807, -11.7804459691252, -33.78216123499142 +) +SketchLine_7 = Sketch_1.addLine( + -11.7804459691252, -33.78216123499142, 34.99485420240136, -33.78216123499142 +) +SketchLine_8 = Sketch_1.addLine( + 34.99485420240136, -33.78216123499142, 34.99485420240136, 11.60720411663807 +) +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()) 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_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")] +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_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")]) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1"), model.selection("FACE", "Face_1_1")], +) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Partition_1, 1) model.testNbSubResults(Partition_1, [2]) @@ -66,4 +117,4 @@ model.testNbSubShapes(Partition_1, GeomAPI_Shape.EDGE, [56]) model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [112]) model.testResultsVolumes(Partition_1, [424620.237783511402085423469543457]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2304_2.py b/src/FeaturesPlugin/Test/Test2304_2.py index 883f6984b..f72e3c7a8 100644 --- a/src/FeaturesPlugin/Test/Test2304_2.py +++ b/src/FeaturesPlugin/Test/Test2304_2.py @@ -26,14 +26,24 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(345, 0, 0, 0) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 200) SketchLine_3 = Sketch_1.addLine(0, 200, 345, 200) SketchLine_4 = Sketch_1.addLine(345, 200, 345, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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()) @@ -41,107 +51,230 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 345) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 200) SketchLine_5 = Sketch_1.addLine(167, 200, 161.5499999999994, 190.5603230987492) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_3.result()) -SketchLine_6 = Sketch_1.addLine(161.5499999999994, 190.5603230987492, 167, 181.1206461974984) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_3.result() +) +SketchLine_6 = Sketch_1.addLine( + 161.5499999999994, 190.5603230987492, 167, 181.1206461974984 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(167, 181.1206461974984, 177.9, 181.1206461974984) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchLine_8 = Sketch_1.addLine(177.9, 181.1206461974984, 183.3499999999994, 190.5603230987492) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchLine_8 = Sketch_1.addLine( + 177.9, 181.1206461974984, 183.3499999999994, 190.5603230987492 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(183.3499999999994, 190.5603230987492, 177.9, 200) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_3.result() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintHorizontal_3.setName("SketchConstraintHorizontal_4") SketchLine_10 = Sketch_1.addLine(167, 200, 167, 181.1206461974984) SketchLine_10.setName("SketchLine_11") SketchLine_10.result().setName("SketchLine_11") SketchLine_10.setAuxiliary(True) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_10.startPoint() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_14") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_10.endPoint() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_15") SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_10.result()) SketchLine_11 = Sketch_1.addLine(177.9, 200, 177.9, 181.1206461974984) SketchLine_11.setName("SketchLine_12") SketchLine_11.result().setName("SketchLine_12") SketchLine_11.setAuxiliary(True) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_11.startPoint() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_16") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_11.endPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_11.endPoint() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_17") SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_11.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_6.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_8.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_5.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_6.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_8.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_5.result() +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 10.9) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_7.result(), SketchLine_6.result()) -SketchCircle_1 = Sketch_1.addCircle(172.4499999999994, 190.5603230987492, 10.89999999999998) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_7.result(), SketchLine_6.result() +) +SketchCircle_1 = Sketch_1.addCircle( + 172.4499999999994, 190.5603230987492, 10.89999999999998 +) SketchCircle_1.setAuxiliary(True) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchCircle_1.results()[1] +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_18") -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchCircle_1.results()[1] +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_19") -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchCircle_1.results()[1] +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_20") -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchCircle_1.results()[1] +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_21") -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_5.startPoint(), SketchLine_2.result(), 167, False) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_5.startPoint(), SketchLine_2.result(), 167, False +) SketchLine_12 = Sketch_1.addLine(163.0544826719043, 187.9544826719043, 175.1, 200) SketchLine_12.setName("SketchLine_13") SketchLine_12.result().setName("SketchLine_13") -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_12.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_12.startPoint(), SketchLine_6.result() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_22") -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_3.result() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_23") -SketchLine_13 = Sketch_1.addLine(163.0808822145049, 187.9087573228236, 175.1721248916813, 200) +SketchLine_13 = Sketch_1.addLine( + 163.0808822145049, 187.9087573228236, 175.1721248916813, 200 +) SketchLine_13.setName("SketchLine_14") SketchLine_13.result().setName("SketchLine_14") -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_13.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_13.startPoint(), SketchLine_6.result() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_24") -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_3.result() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_25") -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_12.result(), SketchLine_13.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_12.result(), SketchLine_13.startPoint(), 0.051, False) -SketchCircle_2 = Sketch_1.addCircle(163.0544826719043, 187.9544826719043, 0.004999999999999999) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_12.startPoint(), SketchCircle_2.center()) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_12.result(), SketchLine_13.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_12.result(), SketchLine_13.startPoint(), 0.051, False +) +SketchCircle_2 = Sketch_1.addCircle( + 163.0544826719043, 187.9544826719043, 0.004999999999999999 +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_12.startPoint(), SketchCircle_2.center() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_26") -SketchCircle_3 = Sketch_1.addCircle(163.0808822145049, 187.9087573228236, 0.004999999999999999) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_13.startPoint(), SketchCircle_3.center()) +SketchCircle_3 = Sketch_1.addCircle( + 163.0808822145049, 187.9087573228236, 0.004999999999999999 +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_13.startPoint(), SketchCircle_3.center() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_27") SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], 0.005) -SketchConstraintEqual_5 = Sketch_1.setEqual(SketchCircle_2.results()[1], SketchCircle_3.results()[1]) -SketchLine_14 = Sketch_1.addLine(163.0544826719043, 187.9544826719043, 163.0497273893228, 187.9529375869324) +SketchConstraintEqual_5 = Sketch_1.setEqual( + SketchCircle_2.results()[1], SketchCircle_3.results()[1] +) +SketchLine_14 = Sketch_1.addLine( + 163.0544826719043, 187.9544826719043, 163.0497273893228, 187.9529375869324 +) SketchLine_14.setName("SketchLine_15") SketchLine_14.result().setName("SketchLine_15") -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchLine_12.startPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchLine_12.startPoint(), SketchLine_14.startPoint() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_28") -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchCircle_2.results()[1]) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchCircle_2.results()[1] +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_29") -SketchConstraintAngle_1 = Sketch_1.setAngleComplementary(SketchLine_6.result(), SketchLine_14.result(), 78.00000000013193) -SketchLine_15 = Sketch_1.addLine(163.0808822145049, 187.9087573228236, 163.0761269319234, 187.9072122378517) +SketchConstraintAngle_1 = Sketch_1.setAngleComplementary( + SketchLine_6.result(), SketchLine_14.result(), 78.00000000013193 +) +SketchLine_15 = Sketch_1.addLine( + 163.0808822145049, 187.9087573228236, 163.0761269319234, 187.9072122378517 +) SketchLine_15.setName("SketchLine_16") SketchLine_15.result().setName("SketchLine_16") -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchLine_13.startPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchLine_13.startPoint(), SketchLine_15.startPoint() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_30") -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchCircle_3.results()[1]) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_15.endPoint(), SketchCircle_3.results()[1] +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_31") -SketchConstraintAngle_2 = Sketch_1.setAngleComplementary(SketchLine_6.result(), SketchLine_15.result(), 78.00000000013193) -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) +SketchConstraintAngle_2 = Sketch_1.setAngleComplementary( + SketchLine_6.result(), SketchLine_15.result(), 78.00000000013193 +) +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/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_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_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/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_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_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) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Partition_1, 1) model.testNbSubResults(Partition_1, [12]) @@ -150,4 +283,4 @@ model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [12]) model.testNbSubShapes(Partition_1, GeomAPI_Shape.EDGE, [62]) model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [124]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2375.py b/src/FeaturesPlugin/Test/Test2375.py index 76a2a1326..4fdfb19cc 100644 --- a/src/FeaturesPlugin/Test/Test2375.py +++ b/src/FeaturesPlugin/Test/Test2375.py @@ -28,24 +28,46 @@ 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) +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()) +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()) +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()) +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) +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()) +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()) +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()) +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()) @@ -55,160 +77,404 @@ 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_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) +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) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchCircle_2 = Sketch_2.addCircle(4.113620667976081, 2.375000000000003, 1.1) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_2.center()) +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()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_3.center() +) 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]) +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] +) SketchLine_9 = Sketch_2.addLine(0, 0, 4.113620667976081, 2.375000000000003) SketchLine_9.setAuxiliary(True) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchCircle_2.center(), SketchLine_9.endPoint()) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchCircle_2.center(), SketchLine_9.endPoint() +) 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()) +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-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()) +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/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) -SketchConstraintAngle_3 = Sketch_2.setAngle(SketchLine_10.result(), SketchLine_11.result(), 120.0000000001004) +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 +) +SketchConstraintAngle_3 = Sketch_2.setAngle( + SketchLine_10.result(), SketchLine_11.result(), 120.0000000001004 +) SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_9.result(), 4.75) SketchCircle_5 = Sketch_2.addCircle(2.552173139647412, 4.006109367611208, 0.65) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_5.center()) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_5.center() +) SketchCircle_6 = Sketch_2.addCircle(2.552173139647412, 4.006109367611208, 0.8) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_6.center()) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchCircle_5.center(), SketchCircle_6.center()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_6.center() +) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchCircle_5.center(), SketchCircle_6.center() +) SketchCircle_7 = Sketch_2.addCircle(4.745479052513824, 0.20719208998535, 0.65) -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_7.center()) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_7.center() +) SketchCircle_8 = Sketch_2.addCircle(4.745479052513824, 0.20719208998535, 0.8) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_8.center()) -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchCircle_7.center(), SketchCircle_8.center()) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_8.center() +) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchCircle_7.center(), SketchCircle_8.center() +) SketchLine_13 = Sketch_2.addLine(0, 0, 2.552173139647412, 4.006109367611208) SketchLine_13.setAuxiliary(True) -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchCircle_5.center(), SketchLine_13.endPoint()) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchCircle_5.center(), SketchLine_13.endPoint() +) SketchLine_14 = Sketch_2.addLine(0, 0, 4.745479052513824, 0.20719208998535) SketchLine_14.setAuxiliary(True) -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchCircle_7.center(), SketchLine_14.endPoint()) -SketchConstraintEqual_3 = Sketch_2.setEqual(SketchCircle_7.results()[1], SketchCircle_5.results()[1]) -SketchConstraintEqual_4 = Sketch_2.setEqual(SketchCircle_8.results()[1], SketchCircle_6.results()[1]) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchCircle_7.center(), SketchLine_14.endPoint() +) +SketchConstraintEqual_3 = Sketch_2.setEqual( + SketchCircle_7.results()[1], SketchCircle_5.results()[1] +) +SketchConstraintEqual_4 = Sketch_2.setEqual( + SketchCircle_8.results()[1], SketchCircle_6.results()[1] +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_7.results()[1], 0.65) SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_8.results()[1], 0.8) SketchCircle_9 = Sketch_2.addCircle(-2.552173139482203, 4.006109367717388, 0.65) -SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_9.center()) +SketchConstraintCoincidence_30 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_9.center() +) SketchCircle_10 = Sketch_2.addCircle(-4.745479052513825, 0.2071920899853395, 0.65) -SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_10.center()) +SketchConstraintCoincidence_31 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_10.center() +) SketchCircle_11 = Sketch_2.addCircle(-2.552173139482203, 4.006109367717388, 0.8) -SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_11.center()) +SketchConstraintCoincidence_32 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_11.center() +) SketchCircle_12 = Sketch_2.addCircle(-4.745479052513825, 0.2071920899853395, 0.8) -SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchCircle_10.center(), SketchCircle_12.center()) -SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchCircle_9.center(), SketchCircle_11.center()) -SketchConstraintEqual_5 = Sketch_2.setEqual(SketchCircle_6.results()[1], SketchCircle_11.results()[1]) -SketchConstraintEqual_6 = Sketch_2.setEqual(SketchCircle_5.results()[1], SketchCircle_9.results()[1]) -SketchConstraintEqual_7 = Sketch_2.setEqual(SketchCircle_9.results()[1], SketchCircle_10.results()[1]) -SketchConstraintEqual_8 = Sketch_2.setEqual(SketchCircle_11.results()[1], SketchCircle_12.results()[1]) +SketchConstraintCoincidence_33 = Sketch_2.setCoincident( + SketchCircle_10.center(), SketchCircle_12.center() +) +SketchConstraintCoincidence_34 = Sketch_2.setCoincident( + SketchCircle_9.center(), SketchCircle_11.center() +) +SketchConstraintEqual_5 = Sketch_2.setEqual( + SketchCircle_6.results()[1], SketchCircle_11.results()[1] +) +SketchConstraintEqual_6 = Sketch_2.setEqual( + SketchCircle_5.results()[1], SketchCircle_9.results()[1] +) +SketchConstraintEqual_7 = Sketch_2.setEqual( + SketchCircle_9.results()[1], SketchCircle_10.results()[1] +) +SketchConstraintEqual_8 = Sketch_2.setEqual( + SketchCircle_11.results()[1], SketchCircle_12.results()[1] +) SketchLine_15 = Sketch_2.addLine(-2.552173139482203, 4.006109367717388, 0, 0) SketchLine_15.setAuxiliary(True) -SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchCircle_9.center(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_36 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_15.endPoint()) +SketchConstraintCoincidence_35 = Sketch_2.setCoincident( + SketchCircle_9.center(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_36 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_15.endPoint() +) SketchLine_16 = Sketch_2.addLine(-4.745479052513825, 0.2071920899853395, 0, 0) SketchLine_16.setAuxiliary(True) -SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchCircle_10.center(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_16.endPoint()) +SketchConstraintCoincidence_37 = Sketch_2.setCoincident( + SketchCircle_10.center(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_38 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_16.endPoint() +) SketchCircle_13 = Sketch_2.addCircle(-2.193305912870557, -4.213301457594897, 0.8) -SketchConstraintCoincidence_39 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_13.center()) +SketchConstraintCoincidence_39 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_13.center() +) SketchCircle_14 = Sketch_2.addCircle(2.193305912973027, -4.213301457541542, 0.8) -SketchConstraintCoincidence_40 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_14.center()) -SketchConstraintEqual_9 = Sketch_2.setEqual(SketchCircle_14.results()[1], SketchCircle_13.results()[1]) -SketchConstraintEqual_10 = Sketch_2.setEqual(SketchCircle_12.results()[1], SketchCircle_13.results()[1]) +SketchConstraintCoincidence_40 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_14.center() +) +SketchConstraintEqual_9 = Sketch_2.setEqual( + SketchCircle_14.results()[1], SketchCircle_13.results()[1] +) +SketchConstraintEqual_10 = Sketch_2.setEqual( + SketchCircle_12.results()[1], SketchCircle_13.results()[1] +) SketchLine_17 = Sketch_2.addLine(0, 0, -2.193305912870557, -4.213301457594897) SketchLine_17.setAuxiliary(True) -SketchConstraintCoincidence_41 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_17.startPoint()) -SketchConstraintCoincidence_42 = Sketch_2.setCoincident(SketchCircle_13.center(), SketchLine_17.endPoint()) +SketchConstraintCoincidence_41 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_17.startPoint() +) +SketchConstraintCoincidence_42 = Sketch_2.setCoincident( + SketchCircle_13.center(), SketchLine_17.endPoint() +) SketchLine_18 = Sketch_2.addLine(0, 0, 2.193305912973027, -4.213301457541542) SketchLine_18.setAuxiliary(True) -SketchConstraintCoincidence_43 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_18.startPoint()) -SketchConstraintCoincidence_44 = Sketch_2.setCoincident(SketchCircle_14.center(), SketchLine_18.endPoint()) -SketchConstraintAngle_4 = Sketch_2.setAngleBackward(SketchLine_9.result(), SketchLine_14.result(), "angle") -SketchConstraintAngle_5 = Sketch_2.setAngle(SketchLine_9.result(), SketchLine_13.result(), "angle") -SketchConstraintAngle_6 = Sketch_2.setAngleBackward(SketchLine_10.result(), SketchLine_15.result(), "angle") -SketchConstraintAngle_7 = Sketch_2.setAngleBackward(SketchLine_16.result(), SketchLine_10.result(), "angle") -SketchConstraintAngle_8 = Sketch_2.setAngle(SketchLine_17.result(), SketchLine_11.result(), "angle") -SketchConstraintAngle_9 = Sketch_2.setAngle(SketchLine_11.result(), SketchLine_18.result(), "angle") -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchConstraintCoincidence_43 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_18.startPoint() +) +SketchConstraintCoincidence_44 = Sketch_2.setCoincident( + SketchCircle_14.center(), SketchLine_18.endPoint() +) +SketchConstraintAngle_4 = Sketch_2.setAngleBackward( + SketchLine_9.result(), SketchLine_14.result(), "angle" +) +SketchConstraintAngle_5 = Sketch_2.setAngle( + SketchLine_9.result(), SketchLine_13.result(), "angle" +) +SketchConstraintAngle_6 = Sketch_2.setAngleBackward( + SketchLine_10.result(), SketchLine_15.result(), "angle" +) +SketchConstraintAngle_7 = Sketch_2.setAngleBackward( + SketchLine_16.result(), SketchLine_10.result(), "angle" +) +SketchConstraintAngle_8 = Sketch_2.setAngle( + SketchLine_17.result(), SketchLine_11.result(), "angle" +) +SketchConstraintAngle_9 = Sketch_2.setAngle( + SketchLine_11.result(), SketchLine_18.result(), "angle" +) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_19 = SketchProjection_5.createdFeature() SketchCircle_15 = Sketch_2.addCircle(0, 5, 0.45) -SketchConstraintCoincidence_45 = Sketch_2.setCoincident(SketchLine_19.result(), SketchCircle_15.center()) +SketchConstraintCoincidence_45 = Sketch_2.setCoincident( + SketchLine_19.result(), SketchCircle_15.center() +) SketchConstraintRadius_4 = Sketch_2.setRadius(SketchCircle_15.results()[1], 0.45) SketchLine_20 = Sketch_2.addLine(0, 0, 4.385635518227006, -2.793957963403483) SketchLine_20.setAuxiliary(True) -SketchConstraintCoincidence_46 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_46 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_20.startPoint() +) SketchCircle_16 = Sketch_2.addCircle(3.373565783251674, -2.149198433387089, 0.3) -SketchConstraintCoincidence_47 = Sketch_2.setCoincident(SketchLine_20.result(), SketchCircle_16.center()) +SketchConstraintCoincidence_47 = Sketch_2.setCoincident( + SketchLine_20.result(), SketchCircle_16.center() +) SketchCircle_17 = Sketch_2.addCircle(4.385635518227006, -2.793957963403483, 0.5) -SketchConstraintCoincidence_48 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchCircle_17.center()) +SketchConstraintCoincidence_48 = Sketch_2.setCoincident( + SketchLine_20.endPoint(), SketchCircle_17.center() +) SketchConstraintRadius_5 = Sketch_2.setRadius(SketchCircle_16.results()[1], 0.3) SketchConstraintRadius_6 = Sketch_2.setRadius(SketchCircle_17.results()[1], 0.5) -SketchConstraintAngle_10 = Sketch_2.setAngleBackward(SketchLine_14.result(), SketchLine_20.result(), 35.00000000000006) -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchCircle_15.center(), SketchLine_12.result(), 5, True) -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_16.center(), SketchAPI_Line(SketchLine_19).startPoint(), 4, True) -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_19).startPoint(), SketchCircle_17.center(), 5.2, True) +SketchConstraintAngle_10 = Sketch_2.setAngleBackward( + SketchLine_14.result(), SketchLine_20.result(), 35.00000000000006 +) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchCircle_15.center(), SketchLine_12.result(), 5, True +) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_16.center(), SketchAPI_Line(SketchLine_19).startPoint(), 4, True +) +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&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")]) +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&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&Sketch_1/SketchLine_7"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")]) +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()) +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/SketchLine_3"), False) +SketchConstraintCoincidence_50 = Sketch_3.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.startPoint() +) +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()) +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/SketchLine_5"), False) +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/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()) +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/SketchLine_4"), False) +SketchConstraintCoincidence_56 = Sketch_3.setCoincident( + SketchLine_22.endPoint(), SketchLine_24.result() +) +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/SketchLine_4"), False) +SketchConstraintParallel_1 = Sketch_3.setParallel( + SketchLine_25.result(), SketchLine_27.result() +) +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) +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&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")]) +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&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() model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2377.py b/src/FeaturesPlugin/Test/Test2377.py index 4804b0aac..4054d5dce 100644 --- a/src/FeaturesPlugin/Test/Test2377.py +++ b/src/FeaturesPlugin/Test/Test2377.py @@ -24,22 +24,57 @@ 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.039451114922807, 35.51457975986278, -38.45969125214407, -21.30874785591767) -SketchLine_2 = Sketch_1.addLine(-38.45969125214407, -21.30874785591767, 46.08233276157804, -21.30874785591767) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(46.08233276157804, -21.30874785591767, -1.039451114922807, 35.51457975986278) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) +SketchLine_1 = Sketch_1.addLine( + -1.039451114922807, 35.51457975986278, -38.45969125214407, -21.30874785591767 +) +SketchLine_2 = Sketch_1.addLine( + -38.45969125214407, -21.30874785591767, 46.08233276157804, -21.30874785591767 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 46.08233276157804, -21.30874785591767, -1.039451114922807, 35.51457975986278 +) +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_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) +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_2r")], 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() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Extrusion_2, 1) model.testNbSubResults(Extrusion_2, [0]) @@ -49,4 +84,4 @@ model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Extrusion_2, [25446.012037604283250402659177780]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test23885.py b/src/FeaturesPlugin/Test/Test23885.py index 3845c01a7..9a66741b2 100644 --- a/src/FeaturesPlugin/Test/Test23885.py +++ b/src/FeaturesPlugin/Test/Test23885.py @@ -40,19 +40,44 @@ SketchCircle_2 = Sketch_2.addCircle(79, 72, 29.30) model.do() ### Create Extrusion -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0, "Faces|Wires") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], + model.selection(), + 10, + 0, + "Faces|Wires", +) ### Create Extrusion -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r")], model.selection(), 10, 0, "Faces|Wires") +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r")], + model.selection(), + 10, + 0, + "Faces|Wires", +) ### Create Compound -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")]) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_2_1"), + ], +) ### Create ExtrusionCut -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), [model.selection("SOLID", "Compound_1_1_2")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, [], model.selection(), [model.selection("SOLID", "Compound_1_1_2")] +) ### Create Sketch -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Compound_1_1_2/Modified_Face&Extrusion_2_1/To_Face")) +Sketch_3 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Compound_1_1_2/Modified_Face&Extrusion_2_1/To_Face"), +) ### Create SketchCircle SketchCircle_3 = Sketch_3.addCircle(88, 78, 6) @@ -70,4 +95,4 @@ model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.EDGE, [18]) model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.VERTEX, [36]) model.testResultsVolumes(ExtrusionCut_1, [50469.37182]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2394.py b/src/FeaturesPlugin/Test/Test2394.py index af1ad91d9..a64b23a93 100644 --- a/src/FeaturesPlugin/Test/Test2394.py +++ b/src/FeaturesPlugin/Test/Test2394.py @@ -37,136 +37,459 @@ 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) +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) +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) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 58, 0, 0, -58, True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchArc_1.center() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.startPoint() +) SketchLine_2 = Sketch_1.addLine(0, -58, 0, 0) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.endPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.endPoint() +) SketchLine_3 = Sketch_1.addLine(0, 0, 58, 0) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_3.endPoint() +) 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&Sketch_1/SketchLine_3")) +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) SketchLine_7 = Sketch_2.addLine(29, 29, 29, 0) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_4.result()) SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_5.result()) 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&Sketch_1/SketchLine_3][Revolution_1_1/To_Face]"), False) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_6.result(), SketchLine_7.result() +) +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&Sketch_1/SketchLine_3][Revolution_1_1/From_Face]"), False) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_8.result() +) +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()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_4.startPoint(), SketchLine_9.result() +) Extrusion_1.setNestedSketch(Sketch_2) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_1")]) +Split_1 = model.addSplit( + 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", "[Split_1_1_2/Modified_Face&Sketch_2/SketchLine_5&Revolution_1_1/To_Face][Split_1_1_2/Modified_Face&Sketch_2/SketchLine_4&Revolution_1_1/From_Face][Split_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) +Axis_4 = model.addAxis( + Part_1_doc, + model.selection("VERTEX", "Point_1"), + model.selection( + "VERTEX", + "[Split_1_1_2/Modified_Face&Sketch_2/SketchLine_5&Revolution_1_1/To_Face][Split_1_1_2/Modified_Face&Sketch_2/SketchLine_4&Revolution_1_1/From_Face][Split_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&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") -Split_2 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Split_1_1_1")], [model.selection("FACE", "Plane_5")]) -Split_3 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Split_2_1_2")], [model.selection("FACE", "Plane_3")]) -Split_4 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Split_3_1_2")], [model.selection("FACE", "Plane_4")]) +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", +) +Split_2 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Split_1_1_1")], + [model.selection("FACE", "Plane_5")], +) +Split_3 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Split_2_1_2")], + [model.selection("FACE", "Plane_3")], +) +Split_4 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Split_3_1_2")], + [model.selection("FACE", "Plane_4")], +) Split_4.result().setColor(102, 51, 51) Split_4.result().subResult(0).setColor(153, 153, 76) Split_4.result().subResult(1).setColor(0, 204, 204) Split_4.result().subResult(2).setColor(51, 51, 102) Split_4.result().subResult(3).setColor(102, 204, 102) Split_4.result().subResult(4).setColor(204, 204, 0) -Union_1 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Split_4_1_4"), model.selection("SOLID", "Split_4_1_2")]) -Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("FACE", "Plane_2 arrivee tuyau")) +Union_1 = model.addUnion( + Part_1_doc, + [model.selection("SOLID", "Split_4_1_4"), model.selection("SOLID", "Split_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() SketchCircle_1 = Sketch_3.addCircle(0, 0, 10) -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchPoint_2.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchPoint_2.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_3.setRadius(SketchCircle_1.results()[1], "diam_tuyau") SketchLine_10 = Sketch_3.addLine(-5, 5, 5, 5) SketchLine_11 = Sketch_3.addLine(5, 5, 5, -5) SketchLine_12 = Sketch_3.addLine(5, -5, -5, -5) SketchLine_13 = Sketch_3.addLine(-5, -5, -5, 5) -SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_14 = Sketch_3.setCoincident( + SketchLine_13.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_3.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_3.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_10.result()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_11.result()) SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_12.result()) SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_13.result()) -SketchConstraintEqual_2 = Sketch_3.setEqual(SketchLine_10.result(), SketchLine_13.result()) +SketchConstraintEqual_2 = Sketch_3.setEqual( + SketchLine_10.result(), SketchLine_13.result() +) SketchLine_14 = Sketch_3.addLine(5, 5, 7.071067811865479, 7.071067811865475) -SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_18 = Sketch_3.setCoincident( + SketchLine_10.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_19 = Sketch_3.setCoincident( + SketchLine_14.endPoint(), SketchCircle_1.results()[1] +) SketchLine_15 = Sketch_3.addLine(-5, -5, -7.071067811865472, -7.071067811865476) -SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchCircle_1.results()[1]) -SketchConstraintCollinear_1 = Sketch_3.setCollinear(SketchLine_14.result(), SketchLine_15.result()) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident( + SketchLine_12.endPoint(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_21 = Sketch_3.setCoincident( + SketchLine_15.endPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCollinear_1 = Sketch_3.setCollinear( + SketchLine_14.result(), SketchLine_15.result() +) SketchLine_16 = Sketch_3.addLine(7.071067811865478, -7.071067811865476, 5, -5) -SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_16.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_16.endPoint()) +SketchConstraintCoincidence_22 = Sketch_3.setCoincident( + SketchLine_16.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_23 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_16.endPoint() +) SketchLine_17 = Sketch_3.addLine(-5, 5, -7.071067811865472, 7.071067811865476) -SketchConstraintCoincidence_24 = Sketch_3.setCoincident(SketchLine_10.startPoint(), SketchLine_17.startPoint()) -SketchConstraintCoincidence_25 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchCircle_1.results()[1]) -SketchConstraintCollinear_2 = Sketch_3.setCollinear(SketchLine_17.result(), SketchLine_16.result()) -SketchConstraintEqual_3 = Sketch_3.setEqual(SketchLine_14.result(), SketchLine_15.result()) -SketchConstraintEqual_4 = Sketch_3.setEqual(SketchLine_17.result(), SketchLine_16.result()) +SketchConstraintCoincidence_24 = Sketch_3.setCoincident( + SketchLine_10.startPoint(), SketchLine_17.startPoint() +) +SketchConstraintCoincidence_25 = Sketch_3.setCoincident( + SketchLine_17.endPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCollinear_2 = Sketch_3.setCollinear( + SketchLine_17.result(), SketchLine_16.result() +) +SketchConstraintEqual_3 = Sketch_3.setEqual( + SketchLine_14.result(), SketchLine_15.result() +) +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_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_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) +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_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_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) +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()) -SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchPoint_4.result(), SketchArc_2.results()[1]) -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_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) +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() +) +SketchConstraintCoincidence_27 = Sketch_4.setCoincident( + SketchPoint_4.result(), SketchArc_2.results()[1] +) +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_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()) +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/SketchLine_18"), 0, 180) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_2_1")], [model.selection("SOLID", "Extrusion_3_1")]) +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_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]")) +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/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) -Split_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")] -Split_5 = model.addSplit(Part_1_doc, [model.selection("SOLID", "demi-sphere")], Split_5_objects_2) +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, +) +Split_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"), +] +Split_5 = model.addSplit( + Part_1_doc, [model.selection("SOLID", "demi-sphere")], Split_5_objects_2 +) Split_5.result().subResult(0).setName("Split_5_1_1") Split_5.result().subResult(1).setName("Split_5_1_2") Split_5.result().subResult(2).setName("Split_5_1_3") @@ -183,7 +506,11 @@ Split_5.result().subResult(12).setName("Split_5_1_13") Split_5.result().subResult(13).setName("Split_5_1_14") Split_5.result().subResult(14).setName("Split_5_1_15") Split_5.result().subResult(15).setName("Split_5_1_16") -Union_2_objects = [model.selection("SOLID", "Split_5_1_14"), model.selection("SOLID", "Split_5_1_15"), model.selection("SOLID", "Split_5_1_16")] +Union_2_objects = [ + model.selection("SOLID", "Split_5_1_14"), + model.selection("SOLID", "Split_5_1_15"), + model.selection("SOLID", "Split_5_1_16"), +] Union_2 = model.addUnion(Part_1_doc, Union_2_objects) Union_2.result().subResult(0).setName("Union_2_1_1") Union_2.result().subResult(1).setName("Union_2_1_2") @@ -199,7 +526,12 @@ 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_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_3.result().subResult(0).setName("Union_3_1_1") Union_3.result().subResult(1).setName("Union_3_1_2") @@ -212,7 +544,11 @@ 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_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_4.result().subResult(0).setName("Union_4_1_1") Union_4.result().subResult(1).setName("Union_4_1_2") @@ -223,7 +559,11 @@ 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_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_5.result().subResult(0).setName("Union_5_1_1") Union_5.result().subResult(1).setName("Union_5_1_2") @@ -232,7 +572,11 @@ 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_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") @@ -245,7 +589,12 @@ 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_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) Partition_1.result().subResult(0).setColor(255, 255, 0) @@ -295,4 +644,4 @@ model.testResultsVolumes(Partition_1, [103221.354557478349306620657444]) model.end() # too long -#assert(model.checkPythonDump()) +# assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/Test2395.py b/src/FeaturesPlugin/Test/Test2395.py index 0c80f8c2a..80f23e760 100644 --- a/src/FeaturesPlugin/Test/Test2395.py +++ b/src/FeaturesPlugin/Test/Test2395.py @@ -25,16 +25,32 @@ 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(79.57337041028953, 0, 0, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 72.40068540018763) -SketchLine_3 = Sketch_1.addLine(0, 72.40068540018763, 79.57337041028953, 72.40068540018763) -SketchLine_4 = Sketch_1.addLine(79.57337041028953, 72.40068540018763, 79.57337041028953, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_3 = Sketch_1.addLine( + 0, 72.40068540018763, 79.57337041028953, 72.40068540018763 +) +SketchLine_4 = Sketch_1.addLine( + 79.57337041028953, 72.40068540018763, 79.57337041028953, 0 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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()) @@ -42,15 +58,30 @@ 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/SketchLine_1_EndVertex"), 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()) +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/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")], model.selection("EDGE", "Sketch_2/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() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [0]) @@ -60,4 +91,4 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [48]) model.testResultsVolumes(Extrusion_1, [495870.673305030388291925191879272]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2419_1.py b/src/FeaturesPlugin/Test/Test2419_1.py index efe916bf4..8ab2c2422 100644 --- a/src/FeaturesPlugin/Test/Test2419_1.py +++ b/src/FeaturesPlugin/Test/Test2419_1.py @@ -27,92 +27,196 @@ model.addParameter(Part_1_doc, "length_assemblage", "10") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 60, 10, 60) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) SketchLine_3 = Sketch_1.addLine(10, 60, 10, 40) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(10, 40, 20, 40) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(20, 40, 20, 20) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(20, 20, 30, 20) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(30, 20, 30, 0) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.result()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.result() +) SketchLine_9 = Sketch_1.addLine(30, 0, 81.26217508737108, 0) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_8.result()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_8.result() +) SketchLine_10 = Sketch_1.addLine(0, 60, 0, 81.26217508737108) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_2.result() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) 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-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()) +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-34, -3.089278765476956e-34, 76.26217508737108, 0, 0, 76.26217508737108, False) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_2.center()) +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 = 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 = 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, False) -SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), "2*length_assemblage") +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") +SketchConstraintLength_2 = Sketch_1.setLength( + SketchLine_6.result(), "length_assemblage" +) SketchConstraintLength_2.setName("SketchConstraintLength_3") -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_7.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_7.result() +) SketchConstraintEqual_1.setName("SketchConstraintEqual_2") -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_6.result(), SketchLine_4.result()) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_6.result(), SketchLine_4.result() +) SketchConstraintEqual_2.setName("SketchConstraintEqual_3") -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_3.result()) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_3.result() +) SketchConstraintEqual_3.setName("SketchConstraintEqual_4") -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_1.result()) +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/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")]) +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 = 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 = 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 = 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 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_26") SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_12.result()) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_13.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_14.result()) -SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_13.result(), "length_assemblage") +SketchConstraintLength_3 = Sketch_2.setLength( + SketchLine_13.result(), "length_assemblage" +) SketchConstraintLength_3.setName("SketchConstraintLength_1") -SketchConstraintEqual_5 = Sketch_2.setEqual(SketchLine_13.result(), SketchLine_14.result()) +SketchConstraintEqual_5 = Sketch_2.setEqual( + SketchLine_13.result(), SketchLine_14.result() +) 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/Face-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r_wire")]) +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/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") -Split_1 = model.addSplit(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("COMPOUND", "LinearCopy")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + [model.selection("COMPOUND", "LinearCopy")], +) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Split_1, 1) model.testNbSubResults(Split_1, [3]) @@ -121,4 +225,4 @@ model.testNbSubShapes(Split_1, GeomAPI_Shape.FACE, [3]) model.testNbSubShapes(Split_1, GeomAPI_Shape.EDGE, [20]) model.testNbSubShapes(Split_1, GeomAPI_Shape.VERTEX, [40]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2419_2.py b/src/FeaturesPlugin/Test/Test2419_2.py index bb262643d..b63e68093 100644 --- a/src/FeaturesPlugin/Test/Test2419_2.py +++ b/src/FeaturesPlugin/Test/Test2419_2.py @@ -27,78 +27,228 @@ model.addParameter(Part_1_doc, "length_assemblage", "10") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 60, 10, 60) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) SketchLine_3 = Sketch_1.addLine(10, 60, 10, 40) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(10, 40, 20, 40) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(20, 40, 20, 20) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(20, 20, 30, 20) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(30, 20, 30, 0) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.result()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.result() +) SketchLine_9 = Sketch_1.addLine(30, 0, 81.26217508737108, 0) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_8.result()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_8.result() +) SketchLine_10 = Sketch_1.addLine(0, 60, 0, 81.26217508737108) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_2.result() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) 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-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()) +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-34, -3.089278765476956e-34, 76.26217508737108, 0, 0, 76.26217508737108, False) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_2.center()) +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 = 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 = 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, False) -SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), "2*length_assemblage") +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") +SketchConstraintLength_2 = Sketch_1.setLength( + SketchLine_6.result(), "length_assemblage" +) SketchConstraintLength_2.setName("SketchConstraintLength_3") -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_7.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_7.result() +) SketchConstraintEqual_1.setName("SketchConstraintEqual_2") -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_6.result(), SketchLine_4.result()) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_6.result(), SketchLine_4.result() +) SketchConstraintEqual_2.setName("SketchConstraintEqual_3") -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_3.result()) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_3.result() +) SketchConstraintEqual_3.setName("SketchConstraintEqual_4") -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_1.result()) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_4.result(), SketchLine_1.result() +) SketchConstraintEqual_4.setName("SketchConstraintEqual_5") model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_1 = Sketch_2.addCircle(9.082839147404137, 71.32948234489588, 2.005056553640547) -SketchCircle_2 = Sketch_2.addCircle(20.11065019242717, 63.7102674410618, 2.268462537186828) -SketchCircle_3 = Sketch_2.addCircle(26.52683116407693, 51.67992811921848, 2.727171758268866) -SketchCircle_4 = Sketch_2.addCircle(38.35666483055617, 58.29661474623231, 3.007584830460834) -SketchCircle_5 = Sketch_2.addCircle(33.94554041254697, 44.0607132153844, 3.054011155390377) -SketchCircle_6 = Sketch_2.addCircle(48.58245325412298, 42.45666797247195, 2.346858526438435) -SketchCircle_7 = Sketch_2.addCircle(38.95818179664835, 31.42885692744893, 3.547307159201095) -SketchCircle_8 = Sketch_2.addCircle(63.82088306179116, 27.41874382016783, 4.536925074373651) -SketchCircle_9 = Sketch_2.addCircle(50.18649849703544, 28.4212720969881, 4.820482891521984) -SketchCircle_10 = Sketch_2.addCircle(49.58498153094326, 15.18789884296047, 2.552020354335177) -SketchCircle_11 = Sketch_2.addCircle(66.22695092615982, 10.77677442495125, 4.536925074373645) -SketchCircle_12 = Sketch_2.addCircle(50.98852111849166, 6.165144351577979, 3.547307159201085) +SketchCircle_1 = Sketch_2.addCircle( + 9.082839147404137, 71.32948234489588, 2.005056553640547 +) +SketchCircle_2 = Sketch_2.addCircle( + 20.11065019242717, 63.7102674410618, 2.268462537186828 +) +SketchCircle_3 = Sketch_2.addCircle( + 26.52683116407693, 51.67992811921848, 2.727171758268866 +) +SketchCircle_4 = Sketch_2.addCircle( + 38.35666483055617, 58.29661474623231, 3.007584830460834 +) +SketchCircle_5 = Sketch_2.addCircle( + 33.94554041254697, 44.0607132153844, 3.054011155390377 +) +SketchCircle_6 = Sketch_2.addCircle( + 48.58245325412298, 42.45666797247195, 2.346858526438435 +) +SketchCircle_7 = Sketch_2.addCircle( + 38.95818179664835, 31.42885692744893, 3.547307159201095 +) +SketchCircle_8 = Sketch_2.addCircle( + 63.82088306179116, 27.41874382016783, 4.536925074373651 +) +SketchCircle_9 = Sketch_2.addCircle( + 50.18649849703544, 28.4212720969881, 4.820482891521984 +) +SketchCircle_10 = Sketch_2.addCircle( + 49.58498153094326, 15.18789884296047, 2.552020354335177 +) +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/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_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_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_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) @@ -107,51 +257,162 @@ 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/Modified_Vertex&Sketch_1/SketchLine_9_StartVertex&Sketch_1/SketchLine_7_EndVertex"), False) +SketchProjection_1 = Sketch_3.addProjection( + model.selection( + "VERTEX", + "Face_4_1/Modified_Vertex&Sketch_1/SketchLine_9_StartVertex&Sketch_1/SketchLine_7_EndVertex", + ), + False, +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchPoint_1.result()) +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 = 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 = 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 = 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 = Sketch_3.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_26") SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_12.result()) SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_13.result()) SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_14.result()) -SketchConstraintLength_3 = Sketch_3.setLength(SketchLine_13.result(), "length_assemblage") +SketchConstraintLength_3 = Sketch_3.setLength( + SketchLine_13.result(), "length_assemblage" +) SketchConstraintLength_3.setName("SketchConstraintLength_1") -SketchConstraintEqual_5 = Sketch_3.setEqual(SketchLine_13.result(), SketchLine_14.result()) +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/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) +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) +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) +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/MV:Translated&Sketch_3/SketchLine_13_EndVertex&Sketch_3/SketchLine_14_StartVertex")) -LinearCopy_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_3_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 3) +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/MV:Translated&Sketch_3/SketchLine_13_EndVertex&Sketch_3/SketchLine_14_StartVertex", + ), +) +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_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")]) -Split_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")] -Split_1 = model.addSplit(Part_1_doc, [model.selection("COMPOUND", "Partition_1_1")], Split_1_objects_2) +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")], +) +Split_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"), +] +Split_1 = model.addSplit( + Part_1_doc, [model.selection("COMPOUND", "Partition_1_1")], Split_1_objects_2 +) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Split_1, 1) model.testNbSubResults(Split_1, [60]) @@ -160,4 +421,4 @@ model.testNbSubShapes(Split_1, GeomAPI_Shape.FACE, [60]) model.testNbSubShapes(Split_1, GeomAPI_Shape.EDGE, [273]) model.testNbSubShapes(Split_1, GeomAPI_Shape.VERTEX, [546]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2419_3.py b/src/FeaturesPlugin/Test/Test2419_3.py index 19371ff81..3915745d0 100644 --- a/src/FeaturesPlugin/Test/Test2419_3.py +++ b/src/FeaturesPlugin/Test/Test2419_3.py @@ -27,78 +27,228 @@ model.addParameter(Part_1_doc, "length_assemblage", "10") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 60, 10, 60) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) SketchLine_3 = Sketch_1.addLine(10, 60, 10, 40) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(10, 40, 20, 40) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(20, 40, 20, 20) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(20, 20, 30, 20) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(30, 20, 30, 0) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.result()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.result() +) SketchLine_9 = Sketch_1.addLine(30, 0, 81.26217508737108, 0) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_8.result()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_8.result() +) SketchLine_10 = Sketch_1.addLine(0, 60, 0, 81.26217508737108) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_2.result() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) 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-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()) +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-34, -3.089278765476956e-34, 76.26217508737108, 0, 0, 76.26217508737108, False) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_2.center()) +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 = 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 = 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, False) -SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), "2*length_assemblage") +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") +SketchConstraintLength_2 = Sketch_1.setLength( + SketchLine_6.result(), "length_assemblage" +) SketchConstraintLength_2.setName("SketchConstraintLength_3") -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_7.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_7.result() +) SketchConstraintEqual_1.setName("SketchConstraintEqual_2") -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_6.result(), SketchLine_4.result()) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_6.result(), SketchLine_4.result() +) SketchConstraintEqual_2.setName("SketchConstraintEqual_3") -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_3.result()) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_3.result() +) SketchConstraintEqual_3.setName("SketchConstraintEqual_4") -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_1.result()) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_4.result(), SketchLine_1.result() +) SketchConstraintEqual_4.setName("SketchConstraintEqual_5") model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_1 = Sketch_2.addCircle(9.082839147404137, 71.32948234489588, 2.005056553640547) -SketchCircle_2 = Sketch_2.addCircle(20.11065019242717, 63.7102674410618, 2.268462537186828) -SketchCircle_3 = Sketch_2.addCircle(26.52683116407693, 51.67992811921848, 2.727171758268866) -SketchCircle_4 = Sketch_2.addCircle(38.35666483055617, 58.29661474623231, 3.007584830460834) -SketchCircle_5 = Sketch_2.addCircle(33.94554041254697, 44.0607132153844, 3.054011155390377) -SketchCircle_6 = Sketch_2.addCircle(48.58245325412298, 42.45666797247195, 2.346858526438435) -SketchCircle_7 = Sketch_2.addCircle(38.95818179664835, 31.42885692744893, 3.547307159201095) -SketchCircle_8 = Sketch_2.addCircle(63.82088306179116, 27.41874382016783, 4.536925074373651) -SketchCircle_9 = Sketch_2.addCircle(50.18649849703544, 28.4212720969881, 4.820482891521984) -SketchCircle_10 = Sketch_2.addCircle(49.58498153094326, 15.18789884296047, 2.552020354335177) -SketchCircle_11 = Sketch_2.addCircle(66.22695092615982, 10.77677442495125, 4.536925074373645) -SketchCircle_12 = Sketch_2.addCircle(50.98852111849166, 6.165144351577979, 3.547307159201085) +SketchCircle_1 = Sketch_2.addCircle( + 9.082839147404137, 71.32948234489588, 2.005056553640547 +) +SketchCircle_2 = Sketch_2.addCircle( + 20.11065019242717, 63.7102674410618, 2.268462537186828 +) +SketchCircle_3 = Sketch_2.addCircle( + 26.52683116407693, 51.67992811921848, 2.727171758268866 +) +SketchCircle_4 = Sketch_2.addCircle( + 38.35666483055617, 58.29661474623231, 3.007584830460834 +) +SketchCircle_5 = Sketch_2.addCircle( + 33.94554041254697, 44.0607132153844, 3.054011155390377 +) +SketchCircle_6 = Sketch_2.addCircle( + 48.58245325412298, 42.45666797247195, 2.346858526438435 +) +SketchCircle_7 = Sketch_2.addCircle( + 38.95818179664835, 31.42885692744893, 3.547307159201095 +) +SketchCircle_8 = Sketch_2.addCircle( + 63.82088306179116, 27.41874382016783, 4.536925074373651 +) +SketchCircle_9 = Sketch_2.addCircle( + 50.18649849703544, 28.4212720969881, 4.820482891521984 +) +SketchCircle_10 = Sketch_2.addCircle( + 49.58498153094326, 15.18789884296047, 2.552020354335177 +) +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/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_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_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_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) @@ -107,51 +257,162 @@ 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/Modified_Vertex&Sketch_1/SketchLine_9_StartVertex&Sketch_1/SketchLine_7_EndVertex"), False) +SketchProjection_1 = Sketch_3.addProjection( + model.selection( + "VERTEX", + "Face_4_1/Modified_Vertex&Sketch_1/SketchLine_9_StartVertex&Sketch_1/SketchLine_7_EndVertex", + ), + False, +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchPoint_1.result()) +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 = 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 = 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 = 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 = Sketch_3.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_26") SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_12.result()) SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_13.result()) SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_14.result()) -SketchConstraintLength_3 = Sketch_3.setLength(SketchLine_13.result(), "length_assemblage") +SketchConstraintLength_3 = Sketch_3.setLength( + SketchLine_13.result(), "length_assemblage" +) SketchConstraintLength_3.setName("SketchConstraintLength_1") -SketchConstraintEqual_5 = Sketch_3.setEqual(SketchLine_13.result(), SketchLine_14.result()) +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/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) +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) +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) +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/MV:Translated&Sketch_3/SketchLine_13_EndVertex&Sketch_3/SketchLine_14_StartVertex")) -LinearCopy_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_3_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 3) +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/MV:Translated&Sketch_3/SketchLine_13_EndVertex&Sketch_3/SketchLine_14_StartVertex", + ), +) +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) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")]) -Split_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")] -Split_1 = model.addSplit(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], Split_1_objects_2) +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")], +) +Split_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"), +] +Split_1 = model.addSplit( + Part_1_doc, [model.selection("SHELL", "Shell_1_1")], Split_1_objects_2 +) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Split_1, 1) model.testNbSubResults(Split_1, [0]) @@ -160,4 +421,4 @@ model.testNbSubShapes(Split_1, GeomAPI_Shape.FACE, [60]) model.testNbSubShapes(Split_1, GeomAPI_Shape.EDGE, [273]) model.testNbSubShapes(Split_1, GeomAPI_Shape.VERTEX, [546]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2465.py b/src/FeaturesPlugin/Test/Test2465.py index 7ea39b73a..3b8e8c697 100644 --- a/src/FeaturesPlugin/Test/Test2465.py +++ b/src/FeaturesPlugin/Test/Test2465.py @@ -24,12 +24,25 @@ partSet = model.moduleDocument() 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][weak_name_3]"), 10, 2) +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][weak_name_3]"), + 10, + 2, +) model.do() model.end() # check that for the linear copy direction the elliptical edge is invalid from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(not aFactory.validate(LinearCopy_1.feature())) +assert not aFactory.validate(LinearCopy_1.feature()) diff --git a/src/FeaturesPlugin/Test/Test2495.py b/src/FeaturesPlugin/Test/Test2495.py index 0db450774..6681091ba 100644 --- a/src/FeaturesPlugin/Test/Test2495.py +++ b/src/FeaturesPlugin/Test/Test2495.py @@ -31,9 +31,15 @@ model.addParameter(Part_1_doc, "ep", "0.3") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) 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_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +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_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()) @@ -41,68 +47,157 @@ 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_2 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result()) +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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_5 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_5.result()) +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()) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchLine_1.result(), SketchPoint_1.coordinates() +) SketchPoint_2 = Sketch_1.addPoint(153.5, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_4.result()) +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) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_6 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_6.result()) +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_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") 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_6 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchArc_1.startPoint()) +SketchArc_1 = Sketch_1.addArc( + -109.8500000000001, + 21.39999999999999, + -109.8500000000001, + 19.75000000000008, + -109.8500000000001, + 23.04999999999991, + True, +) +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_7 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchArc_2.startPoint()) +SketchArc_2 = Sketch_1.addArc( + -108.1499999999999, + 21.39999999999999, + -108.1499999999999, + 19.75000000000008, + -108.1499999999999, + 23.04999999999991, + False, +) +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 = 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 = 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]) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_7.result(), SketchArc_1.results()[1]) +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] +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchLine_7.result(), SketchArc_1.results()[1] +) SketchLine_9 = Sketch_1.addLine(-111.5, 21.39999999999998, -106.5, 21.40000000000011) SketchLine_9.setName("SketchLine_10") SketchLine_9.result().setName("SketchLine_10") SketchLine_9.setAuxiliary(True) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchArc_1.results()[1]) +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 = 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 = 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 = 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) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.startPoint(), SketchLine_7.result(), 3.3, True +) SketchPoint_3 = Sketch_1.addPoint(0, 21.40000000000294) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_5.result()) +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 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_9.result() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_18") SketchPoint_4 = Sketch_1.addPoint(-109, 21.4) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_9.result()) +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 = 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) -SketchMultiTranslation_1_objects = [SketchArc_1.results()[1], SketchLine_7.result(), SketchLine_8.result(), SketchArc_2.results()[1]] -SketchMultiTranslation_1 = Sketch_1.addTranslation(SketchMultiTranslation_1_objects, SketchPoint_4.coordinates(), SketchPoint_3.coordinates(), 3) -[SketchArc_3, SketchArc_4, SketchLine_10, SketchLine_11, SketchLine_12, SketchLine_13, SketchArc_5, SketchArc_6] = SketchMultiTranslation_1.translated() +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchPoint_4.coordinates(), SketchPoint_3.coordinates(), 109 +) +SketchMultiTranslation_1_objects = [ + SketchArc_1.results()[1], + SketchLine_7.result(), + SketchLine_8.result(), + SketchArc_2.results()[1], +] +SketchMultiTranslation_1 = Sketch_1.addTranslation( + SketchMultiTranslation_1_objects, + SketchPoint_4.coordinates(), + SketchPoint_3.coordinates(), + 3, +) +[ + SketchArc_3, + SketchArc_4, + SketchLine_10, + SketchLine_11, + SketchLine_12, + SketchLine_13, + SketchArc_5, + SketchArc_6, +] = SketchMultiTranslation_1.translated() SketchArc_5.setName("SketchArc_4") SketchArc_5.result().setName("SketchArc_4") SketchArc_5.results()[1].setName("SketchArc_4_2") @@ -117,14 +212,59 @@ SketchLine_10.result().setName("SketchLine_11") SketchArc_4.setName("SketchArc_5") 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) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchPoint_4.coordinates(), SketchLine_6.result(), 21.4, True +) SketchPoint_5 = Sketch_1.addPoint(0, -21) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_5.result()) +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) -[SketchArc_7, SketchLine_14, SketchLine_15, SketchArc_8, SketchLine_10, SketchLine_16, SketchArc_5, SketchArc_9, SketchLine_12, SketchLine_17, SketchArc_3, SketchArc_10, SketchArc_4, SketchArc_11, SketchLine_13, SketchLine_18, SketchLine_11, SketchLine_19, SketchArc_6, SketchArc_12] = SketchMultiTranslation_2.translated() +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, +) +[ + SketchArc_7, + SketchLine_14, + SketchLine_15, + SketchArc_8, + SketchLine_10, + SketchLine_16, + SketchArc_5, + SketchArc_9, + SketchLine_12, + SketchLine_17, + SketchArc_3, + SketchArc_10, + SketchArc_4, + SketchArc_11, + SketchLine_13, + SketchLine_18, + SketchLine_11, + SketchLine_19, + SketchArc_6, + SketchArc_12, +] = SketchMultiTranslation_2.translated() SketchLine_19.setName("SketchLine_20") SketchLine_19.result().setName("SketchLine_20") SketchLine_18.setName("SketchLine_19") @@ -155,55 +295,168 @@ SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_22.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_23.result()) 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) +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_18 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchArc_13.startPoint()) +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 = 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 = 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 = 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_22 = Sketch_1.setCoincident(SketchArc_14.startPoint(), SketchLine_21.endPoint()) +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_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 = 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 = 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 = 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_26 = Sketch_1.setCoincident(SketchArc_15.endPoint(), SketchLine_20.startPoint()) +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_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 = 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 = 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 = 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_30 = Sketch_1.setCoincident(SketchArc_16.startPoint(), SketchLine_22.endPoint()) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchArc_15.results()[1], SketchArc_16.results()[1] +) +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 = 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 = 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 = 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) +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_34 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_20.result()) +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) -[SketchLine_24, SketchLine_25, SketchLine_26, SketchLine_27, SketchLine_28, SketchArc_17, SketchArc_18, SketchArc_19, SketchArc_20, SketchArc_21, SketchLine_29, SketchLine_30, SketchLine_31, SketchLine_32, SketchLine_33, SketchArc_22, SketchArc_23, SketchArc_24, SketchArc_25, SketchArc_26, SketchArc_27, SketchArc_28, SketchArc_29, SketchArc_30, SketchArc_31, SketchLine_34, SketchLine_35, SketchLine_36, SketchLine_37, SketchLine_38, SketchLine_39, SketchLine_40, SketchLine_41, SketchLine_42, SketchLine_43, SketchArc_32, SketchArc_33, SketchArc_34, SketchArc_35, SketchArc_36] = SketchMultiTranslation_3.translated() +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, +) +[ + SketchLine_24, + SketchLine_25, + SketchLine_26, + SketchLine_27, + SketchLine_28, + SketchArc_17, + SketchArc_18, + SketchArc_19, + SketchArc_20, + SketchArc_21, + SketchLine_29, + SketchLine_30, + SketchLine_31, + SketchLine_32, + SketchLine_33, + SketchArc_22, + SketchArc_23, + SketchArc_24, + SketchArc_25, + SketchArc_26, + SketchArc_27, + SketchArc_28, + SketchArc_29, + SketchArc_30, + SketchArc_31, + SketchLine_34, + SketchLine_35, + SketchLine_36, + SketchLine_37, + SketchLine_38, + SketchLine_39, + SketchLine_40, + SketchLine_41, + SketchLine_42, + SketchLine_43, + SketchArc_32, + SketchArc_33, + SketchArc_34, + SketchArc_35, + SketchArc_36, +] = SketchMultiTranslation_3.translated() SketchArc_32.setName("SketchArc_20") SketchArc_32.result().setName("SketchArc_20") SketchArc_32.results()[1].setName("SketchArc_20_2") @@ -290,12 +543,159 @@ 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_35 = Sketch_1.setCoincident(SketchPoint_7.coordinates(), SketchLine_23.result()) +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) -[SketchLine_44, SketchArc_21, SketchArc_37, SketchLine_45, SketchArc_38, SketchLine_41, SketchLine_46, SketchLine_37, SketchLine_47, SketchLine_38, SketchLine_48, SketchArc_33, SketchArc_39, SketchLine_43, SketchLine_49, SketchLine_24, SketchLine_50, SketchLine_42, SketchLine_51, SketchArc_40, SketchArc_31, SketchArc_41, SketchLine_36, SketchLine_52, SketchLine_28, SketchLine_53, SketchArc_19, SketchArc_42, SketchLine_54, SketchArc_36, SketchArc_43, SketchArc_44, SketchArc_24, SketchArc_45, SketchLine_31, SketchLine_55, SketchArc_32, SketchArc_46, SketchArc_20, SketchArc_47, SketchLine_27, SketchLine_56, SketchLine_34, SketchLine_57, SketchArc_30, SketchArc_48, SketchLine_39, SketchLine_58, SketchArc_25, SketchArc_49, SketchArc_34, SketchArc_50, SketchArc_18, SketchArc_51, SketchLine_40, SketchLine_59, SketchLine_35, SketchLine_60, SketchArc_35, SketchArc_52, SketchArc_28, SketchArc_53, SketchLine_32, SketchLine_61, SketchArc_22, SketchArc_54, SketchArc_26, SketchArc_55, SketchLine_26, SketchLine_62, SketchLine_30, SketchLine_63, SketchArc_56, SketchLine_33, SketchLine_64, SketchLine_29, SketchLine_65, SketchLine_66, SketchLine_25, SketchLine_67, SketchArc_29, SketchArc_57, SketchArc_23, SketchArc_58, SketchArc_27, SketchArc_59, SketchArc_17, SketchArc_60] = SketchMultiTranslation_4.translated() +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, +) +[ + SketchLine_44, + SketchArc_21, + SketchArc_37, + SketchLine_45, + SketchArc_38, + SketchLine_41, + SketchLine_46, + SketchLine_37, + SketchLine_47, + SketchLine_38, + SketchLine_48, + SketchArc_33, + SketchArc_39, + SketchLine_43, + SketchLine_49, + SketchLine_24, + SketchLine_50, + SketchLine_42, + SketchLine_51, + SketchArc_40, + SketchArc_31, + SketchArc_41, + SketchLine_36, + SketchLine_52, + SketchLine_28, + SketchLine_53, + SketchArc_19, + SketchArc_42, + SketchLine_54, + SketchArc_36, + SketchArc_43, + SketchArc_44, + SketchArc_24, + SketchArc_45, + SketchLine_31, + SketchLine_55, + SketchArc_32, + SketchArc_46, + SketchArc_20, + SketchArc_47, + SketchLine_27, + SketchLine_56, + SketchLine_34, + SketchLine_57, + SketchArc_30, + SketchArc_48, + SketchLine_39, + SketchLine_58, + SketchArc_25, + SketchArc_49, + SketchArc_34, + SketchArc_50, + SketchArc_18, + SketchArc_51, + SketchLine_40, + SketchLine_59, + SketchLine_35, + SketchLine_60, + SketchArc_35, + SketchArc_52, + SketchArc_28, + SketchArc_53, + SketchLine_32, + SketchLine_61, + SketchArc_22, + SketchArc_54, + SketchArc_26, + SketchArc_55, + SketchLine_26, + SketchLine_62, + SketchLine_30, + SketchLine_63, + SketchArc_56, + SketchLine_33, + SketchLine_64, + SketchLine_29, + SketchLine_65, + SketchLine_66, + SketchLine_25, + SketchLine_67, + SketchArc_29, + SketchArc_57, + SketchArc_23, + SketchArc_58, + SketchArc_27, + SketchArc_59, + SketchArc_17, + SketchArc_60, +] = SketchMultiTranslation_4.translated() SketchLine_67.setName("SketchLine_68") SketchLine_67.result().setName("SketchLine_68") SketchLine_66.setName("SketchLine_67") @@ -344,53 +744,144 @@ SketchLine_45.setName("SketchLine_46") SketchLine_45.result().setName("SketchLine_46") SketchLine_44.setName("SketchLine_45") SketchLine_44.result().setName("SketchLine_45") -SketchLine_68 = Sketch_1.addLine(-153.5, 16.19999999999975, -152.2999999999999, 16.20000000000002) +SketchLine_68 = Sketch_1.addLine( + -153.5, 16.19999999999975, -152.2999999999999, 16.20000000000002 +) SketchLine_68.setName("SketchLine_69") SketchLine_68.result().setName("SketchLine_69") -SketchLine_69 = Sketch_1.addLine(-150.7999999999999, 14.70000000000003, -150.7999999999999, 9.699999999999999) +SketchLine_69 = Sketch_1.addLine( + -150.7999999999999, 14.70000000000003, -150.7999999999999, 9.699999999999999 +) SketchLine_69.setName("SketchLine_70") SketchLine_69.result().setName("SketchLine_70") -SketchLine_70 = Sketch_1.addLine(-152.2999999999999, 8.199999999999999, -153.4999999999999, 8.199999999999999) +SketchLine_70 = Sketch_1.addLine( + -152.2999999999999, 8.199999999999999, -153.4999999999999, 8.199999999999999 +) SketchLine_70.setName("SketchLine_71") SketchLine_70.result().setName("SketchLine_71") 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_36 = Sketch_1.setCoincident(SketchArc_61.startPoint(), SketchLine_69.startPoint()) +SketchArc_61 = Sketch_1.addArc( + -152.2999999999999, + 14.70000000000002, + -150.7999999999999, + 14.70000000000003, + -152.2999999999999, + 16.20000000000002, + False, +) +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 = 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_38 = Sketch_1.setCoincident(SketchArc_62.startPoint(), SketchLine_70.startPoint()) +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_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 = 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) -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_70.endPoint(), SketchLine_69.result(), 2.7, True) +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 +) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_70.endPoint(), SketchLine_69.result(), 2.7, True +) 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) +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_40 = Sketch_1.setCoincident(SketchPoint_8.coordinates(), SketchLine_2.result()) +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) -[SketchLine_71, SketchArc_63, SketchLine_72, SketchArc_64, SketchLine_73] = SketchMultiTranslation_5.translated() +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, +) +[ + SketchLine_71, + SketchArc_63, + SketchLine_72, + SketchArc_64, + SketchLine_73, +] = SketchMultiTranslation_5.translated() SketchLine_73.setName("SketchLine_74") SketchLine_73.result().setName("SketchLine_74") SketchLine_72.setName("SketchLine_73") SketchLine_72.result().setName("SketchLine_73") SketchLine_71.setName("SketchLine_72") SketchLine_71.result().setName("SketchLine_72") -SketchConstraintMirror_1_objects = [SketchLine_68.result(), SketchArc_61.results()[1], SketchLine_69.result(), SketchArc_62.results()[1], SketchLine_70.result(), SketchLine_71.result(), SketchArc_63.results()[1], SketchLine_72.result(), SketchArc_64.results()[1], SketchLine_73.result()] -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_5.result(), SketchConstraintMirror_1_objects) -[SketchLine_74, SketchArc_65, SketchLine_75, SketchArc_66, SketchLine_76, SketchLine_77, SketchArc_67, SketchLine_78, SketchArc_68, SketchLine_79] = SketchConstraintMirror_1.mirrored() +SketchConstraintMirror_1_objects = [ + SketchLine_68.result(), + SketchArc_61.results()[1], + SketchLine_69.result(), + SketchArc_62.results()[1], + SketchLine_70.result(), + SketchLine_71.result(), + SketchArc_63.results()[1], + SketchLine_72.result(), + SketchArc_64.results()[1], + SketchLine_73.result(), +] +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_5.result(), SketchConstraintMirror_1_objects +) +[ + SketchLine_74, + SketchArc_65, + SketchLine_75, + SketchArc_66, + SketchLine_76, + SketchLine_77, + SketchArc_67, + SketchLine_78, + SketchArc_68, + SketchLine_79, +] = SketchConstraintMirror_1.mirrored() SketchLine_79.setName("SketchLine_80") SketchLine_79.result().setName("SketchLine_80") SketchLine_78.setName("SketchLine_79") @@ -403,167 +894,343 @@ SketchLine_75.setName("SketchLine_76") SketchLine_75.result().setName("SketchLine_76") SketchLine_74.setName("SketchLine_75") SketchLine_74.result().setName("SketchLine_75") -SketchLine_80 = Sketch_1.addLine(-153.4999999999999, 8.199999999999999, -153.5, -7.799999999999947) +SketchLine_80 = Sketch_1.addLine( + -153.4999999999999, 8.199999999999999, -153.5, -7.799999999999947 +) SketchLine_80.setName("SketchLine_81") SketchLine_80.result().setName("SketchLine_81") -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_2.result(), SketchLine_80.result()) -SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchLine_70.endPoint(), SketchLine_80.startPoint()) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_2.result(), SketchLine_80.result() +) +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 = 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 = 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_43 = Sketch_1.setCoincident(SketchLine_81.startPoint(), SketchLine_73.result()) +SketchConstraintCollinear_2 = Sketch_1.setCollinear( + SketchLine_80.result(), SketchLine_81.result() +) +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 = 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_45 = 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()) +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") SketchLine_83 = Sketch_1.addLine(153.5, -7.800000000000278, 153.5, 8.199999999999999) SketchLine_83.setName("SketchLine_84") SketchLine_83.result().setName("SketchLine_84") -SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchLine_83.endPoint(), SketchLine_76.result()) +SketchConstraintCoincidence_47 = Sketch_1.setCoincident( + SketchLine_83.endPoint(), SketchLine_76.result() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_57") -SketchConstraintCollinear_4 = Sketch_1.setCollinear(SketchLine_4.result(), SketchLine_83.result()) -SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_79.result()) +SketchConstraintCollinear_4 = Sketch_1.setCollinear( + SketchLine_4.result(), SketchLine_83.result() +) +SketchConstraintCoincidence_48 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_79.result() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_58") -SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchLine_83.startPoint(), SketchLine_77.result()) +SketchConstraintCoincidence_49 = Sketch_1.setCoincident( + SketchLine_83.startPoint(), SketchLine_77.result() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_59") -SketchLine_84 = Sketch_1.addLine(-153.5, -22.70000000003739, -151.5000000000398, -24.69999999999951) +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.0000000000272) -SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchLine_84.startPoint(), SketchLine_81.endPoint()) +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()) +SketchConstraintCoincidence_51 = Sketch_1.setCoincident( + SketchLine_84.endPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_60") -SketchConstraintDistance_12 = Sketch_1.setDistance(SketchLine_84.startPoint(), SketchLine_3.result(), 2, True) -SketchConstraintDistance_13 = Sketch_1.setDistance(SketchLine_84.endPoint(), SketchLine_1.result(), "55.4-rext_1-rext_2", True) -SketchConstraintMirror_2 = Sketch_1.addMirror(SketchLine_5.result(), [SketchLine_84.result()]) +SketchConstraintDistance_12 = Sketch_1.setDistance( + SketchLine_84.startPoint(), SketchLine_3.result(), 2, True +) +SketchConstraintDistance_13 = Sketch_1.setDistance( + SketchLine_84.endPoint(), SketchLine_1.result(), "55.4-rext_1-rext_2", True +) +SketchConstraintMirror_2 = Sketch_1.addMirror( + SketchLine_5.result(), [SketchLine_84.result()] +) [SketchLine_85] = SketchConstraintMirror_2.mirrored() SketchLine_85.setName("SketchLine_86") SketchLine_85.result().setName("SketchLine_86") -SketchConstraintCoincidence_52 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_85.result()) +SketchConstraintCoincidence_52 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_85.result() +) SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_61") -SketchConstraintCoincidence_53 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_85.result()) +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/SketchLine_4_EndVertex")) +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/SketchLine_1_StartVertex"), 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()) +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/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") -SketchConstraintTangent_9 = Sketch_2.setTangent(SketchLine_86.result(), SketchArc_69.results()[1]) +SketchConstraintTangent_9 = Sketch_2.setTangent( + SketchLine_86.result(), SketchArc_69.results()[1] +) SketchLine_87 = Sketch_2.addLine(27.70000001097709, 0.85, 28.55000001097708, 0.85) SketchLine_87.setName("SketchLine_88") SketchLine_87.result().setName("SketchLine_88") SketchLine_87.setAuxiliary(True) -SketchConstraintCoincidence_55 = Sketch_2.setCoincident(SketchArc_69.center(), SketchLine_87.startPoint()) +SketchConstraintCoincidence_55 = Sketch_2.setCoincident( + SketchArc_69.center(), SketchLine_87.startPoint() +) SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_65") -SketchConstraintCoincidence_56 = Sketch_2.setCoincident(SketchArc_69.endPoint(), SketchLine_87.endPoint()) +SketchConstraintCoincidence_56 = Sketch_2.setCoincident( + SketchArc_69.endPoint(), SketchLine_87.endPoint() +) SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_66") SketchConstraintHorizontal_9 = Sketch_2.setHorizontal(SketchLine_87.result()) SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_69.results()[1], "rext_1-ep/2") SketchLine_88 = Sketch_2.addLine(28.55000001097708, 0.85, 28.55000000874763, 10.85) SketchLine_88.setName("SketchLine_89") SketchLine_88.result().setName("SketchLine_89") -SketchConstraintCoincidence_57 = Sketch_2.setCoincident(SketchArc_69.endPoint(), SketchLine_88.startPoint()) +SketchConstraintCoincidence_57 = Sketch_2.setCoincident( + SketchArc_69.endPoint(), SketchLine_88.startPoint() +) 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/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/SketchLine_3_EndVertex")) +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/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/SketchLine_3_EndVertex"), 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-14, -26.54999999999951, 1.85, True) -SketchConstraintCoincidence_58 = Sketch_3.setCoincident(SketchPoint_10.result(), SketchArc_70.startPoint()) +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) SketchLine_89.setName("SketchLine_90") SketchLine_89.result().setName("SketchLine_90") SketchLine_89.setAuxiliary(True) -SketchConstraintCoincidence_59 = Sketch_3.setCoincident(SketchArc_70.endPoint(), SketchLine_89.startPoint()) +SketchConstraintCoincidence_59 = Sketch_3.setCoincident( + SketchArc_70.endPoint(), SketchLine_89.startPoint() +) SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_69") -SketchConstraintCoincidence_60 = Sketch_3.setCoincident(SketchArc_70.center(), SketchLine_89.endPoint()) +SketchConstraintCoincidence_60 = Sketch_3.setCoincident( + SketchArc_70.center(), SketchLine_89.endPoint() +) SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_70") SketchConstraintHorizontal_10 = Sketch_3.setHorizontal(SketchLine_89.result()) SketchLine_90 = Sketch_3.addLine(-24.69999999999951, 1.85, -24.69999999999977, 0) SketchLine_90.setName("SketchLine_91") SketchLine_90.result().setName("SketchLine_91") SketchLine_90.setAuxiliary(True) -SketchConstraintCoincidence_61 = Sketch_3.setCoincident(SketchArc_70.center(), SketchLine_90.startPoint()) +SketchConstraintCoincidence_61 = Sketch_3.setCoincident( + SketchArc_70.center(), SketchLine_90.startPoint() +) SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_71") -SketchConstraintCoincidence_62 = Sketch_3.setCoincident(SketchAPI_Point(SketchPoint_10).coordinates(), SketchLine_90.endPoint()) +SketchConstraintCoincidence_62 = Sketch_3.setCoincident( + SketchAPI_Point(SketchPoint_10).coordinates(), SketchLine_90.endPoint() +) SketchConstraintCoincidence_62.setName("SketchConstraintCoincidence_72") SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_90.result()) SketchLine_91 = Sketch_3.addLine(-26.54999999999951, 1.85, -26.54999999999951, 11.85) SketchLine_91.setName("SketchLine_92") SketchLine_91.result().setName("SketchLine_92") -SketchConstraintCoincidence_63 = Sketch_3.setCoincident(SketchArc_70.endPoint(), SketchLine_91.startPoint()) +SketchConstraintCoincidence_63 = Sketch_3.setCoincident( + SketchArc_70.endPoint(), SketchLine_91.startPoint() +) SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_73") 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/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_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")]) +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_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/ME:Translated&Extrusion_2_1/To_Edge"), 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"), False) +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"), False +) SketchLine_93 = SketchProjection_7.createdFeature() SketchLine_93.setName("SketchLine_94") SketchLine_93.result().setName("SketchLine_94") -SketchProjection_8 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_8 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_94 = SketchProjection_8.createdFeature() SketchLine_94.setName("SketchLine_95") SketchLine_94.result().setName("SketchLine_95") -SketchConstraintDistance_15 = Sketch_4.setDistance(SketchCircle_1.center(), SketchLine_94.result(), 5.5, True) +SketchConstraintDistance_15 = Sketch_4.setDistance( + SketchCircle_1.center(), SketchLine_94.result(), 5.5, True +) SketchConstraintRadius_5 = Sketch_4.setRadius(SketchCircle_1.results()[1], "3.3/2") SketchPoint_11 = Sketch_4.addPoint(29.50000000003768, 5.5) SketchLine_95 = Sketch_4.addLine(29.50000000003768, 5.5, 96.50000000003769, 5.5) SketchLine_95.setName("SketchLine_96") SketchLine_95.result().setName("SketchLine_96") SketchLine_95.setAuxiliary(True) -SketchConstraintCoincidence_64 = Sketch_4.setCoincident(SketchPoint_11.coordinates(), SketchLine_95.startPoint()) +SketchConstraintCoincidence_64 = Sketch_4.setCoincident( + SketchPoint_11.coordinates(), SketchLine_95.startPoint() +) SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_74") -SketchConstraintCoincidence_65 = Sketch_4.setCoincident(SketchCircle_1.center(), SketchLine_95.endPoint()) +SketchConstraintCoincidence_65 = Sketch_4.setCoincident( + SketchCircle_1.center(), SketchLine_95.endPoint() +) SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_75") SketchConstraintHorizontal_11 = Sketch_4.setHorizontal(SketchLine_95.result()) 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) +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/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_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_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", "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_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() # check that naming after remove sub-shapes feature applying is correct diff --git a/src/FeaturesPlugin/Test/Test2514.py b/src/FeaturesPlugin/Test/Test2514.py index 35dcd9e31..d67019614 100644 --- a/src/FeaturesPlugin/Test/Test2514.py +++ b/src/FeaturesPlugin/Test/Test2514.py @@ -28,143 +28,252 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(15, 17, 15, -3) SketchLine_2 = Sketch_1.addLine(15, -3, 0, -3) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_3 = SketchProjection_1.createdFeature() SketchLine_3.setName("SketchLine_4") SketchLine_3.result().setName("SketchLine_4") SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.result() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_4") SketchArc_1 = Sketch_1.addArc(0, -8.980762113533162, 0, 21.01923788646684, 15, 17, True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.result(), SketchArc_1.center()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchArc_1.center() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_5") SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 15) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 20) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_7") SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 30) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_4 = SketchProjection_2.createdFeature() SketchLine_4.setName("SketchLine_5") SketchLine_4.result().setName("SketchLine_5") -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_4.result(), 3, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_2.startPoint(), SketchLine_4.result(), 3, True +) SketchLine_5 = Sketch_1.addLine(15, 0, 16, 0) SketchLine_5.setName("SketchLine_6") SketchLine_5.result().setName("SketchLine_6") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_1.result() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_8") -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_4.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_4.result() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_9") SketchLine_6 = Sketch_1.addLine(16, 0, 16, -3) SketchLine_6.setName("SketchLine_7") SketchLine_6.result().setName("SketchLine_7") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_10") SketchLine_7 = Sketch_1.addLine(16, -3, 15, -3) SketchLine_7.setName("SketchLine_8") SketchLine_7.result().setName("SketchLine_8") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_11") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_7.endPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_12") SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_4.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_4.result() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_13") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchLine_2.result() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_14") SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 1) SketchLine_8 = Sketch_1.addLine(15, 0, 0, 0) SketchLine_8.setName("SketchLine_9") SketchLine_8.result().setName("SketchLine_9") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_15") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_3).startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_3).startPoint(), SketchLine_8.endPoint() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_16") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.result()) +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/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_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) +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/SketchLine_2_EndVertex"), 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/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") SketchLine_10 = Sketch_2.addLine(1.5, -3, -1.5, -3) SketchLine_10.setName("SketchLine_10") SketchLine_10.result().setName("SketchLine_10") -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchLine_9.result()) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_10.startPoint(), SketchLine_9.result() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_18") SketchLine_11 = Sketch_2.addLine(-1.5, -3, -1, -5) SketchLine_11.setName("SketchLine_12") SketchLine_11.result().setName("SketchLine_12") -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_19") SketchLine_12 = Sketch_2.addLine(-1, -5, 1, -5) SketchLine_12.setName("SketchLine_13") SketchLine_12.result().setName("SketchLine_13") -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_20") SketchLine_13 = Sketch_2.addLine(1, -5, 1.5, -3) SketchLine_13.setName("SketchLine_14") SketchLine_13.result().setName("SketchLine_14") -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_21") -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchLine_13.endPoint()) +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-26, -5) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_12.result()) +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_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint( + SketchPoint_2.coordinates(), SketchLine_12.result() +) +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 = 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) +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()) +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/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_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) +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_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) +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 = 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 = 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 = Sketch_3.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_28") -SketchConstraintCoincidence_25 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchCircle_1.results()[1]) +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 = 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()) +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()]) +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") @@ -176,131 +285,228 @@ 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 = 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 = Sketch_3.setCoincident( + SketchLine_21.endPoint(), SketchLine_22.startPoint() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_32") -SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False) +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 = 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_30 = Sketch_3.setCoincident(SketchAPI_Circle(SketchCircle_1).center(), SketchArc_2.center()) +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 = 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 = Sketch_3.setCoincident( + SketchArc_2.endPoint(), SketchLine_22.endPoint() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_36") SketchPoint_3 = Sketch_3.addPoint(2, 0) -SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_21.result()) +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 = 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()) +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 = 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 = 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) +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 = 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) +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) +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 = 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 = 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 = 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 = 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 = 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) +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 = 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 = 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) +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 = 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 = 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) +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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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()) +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() +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") @@ -313,4 +519,4 @@ model.do() model.do() model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2520.py b/src/FeaturesPlugin/Test/Test2520.py index e0291430c..c94fa89e6 100644 --- a/src/FeaturesPlugin/Test/Test2520.py +++ b/src/FeaturesPlugin/Test/Test2520.py @@ -28,28 +28,56 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) 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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(18, 10, 63, 10) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(63, 10, 63, 8.999999999999995) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(63, 8.999999999999995, 66, 8.999999999999995) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(66, 8.999999999999995, 66, 18) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(66, 18, 70, 18) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(70, 18, 70, 6.999999999999999) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +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()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) 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-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-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()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +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-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()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_3.result()) @@ -61,27 +89,58 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_2.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_12.result()) SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_8.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_12.startPoint(), SketchLine_8.result(), 70, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_12.startPoint(), SketchLine_8.result(), 70, True +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 18) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_4.startPoint(), SketchLine_5.result(), 1, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_4.startPoint(), SketchLine_5.result(), 1, True +) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_5.result(), 3) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 4) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_7.endPoint(), SketchLine_11.result(), 18, True) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_7.endPoint(), SketchLine_11.result(), 18, True +) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_12.result(), 6) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_12.startPoint(), SketchLine_3.result(), 10, True) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_11.startPoint(), SketchLine_8.result(), 36, True) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_11.startPoint(), SketchLine_9.result(), 7, True) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_12.startPoint(), SketchLine_3.result(), 10, True +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_11.startPoint(), SketchLine_8.result(), 36, True +) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_11.startPoint(), SketchLine_9.result(), 7, True +) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_9.result(), 32) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_12.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_12.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates() +) SketchLine_13 = Sketch_1.addLine(0, 0, 70, 0) SketchLine_13.setAuxiliary(True) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_13.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_13.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates() +) SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_13.result()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_8.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_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) +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) diff --git a/src/FeaturesPlugin/Test/Test2545.py b/src/FeaturesPlugin/Test/Test2545.py index b341118f3..97732c78c 100644 --- a/src/FeaturesPlugin/Test/Test2545.py +++ b/src/FeaturesPlugin/Test/Test2545.py @@ -26,13 +26,21 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() ParamR = model.addParameter(Part_1_doc, "R", "100") 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) +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/SketchArc_1_2")]) model.do() radius = model.measureRadius(Part_1_doc, model.selection("EDGE", "Edge_1_1")) -assert(math.fabs(radius - ParamR.value()) < 1.e-7) +assert math.fabs(radius - ParamR.value()) < 1.0e-7 model.end() diff --git a/src/FeaturesPlugin/Test/Test2588.py b/src/FeaturesPlugin/Test/Test2588.py index 3eba0381b..e4f67f283 100644 --- a/src/FeaturesPlugin/Test/Test2588.py +++ b/src/FeaturesPlugin/Test/Test2588.py @@ -27,20 +27,47 @@ 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(0, 0, 2) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates()) +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_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) +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 +from GeomAPI import GeomAPI_Shape model.testNbSubShapes(AngularCopy_1, GeomAPI_Shape.SOLID, [48]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2592.py b/src/FeaturesPlugin/Test/Test2592.py index 0a2988d84..eed9b484f 100644 --- a/src/FeaturesPlugin/Test/Test2592.py +++ b/src/FeaturesPlugin/Test/Test2592.py @@ -24,10 +24,20 @@ 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_2 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_1_1_1")], model.selection("EDGE", "PartSet/OX"), 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 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2596.py b/src/FeaturesPlugin/Test/Test2596.py index e527ab72e..ef8128339 100644 --- a/src/FeaturesPlugin/Test/Test2596.py +++ b/src/FeaturesPlugin/Test/Test2596.py @@ -24,29 +24,60 @@ 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(-32.04974271012008, 18.88336192109778, 25.20058663660772) +SketchCircle_1 = Sketch_1.addCircle( + -32.04974271012008, 18.88336192109778, 25.20058663660772 +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_2.addLine(22.00171526586623, 64.27272727272731, -86.7941680960549, 64.27272727272731) -SketchLine_2 = Sketch_2.addLine(-86.7941680960549, 64.27272727272731, -86.7941680960549, -27.54545454545455) -SketchLine_3 = Sketch_2.addLine(-86.7941680960549, -27.54545454545455, 22.00171526586623, -27.54545454545455) -SketchLine_4 = Sketch_2.addLine(22.00171526586623, -27.54545454545455, 22.00171526586623, 64.27272727272731) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_1 = Sketch_2.addLine( + 22.00171526586623, 64.27272727272731, -86.7941680960549, 64.27272727272731 +) +SketchLine_2 = Sketch_2.addLine( + -86.7941680960549, 64.27272727272731, -86.7941680960549, -27.54545454545455 +) +SketchLine_3 = Sketch_2.addLine( + -86.7941680960549, -27.54545454545455, 22.00171526586623, -27.54545454545455 +) +SketchLine_4 = Sketch_2.addLine( + 22.00171526586623, -27.54545454545455, 22.00171526586623, 64.27272727272731 +) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_1.result()) 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_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")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Smash_1, 1) model.testNbSubResults(Smash_1, [0]) @@ -55,4 +86,4 @@ model.testNbSubShapes(Smash_1, GeomAPI_Shape.FACE, [1]) model.testNbSubShapes(Smash_1, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Smash_1, GeomAPI_Shape.VERTEX, [8]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2617.py b/src/FeaturesPlugin/Test/Test2617.py index 474c4f66d..2888cf758 100644 --- a/src/FeaturesPlugin/Test/Test2617.py +++ b/src/FeaturesPlugin/Test/Test2617.py @@ -23,10 +23,33 @@ 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")]) +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() @@ -41,4 +64,4 @@ 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()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2631.py b/src/FeaturesPlugin/Test/Test2631.py index cbd8e3213..b5815da35 100644 --- a/src/FeaturesPlugin/Test/Test2631.py +++ b/src/FeaturesPlugin/Test/Test2631.py @@ -26,30 +26,68 @@ 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(-53.93497380447579, 58.11303515552675, 60.01215395145899, 58.11303515552675) -SketchLine_2 = Sketch_1.addLine(60.01215395145899, 58.11303515552675, 60.01215395145899, 11.01488901640705) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_1 = Sketch_1.addLine( + -53.93497380447579, 58.11303515552675, 60.01215395145899, 58.11303515552675 +) +SketchLine_2 = Sketch_1.addLine( + 60.01215395145899, 58.11303515552675, 60.01215395145899, 11.01488901640705 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) 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/SketchLine_1"), False) +SketchLine_3 = Sketch_2.addLine( + 31.90519577166173, 58.11303515552675, 60.012153951459, 58.11303515552675 +) +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/SketchLine_2"), False) +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/SketchLine_2"), False +) SketchLine_6 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result()) +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/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")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 2) model.testNbSubResults(Cut_1, [0, 0]) @@ -58,4 +96,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [0, 0]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [1, 1]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [2, 2]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2636.py b/src/FeaturesPlugin/Test/Test2636.py index aa68db550..5f003a619 100644 --- a/src/FeaturesPlugin/Test/Test2636.py +++ b/src/FeaturesPlugin/Test/Test2636.py @@ -27,140 +27,237 @@ model.addParameter(partSet, "epsilon", "0.1") 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchLine_1.setName("SketchLine_2") SketchLine_1.result().setName("SketchLine_2") -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchLine_2.setName("SketchLine_3") SketchLine_2.result().setName("SketchLine_3") SketchLine_3 = Sketch_1.addLine(0, 0, 0, -21) SketchLine_3.setName("SketchLine_4") SketchLine_3.result().setName("SketchLine_4") -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(0, -21, 54, -21) SketchLine_4.setName("SketchLine_5") SketchLine_4.result().setName("SketchLine_5") -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(54, -21, 57, -18) SketchLine_5.setName("SketchLine_6") SketchLine_5.result().setName("SketchLine_6") -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), "42/2") -SketchConstraintAngle_1 = Sketch_1.setAngleComplementary(SketchLine_4.result(), SketchLine_5.result(), 45) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_5.endPoint(), SketchLine_3.endPoint(), 57) +SketchConstraintAngle_1 = Sketch_1.setAngleComplementary( + SketchLine_4.result(), SketchLine_5.result(), 45 +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_5.endPoint(), SketchLine_3.endPoint(), 57 +) SketchLine_6 = Sketch_1.addLine(57, -18, 159.1, -18) SketchLine_6.setName("SketchLine_7") SketchLine_6.result().setName("SketchLine_7") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_5.endPoint(), SketchLine_1.result(), "36/2", True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_5.endPoint(), SketchLine_1.result(), "36/2", True +) SketchLine_7 = Sketch_1.addLine(162.1, -21, 162.1, -31.5) SketchLine_7.setName("SketchLine_8") SketchLine_7.result().setName("SketchLine_8") SketchLine_8 = Sketch_1.addLine(162.1, -31.5, 204.1, -31.5) SketchLine_8.setName("SketchLine_9") SketchLine_8.result().setName("SketchLine_9") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(204.1, -31.5, 204.1, -21) SketchLine_9.setName("SketchLine_10") SketchLine_9.result().setName("SketchLine_10") -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchLine_10 = Sketch_1.addLine(204.1, -21, 181.1, -21) SketchLine_10.setName("SketchLine_11") SketchLine_10.result().setName("SketchLine_11") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchLine_11 = Sketch_1.addLine(181.1, -21, 168.9756443470179, 0) SketchLine_11.setName("SketchLine_12") SketchLine_11.result().setName("SketchLine_12") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchLine_12 = Sketch_1.addLine(168.9756443470179, 0, 0, 0) SketchLine_12.setName("SketchLine_13") SketchLine_12.result().setName("SketchLine_13") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_12.endPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_12.endPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_12.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_10.result()) SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_9.result()) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_12.startPoint(), SketchLine_8.endPoint(), "63/2") -SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchLine_12.startPoint(), SketchLine_10.startPoint(), "42/2") -SketchConstraintAngle_2 = Sketch_1.setAngleComplementary(SketchLine_12.result(), SketchLine_11.result(), 60) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_12.startPoint(), SketchLine_8.endPoint(), "63/2" +) +SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance( + SketchLine_12.startPoint(), SketchLine_10.startPoint(), "42/2" +) +SketchConstraintAngle_2 = Sketch_1.setAngleComplementary( + SketchLine_12.result(), SketchLine_11.result(), 60 +) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_10.result(), 23) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_8.result(), 42) SketchLine_13 = Sketch_1.addLine(54, -21, 54, 0) SketchLine_13.setName("SketchLine_14") SketchLine_13.result().setName("SketchLine_14") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_1.result() +) SketchLine_14 = Sketch_1.addLine(57, -18, 57, 0) SketchLine_14.setName("SketchLine_15") SketchLine_14.result().setName("SketchLine_15") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchLine_1.result() +) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_14.result()) SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_13.result()) SketchLine_15 = Sketch_1.addLine(181.1, -21, 181.1, -31.5) SketchLine_15.setName("SketchLine_18") SketchLine_15.result().setName("SketchLine_18") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_8.result()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_15.endPoint(), SketchLine_8.result() +) SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_15.result()) SketchArc_1 = Sketch_1.addArc(159.1, -21, 162.1, -21, 159.1, -18, False) SketchPoint_1 = Sketch_1.addPoint(162.1, -18) SketchPoint_1.setName("SketchPoint_2") SketchPoint_1.result().setName("SketchPoint_2") SketchPoint_1.setAuxiliary(True) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_6.result()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_7.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchPoint_1.coordinates(), "105+epsilon", False) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_6.endPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_6.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_7.result()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_6.result() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_7.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchPoint_1.coordinates(), "105+epsilon", False +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_6.endPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_6.result() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_7.result() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 3) SketchLine_16 = Sketch_1.addLine(162.1, -21, 181.1, -21) SketchLine_16.setName("SketchLine_36") SketchLine_16.result().setName("SketchLine_36") -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_11.result()) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_16.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_16.endPoint(), SketchLine_11.result() +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_16.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_16.endPoint(), SketchLine_15.startPoint() +) SketchLine_17 = Sketch_1.addLine(159.1, -18, 159.1, 0) SketchLine_17.setName("SketchLine_35") SketchLine_17.result().setName("SketchLine_35") -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_17.startPoint()) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_12.result()) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_17.startPoint() +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_12.result() +) SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_17.result()) SketchLine_18 = Sketch_1.addLine(159.1, -18, 175.3264973081038, -11) SketchLine_18.setName("SketchLine_37") SketchLine_18.result().setName("SketchLine_37") -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_11.result()) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_18.startPoint(), SketchLine_6.endPoint()) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchLine_11.result() +) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_18.startPoint(), SketchLine_6.endPoint() +) SketchLine_19 = Sketch_1.addLine(168.9756443470179, 0, 168.9756443470179, -5) SketchLine_19.setName("SketchLine_38") SketchLine_19.result().setName("SketchLine_38") SketchLine_19.setAuxiliary(True) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_19.startPoint() +) SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_19.result()) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_19.result(), 5) -SketchConstraintDistanceVertical_3 = Sketch_1.setVerticalDistance(SketchLine_18.endPoint(), SketchLine_12.startPoint(), 11) +SketchConstraintDistanceVertical_3 = Sketch_1.setVerticalDistance( + SketchLine_18.endPoint(), SketchLine_12.startPoint(), 11 +) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "Sketch_1/SketchLine_13"), 360, 0) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1_1/Generated_Face&Sketch_1/SketchLine_4")) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection("EDGE", "Sketch_1/SketchLine_13"), + 360, + 0, +) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Revolution_1_1_1/Generated_Face&Sketch_1/SketchLine_4"), +) SketchPoint_2 = Sketch_2.addPoint(0, 0) SketchPoint_2.setName("SketchPoint_3") SketchPoint_2.result().setName("SketchPoint_3") -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Revolution_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Revolution_1_1_1/Generated_Face&Sketch_1/SketchLine_5]__cc"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Revolution_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Revolution_1_1_1/Generated_Face&Sketch_1/SketchLine_5]__cc", + ), + False, +) SketchProjection_3.setName("SketchProjection_4") SketchProjection_3.result().setName("SketchProjection_4") SketchPoint_3 = SketchProjection_3.createdFeature() SketchPoint_3.setName("SketchPoint_4") SketchPoint_3.result().setName("SketchPoint_4") -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchPoint_3.result()) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchPoint_2.coordinates(), SketchPoint_3.result() +) model.do() Sketch_2.setName("Sketch_3") Sketch_2.result().setName("Sketch_3") @@ -168,135 +265,230 @@ model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Sketch_3 = model.addSketch(Part_2_doc, model.defaultPlane("XOY")) -SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_4 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_20 = SketchProjection_4.createdFeature() SketchLine_20.setName("SketchLine_2") SketchLine_20.result().setName("SketchLine_2") -SketchProjection_5 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_5 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_21 = SketchProjection_5.createdFeature() SketchLine_21.setName("SketchLine_3") SketchLine_21.result().setName("SketchLine_3") SketchLine_22 = Sketch_3.addLine(0, 0, 0, -21) SketchLine_22.setName("SketchLine_4") SketchLine_22.result().setName("SketchLine_4") -SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_20).startPoint(), SketchLine_22.startPoint()) +SketchConstraintCoincidence_30 = Sketch_3.setCoincident( + SketchAPI_Line(SketchLine_20).startPoint(), SketchLine_22.startPoint() +) SketchLine_23 = Sketch_3.addLine(0, -21, 54, -21) SketchLine_23.setName("SketchLine_5") SketchLine_23.result().setName("SketchLine_5") -SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) +SketchConstraintCoincidence_31 = Sketch_3.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.startPoint() +) SketchLine_24 = Sketch_3.addLine(54, -21, 57, -18) SketchLine_24.setName("SketchLine_6") SketchLine_24.result().setName("SketchLine_6") -SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) +SketchConstraintCoincidence_32 = Sketch_3.setCoincident( + SketchLine_23.endPoint(), SketchLine_24.startPoint() +) SketchConstraintVertical_9 = Sketch_3.setVertical(SketchLine_22.result()) SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_23.result()) SketchConstraintLength_5 = Sketch_3.setLength(SketchLine_22.result(), "42/2") -SketchConstraintAngle_3 = Sketch_3.setAngleComplementary(SketchLine_23.result(), SketchLine_24.result(), 45) -SketchConstraintDistanceHorizontal_2 = Sketch_3.setHorizontalDistance(SketchLine_24.endPoint(), SketchLine_22.endPoint(), 57) +SketchConstraintAngle_3 = Sketch_3.setAngleComplementary( + SketchLine_23.result(), SketchLine_24.result(), 45 +) +SketchConstraintDistanceHorizontal_2 = Sketch_3.setHorizontalDistance( + SketchLine_24.endPoint(), SketchLine_22.endPoint(), 57 +) SketchLine_25 = Sketch_3.addLine(57, -18, 159.1, -18) SketchLine_25.setName("SketchLine_7") SketchLine_25.result().setName("SketchLine_7") -SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint()) +SketchConstraintCoincidence_33 = Sketch_3.setCoincident( + SketchLine_24.endPoint(), SketchLine_25.startPoint() +) SketchConstraintHorizontal_7 = Sketch_3.setHorizontal(SketchLine_25.result()) -SketchConstraintDistance_3 = Sketch_3.setDistance(SketchLine_24.endPoint(), SketchLine_20.result(), "36/2", True) +SketchConstraintDistance_3 = Sketch_3.setDistance( + SketchLine_24.endPoint(), SketchLine_20.result(), "36/2", True +) SketchLine_26 = Sketch_3.addLine(162.1, -21, 162.1, -31.5) SketchLine_26.setName("SketchLine_8") SketchLine_26.result().setName("SketchLine_8") SketchLine_27 = Sketch_3.addLine(162.1, -31.5, 204.1, -31.5) SketchLine_27.setName("SketchLine_9") SketchLine_27.result().setName("SketchLine_9") -SketchConstraintCoincidence_34 = Sketch_3.setCoincident(SketchLine_26.endPoint(), SketchLine_27.startPoint()) +SketchConstraintCoincidence_34 = Sketch_3.setCoincident( + SketchLine_26.endPoint(), SketchLine_27.startPoint() +) SketchLine_28 = Sketch_3.addLine(204.1, -31.5, 204.1, -21) SketchLine_28.setName("SketchLine_10") SketchLine_28.result().setName("SketchLine_10") -SketchConstraintCoincidence_35 = Sketch_3.setCoincident(SketchLine_27.endPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_35 = Sketch_3.setCoincident( + SketchLine_27.endPoint(), SketchLine_28.startPoint() +) SketchLine_29 = Sketch_3.addLine(204.1, -21, 181.1, -21) SketchLine_29.setName("SketchLine_11") SketchLine_29.result().setName("SketchLine_11") -SketchConstraintCoincidence_36 = Sketch_3.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_36 = Sketch_3.setCoincident( + SketchLine_28.endPoint(), SketchLine_29.startPoint() +) SketchLine_30 = Sketch_3.addLine(181.1, -21, 168.9756443470179, 0) SketchLine_30.setName("SketchLine_12") SketchLine_30.result().setName("SketchLine_12") -SketchConstraintCoincidence_37 = Sketch_3.setCoincident(SketchLine_29.endPoint(), SketchLine_30.startPoint()) +SketchConstraintCoincidence_37 = Sketch_3.setCoincident( + SketchLine_29.endPoint(), SketchLine_30.startPoint() +) SketchLine_31 = Sketch_3.addLine(168.9756443470179, 0, 0, 0) SketchLine_31.setName("SketchLine_13") SketchLine_31.result().setName("SketchLine_13") -SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) -SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_20).startPoint(), SketchLine_31.endPoint()) +SketchConstraintCoincidence_38 = Sketch_3.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) +SketchConstraintCoincidence_39 = Sketch_3.setCoincident( + SketchAPI_Line(SketchLine_20).startPoint(), SketchLine_31.endPoint() +) SketchConstraintHorizontal_8 = Sketch_3.setHorizontal(SketchLine_31.result()) SketchConstraintHorizontal_9 = Sketch_3.setHorizontal(SketchLine_29.result()) SketchConstraintHorizontal_10 = Sketch_3.setHorizontal(SketchLine_27.result()) SketchConstraintVertical_10 = Sketch_3.setVertical(SketchLine_26.result()) SketchConstraintVertical_11 = Sketch_3.setVertical(SketchLine_28.result()) -SketchConstraintDistanceVertical_4 = Sketch_3.setVerticalDistance(SketchLine_31.startPoint(), SketchLine_27.endPoint(), "63/2") -SketchConstraintDistanceVertical_5 = Sketch_3.setVerticalDistance(SketchLine_31.startPoint(), SketchLine_29.startPoint(), "42/2") -SketchConstraintAngle_4 = Sketch_3.setAngleComplementary(SketchLine_31.result(), SketchLine_30.result(), 60) +SketchConstraintDistanceVertical_4 = Sketch_3.setVerticalDistance( + SketchLine_31.startPoint(), SketchLine_27.endPoint(), "63/2" +) +SketchConstraintDistanceVertical_5 = Sketch_3.setVerticalDistance( + SketchLine_31.startPoint(), SketchLine_29.startPoint(), "42/2" +) +SketchConstraintAngle_4 = Sketch_3.setAngleComplementary( + SketchLine_31.result(), SketchLine_30.result(), 60 +) SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_29.result(), 23) SketchConstraintLength_7 = Sketch_3.setLength(SketchLine_27.result(), 42) SketchLine_32 = Sketch_3.addLine(54, -21, 54, 0) SketchLine_32.setName("SketchLine_14") SketchLine_32.result().setName("SketchLine_14") -SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_32.startPoint()) -SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_32.endPoint(), SketchLine_20.result()) +SketchConstraintCoincidence_40 = Sketch_3.setCoincident( + SketchLine_23.endPoint(), SketchLine_32.startPoint() +) +SketchConstraintCoincidence_41 = Sketch_3.setCoincident( + SketchLine_32.endPoint(), SketchLine_20.result() +) SketchLine_33 = Sketch_3.addLine(57, -18, 57, 0) SketchLine_33.setName("SketchLine_15") SketchLine_33.result().setName("SketchLine_15") -SketchConstraintCoincidence_42 = Sketch_3.setCoincident(SketchLine_24.endPoint(), SketchLine_33.startPoint()) -SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchLine_33.endPoint(), SketchLine_20.result()) +SketchConstraintCoincidence_42 = Sketch_3.setCoincident( + SketchLine_24.endPoint(), SketchLine_33.startPoint() +) +SketchConstraintCoincidence_43 = Sketch_3.setCoincident( + SketchLine_33.endPoint(), SketchLine_20.result() +) SketchConstraintVertical_12 = Sketch_3.setVertical(SketchLine_33.result()) SketchConstraintVertical_13 = Sketch_3.setVertical(SketchLine_32.result()) SketchLine_34 = Sketch_3.addLine(181.1, -21, 181.1, -31.5) SketchLine_34.setName("SketchLine_18") SketchLine_34.result().setName("SketchLine_18") -SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchLine_29.endPoint(), SketchLine_34.startPoint()) -SketchConstraintCoincidence_45 = Sketch_3.setCoincident(SketchLine_34.endPoint(), SketchLine_27.result()) +SketchConstraintCoincidence_44 = Sketch_3.setCoincident( + SketchLine_29.endPoint(), SketchLine_34.startPoint() +) +SketchConstraintCoincidence_45 = Sketch_3.setCoincident( + SketchLine_34.endPoint(), SketchLine_27.result() +) SketchConstraintVertical_14 = Sketch_3.setVertical(SketchLine_34.result()) SketchArc_2 = Sketch_3.addArc(159.1, -21, 162.1, -21, 159.1, -18, False) SketchPoint_4 = Sketch_3.addPoint(162.1, -18) SketchPoint_4.setName("SketchPoint_2") SketchPoint_4.result().setName("SketchPoint_2") SketchPoint_4.setAuxiliary(True) -SketchConstraintCoincidence_46 = Sketch_3.setCoincident(SketchPoint_4.coordinates(), SketchLine_25.result()) -SketchConstraintCoincidence_47 = Sketch_3.setCoincident(SketchPoint_4.coordinates(), SketchLine_26.result()) -SketchConstraintDistance_4 = Sketch_3.setDistance(SketchLine_25.startPoint(), SketchPoint_4.coordinates(), "105+epsilon", False) -SketchConstraintCoincidence_48 = Sketch_3.setCoincident(SketchArc_2.startPoint(), SketchLine_26.startPoint()) -SketchConstraintCoincidence_49 = Sketch_3.setCoincident(SketchArc_2.endPoint(), SketchLine_25.endPoint()) -SketchConstraintTangent_3 = Sketch_3.setTangent(SketchArc_2.results()[1], SketchLine_25.result()) -SketchConstraintTangent_4 = Sketch_3.setTangent(SketchArc_2.results()[1], SketchLine_26.result()) +SketchConstraintCoincidence_46 = Sketch_3.setCoincident( + SketchPoint_4.coordinates(), SketchLine_25.result() +) +SketchConstraintCoincidence_47 = Sketch_3.setCoincident( + SketchPoint_4.coordinates(), SketchLine_26.result() +) +SketchConstraintDistance_4 = Sketch_3.setDistance( + SketchLine_25.startPoint(), SketchPoint_4.coordinates(), "105+epsilon", False +) +SketchConstraintCoincidence_48 = Sketch_3.setCoincident( + SketchArc_2.startPoint(), SketchLine_26.startPoint() +) +SketchConstraintCoincidence_49 = Sketch_3.setCoincident( + SketchArc_2.endPoint(), SketchLine_25.endPoint() +) +SketchConstraintTangent_3 = Sketch_3.setTangent( + SketchArc_2.results()[1], SketchLine_25.result() +) +SketchConstraintTangent_4 = Sketch_3.setTangent( + SketchArc_2.results()[1], SketchLine_26.result() +) SketchConstraintRadius_2 = Sketch_3.setRadius(SketchArc_2.results()[1], 3) SketchLine_35 = Sketch_3.addLine(162.1, -21, 181.1, -21) SketchLine_35.setName("SketchLine_36") SketchLine_35.result().setName("SketchLine_36") -SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchLine_35.endPoint(), SketchLine_30.result()) -SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchLine_35.startPoint(), SketchLine_26.startPoint()) -SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchLine_35.endPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_50 = Sketch_3.setCoincident( + SketchLine_35.endPoint(), SketchLine_30.result() +) +SketchConstraintCoincidence_51 = Sketch_3.setCoincident( + SketchLine_35.startPoint(), SketchLine_26.startPoint() +) +SketchConstraintCoincidence_52 = Sketch_3.setCoincident( + SketchLine_35.endPoint(), SketchLine_34.startPoint() +) SketchLine_36 = Sketch_3.addLine(159.1, -18, 159.1, 0) SketchLine_36.setName("SketchLine_35") SketchLine_36.result().setName("SketchLine_35") -SketchConstraintCoincidence_53 = Sketch_3.setCoincident(SketchLine_25.endPoint(), SketchLine_36.startPoint()) -SketchConstraintCoincidence_54 = Sketch_3.setCoincident(SketchLine_36.endPoint(), SketchLine_31.result()) +SketchConstraintCoincidence_53 = Sketch_3.setCoincident( + SketchLine_25.endPoint(), SketchLine_36.startPoint() +) +SketchConstraintCoincidence_54 = Sketch_3.setCoincident( + SketchLine_36.endPoint(), SketchLine_31.result() +) SketchConstraintVertical_15 = Sketch_3.setVertical(SketchLine_36.result()) SketchLine_37 = Sketch_3.addLine(159.1, -18, 175.3264973081038, -11) SketchLine_37.setName("SketchLine_37") SketchLine_37.result().setName("SketchLine_37") -SketchConstraintCoincidence_55 = Sketch_3.setCoincident(SketchLine_37.endPoint(), SketchLine_30.result()) -SketchConstraintCoincidence_56 = Sketch_3.setCoincident(SketchLine_37.startPoint(), SketchLine_25.endPoint()) +SketchConstraintCoincidence_55 = Sketch_3.setCoincident( + SketchLine_37.endPoint(), SketchLine_30.result() +) +SketchConstraintCoincidence_56 = Sketch_3.setCoincident( + SketchLine_37.startPoint(), SketchLine_25.endPoint() +) SketchLine_38 = Sketch_3.addLine(168.9756443470179, 0, 168.9756443470179, -5) SketchLine_38.setName("SketchLine_38") SketchLine_38.result().setName("SketchLine_38") SketchLine_38.setAuxiliary(True) -SketchConstraintCoincidence_57 = Sketch_3.setCoincident(SketchLine_30.endPoint(), SketchLine_38.startPoint()) +SketchConstraintCoincidence_57 = Sketch_3.setCoincident( + SketchLine_30.endPoint(), SketchLine_38.startPoint() +) SketchConstraintVertical_16 = Sketch_3.setVertical(SketchLine_38.result()) SketchConstraintLength_8 = Sketch_3.setLength(SketchLine_38.result(), 5) -SketchConstraintDistanceVertical_6 = Sketch_3.setVerticalDistance(SketchLine_37.endPoint(), SketchLine_31.startPoint(), 11) +SketchConstraintDistanceVertical_6 = Sketch_3.setVerticalDistance( + SketchLine_37.endPoint(), SketchLine_31.startPoint(), 11 +) model.do() -Revolution_2 = model.addRevolution(Part_2_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "Sketch_1/SketchLine_13"), 360, 0) -Sketch_4 = model.addSketch(Part_2_doc, model.selection("FACE", "Revolution_1_1_1/Generated_Face&Sketch_1/SketchLine_4")) +Revolution_2 = model.addRevolution( + Part_2_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection("EDGE", "Sketch_1/SketchLine_13"), + 360, + 0, +) +Sketch_4 = model.addSketch( + Part_2_doc, + model.selection("FACE", "Revolution_1_1_1/Generated_Face&Sketch_1/SketchLine_4"), +) SketchLine_39 = Sketch_4.addLine(50, 0, -50, 0) SketchLine_39.setName("SketchLine_19") SketchLine_39.result().setName("SketchLine_19") SketchConstraintHorizontal_11 = Sketch_4.setHorizontal(SketchLine_39.result()) -SketchProjection_6 = Sketch_4.addProjection(model.selection("VERTEX", "[Revolution_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Revolution_1_1_1/Generated_Face&Sketch_1/SketchLine_5]__cc"), False) +SketchProjection_6 = Sketch_4.addProjection( + model.selection( + "VERTEX", + "[Revolution_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Revolution_1_1_1/Generated_Face&Sketch_1/SketchLine_5]__cc", + ), + False, +) SketchPoint_5 = SketchProjection_6.createdFeature() SketchPoint_5.setName("SketchPoint_1") SketchPoint_5.result().setName("SketchPoint_1") @@ -304,45 +496,91 @@ SketchConstraintLength_9 = Sketch_4.setLength(SketchLine_39.result(), 100) SketchLine_40 = Sketch_4.addLine(0, -50, 0, 50) SketchLine_40.setName("SketchLine_20") SketchLine_40.result().setName("SketchLine_20") -SketchProjection_7 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_7 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_41 = SketchProjection_7.createdFeature() SketchLine_41.setName("SketchLine_21") SketchLine_41.result().setName("SketchLine_21") -SketchConstraintCoincidence_58 = Sketch_4.setCoincident(SketchLine_40.startPoint(), SketchLine_41.result()) +SketchConstraintCoincidence_58 = Sketch_4.setCoincident( + SketchLine_40.startPoint(), SketchLine_41.result() +) SketchConstraintVertical_17 = Sketch_4.setVertical(SketchLine_40.result()) SketchConstraintLength_10 = Sketch_4.setLength(SketchLine_40.result(), 100) SketchCircle_1 = Sketch_4.addCircle(0, 0, 7) SketchCircle_1.setAuxiliary(True) -SketchConstraintCoincidence_59 = Sketch_4.setCoincident(SketchAPI_Point(SketchPoint_5).coordinates(), SketchCircle_1.center()) +SketchConstraintCoincidence_59 = Sketch_4.setCoincident( + SketchAPI_Point(SketchPoint_5).coordinates(), SketchCircle_1.center() +) SketchConstraintRadius_3 = Sketch_4.setRadius(SketchCircle_1.results()[1], 7) SketchLine_42 = Sketch_4.addLine(0, 0, -4.949747468305834, -4.949747468305832) SketchLine_42.setName("SketchLine_22") SketchLine_42.result().setName("SketchLine_22") SketchLine_42.setAuxiliary(True) -SketchConstraintCoincidence_60 = Sketch_4.setCoincident(SketchAPI_Point(SketchPoint_5).coordinates(), SketchLine_42.startPoint()) -SketchConstraintCoincidence_61 = Sketch_4.setCoincident(SketchLine_42.endPoint(), SketchCircle_1.results()[1]) -SketchConstraintAngle_5 = Sketch_4.setAngleComplementary(SketchLine_42.result(), SketchLine_39.result(), 45) +SketchConstraintCoincidence_60 = Sketch_4.setCoincident( + SketchAPI_Point(SketchPoint_5).coordinates(), SketchLine_42.startPoint() +) +SketchConstraintCoincidence_61 = Sketch_4.setCoincident( + SketchLine_42.endPoint(), SketchCircle_1.results()[1] +) +SketchConstraintAngle_5 = Sketch_4.setAngleComplementary( + SketchLine_42.result(), SketchLine_39.result(), 45 +) SketchLine_43 = Sketch_4.addLine(0, -7, -4.949747468305834, -4.949747468305832) SketchLine_43.setName("SketchLine_23") SketchLine_43.result().setName("SketchLine_23") -SketchConstraintCoincidence_62 = Sketch_4.setCoincident(SketchLine_43.startPoint(), SketchLine_41.result()) -SketchConstraintCoincidence_63 = Sketch_4.setCoincident(SketchLine_42.endPoint(), SketchLine_43.endPoint()) +SketchConstraintCoincidence_62 = Sketch_4.setCoincident( + SketchLine_43.startPoint(), SketchLine_41.result() +) +SketchConstraintCoincidence_63 = Sketch_4.setCoincident( + SketchLine_42.endPoint(), SketchLine_43.endPoint() +) SketchLine_44 = Sketch_4.addLine(-4.949747468305834, -4.949747468305832, -7, 0) SketchLine_44.setName("SketchLine_24") SketchLine_44.result().setName("SketchLine_24") -SketchConstraintCoincidence_64 = Sketch_4.setCoincident(SketchLine_42.endPoint(), SketchLine_44.startPoint()) -SketchConstraintCoincidence_65 = Sketch_4.setCoincident(SketchLine_44.endPoint(), SketchLine_39.result()) -SketchLine_45 = Sketch_4.addLine(-4.949747468305834, -4.949747468305832, -33.23401871576774, -33.23401871576773) +SketchConstraintCoincidence_64 = Sketch_4.setCoincident( + SketchLine_42.endPoint(), SketchLine_44.startPoint() +) +SketchConstraintCoincidence_65 = Sketch_4.setCoincident( + SketchLine_44.endPoint(), SketchLine_39.result() +) +SketchLine_45 = Sketch_4.addLine( + -4.949747468305834, -4.949747468305832, -33.23401871576774, -33.23401871576773 +) SketchLine_45.setName("SketchLine_25") SketchLine_45.result().setName("SketchLine_25") -SketchConstraintCoincidence_66 = Sketch_4.setCoincident(SketchLine_42.endPoint(), SketchLine_45.startPoint()) -SketchConstraintCollinear_1 = Sketch_4.setCollinear(SketchLine_45.result(), SketchLine_42.result()) -SketchConstraintCoincidence_67 = Sketch_4.setCoincident(SketchLine_43.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_68 = Sketch_4.setCoincident(SketchLine_44.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_66 = Sketch_4.setCoincident( + SketchLine_42.endPoint(), SketchLine_45.startPoint() +) +SketchConstraintCollinear_1 = Sketch_4.setCollinear( + SketchLine_45.result(), SketchLine_42.result() +) +SketchConstraintCoincidence_67 = Sketch_4.setCoincident( + SketchLine_43.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_68 = Sketch_4.setCoincident( + SketchLine_44.endPoint(), SketchCircle_1.results()[1] +) SketchConstraintLength_11 = Sketch_4.setLength(SketchLine_45.result(), 40) -SketchMultiRotation_1_objects = [SketchLine_43.result(), SketchLine_45.result(), SketchLine_44.result()] -SketchMultiRotation_1 = Sketch_4.addRotation(SketchMultiRotation_1_objects, SketchAPI_Line(SketchLine_41).startPoint(), 90, 4) -[SketchLine_46, SketchLine_47, SketchLine_48, SketchLine_49, SketchLine_50, SketchLine_51, SketchLine_52, SketchLine_53, SketchLine_54] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1_objects = [ + SketchLine_43.result(), + SketchLine_45.result(), + SketchLine_44.result(), +] +SketchMultiRotation_1 = Sketch_4.addRotation( + SketchMultiRotation_1_objects, SketchAPI_Line(SketchLine_41).startPoint(), 90, 4 +) +[ + SketchLine_46, + SketchLine_47, + SketchLine_48, + SketchLine_49, + SketchLine_50, + SketchLine_51, + SketchLine_52, + SketchLine_53, + SketchLine_54, +] = SketchMultiRotation_1.rotated() SketchLine_54.setName("SketchLine_34") SketchLine_54.result().setName("SketchLine_34") SketchLine_53.setName("SketchLine_33") @@ -362,49 +600,274 @@ SketchLine_47.result().setName("SketchLine_29") SketchLine_46.setName("SketchLine_26") SketchLine_46.result().setName("SketchLine_26") model.do() -Edge_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_27"), model.selection("EDGE", "Sketch_2/SketchLine_26"), model.selection("EDGE", "Sketch_2/SketchLine_28"), model.selection("EDGE", "Sketch_2/SketchLine_19"), model.selection("EDGE", "Sketch_2/SketchLine_25"), model.selection("EDGE", "Sketch_2/SketchLine_23"), model.selection("EDGE", "Sketch_2/SketchLine_24"), model.selection("EDGE", "Sketch_2/SketchLine_30"), model.selection("EDGE", "Sketch_2/SketchLine_34"), model.selection("EDGE", "Sketch_2/SketchLine_29"), model.selection("EDGE", "Sketch_2/SketchLine_33"), model.selection("EDGE", "Sketch_2/SketchLine_31"), model.selection("EDGE", "Sketch_2/SketchLine_20"), model.selection("EDGE", "Sketch_2/SketchLine_32")] +Edge_1_objects = [ + model.selection("EDGE", "Sketch_2/SketchLine_27"), + model.selection("EDGE", "Sketch_2/SketchLine_26"), + model.selection("EDGE", "Sketch_2/SketchLine_28"), + model.selection("EDGE", "Sketch_2/SketchLine_19"), + model.selection("EDGE", "Sketch_2/SketchLine_25"), + model.selection("EDGE", "Sketch_2/SketchLine_23"), + model.selection("EDGE", "Sketch_2/SketchLine_24"), + model.selection("EDGE", "Sketch_2/SketchLine_30"), + model.selection("EDGE", "Sketch_2/SketchLine_34"), + model.selection("EDGE", "Sketch_2/SketchLine_29"), + model.selection("EDGE", "Sketch_2/SketchLine_33"), + model.selection("EDGE", "Sketch_2/SketchLine_31"), + model.selection("EDGE", "Sketch_2/SketchLine_20"), + model.selection("EDGE", "Sketch_2/SketchLine_32"), +] Edge_1 = model.addEdge(Part_2_doc, Edge_1_objects) -Extrusion_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"), model.selection("EDGE", "Edge_1_8"), model.selection("EDGE", "Edge_1_9"), model.selection("EDGE", "Edge_1_10"), model.selection("EDGE", "Edge_1_11"), model.selection("EDGE", "Edge_1_12"), model.selection("EDGE", "Edge_1_13"), model.selection("EDGE", "Edge_1_14")] -Extrusion_1 = model.addExtrusion(Part_2_doc, Extrusion_1_objects, model.selection("EDGE", "PartSet/OX"), 300, 0) -Split_1_objects_2 = [model.selection("FACE", "Extrusion_1_1"), model.selection("FACE", "Extrusion_1_2"), model.selection("FACE", "Extrusion_1_3"), model.selection("FACE", "Extrusion_1_4"), model.selection("FACE", "Extrusion_1_5"), model.selection("FACE", "Extrusion_1_6"), model.selection("FACE", "Extrusion_1_7"), model.selection("FACE", "Extrusion_1_8"), model.selection("FACE", "Extrusion_1_9"), model.selection("FACE", "Extrusion_1_10"), model.selection("FACE", "Extrusion_1_11"), model.selection("FACE", "Extrusion_1_12"), model.selection("FACE", "Extrusion_1_13"), model.selection("FACE", "Extrusion_1_14")] -Split_1 = model.addSplit(Part_2_doc, [model.selection("COMPSOLID", "Revolution_1_1")], Split_1_objects_2) -Group_1_objects = [model.selection("SOLID", "Split_1_1_25"), model.selection("SOLID", "Split_1_1_28"), model.selection("SOLID", "Split_1_1_26"), model.selection("SOLID", "Split_1_1_27"), model.selection("SOLID", "Split_1_1_31"), model.selection("SOLID", "Split_1_1_35"), model.selection("SOLID", "Split_1_1_36"), model.selection("SOLID", "Split_1_1_32"), model.selection("SOLID", "Split_1_1_34"), model.selection("SOLID", "Split_1_1_30"), model.selection("SOLID", "Split_1_1_33"), model.selection("SOLID", "Split_1_1_29")] +Extrusion_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"), + model.selection("EDGE", "Edge_1_8"), + model.selection("EDGE", "Edge_1_9"), + model.selection("EDGE", "Edge_1_10"), + model.selection("EDGE", "Edge_1_11"), + model.selection("EDGE", "Edge_1_12"), + model.selection("EDGE", "Edge_1_13"), + model.selection("EDGE", "Edge_1_14"), +] +Extrusion_1 = model.addExtrusion( + Part_2_doc, Extrusion_1_objects, model.selection("EDGE", "PartSet/OX"), 300, 0 +) +Split_1_objects_2 = [ + model.selection("FACE", "Extrusion_1_1"), + model.selection("FACE", "Extrusion_1_2"), + model.selection("FACE", "Extrusion_1_3"), + model.selection("FACE", "Extrusion_1_4"), + model.selection("FACE", "Extrusion_1_5"), + model.selection("FACE", "Extrusion_1_6"), + model.selection("FACE", "Extrusion_1_7"), + model.selection("FACE", "Extrusion_1_8"), + model.selection("FACE", "Extrusion_1_9"), + model.selection("FACE", "Extrusion_1_10"), + model.selection("FACE", "Extrusion_1_11"), + model.selection("FACE", "Extrusion_1_12"), + model.selection("FACE", "Extrusion_1_13"), + model.selection("FACE", "Extrusion_1_14"), +] +Split_1 = model.addSplit( + Part_2_doc, [model.selection("COMPSOLID", "Revolution_1_1")], Split_1_objects_2 +) +Group_1_objects = [ + model.selection("SOLID", "Split_1_1_25"), + model.selection("SOLID", "Split_1_1_28"), + model.selection("SOLID", "Split_1_1_26"), + model.selection("SOLID", "Split_1_1_27"), + model.selection("SOLID", "Split_1_1_31"), + model.selection("SOLID", "Split_1_1_35"), + model.selection("SOLID", "Split_1_1_36"), + model.selection("SOLID", "Split_1_1_32"), + model.selection("SOLID", "Split_1_1_34"), + model.selection("SOLID", "Split_1_1_30"), + model.selection("SOLID", "Split_1_1_33"), + model.selection("SOLID", "Split_1_1_29"), +] Group_1 = model.addGroup(Part_2_doc, Group_1_objects) Group_1.setName("CORPS") Group_1.result().setName("CORPS") -Group_2_objects = [model.selection("SOLID", "Split_1_1_41"), model.selection("SOLID", "Split_1_1_49"), model.selection("SOLID", "Split_1_1_69"), model.selection("SOLID", "Split_1_1_71"), model.selection("SOLID", "Split_1_1_51"), model.selection("SOLID", "Split_1_1_43"), model.selection("SOLID", "Split_1_1_44"), model.selection("SOLID", "Split_1_1_67"), model.selection("SOLID", "Split_1_1_39"), model.selection("SOLID", "Split_1_1_47"), model.selection("SOLID", "Split_1_1_45"), model.selection("SOLID", "Split_1_1_37"), model.selection("SOLID", "Split_1_1_65"), model.selection("SOLID", "Split_1_1_66"), model.selection("SOLID", "Split_1_1_38"), model.selection("SOLID", "Split_1_1_46"), model.selection("SOLID", "Split_1_1_48"), model.selection("SOLID", "Split_1_1_40"), model.selection("SOLID", "Split_1_1_68"), model.selection("SOLID", "Split_1_1_42"), model.selection("SOLID", "Split_1_1_70"), model.selection("SOLID", "Split_1_1_50"), model.selection("SOLID", "Split_1_1_52"), model.selection("SOLID", "Split_1_1_72"), model.selection("SOLID", "Split_1_1_63"), model.selection("SOLID", "Split_1_1_64"), model.selection("SOLID", "Split_1_1_61"), model.selection("SOLID", "Split_1_1_62"), model.selection("SOLID", "Split_1_1_58"), model.selection("SOLID", "Split_1_1_57"), model.selection("SOLID", "Split_1_1_54"), model.selection("SOLID", "Split_1_1_53"), model.selection("SOLID", "Split_1_1_55"), model.selection("SOLID", "Split_1_1_56"), model.selection("SOLID", "Split_1_1_60"), model.selection("SOLID", "Split_1_1_59")] +Group_2_objects = [ + model.selection("SOLID", "Split_1_1_41"), + model.selection("SOLID", "Split_1_1_49"), + model.selection("SOLID", "Split_1_1_69"), + model.selection("SOLID", "Split_1_1_71"), + model.selection("SOLID", "Split_1_1_51"), + model.selection("SOLID", "Split_1_1_43"), + model.selection("SOLID", "Split_1_1_44"), + model.selection("SOLID", "Split_1_1_67"), + model.selection("SOLID", "Split_1_1_39"), + model.selection("SOLID", "Split_1_1_47"), + model.selection("SOLID", "Split_1_1_45"), + model.selection("SOLID", "Split_1_1_37"), + model.selection("SOLID", "Split_1_1_65"), + model.selection("SOLID", "Split_1_1_66"), + model.selection("SOLID", "Split_1_1_38"), + model.selection("SOLID", "Split_1_1_46"), + model.selection("SOLID", "Split_1_1_48"), + model.selection("SOLID", "Split_1_1_40"), + model.selection("SOLID", "Split_1_1_68"), + model.selection("SOLID", "Split_1_1_42"), + model.selection("SOLID", "Split_1_1_70"), + model.selection("SOLID", "Split_1_1_50"), + model.selection("SOLID", "Split_1_1_52"), + model.selection("SOLID", "Split_1_1_72"), + model.selection("SOLID", "Split_1_1_63"), + model.selection("SOLID", "Split_1_1_64"), + model.selection("SOLID", "Split_1_1_61"), + model.selection("SOLID", "Split_1_1_62"), + model.selection("SOLID", "Split_1_1_58"), + model.selection("SOLID", "Split_1_1_57"), + model.selection("SOLID", "Split_1_1_54"), + model.selection("SOLID", "Split_1_1_53"), + model.selection("SOLID", "Split_1_1_55"), + model.selection("SOLID", "Split_1_1_56"), + model.selection("SOLID", "Split_1_1_60"), + model.selection("SOLID", "Split_1_1_59"), +] Group_2 = model.addGroup(Part_2_doc, Group_2_objects) Group_2.setName("TETE") Group_2.result().setName("TETE") -Group_3_objects = [model.selection("SOLID", "Split_1_1_2"), model.selection("SOLID", "Split_1_1_1"), model.selection("SOLID", "Split_1_1_5"), model.selection("SOLID", "Split_1_1_9"), model.selection("SOLID", "Split_1_1_13"), model.selection("SOLID", "Split_1_1_14"), model.selection("SOLID", "Split_1_1_15"), model.selection("SOLID", "Split_1_1_19"), model.selection("SOLID", "Split_1_1_11"), model.selection("SOLID", "Split_1_1_12"), model.selection("SOLID", "Split_1_1_24"), model.selection("SOLID", "Split_1_1_23"), model.selection("SOLID", "Split_1_1_16"), model.selection("SOLID", "Split_1_1_8"), model.selection("SOLID", "Split_1_1_20"), model.selection("SOLID", "Split_1_1_4"), model.selection("SOLID", "Split_1_1_3"), model.selection("SOLID", "Split_1_1_7"), model.selection("SOLID", "Split_1_1_10"), model.selection("SOLID", "Split_1_1_6")] +Group_3_objects = [ + model.selection("SOLID", "Split_1_1_2"), + model.selection("SOLID", "Split_1_1_1"), + model.selection("SOLID", "Split_1_1_5"), + model.selection("SOLID", "Split_1_1_9"), + model.selection("SOLID", "Split_1_1_13"), + model.selection("SOLID", "Split_1_1_14"), + model.selection("SOLID", "Split_1_1_15"), + model.selection("SOLID", "Split_1_1_19"), + model.selection("SOLID", "Split_1_1_11"), + model.selection("SOLID", "Split_1_1_12"), + model.selection("SOLID", "Split_1_1_24"), + model.selection("SOLID", "Split_1_1_23"), + model.selection("SOLID", "Split_1_1_16"), + model.selection("SOLID", "Split_1_1_8"), + model.selection("SOLID", "Split_1_1_20"), + model.selection("SOLID", "Split_1_1_4"), + model.selection("SOLID", "Split_1_1_3"), + model.selection("SOLID", "Split_1_1_7"), + model.selection("SOLID", "Split_1_1_10"), + model.selection("SOLID", "Split_1_1_6"), +] Group_3 = model.addGroup(Part_2_doc, Group_3_objects) Group_3.setName("PIED") Group_3.result().setName("PIED") -Group_4 = model.addGroup(Part_2_doc, [model.selection("EDGE", "Split_1_1_36/Generated_Edge&Sketch_2/SketchLine_31&Sketch_1/SketchLine_7")]) +Group_4 = model.addGroup( + Part_2_doc, + [ + model.selection( + "EDGE", + "Split_1_1_36/Generated_Edge&Sketch_2/SketchLine_31&Sketch_1/SketchLine_7", + ) + ], +) Group_4.setName("corps_hauteur") Group_4.result().setName("corps_hauteur") -Group_5 = model.addGroup(Part_2_doc, [model.selection("EDGE", "Split_1_1_11/Generated_Edge&Sketch_2/SketchLine_31&Sketch_1/SketchLine_5")]) +Group_5 = model.addGroup( + Part_2_doc, + [ + model.selection( + "EDGE", + "Split_1_1_11/Generated_Edge&Sketch_2/SketchLine_31&Sketch_1/SketchLine_5", + ) + ], +) Group_5.setName("pied_hauteur") Group_5.result().setName("pied_hauteur") -Group_6 = model.addGroup(Part_2_doc, [model.selection("EDGE", "Split_1_1_24/Generated_Edge&Sketch_2/SketchLine_31&Sketch_1/SketchLine_6")]) +Group_6 = model.addGroup( + Part_2_doc, + [ + model.selection( + "EDGE", + "Split_1_1_24/Generated_Edge&Sketch_2/SketchLine_31&Sketch_1/SketchLine_6", + ) + ], +) Group_6.setName("chanfrein") Group_6.result().setName("chanfrein") -Group_7 = model.addGroup(Part_2_doc, [model.selection("EDGE", "Split_1_1_72/Generated_Edge&Sketch_2/SketchLine_31&Sketch_1/SketchArc_1_2")]) +Group_7 = model.addGroup( + Part_2_doc, + [ + model.selection( + "EDGE", + "Split_1_1_72/Generated_Edge&Sketch_2/SketchLine_31&Sketch_1/SketchArc_1_2", + ) + ], +) Group_7.setName("filet") Group_7.result().setName("filet") -Group_8 = model.addGroup(Part_2_doc, [model.selection("EDGE", "Split_1_1_42/Generated_Edge&Sketch_2/SketchLine_31&Sketch_1/SketchLine_9")]) +Group_8 = model.addGroup( + Part_2_doc, + [ + model.selection( + "EDGE", + "Split_1_1_42/Generated_Edge&Sketch_2/SketchLine_31&Sketch_1/SketchLine_9", + ) + ], +) Group_8.setName("tete_bas") Group_8.result().setName("tete_bas") -Group_9_objects = [model.selection("FACE", "Split_1_1_12/Modified_Face&Sketch_1/SketchLine_5"), model.selection("FACE", "Split_1_1_11/Modified_Face&Sketch_1/SketchLine_5"), model.selection("FACE", "Split_1_1_9/Modified_Face&Sketch_1/SketchLine_5"), model.selection("FACE", "Split_1_1_8/Modified_Face&Sketch_1/SketchLine_5"), model.selection("FACE", "Split_1_1_4/Modified_Face&Sketch_1/SketchLine_5"), model.selection("FACE", "Split_1_1_1/Modified_Face&Sketch_1/SketchLine_5"), model.selection("FACE", "Split_1_1_2/Modified_Face&Sketch_1/SketchLine_5"), model.selection("FACE", "Split_1_1_5/Modified_Face&Sketch_1/SketchLine_5")] +Group_9_objects = [ + model.selection("FACE", "Split_1_1_12/Modified_Face&Sketch_1/SketchLine_5"), + model.selection("FACE", "Split_1_1_11/Modified_Face&Sketch_1/SketchLine_5"), + model.selection("FACE", "Split_1_1_9/Modified_Face&Sketch_1/SketchLine_5"), + model.selection("FACE", "Split_1_1_8/Modified_Face&Sketch_1/SketchLine_5"), + model.selection("FACE", "Split_1_1_4/Modified_Face&Sketch_1/SketchLine_5"), + model.selection("FACE", "Split_1_1_1/Modified_Face&Sketch_1/SketchLine_5"), + model.selection("FACE", "Split_1_1_2/Modified_Face&Sketch_1/SketchLine_5"), + model.selection("FACE", "Split_1_1_5/Modified_Face&Sketch_1/SketchLine_5"), +] Group_9 = model.addGroup(Part_2_doc, Group_9_objects) Group_9.setName("ADH_PIEDS") Group_9.result().setName("ADH_PIEDS") -Group_10_objects = [model.selection("FACE", "Split_1_1_13/Modified_Face&Sketch_1/SketchLine_6"), model.selection("FACE", "Split_1_1_14/Modified_Face&Sketch_1/SketchLine_6"), model.selection("FACE", "Split_1_1_25/Modified_Face&Sketch_1/SketchLine_7"), model.selection("FACE", "Split_1_1_26/Modified_Face&Sketch_1/SketchLine_7"), model.selection("FACE", "Split_1_1_15/Modified_Face&Sketch_1/SketchLine_6"), model.selection("FACE", "Split_1_1_27/Modified_Face&Sketch_1/SketchLine_7"), model.selection("FACE", "Split_1_1_19/Modified_Face&Sketch_1/SketchLine_6"), model.selection("FACE", "Split_1_1_31/Modified_Face&Sketch_1/SketchLine_7"), model.selection("FACE", "Split_1_1_23/Modified_Face&Sketch_1/SketchLine_6"), model.selection("FACE", "Split_1_1_35/Modified_Face&Sketch_1/SketchLine_7"), model.selection("FACE", "Split_1_1_24/Modified_Face&Sketch_1/SketchLine_6"), model.selection("FACE", "Split_1_1_36/Modified_Face&Sketch_1/SketchLine_7"), model.selection("FACE", "Split_1_1_32/Modified_Face&Sketch_1/SketchLine_7"), model.selection("FACE", "Split_1_1_20/Modified_Face&Sketch_1/SketchLine_6"), model.selection("FACE", "Split_1_1_16/Modified_Face&Sketch_1/SketchLine_6"), model.selection("FACE", "Split_1_1_28/Modified_Face&Sketch_1/SketchLine_7"), model.selection("FACE", "Split_1_1_70/Modified_Face&Sketch_1/SketchArc_1_2"), model.selection("FACE", "Split_1_1_42/Modified_Face&Sketch_1/SketchLine_8"), model.selection("FACE", "Split_1_1_68/Modified_Face&Sketch_1/SketchArc_1_2"), model.selection("FACE", "Split_1_1_40/Modified_Face&Sketch_1/SketchLine_8"), model.selection("FACE", "Split_1_1_66/Modified_Face&Sketch_1/SketchArc_1_2"), model.selection("FACE", "Split_1_1_38/Modified_Face&Sketch_1/SketchLine_8"), model.selection("FACE", "Split_1_1_37/Modified_Face&Sketch_1/SketchLine_8"), model.selection("FACE", "Split_1_1_65/Modified_Face&Sketch_1/SketchArc_1_2"), model.selection("FACE", "Split_1_1_39/Modified_Face&Sketch_1/SketchLine_8"), model.selection("FACE", "Split_1_1_67/Modified_Face&Sketch_1/SketchArc_1_2"), model.selection("FACE", "Split_1_1_69/Modified_Face&Sketch_1/SketchArc_1_2"), model.selection("FACE", "Split_1_1_41/Modified_Face&Sketch_1/SketchLine_8"), model.selection("FACE", "Split_1_1_43/Modified_Face&Sketch_1/SketchLine_8"), model.selection("FACE", "Split_1_1_71/Modified_Face&Sketch_1/SketchArc_1_2"), model.selection("FACE", "Split_1_1_44/Modified_Face&Sketch_1/SketchLine_8"), model.selection("FACE", "Split_1_1_72/Modified_Face&Sketch_1/SketchArc_1_2"), model.selection("FACE", "Split_1_1_52/Modified_Face&Sketch_1/SketchLine_9"), model.selection("FACE", "Split_1_1_44/Modified_Face&Sketch_1/SketchLine_9"), model.selection("FACE", "Split_1_1_43/Modified_Face&Sketch_1/SketchLine_9"), model.selection("FACE", "Split_1_1_51/Modified_Face&Sketch_1/SketchLine_9"), model.selection("FACE", "Split_1_1_50/Modified_Face&Sketch_1/SketchLine_9"), model.selection("FACE", "Split_1_1_42/Modified_Face&Sketch_1/SketchLine_9"), model.selection("FACE", "Split_1_1_40/Modified_Face&Sketch_1/SketchLine_9"), model.selection("FACE", "Split_1_1_48/Modified_Face&Sketch_1/SketchLine_9"), model.selection("FACE", "Split_1_1_46/Modified_Face&Sketch_1/SketchLine_9"), model.selection("FACE", "Split_1_1_38/Modified_Face&Sketch_1/SketchLine_9"), model.selection("FACE", "Split_1_1_37/Modified_Face&Sketch_1/SketchLine_9"), model.selection("FACE", "Split_1_1_45/Modified_Face&Sketch_1/SketchLine_9"), model.selection("FACE", "Split_1_1_39/Modified_Face&Sketch_1/SketchLine_9"), model.selection("FACE", "Split_1_1_47/Modified_Face&Sketch_1/SketchLine_9"), model.selection("FACE", "Split_1_1_49/Modified_Face&Sketch_1/SketchLine_9"), model.selection("FACE", "Split_1_1_41/Modified_Face&Sketch_1/SketchLine_9")] +Group_10_objects = [ + model.selection("FACE", "Split_1_1_13/Modified_Face&Sketch_1/SketchLine_6"), + model.selection("FACE", "Split_1_1_14/Modified_Face&Sketch_1/SketchLine_6"), + model.selection("FACE", "Split_1_1_25/Modified_Face&Sketch_1/SketchLine_7"), + model.selection("FACE", "Split_1_1_26/Modified_Face&Sketch_1/SketchLine_7"), + model.selection("FACE", "Split_1_1_15/Modified_Face&Sketch_1/SketchLine_6"), + model.selection("FACE", "Split_1_1_27/Modified_Face&Sketch_1/SketchLine_7"), + model.selection("FACE", "Split_1_1_19/Modified_Face&Sketch_1/SketchLine_6"), + model.selection("FACE", "Split_1_1_31/Modified_Face&Sketch_1/SketchLine_7"), + model.selection("FACE", "Split_1_1_23/Modified_Face&Sketch_1/SketchLine_6"), + model.selection("FACE", "Split_1_1_35/Modified_Face&Sketch_1/SketchLine_7"), + model.selection("FACE", "Split_1_1_24/Modified_Face&Sketch_1/SketchLine_6"), + model.selection("FACE", "Split_1_1_36/Modified_Face&Sketch_1/SketchLine_7"), + model.selection("FACE", "Split_1_1_32/Modified_Face&Sketch_1/SketchLine_7"), + model.selection("FACE", "Split_1_1_20/Modified_Face&Sketch_1/SketchLine_6"), + model.selection("FACE", "Split_1_1_16/Modified_Face&Sketch_1/SketchLine_6"), + model.selection("FACE", "Split_1_1_28/Modified_Face&Sketch_1/SketchLine_7"), + model.selection("FACE", "Split_1_1_70/Modified_Face&Sketch_1/SketchArc_1_2"), + model.selection("FACE", "Split_1_1_42/Modified_Face&Sketch_1/SketchLine_8"), + model.selection("FACE", "Split_1_1_68/Modified_Face&Sketch_1/SketchArc_1_2"), + model.selection("FACE", "Split_1_1_40/Modified_Face&Sketch_1/SketchLine_8"), + model.selection("FACE", "Split_1_1_66/Modified_Face&Sketch_1/SketchArc_1_2"), + model.selection("FACE", "Split_1_1_38/Modified_Face&Sketch_1/SketchLine_8"), + model.selection("FACE", "Split_1_1_37/Modified_Face&Sketch_1/SketchLine_8"), + model.selection("FACE", "Split_1_1_65/Modified_Face&Sketch_1/SketchArc_1_2"), + model.selection("FACE", "Split_1_1_39/Modified_Face&Sketch_1/SketchLine_8"), + model.selection("FACE", "Split_1_1_67/Modified_Face&Sketch_1/SketchArc_1_2"), + model.selection("FACE", "Split_1_1_69/Modified_Face&Sketch_1/SketchArc_1_2"), + model.selection("FACE", "Split_1_1_41/Modified_Face&Sketch_1/SketchLine_8"), + model.selection("FACE", "Split_1_1_43/Modified_Face&Sketch_1/SketchLine_8"), + model.selection("FACE", "Split_1_1_71/Modified_Face&Sketch_1/SketchArc_1_2"), + model.selection("FACE", "Split_1_1_44/Modified_Face&Sketch_1/SketchLine_8"), + model.selection("FACE", "Split_1_1_72/Modified_Face&Sketch_1/SketchArc_1_2"), + model.selection("FACE", "Split_1_1_52/Modified_Face&Sketch_1/SketchLine_9"), + model.selection("FACE", "Split_1_1_44/Modified_Face&Sketch_1/SketchLine_9"), + model.selection("FACE", "Split_1_1_43/Modified_Face&Sketch_1/SketchLine_9"), + model.selection("FACE", "Split_1_1_51/Modified_Face&Sketch_1/SketchLine_9"), + model.selection("FACE", "Split_1_1_50/Modified_Face&Sketch_1/SketchLine_9"), + model.selection("FACE", "Split_1_1_42/Modified_Face&Sketch_1/SketchLine_9"), + model.selection("FACE", "Split_1_1_40/Modified_Face&Sketch_1/SketchLine_9"), + model.selection("FACE", "Split_1_1_48/Modified_Face&Sketch_1/SketchLine_9"), + model.selection("FACE", "Split_1_1_46/Modified_Face&Sketch_1/SketchLine_9"), + model.selection("FACE", "Split_1_1_38/Modified_Face&Sketch_1/SketchLine_9"), + model.selection("FACE", "Split_1_1_37/Modified_Face&Sketch_1/SketchLine_9"), + model.selection("FACE", "Split_1_1_45/Modified_Face&Sketch_1/SketchLine_9"), + model.selection("FACE", "Split_1_1_39/Modified_Face&Sketch_1/SketchLine_9"), + model.selection("FACE", "Split_1_1_47/Modified_Face&Sketch_1/SketchLine_9"), + model.selection("FACE", "Split_1_1_49/Modified_Face&Sketch_1/SketchLine_9"), + model.selection("FACE", "Split_1_1_41/Modified_Face&Sketch_1/SketchLine_9"), +] Group_10 = model.addGroup(Part_2_doc, Group_10_objects) Group_10.setName("CONTACT_VIS") Group_10.result().setName("CONTACT_VIS") -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("COMPSOLID", "Split_1_1")], 0, 100, 0) -AngularCopy_1 = model.addMultiRotation(Part_2_doc, [model.selection("COMPSOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OX"), 4) +Translation_1 = model.addTranslation( + Part_2_doc, [model.selection("COMPSOLID", "Split_1_1")], 0, 100, 0 +) +AngularCopy_1 = model.addMultiRotation( + Part_2_doc, + [model.selection("COMPSOLID", "Translation_1_1")], + model.selection("EDGE", "PartSet/OX"), + 4, +) model.do() # move groups to the end @@ -428,9 +891,9 @@ aFactory = ModelAPI_Session.get().validators() a = 0 num_in_groups = [48, 144, 80, 4, 4, 4, 4, 4, 32, 192] for i in range(Part_2_doc.size("Groups")): - GroupFeature = Part_2_doc.feature(objectToResult(Part_2_doc.object("Groups", i))) - assert(aFactory.validate(GroupFeature)) - assert(GroupFeature.selectionList("group_list").size() == num_in_groups[a]) - a = a + 1 + GroupFeature = Part_2_doc.feature(objectToResult(Part_2_doc.object("Groups", i))) + assert aFactory.validate(GroupFeature) + assert GroupFeature.selectionList("group_list").size() == num_in_groups[a] + a = a + 1 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2650.py b/src/FeaturesPlugin/Test/Test2650.py index da899b8cb..fbc724b8e 100644 --- a/src/FeaturesPlugin/Test/Test2650.py +++ b/src/FeaturesPlugin/Test/Test2650.py @@ -24,34 +24,89 @@ partSet = model.moduleDocument() 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(10.96877310597264, 4.388320842434023, 10.96877310597264, 75.63259202833271) +SketchLine_1 = Sketch_1.addLine( + 10.96877310597264, 4.388320842434023, 10.96877310597264, 75.63259202833271 +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_2 = Sketch_2.addLine(20.69511709668412, -6.720507935503198, 19.39808085030927, 19.46570269579372) -SketchLine_3 = Sketch_2.addLine(19.39808085030927, 19.46570269579372, 61.20243103906213, 28.02128023393725) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_2.addLine(61.20243103906213, 28.02128023393725, 64.54729867171925, -32.684941224703) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_2.addLine(64.54729867171925, -32.684941224703, 20.69511709668412, -6.720507935503198) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchLine_5.endPoint()) +SketchLine_2 = Sketch_2.addLine( + 20.69511709668412, -6.720507935503198, 19.39808085030927, 19.46570269579372 +) +SketchLine_3 = Sketch_2.addLine( + 19.39808085030927, 19.46570269579372, 61.20243103906213, 28.02128023393725 +) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_2.addLine( + 61.20243103906213, 28.02128023393725, 64.54729867171925, -32.684941224703 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_2.addLine( + 64.54729867171925, -32.684941224703, 20.69511709668412, -6.720507935503198 +) +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/SketchLine_1_EndVertex")) +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) -SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchLine_8 = Sketch_3.addLine(57.06415928764967, -9.455161348995592, 56.5687276408287, 11.2362868340608) -SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchLine_9 = Sketch_3.addLine(56.5687276408287, 11.2362868340608, 18.78449167586506, 11.40320166178118) -SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_6.startPoint(), SketchLine_9.endPoint()) +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 +) +SketchConstraintCoincidence_5 = Sketch_3.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchLine_8 = Sketch_3.addLine( + 57.06415928764967, -9.455161348995592, 56.5687276408287, 11.2362868340608 +) +SketchConstraintCoincidence_6 = Sketch_3.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchLine_9 = Sketch_3.addLine( + 56.5687276408287, 11.2362868340608, 18.78449167586506, 11.40320166178118 +) +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_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")]) +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() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Pipe_1, 1) model.testNbSubResults(Pipe_1, [0]) @@ -60,4 +115,4 @@ model.testNbSubShapes(Pipe_1, GeomAPI_Shape.FACE, [6]) model.testNbSubShapes(Pipe_1, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(Pipe_1, GeomAPI_Shape.VERTEX, [48]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2681.py b/src/FeaturesPlugin/Test/Test2681.py index 8850258a5..940c82755 100644 --- a/src/FeaturesPlugin/Test/Test2681.py +++ b/src/FeaturesPlugin/Test/Test2681.py @@ -24,26 +24,62 @@ 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()) +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()) +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) +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()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2686.py b/src/FeaturesPlugin/Test/Test2686.py index 4d9b686e6..0d818c419 100644 --- a/src/FeaturesPlugin/Test/Test2686.py +++ b/src/FeaturesPlugin/Test/Test2686.py @@ -29,24 +29,46 @@ 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) +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()) +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()) +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()) +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) +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()) +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()) +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()) +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()) @@ -56,74 +78,158 @@ 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) +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) +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) +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()) +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()) +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]) +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) +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) +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()) +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()) +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") +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()) +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]) +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() +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) +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") @@ -137,14 +243,24 @@ 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()) +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) +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()) +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) +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") @@ -159,55 +275,192 @@ 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) +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) +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) +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(0, 0, 2.542710267975591))]) -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.02796175964867624, -0.05417366434185267, 2.475075117094407))]) +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(0, 0, 2.542710267975591))], +) +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.02796175964867624, -0.05417366434185267, 2.475075117094407), + ) + ], +) 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.02818028507968423, -0.07071295235452894, 2.466088994028068))]) -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) +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.02818028507968423, -0.07071295235452894, 2.466088994028068), + ) + ], +) +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()) +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()) +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()) +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) +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) +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()) +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) +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()) +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) +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()) +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.382519172194574))]) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", GeomAPI_Pnt(-0.02856815579589599, -0.09246122079397179, 2.463292892680745))], [model.selection("SOLID", GeomAPI_Pnt(-2.136430444927541, -4.104043624269158, 3.360182492861197)), model.selection("SOLID", GeomAPI_Pnt(2.136429748085782, -4.104043260947467, 3.360182494729003))]) +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.382519172194574 + ), + ) + ], +) +Cut_1 = model.addCut( + Part_1_doc, + [ + model.selection( + "SOLID", + GeomAPI_Pnt(-0.02856815579589599, -0.09246122079397179, 2.463292892680745), + ) + ], + [ + model.selection( + "SOLID", + GeomAPI_Pnt(-2.136430444927541, -4.104043624269158, 3.360182492861197), + ), + model.selection( + "SOLID", + GeomAPI_Pnt(2.136429748085782, -4.104043260947467, 3.360182494729003), + ), + ], +) model.do() model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2689.py b/src/FeaturesPlugin/Test/Test2689.py index 900c48585..5c4f140e7 100644 --- a/src/FeaturesPlugin/Test/Test2689.py +++ b/src/FeaturesPlugin/Test/Test2689.py @@ -24,74 +24,195 @@ 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()) +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()) +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()) +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()) +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) +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")] +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")]) +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()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2692.py b/src/FeaturesPlugin/Test/Test2692.py index 60a8510e2..9fc479b05 100644 --- a/src/FeaturesPlugin/Test/Test2692.py +++ b/src/FeaturesPlugin/Test/Test2692.py @@ -24,13 +24,34 @@ 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) +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) @@ -46,4 +67,4 @@ 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()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2693.py b/src/FeaturesPlugin/Test/Test2693.py index 4fe2b1acb..b7d60e532 100644 --- a/src/FeaturesPlugin/Test/Test2693.py +++ b/src/FeaturesPlugin/Test/Test2693.py @@ -27,46 +27,108 @@ 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_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_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()) +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()) +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()) +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 = 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()) +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()) +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()) +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()) +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 = 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 = 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) +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) @@ -74,62 +136,139 @@ 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 = 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()) +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 = 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 = 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) +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 = 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 = 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) +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 = 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) +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 = 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) +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")) +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) +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 = 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 = 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 = 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 = 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 = 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()) @@ -138,16 +277,28 @@ 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 = 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) +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 = 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()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2698.py b/src/FeaturesPlugin/Test/Test2698.py index 42fc5f2ac..84afe229b 100644 --- a/src/FeaturesPlugin/Test/Test2698.py +++ b/src/FeaturesPlugin/Test/Test2698.py @@ -29,39 +29,79 @@ 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()) +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()) +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()) +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()) +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()) +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()) +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()) +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) +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()) +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()) +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()) +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()) +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()) +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()) @@ -71,96 +111,204 @@ 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()) +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) +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) +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()) +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()) +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) +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()) +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) +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) +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) +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()) +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()) +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) +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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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) +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") @@ -173,13 +321,21 @@ 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 = 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 = 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 = 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 = 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()) @@ -187,162 +343,346 @@ 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) +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 = 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 = 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()) +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 = 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) +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) +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 = 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 = 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) +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) +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) +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 = 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 = 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 = 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 = 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]) +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()) +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 = 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 = 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 = 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) +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 = 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 = 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 = 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) +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 = 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 = 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 = 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()) +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 = 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 = 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 = 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 = 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 = 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()) +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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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]) +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()) +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 = 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 = 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 = 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 = 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 = 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 = 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) +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()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2701.py b/src/FeaturesPlugin/Test/Test2701.py index 2b0e5a4d9..4a5cfe048 100644 --- a/src/FeaturesPlugin/Test/Test2701.py +++ b/src/FeaturesPlugin/Test/Test2701.py @@ -29,77 +29,187 @@ 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()) +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()) +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()) +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()) +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 = 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()) +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 = 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()) +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 = 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_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 = 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()) +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 = 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()) +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 = 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()) +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 = 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) +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 = 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) +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) +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) @@ -107,9 +217,15 @@ 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) +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()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2724.py b/src/FeaturesPlugin/Test/Test2724.py index c72e79d20..7fd182c52 100644 --- a/src/FeaturesPlugin/Test/Test2724.py +++ b/src/FeaturesPlugin/Test/Test2724.py @@ -29,36 +29,116 @@ 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()) +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()) +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) +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()) +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) +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() +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") +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))]) +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)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_WEAK) model.end() diff --git a/src/FeaturesPlugin/Test/Test2729.py b/src/FeaturesPlugin/Test/Test2729.py index 676b00a63..f329f352c 100644 --- a/src/FeaturesPlugin/Test/Test2729.py +++ b/src/FeaturesPlugin/Test/Test2729.py @@ -50,34 +50,66 @@ 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()) +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()) +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()) +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()) +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()) +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()) +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()) +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()) +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()) +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()) +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) +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) +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()) +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()) @@ -90,105 +122,236 @@ 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") +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") +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) +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) +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) +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()) +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()) +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()) +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()) +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()) +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 = 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 = 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 = 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()) +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()) +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]) +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()) +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) +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 = 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 = 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()) +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") +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 = 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 = 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 = 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 = 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()) +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()) +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 = 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 = 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 = 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()) +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 = 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) @@ -197,33 +360,79 @@ 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) +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) +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 = 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 = 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) +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 = 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) +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") @@ -232,8 +441,21 @@ 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&Extrusion_1_1/To_Face)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_23)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_25)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchArc_2_2)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_24)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchArc_3_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_12)2(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_11)2(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10)2(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2)2(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3)2(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_5)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_21)2(ExtrusionCut_1_1/From_Face_1)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_27)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&Extrusion_1_1/To_Face)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_23)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_25)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchArc_2_2)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_24)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchArc_3_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_12)2(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_11)2(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10)2(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2)2(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3)2(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_5)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_21)2(ExtrusionCut_1_1/From_Face_1)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_27)2", + ), +) 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) @@ -245,7 +467,8 @@ model.end() # check that radius constraint is valid from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(SketchConstraintRadius_3.feature())) +assert aFactory.validate(SketchConstraintRadius_3.feature()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2738.py b/src/FeaturesPlugin/Test/Test2738.py index 3cc0d3f44..88a0d2a34 100644 --- a/src/FeaturesPlugin/Test/Test2738.py +++ b/src/FeaturesPlugin/Test/Test2738.py @@ -27,20 +27,62 @@ Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "d", "8") model.addParameter(Part_1_doc, "nb", "3") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_1 = Sketch_1.addCircle(-34.12026714434272, 28.71281409244911, 1.619211673722419) -SketchCircle_2 = Sketch_1.addCircle(-34.12026714434272, 28.71281409244911, 3.180589706721861) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchCircle_2.center()) +SketchCircle_1 = Sketch_1.addCircle( + -34.12026714434272, 28.71281409244911, 1.619211673722419 +) +SketchCircle_2 = Sketch_1.addCircle( + -34.12026714434272, 28.71281409244911, 3.180589706721861 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchCircle_2.center() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE_2", (-35.73947881806514, 28.71281409244911, 0))], model.selection(), 2, -1) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", (-37.30085685106458, 28.71281409244911, 0))], model.selection(), 5, 0) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1"), model.selection("COMPOUND", "all-in-Extrusion_2")]) -Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", (-34.12026714434272, 28.71281409244911, 1.5))]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE_2", (-35.73947881806514, 28.71281409244911, 0))], + model.selection(), + 2, + -1, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", (-37.30085685106458, 28.71281409244911, 0))], + model.selection(), + 5, + 0, +) +Partition_1 = model.addPartition( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Extrusion_1"), + model.selection("COMPOUND", "all-in-Extrusion_2"), + ], +) +Group_1 = model.addGroup( + Part_1_doc, [model.selection("SOLID", (-34.12026714434272, 28.71281409244911, 1.5))] +) Group_1.setName("Group_dechets") Group_1.result().setName("Group_dechets") -Group_2 = model.addGroup(Part_1_doc, [model.selection("SOLID", (-34.12026714434272, 28.71281409244911, 2.554668601838412))]) +Group_2 = model.addGroup( + Part_1_doc, + [ + model.selection( + "SOLID", (-34.12026714434272, 28.71281409244911, 2.554668601838412) + ) + ], +) Group_2.setName("Group_colis") Group_2.result().setName("Group_colis") -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPSOLID", (-34.12026714434272, 28.71281409244911, 2.5))], model.selection("EDGE", "PartSet/OX"), "d", "nb", model.selection("EDGE", "PartSet/OY"), "d", "nb") +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPSOLID", (-34.12026714434272, 28.71281409244911, 2.5))], + model.selection("EDGE", "PartSet/OX"), + "d", + "nb", + model.selection("EDGE", "PartSet/OY"), + "d", + "nb", +) model.do() # move groups to the end Part_1_doc.moveFeature(Group_1.feature(), LinearCopy_1.feature()) @@ -48,25 +90,32 @@ Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) model.end() from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() # number of solids should be multiplyed by linear copy selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 9) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 9 +assert aFactory.validate(Group_1.feature()) # checkthat solids in the first group are small, like the origin for i in range(9): - delta = GeomAlgoAPI_ShapeTools.volume(selectionList.value(i).value()) - 8.236773528312948 - assert(fabs(delta) < 1.e-5) + delta = ( + GeomAlgoAPI_ShapeTools.volume(selectionList.value(i).value()) + - 8.236773528312948 + ) + assert fabs(delta) < 1.0e-5 # same-plane faces should be merged selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 9) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 9 +assert aFactory.validate(Group_2.feature()) # checkthat solids in the secong group are big, like the origin for i in range(9): - delta = GeomAlgoAPI_ShapeTools.volume(selectionList.value(i).value()) - 150.66735294710597 - assert(fabs(delta) < 1.e-5) + delta = ( + GeomAlgoAPI_ShapeTools.volume(selectionList.value(i).value()) + - 150.66735294710597 + ) + assert fabs(delta) < 1.0e-5 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2751.py b/src/FeaturesPlugin/Test/Test2751.py index 3eccc0bad..6d89b6981 100644 --- a/src/FeaturesPlugin/Test/Test2751.py +++ b/src/FeaturesPlugin/Test/Test2751.py @@ -32,59 +32,127 @@ 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) +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) +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) +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()) +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()) +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()) +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()) +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 = 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()) +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) +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) +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") +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") +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) +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) +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") -Split_1 = model.addSplit(Part_1_doc, [model.selection("FACE", (30, 30, 0))], [model.selection("COMPOUND", (29.25281542867235, 29.25281542867235, 5))]) +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", +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("FACE", (30, 30, 0))], + [model.selection("COMPOUND", (29.25281542867235, 29.25281542867235, 5))], +) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2817.py b/src/FeaturesPlugin/Test/Test2817.py index 957dee696..8ed0c32d3 100644 --- a/src/FeaturesPlugin/Test/Test2817.py +++ b/src/FeaturesPlugin/Test/Test2817.py @@ -26,45 +26,98 @@ 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection(), + 100, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) SketchLine_1 = Sketch_2.addLine(50, 10, -50, 10) SketchLine_2 = Sketch_2.addLine(-50, 10, -50, 90) SketchLine_3 = Sketch_2.addLine(-50, 90, 50, 90) SketchLine_4 = Sketch_2.addLine(50, 90, 50, 10) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_1.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_2 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_1.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() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_1.result()) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_4.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchCircle_1"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchCircle_1"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.result(), 10, True) -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_4.result(), 50, True) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.result(), 10, True +) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_4.result(), 50, True +) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), 100) SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_2.result(), 80) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")]) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), 12, keepSubResults = True) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")], keepSubResults = True) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_2/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 12, + keepSubResults=True, +) +Partition_1 = model.addPartition( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], + keepSubResults=True, +) Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Partition_1_1_3")) SketchLine_5 = Sketch_3.addLine(50, 43.33333333333334, 35, 43.33333333333334) SketchLine_6 = Sketch_3.addLine(35, 43.33333333333334, 35, 23.33333333333333) SketchLine_7 = Sketch_3.addLine(35, 23.33333333333333, 50, 23.33333333333333) SketchLine_8 = Sketch_3.addLine(50, 23.33333333333333, 50, 43.33333333333334) -SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_6 = Sketch_3.setCoincident( + SketchLine_8.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_3.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_3.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_3.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_6.result()) SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_7.result()) @@ -73,40 +126,97 @@ SketchLine_9 = Sketch_3.addLine(50, 76.66666666666667, 35, 76.66666666666667) SketchLine_10 = Sketch_3.addLine(35, 76.66666666666667, 35, 56.66666666666666) SketchLine_11 = Sketch_3.addLine(35, 56.66666666666666, 50, 56.66666666666666) SketchLine_12 = Sketch_3.addLine(50, 56.66666666666666, 50, 76.66666666666667) -SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_10 = Sketch_3.setCoincident( + SketchLine_12.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_3.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_3.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_10.result()) SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_6 = Sketch_3.setVertical(SketchLine_12.result()) -SketchConstraintEqual_1 = Sketch_3.setEqual(SketchLine_8.result(), SketchLine_12.result()) -SketchConstraintEqual_2 = Sketch_3.setEqual(SketchLine_11.result(), SketchLine_7.result()) -SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "Partition_1_1_3/Modified_Edge&Sketch_2/SketchLine_2&Sketch_2/SketchLine_4"), False) +SketchConstraintEqual_1 = Sketch_3.setEqual( + SketchLine_8.result(), SketchLine_12.result() +) +SketchConstraintEqual_2 = Sketch_3.setEqual( + SketchLine_11.result(), SketchLine_7.result() +) +SketchProjection_3 = Sketch_3.addProjection( + model.selection( + "EDGE", + "Partition_1_1_3/Modified_Edge&Sketch_2/SketchLine_2&Sketch_2/SketchLine_4", + ), + False, +) SketchLine_13 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_13.result()) -SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_7.endPoint(), SketchLine_13.result()) +SketchConstraintCoincidence_14 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_13.result() +) +SketchConstraintCoincidence_15 = Sketch_3.setCoincident( + SketchLine_7.endPoint(), SketchLine_13.result() +) SketchConstraintLength_3 = Sketch_3.setLength(SketchLine_7.result(), 15) SketchConstraintLength_4 = Sketch_3.setLength(SketchLine_8.result(), 20) SketchLine_14 = Sketch_3.addLine(50, 10, 50, 23.33333333333333) SketchLine_14.setAuxiliary(True) -SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_13).endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_7.endPoint(), SketchLine_14.endPoint()) +SketchConstraintCoincidence_16 = Sketch_3.setCoincident( + SketchAPI_Line(SketchLine_13).endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_3.setCoincident( + SketchLine_7.endPoint(), SketchLine_14.endPoint() +) SketchLine_15 = Sketch_3.addLine(50, 43.33333333333334, 50, 56.66666666666666) SketchLine_15.setAuxiliary(True) -SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_5.startPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_15.endPoint()) +SketchConstraintCoincidence_18 = Sketch_3.setCoincident( + SketchLine_5.startPoint(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_19 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_15.endPoint() +) SketchLine_16 = Sketch_3.addLine(50, 76.66666666666667, 50, 90) SketchLine_16.setAuxiliary(True) -SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_9.startPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_13).startPoint(), SketchLine_16.endPoint()) -SketchConstraintEqual_3 = Sketch_3.setEqual(SketchLine_14.result(), SketchLine_15.result()) -SketchConstraintEqual_4 = Sketch_3.setEqual(SketchLine_15.result(), SketchLine_16.result()) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident( + SketchLine_9.startPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_21 = Sketch_3.setCoincident( + SketchAPI_Line(SketchLine_13).startPoint(), SketchLine_16.endPoint() +) +SketchConstraintEqual_3 = Sketch_3.setEqual( + SketchLine_14.result(), SketchLine_15.result() +) +SketchConstraintEqual_4 = Sketch_3.setEqual( + SketchLine_15.result(), SketchLine_16.result() +) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 5, 5) -AngularCopy_2 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")], model.selection("EDGE", "PartSet/OZ"), 12, keepSubResults = True) -Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "Partition_1_1")], [model.selection("COMPOUND", "AngularCopy_2_1"), model.selection("COMPOUND", "AngularCopy_2_2")], keepSubResults = True) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 5, 5 +) +AngularCopy_2 = model.addMultiRotation( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "Extrusion_2_2"), + ], + model.selection("EDGE", "PartSet/OZ"), + 12, + keepSubResults=True, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("COMPOUND", "Partition_1_1")], + [ + model.selection("COMPOUND", "AngularCopy_2_1"), + model.selection("COMPOUND", "AngularCopy_2_2"), + ], + keepSubResults=True, +) model.end() from GeomAPI import * @@ -119,4 +229,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [213]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [426]) model.testResultsVolumes(Cut_1, [282743.338823]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2826.py b/src/FeaturesPlugin/Test/Test2826.py index 73c00d6e0..902c69be8 100644 --- a/src/FeaturesPlugin/Test/Test2826.py +++ b/src/FeaturesPlugin/Test/Test2826.py @@ -28,25 +28,45 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(6.188, 9.025, 6.188, -3.45) SketchLine_2 = Sketch_1.addLine(6.188, -3.45, 0, -3.45) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(0, -3.45, 0, -6.449999999999999) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(0, -6.449999999999999, 7.782, -6.45) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(7.782, -6.45, 7.782, -3.45) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(7.782, -3.45, 6.538, -3.45) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(6.538, -3.45, 6.538, -2.4) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(6.538, -2.4, 6.375999999999999, -2.25) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(6.375999999999999, -2.25, 6.375999999999999, 9.025) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchLine_10 = Sketch_1.addLine(6.375999999999999, 9.025, 6.188, 9.025) SketchLine_10.setAuxiliary(True) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_10.endPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_10.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) @@ -56,327 +76,738 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_7.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_11 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_11.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_11).startPoint(), SketchLine_2.result(), 3.45, True) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_11.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_11).startPoint(), SketchLine_2.result(), 3.45, True +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 3) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_12 = SketchProjection_2.createdFeature() -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_12.result(), 9.025, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_12.result(), 9.025, True +) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_10.result(), 0.188) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_8.endPoint(), SketchLine_7.endPoint(), 0.15) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_2.result()) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_1.result(), 0.35, True) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_12.result(), 2.25, True) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_11.result(), 6.188, True) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_8.endPoint(), SketchLine_7.endPoint(), 0.15 +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_2.result() +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.endPoint(), SketchLine_1.result(), 0.35, True +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_12.result(), 2.25, True +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_2.startPoint(), SketchLine_11.result(), 6.188, True +) SketchLine_13 = Sketch_1.addLine(7.032, -4.050000000000001, 5.532, -4.050000000000001) SketchLine_14 = Sketch_1.addLine(5.532, -4.050000000000001, 5.532, -5.850000000000001) SketchLine_15 = Sketch_1.addLine(5.532, -5.850000000000001, 7.032, -5.850000000000001) SketchLine_16 = Sketch_1.addLine(7.032, -5.850000000000001, 7.032, -4.050000000000001) -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()) +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_5 = Sketch_1.setHorizontal(SketchLine_13.result()) SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_14.result()) SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_15.result()) SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_16.result()) SketchLine_17 = Sketch_1.addLine(6.282, 9.025000000000013, 6.282, -4.050000000000002) SketchLine_17.setAuxiliary(True) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_17.startPoint(), SketchLine_10.result()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_13.result()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_17.startPoint(), SketchLine_10.result() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_13.result() +) SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_17.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_17.startPoint(), SketchLine_10.result()) -SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint(SketchLine_17.endPoint(), SketchLine_13.result()) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchLine_17.startPoint(), SketchLine_10.result() +) +SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint( + SketchLine_17.endPoint(), SketchLine_13.result() +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_13.result(), 1.5) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_16.result(), 1.8) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_17.endPoint(), SketchLine_5.result(), 1.5, True) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_14.startPoint(), SketchLine_2.result(), 0.6, True) -SketchLine_18 = Sketch_1.addLine(6.375999999999999, 9.025, 6.537999999999999, 9.186999999999999) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_18.startPoint()) -SketchLine_19 = Sketch_1.addLine(6.537999999999999, 9.186999999999999, 6.537999999999999, 10.256) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_17.endPoint(), SketchLine_5.result(), 1.5, True +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchLine_14.startPoint(), SketchLine_2.result(), 0.6, True +) +SketchLine_18 = Sketch_1.addLine( + 6.375999999999999, 9.025, 6.537999999999999, 9.186999999999999 +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_18.startPoint() +) +SketchLine_19 = Sketch_1.addLine( + 6.537999999999999, 9.186999999999999, 6.537999999999999, 10.256 +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) SketchLine_20 = Sketch_1.addLine(6.537999999999999, 10.256, 6.188, 10.256) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) SketchLine_21 = Sketch_1.addLine(6.188, 10.256, 4.938, 10.97786688777512) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.startPoint() +) SketchLine_22 = Sketch_1.addLine(6.188, 9.025, 6.082, 9.532) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_22.startPoint()) -SketchArc_1 = Sketch_1.addArc(4.793854309433998, 9.262673655435936, 6.082, 9.532, 5.676829966640704, 10.23848613167324, False) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchArc_1.startPoint()) -SketchLine_23 = Sketch_1.addLine(5.676829966640704, 10.23848613167324, 5.417460848824595, 10.45671600291324) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_23.startPoint()) -SketchLine_24 = Sketch_1.addLine(5.417460848824595, 10.45671600291324, 5.143396378647488, 10.65615482129427) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) -SketchLine_25 = Sketch_1.addLine(5.143396378647488, 10.65615482129427, 4.856000000000001, 10.83583872155447) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint()) -SketchArc_2 = Sketch_1.addArc(0, 2.425, 4.856000000000001, 10.83583872155447, 0, 12.137, False) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchArc_2.startPoint()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_22.startPoint() +) +SketchArc_1 = Sketch_1.addArc( + 4.793854309433998, + 9.262673655435936, + 6.082, + 9.532, + 5.676829966640704, + 10.23848613167324, + False, +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_22.endPoint(), SketchArc_1.startPoint() +) +SketchLine_23 = Sketch_1.addLine( + 5.676829966640704, 10.23848613167324, 5.417460848824595, 10.45671600291324 +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_23.startPoint() +) +SketchLine_24 = Sketch_1.addLine( + 5.417460848824595, 10.45671600291324, 5.143396378647488, 10.65615482129427 +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchLine_23.endPoint(), SketchLine_24.startPoint() +) +SketchLine_25 = Sketch_1.addLine( + 5.143396378647488, 10.65615482129427, 4.856000000000001, 10.83583872155447 +) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_24.endPoint(), SketchLine_25.startPoint() +) +SketchArc_2 = Sketch_1.addArc( + 0, 2.425, 4.856000000000001, 10.83583872155447, 0, 12.137, False +) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchLine_25.endPoint(), SketchArc_2.startPoint() +) SketchArc_3 = Sketch_1.addArc(0, 2.425, 4.938, 10.97786688777512, 0, 12.301, False) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchArc_3.startPoint()) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_3.center(), SketchArc_2.center()) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_11.result()) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchArc_2.center() +) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_11.result() +) SketchArc_4 = Sketch_1.addArc(0, 2.425, 0, 12.219, 6.538, 9.717255618119815, True) SketchArc_4.setAuxiliary(True) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_2.center(), SketchArc_4.center()) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchArc_4.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_4.results()[1], 9.794) SketchLine_26 = Sketch_1.addLine(0, 12.301, 0, 12.137) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_26.startPoint()) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_26.endPoint()) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchLine_26.startPoint(), SketchLine_11.result()) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchLine_26.endPoint(), SketchArc_2.endPoint()) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchLine_11.result(), SketchLine_26.endPoint()) -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchLine_26.result()) -SketchConstraintMiddle_3 = Sketch_1.setMiddlePoint(SketchArc_4.startPoint(), SketchLine_26.result()) -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_26.startPoint(), SketchArc_4.startPoint(), 0.082, True) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_26.startPoint() +) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_26.endPoint() +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchLine_26.startPoint(), SketchLine_11.result() +) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchLine_26.endPoint(), SketchArc_2.endPoint() +) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchLine_11.result(), SketchLine_26.endPoint() +) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchArc_4.startPoint(), SketchLine_26.result() +) +SketchConstraintMiddle_3 = Sketch_1.setMiddlePoint( + SketchArc_4.startPoint(), SketchLine_26.result() +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchLine_26.startPoint(), SketchArc_4.startPoint(), 0.082, True +) SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_20.result()) SketchConstraintVertical_9 = Sketch_1.setVertical(SketchLine_19.result()) -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchArc_3.center(), SketchLine_12.result(), 2.425, True) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchArc_3.center(), SketchLine_12.result(), 2.425, True +) SketchLine_27 = Sketch_1.addLine(4.856000000000001, 10.83583872155447, 0, 2.425) SketchLine_27.setAuxiliary(True) -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_27.startPoint()) -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_27.endPoint()) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchLine_25.endPoint(), SketchLine_27.startPoint() +) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_27.endPoint() +) SketchLine_28 = Sketch_1.addLine(5.143396378647488, 10.65615482129427, 0, 2.425) SketchLine_28.setAuxiliary(True) -SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchLine_28.startPoint()) -SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_28.endPoint()) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident( + SketchLine_24.endPoint(), SketchLine_28.startPoint() +) +SketchConstraintCoincidence_42 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_28.endPoint() +) SketchLine_29 = Sketch_1.addLine(0, 2.425, 5.417460848824595, 10.45671600291324) SketchLine_29.setAuxiliary(True) -SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_29.startPoint()) -SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_29.endPoint()) +SketchConstraintCoincidence_43 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_29.startPoint() +) +SketchConstraintCoincidence_44 = Sketch_1.setCoincident( + SketchLine_23.endPoint(), SketchLine_29.endPoint() +) SketchLine_30 = Sketch_1.addLine(5.676829966640704, 10.23848613167324, 0, 2.425) SketchLine_30.setAuxiliary(True) -SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_30.startPoint()) -SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_30.endPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_27.result(), SketchLine_11.result(), 29.99999999999999) -SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_28.result(), SketchLine_11.result(), 32.00000000000001) -SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_29.result(), SketchLine_11.result(), 34.00000000000001) -SketchConstraintAngle_4 = Sketch_1.setAngle(SketchLine_30.result(), SketchLine_11.result(), 36.00000000000001) -SketchConstraintAngle_5 = Sketch_1.setAngleComplementary(SketchLine_18.result(), SketchLine_10.result(), 44.99999999999972) +SketchConstraintCoincidence_45 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_30.startPoint() +) +SketchConstraintCoincidence_46 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_30.endPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_27.result(), SketchLine_11.result(), 29.99999999999999 +) +SketchConstraintAngle_2 = Sketch_1.setAngle( + SketchLine_28.result(), SketchLine_11.result(), 32.00000000000001 +) +SketchConstraintAngle_3 = Sketch_1.setAngle( + SketchLine_29.result(), SketchLine_11.result(), 34.00000000000001 +) +SketchConstraintAngle_4 = Sketch_1.setAngle( + SketchLine_30.result(), SketchLine_11.result(), 36.00000000000001 +) +SketchConstraintAngle_5 = Sketch_1.setAngleComplementary( + SketchLine_18.result(), SketchLine_10.result(), 44.99999999999972 +) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_20.result(), 0.35) -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchLine_20.startPoint(), SketchLine_12.result(), 10.256, True) +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchLine_20.startPoint(), SketchLine_12.result(), 10.256, True +) SketchConstraintDistance_10.setName("SketchConstraintDistance_13") -SketchConstraintDistance_11 = Sketch_1.setDistance(SketchLine_22.endPoint(), SketchLine_1.result(), 0.106, True) +SketchConstraintDistance_11 = Sketch_1.setDistance( + SketchLine_22.endPoint(), SketchLine_1.result(), 0.106, True +) SketchConstraintDistance_11.setName("SketchConstraintDistance_14") -SketchConstraintDistance_12 = Sketch_1.setDistance(SketchLine_22.endPoint(), SketchLine_12.result(), 9.532, True) +SketchConstraintDistance_12 = Sketch_1.setDistance( + SketchLine_22.endPoint(), SketchLine_12.result(), 9.532, True +) SketchConstraintDistance_12.setName("SketchConstraintDistance_15") -SketchLine_31 = Sketch_1.addLine(4.856000000000001, 10.83583872155447, 4.938, 10.97786688777512) +SketchLine_31 = Sketch_1.addLine( + 4.856000000000001, 10.83583872155447, 4.938, 10.97786688777512 +) SketchLine_31.setAuxiliary(True) -SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_47 = Sketch_1.setCoincident( + SketchLine_25.endPoint(), SketchLine_31.startPoint() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_48") -SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchLine_31.endPoint()) +SketchConstraintCoincidence_48 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchLine_31.endPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_49") -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_31.result(), SketchLine_27.result()) -SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_19.result()) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_31.result(), SketchLine_27.result() +) +SketchConstraintCoincidence_49 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_19.result() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_50") SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_1.results()[1], 1.316) -SketchLine_32 = Sketch_1.addLine(5.143396378647488, 10.65615482129427, 5.236653048654413, 10.80539669036974) +SketchLine_32 = Sketch_1.addLine( + 5.143396378647488, 10.65615482129427, 5.236653048654413, 10.80539669036974 +) SketchLine_32.setAuxiliary(True) -SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_50 = Sketch_1.setCoincident( + SketchLine_24.endPoint(), SketchLine_32.startPoint() +) SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_51") -SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_32.endPoint(), SketchLine_21.result()) +SketchConstraintCoincidence_51 = Sketch_1.setCoincident( + SketchLine_32.endPoint(), SketchLine_21.result() +) SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_52") -SketchLine_33 = Sketch_1.addLine(5.417460848824595, 10.45671600291324, 5.536033128724348, 10.63250663704018) +SketchLine_33 = Sketch_1.addLine( + 5.417460848824595, 10.45671600291324, 5.536033128724348, 10.63250663704018 +) SketchLine_33.setAuxiliary(True) -SketchConstraintCoincidence_52 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_52 = Sketch_1.setCoincident( + SketchLine_23.endPoint(), SketchLine_33.startPoint() +) SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_53") -SketchConstraintCoincidence_53 = Sketch_1.setCoincident(SketchLine_33.endPoint(), SketchLine_21.result()) +SketchConstraintCoincidence_53 = Sketch_1.setCoincident( + SketchLine_33.endPoint(), SketchLine_21.result() +) SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_54") -SketchLine_34 = Sketch_1.addLine(5.676829966640704, 10.23848613167324, 5.836876630976977, 10.4587714668974) +SketchLine_34 = Sketch_1.addLine( + 5.676829966640704, 10.23848613167324, 5.836876630976977, 10.4587714668974 +) SketchLine_34.setAuxiliary(True) -SketchConstraintCoincidence_54 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_54 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_34.startPoint() +) SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_55") -SketchConstraintCoincidence_55 = Sketch_1.setCoincident(SketchLine_34.endPoint(), SketchLine_21.result()) +SketchConstraintCoincidence_55 = Sketch_1.setCoincident( + SketchLine_34.endPoint(), SketchLine_21.result() +) SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_56") -SketchConstraintCollinear_2 = Sketch_1.setCollinear(SketchLine_32.result(), SketchLine_28.result()) -SketchConstraintCollinear_3 = Sketch_1.setCollinear(SketchLine_33.result(), SketchLine_29.result()) -SketchConstraintCollinear_4 = Sketch_1.setCollinear(SketchLine_34.result(), SketchLine_30.result()) +SketchConstraintCollinear_2 = Sketch_1.setCollinear( + SketchLine_32.result(), SketchLine_28.result() +) +SketchConstraintCollinear_3 = Sketch_1.setCollinear( + SketchLine_33.result(), SketchLine_29.result() +) +SketchConstraintCollinear_4 = Sketch_1.setCollinear( + SketchLine_34.result(), SketchLine_30.result() +) SketchPoint_1 = Sketch_1.addPoint(5.190029273900029, 10.73078305375602) -SketchConstraintCoincidence_56 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_4.results()[1]) +SketchConstraintCoincidence_56 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_4.results()[1] +) SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_57") -SketchConstraintCoincidence_57 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_32.result()) +SketchConstraintCoincidence_57 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_32.result() +) SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_58") -SketchConstraintDistance_13 = Sketch_1.setDistance(SketchLine_25.startPoint(), SketchPoint_1.coordinates(), 0.08799999999999999, True) +SketchConstraintDistance_13 = Sketch_1.setDistance( + SketchLine_25.startPoint(), SketchPoint_1.coordinates(), 0.08799999999999999, True +) SketchConstraintDistance_13.setName("SketchConstraintDistance_16") SketchPoint_2 = Sketch_1.addPoint(5.476735296592504, 10.54459398560407) -SketchConstraintCoincidence_58 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchArc_4.results()[1]) +SketchConstraintCoincidence_58 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchArc_4.results()[1] +) SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_59") -SketchConstraintCoincidence_59 = Sketch_1.setCoincident(SketchLine_33.result(), SketchPoint_2.coordinates()) +SketchConstraintCoincidence_59 = Sketch_1.setCoincident( + SketchLine_33.result(), SketchPoint_2.coordinates() +) SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_60") -SketchConstraintDistance_14 = Sketch_1.setDistance(SketchLine_24.startPoint(), SketchPoint_2.coordinates(), 0.106, True) +SketchConstraintDistance_14 = Sketch_1.setDistance( + SketchLine_24.startPoint(), SketchPoint_2.coordinates(), 0.106, True +) SketchConstraintDistance_14.setName("SketchConstraintDistance_17") SketchPoint_3 = Sketch_1.addPoint(5.756768760952494, 10.34851244290823) -SketchConstraintCoincidence_60 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchArc_4.results()[1]) +SketchConstraintCoincidence_60 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchArc_4.results()[1] +) SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_61") -SketchConstraintCoincidence_61 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_34.result()) +SketchConstraintCoincidence_61 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_34.result() +) SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_62") -SketchConstraintDistance_15 = Sketch_1.setDistance(SketchArc_1.endPoint(), SketchPoint_3.coordinates(), 0.136, True) +SketchConstraintDistance_15 = Sketch_1.setDistance( + SketchArc_1.endPoint(), SketchPoint_3.coordinates(), 0.136, True +) SketchConstraintDistance_15.setName("SketchConstraintDistance_18") -SketchConstraintCoincidence_62 = Sketch_1.setCoincident(SketchLine_21.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_62 = Sketch_1.setCoincident( + SketchLine_21.startPoint(), SketchLine_1.result() +) SketchConstraintCoincidence_62.setName("SketchConstraintCoincidence_63") 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_18f-SketchLine_19f-SketchLine_20f-SketchLine_21f-SketchArc_3_2f-SketchLine_26f-SketchArc_2_2r-SketchLine_25r-SketchLine_24r-SketchLine_23r-SketchArc_1_2r-SketchLine_22r-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r")], model.selection("EDGE", "PartSet/OZ"), 360, 0) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_4")]) +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_18f-SketchLine_19f-SketchLine_20f-SketchLine_21f-SketchArc_3_2f-SketchLine_26f-SketchArc_2_2r-SketchLine_25r-SketchLine_24r-SketchLine_23r-SketchArc_1_2r-SketchLine_22r-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r", + ) + ], + model.selection("EDGE", "PartSet/OZ"), + 360, + 0, +) +Group_1 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_4")], +) Group_1.setName("Base") Group_1.result().setName("Base") -Group_2_objects = [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchArc_1_2")] +Group_2_objects = [ + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchArc_1_2"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) Group_2.setName("Faces_int") Group_2.result().setName("Faces_int") -Group_3_objects = [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_16"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_14"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_15")] +Group_3_objects = [ + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_16"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_14"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_15"), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) Group_3.setName("Faces_gallerie") Group_3.result().setName("Faces_gallerie") Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) -SketchLine_35 = Sketch_2.addLine(3.397674805046317, 12.11397308570391, 3.082152448528626, 11.21424138021434) -SketchLine_36 = Sketch_2.addLine(3.241000000000001, 12.09482302308413, 3.241000000000001, 11.06850194037818) +SketchLine_35 = Sketch_2.addLine( + 3.397674805046317, 12.11397308570391, 3.082152448528626, 11.21424138021434 +) +SketchLine_36 = Sketch_2.addLine( + 3.241000000000001, 12.09482302308413, 3.241000000000001, 11.06850194037818 +) SketchLine_36.setAuxiliary(True) SketchConstraintVertical_10 = Sketch_2.setVertical(SketchLine_36.result()) SketchPoint_4 = Sketch_2.addPoint(3.241, 11.66720509403099) -SketchConstraintCoincidence_63 = Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchLine_35.result()) +SketchConstraintCoincidence_63 = Sketch_2.setCoincident( + SketchPoint_4.coordinates(), SketchLine_35.result() +) SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_64") -SketchConstraintCoincidence_64 = Sketch_2.setCoincident(SketchLine_36.result(), SketchPoint_4.coordinates()) +SketchConstraintCoincidence_64 = Sketch_2.setCoincident( + SketchLine_36.result(), SketchPoint_4.coordinates() +) SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_65") -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchArc_4_2"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchArc_4_2"), False +) SketchArc_5 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_65 = Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchArc_5.results()[1]) +SketchConstraintCoincidence_65 = Sketch_2.setCoincident( + SketchPoint_4.coordinates(), SketchArc_5.results()[1] +) SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_66") -SketchConstraintAngle_6 = Sketch_2.setAngleComplementary(SketchLine_35.result(), SketchLine_36.result(), 160.675) -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchConstraintAngle_6 = Sketch_2.setAngleComplementary( + SketchLine_35.result(), SketchLine_36.result(), 160.675 +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_37 = SketchProjection_4.createdFeature() -SketchConstraintDistance_16 = Sketch_2.setDistance(SketchPoint_4.coordinates(), SketchLine_37.result(), 3.241, True) +SketchConstraintDistance_16 = Sketch_2.setDistance( + SketchPoint_4.coordinates(), SketchLine_37.result(), 3.241, True +) SketchConstraintDistance_16.setName("SketchConstraintDistance_19") -SketchLine_38 = Sketch_2.addLine(3.911629569238839, 11.53981731861503, 3.828898026216406, 11.30390315670624) -SketchLine_39 = Sketch_2.addLine(3.828898026216406, 11.30390315670624, 4.057270795192212, 11.20218846558286) -SketchConstraintCoincidence_66 = Sketch_2.setCoincident(SketchLine_38.endPoint(), SketchLine_39.startPoint()) +SketchLine_38 = Sketch_2.addLine( + 3.911629569238839, 11.53981731861503, 3.828898026216406, 11.30390315670624 +) +SketchLine_39 = Sketch_2.addLine( + 3.828898026216406, 11.30390315670624, 4.057270795192212, 11.20218846558286 +) +SketchConstraintCoincidence_66 = Sketch_2.setCoincident( + SketchLine_38.endPoint(), SketchLine_39.startPoint() +) SketchConstraintCoincidence_66.setName("SketchConstraintCoincidence_67") -SketchLine_40 = Sketch_2.addLine(4.057270795192212, 11.20218846558286, 4.140002338214646, 11.43810262749166) +SketchLine_40 = Sketch_2.addLine( + 4.057270795192212, 11.20218846558286, 4.140002338214646, 11.43810262749166 +) SketchLine_40.setAuxiliary(True) -SketchConstraintCoincidence_67 = Sketch_2.setCoincident(SketchLine_39.endPoint(), SketchLine_40.startPoint()) +SketchConstraintCoincidence_67 = Sketch_2.setCoincident( + SketchLine_39.endPoint(), SketchLine_40.startPoint() +) SketchConstraintCoincidence_67.setName("SketchConstraintCoincidence_68") -SketchLine_41 = Sketch_2.addLine(4.140002338214646, 11.43810262749166, 3.911629569238839, 11.53981731861503) -SketchConstraintCoincidence_68 = Sketch_2.setCoincident(SketchLine_40.endPoint(), SketchLine_41.startPoint()) +SketchLine_41 = Sketch_2.addLine( + 4.140002338214646, 11.43810262749166, 3.911629569238839, 11.53981731861503 +) +SketchConstraintCoincidence_68 = Sketch_2.setCoincident( + SketchLine_40.endPoint(), SketchLine_41.startPoint() +) SketchConstraintCoincidence_68.setName("SketchConstraintCoincidence_69") -SketchConstraintCoincidence_69 = Sketch_2.setCoincident(SketchLine_38.startPoint(), SketchLine_41.endPoint()) +SketchConstraintCoincidence_69 = Sketch_2.setCoincident( + SketchLine_38.startPoint(), SketchLine_41.endPoint() +) SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_70") -SketchLine_42 = Sketch_2.addLine(4.057270795192212, 11.20218846558286, 4.410949215071502, 11.07754130426779) -SketchConstraintCoincidence_70 = Sketch_2.setCoincident(SketchLine_39.endPoint(), SketchLine_42.startPoint()) +SketchLine_42 = Sketch_2.addLine( + 4.057270795192212, 11.20218846558286, 4.410949215071502, 11.07754130426779 +) +SketchConstraintCoincidence_70 = Sketch_2.setCoincident( + SketchLine_39.endPoint(), SketchLine_42.startPoint() +) SketchConstraintCoincidence_70.setName("SketchConstraintCoincidence_71") -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchArc_2_2"), False) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchArc_2_2"), False +) SketchArc_6 = SketchProjection_5.createdFeature() -SketchConstraintCoincidence_71 = Sketch_2.setCoincident(SketchLine_42.endPoint(), SketchArc_6.results()[1]) +SketchConstraintCoincidence_71 = Sketch_2.setCoincident( + SketchLine_42.endPoint(), SketchArc_6.results()[1] +) SketchConstraintCoincidence_71.setName("SketchConstraintCoincidence_72") -SketchLine_43 = Sketch_2.addLine(4.410949215071502, 11.07754130426779, 4.465704943014801, 11.23368068225505) -SketchConstraintCoincidence_72 = Sketch_2.setCoincident(SketchLine_42.endPoint(), SketchLine_43.startPoint()) +SketchLine_43 = Sketch_2.addLine( + 4.410949215071502, 11.07754130426779, 4.465704943014801, 11.23368068225505 +) +SketchConstraintCoincidence_72 = Sketch_2.setCoincident( + SketchLine_42.endPoint(), SketchLine_43.startPoint() +) SketchConstraintCoincidence_72.setName("SketchConstraintCoincidence_73") -SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchArc_3_2"), False) +SketchProjection_6 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchArc_3_2"), False +) SketchArc_7 = SketchProjection_6.createdFeature() -SketchConstraintCoincidence_73 = Sketch_2.setCoincident(SketchLine_43.endPoint(), SketchArc_7.results()[1]) +SketchConstraintCoincidence_73 = Sketch_2.setCoincident( + SketchLine_43.endPoint(), SketchArc_7.results()[1] +) SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_74") -SketchLine_44 = Sketch_2.addLine(4.465704943014801, 11.23368068225505, 4.140002338214646, 11.43810262749166) -SketchConstraintCoincidence_74 = Sketch_2.setCoincident(SketchLine_43.endPoint(), SketchLine_44.startPoint()) +SketchLine_44 = Sketch_2.addLine( + 4.465704943014801, 11.23368068225505, 4.140002338214646, 11.43810262749166 +) +SketchConstraintCoincidence_74 = Sketch_2.setCoincident( + SketchLine_43.endPoint(), SketchLine_44.startPoint() +) SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_75") -SketchConstraintCoincidence_75 = Sketch_2.setCoincident(SketchLine_40.endPoint(), SketchLine_44.endPoint()) +SketchConstraintCoincidence_75 = Sketch_2.setCoincident( + SketchLine_40.endPoint(), SketchLine_44.endPoint() +) SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_76") -SketchConstraintParallel_1 = Sketch_2.setParallel(SketchLine_38.result(), SketchLine_35.result()) -SketchConstraintParallel_2 = Sketch_2.setParallel(SketchLine_40.result(), SketchLine_38.result()) -SketchConstraintParallel_3 = Sketch_2.setParallel(SketchLine_43.result(), SketchLine_40.result()) +SketchConstraintParallel_1 = Sketch_2.setParallel( + SketchLine_38.result(), SketchLine_35.result() +) +SketchConstraintParallel_2 = Sketch_2.setParallel( + SketchLine_40.result(), SketchLine_38.result() +) +SketchConstraintParallel_3 = Sketch_2.setParallel( + SketchLine_43.result(), SketchLine_40.result() +) SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_40.result(), 0.25) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_40.result(), SketchLine_38.result()) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_40.result(), SketchLine_38.result() +) SketchPoint_5 = Sketch_2.addPoint(3.87026379772762, 11.42186023766063) -SketchConstraintCoincidence_76 = Sketch_2.setCoincident(SketchPoint_5.coordinates(), SketchLine_38.result()) +SketchConstraintCoincidence_76 = Sketch_2.setCoincident( + SketchPoint_5.coordinates(), SketchLine_38.result() +) SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_77") -SketchConstraintMiddle_4 = Sketch_2.setMiddlePoint(SketchPoint_5.coordinates(), SketchLine_38.result()) -SketchConstraintCoincidence_77 = Sketch_2.setCoincident(SketchPoint_5.coordinates(), SketchArc_5.results()[1]) +SketchConstraintMiddle_4 = Sketch_2.setMiddlePoint( + SketchPoint_5.coordinates(), SketchLine_38.result() +) +SketchConstraintCoincidence_77 = Sketch_2.setCoincident( + SketchPoint_5.coordinates(), SketchArc_5.results()[1] +) SketchConstraintCoincidence_77.setName("SketchConstraintCoincidence_78") SketchPoint_6 = Sketch_2.addPoint(4.09863656670343, 11.32014554653726) -SketchConstraintCoincidence_78 = Sketch_2.setCoincident(SketchPoint_6.coordinates(), SketchLine_40.result()) +SketchConstraintCoincidence_78 = Sketch_2.setCoincident( + SketchPoint_6.coordinates(), SketchLine_40.result() +) SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_79") -SketchConstraintCoincidence_79 = Sketch_2.setCoincident(SketchPoint_6.coordinates(), SketchArc_5.results()[1]) +SketchConstraintCoincidence_79 = Sketch_2.setCoincident( + SketchPoint_6.coordinates(), SketchArc_5.results()[1] +) SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_80") -SketchConstraintMiddle_5 = Sketch_2.setMiddlePoint(SketchPoint_6.coordinates(), SketchLine_40.result()) +SketchConstraintMiddle_5 = Sketch_2.setMiddlePoint( + SketchPoint_6.coordinates(), SketchLine_40.result() +) SketchConstraintLength_7 = Sketch_2.setLength(SketchLine_41.result(), 0.25) -SketchConstraintDistance_17 = Sketch_2.setDistance(SketchLine_38.startPoint(), SketchLine_35.result(), "1.35/2", True) +SketchConstraintDistance_17 = Sketch_2.setDistance( + SketchLine_38.startPoint(), SketchLine_35.result(), "1.35/2", True +) SketchConstraintDistance_17.setName("SketchConstraintDistance_20") -SketchConstraintDistance_18 = Sketch_2.setDistance(SketchLine_41.startPoint(), SketchLine_43.result(), 0.375, True) +SketchConstraintDistance_18 = Sketch_2.setDistance( + SketchLine_41.startPoint(), SketchLine_43.result(), 0.375, True +) SketchConstraintDistance_18.setName("SketchConstraintDistance_21") -SketchLine_45 = Sketch_2.addLine(3.911629569238839, 11.53981731861503, 3.397674805046317, 12.11397308570391) -SketchConstraintCoincidence_80 = Sketch_2.setCoincident(SketchLine_38.startPoint(), SketchLine_45.startPoint()) +SketchLine_45 = Sketch_2.addLine( + 3.911629569238839, 11.53981731861503, 3.397674805046317, 12.11397308570391 +) +SketchConstraintCoincidence_80 = Sketch_2.setCoincident( + SketchLine_38.startPoint(), SketchLine_45.startPoint() +) SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_81") -SketchConstraintCoincidence_81 = Sketch_2.setCoincident(SketchLine_35.startPoint(), SketchLine_45.endPoint()) +SketchConstraintCoincidence_81 = Sketch_2.setCoincident( + SketchLine_35.startPoint(), SketchLine_45.endPoint() +) SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_82") -SketchLine_46 = Sketch_2.addLine(3.082152448528626, 11.21424138021434, 3.828898026216406, 11.30390315670624) -SketchConstraintCoincidence_82 = Sketch_2.setCoincident(SketchLine_35.endPoint(), SketchLine_46.startPoint()) +SketchLine_46 = Sketch_2.addLine( + 3.082152448528626, 11.21424138021434, 3.828898026216406, 11.30390315670624 +) +SketchConstraintCoincidence_82 = Sketch_2.setCoincident( + SketchLine_35.endPoint(), SketchLine_46.startPoint() +) SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_83") -SketchConstraintCoincidence_83 = Sketch_2.setCoincident(SketchLine_38.endPoint(), SketchLine_46.endPoint()) +SketchConstraintCoincidence_83 = Sketch_2.setCoincident( + SketchLine_38.endPoint(), SketchLine_46.endPoint() +) SketchConstraintCoincidence_83.setName("SketchConstraintCoincidence_84") model.do() -Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_35r-SketchLine_46f-SketchLine_38r-SketchLine_45f")], model.selection("EDGE", "Sketch_2/SketchLine_35"), 360, 0) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Revolution_2_1")], model.selection("EDGE", "PartSet/OZ"), 2) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("COMPOUND", "AngularCopy_1_1")]) +Revolution_2 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_2/Face-SketchLine_35r-SketchLine_46f-SketchLine_38r-SketchLine_45f", + ) + ], + model.selection("EDGE", "Sketch_2/SketchLine_35"), + 360, + 0, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Revolution_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 2, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Revolution_1_1")], + [model.selection("COMPOUND", "AngularCopy_1_1")], +) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 3.6, False) Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_9][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8]"), True) +SketchProjection_7 = Sketch_3.addProjection( + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_9][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8]", + ), + True, +) SketchCircle_1 = SketchProjection_7.createdFeature() -SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2]"), True) +SketchProjection_8 = Sketch_3.addProjection( + model.selection( + "EDGE", + "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2]", + ), + True, +) SketchCircle_2 = SketchProjection_8.createdFeature() SketchLine_47 = Sketch_3.addLine(6.067916611160706, -1.958, 6.166614630411087, -1.958) -SketchConstraintCoincidence_84 = Sketch_3.setCoincident(SketchLine_47.startPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_84 = Sketch_3.setCoincident( + SketchLine_47.startPoint(), SketchCircle_1.results()[1] +) SketchConstraintCoincidence_84.setName("SketchConstraintCoincidence_85") SketchArc_8 = Sketch_3.addArc(0, 0, 6.166614630411087, -1.958, 6.47, 0, False) -SketchConstraintCoincidence_85 = Sketch_3.setCoincident(SketchLine_47.endPoint(), SketchArc_8.startPoint()) +SketchConstraintCoincidence_85 = Sketch_3.setCoincident( + SketchLine_47.endPoint(), SketchArc_8.startPoint() +) SketchConstraintCoincidence_85.setName("SketchConstraintCoincidence_87") SketchConstraintHorizontal_8 = Sketch_3.setHorizontal(SketchLine_47.result()) -SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_9 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_48 = SketchProjection_9.createdFeature() SketchLine_48.setName("SketchLine_49") SketchLine_48.result().setName("SketchLine_49") -SketchConstraintDistance_19 = Sketch_3.setDistance(SketchLine_47.endPoint(), SketchLine_48.result(), 1.958, True) +SketchConstraintDistance_19 = Sketch_3.setDistance( + SketchLine_47.endPoint(), SketchLine_48.result(), 1.958, True +) SketchConstraintDistance_19.setName("SketchConstraintDistance_23") -SketchLine_49 = Sketch_3.addLine(5.870057921349673, -1.957999999999988, 5.858998207885032, -1.675999999999991) +SketchLine_49 = Sketch_3.addLine( + 5.870057921349673, -1.957999999999988, 5.858998207885032, -1.675999999999991 +) SketchLine_49.setName("SketchLine_50") SketchLine_49.result().setName("SketchLine_50") -SketchConstraintCoincidence_86 = Sketch_3.setCoincident(SketchLine_49.startPoint(), SketchCircle_2.results()[1]) +SketchConstraintCoincidence_86 = Sketch_3.setCoincident( + SketchLine_49.startPoint(), SketchCircle_2.results()[1] +) SketchConstraintCoincidence_86.setName("SketchConstraintCoincidence_89") -SketchConstraintCoincidence_87 = Sketch_3.setCoincident(SketchArc_8.endPoint(), SketchLine_48.result()) +SketchConstraintCoincidence_87 = Sketch_3.setCoincident( + SketchArc_8.endPoint(), SketchLine_48.result() +) SketchConstraintCoincidence_87.setName("SketchConstraintCoincidence_88") -SketchArc_9 = Sketch_3.addArc(0, 0, 5.858998207885032, -1.675999999999991, 6.093999999999999, 0, False) -SketchConstraintCoincidence_88 = Sketch_3.setCoincident(SketchLine_49.endPoint(), SketchArc_9.startPoint()) +SketchArc_9 = Sketch_3.addArc( + 0, 0, 5.858998207885032, -1.675999999999991, 6.093999999999999, 0, False +) +SketchConstraintCoincidence_88 = Sketch_3.setCoincident( + SketchLine_49.endPoint(), SketchArc_9.startPoint() +) SketchConstraintCoincidence_88.setName("SketchConstraintCoincidence_90") -SketchConstraintCoincidence_89 = Sketch_3.setCoincident(SketchLine_48.result(), SketchArc_9.endPoint()) +SketchConstraintCoincidence_89 = Sketch_3.setCoincident( + SketchLine_48.result(), SketchArc_9.endPoint() +) SketchConstraintCoincidence_89.setName("SketchConstraintCoincidence_91") -SketchConstraintCoincidence_90 = Sketch_3.setCoincident(SketchArc_9.center(), SketchAPI_Line(SketchLine_48).startPoint()) +SketchConstraintCoincidence_90 = Sketch_3.setCoincident( + SketchArc_9.center(), SketchAPI_Line(SketchLine_48).startPoint() +) SketchConstraintCoincidence_90.setName("SketchConstraintCoincidence_92") -SketchConstraintCoincidence_91 = Sketch_3.setCoincident(SketchArc_8.result(), SketchAPI_Line(SketchLine_48).startPoint()) +SketchConstraintCoincidence_91 = Sketch_3.setCoincident( + SketchArc_8.result(), SketchAPI_Line(SketchLine_48).startPoint() +) SketchConstraintCoincidence_91.setName("SketchConstraintCoincidence_93") SketchPoint_7 = Sketch_3.addPoint(6.188, 0) -SketchConstraintCoincidence_92 = Sketch_3.setCoincident(SketchPoint_7.coordinates(), SketchCircle_2.results()[1]) +SketchConstraintCoincidence_92 = Sketch_3.setCoincident( + SketchPoint_7.coordinates(), SketchCircle_2.results()[1] +) SketchConstraintCoincidence_92.setName("SketchConstraintCoincidence_94") -SketchConstraintCoincidence_93 = Sketch_3.setCoincident(SketchPoint_7.coordinates(), SketchLine_48.result()) +SketchConstraintCoincidence_93 = Sketch_3.setCoincident( + SketchPoint_7.coordinates(), SketchLine_48.result() +) SketchConstraintCoincidence_93.setName("SketchConstraintCoincidence_95") SketchPoint_8 = Sketch_3.addPoint(6.375999999999999, 0) -SketchConstraintCoincidence_94 = Sketch_3.setCoincident(SketchPoint_8.coordinates(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_94 = Sketch_3.setCoincident( + SketchPoint_8.coordinates(), SketchCircle_1.results()[1] +) SketchConstraintCoincidence_94.setName("SketchConstraintCoincidence_96") -SketchConstraintCoincidence_95 = Sketch_3.setCoincident(SketchPoint_8.coordinates(), SketchLine_48.result()) +SketchConstraintCoincidence_95 = Sketch_3.setCoincident( + SketchPoint_8.coordinates(), SketchLine_48.result() +) SketchConstraintCoincidence_95.setName("SketchConstraintCoincidence_97") -SketchConstraintDistance_20 = Sketch_3.setDistance(SketchPoint_8.coordinates(), SketchArc_8.endPoint(), 0.094, True) +SketchConstraintDistance_20 = Sketch_3.setDistance( + SketchPoint_8.coordinates(), SketchArc_8.endPoint(), 0.094, True +) SketchConstraintDistance_20.setName("SketchConstraintDistance_22") -SketchConstraintDistance_21 = Sketch_3.setDistance(SketchArc_9.endPoint(), SketchPoint_7.coordinates(), 0.094, True) +SketchConstraintDistance_21 = Sketch_3.setDistance( + SketchArc_9.endPoint(), SketchPoint_7.coordinates(), 0.094, True +) SketchConstraintDistance_21.setName("SketchConstraintDistance_24") -SketchConstraintDistance_22 = Sketch_3.setDistance(SketchArc_9.startPoint(), SketchLine_47.result(), 0.282, True) +SketchConstraintDistance_22 = Sketch_3.setDistance( + SketchArc_9.startPoint(), SketchLine_47.result(), 0.282, True +) SketchConstraintDistance_22.setName("SketchConstraintDistance_25") -SketchConstraintCoincidence_96 = Sketch_3.setCoincident(SketchLine_49.startPoint(), SketchLine_47.result()) +SketchConstraintCoincidence_96 = Sketch_3.setCoincident( + SketchLine_49.startPoint(), SketchLine_47.result() +) SketchConstraintCoincidence_96.setName("SketchConstraintCoincidence_98") -SketchConstraintMirror_1_objects = [SketchArc_9.results()[1], SketchLine_49.result(), SketchLine_47.result(), SketchArc_8.results()[1]] -SketchConstraintMirror_1 = Sketch_3.addMirror(SketchLine_48.result(), SketchConstraintMirror_1_objects) -[SketchArc_10, SketchLine_50, SketchLine_51, SketchArc_11] = SketchConstraintMirror_1.mirrored() +SketchConstraintMirror_1_objects = [ + SketchArc_9.results()[1], + SketchLine_49.result(), + SketchLine_47.result(), + SketchArc_8.results()[1], +] +SketchConstraintMirror_1 = Sketch_3.addMirror( + SketchLine_48.result(), SketchConstraintMirror_1_objects +) +[ + SketchArc_10, + SketchLine_50, + SketchLine_51, + SketchArc_11, +] = SketchConstraintMirror_1.mirrored() SketchLine_51.setName("SketchLine_52") SketchLine_51.result().setName("SketchLine_52") SketchLine_50.setName("SketchLine_51") SketchLine_50.result().setName("SketchLine_51") model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchProjection_8f-SketchProjection_8f-SketchLine_51f-SketchArc_10_2r-SketchArc_9_2r-SketchLine_50r"), model.selection("FACE", "Sketch_3/Face-SketchProjection_7r-SketchLine_47f-SketchArc_8_2f-SketchArc_11_2f-SketchLine_52r-SketchProjection_7r")], model.selection(), 0, 4.2) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchProjection_8f-SketchProjection_8f-SketchLine_51f-SketchArc_10_2r-SketchArc_9_2r-SketchLine_50r", + ), + model.selection( + "FACE", + "Sketch_3/Face-SketchProjection_7r-SketchLine_47f-SketchArc_8_2f-SketchArc_11_2f-SketchLine_52r-SketchProjection_7r", + ), + ], + model.selection(), + 0, + 4.2, +) Sketch_4 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) SketchLine_52 = Sketch_4.addLine(0.75, 2.1, -0.75, 2.1) SketchLine_52.setName("SketchLine_53") @@ -390,45 +821,96 @@ SketchLine_54.result().setName("SketchLine_55") SketchLine_55 = Sketch_4.addLine(0.75, 0.3, 0.75, 2.1) SketchLine_55.setName("SketchLine_56") SketchLine_55.result().setName("SketchLine_56") -SketchConstraintCoincidence_97 = Sketch_4.setCoincident(SketchLine_55.endPoint(), SketchLine_52.startPoint()) +SketchConstraintCoincidence_97 = Sketch_4.setCoincident( + SketchLine_55.endPoint(), SketchLine_52.startPoint() +) SketchConstraintCoincidence_97.setName("SketchConstraintCoincidence_99") -SketchConstraintCoincidence_98 = Sketch_4.setCoincident(SketchLine_52.endPoint(), SketchLine_53.startPoint()) +SketchConstraintCoincidence_98 = Sketch_4.setCoincident( + SketchLine_52.endPoint(), SketchLine_53.startPoint() +) SketchConstraintCoincidence_98.setName("SketchConstraintCoincidence_100") -SketchConstraintCoincidence_99 = Sketch_4.setCoincident(SketchLine_53.endPoint(), SketchLine_54.startPoint()) +SketchConstraintCoincidence_99 = Sketch_4.setCoincident( + SketchLine_53.endPoint(), SketchLine_54.startPoint() +) SketchConstraintCoincidence_99.setName("SketchConstraintCoincidence_101") -SketchConstraintCoincidence_100 = Sketch_4.setCoincident(SketchLine_54.endPoint(), SketchLine_55.startPoint()) +SketchConstraintCoincidence_100 = Sketch_4.setCoincident( + SketchLine_54.endPoint(), SketchLine_55.startPoint() +) SketchConstraintCoincidence_100.setName("SketchConstraintCoincidence_102") SketchConstraintHorizontal_9 = Sketch_4.setHorizontal(SketchLine_52.result()) SketchConstraintVertical_11 = Sketch_4.setVertical(SketchLine_53.result()) SketchConstraintHorizontal_10 = Sketch_4.setHorizontal(SketchLine_54.result()) SketchConstraintVertical_12 = Sketch_4.setVertical(SketchLine_55.result()) -SketchProjection_10 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_10 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_56 = SketchProjection_10.createdFeature() SketchLine_56.setName("SketchLine_57") SketchLine_56.result().setName("SketchLine_57") -SketchConstraintDistance_23 = Sketch_4.setDistance(SketchLine_52.startPoint(), SketchLine_56.result(), 2.1, True) +SketchConstraintDistance_23 = Sketch_4.setDistance( + SketchLine_52.startPoint(), SketchLine_56.result(), 2.1, True +) SketchConstraintDistance_23.setName("SketchConstraintDistance_26") -SketchConstraintDistance_24 = Sketch_4.setDistance(SketchLine_54.endPoint(), SketchLine_56.result(), 0.3, True) +SketchConstraintDistance_24 = Sketch_4.setDistance( + SketchLine_54.endPoint(), SketchLine_56.result(), 0.3, True +) SketchConstraintDistance_24.setName("SketchConstraintDistance_27") SketchPoint_9 = Sketch_4.addPoint(0, 2.1) -SketchConstraintCoincidence_101 = Sketch_4.setCoincident(SketchPoint_9.coordinates(), SketchLine_52.result()) +SketchConstraintCoincidence_101 = Sketch_4.setCoincident( + SketchPoint_9.coordinates(), SketchLine_52.result() +) SketchConstraintCoincidence_101.setName("SketchConstraintCoincidence_103") -SketchProjection_11 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_11 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_57 = SketchProjection_11.createdFeature() SketchLine_57.setName("SketchLine_58") SketchLine_57.result().setName("SketchLine_58") -SketchConstraintCoincidence_102 = Sketch_4.setCoincident(SketchPoint_9.coordinates(), SketchLine_57.result()) +SketchConstraintCoincidence_102 = Sketch_4.setCoincident( + SketchPoint_9.coordinates(), SketchLine_57.result() +) SketchConstraintCoincidence_102.setName("SketchConstraintCoincidence_104") -SketchConstraintMiddle_6 = Sketch_4.setMiddlePoint(SketchPoint_9.coordinates(), SketchLine_52.result()) -SketchConstraintDistance_25 = Sketch_4.setDistance(SketchPoint_9.coordinates(), SketchLine_52.startPoint(), 0.75, True) +SketchConstraintMiddle_6 = Sketch_4.setMiddlePoint( + SketchPoint_9.coordinates(), SketchLine_52.result() +) +SketchConstraintDistance_25 = Sketch_4.setDistance( + SketchPoint_9.coordinates(), SketchLine_52.startPoint(), 0.75, True +) SketchConstraintDistance_25.setName("SketchConstraintDistance_28") model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchLine_53r-SketchLine_54f-SketchLine_55f-SketchLine_56f")], model.selection(), 10, 0) -Rotation_1_objects = [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_2_1")] -Rotation_1 = model.addRotation(Part_1_doc, Rotation_1_objects, model.selection("EDGE", "PartSet/OZ"), -90) -Cut_2_objects_1 = [model.selection("SOLID", "Cut_1_1"), model.selection("SOLID", "Rotation_1_1"), model.selection("SOLID", "Rotation_1_2")] -Cut_2 = model.addCut(Part_1_doc, Cut_2_objects_1, [model.selection("SOLID", "Rotation_1_3")]) -Fuse_2_objects_1 = [model.selection("SOLID", "Cut_2_1"), model.selection("SOLID", "Cut_2_2"), model.selection("SOLID", "Cut_2_3")] +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_4/Face-SketchLine_53r-SketchLine_54f-SketchLine_55f-SketchLine_56f", + ) + ], + model.selection(), + 10, + 0, +) +Rotation_1_objects = [ + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_2_1"), +] +Rotation_1 = model.addRotation( + Part_1_doc, Rotation_1_objects, model.selection("EDGE", "PartSet/OZ"), -90 +) +Cut_2_objects_1 = [ + model.selection("SOLID", "Cut_1_1"), + model.selection("SOLID", "Rotation_1_1"), + model.selection("SOLID", "Rotation_1_2"), +] +Cut_2 = model.addCut( + Part_1_doc, Cut_2_objects_1, [model.selection("SOLID", "Rotation_1_3")] +) +Fuse_2_objects_1 = [ + model.selection("SOLID", "Cut_2_1"), + model.selection("SOLID", "Cut_2_2"), + model.selection("SOLID", "Cut_2_3"), +] Fuse_2 = model.addFuse(Part_1_doc, Fuse_2_objects_1, True) model.do() # move groups to the end @@ -440,21 +922,22 @@ model.end() # check groups are correct from ModelAPI import * from GeomAPI import * + aFactory = ModelAPI_Session.get().validators() selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_1.feature())) -assert(Group_1.groupList().value(0).value().shapeType() == GeomAPI_Shape.FACE) +assert selectionList.size() == 1 +assert aFactory.validate(Group_1.feature()) +assert Group_1.groupList().value(0).value().shapeType() == GeomAPI_Shape.FACE selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 8) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 8 +assert aFactory.validate(Group_2.feature()) for i in range(8): - assert(Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE) + assert Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 4) -assert(aFactory.validate(Group_3.feature())) +assert selectionList.size() == 4 +assert aFactory.validate(Group_3.feature()) for i in range(4): - assert(Group_3.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE) + assert Group_3.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE diff --git a/src/FeaturesPlugin/Test/Test2854.py b/src/FeaturesPlugin/Test/Test2854.py index 8d45d8d49..8c34eff96 100644 --- a/src/FeaturesPlugin/Test/Test2854.py +++ b/src/FeaturesPlugin/Test/Test2854.py @@ -28,45 +28,109 @@ 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(20.52339901477833, 44.52955665024631, -23.88177339901478, 44.52955665024631) -SketchLine_2 = Sketch_1.addLine(-23.88177339901478, 44.52955665024631, -23.88177339901478, 15.29926108374386) -SketchLine_3 = Sketch_1.addLine(-23.88177339901478, 15.29926108374386, 20.52339901477833, 15.29926108374386) -SketchLine_4 = Sketch_1.addLine(20.52339901477833, 15.29926108374386, 20.52339901477833, 44.52955665024631) -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()) +SketchLine_1 = Sketch_1.addLine( + 20.52339901477833, 44.52955665024631, -23.88177339901478, 44.52955665024631 +) +SketchLine_2 = Sketch_1.addLine( + -23.88177339901478, 44.52955665024631, -23.88177339901478, 15.29926108374386 +) +SketchLine_3 = Sketch_1.addLine( + -23.88177339901478, 15.29926108374386, 20.52339901477833, 15.29926108374386 +) +SketchLine_4 = Sketch_1.addLine( + 20.52339901477833, 15.29926108374386, 20.52339901477833, 44.52955665024631 +) +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(29.23029556650247, 27.36453201970445, -5.970443349753695, 27.36453201970445) -SketchLine_6 = Sketch_1.addLine(-5.970443349753695, 27.36453201970445, -5.970443349753695, -13.80665024630542) -SketchLine_7 = Sketch_1.addLine(-5.970443349753695, -13.80665024630542, 29.23029556650247, -13.80665024630542) -SketchLine_8 = Sketch_1.addLine(29.23029556650247, -13.80665024630542, 29.23029556650247, 27.36453201970445) -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()) +SketchLine_5 = Sketch_1.addLine( + 29.23029556650247, 27.36453201970445, -5.970443349753695, 27.36453201970445 +) +SketchLine_6 = Sketch_1.addLine( + -5.970443349753695, 27.36453201970445, -5.970443349753695, -13.80665024630542 +) +SketchLine_7 = Sketch_1.addLine( + -5.970443349753695, -13.80665024630542, 29.23029556650247, -13.80665024630542 +) +SketchLine_8 = Sketch_1.addLine( + 29.23029556650247, -13.80665024630542, 29.23029556650247, 27.36453201970445 +) +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()) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 10, 0) -Group_1_objects = [model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_7"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_8"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_6"), model.selection("FACE", "Extrusion_1_1_3/From_Face"), model.selection("FACE", "Extrusion_1_1_3/To_Face"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_5"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3"), 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_6"), model.selection("FACE", "Extrusion_1_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_5"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_6"), model.selection("FACE", "Extrusion_1_1_2/From_Face"), model.selection("FACE", "Extrusion_1_1_2/To_Face"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_5"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection(), + 10, + 0, +) +Group_1_objects = [ + model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_7"), + model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_8"), + model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3"), + model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_6"), + model.selection("FACE", "Extrusion_1_1_3/From_Face"), + model.selection("FACE", "Extrusion_1_1_3/To_Face"), + model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4"), + model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_5"), + model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3"), + 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_6"), + model.selection("FACE", "Extrusion_1_1_1/To_Face"), + model.selection("FACE", "Extrusion_1_1_1/From_Face"), + model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_5"), + model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1"), + model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4"), + model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_6"), + model.selection("FACE", "Extrusion_1_1_2/From_Face"), + model.selection("FACE", "Extrusion_1_1_2/To_Face"), + model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_5"), + model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3"), + model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_4"), +] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) model.do() # add a circle to the sketch -SketchCircle_1 = Sketch_1.addCircle(-26.84625185927467, -13.07763963304469, 9.031583682868897) +SketchCircle_1 = Sketch_1.addCircle( + -26.84625185927467, -13.07763963304469, 9.031583682868897 +) model.end() # check group is valid from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) +assert aFactory.validate(Group_1.feature()) selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 22) +assert selectionList.size() == 22 for i in range(22): - assert(Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE) + assert Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE diff --git a/src/FeaturesPlugin/Test/Test2878.py b/src/FeaturesPlugin/Test/Test2878.py index e5178401c..15cf976ae 100644 --- a/src/FeaturesPlugin/Test/Test2878.py +++ b/src/FeaturesPlugin/Test/Test2878.py @@ -24,22 +24,49 @@ 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(68.30992366412212, 32.22748091603054, -50.73129770992366, 32.22748091603054) -SketchLine_2 = Sketch_1.addLine(-50.73129770992366, 32.22748091603054, -50.73129770992366, -43.02137404580152) -SketchLine_3 = Sketch_1.addLine(-50.73129770992366, -43.02137404580152, 68.30992366412212, -43.02137404580152) -SketchLine_4 = Sketch_1.addLine(68.30992366412212, -43.02137404580152, 68.30992366412212, 32.22748091603054) -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()) +SketchLine_1 = Sketch_1.addLine( + 68.30992366412212, 32.22748091603054, -50.73129770992366, 32.22748091603054 +) +SketchLine_2 = Sketch_1.addLine( + -50.73129770992366, 32.22748091603054, -50.73129770992366, -43.02137404580152 +) +SketchLine_3 = Sketch_1.addLine( + -50.73129770992366, -43.02137404580152, 68.30992366412212, -43.02137404580152 +) +SketchLine_4 = Sketch_1.addLine( + 68.30992366412212, -43.02137404580152, 68.30992366412212, 32.22748091603054 +) +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() -Vertex_1_objects = [model.selection("VERTEX", "Sketch_1/SketchLine_2_StartVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_3_StartVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_3_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex")] +Vertex_1_objects = [ + model.selection("VERTEX", "Sketch_1/SketchLine_2_StartVertex"), + model.selection("VERTEX", "Sketch_1/SketchLine_3_StartVertex"), + model.selection("VERTEX", "Sketch_1/SketchLine_3_EndVertex"), + model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex"), +] Vertex_1 = model.addVertex(Part_1_doc, Vertex_1_objects) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Vertex_1")], model.selection("EDGE", "PartSet/OZ"), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Vertex_1")], + model.selection("EDGE", "PartSet/OZ"), + 10, + 0, +) model.do() model.end() @@ -52,4 +79,4 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [8]) -assert(model.checkPythonDump()) \ No newline at end of file +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2918.py b/src/FeaturesPlugin/Test/Test2918.py index 02cc11877..58d500817 100644 --- a/src/FeaturesPlugin/Test/Test2918.py +++ b/src/FeaturesPlugin/Test/Test2918.py @@ -29,25 +29,45 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(6.188, 9.028, 6.188, -3.45) SketchLine_2 = Sketch_1.addLine(6.188, -3.45, 0, -3.45) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(0, -3.45, 0, -6.45) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(0, -6.45, 7.782, -6.45) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(7.782, -6.45, 7.782, -3.45) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(7.782, -3.45, 6.538, -3.45) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(6.538, -3.45, 6.538, -2.4) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(6.538, -2.4, 6.376, -2.25) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(6.376, -2.25, 6.376, 9.028) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchLine_10 = Sketch_1.addLine(6.376, 9.028, 6.188, 9.028) SketchLine_10.setAuxiliary(True) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_10.endPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_10.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_9.result()) @@ -56,29 +76,59 @@ SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_4.result()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchLine_2.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchLine_2.result() +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_11 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_11.result()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_11.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_5.result(), 3) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_11).startPoint(), SketchLine_1.result(), 6.188, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_11).startPoint(), SketchLine_1.result(), 6.188, True +) SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_7.result()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_12 = SketchProjection_2.createdFeature() -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_9.endPoint(), SketchLine_12.result(), 9.028, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_9.result(), 0.188, True) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_7.result(), 0.35, True) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_7.endPoint(), SketchLine_8.endPoint(), 0.15) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_5.endPoint(), SketchLine_12.result(), 3.45, True) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_12.result(), 2.25, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_9.endPoint(), SketchLine_12.result(), 9.028, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_2.startPoint(), SketchLine_9.result(), 0.188, True +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_2.startPoint(), SketchLine_7.result(), 0.35, True +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_7.endPoint(), SketchLine_8.endPoint(), 0.15 +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_5.endPoint(), SketchLine_12.result(), 3.45, True +) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_12.result(), 2.25, True +) SketchLine_13 = Sketch_1.addLine(7.032, -4.05, 5.532, -4.05) SketchLine_14 = Sketch_1.addLine(5.532, -4.05, 5.532, -5.85) SketchLine_15 = Sketch_1.addLine(5.532, -5.85, 7.032, -5.85) SketchLine_16 = Sketch_1.addLine(7.032, -5.85, 7.032, -4.05) -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()) +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_5 = Sketch_1.setHorizontal(SketchLine_13.result()) SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_14.result()) SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_15.result()) @@ -87,233 +137,630 @@ SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_14.result(), 1.8) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_15.result(), 1.5) SketchLine_17 = Sketch_1.addLine(6.282, -4.05, 6.282, 9.028) SketchLine_17.setAuxiliary(True) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_17.startPoint(), SketchLine_13.result()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_10.result()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_17.startPoint(), SketchLine_13.result() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_10.result() +) SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_17.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_17.startPoint(), SketchLine_13.result()) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_17.startPoint(), SketchLine_5.result(), 1.5, True) -SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint(SketchLine_10.result(), SketchLine_17.endPoint()) -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_14.startPoint(), SketchLine_2.result(), 0.6, True) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchLine_17.startPoint(), SketchLine_13.result() +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchLine_17.startPoint(), SketchLine_5.result(), 1.5, True +) +SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint( + SketchLine_10.result(), SketchLine_17.endPoint() +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchLine_14.startPoint(), SketchLine_2.result(), 0.6, True +) SketchLine_18 = Sketch_1.addLine(6.376, 9.028, 6.535, 9.187) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_18.startPoint() +) SketchLine_19 = Sketch_1.addLine(6.535, 9.187, 6.535, 10.256) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) SketchLine_20 = Sketch_1.addLine(6.535, 10.256, 6.185, 10.256) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) SketchLine_21 = Sketch_1.addLine(6.185, 10.256, 4.9175, 10.94235984621998) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.startPoint() +) SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_20.result()) SketchConstraintVertical_9 = Sketch_1.setVertical(SketchLine_19.result()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_10.result(), SketchLine_18.result(), 45, type = "Supplementary") +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_10.result(), SketchLine_18.result(), 45, type="Supplementary" +) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_20.result(), 0.35) -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_19.endPoint(), SketchLine_12.result(), 10.256, True) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_19.endPoint(), SketchLine_12.result(), 10.256, True +) SketchArc_1 = Sketch_1.addArc(0, 2.425, 4.9175, 10.94235984621998, 0, 12.26, False) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_11.result(), SketchArc_1.center()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_11.result(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_11.result(), SketchArc_1.center() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_11.result(), SketchArc_1.endPoint() +) SketchLine_22 = Sketch_1.addLine(6.188, 9.028, 6.082, 9.532) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_22.startPoint()) -SketchArc_2 = Sketch_1.addArc(4.79378612024245, 9.263, 6.082, 9.532, 5.676067550792229, 10.23944020672391, False) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchArc_2.startPoint()) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_22.startPoint() +) +SketchArc_2 = Sketch_1.addArc( + 4.79378612024245, 9.263, 6.082, 9.532, 5.676067550792229, 10.23944020672391, False +) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_22.endPoint(), SketchArc_2.startPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_2.results()[1], 1.316) -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchArc_2.startPoint(), SketchLine_1.result(), 0.106, True) -SketchLine_23 = Sketch_1.addLine(5.676067550792229, 10.23944020672391, 5.405090045827156, 10.43837553323928) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_23.startPoint()) -SketchLine_24 = Sketch_1.addLine(5.405090045827156, 10.43837553323928, 5.126644475052085, 10.62934617154252) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) -SketchLine_25 = Sketch_1.addLine(5.126644475052085, 10.62934617154252, 4.8355, 10.80033167999934) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint()) +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchArc_2.startPoint(), SketchLine_1.result(), 0.106, True +) +SketchLine_23 = Sketch_1.addLine( + 5.676067550792229, 10.23944020672391, 5.405090045827156, 10.43837553323928 +) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_23.startPoint() +) +SketchLine_24 = Sketch_1.addLine( + 5.405090045827156, 10.43837553323928, 5.126644475052085, 10.62934617154252 +) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_23.endPoint(), SketchLine_24.startPoint() +) +SketchLine_25 = Sketch_1.addLine( + 5.126644475052085, 10.62934617154252, 4.8355, 10.80033167999934 +) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchLine_24.endPoint(), SketchLine_25.startPoint() +) SketchArc_3 = Sketch_1.addArc(0, 2.425, 4.8355, 10.80033167999934, 0, 12.096, False) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchLine_11.result(), SketchArc_3.center()) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchArc_3.startPoint()) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchLine_11.result(), SketchArc_3.endPoint()) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchLine_11.result(), SketchArc_3.center() +) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchLine_25.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchLine_11.result(), SketchArc_3.endPoint() +) SketchLine_26 = Sketch_1.addLine(0, 12.096, 0, 12.26) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_26.startPoint()) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_26.endPoint()) -SketchConstraintDistance_11 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_12.result(), 2.425, True) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchArc_3.center(), SketchArc_1.center()) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_26.startPoint() +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_26.endPoint() +) +SketchConstraintDistance_11 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_12.result(), 2.425, True +) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchArc_1.center() +) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_26.result(), 0.164) SketchLine_27 = Sketch_1.addLine(0, 2.425, 4.9175, 10.94235984621998) SketchLine_27.setAuxiliary(True) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_27.startPoint()) -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchLine_27.endPoint()) -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_27.result()) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_27.startPoint() +) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchLine_27.endPoint() +) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchLine_27.result() +) SketchLine_28 = Sketch_1.addLine(0, 2.425, 5.21991026555713, 10.77860263646605) SketchLine_28.setAuxiliary(True) -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_28.startPoint()) -SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchLine_21.result()) -SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchLine_28.result(), SketchLine_25.startPoint()) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_28.startPoint() +) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident( + SketchLine_28.endPoint(), SketchLine_21.result() +) +SketchConstraintCoincidence_42 = Sketch_1.setCoincident( + SketchLine_28.result(), SketchLine_25.startPoint() +) SketchLine_29 = Sketch_1.addLine(0, 2.425, 5.523638941362955, 10.61413149862094) SketchLine_29.setAuxiliary(True) -SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_29.startPoint()) -SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchLine_29.endPoint(), SketchLine_21.result()) -SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchLine_29.result(), SketchLine_24.startPoint()) -SketchConstraintDistance_12 = Sketch_1.setDistance(SketchLine_25.startPoint(), SketchLine_28.endPoint(), 0.176, True) -SketchConstraintDistance_13 = Sketch_1.setDistance(SketchLine_24.startPoint(), SketchLine_29.endPoint(), 0.212, True) -SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_28.result(), SketchLine_11.result(), 32, type = "Direct") -SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_29.result(), SketchLine_11.result(), 34, type = "Direct") -SketchConstraintAngle_4 = Sketch_1.setAngle(SketchLine_27.result(), SketchLine_11.result(), 30, type = "Direct") -SketchLine_30 = Sketch_1.addLine(4.79378612024245, 9.263, 5.676067550792229, 10.23944020672391) +SketchConstraintCoincidence_43 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_29.startPoint() +) +SketchConstraintCoincidence_44 = Sketch_1.setCoincident( + SketchLine_29.endPoint(), SketchLine_21.result() +) +SketchConstraintCoincidence_45 = Sketch_1.setCoincident( + SketchLine_29.result(), SketchLine_24.startPoint() +) +SketchConstraintDistance_12 = Sketch_1.setDistance( + SketchLine_25.startPoint(), SketchLine_28.endPoint(), 0.176, True +) +SketchConstraintDistance_13 = Sketch_1.setDistance( + SketchLine_24.startPoint(), SketchLine_29.endPoint(), 0.212, True +) +SketchConstraintAngle_2 = Sketch_1.setAngle( + SketchLine_28.result(), SketchLine_11.result(), 32, type="Direct" +) +SketchConstraintAngle_3 = Sketch_1.setAngle( + SketchLine_29.result(), SketchLine_11.result(), 34, type="Direct" +) +SketchConstraintAngle_4 = Sketch_1.setAngle( + SketchLine_27.result(), SketchLine_11.result(), 30, type="Direct" +) +SketchLine_30 = Sketch_1.addLine( + 4.79378612024245, 9.263, 5.676067550792229, 10.23944020672391 +) SketchLine_30.setAuxiliary(True) -SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_30.startPoint()) -SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_30.endPoint()) -SketchLine_31 = Sketch_1.addLine(4.79378612024245, 9.263, 4.79378612024245, 10.72808112087839) +SketchConstraintCoincidence_46 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_30.startPoint() +) +SketchConstraintCoincidence_47 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_30.endPoint() +) +SketchLine_31 = Sketch_1.addLine( + 4.79378612024245, 9.263, 4.79378612024245, 10.72808112087839 +) SketchLine_31.setAuxiliary(True) -SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_48 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_31.startPoint() +) SketchConstraintVertical_10 = Sketch_1.setVertical(SketchLine_31.result()) -SketchConstraintAngle_5 = Sketch_1.setAngle(SketchLine_30.result(), SketchLine_31.result(), 42.1, type = "Direct") -SketchConstraintDistance_14 = Sketch_1.setDistance(SketchArc_2.center(), SketchLine_12.result(), 9.263, True) -SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchLine_27.result()) -SketchConstraintDistance_15 = Sketch_1.setDistance(SketchLine_22.endPoint(), SketchLine_12.result(), 9.532, True) -SketchConstraintDistance_16 = Sketch_1.setDistance(SketchLine_18.endPoint(), SketchLine_12.result(), 9.187, True) +SketchConstraintAngle_5 = Sketch_1.setAngle( + SketchLine_30.result(), SketchLine_31.result(), 42.1, type="Direct" +) +SketchConstraintDistance_14 = Sketch_1.setDistance( + SketchArc_2.center(), SketchLine_12.result(), 9.263, True +) +SketchConstraintCoincidence_49 = Sketch_1.setCoincident( + SketchLine_31.endPoint(), SketchLine_27.result() +) +SketchConstraintDistance_15 = Sketch_1.setDistance( + SketchLine_22.endPoint(), SketchLine_12.result(), 9.532, True +) +SketchConstraintDistance_16 = Sketch_1.setDistance( + SketchLine_18.endPoint(), SketchLine_12.result(), 9.187, True +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_1.results()[1], 9.835) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", (3.891, 0, 2.905000000000017))], model.selection("EDGE", "PartSet/OZ"), 360, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("FACE", (3.891, 0, 2.905000000000017))], + model.selection("EDGE", "PartSet/OZ"), + 360, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX_5", (0, 0, 2.425)), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("VERTEX_5", (0, 0, 2.425)), False +) SketchPoint_1 = SketchProjection_3.createdFeature() -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", (0, 0, 12.178)), False) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("EDGE", (0, 0, 12.178)), False +) SketchLine_32 = SketchProjection_4.createdFeature() -SketchArc_4 = Sketch_2.addArc(0, 2.425, 0, 12.178, 5.453808387550563, 10.51060344512907, True) +SketchArc_4 = Sketch_2.addArc( + 0, 2.425, 0, 12.178, 5.453808387550563, 10.51060344512907, True +) SketchArc_4.setAuxiliary(True) -SketchConstraintCoincidence_50 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchArc_4.center()) -SketchConstraintCoincidence_51 = Sketch_2.setCoincident(SketchLine_32.result(), SketchArc_4.startPoint()) -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", (2.761819470681477, 0, 6.519565749310471)), False) +SketchConstraintCoincidence_50 = Sketch_2.setCoincident( + SketchPoint_1.result(), SketchArc_4.center() +) +SketchConstraintCoincidence_51 = Sketch_2.setCoincident( + SketchLine_32.result(), SketchArc_4.startPoint() +) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("EDGE", (2.761819470681477, 0, 6.519565749310471)), False +) SketchLine_33 = SketchProjection_5.createdFeature() -SketchConstraintCoincidence_52 = Sketch_2.setCoincident(SketchArc_4.endPoint(), SketchLine_33.result()) -SketchConstraintMiddle_3 = Sketch_2.setMiddlePoint(SketchArc_4.startPoint(), SketchLine_32.result()) +SketchConstraintCoincidence_52 = Sketch_2.setCoincident( + SketchArc_4.endPoint(), SketchLine_33.result() +) +SketchConstraintMiddle_3 = Sketch_2.setMiddlePoint( + SketchArc_4.startPoint(), SketchLine_32.result() +) SketchLine_34 = Sketch_2.addLine(0, 2.425, 3.282538500974084, 11.74164236673399) SketchLine_34.setAuxiliary(True) -SketchConstraintCoincidence_53 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_34.startPoint()) -SketchLine_35 = Sketch_2.addLine(3.282538500974084, 11.74164236673399, 3.199461499025965, 11.50584963625379) -SketchConstraintCoincidence_54 = Sketch_2.setCoincident(SketchLine_34.endPoint(), SketchLine_35.startPoint()) -SketchConstraintCoincidence_55 = Sketch_2.setCoincident(SketchLine_35.endPoint(), SketchLine_34.result()) +SketchConstraintCoincidence_53 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_34.startPoint() +) +SketchLine_35 = Sketch_2.addLine( + 3.282538500974084, 11.74164236673399, 3.199461499025965, 11.50584963625379 +) +SketchConstraintCoincidence_54 = Sketch_2.setCoincident( + SketchLine_34.endPoint(), SketchLine_35.startPoint() +) +SketchConstraintCoincidence_55 = Sketch_2.setCoincident( + SketchLine_35.endPoint(), SketchLine_34.result() +) SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_35.result(), 0.25) SketchPoint_2 = Sketch_2.addPoint(3.241, 11.6237460014939) -SketchConstraintCoincidence_56 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchArc_4.results()[1]) -SketchConstraintCoincidence_57 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_35.result()) -SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchConstraintCoincidence_56 = Sketch_2.setCoincident( + SketchPoint_2.coordinates(), SketchArc_4.results()[1] +) +SketchConstraintCoincidence_57 = Sketch_2.setCoincident( + SketchPoint_2.coordinates(), SketchLine_35.result() +) +SketchProjection_6 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_36 = SketchProjection_6.createdFeature() -SketchConstraintDistance_17 = Sketch_2.setDistance(SketchPoint_2.coordinates(), SketchLine_36.result(), 3.241, True) -SketchArc_5 = Sketch_2.addArc(0, 2.425, 3.282538500974084, 11.74164236673399, 4.1398177019328, 11.393656164374, True) -SketchConstraintCoincidence_58 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_5.center()) -SketchConstraintCoincidence_59 = Sketch_2.setCoincident(SketchLine_34.endPoint(), SketchArc_5.startPoint()) -SketchArc_6 = Sketch_2.addArc(0, 2.425, 3.199461499025965, 11.50584963625379, 4.035044020470642, 11.16667053559353, True) -SketchConstraintCoincidence_60 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_33).startPoint(), SketchArc_6.center()) -SketchConstraintCoincidence_61 = Sketch_2.setCoincident(SketchLine_35.endPoint(), SketchArc_6.startPoint()) +SketchConstraintDistance_17 = Sketch_2.setDistance( + SketchPoint_2.coordinates(), SketchLine_36.result(), 3.241, True +) +SketchArc_5 = Sketch_2.addArc( + 0, + 2.425, + 3.282538500974084, + 11.74164236673399, + 4.1398177019328, + 11.393656164374, + True, +) +SketchConstraintCoincidence_58 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_5.center() +) +SketchConstraintCoincidence_59 = Sketch_2.setCoincident( + SketchLine_34.endPoint(), SketchArc_5.startPoint() +) +SketchArc_6 = Sketch_2.addArc( + 0, + 2.425, + 3.199461499025965, + 11.50584963625379, + 4.035044020470642, + 11.16667053559353, + True, +) +SketchConstraintCoincidence_60 = Sketch_2.setCoincident( + SketchAPI_Line(SketchLine_33).startPoint(), SketchArc_6.center() +) +SketchConstraintCoincidence_61 = Sketch_2.setCoincident( + SketchLine_35.endPoint(), SketchArc_6.startPoint() +) SketchLine_37 = Sketch_2.addLine(0, 2.425, 3.911506014428326, 11.49555702253677) SketchLine_37.setAuxiliary(True) -SketchConstraintCoincidence_62 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_37.startPoint()) -SketchConstraintCoincidence_63 = Sketch_2.setCoincident(SketchLine_37.endPoint(), SketchArc_5.results()[1]) +SketchConstraintCoincidence_62 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_37.startPoint() +) +SketchConstraintCoincidence_63 = Sketch_2.setCoincident( + SketchLine_37.endPoint(), SketchArc_5.results()[1] +) SketchLine_38 = Sketch_2.addLine(0, 2.425, 4.1398177019328, 11.393656164374) SketchLine_38.setAuxiliary(True) -SketchConstraintCoincidence_64 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_38.startPoint()) -SketchConstraintCoincidence_65 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_38.endPoint()) -SketchConstraintCoincidence_66 = Sketch_2.setCoincident(SketchArc_6.endPoint(), SketchLine_38.result()) -SketchConstraintDistance_18 = Sketch_2.setDistance(SketchLine_35.startPoint(), SketchLine_37.result(), 0.675, True) -SketchConstraintMiddle_4 = Sketch_2.setMiddlePoint(SketchPoint_2.coordinates(), SketchLine_35.result()) -SketchLine_39 = Sketch_2.addLine(3.911506014428326, 11.49555702253677, 3.81251062025875, 11.26599240868435) -SketchConstraintCoincidence_67 = Sketch_2.setCoincident(SketchLine_37.endPoint(), SketchLine_39.startPoint()) -SketchConstraintCoincidence_68 = Sketch_2.setCoincident(SketchLine_39.endPoint(), SketchArc_6.results()[1]) -SketchConstraintCoincidence_69 = Sketch_2.setCoincident(SketchLine_39.endPoint(), SketchLine_37.result()) -SketchLine_40 = Sketch_2.addLine(4.1398177019328, 11.393656164374, 4.459277785066647, 11.19096067956113) -SketchConstraintCoincidence_70 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_40.startPoint()) -SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE_3", (2.545485308583308, 0, 11.92488050155302)), False) +SketchConstraintCoincidence_64 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_38.startPoint() +) +SketchConstraintCoincidence_65 = Sketch_2.setCoincident( + SketchArc_5.endPoint(), SketchLine_38.endPoint() +) +SketchConstraintCoincidence_66 = Sketch_2.setCoincident( + SketchArc_6.endPoint(), SketchLine_38.result() +) +SketchConstraintDistance_18 = Sketch_2.setDistance( + SketchLine_35.startPoint(), SketchLine_37.result(), 0.675, True +) +SketchConstraintMiddle_4 = Sketch_2.setMiddlePoint( + SketchPoint_2.coordinates(), SketchLine_35.result() +) +SketchLine_39 = Sketch_2.addLine( + 3.911506014428326, 11.49555702253677, 3.81251062025875, 11.26599240868435 +) +SketchConstraintCoincidence_67 = Sketch_2.setCoincident( + SketchLine_37.endPoint(), SketchLine_39.startPoint() +) +SketchConstraintCoincidence_68 = Sketch_2.setCoincident( + SketchLine_39.endPoint(), SketchArc_6.results()[1] +) +SketchConstraintCoincidence_69 = Sketch_2.setCoincident( + SketchLine_39.endPoint(), SketchLine_37.result() +) +SketchLine_40 = Sketch_2.addLine( + 4.1398177019328, 11.393656164374, 4.459277785066647, 11.19096067956113 +) +SketchConstraintCoincidence_70 = Sketch_2.setCoincident( + SketchArc_5.endPoint(), SketchLine_40.startPoint() +) +SketchProjection_7 = Sketch_2.addProjection( + model.selection("EDGE_3", (2.545485308583308, 0, 11.92488050155302)), False +) SketchArc_7 = SketchProjection_7.createdFeature() -SketchConstraintCoincidence_71 = Sketch_2.setCoincident(SketchLine_40.endPoint(), SketchArc_7.results()[1]) -SketchLine_41 = Sketch_2.addLine(4.459277785066647, 11.19096067956113, 4.390495384356095, 11.04194790978503) -SketchConstraintCoincidence_72 = Sketch_2.setCoincident(SketchLine_40.endPoint(), SketchLine_41.startPoint()) -SketchProjection_8 = Sketch_2.addProjection(model.selection("EDGE_3", (2.503038985186497, 0, 11.76646866604162)), False) +SketchConstraintCoincidence_71 = Sketch_2.setCoincident( + SketchLine_40.endPoint(), SketchArc_7.results()[1] +) +SketchLine_41 = Sketch_2.addLine( + 4.459277785066647, 11.19096067956113, 4.390495384356095, 11.04194790978503 +) +SketchConstraintCoincidence_72 = Sketch_2.setCoincident( + SketchLine_40.endPoint(), SketchLine_41.startPoint() +) +SketchProjection_8 = Sketch_2.addProjection( + model.selection("EDGE_3", (2.503038985186497, 0, 11.76646866604162)), False +) SketchArc_8 = SketchProjection_8.createdFeature() -SketchConstraintCoincidence_73 = Sketch_2.setCoincident(SketchLine_41.endPoint(), SketchArc_8.results()[1]) -SketchLine_42 = Sketch_2.addLine(4.390495384356095, 11.04194790978503, 4.035044020470642, 11.16667053559353) -SketchConstraintCoincidence_74 = Sketch_2.setCoincident(SketchLine_41.endPoint(), SketchLine_42.startPoint()) -SketchConstraintCoincidence_75 = Sketch_2.setCoincident(SketchLine_42.endPoint(), SketchLine_38.result()) -SketchConstraintCoincidence_76 = Sketch_2.setCoincident(SketchLine_42.endPoint(), SketchArc_6.endPoint()) -SketchConstraintDistance_19 = Sketch_2.setDistance(SketchArc_5.endPoint(), SketchLine_41.result(), 0.375, True) -SketchConstraintDistance_20 = Sketch_2.setDistance(SketchLine_39.startPoint(), SketchLine_38.result(), 0.25, True) -SketchConstraintParallel_1 = Sketch_2.setParallel(SketchLine_41.result(), SketchLine_38.result()) +SketchConstraintCoincidence_73 = Sketch_2.setCoincident( + SketchLine_41.endPoint(), SketchArc_8.results()[1] +) +SketchLine_42 = Sketch_2.addLine( + 4.390495384356095, 11.04194790978503, 4.035044020470642, 11.16667053559353 +) +SketchConstraintCoincidence_74 = Sketch_2.setCoincident( + SketchLine_41.endPoint(), SketchLine_42.startPoint() +) +SketchConstraintCoincidence_75 = Sketch_2.setCoincident( + SketchLine_42.endPoint(), SketchLine_38.result() +) +SketchConstraintCoincidence_76 = Sketch_2.setCoincident( + SketchLine_42.endPoint(), SketchArc_6.endPoint() +) +SketchConstraintDistance_19 = Sketch_2.setDistance( + SketchArc_5.endPoint(), SketchLine_41.result(), 0.375, True +) +SketchConstraintDistance_20 = Sketch_2.setDistance( + SketchLine_39.startPoint(), SketchLine_38.result(), 0.25, True +) +SketchConstraintParallel_1 = Sketch_2.setParallel( + SketchLine_41.result(), SketchLine_38.result() +) model.do() -Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("WIRE", (3.862008317343538, 0, 11.38077471561056))], model.selection("EDGE", (3.241000000000025, 0, 11.62374600149389)), 360, 0) -Revolution_3 = model.addRevolution(Part_1_doc, [model.selection("WIRE", (4.212769702413368, 0, 11.10430922268928))], model.selection("EDGE", (3.241000000000025, 0, 11.62374600149389)), 360, 0) -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", (3.237566604725065, 0, 11.61400119092393)), model.selection("SOLID", (3.223802337712571, 0, 11.57493485456337))], model.selection("FACE", "PartSet/YOZ"), True) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", (-0.02393444277354109, 0, -2.580701826672493))], [model.selection("COMPOUND", (0, 0, 11.60508262087049))]) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", (-0.0201067396659898, 0, -2.591493279115657)), model.selection("COMPOUND", (0, 0, 11.54608275997197))], removeEdges = True) +Revolution_2 = model.addRevolution( + Part_1_doc, + [model.selection("WIRE", (3.862008317343538, 0, 11.38077471561056))], + model.selection("EDGE", (3.241000000000025, 0, 11.62374600149389)), + 360, + 0, +) +Revolution_3 = model.addRevolution( + Part_1_doc, + [model.selection("WIRE", (4.212769702413368, 0, 11.10430922268928))], + model.selection("EDGE", (3.241000000000025, 0, 11.62374600149389)), + 360, + 0, +) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [ + model.selection("SOLID", (3.237566604725065, 0, 11.61400119092393)), + model.selection("SOLID", (3.223802337712571, 0, 11.57493485456337)), + ], + model.selection("FACE", "PartSet/YOZ"), + True, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", (-0.02393444277354109, 0, -2.580701826672493))], + [model.selection("COMPOUND", (0, 0, 11.60508262087049))], +) +Fuse_1 = model.addFuse( + Part_1_doc, + [ + model.selection("SOLID", (-0.0201067396659898, 0, -2.591493279115657)), + model.selection("COMPOUND", (0, 0, 11.54608275997197)), + ], + removeEdges=True, +) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 3.6, False) Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", (0, 0, 3.6))) -SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", (-6.188, 7.578114393123822e-16, -3.45)), True) +SketchProjection_9 = Sketch_3.addProjection( + model.selection("EDGE", (-6.188, 7.578114393123822e-16, -3.45)), True +) SketchCircle_1 = SketchProjection_9.createdFeature() -SketchProjection_10 = Sketch_3.addProjection(model.selection("EDGE", (-6.376, 7.808347991363525e-16, -2.25)), True) +SketchProjection_10 = Sketch_3.addProjection( + model.selection("EDGE", (-6.376, 7.808347991363525e-16, -2.25)), True +) SketchCircle_2 = SketchProjection_10.createdFeature() SketchArc_9 = Sketch_3.addArc(0, 0, 6.094, 0, 5.859569950090201, -1.674, True) -SketchConstraintCoincidence_77 = Sketch_3.setCoincident(SketchAPI_Circle(SketchCircle_1).center(), SketchArc_9.center()) -SketchProjection_11 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_77 = Sketch_3.setCoincident( + SketchAPI_Circle(SketchCircle_1).center(), SketchArc_9.center() +) +SketchProjection_11 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_43 = SketchProjection_11.createdFeature() -SketchConstraintCoincidence_78 = Sketch_3.setCoincident(SketchArc_9.startPoint(), SketchLine_43.result()) +SketchConstraintCoincidence_78 = Sketch_3.setCoincident( + SketchArc_9.startPoint(), SketchLine_43.result() +) SketchPoint_3 = Sketch_3.addPoint(6.188, 0) -SketchConstraintCoincidence_79 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_43.result()) -SketchConstraintCoincidence_80 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchCircle_1.results()[1]) -SketchConstraintDistance_21 = Sketch_3.setDistance(SketchArc_9.startPoint(), SketchPoint_3.coordinates(), 0.094, True) -SketchConstraintDistance_22 = Sketch_3.setDistance(SketchArc_9.endPoint(), SketchLine_43.result(), 1.674, True) +SketchConstraintCoincidence_79 = Sketch_3.setCoincident( + SketchPoint_3.coordinates(), SketchLine_43.result() +) +SketchConstraintCoincidence_80 = Sketch_3.setCoincident( + SketchPoint_3.coordinates(), SketchCircle_1.results()[1] +) +SketchConstraintDistance_21 = Sketch_3.setDistance( + SketchArc_9.startPoint(), SketchPoint_3.coordinates(), 0.094, True +) +SketchConstraintDistance_22 = Sketch_3.setDistance( + SketchArc_9.endPoint(), SketchLine_43.result(), 1.674, True +) SketchLine_44 = Sketch_3.addLine(5.859569950090201, -1.674, 5.870724657144867, -1.956) -SketchConstraintCoincidence_81 = Sketch_3.setCoincident(SketchArc_9.endPoint(), SketchLine_44.startPoint()) -SketchConstraintCoincidence_82 = Sketch_3.setCoincident(SketchLine_44.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_81 = Sketch_3.setCoincident( + SketchArc_9.endPoint(), SketchLine_44.startPoint() +) +SketchConstraintCoincidence_82 = Sketch_3.setCoincident( + SketchLine_44.endPoint(), SketchCircle_1.results()[1] +) SketchArc_10 = Sketch_3.addArc(0, 0, 6.47, 0, 6.167249305809295, -1.956, True) -SketchConstraintCoincidence_83 = Sketch_3.setCoincident(SketchAPI_Circle(SketchCircle_1).center(), SketchArc_10.center()) -SketchConstraintCoincidence_84 = Sketch_3.setCoincident(SketchLine_43.result(), SketchArc_10.startPoint()) +SketchConstraintCoincidence_83 = Sketch_3.setCoincident( + SketchAPI_Circle(SketchCircle_1).center(), SketchArc_10.center() +) +SketchConstraintCoincidence_84 = Sketch_3.setCoincident( + SketchLine_43.result(), SketchArc_10.startPoint() +) SketchLine_45 = Sketch_3.addLine(6.167249305809295, -1.956, 6.068561608816571, -1.956) -SketchConstraintCoincidence_85 = Sketch_3.setCoincident(SketchArc_10.endPoint(), SketchLine_45.startPoint()) -SketchConstraintCoincidence_86 = Sketch_3.setCoincident(SketchLine_45.endPoint(), SketchCircle_2.results()[1]) +SketchConstraintCoincidence_85 = Sketch_3.setCoincident( + SketchArc_10.endPoint(), SketchLine_45.startPoint() +) +SketchConstraintCoincidence_86 = Sketch_3.setCoincident( + SketchLine_45.endPoint(), SketchCircle_2.results()[1] +) SketchConstraintHorizontal_8 = Sketch_3.setHorizontal(SketchLine_45.result()) -SketchConstraintCoincidence_87 = Sketch_3.setCoincident(SketchLine_44.endPoint(), SketchLine_45.result()) -SketchConstraintDistance_23 = Sketch_3.setDistance(SketchArc_10.startPoint(), SketchLine_45.result(), 1.956, True) +SketchConstraintCoincidence_87 = Sketch_3.setCoincident( + SketchLine_44.endPoint(), SketchLine_45.result() +) +SketchConstraintDistance_23 = Sketch_3.setDistance( + SketchArc_10.startPoint(), SketchLine_45.result(), 1.956, True +) SketchPoint_4 = Sketch_3.addPoint(6.376, 0) -SketchConstraintCoincidence_88 = Sketch_3.setCoincident(SketchPoint_4.coordinates(), SketchCircle_2.results()[1]) -SketchConstraintCoincidence_89 = Sketch_3.setCoincident(SketchPoint_4.coordinates(), SketchLine_43.result()) -SketchConstraintDistance_24 = Sketch_3.setDistance(SketchPoint_4.coordinates(), SketchArc_10.startPoint(), 0.094, True) -SketchConstraintMirror_1_objects = [SketchArc_9.results()[1], SketchLine_44.result(), SketchArc_10.results()[1], SketchLine_45.result()] -SketchConstraintMirror_1 = Sketch_3.addMirror(SketchLine_43.result(), SketchConstraintMirror_1_objects) -[SketchArc_11, SketchLine_46, SketchArc_12, SketchLine_47] = SketchConstraintMirror_1.mirrored() +SketchConstraintCoincidence_88 = Sketch_3.setCoincident( + SketchPoint_4.coordinates(), SketchCircle_2.results()[1] +) +SketchConstraintCoincidence_89 = Sketch_3.setCoincident( + SketchPoint_4.coordinates(), SketchLine_43.result() +) +SketchConstraintDistance_24 = Sketch_3.setDistance( + SketchPoint_4.coordinates(), SketchArc_10.startPoint(), 0.094, True +) +SketchConstraintMirror_1_objects = [ + SketchArc_9.results()[1], + SketchLine_44.result(), + SketchArc_10.results()[1], + SketchLine_45.result(), +] +SketchConstraintMirror_1 = Sketch_3.addMirror( + SketchLine_43.result(), SketchConstraintMirror_1_objects +) +[ + SketchArc_11, + SketchLine_46, + SketchArc_12, + SketchLine_47, +] = SketchConstraintMirror_1.mirrored() model.do() -Sketch_3.changeFacesOrder([[SketchProjection_9.result(), SketchProjection_9.result(), SketchLine_46.result(), SketchArc_11.results()[1], SketchArc_9.results()[1], SketchLine_44.result()], - [SketchProjection_10.result(), SketchProjection_10.result(), SketchProjection_10.result(), SketchProjection_9.result(), SketchProjection_9.result(), SketchProjection_9.result()], - [SketchProjection_9.result(), SketchLine_44.result(), SketchArc_9.results()[1], SketchArc_11.results()[1], SketchLine_46.result()], - [SketchProjection_10.result(), SketchLine_45.result(), SketchArc_10.results()[1], SketchArc_12.results()[1], SketchLine_47.result(), SketchProjection_10.result()] - ]) +Sketch_3.changeFacesOrder( + [ + [ + SketchProjection_9.result(), + SketchProjection_9.result(), + SketchLine_46.result(), + SketchArc_11.results()[1], + SketchArc_9.results()[1], + SketchLine_44.result(), + ], + [ + SketchProjection_10.result(), + SketchProjection_10.result(), + SketchProjection_10.result(), + SketchProjection_9.result(), + SketchProjection_9.result(), + SketchProjection_9.result(), + ], + [ + SketchProjection_9.result(), + SketchLine_44.result(), + SketchArc_9.results()[1], + SketchArc_11.results()[1], + SketchLine_46.result(), + ], + [ + SketchProjection_10.result(), + SketchLine_45.result(), + SketchArc_10.results()[1], + SketchArc_12.results()[1], + SketchLine_47.result(), + SketchProjection_10.result(), + ], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", (6.023784975045098, 0, 3.6)), model.selection("WIRE", (6.393864363926704, 0.9896456414839456, 3.6))], model.selection(), 0, 4.2) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection("FACE", (6.023784975045098, 0, 3.6)), + model.selection("WIRE", (6.393864363926704, 0.9896456414839456, 3.6)), + ], + model.selection(), + 0, + 4.2, +) Sketch_4 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) SketchLine_48 = Sketch_4.addLine(0.75, 2.1, -0.75, 2.1) SketchLine_49 = Sketch_4.addLine(-0.75, 2.1, -0.75, 0.3) SketchLine_50 = Sketch_4.addLine(-0.75, 0.3, 0.75, 0.3) SketchLine_51 = Sketch_4.addLine(0.75, 0.3, 0.75, 2.1) -SketchConstraintCoincidence_90 = Sketch_4.setCoincident(SketchLine_51.endPoint(), SketchLine_48.startPoint()) -SketchConstraintCoincidence_91 = Sketch_4.setCoincident(SketchLine_48.endPoint(), SketchLine_49.startPoint()) -SketchConstraintCoincidence_92 = Sketch_4.setCoincident(SketchLine_49.endPoint(), SketchLine_50.startPoint()) -SketchConstraintCoincidence_93 = Sketch_4.setCoincident(SketchLine_50.endPoint(), SketchLine_51.startPoint()) +SketchConstraintCoincidence_90 = Sketch_4.setCoincident( + SketchLine_51.endPoint(), SketchLine_48.startPoint() +) +SketchConstraintCoincidence_91 = Sketch_4.setCoincident( + SketchLine_48.endPoint(), SketchLine_49.startPoint() +) +SketchConstraintCoincidence_92 = Sketch_4.setCoincident( + SketchLine_49.endPoint(), SketchLine_50.startPoint() +) +SketchConstraintCoincidence_93 = Sketch_4.setCoincident( + SketchLine_50.endPoint(), SketchLine_51.startPoint() +) SketchConstraintHorizontal_9 = Sketch_4.setHorizontal(SketchLine_48.result()) SketchConstraintVertical_11 = Sketch_4.setVertical(SketchLine_49.result()) SketchConstraintHorizontal_10 = Sketch_4.setHorizontal(SketchLine_50.result()) SketchConstraintVertical_12 = Sketch_4.setVertical(SketchLine_51.result()) -SketchProjection_12 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_12 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_52 = SketchProjection_12.createdFeature() -SketchConstraintDistance_25 = Sketch_4.setDistance(SketchLine_52.result(), SketchLine_50.endPoint(), 0.3, True) -SketchConstraintDistance_26 = Sketch_4.setDistance(SketchLine_51.endPoint(), SketchLine_52.result(), 2.1, True) +SketchConstraintDistance_25 = Sketch_4.setDistance( + SketchLine_52.result(), SketchLine_50.endPoint(), 0.3, True +) +SketchConstraintDistance_26 = Sketch_4.setDistance( + SketchLine_51.endPoint(), SketchLine_52.result(), 2.1, True +) SketchPoint_5 = Sketch_4.addPoint(0, 2.1) -SketchConstraintCoincidence_94 = Sketch_4.setCoincident(SketchPoint_5.coordinates(), SketchLine_48.result()) -SketchConstraintMiddle_5 = Sketch_4.setMiddlePoint(SketchLine_48.result(), SketchPoint_5.coordinates()) -SketchProjection_13 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchConstraintCoincidence_94 = Sketch_4.setCoincident( + SketchPoint_5.coordinates(), SketchLine_48.result() +) +SketchConstraintMiddle_5 = Sketch_4.setMiddlePoint( + SketchLine_48.result(), SketchPoint_5.coordinates() +) +SketchProjection_13 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_53 = SketchProjection_13.createdFeature() -SketchConstraintCoincidence_95 = Sketch_4.setCoincident(SketchPoint_5.coordinates(), SketchLine_53.result()) -SketchConstraintDistance_27 = Sketch_4.setDistance(SketchPoint_5.coordinates(), SketchLine_51.endPoint(), 0.75, True) +SketchConstraintCoincidence_95 = Sketch_4.setCoincident( + SketchPoint_5.coordinates(), SketchLine_53.result() +) +SketchConstraintDistance_27 = Sketch_4.setDistance( + SketchPoint_5.coordinates(), SketchLine_51.endPoint(), 0.75, True +) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", (0, 0, 1.2))], model.selection(), 10, 0) -Rotation_1_objects = [model.selection("SOLID", (5, 1.166200656118862e-18, 1.2)), model.selection("SOLID", (6.049686362669476, 0, 1.5)), model.selection("SOLID", (6.320976310013338, 0, 1.5))] -Rotation_1 = model.addRotation(Part_1_doc, Rotation_1_objects, model.selection("EDGE", "PartSet/OZ"), -90) -Fuse_2_objects_1 = [model.selection("SOLID", (-0.01517504751345233, 0, -2.581926283264175)), model.selection("SOLID", (0, -6.049686362669479, 1.5)), model.selection("SOLID", (0, -6.320976310013339, 1.5))] +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("FACE", (0, 0, 1.2))], model.selection(), 10, 0 +) +Rotation_1_objects = [ + model.selection("SOLID", (5, 1.166200656118862e-18, 1.2)), + model.selection("SOLID", (6.049686362669476, 0, 1.5)), + model.selection("SOLID", (6.320976310013338, 0, 1.5)), +] +Rotation_1 = model.addRotation( + Part_1_doc, Rotation_1_objects, model.selection("EDGE", "PartSet/OZ"), -90 +) +Fuse_2_objects_1 = [ + model.selection("SOLID", (-0.01517504751345233, 0, -2.581926283264175)), + model.selection("SOLID", (0, -6.049686362669479, 1.5)), + model.selection("SOLID", (0, -6.320976310013339, 1.5)), +] Fuse_2 = model.addFuse(Part_1_doc, Fuse_2_objects_1) -Cut_2 = model.addCut(Part_1_doc, [model.selection("SOLID", (-0.01017608298903453, -0.03890028204629473, -2.562040714294322))], [model.selection("SOLID", (0, -5, 1.2))]) -FusionFaces_1 = model.addFusionFaces(Part_1_doc, model.selection("SOLID", (-0.008741742572144908, -0.03112823644757425, -2.568357186681257))) +Cut_2 = model.addCut( + Part_1_doc, + [ + model.selection( + "SOLID", (-0.01017608298903453, -0.03890028204629473, -2.562040714294322) + ) + ], + [model.selection("SOLID", (0, -5, 1.2))], +) +FusionFaces_1 = model.addFusionFaces( + Part_1_doc, + model.selection( + "SOLID", (-0.008741742572144908, -0.03112823644757425, -2.568357186681257) + ), +) model.end() @@ -325,4 +772,4 @@ model.testNbSubShapes(FusionFaces_1, GeomAPI_Shape.EDGE, [202]) model.testNbSubShapes(FusionFaces_1, GeomAPI_Shape.VERTEX, [404]) model.testResultsVolumes(FusionFaces_1, [612.7268292882]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2920.py b/src/FeaturesPlugin/Test/Test2920.py index da543cec9..26434d062 100644 --- a/src/FeaturesPlugin/Test/Test2920.py +++ b/src/FeaturesPlugin/Test/Test2920.py @@ -25,87 +25,237 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(-28.02134146341463, 30.17682926829269, -40.03048780487805, 30.17682926829269) -SketchLine_2 = Sketch_1.addLine(-40.03048780487805, 30.17682926829269, -40.03048780487805, 21.24695121951219) -SketchLine_3 = Sketch_1.addLine(-40.03048780487805, 21.24695121951219, -28.02134146341463, 21.24695121951219) -SketchLine_4 = Sketch_1.addLine(-28.02134146341463, 21.24695121951219, -28.02134146341463, 30.17682926829269) -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()) +SketchLine_1 = Sketch_1.addLine( + -28.02134146341463, 30.17682926829269, -40.03048780487805, 30.17682926829269 +) +SketchLine_2 = Sketch_1.addLine( + -40.03048780487805, 30.17682926829269, -40.03048780487805, 21.24695121951219 +) +SketchLine_3 = Sketch_1.addLine( + -40.03048780487805, 21.24695121951219, -28.02134146341463, 21.24695121951219 +) +SketchLine_4 = Sketch_1.addLine( + -28.02134146341463, 21.24695121951219, -28.02134146341463, 30.17682926829269 +) +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(-24.32621951219512, 13.39481707317073, -38.79878048780488, 13.39481707317073) -SketchLine_6 = Sketch_1.addLine(-38.79878048780488, 13.39481707317073, -38.79878048780488, 9.545731707317071) -SketchLine_7 = Sketch_1.addLine(-38.79878048780488, 9.545731707317071, -24.32621951219512, 9.545731707317071) -SketchLine_8 = Sketch_1.addLine(-24.32621951219512, 9.545731707317071, -24.32621951219512, 13.39481707317073) -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()) +SketchLine_5 = Sketch_1.addLine( + -24.32621951219512, 13.39481707317073, -38.79878048780488, 13.39481707317073 +) +SketchLine_6 = Sketch_1.addLine( + -38.79878048780488, 13.39481707317073, -38.79878048780488, 9.545731707317071 +) +SketchLine_7 = Sketch_1.addLine( + -38.79878048780488, 9.545731707317071, -24.32621951219512, 9.545731707317071 +) +SketchLine_8 = Sketch_1.addLine( + -24.32621951219512, 9.545731707317071, -24.32621951219512, 13.39481707317073 +) +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()) -SketchCircle_1 = Sketch_1.addCircle(-15.39634146341463, 19.39939024390243, 5.234756097560973) +SketchCircle_1 = Sketch_1.addCircle( + -15.39634146341463, 19.39939024390243, 5.234756097560973 +) Extrusion_1.setNestedSketch(Sketch_1) Extrusion_2 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 10) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_2.addEllipse(9.45504630186378, 35.70277888541424, 12.45818659778603, 26.02599348744252, 6.842520574992792) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_9, SketchLine_10] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchLine_11 = Sketch_2.addLine(18.91725801191108, 15.97306085169858, 9.656369955269037, 15.97306085169858) -SketchLine_12 = Sketch_2.addLine(9.656369955269037, 15.97306085169858, 9.656369955269037, -4.360628142232864) -SketchLine_13 = Sketch_2.addLine(9.656369955269037, -4.360628142232864, 18.91725801191108, -4.360628142232864) -SketchLine_14 = Sketch_2.addLine(18.91725801191108, -4.360628142232864, 18.91725801191108, 15.97306085169858) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchEllipse_1 = Sketch_2.addEllipse( + 9.45504630186378, + 35.70277888541424, + 12.45818659778603, + 26.02599348744252, + 6.842520574992792, +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_9, + SketchLine_10, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchLine_11 = Sketch_2.addLine( + 18.91725801191108, 15.97306085169858, 9.656369955269037, 15.97306085169858 +) +SketchLine_12 = Sketch_2.addLine( + 9.656369955269037, 15.97306085169858, 9.656369955269037, -4.360628142232864 +) +SketchLine_13 = Sketch_2.addLine( + 9.656369955269037, -4.360628142232864, 18.91725801191108, -4.360628142232864 +) +SketchLine_14 = Sketch_2.addLine( + 18.91725801191108, -4.360628142232864, 18.91725801191108, 15.97306085169858 +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_12.result()) SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_13.result()) SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_14.result()) -SketchCircle_2 = Sketch_2.addCircle(-32.8229209132412, -2.146067954774983, 6.582390686251648) +SketchCircle_2 = Sketch_2.addCircle( + -32.8229209132412, -2.146067954774983, 6.582390686251648 +) Extrusion_2.setNestedSketch(Sketch_2) -Compound_1_objects = [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")] +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) Compound_1.result().setName("A") Compound_1.result().setColor(0, 255, 0) Compound_1.result().subResult(0).setColor(0, 255, 0) Compound_1.result().subResult(1).setColor(0, 255, 0) Compound_1.result().subResult(2).setColor(0, 255, 0) -Compound_2_objects = [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2"), model.selection("SOLID", "Extrusion_2_3")] +Compound_2_objects = [ + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "Extrusion_2_2"), + model.selection("SOLID", "Extrusion_2_3"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) Compound_2.result().setName("B") -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Compound_1_1_1/Modified_Face&Extrusion_1_1/To_Face"), 5, True) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Compound_1_1_1/Modified_Face&Extrusion_1_1/To_Face"), + 5, + True, +) Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchLine_15 = Sketch_3.addLine(-43.21451225862969, 24.76425132139253, -23.11145813617009, 27.98073998098607) -SketchLine_16 = Sketch_3.addLine(-23.11145813617009, 27.98073998098607, 25.13587175773296, 39.84154191323723) -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) -SketchLine_17 = Sketch_3.addLine(25.13587175773296, 39.84154191323723, 22.9245358042624, 1.746254351176285) -SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) -SketchLine_18 = Sketch_3.addLine(22.9245358042624, 1.746254351176285, -48.84336741291839, 6.973048423015779) -SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) -SketchLine_19 = Sketch_3.addLine(-48.84336741291839, 6.973048423015779, -43.21451225862969, 24.76425132139253) -SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_15.startPoint(), SketchLine_19.endPoint()) -SketchLine_20 = Sketch_3.addLine(-42.51090536434361, 23.45755280343266, -22.9104275949455, 26.1714651099647) -SketchLine_21 = Sketch_3.addLine(-22.9104275949455, 26.1714651099647, 23.32659688671159, 37.73072123037897) -SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) -SketchLine_22 = Sketch_3.addLine(23.32659688671159, 37.73072123037897, 20.91423039201644, 3.957590304646839) -SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint()) -SketchLine_23 = Sketch_3.addLine(20.91423039201644, 3.957590304646839, -46.02893983577404, 7.97820112913876) -SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) -SketchLine_24 = Sketch_3.addLine(-46.02893983577404, 7.97820112913876, -42.51090536434361, 23.45755280343266) -SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) -SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_20.startPoint(), SketchLine_24.endPoint()) +SketchLine_15 = Sketch_3.addLine( + -43.21451225862969, 24.76425132139253, -23.11145813617009, 27.98073998098607 +) +SketchLine_16 = Sketch_3.addLine( + -23.11145813617009, 27.98073998098607, 25.13587175773296, 39.84154191323723 +) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) +SketchLine_17 = Sketch_3.addLine( + 25.13587175773296, 39.84154191323723, 22.9245358042624, 1.746254351176285 +) +SketchConstraintCoincidence_14 = Sketch_3.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) +SketchLine_18 = Sketch_3.addLine( + 22.9245358042624, 1.746254351176285, -48.84336741291839, 6.973048423015779 +) +SketchConstraintCoincidence_15 = Sketch_3.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) +SketchLine_19 = Sketch_3.addLine( + -48.84336741291839, 6.973048423015779, -43.21451225862969, 24.76425132139253 +) +SketchConstraintCoincidence_16 = Sketch_3.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_3.setCoincident( + SketchLine_15.startPoint(), SketchLine_19.endPoint() +) +SketchLine_20 = Sketch_3.addLine( + -42.51090536434361, 23.45755280343266, -22.9104275949455, 26.1714651099647 +) +SketchLine_21 = Sketch_3.addLine( + -22.9104275949455, 26.1714651099647, 23.32659688671159, 37.73072123037897 +) +SketchConstraintCoincidence_18 = Sketch_3.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.startPoint() +) +SketchLine_22 = Sketch_3.addLine( + 23.32659688671159, 37.73072123037897, 20.91423039201644, 3.957590304646839 +) +SketchConstraintCoincidence_19 = Sketch_3.setCoincident( + SketchLine_21.endPoint(), SketchLine_22.startPoint() +) +SketchLine_23 = Sketch_3.addLine( + 20.91423039201644, 3.957590304646839, -46.02893983577404, 7.97820112913876 +) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.startPoint() +) +SketchLine_24 = Sketch_3.addLine( + -46.02893983577404, 7.97820112913876, -42.51090536434361, 23.45755280343266 +) +SketchConstraintCoincidence_21 = Sketch_3.setCoincident( + SketchLine_23.endPoint(), SketchLine_24.startPoint() +) +SketchConstraintCoincidence_22 = Sketch_3.setCoincident( + SketchLine_20.startPoint(), SketchLine_24.endPoint() +) model.do() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_19r-SketchLine_18r-SketchLine_17r-SketchLine_16r-SketchLine_15r-SketchLine_20f-SketchLine_21f-SketchLine_22f-SketchLine_23f-SketchLine_24f")], model.selection(), 10, 0) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_19r-SketchLine_18r-SketchLine_17r-SketchLine_16r-SketchLine_15r-SketchLine_20f-SketchLine_21f-SketchLine_22f-SketchLine_23f-SketchLine_24f", + ) + ], + model.selection(), + 10, + 0, +) Extrusion_3.result().setName("C") Extrusion_3.result().setColor(0, 85, 255) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Compound_1_1_1"), model.selection("SOLID", "Compound_2_1_2")], [model.selection("SOLID", "C")], keepSubResults = True) +Cut_1 = model.addCut( + Part_1_doc, + [ + model.selection("SOLID", "Compound_1_1_1"), + model.selection("SOLID", "Compound_2_1_2"), + ], + [model.selection("SOLID", "C")], + keepSubResults=True, +) model.end() from GeomAPI import GeomAPI_Shape @@ -118,4 +268,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [138]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [276]) model.testResultsVolumes(Cut_1, [14047.4641487433]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test2971.py b/src/FeaturesPlugin/Test/Test2971.py index ad447c0fd..5356170fd 100644 --- a/src/FeaturesPlugin/Test/Test2971.py +++ b/src/FeaturesPlugin/Test/Test2971.py @@ -26,7 +26,7 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -toto=model.addParameter(Part_1_doc, "r_fond_ext", "1950") +toto = model.addParameter(Part_1_doc, "r_fond_ext", "1950") model.addParameter(Part_1_doc, "r_fond_int", "1724") model.addParameter(Part_1_doc, "r_fillet_38", "38") model.addParameter(Part_1_doc, "r_fillet_40", "40") @@ -49,68 +49,158 @@ SketchLine_1 = Sketch_1.addLine(1897, 693, 1897, 2413) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "h_virole") SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchLine_2 = Sketch_1.addLine(1897, 2413, 1798.4, 2413) -SketchConstraintCoincidence_1 = 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_2.result()) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), "ep_virole") SketchLine_3 = Sketch_1.addLine(1798.4, 2413, 1798.4, 641.4) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.endPoint(), "r_ext_virole") +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), + SketchLine_1.endPoint(), + "r_ext_virole", +) SketchLine_4 = Sketch_1.addLine(1760.4, 603.4, 1653, 603.4) SketchLine_5 = Sketch_1.addLine(1653, 603.4, 1653, 0) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(1653, 0, 1683.450919985492, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_5.result(), "ep_homo") SketchArc_1 = Sketch_1.addArc(1760.4, 641.4, 1760.4, 603.4, 1798.4, 641.4, False) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_3.endPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_3.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_4.result()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_3.endPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_3.result() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_4.result() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_5.startPoint(), SketchLine_1.startPoint(), "dist_1 ") +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_5.startPoint(), SketchLine_1.startPoint(), "dist_1 " +) SketchLine_7 = Sketch_1.addLine(1897, 693, 1897, -214) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(1937, -254, 2151, -254) SketchLine_9 = Sketch_1.addLine(2151, -254, 2151, -508) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchLine_10 = Sketch_1.addLine(2151, -508, 1892.243906054397, -508) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_10.result(), SketchLine_8.result()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_10.result(), SketchLine_8.result() +) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_9.result(), "ep_support") SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_8.result()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_11 = SketchProjection_2.createdFeature() -SketchArc_2 = Sketch_1.addArc(0, 3, 1723.437877704862, -41.02137767220898, 0, -1721, True) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_11.result(), SketchArc_2.center()) +SketchArc_2 = Sketch_1.addArc( + 0, 3, 1723.437877704862, -41.02137767220898, 0, -1721, True +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_11.result(), SketchArc_2.center() +) SketchLine_12 = Sketch_1.addLine(0, -1721, 0, -1891) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_12.startPoint() +) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_12.result()) -SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchArc_2.center(), SketchAPI_Line(SketchLine_11).startPoint(), "dist_cer_1") +SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance( + SketchArc_2.center(), SketchAPI_Line(SketchLine_11).startPoint(), "dist_cer_1" +) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_12.result(), "ep_fond") -SketchArc_3 = Sketch_1.addArc(1683.450919985492, -40, 1723.437877704862, -41.02137767220898, 1683.450919985492, 0, False) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_6.endPoint()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_6.result()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchArc_2.results()[1]) +SketchArc_3 = Sketch_1.addArc( + 1683.450919985492, + -40, + 1723.437877704862, + -41.02137767220898, + 1683.450919985492, + 0, + False, +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_6.endPoint() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_6.result() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchArc_2.results()[1] +) SketchArc_4 = Sketch_1.addArc(1937, -214, 1897, -214, 1937, -254, False) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchLine_7.endPoint()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_8.startPoint()) -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_7.result()) -SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_8.result()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_4.startPoint(), SketchLine_7.endPoint() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchLine_7.result() +) +SketchConstraintTangent_6 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchLine_8.result() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_6.result()) -SketchArc_5 = Sketch_1.addArc(0, 55, 0, -1891, 1854.132246315134, -535.8549848942598, False) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_11.result(), SketchArc_5.center()) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchArc_5.startPoint()) -SketchConstraintDistanceVertical_3 = Sketch_1.setVerticalDistance(SketchArc_5.center(), SketchAPI_Line(SketchLine_11).startPoint(), "dist_cer_2") -SketchArc_6 = Sketch_1.addArc(1892.243906054397, -548, 1892.243906054397, -508, 1854.132246315134, -535.8549848942598, False) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_6.startPoint(), SketchLine_10.endPoint()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchArc_5.endPoint()) -SketchConstraintTangent_7 = Sketch_1.setTangent(SketchArc_6.results()[1], SketchLine_10.result()) -SketchConstraintTangent_8 = Sketch_1.setTangent(SketchArc_6.results()[1], SketchArc_5.results()[1]) +SketchArc_5 = Sketch_1.addArc( + 0, 55, 0, -1891, 1854.132246315134, -535.8549848942598, False +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_11.result(), SketchArc_5.center() +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchArc_5.startPoint() +) +SketchConstraintDistanceVertical_3 = Sketch_1.setVerticalDistance( + SketchArc_5.center(), SketchAPI_Line(SketchLine_11).startPoint(), "dist_cer_2" +) +SketchArc_6 = Sketch_1.addArc( + 1892.243906054397, + -548, + 1892.243906054397, + -508, + 1854.132246315134, + -535.8549848942598, + False, +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchArc_6.startPoint(), SketchLine_10.endPoint() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchArc_6.endPoint(), SketchArc_5.endPoint() +) +SketchConstraintTangent_7 = Sketch_1.setTangent( + SketchArc_6.results()[1], SketchLine_10.result() +) +SketchConstraintTangent_8 = Sketch_1.setTangent( + SketchArc_6.results()[1], SketchArc_5.results()[1] +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_6.results()[1], "r_fillet_40") SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_4.results()[1], "r_fillet_40") SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_3.results()[1], "r_fillet_40") @@ -118,36 +208,66 @@ SketchConstraintRadius_4 = Sketch_1.setRadius(SketchArc_1.results()[1], "r_fille SketchConstraintRadius_5 = Sketch_1.setRadius(SketchArc_2.results()[1], "r_fond_int") SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_9.result()) -SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_12.startPoint(), SketchLine_7.startPoint(), "r_ext_virole") -SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance(SketchAPI_Line(SketchLine_11).startPoint(), SketchLine_6.startPoint(), "r_homo") -SketchConstraintDistanceVertical_4 = Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_11).startPoint(), SketchLine_5.startPoint(), "ep_homo") -SketchConstraintDistanceHorizontal_4 = Sketch_1.setHorizontalDistance(SketchArc_4.startPoint(), SketchLine_9.startPoint(), "ep_support") -SketchConstraintDistanceVertical_5 = Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_11).startPoint(), SketchLine_9.startPoint(), "ep_support") -SketchLine_13 = Sketch_1.addLine(1723.437877704863, -41.02137767220899, 1897, -41.02137767220221) +SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance( + SketchLine_12.startPoint(), SketchLine_7.startPoint(), "r_ext_virole" +) +SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance( + SketchAPI_Line(SketchLine_11).startPoint(), SketchLine_6.startPoint(), "r_homo" +) +SketchConstraintDistanceVertical_4 = Sketch_1.setVerticalDistance( + SketchAPI_Line(SketchLine_11).startPoint(), SketchLine_5.startPoint(), "ep_homo" +) +SketchConstraintDistanceHorizontal_4 = Sketch_1.setHorizontalDistance( + SketchArc_4.startPoint(), SketchLine_9.startPoint(), "ep_support" +) +SketchConstraintDistanceVertical_5 = Sketch_1.setVerticalDistance( + SketchAPI_Line(SketchLine_11).startPoint(), SketchLine_9.startPoint(), "ep_support" +) +SketchLine_13 = Sketch_1.addLine( + 1723.437877704863, -41.02137767220899, 1897, -41.02137767220221 +) SketchLine_13.setName("SketchLine_23") SketchLine_13.result().setName("SketchLine_23") -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_7.result()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_7.result() +) SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_13.result()) SketchLine_14 = Sketch_1.addLine(1897, 693, 1798.4, 693) SketchLine_14.setName("SketchLine_24") SketchLine_14.result().setName("SketchLine_24") -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchLine_3.result() +) SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_14.result()) model.do() Sketch_1.setName("GVProfile") Sketch_1.result().setName("GVProfile") -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "all-in-GVProfile")], model.selection("EDGE", "PartSet/OZ"), 180, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("COMPOUND", "all-in-GVProfile")], + model.selection("EDGE", "PartSet/OZ"), + 180, + 0, +) Revolution_1.setName("GVBody") Revolution_1.result().setName("Revolution_1_1") Revolution_1.result().subResult(0).setName("GVBody_1_1") Revolution_1.result().subResult(1).setName("GVBody_1_2") Revolution_1.result().subResult(2).setName("GVBody_1_3") Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_3.createdFeature() -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_15 = SketchProjection_4.createdFeature() SketchLine_15.setName("SketchLine_14") SketchLine_15.result().setName("SketchLine_14") @@ -157,44 +277,80 @@ SketchLine_16.result().setName("SketchLine_15") SketchLine_17 = Sketch_2.addLine(30, -1806, 0, -1806) SketchLine_17.setName("SketchLine_16") SketchLine_17.result().setName("SketchLine_16") -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) SketchLine_18 = Sketch_2.addLine(0, 0, 70, 0) SketchLine_18.setName("SketchLine_18") SketchLine_18.result().setName("SketchLine_18") -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_18.startPoint() +) SketchArc_7 = Sketch_2.addArc(70, -40, 70, 0, 30, -40, False) -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchArc_7.startPoint()) -SketchConstraintTangent_9 = Sketch_2.setTangent(SketchLine_18.result(), SketchArc_7.results()[1]) -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_16.result(), SketchArc_7.endPoint()) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchLine_18.endPoint(), SketchArc_7.startPoint() +) +SketchConstraintTangent_9 = Sketch_2.setTangent( + SketchLine_18.result(), SketchArc_7.results()[1] +) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchLine_16.result(), SketchArc_7.endPoint() +) SketchConstraintRadius_6 = Sketch_2.setRadius(SketchArc_7.results()[1], "r_fillet_40") SketchConstraintHorizontal_7 = Sketch_2.setHorizontal(SketchLine_18.result()) SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_16.result()) -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchArc_7.endPoint()) -SketchConstraintDistanceHorizontal_5 = Sketch_2.setHorizontalDistance(SketchLine_18.startPoint(), SketchLine_16.startPoint(), "half_pp") +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchLine_16.startPoint(), SketchArc_7.endPoint() +) +SketchConstraintDistanceHorizontal_5 = Sketch_2.setHorizontalDistance( + SketchLine_18.startPoint(), SketchLine_16.startPoint(), "half_pp" +) SketchConstraintHorizontal_8 = Sketch_2.setHorizontal(SketchLine_17.result()) -SketchConstraintTangent_10 = Sketch_2.setTangent(SketchArc_7.results()[1], SketchLine_16.result()) -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchConstraintTangent_10 = Sketch_2.setTangent( + SketchArc_7.results()[1], SketchLine_16.result() +) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchProjection_5.setName("SketchProjection_6") SketchProjection_5.result().setName("SketchProjection_6") SketchLine_19 = SketchProjection_5.createdFeature() SketchLine_19.setName("SketchLine_19") SketchLine_19.result().setName("SketchLine_19") -SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "[GVBody_1_3/From_Face][GVBody_1_3/To_Face]"), False) +SketchProjection_6 = Sketch_2.addProjection( + model.selection("EDGE", "[GVBody_1_3/From_Face][GVBody_1_3/To_Face]"), False +) SketchProjection_6.setName("SketchProjection_7") SketchProjection_6.result().setName("SketchProjection_7") SketchLine_20 = SketchProjection_6.createdFeature() SketchLine_20.setName("SketchLine_25") SketchLine_20.result().setName("SketchLine_25") -SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchLine_20.result(), SketchLine_17.endPoint()) -SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint( + SketchLine_20.result(), SketchLine_17.endPoint() +) +SketchProjection_7 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchProjection_7.setName("SketchProjection_8") SketchProjection_7.result().setName("SketchProjection_8") SketchLine_21 = SketchProjection_7.createdFeature() SketchLine_21.setName("SketchLine_21") SketchLine_21.result().setName("SketchLine_21") -SketchConstraintMirror_1_objects = [SketchLine_18.result(), SketchArc_7.results()[1], SketchLine_16.result(), SketchLine_17.result()] -SketchConstraintMirror_1 = Sketch_2.addMirror(SketchLine_21.result(), SketchConstraintMirror_1_objects) -[SketchLine_22, SketchArc_8, SketchLine_23, SketchLine_24] = SketchConstraintMirror_1.mirrored() +SketchConstraintMirror_1_objects = [ + SketchLine_18.result(), + SketchArc_7.results()[1], + SketchLine_16.result(), + SketchLine_17.result(), +] +SketchConstraintMirror_1 = Sketch_2.addMirror( + SketchLine_21.result(), SketchConstraintMirror_1_objects +) +[ + SketchLine_22, + SketchArc_8, + SketchLine_23, + SketchLine_24, +] = SketchConstraintMirror_1.mirrored() SketchLine_24.setName("SketchLine_27") SketchLine_24.result().setName("SketchLine_27") SketchLine_23.setName("SketchLine_26") @@ -204,80 +360,168 @@ SketchLine_22.result().setName("SketchLine_22") model.do() Sketch_2.setName("PPProfile") Sketch_2.result().setName("PPProfile") -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-PPProfile")], model.selection(), 0, 2300) -Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1")], [model.selection("COMPSOLID", "Revolution_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-PPProfile")], + model.selection(), + 0, + 2300, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Extrusion_1")], + [model.selection("COMPSOLID", "Revolution_1_1")], +) Recover_1 = model.addRecover(Part_1_doc, Cut_1, [Revolution_1.result()]) -Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPOUND", "Cut_1_1")) +Remove_SubShapes_1 = model.addRemoveSubShapes( + Part_1_doc, model.selection("COMPOUND", "Cut_1_1") +) Remove_SubShapes_1.setSubShapesToRemove([model.selection("SOLID", "Cut_1_1_2")]) Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchLine_25 = Sketch_3.addLine(0, 0, 0, 1653) SketchLine_25.setName("SketchLine_28") SketchLine_25.result().setName("SketchLine_28") -SketchProjection_8 = Sketch_3.addProjection(model.selection("VERTEX", "[Recover_1_1_2/Modified_Face&GVProfile/SketchLine_6][Recover_1_1_2/Modified_Face&GVProfile/SketchArc_3_2]__cc"), False) +SketchProjection_8 = Sketch_3.addProjection( + model.selection( + "VERTEX", + "[Recover_1_1_2/Modified_Face&GVProfile/SketchLine_6][Recover_1_1_2/Modified_Face&GVProfile/SketchArc_3_2]__cc", + ), + False, +) SketchProjection_8.setName("SketchProjection_9") SketchProjection_8.result().setName("SketchProjection_9") SketchPoint_3 = SketchProjection_8.createdFeature() -SketchConstraintCoincidence_29 = Sketch_3.setCoincident(SketchLine_25.startPoint(), SketchPoint_3.result()) -SketchProjection_9 = Sketch_3.addProjection(model.selection("VERTEX", "[(Remove_SubShapes_1_1/Modified_Face&PPProfile/SketchArc_7_2)(Remove_SubShapes_1_1/Modified_Face&Extrusion_1_1/To_Face)(Remove_SubShapes_1_1/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_18)][Remove_SubShapes_1_1/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_18][Remove_SubShapes_1_1/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_22][(Remove_SubShapes_1_1/Modified_Face&Extrusion_1_1/To_Face)(Remove_SubShapes_1_1/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_22)(Remove_SubShapes_1_1/Modified_Face&PPProfile/SketchArc_8_2)]"), False) +SketchConstraintCoincidence_29 = Sketch_3.setCoincident( + SketchLine_25.startPoint(), SketchPoint_3.result() +) +SketchProjection_9 = Sketch_3.addProjection( + model.selection( + "VERTEX", + "[(Remove_SubShapes_1_1/Modified_Face&PPProfile/SketchArc_7_2)(Remove_SubShapes_1_1/Modified_Face&Extrusion_1_1/To_Face)(Remove_SubShapes_1_1/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_18)][Remove_SubShapes_1_1/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_18][Remove_SubShapes_1_1/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_22][(Remove_SubShapes_1_1/Modified_Face&Extrusion_1_1/To_Face)(Remove_SubShapes_1_1/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_22)(Remove_SubShapes_1_1/Modified_Face&PPProfile/SketchArc_8_2)]", + ), + False, +) SketchProjection_9.setName("SketchProjection_10") SketchProjection_9.result().setName("SketchProjection_10") SketchPoint_4 = SketchProjection_9.createdFeature() -SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchLine_25.endPoint(), SketchPoint_4.result()) +SketchConstraintCoincidence_30 = Sketch_3.setCoincident( + SketchLine_25.endPoint(), SketchPoint_4.result() +) SketchLine_26 = Sketch_3.addLine(0, 0, -1653, 0) SketchLine_26.setName("SketchLine_29") SketchLine_26.result().setName("SketchLine_29") -SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchLine_25.startPoint(), SketchLine_26.startPoint()) -SketchProjection_10 = Sketch_3.addProjection(model.selection("VERTEX", "Recover_1_1_2/Modified_Vertex&weak_name_8"), False) +SketchConstraintCoincidence_31 = Sketch_3.setCoincident( + SketchLine_25.startPoint(), SketchLine_26.startPoint() +) +SketchProjection_10 = Sketch_3.addProjection( + model.selection("VERTEX", "Recover_1_1_2/Modified_Vertex&weak_name_8"), False +) SketchProjection_10.setName("SketchProjection_11") SketchProjection_10.result().setName("SketchProjection_11") SketchPoint_5 = SketchProjection_10.createdFeature() -SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchLine_26.endPoint(), SketchPoint_5.result()) +SketchConstraintCoincidence_32 = Sketch_3.setCoincident( + SketchLine_26.endPoint(), SketchPoint_5.result() +) SketchArc_9 = Sketch_3.addArc(0, 0, -1653, 0, 0, 1653, True) -SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchLine_25.startPoint(), SketchArc_9.center()) -SketchConstraintCoincidence_34 = Sketch_3.setCoincident(SketchLine_26.endPoint(), SketchArc_9.startPoint()) -SketchConstraintCoincidence_35 = Sketch_3.setCoincident(SketchLine_25.result(), SketchArc_9.endPoint()) +SketchConstraintCoincidence_33 = Sketch_3.setCoincident( + SketchLine_25.startPoint(), SketchArc_9.center() +) +SketchConstraintCoincidence_34 = Sketch_3.setCoincident( + SketchLine_26.endPoint(), SketchArc_9.startPoint() +) +SketchConstraintCoincidence_35 = Sketch_3.setCoincident( + SketchLine_25.result(), SketchArc_9.endPoint() +) SketchLine_27 = Sketch_3.addLine(-75, 0, -75, 1651.297671529879) SketchLine_27.setName("SketchLine_30") SketchLine_27.result().setName("SketchLine_30") -SketchConstraintCoincidence_36 = Sketch_3.setCoincident(SketchLine_27.startPoint(), SketchLine_26.result()) -SketchConstraintCoincidence_37 = Sketch_3.setCoincident(SketchLine_27.endPoint(), SketchArc_9.results()[1]) +SketchConstraintCoincidence_36 = Sketch_3.setCoincident( + SketchLine_27.startPoint(), SketchLine_26.result() +) +SketchConstraintCoincidence_37 = Sketch_3.setCoincident( + SketchLine_27.endPoint(), SketchArc_9.results()[1] +) SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_27.result()) -SketchConstraintDistanceHorizontal_6 = Sketch_3.setHorizontalDistance(SketchLine_27.startPoint(), SketchArc_9.center(), "rue_eau/2") +SketchConstraintDistanceHorizontal_6 = Sketch_3.setHorizontalDistance( + SketchLine_27.startPoint(), SketchArc_9.center(), "rue_eau/2" +) SketchLine_28 = Sketch_3.addLine(-75, 0, -1205.745800334843, 1130.745800334845) SketchLine_28.setName("SketchLine_31") SketchLine_28.result().setName("SketchLine_31") SketchLine_28.setAuxiliary(True) -SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchLine_27.startPoint(), SketchLine_28.startPoint()) -SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_28.endPoint(), SketchArc_9.results()[1]) -SketchConstraintAngle_1 = Sketch_3.setAngle(SketchLine_28.result(), SketchLine_26.result(), 45) +SketchConstraintCoincidence_38 = Sketch_3.setCoincident( + SketchLine_27.startPoint(), SketchLine_28.startPoint() +) +SketchConstraintCoincidence_39 = Sketch_3.setCoincident( + SketchLine_28.endPoint(), SketchArc_9.results()[1] +) +SketchConstraintAngle_1 = Sketch_3.setAngle( + SketchLine_28.result(), SketchLine_26.result(), 45 +) SketchLine_29 = Sketch_3.addLine(-743.85, 0, -743.85, 825.6488357649396) SketchLine_29.setName("SketchLine_32") SketchLine_29.result().setName("SketchLine_32") -SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_29.startPoint(), SketchLine_26.result()) +SketchConstraintCoincidence_40 = Sketch_3.setCoincident( + SketchLine_29.startPoint(), SketchLine_26.result() +) SketchLine_30 = Sketch_3.addLine(-743.85, 825.6488357649396, -75, 825.6488357649395) SketchLine_30.setName("SketchLine_33") SketchLine_30.result().setName("SketchLine_33") -SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_29.endPoint(), SketchLine_30.startPoint()) -SketchConstraintCoincidence_42 = Sketch_3.setCoincident(SketchLine_30.endPoint(), SketchLine_27.result()) -SketchLine_31 = Sketch_3.addLine(-743.85, 825.6488357649396, -1127.232311682702, 1209.031147447615) +SketchConstraintCoincidence_41 = Sketch_3.setCoincident( + SketchLine_29.endPoint(), SketchLine_30.startPoint() +) +SketchConstraintCoincidence_42 = Sketch_3.setCoincident( + SketchLine_30.endPoint(), SketchLine_27.result() +) +SketchLine_31 = Sketch_3.addLine( + -743.85, 825.6488357649396, -1127.232311682702, 1209.031147447615 +) SketchLine_31.setName("SketchLine_34") SketchLine_31.result().setName("SketchLine_34") -SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchLine_29.endPoint(), SketchLine_31.startPoint()) -SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchLine_31.endPoint(), SketchArc_9.results()[1]) -SketchConstraintParallel_2 = Sketch_3.setParallel(SketchLine_31.result(), SketchLine_28.result()) -SketchConstraintMiddle_2 = Sketch_3.setMiddlePoint(SketchLine_30.endPoint(), SketchLine_27.result()) +SketchConstraintCoincidence_43 = Sketch_3.setCoincident( + SketchLine_29.endPoint(), SketchLine_31.startPoint() +) +SketchConstraintCoincidence_44 = Sketch_3.setCoincident( + SketchLine_31.endPoint(), SketchArc_9.results()[1] +) +SketchConstraintParallel_2 = Sketch_3.setParallel( + SketchLine_31.result(), SketchLine_28.result() +) +SketchConstraintMiddle_2 = Sketch_3.setMiddlePoint( + SketchLine_30.endPoint(), SketchLine_27.result() +) SketchConstraintHorizontal_9 = Sketch_3.setHorizontal(SketchLine_30.result()) SketchConstraintVertical_9 = Sketch_3.setVertical(SketchLine_29.result()) -SketchConstraintDistanceHorizontal_7 = Sketch_3.setHorizontalDistance(SketchLine_25.startPoint(), SketchLine_29.startPoint(), "r_homo*0.5*0.9") -SketchProjection_11 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchConstraintDistanceHorizontal_7 = Sketch_3.setHorizontalDistance( + SketchLine_25.startPoint(), SketchLine_29.startPoint(), "r_homo*0.5*0.9" +) +SketchProjection_11 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchProjection_11.setName("SketchProjection_12") SketchProjection_11.result().setName("SketchProjection_12") SketchLine_32 = SketchProjection_11.createdFeature() SketchLine_32.setName("SketchLine_35") SketchLine_32.result().setName("SketchLine_35") -SketchConstraintMirror_2_objects = [SketchLine_26.result(), SketchLine_29.result(), SketchArc_9.results()[1], SketchLine_31.result(), SketchLine_30.result(), SketchLine_27.result()] -SketchConstraintMirror_2 = Sketch_3.addMirror(SketchLine_32.result(), SketchConstraintMirror_2_objects) -[SketchLine_33, SketchLine_34, SketchArc_10, SketchLine_35, SketchLine_36, SketchLine_37] = SketchConstraintMirror_2.mirrored() +SketchConstraintMirror_2_objects = [ + SketchLine_26.result(), + SketchLine_29.result(), + SketchArc_9.results()[1], + SketchLine_31.result(), + SketchLine_30.result(), + SketchLine_27.result(), +] +SketchConstraintMirror_2 = Sketch_3.addMirror( + SketchLine_32.result(), SketchConstraintMirror_2_objects +) +[ + SketchLine_33, + SketchLine_34, + SketchArc_10, + SketchLine_35, + SketchLine_36, + SketchLine_37, +] = SketchConstraintMirror_2.mirrored() SketchLine_37.setName("SketchLine_40") SketchLine_37.result().setName("SketchLine_40") SketchLine_36.setName("SketchLine_39") @@ -291,17 +535,72 @@ SketchLine_33.result().setName("SketchLine_36") model.do() Sketch_3.setName("PHomoProfile") Sketch_3.result().setName("PHomoProfile") -Sketch_3.changeFacesOrder([[SketchLine_25.result(), SketchArc_9.results()[1], SketchLine_27.result(), SketchLine_27.result(), SketchLine_26.result()], - [SketchLine_29.result(), SketchLine_31.result(), SketchArc_9.results()[1], SketchLine_26.result()], - [SketchLine_27.result(), SketchLine_30.result(), SketchLine_29.result(), SketchLine_26.result()], - [SketchArc_9.results()[1], SketchLine_31.result(), SketchLine_30.result(), SketchLine_27.result()], - [SketchLine_33.result(), SketchLine_37.result(), SketchLine_37.result(), SketchArc_10.results()[1], SketchLine_25.result()], - [SketchLine_33.result(), SketchArc_10.results()[1], SketchLine_35.result(), SketchLine_34.result()], - [SketchLine_33.result(), SketchLine_34.result(), SketchLine_36.result(), SketchLine_37.result()], - [SketchArc_10.results()[1], SketchLine_37.result(), SketchLine_36.result(), SketchLine_35.result()] - ]) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-PHomoProfile")], model.selection(), "ep_homo", 0) -Partition_1_objects = [model.selection("SOLID", "Remove_SubShapes_1_1"), model.selection("COMPSOLID", "Recover_1_1"), model.selection("COMPSOLID", "Extrusion_2_1")] +Sketch_3.changeFacesOrder( + [ + [ + SketchLine_25.result(), + SketchArc_9.results()[1], + SketchLine_27.result(), + SketchLine_27.result(), + SketchLine_26.result(), + ], + [ + SketchLine_29.result(), + SketchLine_31.result(), + SketchArc_9.results()[1], + SketchLine_26.result(), + ], + [ + SketchLine_27.result(), + SketchLine_30.result(), + SketchLine_29.result(), + SketchLine_26.result(), + ], + [ + SketchArc_9.results()[1], + SketchLine_31.result(), + SketchLine_30.result(), + SketchLine_27.result(), + ], + [ + SketchLine_33.result(), + SketchLine_37.result(), + SketchLine_37.result(), + SketchArc_10.results()[1], + SketchLine_25.result(), + ], + [ + SketchLine_33.result(), + SketchArc_10.results()[1], + SketchLine_35.result(), + SketchLine_34.result(), + ], + [ + SketchLine_33.result(), + SketchLine_34.result(), + SketchLine_36.result(), + SketchLine_37.result(), + ], + [ + SketchArc_10.results()[1], + SketchLine_37.result(), + SketchLine_36.result(), + SketchLine_35.result(), + ], + ] +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-PHomoProfile")], + model.selection(), + "ep_homo", + 0, +) +Partition_1_objects = [ + model.selection("SOLID", "Remove_SubShapes_1_1"), + model.selection("COMPSOLID", "Recover_1_1"), + model.selection("COMPSOLID", "Extrusion_2_1"), +] Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects) Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Partition_1_1_2")]) Group_1.setName("virole") @@ -312,93 +611,165 @@ Group_2.result().setName("bol") Group_3 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Partition_1_1_1")]) Group_3.setName("pp") Group_3.result().setName("pp") -Group_4_objects = [model.selection("SOLID", "Partition_1_1_6"), - model.selection("SOLID", "Partition_1_1_8"), - model.selection("SOLID", "Partition_1_1_7"), - model.selection("SOLID", "Partition_1_1_12"), - model.selection("SOLID", "Partition_1_1_11"), - model.selection("SOLID", "Partition_1_1_10")] +Group_4_objects = [ + model.selection("SOLID", "Partition_1_1_6"), + model.selection("SOLID", "Partition_1_1_8"), + model.selection("SOLID", "Partition_1_1_7"), + model.selection("SOLID", "Partition_1_1_12"), + model.selection("SOLID", "Partition_1_1_11"), + model.selection("SOLID", "Partition_1_1_10"), +] Group_4 = model.addGroup(Part_1_doc, Group_4_objects) Group_4.setName("pt") Group_4.result().setName("pt") Group_5 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Partition_1_1_3")]) Group_5.setName("pt_virole") Group_5.result().setName("pt_virole") -Group_6 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Partition_1_1_9"), model.selection("SOLID", "Partition_1_1_5")]) +Group_6 = model.addGroup( + Part_1_doc, + [ + model.selection("SOLID", "Partition_1_1_9"), + model.selection("SOLID", "Partition_1_1_5"), + ], +) Group_6.setName("axe_eau") Group_6.result().setName("axe_eau") -Group_7_objects = [model.selection("FACE", "Partition_1_1_3/Modified_Face&GVProfile/SketchLine_4"), - model.selection("FACE", "Recover_1_1_2/Modified_Face&GVProfile/SketchArc_1_2"), - model.selection("FACE", "Recover_1_1_2/Modified_Face&GVProfile/SketchLine_3"), - model.selection("FACE", "Recover_1_1_1/Modified_Face&GVProfile/SketchLine_3"), - model.selection("FACE", "Extrusion_2_1_1/To_Face"), - model.selection("FACE", "Extrusion_2_1_5/To_Face")] +Group_7_objects = [ + model.selection("FACE", "Partition_1_1_3/Modified_Face&GVProfile/SketchLine_4"), + model.selection("FACE", "Recover_1_1_2/Modified_Face&GVProfile/SketchArc_1_2"), + model.selection("FACE", "Recover_1_1_2/Modified_Face&GVProfile/SketchLine_3"), + model.selection("FACE", "Recover_1_1_1/Modified_Face&GVProfile/SketchLine_3"), + model.selection("FACE", "Extrusion_2_1_1/To_Face"), + model.selection("FACE", "Extrusion_2_1_5/To_Face"), +] Group_7 = model.addGroup(Part_1_doc, Group_7_objects) Group_7.setName("faces_sec") Group_7.result().setName("faces_sec") -Group_8_objects = [model.selection("FACE", "(Partition_1_1_4/Modified_Face&GVProfile/SketchLine_23)(Partition_1_1_4/Modified_Face&GVBody_1_3/To_Face)(Recover_1_1_3/Modified_Face&GVProfile/SketchArc_5_2)2(Recover_1_1_3/Modified_Face&GVProfile/SketchArc_6_2)2(Recover_1_1_3/Modified_Face&GVProfile/SketchLine_10)2(Recover_1_1_3/Modified_Face&GVProfile/SketchLine_9)2(Recover_1_1_3/Modified_Face&GVProfile/SketchLine_8)2(Recover_1_1_3/Modified_Face&GVProfile/SketchArc_4_2)2(Recover_1_1_3/Modified_Face&GVProfile/SketchLine_7)2(Partition_1_1_4/Modified_Face&GVBody_1_3/From_Face)2"), - model.selection("FACE", "(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_23)(Partition_1_1_3/Modified_Face&GVBody_1_2/To_Face)(Recover_1_1_2/Modified_Face&GVProfile/SketchLine_3)2(Recover_1_1_2/Modified_Face&GVProfile/SketchArc_1_2)2(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_4)2(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_18)2(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_22)2(Recover_1_1_2/Modified_Face&GVProfile/SketchLine_7)2(Recover_1_1_2/Modified_Face&GVProfile/SketchLine_24)2(Partition_1_1_3/Modified_Face&GVBody_1_2/From_Face)2"), - model.selection("FACE", "(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_22)(Partition_1_1_3/Modified_Face&GVBody_1_2/To_Face)"), - model.selection("FACE", "Remove_SubShapes_1_1/Modified_Face&PPProfile/SketchLine_26"), - model.selection("FACE", "Remove_SubShapes_1_1/Modified_Face&PPProfile/SketchArc_8_2"), - model.selection("FACE", "(Partition_1_1_5/Modified_Face&PHomoProfile/SketchArc_9_2&GVProfile/SketchLine_5)(Extrusion_2_1_4/Generated_Face&PHomoProfile/SketchLine_30)(Extrusion_2_1_3/Generated_Face&PHomoProfile/SketchLine_30)(Partition_1_1_5/Modified_Face&PHomoProfile/SketchLine_29)(Partition_1_1_5/Modified_Face&Extrusion_2_1_1/From_Face&PPProfile/SketchLine_22)"), - model.selection("FACE", "Remove_SubShapes_1_1/Modified_Face&PPProfile/SketchLine_15"), - model.selection("FACE", "Remove_SubShapes_1_1/Modified_Face&PPProfile/SketchArc_7_2"), - model.selection("FACE", "(Partition_1_1_9/Modified_Face&PHomoProfile/SketchLine_36)(Extrusion_2_1_7/Generated_Face&PHomoProfile/SketchLine_40)(Extrusion_2_1_8/Generated_Face&PHomoProfile/SketchLine_40)(Partition_1_1_9/Modified_Face&PHomoProfile/SketchArc_10_2&GVProfile/SketchLine_5)(Partition_1_1_9/Modified_Face&Extrusion_2_1_5/From_Face&PPProfile/SketchLine_18)"), - model.selection("FACE", "(Partition_1_1_4/Modified_Face&GVProfile/SketchLine_23)(Partition_1_1_4/Modified_Face&GVBody_1_3/From_Face)(Recover_1_1_3/Modified_Face&GVProfile/SketchArc_5_2)2(Recover_1_1_3/Modified_Face&GVProfile/SketchArc_6_2)2(Recover_1_1_3/Modified_Face&GVProfile/SketchLine_10)2(Recover_1_1_3/Modified_Face&GVProfile/SketchLine_9)2(Recover_1_1_3/Modified_Face&GVProfile/SketchLine_8)2(Recover_1_1_3/Modified_Face&GVProfile/SketchArc_4_2)2(Recover_1_1_3/Modified_Face&GVProfile/SketchLine_7)2(Partition_1_1_4/Modified_Face&GVBody_1_3/To_Face)2"), - model.selection("FACE", "(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_23)(Partition_1_1_3/Modified_Face&GVBody_1_2/From_Face)(Recover_1_1_2/Modified_Face&GVProfile/SketchLine_3)2(Recover_1_1_2/Modified_Face&GVProfile/SketchArc_1_2)2(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_4)2(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_18)2(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_22)2(Recover_1_1_2/Modified_Face&GVProfile/SketchLine_7)2(Recover_1_1_2/Modified_Face&GVProfile/SketchLine_24)2(Partition_1_1_3/Modified_Face&GVBody_1_2/To_Face)2"), - model.selection("FACE", "(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_18)(Partition_1_1_3/Modified_Face&GVBody_1_2/From_Face)")] +Group_8_objects = [ + model.selection( + "FACE", + "(Partition_1_1_4/Modified_Face&GVProfile/SketchLine_23)(Partition_1_1_4/Modified_Face&GVBody_1_3/To_Face)(Recover_1_1_3/Modified_Face&GVProfile/SketchArc_5_2)2(Recover_1_1_3/Modified_Face&GVProfile/SketchArc_6_2)2(Recover_1_1_3/Modified_Face&GVProfile/SketchLine_10)2(Recover_1_1_3/Modified_Face&GVProfile/SketchLine_9)2(Recover_1_1_3/Modified_Face&GVProfile/SketchLine_8)2(Recover_1_1_3/Modified_Face&GVProfile/SketchArc_4_2)2(Recover_1_1_3/Modified_Face&GVProfile/SketchLine_7)2(Partition_1_1_4/Modified_Face&GVBody_1_3/From_Face)2", + ), + model.selection( + "FACE", + "(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_23)(Partition_1_1_3/Modified_Face&GVBody_1_2/To_Face)(Recover_1_1_2/Modified_Face&GVProfile/SketchLine_3)2(Recover_1_1_2/Modified_Face&GVProfile/SketchArc_1_2)2(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_4)2(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_18)2(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_22)2(Recover_1_1_2/Modified_Face&GVProfile/SketchLine_7)2(Recover_1_1_2/Modified_Face&GVProfile/SketchLine_24)2(Partition_1_1_3/Modified_Face&GVBody_1_2/From_Face)2", + ), + model.selection( + "FACE", + "(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_22)(Partition_1_1_3/Modified_Face&GVBody_1_2/To_Face)", + ), + model.selection( + "FACE", "Remove_SubShapes_1_1/Modified_Face&PPProfile/SketchLine_26" + ), + model.selection( + "FACE", "Remove_SubShapes_1_1/Modified_Face&PPProfile/SketchArc_8_2" + ), + model.selection( + "FACE", + "(Partition_1_1_5/Modified_Face&PHomoProfile/SketchArc_9_2&GVProfile/SketchLine_5)(Extrusion_2_1_4/Generated_Face&PHomoProfile/SketchLine_30)(Extrusion_2_1_3/Generated_Face&PHomoProfile/SketchLine_30)(Partition_1_1_5/Modified_Face&PHomoProfile/SketchLine_29)(Partition_1_1_5/Modified_Face&Extrusion_2_1_1/From_Face&PPProfile/SketchLine_22)", + ), + model.selection( + "FACE", "Remove_SubShapes_1_1/Modified_Face&PPProfile/SketchLine_15" + ), + model.selection( + "FACE", "Remove_SubShapes_1_1/Modified_Face&PPProfile/SketchArc_7_2" + ), + model.selection( + "FACE", + "(Partition_1_1_9/Modified_Face&PHomoProfile/SketchLine_36)(Extrusion_2_1_7/Generated_Face&PHomoProfile/SketchLine_40)(Extrusion_2_1_8/Generated_Face&PHomoProfile/SketchLine_40)(Partition_1_1_9/Modified_Face&PHomoProfile/SketchArc_10_2&GVProfile/SketchLine_5)(Partition_1_1_9/Modified_Face&Extrusion_2_1_5/From_Face&PPProfile/SketchLine_18)", + ), + model.selection( + "FACE", + "(Partition_1_1_4/Modified_Face&GVProfile/SketchLine_23)(Partition_1_1_4/Modified_Face&GVBody_1_3/From_Face)(Recover_1_1_3/Modified_Face&GVProfile/SketchArc_5_2)2(Recover_1_1_3/Modified_Face&GVProfile/SketchArc_6_2)2(Recover_1_1_3/Modified_Face&GVProfile/SketchLine_10)2(Recover_1_1_3/Modified_Face&GVProfile/SketchLine_9)2(Recover_1_1_3/Modified_Face&GVProfile/SketchLine_8)2(Recover_1_1_3/Modified_Face&GVProfile/SketchArc_4_2)2(Recover_1_1_3/Modified_Face&GVProfile/SketchLine_7)2(Partition_1_1_4/Modified_Face&GVBody_1_3/To_Face)2", + ), + model.selection( + "FACE", + "(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_23)(Partition_1_1_3/Modified_Face&GVBody_1_2/From_Face)(Recover_1_1_2/Modified_Face&GVProfile/SketchLine_3)2(Recover_1_1_2/Modified_Face&GVProfile/SketchArc_1_2)2(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_4)2(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_18)2(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_22)2(Recover_1_1_2/Modified_Face&GVProfile/SketchLine_7)2(Recover_1_1_2/Modified_Face&GVProfile/SketchLine_24)2(Partition_1_1_3/Modified_Face&GVBody_1_2/To_Face)2", + ), + model.selection( + "FACE", + "(Partition_1_1_3/Modified_Face&GVProfile/SketchLine_6&PPProfile/SketchLine_18)(Partition_1_1_3/Modified_Face&GVBody_1_2/From_Face)", + ), +] Group_8 = model.addGroup(Part_1_doc, Group_8_objects) Group_8.setName("faces_pr") Group_8.result().setName("faces_pr") -Group_9_objects = [model.selection("FACE", "Partition_1_1_6/Modified_Face&PHomoProfile/SketchLine_29"), - model.selection("FACE", "Extrusion_2_1_3/Generated_Face&PHomoProfile/SketchLine_29"), - model.selection("FACE", "Extrusion_2_1_7/Generated_Face&PHomoProfile/SketchLine_36"), - model.selection("FACE", "Partition_1_1_10/Modified_Face&PHomoProfile/SketchLine_36")] +Group_9_objects = [ + model.selection("FACE", "Partition_1_1_6/Modified_Face&PHomoProfile/SketchLine_29"), + model.selection( + "FACE", "Extrusion_2_1_3/Generated_Face&PHomoProfile/SketchLine_29" + ), + model.selection( + "FACE", "Extrusion_2_1_7/Generated_Face&PHomoProfile/SketchLine_36" + ), + model.selection( + "FACE", "Partition_1_1_10/Modified_Face&PHomoProfile/SketchLine_36" + ), +] Group_9 = model.addGroup(Part_1_doc, Group_9_objects) Group_9.setName("pt_symz") Group_9.result().setName("pt_symz") -Group_10_objects = [model.selection("FACE", "Recover_1_1_1/Modified_Face&GVBody_1_1/To_Face"), - model.selection("FACE", "Recover_1_1_1/Modified_Face&GVBody_1_1/From_Face"), - model.selection("FACE", "Partition_1_1_3/Modified_Face&GVBody_1_2/From_Face"), - model.selection("FACE", "Partition_1_1_10/Modified_Face&PHomoProfile/SketchLine_36"), - model.selection("FACE", "Extrusion_2_1_7/Generated_Face&PHomoProfile/SketchLine_36"), - model.selection("FACE", "Extrusion_2_1_3/Generated_Face&PHomoProfile/SketchLine_29"), - model.selection("FACE", "Partition_1_1_6/Modified_Face&PHomoProfile/SketchLine_29"), - model.selection("FACE", "Partition_1_1_3/Modified_Face&GVBody_1_2/To_Face"), - model.selection("FACE", "Partition_1_1_5/Modified_Face&PHomoProfile/SketchLine_29"), - model.selection("FACE", "Partition_1_1_9/Modified_Face&PHomoProfile/SketchLine_36"), - model.selection("FACE", "Partition_1_1_1/Modified_Face&Extrusion_1_1/To_Face"), - model.selection("FACE", "Partition_1_1_4/Modified_Face&GVBody_1_3/From_Face"), - model.selection("FACE", "Partition_1_1_4/Modified_Face&GVBody_1_3/To_Face")] +Group_10_objects = [ + model.selection("FACE", "Recover_1_1_1/Modified_Face&GVBody_1_1/To_Face"), + model.selection("FACE", "Recover_1_1_1/Modified_Face&GVBody_1_1/From_Face"), + model.selection("FACE", "Partition_1_1_3/Modified_Face&GVBody_1_2/From_Face"), + model.selection( + "FACE", "Partition_1_1_10/Modified_Face&PHomoProfile/SketchLine_36" + ), + model.selection( + "FACE", "Extrusion_2_1_7/Generated_Face&PHomoProfile/SketchLine_36" + ), + model.selection( + "FACE", "Extrusion_2_1_3/Generated_Face&PHomoProfile/SketchLine_29" + ), + model.selection("FACE", "Partition_1_1_6/Modified_Face&PHomoProfile/SketchLine_29"), + model.selection("FACE", "Partition_1_1_3/Modified_Face&GVBody_1_2/To_Face"), + model.selection("FACE", "Partition_1_1_5/Modified_Face&PHomoProfile/SketchLine_29"), + model.selection("FACE", "Partition_1_1_9/Modified_Face&PHomoProfile/SketchLine_36"), + model.selection("FACE", "Partition_1_1_1/Modified_Face&Extrusion_1_1/To_Face"), + model.selection("FACE", "Partition_1_1_4/Modified_Face&GVBody_1_3/From_Face"), + model.selection("FACE", "Partition_1_1_4/Modified_Face&GVBody_1_3/To_Face"), +] Group_10 = model.addGroup(Part_1_doc, Group_10_objects) Group_10.setName("symz") Group_10.result().setName("symz") -Group_11 = model.addGroup(Part_1_doc, [model.selection("FACE", "Recover_1_1_3/Modified_Face&GVProfile/SketchLine_10")]) +Group_11 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Recover_1_1_3/Modified_Face&GVProfile/SketchLine_10")], +) Group_11.setName("appui") Group_11.result().setName("appui") -Group_12 = model.addGroup(Part_1_doc, [model.selection("FACE", "Recover_1_1_1/Modified_Face&GVProfile/SketchLine_2")]) +Group_12 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Recover_1_1_1/Modified_Face&GVProfile/SketchLine_2")], +) Group_12.setName("sup") Group_12.result().setName("sup") -Group_13_objects = [model.selection("FACE", "Partition_1_1_6/Modified_Face&Extrusion_2_1_2/To_Face"), - model.selection("FACE", "Extrusion_2_1_4/To_Face"), - model.selection("FACE", "Extrusion_2_1_3/To_Face"), - model.selection("FACE", "Extrusion_2_1_8/To_Face"), - model.selection("FACE", "Extrusion_2_1_7/To_Face"), - model.selection("FACE", "Partition_1_1_10/Modified_Face&Extrusion_2_1_6/To_Face")] +Group_13_objects = [ + model.selection("FACE", "Partition_1_1_6/Modified_Face&Extrusion_2_1_2/To_Face"), + model.selection("FACE", "Extrusion_2_1_4/To_Face"), + model.selection("FACE", "Extrusion_2_1_3/To_Face"), + model.selection("FACE", "Extrusion_2_1_8/To_Face"), + model.selection("FACE", "Extrusion_2_1_7/To_Face"), + model.selection("FACE", "Partition_1_1_10/Modified_Face&Extrusion_2_1_6/To_Face"), +] Group_13 = model.addGroup(Part_1_doc, Group_13_objects) Group_13.setName("pt_sec") Group_13.result().setName("pt_sec") -Group_14_objects = [model.selection("FACE", "Partition_1_1_6/Modified_Face&Extrusion_2_1_2/From_Face"), - model.selection("FACE", "Extrusion_2_1_3/From_Face"), - model.selection("FACE", "Extrusion_2_1_4/From_Face"), - model.selection("FACE", "Extrusion_2_1_7/From_Face"), - model.selection("FACE", "Extrusion_2_1_8/From_Face"), - model.selection("FACE", "Partition_1_1_10/Modified_Face&Extrusion_2_1_6/From_Face")] +Group_14_objects = [ + model.selection("FACE", "Partition_1_1_6/Modified_Face&Extrusion_2_1_2/From_Face"), + model.selection("FACE", "Extrusion_2_1_3/From_Face"), + model.selection("FACE", "Extrusion_2_1_4/From_Face"), + model.selection("FACE", "Extrusion_2_1_7/From_Face"), + model.selection("FACE", "Extrusion_2_1_8/From_Face"), + model.selection("FACE", "Partition_1_1_10/Modified_Face&Extrusion_2_1_6/From_Face"), +] Group_14 = model.addGroup(Part_1_doc, Group_14_objects) Group_14.setName("pt_pr") Group_14.result().setName("pt_pr") -Group_15 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Recover_1_1_3/Modified_Vertex&weak_name_9")]) +Group_15 = model.addGroup( + Part_1_doc, [model.selection("VERTEX", "Recover_1_1_3/Modified_Vertex&weak_name_9")] +) Group_15.setName("NO_DX") Group_15.result().setName("NO_DX") model.end() @@ -409,8 +780,8 @@ aFactory = ModelAPI_Session.get().validators() # Check groups for i in range(Part_1_doc.size("Groups")): - GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", i))) - assert(aFactory.validate(GroupFeature)) + GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", i))) + assert aFactory.validate(GroupFeature) model.begin() toto.setValue(2000) @@ -418,5 +789,5 @@ model.end() # Check groups again for i in range(Part_1_doc.size("Groups")): - GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", i))) - assert(aFactory.validate(GroupFeature)) + GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", i))) + assert aFactory.validate(GroupFeature) diff --git a/src/FeaturesPlugin/Test/Test3014.py b/src/FeaturesPlugin/Test/Test3014.py index 2579a0f33..ca747730d 100644 --- a/src/FeaturesPlugin/Test/Test3014.py +++ b/src/FeaturesPlugin/Test/Test3014.py @@ -29,22 +29,57 @@ Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "nb", "10") model.addParameter(Part_1_doc, "h", "20") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 55.86212361331221, 9.333219356250011) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center()) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchCircle_1.results()[1]], SketchAPI_Line(SketchLine_1).startPoint(), 360, "nb", True) -[SketchCircle_2, SketchCircle_3, SketchCircle_4, SketchCircle_5, SketchCircle_6, SketchCircle_7, SketchCircle_8, SketchCircle_9, SketchCircle_10] = SketchMultiRotation_1.rotated() +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_1.center() +) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchCircle_1.results()[1]], + SketchAPI_Line(SketchLine_1).startPoint(), + 360, + "nb", + True, +) +[ + SketchCircle_2, + SketchCircle_3, + SketchCircle_4, + SketchCircle_5, + SketchCircle_6, + SketchCircle_7, + SketchCircle_8, + SketchCircle_9, + SketchCircle_10, +] = SketchMultiRotation_1.rotated() model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), "h", 0) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_4/To_Face"), "h/2", True) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Plane_1"), model.selection("COMPOUND", "all-in-Extrusion_1")], keepSubResults = True) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection(), + "h", + 0, +) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "Extrusion_1_4/To_Face"), "h/2", True +) +Partition_1 = model.addPartition( + Part_1_doc, + [ + model.selection("FACE", "Plane_1"), + model.selection("COMPOUND", "all-in-Extrusion_1"), + ], + keepSubResults=True, +) model.end() -assert(Partition_1.feature().error() == "") +assert Partition_1.feature().error() == "" model.testNbResults(Partition_1, 1) model.testNbSubResults(Partition_1, [10]) model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [20]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test3033.py b/src/FeaturesPlugin/Test/Test3033.py index 40df6f537..95d19aa04 100644 --- a/src/FeaturesPlugin/Test/Test3033.py +++ b/src/FeaturesPlugin/Test/Test3033.py @@ -26,19 +26,43 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(10, 25, 7) SketchCircle_2 = Sketch_1.addCircle(10, 25, 3) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchCircle_2.center()) +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_2r-SketchCircle_2_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")], model.selection(), 10, 0) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 10, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2")]) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1_1/To_Face")) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchCircle_2_2r"), + model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f"), + ], + model.selection(), + 10, + 0, +) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [], + model.selection(), + 0, + 10, + [ + model.selection("SOLID", "Extrusion_1_1_1"), + model.selection("SOLID", "Extrusion_1_1_2"), + ], +) +Sketch_2 = model.addSketch( + Part_1_doc, model.selection("FACE", "Extrusion_1_1_1/To_Face") +) SketchCircle_3 = Sketch_2.addCircle(2, 30, 10) ExtrusionCut_1.setNestedSketch(Sketch_2) model.end() # check the extrusion-cut result is correct from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(ExtrusionCut_1.feature())) +assert aFactory.validate(ExtrusionCut_1.feature()) model.testNbResults(ExtrusionCut_1, 1) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/Test3076.py b/src/FeaturesPlugin/Test/Test3076.py index 574019186..5539ba608 100644 --- a/src/FeaturesPlugin/Test/Test3076.py +++ b/src/FeaturesPlugin/Test/Test3076.py @@ -12,124 +12,349 @@ model.addParameter(Part_1_doc, "ep", "0.02") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchLine_1 = Sketch_1.addLine(1.25, 4.0171, 1.25, 2.5971) SketchLine_2 = Sketch_1.addLine(1.25, 2.5971, 1.4, 2.5971) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(1.4, 2.5971, 1.4, 2.0871) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(1.4, 2.0871, 1.25, 2.0871) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_2.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_5 = SketchProjection_1.createdFeature() SketchLine_5.setName("SketchLine_6") SketchLine_5.result().setName("SketchLine_6") -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_6 = SketchProjection_2.createdFeature() SketchLine_6.setName("SketchLine_7") SketchLine_6.result().setName("SketchLine_7") SketchLine_7 = Sketch_1.addLine(1.25, 2.0871, 1.25, 0.6671) SketchLine_7.setName("SketchLine_12") SketchLine_7.result().setName("SketchLine_12") -SketchEllipticArc_1 = Sketch_1.addEllipticArc(0, 0.6671, 1.057108125973878, 0.6671, 0, 2.733995794193338e-31, 1.25, 0.6671000000000001, False) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_8, SketchLine_9] = SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipticArc_1 = Sketch_1.addEllipticArc( + 0, + 0.6671, + 1.057108125973878, + 0.6671, + 0, + 2.733995794193338e-31, + 1.25, + 0.6671000000000001, + False, +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_8, + SketchLine_9, +] = SketchEllipticArc_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintVertical_3.setName("SketchConstraintVertical_4") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_9).startPoint(), SketchEllipticArc_1.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_9).startPoint(), SketchEllipticArc_1.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_22") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchEllipticArc_1.endPoint(), SketchAPI_Point(SketchPoint_5).coordinates()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchEllipticArc_1.endPoint(), SketchAPI_Point(SketchPoint_5).coordinates() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_23") -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchEllipticArc_1.minorAxisNegative(), SketchLine_8.result(), "r1", True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchEllipticArc_1.majorAxisPositive()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchEllipticArc_1.minorAxisNegative(), SketchLine_8.result(), "r1", True +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchEllipticArc_1.majorAxisPositive() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_27") SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintVertical_4.setName("SketchConstraintVertical_5") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.result(), 1.25, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.result(), 1.25, True +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), 1.42) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_7.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_13") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_7.result()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_7.result() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_14") SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_3.result(), 0.51) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_2.result(), 0.15) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_1.result(), 1.42) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchEllipticArc_1.minorAxisNegative(), SketchLine_5.result()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchEllipticArc_1.minorAxisNegative(), SketchLine_5.result() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_9") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_6).coordinates(), SketchLine_6.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_6).coordinates(), SketchLine_6.result() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_10") -SketchEllipticArc_2 = Sketch_1.addEllipticArc(0, 4.0171, 1.057108125973878, 4.0171, 1.25, 4.0171, -1.323488743421758e-23, 4.6842, False) -[SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11, SketchPoint_12, SketchPoint_13, SketchPoint_14, SketchLine_10, SketchLine_11] = SketchEllipticArc_2.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_6.result(), SketchEllipticArc_2.center()) +SketchEllipticArc_2 = Sketch_1.addEllipticArc( + 0, + 4.0171, + 1.057108125973878, + 4.0171, + 1.25, + 4.0171, + -1.323488743421758e-23, + 4.6842, + False, +) +[ + SketchPoint_8, + SketchPoint_9, + SketchPoint_10, + SketchPoint_11, + SketchPoint_12, + SketchPoint_13, + SketchPoint_14, + SketchLine_10, + SketchLine_11, +] = SketchEllipticArc_2.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_6.result(), SketchEllipticArc_2.center() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_11") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchEllipticArc_2.startPoint(), SketchAPI_Line(SketchLine_10).endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchEllipticArc_2.startPoint(), SketchAPI_Line(SketchLine_10).endPoint() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_12") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchEllipticArc_2.endPoint(), SketchAPI_Line(SketchLine_11).endPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchEllipticArc_2.endPoint(), SketchAPI_Line(SketchLine_11).endPoint() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_15") SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_10.result()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_12).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_12).coordinates(), SketchLine_1.startPoint() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_16") -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchEllipticArc_2.minorAxisPositive(), SketchLine_10.result(), "r1", True) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchEllipticArc_2.minorAxisPositive(), SketchLine_10.result(), "r1", True +) SketchLine_12 = Sketch_1.addLine(1.229999999999999, 4.0171, 1.229999999999999, 0.6671) SketchLine_12.setName("SketchLine_13") SketchLine_12.result().setName("SketchLine_13") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_12.startPoint(), SketchLine_10.result()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_12.startPoint(), SketchLine_10.result() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_17") -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_8.result()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_8.result() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_18") SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_12.result()) SketchConstraintVertical_5.setName("SketchConstraintVertical_6") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_12.startPoint(), SketchLine_1.result(), "ep", True) -SketchEllipticArc_3 = Sketch_1.addEllipticArc(0, 4.0171, 1.046021792316405, 4.0171, 0, 4.664199999999999, 1.23, 4.0171, True) -[SketchPoint_15, SketchPoint_16, SketchPoint_17, SketchPoint_18, SketchPoint_19, SketchPoint_20, SketchPoint_21, SketchLine_13, SketchLine_14] = SketchEllipticArc_3.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchEllipticArc_2.center(), SketchEllipticArc_3.center()) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_12.startPoint(), SketchLine_1.result(), "ep", True +) +SketchEllipticArc_3 = Sketch_1.addEllipticArc( + 0, 4.0171, 1.046021792316405, 4.0171, 0, 4.664199999999999, 1.23, 4.0171, True +) +[ + SketchPoint_15, + SketchPoint_16, + SketchPoint_17, + SketchPoint_18, + SketchPoint_19, + SketchPoint_20, + SketchPoint_21, + SketchLine_13, + SketchLine_14, +] = SketchEllipticArc_3.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchEllipticArc_2.center(), SketchEllipticArc_3.center() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_19") -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_6.result(), SketchEllipticArc_3.startPoint()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_6.result(), SketchEllipticArc_3.startPoint() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_20") -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_10.result(), SketchEllipticArc_3.endPoint()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_10.result(), SketchEllipticArc_3.endPoint() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_21") -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchEllipticArc_3.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchEllipticArc_3.endPoint(), SketchLine_12.startPoint() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_24") -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchEllipticArc_2.minorAxisPositive(), SketchEllipticArc_3.startPoint(), "ep") +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchEllipticArc_2.minorAxisPositive(), SketchEllipticArc_3.startPoint(), "ep" +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_13.result()) -SketchEllipticArc_4 = Sketch_1.addEllipticArc(0, 0.6671, 1.046021792316011, 0.6671, 0, 0.02, 1.229999999999999, 0.6670999999999999, False) -[SketchPoint_22, SketchPoint_23, SketchPoint_24, SketchPoint_25, SketchPoint_26, SketchPoint_27, SketchPoint_28, SketchLine_15, SketchLine_16] = SketchEllipticArc_4.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchEllipticArc_1.center(), SketchEllipticArc_4.center()) +SketchEllipticArc_4 = Sketch_1.addEllipticArc( + 0, + 0.6671, + 1.046021792316011, + 0.6671, + 0, + 0.02, + 1.229999999999999, + 0.6670999999999999, + False, +) +[ + SketchPoint_22, + SketchPoint_23, + SketchPoint_24, + SketchPoint_25, + SketchPoint_26, + SketchPoint_27, + SketchPoint_28, + SketchLine_15, + SketchLine_16, +] = SketchEllipticArc_4.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchEllipticArc_1.center(), SketchEllipticArc_4.center() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_25") -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchEllipticArc_4.result()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchEllipticArc_4.result() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_26") -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_6.result(), SketchEllipticArc_4.startPoint()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_6.result(), SketchEllipticArc_4.startPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_28") -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchEllipticArc_4.endPoint()) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchEllipticArc_4.endPoint() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_29") -SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchEllipticArc_4.minorAxisNegative(), SketchEllipticArc_1.minorAxisNegative(), "ep") +SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance( + SketchEllipticArc_4.minorAxisNegative(), + SketchEllipticArc_1.minorAxisNegative(), + "ep", +) SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_15.result()) -SketchLine_17 = Sketch_1.addLine(9.702173021404511e-32, 0.02, -2.296340201324298e-16, -1.110223024625157e-16) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchEllipticArc_4.minorAxisNegative(), SketchLine_17.startPoint()) +SketchLine_17 = Sketch_1.addLine( + 9.702173021404511e-32, 0.02, -2.296340201324298e-16, -1.110223024625157e-16 +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchEllipticArc_4.minorAxisNegative(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_30") -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_17.endPoint()) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_17.endPoint() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_31") -SketchLine_18 = Sketch_1.addLine(7.654042494670958e-17, 4.684199999999996, 7.524363077049401e-17, 4.664199999999999) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchEllipticArc_2.minorAxisPositive(), SketchLine_18.startPoint()) +SketchLine_18 = Sketch_1.addLine( + 7.654042494670958e-17, 4.684199999999996, 7.524363077049401e-17, 4.664199999999999 +) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchEllipticArc_2.minorAxisPositive(), SketchLine_18.startPoint() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_32") -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchEllipticArc_3.minorAxisPositive(), SketchLine_18.endPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchEllipticArc_3.minorAxisPositive(), SketchLine_18.endPoint() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_33") model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchEllipticArc_2f-SketchLine_18f-SketchEllipticArc_3r-SketchLine_13f-SketchEllipticArc_4r-SketchLine_17f-SketchEllipticArc_1f-SketchLine_12r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection("EDGE", "PartSet/OZ"), "angle", 0) -Group_1_objects = [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchEllipticArc_4"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchEllipticArc_3")] +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchEllipticArc_2f-SketchLine_18f-SketchEllipticArc_3r-SketchLine_13f-SketchEllipticArc_4r-SketchLine_17f-SketchEllipticArc_1f-SketchLine_12r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection("EDGE", "PartSet/OZ"), + "angle", + 0, +) +Group_1_objects = [ + model.selection( + "FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchEllipticArc_4" + ), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13"), + model.selection( + "FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchEllipticArc_3" + ), +] Group_1 = model.addGroup(Part_1_doc, "Faces", Group_1_objects) Group_1.setName("Group_int") Group_1.result().setName("Group_int") Group_1.result().setColor(170, 0, 0) -Group_2_objects = [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchEllipticArc_2"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_4"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_12"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchEllipticArc_1")] +Group_2_objects = [ + model.selection( + "FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchEllipticArc_2" + ), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_4"), + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_12"), + model.selection( + "FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchEllipticArc_1" + ), +] Group_2 = model.addGroup(Part_1_doc, "Faces", Group_2_objects) Group_2.setName("Group_ext") Group_2.result().setName("Group_ext") Group_2.result().setColor(0, 170, 0) -Group_3 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Revolution_1_1/From_Face")]) +Group_3 = model.addGroup( + Part_1_doc, "Faces", [model.selection("FACE", "Revolution_1_1/From_Face")] +) Group_3.setName("Face_lat1") Group_3.result().setName("Face_lat1") -Group_4 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Revolution_1_1/To_Face")]) +Group_4 = model.addGroup( + Part_1_doc, "Faces", [model.selection("FACE", "Revolution_1_1/To_Face")] +) Group_4.setName("Face_lat2") Group_4.result().setName("Face_lat2") model.do() @@ -138,5 +363,5 @@ anAngle.setValue(360) model.end() # check that group 3 and group 4 become invalid -assert(Group_3.groupList().value(0).isInvalid()) -assert(Group_4.groupList().value(0).isInvalid()) +assert Group_3.groupList().value(0).isInvalid() +assert Group_4.groupList().value(0).isInvalid() diff --git a/src/FeaturesPlugin/Test/Test3137_1.py b/src/FeaturesPlugin/Test/Test3137_1.py index 8e4ca422c..55fee06ad 100644 --- a/src/FeaturesPlugin/Test/Test3137_1.py +++ b/src/FeaturesPlugin/Test/Test3137_1.py @@ -25,7 +25,9 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 20, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_1 = Sketch_1.addCircle(15.15541180270434, 24.41800127226657, 10.26187655283108) +SketchCircle_1 = Sketch_1.addCircle( + 15.15541180270434, 24.41800127226657, 10.26187655283108 +) Extrusion_1.setNestedSketch(Sketch_1) model.do() @@ -33,33 +35,103 @@ Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Extrusion_2 = model.addExtrusion(Part_2_doc, [], model.selection(), 10, 0) Sketch_2 = model.addSketch(Part_2_doc, model.defaultPlane("YOZ")) -SketchLine_1 = Sketch_2.addLine(-19.91316598300577, 19.16479847747027, -37.02832010642763, 19.16479847747027) -SketchLine_2 = Sketch_2.addLine(-37.02832010642763, 19.16479847747027, -37.02832010642763, 36.27995260089213) -SketchLine_3 = Sketch_2.addLine(-37.02832010642763, 36.27995260089213, -19.91316598300577, 36.27995260089213) -SketchLine_4 = Sketch_2.addLine(-19.91316598300577, 36.27995260089213, -19.91316598300577, 19.16479847747027) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_1 = Sketch_2.addLine( + -19.91316598300577, 19.16479847747027, -37.02832010642763, 19.16479847747027 +) +SketchLine_2 = Sketch_2.addLine( + -37.02832010642763, 19.16479847747027, -37.02832010642763, 36.27995260089213 +) +SketchLine_3 = Sketch_2.addLine( + -37.02832010642763, 36.27995260089213, -19.91316598300577, 36.27995260089213 +) +SketchLine_4 = Sketch_2.addLine( + -19.91316598300577, 36.27995260089213, -19.91316598300577, 19.16479847747027 +) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_1.result()) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_4.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_4.result(), SketchLine_3.result()) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_4.result(), SketchLine_3.result() +) Extrusion_2.setNestedSketch(Sketch_2) model.do() -LinearCopy_1 = model.addMultiTranslation(partSet, [model.selection("COMPOUND", "Part_1/"), model.selection("COMPOUND", "Part_2/")], model.selection("EDGE", "OX"), 50, 2) -LinearCopy_2_objects = [model.selection("COMPOUND", "LinearCopy_1/"), model.selection("COMPOUND", "LinearCopy_1_2/"), model.selection("COMPOUND", "LinearCopy_1_3/"), model.selection("COMPOUND", "LinearCopy_1_4/")] -LinearCopy_2 = model.addMultiTranslation(partSet, LinearCopy_2_objects, model.selection("EDGE", "OY"), 30, 2, model.selection("EDGE", "OZ"), 25, 2) +LinearCopy_1 = model.addMultiTranslation( + partSet, + [model.selection("COMPOUND", "Part_1/"), model.selection("COMPOUND", "Part_2/")], + model.selection("EDGE", "OX"), + 50, + 2, +) +LinearCopy_2_objects = [ + model.selection("COMPOUND", "LinearCopy_1/"), + model.selection("COMPOUND", "LinearCopy_1_2/"), + model.selection("COMPOUND", "LinearCopy_1_3/"), + model.selection("COMPOUND", "LinearCopy_1_4/"), +] +LinearCopy_2 = model.addMultiTranslation( + partSet, + LinearCopy_2_objects, + model.selection("EDGE", "OY"), + 30, + 2, + model.selection("EDGE", "OZ"), + 25, + 2, +) model.end() from GeomAPI import * model.testNbResults(LinearCopy_2, 16) model.testNbSubResults(LinearCopy_2, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) -model.testNbSubShapes(LinearCopy_2, GeomAPI_Shape.SOLID, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) -model.testNbSubShapes(LinearCopy_2, GeomAPI_Shape.FACE, [3, 3, 3, 3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6]) -model.testNbSubShapes(LinearCopy_2, GeomAPI_Shape.EDGE, [6, 6, 6, 6, 6, 6, 6, 6, 24, 24, 24, 24, 24, 24, 24, 24]) -model.testNbSubShapes(LinearCopy_2, GeomAPI_Shape.VERTEX, [12, 12, 12, 12, 12, 12, 12, 12, 48, 48, 48, 48, 48, 48, 48, 48]) -model.testResultsVolumes(LinearCopy_2, [6616.5780553, 6616.5780553, 6616.5780553, 6616.5780553, 6616.5780553, 6616.5780553, 6616.5780553, 6616.5780553, 2929.285, 2929.285, 2929.285, 2929.285, 2929.285, 2929.285, 2929.285, 2929.285]) +model.testNbSubShapes( + LinearCopy_2, GeomAPI_Shape.SOLID, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] +) +model.testNbSubShapes( + LinearCopy_2, GeomAPI_Shape.FACE, [3, 3, 3, 3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6] +) +model.testNbSubShapes( + LinearCopy_2, + GeomAPI_Shape.EDGE, + [6, 6, 6, 6, 6, 6, 6, 6, 24, 24, 24, 24, 24, 24, 24, 24], +) +model.testNbSubShapes( + LinearCopy_2, + GeomAPI_Shape.VERTEX, + [12, 12, 12, 12, 12, 12, 12, 12, 48, 48, 48, 48, 48, 48, 48, 48], +) +model.testResultsVolumes( + LinearCopy_2, + [ + 6616.5780553, + 6616.5780553, + 6616.5780553, + 6616.5780553, + 6616.5780553, + 6616.5780553, + 6616.5780553, + 6616.5780553, + 2929.285, + 2929.285, + 2929.285, + 2929.285, + 2929.285, + 2929.285, + 2929.285, + 2929.285, + ], +) diff --git a/src/FeaturesPlugin/Test/Test3137_2.py b/src/FeaturesPlugin/Test/Test3137_2.py index e4309902e..2f5936eff 100644 --- a/src/FeaturesPlugin/Test/Test3137_2.py +++ b/src/FeaturesPlugin/Test/Test3137_2.py @@ -25,7 +25,9 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 20, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_1 = Sketch_1.addCircle(15.15541180270434, 24.41800127226657, 10.26187655283108) +SketchCircle_1 = Sketch_1.addCircle( + 15.15541180270434, 24.41800127226657, 10.26187655283108 +) Extrusion_1.setNestedSketch(Sketch_1) model.do() @@ -33,23 +35,47 @@ Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Extrusion_2 = model.addExtrusion(Part_2_doc, [], model.selection(), 10, 0) Sketch_2 = model.addSketch(Part_2_doc, model.defaultPlane("YOZ")) -SketchLine_1 = Sketch_2.addLine(-19.91316598300577, 19.16479847747027, -37.02832010642763, 19.16479847747027) -SketchLine_2 = Sketch_2.addLine(-37.02832010642763, 19.16479847747027, -37.02832010642763, 36.27995260089213) -SketchLine_3 = Sketch_2.addLine(-37.02832010642763, 36.27995260089213, -19.91316598300577, 36.27995260089213) -SketchLine_4 = Sketch_2.addLine(-19.91316598300577, 36.27995260089213, -19.91316598300577, 19.16479847747027) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_1 = Sketch_2.addLine( + -19.91316598300577, 19.16479847747027, -37.02832010642763, 19.16479847747027 +) +SketchLine_2 = Sketch_2.addLine( + -37.02832010642763, 19.16479847747027, -37.02832010642763, 36.27995260089213 +) +SketchLine_3 = Sketch_2.addLine( + -37.02832010642763, 36.27995260089213, -19.91316598300577, 36.27995260089213 +) +SketchLine_4 = Sketch_2.addLine( + -19.91316598300577, 36.27995260089213, -19.91316598300577, 19.16479847747027 +) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_1.result()) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_4.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_4.result(), SketchLine_3.result()) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_4.result(), SketchLine_3.result() +) Extrusion_2.setNestedSketch(Sketch_2) model.do() -AngularCopy_1 = model.addMultiRotation(partSet, [model.selection("COMPOUND", "Part_1/"), model.selection("COMPOUND", "Part_2/")], model.selection("EDGE", "OZ"), 90, 2) +AngularCopy_1 = model.addMultiRotation( + partSet, + [model.selection("COMPOUND", "Part_1/"), model.selection("COMPOUND", "Part_2/")], + model.selection("EDGE", "OZ"), + 90, + 2, +) model.end() from GeomAPI import * @@ -60,4 +86,6 @@ model.testNbSubShapes(AngularCopy_1, GeomAPI_Shape.SOLID, [1, 1, 1, 1]) model.testNbSubShapes(AngularCopy_1, GeomAPI_Shape.FACE, [3, 3, 6, 6]) model.testNbSubShapes(AngularCopy_1, GeomAPI_Shape.EDGE, [6, 6, 24, 24]) model.testNbSubShapes(AngularCopy_1, GeomAPI_Shape.VERTEX, [12, 12, 48, 48]) -model.testResultsVolumes(AngularCopy_1, [6616.5780553, 6616.5780553, 2929.285, 2929.285]) +model.testResultsVolumes( + AngularCopy_1, [6616.5780553, 6616.5780553, 2929.285, 2929.285] +) diff --git a/src/FeaturesPlugin/Test/Test3139.py b/src/FeaturesPlugin/Test/Test3139.py index e7ec11051..9edc0ced9 100644 --- a/src/FeaturesPlugin/Test/Test3139.py +++ b/src/FeaturesPlugin/Test/Test3139.py @@ -24,83 +24,210 @@ 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(52.9121725731895, 8.799859429739596, 7.781201848998454, 8.799859429739596) -SketchLine_2 = Sketch_1.addLine(7.781201848998454, 8.799859429739596, 7.781201848998454, 36.33111129445148) -SketchLine_3 = Sketch_1.addLine(7.781201848998454, 36.33111129445148, 52.9121725731895, 36.33111129445148) -SketchLine_4 = Sketch_1.addLine(52.9121725731895, 36.33111129445148, 52.9121725731895, 8.799859429739596) -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()) +SketchLine_1 = Sketch_1.addLine( + 52.9121725731895, 8.799859429739596, 7.781201848998454, 8.799859429739596 +) +SketchLine_2 = Sketch_1.addLine( + 7.781201848998454, 8.799859429739596, 7.781201848998454, 36.33111129445148 +) +SketchLine_3 = Sketch_1.addLine( + 7.781201848998454, 36.33111129445148, 52.9121725731895, 36.33111129445148 +) +SketchLine_4 = Sketch_1.addLine( + 52.9121725731895, 36.33111129445148, 52.9121725731895, 8.799859429739596 +) +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(29.87981510015411, 36.33111129445148, 29.87981510015411, 8.799859429739596) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_3.result()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.result()) +SketchLine_5 = Sketch_1.addLine( + 29.87981510015411, 36.33111129445148, 29.87981510015411, 8.799859429739596 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_3.result() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_1.result() +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_5.result()) -SketchCircle_1 = Sketch_1.addCircle(88.70570107858241, 30.96918335901386, 15.95582825781952) +SketchCircle_1 = Sketch_1.addCircle( + 88.70570107858241, 30.96918335901386, 15.95582825781952 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_1_2"), + ], +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchLine_6 = Sketch_2.addLine(91.78842679005474, 52.44197384283513, 18.42664179347724, 52.44197384283513) -SketchLine_7 = Sketch_2.addLine(18.42664179347724, 52.44197384283513, 18.42664179347724, 23.73518840939176) -SketchLine_8 = Sketch_2.addLine(18.42664179347724, 23.73518840939176, 91.78842679005474, 23.73518840939176) -SketchLine_9 = Sketch_2.addLine(91.78842679005474, 23.73518840939176, 91.78842679005474, 52.44197384283513) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.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()) +SketchLine_6 = Sketch_2.addLine( + 91.78842679005474, 52.44197384283513, 18.42664179347724, 52.44197384283513 +) +SketchLine_7 = Sketch_2.addLine( + 18.42664179347724, 52.44197384283513, 18.42664179347724, 23.73518840939176 +) +SketchLine_8 = Sketch_2.addLine( + 18.42664179347724, 23.73518840939176, 91.78842679005474, 23.73518840939176 +) +SketchLine_9 = Sketch_2.addLine( + 91.78842679005474, 23.73518840939176, 91.78842679005474, 52.44197384283513 +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_6.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() +) SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result()) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_9.result()) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7f-SketchLine_8f-SketchLine_9f")], model.selection(), 10, 0) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Compound_1_1_1_1")], [model.selection("SOLID", "Extrusion_2_1")]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_2/Face-SketchLine_6r-SketchLine_7f-SketchLine_8f-SketchLine_9f", + ) + ], + model.selection(), + 10, + 0, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Compound_1_1_1_1")], + [model.selection("SOLID", "Extrusion_2_1")], +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Sketch_3 = model.addSketch(Part_2_doc, model.defaultPlane("XOY")) -SketchLine_10 = Sketch_3.addLine(52.9121725731895, 8.799859429739596, 7.781201848998454, 8.799859429739596) -SketchLine_11 = Sketch_3.addLine(7.781201848998454, 8.799859429739596, 7.781201848998454, 36.33111129445148) -SketchLine_12 = Sketch_3.addLine(7.781201848998454, 36.33111129445148, 52.9121725731895, 36.33111129445148) -SketchLine_13 = Sketch_3.addLine(52.9121725731895, 36.33111129445148, 52.9121725731895, 8.799859429739596) -SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchLine_10 = Sketch_3.addLine( + 52.9121725731895, 8.799859429739596, 7.781201848998454, 8.799859429739596 +) +SketchLine_11 = Sketch_3.addLine( + 7.781201848998454, 8.799859429739596, 7.781201848998454, 36.33111129445148 +) +SketchLine_12 = Sketch_3.addLine( + 7.781201848998454, 36.33111129445148, 52.9121725731895, 36.33111129445148 +) +SketchLine_13 = Sketch_3.addLine( + 52.9121725731895, 36.33111129445148, 52.9121725731895, 8.799859429739596 +) +SketchConstraintCoincidence_11 = Sketch_3.setCoincident( + SketchLine_13.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_3.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_3.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_10.result()) SketchConstraintVertical_6 = Sketch_3.setVertical(SketchLine_11.result()) SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_12.result()) SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_13.result()) -SketchLine_14 = Sketch_3.addLine(29.87981510015411, 36.33111129445148, 29.87981510015411, 8.799859429739596) -SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_14.startPoint(), SketchLine_12.result()) -SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchLine_10.result()) +SketchLine_14 = Sketch_3.addLine( + 29.87981510015411, 36.33111129445148, 29.87981510015411, 8.799859429739596 +) +SketchConstraintCoincidence_15 = Sketch_3.setCoincident( + SketchLine_14.startPoint(), SketchLine_12.result() +) +SketchConstraintCoincidence_16 = Sketch_3.setCoincident( + SketchLine_14.endPoint(), SketchLine_10.result() +) SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_14.result()) -SketchCircle_2 = Sketch_3.addCircle(88.70570107858241, 30.96918335901386, 15.95582825781952) +SketchCircle_2 = Sketch_3.addCircle( + 88.70570107858241, 30.96918335901386, 15.95582825781952 +) model.do() -Extrusion_3 = model.addExtrusion(Part_2_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0) -Compound_2 = model.addCompound(Part_2_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")]) +Extrusion_3 = model.addExtrusion( + Part_2_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0 +) +Compound_2 = model.addCompound( + Part_2_doc, + [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_1_2"), + ], +) Sketch_4 = model.addSketch(Part_2_doc, model.standardPlane("XOY")) -SketchLine_15 = Sketch_4.addLine(91.78842679005474, 52.44197384283513, 18.42664179347724, 52.44197384283513) -SketchLine_16 = Sketch_4.addLine(18.42664179347724, 52.44197384283513, 18.42664179347724, 23.73518840939176) -SketchLine_17 = Sketch_4.addLine(18.42664179347724, 23.73518840939176, 91.78842679005474, 23.73518840939176) -SketchLine_18 = Sketch_4.addLine(91.78842679005474, 23.73518840939176, 91.78842679005474, 52.44197384283513) -SketchConstraintCoincidence_17 = Sketch_4.setCoincident(SketchLine_18.endPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_18 = Sketch_4.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_19 = Sketch_4.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) -SketchConstraintCoincidence_20 = Sketch_4.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) +SketchLine_15 = Sketch_4.addLine( + 91.78842679005474, 52.44197384283513, 18.42664179347724, 52.44197384283513 +) +SketchLine_16 = Sketch_4.addLine( + 18.42664179347724, 52.44197384283513, 18.42664179347724, 23.73518840939176 +) +SketchLine_17 = Sketch_4.addLine( + 18.42664179347724, 23.73518840939176, 91.78842679005474, 23.73518840939176 +) +SketchLine_18 = Sketch_4.addLine( + 91.78842679005474, 23.73518840939176, 91.78842679005474, 52.44197384283513 +) +SketchConstraintCoincidence_17 = Sketch_4.setCoincident( + SketchLine_18.endPoint(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_18 = Sketch_4.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_19 = Sketch_4.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) +SketchConstraintCoincidence_20 = Sketch_4.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) SketchConstraintHorizontal_7 = Sketch_4.setHorizontal(SketchLine_15.result()) SketchConstraintVertical_9 = Sketch_4.setVertical(SketchLine_16.result()) SketchConstraintHorizontal_8 = Sketch_4.setHorizontal(SketchLine_17.result()) SketchConstraintVertical_10 = Sketch_4.setVertical(SketchLine_18.result()) model.do() -Extrusion_4 = model.addExtrusion(Part_2_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7f-SketchLine_8f-SketchLine_9f")], model.selection(), 10, 0) -Cut_2 = model.addCut(Part_2_doc, [model.selection("SOLID", "Compound_1_1_1_1")], [model.selection("SOLID", "Extrusion_2_1")], keepSubResults = True) +Extrusion_4 = model.addExtrusion( + Part_2_doc, + [ + model.selection( + "FACE", + "Sketch_2/Face-SketchLine_6r-SketchLine_7f-SketchLine_8f-SketchLine_9f", + ) + ], + model.selection(), + 10, + 0, +) +Cut_2 = model.addCut( + Part_2_doc, + [model.selection("SOLID", "Compound_1_1_1_1")], + [model.selection("SOLID", "Extrusion_2_1")], + keepSubResults=True, +) model.do() model.end() diff --git a/src/FeaturesPlugin/Test/TestBoolean1.py b/src/FeaturesPlugin/Test/TestBoolean1.py index 9d5de2abc..199e96616 100644 --- a/src/FeaturesPlugin/Test/TestBoolean1.py +++ b/src/FeaturesPlugin/Test/TestBoolean1.py @@ -31,9 +31,9 @@ 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 * @@ -47,9 +47,9 @@ 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")) @@ -61,12 +61,12 @@ 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.) +anCircleCentr.setValue(10.0, 10.0) +aCircleRadius.setValue(50.0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create a sketch with triangle to extrude -#========================================================================= +# ========================================================================= aSession.startOperation() aTriangleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin")) @@ -84,16 +84,16 @@ 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.) +aLineAStartPoint.setValue(25.0, 25.0) +aLineAEndPoint.setValue(100.0, 25.0) +aLineBStartPoint.setValue(100.0, 25.0) +aLineBEndPoint.setValue(60.0, 75.0) +aLineCStartPoint.setValue(60.0, 75.0) +aLineCEndPoint.setValue(25.0, 25.0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on circle (cylinder) and triangle (prism) -#========================================================================= +# ========================================================================= # Build shape from sketcher results aSession.startOperation() extrudedObjects = [] @@ -102,32 +102,36 @@ for eachSketchFeature in [aCircleSketchFeature, aTriangleSketchFeature]: aSketchResult = modelAPI_ResultConstruction(eachSketchFeature.firstResult()) # Create extrusion on them anExtrusionFt = aPart.addFeature("Extrusion") - anExtrusionFt.selectionList("base").append( - aSketchResult, aSketchResult.face(0)) + 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.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.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) +assert len(aBooleanFt.results()) > 0 aBooleanResult = modelAPI_ResultBody(aBooleanFt.firstResult()) -assert (aBooleanResult is not None) -#========================================================================= +assert aBooleanResult is not None +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBoolean2.py b/src/FeaturesPlugin/Test/TestBoolean2.py index a6cbcdba9..c2b67edca 100644 --- a/src/FeaturesPlugin/Test/TestBoolean2.py +++ b/src/FeaturesPlugin/Test/TestBoolean2.py @@ -27,12 +27,27 @@ 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) +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")]) +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 len(Common_1.results()) > 0 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBoolean3.py b/src/FeaturesPlugin/Test/TestBoolean3.py index f54d6a8fb..e2385494e 100644 --- a/src/FeaturesPlugin/Test/TestBoolean3.py +++ b/src/FeaturesPlugin/Test/TestBoolean3.py @@ -27,12 +27,27 @@ 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) +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")]) +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 len(Smash_1.results()) > 0 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_CompSolidCompound.py b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_CompSolidCompound.py index a0b0a5a46..e1549a010 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_CompSolidCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_CompSolidCompound.py @@ -24,63 +24,173 @@ 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(-20.89528643446688, 23.53376279136156, -12.17630887873155, 30.26420160631515) -SketchLine_2 = Sketch_1.addLine(-12.17630887873155, 30.26420160631515, -3.763260360039565, 22.15708212466651) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(-3.763260360039565, 22.15708212466651, -11.56445080464485, 13.8969981244962) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-11.56445080464485, 13.8969981244962, -20.89528643446688, 23.53376279136156) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint()) -SketchLine_5 = Sketch_1.addLine(-20.89528643446688, 23.53376279136156, -3.763260360039565, 22.15708212466651) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_5.endPoint()) -SketchLine_6 = Sketch_1.addLine(7.862043047607545, 23.07486923579655, 15.35730445516949, 31.02902419892351) -SketchLine_7 = Sketch_1.addLine(15.35730445516949, 31.02902419892351, 24.53517556646984, 20.93336597649314) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchLine_8 = Sketch_1.addLine(24.53517556646984, 20.93336597649314, 17.03991415890789, 12.67328197632283) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchLine_9 = Sketch_1.addLine(17.03991415890789, 12.67328197632283, 7.862043047607545, 23.07486923579655) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_9.endPoint()) -SketchLine_10 = Sketch_1.addLine(7.862043047607545, 23.07486923579655, 24.53517556646984, 20.93336597649314) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_10.endPoint()) +SketchLine_1 = Sketch_1.addLine( + -20.89528643446688, 23.53376279136156, -12.17630887873155, 30.26420160631515 +) +SketchLine_2 = Sketch_1.addLine( + -12.17630887873155, 30.26420160631515, -3.763260360039565, 22.15708212466651 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + -3.763260360039565, 22.15708212466651, -11.56445080464485, 13.8969981244962 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -11.56445080464485, 13.8969981244962, -20.89528643446688, 23.53376279136156 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_4.endPoint() +) +SketchLine_5 = Sketch_1.addLine( + -20.89528643446688, 23.53376279136156, -3.763260360039565, 22.15708212466651 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_5.endPoint() +) +SketchLine_6 = Sketch_1.addLine( + 7.862043047607545, 23.07486923579655, 15.35730445516949, 31.02902419892351 +) +SketchLine_7 = Sketch_1.addLine( + 15.35730445516949, 31.02902419892351, 24.53517556646984, 20.93336597649314 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchLine_8 = Sketch_1.addLine( + 24.53517556646984, 20.93336597649314, 17.03991415890789, 12.67328197632283 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchLine_9 = Sketch_1.addLine( + 17.03991415890789, 12.67328197632283, 7.862043047607545, 23.07486923579655 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchLine_9.endPoint() +) +SketchLine_10 = Sketch_1.addLine( + 7.862043047607545, 23.07486923579655, 24.53517556646984, 20.93336597649314 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_10.endPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_11 = Sketch_2.addLine(-6.516621693429666, 11.60253034667112, -9.88184110090646, 19.09779175423307) -SketchLine_12 = Sketch_2.addLine(-9.88184110090646, 19.09779175423307, -1.162863545171131, 18.94482723571139) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchLine_13 = Sketch_2.addLine(-1.162863545171131, 18.94482723571139, 0.8256751956106094, 13.43810456893119) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchLine_14 = Sketch_2.addLine(0.8256751956106094, 13.43810456893119, -6.516621693429666, 11.60253034667112) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchLine_14.endPoint()) -SketchLine_15 = Sketch_2.addLine(-1.162863545171131, 18.94482723571139, -6.516621693429666, 11.60253034667112) -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchLine_15.endPoint()) -SketchLine_16 = Sketch_2.addLine(6.332397862390824, 16.34443042084296, 15.35730445516949, 18.79186271718972) -SketchLine_17 = Sketch_2.addLine(15.35730445516949, 18.79186271718972, 12.75690764030107, 10.22584967997607) -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) -SketchLine_18 = Sketch_2.addLine(12.75690764030107, 10.22584967997607, 6.179433343869151, 7.778417383629304) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) -SketchLine_19 = Sketch_2.addLine(6.179433343869151, 7.778417383629304, 6.332397862390824, 16.34443042084296) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchLine_19.endPoint()) -SketchLine_20 = Sketch_2.addLine(6.332397862390824, 16.34443042084296, 12.75690764030107, 10.22584967997607) -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_20.endPoint()) +SketchLine_11 = Sketch_2.addLine( + -6.516621693429666, 11.60253034667112, -9.88184110090646, 19.09779175423307 +) +SketchLine_12 = Sketch_2.addLine( + -9.88184110090646, 19.09779175423307, -1.162863545171131, 18.94482723571139 +) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchLine_13 = Sketch_2.addLine( + -1.162863545171131, 18.94482723571139, 0.8256751956106094, 13.43810456893119 +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchLine_14 = Sketch_2.addLine( + 0.8256751956106094, 13.43810456893119, -6.516621693429666, 11.60253034667112 +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_11.startPoint(), SketchLine_14.endPoint() +) +SketchLine_15 = Sketch_2.addLine( + -1.162863545171131, 18.94482723571139, -6.516621693429666, 11.60253034667112 +) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchLine_11.startPoint(), SketchLine_15.endPoint() +) +SketchLine_16 = Sketch_2.addLine( + 6.332397862390824, 16.34443042084296, 15.35730445516949, 18.79186271718972 +) +SketchLine_17 = Sketch_2.addLine( + 15.35730445516949, 18.79186271718972, 12.75690764030107, 10.22584967997607 +) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) +SketchLine_18 = Sketch_2.addLine( + 12.75690764030107, 10.22584967997607, 6.179433343869151, 7.778417383629304 +) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) +SketchLine_19 = Sketch_2.addLine( + 6.179433343869151, 7.778417383629304, 6.332397862390824, 16.34443042084296 +) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_16.startPoint(), SketchLine_19.endPoint() +) +SketchLine_20 = Sketch_2.addLine( + 6.332397862390824, 16.34443042084296, 12.75690764030107, 10.22584967997607 +) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_16.startPoint(), SketchLine_20.startPoint() +) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchLine_17.endPoint(), SketchLine_20.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 5, 5) -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")]) -Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10 +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 5, 5 +) +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"), + ], +) +Common_1 = model.addCommon( + Part_1_doc, + [ + model.selection("COMPOUND", "Compound_1_1"), + model.selection("COMPOUND", "Compound_2_1"), + ], +) model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [2]) @@ -89,4 +199,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [10]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [36]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [72]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_Face.py b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_Face.py index 589832f5b..a52b9e9eb 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_Face.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_Face.py @@ -24,60 +24,139 @@ 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(-21.66024096385543, 40.92621620645053, -77.63614457831326, 40.92621620645053) -SketchLine_2 = Sketch_1.addLine(-77.63614457831326, 40.92621620645053, -77.63614457831326, 1.907518733308514) -SketchLine_3 = Sketch_1.addLine(-77.63614457831326, 1.907518733308514, -21.66024096385543, 1.907518733308514) -SketchLine_4 = Sketch_1.addLine(-21.66024096385543, 1.907518733308514, -21.66024096385543, 40.92621620645053) -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()) +SketchLine_1 = Sketch_1.addLine( + -21.66024096385543, 40.92621620645053, -77.63614457831326, 40.92621620645053 +) +SketchLine_2 = Sketch_1.addLine( + -77.63614457831326, 40.92621620645053, -77.63614457831326, 1.907518733308514 +) +SketchLine_3 = Sketch_1.addLine( + -77.63614457831326, 1.907518733308514, -21.66024096385543, 1.907518733308514 +) +SketchLine_4 = Sketch_1.addLine( + -21.66024096385543, 1.907518733308514, -21.66024096385543, 40.92621620645053 +) +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(65.46746987951809, 41.25025618940838, 10.46506024096384, 41.25025618940838) -SketchLine_6 = Sketch_1.addLine(10.46506024096384, 41.25025618940838, 10.46506024096384, -1.337003177360179) -SketchLine_7 = Sketch_1.addLine(10.46506024096384, -1.337003177360179, 65.46746987951809, -1.337003177360179) -SketchLine_8 = Sketch_1.addLine(65.46746987951809, -1.337003177360179, 65.46746987951809, 41.25025618940838) -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()) +SketchLine_5 = Sketch_1.addLine( + 65.46746987951809, 41.25025618940838, 10.46506024096384, 41.25025618940838 +) +SketchLine_6 = Sketch_1.addLine( + 10.46506024096384, 41.25025618940838, 10.46506024096384, -1.337003177360179 +) +SketchLine_7 = Sketch_1.addLine( + 10.46506024096384, -1.337003177360179, 65.46746987951809, -1.337003177360179 +) +SketchLine_8 = Sketch_1.addLine( + 65.46746987951809, -1.337003177360179, 65.46746987951809, 41.25025618940838 +) +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(-54.27228915662651, 40.92621620645053, -55.24578313253012, 1.907518733308514) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_3.result()) -SketchLine_10 = Sketch_1.addLine(31.88192771084336, 41.25025618940838, 30.42168674698797, -1.337003177360179) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.startPoint(), SketchLine_5.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.result()) +SketchLine_9 = Sketch_1.addLine( + -54.27228915662651, 40.92621620645053, -55.24578313253012, 1.907518733308514 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_9.startPoint(), SketchLine_1.result() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_3.result() +) +SketchLine_10 = Sketch_1.addLine( + 31.88192771084336, 41.25025618940838, 30.42168674698797, -1.337003177360179 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_10.startPoint(), SketchLine_5.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.result() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_11 = Sketch_2.addLine(19.22650602409638, 27.01445783132531, -12.83325439216414, 27.01445783132531) -SketchLine_12 = Sketch_2.addLine(-12.83325439216414, 27.01445783132531, -12.83325439216414, 11.0281619215649) -SketchLine_13 = Sketch_2.addLine(-12.83325439216414, 11.0281619215649, 19.22650602409638, 11.0281619215649) -SketchLine_14 = Sketch_2.addLine(19.22650602409638, 11.0281619215649, 19.22650602409638, 27.01445783132531) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchLine_11 = Sketch_2.addLine( + 19.22650602409638, 27.01445783132531, -12.83325439216414, 27.01445783132531 +) +SketchLine_12 = Sketch_2.addLine( + -12.83325439216414, 27.01445783132531, -12.83325439216414, 11.0281619215649 +) +SketchLine_13 = Sketch_2.addLine( + -12.83325439216414, 11.0281619215649, 19.22650602409638, 11.0281619215649 +) +SketchLine_14 = Sketch_2.addLine( + 19.22650602409638, 11.0281619215649, 19.22650602409638, 27.01445783132531 +) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_12.result()) 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_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")]) +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_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) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [0]) @@ -86,4 +165,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [1]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [8]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_Shell.py b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_Shell.py index 1a38e2d17..7da6efeea 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_Shell.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_Shell.py @@ -24,63 +24,155 @@ 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(-21.66024096385543, 40.92621620645053, -77.63614457831326, 40.92621620645053) -SketchLine_2 = Sketch_1.addLine(-77.63614457831326, 40.92621620645053, -77.63614457831326, 1.907518733308514) -SketchLine_3 = Sketch_1.addLine(-77.63614457831326, 1.907518733308514, -21.66024096385543, 1.907518733308514) -SketchLine_4 = Sketch_1.addLine(-21.66024096385543, 1.907518733308514, -21.66024096385543, 40.92621620645053) -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()) +SketchLine_1 = Sketch_1.addLine( + -21.66024096385543, 40.92621620645053, -77.63614457831326, 40.92621620645053 +) +SketchLine_2 = Sketch_1.addLine( + -77.63614457831326, 40.92621620645053, -77.63614457831326, 1.907518733308514 +) +SketchLine_3 = Sketch_1.addLine( + -77.63614457831326, 1.907518733308514, -21.66024096385543, 1.907518733308514 +) +SketchLine_4 = Sketch_1.addLine( + -21.66024096385543, 1.907518733308514, -21.66024096385543, 40.92621620645053 +) +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(65.46746987951809, 41.25025618940838, 10.46506024096384, 41.25025618940838) -SketchLine_6 = Sketch_1.addLine(10.46506024096384, 41.25025618940838, 10.46506024096384, -1.337003177360179) -SketchLine_7 = Sketch_1.addLine(10.46506024096384, -1.337003177360179, 65.46746987951809, -1.337003177360179) -SketchLine_8 = Sketch_1.addLine(65.46746987951809, -1.337003177360179, 65.46746987951809, 41.25025618940838) -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()) +SketchLine_5 = Sketch_1.addLine( + 65.46746987951809, 41.25025618940838, 10.46506024096384, 41.25025618940838 +) +SketchLine_6 = Sketch_1.addLine( + 10.46506024096384, 41.25025618940838, 10.46506024096384, -1.337003177360179 +) +SketchLine_7 = Sketch_1.addLine( + 10.46506024096384, -1.337003177360179, 65.46746987951809, -1.337003177360179 +) +SketchLine_8 = Sketch_1.addLine( + 65.46746987951809, -1.337003177360179, 65.46746987951809, 41.25025618940838 +) +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(-54.27228915662651, 40.92621620645053, -55.24578313253012, 1.907518733308514) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_3.result()) -SketchLine_10 = Sketch_1.addLine(31.88192771084336, 41.25025618940838, 30.42168674698797, -1.337003177360179) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.startPoint(), SketchLine_5.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.result()) +SketchLine_9 = Sketch_1.addLine( + -54.27228915662651, 40.92621620645053, -55.24578313253012, 1.907518733308514 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_9.startPoint(), SketchLine_1.result() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_3.result() +) +SketchLine_10 = Sketch_1.addLine( + 31.88192771084336, 41.25025618940838, 30.42168674698797, -1.337003177360179 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_10.startPoint(), SketchLine_5.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.result() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_11 = Sketch_2.addLine(19.22650602409638, 26.41583731352732, -12.83325439216414, 26.41583731352732) -SketchLine_12 = Sketch_2.addLine(-12.83325439216414, 26.41583731352732, -12.83325439216414, 12.07337391600091) -SketchLine_13 = Sketch_2.addLine(-12.83325439216414, 12.07337391600091, 19.22650602409638, 12.07337391600091) -SketchLine_14 = Sketch_2.addLine(19.22650602409638, 12.07337391600091, 19.22650602409638, 26.41583731352732) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchLine_11 = Sketch_2.addLine( + 19.22650602409638, 26.41583731352732, -12.83325439216414, 26.41583731352732 +) +SketchLine_12 = Sketch_2.addLine( + -12.83325439216414, 26.41583731352732, -12.83325439216414, 12.07337391600091 +) +SketchLine_13 = Sketch_2.addLine( + -12.83325439216414, 12.07337391600091, 19.22650602409638, 12.07337391600091 +) +SketchLine_14 = Sketch_2.addLine( + 19.22650602409638, 12.07337391600091, 19.22650602409638, 26.41583731352732 +) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_12.result()) SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_13.result()) SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_14.result()) -SketchLine_15 = Sketch_2.addLine(0.2648302996693306, 26.41583731352732, -0.2234771832481639, 12.07337391600092) -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_15.startPoint(), SketchLine_11.result()) -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_13.result()) +SketchLine_15 = Sketch_2.addLine( + 0.2648302996693306, 26.41583731352732, -0.2234771832481639, 12.07337391600092 +) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchLine_15.startPoint(), SketchLine_11.result() +) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchLine_15.endPoint(), SketchLine_13.result() +) 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_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")]) +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_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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [0]) @@ -89,4 +181,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [1]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [8]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_CompSolid.py b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_CompSolid.py index eef944e09..6684db333 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_CompSolid.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_CompSolid.py @@ -24,47 +24,101 @@ 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(47.26932589060148, 52.61651755566245, -44.41221948537944, 52.61651755566245) -SketchLine_2 = Sketch_1.addLine(-44.41221948537944, 52.61651755566245, -44.41221948537944, -26.74931734128092) -SketchLine_3 = Sketch_1.addLine(-44.41221948537944, -26.74931734128092, 47.26932589060148, -26.74931734128092) -SketchLine_4 = Sketch_1.addLine(47.26932589060148, -26.74931734128092, 47.26932589060148, 52.61651755566245) -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()) +SketchLine_1 = Sketch_1.addLine( + 47.26932589060148, 52.61651755566245, -44.41221948537944, 52.61651755566245 +) +SketchLine_2 = Sketch_1.addLine( + -44.41221948537944, 52.61651755566245, -44.41221948537944, -26.74931734128092 +) +SketchLine_3 = Sketch_1.addLine( + -44.41221948537944, -26.74931734128092, 47.26932589060148, -26.74931734128092 +) +SketchLine_4 = Sketch_1.addLine( + 47.26932589060148, -26.74931734128092, 47.26932589060148, 52.61651755566245 +) +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(7.069530544036858, 52.61651755566245, 10.55455403994589, -26.74931734128092) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result()) +SketchLine_5 = Sketch_1.addLine( + 7.069530544036858, 52.61651755566245, 10.55455403994589, -26.74931734128092 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_1.result() +) +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(95.24043941744291, 32.97847252814945, 25.14447162912627, 32.97847252814945) -SketchLine_7 = Sketch_2.addLine(25.14447162912627, 32.97847252814945, 25.14447162912627, -11.61656767103746) -SketchLine_8 = Sketch_2.addLine(25.14447162912627, -11.61656767103746, 95.24043941744291, -11.61656767103746) -SketchLine_9 = Sketch_2.addLine(95.24043941744291, -11.61656767103746, 95.24043941744291, 32.97847252814945) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.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()) +SketchLine_6 = Sketch_2.addLine( + 95.24043941744291, 32.97847252814945, 25.14447162912627, 32.97847252814945 +) +SketchLine_7 = Sketch_2.addLine( + 25.14447162912627, 32.97847252814945, 25.14447162912627, -11.61656767103746 +) +SketchLine_8 = Sketch_2.addLine( + 25.14447162912627, -11.61656767103746, 95.24043941744291, -11.61656767103746 +) +SketchLine_9 = Sketch_2.addLine( + 95.24043941744291, -11.61656767103746, 95.24043941744291, 32.97847252814945 +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_6.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() +) SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result()) SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_9.result()) -SketchLine_10 = Sketch_2.addLine(63.78513134811883, 32.97847252814945, 65.47170548447893, -11.61656767103746) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchLine_6.result()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_8.result()) +SketchLine_10 = Sketch_2.addLine( + 63.78513134811883, 32.97847252814945, 65.47170548447893, -11.61656767103746 +) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_10.startPoint(), SketchLine_6.result() +) +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) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 5, 5) -Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_2_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10 +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 5, 5 +) +Common_1 = model.addCommon( + Part_1_doc, + [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPSOLID", "Extrusion_2_1"), + ], +) model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [1]) @@ -73,4 +127,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [6]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [48]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_Face.py b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_Face.py index 29f2f04b4..c7ef88985 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_Face.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_Face.py @@ -24,44 +24,98 @@ 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(21.16527496861552, 26.63979884904572, -22.80735826270614, 26.63979884904572) -SketchLine_2 = Sketch_1.addLine(-22.80735826270614, 26.63979884904572, -22.80735826270614, -13.87637783487681) -SketchLine_3 = Sketch_1.addLine(-22.80735826270614, -13.87637783487681, 21.16527496861552, -13.87637783487681) -SketchLine_4 = Sketch_1.addLine(21.16527496861552, -13.87637783487681, 21.16527496861552, 26.63979884904572) -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()) +SketchLine_1 = Sketch_1.addLine( + 21.16527496861552, 26.63979884904572, -22.80735826270614, 26.63979884904572 +) +SketchLine_2 = Sketch_1.addLine( + -22.80735826270614, 26.63979884904572, -22.80735826270614, -13.87637783487681 +) +SketchLine_3 = Sketch_1.addLine( + -22.80735826270614, -13.87637783487681, 21.16527496861552, -13.87637783487681 +) +SketchLine_4 = Sketch_1.addLine( + 21.16527496861552, -13.87637783487681, 21.16527496861552, 26.63979884904572 +) +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(-2.257333687264361, 26.63979884904572, -2.257333687264361, -13.87637783487681) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result()) +SketchLine_5 = Sketch_1.addLine( + -2.257333687264361, 26.63979884904572, -2.257333687264361, -13.87637783487681 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_1.result() +) +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(29.6987556208597, 11.4175813298688, 13.10955704685832, 11.4175813298688) -SketchLine_7 = Sketch_2.addLine(13.10955704685832, 11.4175813298688, 13.10955704685832, -4.852594194632538) -SketchLine_8 = Sketch_2.addLine(13.10955704685832, -4.852594194632538, 29.6987556208597, -4.852594194632538) -SketchLine_9 = Sketch_2.addLine(29.6987556208597, -4.852594194632538, 29.6987556208597, 11.4175813298688) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.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()) +SketchLine_6 = Sketch_2.addLine( + 29.6987556208597, 11.4175813298688, 13.10955704685832, 11.4175813298688 +) +SketchLine_7 = Sketch_2.addLine( + 13.10955704685832, 11.4175813298688, 13.10955704685832, -4.852594194632538 +) +SketchLine_8 = Sketch_2.addLine( + 13.10955704685832, -4.852594194632538, 29.6987556208597, -4.852594194632538 +) +SketchLine_9 = Sketch_2.addLine( + 29.6987556208597, -4.852594194632538, 29.6987556208597, 11.4175813298688 +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_6.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() +) SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result()) 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() -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_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")]) +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_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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [0]) @@ -70,4 +124,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [1]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [8]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_Shell.py b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_Shell.py index 277d785fa..71777cad0 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_Shell.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_Shell.py @@ -24,47 +24,111 @@ 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.15938358623833, 14.4352070421809, -11.43137169301882, 14.4352070421809) -SketchLine_2 = Sketch_1.addLine(-11.43137169301882, 14.4352070421809, -11.43137169301882, -6.935604568322221) -SketchLine_3 = Sketch_1.addLine(-11.43137169301882, -6.935604568322221, 15.15938358623833, -6.935604568322221) -SketchLine_4 = Sketch_1.addLine(15.15938358623833, -6.935604568322221, 15.15938358623833, 14.4352070421809) -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()) +SketchLine_1 = Sketch_1.addLine( + 15.15938358623833, 14.4352070421809, -11.43137169301882, 14.4352070421809 +) +SketchLine_2 = Sketch_1.addLine( + -11.43137169301882, 14.4352070421809, -11.43137169301882, -6.935604568322221 +) +SketchLine_3 = Sketch_1.addLine( + -11.43137169301882, -6.935604568322221, 15.15938358623833, -6.935604568322221 +) +SketchLine_4 = Sketch_1.addLine( + 15.15938358623833, -6.935604568322221, 15.15938358623833, 14.4352070421809 +) +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(1.934351860046943, 14.4352070421809, 2.075043686921314, -6.935604568322221) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result()) +SketchLine_5 = Sketch_1.addLine( + 1.934351860046943, 14.4352070421809, 2.075043686921314, -6.935604568322221 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_1.result() +) +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.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()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +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() +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result()) SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_9.result()) -SketchLine_10 = Sketch_2.addLine(18.73204224198193, 6.827405438264643, 19.20309616379092, -3.640935176083419) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchLine_6.result()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_8.result()) +SketchLine_10 = Sketch_2.addLine( + 18.73204224198193, 6.827405438264643, 19.20309616379092, -3.640935176083419 +) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_10.startPoint(), SketchLine_6.result() +) +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_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")]) +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_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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [0]) @@ -73,4 +137,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [1]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [8]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_EdgeCompound_EdgeCompound.py b/src/FeaturesPlugin/Test/TestBooleanCommon_EdgeCompound_EdgeCompound.py index 23914e536..0fc509eeb 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_EdgeCompound_EdgeCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_EdgeCompound_EdgeCompound.py @@ -24,25 +24,65 @@ 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(-77.19749092035903, 24.18794374198263, -26.50243221408208, 23.76942369170098) -SketchLine_2 = Sketch_1.addLine(-52.21940522238806, 23.98173370989996, -68.62380444441784, 24.11716249058297) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result()) -SketchLine_3 = Sketch_1.addLine(9.658082674231901, 24.38959180621407, 76.00931510902234, 24.79203653255435) -SketchLine_4 = Sketch_1.addLine(31.27467463593981, 24.52070441885453, 55.13167389667986, 24.6654059290823) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_3.result()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_3.result()) +SketchLine_1 = Sketch_1.addLine( + -77.19749092035903, 24.18794374198263, -26.50243221408208, 23.76942369170098 +) +SketchLine_2 = Sketch_1.addLine( + -52.21940522238806, 23.98173370989996, -68.62380444441784, 24.11716249058297 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_1.result() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_1.result() +) +SketchLine_3 = Sketch_1.addLine( + 9.658082674231901, 24.38959180621407, 76.00931510902234, 24.79203653255435 +) +SketchLine_4 = Sketch_1.addLine( + 31.27467463593981, 24.52070441885453, 55.13167389667986, 24.6654059290823 +) +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/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")]) +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"), + ], +) model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [2]) @@ -51,4 +91,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [2]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [4]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Edge_Edge.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Edge_Edge.py index 1fdeeb276..20e32ba9a 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_Edge_Edge.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Edge_Edge.py @@ -24,18 +24,35 @@ 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(-57.23353499871462, -2.917111725546991, 40.54932729918568, 17.67239476025231) -SketchLine_2 = Sketch_1.addLine(-81.47249047471176, -8.020952206935315, 40.54932729918568, 17.67239476025231) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.endPoint()) +SketchLine_1 = Sketch_1.addLine( + -57.23353499871462, -2.917111725546991, 40.54932729918568, 17.67239476025231 +) +SketchLine_2 = Sketch_1.addLine( + -81.47249047471176, -8.020952206935315, 40.54932729918568, 17.67239476025231 +) +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/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")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [0]) @@ -44,4 +61,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [1]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [2]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_ErrorMsg.py b/src/FeaturesPlugin/Test/TestBooleanCommon_ErrorMsg.py index a37fc04b6..d6864a4a6 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_ErrorMsg.py @@ -26,22 +26,23 @@ 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() != "") +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() != "") +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() != "") +assert Common_1.error() != "" aSession.finishOperation() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_FaceCompound_FaceCompound.py b/src/FeaturesPlugin/Test/TestBooleanCommon_FaceCompound_FaceCompound.py index d72d15880..0f0f83553 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_FaceCompound_FaceCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_FaceCompound_FaceCompound.py @@ -24,67 +24,167 @@ 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(-26.91983967935873, 43.92184368737476, -89.26052104208418, 43.92184368737476) -SketchLine_2 = Sketch_1.addLine(-89.26052104208418, 43.92184368737476, -89.26052104208418, 10.32264529058116) -SketchLine_3 = Sketch_1.addLine(-89.26052104208418, 10.32264529058116, -26.91983967935873, 10.32264529058116) -SketchLine_4 = Sketch_1.addLine(-26.91983967935873, 10.32264529058116, -26.91983967935873, 43.92184368737476) -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()) +SketchLine_1 = Sketch_1.addLine( + -26.91983967935873, 43.92184368737476, -89.26052104208418, 43.92184368737476 +) +SketchLine_2 = Sketch_1.addLine( + -89.26052104208418, 43.92184368737476, -89.26052104208418, 10.32264529058116 +) +SketchLine_3 = Sketch_1.addLine( + -89.26052104208418, 10.32264529058116, -26.91983967935873, 10.32264529058116 +) +SketchLine_4 = Sketch_1.addLine( + -26.91983967935873, 10.32264529058116, -26.91983967935873, 43.92184368737476 +) +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(92.09418837675352, 44.32665330661324, 12.75150300601203, 44.32665330661324) -SketchLine_6 = Sketch_1.addLine(12.75150300601203, 44.32665330661324, 12.75150300601203, 10.32264529058116) -SketchLine_7 = Sketch_1.addLine(12.75150300601203, 10.32264529058116, 92.09418837675352, 10.32264529058116) -SketchLine_8 = Sketch_1.addLine(92.09418837675352, 10.32264529058116, 92.09418837675352, 44.32665330661324) -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()) +SketchLine_5 = Sketch_1.addLine( + 92.09418837675352, 44.32665330661324, 12.75150300601203, 44.32665330661324 +) +SketchLine_6 = Sketch_1.addLine( + 12.75150300601203, 44.32665330661324, 12.75150300601203, 10.32264529058116 +) +SketchLine_7 = Sketch_1.addLine( + 12.75150300601203, 10.32264529058116, 92.09418837675352, 10.32264529058116 +) +SketchLine_8 = Sketch_1.addLine( + 92.09418837675352, 10.32264529058116, 92.09418837675352, 44.32665330661324 +) +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()) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_9 = Sketch_2.addLine(-44.32665330661324, 21.65731462925853, -65.78156312625251, 21.65731462925853) -SketchLine_10 = Sketch_2.addLine(-65.78156312625251, 21.65731462925853, -65.78156312625251, -10.72745490981964) -SketchLine_11 = Sketch_2.addLine(-65.78156312625251, -10.72745490981964, -44.32665330661324, -10.72745490981964) -SketchLine_12 = Sketch_2.addLine(-44.32665330661324, -10.72745490981964, -44.32665330661324, 21.65731462925853) -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()) +SketchLine_9 = Sketch_2.addLine( + -44.32665330661324, 21.65731462925853, -65.78156312625251, 21.65731462925853 +) +SketchLine_10 = Sketch_2.addLine( + -65.78156312625251, 21.65731462925853, -65.78156312625251, -10.72745490981964 +) +SketchLine_11 = Sketch_2.addLine( + -65.78156312625251, -10.72745490981964, -44.32665330661324, -10.72745490981964 +) +SketchLine_12 = Sketch_2.addLine( + -44.32665330661324, -10.72745490981964, -44.32665330661324, 21.65731462925853 +) +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_5 = Sketch_2.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_10.result()) SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_12.result()) -SketchLine_13 = Sketch_2.addLine(64.56713426853709, 24.08617234468937, 42.70741482965934, 24.08617234468937) -SketchLine_14 = Sketch_2.addLine(42.70741482965934, 24.08617234468937, 42.70741482965934, -10.32264529058116) -SketchLine_15 = Sketch_2.addLine(42.70741482965934, -10.32264529058116, 64.56713426853709, -10.32264529058116) -SketchLine_16 = Sketch_2.addLine(64.56713426853709, -10.32264529058116, 64.56713426853709, 24.08617234468937) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) +SketchLine_13 = Sketch_2.addLine( + 64.56713426853709, 24.08617234468937, 42.70741482965934, 24.08617234468937 +) +SketchLine_14 = Sketch_2.addLine( + 42.70741482965934, 24.08617234468937, 42.70741482965934, -10.32264529058116 +) +SketchLine_15 = Sketch_2.addLine( + 42.70741482965934, -10.32264529058116, 64.56713426853709, -10.32264529058116 +) +SketchLine_16 = Sketch_2.addLine( + 64.56713426853709, -10.32264529058116, 64.56713426853709, 24.08617234468937 +) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) SketchConstraintHorizontal_7 = Sketch_2.setHorizontal(SketchLine_13.result()) 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_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")]) +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"), + ], +) model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [2]) @@ -93,4 +193,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [2]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [8]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [16]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Face_Face.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Face_Face.py index d42b8be34..d2e8f9404 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_Face_Face.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Face_Face.py @@ -24,40 +24,87 @@ 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(24.08617234468939, 57.68537074148297, -74.28256513026052, 57.68537074148297) -SketchLine_2 = Sketch_1.addLine(-74.28256513026052, 57.68537074148297, -74.28256513026052, 13.96593186372746) -SketchLine_3 = Sketch_1.addLine(-74.28256513026052, 13.96593186372746, 24.08617234468939, 13.96593186372746) -SketchLine_4 = Sketch_1.addLine(24.08617234468939, 13.96593186372746, 24.08617234468939, 57.68537074148297) -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()) +SketchLine_1 = Sketch_1.addLine( + 24.08617234468939, 57.68537074148297, -74.28256513026052, 57.68537074148297 +) +SketchLine_2 = Sketch_1.addLine( + -74.28256513026052, 57.68537074148297, -74.28256513026052, 13.96593186372746 +) +SketchLine_3 = Sketch_1.addLine( + -74.28256513026052, 13.96593186372746, 24.08617234468939, 13.96593186372746 +) +SketchLine_4 = Sketch_1.addLine( + 24.08617234468939, 13.96593186372746, 24.08617234468939, 57.68537074148297 +) +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() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_5 = Sketch_2.addLine(-6.679358717434877, 28.9438877755511, -34.20641282565131, 28.9438877755511) -SketchLine_6 = Sketch_2.addLine(-34.20641282565131, 28.9438877755511, -34.20641282565131, -14.37074148296594) -SketchLine_7 = Sketch_2.addLine(-34.20641282565131, -14.37074148296594, -6.679358717434877, -14.37074148296594) -SketchLine_8 = Sketch_2.addLine(-6.679358717434877, -14.37074148296594, -6.679358717434877, 28.9438877755511) -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()) +SketchLine_5 = Sketch_2.addLine( + -6.679358717434877, 28.9438877755511, -34.20641282565131, 28.9438877755511 +) +SketchLine_6 = Sketch_2.addLine( + -34.20641282565131, 28.9438877755511, -34.20641282565131, -14.37074148296594 +) +SketchLine_7 = Sketch_2.addLine( + -34.20641282565131, -14.37074148296594, -6.679358717434877, -14.37074148296594 +) +SketchLine_8 = Sketch_2.addLine( + -6.679358717434877, -14.37074148296594, -6.679358717434877, 28.9438877755511 +) +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()) model.do() -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")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [0]) @@ -66,4 +113,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [1]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [8]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Face_Plane.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Face_Plane.py index a2850f33b..2786bf803 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_Face_Plane.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Face_Plane.py @@ -24,27 +24,55 @@ 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()) +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")]) +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")]) +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 +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 0) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Fuzzy.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Fuzzy.py index d353ec818..60c012de9 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_Fuzzy.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Fuzzy.py @@ -25,7 +25,7 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Param_fuzzy = model.addParameter(Part_1_doc, "fuzzy", '1e-06') +Param_fuzzy = model.addParameter(Part_1_doc, "fuzzy", "1e-06") ### Create Sphere Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 5) @@ -37,7 +37,12 @@ Point_2 = model.addPoint(Part_1_doc, 9.999995, 0, 0) Sphere_2 = model.addSphere(Part_1_doc, model.selection("VERTEX", "Point_1"), 5) ### Create Common -Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Sphere_2_1"), model.selection("SOLID", "Sphere_1_1")], fuzzyParam = "fuzzy", keepSubResults = True) +Common_1 = model.addCommon( + Part_1_doc, + [model.selection("SOLID", "Sphere_2_1"), model.selection("SOLID", "Sphere_1_1")], + fuzzyParam="fuzzy", + keepSubResults=True, +) model.do() model.testNbResults(Common_1, 1) @@ -48,7 +53,7 @@ model.testNbUniqueSubShapes(Common_1, GeomAPI_Shape.EDGE, [3]) model.testNbUniqueSubShapes(Common_1, GeomAPI_Shape.VERTEX, [2]) ### Set a higher fuzzy value -Param_fuzzy.setValue(1.e-5) +Param_fuzzy.setValue(1.0e-5) model.do() model.end() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_MultiLevelCompound_v0_1.py b/src/FeaturesPlugin/Test/TestBooleanCommon_MultiLevelCompound_v0_1.py index e66f2e8f8..8a3e50bd9 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_MultiLevelCompound_v0_1.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_MultiLevelCompound_v0_1.py @@ -25,9 +25,27 @@ 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"), 10, 20) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 40, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 20, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 40, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) LinearCopy_2.result().subResult(0).subResult(0).setColor(255, 170, 0) LinearCopy_2.result().subResult(0).subResult(1).setColor(255, 170, 0) LinearCopy_2.result().subResult(1).subResult(0).setColor(0, 0, 255) @@ -37,47 +55,119 @@ SketchLine_1 = Sketch_1.addLine(7, 0, -7, 0) SketchLine_2 = Sketch_1.addLine(-7, 0, -7, 5) SketchLine_3 = Sketch_1.addLine(-7, 5, 7, 5) SketchLine_4 = Sketch_1.addLine(7, 5, 7, 0) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_5 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_5.result(), 7, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_5.result(), 7, True +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 14) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 5) SketchLine_6 = Sketch_1.addLine(5, 12, -5, 12) SketchLine_7 = Sketch_1.addLine(-5, 12, -5, 15) SketchLine_8 = Sketch_1.addLine(-5, 15, 5, 15) SketchLine_9 = Sketch_1.addLine(5, 15, 5, 12) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_9.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()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_9.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() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 3) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 10) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_5.result(), 5, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_3.result(), 7, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_5.result(), 5, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchLine_3.result(), 7, True +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 60, 20) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r")], model.selection(), 55, 15) -LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 60, + 20, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r", + ) + ], + model.selection(), + 55, + 15, +) +LinearCopy_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "LinearCopy_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_1.result().subResult(0).subResult(0).setColor(0, 170, 0) Compound_1.result().subResult(0).subResult(1).setColor(0, 170, 0) Compound_1.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_1.result().subResult(1).subResult(1).setColor(0, 255, 0) -Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "LinearCopy_2_1_1_1"), model.selection("COMPOUND", "Compound_1_1_2")]) +Common_1 = model.addCommon( + Part_1_doc, + [ + model.selection("SOLID", "LinearCopy_2_1_1_1"), + model.selection("COMPOUND", "Compound_1_1_2"), + ], +) model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) @@ -93,4 +183,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [54]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [108]) model.testResultsVolumes(Common_1, [1147.933772988635155343217775226]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_MultiLevelCompound_v0_2.py b/src/FeaturesPlugin/Test/TestBooleanCommon_MultiLevelCompound_v0_2.py index 4c283dc88..d7a148b34 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_MultiLevelCompound_v0_2.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_MultiLevelCompound_v0_2.py @@ -26,32 +26,70 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 10) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) SketchCircle_2 = Sketch_1.addCircle(10, 0, 10) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_2.center() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0 +) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchCircle_3 = Sketch_2.addCircle(0, -7, 10) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.result(), SketchCircle_3.center()) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.result(), SketchCircle_3.center() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_3.results()[1], 10) -SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance(SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7) +SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance( + SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7 +) SketchCircle_4 = Sketch_2.addCircle(40, -27, 10) -SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_4.results()[1], SketchCircle_3.results()[1]) -SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance(SketchCircle_3.center(), SketchCircle_4.center(), 40) -SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchCircle_4.center(), SketchCircle_3.center(), 20) +SketchConstraintEqual_2 = Sketch_2.setEqual( + SketchCircle_4.results()[1], SketchCircle_3.results()[1] +) +SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance( + SketchCircle_3.center(), SketchCircle_4.center(), 40 +) +SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance( + SketchCircle_4.center(), SketchCircle_3.center(), 20 +) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")]) -Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPSOLID", "Extrusion_1_1")]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "Extrusion_2_2"), + ], +) +Compound_2 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "Compound_1_1"), + model.selection("COMPSOLID", "Extrusion_1_1"), + ], +) Compound_2.result().subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(1).setColor(255, 170, 0) @@ -64,45 +102,114 @@ SketchLine_3 = Sketch_3.addLine(7, 0, -7, 0) SketchLine_4 = Sketch_3.addLine(-7, 0, -7, 5) SketchLine_5 = Sketch_3.addLine(-7, 5, 7, 5) SketchLine_6 = Sketch_3.addLine(7, 5, 7, 0) -SketchConstraintCoincidence_4 = Sketch_3.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_4 = Sketch_3.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_3.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_3.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_3.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_3.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_3.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_6.result()) -SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_3 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_7 = SketchProjection_3.createdFeature() -SketchConstraintDistance_1 = Sketch_3.setDistance(SketchLine_5.endPoint(), SketchLine_7.result(), 7, True) -SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result()) +SketchConstraintDistance_1 = Sketch_3.setDistance( + SketchLine_5.endPoint(), SketchLine_7.result(), 7, True +) +SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint( + SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result() +) SketchConstraintLength_1 = Sketch_3.setLength(SketchLine_4.result(), 5) SketchLine_8 = Sketch_3.addLine(7, 7, -7.000000000000001, 7) SketchLine_9 = Sketch_3.addLine(-7.000000000000001, 7, -7.000000000000001, 10) SketchLine_10 = Sketch_3.addLine(-7.000000000000001, 10, 7, 10) SketchLine_11 = Sketch_3.addLine(7, 10, 7, 7) -SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_8 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_3.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_3.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_3.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_9.result()) SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_10.result()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_11.result()) -SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_9.startPoint(), SketchLine_4.result()) -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_8.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_12 = Sketch_3.setCoincident( + SketchLine_9.startPoint(), SketchLine_4.result() +) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_8.startPoint(), SketchLine_6.result() +) SketchConstraintLength_2 = Sketch_3.setLength(SketchLine_9.result(), 3) -SketchConstraintDistance_2 = Sketch_3.setDistance(SketchLine_9.startPoint(), SketchLine_5.result(), 2, True) +SketchConstraintDistance_2 = Sketch_3.setDistance( + SketchLine_9.startPoint(), SketchLine_5.result(), 2, True +) model.do() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")], model.selection(), 50, -10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r")], model.selection(), 60, 20) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_4_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_3 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], + model.selection(), + 50, + -10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r", + ) + ], + model.selection(), + 60, + 20, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_4_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_3 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_3.result().subResult(0).setColor(0, 170, 0) Compound_3.result().subResult(1).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(1).setColor(0, 255, 0) -Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_1"), model.selection("SOLID", "Compound_2_1_2_3")], [model.selection("COMPOUND", "Compound_3_1_2")]) +Common_1 = model.addCommon( + Part_1_doc, + [ + model.selection("SOLID", "Compound_2_1_1_1"), + model.selection("SOLID", "Compound_2_1_2_3"), + ], + [model.selection("COMPOUND", "Compound_3_1_2")], +) model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) @@ -118,4 +225,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [30, 74]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [60, 148]) model.testResultsVolumes(Common_1, [7048.363799144838594, 6703.185306801399747]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_MultiLevelCompound_v20190506_1.py b/src/FeaturesPlugin/Test/TestBooleanCommon_MultiLevelCompound_v20190506_1.py index c3d574717..214118a65 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_MultiLevelCompound_v20190506_1.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_MultiLevelCompound_v20190506_1.py @@ -25,9 +25,27 @@ 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"), 10, 20) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 40, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 20, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 40, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) LinearCopy_2.result().subResult(0).subResult(0).setColor(255, 170, 0) LinearCopy_2.result().subResult(0).subResult(1).setColor(255, 170, 0) LinearCopy_2.result().subResult(1).subResult(0).setColor(0, 0, 255) @@ -37,47 +55,120 @@ SketchLine_1 = Sketch_1.addLine(7, 0, -7, 0) SketchLine_2 = Sketch_1.addLine(-7, 0, -7, 5) SketchLine_3 = Sketch_1.addLine(-7, 5, 7, 5) SketchLine_4 = Sketch_1.addLine(7, 5, 7, 0) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_5 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_5.result(), 7, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_5.result(), 7, True +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 14) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 5) SketchLine_6 = Sketch_1.addLine(5, 12, -5, 12) SketchLine_7 = Sketch_1.addLine(-5, 12, -5, 15) SketchLine_8 = Sketch_1.addLine(-5, 15, 5, 15) SketchLine_9 = Sketch_1.addLine(5, 15, 5, 12) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_9.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()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_9.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() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 3) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 10) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_5.result(), 5, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_3.result(), 7, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_5.result(), 5, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchLine_3.result(), 7, True +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 60, 20) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r")], model.selection(), 55, 15) -LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 60, + 20, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r", + ) + ], + model.selection(), + 55, + 15, +) +LinearCopy_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "LinearCopy_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_1.result().subResult(0).subResult(0).setColor(0, 170, 0) Compound_1.result().subResult(0).subResult(1).setColor(0, 170, 0) Compound_1.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_1.result().subResult(1).subResult(1).setColor(0, 255, 0) -Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "LinearCopy_2_1_1_1"), model.selection("COMPOUND", "Compound_1_1_2")], keepSubResults = True) +Common_1 = model.addCommon( + Part_1_doc, + [ + model.selection("SOLID", "LinearCopy_2_1_1_1"), + model.selection("COMPOUND", "Compound_1_1_2"), + ], + keepSubResults=True, +) model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) @@ -93,4 +184,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [120]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [240]) model.testResultsVolumes(Common_1, [31197.48969452739765984]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_MultiLevelCompound_v20190506_2.py b/src/FeaturesPlugin/Test/TestBooleanCommon_MultiLevelCompound_v20190506_2.py index 2ac2d126f..6cfa2563d 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_MultiLevelCompound_v20190506_2.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_MultiLevelCompound_v20190506_2.py @@ -26,32 +26,70 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 10) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) SketchCircle_2 = Sketch_1.addCircle(10, 0, 10) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_2.center() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0 +) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchCircle_3 = Sketch_2.addCircle(0, -7, 10) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.result(), SketchCircle_3.center()) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.result(), SketchCircle_3.center() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_3.results()[1], 10) -SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance(SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7) +SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance( + SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7 +) SketchCircle_4 = Sketch_2.addCircle(40, -27, 10) -SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_4.results()[1], SketchCircle_3.results()[1]) -SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance(SketchCircle_3.center(), SketchCircle_4.center(), 40) -SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchCircle_4.center(), SketchCircle_3.center(), 20) +SketchConstraintEqual_2 = Sketch_2.setEqual( + SketchCircle_4.results()[1], SketchCircle_3.results()[1] +) +SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance( + SketchCircle_3.center(), SketchCircle_4.center(), 40 +) +SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance( + SketchCircle_4.center(), SketchCircle_3.center(), 20 +) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")]) -Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPSOLID", "Extrusion_1_1")]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "Extrusion_2_2"), + ], +) +Compound_2 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "Compound_1_1"), + model.selection("COMPSOLID", "Extrusion_1_1"), + ], +) Compound_2.result().subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(1).setColor(255, 170, 0) @@ -64,45 +102,115 @@ SketchLine_3 = Sketch_3.addLine(7, 0, -7, 0) SketchLine_4 = Sketch_3.addLine(-7, 0, -7, 5) SketchLine_5 = Sketch_3.addLine(-7, 5, 7, 5) SketchLine_6 = Sketch_3.addLine(7, 5, 7, 0) -SketchConstraintCoincidence_4 = Sketch_3.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_4 = Sketch_3.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_3.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_3.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_3.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_3.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_3.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_6.result()) -SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_3 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_7 = SketchProjection_3.createdFeature() -SketchConstraintDistance_1 = Sketch_3.setDistance(SketchLine_5.endPoint(), SketchLine_7.result(), 7, True) -SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result()) +SketchConstraintDistance_1 = Sketch_3.setDistance( + SketchLine_5.endPoint(), SketchLine_7.result(), 7, True +) +SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint( + SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result() +) SketchConstraintLength_1 = Sketch_3.setLength(SketchLine_4.result(), 5) SketchLine_8 = Sketch_3.addLine(7, 7, -7.000000000000001, 7) SketchLine_9 = Sketch_3.addLine(-7.000000000000001, 7, -7.000000000000001, 10) SketchLine_10 = Sketch_3.addLine(-7.000000000000001, 10, 7, 10) SketchLine_11 = Sketch_3.addLine(7, 10, 7, 7) -SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_8 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_3.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_3.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_3.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_9.result()) SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_10.result()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_11.result()) -SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_9.startPoint(), SketchLine_4.result()) -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_8.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_12 = Sketch_3.setCoincident( + SketchLine_9.startPoint(), SketchLine_4.result() +) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_8.startPoint(), SketchLine_6.result() +) SketchConstraintLength_2 = Sketch_3.setLength(SketchLine_9.result(), 3) -SketchConstraintDistance_2 = Sketch_3.setDistance(SketchLine_9.startPoint(), SketchLine_5.result(), 2, True) +SketchConstraintDistance_2 = Sketch_3.setDistance( + SketchLine_9.startPoint(), SketchLine_5.result(), 2, True +) model.do() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")], model.selection(), 50, -10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r")], model.selection(), 60, 20) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_4_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_3 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], + model.selection(), + 50, + -10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r", + ) + ], + model.selection(), + 60, + 20, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_4_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_3 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_3.result().subResult(0).setColor(0, 170, 0) Compound_3.result().subResult(1).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(1).setColor(0, 255, 0) -Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_1"), model.selection("SOLID", "Compound_2_1_2_3")], [model.selection("COMPOUND", "Compound_3_1_2")], keepSubResults = True) +Common_1 = model.addCommon( + Part_1_doc, + [ + model.selection("SOLID", "Compound_2_1_1_1"), + model.selection("SOLID", "Compound_2_1_2_3"), + ], + [model.selection("COMPOUND", "Compound_3_1_2")], + keepSubResults=True, +) model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) @@ -118,4 +226,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [128]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [256]) model.testResultsVolumes(Common_1, [16551.5491059462365]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_ShellCompound_ShellCompound.py b/src/FeaturesPlugin/Test/TestBooleanCommon_ShellCompound_ShellCompound.py index 737995026..5e3b0a75a 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_ShellCompound_ShellCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_ShellCompound_ShellCompound.py @@ -24,81 +24,209 @@ 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(-11.4055110220441, 59.07236770836705, -90.54579158316633, 59.07236770836705) -SketchLine_2 = Sketch_1.addLine(-90.54579158316633, 59.07236770836705, -90.54579158316633, 18.29259905792451) -SketchLine_3 = Sketch_1.addLine(-90.54579158316633, 18.29259905792451, -11.4055110220441, 18.29259905792451) -SketchLine_4 = Sketch_1.addLine(-11.4055110220441, 18.29259905792451, -11.4055110220441, 59.07236770836705) -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()) +SketchLine_1 = Sketch_1.addLine( + -11.4055110220441, 59.07236770836705, -90.54579158316633, 59.07236770836705 +) +SketchLine_2 = Sketch_1.addLine( + -90.54579158316633, 59.07236770836705, -90.54579158316633, 18.29259905792451 +) +SketchLine_3 = Sketch_1.addLine( + -90.54579158316633, 18.29259905792451, -11.4055110220441, 18.29259905792451 +) +SketchLine_4 = Sketch_1.addLine( + -11.4055110220441, 18.29259905792451, -11.4055110220441, 59.07236770836705 +) +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(116.15, 58.70699100906781, 29.5612224448898, 58.70699100906781) -SketchLine_6 = Sketch_1.addLine(29.5612224448898, 58.70699100906781, 29.5612224448898, 16.80919541788544) -SketchLine_7 = Sketch_1.addLine(29.5612224448898, 16.80919541788544, 116.15, 16.80919541788544) +SketchLine_5 = Sketch_1.addLine( + 116.15, 58.70699100906781, 29.5612224448898, 58.70699100906781 +) +SketchLine_6 = Sketch_1.addLine( + 29.5612224448898, 58.70699100906781, 29.5612224448898, 16.80919541788544 +) +SketchLine_7 = Sketch_1.addLine( + 29.5612224448898, 16.80919541788544, 116.15, 16.80919541788544 +) SketchLine_8 = Sketch_1.addLine(116.15, 16.80919541788544, 116.15, 58.70699100906781) -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()) +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(-51.44118236472945, 59.07236770836705, -50.51012024048097, 18.29259905792451) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_3.result()) -SketchLine_10 = Sketch_1.addLine(72.85561122244489, 16.80919541788544, 73.32114228456915, 58.70699100906781) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.startPoint(), SketchLine_7.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_5.result()) +SketchLine_9 = Sketch_1.addLine( + -51.44118236472945, 59.07236770836705, -50.51012024048097, 18.29259905792451 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_9.startPoint(), SketchLine_1.result() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_3.result() +) +SketchLine_10 = Sketch_1.addLine( + 72.85561122244489, 16.80919541788544, 73.32114228456915, 58.70699100906781 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_10.startPoint(), SketchLine_7.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_5.result() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_11 = Sketch_2.addLine(-33.65512410802471, 32.35440881763527, -66.62101906518004, 32.35440881763527) -SketchLine_12 = Sketch_2.addLine(-66.62101906518004, 32.35440881763527, -66.62101906518004, -10.93997995991984) -SketchLine_13 = Sketch_2.addLine(-66.62101906518004, -10.93997995991984, -33.65512410802471, -10.93997995991984) -SketchLine_14 = Sketch_2.addLine(-33.65512410802471, -10.93997995991984, -33.65512410802471, 32.35440881763527) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchLine_11 = Sketch_2.addLine( + -33.65512410802471, 32.35440881763527, -66.62101906518004, 32.35440881763527 +) +SketchLine_12 = Sketch_2.addLine( + -66.62101906518004, 32.35440881763527, -66.62101906518004, -10.93997995991984 +) +SketchLine_13 = Sketch_2.addLine( + -66.62101906518004, -10.93997995991984, -33.65512410802471, -10.93997995991984 +) +SketchLine_14 = Sketch_2.addLine( + -33.65512410802471, -10.93997995991984, -33.65512410802471, 32.35440881763527 +) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_12.result()) SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_13.result()) SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_14.result()) -SketchLine_15 = Sketch_2.addLine(-66.62101906518004, 10.47444889779559, -33.6551241080247, 9.543386773547091) -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_15.startPoint(), SketchLine_12.result()) -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_14.result()) -SketchLine_16 = Sketch_2.addLine(86.07316931157348, 30.95781563126252, 62.43123950606181, 30.95781563126252) -SketchLine_17 = Sketch_2.addLine(62.43123950606181, 30.95781563126252, 62.43123950606181, -14.66422845691383) -SketchLine_18 = Sketch_2.addLine(62.43123950606181, -14.66422845691383, 86.07316931157348, -14.66422845691383) -SketchLine_19 = Sketch_2.addLine(86.07316931157348, -14.66422845691383, 86.07316931157348, 30.95781563126252) -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) +SketchLine_15 = Sketch_2.addLine( + -66.62101906518004, 10.47444889779559, -33.6551241080247, 9.543386773547091 +) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchLine_15.startPoint(), SketchLine_12.result() +) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchLine_15.endPoint(), SketchLine_14.result() +) +SketchLine_16 = Sketch_2.addLine( + 86.07316931157348, 30.95781563126252, 62.43123950606181, 30.95781563126252 +) +SketchLine_17 = Sketch_2.addLine( + 62.43123950606181, 30.95781563126252, 62.43123950606181, -14.66422845691383 +) +SketchLine_18 = Sketch_2.addLine( + 62.43123950606181, -14.66422845691383, 86.07316931157348, -14.66422845691383 +) +SketchLine_19 = Sketch_2.addLine( + 86.07316931157348, -14.66422845691383, 86.07316931157348, 30.95781563126252 +) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_19.endPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) SketchConstraintHorizontal_7 = Sketch_2.setHorizontal(SketchLine_16.result()) SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_17.result()) SketchConstraintHorizontal_8 = Sketch_2.setHorizontal(SketchLine_18.result()) SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_19.result()) -SketchLine_20 = Sketch_2.addLine(62.43123950606181, 3.491482965931855, 86.07316931157347, 4.888076152304602) -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_20.startPoint(), SketchLine_17.result()) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_19.result()) +SketchLine_20 = Sketch_2.addLine( + 62.43123950606181, 3.491482965931855, 86.07316931157347, 4.888076152304602 +) +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_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_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_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_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")]) -Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")]) +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")], +) +Common_1 = model.addCommon( + Part_1_doc, + [ + model.selection("COMPOUND", "Compound_1_1"), + model.selection("COMPOUND", "Compound_2_1"), + ], +) model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [2]) @@ -107,4 +235,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [4]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [16]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [32]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Shell_Shell.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Shell_Shell.py index 6c1bbf3fb..186299825 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_Shell_Shell.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Shell_Shell.py @@ -24,47 +24,118 @@ 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(-8.703406813627256, 48.70884844011781, -89.26052104208418, 48.70884844011781) -SketchLine_2 = Sketch_1.addLine(-89.26052104208418, 48.70884844011781, -89.26052104208418, 1.699676379809279) -SketchLine_3 = Sketch_1.addLine(-89.26052104208418, 1.699676379809279, -8.703406813627256, 1.699676379809279) -SketchLine_4 = Sketch_1.addLine(-8.703406813627256, 1.699676379809279, -8.703406813627256, 48.70884844011781) -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()) +SketchLine_1 = Sketch_1.addLine( + -8.703406813627256, 48.70884844011781, -89.26052104208418, 48.70884844011781 +) +SketchLine_2 = Sketch_1.addLine( + -89.26052104208418, 48.70884844011781, -89.26052104208418, 1.699676379809279 +) +SketchLine_3 = Sketch_1.addLine( + -89.26052104208418, 1.699676379809279, -8.703406813627256, 1.699676379809279 +) +SketchLine_4 = Sketch_1.addLine( + -8.703406813627256, 1.699676379809279, -8.703406813627256, 48.70884844011781 +) +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(-50.39879759519037, 48.70884844011781, -49.99398797595192, 1.699676379809278) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result()) +SketchLine_5 = Sketch_1.addLine( + -50.39879759519037, 48.70884844011781, -49.99398797595192, 1.699676379809278 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_1.result() +) +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(-27.69909819639279, -33.75100200400802, -61.96570844393754, -33.75100200400802) -SketchLine_7 = Sketch_2.addLine(-61.96570844393754, -33.75100200400802, -61.96570844393754, 19.31953907815632) -SketchLine_8 = Sketch_2.addLine(-61.96570844393754, 19.31953907815632, -27.69909819639279, 19.31953907815632) -SketchLine_9 = Sketch_2.addLine(-27.69909819639279, 19.31953907815632, -27.69909819639279, -33.75100200400802) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.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()) +SketchLine_6 = Sketch_2.addLine( + -27.69909819639279, -33.75100200400802, -61.96570844393754, -33.75100200400802 +) +SketchLine_7 = Sketch_2.addLine( + -61.96570844393754, -33.75100200400802, -61.96570844393754, 19.31953907815632 +) +SketchLine_8 = Sketch_2.addLine( + -61.96570844393754, 19.31953907815632, -27.69909819639279, 19.31953907815632 +) +SketchLine_9 = Sketch_2.addLine( + -27.69909819639279, 19.31953907815632, -27.69909819639279, -33.75100200400802 +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_6.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() +) SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result()) SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_9.result()) -SketchLine_10 = Sketch_2.addLine(-61.96570844393754, -12.80210420841683, -27.69909819639279, -13.26763527054108) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchLine_7.result()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_9.result()) +SketchLine_10 = Sketch_2.addLine( + -61.96570844393754, -12.80210420841683, -27.69909819639279, -13.26763527054108 +) +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_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")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [0]) @@ -73,4 +144,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [2]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [8]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [16]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_Face.py b/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_Face.py index ab85edb82..336e7e94b 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_Face.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_Face.py @@ -24,54 +24,121 @@ 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(-8.142167372244474, 30.79863310370742, -42.12686596943888, 30.79863310370742) -SketchLine_2 = Sketch_1.addLine(-42.12686596943888, 30.79863310370742, -42.12686596943888, -6.018123709919844) -SketchLine_3 = Sketch_1.addLine(-42.12686596943888, -6.018123709919844, -8.142167372244474, -6.018123709919844) -SketchLine_4 = Sketch_1.addLine(-8.142167372244474, -6.018123709919844, -8.142167372244474, 30.79863310370742) -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()) +SketchLine_1 = Sketch_1.addLine( + -8.142167372244474, 30.79863310370742, -42.12686596943888, 30.79863310370742 +) +SketchLine_2 = Sketch_1.addLine( + -42.12686596943888, 30.79863310370742, -42.12686596943888, -6.018123709919844 +) +SketchLine_3 = Sketch_1.addLine( + -42.12686596943888, -6.018123709919844, -8.142167372244474, -6.018123709919844 +) +SketchLine_4 = Sketch_1.addLine( + -8.142167372244474, -6.018123709919844, -8.142167372244474, 30.79863310370742 +) +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(49.91502606462924, 30.79863310370742, 15.22231291332662, 30.79863310370742) -SketchLine_6 = Sketch_1.addLine(15.22231291332662, 30.79863310370742, 15.22231291332662, -5.310109155811627) -SketchLine_7 = Sketch_1.addLine(15.22231291332662, -5.310109155811627, 49.91502606462924, -5.310109155811627) -SketchLine_8 = Sketch_1.addLine(49.91502606462924, -5.310109155811627, 49.91502606462924, 30.79863310370742) -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()) +SketchLine_5 = Sketch_1.addLine( + 49.91502606462924, 30.79863310370742, 15.22231291332662, 30.79863310370742 +) +SketchLine_6 = Sketch_1.addLine( + 15.22231291332662, 30.79863310370742, 15.22231291332662, -5.310109155811627 +) +SketchLine_7 = Sketch_1.addLine( + 15.22231291332662, -5.310109155811627, 49.91502606462924, -5.310109155811627 +) +SketchLine_8 = Sketch_1.addLine( + 49.91502606462924, -5.310109155811627, 49.91502606462924, 30.79863310370742 +) +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()) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10 +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchLine_9 = Sketch_2.addLine(32.99903071986655, 54.47604223124301, -21.74338409862735, 54.47604223124301) -SketchLine_10 = Sketch_2.addLine(-21.74338409862735, 54.47604223124301, -21.74338409862735, -10.16156298864041) -SketchLine_11 = Sketch_2.addLine(-21.74338409862735, -10.16156298864041, 32.99903071986655, -10.16156298864041) -SketchLine_12 = Sketch_2.addLine(32.99903071986655, -10.16156298864041, 32.99903071986655, 54.47604223124301) -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()) +SketchLine_9 = Sketch_2.addLine( + 32.99903071986655, 54.47604223124301, -21.74338409862735, 54.47604223124301 +) +SketchLine_10 = Sketch_2.addLine( + -21.74338409862735, 54.47604223124301, -21.74338409862735, -10.16156298864041 +) +SketchLine_11 = Sketch_2.addLine( + -21.74338409862735, -10.16156298864041, 32.99903071986655, -10.16156298864041 +) +SketchLine_12 = Sketch_2.addLine( + 32.99903071986655, -10.16156298864041, 32.99903071986655, 54.47604223124301 +) +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_5 = Sketch_2.setHorizontal(SketchLine_9.result()) 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_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")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [2]) @@ -80,4 +147,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [2]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [8]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [16]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_Shell.py b/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_Shell.py index 964ac0821..cba88389b 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_Shell.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_Shell.py @@ -24,57 +24,145 @@ 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(-29.34869739478959, 31.37274549098196, -65.37675350701403, 31.37274549098196) -SketchLine_2 = Sketch_1.addLine(-65.37675350701403, 31.37274549098196, -65.37675350701403, -6.274549098196388) -SketchLine_3 = Sketch_1.addLine(-65.37675350701403, -6.274549098196388, -29.34869739478959, -6.274549098196388) -SketchLine_4 = Sketch_1.addLine(-29.34869739478959, -6.274549098196388, -29.34869739478959, 31.37274549098196) -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()) +SketchLine_1 = Sketch_1.addLine( + -29.34869739478959, 31.37274549098196, -65.37675350701403, 31.37274549098196 +) +SketchLine_2 = Sketch_1.addLine( + -65.37675350701403, 31.37274549098196, -65.37675350701403, -6.274549098196388 +) +SketchLine_3 = Sketch_1.addLine( + -65.37675350701403, -6.274549098196388, -29.34869739478959, -6.274549098196388 +) +SketchLine_4 = Sketch_1.addLine( + -29.34869739478959, -6.274549098196388, -29.34869739478959, 31.37274549098196 +) +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(41.08817635270542, 32.5871743486974, 11.5370741482966, 32.5871743486974) -SketchLine_6 = Sketch_1.addLine(11.5370741482966, 32.5871743486974, 11.5370741482966, -8.703406813627252) -SketchLine_7 = Sketch_1.addLine(11.5370741482966, -8.703406813627252, 41.08817635270542, -8.703406813627252) -SketchLine_8 = Sketch_1.addLine(41.08817635270542, -8.703406813627252, 41.08817635270542, 32.5871743486974) -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()) +SketchLine_5 = Sketch_1.addLine( + 41.08817635270542, 32.5871743486974, 11.5370741482966, 32.5871743486974 +) +SketchLine_6 = Sketch_1.addLine( + 11.5370741482966, 32.5871743486974, 11.5370741482966, -8.703406813627252 +) +SketchLine_7 = Sketch_1.addLine( + 11.5370741482966, -8.703406813627252, 41.08817635270542, -8.703406813627252 +) +SketchLine_8 = Sketch_1.addLine( + 41.08817635270542, -8.703406813627252, 41.08817635270542, 32.5871743486974 +) +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()) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_9 = Sketch_2.addLine(-36.83851213815001, 4.871192068212162, -37.23534778672252, 23.01200273357838) -SketchLine_10 = Sketch_2.addLine(-37.23534778672252, 23.01200273357838, -8.095368404429529, 22.8820142517576) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchLine_11 = Sketch_2.addLine(-8.095368404429529, 22.8820142517576, 20.86605178109317, 22.08563377543123) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) -SketchLine_12 = Sketch_2.addLine(20.86605178109317, 22.08563377543123, 22.14286343998464, -2.004860047909258) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchLine_13 = Sketch_2.addLine(22.14286343998464, -2.004860047909258, -4.857114760245733, -1.198368777231491) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchLine_14 = Sketch_2.addLine(-4.857114760245733, -1.198368777231491, -36.83851213815001, 4.871192068212162) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_9.startPoint(), SketchLine_14.endPoint()) -SketchLine_15 = Sketch_2.addLine(-4.857114760245733, -1.198368777231491, -8.095368404429529, 22.8820142517576) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_15.endPoint()) +SketchLine_9 = Sketch_2.addLine( + -36.83851213815001, 4.871192068212162, -37.23534778672252, 23.01200273357838 +) +SketchLine_10 = Sketch_2.addLine( + -37.23534778672252, 23.01200273357838, -8.095368404429529, 22.8820142517576 +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchLine_11 = Sketch_2.addLine( + -8.095368404429529, 22.8820142517576, 20.86605178109317, 22.08563377543123 +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) +SketchLine_12 = Sketch_2.addLine( + 20.86605178109317, 22.08563377543123, 22.14286343998464, -2.004860047909258 +) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchLine_13 = Sketch_2.addLine( + 22.14286343998464, -2.004860047909258, -4.857114760245733, -1.198368777231491 +) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchLine_14 = Sketch_2.addLine( + -4.857114760245733, -1.198368777231491, -36.83851213815001, 4.871192068212162 +) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_9.startPoint(), SketchLine_14.endPoint() +) +SketchLine_15 = Sketch_2.addLine( + -4.857114760245733, -1.198368777231491, -8.095368404429529, 22.8820142517576 +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_15.startPoint() +) +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_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")]) +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_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) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [2]) @@ -83,4 +171,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [2]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [8]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [16]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_SolidCompound.py b/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_SolidCompound.py index ad2f00c3a..7f9f56635 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_SolidCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_SolidCompound.py @@ -24,67 +24,153 @@ 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(-10.72745490981964, 42.70741482965933, -40.27855711422846, 42.70741482965933) -SketchLine_2 = Sketch_1.addLine(-40.27855711422846, 42.70741482965933, -40.27855711422846, 9.513026052104207) -SketchLine_3 = Sketch_1.addLine(-40.27855711422846, 9.513026052104207, -10.72745490981964, 9.513026052104207) -SketchLine_4 = Sketch_1.addLine(-10.72745490981964, 9.513026052104207, -10.72745490981964, 42.70741482965933) -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()) +SketchLine_1 = Sketch_1.addLine( + -10.72745490981964, 42.70741482965933, -40.27855711422846, 42.70741482965933 +) +SketchLine_2 = Sketch_1.addLine( + -40.27855711422846, 42.70741482965933, -40.27855711422846, 9.513026052104207 +) +SketchLine_3 = Sketch_1.addLine( + -40.27855711422846, 9.513026052104207, -10.72745490981964, 9.513026052104207 +) +SketchLine_4 = Sketch_1.addLine( + -10.72745490981964, 9.513026052104207, -10.72745490981964, 42.70741482965933 +) +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(51.61322645290581, 42.70741482965933, 15.98997995991983, 42.70741482965933) -SketchLine_6 = Sketch_1.addLine(15.98997995991983, 42.70741482965933, 15.98997995991983, 8.298597194388774) -SketchLine_7 = Sketch_1.addLine(15.98997995991983, 8.298597194388774, 51.61322645290581, 8.298597194388774) -SketchLine_8 = Sketch_1.addLine(51.61322645290581, 8.298597194388774, 51.61322645290581, 42.70741482965933) -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()) +SketchLine_5 = Sketch_1.addLine( + 51.61322645290581, 42.70741482965933, 15.98997995991983, 42.70741482965933 +) +SketchLine_6 = Sketch_1.addLine( + 15.98997995991983, 42.70741482965933, 15.98997995991983, 8.298597194388774 +) +SketchLine_7 = Sketch_1.addLine( + 15.98997995991983, 8.298597194388774, 51.61322645290581, 8.298597194388774 +) +SketchLine_8 = Sketch_1.addLine( + 51.61322645290581, 8.298597194388774, 51.61322645290581, 42.70741482965933 +) +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()) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_9 = Sketch_2.addLine(-17.20440881763527, 19.22845691382766, -33.80160320641282, 19.22845691382766) -SketchLine_10 = Sketch_2.addLine(-33.80160320641282, 19.22845691382766, -33.80160320641282, -6.679358717434865) -SketchLine_11 = Sketch_2.addLine(-33.80160320641282, -6.679358717434865, -17.20440881763527, -6.679358717434865) -SketchLine_12 = Sketch_2.addLine(-17.20440881763527, -6.679358717434865, -17.20440881763527, 19.22845691382766) -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()) +SketchLine_9 = Sketch_2.addLine( + -17.20440881763527, 19.22845691382766, -33.80160320641282, 19.22845691382766 +) +SketchLine_10 = Sketch_2.addLine( + -33.80160320641282, 19.22845691382766, -33.80160320641282, -6.679358717434865 +) +SketchLine_11 = Sketch_2.addLine( + -33.80160320641282, -6.679358717434865, -17.20440881763527, -6.679358717434865 +) +SketchLine_12 = Sketch_2.addLine( + -17.20440881763527, -6.679358717434865, -17.20440881763527, 19.22845691382766 +) +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_5 = Sketch_2.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_10.result()) SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_12.result()) -SketchLine_13 = Sketch_2.addLine(41.4929859719439, 21.25250501002005, 26.51503006012023, 21.25250501002005) -SketchLine_14 = Sketch_2.addLine(26.51503006012023, 21.25250501002005, 26.51503006012023, -9.917835671342685) -SketchLine_15 = Sketch_2.addLine(26.51503006012023, -9.917835671342685, 41.4929859719439, -9.917835671342685) -SketchLine_16 = Sketch_2.addLine(41.4929859719439, -9.917835671342685, 41.4929859719439, 21.25250501002005) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) +SketchLine_13 = Sketch_2.addLine( + 41.4929859719439, 21.25250501002005, 26.51503006012023, 21.25250501002005 +) +SketchLine_14 = Sketch_2.addLine( + 26.51503006012023, 21.25250501002005, 26.51503006012023, -9.917835671342685 +) +SketchLine_15 = Sketch_2.addLine( + 26.51503006012023, -9.917835671342685, 41.4929859719439, -9.917835671342685 +) +SketchLine_16 = Sketch_2.addLine( + 41.4929859719439, -9.917835671342685, 41.4929859719439, 21.25250501002005 +) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) SketchConstraintHorizontal_7 = Sketch_2.setHorizontal(SketchLine_13.result()) 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() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 5, 5) -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")]) -Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10 +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 5, 5 +) +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"), + ], +) +Common_1 = model.addCommon( + Part_1_doc, + [ + model.selection("COMPOUND", "Compound_1_1"), + model.selection("COMPOUND", "Compound_2_1"), + ], +) model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [2]) @@ -93,4 +179,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [12]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [48]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [96]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Face.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Face.py index bb7de00d6..cbc8d094b 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Face.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Face.py @@ -24,16 +24,23 @@ 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(-19.01903137581643, 2.528314065029049, 44.55011038017909) +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_2r")]) +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")]) +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) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [0]) @@ -42,4 +49,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [1]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [1]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [2]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Shell.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Shell.py index 405839693..b0342d472 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Shell.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Shell.py @@ -24,30 +24,67 @@ 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(35.42084168336675, 22.87174348697394, -27.32464929859721, 22.87174348697394) -SketchLine_2 = Sketch_1.addLine(-27.32464929859721, 22.87174348697394, -27.32464929859721, -13.08560194713185) -SketchLine_3 = Sketch_1.addLine(-27.32464929859721, -13.08560194713185, 35.42084168336675, -13.08560194713185) -SketchLine_4 = Sketch_1.addLine(35.42084168336675, -13.08560194713185, 35.42084168336675, 22.87174348697394) -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()) +SketchLine_1 = Sketch_1.addLine( + 35.42084168336675, 22.87174348697394, -27.32464929859721, 22.87174348697394 +) +SketchLine_2 = Sketch_1.addLine( + -27.32464929859721, 22.87174348697394, -27.32464929859721, -13.08560194713185 +) +SketchLine_3 = Sketch_1.addLine( + -27.32464929859721, -13.08560194713185, 35.42084168336675, -13.08560194713185 +) +SketchLine_4 = Sketch_1.addLine( + 35.42084168336675, -13.08560194713185, 35.42084168336675, 22.87174348697394 +) +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(4.250501002003999, 22.87174348697394, 4.250501002003999, -13.08560194713185) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result()) +SketchLine_5 = Sketch_1.addLine( + 4.250501002003999, 22.87174348697394, 4.250501002003999, -13.08560194713185 +) +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_1r-SketchLine_2f-SketchLine_3f-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_5f-SketchLine_3f-SketchLine_4f")]) +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")]) +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) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [0]) @@ -56,4 +93,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [2]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [5]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [10]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Solid.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Solid.py index b80a13c80..7de24ebff 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Solid.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Solid.py @@ -24,13 +24,22 @@ 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) -Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Cylinder_1_1")]) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Common_1 = model.addCommon( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Cylinder_1_1")], +) model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [0]) @@ -39,4 +48,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [5]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [18]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [36]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_SolidsHistory.py b/src/FeaturesPlugin/Test/TestBooleanCommon_SolidsHistory.py index e14e7729c..842fa2f03 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_SolidsHistory.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_SolidsHistory.py @@ -31,55 +31,166 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(5, 5, 7.071067811865464) SketchCircle_2 = Sketch_1.addCircle(0, 10, 7.071067811865464) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchCircle_2.results()[1]) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchCircle_2.results()[1] +) SketchCircle_3 = Sketch_1.addCircle(-5, 5, 7.071067811865464) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchCircle_3.results()[1]) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchCircle_3.center(), SketchCircle_2.results()[1]) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchCircle_1.results()[1], SketchCircle_2.center()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_2.center(), SketchCircle_3.results()[1] +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchCircle_3.center(), SketchCircle_2.results()[1] +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchCircle_1.results()[1], SketchCircle_2.center() +) SketchCircle_4 = Sketch_1.addCircle(0, 0, 7.071067811865464) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_4.center(), SketchCircle_3.results()[1]) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchCircle_4.results()[1], SketchCircle_3.center()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchCircle_4.results()[1], SketchCircle_1.center()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchCircle_3.center(), 10, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_2.center(), SketchCircle_4.center(), 10, True) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchCircle_4.center(), SketchCircle_3.results()[1] +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchCircle_4.results()[1], SketchCircle_3.center() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchCircle_4.results()[1], SketchCircle_1.center() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchCircle_3.center(), 10, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchCircle_2.center(), SketchCircle_4.center(), 10, True +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchCircle_4.center(), SketchAPI_Point(SketchPoint_1).coordinates()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchCircle_4.center(), SketchAPI_Point(SketchPoint_1).coordinates() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_1 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchLine_1.result()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchCircle_2.center(), SketchLine_1.result() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_2 = Sketch_2.addLine(-5, 5, 0, 0) -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchCircle_3_2__cc"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchCircle_3_2__cc"), False +) SketchPoint_2 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchPoint_2.result()) -SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchCircle_4_2__cc"), False) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_2.startPoint(), SketchPoint_2.result() +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchCircle_4_2__cc"), False +) SketchPoint_3 = SketchProjection_4.createdFeature() -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchPoint_3.result()) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchPoint_3.result() +) SketchLine_3 = Sketch_2.addLine(0, 0, 5, 5) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchCircle_1_2__cc"), False) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchCircle_1_2__cc"), False +) SketchPoint_4 = SketchProjection_5.createdFeature() -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchPoint_4.result()) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchPoint_4.result() +) SketchLine_4 = Sketch_2.addLine(-5, 5, 5, 5) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.endPoint()) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_2.startPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.endPoint() +) SketchArc_1 = Sketch_2.addArc(-1.474514954580286e-16, 5, -5, 5, 5, 5, True) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_4.result(), SketchArc_1.center()) -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_4.result(), SketchArc_1.center() +) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchLine_2.startPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchArc_1.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 10, 0) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_2")], model.selection(), 5, 5) -Group_1_objects = [model.selection("SOLID", "Extrusion_1_1_13"), model.selection("SOLID", "Extrusion_1_1_10"), model.selection("SOLID", "Extrusion_1_1_7"), model.selection("SOLID", "Extrusion_1_1_9"), model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_5"), model.selection("SOLID", "Extrusion_1_1_4"), model.selection("SOLID", "Extrusion_1_1_12"), model.selection("SOLID", "Extrusion_1_1_11"), model.selection("SOLID", "Extrusion_1_1_8"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("SOLID", "Extrusion_1_1_6"), model.selection("SOLID", "Extrusion_1_1_2")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection(), + 10, + 0, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_2")], + model.selection(), + 5, + 5, +) +Group_1_objects = [ + model.selection("SOLID", "Extrusion_1_1_13"), + model.selection("SOLID", "Extrusion_1_1_10"), + model.selection("SOLID", "Extrusion_1_1_7"), + model.selection("SOLID", "Extrusion_1_1_9"), + model.selection("SOLID", "Extrusion_1_1_1"), + model.selection("SOLID", "Extrusion_1_1_5"), + model.selection("SOLID", "Extrusion_1_1_4"), + model.selection("SOLID", "Extrusion_1_1_12"), + model.selection("SOLID", "Extrusion_1_1_11"), + model.selection("SOLID", "Extrusion_1_1_8"), + model.selection("SOLID", "Extrusion_1_1_3"), + model.selection("SOLID", "Extrusion_1_1_6"), + model.selection("SOLID", "Extrusion_1_1_2"), +] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) -Group_2 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1_2"), model.selection("SOLID", "Extrusion_2_1_1")]) -Group_3_objects = [model.selection("FACE", "Extrusion_1_1_7/From_Face"), model.selection("FACE", "Extrusion_1_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1_9/From_Face"), model.selection("FACE", "Extrusion_1_1_12/From_Face"), model.selection("FACE", "Extrusion_1_1_4/From_Face"), model.selection("FACE", "Extrusion_1_1_5/From_Face"), model.selection("FACE", "Extrusion_1_1_8/From_Face"), model.selection("FACE", "Extrusion_1_1_11/From_Face"), model.selection("FACE", "Extrusion_1_1_6/From_Face"), model.selection("FACE", "Extrusion_1_1_2/From_Face"), model.selection("FACE", "Extrusion_1_1_3/From_Face"), model.selection("FACE", "Extrusion_1_1_10/From_Face")] +Group_2 = model.addGroup( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_2_1_2"), + model.selection("SOLID", "Extrusion_2_1_1"), + ], +) +Group_3_objects = [ + model.selection("FACE", "Extrusion_1_1_7/From_Face"), + model.selection("FACE", "Extrusion_1_1_1/From_Face"), + model.selection("FACE", "Extrusion_1_1_9/From_Face"), + model.selection("FACE", "Extrusion_1_1_12/From_Face"), + model.selection("FACE", "Extrusion_1_1_4/From_Face"), + model.selection("FACE", "Extrusion_1_1_5/From_Face"), + model.selection("FACE", "Extrusion_1_1_8/From_Face"), + model.selection("FACE", "Extrusion_1_1_11/From_Face"), + model.selection("FACE", "Extrusion_1_1_6/From_Face"), + model.selection("FACE", "Extrusion_1_1_2/From_Face"), + model.selection("FACE", "Extrusion_1_1_3/From_Face"), + model.selection("FACE", "Extrusion_1_1_10/From_Face"), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Group_4_objects = [model.selection("FACE", "Extrusion_2_1_2/Generated_Face&Sketch_2/SketchLine_4"), model.selection("FACE", "Extrusion_2_1_2/Generated_Face&Sketch_2/SketchArc_1_2"), model.selection("FACE", "Extrusion_2_1_2/From_Face"), model.selection("FACE", "Extrusion_2_1_2/To_Face"), model.selection("FACE", "Extrusion_2_1_1/Generated_Face&Sketch_2/SketchLine_2"), model.selection("FACE", "Extrusion_2_1_1/To_Face"), model.selection("FACE", "Extrusion_2_1_1/From_Face"), model.selection("FACE", "Extrusion_2_1_1/Generated_Face&Sketch_2/SketchLine_4"), model.selection("FACE", "Extrusion_2_1_1/Generated_Face&Sketch_2/SketchLine_3")] +Group_4_objects = [ + model.selection("FACE", "Extrusion_2_1_2/Generated_Face&Sketch_2/SketchLine_4"), + model.selection("FACE", "Extrusion_2_1_2/Generated_Face&Sketch_2/SketchArc_1_2"), + model.selection("FACE", "Extrusion_2_1_2/From_Face"), + model.selection("FACE", "Extrusion_2_1_2/To_Face"), + model.selection("FACE", "Extrusion_2_1_1/Generated_Face&Sketch_2/SketchLine_2"), + model.selection("FACE", "Extrusion_2_1_1/To_Face"), + model.selection("FACE", "Extrusion_2_1_1/From_Face"), + model.selection("FACE", "Extrusion_2_1_1/Generated_Face&Sketch_2/SketchLine_4"), + model.selection("FACE", "Extrusion_2_1_1/Generated_Face&Sketch_2/SketchLine_3"), +] Group_4 = model.addGroup(Part_1_doc, Group_4_objects) -Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_2_1")]) +Common_1 = model.addCommon( + Part_1_doc, + [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPSOLID", "Extrusion_2_1"), + ], +) Common_1.result().subResult(0).setColor(254, 254, 127) Common_1.result().subResult(1).setColor(204, 102, 204) Common_1.result().subResult(2).setColor(51, 102, 102) @@ -103,27 +214,27 @@ model.end() # check groups are correct aFactory = ModelAPI_Session.get().validators() selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 12) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 12 +assert aFactory.validate(Group_1.feature()) for i in range(12): - assert(Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID) + assert Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 12) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 12 +assert aFactory.validate(Group_2.feature()) for i in range(12): - assert(Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID) + assert Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 12) -assert(aFactory.validate(Group_3.feature())) +assert selectionList.size() == 12 +assert aFactory.validate(Group_3.feature()) for i in range(12): - assert(Group_3.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE) + assert Group_3.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE selectionList = Group_4.feature().selectionList("group_list") -assert(selectionList.size() == 22) -assert(aFactory.validate(Group_4.feature())) +assert selectionList.size() == 22 +assert aFactory.validate(Group_4.feature()) for i in range(22): - assert(Group_4.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE) + assert Group_4.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_SubCompound_Solid.py b/src/FeaturesPlugin/Test/TestBooleanCommon_SubCompound_Solid.py index 82848d9b5..ee4309dfa 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_SubCompound_Solid.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_SubCompound_Solid.py @@ -24,15 +24,34 @@ 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) +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")] +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")]) +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) @@ -48,4 +67,4 @@ 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()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_SubSolid_Solid.py b/src/FeaturesPlugin/Test/TestBooleanCommon_SubSolid_Solid.py index 373a0f3f2..b484a593b 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_SubSolid_Solid.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_SubSolid_Solid.py @@ -25,10 +25,19 @@ 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")]) +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")]) +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) @@ -44,4 +53,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [56]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [112]) model.testResultsVolumes(Common_1, [745]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_VertexCompound_VertexCompound.py b/src/FeaturesPlugin/Test/TestBooleanCommon_VertexCompound_VertexCompound.py index ea4a769e9..5252a0528 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_VertexCompound_VertexCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_VertexCompound_VertexCompound.py @@ -28,16 +28,40 @@ 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/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")]) +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"), + ], +) model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [0]) @@ -46,4 +70,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [0]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [1]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Vertex_Vertex.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Vertex_Vertex.py index f17d4c59d..c64d962b1 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_Vertex_Vertex.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Vertex_Vertex.py @@ -27,22 +27,42 @@ 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/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")]) +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/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()) +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/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")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 0) model.testNbSubResults(Common_1, []) @@ -58,4 +78,4 @@ model.testNbSubShapes(Common_2, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Common_2, GeomAPI_Shape.EDGE, [0]) model.testNbSubShapes(Common_2, GeomAPI_Shape.VERTEX, [1]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_WireCompound_WireCompound.py b/src/FeaturesPlugin/Test/TestBooleanCommon_WireCompound_WireCompound.py index 36a4a719e..f6d3a94b8 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_WireCompound_WireCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_WireCompound_WireCompound.py @@ -26,47 +26,127 @@ 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(-88.6588483815807, 35.68247765805569, -60.62456998069012, -7.998839850308682) -SketchLine_2 = Sketch_1.addLine(-60.62456998069012, -7.998839850308682, -33.24225154261096, 37.63835754648991) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(22.82630525917019, 37.63835754648991, 47.60078384600371, -9.954719738742909) -SketchLine_4 = Sketch_1.addLine(47.60078384600371, -9.954719738742909, 74.33114232127146, 36.3344376208671) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_1 = Sketch_1.addLine( + -88.6588483815807, 35.68247765805569, -60.62456998069012, -7.998839850308682 +) +SketchLine_2 = Sketch_1.addLine( + -60.62456998069012, -7.998839850308682, -33.24225154261096, 37.63835754648991 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 22.82630525917019, 37.63835754648991, 47.60078384600371, -9.954719738742909 +) +SketchLine_4 = Sketch_1.addLine( + 47.60078384600371, -9.954719738742909, 74.33114232127146, 36.3344376208671 +) +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(-75.23467769579756, 14.76574658950986, -60.62456998069012, -7.998839850308684) -SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False) +SketchLine_5 = Sketch_2.addLine( + -75.23467769579756, 14.76574658950986, -60.62456998069012, -7.998839850308684 +) +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/SketchLine_2"), False) +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/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/SketchLine_3"), False) +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/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/SketchLine_4"), False) +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/SketchLine_4"), False +) SketchLine_12 = SketchProjection_4.createdFeature() -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.result()) +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/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")]) +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"), + ], +) model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [2]) @@ -75,4 +155,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [8]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Wire_Wire.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Wire_Wire.py index 2d1e8f343..e3c0aee0d 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_Wire_Wire.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Wire_Wire.py @@ -26,30 +26,67 @@ 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(-44.32557091040492, 34.37855773243287, -1.296213364851963, -18.43019925529121) -SketchLine_2 = Sketch_1.addLine(-1.296213364851963, -18.43019925529121, 39.1253043294554, 29.81483799275304) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_1 = Sketch_1.addLine( + -44.32557091040492, 34.37855773243287, -1.296213364851963, -18.43019925529121 +) +SketchLine_2 = Sketch_1.addLine( + -1.296213364851963, -18.43019925529121, 39.1253043294554, 29.81483799275304 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) 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/SketchLine_1"), False) +SketchLine_3 = Sketch_2.addLine( + -15.313984501828, -1.226571041729713, -1.296213364851965, -18.43019925529121 +) +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/SketchLine_2"), False) +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/SketchLine_2"), False +) SketchLine_6 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result()) +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/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")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [0]) @@ -58,4 +95,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [2]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [4]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCompSolids.py b/src/FeaturesPlugin/Test/TestBooleanCompSolids.py index c55beb392..209ea9c6d 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCompSolids.py +++ b/src/FeaturesPlugin/Test/TestBooleanCompSolids.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -33,9 +33,9 @@ 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")) @@ -57,9 +57,9 @@ aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) aLineStartPoint.setValue(0, -50) aLineEndPoint.setValue(0, 50) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create a sketch with triangle to extrude -#========================================================================= +# ========================================================================= aSession.startOperation() aTriangleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin")) @@ -77,16 +77,16 @@ 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.) +aLineAStartPoint.setValue(25.0, 25.0) +aLineAEndPoint.setValue(100.0, 25.0) +aLineBStartPoint.setValue(100.0, 25.0) +aLineBEndPoint.setValue(60.0, 75.0) +aLineCStartPoint.setValue(60.0, 75.0) +aLineCEndPoint.setValue(25.0, 25.0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on circle (cylinder) and triangle (prism) -#========================================================================= +# ========================================================================= # Build shape from sketcher results aSession.startOperation() extrudedObjects = [] @@ -95,19 +95,18 @@ for eachSketchFeature in [aCircleSketchFeature, aTriangleSketchFeature]: aSketchResult = modelAPI_ResultConstruction(eachSketchFeature.firstResult()) # Create extrusion on them anExtrusionFt = aPart.addFeature("Extrusion") - anExtrusionFt.selectionList("base").append( - aSketchResult, None) + anExtrusionFt.selectionList("base").append(aSketchResult, None) 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.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].subResult(1), None) @@ -115,14 +114,14 @@ aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], None) aBooleanFt.execute() aSession.finishOperation() -assert (len(aBooleanFt.results()) > 0) +assert len(aBooleanFt.results()) > 0 aBooleanResult = modelAPI_ResultBody(aBooleanFt.firstResult()) -assert (aBooleanResult is not None) +assert aBooleanResult is not None aSession.undo() -#========================================================================= +# ========================================================================= # Fuse -#========================================================================= +# ========================================================================= aSession.startOperation() aBooleanFt = aPart.addFeature("Fuse") aBooleanFt.string("creation_method").setValue("advanced") @@ -132,12 +131,13 @@ aBooleanFt.boolean("remove_intersection_edges").setValue(False) aBooleanFt.execute() aSession.finishOperation() -assert (len(aBooleanFt.results()) > 0) +assert len(aBooleanFt.results()) > 0 aBooleanResult = modelAPI_ResultBody(aBooleanFt.firstResult()) -assert (aBooleanResult is not None) -#========================================================================= +assert aBooleanResult is not None +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_CompSolidCompound_CompSolidCompound.py b/src/FeaturesPlugin/Test/TestBooleanCut_CompSolidCompound_CompSolidCompound.py index b8bd387a2..0d17c13d4 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_CompSolidCompound_CompSolidCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_CompSolidCompound_CompSolidCompound.py @@ -24,35 +24,87 @@ 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(-65.75962883650391, 1.812165175943577, 20.84344758927215) -SketchLine_1 = Sketch_1.addLine(-64.98081644495703, 22.64105757725738, -64.58019600110421, -18.99788637597517) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) -SketchCircle_2 = Sketch_1.addCircle(62.53870966583226, 1.604010602289747, 23.75523331537361) -SketchLine_2 = Sketch_1.addLine(63.75890236666707, 25.3278854890081, 63.76050419996562, -22.11978184293701) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchCircle_2.results()[1]) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_2.results()[1]) +SketchCircle_1 = Sketch_1.addCircle( + -65.75962883650391, 1.812165175943577, 20.84344758927215 +) +SketchLine_1 = Sketch_1.addLine( + -64.98081644495703, 22.64105757725738, -64.58019600110421, -18.99788637597517 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) +SketchCircle_2 = Sketch_1.addCircle( + 62.53870966583226, 1.604010602289747, 23.75523331537361 +) +SketchLine_2 = Sketch_1.addLine( + 63.75890236666707, 25.3278854890081, 63.76050419996562, -22.11978184293701 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchCircle_2.results()[1] +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchCircle_2.results()[1] +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_3 = Sketch_2.addCircle(-32.47294132465983, 2.220594155120791, 24.592292084386) -SketchLine_3 = Sketch_2.addLine(-57.05151402373072, 3.041930894979393, -7.893787575150295, 1.41683366733466) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_3.startPoint(), SketchCircle_3.results()[1]) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchCircle_3.results()[1]) -SketchCircle_4 = Sketch_2.addCircle(107.0005131452338, 2.231606536656211, 32.56614591098422) -SketchLine_4 = Sketch_2.addLine(74.45658844157124, 3.434446666454839, 139.5031967571015, 0.1995097076777023) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchCircle_4.results()[1]) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchCircle_4.results()[1]) +SketchCircle_3 = Sketch_2.addCircle( + -32.47294132465983, 2.220594155120791, 24.592292084386 +) +SketchLine_3 = Sketch_2.addLine( + -57.05151402373072, 3.041930894979393, -7.893787575150295, 1.41683366733466 +) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_3.startPoint(), SketchCircle_3.results()[1] +) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchCircle_3.results()[1] +) +SketchCircle_4 = Sketch_2.addCircle( + 107.0005131452338, 2.231606536656211, 32.56614591098422 +) +SketchLine_4 = Sketch_2.addLine( + 74.45658844157124, 3.434446666454839, 139.5031967571015, 0.1995097076777023 +) +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() -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_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")]) +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_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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [2]) @@ -61,4 +113,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [22]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [84]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [168]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_CompSolid_CompSolid.py b/src/FeaturesPlugin/Test/TestBooleanCut_CompSolid_CompSolid.py index 6bc42d19c..df1702d52 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_CompSolid_CompSolid.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_CompSolid_CompSolid.py @@ -24,25 +24,49 @@ 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(-23.21770404974615, 0.697956782029321, 35.59095357943583) -SketchLine_1 = Sketch_1.addLine(-23.86759161364122, 36.28297642299413, -22.5735889911581, -34.88716781357743) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) +SketchCircle_1 = Sketch_1.addCircle( + -23.21770404974615, 0.697956782029321, 35.59095357943583 +) +SketchLine_1 = Sketch_1.addLine( + -23.86759161364122, 36.28297642299413, -22.5735889911581, -34.88716781357743 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) 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.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]) +SketchCircle_2 = Sketch_2.addCircle( + 32.08143103297851, 1.286314091165838, 40.2404383217231 +) +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() -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) -Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1")], [model.selection("COMPSOLID", "Extrusion_2_1")]) +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 +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("COMPSOLID", "Extrusion_1_1")], + [model.selection("COMPSOLID", "Extrusion_2_1")], +) model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [2]) @@ -51,4 +75,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [11]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [42]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [84]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_Compound_Solid.py b/src/FeaturesPlugin/Test/TestBooleanCut_Compound_Solid.py index 59bbabcd6..3a6a96933 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_Compound_Solid.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_Compound_Solid.py @@ -25,11 +25,25 @@ 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")]) +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")]) +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() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_EdgeCompound_EdgeCompound.py b/src/FeaturesPlugin/Test/TestBooleanCut_EdgeCompound_EdgeCompound.py index e56b90d09..11fccb3c3 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_EdgeCompound_EdgeCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_EdgeCompound_EdgeCompound.py @@ -24,19 +24,43 @@ 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(-13.70458696967078, 45.46669742770666, 15.88340489230536, 45.46669742770666) -SketchLine_2 = Sketch_1.addLine(-13.21145377197118, 31.16583469441819, 14.89713849690615, 31.41240129326799) -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) +SketchLine_1 = Sketch_1.addLine( + -13.70458696967078, 45.46669742770666, 15.88340489230536, 45.46669742770666 +) +SketchLine_2 = Sketch_1.addLine( + -13.21145377197118, 31.16583469441819, 14.89713849690615, 31.41240129326799 +) +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/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")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [6]) @@ -45,4 +69,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [12]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_EdgeCompound_Solid.py b/src/FeaturesPlugin/Test/TestBooleanCut_EdgeCompound_Solid.py index faeb24185..ee9ed62d5 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_EdgeCompound_Solid.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_EdgeCompound_Solid.py @@ -24,31 +24,61 @@ 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(-28.62948623265935, 53.77363153293705, 40.23707952134417, 53.11775947813702) -SketchLine_2 = Sketch_1.addLine(-26.66187006825925, 26.22700523133564, 40.89295157614425, 26.22700523133564) +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/SketchLine_1"), model.selection("EDGE", "Sketch_1/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) -SketchLine_4 = Sketch_2.addLine(-10.2650686982584, 60.98822413573743, -10.2650686982584, 18.35654057373522) -SketchLine_5 = Sketch_2.addLine(-10.2650686982584, 18.35654057373522, 14.6580693841429, 18.35654057373522) -SketchLine_6 = Sketch_2.addLine(14.6580693841429, 18.35654057373522, 14.6580693841429, 60.98822413573743) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchLine_3 = Sketch_2.addLine( + 14.6580693841429, 60.98822413573743, -10.2650686982584, 60.98822413573743 +) +SketchLine_4 = Sketch_2.addLine( + -10.2650686982584, 60.98822413573743, -10.2650686982584, 18.35654057373522 +) +SketchLine_5 = Sketch_2.addLine( + -10.2650686982584, 18.35654057373522, 14.6580693841429, 18.35654057373522 +) +SketchLine_6 = Sketch_2.addLine( + 14.6580693841429, 18.35654057373522, 14.6580693841429, 60.98822413573743 +) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_6.result()) Extrusion_1.setNestedSketch(Sketch_2) -Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], [model.selection("SOLID", "Extrusion_1_1")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [4]) @@ -57,4 +87,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [8]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_Edge_Edge.py b/src/FeaturesPlugin/Test/TestBooleanCut_Edge_Edge.py index a8c0f89d9..290286bff 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_Edge_Edge.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_Edge_Edge.py @@ -24,16 +24,30 @@ 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.12006861063466, 20.61578044596912, 27.54545454545454, 58.72898799313897) -SketchLine_2 = Sketch_1.addLine(-19.22984562607204, 56.30360205831907, 22.69468267581474, 22.00171526586621) +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/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")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [2]) @@ -42,4 +56,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [2]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [4]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_Edge_Face.py b/src/FeaturesPlugin/Test/TestBooleanCut_Edge_Face.py index 057cb30c9..5ea37f38c 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_Edge_Face.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_Edge_Face.py @@ -24,30 +24,60 @@ 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.96793587174349, 41.08817635270543, 39.4689378757515, 41.4929859719439) +SketchLine_1 = Sketch_1.addLine( + -30.96793587174349, 41.08817635270543, 39.4689378757515, 41.4929859719439 +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_2 = Sketch_2.addLine(13.96593186372747, 52.01803607214429, -9.917835671342695, 52.01803607214429) -SketchLine_3 = Sketch_2.addLine(-9.917835671342695, 52.01803607214429, -9.917835671342695, 27.32464929859719) -SketchLine_4 = Sketch_2.addLine(-9.917835671342695, 27.32464929859719, 13.96593186372747, 27.32464929859719) -SketchLine_5 = Sketch_2.addLine(13.96593186372747, 27.32464929859719, 13.96593186372747, 52.01803607214429) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchLine_2 = Sketch_2.addLine( + 13.96593186372747, 52.01803607214429, -9.917835671342695, 52.01803607214429 +) +SketchLine_3 = Sketch_2.addLine( + -9.917835671342695, 52.01803607214429, -9.917835671342695, 27.32464929859719 +) +SketchLine_4 = Sketch_2.addLine( + -9.917835671342695, 27.32464929859719, 13.96593186372747, 27.32464929859719 +) +SketchLine_5 = Sketch_2.addLine( + 13.96593186372747, 27.32464929859719, 13.96593186372747, 52.01803607214429 +) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = 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() 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")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [2]) @@ -56,4 +86,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [2]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [4]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_ErrorMsg.py b/src/FeaturesPlugin/Test/TestBooleanCut_ErrorMsg.py index a782214fe..103f5ff84 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_ErrorMsg.py @@ -18,6 +18,7 @@ # from ModelAPI import * + aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -31,7 +32,7 @@ aPart = aPartResult.partDoc() aSession.startOperation() Cut_1 = aPart.addFeature("Cut") Cut_1.execute() -assert(Cut_1.error() != "") +assert Cut_1.error() != "" aSession.finishOperation() @@ -44,7 +45,11 @@ Part_1_doc = Part_1.document() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_2.addLine(-30, -30, 0, 10) model.do() -Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], [model.selection("SOLID", "")]) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + [model.selection("SOLID", "")], +) model.do() -assert(Cut_1.feature().error() != "") +assert Cut_1.feature().error() != "" model.end() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_FaceCompound_FaceCompound.py b/src/FeaturesPlugin/Test/TestBooleanCut_FaceCompound_FaceCompound.py index 99474a300..6e4e4978a 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_FaceCompound_FaceCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_FaceCompound_FaceCompound.py @@ -24,23 +24,53 @@ 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(-49.71737993138937, 2.062011149228122, 25.20652382544127) -SketchCircle_2 = Sketch_1.addCircle(41.46933533447686, 0.6873370497427074, 27.03914027119833) +SketchCircle_1 = Sketch_1.addCircle( + -49.71737993138937, 2.062011149228122, 25.20652382544127 +) +SketchCircle_2 = Sketch_1.addCircle( + 41.46933533447686, 0.6873370497427074, 27.03914027119833 +) model.do() 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) +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/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")]) +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")], +) model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [2]) @@ -49,4 +79,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [2]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [8]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_Face_Face.py b/src/FeaturesPlugin/Test/TestBooleanCut_Face_Face.py index 6ebba9ea4..eb4402df0 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_Face_Face.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_Face_Face.py @@ -24,22 +24,38 @@ 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.8662092624356817, 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/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) +SketchProjection_1 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchCircle_2 = Sketch_2.addCircle(33.45888578231592, 3.635557519489646, 33.65582143213236) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchCircle_2.results()[1]) +SketchCircle_2 = Sketch_2.addCircle( + 33.45888578231592, 3.635557519489646, 33.65582143213236 +) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchPoint_1.result(), SketchCircle_2.results()[1] +) model.do() -Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")]) -Cut_1 = model.addCut(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Face_2_1")]) +Face_2 = model.addFace( + Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")] +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + [model.selection("FACE", "Face_2_1")], +) model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [0]) @@ -48,4 +64,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [1]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [2]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [4]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_Face_Solid.py b/src/FeaturesPlugin/Test/TestBooleanCut_Face_Solid.py index 91549c475..ee7c73d23 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_Face_Solid.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_Face_Solid.py @@ -24,35 +24,85 @@ 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(-8.850181926352695, 1.062021831162306, 46.73432400996293) +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/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) -SketchLine_3 = Sketch_2.addLine(-8.272875875352462, -5.036618941767999, 64.95207814695526, -5.036618941767999) -SketchLine_4 = Sketch_2.addLine(64.95207814695526, -5.036618941767999, 64.95207814695526, 55.29739830292169) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +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 +) +SketchLine_3 = Sketch_2.addLine( + -8.272875875352462, -5.036618941767999, 64.95207814695526, -5.036618941767999 +) +SketchLine_4 = Sketch_2.addLine( + 64.95207814695526, -5.036618941767999, 64.95207814695526, 55.29739830292169 +) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_1.result()) 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_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/Generated_Vertex&Sketch_2/SketchLine_3&Sketch_1/SketchCircle_1_2"), 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")] +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/Generated_Vertex&Sketch_2/SketchLine_3&Sketch_1/SketchCircle_1_2", + ), + 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/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_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) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [0]) @@ -61,4 +111,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [1]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [3]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [6]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_Fuzzy_1.py b/src/FeaturesPlugin/Test/TestBooleanCut_Fuzzy_1.py index b847939a2..85abee539 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_Fuzzy_1.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_Fuzzy_1.py @@ -25,8 +25,8 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Param_offset = model.addParameter(Part_1_doc, "offset", '5e-5') -Param_fuzzy = model.addParameter(Part_1_doc, "fuzzy", '1e-05') +Param_offset = model.addParameter(Part_1_doc, "offset", "5e-5") +Param_fuzzy = model.addParameter(Part_1_doc, "fuzzy", "1e-05") ### Create Point Point_2 = model.addPoint(Part_1_doc, "offset", "5", "5") @@ -36,12 +36,24 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Box_1.result().setColor(255, 0, 0) ### Create Cylinder -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("EDGE", "PartSet/OX"), 6, 13) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "Point_1"), + model.selection("EDGE", "PartSet/OX"), + 6, + 13, +) Cylinder_1.result().setColor(255, 255, 0) Cylinder_1.result().setTransparency(0.6) ### Create Cut -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("SOLID", "Cylinder_1_1")], fuzzyParam = "fuzzy", keepSubResults = True) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + [model.selection("SOLID", "Cylinder_1_1")], + fuzzyParam="fuzzy", + keepSubResults=True, +) model.do() model.testNbResults(Cut_1, 1) @@ -53,7 +65,7 @@ model.testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [24]) model.testResultsVolumes(Cut_1, [49.093623770546]) ### Set a higher fuzzy value -Param_fuzzy.setValue(5.e-5) +Param_fuzzy.setValue(5.0e-5) model.do() model.end() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_Fuzzy_2.py b/src/FeaturesPlugin/Test/TestBooleanCut_Fuzzy_2.py index 44d65f607..31618c78d 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_Fuzzy_2.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_Fuzzy_2.py @@ -25,7 +25,7 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Param_fuzzy = model.addParameter(Part_1_doc, "fuzzy", '1e-07') +Param_fuzzy = model.addParameter(Part_1_doc, "fuzzy", "1e-07") ### Create Point Point_2 = model.addPoint(Part_1_doc, 5, 9.9999, 0) @@ -36,7 +36,9 @@ Point_3 = model.addPoint(Part_1_doc, 10, 10, 0) ### Create Sketch Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(5, 0, 0, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.result()) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 9.9999) @@ -60,7 +62,9 @@ model.do() ### Create Sketch Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_5 = Sketch_2.addLine(10, 0, 0, 0) -SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_4 = SketchProjection_4.createdFeature() Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchPoint_4.result()) SketchLine_6 = Sketch_2.addLine(0, 0, 0, 10) @@ -88,7 +92,13 @@ Face_2 = model.addFace(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")]) Face_2.result().setColor(0, 255, 0) ### Create Cut -Cut_1 = model.addCut(Part_1_doc, [model.selection("FACE", "Face_2_1")], [model.selection("FACE", "Face_1_1")], fuzzyParam = "fuzzy", keepSubResults = True) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("FACE", "Face_2_1")], + [model.selection("FACE", "Face_1_1")], + fuzzyParam="fuzzy", + keepSubResults=True, +) model.do() model.testNbResults(Cut_1, 1) @@ -98,7 +108,7 @@ model.testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.EDGE, [6]) model.testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [6]) ### Set a higher fuzzy value -Param_fuzzy.setValue(1.e-4) +Param_fuzzy.setValue(1.0e-4) model.do() model.end() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v0_1.py b/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v0_1.py index 393e1cb9f..87474b59b 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v0_1.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v0_1.py @@ -27,24 +27,69 @@ 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, 25, 5) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 10) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 25) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 10 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 25 +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OZ"), 30, 2) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 2) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "LinearCopy_1_1_1_2/MF:Translated&Extrusion_1_1/To_Face")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[LinearCopy_1_1_1_2/MF:Translated&Sketch_1/SketchCircle_1_2][LinearCopy_1_1_1_2/MF:Translated&Extrusion_1_1/To_Face]__cc"), False) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], + model.selection(), + 10, + 0, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 2, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "AngularCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 20, + 2, +) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection("FACE", "LinearCopy_1_1_1_2/MF:Translated&Extrusion_1_1/To_Face"), +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[LinearCopy_1_1_1_2/MF:Translated&Sketch_1/SketchCircle_1_2][LinearCopy_1_1_1_2/MF:Translated&Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() SketchCircle_2 = Sketch_2.addCircle(-3.839745962155611, 26.65063509461097, 3) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchCircle_2.center()) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchPoint_2.result(), SketchCircle_2.center() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], 3) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 5, 5) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_1_2")], [model.selection("SOLID", "Extrusion_2_1")]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], + model.selection(), + 5, + 5, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "LinearCopy_1_1_1_2")], + [model.selection("SOLID", "Extrusion_2_1")], +) model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc) @@ -60,4 +105,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [18]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [36]) model.testResultsVolumes(Cut_1, [1429.424657383355906858923844993]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v0_2.py b/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v0_2.py index 0e4daf32b..d588091f0 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v0_2.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v0_2.py @@ -26,32 +26,70 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 10) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) SketchCircle_2 = Sketch_1.addCircle(10, 0, 10) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_2.center() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0 +) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchCircle_3 = Sketch_2.addCircle(0, -7, 10) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.result(), SketchCircle_3.center()) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.result(), SketchCircle_3.center() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_3.results()[1], 10) -SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance(SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7) +SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance( + SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7 +) SketchCircle_4 = Sketch_2.addCircle(40, -27, 10) -SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_4.results()[1], SketchCircle_3.results()[1]) -SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance(SketchCircle_3.center(), SketchCircle_4.center(), 40) -SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchCircle_4.center(), SketchCircle_3.center(), 20) +SketchConstraintEqual_2 = Sketch_2.setEqual( + SketchCircle_4.results()[1], SketchCircle_3.results()[1] +) +SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance( + SketchCircle_3.center(), SketchCircle_4.center(), 40 +) +SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance( + SketchCircle_4.center(), SketchCircle_3.center(), 20 +) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")]) -Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPSOLID", "Extrusion_1_1")]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "Extrusion_2_2"), + ], +) +Compound_2 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "Compound_1_1"), + model.selection("COMPSOLID", "Extrusion_1_1"), + ], +) Compound_2.result().subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(1).setColor(255, 170, 0) @@ -64,45 +102,114 @@ SketchLine_3 = Sketch_3.addLine(7, 0, -7, 0) SketchLine_4 = Sketch_3.addLine(-7, 0, -7, 5) SketchLine_5 = Sketch_3.addLine(-7, 5, 7, 5) SketchLine_6 = Sketch_3.addLine(7, 5, 7, 0) -SketchConstraintCoincidence_4 = Sketch_3.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_4 = Sketch_3.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_3.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_3.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_3.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_3.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_3.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_6.result()) -SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_3 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_7 = SketchProjection_3.createdFeature() -SketchConstraintDistance_1 = Sketch_3.setDistance(SketchLine_5.endPoint(), SketchLine_7.result(), 7, True) -SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result()) +SketchConstraintDistance_1 = Sketch_3.setDistance( + SketchLine_5.endPoint(), SketchLine_7.result(), 7, True +) +SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint( + SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result() +) SketchConstraintLength_1 = Sketch_3.setLength(SketchLine_4.result(), 5) SketchLine_8 = Sketch_3.addLine(7, 7, -7.000000000000001, 7) SketchLine_9 = Sketch_3.addLine(-7.000000000000001, 7, -7.000000000000001, 10) SketchLine_10 = Sketch_3.addLine(-7.000000000000001, 10, 7, 10) SketchLine_11 = Sketch_3.addLine(7, 10, 7, 7) -SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_8 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_3.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_3.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_3.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_9.result()) SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_10.result()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_11.result()) -SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_9.startPoint(), SketchLine_4.result()) -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_8.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_12 = Sketch_3.setCoincident( + SketchLine_9.startPoint(), SketchLine_4.result() +) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_8.startPoint(), SketchLine_6.result() +) SketchConstraintLength_2 = Sketch_3.setLength(SketchLine_9.result(), 3) -SketchConstraintDistance_2 = Sketch_3.setDistance(SketchLine_9.startPoint(), SketchLine_5.result(), 2, True) +SketchConstraintDistance_2 = Sketch_3.setDistance( + SketchLine_9.startPoint(), SketchLine_5.result(), 2, True +) model.do() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")], model.selection(), 50, -10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r")], model.selection(), 60, 20) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_4_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_3 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], + model.selection(), + 50, + -10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r", + ) + ], + model.selection(), + 60, + 20, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_4_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_3 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_3.result().subResult(0).setColor(0, 170, 0) Compound_3.result().subResult(1).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(1).setColor(0, 255, 0) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_1"), model.selection("SOLID", "Compound_2_1_2_3")], [model.selection("SOLID", "Compound_3_1_2_2")]) +Cut_1 = model.addCut( + Part_1_doc, + [ + model.selection("SOLID", "Compound_2_1_1_1"), + model.selection("SOLID", "Compound_2_1_2_3"), + ], + [model.selection("SOLID", "Compound_3_1_2_2")], +) model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc) @@ -118,4 +225,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [36, 98]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [72, 196]) model.testResultsVolumes(Cut_1, [11801.1921223872, 9624.313983209351]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v20190506_1.py b/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v20190506_1.py index 29501a25c..4747aeecb 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v20190506_1.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v20190506_1.py @@ -27,24 +27,70 @@ 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, 25, 5) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 10) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 25) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 10 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 25 +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OZ"), 30, 2) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 2) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "LinearCopy_1_1_1_2/MF:Translated&Extrusion_1_1/To_Face")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[LinearCopy_1_1_1_2/MF:Translated&Sketch_1/SketchCircle_1_2][LinearCopy_1_1_1_2/MF:Translated&Extrusion_1_1/To_Face]__cc"), False) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], + model.selection(), + 10, + 0, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 2, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "AngularCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 20, + 2, +) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection("FACE", "LinearCopy_1_1_1_2/MF:Translated&Extrusion_1_1/To_Face"), +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[LinearCopy_1_1_1_2/MF:Translated&Sketch_1/SketchCircle_1_2][LinearCopy_1_1_1_2/MF:Translated&Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() SketchCircle_2 = Sketch_2.addCircle(-3.839745962155611, 26.65063509461097, 3) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchCircle_2.center()) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchPoint_2.result(), SketchCircle_2.center() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], 3) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 5, 5) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_1_2")], [model.selection("SOLID", "Extrusion_2_1")], keepSubResults = True) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], + model.selection(), + 5, + 5, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "LinearCopy_1_1_1_2")], + [model.selection("SOLID", "Extrusion_2_1")], + keepSubResults=True, +) model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc) @@ -60,4 +106,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [30]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [60]) model.testResultsVolumes(Cut_1, [3000.22098417825282]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v20190506_2.py b/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v20190506_2.py index df1f5c70a..4c7e6a823 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v20190506_2.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v20190506_2.py @@ -26,32 +26,70 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 10) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) SketchCircle_2 = Sketch_1.addCircle(10, 0, 10) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_2.center() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0 +) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchCircle_3 = Sketch_2.addCircle(0, -7, 10) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.result(), SketchCircle_3.center()) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.result(), SketchCircle_3.center() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_3.results()[1], 10) -SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance(SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7) +SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance( + SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7 +) SketchCircle_4 = Sketch_2.addCircle(40, -27, 10) -SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_4.results()[1], SketchCircle_3.results()[1]) -SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance(SketchCircle_3.center(), SketchCircle_4.center(), 40) -SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchCircle_4.center(), SketchCircle_3.center(), 20) +SketchConstraintEqual_2 = Sketch_2.setEqual( + SketchCircle_4.results()[1], SketchCircle_3.results()[1] +) +SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance( + SketchCircle_3.center(), SketchCircle_4.center(), 40 +) +SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance( + SketchCircle_4.center(), SketchCircle_3.center(), 20 +) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")]) -Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPSOLID", "Extrusion_1_1")]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "Extrusion_2_2"), + ], +) +Compound_2 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "Compound_1_1"), + model.selection("COMPSOLID", "Extrusion_1_1"), + ], +) Compound_2.result().subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(1).setColor(255, 170, 0) @@ -64,45 +102,115 @@ SketchLine_3 = Sketch_3.addLine(7, 0, -7, 0) SketchLine_4 = Sketch_3.addLine(-7, 0, -7, 5) SketchLine_5 = Sketch_3.addLine(-7, 5, 7, 5) SketchLine_6 = Sketch_3.addLine(7, 5, 7, 0) -SketchConstraintCoincidence_4 = Sketch_3.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_4 = Sketch_3.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_3.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_3.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_3.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_3.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_3.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_6.result()) -SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_3 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_7 = SketchProjection_3.createdFeature() -SketchConstraintDistance_1 = Sketch_3.setDistance(SketchLine_5.endPoint(), SketchLine_7.result(), 7, True) -SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result()) +SketchConstraintDistance_1 = Sketch_3.setDistance( + SketchLine_5.endPoint(), SketchLine_7.result(), 7, True +) +SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint( + SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result() +) SketchConstraintLength_1 = Sketch_3.setLength(SketchLine_4.result(), 5) SketchLine_8 = Sketch_3.addLine(7, 7, -7.000000000000001, 7) SketchLine_9 = Sketch_3.addLine(-7.000000000000001, 7, -7.000000000000001, 10) SketchLine_10 = Sketch_3.addLine(-7.000000000000001, 10, 7, 10) SketchLine_11 = Sketch_3.addLine(7, 10, 7, 7) -SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_8 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_3.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_3.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_3.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_9.result()) SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_10.result()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_11.result()) -SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_9.startPoint(), SketchLine_4.result()) -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_8.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_12 = Sketch_3.setCoincident( + SketchLine_9.startPoint(), SketchLine_4.result() +) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_8.startPoint(), SketchLine_6.result() +) SketchConstraintLength_2 = Sketch_3.setLength(SketchLine_9.result(), 3) -SketchConstraintDistance_2 = Sketch_3.setDistance(SketchLine_9.startPoint(), SketchLine_5.result(), 2, True) +SketchConstraintDistance_2 = Sketch_3.setDistance( + SketchLine_9.startPoint(), SketchLine_5.result(), 2, True +) model.do() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")], model.selection(), 50, -10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r")], model.selection(), 60, 20) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_4_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_3 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], + model.selection(), + 50, + -10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r", + ) + ], + model.selection(), + 60, + 20, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_4_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_3 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_3.result().subResult(0).setColor(0, 170, 0) Compound_3.result().subResult(1).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(1).setColor(0, 255, 0) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_1"), model.selection("SOLID", "Compound_2_1_2_3")], [model.selection("SOLID", "Compound_3_1_2_2")], keepSubResults = True) +Cut_1 = model.addCut( + Part_1_doc, + [ + model.selection("SOLID", "Compound_2_1_1_1"), + model.selection("SOLID", "Compound_2_1_2_3"), + ], + [model.selection("SOLID", "Compound_3_1_2_2")], + keepSubResults=True, +) model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc) @@ -118,4 +226,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [182]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [364]) model.testResultsVolumes(Cut_1, [27585.506105596567]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_ShellCompound_ShellCompound.py b/src/FeaturesPlugin/Test/TestBooleanCut_ShellCompound_ShellCompound.py index 93106867a..f816c4a17 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_ShellCompound_ShellCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_ShellCompound_ShellCompound.py @@ -24,37 +24,97 @@ 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(-174.3348611545506, 14.32227876658794, 70.49121821473575) -SketchLine_1 = Sketch_1.addLine(-170.8787982705978, 84.72872358712971, -177.6798961073988, -56.0895283864863) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) -SketchCircle_2 = Sketch_1.addCircle(156.5938368884866, -3.269359348234124, 86.69415181338225) -SketchLine_2 = Sketch_1.addLine(159.264749945663, 83.38363934242156, 152.8285624017236, -89.88170642808817) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchCircle_2.results()[1]) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_2.results()[1]) +SketchCircle_1 = Sketch_1.addCircle( + -174.3348611545506, 14.32227876658794, 70.49121821473575 +) +SketchLine_1 = Sketch_1.addLine( + -170.8787982705978, 84.72872358712971, -177.6798961073988, -56.0895283864863 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) +SketchCircle_2 = Sketch_1.addCircle( + 156.5938368884866, -3.269359348234124, 86.69415181338225 +) +SketchLine_2 = Sketch_1.addLine( + 159.264749945663, 83.38363934242156, 152.8285624017236, -89.88170642808817 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchCircle_2.results()[1] +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchCircle_2.results()[1] +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_3 = Sketch_2.addCircle(-63.56168377478743, 4.78844798363732, 75.55300890562218) -SketchCircle_4 = Sketch_2.addCircle(322.6564034385849, -22.92418256149703, 118.030609731015) -SketchLine_3 = Sketch_2.addLine(-138.9405630492767, 9.915017403336009, 11.9830331245263, 5.907779612586542) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_3.startPoint(), SketchCircle_3.results()[1]) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchCircle_3.results()[1]) -SketchLine_4 = Sketch_2.addLine(207.6267015097382, 3.521847530670962, 440.2647819790861, -32.89885701981125) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchCircle_4.results()[1]) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchCircle_4.results()[1]) +SketchCircle_3 = Sketch_2.addCircle( + -63.56168377478743, 4.78844798363732, 75.55300890562218 +) +SketchCircle_4 = Sketch_2.addCircle( + 322.6564034385849, -22.92418256149703, 118.030609731015 +) +SketchLine_3 = Sketch_2.addLine( + -138.9405630492767, 9.915017403336009, 11.9830331245263, 5.907779612586542 +) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_3.startPoint(), SketchCircle_3.results()[1] +) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchCircle_3.results()[1] +) +SketchLine_4 = Sketch_2.addLine( + 207.6267015097382, 3.521847530670962, 440.2647819790861, -32.89885701981125 +) +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_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_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_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_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")]) -Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], [model.selection("COMPOUND", "Compound_2_1")]) +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")], +) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [2]) @@ -63,4 +123,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [4]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [14]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [28]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_Shell_Shell.py b/src/FeaturesPlugin/Test/TestBooleanCut_Shell_Shell.py index 15d920670..bf75afb26 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_Shell_Shell.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_Shell_Shell.py @@ -24,25 +24,54 @@ 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(-32.92409574173262, 1.332083115848444, 52.41665939244462) -SketchLine_1 = Sketch_1.addLine(-32.3899127495535, 53.7460204836366, -32.9246838934834, -51.08457627329644) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) +SketchCircle_1 = Sketch_1.addCircle( + -32.92409574173262, 1.332083115848444, 52.41665939244462 +) +SketchLine_1 = Sketch_1.addLine( + -32.3899127495535, 53.7460204836366, -32.9246838934834, -51.08457627329644 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_2 = Sketch_2.addCircle(52.19056504290929, 1.630574981545157, 59.89949304384059) -SketchLine_2 = Sketch_2.addLine(112.0898160449407, 1.460291967886176, -7.70480537031941, 0.9278161529026914) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchCircle_2.results()[1]) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchCircle_2.results()[1]) +SketchCircle_2 = Sketch_2.addCircle( + 52.19056504290929, 1.630574981545157, 59.89949304384059 +) +SketchLine_2 = Sketch_2.addLine( + 112.0898160449407, 1.460291967886176, -7.70480537031941, 0.9278161529026914 +) +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_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_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")]) +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) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [0]) @@ -51,4 +80,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [2]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [7]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [14]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_SolidCompound_SolidCompound.py b/src/FeaturesPlugin/Test/TestBooleanCut_SolidCompound_SolidCompound.py index 706ac7274..07ff0d4ad 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_SolidCompound_SolidCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_SolidCompound_SolidCompound.py @@ -24,23 +24,51 @@ 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(-64.66755707084829, 12.13132840151158, 21.07964902130243) -SketchCircle_2 = Sketch_1.addCircle(45.61684376247555, 1.775642744728198, 22.96122819474142) +SketchCircle_1 = Sketch_1.addCircle( + -64.66755707084829, 12.13132840151158, 21.07964902130243 +) +SketchCircle_2 = Sketch_1.addCircle( + 45.61684376247555, 1.775642744728198, 22.96122819474142 +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_3 = Sketch_2.addCircle(-36.49725872565889, 7.160803013521951, 17.872664608039) -SketchCircle_4 = Sketch_2.addCircle(78.03127953954764, -3.93858425080257, 22.76570299983515) +SketchCircle_3 = Sketch_2.addCircle( + -36.49725872565889, 7.160803013521951, 17.872664608039 +) +SketchCircle_4 = Sketch_2.addCircle( + 78.03127953954764, -3.93858425080257, 22.76570299983515 +) 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_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")]) +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_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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [2]) @@ -49,4 +77,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [8]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [48]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_Solid_Compound.py b/src/FeaturesPlugin/Test/TestBooleanCut_Solid_Compound.py index acbf11f8f..0afd4ecac 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_Solid_Compound.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_Solid_Compound.py @@ -29,40 +29,60 @@ partSet = model.moduleDocument() ### Create Part Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -model.addParameter(Part_1_doc, "nb", '6') +model.addParameter(Part_1_doc, "nb", "6") ### Create Cylinder -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) ### Create Sketch Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Cylinder_1_1/Face_3")) ### Create SketchLine -SketchLine_1 = Sketch_1.addLine(-3.635759493440736, -2.855949413069177, 3.547995857301719, -2.855949413069177) +SketchLine_1 = Sketch_1.addLine( + -3.635759493440736, -2.855949413069177, 3.547995857301719, -2.855949413069177 +) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() ### Create SketchLine -SketchLine_3 = Sketch_1.addLine(3.547995857301719, -2.855949413069177, 3.547995857301719, -5.405023892364889) +SketchLine_3 = Sketch_1.addLine( + 3.547995857301719, -2.855949413069177, 3.547995857301719, -5.405023892364889 +) ### Create SketchLine -SketchLine_4 = Sketch_1.addLine(3.547995857301719, -5.405023892364889, -3.635759493440736, -5.405023892364889) +SketchLine_4 = Sketch_1.addLine( + 3.547995857301719, -5.405023892364889, -3.635759493440736, -5.405023892364889 +) ### Create SketchLine -SketchLine_5 = Sketch_1.addLine(-3.635759493440736, -5.405023892364889, -3.635759493440736, -2.855949413069177) +SketchLine_5 = Sketch_1.addLine( + -3.635759493440736, -5.405023892364889, -3.635759493440736, -2.855949413069177 +) Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.startPoint()) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) ### Create SketchLine -SketchLine_6 = Sketch_1.addLine(-3.635759493440736, -2.855949413069177, 3.547995857301719, -5.405023892364889) +SketchLine_6 = Sketch_1.addLine( + -3.635759493440736, -2.855949413069177, 3.547995857301719, -5.405023892364889 +) SketchLine_6.setAuxiliary(True) ### Create SketchLine -SketchLine_7 = Sketch_1.addLine(3.547995857301719, -2.855949413069177, -3.635759493440736, -5.405023892364889) +SketchLine_7 = Sketch_1.addLine( + 3.547995857301719, -2.855949413069177, -3.635759493440736, -5.405023892364889 +) SketchLine_7.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.startPoint()) Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_7.startPoint()) @@ -75,13 +95,36 @@ Sketch_1.setVertical(SketchLine_5.result()) model.do() ### Create Extrusion -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r")], model.selection(), 1, 11, "Faces|Wires") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r", + ) + ], + model.selection(), + 1, + 11, + "Faces|Wires", +) ### Create AngularCopy -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OZ"), "nb", keepSubResults = True) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OZ"), + "nb", + keepSubResults=True, +) ### Create Cut -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], [model.selection("COMPOUND", "AngularCopy_1_1")], keepSubResults = True) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + [model.selection("COMPOUND", "AngularCopy_1_1")], + keepSubResults=True, +) model.do() model.end() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_Solid_Solid.py b/src/FeaturesPlugin/Test/TestBooleanCut_Solid_Solid.py index 31aa3bbd7..17372b973 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_Solid_Solid.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_Solid_Solid.py @@ -24,40 +24,82 @@ 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.58517034068135, 30.56312625250501, -33.39679358717434, 30.56312625250501) -SketchLine_2 = Sketch_1.addLine(-33.39679358717434, 30.56312625250501, -33.39679358717434, -16.39478957915832) -SketchLine_3 = Sketch_1.addLine(-33.39679358717434, -16.39478957915832, 15.58517034068135, -16.39478957915832) -SketchLine_4 = Sketch_1.addLine(15.58517034068135, -16.39478957915832, 15.58517034068135, 30.56312625250501) -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()) +SketchLine_1 = Sketch_1.addLine( + 15.58517034068135, 30.56312625250501, -33.39679358717434, 30.56312625250501 +) +SketchLine_2 = Sketch_1.addLine( + -33.39679358717434, 30.56312625250501, -33.39679358717434, -16.39478957915832 +) +SketchLine_3 = Sketch_1.addLine( + -33.39679358717434, -16.39478957915832, 15.58517034068135, -16.39478957915832 +) +SketchLine_4 = Sketch_1.addLine( + 15.58517034068135, -16.39478957915832, 15.58517034068135, 30.56312625250501 +) +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() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_5 = Sketch_2.addLine(35.01603206412826, 45.13627254509017, -8.298597194388776, 45.13627254509017) -SketchLine_6 = Sketch_2.addLine(-8.298597194388776, 45.13627254509017, -8.298597194388776, 6.679358717434865) -SketchLine_7 = Sketch_2.addLine(-8.298597194388776, 6.679358717434865, 35.01603206412826, 6.679358717434865) -SketchLine_8 = Sketch_2.addLine(35.01603206412826, 6.679358717434865, 35.01603206412826, 45.13627254509017) -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()) +SketchLine_5 = Sketch_2.addLine( + 35.01603206412826, 45.13627254509017, -8.298597194388776, 45.13627254509017 +) +SketchLine_6 = Sketch_2.addLine( + -8.298597194388776, 45.13627254509017, -8.298597194388776, 6.679358717434865 +) +SketchLine_7 = Sketch_2.addLine( + -8.298597194388776, 6.679358717434865, 35.01603206412826, 6.679358717434865 +) +SketchLine_8 = Sketch_2.addLine( + 35.01603206412826, 6.679358717434865, 35.01603206412826, 45.13627254509017 +) +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()) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1"), model.selection("COMPOUND", "Sketch_2")], model.selection(), 100, 0) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_1_2")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1"), model.selection("COMPOUND", "Sketch_2")], + model.selection(), + 100, + 0, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + [model.selection("SOLID", "Extrusion_1_2")], +) model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [0]) @@ -66,4 +108,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [8]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [36]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [72]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_SolidsHistory.py b/src/FeaturesPlugin/Test/TestBooleanCut_SolidsHistory.py index e00368422..f0d47493c 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_SolidsHistory.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_SolidsHistory.py @@ -29,28 +29,76 @@ 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.57884322822754, 25.90966115484096, 9.63424990252037) -SketchLine_1 = Sketch_1.addLine(-18.29572175958338, 20.14177099321736, -2.288684850537554, 30.81802598002054) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) +SketchCircle_1 = Sketch_1.addCircle( + -10.57884322822754, 25.90966115484096, 9.63424990252037 +) +SketchLine_1 = Sketch_1.addLine( + -18.29572175958338, 20.14177099321736, -2.288684850537554, 30.81802598002054 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_2 = Sketch_2.addLine(7.424373233594292, 20.04016872303595, -10.19950738916256, 28.60837438423646) -SketchLine_3 = Sketch_2.addLine(-10.19950738916256, 28.60837438423646, 10.7835313495703, 29.11992811073657) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_2.addLine(10.7835313495703, 29.11992811073657, 7.424373233594292, 20.04016872303595) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchLine_4.endPoint()) -SketchLine_5 = Sketch_2.addLine(-10.19950738916256, 28.60837438423646, 9.111243103183778, 24.59975538297626) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_4.result()) +SketchLine_2 = Sketch_2.addLine( + 7.424373233594292, 20.04016872303595, -10.19950738916256, 28.60837438423646 +) +SketchLine_3 = Sketch_2.addLine( + -10.19950738916256, 28.60837438423646, 10.7835313495703, 29.11992811073657 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_2.addLine( + 10.7835313495703, 29.11992811073657, 7.424373233594292, 20.04016872303595 +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_2.startPoint(), SketchLine_4.endPoint() +) +SketchLine_5 = Sketch_2.addLine( + -10.19950738916256, 28.60837438423646, 9.111243103183778, 24.59975538297626 +) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_4.result() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1"), model.selection("COMPOUND", "all-in-Sketch_2")], model.selection(), 10, 0) -Group_1_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_2_2"), model.selection("SOLID", "Extrusion_1_2_1")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Sketch_1"), + model.selection("COMPOUND", "all-in-Sketch_2"), + ], + model.selection(), + 10, + 0, +) +Group_1_objects = [ + model.selection("SOLID", "Extrusion_1_1_2"), + model.selection("SOLID", "Extrusion_1_1_1"), + model.selection("SOLID", "Extrusion_1_2_2"), + model.selection("SOLID", "Extrusion_1_2_1"), +] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) -Group_2_objects = [model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1_2/To_Face"), model.selection("FACE", "Extrusion_1_2_2/To_Face")] +Group_2_objects = [ + model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1"), + model.selection("FACE", "Extrusion_1_1_2/To_Face"), + model.selection("FACE", "Extrusion_1_2_2/To_Face"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2")], [model.selection("SOLID", "Extrusion_1_2_2")]) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1_2")], + [model.selection("SOLID", "Extrusion_1_2_2")], +) model.do() # move groups after the Cut Part_1_doc.moveFeature(Group_1.feature(), Cut_1.feature()) @@ -60,15 +108,15 @@ model.end() # check groups are correct aFactory = ModelAPI_Session.get().validators() selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 2) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 2 +assert aFactory.validate(Group_1.feature()) for i in range(2): - assert(Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID) + assert Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 3) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 3 +assert aFactory.validate(Group_2.feature()) for i in range(3): - assert(Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE) + assert Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_VertexCompound_Solid.py b/src/FeaturesPlugin/Test/TestBooleanCut_VertexCompound_Solid.py index a8932c70e..d0d09d71c 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_VertexCompound_Solid.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_VertexCompound_Solid.py @@ -29,24 +29,60 @@ 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/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_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) -SketchLine_2 = Sketch_2.addLine(-43.32915483490565, 45.75316349699826, -43.32915483490565, 20.90707471054887) -SketchLine_3 = Sketch_2.addLine(-43.32915483490565, 20.90707471054887, 42.11715050385933, 20.90707471054887) -SketchLine_4 = Sketch_2.addLine(42.11715050385933, 20.90707471054887, 42.11715050385933, 45.75316349699826) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_1 = Sketch_2.addLine( + 42.11715050385933, 45.75316349699826, -43.32915483490565, 45.75316349699826 +) +SketchLine_2 = Sketch_2.addLine( + -43.32915483490565, 45.75316349699826, -43.32915483490565, 20.90707471054887 +) +SketchLine_3 = Sketch_2.addLine( + -43.32915483490565, 20.90707471054887, 42.11715050385933, 20.90707471054887 +) +SketchLine_4 = Sketch_2.addLine( + 42.11715050385933, 20.90707471054887, 42.11715050385933, 45.75316349699826 +) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_1.result()) 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_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")]) +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() model.end() @@ -60,4 +96,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [0]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [2]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_VertexCompound_VertexCompound.py b/src/FeaturesPlugin/Test/TestBooleanCut_VertexCompound_VertexCompound.py index 3900c4394..46bbfb574 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_VertexCompound_VertexCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_VertexCompound_VertexCompound.py @@ -29,15 +29,30 @@ 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/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_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/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")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [2]) @@ -46,4 +61,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [0]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [2]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_Vertex_Vertex.py b/src/FeaturesPlugin/Test/TestBooleanCut_Vertex_Vertex.py index 460280958..bef0f7972 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_Vertex_Vertex.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_Vertex_Vertex.py @@ -27,17 +27,33 @@ 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/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")]) +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_2, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 0) model.testNbSubResults(Cut_1, []) @@ -53,4 +69,4 @@ model.testNbSubShapes(Cut_2, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Cut_2, GeomAPI_Shape.EDGE, [0]) model.testNbSubShapes(Cut_2, GeomAPI_Shape.VERTEX, [1]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_WireCompound_WireCompound.py b/src/FeaturesPlugin/Test/TestBooleanCut_WireCompound_WireCompound.py index 25f7da346..b99803b35 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_WireCompound_WireCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_WireCompound_WireCompound.py @@ -24,33 +24,91 @@ 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(-64.96569468267583, 22.00171526586621, -41.05831903945112, 55.95711835334479) -SketchLine_2 = Sketch_1.addLine(-41.05831903945112, 55.95711835334479, -23.04116638078903, 21.65523156089195) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(14.72555746140652, 19.92281303602059, 33.43567753001715, 55.95711835334479) -SketchLine_4 = Sketch_1.addLine(33.43567753001715, 55.95711835334479, 50.75986277873073, 22.69468267581476) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_1 = Sketch_1.addLine( + -64.96569468267583, 22.00171526586621, -41.05831903945112, 55.95711835334479 +) +SketchLine_2 = Sketch_1.addLine( + -41.05831903945112, 55.95711835334479, -23.04116638078903, 21.65523156089195 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 14.72555746140652, 19.92281303602059, 33.43567753001715, 55.95711835334479 +) +SketchLine_4 = Sketch_1.addLine( + 33.43567753001715, 55.95711835334479, 50.75986277873073, 22.69468267581476 +) +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.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.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()) +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.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/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")]) +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")], +) model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [2]) @@ -59,4 +117,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [8]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [16]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_Wire_Face.py b/src/FeaturesPlugin/Test/TestBooleanCut_Wire_Face.py index 33a1604b6..b0270cb06 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_Wire_Face.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_Wire_Face.py @@ -24,24 +24,46 @@ 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(-26.15951972555746, 50.06689536878219, -17.15094339622642, 14.37907375643225) -SketchLine_2 = Sketch_1.addLine(-17.15094339622642, 14.37907375643225, 26.85248713550602, 14.72555746140652) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(26.85248713550602, 14.72555746140652, 34.47512864493997, 50.41337907375645) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_1 = Sketch_1.addLine( + -26.15951972555746, 50.06689536878219, -17.15094339622642, 14.37907375643225 +) +SketchLine_2 = Sketch_1.addLine( + -17.15094339622642, 14.37907375643225, 26.85248713550602, 14.72555746140652 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 26.85248713550602, 14.72555746140652, 34.47512864493997, 50.41337907375645 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_1 = Sketch_2.addCircle(3.984562607204112, 58.72898799313897, 38.16357190022508) +SketchCircle_1 = Sketch_2.addCircle( + 3.984562607204112, 58.72898799313897, 38.16357190022508 +) model.do() -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_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/SketchCircle_1_2")]) -Cut_1 = model.addCut(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("FACE", "Face_1_1")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [0]) @@ -50,4 +72,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [3]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [6]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_Wire_Wire.py b/src/FeaturesPlugin/Test/TestBooleanCut_Wire_Wire.py index d5588a674..4ba5a8287 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_Wire_Wire.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_Wire_Wire.py @@ -24,24 +24,54 @@ 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(-67.98180952066137, 66.89107262893774, -22.72663773945906, 26.22700523133564) -SketchLine_2 = Sketch_1.addLine(-22.72663773945906, 26.22700523133564, 31.71074280894377, 25.5711331765356) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(31.71074280894377, 25.5711331765356, 74.99829842574599, 68.85868879333785) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-58.79960075346089, 25.5711331765356, 3.508244452542322, 60.3323520809374) -SketchLine_5 = Sketch_1.addLine(3.508244452542322, 60.3323520809374, 63.1926014393454, 22.94764495733547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchLine_1 = Sketch_1.addLine( + -67.98180952066137, 66.89107262893774, -22.72663773945906, 26.22700523133564 +) +SketchLine_2 = Sketch_1.addLine( + -22.72663773945906, 26.22700523133564, 31.71074280894377, 25.5711331765356 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 31.71074280894377, 25.5711331765356, 74.99829842574599, 68.85868879333785 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -58.79960075346089, 25.5711331765356, 3.508244452542322, 60.3323520809374 +) +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/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/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/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")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [0]) @@ -50,4 +80,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [5]) model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [10]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolidCompound_CompSolidCompound.py b/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolidCompound_CompSolidCompound.py index 35b1be75e..5edc47472 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolidCompound_CompSolidCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolidCompound_CompSolidCompound.py @@ -24,63 +24,174 @@ 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(-81.42367066895368, 33.08919382504288, -49.89365351629502, 58.72898799313894) -SketchLine_2 = Sketch_1.addLine(-49.89365351629502, 58.72898799313894, -14.89879931389364, 32.04974271012008) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(-14.89879931389364, 32.04974271012008, -45.04288164665522, 2.598627787307022) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-45.04288164665522, 2.598627787307022, -81.42367066895368, 33.08919382504288) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint()) -SketchLine_5 = Sketch_1.addLine(-49.89365351629502, 58.72898799313894, -45.04288164665522, 2.598627787307022) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_5.endPoint()) -SketchLine_6 = Sketch_1.addLine(40.88507718696397, 37.93996569468268, 70.33619210977699, 65.31217838765009) -SketchLine_7 = Sketch_1.addLine(70.33619210977699, 65.31217838765009, 91.81818181818181, 33.43567753001717) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchLine_8 = Sketch_1.addLine(91.81818181818181, 33.43567753001717, 59.24871355060034, 6.756432246998279) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchLine_9 = Sketch_1.addLine(59.24871355060034, 6.756432246998279, 40.88507718696397, 37.93996569468268) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_9.endPoint()) -SketchLine_10 = Sketch_1.addLine(70.33619210977699, 65.31217838765009, 59.24871355060034, 6.756432246998279) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_10.endPoint()) +SketchLine_1 = Sketch_1.addLine( + -81.42367066895368, 33.08919382504288, -49.89365351629502, 58.72898799313894 +) +SketchLine_2 = Sketch_1.addLine( + -49.89365351629502, 58.72898799313894, -14.89879931389364, 32.04974271012008 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + -14.89879931389364, 32.04974271012008, -45.04288164665522, 2.598627787307022 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -45.04288164665522, 2.598627787307022, -81.42367066895368, 33.08919382504288 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_4.endPoint() +) +SketchLine_5 = Sketch_1.addLine( + -49.89365351629502, 58.72898799313894, -45.04288164665522, 2.598627787307022 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_5.endPoint() +) +SketchLine_6 = Sketch_1.addLine( + 40.88507718696397, 37.93996569468268, 70.33619210977699, 65.31217838765009 +) +SketchLine_7 = Sketch_1.addLine( + 70.33619210977699, 65.31217838765009, 91.81818181818181, 33.43567753001717 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchLine_8 = Sketch_1.addLine( + 91.81818181818181, 33.43567753001717, 59.24871355060034, 6.756432246998279 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchLine_9 = Sketch_1.addLine( + 59.24871355060034, 6.756432246998279, 40.88507718696397, 37.93996569468268 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchLine_9.endPoint() +) +SketchLine_10 = Sketch_1.addLine( + 70.33619210977699, 65.31217838765009, 59.24871355060034, 6.756432246998279 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_10.endPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_11 = Sketch_2.addLine(-24.25385934819896, -5.370497427101204, -36.03430531732418, 28.93138936535163) -SketchLine_12 = Sketch_2.addLine(-36.03430531732418, 28.93138936535163, -6.23670668953688, 16.80445969125213) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchLine_13 = Sketch_2.addLine(-6.23670668953688, 16.80445969125213, -4.850771869639785, -14.37907375643225) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchLine_14 = Sketch_2.addLine(-4.850771869639785, -14.37907375643225, -24.25385934819896, -5.370497427101204) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchLine_14.endPoint()) -SketchLine_15 = Sketch_2.addLine(-24.25385934819896, -5.370497427101204, -6.23670668953688, 16.80445969125213) -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_15.endPoint()) -SketchLine_16 = Sketch_2.addLine(32.22298456260721, 12.30017152658662, 55.78387650085761, 33.78216123499142) -SketchLine_17 = Sketch_2.addLine(55.78387650085761, 33.78216123499142, 51.27958833619211, 2.252144082332767) -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) -SketchLine_18 = Sketch_2.addLine(51.27958833619211, 2.252144082332767, 27.71869639794167, -15.41852487135506) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) -SketchLine_19 = Sketch_2.addLine(27.71869639794167, -15.41852487135506, 32.22298456260721, 12.30017152658662) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchLine_19.endPoint()) -SketchLine_20 = Sketch_2.addLine(32.22298456260721, 12.30017152658662, 51.27958833619211, 2.252144082332767) -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_20.endPoint()) +SketchLine_11 = Sketch_2.addLine( + -24.25385934819896, -5.370497427101204, -36.03430531732418, 28.93138936535163 +) +SketchLine_12 = Sketch_2.addLine( + -36.03430531732418, 28.93138936535163, -6.23670668953688, 16.80445969125213 +) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchLine_13 = Sketch_2.addLine( + -6.23670668953688, 16.80445969125213, -4.850771869639785, -14.37907375643225 +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchLine_14 = Sketch_2.addLine( + -4.850771869639785, -14.37907375643225, -24.25385934819896, -5.370497427101204 +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_11.startPoint(), SketchLine_14.endPoint() +) +SketchLine_15 = Sketch_2.addLine( + -24.25385934819896, -5.370497427101204, -6.23670668953688, 16.80445969125213 +) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchLine_11.startPoint(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_15.endPoint() +) +SketchLine_16 = Sketch_2.addLine( + 32.22298456260721, 12.30017152658662, 55.78387650085761, 33.78216123499142 +) +SketchLine_17 = Sketch_2.addLine( + 55.78387650085761, 33.78216123499142, 51.27958833619211, 2.252144082332767 +) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) +SketchLine_18 = Sketch_2.addLine( + 51.27958833619211, 2.252144082332767, 27.71869639794167, -15.41852487135506 +) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) +SketchLine_19 = Sketch_2.addLine( + 27.71869639794167, -15.41852487135506, 32.22298456260721, 12.30017152658662 +) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_16.startPoint(), SketchLine_19.endPoint() +) +SketchLine_20 = Sketch_2.addLine( + 32.22298456260721, 12.30017152658662, 51.27958833619211, 2.252144082332767 +) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_16.startPoint(), SketchLine_20.startPoint() +) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchLine_17.endPoint(), SketchLine_20.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_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) +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_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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [2]) @@ -89,4 +200,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [24]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [108]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [216]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolid_CompSolid.py b/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolid_CompSolid.py index f5d044b02..12f74d455 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolid_CompSolid.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolid_CompSolid.py @@ -24,38 +24,95 @@ 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(-87.19866468842729, 38.44668397626113, -52.3191988130564, 59.05727744807122) -SketchLine_2 = Sketch_1.addLine(-52.3191988130564, 59.05727744807122, -10.30529673590503, 36.86125370919882) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(-10.30529673590503, 36.86125370919882, -59.45363501483681, 10.70165430267062) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-59.45363501483681, 10.70165430267062, -87.19866468842729, 38.44668397626113) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint()) -SketchLine_5 = Sketch_1.addLine(-52.3191988130564, 59.05727744807122, -59.45363501483681, 10.70165430267062) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_5.endPoint()) +SketchLine_1 = Sketch_1.addLine( + -87.19866468842729, 38.44668397626113, -52.3191988130564, 59.05727744807122 +) +SketchLine_2 = Sketch_1.addLine( + -52.3191988130564, 59.05727744807122, -10.30529673590503, 36.86125370919882 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + -10.30529673590503, 36.86125370919882, -59.45363501483681, 10.70165430267062 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -59.45363501483681, 10.70165430267062, -87.19866468842729, 38.44668397626113 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_4.endPoint() +) +SketchLine_5 = Sketch_1.addLine( + -52.3191988130564, 59.05727744807122, -59.45363501483681, 10.70165430267062 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_5.endPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_6 = Sketch_2.addLine(-44.00943641618498, -5.404667630057807, -42.4652456647399, 37.06057803468208) -SketchLine_7 = Sketch_2.addLine(-42.4652456647399, 37.06057803468208, -11.58143063583817, 13.12562138728323) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchLine_8 = Sketch_2.addLine(-11.58143063583817, 13.12562138728323, -16.2140028901734, -17.75819364161849) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchLine_9 = Sketch_2.addLine(-16.2140028901734, -17.75819364161849, -44.00943641618498, -5.404667630057807) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_6.startPoint(), SketchLine_9.endPoint()) -SketchLine_10 = Sketch_2.addLine(-44.00943641618498, -5.404667630057807, -11.58143063583817, 13.12562138728323) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_6.startPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_10.endPoint()) +SketchLine_6 = Sketch_2.addLine( + -44.00943641618498, -5.404667630057807, -42.4652456647399, 37.06057803468208 +) +SketchLine_7 = Sketch_2.addLine( + -42.4652456647399, 37.06057803468208, -11.58143063583817, 13.12562138728323 +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchLine_8 = Sketch_2.addLine( + -11.58143063583817, 13.12562138728323, -16.2140028901734, -17.75819364161849 +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchLine_9 = Sketch_2.addLine( + -16.2140028901734, -17.75819364161849, -44.00943641618498, -5.404667630057807 +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_6.startPoint(), SketchLine_9.endPoint() +) +SketchLine_10 = Sketch_2.addLine( + -44.00943641618498, -5.404667630057807, -11.58143063583817, 13.12562138728323 +) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_6.startPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_10.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1"), model.selection("COMPOUND", "Sketch_2")], model.selection(), 10, 0) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_1_2")], True) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1"), model.selection("COMPOUND", "Sketch_2")], + model.selection(), + 10, + 0, +) +Fuse_1 = model.addFuse( + Part_1_doc, + [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPSOLID", "Extrusion_1_2"), + ], + True, +) model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [1]) @@ -64,4 +121,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [11]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [54]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [108]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolid_Face.py b/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolid_Face.py index f50e2a35d..1a67dcdc4 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolid_Face.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolid_Face.py @@ -25,31 +25,73 @@ 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) +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()) +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()) +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) +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()) +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")]) +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]) @@ -59,7 +101,14 @@ 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")]) +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")], +) model.testNbResults(Fuse_2, 1) model.testNbSubResults(Fuse_2, [2]) diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_EdgeCompound_EdgeCompound.py b/src/FeaturesPlugin/Test/TestBooleanFuse_EdgeCompound_EdgeCompound.py index 280f43f80..9720c8f03 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_EdgeCompound_EdgeCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_EdgeCompound_EdgeCompound.py @@ -24,23 +24,48 @@ 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(-71.60846560846564, -5.878306878306883, -32.06349206349206, 30.99470899470901) -SketchLine_2 = Sketch_1.addLine(17.63492063492066, -11.75661375661376, 49.16402116402119, 24.04761904761905) +SketchLine_1 = Sketch_1.addLine( + -71.60846560846564, -5.878306878306883, -32.06349206349206, 30.99470899470901 +) +SketchLine_2 = Sketch_1.addLine( + 17.63492063492066, -11.75661375661376, 49.16402116402119, 24.04761904761905 +) model.do() 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) +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/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_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")]) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")]) +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")], +) +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) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [8]) @@ -49,4 +74,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [8]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [16]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_Edge_Edge.py b/src/FeaturesPlugin/Test/TestBooleanFuse_Edge_Edge.py index 8a8f33b9d..a12965035 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_Edge_Edge.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_Edge_Edge.py @@ -24,18 +24,31 @@ 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(-37.40740740740741, -11.75661375661376, 41.14814814814816, 42.75132275132275) +SketchLine_1 = Sketch_1.addLine( + -37.40740740740741, -11.75661375661376, 41.14814814814816, 42.75132275132275 +) 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) +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/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")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [4]) @@ -44,4 +57,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [8]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_ErrorMsg.py b/src/FeaturesPlugin/Test/TestBooleanFuse_ErrorMsg.py index 9e35a9507..31b1f50e5 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_ErrorMsg.py @@ -23,31 +23,51 @@ 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")]) +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() != "") +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")]) +Fuse_1 = model.addFuse( + Part_1_doc, + [ + model.selection("SOLID", "Partition_1_1_1"), + model.selection("SOLID", "Partition_1_1_2"), + ], +) # after merging Union and Fuse features, fusing of solids in the same composolid should work (issue #3062) -assert(Fuse_1.feature().error() == "") +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")]) +Fuse_1 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Partition_1_1_1")], + [model.selection("SOLID", "Partition_1_1_2")], +) # after merging Union and Fuse features, fusing of solids in the same composolid should work (issue #3062) -assert(Fuse_1.feature().error() == "") +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() != "") +assert Fuse_1.error() != "" aSession.finishOperation() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_FaceCompound_FaceCompound.py b/src/FeaturesPlugin/Test/TestBooleanFuse_FaceCompound_FaceCompound.py index b36d0afcc..a52e496b7 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_FaceCompound_FaceCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_FaceCompound_FaceCompound.py @@ -24,25 +24,54 @@ 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(-35.3684929577465, 31.98214788732393, 24.26807713993482) -SketchCircle_2 = Sketch_1.addCircle(51.92395774647893, 31.22962676056337, 25.62994603225585) +SketchCircle_1 = Sketch_1.addCircle( + -35.3684929577465, 31.98214788732393, 24.26807713993482 +) +SketchCircle_2 = Sketch_1.addCircle( + 51.92395774647893, 31.22962676056337, 25.62994603225585 +) model.do() 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) +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_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_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")]) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")], True) +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_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")], +) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [2]) @@ -51,4 +80,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [2]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [8]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_Face_Face.py b/src/FeaturesPlugin/Test/TestBooleanFuse_Face_Face.py index 9404608e2..1c5547217 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_Face_Face.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_Face_Face.py @@ -24,19 +24,31 @@ 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(-12.81989708404803, 27.54545454545454, 25.29331046312177) +SketchCircle_1 = Sketch_1.addCircle( + -12.81989708404803, 27.54545454545454, 25.29331046312177 +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_2 = Sketch_2.addCircle(22.86792452830187, 26.50600343053173, 30.90704565816075) +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/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) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [0]) @@ -45,4 +57,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [1]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [2]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [4]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_Fuzzy.py b/src/FeaturesPlugin/Test/TestBooleanFuse_Fuzzy.py index 7d1a7a417..99f05262e 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_Fuzzy.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_Fuzzy.py @@ -25,7 +25,7 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Param_fuzzy = model.addParameter(Part_1_doc, "fuzzy", '1e-07') +Param_fuzzy = model.addParameter(Part_1_doc, "fuzzy", "1e-07") Point_2 = model.addPoint(Part_1_doc, 10, 0, 0) Point_3 = model.addPoint(Part_1_doc, 20, 10.0001, 10.0001) @@ -34,10 +34,19 @@ Point_3 = model.addPoint(Part_1_doc, 20, 10.0001, 10.0001) Box_1 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Box -Box_2 = model.addBox(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")) +Box_2 = model.addBox( + Part_1_doc, + model.selection("VERTEX", "Point_1"), + model.selection("VERTEX", "Point_2"), +) ### Create Fuse -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Box_2_1")], fuzzyParam = "fuzzy", keepSubResults = True) +Fuse_1 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Box_2_1")], + fuzzyParam="fuzzy", + keepSubResults=True, +) model.do() model.testNbResults(Fuse_1, 1) @@ -49,7 +58,7 @@ model.testNbUniqueSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [15]) model.testResultsVolumes(Fuse_1, [2000.02000010]) ### Set a higher fuzzy value -Param_fuzzy.setValue(1.e-4) +Param_fuzzy.setValue(1.0e-4) model.do() model.end() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v0_1.py b/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v0_1.py index b59870cc9..ae6fee9e9 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v0_1.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v0_1.py @@ -25,9 +25,27 @@ 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"), 10, 20) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 40, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 20, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 40, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) LinearCopy_2.result().subResult(0).subResult(0).setColor(255, 170, 0) LinearCopy_2.result().subResult(0).subResult(1).setColor(255, 170, 0) LinearCopy_2.result().subResult(1).subResult(0).setColor(0, 0, 255) @@ -37,47 +55,117 @@ SketchLine_1 = Sketch_1.addLine(7, 0, -7, 0) SketchLine_2 = Sketch_1.addLine(-7, 0, -7, 5) SketchLine_3 = Sketch_1.addLine(-7, 5, 7, 5) SketchLine_4 = Sketch_1.addLine(7, 5, 7, 0) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_5 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_5.result(), 7, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_5.result(), 7, True +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 14) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 5) SketchLine_6 = Sketch_1.addLine(5, 12, -5, 12) SketchLine_7 = Sketch_1.addLine(-5, 12, -5, 15) SketchLine_8 = Sketch_1.addLine(-5, 15, 5, 15) SketchLine_9 = Sketch_1.addLine(5, 15, 5, 12) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_9.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()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_9.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() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 3) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 10) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_5.result(), 5, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_3.result(), 7, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_5.result(), 5, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchLine_3.result(), 7, True +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 60, 20) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r")], model.selection(), 55, 15) -LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 60, + 20, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r", + ) + ], + model.selection(), + 55, + 15, +) +LinearCopy_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "LinearCopy_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_1.result().subResult(0).subResult(0).setColor(0, 170, 0) Compound_1.result().subResult(0).subResult(1).setColor(0, 170, 0) Compound_1.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_1.result().subResult(1).subResult(1).setColor(0, 255, 0) -Fuse_1_objects_1 = [model.selection("SOLID", "LinearCopy_2_1_1_1"), model.selection("SOLID", "Compound_1_1_1_1"), model.selection("COMPOUND", "Compound_1_1_2")] +Fuse_1_objects_1 = [ + model.selection("SOLID", "LinearCopy_2_1_1_1"), + model.selection("SOLID", "Compound_1_1_1_1"), + model.selection("COMPOUND", "Compound_1_1_2"), +] Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1, True) model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) @@ -94,4 +182,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [156]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [312]) model.testResultsVolumes(Fuse_1, [13659.954047657343835453502833843]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v0_2.py b/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v0_2.py index 86cdad1a2..61f41c674 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v0_2.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v0_2.py @@ -25,57 +25,127 @@ 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) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OY"), 15, 3) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OX"), -20, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OY"), + 15, + 3, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OX"), + -20, + 2, +) Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(10, -5, 0, -5) SketchLine_2 = Sketch_1.addLine(0, -5, 0, 0) SketchLine_3 = Sketch_1.addLine(0, 0, 10, 0) SketchLine_4 = Sketch_1.addLine(10, 0, 10, -5) -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()) +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(10, -5, 20, -5) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(20, -5, 20, 0) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(20, 0, 10, 0) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_7.endPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_5.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_5.result() +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_8 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchAPI_Line(SketchLine_8).startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchAPI_Line(SketchLine_8).startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10") SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 5) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 10) Extrusion_1.setNestedSketch(Sketch_1) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1_2/From_Face")) +Sketch_2 = model.addSketch( + Part_1_doc, model.selection("FACE", "Extrusion_1_1_2/From_Face") +) SketchLine_9 = Sketch_2.addLine(22, 2.5, 6, 2.5) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_9.result(), 16) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/From_Face]"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/From_Face]", + ), + False, +) SketchLine_10 = SketchProjection_2.createdFeature() SketchPoint_1 = Sketch_2.addPoint(10, 2.5) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchLine_9.result()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchPoint_1.coordinates(), SketchLine_9.result() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11") -SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchPoint_1.coordinates(), SketchLine_10.result()) -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchLine_9.startPoint(), SketchLine_10.result(), 12, True) +SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint( + SketchPoint_1.coordinates(), SketchLine_10.result() +) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchLine_9.startPoint(), SketchLine_10.result(), 12, True +) model.do() Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_9")]) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OZ"), 13, 3) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("FACE", "Extrusion_2_1")]) -Fuse_1_objects_1 = [model.selection("SOLID", "Compound_1_1_1_1"), model.selection("SOLID", "LinearCopy_2_1_1_1"), model.selection("FACE", "Compound_1_1_2")] +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 13, + 3, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("FACE", "Extrusion_2_1"), + ], +) +Fuse_1_objects_1 = [ + model.selection("SOLID", "Compound_1_1_1_1"), + model.selection("SOLID", "LinearCopy_2_1_1_1"), + model.selection("FACE", "Compound_1_1_2"), +] Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1, True) model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) @@ -92,4 +162,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [40]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [80]) model.testResultsVolumes(Fuse_1, [1089.04862267261933]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v0_3.py b/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v0_3.py index d868c21a2..2a6a002c9 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v0_3.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v0_3.py @@ -25,57 +25,131 @@ 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) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OY"), 15, 3) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OX"), -20, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OY"), + 15, + 3, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OX"), + -20, + 2, +) Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(10, -5, 0, -5) SketchLine_2 = Sketch_1.addLine(0, -5, 0, 0) SketchLine_3 = Sketch_1.addLine(0, 0, 10, 0) SketchLine_4 = Sketch_1.addLine(10, 0, 10, -5) -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()) +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(10, -5, 20, -5) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(20, -5, 20, 0) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(20, 0, 10, 0) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_7.endPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_5.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_5.result() +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_8 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchAPI_Line(SketchLine_8).startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchAPI_Line(SketchLine_8).startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10") SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 5) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 10) Extrusion_1.setNestedSketch(Sketch_1) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1_2/From_Face")) +Sketch_2 = model.addSketch( + Part_1_doc, model.selection("FACE", "Extrusion_1_1_2/From_Face") +) SketchLine_9 = Sketch_2.addLine(22, 2.5, 6, 2.5) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_9.result(), 16) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/From_Face]"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/From_Face]", + ), + False, +) SketchLine_10 = SketchProjection_2.createdFeature() SketchPoint_1 = Sketch_2.addPoint(10, 2.5) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchLine_9.result()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchPoint_1.coordinates(), SketchLine_9.result() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11") -SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchPoint_1.coordinates(), SketchLine_10.result()) -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchLine_9.startPoint(), SketchLine_10.result(), 12, True) +SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint( + SketchPoint_1.coordinates(), SketchLine_10.result() +) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchLine_9.startPoint(), SketchLine_10.result(), 12, True +) model.do() Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_9")]) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OZ"), 13, 3) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("FACE", "Extrusion_2_1")]) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Compound_1_1_1_1")], [model.selection("SOLID", "LinearCopy_2_1_1_1"), model.selection("FACE", "Compound_1_1_2")], True) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 13, + 3, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("FACE", "Extrusion_2_1"), + ], +) +Fuse_1 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Compound_1_1_1_1")], + [ + model.selection("SOLID", "LinearCopy_2_1_1_1"), + model.selection("FACE", "Compound_1_1_2"), + ], + True, +) model.end() from GeomAPI import * diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v0_4.py b/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v0_4.py index 148e831da..8c68bceee 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v0_4.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v0_4.py @@ -25,57 +25,127 @@ 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) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OY"), 15, 3) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OX"), -20, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OY"), + 15, + 3, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OX"), + -20, + 2, +) Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(10, -5, 0, -5) SketchLine_2 = Sketch_1.addLine(0, -5, 0, 0) SketchLine_3 = Sketch_1.addLine(0, 0, 10, 0) SketchLine_4 = Sketch_1.addLine(10, 0, 10, -5) -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()) +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(10, -5, 20, -5) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(20, -5, 20, 0) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(20, 0, 10, 0) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_7.endPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_5.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_5.result() +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_8 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchAPI_Line(SketchLine_8).startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchAPI_Line(SketchLine_8).startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10") SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 5) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 10) Extrusion_1.setNestedSketch(Sketch_1) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1_2/From_Face")) +Sketch_2 = model.addSketch( + Part_1_doc, model.selection("FACE", "Extrusion_1_1_2/From_Face") +) SketchLine_9 = Sketch_2.addLine(22, 2.5, 6, 2.5) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_9.result(), 16) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/From_Face]"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/From_Face]", + ), + False, +) SketchLine_10 = SketchProjection_2.createdFeature() SketchPoint_1 = Sketch_2.addPoint(10, 2.5) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchLine_9.result()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchPoint_1.coordinates(), SketchLine_9.result() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11") -SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchPoint_1.coordinates(), SketchLine_10.result()) -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchLine_9.startPoint(), SketchLine_10.result(), 12, True) +SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint( + SketchPoint_1.coordinates(), SketchLine_10.result() +) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchLine_9.startPoint(), SketchLine_10.result(), 12, True +) model.do() Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_9")]) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OZ"), 13, 3) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("FACE", "Extrusion_2_1")]) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Compound_1_1_1_1")], [model.selection("SOLID", "LinearCopy_2_1_1_1")]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 13, + 3, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("FACE", "Extrusion_2_1"), + ], +) +Fuse_1 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Compound_1_1_1_1")], + [model.selection("SOLID", "LinearCopy_2_1_1_1")], +) model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) @@ -91,4 +161,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [60]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [120]) model.testResultsVolumes(Fuse_1, [1589.04862264177882]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_1.py b/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_1.py index 5623b0cce..b5af3d30e 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_1.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_1.py @@ -25,9 +25,27 @@ 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"), 10, 20) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 40, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 20, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 40, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) LinearCopy_2.result().subResult(0).subResult(0).setColor(255, 170, 0) LinearCopy_2.result().subResult(0).subResult(1).setColor(255, 170, 0) LinearCopy_2.result().subResult(1).subResult(0).setColor(0, 0, 255) @@ -37,48 +55,118 @@ SketchLine_1 = Sketch_1.addLine(7, 0, -7, 0) SketchLine_2 = Sketch_1.addLine(-7, 0, -7, 5) SketchLine_3 = Sketch_1.addLine(-7, 5, 7, 5) SketchLine_4 = Sketch_1.addLine(7, 5, 7, 0) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_5 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_5.result(), 7, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_5.result(), 7, True +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 14) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 5) SketchLine_6 = Sketch_1.addLine(5, 12, -5, 12) SketchLine_7 = Sketch_1.addLine(-5, 12, -5, 15) SketchLine_8 = Sketch_1.addLine(-5, 15, 5, 15) SketchLine_9 = Sketch_1.addLine(5, 15, 5, 12) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_9.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()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_9.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() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 3) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 10) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_5.result(), 5, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_3.result(), 7, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_5.result(), 5, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchLine_3.result(), 7, True +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 60, 20) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r")], model.selection(), 55, 15) -LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 60, + 20, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r", + ) + ], + model.selection(), + 55, + 15, +) +LinearCopy_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "LinearCopy_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_1.result().subResult(0).subResult(0).setColor(0, 170, 0) Compound_1.result().subResult(0).subResult(1).setColor(0, 170, 0) Compound_1.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_1.result().subResult(1).subResult(1).setColor(0, 255, 0) -Fuse_1_objects_1 = [model.selection("SOLID", "LinearCopy_2_1_1_1"), model.selection("SOLID", "Compound_1_1_1_1"), model.selection("COMPOUND", "Compound_1_1_2")] -Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1, False, keepSubResults = True) +Fuse_1_objects_1 = [ + model.selection("SOLID", "LinearCopy_2_1_1_1"), + model.selection("SOLID", "Compound_1_1_1_1"), + model.selection("COMPOUND", "Compound_1_1_2"), +] +Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1, False, keepSubResults=True) model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) @@ -94,4 +182,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [208]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [416]) model.testResultsVolumes(Fuse_1, [38109.5099691938]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_2.py b/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_2.py index 68624819b..6c5123541 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_2.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_2.py @@ -25,58 +25,128 @@ 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) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OY"), 15, 3) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OX"), -20, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OY"), + 15, + 3, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OX"), + -20, + 2, +) Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(10, -5, 0, -5) SketchLine_2 = Sketch_1.addLine(0, -5, 0, 0) SketchLine_3 = Sketch_1.addLine(0, 0, 10, 0) SketchLine_4 = Sketch_1.addLine(10, 0, 10, -5) -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()) +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(10, -5, 20, -5) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(20, -5, 20, 0) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(20, 0, 10, 0) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_7.endPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_5.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_5.result() +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_8 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchAPI_Line(SketchLine_8).startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchAPI_Line(SketchLine_8).startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10") SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 5) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 10) Extrusion_1.setNestedSketch(Sketch_1) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1_2/From_Face")) +Sketch_2 = model.addSketch( + Part_1_doc, model.selection("FACE", "Extrusion_1_1_2/From_Face") +) SketchLine_9 = Sketch_2.addLine(22, 2.5, 5.999999999999998, 2.5) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_9.result(), 16) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/From_Face]"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/From_Face]", + ), + False, +) SketchLine_10 = SketchProjection_2.createdFeature() SketchPoint_1 = Sketch_2.addPoint(10, 2.5) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchLine_9.result()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchPoint_1.coordinates(), SketchLine_9.result() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11") -SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchPoint_1.coordinates(), SketchLine_10.result()) -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchLine_9.startPoint(), SketchLine_10.result(), 12, True) +SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint( + SketchPoint_1.coordinates(), SketchLine_10.result() +) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchLine_9.startPoint(), SketchLine_10.result(), 12, True +) model.do() Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_9")]) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OZ"), 13, 3) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("FACE", "Extrusion_2_1")]) -Fuse_1_objects_1 = [model.selection("SOLID", "Compound_1_1_1_1"), model.selection("SOLID", "LinearCopy_2_1_1_1"), model.selection("FACE", "Compound_1_1_2")] -Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1, True, keepSubResults = True) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 13, + 3, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("FACE", "Extrusion_2_1"), + ], +) +Fuse_1_objects_1 = [ + model.selection("SOLID", "Compound_1_1_1_1"), + model.selection("SOLID", "LinearCopy_2_1_1_1"), + model.selection("FACE", "Compound_1_1_2"), +] +Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1, True, keepSubResults=True) model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) @@ -92,4 +162,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [108]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [216]) model.testResultsVolumes(Fuse_1, [5516.039439659862]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_3.py b/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_3.py index f9281dcd7..6dbc52db5 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_3.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_3.py @@ -25,57 +25,132 @@ 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) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OY"), 15, 3) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OX"), -20, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OY"), + 15, + 3, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OX"), + -20, + 2, +) Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(10, -5, 0, -5) SketchLine_2 = Sketch_1.addLine(0, -5, 0, 0) SketchLine_3 = Sketch_1.addLine(0, 0, 10, 0) SketchLine_4 = Sketch_1.addLine(10, 0, 10, -5) -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()) +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(10, -5, 20, -5) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(20, -5, 20, 0) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(20, 0, 10, 0) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_7.endPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_5.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_5.result() +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_8 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchAPI_Line(SketchLine_8).startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchAPI_Line(SketchLine_8).startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10") SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 5) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 10) Extrusion_1.setNestedSketch(Sketch_1) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1_2/From_Face")) +Sketch_2 = model.addSketch( + Part_1_doc, model.selection("FACE", "Extrusion_1_1_2/From_Face") +) SketchLine_9 = Sketch_2.addLine(22, 2.5, 5.999999999999998, 2.5) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_9.result(), 16) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/From_Face]"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/From_Face]", + ), + False, +) SketchLine_10 = SketchProjection_2.createdFeature() SketchPoint_1 = Sketch_2.addPoint(10, 2.5) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchLine_9.result()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchPoint_1.coordinates(), SketchLine_9.result() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11") -SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchPoint_1.coordinates(), SketchLine_10.result()) -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchLine_9.startPoint(), SketchLine_10.result(), 12, True) +SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint( + SketchPoint_1.coordinates(), SketchLine_10.result() +) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchLine_9.startPoint(), SketchLine_10.result(), 12, True +) model.do() Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_9")]) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OZ"), 13, 3) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("FACE", "Extrusion_2_1")]) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Compound_1_1_1_1")], [model.selection("SOLID", "LinearCopy_2_1_1_1"), model.selection("FACE", "Compound_1_1_2")], True, keepSubResults = True) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 13, + 3, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("FACE", "Extrusion_2_1"), + ], +) +Fuse_1 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Compound_1_1_1_1")], + [ + model.selection("SOLID", "LinearCopy_2_1_1_1"), + model.selection("FACE", "Compound_1_1_2"), + ], + True, + keepSubResults=True, +) model.end() from GeomAPI import * diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_4.py b/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_4.py index 0e69033ce..f72a26e88 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_4.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_4.py @@ -25,57 +25,129 @@ 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) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OY"), 15, 3) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OX"), -20, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OY"), + 15, + 3, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OX"), + -20, + 2, +) Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(10, -5, 0, -5) SketchLine_2 = Sketch_1.addLine(0, -5, 0, 0) SketchLine_3 = Sketch_1.addLine(0, 0, 10, 0) SketchLine_4 = Sketch_1.addLine(10, 0, 10, -5) -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()) +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(10, -5, 20, -5) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(20, -5, 20, 0) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(20, 0, 10, 0) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_7.endPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_5.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_5.result() +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_8 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchAPI_Line(SketchLine_8).startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchAPI_Line(SketchLine_8).startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10") SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 5) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 10) Extrusion_1.setNestedSketch(Sketch_1) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1_2/From_Face")) +Sketch_2 = model.addSketch( + Part_1_doc, model.selection("FACE", "Extrusion_1_1_2/From_Face") +) SketchLine_9 = Sketch_2.addLine(22, 2.5, 5.999999999999998, 2.5) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_9.result(), 16) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/From_Face]"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/From_Face]", + ), + False, +) SketchLine_10 = SketchProjection_2.createdFeature() SketchPoint_1 = Sketch_2.addPoint(10, 2.5) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchLine_9.result()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchPoint_1.coordinates(), SketchLine_9.result() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11") -SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchPoint_1.coordinates(), SketchLine_10.result()) -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchLine_9.startPoint(), SketchLine_10.result(), 12, True) +SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint( + SketchPoint_1.coordinates(), SketchLine_10.result() +) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchLine_9.startPoint(), SketchLine_10.result(), 12, True +) model.do() Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_9")]) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OZ"), 13, 3) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("FACE", "Extrusion_2_1")]) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Compound_1_1_1_1")], [model.selection("SOLID", "LinearCopy_2_1_1_1")], False, keepSubResults = True) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 13, + 3, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("FACE", "Extrusion_2_1"), + ], +) +Fuse_1 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Compound_1_1_1_1")], + [model.selection("SOLID", "LinearCopy_2_1_1_1")], + False, + keepSubResults=True, +) model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) @@ -91,4 +163,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [94]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [188]) model.testResultsVolumes(Fuse_1, [5516.039439629021]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_RemoveEdges.py b/src/FeaturesPlugin/Test/TestBooleanFuse_RemoveEdges.py index c670bbca9..05007606e 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_RemoveEdges.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_RemoveEdges.py @@ -25,13 +25,22 @@ 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"), 5) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1")], True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_2_1")], + model.selection("EDGE", "PartSet/OX"), + 5, +) +Fuse_1 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1")], + True, +) model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [0]) @@ -40,4 +49,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [6]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [48]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_ShellCompound_ShellCompound.py b/src/FeaturesPlugin/Test/TestBooleanFuse_ShellCompound_ShellCompound.py index 06369ebbd..5511fbc33 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_ShellCompound_ShellCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_ShellCompound_ShellCompound.py @@ -24,63 +24,180 @@ 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(-83.2865672209026, 26.7937406175772, -53.58748123515441, 47.45397434679335) -SketchLine_2 = Sketch_1.addLine(-53.58748123515441, 47.45397434679335, -26.47092446555818, 25.50247600950118) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(-26.47092446555818, 25.50247600950118, -53.58748123515441, 5.487874584323028) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-53.58748123515441, 5.487874584323028, -83.2865672209026, 26.7937406175772) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint()) -SketchLine_5 = Sketch_1.addLine(-53.58748123515441, 47.45397434679335, -53.58748123515441, 5.487874584323028) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_5.endPoint()) -SketchLine_6 = Sketch_1.addLine(24.53402755344418, 35.83259287410926, 55.52437814726837, 51.32776817102136) -SketchLine_7 = Sketch_1.addLine(55.52437814726837, 51.32776817102136, 87.16036104513063, 32.60443135391922) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchLine_8 = Sketch_1.addLine(87.16036104513063, 32.60443135391922, 53.58748123515437, 16.46362375296911) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchLine_9 = Sketch_1.addLine(53.58748123515437, 16.46362375296911, 24.53402755344418, 35.83259287410926) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_9.endPoint()) -SketchLine_10 = Sketch_1.addLine(55.52437814726837, 51.32776817102136, 53.58748123515437, 16.46362375296911) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_10.endPoint()) +SketchLine_1 = Sketch_1.addLine( + -83.2865672209026, 26.7937406175772, -53.58748123515441, 47.45397434679335 +) +SketchLine_2 = Sketch_1.addLine( + -53.58748123515441, 47.45397434679335, -26.47092446555818, 25.50247600950118 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + -26.47092446555818, 25.50247600950118, -53.58748123515441, 5.487874584323028 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -53.58748123515441, 5.487874584323028, -83.2865672209026, 26.7937406175772 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_4.endPoint() +) +SketchLine_5 = Sketch_1.addLine( + -53.58748123515441, 47.45397434679335, -53.58748123515441, 5.487874584323028 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_5.endPoint() +) +SketchLine_6 = Sketch_1.addLine( + 24.53402755344418, 35.83259287410926, 55.52437814726837, 51.32776817102136 +) +SketchLine_7 = Sketch_1.addLine( + 55.52437814726837, 51.32776817102136, 87.16036104513063, 32.60443135391922 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchLine_8 = Sketch_1.addLine( + 87.16036104513063, 32.60443135391922, 53.58748123515437, 16.46362375296911 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchLine_9 = Sketch_1.addLine( + 53.58748123515437, 16.46362375296911, 24.53402755344418, 35.83259287410926 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchLine_9.endPoint() +) +SketchLine_10 = Sketch_1.addLine( + 55.52437814726837, 51.32776817102136, 53.58748123515437, 16.46362375296911 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_10.endPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_11 = Sketch_2.addLine(-85.86909643705464, 4.842242280285022, -62.62633349168645, 26.7937406175772) -SketchLine_12 = Sketch_2.addLine(-62.62633349168645, 26.7937406175772, -65.20886270783846, -2.259713064133024) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchLine_13 = Sketch_2.addLine(-65.20886270783846, -2.259713064133024, -83.9321995249406, -14.52672684085511) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchLine_14 = Sketch_2.addLine(-83.9321995249406, -14.52672684085511, -85.86909643705464, 4.842242280285022) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchLine_14.endPoint()) -SketchLine_15 = Sketch_2.addLine(-85.86909643705464, 4.842242280285022, -65.20886270783846, -2.259713064133024) -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_15.endPoint()) -SketchLine_16 = Sketch_2.addLine(31.63598289786226, 11.9441976247031, 44.54862897862235, 33.25006365795723) -SketchLine_17 = Sketch_2.addLine(44.54862897862235, 33.25006365795723, 52.29621662707837, 8.070403800475056) -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) -SketchLine_18 = Sketch_2.addLine(52.29621662707837, 8.070403800475056, 32.28161520190027, -12.58982992874109) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) -SketchLine_19 = Sketch_2.addLine(32.28161520190027, -12.58982992874109, 31.63598289786226, 11.9441976247031) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchLine_19.endPoint()) -SketchLine_20 = Sketch_2.addLine(31.63598289786226, 11.9441976247031, 52.29621662707837, 8.070403800475056) -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_20.endPoint()) +SketchLine_11 = Sketch_2.addLine( + -85.86909643705464, 4.842242280285022, -62.62633349168645, 26.7937406175772 +) +SketchLine_12 = Sketch_2.addLine( + -62.62633349168645, 26.7937406175772, -65.20886270783846, -2.259713064133024 +) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchLine_13 = Sketch_2.addLine( + -65.20886270783846, -2.259713064133024, -83.9321995249406, -14.52672684085511 +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchLine_14 = Sketch_2.addLine( + -83.9321995249406, -14.52672684085511, -85.86909643705464, 4.842242280285022 +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_11.startPoint(), SketchLine_14.endPoint() +) +SketchLine_15 = Sketch_2.addLine( + -85.86909643705464, 4.842242280285022, -65.20886270783846, -2.259713064133024 +) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchLine_11.startPoint(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_15.endPoint() +) +SketchLine_16 = Sketch_2.addLine( + 31.63598289786226, 11.9441976247031, 44.54862897862235, 33.25006365795723 +) +SketchLine_17 = Sketch_2.addLine( + 44.54862897862235, 33.25006365795723, 52.29621662707837, 8.070403800475056 +) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) +SketchLine_18 = Sketch_2.addLine( + 52.29621662707837, 8.070403800475056, 32.28161520190027, -12.58982992874109 +) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) +SketchLine_19 = Sketch_2.addLine( + 32.28161520190027, -12.58982992874109, 31.63598289786226, 11.9441976247031 +) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_16.startPoint(), SketchLine_19.endPoint() +) +SketchLine_20 = Sketch_2.addLine( + 31.63598289786226, 11.9441976247031, 52.29621662707837, 8.070403800475056 +) +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_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_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")]) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")]) +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")], +) +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) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [4]) @@ -89,4 +206,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [12]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [44]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [88]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_Shell_Shell.py b/src/FeaturesPlugin/Test/TestBooleanFuse_Shell_Shell.py index 376d7dfa0..5d4d7ae7a 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_Shell_Shell.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_Shell_Shell.py @@ -24,39 +24,92 @@ 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(-82.64093491686459, 27.4393729216152, -55.52437814726841, 47.45397434679335) -SketchLine_2 = Sketch_1.addLine(-55.52437814726841, 47.45397434679335, -29.69908598574823, 30.02190213776723) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(-29.69908598574823, 30.02190213776723, -54.2331135391924, 7.424771496437049) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-54.2331135391924, 7.424771496437049, -82.64093491686459, 27.4393729216152) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint()) -SketchLine_5 = Sketch_1.addLine(-55.52437814726841, 47.45397434679335, -54.2331135391924, 7.424771496437049) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_5.endPoint()) +SketchLine_1 = Sketch_1.addLine( + -82.64093491686459, 27.4393729216152, -55.52437814726841, 47.45397434679335 +) +SketchLine_2 = Sketch_1.addLine( + -55.52437814726841, 47.45397434679335, -29.69908598574823, 30.02190213776723 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + -29.69908598574823, 30.02190213776723, -54.2331135391924, 7.424771496437049 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -54.2331135391924, 7.424771496437049, -82.64093491686459, 27.4393729216152 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_4.endPoint() +) +SketchLine_5 = Sketch_1.addLine( + -55.52437814726841, 47.45397434679335, -54.2331135391924, 7.424771496437049 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_5.endPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_6 = Sketch_2.addLine(-84.57783182897859, 11.29856532066509, -63.91759809976246, 28.73063752969122) -SketchLine_7 = Sketch_2.addLine(-63.91759809976246, 28.73063752969122, -60.68943657957245, -4.196609976247029) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchLine_8 = Sketch_2.addLine(-60.68943657957245, -4.196609976247029, -84.57783182897859, -14.52672684085511) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchLine_9 = Sketch_2.addLine(-84.57783182897859, -14.52672684085511, -84.57783182897859, 11.29856532066509) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_6.startPoint(), SketchLine_9.endPoint()) -SketchLine_10 = Sketch_2.addLine(-84.57783182897859, 11.29856532066509, -60.68943657957245, -4.196609976247029) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_6.startPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_10.endPoint()) +SketchLine_6 = Sketch_2.addLine( + -84.57783182897859, 11.29856532066509, -63.91759809976246, 28.73063752969122 +) +SketchLine_7 = Sketch_2.addLine( + -63.91759809976246, 28.73063752969122, -60.68943657957245, -4.196609976247029 +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchLine_8 = Sketch_2.addLine( + -60.68943657957245, -4.196609976247029, -84.57783182897859, -14.52672684085511 +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchLine_9 = Sketch_2.addLine( + -84.57783182897859, -14.52672684085511, -84.57783182897859, 11.29856532066509 +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_6.startPoint(), SketchLine_9.endPoint() +) +SketchLine_10 = Sketch_2.addLine( + -84.57783182897859, 11.29856532066509, -60.68943657957245, -4.196609976247029 +) +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_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_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) +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) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [2]) @@ -65,4 +118,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [4]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [18]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [36]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_SimpleMode.py b/src/FeaturesPlugin/Test/TestBooleanFuse_SimpleMode.py index c95152167..4cce0b418 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_SimpleMode.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_SimpleMode.py @@ -25,13 +25,21 @@ 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"), 5) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1")]) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_2_1")], + model.selection("EDGE", "PartSet/OX"), + 5, +) +Fuse_1 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1")], +) model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [0]) @@ -40,4 +48,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [14]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [56]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [112]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_SolidCompound_SolidCompound.py b/src/FeaturesPlugin/Test/TestBooleanFuse_SolidCompound_SolidCompound.py index cbc584970..b815ae852 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_SolidCompound_SolidCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_SolidCompound_SolidCompound.py @@ -24,67 +24,153 @@ 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(-26.93407123287669, 40.82195171232873, -80.80221369863011, 40.82195171232873) -SketchLine_2 = Sketch_1.addLine(-80.80221369863011, 40.82195171232873, -80.80221369863011, -8.837742123287665) -SketchLine_3 = Sketch_1.addLine(-80.80221369863011, -8.837742123287665, -26.93407123287669, -8.837742123287665) -SketchLine_4 = Sketch_1.addLine(-26.93407123287669, -8.837742123287665, -26.93407123287669, 40.82195171232873) -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()) +SketchLine_1 = Sketch_1.addLine( + -26.93407123287669, 40.82195171232873, -80.80221369863011, 40.82195171232873 +) +SketchLine_2 = Sketch_1.addLine( + -80.80221369863011, 40.82195171232873, -80.80221369863011, -8.837742123287665 +) +SketchLine_3 = Sketch_1.addLine( + -80.80221369863011, -8.837742123287665, -26.93407123287669, -8.837742123287665 +) +SketchLine_4 = Sketch_1.addLine( + -26.93407123287669, -8.837742123287665, -26.93407123287669, 40.82195171232873 +) +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(91.74418013698632, 40.82195171232873, 36.19265821917805, 40.82195171232873) -SketchLine_6 = Sketch_1.addLine(36.19265821917805, 40.82195171232873, 36.19265821917805, -15.57125993150685) -SketchLine_7 = Sketch_1.addLine(36.19265821917805, -15.57125993150685, 91.74418013698632, -15.57125993150685) -SketchLine_8 = Sketch_1.addLine(91.74418013698632, -15.57125993150685, 91.74418013698632, 40.82195171232873) -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()) +SketchLine_5 = Sketch_1.addLine( + 91.74418013698632, 40.82195171232873, 36.19265821917805, 40.82195171232873 +) +SketchLine_6 = Sketch_1.addLine( + 36.19265821917805, 40.82195171232873, 36.19265821917805, -15.57125993150685 +) +SketchLine_7 = Sketch_1.addLine( + 36.19265821917805, -15.57125993150685, 91.74418013698632, -15.57125993150685 +) +SketchLine_8 = Sketch_1.addLine( + 91.74418013698632, -15.57125993150685, 91.74418013698632, 40.82195171232873 +) +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()) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 100, 0 +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchLine_9 = Sketch_2.addLine(-14.30872534246576, 22.30477773972602, -41.24279657534246, 22.30477773972602) -SketchLine_10 = Sketch_2.addLine(-41.24279657534246, 22.30477773972602, -41.24279657534246, 1.262534589041107) -SketchLine_11 = Sketch_2.addLine(-41.24279657534246, 1.262534589041107, -14.30872534246576, 1.262534589041107) -SketchLine_12 = Sketch_2.addLine(-14.30872534246576, 1.262534589041107, -14.30872534246576, 22.30477773972602) -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()) +SketchLine_9 = Sketch_2.addLine( + -14.30872534246576, 22.30477773972602, -41.24279657534246, 22.30477773972602 +) +SketchLine_10 = Sketch_2.addLine( + -41.24279657534246, 22.30477773972602, -41.24279657534246, 1.262534589041107 +) +SketchLine_11 = Sketch_2.addLine( + -41.24279657534246, 1.262534589041107, -14.30872534246576, 1.262534589041107 +) +SketchLine_12 = Sketch_2.addLine( + -14.30872534246576, 1.262534589041107, -14.30872534246576, 22.30477773972602 +) +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_5 = Sketch_2.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_10.result()) SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_12.result()) -SketchLine_13 = Sketch_2.addLine(123.7283897260274, 22.30477773972602, 74.91038561643839, 22.30477773972602) -SketchLine_14 = Sketch_2.addLine(74.91038561643839, 22.30477773972602, 74.91038561643839, -0.4208448630136968) -SketchLine_15 = Sketch_2.addLine(74.91038561643839, -0.4208448630136968, 123.7283897260274, -0.4208448630136968) -SketchLine_16 = Sketch_2.addLine(123.7283897260274, -0.4208448630136968, 123.7283897260274, 22.30477773972602) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) +SketchLine_13 = Sketch_2.addLine( + 123.7283897260274, 22.30477773972602, 74.91038561643839, 22.30477773972602 +) +SketchLine_14 = Sketch_2.addLine( + 74.91038561643839, 22.30477773972602, 74.91038561643839, -0.4208448630136968 +) +SketchLine_15 = Sketch_2.addLine( + 74.91038561643839, -0.4208448630136968, 123.7283897260274, -0.4208448630136968 +) +SketchLine_16 = Sketch_2.addLine( + 123.7283897260274, -0.4208448630136968, 123.7283897260274, 22.30477773972602 +) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) SketchConstraintHorizontal_7 = Sketch_2.setHorizontal(SketchLine_13.result()) 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() -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_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")]) +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_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) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [2]) @@ -93,4 +179,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [22]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [96]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [192]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_Solid_Solid.py b/src/FeaturesPlugin/Test/TestBooleanFuse_Solid_Solid.py index 22f5e5c1e..ad196352b 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_Solid_Solid.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_Solid_Solid.py @@ -24,41 +24,101 @@ 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(-22.17495711835335, 33.08919382504288, -50.93310463121783, 33.08919382504288) -SketchLine_2 = Sketch_1.addLine(-50.93310463121783, 33.08919382504288, -50.93310463121783, 7.102915951972556) -SketchLine_3 = Sketch_1.addLine(-50.93310463121783, 7.102915951972556, -22.17495711835335, 7.102915951972556) -SketchLine_4 = Sketch_1.addLine(-22.17495711835335, 7.102915951972556, -22.17495711835335, 33.08919382504288) -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()) +SketchLine_1 = Sketch_1.addLine( + -22.17495711835335, 33.08919382504288, -50.93310463121783, 33.08919382504288 +) +SketchLine_2 = Sketch_1.addLine( + -50.93310463121783, 33.08919382504288, -50.93310463121783, 7.102915951972556 +) +SketchLine_3 = Sketch_1.addLine( + -50.93310463121783, 7.102915951972556, -22.17495711835335, 7.102915951972556 +) +SketchLine_4 = Sketch_1.addLine( + -22.17495711835335, 7.102915951972556, -22.17495711835335, 33.08919382504288 +) +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) +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) -SketchLine_7 = Sketch_2.addLine(-18.03083750064881, 22.05701811772883, -38.01624011480907, 22.05701811772883) -SketchLine_8 = Sketch_2.addLine(-38.01624011480907, 22.05701811772883, -38.01624011480907, 11.11021000825241) -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()) +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 +) +SketchLine_7 = Sketch_2.addLine( + -18.03083750064881, 22.05701811772883, -38.01624011480907, 22.05701811772883 +) +SketchLine_8 = Sketch_2.addLine( + -38.01624011480907, 22.05701811772883, -38.01624011480907, 11.11021000825241 +) +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()) model.do() -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")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [0]) @@ -67,4 +127,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [11]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [48]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [96]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_SolidsHistory.py b/src/FeaturesPlugin/Test/TestBooleanFuse_SolidsHistory.py index 3685c2a19..a753ffb4b 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_SolidsHistory.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_SolidsHistory.py @@ -26,33 +26,81 @@ 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(-9.826354679802961, 29.97660098522167, -30.22536945812809, 29.97660098522167) -SketchLine_2 = Sketch_1.addLine(-30.22536945812809, 29.97660098522167, -30.22536945812809, 11.69211822660099) -SketchLine_3 = Sketch_1.addLine(-30.22536945812809, 11.69211822660099, -9.826354679802961, 11.69211822660099) -SketchLine_4 = Sketch_1.addLine(-9.826354679802961, 11.69211822660099, -9.826354679802961, 29.97660098522167) -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()) +SketchLine_1 = Sketch_1.addLine( + -9.826354679802961, 29.97660098522167, -30.22536945812809, 29.97660098522167 +) +SketchLine_2 = Sketch_1.addLine( + -30.22536945812809, 29.97660098522167, -30.22536945812809, 11.69211822660099 +) +SketchLine_3 = Sketch_1.addLine( + -30.22536945812809, 11.69211822660099, -9.826354679802961, 11.69211822660099 +) +SketchLine_4 = Sketch_1.addLine( + -9.826354679802961, 11.69211822660099, -9.826354679802961, 29.97660098522167 +) +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(-30.22536945812809, 11.69211822660099, -9.826354679802961, 29.97660098522167) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint()) -SketchCircle_1 = Sketch_1.addCircle(9.328817733990148, 6.841133004926101, 8.342093824373531) +SketchLine_5 = Sketch_1.addLine( + -30.22536945812809, 11.69211822660099, -9.826354679802961, 29.97660098522167 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.endPoint() +) +SketchCircle_1 = Sketch_1.addCircle( + 9.328817733990148, 6.841133004926101, 8.342093824373531 +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_2 = Sketch_2.addCircle(-5.846059113300496, 9.453201970443347, 11.01344978196573) +SketchCircle_2 = Sketch_2.addCircle( + -5.846059113300496, 9.453201970443347, 11.01344978196573 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 10, 0) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 11, 1) -Group_1_objects = [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_1_2")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection(), + 10, + 0, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 11, 1 +) +Group_1_objects = [ + model.selection("SOLID", "Extrusion_1_1_1"), + model.selection("SOLID", "Extrusion_1_1_2"), + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "Extrusion_1_2"), +] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) -Group_2_objects = [model.selection("FACE", "Extrusion_1_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1_2/To_Face"), model.selection("FACE", "Extrusion_2_1/To_Face"), model.selection("FACE", "Extrusion_1_2/To_Face")] +Group_2_objects = [ + model.selection("FACE", "Extrusion_1_1_1/To_Face"), + model.selection("FACE", "Extrusion_1_1_2/To_Face"), + model.selection("FACE", "Extrusion_2_1/To_Face"), + model.selection("FACE", "Extrusion_1_2/To_Face"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Fuse_1_objects_1 = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_1_2")] +Fuse_1_objects_1 = [ + model.selection("SOLID", "Extrusion_1_1_2"), + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "Extrusion_1_2"), +] Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1) model.do() # move group @@ -63,16 +111,16 @@ model.end() # All solids are merged to one - result aFactory = ModelAPI_Session.get().validators() selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 1 +assert aFactory.validate(Group_1.feature()) for i in range(1): - assert(Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID) + assert Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID # Check group 2: 3 faces selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 3) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 3 +assert aFactory.validate(Group_2.feature()) for i in range(3): - assert(Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE) + assert Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_VertexCompound_VertexCompound.py b/src/FeaturesPlugin/Test/TestBooleanFuse_VertexCompound_VertexCompound.py index 26d311de8..ada3535f4 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_VertexCompound_VertexCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_VertexCompound_VertexCompound.py @@ -29,16 +29,33 @@ 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/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_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")]) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")]) +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")], +) +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) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [4]) @@ -47,4 +64,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [0]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [4]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_Vertex_Vertex.py b/src/FeaturesPlugin/Test/TestBooleanFuse_Vertex_Vertex.py index 979710333..3d01378cc 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_Vertex_Vertex.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_Vertex_Vertex.py @@ -27,13 +27,22 @@ 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/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")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [2]) @@ -42,4 +51,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [0]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [2]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_WireCompound_WireCompound.py b/src/FeaturesPlugin/Test/TestBooleanFuse_WireCompound_WireCompound.py index 74c2252d7..ff03279f9 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_WireCompound_WireCompound.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_WireCompound_WireCompound.py @@ -24,33 +24,93 @@ 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(-74.539241607565, 22.811578250591, -50.12121418439715, 49.79992434988179) -SketchLine_2 = Sketch_1.addLine(-50.12121418439715, 49.79992434988179, -29.55866477541372, 23.45415791962174) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(15.42191205673757, 24.09673758865247, 34.69930212765959, 49.15734468085105) -SketchLine_4 = Sketch_1.addLine(34.69930212765959, 49.15734468085105, 59.75990921985817, 26.02447659574467) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_1 = Sketch_1.addLine( + -74.539241607565, 22.811578250591, -50.12121418439715, 49.79992434988179 +) +SketchLine_2 = Sketch_1.addLine( + -50.12121418439715, 49.79992434988179, -29.55866477541372, 23.45415791962174 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 15.42191205673757, 24.09673758865247, 34.69930212765959, 49.15734468085105 +) +SketchLine_4 = Sketch_1.addLine( + 34.69930212765959, 49.15734468085105, 59.75990921985817, 26.02447659574467 +) +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(-79.03729929078014, 52.37024302600472, -50.76379385342788, 26.6670562647754) -SketchLine_6 = Sketch_2.addLine(-50.76379385342788, 26.6670562647754, -25.70318676122931, 53.65540236406619) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchLine_7 = Sketch_2.addLine(13.49417304964538, 51.08508368794326, 35.98446146572105, 27.95221560283687) -SketchLine_8 = Sketch_2.addLine(35.98446146572105, 27.95221560283687, 53.3341125295508, 47.87218534278959) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchLine_5 = Sketch_2.addLine( + -79.03729929078014, 52.37024302600472, -50.76379385342788, 26.6670562647754 +) +SketchLine_6 = Sketch_2.addLine( + -50.76379385342788, 26.6670562647754, -25.70318676122931, 53.65540236406619 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchLine_7 = Sketch_2.addLine( + 13.49417304964538, 51.08508368794326, 35.98446146572105, 27.95221560283687 +) +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/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")]) +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"), + ], +) model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [4]) @@ -59,4 +119,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [16]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [32]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_Wire_Wire.py b/src/FeaturesPlugin/Test/TestBooleanFuse_Wire_Wire.py index 3c394f83a..86421b80d 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_Wire_Wire.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_Wire_Wire.py @@ -24,23 +24,50 @@ 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(-31.34514549929152, 46.39906406145125, -4.124361249906777, 13.81661018718769) -SketchLine_2 = Sketch_1.addLine(-4.124361249906777, 13.81661018718769, 21.85911462450594, 45.98662793646056) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_1 = Sketch_1.addLine( + -31.34514549929152, 46.39906406145125, -4.124361249906777, 13.81661018718769 +) +SketchLine_2 = Sketch_1.addLine( + -4.124361249906777, 13.81661018718769, 21.85911462450594, 45.98662793646056 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_3 = Sketch_2.addLine(-23.92129524945932, 7.630068312327553, -4.124361249906777, 34.02598031173091) -SketchLine_4 = Sketch_2.addLine(-4.124361249906777, 34.02598031173091, 14.43526437467373, 6.392759937355498) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_3 = Sketch_2.addLine( + -23.92129524945932, 7.630068312327553, -4.124361249906777, 34.02598031173091 +) +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/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")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [2]) @@ -49,4 +76,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [0]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [8]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [16]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanSmash.py b/src/FeaturesPlugin/Test/TestBooleanSmash.py index 4c017a8a1..13ee955c4 100644 --- a/src/FeaturesPlugin/Test/TestBooleanSmash.py +++ b/src/FeaturesPlugin/Test/TestBooleanSmash.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -31,9 +31,9 @@ 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")) @@ -45,12 +45,12 @@ 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.) +anCircleCentr.setValue(10.0, 10.0) +aCircleRadius.setValue(50.0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create a sketch with triangle to extrude -#========================================================================= +# ========================================================================= aSession.startOperation() aTriangleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin")) @@ -68,16 +68,16 @@ 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.) +aLineAStartPoint.setValue(25.0, 25.0) +aLineAEndPoint.setValue(100.0, 25.0) +aLineBStartPoint.setValue(100.0, 25.0) +aLineBEndPoint.setValue(60.0, 75.0) +aLineCStartPoint.setValue(60.0, 75.0) +aLineCEndPoint.setValue(25.0, 25.0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on circle (cylinder) and triangle (prism) -#========================================================================= +# ========================================================================= # Build shape from sketcher results aSession.startOperation() extrudedObjects = [] @@ -86,32 +86,36 @@ for eachSketchFeature in [aCircleSketchFeature, aTriangleSketchFeature]: aSketchResult = modelAPI_ResultConstruction(eachSketchFeature.firstResult()) # Create extrusion on them anExtrusionFt = aPart.addFeature("Extrusion") - anExtrusionFt.selectionList("base").append( - aSketchResult, aSketchResult.face(0)) + 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.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() -#========================================================================= +# ========================================================================= # Smash prism into the cylinder -#========================================================================= +# ========================================================================= aSession.startOperation() aBooleanFt = aPart.addFeature("Smash") -aBooleanFt.selectionList("main_objects").append(extrudedObjects[0], extrudedObjects[0].shape()) -aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], extrudedObjects[1].shape()) +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) +assert len(aBooleanFt.results()) > 0 aBooleanResult = modelAPI_ResultBody(aBooleanFt.firstResult()) -assert (aBooleanResult is not None) -#========================================================================= +assert aBooleanResult is not None +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanSmash_CompSolid_Solid.py b/src/FeaturesPlugin/Test/TestBooleanSmash_CompSolid_Solid.py index 4272f3176..cffeeb6dd 100644 --- a/src/FeaturesPlugin/Test/TestBooleanSmash_CompSolid_Solid.py +++ b/src/FeaturesPlugin/Test/TestBooleanSmash_CompSolid_Solid.py @@ -25,11 +25,24 @@ 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) +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")]) +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 diff --git a/src/FeaturesPlugin/Test/TestBooleanSmash_ErrorMsg.py b/src/FeaturesPlugin/Test/TestBooleanSmash_ErrorMsg.py index a31e04d62..27c7ba7b7 100644 --- a/src/FeaturesPlugin/Test/TestBooleanSmash_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestBooleanSmash_ErrorMsg.py @@ -24,47 +24,82 @@ 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) +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() != "") +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() != "") +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() != "") +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) +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() != "") +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")]) +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() != "") +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() != "") +assert Smash_1.error() != "" aSession.finishOperation() diff --git a/src/FeaturesPlugin/Test/TestBooleanSmash_Face_Face.py b/src/FeaturesPlugin/Test/TestBooleanSmash_Face_Face.py index a85c45d35..32cbb55cc 100644 --- a/src/FeaturesPlugin/Test/TestBooleanSmash_Face_Face.py +++ b/src/FeaturesPlugin/Test/TestBooleanSmash_Face_Face.py @@ -24,18 +24,32 @@ 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(-31.7032590051458, 14.72555746140652, 29.35516607310447) +SketchCircle_1 = Sketch_1.addCircle( + -31.7032590051458, 14.72555746140652, 29.35516607310447 +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_2 = Sketch_2.addCircle(12.30017152658664, 14.37907375643225, 29.61574408620473) +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_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")]) +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() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Smash_1, 1) model.testNbSubResults(Smash_1, [2]) @@ -44,4 +58,4 @@ model.testNbSubShapes(Smash_1, GeomAPI_Shape.FACE, [2]) model.testNbSubShapes(Smash_1, GeomAPI_Shape.EDGE, [5]) model.testNbSubShapes(Smash_1, GeomAPI_Shape.VERTEX, [10]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanSmash_MultiLevelCompound_v0_1.py b/src/FeaturesPlugin/Test/TestBooleanSmash_MultiLevelCompound_v0_1.py index 68da055eb..8a885bb35 100644 --- a/src/FeaturesPlugin/Test/TestBooleanSmash_MultiLevelCompound_v0_1.py +++ b/src/FeaturesPlugin/Test/TestBooleanSmash_MultiLevelCompound_v0_1.py @@ -25,9 +25,27 @@ 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"), 10, 20) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 40, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 20, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 40, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) LinearCopy_2.result().subResult(0).subResult(0).setColor(255, 170, 0) LinearCopy_2.result().subResult(0).subResult(1).setColor(255, 170, 0) LinearCopy_2.result().subResult(1).subResult(0).setColor(0, 0, 255) @@ -37,47 +55,120 @@ SketchLine_1 = Sketch_1.addLine(7, 0, -7, 0) SketchLine_2 = Sketch_1.addLine(-7, 0, -7, 5) SketchLine_3 = Sketch_1.addLine(-7, 5, 7, 5) SketchLine_4 = Sketch_1.addLine(7, 5, 7, 0) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_5 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_5.result(), 7, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_5.result(), 7, True +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 14) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 5) SketchLine_6 = Sketch_1.addLine(5, 12, -5, 12) SketchLine_7 = Sketch_1.addLine(-5, 12, -5, 15) SketchLine_8 = Sketch_1.addLine(-5, 15, 5, 15) SketchLine_9 = Sketch_1.addLine(5, 15, 5, 12) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_9.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()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_9.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() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 3) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 10) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_5.result(), 5, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_3.result(), 7, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_5.result(), 5, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchLine_3.result(), 7, True +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 60, 20) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r")], model.selection(), 55, 15) -LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 60, + 20, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r", + ) + ], + model.selection(), + 55, + 15, +) +LinearCopy_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "LinearCopy_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_1.result().subResult(0).subResult(0).setColor(0, 170, 0) Compound_1.result().subResult(0).subResult(1).setColor(0, 170, 0) Compound_1.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_1.result().subResult(1).subResult(1).setColor(0, 255, 0) -Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "LinearCopy_2_1_1_1")], [model.selection("SOLID", "Compound_1_1_2_1"), model.selection("SOLID", "Compound_1_1_2_2")]) +Smash_1 = model.addSmash( + Part_1_doc, + [model.selection("SOLID", "LinearCopy_2_1_1_1")], + [ + model.selection("SOLID", "Compound_1_1_2_1"), + model.selection("SOLID", "Compound_1_1_2_2"), + ], +) model.testHaveNamingSubshapes(Smash_1, model, Part_1_doc) @@ -93,4 +184,4 @@ model.testNbSubShapes(Smash_1, GeomAPI_Shape.EDGE, [348]) model.testNbSubShapes(Smash_1, GeomAPI_Shape.VERTEX, [696]) model.testResultsVolumes(Smash_1, [15044.469954918753501260653138161]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanSmash_MultiLevelCompound_v0_2.py b/src/FeaturesPlugin/Test/TestBooleanSmash_MultiLevelCompound_v0_2.py index 908d576db..54c430b10 100644 --- a/src/FeaturesPlugin/Test/TestBooleanSmash_MultiLevelCompound_v0_2.py +++ b/src/FeaturesPlugin/Test/TestBooleanSmash_MultiLevelCompound_v0_2.py @@ -26,32 +26,70 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 10) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) SketchCircle_2 = Sketch_1.addCircle(10, 0, 10) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_2.center() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0 +) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchCircle_3 = Sketch_2.addCircle(0, -7, 10) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.result(), SketchCircle_3.center()) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.result(), SketchCircle_3.center() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_3.results()[1], 10) -SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance(SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7) +SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance( + SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7 +) SketchCircle_4 = Sketch_2.addCircle(40, -27, 10) -SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_4.results()[1], SketchCircle_3.results()[1]) -SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance(SketchCircle_3.center(), SketchCircle_4.center(), 40) -SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchCircle_4.center(), SketchCircle_3.center(), 20) +SketchConstraintEqual_2 = Sketch_2.setEqual( + SketchCircle_4.results()[1], SketchCircle_3.results()[1] +) +SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance( + SketchCircle_3.center(), SketchCircle_4.center(), 40 +) +SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance( + SketchCircle_4.center(), SketchCircle_3.center(), 20 +) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")]) -Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPSOLID", "Extrusion_1_1")]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "Extrusion_2_2"), + ], +) +Compound_2 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "Compound_1_1"), + model.selection("COMPSOLID", "Extrusion_1_1"), + ], +) Compound_2.result().subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(1).setColor(255, 170, 0) @@ -64,45 +102,114 @@ SketchLine_3 = Sketch_3.addLine(7, 0, -7, 0) SketchLine_4 = Sketch_3.addLine(-7, 0, -7, 5) SketchLine_5 = Sketch_3.addLine(-7, 5, 7, 5) SketchLine_6 = Sketch_3.addLine(7, 5, 7, 0) -SketchConstraintCoincidence_4 = Sketch_3.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_4 = Sketch_3.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_3.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_3.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_3.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_3.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_3.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_6.result()) -SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_3 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_7 = SketchProjection_3.createdFeature() -SketchConstraintDistance_1 = Sketch_3.setDistance(SketchLine_5.endPoint(), SketchLine_7.result(), 7, True) -SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result()) +SketchConstraintDistance_1 = Sketch_3.setDistance( + SketchLine_5.endPoint(), SketchLine_7.result(), 7, True +) +SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint( + SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result() +) SketchConstraintLength_1 = Sketch_3.setLength(SketchLine_4.result(), 5) SketchLine_8 = Sketch_3.addLine(7, 7, -7.000000000000001, 7) SketchLine_9 = Sketch_3.addLine(-7.000000000000001, 7, -7.000000000000001, 10) SketchLine_10 = Sketch_3.addLine(-7.000000000000001, 10, 7, 10) SketchLine_11 = Sketch_3.addLine(7, 10, 7, 7) -SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_8 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_3.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_3.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_3.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_9.result()) SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_10.result()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_11.result()) -SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_9.startPoint(), SketchLine_4.result()) -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_8.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_12 = Sketch_3.setCoincident( + SketchLine_9.startPoint(), SketchLine_4.result() +) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_8.startPoint(), SketchLine_6.result() +) SketchConstraintLength_2 = Sketch_3.setLength(SketchLine_9.result(), 3) -SketchConstraintDistance_2 = Sketch_3.setDistance(SketchLine_9.startPoint(), SketchLine_5.result(), 2, True) +SketchConstraintDistance_2 = Sketch_3.setDistance( + SketchLine_9.startPoint(), SketchLine_5.result(), 2, True +) model.do() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")], model.selection(), 50, -10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r")], model.selection(), 60, 20) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_4_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_3 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], + model.selection(), + 50, + -10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r", + ) + ], + model.selection(), + 60, + 20, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_4_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_3 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_3.result().subResult(0).setColor(0, 170, 0) Compound_3.result().subResult(1).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(1).setColor(0, 255, 0) -Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_1"), model.selection("SOLID", "Compound_2_1_2_3")], [model.selection("SOLID", "Compound_3_1_2_2")]) +Smash_1 = model.addSmash( + Part_1_doc, + [ + model.selection("SOLID", "Compound_2_1_1_1"), + model.selection("SOLID", "Compound_2_1_2_3"), + ], + [model.selection("SOLID", "Compound_3_1_2_2")], +) model.testHaveNamingSubshapes(Smash_1, model, Part_1_doc) @@ -118,4 +225,4 @@ model.testNbSubShapes(Smash_1, GeomAPI_Shape.EDGE, [328]) model.testNbSubShapes(Smash_1, GeomAPI_Shape.VERTEX, [656]) model.testResultsVolumes(Smash_1, [21124.1140931756599457]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanSmash_MultiLevelCompound_v20190506_1.py b/src/FeaturesPlugin/Test/TestBooleanSmash_MultiLevelCompound_v20190506_1.py index e95f19638..3a0dd9288 100644 --- a/src/FeaturesPlugin/Test/TestBooleanSmash_MultiLevelCompound_v20190506_1.py +++ b/src/FeaturesPlugin/Test/TestBooleanSmash_MultiLevelCompound_v20190506_1.py @@ -25,9 +25,27 @@ 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"), 10, 20) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 40, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 20, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 40, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) LinearCopy_2.result().subResult(0).subResult(0).setColor(255, 170, 0) LinearCopy_2.result().subResult(0).subResult(1).setColor(255, 170, 0) LinearCopy_2.result().subResult(1).subResult(0).setColor(0, 0, 255) @@ -37,47 +55,121 @@ SketchLine_1 = Sketch_1.addLine(7, 0, -7, 0) SketchLine_2 = Sketch_1.addLine(-7, 0, -7, 5) SketchLine_3 = Sketch_1.addLine(-7, 5, 7, 5) SketchLine_4 = Sketch_1.addLine(7, 5, 7, 0) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_5 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_5.result(), 7, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_5.result(), 7, True +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 14) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 5) SketchLine_6 = Sketch_1.addLine(5, 12, -5, 12) SketchLine_7 = Sketch_1.addLine(-5, 12, -5, 15) SketchLine_8 = Sketch_1.addLine(-5, 15, 5, 15) SketchLine_9 = Sketch_1.addLine(5, 15, 5, 12) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_9.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()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_9.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() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 3) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 10) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_5.result(), 5, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_3.result(), 7, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_5.result(), 5, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchLine_3.result(), 7, True +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 60, 20) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r")], model.selection(), 55, 15) -LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 60, + 20, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r", + ) + ], + model.selection(), + 55, + 15, +) +LinearCopy_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "LinearCopy_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_1.result().subResult(0).subResult(0).setColor(0, 170, 0) Compound_1.result().subResult(0).subResult(1).setColor(0, 170, 0) Compound_1.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_1.result().subResult(1).subResult(1).setColor(0, 255, 0) -Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "LinearCopy_2_1_1_1")], [model.selection("SOLID", "Compound_1_1_2_1"), model.selection("SOLID", "Compound_1_1_2_2")], keepSubResults = True) +Smash_1 = model.addSmash( + Part_1_doc, + [model.selection("SOLID", "LinearCopy_2_1_1_1")], + [ + model.selection("SOLID", "Compound_1_1_2_1"), + model.selection("SOLID", "Compound_1_1_2_2"), + ], + keepSubResults=True, +) model.testHaveNamingSubshapes(Smash_1, model, Part_1_doc) @@ -93,4 +185,4 @@ model.testNbSubShapes(Smash_1, GeomAPI_Shape.EDGE, [408]) model.testNbSubShapes(Smash_1, GeomAPI_Shape.VERTEX, [816]) model.testResultsVolumes(Smash_1, [38810.840569277926988]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanSmash_MultiLevelCompound_v20190506_2.py b/src/FeaturesPlugin/Test/TestBooleanSmash_MultiLevelCompound_v20190506_2.py index 20774b8a1..77bfeae27 100644 --- a/src/FeaturesPlugin/Test/TestBooleanSmash_MultiLevelCompound_v20190506_2.py +++ b/src/FeaturesPlugin/Test/TestBooleanSmash_MultiLevelCompound_v20190506_2.py @@ -26,32 +26,70 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 10) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) SketchCircle_2 = Sketch_1.addCircle(10, 0, 10) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_2.center() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0 +) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchCircle_3 = Sketch_2.addCircle(0, -7, 10) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.result(), SketchCircle_3.center()) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.result(), SketchCircle_3.center() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_3.results()[1], 10) -SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance(SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7) +SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance( + SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7 +) SketchCircle_4 = Sketch_2.addCircle(40, -27, 10) -SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_4.results()[1], SketchCircle_3.results()[1]) -SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance(SketchCircle_3.center(), SketchCircle_4.center(), 40) -SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchCircle_4.center(), SketchCircle_3.center(), 20) +SketchConstraintEqual_2 = Sketch_2.setEqual( + SketchCircle_4.results()[1], SketchCircle_3.results()[1] +) +SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance( + SketchCircle_3.center(), SketchCircle_4.center(), 40 +) +SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance( + SketchCircle_4.center(), SketchCircle_3.center(), 20 +) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")]) -Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPSOLID", "Extrusion_1_1")]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "Extrusion_2_2"), + ], +) +Compound_2 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "Compound_1_1"), + model.selection("COMPSOLID", "Extrusion_1_1"), + ], +) Compound_2.result().subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(1).setColor(255, 170, 0) @@ -64,45 +102,115 @@ SketchLine_3 = Sketch_3.addLine(7, 0, -7, 0) SketchLine_4 = Sketch_3.addLine(-7, 0, -7, 5) SketchLine_5 = Sketch_3.addLine(-7, 5, 7, 5) SketchLine_6 = Sketch_3.addLine(7, 5, 7, 0) -SketchConstraintCoincidence_4 = Sketch_3.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_4 = Sketch_3.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_3.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_3.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_3.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_3.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_3.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_6.result()) -SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_3 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_7 = SketchProjection_3.createdFeature() -SketchConstraintDistance_1 = Sketch_3.setDistance(SketchLine_5.endPoint(), SketchLine_7.result(), 7, True) -SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result()) +SketchConstraintDistance_1 = Sketch_3.setDistance( + SketchLine_5.endPoint(), SketchLine_7.result(), 7, True +) +SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint( + SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result() +) SketchConstraintLength_1 = Sketch_3.setLength(SketchLine_4.result(), 5) SketchLine_8 = Sketch_3.addLine(7, 7, -7.000000000000001, 7) SketchLine_9 = Sketch_3.addLine(-7.000000000000001, 7, -7.000000000000001, 10) SketchLine_10 = Sketch_3.addLine(-7.000000000000001, 10, 7, 10) SketchLine_11 = Sketch_3.addLine(7, 10, 7, 7) -SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_8 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_3.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_3.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_3.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_9.result()) SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_10.result()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_11.result()) -SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_9.startPoint(), SketchLine_4.result()) -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_8.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_12 = Sketch_3.setCoincident( + SketchLine_9.startPoint(), SketchLine_4.result() +) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_8.startPoint(), SketchLine_6.result() +) SketchConstraintLength_2 = Sketch_3.setLength(SketchLine_9.result(), 3) -SketchConstraintDistance_2 = Sketch_3.setDistance(SketchLine_9.startPoint(), SketchLine_5.result(), 2, True) +SketchConstraintDistance_2 = Sketch_3.setDistance( + SketchLine_9.startPoint(), SketchLine_5.result(), 2, True +) model.do() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")], model.selection(), 50, -10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r")], model.selection(), 60, 20) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_4_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_3 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], + model.selection(), + 50, + -10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r", + ) + ], + model.selection(), + 60, + 20, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_4_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_3 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_3.result().subResult(0).setColor(0, 170, 0) Compound_3.result().subResult(1).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(1).setColor(0, 255, 0) -Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_1"), model.selection("SOLID", "Compound_2_1_2_3")], [model.selection("SOLID", "Compound_3_1_2_2")], keepSubResults = True) +Smash_1 = model.addSmash( + Part_1_doc, + [ + model.selection("SOLID", "Compound_2_1_1_1"), + model.selection("SOLID", "Compound_2_1_2_3"), + ], + [model.selection("SOLID", "Compound_3_1_2_2")], + keepSubResults=True, +) model.testHaveNamingSubshapes(Smash_1, model, Part_1_doc) @@ -118,4 +226,4 @@ model.testNbSubShapes(Smash_1, GeomAPI_Shape.EDGE, [376]) model.testNbSubShapes(Smash_1, GeomAPI_Shape.VERTEX, [752]) model.testResultsVolumes(Smash_1, [27284.1140931756599457]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanSmash_SolidsHistory.py b/src/FeaturesPlugin/Test/TestBooleanSmash_SolidsHistory.py index 3f478cea9..f98311fa2 100644 --- a/src/FeaturesPlugin/Test/TestBooleanSmash_SolidsHistory.py +++ b/src/FeaturesPlugin/Test/TestBooleanSmash_SolidsHistory.py @@ -28,60 +28,165 @@ 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(26.49384236453203, 25.42805779478775, -23.25985221674878, 25.42805779478775) -SketchLine_2 = Sketch_1.addLine(-23.25985221674878, 25.42805779478775, -23.25985221674878, -22.79086009461325) -SketchLine_3 = Sketch_1.addLine(-23.25985221674878, -22.79086009461325, 26.49384236453203, -22.79086009461325) -SketchLine_4 = Sketch_1.addLine(26.49384236453203, -22.79086009461325, 26.49384236453203, 25.42805779478775) -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()) +SketchLine_1 = Sketch_1.addLine( + 26.49384236453203, 25.42805779478775, -23.25985221674878, 25.42805779478775 +) +SketchLine_2 = Sketch_1.addLine( + -23.25985221674878, 25.42805779478775, -23.25985221674878, -22.79086009461325 +) +SketchLine_3 = Sketch_1.addLine( + -23.25985221674878, -22.79086009461325, 26.49384236453203, -22.79086009461325 +) +SketchLine_4 = Sketch_1.addLine( + 26.49384236453203, -22.79086009461325, 26.49384236453203, 25.42805779478775 +) +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(-23.25985221674878, -22.79086009461325, -4.602216748768477, 25.42805779478775) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.result()) -SketchLine_6 = Sketch_1.addLine(-4.602216748768477, 25.42805779478775, 8.458128078817737, -22.79086009461324) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.result()) -SketchLine_7 = Sketch_1.addLine(8.458128078817737, -22.79086009461324, 26.49384236453203, 25.42805779478775) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_7.endPoint()) +SketchLine_5 = Sketch_1.addLine( + -23.25985221674878, -22.79086009461325, -4.602216748768477, 25.42805779478775 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_1.result() +) +SketchLine_6 = Sketch_1.addLine( + -4.602216748768477, 25.42805779478775, 8.458128078817737, -22.79086009461324 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.result() +) +SketchLine_7 = Sketch_1.addLine( + 8.458128078817737, -22.79086009461324, 26.49384236453203, 25.42805779478775 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_7.endPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_8 = Sketch_2.addLine(38.18596059113301, 15.79679802955666, -30.91800131851275, 15.79679802955666) -SketchLine_9 = Sketch_2.addLine(-30.91800131851275, 15.79679802955666, -30.91800131851275, -10.07512315270936) -SketchLine_10 = Sketch_2.addLine(-30.91800131851275, -10.07512315270936, 38.18596059113301, -10.07512315270936) -SketchLine_11 = Sketch_2.addLine(38.18596059113301, -10.07512315270936, 38.18596059113301, 15.79679802955666) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchLine_8 = Sketch_2.addLine( + 38.18596059113301, 15.79679802955666, -30.91800131851275, 15.79679802955666 +) +SketchLine_9 = Sketch_2.addLine( + -30.91800131851275, 15.79679802955666, -30.91800131851275, -10.07512315270936 +) +SketchLine_10 = Sketch_2.addLine( + -30.91800131851275, -10.07512315270936, 38.18596059113301, -10.07512315270936 +) +SketchLine_11 = Sketch_2.addLine( + 38.18596059113301, -10.07512315270936, 38.18596059113301, 15.79679802955666 +) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_9.result()) SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_10.result()) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_11.result()) -SketchLine_12 = Sketch_2.addLine(38.18596059113301, 15.79679802955666, -30.91800131851275, 1.368226600985215) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_8.startPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_9.result()) -SketchLine_13 = Sketch_2.addLine(-30.91800131851275, 1.368226600985215, 38.18596059113301, -10.07512315270936) -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_13.endPoint()) +SketchLine_12 = Sketch_2.addLine( + 38.18596059113301, 15.79679802955666, -30.91800131851275, 1.368226600985215 +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_8.startPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_9.result() +) +SketchLine_13 = Sketch_2.addLine( + -30.91800131851275, 1.368226600985215, 38.18596059113301, -10.07512315270936 +) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchLine_13.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 10, 0) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_2")], model.selection(), 5, 5) -Group_1_objects = [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_4"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection(), + 10, + 0, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_2")], + model.selection(), + 5, + 5, +) +Group_1_objects = [ + model.selection("SOLID", "Extrusion_1_1_1"), + model.selection("SOLID", "Extrusion_1_1_4"), + model.selection("SOLID", "Extrusion_1_1_2"), + model.selection("SOLID", "Extrusion_1_1_3"), +] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) -Group_2_objects = [model.selection("SOLID", "Extrusion_2_1_2"), model.selection("SOLID", "Extrusion_2_1_3"), model.selection("SOLID", "Extrusion_2_1_1")] +Group_2_objects = [ + model.selection("SOLID", "Extrusion_2_1_2"), + model.selection("SOLID", "Extrusion_2_1_3"), + model.selection("SOLID", "Extrusion_2_1_1"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("FACE", "Extrusion_1_1_4/From_Face"), model.selection("FACE", "Extrusion_1_1_2/From_Face"), model.selection("FACE", "Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1_4/To_Face"), model.selection("FACE", "Extrusion_1_1_2/To_Face")] +Group_3_objects = [ + model.selection("FACE", "Extrusion_1_1_4/From_Face"), + model.selection("FACE", "Extrusion_1_1_2/From_Face"), + model.selection("FACE", "Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_3"), + model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1"), + model.selection("FACE", "Extrusion_1_1_4/To_Face"), + model.selection("FACE", "Extrusion_1_1_2/To_Face"), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Group_4_objects = [model.selection("FACE", "Extrusion_2_1_2/To_Face"), model.selection("FACE", "Extrusion_2_1_3/To_Face"), model.selection("FACE", "Extrusion_2_1_1/To_Face")] +Group_4_objects = [ + model.selection("FACE", "Extrusion_2_1_2/To_Face"), + model.selection("FACE", "Extrusion_2_1_3/To_Face"), + model.selection("FACE", "Extrusion_2_1_1/To_Face"), +] Group_4 = model.addGroup(Part_1_doc, Group_4_objects) -Smash_1_objects_1 = [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_4"), model.selection("SOLID", "Extrusion_1_1_2")] -Smash_1 = model.addSmash(Part_1_doc, Smash_1_objects_1, [model.selection("SOLID", "Extrusion_2_1_1"), model.selection("SOLID", "Extrusion_2_1_2")]) +Smash_1_objects_1 = [ + model.selection("SOLID", "Extrusion_1_1_1"), + model.selection("SOLID", "Extrusion_1_1_4"), + model.selection("SOLID", "Extrusion_1_1_2"), +] +Smash_1 = model.addSmash( + Part_1_doc, + Smash_1_objects_1, + [ + model.selection("SOLID", "Extrusion_2_1_1"), + model.selection("SOLID", "Extrusion_2_1_2"), + ], +) model.do() # move groups after the Smash Part_1_doc.moveFeature(Group_1.feature(), Smash_1.feature()) @@ -93,27 +198,27 @@ model.end() # check groups are correct aFactory = ModelAPI_Session.get().validators() selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 4) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 4 +assert aFactory.validate(Group_1.feature()) for i in range(4): - assert(Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID) + assert Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 2) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 2 +assert aFactory.validate(Group_2.feature()) for i in range(2): - assert(Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID) + assert Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 10) -assert(aFactory.validate(Group_3.feature())) +assert selectionList.size() == 10 +assert aFactory.validate(Group_3.feature()) for i in range(10): - assert(Group_3.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE) + assert Group_3.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE selectionList = Group_4.feature().selectionList("group_list") -assert(selectionList.size() == 10) -assert(aFactory.validate(Group_4.feature())) +assert selectionList.size() == 10 +assert aFactory.validate(Group_4.feature()) for i in range(10): - assert(Group_4.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE) + assert Group_4.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanSmash_SubSolid_Solid.py b/src/FeaturesPlugin/Test/TestBooleanSmash_SubSolid_Solid.py index 948a91834..f7147eeda 100644 --- a/src/FeaturesPlugin/Test/TestBooleanSmash_SubSolid_Solid.py +++ b/src/FeaturesPlugin/Test/TestBooleanSmash_SubSolid_Solid.py @@ -25,10 +25,19 @@ 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")]) +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")]) +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) @@ -44,4 +53,4 @@ model.testNbSubShapes(Smash_1, GeomAPI_Shape.EDGE, [130]) model.testNbSubShapes(Smash_1, GeomAPI_Shape.VERTEX, [260]) model.testResultsVolumes(Smash_1, [1657]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanSplit.py b/src/FeaturesPlugin/Test/TestBooleanSplit.py index fbd3ba2f8..bc91ea805 100644 --- a/src/FeaturesPlugin/Test/TestBooleanSplit.py +++ b/src/FeaturesPlugin/Test/TestBooleanSplit.py @@ -31,9 +31,19 @@ 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) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_1_2")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1"), model.selection("COMPOUND", "Sketch_2")], + model.selection(), + 100, + 0, +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + [model.selection("SOLID", "Extrusion_1_2")], +) model.do() model.end() -assert (len(Split_1.results()) > 0) -assert(model.checkPythonDump()) +assert len(Split_1.results()) > 0 +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanSplitWithPlane.py b/src/FeaturesPlugin/Test/TestBooleanSplitWithPlane.py index 465477640..900053b48 100644 --- a/src/FeaturesPlugin/Test/TestBooleanSplitWithPlane.py +++ b/src/FeaturesPlugin/Test/TestBooleanSplitWithPlane.py @@ -26,38 +26,89 @@ 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.45430931454487, 141.3050678403047, -211.8625790259634, 141.3050678403047) -SketchLine_2 = Sketch_1.addLine(-211.8625790259634, 141.3050678403047, -211.8625790259634, -163.3288837233227) -SketchLine_3 = Sketch_1.addLine(-211.8625790259634, -163.3288837233227, 50.45430931454487, -163.3288837233227) -SketchLine_4 = Sketch_1.addLine(50.45430931454487, -163.3288837233227, 50.45430931454487, 141.3050678403047) -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()) +SketchLine_1 = Sketch_1.addLine( + 50.45430931454487, 141.3050678403047, -211.8625790259634, 141.3050678403047 +) +SketchLine_2 = Sketch_1.addLine( + -211.8625790259634, 141.3050678403047, -211.8625790259634, -163.3288837233227 +) +SketchLine_3 = Sketch_1.addLine( + -211.8625790259634, -163.3288837233227, 50.45430931454487, -163.3288837233227 +) +SketchLine_4 = Sketch_1.addLine( + 50.45430931454487, -163.3288837233227, 50.45430931454487, 141.3050678403047 +) +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(246.5736143115653, 48.78197815871301, -51.09047583637312, 48.78197815871301) -SketchLine_6 = Sketch_1.addLine(-51.09047583637312, 48.78197815871301, -51.09047583637312, -104.8260668928192) -SketchLine_7 = Sketch_1.addLine(-51.09047583637312, -104.8260668928192, 246.5736143115653, -104.8260668928192) -SketchLine_8 = Sketch_1.addLine(246.5736143115653, -104.8260668928192, 246.5736143115653, 48.78197815871301) -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()) +SketchLine_5 = Sketch_1.addLine( + 246.5736143115653, 48.78197815871301, -51.09047583637312, 48.78197815871301 +) +SketchLine_6 = Sketch_1.addLine( + -51.09047583637312, 48.78197815871301, -51.09047583637312, -104.8260668928192 +) +SketchLine_7 = Sketch_1.addLine( + -51.09047583637312, -104.8260668928192, 246.5736143115653, -104.8260668928192 +) +SketchLine_8 = Sketch_1.addLine( + 246.5736143115653, -104.8260668928192, 246.5736143115653, 48.78197815871301 +) +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()) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", GeomAPI_Pnt(17.35551764280096, -11.01190794150899, 0))], model.selection(), 100, 0) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SOLID", GeomAPI_Pnt(-0.3180832609141306, -28.0220443670531, 50.00000000000001))], [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, +) +Split_1 = model.addSplit( + Part_1_doc, + [ + model.selection( + "SOLID", + GeomAPI_Pnt(-0.3180832609141306, -28.0220443670531, 50.00000000000001), + ) + ], + [model.selection("FACE", "PartSet/YOZ")], +) model.do() model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Split_1, 1) model.testNbSubResults(Split_1, [4]) @@ -67,4 +118,4 @@ model.testNbSubShapes(Split_1, GeomAPI_Shape.EDGE, [132]) model.testNbSubShapes(Split_1, GeomAPI_Shape.VERTEX, [264]) model.testResultsVolumes(Split_1, [11003613.329450136050581932067871094]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanSplit_ErrorMsg.py b/src/FeaturesPlugin/Test/TestBooleanSplit_ErrorMsg.py index 8800576d3..1a92f8777 100644 --- a/src/FeaturesPlugin/Test/TestBooleanSplit_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestBooleanSplit_ErrorMsg.py @@ -18,6 +18,7 @@ # from ModelAPI import * + aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -31,5 +32,5 @@ aPart = aPartResult.partDoc() aSession.startOperation() Split_1 = aPart.addFeature("Split") Split_1.execute() -assert(Split_1.error() != "") +assert Split_1.error() != "" aSession.finishOperation() diff --git a/src/FeaturesPlugin/Test/TestBooleanSplit_MultiLevelCompound_v0_1.py b/src/FeaturesPlugin/Test/TestBooleanSplit_MultiLevelCompound_v0_1.py index e8191ca8d..8f30ec61f 100644 --- a/src/FeaturesPlugin/Test/TestBooleanSplit_MultiLevelCompound_v0_1.py +++ b/src/FeaturesPlugin/Test/TestBooleanSplit_MultiLevelCompound_v0_1.py @@ -25,9 +25,27 @@ 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"), 10, 20) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 40, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 20, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 40, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) LinearCopy_2.result().subResult(0).subResult(0).setColor(255, 170, 0) LinearCopy_2.result().subResult(0).subResult(1).setColor(255, 170, 0) LinearCopy_2.result().subResult(1).subResult(0).setColor(0, 0, 255) @@ -37,47 +55,117 @@ SketchLine_1 = Sketch_1.addLine(7, 0, -7, 0) SketchLine_2 = Sketch_1.addLine(-7, 0, -7, 5) SketchLine_3 = Sketch_1.addLine(-7, 5, 7, 5) SketchLine_4 = Sketch_1.addLine(7, 5, 7, 0) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_5 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_5.result(), 7, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_5.result(), 7, True +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 14) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 5) SketchLine_6 = Sketch_1.addLine(5, 12, -5, 12) SketchLine_7 = Sketch_1.addLine(-5, 12, -5, 15) SketchLine_8 = Sketch_1.addLine(-5, 15, 5, 15) SketchLine_9 = Sketch_1.addLine(5, 15, 5, 12) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_9.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()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_9.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() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 3) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 10) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_5.result(), 5, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_3.result(), 7, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_5.result(), 5, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchLine_3.result(), 7, True +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 60, 20) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r")], model.selection(), 55, 15) -LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 60, + 20, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r", + ) + ], + model.selection(), + 55, + 15, +) +LinearCopy_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "LinearCopy_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_1.result().subResult(0).subResult(0).setColor(0, 170, 0) Compound_1.result().subResult(0).subResult(1).setColor(0, 170, 0) Compound_1.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_1.result().subResult(1).subResult(1).setColor(0, 255, 0) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SOLID", "LinearCopy_2_1_1_1")], [model.selection("COMPOUND", "Compound_1_1_2")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "LinearCopy_2_1_1_1")], + [model.selection("COMPOUND", "Compound_1_1_2")], +) model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) @@ -93,4 +181,4 @@ model.testNbSubShapes(Split_1, GeomAPI_Shape.EDGE, [226]) model.testNbSubShapes(Split_1, GeomAPI_Shape.VERTEX, [452]) model.testResultsVolumes(Split_1, [6283.185307194357847038190811872]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanSplit_MultiLevelCompound_v0_2.py b/src/FeaturesPlugin/Test/TestBooleanSplit_MultiLevelCompound_v0_2.py index e41d47021..e7c9b80f4 100644 --- a/src/FeaturesPlugin/Test/TestBooleanSplit_MultiLevelCompound_v0_2.py +++ b/src/FeaturesPlugin/Test/TestBooleanSplit_MultiLevelCompound_v0_2.py @@ -26,32 +26,70 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 10) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) SketchCircle_2 = Sketch_1.addCircle(10, 0, 10) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_2.center() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0 +) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchCircle_3 = Sketch_2.addCircle(0, -7, 10) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.result(), SketchCircle_3.center()) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.result(), SketchCircle_3.center() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_3.results()[1], 10) -SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance(SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7) +SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance( + SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7 +) SketchCircle_4 = Sketch_2.addCircle(40, -27, 10) -SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_4.results()[1], SketchCircle_3.results()[1]) -SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance(SketchCircle_3.center(), SketchCircle_4.center(), 40) -SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchCircle_4.center(), SketchCircle_3.center(), 20) +SketchConstraintEqual_2 = Sketch_2.setEqual( + SketchCircle_4.results()[1], SketchCircle_3.results()[1] +) +SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance( + SketchCircle_3.center(), SketchCircle_4.center(), 40 +) +SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance( + SketchCircle_4.center(), SketchCircle_3.center(), 20 +) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")]) -Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPSOLID", "Extrusion_1_1")]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "Extrusion_2_2"), + ], +) +Compound_2 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "Compound_1_1"), + model.selection("COMPSOLID", "Extrusion_1_1"), + ], +) Compound_2.result().subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(1).setColor(255, 170, 0) @@ -64,45 +102,114 @@ SketchLine_3 = Sketch_3.addLine(7, 0, -7, 0) SketchLine_4 = Sketch_3.addLine(-7, 0, -7, 5) SketchLine_5 = Sketch_3.addLine(-7, 5, 7, 5) SketchLine_6 = Sketch_3.addLine(7, 5, 7, 0) -SketchConstraintCoincidence_4 = Sketch_3.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_4 = Sketch_3.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_3.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_3.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_3.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_3.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_3.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_6.result()) -SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_3 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_7 = SketchProjection_3.createdFeature() -SketchConstraintDistance_1 = Sketch_3.setDistance(SketchLine_5.endPoint(), SketchLine_7.result(), 7, True) -SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result()) +SketchConstraintDistance_1 = Sketch_3.setDistance( + SketchLine_5.endPoint(), SketchLine_7.result(), 7, True +) +SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint( + SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result() +) SketchConstraintLength_1 = Sketch_3.setLength(SketchLine_4.result(), 5) SketchLine_8 = Sketch_3.addLine(7, 7, -7.000000000000001, 7) SketchLine_9 = Sketch_3.addLine(-7.000000000000001, 7, -7.000000000000001, 10) SketchLine_10 = Sketch_3.addLine(-7.000000000000001, 10, 7, 10) SketchLine_11 = Sketch_3.addLine(7, 10, 7, 7) -SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_8 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_3.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_3.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_3.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_9.result()) SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_10.result()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_11.result()) -SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_9.startPoint(), SketchLine_4.result()) -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_8.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_12 = Sketch_3.setCoincident( + SketchLine_9.startPoint(), SketchLine_4.result() +) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_8.startPoint(), SketchLine_6.result() +) SketchConstraintLength_2 = Sketch_3.setLength(SketchLine_9.result(), 3) -SketchConstraintDistance_2 = Sketch_3.setDistance(SketchLine_9.startPoint(), SketchLine_5.result(), 2, True) +SketchConstraintDistance_2 = Sketch_3.setDistance( + SketchLine_9.startPoint(), SketchLine_5.result(), 2, True +) model.do() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")], model.selection(), 50, -10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r")], model.selection(), 60, 20) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_4_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_3 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], + model.selection(), + 50, + -10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r", + ) + ], + model.selection(), + 60, + 20, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_4_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_3 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_3.result().subResult(0).setColor(0, 170, 0) Compound_3.result().subResult(1).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(1).setColor(0, 255, 0) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_1"), model.selection("SOLID", "Compound_2_1_2_3")], [model.selection("COMPOUND", "Compound_3_1_2")]) +Split_1 = model.addSplit( + Part_1_doc, + [ + model.selection("SOLID", "Compound_2_1_1_1"), + model.selection("SOLID", "Compound_2_1_2_3"), + ], + [model.selection("COMPOUND", "Compound_3_1_2")], +) model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) @@ -118,4 +225,4 @@ model.testNbSubShapes(Split_1, GeomAPI_Shape.EDGE, [148, 250]) model.testNbSubShapes(Split_1, GeomAPI_Shape.VERTEX, [296, 500]) model.testResultsVolumes(Split_1, [6283.185307174889203452, 10109.63121762967239192]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanSplit_MultiLevelCompound_v20190506_1.py b/src/FeaturesPlugin/Test/TestBooleanSplit_MultiLevelCompound_v20190506_1.py index 3e6c2ed3d..ec0cbe7a9 100644 --- a/src/FeaturesPlugin/Test/TestBooleanSplit_MultiLevelCompound_v20190506_1.py +++ b/src/FeaturesPlugin/Test/TestBooleanSplit_MultiLevelCompound_v20190506_1.py @@ -25,9 +25,27 @@ 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"), 10, 20) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 40, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 20, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 40, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) LinearCopy_2.result().subResult(0).subResult(0).setColor(255, 170, 0) LinearCopy_2.result().subResult(0).subResult(1).setColor(255, 170, 0) LinearCopy_2.result().subResult(1).subResult(0).setColor(0, 0, 255) @@ -37,47 +55,118 @@ SketchLine_1 = Sketch_1.addLine(7, 0, -7, 0) SketchLine_2 = Sketch_1.addLine(-7, 0, -7, 5) SketchLine_3 = Sketch_1.addLine(-7, 5, 7, 5) SketchLine_4 = Sketch_1.addLine(7, 5, 7, 0) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_5 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_5.result(), 7, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_5.result(), 7, True +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 14) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 5) SketchLine_6 = Sketch_1.addLine(5, 12, -5, 12) SketchLine_7 = Sketch_1.addLine(-5, 12, -5, 15) SketchLine_8 = Sketch_1.addLine(-5, 15, 5, 15) SketchLine_9 = Sketch_1.addLine(5, 15, 5, 12) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_9.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()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_9.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() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 3) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 10) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_5.result(), 5, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_3.result(), 7, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_5.result(), 5, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchLine_3.result(), 7, True +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 60, 20) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r")], model.selection(), 55, 15) -LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 60, + 20, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r", + ) + ], + model.selection(), + 55, + 15, +) +LinearCopy_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "LinearCopy_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_1.result().subResult(0).subResult(0).setColor(0, 170, 0) Compound_1.result().subResult(0).subResult(1).setColor(0, 170, 0) Compound_1.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_1.result().subResult(1).subResult(1).setColor(0, 255, 0) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SOLID", "LinearCopy_2_1_1_1")], [model.selection("COMPOUND", "Compound_1_1_2")], keepSubResults = True) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "LinearCopy_2_1_1_1")], + [model.selection("COMPOUND", "Compound_1_1_2")], + keepSubResults=True, +) model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) @@ -93,4 +182,4 @@ model.testNbSubShapes(Split_1, GeomAPI_Shape.EDGE, [292]) model.testNbSubShapes(Split_1, GeomAPI_Shape.VERTEX, [584]) model.testResultsVolumes(Split_1, [36332.7412287331171683]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBooleanSplit_MultiLevelCompound_v20190506_2.py b/src/FeaturesPlugin/Test/TestBooleanSplit_MultiLevelCompound_v20190506_2.py index edb22d9ab..b59e1ae2d 100644 --- a/src/FeaturesPlugin/Test/TestBooleanSplit_MultiLevelCompound_v20190506_2.py +++ b/src/FeaturesPlugin/Test/TestBooleanSplit_MultiLevelCompound_v20190506_2.py @@ -26,32 +26,70 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 10) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) SketchCircle_2 = Sketch_1.addCircle(10, 0, 10) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_2.center() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0 +) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchCircle_3 = Sketch_2.addCircle(0, -7, 10) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.result(), SketchCircle_3.center()) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.result(), SketchCircle_3.center() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_3.results()[1], 10) -SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance(SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7) +SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance( + SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7 +) SketchCircle_4 = Sketch_2.addCircle(40, -27, 10) -SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_4.results()[1], SketchCircle_3.results()[1]) -SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance(SketchCircle_3.center(), SketchCircle_4.center(), 40) -SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchCircle_4.center(), SketchCircle_3.center(), 20) +SketchConstraintEqual_2 = Sketch_2.setEqual( + SketchCircle_4.results()[1], SketchCircle_3.results()[1] +) +SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance( + SketchCircle_3.center(), SketchCircle_4.center(), 40 +) +SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance( + SketchCircle_4.center(), SketchCircle_3.center(), 20 +) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")]) -Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPSOLID", "Extrusion_1_1")]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "Extrusion_2_2"), + ], +) +Compound_2 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "Compound_1_1"), + model.selection("COMPSOLID", "Extrusion_1_1"), + ], +) Compound_2.result().subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(1).setColor(255, 170, 0) @@ -64,45 +102,115 @@ SketchLine_3 = Sketch_3.addLine(7, 0, -7, 0) SketchLine_4 = Sketch_3.addLine(-7, 0, -7, 5) SketchLine_5 = Sketch_3.addLine(-7, 5, 7, 5) SketchLine_6 = Sketch_3.addLine(7, 5, 7, 0) -SketchConstraintCoincidence_4 = Sketch_3.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_4 = Sketch_3.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_3.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_3.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_3.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_3.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_3.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_6.result()) -SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_3 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_7 = SketchProjection_3.createdFeature() -SketchConstraintDistance_1 = Sketch_3.setDistance(SketchLine_5.endPoint(), SketchLine_7.result(), 7, True) -SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result()) +SketchConstraintDistance_1 = Sketch_3.setDistance( + SketchLine_5.endPoint(), SketchLine_7.result(), 7, True +) +SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint( + SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result() +) SketchConstraintLength_1 = Sketch_3.setLength(SketchLine_4.result(), 5) SketchLine_8 = Sketch_3.addLine(7, 7, -7.000000000000001, 7) SketchLine_9 = Sketch_3.addLine(-7.000000000000001, 7, -7.000000000000001, 10) SketchLine_10 = Sketch_3.addLine(-7.000000000000001, 10, 7, 10) SketchLine_11 = Sketch_3.addLine(7, 10, 7, 7) -SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_8 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_3.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_3.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_3.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_9.result()) SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_10.result()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_11.result()) -SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_9.startPoint(), SketchLine_4.result()) -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_8.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_12 = Sketch_3.setCoincident( + SketchLine_9.startPoint(), SketchLine_4.result() +) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_8.startPoint(), SketchLine_6.result() +) SketchConstraintLength_2 = Sketch_3.setLength(SketchLine_9.result(), 3) -SketchConstraintDistance_2 = Sketch_3.setDistance(SketchLine_9.startPoint(), SketchLine_5.result(), 2, True) +SketchConstraintDistance_2 = Sketch_3.setDistance( + SketchLine_9.startPoint(), SketchLine_5.result(), 2, True +) model.do() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")], model.selection(), 50, -10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r")], model.selection(), 60, 20) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_4_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_3 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], + model.selection(), + 50, + -10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r", + ) + ], + model.selection(), + 60, + 20, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_4_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_3 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_3.result().subResult(0).setColor(0, 170, 0) Compound_3.result().subResult(1).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(1).setColor(0, 255, 0) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_1"), model.selection("SOLID", "Compound_2_1_2_3")], [model.selection("COMPOUND", "Compound_3_1_2")], keepSubResults = True) +Split_1 = model.addSplit( + Part_1_doc, + [ + model.selection("SOLID", "Compound_2_1_1_1"), + model.selection("SOLID", "Compound_2_1_2_3"), + ], + [model.selection("COMPOUND", "Compound_3_1_2")], + keepSubResults=True, +) model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) @@ -118,4 +226,4 @@ model.testNbSubShapes(Split_1, GeomAPI_Shape.EDGE, [428]) model.testNbSubShapes(Split_1, GeomAPI_Shape.VERTEX, [856]) model.testResultsVolumes(Split_1, [25476.0018319841583434]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestBoolean_ErrorMsg.py b/src/FeaturesPlugin/Test/TestBoolean_ErrorMsg.py index ce2914c6a..56cb7aa8e 100644 --- a/src/FeaturesPlugin/Test/TestBoolean_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestBoolean_ErrorMsg.py @@ -24,18 +24,31 @@ 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")]) +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() != "") +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() != "") +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() != "") +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() diff --git a/src/FeaturesPlugin/Test/TestBoundingBox.py b/src/FeaturesPlugin/Test/TestBoundingBox.py index 98b4c7f48..bd0c932c4 100644 --- a/src/FeaturesPlugin/Test/TestBoundingBox.py +++ b/src/FeaturesPlugin/Test/TestBoundingBox.py @@ -20,9 +20,9 @@ """ Unit test of ... """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= import os @@ -35,25 +35,35 @@ from salome.shaper import model __updated__ = "2020-11-12" -#========================================================================= +# ========================================================================= # test Bounding Box -#========================================================================= +# ========================================================================= def test_Bounding_Box(): - model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() ### Create Cone - Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10) + Cone_1 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 5, + 10, + ) model.do() ### Create BoundingBox - BoundingBox_1 = model.getBoundingBox(Part_1_doc, model.selection("SOLID", "Cone_1_1")) + BoundingBox_1 = model.getBoundingBox( + Part_1_doc, model.selection("SOLID", "Cone_1_1") + ) model.end() myDelta = 1e-6 - Props = model.getGeometryCalculation(Part_1_doc,model.selection("SOLID", "BoundingBox_1_1")) + Props = model.getGeometryCalculation( + Part_1_doc, model.selection("SOLID", "BoundingBox_1_1") + ) print(" Basic Properties:") print(" Wires length: ", Props[0]) @@ -62,21 +72,28 @@ def test_Bounding_Box(): aReflength = 200 aReslength = Props[0] - assert (math.fabs(aReslength - aReflength) < myDelta), "The surface is wrong: expected = {0}, real = {1}".format(aReflength, aReslength) + assert ( + math.fabs(aReslength - aReflength) < myDelta + ), "The surface is wrong: expected = {0}, real = {1}".format(aReflength, aReslength) aRefSurface = 1600 aResSurface = Props[1] - assert (math.fabs(aResSurface - aRefSurface) < myDelta), "The surface is wrong: expected = {0}, real = {1}".format(aRefSurface, aResSurface) + assert ( + math.fabs(aResSurface - aRefSurface) < myDelta + ), "The surface is wrong: expected = {0}, real = {1}".format( + aRefSurface, aResSurface + ) aRefVolume = 4000 aResVolume = Props[2] - assert (math.fabs(aResVolume - aRefVolume) < myDelta), "The volume is wrong: expected = {0}, real = {1}".format(aRefVolume, aResVolume) - + assert ( + math.fabs(aResVolume - aRefVolume) < myDelta + ), "The volume is wrong: expected = {0}, real = {1}".format(aRefVolume, aResVolume) -if __name__ == '__main__': +if __name__ == "__main__": test_Bounding_Box() - #========================================================================= + # ========================================================================= # End of test - #========================================================================= + # ========================================================================= diff --git a/src/FeaturesPlugin/Test/TestChamfer.py b/src/FeaturesPlugin/Test/TestChamfer.py index a94e36e9d..107fbbcc6 100644 --- a/src/FeaturesPlugin/Test/TestChamfer.py +++ b/src/FeaturesPlugin/Test/TestChamfer.py @@ -27,9 +27,9 @@ from GeomDataAPI import * __updated__ = "2017-11-30" -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() # Create a part for extrusion @@ -63,9 +63,9 @@ aCylinder.real("radius").setValue(5) aCylinder.real("height").setValue(10) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Test 1. Create chamfer with two distances -#========================================================================= +# ========================================================================= aSession.startOperation() aChamfer1 = aPart.addFeature("Chamfer") aChamfer1.string("creation_method").setValue("distance_distance") @@ -74,17 +74,21 @@ anObjects.append("[Box_1_1/Left][Box_1_1/Top]", "edge") aChamfer1.real("d1").setValue(1.5) aChamfer1.real("d2").setValue(2) aSession.finishOperation() -assert(aChamfer1.error() == ""), "FAILED: Chamfer reports error \"{}\"".format(aChamfer1.error()) +assert aChamfer1.error() == "", 'FAILED: Chamfer reports error "{}"'.format( + aChamfer1.error() +) -#========================================================================= +# ========================================================================= # Test 2. Change chamfer type -#========================================================================= +# ========================================================================= aSession.startOperation() aChamfer1.string("creation_method").setValue("distance_angle") aChamfer1.real("d").setValue(1) aChamfer1.real("angle").setValue(30) aSession.finishOperation() -assert(aChamfer1.error() == ""), "FAILED: Chamfer reports error \"{}\"".format(aChamfer1.error()) +assert aChamfer1.error() == "", 'FAILED: Chamfer reports error "{}"'.format( + aChamfer1.error() +) ##========================================================================= ## Test 3. Check chamfer reports error if selected entities from different solids @@ -97,7 +101,7 @@ anObjects.append("Box_1_1/Bottom", "face") aChamfer2.real("d1").setValue(-2) aChamfer2.real("d2").setValue(2) aSession.finishOperation() -assert(aChamfer2.error() != ""), "FAILED: Chamfer does not report error" +assert aChamfer2.error() != "", "FAILED: Chamfer does not report error" ##========================================================================= ## Test 4. Fix the error @@ -105,11 +109,13 @@ assert(aChamfer2.error() != ""), "FAILED: Chamfer does not report error" aSession.startOperation() aChamfer2.real("d1").setValue(1) aSession.finishOperation() -assert(aChamfer2.error() == ""), "FAILED: Chamfer reports error \"{}\"".format(aChamfer2.error()) +assert aChamfer2.error() == "", 'FAILED: Chamfer reports error "{}"'.format( + aChamfer2.error() +) -#========================================================================= +# ========================================================================= # Test 5. Check chamfer reports error on smoothly connected edges -#========================================================================= +# ========================================================================= aSession.startOperation() aChamfer3 = aPart.addFeature("Chamfer") aChamfer3.string("creation_method").setValue("distance_distance") @@ -117,18 +123,19 @@ aChamfer3.selectionList("main_objects").append("Cylinder_1_1/Modified_Face_1", " aChamfer3.real("d1").setValue(1) aChamfer3.real("d2").setValue(1) aSession.finishOperation() -assert(aChamfer3.lastResult() is None), "FAILED: Chamfer chamfer not produce a result" +assert aChamfer3.lastResult() is None, "FAILED: Chamfer chamfer not produce a result" -#========================================================================= +# ========================================================================= # Test 6. Remove last fillet feature -#========================================================================= +# ========================================================================= aSession.startOperation() aPart.removeFeature(aChamfer3) aSession.finishOperation() -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v0_1.py b/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v0_1.py index 91ff69bda..8c6580a6e 100644 --- a/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v0_1.py +++ b/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v0_1.py @@ -27,84 +27,226 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 DISTANCE_1 = 2 DISTANCE_2 = 1 model.begin() -Chamfer_1 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], True, DISTANCE_1, DISTANCE_2) +Chamfer_1 = model.addChamfer( + Part_1_doc, [model.selection("EDGE", "Edge_1_1")], True, DISTANCE_1, DISTANCE_2 +) model.end() -assert(Chamfer_1.feature().error() != "") +assert Chamfer_1.feature().error() != "" model.undo() model.begin() -Chamfer_2 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1")], True, DISTANCE_1, DISTANCE_2) +Chamfer_2 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1")], + True, + DISTANCE_1, + DISTANCE_2, +) model.end() -assert(Chamfer_2.feature().error() != "") +assert Chamfer_2.feature().error() != "" model.undo() model.begin() -Chamfer_3 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_3")], True, DISTANCE_1, DISTANCE_2) +Chamfer_3 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_3")], + True, + DISTANCE_1, + DISTANCE_2, +) model.end() -assert(Chamfer_3.feature().error() != "") +assert Chamfer_3.feature().error() != "" model.undo() model.begin() -Chamfer_4 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Shell_1_1/Modified_Edge&Sketch_1/SketchLine_10")], True, DISTANCE_1, DISTANCE_2) +Chamfer_4 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Shell_1_1/Modified_Edge&Sketch_1/SketchLine_10")], + True, + DISTANCE_1, + DISTANCE_2, +) model.end() -assert(Chamfer_4.feature().error() != "") +assert Chamfer_4.feature().error() != "" model.undo() model.begin() -Chamfer_5 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Translation_1_1/MF:Translated&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Top]"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Right")], True, DISTANCE_1, DISTANCE_2) +Chamfer_5 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Top]", + ), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Right"), + ], + True, + DISTANCE_1, + DISTANCE_2, +) model.testNbResults(Chamfer_5, 1) model.testNbSubResults(Chamfer_5, [0]) model.testNbSubShapes(Chamfer_5, GeomAPI_Shape.SOLID, [1]) @@ -114,9 +256,20 @@ model.testNbSubShapes(Chamfer_5, GeomAPI_Shape.VERTEX, [100]) model.testResultsVolumes(Chamfer_5, [955.8333333]) refPoint = GeomAPI_Pnt(54.9539378, 4.833682, 4.95710549) midPoint = Chamfer_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Chamfer_6 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Top][Box_2_1/Front]"), model.selection("FACE", "Box_2_1/Right")], True, DISTANCE_1, DISTANCE_2) +Chamfer_6 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Top][Box_2_1/Front]" + ), + model.selection("FACE", "Box_2_1/Right"), + ], + True, + DISTANCE_1, + DISTANCE_2, +) model.testNbResults(Chamfer_6, 1) model.testNbSubResults(Chamfer_6, [3]) model.testNbSubShapes(Chamfer_6, GeomAPI_Shape.SOLID, [3]) @@ -126,9 +279,21 @@ model.testNbSubShapes(Chamfer_6, GeomAPI_Shape.VERTEX, [180]) model.testResultsVolumes(Chamfer_6, [1545.0486226]) refPoint = GeomAPI_Pnt(2.5, 2.5, 5) midPoint = Chamfer_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Chamfer_7 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[AngularCopy_1_1_1/MF:Rotated&Box_3_1/Back][AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top]"), model.selection("FACE", "AngularCopy_1_1_2/MF:Rotated&Box_3_1/Left")], True, DISTANCE_1, DISTANCE_2) +Chamfer_7 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[AngularCopy_1_1_1/MF:Rotated&Box_3_1/Back][AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top]", + ), + model.selection("FACE", "AngularCopy_1_1_2/MF:Rotated&Box_3_1/Left"), + ], + True, + DISTANCE_1, + DISTANCE_2, +) model.testNbResults(Chamfer_7, 2) model.testNbSubResults(Chamfer_7, [0, 0]) model.testNbSubShapes(Chamfer_7, GeomAPI_Shape.SOLID, [1, 1]) @@ -139,9 +304,24 @@ model.testResultsVolumes(Chamfer_7, [990, 965.33333333]) model.end() model.begin() -Chamfer_8 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Chamfer_1_1/MF:Chamfer&Box_1_1/Top][Chamfer_1_1/MF:Chamfer&Box_1_1/Left]"), model.selection("EDGE", "[AngularCopy_1_1_3/MF:Rotated&Box_3_1/Left][AngularCopy_1_1_3/MF:Rotated&Box_3_1/Top]")], True, DISTANCE_1, DISTANCE_2) +Chamfer_8 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Chamfer_1_1/MF:Chamfer&Box_1_1/Top][Chamfer_1_1/MF:Chamfer&Box_1_1/Left]", + ), + model.selection( + "EDGE", + "[AngularCopy_1_1_3/MF:Rotated&Box_3_1/Left][AngularCopy_1_1_3/MF:Rotated&Box_3_1/Top]", + ), + ], + True, + DISTANCE_1, + DISTANCE_2, +) model.end() -assert(Chamfer_8.feature().error() != "") +assert Chamfer_8.feature().error() != "" model.undo() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v0_2.py b/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v0_2.py index 1f9f5a456..c3e5e7e1c 100644 --- a/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v0_2.py +++ b/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v0_2.py @@ -27,86 +27,241 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 DISTANCE_1 = 2 DISTANCE_2 = 1 model.begin() -Chamfer_1 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Compound_1_1_2")], True, DISTANCE_1, DISTANCE_2) +Chamfer_1 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_2")], + True, + DISTANCE_1, + DISTANCE_2, +) model.end() -assert(Chamfer_1.feature().error() != "") +assert Chamfer_1.feature().error() != "" model.undo() model.begin() -Chamfer_2 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Compound_1_1_3/Modified_Edge&Sketch_1/SketchLine_1")], True, DISTANCE_1, DISTANCE_2) +Chamfer_2 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_3/Modified_Edge&Sketch_1/SketchLine_1")], + True, + DISTANCE_1, + DISTANCE_2, +) model.end() -assert(Chamfer_2.feature().error() != "") +assert Chamfer_2.feature().error() != "" model.undo() model.begin() -Chamfer_3 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Compound_1_1_4/Modified_Edge&Sketch_1/SketchLine_3")], True, DISTANCE_1, DISTANCE_2) +Chamfer_3 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_4/Modified_Edge&Sketch_1/SketchLine_3")], + True, + DISTANCE_1, + DISTANCE_2, +) model.end() -assert(Chamfer_3.feature().error() != "") +assert Chamfer_3.feature().error() != "" model.undo() model.begin() -Chamfer_4 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Compound_1_1_5/Modified_Edge&Sketch_1/SketchLine_10")], True, DISTANCE_1, DISTANCE_2) +Chamfer_4 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_5/Modified_Edge&Sketch_1/SketchLine_10")], + True, + DISTANCE_1, + DISTANCE_2, +) model.end() -assert(Chamfer_4.feature().error() != "") +assert Chamfer_4.feature().error() != "" model.undo() model.begin() -Chamfer_5 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_6/Modified_Face&Box_1_1/Front][Compound_1_1_6/Modified_Face&Box_1_1/Top]"), model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Back")], True, DISTANCE_1, DISTANCE_2) +Chamfer_5 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Compound_1_1_6/Modified_Face&Box_1_1/Front][Compound_1_1_6/Modified_Face&Box_1_1/Top]", + ), + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Back"), + ], + True, + DISTANCE_1, + DISTANCE_2, +) model.testNbResults(Chamfer_5, 1) model.testNbSubResults(Chamfer_5, [0]) model.testNbSubShapes(Chamfer_5, GeomAPI_Shape.SOLID, [1]) @@ -116,10 +271,22 @@ model.testNbSubShapes(Chamfer_5, GeomAPI_Shape.VERTEX, [92]) model.testResultsVolumes(Chamfer_5, [955.333333333]) refPoint = GeomAPI_Pnt(55.1200279, 5, 4.954640614) midPoint = Chamfer_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, Chamfer_5, [Compound_1.result()], True) -Chamfer_6 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Recover_1_1_7_2/Modified_Face&Box_2_1/Top][Recover_1_1_7_2/Modified_Face&Box_2_1/Front]"), model.selection("FACE", "Recover_1_1_7_2/Modified_Face&Box_2_1/Right")], True, DISTANCE_1, DISTANCE_2) +Chamfer_6 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Recover_1_1_7_2/Modified_Face&Box_2_1/Top][Recover_1_1_7_2/Modified_Face&Box_2_1/Front]", + ), + model.selection("FACE", "Recover_1_1_7_2/Modified_Face&Box_2_1/Right"), + ], + True, + DISTANCE_1, + DISTANCE_2, +) model.testNbResults(Chamfer_6, 1) model.testNbSubResults(Chamfer_6, [3]) model.testNbSubShapes(Chamfer_6, GeomAPI_Shape.SOLID, [3]) @@ -129,10 +296,22 @@ model.testNbSubShapes(Chamfer_6, GeomAPI_Shape.VERTEX, [180]) model.testResultsVolumes(Chamfer_6, [1545.0486226]) refPoint = GeomAPI_Pnt(2.5, 2.5, 5) midPoint = Chamfer_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, Chamfer_6, [Compound_1.result()], True) -Chamfer_7 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Recover_2_1_8_1/Modified_Face&Box_3_1/Back][Recover_2_1_8_1/Modified_Face&Box_3_1/Top]"), model.selection("FACE", "Recover_2_1_8_2/Modified_Face&Box_3_1/Left")], True, DISTANCE_1, DISTANCE_2) +Chamfer_7 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Recover_2_1_8_1/Modified_Face&Box_3_1/Back][Recover_2_1_8_1/Modified_Face&Box_3_1/Top]", + ), + model.selection("FACE", "Recover_2_1_8_2/Modified_Face&Box_3_1/Left"), + ], + True, + DISTANCE_1, + DISTANCE_2, +) model.testNbResults(Chamfer_7, 2) model.testNbSubResults(Chamfer_7, [0, 0]) model.testNbSubShapes(Chamfer_7, GeomAPI_Shape.SOLID, [1, 1]) @@ -142,7 +321,21 @@ model.testNbSubShapes(Chamfer_7, GeomAPI_Shape.VERTEX, [60, 80]) model.testResultsVolumes(Chamfer_7, [990, 965.33333333]) Recover_3 = model.addRecover(Part_1_doc, Chamfer_7, [Compound_1.result()], True) -Chamfer_8 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Recover_3_1_6/Modified_Edge&Chamfer_1_1/ChamferSelected_1"), model.selection("EDGE", "[Recover_3_1_8_2/Modified_Face&Box_3_1/Left][Recover_3_1_8_2/Modified_Face&Box_3_1/Top]")], True, DISTANCE_1, DISTANCE_2) +Chamfer_8 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", "Recover_3_1_6/Modified_Edge&Chamfer_1_1/ChamferSelected_1" + ), + model.selection( + "EDGE", + "[Recover_3_1_8_2/Modified_Face&Box_3_1/Left][Recover_3_1_8_2/Modified_Face&Box_3_1/Top]", + ), + ], + True, + DISTANCE_1, + DISTANCE_2, +) model.testNbResults(Chamfer_8, 2) model.testNbSubResults(Chamfer_8, [0, 0]) model.testNbSubShapes(Chamfer_8, GeomAPI_Shape.SOLID, [1, 1]) @@ -152,4 +345,4 @@ model.testNbSubShapes(Chamfer_8, GeomAPI_Shape.VERTEX, [60, 60]) model.testResultsVolumes(Chamfer_8, [990, 990]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v0_3.py b/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v0_3.py index b4ffb0829..d4e98d806 100644 --- a/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v0_3.py +++ b/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v0_3.py @@ -27,84 +27,226 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 DISTANCE = 2 ANGLE = 30 model.begin() -Chamfer_1 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], False, DISTANCE, ANGLE) +Chamfer_1 = model.addChamfer( + Part_1_doc, [model.selection("EDGE", "Edge_1_1")], False, DISTANCE, ANGLE +) model.end() -assert(Chamfer_1.feature().error() != "") +assert Chamfer_1.feature().error() != "" model.undo() model.begin() -Chamfer_2 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1")], False, DISTANCE, ANGLE) +Chamfer_2 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1")], + False, + DISTANCE, + ANGLE, +) model.end() -assert(Chamfer_2.feature().error() != "") +assert Chamfer_2.feature().error() != "" model.undo() model.begin() -Chamfer_3 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_3")], False, DISTANCE, ANGLE) +Chamfer_3 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_3")], + False, + DISTANCE, + ANGLE, +) model.end() -assert(Chamfer_3.feature().error() != "") +assert Chamfer_3.feature().error() != "" model.undo() model.begin() -Chamfer_4 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Shell_1_1/Modified_Edge&Sketch_1/SketchLine_10")], False, DISTANCE, ANGLE) +Chamfer_4 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Shell_1_1/Modified_Edge&Sketch_1/SketchLine_10")], + False, + DISTANCE, + ANGLE, +) model.end() -assert(Chamfer_4.feature().error() != "") +assert Chamfer_4.feature().error() != "" model.undo() model.begin() -Chamfer_5 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Translation_1_1/MF:Translated&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Top]"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Right")], False, DISTANCE, ANGLE) +Chamfer_5 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Top]", + ), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Right"), + ], + False, + DISTANCE, + ANGLE, +) model.testNbResults(Chamfer_5, 1) model.testNbSubResults(Chamfer_5, [0]) model.testNbSubShapes(Chamfer_5, GeomAPI_Shape.SOLID, [1]) @@ -114,9 +256,20 @@ model.testNbSubShapes(Chamfer_5, GeomAPI_Shape.VERTEX, [96]) model.testResultsVolumes(Chamfer_5, [949.312264841]) refPoint = GeomAPI_Pnt(54.9483743992, 4.810295773, 4.951504868) midPoint = Chamfer_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Chamfer_6 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Top][Box_2_1/Front]"), model.selection("FACE", "Box_2_1/Right")], False, DISTANCE, ANGLE) +Chamfer_6 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Top][Box_2_1/Front]" + ), + model.selection("FACE", "Box_2_1/Right"), + ], + False, + DISTANCE, + ANGLE, +) model.testNbResults(Chamfer_6, 1) model.testNbSubResults(Chamfer_6, [3]) model.testNbSubShapes(Chamfer_6, GeomAPI_Shape.SOLID, [3]) @@ -126,9 +279,21 @@ model.testNbSubShapes(Chamfer_6, GeomAPI_Shape.VERTEX, [180]) model.testResultsVolumes(Chamfer_6, [1538.36088744]) refPoint = GeomAPI_Pnt(2.5, 2.5, 5) midPoint = Chamfer_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Chamfer_7 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[AngularCopy_1_1_1/MF:Rotated&Box_3_1/Back][AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top]"), model.selection("FACE", "AngularCopy_1_1_2/MF:Rotated&Box_3_1/Left")], False, DISTANCE, ANGLE) +Chamfer_7 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[AngularCopy_1_1_1/MF:Rotated&Box_3_1/Back][AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top]", + ), + model.selection("FACE", "AngularCopy_1_1_2/MF:Rotated&Box_3_1/Left"), + ], + False, + DISTANCE, + ANGLE, +) model.testNbResults(Chamfer_7, 2) model.testNbSubResults(Chamfer_7, [0, 0]) model.testNbSubShapes(Chamfer_7, GeomAPI_Shape.SOLID, [1, 1]) @@ -139,9 +304,24 @@ model.testResultsVolumes(Chamfer_7, [988.4529946162, 959.970381336]) model.end() model.begin() -Chamfer_8 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Chamfer_1_1/MF:Chamfer&Box_1_1/Top][Chamfer_1_1/MF:Chamfer&Box_1_1/Left]"), model.selection("EDGE", "[AngularCopy_1_1_3/MF:Rotated&Box_3_1/Left][AngularCopy_1_1_3/MF:Rotated&Box_3_1/Top]")], False, DISTANCE, ANGLE) +Chamfer_8 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Chamfer_1_1/MF:Chamfer&Box_1_1/Top][Chamfer_1_1/MF:Chamfer&Box_1_1/Left]", + ), + model.selection( + "EDGE", + "[AngularCopy_1_1_3/MF:Rotated&Box_3_1/Left][AngularCopy_1_1_3/MF:Rotated&Box_3_1/Top]", + ), + ], + False, + DISTANCE, + ANGLE, +) model.end() -assert(Chamfer_8.feature().error() != "") +assert Chamfer_8.feature().error() != "" model.undo() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v0_4.py b/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v0_4.py index 29f2cab02..a30c8eae9 100644 --- a/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v0_4.py +++ b/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v0_4.py @@ -27,86 +27,237 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 DISTANCE = 2 ANGLE = 30 model.begin() -Chamfer_1 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Compound_1_1_2")], False, DISTANCE, ANGLE) +Chamfer_1 = model.addChamfer( + Part_1_doc, [model.selection("EDGE", "Compound_1_1_2")], False, DISTANCE, ANGLE +) model.end() -assert(Chamfer_1.feature().error() != "") +assert Chamfer_1.feature().error() != "" model.undo() model.begin() -Chamfer_2 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Compound_1_1_3/Modified_Edge&Sketch_1/SketchLine_1")], False, DISTANCE, ANGLE) +Chamfer_2 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_3/Modified_Edge&Sketch_1/SketchLine_1")], + False, + DISTANCE, + ANGLE, +) model.end() -assert(Chamfer_2.feature().error() != "") +assert Chamfer_2.feature().error() != "" model.undo() model.begin() -Chamfer_3 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Compound_1_1_4/Modified_Edge&Sketch_1/SketchLine_3")], False, DISTANCE, ANGLE) +Chamfer_3 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_4/Modified_Edge&Sketch_1/SketchLine_3")], + False, + DISTANCE, + ANGLE, +) model.end() -assert(Chamfer_3.feature().error() != "") +assert Chamfer_3.feature().error() != "" model.undo() model.begin() -Chamfer_4 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Compound_1_1_5/Modified_Edge&Sketch_1/SketchLine_10")], False, DISTANCE, ANGLE) +Chamfer_4 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_5/Modified_Edge&Sketch_1/SketchLine_10")], + False, + DISTANCE, + ANGLE, +) model.end() -assert(Chamfer_4.feature().error() != "") +assert Chamfer_4.feature().error() != "" model.undo() model.begin() -Chamfer_5 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_6/Modified_Face&Box_1_1/Front][Compound_1_1_6/Modified_Face&Box_1_1/Top]"), model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Back")], False, DISTANCE, ANGLE) +Chamfer_5 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Compound_1_1_6/Modified_Face&Box_1_1/Front][Compound_1_1_6/Modified_Face&Box_1_1/Top]", + ), + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Back"), + ], + False, + DISTANCE, + ANGLE, +) model.testNbResults(Chamfer_5, 1) model.testNbSubResults(Chamfer_5, [0]) model.testNbSubShapes(Chamfer_5, GeomAPI_Shape.SOLID, [1]) @@ -116,10 +267,22 @@ model.testNbSubShapes(Chamfer_5, GeomAPI_Shape.VERTEX, [92]) model.testResultsVolumes(Chamfer_5, [948.423375952]) refPoint = GeomAPI_Pnt(55.13797373, 5, 4.94724189) midPoint = Chamfer_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, Chamfer_5, [Compound_1.result()], True) -Chamfer_6 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Recover_1_1_7_2/Modified_Face&Box_2_1/Top][Recover_1_1_7_2/Modified_Face&Box_2_1/Front]"), model.selection("FACE", "Recover_1_1_7_2/Modified_Face&Box_2_1/Right")], False, DISTANCE, ANGLE) +Chamfer_6 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Recover_1_1_7_2/Modified_Face&Box_2_1/Top][Recover_1_1_7_2/Modified_Face&Box_2_1/Front]", + ), + model.selection("FACE", "Recover_1_1_7_2/Modified_Face&Box_2_1/Right"), + ], + False, + DISTANCE, + ANGLE, +) model.testNbResults(Chamfer_6, 1) model.testNbSubResults(Chamfer_6, [3]) model.testNbSubShapes(Chamfer_6, GeomAPI_Shape.SOLID, [3]) @@ -129,10 +292,22 @@ model.testNbSubShapes(Chamfer_6, GeomAPI_Shape.VERTEX, [180]) model.testResultsVolumes(Chamfer_6, [1538.36088744]) refPoint = GeomAPI_Pnt(2.5, 2.5, 5) midPoint = Chamfer_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, Chamfer_6, [Compound_1.result()], True) -Chamfer_7 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Recover_2_1_8_1/Modified_Face&Box_3_1/Back][Recover_2_1_8_1/Modified_Face&Box_3_1/Top]"), model.selection("FACE", "Recover_2_1_8_2/Modified_Face&Box_3_1/Left")], False, DISTANCE, ANGLE) +Chamfer_7 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Recover_2_1_8_1/Modified_Face&Box_3_1/Back][Recover_2_1_8_1/Modified_Face&Box_3_1/Top]", + ), + model.selection("FACE", "Recover_2_1_8_2/Modified_Face&Box_3_1/Left"), + ], + False, + DISTANCE, + ANGLE, +) model.testNbResults(Chamfer_7, 2) model.testNbSubResults(Chamfer_7, [0, 0]) model.testNbSubShapes(Chamfer_7, GeomAPI_Shape.SOLID, [1, 1]) @@ -142,7 +317,21 @@ model.testNbSubShapes(Chamfer_7, GeomAPI_Shape.VERTEX, [60, 80]) model.testResultsVolumes(Chamfer_7, [988.4529946162, 959.970381336]) Recover_3 = model.addRecover(Part_1_doc, Chamfer_7, [Compound_1.result()], True) -Chamfer_8 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Recover_3_1_6/Modified_Edge&Chamfer_1_1/ChamferSelected_1"), model.selection("EDGE", "[Recover_3_1_8_2/Modified_Face&Box_3_1/Left][Recover_3_1_8_2/Modified_Face&Box_3_1/Top]")], False, DISTANCE, ANGLE) +Chamfer_8 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", "Recover_3_1_6/Modified_Edge&Chamfer_1_1/ChamferSelected_1" + ), + model.selection( + "EDGE", + "[Recover_3_1_8_2/Modified_Face&Box_3_1/Left][Recover_3_1_8_2/Modified_Face&Box_3_1/Top]", + ), + ], + False, + DISTANCE, + ANGLE, +) model.testNbResults(Chamfer_8, 2) model.testNbSubResults(Chamfer_8, [0, 0]) model.testNbSubShapes(Chamfer_8, GeomAPI_Shape.SOLID, [1, 1]) @@ -152,4 +341,4 @@ model.testNbSubShapes(Chamfer_8, GeomAPI_Shape.VERTEX, [60, 60]) model.testResultsVolumes(Chamfer_8, [988.4529946162, 988.4529946162]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v95_1.py b/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v95_1.py index 050a38f46..044750c62 100644 --- a/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v95_1.py +++ b/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v95_1.py @@ -27,84 +27,236 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 DISTANCE_1 = 2 DISTANCE_2 = 1 model.begin() -Chamfer_1 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], True, DISTANCE_1, DISTANCE_2, keepSubResults = True) +Chamfer_1 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + True, + DISTANCE_1, + DISTANCE_2, + keepSubResults=True, +) model.end() -assert(Chamfer_1.feature().error() != "") +assert Chamfer_1.feature().error() != "" model.undo() model.begin() -Chamfer_2 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1")], True, DISTANCE_1, DISTANCE_2, keepSubResults = True) +Chamfer_2 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1")], + True, + DISTANCE_1, + DISTANCE_2, + keepSubResults=True, +) model.end() -assert(Chamfer_2.feature().error() != "") +assert Chamfer_2.feature().error() != "" model.undo() model.begin() -Chamfer_3 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_3")], True, DISTANCE_1, DISTANCE_2, keepSubResults = True) +Chamfer_3 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_3")], + True, + DISTANCE_1, + DISTANCE_2, + keepSubResults=True, +) model.end() -assert(Chamfer_3.feature().error() != "") +assert Chamfer_3.feature().error() != "" model.undo() model.begin() -Chamfer_4 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Shell_1_1/Modified_Edge&Sketch_1/SketchLine_10")], True, DISTANCE_1, DISTANCE_2, keepSubResults = True) +Chamfer_4 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Shell_1_1/Modified_Edge&Sketch_1/SketchLine_10")], + True, + DISTANCE_1, + DISTANCE_2, + keepSubResults=True, +) model.end() -assert(Chamfer_4.feature().error() != "") +assert Chamfer_4.feature().error() != "" model.undo() model.begin() -Chamfer_5 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Translation_1_1/MF:Translated&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Top]"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Right")], True, DISTANCE_1, DISTANCE_2, keepSubResults = True) +Chamfer_5 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Top]", + ), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Right"), + ], + True, + DISTANCE_1, + DISTANCE_2, + keepSubResults=True, +) model.testNbResults(Chamfer_5, 1) model.testNbSubResults(Chamfer_5, [0]) model.testNbSubShapes(Chamfer_5, GeomAPI_Shape.SOLID, [1]) @@ -114,9 +266,21 @@ model.testNbSubShapes(Chamfer_5, GeomAPI_Shape.VERTEX, [100]) model.testResultsVolumes(Chamfer_5, [955.8333333]) refPoint = GeomAPI_Pnt(54.9539378, 4.833682, 4.95710549) midPoint = Chamfer_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Chamfer_6 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Top][Box_2_1/Front]"), model.selection("FACE", "Box_2_1/Right")], True, DISTANCE_1, DISTANCE_2, keepSubResults = True) +Chamfer_6 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Top][Box_2_1/Front]" + ), + model.selection("FACE", "Box_2_1/Right"), + ], + True, + DISTANCE_1, + DISTANCE_2, + keepSubResults=True, +) model.testNbResults(Chamfer_6, 1) model.testNbSubResults(Chamfer_6, [3]) model.testNbSubShapes(Chamfer_6, GeomAPI_Shape.SOLID, [3]) @@ -126,9 +290,22 @@ model.testNbSubShapes(Chamfer_6, GeomAPI_Shape.VERTEX, [180]) model.testResultsVolumes(Chamfer_6, [1545.0486226]) refPoint = GeomAPI_Pnt(2.5, 2.5, 5) midPoint = Chamfer_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Chamfer_7 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[AngularCopy_1_1_1/MF:Rotated&Box_3_1/Back][AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top]"), model.selection("FACE", "AngularCopy_1_1_2/MF:Rotated&Box_3_1/Left")], True, DISTANCE_1, DISTANCE_2, keepSubResults = True) +Chamfer_7 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[AngularCopy_1_1_1/MF:Rotated&Box_3_1/Back][AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top]", + ), + model.selection("FACE", "AngularCopy_1_1_2/MF:Rotated&Box_3_1/Left"), + ], + True, + DISTANCE_1, + DISTANCE_2, + keepSubResults=True, +) model.testNbResults(Chamfer_7, 1) model.testNbSubResults(Chamfer_7, [3]) model.testNbSubShapes(Chamfer_7, GeomAPI_Shape.SOLID, [3]) @@ -138,13 +315,29 @@ model.testNbSubShapes(Chamfer_7, GeomAPI_Shape.VERTEX, [188]) model.testResultsVolumes(Chamfer_7, [2955.33333333]) refPoint = GeomAPI_Pnt(-20.9807621135, 42.5, 5) midPoint = Chamfer_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() model.begin() -Chamfer_8 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Chamfer_1_1/MF:Chamfer&Box_1_1/Top][Chamfer_1_1/MF:Chamfer&Box_1_1/Left]"), model.selection("EDGE", "[AngularCopy_1_1_3/MF:Rotated&Box_3_1/Left][AngularCopy_1_1_3/MF:Rotated&Box_3_1/Top]")], True, DISTANCE_1, DISTANCE_2, keepSubResults = True) +Chamfer_8 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Chamfer_1_1/MF:Chamfer&Box_1_1/Top][Chamfer_1_1/MF:Chamfer&Box_1_1/Left]", + ), + model.selection( + "EDGE", + "[AngularCopy_1_1_3/MF:Rotated&Box_3_1/Left][AngularCopy_1_1_3/MF:Rotated&Box_3_1/Top]", + ), + ], + True, + DISTANCE_1, + DISTANCE_2, + keepSubResults=True, +) model.end() -assert(Chamfer_8.feature().error() != "") +assert Chamfer_8.feature().error() != "" model.undo() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v95_2.py b/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v95_2.py index 1714fa7e7..9d41a4049 100644 --- a/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v95_2.py +++ b/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v95_2.py @@ -27,57 +27,177 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 DISTANCE_1 = 2 DISTANCE_2 = 1 @@ -93,6 +213,7 @@ for ind in range(0, Compound_1.result().numberOfSubs()): p = Compound_1.result().subResult(ind).resultSubShapePair()[1].middlePoint() REFERENCE.append(p) + def assertResult(theFeature): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [8]) @@ -104,36 +225,87 @@ def assertResult(theFeature): for ind in range(0, theFeature.result().numberOfSubs()): ref = REFERENCE[ind] - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Chamfer_1 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Compound_1_1_2")], True, DISTANCE_1, DISTANCE_2, keepSubResults = True) +Chamfer_1 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_2")], + True, + DISTANCE_1, + DISTANCE_2, + keepSubResults=True, +) model.end() -assert(Chamfer_1.feature().error() != "") +assert Chamfer_1.feature().error() != "" model.undo() model.begin() -Chamfer_2 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Compound_1_1_3/Modified_Edge&Sketch_1/SketchLine_1")], True, DISTANCE_1, DISTANCE_2, keepSubResults = True) +Chamfer_2 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_3/Modified_Edge&Sketch_1/SketchLine_1")], + True, + DISTANCE_1, + DISTANCE_2, + keepSubResults=True, +) model.end() -assert(Chamfer_2.feature().error() != "") +assert Chamfer_2.feature().error() != "" model.undo() model.begin() -Chamfer_3 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Compound_1_1_4/Modified_Edge&Sketch_1/SketchLine_3")], True, DISTANCE_1, DISTANCE_2, keepSubResults = True) +Chamfer_3 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_4/Modified_Edge&Sketch_1/SketchLine_3")], + True, + DISTANCE_1, + DISTANCE_2, + keepSubResults=True, +) model.end() -assert(Chamfer_3.feature().error() != "") +assert Chamfer_3.feature().error() != "" model.undo() model.begin() -Chamfer_4 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Compound_1_1_5/Modified_Edge&Sketch_1/SketchLine_10")], True, DISTANCE_1, DISTANCE_2, keepSubResults = True) +Chamfer_4 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_5/Modified_Edge&Sketch_1/SketchLine_10")], + True, + DISTANCE_1, + DISTANCE_2, + keepSubResults=True, +) model.end() -assert(Chamfer_4.feature().error() != "") +assert Chamfer_4.feature().error() != "" model.undo() model.begin() -Chamfer_5 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_6/Modified_Face&Box_1_1/Front][Compound_1_1_6/Modified_Face&Box_1_1/Top]"), model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Back")], True, DISTANCE_1, DISTANCE_2, keepSubResults = True) +Chamfer_5 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Compound_1_1_6/Modified_Face&Box_1_1/Front][Compound_1_1_6/Modified_Face&Box_1_1/Top]", + ), + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Back"), + ], + True, + DISTANCE_1, + DISTANCE_2, + keepSubResults=True, +) REFERENCE[5] = GeomAPI_Pnt(55.1200279, 5, 4.954640614) NB_FACES += 5 NB_EDGES += 22 @@ -141,21 +313,63 @@ NB_VERTICES += 44 VOLUME = 5544.3819559356 assertResult(Chamfer_5) -Chamfer_6 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_7_2/Modified_Face&Box_2_1/Top][Compound_1_1_7_2/Modified_Face&Box_2_1/Front]"), model.selection("FACE", "Compound_1_1_7_2/Modified_Face&Box_2_1/Right")], True, DISTANCE_1, DISTANCE_2, keepSubResults = True) +Chamfer_6 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Compound_1_1_7_2/Modified_Face&Box_2_1/Top][Compound_1_1_7_2/Modified_Face&Box_2_1/Front]", + ), + model.selection("FACE", "Compound_1_1_7_2/Modified_Face&Box_2_1/Right"), + ], + True, + DISTANCE_1, + DISTANCE_2, + keepSubResults=True, +) NB_FACES += 6 NB_EDGES += 24 NB_VERTICES += 48 VOLUME = 5500.3819559367 assertResult(Chamfer_6) -Chamfer_7 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_8_1/Modified_Face&Box_3_1/Back][Compound_1_1_8_1/Modified_Face&Box_3_1/Top]"), model.selection("FACE", "Compound_1_1_8_2/Modified_Face&Box_3_1/Left")], True, DISTANCE_1, DISTANCE_2, keepSubResults = True) +Chamfer_7 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Compound_1_1_8_1/Modified_Face&Box_3_1/Back][Compound_1_1_8_1/Modified_Face&Box_3_1/Top]", + ), + model.selection("FACE", "Compound_1_1_8_2/Modified_Face&Box_3_1/Left"), + ], + True, + DISTANCE_1, + DISTANCE_2, + keepSubResults=True, +) NB_FACES += 5 NB_EDGES += 22 NB_VERTICES += 44 VOLUME = 5455.71528927 assertResult(Chamfer_7) -Chamfer_8 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Chamfer_1_1_6/MF:Chamfer&Box_1_1/Bottom][Chamfer_1_1_6/MF:Chamfer&Box_1_1/Front]"), model.selection("EDGE", "[Compound_1_1_8_3/Modified_Face&Box_3_1/Left][Compound_1_1_8_3/Modified_Face&Box_3_1/Top]")], True, DISTANCE_1, DISTANCE_2, keepSubResults = True) +Chamfer_8 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Chamfer_1_1_6/MF:Chamfer&Box_1_1/Bottom][Chamfer_1_1_6/MF:Chamfer&Box_1_1/Front]", + ), + model.selection( + "EDGE", + "[Compound_1_1_8_3/Modified_Face&Box_3_1/Left][Compound_1_1_8_3/Modified_Face&Box_3_1/Top]", + ), + ], + True, + DISTANCE_1, + DISTANCE_2, + keepSubResults=True, +) NB_FACES += 2 NB_EDGES += 12 NB_VERTICES += 24 @@ -165,4 +379,4 @@ assertResult(Chamfer_8) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v95_3.py b/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v95_3.py index b8a4c7e7c..f86f60951 100644 --- a/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v95_3.py +++ b/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v95_3.py @@ -27,84 +27,236 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 DISTANCE = 2 ANGLE = 30 model.begin() -Chamfer_1 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], False, DISTANCE, ANGLE, keepSubResults = True) +Chamfer_1 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + False, + DISTANCE, + ANGLE, + keepSubResults=True, +) model.end() -assert(Chamfer_1.feature().error() != "") +assert Chamfer_1.feature().error() != "" model.undo() model.begin() -Chamfer_2 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1")], False, DISTANCE, ANGLE, keepSubResults = True) +Chamfer_2 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1")], + False, + DISTANCE, + ANGLE, + keepSubResults=True, +) model.end() -assert(Chamfer_2.feature().error() != "") +assert Chamfer_2.feature().error() != "" model.undo() model.begin() -Chamfer_3 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_3")], False, DISTANCE, ANGLE, keepSubResults = True) +Chamfer_3 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_3")], + False, + DISTANCE, + ANGLE, + keepSubResults=True, +) model.end() -assert(Chamfer_3.feature().error() != "") +assert Chamfer_3.feature().error() != "" model.undo() model.begin() -Chamfer_4 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Shell_1_1/Modified_Edge&Sketch_1/SketchLine_10")], False, DISTANCE, ANGLE, keepSubResults = True) +Chamfer_4 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Shell_1_1/Modified_Edge&Sketch_1/SketchLine_10")], + False, + DISTANCE, + ANGLE, + keepSubResults=True, +) model.end() -assert(Chamfer_4.feature().error() != "") +assert Chamfer_4.feature().error() != "" model.undo() model.begin() -Chamfer_5 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Translation_1_1/MF:Translated&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Top]"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Right")], False, DISTANCE, ANGLE, keepSubResults = True) +Chamfer_5 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Top]", + ), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Right"), + ], + False, + DISTANCE, + ANGLE, + keepSubResults=True, +) model.testNbResults(Chamfer_5, 1) model.testNbSubResults(Chamfer_5, [0]) model.testNbSubShapes(Chamfer_5, GeomAPI_Shape.SOLID, [1]) @@ -114,9 +266,21 @@ model.testNbSubShapes(Chamfer_5, GeomAPI_Shape.VERTEX, [96]) model.testResultsVolumes(Chamfer_5, [949.312264841]) refPoint = GeomAPI_Pnt(54.9483743992, 4.810295773, 4.951504868) midPoint = Chamfer_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Chamfer_6 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Top][Box_2_1/Front]"), model.selection("FACE", "Box_2_1/Right")], False, DISTANCE, ANGLE, keepSubResults = True) +Chamfer_6 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Top][Box_2_1/Front]" + ), + model.selection("FACE", "Box_2_1/Right"), + ], + False, + DISTANCE, + ANGLE, + keepSubResults=True, +) model.testNbResults(Chamfer_6, 1) model.testNbSubResults(Chamfer_6, [3]) model.testNbSubShapes(Chamfer_6, GeomAPI_Shape.SOLID, [3]) @@ -126,9 +290,22 @@ model.testNbSubShapes(Chamfer_6, GeomAPI_Shape.VERTEX, [180]) model.testResultsVolumes(Chamfer_6, [1538.36088744]) refPoint = GeomAPI_Pnt(2.5, 2.5, 5) midPoint = Chamfer_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Chamfer_7 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[AngularCopy_1_1_1/MF:Rotated&Box_3_1/Back][AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top]"), model.selection("FACE", "AngularCopy_1_1_2/MF:Rotated&Box_3_1/Left")], False, DISTANCE, ANGLE, keepSubResults = True) +Chamfer_7 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[AngularCopy_1_1_1/MF:Rotated&Box_3_1/Back][AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top]", + ), + model.selection("FACE", "AngularCopy_1_1_2/MF:Rotated&Box_3_1/Left"), + ], + False, + DISTANCE, + ANGLE, + keepSubResults=True, +) model.testNbResults(Chamfer_7, 1) model.testNbSubResults(Chamfer_7, [3]) model.testNbSubShapes(Chamfer_7, GeomAPI_Shape.SOLID, [3]) @@ -138,13 +315,29 @@ model.testNbSubShapes(Chamfer_7, GeomAPI_Shape.VERTEX, [188]) model.testResultsVolumes(Chamfer_7, [2948.42337595]) refPoint = GeomAPI_Pnt(-20.9807621135, 42.5, 5) midPoint = Chamfer_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() model.begin() -Chamfer_8 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Chamfer_1_1/MF:Chamfer&Box_1_1/Top][Chamfer_1_1/MF:Chamfer&Box_1_1/Left]"), model.selection("EDGE", "[AngularCopy_1_1_3/MF:Rotated&Box_3_1/Left][AngularCopy_1_1_3/MF:Rotated&Box_3_1/Top]")], False, DISTANCE, ANGLE, keepSubResults = True) +Chamfer_8 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Chamfer_1_1/MF:Chamfer&Box_1_1/Top][Chamfer_1_1/MF:Chamfer&Box_1_1/Left]", + ), + model.selection( + "EDGE", + "[AngularCopy_1_1_3/MF:Rotated&Box_3_1/Left][AngularCopy_1_1_3/MF:Rotated&Box_3_1/Top]", + ), + ], + False, + DISTANCE, + ANGLE, + keepSubResults=True, +) model.end() -assert(Chamfer_8.feature().error() != "") +assert Chamfer_8.feature().error() != "" model.undo() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v95_4.py b/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v95_4.py index f6769677d..30573c6ce 100644 --- a/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v95_4.py +++ b/src/FeaturesPlugin/Test/TestChamfer_MultiLevelCompound_v95_4.py @@ -27,57 +27,177 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 DISTANCE = 2 ANGLE = 30 @@ -93,6 +213,7 @@ for ind in range(0, Compound_1.result().numberOfSubs()): p = Compound_1.result().subResult(ind).resultSubShapePair()[1].middlePoint() REFERENCE.append(p) + def assertResult(theFeature): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [8]) @@ -104,36 +225,87 @@ def assertResult(theFeature): for ind in range(0, theFeature.result().numberOfSubs()): ref = REFERENCE[ind] - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Chamfer_1 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Compound_1_1_2")], False, DISTANCE, ANGLE, keepSubResults = True) +Chamfer_1 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_2")], + False, + DISTANCE, + ANGLE, + keepSubResults=True, +) model.end() -assert(Chamfer_1.feature().error() != "") +assert Chamfer_1.feature().error() != "" model.undo() model.begin() -Chamfer_2 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Compound_1_1_3/Modified_Edge&Sketch_1/SketchLine_1")], False, DISTANCE, ANGLE, keepSubResults = True) +Chamfer_2 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_3/Modified_Edge&Sketch_1/SketchLine_1")], + False, + DISTANCE, + ANGLE, + keepSubResults=True, +) model.end() -assert(Chamfer_2.feature().error() != "") +assert Chamfer_2.feature().error() != "" model.undo() model.begin() -Chamfer_3 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Compound_1_1_4/Modified_Edge&Sketch_1/SketchLine_3")], False, DISTANCE, ANGLE, keepSubResults = True) +Chamfer_3 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_4/Modified_Edge&Sketch_1/SketchLine_3")], + False, + DISTANCE, + ANGLE, + keepSubResults=True, +) model.end() -assert(Chamfer_3.feature().error() != "") +assert Chamfer_3.feature().error() != "" model.undo() model.begin() -Chamfer_4 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "Compound_1_1_5/Modified_Edge&Sketch_1/SketchLine_10")], False, DISTANCE, ANGLE, keepSubResults = True) +Chamfer_4 = model.addChamfer( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_5/Modified_Edge&Sketch_1/SketchLine_10")], + False, + DISTANCE, + ANGLE, + keepSubResults=True, +) model.end() -assert(Chamfer_4.feature().error() != "") +assert Chamfer_4.feature().error() != "" model.undo() model.begin() -Chamfer_5 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_6/Modified_Face&Box_1_1/Front][Compound_1_1_6/Modified_Face&Box_1_1/Top]"), model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Back")], False, DISTANCE, ANGLE, keepSubResults = True) +Chamfer_5 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Compound_1_1_6/Modified_Face&Box_1_1/Front][Compound_1_1_6/Modified_Face&Box_1_1/Top]", + ), + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Back"), + ], + False, + DISTANCE, + ANGLE, + keepSubResults=True, +) REFERENCE[5] = GeomAPI_Pnt(55.13797373, 5, 4.94724189) NB_FACES += 5 NB_EDGES += 22 @@ -141,7 +313,20 @@ NB_VERTICES += 44 VOLUME = 5537.4719985546 assertResult(Chamfer_5) -Chamfer_6 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_7_2/Modified_Face&Box_2_1/Top][Compound_1_1_7_2/Modified_Face&Box_2_1/Front]"), model.selection("FACE", "Compound_1_1_7_2/Modified_Face&Box_2_1/Right")], False, DISTANCE, ANGLE, keepSubResults = True) +Chamfer_6 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Compound_1_1_7_2/Modified_Face&Box_2_1/Top][Compound_1_1_7_2/Modified_Face&Box_2_1/Front]", + ), + model.selection("FACE", "Compound_1_1_7_2/Modified_Face&Box_2_1/Right"), + ], + False, + DISTANCE, + ANGLE, + keepSubResults=True, +) REFERENCE[6] = GeomAPI_Pnt(2.5, 2.5, 5) NB_FACES += 6 NB_EDGES += 24 @@ -149,7 +334,20 @@ NB_VERTICES += 48 VOLUME = 5486.784263397 assertResult(Chamfer_6) -Chamfer_7 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_8_1/Modified_Face&Box_3_1/Back][Compound_1_1_8_1/Modified_Face&Box_3_1/Top]"), model.selection("FACE", "Compound_1_1_8_2/Modified_Face&Box_3_1/Left")], False, DISTANCE, ANGLE, keepSubResults = True) +Chamfer_7 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Compound_1_1_8_1/Modified_Face&Box_3_1/Back][Compound_1_1_8_1/Modified_Face&Box_3_1/Top]", + ), + model.selection("FACE", "Compound_1_1_8_2/Modified_Face&Box_3_1/Left"), + ], + False, + DISTANCE, + ANGLE, + keepSubResults=True, +) REFERENCE[7] = GeomAPI_Pnt(-20.9807621135, 42.5, 5) NB_FACES += 5 NB_EDGES += 22 @@ -157,7 +355,23 @@ NB_VERTICES += 44 VOLUME = 5435.2076393494 assertResult(Chamfer_7) -Chamfer_8 = model.addChamfer(Part_1_doc, [model.selection("EDGE", "[Chamfer_1_1_6/MF:Chamfer&Box_1_1/Bottom][Chamfer_1_1_6/MF:Chamfer&Box_1_1/Front]"), model.selection("EDGE", "[Compound_1_1_8_3/Modified_Face&Box_3_1/Left][Compound_1_1_8_3/Modified_Face&Box_3_1/Top]")], False, DISTANCE, ANGLE, keepSubResults = True) +Chamfer_8 = model.addChamfer( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Chamfer_1_1_6/MF:Chamfer&Box_1_1/Bottom][Chamfer_1_1_6/MF:Chamfer&Box_1_1/Front]", + ), + model.selection( + "EDGE", + "[Compound_1_1_8_3/Modified_Face&Box_3_1/Left][Compound_1_1_8_3/Modified_Face&Box_3_1/Top]", + ), + ], + False, + DISTANCE, + ANGLE, + keepSubResults=True, +) NB_FACES += 2 NB_EDGES += 12 NB_VERTICES += 24 @@ -167,4 +381,4 @@ assertResult(Chamfer_8) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestCheckSharedFaces.py b/src/FeaturesPlugin/Test/TestCheckSharedFaces.py index f473713ca..f269c25ab 100644 --- a/src/FeaturesPlugin/Test/TestCheckSharedFaces.py +++ b/src/FeaturesPlugin/Test/TestCheckSharedFaces.py @@ -20,9 +20,9 @@ """ Unit test of Check shared faces """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= import os @@ -36,8 +36,7 @@ from salome.shaper import model __updated__ = "2020-11-12" -if __name__ == '__main__': - +if __name__ == "__main__": model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) @@ -47,24 +46,53 @@ if __name__ == '__main__': ### Create Point Point_2 = model.addPoint(Part_1_doc, 20, 10, 10) ### Create Box - Box_2 = model.addBox(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]"), model.selection("VERTEX", "Point_1")) + Box_2 = model.addBox( + Part_1_doc, + model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("VERTEX", "Point_1"), + ) ### Create CompSolid - CompSolid_1 = model.addCompSolid(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Box_2_1")]) + CompSolid_1 = model.addCompSolid( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Box_2_1")], + ) ### Create Box Box_3 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Box Box_4 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Translation - Translation_1 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "all-in-Box_4")], axis = model.selection("EDGE", "PartSet/OX"), - distance = 10, keepSubResults = True) + Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Box_4")], + axis=model.selection("EDGE", "PartSet/OX"), + distance=10, + keepSubResults=True, + ) ### Create CompSolid - CompSolid_2 = model.addCompSolid(Part_1_doc, [model.selection("SOLID", "Box_3_1"), model.selection("COMPOUND", "Translation_1_1")]) + CompSolid_2 = model.addCompSolid( + Part_1_doc, + [ + model.selection("SOLID", "Box_3_1"), + model.selection("COMPOUND", "Translation_1_1"), + ], + ) ### Create Box Box_5 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Translation - Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_5_1")], vector = [10, 0, 10], keepSubResults = True) + Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_5_1")], + vector=[10, 0, 10], + keepSubResults=True, + ) ### Create Compound - Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "CompSolid_1_1"), model.selection("SOLID", "Translation_2_1")]) + Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPSOLID", "CompSolid_1_1"), + model.selection("SOLID", "Translation_2_1"), + ], + ) Compound_1.result().setTransparency(0.5) Compound_1.result().subResult(0).setTransparency(0.5) Compound_1.result().subResult(0).subResult(0).setTransparency(0.5) @@ -72,51 +100,55 @@ if __name__ == '__main__': Compound_1.result().subResult(1).setTransparency(0.5) ### Create Shared_faces for compsolid - Shared_faces_1 = model.getSharedFaces(Part_1_doc, model.selection("COMPSOLID", "CompSolid_1_1"), "faces_compsolid") + Shared_faces_1 = model.getSharedFaces( + Part_1_doc, model.selection("COMPSOLID", "CompSolid_1_1"), "faces_compsolid" + ) ### Create Shared_faces for compound - Shared_faces_2 = model.getSharedFaces(Part_1_doc, model.selection("COMPOUND", "Compound_1_1"), 'faces_compound') + Shared_faces_2 = model.getSharedFaces( + Part_1_doc, model.selection("COMPOUND", "Compound_1_1"), "faces_compound" + ) model.do() - # Check results - assert(Part_1_doc.size("Groups") == 2) + # Check results + assert Part_1_doc.size("Groups") == 2 Shared_faces_1_Feature = Shared_faces_1.feature() - assert Shared_faces_1_Feature.error() == '' + assert Shared_faces_1_Feature.error() == "" assert Shared_faces_1_Feature.name() == "Shared_faces_1" aSelectionList = Shared_faces_1_Feature.selectionList("group_list") assert aSelectionList.size() == 1 Shared_faces_2_Feature = Shared_faces_2.feature() - assert Shared_faces_2_Feature.error() == '' + assert Shared_faces_2_Feature.error() == "" assert Shared_faces_2_Feature.name() == "Shared_faces_2" aSelectionList = Shared_faces_2_Feature.selectionList("group_list") assert aSelectionList.size() == 1 resShape_1 = modelAPI_Result(Part_1_doc.object("Groups", 0)).shape() - assert(not resShape_1.isNull()) + assert not resShape_1.isNull() # the group result is a face, check that this is one face aShapeExplorer = GeomAPI_ShapeExplorer(resShape_1, GeomAPI_Shape.FACE) - assert(aShapeExplorer.more()) - assert(aShapeExplorer.current().isFace()) + assert aShapeExplorer.more() + assert aShapeExplorer.current().isFace() aShapeExplorer.next() - assert(not aShapeExplorer.more()) + assert not aShapeExplorer.more() resShape_2 = modelAPI_Result(Part_1_doc.object("Groups", 1)).shape() - assert(not resShape_2.isNull()) + assert not resShape_2.isNull() # the group result is a face, check that this is one face aShapeExplorer = GeomAPI_ShapeExplorer(resShape_2, GeomAPI_Shape.FACE) - assert(aShapeExplorer.more()) - assert(aShapeExplorer.current().isFace()) + assert aShapeExplorer.more() + assert aShapeExplorer.current().isFace() aShapeExplorer.next() - assert(not aShapeExplorer.more()) + assert not aShapeExplorer.more() model.end() - #========================================================================= + # ========================================================================= # End of test - #========================================================================= + # ========================================================================= diff --git a/src/FeaturesPlugin/Test/TestCompositeFeaturesOnCompSolids.py b/src/FeaturesPlugin/Test/TestCompositeFeaturesOnCompSolids.py index 153a7bb85..ea7c87716 100644 --- a/src/FeaturesPlugin/Test/TestCompositeFeaturesOnCompSolids.py +++ b/src/FeaturesPlugin/Test/TestCompositeFeaturesOnCompSolids.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -34,9 +34,9 @@ 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")) @@ -59,64 +59,67 @@ aLineStartPoint.setValue(0, -50) aLineEndPoint.setValue(0, 50) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on circle -#========================================================================= +# ========================================================================= # Build shape from sketcher results aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult()) -assert (aCircleSketchResult.facesNum() > 0) +assert aCircleSketchResult.facesNum() > 0 # Create extrusion aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "Extrusion") +assert anExtrusionFt.getKind() == "Extrusion" # selection type FACE=4 -anExtrusionFt.selectionList("base").append( - aCircleSketchResult, None) +anExtrusionFt.selectionList("base").append(aCircleSketchResult, None) 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.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) +assert anExtrusionFt.real("to_size").value() == 50.0 # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult is not None) +assert anExtrusionResult is not None -#========================================================================= +# ========================================================================= # Test extrusion cut between bounding planes -#========================================================================= +# ========================================================================= # Create from plane aSession.startOperation() aFromPlaneFeature = aPart.addFeature("Plane") aFromPlaneFeature.string("creation_method").setValue("by_general_equation") -aFromPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove -aFromPlaneFeature.real("A").setValue(0.) -aFromPlaneFeature.real("B").setValue(0.) -aFromPlaneFeature.real("C").setValue(1.) -aFromPlaneFeature.real("D").setValue(-25.) +aFromPlaneFeature.string("by_other_plane_option").setValue( + "by_distance_from_other" +) # TODO: remove +aFromPlaneFeature.real("A").setValue(0.0) +aFromPlaneFeature.real("B").setValue(0.0) +aFromPlaneFeature.real("C").setValue(1.0) +aFromPlaneFeature.real("D").setValue(-25.0) aSession.finishOperation() # Create to plane aSession.startOperation() aToPlaneFeature = aPart.addFeature("Plane") aToPlaneFeature.string("creation_method").setValue("by_general_equation") -aToPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove -aToPlaneFeature.real("A").setValue(0.) -aToPlaneFeature.real("B").setValue(0.) -aToPlaneFeature.real("C").setValue(1.) -aToPlaneFeature.real("D").setValue(-60.) +aToPlaneFeature.string("by_other_plane_option").setValue( + "by_distance_from_other" +) # TODO: remove +aToPlaneFeature.real("A").setValue(0.0) +aToPlaneFeature.real("B").setValue(0.0) +aToPlaneFeature.real("C").setValue(1.0) +aToPlaneFeature.real("D").setValue(-60.0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion cut -#========================================================================= +# ========================================================================= aSession.startOperation() anExtrusionCutFt = featureToCompositeFeature(aPart.addFeature("ExtrusionCut")) -assert (anExtrusionCutFt.getKind() == "ExtrusionCut") +assert anExtrusionCutFt.getKind() == "ExtrusionCut" # selection type FACE=4 aSession.startOperation() aCircleSketchFeature = featureToCompositeFeature(anExtrusionCutFt.addFeature("Sketch")) @@ -126,7 +129,9 @@ 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_1" +) aSession.startOperation() aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle") anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center")) @@ -136,7 +141,7 @@ aCircleRadius.setValue(10) aSession.finishOperation() aSession.finishOperation() aSession.startOperation() -aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled. +aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled. anExtrusionCutFt.selectionList("base").append(aCircleSketchFeature.firstResult(), None) anExtrusionCutFt.string("CreationMethod").setValue("ByPlanesAndOffsets") anExtrusionCutFt.real("to_size").setValue(0) @@ -149,23 +154,25 @@ aFromResult = aFromPlaneFeature.firstResult() aFromShape = modelAPI_ResultConstruction(aFromResult).shape() anExtrusionCutFt.selection("from_object").setValue(aFromResult, aFromShape) anExtrusionCutFt.real("from_offset").setValue(0) -anExtrusionCutFt.selectionList("main_objects").append(anExtrusionResult.subResult(1), None) +anExtrusionCutFt.selectionList("main_objects").append( + anExtrusionResult.subResult(1), None +) aSession.finishOperation() aSession.finishOperation() -#========================================================================= +# ========================================================================= # Test results -#========================================================================= +# ========================================================================= aFactory = ModelAPI_Session.get().validators() -assert (aFactory.validate(anExtrusionCutFt)) -assert (len(anExtrusionCutFt.results()) > 0) +assert aFactory.validate(anExtrusionCutFt) +assert len(anExtrusionCutFt.results()) > 0 aCurrentResult = modelAPI_ResultBody(anExtrusionCutFt.firstResult()) -assert (aCurrentResult is not None) +assert aCurrentResult is not None aSession.undo() -#========================================================================= +# ========================================================================= # Create a sketch line to revol -#========================================================================= +# ========================================================================= aSession.startOperation() aLineSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aLineSketchFeature.attribute("Origin")) @@ -178,8 +185,8 @@ norm.setValue(0, 0, 1) aSketchLine = aLineSketchFeature.addFeature("SketchLine") aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) -aLineStartPoint.setValue(-50., 50.) -aLineEndPoint.setValue(-50., -50.) +aLineStartPoint.setValue(-50.0, 50.0) +aLineEndPoint.setValue(-50.0, -50.0) aSession.finishOperation() # Build shape from sketcher results @@ -188,22 +195,26 @@ aLineSketchShape = modelAPI_ResultConstruction(aLineSketchResult).shape() aShapeExplorer = GeomAPI_ShapeExplorer(aLineSketchShape, GeomAPI_Shape.EDGE) aLineEdge = aShapeExplorer.current() -#========================================================================= +# ========================================================================= # Make revolution fuse -#========================================================================= +# ========================================================================= aSession.startOperation() anRevolutionFuseFt = featureToCompositeFeature(aPart.addFeature("RevolutionFuse")) -assert (anRevolutionFuseFt.getKind() == "RevolutionFuse") +assert anRevolutionFuseFt.getKind() == "RevolutionFuse" # selection type FACE=4 aSession.startOperation() -aCircleSketchFeature = featureToCompositeFeature(anRevolutionFuseFt.addFeature("Sketch")) +aCircleSketchFeature = featureToCompositeFeature( + anRevolutionFuseFt.addFeature("Sketch") +) origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")) origin.setValue(0, 0, 50) 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_1" +) aSession.startOperation() aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle") anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center")) @@ -213,28 +224,33 @@ aCircleRadius.setValue(10) aSession.finishOperation() aSession.finishOperation() aSession.startOperation() -aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled. -anRevolutionFuseFt.selectionList("base").append(aCircleSketchFeature.firstResult(), None) +aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled. +anRevolutionFuseFt.selectionList("base").append( + aCircleSketchFeature.firstResult(), None +) anRevolutionFuseFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge) anRevolutionFuseFt.string("CreationMethod").setValue("ByPlanesAndOffsets") -anRevolutionFuseFt.real("from_angle").setValue(0) #TODO: remove -anRevolutionFuseFt.real("to_angle").setValue(0) #TODO: remove +anRevolutionFuseFt.real("from_angle").setValue(0) # TODO: remove +anRevolutionFuseFt.real("to_angle").setValue(0) # TODO: remove anRevolutionFuseFt.selection("to_object").setValue(aToResult, None) anRevolutionFuseFt.real("to_offset").setValue(0) anRevolutionFuseFt.selection("from_object").setValue(None, None) anRevolutionFuseFt.real("from_offset").setValue(0) -anRevolutionFuseFt.selectionList("main_objects").append(anExtrusionResult.subResult(1), None) +anRevolutionFuseFt.selectionList("main_objects").append( + anExtrusionResult.subResult(1), None +) aSession.finishOperation() aSession.finishOperation() -#========================================================================= +# ========================================================================= # Test results -#========================================================================= +# ========================================================================= aFactory = ModelAPI_Session.get().validators() -assert (aFactory.validate(anRevolutionFuseFt)) -assert (len(anRevolutionFuseFt.results()) > 0) +assert aFactory.validate(anRevolutionFuseFt) +assert len(anRevolutionFuseFt.results()) > 0 aCurrentResult = modelAPI_ResultBody(anRevolutionFuseFt.firstResult()) -assert (aCurrentResult is not None) +assert aCurrentResult is not None from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestCopyFeature.py b/src/FeaturesPlugin/Test/TestCopyFeature.py index 41edb791b..ac24932e7 100644 --- a/src/FeaturesPlugin/Test/TestCopyFeature.py +++ b/src/FeaturesPlugin/Test/TestCopyFeature.py @@ -26,23 +26,43 @@ 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(11.02869497636673, 9.8764247475525, 3.312248077480665) -SketchCircle_2 = Sketch_1.addCircle(4.278198729238611, 4.677840612715367, 1.794922837237287) +SketchCircle_1 = Sketch_1.addCircle( + 11.02869497636673, 9.8764247475525, 3.312248077480665 +) +SketchCircle_2 = Sketch_1.addCircle( + 4.278198729238611, 4.677840612715367, 1.794922837237287 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 10, 0) -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")]) -Copy_1 = model.addCopy(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1")], 1) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection(), + 10, + 0, +) +Group_1 = model.addGroup( + Part_1_doc, + "Faces", + [ + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_1_2"), + ], +) +Copy_1 = model.addCopy( + Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1")], 1 +) model.do() # move the group feature to the end - through copy of the whole feature Part_1_doc.moveFeature(Group_1.feature(), Copy_1.feature()) model.end() from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) +assert aFactory.validate(Group_1.feature()) selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 4) # two original solids plus two copies -assert(selectionList.value(3).namingName() == "Extrusion_1_1_1_1") -assert(selectionList.value(2).namingName() == "Extrusion_1_1_1_2") +assert selectionList.size() == 4 # two original solids plus two copies +assert selectionList.value(3).namingName() == "Extrusion_1_1_1_1" +assert selectionList.value(2).namingName() == "Extrusion_1_1_1_2" -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestCopyFeatureMoveGroupOfFeature.py b/src/FeaturesPlugin/Test/TestCopyFeatureMoveGroupOfFeature.py index cee95104b..2b7ac53bb 100644 --- a/src/FeaturesPlugin/Test/TestCopyFeatureMoveGroupOfFeature.py +++ b/src/FeaturesPlugin/Test/TestCopyFeatureMoveGroupOfFeature.py @@ -26,23 +26,38 @@ 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(11.02869497636673, 9.8764247475525, 3.312248077480665) -SketchCircle_2 = Sketch_1.addCircle(4.278198729238611, 4.677840612715367, 1.794922837237287) +SketchCircle_1 = Sketch_1.addCircle( + 11.02869497636673, 9.8764247475525, 3.312248077480665 +) +SketchCircle_2 = Sketch_1.addCircle( + 4.278198729238611, 4.677840612715367, 1.794922837237287 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 10, 0) -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("COMPOUND", "all-in-Extrusion_1")]) -Copy_1 = model.addCopy(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1")], 1) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection(), + 10, + 0, +) +Group_1 = model.addGroup( + Part_1_doc, "Faces", [model.selection("COMPOUND", "all-in-Extrusion_1")] +) +Copy_1 = model.addCopy( + Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1")], 1 +) model.do() # move the group feature to the end - through copy of the whole feature Part_1_doc.moveFeature(Group_1.feature(), Copy_1.feature()) model.end() from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) +assert aFactory.validate(Group_1.feature()) selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 2) # two: original feature and the copy-feature -assert(selectionList.value(0).namingName() == "all-in-Extrusion_1") -assert(selectionList.value(1).namingName() == "all-in-Copy_1") +assert selectionList.size() == 2 # two: original feature and the copy-feature +assert selectionList.value(0).namingName() == "all-in-Extrusion_1" +assert selectionList.value(1).namingName() == "all-in-Copy_1" -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestCopyMoveResult.py b/src/FeaturesPlugin/Test/TestCopyMoveResult.py index 1423c0c66..528fec839 100644 --- a/src/FeaturesPlugin/Test/TestCopyMoveResult.py +++ b/src/FeaturesPlugin/Test/TestCopyMoveResult.py @@ -27,28 +27,74 @@ 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.31034482758622, 31.49775664633739, 7.836206896551726, 31.49775664633739) -SketchLine_2 = Sketch_1.addLine(7.836206896551726, 31.49775664633739, 7.836206896551726, 8.984209848307833) -SketchLine_3 = Sketch_1.addLine(7.836206896551726, 8.984209848307833, 38.31034482758622, 8.984209848307833) -SketchLine_4 = Sketch_1.addLine(38.31034482758622, 8.984209848307833, 38.31034482758622, 31.49775664633739) -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()) +SketchLine_1 = Sketch_1.addLine( + 38.31034482758622, 31.49775664633739, 7.836206896551726, 31.49775664633739 +) +SketchLine_2 = Sketch_1.addLine( + 7.836206896551726, 31.49775664633739, 7.836206896551726, 8.984209848307833 +) +SketchLine_3 = Sketch_1.addLine( + 7.836206896551726, 8.984209848307833, 38.31034482758622, 8.984209848307833 +) +SketchLine_4 = Sketch_1.addLine( + 38.31034482758622, 8.984209848307833, 38.31034482758622, 31.49775664633739 +) +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(21.64285714285715, 31.4977566463374, 25.0012315270936, 8.984209848307833) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result()) +SketchLine_5 = Sketch_1.addLine( + 21.64285714285715, 31.4977566463374, 25.0012315270936, 8.984209848307833 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_1.result() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_3.result() +) model.do() -Extrusion_1 = model.addExtrusion(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")], model.selection(), 7, 0) +Extrusion_1 = model.addExtrusion( + 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", + ), + ], + model.selection(), + 7, + 0, +) Extrusion_1.result().setName("Origin") -Group_1 = model.addGroup(Part_1_doc, "Solids", [model.selection("SOLID", "Extrusion_1_1_1")]) +Group_1 = model.addGroup( + Part_1_doc, "Solids", [model.selection("SOLID", "Extrusion_1_1_1")] +) Copy_1 = model.addCopy(Part_1_doc, [model.selection("COMPSOLID", "Origin")], 1) Copy_1.result().setName("Origin_1") -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Origin_1_1/Copy_2][Origin_1_1/Copy_6]"), model.selection("EDGE", "[Origin_1_2/Copy_4][Origin_1_2/Copy_6]")], 2) +Fillet_1 = model.addFillet( + Part_1_doc, + [ + model.selection("EDGE", "[Origin_1_1/Copy_2][Origin_1_1/Copy_6]"), + model.selection("EDGE", "[Origin_1_2/Copy_4][Origin_1_2/Copy_6]"), + ], + 2, +) Fillet_1.result().setName("CopyCompound") model.do() # move the group feature to the end - through copy and fillet on this copy (to distinguish the origin and the copy) @@ -56,12 +102,13 @@ Part_1_doc.moveFeature(Group_1.feature(), Fillet_1.feature()) model.end() from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) +assert aFactory.validate(Group_1.feature()) selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 2) # still the same solid + the copied and filleted +assert selectionList.size() == 2 # still the same solid + the copied and filleted -assert(selectionList.value(0).namingName() == "Extrusion_1_1_1") -assert(selectionList.value(1).namingName() == "Fillet_1_1_1") +assert selectionList.value(0).namingName() == "Extrusion_1_1_1" +assert selectionList.value(1).namingName() == "Fillet_1_1_1" -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestCopyMoveSubShapes.py b/src/FeaturesPlugin/Test/TestCopyMoveSubShapes.py index 132adb06b..4f1f78458 100644 --- a/src/FeaturesPlugin/Test/TestCopyMoveSubShapes.py +++ b/src/FeaturesPlugin/Test/TestCopyMoveSubShapes.py @@ -27,22 +27,52 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")]) +Group_1 = model.addGroup( + Part_1_doc, "Edges", [model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")] +) Copy_1 = model.addCopy(Part_1_doc, [model.selection("FACE", "Box_1_1/Front")], 2) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 5, [model.selection("SOLID", "Box_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, [], model.selection(), 0, 5, [model.selection("SOLID", "Box_1_1")] +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Front")) -SketchCircle_1 = Sketch_1.addCircle(9.650212071680357, 9.344990586582618, 1.565166813054581) +SketchCircle_1 = Sketch_1.addCircle( + 9.650212071680357, 9.344990586582618, 1.565166813054581 +) ExtrusionCut_1.setNestedSketch(Sketch_1) ExtrusionCut_1.result().setColor(225, 0, 0) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1_1")) -SketchCircle_2 = Sketch_2.addCircle(0.7603686814133139, 9.06793355634084, 1.630854194501576) +SketchCircle_2 = Sketch_2.addCircle( + 0.7603686814133139, 9.06793355634084, 1.630854194501576 +) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r")]) -Cut_1 = model.addCut(Part_1_doc, [model.selection("FACE", "Box_1_1_1")], [model.selection("FACE", "Face_1_1")], keepSubResults = True) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Box_1_1_2")], model.selection("EDGE", "PartSet/OX"), 5) +Face_1 = model.addFace( + Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r")] +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("FACE", "Box_1_1_1")], + [model.selection("FACE", "Face_1_1")], + keepSubResults=True, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("FACE", "Box_1_1_2")], + model.selection("EDGE", "PartSet/OX"), + 5, +) Copy_2 = model.addCopy(Part_1_doc, [model.selection("FACE", "Box_1_1_2")], 2) -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("FACE", "Box_1_1_2_1")], model.selection("EDGE", "PartSet/OZ"), 10) -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("FACE", "Box_1_1_2_2")], model.selection("EDGE", "PartSet/OZ"), 20) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("FACE", "Box_1_1_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 10, +) +Rotation_2 = model.addRotation( + Part_1_doc, + [model.selection("FACE", "Box_1_1_2_2")], + model.selection("EDGE", "PartSet/OZ"), + 20, +) model.do() # move the group feature to the end - through 2 copies and many modifications of the selected edge Part_1_doc.moveFeature(Group_1.feature(), Rotation_2.feature()) @@ -50,8 +80,8 @@ model.end() # result is 5 edges: cut, translation, 2 rotations, extrusion cut aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) +assert aFactory.validate(Group_1.feature()) selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 5) +assert selectionList.size() == 5 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestCopyNames.py b/src/FeaturesPlugin/Test/TestCopyNames.py index 6f07f741a..94af4dcc8 100644 --- a/src/FeaturesPlugin/Test/TestCopyNames.py +++ b/src/FeaturesPlugin/Test/TestCopyNames.py @@ -26,38 +26,77 @@ 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(-11.9408866995074, 14.67733990147784, -29.35467980295567, 14.67733990147784) -SketchLine_2 = Sketch_1.addLine(-29.35467980295567, 14.67733990147784, -29.35467980295567, -7.960591133004924) -SketchLine_3 = Sketch_1.addLine(-29.35467980295567, -7.960591133004924, -11.9408866995074, -7.960591133004924) -SketchLine_4 = Sketch_1.addLine(-11.9408866995074, -7.960591133004924, -11.9408866995074, 14.67733990147784) -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()) +SketchLine_1 = Sketch_1.addLine( + -11.9408866995074, 14.67733990147784, -29.35467980295567, 14.67733990147784 +) +SketchLine_2 = Sketch_1.addLine( + -29.35467980295567, 14.67733990147784, -29.35467980295567, -7.960591133004924 +) +SketchLine_3 = Sketch_1.addLine( + -29.35467980295567, -7.960591133004924, -11.9408866995074, -7.960591133004924 +) +SketchLine_4 = Sketch_1.addLine( + -11.9408866995074, -7.960591133004924, -11.9408866995074, 14.67733990147784 +) +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(14.92610837438425, 16.04556650246306, 6.602917012013241) +SketchCircle_1 = Sketch_1.addCircle( + 14.92610837438425, 16.04556650246306, 6.602917012013241 +) 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) +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, +) Extrusion_1.result().setName("Box") -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection(), + 10, + 0, +) Extrusion_2.result().setName("Cylinder") -Copy_1 = model.addCopy(Part_1_doc, [model.selection("SOLID", "Box"), model.selection("SOLID", "Cylinder")], 3) +Copy_1 = model.addCopy( + Part_1_doc, + [model.selection("SOLID", "Box"), model.selection("SOLID", "Cylinder")], + 3, +) model.end() -assert(Copy_1.feature().results().size() == 6) +assert Copy_1.feature().results().size() == 6 -assert(Copy_1.feature().results()[0].data().name() == "Box_1") -assert(Copy_1.feature().results()[1].data().name() == "Cylinder_1") -assert(Copy_1.feature().results()[2].data().name() == "Box_2") -assert(Copy_1.feature().results()[3].data().name() == "Cylinder_2") -assert(Copy_1.feature().results()[4].data().name() == "Box_3") -assert(Copy_1.feature().results()[5].data().name() == "Cylinder_3") +assert Copy_1.feature().results()[0].data().name() == "Box_1" +assert Copy_1.feature().results()[1].data().name() == "Cylinder_1" +assert Copy_1.feature().results()[2].data().name() == "Box_2" +assert Copy_1.feature().results()[3].data().name() == "Cylinder_2" +assert Copy_1.feature().results()[4].data().name() == "Box_3" +assert Copy_1.feature().results()[5].data().name() == "Cylinder_3" model.begin() model.testHaveNamingSubshapes(Copy_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestCopySubShapes.py b/src/FeaturesPlugin/Test/TestCopySubShapes.py index 5c32ed73f..f30bff30a 100644 --- a/src/FeaturesPlugin/Test/TestCopySubShapes.py +++ b/src/FeaturesPlugin/Test/TestCopySubShapes.py @@ -26,33 +26,61 @@ 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.99630541871921, 19.52832512315271, -16.66748768472907, 29.72783251231528) -SketchLine_2 = Sketch_1.addLine(-16.66748768472907, 29.72783251231528, -12.4384236453202, 17.66256157635469) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(-12.4384236453202, 17.66256157635469, -25.99630541871921, 19.52832512315271) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) +SketchLine_1 = Sketch_1.addLine( + -25.99630541871921, 19.52832512315271, -16.66748768472907, 29.72783251231528 +) +SketchLine_2 = Sketch_1.addLine( + -16.66748768472907, 29.72783251231528, -12.4384236453202, 17.66256157635469 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + -12.4384236453202, 17.66256157635469, -25.99630541871921, 19.52832512315271 +) +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_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r" + ) + ], + model.selection(), + 10, + 0, +) Extrusion_1.result().setName("Prism") -Copy_1_objects = [model.selection("FACE", "Prism/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Prism/Generated_Face&Sketch_1/SketchLine_2"), model.selection("EDGE", "[Prism/Generated_Face&Sketch_1/SketchLine_1][Prism/To_Face]")] +Copy_1_objects = [ + model.selection("FACE", "Prism/Generated_Face&Sketch_1/SketchLine_3"), + model.selection("FACE", "Prism/Generated_Face&Sketch_1/SketchLine_2"), + model.selection( + "EDGE", "[Prism/Generated_Face&Sketch_1/SketchLine_1][Prism/To_Face]" + ), +] Copy_1 = model.addCopy(Part_1_doc, Copy_1_objects, 2) Copy_1.result().setName("Prism_1") model.end() -assert(Copy_1.feature().results().size() == 6) +assert Copy_1.feature().results().size() == 6 for index in range(6): - # name is just incremented - assert(Copy_1.feature().results()[index].data().name() == "Prism_" + str(index + 1)) - # type of the shape corresponds to selection: 2 faces then edge - if index%3 == 2: - assert(Copy_1.feature().results()[index].shape().shapeTypeStr() == "EDGE") - else: - assert(Copy_1.feature().results()[index].shape().shapeTypeStr() == "FACE") + # name is just incremented + assert Copy_1.feature().results()[index].data().name() == "Prism_" + str(index + 1) + # type of the shape corresponds to selection: 2 faces then edge + if index % 3 == 2: + assert Copy_1.feature().results()[index].shape().shapeTypeStr() == "EDGE" + else: + assert Copy_1.feature().results()[index].shape().shapeTypeStr() == "FACE" model.begin() model.testHaveNamingSubshapes(Copy_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestCopyWholeFeature.py b/src/FeaturesPlugin/Test/TestCopyWholeFeature.py index 17189fc27..0c3152f7c 100644 --- a/src/FeaturesPlugin/Test/TestCopyWholeFeature.py +++ b/src/FeaturesPlugin/Test/TestCopyWholeFeature.py @@ -26,48 +26,113 @@ 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(-19.47177806477657, -9.723714972297476, -32.14322074518937, 18.42485654704614) -SketchLine_2 = Sketch_1.addLine(-32.14322074518937, 18.42485654704614, -13.96909823036938, 5.527027954588926) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(-13.96909823036938, 5.527027954588926, -19.47177806477657, -9.723714972297476) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchLine_4 = Sketch_1.addLine(-19.47177806477657, -9.723714972297476, -38.20802856635906, 4.439747463237282) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(-38.20802856635906, 4.439747463237282, -32.14322074518937, 18.42485654704614) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.endPoint()) -SketchCircle_1 = Sketch_1.addCircle(15.45187411494798, 10.57784256870842, 6.036432809751617) +SketchLine_1 = Sketch_1.addLine( + -19.47177806477657, -9.723714972297476, -32.14322074518937, 18.42485654704614 +) +SketchLine_2 = Sketch_1.addLine( + -32.14322074518937, 18.42485654704614, -13.96909823036938, 5.527027954588926 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + -13.96909823036938, 5.527027954588926, -19.47177806477657, -9.723714972297476 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchLine_4 = Sketch_1.addLine( + -19.47177806477657, -9.723714972297476, -38.20802856635906, 4.439747463237282 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + -38.20802856635906, 4.439747463237282, -32.14322074518937, 18.42485654704614 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_5.endPoint() +) +SketchCircle_1 = Sketch_1.addCircle( + 15.45187411494798, 10.57784256870842, 6.036432809751617 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_5r-SketchLine_4r"), model.selection("FACE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 10, 0) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2f_wire")], model.selection(), 10, 0) -Copy_1 = model.addCopy(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "all-in-Extrusion_2")], 1) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_5r-SketchLine_4r" + ), + model.selection( + "FACE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r" + ), + ], + model.selection(), + 10, + 0, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2f_wire")], + model.selection(), + 10, + 0, +) +Copy_1 = model.addCopy( + Part_1_doc, + [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "all-in-Extrusion_2"), + ], + 1, +) model.end() -assert(Copy_1.feature().results().size() == 2) +assert Copy_1.feature().results().size() == 2 from ModelAPI import * -assert(Copy_1.feature().results()[0].data().name() == "Extrusion_1_1_1") -assert(modelAPI_ResultBody(Copy_1.feature().results()[0]).subResult(0).data().name() == "Extrusion_1_1_1_1") -assert(modelAPI_ResultBody(Copy_1.feature().results()[0]).subResult(1).data().name() == "Extrusion_1_1_1_2") -assert(Copy_1.feature().results()[1].data().name() == "Extrusion_2_1_1") + +assert Copy_1.feature().results()[0].data().name() == "Extrusion_1_1_1" +assert ( + modelAPI_ResultBody(Copy_1.feature().results()[0]).subResult(0).data().name() + == "Extrusion_1_1_1_1" +) +assert ( + modelAPI_ResultBody(Copy_1.feature().results()[0]).subResult(1).data().name() + == "Extrusion_1_1_1_2" +) +assert Copy_1.feature().results()[1].data().name() == "Extrusion_2_1_1" # Check that copy of the whole feature that contains several results produce compound of all results model.begin() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 10, 0) -Copy_2 = model.addCopy(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_3")], 1) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection(), + 10, + 0, +) +Copy_2 = model.addCopy( + Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_3")], 1 +) model.end() -assert(Copy_2.feature().results()[0].data().name() == "Extrusion_3_1_1") -assert(Copy_2.feature().results()[0].shape().shapeTypeStr() == "COMPOUND") +assert Copy_2.feature().results()[0].data().name() == "Extrusion_3_1_1" +assert Copy_2.feature().results()[0].shape().shapeTypeStr() == "COMPOUND" aSub1 = modelAPI_ResultBody(Copy_2.feature().results()[0]).subResult(0) -assert(aSub1.shape().shapeTypeStr() == "COMPSOLID") +assert aSub1.shape().shapeTypeStr() == "COMPSOLID" aSub2 = modelAPI_ResultBody(Copy_2.feature().results()[0]).subResult(1) -assert(aSub2.shape().shapeTypeStr() == "SOLID") +assert aSub2.shape().shapeTypeStr() == "SOLID" model.begin() model.testHaveNamingSubshapes(Copy_1, model, Part_1_doc) model.testHaveNamingSubshapes(Copy_2, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestCopy_ErrorMsg.py b/src/FeaturesPlugin/Test/TestCopy_ErrorMsg.py index ea93d1c6e..c86aff1b6 100644 --- a/src/FeaturesPlugin/Test/TestCopy_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestCopy_ErrorMsg.py @@ -26,14 +26,19 @@ 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(11.02869497636673, 9.8764247475525, 3.312248077480665) -SketchCircle_2 = Sketch_1.addCircle(4.278198729238611, 4.677840612715367, 1.794922837237287) +SketchCircle_1 = Sketch_1.addCircle( + 11.02869497636673, 9.8764247475525, 3.312248077480665 +) +SketchCircle_2 = Sketch_1.addCircle( + 4.278198729238611, 4.677840612715367, 1.794922837237287 +) model.do() Copy_1 = model.addCopy(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], 1) Copy_2 = model.addCopy(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], 1) model.end() from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(not aFactory.validate(Copy_1.feature())) -assert(not aFactory.validate(Copy_2.feature())) +assert not aFactory.validate(Copy_1.feature()) +assert not aFactory.validate(Copy_2.feature()) diff --git a/src/FeaturesPlugin/Test/TestDefeaturing_ErrorMsg.py b/src/FeaturesPlugin/Test/TestDefeaturing_ErrorMsg.py index 3f0e0f733..9c128a386 100644 --- a/src/FeaturesPlugin/Test/TestDefeaturing_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestDefeaturing_ErrorMsg.py @@ -25,26 +25,49 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Defeaturing_1 = model.addDefeaturing(Part_1_doc, [model.selection("FACE", "Box_1_1/Top")]) -assert(Defeaturing_1.feature().error() != "") +Defeaturing_1 = model.addDefeaturing( + Part_1_doc, [model.selection("FACE", "Box_1_1/Top")] +) +assert Defeaturing_1.feature().error() != "" model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_2 = model.addBox(Part_2_doc, 10, 10, 10) -ExtrusionCut_1 = model.addExtrusionCut(Part_2_doc, [], model.selection(), [model.selection("SOLID", "Box_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_2_doc, [], model.selection(), [model.selection("SOLID", "Box_1_1")] +) Sketch_1 = model.addSketch(Part_2_doc, model.selection("FACE", "Box_1_1/Top")) SketchCircle_1 = Sketch_1.addCircle(4, 5.137343601256935, 3) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 3) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_1.result(), 4, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_1.result(), 4, True +) ExtrusionCut_1.setNestedSketch(Sketch_1) -Plane_4 = model.addPlane(Part_2_doc, model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Front")) -Partition_1 = model.addPartition(Part_2_doc, [model.selection("SOLID", "ExtrusionCut_1_1"), model.selection("FACE", "Plane_1")], keepSubResults = True) +Plane_4 = model.addPlane( + Part_2_doc, + model.selection("FACE", "Box_1_1/Back"), + model.selection("FACE", "Box_1_1/Front"), +) +Partition_1 = model.addPartition( + Part_2_doc, + [model.selection("SOLID", "ExtrusionCut_1_1"), model.selection("FACE", "Plane_1")], + keepSubResults=True, +) -Defeaturing_2 = model.addDefeaturing(Part_2_doc, [model.selection("FACE", "Partition_1_1_1/Modified_Face&Sketch_1/SketchCircle_1_2")]) -assert(Defeaturing_2.feature().error() != "") +Defeaturing_2 = model.addDefeaturing( + Part_2_doc, + [ + model.selection( + "FACE", "Partition_1_1_1/Modified_Face&Sketch_1/SketchCircle_1_2" + ) + ], +) +assert Defeaturing_2.feature().error() != "" model.end() diff --git a/src/FeaturesPlugin/Test/TestDefeaturing_OnCompound.py b/src/FeaturesPlugin/Test/TestDefeaturing_OnCompound.py index ef483bd59..0f7496bf9 100644 --- a/src/FeaturesPlugin/Test/TestDefeaturing_OnCompound.py +++ b/src/FeaturesPlugin/Test/TestDefeaturing_OnCompound.py @@ -24,12 +24,48 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 20, 20, 10) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 10, 10, 0) -Cylinder_2 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("SOLID", "Translation_1_1"), model.selection("SOLID", "Cylinder_2_1")], keepSubResults = True) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cut_1_1")], model.selection("EDGE", "PartSet/OX"), 30, 2, model.selection("EDGE", "PartSet/OY"), 30, 2) -Defeaturing_1_objects = [model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Cylinder_2_1/Face_1"), model.selection("FACE", "LinearCopy_1_1_4/MF:Translated&Cylinder_1_1/Face_1"), model.selection("FACE", "LinearCopy_1_1_3/MF:Translated&Cylinder_2_1/Face_1"), model.selection("FACE", "LinearCopy_1_1_3/MF:Translated&Cylinder_1_1/Face_1")] +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 10, 10, 0 +) +Cylinder_2 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + [ + model.selection("SOLID", "Translation_1_1"), + model.selection("SOLID", "Cylinder_2_1"), + ], + keepSubResults=True, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cut_1_1")], + model.selection("EDGE", "PartSet/OX"), + 30, + 2, + model.selection("EDGE", "PartSet/OY"), + 30, + 2, +) +Defeaturing_1_objects = [ + model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Cylinder_2_1/Face_1"), + model.selection("FACE", "LinearCopy_1_1_4/MF:Translated&Cylinder_1_1/Face_1"), + model.selection("FACE", "LinearCopy_1_1_3/MF:Translated&Cylinder_2_1/Face_1"), + model.selection("FACE", "LinearCopy_1_1_3/MF:Translated&Cylinder_1_1/Face_1"), +] Defeaturing_1 = model.addDefeaturing(Part_1_doc, Defeaturing_1_objects) model.testHaveNamingSubshapes(Defeaturing_1, model, Part_1_doc) model.end() @@ -44,4 +80,4 @@ model.testNbSubShapes(Defeaturing_1, GeomAPI_Shape.EDGE, [120]) model.testNbSubShapes(Defeaturing_1, GeomAPI_Shape.VERTEX, [240]) model.testResultsVolumes(Defeaturing_1, [14036.50459153]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestDefeaturing_OnCompsolid1.py b/src/FeaturesPlugin/Test/TestDefeaturing_OnCompsolid1.py index c3fbfa7ac..41dcc3adb 100644 --- a/src/FeaturesPlugin/Test/TestDefeaturing_OnCompsolid1.py +++ b/src/FeaturesPlugin/Test/TestDefeaturing_OnCompsolid1.py @@ -24,11 +24,32 @@ 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) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Cut_1_1/Modified_Face&Box_1_1/Back"), model.selection("FACE", "Box_1_1/Front")) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Cut_1_1"), model.selection("FACE", "Plane_1")], keepSubResults = True) -Defeaturing_1 = model.addDefeaturing(Part_1_doc, [model.selection("FACE", "Cut_1_1/Modified_Face&Cylinder_1_1/Face_1")]) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + [model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Cut_1_1/Modified_Face&Box_1_1/Back"), + model.selection("FACE", "Box_1_1/Front"), +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Cut_1_1"), model.selection("FACE", "Plane_1")], + keepSubResults=True, +) +Defeaturing_1 = model.addDefeaturing( + Part_1_doc, [model.selection("FACE", "Cut_1_1/Modified_Face&Cylinder_1_1/Face_1")] +) model.testHaveNamingSubshapes(Defeaturing_1, model, Part_1_doc) model.end() @@ -42,4 +63,4 @@ model.testNbSubShapes(Defeaturing_1, GeomAPI_Shape.EDGE, [48]) model.testNbSubShapes(Defeaturing_1, GeomAPI_Shape.VERTEX, [96]) model.testResultsVolumes(Defeaturing_1, [1000]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestDefeaturing_OnCompsolid2.py b/src/FeaturesPlugin/Test/TestDefeaturing_OnCompsolid2.py index b48f806e2..c73eeb95b 100644 --- a/src/FeaturesPlugin/Test/TestDefeaturing_OnCompsolid2.py +++ b/src/FeaturesPlugin/Test/TestDefeaturing_OnCompsolid2.py @@ -24,17 +24,39 @@ 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(), [model.selection("SOLID", "Box_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, [], model.selection(), [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, 5.137343601256935, 3) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 3) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_1.result(), 4, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_1.result(), 4, True +) ExtrusionCut_1.setNestedSketch(Sketch_1) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Front")) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "ExtrusionCut_1_1"), model.selection("FACE", "Plane_1")], keepSubResults = True) -Defeaturing_1_objects = [model.selection("FACE", "Partition_1_1_2/Modified_Face&Sketch_1/SketchCircle_1_2&weak_name_2"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Sketch_1/SketchCircle_1_2&weak_name_1"), model.selection("FACE", "Partition_1_1_1/Modified_Face&Sketch_1/SketchCircle_1_2")] +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Back"), + model.selection("FACE", "Box_1_1/Front"), +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "ExtrusionCut_1_1"), model.selection("FACE", "Plane_1")], + keepSubResults=True, +) +Defeaturing_1_objects = [ + model.selection( + "FACE", "Partition_1_1_2/Modified_Face&Sketch_1/SketchCircle_1_2&weak_name_2" + ), + model.selection( + "FACE", "Partition_1_1_2/Modified_Face&Sketch_1/SketchCircle_1_2&weak_name_1" + ), + model.selection("FACE", "Partition_1_1_1/Modified_Face&Sketch_1/SketchCircle_1_2"), +] Defeaturing_1 = model.addDefeaturing(Part_1_doc, Defeaturing_1_objects) model.testHaveNamingSubshapes(Defeaturing_1, model, Part_1_doc) model.end() @@ -49,4 +71,4 @@ model.testNbSubShapes(Defeaturing_1, GeomAPI_Shape.EDGE, [48]) model.testNbSubShapes(Defeaturing_1, GeomAPI_Shape.VERTEX, [96]) model.testResultsVolumes(Defeaturing_1, [1000]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestDefeaturing_OnCompsolid3.py b/src/FeaturesPlugin/Test/TestDefeaturing_OnCompsolid3.py index 7e60322a9..4c7f3caf1 100644 --- a/src/FeaturesPlugin/Test/TestDefeaturing_OnCompsolid3.py +++ b/src/FeaturesPlugin/Test/TestDefeaturing_OnCompsolid3.py @@ -29,46 +29,100 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(5, 1.355252715607035e-20, 20, -1.336382355046098e-51) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchLine_2 = Sketch_1.addLine(20, -1.336382355046098e-51, 20, 5.85786437626905) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) SketchLine_3 = Sketch_1.addLine(20, 5.85786437626905, 15.85786437626905, 10) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(15.85786437626905, 10, 20, 14.14213562373095) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(20, 14.14213562373095, 20, 20) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(20, 20, 0, 20) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchLine_7 = Sketch_1.addLine(0, 20, 0, 5) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintVertical_2.setName("SketchConstraintVertical_3") SketchArc_1 = Sketch_1.addArc(0, 0, 5, 1.355252715607035e-20, 0, 5, False) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchArc_1.endPoint()) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_2.result(), SketchLine_5.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_1.result()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_7.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchArc_1.endPoint() +) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_2.result(), SketchLine_5.result() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_1.result() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_7.result() +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_1.center(), SketchAPI_Point(SketchPoint_1).coordinates()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_1.endPoint(), 20, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_7.startPoint(), 20, True) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchAPI_Point(SketchPoint_1).coordinates() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_1.endPoint(), 20, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_7.startPoint(), 20, True +) SketchLine_8 = Sketch_1.addLine(10, 0, 10, 20) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_8.startPoint(), SketchLine_1.result() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_6.result() +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintVertical_3.setName("SketchConstraintVertical_4") -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_8.endPoint(), SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_5.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchLine_8.endPoint(), SketchLine_6.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_5.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 5) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_3.result()) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_3.result() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Defeaturing_1 = model.addDefeaturing(Part_1_doc, [model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchArc_1_2"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Defeaturing_1 = model.addDefeaturing( + Part_1_doc, + [ + model.selection( + "FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchArc_1_2" + ), + model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3"), + ], +) model.testHaveNamingSubshapes(Defeaturing_1, model, Part_1_doc) model.end() @@ -82,4 +136,4 @@ model.testNbSubShapes(Defeaturing_1, GeomAPI_Shape.EDGE, [48]) model.testNbSubShapes(Defeaturing_1, GeomAPI_Shape.VERTEX, [96]) model.testResultsVolumes(Defeaturing_1, [4000]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestDefeaturing_OnSolid1.py b/src/FeaturesPlugin/Test/TestDefeaturing_OnSolid1.py index 60330167a..225ee3474 100644 --- a/src/FeaturesPlugin/Test/TestDefeaturing_OnSolid1.py +++ b/src/FeaturesPlugin/Test/TestDefeaturing_OnSolid1.py @@ -24,9 +24,22 @@ 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) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) -Defeaturing_1 = model.addDefeaturing(Part_1_doc, [model.selection("FACE", "Cut_1_1/Modified_Face&Cylinder_1_1/Face_1")]) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + [model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) +Defeaturing_1 = model.addDefeaturing( + Part_1_doc, [model.selection("FACE", "Cut_1_1/Modified_Face&Cylinder_1_1/Face_1")] +) model.testHaveNamingSubshapes(Defeaturing_1, model, Part_1_doc) model.end() @@ -40,4 +53,4 @@ model.testNbSubShapes(Defeaturing_1, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(Defeaturing_1, GeomAPI_Shape.VERTEX, [48]) model.testResultsVolumes(Defeaturing_1, [1000]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestDefeaturing_OnSolid2.py b/src/FeaturesPlugin/Test/TestDefeaturing_OnSolid2.py index fbd13aa56..61bf2d4f3 100644 --- a/src/FeaturesPlugin/Test/TestDefeaturing_OnSolid2.py +++ b/src/FeaturesPlugin/Test/TestDefeaturing_OnSolid2.py @@ -24,61 +24,142 @@ 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(10.19197853506727, -21.07109716039953, 30.19197853506727, -21.07109716039953) +SketchLine_1 = Sketch_1.addLine( + 10.19197853506727, -21.07109716039953, 30.19197853506727, -21.07109716039953 +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchLine_2 = Sketch_1.addLine(30.19197853506727, -21.07109716039953, 30.19197853506727, -6.071097160399531) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_2 = Sketch_1.addLine( + 30.19197853506727, -21.07109716039953, 30.19197853506727, -6.071097160399531 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) -SketchLine_3 = Sketch_1.addLine(30.19197853506727, -6.071097160399531, 20.19197853506727, -6.071097160399531) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_3 = Sketch_1.addLine( + 30.19197853506727, -6.071097160399531, 20.19197853506727, -6.071097160399531 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) -SketchLine_4 = Sketch_1.addLine(20.19197853506727, -6.071097160399531, 20.19197853506727, 8.928902839600468) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_4 = Sketch_1.addLine( + 20.19197853506727, -6.071097160399531, 20.19197853506727, 8.928902839600468 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) -SketchLine_5 = Sketch_1.addLine(20.19197853506727, 8.928902839600468, 30.19197853506727, 8.928902839600468) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchLine_5 = Sketch_1.addLine( + 20.19197853506727, 8.928902839600468, 30.19197853506727, 8.928902839600468 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) -SketchLine_6 = Sketch_1.addLine(30.19197853506727, 8.928902839600468, 30.19197853506727, 18.92890283960047) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchLine_7 = Sketch_1.addLine(30.19197853506727, 18.92890283960047, 10.19197853506727, 18.92890283960047) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchLine_6 = Sketch_1.addLine( + 30.19197853506727, 8.928902839600468, 30.19197853506727, 18.92890283960047 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchLine_7 = Sketch_1.addLine( + 30.19197853506727, 18.92890283960047, 10.19197853506727, 18.92890283960047 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) -SketchLine_8 = Sketch_1.addLine(10.19197853506727, 18.92890283960047, 10.19197853506727, -21.07109716039953) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.endPoint()) +SketchLine_8 = Sketch_1.addLine( + 10.19197853506727, 18.92890283960047, 10.19197853506727, -21.07109716039953 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_8.endPoint() +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintVertical_3.setName("SketchConstraintVertical_4") -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_2.result(), SketchLine_6.result()) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_2.result(), SketchLine_6.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 20) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_8.result(), 40) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_2.result(), 15) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_6.result(), 10) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_3.result(), 10) model.do() -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(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")]) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_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(), + 10, + 0, +) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [], + 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_2 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"), +) SketchLine_9 = Sketch_2.addLine(30.19197853506727, 5, 25.19197853506727, 5) SketchLine_10 = Sketch_2.addLine(25.19197853506727, 5, 25.19197853506727, 10) SketchLine_11 = Sketch_2.addLine(25.19197853506727, 10, 30.19197853506727, 10) SketchLine_12 = Sketch_2.addLine(30.19197853506727, 10, 30.19197853506727, 5) -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()) +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_5 = Sketch_2.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_10.result()) SketchConstraintVertical_4.setName("SketchConstraintVertical_5") SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_12.result()) SketchConstraintVertical_5.setName("SketchConstraintVertical_6") -SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False) +SketchProjection_1 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]", + ), + False, +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchPoint_1.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_12.result(), SketchLine_11.result()) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchPoint_1.result() +) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_12.result(), SketchLine_11.result() +) SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_12.result(), 5) ExtrusionCut_1.setNestedSketch(Sketch_2) -Defeaturing_1 = model.addDefeaturing(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5")]) +Defeaturing_1 = model.addDefeaturing( + Part_1_doc, + [ + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"), + ], +) model.testHaveNamingSubshapes(Defeaturing_1, model, Part_1_doc) model.end() @@ -92,4 +173,4 @@ model.testNbSubShapes(Defeaturing_1, GeomAPI_Shape.EDGE, [42]) model.testNbSubShapes(Defeaturing_1, GeomAPI_Shape.VERTEX, [84]) model.testResultsVolumes(Defeaturing_1, [7625]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestDefeaturing_OnSolid3.py b/src/FeaturesPlugin/Test/TestDefeaturing_OnSolid3.py index 771aa23e1..7e235ce29 100644 --- a/src/FeaturesPlugin/Test/TestDefeaturing_OnSolid3.py +++ b/src/FeaturesPlugin/Test/TestDefeaturing_OnSolid3.py @@ -24,61 +24,146 @@ 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(10.19197853506727, -21.07109716039953, 30.19197853506727, -21.07109716039953) +SketchLine_1 = Sketch_1.addLine( + 10.19197853506727, -21.07109716039953, 30.19197853506727, -21.07109716039953 +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchLine_2 = Sketch_1.addLine(30.19197853506727, -21.07109716039953, 30.19197853506727, -6.071097160399531) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_2 = Sketch_1.addLine( + 30.19197853506727, -21.07109716039953, 30.19197853506727, -6.071097160399531 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) -SketchLine_3 = Sketch_1.addLine(30.19197853506727, -6.071097160399531, 20.19197853506727, -6.071097160399531) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_3 = Sketch_1.addLine( + 30.19197853506727, -6.071097160399531, 20.19197853506727, -6.071097160399531 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) -SketchLine_4 = Sketch_1.addLine(20.19197853506727, -6.071097160399531, 20.19197853506727, 8.928902839600468) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_4 = Sketch_1.addLine( + 20.19197853506727, -6.071097160399531, 20.19197853506727, 8.928902839600468 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) -SketchLine_5 = Sketch_1.addLine(20.19197853506727, 8.928902839600468, 30.19197853506727, 8.928902839600468) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchLine_5 = Sketch_1.addLine( + 20.19197853506727, 8.928902839600468, 30.19197853506727, 8.928902839600468 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) -SketchLine_6 = Sketch_1.addLine(30.19197853506727, 8.928902839600468, 30.19197853506727, 18.92890283960047) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchLine_7 = Sketch_1.addLine(30.19197853506727, 18.92890283960047, 10.19197853506727, 18.92890283960047) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchLine_6 = Sketch_1.addLine( + 30.19197853506727, 8.928902839600468, 30.19197853506727, 18.92890283960047 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchLine_7 = Sketch_1.addLine( + 30.19197853506727, 18.92890283960047, 10.19197853506727, 18.92890283960047 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) -SketchLine_8 = Sketch_1.addLine(10.19197853506727, 18.92890283960047, 10.19197853506727, -21.07109716039953) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.endPoint()) +SketchLine_8 = Sketch_1.addLine( + 10.19197853506727, 18.92890283960047, 10.19197853506727, -21.07109716039953 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_8.endPoint() +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintVertical_3.setName("SketchConstraintVertical_4") -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_2.result(), SketchLine_6.result()) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_2.result(), SketchLine_6.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 20) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_8.result(), 40) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_2.result(), 15) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_6.result(), 10) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_3.result(), 10) model.do() -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(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")]) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_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(), + 10, + 0, +) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [], + 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_2 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"), +) SketchLine_9 = Sketch_2.addLine(30.19197853506727, 5, 25.19197853506727, 5) SketchLine_10 = Sketch_2.addLine(25.19197853506727, 5, 25.19197853506727, 10) SketchLine_11 = Sketch_2.addLine(25.19197853506727, 10, 30.19197853506727, 10) SketchLine_12 = Sketch_2.addLine(30.19197853506727, 10, 30.19197853506727, 5) -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()) +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_5 = Sketch_2.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_10.result()) SketchConstraintVertical_4.setName("SketchConstraintVertical_5") SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_12.result()) SketchConstraintVertical_5.setName("SketchConstraintVertical_6") -SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False) +SketchProjection_1 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]", + ), + False, +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchPoint_1.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_12.result(), SketchLine_11.result()) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchPoint_1.result() +) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_12.result(), SketchLine_11.result() +) SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_12.result(), 5) ExtrusionCut_1.setNestedSketch(Sketch_2) -Defeaturing_1 = model.addDefeaturing(Part_1_doc, [model.selection("FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10"), model.selection("FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9")]) +Defeaturing_1 = model.addDefeaturing( + Part_1_doc, + [ + model.selection( + "FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10" + ), + model.selection( + "FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9" + ), + ], +) model.testHaveNamingSubshapes(Defeaturing_1, model, Part_1_doc) model.end() @@ -92,4 +177,4 @@ model.testNbSubShapes(Defeaturing_1, GeomAPI_Shape.EDGE, [48]) model.testNbSubShapes(Defeaturing_1, GeomAPI_Shape.VERTEX, [96]) model.testResultsVolumes(Defeaturing_1, [6500]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion.py b/src/FeaturesPlugin/Test/TestExtrusion.py index aeb7b01b3..cc2f193cf 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion.py +++ b/src/FeaturesPlugin/Test/TestExtrusion.py @@ -41,9 +41,9 @@ data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(FROM_OFFSET_ID(), ModelAPI_AttributeSelection::typeId()); """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -58,14 +58,14 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +assert len(aPartFeature.results()) == 1 # Another way is: # aPart = aSession.activeDocument() aPartResult = modelAPI_ResultPart(aPartFeature.firstResult()) aPart = aPartResult.partDoc() -#========================================================================= +# ========================================================================= # Create a sketch circle to extrude -#========================================================================= +# ========================================================================= aSession.startOperation() aCircleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")) @@ -78,70 +78,77 @@ norm.setValue(0, 0, 1) aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle") anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center")) aCircleRadius = aSketchCircle.real("circle_radius") -anCircleCentr.setValue(50., 50) -aCircleRadius.setValue(20.) +anCircleCentr.setValue(50.0, 50) +aCircleRadius.setValue(20.0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on circle -#========================================================================= +# ========================================================================= # Build face from sketcher results aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult()) -assert (aCircleSketchResult.facesNum() > 0) +assert aCircleSketchResult.facesNum() > 0 # Create extrusion aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "Extrusion") +assert anExtrusionFt.getKind() == "Extrusion" # selection type FACE=4 anExtrusionFt.selectionList("base").append( - aCircleSketchResult, aCircleSketchResult.face(0)) + aCircleSketchResult, aCircleSketchResult.face(0) +) 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.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) +assert anExtrusionFt.real("to_size").value() == 50.0 # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult is not None) +assert anExtrusionResult is not None -#========================================================================= +# ========================================================================= # Test extrusion between bounding planes -#========================================================================= +# ========================================================================= # Create from plane aSession.startOperation() aFromPlaneFeature = aPart.addFeature("Plane") aFromPlaneFeature.string("creation_method").setValue("by_general_equation") -aFromPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove -aFromPlaneFeature.real("A").setValue(0.) -aFromPlaneFeature.real("B").setValue(0.) -aFromPlaneFeature.real("C").setValue(1.) -aFromPlaneFeature.real("D").setValue(30.) +aFromPlaneFeature.string("by_other_plane_option").setValue( + "by_distance_from_other" +) # TODO: remove +aFromPlaneFeature.real("A").setValue(0.0) +aFromPlaneFeature.real("B").setValue(0.0) +aFromPlaneFeature.real("C").setValue(1.0) +aFromPlaneFeature.real("D").setValue(30.0) aSession.finishOperation() # Create to plane aSession.startOperation() aToPlaneFeature = aPart.addFeature("Plane") aToPlaneFeature.string("creation_method").setValue("by_general_equation") -aToPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove -aToPlaneFeature.real("A").setValue(0.) -aToPlaneFeature.real("B").setValue(0.) -aToPlaneFeature.real("C").setValue(1.) -aToPlaneFeature.real("D").setValue(-30.) +aToPlaneFeature.string("by_other_plane_option").setValue( + "by_distance_from_other" +) # TODO: remove +aToPlaneFeature.real("A").setValue(0.0) +aToPlaneFeature.real("B").setValue(0.0) +aToPlaneFeature.real("C").setValue(1.0) +aToPlaneFeature.real("D").setValue(-30.0) aSession.finishOperation() # Create extrusion aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "Extrusion") +assert anExtrusionFt.getKind() == "Extrusion" # selection type FACE=4 -anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(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.real("to_size").setValue(0) # TODO: remove +anExtrusionFt.real("from_size").setValue(0) # TODO: remove aToResult = aToPlaneFeature.firstResult() aToShape = modelAPI_ResultConstruction(aToResult).shape() anExtrusionFt.selection("to_object").setValue(aToResult, aToShape) @@ -154,18 +161,18 @@ anExtrusionFt.execute() aSession.finishOperation() # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult is not None) +assert anExtrusionResult is not None # Check extrusion volume aRefVolume = 100530.96491487337 aResVolume = GeomAlgoAPI_ShapeTools.volume(anExtrusionResult.shape()) -assert (math.fabs(aResVolume - aRefVolume) < 10 ** -5) +assert math.fabs(aResVolume - aRefVolume) < 10**-5 -#========================================================================= +# ========================================================================= # Test extrusion between bounding faces from other sketch result -#========================================================================= +# ========================================================================= aSession.startOperation() aClampSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aClampSketchFeature.attribute("Origin")) @@ -190,63 +197,71 @@ aLineDStartPoint = geomDataAPI_Point2D(aSketchLineD.attribute("StartPoint")) aLineDEndPoint = geomDataAPI_Point2D(aSketchLineD.attribute("EndPoint")) aLineEStartPoint = geomDataAPI_Point2D(aSketchLineE.attribute("StartPoint")) aLineEEndPoint = geomDataAPI_Point2D(aSketchLineE.attribute("EndPoint")) -aLineAStartPoint.setValue(0., -50.) -aLineAEndPoint.setValue(0., 50.) -aLineBStartPoint.setValue(0., 50.) -aLineBEndPoint.setValue(100., 50.) -aLineCStartPoint.setValue(100., 50.) -aLineCEndPoint.setValue(10., 0.) -aLineDStartPoint.setValue(10., 0.) -aLineDEndPoint.setValue(100., -50.) -aLineEStartPoint.setValue(100., -50.) -aLineEEndPoint.setValue(0., -50.) +aLineAStartPoint.setValue(0.0, -50.0) +aLineAEndPoint.setValue(0.0, 50.0) +aLineBStartPoint.setValue(0.0, 50.0) +aLineBEndPoint.setValue(100.0, 50.0) +aLineCStartPoint.setValue(100.0, 50.0) +aLineCEndPoint.setValue(10.0, 0.0) +aLineDStartPoint.setValue(10.0, 0.0) +aLineDEndPoint.setValue(100.0, -50.0) +aLineEStartPoint.setValue(100.0, -50.0) +aLineEEndPoint.setValue(0.0, -50.0) aSession.finishOperation() # Extrude clamp aClampSketchResult = modelAPI_ResultConstruction(aClampSketchFeature.firstResult()) aSession.startOperation() aClampExtrusionFt = aPart.addFeature("Extrusion") -assert (aClampExtrusionFt.getKind() == "Extrusion") +assert aClampExtrusionFt.getKind() == "Extrusion" # selection type FACE=4 aClampExtrusionFt.selectionList("base").append( - aClampSketchResult, aClampSketchResult.face(0)) + aClampSketchResult, aClampSketchResult.face(0) +) aClampExtrusionFt.string("CreationMethod").setValue("BySizes") aClampExtrusionFt.real("to_size").setValue(70) aClampExtrusionFt.real("from_size").setValue(0) -aClampExtrusionFt.real("to_offset").setValue(0) #TODO: remove -aClampExtrusionFt.real("from_offset").setValue(0) #TODO: remove +aClampExtrusionFt.real("to_offset").setValue(0) # TODO: remove +aClampExtrusionFt.real("from_offset").setValue(0) # TODO: remove aClampExtrusionFt.execute() aSession.finishOperation() # Check extrusion results -assert (len(aClampExtrusionFt.results()) > 0) +assert len(aClampExtrusionFt.results()) > 0 anExtrusionResult = modelAPI_ResultBody(aClampExtrusionFt.firstResult()) -assert (anExtrusionResult is not None) +assert anExtrusionResult is not None # Extrude circle aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "Extrusion") +assert anExtrusionFt.getKind() == "Extrusion" # selection type FACE=4 -anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(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&Sketch_2/SketchLine_3") +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&Sketch_2/SketchLine_3" +) anExtrusionFt.real("to_offset").setValue(0) -anExtrusionFt.selection("from_object").selectSubShape("face", "Extrusion_3_1/Generated_Face&Sketch_2/SketchLine_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() # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult is not None) +assert anExtrusionResult is not None -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusionCut.py b/src/FeaturesPlugin/Test/TestExtrusionCut.py index e4e0d3826..8bb63550e 100644 --- a/src/FeaturesPlugin/Test/TestExtrusionCut.py +++ b/src/FeaturesPlugin/Test/TestExtrusionCut.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -34,14 +34,14 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +assert len(aPartFeature.results()) == 1 # Another way is: # aPart = aSession.activeDocument() aPartResult = modelAPI_ResultPart(aPartFeature.firstResult()) aPart = aPartResult.partDoc() -#========================================================================= +# ========================================================================= # Create a sketch circle to extrude -#========================================================================= +# ========================================================================= aSession.startOperation() aCircleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")) @@ -57,39 +57,40 @@ aCircleRadius = aSketchCircle.real("circle_radius") anCircleCentr.setValue(0, 0) aCircleRadius.setValue(20) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on circle -#========================================================================= +# ========================================================================= # Build shape from sketcher results aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult()) -assert (aCircleSketchResult.facesNum() > 0) +assert aCircleSketchResult.facesNum() > 0 # Create extrusion aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "Extrusion") +assert anExtrusionFt.getKind() == "Extrusion" # selection type FACE=4 anExtrusionFt.selectionList("base").append( - aCircleSketchResult, aCircleSketchResult.face(0)) + aCircleSketchResult, aCircleSketchResult.face(0) +) 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.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) +assert anExtrusionFt.real("to_size").value() == 50.0 # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult is not None) +assert anExtrusionResult is not None -#========================================================================= +# ========================================================================= # Make extrusion cut -#========================================================================= +# ========================================================================= aSession.startOperation() anExtrusionCutFt = featureToCompositeFeature(aPart.addFeature("ExtrusionCut")) -assert (anExtrusionCutFt.getKind() == "ExtrusionCut") +assert anExtrusionCutFt.getKind() == "ExtrusionCut" # selection type FACE=4 aSession.startOperation() aCircleSketchFeature = featureToCompositeFeature(anExtrusionCutFt.addFeature("Sketch")) @@ -109,25 +110,28 @@ aCircleRadius.setValue(10) aSession.finishOperation() aSession.finishOperation() aSession.startOperation() -aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled. +aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled. anExtrusionCutFt.selectionList("base").append(aCircleSketchFeature.firstResult(), None) anExtrusionCutFt.string("CreationMethod").setValue("BySizes") anExtrusionCutFt.real("to_size").setValue(10) anExtrusionCutFt.real("from_size").setValue(10) -anExtrusionCutFt.real("to_offset").setValue(0) #TODO: remove -anExtrusionCutFt.real("from_offset").setValue(0) #TODO: remove -anExtrusionCutFt.selectionList("main_objects").append(anExtrusionResult, anExtrusionResult.shape()) +anExtrusionCutFt.real("to_offset").setValue(0) # TODO: remove +anExtrusionCutFt.real("from_offset").setValue(0) # TODO: remove +anExtrusionCutFt.selectionList("main_objects").append( + anExtrusionResult, anExtrusionResult.shape() +) aSession.finishOperation() aSession.finishOperation() -#========================================================================= +# ========================================================================= # Test results -#========================================================================= +# ========================================================================= aFactory = ModelAPI_Session.get().validators() -assert (aFactory.validate(anExtrusionCutFt)) -assert (len(anExtrusionCutFt.results()) > 0) +assert aFactory.validate(anExtrusionCutFt) +assert len(anExtrusionCutFt.results()) > 0 aCurrentResult = modelAPI_ResultBody(anExtrusionCutFt.firstResult()) -assert (aCurrentResult is not None) +assert aCurrentResult is not None from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusionCut_ByFaces.py b/src/FeaturesPlugin/Test/TestExtrusionCut_ByFaces.py index 10140de28..45c79427d 100644 --- a/src/FeaturesPlugin/Test/TestExtrusionCut_ByFaces.py +++ b/src/FeaturesPlugin/Test/TestExtrusionCut_ByFaces.py @@ -25,17 +25,29 @@ 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, 0, 0, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 200) SketchLine_3 = Sketch_1.addLine(0, 200, 25, 200) SketchLine_3.setAuxiliary(True) SketchLine_4 = Sketch_1.addLine(25, 200, 25, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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()) @@ -46,91 +58,250 @@ SketchLine_5 = Sketch_1.addLine(125, 243.301270189222, -25, 243.3012701892219) SketchLine_5.setAuxiliary(True) SketchLine_6 = Sketch_1.addLine(-25, 243.3012701892219, 0, 200) SketchLine_6.setAuxiliary(True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_6.endPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_6.endPoint() +) SketchLine_7 = Sketch_1.addLine(0, 200, 0, 350) SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_7.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_5.result(), SketchLine_7.result()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_7.result(), SketchLine_6.result(), 30) -SketchLine_8 = Sketch_1.addLine(-25, 243.3012701892219, 29.37846722219903, 268.6583658936639) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_8.startPoint()) -SketchLine_9 = Sketch_1.addLine(29.37846722219903, 268.6583658936639, 14.58682806127452, 300.3791384399466) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular(SketchLine_8.result(), SketchLine_9.result()) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_5.result(), SketchLine_7.result() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_7.result(), SketchLine_6.result(), 30 +) +SketchLine_8 = Sketch_1.addLine( + -25, 243.3012701892219, 29.37846722219903, 268.6583658936639 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_8.startPoint() +) +SketchLine_9 = Sketch_1.addLine( + 29.37846722219903, 268.6583658936639, 14.58682806127452, 300.3791384399466 +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular( + SketchLine_8.result(), SketchLine_9.result() +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_6.result(), 50) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 60) -SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_5.result(), SketchLine_8.result(), 25) +SketchConstraintAngle_2 = Sketch_1.setAngle( + SketchLine_5.result(), SketchLine_8.result(), 25 +) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_9.result(), 35) -SketchLine_10 = Sketch_1.addLine(23.03919329608853, 282.2529826992136, 36.18065620811996, 288.3809474944538) +SketchLine_10 = Sketch_1.addLine( + 23.03919329608853, 282.2529826992136, 36.18065620811996, 288.3809474944538 +) SketchLine_10.setAuxiliary(True) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.startPoint(), SketchLine_9.result()) -SketchLine_11 = Sketch_1.addLine(36.18065620811996, 288.3809474944538, 48.85920406034094, 261.1917138833543) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_10.startPoint(), SketchLine_9.result() +) +SketchLine_11 = Sketch_1.addLine( + 36.18065620811996, 288.3809474944538, 48.85920406034094, 261.1917138833543 +) SketchLine_11.setAuxiliary(True) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) -SketchConstraintPerpendicular_3 = Sketch_1.setPerpendicular(SketchLine_10.result(), SketchLine_11.result()) -SketchConstraintPerpendicular_4 = Sketch_1.setPerpendicular(SketchLine_9.result(), SketchLine_10.result()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintPerpendicular_3 = Sketch_1.setPerpendicular( + SketchLine_10.result(), SketchLine_11.result() +) +SketchConstraintPerpendicular_4 = Sketch_1.setPerpendicular( + SketchLine_9.result(), SketchLine_10.result() +) SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_11.result(), 30) SketchConstraintLength_7 = Sketch_1.setLength(SketchLine_10.result(), 14.5) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_9.endPoint(), SketchLine_10.startPoint(), 20, True) -SketchArc_1 = Sketch_1.addArc(4.697206021778518, 257.149304782984, 14.58682806127452, 300.3791384399466, 48.85920406034094, 261.1917138833543, True) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_1.results()[1]) -SketchArc_2 = Sketch_1.addArc(0.1512256873309691, 256.7331845326764, 48.85920406034094, 261.1917138833543, 34.14802119649147, 221.5683791690064, True) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchArc_2.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_1.results()[1]) -SketchArc_3 = Sketch_1.addArc(-71.98457930083825, 187.3071972226404, 0, 200, -25, 243.3012701892219, False) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_3.startPoint()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchArc_3.endPoint()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_9.endPoint(), SketchLine_10.startPoint(), 20, True +) +SketchArc_1 = Sketch_1.addArc( + 4.697206021778518, + 257.149304782984, + 14.58682806127452, + 300.3791384399466, + 48.85920406034094, + 261.1917138833543, + True, +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchArc_1.results()[1] +) +SketchArc_2 = Sketch_1.addArc( + 0.1512256873309691, + 256.7331845326764, + 48.85920406034094, + 261.1917138833543, + 34.14802119649147, + 221.5683791690064, + True, +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_1.results()[1] +) +SketchArc_3 = Sketch_1.addArc( + -71.98457930083825, 187.3071972226404, 0, 200, -25, 243.3012701892219, False +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchArc_3.endPoint() +) SketchLine_12 = Sketch_1.addLine(-25, 243.301270189222, 0, 222.3237794097899) SketchLine_12.setAuxiliary(True) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_7.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_12.result()) -SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_6.result(), SketchLine_12.result(), 20) -SketchArc_4 = Sketch_1.addArc(55, 200, 34.14802119649147, 221.5683791690064, 25, 200, False) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_4.startPoint()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_4.results()[1]) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_4.startPoint()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_4.results()[1]) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_7.result() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_12.result() +) +SketchConstraintAngle_3 = Sketch_1.setAngle( + SketchLine_6.result(), SketchLine_12.result(), 20 +) +SketchArc_4 = Sketch_1.addArc( + 55, 200, 34.14802119649147, 221.5683791690064, 25, 200, False +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_4.results()[1] +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchLine_4.result(), SketchArc_4.results()[1] +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_4.results()[1], 30) -SketchLine_13 = Sketch_1.addLine(-7.179200577043265, 240.5774662449659, 15.47849409887298, 251.1429227884834) -SketchLine_14 = Sketch_1.addLine(15.47849409887298, 251.1429227884834, 26.04395064239047, 228.4852281125672) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) -SketchLine_15 = Sketch_1.addLine(26.04395064239047, 228.4852281125672, 3.386255966474217, 217.9197715690497) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) -SketchLine_16 = Sketch_1.addLine(3.386255966474217, 217.9197715690497, -7.179200577043265, 240.5774662449659) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchLine_13.startPoint(), SketchLine_16.endPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_13.result(), SketchLine_15.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_16.result(), SketchLine_14.result()) -SketchConstraintPerpendicular_5 = Sketch_1.setPerpendicular(SketchLine_13.result(), SketchLine_14.result()) -SketchConstraintParallel_3 = Sketch_1.setParallel(SketchLine_13.result(), SketchLine_8.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_15.result(), SketchLine_14.result()) +SketchLine_13 = Sketch_1.addLine( + -7.179200577043265, 240.5774662449659, 15.47849409887298, 251.1429227884834 +) +SketchLine_14 = Sketch_1.addLine( + 15.47849409887298, 251.1429227884834, 26.04395064239047, 228.4852281125672 +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) +SketchLine_15 = Sketch_1.addLine( + 26.04395064239047, 228.4852281125672, 3.386255966474217, 217.9197715690497 +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) +SketchLine_16 = Sketch_1.addLine( + 3.386255966474217, 217.9197715690497, -7.179200577043265, 240.5774662449659 +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchLine_13.startPoint(), SketchLine_16.endPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_13.result(), SketchLine_15.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_16.result(), SketchLine_14.result() +) +SketchConstraintPerpendicular_5 = Sketch_1.setPerpendicular( + SketchLine_13.result(), SketchLine_14.result() +) +SketchConstraintParallel_3 = Sketch_1.setParallel( + SketchLine_13.result(), SketchLine_8.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_15.result(), SketchLine_14.result() +) SketchConstraintLength_8 = Sketch_1.setLength(SketchLine_13.result(), 25) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.result(), SketchLine_16.endPoint(), 10, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchArc_3.endPoint(), SketchLine_16.result(), 15, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_8.result(), SketchLine_16.endPoint(), 10, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchArc_3.endPoint(), SketchLine_16.result(), 15, True +) SketchConstraintLength_9 = Sketch_1.setLength(SketchLine_5.result(), 150) SketchConstraintLength_10 = Sketch_1.setLength(SketchLine_7.result(), 150) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchArc_4_2r-SketchArc_2_2f-SketchArc_1_2f-SketchLine_9r-SketchLine_8r-SketchArc_3_2r-SketchLine_2r-SketchLine_1r-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchLine_16f")], model.selection(), 10, 0) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14")) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchArc_4_2r-SketchArc_2_2f-SketchArc_1_2f-SketchLine_9r-SketchLine_8r-SketchArc_3_2r-SketchLine_2r-SketchLine_1r-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchLine_16f", + ) + ], + model.selection(), + 10, + 0, +) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14"), +) SketchLine_17 = Sketch_2.addLine(-221.0712923119171, 10, -196.0712923119172, 0) SketchLine_17.setAuxiliary(True) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_13][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14][Extrusion_1_1/To_Face]"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_13][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14][Extrusion_1_1/To_Face]", + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_17.startPoint(), SketchPoint_2.result()) -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_15][Extrusion_1_1/From_Face]"), False) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchLine_17.startPoint(), SketchPoint_2.result() +) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_15][Extrusion_1_1/From_Face]", + ), + False, +) SketchPoint_3 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchPoint_3.result()) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchLine_17.endPoint(), SketchPoint_3.result() +) SketchCircle_1 = Sketch_2.addCircle(-208.5712923119172, 5, 4) -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchLine_17.result(), SketchCircle_1.center()) -SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchCircle_1.center(), SketchLine_17.result()) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchLine_17.result(), SketchCircle_1.center() +) +SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint( + SketchCircle_1.center(), SketchLine_17.result() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 4) model.do() -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2f_wire")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2"), 0, model.selection(), 5, [model.selection("SOLID", "Extrusion_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2f_wire")], + model.selection(), + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2"), + 0, + model.selection(), + 5, + [model.selection("SOLID", "Extrusion_1_1")], +) model.do() from GeomAPI import GeomAPI_Shape @@ -147,4 +318,4 @@ model.testHaveNamingSubshapes(ExtrusionCut_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusionCut_ByPlanesAndOffsets.py b/src/FeaturesPlugin/Test/TestExtrusionCut_ByPlanesAndOffsets.py index 7d5dc8cbb..b4d2d0199 100644 --- a/src/FeaturesPlugin/Test/TestExtrusionCut_ByPlanesAndOffsets.py +++ b/src/FeaturesPlugin/Test/TestExtrusionCut_ByPlanesAndOffsets.py @@ -23,12 +23,20 @@ from SketchAPI import * import math -def checkMiddlePoint(shape, x, y, z, tolerance = 1.e-7): - assert(shape is not None) + +def checkMiddlePoint(shape, x, y, z, tolerance=1.0e-7): + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "{} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "{} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "{} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "{} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "{} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "{} != {}".format( + middlePoint.z(), z + ) + model.begin() partSet = model.moduleDocument() @@ -37,23 +45,52 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Axis_4 = model.addAxis(Part_1_doc, 10, 10, 10) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection("FACE", "Box_1_1/Right"), 0, model.selection(), 0, [model.selection("SOLID", "Box_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [], + model.selection("FACE", "Box_1_1/Right"), + 0, + model.selection(), + 0, + [model.selection("SOLID", "Box_1_1")], +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Left")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(5, 10, 2) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_1.center() +) ExtrusionCut_1.setNestedSketch(Sketch_1) model.do() Shape = ExtrusionCut_1.results()[0].resultSubShapePair()[0].shape() checkMiddlePoint(Shape, 5, 5, 4.72168715) -ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [], model.selection("EDGE", "Axis_1"), model.selection(), 0, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Box_1_1/Left"), 0, [model.selection("SOLID", "ExtrusionCut_1_1")]) +ExtrusionCut_2 = model.addExtrusionCut( + Part_1_doc, + [], + model.selection("EDGE", "Axis_1"), + model.selection(), + 0, + model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Box_1_1/Left"), + 0, + [model.selection("SOLID", "ExtrusionCut_1_1")], +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Front")) SketchCircle_2 = Sketch_2.addCircle(10, 10, 2.040695131136049) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Box_1_1/Right][Box_1_1/Front][(ExtrusionCut_1_1/Modified_Face&Box_1_1/Left)(ExtrusionCut_1_1/Modified_Face&Box_1_1/Right)(Box_1_1/Front)(Box_1_1/Back)2(Box_1_1/Bottom)2]"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[ExtrusionCut_1_1/Modified_Face&Box_1_1/Right][Box_1_1/Front][(ExtrusionCut_1_1/Modified_Face&Box_1_1/Left)(ExtrusionCut_1_1/Modified_Face&Box_1_1/Right)(Box_1_1/Front)(Box_1_1/Back)2(Box_1_1/Bottom)2]", + ), + False, +) SketchPoint_1 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchCircle_2.center(), SketchAPI_Point(SketchPoint_1).coordinates()) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchCircle_2.center(), SketchAPI_Point(SketchPoint_1).coordinates() +) ExtrusionCut_2.setNestedSketch(Sketch_2) model.do() Shape = ExtrusionCut_2.results()[0].resultSubShapePair()[0].shape() @@ -61,4 +98,4 @@ checkMiddlePoint(Shape, 4.999955838, 4.99999192, 4.677925562) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusionCut_BySize.py b/src/FeaturesPlugin/Test/TestExtrusionCut_BySize.py index d5cd3f22a..1d6f32c5f 100644 --- a/src/FeaturesPlugin/Test/TestExtrusionCut_BySize.py +++ b/src/FeaturesPlugin/Test/TestExtrusionCut_BySize.py @@ -22,12 +22,20 @@ from GeomAPI import * import math -def checkMiddlePoint(shape, x, y, z, tolerance = 1.e-7): - assert(shape is not None) + +def checkMiddlePoint(shape, x, y, z, tolerance=1.0e-7): + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "{} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "{} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "{} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "{} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "{} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "{} != {}".format( + middlePoint.z(), z + ) + model.begin() partSet = model.moduleDocument() @@ -36,12 +44,18 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Axis_1 = model.addAxis(Part_1_doc, 0, -10, 10) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), -5, [model.selection("SOLID", "Box_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, [], model.selection(), -5, [model.selection("SOLID", "Box_1_1")] +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Left")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(5, 10, 2) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_1.center() +) ExtrusionCut_1.setNestedSketch(Sketch_1) model.do() Shape = ExtrusionCut_1.results()[0].resultSubShapePair()[0].shape() @@ -52,14 +66,20 @@ model.do() Shape = ExtrusionCut_1.results()[0].resultSubShapePair()[0].shape() checkMiddlePoint(Shape, 4.99998635, 5.124949186, 4.8821269448) -ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [], -5, [model.selection("SOLID", "ExtrusionCut_1_1")]) +ExtrusionCut_2 = model.addExtrusionCut( + Part_1_doc, [], -5, [model.selection("SOLID", "ExtrusionCut_1_1")] +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Front")) SketchCircle_2 = Sketch_2.addCircle(2, 7, 1.5) ExtrusionCut_2.setNestedSketch(Sketch_2) model.do() -ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [], 0, 7, [model.selection("SOLID", "ExtrusionCut_2_1")]) -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_2_1/Modified_Face&Box_1_1/Front")) +ExtrusionCut_3 = model.addExtrusionCut( + Part_1_doc, [], 0, 7, [model.selection("SOLID", "ExtrusionCut_2_1")] +) +Sketch_3 = model.addSketch( + Part_1_doc, model.selection("FACE", "ExtrusionCut_2_1/Modified_Face&Box_1_1/Front") +) SketchCircle_3 = Sketch_3.addCircle(7, 2, 1.5) ExtrusionCut_3.setNestedSketch(Sketch_3) model.do() @@ -68,4 +88,4 @@ checkMiddlePoint(Shape, 4.826501151, 5.11493472, 4.9839082) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusionCut_ThroughAll.py b/src/FeaturesPlugin/Test/TestExtrusionCut_ThroughAll.py index 344900fb9..d51ed3834 100644 --- a/src/FeaturesPlugin/Test/TestExtrusionCut_ThroughAll.py +++ b/src/FeaturesPlugin/Test/TestExtrusionCut_ThroughAll.py @@ -22,12 +22,20 @@ from GeomAPI import * import math -def checkMiddlePoint(shape, x, y, z, tolerance = 1.e-7): - assert(shape is not None) + +def checkMiddlePoint(shape, x, y, z, tolerance=1.0e-7): + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "{} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "{} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "{} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "{} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "{} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "{} != {}".format( + middlePoint.z(), z + ) + model.begin() partSet = model.moduleDocument() @@ -36,12 +44,18 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Axis_1 = model.addAxis(Part_1_doc, 0, -10, 10) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), [model.selection("SOLID", "Box_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, [], model.selection(), [model.selection("SOLID", "Box_1_1")] +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Left")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(5, 10, 2) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_1.center() +) ExtrusionCut_1.setNestedSketch(Sketch_1) model.do() Shape = ExtrusionCut_1.results()[0].resultSubShapePair()[0].shape() @@ -52,14 +66,20 @@ model.do() Shape = ExtrusionCut_1.results()[0].resultSubShapePair()[0].shape() checkMiddlePoint(Shape, 5.00004436, 4.999993, 5.001212) -ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [], [model.selection("SOLID", "ExtrusionCut_1_1")]) +ExtrusionCut_2 = model.addExtrusionCut( + Part_1_doc, [], [model.selection("SOLID", "ExtrusionCut_1_1")] +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Front")) SketchCircle_2 = Sketch_2.addCircle(2, 7, 1.5) ExtrusionCut_2.setNestedSketch(Sketch_2) model.do() -ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [], [model.selection("SOLID", "ExtrusionCut_2_1")]) -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_2_1/Modified_Face&Box_1_1/Front")) +ExtrusionCut_3 = model.addExtrusionCut( + Part_1_doc, [], [model.selection("SOLID", "ExtrusionCut_2_1")] +) +Sketch_3 = model.addSketch( + Part_1_doc, model.selection("FACE", "ExtrusionCut_2_1/Modified_Face&Box_1_1/Front") +) SketchCircle_3 = Sketch_3.addCircle(7, 2, 1.5) ExtrusionCut_3.setNestedSketch(Sketch_3) model.do() @@ -68,4 +88,4 @@ checkMiddlePoint(Shape, 5.00008072, 5.079732577, 5.08050677) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusionFuse.py b/src/FeaturesPlugin/Test/TestExtrusionFuse.py index 88a58b8a3..55be2dde6 100644 --- a/src/FeaturesPlugin/Test/TestExtrusionFuse.py +++ b/src/FeaturesPlugin/Test/TestExtrusionFuse.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -34,14 +34,14 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +assert len(aPartFeature.results()) == 1 # Another way is: # aPart = aSession.activeDocument() aPartResult = modelAPI_ResultPart(aPartFeature.firstResult()) aPart = aPartResult.partDoc() -#========================================================================= +# ========================================================================= # Create a sketch circle to extrude -#========================================================================= +# ========================================================================= aSession.startOperation() aCircleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")) @@ -57,39 +57,40 @@ aCircleRadius = aSketchCircle.real("circle_radius") anCircleCentr.setValue(0, 0) aCircleRadius.setValue(20) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on circle -#========================================================================= +# ========================================================================= # Build shape from sketcher results aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult()) -assert (aCircleSketchResult.facesNum() > 0) +assert aCircleSketchResult.facesNum() > 0 # Create extrusion aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "Extrusion") +assert anExtrusionFt.getKind() == "Extrusion" # selection type FACE=4 anExtrusionFt.selectionList("base").append( - aCircleSketchResult, aCircleSketchResult.face(0)) + aCircleSketchResult, aCircleSketchResult.face(0) +) 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.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) +assert anExtrusionFt.real("to_size").value() == 50.0 # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult is not None) +assert anExtrusionResult is not None -#========================================================================= +# ========================================================================= # Make extrusion cut -#========================================================================= +# ========================================================================= aSession.startOperation() anExtrusionFuseFt = featureToCompositeFeature(aPart.addFeature("ExtrusionFuse")) -assert (anExtrusionFuseFt.getKind() == "ExtrusionFuse") +assert anExtrusionFuseFt.getKind() == "ExtrusionFuse" # selection type FACE=4 aSession.startOperation() aCircleSketchFeature = featureToCompositeFeature(anExtrusionFuseFt.addFeature("Sketch")) @@ -109,25 +110,28 @@ aCircleRadius.setValue(10) aSession.finishOperation() aSession.finishOperation() aSession.startOperation() -aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled. +aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled. anExtrusionFuseFt.selectionList("base").append(aCircleSketchFeature.firstResult(), None) anExtrusionFuseFt.string("CreationMethod").setValue("BySizes") anExtrusionFuseFt.real("to_size").setValue(10) anExtrusionFuseFt.real("from_size").setValue(10) -anExtrusionFuseFt.real("to_offset").setValue(0) #TODO: remove -anExtrusionFuseFt.real("from_offset").setValue(0) #TODO: remove -anExtrusionFuseFt.selectionList("main_objects").append(anExtrusionResult, anExtrusionResult.shape()) +anExtrusionFuseFt.real("to_offset").setValue(0) # TODO: remove +anExtrusionFuseFt.real("from_offset").setValue(0) # TODO: remove +anExtrusionFuseFt.selectionList("main_objects").append( + anExtrusionResult, anExtrusionResult.shape() +) aSession.finishOperation() aSession.finishOperation() -#========================================================================= +# ========================================================================= # Test results -#========================================================================= +# ========================================================================= aFactory = ModelAPI_Session.get().validators() -assert (aFactory.validate(anExtrusionFuseFt)) -assert (len(anExtrusionFuseFt.results()) > 0) +assert aFactory.validate(anExtrusionFuseFt) +assert len(anExtrusionFuseFt.results()) > 0 aCurrentResult = modelAPI_ResultBody(anExtrusionFuseFt.firstResult()) -assert (aCurrentResult is not None) +assert aCurrentResult is not None from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusionFuse_ByPlanesAndOffsets.py b/src/FeaturesPlugin/Test/TestExtrusionFuse_ByPlanesAndOffsets.py index d63b70050..de469c285 100644 --- a/src/FeaturesPlugin/Test/TestExtrusionFuse_ByPlanesAndOffsets.py +++ b/src/FeaturesPlugin/Test/TestExtrusionFuse_ByPlanesAndOffsets.py @@ -23,12 +23,20 @@ from SketchAPI import * import math -def checkMiddlePoint(shape, x, y, z, tolerance = 1.e-7): - assert(shape is not None) + +def checkMiddlePoint(shape, x, y, z, tolerance=1.0e-7): + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "{} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "{} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "{} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "{} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "{} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "{} != {}".format( + middlePoint.z(), z + ) + model.begin() partSet = model.moduleDocument() @@ -37,23 +45,55 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Axis_4 = model.addAxis(Part_1_doc, 10, 10, 10) -ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [], model.selection("FACE", "Box_1_1/Right"), 0, model.selection(), 0, [model.selection("SOLID", "Box_1_1")]) +ExtrusionFuse_1 = model.addExtrusionFuse( + Part_1_doc, + [], + model.selection("FACE", "Box_1_1/Right"), + 0, + model.selection(), + 0, + [model.selection("SOLID", "Box_1_1")], +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Left")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(5, 10, 2) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_1.center() +) ExtrusionFuse_1.setNestedSketch(Sketch_1) model.do() Shape = ExtrusionFuse_1.results()[0].resultSubShapePair()[0].shape() checkMiddlePoint(Shape, 5, 5, 5.3457661) -ExtrusionFuse_2 = model.addExtrusionFuse(Part_1_doc, [], model.selection("EDGE", "Axis_1"), model.selection(), 0, model.selection("FACE", "ExtrusionFuse_1_1/Modified_Face&Box_1_1/Left&ExtrusionFuse_1_1/From_Face"), 0, [model.selection("SOLID", "ExtrusionFuse_1_1")]) +ExtrusionFuse_2 = model.addExtrusionFuse( + Part_1_doc, + [], + model.selection("EDGE", "Axis_1"), + model.selection(), + 0, + model.selection( + "FACE", + "ExtrusionFuse_1_1/Modified_Face&Box_1_1/Left&ExtrusionFuse_1_1/From_Face", + ), + 0, + [model.selection("SOLID", "ExtrusionFuse_1_1")], +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Front")) SketchCircle_2 = Sketch_2.addCircle(10, 10, 2.040695131136049) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[(Box_1_1/Back)(Box_1_1/Bottom)(Box_1_1/Front)(ExtrusionFuse_1_1/Modified_Face&Box_1_1/Right&ExtrusionFuse_1_1/To_Face)][Box_1_1/Bottom][Box_1_1/Front]"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[(Box_1_1/Back)(Box_1_1/Bottom)(Box_1_1/Front)(ExtrusionFuse_1_1/Modified_Face&Box_1_1/Right&ExtrusionFuse_1_1/To_Face)][Box_1_1/Bottom][Box_1_1/Front]", + ), + False, +) SketchPoint_1 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchCircle_2.center(), SketchAPI_Point(SketchPoint_1).coordinates()) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchCircle_2.center(), SketchAPI_Point(SketchPoint_1).coordinates() +) ExtrusionFuse_2.setNestedSketch(Sketch_2) model.do() Shape = ExtrusionFuse_2.results()[0].resultSubShapePair()[0].shape() @@ -61,4 +101,4 @@ checkMiddlePoint(Shape, 4.97994427, 4.995857948, 4.254078314) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusionFuse_BySize.py b/src/FeaturesPlugin/Test/TestExtrusionFuse_BySize.py index 7f259fb45..1954e1ca2 100644 --- a/src/FeaturesPlugin/Test/TestExtrusionFuse_BySize.py +++ b/src/FeaturesPlugin/Test/TestExtrusionFuse_BySize.py @@ -22,12 +22,20 @@ from GeomAPI import * import math -def checkMiddlePoint(shape, x, y, z, tolerance = 1.e-7): - assert(shape is not None) + +def checkMiddlePoint(shape, x, y, z, tolerance=1.0e-7): + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "{} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "{} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "{} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "{} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "{} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "{} != {}".format( + middlePoint.z(), z + ) + model.begin() partSet = model.moduleDocument() @@ -36,12 +44,18 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Axis_1 = model.addAxis(Part_1_doc, 0, 10, -10) -ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [], model.selection(), -5, [model.selection("SOLID", "Box_1_1")]) +ExtrusionFuse_1 = model.addExtrusionFuse( + Part_1_doc, [], model.selection(), -5, [model.selection("SOLID", "Box_1_1")] +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Left")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(5, 10, 2) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_1.center() +) ExtrusionFuse_1.setNestedSketch(Sketch_1) model.do() Shape = ExtrusionFuse_1.results()[0].resultSubShapePair()[0].shape() @@ -52,13 +66,17 @@ model.do() Shape = ExtrusionFuse_1.results()[0].resultSubShapePair()[0].shape() checkMiddlePoint(Shape, 5, 4.71213222, 5.287400476) -ExtrusionFuse_2 = model.addExtrusionFuse(Part_1_doc, [], 3, [model.selection("SOLID", "ExtrusionFuse_1_1")]) +ExtrusionFuse_2 = model.addExtrusionFuse( + Part_1_doc, [], 3, [model.selection("SOLID", "ExtrusionFuse_1_1")] +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Front")) SketchCircle_2 = Sketch_2.addCircle(4, 7, 2) ExtrusionFuse_2.setNestedSketch(Sketch_2) model.do() -ExtrusionFuse_3 = model.addExtrusionFuse(Part_1_doc, [], 10, 0, [model.selection("SOLID", "ExtrusionFuse_2_1")]) +ExtrusionFuse_3 = model.addExtrusionFuse( + Part_1_doc, [], 10, 0, [model.selection("SOLID", "ExtrusionFuse_2_1")] +) Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Right")) SketchCircle_3 = Sketch_3.addCircle(5, -6, 3) ExtrusionFuse_3.setNestedSketch(Sketch_3) @@ -68,4 +86,4 @@ checkMiddlePoint(Shape, 5.17873875, 6.823505388, 5.484616493) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusionFuse_ThroughAll.py b/src/FeaturesPlugin/Test/TestExtrusionFuse_ThroughAll.py index 1e5c03abf..bba1c1603 100644 --- a/src/FeaturesPlugin/Test/TestExtrusionFuse_ThroughAll.py +++ b/src/FeaturesPlugin/Test/TestExtrusionFuse_ThroughAll.py @@ -22,12 +22,20 @@ from GeomAPI import * import math -def checkMiddlePoint(shape, x, y, z, tolerance = 1.e-7): - assert(shape is not None) + +def checkMiddlePoint(shape, x, y, z, tolerance=1.0e-7): + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "{} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "{} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "{} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "{} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "{} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "{} != {}".format( + middlePoint.z(), z + ) + model.begin() partSet = model.moduleDocument() @@ -37,15 +45,39 @@ 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) Box_3 = model.addBox(Part_1_doc, 20, 20, 20) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], 20, 10, 0) -Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], 40, 20, 0) -Edge_1 = model.addEdge(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_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/Top]")) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_2_1")], 20, 10, 0 +) +Translation_2 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_3_1")], 40, 20, 0 +) +Edge_1 = model.addEdge( + Part_1_doc, + model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_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/Top]", + ), +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Back")) -SketchCircle_1 = Sketch_1.addCircle(2.134236344973221, -2.430731739079631, 1.564909384334321) +SketchCircle_1 = Sketch_1.addCircle( + 2.134236344973221, -2.430731739079631, 1.564909384334321 +) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")]) -ExtrusionFuse_1_objects_2 = [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("SOLID", "Translation_2_1")] -ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "Edge_1_1"), ExtrusionFuse_1_objects_2) +Face_1 = model.addFace( + Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")] +) +ExtrusionFuse_1_objects_2 = [ + model.selection("SOLID", "Box_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("SOLID", "Translation_2_1"), +] +ExtrusionFuse_1 = model.addExtrusionFuse( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("EDGE", "Edge_1_1"), + ExtrusionFuse_1_objects_2, +) model.do() Shape = ExtrusionFuse_1.results()[0].resultSubShapePair()[0].shape() @@ -53,4 +85,4 @@ checkMiddlePoint(Shape, 42.63716766, 25.85781486, 9.0373214) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusionOfCompound.py b/src/FeaturesPlugin/Test/TestExtrusionOfCompound.py index 20d2e4ba5..5e3857e16 100644 --- a/src/FeaturesPlugin/Test/TestExtrusionOfCompound.py +++ b/src/FeaturesPlugin/Test/TestExtrusionOfCompound.py @@ -28,8 +28,22 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(15, -20, 8) SketchCircle_2 = Sketch_1.addCircle(35, -5, 15) model.do() -Compound_1 = model.addCompound(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")]) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], model.selection(), model.selection(), 0, model.selection("FACE", "PartSet/XOY"), 10) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), + model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f"), + ], +) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Compound_1_1")], + model.selection(), + model.selection(), + 0, + model.selection("FACE", "PartSet/XOY"), + 10, +) model.do() Part_2 = model.addPart(partSet) @@ -38,8 +52,16 @@ Sketch_2 = model.addSketch(Part_2_doc, model.defaultPlane("XOY")) SketchCircle_3 = Sketch_2.addCircle(15, -20, 8) SketchCircle_4 = Sketch_2.addCircle(35, -5, 15) model.do() -Compound_2 = model.addCompound(Part_2_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")]) -Extrusion_2 = model.addExtrusion(Part_2_doc, [model.selection("COMPOUND", "Compound_1_1")], model.selection(), 10, 0) +Compound_2 = model.addCompound( + Part_2_doc, + [ + model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), + model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f"), + ], +) +Extrusion_2 = model.addExtrusion( + Part_2_doc, [model.selection("COMPOUND", "Compound_1_1")], model.selection(), 10, 0 +) model.do() model.end() @@ -62,4 +84,4 @@ model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.EDGE, [12]) model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.VERTEX, [24]) model.testResultsVolumes(Extrusion_2, [9079.2027688745]) -assert(model.checkPythonDump()) \ No newline at end of file +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces01.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces01.py index 0e0e4856b..31ec504e8 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces01.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces01.py @@ -28,28 +28,57 @@ Part_1_doc = Part_1.document() ParamR = model.addParameter(Part_1_doc, "R", "50") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R", 100, 180) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "R", + 100, + 180, +) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(20, 40, -30, 40) SketchLine_2 = Sketch_1.addLine(-30, 40, -30, 20) SketchLine_3 = Sketch_1.addLine(-30, 20, 20, 20) SketchLine_4 = Sketch_1.addLine(20, 20, 20, 40) -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()) +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()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 50) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), model.selection("FACE", "Cylinder_1_1/Face_1"), "offsetTo", model.selection(), "offsetFrom") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + model.selection("FACE", "Cylinder_1_1/Face_1"), + "offsetTo", + model.selection(), + "offsetFrom", +) from GeomAPI import GeomAPI_Shape @@ -83,7 +112,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [18]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [36]) model.testResultsVolumes(Extrusion_1, [25176.8518]) -ParamR.setValue(40); +ParamR.setValue(40) model.do() model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [0]) @@ -131,4 +160,4 @@ model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces02.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces02.py index 5ae523766..bd30e68ee 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces02.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces02.py @@ -28,29 +28,63 @@ Part_1_doc = Part_1.document() ParamR = model.addParameter(Part_1_doc, "R", "50") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R", 100, 180) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OY"), 50) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "R", + 100, + 180, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(20, 40, -30, 40) SketchLine_2 = Sketch_1.addLine(-30, 40, -30, 20) SketchLine_3 = Sketch_1.addLine(-30, 20, 20, 20) SketchLine_4 = Sketch_1.addLine(20, 20, 20, 40) -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()) +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()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 50) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"), "offsetTo", model.selection(), "offsetFrom") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"), + "offsetTo", + model.selection(), + "offsetFrom", +) from GeomAPI import GeomAPI_Shape @@ -65,7 +99,7 @@ model.testResultsVolumes(Extrusion_1, [97540.6]) # change radius of cylinder and check failure ParamR.setValue(10) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure, check the intersected boundaries are processed well ParamR.setValue(30) @@ -76,7 +110,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [1]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [6]) model.testResultsVolumes(Extrusion_1, [75176.8518]) -ParamR.setValue(40); +ParamR.setValue(40) model.do() model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [0]) @@ -87,7 +121,7 @@ model.testResultsVolumes(Extrusion_1, [86812.03]) # change offsetting "To" face and check failure ParamTo.setValue(-20) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure ParamTo.setValue(20) @@ -121,4 +155,4 @@ model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces03.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces03.py index cfff06e7b..5f52c56b1 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces03.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces03.py @@ -30,46 +30,101 @@ ParamSize = model.addParameter(Part_1_doc, "Size", "50") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "R") -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Sphere_1_1"), model.selection("FACE", "PartSet/XOZ")]) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Sphere_1_1"), model.selection("FACE", "PartSet/XOZ")], +) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), 10, False) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) SketchLine_1 = Sketch_1.addLine(50, -50, -50, -50) SketchLine_2 = Sketch_1.addLine(-50, -50, -50, 50) SketchLine_3 = Sketch_1.addLine(-50, 50, 50, 50) SketchLine_4 = Sketch_1.addLine(50, 50, 50, -50) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), "Size", True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), "Size", True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), "Size", True) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.result(), "Size", True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), "Size", True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), "Size", True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), "Size", True +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.result(), "Size", True +) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")]) +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.defaultPlane("XOZ")) SketchLine_5 = Sketch_2.addLine(20, -15, 20, 20) SketchLine_6 = Sketch_2.addLine(20, 20, -15, 20) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_5.result()) SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result()) SketchArc_1 = Sketch_2.addArc(0, 0, -15, 20, 20, -15, False) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_5.startPoint()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_5.result(), SketchLine_6.result()) -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchArc_1.center(), SketchLine_5.result(), 20, True) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchArc_1.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_5.result(), SketchLine_6.result() +) +SketchConstraintDistance_5 = Sketch_2.setDistance( + SketchArc_1.center(), SketchLine_5.result(), 20, True +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchArc_1.center()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchArc_1.center() +) SketchConstraintRadius_1 = Sketch_2.setRadius(SketchArc_1.results()[1], 25) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchArc_1_2f")], model.selection(), model.selection("FACE", "Partition_1_1_2/Modified_Face&Sphere_1_1/Face_1"), "offsetTo", model.selection("FACE", "Face_1_1"), "offsetFrom") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchArc_1_2f" + ) + ], + model.selection(), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Sphere_1_1/Face_1"), + "offsetTo", + model.selection("FACE", "Face_1_1"), + "offsetFrom", +) from GeomAPI import GeomAPI_Shape @@ -84,7 +139,7 @@ model.testResultsVolumes(Extrusion_1, [100878.6]) # change radius of sphere and check failure ParamR.setValue(10) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure, check the intersected boundaries are processed well ParamR.setValue(30) @@ -95,7 +150,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [1]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [5]) model.testResultsVolumes(Extrusion_1, [60964.23998]) -ParamR.setValue(40); +ParamR.setValue(40) model.do() model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [0]) @@ -115,7 +170,7 @@ model.testResultsVolumes(Extrusion_1, [81651.666]) # change offsetting "To" face and check failure ParamTo.setValue(-20) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure ParamTo.setValue(20) @@ -151,4 +206,4 @@ model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces04.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces04.py index 672355216..aee2544c1 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces04.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces04.py @@ -31,63 +31,120 @@ ParamSize = model.addParameter(Part_1_doc, "Size", "50") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "R") -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Sphere_1_1"), model.selection("FACE", "PartSet/XOZ")]) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Sphere_1_1"), model.selection("FACE", "PartSet/XOZ")], +) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), 30, False) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) SketchLine_1 = Sketch_1.addLine(50, -50, -50, -50) SketchLine_2 = Sketch_1.addLine(-50, -50, -50, 50) SketchLine_3 = Sketch_1.addLine(-50, 50, 50, 50) SketchLine_4 = Sketch_1.addLine(50, 50, 50, -50) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), "Size", True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), "Size", True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), "Size", True) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.result(), "Size", True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), "Size", True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), "Size", True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), "Size", True +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.result(), "Size", True +) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")]) +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.defaultPlane("XOZ")) SketchLine_5 = Sketch_2.addLine(20, -40.3112887414928, 20, 20) SketchLine_6 = Sketch_2.addLine(20, 20, -40.31128874149281, 20.00000000000001) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_5.result()) SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result()) -SketchArc_1 = Sketch_2.addArc(0, 0, -40.31128874149281, 20.00000000000001, 20, -40.3112887414928, False) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_5.startPoint()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_5.result(), SketchLine_6.result()) -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchArc_1.center(), SketchLine_5.result(), 20, True) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchArc_1 = Sketch_2.addArc( + 0, 0, -40.31128874149281, 20.00000000000001, 20, -40.3112887414928, False +) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchArc_1.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_5.result(), SketchLine_6.result() +) +SketchConstraintDistance_5 = Sketch_2.setDistance( + SketchArc_1.center(), SketchLine_5.result(), 20, True +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchArc_1.center()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchArc_1.center() +) SketchConstraintRadius_1 = Sketch_2.setRadius(SketchArc_1.results()[1], 45) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchArc_1_2f")], model.selection(), model.selection("FACE", "Partition_1_1_1/Modified_Face&Sphere_1_1/Face_1"), "offsetTo", model.selection("FACE", "Face_1_1"), "offsetFrom") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchArc_1_2f" + ) + ], + model.selection(), + model.selection("FACE", "Partition_1_1_1/Modified_Face&Sphere_1_1/Face_1"), + "offsetTo", + model.selection("FACE", "Face_1_1"), + "offsetFrom", +) # extrusion have to fail because of several results with shared topology -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # change radius of sphere and check failure ParamR.setValue(10) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" ParamR.setValue(45) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # change offsetting "To" face and check failure ParamTo.setValue(-20) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure ParamTo.setValue(20) @@ -112,7 +169,7 @@ model.testResultsVolumes(Extrusion_1, [179594.5]) # check failure ParamFrom.setValue(-20) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure ParamTo.setValue(0) @@ -129,4 +186,4 @@ model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces05.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces05.py index 87925f506..33c0543bc 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces05.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces05.py @@ -30,17 +30,39 @@ ParamRCyl = model.addParameter(Part_1_doc, "rCyl", "30") ParamRCir = model.addParameter(Part_1_doc, "rCircle", "10") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") -Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "rSphere") -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "rCyl", 100) +Sphere_1 = model.addSphere( + Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "rSphere" +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "rCyl", + 100, +) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchCircle_1 = Sketch_1.addCircle(15, 20, 10) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "rCircle") -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 15) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 20) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 15 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 20 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), model.selection("FACE", "Sphere_1_1/Face_1"), "offsetTo", model.selection("FACE", "Cylinder_1_1/Face_1"), "offsetFrom") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], + model.selection(), + model.selection("FACE", "Sphere_1_1/Face_1"), + "offsetTo", + model.selection("FACE", "Cylinder_1_1/Face_1"), + "offsetFrom", +) from GeomAPI import GeomAPI_Shape @@ -77,10 +99,10 @@ model.testResultsVolumes(Extrusion_1, [42694.3277614]) # change radius of sketch circle and check failure ParamRCir.setValue(10) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure -ParamRSph.setValue(45); +ParamRSph.setValue(45) model.do() model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [2]) @@ -158,4 +180,4 @@ model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces06.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces06.py index 9b58444c4..4b1a779dc 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces06.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces06.py @@ -28,28 +28,73 @@ Part_1_doc = Part_1.document() ParamR = model.addParameter(Part_1_doc, "R", "50") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") -Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R", "R/5", "R") -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Cone_1_1"), model.selection("FACE", "PartSet/XOZ")]) +Cone_1 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "R", + "R/5", + "R", +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Cone_1_1"), model.selection("FACE", "PartSet/XOZ")], +) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), 20, False) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_1"), model.selection("EDGE", "PartSet/OZ"), 330) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Plane_1"), + model.selection("EDGE", "PartSet/OZ"), + 330, +) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(10, 8.819660112501044, 10, 30) SketchLine_2 = Sketch_1.addLine(10, 30, -11.18033988749895, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) -SketchArc_1 = Sketch_1.addArc(0, 20, -11.18033988749895, 30, 10, 8.819660112501044, False) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_1.result(), 10, True) +SketchArc_1 = Sketch_1.addArc( + 0, 20, -11.18033988749895, 30, 10, 8.819660112501044, False +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_1.result(), 10, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 15) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_3.result()) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchArc_1.center(), 20) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_3.result() +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Line(SketchLine_3).startPoint(), SketchArc_1.center(), 20 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchArc_1_2f")], model.selection(), model.selection("FACE", "Partition_1_1_2/Modified_Face&Cone_1_1/Face_1"), "offsetTo", model.selection("FACE", "Plane_2"), "offsetFrom") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchArc_1_2f" + ) + ], + model.selection(), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Cone_1_1/Face_1"), + "offsetTo", + model.selection("FACE", "Plane_2"), + "offsetFrom", +) from GeomAPI import GeomAPI_Shape @@ -64,7 +109,7 @@ model.testResultsVolumes(Extrusion_1, [31363.4963946]) # change radius of sphere and check failure ParamR.setValue(10) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure, check the intersected boundaries are processed well ParamR.setValue(40) @@ -78,7 +123,7 @@ model.testResultsVolumes(Extrusion_1, [25645.0102138]) # change offsetting "To" face and check failure ParamTo.setValue(-20) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure ParamTo.setValue(8) @@ -112,4 +157,4 @@ model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces07.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces07.py index 7e007febb..0f36f255f 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces07.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces07.py @@ -28,33 +28,70 @@ Part_1_doc = Part_1.document() ParamR = model.addParameter(Part_1_doc, "R", "50") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R", 100, 180) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "R", + 100, + 180, +) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(20, 40, -30, 40) SketchLine_2 = Sketch_1.addLine(-30, 40, -30, 20) SketchLine_3 = Sketch_1.addLine(-30, 20, 20, 20) SketchLine_4 = Sketch_1.addLine(20, 20, 20, 40) -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()) +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()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 50) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20 +) SketchLine_5 = Sketch_1.addLine(-10, 20, 5, 40) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_3.result()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.result()) -SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_2.endPoint(), SketchLine_5.startPoint(), 20) -SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance(SketchLine_5.endPoint(), SketchLine_1.startPoint(), 15) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_3.result() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_1.result() +) +SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance( + SketchLine_2.endPoint(), SketchLine_5.startPoint(), 20 +) +SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance( + SketchLine_5.endPoint(), SketchLine_1.startPoint(), 15 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), model.selection("FACE", "Cylinder_1_1/Face_1"), "offsetTo", model.selection(), "offsetFrom") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + model.selection("FACE", "Cylinder_1_1/Face_1"), + "offsetTo", + model.selection(), + "offsetFrom", +) from GeomAPI import GeomAPI_Shape @@ -88,7 +125,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [42]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [84]) model.testResultsVolumes(Extrusion_1, [25176.8518]) -ParamR.setValue(40); +ParamR.setValue(40) model.do() model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [2]) @@ -140,4 +177,4 @@ model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces08.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces08.py index 87189dd47..b32a3737f 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces08.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces08.py @@ -28,34 +28,85 @@ Part_1_doc = Part_1.document() ParamR = model.addParameter(Part_1_doc, "R", "50") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R", 100, 180) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OY"), 50) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "R", + 100, + 180, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(20, 40, -30, 40) SketchLine_2 = Sketch_1.addLine(-30, 40, -30, 20) SketchLine_3 = Sketch_1.addLine(-30, 20, 20, 20) SketchLine_4 = Sketch_1.addLine(20, 20, 20, 40) -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()) +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()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 50) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20 +) SketchLine_5 = Sketch_1.addLine(-10, 20, 5, 40) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_3.result()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.result()) -SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_2.endPoint(), SketchLine_5.startPoint(), 20) -SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance(SketchLine_5.endPoint(), SketchLine_1.startPoint(), 15) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_3.result() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_1.result() +) +SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance( + SketchLine_2.endPoint(), SketchLine_5.startPoint(), 20 +) +SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance( + SketchLine_5.endPoint(), SketchLine_1.startPoint(), 15 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_5f"), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_5r-SketchLine_3f-SketchLine_4f")], model.selection(), model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"), "offsetTo", model.selection(), "offsetFrom") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_5f", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_5r-SketchLine_3f-SketchLine_4f", + ), + ], + model.selection(), + model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"), + "offsetTo", + model.selection(), + "offsetFrom", +) from GeomAPI import GeomAPI_Shape @@ -70,7 +121,7 @@ model.testResultsVolumes(Extrusion_1, [97540.6]) # change radius of cylinder and check failure ParamR.setValue(10) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure, check the intersected boundaries are processed well ParamR.setValue(30) @@ -81,7 +132,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [2]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [12]) model.testResultsVolumes(Extrusion_1, [75176.8518]) -ParamR.setValue(40); +ParamR.setValue(40) model.do() model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [2]) @@ -92,7 +143,7 @@ model.testResultsVolumes(Extrusion_1, [86812.03]) # change offsetting "To" face and check failure ParamTo.setValue(-25) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure ParamTo.setValue(20) @@ -126,4 +177,4 @@ model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces09.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces09.py index 6be935b54..781dec0f7 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces09.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces09.py @@ -30,49 +30,109 @@ ParamSize = model.addParameter(Part_1_doc, "Size", "50") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "R") -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Sphere_1_1"), model.selection("FACE", "PartSet/XOZ")]) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Sphere_1_1"), model.selection("FACE", "PartSet/XOZ")], +) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), 10, False) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) SketchLine_1 = Sketch_1.addLine(50, -50, -50, -50) SketchLine_2 = Sketch_1.addLine(-50, -50, -50, 50) SketchLine_3 = Sketch_1.addLine(-50, 50, 50, 50) SketchLine_4 = Sketch_1.addLine(50, 50, 50, -50) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), "Size", True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), "Size", True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), "Size", True) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.result(), "Size", True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), "Size", True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), "Size", True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), "Size", True +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.result(), "Size", True +) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")]) +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.defaultPlane("XOZ")) SketchLine_5 = Sketch_2.addLine(20, -15, 20, 20) SketchLine_6 = Sketch_2.addLine(20, 20, -15, 20) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_5.result()) SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result()) SketchArc_1 = Sketch_2.addArc(0, 0, -15, 20, 20, -15, False) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_5.startPoint()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_5.result(), SketchLine_6.result()) -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchArc_1.center(), SketchLine_5.result(), 20, True) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchArc_1.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_5.result(), SketchLine_6.result() +) +SketchConstraintDistance_5 = Sketch_2.setDistance( + SketchArc_1.center(), SketchLine_5.result(), 20, True +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchArc_1.center()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchArc_1.center() +) SketchConstraintRadius_1 = Sketch_2.setRadius(SketchArc_1.results()[1], 25) SketchLine_7 = Sketch_2.addLine(-15, 20, 20, -15) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_5.startPoint(), SketchLine_7.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_1_2f-SketchLine_7r"), model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchLine_7f")], model.selection(), model.selection("FACE", "Partition_1_1_2/Modified_Face&Sphere_1_1/Face_1"), "offsetTo", model.selection("FACE", "Face_1_1"), "offsetFrom") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection("FACE", "Sketch_2/Face-SketchArc_1_2f-SketchLine_7r"), + model.selection( + "FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchLine_7f" + ), + ], + model.selection(), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Sphere_1_1/Face_1"), + "offsetTo", + model.selection("FACE", "Face_1_1"), + "offsetFrom", +) from GeomAPI import GeomAPI_Shape @@ -87,7 +147,7 @@ model.testResultsVolumes(Extrusion_1, [100878.6]) # change radius of sphere and check failure ParamR.setValue(10) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure, check the intersected boundaries are processed well ParamR.setValue(30) @@ -98,7 +158,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [2]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [9]) model.testResultsVolumes(Extrusion_1, [60964.23998]) -ParamR.setValue(40); +ParamR.setValue(40) model.do() model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [2]) @@ -118,7 +178,7 @@ model.testResultsVolumes(Extrusion_1, [81651.666]) # change offsetting "To" face and check failure ParamTo.setValue(-20) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure ParamTo.setValue(20) @@ -154,4 +214,4 @@ model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces10.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces10.py index 32182b158..44dda324c 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces10.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces10.py @@ -31,67 +31,126 @@ ParamSize = model.addParameter(Part_1_doc, "Size", "50") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "R") -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Sphere_1_1"), model.selection("FACE", "PartSet/XOZ")]) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Sphere_1_1"), model.selection("FACE", "PartSet/XOZ")], +) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), 30, False) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) SketchLine_1 = Sketch_1.addLine(50, -50, -50, -50) SketchLine_2 = Sketch_1.addLine(-50, -50, -50, 50) SketchLine_3 = Sketch_1.addLine(-50, 50, 50, 50) SketchLine_4 = Sketch_1.addLine(50, 50, 50, -50) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), "Size", True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), "Size", True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), "Size", True) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.result(), "Size", True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), "Size", True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), "Size", True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), "Size", True +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.result(), "Size", True +) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")]) +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.defaultPlane("XOZ")) SketchLine_5 = Sketch_2.addLine(20, -40.3112887414928, 20, 20) SketchLine_6 = Sketch_2.addLine(20, 20, -40.31128874149281, 20.00000000000001) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_5.result()) SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result()) -SketchArc_1 = Sketch_2.addArc(0, 0, -40.31128874149281, 20.00000000000001, 20, -40.3112887414928, False) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_5.startPoint()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_5.result(), SketchLine_6.result()) -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchArc_1.center(), SketchLine_5.result(), 20, True) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchArc_1 = Sketch_2.addArc( + 0, 0, -40.31128874149281, 20.00000000000001, 20, -40.3112887414928, False +) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchArc_1.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_5.result(), SketchLine_6.result() +) +SketchConstraintDistance_5 = Sketch_2.setDistance( + SketchArc_1.center(), SketchLine_5.result(), 20, True +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchArc_1.center()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchArc_1.center() +) SketchConstraintRadius_1 = Sketch_2.setRadius(SketchArc_1.results()[1], 45) SketchLine_7 = Sketch_2.addLine(20, 20, -31.81980515339464, -31.81980515339464) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchArc_1.results()[1]) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchArc_1.center(), SketchLine_7.result()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchArc_1.results()[1] +) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchArc_1.center(), SketchLine_7.result() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), model.selection("FACE", "Partition_1_1_1/Modified_Face&Sphere_1_1/Face_1"), "offsetTo", model.selection("FACE", "Face_1_1"), "offsetFrom") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_2")], + model.selection(), + model.selection("FACE", "Partition_1_1_1/Modified_Face&Sphere_1_1/Face_1"), + "offsetTo", + model.selection("FACE", "Face_1_1"), + "offsetFrom", +) # extrusion have to fail because of several results with shared topology -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # change radius of sphere and check failure ParamR.setValue(10) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" ParamR.setValue(45) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # change offsetting "To" face and check failure ParamTo.setValue(-20) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure ParamTo.setValue(20) @@ -116,7 +175,7 @@ model.testResultsVolumes(Extrusion_1, [179594.5]) # check failure ParamFrom.setValue(-20) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure ParamTo.setValue(0) @@ -133,4 +192,4 @@ model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces11.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces11.py index 70098021c..8466dd433 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces11.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces11.py @@ -30,22 +30,55 @@ ParamRCyl = model.addParameter(Part_1_doc, "rCyl", "30") ParamRCir = model.addParameter(Part_1_doc, "rCircle", "10") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") -Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "rSphere") -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "rCyl", 100) +Sphere_1 = model.addSphere( + Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "rSphere" +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "rCyl", + 100, +) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchCircle_1 = Sketch_1.addCircle(15, 20, 10) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "rCircle") -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 15) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 20) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 15 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 20 +) SketchLine_1 = Sketch_1.addLine(6.339745962155468, 15, 23.66025403784453, 15) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_1.result(), "rCircle/2", True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_1.result(), "rCircle/2", True +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchCircle_1_2r-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_1f")], model.selection(), model.selection("FACE", "Sphere_1_1/Face_1"), "offsetTo", model.selection("FACE", "Cylinder_1_1/Face_1"), "offsetFrom") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchCircle_1_2r-SketchLine_1r" + ), + model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_1f"), + ], + model.selection(), + model.selection("FACE", "Sphere_1_1/Face_1"), + "offsetTo", + model.selection("FACE", "Cylinder_1_1/Face_1"), + "offsetFrom", +) from GeomAPI import GeomAPI_Shape @@ -82,10 +115,10 @@ model.testResultsVolumes(Extrusion_1, [41289.10946]) # change radius of sketch circle and check failure ParamRCir.setValue(10) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure -ParamRSph.setValue(45); +ParamRSph.setValue(45) model.do() model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [2]) @@ -163,4 +196,4 @@ model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces12.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces12.py index 9a6d3a3b6..25f1c28b3 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces12.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces12.py @@ -28,31 +28,76 @@ Part_1_doc = Part_1.document() ParamR = model.addParameter(Part_1_doc, "R", "50") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") -Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R", "R/5", "R") -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Cone_1_1"), model.selection("FACE", "PartSet/XOZ")]) +Cone_1 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "R", + "R/5", + "R", +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Cone_1_1"), model.selection("FACE", "PartSet/XOZ")], +) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), 20, False) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_1"), model.selection("EDGE", "PartSet/OZ"), 330) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Plane_1"), + model.selection("EDGE", "PartSet/OZ"), + 330, +) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(10, 8.819660112501044, 10, 30) SketchLine_2 = Sketch_1.addLine(10, 30, -11.18033988749895, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) -SketchArc_1 = Sketch_1.addArc(0, 20, -11.18033988749895, 30, 10, 8.819660112501044, False) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_1.result(), 10, True) +SketchArc_1 = Sketch_1.addArc( + 0, 20, -11.18033988749895, 30, 10, 8.819660112501044, False +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_1.result(), 10, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 15) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_3.result()) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchArc_1.center(), 20) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_3.result() +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Line(SketchLine_3).startPoint(), SketchArc_1.center(), 20 +) SketchLine_4 = Sketch_1.addLine(-11.18033988749895, 30, 10, 8.819660112501044) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_4.endPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_4.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), model.selection("FACE", "Partition_1_1_2/Modified_Face&Cone_1_1/Face_1"), "offsetTo", model.selection("FACE", "Plane_2"), "offsetFrom") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Cone_1_1/Face_1"), + "offsetTo", + model.selection("FACE", "Plane_2"), + "offsetFrom", +) from GeomAPI import GeomAPI_Shape @@ -67,7 +112,7 @@ model.testResultsVolumes(Extrusion_1, [31363.4963946]) # change radius of sphere and check failure ParamR.setValue(10) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure, check the intersected boundaries are processed well ParamR.setValue(40) @@ -83,7 +128,7 @@ model.testResultsVolumes(Extrusion_1, [25645.0102138]) # change offsetting "To" face and check failure ParamTo.setValue(-20) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure ParamTo.setValue(8) @@ -117,4 +162,4 @@ model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces13.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces13.py index 1731b9690..3af59a788 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces13.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces13.py @@ -28,31 +28,70 @@ Part_1_doc = Part_1.document() ParamR = model.addParameter(Part_1_doc, "R", "50") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R", 100, 180) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "R", + 100, + 180, +) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(20, 40, -30, 40) SketchLine_2 = Sketch_1.addLine(-30, 40, -30, 20) SketchLine_3 = Sketch_1.addLine(-30, 20, 20, 20) SketchLine_4 = Sketch_1.addLine(20, 20, 20, 40) -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()) +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()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 50) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20 +) model.do() -Edge_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")] +Edge_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"), +] Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects) -Extrusion_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")] -Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection("EDGE", "PartSet/OY"), model.selection("FACE", "Cylinder_1_1/Face_1"), "offsetTo", model.selection(), "offsetFrom") +Extrusion_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"), +] +Extrusion_1 = model.addExtrusion( + Part_1_doc, + Extrusion_1_objects, + model.selection("EDGE", "PartSet/OY"), + model.selection("FACE", "Cylinder_1_1/Face_1"), + "offsetTo", + model.selection(), + "offsetFrom", +) from GeomAPI import GeomAPI_Shape @@ -67,14 +106,14 @@ model.testResultsAreas(Extrusion_1, [2377.030013, 800, 2377.030013, 916.515139]) # change radius of cylinder ParamR.setValue(10) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" ParamR.setValue(30) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure and check the intersected boundaries are processed well -ParamR.setValue(40); +ParamR.setValue(40) model.do() model.testNbResults(Extrusion_1, 4) model.testNbSubResults(Extrusion_1, [0, 0, 0, 0]) @@ -87,7 +126,7 @@ model.testResultsAreas(Extrusion_1, [1840.601542, 529.150262, 1840.601542, 692.8 # change offsetting "To" face ParamTo.setValue(-20) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure ParamTo.setValue(20) @@ -98,7 +137,9 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [0, 0, 0, 0]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [1, 1, 1, 1]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [4, 4, 4, 4]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [8, 8, 8, 8]) -model.testResultsAreas(Extrusion_1, [2899.292521, 1039.2304845, 2899.292521, 1131.3708499]) +model.testResultsAreas( + Extrusion_1, [2899.292521, 1039.2304845, 2899.292521, 1131.3708499] +) # offset "From" face ParamFrom.setValue(20) @@ -109,7 +150,9 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [0, 0, 0, 0]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [1, 1, 1, 1]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [4, 4, 4, 4]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [8, 8, 8, 8]) -model.testResultsAreas(Extrusion_1, [3899.292521, 1439.2304845, 3899.292521, 1531.3708499]) +model.testResultsAreas( + Extrusion_1, [3899.292521, 1439.2304845, 3899.292521, 1531.3708499] +) ParamFrom.setValue(-20) model.do() @@ -119,10 +162,12 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [0, 0, 0, 0]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [1, 1, 1, 1]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [4, 4, 4, 4]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [8, 8, 8, 8]) -model.testResultsAreas(Extrusion_1, [1899.292521, 639.2304845, 1899.292521, 731.3708499]) +model.testResultsAreas( + Extrusion_1, [1899.292521, 639.2304845, 1899.292521, 731.3708499] +) model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces14.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces14.py index 70ad0b99d..f3342101d 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces14.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces14.py @@ -28,32 +28,76 @@ Part_1_doc = Part_1.document() ParamR = model.addParameter(Part_1_doc, "R", "50") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R", 100, 180) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OY"), 50) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "R", + 100, + 180, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(20, 40, -30, 40) SketchLine_2 = Sketch_1.addLine(-30, 40, -30, 20) SketchLine_3 = Sketch_1.addLine(-30, 20, 20, 20) SketchLine_4 = Sketch_1.addLine(20, 20, 20, 40) -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()) +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()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 50) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20 +) model.do() -Edge_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")] +Edge_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"), +] Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects) -Extrusion_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")] -Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection("EDGE", "PartSet/OY"), model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"), "offsetTo", model.selection(), "offsetFrom") +Extrusion_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"), +] +Extrusion_1 = model.addExtrusion( + Part_1_doc, + Extrusion_1_objects, + model.selection("EDGE", "PartSet/OY"), + model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"), + "offsetTo", + model.selection(), + "offsetFrom", +) from GeomAPI import GeomAPI_Shape @@ -68,14 +112,14 @@ model.testResultsAreas(Extrusion_1, [4877.030013, 1800, 4877.030013, 1916.515139 # change radius of cylinder and check failure ParamR.setValue(10) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" ParamR.setValue(30) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure, check the intersected boundaries are processed well -ParamR.setValue(40); +ParamR.setValue(40) model.do() model.testNbResults(Extrusion_1, 4) model.testNbSubResults(Extrusion_1, [0, 0, 0, 0]) @@ -83,12 +127,14 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [0, 0, 0, 0]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [1, 1, 1, 1]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [4, 4, 4, 4]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [8, 8, 8, 8]) -model.testResultsAreas(Extrusion_1, [4340.6015418, 1529.1502622, 4340.6015418, 1692.820323]) +model.testResultsAreas( + Extrusion_1, [4340.6015418, 1529.1502622, 4340.6015418, 1692.820323] +) # change offsetting "To" face and check failure ParamTo.setValue(-20) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure ParamTo.setValue(20) @@ -99,7 +145,9 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [0, 0, 0, 0]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [1, 1, 1, 1]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [4, 4, 4, 4]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [8, 8, 8, 8]) -model.testResultsAreas(Extrusion_1, [5399.2925211, 2039.2304845, 5399.2925212, 2131.37085]) +model.testResultsAreas( + Extrusion_1, [5399.2925211, 2039.2304845, 5399.2925212, 2131.37085] +) # offset "From" face ParamFrom.setValue(20) @@ -110,7 +158,9 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [0, 0, 0, 0]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [1, 1, 1, 1]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [4, 4, 4, 4]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [8, 8, 8, 8]) -model.testResultsAreas(Extrusion_1, [6399.2925211, 2439.2304845, 6399.2925212, 2531.37085]) +model.testResultsAreas( + Extrusion_1, [6399.2925211, 2439.2304845, 6399.2925212, 2531.37085] +) ParamFrom.setValue(-20) model.do() @@ -120,10 +170,12 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [0, 0, 0, 0]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [1, 1, 1, 1]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [4, 4, 4, 4]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [8, 8, 8, 8]) -model.testResultsAreas(Extrusion_1, [4399.2925211, 1639.2304845, 4399.2925212, 1731.37085]) +model.testResultsAreas( + Extrusion_1, [4399.2925211, 1639.2304845, 4399.2925212, 1731.37085] +) model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces15.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces15.py index 9b239e51c..78aed6219 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces15.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces15.py @@ -30,49 +30,108 @@ ParamSize = model.addParameter(Part_1_doc, "Size", "50") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "R") -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Sphere_1_1"), model.selection("FACE", "PartSet/XOZ")]) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Sphere_1_1"), model.selection("FACE", "PartSet/XOZ")], +) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), 10, False) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) SketchLine_1 = Sketch_1.addLine(50, -50, -50, -50) SketchLine_2 = Sketch_1.addLine(-50, -50, -50, 50) SketchLine_3 = Sketch_1.addLine(-50, 50, 50, 50) SketchLine_4 = Sketch_1.addLine(50, 50, 50, -50) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), "Size", True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), "Size", True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), "Size", True) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.result(), "Size", True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), "Size", True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), "Size", True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), "Size", True +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.result(), "Size", True +) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")]) +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.defaultPlane("XOZ")) SketchLine_5 = Sketch_2.addLine(20, -15, 20, 20) SketchLine_6 = Sketch_2.addLine(20, 20, -15, 20) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_5.result()) SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result()) SketchArc_1 = Sketch_2.addArc(0, 0, -15, 20, 20, -15, False) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_5.startPoint()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_5.result(), SketchLine_6.result()) -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchArc_1.center(), SketchLine_5.result(), 20, True) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchArc_1.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_5.result(), SketchLine_6.result() +) +SketchConstraintDistance_5 = Sketch_2.setDistance( + SketchArc_1.center(), SketchLine_5.result(), 20, True +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchArc_1.center()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchArc_1.center() +) SketchConstraintRadius_1 = Sketch_2.setRadius(SketchArc_1.results()[1], 25) model.do() -Edge_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_6"), model.selection("EDGE", "Sketch_2/SketchArc_1_2")] +Edge_1_objects = [ + model.selection("EDGE", "Sketch_2/SketchLine_5"), + model.selection("EDGE", "Sketch_2/SketchLine_6"), + model.selection("EDGE", "Sketch_2/SketchArc_1_2"), +] Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects) -Extrusion_1_objects = [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_1_3")] -Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection("EDGE", "PartSet/OY"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Sphere_1_1/Face_1"), "offsetTo", model.selection("FACE", "Face_1_1"), "offsetFrom") +Extrusion_1_objects = [ + model.selection("EDGE", "Edge_1_1"), + model.selection("EDGE", "Edge_1_2"), + model.selection("EDGE", "Edge_1_3"), +] +Extrusion_1 = model.addExtrusion( + Part_1_doc, + Extrusion_1_objects, + model.selection("EDGE", "PartSet/OY"), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Sphere_1_1/Face_1"), + "offsetTo", + model.selection("FACE", "Face_1_1"), + "offsetFrom", +) from GeomAPI import GeomAPI_Shape @@ -87,7 +146,7 @@ model.testResultsAreas(Extrusion_1, [1911.43203298, 1911.43203298, 4564.43663366 # change radius of sphere and check failure ParamR.setValue(10) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure, check the intersected boundaries are processed well ParamR.setValue(30) @@ -100,7 +159,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [4, 4, 4]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [8, 8, 8]) model.testResultsAreas(Extrusion_1, [1034.989222291, 1034.989222291, 2276.43702246]) -ParamR.setValue(40); +ParamR.setValue(40) model.do() model.testNbResults(Extrusion_1, 3) model.testNbSubResults(Extrusion_1, [0, 0, 0]) @@ -124,7 +183,7 @@ model.testResultsAreas(Extrusion_1, [1505.0174, 1505.0174, 3530.28837537636]) # change offsetting "To" face and check failure ParamTo.setValue(-20) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure ParamTo.setValue(20) @@ -162,4 +221,4 @@ model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces16.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces16.py index 237878e12..748d050d0 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces16.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces16.py @@ -31,66 +31,127 @@ ParamSize = model.addParameter(Part_1_doc, "Size", "50") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "R") -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Sphere_1_1"), model.selection("FACE", "PartSet/XOZ")]) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Sphere_1_1"), model.selection("FACE", "PartSet/XOZ")], +) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), 30, False) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) SketchLine_1 = Sketch_1.addLine(50, -50, -50, -50) SketchLine_2 = Sketch_1.addLine(-50, -50, -50, 50) SketchLine_3 = Sketch_1.addLine(-50, 50, 50, 50) SketchLine_4 = Sketch_1.addLine(50, 50, 50, -50) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), "Size", True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), "Size", True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), "Size", True) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.result(), "Size", True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), "Size", True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), "Size", True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), "Size", True +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.result(), "Size", True +) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")]) +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.defaultPlane("XOZ")) SketchLine_5 = Sketch_2.addLine(20, -40.3112887414928, 20, 20) SketchLine_6 = Sketch_2.addLine(20, 20, -40.31128874149281, 20.00000000000001) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_5.result()) SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result()) -SketchArc_1 = Sketch_2.addArc(0, 0, -40.31128874149281, 20.00000000000001, 20, -40.3112887414928, False) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_5.startPoint()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_5.result(), SketchLine_6.result()) -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchArc_1.center(), SketchLine_5.result(), 20, True) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchArc_1 = Sketch_2.addArc( + 0, 0, -40.31128874149281, 20.00000000000001, 20, -40.3112887414928, False +) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchArc_1.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_5.result(), SketchLine_6.result() +) +SketchConstraintDistance_5 = Sketch_2.setDistance( + SketchArc_1.center(), SketchLine_5.result(), 20, True +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchArc_1.center()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchArc_1.center() +) SketchConstraintRadius_1 = Sketch_2.setRadius(SketchArc_1.results()[1], 45) model.do() -Edge_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_6"), model.selection("EDGE", "Sketch_2/SketchArc_1_2")] +Edge_1_objects = [ + model.selection("EDGE", "Sketch_2/SketchLine_5"), + model.selection("EDGE", "Sketch_2/SketchLine_6"), + model.selection("EDGE", "Sketch_2/SketchArc_1_2"), +] Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects) -Extrusion_1_objects = [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_1_3")] -Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection("EDGE", "PartSet/OY"), model.selection("FACE", "Partition_1_1_1/Modified_Face&Sphere_1_1/Face_1"), "offsetTo", model.selection("FACE", "Face_1_1"), "offsetFrom") +Extrusion_1_objects = [ + model.selection("EDGE", "Edge_1_1"), + model.selection("EDGE", "Edge_1_2"), + model.selection("EDGE", "Edge_1_3"), +] +Extrusion_1 = model.addExtrusion( + Part_1_doc, + Extrusion_1_objects, + model.selection("EDGE", "PartSet/OY"), + model.selection("FACE", "Partition_1_1_1/Modified_Face&Sphere_1_1/Face_1"), + "offsetTo", + model.selection("FACE", "Face_1_1"), + "offsetFrom", +) # extrusion have to fail because of several results with shared topology -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # change radius of sphere and check failure ParamR.setValue(10) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" ParamR.setValue(45) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # change offsetting "To" face and check failure ParamTo.setValue(-20) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure ParamTo.setValue(20) @@ -117,7 +178,7 @@ model.testResultsAreas(Extrusion_1, [2915.069101129, 2915.069100598, 4138.273322 # check failure ParamFrom.setValue(-20) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure ParamFrom.setValue(-10) @@ -134,4 +195,4 @@ model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces17.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces17.py index 17e2e7fa5..d14ebb2d1 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces17.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces17.py @@ -30,18 +30,42 @@ ParamRCyl = model.addParameter(Part_1_doc, "rCyl", "30") ParamRCir = model.addParameter(Part_1_doc, "rCircle", "10") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") -Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "rSphere") -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "rCyl", 100) +Sphere_1 = model.addSphere( + Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "rSphere" +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "rCyl", + 100, +) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchCircle_1 = Sketch_1.addCircle(15, 20, 10) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "rCircle") -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 15) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 20) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 15 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 20 +) model.do() -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")]) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OY"), model.selection("FACE", "Sphere_1_1/Face_1"), "offsetTo", model.selection("FACE", "Cylinder_1_1/Face_1"), "offsetFrom") +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")] +) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OY"), + model.selection("FACE", "Sphere_1_1/Face_1"), + "offsetTo", + model.selection("FACE", "Cylinder_1_1/Face_1"), + "offsetFrom", +) from GeomAPI import GeomAPI_Shape @@ -78,10 +102,10 @@ model.testResultsAreas(Extrusion_1, [3658.7714]) # change radius of sketch circle and check failure ParamRCir.setValue(10) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure -ParamRSph.setValue(45); +ParamRSph.setValue(45) model.do() model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [2]) @@ -159,4 +183,4 @@ model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces18.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces18.py index d649bd0fc..3ba6d333b 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces18.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces18.py @@ -28,31 +28,80 @@ Part_1_doc = Part_1.document() ParamR = model.addParameter(Part_1_doc, "R", "50") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") -Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R", "R/5", "R") -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Cone_1_1"), model.selection("FACE", "PartSet/XOZ")]) +Cone_1 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "R", + "R/5", + "R", +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Cone_1_1"), model.selection("FACE", "PartSet/XOZ")], +) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), 20, False) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_1"), model.selection("EDGE", "PartSet/OZ"), 330) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Plane_1"), + model.selection("EDGE", "PartSet/OZ"), + 330, +) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(10, 8.819660112501044, 10, 30) SketchLine_2 = Sketch_1.addLine(10, 30, -11.18033988749895, 30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) -SketchArc_1 = Sketch_1.addArc(0, 20, -11.18033988749895, 30, 10, 8.819660112501044, False) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_1.result(), 10, True) +SketchArc_1 = Sketch_1.addArc( + 0, 20, -11.18033988749895, 30, 10, 8.819660112501044, False +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_1.result(), 10, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 15) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_3.result()) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchArc_1.center(), 20) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_3.result() +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Line(SketchLine_3).startPoint(), SketchArc_1.center(), 20 +) model.do() -Edge_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchArc_1_2")] +Edge_1_objects = [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + model.selection("EDGE", "Sketch_1/SketchArc_1_2"), +] Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects) -Extrusion_1_objects = [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_1_3")] -Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection("EDGE", "PartSet/OY"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Cone_1_1/Face_1"), "offsetTo", model.selection("FACE", "Plane_2"), "offsetFrom") +Extrusion_1_objects = [ + model.selection("EDGE", "Edge_1_1"), + model.selection("EDGE", "Edge_1_2"), + model.selection("EDGE", "Edge_1_3"), +] +Extrusion_1 = model.addExtrusion( + Part_1_doc, + Extrusion_1_objects, + model.selection("EDGE", "PartSet/OY"), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Cone_1_1/Face_1"), + "offsetTo", + model.selection("FACE", "Plane_2"), + "offsetFrom", +) from GeomAPI import GeomAPI_Shape @@ -67,7 +116,7 @@ model.testResultsAreas(Extrusion_1, [1309.42058662, 1016.82520496, 2589.5946928] # change radius of sphere and check failure ParamR.setValue(10) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure, check the intersected boundaries are processed well ParamR.setValue(40) @@ -83,7 +132,7 @@ model.testResultsAreas(Extrusion_1, [1081.93830116, 793.80218227, 2095.8021933]) # change offsetting "To" face and check failure ParamTo.setValue(-20) model.do() -assert(Extrusion_1.feature().error() != "") +assert Extrusion_1.feature().error() != "" # revert failure ParamTo.setValue(8) @@ -117,4 +166,4 @@ model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces19.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces19.py index effdaabd5..e65228f02 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces19.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces19.py @@ -28,30 +28,64 @@ Part_1_doc = Part_1.document() ParamR = model.addParameter(Part_1_doc, "R", "50") ParamFrom = model.addParameter(Part_1_doc, "offsetFrom", "0") ParamTo = model.addParameter(Part_1_doc, "offsetTo", "0") -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R", 100, 180) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "R", + 100, + 180, +) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(20, 40, -30, 40) SketchLine_2 = Sketch_1.addLine(-30, 40, -30, 20) SketchLine_3 = Sketch_1.addLine(-30, 20, 20, 20) SketchLine_4 = Sketch_1.addLine(20, 20, 20, 40) -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()) +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()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 50) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20 +) model.do() -Wire_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")] +Wire_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"), +] 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("EDGE", "PartSet/OY"), model.selection("FACE", "Cylinder_1_1/Face_1"), "offsetTo", model.selection(), "offsetFrom") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + model.selection("EDGE", "PartSet/OY"), + model.selection("FACE", "Cylinder_1_1/Face_1"), + "offsetTo", + model.selection(), + "offsetFrom", +) from GeomAPI import GeomAPI_Shape @@ -85,7 +119,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [20]) model.testResultsAreas(Extrusion_1, [2964.89877572]) # check the intersected boundaries are processed well -ParamR.setValue(40); +ParamR.setValue(40) model.do() model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [0]) @@ -141,4 +175,4 @@ model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ErrorMsg.py b/src/FeaturesPlugin/Test/TestExtrusion_ErrorMsg.py index cc808edf1..fec68883d 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ErrorMsg.py @@ -26,47 +26,107 @@ 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() != "") +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() != "") +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() != "") +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() != "") +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()) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), model.selection("EDGE", "Sketch_2/SketchArc_1_2"), 0, model.selection("EDGE", "Sketch_2/SketchArc_1_2"), 10) -assert(Extrusion_1.feature().error() != "") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + model.selection("EDGE", "Sketch_2/SketchArc_1_2"), + 0, + model.selection("EDGE", "Sketch_2/SketchArc_1_2"), + 10, +) +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(), model.selection("EDGE", "Sketch_2/SketchArc_1_2"), 0, model.selection("FACE", "PartSet/XOY"), 10) -assert(Extrusion_1.feature().error() != "") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + model.selection("EDGE", "Sketch_2/SketchArc_1_2"), + 0, + model.selection("FACE", "PartSet/XOY"), + 10, +) +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(), model.selection("EDGE", "Sketch_2/SketchArc_1_2"), 0, model.selection(), 10) -assert(Extrusion_1.feature().error() != "") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + model.selection("EDGE", "Sketch_2/SketchArc_1_2"), + 0, + model.selection(), + 10, +) +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(), model.selection(), 0, model.selection("EDGE", "Sketch_2/SketchArc_1_2"), 10) -assert(Extrusion_1.feature().error() != "") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + model.selection(), + 0, + model.selection("EDGE", "Sketch_2/SketchArc_1_2"), + 10, +) +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(), model.selection(), 0, model.selection("FACE", "PartSet/XOY"), 10) -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(), + model.selection(), + 0, + model.selection("FACE", "PartSet/XOY"), + 10, +) +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 index 710a64194..51060b2d1 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ZeroOffsetError.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ZeroOffsetError.py @@ -24,26 +24,62 @@ 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) +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() != "") +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) +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")]) +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) +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")]) +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() == "") +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() diff --git a/src/FeaturesPlugin/Test/TestFillet.py b/src/FeaturesPlugin/Test/TestFillet.py index a41e6041c..3d628569a 100644 --- a/src/FeaturesPlugin/Test/TestFillet.py +++ b/src/FeaturesPlugin/Test/TestFillet.py @@ -27,9 +27,9 @@ from GeomDataAPI import * __updated__ = "2017-11-30" -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() # Create a part for extrusion @@ -63,9 +63,9 @@ aCylinder.real("radius").setValue(5) aCylinder.real("height").setValue(10) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Test 1. Create fillet with fixed radius -#========================================================================= +# ========================================================================= aSession.startOperation() aFillet1 = aPart.addFeature("Fillet") aFillet1.string("creation_method").setValue("fixed_radius") @@ -73,21 +73,25 @@ anObjects = aFillet1.selectionList("main_objects") 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()) +assert aFillet1.error() == "", 'FAILED: Fillet reports error "{}"'.format( + aFillet1.error() +) -#========================================================================= +# ========================================================================= # Test 2. Change fillet type -#========================================================================= +# ========================================================================= aSession.startOperation() aFillet1.string("creation_method").setValue("variable_radius") aFillet1.real("radius1").setValue(5) aFillet1.real("radius2").setValue(1) aSession.finishOperation() -assert(aFillet1.error() == ""), "FAILED: Fillet reports error \"{}\"".format(aFillet1.error()) +assert aFillet1.error() == "", 'FAILED: Fillet reports error "{}"'.format( + aFillet1.error() +) -#========================================================================= +# ========================================================================= # Test 3. Check fillet reports error if selected entities from different solids -#========================================================================= +# ========================================================================= aSession.startOperation() aFillet2 = aPart.addFeature("Fillet") aFillet2.string("creation_method").setValue("fixed_radius") @@ -96,37 +100,40 @@ anObjects.append("Cylinder_1_1/Face_2", "face") anObjects.append("Box_1_1/Right", "face") aFillet2.real("radius1").setValue(2) aSession.finishOperation() -assert(aFillet2.error() != ""), "FAILED: Fillet does not report error" +assert aFillet2.error() != "", "FAILED: Fillet does not report error" -#========================================================================= +# ========================================================================= # Test 4. Fix the error -#========================================================================= +# ========================================================================= aSession.startOperation() anObjects.removeLast() aSession.finishOperation() -assert(aFillet2.error() == ""), "FAILED: Fillet reports error \"{}\"".format(aFillet1.error()) +assert aFillet2.error() == "", 'FAILED: Fillet reports error "{}"'.format( + aFillet1.error() +) -#========================================================================= +# ========================================================================= # Test 5. Check fillet reports error on smoothly connected edges -#========================================================================= +# ========================================================================= aSession.startOperation() aFillet3 = aPart.addFeature("Fillet") aFillet3.string("creation_method").setValue("fixed_radius") aFillet3.selectionList("main_objects").append("Cylinder_1_1/Modified_Face_1", "face") aFillet3.real("radius1").setValue(3) aSession.finishOperation() -assert(aFillet3.lastResult() is None), "FAILED: Fillet should not produce a result" +assert aFillet3.lastResult() is None, "FAILED: Fillet should not produce a result" -#========================================================================= +# ========================================================================= # Test 6. Remove last fillet feature -#========================================================================= +# ========================================================================= aSession.startOperation() aPart.removeFeature(aFillet3) aSession.finishOperation() -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestFillet1.py b/src/FeaturesPlugin/Test/TestFillet1.py index 2e4e4d427..ef39ff1f7 100644 --- a/src/FeaturesPlugin/Test/TestFillet1.py +++ b/src/FeaturesPlugin/Test/TestFillet1.py @@ -27,7 +27,7 @@ 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() == "") +assert Fillet_1.feature().error() == "" model.testNbResults(Fillet_1, 1) model.testNbSubResults(Fillet_1, [0]) @@ -41,9 +41,13 @@ 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) +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() != "") +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/TestFillet1D_ErrorMsg.py b/src/FeaturesPlugin/Test/TestFillet1D_ErrorMsg.py index 21728aeca..fcb2f7502 100644 --- a/src/FeaturesPlugin/Test/TestFillet1D_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestFillet1D_ErrorMsg.py @@ -30,15 +30,27 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) ### Create SketchLine -SketchLine_1 = Sketch_1.addLine(35.66344827586208, 18.52827586206897, -10.58758620689655, 18.52827586206897) +SketchLine_1 = Sketch_1.addLine( + 35.66344827586208, 18.52827586206897, -10.58758620689655, 18.52827586206897 +) Sketch_1.setHorizontal(SketchLine_1.result()) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() ### Create SketchArc -SketchArc_1 = Sketch_1.addArc(-10.58758620689655, 34.59034482758621, -10.58758620689655, 18.52827586206897, 0, 46.66896551724138, True) +SketchArc_1 = Sketch_1.addArc( + -10.58758620689655, + 34.59034482758621, + -10.58758620689655, + 18.52827586206897, + 0, + 46.66896551724138, + True, +) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_1.startPoint()) Sketch_1.setTangent(SketchLine_1.result(), SketchArc_1.results()[1]) Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint()) @@ -48,33 +60,43 @@ model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) ### Create SketchLine -SketchLine_3 = Sketch_2.addLine(46.66896551724138, 0, 49.59252615395944, 57.3324122669822) +SketchLine_3 = Sketch_2.addLine( + 46.66896551724138, 0, 49.59252615395944, 57.3324122669822 +) ### Create SketchProjection -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchArc_1_2_StartVertex"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchArc_1_2_StartVertex"), False +) SketchPoint_1 = SketchProjection_2.createdFeature() Sketch_2.setCoincident(SketchLine_3.startPoint(), SketchPoint_1.result()) model.do() ### Create Wire -Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_2/SketchLine_3")] +Wire_1_objects = [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchArc_1_2"), + model.selection("EDGE", "Sketch_2/SketchLine_3"), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) model.end() ### Check errors on 1D-fillet -vertices = ["Sketch_1/SketchLine_1_StartVertex", - "Sketch_2/SketchLine_3_EndVertex", - "[Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1]e[Wire_1_1/Modified_Edge&Sketch_1/SketchArc_1_2]e", - "[Wire_1_1/Modified_Edge&Sketch_1/SketchArc_1_2]e[Wire_1_1/Modified_Edge&Sketch_2/SketchLine_3]e"] +vertices = [ + "Sketch_1/SketchLine_1_StartVertex", + "Sketch_2/SketchLine_3_EndVertex", + "[Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1]e[Wire_1_1/Modified_Edge&Sketch_1/SketchArc_1_2]e", + "[Wire_1_1/Modified_Edge&Sketch_1/SketchArc_1_2]e[Wire_1_1/Modified_Edge&Sketch_2/SketchLine_3]e", +] for v in vertices: - model.begin() - Fillet1D = model.addFillet(Part_1_doc, [model.selection("VERTEX", v)], 1) - model.end() - assert(Fillet1D.feature().error() != "") + model.begin() + Fillet1D = model.addFillet(Part_1_doc, [model.selection("VERTEX", v)], 1) + model.end() + assert Fillet1D.feature().error() != "" ### Wire has no vertices applicable for 1D-fillet model.begin() Fillet1D = model.addFillet(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], 1) model.end() -assert(Fillet1D.feature().error() != "") +assert Fillet1D.feature().error() != "" diff --git a/src/FeaturesPlugin/Test/TestFillet1D_Vertices_1.py b/src/FeaturesPlugin/Test/TestFillet1D_Vertices_1.py index f5d6e249b..9012d421f 100644 --- a/src/FeaturesPlugin/Test/TestFillet1D_Vertices_1.py +++ b/src/FeaturesPlugin/Test/TestFillet1D_Vertices_1.py @@ -31,11 +31,19 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Wire -Wire_1_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]")] +Wire_1_objects = [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) ### Create Fillet1D -Fillet1D_1 = model.addFillet(Part_1_doc, [model.selection("VERTEX", "[Wire_1_1/Edge_1]e[Wire_1_1/Edge_2]e")], 2) +Fillet1D_1 = model.addFillet( + Part_1_doc, [model.selection("VERTEX", "[Wire_1_1/Edge_1]e[Wire_1_1/Edge_2]e")], 2 +) model.testNbResults(Fillet1D_1, 1) model.testNbSubResults(Fillet1D_1, [0]) @@ -46,7 +54,16 @@ model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Fillet1D_1, [0]) ### Create Fillet1D -Fillet1D_2 = model.addFillet(Part_1_doc, [model.selection("VERTEX", "[(Wire_1_1/Edge_4)(Wire_1_1/Edge_5)2_Fillet1D_1_1]e[Wire_1_1/Edge_4]e")], 2) +Fillet1D_2 = model.addFillet( + Part_1_doc, + [ + model.selection( + "VERTEX", + "[(Wire_1_1/Edge_4)(Wire_1_1/Edge_5)2_Fillet1D_1_1]e[Wire_1_1/Edge_4]e", + ) + ], + 2, +) model.testHaveNamingByType(Fillet1D_2, model, Part_1_doc, GeomAPI_Shape.VERTEX) model.testHaveNamingByType(Fillet1D_2, model, Part_1_doc, GeomAPI_Shape.EDGE) @@ -60,4 +77,4 @@ model.testNbSubShapes(Fillet1D_2, GeomAPI_Shape.EDGE, [7]) model.testNbSubShapes(Fillet1D_2, GeomAPI_Shape.VERTEX, [14]) model.testResultsVolumes(Fillet1D_2, [0]) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/TestFillet1D_Vertices_2.py b/src/FeaturesPlugin/Test/TestFillet1D_Vertices_2.py index dbbb9dacb..457dc4612 100644 --- a/src/FeaturesPlugin/Test/TestFillet1D_Vertices_2.py +++ b/src/FeaturesPlugin/Test/TestFillet1D_Vertices_2.py @@ -31,11 +31,22 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Wire -Wire_1_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]")] +Wire_1_objects = [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) ### Create Fillet1D -Fillet1D_1 = model.addFillet(Part_1_doc, [model.selection("VERTEX", "[Wire_1_1/Edge_4]e[Wire_1_1/Edge_6]e")], 2) +Fillet1D_1 = model.addFillet( + Part_1_doc, [model.selection("VERTEX", "[Wire_1_1/Edge_4]e[Wire_1_1/Edge_6]e")], 2 +) model.testNbResults(Fillet1D_1, 1) model.testNbSubResults(Fillet1D_1, [0]) @@ -46,7 +57,16 @@ model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.VERTEX, [18]) model.testResultsVolumes(Fillet1D_1, [0]) ### Create Fillet1D -Fillet1D_2 = model.addFillet(Part_1_doc, [model.selection("VERTEX", "[Fillet1D_1_1/ME:Fillet1D&Wire_1_1/Edge_1]e[Fillet1D_1_1/ME:Fillet1D&Wire_1_1/Edge_3]e")], 1) +Fillet1D_2 = model.addFillet( + Part_1_doc, + [ + model.selection( + "VERTEX", + "[Fillet1D_1_1/ME:Fillet1D&Wire_1_1/Edge_1]e[Fillet1D_1_1/ME:Fillet1D&Wire_1_1/Edge_3]e", + ) + ], + 1, +) model.testNbResults(Fillet1D_2, 1) model.testNbSubResults(Fillet1D_2, [0]) @@ -57,7 +77,16 @@ model.testNbSubShapes(Fillet1D_2, GeomAPI_Shape.VERTEX, [20]) model.testResultsVolumes(Fillet1D_2, [0]) ### Create Fillet1D -Fillet1D_3 = model.addFillet(Part_1_doc, [model.selection("VERTEX", "[Fillet1D_2_1/ME:Fillet1D&Wire_1_1/Edge_2]e[Fillet1D_2_1/ME:Fillet1D&Wire_1_1/Edge_4]e")], 5) +Fillet1D_3 = model.addFillet( + Part_1_doc, + [ + model.selection( + "VERTEX", + "[Fillet1D_2_1/ME:Fillet1D&Wire_1_1/Edge_2]e[Fillet1D_2_1/ME:Fillet1D&Wire_1_1/Edge_4]e", + ) + ], + 5, +) model.testHaveNamingByType(Fillet1D_3, model, Part_1_doc, GeomAPI_Shape.VERTEX) model.testHaveNamingByType(Fillet1D_3, model, Part_1_doc, GeomAPI_Shape.EDGE) @@ -71,4 +100,4 @@ model.testNbSubShapes(Fillet1D_3, GeomAPI_Shape.EDGE, [11]) model.testNbSubShapes(Fillet1D_3, GeomAPI_Shape.VERTEX, [22]) model.testResultsVolumes(Fillet1D_3, [0]) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/TestFillet1D_Vertices_3.py b/src/FeaturesPlugin/Test/TestFillet1D_Vertices_3.py index ed4b5c4a4..b853ee5b1 100644 --- a/src/FeaturesPlugin/Test/TestFillet1D_Vertices_3.py +++ b/src/FeaturesPlugin/Test/TestFillet1D_Vertices_3.py @@ -28,14 +28,29 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() ### Create Cylinder -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10, 45) -Wire_1_objects = [model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), model.selection("EDGE", "[Cylinder_1_1/Face_2][Cylinder_1_1/Face_5]"), model.selection("EDGE", "[Cylinder_1_1/Face_4][Cylinder_1_1/Face_5]"), model.selection("EDGE", "[Cylinder_1_1/Face_3][Cylinder_1_1/Face_4]"), model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]")] +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, + 45, +) +Wire_1_objects = [ + model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), + model.selection("EDGE", "[Cylinder_1_1/Face_2][Cylinder_1_1/Face_5]"), + model.selection("EDGE", "[Cylinder_1_1/Face_4][Cylinder_1_1/Face_5]"), + model.selection("EDGE", "[Cylinder_1_1/Face_3][Cylinder_1_1/Face_4]"), + model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]"), +] ### Create Wire Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) ### Create Fillet1D -Fillet1D_1 = model.addFillet(Part_1_doc, [model.selection("VERTEX", "[Wire_1_1/Edge_1]e[Wire_1_1/Edge_2]e")], 1) +Fillet1D_1 = model.addFillet( + Part_1_doc, [model.selection("VERTEX", "[Wire_1_1/Edge_1]e[Wire_1_1/Edge_2]e")], 1 +) model.testNbResults(Fillet1D_1, 1) model.testNbSubResults(Fillet1D_1, [0]) @@ -46,7 +61,16 @@ model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Fillet1D_1, [0]) ### Create Fillet1D -Fillet1D_2 = model.addFillet(Part_1_doc, [model.selection("VERTEX", "[Fillet1D_1_1/ME:Fillet1D&Wire_1_1/Edge_4]e[Fillet1D_1_1/ME:Fillet1D&Wire_1_1/Edge_3]e")], 3) +Fillet1D_2 = model.addFillet( + Part_1_doc, + [ + model.selection( + "VERTEX", + "[Fillet1D_1_1/ME:Fillet1D&Wire_1_1/Edge_4]e[Fillet1D_1_1/ME:Fillet1D&Wire_1_1/Edge_3]e", + ) + ], + 3, +) model.testHaveNamingByType(Fillet1D_2, model, Part_1_doc, GeomAPI_Shape.VERTEX) model.testHaveNamingByType(Fillet1D_2, model, Part_1_doc, GeomAPI_Shape.EDGE) @@ -60,4 +84,4 @@ model.testNbSubShapes(Fillet1D_2, GeomAPI_Shape.EDGE, [7]) model.testNbSubShapes(Fillet1D_2, GeomAPI_Shape.VERTEX, [14]) model.testResultsVolumes(Fillet1D_2, [0]) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/TestFillet1D_Vertices_4.py b/src/FeaturesPlugin/Test/TestFillet1D_Vertices_4.py index 61ce97310..ee7b9cc5f 100644 --- a/src/FeaturesPlugin/Test/TestFillet1D_Vertices_4.py +++ b/src/FeaturesPlugin/Test/TestFillet1D_Vertices_4.py @@ -31,26 +31,51 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) ### Create SketchLine -SketchLine_1 = Sketch_1.addLine(-21.09850585253612, 7.838733928946021, 28.18352301808598, -36.47460859551143) +SketchLine_1 = Sketch_1.addLine( + -21.09850585253612, 7.838733928946021, 28.18352301808598, -36.47460859551143 +) ### Create SketchLine -SketchLine_2 = Sketch_1.addLine(28.18352301808598, -36.47460859551143, -24.86780397022334, -36.47460859551143) +SketchLine_2 = Sketch_1.addLine( + 28.18352301808598, -36.47460859551143, -24.86780397022334, -36.47460859551143 +) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) Sketch_1.setHorizontal(SketchLine_2.result()) ### Create SketchArc -SketchArc_1 = Sketch_1.addArc(-24.86780397022334, -14.15762886307242, -24.86780397022334, -36.47460859551143, -21.09850585253612, 7.838733928946021, True) +SketchArc_1 = Sketch_1.addArc( + -24.86780397022334, + -14.15762886307242, + -24.86780397022334, + -36.47460859551143, + -21.09850585253612, + 7.838733928946021, + True, +) Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.startPoint()) Sketch_1.setTangent(SketchLine_2.result(), SketchArc_1.results()[1]) Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) model.do() -Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchArc_1_2")] +Wire_1_objects = [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + model.selection("EDGE", "Sketch_1/SketchArc_1_2"), +] ### Create Wire Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) ### Create Fillet1D -Fillet1D_1 = model.addFillet(Part_1_doc, [model.selection("VERTEX", "[Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1]e[Wire_1_1/Modified_Edge&Sketch_1/SketchLine_2]e")], 2) +Fillet1D_1 = model.addFillet( + Part_1_doc, + [ + model.selection( + "VERTEX", + "[Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1]e[Wire_1_1/Modified_Edge&Sketch_1/SketchLine_2]e", + ) + ], + 2, +) model.testNbResults(Fillet1D_1, 1) model.testNbSubResults(Fillet1D_1, [0]) @@ -61,7 +86,16 @@ model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.VERTEX, [8]) model.testResultsVolumes(Fillet1D_1, [0]) ### Create Fillet1D -Fillet1D_2 = model.addFillet(Part_1_doc, [model.selection("VERTEX", "[Fillet1D_1_1/ME:Fillet1D&Sketch_1/SketchLine_1]e[_weak_name_1_Fillet1D_1_1]e")], 20) +Fillet1D_2 = model.addFillet( + Part_1_doc, + [ + model.selection( + "VERTEX", + "[Fillet1D_1_1/ME:Fillet1D&Sketch_1/SketchLine_1]e[_weak_name_1_Fillet1D_1_1]e", + ) + ], + 20, +) model.testHaveNamingByType(Fillet1D_2, model, Part_1_doc, GeomAPI_Shape.VERTEX) model.testHaveNamingByType(Fillet1D_2, model, Part_1_doc, GeomAPI_Shape.EDGE) @@ -75,4 +109,4 @@ model.testNbSubShapes(Fillet1D_2, GeomAPI_Shape.EDGE, [5]) model.testNbSubShapes(Fillet1D_2, GeomAPI_Shape.VERTEX, [10]) model.testResultsVolumes(Fillet1D_2, [0]) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/TestFillet1D_Vertices_5.py b/src/FeaturesPlugin/Test/TestFillet1D_Vertices_5.py index 486c51b0c..ef785a66e 100644 --- a/src/FeaturesPlugin/Test/TestFillet1D_Vertices_5.py +++ b/src/FeaturesPlugin/Test/TestFillet1D_Vertices_5.py @@ -31,11 +31,24 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Wire -Wire_1_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]")] +Wire_1_objects = [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) ### Create Fillet1D -Fillet1D_1 = model.addFillet(Part_1_doc, [model.selection("VERTEX", "[Wire_1_1/Edge_2]e[Wire_1_1/Edge_3]e"), model.selection("VERTEX", "[Wire_1_1/Edge_3]e[Wire_1_1/Edge_4]e")], 2) +Fillet1D_1 = model.addFillet( + Part_1_doc, + [ + model.selection("VERTEX", "[Wire_1_1/Edge_2]e[Wire_1_1/Edge_3]e"), + model.selection("VERTEX", "[Wire_1_1/Edge_3]e[Wire_1_1/Edge_4]e"), + ], + 2, +) model.testHaveNamingByType(Fillet1D_1, model, Part_1_doc, GeomAPI_Shape.VERTEX) model.testHaveNamingByType(Fillet1D_1, model, Part_1_doc, GeomAPI_Shape.EDGE) @@ -49,4 +62,4 @@ model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.EDGE, [7]) model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.VERTEX, [14]) model.testResultsVolumes(Fillet1D_1, [0]) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/TestFillet1D_Vertices_6.py b/src/FeaturesPlugin/Test/TestFillet1D_Vertices_6.py index 2adb70cfb..11f13667d 100644 --- a/src/FeaturesPlugin/Test/TestFillet1D_Vertices_6.py +++ b/src/FeaturesPlugin/Test/TestFillet1D_Vertices_6.py @@ -31,11 +31,28 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Wire -Wire_1_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]")] +Wire_1_objects = [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) ### Create Fillet1D -Fillet1D_1 = model.addFillet(Part_1_doc, [model.selection("VERTEX", "[Wire_1_1/Edge_4]e[Wire_1_1/Edge_6]e"), model.selection("VERTEX", "[Wire_1_1/Edge_2]e[Wire_1_1/Edge_4]e"), model.selection("VERTEX", "[Wire_1_1/Edge_1]e[Wire_1_1/Edge_3]e")], 2) +Fillet1D_1 = model.addFillet( + Part_1_doc, + [ + model.selection("VERTEX", "[Wire_1_1/Edge_4]e[Wire_1_1/Edge_6]e"), + model.selection("VERTEX", "[Wire_1_1/Edge_2]e[Wire_1_1/Edge_4]e"), + model.selection("VERTEX", "[Wire_1_1/Edge_1]e[Wire_1_1/Edge_3]e"), + ], + 2, +) model.testHaveNamingByType(Fillet1D_1, model, Part_1_doc, GeomAPI_Shape.VERTEX) model.testHaveNamingByType(Fillet1D_1, model, Part_1_doc, GeomAPI_Shape.EDGE) @@ -49,4 +66,4 @@ model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.EDGE, [11]) model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.VERTEX, [22]) model.testResultsVolumes(Fillet1D_1, [0]) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/TestFillet1D_Vertices_7.py b/src/FeaturesPlugin/Test/TestFillet1D_Vertices_7.py index f5aed6bec..c9097d1d9 100644 --- a/src/FeaturesPlugin/Test/TestFillet1D_Vertices_7.py +++ b/src/FeaturesPlugin/Test/TestFillet1D_Vertices_7.py @@ -28,14 +28,34 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() ### Create Cylinder -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10, 45) -Wire_1_objects = [model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), model.selection("EDGE", "[Cylinder_1_1/Face_2][Cylinder_1_1/Face_5]"), model.selection("EDGE", "[Cylinder_1_1/Face_4][Cylinder_1_1/Face_5]"), model.selection("EDGE", "[Cylinder_1_1/Face_3][Cylinder_1_1/Face_4]"), model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]")] +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, + 45, +) +Wire_1_objects = [ + model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), + model.selection("EDGE", "[Cylinder_1_1/Face_2][Cylinder_1_1/Face_5]"), + model.selection("EDGE", "[Cylinder_1_1/Face_4][Cylinder_1_1/Face_5]"), + model.selection("EDGE", "[Cylinder_1_1/Face_3][Cylinder_1_1/Face_4]"), + model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]"), +] ### Create Wire Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) ### Create Fillet1D -Fillet1D_1 = model.addFillet(Part_1_doc, [model.selection("VERTEX", "[Wire_1_1/Edge_1]e[Wire_1_1/Edge_2]e"), model.selection("VERTEX", "[Wire_1_1/Edge_3]e[Wire_1_1/Edge_4]e")], 2) +Fillet1D_1 = model.addFillet( + Part_1_doc, + [ + model.selection("VERTEX", "[Wire_1_1/Edge_1]e[Wire_1_1/Edge_2]e"), + model.selection("VERTEX", "[Wire_1_1/Edge_3]e[Wire_1_1/Edge_4]e"), + ], + 2, +) model.testHaveNamingByType(Fillet1D_1, model, Part_1_doc, GeomAPI_Shape.VERTEX) model.testHaveNamingByType(Fillet1D_1, model, Part_1_doc, GeomAPI_Shape.EDGE) @@ -49,4 +69,4 @@ model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.EDGE, [7]) model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.VERTEX, [14]) model.testResultsVolumes(Fillet1D_1, [0]) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/TestFillet1D_Vertices_8.py b/src/FeaturesPlugin/Test/TestFillet1D_Vertices_8.py index ea8badf30..7bd39f89f 100644 --- a/src/FeaturesPlugin/Test/TestFillet1D_Vertices_8.py +++ b/src/FeaturesPlugin/Test/TestFillet1D_Vertices_8.py @@ -31,26 +31,55 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) ### Create SketchLine -SketchLine_1 = Sketch_1.addLine(-21.09850585253612, 7.838733928946021, 28.18352301808598, -36.47460859551143) +SketchLine_1 = Sketch_1.addLine( + -21.09850585253612, 7.838733928946021, 28.18352301808598, -36.47460859551143 +) ### Create SketchLine -SketchLine_2 = Sketch_1.addLine(28.18352301808598, -36.47460859551143, -24.86780397022334, -36.47460859551143) +SketchLine_2 = Sketch_1.addLine( + 28.18352301808598, -36.47460859551143, -24.86780397022334, -36.47460859551143 +) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) Sketch_1.setHorizontal(SketchLine_2.result()) ### Create SketchArc -SketchArc_1 = Sketch_1.addArc(-24.86780397022334, -14.15762886307242, -24.86780397022334, -36.47460859551143, -21.09850585253612, 7.838733928946021, True) +SketchArc_1 = Sketch_1.addArc( + -24.86780397022334, + -14.15762886307242, + -24.86780397022334, + -36.47460859551143, + -21.09850585253612, + 7.838733928946021, + True, +) Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.startPoint()) Sketch_1.setTangent(SketchLine_2.result(), SketchArc_1.results()[1]) Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) model.do() -Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchArc_1_2")] +Wire_1_objects = [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + model.selection("EDGE", "Sketch_1/SketchArc_1_2"), +] ### Create Wire Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) ### Create Fillet1D -Fillet1D_1 = model.addFillet(Part_1_doc, [model.selection("VERTEX", "[Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1]e[Wire_1_1/Modified_Edge&Sketch_1/SketchLine_2]e"), model.selection("VERTEX", "[Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1]e[Wire_1_1/Modified_Edge&Sketch_1/SketchArc_1_2]e")], 15) +Fillet1D_1 = model.addFillet( + Part_1_doc, + [ + model.selection( + "VERTEX", + "[Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1]e[Wire_1_1/Modified_Edge&Sketch_1/SketchLine_2]e", + ), + model.selection( + "VERTEX", + "[Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1]e[Wire_1_1/Modified_Edge&Sketch_1/SketchArc_1_2]e", + ), + ], + 15, +) model.testHaveNamingByType(Fillet1D_1, model, Part_1_doc, GeomAPI_Shape.VERTEX) model.testHaveNamingByType(Fillet1D_1, model, Part_1_doc, GeomAPI_Shape.EDGE) @@ -64,4 +93,4 @@ model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.EDGE, [5]) model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.VERTEX, [10]) model.testResultsVolumes(Fillet1D_1, [0]) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/TestFillet1D_Vertices_9.py b/src/FeaturesPlugin/Test/TestFillet1D_Vertices_9.py index 7dd54bf2f..a437c673c 100644 --- a/src/FeaturesPlugin/Test/TestFillet1D_Vertices_9.py +++ b/src/FeaturesPlugin/Test/TestFillet1D_Vertices_9.py @@ -29,7 +29,11 @@ Part_1_doc = Part_1.document() ### Create Box Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Wire_1_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")] +Wire_1_objects = [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), +] ### Create Wire Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) @@ -38,11 +42,31 @@ Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) Recover_1 = model.addRecover(Part_1_doc, Wire_1, [Box_1.result()]) ### Create Wire -Wire_2_objects = [model.selection("EDGE", "[Recover_1_1/Modified_Face&Box_1_1/Right][Recover_1_1/Modified_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[Recover_1_1/Modified_Face&Box_1_1/Back][Recover_1_1/Modified_Face&Box_1_1/Right]"), model.selection("EDGE", "[Recover_1_1/Modified_Face&Box_1_1/Back][Recover_1_1/Modified_Face&Box_1_1/Top]")] +Wire_2_objects = [ + model.selection( + "EDGE", + "[Recover_1_1/Modified_Face&Box_1_1/Right][Recover_1_1/Modified_Face&Box_1_1/Bottom]", + ), + model.selection( + "EDGE", + "[Recover_1_1/Modified_Face&Box_1_1/Back][Recover_1_1/Modified_Face&Box_1_1/Right]", + ), + model.selection( + "EDGE", + "[Recover_1_1/Modified_Face&Box_1_1/Back][Recover_1_1/Modified_Face&Box_1_1/Top]", + ), +] Wire_2 = model.addWire(Part_1_doc, Wire_2_objects, False) ### Create Fillet1D -Fillet1D_1 = model.addFillet(Part_1_doc, [model.selection("VERTEX", "[Wire_1_1/Edge_1]e[Wire_1_1/Edge_2]e"), model.selection("VERTEX", "[Wire_2_1/Edge_2]e[Wire_2_1/Edge_3]e")], 2) +Fillet1D_1 = model.addFillet( + Part_1_doc, + [ + model.selection("VERTEX", "[Wire_1_1/Edge_1]e[Wire_1_1/Edge_2]e"), + model.selection("VERTEX", "[Wire_2_1/Edge_2]e[Wire_2_1/Edge_3]e"), + ], + 2, +) model.testNbResults(Fillet1D_1, 2) model.testNbSubResults(Fillet1D_1, [0, 0]) @@ -53,7 +77,20 @@ model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.VERTEX, [8, 8]) model.testResultsVolumes(Fillet1D_1, [0, 0]) ### Create Fillet1D -Fillet1D_2 = model.addFillet(Part_1_doc, [model.selection("VERTEX", "[Fillet1D_1_2/ME:Fillet1D&Wire_2_1/Edge_1]e[Fillet1D_1_2/ME:Fillet1D&Wire_2_1/Edge_2]e"), model.selection("VERTEX", "[Fillet1D_1_1/ME:Fillet1D&Wire_1_1/Edge_2]e[Fillet1D_1_1/ME:Fillet1D&Wire_1_1/Edge_3]e")], 5) +Fillet1D_2 = model.addFillet( + Part_1_doc, + [ + model.selection( + "VERTEX", + "[Fillet1D_1_2/ME:Fillet1D&Wire_2_1/Edge_1]e[Fillet1D_1_2/ME:Fillet1D&Wire_2_1/Edge_2]e", + ), + model.selection( + "VERTEX", + "[Fillet1D_1_1/ME:Fillet1D&Wire_1_1/Edge_2]e[Fillet1D_1_1/ME:Fillet1D&Wire_1_1/Edge_3]e", + ), + ], + 5, +) model.testHaveNamingByType(Fillet1D_2, model, Part_1_doc, GeomAPI_Shape.VERTEX) model.testHaveNamingByType(Fillet1D_2, model, Part_1_doc, GeomAPI_Shape.EDGE) @@ -67,4 +104,4 @@ model.testNbSubShapes(Fillet1D_2, GeomAPI_Shape.EDGE, [5, 5]) model.testNbSubShapes(Fillet1D_2, GeomAPI_Shape.VERTEX, [10, 10]) model.testResultsVolumes(Fillet1D_2, [0, 0]) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/TestFillet1D_Wire_1.py b/src/FeaturesPlugin/Test/TestFillet1D_Wire_1.py index 17b807a34..ac90f4b83 100644 --- a/src/FeaturesPlugin/Test/TestFillet1D_Wire_1.py +++ b/src/FeaturesPlugin/Test/TestFillet1D_Wire_1.py @@ -31,7 +31,13 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Wire -Wire_1_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]")] +Wire_1_objects = [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) ### Create Fillet1D @@ -49,4 +55,4 @@ model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.EDGE, [9]) model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.VERTEX, [18]) model.testResultsVolumes(Fillet1D_1, [0]) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/TestFillet1D_Wire_2.py b/src/FeaturesPlugin/Test/TestFillet1D_Wire_2.py index 3c0f1f12f..949822a90 100644 --- a/src/FeaturesPlugin/Test/TestFillet1D_Wire_2.py +++ b/src/FeaturesPlugin/Test/TestFillet1D_Wire_2.py @@ -31,7 +31,16 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Wire -Wire_1_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]")] +Wire_1_objects = [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) ### Create Fillet1D @@ -49,4 +58,4 @@ model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.EDGE, [16]) model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.VERTEX, [32]) model.testResultsVolumes(Fillet1D_1, [0]) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/TestFillet1D_Wire_3.py b/src/FeaturesPlugin/Test/TestFillet1D_Wire_3.py index 2cf0583e8..592ca4cc7 100644 --- a/src/FeaturesPlugin/Test/TestFillet1D_Wire_3.py +++ b/src/FeaturesPlugin/Test/TestFillet1D_Wire_3.py @@ -28,8 +28,21 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() ### Create Cylinder -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10, 45) -Wire_1_objects = [model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), model.selection("EDGE", "[Cylinder_1_1/Face_2][Cylinder_1_1/Face_5]"), model.selection("EDGE", "[Cylinder_1_1/Face_4][Cylinder_1_1/Face_5]"), model.selection("EDGE", "[Cylinder_1_1/Face_3][Cylinder_1_1/Face_4]"), model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]")] +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, + 45, +) +Wire_1_objects = [ + model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), + model.selection("EDGE", "[Cylinder_1_1/Face_2][Cylinder_1_1/Face_5]"), + model.selection("EDGE", "[Cylinder_1_1/Face_4][Cylinder_1_1/Face_5]"), + model.selection("EDGE", "[Cylinder_1_1/Face_3][Cylinder_1_1/Face_4]"), + model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]"), +] ### Create Wire Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) @@ -49,4 +62,4 @@ model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.EDGE, [9]) model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.VERTEX, [18]) model.testResultsVolumes(Fillet1D_1, [0]) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/TestFillet1D_Wire_4.py b/src/FeaturesPlugin/Test/TestFillet1D_Wire_4.py index 7bbcdade0..751e694ee 100644 --- a/src/FeaturesPlugin/Test/TestFillet1D_Wire_4.py +++ b/src/FeaturesPlugin/Test/TestFillet1D_Wire_4.py @@ -31,20 +31,36 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) ### Create SketchLine -SketchLine_1 = Sketch_1.addLine(-21.09850585253612, 7.838733928946021, 28.18352301808598, -36.47460859551143) +SketchLine_1 = Sketch_1.addLine( + -21.09850585253612, 7.838733928946021, 28.18352301808598, -36.47460859551143 +) ### Create SketchLine -SketchLine_2 = Sketch_1.addLine(28.18352301808598, -36.47460859551143, -24.86780397022334, -36.47460859551143) +SketchLine_2 = Sketch_1.addLine( + 28.18352301808598, -36.47460859551143, -24.86780397022334, -36.47460859551143 +) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) Sketch_1.setHorizontal(SketchLine_2.result()) ### Create SketchArc -SketchArc_1 = Sketch_1.addArc(-24.86780397022334, -14.15762886307242, -24.86780397022334, -36.47460859551143, -21.09850585253612, 7.838733928946021, True) +SketchArc_1 = Sketch_1.addArc( + -24.86780397022334, + -14.15762886307242, + -24.86780397022334, + -36.47460859551143, + -21.09850585253612, + 7.838733928946021, + True, +) Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.startPoint()) Sketch_1.setTangent(SketchLine_2.result(), SketchArc_1.results()[1]) Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) model.do() -Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchArc_1_2")] +Wire_1_objects = [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + model.selection("EDGE", "Sketch_1/SketchArc_1_2"), +] ### Create Wire Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) @@ -64,4 +80,4 @@ model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.EDGE, [5]) model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.VERTEX, [10]) model.testResultsVolumes(Fillet1D_1, [0]) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/TestFillet1D_Wire_5.py b/src/FeaturesPlugin/Test/TestFillet1D_Wire_5.py index aff6f545c..b1bf0d8de 100644 --- a/src/FeaturesPlugin/Test/TestFillet1D_Wire_5.py +++ b/src/FeaturesPlugin/Test/TestFillet1D_Wire_5.py @@ -29,7 +29,11 @@ Part_1_doc = Part_1.document() ### Create Box Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Wire_1_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")] +Wire_1_objects = [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), +] ### Create Wire Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) @@ -38,11 +42,28 @@ Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) Recover_1 = model.addRecover(Part_1_doc, Wire_1, [Box_1.result()]) ### Create Wire -Wire_2_objects = [model.selection("EDGE", "[Recover_1_1/Modified_Face&Box_1_1/Right][Recover_1_1/Modified_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[Recover_1_1/Modified_Face&Box_1_1/Back][Recover_1_1/Modified_Face&Box_1_1/Right]"), model.selection("EDGE", "[Recover_1_1/Modified_Face&Box_1_1/Back][Recover_1_1/Modified_Face&Box_1_1/Top]")] +Wire_2_objects = [ + model.selection( + "EDGE", + "[Recover_1_1/Modified_Face&Box_1_1/Right][Recover_1_1/Modified_Face&Box_1_1/Bottom]", + ), + model.selection( + "EDGE", + "[Recover_1_1/Modified_Face&Box_1_1/Back][Recover_1_1/Modified_Face&Box_1_1/Right]", + ), + model.selection( + "EDGE", + "[Recover_1_1/Modified_Face&Box_1_1/Back][Recover_1_1/Modified_Face&Box_1_1/Top]", + ), +] Wire_2 = model.addWire(Part_1_doc, Wire_2_objects, False) ### Create Fillet1D -Fillet1D_1 = model.addFillet(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")], 2) +Fillet1D_1 = model.addFillet( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")], + 2, +) model.testHaveNamingByType(Fillet1D_1, model, Part_1_doc, GeomAPI_Shape.VERTEX) model.testHaveNamingByType(Fillet1D_1, model, Part_1_doc, GeomAPI_Shape.EDGE) @@ -56,4 +77,4 @@ model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.EDGE, [5, 5]) model.testNbSubShapes(Fillet1D_1, GeomAPI_Shape.VERTEX, [10, 10]) model.testResultsVolumes(Fillet1D_1, [0, 0]) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/TestFillet_ErrorMsg.py b/src/FeaturesPlugin/Test/TestFillet_ErrorMsg.py index 7be6375f5..4aea8d41d 100644 --- a/src/FeaturesPlugin/Test/TestFillet_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestFillet_ErrorMsg.py @@ -29,23 +29,42 @@ 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()) +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) +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() != "") +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() != "") +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() diff --git a/src/FeaturesPlugin/Test/TestFillet_History.py b/src/FeaturesPlugin/Test/TestFillet_History.py index 60bf71355..cd8e1c545 100644 --- a/src/FeaturesPlugin/Test/TestFillet_History.py +++ b/src/FeaturesPlugin/Test/TestFillet_History.py @@ -30,32 +30,102 @@ 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(23.0955987576144, 26.85924638608351, -23.50862068965518, 26.85924638608351) -SketchLine_2 = Sketch_1.addLine(-23.50862068965518, 26.85924638608351, -23.50862068965518, -11.11713209726581) -SketchLine_3 = Sketch_1.addLine(-23.50862068965518, -11.11713209726581, 23.0955987576144, -11.11713209726581) -SketchLine_4 = Sketch_1.addLine(23.0955987576144, -11.11713209726581, 23.0955987576144, 26.85924638608351) -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_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_1 = Sketch_1.addLine( + 23.0955987576144, 26.85924638608351, -23.50862068965518, 26.85924638608351 +) +SketchLine_2 = Sketch_1.addLine( + -23.50862068965518, 26.85924638608351, -23.50862068965518, -11.11713209726581 +) +SketchLine_3 = Sketch_1.addLine( + -23.50862068965518, -11.11713209726581, 23.0955987576144, -11.11713209726581 +) +SketchLine_4 = Sketch_1.addLine( + 23.0955987576144, -11.11713209726581, 23.0955987576144, 26.85924638608351 +) +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_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_4") 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(2.024890803123894, -11.11713209726581, 23.0955987576144, 26.85924638608351) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint()) +SketchLine_5 = Sketch_1.addLine( + 2.024890803123894, -11.11713209726581, 23.0955987576144, 26.85924638608351 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.endPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_6") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_3.result() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_5") -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7") model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_5f")], model.selection(), 10, 0) -Group_1_objects = [model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "Extrusion_1_1_2/To_Face"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5r" + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_5f", + ), + ], + model.selection(), + 10, + 0, +) +Group_1_objects = [ + model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2"), + model.selection("FACE", "Extrusion_1_1_2/To_Face"), + model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3"), +] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) -Group_2_objects = [model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1_2/To_Face]")] +Group_2_objects = [ + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_2/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1_2/To_Face]", + ), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Fillet_1_objects = [model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_2/From_Face]")] +Fillet_1_objects = [ + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_2/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_2/From_Face]", + ), +] Fillet_1 = model.addFillet(Part_1_doc, Fillet_1_objects, 2) model.do() # move groups after the Fillet @@ -66,15 +136,15 @@ model.end() # check groups are correct aFactory = ModelAPI_Session.get().validators() selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 3) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 3 +assert aFactory.validate(Group_1.feature()) for i in range(3): - assert(Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE) + assert Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 2) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 2 +assert aFactory.validate(Group_2.feature()) for i in range(2): - assert(Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.EDGE) + assert Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.EDGE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_1.py b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_1.py index 211a7981b..5f2cf2e4c 100644 --- a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_1.py +++ b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_1.py @@ -27,83 +27,215 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 RADIUS = 2 model.begin() Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], RADIUS) model.end() -assert(Fillet_1.feature().error() != "") +assert Fillet_1.feature().error() != "" model.undo() model.begin() -Fillet_2 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1")], RADIUS) +Fillet_2 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1")], + RADIUS, +) model.end() -assert(Fillet_2.feature().error() != "") +assert Fillet_2.feature().error() != "" model.undo() model.begin() -Fillet_3 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_3")], RADIUS) +Fillet_3 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_3")], + RADIUS, +) model.end() -assert(Fillet_3.feature().error() != "") +assert Fillet_3.feature().error() != "" model.undo() model.begin() -Fillet_4 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Shell_1_1/Modified_Edge&Sketch_1/SketchLine_10")], RADIUS) +Fillet_4 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Shell_1_1/Modified_Edge&Sketch_1/SketchLine_10")], + RADIUS, +) model.end() -assert(Fillet_4.feature().error() != "") +assert Fillet_4.feature().error() != "" model.undo() model.begin() -Fillet_5 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Translation_1_1/MF:Translated&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Top]"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Right")], RADIUS) +Fillet_5 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Top]", + ), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Right"), + ], + RADIUS, +) model.testNbResults(Fillet_5, 1) model.testNbSubResults(Fillet_5, [0]) model.testNbSubShapes(Fillet_5, GeomAPI_Shape.SOLID, [1]) @@ -113,9 +245,18 @@ model.testNbSubShapes(Fillet_5, GeomAPI_Shape.VERTEX, [98]) model.testResultsVolumes(Fillet_5, [960.71975512471]) refPoint = GeomAPI_Pnt(54.962243976, 4.8550769, 4.9622439887) midPoint = Fillet_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Fillet_6 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Top][Box_2_1/Front]"), model.selection("FACE", "Box_2_1/Right")], RADIUS) +Fillet_6 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Top][Box_2_1/Front]" + ), + model.selection("FACE", "Box_2_1/Right"), + ], + RADIUS, +) model.testNbResults(Fillet_6, 1) model.testNbSubResults(Fillet_6, [3]) model.testNbSubShapes(Fillet_6, GeomAPI_Shape.SOLID, [3]) @@ -125,9 +266,19 @@ model.testNbSubShapes(Fillet_6, GeomAPI_Shape.VERTEX, [182]) model.testResultsVolumes(Fillet_6, [1549.768377728]) refPoint = GeomAPI_Pnt(2.5, 2.5, 5) midPoint = Fillet_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Fillet_7 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[AngularCopy_1_1_1/MF:Rotated&Box_3_1/Back][AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top]"), model.selection("FACE", "AngularCopy_1_1_2/MF:Rotated&Box_3_1/Left")], RADIUS) +Fillet_7 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[AngularCopy_1_1_1/MF:Rotated&Box_3_1/Back][AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top]", + ), + model.selection("FACE", "AngularCopy_1_1_2/MF:Rotated&Box_3_1/Left"), + ], + RADIUS, +) model.testNbResults(Fillet_7, 2) model.testNbSubResults(Fillet_7, [0, 0]) model.testNbSubShapes(Fillet_7, GeomAPI_Shape.SOLID, [1, 1]) @@ -138,9 +289,22 @@ model.testResultsVolumes(Fillet_7, [991.415926537164, 968.731557]) model.end() model.begin() -Fillet_8 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Fillet_1_1/MF:Fillet&Box_1_1/Top][Fillet_1_1/MF:Fillet&Box_1_1/Left]"), model.selection("EDGE", "[AngularCopy_1_1_3/MF:Rotated&Box_3_1/Left][AngularCopy_1_1_3/MF:Rotated&Box_3_1/Top]")], RADIUS) +Fillet_8 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Fillet_1_1/MF:Fillet&Box_1_1/Top][Fillet_1_1/MF:Fillet&Box_1_1/Left]", + ), + model.selection( + "EDGE", + "[AngularCopy_1_1_3/MF:Rotated&Box_3_1/Left][AngularCopy_1_1_3/MF:Rotated&Box_3_1/Top]", + ), + ], + RADIUS, +) model.end() -assert(Fillet_8.feature().error() != "") +assert Fillet_8.feature().error() != "" model.undo() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_2.py b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_2.py index bafac9678..72e06afe1 100644 --- a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_2.py +++ b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_2.py @@ -27,86 +27,229 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 RADIUS = 2 model.begin() -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Compound_1_1_2")], RADIUS) +Fillet_1 = model.addFillet( + Part_1_doc, [model.selection("EDGE", "Compound_1_1_2")], RADIUS +) model.end() -assert(Fillet_1.feature().error() != "") +assert Fillet_1.feature().error() != "" model.undo() model.begin() -Fillet_2 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Compound_1_1_3/Modified_Edge&Sketch_1/SketchLine_1")], RADIUS) +Fillet_2 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_3/Modified_Edge&Sketch_1/SketchLine_1")], + RADIUS, +) model.end() -assert(Fillet_2.feature().error() != "") +assert Fillet_2.feature().error() != "" model.undo() model.begin() -Fillet_3 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Compound_1_1_4/Modified_Edge&Sketch_1/SketchLine_3")], RADIUS) +Fillet_3 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_4/Modified_Edge&Sketch_1/SketchLine_3")], + RADIUS, +) model.end() -assert(Fillet_3.feature().error() != "") +assert Fillet_3.feature().error() != "" model.undo() model.begin() -Fillet_4 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Compound_1_1_5/Modified_Edge&Sketch_1/SketchLine_10")], RADIUS) +Fillet_4 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_5/Modified_Edge&Sketch_1/SketchLine_10")], + RADIUS, +) model.end() -assert(Fillet_4.feature().error() != "") +assert Fillet_4.feature().error() != "" model.undo() model.begin() -Fillet_5 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_6/Modified_Face&Box_1_1/Front][Compound_1_1_6/Modified_Face&Box_1_1/Top]"), model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Back")], RADIUS) +Fillet_5 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Compound_1_1_6/Modified_Face&Box_1_1/Front][Compound_1_1_6/Modified_Face&Box_1_1/Top]", + ), + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Back"), + ], + RADIUS, +) model.testNbResults(Fillet_5, 1) model.testNbSubResults(Fillet_5, [0]) model.testNbSubShapes(Fillet_5, GeomAPI_Shape.SOLID, [1]) @@ -116,10 +259,20 @@ model.testNbSubShapes(Fillet_5, GeomAPI_Shape.VERTEX, [92]) model.testResultsVolumes(Fillet_5, [960.147483562]) refPoint = GeomAPI_Pnt(55.106983719, 5, 4.95929198) midPoint = Fillet_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, Fillet_5, [Compound_1.result()], True) -Fillet_6 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Recover_1_1_7_2/Modified_Face&Box_2_1/Top][Recover_1_1_7_2/Modified_Face&Box_2_1/Front]"), model.selection("FACE", "Recover_1_1_7_2/Modified_Face&Box_2_1/Right")], RADIUS) +Fillet_6 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Recover_1_1_7_2/Modified_Face&Box_2_1/Top][Recover_1_1_7_2/Modified_Face&Box_2_1/Front]", + ), + model.selection("FACE", "Recover_1_1_7_2/Modified_Face&Box_2_1/Right"), + ], + RADIUS, +) model.testNbResults(Fillet_6, 1) model.testNbSubResults(Fillet_6, [3]) model.testNbSubShapes(Fillet_6, GeomAPI_Shape.SOLID, [3]) @@ -129,10 +282,20 @@ model.testNbSubShapes(Fillet_6, GeomAPI_Shape.VERTEX, [182]) model.testResultsVolumes(Fillet_6, [1549.768377728]) refPoint = GeomAPI_Pnt(2.5, 2.5, 5) midPoint = Fillet_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, Fillet_6, [Compound_1.result()], True) -Fillet_7 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Recover_2_1_8_1/Modified_Face&Box_3_1/Back][Recover_2_1_8_1/Modified_Face&Box_3_1/Top]"), model.selection("FACE", "Recover_2_1_8_2/Modified_Face&Box_3_1/Left")], RADIUS) +Fillet_7 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Recover_2_1_8_1/Modified_Face&Box_3_1/Back][Recover_2_1_8_1/Modified_Face&Box_3_1/Top]", + ), + model.selection("FACE", "Recover_2_1_8_2/Modified_Face&Box_3_1/Left"), + ], + RADIUS, +) model.testNbResults(Fillet_7, 2) model.testNbSubResults(Fillet_7, [0, 0]) model.testNbSubShapes(Fillet_7, GeomAPI_Shape.SOLID, [1, 1]) @@ -142,7 +305,19 @@ model.testNbSubShapes(Fillet_7, GeomAPI_Shape.VERTEX, [60, 80]) model.testResultsVolumes(Fillet_7, [991.415926537164, 968.731557]) Recover_3 = model.addRecover(Part_1_doc, Fillet_7, [Compound_1.result()], True) -Fillet_8 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Recover_3_1_6/Modified_Edge&Fillet_1_1/FilletSelected_1"), model.selection("EDGE", "[Recover_3_1_8_2/Modified_Face&Box_3_1/Left][Recover_3_1_8_2/Modified_Face&Box_3_1/Top]")], RADIUS) +Fillet_8 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", "Recover_3_1_6/Modified_Edge&Fillet_1_1/FilletSelected_1" + ), + model.selection( + "EDGE", + "[Recover_3_1_8_2/Modified_Face&Box_3_1/Left][Recover_3_1_8_2/Modified_Face&Box_3_1/Top]", + ), + ], + RADIUS, +) model.testNbResults(Fillet_8, 2) model.testNbSubResults(Fillet_8, [0, 0]) model.testNbSubShapes(Fillet_8, GeomAPI_Shape.SOLID, [1, 1]) @@ -152,4 +327,4 @@ model.testNbSubShapes(Fillet_8, GeomAPI_Shape.VERTEX, [60, 60]) model.testResultsVolumes(Fillet_8, [991.415926537164, 991.415926537164]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_3.py b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_3.py index ba18b999a..24dffce34 100644 --- a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_3.py +++ b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_3.py @@ -27,84 +27,222 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 RADIUS_1 = 2 RADIUS_2 = 1 model.begin() -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], RADIUS_1, RADIUS_2) +Fillet_1 = model.addFillet( + Part_1_doc, [model.selection("EDGE", "Edge_1_1")], RADIUS_1, RADIUS_2 +) model.end() -assert(Fillet_1.feature().error() != "") +assert Fillet_1.feature().error() != "" model.undo() model.begin() -Fillet_2 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1")], RADIUS_1, RADIUS_2) +Fillet_2 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1")], + RADIUS_1, + RADIUS_2, +) model.end() -assert(Fillet_2.feature().error() != "") +assert Fillet_2.feature().error() != "" model.undo() model.begin() -Fillet_3 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_3")], RADIUS_1, RADIUS_2) +Fillet_3 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_3")], + RADIUS_1, + RADIUS_2, +) model.end() -assert(Fillet_3.feature().error() != "") +assert Fillet_3.feature().error() != "" model.undo() model.begin() -Fillet_4 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Shell_1_1/Modified_Edge&Sketch_1/SketchLine_10")], RADIUS_1, RADIUS_2) +Fillet_4 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Shell_1_1/Modified_Edge&Sketch_1/SketchLine_10")], + RADIUS_1, + RADIUS_2, +) model.end() -assert(Fillet_4.feature().error() != "") +assert Fillet_4.feature().error() != "" model.undo() model.begin() -Fillet_5 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Translation_1_1/MF:Translated&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Top]"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Right")], RADIUS_1, RADIUS_2) +Fillet_5 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Top]", + ), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Right"), + ], + RADIUS_1, + RADIUS_2, +) model.testNbResults(Fillet_5, 1) model.testNbSubResults(Fillet_5, [0]) model.testNbSubShapes(Fillet_5, GeomAPI_Shape.SOLID, [1]) @@ -114,9 +252,19 @@ model.testNbSubShapes(Fillet_5, GeomAPI_Shape.VERTEX, [106]) model.testResultsVolumes(Fillet_5, [976.519471836586]) refPoint = GeomAPI_Pnt(54.98720346, 4.918055722, 4.987203302) midPoint = Fillet_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Fillet_6 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Top][Box_2_1/Front]"), model.selection("FACE", "Box_2_1/Right")], RADIUS_1, RADIUS_2) +Fillet_6 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Top][Box_2_1/Front]" + ), + model.selection("FACE", "Box_2_1/Right"), + ], + RADIUS_1, + RADIUS_2, +) model.testNbResults(Fillet_6, 1) model.testNbSubResults(Fillet_6, [3]) model.testNbSubShapes(Fillet_6, GeomAPI_Shape.SOLID, [3]) @@ -126,9 +274,20 @@ model.testNbSubShapes(Fillet_6, GeomAPI_Shape.VERTEX, [190]) model.testResultsVolumes(Fillet_6, [1565.568094166]) refPoint = GeomAPI_Pnt(2.7448, 2.7448, 5) midPoint = Fillet_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Fillet_7 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[AngularCopy_1_1_1/MF:Rotated&Box_3_1/Back][AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top]"), model.selection("FACE", "AngularCopy_1_1_2/MF:Rotated&Box_3_1/Left")], RADIUS_1, RADIUS_2) +Fillet_7 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[AngularCopy_1_1_1/MF:Rotated&Box_3_1/Back][AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top]", + ), + model.selection("FACE", "AngularCopy_1_1_2/MF:Rotated&Box_3_1/Left"), + ], + RADIUS_1, + RADIUS_2, +) model.testNbResults(Fillet_7, 2) model.testNbSubResults(Fillet_7, [0, 0]) model.testNbSubShapes(Fillet_7, GeomAPI_Shape.SOLID, [1, 1]) @@ -139,9 +298,23 @@ model.testResultsVolumes(Fillet_7, [994.948408157, 981.120160322]) model.end() model.begin() -Fillet_8 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Fillet_1_1/MF:Fillet&Box_1_1/Top][Fillet_1_1/MF:Fillet&Box_1_1/Left]"), model.selection("EDGE", "[AngularCopy_1_1_3/MF:Rotated&Box_3_1/Left][AngularCopy_1_1_3/MF:Rotated&Box_3_1/Top]")], RADIUS_1, RADIUS_2) +Fillet_8 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Fillet_1_1/MF:Fillet&Box_1_1/Top][Fillet_1_1/MF:Fillet&Box_1_1/Left]", + ), + model.selection( + "EDGE", + "[AngularCopy_1_1_3/MF:Rotated&Box_3_1/Left][AngularCopy_1_1_3/MF:Rotated&Box_3_1/Top]", + ), + ], + RADIUS_1, + RADIUS_2, +) model.end() -assert(Fillet_8.feature().error() != "") +assert Fillet_8.feature().error() != "" model.undo() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_4.py b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_4.py index 92fc42075..ad72e8704 100644 --- a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_4.py +++ b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_4.py @@ -27,86 +27,233 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 RADIUS_1 = 2 RADIUS_2 = 1 model.begin() -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Compound_1_1_2")], RADIUS_1, RADIUS_2) +Fillet_1 = model.addFillet( + Part_1_doc, [model.selection("EDGE", "Compound_1_1_2")], RADIUS_1, RADIUS_2 +) model.end() -assert(Fillet_1.feature().error() != "") +assert Fillet_1.feature().error() != "" model.undo() model.begin() -Fillet_2 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Compound_1_1_3/Modified_Edge&Sketch_1/SketchLine_1")], RADIUS_1, RADIUS_2) +Fillet_2 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_3/Modified_Edge&Sketch_1/SketchLine_1")], + RADIUS_1, + RADIUS_2, +) model.end() -assert(Fillet_2.feature().error() != "") +assert Fillet_2.feature().error() != "" model.undo() model.begin() -Fillet_3 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Compound_1_1_4/Modified_Edge&Sketch_1/SketchLine_3")], RADIUS_1, RADIUS_2) +Fillet_3 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_4/Modified_Edge&Sketch_1/SketchLine_3")], + RADIUS_1, + RADIUS_2, +) model.end() -assert(Fillet_3.feature().error() != "") +assert Fillet_3.feature().error() != "" model.undo() model.begin() -Fillet_4 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Compound_1_1_5/Modified_Edge&Sketch_1/SketchLine_10")], RADIUS_1, RADIUS_2) +Fillet_4 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_5/Modified_Edge&Sketch_1/SketchLine_10")], + RADIUS_1, + RADIUS_2, +) model.end() -assert(Fillet_4.feature().error() != "") +assert Fillet_4.feature().error() != "" model.undo() model.begin() -Fillet_5 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_6/Modified_Face&Box_1_1/Front][Compound_1_1_6/Modified_Face&Box_1_1/Top]"), model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Back")], RADIUS_1, RADIUS_2) +Fillet_5 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Compound_1_1_6/Modified_Face&Box_1_1/Front][Compound_1_1_6/Modified_Face&Box_1_1/Top]", + ), + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Back"), + ], + RADIUS_1, + RADIUS_2, +) model.testNbResults(Fillet_5, 1) model.testNbSubResults(Fillet_5, [0]) model.testNbSubShapes(Fillet_5, GeomAPI_Shape.SOLID, [1]) @@ -116,10 +263,21 @@ model.testNbSubShapes(Fillet_5, GeomAPI_Shape.VERTEX, [100]) model.testResultsVolumes(Fillet_5, [976.068565925934]) refPoint = GeomAPI_Pnt(55.0654360945, 5.015632459, 4.985518188) midPoint = Fillet_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, Fillet_5, [Compound_1.result()], True) -Fillet_6 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Recover_1_1_7_2/Modified_Face&Box_2_1/Top][Recover_1_1_7_2/Modified_Face&Box_2_1/Front]"), model.selection("FACE", "Recover_1_1_7_2/Modified_Face&Box_2_1/Right")], RADIUS_1, RADIUS_2) +Fillet_6 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Recover_1_1_7_2/Modified_Face&Box_2_1/Top][Recover_1_1_7_2/Modified_Face&Box_2_1/Front]", + ), + model.selection("FACE", "Recover_1_1_7_2/Modified_Face&Box_2_1/Right"), + ], + RADIUS_1, + RADIUS_2, +) model.testNbResults(Fillet_6, 1) model.testNbSubResults(Fillet_6, [3]) model.testNbSubShapes(Fillet_6, GeomAPI_Shape.SOLID, [3]) @@ -129,10 +287,21 @@ model.testNbSubShapes(Fillet_6, GeomAPI_Shape.VERTEX, [190]) model.testResultsVolumes(Fillet_6, [1565.568094166]) refPoint = GeomAPI_Pnt(2.7448, 2.7448, 5) midPoint = Fillet_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, Fillet_6, [Compound_1.result()], True) -Fillet_7 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Recover_2_1_8_1/Modified_Face&Box_3_1/Back][Recover_2_1_8_1/Modified_Face&Box_3_1/Top]"), model.selection("FACE", "Recover_2_1_8_2/Modified_Face&Box_3_1/Left")], RADIUS_1, RADIUS_2) +Fillet_7 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Recover_2_1_8_1/Modified_Face&Box_3_1/Back][Recover_2_1_8_1/Modified_Face&Box_3_1/Top]", + ), + model.selection("FACE", "Recover_2_1_8_2/Modified_Face&Box_3_1/Left"), + ], + RADIUS_1, + RADIUS_2, +) model.testNbResults(Fillet_7, 2) model.testNbSubResults(Fillet_7, [0, 0]) model.testNbSubShapes(Fillet_7, GeomAPI_Shape.SOLID, [1, 1]) @@ -142,7 +311,20 @@ model.testNbSubShapes(Fillet_7, GeomAPI_Shape.VERTEX, [60, 88]) model.testResultsVolumes(Fillet_7, [994.948408157, 981.12016032]) Recover_3 = model.addRecover(Part_1_doc, Fillet_7, [Compound_1.result()], True) -Fillet_8 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Recover_3_1_6/Modified_Edge&Fillet_1_1/FilletSelected_1"), model.selection("EDGE", "[Recover_3_1_8_2/Modified_Face&Box_3_1/Left][Recover_3_1_8_2/Modified_Face&Box_3_1/Top]")], RADIUS_1, RADIUS_2) +Fillet_8 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", "Recover_3_1_6/Modified_Edge&Fillet_1_1/FilletSelected_1" + ), + model.selection( + "EDGE", + "[Recover_3_1_8_2/Modified_Face&Box_3_1/Left][Recover_3_1_8_2/Modified_Face&Box_3_1/Top]", + ), + ], + RADIUS_1, + RADIUS_2, +) model.testNbResults(Fillet_8, 2) model.testNbSubResults(Fillet_8, [0, 0]) model.testNbSubShapes(Fillet_8, GeomAPI_Shape.SOLID, [1, 1]) @@ -152,4 +334,4 @@ model.testNbSubShapes(Fillet_8, GeomAPI_Shape.VERTEX, [60, 60]) model.testResultsVolumes(Fillet_8, [994.948408157, 994.948408157]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_1.py b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_1.py index 1f6591e08..ecc24bd65 100644 --- a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_1.py +++ b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_1.py @@ -27,83 +27,222 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 RADIUS = 2 model.begin() -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], RADIUS, keepSubResults = True) +Fillet_1 = model.addFillet( + Part_1_doc, [model.selection("EDGE", "Edge_1_1")], RADIUS, keepSubResults=True +) model.end() -assert(Fillet_1.feature().error() != "") +assert Fillet_1.feature().error() != "" model.undo() model.begin() -Fillet_2 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1")], RADIUS, keepSubResults = True) +Fillet_2 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1")], + RADIUS, + keepSubResults=True, +) model.end() -assert(Fillet_2.feature().error() != "") +assert Fillet_2.feature().error() != "" model.undo() model.begin() -Fillet_3 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_3")], RADIUS, keepSubResults = True) +Fillet_3 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_3")], + RADIUS, + keepSubResults=True, +) model.end() -assert(Fillet_3.feature().error() != "") +assert Fillet_3.feature().error() != "" model.undo() model.begin() -Fillet_4 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Shell_1_1/Modified_Edge&Sketch_1/SketchLine_10")], RADIUS, keepSubResults = True) +Fillet_4 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Shell_1_1/Modified_Edge&Sketch_1/SketchLine_10")], + RADIUS, + keepSubResults=True, +) model.end() -assert(Fillet_4.feature().error() != "") +assert Fillet_4.feature().error() != "" model.undo() model.begin() -Fillet_5 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Translation_1_1/MF:Translated&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Top]"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Right")], RADIUS, keepSubResults = True) +Fillet_5 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Top]", + ), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Right"), + ], + RADIUS, + keepSubResults=True, +) model.testNbResults(Fillet_5, 1) model.testNbSubResults(Fillet_5, [0]) model.testNbSubShapes(Fillet_5, GeomAPI_Shape.SOLID, [1]) @@ -113,9 +252,19 @@ model.testNbSubShapes(Fillet_5, GeomAPI_Shape.VERTEX, [98]) model.testResultsVolumes(Fillet_5, [960.71975512471]) refPoint = GeomAPI_Pnt(54.962243976, 4.8550769, 4.9622439887) midPoint = Fillet_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Fillet_6 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Top][Box_2_1/Front]"), model.selection("FACE", "Box_2_1/Right")], RADIUS, keepSubResults = True) +Fillet_6 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Top][Box_2_1/Front]" + ), + model.selection("FACE", "Box_2_1/Right"), + ], + RADIUS, + keepSubResults=True, +) model.testNbResults(Fillet_6, 1) model.testNbSubResults(Fillet_6, [3]) model.testNbSubShapes(Fillet_6, GeomAPI_Shape.SOLID, [3]) @@ -125,9 +274,20 @@ model.testNbSubShapes(Fillet_6, GeomAPI_Shape.VERTEX, [182]) model.testResultsVolumes(Fillet_6, [1549.768377728]) refPoint = GeomAPI_Pnt(2.5, 2.5, 5) midPoint = Fillet_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Fillet_7 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[AngularCopy_1_1_1/MF:Rotated&Box_3_1/Back][AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top]"), model.selection("FACE", "AngularCopy_1_1_2/MF:Rotated&Box_3_1/Left")], RADIUS, keepSubResults = True) +Fillet_7 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[AngularCopy_1_1_1/MF:Rotated&Box_3_1/Back][AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top]", + ), + model.selection("FACE", "AngularCopy_1_1_2/MF:Rotated&Box_3_1/Left"), + ], + RADIUS, + keepSubResults=True, +) model.testNbResults(Fillet_7, 1) model.testNbSubResults(Fillet_7, [3]) model.testNbSubShapes(Fillet_7, GeomAPI_Shape.SOLID, [3]) @@ -137,13 +297,27 @@ model.testNbSubShapes(Fillet_7, GeomAPI_Shape.VERTEX, [188]) model.testResultsVolumes(Fillet_7, [2960.14748356]) refPoint = GeomAPI_Pnt(-20.9807621135, 42.5, 5) midPoint = Fillet_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() model.begin() -Fillet_8 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Fillet_1_1/MF:Fillet&Box_1_1/Top][Fillet_1_1/MF:Fillet&Box_1_1/Left]"), model.selection("EDGE", "[AngularCopy_1_1_3/MF:Rotated&Box_3_1/Left][AngularCopy_1_1_3/MF:Rotated&Box_3_1/Top]")], RADIUS, keepSubResults = True) +Fillet_8 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Fillet_1_1/MF:Fillet&Box_1_1/Top][Fillet_1_1/MF:Fillet&Box_1_1/Left]", + ), + model.selection( + "EDGE", + "[AngularCopy_1_1_3/MF:Rotated&Box_3_1/Left][AngularCopy_1_1_3/MF:Rotated&Box_3_1/Top]", + ), + ], + RADIUS, + keepSubResults=True, +) model.end() -assert(Fillet_8.feature().error() != "") +assert Fillet_8.feature().error() != "" model.undo() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_2.py b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_2.py index 9659a7a5e..33ff907a7 100644 --- a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_2.py +++ b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_2.py @@ -27,57 +27,177 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 RADIUS = 2 NB_SOLIDS = 7 @@ -92,6 +212,7 @@ for ind in range(0, Compound_1.result().numberOfSubs()): p = Compound_1.result().subResult(ind).resultSubShapePair()[1].middlePoint() REFERENCE.append(p) + def assertResult(theFeature): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [8]) @@ -103,36 +224,74 @@ def assertResult(theFeature): for ind in range(0, theFeature.result().numberOfSubs()): ref = REFERENCE[ind] - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Compound_1_1_2")], RADIUS, keepSubResults = True) +Fillet_1 = model.addFillet( + Part_1_doc, [model.selection("EDGE", "Compound_1_1_2")], RADIUS, keepSubResults=True +) model.end() -assert(Fillet_1.feature().error() != "") +assert Fillet_1.feature().error() != "" model.undo() model.begin() -Fillet_2 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Compound_1_1_3/Modified_Edge&Sketch_1/SketchLine_1")], RADIUS, keepSubResults = True) +Fillet_2 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_3/Modified_Edge&Sketch_1/SketchLine_1")], + RADIUS, + keepSubResults=True, +) model.end() -assert(Fillet_2.feature().error() != "") +assert Fillet_2.feature().error() != "" model.undo() model.begin() -Fillet_3 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Compound_1_1_4/Modified_Edge&Sketch_1/SketchLine_3")], RADIUS, keepSubResults = True) +Fillet_3 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_4/Modified_Edge&Sketch_1/SketchLine_3")], + RADIUS, + keepSubResults=True, +) model.end() -assert(Fillet_3.feature().error() != "") +assert Fillet_3.feature().error() != "" model.undo() model.begin() -Fillet_4 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Compound_1_1_5/Modified_Edge&Sketch_1/SketchLine_10")], RADIUS, keepSubResults = True) +Fillet_4 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_5/Modified_Edge&Sketch_1/SketchLine_10")], + RADIUS, + keepSubResults=True, +) model.end() -assert(Fillet_4.feature().error() != "") +assert Fillet_4.feature().error() != "" model.undo() model.begin() -Fillet_5 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_6/Modified_Face&Box_1_1/Front][Compound_1_1_6/Modified_Face&Box_1_1/Top]"), model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Back")], RADIUS, keepSubResults = True) +Fillet_5 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Compound_1_1_6/Modified_Face&Box_1_1/Front][Compound_1_1_6/Modified_Face&Box_1_1/Top]", + ), + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Back"), + ], + RADIUS, + keepSubResults=True, +) REFERENCE[5] = GeomAPI_Pnt(55.1069837186, 5, 4.959291982496) NB_FACES += 5 NB_EDGES += 22 @@ -140,21 +299,57 @@ NB_VERTICES += 44 VOLUME = 5549.19610616474 assertResult(Fillet_5) -Fillet_6 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_7_2/Modified_Face&Box_2_1/Top][Compound_1_1_7_2/Modified_Face&Box_2_1/Front]"), model.selection("FACE", "Compound_1_1_7_2/Modified_Face&Box_2_1/Right")], RADIUS, keepSubResults = True) +Fillet_6 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Compound_1_1_7_2/Modified_Face&Box_2_1/Top][Compound_1_1_7_2/Modified_Face&Box_2_1/Front]", + ), + model.selection("FACE", "Compound_1_1_7_2/Modified_Face&Box_2_1/Right"), + ], + RADIUS, + keepSubResults=True, +) NB_FACES += 6 NB_EDGES += 25 NB_VERTICES += 50 VOLUME = 5509.91586129 assertResult(Fillet_6) -Fillet_7 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_8_1/Modified_Face&Box_3_1/Back][Compound_1_1_8_1/Modified_Face&Box_3_1/Top]"), model.selection("FACE", "Compound_1_1_8_2/Modified_Face&Box_3_1/Left")], RADIUS, keepSubResults = True) +Fillet_7 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Compound_1_1_8_1/Modified_Face&Box_3_1/Back][Compound_1_1_8_1/Modified_Face&Box_3_1/Top]", + ), + model.selection("FACE", "Compound_1_1_8_2/Modified_Face&Box_3_1/Left"), + ], + RADIUS, + keepSubResults=True, +) NB_FACES += 5 NB_EDGES += 22 NB_VERTICES += 44 VOLUME = 5470.063344851 assertResult(Fillet_7) -Fillet_8 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Fillet_1_1_6/MF:Fillet&Box_1_1/Bottom][Fillet_1_1_6/MF:Fillet&Box_1_1/Front]"), model.selection("EDGE", "[Compound_1_1_8_3/Modified_Face&Box_3_1/Left][Compound_1_1_8_3/Modified_Face&Box_3_1/Top]")], RADIUS, keepSubResults = True) +Fillet_8 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Fillet_1_1_6/MF:Fillet&Box_1_1/Bottom][Fillet_1_1_6/MF:Fillet&Box_1_1/Front]", + ), + model.selection( + "EDGE", + "[Compound_1_1_8_3/Modified_Face&Box_3_1/Left][Compound_1_1_8_3/Modified_Face&Box_3_1/Top]", + ), + ], + RADIUS, + keepSubResults=True, +) NB_FACES += 2 NB_EDGES += 12 NB_VERTICES += 24 @@ -164,4 +359,4 @@ assertResult(Fillet_8) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_3.py b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_3.py index a60997187..36276482e 100644 --- a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_3.py +++ b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_3.py @@ -27,84 +27,231 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 RADIUS_1 = 2 RADIUS_2 = 1 model.begin() -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], RADIUS_1, RADIUS_2, keepSubResults = True) +Fillet_1 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + RADIUS_1, + RADIUS_2, + keepSubResults=True, +) model.end() -assert(Fillet_1.feature().error() != "") +assert Fillet_1.feature().error() != "" model.undo() model.begin() -Fillet_2 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1")], RADIUS_1, RADIUS_2, keepSubResults = True) +Fillet_2 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1")], + RADIUS_1, + RADIUS_2, + keepSubResults=True, +) model.end() -assert(Fillet_2.feature().error() != "") +assert Fillet_2.feature().error() != "" model.undo() model.begin() -Fillet_3 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_3")], RADIUS_1, RADIUS_2, keepSubResults = True) +Fillet_3 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_3")], + RADIUS_1, + RADIUS_2, + keepSubResults=True, +) model.end() -assert(Fillet_3.feature().error() != "") +assert Fillet_3.feature().error() != "" model.undo() model.begin() -Fillet_4 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Shell_1_1/Modified_Edge&Sketch_1/SketchLine_10")], RADIUS_1, RADIUS_2, keepSubResults = True) +Fillet_4 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Shell_1_1/Modified_Edge&Sketch_1/SketchLine_10")], + RADIUS_1, + RADIUS_2, + keepSubResults=True, +) model.end() -assert(Fillet_4.feature().error() != "") +assert Fillet_4.feature().error() != "" model.undo() model.begin() -Fillet_5 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Translation_1_1/MF:Translated&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Top]"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Right")], RADIUS_1, RADIUS_2, keepSubResults = True) +Fillet_5 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Top]", + ), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Right"), + ], + RADIUS_1, + RADIUS_2, + keepSubResults=True, +) model.testNbResults(Fillet_5, 1) model.testNbSubResults(Fillet_5, [0]) model.testNbSubShapes(Fillet_5, GeomAPI_Shape.SOLID, [1]) @@ -114,9 +261,20 @@ model.testNbSubShapes(Fillet_5, GeomAPI_Shape.VERTEX, [106]) model.testResultsVolumes(Fillet_5, [976.519471836586]) refPoint = GeomAPI_Pnt(54.98720346, 4.918055722, 4.987203302) midPoint = Fillet_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Fillet_6 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Top][Box_2_1/Front]"), model.selection("FACE", "Box_2_1/Right")], RADIUS_1, RADIUS_2, keepSubResults = True) +Fillet_6 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Top][Box_2_1/Front]" + ), + model.selection("FACE", "Box_2_1/Right"), + ], + RADIUS_1, + RADIUS_2, + keepSubResults=True, +) model.testNbResults(Fillet_6, 1) model.testNbSubResults(Fillet_6, [3]) model.testNbSubShapes(Fillet_6, GeomAPI_Shape.SOLID, [3]) @@ -126,9 +284,21 @@ model.testNbSubShapes(Fillet_6, GeomAPI_Shape.VERTEX, [190]) model.testResultsVolumes(Fillet_6, [1565.568094166]) refPoint = GeomAPI_Pnt(2.7448, 2.7448, 5) midPoint = Fillet_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Fillet_7 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[AngularCopy_1_1_1/MF:Rotated&Box_3_1/Back][AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top]"), model.selection("FACE", "AngularCopy_1_1_2/MF:Rotated&Box_3_1/Left")], RADIUS_1, RADIUS_2, keepSubResults = True) +Fillet_7 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[AngularCopy_1_1_1/MF:Rotated&Box_3_1/Back][AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top]", + ), + model.selection("FACE", "AngularCopy_1_1_2/MF:Rotated&Box_3_1/Left"), + ], + RADIUS_1, + RADIUS_2, + keepSubResults=True, +) model.testNbResults(Fillet_7, 1) model.testNbSubResults(Fillet_7, [3]) model.testNbSubShapes(Fillet_7, GeomAPI_Shape.SOLID, [3]) @@ -138,13 +308,28 @@ model.testNbSubShapes(Fillet_7, GeomAPI_Shape.VERTEX, [196]) model.testResultsVolumes(Fillet_7, [2976.0685684791988]) refPoint = GeomAPI_Pnt(-20.9807621135, 42.806, 5) midPoint = Fillet_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() model.begin() -Fillet_8 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Fillet_1_1/MF:Fillet&Box_1_1/Top][Fillet_1_1/MF:Fillet&Box_1_1/Left]"), model.selection("EDGE", "[AngularCopy_1_1_3/MF:Rotated&Box_3_1/Left][AngularCopy_1_1_3/MF:Rotated&Box_3_1/Top]")], RADIUS_1, RADIUS_2, keepSubResults = True) +Fillet_8 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Fillet_1_1/MF:Fillet&Box_1_1/Top][Fillet_1_1/MF:Fillet&Box_1_1/Left]", + ), + model.selection( + "EDGE", + "[AngularCopy_1_1_3/MF:Rotated&Box_3_1/Left][AngularCopy_1_1_3/MF:Rotated&Box_3_1/Top]", + ), + ], + RADIUS_1, + RADIUS_2, + keepSubResults=True, +) model.end() -assert(Fillet_8.feature().error() != "") +assert Fillet_8.feature().error() != "" model.undo() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_4.py b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_4.py index d9c5835c8..2a02704f7 100644 --- a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_4.py +++ b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_4.py @@ -27,57 +27,177 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 RADIUS_1 = 2 RADIUS_2 = 1 @@ -93,6 +213,7 @@ for ind in range(0, Compound_1.result().numberOfSubs()): p = Compound_1.result().subResult(ind).resultSubShapePair()[1].middlePoint() REFERENCE.append(p) + def assertResult(theFeature): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [8]) @@ -104,36 +225,82 @@ def assertResult(theFeature): for ind in range(0, theFeature.result().numberOfSubs()): ref = REFERENCE[ind] - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Compound_1_1_2")], RADIUS_1, RADIUS_2, keepSubResults = True) +Fillet_1 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_2")], + RADIUS_1, + RADIUS_2, + keepSubResults=True, +) model.end() -assert(Fillet_1.feature().error() != "") +assert Fillet_1.feature().error() != "" model.undo() model.begin() -Fillet_2 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Compound_1_1_3/Modified_Edge&Sketch_1/SketchLine_1")], RADIUS_1, RADIUS_2, keepSubResults = True) +Fillet_2 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_3/Modified_Edge&Sketch_1/SketchLine_1")], + RADIUS_1, + RADIUS_2, + keepSubResults=True, +) model.end() -assert(Fillet_2.feature().error() != "") +assert Fillet_2.feature().error() != "" model.undo() model.begin() -Fillet_3 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Compound_1_1_4/Modified_Edge&Sketch_1/SketchLine_3")], RADIUS_1, RADIUS_2, keepSubResults = True) +Fillet_3 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_4/Modified_Edge&Sketch_1/SketchLine_3")], + RADIUS_1, + RADIUS_2, + keepSubResults=True, +) model.end() -assert(Fillet_3.feature().error() != "") +assert Fillet_3.feature().error() != "" model.undo() model.begin() -Fillet_4 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Compound_1_1_5/Modified_Edge&Sketch_1/SketchLine_10")], RADIUS_1, RADIUS_2, keepSubResults = True) +Fillet_4 = model.addFillet( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_5/Modified_Edge&Sketch_1/SketchLine_10")], + RADIUS_1, + RADIUS_2, + keepSubResults=True, +) model.end() -assert(Fillet_4.feature().error() != "") +assert Fillet_4.feature().error() != "" model.undo() model.begin() -Fillet_5 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_6/Modified_Face&Box_1_1/Front][Compound_1_1_6/Modified_Face&Box_1_1/Top]"), model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Back")], RADIUS_1, RADIUS_2, keepSubResults = True) +Fillet_5 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Compound_1_1_6/Modified_Face&Box_1_1/Front][Compound_1_1_6/Modified_Face&Box_1_1/Top]", + ), + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Back"), + ], + RADIUS_1, + RADIUS_2, + keepSubResults=True, +) REFERENCE[5] = GeomAPI_Pnt(55.0654360945, 5.015632459, 4.985518188) NB_FACES += 5 NB_EDGES += 26 @@ -141,7 +308,19 @@ NB_VERTICES += 52 VOLUME = 5565.117188528191 assertResult(Fillet_5) -Fillet_6 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_7_2/Modified_Face&Box_2_1/Top][Compound_1_1_7_2/Modified_Face&Box_2_1/Front]"), model.selection("FACE", "Compound_1_1_7_2/Modified_Face&Box_2_1/Right")], RADIUS_1, RADIUS_2, keepSubResults = True) +Fillet_6 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Compound_1_1_7_2/Modified_Face&Box_2_1/Top][Compound_1_1_7_2/Modified_Face&Box_2_1/Front]", + ), + model.selection("FACE", "Compound_1_1_7_2/Modified_Face&Box_2_1/Right"), + ], + RADIUS_1, + RADIUS_2, + keepSubResults=True, +) REFERENCE[6] = GeomAPI_Pnt(2.7448, 2.7448, 5) NB_FACES += 6 NB_EDGES += 29 @@ -149,7 +328,19 @@ NB_VERTICES += 58 VOLUME = 5541.63666 assertResult(Fillet_6) -Fillet_7 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_8_1/Modified_Face&Box_3_1/Back][Compound_1_1_8_1/Modified_Face&Box_3_1/Top]"), model.selection("FACE", "Compound_1_1_8_2/Modified_Face&Box_3_1/Left")], RADIUS_1, RADIUS_2, keepSubResults = True) +Fillet_7 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Compound_1_1_8_1/Modified_Face&Box_3_1/Back][Compound_1_1_8_1/Modified_Face&Box_3_1/Top]", + ), + model.selection("FACE", "Compound_1_1_8_2/Modified_Face&Box_3_1/Left"), + ], + RADIUS_1, + RADIUS_2, + keepSubResults=True, +) REFERENCE[7] = GeomAPI_Pnt(-20.9807621135, 42.806, 5) NB_FACES += 5 NB_EDGES += 26 @@ -157,7 +348,22 @@ NB_VERTICES += 52 VOLUME = 5517.70522857 assertResult(Fillet_7) -Fillet_8 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Fillet_1_1_6/MF:Fillet&Box_1_1/Bottom][Fillet_1_1_6/MF:Fillet&Box_1_1/Front]"), model.selection("EDGE", "[Compound_1_1_8_3/Modified_Face&Box_3_1/Left][Compound_1_1_8_3/Modified_Face&Box_3_1/Top]")], RADIUS_1, RADIUS_2, keepSubResults = True) +Fillet_8 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Fillet_1_1_6/MF:Fillet&Box_1_1/Bottom][Fillet_1_1_6/MF:Fillet&Box_1_1/Front]", + ), + model.selection( + "EDGE", + "[Compound_1_1_8_3/Modified_Face&Box_3_1/Left][Compound_1_1_8_3/Modified_Face&Box_3_1/Top]", + ), + ], + RADIUS_1, + RADIUS_2, + keepSubResults=True, +) NB_FACES += 2 NB_EDGES += 12 NB_VERTICES += 24 @@ -168,4 +374,4 @@ assertResult(Fillet_8) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestFusionFaces.py b/src/FeaturesPlugin/Test/TestFusionFaces.py index b27004458..df0494481 100644 --- a/src/FeaturesPlugin/Test/TestFusionFaces.py +++ b/src/FeaturesPlugin/Test/TestFusionFaces.py @@ -30,10 +30,21 @@ 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"), 10) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_2_1")], + model.selection("EDGE", "PartSet/OX"), + 10, +) model.do() -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")]) +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]) @@ -43,14 +54,18 @@ model.end() model.checkResult(FusionFaces_1, model, 1, [0], [0], [1], [4], [8]) -model.undo() # to reuse Box_1_1 and Translation_1_1 +model.undo() # to reuse Box_1_1 and Translation_1_1 model.undo() model.begin() # ============================================================================= # Test 2. Fusion faces for solid of 2 adjacent boxes # ============================================================================= -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1")], []) +Fuse_1 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1")], + [], +) model.do() model.checkResult(Fuse_1, model, 1, [0], [1], [10], [40], [80]) @@ -63,17 +78,33 @@ model.checkResult(FusionFaces_2, model, 1, [0], [1], [6], [24], [48]) # ============================================================================= # Test 3. Fusion faces for shell of adjacent faces lying on cylindrical surface # ============================================================================= -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Cylinder_1_1/Face_1")]) Point_1 = model.addPoint(Part_1_doc, 0, 0, 5) -Plane_1 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OZ"), model.selection("VERTEX", "Point_1"), True) - -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("FACE", "Plane_1")]) +Plane_1 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "PartSet/OZ"), + model.selection("VERTEX", "Point_1"), + True, +) + +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1"), model.selection("FACE", "Plane_1")], +) model.do() model.checkResult(Partition_1, model, 1, [0], [0], [2], [8], [16]) -FusionFaces_3 = model.addFusionFaces(Part_1_doc, model.selection("SHELL", "Partition_1_1")) +FusionFaces_3 = model.addFusionFaces( + Part_1_doc, model.selection("SHELL", "Partition_1_1") +) model.do() model.checkResult(FusionFaces_3, model, 1, [0], [0], [1], [4], [8]) @@ -89,15 +120,25 @@ SketchLine_4 = Sketch_1.addLine(25, 0, 25, 40) SketchLine_5 = Sketch_1.addLine(-20, 40, -20, 0) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) Box_3 = model.addBox(Part_1_doc, 10, 10, 10) -Fuse_2 = model.addFuse(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("SOLID", "Box_3_1")]) +Fuse_2 = model.addFuse( + Part_1_doc, + [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("SOLID", "Box_3_1"), + ], +) model.do() model.checkResult(Fuse_2, model, 1, [1], [1], [14], [64], [128]) -FusionFaces_4 = model.addFusionFaces(Part_1_doc, model.selection("COMPSOLID", "Fuse_2_1")) +FusionFaces_4 = model.addFusionFaces( + Part_1_doc, model.selection("COMPSOLID", "Fuse_2_1") +) model.do() model.checkResult(FusionFaces_4, model, 1, [1], [1], [6], [24], [48]) @@ -107,20 +148,42 @@ model.checkResult(FusionFaces_4, model, 1, [1], [1], [6], [24], [48]) # ============================================================================= Box_4 = model.addBox(Part_1_doc, 10, 10, 10) Box_5 = model.addBox(Part_1_doc, 10, 10, 10) -Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_5_1")], 0, 0, 5) +Translation_2 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_5_1")], 0, 0, 5 +) Box_6 = model.addBox(Part_1_doc, 10, 10, 10) -Translation_3 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_6_1")], 20, 0, 0) +Translation_3 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_6_1")], 20, 0, 0 +) Box_7 = model.addBox(Part_1_doc, 10, 10, 10) -Translation_4 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_7_1")], 20, 0, 5) -Fuse_3 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Box_4_1"), model.selection("SOLID", "Translation_2_1")], []) -Fuse_4 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Translation_3_1"), model.selection("SOLID", "Translation_4_1")], []) - -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Fuse_3_1"), model.selection("SOLID", "Fuse_4_1")]) +Translation_4 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_7_1")], 20, 0, 5 +) +Fuse_3 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Box_4_1"), model.selection("SOLID", "Translation_2_1")], + [], +) +Fuse_4 = model.addFuse( + Part_1_doc, + [ + model.selection("SOLID", "Translation_3_1"), + model.selection("SOLID", "Translation_4_1"), + ], + [], +) + +Compound_1 = model.addCompound( + Part_1_doc, + [model.selection("SOLID", "Fuse_3_1"), model.selection("SOLID", "Fuse_4_1")], +) model.do() model.checkResult(Compound_1, model, 1, [2], [2], [28], [112], [224]) -FusionFaces_5 = model.addFusionFaces(Part_1_doc, model.selection("COMPOUND", "Compound_1_1")) +FusionFaces_5 = model.addFusionFaces( + Part_1_doc, model.selection("COMPOUND", "Compound_1_1") +) model.do() model.checkResult(FusionFaces_5, model, 1, [2], [2], [12], [48], [96]) @@ -128,9 +191,9 @@ model.checkResult(FusionFaces_5, model, 1, [2], [2], [12], [48], [96]) # ============================================================================= # Test 6. Check subshapes naming # ============================================================================= -#model.testHaveNamingSubshapes(FusionFaces_1, model, Part_1_doc) +# model.testHaveNamingSubshapes(FusionFaces_1, model, Part_1_doc) model.testHaveNamingSubshapes(FusionFaces_2, model, Part_1_doc) -#model.testHaveNamingSubshapes(FusionFaces_3, model, Part_1_doc) +# model.testHaveNamingSubshapes(FusionFaces_3, model, Part_1_doc) model.testHaveNamingSubshapes(FusionFaces_4, model, Part_1_doc) model.testHaveNamingSubshapes(FusionFaces_5, model, Part_1_doc) model.end() @@ -138,4 +201,4 @@ model.end() # ============================================================================= # Test 7. Check Python dump # ============================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestFusionFaces2697.py b/src/FeaturesPlugin/Test/TestFusionFaces2697.py index b0663a698..d26d20543 100644 --- a/src/FeaturesPlugin/Test/TestFusionFaces2697.py +++ b/src/FeaturesPlugin/Test/TestFusionFaces2697.py @@ -31,234 +31,443 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(6.187999999999998, 10.256, 4.9175, 10.94235984621995) SketchLine_1.setName("SketchLine_11") SketchLine_1.result().setName("SketchLine_11") -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_2 = SketchProjection_1.createdFeature() SketchLine_2.setName("SketchLine_12") SketchLine_2.result().setName("SketchLine_12") SketchArc_1 = Sketch_1.addArc(0, 2.425, 0, 12.26, 4.9175, 10.94235984621995, True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_1.center() +) SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_11") -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_1.startPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_12") -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchArc_1.endPoint() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_13") SketchLine_3 = Sketch_1.addLine(0, 12.26, 0, 12.096) SketchLine_3.setName("SketchLine_13") SketchLine_3.result().setName("SketchLine_13") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_14") -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_4 = SketchProjection_2.createdFeature() SketchLine_4.setName("SketchLine_17") SketchLine_4.result().setName("SketchLine_17") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_2.result() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_20") -SketchLine_5 = Sketch_1.addLine(5.404900443923878, 10.43809443685872, 5.12663857042824, 10.62933672216996) +SketchLine_5 = Sketch_1.addLine( + 5.404900443923878, 10.43809443685872, 5.12663857042824, 10.62933672216996 +) SketchLine_5.setName("SketchLine_23") SketchLine_5.result().setName("SketchLine_23") -SketchLine_6 = Sketch_1.addLine(5.12663857042824, 10.62933672216996, 4.835500000000001, 10.80033167999931) +SketchLine_6 = Sketch_1.addLine( + 5.12663857042824, 10.62933672216996, 4.835500000000001, 10.80033167999931 +) SketchLine_6.setName("SketchLine_24") SketchLine_6.result().setName("SketchLine_24") -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_31") SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), "0.082*2") SketchConstraintLength_1.setName("SketchConstraintLength_3") -SketchArc_2 = Sketch_1.addArc(0, 2.425, 0, 12.096, 4.835500000000001, 10.80033167999931, True) +SketchArc_2 = Sketch_1.addArc( + 0, 2.425, 0, 12.096, 4.835500000000001, 10.80033167999931, True +) SketchArc_2.setName("SketchArc_3") SketchArc_2.result().setName("SketchArc_3") SketchArc_2.results()[1].setName("SketchArc_3_2") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_1.center(), SketchArc_2.center()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchArc_2.center() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_32") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_2.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_2.startPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_33") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchArc_2.endPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchArc_2.endPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_34") -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_4.result(), 2.425, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_4.result(), 2.425, True +) SketchConstraintDistance_1.setName("SketchConstraintDistance_11") SketchLine_7 = Sketch_1.addLine(0, 2.425, 5.524022094217663, 10.61469954608912) SketchLine_7.setName("SketchLine_28") SketchLine_7.result().setName("SketchLine_28") SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_7.startPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_43") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_1.result() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_44") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_7.result(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_7.result(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_45") -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_7.result(), SketchLine_2.result(), 34) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_7.result(), SketchLine_2.result(), 34 +) SketchConstraintAngle_1.setName("SketchConstraintAngle_5") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_5.endPoint(), SketchLine_1.result(), "0.088*2", True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_5.endPoint(), SketchLine_1.result(), "0.088*2", True +) SketchConstraintDistance_2.setName("SketchConstraintDistance_12") -SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 9.835000000000001) +SketchConstraintRadius_1 = Sketch_1.setRadius( + SketchArc_1.results()[1], 9.835000000000001 +) SketchConstraintRadius_1.setName("SketchConstraintRadius_2") -SketchLine_8 = Sketch_1.addLine(5.404900443923878, 10.43809443685872, 6.187999999999998, 10.256) +SketchLine_8 = Sketch_1.addLine( + 5.404900443923878, 10.43809443685872, 6.187999999999998, 10.256 +) SketchLine_8.setName("SketchLine_19") SketchLine_8.result().setName("SketchLine_19") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_46") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_8.endPoint() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_47") model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchArc_1_2f-SketchLine_13f-SketchArc_3_2r-SketchLine_24r-SketchLine_23r-SketchLine_19f")], model.selection("EDGE", "PartSet/OZ"), 360, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchArc_1_2f-SketchLine_13f-SketchArc_3_2r-SketchLine_24r-SketchLine_23r-SketchLine_19f", + ) + ], + model.selection("EDGE", "PartSet/OZ"), + 360, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_9 = Sketch_2.addLine(0, 2.425, 3.282538500974061, 11.74164236673401) SketchLine_9.setName("SketchLine_34") SketchLine_9.result().setName("SketchLine_34") SketchLine_9.setAuxiliary(True) -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_28_StartVertex"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_28_StartVertex"), False +) SketchPoint_1 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_9.startPoint(), SketchPoint_1.result()) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_9.startPoint(), SketchPoint_1.result() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_55") SketchPoint_2 = Sketch_2.addPoint(3.241, 11.6237460014939) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_9.result()) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchPoint_2.coordinates(), SketchLine_9.result() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_56") -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_10 = SketchProjection_4.createdFeature() SketchLine_10.setName("SketchLine_36") SketchLine_10.result().setName("SketchLine_36") -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchPoint_2.coordinates(), SketchLine_10.result(), 3.241, True) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchPoint_2.coordinates(), SketchLine_10.result(), 3.241, True +) SketchConstraintDistance_3.setName("SketchConstraintDistance_17") -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_13"), False) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchLine_13"), False +) SketchLine_11 = SketchProjection_5.createdFeature() SketchLine_11.setName("SketchLine_37") SketchLine_11.result().setName("SketchLine_37") -SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_28"), False) +SketchProjection_6 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchLine_28"), False +) SketchLine_12 = SketchProjection_6.createdFeature() SketchLine_12.setName("SketchLine_38") SketchLine_12.result().setName("SketchLine_38") -SketchArc_3 = Sketch_2.addArc(0, 2.425, 0, 12.178, 5.453808387550194, 10.51060344512932, True) +SketchArc_3 = Sketch_2.addArc( + 0, 2.425, 0, 12.178, 5.453808387550194, 10.51060344512932, True +) SketchArc_3.setName("SketchArc_4") SketchArc_3.result().setName("SketchArc_4") SketchArc_3.results()[1].setName("SketchArc_4_2") SketchArc_3.setAuxiliary(True) -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_9.startPoint(), SketchArc_3.center()) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchLine_9.startPoint(), SketchArc_3.center() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_58") -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_11.result(), SketchArc_3.startPoint()) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchLine_11.result(), SketchArc_3.startPoint() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_59") -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_12.result(), SketchArc_3.endPoint()) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_12.result(), SketchArc_3.endPoint() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_60") -SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchLine_11.result(), SketchArc_3.startPoint()) +SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint( + SketchLine_11.result(), SketchArc_3.startPoint() +) SketchConstraintMiddle_1.setName("SketchConstraintMiddle_3") -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchArc_3.results()[1]) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchPoint_2.coordinates(), SketchArc_3.results()[1] +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_61") -SketchArc_4 = Sketch_2.addArc(0, 2.425, 3.28253850097406, 11.74164236673401, 4.139817701932777, 11.39365616437401, True) +SketchArc_4 = Sketch_2.addArc( + 0, + 2.425, + 3.28253850097406, + 11.74164236673401, + 4.139817701932777, + 11.39365616437401, + True, +) SketchArc_4.setName("SketchArc_5") SketchArc_4.result().setName("SketchArc_5") SketchArc_4.results()[1].setName("SketchArc_5_2") -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_9.startPoint(), SketchArc_4.center()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchLine_9.startPoint(), SketchArc_4.center() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_62") -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_9.result(), SketchArc_4.startPoint()) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_9.result(), SketchArc_4.startPoint() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_63") -SketchLine_13 = Sketch_2.addLine(4.139817701932777, 11.39365616437401, 4.459277785066624, 11.1909606795611) +SketchLine_13 = Sketch_2.addLine( + 4.139817701932777, 11.39365616437401, 4.459277785066624, 11.1909606795611 +) SketchLine_13.setName("SketchLine_39") SketchLine_13.result().setName("SketchLine_39") -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchArc_4.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchArc_4.endPoint(), SketchLine_13.startPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_64") -SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchArc_1_2"), False) +SketchProjection_7 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchArc_1_2"), False +) SketchArc_5 = SketchProjection_7.createdFeature() SketchArc_5.setName("SketchArc_6") SketchArc_5.result().setName("SketchArc_6") SketchArc_5.results()[1].setName("SketchArc_6_2") -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchArc_5.results()[1]) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchArc_5.results()[1] +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_65") -SketchLine_14 = Sketch_2.addLine(4.459277785066624, 11.1909606795611, 4.390495384356073, 11.041947909785) +SketchLine_14 = Sketch_2.addLine( + 4.459277785066624, 11.1909606795611, 4.390495384356073, 11.041947909785 +) SketchLine_14.setName("SketchLine_40") SketchLine_14.result().setName("SketchLine_40") -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_66") -SketchProjection_8 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchArc_3_2"), False) +SketchProjection_8 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchArc_3_2"), False +) SketchArc_6 = SketchProjection_8.createdFeature() SketchArc_6.setName("SketchArc_7") SketchArc_6.result().setName("SketchArc_7") SketchArc_6.results()[1].setName("SketchArc_7_2") -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchArc_6.results()[1]) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchArc_6.results()[1] +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_67") -SketchLine_15 = Sketch_2.addLine(4.390495384356073, 11.041947909785, 4.035044020470619, 11.16667053559354) +SketchLine_15 = Sketch_2.addLine( + 4.390495384356073, 11.041947909785, 4.035044020470619, 11.16667053559354 +) SketchLine_15.setName("SketchLine_41") SketchLine_15.result().setName("SketchLine_41") -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_68") -SketchArc_7 = Sketch_2.addArc(0, 2.425, 3.199461499025941, 11.5058496362538, 4.035044020470619, 11.16667053559354, True) +SketchArc_7 = Sketch_2.addArc( + 0, + 2.425, + 3.199461499025941, + 11.5058496362538, + 4.035044020470619, + 11.16667053559354, + True, +) SketchArc_7.setName("SketchArc_8") SketchArc_7.result().setName("SketchArc_8") SketchArc_7.results()[1].setName("SketchArc_8_2") -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_9.startPoint(), SketchArc_7.center()) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchLine_9.startPoint(), SketchArc_7.center() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_69") -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchLine_9.result(), SketchArc_7.startPoint()) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchLine_9.result(), SketchArc_7.startPoint() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_70") -SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchArc_7.endPoint(), SketchLine_15.endPoint()) +SketchConstraintCoincidence_30 = Sketch_2.setCoincident( + SketchArc_7.endPoint(), SketchLine_15.endPoint() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_71") SketchLine_16 = Sketch_2.addLine(0, 2.425, 4.139817701932777, 11.39365616437401) SketchLine_16.setName("SketchLine_42") SketchLine_16.result().setName("SketchLine_42") SketchLine_16.setAuxiliary(True) -SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchLine_9.startPoint(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_31 = Sketch_2.setCoincident( + SketchLine_9.startPoint(), SketchLine_16.startPoint() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_72") -SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchArc_4.endPoint(), SketchLine_16.endPoint()) +SketchConstraintCoincidence_32 = Sketch_2.setCoincident( + SketchArc_4.endPoint(), SketchLine_16.endPoint() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_73") -SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchArc_7.endPoint(), SketchLine_16.result()) +SketchConstraintCoincidence_33 = Sketch_2.setCoincident( + SketchArc_7.endPoint(), SketchLine_16.result() +) SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_74") -SketchConstraintParallel_1 = Sketch_2.setParallel(SketchLine_14.result(), SketchLine_16.result()) +SketchConstraintParallel_1 = Sketch_2.setParallel( + SketchLine_14.result(), SketchLine_16.result() +) SketchLine_17 = Sketch_2.addLine(0, 2.425, 3.9115060144283, 11.49555702253678) SketchLine_17.setName("SketchLine_43") SketchLine_17.result().setName("SketchLine_43") SketchLine_17.setAuxiliary(True) -SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchLine_9.startPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_34 = Sketch_2.setCoincident( + SketchLine_9.startPoint(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_75") -SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchArc_4.results()[1]) +SketchConstraintCoincidence_35 = Sketch_2.setCoincident( + SketchLine_17.endPoint(), SketchArc_4.results()[1] +) SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_76") SketchPoint_3 = Sketch_2.addPoint(3.812510620258724, 11.26599240868436) -SketchConstraintCoincidence_36 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_17.result()) +SketchConstraintCoincidence_36 = Sketch_2.setCoincident( + SketchPoint_3.coordinates(), SketchLine_17.result() +) SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_77") -SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchArc_7.results()[1]) +SketchConstraintCoincidence_37 = Sketch_2.setCoincident( + SketchPoint_3.coordinates(), SketchArc_7.results()[1] +) SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_78") -SketchLine_18 = Sketch_2.addLine(3.812510620258724, 11.26599240868436, 3.9115060144283, 11.49555702253678) +SketchLine_18 = Sketch_2.addLine( + 3.812510620258724, 11.26599240868436, 3.9115060144283, 11.49555702253678 +) SketchLine_18.setName("SketchLine_44") SketchLine_18.result().setName("SketchLine_44") -SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_38 = Sketch_2.setCoincident( + SketchPoint_3.coordinates(), SketchLine_18.startPoint() +) SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_79") -SketchConstraintCoincidence_39 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_18.endPoint()) +SketchConstraintCoincidence_39 = Sketch_2.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.endPoint() +) SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_80") SketchPoint_4 = Sketch_2.addPoint(3.862008317343517, 11.38077471561057) -SketchConstraintCoincidence_40 = Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchLine_18.result()) +SketchConstraintCoincidence_40 = Sketch_2.setCoincident( + SketchPoint_4.coordinates(), SketchLine_18.result() +) SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_81") -SketchConstraintMiddle_2 = Sketch_2.setMiddlePoint(SketchPoint_4.coordinates(), SketchLine_18.result()) +SketchConstraintMiddle_2 = Sketch_2.setMiddlePoint( + SketchPoint_4.coordinates(), SketchLine_18.result() +) SketchConstraintMiddle_2.setName("SketchConstraintMiddle_4") -SketchConstraintCoincidence_41 = Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchArc_3.results()[1]) +SketchConstraintCoincidence_41 = Sketch_2.setCoincident( + SketchPoint_4.coordinates(), SketchArc_3.results()[1] +) SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_82") -SketchConstraintDistance_4 = Sketch_2.setDistance(SketchLine_18.endPoint(), SketchLine_16.result(), 0.25, True) +SketchConstraintDistance_4 = Sketch_2.setDistance( + SketchLine_18.endPoint(), SketchLine_16.result(), 0.25, True +) SketchConstraintDistance_4.setName("SketchConstraintDistance_18") -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchArc_4.endPoint(), SketchLine_14.result(), 0.375, True) +SketchConstraintDistance_5 = Sketch_2.setDistance( + SketchArc_4.endPoint(), SketchLine_14.result(), 0.375, True +) SketchConstraintDistance_5.setName("SketchConstraintDistance_19") -SketchConstraintDistance_6 = Sketch_2.setDistance(SketchArc_4.startPoint(), SketchLine_18.result(), "1.35/2", True) +SketchConstraintDistance_6 = Sketch_2.setDistance( + SketchArc_4.startPoint(), SketchLine_18.result(), "1.35/2", True +) SketchConstraintDistance_6.setName("SketchConstraintDistance_20") -SketchConstraintDistance_7 = Sketch_2.setDistance(SketchArc_7.startPoint(), SketchArc_4.startPoint(), 0.25, True) +SketchConstraintDistance_7 = Sketch_2.setDistance( + SketchArc_7.startPoint(), SketchArc_4.startPoint(), 0.25, True +) SketchConstraintDistance_7.setName("SketchConstraintDistance_21") -SketchConstraintCoincidence_42 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchArc_4.startPoint()) +SketchConstraintCoincidence_42 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchArc_4.startPoint() +) SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_83") -SketchLine_19 = Sketch_2.addLine(3.199461499025942, 11.5058496362538, 3.28253850097406, 11.74164236673401) +SketchLine_19 = Sketch_2.addLine( + 3.199461499025942, 11.5058496362538, 3.28253850097406, 11.74164236673401 +) SketchLine_19.setName("SketchLine_45") SketchLine_19.result().setName("SketchLine_45") -SketchConstraintCoincidence_43 = Sketch_2.setCoincident(SketchArc_7.startPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_43 = Sketch_2.setCoincident( + SketchArc_7.startPoint(), SketchLine_19.startPoint() +) SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_84") -SketchConstraintCoincidence_44 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_19.endPoint()) +SketchConstraintCoincidence_44 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchLine_19.endPoint() +) SketchConstraintCoincidence_44.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 = 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("FACE", "Sketch_2/Face-SketchArc_5_2f-SketchLine_44r-SketchArc_8_2r-SketchLine_41r-SketchLine_40r-SketchLine_39r")], model.selection("EDGE", "Sketch_2/SketchLine_34"), 360, 0) +Revolution_3 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_2/Face-SketchArc_5_2f-SketchLine_44r-SketchArc_8_2r-SketchLine_41r-SketchLine_40r-SketchLine_39r", + ) + ], + 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 = 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")]) +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")], +) FusionFaces_1 = model.addFusionFaces(Part_1_doc, model.selection("SOLID", "Fuse_1_1")) model.do() # check the faces are fused model.checkResult(FusionFaces_1, model, 1, [0], [1], [16], [76], [152]) -model.end() \ No newline at end of file +model.end() diff --git a/src/FeaturesPlugin/Test/TestFusionFaces32443.py b/src/FeaturesPlugin/Test/TestFusionFaces32443.py index 412ba5162..76446c81c 100644 --- a/src/FeaturesPlugin/Test/TestFusionFaces32443.py +++ b/src/FeaturesPlugin/Test/TestFusionFaces32443.py @@ -26,23 +26,31 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -model.addParameter(Part_1_doc, "hauteur", '200') -model.addParameter(Part_1_doc, "rayon", '20') -model.addParameter(Part_1_doc, "largeur", '100') -model.addParameter(Part_1_doc, "epaisseur", '10') -model.addParameter(Part_1_doc, "distance", '50') +model.addParameter(Part_1_doc, "hauteur", "200") +model.addParameter(Part_1_doc, "rayon", "20") +model.addParameter(Part_1_doc, "largeur", "100") +model.addParameter(Part_1_doc, "epaisseur", "10") +model.addParameter(Part_1_doc, "distance", "50") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchLine_2 = Sketch_1.addLine(0, 50, 0, 60) SketchLine_3 = Sketch_1.addLine(100, 60.00000000000041, 100, 50.00000000001594) Sketch_1.setVertical(SketchLine_2.result()) Sketch_1.setVertical(SketchLine_3.result()) -Sketch_1.setVerticalDistance(SketchLine_2.endPoint(), SketchLine_2.startPoint(), "epaisseur") -Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_2.startPoint(), "distance") - -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +Sketch_1.setVerticalDistance( + SketchLine_2.endPoint(), SketchLine_2.startPoint(), "epaisseur" +) +Sketch_1.setVerticalDistance( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_2.startPoint(), "distance" +) + +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_4 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(50, 0, 0, 60, 100, 60.00000000000041, True) @@ -57,28 +65,52 @@ Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_3.startPoint()) Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_2.endPoint()) Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_2.startPoint()) Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_1.result()) -Sketch_1.setHorizontalDistance(SketchArc_2.center(), SketchAPI_Line(SketchLine_1).startPoint(), "largeur/2") -Sketch_1.setHorizontalDistance(SketchArc_2.endPoint(), SketchAPI_Line(SketchLine_1).startPoint(), "largeur") +Sketch_1.setHorizontalDistance( + SketchArc_2.center(), SketchAPI_Line(SketchLine_1).startPoint(), "largeur/2" +) +Sketch_1.setHorizontalDistance( + SketchArc_2.endPoint(), SketchAPI_Line(SketchLine_1).startPoint(), "largeur" +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), "hauteur", 0, "Faces|Wires") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection(), + "hauteur", + 0, + "Faces|Wires", +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) SketchCircle_1 = Sketch_2.addCircle(50, 100, 20) -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_3.createdFeature() -Sketch_2.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), "largeur/2") -Sketch_2.setVerticalDistance(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates(), "hauteur/2") +Sketch_2.setHorizontalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), "largeur/2" +) +Sketch_2.setVerticalDistance( + SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates(), "hauteur/2" +) Sketch_2.setRadius(SketchCircle_1.results()[1], "rayon") model.do() -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_2")], model.selection(), [model.selection("COMPOUND", "all-in-Extrusion_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_2")], + model.selection(), + [model.selection("COMPOUND", "all-in-Extrusion_1")], +) Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) SketchLine_5 = Sketch_3.addLine(0, 150, 100, 50) SketchLine_6 = Sketch_3.addLine(0, 50, 100, 150) -SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_4 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_7 = SketchProjection_4.createdFeature() Sketch_3.setCoincident(SketchLine_6.startPoint(), SketchLine_7.result()) SketchLine_8 = Sketch_3.addLine(0, 150, 100, 150) @@ -95,23 +127,43 @@ Sketch_3.setCoincident(SketchLine_6.endPoint(), SketchLine_8.endPoint()) Sketch_3.setLength(SketchLine_9.result(), "largeur") Sketch_3.setLength(SketchLine_8.result(), "largeur") -SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/SketchCircle_1_2__cc"), False) +SketchProjection_5 = Sketch_3.addProjection( + model.selection("VERTEX", "Sketch_2/SketchCircle_1_2__cc"), False +) SketchPoint_2 = SketchProjection_5.createdFeature() -Sketch_3.setVerticalDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_9.startPoint(), "largeur/2") -Sketch_3.setVerticalDistance(SketchLine_5.startPoint(), SketchAPI_Point(SketchPoint_2).coordinates(), "largeur/2") +Sketch_3.setVerticalDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_9.startPoint(), "largeur/2" +) +Sketch_3.setVerticalDistance( + SketchLine_5.startPoint(), SketchAPI_Point(SketchPoint_2).coordinates(), "largeur/2" +) model.do() ### Create Extrusion -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_3")], model.selection(), 100, 0, "Edges") +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_3")], + model.selection(), + 100, + 0, + "Edges", +) ### Create Split -Split_1 = model.addSplit(Part_1_doc, [model.selection("SOLID", "ExtrusionCut_1_1")], [model.selection("COMPOUND", "Extrusion_2_1")], keepSubResults = True) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "ExtrusionCut_1_1")], + [model.selection("COMPOUND", "Extrusion_2_1")], + keepSubResults=True, +) ### Create FusionFaces -FusionFaces_1 = model.addFusionFaces(Part_1_doc, model.selection("COMPSOLID", "Split_1_1")) +FusionFaces_1 = model.addFusionFaces( + Part_1_doc, model.selection("COMPSOLID", "Split_1_1") +) model.end() model.checkResult(FusionFaces_1, model, 1, [6], [6], [36], [144], [288]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestGeometryCalculation.py b/src/FeaturesPlugin/Test/TestGeometryCalculation.py index 40e327afa..8c310a880 100644 --- a/src/FeaturesPlugin/Test/TestGeometryCalculation.py +++ b/src/FeaturesPlugin/Test/TestGeometryCalculation.py @@ -20,9 +20,9 @@ """ Unit test of ... """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= import salome @@ -33,25 +33,23 @@ from ModelAPI import * from salome.shaper import model - __updated__ = "2020-11-12" -#========================================================================= +# ========================================================================= # test Geometry calculation -#========================================================================= +# ========================================================================= def test_Geometry_Calculation(): - model.begin() - file_path = os.path.join(os.getenv("DATA_DIR"),"Shapes","Brep","box1.brep") + file_path = os.path.join(os.getenv("DATA_DIR"), "Shapes", "Brep", "box1.brep") partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() - Import_1 = model.addImport(Part_1_doc,file_path) + Import_1 = model.addImport(Part_1_doc, file_path) model.do() myDelta = 1e-6 - Props = model.getGeometryCalculation(Part_1_doc,model.selection("SOLID", "box1_1")) + Props = model.getGeometryCalculation(Part_1_doc, model.selection("SOLID", "box1_1")) print(" Geometry calculation:") print(" Wires length: ", Props[0]) @@ -60,21 +58,28 @@ def test_Geometry_Calculation(): aReflength = 2400 aReslength = Props[0] - assert (math.fabs(aReslength - aReflength) < myDelta), "The surface is wrong: expected = {0}, real = {1}".format(aReflength, aReslength) + assert ( + math.fabs(aReslength - aReflength) < myDelta + ), "The surface is wrong: expected = {0}, real = {1}".format(aReflength, aReslength) aRefSurface = 240000 aResSurface = Props[1] - assert (math.fabs(aResSurface - aRefSurface) < myDelta), "The surface is wrong: expected = {0}, real = {1}".format(aRefSurface, aResSurface) + assert ( + math.fabs(aResSurface - aRefSurface) < myDelta + ), "The surface is wrong: expected = {0}, real = {1}".format( + aRefSurface, aResSurface + ) aRefVolume = 8000000 aResVolume = Props[2] - assert (math.fabs(aResVolume - aRefVolume) < myDelta), "The volume is wrong: expected = {0}, real = {1}".format(aRefVolume, aResVolume) - + assert ( + math.fabs(aResVolume - aRefVolume) < myDelta + ), "The volume is wrong: expected = {0}, real = {1}".format(aRefVolume, aResVolume) -if __name__ == '__main__': +if __name__ == "__main__": test_Geometry_Calculation() - #========================================================================= + # ========================================================================= # End of test - #========================================================================= + # ========================================================================= diff --git a/src/FeaturesPlugin/Test/TestGlueFaces_Compound.py b/src/FeaturesPlugin/Test/TestGlueFaces_Compound.py index cd970dacd..926e20f59 100644 --- a/src/FeaturesPlugin/Test/TestGlueFaces_Compound.py +++ b/src/FeaturesPlugin/Test/TestGlueFaces_Compound.py @@ -25,21 +25,38 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Param_dx = model.addParameter(Part_1_doc, "dx", '10') -Param_alfa = model.addParameter(Part_1_doc, "alfa", '0') +Param_dx = model.addParameter(Part_1_doc, "dx", "10") +Param_alfa = model.addParameter(Part_1_doc, "alfa", "0") # ============================================================================= # Test 1. Glue faces of 2 adjacent boxes in a compound # ============================================================================= 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")], axis = model.selection("EDGE", "PartSet/OX"), distance = "dx", keepSubResults = True) -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], axis = model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), angle = "alfa", keepSubResults = True) -Compound_1_Objects = [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Rotation_1_1")] +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_2_1")], + axis=model.selection("EDGE", "PartSet/OX"), + distance="dx", + keepSubResults=True, +) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + axis=model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + angle="alfa", + keepSubResults=True, +) +Compound_1_Objects = [ + model.selection("SOLID", "Box_1_1"), + model.selection("SOLID", "Rotation_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_Objects) model.do() -GlueFaces_1 = model.addGlueFaces(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], 1.0e-7, True) +GlueFaces_1 = model.addGlueFaces( + Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], 1.0e-7, True +) model.end() # gluing successful @@ -48,12 +65,14 @@ model.testCompSolid(GlueFaces_1, [2], [2], [11], [20], [12]) # ============================================================================= # Test 2. Glue faces for 2 solids with 1 common edge only # ============================================================================= -model.undo() # to reuse Box_1_1, Translation_1_1, and Rotation_1_1 +model.undo() # to reuse Box_1_1, Translation_1_1, and Rotation_1_1 model.begin() Param_alfa.setValue(90) model.do() -GlueFaces_2 = model.addGlueFaces(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], 1.0e-7, True) +GlueFaces_2 = model.addGlueFaces( + Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], 1.0e-7, True +) model.end() # no faces glued @@ -62,14 +81,16 @@ model.testCompound(GlueFaces_2, [2], [2], [12], [23], [14]) # ============================================================================= # Test 3. Glue faces for 2 solids with 2 adjacent faces above default tolerance # ============================================================================= -model.undo() # to reuse Box_1_1, Translation_1_1, and Rotation_1_1 +model.undo() # to reuse Box_1_1, Translation_1_1, and Rotation_1_1 model.begin() Param_alfa.setValue(0) Param_dx.setValue(10.0001) model.do() -GlueFaces_3 = model.addGlueFaces(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], 1.0e-7, True) +GlueFaces_3 = model.addGlueFaces( + Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], 1.0e-7, True +) model.end() # no faces glued @@ -78,11 +99,13 @@ model.testCompound(GlueFaces_3, [2], [2], [12], [24], [16]) # ============================================================================= # Test 4. Glue faces for 2 solids with 2 adjacent faces using different tolerance # ============================================================================= -model.undo() # to reuse Box_1_1, Translation_1_1, and Rotation_1_1 +model.undo() # to reuse Box_1_1, Translation_1_1, and Rotation_1_1 model.begin() -tol = 1.e-4 -GlueFaces_4 = model.addGlueFaces(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], tol, True) +tol = 1.0e-4 +GlueFaces_4 = model.addGlueFaces( + Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], tol, True +) model.end() # gluing successful @@ -91,4 +114,4 @@ model.testCompSolid(GlueFaces_4, [2], [2], [11], [20], [12]) # ============================================================================= # Test 5. Check Python dump # ============================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestGlueFaces_Faces.py b/src/FeaturesPlugin/Test/TestGlueFaces_Faces.py index a86250e10..6f23e7b09 100644 --- a/src/FeaturesPlugin/Test/TestGlueFaces_Faces.py +++ b/src/FeaturesPlugin/Test/TestGlueFaces_Faces.py @@ -31,10 +31,18 @@ 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")], axis = model.selection("EDGE", "PartSet/OX"), distance = 10, keepSubResults = True) -Copy_1_objects = [model.selection("FACE", "Box_1_1/Top"), - model.selection("FACE", "Translation_1_1/MF:Translated&Box_2_1/Top"), - model.selection("FACE", "Translation_1_1/MF:Translated&Box_2_1/Left")] +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_2_1")], + axis=model.selection("EDGE", "PartSet/OX"), + distance=10, + keepSubResults=True, +) +Copy_1_objects = [ + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_2_1/Top"), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_2_1/Left"), +] Copy_1 = model.addCopy(Part_1_doc, Copy_1_objects, 1) Copy_1.result().setName("Box_1_1_1") Copy_1.results()[1].setName("Translation_1_1_1") @@ -44,7 +52,12 @@ model.do() # ============================================================================= # Test 1. Glue faces of 2 adjacent solids # ============================================================================= -GlueFaces_1 = model.addGlueFaces(Part_1_doc, [model.selection("SOLID", "Translation_1_1"), model.selection("SOLID", "Box_1_1")], 1e-07, True) +GlueFaces_1 = model.addGlueFaces( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1"), model.selection("SOLID", "Box_1_1")], + 1e-07, + True, +) model.do() # gluing successful @@ -53,7 +66,15 @@ model.testCompSolid(GlueFaces_1, [2], [2], [11], [20], [12]) # ============================================================================= # Test 2. Glue faces for 2 faces with 1 common edge only # ============================================================================= -GlueFaces_2 = model.addGlueFaces(Part_1_doc, [model.selection("FACE", "Box_1_1_1"), model.selection("FACE", "Translation_1_1_1")], 1e-07, True) +GlueFaces_2 = model.addGlueFaces( + Part_1_doc, + [ + model.selection("FACE", "Box_1_1_1"), + model.selection("FACE", "Translation_1_1_1"), + ], + 1e-07, + True, +) GlueFaces_2.result().setName("GlueFaces_2_1") GlueFaces_2.result().subResult(0).setName("GlueFaces_2_1_1") GlueFaces_2.result().subResult(1).setName("GlueFaces_2_1_2") @@ -66,7 +87,15 @@ model.testCompound(GlueFaces_2, [2], [0], [2], [7], [6]) # Test 3. Glue faces for 1 solid and 1 faces with 1 common edge # ============================================================================= Recover_1 = model.addRecover(Part_1_doc, GlueFaces_1, [Box_1.result()]) -GlueFaces_3 = model.addGlueFaces(Part_1_doc, [model.selection("FACE", "Translation_1_1_2"), model.selection("SOLID", "Recover_1_1")], 1e-07, True) +GlueFaces_3 = model.addGlueFaces( + Part_1_doc, + [ + model.selection("FACE", "Translation_1_1_2"), + model.selection("SOLID", "Recover_1_1"), + ], + 1e-07, + True, +) GlueFaces_3.result().setName("GlueFaces_3_1") GlueFaces_3.result().subResult(0).setName("GlueFaces_3_1_1") GlueFaces_3.result().subResult(1).setName("GlueFaces_3_1_2") diff --git a/src/FeaturesPlugin/Test/TestGlueFaces_Shell.py b/src/FeaturesPlugin/Test/TestGlueFaces_Shell.py index 3acbe7395..04f0f3c70 100644 --- a/src/FeaturesPlugin/Test/TestGlueFaces_Shell.py +++ b/src/FeaturesPlugin/Test/TestGlueFaces_Shell.py @@ -25,23 +25,46 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Param_dx = model.addParameter(Part_1_doc, "dx", '10') -Param_alfa = model.addParameter(Part_1_doc, "alfa", '0') +Param_dx = model.addParameter(Part_1_doc, "dx", "10") +Param_alfa = model.addParameter(Part_1_doc, "alfa", "0") # ============================================================================= # Test 1. Glue faces of 2 adjacent shells # ============================================================================= 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")], axis = model.selection("EDGE", "PartSet/OX"), distance = "dx", keepSubResults = True) -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], axis = model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), angle = "alfa", keepSubResults = True) -Shell_1_Objects = [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Front")] +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_2_1")], + axis=model.selection("EDGE", "PartSet/OX"), + distance="dx", + keepSubResults=True, +) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + axis=model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + angle="alfa", + keepSubResults=True, +) +Shell_1_Objects = [ + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Front"), +] Shell_1 = model.addShell(Part_1_doc, Shell_1_Objects) -Shell_2_Objects = [model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Top"), model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Back")] +Shell_2_Objects = [ + model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Top"), + model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Back"), +] Shell_2 = model.addShell(Part_1_doc, Shell_2_Objects) model.do() -GlueFaces_1 = model.addGlueFaces(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_2_1")], 1.0e-7, True) +GlueFaces_1 = model.addGlueFaces( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_2_1")], + 1.0e-7, + True, +) model.end() # gluing successful @@ -50,12 +73,17 @@ model.testCompound(GlueFaces_1, [2], [0], [3], [10], [8]) # ============================================================================= # Test 2. Glue faces for 2 shells with 1 common edge only # ============================================================================= -model.undo() # to reuse the 2 shells +model.undo() # to reuse the 2 shells model.begin() Param_alfa.setValue(90) model.do() -GlueFaces_2 = model.addGlueFaces(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_2_1")], 1.0e-7, True) +GlueFaces_2 = model.addGlueFaces( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_2_1")], + 1.0e-7, + True, +) model.end() # gluing successful @@ -64,14 +92,19 @@ model.testCompound(GlueFaces_2, [2], [0], [4], [13], [10]) # ============================================================================= # Test 3. Glue faces for 2 shells with 2 adjacent faces above default tolerance # ============================================================================= -model.undo() # to reuse the 2 shells +model.undo() # to reuse the 2 shells model.begin() Param_alfa.setValue(0) Param_dx.setValue(10.0001) model.do() -GlueFaces_3 = model.addGlueFaces(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_2_1")], 1.0e-7, True) +GlueFaces_3 = model.addGlueFaces( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_2_1")], + 1.0e-7, + True, +) model.end() # no faces glued @@ -80,11 +113,16 @@ model.testCompound(GlueFaces_3, [2], [0], [4], [14], [12]) # ============================================================================= # Test 4. Glue faces for 2 solids with 2 adjacent faces using different tolerance # ============================================================================= -model.undo() # to reuse Box_1_1, Translation_1_1, and Rotation_1_1 +model.undo() # to reuse Box_1_1, Translation_1_1, and Rotation_1_1 model.begin() -tol = 1.e-4 -GlueFaces_4 = model.addGlueFaces(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_2_1")], tol, True) +tol = 1.0e-4 +GlueFaces_4 = model.addGlueFaces( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_2_1")], + tol, + True, +) model.end() # gluing successful @@ -93,4 +131,4 @@ model.testCompound(GlueFaces_4, [2], [0], [3], [10], [8]) # ============================================================================= # Test 5. Check Python dump # ============================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestGlueFaces_Solids.py b/src/FeaturesPlugin/Test/TestGlueFaces_Solids.py index df8c6259e..ff43fc439 100644 --- a/src/FeaturesPlugin/Test/TestGlueFaces_Solids.py +++ b/src/FeaturesPlugin/Test/TestGlueFaces_Solids.py @@ -25,19 +25,36 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Param_dx = model.addParameter(Part_1_doc, "dx", '10') -Param_alfa = model.addParameter(Part_1_doc, "alfa", '0') +Param_dx = model.addParameter(Part_1_doc, "dx", "10") +Param_alfa = model.addParameter(Part_1_doc, "alfa", "0") # ============================================================================= # Test 1. Glue faces of 2 adjacent boxes # ============================================================================= 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")], axis = model.selection("EDGE", "PartSet/OX"), distance = "dx", keepSubResults = True) -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], axis = model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), angle = "alfa", keepSubResults = True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_2_1")], + axis=model.selection("EDGE", "PartSet/OX"), + distance="dx", + keepSubResults=True, +) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + axis=model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + angle="alfa", + keepSubResults=True, +) model.do() -GlueFaces_1 = model.addGlueFaces(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Rotation_1_1")], 1.0e-7, True) +GlueFaces_1 = model.addGlueFaces( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Rotation_1_1")], + 1.0e-7, + True, +) model.end() # gluing successful @@ -46,12 +63,17 @@ model.testCompSolid(GlueFaces_1, [2], [2], [11], [20], [12]) # ============================================================================= # Test 2. Glue faces for 2 solids with 1 common edge only # ============================================================================= -model.undo() # to reuse Box_1_1, Translation_1_1, and Rotation_1_1 +model.undo() # to reuse Box_1_1, Translation_1_1, and Rotation_1_1 model.begin() Param_alfa.setValue(90) model.do() -GlueFaces_2 = model.addGlueFaces(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Rotation_1_1")], 1.0e-7, True) +GlueFaces_2 = model.addGlueFaces( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Rotation_1_1")], + 1.0e-7, + True, +) model.end() # gluing successful @@ -60,14 +82,19 @@ model.testCompound(GlueFaces_2, [2], [2], [12], [23], [14]) # ============================================================================= # Test 3. Glue faces for 2 solids with 2 adjacent faces above default tolerance # ============================================================================= -model.undo() # to reuse Box_1_1, Translation_1_1, and Rotation_1_1 +model.undo() # to reuse Box_1_1, Translation_1_1, and Rotation_1_1 model.begin() Param_alfa.setValue(0) Param_dx.setValue(10.0001) model.do() -GlueFaces_3 = model.addGlueFaces(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Rotation_1_1")], 1.0e-7, True) +GlueFaces_3 = model.addGlueFaces( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Rotation_1_1")], + 1.0e-7, + True, +) model.end() # no faces glued @@ -76,11 +103,16 @@ model.testCompound(GlueFaces_3, [2], [2], [12], [24], [16]) # ============================================================================= # Test 4. Glue faces for 2 solids with 2 adjacent faces using different tolerance # ============================================================================= -model.undo() # to reuse Box_1_1, Translation_1_1, and Rotation_1_1 +model.undo() # to reuse Box_1_1, Translation_1_1, and Rotation_1_1 model.begin() -tol = 1.e-4 -GlueFaces_4 = model.addGlueFaces(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Rotation_1_1")], tol, True) +tol = 1.0e-4 +GlueFaces_4 = model.addGlueFaces( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Rotation_1_1")], + tol, + True, +) model.end() # gluing successful @@ -89,4 +121,4 @@ model.testCompSolid(GlueFaces_4, [2], [2], [11], [20], [12]) # ============================================================================= # Test 5. Check Python dump # ============================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestImportResult.py b/src/FeaturesPlugin/Test/TestImportResult.py index 54d490955..9bb8fefbc 100644 --- a/src/FeaturesPlugin/Test/TestImportResult.py +++ b/src/FeaturesPlugin/Test/TestImportResult.py @@ -28,7 +28,13 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(15, 13, 11) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], + model.selection(), + 10, + 0, +) model.do() Part_2 = model.addPart(partSet) @@ -36,8 +42,16 @@ Part_2_doc = Part_2.document() Sketch_2 = model.addSketch(Part_2_doc, model.defaultPlane("XOZ")) SketchCircle_2 = Sketch_2.addCircle(-13, -9, 5) model.do() -Extrusion_2 = model.addExtrusion(Part_2_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0) -ImportResult_1 = model.addImportResult(Part_2_doc, [model.selection("SOLID", "Part_1/Extrusion_1_1")]) +Extrusion_2 = model.addExtrusion( + Part_2_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], + model.selection(), + 10, + 0, +) +ImportResult_1 = model.addImportResult( + Part_2_doc, [model.selection("SOLID", "Part_1/Extrusion_1_1")] +) model.do() Part_3 = model.addPart(partSet) @@ -51,13 +65,13 @@ model.do() model.end() # check Part_2 is ok and contains 2 solids in result -assert(Part_2.feature().results().size() == 1) +assert Part_2.feature().results().size() == 1 aPartShape = Part_2.feature().firstResult().shape() -assert(aPartShape.shapeTypeStr() == "COMPOUND") +assert aPartShape.shapeTypeStr() == "COMPOUND" aShapeExplorer = GeomAPI_ShapeExplorer(aPartShape, GeomAPI_Shape.SOLID) -assert(aShapeExplorer.more()) +assert aShapeExplorer.more() aShapeExplorer.next() -assert(aShapeExplorer.more()) +assert aShapeExplorer.more() # check that selection of this part and the lower part is impossible (by validator) model.begin() @@ -65,20 +79,20 @@ aSel = ImportResult_1.feature().selectionList("objects").value(0) aSel.selectSubShape("SOLID", "Part_2/Extrusion_1_1") model.end() aFactory = ModelAPI_Session.get().validators() -assert(not aFactory.validate(ImportResult_1.feature())) +assert not aFactory.validate(ImportResult_1.feature()) model.begin() aSel = ImportResult_1.feature().selectionList("objects").value(0) aSel.selectSubShape("SOLID", "Part_3/Extrusion_1_1") model.end() -assert(not aFactory.validate(ImportResult_1.feature())) +assert not aFactory.validate(ImportResult_1.feature()) # back to correct value model.begin() aSel = ImportResult_1.feature().selectionList("objects").value(0) aSel.selectSubShape("SOLID", "Part_1/Extrusion_1_1") model.end() -assert(aFactory.validate(ImportResult_1.feature())) +assert aFactory.validate(ImportResult_1.feature()) # TODO: implement for GEOMOETRICAL also -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/TestImportResultWithGroups1.py b/src/FeaturesPlugin/Test/TestImportResultWithGroups1.py index c74300dd2..f81e233ae 100644 --- a/src/FeaturesPlugin/Test/TestImportResultWithGroups1.py +++ b/src/FeaturesPlugin/Test/TestImportResultWithGroups1.py @@ -27,16 +27,29 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Groups -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Top")]) -Group_2 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")]) -GroupAddition_1 = model.addGroupAddition(Part_1_doc, [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")]) +Group_1 = model.addGroup( + Part_1_doc, + "Faces", + [model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Top")], +) +Group_2 = model.addGroup( + Part_1_doc, + "Faces", + [model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Top")], +) +GroupAddition_1 = model.addGroupAddition( + Part_1_doc, + [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")], +) model.do() ### Create Part 2 Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() -ImportResult_1 = model.addImportResult(Part_2_doc, [model.selection("SOLID", "Part_1/Box_1_1")]) +ImportResult_1 = model.addImportResult( + Part_2_doc, [model.selection("SOLID", "Part_1/Box_1_1")] +) model.end() @@ -44,9 +57,9 @@ from GeomAPI import * from ModelAPI import * import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -assert(ImportResult_1.feature().error() == "") +assert ImportResult_1.feature().error() == "" model.testNbResults(ImportResult_1, 1) model.testNbSubResults(ImportResult_1, [0]) model.testNbSubShapes(ImportResult_1, GeomAPI_Shape.SOLID, [1]) @@ -57,22 +70,28 @@ model.testResultsVolumes(ImportResult_1, [1000]) model.testResultsAreas(ImportResult_1, [600]) # check groups are the same in both parts -assert(Part_1_doc.size("Groups") == Part_2_doc.size("Groups")) +assert Part_1_doc.size("Groups") == Part_2_doc.size("Groups") for ind in range(0, Part_1_doc.size("Groups")): res1 = objectToResult(Part_1_doc.object("Groups", ind)) res2 = objectToResult(Part_2_doc.object("Groups", ind)) - assert(res1 is not None) - assert(res2 is not None) + assert res1 is not None + assert res2 is not None res1It = GeomAPI_ShapeExplorer(res1.shape(), GeomAPI_Shape.FACE) res2It = GeomAPI_ShapeExplorer(res2.shape(), GeomAPI_Shape.FACE) while res1It.more() and res2It.more(): shape1 = res1It.current() shape2 = res2It.current() - assert(shape1.shapeType() == shape2.shapeType()) + assert shape1.shapeType() == shape2.shapeType() res1It.next() res2It.next() p1 = res1.shape().middlePoint() p2 = res2.shape().middlePoint() - assert(math.fabs(p1.x() - p2.x()) <= TOLERANCE and math.fabs(p1.y() - p2.y()) <= TOLERANCE and math.fabs(p1.z() - p2.z()) <= TOLERANCE), "({}, {}, {}) != ({}, {}, {})".format(p1.x(), p1.y(), p1.z(), p2.x(), p2.y(), p2.z()) + assert ( + math.fabs(p1.x() - p2.x()) <= TOLERANCE + and math.fabs(p1.y() - p2.y()) <= TOLERANCE + and math.fabs(p1.z() - p2.z()) <= TOLERANCE + ), "({}, {}, {}) != ({}, {}, {})".format( + p1.x(), p1.y(), p1.z(), p2.x(), p2.y(), p2.z() + ) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestImportResultWithGroups2.py b/src/FeaturesPlugin/Test/TestImportResultWithGroups2.py index 4dc395924..93cdfc4ee 100644 --- a/src/FeaturesPlugin/Test/TestImportResultWithGroups2.py +++ b/src/FeaturesPlugin/Test/TestImportResultWithGroups2.py @@ -27,13 +27,39 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Top")]) +Group_1 = model.addGroup( + Part_1_doc, + "Faces", + [model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Top")], +) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Group_2 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Cylinder_1_1/Face_1"), model.selection("FACE", "Box_1_1/Front")]) -Group_3 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Cylinder_1_1/Face_1")]) -GroupAddition_1 = model.addGroupAddition(Part_1_doc, [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")]) -GroupSubstraction_1 = model.addGroupSubstraction(Part_1_doc, [model.selection("COMPOUND", "GroupAddition_1")], [model.selection("COMPOUND", "Group_3")]) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Group_2 = model.addGroup( + Part_1_doc, + "Faces", + [ + model.selection("FACE", "Cylinder_1_1/Face_1"), + model.selection("FACE", "Box_1_1/Front"), + ], +) +Group_3 = model.addGroup( + Part_1_doc, "Faces", [model.selection("FACE", "Cylinder_1_1/Face_1")] +) +GroupAddition_1 = model.addGroupAddition( + Part_1_doc, + [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")], +) +GroupSubstraction_1 = model.addGroupSubstraction( + Part_1_doc, + [model.selection("COMPOUND", "GroupAddition_1")], + [model.selection("COMPOUND", "Group_3")], +) model.do() @@ -42,7 +68,13 @@ Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() ### Create ImportResult -ImportResult_1 = model.addImportResult(Part_2_doc, [model.selection("SOLID", "Part_1/Box_1_1"), model.selection("SOLID", "Part_1/Cylinder_1_1")]) +ImportResult_1 = model.addImportResult( + Part_2_doc, + [ + model.selection("SOLID", "Part_1/Box_1_1"), + model.selection("SOLID", "Part_1/Cylinder_1_1"), + ], +) model.end() @@ -50,9 +82,9 @@ from GeomAPI import * from ModelAPI import * import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -assert(ImportResult_1.feature().error() == "") +assert ImportResult_1.feature().error() == "" model.testNbResults(ImportResult_1, 2) model.testNbSubResults(ImportResult_1, [0, 0]) model.testNbSubShapes(ImportResult_1, GeomAPI_Shape.SOLID, [1, 1]) @@ -63,23 +95,29 @@ model.testResultsVolumes(ImportResult_1, [1000, 785.3981634]) model.testResultsAreas(ImportResult_1, [600, 471.238898]) # check groups are the same in both parts -assert(Part_1_doc.size("Groups") == Part_2_doc.size("Groups")) +assert Part_1_doc.size("Groups") == Part_2_doc.size("Groups") REFIND = [0, 1, 3, 4, 2] for ind in range(0, Part_1_doc.size("Groups")): res1 = objectToResult(Part_1_doc.object("Groups", REFIND[ind])) res2 = objectToResult(Part_2_doc.object("Groups", ind)) - assert(res1 is not None) - assert(res2 is not None) + assert res1 is not None + assert res2 is not None res1It = GeomAPI_ShapeExplorer(res1.shape(), GeomAPI_Shape.FACE) res2It = GeomAPI_ShapeExplorer(res2.shape(), GeomAPI_Shape.FACE) while res1It.more() and res2It.more(): shape1 = res1It.current() shape2 = res2It.current() - assert(shape1.shapeType() == shape2.shapeType()) + assert shape1.shapeType() == shape2.shapeType() res1It.next() res2It.next() p1 = res1.shape().middlePoint() p2 = res2.shape().middlePoint() - assert(math.fabs(p1.x() - p2.x()) <= TOLERANCE and math.fabs(p1.y() - p2.y()) <= TOLERANCE and math.fabs(p1.z() - p2.z()) <= TOLERANCE), "({}, {}, {}) != ({}, {}, {})".format(p1.x(), p1.y(), p1.z(), p2.x(), p2.y(), p2.z()) + assert ( + math.fabs(p1.x() - p2.x()) <= TOLERANCE + and math.fabs(p1.y() - p2.y()) <= TOLERANCE + and math.fabs(p1.z() - p2.z()) <= TOLERANCE + ), "({}, {}, {}) != ({}, {}, {})".format( + p1.x(), p1.y(), p1.z(), p2.x(), p2.y(), p2.z() + ) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestImportResultWithGroups3.py b/src/FeaturesPlugin/Test/TestImportResultWithGroups3.py index 63b70bde5..f82700aa5 100644 --- a/src/FeaturesPlugin/Test/TestImportResultWithGroups3.py +++ b/src/FeaturesPlugin/Test/TestImportResultWithGroups3.py @@ -27,13 +27,39 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Top")]) +Group_1 = model.addGroup( + Part_1_doc, + "Faces", + [model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Top")], +) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Group_2 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Cylinder_1_1/Face_1"), model.selection("FACE", "Box_1_1/Front")]) -Group_3 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Cylinder_1_1/Face_1")]) -GroupAddition_1 = model.addGroupAddition(Part_1_doc, [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")]) -GroupSubstraction_1 = model.addGroupSubstraction(Part_1_doc, [model.selection("COMPOUND", "GroupAddition_1")], [model.selection("COMPOUND", "Group_3")]) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Group_2 = model.addGroup( + Part_1_doc, + "Faces", + [ + model.selection("FACE", "Cylinder_1_1/Face_1"), + model.selection("FACE", "Box_1_1/Front"), + ], +) +Group_3 = model.addGroup( + Part_1_doc, "Faces", [model.selection("FACE", "Cylinder_1_1/Face_1")] +) +GroupAddition_1 = model.addGroupAddition( + Part_1_doc, + [model.selection("COMPOUND", "Group_1"), model.selection("COMPOUND", "Group_2")], +) +GroupSubstraction_1 = model.addGroupSubstraction( + Part_1_doc, + [model.selection("COMPOUND", "GroupAddition_1")], + [model.selection("COMPOUND", "Group_3")], +) model.do() @@ -42,7 +68,9 @@ Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() ### Create ImportResult -ImportResult_1 = model.addImportResult(Part_2_doc, [model.selection("SOLID", "Part_1/Box_1_1")]) +ImportResult_1 = model.addImportResult( + Part_2_doc, [model.selection("SOLID", "Part_1/Box_1_1")] +) model.end() @@ -50,9 +78,9 @@ from GeomAPI import * from ModelAPI import * import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -assert(ImportResult_1.feature().error() == "") +assert ImportResult_1.feature().error() == "" model.testNbResults(ImportResult_1, 1) model.testNbSubResults(ImportResult_1, [0]) model.testNbSubShapes(ImportResult_1, GeomAPI_Shape.SOLID, [1]) @@ -63,25 +91,31 @@ model.testResultsVolumes(ImportResult_1, [1000]) model.testResultsAreas(ImportResult_1, [600]) # check imported groups are correct -assert(Part_1_doc.size("Groups") == 5) -assert(Part_2_doc.size("Groups") == 4) -REFERENCE = [(2, 5.0, 5.0, 5.0), - (1, 10.0, 5.0, 5.0), - (3, 5.0, 5.0, 5.0), - (3, 5.0, 5.0, 5.0)] +assert Part_1_doc.size("Groups") == 5 +assert Part_2_doc.size("Groups") == 4 +REFERENCE = [ + (2, 5.0, 5.0, 5.0), + (1, 10.0, 5.0, 5.0), + (3, 5.0, 5.0, 5.0), + (3, 5.0, 5.0, 5.0), +] for ind in range(0, Part_2_doc.size("Groups")): res = objectToResult(Part_2_doc.object("Groups", ind)) - assert(res is not None) + assert res is not None nbShapes = 0 it = GeomAPI_ShapeExplorer(res.shape(), GeomAPI_Shape.FACE) while it.more(): nbShapes += 1 it.next() - assert(nbShapes == REFERENCE[ind][0]) + assert nbShapes == REFERENCE[ind][0] p = res.shape().middlePoint() x = REFERENCE[ind][1] y = REFERENCE[ind][2] z = REFERENCE[ind][3] - assert(math.fabs(p.x() - x) <= TOLERANCE and math.fabs(p.y() - y) <= TOLERANCE and math.fabs(p.z() - z) <= TOLERANCE), "({}, {}, {}) != ({}, {}, {})".format(p.x(), p.y(), p.z(), x, y, z) + assert ( + math.fabs(p.x() - x) <= TOLERANCE + and math.fabs(p.y() - y) <= TOLERANCE + and math.fabs(p.z() - z) <= TOLERANCE + ), "({}, {}, {}) != ({}, {}, {})".format(p.x(), p.y(), p.z(), x, y, z) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestIntersection.py b/src/FeaturesPlugin/Test/TestIntersection.py index 6fb484996..16df3f511 100644 --- a/src/FeaturesPlugin/Test/TestIntersection.py +++ b/src/FeaturesPlugin/Test/TestIntersection.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -32,15 +32,15 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +assert len(aPartFeature.results()) == 1 # Another way is: # aPart = aSession.activeDocument() aPartResult = modelAPI_ResultPart(aPartFeature.firstResult()) aPart = aPartResult.partDoc() -#========================================================================= +# ========================================================================= # Create a sketch circle to extrude 1 -#========================================================================= +# ========================================================================= aSession.startOperation() aCircleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")) @@ -57,36 +57,37 @@ anCircleCentr.setValue(-10, 0) aCircleRadius.setValue(50) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on circle 1 -#========================================================================= +# ========================================================================= # Build shape from sketcher results aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult()) -assert (aCircleSketchResult.facesNum() > 0) +assert aCircleSketchResult.facesNum() > 0 # Create extrusion aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "Extrusion") +assert anExtrusionFt.getKind() == "Extrusion" # selection type FACE=4 anExtrusionFt.selectionList("base").append( - aCircleSketchResult, aCircleSketchResult.face(0)) + aCircleSketchResult, aCircleSketchResult.face(0) +) 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.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) +assert anExtrusionFt.real("to_size").value() == 50 # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult1 = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult1 is not None) +assert anExtrusionResult1 is not None -#========================================================================= +# ========================================================================= # Create a sketch circle to extrude 2 -#========================================================================= +# ========================================================================= aSession.startOperation() aCircleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")) @@ -103,52 +104,54 @@ anCircleCentr.setValue(10, 0) aCircleRadius.setValue(50) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on circle 2 -#========================================================================= +# ========================================================================= # Build shape from sketcher results aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult()) -assert (aCircleSketchResult.facesNum() > 0) +assert aCircleSketchResult.facesNum() > 0 # Create extrusion aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "Extrusion") +assert anExtrusionFt.getKind() == "Extrusion" # selection type FACE=4 anExtrusionFt.selectionList("base").append( - aCircleSketchResult, aCircleSketchResult.face(0)) + aCircleSketchResult, aCircleSketchResult.face(0) +) 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.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) +assert anExtrusionFt.real("to_size").value() == 50 # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult2 = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult2 is not None) +assert anExtrusionResult2 is not None -#========================================================================= +# ========================================================================= # Create an intersection -#========================================================================= +# ========================================================================= aSession.startOperation() anIntersectionFt = aPart.addFeature("Intersection") -assert (anIntersectionFt.getKind() == "Intersection") +assert anIntersectionFt.getKind() == "Intersection" anIntersectionFt.selectionList("main_objects").append(anExtrusionResult1, None) anIntersectionFt.selectionList("main_objects").append(anExtrusionResult2, None) anIntersectionFt.execute() aSession.finishOperation() -#========================================================================= +# ========================================================================= # Test results -#========================================================================= +# ========================================================================= aFactory = ModelAPI_Session.get().validators() -assert (aFactory.validate(anIntersectionFt)) -assert (len(anIntersectionFt.results()) > 0) +assert aFactory.validate(anIntersectionFt) +assert len(anIntersectionFt.results()) > 0 anItersectionResult = modelAPI_ResultBody(anIntersectionFt.firstResult()) -assert (anItersectionResult is not None) +assert anItersectionResult is not None from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestIntersection_ErrorMsg.py b/src/FeaturesPlugin/Test/TestIntersection_ErrorMsg.py index 425f8a688..1ebeb0458 100644 --- a/src/FeaturesPlugin/Test/TestIntersection_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestIntersection_ErrorMsg.py @@ -27,8 +27,10 @@ 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() != "") +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() diff --git a/src/FeaturesPlugin/Test/TestIntersection_MultiLevelCompound_v0_1.py b/src/FeaturesPlugin/Test/TestIntersection_MultiLevelCompound_v0_1.py index c82a536c7..2a1a58f7a 100644 --- a/src/FeaturesPlugin/Test/TestIntersection_MultiLevelCompound_v0_1.py +++ b/src/FeaturesPlugin/Test/TestIntersection_MultiLevelCompound_v0_1.py @@ -24,11 +24,37 @@ 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/OX"), 20, 2) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 5) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), model.selection("EDGE", "PartSet/OX"), 30) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1"), model.selection("FACE", "Plane_1")]) -Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_1"), model.selection("SOLID", "Partition_1_1_1")]) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 5, +) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOY"), + model.selection("EDGE", "PartSet/OX"), + 30, +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1"), model.selection("FACE", "Plane_1")], +) +Intersection_1 = model.addIntersection( + Part_1_doc, + [ + model.selection("SOLID", "LinearCopy_1_1_1"), + model.selection("SOLID", "Partition_1_1_1"), + ], +) model.end() from GeomAPI import * @@ -41,4 +67,4 @@ model.testNbSubShapes(Intersection_1, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Intersection_1, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Intersection_1, [0]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestIntersection_MultiLevelCompound_v0_2.py b/src/FeaturesPlugin/Test/TestIntersection_MultiLevelCompound_v0_2.py index f6a989dac..bccaecf7b 100644 --- a/src/FeaturesPlugin/Test/TestIntersection_MultiLevelCompound_v0_2.py +++ b/src/FeaturesPlugin/Test/TestIntersection_MultiLevelCompound_v0_2.py @@ -24,10 +24,34 @@ 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/OX"), 20, 2) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 3) -Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_1"), model.selection("SOLID", "LinearCopy_2_1_1")]) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OY"), + 20, + 3, +) +Intersection_1 = model.addIntersection( + Part_1_doc, + [ + model.selection("SOLID", "LinearCopy_1_1_1"), + model.selection("SOLID", "LinearCopy_2_1_1"), + ], +) model.end() from GeomAPI import * @@ -40,4 +64,4 @@ model.testNbSubShapes(Intersection_1, GeomAPI_Shape.EDGE, [8]) model.testNbSubShapes(Intersection_1, GeomAPI_Shape.VERTEX, [16]) model.testResultsVolumes(Intersection_1, [0]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestIntersection_MultiLevelCompound_v95_1.py b/src/FeaturesPlugin/Test/TestIntersection_MultiLevelCompound_v95_1.py index bcb1bcf1f..50b3d01b4 100644 --- a/src/FeaturesPlugin/Test/TestIntersection_MultiLevelCompound_v95_1.py +++ b/src/FeaturesPlugin/Test/TestIntersection_MultiLevelCompound_v95_1.py @@ -24,11 +24,40 @@ 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/OX"), 20, 2, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 5) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), model.selection("EDGE", "PartSet/OX"), 30) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1"), model.selection("FACE", "Plane_1")], keepSubResults = True) -Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_1"), model.selection("SOLID", "Partition_1_1_1")], keepSubResults = True) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, + keepSubResults=True, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 5, +) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOY"), + model.selection("EDGE", "PartSet/OX"), + 30, +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1"), model.selection("FACE", "Plane_1")], + keepSubResults=True, +) +Intersection_1 = model.addIntersection( + Part_1_doc, + [ + model.selection("SOLID", "LinearCopy_1_1_1"), + model.selection("SOLID", "Partition_1_1_1"), + ], + keepSubResults=True, +) model.end() from GeomAPI import * @@ -41,4 +70,4 @@ model.testNbSubShapes(Intersection_1, GeomAPI_Shape.EDGE, [30]) model.testNbSubShapes(Intersection_1, GeomAPI_Shape.VERTEX, [60]) model.testResultsVolumes(Intersection_1, [1000]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestIntersection_MultiLevelCompound_v95_2.py b/src/FeaturesPlugin/Test/TestIntersection_MultiLevelCompound_v95_2.py index 813417548..5b748b166 100644 --- a/src/FeaturesPlugin/Test/TestIntersection_MultiLevelCompound_v95_2.py +++ b/src/FeaturesPlugin/Test/TestIntersection_MultiLevelCompound_v95_2.py @@ -24,10 +24,37 @@ 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/OX"), 20, 2, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 3, keepSubResults = True) -Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_1"), model.selection("SOLID", "LinearCopy_2_1_1")], keepSubResults = True) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, + keepSubResults=True, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OY"), + 20, + 3, + keepSubResults=True, +) +Intersection_1 = model.addIntersection( + Part_1_doc, + [ + model.selection("SOLID", "LinearCopy_1_1_1"), + model.selection("SOLID", "LinearCopy_2_1_1"), + ], + keepSubResults=True, +) model.end() from GeomAPI import * @@ -40,4 +67,4 @@ model.testNbSubShapes(Intersection_1, GeomAPI_Shape.EDGE, [44]) model.testNbSubShapes(Intersection_1, GeomAPI_Shape.VERTEX, [88]) model.testResultsVolumes(Intersection_1, [2570.79632679489714]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestLimitTolerance.py b/src/FeaturesPlugin/Test/TestLimitTolerance.py index c818bd7eb..efe17feef 100644 --- a/src/FeaturesPlugin/Test/TestLimitTolerance.py +++ b/src/FeaturesPlugin/Test/TestLimitTolerance.py @@ -31,8 +31,11 @@ Point_2 = model.addPoint(Part_1_doc, 1, 0, 0) Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_2")]) model.do() -Partition_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_2_1")] -Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults = True) +Partition_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("VERTEX", "Vertex_2_1"), +] +Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults=True) model.end() model.testNbResults(Partition_1, 1) @@ -41,8 +44,11 @@ model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [2]) model.undo() model.begin() -Fuse_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_2_1")] -Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects, True, keepSubResults = True) +Fuse_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("VERTEX", "Vertex_2_1"), +] +Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects, True, keepSubResults=True) model.end() model.testNbResults(Fuse_1, 1) @@ -51,12 +57,19 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [2]) model.undo() model.begin() -LimitTolerance_1 = model.addLimitTolerance(Part_1_doc, model.selection("VERTEX", "Vertex_1_1"), 0.6) -LimitTolerance_2 = model.addLimitTolerance(Part_1_doc, model.selection("VERTEX", "Vertex_2_1"), 0.6) +LimitTolerance_1 = model.addLimitTolerance( + Part_1_doc, model.selection("VERTEX", "Vertex_1_1"), 0.6 +) +LimitTolerance_2 = model.addLimitTolerance( + Part_1_doc, model.selection("VERTEX", "Vertex_2_1"), 0.6 +) model.do() -Partition_2_objects = [model.selection("VERTEX", "LimitTolerance_1_1"), model.selection("VERTEX", "LimitTolerance_2_1")] -Partition_2 = model.addPartition(Part_1_doc, Partition_2_objects, keepSubResults = True) +Partition_2_objects = [ + model.selection("VERTEX", "LimitTolerance_1_1"), + model.selection("VERTEX", "LimitTolerance_2_1"), +] +Partition_2 = model.addPartition(Part_1_doc, Partition_2_objects, keepSubResults=True) model.end() model.testNbResults(Partition_2, 1) @@ -65,8 +78,11 @@ model.testNbSubShapes(Partition_2, GeomAPI_Shape.VERTEX, [1]) model.undo() model.begin() -Fuse_2_objects = [model.selection("VERTEX", "LimitTolerance_1_1"), model.selection("VERTEX", "LimitTolerance_2_1")] -Fuse_2 = model.addFuse(Part_1_doc, Fuse_2_objects, True, keepSubResults = True) +Fuse_2_objects = [ + model.selection("VERTEX", "LimitTolerance_1_1"), + model.selection("VERTEX", "LimitTolerance_2_1"), +] +Fuse_2 = model.addFuse(Part_1_doc, Fuse_2_objects, True, keepSubResults=True) model.end() model.testNbResults(Fuse_2, 1) diff --git a/src/FeaturesPlugin/Test/TestLimitTolerance_Face.py b/src/FeaturesPlugin/Test/TestLimitTolerance_Face.py index 4e36e1368..dbaab5db7 100644 --- a/src/FeaturesPlugin/Test/TestLimitTolerance_Face.py +++ b/src/FeaturesPlugin/Test/TestLimitTolerance_Face.py @@ -46,10 +46,19 @@ Import_2.setName("Face_1") Import_2.result().setName("Face_1_1") # Limit the tolerance of the planar face (in order to get a good intersection result) -LimitTolerance_1 = model.addLimitTolerance(Part_1_doc, model.selection("FACE", "Face_1_1"), 0.0001) +LimitTolerance_1 = model.addLimitTolerance( + Part_1_doc, model.selection("FACE", "Face_1_1"), 0.0001 +) # Create intersection -Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("FACE", "LimitTolerance_1_1"), model.selection("FACE", "Torus_1_1")], keepSubResults = True) +Intersection_1 = model.addIntersection( + Part_1_doc, + [ + model.selection("FACE", "LimitTolerance_1_1"), + model.selection("FACE", "Torus_1_1"), + ], + keepSubResults=True, +) model.end() # Result should be single edge with 2 vertices diff --git a/src/FeaturesPlugin/Test/TestLoft.py b/src/FeaturesPlugin/Test/TestLoft.py index 1f8b04777..7e4b8dee0 100644 --- a/src/FeaturesPlugin/Test/TestLoft.py +++ b/src/FeaturesPlugin/Test/TestLoft.py @@ -30,16 +30,24 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) ### Create SketchLine -SketchLine_1 = Sketch_1.addLine(65.56914119359536, 34.84279475982533, -62.33478893740904, 34.84279475982533) +SketchLine_1 = Sketch_1.addLine( + 65.56914119359536, 34.84279475982533, -62.33478893740904, 34.84279475982533 +) ### Create SketchLine -SketchLine_2 = Sketch_1.addLine(-62.33478893740904, 34.84279475982533, -62.33478893740904, -28.08005822416302) +SketchLine_2 = Sketch_1.addLine( + -62.33478893740904, 34.84279475982533, -62.33478893740904, -28.08005822416302 +) ### Create SketchLine -SketchLine_3 = Sketch_1.addLine(-62.33478893740904, -28.08005822416302, 65.56914119359536, -28.08005822416302) +SketchLine_3 = Sketch_1.addLine( + -62.33478893740904, -28.08005822416302, 65.56914119359536, -28.08005822416302 +) ### Create SketchLine -SketchLine_4 = Sketch_1.addLine(65.56914119359536, -28.08005822416302, 65.56914119359536, 34.84279475982533) +SketchLine_4 = Sketch_1.addLine( + 65.56914119359536, -28.08005822416302, 65.56914119359536, 34.84279475982533 +) Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) @@ -51,20 +59,36 @@ Sketch_1.setVertical(SketchLine_4.result()) model.do() ### Create Plane -Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("VERTEX", "Sketch_1/SketchLine_3_StartVertex"), False) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "Sketch_1/SketchLine_4"), + model.selection("VERTEX", "Sketch_1/SketchLine_3_StartVertex"), + False, +) ### Create Plane -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f"), 100, False) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection( + "FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f" + ), + 100, + False, +) ### Create Sketch Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) ### Create SketchCircle -SketchCircle_1 = Sketch_2.addCircle(60.9581866489876, 39.76685108527785, 26.86156014153439) +SketchCircle_1 = Sketch_2.addCircle( + 60.9581866489876, 39.76685108527785, 26.86156014153439 +) model.do() ### Create Plane -Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r"), 100, False) +Plane_6 = model.addPlane( + Part_1_doc, model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r"), 100, False +) ### Create Box Box_1 = model.addBox(Part_1_doc, 10, 10, 10) @@ -73,84 +97,165 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Box_2 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Translation -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "all-in-Box_2")], axis = model.selection("EDGE", "PartSet/OY"), distance = 100, keepSubResults = True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Box_2")], + axis=model.selection("EDGE", "PartSet/OY"), + distance=100, + keepSubResults=True, +) ### Create Wire -Wire_1_objects = [model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), - model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), - model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), - model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]")] +Wire_1_objects = [ + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) ### Create Wire -Wire_2_objects = [model.selection("EDGE", "[Translation_1_1_1/MF:Translated&Box_2_1/Left][Translation_1_1_1/MF:Translated&Box_2_1/Top]"), - model.selection("EDGE", "[Translation_1_1_1/MF:Translated&Box_2_1/Front][Translation_1_1_1/MF:Translated&Box_2_1/Left]"), - model.selection("EDGE", "[Translation_1_1_1/MF:Translated&Box_2_1/Left][Translation_1_1_1/MF:Translated&Box_2_1/Bottom]"), - model.selection("EDGE", "[Translation_1_1_1/MF:Translated&Box_2_1/Back][Translation_1_1_1/MF:Translated&Box_2_1/Left]")] +Wire_2_objects = [ + model.selection( + "EDGE", + "[Translation_1_1_1/MF:Translated&Box_2_1/Left][Translation_1_1_1/MF:Translated&Box_2_1/Top]", + ), + model.selection( + "EDGE", + "[Translation_1_1_1/MF:Translated&Box_2_1/Front][Translation_1_1_1/MF:Translated&Box_2_1/Left]", + ), + model.selection( + "EDGE", + "[Translation_1_1_1/MF:Translated&Box_2_1/Left][Translation_1_1_1/MF:Translated&Box_2_1/Bottom]", + ), + model.selection( + "EDGE", + "[Translation_1_1_1/MF:Translated&Box_2_1/Back][Translation_1_1_1/MF:Translated&Box_2_1/Left]", + ), +] Wire_2 = model.addWire(Part_1_doc, Wire_2_objects, False) ### Create Box Box_3 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Wire -Wire_3 = model.addWire(Part_1_doc, [model.selection("EDGE", "[Box_3_1/Left][Box_3_1/Top]"), model.selection("EDGE", "[Box_3_1/Front][Box_3_1/Left]")], False) +Wire_3 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "[Box_3_1/Left][Box_3_1/Top]"), + model.selection("EDGE", "[Box_3_1/Front][Box_3_1/Left]"), + ], + False, +) ### Create Box Box_4 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Translation -Translation_2 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "all-in-Box_4")], axis = model.selection("EDGE", "PartSet/OY"), distance = 40, keepSubResults = True) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Box_4")], + axis=model.selection("EDGE", "PartSet/OY"), + distance=40, + keepSubResults=True, +) ### Create Wire -Wire_4 = model.addWire(Part_1_doc, [model.selection("EDGE", "[Translation_2_1_1/MF:Translated&Box_4_1/Left][Translation_2_1_1/MF:Translated&Box_4_1/Top]"), model.selection("EDGE", "[Translation_2_1_1/MF:Translated&Box_4_1/Front][Translation_2_1_1/MF:Translated&Box_4_1/Left]")], False) +Wire_4 = model.addWire( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Translation_2_1_1/MF:Translated&Box_4_1/Left][Translation_2_1_1/MF:Translated&Box_4_1/Top]", + ), + model.selection( + "EDGE", + "[Translation_2_1_1/MF:Translated&Box_4_1/Front][Translation_2_1_1/MF:Translated&Box_4_1/Left]", + ), + ], + False, +) ### Create Loft -Loft_1 = model.addLoft(Part_1_doc, model.selection("FACE", "Plane_2"), model.selection("FACE", "Plane_1")) +Loft_1 = model.addLoft( + Part_1_doc, model.selection("FACE", "Plane_2"), model.selection("FACE", "Plane_1") +) ### Create Loft -Loft_2 = model.addLoft(Part_1_doc, model.selection("WIRE", "Wire_2_1"), model.selection("WIRE", "Wire_1_1")) +Loft_2 = model.addLoft( + Part_1_doc, model.selection("WIRE", "Wire_2_1"), model.selection("WIRE", "Wire_1_1") +) ### Create Loft -Loft_3 = model.addLoft(Part_1_doc, model.selection("WIRE", "Wire_3_1"), model.selection("WIRE", "Wire_4_1")) +Loft_3 = model.addLoft( + Part_1_doc, model.selection("WIRE", "Wire_3_1"), model.selection("WIRE", "Wire_4_1") +) ### Create Loft -Loft_4 = model.addLoft(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_4")) +Loft_4 = model.addLoft( + Part_1_doc, + model.selection("EDGE", "Sketch_1/SketchLine_2"), + model.selection("EDGE", "Sketch_1/SketchLine_4"), +) # # Errors tests # Wire and Edge Box_5 = model.addBox(Part_1_doc, 10, 10, 10) -Wire_5_objects = [model.selection("EDGE", "[Box_5_1/Back][Box_5_1/Left]"), - model.selection("EDGE", "[Box_5_1/Left][Box_5_1/Top]"), - model.selection("EDGE", "[Box_5_1/Front][Box_5_1/Left]"), - model.selection("EDGE", "[Box_5_1/Left][Box_5_1/Bottom]")] +Wire_5_objects = [ + model.selection("EDGE", "[Box_5_1/Back][Box_5_1/Left]"), + model.selection("EDGE", "[Box_5_1/Left][Box_5_1/Top]"), + model.selection("EDGE", "[Box_5_1/Front][Box_5_1/Left]"), + model.selection("EDGE", "[Box_5_1/Left][Box_5_1/Bottom]"), +] Wire_5 = model.addWire(Part_1_doc, Wire_5_objects, False) Box_6 = model.addBox(Part_1_doc, 10, 10, 10) -Loft_5 = model.addLoft(Part_1_doc, model.selection("WIRE", "Wire_5_1"), model.selection("EDGE", "[Box_6_1/Right][Box_6_1/Top]")) -assert(Loft_5.feature().error() == "Error: the shapes have different type") +Loft_5 = model.addLoft( + Part_1_doc, + model.selection("WIRE", "Wire_5_1"), + model.selection("EDGE", "[Box_6_1/Right][Box_6_1/Top]"), +) +assert Loft_5.feature().error() == "Error: the shapes have different type" # Wire and Face -Wire_6_objects = [model.selection("EDGE", "[Loft_1_1/Loft_Face_1][Loft_1_1/Loft_Face_5]"), - model.selection("EDGE", "[Loft_1_1/Loft_Face_1][Loft_1_1/Loft_Face_4]"), - model.selection("EDGE", "[Loft_1_1/Loft_Face_1][Loft_1_1/Loft_Face_2]"), - model.selection("EDGE", "[Loft_1_1/Loft_Face_1][Loft_1_1/Loft_Face_6]")] +Wire_6_objects = [ + model.selection("EDGE", "[Loft_1_1/Loft_Face_1][Loft_1_1/Loft_Face_5]"), + model.selection("EDGE", "[Loft_1_1/Loft_Face_1][Loft_1_1/Loft_Face_4]"), + model.selection("EDGE", "[Loft_1_1/Loft_Face_1][Loft_1_1/Loft_Face_2]"), + model.selection("EDGE", "[Loft_1_1/Loft_Face_1][Loft_1_1/Loft_Face_6]"), +] Wire_6 = model.addWire(Part_1_doc, Wire_6_objects, False) -Loft_6 = model.addLoft(Part_1_doc, model.selection("WIRE", "Wire_6_1"), model.selection("EDGE", "Plane_3")) -assert(Loft_6.feature().error() == "Error: the shapes have different type") +Loft_6 = model.addLoft( + Part_1_doc, model.selection("WIRE", "Wire_6_1"), model.selection("EDGE", "Plane_3") +) +assert Loft_6.feature().error() == "Error: the shapes have different type" # Only one element Box_7 = model.addBox(Part_1_doc, 10, 10, 10) -Loft_7 = model.addLoft(Part_1_doc, model.selection("SOLID", "Box_7_1"), model.selection()) -assert(Loft_7.feature().error() == 'Error: Could not get "second_object" attribute.') +Loft_7 = model.addLoft( + Part_1_doc, model.selection("SOLID", "Box_7_1"), model.selection() +) +assert Loft_7.feature().error() == 'Error: Could not get "second_object" attribute.' # Two faces with different number of edges -Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10) -Loft_8 = model.addLoft(Part_1_doc, model.selection("FACE", "Cone_1_1/Face_2"), model.selection("EDGE", "Plane_3")) +Cone_1 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 5, + 10, +) +Loft_8 = model.addLoft( + Part_1_doc, + model.selection("FACE", "Cone_1_1/Face_2"), + model.selection("EDGE", "Plane_3"), +) model.end() from GeomAPI import GeomAPI_Shape -#test loft with two face +# test loft with two face model.testNbResults(Loft_1, 1) model.testNbSubResults(Loft_1, [0]) model.testNbSubShapes(Loft_1, GeomAPI_Shape.SOLID, [1]) @@ -159,7 +264,7 @@ model.testNbSubShapes(Loft_1, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(Loft_1, GeomAPI_Shape.VERTEX, [48]) model.testResultsVolumes(Loft_1, [996988.58940]) -#test loft with two wire +# test loft with two wire model.testNbResults(Loft_2, 1) model.testNbSubResults(Loft_2, [0]) model.testNbSubShapes(Loft_2, GeomAPI_Shape.SHELL, [1]) @@ -168,7 +273,7 @@ model.testNbSubShapes(Loft_2, GeomAPI_Shape.EDGE, [16]) model.testNbSubShapes(Loft_2, GeomAPI_Shape.VERTEX, [32]) model.testResultsVolumes(Loft_2, [0.0]) -#test loft with two wire +# test loft with two wire model.testNbResults(Loft_3, 1) model.testNbSubResults(Loft_3, [0]) model.testNbSubShapes(Loft_3, GeomAPI_Shape.SHELL, [1]) @@ -177,7 +282,7 @@ model.testNbSubShapes(Loft_3, GeomAPI_Shape.EDGE, [8]) model.testNbSubShapes(Loft_3, GeomAPI_Shape.VERTEX, [16]) model.testResultsVolumes(Loft_3, [0.0]) -#test loft with two edge +# test loft with two edge model.testNbResults(Loft_4, 1) model.testNbSubResults(Loft_4, [0]) model.testNbSubShapes(Loft_4, GeomAPI_Shape.FACE, [1]) @@ -185,14 +290,10 @@ model.testNbSubShapes(Loft_4, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Loft_4, GeomAPI_Shape.VERTEX, [8]) model.testResultsVolumes(Loft_4, [0.0]) -#test loft with faces with different number of edges +# test loft with faces with different number of edges model.testNbResults(Loft_8, 1) model.testNbSubResults(Loft_8, [0]) model.testNbSubShapes(Loft_8, GeomAPI_Shape.FACE, [7]) model.testNbSubShapes(Loft_8, GeomAPI_Shape.EDGE, [30]) model.testNbSubShapes(Loft_8, GeomAPI_Shape.VERTEX, [60]) model.testResultsVolumes(Loft_8, [151868.70541]) - - - - diff --git a/src/FeaturesPlugin/Test/TestMeasurementAngle.py b/src/FeaturesPlugin/Test/TestMeasurementAngle.py index abc051cde..2ba849b51 100644 --- a/src/FeaturesPlugin/Test/TestMeasurementAngle.py +++ b/src/FeaturesPlugin/Test/TestMeasurementAngle.py @@ -31,64 +31,143 @@ 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) +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")) SketchCircle_1 = Sketch_1.addCircle(50, 50, 50) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "R") -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_1.result(), SketchCircle_1.results()[1]) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_1.result(), SketchCircle_1.results()[1] +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_2.result(), SketchCircle_1.results()[1]) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_2.result(), SketchCircle_1.results()[1] +) SketchLine_3 = Sketch_1.addLine(70, 40, 30, 40) SketchLine_4 = Sketch_1.addLine(30, 40, 30, 60) SketchLine_5 = Sketch_1.addLine(30, 60, 70, 60) SketchLine_6 = Sketch_1.addLine(70, 60, 70, 40) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.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_1 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.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() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), "L") 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") +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_2r-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.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) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_8 = SketchProjection_3.createdFeature() -SketchConstraintAngle_1 = Sketch_2.setAngle(SketchLine_8.result(), SketchLine_7.result(), 50) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.result()) -SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance(SketchAPI_Line(SketchLine_8).startPoint(), SketchLine_7.endPoint(), 10) +SketchConstraintAngle_1 = Sketch_2.setAngle( + SketchLine_8.result(), SketchLine_7.result(), 50 +) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.result() +) +SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance( + SketchAPI_Line(SketchLine_8).startPoint(), SketchLine_7.endPoint(), 10 +) model.do() -TOLERANCE = 1.e-6 +TOLERANCE = 1.0e-6 # reference data -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]) - ] +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: - angle = model.measureAngle(Part_1_doc, model.selection("EDGE", ref[0]), model.selection("EDGE", ref[1])) - assert(angle.size() == len(ref[2])) + angle = model.measureAngle( + Part_1_doc, model.selection("EDGE", ref[0]), model.selection("EDGE", ref[1]) + ) + assert angle.size() == len(ref[2]) for a, r in zip(angle, ref[2]): - assert(math.fabs(a - r) < TOLERANCE), "Angle {} differs from expected value {}".format(a, r) + 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"), model.selection("EDGE", "Sketch_2/SketchLine_7")) -assert(angle.size() == 0) +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() diff --git a/src/FeaturesPlugin/Test/TestMeasurementAngle3Points.py b/src/FeaturesPlugin/Test/TestMeasurementAngle3Points.py index 95d3e7c2c..ebe3df0cc 100644 --- a/src/FeaturesPlugin/Test/TestMeasurementAngle3Points.py +++ b/src/FeaturesPlugin/Test/TestMeasurementAngle3Points.py @@ -30,79 +30,162 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 30, -51.96152422706629) SketchLine_2 = Sketch_1.addLine(30, -51.96152422706629, 90, -51.96152422706629) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(90, -51.96152422706629, 120, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(120, 0, 90, 51.96152422706636) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(90, 51.96152422706636, 30, 51.96152422706631) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(30, 51.96152422706631, 0, 0) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.endPoint()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_1.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_1.result()) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_1.result()) -SketchConstraintEqual_5 = Sketch_1.setEqual(SketchLine_6.result(), SketchLine_1.result()) -SketchConstraintAngle_1 = Sketch_1.setAngleBackward(SketchLine_1.result(), SketchLine_2.result(), 120) -SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_2.result(), 120) -SketchConstraintAngle_3 = Sketch_1.setAngleBackward(SketchLine_3.result(), SketchLine_4.result(), 120) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_6.endPoint() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_1.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_1.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_4.result(), SketchLine_1.result() +) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_1.result() +) +SketchConstraintEqual_5 = Sketch_1.setEqual( + SketchLine_6.result(), SketchLine_1.result() +) +SketchConstraintAngle_1 = Sketch_1.setAngleBackward( + SketchLine_1.result(), SketchLine_2.result(), 120 +) +SketchConstraintAngle_2 = Sketch_1.setAngle( + SketchLine_3.result(), SketchLine_2.result(), 120 +) +SketchConstraintAngle_3 = Sketch_1.setAngleBackward( + SketchLine_3.result(), SketchLine_4.result(), 120 +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_5.result(), 60) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) +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_1r-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 +TOLERANCE = 1.0e-6 # reference data -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&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&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&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&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&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&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&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) - ] +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&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&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&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&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&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&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&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, + ), +] for ref in REF_DATA: - angle = model.measureAngle(Part_1_doc, model.selection("VERTEX", ref[0]), model.selection("VERTEX", ref[1]), model.selection("VERTEX", ref[2])) - assert(math.fabs(angle - ref[3]) < TOLERANCE), "Angle {} differs from expected value {}".format(angle, ref[3]) + angle = model.measureAngle( + Part_1_doc, + model.selection("VERTEX", ref[0]), + model.selection("VERTEX", ref[1]), + model.selection("VERTEX", ref[2]), + ) + 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"), 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("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", "")) -assert(angle == -1.0) +angle = model.measureAngle( + Part_1_doc, + model.selection("VERTEX", ""), + model.selection("VERTEX", ""), + model.selection("VERTEX", ""), +) +assert angle == -1.0 model.end() diff --git a/src/FeaturesPlugin/Test/TestMeasurementDistance.py b/src/FeaturesPlugin/Test/TestMeasurementDistance.py index 43d314d8e..19e1e610b 100644 --- a/src/FeaturesPlugin/Test/TestMeasurementDistance.py +++ b/src/FeaturesPlugin/Test/TestMeasurementDistance.py @@ -29,117 +29,235 @@ 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) +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")) SketchCircle_1 = Sketch_1.addCircle(50, 50, 50) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "R") -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_1.result(), SketchCircle_1.results()[1]) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_1.result(), SketchCircle_1.results()[1] +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_2.result(), SketchCircle_1.results()[1]) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_2.result(), SketchCircle_1.results()[1] +) SketchLine_3 = Sketch_1.addLine(70, 40, 30, 40) SketchLine_4 = Sketch_1.addLine(30, 40, 30, 60) SketchLine_5 = Sketch_1.addLine(30, 60, 70, 60) SketchLine_6 = Sketch_1.addLine(70, 60, 70, 40) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.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_1 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.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() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), "L") 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") +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_2r-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) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchArc_1.endPoint()) +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 +) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchArc_1.startPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchArc_2.endPoint(), SketchArc_1.endPoint() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchArc_1.results()[1], "R") SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_2.results()[1], "2*R") SketchLine_7 = Sketch_2.addLine(0, 48.41229182762603, 100, 48.41229182762603) SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchArc_2.center(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchArc_1.center(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchArc_2.center(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchArc_1.center(), SketchLine_7.endPoint() +) SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_7.result()) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_8 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_8.result()) -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchArc_1.startPoint(), SketchLine_8.result() +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_9 = SketchProjection_4.createdFeature() -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchArc_2.results()[1]) -SketchConstraintMirror_1 = Sketch_2.addMirror(SketchLine_9.result(), [SketchArc_2.results()[1], SketchArc_1.results()[1]]) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_7.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchArc_2.results()[1] +) +SketchConstraintMirror_1 = Sketch_2.addMirror( + SketchLine_9.result(), [SketchArc_2.results()[1], SketchArc_1.results()[1]] +) [SketchArc_3, SketchArc_4] = SketchConstraintMirror_1.mirrored() model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 100, 0) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 100, 0 +) model.do() -TOLERANCE = 1.e-6 +TOLERANCE = 1.0e-6 # reference data -REF_DATA = [(model.selection("VERTEX", "PartSet/Origin"), - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]"), - 122.4744871, - "NA"), - (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, - "NA"), - (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, - 100.0), - (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, - 176.710217655), - (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, - "NA"), - (model.selection("VERTEX", "Sketch_1/SketchCircle_1_2__cc"), - model.selection("FACE", "Plane_1"), - 35.35533906, - "NA"), - (model.selection("FACE", "Extrusion_2_2/From_Face"), - model.selection("FACE", "Extrusion_2_2/To_Face"), - 100, - 100), - (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, - 165.799606), - (model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"), - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2"), - 27.63932023, - 40.0), - (model.selection("SOLID", "Extrusion_1_1"), - model.selection("FACE", "Extrusion_2_1/To_Face"), - 12.5, - "NA"), - (model.selection("SOLID", "Extrusion_1_1"), - model.selection("SOLID", "Extrusion_2_1"), - 0, - "NA"), - (model.selection("SOLID", "Extrusion_1_1"), - model.selection("SOLID", "Extrusion_2_2"), - 87.5, - "NA") - ] +REF_DATA = [ + ( + model.selection("VERTEX", "PartSet/Origin"), + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]", + ), + 122.4744871, + "NA", + ), + ( + 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, + "NA", + ), + ( + 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, + 100.0, + ), + ( + 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, + 176.710217655, + ), + ( + 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, + "NA", + ), + ( + model.selection("VERTEX", "Sketch_1/SketchCircle_1_2__cc"), + model.selection("FACE", "Plane_1"), + 35.35533906, + "NA", + ), + ( + model.selection("FACE", "Extrusion_2_2/From_Face"), + model.selection("FACE", "Extrusion_2_2/To_Face"), + 100, + 100, + ), + ( + 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, + 165.799606, + ), + ( + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"), + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2" + ), + 27.63932023, + 40.0, + ), + ( + model.selection("SOLID", "Extrusion_1_1"), + model.selection("FACE", "Extrusion_2_1/To_Face"), + 12.5, + "NA", + ), + ( + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_2_1"), + 0, + "NA", + ), + ( + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_2_2"), + 87.5, + "NA", + ), +] for ref in REF_DATA: dist = model.measureDistance(Part_1_doc, ref[0], ref[1]) - assert(math.fabs(dist - ref[2]) < TOLERANCE), "Distance {} differs from expected value {}".format(dist, ref[2]) + assert ( + math.fabs(dist - ref[2]) < TOLERANCE + ), "Distance {} differs from expected value {}".format(dist, ref[2]) if ref[3] != "NA": prox = model.shapeProximity(Part_1_doc, ref[0], ref[1]) - assert(math.fabs(prox - ref[3]) < TOLERANCE), "Proximity {} differs from expected value {}".format(prox, ref[3]) + assert ( + math.fabs(prox - ref[3]) < TOLERANCE + ), "Proximity {} differs from expected value {}".format(prox, ref[3]) model.end() diff --git a/src/FeaturesPlugin/Test/TestMeasurementLength.py b/src/FeaturesPlugin/Test/TestMeasurementLength.py index 4a19aaa4a..cbf69a4c3 100644 --- a/src/FeaturesPlugin/Test/TestMeasurementLength.py +++ b/src/FeaturesPlugin/Test/TestMeasurementLength.py @@ -29,55 +29,114 @@ ParamR = model.addParameter(Part_1_doc, "R", "50") ParamL = model.addParameter(Part_1_doc, "L", "40") ParamH = 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) +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")) SketchCircle_1 = Sketch_1.addCircle(50, 50, 50) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "R") -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_1.result(), SketchCircle_1.results()[1]) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_1.result(), SketchCircle_1.results()[1] +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_2.result(), SketchCircle_1.results()[1]) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_2.result(), SketchCircle_1.results()[1] +) SketchLine_3 = Sketch_1.addLine(70, 40, 30, 40) SketchLine_4 = Sketch_1.addLine(30, 40, 30, 60) SketchLine_5 = Sketch_1.addLine(30, 60, 70, 60) SketchLine_6 = Sketch_1.addLine(70, 60, 70, 40) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.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_1 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.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() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), "L") 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") +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_2r-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 +TOLERANCE = 1.0e-6 # reference data -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) - ] +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: length = model.measureLength(Part_1_doc, model.selection("EDGE", ref[0])) - assert(math.fabs(length - ref[1]) < TOLERANCE), "Length {} differs from expected value {}".format(length, ref[1]) + 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&Sketch_1/SketchCircle_1_2")) -assert(length == -1) +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 index 77cc71784..ee99df9d5 100644 --- a/src/FeaturesPlugin/Test/TestMeasurementPresentation.py +++ b/src/FeaturesPlugin/Test/TestMeasurementPresentation.py @@ -20,22 +20,65 @@ 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") + +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()) +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() @@ -45,22 +88,26 @@ 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") +aMeasurement.selection("edge_for_length").selectSubShape( + "EDGE", "Sketch_1/SketchLine_1" +) anAIS = featureToPresentation(aMeasurement).getAISObject(None) -assert(anAIS is not None) +assert anAIS is not None anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS) -assert(anAIS is not None) +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_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) +assert anAIS is not None anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS) -assert(anAIS is not None) +assert anAIS is not None aSession.finishOperation() aSession.startOperation() @@ -68,9 +115,9 @@ 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) +assert anAIS is not None anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS) -assert(anAIS is not None) +assert anAIS is not None aSession.finishOperation() aSession.startOperation() @@ -79,19 +126,25 @@ 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) +assert anAIS is not None anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS) -assert(anAIS is not None) +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") +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) +assert anAIS is not None anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS) -assert(anAIS is not None) +assert anAIS is not None aSession.finishOperation() diff --git a/src/FeaturesPlugin/Test/TestMeasurementRadius.py b/src/FeaturesPlugin/Test/TestMeasurementRadius.py index c8ac4022f..9c584d466 100644 --- a/src/FeaturesPlugin/Test/TestMeasurementRadius.py +++ b/src/FeaturesPlugin/Test/TestMeasurementRadius.py @@ -29,50 +29,104 @@ ParamR = model.addParameter(Part_1_doc, "R", "50") ParamL = model.addParameter(Part_1_doc, "L", "40") ParamH = 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) +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")) SketchCircle_1 = Sketch_1.addCircle(50, 50, 50) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "R") -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_1.result(), SketchCircle_1.results()[1]) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_1.result(), SketchCircle_1.results()[1] +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_2.result(), SketchCircle_1.results()[1]) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_2.result(), SketchCircle_1.results()[1] +) SketchLine_3 = Sketch_1.addLine(70, 40, 30, 40) SketchLine_4 = Sketch_1.addLine(30, 40, 30, 60) SketchLine_5 = Sketch_1.addLine(30, 60, 70, 60) SketchLine_6 = Sketch_1.addLine(70, 60, 70, 40) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.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_1 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.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() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), "L") 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") +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_2r-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 +TOLERANCE = 1.0e-6 # reference data -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()) - ] +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: radius = model.measureRadius(Part_1_doc, ref[0]) - assert(math.fabs(radius - ref[1]) < TOLERANCE), "Radius {} differs from expected value {}".format(radius, ref[1]) + 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")) -assert(radius == -1) +radius = model.measureRadius( + Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face") +) +assert radius == -1 model.end() diff --git a/src/FeaturesPlugin/Test/TestMultiBoolean.py b/src/FeaturesPlugin/Test/TestMultiBoolean.py index 48e302ae6..a76496da1 100644 --- a/src/FeaturesPlugin/Test/TestMultiBoolean.py +++ b/src/FeaturesPlugin/Test/TestMultiBoolean.py @@ -35,9 +35,9 @@ # Number rows and columns of cylinders that cuts the big box. Number of Boolena operations is N*N N = 5 -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from GeomAPI import * from GeomAlgoAPI import * from GeomDataAPI import * @@ -52,17 +52,17 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +assert len(aPartFeature.results()) == 1 # Another way is: # aPart = aSession.activeDocument() aPartResult = modelAPI_ResultPart(aPartFeature.firstResult()) aPart = aPartResult.partDoc() -#========================================================================= +# ========================================================================= # Create a list of sketches with one circle inside of each to extrude -#========================================================================= -step = 99. / N -radius = 95. / N / 2. +# ========================================================================= +step = 99.0 / N +radius = 95.0 / N / 2.0 aSession.startOperation() aSketchFeatures = [] @@ -85,9 +85,9 @@ for i in range(0, N): aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusions on circles -#========================================================================= +# ========================================================================= # Build shape from sketcher results # Create extrusions @@ -97,22 +97,21 @@ anExtrusions = [] for i in range(0, N * N): aSketchResult = modelAPI_ResultConstruction(aSketchFeatures[i].firstResult()) anExtrusionFt = aPart.addFeature("Extrusion") - assert (anExtrusionFt.getKind() == "Extrusion") + assert anExtrusionFt.getKind() == "Extrusion" - anExtrusionFt.selectionList("base").append( - aSketchResult, aSketchResult.face(0)) + anExtrusionFt.selectionList("base").append(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 + anExtrusionFt.real("to_offset").setValue(0) # TODO: remove + anExtrusionFt.real("from_offset").setValue(0) # TODO: remove anExtrusions.append(anExtrusionFt) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make rectangle sketch: base for the box, size 100x100 -#========================================================================= +# ========================================================================= aSession.startOperation() aQuadrangleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aQuadrangleSketchFeature.attribute("Origin")) @@ -133,38 +132,37 @@ aLineCStartPoint = geomDataAPI_Point2D(aSketchLineC.attribute("StartPoint")) aLineCEndPoint = geomDataAPI_Point2D(aSketchLineC.attribute("EndPoint")) aLineDStartPoint = geomDataAPI_Point2D(aSketchLineD.attribute("StartPoint")) aLineDEndPoint = geomDataAPI_Point2D(aSketchLineD.attribute("EndPoint")) -aLineAStartPoint.setValue(0., 0.) -aLineAEndPoint.setValue(0., 100.) -aLineBStartPoint.setValue(0., 100.) -aLineBEndPoint.setValue(100., 100.) -aLineCStartPoint.setValue(100., 100.) -aLineCEndPoint.setValue(100., 0.) -aLineDStartPoint.setValue(100., 0.) -aLineDEndPoint.setValue(0., 0.) +aLineAStartPoint.setValue(0.0, 0.0) +aLineAEndPoint.setValue(0.0, 100.0) +aLineBStartPoint.setValue(0.0, 100.0) +aLineBEndPoint.setValue(100.0, 100.0) +aLineCStartPoint.setValue(100.0, 100.0) +aLineCEndPoint.setValue(100.0, 0.0) +aLineDStartPoint.setValue(100.0, 0.0) +aLineDEndPoint.setValue(0.0, 0.0) aSession.finishOperation() aSession.startOperation() -#========================================================================= +# ========================================================================= # Build a big box extrusion -#========================================================================= +# ========================================================================= aSketchResult = modelAPI_ResultConstruction(aQuadrangleSketchFeature.firstResult()) # Create extrusion on them aBox = aPart.addFeature("Extrusion") -aBox.selectionList("base").append( - aSketchResult, aSketchResult.face(0)) +aBox.selectionList("base").append(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 +aBox.real("to_offset").setValue(0) # TODO: remove +aBox.real("from_offset").setValue(0) # TODO: remove aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create a boolean cut of cylinders from the box: -#========================================================================= +# ========================================================================= aCurrentResult = modelAPI_ResultBody(aBox.firstResult()) aSession.startOperation() @@ -172,18 +170,21 @@ aBooleanFt = aPart.addFeature("Cut") aBooleanFt.selectionList("main_objects").append(aCurrentResult, aCurrentResult.shape()) for i in range(0, N * N): anExtrusionResult = modelAPI_ResultBody(anExtrusions[i].firstResult()) - aBooleanFt.selectionList("tool_objects").append(anExtrusionResult, anExtrusionResult.shape()) + aBooleanFt.selectionList("tool_objects").append( + anExtrusionResult, anExtrusionResult.shape() + ) aBooleanFt.execute() aFactory = ModelAPI_Session.get().validators() -assert (aFactory.validate(aBooleanFt)) -assert (len(aBooleanFt.results()) > 0) +assert aFactory.validate(aBooleanFt) +assert len(aBooleanFt.results()) > 0 aCurrentResult = modelAPI_ResultBody(aBooleanFt.firstResult()) -assert (aCurrentResult is not None) +assert aCurrentResult is not None aSession.finishOperation() -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestMultiRotation_ErrorMsg.py b/src/FeaturesPlugin/Test/TestMultiRotation_ErrorMsg.py index 77f0280ac..bc12494dd 100644 --- a/src/FeaturesPlugin/Test/TestMultiRotation_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestMultiRotation_ErrorMsg.py @@ -19,6 +19,7 @@ from ModelAPI import * + aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -48,24 +49,24 @@ aSession.finishOperation() aSession.startOperation() anAngularCopy1 = aPart.addFeature("AngularCopy") anAngularCopy1.execute() -assert(anAngularCopy1.error() != "") +assert anAngularCopy1.error() != "" aSession.finishOperation() aSession.startOperation() anAngularCopy1.selectionList("main_objects").append("Compound_1_1", "COMPOUND") anAngularCopy1.execute() -assert(anAngularCopy1.error() != "") +assert anAngularCopy1.error() != "" aSession.finishOperation() aSession.startOperation() anAngularCopy1.selection("axis_angular").selectSubShape("COMPOUND", "Compound_1_1") anAngularCopy1.execute() -assert(anAngularCopy1.error() != "") +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() != "") +assert anAngularCopy1.error() != "" aSession.finishOperation() diff --git a/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v0_1.py b/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v0_1.py index e6cdeb4ff..60c1270db 100644 --- a/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v0_1.py +++ b/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v0_1.py @@ -28,47 +28,129 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() ANGLE = 60 COPIES = 3 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 model.begin() -MultiRotation_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("EDGE", "PartSet/OZ"), ANGLE, COPIES) +MultiRotation_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, + COPIES, +) model.testNbResults(MultiRotation_1, 1) model.testNbSubResults(MultiRotation_1, [COPIES]) model.testNbSubShapes(MultiRotation_1, GeomAPI_Shape.SOLID, [1 * COPIES]) @@ -79,11 +161,17 @@ model.testResultsVolumes(MultiRotation_1, [542.746463956 * COPIES]) refPoint = GeomAPI_Pnt(22.16914827868, -12.5, 5) midPoint = MultiRotation_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, MultiRotation_1, [Compound_2.result()], True) -MultiRotation_2 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Recover_1_1_2_1")], model.selection("EDGE", "PartSet/OZ"), ANGLE, COPIES) +MultiRotation_2 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Recover_1_1_2_1")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, + COPIES, +) model.testNbResults(MultiRotation_2, 1) model.testNbSubResults(MultiRotation_2, [COPIES]) model.testNbSubShapes(MultiRotation_2, GeomAPI_Shape.SOLID, [1 * COPIES]) @@ -94,11 +182,17 @@ model.testResultsVolumes(MultiRotation_2, [785.39816339745 * COPIES]) refPoint = GeomAPI_Pnt(43.301270189, 5.3316102395, 5) midPoint = MultiRotation_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, MultiRotation_2, [Recover_1.result()], True) -MultiRotation_3 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Recover_2_1_3")], model.selection("EDGE", "PartSet/OZ"), ANGLE, COPIES) +MultiRotation_3 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Recover_2_1_3")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, + COPIES, +) model.testNbResults(MultiRotation_3, 1) model.testNbSubResults(MultiRotation_3, [COPIES]) model.testNbSubShapes(MultiRotation_3, GeomAPI_Shape.SOLID, [1 * COPIES]) @@ -109,26 +203,49 @@ model.testResultsVolumes(MultiRotation_3, [785.39816339745 * COPIES]) refPoint = GeomAPI_Pnt(31.94572, -30.33161024, 5) midPoint = MultiRotation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_3 = model.addRecover(Part_1_doc, MultiRotation_3, [Recover_2.result()], True) -MultiRotation_4 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Recover_3_1_1_1"), model.selection("SOLID", "Recover_3_1_2_2"), model.selection("SOLID", "Recover_3_1_3")], model.selection("EDGE", "PartSet/OZ"), ANGLE, COPIES) +MultiRotation_4 = model.addMultiRotation( + Part_1_doc, + [ + model.selection("SOLID", "Recover_3_1_1_1"), + model.selection("SOLID", "Recover_3_1_2_2"), + model.selection("SOLID", "Recover_3_1_3"), + ], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, + COPIES, +) model.testNbResults(MultiRotation_4, 3) model.testNbSubResults(MultiRotation_4, [COPIES, COPIES, COPIES]) -model.testNbSubShapes(MultiRotation_4, GeomAPI_Shape.SOLID, [1 * COPIES, 1 * COPIES, 1 * COPIES]) -model.testNbSubShapes(MultiRotation_4, GeomAPI_Shape.FACE, [6 * COPIES, 3 * COPIES, 3 * COPIES]) -model.testNbSubShapes(MultiRotation_4, GeomAPI_Shape.EDGE, [24 * COPIES, 6 * COPIES, 6 * COPIES]) -model.testNbSubShapes(MultiRotation_4, GeomAPI_Shape.VERTEX, [48 * COPIES, 12 * COPIES, 12 * COPIES]) -model.testResultsVolumes(MultiRotation_4, [3444.394198615 * COPIES, 785.39816339745 * COPIES, 785.39816339745 * COPIES]) - -REFERENCE = [GeomAPI_Pnt(32.6022829255, -5.6990653637, 5), - GeomAPI_Pnt(1.06046515086, -17.8316102395, 5), - GeomAPI_Pnt(31.945720066, -30.3316102395, 5)] +model.testNbSubShapes( + MultiRotation_4, GeomAPI_Shape.SOLID, [1 * COPIES, 1 * COPIES, 1 * COPIES] +) +model.testNbSubShapes( + MultiRotation_4, GeomAPI_Shape.FACE, [6 * COPIES, 3 * COPIES, 3 * COPIES] +) +model.testNbSubShapes( + MultiRotation_4, GeomAPI_Shape.EDGE, [24 * COPIES, 6 * COPIES, 6 * COPIES] +) +model.testNbSubShapes( + MultiRotation_4, GeomAPI_Shape.VERTEX, [48 * COPIES, 12 * COPIES, 12 * COPIES] +) +model.testResultsVolumes( + MultiRotation_4, + [3444.394198615 * COPIES, 785.39816339745 * COPIES, 785.39816339745 * COPIES], +) + +REFERENCE = [ + GeomAPI_Pnt(32.6022829255, -5.6990653637, 5), + GeomAPI_Pnt(1.06046515086, -17.8316102395, 5), + GeomAPI_Pnt(31.945720066, -30.3316102395, 5), +] for res, ref in zip(MultiRotation_4.results(), REFERENCE): midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE) + assert midPoint.distance(ref) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v0_2.py b/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v0_2.py index ec84d717a..f572a025b 100644 --- a/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v0_2.py +++ b/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v0_2.py @@ -28,46 +28,127 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() COPIES = 3 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 model.begin() -MultiRotation_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("EDGE", "PartSet/OZ"), COPIES) +MultiRotation_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("EDGE", "PartSet/OZ"), + COPIES, +) model.testNbResults(MultiRotation_1, 1) model.testNbSubResults(MultiRotation_1, [COPIES]) model.testNbSubShapes(MultiRotation_1, GeomAPI_Shape.SOLID, [1 * COPIES]) @@ -78,11 +159,16 @@ model.testResultsVolumes(MultiRotation_1, [542.746463956 * COPIES]) refPoint = GeomAPI_Pnt(0.518513184, -12.5, 5) midPoint = MultiRotation_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, MultiRotation_1, [Compound_2.result()], True) -MultiRotation_2 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Recover_1_1_2_1")], model.selection("EDGE", "PartSet/OZ"), COPIES) +MultiRotation_2 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Recover_1_1_2_1")], + model.selection("EDGE", "PartSet/OZ"), + COPIES, +) model.testNbResults(MultiRotation_2, 1) model.testNbSubResults(MultiRotation_2, [COPIES]) model.testNbSubShapes(MultiRotation_2, GeomAPI_Shape.SOLID, [1 * COPIES]) @@ -93,11 +179,16 @@ model.testResultsVolumes(MultiRotation_2, [785.39816339745 * COPIES]) refPoint = GeomAPI_Pnt(-11.355550122, 5.3316102, 5) midPoint = MultiRotation_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, MultiRotation_2, [Recover_1.result()], True) -MultiRotation_3 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Recover_2_1_3")], model.selection("EDGE", "PartSet/OZ"), COPIES) +MultiRotation_3 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Recover_2_1_3")], + model.selection("EDGE", "PartSet/OZ"), + COPIES, +) model.testNbResults(MultiRotation_3, 1) model.testNbSubResults(MultiRotation_3, [COPIES]) model.testNbSubShapes(MultiRotation_3, GeomAPI_Shape.SOLID, [1 * COPIES]) @@ -108,26 +199,48 @@ model.testResultsVolumes(MultiRotation_3, [785.39816339745 * COPIES]) refPoint = GeomAPI_Pnt(10.29508497, -12.5, 5) midPoint = MultiRotation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_3 = model.addRecover(Part_1_doc, MultiRotation_3, [Recover_2.result()], True) -MultiRotation_4 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Recover_3_1_1_1"), model.selection("SOLID", "Recover_3_1_2_2"), model.selection("SOLID", "Recover_3_1_3")], model.selection("EDGE", "PartSet/OZ"), COPIES) +MultiRotation_4 = model.addMultiRotation( + Part_1_doc, + [ + model.selection("SOLID", "Recover_3_1_1_1"), + model.selection("SOLID", "Recover_3_1_2_2"), + model.selection("SOLID", "Recover_3_1_3"), + ], + model.selection("EDGE", "PartSet/OZ"), + COPIES, +) model.testNbResults(MultiRotation_4, 3) model.testNbSubResults(MultiRotation_4, [COPIES, COPIES, COPIES]) -model.testNbSubShapes(MultiRotation_4, GeomAPI_Shape.SOLID, [1 * COPIES, 1 * COPIES, 1 * COPIES]) -model.testNbSubShapes(MultiRotation_4, GeomAPI_Shape.FACE, [6 * COPIES, 3 * COPIES, 3 * COPIES]) -model.testNbSubShapes(MultiRotation_4, GeomAPI_Shape.EDGE, [24 * COPIES, 6 * COPIES, 6 * COPIES]) -model.testNbSubShapes(MultiRotation_4, GeomAPI_Shape.VERTEX, [48 * COPIES, 12 * COPIES, 12 * COPIES]) -model.testResultsVolumes(MultiRotation_4, [3444.394198615 * COPIES, 785.39816339745 * COPIES, 785.39816339745 * COPIES]) - -REFERENCE = [GeomAPI_Pnt(-5.8665084688, -5.6990653637, 5), - GeomAPI_Pnt(1.06046515086, 5.3316102395, 5), - GeomAPI_Pnt(10.29508497, -12.5, 5)] +model.testNbSubShapes( + MultiRotation_4, GeomAPI_Shape.SOLID, [1 * COPIES, 1 * COPIES, 1 * COPIES] +) +model.testNbSubShapes( + MultiRotation_4, GeomAPI_Shape.FACE, [6 * COPIES, 3 * COPIES, 3 * COPIES] +) +model.testNbSubShapes( + MultiRotation_4, GeomAPI_Shape.EDGE, [24 * COPIES, 6 * COPIES, 6 * COPIES] +) +model.testNbSubShapes( + MultiRotation_4, GeomAPI_Shape.VERTEX, [48 * COPIES, 12 * COPIES, 12 * COPIES] +) +model.testResultsVolumes( + MultiRotation_4, + [3444.394198615 * COPIES, 785.39816339745 * COPIES, 785.39816339745 * COPIES], +) + +REFERENCE = [ + GeomAPI_Pnt(-5.8665084688, -5.6990653637, 5), + GeomAPI_Pnt(1.06046515086, 5.3316102395, 5), + GeomAPI_Pnt(10.29508497, -12.5, 5), +] for res, ref in zip(MultiRotation_4.results(), REFERENCE): midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE) + assert midPoint.distance(ref) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v0_3.py b/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v0_3.py index 1a71cab18..94a7c215e 100644 --- a/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v0_3.py +++ b/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v0_3.py @@ -27,60 +27,175 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 COPIES = 4 model.begin() -MultiRotation_1 = model.addMultiRotation(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("EDGE", "PartSet/OX"), COPIES) +MultiRotation_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("VERTEX", "Vertex_1_1")], + model.selection("EDGE", "PartSet/OX"), + COPIES, +) model.testNbResults(MultiRotation_1, 1) model.testNbSubResults(MultiRotation_1, [COPIES]) model.testNbSubShapes(MultiRotation_1, GeomAPI_Shape.SOLID, [0]) @@ -93,9 +208,14 @@ refPoint = Vertex_1.defaultResult().shape().middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiRotation_2 = model.addMultiRotation(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OX"), COPIES) +MultiRotation_2 = model.addMultiRotation( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OX"), + COPIES, +) model.testNbResults(MultiRotation_2, 1) model.testNbSubResults(MultiRotation_2, [COPIES]) model.testNbSubShapes(MultiRotation_2, GeomAPI_Shape.SOLID, [0]) @@ -109,9 +229,14 @@ refPoint = comp.middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiRotation_3 = model.addMultiRotation(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("EDGE", "PartSet/OX"), COPIES) +MultiRotation_3 = model.addMultiRotation( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + model.selection("EDGE", "PartSet/OX"), + COPIES, +) model.testNbResults(MultiRotation_3, 1) model.testNbSubResults(MultiRotation_3, [COPIES]) model.testNbSubShapes(MultiRotation_3, GeomAPI_Shape.SOLID, [0]) @@ -125,9 +250,14 @@ refPoint = comp.middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiRotation_4 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OX"), COPIES) +MultiRotation_4 = model.addMultiRotation( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("EDGE", "PartSet/OX"), + COPIES, +) model.testNbResults(MultiRotation_4, 1) model.testNbSubResults(MultiRotation_4, [COPIES]) model.testNbSubShapes(MultiRotation_4, GeomAPI_Shape.SOLID, [0]) @@ -140,9 +270,14 @@ refPoint = Face_1.defaultResult().shape().middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiRotation_5 = model.addMultiRotation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OX"), COPIES) +MultiRotation_5 = model.addMultiRotation( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + model.selection("EDGE", "PartSet/OX"), + COPIES, +) model.testNbResults(MultiRotation_5, 1) model.testNbSubResults(MultiRotation_5, [COPIES]) model.testNbSubShapes(MultiRotation_5, GeomAPI_Shape.SOLID, [0]) @@ -155,9 +290,14 @@ refPoint = Shell_1.defaultResult().shape().middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiRotation_6 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OX"), COPIES) +MultiRotation_6 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + model.selection("EDGE", "PartSet/OX"), + COPIES, +) model.testNbResults(MultiRotation_6, 1) model.testNbSubResults(MultiRotation_6, [COPIES]) model.testNbSubShapes(MultiRotation_6, GeomAPI_Shape.SOLID, [COPIES]) @@ -169,9 +309,14 @@ refPoint = Translation_1.defaultResult().shape().middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiRotation_7 = model.addMultiRotation(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("EDGE", "PartSet/OX"), COPIES) +MultiRotation_7 = model.addMultiRotation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + model.selection("EDGE", "PartSet/OX"), + COPIES, +) model.testNbResults(MultiRotation_7, 1) model.testNbSubResults(MultiRotation_7, [COPIES]) model.testNbSubShapes(MultiRotation_7, GeomAPI_Shape.SOLID, [3 * COPIES]) @@ -183,9 +328,14 @@ refPoint = Partition_1.defaultResult().shape().middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiRotation_8 = model.addMultiRotation(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], model.selection("EDGE", "PartSet/OX"), COPIES) +MultiRotation_8 = model.addMultiRotation( + Part_1_doc, + [model.selection("COMPOUND", "AngularCopy_1_1")], + model.selection("EDGE", "PartSet/OX"), + COPIES, +) model.testNbResults(MultiRotation_8, 1) model.testNbSubResults(MultiRotation_8, [COPIES]) model.testNbSubShapes(MultiRotation_8, GeomAPI_Shape.SOLID, [3 * COPIES]) @@ -197,8 +347,8 @@ refPoint = AngularCopy_1.defaultResult().shape().middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v0_4.py b/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v0_4.py index 4de5f6a3d..2b8c85a58 100644 --- a/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v0_4.py +++ b/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v0_4.py @@ -27,62 +27,186 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 COPIES = 4 model.begin() -MultiRotation_1 = model.addMultiRotation(Part_1_doc, [model.selection("VERTEX", "Compound_1_1_1")], model.selection("EDGE", "PartSet/OX"), COPIES) +MultiRotation_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("VERTEX", "Compound_1_1_1")], + model.selection("EDGE", "PartSet/OX"), + COPIES, +) model.testNbResults(MultiRotation_1, 1) model.testNbSubResults(MultiRotation_1, [COPIES]) model.testNbSubShapes(MultiRotation_1, GeomAPI_Shape.SOLID, [0]) @@ -95,10 +219,15 @@ refPoint = Vertex_1.defaultResult().shape().middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, MultiRotation_1, [Compound_1.result()], True) -MultiRotation_2 = model.addMultiRotation(Part_1_doc, [model.selection("EDGE", "Recover_1_1_2")], model.selection("EDGE", "PartSet/OX"), COPIES) +MultiRotation_2 = model.addMultiRotation( + Part_1_doc, + [model.selection("EDGE", "Recover_1_1_2")], + model.selection("EDGE", "PartSet/OX"), + COPIES, +) model.testNbResults(MultiRotation_2, 1) model.testNbSubResults(MultiRotation_2, [COPIES]) model.testNbSubShapes(MultiRotation_2, GeomAPI_Shape.SOLID, [0]) @@ -112,10 +241,15 @@ refPoint = comp.middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, MultiRotation_2, [Recover_1.result()]) -MultiRotation_3 = model.addMultiRotation(Part_1_doc, [model.selection("WIRE", "Recover_2_1_3")], model.selection("EDGE", "PartSet/OX"), COPIES) +MultiRotation_3 = model.addMultiRotation( + Part_1_doc, + [model.selection("WIRE", "Recover_2_1_3")], + model.selection("EDGE", "PartSet/OX"), + COPIES, +) model.testNbResults(MultiRotation_3, 1) model.testNbSubResults(MultiRotation_3, [COPIES]) model.testNbSubShapes(MultiRotation_3, GeomAPI_Shape.SOLID, [0]) @@ -129,10 +263,15 @@ refPoint = comp.middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_3 = model.addRecover(Part_1_doc, MultiRotation_3, [Recover_2.result()]) -MultiRotation_4 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Recover_3_1_4")], model.selection("EDGE", "PartSet/OX"), COPIES) +MultiRotation_4 = model.addMultiRotation( + Part_1_doc, + [model.selection("FACE", "Recover_3_1_4")], + model.selection("EDGE", "PartSet/OX"), + COPIES, +) model.testNbResults(MultiRotation_4, 1) model.testNbSubResults(MultiRotation_4, [COPIES]) model.testNbSubShapes(MultiRotation_4, GeomAPI_Shape.SOLID, [0]) @@ -145,10 +284,15 @@ refPoint = Face_1.defaultResult().shape().middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_4 = model.addRecover(Part_1_doc, MultiRotation_4, [Recover_3.result()]) -MultiRotation_5 = model.addMultiRotation(Part_1_doc, [model.selection("SHELL", "Recover_4_1_5")], model.selection("EDGE", "PartSet/OX"), COPIES) +MultiRotation_5 = model.addMultiRotation( + Part_1_doc, + [model.selection("SHELL", "Recover_4_1_5")], + model.selection("EDGE", "PartSet/OX"), + COPIES, +) model.testNbResults(MultiRotation_5, 1) model.testNbSubResults(MultiRotation_5, [COPIES]) model.testNbSubShapes(MultiRotation_5, GeomAPI_Shape.SOLID, [0]) @@ -161,10 +305,15 @@ refPoint = Shell_1.defaultResult().shape().middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_5 = model.addRecover(Part_1_doc, MultiRotation_5, [Recover_4.result()]) -MultiRotation_6 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Recover_5_1_6")], model.selection("EDGE", "PartSet/OX"), COPIES) +MultiRotation_6 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Recover_5_1_6")], + model.selection("EDGE", "PartSet/OX"), + COPIES, +) model.testNbResults(MultiRotation_6, 1) model.testNbSubResults(MultiRotation_6, [COPIES]) model.testNbSubShapes(MultiRotation_6, GeomAPI_Shape.SOLID, [COPIES]) @@ -176,10 +325,15 @@ refPoint = Translation_1.defaultResult().shape().middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_6 = model.addRecover(Part_1_doc, MultiRotation_6, [Recover_5.result()]) -MultiRotation_7 = model.addMultiRotation(Part_1_doc, [model.selection("COMPSOLID", "Recover_6_1_7")], model.selection("EDGE", "PartSet/OX"), COPIES) +MultiRotation_7 = model.addMultiRotation( + Part_1_doc, + [model.selection("COMPSOLID", "Recover_6_1_7")], + model.selection("EDGE", "PartSet/OX"), + COPIES, +) model.testNbResults(MultiRotation_7, 1) model.testNbSubResults(MultiRotation_7, [COPIES]) model.testNbSubShapes(MultiRotation_7, GeomAPI_Shape.SOLID, [3 * COPIES]) @@ -191,10 +345,15 @@ refPoint = Partition_1.defaultResult().shape().middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_7 = model.addRecover(Part_1_doc, MultiRotation_7, [Recover_6.result()]) -MultiRotation_8 = model.addMultiRotation(Part_1_doc, [model.selection("COMPOUND", "Recover_7_1_8")], model.selection("EDGE", "PartSet/OX"), COPIES) +MultiRotation_8 = model.addMultiRotation( + Part_1_doc, + [model.selection("COMPOUND", "Recover_7_1_8")], + model.selection("EDGE", "PartSet/OX"), + COPIES, +) model.testNbResults(MultiRotation_8, 1) model.testNbSubResults(MultiRotation_8, [COPIES]) model.testNbSubShapes(MultiRotation_8, GeomAPI_Shape.SOLID, [3 * COPIES]) @@ -206,8 +365,8 @@ refPoint = AngularCopy_1.defaultResult().shape().middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v95_1.py b/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v95_1.py index 598b20f1c..68e55997c 100644 --- a/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v95_1.py +++ b/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v95_1.py @@ -27,53 +27,136 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() ANGLE = 60 COPIES = 3 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + def subsRefPoints(theResult): res = [] for ind in range(0, theResult.numberOfSubs()): - res.append( theResult.subResult(ind).resultSubShapePair()[0].shape().middlePoint()) + res.append( + theResult.subResult(ind).resultSubShapePair()[0].shape().middlePoint() + ) return res + REFERENCE = subsRefPoints(Compound_2.result()) -def assertResult(theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, theVolume): + +def assertResult( + theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, theVolume +): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [3]) model.testNbSubShapes(theFeature, GeomAPI_Shape.SOLID, [theNbSolids]) @@ -84,30 +167,72 @@ def assertResult(theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, for ind in range(0, theFeature.result().numberOfSubs()): ref = REFERENCE[ind] - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -MultiRotation_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("EDGE", "PartSet/OZ"), ANGLE, COPIES, keepSubResults = True) +MultiRotation_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, + COPIES, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(MultiRotation_1.feature().error() != "") +assert MultiRotation_1.feature().error() != "" model.begin() MultiRotation_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")]) REFERENCE[0] = GeomAPI_Pnt(26.21750044779, -12.5, 5) assertResult(MultiRotation_1, 24, 123, 450, 900, 38247.599) -MultiRotation_2 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "AngularCopy_1_1_2_1")], model.selection("EDGE", "PartSet/OZ"), ANGLE, COPIES, keepSubResults = True) +MultiRotation_2 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "AngularCopy_1_1_2_1")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, + COPIES, + keepSubResults=True, +) REFERENCE[1] = GeomAPI_Pnt(21.6506350946, 5.3316102, 5) assertResult(MultiRotation_2, 26, 129, 462, 924, 39818.3954) -MultiRotation_3 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "AngularCopy_2_1_3")], model.selection("EDGE", "PartSet/OZ"), ANGLE, COPIES, keepSubResults = True) +MultiRotation_3 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "AngularCopy_2_1_3")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, + COPIES, + keepSubResults=True, +) REFERENCE[2] = GeomAPI_Pnt(31.94572, -30.3316102, 5) assertResult(MultiRotation_3, 28, 135, 474, 948, 41389.19175) -MultiRotation_4 = model.addMultiRotation(Part_1_doc, [model.selection("COMPSOLID", "AngularCopy_3_1_1_1"), model.selection("SOLID", "AngularCopy_3_1_2_2"), model.selection("COMPOUND", "AngularCopy_3_1_3")], model.selection("EDGE", "PartSet/OZ"), -ANGLE, COPIES, keepSubResults = True) +MultiRotation_4 = model.addMultiRotation( + Part_1_doc, + [ + model.selection("COMPSOLID", "AngularCopy_3_1_1_1"), + model.selection("SOLID", "AngularCopy_3_1_2_2"), + model.selection("COMPOUND", "AngularCopy_3_1_3"), + ], + model.selection("EDGE", "PartSet/OZ"), + -ANGLE, + COPIES, + keepSubResults=True, +) REFERENCE[0] = GeomAPI_Pnt(0, -12.5, 5) REFERENCE[1] = GeomAPI_Pnt(20.59016994, 5.3316102, 5) REFERENCE[2] = GeomAPI_Pnt(0, -12.5, 5) @@ -115,4 +240,4 @@ assertResult(MultiRotation_4, 50, 235, 810, 1620, 71599.98) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v95_2.py b/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v95_2.py index 1dac17bd9..63e7957b9 100644 --- a/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v95_2.py +++ b/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v95_2.py @@ -27,52 +27,135 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() COPIES = 3 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + def subsRefPoints(theResult): res = [] for ind in range(0, theResult.numberOfSubs()): - res.append( theResult.subResult(ind).resultSubShapePair()[0].shape().middlePoint()) + res.append( + theResult.subResult(ind).resultSubShapePair()[0].shape().middlePoint() + ) return res + REFERENCE = subsRefPoints(Compound_2.result()) -def assertResult(theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, theVolume): + +def assertResult( + theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, theVolume +): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [3]) model.testNbSubShapes(theFeature, GeomAPI_Shape.SOLID, [theNbSolids]) @@ -83,32 +166,70 @@ def assertResult(theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, for ind in range(0, theFeature.result().numberOfSubs()): ref = REFERENCE[ind] - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -MultiRotation_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("EDGE", "PartSet/OZ"), COPIES, keepSubResults = True) +MultiRotation_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("EDGE", "PartSet/OZ"), + COPIES, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(MultiRotation_1.feature().error() != "") +assert MultiRotation_1.feature().error() != "" model.begin() MultiRotation_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")]) REFERENCE[0] = GeomAPI_Pnt(4.566865353, -12.5, 5) assertResult(MultiRotation_1, 24, 123, 450, 900, 38247.599) -MultiRotation_2 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "AngularCopy_1_1_2_1")], model.selection("EDGE", "PartSet/OZ"), COPIES, keepSubResults = True) +MultiRotation_2 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "AngularCopy_1_1_2_1")], + model.selection("EDGE", "PartSet/OZ"), + COPIES, + keepSubResults=True, +) REFERENCE[1] = GeomAPI_Pnt(-11.35555012, 5.3316102, 5) assertResult(MultiRotation_2, 26, 129, 462, 924, 39818.3954) -MultiRotation_3 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "AngularCopy_2_1_3")], model.selection("EDGE", "PartSet/OZ"), COPIES, keepSubResults = True) +MultiRotation_3 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "AngularCopy_2_1_3")], + model.selection("EDGE", "PartSet/OZ"), + COPIES, + keepSubResults=True, +) REFERENCE[2] = GeomAPI_Pnt(10.29508497, -12.5, 5) assertResult(MultiRotation_3, 28, 135, 474, 948, 41389.19175) -MultiRotation_4 = model.addMultiRotation(Part_1_doc, [model.selection("COMPSOLID", "AngularCopy_3_1_1_1"), model.selection("SOLID", "AngularCopy_3_1_2_2"), model.selection("COMPOUND", "AngularCopy_3_1_3")], model.selection("EDGE", "PartSet/OZ"), COPIES, keepSubResults = True) +MultiRotation_4 = model.addMultiRotation( + Part_1_doc, + [ + model.selection("COMPSOLID", "AngularCopy_3_1_1_1"), + model.selection("SOLID", "AngularCopy_3_1_2_2"), + model.selection("COMPOUND", "AngularCopy_3_1_3"), + ], + model.selection("EDGE", "PartSet/OZ"), + COPIES, + keepSubResults=True, +) assertResult(MultiRotation_4, 50, 235, 810, 1620, 71599.98) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v95_3.py b/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v95_3.py index 3cf69ea23..65587480f 100644 --- a/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v95_3.py +++ b/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v95_3.py @@ -27,60 +27,177 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 COPIES = 4 model.begin() -MultiRotation_1 = model.addMultiRotation(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("EDGE", "PartSet/OX"), COPIES, keepSubResults = True) +MultiRotation_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("VERTEX", "Vertex_1_1")], + model.selection("EDGE", "PartSet/OX"), + COPIES, + keepSubResults=True, +) model.testNbResults(MultiRotation_1, 1) model.testNbSubResults(MultiRotation_1, [COPIES]) model.testNbSubShapes(MultiRotation_1, GeomAPI_Shape.SOLID, [0]) @@ -93,9 +210,15 @@ refPoint = Vertex_1.defaultResult().shape().middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiRotation_2 = model.addMultiRotation(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OX"), COPIES, keepSubResults = True) +MultiRotation_2 = model.addMultiRotation( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OX"), + COPIES, + keepSubResults=True, +) model.testNbResults(MultiRotation_2, 1) model.testNbSubResults(MultiRotation_2, [COPIES]) model.testNbSubShapes(MultiRotation_2, GeomAPI_Shape.SOLID, [0]) @@ -109,9 +232,15 @@ refPoint = comp.middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiRotation_3 = model.addMultiRotation(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("EDGE", "PartSet/OX"), COPIES, keepSubResults = True) +MultiRotation_3 = model.addMultiRotation( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + model.selection("EDGE", "PartSet/OX"), + COPIES, + keepSubResults=True, +) model.testNbResults(MultiRotation_3, 1) model.testNbSubResults(MultiRotation_3, [COPIES]) model.testNbSubShapes(MultiRotation_3, GeomAPI_Shape.SOLID, [0]) @@ -125,9 +254,15 @@ refPoint = comp.middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiRotation_4 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OX"), COPIES, keepSubResults = True) +MultiRotation_4 = model.addMultiRotation( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("EDGE", "PartSet/OX"), + COPIES, + keepSubResults=True, +) model.testNbResults(MultiRotation_4, 1) model.testNbSubResults(MultiRotation_4, [COPIES]) model.testNbSubShapes(MultiRotation_4, GeomAPI_Shape.SOLID, [0]) @@ -140,9 +275,15 @@ refPoint = Face_1.defaultResult().shape().middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiRotation_5 = model.addMultiRotation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OX"), COPIES, keepSubResults = True) +MultiRotation_5 = model.addMultiRotation( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + model.selection("EDGE", "PartSet/OX"), + COPIES, + keepSubResults=True, +) model.testNbResults(MultiRotation_5, 1) model.testNbSubResults(MultiRotation_5, [COPIES]) model.testNbSubShapes(MultiRotation_5, GeomAPI_Shape.SOLID, [0]) @@ -155,9 +296,15 @@ refPoint = Shell_1.defaultResult().shape().middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiRotation_6 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OX"), COPIES, keepSubResults = True) +MultiRotation_6 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + model.selection("EDGE", "PartSet/OX"), + COPIES, + keepSubResults=True, +) model.testNbResults(MultiRotation_6, 1) model.testNbSubResults(MultiRotation_6, [COPIES]) model.testNbSubShapes(MultiRotation_6, GeomAPI_Shape.SOLID, [COPIES]) @@ -169,9 +316,15 @@ refPoint = Translation_1.defaultResult().shape().middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiRotation_7 = model.addMultiRotation(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("EDGE", "PartSet/OX"), COPIES, keepSubResults = True) +MultiRotation_7 = model.addMultiRotation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + model.selection("EDGE", "PartSet/OX"), + COPIES, + keepSubResults=True, +) model.testNbResults(MultiRotation_7, 1) model.testNbSubResults(MultiRotation_7, [COPIES]) model.testNbSubShapes(MultiRotation_7, GeomAPI_Shape.SOLID, [3 * COPIES]) @@ -183,9 +336,15 @@ refPoint = Partition_1.defaultResult().shape().middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiRotation_8 = model.addMultiRotation(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], model.selection("EDGE", "PartSet/OX"), COPIES, keepSubResults = True) +MultiRotation_8 = model.addMultiRotation( + Part_1_doc, + [model.selection("COMPOUND", "AngularCopy_1_1")], + model.selection("EDGE", "PartSet/OX"), + COPIES, + keepSubResults=True, +) model.testNbResults(MultiRotation_8, 1) model.testNbSubResults(MultiRotation_8, [COPIES]) model.testNbSubShapes(MultiRotation_8, GeomAPI_Shape.SOLID, [3 * COPIES]) @@ -197,8 +356,8 @@ refPoint = AngularCopy_1.defaultResult().shape().middlePoint() refPoint.setY(0) refPoint.setZ(0) midPoint = MultiRotation_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v95_4.py b/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v95_4.py index 99e97a25a..4debc59de 100644 --- a/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v95_4.py +++ b/src/FeaturesPlugin/Test/TestMultiRotation_MultiLevelCompound_v95_4.py @@ -27,57 +27,177 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 COPIES = 4 NB_SOLIDS = 7 @@ -92,6 +212,7 @@ for ind in range(0, Compound_1.result().numberOfSubs()): p = Compound_1.result().subResult(ind).resultSubShapePair()[1].middlePoint() REFERENCE.append(p) + def assertResult(theFeature, theNbMoved): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [8]) @@ -106,42 +227,88 @@ def assertResult(theFeature, theNbMoved): if ind < theNbMoved: ref.setY(0) ref.setZ(0) - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -MultiRotation_1 = model.addMultiRotation(Part_1_doc, [model.selection("VERTEX", "Compound_1_1_1")], model.selection("EDGE", "PartSet/OX"), COPIES, keepSubResults = True) +MultiRotation_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("VERTEX", "Compound_1_1_1")], + model.selection("EDGE", "PartSet/OX"), + COPIES, + keepSubResults=True, +) NB_VERTICES += COPIES - 1 assertResult(MultiRotation_1, 1) -MultiRotation_2 = model.addMultiRotation(Part_1_doc, [model.selection("EDGE", "AngularCopy_2_1_2")], model.selection("EDGE", "PartSet/OX"), COPIES, keepSubResults = True) +MultiRotation_2 = model.addMultiRotation( + Part_1_doc, + [model.selection("EDGE", "AngularCopy_2_1_2")], + model.selection("EDGE", "PartSet/OX"), + COPIES, + keepSubResults=True, +) c = GeomAlgoAPI_CompoundBuilder.compound([Edge_1.defaultResult().shape()]) REFERENCE[1] = c.middlePoint() NB_EDGES += COPIES - 1 NB_VERTICES += 2 * (COPIES - 1) assertResult(MultiRotation_2, 2) -MultiRotation_3 = model.addMultiRotation(Part_1_doc, [model.selection("WIRE", "AngularCopy_3_1_3")], model.selection("EDGE", "PartSet/OX"), COPIES, keepSubResults = True) +MultiRotation_3 = model.addMultiRotation( + Part_1_doc, + [model.selection("WIRE", "AngularCopy_3_1_3")], + model.selection("EDGE", "PartSet/OX"), + COPIES, + keepSubResults=True, +) c = GeomAlgoAPI_CompoundBuilder.compound([Wire_1.defaultResult().shape()]) REFERENCE[2] = c.middlePoint() NB_EDGES += 2 * (COPIES - 1) NB_VERTICES += 4 * (COPIES - 1) assertResult(MultiRotation_3, 3) -MultiRotation_4 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "AngularCopy_4_1_4")], model.selection("EDGE", "PartSet/OX"), COPIES, keepSubResults = True) +MultiRotation_4 = model.addMultiRotation( + Part_1_doc, + [model.selection("FACE", "AngularCopy_4_1_4")], + model.selection("EDGE", "PartSet/OX"), + COPIES, + keepSubResults=True, +) NB_FACES += COPIES - 1 NB_EDGES += 4 * (COPIES - 1) NB_VERTICES += 8 * (COPIES - 1) assertResult(MultiRotation_4, 4) -MultiRotation_5 = model.addMultiRotation(Part_1_doc, [model.selection("SHELL", "AngularCopy_5_1_5")], model.selection("EDGE", "PartSet/OX"), COPIES, keepSubResults = True) +MultiRotation_5 = model.addMultiRotation( + Part_1_doc, + [model.selection("SHELL", "AngularCopy_5_1_5")], + model.selection("EDGE", "PartSet/OX"), + COPIES, + keepSubResults=True, +) NB_FACES += 2 * (COPIES - 1) NB_EDGES += 8 * (COPIES - 1) NB_VERTICES += 16 * (COPIES - 1) assertResult(MultiRotation_5, 5) -MultiRotation_6 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "AngularCopy_6_1_6")], model.selection("EDGE", "PartSet/OX"), COPIES, keepSubResults = True) +MultiRotation_6 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "AngularCopy_6_1_6")], + model.selection("EDGE", "PartSet/OX"), + COPIES, + keepSubResults=True, +) NB_SOLIDS += COPIES - 1 NB_FACES += 6 * (COPIES - 1) NB_EDGES += 24 * (COPIES - 1) @@ -149,7 +316,13 @@ NB_VERTICES += 48 * (COPIES - 1) VOLUME += 1000 * (COPIES - 1) assertResult(MultiRotation_6, 6) -MultiRotation_7 = model.addMultiRotation(Part_1_doc, [model.selection("COMPSOLID", "AngularCopy_7_1_7")], model.selection("EDGE", "PartSet/OX"), COPIES, keepSubResults = True) +MultiRotation_7 = model.addMultiRotation( + Part_1_doc, + [model.selection("COMPSOLID", "AngularCopy_7_1_7")], + model.selection("EDGE", "PartSet/OX"), + COPIES, + keepSubResults=True, +) NB_SOLIDS += 3 * (COPIES - 1) NB_FACES += 17 * (COPIES - 1) NB_EDGES += 66 * (COPIES - 1) @@ -157,7 +330,13 @@ NB_VERTICES += 132 * (COPIES - 1) VOLUME += 1589.0486226 * (COPIES - 1) assertResult(MultiRotation_7, 7) -MultiRotation_8 = model.addMultiRotation(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_8_1_8")], model.selection("EDGE", "PartSet/OX"), COPIES, keepSubResults = True) +MultiRotation_8 = model.addMultiRotation( + Part_1_doc, + [model.selection("COMPOUND", "AngularCopy_8_1_8")], + model.selection("EDGE", "PartSet/OX"), + COPIES, + keepSubResults=True, +) NB_SOLIDS += 3 * (COPIES - 1) NB_FACES += 18 * (COPIES - 1) NB_EDGES += 72 * (COPIES - 1) @@ -167,4 +346,4 @@ assertResult(MultiRotation_8, 8) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestMultiRotation_Part.py b/src/FeaturesPlugin/Test/TestMultiRotation_Part.py index 9c87c3465..8ef5efb2a 100644 --- a/src/FeaturesPlugin/Test/TestMultiRotation_Part.py +++ b/src/FeaturesPlugin/Test/TestMultiRotation_Part.py @@ -25,7 +25,9 @@ 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) +AngularCopy_1 = model.addMultiRotation( + partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("EDGE", "OZ"), 2 +) model.end() from GeomAPI import GeomAPI_Shape diff --git a/src/FeaturesPlugin/Test/TestMultiTranslation_ErrorMsg.py b/src/FeaturesPlugin/Test/TestMultiTranslation_ErrorMsg.py index 7a37814bf..3e75d0458 100644 --- a/src/FeaturesPlugin/Test/TestMultiTranslation_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestMultiTranslation_ErrorMsg.py @@ -19,6 +19,7 @@ from ModelAPI import * + aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -48,26 +49,26 @@ aSession.finishOperation() aSession.startOperation() aLinearCopy1 = aPart.addFeature("LinearCopy") aLinearCopy1.execute() -assert(aLinearCopy1.error() != "") +assert aLinearCopy1.error() != "" aSession.finishOperation() aSession.startOperation() aLinearCopy1.selectionList("main_objects").append("Compound_1_1", "COMPOUND") aLinearCopy1.execute() -assert(aLinearCopy1.error() != "") +assert aLinearCopy1.error() != "" aSession.finishOperation() aSession.startOperation() aLinearCopy1.selection("axis_first_dir").selectSubShape("COMPOUND", "Compound_1_1") aLinearCopy1.execute() -assert(aLinearCopy1.error() != "") +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() != "") +assert aLinearCopy1.error() != "" aSession.finishOperation() @@ -75,26 +76,26 @@ aSession.startOperation() aLinearCopy2 = aPart.addFeature("LinearCopy") aLinearCopy2.string("use_second_dir").setValue("true") aLinearCopy2.execute() -assert(aLinearCopy2.error() != "") +assert aLinearCopy2.error() != "" aSession.finishOperation() aSession.startOperation() aLinearCopy2.selectionList("main_objects").append("Compound_1_1", "COMPOUND") aLinearCopy2.execute() -assert(aLinearCopy2.error() != "") +assert aLinearCopy2.error() != "" aSession.finishOperation() aSession.startOperation() aLinearCopy2.selection("axis_first_dir").selectSubShape("COMPOUND", "Compound_1_1") aLinearCopy2.execute() -assert(aLinearCopy2.error() != "") +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() != "") +assert aLinearCopy2.error() != "" aSession.finishOperation() aSession.startOperation() @@ -102,12 +103,12 @@ 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() != "") +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() != "") +assert aLinearCopy2.error() != "" aSession.finishOperation() diff --git a/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v0_1.py b/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v0_1.py index 8ca9f8ca0..dfad26dc9 100644 --- a/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v0_1.py +++ b/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v0_1.py @@ -28,47 +28,129 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() DISTANCE = 20 COPIES = 3 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 model.begin() -MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +MultiTranslation_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_1, 1) model.testNbSubResults(MultiTranslation_1, [COPIES]) model.testNbSubShapes(MultiTranslation_1, GeomAPI_Shape.SOLID, [1 * COPIES]) @@ -77,15 +159,25 @@ model.testNbSubShapes(MultiTranslation_1, GeomAPI_Shape.EDGE, [18 * COPIES]) model.testNbSubShapes(MultiTranslation_1, GeomAPI_Shape.VERTEX, [36 * COPIES]) model.testResultsVolumes(MultiTranslation_1, [542.746463956 * COPIES]) -comp = GeomAlgoAPI_CompoundBuilder.compound([Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape()]) +comp = GeomAlgoAPI_CompoundBuilder.compound( + [Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape()] +) refPoint = comp.middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Recover_1 = model.addRecover(Part_1_doc, MultiTranslation_1, [Compound_2.result()], True) -MultiTranslation_2 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Recover_1_1_2_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +Recover_1 = model.addRecover( + Part_1_doc, MultiTranslation_1, [Compound_2.result()], True +) +MultiTranslation_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Recover_1_1_2_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_2, 1) model.testNbSubResults(MultiTranslation_2, [COPIES]) model.testNbSubShapes(MultiTranslation_2, GeomAPI_Shape.SOLID, [1 * COPIES]) @@ -94,14 +186,27 @@ model.testNbSubShapes(MultiTranslation_2, GeomAPI_Shape.EDGE, [6 * COPIES]) model.testNbSubShapes(MultiTranslation_2, GeomAPI_Shape.VERTEX, [12 * COPIES]) model.testResultsVolumes(MultiTranslation_2, [785.39816339745 * COPIES]) -refPoint = Recover_1.result().subResult(1).subResult(0).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Recover_1.result() + .subResult(1) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint() +) refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, MultiTranslation_2, [Recover_1.result()], True) -MultiTranslation_3 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Recover_2_1_3")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +MultiTranslation_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Recover_2_1_3")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_3, 1) model.testNbSubResults(MultiTranslation_3, [COPIES]) model.testNbSubShapes(MultiTranslation_3, GeomAPI_Shape.SOLID, [1 * COPIES]) @@ -113,28 +218,58 @@ model.testResultsVolumes(MultiTranslation_3, [785.39816339745 * COPIES]) refPoint = Recover_2.result().subResult(2).resultSubShapePair()[0].shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_3 = model.addRecover(Part_1_doc, MultiTranslation_3, [Recover_2.result()], True) -MultiTranslation_4 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Recover_3_1_1_1"), model.selection("SOLID", "Recover_3_1_2_2"), model.selection("SOLID", "Recover_3_1_3")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +MultiTranslation_4 = model.addMultiTranslation( + Part_1_doc, + [ + model.selection("SOLID", "Recover_3_1_1_1"), + model.selection("SOLID", "Recover_3_1_2_2"), + model.selection("SOLID", "Recover_3_1_3"), + ], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_4, 3) model.testNbSubResults(MultiTranslation_4, [COPIES, COPIES, COPIES]) -model.testNbSubShapes(MultiTranslation_4, GeomAPI_Shape.SOLID, [1 * COPIES, 1 * COPIES, 1 * COPIES]) -model.testNbSubShapes(MultiTranslation_4, GeomAPI_Shape.FACE, [6 * COPIES, 3 * COPIES, 3 * COPIES]) -model.testNbSubShapes(MultiTranslation_4, GeomAPI_Shape.EDGE, [24 * COPIES, 6 * COPIES, 6 * COPIES]) -model.testNbSubShapes(MultiTranslation_4, GeomAPI_Shape.VERTEX, [48 * COPIES, 12 * COPIES, 12 * COPIES]) -model.testResultsVolumes(MultiTranslation_4, [3444.394198615 * COPIES, 785.39816339745 * COPIES, 785.39816339745 * COPIES]) - -comp = GeomAlgoAPI_CompoundBuilder.compound([Recover_3.result().subResult(0).subResult(0).resultSubShapePair()[0].shape()]) -REFERENCE = [comp.middlePoint(), - Recover_3.result().subResult(1).subResult(1).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()] +model.testNbSubShapes( + MultiTranslation_4, GeomAPI_Shape.SOLID, [1 * COPIES, 1 * COPIES, 1 * COPIES] +) +model.testNbSubShapes( + MultiTranslation_4, GeomAPI_Shape.FACE, [6 * COPIES, 3 * COPIES, 3 * COPIES] +) +model.testNbSubShapes( + MultiTranslation_4, GeomAPI_Shape.EDGE, [24 * COPIES, 6 * COPIES, 6 * COPIES] +) +model.testNbSubShapes( + MultiTranslation_4, GeomAPI_Shape.VERTEX, [48 * COPIES, 12 * COPIES, 12 * COPIES] +) +model.testResultsVolumes( + MultiTranslation_4, + [3444.394198615 * COPIES, 785.39816339745 * COPIES, 785.39816339745 * COPIES], +) + +comp = GeomAlgoAPI_CompoundBuilder.compound( + [Recover_3.result().subResult(0).subResult(0).resultSubShapePair()[0].shape()] +) +REFERENCE = [ + comp.middlePoint(), + Recover_3.result() + .subResult(1) + .subResult(1) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint(), +] for res, ref in zip(MultiTranslation_4.results(), REFERENCE): ref.setZ(ref.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE) + assert midPoint.distance(ref) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v0_2.py b/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v0_2.py index 458217537..3f607c31d 100644 --- a/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v0_2.py +++ b/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v0_2.py @@ -28,41 +28,117 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 DISTANCE_1 = 20 COPIES_1 = 3 DISTANCE_2 = 100 @@ -70,7 +146,16 @@ COPIES_2 = 2 COPIES = COPIES_1 * COPIES_2 model.begin() -MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("EDGE", "PartSet/OZ"), DISTANCE_1, COPIES_1, model.selection("EDGE", "PartSet/OY"), DISTANCE_2, COPIES_2) +MultiTranslation_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE_1, + COPIES_1, + model.selection("EDGE", "PartSet/OY"), + DISTANCE_2, + COPIES_2, +) model.testNbResults(MultiTranslation_1, 1) model.testNbSubResults(MultiTranslation_1, [COPIES]) model.testNbSubShapes(MultiTranslation_1, GeomAPI_Shape.SOLID, [1 * COPIES]) @@ -79,16 +164,29 @@ model.testNbSubShapes(MultiTranslation_1, GeomAPI_Shape.EDGE, [18 * COPIES]) model.testNbSubShapes(MultiTranslation_1, GeomAPI_Shape.VERTEX, [36 * COPIES]) model.testResultsVolumes(MultiTranslation_1, [542.746463956 * COPIES]) -comp = GeomAlgoAPI_CompoundBuilder.compound([Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape()]) +comp = GeomAlgoAPI_CompoundBuilder.compound( + [Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape()] +) refPoint = comp.middlePoint() refPoint.setY(refPoint.y() + DISTANCE_2 / 2 * (COPIES_2 - 1)) refPoint.setZ(refPoint.z() + DISTANCE_1 / 2 * (COPIES_1 - 1)) midPoint = MultiTranslation_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Recover_1 = model.addRecover(Part_1_doc, MultiTranslation_1, [Compound_2.result()], True) -MultiTranslation_2 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Recover_1_1_2_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE_1, COPIES_1, model.selection("EDGE", "PartSet/OY"), DISTANCE_2, COPIES_2) +Recover_1 = model.addRecover( + Part_1_doc, MultiTranslation_1, [Compound_2.result()], True +) +MultiTranslation_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Recover_1_1_2_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE_1, + COPIES_1, + model.selection("EDGE", "PartSet/OY"), + DISTANCE_2, + COPIES_2, +) model.testNbResults(MultiTranslation_2, 1) model.testNbSubResults(MultiTranslation_2, [COPIES]) model.testNbSubShapes(MultiTranslation_2, GeomAPI_Shape.SOLID, [1 * COPIES]) @@ -97,15 +195,31 @@ model.testNbSubShapes(MultiTranslation_2, GeomAPI_Shape.EDGE, [6 * COPIES]) model.testNbSubShapes(MultiTranslation_2, GeomAPI_Shape.VERTEX, [12 * COPIES]) model.testResultsVolumes(MultiTranslation_2, [785.39816339745 * COPIES]) -refPoint = Recover_1.result().subResult(1).subResult(0).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Recover_1.result() + .subResult(1) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint() +) refPoint.setY(refPoint.y() + DISTANCE_2 / 2 * (COPIES_2 - 1)) refPoint.setZ(refPoint.z() + DISTANCE_1 / 2 * (COPIES_1 - 1)) midPoint = MultiTranslation_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, MultiTranslation_2, [Recover_1.result()], True) -MultiTranslation_3 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Recover_2_1_3")], model.selection("EDGE", "PartSet/OZ"), DISTANCE_1, COPIES_1, model.selection("EDGE", "PartSet/OY"), DISTANCE_2, COPIES_2) +MultiTranslation_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Recover_2_1_3")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE_1, + COPIES_1, + model.selection("EDGE", "PartSet/OY"), + DISTANCE_2, + COPIES_2, +) model.testNbResults(MultiTranslation_3, 1) model.testNbSubResults(MultiTranslation_3, [COPIES]) model.testNbSubShapes(MultiTranslation_3, GeomAPI_Shape.SOLID, [1 * COPIES]) @@ -118,29 +232,62 @@ refPoint = Recover_2.result().subResult(2).resultSubShapePair()[0].shape().middl refPoint.setY(refPoint.y() + DISTANCE_2 / 2 * (COPIES_2 - 1)) refPoint.setZ(refPoint.z() + DISTANCE_1 / 2 * (COPIES_1 - 1)) midPoint = MultiTranslation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_3 = model.addRecover(Part_1_doc, MultiTranslation_3, [Recover_2.result()], True) -MultiTranslation_4 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Recover_3_1_1_1"), model.selection("SOLID", "Recover_3_1_2_2"), model.selection("SOLID", "Recover_3_1_3")], model.selection("EDGE", "PartSet/OZ"), DISTANCE_1, COPIES_1, model.selection("EDGE", "PartSet/OY"), DISTANCE_2, COPIES_2) +MultiTranslation_4 = model.addMultiTranslation( + Part_1_doc, + [ + model.selection("SOLID", "Recover_3_1_1_1"), + model.selection("SOLID", "Recover_3_1_2_2"), + model.selection("SOLID", "Recover_3_1_3"), + ], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE_1, + COPIES_1, + model.selection("EDGE", "PartSet/OY"), + DISTANCE_2, + COPIES_2, +) model.testNbResults(MultiTranslation_4, 3) model.testNbSubResults(MultiTranslation_4, [COPIES, COPIES, COPIES]) -model.testNbSubShapes(MultiTranslation_4, GeomAPI_Shape.SOLID, [1 * COPIES, 1 * COPIES, 1 * COPIES]) -model.testNbSubShapes(MultiTranslation_4, GeomAPI_Shape.FACE, [6 * COPIES, 3 * COPIES, 3 * COPIES]) -model.testNbSubShapes(MultiTranslation_4, GeomAPI_Shape.EDGE, [24 * COPIES, 6 * COPIES, 6 * COPIES]) -model.testNbSubShapes(MultiTranslation_4, GeomAPI_Shape.VERTEX, [48 * COPIES, 12 * COPIES, 12 * COPIES]) -model.testResultsVolumes(MultiTranslation_4, [3444.394198615 * COPIES, 785.39816339745 * COPIES, 785.39816339745 * COPIES]) - -comp = GeomAlgoAPI_CompoundBuilder.compound([Recover_3.result().subResult(0).subResult(0).resultSubShapePair()[0].shape()]) -REFERENCE = [comp.middlePoint(), - Recover_3.result().subResult(1).subResult(1).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()] +model.testNbSubShapes( + MultiTranslation_4, GeomAPI_Shape.SOLID, [1 * COPIES, 1 * COPIES, 1 * COPIES] +) +model.testNbSubShapes( + MultiTranslation_4, GeomAPI_Shape.FACE, [6 * COPIES, 3 * COPIES, 3 * COPIES] +) +model.testNbSubShapes( + MultiTranslation_4, GeomAPI_Shape.EDGE, [24 * COPIES, 6 * COPIES, 6 * COPIES] +) +model.testNbSubShapes( + MultiTranslation_4, GeomAPI_Shape.VERTEX, [48 * COPIES, 12 * COPIES, 12 * COPIES] +) +model.testResultsVolumes( + MultiTranslation_4, + [3444.394198615 * COPIES, 785.39816339745 * COPIES, 785.39816339745 * COPIES], +) + +comp = GeomAlgoAPI_CompoundBuilder.compound( + [Recover_3.result().subResult(0).subResult(0).resultSubShapePair()[0].shape()] +) +REFERENCE = [ + comp.middlePoint(), + Recover_3.result() + .subResult(1) + .subResult(1) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint(), +] for res, ref in zip(MultiTranslation_4.results(), REFERENCE): ref.setY(ref.y() + DISTANCE_2 / 2 * (COPIES_2 - 1)) ref.setZ(ref.z() + DISTANCE_1 / 2 * (COPIES_1 - 1)) midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE) + assert midPoint.distance(ref) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v0_3.py b/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v0_3.py index 726353a20..af8a091ba 100644 --- a/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v0_3.py +++ b/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v0_3.py @@ -27,61 +27,177 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 DISTANCE = 20 COPIES = 2 model.begin() -MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +MultiTranslation_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("VERTEX", "Vertex_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_1, 1) model.testNbSubResults(MultiTranslation_1, [COPIES]) model.testNbSubShapes(MultiTranslation_1, GeomAPI_Shape.SOLID, [0]) @@ -93,9 +209,15 @@ model.testResultsAreas(MultiTranslation_1, [0]) refPoint = Vertex_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiTranslation_2 = model.addMultiTranslation(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +MultiTranslation_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_2, 1) model.testNbSubResults(MultiTranslation_2, [COPIES]) model.testNbSubShapes(MultiTranslation_2, GeomAPI_Shape.SOLID, [0]) @@ -108,9 +230,15 @@ comp = GeomAlgoAPI_CompoundBuilder.compound([Edge_1.defaultResult().shape()]) refPoint = comp.middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiTranslation_3 = model.addMultiTranslation(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +MultiTranslation_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_3, 1) model.testNbSubResults(MultiTranslation_3, [COPIES]) model.testNbSubShapes(MultiTranslation_3, GeomAPI_Shape.SOLID, [0]) @@ -123,9 +251,15 @@ comp = GeomAlgoAPI_CompoundBuilder.compound([Wire_1.defaultResult().shape()]) refPoint = comp.middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiTranslation_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +MultiTranslation_4 = model.addMultiTranslation( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_4, 1) model.testNbSubResults(MultiTranslation_4, [COPIES]) model.testNbSubShapes(MultiTranslation_4, GeomAPI_Shape.SOLID, [0]) @@ -137,9 +271,15 @@ model.testResultsAreas(MultiTranslation_4, [109.154152964914914 * COPIES]) refPoint = Face_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiTranslation_5 = model.addMultiTranslation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +MultiTranslation_5 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_5, 1) model.testNbSubResults(MultiTranslation_5, [COPIES]) model.testNbSubShapes(MultiTranslation_5, GeomAPI_Shape.SOLID, [0]) @@ -151,9 +291,15 @@ model.testResultsAreas(MultiTranslation_5, [182.822012116 * COPIES]) refPoint = Shell_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiTranslation_6 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +MultiTranslation_6 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_6, 1) model.testNbSubResults(MultiTranslation_6, [COPIES]) model.testNbSubShapes(MultiTranslation_6, GeomAPI_Shape.SOLID, [COPIES]) @@ -164,9 +310,15 @@ model.testResultsVolumes(MultiTranslation_6, [1000 * COPIES]) refPoint = Translation_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiTranslation_7 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +MultiTranslation_7 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_7, 1) model.testNbSubResults(MultiTranslation_7, [COPIES]) model.testNbSubShapes(MultiTranslation_7, GeomAPI_Shape.SOLID, [3 * COPIES]) @@ -177,9 +329,15 @@ model.testResultsVolumes(MultiTranslation_7, [1589.0486226 * COPIES]) refPoint = Partition_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiTranslation_8 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +MultiTranslation_8 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "AngularCopy_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_8, 1) model.testNbSubResults(MultiTranslation_8, [COPIES]) model.testNbSubShapes(MultiTranslation_8, GeomAPI_Shape.SOLID, [3 * COPIES]) @@ -190,8 +348,8 @@ model.testResultsVolumes(MultiTranslation_8, [3000 * COPIES]) refPoint = AngularCopy_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v0_4.py b/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v0_4.py index 9d1fbe42c..c7b6be2a1 100644 --- a/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v0_4.py +++ b/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v0_4.py @@ -27,63 +27,188 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 DISTANCE = 20 COPIES = 2 model.begin() -MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("VERTEX", "Compound_1_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +MultiTranslation_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("VERTEX", "Compound_1_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_1, 1) model.testNbSubResults(MultiTranslation_1, [COPIES]) model.testNbSubShapes(MultiTranslation_1, GeomAPI_Shape.SOLID, [0]) @@ -95,10 +220,18 @@ model.testResultsAreas(MultiTranslation_1, [0]) refPoint = Vertex_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Recover_1 = model.addRecover(Part_1_doc, MultiTranslation_1, [Compound_1.result()], True) -MultiTranslation_2 = model.addMultiTranslation(Part_1_doc, [model.selection("EDGE", "Recover_1_1_2")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +Recover_1 = model.addRecover( + Part_1_doc, MultiTranslation_1, [Compound_1.result()], True +) +MultiTranslation_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("EDGE", "Recover_1_1_2")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_2, 1) model.testNbSubResults(MultiTranslation_2, [COPIES]) model.testNbSubShapes(MultiTranslation_2, GeomAPI_Shape.SOLID, [0]) @@ -111,10 +244,16 @@ comp = GeomAlgoAPI_CompoundBuilder.compound([Edge_1.defaultResult().shape()]) refPoint = comp.middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, MultiTranslation_2, [Recover_1.result()]) -MultiTranslation_3 = model.addMultiTranslation(Part_1_doc, [model.selection("WIRE", "Recover_2_1_3")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +MultiTranslation_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("WIRE", "Recover_2_1_3")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_3, 1) model.testNbSubResults(MultiTranslation_3, [COPIES]) model.testNbSubShapes(MultiTranslation_3, GeomAPI_Shape.SOLID, [0]) @@ -127,10 +266,16 @@ comp = GeomAlgoAPI_CompoundBuilder.compound([Wire_1.defaultResult().shape()]) refPoint = comp.middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_3 = model.addRecover(Part_1_doc, MultiTranslation_3, [Recover_2.result()]) -MultiTranslation_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1_4")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +MultiTranslation_4 = model.addMultiTranslation( + Part_1_doc, + [model.selection("FACE", "Recover_3_1_4")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_4, 1) model.testNbSubResults(MultiTranslation_4, [COPIES]) model.testNbSubShapes(MultiTranslation_4, GeomAPI_Shape.SOLID, [0]) @@ -142,10 +287,16 @@ model.testResultsAreas(MultiTranslation_4, [109.154152964914914 * COPIES]) refPoint = Face_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_4 = model.addRecover(Part_1_doc, MultiTranslation_4, [Recover_3.result()]) -MultiTranslation_5 = model.addMultiTranslation(Part_1_doc, [model.selection("SHELL", "Recover_4_1_5")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +MultiTranslation_5 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SHELL", "Recover_4_1_5")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_5, 1) model.testNbSubResults(MultiTranslation_5, [COPIES]) model.testNbSubShapes(MultiTranslation_5, GeomAPI_Shape.SOLID, [0]) @@ -157,10 +308,16 @@ model.testResultsAreas(MultiTranslation_5, [182.822012116 * COPIES]) refPoint = Shell_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_5 = model.addRecover(Part_1_doc, MultiTranslation_5, [Recover_4.result()]) -MultiTranslation_6 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Recover_5_1_6")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +MultiTranslation_6 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Recover_5_1_6")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_6, 1) model.testNbSubResults(MultiTranslation_6, [COPIES]) model.testNbSubShapes(MultiTranslation_6, GeomAPI_Shape.SOLID, [COPIES]) @@ -171,10 +328,16 @@ model.testResultsVolumes(MultiTranslation_6, [1000 * COPIES]) refPoint = Translation_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_6 = model.addRecover(Part_1_doc, MultiTranslation_6, [Recover_5.result()]) -MultiTranslation_7 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPSOLID", "Recover_6_1_7")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +MultiTranslation_7 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Recover_6_1_7")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_7, 1) model.testNbSubResults(MultiTranslation_7, [COPIES]) model.testNbSubShapes(MultiTranslation_7, GeomAPI_Shape.SOLID, [3 * COPIES]) @@ -185,10 +348,16 @@ model.testResultsVolumes(MultiTranslation_7, [1589.0486226 * COPIES]) refPoint = Partition_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_7 = model.addRecover(Part_1_doc, MultiTranslation_7, [Recover_6.result()]) -MultiTranslation_8 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "Recover_7_1_8")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES) +MultiTranslation_8 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "Recover_7_1_8")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, +) model.testNbResults(MultiTranslation_8, 1) model.testNbSubResults(MultiTranslation_8, [COPIES]) model.testNbSubShapes(MultiTranslation_8, GeomAPI_Shape.SOLID, [3 * COPIES]) @@ -199,8 +368,8 @@ model.testResultsVolumes(MultiTranslation_8, [3000 * COPIES]) refPoint = AngularCopy_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v95_1.py b/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v95_1.py index a396672c5..a34e365ba 100644 --- a/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v95_1.py +++ b/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v95_1.py @@ -27,53 +27,136 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() DISTANCE = 50 COPIES = 3 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + def subsRefPoints(theResult): res = [] for ind in range(0, theResult.numberOfSubs()): - res.append( theResult.subResult(ind).resultSubShapePair()[0].shape().middlePoint()) + res.append( + theResult.subResult(ind).resultSubShapePair()[0].shape().middlePoint() + ) return res + REFERENCE = subsRefPoints(Compound_2.result()) -def assertResult(theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, theVolume): + +def assertResult( + theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, theVolume +): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [3]) model.testNbSubShapes(theFeature, GeomAPI_Shape.SOLID, [theNbSolids]) @@ -84,30 +167,72 @@ def assertResult(theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, for ind in range(0, theFeature.result().numberOfSubs()): ref = REFERENCE[ind] - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(MultiTranslation_1.feature().error() != "") +assert MultiTranslation_1.feature().error() != "" model.begin() MultiTranslation_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")]) REFERENCE[0].setZ(REFERENCE[0].z() + DISTANCE / 2 * (COPIES - 1)) assertResult(MultiTranslation_1, 24, 123, 450, 900, 38247.599) -MultiTranslation_2 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_2_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "LinearCopy_1_1_2_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) REFERENCE[1].setZ(REFERENCE[1].z() + DISTANCE / 2 * (COPIES - 1)) assertResult(MultiTranslation_2, 26, 129, 462, 924, 39818.3954) -MultiTranslation_3 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "LinearCopy_2_1_3")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "LinearCopy_2_1_3")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) REFERENCE[2].setZ(REFERENCE[2].z() + DISTANCE / 2 * (COPIES - 1)) assertResult(MultiTranslation_3, 28, 135, 474, 948, 41389.19175) -MultiTranslation_4 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPSOLID", "LinearCopy_3_1_1_1"), model.selection("SOLID", "LinearCopy_3_1_2_2"), model.selection("COMPOUND", "LinearCopy_3_1_3")], model.selection("EDGE", "PartSet/OY"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_4 = model.addMultiTranslation( + Part_1_doc, + [ + model.selection("COMPSOLID", "LinearCopy_3_1_1_1"), + model.selection("SOLID", "LinearCopy_3_1_2_2"), + model.selection("COMPOUND", "LinearCopy_3_1_3"), + ], + model.selection("EDGE", "PartSet/OY"), + DISTANCE, + COPIES, + keepSubResults=True, +) REFERENCE[0].setY(REFERENCE[0].y() + DISTANCE / 2 * (COPIES - 1)) REFERENCE[1].setY(REFERENCE[1].y() + DISTANCE / 2 * (COPIES - 1)) REFERENCE[2].setY(REFERENCE[2].y() + DISTANCE / 2 * (COPIES - 1)) @@ -115,4 +240,4 @@ assertResult(MultiTranslation_4, 50, 235, 810, 1620, 71599.98) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v95_2.py b/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v95_2.py index f2608651f..56f01d6a1 100644 --- a/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v95_2.py +++ b/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v95_2.py @@ -27,41 +27,117 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 DISTANCE_1 = 100 COPIES_1 = 2 DISTANCE_2 = 50 @@ -72,12 +148,18 @@ COPIES = COPIES_1 * COPIES_2 def subsRefPoints(theResult): res = [] for ind in range(0, theResult.numberOfSubs()): - res.append( theResult.subResult(ind).resultSubShapePair()[0].shape().middlePoint()) + res.append( + theResult.subResult(ind).resultSubShapePair()[0].shape().middlePoint() + ) return res + REFERENCE = subsRefPoints(Compound_2.result()) -def assertResult(theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, theVolume): + +def assertResult( + theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, theVolume +): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [3]) model.testNbSubShapes(theFeature, GeomAPI_Shape.SOLID, [theNbSolids]) @@ -88,15 +170,35 @@ def assertResult(theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, for ind in range(0, theFeature.result().numberOfSubs()): ref = REFERENCE[ind] - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("EDGE", "PartSet/OY"), DISTANCE_1, COPIES_1, model.selection("EDGE", "PartSet/OZ"), DISTANCE_2, COPIES_2, keepSubResults = True) +MultiTranslation_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("EDGE", "PartSet/OY"), + DISTANCE_1, + COPIES_1, + model.selection("EDGE", "PartSet/OZ"), + DISTANCE_2, + COPIES_2, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(MultiTranslation_1.feature().error() != "") +assert MultiTranslation_1.feature().error() != "" model.begin() MultiTranslation_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")]) @@ -104,18 +206,52 @@ REFERENCE[0].setY(REFERENCE[0].y() + DISTANCE_1 / 2 * (COPIES_1 - 1)) REFERENCE[0].setZ(REFERENCE[0].z() + DISTANCE_2 / 2 * (COPIES_2 - 1)) assertResult(MultiTranslation_1, 45, 237, 882, 1764, 74139.0037) -MultiTranslation_2 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_2_1")], model.selection("EDGE", "PartSet/OY"), DISTANCE_1, COPIES_1, model.selection("EDGE", "PartSet/OZ"), DISTANCE_2, COPIES_2, keepSubResults = True) +MultiTranslation_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "LinearCopy_1_1_2_1")], + model.selection("EDGE", "PartSet/OY"), + DISTANCE_1, + COPIES_1, + model.selection("EDGE", "PartSet/OZ"), + DISTANCE_2, + COPIES_2, + keepSubResults=True, +) ref1Ycopy = REFERENCE[1].y() REFERENCE[1].setY(0) REFERENCE[1].setZ(REFERENCE[1].z() + DISTANCE_2 / 2 * (COPIES_2 - 1)) assertResult(MultiTranslation_2, 50, 252, 912, 1824, 78065.9945) -MultiTranslation_3 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "LinearCopy_2_1_3")], model.selection("EDGE", "PartSet/OY"), DISTANCE_1, COPIES_1, model.selection("EDGE", "PartSet/OZ"), DISTANCE_2, COPIES_2, keepSubResults = True) +MultiTranslation_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "LinearCopy_2_1_3")], + model.selection("EDGE", "PartSet/OY"), + DISTANCE_1, + COPIES_1, + model.selection("EDGE", "PartSet/OZ"), + DISTANCE_2, + COPIES_2, + keepSubResults=True, +) REFERENCE[2].setY(REFERENCE[2].y() + DISTANCE_1 / 2 * (COPIES_1 - 1)) REFERENCE[2].setZ(REFERENCE[2].z() + DISTANCE_2 / 2 * (COPIES_2 - 1)) assertResult(MultiTranslation_3, 55, 267, 942, 1884, 81992.9853) -MultiTranslation_4 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPSOLID", "LinearCopy_3_1_1_5"), model.selection("SOLID", "LinearCopy_3_1_2_2"), model.selection("COMPOUND", "LinearCopy_3_1_3")], model.selection("EDGE", "PartSet/OX"), -DISTANCE_2, COPIES_2, model.selection("EDGE", "PartSet/OY"), -DISTANCE_1, COPIES_1, keepSubResults = True) +MultiTranslation_4 = model.addMultiTranslation( + Part_1_doc, + [ + model.selection("COMPSOLID", "LinearCopy_3_1_1_5"), + model.selection("SOLID", "LinearCopy_3_1_2_2"), + model.selection("COMPOUND", "LinearCopy_3_1_3"), + ], + model.selection("EDGE", "PartSet/OX"), + -DISTANCE_2, + COPIES_2, + model.selection("EDGE", "PartSet/OY"), + -DISTANCE_1, + COPIES_1, + keepSubResults=True, +) REFERENCE[0].setX(REFERENCE[0].x() - DISTANCE_2 / 2 * (COPIES_2 - 1)) REFERENCE[0].setY(REFERENCE[0].y() - DISTANCE_1 / 2 * (COPIES_1 - 1)) REFERENCE[1].setX(REFERENCE[1].x() - DISTANCE_2 / 2 * (COPIES_2 - 1)) @@ -126,4 +262,4 @@ assertResult(MultiTranslation_4, 125, 562, 1872, 3744, 169300.9287) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v95_3.py b/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v95_3.py index 84319e6e8..19151470e 100644 --- a/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v95_3.py +++ b/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v95_3.py @@ -27,61 +27,179 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 DISTANCE = 20 COPIES = 2 model.begin() -MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("VERTEX", "Vertex_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) model.testNbResults(MultiTranslation_1, 1) model.testNbSubResults(MultiTranslation_1, [COPIES]) model.testNbSubShapes(MultiTranslation_1, GeomAPI_Shape.SOLID, [0]) @@ -93,9 +211,16 @@ model.testResultsAreas(MultiTranslation_1, [0]) refPoint = Vertex_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiTranslation_2 = model.addMultiTranslation(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) model.testNbResults(MultiTranslation_2, 1) model.testNbSubResults(MultiTranslation_2, [COPIES]) model.testNbSubShapes(MultiTranslation_2, GeomAPI_Shape.SOLID, [0]) @@ -108,9 +233,16 @@ comp = GeomAlgoAPI_CompoundBuilder.compound([Edge_1.defaultResult().shape()]) refPoint = comp.middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiTranslation_3 = model.addMultiTranslation(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) model.testNbResults(MultiTranslation_3, 1) model.testNbSubResults(MultiTranslation_3, [COPIES]) model.testNbSubShapes(MultiTranslation_3, GeomAPI_Shape.SOLID, [0]) @@ -123,9 +255,16 @@ comp = GeomAlgoAPI_CompoundBuilder.compound([Wire_1.defaultResult().shape()]) refPoint = comp.middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiTranslation_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_4 = model.addMultiTranslation( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) model.testNbResults(MultiTranslation_4, 1) model.testNbSubResults(MultiTranslation_4, [COPIES]) model.testNbSubShapes(MultiTranslation_4, GeomAPI_Shape.SOLID, [0]) @@ -137,9 +276,16 @@ model.testResultsAreas(MultiTranslation_4, [109.154152964914914 * COPIES]) refPoint = Face_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiTranslation_5 = model.addMultiTranslation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_5 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) model.testNbResults(MultiTranslation_5, 1) model.testNbSubResults(MultiTranslation_5, [COPIES]) model.testNbSubShapes(MultiTranslation_5, GeomAPI_Shape.SOLID, [0]) @@ -151,9 +297,16 @@ model.testResultsAreas(MultiTranslation_5, [182.822012116 * COPIES]) refPoint = Shell_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiTranslation_6 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_6 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) model.testNbResults(MultiTranslation_6, 1) model.testNbSubResults(MultiTranslation_6, [COPIES]) model.testNbSubShapes(MultiTranslation_6, GeomAPI_Shape.SOLID, [COPIES]) @@ -164,9 +317,16 @@ model.testResultsVolumes(MultiTranslation_6, [1000 * COPIES]) refPoint = Translation_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiTranslation_7 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_7 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) model.testNbResults(MultiTranslation_7, 1) model.testNbSubResults(MultiTranslation_7, [COPIES]) model.testNbSubShapes(MultiTranslation_7, GeomAPI_Shape.SOLID, [3 * COPIES]) @@ -177,9 +337,16 @@ model.testResultsVolumes(MultiTranslation_7, [1589.0486226 * COPIES]) refPoint = Partition_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -MultiTranslation_8 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_8 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "AngularCopy_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) model.testNbResults(MultiTranslation_8, 1) model.testNbSubResults(MultiTranslation_8, [COPIES]) model.testNbSubShapes(MultiTranslation_8, GeomAPI_Shape.SOLID, [3 * COPIES]) @@ -190,8 +357,8 @@ model.testResultsVolumes(MultiTranslation_8, [3000 * COPIES]) refPoint = AngularCopy_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE / 2 * (COPIES - 1)) midPoint = MultiTranslation_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v95_4.py b/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v95_4.py index 59427ec09..ba47b6bce 100644 --- a/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v95_4.py +++ b/src/FeaturesPlugin/Test/TestMultiTranslation_MultiLevelCompound_v95_4.py @@ -27,57 +27,177 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 DISTANCE = 20 COPIES = 2 @@ -93,6 +213,7 @@ for ind in range(0, Compound_1.result().numberOfSubs()): p = Compound_1.result().subResult(ind).resultSubShapePair()[1].middlePoint() REFERENCE.append(p) + def assertResult(theFeature, theNbMoved): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [8]) @@ -106,42 +227,94 @@ def assertResult(theFeature, theNbMoved): ref = GeomAPI_Pnt(REFERENCE[ind].x(), REFERENCE[ind].y(), REFERENCE[ind].z()) if ind < theNbMoved: ref.setZ(ref.z() + DISTANCE / 2 * (COPIES - 1)) - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("VERTEX", "Compound_1_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("VERTEX", "Compound_1_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) NB_VERTICES += COPIES - 1 assertResult(MultiTranslation_1, 1) -MultiTranslation_2 = model.addMultiTranslation(Part_1_doc, [model.selection("EDGE", "LinearCopy_1_1_2")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("EDGE", "LinearCopy_1_1_2")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) c = GeomAlgoAPI_CompoundBuilder.compound([Edge_1.defaultResult().shape()]) REFERENCE[1] = c.middlePoint() NB_EDGES += COPIES - 1 NB_VERTICES += 2 * (COPIES - 1) assertResult(MultiTranslation_2, 2) -MultiTranslation_3 = model.addMultiTranslation(Part_1_doc, [model.selection("WIRE", "LinearCopy_2_1_3")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("WIRE", "LinearCopy_2_1_3")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) c = GeomAlgoAPI_CompoundBuilder.compound([Wire_1.defaultResult().shape()]) REFERENCE[2] = c.middlePoint() NB_EDGES += 2 * (COPIES - 1) NB_VERTICES += 4 * (COPIES - 1) assertResult(MultiTranslation_3, 3) -MultiTranslation_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "LinearCopy_3_1_4")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_4 = model.addMultiTranslation( + Part_1_doc, + [model.selection("FACE", "LinearCopy_3_1_4")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) NB_FACES += COPIES - 1 NB_EDGES += 4 * (COPIES - 1) NB_VERTICES += 8 * (COPIES - 1) assertResult(MultiTranslation_4, 4) -MultiTranslation_5 = model.addMultiTranslation(Part_1_doc, [model.selection("SHELL", "LinearCopy_4_1_5")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_5 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SHELL", "LinearCopy_4_1_5")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) NB_FACES += 2 * (COPIES - 1) NB_EDGES += 8 * (COPIES - 1) NB_VERTICES += 16 * (COPIES - 1) assertResult(MultiTranslation_5, 5) -MultiTranslation_6 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "LinearCopy_5_1_6")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_6 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "LinearCopy_5_1_6")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) NB_SOLIDS += COPIES - 1 NB_FACES += 6 * (COPIES - 1) NB_EDGES += 24 * (COPIES - 1) @@ -149,7 +322,14 @@ NB_VERTICES += 48 * (COPIES - 1) VOLUME += 1000 * (COPIES - 1) assertResult(MultiTranslation_6, 6) -MultiTranslation_7 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPSOLID", "LinearCopy_6_1_7")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_7 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "LinearCopy_6_1_7")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) NB_SOLIDS += 3 * (COPIES - 1) NB_FACES += 17 * (COPIES - 1) NB_EDGES += 66 * (COPIES - 1) @@ -157,7 +337,14 @@ NB_VERTICES += 132 * (COPIES - 1) VOLUME += 1589.0486226 * (COPIES - 1) assertResult(MultiTranslation_7, 7) -MultiTranslation_8 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_7_1_8")], model.selection("EDGE", "PartSet/OZ"), DISTANCE, COPIES, keepSubResults = True) +MultiTranslation_8 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_7_1_8")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, + COPIES, + keepSubResults=True, +) NB_SOLIDS += 3 * (COPIES - 1) NB_FACES += 18 * (COPIES - 1) NB_EDGES += 72 * (COPIES - 1) @@ -167,4 +354,4 @@ assertResult(MultiTranslation_8, 8) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestMultiTranslation_Part.py b/src/FeaturesPlugin/Test/TestMultiTranslation_Part.py index 259fdeed8..179b6e558 100644 --- a/src/FeaturesPlugin/Test/TestMultiTranslation_Part.py +++ b/src/FeaturesPlugin/Test/TestMultiTranslation_Part.py @@ -25,8 +25,23 @@ 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) +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 diff --git a/src/FeaturesPlugin/Test/TestNormalToFace.py b/src/FeaturesPlugin/Test/TestNormalToFace.py index 1ba6a4937..769c39ec3 100644 --- a/src/FeaturesPlugin/Test/TestNormalToFace.py +++ b/src/FeaturesPlugin/Test/TestNormalToFace.py @@ -20,9 +20,9 @@ """ Unit test of ... """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= import os @@ -34,9 +34,9 @@ from salome.shaper import model __updated__ = "2020-11-12" -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= model.begin() partSet = model.moduleDocument() @@ -48,30 +48,34 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) model.do() -#========================================================================= +# ========================================================================= # Test 1. Create a normal to a face with only a face -#========================================================================= +# ========================================================================= Normal_1 = model.getNormal(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) model.do() -#========================================================================= +# ========================================================================= # Test 2. Create a normal to a face with a face and a vertex -#========================================================================= -Normal_2 = model.getNormal(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]")) +# ========================================================================= +Normal_2 = model.getNormal( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]"), +) model.do() model.end() -assert (len(Normal_1.results()) > 0) -assert(Normal_1.feature().error() == "") +assert len(Normal_1.results()) > 0 +assert Normal_1.feature().error() == "" anAxisResult = modelAPI_ResultConstruction(Normal_1.feature().firstResult()) -assert (anAxisResult is not None) +assert anAxisResult is not None -assert (len(Normal_2.results()) > 0) -assert(Normal_2.feature().error() == "") +assert len(Normal_2.results()) > 0 +assert Normal_2.feature().error() == "" anAxisResult = modelAPI_ResultConstruction(Normal_2.feature().firstResult()) -assert (anAxisResult is not None) +assert anAxisResult is not None -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= diff --git a/src/FeaturesPlugin/Test/TestPartition.py b/src/FeaturesPlugin/Test/TestPartition.py index 924fbe5ac..56ee86884 100644 --- a/src/FeaturesPlugin/Test/TestPartition.py +++ b/src/FeaturesPlugin/Test/TestPartition.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -34,15 +34,15 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +assert len(aPartFeature.results()) == 1 # Another way is: # aPart = aSession.activeDocument() aPartResult = modelAPI_ResultPart(aPartFeature.firstResult()) aPart = aPartResult.partDoc() -#========================================================================= +# ========================================================================= # Create a sketch circle to extrude -#========================================================================= +# ========================================================================= aSession.startOperation() aCircleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")) @@ -59,87 +59,95 @@ anCircleCentr.setValue(0, 0) aCircleRadius.setValue(50) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on circle -#========================================================================= +# ========================================================================= # Build shape from sketcher results aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult()) -assert (aCircleSketchResult.facesNum() > 0) +assert aCircleSketchResult.facesNum() > 0 # Create extrusion aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "Extrusion") +assert anExtrusionFt.getKind() == "Extrusion" # selection type FACE=4 anExtrusionFt.selectionList("base").append( - aCircleSketchResult, aCircleSketchResult.face(0)) + aCircleSketchResult, aCircleSketchResult.face(0) +) 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.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) +assert anExtrusionFt.real("to_size").value() == 50 # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult is not None) +assert anExtrusionResult is not None -#========================================================================= +# ========================================================================= # Create plane -#========================================================================= +# ========================================================================= aSession.startOperation() aPlaneFeature = aPart.addFeature("Plane") aPlaneFeature.string("creation_method").setValue("by_general_equation") -aPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove -aPlaneFeature.real("A").setValue(0.) -aPlaneFeature.real("B").setValue(1.) -aPlaneFeature.real("C").setValue(0.) -aPlaneFeature.real("D").setValue(1.) +aPlaneFeature.string("by_other_plane_option").setValue( + "by_distance_from_other" +) # TODO: remove +aPlaneFeature.real("A").setValue(0.0) +aPlaneFeature.real("B").setValue(1.0) +aPlaneFeature.real("C").setValue(0.0) +aPlaneFeature.real("D").setValue(1.0) aSession.finishOperation() aPlaneResult = aPlaneFeature.firstResult() -#========================================================================= +# ========================================================================= # Create a partition -#========================================================================= +# ========================================================================= aSession.startOperation() aPartitionFt = aPart.addFeature("Partition") -assert (aPartitionFt.getKind() == "Partition") -aPartitionFt.selectionList("base_objects").append(anExtrusionResult, anExtrusionResult.shape()) +assert aPartitionFt.getKind() == "Partition" +aPartitionFt.selectionList("base_objects").append( + anExtrusionResult, anExtrusionResult.shape() +) aPartitionFt.selectionList("base_objects").append(aPlaneResult, None) aPartitionFt.execute() aSession.finishOperation() -#========================================================================= +# ========================================================================= # Test results -#========================================================================= +# ========================================================================= aFactory = ModelAPI_Session.get().validators() -assert (aFactory.validate(aPartitionFt)) -assert (len(aPartitionFt.results()) > 0) +assert aFactory.validate(aPartitionFt) +assert len(aPartitionFt.results()) > 0 aPartitionResult = modelAPI_ResultBody(aPartitionFt.firstResult()) -assert (aPartitionResult is not None) +assert aPartitionResult is not None aSession.undo() -#========================================================================= +# ========================================================================= # Create a partition -#========================================================================= +# ========================================================================= aSession.startOperation() aPartitionFt = aPart.addFeature("Partition") -assert (aPartitionFt.getKind() == "Partition") -aPartitionFt.selectionList("base_objects").append(anExtrusionResult, anExtrusionResult.shape()) +assert aPartitionFt.getKind() == "Partition" +aPartitionFt.selectionList("base_objects").append( + anExtrusionResult, anExtrusionResult.shape() +) aPartitionFt.selectionList("base_objects").append(aPlaneResult, None) aPartitionFt.execute() aSession.finishOperation() -#========================================================================= +# ========================================================================= # Test results -#========================================================================= +# ========================================================================= aFactory = ModelAPI_Session.get().validators() -assert (aFactory.validate(aPartitionFt)) -assert (len(aPartitionFt.results()) > 0) +assert aFactory.validate(aPartitionFt) +assert len(aPartitionFt.results()) > 0 aPartitionResult = modelAPI_ResultBody(aPartitionFt.firstResult()) -assert (aPartitionResult is not None) +assert aPartitionResult is not None from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPartition2Faces.py b/src/FeaturesPlugin/Test/TestPartition2Faces.py index fa7cd2257..c3ed1873c 100644 --- a/src/FeaturesPlugin/Test/TestPartition2Faces.py +++ b/src/FeaturesPlugin/Test/TestPartition2Faces.py @@ -24,31 +24,59 @@ 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(55.40972222222221, 31.70277777777777, -46.71249999999999, 31.70277777777777) -SketchLine_2 = Sketch_1.addLine(-46.71249999999999, 31.70277777777777, -46.71249999999999, -45.44999999999999) -SketchLine_3 = Sketch_1.addLine(-46.71249999999999, -45.44999999999999, 55.40972222222221, -45.44999999999999) -SketchLine_4 = Sketch_1.addLine(55.40972222222221, -45.44999999999999, 55.40972222222221, 31.70277777777777) -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()) +SketchLine_1 = Sketch_1.addLine( + 55.40972222222221, 31.70277777777777, -46.71249999999999, 31.70277777777777 +) +SketchLine_2 = Sketch_1.addLine( + -46.71249999999999, 31.70277777777777, -46.71249999999999, -45.44999999999999 +) +SketchLine_3 = Sketch_1.addLine( + -46.71249999999999, -45.44999999999999, 55.40972222222221, -45.44999999999999 +) +SketchLine_4 = Sketch_1.addLine( + 55.40972222222221, -45.44999999999999, 55.40972222222221, 31.70277777777777 +) +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() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_1 = Sketch_2.addCircle(64.38749999999999, 45.44999999999999, 41.86298795836804) +SketchCircle_1 = Sketch_2.addCircle( + 64.38749999999999, 45.44999999999999, 41.86298795836804 +) model.do() -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_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")]) +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() -model.checkResult(Partition_1,model,1,[3],[0],[3],[12],[24]) -model.testHaveNamingSubshapes(Partition_1,model,Part_1_doc) +model.checkResult(Partition_1, model, 1, [3], [0], [3], [12], [24]) +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPartition2Solids.py b/src/FeaturesPlugin/Test/TestPartition2Solids.py index b6b6e223c..bf3814a60 100644 --- a/src/FeaturesPlugin/Test/TestPartition2Solids.py +++ b/src/FeaturesPlugin/Test/TestPartition2Solids.py @@ -24,37 +24,108 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() 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) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(82.06249999999999, -36.19166666666666, 19.4986111111111, -81.3611111111111) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(19.4986111111111, -81.3611111111111, -45.87083333333333, -45.44999999999999) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(-45.87083333333333, -45.44999999999999, -43.90694444444443, 28.05555555555554) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint()) +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 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 82.06249999999999, -36.19166666666666, 19.4986111111111, -81.3611111111111 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + 19.4986111111111, -81.3611111111111, -45.87083333333333, -45.44999999999999 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + -45.87083333333333, -45.44999999999999, -43.90694444444443, 28.05555555555554 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.endPoint() +) model.do() -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()) -SketchLine_8 = Sketch_2.addLine(37.35304976096997, -31.43655264675337, 25.65802050767337, -1.791013376768974) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchLine_9 = Sketch_2.addLine(25.65802050767337, -1.791013376768974, 69.44638585141178, 6.640286782584385) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchLine_10 = Sketch_2.addLine(69.44638585141178, 6.640286782584385, 74.07000206783135, -18.10965884648514) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_6.startPoint(), SketchLine_10.endPoint()) +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() +) +SketchLine_8 = Sketch_2.addLine( + 37.35304976096997, -31.43655264675337, 25.65802050767337, -1.791013376768974 +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchLine_9 = Sketch_2.addLine( + 25.65802050767337, -1.791013376768974, 69.44638585141178, 6.640286782584385 +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchLine_10 = Sketch_2.addLine( + 69.44638585141178, 6.640286782584385, 74.07000206783135, -18.10965884648514 +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_6.startPoint(), SketchLine_10.endPoint() +) model.do() -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")]) +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() -model.checkResult(Partition_1,model,1,[4],[4],[33],[150],[300]) -model.testHaveNamingSubshapes(Partition_1,model,Part_1_doc) +model.checkResult(Partition_1, model, 1, [4], [4], [33], [150], [300]) +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPartition2Wires.py b/src/FeaturesPlugin/Test/TestPartition2Wires.py index a644a0923..544af46d8 100644 --- a/src/FeaturesPlugin/Test/TestPartition2Wires.py +++ b/src/FeaturesPlugin/Test/TestPartition2Wires.py @@ -24,39 +24,100 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchLine_1 = Sketch_1.addLine(-59.3375, 27.49444444444443, -20.05972222222222, 71.26111111111109) -SketchLine_2 = Sketch_1.addLine(-20.05972222222222, 71.26111111111109, 31.5625, 60.31944444444444) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(31.5625, 60.31944444444444, 48.95694444444444, -41.52222222222221) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(48.95694444444444, -41.52222222222221, -7.434722222222216, -63.6861111111111) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(-7.434722222222216, -63.6861111111111, -12.20416666666666, 3.0861111111111) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(-12.20416666666666, 3.0861111111111, -59.3375, 27.49444444444443) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_1.startPoint()) +SketchLine_1 = Sketch_1.addLine( + -59.3375, 27.49444444444443, -20.05972222222222, 71.26111111111109 +) +SketchLine_2 = Sketch_1.addLine( + -20.05972222222222, 71.26111111111109, 31.5625, 60.31944444444444 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 31.5625, 60.31944444444444, 48.95694444444444, -41.52222222222221 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + 48.95694444444444, -41.52222222222221, -7.434722222222216, -63.6861111111111 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + -7.434722222222216, -63.6861111111111, -12.20416666666666, 3.0861111111111 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + -12.20416666666666, 3.0861111111111, -59.3375, 27.49444444444443 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_1.startPoint() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchArc_1 = Sketch_2.addArc(-25.27347239223771, 29.23826809458483, -58.42699662355402, 67.59234514649975, 1.894762451441686, -13.56451698932517, False) -SketchLine_7 = Sketch_2.addLine(-58.42699662355402, 67.59234514649975, 66.71130562210065, 43.53978835123107) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_7.startPoint()) -SketchLine_8 = Sketch_2.addLine(66.71130562210065, 43.53978835123107, 30.30743587791019, -67.62202818906478) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchLine_9 = Sketch_2.addLine(30.30743587791019, -67.62202818906478, 1.894762451441686, -13.56451698932518) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_9.endPoint()) +SketchArc_1 = Sketch_2.addArc( + -25.27347239223771, + 29.23826809458483, + -58.42699662355402, + 67.59234514649975, + 1.894762451441686, + -13.56451698932517, + False, +) +SketchLine_7 = Sketch_2.addLine( + -58.42699662355402, 67.59234514649975, 66.71130562210065, 43.53978835123107 +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchArc_1.startPoint(), SketchLine_7.startPoint() +) +SketchLine_8 = Sketch_2.addLine( + 66.71130562210065, 43.53978835123107, 30.30743587791019, -67.62202818906478 +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchLine_9 = Sketch_2.addLine( + 30.30743587791019, -67.62202818906478, 1.894762451441686, -13.56451698932518 +) +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_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_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_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")]) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("WIRE", "Wire_2_1"), model.selection("WIRE", "Wire_1_1")], +) model.do() -model.checkResult(Partition_1,model,1,[2],[0],[0],[22],[44]) -model.testHaveNamingSubshapes(Partition_1,model,Part_1_doc) +model.checkResult(Partition_1, model, 1, [2], [0], [0], [22], [44]) +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPartitionArgsUpdate.py b/src/FeaturesPlugin/Test/TestPartitionArgsUpdate.py index 08a8987ab..a15a49adf 100644 --- a/src/FeaturesPlugin/Test/TestPartitionArgsUpdate.py +++ b/src/FeaturesPlugin/Test/TestPartitionArgsUpdate.py @@ -36,20 +36,36 @@ model.addParameter(Part_1_doc, "ep_dalles", "0.12") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0.275, 3.325, -0.375, 3.325) SketchLine_2 = Sketch_1.addLine(-0.375, 3.325, -0.375, -0.325) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(-0.375, -0.325, 4.275, -0.325) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(4.275, -0.325, 4.275, 1.325) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(4.275, 1.325, 3.625, 1.325) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(3.625, 1.325, 3.625, 0.325) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(3.625, 0.325, 0.275, 0.3250000000000001) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(0.275, 0.3250000000000001, 0.275, 3.325) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.endPoint()) +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_1.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_3.result()) @@ -62,23 +78,52 @@ 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", False) +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", False) +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", False) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_1.result()) +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_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")) +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) SketchLine_14 = Sketch_2.addLine(2.26, -1.69, 2.26, -2.31) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_12.result()) SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_13.result()) @@ -86,35 +131,80 @@ SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_14.result()) 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", False) +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", False +) SketchConstraintDistance_4.setName("SketchConstraintDistance_6") -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_12.result(), "0.21+ep_poteau/2", False) +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"), False) +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"), False) +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", False) +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", False) +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_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")) +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") SketchLine_18 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_18.setName("SketchLine_16") SketchLine_18.result().setName("SketchLine_16") -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_17.startPoint(), SketchLine_18.result()) -SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchLine_18.result()) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_17.startPoint(), SketchLine_18.result() +) +SketchConstraintCoincidence_14 = Sketch_3.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.result() +) SketchLine_19 = Sketch_3.addLine(0, 1.2, 0, 0) SketchLine_19.setName("SketchLine_17") SketchLine_19.result().setName("SketchLine_17") -SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_19.startPoint(), SketchLine_18.result()) -SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchLine_18.result()) +SketchConstraintCoincidence_15 = Sketch_3.setCoincident( + SketchLine_19.startPoint(), SketchLine_18.result() +) +SketchConstraintCoincidence_16 = Sketch_3.setCoincident( + SketchLine_19.endPoint(), SketchLine_18.result() +) SketchLine_20 = Sketch_3.addLine(0, 0, 0.95, 0) SketchLine_20.setName("SketchLine_18") SketchLine_20.result().setName("SketchLine_18") @@ -124,20 +214,37 @@ SketchLine_21.result().setName("SketchLine_19") SketchLine_22 = Sketch_3.addLine(2.525000000000001, 0, 3.975000000000001, 0) SketchLine_22.setName("SketchLine_20") SketchLine_22.result().setName("SketchLine_20") -SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchLine_21.result()) -SketchConstraintCoincidence_18 = 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_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]")) +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_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") +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") SketchConstraintLength_8.setName("SketchConstraintLength_7") @@ -147,112 +254,400 @@ SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_23.result()) 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", False) +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&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]")) +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, False) +SketchConstraintDistance_9 = Sketch_3.setDistance( + SketchLine_17.startPoint(), SketchLine_26.result(), 0.375, False +) SketchConstraintDistance_9.setName("SketchConstraintDistance_12") model.do() -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_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")) +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&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()) +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_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()) +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_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()) +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_objects = [model.selection("EDGE", "Sketch_4/SketchLine_26"), model.selection("EDGE", "Sketch_4/SketchLine_27"), model.selection("EDGE", "Sketch_4/SketchLine_28")] +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")) +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&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()) +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_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()) +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_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()) +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_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()) +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_37 = Sketch_5.setCoincident(SketchLine_34.startPoint(), SketchLine_33.result()) -SketchLine_35 = Sketch_5.addLine(2.075000000000001, 1.905974842767296, 2.075000000000001, 0) +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_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()) +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", False) +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 = 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/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]] +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_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]] +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/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_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")] +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_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.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) model.do() # insert points and polyline before partition to add it as a Partition argument Part_1_doc.setCurrentFeature(Extrusion_5.feature(), True) -Point_2 = model.addPoint(Part_1_doc, "0", "0", "3*(h_ouverture+h_apres_ouverture-ep_dalles/2)") +Point_2 = model.addPoint( + Part_1_doc, "0", "0", "3*(h_ouverture+h_apres_ouverture-ep_dalles/2)" +) Point_3 = model.addPoint(Part_1_doc, 0, 0, 5) -Polyline_1 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")], False) +Polyline_1 = model.addPolyline3D( + Part_1_doc, + [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")], + False, +) model.do() Part_1_doc.setCurrentFeature(Partition_1.feature(), True) # append the polyline argument to the end of selection partition list @@ -262,8 +657,9 @@ model.end() # check all groups are valid from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(Part_1_doc.size("Groups") == 3) +assert Part_1_doc.size("Groups") == 3 for i in range(Part_1_doc.size("Groups")): - GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", i))) - assert(aFactory.validate(GroupFeature)) + GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", i))) + assert aFactory.validate(GroupFeature) diff --git a/src/FeaturesPlugin/Test/TestPartitionBox4Planes.py b/src/FeaturesPlugin/Test/TestPartitionBox4Planes.py index 6b7eeddd4..4db256f3e 100644 --- a/src/FeaturesPlugin/Test/TestPartitionBox4Planes.py +++ b/src/FeaturesPlugin/Test/TestPartitionBox4Planes.py @@ -28,13 +28,19 @@ 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_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_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]) -model.testHaveNamingSubshapes(Partition_1,model,Part_1_doc) +model.checkResult(Partition_1, model, 1, [8], [8], [48], [192], [384]) +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPartitionEdgeSolid.py b/src/FeaturesPlugin/Test/TestPartitionEdgeSolid.py index 0d48ba8c0..15ac0f7f4 100644 --- a/src/FeaturesPlugin/Test/TestPartitionEdgeSolid.py +++ b/src/FeaturesPlugin/Test/TestPartitionEdgeSolid.py @@ -23,19 +23,36 @@ 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) +Cone_1 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 5, + 10, +) 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) +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) +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/SketchLine_1")]) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Cone_1_1"), model.selection("EDGE", "Edge_1_1")]) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Cone_1_1"), model.selection("EDGE", "Edge_1_1")], +) model.do() -model.checkResult(Partition_1,model,1,[3],[1],[3],[9],[20]) -model.testHaveNamingSubshapes(Partition_1,model,Part_1_doc) +model.checkResult(Partition_1, model, 1, [3], [1], [3], [9], [20]) +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPartitionFace2Solid.py b/src/FeaturesPlugin/Test/TestPartitionFace2Solid.py index 5bafa9348..c92879b88 100644 --- a/src/FeaturesPlugin/Test/TestPartitionFace2Solid.py +++ b/src/FeaturesPlugin/Test/TestPartitionFace2Solid.py @@ -26,62 +26,158 @@ 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/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchArc_1 = Sketch_1.addArc(0, -23.6272731038225, 7.84836794507966, 9.071298990348682, 0, 10, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.center()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.endPoint()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchArc_1 = Sketch_1.addArc( + 0, -23.6272731038225, 7.84836794507966, 9.071298990348682, 0, 10, False +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.center() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.endPoint() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_2 = SketchProjection_2.createdFeature() -SketchArc_2 = Sketch_1.addArc(5.671059039631239, 0, 7.84836794507966, 9.071298990348682, 15, 0, True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_2.center()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_2.endPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1]) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_2.endPoint(), 15, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.endPoint(), 10, True) -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_2.result(), [SketchArc_2.results()[1], SketchArc_1.results()[1]]) +SketchArc_2 = Sketch_1.addArc( + 5.671059039631239, 0, 7.84836794507966, 9.071298990348682, 15, 0, True +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_2.center() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_2.endPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchArc_2.results()[1] +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_2.endPoint(), 15, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.endPoint(), 10, True +) +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_2.result(), [SketchArc_2.results()[1], SketchArc_1.results()[1]] +) [SketchArc_3, SketchArc_4] = SketchConstraintMirror_1.mirrored() -SketchConstraintMirror_2_objects = [SketchArc_1.results()[1], SketchArc_2.results()[1], SketchArc_3.results()[1], SketchArc_4.results()[1]] -SketchConstraintMirror_2 = Sketch_1.addMirror(SketchLine_1.result(), SketchConstraintMirror_2_objects) -[SketchArc_5, SketchArc_6, SketchArc_7, SketchArc_8] = SketchConstraintMirror_2.mirrored() +SketchConstraintMirror_2_objects = [ + SketchArc_1.results()[1], + SketchArc_2.results()[1], + SketchArc_3.results()[1], + SketchArc_4.results()[1], +] +SketchConstraintMirror_2 = Sketch_1.addMirror( + SketchLine_1.result(), SketchConstraintMirror_2_objects +) +[ + 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) +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")) -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) -SketchLine_6 = Sketch_2.addLine(7.498934040825037, -4.489390918751097, 7.498934040825037, 4.111344571723496) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +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 +) +SketchLine_6 = Sketch_2.addLine( + 7.498934040825037, -4.489390918751097, 7.498934040825037, 4.111344571723496 +) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_4.result()) 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) +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_3r-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) -SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchLine_9 = Sketch_3.addLine(-12.33809712604348, -45.93749869468675, 30.10255255530162, -25.9120009302625) -SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchLine_10 = Sketch_3.addLine(30.10255255530162, -25.9120009302625, 21.55890075100801, 30.21822825485694) -SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_7.startPoint(), SketchLine_10.endPoint()) +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 +) +SketchConstraintCoincidence_10 = Sketch_3.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchLine_9 = Sketch_3.addLine( + -12.33809712604348, -45.93749869468675, 30.10255255530162, -25.9120009302625 +) +SketchConstraintCoincidence_11 = Sketch_3.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchLine_10 = Sketch_3.addLine( + 30.10255255530162, -25.9120009302625, 21.55890075100801, 30.21822825485694 +) +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_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_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_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]) -model.testHaveNamingSubshapes(Partition_1,model,Part_1_doc) +model.checkResult(Partition_1, model, 1, [2], [4], [42], [198], [396]) +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPartitionFaceSolid.py b/src/FeaturesPlugin/Test/TestPartitionFaceSolid.py index 01fe4aa69..3055e8071 100644 --- a/src/FeaturesPlugin/Test/TestPartitionFaceSolid.py +++ b/src/FeaturesPlugin/Test/TestPartitionFaceSolid.py @@ -25,20 +25,48 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchLine_1 = Sketch_1.addLine(29.00299588076832, 85.46917598420691, 38.5336063380206, 85.46917598420691) -SketchLine_2 = Sketch_1.addLine(38.5336063380206, 85.46917598420691, 51.24108694769031, 59.52473640613128) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(51.24108694769031, 59.52473640613128, 51.24108694769031, 20.87281621838598) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(51.24108694769031, 20.87281621838598, 74.53813473208469, 20.87281621838598) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(74.53813473208469, 20.87281621838598, 74.53813473208469, 7.635857249980032) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(74.53813473208469, 7.635857249980032, 29.00299588076832, 7.635857249980032) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchLine_7 = Sketch_1.addLine(29.00299588076832, 7.635857249980032, 29.00299588076832, 85.46917598420691) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_7.endPoint()) +SketchLine_1 = Sketch_1.addLine( + 29.00299588076832, 85.46917598420691, 38.5336063380206, 85.46917598420691 +) +SketchLine_2 = Sketch_1.addLine( + 38.5336063380206, 85.46917598420691, 51.24108694769031, 59.52473640613128 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 51.24108694769031, 59.52473640613128, 51.24108694769031, 20.87281621838598 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + 51.24108694769031, 20.87281621838598, 74.53813473208469, 20.87281621838598 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 74.53813473208469, 20.87281621838598, 74.53813473208469, 7.635857249980032 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + 74.53813473208469, 7.635857249980032, 29.00299588076832, 7.635857249980032 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchLine_7 = Sketch_1.addLine( + 29.00299588076832, 7.635857249980032, 29.00299588076832, 85.46917598420691 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_7.endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_5.result()) @@ -46,28 +74,61 @@ SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_1.result()) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "PartSet/OZ"), 180, 0) -Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) -SketchLine_8 = Sketch_2.addLine(61.72045613220821, 51.92790864086226, -64.56856594464165, 51.92790864086226) -SketchLine_9 = Sketch_2.addLine(-64.56856594464165, 51.92790864086226, -64.56856594464165, -5.323114700643004) -SketchLine_10 = Sketch_2.addLine(-64.56856594464165, -5.323114700643004, 61.72045613220821, -5.323114700643004) -SketchLine_11 = Sketch_2.addLine(61.72045613220821, -5.323114700643004, 61.72045613220821, 51.92790864086226) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_8.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()) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection("EDGE", "PartSet/OZ"), + 180, + 0, +) +Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) +SketchLine_8 = Sketch_2.addLine( + 61.72045613220821, 51.92790864086226, -64.56856594464165, 51.92790864086226 +) +SketchLine_9 = Sketch_2.addLine( + -64.56856594464165, 51.92790864086226, -64.56856594464165, -5.323114700643004 +) +SketchLine_10 = Sketch_2.addLine( + -64.56856594464165, -5.323114700643004, 61.72045613220821, -5.323114700643004 +) +SketchLine_11 = Sketch_2.addLine( + 61.72045613220821, -5.323114700643004, 61.72045613220821, 51.92790864086226 +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_8.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() +) SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_9.result()) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_10.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_11.result()) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8r-SketchLine_9f-SketchLine_10f-SketchLine_11f")]) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Revolution_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", + ) + ], +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Revolution_1_1"), model.selection("FACE", "Face_1_1")], +) model.do() -model.checkResult(Partition_1,model,1,[4],[1],[16],[82],[164]) -model.testHaveNamingSubshapes(Partition_1,model,Part_1_doc) +model.checkResult(Partition_1, model, 1, [4], [1], [16], [82], [164]) +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPartitionFaceWire.py b/src/FeaturesPlugin/Test/TestPartitionFaceWire.py index ba59df3ba..1ff7130c1 100644 --- a/src/FeaturesPlugin/Test/TestPartitionFaceWire.py +++ b/src/FeaturesPlugin/Test/TestPartitionFaceWire.py @@ -24,42 +24,116 @@ 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(-27.59408640325028, 19.28272273466096, -69.22045455254333, 36.34312971236017, -20.39867310978187, 63.6903576534723, True) -SketchLine_1 = Sketch_1.addLine(-20.39867310978187, 63.6903576534723, 50.06261173489778, 52.27344552622073) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) -SketchLine_2 = Sketch_1.addLine(50.06261173489778, 52.27344552622073, 61.51017441860466, -50.20639534883721) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(61.51017441860466, -50.20639534883721, -40.37063953488371, -58.72093023255813) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-40.37063953488371, -58.72093023255813, -8.587370006050145, 0.9678324888285939) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(-8.587370006050145, 0.9678324888285939, -69.22045455254333, 36.34312971236017) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_5.endPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_1.result(), SketchArc_1.results()[1]) +SketchArc_1 = Sketch_1.addArc( + -27.59408640325028, + 19.28272273466096, + -69.22045455254333, + 36.34312971236017, + -20.39867310978187, + 63.6903576534723, + True, +) +SketchLine_1 = Sketch_1.addLine( + -20.39867310978187, 63.6903576534723, 50.06261173489778, 52.27344552622073 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.startPoint() +) +SketchLine_2 = Sketch_1.addLine( + 50.06261173489778, 52.27344552622073, 61.51017441860466, -50.20639534883721 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 61.51017441860466, -50.20639534883721, -40.37063953488371, -58.72093023255813 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -40.37063953488371, -58.72093023255813, -8.587370006050145, 0.9678324888285939 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + -8.587370006050145, 0.9678324888285939, -69.22045455254333, 36.34312971236017 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_5.endPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_1.result(), SketchArc_1.results()[1] +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchArc_2 = Sketch_2.addArc(25.75044090453202, 23.87245760846999, -31.39978593836629, 46.7325483456293, 20.55274339063303, 85.20528827247816, True) -SketchLine_6 = Sketch_2.addLine(20.55274339063303, 85.20528827247816, 74.86874397491491, -32.65992894423484) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_6.startPoint()) -SketchLine_7 = Sketch_2.addLine(74.86874397491491, -32.65992894423484, 9.995513504597909, -67.56790534016733) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchLine_8 = Sketch_2.addLine(9.995513504597909, -67.56790534016733, -36.0335881148175, -7.328477046301525) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchLine_9 = Sketch_2.addLine(-36.0335881148175, -7.328477046301525, -31.39978593836629, 46.7325483456293) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchArc_2.startPoint(), SketchLine_9.endPoint()) +SketchArc_2 = Sketch_2.addArc( + 25.75044090453202, + 23.87245760846999, + -31.39978593836629, + 46.7325483456293, + 20.55274339063303, + 85.20528827247816, + True, +) +SketchLine_6 = Sketch_2.addLine( + 20.55274339063303, 85.20528827247816, 74.86874397491491, -32.65992894423484 +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchArc_2.endPoint(), SketchLine_6.startPoint() +) +SketchLine_7 = Sketch_2.addLine( + 74.86874397491491, -32.65992894423484, 9.995513504597909, -67.56790534016733 +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchLine_8 = Sketch_2.addLine( + 9.995513504597909, -67.56790534016733, -36.0335881148175, -7.328477046301525 +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchLine_9 = Sketch_2.addLine( + -36.0335881148175, -7.328477046301525, -31.39978593836629, 46.7325483456293 +) +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_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_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_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")]) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("FACE", "Face_1_1"), model.selection("WIRE", "Wire_1_1")], +) model.do() -model.checkResult(Partition_1,model,1,[6],[0],[5],[39],[78]) -model.testHaveNamingSubshapes(Partition_1,model,Part_1_doc) +model.checkResult(Partition_1, model, 1, [6], [0], [5], [39], [78]) +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPartitionInclinedFaceSolid.py b/src/FeaturesPlugin/Test/TestPartitionInclinedFaceSolid.py index 86f5edbcb..d9a146190 100644 --- a/src/FeaturesPlugin/Test/TestPartitionInclinedFaceSolid.py +++ b/src/FeaturesPlugin/Test/TestPartitionInclinedFaceSolid.py @@ -24,33 +24,74 @@ 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(-18.11540697674418, -21.53002906976744, 69.96519983648402) -SketchCircle_2 = Sketch_1.addCircle(-18.11540697674418, -21.53002906976744, 31.60961705559024) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchCircle_2.center()) +SketchCircle_1 = Sketch_1.addCircle( + -18.11540697674418, -21.53002906976744, 69.96519983648402 +) +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_2r-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) -Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2"), model.selection("VERTEX", "Point_3")) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("VERTEX", "Point_1"), + model.selection("VERTEX", "Point_2"), + model.selection("VERTEX", "Point_3"), +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchLine_1 = Sketch_2.addLine(98.50650093667804, 100.9440062780326, 111.3990833103819, -44.73923695837706) -SketchLine_2 = Sketch_2.addLine(111.3990833103819, -44.73923695837706, -130.2032518739455, -87.67357443122384) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(-130.2032518739455, -87.67357443122384, -102.5665996005733, 115.6113578178721) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_2.addLine(-102.5665996005733, 115.6113578178721, 98.50650093667804, 100.9440062780326) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint()) +SketchLine_1 = Sketch_2.addLine( + 98.50650093667804, 100.9440062780326, 111.3990833103819, -44.73923695837706 +) +SketchLine_2 = Sketch_2.addLine( + 111.3990833103819, -44.73923695837706, -130.2032518739455, -87.67357443122384 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + -130.2032518739455, -87.67357443122384, -102.5665996005733, 115.6113578178721 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_2.addLine( + -102.5665996005733, 115.6113578178721, 98.50650093667804, 100.9440062780326 +) +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_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_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")]) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1"), model.selection("FACE", "Face_1_1")], +) model.do() -model.checkResult(Partition_1,model,1,[3],[2],[10],[30],[60]) -model.testHaveNamingSubshapes(Partition_1,model,Part_1_doc) +model.checkResult(Partition_1, model, 1, [3], [2], [10], [30], [60]) +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid1.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid1.py index f7f475d66..150c467c6 100644 --- a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid1.py +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid1.py @@ -33,13 +33,37 @@ SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) 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") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + "ExtrusionMax", + "ExtrusionMin", +) Box_1 = model.addBox(Part_1_doc, 80, 80, "BoxHeight") -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Right")) -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")] +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +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_3")]) +Partition_2 = model.addPartition( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_1_2"), + model.selection("SOLID", "Partition_1_1_3"), + ], +) model.do() # check partition diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid2.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid2.py index 820793031..4a6ca1cf1 100644 --- a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid2.py +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid2.py @@ -33,13 +33,35 @@ SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) 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") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + "ExtrusionMax", + "ExtrusionMin", +) Box_1 = model.addBox(Part_1_doc, 80, 80, "BoxHeight") -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Right")) -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")] +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +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_objects = [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() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid3.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid3.py index c4a671463..5785e7067 100644 --- a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid3.py +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid3.py @@ -33,13 +33,36 @@ SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) 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") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + "ExtrusionMax", + "ExtrusionMin", +) Box_1 = model.addBox(Part_1_doc, 80, 80, "BoxHeight") -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Right")) -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")] +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +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_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_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() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace1.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace1.py index 6cc1c0146..fafc9678f 100644 --- a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace1.py +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace1.py @@ -32,16 +32,48 @@ SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) 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") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + "ExtrusionMax", + "ExtrusionMin", +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchArc_1 = Sketch_2.addArc(10.01336797518561, 24.95055816041118, 7.898114670281987, -23.85096600991564, 58.22303946797933, 32.81761798074749, False) -SketchLine_1 = Sketch_2.addLine(58.22303949051827, 32.8176179844255, 7.898114670281987, -23.85096600991564) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) +SketchArc_1 = Sketch_2.addArc( + 10.01336797518561, + 24.95055816041118, + 7.898114670281987, + -23.85096600991564, + 58.22303946797933, + 32.81761798074749, + False, +) +SketchLine_1 = Sketch_2.addLine( + 58.22303949051827, 32.8176179844255, 7.898114670281987, -23.85096600991564 +) +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/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")]) +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() # check partition diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace2.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace2.py index 0397bed15..ca097178b 100644 --- a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace2.py +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace2.py @@ -32,16 +32,48 @@ SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) 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") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + "ExtrusionMax", + "ExtrusionMin", +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchArc_1 = Sketch_2.addArc(10.01336797518561, 24.95055816041118, 7.898114670281987, -23.85096600991564, 58.22303946797933, 32.81761798074749, False) -SketchLine_1 = Sketch_2.addLine(58.22303949051827, 32.8176179844255, 7.898114670281987, -23.85096600991564) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) +SketchArc_1 = Sketch_2.addArc( + 10.01336797518561, + 24.95055816041118, + 7.898114670281987, + -23.85096600991564, + 58.22303946797933, + 32.81761798074749, + False, +) +SketchLine_1 = Sketch_2.addLine( + 58.22303949051827, 32.8176179844255, 7.898114670281987, -23.85096600991564 +) +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/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")]) +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() # check partition diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace3.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace3.py index e18ae68f9..09b5d427a 100644 --- a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace3.py +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace3.py @@ -32,16 +32,48 @@ SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) 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") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + "ExtrusionMax", + "ExtrusionMin", +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchArc_1 = Sketch_2.addArc(10.01336797518561, 24.95055816041118, 7.898114670281987, -23.85096600991564, 58.22303946797933, 32.81761798074749, False) -SketchLine_1 = Sketch_2.addLine(58.22303949051827, 32.8176179844255, 7.898114670281987, -23.85096600991564) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) +SketchArc_1 = Sketch_2.addArc( + 10.01336797518561, + 24.95055816041118, + 7.898114670281987, + -23.85096600991564, + 58.22303946797933, + 32.81761798074749, + False, +) +SketchLine_1 = Sketch_2.addLine( + 58.22303949051827, 32.8176179844255, 7.898114670281987, -23.85096600991564 +) +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/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")]) +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() # check partition diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace4.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace4.py index cacd109c3..7d75934a6 100644 --- a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace4.py +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace4.py @@ -32,16 +32,49 @@ SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) 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") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + "ExtrusionMax", + "ExtrusionMin", +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchArc_1 = Sketch_2.addArc(10.01336797518561, 24.95055816041118, 7.898114670281987, -23.85096600991564, 58.22303946797933, 32.81761798074749, False) -SketchLine_1 = Sketch_2.addLine(58.22303949051827, 32.8176179844255, 7.898114670281987, -23.85096600991564) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) +SketchArc_1 = Sketch_2.addArc( + 10.01336797518561, + 24.95055816041118, + 7.898114670281987, + -23.85096600991564, + 58.22303946797933, + 32.81761798074749, + False, +) +SketchLine_1 = Sketch_2.addLine( + 58.22303949051827, 32.8176179844255, 7.898114670281987, -23.85096600991564 +) +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/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")] +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() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace5.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace5.py index 7730c55d9..73a2b896e 100644 --- a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace5.py +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace5.py @@ -32,16 +32,49 @@ SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) 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") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + "ExtrusionMax", + "ExtrusionMin", +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchArc_1 = Sketch_2.addArc(10.01336797518561, 24.95055816041118, 7.898114670281987, -23.85096600991564, 58.22303946797933, 32.81761798074749, False) -SketchLine_1 = Sketch_2.addLine(58.22303949051827, 32.8176179844255, 7.898114670281987, -23.85096600991564) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) +SketchArc_1 = Sketch_2.addArc( + 10.01336797518561, + 24.95055816041118, + 7.898114670281987, + -23.85096600991564, + 58.22303946797933, + 32.81761798074749, + False, +) +SketchLine_1 = Sketch_2.addLine( + 58.22303949051827, 32.8176179844255, 7.898114670281987, -23.85096600991564 +) +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/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")] +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() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane1.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane1.py index bcc8a054b..16fc05ce2 100644 --- a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane1.py +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane1.py @@ -32,8 +32,20 @@ SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) 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("FACE", "PartSet/XOZ")]) +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("FACE", "PartSet/XOZ"), + ], +) model.do() # check partition diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane2.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane2.py index bd06a5e29..10d74e444 100644 --- a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane2.py +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane2.py @@ -32,8 +32,20 @@ SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) 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("FACE", "PartSet/XOZ")]) +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("FACE", "PartSet/XOZ"), + ], +) model.do() # check partition diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane3.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane3.py index 03b368055..3380b0d92 100644 --- a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane3.py +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane3.py @@ -32,8 +32,20 @@ SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) 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_3"), model.selection("FACE", "PartSet/XOZ")]) +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_3"), + model.selection("FACE", "PartSet/XOZ"), + ], +) model.do() # check partition diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane4.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane4.py index 28c15d4d7..1516b38ea 100644 --- a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane4.py +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane4.py @@ -32,8 +32,18 @@ SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) 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_objects = [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("FACE", "PartSet/XOZ")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + "ExtrusionMax", + "ExtrusionMin", +) +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() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane5.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane5.py index 824d4cf70..ab9ea67a7 100644 --- a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane5.py +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane5.py @@ -32,8 +32,18 @@ SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) 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_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "PartSet/XOZ")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + "ExtrusionMax", + "ExtrusionMin", +) +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() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid1.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid1.py index ba69f723f..b22afaa2b 100644 --- a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid1.py +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid1.py @@ -33,9 +33,18 @@ SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) 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") +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")]) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Box_1_1")], +) model.do() # check partition diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid2.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid2.py index 0ec42e2fc..5dc5fcbdf 100644 --- a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid2.py +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid2.py @@ -33,9 +33,19 @@ SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) 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") +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_objects = [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() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid3.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid3.py index b8d8e8807..3600a25d9 100644 --- a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid3.py +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid3.py @@ -33,9 +33,19 @@ SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) 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") +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_objects = [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() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid4.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid4.py index 54a9220f5..0825829ee 100644 --- a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid4.py +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid4.py @@ -33,9 +33,19 @@ SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) 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") +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_objects = [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() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid5.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid5.py index a0b9b3b4b..119f7d526 100644 --- a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid5.py +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid5.py @@ -33,9 +33,19 @@ SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) 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") +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_objects = [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() diff --git a/src/FeaturesPlugin/Test/TestPartitionWireFaceSolid.py b/src/FeaturesPlugin/Test/TestPartitionWireFaceSolid.py index fe23f586a..5eeb6a867 100644 --- a/src/FeaturesPlugin/Test/TestPartitionWireFaceSolid.py +++ b/src/FeaturesPlugin/Test/TestPartitionWireFaceSolid.py @@ -23,39 +23,94 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Torus_1 = model.addTorus(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 15, 3) +Torus_1 = model.addTorus( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 15, + 3, +) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchLine_1 = Sketch_1.addLine(-6.378039652249388, 16.497623739925, 8.984305600666083, -24.54329369827008) -SketchLine_2 = Sketch_1.addLine(8.984305600666083, -24.54329369827008, 36.73713621773835, -5.929982231235201) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(36.73713621773835, -5.929982231235201, 19.18554250372658, 21.11854572580065) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(19.18554250372658, 21.11854572580065, -6.378039652249388, 16.497623739925) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint()) -SketchCircle_1 = Sketch_1.addCircle(14.49765103937751, 9.678507230150521, 3.831444106492329) +SketchLine_1 = Sketch_1.addLine( + -6.378039652249388, 16.497623739925, 8.984305600666083, -24.54329369827008 +) +SketchLine_2 = Sketch_1.addLine( + 8.984305600666083, -24.54329369827008, 36.73713621773835, -5.929982231235201 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 36.73713621773835, -5.929982231235201, 19.18554250372658, 21.11854572580065 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + 19.18554250372658, 21.11854572580065, -6.378039652249388, 16.497623739925 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +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_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_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) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchLine_7 = Sketch_2.addLine(-3.043616368139293, -11.46189011940212, -3.922197168000547, 15.83568871823551) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchLine_8 = Sketch_2.addLine(-3.922197168000547, 15.83568871823551, -15.11211565655763, 11.99814589971457) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchLine_8.endPoint()) +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 +) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchLine_7 = Sketch_2.addLine( + -3.043616368139293, -11.46189011940212, -3.922197168000547, 15.83568871823551 +) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchLine_8 = Sketch_2.addLine( + -3.922197168000547, 15.83568871823551, -15.11211565655763, 11.99814589971457 +) +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_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_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_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]) -model.testHaveNamingSubshapes(Partition_1,model,Part_1_doc) +model.checkResult(Partition_1, model, 1, [3], [1], [4], [22], [46]) +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPartition_ErrorMsg.py b/src/FeaturesPlugin/Test/TestPartition_ErrorMsg.py index 50e47b592..f3f2fd598 100644 --- a/src/FeaturesPlugin/Test/TestPartition_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestPartition_ErrorMsg.py @@ -28,30 +28,43 @@ 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()) +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) +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() != "") +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() != "") +assert Partition_1.error() != "" aSession.finishOperation() diff --git a/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v0_1.py b/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v0_1.py index 12da02366..a8a5c7187 100644 --- a/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v0_1.py +++ b/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v0_1.py @@ -25,9 +25,27 @@ 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"), 10, 20) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 40, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 20, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 40, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) LinearCopy_2.result().subResult(0).subResult(0).setColor(255, 170, 0) LinearCopy_2.result().subResult(0).subResult(1).setColor(255, 170, 0) LinearCopy_2.result().subResult(1).subResult(0).setColor(0, 0, 255) @@ -37,47 +55,119 @@ SketchLine_1 = Sketch_1.addLine(7, 0, -7, 0) SketchLine_2 = Sketch_1.addLine(-7, 0, -7, 5) SketchLine_3 = Sketch_1.addLine(-7, 5, 7, 5) SketchLine_4 = Sketch_1.addLine(7, 5, 7, 0) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_5 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_5.result(), 7, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_5.result(), 7, True +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 14) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 5) SketchLine_6 = Sketch_1.addLine(5, 12, -5, 12) SketchLine_7 = Sketch_1.addLine(-5, 12, -5, 15) SketchLine_8 = Sketch_1.addLine(-5, 15, 5, 15) SketchLine_9 = Sketch_1.addLine(5, 15, 5, 12) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_9.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()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_9.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() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 3) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 10) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_5.result(), 5, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_3.result(), 7, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_5.result(), 5, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchLine_3.result(), 7, True +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 60, 20) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r")], model.selection(), 55, 15) -LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 60, + 20, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r", + ) + ], + model.selection(), + 55, + 15, +) +LinearCopy_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "LinearCopy_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_1.result().subResult(0).subResult(0).setColor(0, 170, 0) Compound_1.result().subResult(0).subResult(1).setColor(0, 170, 0) Compound_1.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_1.result().subResult(1).subResult(1).setColor(0, 255, 0) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "LinearCopy_2_1_1_1"), model.selection("COMPOUND", "Compound_1_1_2")]) +Partition_1 = model.addPartition( + Part_1_doc, + [ + model.selection("SOLID", "LinearCopy_2_1_1_1"), + model.selection("COMPOUND", "Compound_1_1_2"), + ], +) model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) @@ -93,4 +183,4 @@ model.testNbSubShapes(Partition_1, GeomAPI_Shape.EDGE, [328]) model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [656]) model.testResultsVolumes(Partition_1, [9335.251534206097858259454369545]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v0_2.py b/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v0_2.py index 957971c9e..7ce53c29d 100644 --- a/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v0_2.py +++ b/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v0_2.py @@ -26,32 +26,70 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 10) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) SketchCircle_2 = Sketch_1.addCircle(10, 0, 10) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_2.center() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0 +) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchCircle_3 = Sketch_2.addCircle(0, -7, 10) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.result(), SketchCircle_3.center()) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.result(), SketchCircle_3.center() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_3.results()[1], 10) -SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance(SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7) +SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance( + SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7 +) SketchCircle_4 = Sketch_2.addCircle(40, -27, 10) -SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_4.results()[1], SketchCircle_3.results()[1]) -SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance(SketchCircle_3.center(), SketchCircle_4.center(), 40) -SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchCircle_4.center(), SketchCircle_3.center(), 20) +SketchConstraintEqual_2 = Sketch_2.setEqual( + SketchCircle_4.results()[1], SketchCircle_3.results()[1] +) +SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance( + SketchCircle_3.center(), SketchCircle_4.center(), 40 +) +SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance( + SketchCircle_4.center(), SketchCircle_3.center(), 20 +) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")]) -Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPSOLID", "Extrusion_1_1")]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "Extrusion_2_2"), + ], +) +Compound_2 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "Compound_1_1"), + model.selection("COMPSOLID", "Extrusion_1_1"), + ], +) Compound_2.result().subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(1).setColor(255, 170, 0) @@ -64,45 +102,114 @@ SketchLine_3 = Sketch_3.addLine(7, 0, -7, 0) SketchLine_4 = Sketch_3.addLine(-7, 0, -7, 5) SketchLine_5 = Sketch_3.addLine(-7, 5, 7, 5) SketchLine_6 = Sketch_3.addLine(7, 5, 7, 0) -SketchConstraintCoincidence_4 = Sketch_3.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_4 = Sketch_3.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_3.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_3.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_3.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_3.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_3.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_6.result()) -SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_3 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_7 = SketchProjection_3.createdFeature() -SketchConstraintDistance_1 = Sketch_3.setDistance(SketchLine_5.endPoint(), SketchLine_7.result(), 7, True) -SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result()) +SketchConstraintDistance_1 = Sketch_3.setDistance( + SketchLine_5.endPoint(), SketchLine_7.result(), 7, True +) +SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint( + SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result() +) SketchConstraintLength_1 = Sketch_3.setLength(SketchLine_4.result(), 5) SketchLine_8 = Sketch_3.addLine(7, 7, -7, 7) SketchLine_9 = Sketch_3.addLine(-7, 7, -7, 10) SketchLine_10 = Sketch_3.addLine(-7, 10, 7, 10) SketchLine_11 = Sketch_3.addLine(7, 10, 7, 7) -SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_8 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_3.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_3.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_3.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_9.result()) SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_10.result()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_11.result()) -SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_9.startPoint(), SketchLine_4.result()) -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_8.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_12 = Sketch_3.setCoincident( + SketchLine_9.startPoint(), SketchLine_4.result() +) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_8.startPoint(), SketchLine_6.result() +) SketchConstraintLength_2 = Sketch_3.setLength(SketchLine_9.result(), 3) -SketchConstraintDistance_2 = Sketch_3.setDistance(SketchLine_9.startPoint(), SketchLine_5.result(), 2, True) +SketchConstraintDistance_2 = Sketch_3.setDistance( + SketchLine_9.startPoint(), SketchLine_5.result(), 2, True +) model.do() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")], model.selection(), 50, -10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r")], model.selection(), 60, 20) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_4_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_3 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], + model.selection(), + 50, + -10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r", + ) + ], + model.selection(), + 60, + 20, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_4_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_3 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_3.result().subResult(0).setColor(0, 170, 0) Compound_3.result().subResult(1).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(1).setColor(0, 255, 0) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_1"), model.selection("SOLID", "Compound_2_1_2_3"), model.selection("COMPOUND", "Compound_3_1_2")]) +Partition_1 = model.addPartition( + Part_1_doc, + [ + model.selection("SOLID", "Compound_2_1_1_1"), + model.selection("SOLID", "Compound_2_1_2_3"), + model.selection("COMPOUND", "Compound_3_1_2"), + ], +) model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) @@ -118,4 +225,4 @@ model.testNbSubShapes(Partition_1, GeomAPI_Shape.EDGE, [938]) model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [1876]) model.testResultsVolumes(Partition_1, [17001.414867225816]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v0_3.py b/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v0_3.py index fe8adac42..3f2c73d14 100644 --- a/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v0_3.py +++ b/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v0_3.py @@ -26,9 +26,27 @@ 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"), 10, 20) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 40, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 20, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 40, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) LinearCopy_2.result().subResult(0).subResult(0).setColor(255, 170, 0) LinearCopy_2.result().subResult(0).subResult(1).setColor(255, 170, 0) LinearCopy_2.result().subResult(1).subResult(0).setColor(0, 0, 255) @@ -38,47 +56,118 @@ SketchLine_1 = Sketch_1.addLine(7, 0, -7, 0) SketchLine_2 = Sketch_1.addLine(-7, 0, -7, 5) SketchLine_3 = Sketch_1.addLine(-7, 5, 7, 5) SketchLine_4 = Sketch_1.addLine(7, 5, 7, 0) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_5 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_5.result(), 7, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_5.result(), 7, True +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 14) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 5) SketchLine_6 = Sketch_1.addLine(5, 12, -5, 12) SketchLine_7 = Sketch_1.addLine(-5, 12, -5, 15) SketchLine_8 = Sketch_1.addLine(-5, 15, 5, 15) SketchLine_9 = Sketch_1.addLine(5, 15, 5, 12) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_9.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()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_9.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() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 3) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 10) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_5.result(), 5, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_3.result(), 7, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_5.result(), 5, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchLine_3.result(), 7, True +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 60, 20) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r")], model.selection(), 55, 15) -LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 60, + 20, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r", + ) + ], + model.selection(), + 55, + 15, +) +LinearCopy_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "LinearCopy_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_1.result().subResult(0).subResult(0).setColor(0, 170, 0) Compound_1.result().subResult(0).subResult(1).setColor(0, 170, 0) Compound_1.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_1.result().subResult(1).subResult(1).setColor(0, 255, 0) -Partition_1_objects = [model.selection("SOLID", "LinearCopy_2_1_1_1"), model.selection("SOLID", "Compound_1_1_2_2"), model.selection("SOLID", "LinearCopy_2_1_2_2"), model.selection("SOLID", "Compound_1_1_1_2")] +Partition_1_objects = [ + model.selection("SOLID", "LinearCopy_2_1_1_1"), + model.selection("SOLID", "Compound_1_1_2_2"), + model.selection("SOLID", "LinearCopy_2_1_2_2"), + model.selection("SOLID", "Compound_1_1_1_2"), +] Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects) model.do() @@ -91,7 +180,11 @@ model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [204, 228]) model.testResultsVolumes(Partition_1, [7809.218420698664886, 10607.88782061204438]) # change Partition objects -Partition_1_objects = [model.selection("SOLID", "LinearCopy_2_1_1_1"), model.selection("SOLID", "Compound_1_1_2_2"), model.selection("SOLID", "LinearCopy_2_1_2_2")] +Partition_1_objects = [ + model.selection("SOLID", "LinearCopy_2_1_1_1"), + model.selection("SOLID", "Compound_1_1_2_2"), + model.selection("SOLID", "LinearCopy_2_1_2_2"), +] Partition_1.setBase(Partition_1_objects) model.do() @@ -109,4 +202,4 @@ model.testNbSubShapes(Partition_1, GeomAPI_Shape.EDGE, [102, 6]) model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [204, 12]) model.testResultsVolumes(Partition_1, [7809.218420698664886, 6283.185307179586744]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v20190506_1.py b/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v20190506_1.py index dc8fef61a..33d4cb763 100644 --- a/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v20190506_1.py +++ b/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v20190506_1.py @@ -25,9 +25,27 @@ 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"), 10, 20) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 40, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 20, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 40, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) LinearCopy_2.result().subResult(0).subResult(0).setColor(255, 170, 0) LinearCopy_2.result().subResult(0).subResult(1).setColor(255, 170, 0) LinearCopy_2.result().subResult(1).subResult(0).setColor(0, 0, 255) @@ -37,47 +55,120 @@ SketchLine_1 = Sketch_1.addLine(7, 0, -7, 0) SketchLine_2 = Sketch_1.addLine(-7, 0, -7, 5) SketchLine_3 = Sketch_1.addLine(-7, 5, 7, 5) SketchLine_4 = Sketch_1.addLine(7, 5, 7, 0) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_5 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_5.result(), 7, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_5.result(), 7, True +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 14) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 5) SketchLine_6 = Sketch_1.addLine(5, 12, -5, 12) SketchLine_7 = Sketch_1.addLine(-5, 12, -5, 15) SketchLine_8 = Sketch_1.addLine(-5, 15, 5, 15) SketchLine_9 = Sketch_1.addLine(5, 15, 5, 12) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_9.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()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_9.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() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 3) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 10) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_5.result(), 5, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_3.result(), 7, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_5.result(), 5, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchLine_3.result(), 7, True +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 60, 20) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r")], model.selection(), 55, 15) -LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 60, + 20, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r", + ) + ], + model.selection(), + 55, + 15, +) +LinearCopy_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "LinearCopy_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_1.result().subResult(0).subResult(0).setColor(0, 170, 0) Compound_1.result().subResult(0).subResult(1).setColor(0, 170, 0) Compound_1.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_1.result().subResult(1).subResult(1).setColor(0, 255, 0) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "LinearCopy_2_1_1_1"), model.selection("COMPOUND", "Compound_1_1_2")], keepSubResults = True) +Partition_1 = model.addPartition( + Part_1_doc, + [ + model.selection("SOLID", "LinearCopy_2_1_1_1"), + model.selection("COMPOUND", "Compound_1_1_2"), + ], + keepSubResults=True, +) model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) @@ -93,4 +184,4 @@ model.testNbSubShapes(Partition_1, GeomAPI_Shape.EDGE, [394]) model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [788]) model.testResultsVolumes(Partition_1, [39384.807455744848994]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v20190506_2.py b/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v20190506_2.py index f29466ef7..ecab5bc48 100644 --- a/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v20190506_2.py +++ b/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v20190506_2.py @@ -26,32 +26,70 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 10) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) SketchCircle_2 = Sketch_1.addCircle(10, 0, 10) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_2.center() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_2.center(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0 +) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchCircle_3 = Sketch_2.addCircle(0, -7, 10) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.result(), SketchCircle_3.center()) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_2.result(), SketchCircle_3.center() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_3.results()[1], 10) -SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance(SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7) +SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance( + SketchCircle_3.center(), SketchAPI_Line(SketchLine_2).startPoint(), 7 +) SketchCircle_4 = Sketch_2.addCircle(40, -27, 10) -SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_4.results()[1], SketchCircle_3.results()[1]) -SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance(SketchCircle_3.center(), SketchCircle_4.center(), 40) -SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchCircle_4.center(), SketchCircle_3.center(), 20) +SketchConstraintEqual_2 = Sketch_2.setEqual( + SketchCircle_4.results()[1], SketchCircle_3.results()[1] +) +SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance( + SketchCircle_3.center(), SketchCircle_4.center(), 40 +) +SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance( + SketchCircle_4.center(), SketchCircle_3.center(), 20 +) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")]) -Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPSOLID", "Extrusion_1_1")]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "Extrusion_2_2"), + ], +) +Compound_2 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "Compound_1_1"), + model.selection("COMPSOLID", "Extrusion_1_1"), + ], +) Compound_2.result().subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(0).setColor(255, 170, 0) Compound_2.result().subResult(0).subResult(1).setColor(255, 170, 0) @@ -64,45 +102,115 @@ SketchLine_3 = Sketch_3.addLine(7, 0, -7, 0) SketchLine_4 = Sketch_3.addLine(-7, 0, -7, 5) SketchLine_5 = Sketch_3.addLine(-7, 5, 7, 5) SketchLine_6 = Sketch_3.addLine(7, 5, 7, 0) -SketchConstraintCoincidence_4 = Sketch_3.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_4 = Sketch_3.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_3.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_3.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_3.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_3.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_3.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_6.result()) -SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_3 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_7 = SketchProjection_3.createdFeature() -SketchConstraintDistance_1 = Sketch_3.setDistance(SketchLine_5.endPoint(), SketchLine_7.result(), 7, True) -SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result()) +SketchConstraintDistance_1 = Sketch_3.setDistance( + SketchLine_5.endPoint(), SketchLine_7.result(), 7, True +) +SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint( + SketchAPI_Line(SketchLine_7).startPoint(), SketchLine_3.result() +) SketchConstraintLength_1 = Sketch_3.setLength(SketchLine_4.result(), 5) SketchLine_8 = Sketch_3.addLine(7, 7, -7, 7) SketchLine_9 = Sketch_3.addLine(-7, 7, -7, 10) SketchLine_10 = Sketch_3.addLine(-7, 10, 7, 10) SketchLine_11 = Sketch_3.addLine(7, 10, 7, 7) -SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_8 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_3.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_3.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_3.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_9.result()) SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_10.result()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_11.result()) -SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_9.startPoint(), SketchLine_4.result()) -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_8.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_12 = Sketch_3.setCoincident( + SketchLine_9.startPoint(), SketchLine_4.result() +) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_8.startPoint(), SketchLine_6.result() +) SketchConstraintLength_2 = Sketch_3.setLength(SketchLine_9.result(), 3) -SketchConstraintDistance_2 = Sketch_3.setDistance(SketchLine_9.startPoint(), SketchLine_5.result(), 2, True) +SketchConstraintDistance_2 = Sketch_3.setDistance( + SketchLine_9.startPoint(), SketchLine_5.result(), 2, True +) model.do() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")], model.selection(), 50, -10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r")], model.selection(), 60, 20) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_4_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_3 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], + model.selection(), + 50, + -10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r", + ) + ], + model.selection(), + 60, + 20, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_4_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_3 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_3.result().subResult(0).setColor(0, 170, 0) Compound_3.result().subResult(1).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_3.result().subResult(1).subResult(1).setColor(0, 255, 0) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_1"), model.selection("SOLID", "Compound_2_1_2_3"), model.selection("COMPOUND", "Compound_3_1_2")], keepSubResults = True) +Partition_1 = model.addPartition( + Part_1_doc, + [ + model.selection("SOLID", "Compound_2_1_1_1"), + model.selection("SOLID", "Compound_2_1_2_3"), + model.selection("COMPOUND", "Compound_3_1_2"), + ], + keepSubResults=True, +) model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) @@ -118,4 +226,4 @@ model.testNbSubShapes(Partition_1, GeomAPI_Shape.EDGE, [968]) model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [1936]) model.testResultsVolumes(Partition_1, [26084.60017440541]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v20190506_3.py b/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v20190506_3.py index 72d8271fa..f91e352e3 100644 --- a/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v20190506_3.py +++ b/src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v20190506_3.py @@ -26,9 +26,27 @@ 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"), 10, 20) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 40, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 20, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 40, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) LinearCopy_2.result().subResult(0).subResult(0).setColor(255, 170, 0) LinearCopy_2.result().subResult(0).subResult(1).setColor(255, 170, 0) LinearCopy_2.result().subResult(1).subResult(0).setColor(0, 0, 255) @@ -38,48 +56,119 @@ SketchLine_1 = Sketch_1.addLine(7, 0, -7, 0) SketchLine_2 = Sketch_1.addLine(-7, 0, -7, 5) SketchLine_3 = Sketch_1.addLine(-7, 5, 7, 5) SketchLine_4 = Sketch_1.addLine(7, 5, 7, 0) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_5 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_5.result(), 7, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_5.result(), 7, True +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_1.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 14) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 5) SketchLine_6 = Sketch_1.addLine(5, 12, -5, 12) SketchLine_7 = Sketch_1.addLine(-5, 12, -5, 15) SketchLine_8 = Sketch_1.addLine(-5, 15, 5, 15) SketchLine_9 = Sketch_1.addLine(5, 15, 5, 12) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_9.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()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_9.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() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 3) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 10) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_5.result(), 5, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_3.result(), 7, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_5.result(), 5, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchLine_3.result(), 7, True +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 60, 20) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r")], model.selection(), 55, 15) -LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OY"), 40, 2) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "AngularCopy_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 60, + 20, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r", + ) + ], + model.selection(), + 55, + 15, +) +LinearCopy_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OY"), + 40, + 2, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("COMPOUND", "LinearCopy_3_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), + ], +) Compound_1.result().subResult(0).subResult(0).setColor(0, 170, 0) Compound_1.result().subResult(0).subResult(1).setColor(0, 170, 0) Compound_1.result().subResult(1).subResult(0).setColor(0, 255, 0) Compound_1.result().subResult(1).subResult(1).setColor(0, 255, 0) -Partition_1_objects = [model.selection("SOLID", "LinearCopy_2_1_1_1"), model.selection("SOLID", "Compound_1_1_2_2"), model.selection("SOLID", "LinearCopy_2_1_2_2"), model.selection("SOLID", "Compound_1_1_1_2")] -Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults = True) +Partition_1_objects = [ + model.selection("SOLID", "LinearCopy_2_1_1_1"), + model.selection("SOLID", "Compound_1_1_2_2"), + model.selection("SOLID", "LinearCopy_2_1_2_2"), + model.selection("SOLID", "Compound_1_1_1_2"), +] +Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults=True) model.do() model.testNbResults(Partition_1, 1) @@ -91,7 +180,11 @@ model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [552]) model.testResultsVolumes(Partition_1, [38683.4768556698836619]) # change Partition objects -Partition_1_objects = [model.selection("SOLID", "LinearCopy_2_1_1_1"), model.selection("SOLID", "Compound_1_1_2_2"), model.selection("SOLID", "LinearCopy_2_1_2_2")] +Partition_1_objects = [ + model.selection("SOLID", "LinearCopy_2_1_1_1"), + model.selection("SOLID", "Compound_1_1_2_2"), + model.selection("SOLID", "LinearCopy_2_1_2_2"), +] Partition_1.setBase(Partition_1_objects) model.do() @@ -107,4 +200,4 @@ model.testNbSubShapes(Partition_1, GeomAPI_Shape.EDGE, [192]) model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [384]) model.testResultsVolumes(Partition_1, [39958.774342237426]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPartition_SolidsHistory.py b/src/FeaturesPlugin/Test/TestPartition_SolidsHistory.py index 72edb9457..16afa879d 100644 --- a/src/FeaturesPlugin/Test/TestPartition_SolidsHistory.py +++ b/src/FeaturesPlugin/Test/TestPartition_SolidsHistory.py @@ -28,42 +28,105 @@ 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(-16.04556650246306, 45.15147783251232, -31.59359605911331, 45.15147783251232) -SketchLine_2 = Sketch_1.addLine(-31.59359605911331, 45.15147783251232, -31.59359605911331, 29.10591133004927) -SketchLine_3 = Sketch_1.addLine(-31.59359605911331, 29.10591133004927, -16.04556650246306, 29.10591133004927) -SketchLine_4 = Sketch_1.addLine(-16.04556650246306, 29.10591133004927, -16.04556650246306, 45.15147783251232) -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()) +SketchLine_1 = Sketch_1.addLine( + -16.04556650246306, 45.15147783251232, -31.59359605911331, 45.15147783251232 +) +SketchLine_2 = Sketch_1.addLine( + -31.59359605911331, 45.15147783251232, -31.59359605911331, 29.10591133004927 +) +SketchLine_3 = Sketch_1.addLine( + -31.59359605911331, 29.10591133004927, -16.04556650246306, 29.10591133004927 +) +SketchLine_4 = Sketch_1.addLine( + -16.04556650246306, 29.10591133004927, -16.04556650246306, 45.15147783251232 +) +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(12.4384236453202, 13.06034482758621, -5.846059113300496, 13.06034482758621) -SketchLine_6 = Sketch_1.addLine(-5.846059113300496, 13.06034482758621, -5.846059113300496, -6.965517241379309) -SketchLine_7 = Sketch_1.addLine(-5.846059113300496, -6.965517241379309, 12.4384236453202, -6.965517241379309) -SketchLine_8 = Sketch_1.addLine(12.4384236453202, -6.965517241379309, 12.4384236453202, 13.06034482758621) -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()) +SketchLine_5 = Sketch_1.addLine( + 12.4384236453202, 13.06034482758621, -5.846059113300496, 13.06034482758621 +) +SketchLine_6 = Sketch_1.addLine( + -5.846059113300496, 13.06034482758621, -5.846059113300496, -6.965517241379309 +) +SketchLine_7 = Sketch_1.addLine( + -5.846059113300496, -6.965517241379309, 12.4384236453202, -6.965517241379309 +) +SketchLine_8 = Sketch_1.addLine( + 12.4384236453202, -6.965517241379309, 12.4384236453202, 13.06034482758621 +) +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()) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_1 = Sketch_2.addCircle(-10.81448298196523, 20.3003568426161, 15.58088381891068) -SketchLine_9 = Sketch_2.addLine(-19.86849367207068, 32.98061042849822, 0.2083042015703297, 9.288449501673265) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_9.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchCircle_1.results()[1]) +SketchCircle_1 = Sketch_2.addCircle( + -10.81448298196523, 20.3003568426161, 15.58088381891068 +) +SketchLine_9 = Sketch_2.addLine( + -19.86849367207068, 32.98061042849822, 0.2083042015703297, 9.288449501673265 +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_9.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchCircle_1.results()[1] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1"), model.selection("COMPOUND", "Sketch_2")], model.selection(), 10, 0) -Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_3_2")]) -Group_2_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), model.selection("FACE", "Extrusion_1_3_2/Generated_Face&Sketch_2/SketchCircle_1_2"), model.selection("FACE", "Extrusion_1_3_1/Generated_Face&Sketch_2/SketchCircle_1_2&weak_name_1"), model.selection("FACE", "Extrusion_1_2/To_Face")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1"), model.selection("COMPOUND", "Sketch_2")], + model.selection(), + 10, + 0, +) +Group_1 = model.addGroup( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_1_3_2"), + ], +) +Group_2_objects = [ + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), + model.selection("FACE", "Extrusion_1_3_2/Generated_Face&Sketch_2/SketchCircle_1_2"), + model.selection( + "FACE", "Extrusion_1_3_1/Generated_Face&Sketch_2/SketchCircle_1_2&weak_name_1" + ), + model.selection("FACE", "Extrusion_1_2/To_Face"), +] Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2"), model.selection("COMPSOLID", "Extrusion_1_3")] +Partition_1_objects = [ + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_1_2"), + model.selection("COMPSOLID", "Extrusion_1_3"), +] Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects) model.do() # move groups after the partitiion @@ -74,15 +137,15 @@ model.end() # check groups are correct aFactory = ModelAPI_Session.get().validators() selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 5) -assert(aFactory.validate(Group_1.feature())) +assert selectionList.size() == 5 +assert aFactory.validate(Group_1.feature()) for i in range(5): - assert(Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID) + assert Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 10) -assert(aFactory.validate(Group_2.feature())) +assert selectionList.size() == 10 +assert aFactory.validate(Group_2.feature()) for i in range(10): - assert(Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE) + assert Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPipe.py b/src/FeaturesPlugin/Test/TestPipe.py index 93f004fc5..ef065fb8d 100644 --- a/src/FeaturesPlugin/Test/TestPipe.py +++ b/src/FeaturesPlugin/Test/TestPipe.py @@ -117,7 +117,7 @@ aPipeFeature.string("creation_method").setValue("simple") aSession.finishOperation() # Test results -assert (len(aPipeFeature.results()) > 0) +assert len(aPipeFeature.results()) > 0 # aSession.undo() # Recover original face @@ -144,7 +144,7 @@ aBinormalObjectSelection.setValue(aSketchResult, aShapeExplorer.current()) aSession.finishOperation() # Test results -assert (len(aPipeFeature.results()) > 0) +assert len(aPipeFeature.results()) > 0 # aSession.undo() # Recover original face @@ -200,7 +200,8 @@ aPipeFeature.string("creation_method").setValue("locations") aSession.finishOperation() # Test results -assert (len(aPipeFeature.results()) > 0) +assert len(aPipeFeature.results()) > 0 from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPipe_Compound.py b/src/FeaturesPlugin/Test/TestPipe_Compound.py index 02ef76195..edb1864a2 100644 --- a/src/FeaturesPlugin/Test/TestPipe_Compound.py +++ b/src/FeaturesPlugin/Test/TestPipe_Compound.py @@ -28,9 +28,19 @@ SketchLine_1 = Sketch_1.addLine(60, 15, 100, 20) SketchLine_2 = Sketch_1.addLine(35, 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")]) +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")) +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 diff --git a/src/FeaturesPlugin/Test/TestPipe_DoNotMovePath.py b/src/FeaturesPlugin/Test/TestPipe_DoNotMovePath.py index 85f44320c..bde010059 100644 --- a/src/FeaturesPlugin/Test/TestPipe_DoNotMovePath.py +++ b/src/FeaturesPlugin/Test/TestPipe_DoNotMovePath.py @@ -31,150 +31,204 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) ### Create SketchLine -SketchLine_1 = Sketch_1.addLine(-592.0852359208525, -262.5570776255708, -625.5707762557078, -186.4535768645358) +SketchLine_1 = Sketch_1.addLine( + -592.0852359208525, -262.5570776255708, -625.5707762557078, -186.4535768645358 +) SketchLine_1.setAuxiliary(True) ### Create SketchLine -SketchLine_2 = Sketch_1.addLine(-625.5707762557078, -186.4535768645358, -639.2694063926941, -108.8280060882801) +SketchLine_2 = Sketch_1.addLine( + -625.5707762557078, -186.4535768645358, -639.2694063926941, -108.8280060882801 +) SketchLine_2.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) ### Create SketchLine -SketchLine_3 = Sketch_1.addLine(-639.2694063926941, -108.8280060882801, -637.7473363774735, -9.893455098934579) +SketchLine_3 = Sketch_1.addLine( + -639.2694063926941, -108.8280060882801, -637.7473363774735, -9.893455098934579 +) SketchLine_3.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) ### Create SketchLine -SketchLine_4 = Sketch_1.addLine(-637.7473363774735, -9.893455098934579, -614.9162861491628, 101.2176560121766) +SketchLine_4 = Sketch_1.addLine( + -637.7473363774735, -9.893455098934579, -614.9162861491628, 101.2176560121766 +) SketchLine_4.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) ### Create SketchLine -SketchLine_5 = Sketch_1.addLine(-614.9162861491628, 101.2176560121766, -573.8203957382038, 200.1522070015221) +SketchLine_5 = Sketch_1.addLine( + -614.9162861491628, 101.2176560121766, -573.8203957382038, 200.1522070015221 +) SketchLine_5.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) ### Create SketchLine -SketchLine_6 = Sketch_1.addLine(-573.8203957382038, 200.1522070015221, -532.724505327245, 200.1522070015221) +SketchLine_6 = Sketch_1.addLine( + -573.8203957382038, 200.1522070015221, -532.724505327245, 200.1522070015221 +) SketchLine_6.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) ### Create SketchLine -SketchLine_7 = Sketch_1.addLine(-532.724505327245, 200.1522070015221, 80.66971080669715, 200.1522070015221) +SketchLine_7 = Sketch_1.addLine( + -532.724505327245, 200.1522070015221, 80.66971080669715, 200.1522070015221 +) SketchLine_7.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) Sketch_1.setHorizontal(SketchLine_7.result()) ### Create SketchLine -SketchLine_8 = Sketch_1.addLine(80.66971080669715, 200.1522070015221, 68.49315068493158, 101.2176560121766) +SketchLine_8 = Sketch_1.addLine( + 80.66971080669715, 200.1522070015221, 68.49315068493158, 101.2176560121766 +) SketchLine_8.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) ### Create SketchLine -SketchLine_9 = Sketch_1.addLine(68.49315068493158, 101.2176560121766, 54.79452054794545, -9.893455098934579) +SketchLine_9 = Sketch_1.addLine( + 68.49315068493158, 101.2176560121766, 54.79452054794545, -9.893455098934579 +) SketchLine_9.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) ### Create SketchLine -SketchLine_10 = Sketch_1.addLine(54.79452054794545, -9.893455098934579, 63.92694063926946, -108.8280060882801) +SketchLine_10 = Sketch_1.addLine( + 54.79452054794545, -9.893455098934579, 63.92694063926946, -108.8280060882801 +) SketchLine_10.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) ### Create SketchLine -SketchLine_11 = Sketch_1.addLine(63.92694063926946, -108.8280060882801, 66.97108066971103, -186.4535768645358) +SketchLine_11 = Sketch_1.addLine( + 63.92694063926946, -108.8280060882801, 66.97108066971103, -186.4535768645358 +) SketchLine_11.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) ### Create SketchLine -SketchLine_12 = Sketch_1.addLine(66.97108066971103, -186.4535768645358, 92.84627092846273, -262.5570776255708) +SketchLine_12 = Sketch_1.addLine( + 66.97108066971103, -186.4535768645358, 92.84627092846273, -262.5570776255708 +) SketchLine_12.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) ### Create SketchLine -SketchLine_13 = Sketch_1.addLine(92.84627092846273, -262.5570776255708, -546.4231354642313, -262.5570776255708) +SketchLine_13 = Sketch_1.addLine( + 92.84627092846273, -262.5570776255708, -546.4231354642313, -262.5570776255708 +) SketchLine_13.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) Sketch_1.setHorizontal(SketchLine_13.result()) ### Create SketchLine -SketchLine_14 = Sketch_1.addLine(-546.4231354642313, -262.5570776255708, -584.4748858447489, -186.4535768645358) +SketchLine_14 = Sketch_1.addLine( + -546.4231354642313, -262.5570776255708, -584.4748858447489, -186.4535768645358 +) SketchLine_14.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) ### Create SketchLine -SketchLine_15 = Sketch_1.addLine(-584.4748858447489, -186.4535768645358, -593.6073059360729, -108.8280060882801) +SketchLine_15 = Sketch_1.addLine( + -584.4748858447489, -186.4535768645358, -593.6073059360729, -108.8280060882801 +) SketchLine_15.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) ### Create SketchLine -SketchLine_16 = Sketch_1.addLine(-593.6073059360729, -108.8280060882801, -573.8203957382038, -9.893455098934577) +SketchLine_16 = Sketch_1.addLine( + -593.6073059360729, -108.8280060882801, -573.8203957382038, -9.893455098934577 +) SketchLine_16.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) ### Create SketchLine -SketchLine_17 = Sketch_1.addLine(-573.8203957382038, -9.893455098934577, -558.599695585997, 101.2176560121766) +SketchLine_17 = Sketch_1.addLine( + -573.8203957382038, -9.893455098934577, -558.599695585997, 101.2176560121766 +) SketchLine_17.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) ### Create SketchLine -SketchLine_18 = Sketch_1.addLine(-558.599695585997, 101.2176560121766, -532.724505327245, 200.1522070015221) +SketchLine_18 = Sketch_1.addLine( + -558.599695585997, 101.2176560121766, -532.724505327245, 200.1522070015221 +) SketchLine_18.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_18.endPoint()) ### Create SketchLine -SketchLine_19 = Sketch_1.addLine(-592.0852359208525, -262.5570776255708, -546.4231354642313, -262.5570776255708) +SketchLine_19 = Sketch_1.addLine( + -592.0852359208525, -262.5570776255708, -546.4231354642313, -262.5570776255708 +) SketchLine_19.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_19.startPoint()) Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_19.endPoint()) ### Create SketchLine -SketchLine_20 = Sketch_1.addLine(-625.5707762557078, -186.4535768645358, -584.4748858447489, -186.4535768645358) +SketchLine_20 = Sketch_1.addLine( + -625.5707762557078, -186.4535768645358, -584.4748858447489, -186.4535768645358 +) SketchLine_20.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_20.startPoint()) Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_20.endPoint()) ### Create SketchLine -SketchLine_21 = Sketch_1.addLine(-639.2694063926941, -108.8280060882801, -593.6073059360729, -108.8280060882801) +SketchLine_21 = Sketch_1.addLine( + -639.2694063926941, -108.8280060882801, -593.6073059360729, -108.8280060882801 +) SketchLine_21.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_21.startPoint()) Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_21.endPoint()) ### Create SketchLine -SketchLine_22 = Sketch_1.addLine(-637.7473363774735, -9.893455098934579, -573.8203957382038, -9.893455098934577) +SketchLine_22 = Sketch_1.addLine( + -637.7473363774735, -9.893455098934579, -573.8203957382038, -9.893455098934577 +) SketchLine_22.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_22.startPoint()) Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_22.endPoint()) Sketch_1.setHorizontal(SketchLine_22.result()) ### Create SketchLine -SketchLine_23 = Sketch_1.addLine(-614.9162861491628, 101.2176560121766, -558.599695585997, 101.2176560121766) +SketchLine_23 = Sketch_1.addLine( + -614.9162861491628, 101.2176560121766, -558.599695585997, 101.2176560121766 +) SketchLine_23.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_23.startPoint()) Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_23.endPoint()) ### Create SketchLine -SketchLine_24 = Sketch_1.addLine(-558.599695585997, 101.2176560121766, 68.49315068493158, 101.2176560121766) +SketchLine_24 = Sketch_1.addLine( + -558.599695585997, 101.2176560121766, 68.49315068493158, 101.2176560121766 +) SketchLine_24.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_24.startPoint()) Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_24.endPoint()) ### Create SketchLine -SketchLine_25 = Sketch_1.addLine(-573.8203957382038, -9.893455098934577, 54.79452054794545, -9.893455098934579) +SketchLine_25 = Sketch_1.addLine( + -573.8203957382038, -9.893455098934577, 54.79452054794545, -9.893455098934579 +) SketchLine_25.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_25.startPoint()) Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_25.endPoint()) Sketch_1.setHorizontal(SketchLine_25.result()) ### Create SketchLine -SketchLine_26 = Sketch_1.addLine(-593.6073059360729, -108.8280060882801, 63.92694063926946, -108.8280060882801) +SketchLine_26 = Sketch_1.addLine( + -593.6073059360729, -108.8280060882801, 63.92694063926946, -108.8280060882801 +) SketchLine_26.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_26.startPoint()) Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_26.endPoint()) Sketch_1.setHorizontal(SketchLine_26.result()) ### Create SketchLine -SketchLine_27 = Sketch_1.addLine(-584.4748858447489, -186.4535768645358, 66.97108066971103, -186.4535768645358) +SketchLine_27 = Sketch_1.addLine( + -584.4748858447489, -186.4535768645358, 66.97108066971103, -186.4535768645358 +) SketchLine_27.setAuxiliary(True) Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_27.startPoint()) Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_27.endPoint()) @@ -188,32 +242,60 @@ Sketch_1.setHorizontal(SketchLine_19.result()) model.do() ### Create Plane -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), model.selection("VERTEX", "Sketch_1/SketchLine_13_StartVertex")) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOY"), + model.selection("VERTEX", "Sketch_1/SketchLine_13_StartVertex"), +) ### Create Plane -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), model.selection("VERTEX", "Sketch_1/SketchLine_11_EndVertex")) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOY"), + model.selection("VERTEX", "Sketch_1/SketchLine_11_EndVertex"), +) ### Create Plane -Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), model.selection("VERTEX", "Sketch_1/SketchLine_11_StartVertex")) +Plane_6 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOY"), + model.selection("VERTEX", "Sketch_1/SketchLine_11_StartVertex"), +) ### Create Plane -Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), model.selection("VERTEX", "Sketch_1/SketchLine_10_StartVertex")) +Plane_7 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOY"), + model.selection("VERTEX", "Sketch_1/SketchLine_10_StartVertex"), +) ### Create Plane -Plane_8 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), model.selection("VERTEX", "Sketch_1/SketchLine_24_EndVertex")) +Plane_8 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOY"), + model.selection("VERTEX", "Sketch_1/SketchLine_24_EndVertex"), +) ### Create Plane -Plane_9 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), model.selection("VERTEX", "Sketch_1/SketchLine_7_EndVertex")) +Plane_9 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOY"), + model.selection("VERTEX", "Sketch_1/SketchLine_7_EndVertex"), +) ### Create Sketch Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "all-in-Plane_1")) ### Create SketchProjection -SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_13_StartVertex"), False) +SketchProjection_1 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_13_StartVertex"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() ### Create SketchProjection -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_19_EndVertex"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_19_EndVertex"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() ### Create SketchCircle @@ -222,11 +304,15 @@ Sketch_2.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) Sketch_2.setCoincident(SketchPoint_2.result(), SketchCircle_1.results()[1]) ### Create SketchProjection -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), False +) SketchPoint_3 = SketchProjection_3.createdFeature() ### Create SketchCircle -SketchCircle_2 = Sketch_2.addCircle(96.29157651318411, -4.925446150925168, 688.3944333858536) +SketchCircle_2 = Sketch_2.addCircle( + 96.29157651318411, -4.925446150925168, 688.3944333858536 +) Sketch_2.setCoincident(SketchPoint_3.result(), SketchCircle_2.results()[1]) model.do() @@ -234,11 +320,15 @@ model.do() Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "all-in-Plane_2")) ### Create SketchProjection -SketchProjection_4 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_11_EndVertex"), False) +SketchProjection_4 = Sketch_3.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_11_EndVertex"), False +) SketchPoint_4 = SketchProjection_4.createdFeature() ### Create SketchProjection -SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_20_EndVertex"), False) +SketchProjection_5 = Sketch_3.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_20_EndVertex"), False +) SketchPoint_5 = SketchProjection_5.createdFeature() ### Create SketchCircle @@ -247,12 +337,16 @@ Sketch_3.setCoincident(SketchPoint_4.result(), SketchCircle_3.center()) Sketch_3.setCoincident(SketchPoint_5.result(), SketchCircle_3.results()[1]) ### Create SketchProjection -SketchProjection_6 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False) +SketchProjection_6 = Sketch_3.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False +) SketchPoint_6 = SketchProjection_6.createdFeature() ### Create SketchCircle SketchCircle_4 = Sketch_3.addCircle(66.97108066971103, 0, 692.5418569254188) -Sketch_3.setCoincident(SketchAPI_Point(SketchPoint_4).coordinates(), SketchCircle_4.center()) +Sketch_3.setCoincident( + SketchAPI_Point(SketchPoint_4).coordinates(), SketchCircle_4.center() +) Sketch_3.setCoincident(SketchPoint_6.result(), SketchCircle_4.results()[1]) model.do() @@ -260,11 +354,15 @@ model.do() Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "all-in-Plane_3")) ### Create SketchProjection -SketchProjection_7 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_11_StartVertex"), False) +SketchProjection_7 = Sketch_4.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_11_StartVertex"), False +) SketchPoint_7 = SketchProjection_7.createdFeature() ### Create SketchProjection -SketchProjection_8 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_15_EndVertex"), False) +SketchProjection_8 = Sketch_4.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_15_EndVertex"), False +) SketchPoint_8 = SketchProjection_8.createdFeature() ### Create SketchCircle @@ -273,12 +371,16 @@ Sketch_4.setCoincident(SketchPoint_7.result(), SketchCircle_5.center()) Sketch_4.setCoincident(SketchPoint_8.result(), SketchCircle_5.results()[1]) ### Create SketchProjection -SketchProjection_9 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_21_StartVertex"), False) +SketchProjection_9 = Sketch_4.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_21_StartVertex"), False +) SketchPoint_9 = SketchProjection_9.createdFeature() ### Create SketchCircle SketchCircle_6 = Sketch_4.addCircle(63.92694063926946, 0, 703.1963470319636) -Sketch_4.setCoincident(SketchAPI_Point(SketchPoint_7).coordinates(), SketchCircle_6.center()) +Sketch_4.setCoincident( + SketchAPI_Point(SketchPoint_7).coordinates(), SketchCircle_6.center() +) Sketch_4.setCoincident(SketchPoint_9.result(), SketchCircle_6.results()[1]) model.do() @@ -286,11 +388,15 @@ model.do() Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "all-in-Plane_4")) ### Create SketchProjection -SketchProjection_10 = Sketch_5.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_10_StartVertex"), False) +SketchProjection_10 = Sketch_5.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_10_StartVertex"), False +) SketchPoint_10 = SketchProjection_10.createdFeature() ### Create SketchProjection -SketchProjection_11 = Sketch_5.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_22_EndVertex"), False) +SketchProjection_11 = Sketch_5.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_22_EndVertex"), False +) SketchPoint_11 = SketchProjection_11.createdFeature() ### Create SketchCircle @@ -299,12 +405,16 @@ Sketch_5.setCoincident(SketchPoint_10.result(), SketchCircle_7.center()) Sketch_5.setCoincident(SketchPoint_11.result(), SketchCircle_7.results()[1]) ### Create SketchProjection -SketchProjection_12 = Sketch_5.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_4_StartVertex"), False) +SketchProjection_12 = Sketch_5.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_4_StartVertex"), False +) SketchPoint_12 = SketchProjection_12.createdFeature() ### Create SketchCircle SketchCircle_8 = Sketch_5.addCircle(54.79452054794545, 0, 692.541856925419) -Sketch_5.setCoincident(SketchAPI_Point(SketchPoint_10).coordinates(), SketchCircle_8.center()) +Sketch_5.setCoincident( + SketchAPI_Point(SketchPoint_10).coordinates(), SketchCircle_8.center() +) Sketch_5.setCoincident(SketchPoint_12.result(), SketchCircle_8.results()[1]) model.do() @@ -312,11 +422,15 @@ model.do() Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "all-in-Plane_5")) ### Create SketchProjection -SketchProjection_13 = Sketch_6.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_24_EndVertex"), False) +SketchProjection_13 = Sketch_6.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_24_EndVertex"), False +) SketchPoint_13 = SketchProjection_13.createdFeature() ### Create SketchProjection -SketchProjection_14 = Sketch_6.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_18_StartVertex"), False) +SketchProjection_14 = Sketch_6.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_18_StartVertex"), False +) SketchPoint_14 = SketchProjection_14.createdFeature() ### Create SketchCircle @@ -325,12 +439,16 @@ Sketch_6.setCoincident(SketchPoint_13.result(), SketchCircle_9.center()) Sketch_6.setCoincident(SketchPoint_14.result(), SketchCircle_9.results()[1]) ### Create SketchProjection -SketchProjection_15 = Sketch_6.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_23_StartVertex"), False) +SketchProjection_15 = Sketch_6.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_23_StartVertex"), False +) SketchPoint_15 = SketchProjection_15.createdFeature() ### Create SketchCircle SketchCircle_10 = Sketch_6.addCircle(68.49315068493158, 0, 683.4094368340944) -Sketch_6.setCoincident(SketchAPI_Point(SketchPoint_13).coordinates(), SketchCircle_10.center()) +Sketch_6.setCoincident( + SketchAPI_Point(SketchPoint_13).coordinates(), SketchCircle_10.center() +) Sketch_6.setCoincident(SketchPoint_15.result(), SketchCircle_10.results()[1]) model.do() @@ -338,11 +456,15 @@ model.do() Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "all-in-Plane_6")) ### Create SketchProjection -SketchProjection_16 = Sketch_7.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_7_EndVertex"), False) +SketchProjection_16 = Sketch_7.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_7_EndVertex"), False +) SketchPoint_16 = SketchProjection_16.createdFeature() ### Create SketchProjection -SketchProjection_17 = Sketch_7.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_18_EndVertex"), False) +SketchProjection_17 = Sketch_7.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_18_EndVertex"), False +) SketchPoint_17 = SketchProjection_17.createdFeature() ### Create SketchCircle @@ -351,48 +473,64 @@ Sketch_7.setCoincident(SketchPoint_16.result(), SketchCircle_11.center()) Sketch_7.setCoincident(SketchPoint_17.result(), SketchCircle_11.results()[1]) ### Create SketchProjection -SketchProjection_18 = Sketch_7.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_6_StartVertex"), False) +SketchProjection_18 = Sketch_7.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_6_StartVertex"), False +) SketchPoint_18 = SketchProjection_18.createdFeature() ### Create SketchCircle SketchCircle_12 = Sketch_7.addCircle(80.66971080669715, 0, 654.490106544901) -Sketch_7.setCoincident(SketchAPI_Point(SketchPoint_16).coordinates(), SketchCircle_12.center()) +Sketch_7.setCoincident( + SketchAPI_Point(SketchPoint_16).coordinates(), SketchCircle_12.center() +) Sketch_7.setCoincident(SketchPoint_18.result(), SketchCircle_12.results()[1]) model.do() ### Create Wire -Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_8"), - model.selection("EDGE", "Sketch_1/SketchLine_9"), - model.selection("EDGE", "Sketch_1/SketchLine_10"), - model.selection("EDGE", "Sketch_1/SketchLine_11"), - model.selection("EDGE", "Sketch_1/SketchLine_12")] +Wire_1_objects = [ + model.selection("EDGE", "Sketch_1/SketchLine_8"), + model.selection("EDGE", "Sketch_1/SketchLine_9"), + model.selection("EDGE", "Sketch_1/SketchLine_10"), + model.selection("EDGE", "Sketch_1/SketchLine_11"), + model.selection("EDGE", "Sketch_1/SketchLine_12"), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) ### Create Pipe -Pipe_1_objects_1 = [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f"), - model.selection("FACE", "Sketch_3/Face-SketchCircle_3_2f"), - model.selection("FACE", "Sketch_4/Face-SketchCircle_5_2f"), - model.selection("FACE", "Sketch_5/Face-SketchCircle_7_2f"), - model.selection("FACE", "Sketch_6/Face-SketchCircle_9_2f"), - model.selection("FACE", "Sketch_7/Face-SketchCircle_11_2f")] -Pipe_1 = model.addPipe(Part_1_doc, Pipe_1_objects_1, model.selection("WIRE", "Wire_1_1"), []) +Pipe_1_objects_1 = [ + model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f"), + model.selection("FACE", "Sketch_3/Face-SketchCircle_3_2f"), + model.selection("FACE", "Sketch_4/Face-SketchCircle_5_2f"), + model.selection("FACE", "Sketch_5/Face-SketchCircle_7_2f"), + model.selection("FACE", "Sketch_6/Face-SketchCircle_9_2f"), + model.selection("FACE", "Sketch_7/Face-SketchCircle_11_2f"), +] +Pipe_1 = model.addPipe( + Part_1_doc, Pipe_1_objects_1, model.selection("WIRE", "Wire_1_1"), [] +) ### Create Wire -Wire_2_objects = [model.selection("EDGE", "Sketch_1/SketchLine_8"), - model.selection("EDGE", "Sketch_1/SketchLine_9"), - model.selection("EDGE", "Sketch_1/SketchLine_10"), - model.selection("EDGE", "Sketch_1/SketchLine_11"), - model.selection("EDGE", "Sketch_1/SketchLine_12")] +Wire_2_objects = [ + model.selection("EDGE", "Sketch_1/SketchLine_8"), + model.selection("EDGE", "Sketch_1/SketchLine_9"), + model.selection("EDGE", "Sketch_1/SketchLine_10"), + model.selection("EDGE", "Sketch_1/SketchLine_11"), + model.selection("EDGE", "Sketch_1/SketchLine_12"), +] Wire_2 = model.addWire(Part_1_doc, Wire_2_objects) ### Create Pipe -Pipe_2_objects_1 = [model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), - model.selection("EDGE", "Sketch_3/SketchCircle_4_2"), - model.selection("EDGE", "Sketch_4/SketchCircle_6_2"), - model.selection("EDGE", "Sketch_5/SketchCircle_8_2"), - model.selection("EDGE", "Sketch_6/SketchCircle_10_2"), - model.selection("EDGE", "Sketch_7/SketchCircle_12_2")] -Pipe_2 = model.addPipe(Part_1_doc, Pipe_2_objects_1, model.selection("WIRE", "Wire_2_1"), []) +Pipe_2_objects_1 = [ + model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), + model.selection("EDGE", "Sketch_3/SketchCircle_4_2"), + model.selection("EDGE", "Sketch_4/SketchCircle_6_2"), + model.selection("EDGE", "Sketch_5/SketchCircle_8_2"), + model.selection("EDGE", "Sketch_6/SketchCircle_10_2"), + model.selection("EDGE", "Sketch_7/SketchCircle_12_2"), +] +Pipe_2 = model.addPipe( + Part_1_doc, Pipe_2_objects_1, model.selection("WIRE", "Wire_2_1"), [] +) model.end() diff --git a/src/FeaturesPlugin/Test/TestPipe_Edge.py b/src/FeaturesPlugin/Test/TestPipe_Edge.py index 2e36d288d..67bddf76b 100644 --- a/src/FeaturesPlugin/Test/TestPipe_Edge.py +++ b/src/FeaturesPlugin/Test/TestPipe_Edge.py @@ -24,13 +24,32 @@ 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) +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")) +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")) +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() diff --git a/src/FeaturesPlugin/Test/TestPipe_ErrorMsg.py b/src/FeaturesPlugin/Test/TestPipe_ErrorMsg.py index ee2d8834f..9909b3baf 100644 --- a/src/FeaturesPlugin/Test/TestPipe_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestPipe_ErrorMsg.py @@ -56,27 +56,27 @@ aSession.startOperation() aPipeFeature = aPart.addFeature("Pipe") aPipeFeature.string("creation_method").setValue("WrongCreationMethod") aPipeFeature.execute() -assert(aPipeFeature.error() != "") +assert aPipeFeature.error() != "" aSession.finishOperation() aSession.startOperation() aBaseObjectsList = aPipeFeature.selectionList("base_objects") aBaseObjectsList.append(aSketchResult, None) aPipeFeature.execute() -assert(aPipeFeature.error() != "") +assert aPipeFeature.error() != "" aSession.finishOperation() aSession.startOperation() aPathObjectSelection = aPipeFeature.selection("path_object") aPathObjectSelection.selectSubShape("EDGE", "PartSet/OZ") aPipeFeature.execute() -assert(aPipeFeature.error() != "") +assert aPipeFeature.error() != "" aSession.finishOperation() aSession.startOperation() aPipeFeature.string("creation_method").setValue("binormal") aPipeFeature.execute() -assert(aPipeFeature.error() != "") +assert aPipeFeature.error() != "" aSession.finishOperation() aSession.startOperation() @@ -84,5 +84,5 @@ aPipeFeature.string("creation_method").setValue("locations") aBaseObjectsList = aPipeFeature.selectionList("locations_objects") aBaseObjectsList.append(None, None) aPipeFeature.execute() -assert(aPipeFeature.error() != "") +assert aPipeFeature.error() != "" aSession.finishOperation() diff --git a/src/FeaturesPlugin/Test/TestPipe_Wire.py b/src/FeaturesPlugin/Test/TestPipe_Wire.py index 540d4bb3a..3fc6aa4cd 100644 --- a/src/FeaturesPlugin/Test/TestPipe_Wire.py +++ b/src/FeaturesPlugin/Test/TestPipe_Wire.py @@ -28,10 +28,18 @@ 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()) +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()) @@ -39,13 +47,35 @@ 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()) +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")] +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"), []) +Pipe_2 = model.addPipe( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + model.selection("EDGE", "PartSet/OZ"), + [], +) model.do() model.end() diff --git a/src/FeaturesPlugin/Test/TestPlacement_BodyShapesValidator.py b/src/FeaturesPlugin/Test/TestPlacement_BodyShapesValidator.py index e395e2041..2b7eee105 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_BodyShapesValidator.py +++ b/src/FeaturesPlugin/Test/TestPlacement_BodyShapesValidator.py @@ -30,8 +30,15 @@ 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() != "") +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_Complex.py b/src/FeaturesPlugin/Test/TestPlacement_Complex.py index 80cf84281..3b07ca85a 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_Complex.py +++ b/src/FeaturesPlugin/Test/TestPlacement_Complex.py @@ -28,32 +28,98 @@ SketchLine_1 = Sketch_1.addLine(2, -40, -30, -40) SketchLine_2 = Sketch_1.addLine(-30, -40, -30, -5) SketchLine_3 = Sketch_1.addLine(-30, -5, 2, -5) SketchLine_4 = Sketch_1.addLine(2, -5, 2, -40) -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()) +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(40, -25, 2, -25) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_4.result()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_4.result() +) SketchLine_6 = Sketch_1.addLine(2, -25, 2, 20) SketchLine_7 = Sketch_1.addLine(2, 20, 40, 20) SketchLine_8 = Sketch_1.addLine(40, 20, 40, -25) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_9 = 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()) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 10, 0) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4f-SketchLine_5r-SketchLine_8r-SketchLine_7r-SketchLine_6r")], model.selection(), 10, 0) -Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4&weak_name_1][Extrusion_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_2_1/To_Face]"), False, False) -Placement_2 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Placement_1_1")], model.selection("VERTEX", "[Placement_1_1/MF:Placed&Sketch_1/SketchLine_4&weak_name_1][Placement_1_1/MF:Placed&Sketch_1/SketchLine_1][Placement_1_1/MF:Placed&Extrusion_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_2_1/To_Face]"), False, True) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 10, + 0, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4f-SketchLine_5r-SketchLine_8r-SketchLine_7r-SketchLine_6r", + ) + ], + model.selection(), + 10, + 0, +) +Placement_1 = model.addPlacement( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4&weak_name_1][Extrusion_1_1/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_2_1/To_Face]", + ), + False, + False, +) +Placement_2 = model.addPlacement( + Part_1_doc, + [model.selection("SOLID", "Placement_1_1")], + model.selection( + "VERTEX", + "[Placement_1_1/MF:Placed&Sketch_1/SketchLine_4&weak_name_1][Placement_1_1/MF:Placed&Sketch_1/SketchLine_1][Placement_1_1/MF:Placed&Extrusion_1_1/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_2_1/To_Face]", + ), + False, + True, +) model.do() model.end() @@ -61,7 +127,7 @@ from GeomAPI import * # check middle point of the placed solid shape = Placement_2.results()[0].resultSubShapePair()[0].shape() -assert(shape.middlePoint().distance(GeomAPI_Pnt(-14, 25, 5)) < 1e-7) +assert shape.middlePoint().distance(GeomAPI_Pnt(-14, 25, 5)) < 1e-7 # check properties of the result model.testNbResults(Placement_2, 1) diff --git a/src/FeaturesPlugin/Test/TestPlacement_Edge_Edge.py b/src/FeaturesPlugin/Test/TestPlacement_Edge_Edge.py index fba0f49e5..f7217a64b 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_Edge_Edge.py +++ b/src/FeaturesPlugin/Test/TestPlacement_Edge_Edge.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -34,13 +34,13 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +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")) @@ -91,48 +91,57 @@ aLineD2StartPoint.setValue(100, 50) aLineD2EndPoint.setValue(100, 0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion -#========================================================================= +# ========================================================================= aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult()) -assert (aSketchResult.facesNum() > 1) +assert aSketchResult.facesNum() > 1 aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "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.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) +assert anExtrusionFt.real("to_size").value() == 50.0 # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult is not None) +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.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) +assert len(aPlacementFt.results()) > 0 aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult()) -assert (aPlacementResult is not None) +assert aPlacementResult is not None from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPlacement_Edge_Vertex.py b/src/FeaturesPlugin/Test/TestPlacement_Edge_Vertex.py index ddc9dff32..2fafbfa2b 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_Edge_Vertex.py +++ b/src/FeaturesPlugin/Test/TestPlacement_Edge_Vertex.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -34,13 +34,13 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +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")) @@ -91,48 +91,57 @@ aLineD2StartPoint.setValue(100, 50) aLineD2EndPoint.setValue(100, 0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion -#========================================================================= +# ========================================================================= aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult()) -assert (aSketchResult.facesNum() > 1) +assert aSketchResult.facesNum() > 1 aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "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.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) +assert anExtrusionFt.real("to_size").value() == 50.0 # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult is not None) +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.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) +assert len(aPlacementFt.results()) > 0 aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult()) -assert (aPlacementResult is not None) +assert aPlacementResult is not None from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPlacement_ErrorMsg.py b/src/FeaturesPlugin/Test/TestPlacement_ErrorMsg.py index d7fe6dcc6..17fc9310d 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestPlacement_ErrorMsg.py @@ -24,14 +24,21 @@ 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) +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) +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] @@ -41,47 +48,71 @@ aSession.startOperation() aPlacementFt = featureToCompositeFeature(Part_1.feature()).addFeature("Placement") aPlacementFt.execute() aSession.finishOperation() -assert(aPlacementFt.error() != "") +assert aPlacementFt.error() != "" aSession.startOperation() -aPlacementFt.selectionList("placement_objects_list").append(aShapeToMove, aShapeToMove.shape()) +aPlacementFt.selectionList("placement_objects_list").append( + aShapeToMove, aShapeToMove.shape() +) aPlacementFt.execute() aSession.finishOperation() -assert(aPlacementFt.error() != "") +assert aPlacementFt.error() != "" aSession.startOperation() -aPlacementFt.selection("placement_start_shape").selectSubShape("FACE", "Extrusion_1_2/To_Face") +aPlacementFt.selection("placement_start_shape").selectSubShape( + "FACE", "Extrusion_1_2/To_Face" +) aPlacementFt.execute() aSession.finishOperation() -assert(aPlacementFt.error() != "") +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.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() != "") +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.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() != "") +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.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() == "") +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() != "") +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 index 08678a8fe..70dfc2bfd 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_Face_Edge.py +++ b/src/FeaturesPlugin/Test/TestPlacement_Face_Edge.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -34,13 +34,13 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +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")) @@ -91,48 +91,56 @@ aLineD2StartPoint.setValue(100, 50) aLineD2EndPoint.setValue(100, 0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion -#========================================================================= +# ========================================================================= aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult()) -assert (aSketchResult.facesNum() > 1) +assert aSketchResult.facesNum() > 1 aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "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.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) +assert anExtrusionFt.real("to_size").value() == 50.0 # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult is not None) +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.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) +assert len(aPlacementFt.results()) > 0 aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult()) -assert (aPlacementResult is not None) +assert aPlacementResult is not None from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPlacement_Face_Face.py b/src/FeaturesPlugin/Test/TestPlacement_Face_Face.py index 988aebcb4..a32eede69 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_Face_Face.py +++ b/src/FeaturesPlugin/Test/TestPlacement_Face_Face.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -34,13 +34,13 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +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")) @@ -91,48 +91,55 @@ aLineD2StartPoint.setValue(100, 50) aLineD2EndPoint.setValue(100, 0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion -#========================================================================= +# ========================================================================= aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult()) -assert (aSketchResult.facesNum() > 1) +assert aSketchResult.facesNum() > 1 aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "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.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) +assert anExtrusionFt.real("to_size").value() == 50.0 # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult is not None) +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.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) +assert len(aPlacementFt.results()) > 0 aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult()) -assert (aPlacementResult is not None) +assert aPlacementResult is not None from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPlacement_Face_Vertex.py b/src/FeaturesPlugin/Test/TestPlacement_Face_Vertex.py index 07d51e10f..f5ec83511 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_Face_Vertex.py +++ b/src/FeaturesPlugin/Test/TestPlacement_Face_Vertex.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -34,13 +34,13 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +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")) @@ -91,48 +91,56 @@ aLineD2StartPoint.setValue(100, 50) aLineD2EndPoint.setValue(100, 0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion -#========================================================================= +# ========================================================================= aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult()) -assert (aSketchResult.facesNum() > 1) +assert aSketchResult.facesNum() > 1 aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "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.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) +assert anExtrusionFt.real("to_size").value() == 50.0 # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult is not None) +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.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) +assert len(aPlacementFt.results()) > 0 aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult()) -assert (aPlacementResult is not None) +assert aPlacementResult is not None from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_1.py b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_1.py index 6fd4bbfed..a37579486 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_1.py +++ b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_1.py @@ -25,43 +25,144 @@ 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) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 20, + 2, +) Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) -Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "LinearCopy_2_1_1_1")], model.selection("FACE", "LinearCopy_2_1_1_1/MF:Translated&Cylinder_1_1/Face_2"), model.selection("FACE", "Compound_2_1_2_1/Modified_Face&Extrusion_1_2/To_Face"), False, True) +Placement_1 = model.addPlacement( + Part_1_doc, + [model.selection("SOLID", "LinearCopy_2_1_1_1")], + model.selection("FACE", "LinearCopy_2_1_1_1/MF:Translated&Cylinder_1_1/Face_2"), + model.selection("FACE", "Compound_2_1_2_1/Modified_Face&Extrusion_1_2/To_Face"), + False, + True, +) model.end() @@ -75,9 +176,9 @@ model.testNbSubShapes(Placement_1, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Placement_1, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Placement_1, [785.39816339745]) -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 REFERENCE = GeomAPI_Pnt(41.18033988749897, -50, 15) midPoint = Placement_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE) < TOLERANCE) +assert midPoint.distance(REFERENCE) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_2.py b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_2.py index d37b553c9..5460b0e78 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_2.py +++ b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_2.py @@ -25,43 +25,144 @@ 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) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 20, + 2, +) Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) -Placement_1 = model.addPlacement(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_2_1_1")], model.selection("FACE", "LinearCopy_2_1_1_1/MF:Translated&Cylinder_1_1/Face_2"), model.selection("FACE", "Compound_2_1_2_1/Modified_Face&Extrusion_1_2/To_Face"), False, True) +Placement_1 = model.addPlacement( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_2_1_1")], + model.selection("FACE", "LinearCopy_2_1_1_1/MF:Translated&Cylinder_1_1/Face_2"), + model.selection("FACE", "Compound_2_1_2_1/Modified_Face&Extrusion_1_2/To_Face"), + False, + True, +) model.end() @@ -75,9 +176,9 @@ model.testNbSubShapes(Placement_1, GeomAPI_Shape.EDGE, [12]) model.testNbSubShapes(Placement_1, GeomAPI_Shape.VERTEX, [24]) model.testResultsVolumes(Placement_1, [1570.7963267949]) -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 REFERENCE = GeomAPI_Pnt(31.18033988749897, -50, 15) midPoint = Placement_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE) < TOLERANCE) +assert midPoint.distance(REFERENCE) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_3.py b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_3.py index 026f412ce..c1e1011ad 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_3.py +++ b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_3.py @@ -25,43 +25,147 @@ 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) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 20, + 2, +) Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) -Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5"), model.selection("SOLID", "Compound_2_1_2_1")], model.selection("FACE", "Compound_2_1_2_1/Modified_Face&Extrusion_1_2/From_Face"), model.selection("FACE", "LinearCopy_2_1_1_1/MF:Translated&Cylinder_1_1/Face_2"), False, False) +Placement_1 = model.addPlacement( + Part_1_doc, + [ + model.selection("SOLID", "Compound_2_1_1_5"), + model.selection("SOLID", "Compound_2_1_2_1"), + ], + model.selection("FACE", "Compound_2_1_2_1/Modified_Face&Extrusion_1_2/From_Face"), + model.selection("FACE", "LinearCopy_2_1_1_1/MF:Translated&Cylinder_1_1/Face_2"), + False, + False, +) model.end() @@ -75,10 +179,10 @@ model.testNbSubShapes(Placement_1, GeomAPI_Shape.EDGE, [18, 6]) model.testNbSubShapes(Placement_1, GeomAPI_Shape.VERTEX, [36, 12]) model.testResultsVolumes(Placement_1, [542.746463956, 785.39816339745]) -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 REFERENCE = [GeomAPI_Pnt(0, -50, 15), GeomAPI_Pnt(41.18033988749897, -50, 15)] for res, ref in zip(Placement_1.results(), REFERENCE): midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE) + assert midPoint.distance(ref) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_4.py b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_4.py index 4ffe9a2ed..4ae61adb1 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_4.py +++ b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_4.py @@ -25,43 +25,147 @@ 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) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 20, + 2, +) Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) -Placement_1 = model.addPlacement(Part_1_doc, [model.selection("COMPSOLID", "Compound_2_1_1"), model.selection("SOLID", "Compound_2_1_3")], model.selection("FACE", "Compound_2_1_2_1/Modified_Face&Extrusion_1_2/From_Face"), model.selection("FACE", "LinearCopy_2_1_1_1/MF:Translated&Cylinder_1_1/Face_2"), False, False) +Placement_1 = model.addPlacement( + Part_1_doc, + [ + model.selection("COMPSOLID", "Compound_2_1_1"), + model.selection("SOLID", "Compound_2_1_3"), + ], + model.selection("FACE", "Compound_2_1_2_1/Modified_Face&Extrusion_1_2/From_Face"), + model.selection("FACE", "LinearCopy_2_1_1_1/MF:Translated&Cylinder_1_1/Face_2"), + False, + False, +) model.end() @@ -75,10 +179,13 @@ model.testNbSubShapes(Placement_1, GeomAPI_Shape.EDGE, [144, 6]) model.testNbSubShapes(Placement_1, GeomAPI_Shape.VERTEX, [288, 12]) model.testResultsVolumes(Placement_1, [11963.80153655, 785.39816339745]) -TOLERANCE = 1.e-7 -REFERENCE = [GeomAPI_Pnt(4.5668653531, -50, 15), GeomAPI_Pnt(-20.59016994374951, -85.663220479, 15)] +TOLERANCE = 1.0e-7 +REFERENCE = [ + GeomAPI_Pnt(4.5668653531, -50, 15), + GeomAPI_Pnt(-20.59016994374951, -85.663220479, 15), +] for res, ref in zip(Placement_1.results(), REFERENCE): midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE) + assert midPoint.distance(ref) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_5.py b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_5.py index 80393ef82..1abeda39b 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_5.py +++ b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_5.py @@ -26,59 +26,176 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() Z_SHIFT = 10 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 model.begin() -Placement_1 = model.addPlacement(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), False, False) +Placement_1 = model.addPlacement( + Part_1_doc, + [model.selection("VERTEX", "Vertex_1_1")], + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), + False, + False, +) model.testNbResults(Placement_1, 1) model.testNbSubResults(Placement_1, [0]) model.testNbSubShapes(Placement_1, GeomAPI_Shape.SOLID, [0]) @@ -90,9 +207,16 @@ model.testResultsAreas(Placement_1, [0]) refPoint = Vertex_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + Z_SHIFT) midPoint = Placement_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Placement_2 = model.addPlacement(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), False, False) +Placement_2 = model.addPlacement( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), + False, + False, +) model.testNbResults(Placement_2, 1) model.testNbSubResults(Placement_2, [0]) model.testNbSubShapes(Placement_2, GeomAPI_Shape.SOLID, [0]) @@ -104,9 +228,16 @@ model.testResultsAreas(Placement_2, [0]) refPoint = Edge_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + Z_SHIFT) midPoint = Placement_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Placement_3 = model.addPlacement(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), False, False) +Placement_3 = model.addPlacement( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), + False, + False, +) model.testNbResults(Placement_3, 1) model.testNbSubResults(Placement_3, [0]) model.testNbSubShapes(Placement_3, GeomAPI_Shape.SOLID, [0]) @@ -118,9 +249,16 @@ model.testResultsAreas(Placement_3, [0]) refPoint = Wire_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + Z_SHIFT) midPoint = Placement_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Placement_4 = model.addPlacement(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), False, False) +Placement_4 = model.addPlacement( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), + False, + False, +) model.testNbResults(Placement_4, 1) model.testNbSubResults(Placement_4, [0]) model.testNbSubShapes(Placement_4, GeomAPI_Shape.SOLID, [0]) @@ -132,9 +270,16 @@ model.testResultsAreas(Placement_4, [109.154152964914914]) refPoint = Face_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + Z_SHIFT) midPoint = Placement_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Placement_5 = model.addPlacement(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), False, False) +Placement_5 = model.addPlacement( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), + False, + False, +) model.testNbResults(Placement_5, 1) model.testNbSubResults(Placement_5, [0]) model.testNbSubShapes(Placement_5, GeomAPI_Shape.SOLID, [0]) @@ -146,9 +291,16 @@ model.testResultsAreas(Placement_5, [182.822012116]) refPoint = Shell_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + Z_SHIFT) midPoint = Placement_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Placement_6 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), False, False) +Placement_6 = model.addPlacement( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), + False, + False, +) model.testNbResults(Placement_6, 1) model.testNbSubResults(Placement_6, [0]) model.testNbSubShapes(Placement_6, GeomAPI_Shape.SOLID, [1]) @@ -159,9 +311,16 @@ model.testResultsVolumes(Placement_6, [1000]) refPoint = Translation_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + Z_SHIFT) midPoint = Placement_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Placement_7 = model.addPlacement(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("FACE", "AngularCopy_1_1_1/MF:Rotated&Box_3_1/Bottom"), model.selection("FACE", "AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top"), False, False) +Placement_7 = model.addPlacement( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + model.selection("FACE", "AngularCopy_1_1_1/MF:Rotated&Box_3_1/Bottom"), + model.selection("FACE", "AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top"), + False, + False, +) model.testNbResults(Placement_7, 1) model.testNbSubResults(Placement_7, [3]) model.testNbSubShapes(Placement_7, GeomAPI_Shape.SOLID, [3]) @@ -172,9 +331,16 @@ model.testResultsVolumes(Placement_7, [1589.0486226]) refPoint = Partition_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + Z_SHIFT) midPoint = Placement_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Placement_8 = model.addPlacement(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")],model.selection("FACE", "AngularCopy_1_1_1/MF:Rotated&Box_3_1/Bottom"), model.selection("FACE", "AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top"), False, False) +Placement_8 = model.addPlacement( + Part_1_doc, + [model.selection("COMPOUND", "AngularCopy_1_1")], + model.selection("FACE", "AngularCopy_1_1_1/MF:Rotated&Box_3_1/Bottom"), + model.selection("FACE", "AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top"), + False, + False, +) model.testNbResults(Placement_8, 1) model.testNbSubResults(Placement_8, [3]) model.testNbSubShapes(Placement_8, GeomAPI_Shape.SOLID, [3]) @@ -185,8 +351,8 @@ model.testResultsVolumes(Placement_8, [3000]) refPoint = AngularCopy_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + Z_SHIFT) midPoint = Placement_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_6.py b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_6.py index 5b4d4d5ae..99372f6e8 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_6.py +++ b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v0_6.py @@ -26,60 +26,179 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() # collect reference data Z_SHIFT = 10 REFERENCE = [] -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 for ind in range(0, Compound_1.result().numberOfSubs()): p = Compound_1.result().subResult(ind).resultSubShapePair()[1].middlePoint() p.setZ(p.z() + Z_SHIFT) @@ -88,7 +207,14 @@ for ind in range(0, Compound_1.result().numberOfSubs()): index = 0 model.begin() -Placement_1 = model.addPlacement(Part_1_doc, [model.selection("VERTEX", "Compound_1_1_1")], model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Top"), False, False) +Placement_1 = model.addPlacement( + Part_1_doc, + [model.selection("VERTEX", "Compound_1_1_1")], + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Bottom"), + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Top"), + False, + False, +) model.testNbResults(Placement_1, 1) model.testNbSubResults(Placement_1, [0]) model.testNbSubShapes(Placement_1, GeomAPI_Shape.SOLID, [0]) @@ -98,11 +224,18 @@ model.testNbSubShapes(Placement_1, GeomAPI_Shape.VERTEX, [1]) model.testResultsVolumes(Placement_1, [0]) model.testResultsAreas(Placement_1, [0]) midPoint = Placement_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_1 = model.addRecover(Part_1_doc, Placement_1, [Compound_1.result()], True) -Placement_2 = model.addPlacement(Part_1_doc, [model.selection("EDGE", "Recover_1_1_2")], model.selection("FACE", "Recover_1_1_6/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Recover_1_1_6/Modified_Face&Box_1_1/Top"), False, False) +Placement_2 = model.addPlacement( + Part_1_doc, + [model.selection("EDGE", "Recover_1_1_2")], + model.selection("FACE", "Recover_1_1_6/Modified_Face&Box_1_1/Bottom"), + model.selection("FACE", "Recover_1_1_6/Modified_Face&Box_1_1/Top"), + False, + False, +) model.testNbResults(Placement_2, 1) model.testNbSubResults(Placement_2, [0]) model.testNbSubShapes(Placement_2, GeomAPI_Shape.SOLID, [0]) @@ -112,11 +245,18 @@ model.testNbSubShapes(Placement_2, GeomAPI_Shape.VERTEX, [2]) model.testResultsVolumes(Placement_2, [0]) model.testResultsAreas(Placement_2, [0]) midPoint = Placement_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_2 = model.addRecover(Part_1_doc, Placement_2, [Recover_1.result()]) -Placement_3 = model.addPlacement(Part_1_doc, [model.selection("WIRE", "Recover_2_1_3")], model.selection("FACE", "Recover_2_1_6/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Recover_2_1_6/Modified_Face&Box_1_1/Top"), False, False) +Placement_3 = model.addPlacement( + Part_1_doc, + [model.selection("WIRE", "Recover_2_1_3")], + model.selection("FACE", "Recover_2_1_6/Modified_Face&Box_1_1/Bottom"), + model.selection("FACE", "Recover_2_1_6/Modified_Face&Box_1_1/Top"), + False, + False, +) model.testNbResults(Placement_3, 1) model.testNbSubResults(Placement_3, [0]) model.testNbSubShapes(Placement_3, GeomAPI_Shape.SOLID, [0]) @@ -126,11 +266,18 @@ model.testNbSubShapes(Placement_3, GeomAPI_Shape.VERTEX, [4]) model.testResultsVolumes(Placement_3, [0]) model.testResultsAreas(Placement_3, [0]) midPoint = Placement_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_3 = model.addRecover(Part_1_doc, Placement_3, [Recover_2.result()]) -Placement_4 = model.addPlacement(Part_1_doc, [model.selection("FACE", "Recover_3_1_4")], model.selection("FACE", "Recover_3_1_6/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Recover_3_1_6/Modified_Face&Box_1_1/Top"), False, False) +Placement_4 = model.addPlacement( + Part_1_doc, + [model.selection("FACE", "Recover_3_1_4")], + model.selection("FACE", "Recover_3_1_6/Modified_Face&Box_1_1/Bottom"), + model.selection("FACE", "Recover_3_1_6/Modified_Face&Box_1_1/Top"), + False, + False, +) model.testNbResults(Placement_4, 1) model.testNbSubResults(Placement_4, [0]) model.testNbSubShapes(Placement_4, GeomAPI_Shape.SOLID, [0]) @@ -140,11 +287,18 @@ model.testNbSubShapes(Placement_4, GeomAPI_Shape.VERTEX, [8]) model.testResultsVolumes(Placement_4, [0]) model.testResultsAreas(Placement_4, [109.154152964914914]) midPoint = Placement_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_4 = model.addRecover(Part_1_doc, Placement_4, [Recover_3.result()]) -Placement_5 = model.addPlacement(Part_1_doc, [model.selection("SHELL", "Recover_4_1_5")], model.selection("FACE", "Recover_4_1_6/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Recover_4_1_6/Modified_Face&Box_1_1/Top"), False, False) +Placement_5 = model.addPlacement( + Part_1_doc, + [model.selection("SHELL", "Recover_4_1_5")], + model.selection("FACE", "Recover_4_1_6/Modified_Face&Box_1_1/Bottom"), + model.selection("FACE", "Recover_4_1_6/Modified_Face&Box_1_1/Top"), + False, + False, +) model.testNbResults(Placement_5, 1) model.testNbSubResults(Placement_5, [0]) model.testNbSubShapes(Placement_5, GeomAPI_Shape.SOLID, [0]) @@ -154,11 +308,18 @@ model.testNbSubShapes(Placement_5, GeomAPI_Shape.VERTEX, [16]) model.testResultsVolumes(Placement_5, [0]) model.testResultsAreas(Placement_5, [182.822012116]) midPoint = Placement_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_5 = model.addRecover(Part_1_doc, Placement_5, [Recover_4.result()]) -Placement_6 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Recover_5_1_6")], model.selection("FACE", "Recover_5_1_6/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Recover_5_1_6/Modified_Face&Box_1_1/Top"), False, False) +Placement_6 = model.addPlacement( + Part_1_doc, + [model.selection("SOLID", "Recover_5_1_6")], + model.selection("FACE", "Recover_5_1_6/Modified_Face&Box_1_1/Bottom"), + model.selection("FACE", "Recover_5_1_6/Modified_Face&Box_1_1/Top"), + False, + False, +) model.testNbResults(Placement_6, 1) model.testNbSubResults(Placement_6, [0]) model.testNbSubShapes(Placement_6, GeomAPI_Shape.SOLID, [1]) @@ -167,11 +328,18 @@ model.testNbSubShapes(Placement_6, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(Placement_6, GeomAPI_Shape.VERTEX, [48]) model.testResultsVolumes(Placement_6, [1000]) midPoint = Placement_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_6 = model.addRecover(Part_1_doc, Placement_6, [Recover_5.result()]) -Placement_7 = model.addPlacement(Part_1_doc, [model.selection("COMPSOLID", "Recover_6_1_7")], model.selection("FACE", "Recover_6_1_6/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Recover_6_1_6/Modified_Face&Box_1_1/Top"), False, False) +Placement_7 = model.addPlacement( + Part_1_doc, + [model.selection("COMPSOLID", "Recover_6_1_7")], + model.selection("FACE", "Recover_6_1_6/Modified_Face&Box_1_1/Bottom"), + model.selection("FACE", "Recover_6_1_6/Modified_Face&Box_1_1/Top"), + False, + False, +) model.testNbResults(Placement_7, 1) model.testNbSubResults(Placement_7, [3]) model.testNbSubShapes(Placement_7, GeomAPI_Shape.SOLID, [3]) @@ -180,11 +348,18 @@ model.testNbSubShapes(Placement_7, GeomAPI_Shape.EDGE, [66]) model.testNbSubShapes(Placement_7, GeomAPI_Shape.VERTEX, [132]) model.testResultsVolumes(Placement_7, [1589.0486226]) midPoint = Placement_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_7 = model.addRecover(Part_1_doc, Placement_7, [Recover_6.result()]) -Placement_8 = model.addPlacement(Part_1_doc, [model.selection("COMPOUND", "Recover_7_1_8")], model.selection("FACE", "Recover_7_1_6/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Recover_7_1_6/Modified_Face&Box_1_1/Top"), False, False) +Placement_8 = model.addPlacement( + Part_1_doc, + [model.selection("COMPOUND", "Recover_7_1_8")], + model.selection("FACE", "Recover_7_1_6/Modified_Face&Box_1_1/Bottom"), + model.selection("FACE", "Recover_7_1_6/Modified_Face&Box_1_1/Top"), + False, + False, +) model.testNbResults(Placement_8, 1) model.testNbSubResults(Placement_8, [3]) model.testNbSubShapes(Placement_8, GeomAPI_Shape.SOLID, [3]) @@ -193,8 +368,8 @@ model.testNbSubShapes(Placement_8, GeomAPI_Shape.EDGE, [72]) model.testNbSubShapes(Placement_8, GeomAPI_Shape.VERTEX, [144]) model.testResultsVolumes(Placement_8, [3000]) midPoint = Placement_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_1.py b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_1.py index bcf25de60..3de58d2f1 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_1.py +++ b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_1.py @@ -25,43 +25,144 @@ 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) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 20, + 2, +) Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) -Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "LinearCopy_2_1_1_1")], model.selection("FACE", "LinearCopy_2_1_1_1/MF:Translated&Cylinder_1_1/Face_2"), model.selection("FACE", "Compound_2_1_2_1/Modified_Face&Extrusion_1_2/To_Face"), centering = True, keepSubResults = True) +Placement_1 = model.addPlacement( + Part_1_doc, + [model.selection("SOLID", "LinearCopy_2_1_1_1")], + model.selection("FACE", "LinearCopy_2_1_1_1/MF:Translated&Cylinder_1_1/Face_2"), + model.selection("FACE", "Compound_2_1_2_1/Modified_Face&Extrusion_1_2/To_Face"), + centering=True, + keepSubResults=True, +) model.end() @@ -75,14 +176,20 @@ model.testNbSubShapes(Placement_1, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(Placement_1, GeomAPI_Shape.VERTEX, [48]) model.testResultsVolumes(Placement_1, [3141.592653589793]) -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 REF_C = GeomAPI_Pnt(20.590169943749483, -15, 10) midPoint = Placement_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(REF_C) < TOLERANCE) +assert midPoint.distance(REF_C) < TOLERANCE REF_SUB = [GeomAPI_Pnt(30.590169943749483, -25, 10), GeomAPI_Pnt(10, 20, 5)] for ind in range(0, len(REF_SUB)): - midPoint = Placement_1.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(REF_SUB[ind]) < TOLERANCE) + midPoint = ( + Placement_1.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert midPoint.distance(REF_SUB[ind]) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_2.py b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_2.py index 854708877..f81f97a95 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_2.py +++ b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_2.py @@ -25,43 +25,145 @@ 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) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 20, + 2, +) Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) -Placement_1 = model.addPlacement(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_2_1_1")], model.selection("FACE", "LinearCopy_2_1_1_1/MF:Translated&Cylinder_1_1/Face_2"), model.selection("FACE", "Compound_2_1_2_1/Modified_Face&Extrusion_1_2/To_Face"), reverse = False, centering = True, keepSubResults = True) +Placement_1 = model.addPlacement( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_2_1_1")], + model.selection("FACE", "LinearCopy_2_1_1_1/MF:Translated&Cylinder_1_1/Face_2"), + model.selection("FACE", "Compound_2_1_2_1/Modified_Face&Extrusion_1_2/To_Face"), + reverse=False, + centering=True, + keepSubResults=True, +) model.end() @@ -75,14 +177,20 @@ model.testNbSubShapes(Placement_1, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(Placement_1, GeomAPI_Shape.VERTEX, [48]) model.testResultsVolumes(Placement_1, [3141.592653589793]) -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 REF_C = GeomAPI_Pnt(20.590169943749483, -15, 10) midPoint = Placement_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(REF_C) < TOLERANCE) +assert midPoint.distance(REF_C) < TOLERANCE REF_SUB = [GeomAPI_Pnt(31.18033988749897, -50, 15), GeomAPI_Pnt(10, 20, 5)] for ind in range(0, len(REF_SUB)): - midPoint = Placement_1.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(REF_SUB[ind]) < TOLERANCE) + midPoint = ( + Placement_1.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert midPoint.distance(REF_SUB[ind]) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_3.py b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_3.py index 3bdf25ed5..895db1cc7 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_3.py +++ b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_3.py @@ -25,52 +25,161 @@ 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) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 20, + 2, +) Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) -Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5"), model.selection("SOLID", "Compound_2_1_2_1")], model.selection("FACE", "Compound_2_1_2_1/Modified_Face&Extrusion_1_2/From_Face"), model.selection("FACE", "LinearCopy_2_1_1_1/MF:Translated&Cylinder_1_1/Face_2"), centering = False, keepSubResults = True) +Placement_1 = model.addPlacement( + Part_1_doc, + [ + model.selection("SOLID", "Compound_2_1_1_5"), + model.selection("SOLID", "Compound_2_1_2_1"), + ], + model.selection("FACE", "Compound_2_1_2_1/Modified_Face&Extrusion_1_2/From_Face"), + model.selection("FACE", "LinearCopy_2_1_1_1/MF:Translated&Cylinder_1_1/Face_2"), + centering=False, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Placement_1.feature().error() != "") +assert Placement_1.feature().error() != "" # change the placement arguments model.begin() -Placement_1.setObjects([model.selection("COMPSOLID", "Compound_2_1_1"), model.selection("SOLID", "Compound_2_1_2_1")]) +Placement_1.setObjects( + [ + model.selection("COMPSOLID", "Compound_2_1_1"), + model.selection("SOLID", "Compound_2_1_2_1"), + ] +) model.end() from GeomAPI import * @@ -83,16 +192,24 @@ model.testNbSubShapes(Placement_1, GeomAPI_Shape.EDGE, [162]) model.testNbSubShapes(Placement_1, GeomAPI_Shape.VERTEX, [324]) model.testResultsVolumes(Placement_1, [14319.996]) -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 REF_C = GeomAPI_Pnt(10.29508497187, -50, 10) midPoint = Placement_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(REF_C) < TOLERANCE) +assert midPoint.distance(REF_C) < TOLERANCE -REF_SUB = [GeomAPI_Pnt(4.566865353179923, -50, 15), - GeomAPI_Pnt(10.29508497, -32.16838976, 10), - GeomAPI_Pnt(-20.59016994, -85.663220479, 5)] +REF_SUB = [ + GeomAPI_Pnt(4.566865353179923, -50, 15), + GeomAPI_Pnt(10.29508497, -32.16838976, 10), + GeomAPI_Pnt(-20.59016994, -85.663220479, 5), +] for ind in range(0, len(REF_SUB)): - midPoint = Placement_1.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(REF_SUB[ind]) < TOLERANCE) + midPoint = ( + Placement_1.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert midPoint.distance(REF_SUB[ind]) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_4.py b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_4.py index 3248ef939..e10c87842 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_4.py +++ b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_4.py @@ -25,43 +25,146 @@ 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) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 20, + 2, +) Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) -Placement_1 = model.addPlacement(Part_1_doc, [model.selection("COMPSOLID", "Compound_2_1_1"), model.selection("SOLID", "Compound_2_1_3")], model.selection("FACE", "Compound_2_1_2_1/Modified_Face&Extrusion_1_2/From_Face"), model.selection("FACE", "LinearCopy_2_1_1_1/MF:Translated&Cylinder_1_1/Face_2"), keepSubResults = True) +Placement_1 = model.addPlacement( + Part_1_doc, + [ + model.selection("COMPSOLID", "Compound_2_1_1"), + model.selection("SOLID", "Compound_2_1_3"), + ], + model.selection("FACE", "Compound_2_1_2_1/Modified_Face&Extrusion_1_2/From_Face"), + model.selection("FACE", "LinearCopy_2_1_1_1/MF:Translated&Cylinder_1_1/Face_2"), + keepSubResults=True, +) model.end() @@ -75,16 +178,24 @@ model.testNbSubShapes(Placement_1, GeomAPI_Shape.EDGE, [162]) model.testNbSubShapes(Placement_1, GeomAPI_Shape.VERTEX, [324]) model.testResultsVolumes(Placement_1, [14319.996]) -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 REF_C = GeomAPI_Pnt(10.29508497187, -50, 10) midPoint = Placement_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(REF_C) < TOLERANCE) +assert midPoint.distance(REF_C) < TOLERANCE -REF_SUB = [GeomAPI_Pnt(4.566865353179923, -50, 15), - GeomAPI_Pnt(10.29508497, -32.16838976, 5), - GeomAPI_Pnt(-20.59016994, -85.663220479, 15)] +REF_SUB = [ + GeomAPI_Pnt(4.566865353179923, -50, 15), + GeomAPI_Pnt(10.29508497, -32.16838976, 5), + GeomAPI_Pnt(-20.59016994, -85.663220479, 15), +] for ind in range(0, len(REF_SUB)): - midPoint = Placement_1.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(REF_SUB[ind]) < TOLERANCE) + midPoint = ( + Placement_1.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert midPoint.distance(REF_SUB[ind]) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_5.py b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_5.py index a412b8eff..7dc2b1b0a 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_5.py +++ b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_5.py @@ -26,59 +26,176 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() Z_SHIFT = 10 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 model.begin() -Placement_1 = model.addPlacement(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), keepSubResults = True) +Placement_1 = model.addPlacement( + Part_1_doc, + [model.selection("VERTEX", "Vertex_1_1")], + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), + keepSubResults=True, +) model.testNbResults(Placement_1, 1) model.testNbSubResults(Placement_1, [0]) model.testNbSubShapes(Placement_1, GeomAPI_Shape.SOLID, [0]) @@ -90,9 +207,15 @@ model.testResultsAreas(Placement_1, [0]) refPoint = Vertex_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + Z_SHIFT) midPoint = Placement_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Placement_2 = model.addPlacement(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), keepSubResults = True) +Placement_2 = model.addPlacement( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), + keepSubResults=True, +) model.testNbResults(Placement_2, 1) model.testNbSubResults(Placement_2, [0]) model.testNbSubShapes(Placement_2, GeomAPI_Shape.SOLID, [0]) @@ -104,9 +227,15 @@ model.testResultsAreas(Placement_2, [0]) refPoint = Edge_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + Z_SHIFT) midPoint = Placement_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Placement_3 = model.addPlacement(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), keepSubResults = True) +Placement_3 = model.addPlacement( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), + keepSubResults=True, +) model.testNbResults(Placement_3, 1) model.testNbSubResults(Placement_3, [0]) model.testNbSubShapes(Placement_3, GeomAPI_Shape.SOLID, [0]) @@ -118,9 +247,15 @@ model.testResultsAreas(Placement_3, [0]) refPoint = Wire_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + Z_SHIFT) midPoint = Placement_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Placement_4 = model.addPlacement(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), keepSubResults = True) +Placement_4 = model.addPlacement( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), + keepSubResults=True, +) model.testNbResults(Placement_4, 1) model.testNbSubResults(Placement_4, [0]) model.testNbSubShapes(Placement_4, GeomAPI_Shape.SOLID, [0]) @@ -132,9 +267,15 @@ model.testResultsAreas(Placement_4, [109.154152964914914]) refPoint = Face_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + Z_SHIFT) midPoint = Placement_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Placement_5 = model.addPlacement(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), keepSubResults = True) +Placement_5 = model.addPlacement( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), + keepSubResults=True, +) model.testNbResults(Placement_5, 1) model.testNbSubResults(Placement_5, [0]) model.testNbSubShapes(Placement_5, GeomAPI_Shape.SOLID, [0]) @@ -146,9 +287,15 @@ model.testResultsAreas(Placement_5, [182.822012116]) refPoint = Shell_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + Z_SHIFT) midPoint = Placement_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Placement_6 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), keepSubResults = True) +Placement_6 = model.addPlacement( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Bottom"), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), + keepSubResults=True, +) model.testNbResults(Placement_6, 1) model.testNbSubResults(Placement_6, [0]) model.testNbSubShapes(Placement_6, GeomAPI_Shape.SOLID, [1]) @@ -159,9 +306,15 @@ model.testResultsVolumes(Placement_6, [1000]) refPoint = Translation_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + Z_SHIFT) midPoint = Placement_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Placement_7 = model.addPlacement(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("FACE", "AngularCopy_1_1_1/MF:Rotated&Box_3_1/Bottom"), model.selection("FACE", "AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top"), keepSubResults = True) +Placement_7 = model.addPlacement( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + model.selection("FACE", "AngularCopy_1_1_1/MF:Rotated&Box_3_1/Bottom"), + model.selection("FACE", "AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top"), + keepSubResults=True, +) model.testNbResults(Placement_7, 1) model.testNbSubResults(Placement_7, [3]) model.testNbSubShapes(Placement_7, GeomAPI_Shape.SOLID, [3]) @@ -172,9 +325,15 @@ model.testResultsVolumes(Placement_7, [1589.0486226]) refPoint = Partition_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + Z_SHIFT) midPoint = Placement_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Placement_8 = model.addPlacement(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")],model.selection("FACE", "AngularCopy_1_1_1/MF:Rotated&Box_3_1/Bottom"), model.selection("FACE", "AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top"), keepSubResults = True) +Placement_8 = model.addPlacement( + Part_1_doc, + [model.selection("COMPOUND", "AngularCopy_1_1")], + model.selection("FACE", "AngularCopy_1_1_1/MF:Rotated&Box_3_1/Bottom"), + model.selection("FACE", "AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top"), + keepSubResults=True, +) model.testNbResults(Placement_8, 1) model.testNbSubResults(Placement_8, [3]) model.testNbSubShapes(Placement_8, GeomAPI_Shape.SOLID, [3]) @@ -185,8 +344,8 @@ model.testResultsVolumes(Placement_8, [3000]) refPoint = AngularCopy_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + Z_SHIFT) midPoint = Placement_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_6.py b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_6.py index 15822ef88..4c88a3772 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_6.py +++ b/src/FeaturesPlugin/Test/TestPlacement_MultiLevelCompound_v95_6.py @@ -26,64 +26,185 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() # collect reference data Z_SHIFT = 10 REFERENCE = [] -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 for ind in range(0, Compound_1.result().numberOfSubs()): p = Compound_1.result().subResult(ind).resultSubShapePair()[1].middlePoint() REFERENCE.append(p) + def assertResult(thePlacement, theNbMoved): model.testNbResults(thePlacement, 1) model.testNbSubResults(thePlacement, [8]) @@ -97,35 +218,93 @@ def assertResult(thePlacement, theNbMoved): ref = GeomAPI_Pnt(REFERENCE[ind].x(), REFERENCE[ind].y(), REFERENCE[ind].z()) if ind < theNbMoved: ref.setZ(ref.z() + Z_SHIFT) - midPoint = thePlacement.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + thePlacement.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Placement_1 = model.addPlacement(Part_1_doc, [model.selection("VERTEX", "Compound_1_1_1")], model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Top"), keepSubResults = True) +Placement_1 = model.addPlacement( + Part_1_doc, + [model.selection("VERTEX", "Compound_1_1_1")], + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Bottom"), + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Top"), + keepSubResults=True, +) assertResult(Placement_1, 1) -Placement_2 = model.addPlacement(Part_1_doc, [model.selection("EDGE", "Placement_1_1_2")], model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Top"), keepSubResults = True) +Placement_2 = model.addPlacement( + Part_1_doc, + [model.selection("EDGE", "Placement_1_1_2")], + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Bottom"), + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Top"), + keepSubResults=True, +) assertResult(Placement_2, 2) -Placement_3 = model.addPlacement(Part_1_doc, [model.selection("WIRE", "Placement_2_1_3")], model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Top"), keepSubResults = True) +Placement_3 = model.addPlacement( + Part_1_doc, + [model.selection("WIRE", "Placement_2_1_3")], + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Bottom"), + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Top"), + keepSubResults=True, +) assertResult(Placement_3, 3) -Placement_4 = model.addPlacement(Part_1_doc, [model.selection("FACE", "Placement_3_1_4")], model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Top"), keepSubResults = True) +Placement_4 = model.addPlacement( + Part_1_doc, + [model.selection("FACE", "Placement_3_1_4")], + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Bottom"), + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Top"), + keepSubResults=True, +) assertResult(Placement_4, 4) -Placement_5 = model.addPlacement(Part_1_doc, [model.selection("SHELL", "Placement_4_1_5")], model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Top"), keepSubResults = True) +Placement_5 = model.addPlacement( + Part_1_doc, + [model.selection("SHELL", "Placement_4_1_5")], + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Bottom"), + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Top"), + keepSubResults=True, +) assertResult(Placement_5, 5) -Placement_6 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Placement_5_1_6")], model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Top"), keepSubResults = True) +Placement_6 = model.addPlacement( + Part_1_doc, + [model.selection("SOLID", "Placement_5_1_6")], + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Bottom"), + model.selection("FACE", "Compound_1_1_6/Modified_Face&Box_1_1/Top"), + keepSubResults=True, +) assertResult(Placement_6, 6) -Placement_7 = model.addPlacement(Part_1_doc, [model.selection("COMPSOLID", "Placement_6_1_7")], model.selection("FACE", "Placement_6_1_6/MF:Placed&Box_1_1/Bottom"), model.selection("FACE", "Placement_6_1_6/MF:Placed&Box_1_1/Top"), keepSubResults = True) +Placement_7 = model.addPlacement( + Part_1_doc, + [model.selection("COMPSOLID", "Placement_6_1_7")], + model.selection("FACE", "Placement_6_1_6/MF:Placed&Box_1_1/Bottom"), + model.selection("FACE", "Placement_6_1_6/MF:Placed&Box_1_1/Top"), + keepSubResults=True, +) assertResult(Placement_7, 7) -Placement_8 = model.addPlacement(Part_1_doc, [model.selection("COMPOUND", "Placement_7_1_8")], model.selection("FACE", "Placement_6_1_6/MF:Placed&Box_1_1/Bottom"), model.selection("FACE", "Placement_6_1_6/MF:Placed&Box_1_1/Top"), keepSubResults = True) +Placement_8 = model.addPlacement( + Part_1_doc, + [model.selection("COMPOUND", "Placement_7_1_8")], + model.selection("FACE", "Placement_6_1_6/MF:Placed&Box_1_1/Bottom"), + model.selection("FACE", "Placement_6_1_6/MF:Placed&Box_1_1/Top"), + keepSubResults=True, +) assertResult(Placement_8, 8) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPlacement_Part_Part.py b/src/FeaturesPlugin/Test/TestPlacement_Part_Part.py index 520d67877..9596b3c4a 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_Part_Part.py +++ b/src/FeaturesPlugin/Test/TestPlacement_Part_Part.py @@ -27,9 +27,22 @@ 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) +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) +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 diff --git a/src/FeaturesPlugin/Test/TestPlacement_Vertex_Vertex.py b/src/FeaturesPlugin/Test/TestPlacement_Vertex_Vertex.py index f3a2faf46..a3a9c4ef1 100644 --- a/src/FeaturesPlugin/Test/TestPlacement_Vertex_Vertex.py +++ b/src/FeaturesPlugin/Test/TestPlacement_Vertex_Vertex.py @@ -33,7 +33,35 @@ 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) +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() diff --git a/src/FeaturesPlugin/Test/TestPointCloud.py b/src/FeaturesPlugin/Test/TestPointCloud.py index 45feab940..f33ffab70 100644 --- a/src/FeaturesPlugin/Test/TestPointCloud.py +++ b/src/FeaturesPlugin/Test/TestPointCloud.py @@ -35,7 +35,9 @@ Part_1_doc = Part_1.document() Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 10) ### Get Points Cloud -PC_1 = model.makeVertexInsideFace(Part_1_doc, model.selection("FACE", "Sphere_1_1/Face_1"), 100) +PC_1 = model.makeVertexInsideFace( + Part_1_doc, model.selection("FACE", "Sphere_1_1/Face_1"), 100 +) model.end() @@ -44,7 +46,7 @@ err = PC_1.feature().error() if err != "": print(err) # this test should not fail with old OCCT - assert("Improper OCCT version" in err) + assert "Improper OCCT version" in err else: model.testNbResults(PC_1, 1) model.testNbSubResults(PC_1, [0]) @@ -53,4 +55,4 @@ else: model.testNbSubShapes(PC_1, GeomAPI_Shape.EDGE, [0]) model.testNbSubShapes(PC_1, GeomAPI_Shape.VERTEX, [100]) - assert(model.checkPythonDump()) + assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestPointCoordinates.py b/src/FeaturesPlugin/Test/TestPointCoordinates.py index 7b9e7b0e0..bc47addb8 100644 --- a/src/FeaturesPlugin/Test/TestPointCoordinates.py +++ b/src/FeaturesPlugin/Test/TestPointCoordinates.py @@ -20,9 +20,9 @@ """ Unit test of ... """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= import os import math @@ -31,21 +31,24 @@ from salome.shaper import model __updated__ = "2020-11-12" -#========================================================================= + +# ========================================================================= # test get point coordinates -#========================================================================= +# ========================================================================= def test_point_coordinates(): - model.begin() - file_path = os.path.join(os.getenv("DATA_DIR"),"Shapes","Brep","box1.brep") + file_path = os.path.join(os.getenv("DATA_DIR"), "Shapes", "Brep", "box1.brep") partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() - Import_1 = model.addImport(Part_1_doc,file_path) + Import_1 = model.addImport(Part_1_doc, file_path) model.do() myDelta = 1e-6 - coordinates = model.getPointCoordinates(Part_1_doc,model.selection("VERTEX", "[box1_1/Shape_2][box1_1/Shape_3][box1_1/Shape_6]")) + coordinates = model.getPointCoordinates( + Part_1_doc, + model.selection("VERTEX", "[box1_1/Shape_2][box1_1/Shape_3][box1_1/Shape_6]"), + ) print(" x: ", coordinates[0]) print(" y: ", coordinates[1]) @@ -53,21 +56,26 @@ def test_point_coordinates(): aRef = 200 aRes = coordinates[0] - assert (math.fabs(aRes - aRef) < myDelta), "The coordinate X is wrong: expected = {0}, real = {1}".format(aRef, aRes) + assert ( + math.fabs(aRes - aRef) < myDelta + ), "The coordinate X is wrong: expected = {0}, real = {1}".format(aRef, aRes) aRef = 0 - aRes= coordinates[1] - assert (math.fabs(aRes - aRef) < myDelta), "The coordinate Y is wrong: expected = {0}, real = {1}".format(aRef, aRes) + aRes = coordinates[1] + assert ( + math.fabs(aRes - aRef) < myDelta + ), "The coordinate Y is wrong: expected = {0}, real = {1}".format(aRef, aRes) aRef = 200 aRes = coordinates[2] - assert (math.fabs(aRes - aRef) < myDelta), "The coordinate Z is wrong: expected = {0}, real = {1}".format(aRef, aRes) - + assert ( + math.fabs(aRes - aRef) < myDelta + ), "The coordinate Z is wrong: expected = {0}, real = {1}".format(aRef, aRes) -if __name__ == '__main__': +if __name__ == "__main__": test_point_coordinates() - #========================================================================= + # ========================================================================= # End of test - #========================================================================= + # ========================================================================= diff --git a/src/FeaturesPlugin/Test/TestRecover.py b/src/FeaturesPlugin/Test/TestRecover.py index 4681616f5..b7883def9 100644 --- a/src/FeaturesPlugin/Test/TestRecover.py +++ b/src/FeaturesPlugin/Test/TestRecover.py @@ -47,19 +47,19 @@ cut = model.addCut(mypart, bigcyl.results(), smallcyl.results()) model.do() # check bodies number is 1: only Boolean result -assert(mypart.size("Bodies") == 1) +assert mypart.size("Bodies") == 1 model.addRecover(mypart, cut, smallcyl.results()) model.end() # check that one is recovered -assert(mypart.size("Bodies") == 2) +assert mypart.size("Bodies") == 2 model.undo() # check bodies number is 1: recover is canceled -assert(mypart.size("Bodies") == 1) +assert mypart.size("Bodies") == 1 # check persistent flag of recover: never concealed @@ -67,7 +67,7 @@ model.begin() recover = model.addRecover(mypart, cut, smallcyl.results()) model.end() -assert(mypart.size("Bodies") == 2) +assert mypart.size("Bodies") == 2 model.begin() sk3 = model.addSketch(mypart, model.defaultPlane("XOY")) @@ -81,6 +81,6 @@ cut2 = model.addCut(mypart, big2.results(), smallcyl2.results()) model.end() # two booleans and small cylinder -assert(mypart.size("Bodies") == 3) +assert mypart.size("Bodies") == 3 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRecover1798.py b/src/FeaturesPlugin/Test/TestRecover1798.py index 0c74155cf..7c13cac83 100644 --- a/src/FeaturesPlugin/Test/TestRecover1798.py +++ b/src/FeaturesPlugin/Test/TestRecover1798.py @@ -31,29 +31,51 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(0, 263.502735943608, 0, -36.43621897530445) SketchLine_1.setAuxiliary(True) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchPoint_1.coordinates()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchPoint_1.coordinates() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchLine_2 = Sketch_1.addLine(-90, 0, -90, 29.20204102886729) SketchLine_3 = Sketch_1.addLine(-90, 29.20204102886729, -85, 29.20204102886729) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(-85, 29.20204102886729, -85, 118.2020410288673) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(-85, 118.2020410288673, -90, 128) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(-90, 128, -90, 183) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(-90, 183, -80, 183) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(-80, 183, -80, 190) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(-80, 190, -70, 190) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchLine_10 = Sketch_1.addLine(-70, 190, -70, 0) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchLine_11 = Sketch_1.addLine(-70, 0, -90, 0) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +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, False) +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()) @@ -65,11 +87,21 @@ 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, 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()) +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") SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_5.result(), 11) @@ -77,28 +109,51 @@ SketchConstraintLength_2.setName("SketchConstraintLength_4") SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_4.result(), 89) SketchConstraintLength_3.setName("SketchConstraintLength_5") SketchLine_12 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_12.result()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_12.result() +) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 7) SketchConstraintLength_4.setName("SketchConstraintLength_6") SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_6.result(), 55) SketchConstraintLength_5.setName("SketchConstraintLength_7") -SketchLine_13 = Sketch_1.addLine(-130.660278375518, 118.202041028867, 110.462869194241, 118.202041028867) +SketchLine_13 = Sketch_1.addLine( + -130.660278375518, 118.202041028867, 110.462869194241, 118.202041028867 +) SketchLine_13.setName("SketchLine_19") SketchLine_13.result().setName("SketchLine_19") SketchLine_13.setAuxiliary(True) SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_13.result()) SketchConstraintHorizontal_5.setName("SketchConstraintHorizontal_8") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_13.result(), SketchLine_4.endPoint()) +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_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) +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/SketchLine_1"), False) +SketchProjection_1 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchLine_1"), False +) SketchLine_14 = SketchProjection_1.createdFeature() SketchLine_14.setName("SketchLine_14") SketchLine_14.result().setName("SketchLine_14") -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_15 = SketchProjection_2.createdFeature() SketchLine_15.setName("SketchLine_15") SketchLine_15.result().setName("SketchLine_15") @@ -111,7 +166,9 @@ SketchLine_17.result().setName("SketchLine_28") 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(15, 98.202041028867, -15.00000000000001, 98.20204102886699) +SketchLine_19 = Sketch_2.addLine( + 15, 98.202041028867, -15.00000000000001, 98.20204102886699 +) SketchLine_19.setName("SketchLine_27") SketchLine_19.result().setName("SketchLine_27") SketchLine_20 = Sketch_2.addLine(25, 98.20204102886706, -25, 98.20204102886706) @@ -122,21 +179,29 @@ 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 = 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_20.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") SketchLine_23.result().setName("SketchLine_17") SketchLine_23.setAuxiliary(True) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) +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_21.startPoint()) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchLine_23.endPoint(), SketchLine_21.startPoint() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_16") SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_20.result()) SketchConstraintHorizontal_6.setName("SketchConstraintHorizontal_6") @@ -148,88 +213,220 @@ SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_20.result(), "l_percage SketchConstraintLength_6.setName("SketchConstraintLength_8") 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", False) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_19"), False) +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() 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) +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()) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchArc_1.startPoint(), SketchLine_25.endPoint() +) 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) -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_26.startPoint()) -SketchConstraintTangent_1 = Sketch_2.setTangent(SketchArc_1.results()[1], SketchLine_26.result()) -SketchConstraintTangent_2 = Sketch_2.setTangent(SketchArc_1.results()[1], SketchLine_25.result()) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_23.endPoint(), SketchLine_26.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.20204102886701, 15, 44.20204102886701, 25, 54.20204102886701, False) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchArc_2.startPoint(), SketchLine_16.endPoint()) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchArc_1.endPoint(), SketchLine_26.startPoint() +) +SketchConstraintTangent_1 = Sketch_2.setTangent( + SketchArc_1.results()[1], SketchLine_26.result() +) +SketchConstraintTangent_2 = Sketch_2.setTangent( + SketchArc_1.results()[1], SketchLine_25.result() +) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchLine_23.endPoint(), SketchLine_26.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.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.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_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_21.result()) -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_26.result()) -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()) +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_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_21.result() +) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_26.result() +) +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(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_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_20.result()) -SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_27.result()) -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()) -SketchConstraintTangent_8 = Sketch_2.setTangent(SketchArc_4.results()[1], SketchLine_17.result()) -SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchLine_28.startPoint(), SketchLine_19.startPoint()) -SketchConstraintCoincidence_39 = Sketch_2.setCoincident(SketchLine_25.endPoint(), SketchLine_17.endPoint()) -SketchConstraintCoincidence_40 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_28.result()) -SketchConstraintCoincidence_41 = Sketch_2.setCoincident(SketchLine_17.startPoint(), SketchLine_25.result()) +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_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_20.result() +) +SketchConstraintCoincidence_35 = Sketch_2.setCoincident( + SketchLine_18.endPoint(), SketchLine_27.result() +) +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() +) +SketchConstraintTangent_8 = Sketch_2.setTangent( + SketchArc_4.results()[1], SketchLine_17.result() +) +SketchConstraintCoincidence_38 = Sketch_2.setCoincident( + SketchLine_28.startPoint(), SketchLine_19.startPoint() +) +SketchConstraintCoincidence_39 = Sketch_2.setCoincident( + SketchLine_25.endPoint(), SketchLine_17.endPoint() +) +SketchConstraintCoincidence_40 = Sketch_2.setCoincident( + SketchLine_19.endPoint(), SketchLine_28.result() +) +SketchConstraintCoincidence_41 = Sketch_2.setCoincident( + SketchLine_17.startPoint(), SketchLine_25.result() +) SketchConstraintRadius_1 = Sketch_2.setRadius(SketchArc_3.results()[1], 10) 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-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") +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 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Recover_1_1")], + model.selection("EDGE", "PartSet/OZ"), + "angle2", +) Rotation_3.setName("Rotation_4") Rotation_3.result().setName("Rotation_4_1") Recover_2 = model.addRecover(Part_1_doc, Rotation_2, [Rotation_1.result()]) -Rotation_4 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_2_1")], model.selection("EDGE", "PartSet/OZ"), "-angle2") +Rotation_4 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Recover_2_1")], + model.selection("EDGE", "PartSet/OZ"), + "-angle2", +) Rotation_4.setName("Rotation_5") Rotation_4.result().setName("Rotation_5_1") 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 = 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") -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) +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(Cut_1.result().shapeType() == 'SOLID') -assert(Part_1_doc.size("Bodies") == 1) +assert Cut_1.result().shapeType() == "SOLID" +assert Part_1_doc.size("Bodies") == 1 diff --git a/src/FeaturesPlugin/Test/TestRecover_Compound.py b/src/FeaturesPlugin/Test/TestRecover_Compound.py index d9496950a..cc37d851e 100644 --- a/src/FeaturesPlugin/Test/TestRecover_Compound.py +++ b/src/FeaturesPlugin/Test/TestRecover_Compound.py @@ -23,18 +23,55 @@ 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"), 10, 50) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 50, 2) -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 50, 3) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 50, +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 50, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OY"), + 50, + 3, +) Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "([LinearCopy_2_1_2_1/MF:Translated&Cylinder_1_1/Face_1][LinearCopy_2_1_2_1/MF:Translated&Cylinder_1_1/Face_2])([LinearCopy_2_1_2_1/MF:Translated&Cylinder_1_1/Face_1][LinearCopy_2_1_2_1/MF:Translated&Cylinder_1_1/Face_3])"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection( + "EDGE", + "([LinearCopy_2_1_2_1/MF:Translated&Cylinder_1_1/Face_1][LinearCopy_2_1_2_1/MF:Translated&Cylinder_1_1/Face_2])([LinearCopy_2_1_2_1/MF:Translated&Cylinder_1_1/Face_1][LinearCopy_2_1_2_1/MF:Translated&Cylinder_1_1/Face_3])", + ), + False, +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(50, 25, 5) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchCircle_1.center(), SketchLine_1.result()) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchCircle_1.center(), SketchLine_1.result() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 100, 0) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "LinearCopy_2_1_2_2")], [model.selection("SOLID", "Extrusion_1_1")], keepSubResults = True) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection(), + 100, + 0, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "LinearCopy_2_1_2_2")], + [model.selection("SOLID", "Extrusion_1_1")], + keepSubResults=True, +) Recover_1 = model.addRecover(Part_1_doc, Cut_1, [LinearCopy_2.result()], True) model.do() model.end() @@ -49,4 +86,4 @@ model.testNbSubShapes(Part_1, GeomAPI_Shape.EDGE, [82]) model.testNbSubShapes(Part_1, GeomAPI_Shape.VERTEX, [164]) model.testResultsVolumes(Part_1, [186975.51922585917]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRecover_Compsolid1.py b/src/FeaturesPlugin/Test/TestRecover_Compsolid1.py index e1a334332..b2103d92d 100644 --- a/src/FeaturesPlugin/Test/TestRecover_Compsolid1.py +++ b/src/FeaturesPlugin/Test/TestRecover_Compsolid1.py @@ -24,31 +24,77 @@ 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(31.9410018961801, -31.48668563219184, -26.28238891138439, -31.48668563219184) -SketchLine_2 = Sketch_1.addLine(-26.28238891138439, -31.48668563219184, -26.28238891138439, 32.16845339608692) -SketchLine_3 = Sketch_1.addLine(-26.28238891138439, 32.16845339608692, 31.9410018961801, 32.16845339608692) -SketchLine_4 = Sketch_1.addLine(31.9410018961801, 32.16845339608692, 31.9410018961801, -31.48668563219184) -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()) +SketchLine_1 = Sketch_1.addLine( + 31.9410018961801, -31.48668563219184, -26.28238891138439, -31.48668563219184 +) +SketchLine_2 = Sketch_1.addLine( + -26.28238891138439, -31.48668563219184, -26.28238891138439, 32.16845339608692 +) +SketchLine_3 = Sketch_1.addLine( + -26.28238891138439, 32.16845339608692, 31.9410018961801, 32.16845339608692 +) +SketchLine_4 = Sketch_1.addLine( + 31.9410018961801, 32.16845339608692, 31.9410018961801, -31.48668563219184 +) +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(-26.28238891138439, -12.06888707668976, 31.9410018961801, 21.15910771625288) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_4.result()) -SketchLine_6 = Sketch_1.addLine(-0.02931756086478185, 2.913698204490415, 1.128717663020605, -31.48668563219184) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_5.result()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_1.result()) +SketchLine_5 = Sketch_1.addLine( + -26.28238891138439, -12.06888707668976, 31.9410018961801, 21.15910771625288 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_4.result() +) +SketchLine_6 = Sketch_1.addLine( + -0.02931756086478185, 2.913698204490415, 1.128717663020605, -31.48668563219184 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchLine_5.result() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_1.result() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 50, 0) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_4")) -SketchCircle_1 = Sketch_2.addCircle(-4.420087352215441, 24.04732854606771, 12.87676926472621) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 50, 0 +) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_4"), +) +SketchCircle_1 = Sketch_2.addCircle( + -4.420087352215441, 24.04732854606771, 12.87676926472621 +) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 20, 80) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2")], [model.selection("SOLID", "Extrusion_2_1")], keepSubResults = True) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], + model.selection(), + 20, + 80, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1_2")], + [model.selection("SOLID", "Extrusion_2_1")], + keepSubResults=True, +) Recover_1 = model.addRecover(Part_1_doc, Cut_1, [Extrusion_1.result()], True) model.end() @@ -62,4 +108,4 @@ model.testNbSubShapes(Part_1, GeomAPI_Shape.EDGE, [182]) model.testNbSubShapes(Part_1, GeomAPI_Shape.VERTEX, [364]) model.testResultsVolumes(Part_1, [354429.714290673]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRecover_Compsolid2.py b/src/FeaturesPlugin/Test/TestRecover_Compsolid2.py index 10bc71bc8..a56ce2dd1 100644 --- a/src/FeaturesPlugin/Test/TestRecover_Compsolid2.py +++ b/src/FeaturesPlugin/Test/TestRecover_Compsolid2.py @@ -24,10 +24,22 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 100, 100, 100) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], -50, -50, -50) -Partition_1_objects = [model.selection("SOLID", "Translation_1_1"), model.selection("FACE", "PartSet/XOY"), model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ")] -Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults = True) -CompSolid_1_objects = [model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Partition_1_1_5"), model.selection("SOLID", "Partition_1_1_6"), model.selection("SOLID", "Partition_1_1_8")] +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_1_1")], -50, -50, -50 +) +Partition_1_objects = [ + model.selection("SOLID", "Translation_1_1"), + model.selection("FACE", "PartSet/XOY"), + model.selection("FACE", "PartSet/YOZ"), + model.selection("FACE", "PartSet/XOZ"), +] +Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults=True) +CompSolid_1_objects = [ + model.selection("SOLID", "Partition_1_1_1"), + model.selection("SOLID", "Partition_1_1_5"), + model.selection("SOLID", "Partition_1_1_6"), + model.selection("SOLID", "Partition_1_1_8"), +] CompSolid_1 = model.addCompSolid(Part_1_doc, CompSolid_1_objects) Recover_1 = model.addRecover(Part_1_doc, CompSolid_1, [Partition_1.result()], True) model.end() @@ -42,4 +54,4 @@ model.testNbSubShapes(Part_1, GeomAPI_Shape.EDGE, [288]) model.testNbSubShapes(Part_1, GeomAPI_Shape.VERTEX, [576]) model.testResultsVolumes(Part_1, [1500000]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRemoveResultsBody.py b/src/FeaturesPlugin/Test/TestRemoveResultsBody.py index e9252bd2a..30677b141 100644 --- a/src/FeaturesPlugin/Test/TestRemoveResultsBody.py +++ b/src/FeaturesPlugin/Test/TestRemoveResultsBody.py @@ -27,12 +27,18 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 2) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], + model.selection(), + 10, + 0, +) removeResults(Extrusion_1.feature().results()) model.end() # check the number of bodies = 0, number of construction = 1 -assert(Part_1.document().size(ModelAPI_ResultConstruction.group()) == 1) -assert(Part_1.document().size(ModelAPI_ResultBody.group()) == 0) +assert Part_1.document().size(ModelAPI_ResultConstruction.group()) == 1 +assert Part_1.document().size(ModelAPI_ResultBody.group()) == 0 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRemoveResultsConstruction.py b/src/FeaturesPlugin/Test/TestRemoveResultsConstruction.py index 5a3da28b1..6ec8e8124 100644 --- a/src/FeaturesPlugin/Test/TestRemoveResultsConstruction.py +++ b/src/FeaturesPlugin/Test/TestRemoveResultsConstruction.py @@ -26,13 +26,22 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 2) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0) -RemoveResults_1 = model.addRemoveResults(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], + model.selection(), + 10, + 0, +) +RemoveResults_1 = model.addRemoveResults( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")] +) model.end() # check the number of bodies = 1, number of construction = 0 from ModelAPI import * -assert(Part_1.document().size(ModelAPI_ResultConstruction.group()) == 0) -assert(Part_1.document().size(ModelAPI_ResultBody.group()) == 1) -assert(model.checkPythonDump()) +assert Part_1.document().size(ModelAPI_ResultConstruction.group()) == 0 +assert Part_1.document().size(ModelAPI_ResultBody.group()) == 1 + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRemoveResultsPart.py b/src/FeaturesPlugin/Test/TestRemoveResultsPart.py index 167640f55..b756f6c52 100644 --- a/src/FeaturesPlugin/Test/TestRemoveResultsPart.py +++ b/src/FeaturesPlugin/Test/TestRemoveResultsPart.py @@ -29,4 +29,5 @@ model.end() # check the number of parts = 0 from ModelAPI import * -assert(Part_1.document().size(ModelAPI_ResultPart.group()) == 0) + +assert Part_1.document().size(ModelAPI_ResultPart.group()) == 0 diff --git a/src/FeaturesPlugin/Test/TestRemoveSubShapes.py b/src/FeaturesPlugin/Test/TestRemoveSubShapes.py index 58992d780..7730e3ca0 100644 --- a/src/FeaturesPlugin/Test/TestRemoveSubShapes.py +++ b/src/FeaturesPlugin/Test/TestRemoveSubShapes.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -33,14 +33,14 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +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")) @@ -64,9 +64,9 @@ aCircleRadius.setValue(50) aSession.finishOperation() aSketchResult = aSketchFeature.firstResult() -#========================================================================= +# ========================================================================= # Make extrusion on sketch -#========================================================================= +# ========================================================================= # Create extrusion aSession.startOperation() anExtrusionFeature = aPart.addFeature("Extrusion") @@ -74,24 +74,25 @@ anExtrusionFeature.selectionList("base").append(aSketchResult, None) anExtrusionFeature.string("CreationMethod").setValue("BySizes") anExtrusionFeature.real("to_size").setValue(50) anExtrusionFeature.real("from_size").setValue(0) -anExtrusionFeature.real("to_offset").setValue(0) #TODO: remove -anExtrusionFeature.real("from_offset").setValue(0) #TODO: remove +anExtrusionFeature.real("to_offset").setValue(0) # TODO: remove +anExtrusionFeature.real("from_offset").setValue(0) # TODO: remove anExtrusionFeature.execute() aSession.finishOperation() anExtrusionResult = modelAPI_ResultBody(anExtrusionFeature.firstResult()) -#========================================================================= +# ========================================================================= # Remove sub-shapes -#========================================================================= +# ========================================================================= aSession.startOperation() aRemoveSubShapesFeature = aPart.addFeature("Remove_SubShapes") aRemoveSubShapesFeature.selection("base_shape").setValue(anExtrusionResult, None) aRemoveSubShapesFeature.string("creation_method").setValue("by_keep_subshapes") -aRemoveSubShapesFeature.selectionList("subshapes_to_keep").removeLast(); +aRemoveSubShapesFeature.selectionList("subshapes_to_keep").removeLast() aSession.finishOperation() -assert (len(aRemoveSubShapesFeature.results()) > 0) +assert len(aRemoveSubShapesFeature.results()) > 0 anUnionResult = modelAPI_ResultBody(aRemoveSubShapesFeature.firstResult()) -assert (anUnionResult.numberOfSubs() == 2) +assert anUnionResult.numberOfSubs() == 2 from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRemoveSubShapes2.py b/src/FeaturesPlugin/Test/TestRemoveSubShapes2.py index 62cca9c9d..7218f8f36 100644 --- a/src/FeaturesPlugin/Test/TestRemoveSubShapes2.py +++ b/src/FeaturesPlugin/Test/TestRemoveSubShapes2.py @@ -24,11 +24,19 @@ 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(-38.80617495711836, 0.1732418524871273, 42.63017006028262) -SketchCircle_2 = Sketch_1.addCircle(-117.8044596912521, -0.1732418524871385, 54.50817511994374) +SketchCircle_1 = Sketch_1.addCircle( + -38.80617495711836, 0.1732418524871273, 42.63017006028262 +) +SketchCircle_2 = Sketch_1.addCircle( + -117.8044596912521, -0.1732418524871385, 54.50817511994374 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPSOLID", "Extrusion_1_1")) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Remove_SubShapes_1 = model.addRemoveSubShapes( + Part_1_doc, model.selection("COMPSOLID", "Extrusion_1_1") +) Remove_SubShapes_1.setSubShapesToRemove([model.selection("SOLID", "Extrusion_1_1_3")]) model.do() model.end() @@ -43,4 +51,4 @@ model.testNbSubShapes(Remove_SubShapes_1, GeomAPI_Shape.EDGE, [36]) model.testNbSubShapes(Remove_SubShapes_1, GeomAPI_Shape.VERTEX, [72]) model.testResultsVolumes(Remove_SubShapes_1, [136619.795923917088657617568969727]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRemoveSubShapes3.py b/src/FeaturesPlugin/Test/TestRemoveSubShapes3.py index d1b3cafe3..800bd0229 100644 --- a/src/FeaturesPlugin/Test/TestRemoveSubShapes3.py +++ b/src/FeaturesPlugin/Test/TestRemoveSubShapes3.py @@ -28,15 +28,39 @@ 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) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Cylinder_1_1/Face_1")]) -Cylinder_2 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) +Cylinder_2 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Cylinder_2_1/Face_1")]) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OZ"), 10) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Translation_1_1"), model.selection("FACE", "Face_1_1")]) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("FACE", "Face_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 10, +) +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&Face_2_1/Face_2_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&Face_2_1/Face_2_1")] +) model.do() model.checkResult(Remove_SubShapes_1, model, 1, [0], [0], [1], [4], [8]) @@ -48,13 +72,38 @@ model.testHaveNamingSubshapes(Remove_SubShapes_1, model, Part_1_doc) 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) +Cylinder_1 = model.addCylinder( + Part_2_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) Face_1 = model.addFace(Part_2_doc, [model.selection("FACE", "Cylinder_1_1/Face_1")]) -LinearCopy_1 = model.addMultiTranslation(Part_2_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), 10, 2) -LinearCopy_2 = model.addMultiTranslation(Part_2_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OZ"), 20, 2) +LinearCopy_1 = model.addMultiTranslation( + Part_2_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 10, + 2, +) +LinearCopy_2 = model.addMultiTranslation( + Part_2_doc, + [model.selection("COMPOUND", "LinearCopy_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 20, + 2, +) -Remove_SubShapes_2 = model.addRemoveSubShapes(Part_2_doc, model.selection("COMPOUND", "LinearCopy_2_1")) -Remove_SubShapes_2.setSubShapesToRemove([model.selection("FACE", "LinearCopy_2_1_2_2"), model.selection("FACE", "LinearCopy_2_1_2_1")]) +Remove_SubShapes_2 = model.addRemoveSubShapes( + Part_2_doc, model.selection("COMPOUND", "LinearCopy_2_1") +) +Remove_SubShapes_2.setSubShapesToRemove( + [ + model.selection("FACE", "LinearCopy_2_1_2_2"), + model.selection("FACE", "LinearCopy_2_1_2_1"), + ] +) model.do() model.checkResult(Remove_SubShapes_2, model, 1, [2], [0], [2], [8], [16]) @@ -67,12 +116,30 @@ Part_3 = model.addPart(partSet) Part_3_doc = Part_3.document() Box_1 = model.addBox(Part_3_doc, 10, 10, 10) -LinearCopy_1 = model.addMultiTranslation(Part_3_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OY"), 10, 6) -CompSolid_1_objects = [model.selection("SOLID", "LinearCopy_1_1_1"), model.selection("SOLID", "LinearCopy_1_1_2"), model.selection("SOLID", "LinearCopy_1_1_3"), model.selection("SOLID", "LinearCopy_1_1_4"), model.selection("SOLID", "LinearCopy_1_1_5"), model.selection("SOLID", "LinearCopy_1_1_6")] +LinearCopy_1 = model.addMultiTranslation( + Part_3_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OY"), + 10, + 6, +) +CompSolid_1_objects = [ + model.selection("SOLID", "LinearCopy_1_1_1"), + model.selection("SOLID", "LinearCopy_1_1_2"), + model.selection("SOLID", "LinearCopy_1_1_3"), + model.selection("SOLID", "LinearCopy_1_1_4"), + model.selection("SOLID", "LinearCopy_1_1_5"), + model.selection("SOLID", "LinearCopy_1_1_6"), +] CompSolid_1 = model.addCompSolid(Part_3_doc, CompSolid_1_objects) -Remove_SubShapes_3_objects = [model.selection("SOLID", "CompSolid_1_1_3"), model.selection("SOLID", "CompSolid_1_1_4")] -Remove_SubShapes_3 = model.addRemoveSubShapes(Part_3_doc, model.selection("COMPSOLID", "CompSolid_1_1")) +Remove_SubShapes_3_objects = [ + model.selection("SOLID", "CompSolid_1_1_3"), + model.selection("SOLID", "CompSolid_1_1_4"), +] +Remove_SubShapes_3 = model.addRemoveSubShapes( + Part_3_doc, model.selection("COMPSOLID", "CompSolid_1_1") +) Remove_SubShapes_3.setSubShapesToRemove(Remove_SubShapes_3_objects) model.do() @@ -83,4 +150,4 @@ model.testHaveNamingSubshapes(Remove_SubShapes_3, model, Part_3_doc) # Test 4. Check Python dump # ============================================================================= model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRemoveSubShapes4.py b/src/FeaturesPlugin/Test/TestRemoveSubShapes4.py index e580b819c..09927c96e 100644 --- a/src/FeaturesPlugin/Test/TestRemoveSubShapes4.py +++ b/src/FeaturesPlugin/Test/TestRemoveSubShapes4.py @@ -26,32 +26,75 @@ 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/Bottom"), model.selection("FACE", "Box_1_1/Top")) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Bottom"), + model.selection("FACE", "Box_1_1/Top"), +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) SketchLine_1 = Sketch_1.addLine(20, 0, 0, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, -20) SketchLine_3 = Sketch_1.addLine(0, -20, 20, -20) SketchLine_4 = Sketch_1.addLine(20, -20, 20, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), 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_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")] +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) -Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPOUND", "Partition_1_1")) -Remove_SubShapes_1.setSubShapesToRemove([model.selection("FACE", "Partition_1_1_2"), model.selection("FACE", "Partition_1_1_3")]) +Remove_SubShapes_1 = model.addRemoveSubShapes( + Part_1_doc, model.selection("COMPOUND", "Partition_1_1") +) +Remove_SubShapes_1.setSubShapesToRemove( + [ + model.selection("FACE", "Partition_1_1_2"), + model.selection("FACE", "Partition_1_1_3"), + ] +) Recover_1 = model.addRecover(Part_1_doc, Remove_SubShapes_1, [Partition_1.result()]) model.do() @@ -72,4 +115,4 @@ model.testNbSubShapes(Recover_1, GeomAPI_Shape.FACE, [20]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRemoveSubShapes5.py b/src/FeaturesPlugin/Test/TestRemoveSubShapes5.py index 72a4e7f73..2d1d45c52 100644 --- a/src/FeaturesPlugin/Test/TestRemoveSubShapes5.py +++ b/src/FeaturesPlugin/Test/TestRemoveSubShapes5.py @@ -26,41 +26,87 @@ 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/Bottom"), model.selection("FACE", "Box_1_1/Top")) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Bottom"), + model.selection("FACE", "Box_1_1/Top"), +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) SketchLine_1 = Sketch_1.addLine(20, 0, 0, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, -20) SketchLine_3 = Sketch_1.addLine(0, -20, 20, -20) SketchLine_4 = Sketch_1.addLine(20, -20, 20, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), 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_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")] +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) -Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPOUND", "Partition_1_1")) -Remove_SubShapes_1.setSubShapesToRemove([model.selection("COMPSOLID", "Partition_1_1_1/Partition_1_1_1")]) +Remove_SubShapes_1 = model.addRemoveSubShapes( + Part_1_doc, model.selection("COMPOUND", "Partition_1_1") +) +Remove_SubShapes_1.setSubShapesToRemove( + [model.selection("COMPSOLID", "Partition_1_1_1/Partition_1_1_1")] +) model.do() # check error when compsolid is selected -assert(Remove_SubShapes_1.feature().error() != "") +assert Remove_SubShapes_1.feature().error() != "" # fix the problematic feature -Remove_SubShapes_1.setSubShapesToRemove([model.selection("SOLID", "Partition_1_1_1_1"), model.selection("SOLID", "Partition_1_1_1_2"), model.selection("SOLID", "Partition_1_1_1_3")]) +Remove_SubShapes_1.setSubShapesToRemove( + [ + 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.do() -assert(Remove_SubShapes_1.feature().error() == "") +assert Remove_SubShapes_1.feature().error() == "" # check number of sub-shapes model.testNbResults(Remove_SubShapes_1, 1) @@ -72,4 +118,4 @@ model.testNbSubShapes(Remove_SubShapes_1, GeomAPI_Shape.FACE, [2]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRemoveSubShapes6.py b/src/FeaturesPlugin/Test/TestRemoveSubShapes6.py index 039f514d4..6fd6fba86 100644 --- a/src/FeaturesPlugin/Test/TestRemoveSubShapes6.py +++ b/src/FeaturesPlugin/Test/TestRemoveSubShapes6.py @@ -26,41 +26,85 @@ 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/Bottom"), model.selection("FACE", "Box_1_1/Top")) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Bottom"), + model.selection("FACE", "Box_1_1/Top"), +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) SketchLine_1 = Sketch_1.addLine(20, 0, 0, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, -20) SketchLine_3 = Sketch_1.addLine(0, -20, 20, -20) SketchLine_4 = Sketch_1.addLine(20, -20, 20, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), 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_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")] +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) -Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPOUND", "Partition_1_1")) +Remove_SubShapes_1 = model.addRemoveSubShapes( + Part_1_doc, model.selection("COMPOUND", "Partition_1_1") +) Remove_SubShapes_1.setSubShapesToKeep([model.selection("COMPSOLID", "Partition_1_1_1")]) model.do() # check error when compsolid is selected -assert(Remove_SubShapes_1.feature().error() != "") +assert Remove_SubShapes_1.feature().error() != "" # fix the problematic feature -Remove_SubShapes_1.setSubShapesToKeep([model.selection("SOLID", "Partition_1_1_1_1"), model.selection("SOLID", "Partition_1_1_1_2"), model.selection("SOLID", "Partition_1_1_1_3")]) +Remove_SubShapes_1.setSubShapesToKeep( + [ + 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.do() -assert(Remove_SubShapes_1.feature().error() == "") +assert Remove_SubShapes_1.feature().error() == "" # check number of sub-shapes model.testNbResults(Remove_SubShapes_1, 1) @@ -72,4 +116,4 @@ model.testNbSubShapes(Remove_SubShapes_1, GeomAPI_Shape.FACE, [18]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRevolution.py b/src/FeaturesPlugin/Test/TestRevolution.py index 45d5a2bcb..6baeae30c 100644 --- a/src/FeaturesPlugin/Test/TestRevolution.py +++ b/src/FeaturesPlugin/Test/TestRevolution.py @@ -43,9 +43,9 @@ data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(FROM_OFFSET_ID(), ModelAPI_AttributeDouble::typeId()); """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -58,15 +58,15 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +assert len(aPartFeature.results()) == 1 # Another way is: # aPart = aSession.activeDocument() aPartResult = modelAPI_ResultPart(aPartFeature.firstResult()) aPart = aPartResult.partDoc() -#========================================================================= +# ========================================================================= # Create a sketch circle to revol -#========================================================================= +# ========================================================================= aSession.startOperation() aCircleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")) @@ -80,17 +80,17 @@ norm.setValue(0, 0, 1) aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle") anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center")) aCircleRadius = aSketchCircle.real("circle_radius") -anCircleCentr.setValue(0., 0.) -aCircleRadius.setValue(30.) +anCircleCentr.setValue(0.0, 0.0) +aCircleRadius.setValue(30.0) aSession.finishOperation() # Build shape from sketcher results aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult()) -assert (aCircleSketchResult.facesNum() > 0) +assert aCircleSketchResult.facesNum() > 0 -#========================================================================= +# ========================================================================= # Create a sketch line to revol -#========================================================================= +# ========================================================================= aSession.startOperation() aLineSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aLineSketchFeature.attribute("Origin")) @@ -103,8 +103,8 @@ norm.setValue(0, 0, 1) aSketchLine = aLineSketchFeature.addFeature("SketchLine") aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) -aLineStartPoint.setValue(-100., -100.) -aLineEndPoint.setValue(100., -100.) +aLineStartPoint.setValue(-100.0, -100.0) +aLineEndPoint.setValue(100.0, -100.0) aSession.finishOperation() # Build shape from sketcher results @@ -113,43 +113,44 @@ aLineSketchShape = modelAPI_ResultConstruction(aLineSketchResult).shape() aShapeExplorer = GeomAPI_ShapeExplorer(aLineSketchShape, GeomAPI_Shape.EDGE) aLineEdge = aShapeExplorer.current() -#========================================================================= +# ========================================================================= # Test revol between from and to angles -#========================================================================= +# ========================================================================= aSession.startOperation() aRevolFt = aPart.addFeature("Revolution") -assert (aRevolFt.getKind() == "Revolution") +assert aRevolFt.getKind() == "Revolution" # selection type FACE=4 -aRevolFt.selectionList("base").append( - aCircleSketchResult, aCircleSketchResult.face(0)) +aRevolFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(0)) aRevolFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge) aRevolFt.string("CreationMethod").setValue("ByAngles") aRevolFt.real("from_angle").setValue(10) aRevolFt.real("to_angle").setValue(10) -aRevolFt.real("to_offset").setValue(0) #TODO: remove -aRevolFt.real("from_offset").setValue(0) #TODO: remove +aRevolFt.real("to_offset").setValue(0) # TODO: remove +aRevolFt.real("from_offset").setValue(0) # TODO: remove aRevolFt.execute() aSession.finishOperation() -assert (aRevolFt.real("from_angle").value() == 10.0) -assert (aRevolFt.real("to_angle").value() == 10.0) +assert aRevolFt.real("from_angle").value() == 10.0 +assert aRevolFt.real("to_angle").value() == 10.0 # Check revol results -assert (len(aRevolFt.results()) > 0) +assert len(aRevolFt.results()) > 0 aRevolResult = modelAPI_ResultBody(aRevolFt.firstResult()) -assert (aRevolResult is not None) +assert aRevolResult is not None -#========================================================================= +# ========================================================================= # Create bounding planes -#========================================================================= +# ========================================================================= # Create from plane aSession.startOperation() aFromPlaneFeature = aPart.addFeature("Plane") aFromPlaneFeature.string("creation_method").setValue("by_general_equation") -aFromPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove -aFromPlaneFeature.real("A").setValue(0.) -aFromPlaneFeature.real("B").setValue(0.) -aFromPlaneFeature.real("C").setValue(1.) -aFromPlaneFeature.real("D").setValue(50.) +aFromPlaneFeature.string("by_other_plane_option").setValue( + "by_distance_from_other" +) # TODO: remove +aFromPlaneFeature.real("A").setValue(0.0) +aFromPlaneFeature.real("B").setValue(0.0) +aFromPlaneFeature.real("C").setValue(1.0) +aFromPlaneFeature.real("D").setValue(50.0) aSession.finishOperation() aFromResult = aFromPlaneFeature.firstResult() aFromShape = modelAPI_ResultConstruction(aFromResult).shape() @@ -158,28 +159,29 @@ aFromShape = modelAPI_ResultConstruction(aFromResult).shape() aSession.startOperation() aToPlaneFeature = aPart.addFeature("Plane") aToPlaneFeature.string("creation_method").setValue("by_general_equation") -aToPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove -aToPlaneFeature.real("A").setValue(0.) -aToPlaneFeature.real("B").setValue(0.) -aToPlaneFeature.real("C").setValue(1.) -aToPlaneFeature.real("D").setValue(-50.) +aToPlaneFeature.string("by_other_plane_option").setValue( + "by_distance_from_other" +) # TODO: remove +aToPlaneFeature.real("A").setValue(0.0) +aToPlaneFeature.real("B").setValue(0.0) +aToPlaneFeature.real("C").setValue(1.0) +aToPlaneFeature.real("D").setValue(-50.0) aSession.finishOperation() aToResult = aToPlaneFeature.firstResult() aToShape = modelAPI_ResultConstruction(aToResult).shape() -#========================================================================= +# ========================================================================= # Test revol between bounding planes -#========================================================================= +# ========================================================================= aSession.startOperation() aRevolFt = aPart.addFeature("Revolution") -assert (aRevolFt.getKind() == "Revolution") +assert aRevolFt.getKind() == "Revolution" # selection type FACE=4 -aRevolFt.selectionList("base").append( - aCircleSketchResult, aCircleSketchResult.face(0)) +aRevolFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(0)) aRevolFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge) aRevolFt.string("CreationMethod").setValue("ByPlanesAndOffsets") -aRevolFt.real("from_angle").setValue(0) #TODO: remove -aRevolFt.real("to_angle").setValue(0) #TODO: remove +aRevolFt.real("from_angle").setValue(0) # TODO: remove +aRevolFt.real("to_angle").setValue(0) # TODO: remove aRevolFt.selection("to_object").setValue(aToResult, None) aRevolFt.real("to_offset").setValue(0) aRevolFt.selection("from_object").setValue(aFromResult, None) @@ -188,24 +190,23 @@ aRevolFt.execute() aSession.finishOperation() # Check revol results -assert (len(aRevolFt.results()) > 0) +assert len(aRevolFt.results()) > 0 aRevolResult = modelAPI_ResultBody(aRevolFt.firstResult()) -assert (aRevolResult is not None) +assert aRevolResult is not None aSession.undo() -#========================================================================= +# ========================================================================= # Test revol between bounding plane -#========================================================================= +# ========================================================================= aSession.startOperation() aRevolFt = aPart.addFeature("Revolution") -assert (aRevolFt.getKind() == "Revolution") +assert aRevolFt.getKind() == "Revolution" # selection type FACE=4 -aRevolFt.selectionList("base").append( - aCircleSketchResult, aCircleSketchResult.face(0)) +aRevolFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(0)) aRevolFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge) aRevolFt.string("CreationMethod").setValue("ByPlanesAndOffsets") -aRevolFt.real("from_angle").setValue(0) #TODO: remove -aRevolFt.real("to_angle").setValue(0) #TODO: remove +aRevolFt.real("from_angle").setValue(0) # TODO: remove +aRevolFt.real("to_angle").setValue(0) # TODO: remove aRevolFt.selection("to_object").setValue(aToResult, None) aRevolFt.real("to_offset").setValue(0) aRevolFt.selection("from_object").setValue(None, None) @@ -214,9 +215,10 @@ aRevolFt.execute() aSession.finishOperation() # Check revol results -assert (len(aRevolFt.results()) > 0) +assert len(aRevolFt.results()) > 0 aRevolResult = modelAPI_ResultBody(aRevolFt.firstResult()) -assert (aRevolResult is not None) +assert aRevolResult is not None from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRevolutionCut.py b/src/FeaturesPlugin/Test/TestRevolutionCut.py index e13c49f84..da4ef313d 100644 --- a/src/FeaturesPlugin/Test/TestRevolutionCut.py +++ b/src/FeaturesPlugin/Test/TestRevolutionCut.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -34,14 +34,14 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +assert len(aPartFeature.results()) == 1 # Another way is: # aPart = aSession.activeDocument() aPartResult = modelAPI_ResultPart(aPartFeature.firstResult()) aPart = aPartResult.partDoc() -#========================================================================= +# ========================================================================= # Create a sketch circle to extrude -#========================================================================= +# ========================================================================= aSession.startOperation() aCircleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")) @@ -57,36 +57,37 @@ aCircleRadius = aSketchCircle.real("circle_radius") anCircleCentr.setValue(0, 0) aCircleRadius.setValue(20) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on circle -#========================================================================= +# ========================================================================= # Build shape from sketcher results aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult()) -assert (aCircleSketchResult.facesNum() > 0) +assert aCircleSketchResult.facesNum() > 0 # Create extrusion aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "Extrusion") +assert anExtrusionFt.getKind() == "Extrusion" # selection type FACE=4 anExtrusionFt.selectionList("base").append( - aCircleSketchResult, aCircleSketchResult.face(0)) + aCircleSketchResult, aCircleSketchResult.face(0) +) 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.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) +assert anExtrusionFt.real("to_size").value() == 50.0 # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult is not None) +assert anExtrusionResult is not None -#========================================================================= +# ========================================================================= # Create a sketch line to revol -#========================================================================= +# ========================================================================= aSession.startOperation() aLineSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aLineSketchFeature.attribute("Origin")) @@ -110,12 +111,12 @@ aLineSketchShape = modelAPI_ResultConstruction(aLineSketchResult).shape() aShapeExplorer = GeomAPI_ShapeExplorer(aLineSketchShape, GeomAPI_Shape.EDGE) aLineEdge = aShapeExplorer.current() -#========================================================================= +# ========================================================================= # Make revolution cut -#========================================================================= +# ========================================================================= aSession.startOperation() anRevolutionCutFt = featureToCompositeFeature(aPart.addFeature("RevolutionCut")) -assert (anRevolutionCutFt.getKind() == "RevolutionCut") +assert anRevolutionCutFt.getKind() == "RevolutionCut" # selection type FACE=4 aSession.startOperation() aCircleSketchFeature = featureToCompositeFeature(anRevolutionCutFt.addFeature("Sketch")) @@ -135,26 +136,29 @@ aCircleRadius.setValue(10) aSession.finishOperation() aSession.finishOperation() aSession.startOperation() -aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled. +aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled. anRevolutionCutFt.selectionList("base").append(aCircleSketchFeature.firstResult(), None) anRevolutionCutFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge) anRevolutionCutFt.string("CreationMethod").setValue("ByAngles") anRevolutionCutFt.real("to_angle").setValue(50) anRevolutionCutFt.real("from_angle").setValue(50) -anRevolutionCutFt.real("to_offset").setValue(0) #TODO: remove -anRevolutionCutFt.real("from_offset").setValue(0) #TODO: remove -anRevolutionCutFt.selectionList("main_objects").append(anExtrusionResult, anExtrusionResult.shape()) +anRevolutionCutFt.real("to_offset").setValue(0) # TODO: remove +anRevolutionCutFt.real("from_offset").setValue(0) # TODO: remove +anRevolutionCutFt.selectionList("main_objects").append( + anExtrusionResult, anExtrusionResult.shape() +) aSession.finishOperation() aSession.finishOperation() -#========================================================================= +# ========================================================================= # Test results -#========================================================================= +# ========================================================================= aFactory = ModelAPI_Session.get().validators() -assert (aFactory.validate(anRevolutionCutFt)) -assert (len(anRevolutionCutFt.results()) > 0) +assert aFactory.validate(anRevolutionCutFt) +assert len(anRevolutionCutFt.results()) > 0 aCurrentResult = modelAPI_ResultBody(anRevolutionCutFt.firstResult()) -assert (aCurrentResult is not None) +assert aCurrentResult is not None from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRevolutionCut_ByAngle.py b/src/FeaturesPlugin/Test/TestRevolutionCut_ByAngle.py index 52bba4baa..d52d0476c 100644 --- a/src/FeaturesPlugin/Test/TestRevolutionCut_ByAngle.py +++ b/src/FeaturesPlugin/Test/TestRevolutionCut_ByAngle.py @@ -22,12 +22,20 @@ from GeomAPI import * import math -def checkMiddlePoint(shape, x, y, z, tolerance = 1.e-7): - assert(shape is not None) + +def checkMiddlePoint(shape, x, y, z, tolerance=1.0e-7): + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "{} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "{} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "{} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "{} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "{} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "{} != {}".format( + middlePoint.z(), z + ) + model.begin() partSet = model.moduleDocument() @@ -35,12 +43,22 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 45, [model.selection("SOLID", "Box_1_1")]) +RevolutionCut_1 = model.addRevolutionCut( + Part_1_doc, + [], + model.selection("EDGE", "PartSet/OZ"), + 45, + [model.selection("SOLID", "Box_1_1")], +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Left")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(5, 10, 2) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_1.center() +) RevolutionCut_1.setNestedSketch(Sketch_1) model.do() Shape = RevolutionCut_1.results()[0].resultSubShapePair()[0].shape() @@ -53,4 +71,4 @@ checkMiddlePoint(Shape, 5, 5, 5) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRevolutionCut_ByPlanesAndOffsets.py b/src/FeaturesPlugin/Test/TestRevolutionCut_ByPlanesAndOffsets.py index a554c0f47..29f6feb5c 100644 --- a/src/FeaturesPlugin/Test/TestRevolutionCut_ByPlanesAndOffsets.py +++ b/src/FeaturesPlugin/Test/TestRevolutionCut_ByPlanesAndOffsets.py @@ -22,12 +22,20 @@ from GeomAPI import * import math -def checkMiddlePoint(shape, x, y, z, tolerance = 1.e-7): - assert(shape is not None) + +def checkMiddlePoint(shape, x, y, z, tolerance=1.0e-7): + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "{} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "{} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "{} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "{} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "{} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "{} != {}".format( + middlePoint.z(), z + ) + model.begin() partSet = model.moduleDocument() @@ -35,22 +43,37 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [], model.selection("EDGE", "PartSet/OX"), model.selection("FACE", "Box_1_1/Right"), 0, model.selection(), 0, [model.selection("SOLID", "Box_1_1")]) +RevolutionCut_1 = model.addRevolutionCut( + Part_1_doc, + [], + model.selection("EDGE", "PartSet/OX"), + model.selection("FACE", "Box_1_1/Right"), + 0, + model.selection(), + 0, + [model.selection("SOLID", "Box_1_1")], +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Left")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(5, 10, 2) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_1.center() +) RevolutionCut_1.setNestedSketch(Sketch_1) model.do() Shape = RevolutionCut_1.results()[0].resultSubShapePair()[0].shape() checkMiddlePoint(Shape, 5, 4.760371965, 4.760372054) -RevolutionCut_1.setPlanesAndOffsets(model.selection(), 0, model.selection("FACE", "Box_1_1/Bottom"), 3) +RevolutionCut_1.setPlanesAndOffsets( + model.selection(), 0, model.selection("FACE", "Box_1_1/Bottom"), 3 +) model.do() Shape = RevolutionCut_1.results()[0].resultSubShapePair()[0].shape() checkMiddlePoint(Shape, 5, 4.7759476985, 4.74444379) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRevolutionCut_ThroughAll.py b/src/FeaturesPlugin/Test/TestRevolutionCut_ThroughAll.py index da4bc4e5a..191c71aad 100644 --- a/src/FeaturesPlugin/Test/TestRevolutionCut_ThroughAll.py +++ b/src/FeaturesPlugin/Test/TestRevolutionCut_ThroughAll.py @@ -21,12 +21,20 @@ from salome.shaper import model import math -def checkMiddlePoint(shape, x, y, z, tolerance = 1.e-7): - assert(shape is not None) + +def checkMiddlePoint(shape, x, y, z, tolerance=1.0e-7): + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "{} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "{} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "{} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "{} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "{} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "{} != {}".format( + middlePoint.z(), z + ) + model.begin() partSet = model.moduleDocument() @@ -34,19 +42,51 @@ 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"), 2, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 5, 5, 0) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 2, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 5, 5, 0 +) -RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), [model.selection("SOLID", "Box_1_1")]) +RevolutionCut_1 = model.addRevolutionCut( + Part_1_doc, + [], + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + [model.selection("SOLID", "Box_1_1")], +) -Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]__cc"), False) +Sketch_1 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"), +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]__cc", + ), + False, +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ), + False, +) SketchCircle_1 = SketchProjection_2.createdFeature() SketchCircle_2 = Sketch_1.addCircle(5, 5, 2) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_2.center()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_2.center() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) RevolutionCut_1.setNestedSketch(Sketch_1) @@ -57,4 +97,4 @@ checkMiddlePoint(Shape, 4.81498576, 5.0, 4.81498576) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRevolutionFuse.py b/src/FeaturesPlugin/Test/TestRevolutionFuse.py index ff405b504..cc335868b 100644 --- a/src/FeaturesPlugin/Test/TestRevolutionFuse.py +++ b/src/FeaturesPlugin/Test/TestRevolutionFuse.py @@ -45,9 +45,9 @@ data()->addAttribute(FROM_OFFSET_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(BOOLEAN_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()); """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -62,14 +62,14 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +assert len(aPartFeature.results()) == 1 # Another way is: # aPart = aSession.activeDocument() aPartResult = modelAPI_ResultPart(aPartFeature.firstResult()) aPart = aPartResult.partDoc() -#========================================================================= +# ========================================================================= # Create a sketch circle to extrude -#========================================================================= +# ========================================================================= aSession.startOperation() aCircleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")) @@ -85,36 +85,37 @@ aCircleRadius = aSketchCircle.real("circle_radius") anCircleCentr.setValue(0, 0) aCircleRadius.setValue(20) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on circle -#========================================================================= +# ========================================================================= # Build shape from sketcher results aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult()) -assert (aCircleSketchResult.facesNum() > 0) +assert aCircleSketchResult.facesNum() > 0 # Create extrusion aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "Extrusion") +assert anExtrusionFt.getKind() == "Extrusion" # selection type FACE=4 anExtrusionFt.selectionList("base").append( - aCircleSketchResult, aCircleSketchResult.face(0)) + aCircleSketchResult, aCircleSketchResult.face(0) +) 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.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) +assert anExtrusionFt.real("to_size").value() == 50.0 # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult is not None) +assert anExtrusionResult is not None -#========================================================================= +# ========================================================================= # Create a sketch line to revol -#========================================================================= +# ========================================================================= aSession.startOperation() aLineSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aLineSketchFeature.attribute("Origin")) @@ -138,15 +139,17 @@ aLineSketchShape = modelAPI_ResultConstruction(aLineSketchResult).shape() aShapeExplorer = GeomAPI_ShapeExplorer(aLineSketchShape, GeomAPI_Shape.EDGE) aLineEdge = aShapeExplorer.current() -#========================================================================= +# ========================================================================= # Make revolution fuse -#========================================================================= +# ========================================================================= aSession.startOperation() anRevolutionFuseFt = featureToCompositeFeature(aPart.addFeature("RevolutionFuse")) -assert (anRevolutionFuseFt.getKind() == "RevolutionFuse") +assert anRevolutionFuseFt.getKind() == "RevolutionFuse" # selection type FACE=4 aSession.startOperation() -aCircleSketchFeature = featureToCompositeFeature(anRevolutionFuseFt.addFeature("Sketch")) +aCircleSketchFeature = featureToCompositeFeature( + anRevolutionFuseFt.addFeature("Sketch") +) origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")) origin.setValue(0, 0, 50) dirx = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")) @@ -163,26 +166,31 @@ aCircleRadius.setValue(10) aSession.finishOperation() aSession.finishOperation() aSession.startOperation() -aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled. -anRevolutionFuseFt.selectionList("base").append(aCircleSketchFeature.firstResult(), None) +aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled. +anRevolutionFuseFt.selectionList("base").append( + aCircleSketchFeature.firstResult(), None +) anRevolutionFuseFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge) anRevolutionFuseFt.string("CreationMethod").setValue("ByAngles") anRevolutionFuseFt.real("to_angle").setValue(50) anRevolutionFuseFt.real("from_angle").setValue(50) -anRevolutionFuseFt.real("to_offset").setValue(0) #TODO: remove -anRevolutionFuseFt.real("from_offset").setValue(0) #TODO: remove -anRevolutionFuseFt.selectionList("main_objects").append(anExtrusionResult, anExtrusionResult.shape()) +anRevolutionFuseFt.real("to_offset").setValue(0) # TODO: remove +anRevolutionFuseFt.real("from_offset").setValue(0) # TODO: remove +anRevolutionFuseFt.selectionList("main_objects").append( + anExtrusionResult, anExtrusionResult.shape() +) aSession.finishOperation() aSession.finishOperation() -#========================================================================= +# ========================================================================= # Test results -#========================================================================= +# ========================================================================= aFactory = ModelAPI_Session.get().validators() -assert (aFactory.validate(anRevolutionFuseFt)) -assert (len(anRevolutionFuseFt.results()) > 0) +assert aFactory.validate(anRevolutionFuseFt) +assert len(anRevolutionFuseFt.results()) > 0 aCurrentResult = modelAPI_ResultBody(anRevolutionFuseFt.firstResult()) -assert (aCurrentResult is not None) +assert aCurrentResult is not None from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRevolutionFuse_ByAngle.py b/src/FeaturesPlugin/Test/TestRevolutionFuse_ByAngle.py index a67e478ca..13da4c18d 100644 --- a/src/FeaturesPlugin/Test/TestRevolutionFuse_ByAngle.py +++ b/src/FeaturesPlugin/Test/TestRevolutionFuse_ByAngle.py @@ -22,12 +22,20 @@ from GeomAPI import * import math -def checkMiddlePoint(shape, x, y, z, tolerance = 1.e-7): - assert(shape is not None) + +def checkMiddlePoint(shape, x, y, z, tolerance=1.0e-7): + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "{} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "{} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "{} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "{} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "{} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "{} != {}".format( + middlePoint.z(), z + ) + model.begin() partSet = model.moduleDocument() @@ -35,12 +43,22 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -RevolutionFuse_1 = model.addRevolutionFuse(Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 45, [model.selection("SOLID", "Box_1_1")]) +RevolutionFuse_1 = model.addRevolutionFuse( + Part_1_doc, + [], + model.selection("EDGE", "PartSet/OZ"), + 45, + [model.selection("SOLID", "Box_1_1")], +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Left")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(5, 10, 2) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_1.center() +) RevolutionFuse_1.setNestedSketch(Sketch_1) model.do() Shape = RevolutionFuse_1.results()[0].resultSubShapePair()[0].shape() @@ -53,4 +71,4 @@ checkMiddlePoint(Shape, 5, 4.21250167, 5.36769235) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRevolutionFuse_ByPlanesAndOffsets.py b/src/FeaturesPlugin/Test/TestRevolutionFuse_ByPlanesAndOffsets.py index 7c09c604d..d466f5718 100644 --- a/src/FeaturesPlugin/Test/TestRevolutionFuse_ByPlanesAndOffsets.py +++ b/src/FeaturesPlugin/Test/TestRevolutionFuse_ByPlanesAndOffsets.py @@ -22,12 +22,20 @@ from GeomAPI import * import math -def checkMiddlePoint(shape, x, y, z, tolerance = 1.e-7): - assert(shape is not None) + +def checkMiddlePoint(shape, x, y, z, tolerance=1.0e-7): + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "{} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "{} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "{} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "{} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "{} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "{} != {}".format( + middlePoint.z(), z + ) + model.begin() partSet = model.moduleDocument() @@ -35,22 +43,37 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -RevolutionFuse_1 = model.addRevolutionFuse(Part_1_doc, [], model.selection("EDGE", "PartSet/OX"), model.selection("FACE", "Box_1_1/Right"), 0, model.selection(), 0, [model.selection("SOLID", "Box_1_1")]) +RevolutionFuse_1 = model.addRevolutionFuse( + Part_1_doc, + [], + model.selection("EDGE", "PartSet/OX"), + model.selection("FACE", "Box_1_1/Right"), + 0, + model.selection(), + 0, + [model.selection("SOLID", "Box_1_1")], +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Left")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(5, 10, 2) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_1.center() +) RevolutionFuse_1.setNestedSketch(Sketch_1) model.do() Shape = RevolutionFuse_1.results()[0].resultSubShapePair()[0].shape() checkMiddlePoint(Shape, 5.000000277, 2.2088446592, 2.5458802675) -RevolutionFuse_1.setPlanesAndOffsets(model.selection(), 0, model.selection("FACE", "Box_1_1/Bottom"), 0) +RevolutionFuse_1.setPlanesAndOffsets( + model.selection(), 0, model.selection("FACE", "Box_1_1/Bottom"), 0 +) model.do() Shape = RevolutionFuse_1.results()[0].resultSubShapePair()[0].shape() checkMiddlePoint(Shape, 5, 3.0990965, 5.350448567) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRevolutionFuse_ThroughAll.py b/src/FeaturesPlugin/Test/TestRevolutionFuse_ThroughAll.py index d4af62a64..f50f3a952 100644 --- a/src/FeaturesPlugin/Test/TestRevolutionFuse_ThroughAll.py +++ b/src/FeaturesPlugin/Test/TestRevolutionFuse_ThroughAll.py @@ -21,12 +21,20 @@ from salome.shaper import model import math -def checkMiddlePoint(shape, x, y, z, tolerance = 1.e-7): - assert(shape is not None) + +def checkMiddlePoint(shape, x, y, z, tolerance=1.0e-7): + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "{} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "{} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "{} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "{} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "{} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "{} != {}".format( + middlePoint.z(), z + ) + model.begin() partSet = model.moduleDocument() @@ -34,19 +42,51 @@ 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"), 2, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 5, 5, 0) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 2, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 5, 5, 0 +) -RevolutionFuse_1 = model.addRevolutionFuse(Part_1_doc, [], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), [model.selection("SOLID", "Box_1_1")]) +RevolutionFuse_1 = model.addRevolutionFuse( + Part_1_doc, + [], + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + [model.selection("SOLID", "Box_1_1")], +) -Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]__cc"), False) +Sketch_1 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"), +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]__cc", + ), + False, +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ), + False, +) SketchCircle_1 = SketchProjection_2.createdFeature() SketchCircle_2 = Sketch_1.addCircle(5, 5, 2) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_2.center()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_2.center() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) RevolutionFuse_1.setNestedSketch(Sketch_1) @@ -57,4 +97,4 @@ checkMiddlePoint(Shape, 6.3892968486, 5.0, 6.3892968486) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRevolutionOfCompound.py b/src/FeaturesPlugin/Test/TestRevolutionOfCompound.py index 0af057cc6..70095f319 100644 --- a/src/FeaturesPlugin/Test/TestRevolutionOfCompound.py +++ b/src/FeaturesPlugin/Test/TestRevolutionOfCompound.py @@ -28,8 +28,22 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(15, -20, 8) SketchCircle_2 = Sketch_1.addCircle(35, -35, 15) model.do() -Compound_1 = model.addCompound(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")]) -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], model.selection("EDGE", "PartSet/OX"), model.selection(), 0, model.selection("FACE", "PartSet/XOZ"), 0) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), + model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f"), + ], +) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("COMPOUND", "Compound_1_1")], + model.selection("EDGE", "PartSet/OX"), + model.selection(), + 0, + model.selection("FACE", "PartSet/XOZ"), + 0, +) model.do() Part_2 = model.addPart(partSet) @@ -38,8 +52,20 @@ Sketch_2 = model.addSketch(Part_2_doc, model.defaultPlane("XOY")) SketchCircle_3 = Sketch_2.addCircle(15, -20, 8) SketchCircle_4 = Sketch_2.addCircle(35, -35, 15) model.do() -Compound_2 = model.addCompound(Part_2_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")]) -Revolution_2 = model.addRevolution(Part_2_doc, [model.selection("COMPOUND", "Compound_1_1")], model.selection("EDGE", "PartSet/OX"), 90, 0) +Compound_2 = model.addCompound( + Part_2_doc, + [ + model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), + model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f"), + ], +) +Revolution_2 = model.addRevolution( + Part_2_doc, + [model.selection("COMPOUND", "Compound_1_1")], + model.selection("EDGE", "PartSet/OX"), + 90, + 0, +) model.do() Part_3 = model.addPart(partSet) @@ -48,8 +74,22 @@ Sketch_3 = model.addSketch(Part_3_doc, model.defaultPlane("XOY")) SketchCircle_5 = Sketch_3.addCircle(15, -20, 8) SketchCircle_6 = Sketch_3.addCircle(35, -35, 15) model.do() -Compound_3 = model.addCompound(Part_3_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")]) -Revolution_3 = model.addRevolution(Part_3_doc, [model.selection("COMPOUND", "Compound_1_1")], model.selection("EDGE", "PartSet/OX"), model.selection("FACE", "PartSet/XOY"), 0, model.selection("FACE", "PartSet/XOZ"), 0) +Compound_3 = model.addCompound( + Part_3_doc, + [ + model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), + model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f"), + ], +) +Revolution_3 = model.addRevolution( + Part_3_doc, + [model.selection("COMPOUND", "Compound_1_1")], + model.selection("EDGE", "PartSet/OX"), + model.selection("FACE", "PartSet/XOY"), + 0, + model.selection("FACE", "PartSet/XOZ"), + 0, +) model.do() model.end() @@ -80,4 +120,4 @@ model.testNbSubShapes(Revolution_3, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Revolution_3, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Revolution_3, [38861.56733864]) -assert(model.checkPythonDump()) \ No newline at end of file +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRevolutionOfEdge.py b/src/FeaturesPlugin/Test/TestRevolutionOfEdge.py index c1ba54940..0ac7601b5 100644 --- a/src/FeaturesPlugin/Test/TestRevolutionOfEdge.py +++ b/src/FeaturesPlugin/Test/TestRevolutionOfEdge.py @@ -26,9 +26,21 @@ 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, 0, 10) -Polyline_1 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")], False) +Polyline_1 = model.addPolyline3D( + Part_1_doc, + [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")], + False, +) -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("EDGE", "Polyline_1_1/Generated_Edge&Point_1/Point_1")], model.selection("EDGE", "PartSet/OZ"), model.selection(), 0, model.selection("FACE", "PartSet/XOZ"), 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("EDGE", "Polyline_1_1/Generated_Edge&Point_1/Point_1")], + model.selection("EDGE", "PartSet/OZ"), + model.selection(), + 0, + model.selection("FACE", "PartSet/XOZ"), + 0, +) model.testNbResults(Revolution_1, 1) model.testNbSubResults(Revolution_1, [0]) @@ -38,7 +50,9 @@ model.testNbSubShapes(Revolution_1, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Revolution_1, GeomAPI_Shape.VERTEX, [8]) model.testResultsAreas(Revolution_1, [666.43244]) -Revolution_1.setPlanesAndOffsets(model.selection("FACE", "PartSet/YOZ"), 0, model.selection("FACE", "PartSet/XOZ"), 0) +Revolution_1.setPlanesAndOffsets( + model.selection("FACE", "PartSet/YOZ"), 0, model.selection("FACE", "PartSet/XOZ"), 0 +) model.testNbResults(Revolution_1, 1) model.testNbSubResults(Revolution_1, [0]) @@ -50,4 +64,4 @@ model.testResultsAreas(Revolution_1, [333.21622]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRevolutionOfPoint.py b/src/FeaturesPlugin/Test/TestRevolutionOfPoint.py index d83031067..87c7e6c77 100644 --- a/src/FeaturesPlugin/Test/TestRevolutionOfPoint.py +++ b/src/FeaturesPlugin/Test/TestRevolutionOfPoint.py @@ -22,13 +22,21 @@ from GeomAPI import * import math -def checkMiddlePoint(shape, x, y, z, tolerance = 1.e-7): - assert(shape is not None) - assert(shape.isEdge()) + +def checkMiddlePoint(shape, x, y, z, tolerance=1.0e-7): + assert shape is not None + assert shape.isEdge() middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "{} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "{} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "{} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "{} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "{} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "{} != {}".format( + middlePoint.z(), z + ) + model.begin() partSet = model.moduleDocument() @@ -37,14 +45,24 @@ Part_1_doc = Part_1.document() Point_2 = model.addPoint(Part_1_doc, 10, 0, 0) Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_1")]) -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("EDGE", "PartSet/OZ"), model.selection(), 0, model.selection("FACE", "PartSet/XOZ"), 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("VERTEX", "Vertex_1_1")], + model.selection("EDGE", "PartSet/OZ"), + model.selection(), + 0, + model.selection("FACE", "PartSet/XOZ"), + 0, +) Shape = Revolution_1.results()[0].resultSubShapePair()[0].shape() checkMiddlePoint(Shape, 0, -10, 0) -Revolution_1.setPlanesAndOffsets(model.selection("FACE", "PartSet/YOZ"), 0, model.selection("FACE", "PartSet/XOZ"), 0) +Revolution_1.setPlanesAndOffsets( + model.selection("FACE", "PartSet/YOZ"), 0, model.selection("FACE", "PartSet/XOZ"), 0 +) Shape = Revolution_1.results()[0].resultSubShapePair()[0].shape() checkMiddlePoint(Shape, 7.071067811865474, -7.071067811865474, 0) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRevolution_ByAngle.py b/src/FeaturesPlugin/Test/TestRevolution_ByAngle.py index e50d672cf..f00aa6fd8 100644 --- a/src/FeaturesPlugin/Test/TestRevolution_ByAngle.py +++ b/src/FeaturesPlugin/Test/TestRevolution_ByAngle.py @@ -22,19 +22,29 @@ from GeomAPI import * import math -def checkMiddlePoint(shape, x, y, z, tolerance = 1.e-7): - assert(shape is not None) + +def checkMiddlePoint(shape, x, y, z, tolerance=1.0e-7): + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "{} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "{} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "{} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "{} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "{} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "{} != {}".format( + middlePoint.z(), z + ) + model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Revolution_1 = model.addRevolution(Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 90) +Revolution_1 = model.addRevolution( + Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 90 +) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchCircle_1 = Sketch_1.addCircle(30, 20, 15) Revolution_1.setNestedSketch(Sketch_1) @@ -49,4 +59,4 @@ checkMiddlePoint(Shape, 14.5229101, 30, 14.5229101) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRotation.py b/src/FeaturesPlugin/Test/TestRotation.py index 561d82ec1..7eda1170f 100644 --- a/src/FeaturesPlugin/Test/TestRotation.py +++ b/src/FeaturesPlugin/Test/TestRotation.py @@ -31,9 +31,9 @@ data()->addAttribute(AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(ANGLE_ID(), ModelAPI_AttributeDouble::typeId()); """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -46,15 +46,15 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +assert len(aPartFeature.results()) == 1 # Another way is: # aPart = aSession.activeDocument() aPartResult = modelAPI_ResultPart(aPartFeature.firstResult()) aPart = aPartResult.partDoc() -#========================================================================= +# ========================================================================= # Create a sketch circle to extrude -#========================================================================= +# ========================================================================= aSession.startOperation() aCircleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")) @@ -70,36 +70,37 @@ aCircleRadius = aSketchCircle.real("circle_radius") anCircleCentr.setValue(50, 50) aCircleRadius.setValue(20) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on circle -#========================================================================= +# ========================================================================= # Build shape from sketcher results aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult()) -assert (aCircleSketchResult.facesNum() > 0) +assert aCircleSketchResult.facesNum() > 0 # Create extrusion aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "Extrusion") +assert anExtrusionFt.getKind() == "Extrusion" # selection type FACE=4 anExtrusionFt.selectionList("base").append( - aCircleSketchResult, aCircleSketchResult.face(0)) + aCircleSketchResult, aCircleSketchResult.face(0) +) 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.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) +assert anExtrusionFt.real("to_size").value() == 50 # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult is not None) +assert anExtrusionResult is not None -#========================================================================= +# ========================================================================= # Create a sketch line to rotation -#========================================================================= +# ========================================================================= aSession.startOperation() aLineSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aLineSketchFeature.attribute("Origin")) @@ -122,27 +123,29 @@ aLineSketchShape = modelAPI_ResultConstruction(aLineSketchResult).shape() aShapeExplorer = GeomAPI_ShapeExplorer(aLineSketchShape, GeomAPI_Shape.EDGE) aLineEdge = aShapeExplorer.current() -#========================================================================= +# ========================================================================= # Test rotation -#========================================================================= +# ========================================================================= aSession.startOperation() aRotateFt = aPart.addFeature("Rotation") -assert (aRotateFt.getKind() == "Rotation") +assert aRotateFt.getKind() == "Rotation" aRotateFt.selectionList("main_objects").append( - anExtrusionResult, anExtrusionResult.shape()) + anExtrusionResult, anExtrusionResult.shape() +) aRotateFt.string("CreationMethod").setValue("ByAxisAndAngle") aRotateFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge) aRotateFt.real("angle").setValue(90) aRotateFt.execute() aSession.finishOperation() -assert (aRotateFt.real("angle").value() == 90) +assert aRotateFt.real("angle").value() == 90 # Check rotation results aFactory = ModelAPI_Session.get().validators() -assert (aFactory.validate(aRotateFt)) -assert (len(aRotateFt.results()) > 0) +assert aFactory.validate(aRotateFt) +assert len(aRotateFt.results()) > 0 aMoveResult = modelAPI_ResultBody(aRotateFt.firstResult()) -assert (aMoveResult is not None) +assert aMoveResult is not None from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRotation_ByAxis.py b/src/FeaturesPlugin/Test/TestRotation_ByAxis.py index 2343639e5..674ddfc6c 100644 --- a/src/FeaturesPlugin/Test/TestRotation_ByAxis.py +++ b/src/FeaturesPlugin/Test/TestRotation_ByAxis.py @@ -22,12 +22,20 @@ from GeomAPI import * import math -def checkMiddlePoint(shape, x, y, z, tolerance = 1.e-7): - assert(shape is not None) + +def checkMiddlePoint(shape, x, y, z, tolerance=1.0e-7): + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "{} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "{} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "{} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "{} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "{} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "{} != {}".format( + middlePoint.z(), z + ) + model.begin() partSet = model.moduleDocument() @@ -36,7 +44,12 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 5) -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), 45) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), + 45, +) Shape = Rotation_1.results()[0].resultSubShapePair()[0].shape() checkMiddlePoint(Shape, 0, 7.071067811865, 5) @@ -50,4 +63,4 @@ checkMiddlePoint(Shape, 2.928932188135, -7.071067811865, 0) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRotation_ByPoints.py b/src/FeaturesPlugin/Test/TestRotation_ByPoints.py index a2f6921b3..2c79c02bf 100644 --- a/src/FeaturesPlugin/Test/TestRotation_ByPoints.py +++ b/src/FeaturesPlugin/Test/TestRotation_ByPoints.py @@ -22,12 +22,20 @@ from GeomAPI import * import math -def checkMiddlePoint(shape, x, y, z, tolerance = 1.e-7): - assert(shape is not None) + +def checkMiddlePoint(shape, x, y, z, tolerance=1.0e-7): + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "{} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "{} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "{} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "{} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "{} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "{} != {}".format( + middlePoint.z(), z + ) + model.begin() partSet = model.moduleDocument() @@ -36,10 +44,16 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 5) -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], 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/Left][Box_1_1/Bottom]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]")) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + 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/Left][Box_1_1/Bottom]"), + model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]"), +) Shape = Rotation_1.results()[0].resultSubShapePair()[0].shape() checkMiddlePoint(Shape, 0, 7.071067811865, 5) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRotation_ErrorMsg.py b/src/FeaturesPlugin/Test/TestRotation_ErrorMsg.py index 5088449ae..79f7041d0 100644 --- a/src/FeaturesPlugin/Test/TestRotation_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestRotation_ErrorMsg.py @@ -23,10 +23,11 @@ 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_1 = model.addBox(Part_1_doc, 10, 10, 10) model.end() from ModelAPI import * + aSession = ModelAPI_Session.get() aShapeToMove = Box_1.feature().lastResult() @@ -37,32 +38,32 @@ aRotation = featureToCompositeFeature(Part_1.feature()).addFeature("Rotation") aRotation.string("CreationMethod").setValue("ByAxisAndAngle") aRotation.execute() aSession.finishOperation() -assert(aRotation.error() != "") +assert aRotation.error() != "" aSession.startOperation() aRotation.selectionList("main_objects").append(aShapeToMove, aShapeToMove.shape()) aRotation.execute() aSession.finishOperation() -assert(aRotation.error() != "") +assert aRotation.error() != "" aSession.startOperation() aRotation.selectionList("main_objects").append(None, None) aRotation.execute() aSession.finishOperation() -assert(aRotation.error() != "") +assert aRotation.error() != "" aSession.startOperation() aRotation.string("CreationMethod").setValue("ByThreePoints") aRotation.execute() aSession.finishOperation() -assert(aRotation.error() != "") +assert aRotation.error() != "" aSession.startOperation() aRotation.selectionList("main_objects").removeLast() aRotation.selectionList("main_objects").removeLast() aRotation.execute() aSession.finishOperation() -assert(aRotation.error() != "") +assert aRotation.error() != "" aSession.startOperation() aRotation.selectionList("main_objects").append(aShapeToMove, aShapeToMove.shape()) @@ -70,10 +71,10 @@ aRotation.string("CreationMethod").setValue("ByAxisAndAngle") aRotation.selection("axis_object").selectSubShape("FACE", "Box_1_1/Back") aRotation.execute() aSession.finishOperation() -assert(aRotation.error() != "") +assert aRotation.error() != "" aSession.startOperation() aRotation.selection("axis_object").selectSubShape("COMPOUND", "Box_1_1/Back") aRotation.execute() aSession.finishOperation() -assert(aRotation.error() != "") +assert aRotation.error() != "" diff --git a/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v0_1.py b/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v0_1.py index d645a4cd3..8b70f89fa 100644 --- a/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v0_1.py +++ b/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v0_1.py @@ -27,42 +27,118 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() ANGLE = 45 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 ORIGIN = GeomAPI_Pnt(0, 0, 0) OX = GeomAPI_Ax1(ORIGIN, GeomAPI_Dir(1, 0, 0)) @@ -71,7 +147,12 @@ OZ = GeomAPI_Ax1(ORIGIN, GeomAPI_Dir(0, 0, 1)) model.begin() -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("EDGE", "PartSet/OX"), ANGLE) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("EDGE", "PartSet/OX"), + ANGLE, +) model.testNbResults(Rotation_1, 1) model.testNbSubResults(Rotation_1, [0]) model.testNbSubShapes(Rotation_1, GeomAPI_Shape.SOLID, [1]) @@ -80,14 +161,21 @@ model.testNbSubShapes(Rotation_1, GeomAPI_Shape.EDGE, [18]) model.testNbSubShapes(Rotation_1, GeomAPI_Shape.VERTEX, [36]) model.testResultsVolumes(Rotation_1, [542.746463956]) -refPoint = Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint() +) refPoint.rotate(OX, ANGLE) midPoint = Rotation_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, Rotation_1, [Compound_2.result()], True) -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_1_1_2_1")], model.selection("EDGE", "PartSet/OY"), ANGLE) +Rotation_2 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Recover_1_1_2_1")], + model.selection("EDGE", "PartSet/OY"), + ANGLE, +) model.testNbResults(Rotation_2, 1) model.testNbSubResults(Rotation_2, [0]) model.testNbSubShapes(Rotation_2, GeomAPI_Shape.SOLID, [1]) @@ -96,14 +184,26 @@ model.testNbSubShapes(Rotation_2, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Rotation_2, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Rotation_2, [785.39816339745]) -refPoint = Recover_1.result().subResult(1).subResult(0).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Recover_1.result() + .subResult(1) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint() +) refPoint.rotate(OY, ANGLE) midPoint = Rotation_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, Rotation_2, [Recover_1.result()], True) -Rotation_3 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_2_1_3")], model.selection("EDGE", "PartSet/OZ"), ANGLE) +Rotation_3 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Recover_2_1_3")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, +) model.testNbResults(Rotation_3, 1) model.testNbSubResults(Rotation_3, [0]) model.testNbSubShapes(Rotation_3, GeomAPI_Shape.SOLID, [1]) @@ -115,11 +215,20 @@ model.testResultsVolumes(Rotation_3, [785.39816339745]) refPoint = Recover_2.result().subResult(2).resultSubShapePair()[0].shape().middlePoint() refPoint.rotate(OZ, ANGLE) midPoint = Rotation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_3 = model.addRecover(Part_1_doc, Rotation_3, [Recover_2.result()], True) -Rotation_4 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_3_1_1_1"), model.selection("SOLID", "Recover_3_1_2_2"), model.selection("SOLID", "Recover_3_1_3")], model.selection("EDGE", "PartSet/OZ"), -ANGLE) +Rotation_4 = model.addRotation( + Part_1_doc, + [ + model.selection("SOLID", "Recover_3_1_1_1"), + model.selection("SOLID", "Recover_3_1_2_2"), + model.selection("SOLID", "Recover_3_1_3"), + ], + model.selection("EDGE", "PartSet/OZ"), + -ANGLE, +) model.testNbResults(Rotation_4, 3) model.testNbSubResults(Rotation_4, [0, 0, 0]) model.testNbSubShapes(Rotation_4, GeomAPI_Shape.SOLID, [1, 1, 1]) @@ -128,14 +237,26 @@ model.testNbSubShapes(Rotation_4, GeomAPI_Shape.EDGE, [24, 6, 6]) model.testNbSubShapes(Rotation_4, GeomAPI_Shape.VERTEX, [48, 12, 12]) model.testResultsVolumes(Rotation_4, [3444.394198615, 785.39816339745, 785.39816339745]) -REFERENCE = [Recover_3.result().subResult(0).subResult(0).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(1).subResult(1).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()] +REFERENCE = [ + Recover_3.result() + .subResult(0) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result() + .subResult(1) + .subResult(1) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint(), +] for res, ref in zip(Rotation_4.results(), REFERENCE): ref.rotate(OZ, -ANGLE) midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE) + assert midPoint.distance(ref) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v0_2.py b/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v0_2.py index ff4980399..61772f9ce 100644 --- a/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v0_2.py +++ b/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v0_2.py @@ -27,48 +27,132 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 CENTER = SketchEllipse_1.secondFocus().pnt() -ANGLE = GeomAPI_Angle2d(CENTER, GeomAPI_Pnt2d(0, 0), SketchCircle_1.center().pnt()).angleDegree() +ANGLE = GeomAPI_Angle2d( + CENTER, GeomAPI_Pnt2d(0, 0), SketchCircle_1.center().pnt() +).angleDegree() AXIS = GeomAPI_Ax1(GeomAPI_Pnt(CENTER.x(), CENTER.y(), 0), GeomAPI_Dir(0, 0, 1)) model.begin() -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_second_focus"), model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Sketch_1/SketchCircle_1")) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_second_focus"), + model.selection("VERTEX", "PartSet/Origin"), + model.selection("VERTEX", "Sketch_1/SketchCircle_1"), +) model.testNbResults(Rotation_1, 1) model.testNbSubResults(Rotation_1, [0]) model.testNbSubShapes(Rotation_1, GeomAPI_Shape.SOLID, [1]) @@ -77,14 +161,22 @@ model.testNbSubShapes(Rotation_1, GeomAPI_Shape.EDGE, [18]) model.testNbSubShapes(Rotation_1, GeomAPI_Shape.VERTEX, [36]) model.testResultsVolumes(Rotation_1, [542.746463956]) -refPoint = Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint() +) refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, Rotation_1, [Compound_2.result()], True) -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_1_1_2_1")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_second_focus"), model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Sketch_1/SketchCircle_1")) +Rotation_2 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Recover_1_1_2_1")], + model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_second_focus"), + model.selection("VERTEX", "PartSet/Origin"), + model.selection("VERTEX", "Sketch_1/SketchCircle_1"), +) model.testNbResults(Rotation_2, 1) model.testNbSubResults(Rotation_2, [0]) model.testNbSubShapes(Rotation_2, GeomAPI_Shape.SOLID, [1]) @@ -93,14 +185,27 @@ model.testNbSubShapes(Rotation_2, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Rotation_2, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Rotation_2, [785.39816339745]) -refPoint = Recover_1.result().subResult(1).subResult(0).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Recover_1.result() + .subResult(1) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint() +) refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, Rotation_2, [Recover_1.result()], True) -Rotation_3 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_2_1_3")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_second_focus"), model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Sketch_1/SketchCircle_1")) +Rotation_3 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Recover_2_1_3")], + model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_second_focus"), + model.selection("VERTEX", "PartSet/Origin"), + model.selection("VERTEX", "Sketch_1/SketchCircle_1"), +) model.testNbResults(Rotation_3, 1) model.testNbSubResults(Rotation_3, [0]) model.testNbSubShapes(Rotation_3, GeomAPI_Shape.SOLID, [1]) @@ -112,11 +217,21 @@ model.testResultsVolumes(Rotation_3, [785.39816339745]) refPoint = Recover_2.result().subResult(2).resultSubShapePair()[0].shape().middlePoint() refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_3 = model.addRecover(Part_1_doc, Rotation_3, [Recover_2.result()], True) -Rotation_4 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_3_1_1_1"), model.selection("SOLID", "Recover_3_1_2_2"), model.selection("SOLID", "Recover_3_1_3")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_second_focus"), model.selection("VERTEX", "Sketch_1/SketchCircle_1"), model.selection("VERTEX", "PartSet/Origin")) +Rotation_4 = model.addRotation( + Part_1_doc, + [ + model.selection("SOLID", "Recover_3_1_1_1"), + model.selection("SOLID", "Recover_3_1_2_2"), + model.selection("SOLID", "Recover_3_1_3"), + ], + model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_second_focus"), + model.selection("VERTEX", "Sketch_1/SketchCircle_1"), + model.selection("VERTEX", "PartSet/Origin"), +) model.testNbResults(Rotation_4, 3) model.testNbSubResults(Rotation_4, [0, 0, 0]) model.testNbSubShapes(Rotation_4, GeomAPI_Shape.SOLID, [1, 1, 1]) @@ -125,14 +240,26 @@ model.testNbSubShapes(Rotation_4, GeomAPI_Shape.EDGE, [24, 6, 6]) model.testNbSubShapes(Rotation_4, GeomAPI_Shape.VERTEX, [48, 12, 12]) model.testResultsVolumes(Rotation_4, [3444.394198615, 785.39816339745, 785.39816339745]) -REFERENCE = [Recover_3.result().subResult(0).subResult(0).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(1).subResult(1).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()] +REFERENCE = [ + Recover_3.result() + .subResult(0) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result() + .subResult(1) + .subResult(1) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint(), +] for res, ref in zip(Rotation_4.results(), REFERENCE): ref.rotate(AXIS, -ANGLE) midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE) + assert midPoint.distance(ref) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v0_3.py b/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v0_3.py index 4577934e6..87ae0b18e 100644 --- a/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v0_3.py +++ b/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v0_3.py @@ -26,61 +26,176 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 ANGLE = 30 AXIS = GeomAPI_Ax1(GeomAPI_Pnt(0, 0, 0), GeomAPI_Dir(0, 0, 1)) model.begin() -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("EDGE", "PartSet/OZ"), ANGLE) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("VERTEX", "Vertex_1_1")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, +) model.testNbResults(Rotation_1, 1) model.testNbSubResults(Rotation_1, [0]) model.testNbSubShapes(Rotation_1, GeomAPI_Shape.SOLID, [0]) @@ -92,9 +207,14 @@ model.testResultsAreas(Rotation_1, [0]) refPoint = Vertex_1.defaultResult().shape().middlePoint() refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OZ"), ANGLE) +Rotation_2 = model.addRotation( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, +) model.testNbResults(Rotation_2, 1) model.testNbSubResults(Rotation_2, [0]) model.testNbSubShapes(Rotation_2, GeomAPI_Shape.SOLID, [0]) @@ -106,9 +226,14 @@ model.testResultsAreas(Rotation_2, [0]) refPoint = Edge_1.defaultResult().shape().middlePoint() refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Rotation_3 = model.addRotation(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("EDGE", "PartSet/OZ"), ANGLE) +Rotation_3 = model.addRotation( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, +) model.testNbResults(Rotation_3, 1) model.testNbSubResults(Rotation_3, [0]) model.testNbSubShapes(Rotation_3, GeomAPI_Shape.SOLID, [0]) @@ -120,9 +245,14 @@ model.testResultsAreas(Rotation_3, [0]) refPoint = Wire_1.defaultResult().shape().middlePoint() refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Rotation_4 = model.addRotation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), ANGLE) +Rotation_4 = model.addRotation( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, +) model.testNbResults(Rotation_4, 1) model.testNbSubResults(Rotation_4, [0]) model.testNbSubShapes(Rotation_4, GeomAPI_Shape.SOLID, [0]) @@ -134,9 +264,14 @@ model.testResultsAreas(Rotation_4, [109.154152964914914]) refPoint = Face_1.defaultResult().shape().middlePoint() refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Rotation_5 = model.addRotation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OZ"), ANGLE) +Rotation_5 = model.addRotation( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, +) model.testNbResults(Rotation_5, 1) model.testNbSubResults(Rotation_5, [0]) model.testNbSubShapes(Rotation_5, GeomAPI_Shape.SOLID, [0]) @@ -148,9 +283,14 @@ model.testResultsAreas(Rotation_5, [182.822012116]) refPoint = Shell_1.defaultResult().shape().middlePoint() refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Rotation_6 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OZ"), ANGLE) +Rotation_6 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, +) model.testNbResults(Rotation_6, 1) model.testNbSubResults(Rotation_6, [0]) model.testNbSubShapes(Rotation_6, GeomAPI_Shape.SOLID, [1]) @@ -161,9 +301,14 @@ model.testResultsVolumes(Rotation_6, [1000]) refPoint = Translation_1.defaultResult().shape().middlePoint() refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Rotation_7 = model.addRotation(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("EDGE", "PartSet/OZ"), ANGLE) +Rotation_7 = model.addRotation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, +) model.testNbResults(Rotation_7, 1) model.testNbSubResults(Rotation_7, [3]) model.testNbSubShapes(Rotation_7, GeomAPI_Shape.SOLID, [3]) @@ -173,9 +318,14 @@ model.testNbSubShapes(Rotation_7, GeomAPI_Shape.VERTEX, [132]) model.testResultsVolumes(Rotation_7, [1589.0486226]) refPoint = GeomAPI_Pnt(1.830127, 4.330127, 5.0) midPoint = Rotation_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Rotation_8 = model.addRotation(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], model.selection("EDGE", "PartSet/OZ"), ANGLE) +Rotation_8 = model.addRotation( + Part_1_doc, + [model.selection("COMPOUND", "AngularCopy_1_1")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, +) model.testNbResults(Rotation_8, 1) model.testNbSubResults(Rotation_8, [3]) model.testNbSubShapes(Rotation_8, GeomAPI_Shape.SOLID, [3]) @@ -185,8 +335,8 @@ model.testNbSubShapes(Rotation_8, GeomAPI_Shape.VERTEX, [144]) model.testResultsVolumes(Rotation_8, [3000]) refPoint = GeomAPI_Pnt(-38.169872981, 28.4807621, 5.0) midPoint = Rotation_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v0_4.py b/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v0_4.py index 87ea4bf70..455d3310d 100644 --- a/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v0_4.py +++ b/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v0_4.py @@ -26,63 +26,187 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 ANGLE = 30 AXIS = GeomAPI_Ax1(GeomAPI_Pnt(0, 0, 0), GeomAPI_Dir(0, 0, 1)) model.begin() -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("VERTEX", "Compound_1_1_1")], model.selection("EDGE", "PartSet/OZ"), ANGLE) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("VERTEX", "Compound_1_1_1")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, +) model.testNbResults(Rotation_1, 1) model.testNbSubResults(Rotation_1, [0]) model.testNbSubShapes(Rotation_1, GeomAPI_Shape.SOLID, [0]) @@ -91,13 +215,20 @@ model.testNbSubShapes(Rotation_1, GeomAPI_Shape.EDGE, [0]) model.testNbSubShapes(Rotation_1, GeomAPI_Shape.VERTEX, [1]) model.testResultsVolumes(Rotation_1, [0]) model.testResultsAreas(Rotation_1, [0]) -refPoint = Compound_1.result().subResult(0).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Compound_1.result().subResult(0).resultSubShapePair()[0].shape().middlePoint() +) refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, Rotation_1, [Compound_1.result()], True) -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("EDGE", "Recover_1_1_2")], model.selection("EDGE", "PartSet/OZ"), ANGLE) +Rotation_2 = model.addRotation( + Part_1_doc, + [model.selection("EDGE", "Recover_1_1_2")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, +) model.testNbResults(Rotation_2, 1) model.testNbSubResults(Rotation_2, [0]) model.testNbSubShapes(Rotation_2, GeomAPI_Shape.SOLID, [0]) @@ -106,13 +237,20 @@ model.testNbSubShapes(Rotation_2, GeomAPI_Shape.EDGE, [1]) model.testNbSubShapes(Rotation_2, GeomAPI_Shape.VERTEX, [2]) model.testResultsVolumes(Rotation_2, [0]) model.testResultsAreas(Rotation_2, [0]) -refPoint = Compound_1.result().subResult(1).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Compound_1.result().subResult(1).resultSubShapePair()[0].shape().middlePoint() +) refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, Rotation_2, [Recover_1.result()]) -Rotation_3 = model.addRotation(Part_1_doc, [model.selection("WIRE", "Recover_2_1_3")], model.selection("EDGE", "PartSet/OZ"), ANGLE) +Rotation_3 = model.addRotation( + Part_1_doc, + [model.selection("WIRE", "Recover_2_1_3")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, +) model.testNbResults(Rotation_3, 1) model.testNbSubResults(Rotation_3, [0]) model.testNbSubShapes(Rotation_3, GeomAPI_Shape.SOLID, [0]) @@ -121,13 +259,20 @@ model.testNbSubShapes(Rotation_3, GeomAPI_Shape.EDGE, [2]) model.testNbSubShapes(Rotation_3, GeomAPI_Shape.VERTEX, [4]) model.testResultsVolumes(Rotation_3, [0]) model.testResultsAreas(Rotation_3, [0]) -refPoint = Compound_1.result().subResult(2).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Compound_1.result().subResult(2).resultSubShapePair()[0].shape().middlePoint() +) refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_3 = model.addRecover(Part_1_doc, Rotation_3, [Recover_2.result()]) -Rotation_4 = model.addRotation(Part_1_doc, [model.selection("FACE", "Recover_3_1_4")], model.selection("EDGE", "PartSet/OZ"), ANGLE) +Rotation_4 = model.addRotation( + Part_1_doc, + [model.selection("FACE", "Recover_3_1_4")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, +) model.testNbResults(Rotation_4, 1) model.testNbSubResults(Rotation_4, [0]) model.testNbSubShapes(Rotation_4, GeomAPI_Shape.SOLID, [0]) @@ -136,13 +281,20 @@ model.testNbSubShapes(Rotation_4, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Rotation_4, GeomAPI_Shape.VERTEX, [8]) model.testResultsVolumes(Rotation_4, [0]) model.testResultsAreas(Rotation_4, [109.154152964914914]) -refPoint = Compound_1.result().subResult(3).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Compound_1.result().subResult(3).resultSubShapePair()[0].shape().middlePoint() +) refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_4 = model.addRecover(Part_1_doc, Rotation_4, [Recover_3.result()]) -Rotation_5 = model.addRotation(Part_1_doc, [model.selection("SHELL", "Recover_4_1_5")], model.selection("EDGE", "PartSet/OZ"), ANGLE) +Rotation_5 = model.addRotation( + Part_1_doc, + [model.selection("SHELL", "Recover_4_1_5")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, +) model.testNbResults(Rotation_5, 1) model.testNbSubResults(Rotation_5, [0]) model.testNbSubShapes(Rotation_5, GeomAPI_Shape.SOLID, [0]) @@ -151,13 +303,20 @@ model.testNbSubShapes(Rotation_5, GeomAPI_Shape.EDGE, [8]) model.testNbSubShapes(Rotation_5, GeomAPI_Shape.VERTEX, [16]) model.testResultsVolumes(Rotation_5, [0]) model.testResultsAreas(Rotation_5, [182.822012116]) -refPoint = Compound_1.result().subResult(4).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Compound_1.result().subResult(4).resultSubShapePair()[0].shape().middlePoint() +) refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_5 = model.addRecover(Part_1_doc, Rotation_5, [Recover_4.result()]) -Rotation_6 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_5_1_6")], model.selection("EDGE", "PartSet/OZ"), ANGLE) +Rotation_6 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Recover_5_1_6")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, +) model.testNbResults(Rotation_6, 1) model.testNbSubResults(Rotation_6, [0]) model.testNbSubShapes(Rotation_6, GeomAPI_Shape.SOLID, [1]) @@ -165,13 +324,20 @@ model.testNbSubShapes(Rotation_6, GeomAPI_Shape.FACE, [6]) model.testNbSubShapes(Rotation_6, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(Rotation_6, GeomAPI_Shape.VERTEX, [48]) model.testResultsVolumes(Rotation_6, [1000]) -refPoint = Compound_1.result().subResult(5).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Compound_1.result().subResult(5).resultSubShapePair()[0].shape().middlePoint() +) refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_6 = model.addRecover(Part_1_doc, Rotation_6, [Recover_5.result()]) -Rotation_7 = model.addRotation(Part_1_doc, [model.selection("COMPSOLID", "Recover_6_1_7")], model.selection("EDGE", "PartSet/OZ"), ANGLE) +Rotation_7 = model.addRotation( + Part_1_doc, + [model.selection("COMPSOLID", "Recover_6_1_7")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, +) model.testNbResults(Rotation_7, 1) model.testNbSubResults(Rotation_7, [3]) model.testNbSubShapes(Rotation_7, GeomAPI_Shape.SOLID, [3]) @@ -181,10 +347,15 @@ model.testNbSubShapes(Rotation_7, GeomAPI_Shape.VERTEX, [132]) model.testResultsVolumes(Rotation_7, [1589.0486226]) refPoint = GeomAPI_Pnt(1.830127, 4.330127, 5.0) midPoint = Rotation_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_7 = model.addRecover(Part_1_doc, Rotation_7, [Recover_6.result()]) -Rotation_8 = model.addRotation(Part_1_doc, [model.selection("COMPOUND", "Recover_7_1_8")], model.selection("EDGE", "PartSet/OZ"), ANGLE) +Rotation_8 = model.addRotation( + Part_1_doc, + [model.selection("COMPOUND", "Recover_7_1_8")], + model.selection("EDGE", "PartSet/OZ"), + ANGLE, +) model.testNbResults(Rotation_8, 1) model.testNbSubResults(Rotation_8, [3]) model.testNbSubShapes(Rotation_8, GeomAPI_Shape.SOLID, [3]) @@ -194,8 +365,8 @@ model.testNbSubShapes(Rotation_8, GeomAPI_Shape.VERTEX, [144]) model.testResultsVolumes(Rotation_8, [3000]) refPoint = GeomAPI_Pnt(-38.169872981, 28.4807621, 5.0) midPoint = Rotation_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v95_1.py b/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v95_1.py index 556eb7306..b754c2aa8 100644 --- a/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v95_1.py +++ b/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v95_1.py @@ -27,42 +27,118 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() ANGLE = 45 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 ORIGIN = GeomAPI_Pnt(0, 0, 0) OX = GeomAPI_Ax1(ORIGIN, GeomAPI_Dir(1, 0, 0)) @@ -74,6 +150,7 @@ for ind in range(0, Compound_2.result().numberOfSubs()): p = Compound_2.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() REFERENCE.append(p) + def assertResult(theFeature): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [3]) @@ -85,36 +162,80 @@ def assertResult(theFeature): for ind in range(0, theFeature.result().numberOfSubs()): ref = REFERENCE[ind] - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], axis = model.selection("EDGE", "PartSet/OX"), angle = ANGLE, keepSubResults = True) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + axis=model.selection("EDGE", "PartSet/OX"), + angle=ANGLE, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Rotation_1.feature().error() != "") +assert Rotation_1.feature().error() != "" model.begin() Rotation_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")]) REFERENCE[0].rotate(OX, ANGLE) assertResult(Rotation_1) -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Rotation_1_1_2_1")], axis = model.selection("EDGE", "PartSet/OY"), angle = ANGLE, keepSubResults = True) +Rotation_2 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Rotation_1_1_2_1")], + axis=model.selection("EDGE", "PartSet/OY"), + angle=ANGLE, + keepSubResults=True, +) REFERENCE[1] = GeomAPI_Pnt(7.06766468, -32.16838976, -11.327215745975) assertResult(Rotation_2) -Rotation_3 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Rotation_2_1_3")], axis = model.selection("EDGE", "PartSet/OZ"), angle = ANGLE, keepSubResults = True) +Rotation_3 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Rotation_2_1_3")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=ANGLE, + keepSubResults=True, +) REFERENCE[2].rotate(OZ, ANGLE) assertResult(Rotation_3) -Rotation_4 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Rotation_3_1_1_1"), model.selection("SOLID", "Rotation_3_1_2_2"), model.selection("SOLID", "Rotation_3_1_3")], axis = model.selection("EDGE", "PartSet/OZ"), angle = -ANGLE, keepSubResults = True) +Rotation_4 = model.addRotation( + Part_1_doc, + [ + model.selection("SOLID", "Rotation_3_1_1_1"), + model.selection("SOLID", "Rotation_3_1_2_2"), + model.selection("SOLID", "Rotation_3_1_3"), + ], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=-ANGLE, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Rotation_4.feature().error() != "") +assert Rotation_4.feature().error() != "" model.begin() -Rotation_4.setMainObjects([model.selection("COMPSOLID", "Rotation_3_1_1"), model.selection("SOLID", "Rotation_3_1_2_2"), model.selection("SOLID", "Rotation_3_1_3")]) +Rotation_4.setMainObjects( + [ + model.selection("COMPSOLID", "Rotation_3_1_1"), + model.selection("SOLID", "Rotation_3_1_2_2"), + model.selection("SOLID", "Rotation_3_1_3"), + ] +) REFERENCE[0] = GeomAPI_Pnt(-28.2523903833, -26.7476096167, -31.819805153) REFERENCE[1] = GeomAPI_Pnt(5.0142082456, -22.789092613, -11.327215746) REFERENCE[2].rotate(OZ, -ANGLE) @@ -122,4 +243,4 @@ assertResult(Rotation_4) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v95_2.py b/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v95_2.py index bbde060cf..57686e8e6 100644 --- a/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v95_2.py +++ b/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v95_2.py @@ -27,43 +27,121 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 CENTER = SketchEllipse_1.secondFocus().pnt() -ANGLE = GeomAPI_Angle2d(CENTER, GeomAPI_Pnt2d(0, 0), SketchCircle_1.center().pnt()).angleDegree() +ANGLE = GeomAPI_Angle2d( + CENTER, GeomAPI_Pnt2d(0, 0), SketchCircle_1.center().pnt() +).angleDegree() AXIS = GeomAPI_Ax1(GeomAPI_Pnt(CENTER.x(), CENTER.y(), 0), GeomAPI_Dir(0, 0, 1)) REFERENCE = [] @@ -71,6 +149,7 @@ for ind in range(0, Compound_2.result().numberOfSubs()): p = Compound_2.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() REFERENCE.append(p) + def assertResult(theFeature): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [3]) @@ -82,45 +161,111 @@ def assertResult(theFeature): for ind in range(0, theFeature.result().numberOfSubs()): ref = REFERENCE[ind] - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], center = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_second_focus"), start = model.selection("VERTEX", "PartSet/Origin"), end = model.selection("VERTEX", "Sketch_1/SketchCircle_1"), keepSubResults = True) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + center=model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_second_focus"), + start=model.selection("VERTEX", "PartSet/Origin"), + end=model.selection("VERTEX", "Sketch_1/SketchCircle_1"), + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Rotation_1.feature().error() != "") +assert Rotation_1.feature().error() != "" model.begin() Rotation_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")]) REFERENCE[0].rotate(AXIS, ANGLE) assertResult(Rotation_1) -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Rotation_1_1_2_1")], center = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_second_focus"), start = model.selection("VERTEX", "PartSet/Origin"), end = model.selection("VERTEX", "Sketch_1/SketchCircle_1"), keepSubResults = True) -mp0 = Compound_2.result().subResult(1).subResult(0).resultSubShapePair()[0].shape().middlePoint() -mp1 = Compound_2.result().subResult(1).subResult(1).resultSubShapePair()[0].shape().middlePoint() +Rotation_2 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Rotation_1_1_2_1")], + center=model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_second_focus"), + start=model.selection("VERTEX", "PartSet/Origin"), + end=model.selection("VERTEX", "Sketch_1/SketchCircle_1"), + keepSubResults=True, +) +mp0 = ( + Compound_2.result() + .subResult(1) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint() +) +mp1 = ( + Compound_2.result() + .subResult(1) + .subResult(1) + .resultSubShapePair()[0] + .shape() + .middlePoint() +) mp0.rotate(AXIS, ANGLE) -REFERENCE[1] = GeomAPI_Pnt((mp0.x() + mp1.x()) / 2, (mp0.y() + mp1.y()) / 2, (mp0.z() + mp1.z()) / 2) +REFERENCE[1] = GeomAPI_Pnt( + (mp0.x() + mp1.x()) / 2, (mp0.y() + mp1.y()) / 2, (mp0.z() + mp1.z()) / 2 +) assertResult(Rotation_2) -Rotation_3 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Rotation_2_1_3")], center = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_second_focus"), start = model.selection("VERTEX", "PartSet/Origin"), end = model.selection("VERTEX", "Sketch_1/SketchCircle_1"), keepSubResults = True) +Rotation_3 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Rotation_2_1_3")], + center=model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_second_focus"), + start=model.selection("VERTEX", "PartSet/Origin"), + end=model.selection("VERTEX", "Sketch_1/SketchCircle_1"), + keepSubResults=True, +) REFERENCE[2].rotate(AXIS, ANGLE) assertResult(Rotation_3) -Rotation_4 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Rotation_3_1_1_1"), model.selection("SOLID", "Rotation_3_1_2_2"), model.selection("SOLID", "Rotation_3_1_3")], center = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_second_focus"), end = model.selection("VERTEX", "PartSet/Origin"), start = model.selection("VERTEX", "Sketch_1/SketchCircle_1"), keepSubResults = True) +Rotation_4 = model.addRotation( + Part_1_doc, + [ + model.selection("SOLID", "Rotation_3_1_1_1"), + model.selection("SOLID", "Rotation_3_1_2_2"), + model.selection("SOLID", "Rotation_3_1_3"), + ], + center=model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_second_focus"), + end=model.selection("VERTEX", "PartSet/Origin"), + start=model.selection("VERTEX", "Sketch_1/SketchCircle_1"), + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Rotation_4.feature().error() != "") +assert Rotation_4.feature().error() != "" model.begin() -Rotation_4.setMainObjects([model.selection("COMPSOLID", "Rotation_3_1_1"), model.selection("SOLID", "Rotation_3_1_2_2"), model.selection("SOLID", "Rotation_3_1_3")]) +Rotation_4.setMainObjects( + [ + model.selection("COMPSOLID", "Rotation_3_1_1"), + model.selection("SOLID", "Rotation_3_1_2_2"), + model.selection("SOLID", "Rotation_3_1_3"), + ] +) REFERENCE[0].rotate(AXIS, -ANGLE) mp1.rotate(AXIS, -ANGLE) -REFERENCE[1] = GeomAPI_Pnt((mp0.x() + mp1.x()) / 2, (mp0.y() + mp1.y()) / 2, (mp0.z() + mp1.z()) / 2) +REFERENCE[1] = GeomAPI_Pnt( + (mp0.x() + mp1.x()) / 2, (mp0.y() + mp1.y()) / 2, (mp0.z() + mp1.z()) / 2 +) REFERENCE[2].rotate(AXIS, -ANGLE) assertResult(Rotation_4) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v95_3.py b/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v95_3.py index 8654c9a28..e4ad4a739 100644 --- a/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v95_3.py +++ b/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v95_3.py @@ -26,61 +26,178 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 ANGLE = 30 AXIS = GeomAPI_Ax1(GeomAPI_Pnt(0, 0, 0), GeomAPI_Dir(0, 0, 1)) model.begin() -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), angle = ANGLE, keepSubResults = True) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("VERTEX", "Vertex_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=ANGLE, + keepSubResults=True, +) model.testNbResults(Rotation_1, 1) model.testNbSubResults(Rotation_1, [0]) model.testNbSubShapes(Rotation_1, GeomAPI_Shape.SOLID, [0]) @@ -92,9 +209,15 @@ model.testResultsAreas(Rotation_1, [0]) refPoint = Vertex_1.defaultResult().shape().middlePoint() refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), angle = ANGLE, keepSubResults = True) +Rotation_2 = model.addRotation( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=ANGLE, + keepSubResults=True, +) model.testNbResults(Rotation_2, 1) model.testNbSubResults(Rotation_2, [0]) model.testNbSubShapes(Rotation_2, GeomAPI_Shape.SOLID, [0]) @@ -106,9 +229,15 @@ model.testResultsAreas(Rotation_2, [0]) refPoint = Edge_1.defaultResult().shape().middlePoint() refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Rotation_3 = model.addRotation(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), angle = ANGLE, keepSubResults = True) +Rotation_3 = model.addRotation( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=ANGLE, + keepSubResults=True, +) model.testNbResults(Rotation_3, 1) model.testNbSubResults(Rotation_3, [0]) model.testNbSubShapes(Rotation_3, GeomAPI_Shape.SOLID, [0]) @@ -120,9 +249,15 @@ model.testResultsAreas(Rotation_3, [0]) refPoint = Wire_1.defaultResult().shape().middlePoint() refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Rotation_4 = model.addRotation(Part_1_doc, [model.selection("FACE", "Face_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), angle = ANGLE, keepSubResults = True) +Rotation_4 = model.addRotation( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=ANGLE, + keepSubResults=True, +) model.testNbResults(Rotation_4, 1) model.testNbSubResults(Rotation_4, [0]) model.testNbSubShapes(Rotation_4, GeomAPI_Shape.SOLID, [0]) @@ -134,9 +269,15 @@ model.testResultsAreas(Rotation_4, [109.154152964914914]) refPoint = Face_1.defaultResult().shape().middlePoint() refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Rotation_5 = model.addRotation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), angle = ANGLE, keepSubResults = True) +Rotation_5 = model.addRotation( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=ANGLE, + keepSubResults=True, +) model.testNbResults(Rotation_5, 1) model.testNbSubResults(Rotation_5, [0]) model.testNbSubShapes(Rotation_5, GeomAPI_Shape.SOLID, [0]) @@ -148,9 +289,15 @@ model.testResultsAreas(Rotation_5, [182.822012116]) refPoint = Shell_1.defaultResult().shape().middlePoint() refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Rotation_6 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), angle = ANGLE, keepSubResults = True) +Rotation_6 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=ANGLE, + keepSubResults=True, +) model.testNbResults(Rotation_6, 1) model.testNbSubResults(Rotation_6, [0]) model.testNbSubShapes(Rotation_6, GeomAPI_Shape.SOLID, [1]) @@ -161,9 +308,15 @@ model.testResultsVolumes(Rotation_6, [1000]) refPoint = Translation_1.defaultResult().shape().middlePoint() refPoint.rotate(AXIS, ANGLE) midPoint = Rotation_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Rotation_7 = model.addRotation(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), angle = ANGLE, keepSubResults = True) +Rotation_7 = model.addRotation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=ANGLE, + keepSubResults=True, +) model.testNbResults(Rotation_7, 1) model.testNbSubResults(Rotation_7, [3]) model.testNbSubShapes(Rotation_7, GeomAPI_Shape.SOLID, [3]) @@ -173,9 +326,15 @@ model.testNbSubShapes(Rotation_7, GeomAPI_Shape.VERTEX, [132]) model.testResultsVolumes(Rotation_7, [1589.0486226]) refPoint = GeomAPI_Pnt(1.830127, 4.330127, 5.0) midPoint = Rotation_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Rotation_8 = model.addRotation(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), angle = ANGLE, keepSubResults = True) +Rotation_8 = model.addRotation( + Part_1_doc, + [model.selection("COMPOUND", "AngularCopy_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=ANGLE, + keepSubResults=True, +) model.testNbResults(Rotation_8, 1) model.testNbSubResults(Rotation_8, [3]) model.testNbSubShapes(Rotation_8, GeomAPI_Shape.SOLID, [3]) @@ -185,8 +344,8 @@ model.testNbSubShapes(Rotation_8, GeomAPI_Shape.VERTEX, [144]) model.testResultsVolumes(Rotation_8, [3000]) refPoint = GeomAPI_Pnt(-38.169872981, 28.4807621, 5.0) midPoint = Rotation_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v95_4.py b/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v95_4.py index d5dedbdc5..65195594f 100644 --- a/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v95_4.py +++ b/src/FeaturesPlugin/Test/TestRotation_MultiLevelCompound_v95_4.py @@ -26,59 +26,179 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() ANGLE = 30 AXIS = GeomAPI_Ax1(GeomAPI_Pnt(0, 0, 0), GeomAPI_Dir(0, 0, 1)) -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 # collect reference data REFERENCE = [] @@ -86,6 +206,7 @@ for ind in range(0, Compound_1.result().numberOfSubs()): p = Compound_1.result().subResult(ind).resultSubShapePair()[1].middlePoint() REFERENCE.append(p) + def assertResult(theFeature, theNbMoved): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [8]) @@ -99,37 +220,95 @@ def assertResult(theFeature, theNbMoved): ref = GeomAPI_Pnt(REFERENCE[ind].x(), REFERENCE[ind].y(), REFERENCE[ind].z()) if ind < theNbMoved: ref.rotate(AXIS, ANGLE) - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("VERTEX", "Compound_1_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), angle = ANGLE, keepSubResults = True) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("VERTEX", "Compound_1_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=ANGLE, + keepSubResults=True, +) assertResult(Rotation_1, 1) -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("EDGE", "Rotation_1_1_2")], axis = model.selection("EDGE", "PartSet/OZ"), angle = ANGLE, keepSubResults = True) +Rotation_2 = model.addRotation( + Part_1_doc, + [model.selection("EDGE", "Rotation_1_1_2")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=ANGLE, + keepSubResults=True, +) assertResult(Rotation_2, 2) -Rotation_3 = model.addRotation(Part_1_doc, [model.selection("WIRE", "Rotation_2_1_3")], axis = model.selection("EDGE", "PartSet/OZ"), angle = ANGLE, keepSubResults = True) +Rotation_3 = model.addRotation( + Part_1_doc, + [model.selection("WIRE", "Rotation_2_1_3")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=ANGLE, + keepSubResults=True, +) assertResult(Rotation_3, 3) -Rotation_4 = model.addRotation(Part_1_doc, [model.selection("FACE", "Rotation_3_1_4")], axis = model.selection("EDGE", "PartSet/OZ"), angle = ANGLE, keepSubResults = True) +Rotation_4 = model.addRotation( + Part_1_doc, + [model.selection("FACE", "Rotation_3_1_4")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=ANGLE, + keepSubResults=True, +) assertResult(Rotation_4, 4) -Rotation_5 = model.addRotation(Part_1_doc, [model.selection("SHELL", "Rotation_4_1_5")], axis = model.selection("EDGE", "PartSet/OZ"), angle = ANGLE, keepSubResults = True) +Rotation_5 = model.addRotation( + Part_1_doc, + [model.selection("SHELL", "Rotation_4_1_5")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=ANGLE, + keepSubResults=True, +) assertResult(Rotation_5, 5) -Rotation_6 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Rotation_5_1_6")], axis = model.selection("EDGE", "PartSet/OZ"), angle = ANGLE, keepSubResults = True) +Rotation_6 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Rotation_5_1_6")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=ANGLE, + keepSubResults=True, +) assertResult(Rotation_6, 6) -Rotation_7 = model.addRotation(Part_1_doc, [model.selection("COMPSOLID", "Rotation_6_1_7")], axis = model.selection("EDGE", "PartSet/OZ"), angle = ANGLE, keepSubResults = True) +Rotation_7 = model.addRotation( + Part_1_doc, + [model.selection("COMPSOLID", "Rotation_6_1_7")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=ANGLE, + keepSubResults=True, +) REFERENCE[6] = GeomAPI_Pnt(1.83012701892, 4.33012701892, 5.0) assertResult(Rotation_7, 6) -Rotation_8 = model.addRotation(Part_1_doc, [model.selection("COMPOUND", "Rotation_7_1_8")], axis = model.selection("EDGE", "PartSet/OZ"), angle = ANGLE, keepSubResults = True) +Rotation_8 = model.addRotation( + Part_1_doc, + [model.selection("COMPOUND", "Rotation_7_1_8")], + axis=model.selection("EDGE", "PartSet/OZ"), + angle=ANGLE, + keepSubResults=True, +) REFERENCE[7] = GeomAPI_Pnt(-38.169872981, 28.48076211, 5.0) assertResult(Rotation_8, 6) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestScale1.py b/src/FeaturesPlugin/Test/TestScale1.py index 5a15bc1ad..54a090b49 100644 --- a/src/FeaturesPlugin/Test/TestScale1.py +++ b/src/FeaturesPlugin/Test/TestScale1.py @@ -22,12 +22,19 @@ from GeomAPI import * import math -def checkMiddlePoint(shape, x, y, z, tolerance = 1.e-7): - assert(shape is not None) + +def checkMiddlePoint(shape, x, y, z, tolerance=1.0e-7): + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "{} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "{} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "{} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "{} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "{} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "{} != {}".format( + middlePoint.z(), z + ) model.begin() @@ -37,11 +44,18 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 5) -Scale_1 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_1_1")] , model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"), 2) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"), + 2, +) Shape = Scale_1.results()[0].resultSubShapePair()[0].shape() checkMiddlePoint(Shape, 10, 10, 10) -Scale_1.setCenterPoint(model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]")) +Scale_1.setCenterPoint( + model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]") +) Shape = Scale_1.results()[0].resultSubShapePair()[0].shape() checkMiddlePoint(Shape, 0, 10, 10) @@ -51,4 +65,4 @@ checkMiddlePoint(Shape, -10, 0, 0) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestScale2.py b/src/FeaturesPlugin/Test/TestScale2.py index e65d69b79..1c373c04a 100644 --- a/src/FeaturesPlugin/Test/TestScale2.py +++ b/src/FeaturesPlugin/Test/TestScale2.py @@ -22,12 +22,20 @@ from GeomAPI import * import math -def checkMiddlePoint(shape, x, y, z, tolerance = 1.e-7): - assert(shape is not None) + +def checkMiddlePoint(shape, x, y, z, tolerance=1.0e-7): + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "{} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "{} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "{} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "{} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "{} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "{} != {}".format( + middlePoint.z(), z + ) + model.begin() partSet = model.moduleDocument() @@ -36,12 +44,21 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 5) -Scale_1 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_1_1")] , model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"), 1 , 2, 4) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"), + 1, + 2, + 4, +) model.do() Shape = Scale_1.results()[0].resultSubShapePair()[0].shape() checkMiddlePoint(Shape, 5, 10, 20) -Scale_1.setCenterPoint(model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]")) +Scale_1.setCenterPoint( + model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]") +) Shape = Scale_1.results()[0].resultSubShapePair()[0].shape() checkMiddlePoint(Shape, 5, 10, 20) @@ -51,4 +68,4 @@ checkMiddlePoint(Shape, 0, 0, 0) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v0_1.py b/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v0_1.py index f8a17caac..2729e576c 100644 --- a/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v0_1.py +++ b/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v0_1.py @@ -27,46 +27,127 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() SCALE = 2 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 model.begin() -Scale_1 = model.addScale(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_1, 1) model.testNbSubResults(Scale_1, [0]) model.testNbSubShapes(Scale_1, GeomAPI_Shape.SOLID, [1]) @@ -75,14 +156,21 @@ model.testNbSubShapes(Scale_1, GeomAPI_Shape.EDGE, [18]) model.testNbSubShapes(Scale_1, GeomAPI_Shape.VERTEX, [36]) model.testResultsVolumes(Scale_1, [542.746463956 * (SCALE**3)]) -refPoint = Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint() +) refPoint = GeomAPI_Pnt(refPoint.xyz().multiplied(SCALE)) midPoint = Scale_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, Scale_1, [Compound_2.result()], True) -Scale_2 = model.addScale(Part_1_doc, [model.selection("SOLID", "Recover_1_1_2_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_2 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Recover_1_1_2_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_2, 1) model.testNbSubResults(Scale_2, [0]) model.testNbSubShapes(Scale_2, GeomAPI_Shape.SOLID, [1]) @@ -91,14 +179,26 @@ model.testNbSubShapes(Scale_2, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Scale_2, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Scale_2, [785.39816339745 * (SCALE**3)]) -refPoint = Recover_1.result().subResult(1).subResult(0).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Recover_1.result() + .subResult(1) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint() +) refPoint = GeomAPI_Pnt(refPoint.xyz().multiplied(SCALE)) midPoint = Scale_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, Scale_2, [Recover_1.result()], True) -Scale_3 = model.addScale(Part_1_doc, [model.selection("SOLID", "Recover_2_1_3")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_3 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Recover_2_1_3")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_3, 1) model.testNbSubResults(Scale_3, [0]) model.testNbSubShapes(Scale_3, GeomAPI_Shape.SOLID, [1]) @@ -110,27 +210,55 @@ model.testResultsVolumes(Scale_3, [785.39816339745 * (SCALE**3)]) refPoint = Recover_2.result().subResult(2).resultSubShapePair()[0].shape().middlePoint() refPoint = GeomAPI_Pnt(refPoint.xyz().multiplied(SCALE)) midPoint = Scale_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_3 = model.addRecover(Part_1_doc, Scale_3, [Recover_2.result()], True) -Scale_4 = model.addScale(Part_1_doc, [model.selection("SOLID", "Recover_3_1_1_1"), model.selection("SOLID", "Recover_3_1_2_2"), model.selection("SOLID", "Recover_3_1_3")], model.selection("VERTEX", "PartSet/Origin"), 1 / SCALE) +Scale_4 = model.addScale( + Part_1_doc, + [ + model.selection("SOLID", "Recover_3_1_1_1"), + model.selection("SOLID", "Recover_3_1_2_2"), + model.selection("SOLID", "Recover_3_1_3"), + ], + model.selection("VERTEX", "PartSet/Origin"), + 1 / SCALE, +) model.testNbResults(Scale_4, 3) model.testNbSubResults(Scale_4, [0, 0, 0]) model.testNbSubShapes(Scale_4, GeomAPI_Shape.SOLID, [1, 1, 1]) model.testNbSubShapes(Scale_4, GeomAPI_Shape.FACE, [6, 3, 3]) model.testNbSubShapes(Scale_4, GeomAPI_Shape.EDGE, [24, 6, 6]) model.testNbSubShapes(Scale_4, GeomAPI_Shape.VERTEX, [48, 12, 12]) -model.testResultsVolumes(Scale_4, [3444.394198615 / (SCALE**3), 785.39816339745 / (SCALE**3), 785.39816339745 / (SCALE**3)]) +model.testResultsVolumes( + Scale_4, + [ + 3444.394198615 / (SCALE**3), + 785.39816339745 / (SCALE**3), + 785.39816339745 / (SCALE**3), + ], +) -REFERENCE = [Recover_3.result().subResult(0).subResult(0).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(1).subResult(1).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()] +REFERENCE = [ + Recover_3.result() + .subResult(0) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result() + .subResult(1) + .subResult(1) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint(), +] for res, ref in zip(Scale_4.results(), REFERENCE): ref = GeomAPI_Pnt(ref.xyz().multiplied(1 / SCALE)) midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE) + assert midPoint.distance(ref) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v0_2.py b/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v0_2.py index c70e05870..02a52abde 100644 --- a/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v0_2.py +++ b/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v0_2.py @@ -27,48 +27,131 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() SCALE_X = 1 SCALE_Y = 2 SCALE_Z = 3 -TOLERANCE = 1.e-3 +TOLERANCE = 1.0e-3 model.begin() -Scale_1 = model.addScale(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("VERTEX", "PartSet/Origin"), SCALE_X, SCALE_Y, SCALE_Z) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE_X, + SCALE_Y, + SCALE_Z, +) model.testNbResults(Scale_1, 1) model.testNbSubResults(Scale_1, [0]) model.testNbSubShapes(Scale_1, GeomAPI_Shape.SOLID, [1]) @@ -77,14 +160,25 @@ model.testNbSubShapes(Scale_1, GeomAPI_Shape.EDGE, [18]) model.testNbSubShapes(Scale_1, GeomAPI_Shape.VERTEX, [36]) model.testResultsVolumes(Scale_1, [542.746463956 * SCALE_X * SCALE_Y * SCALE_Z]) -refPoint = Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint() -refPoint = GeomAPI_Pnt(refPoint.x() * SCALE_X, refPoint.y() * SCALE_Y, refPoint.z() * SCALE_Z) +refPoint = ( + Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint() +) +refPoint = GeomAPI_Pnt( + refPoint.x() * SCALE_X, refPoint.y() * SCALE_Y, refPoint.z() * SCALE_Z +) midPoint = Scale_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, Scale_1, [Compound_2.result()], True) -Scale_2 = model.addScale(Part_1_doc, [model.selection("SOLID", "Recover_1_1_2_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE_X, SCALE_Y, SCALE_Z) +Scale_2 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Recover_1_1_2_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE_X, + SCALE_Y, + SCALE_Z, +) model.testNbResults(Scale_2, 1) model.testNbSubResults(Scale_2, [0]) model.testNbSubShapes(Scale_2, GeomAPI_Shape.SOLID, [1]) @@ -93,14 +187,30 @@ model.testNbSubShapes(Scale_2, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Scale_2, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Scale_2, [785.3997 * SCALE_X * SCALE_Y * SCALE_Z]) -refPoint = Recover_1.result().subResult(1).subResult(0).resultSubShapePair()[0].shape().middlePoint() -refPoint = GeomAPI_Pnt(refPoint.x() * SCALE_X, refPoint.y() * SCALE_Y, refPoint.z() * SCALE_Z) +refPoint = ( + Recover_1.result() + .subResult(1) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint() +) +refPoint = GeomAPI_Pnt( + refPoint.x() * SCALE_X, refPoint.y() * SCALE_Y, refPoint.z() * SCALE_Z +) midPoint = Scale_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, Scale_2, [Recover_1.result()], True) -Scale_3 = model.addScale(Part_1_doc, [model.selection("SOLID", "Recover_2_1_3")], model.selection("VERTEX", "PartSet/Origin"), SCALE_X, SCALE_Y, SCALE_Z) +Scale_3 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Recover_2_1_3")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE_X, + SCALE_Y, + SCALE_Z, +) model.testNbResults(Scale_3, 1) model.testNbSubResults(Scale_3, [0]) model.testNbSubShapes(Scale_3, GeomAPI_Shape.SOLID, [1]) @@ -110,29 +220,61 @@ model.testNbSubShapes(Scale_3, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Scale_3, [785.3997 * SCALE_X * SCALE_Y * SCALE_Z]) refPoint = Recover_2.result().subResult(2).resultSubShapePair()[0].shape().middlePoint() -refPoint = GeomAPI_Pnt(refPoint.x() * SCALE_X, refPoint.y() * SCALE_Y, refPoint.z() * SCALE_Z) +refPoint = GeomAPI_Pnt( + refPoint.x() * SCALE_X, refPoint.y() * SCALE_Y, refPoint.z() * SCALE_Z +) midPoint = Scale_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_3 = model.addRecover(Part_1_doc, Scale_3, [Recover_2.result()], True) -Scale_4 = model.addScale(Part_1_doc, [model.selection("SOLID", "Recover_3_1_1_1"), model.selection("SOLID", "Recover_3_1_2_2"), model.selection("SOLID", "Recover_3_1_3")], model.selection("VERTEX", "PartSet/Origin"), 1 / SCALE_X, 1 / SCALE_Y, 1 / SCALE_Z) +Scale_4 = model.addScale( + Part_1_doc, + [ + model.selection("SOLID", "Recover_3_1_1_1"), + model.selection("SOLID", "Recover_3_1_2_2"), + model.selection("SOLID", "Recover_3_1_3"), + ], + model.selection("VERTEX", "PartSet/Origin"), + 1 / SCALE_X, + 1 / SCALE_Y, + 1 / SCALE_Z, +) model.testNbResults(Scale_4, 3) model.testNbSubResults(Scale_4, [0, 0, 0]) model.testNbSubShapes(Scale_4, GeomAPI_Shape.SOLID, [1, 1, 1]) model.testNbSubShapes(Scale_4, GeomAPI_Shape.FACE, [6, 3, 3]) model.testNbSubShapes(Scale_4, GeomAPI_Shape.EDGE, [24, 6, 6]) model.testNbSubShapes(Scale_4, GeomAPI_Shape.VERTEX, [48, 12, 12]) -model.testResultsVolumes(Scale_4, [3444.39814733 / (SCALE_X * SCALE_Y * SCALE_Z), 785.3997 / (SCALE_X * SCALE_Y * SCALE_Z), 785.3997 / (SCALE_X * SCALE_Y * SCALE_Z)]) +model.testResultsVolumes( + Scale_4, + [ + 3444.39814733 / (SCALE_X * SCALE_Y * SCALE_Z), + 785.3997 / (SCALE_X * SCALE_Y * SCALE_Z), + 785.3997 / (SCALE_X * SCALE_Y * SCALE_Z), + ], +) -REFERENCE = [Recover_3.result().subResult(0).subResult(0).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(1).subResult(1).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()] +REFERENCE = [ + Recover_3.result() + .subResult(0) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result() + .subResult(1) + .subResult(1) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint(), +] for res, ref in zip(Scale_4.results(), REFERENCE): ref = GeomAPI_Pnt(ref.x() / SCALE_X, ref.y() / SCALE_Y, ref.z() / SCALE_Z) midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE) + assert midPoint.distance(ref) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v0_3.py b/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v0_3.py index 7ae9ab725..ca909f348 100644 --- a/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v0_3.py +++ b/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v0_3.py @@ -26,60 +26,175 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 SCALE = 2 model.begin() -Scale_1 = model.addScale(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("VERTEX", "Vertex_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_1, 1) model.testNbSubResults(Scale_1, [0]) model.testNbSubShapes(Scale_1, GeomAPI_Shape.SOLID, [0]) @@ -88,11 +203,18 @@ model.testNbSubShapes(Scale_1, GeomAPI_Shape.EDGE, [0]) model.testNbSubShapes(Scale_1, GeomAPI_Shape.VERTEX, [1]) model.testResultsVolumes(Scale_1, [0]) model.testResultsAreas(Scale_1, [0]) -refPoint = GeomAPI_Pnt(Vertex_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Vertex_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE) +) midPoint = Scale_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Scale_2 = model.addScale(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_2 = model.addScale( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_2, 1) model.testNbSubResults(Scale_2, [0]) model.testNbSubShapes(Scale_2, GeomAPI_Shape.SOLID, [0]) @@ -101,11 +223,18 @@ model.testNbSubShapes(Scale_2, GeomAPI_Shape.EDGE, [1]) model.testNbSubShapes(Scale_2, GeomAPI_Shape.VERTEX, [2]) model.testResultsVolumes(Scale_2, [0]) model.testResultsAreas(Scale_2, [0]) -refPoint = GeomAPI_Pnt(Edge_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Edge_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE) +) midPoint = Scale_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Scale_3 = model.addScale(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_3 = model.addScale( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_3, 1) model.testNbSubResults(Scale_3, [0]) model.testNbSubShapes(Scale_3, GeomAPI_Shape.SOLID, [0]) @@ -114,11 +243,18 @@ model.testNbSubShapes(Scale_3, GeomAPI_Shape.EDGE, [2]) model.testNbSubShapes(Scale_3, GeomAPI_Shape.VERTEX, [4]) model.testResultsVolumes(Scale_3, [0]) model.testResultsAreas(Scale_3, [0]) -refPoint = GeomAPI_Pnt(Wire_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Wire_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE) +) midPoint = Scale_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Scale_4 = model.addScale(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_4 = model.addScale( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_4, 1) model.testNbSubResults(Scale_4, [0]) model.testNbSubShapes(Scale_4, GeomAPI_Shape.SOLID, [0]) @@ -127,11 +263,18 @@ model.testNbSubShapes(Scale_4, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Scale_4, GeomAPI_Shape.VERTEX, [8]) model.testResultsVolumes(Scale_4, [0]) model.testResultsAreas(Scale_4, [109.154152964914914 * (SCALE**2)]) -refPoint = GeomAPI_Pnt(Face_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Face_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE) +) midPoint = Scale_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Scale_5 = model.addScale(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_5 = model.addScale( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_5, 1) model.testNbSubResults(Scale_5, [0]) model.testNbSubShapes(Scale_5, GeomAPI_Shape.SOLID, [0]) @@ -140,11 +283,18 @@ model.testNbSubShapes(Scale_5, GeomAPI_Shape.EDGE, [8]) model.testNbSubShapes(Scale_5, GeomAPI_Shape.VERTEX, [16]) model.testResultsVolumes(Scale_5, [0]) model.testResultsAreas(Scale_5, [182.822012116 * (SCALE**2)]) -refPoint = GeomAPI_Pnt(Shell_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Shell_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE) +) midPoint = Scale_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Scale_6 = model.addScale(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_6 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_6, 1) model.testNbSubResults(Scale_6, [0]) model.testNbSubShapes(Scale_6, GeomAPI_Shape.SOLID, [1]) @@ -152,11 +302,18 @@ model.testNbSubShapes(Scale_6, GeomAPI_Shape.FACE, [6]) model.testNbSubShapes(Scale_6, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(Scale_6, GeomAPI_Shape.VERTEX, [48]) model.testResultsVolumes(Scale_6, [1000 * (SCALE**3)]) -refPoint = GeomAPI_Pnt(Translation_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Translation_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE) +) midPoint = Scale_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Scale_7 = model.addScale(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_7 = model.addScale( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_7, 1) model.testNbSubResults(Scale_7, [3]) model.testNbSubShapes(Scale_7, GeomAPI_Shape.SOLID, [3]) @@ -164,11 +321,18 @@ model.testNbSubShapes(Scale_7, GeomAPI_Shape.FACE, [17]) model.testNbSubShapes(Scale_7, GeomAPI_Shape.EDGE, [66]) model.testNbSubShapes(Scale_7, GeomAPI_Shape.VERTEX, [132]) model.testResultsVolumes(Scale_7, [1589.0486226 * (SCALE**3)]) -refPoint = GeomAPI_Pnt(Partition_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Partition_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE) +) midPoint = Scale_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Scale_8 = model.addScale(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_8 = model.addScale( + Part_1_doc, + [model.selection("COMPOUND", "AngularCopy_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_8, 1) model.testNbSubResults(Scale_8, [3]) model.testNbSubShapes(Scale_8, GeomAPI_Shape.SOLID, [3]) @@ -176,10 +340,12 @@ model.testNbSubShapes(Scale_8, GeomAPI_Shape.FACE, [18]) model.testNbSubShapes(Scale_8, GeomAPI_Shape.EDGE, [72]) model.testNbSubShapes(Scale_8, GeomAPI_Shape.VERTEX, [144]) model.testResultsVolumes(Scale_8, [3000 * (SCALE**3)]) -refPoint = GeomAPI_Pnt(AngularCopy_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + AngularCopy_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE) +) midPoint = Scale_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v0_4.py b/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v0_4.py index d7cdd07ab..62cad73a5 100644 --- a/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v0_4.py +++ b/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v0_4.py @@ -26,62 +26,186 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 SCALE = 2 model.begin() -Scale_1 = model.addScale(Part_1_doc, [model.selection("VERTEX", "Compound_1_1_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("VERTEX", "Compound_1_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_1, 1) model.testNbSubResults(Scale_1, [0]) model.testNbSubShapes(Scale_1, GeomAPI_Shape.SOLID, [0]) @@ -90,12 +214,25 @@ model.testNbSubShapes(Scale_1, GeomAPI_Shape.EDGE, [0]) model.testNbSubShapes(Scale_1, GeomAPI_Shape.VERTEX, [1]) model.testResultsVolumes(Scale_1, [0]) model.testResultsAreas(Scale_1, [0]) -refPoint = GeomAPI_Pnt(Compound_1.result().subResult(0).resultSubShapePair()[0].shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Compound_1.result() + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint() + .xyz() + .multiplied(SCALE) +) midPoint = Scale_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, Scale_1, [Compound_1.result()], True) -Scale_2 = model.addScale(Part_1_doc, [model.selection("EDGE", "Recover_1_1_2")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_2 = model.addScale( + Part_1_doc, + [model.selection("EDGE", "Recover_1_1_2")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_2, 1) model.testNbSubResults(Scale_2, [0]) model.testNbSubShapes(Scale_2, GeomAPI_Shape.SOLID, [0]) @@ -104,12 +241,25 @@ model.testNbSubShapes(Scale_2, GeomAPI_Shape.EDGE, [1]) model.testNbSubShapes(Scale_2, GeomAPI_Shape.VERTEX, [2]) model.testResultsVolumes(Scale_2, [0]) model.testResultsAreas(Scale_2, [0]) -refPoint = GeomAPI_Pnt(Compound_1.result().subResult(1).resultSubShapePair()[0].shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Compound_1.result() + .subResult(1) + .resultSubShapePair()[0] + .shape() + .middlePoint() + .xyz() + .multiplied(SCALE) +) midPoint = Scale_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, Scale_2, [Recover_1.result()]) -Scale_3 = model.addScale(Part_1_doc, [model.selection("WIRE", "Recover_2_1_3")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_3 = model.addScale( + Part_1_doc, + [model.selection("WIRE", "Recover_2_1_3")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_3, 1) model.testNbSubResults(Scale_3, [0]) model.testNbSubShapes(Scale_3, GeomAPI_Shape.SOLID, [0]) @@ -118,12 +268,25 @@ model.testNbSubShapes(Scale_3, GeomAPI_Shape.EDGE, [2]) model.testNbSubShapes(Scale_3, GeomAPI_Shape.VERTEX, [4]) model.testResultsVolumes(Scale_3, [0]) model.testResultsAreas(Scale_3, [0]) -refPoint = GeomAPI_Pnt(Compound_1.result().subResult(2).resultSubShapePair()[0].shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Compound_1.result() + .subResult(2) + .resultSubShapePair()[0] + .shape() + .middlePoint() + .xyz() + .multiplied(SCALE) +) midPoint = Scale_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_3 = model.addRecover(Part_1_doc, Scale_3, [Recover_2.result()]) -Scale_4 = model.addScale(Part_1_doc, [model.selection("FACE", "Recover_3_1_4")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_4 = model.addScale( + Part_1_doc, + [model.selection("FACE", "Recover_3_1_4")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_4, 1) model.testNbSubResults(Scale_4, [0]) model.testNbSubShapes(Scale_4, GeomAPI_Shape.SOLID, [0]) @@ -132,12 +295,25 @@ model.testNbSubShapes(Scale_4, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Scale_4, GeomAPI_Shape.VERTEX, [8]) model.testResultsVolumes(Scale_4, [0]) model.testResultsAreas(Scale_4, [109.154152964914914 * (SCALE**2)]) -refPoint = GeomAPI_Pnt(Compound_1.result().subResult(3).resultSubShapePair()[0].shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Compound_1.result() + .subResult(3) + .resultSubShapePair()[0] + .shape() + .middlePoint() + .xyz() + .multiplied(SCALE) +) midPoint = Scale_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_4 = model.addRecover(Part_1_doc, Scale_4, [Recover_3.result()]) -Scale_5 = model.addScale(Part_1_doc, [model.selection("SHELL", "Recover_4_1_5")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_5 = model.addScale( + Part_1_doc, + [model.selection("SHELL", "Recover_4_1_5")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_5, 1) model.testNbSubResults(Scale_5, [0]) model.testNbSubShapes(Scale_5, GeomAPI_Shape.SOLID, [0]) @@ -146,12 +322,25 @@ model.testNbSubShapes(Scale_5, GeomAPI_Shape.EDGE, [8]) model.testNbSubShapes(Scale_5, GeomAPI_Shape.VERTEX, [16]) model.testResultsVolumes(Scale_5, [0]) model.testResultsAreas(Scale_5, [182.822012116 * (SCALE**2)]) -refPoint = GeomAPI_Pnt(Compound_1.result().subResult(4).resultSubShapePair()[0].shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Compound_1.result() + .subResult(4) + .resultSubShapePair()[0] + .shape() + .middlePoint() + .xyz() + .multiplied(SCALE) +) midPoint = Scale_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_5 = model.addRecover(Part_1_doc, Scale_5, [Recover_4.result()]) -Scale_6 = model.addScale(Part_1_doc, [model.selection("SOLID", "Recover_5_1_6")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_6 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Recover_5_1_6")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_6, 1) model.testNbSubResults(Scale_6, [0]) model.testNbSubShapes(Scale_6, GeomAPI_Shape.SOLID, [1]) @@ -159,12 +348,25 @@ model.testNbSubShapes(Scale_6, GeomAPI_Shape.FACE, [6]) model.testNbSubShapes(Scale_6, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(Scale_6, GeomAPI_Shape.VERTEX, [48]) model.testResultsVolumes(Scale_6, [1000 * (SCALE**3)]) -refPoint = GeomAPI_Pnt(Compound_1.result().subResult(5).resultSubShapePair()[0].shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Compound_1.result() + .subResult(5) + .resultSubShapePair()[0] + .shape() + .middlePoint() + .xyz() + .multiplied(SCALE) +) midPoint = Scale_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_6 = model.addRecover(Part_1_doc, Scale_6, [Recover_5.result()]) -Scale_7 = model.addScale(Part_1_doc, [model.selection("COMPSOLID", "Recover_6_1_7")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_7 = model.addScale( + Part_1_doc, + [model.selection("COMPSOLID", "Recover_6_1_7")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_7, 1) model.testNbSubResults(Scale_7, [3]) model.testNbSubShapes(Scale_7, GeomAPI_Shape.SOLID, [3]) @@ -172,12 +374,25 @@ model.testNbSubShapes(Scale_7, GeomAPI_Shape.FACE, [17]) model.testNbSubShapes(Scale_7, GeomAPI_Shape.EDGE, [66]) model.testNbSubShapes(Scale_7, GeomAPI_Shape.VERTEX, [132]) model.testResultsVolumes(Scale_7, [1589.0486226 * (SCALE**3)]) -refPoint = GeomAPI_Pnt(Compound_1.result().subResult(6).resultSubShapePair()[0].shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Compound_1.result() + .subResult(6) + .resultSubShapePair()[0] + .shape() + .middlePoint() + .xyz() + .multiplied(SCALE) +) midPoint = Scale_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_7 = model.addRecover(Part_1_doc, Scale_7, [Recover_6.result()]) -Scale_8 = model.addScale(Part_1_doc, [model.selection("COMPOUND", "Recover_7_1_8")], model.selection("VERTEX", "PartSet/Origin"), SCALE) +Scale_8 = model.addScale( + Part_1_doc, + [model.selection("COMPOUND", "Recover_7_1_8")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, +) model.testNbResults(Scale_8, 1) model.testNbSubResults(Scale_8, [3]) model.testNbSubShapes(Scale_8, GeomAPI_Shape.SOLID, [3]) @@ -185,10 +400,18 @@ model.testNbSubShapes(Scale_8, GeomAPI_Shape.FACE, [18]) model.testNbSubShapes(Scale_8, GeomAPI_Shape.EDGE, [72]) model.testNbSubShapes(Scale_8, GeomAPI_Shape.VERTEX, [144]) model.testResultsVolumes(Scale_8, [3000 * (SCALE**3)]) -refPoint = GeomAPI_Pnt(Compound_1.result().subResult(7).resultSubShapePair()[0].shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Compound_1.result() + .subResult(7) + .resultSubShapePair()[0] + .shape() + .middlePoint() + .xyz() + .multiplied(SCALE) +) midPoint = Scale_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_1.py b/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_1.py index 849a11de4..70f35eb97 100644 --- a/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_1.py +++ b/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_1.py @@ -27,60 +27,146 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() SCALE = 2 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + def average(thePoints): - x = 0; y = 0; z = 0 + x = 0 + y = 0 + z = 0 for p in thePoints: - x += p.x(); y += p.y(); z+= p.z() + x += p.x() + y += p.y() + z += p.z() x /= len(thePoints) y /= len(thePoints) z /= len(thePoints) return GeomAPI_Pnt(x, y, z) + def subsRefPoints(theResult): res = [] for ind in range(0, theResult.numberOfSubs()): - res.append( theResult.subResult(ind).resultSubShapePair()[0].shape().middlePoint()) + res.append( + theResult.subResult(ind).resultSubShapePair()[0].shape().middlePoint() + ) return res + REFERENCE = subsRefPoints(Compound_2.result()) + def assertResult(theFeature, theVolume): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [3]) @@ -92,39 +178,83 @@ def assertResult(theFeature, theVolume): for ind in range(0, theFeature.result().numberOfSubs()): ref = REFERENCE[ind] - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Scale_1 = model.addScale(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Scale_1.feature().error() != "") +assert Scale_1.feature().error() != "" model.begin() Scale_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")]) REFERENCE[0] = GeomAPI_Pnt(REFERENCE[0].xyz().multiplied(SCALE)) assertResult(Scale_1, 98066.606782594) -Scale_2 = model.addScale(Part_1_doc, [model.selection("SOLID", "Scale_1_1_2_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_2 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Scale_1_1_2_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) subs = subsRefPoints(Compound_2.result().subResult(1)) subs[0] = GeomAPI_Pnt(subs[0].xyz().added(GeomAPI_XYZ(5, -5, 5)).multiplied(SCALE)) subs[1] = GeomAPI_Pnt(subs[1].xyz().added(GeomAPI_XYZ(-5, 5, -5))) REFERENCE[1] = average(subs) assertResult(Scale_2, 103564.3939263762) -Scale_3 = model.addScale(Part_1_doc, [model.selection("SOLID", "Scale_2_1_3")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_3 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Scale_2_1_3")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) REFERENCE[2] = GeomAPI_Pnt(REFERENCE[2].xyz().multiplied(SCALE)) assertResult(Scale_3, 109062.18107) -Scale_4 = model.addScale(Part_1_doc, [model.selection("SOLID", "Scale_3_1_1_1"), model.selection("SOLID", "Scale_3_1_2_2"), model.selection("SOLID", "Scale_3_1_3")], model.selection("VERTEX", "PartSet/Origin"), 1 / SCALE, keepSubResults = True) +Scale_4 = model.addScale( + Part_1_doc, + [ + model.selection("SOLID", "Scale_3_1_1_1"), + model.selection("SOLID", "Scale_3_1_2_2"), + model.selection("SOLID", "Scale_3_1_3"), + ], + model.selection("VERTEX", "PartSet/Origin"), + 1 / SCALE, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Scale_4.feature().error() != "") +assert Scale_4.feature().error() != "" model.begin() -Scale_4.setMainObjects([model.selection("COMPSOLID", "Scale_3_1_1"), model.selection("SOLID", "Scale_3_1_2_2"), model.selection("SOLID", "Scale_3_1_3")]) +Scale_4.setMainObjects( + [ + model.selection("COMPSOLID", "Scale_3_1_1"), + model.selection("SOLID", "Scale_3_1_2_2"), + model.selection("SOLID", "Scale_3_1_3"), + ] +) REFERENCE[0] = GeomAPI_Pnt(REFERENCE[0].xyz().multiplied(1 / SCALE)) subs[1] = GeomAPI_Pnt(subs[1].xyz().multiplied(1 / SCALE)) REFERENCE[1] = average(subs) @@ -133,4 +263,4 @@ assertResult(Scale_4, 19130.55977755) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_2.py b/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_2.py index a1617218f..0b7db947b 100644 --- a/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_2.py +++ b/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_2.py @@ -27,62 +27,148 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() SCALE_X = 1 SCALE_Y = 2 SCALE_Z = 3 -TOLERANCE = 1.e-4 +TOLERANCE = 1.0e-4 + def average(thePoints): - x = 0; y = 0; z = 0 + x = 0 + y = 0 + z = 0 for p in thePoints: - x += p.x(); y += p.y(); z+= p.z() + x += p.x() + y += p.y() + z += p.z() x /= len(thePoints) y /= len(thePoints) z /= len(thePoints) return GeomAPI_Pnt(x, y, z) + def subsRefPoints(theResult): res = [] for ind in range(0, theResult.numberOfSubs()): - res.append(theResult.subResult(ind).resultSubShapePair()[0].shape().middlePoint()) + res.append( + theResult.subResult(ind).resultSubShapePair()[0].shape().middlePoint() + ) return res + REFERENCE = subsRefPoints(Compound_2.result()) + def assertResult(theFeature, theVolume): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [3]) @@ -94,51 +180,119 @@ def assertResult(theFeature, theVolume): for ind in range(0, theFeature.result().numberOfSubs()): ref = REFERENCE[ind] - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Scale_1 = model.addScale(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("VERTEX", "PartSet/Origin"), SCALE_X, SCALE_Y, SCALE_Z, keepSubResults = True) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE_X, + SCALE_Y, + SCALE_Z, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Scale_1.feature().error() != "") +assert Scale_1.feature().error() != "" model.begin() Scale_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")]) -REFERENCE[0] = GeomAPI_Pnt(REFERENCE[0].x() * SCALE_X, REFERENCE[0].y() * SCALE_Y, REFERENCE[0].z() * SCALE_Z) -REFERENCE[0].setX(0) # <= B-spline poles are used to calculate the bounding box and thus the middle point +REFERENCE[0] = GeomAPI_Pnt( + REFERENCE[0].x() * SCALE_X, REFERENCE[0].y() * SCALE_Y, REFERENCE[0].z() * SCALE_Z +) +REFERENCE[0].setX( + 0 +) # <= B-spline poles are used to calculate the bounding box and thus the middle point assertResult(Scale_1, 74139.07479) -Scale_2 = model.addScale(Part_1_doc, [model.selection("SOLID", "Scale_1_1_2_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE_X, SCALE_Y, SCALE_Z, keepSubResults = True) +Scale_2 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Scale_1_1_2_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE_X, + SCALE_Y, + SCALE_Z, + keepSubResults=True, +) subs = subsRefPoints(Compound_2.result().subResult(1)) subs[0] = GeomAPI_Pnt(subs[0].xyz().added(GeomAPI_XYZ(5, -5, 5))) -subs[0] = GeomAPI_Pnt(subs[0].x() * SCALE_X, subs[0].y() * SCALE_Y, subs[0].z() * SCALE_Z) -subs[0].setY(-117.3204876) # <= B-spline poles are used to calculate the bounding box and thus the middle point +subs[0] = GeomAPI_Pnt( + subs[0].x() * SCALE_X, subs[0].y() * SCALE_Y, subs[0].z() * SCALE_Z +) +subs[0].setY( + -117.3204876 +) # <= B-spline poles are used to calculate the bounding box and thus the middle point subs[1] = GeomAPI_Pnt(subs[1].xyz().added(GeomAPI_XYZ(-5, 5, -5))) REFERENCE[1] = average(subs) assertResult(Scale_2, 78066.07487341) -Scale_3 = model.addScale(Part_1_doc, [model.selection("SOLID", "Scale_2_1_3")], model.selection("VERTEX", "PartSet/Origin"), SCALE_X, SCALE_Y, SCALE_Z, keepSubResults = True) -REFERENCE[2] = GeomAPI_Pnt(REFERENCE[2].x() * SCALE_X, REFERENCE[2].y() * SCALE_Y, REFERENCE[2].z() * SCALE_Z) +Scale_3 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Scale_2_1_3")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE_X, + SCALE_Y, + SCALE_Z, + keepSubResults=True, +) +REFERENCE[2] = GeomAPI_Pnt( + REFERENCE[2].x() * SCALE_X, REFERENCE[2].y() * SCALE_Y, REFERENCE[2].z() * SCALE_Z +) assertResult(Scale_3, 81993.0749561) -Scale_4 = model.addScale(Part_1_doc, [model.selection("SOLID", "Scale_3_1_1_1"), model.selection("SOLID", "Scale_3_1_2_2"), model.selection("SOLID", "Scale_3_1_3")], model.selection("VERTEX", "PartSet/Origin"), 1 / SCALE_X, 1 / SCALE_Y, 1 / SCALE_Z, keepSubResults = True) +Scale_4 = model.addScale( + Part_1_doc, + [ + model.selection("SOLID", "Scale_3_1_1_1"), + model.selection("SOLID", "Scale_3_1_2_2"), + model.selection("SOLID", "Scale_3_1_3"), + ], + model.selection("VERTEX", "PartSet/Origin"), + 1 / SCALE_X, + 1 / SCALE_Y, + 1 / SCALE_Z, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Scale_4.feature().error() != "") +assert Scale_4.feature().error() != "" model.begin() -Scale_4.setMainObjects([model.selection("COMPSOLID", "Scale_3_1_1"), model.selection("SOLID", "Scale_3_1_2_2"), model.selection("SOLID", "Scale_3_1_3")]) -REFERENCE[0] = GeomAPI_Pnt(REFERENCE[0].x() / SCALE_X, REFERENCE[0].y() / SCALE_Y, REFERENCE[0].z() / SCALE_Z) -subs[1] = GeomAPI_Pnt(subs[1].x() / SCALE_X, subs[1].y() / SCALE_Y, subs[1].z() / SCALE_Z) +Scale_4.setMainObjects( + [ + model.selection("COMPSOLID", "Scale_3_1_1"), + model.selection("SOLID", "Scale_3_1_2_2"), + model.selection("SOLID", "Scale_3_1_3"), + ] +) +REFERENCE[0] = GeomAPI_Pnt( + REFERENCE[0].x() / SCALE_X, REFERENCE[0].y() / SCALE_Y, REFERENCE[0].z() / SCALE_Z +) +subs[1] = GeomAPI_Pnt( + subs[1].x() / SCALE_X, subs[1].y() / SCALE_Y, subs[1].z() / SCALE_Z +) # B-spline poles are used to calculate the bounding box and thus the middle point subs[1].setX(-30.59017) subs[1].setY(-2.83826244) REFERENCE[1] = average(subs) -REFERENCE[2] = GeomAPI_Pnt(REFERENCE[2].x() / SCALE_X, REFERENCE[2].y() / SCALE_Y, REFERENCE[2].z() / SCALE_Z) +REFERENCE[2] = GeomAPI_Pnt( + REFERENCE[2].x() / SCALE_X, REFERENCE[2].y() / SCALE_Y, REFERENCE[2].z() / SCALE_Z +) assertResult(Scale_4, 17592.5112883) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_3.py b/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_3.py index dc44fc6ea..09a6360ee 100644 --- a/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_3.py +++ b/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_3.py @@ -26,60 +26,177 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 SCALE = 2 model.begin() -Scale_1 = model.addScale(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("VERTEX", "Vertex_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) model.testNbResults(Scale_1, 1) model.testNbSubResults(Scale_1, [0]) model.testNbSubShapes(Scale_1, GeomAPI_Shape.SOLID, [0]) @@ -88,11 +205,19 @@ model.testNbSubShapes(Scale_1, GeomAPI_Shape.EDGE, [0]) model.testNbSubShapes(Scale_1, GeomAPI_Shape.VERTEX, [1]) model.testResultsVolumes(Scale_1, [0]) model.testResultsAreas(Scale_1, [0]) -refPoint = GeomAPI_Pnt(Vertex_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Vertex_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE) +) midPoint = Scale_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Scale_2 = model.addScale(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_2 = model.addScale( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) model.testNbResults(Scale_2, 1) model.testNbSubResults(Scale_2, [0]) model.testNbSubShapes(Scale_2, GeomAPI_Shape.SOLID, [0]) @@ -101,11 +226,19 @@ model.testNbSubShapes(Scale_2, GeomAPI_Shape.EDGE, [1]) model.testNbSubShapes(Scale_2, GeomAPI_Shape.VERTEX, [2]) model.testResultsVolumes(Scale_2, [0]) model.testResultsAreas(Scale_2, [0]) -refPoint = GeomAPI_Pnt(Edge_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Edge_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE) +) midPoint = Scale_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Scale_3 = model.addScale(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_3 = model.addScale( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) model.testNbResults(Scale_3, 1) model.testNbSubResults(Scale_3, [0]) model.testNbSubShapes(Scale_3, GeomAPI_Shape.SOLID, [0]) @@ -114,11 +247,19 @@ model.testNbSubShapes(Scale_3, GeomAPI_Shape.EDGE, [2]) model.testNbSubShapes(Scale_3, GeomAPI_Shape.VERTEX, [4]) model.testResultsVolumes(Scale_3, [0]) model.testResultsAreas(Scale_3, [0]) -refPoint = GeomAPI_Pnt(Wire_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Wire_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE) +) midPoint = Scale_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Scale_4 = model.addScale(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_4 = model.addScale( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) model.testNbResults(Scale_4, 1) model.testNbSubResults(Scale_4, [0]) model.testNbSubShapes(Scale_4, GeomAPI_Shape.SOLID, [0]) @@ -127,11 +268,19 @@ model.testNbSubShapes(Scale_4, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Scale_4, GeomAPI_Shape.VERTEX, [8]) model.testResultsVolumes(Scale_4, [0]) model.testResultsAreas(Scale_4, [109.154152964914914 * (SCALE**2)]) -refPoint = GeomAPI_Pnt(Face_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Face_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE) +) midPoint = Scale_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Scale_5 = model.addScale(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_5 = model.addScale( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) model.testNbResults(Scale_5, 1) model.testNbSubResults(Scale_5, [0]) model.testNbSubShapes(Scale_5, GeomAPI_Shape.SOLID, [0]) @@ -140,11 +289,19 @@ model.testNbSubShapes(Scale_5, GeomAPI_Shape.EDGE, [8]) model.testNbSubShapes(Scale_5, GeomAPI_Shape.VERTEX, [16]) model.testResultsVolumes(Scale_5, [0]) model.testResultsAreas(Scale_5, [182.822012116 * (SCALE**2)]) -refPoint = GeomAPI_Pnt(Shell_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Shell_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE) +) midPoint = Scale_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Scale_6 = model.addScale(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_6 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) model.testNbResults(Scale_6, 1) model.testNbSubResults(Scale_6, [0]) model.testNbSubShapes(Scale_6, GeomAPI_Shape.SOLID, [1]) @@ -152,11 +309,19 @@ model.testNbSubShapes(Scale_6, GeomAPI_Shape.FACE, [6]) model.testNbSubShapes(Scale_6, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(Scale_6, GeomAPI_Shape.VERTEX, [48]) model.testResultsVolumes(Scale_6, [1000 * (SCALE**3)]) -refPoint = GeomAPI_Pnt(Translation_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Translation_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE) +) midPoint = Scale_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Scale_7 = model.addScale(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_7 = model.addScale( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) model.testNbResults(Scale_7, 1) model.testNbSubResults(Scale_7, [3]) model.testNbSubShapes(Scale_7, GeomAPI_Shape.SOLID, [3]) @@ -164,11 +329,19 @@ model.testNbSubShapes(Scale_7, GeomAPI_Shape.FACE, [17]) model.testNbSubShapes(Scale_7, GeomAPI_Shape.EDGE, [66]) model.testNbSubShapes(Scale_7, GeomAPI_Shape.VERTEX, [132]) model.testResultsVolumes(Scale_7, [1589.0486226 * (SCALE**3)]) -refPoint = GeomAPI_Pnt(Partition_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + Partition_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE) +) midPoint = Scale_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Scale_8 = model.addScale(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_8 = model.addScale( + Part_1_doc, + [model.selection("COMPOUND", "AngularCopy_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) model.testNbResults(Scale_8, 1) model.testNbSubResults(Scale_8, [3]) model.testNbSubShapes(Scale_8, GeomAPI_Shape.SOLID, [3]) @@ -176,10 +349,12 @@ model.testNbSubShapes(Scale_8, GeomAPI_Shape.FACE, [18]) model.testNbSubShapes(Scale_8, GeomAPI_Shape.EDGE, [72]) model.testNbSubShapes(Scale_8, GeomAPI_Shape.VERTEX, [144]) model.testResultsVolumes(Scale_8, [3000 * (SCALE**3)]) -refPoint = GeomAPI_Pnt(AngularCopy_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE)) +refPoint = GeomAPI_Pnt( + AngularCopy_1.defaultResult().shape().middlePoint().xyz().multiplied(SCALE) +) midPoint = Scale_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_4.py b/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_4.py index d307394cd..7e16cc6f3 100644 --- a/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_4.py +++ b/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_4.py @@ -26,59 +26,179 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() SCALE = 2 VOLUME = 5589.0486226 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 # collect reference data REFERENCE = [] @@ -86,6 +206,7 @@ for ind in range(0, Compound_1.result().numberOfSubs()): p = Compound_1.result().subResult(ind).resultSubShapePair()[1].middlePoint() REFERENCE.append(p) + def assertResult(theFeature, theNbMoved): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [8]) @@ -99,38 +220,96 @@ def assertResult(theFeature, theNbMoved): ref = GeomAPI_Pnt(REFERENCE[ind].x(), REFERENCE[ind].y(), REFERENCE[ind].z()) if ind < theNbMoved: ref = GeomAPI_Pnt(ref.xyz().multiplied(SCALE)) - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Scale_1 = model.addScale(Part_1_doc, [model.selection("VERTEX", "Compound_1_1_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("VERTEX", "Compound_1_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) assertResult(Scale_1, 1) -Scale_2 = model.addScale(Part_1_doc, [model.selection("EDGE", "Scale_1_1_2")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_2 = model.addScale( + Part_1_doc, + [model.selection("EDGE", "Scale_1_1_2")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) assertResult(Scale_2, 2) -Scale_3 = model.addScale(Part_1_doc, [model.selection("WIRE", "Scale_2_1_3")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_3 = model.addScale( + Part_1_doc, + [model.selection("WIRE", "Scale_2_1_3")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) assertResult(Scale_3, 3) -Scale_4 = model.addScale(Part_1_doc, [model.selection("FACE", "Scale_3_1_4")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_4 = model.addScale( + Part_1_doc, + [model.selection("FACE", "Scale_3_1_4")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) assertResult(Scale_4, 4) -Scale_5 = model.addScale(Part_1_doc, [model.selection("SHELL", "Scale_4_1_5")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_5 = model.addScale( + Part_1_doc, + [model.selection("SHELL", "Scale_4_1_5")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) assertResult(Scale_5, 5) -Scale_6 = model.addScale(Part_1_doc, [model.selection("SOLID", "Scale_5_1_6")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_6 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Scale_5_1_6")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) VOLUME += 1000 * (SCALE**3 - 1) assertResult(Scale_6, 6) -Scale_7 = model.addScale(Part_1_doc, [model.selection("COMPSOLID", "Scale_6_1_7")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_7 = model.addScale( + Part_1_doc, + [model.selection("COMPSOLID", "Scale_6_1_7")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) VOLUME += 1589.0486226 * (SCALE**3 - 1) assertResult(Scale_7, 7) -Scale_8 = model.addScale(Part_1_doc, [model.selection("COMPOUND", "Scale_7_1_8")], model.selection("VERTEX", "PartSet/Origin"), SCALE, keepSubResults = True) +Scale_8 = model.addScale( + Part_1_doc, + [model.selection("COMPOUND", "Scale_7_1_8")], + model.selection("VERTEX", "PartSet/Origin"), + SCALE, + keepSubResults=True, +) VOLUME += 3000 * (SCALE**3 - 1) assertResult(Scale_8, 8) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestScriptSolidEdge.py b/src/FeaturesPlugin/Test/TestScriptSolidEdge.py index f7caedffb..94caefd58 100644 --- a/src/FeaturesPlugin/Test/TestScriptSolidEdge.py +++ b/src/FeaturesPlugin/Test/TestScriptSolidEdge.py @@ -26,15 +26,27 @@ 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) +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 +) SketchLine_3 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.result()) +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/SketchLine_1")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("EDGE", "Edge_1_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + [model.selection("EDGE", "Edge_1_1")], +) model.do() model.checkResult(Split_1, model, 1, [0], [1], [7], [30], [60]) @@ -42,4 +54,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSerialBoolean.py b/src/FeaturesPlugin/Test/TestSerialBoolean.py index f29c1cfdc..231628728 100644 --- a/src/FeaturesPlugin/Test/TestSerialBoolean.py +++ b/src/FeaturesPlugin/Test/TestSerialBoolean.py @@ -35,9 +35,9 @@ # Number rows and columns of cylinders that cuts the big box. Number of Boolena operations is N*N N = 5 -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from GeomAPI import * from GeomAlgoAPI import * from GeomDataAPI import * @@ -52,17 +52,17 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +assert len(aPartFeature.results()) == 1 # Another way is: # aPart = aSession.activeDocument() aPartResult = modelAPI_ResultPart(aPartFeature.firstResult()) aPart = aPartResult.partDoc() -#========================================================================= +# ========================================================================= # Create a list of sketches with one circle inside of each to extrude -#========================================================================= -step = 99. / N -radius = 95. / N / 2. +# ========================================================================= +step = 99.0 / N +radius = 95.0 / N / 2.0 aSession.startOperation() aSketchFeatures = [] @@ -85,9 +85,9 @@ for i in range(0, N): aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusions on circles -#========================================================================= +# ========================================================================= # Build shape from sketcher results # Create extrusions @@ -97,22 +97,21 @@ anExtrusions = [] for i in range(0, N * N): aSketchResult = modelAPI_ResultConstruction(aSketchFeatures[i].firstResult()) anExtrusionFt = aPart.addFeature("Extrusion") - assert (anExtrusionFt.getKind() == "Extrusion") + assert anExtrusionFt.getKind() == "Extrusion" - anExtrusionFt.selectionList("base").append( - aSketchResult, aSketchResult.face(0)) + anExtrusionFt.selectionList("base").append(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 + anExtrusionFt.real("to_offset").setValue(0) # TODO: remove + anExtrusionFt.real("from_offset").setValue(0) # TODO: remove anExtrusions.append(anExtrusionFt) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make rectangle sketch: base for the box, size 100x100 -#========================================================================= +# ========================================================================= aSession.startOperation() aQuadrangleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aQuadrangleSketchFeature.attribute("Origin")) @@ -133,57 +132,61 @@ aLineCStartPoint = geomDataAPI_Point2D(aSketchLineC.attribute("StartPoint")) aLineCEndPoint = geomDataAPI_Point2D(aSketchLineC.attribute("EndPoint")) aLineDStartPoint = geomDataAPI_Point2D(aSketchLineD.attribute("StartPoint")) aLineDEndPoint = geomDataAPI_Point2D(aSketchLineD.attribute("EndPoint")) -aLineAStartPoint.setValue(0., 0.) -aLineAEndPoint.setValue(0., 100.) -aLineBStartPoint.setValue(0., 100.) -aLineBEndPoint.setValue(100., 100.) -aLineCStartPoint.setValue(100., 100.) -aLineCEndPoint.setValue(100., 0.) -aLineDStartPoint.setValue(100., 0.) -aLineDEndPoint.setValue(0., 0.) +aLineAStartPoint.setValue(0.0, 0.0) +aLineAEndPoint.setValue(0.0, 100.0) +aLineBStartPoint.setValue(0.0, 100.0) +aLineBEndPoint.setValue(100.0, 100.0) +aLineCStartPoint.setValue(100.0, 100.0) +aLineCEndPoint.setValue(100.0, 0.0) +aLineDStartPoint.setValue(100.0, 0.0) +aLineDEndPoint.setValue(0.0, 0.0) aSession.finishOperation() aSession.startOperation() -#========================================================================= +# ========================================================================= # Build a big box extrusion -#========================================================================= +# ========================================================================= aSketchResult = modelAPI_ResultConstruction(aQuadrangleSketchFeature.firstResult()) # Create extrusion on them aBox = aPart.addFeature("Extrusion") -aBox.selectionList("base").append( - aSketchResult, aSketchResult.face(0)) +aBox.selectionList("base").append(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 +aBox.real("to_offset").setValue(0) # TODO: remove +aBox.real("from_offset").setValue(0) # TODO: remove aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create a boolean cut of cylinders from the box: # result of Boolean is the first argument of the next Boolean -#========================================================================= +# ========================================================================= aCurrentResult = modelAPI_ResultBody(aBox.firstResult()) aSession.startOperation() aFactory = ModelAPI_Session.get().validators() for i in range(0, N * N): anExtrusionResult = modelAPI_ResultBody(anExtrusions[i].firstResult()) aBooleanFt = aPart.addFeature("Cut") - aBooleanFt.selectionList("main_objects").append(aCurrentResult, aCurrentResult.shape()) - aBooleanFt.selectionList("tool_objects").append(anExtrusionResult, anExtrusionResult.shape()) + aBooleanFt.selectionList("main_objects").append( + aCurrentResult, aCurrentResult.shape() + ) + aBooleanFt.selectionList("tool_objects").append( + anExtrusionResult, anExtrusionResult.shape() + ) aBooleanFt.execute() - assert (aFactory.validate(aBooleanFt)) - assert (len(aBooleanFt.results()) > 0) + assert aFactory.validate(aBooleanFt) + assert len(aBooleanFt.results()) > 0 aCurrentResult = modelAPI_ResultBody(aBooleanFt.firstResult()) - assert (aCurrentResult is not None) + assert aCurrentResult is not None aSession.finishOperation() -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSewing_Groups.py b/src/FeaturesPlugin/Test/TestSewing_Groups.py index b2b8f0ca7..5473978cd 100644 --- a/src/FeaturesPlugin/Test/TestSewing_Groups.py +++ b/src/FeaturesPlugin/Test/TestSewing_Groups.py @@ -23,7 +23,9 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(60, 0, 0, 0) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.result()) @@ -46,7 +48,15 @@ Sketch_1.setVertical(SketchLine_4.result()) model.do() ### Create Face -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")]) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], +) ### Create Sketch Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) @@ -55,7 +65,9 @@ Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) SketchLine_5 = Sketch_2.addLine(75, 0.0001, 0, 0) ### Create SketchProjection -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchPoint_2.result()) @@ -76,24 +88,44 @@ Sketch_2.setHorizontal(SketchLine_7.result()) Sketch_2.setVertical(SketchLine_8.result()) ### Create SketchProjection -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_9 = SketchProjection_3.createdFeature() Sketch_2.setDistance(SketchLine_5.startPoint(), SketchLine_9.result(), 0.0001, True) ### Create SketchProjection -SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Face_1_1/Modified_Vertex&Sketch_1/SketchLine_2_EndVertex&Sketch_1/SketchLine_3_StartVertex"), False) +SketchProjection_4 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "Face_1_1/Modified_Vertex&Sketch_1/SketchLine_2_EndVertex&Sketch_1/SketchLine_3_StartVertex", + ), + False, +) SketchPoint_3 = SketchProjection_4.createdFeature() -Sketch_2.setHorizontalDistance(SketchLine_8.endPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 0) +Sketch_2.setHorizontalDistance( + SketchLine_8.endPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 0 +) model.do() ### Create Face -Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r")]) +Face_2 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_2/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r", + ) + ], +) ### Create Group -Group_1_objects = [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_4"), - model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_1"), - model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_3"), - model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_2")] +Group_1_objects = [ + model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_4"), + model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_1"), + model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_3"), + model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_2"), +] Group_1 = model.addGroup(Part_1_doc, "Edges", Group_1_objects) model.do() @@ -101,10 +133,12 @@ model.testNbResults(Group_1, 1) model.testNbSubShapes(Group_1, GeomAPI_Shape.EDGE, [4]) ### Create Group -Group_2_objects = [model.selection("EDGE", "Face_2_1/Modified_Edge&Sketch_2/SketchLine_6"), - model.selection("EDGE", "Face_2_1/Modified_Edge&Sketch_2/SketchLine_5"), - model.selection("EDGE", "Face_2_1/Modified_Edge&Sketch_2/SketchLine_7"), - model.selection("EDGE", "Face_2_1/Modified_Edge&Sketch_2/SketchLine_8")] +Group_2_objects = [ + model.selection("EDGE", "Face_2_1/Modified_Edge&Sketch_2/SketchLine_6"), + model.selection("EDGE", "Face_2_1/Modified_Edge&Sketch_2/SketchLine_5"), + model.selection("EDGE", "Face_2_1/Modified_Edge&Sketch_2/SketchLine_7"), + model.selection("EDGE", "Face_2_1/Modified_Edge&Sketch_2/SketchLine_8"), +] Group_2 = model.addGroup(Part_1_doc, "Edges", Group_2_objects) model.do() @@ -112,7 +146,13 @@ model.testNbResults(Group_2, 1) model.testNbSubShapes(Group_2, GeomAPI_Shape.EDGE, [4]) ### Create Sewing -Sewing_1 = model.addSewing(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")], 0.0001, allowNonManifold = True, alwaysCreateResult = False) +Sewing_1 = model.addSewing( + Part_1_doc, + [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")], + 0.0001, + allowNonManifold=True, + alwaysCreateResult=False, +) model.do() model.testResults(Sewing_1, 1, [0], [1], [2], [7], [6]) @@ -139,11 +179,14 @@ model.testNbSubShapes(Group_2, GeomAPI_Shape.EDGE, [4]) ### Build Shell model.begin() -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")]) +Shell_1 = model.addShell( + Part_1_doc, + [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")], +) model.do() -model.testResults(Shell_1, 2, [0,0], [1,1], [1,1], [4,4], [4,4]) -model.testNbSubShapes(Shell_1, GeomAPI_Shape.EDGE, [4,4]) +model.testResults(Shell_1, 2, [0, 0], [1, 1], [1, 1], [4, 4], [4, 4]) +model.testNbSubShapes(Shell_1, GeomAPI_Shape.EDGE, [4, 4]) # Move the groups after Shell (move to the end) Part_1_doc.moveFeature(Group_1.feature(), Shell_1.feature()) diff --git a/src/FeaturesPlugin/Test/TestSewing_Manifold.py b/src/FeaturesPlugin/Test/TestSewing_Manifold.py index 5bb6459f4..8f269821d 100644 --- a/src/FeaturesPlugin/Test/TestSewing_Manifold.py +++ b/src/FeaturesPlugin/Test/TestSewing_Manifold.py @@ -25,33 +25,55 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Param_dx = model.addParameter(Part_1_doc, "dx", '10') -Param_alfa = model.addParameter(Part_1_doc, "alfa", '90') +Param_dx = model.addParameter(Part_1_doc, "dx", "10") +Param_alfa = model.addParameter(Part_1_doc, "alfa", "90") # ============================================================================= # Test 1a. Sew two shells with a single common edge (create result) # ============================================================================= 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")], axis = model.selection("EDGE", "PartSet/OX"), distance = "dx", keepSubResults = True) -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], axis = model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), angle = "alfa", keepSubResults = True) - -Shell_1_objects = [model.selection("FACE", "Box_1_1/Top"), - model.selection("FACE", "Box_1_1/Left"), - model.selection("FACE", "Box_1_1/Right"), - model.selection("FACE", "Box_1_1/Back"), - model.selection("FACE", "Box_1_1/Bottom")] +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_2_1")], + axis=model.selection("EDGE", "PartSet/OX"), + distance="dx", + keepSubResults=True, +) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + axis=model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + angle="alfa", + keepSubResults=True, +) + +Shell_1_objects = [ + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), + model.selection("FACE", "Box_1_1/Back"), + model.selection("FACE", "Box_1_1/Bottom"), +] Shell_1 = model.addShell(Part_1_doc, Shell_1_objects) -Shell_2_objects = [model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Top"), - model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Left"), - model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Front"), - model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Right"), - model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Bottom")] +Shell_2_objects = [ + model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Top"), + model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Left"), + model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Front"), + model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Right"), + model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Bottom"), +] Shell_2 = model.addShell(Part_1_doc, Shell_2_objects) model.do() -Sewing_1a = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], 1e-07, allowNonManifold = False, alwaysCreateResult = True) +Sewing_1a = model.addSewing( + Part_1_doc, + [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], + 1e-07, + allowNonManifold=False, + alwaysCreateResult=True, +) model.end() # sewing successful @@ -63,7 +85,13 @@ model.testResults(Sewing_1a, 1, [0], [1], [10], [23], [14]) model.undo() model.begin() -Sewing_1b = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], 1e-07, allowNonManifold = False, alwaysCreateResult = False) +Sewing_1b = model.addSewing( + Part_1_doc, + [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], + 1e-07, + allowNonManifold=False, + alwaysCreateResult=False, +) model.end() # sewing successful @@ -77,7 +105,13 @@ model.begin() Param_alfa.setValue(0) model.do() -Sewing_2a = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], 1e-07, allowNonManifold = False, alwaysCreateResult = True) +Sewing_2a = model.addSewing( + Part_1_doc, + [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], + 1e-07, + allowNonManifold=False, + alwaysCreateResult=True, +) model.end() # sewing successful @@ -89,7 +123,13 @@ model.testResults(Sewing_2a, 1, [0], [1], [10], [20], [12]) model.undo() model.begin() -Sewing_2b = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], 1e-07, allowNonManifold = False, alwaysCreateResult = False) +Sewing_2b = model.addSewing( + Part_1_doc, + [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], + 1e-07, + allowNonManifold=False, + alwaysCreateResult=False, +) model.end() # sewing successful @@ -103,7 +143,13 @@ model.begin() Param_dx.setValue(10.0001) model.do() -Sewing_3a = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], 1e-07, allowNonManifold = False, alwaysCreateResult = True) +Sewing_3a = model.addSewing( + Part_1_doc, + [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], + 1e-07, + allowNonManifold=False, + alwaysCreateResult=True, +) model.end() # no sewing done (result is a compound with the two input shells) @@ -115,7 +161,13 @@ model.testResults(Sewing_3a, 1, [2], [2], [10], [24], [16]) model.undo() model.begin() -Sewing_3b = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], 1e-07, allowNonManifold = False, alwaysCreateResult = False) +Sewing_3b = model.addSewing( + Part_1_doc, + [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], + 1e-07, + allowNonManifold=False, + alwaysCreateResult=False, +) model.end() # no sewing done (no result was created) @@ -129,7 +181,13 @@ model.begin() Param_dx.setValue(10.0001) model.do() -Sewing_4a = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], 1e-04, allowNonManifold = False, alwaysCreateResult = True) +Sewing_4a = model.addSewing( + Part_1_doc, + [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], + 1e-04, + allowNonManifold=False, + alwaysCreateResult=True, +) model.end() # sewing successful @@ -141,7 +199,13 @@ model.testResults(Sewing_4a, 1, [0], [1], [10], [20], [12]) model.undo() model.begin() -Sewing_4b = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], 1e-04, allowNonManifold = False, alwaysCreateResult = False) +Sewing_4b = model.addSewing( + Part_1_doc, + [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], + 1e-04, + allowNonManifold=False, + alwaysCreateResult=False, +) model.end() # sewing successful diff --git a/src/FeaturesPlugin/Test/TestSewing_NonManifold.py b/src/FeaturesPlugin/Test/TestSewing_NonManifold.py index d5aa39f61..c07af9f5c 100644 --- a/src/FeaturesPlugin/Test/TestSewing_NonManifold.py +++ b/src/FeaturesPlugin/Test/TestSewing_NonManifold.py @@ -25,8 +25,8 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Param_dx = model.addParameter(Part_1_doc, "dx", '10') -Param_alfa = model.addParameter(Part_1_doc, "alfa", '90') +Param_dx = model.addParameter(Part_1_doc, "dx", "10") +Param_alfa = model.addParameter(Part_1_doc, "alfa", "90") # ============================================================================= # Test 1. Sew two shells with a single common edge @@ -35,16 +35,34 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Box_2 = model.addBox(Part_1_doc, 10, 10, 10) Vertex_1 = model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]") Vertex_2 = model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]") -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], startPoint = Vertex_1, endPoint = Vertex_2, keepSubResults = True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_2_1")], + startPoint=Vertex_1, + endPoint=Vertex_2, + keepSubResults=True, +) -Shell_1_objects = [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Front")] +Shell_1_objects = [ + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Front"), +] Shell_1 = model.addShell(Part_1_doc, Shell_1_objects) -Shell_2_objects = [model.selection("FACE", "Translation_1_1/MF:Translated&Box_2_1/Back"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_2_1/Bottom")] +Shell_2_objects = [ + model.selection("FACE", "Translation_1_1/MF:Translated&Box_2_1/Back"), + model.selection("FACE", "Translation_1_1/MF:Translated&Box_2_1/Bottom"), +] Shell_2 = model.addShell(Part_1_doc, Shell_2_objects) model.do() -Sewing_1 = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], 1e-07, allowNonManifold = False, alwaysCreateResult = True) +Sewing_1 = model.addSewing( + Part_1_doc, + [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], + 1e-07, + allowNonManifold=False, + alwaysCreateResult=True, +) model.end() # sewing failed (result is a compound with the two input shells) @@ -56,7 +74,13 @@ model.testResults(Sewing_1, 1, [2], [2], [4], [14], [12]) model.undo() model.begin() -Sewing_2 = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], 1e-07, allowNonManifold = True, alwaysCreateResult = True) +Sewing_2 = model.addSewing( + Part_1_doc, + [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], + 1e-07, + allowNonManifold=True, + alwaysCreateResult=True, +) model.end() # sewing successful diff --git a/src/FeaturesPlugin/Test/TestSplitCompFaceSolid.py b/src/FeaturesPlugin/Test/TestSplitCompFaceSolid.py index d62894c43..b8eb32d3f 100644 --- a/src/FeaturesPlugin/Test/TestSplitCompFaceSolid.py +++ b/src/FeaturesPlugin/Test/TestSplitCompFaceSolid.py @@ -28,29 +28,68 @@ Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "L", "10") model.addParameter(Part_1_doc, "Shift", "5") Box_1 = model.addBox(Part_1_doc, "L", "L", "L") -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "Shift", True) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "Shift", True +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +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()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.result() +) SketchLine_2 = Sketch_1.addLine(11.4564392373896, -5, 0, 5) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(0, 5, 0, -12.5) -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()) +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() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "L+Shift/2") -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) +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() -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/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")]) -Split_2 = model.addSplit(Part_1_doc, [model.selection("COMPOUND", "Split_1_1")], [model.selection("SOLID", "Box_1_1")]) +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/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire" + ) + ], +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + [model.selection("FACE", "Plane_2")], +) +Split_2 = model.addSplit( + Part_1_doc, + [model.selection("COMPOUND", "Split_1_1")], + [model.selection("SOLID", "Box_1_1")], +) model.do() model.checkResult(Split_2, model, 1, [6], [0], [6], [22], [44]) @@ -58,4 +97,4 @@ model.testHaveNamingSubshapes(Split_2, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitCompsolidPlane.py b/src/FeaturesPlugin/Test/TestSplitCompsolidPlane.py index 796474e8a..72f61ebdd 100644 --- a/src/FeaturesPlugin/Test/TestSplitCompsolidPlane.py +++ b/src/FeaturesPlugin/Test/TestSplitCompsolidPlane.py @@ -24,15 +24,30 @@ 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) +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()) +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()) +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) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2")], [model.selection("FACE", "PartSet/XOZ")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Split_1 = model.addSplit( + 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() diff --git a/src/FeaturesPlugin/Test/TestSplitEdgeEdge.py b/src/FeaturesPlugin/Test/TestSplitEdgeEdge.py index 6befa7f5e..06e78202e 100644 --- a/src/FeaturesPlugin/Test/TestSplitEdgeEdge.py +++ b/src/FeaturesPlugin/Test/TestSplitEdgeEdge.py @@ -24,23 +24,37 @@ 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(-43.24383164005806, 13.92597968069667, 63.17997097242381, 62.8867924528302) +SketchLine_1 = Sketch_1.addLine( + -43.24383164005806, 13.92597968069667, 63.17997097242381, 62.8867924528302 +) 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/SketchLine_1"), False) +SketchLine_2 = Sketch_2.addLine( + -21.12944291883177, 24.09981691608177, 39.13933236574746, 51.82677414066782 +) +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()) +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/SketchLine_1")]) Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_2")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("EDGE", "Edge_2_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + [model.selection("EDGE", "Edge_2_1")], +) model.do() -model.checkResult(Split_1,model,1,[3],[0],[0],[3],[6]) -model.testHaveNamingSubshapes(Split_1,model,Part_1_doc) +model.checkResult(Split_1, model, 1, [3], [0], [0], [3], [6]) +model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitEdgeEdgeIntersected.py b/src/FeaturesPlugin/Test/TestSplitEdgeEdgeIntersected.py index 3fb96bc1c..aa4d35220 100644 --- a/src/FeaturesPlugin/Test/TestSplitEdgeEdgeIntersected.py +++ b/src/FeaturesPlugin/Test/TestSplitEdgeEdgeIntersected.py @@ -24,19 +24,27 @@ partSet = model.moduleDocument() 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(-54.08747895500726, -7.310347750362856, 54.27191756168357, 63.68373962264153) +SketchLine_1 = Sketch_1.addLine( + -54.08747895500726, -7.310347750362856, 54.27191756168357, 63.68373962264153 +) 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) +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/SketchLine_1")]) Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_2")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("EDGE", "Edge_2_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + [model.selection("EDGE", "Edge_2_1")], +) model.do() -model.checkResult(Split_1,model,1,[2],[0],[0],[2],[4]) -model.testHaveNamingSubshapes(Split_1,model,Part_1_doc) +model.checkResult(Split_1, model, 1, [2], [0], [0], [2], [4]) +model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitEdgeFace.py b/src/FeaturesPlugin/Test/TestSplitEdgeFace.py index cc8cc5d0f..d74a6e39e 100644 --- a/src/FeaturesPlugin/Test/TestSplitEdgeFace.py +++ b/src/FeaturesPlugin/Test/TestSplitEdgeFace.py @@ -24,22 +24,54 @@ partSet = model.moduleDocument() 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(-65.15998142235124, 15.60729985486212, 25.76227082728593, 71.65526357039188) -SketchLine_2 = Sketch_1.addLine(25.76227082728593, 71.65526357039188, 74.75234281567489, -47.08338548621191) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(74.75234281567489, -47.08338548621191, 13.30716777939044, -81.12733381712628) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(13.30716777939044, -81.12733381712628, -65.15998142235124, 15.60729985486212) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint()) +SketchLine_1 = Sketch_1.addLine( + -65.15998142235124, 15.60729985486212, 25.76227082728593, 71.65526357039188 +) +SketchLine_2 = Sketch_1.addLine( + 25.76227082728593, 71.65526357039188, 74.75234281567489, -47.08338548621191 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 74.75234281567489, -47.08338548621191, 13.30716777939044, -81.12733381712628 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + 13.30716777939044, -81.12733381712628, -65.15998142235124, 15.60729985486212 +) +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_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_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) +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/SketchLine_5")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("FACE", "Face_1_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + [model.selection("FACE", "Face_1_1")], +) model.do() model.checkResult(Split_1, model, 1, [3], [0], [0], [3], [6]) @@ -47,4 +79,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitEdgeShell.py b/src/FeaturesPlugin/Test/TestSplitEdgeShell.py index bd5bdce9f..dca84035e 100644 --- a/src/FeaturesPlugin/Test/TestSplitEdgeShell.py +++ b/src/FeaturesPlugin/Test/TestSplitEdgeShell.py @@ -26,27 +26,65 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchArc_1 = Sketch_1.addArc(28.24683132290313, 24.84281403912743, 0, 50, 56.77054208906745, 0, False) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchArc_1 = Sketch_1.addArc( + 28.24683132290313, 24.84281403912743, 0, 50, 56.77054208906745, 0, False +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.endPoint()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.endPoint() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.result()) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchArc_1.startPoint(), SketchAPI_Line(SketchLine_1).startPoint(), 50) -SketchArc_2 = Sketch_1.addArc(38.14157263904823, 16.22495851193372, 56.77054208906745, 0, 34.15529753265601, 40.60522496371553, False) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1]) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_2.result() +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchArc_1.startPoint(), SketchAPI_Line(SketchLine_1).startPoint(), 50 +) +SketchArc_2 = Sketch_1.addArc( + 38.14157263904823, + 16.22495851193372, + 56.77054208906745, + 0, + 34.15529753265601, + 40.60522496371553, + False, +) +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/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) +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) +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/SketchLine_3")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("SHELL", "Shell_1_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + [model.selection("SHELL", "Shell_1_1")], +) model.do() model.checkResult(Split_1, model, 1, [3], [0], [0], [3], [6]) @@ -54,4 +92,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitEdgeSolid.py b/src/FeaturesPlugin/Test/TestSplitEdgeSolid.py index 1c3515b4f..2c8ea29ee 100644 --- a/src/FeaturesPlugin/Test/TestSplitEdgeSolid.py +++ b/src/FeaturesPlugin/Test/TestSplitEdgeSolid.py @@ -26,15 +26,27 @@ 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) +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 +) SketchLine_3 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.result()) +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/SketchLine_1")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("SOLID", "Box_1_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + [model.selection("SOLID", "Box_1_1")], +) model.do() model.checkResult(Split_1, model, 1, [0], [0], [0], [1], [2]) @@ -42,4 +54,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitEdgeSolidIntersected.py b/src/FeaturesPlugin/Test/TestSplitEdgeSolidIntersected.py index ed8f55fa6..6afb09597 100644 --- a/src/FeaturesPlugin/Test/TestSplitEdgeSolidIntersected.py +++ b/src/FeaturesPlugin/Test/TestSplitEdgeSolidIntersected.py @@ -25,17 +25,36 @@ 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) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Cone_1_1/Face_3"), 5, True) +Cone_1 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 5, + 10, +) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "Cone_1_1/Face_3"), 5, True +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchLine_1 = Sketch_1.addLine(-8.679188755740876, 4.967059748203267, 8.679188755740878, -4.967059748203268) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchLine_1 = Sketch_1.addLine( + -8.679188755740876, 4.967059748203267, 8.679188755740878, -4.967059748203268 +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result()) +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/SketchLine_1")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("SOLID", "Cone_1_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + [model.selection("SOLID", "Cone_1_1")], +) model.do() model.checkResult(Split_1, model, 1, [3], [0], [0], [3], [6]) @@ -43,4 +62,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitEdgeVertex.py b/src/FeaturesPlugin/Test/TestSplitEdgeVertex.py index 403114034..d3be815e7 100644 --- a/src/FeaturesPlugin/Test/TestSplitEdgeVertex.py +++ b/src/FeaturesPlugin/Test/TestSplitEdgeVertex.py @@ -28,17 +28,25 @@ Part_1_doc = Part_1.document() 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) +SketchLine_1 = Sketch_1.addLine( + -27.61369370623992, 41.69872643310781, 64.30052615729069, -35.76145957046036 +) SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Point_1"), False) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchAPI_Point(SketchPoint_1).coordinates()) +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/SketchLine_1")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("VERTEX", "Vertex_1_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + [model.selection("VERTEX", "Vertex_1_1")], +) model.do() -model.checkResult(Split_1,model,1,[2],[0],[0],[2],[4]) -model.testHaveNamingSubshapes(Split_1,model,Part_1_doc) +model.checkResult(Split_1, model, 1, [2], [0], [0], [2], [4]) +model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitEdgeWire.py b/src/FeaturesPlugin/Test/TestSplitEdgeWire.py index 9cb212f88..cafe28a86 100644 --- a/src/FeaturesPlugin/Test/TestSplitEdgeWire.py +++ b/src/FeaturesPlugin/Test/TestSplitEdgeWire.py @@ -24,22 +24,49 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchLine_1 = Sketch_1.addLine(-67.57764876632801, 2.198838896952097, 88.39332365747461, 44.12336719883891) +SketchLine_1 = Sketch_1.addLine( + -67.57764876632801, 2.198838896952097, 88.39332365747461, 44.12336719883891 +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchLine_2 = Sketch_2.addLine(-40.60522496371553, -29.75761973875181, -38.84615384615385, 66.99129172714079) -SketchLine_3 = Sketch_2.addLine(-38.84615384615385, 66.99129172714079, 50.86647314949202, 73.4412191582003) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_2.addLine(50.86647314949202, 73.4412191582003, 55.26415094339622, -34.15529753265602) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_2.addLine(55.26415094339622, -34.15529753265602, -40.60522496371553, -29.75761973875181) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_2.startPoint()) +SketchLine_2 = Sketch_2.addLine( + -40.60522496371553, -29.75761973875181, -38.84615384615385, 66.99129172714079 +) +SketchLine_3 = Sketch_2.addLine( + -38.84615384615385, 66.99129172714079, 50.86647314949202, 73.4412191582003 +) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_2.addLine( + 50.86647314949202, 73.4412191582003, 55.26415094339622, -34.15529753265602 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_2.addLine( + 55.26415094339622, -34.15529753265602, -40.60522496371553, -29.75761973875181 +) +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/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_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) -Split_1 = model.addSplit(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("WIRE", "Wire_1_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + [model.selection("WIRE", "Wire_1_1")], +) model.do() model.checkResult(Split_1, model, 1, [3], [0], [0], [3], [6]) @@ -47,4 +74,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitFaceEdge.py b/src/FeaturesPlugin/Test/TestSplitFaceEdge.py index eaf853939..dd50d05c7 100644 --- a/src/FeaturesPlugin/Test/TestSplitFaceEdge.py +++ b/src/FeaturesPlugin/Test/TestSplitFaceEdge.py @@ -24,27 +24,59 @@ partSet = model.moduleDocument() 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(-65.15998142235124, 15.60729985486212, 25.76227082728593, 71.65526357039188) -SketchLine_2 = Sketch_1.addLine(25.76227082728593, 71.65526357039188, 74.75234281567489, -47.08338548621191) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(74.75234281567489, -47.08338548621191, 13.30716777939044, -81.12733381712628) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(13.30716777939044, -81.12733381712628, -65.15998142235124, 15.60729985486212) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint()) +SketchLine_1 = Sketch_1.addLine( + -65.15998142235124, 15.60729985486212, 25.76227082728593, 71.65526357039188 +) +SketchLine_2 = Sketch_1.addLine( + 25.76227082728593, 71.65526357039188, 74.75234281567489, -47.08338548621191 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 74.75234281567489, -47.08338548621191, 13.30716777939044, -81.12733381712628 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + 13.30716777939044, -81.12733381712628, -65.15998142235124, 15.60729985486212 +) +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_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_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) +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/SketchLine_5")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("EDGE", "Edge_1_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + [model.selection("EDGE", "Edge_1_1")], +) model.do() -model.checkResult(Split_1,model,1,[2],[0],[2],[8],[16]) -model.testHaveNamingSubshapes(Split_1,model,Part_1_doc) +model.checkResult(Split_1, model, 1, [2], [0], [2], [8], [16]) +model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitFaceEdgeInside.py b/src/FeaturesPlugin/Test/TestSplitFaceEdgeInside.py index 109aaa777..61fac279a 100644 --- a/src/FeaturesPlugin/Test/TestSplitFaceEdgeInside.py +++ b/src/FeaturesPlugin/Test/TestSplitFaceEdgeInside.py @@ -24,30 +24,72 @@ 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(-31.22351233671988, 15.68505079825835, -49.40058055152394, 17.44412191582002, -17.30100145268062, 27.5029960835475, True) -SketchLine_1 = Sketch_1.addLine(-17.30100145268062, 27.5029960835475, -6.596516690856308, -20.66908563134978) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) -SketchLine_2 = Sketch_1.addLine(-6.596516690856308, -20.66908563134978, -34.74165457184325, -28.87808417997097) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(-34.74165457184325, -28.87808417997097, -49.40058055152394, 17.44412191582002) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.endPoint()) +SketchArc_1 = Sketch_1.addArc( + -31.22351233671988, + 15.68505079825835, + -49.40058055152394, + 17.44412191582002, + -17.30100145268062, + 27.5029960835475, + True, +) +SketchLine_1 = Sketch_1.addLine( + -17.30100145268062, 27.5029960835475, -6.596516690856308, -20.66908563134978 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.startPoint() +) +SketchLine_2 = Sketch_1.addLine( + -6.596516690856308, -20.66908563134978, -34.74165457184325, -28.87808417997097 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + -34.74165457184325, -28.87808417997097, -49.40058055152394, 17.44412191582002 +) +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_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/SketchLine_2"), False) +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/SketchLine_2"), False +) SketchLine_5 = SketchProjection_1.createdFeature() -SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_4.result(), SketchLine_5.result()) +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/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_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) -Split_1 = model.addSplit(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("EDGE", "Edge_1_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + [model.selection("EDGE", "Edge_1_1")], +) model.do() -model.checkResult(Split_1,model,1,[0],[0],[1],[5],[10]) -model.testHaveNamingSubshapes(Split_1,model,Part_1_doc) +model.checkResult(Split_1, model, 1, [0], [0], [1], [5], [10]) +model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitFaceEdgePerpendicular.py b/src/FeaturesPlugin/Test/TestSplitFaceEdgePerpendicular.py index 1279406ee..ce30e3734 100644 --- a/src/FeaturesPlugin/Test/TestSplitFaceEdgePerpendicular.py +++ b/src/FeaturesPlugin/Test/TestSplitFaceEdgePerpendicular.py @@ -24,31 +24,68 @@ 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(-27.76647174128943, 72.31029012920524, 42.2686420251427, 59.94944420697596) -SketchLine_2 = Sketch_1.addLine(42.2686420251427, 59.94944420697596, 59.0507718766223, 21.43074552356853) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(59.0507718766223, 21.43074552356853, 56.1909608273397, -69.919416180974) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(56.1909608273397, -69.919416180974, -29.91225626113892, -65.09334567012574) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(-29.91225626113892, -65.09334567012574, -57.18321726979322, -2.500460309588558) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(-57.18321726979322, -2.500460309588558, -27.76647174128943, 72.31029012920524) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_1.startPoint()) +SketchLine_1 = Sketch_1.addLine( + -27.76647174128943, 72.31029012920524, 42.2686420251427, 59.94944420697596 +) +SketchLine_2 = Sketch_1.addLine( + 42.2686420251427, 59.94944420697596, 59.0507718766223, 21.43074552356853 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 59.0507718766223, 21.43074552356853, 56.1909608273397, -69.919416180974 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + 56.1909608273397, -69.919416180974, -29.91225626113892, -65.09334567012574 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + -29.91225626113892, -65.09334567012574, -57.18321726979322, -2.500460309588558 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + -57.18321726979322, -2.500460309588558, -27.76647174128943, 72.31029012920524 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_1.startPoint() +) 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) +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/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_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) -Split_1 = model.addSplit(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("EDGE", "Edge_1_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + [model.selection("EDGE", "Edge_1_1")], +) model.do() -model.checkResult(Split_1,model,1,[0],[0],[1],[6],[13]) -model.testHaveNamingSubshapes(Split_1,model,Part_1_doc) +model.checkResult(Split_1, model, 1, [0], [0], [1], [6], [13]) +model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitFaceFace.py b/src/FeaturesPlugin/Test/TestSplitFaceFace.py index 340d44e8a..da2c62d53 100644 --- a/src/FeaturesPlugin/Test/TestSplitFaceFace.py +++ b/src/FeaturesPlugin/Test/TestSplitFaceFace.py @@ -25,36 +25,104 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "R", "50") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(-49.81325699578132, 35.39936274902501, 0, 8.200436015051352) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchLine_1 = Sketch_1.addLine( + -49.81325699578132, 35.39936274902501, 0, 8.200436015051352 +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) -SketchLine_3 = Sketch_1.addLine(0, 8.200436015051352, 49.94978427678259, 33.32234621934526) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) -SketchArc_1 = Sketch_1.addArc(0, 31.08202242513997, 49.94978427678259, 33.32234621934526, -49.81325699578132, 35.39936274902501, False) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) +SketchLine_3 = Sketch_1.addLine( + 0, 8.200436015051352, 49.94978427678259, 33.32234621934526 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) +SketchArc_1 = Sketch_1.addArc( + 0, + 31.08202242513997, + 49.94978427678259, + 33.32234621934526, + -49.81325699578132, + 35.39936274902501, + False, +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_2.result() +) 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/SketchLine_1_EndVertex"), False) +SketchLine_4 = Sketch_2.addLine( + 31.79164821526215, 49.99496405877289, 8.200436015051352, 0 +) +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/SketchArc_1"), False) +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/SketchArc_1"), False +) SketchPoint_2 = SketchProjection_3.createdFeature() -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()) +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/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")]) -Split_1 = model.addSplit(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" + ) + ], +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + [model.selection("FACE", "Face_2_1")], +) model.do() model.checkResult(Split_1, model, 1, [2], [0], [2], [6], [12]) @@ -62,4 +130,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitFaceShell.py b/src/FeaturesPlugin/Test/TestSplitFaceShell.py index c284077d5..4a0294658 100644 --- a/src/FeaturesPlugin/Test/TestSplitFaceShell.py +++ b/src/FeaturesPlugin/Test/TestSplitFaceShell.py @@ -29,59 +29,113 @@ model.addParameter(Part_1_doc, "D", "50") model.addParameter(Part_1_doc, "L", "30") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 28.78679656440358, 21.21320343559643, 50) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) SketchLine_3 = Sketch_1.addLine(21.21320343559643, 50, 0, 71.21320343559643) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_2.result() +) SketchLine_4 = Sketch_1.addLine(0, 71.21320343559643, -21.21320343559642, 50) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(-21.21320343559642, 50, 0, 28.78679656440358) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.endPoint() +) SketchLine_6 = Sketch_1.addLine(-21.21320343559642, 50, 21.21320343559643, 50) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_6.endPoint()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_6.result(), "D", True) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_6.endPoint() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_6.result(), "D", True +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "L") -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_5.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_4.result(), SketchLine_5.result() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_2.createdFeature() SketchLine_7 = Sketch_2.addLine(50, -39.61510263929618, 50, 43.87280058651025) SketchLine_7.setName("SketchLine_8") SketchLine_7.result().setName("SketchLine_8") SketchLine_7.setAuxiliary(True) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_7.result()) -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_7.result(), "D", True) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_7.result(), "D", True +) SketchLine_8 = Sketch_2.addLine(57.5, 0, 65, -10.81485284151855) SketchLine_8.setName("SketchLine_9") SketchLine_8.result().setName("SketchLine_9") -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_9 = SketchProjection_3.createdFeature() SketchLine_9.setName("SketchLine_10") SketchLine_9.result().setName("SketchLine_10") -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_8.startPoint(), SketchLine_9.result()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_8.startPoint(), SketchLine_9.result() +) SketchLine_10 = Sketch_2.addLine(65, -10.81485284151855, 65, 11.50710132369052) SketchLine_10.setName("SketchLine_11") SketchLine_10.result().setName("SketchLine_11") -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_10.startPoint() +) SketchLine_11 = Sketch_2.addLine(65, 11.50710132369052, 50, 11.50710132369052) SketchLine_11.setName("SketchLine_12") SketchLine_11.result().setName("SketchLine_12") -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchLine_8.startPoint(), SketchLine_7.result(), "L/4", True) -SketchConstraintDistance_4 = Sketch_2.setDistance(SketchLine_8.endPoint(), SketchLine_7.result(), "L/2", True) -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchLine_10.endPoint(), SketchLine_7.result(), "L/2", True) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchLine_8.startPoint(), SketchLine_7.result(), "L/4", True +) +SketchConstraintDistance_4 = Sketch_2.setDistance( + SketchLine_8.endPoint(), SketchLine_7.result(), "L/2", True +) +SketchConstraintDistance_5 = Sketch_2.setDistance( + SketchLine_10.endPoint(), SketchLine_7.result(), "L/2", True +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_11.result()) -SketchConstraintMirror_1_objects = [SketchLine_8.result(), SketchLine_10.result(), SketchLine_11.result()] -SketchConstraintMirror_1 = Sketch_2.addMirror(SketchLine_7.result(), SketchConstraintMirror_1_objects) +SketchConstraintMirror_1_objects = [ + SketchLine_8.result(), + SketchLine_10.result(), + SketchLine_11.result(), +] +SketchConstraintMirror_1 = Sketch_2.addMirror( + SketchLine_7.result(), SketchConstraintMirror_1_objects +) [SketchLine_12, SketchLine_13, SketchLine_14] = SketchConstraintMirror_1.mirrored() SketchLine_14.setName("SketchLine_15") SketchLine_14.result().setName("SketchLine_15") @@ -92,14 +146,47 @@ SketchLine_12.result().setName("SketchLine_13") SketchLine_15 = Sketch_2.addLine(42.5, 0, 57.5, 0) SketchLine_15.setName("SketchLine_16") 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()) +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/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/Face-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_15r-SketchLine_14r-SketchLine_13r-SketchLine_16f_wire")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("FACE", "Face_3_1")], [model.selection("SHELL", "Shell_1_1")]) +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/Face-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_15r-SketchLine_14r-SketchLine_13r-SketchLine_16f_wire", + ) + ], +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("FACE", "Face_3_1")], + [model.selection("SHELL", "Shell_1_1")], +) model.do() model.checkResult(Split_1, model, 1, [3], [0], [3], [14], [28]) @@ -107,4 +194,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitFaceSolid.py b/src/FeaturesPlugin/Test/TestSplitFaceSolid.py index d26539da8..4cbce9397 100644 --- a/src/FeaturesPlugin/Test/TestSplitFaceSolid.py +++ b/src/FeaturesPlugin/Test/TestSplitFaceSolid.py @@ -28,27 +28,60 @@ Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "L", "10") model.addParameter(Part_1_doc, "Shift", "5") Box_1 = model.addBox(Part_1_doc, "L", "L", "L") -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "Shift", True) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "Shift", True +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +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()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.result() +) SketchLine_2 = Sketch_1.addLine(11.4564392373896, -5, 0, 5) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(0, 5, 0, -12.5) -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()) +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() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "L+Shift/2") -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) +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/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")]) -Split_1 = model.addSplit(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" + ) + ], +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + [model.selection("SOLID", "Box_1_1")], +) model.do() model.checkResult(Split_1, model, 1, [4], [0], [4], [15], [30]) @@ -56,4 +89,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitFaceVertex.py b/src/FeaturesPlugin/Test/TestSplitFaceVertex.py index 1d354e3f2..4e62af9a9 100644 --- a/src/FeaturesPlugin/Test/TestSplitFaceVertex.py +++ b/src/FeaturesPlugin/Test/TestSplitFaceVertex.py @@ -25,28 +25,53 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Point_2 = model.addPoint(Part_1_doc, 22, 33, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(80.77068214804063, 60.54136429608128, -35.9143686502177, 60.54136429608128) -SketchLine_2 = Sketch_1.addLine(-35.9143686502177, 60.54136429608128, -35.9143686502177, -37.67343976777939) -SketchLine_3 = Sketch_1.addLine(-35.9143686502177, -37.67343976777939, 80.77068214804063, -37.67343976777939) -SketchLine_4 = Sketch_1.addLine(80.77068214804063, -37.67343976777939, 80.77068214804063, 60.54136429608128) -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()) +SketchLine_1 = Sketch_1.addLine( + 80.77068214804063, 60.54136429608128, -35.9143686502177, 60.54136429608128 +) +SketchLine_2 = Sketch_1.addLine( + -35.9143686502177, 60.54136429608128, -35.9143686502177, -37.67343976777939 +) +SketchLine_3 = Sketch_1.addLine( + -35.9143686502177, -37.67343976777939, 80.77068214804063, -37.67343976777939 +) +SketchLine_4 = Sketch_1.addLine( + 80.77068214804063, -37.67343976777939, 80.77068214804063, 60.54136429608128 +) +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_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_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")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("VERTEX", "Vertex_1_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + [model.selection("VERTEX", "Vertex_1_1")], +) model.do() -model.checkResult(Split_1,model,1,[0],[0],[1],[4],[9]) -model.testHaveNamingSubshapes(Split_1,model,Part_1_doc) +model.checkResult(Split_1, model, 1, [0], [0], [1], [4], [9]) +model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitFaceWire.py b/src/FeaturesPlugin/Test/TestSplitFaceWire.py index 07c944a42..3faa7608c 100644 --- a/src/FeaturesPlugin/Test/TestSplitFaceWire.py +++ b/src/FeaturesPlugin/Test/TestSplitFaceWire.py @@ -25,33 +25,96 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "R", "50") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(-49.81325699578132, 35.39936274902501, 0, 8.200436015051352) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchLine_1 = Sketch_1.addLine( + -49.81325699578132, 35.39936274902501, 0, 8.200436015051352 +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) -SketchLine_3 = Sketch_1.addLine(0, 8.200436015051352, 49.94978427678259, 33.32234621934526) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) -SketchArc_1 = Sketch_1.addArc(0, 31.08202242513997, 49.94978427678259, 33.32234621934526, -49.81325699578132, 35.39936274902501, False) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) +SketchLine_3 = Sketch_1.addLine( + 0, 8.200436015051352, 49.94978427678259, 33.32234621934526 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) +SketchArc_1 = Sketch_1.addArc( + 0, + 31.08202242513997, + 49.94978427678259, + 33.32234621934526, + -49.81325699578132, + 35.39936274902501, + False, +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_2.result() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "R") model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_4 = Sketch_2.addLine(-42.38833891077762, 73.71572760627062, -18.23994072168525, 7.835320880296757) -SketchLine_5 = Sketch_2.addLine(-18.23994072168525, 7.835320880296757, 13.89341696052619, 27.33089138697832) -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.93732104572751) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -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()) +SketchLine_4 = Sketch_2.addLine( + -42.38833891077762, 73.71572760627062, -18.23994072168525, 7.835320880296757 +) +SketchLine_5 = Sketch_2.addLine( + -18.23994072168525, 7.835320880296757, 13.89341696052619, 27.33089138697832 +) +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.93732104572751 +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +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/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")]) -Split_1 = model.addSplit(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", + ) + ], +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + [model.selection("WIRE", "Wire_1_1")], +) model.do() model.checkResult(Split_1, model, 1, [5], [0], [5], [21], [42]) @@ -59,4 +122,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitShellConstrPlane.py b/src/FeaturesPlugin/Test/TestSplitShellConstrPlane.py index 172fbdf0d..1953f7b0d 100644 --- a/src/FeaturesPlugin/Test/TestSplitShellConstrPlane.py +++ b/src/FeaturesPlugin/Test/TestSplitShellConstrPlane.py @@ -26,27 +26,63 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchArc_1 = Sketch_1.addArc(28.24683132290313, 24.84281403912743, 0, 50, 56.77054208906745, 0, False) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchArc_1 = Sketch_1.addArc( + 28.24683132290313, 24.84281403912743, 0, 50, 56.77054208906745, 0, False +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.endPoint()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.endPoint() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.result()) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchArc_1.startPoint(), SketchAPI_Line(SketchLine_1).startPoint(), 50) -SketchArc_2 = Sketch_1.addArc(38.14157263904823, 16.22495851193372, 56.77054208906745, 0, 34.15529753265601, 40.60522496371553, False) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1]) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_2.result() +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchArc_1.startPoint(), SketchAPI_Line(SketchLine_1).startPoint(), 50 +) +SketchArc_2 = Sketch_1.addArc( + 38.14157263904823, + 16.22495851193372, + 56.77054208906745, + 0, + 34.15529753265601, + 40.60522496371553, + False, +) +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/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) +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")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("FACE", "PartSet/XOZ")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + [model.selection("FACE", "PartSet/XOZ")], +) model.do() -model.checkResult(Split_1,model,1,[0],[0],[3],[12],[24]) -model.testHaveNamingSubshapes(Split_1,model,Part_1_doc) +model.checkResult(Split_1, model, 1, [0], [0], [3], [12], [24]) +model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitShellEdge.py b/src/FeaturesPlugin/Test/TestSplitShellEdge.py index b44ca6620..889f054bd 100644 --- a/src/FeaturesPlugin/Test/TestSplitShellEdge.py +++ b/src/FeaturesPlugin/Test/TestSplitShellEdge.py @@ -26,32 +26,70 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchArc_1 = Sketch_1.addArc(28.24683132290313, 24.84281403912743, 0, 50, 56.77054208906745, 0, False) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchArc_1 = Sketch_1.addArc( + 28.24683132290313, 24.84281403912743, 0, 50, 56.77054208906745, 0, False +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.endPoint()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.endPoint() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.result()) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchArc_1.startPoint(), SketchAPI_Line(SketchLine_1).startPoint(), 50) -SketchArc_2 = Sketch_1.addArc(38.14157263904823, 16.22495851193372, 56.77054208906745, 0, 34.15529753265601, 40.60522496371553, False) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1]) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_2.result() +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchArc_1.startPoint(), SketchAPI_Line(SketchLine_1).startPoint(), 50 +) +SketchArc_2 = Sketch_1.addArc( + 38.14157263904823, + 16.22495851193372, + 56.77054208906745, + 0, + 34.15529753265601, + 40.60522496371553, + False, +) +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/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) +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) +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/SketchLine_3")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("EDGE", "Edge_1_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + [model.selection("EDGE", "Edge_1_1")], +) model.do() -model.checkResult(Split_1,model,1,[0],[0],[2],[8],[18]) -model.testHaveNamingSubshapes(Split_1,model,Part_1_doc) +model.checkResult(Split_1, model, 1, [0], [0], [2], [8], [18]) +model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitShellFace.py b/src/FeaturesPlugin/Test/TestSplitShellFace.py index f3eadcb10..23183f92d 100644 --- a/src/FeaturesPlugin/Test/TestSplitShellFace.py +++ b/src/FeaturesPlugin/Test/TestSplitShellFace.py @@ -29,56 +29,108 @@ model.addParameter(Part_1_doc, "D", "50") model.addParameter(Part_1_doc, "L", "30") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(-6, 29.93619865618197, 18, 47.93619865618197) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() SketchLine_3 = Sketch_1.addLine(18, 47.93619865618197, 0, 71.93619865618197) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_2.result()) +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(0, 71.93619865618197, -24, 53.93619865618197) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(-24, 53.93619865618197, -6, 29.93619865618197) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.endPoint() +) SketchLine_6 = Sketch_1.addLine(-24, 53.93619865618197, 18, 47.93619865618197) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_6.endPoint()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_6.result(), "D", True) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_6.endPoint() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_6.result(), "D", True +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "L") -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_5.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_5.endPoint(), SketchLine_2.result(), "L/5", True) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_4.result(), SketchLine_5.result() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_5.endPoint(), SketchLine_2.result(), "L/5", True +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_2.createdFeature() SketchLine_7 = Sketch_2.addLine(50, -39.61510263929618, 50, 43.87280058651025) SketchLine_7.setName("SketchLine_8") SketchLine_7.result().setName("SketchLine_8") SketchLine_7.setAuxiliary(True) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_7.result()) -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_7.result(), "D", True) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_7.result(), "D", True +) SketchLine_8 = Sketch_2.addLine(50, -3.170182618622045, 80, -14.17077918941143) SketchLine_8.setName("SketchLine_9") SketchLine_8.result().setName("SketchLine_9") -SketchLine_9 = Sketch_2.addLine(80, -14.17077918941143, 64.99999999999999, 12.18920647716607) +SketchLine_9 = Sketch_2.addLine( + 80, -14.17077918941143, 64.99999999999999, 12.18920647716607 +) SketchLine_9.setName("SketchLine_11") SketchLine_9.result().setName("SketchLine_11") -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_9") -SketchLine_10 = Sketch_2.addLine(64.99999999999999, 12.18920647716607, 50, 12.18920647716607) +SketchLine_10 = Sketch_2.addLine( + 64.99999999999999, 12.18920647716607, 50, 12.18920647716607 +) SketchLine_10.setName("SketchLine_12") SketchLine_10.result().setName("SketchLine_12") -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +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 = 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) +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()) -SketchConstraintMirror_1_objects = [SketchLine_8.result(), SketchLine_9.result(), SketchLine_10.result()] -SketchConstraintMirror_1 = Sketch_2.addMirror(SketchLine_7.result(), SketchConstraintMirror_1_objects) +SketchConstraintMirror_1_objects = [ + SketchLine_8.result(), + SketchLine_9.result(), + SketchLine_10.result(), +] +SketchConstraintMirror_1 = Sketch_2.addMirror( + SketchLine_7.result(), SketchConstraintMirror_1_objects +) [SketchLine_11, SketchLine_12, SketchLine_13] = SketchConstraintMirror_1.mirrored() SketchLine_13.setName("SketchLine_15") SketchLine_13.result().setName("SketchLine_15") @@ -86,18 +138,53 @@ 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/SketchLine_3_EndVertex"), 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 = 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 = 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/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/Face-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_15r-SketchLine_14r-SketchLine_13r_wire")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("FACE", "Face_3_1")]) +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/Face-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_15r-SketchLine_14r-SketchLine_13r_wire", + ) + ], +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + [model.selection("FACE", "Face_3_1")], +) model.do() model.checkResult(Split_1, model, 1, [0], [0], [4], [13], [26]) @@ -105,4 +192,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitShellShell.py b/src/FeaturesPlugin/Test/TestSplitShellShell.py index 1d2f59004..cdb800722 100644 --- a/src/FeaturesPlugin/Test/TestSplitShellShell.py +++ b/src/FeaturesPlugin/Test/TestSplitShellShell.py @@ -28,56 +28,154 @@ Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "D", "50") model.addParameter(Part_1_doc, "L", "30") 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_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-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-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()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint()) -SketchLine_6 = Sketch_1.addLine(-25.61552812810082, 57.66225366792627, 15.61552812808831, 47.66225366793383) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_6.endPoint()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_6.result(), "D", True) +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-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() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.endPoint() +) +SketchLine_6 = Sketch_1.addLine( + -25.61552812810082, 57.66225366792627, 15.61552812808831, 47.66225366793383 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_6.endPoint() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_6.result(), "D", True +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "L") -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_5.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_5.endPoint(), SketchLine_2.result(), "L/3", True) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_4.result(), SketchLine_5.result() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_5.endPoint(), SketchLine_2.result(), "L/3", True +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchLine_7 = Sketch_2.addLine(50, 15.56025031353752, 50, -15.54016280334104) SketchLine_8 = Sketch_2.addLine(50, -15.54016280334104, 36.52981427174974, 0) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_9 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.result()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.result() +) SketchLine_10 = Sketch_2.addLine(36.52981427174974, 0, 50, 15.56025031353752) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_10.startPoint() +) +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/SketchLine_3_EndVertex"), False) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_7.startPoint(), SketchLine_11.startPoint() +) +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()) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchPoint_1.result() +) SketchLine_12 = Sketch_2.addLine(73.27778179602213, 0, 50, -15.54016280334104) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_12.endPoint()) -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_9).startPoint(), SketchLine_7.result(), "D", True) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_12.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/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")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("SHELL", "Shell_2_1")]) +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")], +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + [model.selection("SHELL", "Shell_2_1")], +) model.do() model.checkResult(Split_1, model, 1, [0], [0], [4], [15], [30]) @@ -85,4 +183,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitShellSolid.py b/src/FeaturesPlugin/Test/TestSplitShellSolid.py index 3fa99d440..47844a8e1 100644 --- a/src/FeaturesPlugin/Test/TestSplitShellSolid.py +++ b/src/FeaturesPlugin/Test/TestSplitShellSolid.py @@ -28,30 +28,72 @@ Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "L", "10") model.addParameter(Part_1_doc, "Shift", "5") Box_1 = model.addBox(Part_1_doc, "L", "L", "L") -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "Shift", True) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "Shift", True +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +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()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.result() +) SketchLine_2 = Sketch_1.addLine(11.4564392373896, -5, 0, 5) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(0, 5, 0, -12.5) -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()) +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() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "L+Shift/2") -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) +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() -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/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Split_1_1_2"), model.selection("FACE", "Split_1_1_1")]) -Split_2 = model.addSplit(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("SOLID", "Box_1_1")]) +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/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire" + ) + ], +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + [model.selection("FACE", "Plane_2")], +) +Shell_1 = model.addShell( + Part_1_doc, + [model.selection("FACE", "Split_1_1_2"), model.selection("FACE", "Split_1_1_1")], +) +Split_2 = model.addSplit( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + [model.selection("SOLID", "Box_1_1")], +) model.do() model.checkResult(Split_2, model, 1, [0], [0], [6], [22], [44]) @@ -59,4 +101,4 @@ model.testHaveNamingSubshapes(Split_2, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitShellVertex.py b/src/FeaturesPlugin/Test/TestSplitShellVertex.py index 4bf67b6f3..dc8c9752e 100644 --- a/src/FeaturesPlugin/Test/TestSplitShellVertex.py +++ b/src/FeaturesPlugin/Test/TestSplitShellVertex.py @@ -26,25 +26,61 @@ 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(9.761379814097372, -58.25586643592183, 0, 0, -48.40807467084933, -47.99209154562215, False) -SketchArc_2 = Sketch_1.addArc(-12.6706171814691, -54.29782746957817, -48.40807467084933, -47.99209154562215, 12.46009047944227, -80.47750863283412, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1]) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchArc_1 = Sketch_1.addArc( + 9.761379814097372, + -58.25586643592183, + 0, + 0, + -48.40807467084933, + -47.99209154562215, + False, +) +SketchArc_2 = Sketch_1.addArc( + -12.6706171814691, + -54.29782746957817, + -48.40807467084933, + -47.99209154562215, + 12.46009047944227, + -80.47750863283412, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchArc_2.results()[1] +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) +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/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) +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")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("VERTEX", "Vertex_1_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + [model.selection("VERTEX", "Vertex_1_1")], +) model.do() -model.checkResult(Split_1,model,1,[0],[0],[2],[9],[18]) -model.testHaveNamingSubshapes(Split_1,model,Part_1_doc) +model.checkResult(Split_1, model, 1, [0], [0], [2], [9], [18]) +model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitShellWire.py b/src/FeaturesPlugin/Test/TestSplitShellWire.py index 50a2bd65b..1fa26cb6a 100644 --- a/src/FeaturesPlugin/Test/TestSplitShellWire.py +++ b/src/FeaturesPlugin/Test/TestSplitShellWire.py @@ -29,52 +29,118 @@ model.addParameter(Part_1_doc, "D", "50") model.addParameter(Part_1_doc, "L", "30") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 28.78679656440358, 21.21320343559643, 50) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) SketchLine_3 = Sketch_1.addLine(21.21320343559643, 50, 0, 71.21320343559643) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_2.result() +) SketchLine_4 = Sketch_1.addLine(0, 71.21320343559643, -21.21320343559642, 50) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(-21.21320343559642, 50, 0, 28.78679656440358) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.endPoint() +) SketchLine_6 = Sketch_1.addLine(-21.21320343559642, 50, 21.21320343559643, 50) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_6.endPoint()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_6.result(), "D", True) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_6.endPoint() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_6.result(), "D", True +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "L") -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_5.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_4.result(), SketchLine_5.result() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_7 = Sketch_2.addLine(-14.33356820392057, 60, 15.66643179607943, 60) SketchLine_8 = Sketch_2.addLine(15.66643179607943, 60, 15.66643179607943, 30) SketchLine_9 = Sketch_2.addLine(15.66643179607943, 30, -14.33356820392057, 30) SketchLine_10 = Sketch_2.addLine(-14.33356820392057, 30, -14.33356820392057, 60) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_12 = 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()) SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_9.result(), "L") SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_8.result(), "L") -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_2.createdFeature() -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_9.result(), "L", True) +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/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_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")] +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_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) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("WIRE", "Wire_1_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + [model.selection("WIRE", "Wire_1_1")], +) model.do() model.checkResult(Split_1, model, 1, [0], [0], [8], [30], [60]) @@ -82,4 +148,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitSolid2ConstructionPlanes.py b/src/FeaturesPlugin/Test/TestSplitSolid2ConstructionPlanes.py index 81a602252..cb500361b 100644 --- a/src/FeaturesPlugin/Test/TestSplitSolid2ConstructionPlanes.py +++ b/src/FeaturesPlugin/Test/TestSplitSolid2ConstructionPlanes.py @@ -23,13 +23,24 @@ 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) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], [model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ")]) +Cone_1 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 5, + 10, +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Cone_1_1")], + [model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ")], +) model.do() -model.checkResult(Split_1,model,1,[4],[4],[20],[72],[144]) -model.testHaveNamingSubshapes(Split_1,model,Part_1_doc) +model.checkResult(Split_1, model, 1, [4], [4], [20], [72], [144]) +model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitSolidCompFace.py b/src/FeaturesPlugin/Test/TestSplitSolidCompFace.py index 15b7951a3..7f532a162 100644 --- a/src/FeaturesPlugin/Test/TestSplitSolidCompFace.py +++ b/src/FeaturesPlugin/Test/TestSplitSolidCompFace.py @@ -28,29 +28,68 @@ Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "L", "10") model.addParameter(Part_1_doc, "Shift", "12") Box_1 = model.addBox(Part_1_doc, "L", "L", "L") -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "L/2", True) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "L/2", True +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() 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) +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()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.result() +) SketchLine_2 = Sketch_1.addLine(15.49193338482974, -4, 0, 12) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_2.startPoint() +) 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()) +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() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "L+Shift/2") -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) +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() -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/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")]) -Split_2 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "Split_1_1")]) +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/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire" + ) + ], +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + [model.selection("FACE", "Plane_2")], +) +Split_2 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + [model.selection("COMPOUND", "Split_1_1")], +) model.do() model.checkResult(Split_2, model, 1, [2], [2], [14], [60], [120]) @@ -58,4 +97,4 @@ model.testHaveNamingSubshapes(Split_2, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitSolidCompShell.py b/src/FeaturesPlugin/Test/TestSplitSolidCompShell.py index 5b43f67e6..ed039734d 100644 --- a/src/FeaturesPlugin/Test/TestSplitSolidCompShell.py +++ b/src/FeaturesPlugin/Test/TestSplitSolidCompShell.py @@ -28,31 +28,79 @@ Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "L", "10") model.addParameter(Part_1_doc, "Shift", "12") Box_1 = model.addBox(Part_1_doc, "L", "L", "L") -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "L/2", True) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "L/2", True +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() 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) +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()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.result() +) SketchLine_2 = Sketch_1.addLine(15.49193338482974, -4, 0, 12) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_2.startPoint() +) 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()) +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() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "L+Shift/2") -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) +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() -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/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Split_1_1_2"), model.selection("FACE", "Split_1_1_1")]) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OZ"), 1, 3) -Split_2 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "LinearCopy_1_1")]) +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/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire" + ) + ], +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + [model.selection("FACE", "Plane_2")], +) +Shell_1 = model.addShell( + Part_1_doc, + [model.selection("FACE", "Split_1_1_2"), model.selection("FACE", "Split_1_1_1")], +) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 1, + 3, +) +Split_2 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + [model.selection("COMPOUND", "LinearCopy_1_1")], +) model.do() model.checkResult(Split_2, model, 1, [4], [4], [30], [132], [264]) @@ -60,4 +108,4 @@ model.testHaveNamingSubshapes(Split_2, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitSolidEdge.py b/src/FeaturesPlugin/Test/TestSplitSolidEdge.py index f7caedffb..94caefd58 100755 --- a/src/FeaturesPlugin/Test/TestSplitSolidEdge.py +++ b/src/FeaturesPlugin/Test/TestSplitSolidEdge.py @@ -26,15 +26,27 @@ 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) +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 +) SketchLine_3 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.result()) +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/SketchLine_1")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("EDGE", "Edge_1_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + [model.selection("EDGE", "Edge_1_1")], +) model.do() model.checkResult(Split_1, model, 1, [0], [1], [7], [30], [60]) @@ -42,4 +54,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitSolidFace.py b/src/FeaturesPlugin/Test/TestSplitSolidFace.py index a7d42d3c4..82a1c287e 100644 --- a/src/FeaturesPlugin/Test/TestSplitSolidFace.py +++ b/src/FeaturesPlugin/Test/TestSplitSolidFace.py @@ -28,27 +28,60 @@ Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "L", "10") model.addParameter(Part_1_doc, "Shift", "12") Box_1 = model.addBox(Part_1_doc, "L", "L", "L") -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "L/2", True) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "L/2", True +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() 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) +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()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.result() +) SketchLine_2 = Sketch_1.addLine(15.49193338482974, -4, 0, 12) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_2.startPoint() +) 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()) +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() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "L+Shift/2") -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) +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/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")]) -Split_1 = model.addSplit(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" + ) + ], +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + [model.selection("FACE", "Face_1_1")], +) model.do() model.checkResult(Split_1, model, 1, [2], [2], [12], [48], [96]) @@ -56,4 +89,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitSolidShell.py b/src/FeaturesPlugin/Test/TestSplitSolidShell.py index 28aa147e8..23f382cf4 100644 --- a/src/FeaturesPlugin/Test/TestSplitSolidShell.py +++ b/src/FeaturesPlugin/Test/TestSplitSolidShell.py @@ -28,30 +28,72 @@ Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "L", "10") model.addParameter(Part_1_doc, "Shift", "12") Box_1 = model.addBox(Part_1_doc, "L", "L", "L") -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "L/2", True) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "L/2", True +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() 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) +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()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.result() +) SketchLine_2 = Sketch_1.addLine(15.49193338482974, -4, 0, 12) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_2.startPoint() +) 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()) +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() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "L+Shift/2") -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) +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() -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/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Split_1_1_2"), model.selection("FACE", "Split_1_1_1")]) -Split_2 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("SHELL", "Shell_1_1")]) +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/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire" + ) + ], +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + [model.selection("FACE", "Plane_2")], +) +Shell_1 = model.addShell( + Part_1_doc, + [model.selection("FACE", "Split_1_1_2"), model.selection("FACE", "Split_1_1_1")], +) +Split_2 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + [model.selection("SHELL", "Shell_1_1")], +) model.do() model.checkResult(Split_2, model, 1, [2], [2], [14], [60], [120]) @@ -59,4 +101,4 @@ model.testHaveNamingSubshapes(Split_2, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitWireEdge.py b/src/FeaturesPlugin/Test/TestSplitWireEdge.py index f1790c222..40ebe45fd 100644 --- a/src/FeaturesPlugin/Test/TestSplitWireEdge.py +++ b/src/FeaturesPlugin/Test/TestSplitWireEdge.py @@ -24,27 +24,54 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchLine_1 = Sketch_1.addLine(-67.57764876632801, 2.198838896952097, 88.39332365747461, 44.12336719883891) +SketchLine_1 = Sketch_1.addLine( + -67.57764876632801, 2.198838896952097, 88.39332365747461, 44.12336719883891 +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchLine_2 = Sketch_2.addLine(-40.60522496371553, -29.75761973875181, -38.84615384615385, 66.99129172714079) -SketchLine_3 = Sketch_2.addLine(-38.84615384615385, 66.99129172714079, 50.86647314949202, 73.4412191582003) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_2.addLine(50.86647314949202, 73.4412191582003, 55.26415094339622, -34.15529753265602) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_2.addLine(55.26415094339622, -34.15529753265602, -40.60522496371553, -29.75761973875181) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_2.startPoint()) +SketchLine_2 = Sketch_2.addLine( + -40.60522496371553, -29.75761973875181, -38.84615384615385, 66.99129172714079 +) +SketchLine_3 = Sketch_2.addLine( + -38.84615384615385, 66.99129172714079, 50.86647314949202, 73.4412191582003 +) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_2.addLine( + 50.86647314949202, 73.4412191582003, 55.26415094339622, -34.15529753265602 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_2.addLine( + 55.26415094339622, -34.15529753265602, -40.60522496371553, -29.75761973875181 +) +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/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_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) -Split_1 = model.addSplit(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("EDGE", "Edge_1_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + [model.selection("EDGE", "Edge_1_1")], +) model.do() -model.checkResult(Split_1,model,1,[0],[0],[0],[6],[12]) -model.testHaveNamingSubshapes(Split_1,model,Part_1_doc) +model.checkResult(Split_1, model, 1, [0], [0], [0], [6], [12]) +model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitWireFace.py b/src/FeaturesPlugin/Test/TestSplitWireFace.py index d9cd64292..8935a5634 100644 --- a/src/FeaturesPlugin/Test/TestSplitWireFace.py +++ b/src/FeaturesPlugin/Test/TestSplitWireFace.py @@ -25,39 +25,108 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "R", "50") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(-49.81325699578132, 35.39936274902501, 0, 8.200436015051352) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchLine_1 = Sketch_1.addLine( + -49.81325699578132, 35.39936274902501, 0, 8.200436015051352 +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) -SketchLine_3 = Sketch_1.addLine(0, 8.200436015051352, 49.94978427678259, 33.32234621934526) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) -SketchArc_1 = Sketch_1.addArc(0, 31.08202242513997, 49.94978427678259, 33.32234621934526, -49.81325699578132, 35.39936274902501, False) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) +SketchLine_3 = Sketch_1.addLine( + 0, 8.200436015051352, 49.94978427678259, 33.32234621934526 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) +SketchArc_1 = Sketch_1.addArc( + 0, + 31.08202242513997, + 49.94978427678259, + 33.32234621934526, + -49.81325699578132, + 35.39936274902501, + False, +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_2.result() +) 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/SketchArc_1"), False) +SketchLine_4 = Sketch_2.addLine( + 29.74624907439609, 30.07487215963349, 31.08202242513997, 0 +) +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()) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchPoint_1.result() +) SketchLine_5 = Sketch_2.addLine(31.08202242513997, 0, 45.45797599933665, 0) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_6 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result()) -SketchLine_7 = Sketch_2.addLine(45.45797599933665, 0, 45.83553599350717, -22.747645239555) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint()) -SketchLine_8 = Sketch_2.addLine(45.83553599350717, -22.747645239555, 70.40999925541598, 30.039147749218) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchLine_9 = Sketch_2.addLine(70.40999925541598, 30.039147749218, 29.74624907439609, 30.07487215963349) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchLine_9.endPoint()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.result() +) +SketchLine_7 = Sketch_2.addLine( + 45.45797599933665, 0, 45.83553599350717, -22.747645239555 +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_7.startPoint() +) +SketchLine_8 = Sketch_2.addLine( + 45.83553599350717, -22.747645239555, 70.40999925541598, 30.039147749218 +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchLine_9 = Sketch_2.addLine( + 70.40999925541598, 30.039147749218, 29.74624907439609, 30.07487215963349 +) +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/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")]) -Split_1 = model.addSplit(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", + ) + ], +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + [model.selection("FACE", "Face_1_1")], +) model.do() model.checkResult(Split_1, model, 1, [0], [0], [0], [6], [12]) @@ -65,4 +134,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitWireShell.py b/src/FeaturesPlugin/Test/TestSplitWireShell.py index 75ee45330..41d656132 100644 --- a/src/FeaturesPlugin/Test/TestSplitWireShell.py +++ b/src/FeaturesPlugin/Test/TestSplitWireShell.py @@ -29,59 +29,113 @@ model.addParameter(Part_1_doc, "D", "50") model.addParameter(Part_1_doc, "L", "30") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 28.78679656440358, 21.21320343559643, 50) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) SketchLine_3 = Sketch_1.addLine(21.21320343559643, 50, 0, 71.21320343559643) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_2.result() +) SketchLine_4 = Sketch_1.addLine(0, 71.21320343559643, -21.21320343559642, 50) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(-21.21320343559642, 50, 0, 28.78679656440358) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.endPoint() +) SketchLine_6 = Sketch_1.addLine(-21.21320343559642, 50, 21.21320343559643, 50) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_6.endPoint()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_6.result(), "D", True) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_6.endPoint() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_6.result(), "D", True +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "L") -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_3.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_5.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_3.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_4.result(), SketchLine_5.result() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_1.result(), SketchLine_3.result() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_2.createdFeature() SketchLine_7 = Sketch_2.addLine(50, -39.61510263929618, 50, 43.87280058651025) SketchLine_7.setName("SketchLine_8") SketchLine_7.result().setName("SketchLine_8") SketchLine_7.setAuxiliary(True) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_7.result()) -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_7.result(), "D", True) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_7.result(), "D", True +) SketchLine_8 = Sketch_2.addLine(57.5, 0, 65, -10.81485284151855) SketchLine_8.setName("SketchLine_9") SketchLine_8.result().setName("SketchLine_9") -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_9 = SketchProjection_3.createdFeature() SketchLine_9.setName("SketchLine_10") SketchLine_9.result().setName("SketchLine_10") -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_8.startPoint(), SketchLine_9.result()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_8.startPoint(), SketchLine_9.result() +) SketchLine_10 = Sketch_2.addLine(65, -10.81485284151855, 65, 11.50710132369052) SketchLine_10.setName("SketchLine_11") SketchLine_10.result().setName("SketchLine_11") -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_10.startPoint() +) SketchLine_11 = Sketch_2.addLine(65, 11.50710132369052, 50, 11.50710132369052) SketchLine_11.setName("SketchLine_12") SketchLine_11.result().setName("SketchLine_12") -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchLine_8.startPoint(), SketchLine_7.result(), "L/4", True) -SketchConstraintDistance_4 = Sketch_2.setDistance(SketchLine_8.endPoint(), SketchLine_7.result(), "L/2", True) -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchLine_10.endPoint(), SketchLine_7.result(), "L/2", True) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchLine_8.startPoint(), SketchLine_7.result(), "L/4", True +) +SketchConstraintDistance_4 = Sketch_2.setDistance( + SketchLine_8.endPoint(), SketchLine_7.result(), "L/2", True +) +SketchConstraintDistance_5 = Sketch_2.setDistance( + SketchLine_10.endPoint(), SketchLine_7.result(), "L/2", True +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_11.result()) -SketchConstraintMirror_1_objects = [SketchLine_8.result(), SketchLine_10.result(), SketchLine_11.result()] -SketchConstraintMirror_1 = Sketch_2.addMirror(SketchLine_7.result(), SketchConstraintMirror_1_objects) +SketchConstraintMirror_1_objects = [ + SketchLine_8.result(), + SketchLine_10.result(), + SketchLine_11.result(), +] +SketchConstraintMirror_1 = Sketch_2.addMirror( + SketchLine_7.result(), SketchConstraintMirror_1_objects +) [SketchLine_12, SketchLine_13, SketchLine_14] = SketchConstraintMirror_1.mirrored() SketchLine_14.setName("SketchLine_15") SketchLine_14.result().setName("SketchLine_15") @@ -92,14 +146,47 @@ SketchLine_12.result().setName("SketchLine_13") SketchLine_15 = Sketch_2.addLine(42.5, 0, 57.5, 0) SketchLine_15.setName("SketchLine_16") 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()) +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/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/Face-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_15r-SketchLine_14r-SketchLine_13r-SketchLine_16f_wire")]) -Split_1 = model.addSplit(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("SHELL", "Shell_1_1")]) +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/Face-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_15r-SketchLine_14r-SketchLine_13r-SketchLine_16f_wire", + ) + ], +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + [model.selection("SHELL", "Shell_1_1")], +) model.do() model.checkResult(Split_1, model, 1, [0], [0], [0], [10], [20]) @@ -107,4 +194,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitWireSolid.py b/src/FeaturesPlugin/Test/TestSplitWireSolid.py index 7395c2b16..5e5b2c7aa 100644 --- a/src/FeaturesPlugin/Test/TestSplitWireSolid.py +++ b/src/FeaturesPlugin/Test/TestSplitWireSolid.py @@ -28,27 +28,60 @@ Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "L", "10") model.addParameter(Part_1_doc, "Shift", "5") Box_1 = model.addBox(Part_1_doc, "L", "L", "L") -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "Shift", True) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), "Shift", True +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +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()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.result() +) SketchLine_2 = Sketch_1.addLine(11.4564392373896, -5, 0, 5) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(0, 5, 0, -12.5) -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()) +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() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "L+Shift/2") -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) +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/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")]) -Split_1 = model.addSplit(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" + ) + ], +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + [model.selection("SOLID", "Box_1_1")], +) model.do() model.checkResult(Split_1, model, 1, [0], [0], [0], [9], [18]) @@ -56,4 +89,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitWireVertex.py b/src/FeaturesPlugin/Test/TestSplitWireVertex.py index b81693523..2ee797307 100644 --- a/src/FeaturesPlugin/Test/TestSplitWireVertex.py +++ b/src/FeaturesPlugin/Test/TestSplitWireVertex.py @@ -28,24 +28,46 @@ Part_1_doc = Part_1.document() 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.43492861072797, 41.55044273324706, 64.29883100829633, -35.76346801736826) +SketchLine_1 = Sketch_1.addLine( + -27.43492861072797, 41.55044273324706, 64.29883100829633, -35.76346801736826 +) SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Point_1"), False) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchAPI_Point(SketchPoint_1).coordinates()) -SketchLine_2 = Sketch_1.addLine(64.5972559141328, -34.82170453629492, 63.39686648861513, 69.37209759863701) -SketchLine_3 = Sketch_1.addLine(63.39686648861513, 69.37209759863701, -27.43492861072797, 41.55044273324706) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchAPI_Point(SketchPoint_1).coordinates() +) +SketchLine_2 = Sketch_1.addLine( + 64.5972559141328, -34.82170453629492, 63.39686648861513, 69.37209759863701 +) +SketchLine_3 = Sketch_1.addLine( + 63.39686648861513, 69.37209759863701, -27.43492861072797, 41.55044273324706 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +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_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/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) -Split_1 = model.addSplit(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("VERTEX", "Vertex_1_1")]) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + [model.selection("VERTEX", "Vertex_1_1")], +) model.do() -model.checkResult(Split_1,model,1,[0],[0],[0],[4],[8]) -model.testHaveNamingSubshapes(Split_1,model,Part_1_doc) +model.checkResult(Split_1, model, 1, [0], [0], [0], [4], [8]) +model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSplitWireWire.py b/src/FeaturesPlugin/Test/TestSplitWireWire.py index 7cba4f48d..88d2102d1 100644 --- a/src/FeaturesPlugin/Test/TestSplitWireWire.py +++ b/src/FeaturesPlugin/Test/TestSplitWireWire.py @@ -25,36 +25,104 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "R", "50") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(-49.81325699578132, 35.39936274902501, 0, 8.200436015051352) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchLine_1 = Sketch_1.addLine( + -49.81325699578132, 35.39936274902501, 0, 8.200436015051352 +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) -SketchLine_3 = Sketch_1.addLine(0, 8.200436015051352, 49.94978427678259, 33.32234621934526) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) -SketchArc_1 = Sketch_1.addArc(0, 31.08202242513997, 49.94978427678259, 33.32234621934526, -49.81325699578132, 35.39936274902501, False) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) +SketchLine_3 = Sketch_1.addLine( + 0, 8.200436015051352, 49.94978427678259, 33.32234621934526 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) +SketchArc_1 = Sketch_1.addArc( + 0, + 31.08202242513997, + 49.94978427678259, + 33.32234621934526, + -49.81325699578132, + 35.39936274902501, + False, +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_2.result() +) 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/SketchLine_1_EndVertex"), False) +SketchLine_4 = Sketch_2.addLine( + 31.79164821526215, 49.99496405877289, 8.200436015051352, 0 +) +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/SketchArc_1"), False) +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/SketchArc_1"), False +) SketchPoint_2 = SketchProjection_3.createdFeature() -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()) +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/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")]) -Split_1 = model.addSplit(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" + ) + ], +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + [model.selection("WIRE", "Wire_2_1")], +) model.do() model.checkResult(Split_1, model, 1, [0], [0], [0], [4], [8]) @@ -62,4 +130,4 @@ model.testHaveNamingSubshapes(Split_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_1.py b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_1.py index c14d72649..432a9766a 100644 --- a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_1.py +++ b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_1.py @@ -27,50 +27,138 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 ORIGIN = GeomAPI_Pnt(0, 0, 0) -CENTER = GeomAPI_Pnt(SketchEllipse_1.center().pnt().x(), SketchEllipse_1.center().pnt().y(), 0) +CENTER = GeomAPI_Pnt( + SketchEllipse_1.center().pnt().x(), SketchEllipse_1.center().pnt().y(), 0 +) + def symmetry(thePoint, theCenter): - return GeomAPI_Pnt(2 * theCenter.x() - thePoint.x(), 2 * theCenter.y() - thePoint.y(), 2 * theCenter.z() - thePoint.z()) + return GeomAPI_Pnt( + 2 * theCenter.x() - thePoint.x(), + 2 * theCenter.y() - thePoint.y(), + 2 * theCenter.z() - thePoint.z(), + ) model.begin() -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("VERTEX", "PartSet/Origin"), False) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("VERTEX", "PartSet/Origin"), + False, +) model.testNbResults(Symmetry_1, 1) model.testNbSubResults(Symmetry_1, [0]) model.testNbSubShapes(Symmetry_1, GeomAPI_Shape.SOLID, [1]) @@ -79,13 +167,21 @@ model.testNbSubShapes(Symmetry_1, GeomAPI_Shape.EDGE, [18]) model.testNbSubShapes(Symmetry_1, GeomAPI_Shape.VERTEX, [36]) model.testResultsVolumes(Symmetry_1, [542.746463956]) -refPoint = symmetry(Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint(), ORIGIN) +refPoint = symmetry( + Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint(), + ORIGIN, +) midPoint = Symmetry_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, Symmetry_1, [Compound_2.result()], True) -Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_1_1_2_1")], model.selection("VERTEX", "PartSet/Origin"), False) +Symmetry_2 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Recover_1_1_2_1")], + model.selection("VERTEX", "PartSet/Origin"), + False, +) model.testNbResults(Symmetry_2, 1) model.testNbSubResults(Symmetry_2, [0]) model.testNbSubShapes(Symmetry_2, GeomAPI_Shape.SOLID, [1]) @@ -94,13 +190,26 @@ model.testNbSubShapes(Symmetry_2, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Symmetry_2, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Symmetry_2, [785.39816339745]) -refPoint = symmetry(Recover_1.result().subResult(1).subResult(0).resultSubShapePair()[0].shape().middlePoint(), ORIGIN) +refPoint = symmetry( + Recover_1.result() + .subResult(1) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + ORIGIN, +) midPoint = Symmetry_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, Symmetry_2, [Recover_1.result()], True) -Symmetry_3 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_2_1_3")], model.selection("VERTEX", "PartSet/Origin"), False) +Symmetry_3 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Recover_2_1_3")], + model.selection("VERTEX", "PartSet/Origin"), + False, +) model.testNbResults(Symmetry_3, 1) model.testNbSubResults(Symmetry_3, [0]) model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.SOLID, [1]) @@ -109,13 +218,25 @@ model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Symmetry_3, [785.39816339745]) -refPoint = symmetry(Recover_2.result().subResult(2).resultSubShapePair()[0].shape().middlePoint(), ORIGIN) +refPoint = symmetry( + Recover_2.result().subResult(2).resultSubShapePair()[0].shape().middlePoint(), + ORIGIN, +) midPoint = Symmetry_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_3 = model.addRecover(Part_1_doc, Symmetry_3, [Recover_2.result()], True) -Symmetry_4 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_3_1_1_1"), model.selection("SOLID", "Recover_3_1_2_2"), model.selection("SOLID", "Recover_3_1_3")], model.selection("VERTEX", "PartSet/Origin"), False) +Symmetry_4 = model.addSymmetry( + Part_1_doc, + [ + model.selection("SOLID", "Recover_3_1_1_1"), + model.selection("SOLID", "Recover_3_1_2_2"), + model.selection("SOLID", "Recover_3_1_3"), + ], + model.selection("VERTEX", "PartSet/Origin"), + False, +) model.testNbResults(Symmetry_4, 3) model.testNbSubResults(Symmetry_4, [0, 0, 0]) model.testNbSubShapes(Symmetry_4, GeomAPI_Shape.SOLID, [1, 1, 1]) @@ -124,17 +245,34 @@ model.testNbSubShapes(Symmetry_4, GeomAPI_Shape.EDGE, [24, 6, 6]) model.testNbSubShapes(Symmetry_4, GeomAPI_Shape.VERTEX, [48, 12, 12]) model.testResultsVolumes(Symmetry_4, [3444.394198615, 785.39816339745, 785.39816339745]) -REFERENCE = [Recover_3.result().subResult(0).subResult(0).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(1).subResult(1).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()] +REFERENCE = [ + Recover_3.result() + .subResult(0) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result() + .subResult(1) + .subResult(1) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint(), +] for res, ref in zip(Symmetry_4.results(), REFERENCE): ref = symmetry(ref, ORIGIN) midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE) + assert midPoint.distance(ref) < TOLERANCE Recover_4 = model.addRecover(Part_1_doc, Symmetry_4, [Recover_3.result()], True) -Symmetry_5 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_4_1_1_5")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_center"), True) +Symmetry_5 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Recover_4_1_1_5")], + model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_center"), + True, +) model.testNbResults(Symmetry_5, 1) model.testNbSubResults(Symmetry_5, [2]) model.testNbSubShapes(Symmetry_5, GeomAPI_Shape.SOLID, [2]) @@ -144,11 +282,16 @@ model.testNbSubShapes(Symmetry_5, GeomAPI_Shape.VERTEX, [72]) model.testResultsVolumes(Symmetry_5, [2 * 542.746463956]) midPoint = Symmetry_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(CENTER) < TOLERANCE) +assert midPoint.distance(CENTER) < TOLERANCE Recover_5 = model.addRecover(Part_1_doc, Symmetry_5, [Compound_2.result()], True) -Symmetry_6 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_5_1_2_1")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_center"), True) +Symmetry_6 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Recover_5_1_2_1")], + model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_center"), + True, +) model.testNbResults(Symmetry_6, 1) model.testNbSubResults(Symmetry_6, [2]) model.testNbSubShapes(Symmetry_6, GeomAPI_Shape.SOLID, [2]) @@ -158,11 +301,16 @@ model.testNbSubShapes(Symmetry_6, GeomAPI_Shape.VERTEX, [24]) model.testResultsVolumes(Symmetry_6, [2 * 785.39816339745]) midPoint = Symmetry_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(CENTER) < TOLERANCE) +assert midPoint.distance(CENTER) < TOLERANCE Recover_6 = model.addRecover(Part_1_doc, Symmetry_6, [Recover_5.result()], True) -Symmetry_7 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_6_1_3")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_center"), True) +Symmetry_7 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Recover_6_1_3")], + model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_center"), + True, +) model.testNbResults(Symmetry_7, 1) model.testNbSubResults(Symmetry_7, [2]) model.testNbSubShapes(Symmetry_7, GeomAPI_Shape.SOLID, [2]) @@ -172,24 +320,35 @@ model.testNbSubShapes(Symmetry_7, GeomAPI_Shape.VERTEX, [24]) model.testResultsVolumes(Symmetry_7, [2 * 785.39816339745]) midPoint = Symmetry_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(CENTER) < TOLERANCE) +assert midPoint.distance(CENTER) < TOLERANCE Recover_7 = model.addRecover(Part_1_doc, Symmetry_7, [Recover_6.result()], True) -Symmetry_8 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_7_1_1_1"), model.selection("SOLID", "Recover_7_1_2_2"), model.selection("SOLID", "Recover_7_1_3")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_center"), True) +Symmetry_8 = model.addSymmetry( + Part_1_doc, + [ + model.selection("SOLID", "Recover_7_1_1_1"), + model.selection("SOLID", "Recover_7_1_2_2"), + model.selection("SOLID", "Recover_7_1_3"), + ], + model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_center"), + True, +) model.testNbResults(Symmetry_8, 3) model.testNbSubResults(Symmetry_8, [2, 2, 2]) model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.SOLID, [2, 2, 2]) model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.FACE, [12, 6, 6]) model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.EDGE, [48, 12, 12]) model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.VERTEX, [96, 24, 24]) -model.testResultsVolumes(Symmetry_8, [2 * 3444.394198615, 2 * 785.39816339745, 2 * 785.39816339745]) +model.testResultsVolumes( + Symmetry_8, [2 * 3444.394198615, 2 * 785.39816339745, 2 * 785.39816339745] +) for res in Symmetry_8.results(): midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(CENTER) < TOLERANCE) + assert midPoint.distance(CENTER) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_2.py b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_2.py index dac92ab67..bed07737c 100644 --- a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_2.py +++ b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_2.py @@ -27,51 +27,134 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + def symmetryOX(thePoint): return GeomAPI_Pnt(thePoint.x(), -thePoint.y(), -thePoint.z()) + def middleOZ(thePoint): return GeomAPI_Pnt(0, 0, thePoint.z()) model.begin() -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("EDGE", "PartSet/OX"), False) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("EDGE", "PartSet/OX"), + False, +) model.testNbResults(Symmetry_1, 1) model.testNbSubResults(Symmetry_1, [0]) model.testNbSubShapes(Symmetry_1, GeomAPI_Shape.SOLID, [1]) @@ -80,13 +163,20 @@ model.testNbSubShapes(Symmetry_1, GeomAPI_Shape.EDGE, [18]) model.testNbSubShapes(Symmetry_1, GeomAPI_Shape.VERTEX, [36]) model.testResultsVolumes(Symmetry_1, [542.746463956]) -refPoint = symmetryOX(Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint()) +refPoint = symmetryOX( + Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint() +) midPoint = Symmetry_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, Symmetry_1, [Compound_2.result()], True) -Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_1_1_2_1")], model.selection("EDGE", "PartSet/OX"), False) +Symmetry_2 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Recover_1_1_2_1")], + model.selection("EDGE", "PartSet/OX"), + False, +) model.testNbResults(Symmetry_2, 1) model.testNbSubResults(Symmetry_2, [0]) model.testNbSubShapes(Symmetry_2, GeomAPI_Shape.SOLID, [1]) @@ -95,13 +185,25 @@ model.testNbSubShapes(Symmetry_2, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Symmetry_2, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Symmetry_2, [785.39816339745]) -refPoint = symmetryOX(Recover_1.result().subResult(1).subResult(0).resultSubShapePair()[0].shape().middlePoint()) +refPoint = symmetryOX( + Recover_1.result() + .subResult(1) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint() +) midPoint = Symmetry_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, Symmetry_2, [Recover_1.result()], True) -Symmetry_3 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_2_1_3")], model.selection("EDGE", "PartSet/OX"), False) +Symmetry_3 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Recover_2_1_3")], + model.selection("EDGE", "PartSet/OX"), + False, +) model.testNbResults(Symmetry_3, 1) model.testNbSubResults(Symmetry_3, [0]) model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.SOLID, [1]) @@ -110,13 +212,24 @@ model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Symmetry_3, [785.39816339745]) -refPoint = symmetryOX(Recover_2.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()) +refPoint = symmetryOX( + Recover_2.result().subResult(2).resultSubShapePair()[0].shape().middlePoint() +) midPoint = Symmetry_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_3 = model.addRecover(Part_1_doc, Symmetry_3, [Recover_2.result()], True) -Symmetry_4 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_3_1_1_1"), model.selection("SOLID", "Recover_3_1_2_2"), model.selection("SOLID", "Recover_3_1_3")], model.selection("EDGE", "PartSet/OX"), False) +Symmetry_4 = model.addSymmetry( + Part_1_doc, + [ + model.selection("SOLID", "Recover_3_1_1_1"), + model.selection("SOLID", "Recover_3_1_2_2"), + model.selection("SOLID", "Recover_3_1_3"), + ], + model.selection("EDGE", "PartSet/OX"), + False, +) model.testNbResults(Symmetry_4, 3) model.testNbSubResults(Symmetry_4, [0, 0, 0]) model.testNbSubShapes(Symmetry_4, GeomAPI_Shape.SOLID, [1, 1, 1]) @@ -125,17 +238,34 @@ model.testNbSubShapes(Symmetry_4, GeomAPI_Shape.EDGE, [24, 6, 6]) model.testNbSubShapes(Symmetry_4, GeomAPI_Shape.VERTEX, [48, 12, 12]) model.testResultsVolumes(Symmetry_4, [3444.394198615, 785.39816339745, 785.39816339745]) -REFERENCE = [Recover_3.result().subResult(0).subResult(0).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(1).subResult(1).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()] +REFERENCE = [ + Recover_3.result() + .subResult(0) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result() + .subResult(1) + .subResult(1) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint(), +] for res, ref in zip(Symmetry_4.results(), REFERENCE): ref = symmetryOX(ref) midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE) + assert midPoint.distance(ref) < TOLERANCE Recover_4 = model.addRecover(Part_1_doc, Symmetry_4, [Recover_3.result()], True) -Symmetry_5 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_4_1_1_5")], model.selection("EDGE", "PartSet/OZ"), True) +Symmetry_5 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Recover_4_1_1_5")], + model.selection("EDGE", "PartSet/OZ"), + True, +) model.testNbResults(Symmetry_5, 1) model.testNbSubResults(Symmetry_5, [2]) model.testNbSubShapes(Symmetry_5, GeomAPI_Shape.SOLID, [2]) @@ -144,13 +274,25 @@ model.testNbSubShapes(Symmetry_5, GeomAPI_Shape.EDGE, [36]) model.testNbSubShapes(Symmetry_5, GeomAPI_Shape.VERTEX, [72]) model.testResultsVolumes(Symmetry_5, [2 * 542.746463956]) -refPoint = middleOZ(Recover_4.results()[0].subResult(0).subResult(4).resultSubShapePair()[0].shape().middlePoint()) +refPoint = middleOZ( + Recover_4.results()[0] + .subResult(0) + .subResult(4) + .resultSubShapePair()[0] + .shape() + .middlePoint() +) midPoint = Symmetry_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_5 = model.addRecover(Part_1_doc, Symmetry_5, [Compound_2.result()], True) -Symmetry_6 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_5_1_2_1")], model.selection("EDGE", "PartSet/OZ"), True) +Symmetry_6 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Recover_5_1_2_1")], + model.selection("EDGE", "PartSet/OZ"), + True, +) model.testNbResults(Symmetry_6, 1) model.testNbSubResults(Symmetry_6, [2]) model.testNbSubShapes(Symmetry_6, GeomAPI_Shape.SOLID, [2]) @@ -159,13 +301,25 @@ model.testNbSubShapes(Symmetry_6, GeomAPI_Shape.EDGE, [12]) model.testNbSubShapes(Symmetry_6, GeomAPI_Shape.VERTEX, [24]) model.testResultsVolumes(Symmetry_6, [2 * 785.39816339745]) -refPoint = middleOZ(Recover_5.result().subResult(1).subResult(0).resultSubShapePair()[0].shape().middlePoint()) +refPoint = middleOZ( + Recover_5.result() + .subResult(1) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint() +) midPoint = Symmetry_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_6 = model.addRecover(Part_1_doc, Symmetry_6, [Recover_5.result()], True) -Symmetry_7 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_6_1_3")], model.selection("EDGE", "PartSet/OZ"), True) +Symmetry_7 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Recover_6_1_3")], + model.selection("EDGE", "PartSet/OZ"), + True, +) model.testNbResults(Symmetry_7, 1) model.testNbSubResults(Symmetry_7, [2]) model.testNbSubShapes(Symmetry_7, GeomAPI_Shape.SOLID, [2]) @@ -174,29 +328,54 @@ model.testNbSubShapes(Symmetry_7, GeomAPI_Shape.EDGE, [12]) model.testNbSubShapes(Symmetry_7, GeomAPI_Shape.VERTEX, [24]) model.testResultsVolumes(Symmetry_7, [2 * 785.39816339745]) -refPoint = middleOZ(Recover_6.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()) +refPoint = middleOZ( + Recover_6.result().subResult(2).resultSubShapePair()[0].shape().middlePoint() +) midPoint = Symmetry_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_7 = model.addRecover(Part_1_doc, Symmetry_7, [Recover_6.result()], True) -Symmetry_8 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_7_1_1_1"), model.selection("SOLID", "Recover_7_1_2_2"), model.selection("SOLID", "Recover_7_1_3")], model.selection("EDGE", "PartSet/OZ"), True) +Symmetry_8 = model.addSymmetry( + Part_1_doc, + [ + model.selection("SOLID", "Recover_7_1_1_1"), + model.selection("SOLID", "Recover_7_1_2_2"), + model.selection("SOLID", "Recover_7_1_3"), + ], + model.selection("EDGE", "PartSet/OZ"), + True, +) model.testNbResults(Symmetry_8, 3) model.testNbSubResults(Symmetry_8, [2, 2, 2]) model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.SOLID, [2, 2, 2]) model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.FACE, [12, 6, 6]) model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.EDGE, [48, 12, 12]) model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.VERTEX, [96, 24, 24]) -model.testResultsVolumes(Symmetry_8, [2 * 3444.394198615, 2 * 785.39816339745, 2 * 785.39816339745]) - -REFERENCE = [Recover_7.result().subResult(0).subResult(0).resultSubShapePair()[0].shape().middlePoint(), - Recover_7.result().subResult(1).subResult(1).resultSubShapePair()[0].shape().middlePoint(), - Recover_7.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()] +model.testResultsVolumes( + Symmetry_8, [2 * 3444.394198615, 2 * 785.39816339745, 2 * 785.39816339745] +) + +REFERENCE = [ + Recover_7.result() + .subResult(0) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_7.result() + .subResult(1) + .subResult(1) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_7.result().subResult(2).resultSubShapePair()[0].shape().middlePoint(), +] for res, ref in zip(Symmetry_8.results(), REFERENCE): ref = middleOZ(ref) midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE) + assert midPoint.distance(ref) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_3.py b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_3.py index 21f95983e..5d69c31d0 100644 --- a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_3.py +++ b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_3.py @@ -27,52 +27,137 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + def symmetryXOZ(thePoint): return GeomAPI_Pnt(thePoint.x(), -thePoint.y(), thePoint.z()) + def centerBB(theShape): res = theShape.computeSize() - return GeomAPI_Pnt((res[1] + res[4]) / 2, (res[2] + res[5]) / 2, (res[3] + res[6]) / 2) + return GeomAPI_Pnt( + (res[1] + res[4]) / 2, (res[2] + res[5]) / 2, (res[3] + res[6]) / 2 + ) model.begin() -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("FACE", "PartSet/XOZ"), False) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("FACE", "PartSet/XOZ"), + False, +) model.testNbResults(Symmetry_1, 1) model.testNbSubResults(Symmetry_1, [0]) model.testNbSubShapes(Symmetry_1, GeomAPI_Shape.SOLID, [1]) @@ -81,13 +166,20 @@ model.testNbSubShapes(Symmetry_1, GeomAPI_Shape.EDGE, [18]) model.testNbSubShapes(Symmetry_1, GeomAPI_Shape.VERTEX, [36]) model.testResultsVolumes(Symmetry_1, [542.746463956]) -refPoint = symmetryXOZ(Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint()) +refPoint = symmetryXOZ( + Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint() +) midPoint = Symmetry_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, Symmetry_1, [Compound_2.result()], True) -Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_1_1_2_1")], model.selection("FACE", "PartSet/XOZ"), False) +Symmetry_2 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Recover_1_1_2_1")], + model.selection("FACE", "PartSet/XOZ"), + False, +) model.testNbResults(Symmetry_2, 1) model.testNbSubResults(Symmetry_2, [0]) model.testNbSubShapes(Symmetry_2, GeomAPI_Shape.SOLID, [1]) @@ -96,13 +188,25 @@ model.testNbSubShapes(Symmetry_2, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Symmetry_2, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Symmetry_2, [785.39816339745]) -refPoint = symmetryXOZ(Recover_1.result().subResult(1).subResult(0).resultSubShapePair()[0].shape().middlePoint()) +refPoint = symmetryXOZ( + Recover_1.result() + .subResult(1) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint() +) midPoint = Symmetry_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, Symmetry_2, [Recover_1.result()], True) -Symmetry_3 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_2_1_3")], model.selection("FACE", "PartSet/XOZ"), False) +Symmetry_3 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Recover_2_1_3")], + model.selection("FACE", "PartSet/XOZ"), + False, +) model.testNbResults(Symmetry_3, 1) model.testNbSubResults(Symmetry_3, [0]) model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.SOLID, [1]) @@ -111,13 +215,24 @@ model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Symmetry_3, [785.39816339745]) -refPoint = symmetryXOZ(Recover_2.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()) +refPoint = symmetryXOZ( + Recover_2.result().subResult(2).resultSubShapePair()[0].shape().middlePoint() +) midPoint = Symmetry_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_3 = model.addRecover(Part_1_doc, Symmetry_3, [Recover_2.result()], True) -Symmetry_4 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_3_1_1_1"), model.selection("SOLID", "Recover_3_1_2_2"), model.selection("SOLID", "Recover_3_1_3")], model.selection("FACE", "PartSet/XOZ"), False) +Symmetry_4 = model.addSymmetry( + Part_1_doc, + [ + model.selection("SOLID", "Recover_3_1_1_1"), + model.selection("SOLID", "Recover_3_1_2_2"), + model.selection("SOLID", "Recover_3_1_3"), + ], + model.selection("FACE", "PartSet/XOZ"), + False, +) model.testNbResults(Symmetry_4, 3) model.testNbSubResults(Symmetry_4, [0, 0, 0]) model.testNbSubShapes(Symmetry_4, GeomAPI_Shape.SOLID, [1, 1, 1]) @@ -126,17 +241,34 @@ model.testNbSubShapes(Symmetry_4, GeomAPI_Shape.EDGE, [24, 6, 6]) model.testNbSubShapes(Symmetry_4, GeomAPI_Shape.VERTEX, [48, 12, 12]) model.testResultsVolumes(Symmetry_4, [3444.394198615, 785.39816339745, 785.39816339745]) -REFERENCE = [Recover_3.result().subResult(0).subResult(0).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(1).subResult(1).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()] +REFERENCE = [ + Recover_3.result() + .subResult(0) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result() + .subResult(1) + .subResult(1) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint(), +] for res, ref in zip(Symmetry_4.results(), REFERENCE): ref = symmetryXOZ(ref) midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE) + assert midPoint.distance(ref) < TOLERANCE Recover_4 = model.addRecover(Part_1_doc, Symmetry_4, [Recover_3.result()], True) -Symmetry_5 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_4_1_1_5")], model.selection("FACE", "PartSet/XOY"), True) +Symmetry_5 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Recover_4_1_1_5")], + model.selection("FACE", "PartSet/XOY"), + True, +) model.testNbResults(Symmetry_5, 1) model.testNbSubResults(Symmetry_5, [2]) model.testNbSubShapes(Symmetry_5, GeomAPI_Shape.SOLID, [2]) @@ -145,14 +277,21 @@ model.testNbSubShapes(Symmetry_5, GeomAPI_Shape.EDGE, [36]) model.testNbSubShapes(Symmetry_5, GeomAPI_Shape.VERTEX, [72]) model.testResultsVolumes(Symmetry_5, [2 * 542.746463956]) -refPoint = centerBB(Recover_4.results()[0].subResult(0).subResult(4).resultSubShapePair()[0].shape()) +refPoint = centerBB( + Recover_4.results()[0].subResult(0).subResult(4).resultSubShapePair()[0].shape() +) refPoint.setZ(0) midPoint = Symmetry_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_5 = model.addRecover(Part_1_doc, Symmetry_5, [Compound_2.result()], True) -Symmetry_6 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_5_1_2_1")], model.selection("FACE", "PartSet/XOY"), True) +Symmetry_6 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Recover_5_1_2_1")], + model.selection("FACE", "PartSet/XOY"), + True, +) model.testNbResults(Symmetry_6, 1) model.testNbSubResults(Symmetry_6, [2]) model.testNbSubShapes(Symmetry_6, GeomAPI_Shape.SOLID, [2]) @@ -161,14 +300,26 @@ model.testNbSubShapes(Symmetry_6, GeomAPI_Shape.EDGE, [12]) model.testNbSubShapes(Symmetry_6, GeomAPI_Shape.VERTEX, [24]) model.testResultsVolumes(Symmetry_6, [2 * 785.39816339745]) -refPoint = Recover_5.result().subResult(1).subResult(0).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Recover_5.result() + .subResult(1) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint() +) refPoint.setZ(0) midPoint = Symmetry_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_6 = model.addRecover(Part_1_doc, Symmetry_6, [Recover_5.result()], True) -Symmetry_7 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_6_1_3")], model.selection("FACE", "PartSet/XOY"), True) +Symmetry_7 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Recover_6_1_3")], + model.selection("FACE", "PartSet/XOY"), + True, +) model.testNbResults(Symmetry_7, 1) model.testNbSubResults(Symmetry_7, [2]) model.testNbSubShapes(Symmetry_7, GeomAPI_Shape.SOLID, [2]) @@ -180,27 +331,47 @@ model.testResultsVolumes(Symmetry_7, [2 * 785.39816339745]) refPoint = Recover_6.result().subResult(2).resultSubShapePair()[0].shape().middlePoint() refPoint.setZ(0) midPoint = Symmetry_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_7 = model.addRecover(Part_1_doc, Symmetry_7, [Recover_6.result()], True) -Symmetry_8 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_7_1_1_1"), model.selection("SOLID", "Recover_7_1_2_2"), model.selection("SOLID", "Recover_7_1_3")], model.selection("FACE", "PartSet/XOY"), True) +Symmetry_8 = model.addSymmetry( + Part_1_doc, + [ + model.selection("SOLID", "Recover_7_1_1_1"), + model.selection("SOLID", "Recover_7_1_2_2"), + model.selection("SOLID", "Recover_7_1_3"), + ], + model.selection("FACE", "PartSet/XOY"), + True, +) model.testNbResults(Symmetry_8, 3) model.testNbSubResults(Symmetry_8, [2, 2, 2]) model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.SOLID, [2, 2, 2]) model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.FACE, [12, 6, 6]) model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.EDGE, [48, 12, 12]) model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.VERTEX, [96, 24, 24]) -model.testResultsVolumes(Symmetry_8, [2 * 3444.394198615, 2 * 785.39816339745, 2 * 785.39816339745]) - -REFERENCE = [centerBB(Recover_7.result().subResult(0).subResult(0).resultSubShapePair()[0].shape()), - Recover_7.result().subResult(1).subResult(1).resultSubShapePair()[0].shape().middlePoint(), - Recover_7.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()] +model.testResultsVolumes( + Symmetry_8, [2 * 3444.394198615, 2 * 785.39816339745, 2 * 785.39816339745] +) + +REFERENCE = [ + centerBB( + Recover_7.result().subResult(0).subResult(0).resultSubShapePair()[0].shape() + ), + Recover_7.result() + .subResult(1) + .subResult(1) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_7.result().subResult(2).resultSubShapePair()[0].shape().middlePoint(), +] for res, ref in zip(Symmetry_8.results(), REFERENCE): ref.setZ(0) midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE) + assert midPoint.distance(ref) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_4.py b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_4.py index 654107933..2aff947ad 100644 --- a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_4.py +++ b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_4.py @@ -26,62 +26,178 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + def symmetryOZ(thePoint): return GeomAPI_Pnt(-thePoint.x(), -thePoint.y(), thePoint.z()) model.begin() -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("EDGE", "PartSet/OZ"), False) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("VERTEX", "Vertex_1_1")], + model.selection("EDGE", "PartSet/OZ"), + False, +) model.testNbResults(Symmetry_1, 1) model.testNbSubResults(Symmetry_1, [0]) model.testNbSubShapes(Symmetry_1, GeomAPI_Shape.SOLID, [0]) @@ -92,9 +208,14 @@ model.testResultsVolumes(Symmetry_1, [0]) model.testResultsAreas(Symmetry_1, [0]) refPoint = symmetryOZ(Vertex_1.defaultResult().shape().middlePoint()) midPoint = Symmetry_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OZ"), False) +Symmetry_2 = model.addSymmetry( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OZ"), + False, +) model.testNbResults(Symmetry_2, 1) model.testNbSubResults(Symmetry_2, [0]) model.testNbSubShapes(Symmetry_2, GeomAPI_Shape.SOLID, [0]) @@ -105,9 +226,14 @@ model.testResultsVolumes(Symmetry_2, [0]) model.testResultsAreas(Symmetry_2, [0]) refPoint = symmetryOZ(Edge_1.defaultResult().shape().middlePoint()) midPoint = Symmetry_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Symmetry_3 = model.addSymmetry(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("EDGE", "PartSet/OZ"), False) +Symmetry_3 = model.addSymmetry( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + model.selection("EDGE", "PartSet/OZ"), + False, +) model.testNbResults(Symmetry_3, 1) model.testNbSubResults(Symmetry_3, [0]) model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.SOLID, [0]) @@ -118,9 +244,14 @@ model.testResultsVolumes(Symmetry_3, [0]) model.testResultsAreas(Symmetry_3, [0]) refPoint = symmetryOZ(Wire_1.defaultResult().shape().middlePoint()) midPoint = Symmetry_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Symmetry_4 = model.addSymmetry(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), False) +Symmetry_4 = model.addSymmetry( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("EDGE", "PartSet/OZ"), + False, +) model.testNbResults(Symmetry_4, 1) model.testNbSubResults(Symmetry_4, [0]) model.testNbSubShapes(Symmetry_4, GeomAPI_Shape.SOLID, [0]) @@ -131,9 +262,14 @@ model.testResultsVolumes(Symmetry_4, [0]) model.testResultsAreas(Symmetry_4, [109.154152964914914]) refPoint = symmetryOZ(Face_1.defaultResult().shape().middlePoint()) midPoint = Symmetry_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Symmetry_5 = model.addSymmetry(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OZ"), False) +Symmetry_5 = model.addSymmetry( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + model.selection("EDGE", "PartSet/OZ"), + False, +) model.testNbResults(Symmetry_5, 1) model.testNbSubResults(Symmetry_5, [0]) model.testNbSubShapes(Symmetry_5, GeomAPI_Shape.SOLID, [0]) @@ -144,9 +280,14 @@ model.testResultsVolumes(Symmetry_5, [0]) model.testResultsAreas(Symmetry_5, [182.822012116]) refPoint = symmetryOZ(Shell_1.defaultResult().shape().middlePoint()) midPoint = Symmetry_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Symmetry_6 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OZ"), False) +Symmetry_6 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + model.selection("EDGE", "PartSet/OZ"), + False, +) model.testNbResults(Symmetry_6, 1) model.testNbSubResults(Symmetry_6, [0]) model.testNbSubShapes(Symmetry_6, GeomAPI_Shape.SOLID, [1]) @@ -156,9 +297,14 @@ model.testNbSubShapes(Symmetry_6, GeomAPI_Shape.VERTEX, [48]) model.testResultsVolumes(Symmetry_6, [1000]) refPoint = symmetryOZ(Translation_1.defaultResult().shape().middlePoint()) midPoint = Symmetry_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Symmetry_7 = model.addSymmetry(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("EDGE", "PartSet/OZ"), False) +Symmetry_7 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + model.selection("EDGE", "PartSet/OZ"), + False, +) model.testNbResults(Symmetry_7, 1) model.testNbSubResults(Symmetry_7, [3]) model.testNbSubShapes(Symmetry_7, GeomAPI_Shape.SOLID, [3]) @@ -168,9 +314,14 @@ model.testNbSubShapes(Symmetry_7, GeomAPI_Shape.VERTEX, [132]) model.testResultsVolumes(Symmetry_7, [1589.0486226]) refPoint = symmetryOZ(Partition_1.defaultResult().shape().middlePoint()) midPoint = Symmetry_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Symmetry_8 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], model.selection("EDGE", "PartSet/OZ"), False) +Symmetry_8 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPOUND", "AngularCopy_1_1")], + model.selection("EDGE", "PartSet/OZ"), + False, +) model.testNbResults(Symmetry_8, 1) model.testNbSubResults(Symmetry_8, [3]) model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.SOLID, [3]) @@ -180,8 +331,8 @@ model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.VERTEX, [144]) model.testResultsVolumes(Symmetry_8, [3000]) refPoint = symmetryOZ(AngularCopy_1.defaultResult().shape().middlePoint()) midPoint = Symmetry_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_5.py b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_5.py index de2836939..ab4e694b6 100644 --- a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_5.py +++ b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v0_5.py @@ -26,59 +26,178 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() # collect reference data REFERENCE = [] -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 for ind in range(0, Compound_1.result().numberOfSubs()): p = Compound_1.result().subResult(ind).resultSubShapePair()[1].middlePoint() p.setX(-p.x()) @@ -88,7 +207,12 @@ for ind in range(0, Compound_1.result().numberOfSubs()): index = 0 model.begin() -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("VERTEX", "Compound_1_1_1")], model.selection("EDGE", "PartSet/OZ"), False) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("VERTEX", "Compound_1_1_1")], + model.selection("EDGE", "PartSet/OZ"), + False, +) model.testNbResults(Symmetry_1, 1) model.testNbSubResults(Symmetry_1, [0]) model.testNbSubShapes(Symmetry_1, GeomAPI_Shape.SOLID, [0]) @@ -98,11 +222,16 @@ model.testNbSubShapes(Symmetry_1, GeomAPI_Shape.VERTEX, [1]) model.testResultsVolumes(Symmetry_1, [0]) model.testResultsAreas(Symmetry_1, [0]) midPoint = Symmetry_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_1 = model.addRecover(Part_1_doc, Symmetry_1, [Compound_1.result()], True) -Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("EDGE", "Recover_1_1_2")], model.selection("EDGE", "PartSet/OZ"), False) +Symmetry_2 = model.addSymmetry( + Part_1_doc, + [model.selection("EDGE", "Recover_1_1_2")], + model.selection("EDGE", "PartSet/OZ"), + False, +) model.testNbResults(Symmetry_2, 1) model.testNbSubResults(Symmetry_2, [0]) model.testNbSubShapes(Symmetry_2, GeomAPI_Shape.SOLID, [0]) @@ -112,11 +241,16 @@ model.testNbSubShapes(Symmetry_2, GeomAPI_Shape.VERTEX, [2]) model.testResultsVolumes(Symmetry_2, [0]) model.testResultsAreas(Symmetry_2, [0]) midPoint = Symmetry_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_2 = model.addRecover(Part_1_doc, Symmetry_2, [Recover_1.result()]) -Symmetry_3 = model.addSymmetry(Part_1_doc, [model.selection("WIRE", "Recover_2_1_3")], model.selection("EDGE", "PartSet/OZ"), False) +Symmetry_3 = model.addSymmetry( + Part_1_doc, + [model.selection("WIRE", "Recover_2_1_3")], + model.selection("EDGE", "PartSet/OZ"), + False, +) model.testNbResults(Symmetry_3, 1) model.testNbSubResults(Symmetry_3, [0]) model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.SOLID, [0]) @@ -126,11 +260,16 @@ model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.VERTEX, [4]) model.testResultsVolumes(Symmetry_3, [0]) model.testResultsAreas(Symmetry_3, [0]) midPoint = Symmetry_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_3 = model.addRecover(Part_1_doc, Symmetry_3, [Recover_2.result()]) -Symmetry_4 = model.addSymmetry(Part_1_doc, [model.selection("FACE", "Recover_3_1_4")], model.selection("EDGE", "PartSet/OZ"), False) +Symmetry_4 = model.addSymmetry( + Part_1_doc, + [model.selection("FACE", "Recover_3_1_4")], + model.selection("EDGE", "PartSet/OZ"), + False, +) model.testNbResults(Symmetry_4, 1) model.testNbSubResults(Symmetry_4, [0]) model.testNbSubShapes(Symmetry_4, GeomAPI_Shape.SOLID, [0]) @@ -140,11 +279,16 @@ model.testNbSubShapes(Symmetry_4, GeomAPI_Shape.VERTEX, [8]) model.testResultsVolumes(Symmetry_4, [0]) model.testResultsAreas(Symmetry_4, [109.154152964914914]) midPoint = Symmetry_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_4 = model.addRecover(Part_1_doc, Symmetry_4, [Recover_3.result()]) -Symmetry_5 = model.addSymmetry(Part_1_doc, [model.selection("SHELL", "Recover_4_1_5")], model.selection("EDGE", "PartSet/OZ"), False) +Symmetry_5 = model.addSymmetry( + Part_1_doc, + [model.selection("SHELL", "Recover_4_1_5")], + model.selection("EDGE", "PartSet/OZ"), + False, +) model.testNbResults(Symmetry_5, 1) model.testNbSubResults(Symmetry_5, [0]) model.testNbSubShapes(Symmetry_5, GeomAPI_Shape.SOLID, [0]) @@ -154,11 +298,16 @@ model.testNbSubShapes(Symmetry_5, GeomAPI_Shape.VERTEX, [16]) model.testResultsVolumes(Symmetry_5, [0]) model.testResultsAreas(Symmetry_5, [182.822012116]) midPoint = Symmetry_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_5 = model.addRecover(Part_1_doc, Symmetry_5, [Recover_4.result()]) -Symmetry_6 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Recover_5_1_6")], model.selection("EDGE", "PartSet/OZ"), False) +Symmetry_6 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Recover_5_1_6")], + model.selection("EDGE", "PartSet/OZ"), + False, +) model.testNbResults(Symmetry_6, 1) model.testNbSubResults(Symmetry_6, [0]) model.testNbSubShapes(Symmetry_6, GeomAPI_Shape.SOLID, [1]) @@ -167,11 +316,16 @@ model.testNbSubShapes(Symmetry_6, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(Symmetry_6, GeomAPI_Shape.VERTEX, [48]) model.testResultsVolumes(Symmetry_6, [1000]) midPoint = Symmetry_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_6 = model.addRecover(Part_1_doc, Symmetry_6, [Recover_5.result()]) -Symmetry_7 = model.addSymmetry(Part_1_doc, [model.selection("COMPSOLID", "Recover_6_1_7")], model.selection("EDGE", "PartSet/OZ"), False) +Symmetry_7 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPSOLID", "Recover_6_1_7")], + model.selection("EDGE", "PartSet/OZ"), + False, +) model.testNbResults(Symmetry_7, 1) model.testNbSubResults(Symmetry_7, [3]) model.testNbSubShapes(Symmetry_7, GeomAPI_Shape.SOLID, [3]) @@ -180,11 +334,16 @@ model.testNbSubShapes(Symmetry_7, GeomAPI_Shape.EDGE, [66]) model.testNbSubShapes(Symmetry_7, GeomAPI_Shape.VERTEX, [132]) model.testResultsVolumes(Symmetry_7, [1589.0486226]) midPoint = Symmetry_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_7 = model.addRecover(Part_1_doc, Symmetry_7, [Recover_6.result()]) -Symmetry_8 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "Recover_7_1_8")], model.selection("EDGE", "PartSet/OZ"), False) +Symmetry_8 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPOUND", "Recover_7_1_8")], + model.selection("EDGE", "PartSet/OZ"), + False, +) model.testNbResults(Symmetry_8, 1) model.testNbSubResults(Symmetry_8, [3]) model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.SOLID, [3]) @@ -193,8 +352,8 @@ model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.EDGE, [72]) model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.VERTEX, [144]) model.testResultsVolumes(Symmetry_8, [3000]) midPoint = Symmetry_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_1.py b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_1.py index 91a365202..6d15c7cb3 100644 --- a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_1.py +++ b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_1.py @@ -29,67 +29,162 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() + def symmetry(thePoint, theCenter): - return GeomAPI_Pnt(2 * theCenter.x() - thePoint.x(), 2 * theCenter.y() - thePoint.y(), 2 * theCenter.z() - thePoint.z()) + return GeomAPI_Pnt( + 2 * theCenter.x() - thePoint.x(), + 2 * theCenter.y() - thePoint.y(), + 2 * theCenter.z() - thePoint.z(), + ) + def average(thePoints): - x = 0; y = 0; z = 0 + x = 0 + y = 0 + z = 0 for p in thePoints: - x += p.x(); y += p.y(); z+= p.z() + x += p.x() + y += p.y() + z += p.z() x /= len(thePoints) y /= len(thePoints) z /= len(thePoints) return GeomAPI_Pnt(x, y, z) + def subsRefPoints(theResult): res = [] for ind in range(0, theResult.numberOfSubs()): - res.append( theResult.subResult(ind).resultSubShapePair()[0].shape().middlePoint()) + res.append( + theResult.subResult(ind).resultSubShapePair()[0].shape().middlePoint() + ) return res -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 ORIGIN = GeomAPI_Pnt(0, 0, 0) -CENTER_1 = GeomAPI_Pnt(SketchEllipse_1.center().pnt().x(), SketchEllipse_1.center().pnt().y(), 0) -CENTER_2 = GeomAPI_Pnt(SketchCircle_1.center().pnt().x(), SketchCircle_1.center().pnt().y(), 0) +CENTER_1 = GeomAPI_Pnt( + SketchEllipse_1.center().pnt().x(), SketchEllipse_1.center().pnt().y(), 0 +) +CENTER_2 = GeomAPI_Pnt( + SketchCircle_1.center().pnt().x(), SketchCircle_1.center().pnt().y(), 0 +) REFERENCE = subsRefPoints(Compound_2.result()) -def assertResult(theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, theVolume): +def assertResult( + theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, theVolume +): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [3]) model.testNbSubShapes(theFeature, GeomAPI_Shape.SOLID, [theNbSolids]) @@ -100,38 +195,82 @@ def assertResult(theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, for ind in range(0, theFeature.result().numberOfSubs()): ref = REFERENCE[ind] - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("VERTEX", "PartSet/Origin"), keepOriginal = False, keepSubResults = True) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("VERTEX", "PartSet/Origin"), + keepOriginal=False, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Symmetry_1.feature().error() != "") +assert Symmetry_1.feature().error() != "" model.begin() Symmetry_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")]) REFERENCE[0] = symmetry(REFERENCE[0], ORIGIN) assertResult(Symmetry_1, 10, 47, 162, 324, 14319.99602674256) -Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_1_1_2_1")], model.selection("VERTEX", "PartSet/Origin"), keepOriginal = False, keepSubResults = True) +Symmetry_2 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Symmetry_1_1_2_1")], + model.selection("VERTEX", "PartSet/Origin"), + keepOriginal=False, + keepSubResults=True, +) subs = subsRefPoints(Compound_2.result().subResult(1)) subs[0] = symmetry(subs[0], ORIGIN) REFERENCE[1] = average(subs) assertResult(Symmetry_2, 10, 47, 162, 324, 14319.99602674256) -Symmetry_3 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_2_1_3")], model.selection("VERTEX", "PartSet/Origin"), keepOriginal = False, keepSubResults = True) +Symmetry_3 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Symmetry_2_1_3")], + model.selection("VERTEX", "PartSet/Origin"), + keepOriginal=False, + keepSubResults=True, +) REFERENCE[2] = symmetry(REFERENCE[2], ORIGIN) assertResult(Symmetry_3, 10, 47, 162, 324, 14319.99602674256) -Symmetry_4 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_3_1_1_1"), model.selection("SOLID", "Symmetry_3_1_2_2"), model.selection("SOLID", "Symmetry_3_1_3")], model.selection("VERTEX", "PartSet/Origin"), keepOriginal = False, keepSubResults = True) +Symmetry_4 = model.addSymmetry( + Part_1_doc, + [ + model.selection("SOLID", "Symmetry_3_1_1_1"), + model.selection("SOLID", "Symmetry_3_1_2_2"), + model.selection("SOLID", "Symmetry_3_1_3"), + ], + model.selection("VERTEX", "PartSet/Origin"), + keepOriginal=False, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Symmetry_4.feature().error() != "") +assert Symmetry_4.feature().error() != "" model.begin() -Symmetry_4.setMainObjects([model.selection("COMPSOLID", "Symmetry_3_1_1"), model.selection("SOLID", "Symmetry_3_1_2_2"), model.selection("SOLID", "Symmetry_3_1_3")]) +Symmetry_4.setMainObjects( + [ + model.selection("COMPSOLID", "Symmetry_3_1_1"), + model.selection("SOLID", "Symmetry_3_1_2_2"), + model.selection("SOLID", "Symmetry_3_1_3"), + ] +) REFERENCE[0] = symmetry(REFERENCE[0], ORIGIN) subs = subsRefPoints(Compound_2.result().subResult(1)) for ind in range(0, len(subs)): @@ -141,23 +280,51 @@ REFERENCE[2] = symmetry(REFERENCE[2], ORIGIN) assertResult(Symmetry_4, 10, 47, 162, 324, 14319.99602674256) -Symmetry_5 = model.addSymmetry(Part_1_doc, [model.selection("COMPSOLID", "Symmetry_4_1_1")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_center"), keepOriginal = True, keepSubResults = True) +Symmetry_5 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPSOLID", "Symmetry_4_1_1")], + model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_center"), + keepOriginal=True, + keepSubResults=True, +) REFERENCE[0] = CENTER_1 assertResult(Symmetry_5, 17, 85, 306, 612, 26283.79756329278) -Symmetry_6 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_5_1_2_1")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_center"), keepOriginal = True, keepSubResults = True) +Symmetry_6 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Symmetry_5_1_2_1")], + model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_center"), + keepOriginal=True, + keepSubResults=True, +) REFERENCE[1] = CENTER_1 assertResult(Symmetry_6, 18, 88, 312, 624, 27069.19572669) -Symmetry_7 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_6_1_3")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_center"), keepOriginal = True, keepSubResults = True) +Symmetry_7 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Symmetry_6_1_3")], + model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_center"), + keepOriginal=True, + keepSubResults=True, +) REFERENCE[2] = CENTER_1 assertResult(Symmetry_7, 19, 91, 318, 636, 27854.59389) -Symmetry_8 = model.addSymmetry(Part_1_doc, [model.selection("COMPSOLID", "Symmetry_7_1_1"), model.selection("SOLID", "Symmetry_7_1_2_2"), model.selection("SOLID", "Symmetry_7_1_3")], model.selection("VERTEX", "Sketch_1/SketchCircle_1"), keepOriginal = True, keepSubResults = True) +Symmetry_8 = model.addSymmetry( + Part_1_doc, + [ + model.selection("COMPSOLID", "Symmetry_7_1_1"), + model.selection("SOLID", "Symmetry_7_1_2_2"), + model.selection("SOLID", "Symmetry_7_1_3"), + ], + model.selection("VERTEX", "Sketch_1/SketchCircle_1"), + keepOriginal=True, + keepSubResults=True, +) REFERENCE[0] = CENTER_2 REFERENCE[2] = CENTER_2 assertResult(Symmetry_8, 36, 176, 624, 1248, 54138.39145338) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_2.py b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_2.py index b65cbbcee..9115a96dd 100644 --- a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_2.py +++ b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_2.py @@ -29,68 +29,156 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() + def symmetryOX(thePoint): return GeomAPI_Pnt(thePoint.x(), -thePoint.y(), -thePoint.z()) + def middleOZ(thePoint): return GeomAPI_Pnt(0, 0, thePoint.z()) + def average(thePoints): - x = 0; y = 0; z = 0 + x = 0 + y = 0 + z = 0 for p in thePoints: - x += p.x(); y += p.y(); z+= p.z() + x += p.x() + y += p.y() + z += p.z() x /= len(thePoints) y /= len(thePoints) z /= len(thePoints) return GeomAPI_Pnt(x, y, z) + def subsRefPoints(theResult): res = [] for ind in range(0, theResult.numberOfSubs()): - res.append( theResult.subResult(ind).resultSubShapePair()[0].shape().middlePoint()) + res.append( + theResult.subResult(ind).resultSubShapePair()[0].shape().middlePoint() + ) return res -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 ORIGIN = GeomAPI_Pnt(0, 0, 0) REFERENCE = subsRefPoints(Compound_2.result()) -def assertResult(theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, theVolume): +def assertResult( + theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, theVolume +): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [3]) model.testNbSubShapes(theFeature, GeomAPI_Shape.SOLID, [theNbSolids]) @@ -101,38 +189,82 @@ def assertResult(theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, for ind in range(0, theFeature.result().numberOfSubs()): ref = REFERENCE[ind] - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("EDGE", "PartSet/OX"), keepOriginal = False, keepSubResults = True) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("EDGE", "PartSet/OX"), + keepOriginal=False, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Symmetry_1.feature().error() != "") +assert Symmetry_1.feature().error() != "" model.begin() Symmetry_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")]) REFERENCE[0] = symmetryOX(REFERENCE[0]) assertResult(Symmetry_1, 10, 47, 162, 324, 14319.99602674256) -Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_1_1_2_1")], model.selection("EDGE", "PartSet/OX"), keepOriginal = False, keepSubResults = True) +Symmetry_2 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Symmetry_1_1_2_1")], + model.selection("EDGE", "PartSet/OX"), + keepOriginal=False, + keepSubResults=True, +) subs = subsRefPoints(Compound_2.result().subResult(1)) subs[0] = symmetryOX(subs[0]) REFERENCE[1] = average(subs) assertResult(Symmetry_2, 10, 47, 162, 324, 14319.99602674256) -Symmetry_3 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_2_1_3")], model.selection("EDGE", "PartSet/OX"), keepOriginal = False, keepSubResults = True) +Symmetry_3 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Symmetry_2_1_3")], + model.selection("EDGE", "PartSet/OX"), + keepOriginal=False, + keepSubResults=True, +) REFERENCE[2] = symmetryOX(REFERENCE[2]) assertResult(Symmetry_3, 10, 47, 162, 324, 14319.99602674256) -Symmetry_4 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_3_1_1_1"), model.selection("SOLID", "Symmetry_3_1_2_2"), model.selection("SOLID", "Symmetry_3_1_3")], model.selection("EDGE", "PartSet/OX"), keepOriginal = False, keepSubResults = True) +Symmetry_4 = model.addSymmetry( + Part_1_doc, + [ + model.selection("SOLID", "Symmetry_3_1_1_1"), + model.selection("SOLID", "Symmetry_3_1_2_2"), + model.selection("SOLID", "Symmetry_3_1_3"), + ], + model.selection("EDGE", "PartSet/OX"), + keepOriginal=False, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Symmetry_4.feature().error() != "") +assert Symmetry_4.feature().error() != "" model.begin() -Symmetry_4.setMainObjects([model.selection("COMPSOLID", "Symmetry_3_1_1"), model.selection("SOLID", "Symmetry_3_1_2_2"), model.selection("SOLID", "Symmetry_3_1_3")]) +Symmetry_4.setMainObjects( + [ + model.selection("COMPSOLID", "Symmetry_3_1_1"), + model.selection("SOLID", "Symmetry_3_1_2_2"), + model.selection("SOLID", "Symmetry_3_1_3"), + ] +) REFERENCE[0] = symmetryOX(REFERENCE[0]) subs = subsRefPoints(Compound_2.result().subResult(1)) for ind in range(0, len(subs)): @@ -142,19 +274,47 @@ REFERENCE[2] = symmetryOX(REFERENCE[2]) assertResult(Symmetry_4, 10, 47, 162, 324, 14319.99602674256) -Symmetry_5 = model.addSymmetry(Part_1_doc, [model.selection("COMPSOLID", "Symmetry_4_1_1")], model.selection("EDGE", "PartSet/OZ"), keepOriginal = True, keepSubResults = True) +Symmetry_5 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPSOLID", "Symmetry_4_1_1")], + model.selection("EDGE", "PartSet/OZ"), + keepOriginal=True, + keepSubResults=True, +) REFERENCE[0] = middleOZ(REFERENCE[0]) assertResult(Symmetry_5, 17, 85, 306, 612, 26283.79756329278) -Symmetry_6 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_5_1_2_1")], model.selection("EDGE", "PartSet/OZ"), keepOriginal = True, keepSubResults = True) +Symmetry_6 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Symmetry_5_1_2_1")], + model.selection("EDGE", "PartSet/OZ"), + keepOriginal=True, + keepSubResults=True, +) REFERENCE[1] = middleOZ(REFERENCE[1]) assertResult(Symmetry_6, 18, 88, 312, 624, 27069.19572669) -Symmetry_7 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_6_1_3")], model.selection("EDGE", "PartSet/OZ"), keepOriginal = True, keepSubResults = True) +Symmetry_7 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Symmetry_6_1_3")], + model.selection("EDGE", "PartSet/OZ"), + keepOriginal=True, + keepSubResults=True, +) REFERENCE[2] = middleOZ(REFERENCE[2]) assertResult(Symmetry_7, 19, 91, 318, 636, 27854.59389) -Symmetry_8 = model.addSymmetry(Part_1_doc, [model.selection("COMPSOLID", "Symmetry_7_1_1"), model.selection("SOLID", "Symmetry_7_1_2_2"), model.selection("SOLID", "Symmetry_7_1_3")], model.selection("EDGE", "PartSet/OY"), keepOriginal = True, keepSubResults = True) +Symmetry_8 = model.addSymmetry( + Part_1_doc, + [ + model.selection("COMPSOLID", "Symmetry_7_1_1"), + model.selection("SOLID", "Symmetry_7_1_2_2"), + model.selection("SOLID", "Symmetry_7_1_3"), + ], + model.selection("EDGE", "PartSet/OY"), + keepOriginal=True, + keepSubResults=True, +) REFERENCE[0] = ORIGIN REFERENCE[1] = ORIGIN REFERENCE[2] = ORIGIN @@ -162,4 +322,4 @@ assertResult(Symmetry_8, 36, 176, 624, 1248, 54138.39145338) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_3.py b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_3.py index 19c5ffd22..b5b1f7cf3 100644 --- a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_3.py +++ b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_3.py @@ -29,62 +29,151 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() + def symmetryXOZ(thePoint): return GeomAPI_Pnt(thePoint.x(), -thePoint.y(), thePoint.z()) + def average(thePoints): - x = 0; y = 0; z = 0 + x = 0 + y = 0 + z = 0 for p in thePoints: - x += p.x(); y += p.y(); z+= p.z() + x += p.x() + y += p.y() + z += p.z() x /= len(thePoints) y /= len(thePoints) z /= len(thePoints) return GeomAPI_Pnt(x, y, z) + def subsRefPoints(theResult): res = [] for ind in range(0, theResult.numberOfSubs()): - res.append( theResult.subResult(ind).resultSubShapePair()[0].shape().middlePoint()) + res.append( + theResult.subResult(ind).resultSubShapePair()[0].shape().middlePoint() + ) return res -TOLERANCE = 1.e-7 + +TOLERANCE = 1.0e-7 REFERENCE = subsRefPoints(Compound_2.result()) -def assertResult(theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, theVolume): + +def assertResult( + theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, theVolume +): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [3]) model.testNbSubShapes(theFeature, GeomAPI_Shape.SOLID, [theNbSolids]) @@ -95,39 +184,82 @@ def assertResult(theFeature, theNbSolids, theNbFaces, theNbEdges, theNbVertices, for ind in range(0, theFeature.result().numberOfSubs()): ref = REFERENCE[ind] - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) - + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("FACE", "PartSet/XOZ"), keepOriginal = False, keepSubResults = True) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("FACE", "PartSet/XOZ"), + keepOriginal=False, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Symmetry_1.feature().error() != "") +assert Symmetry_1.feature().error() != "" model.begin() Symmetry_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")]) REFERENCE[0] = symmetryXOZ(REFERENCE[0]) assertResult(Symmetry_1, 10, 47, 162, 324, 14319.99602674256) -Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_1_1_2_1")], model.selection("FACE", "PartSet/XOZ"), keepOriginal = False, keepSubResults = True) +Symmetry_2 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Symmetry_1_1_2_1")], + model.selection("FACE", "PartSet/XOZ"), + keepOriginal=False, + keepSubResults=True, +) subs = subsRefPoints(Compound_2.result().subResult(1)) subs[0] = symmetryXOZ(subs[0]) REFERENCE[1] = average(subs) assertResult(Symmetry_2, 10, 47, 162, 324, 14319.99602674256) -Symmetry_3 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_2_1_3")], model.selection("FACE", "PartSet/XOZ"), keepOriginal = False, keepSubResults = True) +Symmetry_3 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Symmetry_2_1_3")], + model.selection("FACE", "PartSet/XOZ"), + keepOriginal=False, + keepSubResults=True, +) REFERENCE[2] = symmetryXOZ(REFERENCE[2]) assertResult(Symmetry_3, 10, 47, 162, 324, 14319.99602674256) -Symmetry_4 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_3_1_1_1"), model.selection("SOLID", "Symmetry_3_1_2_2"), model.selection("SOLID", "Symmetry_3_1_3")], model.selection("FACE", "PartSet/XOZ"), keepOriginal = False, keepSubResults = True) +Symmetry_4 = model.addSymmetry( + Part_1_doc, + [ + model.selection("SOLID", "Symmetry_3_1_1_1"), + model.selection("SOLID", "Symmetry_3_1_2_2"), + model.selection("SOLID", "Symmetry_3_1_3"), + ], + model.selection("FACE", "PartSet/XOZ"), + keepOriginal=False, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Symmetry_4.feature().error() != "") +assert Symmetry_4.feature().error() != "" model.begin() -Symmetry_4.setMainObjects([model.selection("COMPSOLID", "Symmetry_3_1_1"), model.selection("SOLID", "Symmetry_3_1_2_2"), model.selection("SOLID", "Symmetry_3_1_3")]) +Symmetry_4.setMainObjects( + [ + model.selection("COMPSOLID", "Symmetry_3_1_1"), + model.selection("SOLID", "Symmetry_3_1_2_2"), + model.selection("SOLID", "Symmetry_3_1_3"), + ] +) REFERENCE[0] = symmetryXOZ(REFERENCE[0]) subs = subsRefPoints(Compound_2.result().subResult(1)) for ind in range(0, len(subs)): @@ -137,19 +269,47 @@ REFERENCE[2] = symmetryXOZ(REFERENCE[2]) assertResult(Symmetry_4, 10, 47, 162, 324, 14319.99602674256) -Symmetry_5 = model.addSymmetry(Part_1_doc, [model.selection("COMPSOLID", "Symmetry_4_1_1")], model.selection("FACE", "PartSet/XOY"), keepOriginal = True, keepSubResults = True) +Symmetry_5 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPSOLID", "Symmetry_4_1_1")], + model.selection("FACE", "PartSet/XOY"), + keepOriginal=True, + keepSubResults=True, +) REFERENCE[0].setZ(0) assertResult(Symmetry_5, 17, 85, 306, 612, 26283.79756329278) -Symmetry_6 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_5_1_2_1")], model.selection("FACE", "PartSet/XOY"), keepOriginal = True, keepSubResults = True) +Symmetry_6 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Symmetry_5_1_2_1")], + model.selection("FACE", "PartSet/XOY"), + keepOriginal=True, + keepSubResults=True, +) REFERENCE[1].setZ(0) assertResult(Symmetry_6, 18, 88, 312, 624, 27069.19572669) -Symmetry_7 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_6_1_3")], model.selection("FACE", "PartSet/XOY"), keepOriginal = True, keepSubResults = True) +Symmetry_7 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Symmetry_6_1_3")], + model.selection("FACE", "PartSet/XOY"), + keepOriginal=True, + keepSubResults=True, +) REFERENCE[2].setZ(0) assertResult(Symmetry_7, 19, 91, 318, 636, 27854.59389) -Symmetry_8 = model.addSymmetry(Part_1_doc, [model.selection("COMPSOLID", "Symmetry_7_1_1"), model.selection("SOLID", "Symmetry_7_1_2_2"), model.selection("SOLID", "Symmetry_7_1_3")], model.selection("FACE", "Symmetry_4_1_2_2/MF:Symmetried&Extrusion_1_3/To_Face"), keepOriginal = True, keepSubResults = True) +Symmetry_8 = model.addSymmetry( + Part_1_doc, + [ + model.selection("COMPSOLID", "Symmetry_7_1_1"), + model.selection("SOLID", "Symmetry_7_1_2_2"), + model.selection("SOLID", "Symmetry_7_1_3"), + ], + model.selection("FACE", "Symmetry_4_1_2_2/MF:Symmetried&Extrusion_1_3/To_Face"), + keepOriginal=True, + keepSubResults=True, +) REFERENCE[0].setZ(10) REFERENCE[1].setZ(5) REFERENCE[2].setZ(10) @@ -157,4 +317,4 @@ assertResult(Symmetry_8, 36, 176, 624, 1248, 54138.39145338) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_4.py b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_4.py index 81b72e143..f0c0b698e 100644 --- a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_4.py +++ b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_4.py @@ -26,62 +26,180 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + def symmetryOZ(thePoint): return GeomAPI_Pnt(-thePoint.x(), -thePoint.y(), thePoint.z()) model.begin() -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("EDGE", "PartSet/OZ"), keepOriginal = False, keepSubResults = True) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("VERTEX", "Vertex_1_1")], + model.selection("EDGE", "PartSet/OZ"), + keepOriginal=False, + keepSubResults=True, +) model.testNbResults(Symmetry_1, 1) model.testNbSubResults(Symmetry_1, [0]) model.testNbSubShapes(Symmetry_1, GeomAPI_Shape.SOLID, [0]) @@ -92,9 +210,15 @@ model.testResultsVolumes(Symmetry_1, [0]) model.testResultsAreas(Symmetry_1, [0]) refPoint = symmetryOZ(Vertex_1.defaultResult().shape().middlePoint()) midPoint = Symmetry_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OZ"), keepOriginal = False, keepSubResults = True) +Symmetry_2 = model.addSymmetry( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OZ"), + keepOriginal=False, + keepSubResults=True, +) model.testNbResults(Symmetry_2, 1) model.testNbSubResults(Symmetry_2, [0]) model.testNbSubShapes(Symmetry_2, GeomAPI_Shape.SOLID, [0]) @@ -105,9 +229,15 @@ model.testResultsVolumes(Symmetry_2, [0]) model.testResultsAreas(Symmetry_2, [0]) refPoint = symmetryOZ(Edge_1.defaultResult().shape().middlePoint()) midPoint = Symmetry_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Symmetry_3 = model.addSymmetry(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("EDGE", "PartSet/OZ"), keepOriginal = False, keepSubResults = True) +Symmetry_3 = model.addSymmetry( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + model.selection("EDGE", "PartSet/OZ"), + keepOriginal=False, + keepSubResults=True, +) model.testNbResults(Symmetry_3, 1) model.testNbSubResults(Symmetry_3, [0]) model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.SOLID, [0]) @@ -118,9 +248,15 @@ model.testResultsVolumes(Symmetry_3, [0]) model.testResultsAreas(Symmetry_3, [0]) refPoint = symmetryOZ(Wire_1.defaultResult().shape().middlePoint()) midPoint = Symmetry_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Symmetry_4 = model.addSymmetry(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), keepOriginal = False, keepSubResults = True) +Symmetry_4 = model.addSymmetry( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("EDGE", "PartSet/OZ"), + keepOriginal=False, + keepSubResults=True, +) model.testNbResults(Symmetry_4, 1) model.testNbSubResults(Symmetry_4, [0]) model.testNbSubShapes(Symmetry_4, GeomAPI_Shape.SOLID, [0]) @@ -131,9 +267,15 @@ model.testResultsVolumes(Symmetry_4, [0]) model.testResultsAreas(Symmetry_4, [109.154152964914914]) refPoint = symmetryOZ(Face_1.defaultResult().shape().middlePoint()) midPoint = Symmetry_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Symmetry_5 = model.addSymmetry(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OZ"), keepOriginal = False, keepSubResults = True) +Symmetry_5 = model.addSymmetry( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + model.selection("EDGE", "PartSet/OZ"), + keepOriginal=False, + keepSubResults=True, +) model.testNbResults(Symmetry_5, 1) model.testNbSubResults(Symmetry_5, [0]) model.testNbSubShapes(Symmetry_5, GeomAPI_Shape.SOLID, [0]) @@ -144,9 +286,15 @@ model.testResultsVolumes(Symmetry_5, [0]) model.testResultsAreas(Symmetry_5, [182.822012116]) refPoint = symmetryOZ(Shell_1.defaultResult().shape().middlePoint()) midPoint = Symmetry_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Symmetry_6 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OZ"), keepOriginal = False, keepSubResults = True) +Symmetry_6 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + model.selection("EDGE", "PartSet/OZ"), + keepOriginal=False, + keepSubResults=True, +) model.testNbResults(Symmetry_6, 1) model.testNbSubResults(Symmetry_6, [0]) model.testNbSubShapes(Symmetry_6, GeomAPI_Shape.SOLID, [1]) @@ -156,9 +304,15 @@ model.testNbSubShapes(Symmetry_6, GeomAPI_Shape.VERTEX, [48]) model.testResultsVolumes(Symmetry_6, [1000]) refPoint = symmetryOZ(Translation_1.defaultResult().shape().middlePoint()) midPoint = Symmetry_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Symmetry_7 = model.addSymmetry(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("EDGE", "PartSet/OZ"), keepOriginal = False, keepSubResults = True) +Symmetry_7 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + model.selection("EDGE", "PartSet/OZ"), + keepOriginal=False, + keepSubResults=True, +) model.testNbResults(Symmetry_7, 1) model.testNbSubResults(Symmetry_7, [3]) model.testNbSubShapes(Symmetry_7, GeomAPI_Shape.SOLID, [3]) @@ -168,9 +322,15 @@ model.testNbSubShapes(Symmetry_7, GeomAPI_Shape.VERTEX, [132]) model.testResultsVolumes(Symmetry_7, [1589.0486226]) refPoint = symmetryOZ(Partition_1.defaultResult().shape().middlePoint()) midPoint = Symmetry_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Symmetry_8 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], model.selection("EDGE", "PartSet/OZ"), keepOriginal = False, keepSubResults = True) +Symmetry_8 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPOUND", "AngularCopy_1_1")], + model.selection("EDGE", "PartSet/OZ"), + keepOriginal=False, + keepSubResults=True, +) model.testNbResults(Symmetry_8, 1) model.testNbSubResults(Symmetry_8, [3]) model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.SOLID, [3]) @@ -180,8 +340,8 @@ model.testNbSubShapes(Symmetry_8, GeomAPI_Shape.VERTEX, [144]) model.testResultsVolumes(Symmetry_8, [3000]) refPoint = symmetryOZ(AngularCopy_1.defaultResult().shape().middlePoint()) midPoint = Symmetry_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_5.py b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_5.py index f094abd44..d646fe6fc 100644 --- a/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_5.py +++ b/src/FeaturesPlugin/Test/TestSymmetry_MultiLevelCompound_v95_5.py @@ -26,63 +26,184 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() # collect reference data REFERENCE = [] -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 for ind in range(0, Compound_1.result().numberOfSubs()): p = Compound_1.result().subResult(ind).resultSubShapePair()[1].middlePoint() REFERENCE.append(p) + def assertResult(theFeature, theNbMoved): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [8]) @@ -97,35 +218,93 @@ def assertResult(theFeature, theNbMoved): if ind < theNbMoved: ref.setY(-ref.y()) ref.setZ(-ref.z()) - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("VERTEX", "Compound_1_1_1")], model.selection("EDGE", "PartSet/OX"), keepOriginal = False, keepSubResults = True) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("VERTEX", "Compound_1_1_1")], + model.selection("EDGE", "PartSet/OX"), + keepOriginal=False, + keepSubResults=True, +) assertResult(Symmetry_1, 1) -Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("EDGE", "Symmetry_1_1_2")], model.selection("EDGE", "PartSet/OX"), keepOriginal = False, keepSubResults = True) +Symmetry_2 = model.addSymmetry( + Part_1_doc, + [model.selection("EDGE", "Symmetry_1_1_2")], + model.selection("EDGE", "PartSet/OX"), + keepOriginal=False, + keepSubResults=True, +) assertResult(Symmetry_2, 2) -Symmetry_3 = model.addSymmetry(Part_1_doc, [model.selection("WIRE", "Symmetry_2_1_3")], model.selection("EDGE", "PartSet/OX"), keepOriginal = False, keepSubResults = True) +Symmetry_3 = model.addSymmetry( + Part_1_doc, + [model.selection("WIRE", "Symmetry_2_1_3")], + model.selection("EDGE", "PartSet/OX"), + keepOriginal=False, + keepSubResults=True, +) assertResult(Symmetry_3, 3) -Symmetry_4 = model.addSymmetry(Part_1_doc, [model.selection("FACE", "Symmetry_3_1_4")], model.selection("EDGE", "PartSet/OX"), keepOriginal = False, keepSubResults = True) +Symmetry_4 = model.addSymmetry( + Part_1_doc, + [model.selection("FACE", "Symmetry_3_1_4")], + model.selection("EDGE", "PartSet/OX"), + keepOriginal=False, + keepSubResults=True, +) assertResult(Symmetry_4, 4) -Symmetry_5 = model.addSymmetry(Part_1_doc, [model.selection("SHELL", "Symmetry_4_1_5")], model.selection("EDGE", "PartSet/OX"), keepOriginal = False, keepSubResults = True) +Symmetry_5 = model.addSymmetry( + Part_1_doc, + [model.selection("SHELL", "Symmetry_4_1_5")], + model.selection("EDGE", "PartSet/OX"), + keepOriginal=False, + keepSubResults=True, +) assertResult(Symmetry_5, 5) -Symmetry_6 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_5_1_6")], model.selection("EDGE", "PartSet/OX"), keepOriginal = False, keepSubResults = True) +Symmetry_6 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Symmetry_5_1_6")], + model.selection("EDGE", "PartSet/OX"), + keepOriginal=False, + keepSubResults=True, +) assertResult(Symmetry_6, 6) -Symmetry_7 = model.addSymmetry(Part_1_doc, [model.selection("COMPSOLID", "Symmetry_6_1_7")], model.selection("EDGE", "PartSet/OX"), keepOriginal = False, keepSubResults = True) +Symmetry_7 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPSOLID", "Symmetry_6_1_7")], + model.selection("EDGE", "PartSet/OX"), + keepOriginal=False, + keepSubResults=True, +) assertResult(Symmetry_7, 7) -Symmetry_8 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "Symmetry_7_1_8")], model.selection("EDGE", "PartSet/OX"), keepOriginal = False, keepSubResults = True) +Symmetry_8 = model.addSymmetry( + Part_1_doc, + [model.selection("COMPOUND", "Symmetry_7_1_8")], + model.selection("EDGE", "PartSet/OX"), + keepOriginal=False, + keepSubResults=True, +) assertResult(Symmetry_8, 8) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestSymmetry_Part.py b/src/FeaturesPlugin/Test/TestSymmetry_Part.py index 4a05d7dea..fe526c168 100644 --- a/src/FeaturesPlugin/Test/TestSymmetry_Part.py +++ b/src/FeaturesPlugin/Test/TestSymmetry_Part.py @@ -25,9 +25,24 @@ 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) +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 diff --git a/src/FeaturesPlugin/Test/TestTranslation.py b/src/FeaturesPlugin/Test/TestTranslation.py index abef71dc8..603e834b1 100644 --- a/src/FeaturesPlugin/Test/TestTranslation.py +++ b/src/FeaturesPlugin/Test/TestTranslation.py @@ -31,9 +31,9 @@ data()->addAttribute(AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(DISTANCE_ID(), ModelAPI_AttributeDouble::typeId()); """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -46,15 +46,15 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +assert len(aPartFeature.results()) == 1 # Another way is: # aPart = aSession.activeDocument() aPartResult = modelAPI_ResultPart(aPartFeature.firstResult()) aPart = aPartResult.partDoc() -#========================================================================= +# ========================================================================= # Create a sketch circle to extrude -#========================================================================= +# ========================================================================= aSession.startOperation() aCircleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")) @@ -70,36 +70,37 @@ aCircleRadius = aSketchCircle.real("circle_radius") anCircleCentr.setValue(50, 50) aCircleRadius.setValue(20) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on circle -#========================================================================= +# ========================================================================= # Build shape from sketcher results aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult()) -assert (aCircleSketchResult.facesNum() > 0) +assert aCircleSketchResult.facesNum() > 0 # Create extrusion aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") -assert (anExtrusionFt.getKind() == "Extrusion") +assert anExtrusionFt.getKind() == "Extrusion" # selection type FACE=4 anExtrusionFt.selectionList("base").append( - aCircleSketchResult, aCircleSketchResult.face(0)) + aCircleSketchResult, aCircleSketchResult.face(0) +) 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.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) +assert anExtrusionFt.real("to_size").value() == 50 # Check extrusion results -assert (len(anExtrusionFt.results()) > 0) +assert len(anExtrusionFt.results()) > 0 anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult()) -assert (anExtrusionResult is not None) +assert anExtrusionResult is not None -#========================================================================= +# ========================================================================= # Create a sketch line to movement -#========================================================================= +# ========================================================================= aSession.startOperation() aLineSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) origin = geomDataAPI_Point(aLineSketchFeature.attribute("Origin")) @@ -122,27 +123,29 @@ aLineSketchShape = modelAPI_ResultConstruction(aLineSketchResult).shape() aShapeExplorer = GeomAPI_ShapeExplorer(aLineSketchShape, GeomAPI_Shape.EDGE) aLineEdge = aShapeExplorer.current() -#========================================================================= +# ========================================================================= # Test movement -#========================================================================= +# ========================================================================= aSession.startOperation() aMoveFt = aPart.addFeature("Translation") -assert (aMoveFt.getKind() == "Translation") +assert aMoveFt.getKind() == "Translation" aMoveFt.selectionList("main_objects").append( - anExtrusionResult, anExtrusionResult.shape()) + anExtrusionResult, anExtrusionResult.shape() +) aMoveFt.string("CreationMethod").setValue("ByAxisAndDistance") aMoveFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge) aMoveFt.real("distance").setValue(100) aMoveFt.execute() aSession.finishOperation() -assert (aMoveFt.real("distance").value() == 100) +assert aMoveFt.real("distance").value() == 100 # Check movement results aFactory = ModelAPI_Session.get().validators() -assert (aFactory.validate(aMoveFt)) -assert (len(aMoveFt.results()) > 0) +assert aFactory.validate(aMoveFt) +assert len(aMoveFt.results()) > 0 aMoveResult = modelAPI_ResultBody(aMoveFt.firstResult()) -assert (aMoveResult is not None) +assert aMoveResult is not None from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_1.py b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_1.py index d55cc5e97..d22584d8a 100644 --- a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_1.py +++ b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_1.py @@ -27,45 +27,126 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() DISTANCE = 10 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 model.begin() -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("EDGE", "PartSet/OX"), DISTANCE) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection("EDGE", "PartSet/OX"), + DISTANCE, +) model.testNbResults(Translation_1, 1) model.testNbSubResults(Translation_1, [0]) model.testNbSubShapes(Translation_1, GeomAPI_Shape.SOLID, [1]) @@ -74,14 +155,21 @@ model.testNbSubShapes(Translation_1, GeomAPI_Shape.EDGE, [18]) model.testNbSubShapes(Translation_1, GeomAPI_Shape.VERTEX, [36]) model.testResultsVolumes(Translation_1, [542.746463956]) -refPoint = Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint() +) refPoint.setX(refPoint.x() + DISTANCE) midPoint = Translation_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, Translation_1, [Compound_2.result()], True) -Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_1_1_2_1")], model.selection("EDGE", "PartSet/OY"), DISTANCE) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Recover_1_1_2_1")], + model.selection("EDGE", "PartSet/OY"), + DISTANCE, +) model.testNbResults(Translation_2, 1) model.testNbSubResults(Translation_2, [0]) model.testNbSubShapes(Translation_2, GeomAPI_Shape.SOLID, [1]) @@ -90,14 +178,26 @@ model.testNbSubShapes(Translation_2, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Translation_2, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Translation_2, [785.39816339745]) -refPoint = Recover_1.result().subResult(1).subResult(0).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Recover_1.result() + .subResult(1) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint() +) refPoint.setY(refPoint.y() + DISTANCE) midPoint = Translation_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, Translation_2, [Recover_1.result()], True) -Translation_3 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_2_1_3")], model.selection("EDGE", "PartSet/OZ"), DISTANCE) +Translation_3 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Recover_2_1_3")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, +) model.testNbResults(Translation_3, 1) model.testNbSubResults(Translation_3, [0]) model.testNbSubShapes(Translation_3, GeomAPI_Shape.SOLID, [1]) @@ -109,27 +209,50 @@ model.testResultsVolumes(Translation_3, [785.39816339745]) refPoint = Recover_2.result().subResult(2).resultSubShapePair()[0].shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE) midPoint = Translation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_3 = model.addRecover(Part_1_doc, Translation_3, [Recover_2.result()], True) -Translation_4 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_3_1_1_1"), model.selection("SOLID", "Recover_3_1_2_2"), model.selection("SOLID", "Recover_3_1_3")], model.selection("EDGE", "PartSet/OZ"), -DISTANCE) +Translation_4 = model.addTranslation( + Part_1_doc, + [ + model.selection("SOLID", "Recover_3_1_1_1"), + model.selection("SOLID", "Recover_3_1_2_2"), + model.selection("SOLID", "Recover_3_1_3"), + ], + model.selection("EDGE", "PartSet/OZ"), + -DISTANCE, +) model.testNbResults(Translation_4, 3) model.testNbSubResults(Translation_4, [0, 0, 0]) model.testNbSubShapes(Translation_4, GeomAPI_Shape.SOLID, [1, 1, 1]) model.testNbSubShapes(Translation_4, GeomAPI_Shape.FACE, [6, 3, 3]) model.testNbSubShapes(Translation_4, GeomAPI_Shape.EDGE, [24, 6, 6]) model.testNbSubShapes(Translation_4, GeomAPI_Shape.VERTEX, [48, 12, 12]) -model.testResultsVolumes(Translation_4, [3444.394198615, 785.39816339745, 785.39816339745]) +model.testResultsVolumes( + Translation_4, [3444.394198615, 785.39816339745, 785.39816339745] +) -REFERENCE = [Recover_3.result().subResult(0).subResult(0).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(1).subResult(1).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()] +REFERENCE = [ + Recover_3.result() + .subResult(0) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result() + .subResult(1) + .subResult(1) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint(), +] for res, ref in zip(Translation_4.results(), REFERENCE): ref.setZ(ref.z() - DISTANCE) midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE) + assert midPoint.distance(ref) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_2.py b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_2.py index fad4bec80..0bd4ae258 100644 --- a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_2.py +++ b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_2.py @@ -27,47 +27,125 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() DX = 15 DY = 20 DZ = 25 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 model.begin() -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], DX, 0, 0) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], DX, 0, 0 +) model.testNbResults(Translation_1, 1) model.testNbSubResults(Translation_1, [0]) model.testNbSubShapes(Translation_1, GeomAPI_Shape.SOLID, [1]) @@ -76,14 +154,18 @@ model.testNbSubShapes(Translation_1, GeomAPI_Shape.EDGE, [18]) model.testNbSubShapes(Translation_1, GeomAPI_Shape.VERTEX, [36]) model.testResultsVolumes(Translation_1, [542.746463956]) -refPoint = Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint() +) refPoint.setX(refPoint.x() + DX) midPoint = Translation_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, Translation_1, [Compound_2.result()], True) -Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_1_1_2_1")], 0, DY, 0) +Translation_2 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Recover_1_1_2_1")], 0, DY, 0 +) model.testNbResults(Translation_2, 1) model.testNbSubResults(Translation_2, [0]) model.testNbSubShapes(Translation_2, GeomAPI_Shape.SOLID, [1]) @@ -92,14 +174,23 @@ model.testNbSubShapes(Translation_2, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Translation_2, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Translation_2, [785.39816339745]) -refPoint = Recover_1.result().subResult(1).subResult(0).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Recover_1.result() + .subResult(1) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint() +) refPoint.setY(refPoint.y() + DY) midPoint = Translation_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, Translation_2, [Recover_1.result()], True) -Translation_3 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_2_1_3")], 0, 0, DZ) +Translation_3 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Recover_2_1_3")], 0, 0, DZ +) model.testNbResults(Translation_3, 1) model.testNbSubResults(Translation_3, [0]) model.testNbSubShapes(Translation_3, GeomAPI_Shape.SOLID, [1]) @@ -111,29 +202,53 @@ model.testResultsVolumes(Translation_3, [785.39816339745]) refPoint = Recover_2.result().subResult(2).resultSubShapePair()[0].shape().middlePoint() refPoint.setZ(refPoint.z() + DZ) midPoint = Translation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_3 = model.addRecover(Part_1_doc, Translation_3, [Recover_2.result()], True) -Translation_4 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_3_1_1_1"), model.selection("SOLID", "Recover_3_1_2_2"), model.selection("SOLID", "Recover_3_1_3")], DX, DY, DZ) +Translation_4 = model.addTranslation( + Part_1_doc, + [ + model.selection("SOLID", "Recover_3_1_1_1"), + model.selection("SOLID", "Recover_3_1_2_2"), + model.selection("SOLID", "Recover_3_1_3"), + ], + DX, + DY, + DZ, +) model.testNbResults(Translation_4, 3) model.testNbSubResults(Translation_4, [0, 0, 0]) model.testNbSubShapes(Translation_4, GeomAPI_Shape.SOLID, [1, 1, 1]) model.testNbSubShapes(Translation_4, GeomAPI_Shape.FACE, [6, 3, 3]) model.testNbSubShapes(Translation_4, GeomAPI_Shape.EDGE, [24, 6, 6]) model.testNbSubShapes(Translation_4, GeomAPI_Shape.VERTEX, [48, 12, 12]) -model.testResultsVolumes(Translation_4, [3444.394198615, 785.39816339745, 785.39816339745]) - -REFERENCE = [Recover_3.result().subResult(0).subResult(0).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(1).subResult(1).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()] +model.testResultsVolumes( + Translation_4, [3444.394198615, 785.39816339745, 785.39816339745] +) + +REFERENCE = [ + Recover_3.result() + .subResult(0) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result() + .subResult(1) + .subResult(1) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint(), +] for res, ref in zip(Translation_4.results(), REFERENCE): ref.setX(ref.x() + DX) ref.setY(ref.y() + DY) ref.setZ(ref.z() + DZ) midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE) + assert midPoint.distance(ref) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_3.py b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_3.py index f3548a0a1..eeb48c102 100644 --- a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_3.py +++ b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_3.py @@ -29,44 +29,127 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), MAJOR_AXIS) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 model.begin() -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point"), model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex")) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + model.selection( + "VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point" + ), + model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"), +) model.testNbResults(Translation_1, 1) model.testNbSubResults(Translation_1, [0]) model.testNbSubShapes(Translation_1, GeomAPI_Shape.SOLID, [1]) @@ -75,14 +158,23 @@ model.testNbSubShapes(Translation_1, GeomAPI_Shape.EDGE, [18]) model.testNbSubShapes(Translation_1, GeomAPI_Shape.VERTEX, [36]) model.testResultsVolumes(Translation_1, [542.746463956]) -refPoint = Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint() +) refPoint.setX(refPoint.x() + MAJOR_AXIS) midPoint = Translation_1.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_1 = model.addRecover(Part_1_doc, Translation_1, [Compound_2.result()], True) -Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_1_1_2_1")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point"), model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex")) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Recover_1_1_2_1")], + model.selection( + "VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point" + ), + model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"), +) model.testNbResults(Translation_2, 1) model.testNbSubResults(Translation_2, [0]) model.testNbSubShapes(Translation_2, GeomAPI_Shape.SOLID, [1]) @@ -91,14 +183,28 @@ model.testNbSubShapes(Translation_2, GeomAPI_Shape.EDGE, [6]) model.testNbSubShapes(Translation_2, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Translation_2, [785.39816339745]) -refPoint = Recover_1.result().subResult(1).subResult(0).resultSubShapePair()[0].shape().middlePoint() +refPoint = ( + Recover_1.result() + .subResult(1) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint() +) refPoint.setX(refPoint.x() + MAJOR_AXIS) midPoint = Translation_2.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_2 = model.addRecover(Part_1_doc, Translation_2, [Recover_1.result()], True) -Translation_3 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_2_1_3")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point"), model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex")) +Translation_3 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Recover_2_1_3")], + model.selection( + "VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point" + ), + model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"), +) model.testNbResults(Translation_3, 1) model.testNbSubResults(Translation_3, [0]) model.testNbSubShapes(Translation_3, GeomAPI_Shape.SOLID, [1]) @@ -110,27 +216,52 @@ model.testResultsVolumes(Translation_3, [785.39816339745]) refPoint = Recover_2.result().subResult(2).resultSubShapePair()[0].shape().middlePoint() refPoint.setX(refPoint.x() + MAJOR_AXIS) midPoint = Translation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE Recover_3 = model.addRecover(Part_1_doc, Translation_3, [Recover_2.result()], True) -Translation_4 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_3_1_1_1"), model.selection("SOLID", "Recover_3_1_2_2"), model.selection("SOLID", "Recover_3_1_3")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point"), model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex")) +Translation_4 = model.addTranslation( + Part_1_doc, + [ + model.selection("SOLID", "Recover_3_1_1_1"), + model.selection("SOLID", "Recover_3_1_2_2"), + model.selection("SOLID", "Recover_3_1_3"), + ], + model.selection( + "VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point" + ), + model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"), +) model.testNbResults(Translation_4, 3) model.testNbSubResults(Translation_4, [0, 0, 0]) model.testNbSubShapes(Translation_4, GeomAPI_Shape.SOLID, [1, 1, 1]) model.testNbSubShapes(Translation_4, GeomAPI_Shape.FACE, [6, 3, 3]) model.testNbSubShapes(Translation_4, GeomAPI_Shape.EDGE, [24, 6, 6]) model.testNbSubShapes(Translation_4, GeomAPI_Shape.VERTEX, [48, 12, 12]) -model.testResultsVolumes(Translation_4, [3444.394198615, 785.39816339745, 785.39816339745]) +model.testResultsVolumes( + Translation_4, [3444.394198615, 785.39816339745, 785.39816339745] +) -REFERENCE = [Recover_3.result().subResult(0).subResult(0).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(1).subResult(1).resultSubShapePair()[0].shape().middlePoint(), - Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()] +REFERENCE = [ + Recover_3.result() + .subResult(0) + .subResult(0) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result() + .subResult(1) + .subResult(1) + .resultSubShapePair()[0] + .shape() + .middlePoint(), + Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint(), +] for res, ref in zip(Translation_4.results(), REFERENCE): ref.setX(ref.x() + MAJOR_AXIS) midPoint = res.resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE) + assert midPoint.distance(ref) < TOLERANCE model.end() -assert(model.checkPythonDump(model.CHECK_NAMING)) +assert model.checkPythonDump(model.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_4.py b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_4.py index 6321f12b8..fb68d3d14 100644 --- a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_4.py +++ b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_4.py @@ -26,59 +26,174 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() DISTANCE = 10 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 model.begin() -Translation_3 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE) +Translation_3 = model.addTranslation( + Part_1_doc, + [model.selection("VERTEX", "Vertex_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, +) model.testNbResults(Translation_3, 1) model.testNbSubResults(Translation_3, [0]) model.testNbSubShapes(Translation_3, GeomAPI_Shape.SOLID, [0]) @@ -90,9 +205,14 @@ model.testResultsAreas(Translation_3, [0]) refPoint = Vertex_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE) midPoint = Translation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Translation_4 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE) +Translation_4 = model.addTranslation( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, +) model.testNbResults(Translation_4, 1) model.testNbSubResults(Translation_4, [0]) model.testNbSubShapes(Translation_4, GeomAPI_Shape.SOLID, [0]) @@ -104,9 +224,14 @@ model.testResultsAreas(Translation_4, [0]) refPoint = Edge_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE) midPoint = Translation_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Translation_5 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE) +Translation_5 = model.addTranslation( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, +) model.testNbResults(Translation_5, 1) model.testNbSubResults(Translation_5, [0]) model.testNbSubShapes(Translation_5, GeomAPI_Shape.SOLID, [0]) @@ -118,9 +243,14 @@ model.testResultsAreas(Translation_5, [0]) refPoint = Wire_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE) midPoint = Translation_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Translation_6 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE) +Translation_6 = model.addTranslation( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, +) model.testNbResults(Translation_6, 1) model.testNbSubResults(Translation_6, [0]) model.testNbSubShapes(Translation_6, GeomAPI_Shape.SOLID, [0]) @@ -132,9 +262,14 @@ model.testResultsAreas(Translation_6, [109.154152964914914]) refPoint = Face_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE) midPoint = Translation_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Translation_7 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE) +Translation_7 = model.addTranslation( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, +) model.testNbResults(Translation_7, 1) model.testNbSubResults(Translation_7, [0]) model.testNbSubShapes(Translation_7, GeomAPI_Shape.SOLID, [0]) @@ -146,9 +281,14 @@ model.testResultsAreas(Translation_7, [182.822012116]) refPoint = Shell_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE) midPoint = Translation_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Translation_8 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE) +Translation_8 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, +) model.testNbResults(Translation_8, 1) model.testNbSubResults(Translation_8, [0]) model.testNbSubShapes(Translation_8, GeomAPI_Shape.SOLID, [1]) @@ -159,9 +299,14 @@ model.testResultsVolumes(Translation_8, [1000]) refPoint = Translation_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE) midPoint = Translation_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Translation_9 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE) +Translation_9 = model.addTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, +) model.testNbResults(Translation_9, 1) model.testNbSubResults(Translation_9, [3]) model.testNbSubShapes(Translation_9, GeomAPI_Shape.SOLID, [3]) @@ -172,9 +317,14 @@ model.testResultsVolumes(Translation_9, [1589.0486226]) refPoint = Partition_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE) midPoint = Translation_9.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Translation_10 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE) +Translation_10 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "AngularCopy_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, +) model.testNbResults(Translation_10, 1) model.testNbSubResults(Translation_10, [3]) model.testNbSubShapes(Translation_10, GeomAPI_Shape.SOLID, [3]) @@ -185,8 +335,8 @@ model.testResultsVolumes(Translation_10, [3000]) refPoint = AngularCopy_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE) midPoint = Translation_10.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_5.py b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_5.py index 152a1f1e2..855f4f3d6 100644 --- a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_5.py +++ b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v0_5.py @@ -26,60 +26,179 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() # collect reference data DISTANCE = 10 REFERENCE = [] -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 for ind in range(0, Compound_1.result().numberOfSubs()): p = Compound_1.result().subResult(ind).resultSubShapePair()[1].middlePoint() p.setZ(p.z() + DISTANCE) @@ -88,7 +207,12 @@ for ind in range(0, Compound_1.result().numberOfSubs()): index = 0 model.begin() -Translation_3 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Compound_1_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE) +Translation_3 = model.addTranslation( + Part_1_doc, + [model.selection("VERTEX", "Compound_1_1_1")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, +) model.testNbResults(Translation_3, 1) model.testNbSubResults(Translation_3, [0]) model.testNbSubShapes(Translation_3, GeomAPI_Shape.SOLID, [0]) @@ -98,11 +222,16 @@ model.testNbSubShapes(Translation_3, GeomAPI_Shape.VERTEX, [1]) model.testResultsVolumes(Translation_3, [0]) model.testResultsAreas(Translation_3, [0]) midPoint = Translation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_1 = model.addRecover(Part_1_doc, Translation_3, [Compound_1.result()], True) -Translation_4 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Recover_1_1_2")], model.selection("EDGE", "PartSet/OZ"), DISTANCE) +Translation_4 = model.addTranslation( + Part_1_doc, + [model.selection("EDGE", "Recover_1_1_2")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, +) model.testNbResults(Translation_4, 1) model.testNbSubResults(Translation_4, [0]) model.testNbSubShapes(Translation_4, GeomAPI_Shape.SOLID, [0]) @@ -112,11 +241,16 @@ model.testNbSubShapes(Translation_4, GeomAPI_Shape.VERTEX, [2]) model.testResultsVolumes(Translation_4, [0]) model.testResultsAreas(Translation_4, [0]) midPoint = Translation_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_2 = model.addRecover(Part_1_doc, Translation_4, [Recover_1.result()]) -Translation_5 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Recover_2_1_3")], model.selection("EDGE", "PartSet/OZ"), DISTANCE) +Translation_5 = model.addTranslation( + Part_1_doc, + [model.selection("WIRE", "Recover_2_1_3")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, +) model.testNbResults(Translation_5, 1) model.testNbSubResults(Translation_5, [0]) model.testNbSubShapes(Translation_5, GeomAPI_Shape.SOLID, [0]) @@ -126,11 +260,16 @@ model.testNbSubShapes(Translation_5, GeomAPI_Shape.VERTEX, [4]) model.testResultsVolumes(Translation_5, [0]) model.testResultsAreas(Translation_5, [0]) midPoint = Translation_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_3 = model.addRecover(Part_1_doc, Translation_5, [Recover_2.result()]) -Translation_6 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1_4")], model.selection("EDGE", "PartSet/OZ"), DISTANCE) +Translation_6 = model.addTranslation( + Part_1_doc, + [model.selection("FACE", "Recover_3_1_4")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, +) model.testNbResults(Translation_6, 1) model.testNbSubResults(Translation_6, [0]) model.testNbSubShapes(Translation_6, GeomAPI_Shape.SOLID, [0]) @@ -140,11 +279,16 @@ model.testNbSubShapes(Translation_6, GeomAPI_Shape.VERTEX, [8]) model.testResultsVolumes(Translation_6, [0]) model.testResultsAreas(Translation_6, [109.154152964914914]) midPoint = Translation_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_4 = model.addRecover(Part_1_doc, Translation_6, [Recover_3.result()]) -Translation_7 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Recover_4_1_5")], model.selection("EDGE", "PartSet/OZ"), DISTANCE) +Translation_7 = model.addTranslation( + Part_1_doc, + [model.selection("SHELL", "Recover_4_1_5")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, +) model.testNbResults(Translation_7, 1) model.testNbSubResults(Translation_7, [0]) model.testNbSubShapes(Translation_7, GeomAPI_Shape.SOLID, [0]) @@ -154,11 +298,16 @@ model.testNbSubShapes(Translation_7, GeomAPI_Shape.VERTEX, [16]) model.testResultsVolumes(Translation_7, [0]) model.testResultsAreas(Translation_7, [182.822012116]) midPoint = Translation_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_5 = model.addRecover(Part_1_doc, Translation_7, [Recover_4.result()]) -Translation_8 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_5_1_6")], model.selection("EDGE", "PartSet/OZ"), DISTANCE) +Translation_8 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Recover_5_1_6")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, +) model.testNbResults(Translation_8, 1) model.testNbSubResults(Translation_8, [0]) model.testNbSubShapes(Translation_8, GeomAPI_Shape.SOLID, [1]) @@ -167,11 +316,16 @@ model.testNbSubShapes(Translation_8, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(Translation_8, GeomAPI_Shape.VERTEX, [48]) model.testResultsVolumes(Translation_8, [1000]) midPoint = Translation_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_6 = model.addRecover(Part_1_doc, Translation_8, [Recover_5.result()]) -Translation_9 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Recover_6_1_7")], model.selection("EDGE", "PartSet/OZ"), DISTANCE) +Translation_9 = model.addTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Recover_6_1_7")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, +) model.testNbResults(Translation_9, 1) model.testNbSubResults(Translation_9, [3]) model.testNbSubShapes(Translation_9, GeomAPI_Shape.SOLID, [3]) @@ -180,11 +334,16 @@ model.testNbSubShapes(Translation_9, GeomAPI_Shape.EDGE, [66]) model.testNbSubShapes(Translation_9, GeomAPI_Shape.VERTEX, [132]) model.testResultsVolumes(Translation_9, [1589.0486226]) midPoint = Translation_9.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE index += 1 Recover_7 = model.addRecover(Part_1_doc, Translation_9, [Recover_6.result()]) -Translation_10 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "Recover_7_1_8")], model.selection("EDGE", "PartSet/OZ"), DISTANCE) +Translation_10 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "Recover_7_1_8")], + model.selection("EDGE", "PartSet/OZ"), + DISTANCE, +) model.testNbResults(Translation_10, 1) model.testNbSubResults(Translation_10, [3]) model.testNbSubShapes(Translation_10, GeomAPI_Shape.SOLID, [3]) @@ -193,8 +352,8 @@ model.testNbSubShapes(Translation_10, GeomAPI_Shape.EDGE, [72]) model.testNbSubShapes(Translation_10, GeomAPI_Shape.VERTEX, [144]) model.testResultsVolumes(Translation_10, [3000]) midPoint = Translation_10.defaultResult().shape().middlePoint() -assert(midPoint.distance(REFERENCE[index]) < TOLERANCE) +assert midPoint.distance(REFERENCE[index]) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_1.py b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_1.py index d0ef12d9f..2b80b761b 100644 --- a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_1.py +++ b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_1.py @@ -27,47 +27,124 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() DISTANCE = 10 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 REFERENCE = [] for ind in range(0, Compound_2.result().numberOfSubs()): p = Compound_2.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() REFERENCE.append(p) + def assertResult(theFeature): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [3]) @@ -79,36 +156,80 @@ def assertResult(theFeature): for ind in range(0, theFeature.result().numberOfSubs()): ref = REFERENCE[ind] - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], axis = model.selection("EDGE", "PartSet/OX"), distance = DISTANCE, keepSubResults = True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + axis=model.selection("EDGE", "PartSet/OX"), + distance=DISTANCE, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Translation_1.feature().error() != "") +assert Translation_1.feature().error() != "" model.begin() Translation_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")]) REFERENCE[0].setX(REFERENCE[0].x() + DISTANCE) assertResult(Translation_1) -Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_1_1_2_1")], axis = model.selection("EDGE", "PartSet/OY"), distance = DISTANCE, keepSubResults = True) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1_2_1")], + axis=model.selection("EDGE", "PartSet/OY"), + distance=DISTANCE, + keepSubResults=True, +) REFERENCE[1].setY(REFERENCE[1].y() + DISTANCE / 2) assertResult(Translation_2) -Translation_3 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_2_1_3")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True) +Translation_3 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1_3")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=DISTANCE, + keepSubResults=True, +) REFERENCE[2].setZ(REFERENCE[2].z() + DISTANCE) assertResult(Translation_3) -Translation_4 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_3_1_1_1"), model.selection("SOLID", "Translation_3_1_2_2"), model.selection("SOLID", "Translation_3_1_3")], axis = model.selection("EDGE", "PartSet/OZ"), distance = -DISTANCE, keepSubResults = True) +Translation_4 = model.addTranslation( + Part_1_doc, + [ + model.selection("SOLID", "Translation_3_1_1_1"), + model.selection("SOLID", "Translation_3_1_2_2"), + model.selection("SOLID", "Translation_3_1_3"), + ], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=-DISTANCE, + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Translation_4.feature().error() != "") +assert Translation_4.feature().error() != "" model.begin() -Translation_4.setMainObjects([model.selection("COMPSOLID", "Translation_3_1_1"), model.selection("SOLID", "Translation_3_1_2_2"), model.selection("SOLID", "Translation_3_1_3")]) +Translation_4.setMainObjects( + [ + model.selection("COMPSOLID", "Translation_3_1_1"), + model.selection("SOLID", "Translation_3_1_2_2"), + model.selection("SOLID", "Translation_3_1_3"), + ] +) REFERENCE[0].setZ(REFERENCE[0].z() - DISTANCE) REFERENCE[1].setZ(REFERENCE[1].z() - DISTANCE / 2) REFERENCE[2].setZ(REFERENCE[2].z() - DISTANCE) @@ -116,4 +237,4 @@ assertResult(Translation_4) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_2.py b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_2.py index 32d449087..6ecb8a386 100644 --- a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_2.py +++ b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_2.py @@ -27,49 +27,126 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() DX = 15 DY = 20 DZ = 25 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 REFERENCE = [] for ind in range(0, Compound_2.result().numberOfSubs()): p = Compound_2.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() REFERENCE.append(p) + def assertResult(theFeature): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [3]) @@ -81,41 +158,85 @@ def assertResult(theFeature): for ind in range(0, theFeature.result().numberOfSubs()): ref = REFERENCE[ind] - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], vector = [DX, 0, 0], keepSubResults = True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + vector=[DX, 0, 0], + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Translation_1.feature().error() != "") +assert Translation_1.feature().error() != "" model.begin() Translation_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")]) REFERENCE[0].setX(REFERENCE[0].x() + DX) assertResult(Translation_1) -Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_1_1_2_1")], vector = [0, DY, 0], keepSubResults = True) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1_2_1")], + vector=[0, DY, 0], + keepSubResults=True, +) REFERENCE[1].setY(REFERENCE[1].y() + DY / 2) assertResult(Translation_2) -Translation_3 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_2_1_3")], vector = [0, 0, DZ], keepSubResults = True) +Translation_3 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1_3")], + vector=[0, 0, DZ], + keepSubResults=True, +) REFERENCE[2].setZ(REFERENCE[2].z() + DZ) assertResult(Translation_3) -Translation_4 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_3_1_1_1"), model.selection("SOLID", "Translation_3_1_2_2"), model.selection("SOLID", "Translation_3_1_3")], vector = [DX, DY, DZ], keepSubResults = True) +Translation_4 = model.addTranslation( + Part_1_doc, + [ + model.selection("SOLID", "Translation_3_1_1_1"), + model.selection("SOLID", "Translation_3_1_2_2"), + model.selection("SOLID", "Translation_3_1_3"), + ], + vector=[DX, DY, DZ], + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Translation_4.feature().error() != "") +assert Translation_4.feature().error() != "" model.begin() -Translation_4.setMainObjects([model.selection("COMPSOLID", "Translation_3_1_1"), model.selection("SOLID", "Translation_3_1_2_2"), model.selection("SOLID", "Translation_3_1_3")]) -REFERENCE = [GeomAPI_Pnt(REFERENCE[0].x() + DX, REFERENCE[0].y() + DY, REFERENCE[0].z() + DZ), - GeomAPI_Pnt(REFERENCE[1].x() + DX / 2, REFERENCE[1].y() + DY / 2, REFERENCE[1].z() + DZ / 2), - GeomAPI_Pnt(REFERENCE[2].x() + DX, REFERENCE[2].y() + DY, REFERENCE[2].z() + DZ)] +Translation_4.setMainObjects( + [ + model.selection("COMPSOLID", "Translation_3_1_1"), + model.selection("SOLID", "Translation_3_1_2_2"), + model.selection("SOLID", "Translation_3_1_3"), + ] +) +REFERENCE = [ + GeomAPI_Pnt(REFERENCE[0].x() + DX, REFERENCE[0].y() + DY, REFERENCE[0].z() + DZ), + GeomAPI_Pnt( + REFERENCE[1].x() + DX / 2, REFERENCE[1].y() + DY / 2, REFERENCE[1].z() + DZ / 2 + ), + GeomAPI_Pnt(REFERENCE[2].x() + DX, REFERENCE[2].y() + DY, REFERENCE[2].z() + DZ), +] assertResult(Translation_4) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_3.py b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_3.py index 518e76a58..a170d383e 100644 --- a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_3.py +++ b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_3.py @@ -29,46 +29,123 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + 11.18033988749894, -50, 22.36067977499789, -50, 10 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), MAJOR_AXIS) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_3).startPoint(), + SketchAPI_Point(SketchPoint_3).coordinates(), + 50, + True, +) SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True) -[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchEllipse_1.result(), SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_3).coordinates(), + 360, + 3, + True, +) +[ + SketchEllipse_2, + SketchEllipse_3, + SketchCircle_2, + SketchCircle_3, +] = SketchMultiRotation_1.rotated() model.do() -Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchCircle_1.results()[1]], - [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], - [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], - [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], - [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchEllipse_1.result(), + SketchEllipse_1.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + ], + [SketchCircle_1.results()[1]], + [ + SketchEllipse_2.result(), + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()], + [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()], + [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()], + [ + SketchEllipse_2.result(), + SketchEllipse_3.result(), + SketchEllipse_3.result(), + SketchEllipse_1.result(), + ], + [SketchCircle_2.results()[1]], + [SketchCircle_3.results()[1]], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]) -Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + ], +) +Compound_2_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("COMPOUND", "Compound_1_1"), + model.selection("SOLID", "Extrusion_1_4"), +] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 REFERENCE = [] for ind in range(0, Compound_2.result().numberOfSubs()): p = Compound_2.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() REFERENCE.append(p) + def assertResult(theFeature): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [3]) @@ -80,36 +157,90 @@ def assertResult(theFeature): for ind in range(0, theFeature.result().numberOfSubs()): ref = REFERENCE[ind] - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], startPoint = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point"), endPoint = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"), keepSubResults = True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Compound_2_1_1_5")], + startPoint=model.selection( + "VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point" + ), + endPoint=model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"), + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Translation_1.feature().error() != "") +assert Translation_1.feature().error() != "" model.begin() Translation_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")]) REFERENCE[0].setX(REFERENCE[0].x() + MAJOR_AXIS) assertResult(Translation_1) -Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_1_1_2_1")], startPoint = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point"), endPoint = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"), keepSubResults = True) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1_2_1")], + startPoint=model.selection( + "VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point" + ), + endPoint=model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"), + keepSubResults=True, +) REFERENCE[1].setX(REFERENCE[1].x() + MAJOR_AXIS / 2) assertResult(Translation_2) -Translation_3 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_2_1_3")], startPoint = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point"), endPoint = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"), keepSubResults = True) +Translation_3 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1_3")], + startPoint=model.selection( + "VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point" + ), + endPoint=model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"), + keepSubResults=True, +) REFERENCE[2].setX(REFERENCE[2].x() + MAJOR_AXIS) assertResult(Translation_3) -Translation_4 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_3_1_1_1"), model.selection("SOLID", "Translation_3_1_2_2"), model.selection("SOLID", "Translation_3_1_3")], startPoint = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"), endPoint = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point"), keepSubResults = True) +Translation_4 = model.addTranslation( + Part_1_doc, + [ + model.selection("SOLID", "Translation_3_1_1_1"), + model.selection("SOLID", "Translation_3_1_2_2"), + model.selection("SOLID", "Translation_3_1_3"), + ], + startPoint=model.selection( + "VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex" + ), + endPoint=model.selection( + "VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point" + ), + keepSubResults=True, +) model.end() # selection of a compsolid part is prohibited -assert(Translation_4.feature().error() != "") +assert Translation_4.feature().error() != "" model.begin() -Translation_4.setMainObjects([model.selection("COMPSOLID", "Translation_3_1_1"), model.selection("SOLID", "Translation_3_1_2_2"), model.selection("SOLID", "Translation_3_1_3")]) +Translation_4.setMainObjects( + [ + model.selection("COMPSOLID", "Translation_3_1_1"), + model.selection("SOLID", "Translation_3_1_2_2"), + model.selection("SOLID", "Translation_3_1_3"), + ] +) REFERENCE[0].setX(REFERENCE[0].x() - MAJOR_AXIS) REFERENCE[1].setX(REFERENCE[1].x() - MAJOR_AXIS / 2) REFERENCE[2].setX(REFERENCE[2].x() - MAJOR_AXIS) @@ -117,4 +248,4 @@ assertResult(Translation_4) model.end() -assert(model.checkPythonDump(model.CHECK_NAMING)) +assert model.checkPythonDump(model.CHECK_NAMING) diff --git a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_4.py b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_4.py index bad6c71d7..75f1fc3d6 100644 --- a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_4.py +++ b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_4.py @@ -26,59 +26,176 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) model.end() DISTANCE = 10 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 model.begin() -Translation_3 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True) +Translation_3 = model.addTranslation( + Part_1_doc, + [model.selection("VERTEX", "Vertex_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=DISTANCE, + keepSubResults=True, +) model.testNbResults(Translation_3, 1) model.testNbSubResults(Translation_3, [0]) model.testNbSubShapes(Translation_3, GeomAPI_Shape.SOLID, [0]) @@ -90,9 +207,15 @@ model.testResultsAreas(Translation_3, [0]) refPoint = Vertex_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE) midPoint = Translation_3.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Translation_4 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True) +Translation_4 = model.addTranslation( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=DISTANCE, + keepSubResults=True, +) model.testNbResults(Translation_4, 1) model.testNbSubResults(Translation_4, [0]) model.testNbSubShapes(Translation_4, GeomAPI_Shape.SOLID, [0]) @@ -104,9 +227,15 @@ model.testResultsAreas(Translation_4, [0]) refPoint = Edge_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE) midPoint = Translation_4.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Translation_5 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True) +Translation_5 = model.addTranslation( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=DISTANCE, + keepSubResults=True, +) model.testNbResults(Translation_5, 1) model.testNbSubResults(Translation_5, [0]) model.testNbSubShapes(Translation_5, GeomAPI_Shape.SOLID, [0]) @@ -118,9 +247,15 @@ model.testResultsAreas(Translation_5, [0]) refPoint = Wire_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE) midPoint = Translation_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Translation_6 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True) +Translation_6 = model.addTranslation( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=DISTANCE, + keepSubResults=True, +) model.testNbResults(Translation_6, 1) model.testNbSubResults(Translation_6, [0]) model.testNbSubShapes(Translation_6, GeomAPI_Shape.SOLID, [0]) @@ -132,9 +267,15 @@ model.testResultsAreas(Translation_6, [109.154152964914914]) refPoint = Face_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE) midPoint = Translation_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Translation_7 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True) +Translation_7 = model.addTranslation( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=DISTANCE, + keepSubResults=True, +) model.testNbResults(Translation_7, 1) model.testNbSubResults(Translation_7, [0]) model.testNbSubShapes(Translation_7, GeomAPI_Shape.SOLID, [0]) @@ -146,9 +287,15 @@ model.testResultsAreas(Translation_7, [182.822012116]) refPoint = Shell_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE) midPoint = Translation_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Translation_8 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True) +Translation_8 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=DISTANCE, + keepSubResults=True, +) model.testNbResults(Translation_8, 1) model.testNbSubResults(Translation_8, [0]) model.testNbSubShapes(Translation_8, GeomAPI_Shape.SOLID, [1]) @@ -159,9 +306,15 @@ model.testResultsVolumes(Translation_8, [1000]) refPoint = Translation_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE) midPoint = Translation_8.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Translation_9 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True) +Translation_9 = model.addTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=DISTANCE, + keepSubResults=True, +) model.testNbResults(Translation_9, 1) model.testNbSubResults(Translation_9, [3]) model.testNbSubShapes(Translation_9, GeomAPI_Shape.SOLID, [3]) @@ -172,9 +325,15 @@ model.testResultsVolumes(Translation_9, [1589.0486226]) refPoint = Partition_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE) midPoint = Translation_9.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE -Translation_10 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True) +Translation_10 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "AngularCopy_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=DISTANCE, + keepSubResults=True, +) model.testNbResults(Translation_10, 1) model.testNbSubResults(Translation_10, [3]) model.testNbSubShapes(Translation_10, GeomAPI_Shape.SOLID, [3]) @@ -185,8 +344,8 @@ model.testResultsVolumes(Translation_10, [3000]) refPoint = AngularCopy_1.defaultResult().shape().middlePoint() refPoint.setZ(refPoint.z() + DISTANCE) midPoint = Translation_10.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +assert midPoint.distance(refPoint) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_5.py b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_5.py index 56236788a..633e3cca8 100644 --- a/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_5.py +++ b/src/FeaturesPlugin/Test/TestTranslation_MultiLevelCompound_v95_5.py @@ -26,64 +26,185 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031) -SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117) -SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547) -SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154) -SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154) -SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 44.29784155360136, + 17.09942588468031, + 47.1668727423061, + 12.27945348765633, + 45.38299232715926, + 22.60269052200972, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117 +) +SketchLine_2 = Sketch_1.addLine( + 39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547 +) +SketchLine_4 = Sketch_1.addLine( + 15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154 +) +SketchLine_5 = Sketch_1.addLine( + 15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154 +) +SketchLine_6 = Sketch_1.addLine( + 28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371) -SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362) -SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362) -SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371 +) +SketchLine_8 = Sketch_1.addLine( + -28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362 +) +SketchLine_9 = Sketch_1.addLine( + -28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362 +) +SketchLine_10 = Sketch_1.addLine( + -10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) +SketchLine_11 = Sketch_1.addLine( + -17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_7.result() +) model.do() -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")]) +Vertex_1 = model.addVertex( + Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False +) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Wire_1 = model.addWire( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SketchLine_2"), + ], + False, +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r", + ) + ], +) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r", + ), + ], +) 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) +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) -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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True) +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", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], + keepSubResults=True, +) 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/OY"), 50) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3) -Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")] +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OY"), + 50, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 30, + 3, +) +Compound_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("EDGE", "Edge_1_1"), + model.selection("WIRE", "Wire_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("SHELL", "Shell_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("COMPSOLID", "Partition_1_1"), + model.selection("COMPOUND", "AngularCopy_1_1"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) model.end() # collect reference data DISTANCE = 10 REFERENCE = [] -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 for ind in range(0, Compound_1.result().numberOfSubs()): p = Compound_1.result().subResult(ind).resultSubShapePair()[1].middlePoint() REFERENCE.append(p) + def assertResult(theFeature, theNbMoved): model.testNbResults(theFeature, 1) model.testNbSubResults(theFeature, [8]) @@ -97,35 +218,93 @@ def assertResult(theFeature, theNbMoved): ref = GeomAPI_Pnt(REFERENCE[ind].x(), REFERENCE[ind].y(), REFERENCE[ind].z()) if ind < theNbMoved: ref.setZ(ref.z() + DISTANCE) - midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint() - assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z()) + midPoint = ( + theFeature.result() + .subResult(ind) + .resultSubShapePair()[0] + .shape() + .middlePoint() + ) + assert ( + midPoint.distance(ref) < TOLERANCE + ), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format( + ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z() + ) model.begin() -Translation_3 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Compound_1_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True) +Translation_3 = model.addTranslation( + Part_1_doc, + [model.selection("VERTEX", "Compound_1_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=DISTANCE, + keepSubResults=True, +) assertResult(Translation_3, 1) -Translation_4 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Translation_3_1_2")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True) +Translation_4 = model.addTranslation( + Part_1_doc, + [model.selection("EDGE", "Translation_3_1_2")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=DISTANCE, + keepSubResults=True, +) assertResult(Translation_4, 2) -Translation_5 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Translation_4_1_3")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True) +Translation_5 = model.addTranslation( + Part_1_doc, + [model.selection("WIRE", "Translation_4_1_3")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=DISTANCE, + keepSubResults=True, +) assertResult(Translation_5, 3) -Translation_6 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Translation_5_1_4")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True) +Translation_6 = model.addTranslation( + Part_1_doc, + [model.selection("FACE", "Translation_5_1_4")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=DISTANCE, + keepSubResults=True, +) assertResult(Translation_6, 4) -Translation_7 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Translation_6_1_5")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True) +Translation_7 = model.addTranslation( + Part_1_doc, + [model.selection("SHELL", "Translation_6_1_5")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=DISTANCE, + keepSubResults=True, +) assertResult(Translation_7, 5) -Translation_8 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_7_1_6")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True) +Translation_8 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Translation_7_1_6")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=DISTANCE, + keepSubResults=True, +) assertResult(Translation_8, 6) -Translation_9 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Translation_8_1_7")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True) +Translation_9 = model.addTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Translation_8_1_7")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=DISTANCE, + keepSubResults=True, +) assertResult(Translation_9, 7) -Translation_10 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "Translation_9_1_8")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True) +Translation_10 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "Translation_9_1_8")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=DISTANCE, + keepSubResults=True, +) assertResult(Translation_10, 8) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestTranslation_Part.py b/src/FeaturesPlugin/Test/TestTranslation_Part.py index e913af5a8..657543fbb 100644 --- a/src/FeaturesPlugin/Test/TestTranslation_Part.py +++ b/src/FeaturesPlugin/Test/TestTranslation_Part.py @@ -25,9 +25,22 @@ 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]")) +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 diff --git a/src/FeaturesPlugin/Test/TestUnion.py b/src/FeaturesPlugin/Test/TestUnion.py index 810ababae..974478b38 100644 --- a/src/FeaturesPlugin/Test/TestUnion.py +++ b/src/FeaturesPlugin/Test/TestUnion.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -33,14 +33,14 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aPartFeature = aDocument.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +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")) @@ -64,9 +64,9 @@ aCircleRadius.setValue(50) aSession.finishOperation() aSketchResult = aSketchFeature.firstResult() -#========================================================================= +# ========================================================================= # Make extrusion on sketch -#========================================================================= +# ========================================================================= # Create extrusion aSession.startOperation() anExtrusionFeature = aPart.addFeature("Extrusion") @@ -74,26 +74,27 @@ anExtrusionFeature.selectionList("base").append(aSketchResult, None) anExtrusionFeature.string("CreationMethod").setValue("BySizes") anExtrusionFeature.real("to_size").setValue(50) anExtrusionFeature.real("from_size").setValue(0) -anExtrusionFeature.real("to_offset").setValue(0) #TODO: remove -anExtrusionFeature.real("from_offset").setValue(0) #TODO: remove +anExtrusionFeature.real("to_offset").setValue(0) # TODO: remove +anExtrusionFeature.real("from_offset").setValue(0) # TODO: remove anExtrusionFeature.execute() aSession.finishOperation() anExtrusionResult = modelAPI_ResultBody(anExtrusionFeature.firstResult()) -#========================================================================= +# ========================================================================= # Make union on extrusion -#========================================================================= +# ========================================================================= aSession.startOperation() aUnionFeature = aPart.addFeature("Fuse") aUnionFeature.string("creation_method").setValue("simple") -aUnionFeature.selectionList("main_objects").append(anExtrusionResult.subResult(0), None); -aUnionFeature.selectionList("main_objects").append(anExtrusionResult.subResult(1), None); -aUnionFeature.selectionList("main_objects").append(anExtrusionResult.subResult(2), None); +aUnionFeature.selectionList("main_objects").append(anExtrusionResult.subResult(0), None) +aUnionFeature.selectionList("main_objects").append(anExtrusionResult.subResult(1), None) +aUnionFeature.selectionList("main_objects").append(anExtrusionResult.subResult(2), None) aUnionFeature.boolean("remove_intersection_edges").setValue(False) aSession.finishOperation() -assert (len(aUnionFeature.results()) > 0) +assert len(aUnionFeature.results()) > 0 anUnionResult = modelAPI_ResultBody(aUnionFeature.firstResult()) -assert (anUnionResult.numberOfSubs() == 0) +assert anUnionResult.numberOfSubs() == 0 from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestUnion4CurvedFaces.py b/src/FeaturesPlugin/Test/TestUnion4CurvedFaces.py index be2536c1a..ba10e5701 100644 --- a/src/FeaturesPlugin/Test/TestUnion4CurvedFaces.py +++ b/src/FeaturesPlugin/Test/TestUnion4CurvedFaces.py @@ -24,25 +24,59 @@ 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchArc_1 = Sketch_1.addArc(0, 0, 14.26163338647443, -11.82948087533604, 14.26163338647443, 11.82948087533609, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(14.26163338647443, -11.82948087533604, 14.26163338647443, 11.82948087533609) +SketchArc_1 = Sketch_1.addArc( + 0, + 0, + 14.26163338647443, + -11.82948087533604, + 14.26163338647443, + 11.82948087533609, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 14.26163338647443, -11.82948087533604, 14.26163338647443, 11.82948087533609 +) SketchLine_1.setAuxiliary(True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_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/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.addFuse(Part_1_doc, [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_2")], True) +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.addFuse( + Part_1_doc, + [ + model.selection("FACE", "Partition_1_1_1"), + model.selection("FACE", "Partition_1_1_2"), + ], + True, +) model.do() -model.checkResult(Union_1,model,1,[0],[0],[1],[4],[8]) -model.testHaveNamingSubshapes(Union_1,model,Part_1_doc) +model.checkResult(Union_1, model, 1, [0], [0], [1], [4], [8]) +model.testHaveNamingSubshapes(Union_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestUnion4CurvedFaces_2.py b/src/FeaturesPlugin/Test/TestUnion4CurvedFaces_2.py index 3e9a44b83..210378a8f 100644 --- a/src/FeaturesPlugin/Test/TestUnion4CurvedFaces_2.py +++ b/src/FeaturesPlugin/Test/TestUnion4CurvedFaces_2.py @@ -24,22 +24,56 @@ 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchArc_1 = Sketch_1.addArc(0, 0, 14.26163338647443, -11.82948087533604, 14.26163338647443, 11.82948087533609, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center()) -SketchLine_1 = Sketch_1.addLine(14.26163338647443, -11.82948087533604, 14.26163338647443, 11.82948087533609) +SketchArc_1 = Sketch_1.addArc( + 0, + 0, + 14.26163338647443, + -11.82948087533604, + 14.26163338647443, + 11.82948087533609, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchArc_1.center() +) +SketchLine_1 = Sketch_1.addLine( + 14.26163338647443, -11.82948087533604, 14.26163338647443, 11.82948087533609 +) SketchLine_1.setAuxiliary(True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_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/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_objects = [model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ"), model.selection("FACE", "PartSet/XOY"), model.selection("FACE", "Revolution_1_1")] +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OY"), + 360, + 0, +) +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_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.addFuse(Part_1_doc, Union_1_objects, True) -model.testHaveNamingSubshapes(Union_1,model,Part_1_doc) +model.testHaveNamingSubshapes(Union_1, model, Part_1_doc) model.do() model.end() diff --git a/src/FeaturesPlugin/Test/TestUnion4Faces.py b/src/FeaturesPlugin/Test/TestUnion4Faces.py index a1f325ef1..5797cadc7 100644 --- a/src/FeaturesPlugin/Test/TestUnion4Faces.py +++ b/src/FeaturesPlugin/Test/TestUnion4Faces.py @@ -24,45 +24,113 @@ 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(-44.48110465116279, 12.33139534883721, -38.60901162790698, 48.15116279069767) -SketchLine_2 = Sketch_1.addLine(-38.60901162790698, 48.15116279069767, 16.88226744186047, 78.68604651162791) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(16.88226744186047, 78.68604651162791, 48.29796511627906, 10.86337209302326) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(48.29796511627906, 10.86337209302326, 31.85610465116278, -38.16860465116279) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(31.85610465116278, -38.16860465116279, -44.48110465116279, 12.33139534883721) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.startPoint()) +SketchLine_1 = Sketch_1.addLine( + -44.48110465116279, 12.33139534883721, -38.60901162790698, 48.15116279069767 +) +SketchLine_2 = Sketch_1.addLine( + -38.60901162790698, 48.15116279069767, 16.88226744186047, 78.68604651162791 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 16.88226744186047, 78.68604651162791, 48.29796511627906, 10.86337209302326 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + 48.29796511627906, 10.86337209302326, 31.85610465116278, -38.16860465116279 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 31.85610465116278, -38.16860465116279, -44.48110465116279, 12.33139534883721 +) +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_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/SketchLine_4_EndVertex"), False) +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/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) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchLine_8 = Sketch_2.addLine(-115.5003601973775, -26.06900348999911, -106.2327558444751, 34.47934494896344) -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/SketchLine_1_StartVertex"), False) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_6.startPoint(), SketchPoint_1.result() +) +SketchLine_7 = Sketch_2.addLine( + -40.43276493886778, -56.03425756438362, -115.5003601973775, -26.06900348999911 +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchLine_8 = Sketch_2.addLine( + -115.5003601973775, -26.06900348999911, -106.2327558444751, 34.47934494896344 +) +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/SketchLine_1_StartVertex"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchPoint_2.result()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchPoint_2.result() +) model.do() -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_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_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_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.addFuse(Part_1_doc, Union_1_objects, True, keepSubResults = True) +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.addFuse(Part_1_doc, Union_1_objects, True, keepSubResults=True) model.do() -model.checkResult(Union_1,model,1,[2],[0],[2],[13],[26]) -model.testHaveNamingSubshapes(Union_1,model,Part_1_doc) +model.checkResult(Union_1, model, 1, [2], [0], [2], [13], [26]) +model.testHaveNamingSubshapes(Union_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestUnionFaces.py b/src/FeaturesPlugin/Test/TestUnionFaces.py index 46d781486..d99d28010 100644 --- a/src/FeaturesPlugin/Test/TestUnionFaces.py +++ b/src/FeaturesPlugin/Test/TestUnionFaces.py @@ -24,12 +24,26 @@ 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(-5.197255574614073, 0.1732418524871273, 67.586529314451) +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/SketchCircle_1_2")]) -Partition_1_objects = [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")]) +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() @@ -42,4 +56,4 @@ model.testNbSubShapes(Union_1, GeomAPI_Shape.FACE, [3]) model.testNbSubShapes(Union_1, GeomAPI_Shape.EDGE, [10]) model.testNbSubShapes(Union_1, GeomAPI_Shape.VERTEX, [20]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestUnionFaces_v20190506.py b/src/FeaturesPlugin/Test/TestUnionFaces_v20190506.py index 40bab5772..11096accb 100644 --- a/src/FeaturesPlugin/Test/TestUnionFaces_v20190506.py +++ b/src/FeaturesPlugin/Test/TestUnionFaces_v20190506.py @@ -24,12 +24,27 @@ 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(-5.197255574614073, 0.1732418524871273, 67.586529314451) +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/SketchCircle_1_2")]) -Partition_1_objects = [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")], keepSubResults = True) +Union_1 = model.addUnion( + Part_1_doc, + [ + model.selection("FACE", "Partition_1_1_1"), + model.selection("FACE", "Partition_1_1_2"), + ], + keepSubResults=True, +) model.do() model.end() @@ -42,4 +57,4 @@ model.testNbSubShapes(Union_1, GeomAPI_Shape.FACE, [3]) model.testNbSubShapes(Union_1, GeomAPI_Shape.EDGE, [10]) model.testNbSubShapes(Union_1, GeomAPI_Shape.VERTEX, [20]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestUnionOfUnion.py b/src/FeaturesPlugin/Test/TestUnionOfUnion.py index 1ab8c0e4a..92713b350 100644 --- a/src/FeaturesPlugin/Test/TestUnionOfUnion.py +++ b/src/FeaturesPlugin/Test/TestUnionOfUnion.py @@ -26,15 +26,33 @@ 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/Left"), 5, True) Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), 5, True) -Partition_1_objects = [model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2"), model.selection("SOLID", "Box_1_1")] +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.addFuse(Part_1_doc, [model.selection("SOLID", "Partition_1_1_3"), model.selection("SOLID", "Partition_1_1_1")], False, keepSubResults = True) -Union_2 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Fuse_1_1_2"), model.selection("SOLID", "Fuse_1_1_1")], False, keepSubResults = True) +Union_1 = model.addFuse( + Part_1_doc, + [ + model.selection("SOLID", "Partition_1_1_3"), + model.selection("SOLID", "Partition_1_1_1"), + ], + False, + keepSubResults=True, +) +Union_2 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Fuse_1_1_2"), model.selection("SOLID", "Fuse_1_1_1")], + False, + keepSubResults=True, +) model.do() model.end() from GeomAPI import GeomAPI_Shape -assert(Part_1_doc.size("Bodies") == 1) + +assert Part_1_doc.size("Bodies") == 1 model.testNbSubShapes(Union_2, GeomAPI_Shape.SOLID, [2]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestUnion_ErrorMsg.py b/src/FeaturesPlugin/Test/TestUnion_ErrorMsg.py index 2382d46bd..67a8d5741 100644 --- a/src/FeaturesPlugin/Test/TestUnion_ErrorMsg.py +++ b/src/FeaturesPlugin/Test/TestUnion_ErrorMsg.py @@ -27,10 +27,18 @@ 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) +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() != "") +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() diff --git a/src/FeaturesPlugin/Test/TestUnion_MultiLevelCompound_v0.py b/src/FeaturesPlugin/Test/TestUnion_MultiLevelCompound_v0.py index e3ecebbe7..d7b3c5ce2 100644 --- a/src/FeaturesPlugin/Test/TestUnion_MultiLevelCompound_v0.py +++ b/src/FeaturesPlugin/Test/TestUnion_MultiLevelCompound_v0.py @@ -30,23 +30,55 @@ SketchLine_1 = Sketch_1.addLine(25, -25, -25, -25) SketchLine_2 = Sketch_1.addLine(-25, -25, -25, 25) SketchLine_3 = Sketch_1.addLine(-25, 25, 25, 25) SketchLine_4 = Sketch_1.addLine(25, 25, 25, -25) -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()) +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()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 50) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), 25, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), 25, True) -SketchMultiRotation_1_objects = [SketchLine_1.result(), SketchLine_2.result(), SketchLine_3.result(), SketchLine_4.result()] -SketchMultiRotation_1 = Sketch_1.addRotation(SketchMultiRotation_1_objects, SketchAPI_Point(SketchPoint_1).coordinates(), 45, 2, True) -[SketchLine_5, SketchLine_6, SketchLine_7, SketchLine_8] = SketchMultiRotation_1.rotated() +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), 25, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), 25, True +) +SketchMultiRotation_1_objects = [ + SketchLine_1.result(), + SketchLine_2.result(), + SketchLine_3.result(), + SketchLine_4.result(), +] +SketchMultiRotation_1 = Sketch_1.addRotation( + SketchMultiRotation_1_objects, + SketchAPI_Point(SketchPoint_1).coordinates(), + 45, + 2, + True, +) +[ + SketchLine_5, + SketchLine_6, + SketchLine_7, + SketchLine_8, +] = SketchMultiRotation_1.rotated() SketchLine_8.setName("SketchLine_14") SketchLine_8.result().setName("SketchLine_14") SketchLine_7.setName("SketchLine_11") @@ -55,19 +87,55 @@ SketchLine_6.setName("SketchLine_8") SketchLine_6.result().setName("SketchLine_8") SketchCircle_1 = Sketch_1.addCircle(80, 0, 20) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 20) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_9 = SketchProjection_2.createdFeature() SketchLine_9.setName("SketchLine_9") SketchLine_9.result().setName("SketchLine_9") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_9.result()) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_9).startPoint(), SketchCircle_1.center(), 80, True) -SketchMultiRotation_2 = Sketch_1.addRotation([SketchCircle_1.results()[1]], SketchAPI_Line(SketchLine_9).startPoint(), 360, 8, True) -[SketchCircle_2, SketchCircle_3, SketchCircle_4, SketchCircle_5, SketchCircle_6, SketchCircle_7, SketchCircle_8] = SketchMultiRotation_2.rotated() +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_9.result() +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_9).startPoint(), SketchCircle_1.center(), 80, True +) +SketchMultiRotation_2 = Sketch_1.addRotation( + [SketchCircle_1.results()[1]], + SketchAPI_Line(SketchLine_9).startPoint(), + 360, + 8, + True, +) +[ + SketchCircle_2, + SketchCircle_3, + SketchCircle_4, + SketchCircle_5, + SketchCircle_6, + SketchCircle_7, + SketchCircle_8, +] = SketchMultiRotation_2.rotated() model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 50, 0) -Compound_1_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3"), model.selection("SOLID", "Extrusion_1_4"), model.selection("SOLID", "Extrusion_1_5"), model.selection("SOLID", "Extrusion_1_6"), model.selection("SOLID", "Extrusion_1_7"), model.selection("SOLID", "Extrusion_1_8"), model.selection("SOLID", "Extrusion_1_9")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 50, 0 +) +Compound_1_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + model.selection("SOLID", "Extrusion_1_4"), + model.selection("SOLID", "Extrusion_1_5"), + model.selection("SOLID", "Extrusion_1_6"), + model.selection("SOLID", "Extrusion_1_7"), + model.selection("SOLID", "Extrusion_1_8"), + model.selection("SOLID", "Extrusion_1_9"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) -Union_1_objects = [model.selection("SOLID", "Compound_1_1_1_1"), model.selection("SOLID", "Compound_1_1_1_2"), model.selection("SOLID", "Compound_1_1_1_3")] +Union_1_objects = [ + model.selection("SOLID", "Compound_1_1_1_1"), + model.selection("SOLID", "Compound_1_1_1_2"), + model.selection("SOLID", "Compound_1_1_1_3"), +] Union_1 = model.addUnion(Part_1_doc, Union_1_objects) model.testHaveNamingSubshapes(Union_1, model, Part_1_doc) @@ -84,4 +152,4 @@ model.testNbSubShapes(Union_1, GeomAPI_Shape.EDGE, [176]) model.testNbSubShapes(Union_1, GeomAPI_Shape.VERTEX, [352]) model.testResultsVolumes(Union_1, [146446.6094067262311]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/Test/TestUnion_MultiLevelCompound_v20190506.py b/src/FeaturesPlugin/Test/TestUnion_MultiLevelCompound_v20190506.py index b1f5ca942..5255fa1e2 100644 --- a/src/FeaturesPlugin/Test/TestUnion_MultiLevelCompound_v20190506.py +++ b/src/FeaturesPlugin/Test/TestUnion_MultiLevelCompound_v20190506.py @@ -30,23 +30,55 @@ SketchLine_1 = Sketch_1.addLine(25, -25, -25, -25) SketchLine_2 = Sketch_1.addLine(-25, -25, -25, 25) SketchLine_3 = Sketch_1.addLine(-25, 25, 25, 25) SketchLine_4 = Sketch_1.addLine(25, 25, 25, -25) -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()) +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()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 50) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), 25, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), 25, True) -SketchMultiRotation_1_objects = [SketchLine_1.result(), SketchLine_2.result(), SketchLine_3.result(), SketchLine_4.result()] -SketchMultiRotation_1 = Sketch_1.addRotation(SketchMultiRotation_1_objects, SketchAPI_Point(SketchPoint_1).coordinates(), 45, 2, True) -[SketchLine_5, SketchLine_6, SketchLine_7, SketchLine_8] = SketchMultiRotation_1.rotated() +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), 25, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), 25, True +) +SketchMultiRotation_1_objects = [ + SketchLine_1.result(), + SketchLine_2.result(), + SketchLine_3.result(), + SketchLine_4.result(), +] +SketchMultiRotation_1 = Sketch_1.addRotation( + SketchMultiRotation_1_objects, + SketchAPI_Point(SketchPoint_1).coordinates(), + 45, + 2, + True, +) +[ + SketchLine_5, + SketchLine_6, + SketchLine_7, + SketchLine_8, +] = SketchMultiRotation_1.rotated() SketchLine_8.setName("SketchLine_14") SketchLine_8.result().setName("SketchLine_14") SketchLine_7.setName("SketchLine_11") @@ -55,20 +87,56 @@ SketchLine_6.setName("SketchLine_8") SketchLine_6.result().setName("SketchLine_8") SketchCircle_1 = Sketch_1.addCircle(80, 0, 20) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 20) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_9 = SketchProjection_2.createdFeature() SketchLine_9.setName("SketchLine_9") SketchLine_9.result().setName("SketchLine_9") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_9.result()) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_9).startPoint(), SketchCircle_1.center(), 80, True) -SketchMultiRotation_2 = Sketch_1.addRotation([SketchCircle_1.results()[1]], SketchAPI_Line(SketchLine_9).startPoint(), 360, 8, True) -[SketchCircle_2, SketchCircle_3, SketchCircle_4, SketchCircle_5, SketchCircle_6, SketchCircle_7, SketchCircle_8] = SketchMultiRotation_2.rotated() +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_9.result() +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_9).startPoint(), SketchCircle_1.center(), 80, True +) +SketchMultiRotation_2 = Sketch_1.addRotation( + [SketchCircle_1.results()[1]], + SketchAPI_Line(SketchLine_9).startPoint(), + 360, + 8, + True, +) +[ + SketchCircle_2, + SketchCircle_3, + SketchCircle_4, + SketchCircle_5, + SketchCircle_6, + SketchCircle_7, + SketchCircle_8, +] = SketchMultiRotation_2.rotated() model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 50, 0) -Compound_1_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3"), model.selection("SOLID", "Extrusion_1_4"), model.selection("SOLID", "Extrusion_1_5"), model.selection("SOLID", "Extrusion_1_6"), model.selection("SOLID", "Extrusion_1_7"), model.selection("SOLID", "Extrusion_1_8"), model.selection("SOLID", "Extrusion_1_9")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 50, 0 +) +Compound_1_objects = [ + model.selection("COMPSOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_3"), + model.selection("SOLID", "Extrusion_1_4"), + model.selection("SOLID", "Extrusion_1_5"), + model.selection("SOLID", "Extrusion_1_6"), + model.selection("SOLID", "Extrusion_1_7"), + model.selection("SOLID", "Extrusion_1_8"), + model.selection("SOLID", "Extrusion_1_9"), +] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) -Union_1_objects = [model.selection("SOLID", "Compound_1_1_1_1"), model.selection("SOLID", "Compound_1_1_1_2"), model.selection("SOLID", "Compound_1_1_1_3")] -Union_1 = model.addUnion(Part_1_doc, Union_1_objects, keepSubResults = True) +Union_1_objects = [ + model.selection("SOLID", "Compound_1_1_1_1"), + model.selection("SOLID", "Compound_1_1_1_2"), + model.selection("SOLID", "Compound_1_1_1_3"), +] +Union_1 = model.addUnion(Part_1_doc, Union_1_objects, keepSubResults=True) model.testHaveNamingSubshapes(Union_1, model, Part_1_doc) @@ -84,4 +152,4 @@ model.testNbSubShapes(Union_1, GeomAPI_Shape.EDGE, [224]) model.testNbSubShapes(Union_1, GeomAPI_Shape.VERTEX, [448]) model.testResultsVolumes(Union_1, [649101.433981]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FeaturesPlugin/doc/examples/angularcopy.py b/src/FeaturesPlugin/doc/examples/angularcopy.py index 3c6eaeceb..e0d2fae64 100644 --- a/src/FeaturesPlugin/doc/examples/angularcopy.py +++ b/src/FeaturesPlugin/doc/examples/angularcopy.py @@ -4,7 +4,19 @@ 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) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OY"), 90, 3) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OY"), + 90, + 3, +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/bool_split.py b/src/FeaturesPlugin/doc/examples/bool_split.py index 201d023c0..abe4bfbf2 100644 --- a/src/FeaturesPlugin/doc/examples/bool_split.py +++ b/src/FeaturesPlugin/doc/examples/bool_split.py @@ -5,11 +5,17 @@ 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) -Split_1 = model.addSplit(Part_1_doc, - [model.selection("SOLID", "Cylinder_1_1")], - [model.selection("SOLID", "Box_1_1")]) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + [model.selection("SOLID", "Box_1_1")], +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/chamfer1.py b/src/FeaturesPlugin/doc/examples/chamfer1.py index ed603f6c6..d7cc1f532 100644 --- a/src/FeaturesPlugin/doc/examples/chamfer1.py +++ b/src/FeaturesPlugin/doc/examples/chamfer1.py @@ -5,6 +5,8 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 20, 20, 20) -Chamfer_1 = model.addChamfer(Part_1_doc, [model.selection("FACE", "Box_1_1/Top")], True, 2, 2) +Chamfer_1 = model.addChamfer( + Part_1_doc, [model.selection("FACE", "Box_1_1/Top")], True, 2, 2 +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/chamfer2.py b/src/FeaturesPlugin/doc/examples/chamfer2.py index 387b60cb0..15e1c6b05 100644 --- a/src/FeaturesPlugin/doc/examples/chamfer2.py +++ b/src/FeaturesPlugin/doc/examples/chamfer2.py @@ -5,7 +5,12 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 20, 20, 20) -Chamfer_1_objects = [model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]")] +Chamfer_1_objects = [ + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), +] Chamfer_1 = model.addChamfer(Part_1_doc, Chamfer_1_objects, False, 2, 25) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/check_shared_faces.py b/src/FeaturesPlugin/doc/examples/check_shared_faces.py index 198027331..742743f78 100644 --- a/src/FeaturesPlugin/doc/examples/check_shared_faces.py +++ b/src/FeaturesPlugin/doc/examples/check_shared_faces.py @@ -10,12 +10,21 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Point Point_2 = model.addPoint(Part_1_doc, 20, 10, 10) ### Create Box -Box_2 = model.addBox(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]"), model.selection("VERTEX", "Point_1")) +Box_2 = model.addBox( + Part_1_doc, + model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("VERTEX", "Point_1"), +) ### Create CompSolid -CompSolid_1 = model.addCompSolid(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Box_2_1")]) +CompSolid_1 = model.addCompSolid( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Box_2_1")], +) ### Create Shared_faces -Shared_faces_1 = model.getSharedFaces(Part_1_doc, model.selection("COMPSOLID", "CompSolid_1_1"), "mygroup") +Shared_faces_1 = model.getSharedFaces( + Part_1_doc, model.selection("COMPSOLID", "CompSolid_1_1"), "mygroup" +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/common.py b/src/FeaturesPlugin/doc/examples/common.py index 86219432b..e77c779ca 100644 --- a/src/FeaturesPlugin/doc/examples/common.py +++ b/src/FeaturesPlugin/doc/examples/common.py @@ -5,11 +5,17 @@ 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) -Common_1 = model.addCommon(Part_1_doc, - [model.selection("SOLID", "Cylinder_1_1")], - [model.selection("SOLID", "Box_1_1")]) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Common_1 = model.addCommon( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + [model.selection("SOLID", "Box_1_1")], +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/copy.py b/src/FeaturesPlugin/doc/examples/copy.py index 1e81c0e66..9270a9f48 100644 --- a/src/FeaturesPlugin/doc/examples/copy.py +++ b/src/FeaturesPlugin/doc/examples/copy.py @@ -7,9 +7,22 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(7, 11, 2) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], 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().setTransparency(0.75) -Copy_1 = model.addCopy(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1/To_Face")], 2) +Copy_1 = model.addCopy( + Part_1_doc, + [ + model.selection("FACE", "Extrusion_1_1/From_Face"), + model.selection("FACE", "Extrusion_1_1/To_Face"), + ], + 2, +) Copy_1.result().setColor(0, 170, 0) Copy_1.results()[1].setColor(0, 170, 0) Copy_1.results()[2].setColor(0, 170, 0) diff --git a/src/FeaturesPlugin/doc/examples/create_bounding_box.py b/src/FeaturesPlugin/doc/examples/create_bounding_box.py index fa14ebaf2..e505c8719 100644 --- a/src/FeaturesPlugin/doc/examples/create_bounding_box.py +++ b/src/FeaturesPlugin/doc/examples/create_bounding_box.py @@ -6,7 +6,14 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() ### Create Cone -Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10) +Cone_1 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 5, + 10, +) model.do() ### Create BoundingBox diff --git a/src/FeaturesPlugin/doc/examples/create_normal_to_face_at_vertex.py b/src/FeaturesPlugin/doc/examples/create_normal_to_face_at_vertex.py index eb0071efb..92c5e6069 100644 --- a/src/FeaturesPlugin/doc/examples/create_normal_to_face_at_vertex.py +++ b/src/FeaturesPlugin/doc/examples/create_normal_to_face_at_vertex.py @@ -1,12 +1,15 @@ - from salome.shaper import model import os model.begin() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) model.do() - -Normal_1 = model.getNormal(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]")) + +Normal_1 = model.getNormal( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]"), +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/cut.py b/src/FeaturesPlugin/doc/examples/cut.py index 394090ede..2523bf2d3 100644 --- a/src/FeaturesPlugin/doc/examples/cut.py +++ b/src/FeaturesPlugin/doc/examples/cut.py @@ -5,11 +5,17 @@ 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) -Cut_1 = model.addCut(Part_1_doc, - [model.selection("SOLID", "Cylinder_1_1")], - [model.selection("SOLID", "Box_1_1")]) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + [model.selection("SOLID", "Box_1_1")], +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/defeaturing.py b/src/FeaturesPlugin/doc/examples/defeaturing.py index 0dc1f52f8..ba5a2355f 100644 --- a/src/FeaturesPlugin/doc/examples/defeaturing.py +++ b/src/FeaturesPlugin/doc/examples/defeaturing.py @@ -5,8 +5,21 @@ 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_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")] +Fillet_1_objects = [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), +] Fillet_1 = model.addFillet(Part_1_doc, Fillet_1_objects, 2) -Defeaturing_1 = model.addDefeaturing(Part_1_doc, [model.selection("FACE", "Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_3"), model.selection("FACE", "(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_1)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_2)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_3)")]) +Defeaturing_1 = model.addDefeaturing( + Part_1_doc, + [ + model.selection("FACE", "Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_3"), + model.selection( + "FACE", + "(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_1)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_2)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_3)", + ), + ], +) model.end() diff --git a/src/FeaturesPlugin/doc/examples/extrusion_by_bounding_planes.py b/src/FeaturesPlugin/doc/examples/extrusion_by_bounding_planes.py index 72b53730f..0f55d8499 100644 --- a/src/FeaturesPlugin/doc/examples/extrusion_by_bounding_planes.py +++ b/src/FeaturesPlugin/doc/examples/extrusion_by_bounding_planes.py @@ -7,20 +7,26 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 50) model.do() -Plane_4 = model.addPlane(Part_1_doc, - model.selection("FACE", "PartSet/XOY"), - model.selection("EDGE", "PartSet/OX"), - 45) -Plane_5 = model.addPlane(Part_1_doc, - model.selection("FACE", "PartSet/XOY"), - model.selection("EDGE", "PartSet/OX"), - 315) -Extrusion_1 = model.addExtrusion(Part_1_doc, - [model.selection("COMPOUND", "Sketch_1")], - model.selection(), - model.selection("FACE", "Plane_2"), - 50, - model.selection("FACE", "Plane_1"), - 50) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOY"), + model.selection("EDGE", "PartSet/OX"), + 45, +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOY"), + model.selection("EDGE", "PartSet/OX"), + 315, +) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + model.selection("FACE", "Plane_2"), + 50, + model.selection("FACE", "Plane_1"), + 50, +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/extrusion_by_sizes.py b/src/FeaturesPlugin/doc/examples/extrusion_by_sizes.py index 3918416dc..00cd989dc 100644 --- a/src/FeaturesPlugin/doc/examples/extrusion_by_sizes.py +++ b/src/FeaturesPlugin/doc/examples/extrusion_by_sizes.py @@ -7,10 +7,8 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 25) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, - [model.selection("COMPOUND", "Sketch_1")], - model.selection(), - 50, - 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 50, 0 +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/extrusion_cut_by_bounding_planes.py b/src/FeaturesPlugin/doc/examples/extrusion_cut_by_bounding_planes.py index 1f7db4730..6e35192ec 100644 --- a/src/FeaturesPlugin/doc/examples/extrusion_cut_by_bounding_planes.py +++ b/src/FeaturesPlugin/doc/examples/extrusion_cut_by_bounding_planes.py @@ -5,14 +5,16 @@ 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(), - model.selection("FACE", "Box_1_1/Bottom"), - 0, - model.selection("FACE", "Box_1_1/Top"), - 0, - [model.selection("SOLID", "Box_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [], + model.selection(), + model.selection("FACE", "Box_1_1/Bottom"), + 0, + model.selection("FACE", "Box_1_1/Top"), + 0, + [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(5, 0, 2) ExtrusionCut_1.setNestedSketch(Sketch_1) diff --git a/src/FeaturesPlugin/doc/examples/extrusion_cut_by_sizes.py b/src/FeaturesPlugin/doc/examples/extrusion_cut_by_sizes.py index f653c4a17..495adbce8 100644 --- a/src/FeaturesPlugin/doc/examples/extrusion_cut_by_sizes.py +++ b/src/FeaturesPlugin/doc/examples/extrusion_cut_by_sizes.py @@ -5,14 +5,10 @@ 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, - 5, - [model.selection("SOLID", "Box_1_1")]) -Sketch_1 = model.addSketch(Part_1_doc, - model.selection("FACE", "Box_1_1/Top")) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, [], model.selection(), 0, 5, [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(5, 0, 2) ExtrusionCut_1.setNestedSketch(Sketch_1) model.do() diff --git a/src/FeaturesPlugin/doc/examples/extrusion_cut_through_all.py b/src/FeaturesPlugin/doc/examples/extrusion_cut_through_all.py index d9f380b79..ad297a911 100644 --- a/src/FeaturesPlugin/doc/examples/extrusion_cut_through_all.py +++ b/src/FeaturesPlugin/doc/examples/extrusion_cut_through_all.py @@ -5,12 +5,10 @@ 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(), - [model.selection("SOLID", "Box_1_1")]) -Sketch_1 = model.addSketch(Part_1_doc, - model.selection("FACE", "Box_1_1/Top")) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, [], model.selection(), [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(5, 0, 2) ExtrusionCut_1.setNestedSketch(Sketch_1) model.do() diff --git a/src/FeaturesPlugin/doc/examples/extrusion_fuse_by_bounding_planes.py b/src/FeaturesPlugin/doc/examples/extrusion_fuse_by_bounding_planes.py index 8e69da18b..3ed2db81f 100644 --- a/src/FeaturesPlugin/doc/examples/extrusion_fuse_by_bounding_planes.py +++ b/src/FeaturesPlugin/doc/examples/extrusion_fuse_by_bounding_planes.py @@ -5,14 +5,16 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, - [], - model.selection(), - model.selection("FACE", "Box_1_1/Bottom"), - 0, - model.selection("FACE", "Box_1_1/Top"), - 0, - [model.selection("SOLID", "Box_1_1")]) +ExtrusionFuse_1 = model.addExtrusionFuse( + Part_1_doc, + [], + model.selection(), + model.selection("FACE", "Box_1_1/Bottom"), + 0, + model.selection("FACE", "Box_1_1/Top"), + 0, + [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(5, 0, 2) ExtrusionFuse_1.setNestedSketch(Sketch_1) diff --git a/src/FeaturesPlugin/doc/examples/extrusion_fuse_by_sizes.py b/src/FeaturesPlugin/doc/examples/extrusion_fuse_by_sizes.py index 504d1db80..d34f0ea55 100644 --- a/src/FeaturesPlugin/doc/examples/extrusion_fuse_by_sizes.py +++ b/src/FeaturesPlugin/doc/examples/extrusion_fuse_by_sizes.py @@ -5,14 +5,10 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, - [], - model.selection(), - 0, - 5, - [model.selection("SOLID", "Box_1_1")]) -Sketch_1 = model.addSketch(Part_1_doc, - model.selection("FACE", "Box_1_1/Top")) +ExtrusionFuse_1 = model.addExtrusionFuse( + Part_1_doc, [], model.selection(), 0, 5, [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(5, 0, 2) ExtrusionFuse_1.setNestedSketch(Sketch_1) model.do() diff --git a/src/FeaturesPlugin/doc/examples/extrusion_fuse_through_all.py b/src/FeaturesPlugin/doc/examples/extrusion_fuse_through_all.py index f64d43354..f5b2d27d7 100644 --- a/src/FeaturesPlugin/doc/examples/extrusion_fuse_through_all.py +++ b/src/FeaturesPlugin/doc/examples/extrusion_fuse_through_all.py @@ -9,28 +9,42 @@ 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) Box_3 = model.addBox(Part_1_doc, 20, 20, 20) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], 20, 10, 0) -Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], 40, 20, 0) -ExtrusionFuse_1_objects_2 = [model.selection("SOLID", "Box_1_1"), - model.selection("SOLID", "Translation_1_1"), - model.selection("SOLID", "Translation_2_1")] +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_2_1")], 20, 10, 0 +) +Translation_2 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_3_1")], 40, 20, 0 +) +ExtrusionFuse_1_objects_2 = [ + model.selection("SOLID", "Box_1_1"), + model.selection("SOLID", "Translation_1_1"), + model.selection("SOLID", "Translation_2_1"), +] # Extrusion direction Point_1 = model.addPoint(Part_1_doc, 0, 0, 0) Point_2 = model.addPoint(Part_1_doc, 60, 40, 20) -Edge_1 = model.addEdge(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")) +Edge_1 = model.addEdge( + Part_1_doc, + model.selection("VERTEX", "Point_1"), + model.selection("VERTEX", "Point_2"), +) # Base object for extrusion Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Back")) SketchCircle_1 = Sketch_1.addCircle(2.13, -2.43, 1.6) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")]) +Face_1 = model.addFace( + Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")] +) # Extrusion fuse through all -ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, - [model.selection("FACE", "Face_1_1")], - model.selection("EDGE", "Edge_1_1"), - ExtrusionFuse_1_objects_2) +ExtrusionFuse_1 = model.addExtrusionFuse( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("EDGE", "Edge_1_1"), + ExtrusionFuse_1_objects_2, +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/fillet1.py b/src/FeaturesPlugin/doc/examples/fillet1.py index 83aa468c9..c0782e002 100644 --- a/src/FeaturesPlugin/doc/examples/fillet1.py +++ b/src/FeaturesPlugin/doc/examples/fillet1.py @@ -5,7 +5,11 @@ 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_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]")] +Fillet_1_objects = [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), +] Fillet_1 = model.addFillet(Part_1_doc, Fillet_1_objects, 2) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/fillet1d_vertices.py b/src/FeaturesPlugin/doc/examples/fillet1d_vertices.py index d2a0cbe5a..9a959e285 100644 --- a/src/FeaturesPlugin/doc/examples/fillet1d_vertices.py +++ b/src/FeaturesPlugin/doc/examples/fillet1d_vertices.py @@ -11,15 +11,19 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Wire -Wire_1_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), - model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), - model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), - model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]")] +Wire_1_objects = [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) ### Create Fillet1D -Fillet1D_1_objects = [model.selection("VERTEX", "[Wire_1_1/Edge_2]e[Wire_1_1/Edge_3]e"), - model.selection("VERTEX", "[Wire_1_1/Edge_3]e[Wire_1_1/Edge_4]e")] +Fillet1D_1_objects = [ + model.selection("VERTEX", "[Wire_1_1/Edge_2]e[Wire_1_1/Edge_3]e"), + model.selection("VERTEX", "[Wire_1_1/Edge_3]e[Wire_1_1/Edge_4]e"), +] Fillet1D_1 = model.addFillet(Part_1_doc, Fillet1D_1_objects, 3) model.end() diff --git a/src/FeaturesPlugin/doc/examples/fillet1d_wire.py b/src/FeaturesPlugin/doc/examples/fillet1d_wire.py index 36ccfc975..5414e0ce2 100644 --- a/src/FeaturesPlugin/doc/examples/fillet1d_wire.py +++ b/src/FeaturesPlugin/doc/examples/fillet1d_wire.py @@ -11,10 +11,12 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Wire -Wire_1_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), - model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), - model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), - model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]")] +Wire_1_objects = [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) ### Create Fillet1D diff --git a/src/FeaturesPlugin/doc/examples/fillet2.py b/src/FeaturesPlugin/doc/examples/fillet2.py index befe704ce..5a4a102ab 100644 --- a/src/FeaturesPlugin/doc/examples/fillet2.py +++ b/src/FeaturesPlugin/doc/examples/fillet2.py @@ -5,6 +5,8 @@ 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", "[Box_1_1/Front][Box_1_1/Top]")], 1, 3) +Fillet_1 = model.addFillet( + Part_1_doc, [model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")], 1, 3 +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/fuse.py b/src/FeaturesPlugin/doc/examples/fuse.py index 746a5d3cd..4961156bb 100644 --- a/src/FeaturesPlugin/doc/examples/fuse.py +++ b/src/FeaturesPlugin/doc/examples/fuse.py @@ -5,11 +5,17 @@ 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) -Fuse_1 = model.addFuse(Part_1_doc, - [model.selection("SOLID", "Cylinder_1_1")], - [model.selection("SOLID", "Box_1_1")]) +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("SOLID", "Box_1_1")], +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/fuse_faces.py b/src/FeaturesPlugin/doc/examples/fuse_faces.py index 62a971ddc..1b0d3b89b 100644 --- a/src/FeaturesPlugin/doc/examples/fuse_faces.py +++ b/src/FeaturesPlugin/doc/examples/fuse_faces.py @@ -7,33 +7,86 @@ partSet = model.moduleDocument() 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, 75.67806267806267, 34.24216524216526, 75.67806267806267) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchLine_1 = Sketch_1.addLine( + 0, 75.67806267806267, 34.24216524216526, 75.67806267806267 +) +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(34.24216524216526, 75.67806267806267, 34.24216524216526, 46.03988603988604) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(34.24216524216526, 46.03988603988604, 63.30484330484332, 46.03988603988604) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(63.30484330484332, 46.03988603988604, 63.30484330484332, -2.775557561562891e-17) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) +SketchLine_3 = Sketch_1.addLine( + 34.24216524216526, 75.67806267806267, 34.24216524216526, 46.03988603988604 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + 34.24216524216526, 46.03988603988604, 63.30484330484332, 46.03988603988604 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 63.30484330484332, 46.03988603988604, 63.30484330484332, -2.775557561562891e-17 +) +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()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.result() +) SketchLine_7 = Sketch_1.addLine(63.30484330484332, -2.775557561562891e-17, 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()) +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, 75.67806267806267, 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()) +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_3.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_8f-SketchLine_7r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r_wire")], model.selection(), 50, 0) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 0, 50) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "WIRE", + "Sketch_1/Face-SketchLine_8f-SketchLine_7r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r_wire", + ) + ], + model.selection(), + 50, + 0, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection(), + 0, + 50, +) +Fuse_1 = model.addFuse( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_2_1"), + ], +) FusionFaces_1 = model.addFusionFaces(Part_1_doc, model.selection("SOLID", "Fuse_1_1")) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/geometry_calculation.py b/src/FeaturesPlugin/doc/examples/geometry_calculation.py index 2562da94d..ac94538ac 100644 --- a/src/FeaturesPlugin/doc/examples/geometry_calculation.py +++ b/src/FeaturesPlugin/doc/examples/geometry_calculation.py @@ -6,8 +6,10 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -properties = model.getGeometryCalculation(Part_1_doc,model.selection("SOLID", "Box_1_1")) +properties = model.getGeometryCalculation( + Part_1_doc, model.selection("SOLID", "Box_1_1") +) print(" length: ", properties[0]) print(" area: ", properties[1]) print(" volume: ", properties[2]) -model.end() \ No newline at end of file +model.end() diff --git a/src/FeaturesPlugin/doc/examples/glue_faces.py b/src/FeaturesPlugin/doc/examples/glue_faces.py index 06a3f0573..1f3922491 100644 --- a/src/FeaturesPlugin/doc/examples/glue_faces.py +++ b/src/FeaturesPlugin/doc/examples/glue_faces.py @@ -6,8 +6,19 @@ 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, 20, 10, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], axis = model.selection("EDGE", "PartSet/OX"), distance = 10, keepSubResults = True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_2_1")], + axis=model.selection("EDGE", "PartSet/OX"), + distance=10, + keepSubResults=True, +) model.do() -GlueFaces_1 = model.addGlueFaces(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1")], 1.0e-7, True) +GlueFaces_1 = model.addGlueFaces( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1")], + 1.0e-7, + True, +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/import_result.py b/src/FeaturesPlugin/doc/examples/import_result.py index b0293b44d..2e103c1a6 100644 --- a/src/FeaturesPlugin/doc/examples/import_result.py +++ b/src/FeaturesPlugin/doc/examples/import_result.py @@ -7,9 +7,17 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(21, 16, 6) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], + model.selection(), + 10, + 0, +) model.do() Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() -ImportResult_1 = model.addImportResult(Part_2_doc, [model.selection("SOLID", "Part_1/Extrusion_1_1")]) +ImportResult_1 = model.addImportResult( + Part_2_doc, [model.selection("SOLID", "Part_1/Extrusion_1_1")] +) model.end() diff --git a/src/FeaturesPlugin/doc/examples/intersection.py b/src/FeaturesPlugin/doc/examples/intersection.py index d7a966643..5e5ec4aff 100644 --- a/src/FeaturesPlugin/doc/examples/intersection.py +++ b/src/FeaturesPlugin/doc/examples/intersection.py @@ -5,11 +5,16 @@ 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) -Intersection_1 = model.addIntersection(Part_1_doc, - [model.selection("SOLID", "Cylinder_1_1"), - model.selection("SOLID", "Box_1_1")]) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Intersection_1 = model.addIntersection( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1"), model.selection("SOLID", "Box_1_1")], +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/limit_tolerance.py b/src/FeaturesPlugin/doc/examples/limit_tolerance.py index c0fd60584..aac4820f6 100644 --- a/src/FeaturesPlugin/doc/examples/limit_tolerance.py +++ b/src/FeaturesPlugin/doc/examples/limit_tolerance.py @@ -14,34 +14,54 @@ model.do() # => partition results in a compound with 2 vertices Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_1")]) Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_2")]) -Partition_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_2_1")] -Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults = True) +Partition_1_objects = [ + model.selection("VERTEX", "Vertex_1_1"), + model.selection("VERTEX", "Vertex_2_1"), +] +Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults=True) model.do() # Create a boolean fusion between two vertices with default tolerance: # => fusion results in a compound with 2 vertices Vertex_3 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_1")]) Vertex_4 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_2")]) -Fuse_1_objects = [model.selection("VERTEX", "Vertex_3_1"), model.selection("VERTEX", "Vertex_4_1")] -Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects, True, keepSubResults = True) +Fuse_1_objects = [ + model.selection("VERTEX", "Vertex_3_1"), + model.selection("VERTEX", "Vertex_4_1"), +] +Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects, True, keepSubResults=True) model.do() # Create a partition between two vertices with higher tolerance: # => partition results in a single vertex Vertex_5 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_1")]) Vertex_6 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_2")]) -LimitTolerance_1 = model.addLimitTolerance(Part_1_doc, model.selection("VERTEX", "Vertex_5_1"), 0.6) -LimitTolerance_2 = model.addLimitTolerance(Part_1_doc, model.selection("VERTEX", "Vertex_6_1"), 0.6) -Partition_2_objects = [model.selection("VERTEX", "LimitTolerance_1_1"), model.selection("VERTEX", "LimitTolerance_2_1")] -Partition_2 = model.addPartition(Part_1_doc, Partition_2_objects, keepSubResults = True) +LimitTolerance_1 = model.addLimitTolerance( + Part_1_doc, model.selection("VERTEX", "Vertex_5_1"), 0.6 +) +LimitTolerance_2 = model.addLimitTolerance( + Part_1_doc, model.selection("VERTEX", "Vertex_6_1"), 0.6 +) +Partition_2_objects = [ + model.selection("VERTEX", "LimitTolerance_1_1"), + model.selection("VERTEX", "LimitTolerance_2_1"), +] +Partition_2 = model.addPartition(Part_1_doc, Partition_2_objects, keepSubResults=True) model.do() # Create a boolean fusion between two vertices with higher tolerance: # => fusion results in a single vertex Vertex_7 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_1")]) Vertex_8 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_2")]) -LimitTolerance_3 = model.addLimitTolerance(Part_1_doc, model.selection("VERTEX", "Vertex_7_1"), 0.6) -LimitTolerance_4 = model.addLimitTolerance(Part_1_doc, model.selection("VERTEX", "Vertex_8_1"), 0.6) -Fuse_2_objects = [model.selection("VERTEX", "LimitTolerance_3_1"), model.selection("VERTEX", "LimitTolerance_4_1")] -Fuse_2 = model.addFuse(Part_1_doc, Fuse_2_objects, True, keepSubResults = True) +LimitTolerance_3 = model.addLimitTolerance( + Part_1_doc, model.selection("VERTEX", "Vertex_7_1"), 0.6 +) +LimitTolerance_4 = model.addLimitTolerance( + Part_1_doc, model.selection("VERTEX", "Vertex_8_1"), 0.6 +) +Fuse_2_objects = [ + model.selection("VERTEX", "LimitTolerance_3_1"), + model.selection("VERTEX", "LimitTolerance_4_1"), +] +Fuse_2 = model.addFuse(Part_1_doc, Fuse_2_objects, True, keepSubResults=True) model.end() diff --git a/src/FeaturesPlugin/doc/examples/linearcopy.py b/src/FeaturesPlugin/doc/examples/linearcopy.py index 954d9d67d..b1a3b7659 100644 --- a/src/FeaturesPlugin/doc/examples/linearcopy.py +++ b/src/FeaturesPlugin/doc/examples/linearcopy.py @@ -5,6 +5,15 @@ 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) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Sphere_1_1")], model.selection("EDGE", "PartSet/OX"), 30, 3, model.selection("EDGE", "PartSet/OY"), 30, 2) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Sphere_1_1")], + model.selection("EDGE", "PartSet/OX"), + 30, + 3, + model.selection("EDGE", "PartSet/OY"), + 30, + 2, +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/loft.py b/src/FeaturesPlugin/doc/examples/loft.py index f3f9dfebe..cbae544f2 100644 --- a/src/FeaturesPlugin/doc/examples/loft.py +++ b/src/FeaturesPlugin/doc/examples/loft.py @@ -13,16 +13,24 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) ### Create SketchLine -SketchLine_1 = Sketch_1.addLine(65.56914119359536, 34.84279475982533, -62.33478893740904, 34.84279475982533) +SketchLine_1 = Sketch_1.addLine( + 65.56914119359536, 34.84279475982533, -62.33478893740904, 34.84279475982533 +) ### Create SketchLine -SketchLine_2 = Sketch_1.addLine(-62.33478893740904, 34.84279475982533, -62.33478893740904, -28.08005822416302) +SketchLine_2 = Sketch_1.addLine( + -62.33478893740904, 34.84279475982533, -62.33478893740904, -28.08005822416302 +) ### Create SketchLine -SketchLine_3 = Sketch_1.addLine(-62.33478893740904, -28.08005822416302, 65.56914119359536, -28.08005822416302) +SketchLine_3 = Sketch_1.addLine( + -62.33478893740904, -28.08005822416302, 65.56914119359536, -28.08005822416302 +) ### Create SketchLine -SketchLine_4 = Sketch_1.addLine(65.56914119359536, -28.08005822416302, 65.56914119359536, 34.84279475982533) +SketchLine_4 = Sketch_1.addLine( + 65.56914119359536, -28.08005822416302, 65.56914119359536, 34.84279475982533 +) Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) @@ -34,12 +42,26 @@ Sketch_1.setVertical(SketchLine_4.result()) model.do() ### Create Plane -Plane_1 = model.addPlane(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("VERTEX", "Sketch_1/SketchLine_3_StartVertex"), False) +Plane_1 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "Sketch_1/SketchLine_4"), + model.selection("VERTEX", "Sketch_1/SketchLine_3_StartVertex"), + False, +) ### Create Plane -Plane_2 = model.addPlane(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f"), 100, False) +Plane_2 = model.addPlane( + Part_1_doc, + model.selection( + "FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f" + ), + 100, + False, +) ### Create Loft -Loft_1 = model.addLoft(Part_1_doc, model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")) +Loft_1 = model.addLoft( + Part_1_doc, model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2") +) model.end() diff --git a/src/FeaturesPlugin/doc/examples/partition.py b/src/FeaturesPlugin/doc/examples/partition.py index df1e41253..1ac8d977f 100644 --- a/src/FeaturesPlugin/doc/examples/partition.py +++ b/src/FeaturesPlugin/doc/examples/partition.py @@ -5,10 +5,16 @@ 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("SOLID", "Cylinder_1_1"), model.selection("SOLID", "Box_1_1")]) +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("SOLID", "Box_1_1")], +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/pipe_binormal.py b/src/FeaturesPlugin/doc/examples/pipe_binormal.py index 1eba97bbb..cef43df66 100644 --- a/src/FeaturesPlugin/doc/examples/pipe_binormal.py +++ b/src/FeaturesPlugin/doc/examples/pipe_binormal.py @@ -5,14 +5,30 @@ partSet = model.moduleDocument() 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(72.2418524871355, 29.96679215537161, -69.82505995666611, 29.96679215537161) -SketchLine_2 = Sketch_1.addLine(-69.82505995666611, 29.96679215537161, -69.82505995666611, -40.02291624943114) -SketchLine_3 = Sketch_1.addLine(-69.82505995666611, -40.02291624943114, 72.2418524871355, -40.02291624943114) -SketchLine_4 = Sketch_1.addLine(72.2418524871355, -40.02291624943114, 72.2418524871355, 29.96679215537161) -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()) +SketchLine_1 = Sketch_1.addLine( + 72.2418524871355, 29.96679215537161, -69.82505995666611, 29.96679215537161 +) +SketchLine_2 = Sketch_1.addLine( + -69.82505995666611, 29.96679215537161, -69.82505995666611, -40.02291624943114 +) +SketchLine_3 = Sketch_1.addLine( + -69.82505995666611, -40.02291624943114, 72.2418524871355, -40.02291624943114 +) +SketchLine_4 = Sketch_1.addLine( + 72.2418524871355, -40.02291624943114, 72.2418524871355, 29.96679215537161 +) +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()) @@ -20,8 +36,24 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) model.do() Point_2 = model.addPoint(Part_1_doc, 0, 100, 40) Point_3 = model.addPoint(Part_1_doc, 0, 260, 60) -Interpolation_1_objects = [model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")] -Interpolation_1 = model.addInterpolation(Part_1_doc, Interpolation_1_objects, False, False) -Pipe_1 = model.addPipe(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection("EDGE", "Interpolation_1_1"), model.selection("EDGE", "PartSet/OX")) +Interpolation_1_objects = [ + model.selection("VERTEX", "PartSet/Origin"), + model.selection("VERTEX", "Point_1"), + model.selection("VERTEX", "Point_2"), +] +Interpolation_1 = model.addInterpolation( + Part_1_doc, Interpolation_1_objects, False, False +) +Pipe_1 = model.addPipe( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f", + ) + ], + model.selection("EDGE", "Interpolation_1_1"), + model.selection("EDGE", "PartSet/OX"), +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/pipe_locations.py b/src/FeaturesPlugin/doc/examples/pipe_locations.py index 23e0f666e..6d0a54ca1 100644 --- a/src/FeaturesPlugin/doc/examples/pipe_locations.py +++ b/src/FeaturesPlugin/doc/examples/pipe_locations.py @@ -10,20 +10,56 @@ Part_2_doc = Part_2.document() Plane_4 = model.addPlane(Part_2_doc, model.selection("FACE", "PartSet/YOZ"), 100, False) Plane_5 = model.addPlane(Part_2_doc, model.selection("FACE", "Plane_1"), 120, False) Sketch_1 = model.addSketch(Part_2_doc, model.standardPlane("YOZ")) -SketchCircle_1 = Sketch_1.addCircle(-17.96171526586622, -340.274716981132, 71.31826129521251) +SketchCircle_1 = Sketch_1.addCircle( + -17.96171526586622, -340.274716981132, 71.31826129521251 +) model.do() Sketch_2 = model.addSketch(Part_2_doc, model.selection("FACE", "Plane_1")) -SketchCircle_2 = Sketch_2.addCircle(46.42844892447576, -229.9982953588847, 114.4484521366094) +SketchCircle_2 = Sketch_2.addCircle( + 46.42844892447576, -229.9982953588847, 114.4484521366094 +) model.do() Sketch_3 = model.addSketch(Part_2_doc, model.selection("FACE", "Plane_2")) -SketchCircle_3 = Sketch_3.addCircle(121.2811188302094, -19.85285601110755, 120.5601403551194) +SketchCircle_3 = Sketch_3.addCircle( + 121.2811188302094, -19.85285601110755, 120.5601403551194 +) model.do() -Interpolation_1_objects = [model.selection("VERTEX", "Sketch_1/SketchCircle_1"), model.selection("VERTEX", "Sketch_2/SketchCircle_2"), model.selection("VERTEX", "Sketch_3/SketchCircle_3")] -Interpolation_1 = model.addInterpolation(Part_2_doc, Interpolation_1_objects, False, False) -Vertex_1 = model.addVertex(Part_2_doc, [model.selection("VERTEX", "Sketch_2/SketchCircle_2")]) -Partition_1 = model.addPartition(Part_2_doc, [model.selection("EDGE", "Interpolation_1_1"), model.selection("VERTEX", "Vertex_1_1")]) -Wire_1 = model.addWire(Part_2_doc, [model.selection("EDGE", "Partition_1_1_1"), model.selection("EDGE", "Partition_1_1_2")]) -Pipe_1_objects_2 = [model.selection("VERTEX", "Interpolation_1_1/Vertex_1_1"), model.selection("VERTEX", "Vertex_1_1/Vertex_1_1&Sketch_2/SketchCircle_2"), model.selection("VERTEX", "Interpolation_1_1/Vertex_1_2")] -Pipe_1_objects_1 = [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r"), model.selection("FACE", "Sketch_3/Face-SketchCircle_3_2r")] -Pipe_1 = model.addPipe(Part_2_doc, Pipe_1_objects_1, model.selection("WIRE", "Wire_1_1"), Pipe_1_objects_2) +Interpolation_1_objects = [ + model.selection("VERTEX", "Sketch_1/SketchCircle_1"), + model.selection("VERTEX", "Sketch_2/SketchCircle_2"), + model.selection("VERTEX", "Sketch_3/SketchCircle_3"), +] +Interpolation_1 = model.addInterpolation( + Part_2_doc, Interpolation_1_objects, False, False +) +Vertex_1 = model.addVertex( + Part_2_doc, [model.selection("VERTEX", "Sketch_2/SketchCircle_2")] +) +Partition_1 = model.addPartition( + Part_2_doc, + [ + model.selection("EDGE", "Interpolation_1_1"), + model.selection("VERTEX", "Vertex_1_1"), + ], +) +Wire_1 = model.addWire( + Part_2_doc, + [ + model.selection("EDGE", "Partition_1_1_1"), + model.selection("EDGE", "Partition_1_1_2"), + ], +) +Pipe_1_objects_2 = [ + model.selection("VERTEX", "Interpolation_1_1/Vertex_1_1"), + model.selection("VERTEX", "Vertex_1_1/Vertex_1_1&Sketch_2/SketchCircle_2"), + model.selection("VERTEX", "Interpolation_1_1/Vertex_1_2"), +] +Pipe_1_objects_1 = [ + model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), + model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r"), + model.selection("FACE", "Sketch_3/Face-SketchCircle_3_2r"), +] +Pipe_1 = model.addPipe( + Part_2_doc, Pipe_1_objects_1, model.selection("WIRE", "Wire_1_1"), Pipe_1_objects_2 +) model.end() diff --git a/src/FeaturesPlugin/doc/examples/pipe_simple.py b/src/FeaturesPlugin/doc/examples/pipe_simple.py index baad1a5ed..8efcf50d9 100644 --- a/src/FeaturesPlugin/doc/examples/pipe_simple.py +++ b/src/FeaturesPlugin/doc/examples/pipe_simple.py @@ -7,21 +7,37 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 40) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 40) model.do() -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")]) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")] +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_2.addArc(30, 0, 0, 0, 40.50885209855912, 28.09918197333542, True) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_1.result(), SketchArc_1.center()) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchArc_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_1.result(), SketchArc_1.center() +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchArc_1.startPoint() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchArc_1.results()[1], 30) model.do() -Pipe_1 = model.addPipe(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "Sketch_2/SketchArc_1_2")) +Pipe_1 = model.addPipe( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "Sketch_2/SketchArc_1_2"), +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/placement.py b/src/FeaturesPlugin/doc/examples/placement.py index 7b6c8b03a..9ac3bbd5e 100644 --- a/src/FeaturesPlugin/doc/examples/placement.py +++ b/src/FeaturesPlugin/doc/examples/placement.py @@ -8,7 +8,20 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Front")) SketchCircle_1 = Sketch_1.addCircle(20, 6, 3) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), -10, 0) -Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("FACE", "Extrusion_1_1/From_Face"), model.selection("FACE", "Box_1_1/Front"), False, True) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], + model.selection(), + -10, + 0, +) +Placement_1 = model.addPlacement( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("FACE", "Extrusion_1_1/From_Face"), + model.selection("FACE", "Box_1_1/Front"), + False, + True, +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/point_coordinates.py b/src/FeaturesPlugin/doc/examples/point_coordinates.py index e8d902de6..50e84fbec 100644 --- a/src/FeaturesPlugin/doc/examples/point_coordinates.py +++ b/src/FeaturesPlugin/doc/examples/point_coordinates.py @@ -6,7 +6,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) -coordinates = model.getPointCoordinates(Part_1_doc,model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]")) +coordinates = model.getPointCoordinates( + Part_1_doc, model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]") +) print(" x: ", coordinates[0]) print(" y: ", coordinates[1]) print(" z: ", coordinates[2]) diff --git a/src/FeaturesPlugin/doc/examples/recover_compound.py b/src/FeaturesPlugin/doc/examples/recover_compound.py index 781a87167..d34df8d0b 100644 --- a/src/FeaturesPlugin/doc/examples/recover_compound.py +++ b/src/FeaturesPlugin/doc/examples/recover_compound.py @@ -5,9 +5,25 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("FACE", "Plane_1")]) -Split_2 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Split_1_1_1")], [model.selection("FACE", "Plane_2")]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + [model.selection("FACE", "Plane_1")], +) +Split_2 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Split_1_1_1")], + [model.selection("FACE", "Plane_2")], +) Recover_1 = model.addRecover(Part_1_doc, Split_2, [Split_1.result()], True) model.end() diff --git a/src/FeaturesPlugin/doc/examples/recover_default.py b/src/FeaturesPlugin/doc/examples/recover_default.py index ce6b03507..54ca3532b 100644 --- a/src/FeaturesPlugin/doc/examples/recover_default.py +++ b/src/FeaturesPlugin/doc/examples/recover_default.py @@ -5,9 +5,25 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -Split_1 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("FACE", "Plane_1")]) -Split_2 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Split_1_1_1")], [model.selection("FACE", "Plane_2")]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + [model.selection("FACE", "Plane_1")], +) +Split_2 = model.addSplit( + Part_1_doc, + [model.selection("SOLID", "Split_1_1_1")], + [model.selection("FACE", "Plane_2")], +) Recover_1 = model.addRecover(Part_1_doc, Split_2, [Split_1.result().subResult(0)]) model.end() diff --git a/src/FeaturesPlugin/doc/examples/remove_subshapes.py b/src/FeaturesPlugin/doc/examples/remove_subshapes.py index b3e118056..eb6dc62ac 100644 --- a/src/FeaturesPlugin/doc/examples/remove_subshapes.py +++ b/src/FeaturesPlugin/doc/examples/remove_subshapes.py @@ -8,13 +8,12 @@ Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(0, -25, 50) SketchCircle_2 = Sketch_1.addCircle(0, 25, 50) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, - [model.selection("COMPOUND", "Sketch_1")], - model.selection(), - 10, - 0) -Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, - model.selection("COMPSOLID", "Extrusion_1_1")) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Remove_SubShapes_1 = model.addRemoveSubShapes( + Part_1_doc, model.selection("COMPSOLID", "Extrusion_1_1") +) Remove_SubShapes_1.setSubShapesToRemove([model.selection("SOLID", "Extrusion_1_1_2")]) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/revolution_by_angles.py b/src/FeaturesPlugin/doc/examples/revolution_by_angles.py index 8460d8c56..174a6f057 100644 --- a/src/FeaturesPlugin/doc/examples/revolution_by_angles.py +++ b/src/FeaturesPlugin/doc/examples/revolution_by_angles.py @@ -7,10 +7,12 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(20, 20, 10) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, - [model.selection("COMPOUND", "Sketch_1")], - model.selection("EDGE", "PartSet/OY"), - 360, - 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection("EDGE", "PartSet/OY"), + 360, + 0, +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/revolution_by_bounding_planes.py b/src/FeaturesPlugin/doc/examples/revolution_by_bounding_planes.py index ce38a7270..d8f0e031c 100644 --- a/src/FeaturesPlugin/doc/examples/revolution_by_bounding_planes.py +++ b/src/FeaturesPlugin/doc/examples/revolution_by_bounding_planes.py @@ -7,12 +7,14 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(20, 20, 10) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, - [model.selection("COMPOUND", "Sketch_1")], - model.selection("EDGE", "PartSet/OY"), - model.selection("FACE", "PartSet/XOY"), - 0, - model.selection("FACE", "PartSet/YOZ"), - 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection("EDGE", "PartSet/OY"), + model.selection("FACE", "PartSet/XOY"), + 0, + model.selection("FACE", "PartSet/YOZ"), + 0, +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/revolution_cut_by_angles.py b/src/FeaturesPlugin/doc/examples/revolution_cut_by_angles.py index e44625be7..bee40c8c9 100644 --- a/src/FeaturesPlugin/doc/examples/revolution_cut_by_angles.py +++ b/src/FeaturesPlugin/doc/examples/revolution_cut_by_angles.py @@ -8,6 +8,13 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) SketchCircle_1 = Sketch_1.addCircle(5, 5, 2.5) model.do() -RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), 0, 90, [model.selection("SOLID", "Box_1_1")]) +RevolutionCut_1 = model.addRevolutionCut( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + 0, + 90, + [model.selection("SOLID", "Box_1_1")], +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/revolution_cut_by_bounding_planes.py b/src/FeaturesPlugin/doc/examples/revolution_cut_by_bounding_planes.py index cf8b35d0a..ef2e73048 100644 --- a/src/FeaturesPlugin/doc/examples/revolution_cut_by_bounding_planes.py +++ b/src/FeaturesPlugin/doc/examples/revolution_cut_by_bounding_planes.py @@ -8,6 +8,15 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) SketchCircle_1 = Sketch_1.addCircle(5, 5, 2.5) model.do() -RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), model.selection(), 0, model.selection("FACE", "Box_1_1/Front"), 0, [model.selection("SOLID", "Box_1_1")]) +RevolutionCut_1 = model.addRevolutionCut( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + model.selection(), + 0, + model.selection("FACE", "Box_1_1/Front"), + 0, + [model.selection("SOLID", "Box_1_1")], +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/revolution_cut_through_all.py b/src/FeaturesPlugin/doc/examples/revolution_cut_through_all.py index 508147e62..ea3287303 100644 --- a/src/FeaturesPlugin/doc/examples/revolution_cut_through_all.py +++ b/src/FeaturesPlugin/doc/examples/revolution_cut_through_all.py @@ -8,6 +8,11 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) SketchCircle_1 = Sketch_1.addCircle(5, 5, 2.5) model.do() -RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), [model.selection("SOLID", "Box_1_1")]) +RevolutionCut_1 = model.addRevolutionCut( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + [model.selection("SOLID", "Box_1_1")], +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/revolution_fuse_by_angles.py b/src/FeaturesPlugin/doc/examples/revolution_fuse_by_angles.py index 449714a3b..f2d171c55 100644 --- a/src/FeaturesPlugin/doc/examples/revolution_fuse_by_angles.py +++ b/src/FeaturesPlugin/doc/examples/revolution_fuse_by_angles.py @@ -8,6 +8,13 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) SketchCircle_1 = Sketch_1.addCircle(5, 5, 2.5) model.do() -RevolutionFuse_1 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), 90, 0, [model.selection("SOLID", "Box_1_1")]) +RevolutionFuse_1 = model.addRevolutionFuse( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + 90, + 0, + [model.selection("SOLID", "Box_1_1")], +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/revolution_fuse_by_bounding_planes.py b/src/FeaturesPlugin/doc/examples/revolution_fuse_by_bounding_planes.py index 25cc7b918..a39812882 100644 --- a/src/FeaturesPlugin/doc/examples/revolution_fuse_by_bounding_planes.py +++ b/src/FeaturesPlugin/doc/examples/revolution_fuse_by_bounding_planes.py @@ -8,6 +8,15 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) SketchCircle_1 = Sketch_1.addCircle(5, 5, 2.5) model.do() -RevolutionFuse_1 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), model.selection("FACE", "Box_1_1/Front"), 0, model.selection(), 0, [model.selection("SOLID", "Box_1_1")]) +RevolutionFuse_1 = model.addRevolutionFuse( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + model.selection("FACE", "Box_1_1/Front"), + 0, + model.selection(), + 0, + [model.selection("SOLID", "Box_1_1")], +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/revolution_fuse_through_all.py b/src/FeaturesPlugin/doc/examples/revolution_fuse_through_all.py index fad51a66c..d65f967b0 100644 --- a/src/FeaturesPlugin/doc/examples/revolution_fuse_through_all.py +++ b/src/FeaturesPlugin/doc/examples/revolution_fuse_through_all.py @@ -8,6 +8,11 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) SketchCircle_1 = Sketch_1.addCircle(5, 5, 2.5) model.do() -RevolutionFuse_1 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), [model.selection("SOLID", "Box_1_1")]) +RevolutionFuse_1 = model.addRevolutionFuse( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + [model.selection("SOLID", "Box_1_1")], +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/rotation1.py b/src/FeaturesPlugin/doc/examples/rotation1.py index 3838ed08e..3b737c840 100644 --- a/src/FeaturesPlugin/doc/examples/rotation1.py +++ b/src/FeaturesPlugin/doc/examples/rotation1.py @@ -4,7 +4,19 @@ 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) -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("COMPOUND", "all-in-Cone_1")], model.selection("EDGE", "PartSet/OX"), 120) +Cone_1 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 5, + 10, +) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Cone_1")], + model.selection("EDGE", "PartSet/OX"), + 120, +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/rotation2.py b/src/FeaturesPlugin/doc/examples/rotation2.py index 42e1b5dda..8e7b40726 100644 --- a/src/FeaturesPlugin/doc/examples/rotation2.py +++ b/src/FeaturesPlugin/doc/examples/rotation2.py @@ -4,7 +4,20 @@ 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) -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "[Cone_1_1/Face_1][Cone_1_1/Face_3]"), model.selection("VERTEX", "[Cone_1_1/Face_1][Cone_1_1/Face_2]")) +Cone_1 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 5, + 10, +) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Cone_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + model.selection("VERTEX", "[Cone_1_1/Face_1][Cone_1_1/Face_3]"), + model.selection("VERTEX", "[Cone_1_1/Face_1][Cone_1_1/Face_2]"), +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/scaleXYZ.py b/src/FeaturesPlugin/doc/examples/scaleXYZ.py index 2e77c21f8..242e35641 100644 --- a/src/FeaturesPlugin/doc/examples/scaleXYZ.py +++ b/src/FeaturesPlugin/doc/examples/scaleXYZ.py @@ -5,6 +5,13 @@ 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) -Scale_1 = model.addScale(Part_1_doc, [model.selection("SOLID", "Sphere_1_1")] , model.selection("VERTEX", "PartSet/Origin"), 2 , 3, 4) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Sphere_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + 2, + 3, + 4, +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/scalefactor.py b/src/FeaturesPlugin/doc/examples/scalefactor.py index e0ab304b1..f147bb487 100644 --- a/src/FeaturesPlugin/doc/examples/scalefactor.py +++ b/src/FeaturesPlugin/doc/examples/scalefactor.py @@ -4,7 +4,18 @@ 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) -Scale_1 = model.addScale(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")] , model.selection("VERTEX", "PartSet/Origin"), 2) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + 2, +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/sewing.py b/src/FeaturesPlugin/doc/examples/sewing.py index 52f2c3ad8..abbdd8b37 100644 --- a/src/FeaturesPlugin/doc/examples/sewing.py +++ b/src/FeaturesPlugin/doc/examples/sewing.py @@ -4,28 +4,50 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -model.addParameter(Part_1_doc, "dx", '10') -model.addParameter(Part_1_doc, "alfa", '90') +model.addParameter(Part_1_doc, "dx", "10") +model.addParameter(Part_1_doc, "alfa", "90") 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")], axis = model.selection("EDGE", "PartSet/OX"), distance = "dx", keepSubResults = True) -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], axis = model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), angle = "alfa", keepSubResults = True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_2_1")], + axis=model.selection("EDGE", "PartSet/OX"), + distance="dx", + keepSubResults=True, +) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Translation_1_1")], + axis=model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + angle="alfa", + keepSubResults=True, +) -Shell_1_objects = [model.selection("FACE", "Box_1_1/Top"), - model.selection("FACE", "Box_1_1/Left"), - model.selection("FACE", "Box_1_1/Right"), - model.selection("FACE", "Box_1_1/Back"), - model.selection("FACE", "Box_1_1/Bottom")] +Shell_1_objects = [ + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), + model.selection("FACE", "Box_1_1/Back"), + model.selection("FACE", "Box_1_1/Bottom"), +] Shell_1 = model.addShell(Part_1_doc, Shell_1_objects) -Shell_2_objects = [model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Top"), - model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Left"), - model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Front"), - model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Right"), - model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Bottom")] +Shell_2_objects = [ + model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Top"), + model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Left"), + model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Front"), + model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Right"), + model.selection("FACE", "Rotation_1_1/MF:Rotated&Box_2_1/Bottom"), +] Shell_2 = model.addShell(Part_1_doc, Shell_2_objects) -Sewing_1 = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], 1e-07, allowNonManifold = False, alwaysCreateResult = True) +Sewing_1 = model.addSewing( + Part_1_doc, + [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_1_1")], + 1e-07, + allowNonManifold=False, + alwaysCreateResult=True, +) model.end() diff --git a/src/FeaturesPlugin/doc/examples/smash.py b/src/FeaturesPlugin/doc/examples/smash.py index 54a4b6a89..e43786d78 100644 --- a/src/FeaturesPlugin/doc/examples/smash.py +++ b/src/FeaturesPlugin/doc/examples/smash.py @@ -5,11 +5,17 @@ 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("SOLID", "Cylinder_1_1")], - [model.selection("SOLID", "Box_1_1")]) +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("SOLID", "Cylinder_1_1")], + [model.selection("SOLID", "Box_1_1")], +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/symmetryaxis.py b/src/FeaturesPlugin/doc/examples/symmetryaxis.py index 9736d6eaa..cc8fdaafe 100644 --- a/src/FeaturesPlugin/doc/examples/symmetryaxis.py +++ b/src/FeaturesPlugin/doc/examples/symmetryaxis.py @@ -4,7 +4,21 @@ 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) -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "([Cylinder_1_1/Face_1][Cylinder_1_1/Face_2])([Cylinder_1_1/Face_1][Cylinder_1_1/Face_3])"), False) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection( + "EDGE", + "([Cylinder_1_1/Face_1][Cylinder_1_1/Face_2])([Cylinder_1_1/Face_1][Cylinder_1_1/Face_3])", + ), + False, +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/symmetryplane.py b/src/FeaturesPlugin/doc/examples/symmetryplane.py index b6a496b0f..9fa3c34db 100644 --- a/src/FeaturesPlugin/doc/examples/symmetryplane.py +++ b/src/FeaturesPlugin/doc/examples/symmetryplane.py @@ -4,7 +4,18 @@ 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) -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("FACE", "Cylinder_1_1/Face_2"), True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("FACE", "Cylinder_1_1/Face_2"), + True, +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/symmetrypoint.py b/src/FeaturesPlugin/doc/examples/symmetrypoint.py index 5b789603f..eb7b3c7e8 100644 --- a/src/FeaturesPlugin/doc/examples/symmetrypoint.py +++ b/src/FeaturesPlugin/doc/examples/symmetrypoint.py @@ -4,7 +4,18 @@ 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) -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("VERTEX", "PartSet/Origin"), True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + True, +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/translation2points.py b/src/FeaturesPlugin/doc/examples/translation2points.py index 974ed91d9..ac9351269 100644 --- a/src/FeaturesPlugin/doc/examples/translation2points.py +++ b/src/FeaturesPlugin/doc/examples/translation2points.py @@ -4,7 +4,19 @@ 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("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "[Cone_1_1/Face_1][Cone_1_1/Face_2]")) +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("VERTEX", "PartSet/Origin"), + model.selection("VERTEX", "[Cone_1_1/Face_1][Cone_1_1/Face_2]"), +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/translationDXDYDZ.py b/src/FeaturesPlugin/doc/examples/translationDXDYDZ.py index c43d33abe..063da5274 100644 --- a/src/FeaturesPlugin/doc/examples/translationDXDYDZ.py +++ b/src/FeaturesPlugin/doc/examples/translationDXDYDZ.py @@ -4,7 +4,16 @@ 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")], 10, 20, 50) +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")], 10, 20, 50 +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/translationvector.py b/src/FeaturesPlugin/doc/examples/translationvector.py index 1d8b55980..95daa5acb 100644 --- a/src/FeaturesPlugin/doc/examples/translationvector.py +++ b/src/FeaturesPlugin/doc/examples/translationvector.py @@ -4,7 +4,22 @@ 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", "([Cone_1_1/Face_1][Cone_1_1/Face_2])([Cone_1_1/Face_1][Cone_1_1/Face_3])"), 40) +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", + "([Cone_1_1/Face_1][Cone_1_1/Face_2])([Cone_1_1/Face_1][Cone_1_1/Face_3])", + ), + 40, +) model.do() model.end() diff --git a/src/FeaturesPlugin/doc/examples/union.py b/src/FeaturesPlugin/doc/examples/union.py index 64a99bb97..f37ceb55f 100644 --- a/src/FeaturesPlugin/doc/examples/union.py +++ b/src/FeaturesPlugin/doc/examples/union.py @@ -9,19 +9,52 @@ SketchLine_1 = Sketch_1.addLine(71, -15, -32, -15) SketchLine_2 = Sketch_1.addLine(-32, -15, -32, -56) SketchLine_3 = Sketch_1.addLine(-32, -56, 71, -56) SketchLine_4 = Sketch_1.addLine(71, -56, 71, -15) -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()) +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(3, -15, 36, -56) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_1.result() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_3.result() +) model.do() -Extrusion_1 = model.addExtrusion(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")], model.selection(), 10, 0) -Union_1 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2")]) +Extrusion_1 = model.addExtrusion( + 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", + ), + ], + model.selection(), + 10, + 0, +) +Union_1 = model.addUnion( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_1_1"), + model.selection("SOLID", "Extrusion_1_1_2"), + ], +) model.do() model.end() diff --git a/src/FiltersPlugin/FiltersPlugin_TopoConnectedFaces.py b/src/FiltersPlugin/FiltersPlugin_TopoConnectedFaces.py index 9f984338d..bd1e5ac54 100644 --- a/src/FiltersPlugin/FiltersPlugin_TopoConnectedFaces.py +++ b/src/FiltersPlugin/FiltersPlugin_TopoConnectedFaces.py @@ -24,100 +24,118 @@ from GeomAlgoAPI import GeomAlgoAPI_MapShapesAndAncestors as mapShapesAndAncesto FILTER_ID = "TopoConnectedFaces" + def singleton(cls): - instance = cls() - instance.__call__ = lambda: instance - return instance + instance = cls() + instance.__call__ = lambda: instance + return instance + @singleton class FiltersPlugin_TopoConnectedFaces(ModelAPI_Filter): - """ - Filter for faces topologically connected to the selected object. - """ - - def __init__(self): - """x.__init__(...) initializes x; see x.__class__.__doc__ for signature""" - ModelAPI_Filter.__init__(self) - self.myCached = {} - - def name(self): - """ Description of the filter """ - return "Topologically connected faces" - - def isSupported(self, theType): - """ Supported types of filtered shapes """ - return theType == GeomAPI_Shape.FACE - - def isMultiple(self): - """ Returns True if the filter can be used several times within one selection """ - return True - - def isOk(self, theShape, theResult, theArgs): - """ True if theShape is applicable for the filter """ - selectedShapeAttr = modelAPI_AttributeSelection(theArgs.argument("Shape")) - if selectedShapeAttr is None: - return False - selectedShape = selectedShapeAttr.value() - isPropagated = modelAPI_AttributeBoolean(theArgs.argument("Propagation")).value() - - # cache selected shape and applicable faces - if selectedShape not in self.myCached: - anOwner = bodyOwner(theResult, True) - if anOwner is None: - anOwner = modelAPI_ResultBody(theResult) - if anOwner is None: - return False - topLevelShape = anOwner.shape() - if not topLevelShape.isSubShape(selectedShape): - return False; - - mapVFAlgo = mapShapesAndAncestors(topLevelShape, GeomAPI_Shape.VERTEX, GeomAPI_Shape.FACE) - mapVF = mapVFAlgo.map() - mapEFAlgo = mapShapesAndAncestors(topLevelShape, GeomAPI_Shape.EDGE, GeomAPI_Shape.FACE) - mapEF = mapEFAlgo.map() - - # faces adjacent to the selected shape - applicableFaces = OriShapeSet() - if selectedShape.shapeType() == GeomAPI_Shape.VERTEX: - if selectedShape in mapVF: applicableFaces = mapVF[selectedShape] - elif selectedShape.shapeType() == GeomAPI_Shape.EDGE: - if selectedShape in mapEF: applicableFaces = mapEF[selectedShape] - elif selectedShape.shapeType() == GeomAPI_Shape.FACE: - applicableFaces.insert(selectedShape) - self.adjacentFaces(selectedShape, mapVF, GeomAPI_Shape.VERTEX, applicableFaces, False) - else: - return False - # propagate the connection - if isPropagated: - appFacesCopy = applicableFaces - for ind in range(appFacesCopy.size()): - self.adjacentFaces(appFacesCopy[ind], mapEF, GeomAPI_Shape.EDGE, applicableFaces) - self.myCached[selectedShape] = applicableFaces - - return theShape in self.myCached[selectedShape] - - def xmlRepresentation(self): - """ Returns XML string which represents GUI of the filter """ - return self.xmlFromFile("filter-TopoConnectedFaces.xml") - - def initAttributes(self, theArgs): - """ Initializes arguments of a filter """ - theArgs.initAttribute("Shape", ModelAPI_AttributeSelection.typeId()) - theArgs.initAttribute("Propagation", ModelAPI_AttributeBoolean.typeId()) - - def adjacentFaces(self, theFace, theMapSA, theShapeType, theApplicableFaces, theRecursive = True): - """ Find all faces neighbour to theFace """ - exp = GeomAPI_ShapeExplorer(theFace, theShapeType) - while exp.more(): - if exp.current() in theMapSA: - faces = theMapSA[exp.current()] - for ind in range(faces.size()): - f = faces[ind] - if f not in theApplicableFaces: - theApplicableFaces.insert(f) - if theRecursive: - self.adjacentFaces(f, theMapSA, theShapeType, theApplicableFaces) - exp.next() + """ + Filter for faces topologically connected to the selected object. + """ + + def __init__(self): + """x.__init__(...) initializes x; see x.__class__.__doc__ for signature""" + ModelAPI_Filter.__init__(self) + self.myCached = {} + + def name(self): + """Description of the filter""" + return "Topologically connected faces" + + def isSupported(self, theType): + """Supported types of filtered shapes""" + return theType == GeomAPI_Shape.FACE + + def isMultiple(self): + """Returns True if the filter can be used several times within one selection""" + return True + + def isOk(self, theShape, theResult, theArgs): + """True if theShape is applicable for the filter""" + selectedShapeAttr = modelAPI_AttributeSelection(theArgs.argument("Shape")) + if selectedShapeAttr is None: + return False + selectedShape = selectedShapeAttr.value() + isPropagated = modelAPI_AttributeBoolean( + theArgs.argument("Propagation") + ).value() + + # cache selected shape and applicable faces + if selectedShape not in self.myCached: + anOwner = bodyOwner(theResult, True) + if anOwner is None: + anOwner = modelAPI_ResultBody(theResult) + if anOwner is None: + return False + topLevelShape = anOwner.shape() + if not topLevelShape.isSubShape(selectedShape): + return False + + mapVFAlgo = mapShapesAndAncestors( + topLevelShape, GeomAPI_Shape.VERTEX, GeomAPI_Shape.FACE + ) + mapVF = mapVFAlgo.map() + mapEFAlgo = mapShapesAndAncestors( + topLevelShape, GeomAPI_Shape.EDGE, GeomAPI_Shape.FACE + ) + mapEF = mapEFAlgo.map() + + # faces adjacent to the selected shape + applicableFaces = OriShapeSet() + if selectedShape.shapeType() == GeomAPI_Shape.VERTEX: + if selectedShape in mapVF: + applicableFaces = mapVF[selectedShape] + elif selectedShape.shapeType() == GeomAPI_Shape.EDGE: + if selectedShape in mapEF: + applicableFaces = mapEF[selectedShape] + elif selectedShape.shapeType() == GeomAPI_Shape.FACE: + applicableFaces.insert(selectedShape) + self.adjacentFaces( + selectedShape, mapVF, GeomAPI_Shape.VERTEX, applicableFaces, False + ) + else: + return False + # propagate the connection + if isPropagated: + appFacesCopy = applicableFaces + for ind in range(appFacesCopy.size()): + self.adjacentFaces( + appFacesCopy[ind], mapEF, GeomAPI_Shape.EDGE, applicableFaces + ) + self.myCached[selectedShape] = applicableFaces + + return theShape in self.myCached[selectedShape] + + def xmlRepresentation(self): + """Returns XML string which represents GUI of the filter""" + return self.xmlFromFile("filter-TopoConnectedFaces.xml") + + def initAttributes(self, theArgs): + """Initializes arguments of a filter""" + theArgs.initAttribute("Shape", ModelAPI_AttributeSelection.typeId()) + theArgs.initAttribute("Propagation", ModelAPI_AttributeBoolean.typeId()) + + def adjacentFaces( + self, theFace, theMapSA, theShapeType, theApplicableFaces, theRecursive=True + ): + """Find all faces neighbour to theFace""" + exp = GeomAPI_ShapeExplorer(theFace, theShapeType) + while exp.more(): + if exp.current() in theMapSA: + faces = theMapSA[exp.current()] + for ind in range(faces.size()): + f = faces[ind] + if f not in theApplicableFaces: + theApplicableFaces.insert(f) + if theRecursive: + self.adjacentFaces( + f, theMapSA, theShapeType, theApplicableFaces + ) + exp.next() # Register the filter object diff --git a/src/FiltersPlugin/Test/Test17924.py b/src/FiltersPlugin/Test/Test17924.py index 0b385ee10..11a5978a9 100644 --- a/src/FiltersPlugin/Test/Test17924.py +++ b/src/FiltersPlugin/Test/Test17924.py @@ -24,35 +24,110 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchEllipticArc_1 = Sketch_1.addEllipticArc(-10.32877055751729, 9.639944794047965, 15.50521682336113, 20.50671907502198, 14.00087220087917, 9.066138556306997, -21.07385236240306, -7.836309501397333, False) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchLine_3 = Sketch_1.addLine(14.00087220087917, 9.066138556306999, -27.08576797296286, 16.56662668932342) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchEllipticArc_1.startPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchEllipticArc_1.result()) -SketchLine_4 = Sketch_1.addLine(-21.07385236240307, -7.836309501397318, 6.541391110246827, 27.42439482327214) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchEllipticArc_1.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchEllipticArc_1.result()) +SketchEllipticArc_1 = Sketch_1.addEllipticArc( + -10.32877055751729, + 9.639944794047965, + 15.50521682336113, + 20.50671907502198, + 14.00087220087917, + 9.066138556306997, + -21.07385236240306, + -7.836309501397333, + False, +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipticArc_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchLine_3 = Sketch_1.addLine( + 14.00087220087917, 9.066138556306999, -27.08576797296286, 16.56662668932342 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchEllipticArc_1.startPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchEllipticArc_1.result() +) +SketchLine_4 = Sketch_1.addLine( + -21.07385236240307, -7.836309501397318, 6.541391110246827, 27.42439482327214 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchEllipticArc_1.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchEllipticArc_1.result() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 50, 0) -FilterFace = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", args = [model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchEllipticArc_1")])]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 50, 0 +) +FilterFace = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnGeometry", + args=[ + model.selection( + "FACE", + "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchEllipticArc_1", + ) + ], + ) + ], +) model.end() Reference = { model.selection("FACE", "Extrusion_1_1_1/From_Face"): False, model.selection("FACE", "Extrusion_1_1_1/To_Face"): False, - model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchEllipticArc_1"): True, - model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4"): False, - model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3"): False, + model.selection( + "FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchEllipticArc_1" + ): True, + model.selection( + "FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4" + ): False, + model.selection( + "FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3" + ): False, model.selection("FACE", "Extrusion_1_1_2/To_Face"): False, model.selection("FACE", "Extrusion_1_1_2/From_Face"): False, - model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchEllipticArc_1"): True, - model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3"): False, - model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_4"): False, + model.selection( + "FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchEllipticArc_1" + ): True, + model.selection( + "FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3" + ): False, + model.selection( + "FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_4" + ): False, model.selection("FACE", "Extrusion_1_1_3/To_Face"): False, model.selection("FACE", "Extrusion_1_1_3/From_Face"): False, - model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4"): False, - model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3"): False, - model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchEllipticArc_1"): True + model.selection( + "FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4" + ): False, + model.selection( + "FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3" + ): False, + model.selection( + "FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchEllipticArc_1" + ): True, } model.checkFilter(Part_1_doc, model, FilterFace, Reference) diff --git a/src/FiltersPlugin/Test/Test17962.py b/src/FiltersPlugin/Test/Test17962.py index 4388d7637..71d6aa35e 100644 --- a/src/FiltersPlugin/Test/Test17962.py +++ b/src/FiltersPlugin/Test/Test17962.py @@ -28,35 +28,86 @@ 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(0, 12.99991029434202, 0, 51.37466648339316) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) -SketchLine_3 = Sketch_1.addLine(0, 51.37466648339316, 51.95275254614653, 51.37466648339316) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(51.95275254614653, 51.37466648339316, 59.69545386375759, 37.96391441346034) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(59.69545386375759, 37.96391441346034, 133.2087031398387, 37.96391441346034) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(133.2087031398387, 37.96391441346034, 133.2087031398387, 12.99991029434202) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchLine_7 = Sketch_1.addLine(133.2087031398387, 12.99991029434202, 0, 12.99991029434202) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) +SketchLine_3 = Sketch_1.addLine( + 0, 51.37466648339316, 51.95275254614653, 51.37466648339316 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + 51.95275254614653, 51.37466648339316, 59.69545386375759, 37.96391441346034 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 59.69545386375759, 37.96391441346034, 133.2087031398387, 37.96391441346034 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + 133.2087031398387, 37.96391441346034, 133.2087031398387, 12.99991029434202 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchLine_7 = Sketch_1.addLine( + 133.2087031398387, 12.99991029434202, 0, 12.99991029434202 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_7.endPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_6.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) -SketchConstraintAngle_1 = Sketch_1.setAngleBackward(SketchLine_4.result(), SketchLine_2.result(), 30) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) +SketchConstraintAngle_1 = Sketch_1.setAngleBackward( + SketchLine_4.result(), SketchLine_2.result(), 30 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r")], model.selection("EDGE", "PartSet/OX"), 360, 0) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6"), 1, True) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r", + ) + ], + model.selection("EDGE", "PartSet/OX"), + 360, + 0, +) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6"), + 1, + True, +) Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 1, False) # load 'Filters' plugin -FiltersFeature = model.filters(Part_1_doc, [model.addFilter(name = "BelongsTo", args = [model.selection("FACE", "Plane_1")])]) +FiltersFeature = model.filters( + Part_1_doc, + [model.addFilter(name="BelongsTo", args=[model.selection("FACE", "Plane_1")])], +) FiltersFactory = ModelAPI_Session.get().filters() Filter = FiltersFactory.filter("BelongsTo") @@ -68,10 +119,12 @@ ValidatorReader.readAll() aFactory = ModelAPI_Session.get().validators() # no Group, thus not valid yet -assert(not aFactory.validate(FiltersFeature.feature())) +assert not aFactory.validate(FiltersFeature.feature()) # should be not valid while the group is created -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Box_1_1/Left"), FiltersFeature]) -assert(not aFactory.validate(FiltersFeature.feature())) +Group_1 = model.addGroup( + Part_1_doc, "Faces", [model.selection("FACE", "Box_1_1/Left"), FiltersFeature] +) +assert not aFactory.validate(FiltersFeature.feature()) model.end() diff --git a/src/FiltersPlugin/Test/Test19190.py b/src/FiltersPlugin/Test/Test19190.py index 8155aea3b..c8e9cebfc 100644 --- a/src/FiltersPlugin/Test/Test19190.py +++ b/src/FiltersPlugin/Test/Test19190.py @@ -24,34 +24,92 @@ 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(87.62648221343873, 42.39493620569578, -76.44861660079052, 42.39493620569578) -SketchLine_2 = Sketch_1.addLine(-76.44861660079052, 42.39493620569578, -76.44861660079052, -42.23747486149789) -SketchLine_3 = Sketch_1.addLine(-76.44861660079052, -42.23747486149789, 87.62648221343873, -42.23747486149789) -SketchLine_4 = Sketch_1.addLine(87.62648221343873, -42.23747486149789, 87.62648221343873, 42.39493620569578) -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()) +SketchLine_1 = Sketch_1.addLine( + 87.62648221343873, 42.39493620569578, -76.44861660079052, 42.39493620569578 +) +SketchLine_2 = Sketch_1.addLine( + -76.44861660079052, 42.39493620569578, -76.44861660079052, -42.23747486149789 +) +SketchLine_3 = Sketch_1.addLine( + -76.44861660079052, -42.23747486149789, 87.62648221343873, -42.23747486149789 +) +SketchLine_4 = Sketch_1.addLine( + 87.62648221343873, -42.23747486149789, 87.62648221343873, 42.39493620569578 +) +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(-32.93478260869566, 42.39493620569578, -17.36561264822134, -42.23747486149789) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result()) -SketchLine_6 = Sketch_1.addLine(34.93083003952569, -42.23747486149789, 44.11264822134387, 42.39493620569579) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_3.result()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_1.result()) +SketchLine_5 = Sketch_1.addLine( + -32.93478260869566, 42.39493620569578, -17.36561264822134, -42.23747486149789 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_1.result() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_3.result() +) +SketchLine_6 = Sketch_1.addLine( + 34.93083003952569, -42.23747486149789, 44.11264822134387, 42.39493620569579 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchLine_3.result() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_1.result() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 100, 0) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 35, 120) -Fuse_1_objects_1 = [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Cylinder_1_1"), model.selection("SOLID", "Extrusion_1_1_3")] -Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1, removeEdges = True, keepSubResults = True) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection(), + 100, + 0, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 35, + 120, +) +Fuse_1_objects_1 = [ + model.selection("SOLID", "Extrusion_1_1_1"), + model.selection("SOLID", "Cylinder_1_1"), + model.selection("SOLID", "Extrusion_1_1_3"), +] +Fuse_1 = model.addFuse( + Part_1_doc, Fuse_1_objects_1, removeEdges=True, keepSubResults=True +) Fuse_1.result().setColor(76, 76, 153) Fuse_1.result().subResult(0).setColor(254, 127, 127) Fuse_1.result().subResult(1).setColor(153, 153, 76) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Fuse_1_1_2/Modified_Face&Sketch_1/SketchLine_2"), 75, True) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", args = [model.selection("SOLID", "Fuse_1_1_2"), "on"])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Fuse_1_1_2/Modified_Face&Sketch_1/SketchLine_2"), + 75, + True, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="RelativeToSolid", args=[model.selection("SOLID", "Fuse_1_1_2"), "on"] + ) + ], +) model.end() from GeomAPI import * @@ -69,8 +127,10 @@ solid2 = Fuse_1.result().subResult(1).resultSubShapePair()[0] Reference = {} exp = GeomAPI_ShapeExplorer(solid1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(solid1, exp.current())] = False; exp.next() -Reference[model.selection(solid1, exp.current())] = True; exp.next() +Reference[model.selection(solid1, exp.current())] = False +exp.next() +Reference[model.selection(solid1, exp.current())] = True +exp.next() while exp.more(): Reference[model.selection(solid1, exp.current())] = False exp.next() diff --git a/src/FiltersPlugin/Test/Test2946.py b/src/FiltersPlugin/Test/Test2946.py index 68089ec22..418550439 100644 --- a/src/FiltersPlugin/Test/Test2946.py +++ b/src/FiltersPlugin/Test/Test2946.py @@ -26,118 +26,442 @@ 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), 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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) -SketchLine_1 = Sketch_1.addLine(19.31851652578136, 5.176380902050418, 38.63703305156273, 10.35276180410083) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_1 = Sketch_1.addLine( + 19.31851652578136, 5.176380902050418, 38.63703305156273, 10.35276180410083 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_2 = SketchProjection_2.createdFeature() -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_2.result(), SketchLine_1.result(), 15) -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_2.result(), [SketchLine_1.result()]) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_2.result(), SketchLine_1.result(), 15 +) +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_2.result(), [SketchLine_1.result()] +) [SketchLine_3] = SketchConstraintMirror_1.mirrored() -SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_1.result(), SketchLine_3.result()], SketchAPI_Line(SketchLine_2).startPoint(), 360, 4, True) -[SketchLine_4, SketchLine_5, SketchLine_6, SketchLine_3, SketchLine_7, SketchLine_8, SketchLine_9] = SketchMultiRotation_1.rotated() -SketchArc_1 = Sketch_1.addArc(0, 0, 10.35276180410083, 38.63703305156273, -10.35276180410083, 38.63703305156273, False) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchArc_1.center()) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchLine_1.result(), SketchLine_3.result()], + SketchAPI_Line(SketchLine_2).startPoint(), + 360, + 4, + True, +) +[ + SketchLine_4, + SketchLine_5, + SketchLine_6, + SketchLine_3, + SketchLine_7, + SketchLine_8, + SketchLine_9, +] = SketchMultiRotation_1.rotated() +SketchArc_1 = Sketch_1.addArc( + 0, + 0, + 10.35276180410083, + 38.63703305156273, + -10.35276180410083, + 38.63703305156273, + False, +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchArc_1.center() +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_1.results()[1], 40) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_7.result()) -SketchArc_2 = Sketch_1.addArc(0, 0, -38.63703305156272, 10.35276180410084, -38.63703305156273, -10.35276180410081, False) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_1.results()[1], SketchArc_2.results()[1]) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_1.center(), SketchArc_2.center()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_4.result()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_8.result()) -SketchArc_3 = Sketch_1.addArc(0, 0, -10.35276180410082, -38.63703305156272, 10.35276180410081, -38.63703305156273, False) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchArc_2.results()[1], SketchArc_3.results()[1]) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_2.center(), SketchArc_3.center()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_5.result()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_9.result()) -SketchArc_4 = Sketch_1.addArc(0, 0, 38.63703305156272, -10.35276180410083, 38.63703305156273, 10.35276180410083, False) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_4.endPoint()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchArc_3.results()[1], SketchArc_4.results()[1]) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.center(), SketchArc_4.center()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchLine_3.result()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_6.result()) -SketchArc_5 = Sketch_1.addArc(0, 0, -5.176380902050417, 19.31851652578137, -19.31851652578136, 5.17638090205042, False) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_5.center()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_7.result() +) +SketchArc_2 = Sketch_1.addArc( + 0, + 0, + -38.63703305156272, + 10.35276180410084, + -38.63703305156273, + -10.35276180410081, + False, +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchArc_1.results()[1], SketchArc_2.results()[1] +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchArc_2.center() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_4.result() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_8.result() +) +SketchArc_3 = Sketch_1.addArc( + 0, + 0, + -10.35276180410082, + -38.63703305156272, + 10.35276180410081, + -38.63703305156273, + False, +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchArc_3.center() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_5.result() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchLine_9.result() +) +SketchArc_4 = Sketch_1.addArc( + 0, + 0, + 38.63703305156272, + -10.35276180410083, + 38.63703305156273, + 10.35276180410083, + False, +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchArc_3.results()[1], SketchArc_4.results()[1] +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchArc_4.center() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_4.startPoint(), SketchLine_3.result() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_6.result() +) +SketchArc_5 = Sketch_1.addArc( + 0, + 0, + -5.176380902050417, + 19.31851652578137, + -19.31851652578136, + 5.17638090205042, + False, +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_5.center() +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_5.results()[1], 20) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_5.results()[1]) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_5.startPoint(), SketchLine_4.result()) -SketchArc_6 = Sketch_1.addArc(0, 0, -19.31851652578137, -5.176380902050416, -5.176380902050431, -19.31851652578136, False) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchArc_5.results()[1], SketchArc_6.results()[1]) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchArc_5.center(), SketchArc_6.center()) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_8.result()) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchArc_6.startPoint(), SketchLine_5.result()) -SketchArc_7 = Sketch_1.addArc(0, 0, 5.176380902050406, -19.31851652578137, 19.31851652578136, -5.176380902050432, False) -SketchConstraintEqual_5 = Sketch_1.setEqual(SketchArc_6.results()[1], SketchArc_7.results()[1]) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_6.center(), SketchArc_7.center()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchArc_7.startPoint(), SketchLine_6.result()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_9.result()) -SketchArc_8 = Sketch_1.addArc(0, 0, 19.31851652578136, 5.176380902050419, 5.176380902050419, 19.31851652578136, False) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchLine_7.result()) -SketchConstraintEqual_6 = Sketch_1.setEqual(SketchArc_7.results()[1], SketchArc_8.results()[1]) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchArc_7.center(), SketchArc_8.center()) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_7.endPoint(), SketchLine_3.result()) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchArc_8.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_5.results()[1] +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchArc_5.startPoint(), SketchLine_4.result() +) +SketchArc_6 = Sketch_1.addArc( + 0, + 0, + -19.31851652578137, + -5.176380902050416, + -5.176380902050431, + -19.31851652578136, + False, +) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchArc_5.results()[1], SketchArc_6.results()[1] +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchArc_5.center(), SketchArc_6.center() +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchLine_8.result() +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchArc_6.startPoint(), SketchLine_5.result() +) +SketchArc_7 = Sketch_1.addArc( + 0, + 0, + 5.176380902050406, + -19.31851652578137, + 19.31851652578136, + -5.176380902050432, + False, +) +SketchConstraintEqual_5 = Sketch_1.setEqual( + SketchArc_6.results()[1], SketchArc_7.results()[1] +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchArc_6.center(), SketchArc_7.center() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchArc_7.startPoint(), SketchLine_6.result() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchArc_6.endPoint(), SketchLine_9.result() +) +SketchArc_8 = Sketch_1.addArc( + 0, + 0, + 19.31851652578136, + 5.176380902050419, + 5.176380902050419, + 19.31851652578136, + False, +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchArc_8.endPoint(), SketchLine_7.result() +) +SketchConstraintEqual_6 = Sketch_1.setEqual( + SketchArc_7.results()[1], SketchArc_8.results()[1] +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchArc_7.center(), SketchArc_8.center() +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchArc_7.endPoint(), SketchLine_3.result() +) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchArc_8.startPoint(), SketchLine_1.result() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_8_2f-SketchLine_7f-SketchArc_1_2f-SketchLine_4r-SketchArc_5_2f-SketchLine_8f-SketchArc_2_2f-SketchLine_5r-SketchArc_6_2f-SketchLine_9f-SketchArc_3_2f-SketchLine_6r-SketchArc_7_2f-SketchLine_3f-SketchArc_4_2f-SketchLine_1r-SketchCircle_1_2r")], model.selection(), 10, 0) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnPlane", args = [model.selection("FACE", "Extrusion_1_1/To_Face")])]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchArc_8_2f-SketchLine_7f-SketchArc_1_2f-SketchLine_4r-SketchArc_5_2f-SketchLine_8f-SketchArc_2_2f-SketchLine_5r-SketchArc_6_2f-SketchLine_9f-SketchArc_3_2f-SketchLine_6r-SketchArc_7_2f-SketchLine_3f-SketchArc_4_2f-SketchLine_1r-SketchCircle_1_2r", + ) + ], + model.selection(), + 10, + 0, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnPlane", args=[model.selection("FACE", "Extrusion_1_1/To_Face")] + ) + ], +) model.end() Reference = { - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_6_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_6_2][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_6_2]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_7_2]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face]"): False, - 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])"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_7_2][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_7_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_5_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_5_2][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_5_2]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_8_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_8_2][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_8_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/From_Face]"): False, - - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_6_2][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_7_2][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_5_2][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_8_2][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_6_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_6_2][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_6_2]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_7_2]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face]", + ): False, + 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])", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_7_2][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_7_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_5_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_5_2][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_5_2]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_8_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_8_2][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_8_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_6_2][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_7_2][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_5_2][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_8_2][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]", + ): True, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/Test2951.py b/src/FiltersPlugin/Test/Test2951.py index 5ee94f8ed..94f83b370 100644 --- a/src/FiltersPlugin/Test/Test2951.py +++ b/src/FiltersPlugin/Test/Test2951.py @@ -26,74 +26,172 @@ 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 25) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchLine_1 = Sketch_1.addLine(-35, 23, -35, -23) SketchLine_2 = Sketch_1.addLine(-35, -23, -28, -23) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(-28, -23, -23, -28) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(-23, -28, -23, -35) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(-23, -35, 23, -35) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(23, -35, 23, -28) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(23, -28, 28, -23) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(28, -23, 35, -23) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(35, -23, 35, 23) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchLine_10 = Sketch_1.addLine(35, 23, 28, 23) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchLine_11 = Sketch_1.addLine(28, 23, 23, 28) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchLine_12 = Sketch_1.addLine(23, 28, 23, 35) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchLine_13 = Sketch_1.addLine(23, 35, -23, 35) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchLine_14 = Sketch_1.addLine(-23, 35, -23, 28) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchLine_15 = Sketch_1.addLine(-23, 28, -28, 23) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) SketchLine_16 = Sketch_1.addLine(-28, 23, -35, 23) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_16.endPoint()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_16.endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_13.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_2.result()) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_2.result(), SketchLine_8.result()) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_2.result(), SketchLine_8.result() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_16.result()) -SketchConstraintCollinear_2 = Sketch_1.setCollinear(SketchLine_16.result(), SketchLine_10.result()) +SketchConstraintCollinear_2 = Sketch_1.setCollinear( + SketchLine_16.result(), SketchLine_10.result() +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_4.result()) -SketchConstraintCollinear_3 = Sketch_1.setCollinear(SketchLine_4.result(), SketchLine_14.result()) +SketchConstraintCollinear_3 = Sketch_1.setCollinear( + SketchLine_4.result(), SketchLine_14.result() +) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_6.result()) -SketchConstraintCollinear_4 = Sketch_1.setCollinear(SketchLine_6.result(), SketchLine_12.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_4.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_16.result(), SketchLine_14.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_16.result()) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_14.result(), SketchLine_12.result()) -SketchConstraintEqual_5 = Sketch_1.setEqual(SketchLine_12.result(), SketchLine_10.result()) -SketchConstraintEqual_6 = Sketch_1.setEqual(SketchLine_10.result(), SketchLine_8.result()) -SketchConstraintEqual_7 = Sketch_1.setEqual(SketchLine_6.result(), SketchLine_4.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_9.result(), 35, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_1.result(), 35, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_5.result(), 35, True) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_13.result(), 35, True) +SketchConstraintCollinear_4 = Sketch_1.setCollinear( + SketchLine_6.result(), SketchLine_12.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_4.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_16.result(), SketchLine_14.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_16.result() +) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_14.result(), SketchLine_12.result() +) +SketchConstraintEqual_5 = Sketch_1.setEqual( + SketchLine_12.result(), SketchLine_10.result() +) +SketchConstraintEqual_6 = Sketch_1.setEqual( + SketchLine_10.result(), SketchLine_8.result() +) +SketchConstraintEqual_7 = Sketch_1.setEqual( + SketchLine_6.result(), SketchLine_4.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_9.result(), 35, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_1.result(), 35, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_5.result(), 35, True +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_13.result(), 35, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 25) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 7) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), 23, True) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_2.result(), 23, True) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_12.result(), 23, True) -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_16.result(), 23, True) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), 23, True +) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_2.result(), 23, True +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_12.result(), 23, True +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_16.result(), 23, 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-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchLine_16f-SketchCircle_1_2r")], model.selection(), 10, 0) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OppositeToEdge", args = [model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1/To_Face]")])]) +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-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchLine_16f-SketchCircle_1_2r", + ) + ], + model.selection(), + 10, + 0, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OppositeToEdge", + args=[ + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1/To_Face]", + ) + ], + ) + ], +) model.end() from GeomAPI import * @@ -102,126 +200,228 @@ Reference = {} ExtrusionResult = Extrusion_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ExtrusionResult.shape(), GeomAPI_Shape.EDGE) # edges on face 1 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() # edges on face 2 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() # edges on face 3 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() # edges on face 4 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() # edges on face 5 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() # edges on face 6 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() # edges on face 7 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() # edges on face 8 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() # edges on face 9 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = True; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = True; exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = True +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = True +exp.next() # edges on face 10 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() # edges on face 11 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() # edges on face 12 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() # edges on face 13 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() # edges on face 14 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() # edges on face 15 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() # edges on face 16 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() # edges on face 17 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() # edges on face 18 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = True; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = True +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() # edges on face 19 -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = True; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -Reference[model.selection(ExtrusionResult, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = True +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +Reference[model.selection(ExtrusionResult, exp.current())] = False +exp.next() +assert not exp.more() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/Test3241.py b/src/FiltersPlugin/Test/Test3241.py index 00959e6d8..125562f02 100644 --- a/src/FiltersPlugin/Test/Test3241.py +++ b/src/FiltersPlugin/Test/Test3241.py @@ -27,42 +27,93 @@ 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 40) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 40) model.do() -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), 10, False) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), 10, False +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchCircle_1"), True) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchCircle_1"), True +) SketchPoint_2 = SketchProjection_2.createdFeature() SketchCircle_2 = Sketch_2.addCircle(0, 0, 50) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchCircle_2.center()) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchCircle_2.center() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], 50) model.do() Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_1"), 10, False) Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2")) -SketchProjection_3 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/SketchCircle_1"), True) +SketchProjection_3 = Sketch_3.addProjection( + model.selection("VERTEX", "Sketch_1/SketchCircle_1"), True +) SketchPoint_3 = SketchProjection_3.createdFeature() SketchCircle_3 = Sketch_3.addCircle(0, 0, 53) -SketchConstraintCoincidence_3 = Sketch_3.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchCircle_3.center()) +SketchConstraintCoincidence_3 = Sketch_3.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchCircle_3.center() +) SketchConstraintRadius_3 = Sketch_3.setRadius(SketchCircle_3.results()[1], 53) model.do() -Filling_1_objects = [model.selection("EDGE", "Sketch_1/SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), model.selection("EDGE", "Sketch_3/SketchCircle_3_2")] +Filling_1_objects = [ + model.selection("EDGE", "Sketch_1/SketchCircle_1_2"), + model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), + model.selection("EDGE", "Sketch_3/SketchCircle_3_2"), +] Filling_1 = model.addFilling(Part_1_doc, Filling_1_objects) Sketch_4 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchProjection_4 = Sketch_4.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_4 = Sketch_4.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_4 = SketchProjection_4.createdFeature() SketchProjection_5 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OX"), True) SketchLine_1 = SketchProjection_5.createdFeature() -SketchMultiRotation_1 = Sketch_4.addRotation([SketchLine_1.result()], SketchAPI_Point(SketchPoint_4).coordinates(), 360, 12, True) -[SketchLine_1, SketchLine_2, SketchLine_3, SketchLine_4, SketchLine_5, SketchLine_6, SketchLine_7, SketchLine_8, SketchLine_9, SketchLine_10, SketchLine_11, SketchLine_12] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_4.addRotation( + [SketchLine_1.result()], SketchAPI_Point(SketchPoint_4).coordinates(), 360, 12, True +) +[ + SketchLine_1, + SketchLine_2, + SketchLine_3, + SketchLine_4, + SketchLine_5, + SketchLine_6, + SketchLine_7, + SketchLine_8, + SketchLine_9, + SketchLine_10, + SketchLine_11, + SketchLine_12, +] = SketchMultiRotation_1.rotated() model.do() Edge_1 = model.addEdge(Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], False) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Edge_1")], model.selection(), model.selection("FACE", "Plane_2"), 0, model.selection(), 0) -Split_1 = model.addSplit(Part_1_doc, [model.selection("FACE", "Filling_1_1")], [model.selection("COMPOUND", "Extrusion_1_1")], keepSubResults = True) -FilterFace = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", args = [model.selection("FACE", "Split_1_1_1")])]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Edge_1")], + model.selection(), + model.selection("FACE", "Plane_2"), + 0, + model.selection(), + 0, +) +Split_1 = model.addSplit( + Part_1_doc, + [model.selection("FACE", "Filling_1_1")], + [model.selection("COMPOUND", "Extrusion_1_1")], + keepSubResults=True, +) +FilterFace = model.filters( + Part_1_doc, + [model.addFilter(name="OnGeometry", args=[model.selection("FACE", "Split_1_1_1")])], +) model.end() Reference = {} diff --git a/src/FiltersPlugin/Test/TestFilter_BelongsTo.py b/src/FiltersPlugin/Test/TestFilter_BelongsTo.py index ec9e01c16..ed621455c 100644 --- a/src/FiltersPlugin/Test/TestFilter_BelongsTo.py +++ b/src/FiltersPlugin/Test/TestFilter_BelongsTo.py @@ -25,10 +25,41 @@ 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/OX"), 20, 2, model.selection("EDGE", "PartSet/OY"), 20, 3) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 50) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "BelongsTo", args = [model.selection("SOLID", "LinearCopy_1_1_1"), model.selection("SOLID", "Translation_1_1")])]) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, + model.selection("EDGE", "PartSet/OY"), + 20, + 3, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 50, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="BelongsTo", + args=[ + model.selection("SOLID", "LinearCopy_1_1_1"), + model.selection("SOLID", "Translation_1_1"), + ], + ) + ], +) model.end() Reference = {} @@ -36,49 +67,49 @@ Reference = {} ResultBox_1 = LinearCopy_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() # Faces of another box ResultBox_2 = LinearCopy_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = False + exp.next() # Faces of the cylinder ResultCylinder_1 = Translation_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() # Edges of the original box exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() # Edges of another box exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = False + exp.next() # Edges of the cylinder exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() # Vertices of the original box exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() # Vertices of another box exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = False + exp.next() # Vertices of the cylinder exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_BelongsTo_Exclude.py b/src/FiltersPlugin/Test/TestFilter_BelongsTo_Exclude.py index 0532323d9..93c203be9 100644 --- a/src/FiltersPlugin/Test/TestFilter_BelongsTo_Exclude.py +++ b/src/FiltersPlugin/Test/TestFilter_BelongsTo_Exclude.py @@ -25,10 +25,42 @@ 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/OX"), 20, 2, model.selection("EDGE", "PartSet/OY"), 20, 3) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 50) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "BelongsTo", exclude = True, args = [model.selection("SOLID", "LinearCopy_1_1_1"), model.selection("SOLID", "Translation_1_1")])]) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, + model.selection("EDGE", "PartSet/OY"), + 20, + 3, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 50, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="BelongsTo", + exclude=True, + args=[ + model.selection("SOLID", "LinearCopy_1_1_1"), + model.selection("SOLID", "Translation_1_1"), + ], + ) + ], +) model.end() Reference = {} @@ -36,49 +68,49 @@ Reference = {} ResultBox_1 = LinearCopy_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() # Faces of another box ResultBox_2 = LinearCopy_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = True + exp.next() # Faces of the cylinder ResultCylinder_1 = Translation_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() # Edges of the original box exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() # Edges of another box exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = True + exp.next() # Edges of the cylinder exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() # Vertices of the original box exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() # Vertices of another box exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = True + exp.next() # Vertices of the cylinder exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_ContinuousFaces.py b/src/FiltersPlugin/Test/TestFilter_ContinuousFaces.py index 308d4f0b4..ff85ca54b 100644 --- a/src/FiltersPlugin/Test/TestFilter_ContinuousFaces.py +++ b/src/FiltersPlugin/Test/TestFilter_ContinuousFaces.py @@ -34,25 +34,35 @@ Part_1_doc = Part_1.document() Box_2 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Fillet -Fillet_1_objects_4 = [model.selection("FACE", "Box_1_1/Left"), - model.selection("FACE", "Box_1_1/Front"), - model.selection("FACE", "Box_1_1/Top"), - model.selection("FACE", "Box_1_1/Right"), - model.selection("FACE", "Box_1_1/Bottom")] -Fillet_1 = model.addFillet(Part_1_doc, Fillet_1_objects_4, 2, keepSubResults = True) +Fillet_1_objects_4 = [ + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Right"), + model.selection("FACE", "Box_1_1/Bottom"), +] +Fillet_1 = model.addFillet(Part_1_doc, Fillet_1_objects_4, 2, keepSubResults=True) model.end() model.do() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "ContinuousFaces", args = [model.selection("FACE", "Fillet_1_1/MF:Fillet&Box_1_1/Left"), 5.0 ])]) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="ContinuousFaces", + args=[model.selection("FACE", "Fillet_1_1/MF:Fillet&Box_1_1/Left"), 5.0], + ) + ], +) model.end() Reference = {} ResultFillet_1_1 = Fillet_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultFillet_1_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultFillet_1_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultFillet_1_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) ###===========Test with Chamfer by an angle of 43° on solid and filters with angle 50 =========== @@ -65,23 +75,35 @@ Part_2_doc = Part_2.document() Box_3 = model.addBox(Part_2_doc, 10, 10, 10) ### Create Chamfer -Chamfer_1_objects = [model.selection("FACE", "Box_1_1/Left"), - model.selection("FACE", "Box_1_1/Front"), - model.selection("FACE", "Box_1_1/Top"), - model.selection("FACE", "Box_1_1/Right"), - model.selection("FACE", "Box_1_1/Bottom")] -Chamfer_2 = model.addChamfer(Part_2_doc, Chamfer_1_objects, False, 2, 43, keepSubResults = True) +Chamfer_1_objects = [ + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Right"), + model.selection("FACE", "Box_1_1/Bottom"), +] +Chamfer_2 = model.addChamfer( + Part_2_doc, Chamfer_1_objects, False, 2, 43, keepSubResults=True +) model.end() model.do() -Filters = model.filters(Part_2_doc, [model.addFilter(name = "ContinuousFaces", args = [model.selection("FACE", "Chamfer_1_1/MF:Chamfer&Box_1_1/Left"), 50.0 ])]) +Filters = model.filters( + Part_2_doc, + [ + model.addFilter( + name="ContinuousFaces", + args=[model.selection("FACE", "Chamfer_1_1/MF:Chamfer&Box_1_1/Left"), 50.0], + ) + ], +) model.end() Reference = {} ResultChamfer_2_1 = Chamfer_2.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultChamfer_2_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultChamfer_2_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultChamfer_2_1, exp.current())] = True + exp.next() model.checkFilter(Part_2_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_EdgeSize.py b/src/FiltersPlugin/Test/TestFilter_EdgeSize.py index ee68a843b..43246b1ef 100644 --- a/src/FiltersPlugin/Test/TestFilter_EdgeSize.py +++ b/src/FiltersPlugin/Test/TestFilter_EdgeSize.py @@ -30,7 +30,9 @@ Part_1_doc = Part_1.document() ### Create Box Box_1 = model.addBox(Part_1_doc, 100, 50, 100) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "inf" , 60.0 ])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="EdgeSize", args=["inf", 60.0])] +) model.end() Reference = { @@ -45,12 +47,15 @@ Reference = { model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"): False, model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"): False, model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"): False, - model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): False} + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): False, +} model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "sup" , 60.0 ])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="EdgeSize", args=["sup", 60.0])] +) model.end() Reference = { @@ -65,12 +70,15 @@ Reference = { model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"): True, model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"): True, model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"): True, - model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): True} + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): True, +} model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "inf" , 50.0 ])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="EdgeSize", args=["inf", 50.0])] +) model.end() Reference = { @@ -85,12 +93,15 @@ Reference = { model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"): False, model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"): False, model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"): False, - model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): False} + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): False, +} model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "infEq" , 50.0 ])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="EdgeSize", args=["infEq", 50.0])] +) model.end() Reference = { @@ -105,12 +116,15 @@ Reference = { model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"): False, model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"): False, model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"): False, - model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): False} + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): False, +} model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "supEq" , 50.0 ])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="EdgeSize", args=["supEq", 50.0])] +) model.end() Reference = { @@ -125,12 +139,15 @@ Reference = { model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"): True, model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"): True, model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"): True, - model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): True} + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): True, +} model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "isBetween" , 50.0 , 200.0])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="EdgeSize", args=["isBetween", 50.0, 200.0])] +) model.end() Reference = { @@ -145,12 +162,16 @@ Reference = { model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"): True, model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"): True, model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"): True, - model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): True} + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): True, +} model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "isStrictlyBetween" , 50.0 , 200.0])]) +Filters = model.filters( + Part_1_doc, + [model.addFilter(name="EdgeSize", args=["isStrictlyBetween", 50.0, 200.0])], +) model.end() Reference = { @@ -165,6 +186,7 @@ Reference = { model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"): True, model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"): True, model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"): True, - model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): True} + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): True, +} model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_ExternalFaces1.py b/src/FiltersPlugin/Test/TestFilter_ExternalFaces1.py index 37a149368..2909bf8b8 100644 --- a/src/FiltersPlugin/Test/TestFilter_ExternalFaces1.py +++ b/src/FiltersPlugin/Test/TestFilter_ExternalFaces1.py @@ -25,35 +25,66 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "ExternalFaces")]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], + keepSubResults=True, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, +) +Filters = model.filters(Part_1_doc, [model.addFilter(name="ExternalFaces")]) model.end() Reference = {} # Faces of the box ResultBox_1 = Partition_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() # Faces of the cylinder ResultCylinder_1 = Translation_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) Reference = { diff --git a/src/FiltersPlugin/Test/TestFilter_ExternalFaces2.py b/src/FiltersPlugin/Test/TestFilter_ExternalFaces2.py index 3c5855e7a..1f72ecbc4 100644 --- a/src/FiltersPlugin/Test/TestFilter_ExternalFaces2.py +++ b/src/FiltersPlugin/Test/TestFilter_ExternalFaces2.py @@ -26,44 +26,86 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) SketchLine_1 = Sketch_1.addLine(15, 2, 5, 2) SketchLine_2 = Sketch_1.addLine(5, 2, 5, 8) SketchLine_3 = Sketch_1.addLine(5, 8, 15, 8) SketchLine_4 = Sketch_1.addLine(15, 8, 15, 2) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), 5, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), 15, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), 2, True) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.result(), 8, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), 5, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), 15, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), 2, True +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.result(), 8, True +) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")]) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Face_1_1")], keepSubResults = True) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "ExternalFaces")]) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Face_1_1")], + keepSubResults=True, +) +Filters = model.filters(Part_1_doc, [model.addFilter(name="ExternalFaces")]) model.end() Reference = {} ResultPartition = Partition_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultPartition.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultPartition, exp.current())] = True; exp.next() -Reference[model.selection(ResultPartition, exp.current())] = True; exp.next() -Reference[model.selection(ResultPartition, exp.current())] = True; exp.next() -Reference[model.selection(ResultPartition, exp.current())] = True; exp.next() -Reference[model.selection(ResultPartition, exp.current())] = True; exp.next() -Reference[model.selection(ResultPartition, exp.current())] = True; exp.next() -Reference[model.selection(ResultPartition, exp.current())] = False; exp.next() -Reference[model.selection(ResultPartition, exp.current())] = True; exp.next() -assert(not exp.more()) +Reference[model.selection(ResultPartition, exp.current())] = True +exp.next() +Reference[model.selection(ResultPartition, exp.current())] = True +exp.next() +Reference[model.selection(ResultPartition, exp.current())] = True +exp.next() +Reference[model.selection(ResultPartition, exp.current())] = True +exp.next() +Reference[model.selection(ResultPartition, exp.current())] = True +exp.next() +Reference[model.selection(ResultPartition, exp.current())] = True +exp.next() +Reference[model.selection(ResultPartition, exp.current())] = False +exp.next() +Reference[model.selection(ResultPartition, exp.current())] = True +exp.next() +assert not exp.more() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_ExternalFaces_Exclude1.py b/src/FiltersPlugin/Test/TestFilter_ExternalFaces_Exclude1.py index 8eb4962e4..30c46ab81 100644 --- a/src/FiltersPlugin/Test/TestFilter_ExternalFaces_Exclude1.py +++ b/src/FiltersPlugin/Test/TestFilter_ExternalFaces_Exclude1.py @@ -25,35 +25,68 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "ExternalFaces", exclude = True)]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], + keepSubResults=True, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, +) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="ExternalFaces", exclude=True)] +) model.end() Reference = {} # Faces of the box ResultBox_1 = Partition_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() # Faces of the cylinder ResultCylinder_1 = Translation_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) Reference = { diff --git a/src/FiltersPlugin/Test/TestFilter_ExternalFaces_Exclude2.py b/src/FiltersPlugin/Test/TestFilter_ExternalFaces_Exclude2.py index 5eb5e967a..241903ba4 100644 --- a/src/FiltersPlugin/Test/TestFilter_ExternalFaces_Exclude2.py +++ b/src/FiltersPlugin/Test/TestFilter_ExternalFaces_Exclude2.py @@ -26,44 +26,88 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) SketchLine_1 = Sketch_1.addLine(15, 2, 5, 2) SketchLine_2 = Sketch_1.addLine(5, 2, 5, 8) SketchLine_3 = Sketch_1.addLine(5, 8, 15, 8) SketchLine_4 = Sketch_1.addLine(15, 8, 15, 2) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), 5, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), 15, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), 2, True) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.result(), 8, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.result(), 5, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), 15, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result(), 2, True +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.result(), 8, True +) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")]) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Face_1_1")], keepSubResults = True) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "ExternalFaces", exclude = True)]) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Face_1_1")], + keepSubResults=True, +) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="ExternalFaces", exclude=True)] +) model.end() Reference = {} ResultPartition = Partition_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultPartition.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultPartition, exp.current())] = False; exp.next() -Reference[model.selection(ResultPartition, exp.current())] = False; exp.next() -Reference[model.selection(ResultPartition, exp.current())] = False; exp.next() -Reference[model.selection(ResultPartition, exp.current())] = False; exp.next() -Reference[model.selection(ResultPartition, exp.current())] = False; exp.next() -Reference[model.selection(ResultPartition, exp.current())] = False; exp.next() -Reference[model.selection(ResultPartition, exp.current())] = True; exp.next() -Reference[model.selection(ResultPartition, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(ResultPartition, exp.current())] = False +exp.next() +Reference[model.selection(ResultPartition, exp.current())] = False +exp.next() +Reference[model.selection(ResultPartition, exp.current())] = False +exp.next() +Reference[model.selection(ResultPartition, exp.current())] = False +exp.next() +Reference[model.selection(ResultPartition, exp.current())] = False +exp.next() +Reference[model.selection(ResultPartition, exp.current())] = False +exp.next() +Reference[model.selection(ResultPartition, exp.current())] = True +exp.next() +Reference[model.selection(ResultPartition, exp.current())] = False +exp.next() +assert not exp.more() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_FaceSize.py b/src/FiltersPlugin/Test/TestFilter_FaceSize.py index da11eb39a..8558eb076 100644 --- a/src/FiltersPlugin/Test/TestFilter_FaceSize.py +++ b/src/FiltersPlugin/Test/TestFilter_FaceSize.py @@ -30,7 +30,9 @@ Part_1_doc = Part_1.document() ### Create Box Box_1 = model.addBox(Part_1_doc, 100, 50, 100) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "FaceSize", args = [ "inf" , 5000.0 ])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="FaceSize", args=["inf", 5000.0])] +) model.end() Reference = { @@ -38,13 +40,16 @@ Reference = { model.selection("FACE", "Box_1_1/Back"): False, model.selection("FACE", "Box_1_1/Front"): False, model.selection("FACE", "Box_1_1/Bottom"): False, - model.selection("FACE","Box_1_1/Right"): False, - model.selection("FACE","Box_1_1/Left"): False} + model.selection("FACE", "Box_1_1/Right"): False, + model.selection("FACE", "Box_1_1/Left"): False, +} model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "FaceSize", args = [ "infEq" , 5000.0 ])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="FaceSize", args=["infEq", 5000.0])] +) model.end() Reference = { @@ -53,12 +58,15 @@ Reference = { model.selection("FACE", "Box_1_1/Front"): True, model.selection("FACE", "Box_1_1/Bottom"): True, model.selection("FACE", "Box_1_1/Right"): False, - model.selection("FACE", "Box_1_1/Left"): False} + model.selection("FACE", "Box_1_1/Left"): False, +} model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "FaceSize", args = [ "sup" , 5000.0 ])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="FaceSize", args=["sup", 5000.0])] +) model.end() Reference = { @@ -67,12 +75,15 @@ Reference = { model.selection("FACE", "Box_1_1/Front"): False, model.selection("FACE", "Box_1_1/Bottom"): False, model.selection("FACE", "Box_1_1/Right"): True, - model.selection("FACE", "Box_1_1/Left"): True} + model.selection("FACE", "Box_1_1/Left"): True, +} model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "FaceSize", args = [ "inf" , 50.0 ])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="FaceSize", args=["inf", 50.0])] +) model.end() Reference = { @@ -81,12 +92,15 @@ Reference = { model.selection("FACE", "Box_1_1/Front"): False, model.selection("FACE", "Box_1_1/Bottom"): False, model.selection("FACE", "Box_1_1/Right"): False, - model.selection("FACE", "Box_1_1/Left"): False} + model.selection("FACE", "Box_1_1/Left"): False, +} model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "FaceSize", args = [ "supEq" , 5000.0 ])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="FaceSize", args=["supEq", 5000.0])] +) model.end() Reference = { @@ -95,12 +109,15 @@ Reference = { model.selection("FACE", "Box_1_1/Front"): True, model.selection("FACE", "Box_1_1/Bottom"): True, model.selection("FACE", "Box_1_1/Right"): True, - model.selection("FACE", "Box_1_1/Left"): True} + model.selection("FACE", "Box_1_1/Left"): True, +} model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "FaceSize", args = [ "supEq" , 7000.0 ])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="FaceSize", args=["supEq", 7000.0])] +) model.end() Reference = { @@ -109,12 +126,15 @@ Reference = { model.selection("FACE", "Box_1_1/Front"): False, model.selection("FACE", "Box_1_1/Bottom"): False, model.selection("FACE", "Box_1_1/Right"): True, - model.selection("FACE", "Box_1_1/Left"): True} + model.selection("FACE", "Box_1_1/Left"): True, +} model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "FaceSize", args = [ "isBetween" , 50.0 , 10000.0])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="FaceSize", args=["isBetween", 50.0, 10000.0])] +) model.end() Reference = { @@ -123,12 +143,16 @@ Reference = { model.selection("FACE", "Box_1_1/Front"): True, model.selection("FACE", "Box_1_1/Bottom"): True, model.selection("FACE", "Box_1_1/Right"): True, - model.selection("FACE", "Box_1_1/Left"): True} + model.selection("FACE", "Box_1_1/Left"): True, +} model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "FaceSize", args = [ "isStrictlyBetween" , 500.0 , 10000.0])]) +Filters = model.filters( + Part_1_doc, + [model.addFilter(name="FaceSize", args=["isStrictlyBetween", 500.0, 10000.0])], +) model.end() Reference = { @@ -137,6 +161,7 @@ Reference = { model.selection("FACE", "Box_1_1/Front"): True, model.selection("FACE", "Box_1_1/Bottom"): True, model.selection("FACE", "Box_1_1/Right"): False, - model.selection("FACE", "Box_1_1/Left"): False} + model.selection("FACE", "Box_1_1/Left"): False, +} model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_FeatureEdges.py b/src/FiltersPlugin/Test/TestFilter_FeatureEdges.py index d058ca27d..b5f4f3a63 100644 --- a/src/FiltersPlugin/Test/TestFilter_FeatureEdges.py +++ b/src/FiltersPlugin/Test/TestFilter_FeatureEdges.py @@ -34,18 +34,25 @@ Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) ### Create Chamfer -Chamfer_1 = model.addChamfer(Part_1_doc, [model.selection("FACE", "Box_1_1/Left")], True, 2, 2, keepSubResults = True) +Chamfer_1 = model.addChamfer( + Part_1_doc, + [model.selection("FACE", "Box_1_1/Left")], + True, + 2, + 2, + keepSubResults=True, +) model.do() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "FeatureEdges", args = [ 5.0 ])]) +Filters = model.filters(Part_1_doc, [model.addFilter(name="FeatureEdges", args=[5.0])]) model.end() Reference = {} ResultChamfer_1_1 = Chamfer_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultChamfer_1_1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResultChamfer_1_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultChamfer_1_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) model.do() @@ -60,17 +67,19 @@ Part_2_doc = Part_2.document() Box_2 = model.addBox(Part_2_doc, 10, 10, 10) ### Create Fillet -Fillet_1_objects_4 = [model.selection("FACE", "Box_1_1/Left"), - model.selection("FACE", "Box_1_1/Front"), - model.selection("FACE", "Box_1_1/Top"), - model.selection("FACE", "Box_1_1/Right"), - model.selection("FACE", "Box_1_1/Bottom")] -Fillet_1 = model.addFillet(Part_2_doc, Fillet_1_objects_4, 2, keepSubResults = True) +Fillet_1_objects_4 = [ + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Right"), + model.selection("FACE", "Box_1_1/Bottom"), +] +Fillet_1 = model.addFillet(Part_2_doc, Fillet_1_objects_4, 2, keepSubResults=True) model.end() model.do() -Filters = model.filters(Part_2_doc, [model.addFilter(name = "FeatureEdges", args = [ 5.0 ])]) +Filters = model.filters(Part_2_doc, [model.addFilter(name="FeatureEdges", args=[5.0])]) model.end() @@ -79,8 +88,8 @@ Reference = {} ResultFillet_1_1 = Fillet_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultFillet_1_1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResultFillet_1_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultFillet_1_1, exp.current())] = False + exp.next() model.checkFilter(Part_2_doc, model, Filters, Reference) ### Create Part @@ -91,34 +100,38 @@ Part_3_doc = Part_3.document() Box_3 = model.addBox(Part_3_doc, 10, 10, 10) ### Create Chamfer -Chamfer_1_objects = [model.selection("FACE", "Box_1_1/Left"), - model.selection("FACE", "Box_1_1/Front"), - model.selection("FACE", "Box_1_1/Top"), - model.selection("FACE", "Box_1_1/Right"), - model.selection("FACE", "Box_1_1/Bottom")] -Chamfer_2 = model.addChamfer(Part_3_doc, Chamfer_1_objects, False, 2, 43, keepSubResults = True) +Chamfer_1_objects = [ + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Top"), + model.selection("FACE", "Box_1_1/Right"), + model.selection("FACE", "Box_1_1/Bottom"), +] +Chamfer_2 = model.addChamfer( + Part_3_doc, Chamfer_1_objects, False, 2, 43, keepSubResults=True +) model.end() model.do() -Filters = model.filters(Part_3_doc, [model.addFilter(name = "FeatureEdges", args = [ 30.0 ])]) +Filters = model.filters(Part_3_doc, [model.addFilter(name="FeatureEdges", args=[30.0])]) model.end() Reference = {} ResultChamfer_2_1 = Chamfer_2.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultChamfer_2_1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResultChamfer_2_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultChamfer_2_1, exp.current())] = True + exp.next() model.checkFilter(Part_3_doc, model, Filters, Reference) model.do() -Filters = model.filters(Part_3_doc, [model.addFilter(name = "FeatureEdges", args = [ 50.0 ])]) +Filters = model.filters(Part_3_doc, [model.addFilter(name="FeatureEdges", args=[50.0])]) model.end() Reference = {} exp = GeomAPI_ShapeExplorer(ResultChamfer_2_1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResultChamfer_2_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultChamfer_2_1, exp.current())] = False + exp.next() model.checkFilter(Part_3_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_HorizontalFaces.py b/src/FiltersPlugin/Test/TestFilter_HorizontalFaces.py index 9cb6dd6df..71a7a2b1d 100644 --- a/src/FiltersPlugin/Test/TestFilter_HorizontalFaces.py +++ b/src/FiltersPlugin/Test/TestFilter_HorizontalFaces.py @@ -24,10 +24,30 @@ 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/OX"), 20, 2, model.selection("EDGE", "PartSet/OY"), 20, 3) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 50) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "HorizontalFaces")]) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, + model.selection("EDGE", "PartSet/OY"), + 20, + 3, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 50, +) +Filters = model.filters(Part_1_doc, [model.addFilter(name="HorizontalFaces")]) model.end() Reference = { @@ -57,7 +77,13 @@ Reference = { model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): True, # Edges and vertices are not applicable - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): False, - } + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): False, +} model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_HorizontalFaces_Exclude.py b/src/FiltersPlugin/Test/TestFilter_HorizontalFaces_Exclude.py index 3f1bb9376..dc6f0e8f2 100644 --- a/src/FiltersPlugin/Test/TestFilter_HorizontalFaces_Exclude.py +++ b/src/FiltersPlugin/Test/TestFilter_HorizontalFaces_Exclude.py @@ -24,10 +24,32 @@ 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/OX"), 20, 2, model.selection("EDGE", "PartSet/OY"), 20, 3) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 50) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "HorizontalFaces", exclude = True)]) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, + model.selection("EDGE", "PartSet/OY"), + 20, + 3, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 50, +) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="HorizontalFaces", exclude=True)] +) model.end() Reference = { @@ -57,7 +79,13 @@ Reference = { model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): False, # Edges and vertices are not applicable - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True, - } + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): True, +} model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge1.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge1.py index 22783fd9a..e1ab15872 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge1.py +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge1.py @@ -25,11 +25,47 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20) -FilterFace = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", args = [model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Front]")])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], + keepSubResults=True, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, +) +FilterFace = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnGeometry", + args=[ + model.selection( + "EDGE", + "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front", + ), + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Front]", + ), + ], + ) + ], +) model.end() Reference = {} @@ -37,80 +73,128 @@ Reference = {} ResultBox_1 = Partition_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() # Faces of the cylinder ResultCylinder_1 = Translation_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() # Edges of the original box (selected as a sub-shapes of the result to keep original surface). # Note: the expected values have to be updated if ShapeExplorer will return another order of sub-shapes. exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.EDGE) -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -assert(not exp.more()) +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +assert not exp.more() # Edges of the cylinder exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() # Vertices of the original box exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() # Vertices of the cylinder exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, FilterFace, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge2.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge2.py index 136ffc0f4..1be6a5470 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge2.py +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge2.py @@ -28,19 +28,48 @@ Part_1_doc = Part_1.document() Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 100, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 80) -SketchLine_1 = Sketch_1.addLine(-70.03988514133886, -38.65765757761403, 65.03214823048954, -46.59205615260649) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) -SketchLine_2 = Sketch_1.addLine(6.89273184263731, -79.70251092497334, 48.24895637932232, 63.81252391424628) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1]) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchLine_1 = Sketch_1.addLine( + -70.03988514133886, -38.65765757761403, 65.03214823048954, -46.59205615260649 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) +SketchLine_2 = Sketch_1.addLine( + 6.89273184263731, -79.70251092497334, 48.24895637932232, 63.81252391424628 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchCircle_1.results()[1] +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 80) Extrusion_1.setNestedSketch(Sketch_1) model.do() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", args = [model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_3/To_Face]")])]) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnGeometry", + args=[ + model.selection( + "EDGE", + "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_3/To_Face]", + ) + ], + ) + ], +) model.end() Reference = {} @@ -48,119 +77,197 @@ Reference = {} ResultExtrusion = Extrusion_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.EDGE) # edges of face 1 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # edges of face 2 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # edges of face 3 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # edges of face 4 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # edges of face 5 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # edges of face 6 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +assert not exp.more() # Extrusion Solid 2 ResultExtrusion = Extrusion_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.EDGE) # edges of face 1 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # edges of face 2 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # edges of face 3 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # edges of face 4 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # edges of face 5 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +assert not exp.more() # Extrusion Solid 3 ResultExtrusion = Extrusion_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.EDGE) # edges of face 1 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # edges of face 2 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # edges of face 3 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # edges of face 4 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # edges of face 5 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +assert not exp.more() # Extrusion Solid 4 ResultExtrusion = Extrusion_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.EDGE) # edges of face 1 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # edges of face 2 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # edges of face 3 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # edges of face 4 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # edges of face 5 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +assert not exp.more() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge1.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge1.py index f1caab113..f76ffb214 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge1.py +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge1.py @@ -25,11 +25,48 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20) -FilterFace = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", exclude = True, args = [model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Front]")])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], + keepSubResults=True, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, +) +FilterFace = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnGeometry", + exclude=True, + args=[ + model.selection( + "EDGE", + "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front", + ), + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Front]", + ), + ], + ) + ], +) model.end() Reference = {} @@ -37,80 +74,128 @@ Reference = {} ResultBox_1 = Partition_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() # Faces of the cylinder ResultCylinder_1 = Translation_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() # Edges of the original box (selected as a sub-shapes of the result to keep original surface). # Note: the expected values have to be updated if ShapeExplorer will return another order of sub-shapes. exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.EDGE) -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +assert not exp.more() # Edges of the cylinder exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() # Vertices of the original box exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() # Vertices of the cylinder exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, FilterFace, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge2.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge2.py index 23c2a7765..9b03ac292 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge2.py +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge2.py @@ -28,19 +28,49 @@ Part_1_doc = Part_1.document() Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 100, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 80) -SketchLine_1 = Sketch_1.addLine(-70.03988514133886, -38.65765757761403, 65.03214823048954, -46.59205615260649) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) -SketchLine_2 = Sketch_1.addLine(6.89273184263731, -79.70251092497334, 48.24895637932232, 63.81252391424628) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1]) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchLine_1 = Sketch_1.addLine( + -70.03988514133886, -38.65765757761403, 65.03214823048954, -46.59205615260649 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) +SketchLine_2 = Sketch_1.addLine( + 6.89273184263731, -79.70251092497334, 48.24895637932232, 63.81252391424628 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchCircle_1.results()[1] +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 80) Extrusion_1.setNestedSketch(Sketch_1) model.do() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", exclude = True, args = [model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_3/To_Face]")])]) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnGeometry", + exclude=True, + args=[ + model.selection( + "EDGE", + "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_3/To_Face]", + ) + ], + ) + ], +) model.end() Reference = {} @@ -48,119 +78,197 @@ Reference = {} ResultExtrusion = Extrusion_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.EDGE) # edges of face 1 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # edges of face 2 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # edges of face 3 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # edges of face 4 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # edges of face 5 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # edges of face 6 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -assert(not exp.more()) +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +assert not exp.more() # Extrusion Solid 2 ResultExtrusion = Extrusion_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.EDGE) # edges of face 1 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # edges of face 2 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # edges of face 3 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # edges of face 4 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # edges of face 5 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -assert(not exp.more()) +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +assert not exp.more() # Extrusion Solid 3 ResultExtrusion = Extrusion_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.EDGE) # edges of face 1 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # edges of face 2 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # edges of face 3 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # edges of face 4 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # edges of face 5 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -assert(not exp.more()) +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +assert not exp.more() # Extrusion Solid 4 ResultExtrusion = Extrusion_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.EDGE) # edges of face 1 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # edges of face 2 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # edges of face 3 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # edges of face 4 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # edges of face 5 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -assert(not exp.more()) +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +assert not exp.more() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face1.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face1.py index 7de495d20..490f4da64 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face1.py +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face1.py @@ -25,11 +25,39 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20) -FilterFace = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", exclude = True, args = [model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Top")])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], + keepSubResults=True, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, +) +FilterFace = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnGeometry", + exclude=True, + args=[model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Top")], + ) + ], +) model.end() Reference = {} @@ -37,45 +65,60 @@ Reference = {} # Note: the expected values have to be updated if ShapeExplorer will return another order of sub-shapes. ResultBox_1 = Partition_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -assert(not exp.more()) +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +assert not exp.more() # Faces of the cylinder ResultCylinder_1 = Translation_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultCylinder_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultCylinder_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultCylinder_1, exp.current())] = True; exp.next() -assert(not exp.more()) +Reference[model.selection(ResultCylinder_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = True +exp.next() +assert not exp.more() # Edges of the original box exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() # Edges of the cylinder exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() # Vertices of the original box exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() # Vertices of the cylinder exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, FilterFace, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face2.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face2.py index 6e7843e5b..e2bc40604 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face2.py +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face2.py @@ -28,40 +28,89 @@ Part_1_doc = Part_1.document() Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 100, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 80) -SketchLine_1 = Sketch_1.addLine(-70.03988514133886, -38.65765757761403, 65.03214823048954, -46.59205615260649) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) -SketchLine_2 = Sketch_1.addLine(6.89273184263731, -79.70251092497334, 48.24895637932232, 63.81252391424628) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1]) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchLine_1 = Sketch_1.addLine( + -70.03988514133886, -38.65765757761403, 65.03214823048954, -46.59205615260649 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) +SketchLine_2 = Sketch_1.addLine( + 6.89273184263731, -79.70251092497334, 48.24895637932232, 63.81252391424628 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchCircle_1.results()[1] +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 80) Extrusion_1.setNestedSketch(Sketch_1) -Revolution_1 = model.addRevolution(Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 270, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 270, 0 +) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_3 = Sketch_2.addLine(80, -20, 20, -20) SketchLine_4 = Sketch_2.addLine(20, -20, 20, -100) SketchLine_5 = Sketch_2.addLine(20, -100, 80, -100) SketchLine_6 = Sketch_2.addLine(80, -100, 80, -20) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_6.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_6.result(), 80, True) -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_4.result(), 20, True) -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_3.result(), 20, True) -SketchConstraintDistance_4 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_5.result(), 100, True) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_6.result(), 80, True +) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_4.result(), 20, True +) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_3.result(), 20, True +) +SketchConstraintDistance_4 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_5.result(), 100, True +) Revolution_1.setNestedSketch(Sketch_2) model.do() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", exclude = True, args = [model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2")])]) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnGeometry", + exclude=True, + args=[ + model.selection( + "FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2" + ) + ], + ) + ], +) model.end() Reference = {} @@ -69,38 +118,65 @@ Reference = {} ResultExtrusion = Extrusion_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.FACE) # faces of solid 1 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # faces of solid 2 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # faces of solid 3 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # faces of solid 4 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # Revolution ResultRevolution = Revolution_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultRevolution.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultRevolution, exp.current())] = True; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = True; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = True; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = True; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = True; exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = True +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = True +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = True +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = False +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = True +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = True +exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face3.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face3.py index 7a6479d93..83a64248b 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face3.py +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face3.py @@ -28,40 +28,85 @@ Part_1_doc = Part_1.document() Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 100, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 80) -SketchLine_1 = Sketch_1.addLine(-70.03988514133886, -38.65765757761403, 65.03214823048954, -46.59205615260649) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) -SketchLine_2 = Sketch_1.addLine(6.89273184263731, -79.70251092497334, 48.24895637932232, 63.81252391424628) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1]) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchLine_1 = Sketch_1.addLine( + -70.03988514133886, -38.65765757761403, 65.03214823048954, -46.59205615260649 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) +SketchLine_2 = Sketch_1.addLine( + 6.89273184263731, -79.70251092497334, 48.24895637932232, 63.81252391424628 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchCircle_1.results()[1] +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 80) Extrusion_1.setNestedSketch(Sketch_1) -Revolution_1 = model.addRevolution(Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 270, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 270, 0 +) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_3 = Sketch_2.addLine(80, -20, 20, -20) SketchLine_4 = Sketch_2.addLine(20, -20, 20, -100) SketchLine_5 = Sketch_2.addLine(20, -100, 80, -100) SketchLine_6 = Sketch_2.addLine(80, -100, 80, -20) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_6.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_6.result(), 80, True) -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_4.result(), 20, True) -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_3.result(), 20, True) -SketchConstraintDistance_4 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_5.result(), 100, True) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_6.result(), 80, True +) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_4.result(), 20, True +) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_3.result(), 20, True +) +SketchConstraintDistance_4 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_5.result(), 100, True +) Revolution_1.setNestedSketch(Sketch_2) model.do() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", exclude = True, args = [model.selection("FACE", "Extrusion_1_1_3/To_Face")])]) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnGeometry", + exclude=True, + args=[model.selection("FACE", "Extrusion_1_1_3/To_Face")], + ) + ], +) model.end() Reference = {} @@ -69,38 +114,65 @@ Reference = {} ResultExtrusion = Extrusion_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.FACE) # faces of solid 1 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # faces of solid 2 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # faces of solid 3 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # faces of solid 4 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # Revolution ResultRevolution = Revolution_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultRevolution.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultRevolution, exp.current())] = True; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = True; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = True; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = True; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = True; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = True; exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = True +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = True +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = True +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = True +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = True +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = True +exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face4.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face4.py index c0f5691bc..02e9c30d8 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face4.py +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face4.py @@ -24,21 +24,61 @@ 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, 45) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, + 45, +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Cylinder_1_1/Face_4")) -SketchArc_1 = Sketch_1.addArc(2.402631123626777, 4.538350751693263, 2.946623076146047, 2.768866376496988, 3.159520035183744, 6.227765257973941, False) +SketchArc_1 = Sketch_1.addArc( + 2.402631123626777, + 4.538350751693263, + 2.946623076146047, + 2.768866376496988, + 3.159520035183744, + 6.227765257973941, + False, +) model.do() 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/OZ"), 0, 90) -FiltersCyl = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", exclude = True, args = [model.selection("FACE", "Cylinder_1_1/Face_1")])]) -FiltersRev = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", exclude = True, args = [model.selection("FACE", "Revolution_1_1")])]) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 0, + 90, +) +FiltersCyl = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnGeometry", + exclude=True, + args=[model.selection("FACE", "Cylinder_1_1/Face_1")], + ) + ], +) +FiltersRev = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnGeometry", + exclude=True, + args=[model.selection("FACE", "Revolution_1_1")], + ) + ], +) model.end() Reference = {} ResultRevolution = Revolution_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultRevolution.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultRevolution, exp.current())] = True; exp.next() -assert(not exp.more()) +Reference[model.selection(ResultRevolution, exp.current())] = True +exp.next() +assert not exp.more() model.checkFilter(Part_1_doc, model, FiltersCyl, Reference) @@ -46,7 +86,7 @@ Reference = {} ResultCylinder = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, FiltersRev, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face1.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face1.py index 01eef585e..f285c35bc 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face1.py +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face1.py @@ -25,11 +25,38 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20) -FilterFace = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", args = [model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Top")])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], + keepSubResults=True, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, +) +FilterFace = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnGeometry", + args=[model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Top")], + ) + ], +) model.end() Reference = {} @@ -37,45 +64,60 @@ Reference = {} # Note: the expected values have to be updated if ShapeExplorer will return another order of sub-shapes. ResultBox_1 = Partition_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +assert not exp.more() # Faces of the cylinder ResultCylinder_1 = Translation_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultCylinder_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultCylinder_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultCylinder_1, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(ResultCylinder_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = False +exp.next() +assert not exp.more() # Edges of the original box exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() # Edges of the cylinder exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() # Vertices of the original box exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() # Vertices of the cylinder exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, FilterFace, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face2.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face2.py index 2f7a756fa..abf65f487 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face2.py +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face2.py @@ -28,40 +28,88 @@ Part_1_doc = Part_1.document() Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 100, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 80) -SketchLine_1 = Sketch_1.addLine(-70.03988514133886, -38.65765757761403, 65.03214823048954, -46.59205615260649) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) -SketchLine_2 = Sketch_1.addLine(6.89273184263731, -79.70251092497334, 48.24895637932232, 63.81252391424628) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1]) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchLine_1 = Sketch_1.addLine( + -70.03988514133886, -38.65765757761403, 65.03214823048954, -46.59205615260649 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) +SketchLine_2 = Sketch_1.addLine( + 6.89273184263731, -79.70251092497334, 48.24895637932232, 63.81252391424628 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchCircle_1.results()[1] +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 80) Extrusion_1.setNestedSketch(Sketch_1) -Revolution_1 = model.addRevolution(Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 270, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 270, 0 +) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_3 = Sketch_2.addLine(80, -20, 20, -20) SketchLine_4 = Sketch_2.addLine(20, -20, 20, -100) SketchLine_5 = Sketch_2.addLine(20, -100, 80, -100) SketchLine_6 = Sketch_2.addLine(80, -100, 80, -20) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_6.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_6.result(), 80, True) -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_4.result(), 20, True) -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_3.result(), 20, True) -SketchConstraintDistance_4 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_5.result(), 100, True) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_6.result(), 80, True +) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_4.result(), 20, True +) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_3.result(), 20, True +) +SketchConstraintDistance_4 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_5.result(), 100, True +) Revolution_1.setNestedSketch(Sketch_2) model.do() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", args = [model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2")])]) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnGeometry", + args=[ + model.selection( + "FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2" + ) + ], + ) + ], +) model.end() Reference = {} @@ -69,38 +117,65 @@ Reference = {} ResultExtrusion = Extrusion_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.FACE) # faces of solid 1 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # faces of solid 2 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # faces of solid 3 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # faces of solid 4 -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() # Revolution ResultRevolution = Revolution_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultRevolution.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = True; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = False +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = False +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = False +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = True +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = False +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = False +exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face3.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face3.py index 1f54ba441..2e3d65bcb 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face3.py +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face3.py @@ -28,40 +28,83 @@ Part_1_doc = Part_1.document() Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 100, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 80) -SketchLine_1 = Sketch_1.addLine(-70.03988514133886, -38.65765757761403, 65.03214823048954, -46.59205615260649) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) -SketchLine_2 = Sketch_1.addLine(6.89273184263731, -79.70251092497334, 48.24895637932232, 63.81252391424628) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1]) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchLine_1 = Sketch_1.addLine( + -70.03988514133886, -38.65765757761403, 65.03214823048954, -46.59205615260649 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) +SketchLine_2 = Sketch_1.addLine( + 6.89273184263731, -79.70251092497334, 48.24895637932232, 63.81252391424628 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchCircle_1.results()[1] +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 80) Extrusion_1.setNestedSketch(Sketch_1) -Revolution_1 = model.addRevolution(Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 270, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 270, 0 +) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_3 = Sketch_2.addLine(80, -20, 20, -20) SketchLine_4 = Sketch_2.addLine(20, -20, 20, -100) SketchLine_5 = Sketch_2.addLine(20, -100, 80, -100) SketchLine_6 = Sketch_2.addLine(80, -100, 80, -20) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_6.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_6.result(), 80, True) -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_4.result(), 20, True) -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_3.result(), 20, True) -SketchConstraintDistance_4 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_5.result(), 100, True) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_6.result(), 80, True +) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_4.result(), 20, True +) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_3.result(), 20, True +) +SketchConstraintDistance_4 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_5.result(), 100, True +) Revolution_1.setNestedSketch(Sketch_2) model.do() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", args = [model.selection("FACE", "Extrusion_1_1_3/To_Face")])]) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnGeometry", args=[model.selection("FACE", "Extrusion_1_1_3/To_Face")] + ) + ], +) model.end() Reference = {} @@ -69,38 +112,65 @@ Reference = {} ResultExtrusion = Extrusion_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.FACE) # faces of solid 1 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # faces of solid 2 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # faces of solid 3 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # faces of solid 4 -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next() -Reference[model.selection(ResultExtrusion, exp.current())] = True; exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = False +exp.next() +Reference[model.selection(ResultExtrusion, exp.current())] = True +exp.next() # Revolution ResultRevolution = Revolution_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultRevolution.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next() -Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = False +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = False +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = False +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = False +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = False +exp.next() +Reference[model.selection(ResultRevolution, exp.current())] = False +exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face4.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face4.py index e3c006945..8364a7bc3 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face4.py +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face4.py @@ -24,21 +24,57 @@ 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, 45) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, + 45, +) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Cylinder_1_1/Face_4")) -SketchArc_1 = Sketch_1.addArc(2.402631123626777, 4.538350751693263, 2.946623076146047, 2.768866376496988, 3.159520035183744, 6.227765257973941, False) +SketchArc_1 = Sketch_1.addArc( + 2.402631123626777, + 4.538350751693263, + 2.946623076146047, + 2.768866376496988, + 3.159520035183744, + 6.227765257973941, + False, +) model.do() 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/OZ"), 0, 90) -FiltersCyl = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", args = [model.selection("FACE", "Cylinder_1_1/Face_1")])]) -FiltersRev = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", args = [model.selection("FACE", "Revolution_1_1")])]) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("EDGE", "Edge_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 0, + 90, +) +FiltersCyl = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnGeometry", args=[model.selection("FACE", "Cylinder_1_1/Face_1")] + ) + ], +) +FiltersRev = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnGeometry", args=[model.selection("FACE", "Revolution_1_1")] + ) + ], +) model.end() Reference = {} ResultRevolution = Revolution_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultRevolution.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(ResultRevolution, exp.current())] = False +exp.next() +assert not exp.more() model.checkFilter(Part_1_doc, model, FiltersCyl, Reference) @@ -46,7 +82,7 @@ Reference = {} ResultCylinder = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, FiltersRev, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnLine.py b/src/FiltersPlugin/Test/TestFilter_OnLine.py index 74743d3a2..346dc9511 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnLine.py +++ b/src/FiltersPlugin/Test/TestFilter_OnLine.py @@ -24,10 +24,47 @@ 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/OX"), 20, 2, model.selection("EDGE", "PartSet/OY"), 20, 3) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 50) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnLine", args = [model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_4/MF:Translated&Box_1_1/Front][LinearCopy_1_1_4/MF:Translated&Box_1_1/Top]")])]) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, + model.selection("EDGE", "PartSet/OY"), + 20, + 3, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 50, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnLine", + args=[ + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_4/MF:Translated&Box_1_1/Front][LinearCopy_1_1_4/MF:Translated&Box_1_1/Top]", + ), + ], + ) + ], +) model.end() Reference = { @@ -42,52 +79,181 @@ Reference = { model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): False, # Edges of the original box - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): False, # Edges of translated box - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Left][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]"): True, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Right][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]"): False, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]"): True, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]"): False, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Left]"): False, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Left]"): False, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Right]"): False, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Right]"): False, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Left][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Right][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]"): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Left][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Right][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Left]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Left]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Right]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Right]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Left][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Right][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]", + ): False, # Edges of the cylinder - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): False, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): False, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): False, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): False, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): False, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): False, # Vertices of the original box - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): False, # Vertices of translated box - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]"): False, - } + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]", + ): False, +} model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnLine_Exclude.py b/src/FiltersPlugin/Test/TestFilter_OnLine_Exclude.py index 1ca45579c..b9dad8faf 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnLine_Exclude.py +++ b/src/FiltersPlugin/Test/TestFilter_OnLine_Exclude.py @@ -24,10 +24,48 @@ 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/OX"), 20, 2, model.selection("EDGE", "PartSet/OY"), 20, 3) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 50) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnLine", exclude = True, args = [model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_4/MF:Translated&Box_1_1/Front][LinearCopy_1_1_4/MF:Translated&Box_1_1/Top]")])]) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, + model.selection("EDGE", "PartSet/OY"), + 20, + 3, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 50, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnLine", + exclude=True, + args=[ + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ), + model.selection( + "EDGE", + "[LinearCopy_1_1_4/MF:Translated&Box_1_1/Front][LinearCopy_1_1_4/MF:Translated&Box_1_1/Top]", + ), + ], + ) + ], +) model.end() Reference = { @@ -42,52 +80,181 @@ Reference = { model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): True, # Edges of the original box - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): True, # Edges of translated box - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Left][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]"): False, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Right][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]"): True, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]"): False, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]"): True, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Left]"): True, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Left]"): True, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Right]"): True, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Right]"): True, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Left][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Right][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]"): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Left][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Right][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Left]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Left]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Right]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Right]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Left][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Right][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_2/MF:Translated&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom]", + ): True, # Edges of the cylinder - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): True, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): True, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): True, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): True, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): True, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): True, # Vertices of the original box - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): True, # Vertices of translated box - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]"): True, - } + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]", + ): True, +} model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnLine_Multi.py b/src/FiltersPlugin/Test/TestFilter_OnLine_Multi.py index 76a935310..366b0132a 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnLine_Multi.py +++ b/src/FiltersPlugin/Test/TestFilter_OnLine_Multi.py @@ -26,9 +26,25 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) # two filters with two edges each -Filters = model.filters(Part_1_doc, [ - model.addFilter(name = "OnLine", args = [model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]")]), - model.addFilter(name = "OnLine", args = [model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]")])]) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnLine", + args=[ + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), + ], + ), + model.addFilter( + name="OnLine", + args=[ + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), + ], + ), + ], +) model.end() # 2 vertices on intersection of edges @@ -40,7 +56,7 @@ Reference = { model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"): False, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"): False, model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]"): True, - model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]"): False + model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]"): False, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnPlane.py b/src/FiltersPlugin/Test/TestFilter_OnPlane.py index 5f104971f..7a95a668a 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnPlane.py +++ b/src/FiltersPlugin/Test/TestFilter_OnPlane.py @@ -24,10 +24,41 @@ 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/OX"), 20, 2, model.selection("EDGE", "PartSet/OY"), 20, 3) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 50) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnPlane", args = [model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Top"), model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Left")])]) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, + model.selection("EDGE", "PartSet/OY"), + 20, + 3, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 50, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnPlane", + args=[ + model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Top"), + model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Left"), + ], + ) + ], +) model.end() Reference = { @@ -57,52 +88,181 @@ Reference = { model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): False, # Edges of the original box - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): False, # Edges of translated box - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Left][LinearCopy_1_1_6/MF:Translated&Box_1_1/Top]"): True, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Right][LinearCopy_1_1_6/MF:Translated&Box_1_1/Top]"): True, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Front][LinearCopy_1_1_6/MF:Translated&Box_1_1/Top]"): True, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Back][LinearCopy_1_1_6/MF:Translated&Box_1_1/Top]"): True, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Back][LinearCopy_1_1_6/MF:Translated&Box_1_1/Left]"): False, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Front][LinearCopy_1_1_6/MF:Translated&Box_1_1/Left]"): False, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Front][LinearCopy_1_1_6/MF:Translated&Box_1_1/Right]"): False, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Back][LinearCopy_1_1_6/MF:Translated&Box_1_1/Right]"): False, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Left][LinearCopy_1_1_6/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Right][LinearCopy_1_1_6/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Front][LinearCopy_1_1_6/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Back][LinearCopy_1_1_6/MF:Translated&Box_1_1/Bottom]"): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Left][LinearCopy_1_1_6/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Right][LinearCopy_1_1_6/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Front][LinearCopy_1_1_6/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Back][LinearCopy_1_1_6/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Back][LinearCopy_1_1_6/MF:Translated&Box_1_1/Left]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Front][LinearCopy_1_1_6/MF:Translated&Box_1_1/Left]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Front][LinearCopy_1_1_6/MF:Translated&Box_1_1/Right]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Back][LinearCopy_1_1_6/MF:Translated&Box_1_1/Right]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Left][LinearCopy_1_1_6/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Right][LinearCopy_1_1_6/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Front][LinearCopy_1_1_6/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Back][LinearCopy_1_1_6/MF:Translated&Box_1_1/Bottom]", + ): False, # Edges of the cylinder - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): True, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): False, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): True, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): True, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): False, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): True, # Vertices of the original box - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): False, # Vertices of translated box - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]"): False, - } + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]", + ): False, +} model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Exclude_Face.py b/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Exclude_Face.py index f02e6b909..1876be61e 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Exclude_Face.py +++ b/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Exclude_Face.py @@ -25,25 +25,73 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], + keepSubResults=True, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, +) Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(-15, 4, 10) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) SketchLine_1 = Sketch_1.addLine(-24.53939201417305, 7, -5.460607985826952, 7) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_1.result(), 3, True) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]"), False) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_1.result(), 3, True +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]", + ), + False, +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates(), 15) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 4) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates(), 15 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 4 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 15, 5) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnPlaneSide", exclude = True, args = [model.selection("FACE", "Partition_1_1_2/Modified_Face&Plane_1/Plane_1")])]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 15, 5 +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnPlaneSide", + exclude=True, + args=[ + model.selection("FACE", "Partition_1_1_2/Modified_Face&Plane_1/Plane_1") + ], + ) + ], +) model.end() ResultBox_1 = Partition_1.result().subResult(0).resultSubShapePair()[0] @@ -53,6 +101,7 @@ ResultExtrusion_1 = Extrusion_1.result().subResult(0).resultSubShapePair()[0] ResultExtrusion_2 = Extrusion_1.result().subResult(1).resultSubShapePair()[0] from GeomAPI import GeomAPI_Shape + emptyShape = GeomAPI_Shape() Reference = { @@ -78,92 +127,288 @@ Reference = { # Faces of the extrusion model.selection("FACE", "Extrusion_1_1_1/From_Face"): False, model.selection("FACE", "Extrusion_1_1_1/To_Face"): False, - model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1"): False, - model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2"): True, - model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1"): True, + model.selection( + "FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1" + ): False, + model.selection( + "FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2" + ): True, + model.selection( + "FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1" + ): True, model.selection("FACE", "Extrusion_1_1_2/From_Face"): True, model.selection("FACE", "Extrusion_1_1_2/To_Face"): True, - model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1"): True, - model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1" + ): True, + model.selection( + "FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2" + ): True, # Faces of the cylinder model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): False, # Edges of the box - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]"): False, - model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Back"): True, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Box_1_1/Left]"): False, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top]"): False, - model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Bottom"): True, - model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"): True, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left]"): False, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]"): False, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): False, - model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front"): True, - model.selection("EDGE", "[Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): False, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): False, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]"): True, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Box_1_1/Right]"): True, - model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Back"): True, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top]"): True, - model.selection("EDGE", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]"): True, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right]"): True, - model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"): True, - model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Bottom"): True, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): True, - model.selection("EDGE", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): True, - model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front"): True, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): True, + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]", + ): False, + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Back" + ): True, + model.selection( + "EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Box_1_1/Left]" + ): False, + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Bottom" + ): True, + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top" + ): True, + model.selection( + "EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left]" + ): False, + model.selection( + "EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]" + ): False, + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Partition_1_1_1/Modified_Face&Box_1_1/Front]", + ): False, + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front" + ): True, + model.selection( + "EDGE", "[Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]" + ): False, + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Front]", + ): False, + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]", + ): True, + model.selection( + "EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Box_1_1/Right]" + ): True, + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Back" + ): True, + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]" + ): True, + model.selection( + "EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right]" + ): True, + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top" + ): True, + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Bottom" + ): True, + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Front]", + ): True, + model.selection( + "EDGE", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Front]" + ): True, + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front" + ): True, + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Box_1_1/Front]", + ): True, # Edges of the extrusion - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][weak_name_2]"): True, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][weak_name_1]"): True, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]"): True, - 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]"): True, - 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/SketchCircle_1_2&weak_name_2]"): False, - 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/SketchLine_1]"): True, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]"): True, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][weak_name_2]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][weak_name_1]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]", + ): True, + 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]", + ): True, + 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/SketchCircle_1_2&weak_name_2]", + ): False, + 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/SketchLine_1]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]", + ): True, # Edges of the cylinder - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): False, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): False, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): False, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): False, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): False, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): False, # Vertices of the box - model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): False, - model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_4"): True, - model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left]"): False, - model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): False, - model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_2"): True, - model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_3"): True, - model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]"): False, - model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_1"): True, - model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_3"): True, - model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right]"): True, - model.selection("VERTEX", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): True, - model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_1"): True, - model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]"): True, - model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_2"): True, - model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_4"): True, - model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): True, + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]", + ): False, + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_4" + ): True, + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left]", + ): False, + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]", + ): False, + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_2" + ): True, + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_3" + ): True, + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]", + ): False, + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_1" + ): True, + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_3" + ): True, + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right]", + ): True, + model.selection( + "VERTEX", + "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Front]", + ): True, + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_1" + ): True, + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]", + ): True, + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_2" + ): True, + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_4" + ): True, + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Front]", + ): True, # Vertices of the extrusion - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]"): True, - model.selection("VERTEX", "[_weak_name_6_Extrusion_1_1_2]e[_weak_name_5_Extrusion_1_1_2]e[_weak_name_3_Extrusion_1_1_2]e"): True, - model.selection("VERTEX", "[_weak_name_1_Extrusion_1_1_2]e[_weak_name_5_Extrusion_1_1_2]e[_weak_name_3_Extrusion_1_1_2]e"): True, - model.selection("VERTEX", "[_weak_name_6_Extrusion_1_1_2]e[_weak_name_4_Extrusion_1_1_2]e[_weak_name_2_Extrusion_1_1_2]e"): True, - model.selection("VERTEX", "[_weak_name_1_Extrusion_1_1_2]e[_weak_name_4_Extrusion_1_1_2]e[_weak_name_2_Extrusion_1_1_2]e"): True, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[_weak_name_6_Extrusion_1_1_2]e[_weak_name_5_Extrusion_1_1_2]e[_weak_name_3_Extrusion_1_1_2]e", + ): True, + model.selection( + "VERTEX", + "[_weak_name_1_Extrusion_1_1_2]e[_weak_name_5_Extrusion_1_1_2]e[_weak_name_3_Extrusion_1_1_2]e", + ): True, + model.selection( + "VERTEX", + "[_weak_name_6_Extrusion_1_1_2]e[_weak_name_4_Extrusion_1_1_2]e[_weak_name_2_Extrusion_1_1_2]e", + ): True, + model.selection( + "VERTEX", + "[_weak_name_1_Extrusion_1_1_2]e[_weak_name_4_Extrusion_1_1_2]e[_weak_name_2_Extrusion_1_1_2]e", + ): True, # Vertices of the cylinder - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): False, - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): False, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): False, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): False, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Exclude_Plane.py b/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Exclude_Plane.py index 0ff9a9ca4..7984b5163 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Exclude_Plane.py +++ b/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Exclude_Plane.py @@ -25,25 +25,69 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], + keepSubResults=True, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, +) Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(-15, 4, 10) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) SketchLine_1 = Sketch_1.addLine(-24.53939201417305, 7, -5.460607985826952, 7) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_1.result(), 3, True) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]"), False) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_1.result(), 3, True +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]", + ), + False, +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates(), 15) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 4) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates(), 15 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 4 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 15, 5) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnPlaneSide", exclude = True, args = [model.selection("FACE", "Plane_1")])]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 15, 5 +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnPlaneSide", exclude=True, args=[model.selection("FACE", "Plane_1")] + ) + ], +) model.end() ResultBox_1 = Partition_1.result().subResult(0).resultSubShapePair()[0] @@ -53,6 +97,7 @@ ResultExtrusion_1 = Extrusion_1.result().subResult(0).resultSubShapePair()[0] ResultExtrusion_2 = Extrusion_1.result().subResult(1).resultSubShapePair()[0] from GeomAPI import GeomAPI_Shape + emptyShape = GeomAPI_Shape() Reference = { @@ -78,92 +123,288 @@ Reference = { # Faces of the extrusion model.selection("FACE", "Extrusion_1_1_1/From_Face"): False, model.selection("FACE", "Extrusion_1_1_1/To_Face"): False, - model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1"): False, - model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2"): True, - model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1"): True, + model.selection( + "FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1" + ): False, + model.selection( + "FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2" + ): True, + model.selection( + "FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1" + ): True, model.selection("FACE", "Extrusion_1_1_2/From_Face"): True, model.selection("FACE", "Extrusion_1_1_2/To_Face"): True, - model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1"): True, - model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1" + ): True, + model.selection( + "FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2" + ): True, # Faces of the cylinder model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): False, # Edges of the box - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]"): False, - model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Back"): True, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Box_1_1/Left]"): False, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top]"): False, - model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Bottom"): True, - model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"): True, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left]"): False, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]"): False, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): False, - model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front"): True, - model.selection("EDGE", "[Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): False, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): False, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]"): True, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Box_1_1/Right]"): True, - model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Back"): True, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top]"): True, - model.selection("EDGE", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]"): True, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right]"): True, - model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"): True, - model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Bottom"): True, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): True, - model.selection("EDGE", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): True, - model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front"): True, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): True, + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]", + ): False, + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Back" + ): True, + model.selection( + "EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Box_1_1/Left]" + ): False, + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Bottom" + ): True, + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top" + ): True, + model.selection( + "EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left]" + ): False, + model.selection( + "EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]" + ): False, + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Partition_1_1_1/Modified_Face&Box_1_1/Front]", + ): False, + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front" + ): True, + model.selection( + "EDGE", "[Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]" + ): False, + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Front]", + ): False, + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]", + ): True, + model.selection( + "EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Box_1_1/Right]" + ): True, + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Back" + ): True, + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]" + ): True, + model.selection( + "EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right]" + ): True, + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top" + ): True, + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Bottom" + ): True, + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Front]", + ): True, + model.selection( + "EDGE", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Front]" + ): True, + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front" + ): True, + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Box_1_1/Front]", + ): True, # Edges of the extrusion - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][weak_name_2]"): True, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][weak_name_1]"): True, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]"): True, - 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]"): True, - 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/SketchCircle_1_2&weak_name_2]"): False, - 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/SketchLine_1]"): True, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]"): True, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][weak_name_2]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][weak_name_1]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]", + ): True, + 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]", + ): True, + 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/SketchCircle_1_2&weak_name_2]", + ): False, + 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/SketchLine_1]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]", + ): True, # Edges of the cylinder - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): False, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): False, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): False, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): False, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): False, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): False, # Vertices of the box - model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): False, - model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_4"): True, - model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left]"): False, - model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): False, - model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_2"): True, - model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_3"): True, - model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]"): False, - model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_1"): True, - model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_3"): True, - model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right]"): True, - model.selection("VERTEX", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): True, - model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_1"): True, - model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]"): True, - model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_2"): True, - model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_4"): True, - model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): True, + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]", + ): False, + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_4" + ): True, + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left]", + ): False, + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]", + ): False, + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_2" + ): True, + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_3" + ): True, + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]", + ): False, + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_1" + ): True, + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_3" + ): True, + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right]", + ): True, + model.selection( + "VERTEX", + "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Front]", + ): True, + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_1" + ): True, + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]", + ): True, + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_2" + ): True, + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_4" + ): True, + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Front]", + ): True, # Vertices of the extrusion - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]"): True, - model.selection("VERTEX", "[_weak_name_6_Extrusion_1_1_2]e[_weak_name_5_Extrusion_1_1_2]e[_weak_name_3_Extrusion_1_1_2]e"): True, - model.selection("VERTEX", "[_weak_name_1_Extrusion_1_1_2]e[_weak_name_5_Extrusion_1_1_2]e[_weak_name_3_Extrusion_1_1_2]e"): True, - model.selection("VERTEX", "[_weak_name_6_Extrusion_1_1_2]e[_weak_name_4_Extrusion_1_1_2]e[_weak_name_2_Extrusion_1_1_2]e"): True, - model.selection("VERTEX", "[_weak_name_1_Extrusion_1_1_2]e[_weak_name_4_Extrusion_1_1_2]e[_weak_name_2_Extrusion_1_1_2]e"): True, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[_weak_name_6_Extrusion_1_1_2]e[_weak_name_5_Extrusion_1_1_2]e[_weak_name_3_Extrusion_1_1_2]e", + ): True, + model.selection( + "VERTEX", + "[_weak_name_1_Extrusion_1_1_2]e[_weak_name_5_Extrusion_1_1_2]e[_weak_name_3_Extrusion_1_1_2]e", + ): True, + model.selection( + "VERTEX", + "[_weak_name_6_Extrusion_1_1_2]e[_weak_name_4_Extrusion_1_1_2]e[_weak_name_2_Extrusion_1_1_2]e", + ): True, + model.selection( + "VERTEX", + "[_weak_name_1_Extrusion_1_1_2]e[_weak_name_4_Extrusion_1_1_2]e[_weak_name_2_Extrusion_1_1_2]e", + ): True, # Vertices of the cylinder - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): False, - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): False, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): False, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): False, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Face.py b/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Face.py index c5a2480c3..fe4be594e 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Face.py +++ b/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Face.py @@ -25,25 +25,72 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], + keepSubResults=True, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, +) Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(-15, 4, 10) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) SketchLine_1 = Sketch_1.addLine(-24.53939201417305, 7, -5.460607985826952, 7) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_1.result(), 3, True) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]"), False) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_1.result(), 3, True +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]", + ), + False, +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates(), 15) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 4) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates(), 15 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 4 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 15, 5) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnPlaneSide", args = [model.selection("FACE", "Partition_1_1_2/Modified_Face&Plane_1/Plane_1")])]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 15, 5 +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnPlaneSide", + args=[ + model.selection("FACE", "Partition_1_1_2/Modified_Face&Plane_1/Plane_1") + ], + ) + ], +) model.end() ResultBox_1 = Partition_1.result().subResult(0).resultSubShapePair()[0] @@ -53,6 +100,7 @@ ResultExtrusion_1 = Extrusion_1.result().subResult(0).resultSubShapePair()[0] ResultExtrusion_2 = Extrusion_1.result().subResult(1).resultSubShapePair()[0] from GeomAPI import GeomAPI_Shape + emptyShape = GeomAPI_Shape() Reference = { @@ -78,92 +126,288 @@ Reference = { # Faces of the extrusion model.selection("FACE", "Extrusion_1_1_1/From_Face"): True, model.selection("FACE", "Extrusion_1_1_1/To_Face"): True, - model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1"): True, - model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2"): False, - model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1"): False, + model.selection( + "FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1" + ): True, + model.selection( + "FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2" + ): False, + model.selection( + "FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1" + ): False, model.selection("FACE", "Extrusion_1_1_2/From_Face"): False, model.selection("FACE", "Extrusion_1_1_2/To_Face"): False, - model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1"): False, - model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1" + ): False, + model.selection( + "FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2" + ): False, # Faces of the cylinder model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): True, # Edges of the box - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]"): True, - model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Back"): False, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Box_1_1/Left]"): True, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top]"): True, - model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Bottom"): False, - model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"): False, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left]"): True, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]"): True, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): True, - model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front"): False, - model.selection("EDGE", "[Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): True, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): True, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]"): False, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Box_1_1/Right]"): False, - model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Back"): False, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top]"): False, - model.selection("EDGE", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]"): False, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right]"): False, - model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"): False, - model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Bottom"): False, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): False, - model.selection("EDGE", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): False, - model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front"): False, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): False, + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]", + ): True, + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Back" + ): False, + model.selection( + "EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Box_1_1/Left]" + ): True, + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Bottom" + ): False, + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top" + ): False, + model.selection( + "EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left]" + ): True, + model.selection( + "EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]" + ): True, + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Partition_1_1_1/Modified_Face&Box_1_1/Front]", + ): True, + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front" + ): False, + model.selection( + "EDGE", "[Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]" + ): True, + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Front]", + ): True, + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]", + ): False, + model.selection( + "EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Box_1_1/Right]" + ): False, + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Back" + ): False, + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]" + ): False, + model.selection( + "EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right]" + ): False, + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top" + ): False, + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Bottom" + ): False, + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Front]", + ): False, + model.selection( + "EDGE", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Front]" + ): False, + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front" + ): False, + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Box_1_1/Front]", + ): False, # Edges of the extrusion - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][weak_name_2]"): False, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][weak_name_1]"): False, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]"): False, - 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]"): False, - 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/SketchCircle_1_2&weak_name_2]"): True, - 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/SketchLine_1]"): False, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]"): False, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][weak_name_2]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][weak_name_1]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]", + ): False, + 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]", + ): False, + 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/SketchCircle_1_2&weak_name_2]", + ): True, + 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/SketchLine_1]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]", + ): False, # Edges of the cylinder - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): True, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): True, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): True, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): True, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): True, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): True, # Vertices of the box - model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): True, - model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_4"): False, - model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left]"): True, - model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): True, - model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_2"): False, - model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_3"): False, - model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]"): True, - model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_1"): False, - model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_3"): False, - model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right]"): False, - model.selection("VERTEX", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): False, - model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_1"): False, - model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]"): False, - model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_2"): False, - model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_4"): False, - model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): False, + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]", + ): True, + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_4" + ): False, + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left]", + ): True, + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]", + ): True, + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_2" + ): False, + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_3" + ): False, + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]", + ): True, + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_1" + ): False, + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_3" + ): False, + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right]", + ): False, + model.selection( + "VERTEX", + "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Front]", + ): False, + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_1" + ): False, + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]", + ): False, + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_2" + ): False, + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_4" + ): False, + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Front]", + ): False, # Vertices of the extrusion - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]"): False, - model.selection("VERTEX", "[_weak_name_6_Extrusion_1_1_2]e[_weak_name_5_Extrusion_1_1_2]e[_weak_name_3_Extrusion_1_1_2]e"): False, - model.selection("VERTEX", "[_weak_name_1_Extrusion_1_1_2]e[_weak_name_5_Extrusion_1_1_2]e[_weak_name_3_Extrusion_1_1_2]e"): False, - model.selection("VERTEX", "[_weak_name_6_Extrusion_1_1_2]e[_weak_name_4_Extrusion_1_1_2]e[_weak_name_2_Extrusion_1_1_2]e"): False, - model.selection("VERTEX", "[_weak_name_1_Extrusion_1_1_2]e[_weak_name_4_Extrusion_1_1_2]e[_weak_name_2_Extrusion_1_1_2]e"): False, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[_weak_name_6_Extrusion_1_1_2]e[_weak_name_5_Extrusion_1_1_2]e[_weak_name_3_Extrusion_1_1_2]e", + ): False, + model.selection( + "VERTEX", + "[_weak_name_1_Extrusion_1_1_2]e[_weak_name_5_Extrusion_1_1_2]e[_weak_name_3_Extrusion_1_1_2]e", + ): False, + model.selection( + "VERTEX", + "[_weak_name_6_Extrusion_1_1_2]e[_weak_name_4_Extrusion_1_1_2]e[_weak_name_2_Extrusion_1_1_2]e", + ): False, + model.selection( + "VERTEX", + "[_weak_name_1_Extrusion_1_1_2]e[_weak_name_4_Extrusion_1_1_2]e[_weak_name_2_Extrusion_1_1_2]e", + ): False, # Vertices of the cylinder - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): True, - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): True, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): True, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): True, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Multi.py b/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Multi.py index abfe036f1..38fc232a1 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Multi.py +++ b/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Multi.py @@ -28,61 +28,184 @@ SketchLine_1 = Sketch_1.addLine(20, 23, -19, 23) SketchLine_2 = Sketch_1.addLine(-19, 23, -19, -21) SketchLine_3 = Sketch_1.addLine(-19, -21, 20, -21) SketchLine_4 = Sketch_1.addLine(20, -21, 20, 23) -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()) +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(), 30, 0) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 20, [model.selection("SOLID", "Extrusion_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f", + ) + ], + model.selection(), + 30, + 0, +) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [], + model.selection(), + 0, + 20, + [model.selection("SOLID", "Extrusion_1_1")], +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) SketchLine_5 = Sketch_2.addLine(34, 36, -11, 36) SketchLine_6 = Sketch_2.addLine(-11, 36, -11, -10) SketchLine_7 = Sketch_2.addLine(-11, -10, 34, -10) SketchLine_8 = Sketch_2.addLine(34, -10, 34, 36) -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()) +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()) ExtrusionCut_1.setNestedSketch(Sketch_2) # two filters with different faces each, the second is reversed -Filters = model.filters(Part_1_doc, [ - model.addFilter(name = "OnPlaneSide", args = [model.selection("FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7")]), - model.addFilter(name = "OnPlaneSide", exclude = True, args = [model.selection("FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6")]), - model.addFilter(name = "OnPlaneSide", args = [model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face")])]) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnPlaneSide", + args=[ + model.selection( + "FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7" + ) + ], + ), + model.addFilter( + name="OnPlaneSide", + exclude=True, + args=[ + model.selection( + "FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6" + ) + ], + ), + model.addFilter( + name="OnPlaneSide", + args=[ + model.selection( + "FACE", "ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face" + ) + ], + ), + ], +) model.end() # 5 edges are in result Reference = { - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2]"): True, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]"): False, - model.selection("EDGE", "[Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7]"): False, - model.selection("EDGE", "([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4])([ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7])([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7])"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6][ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4]"): False, - model.selection("EDGE", "[Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6])([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4])([ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6][ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face])"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4]"): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2]", + ): True, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7]", + ): False, + model.selection( + "EDGE", + "([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4])([ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7])([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7])", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6][ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6])([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4])([ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6][ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face])", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4]", + ): False, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Plane.py b/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Plane.py index 15430cb0a..275159ffb 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Plane.py +++ b/src/FiltersPlugin/Test/TestFilter_OnPlaneSide_Plane.py @@ -25,25 +25,65 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], + keepSubResults=True, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, +) Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(-15, 4, 10) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) SketchLine_1 = Sketch_1.addLine(-24.53939201417305, 7, -5.460607985826952, 7) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_1.result(), 3, True) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]"), False) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_1.result(), 3, True +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]", + ), + False, +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates(), 15) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 4) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates(), 15 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 4 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 15, 5) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnPlaneSide", args = [model.selection("FACE", "Plane_1")])]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 15, 5 +) +Filters = model.filters( + Part_1_doc, + [model.addFilter(name="OnPlaneSide", args=[model.selection("FACE", "Plane_1")])], +) model.end() ResultBox_1 = Partition_1.result().subResult(0).resultSubShapePair()[0] @@ -53,6 +93,7 @@ ResultExtrusion_1 = Extrusion_1.result().subResult(0).resultSubShapePair()[0] ResultExtrusion_2 = Extrusion_1.result().subResult(1).resultSubShapePair()[0] from GeomAPI import GeomAPI_Shape + emptyShape = GeomAPI_Shape() Reference = { @@ -78,92 +119,288 @@ Reference = { # Faces of the extrusion model.selection("FACE", "Extrusion_1_1_1/From_Face"): True, model.selection("FACE", "Extrusion_1_1_1/To_Face"): True, - model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1"): True, - model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2"): False, - model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1"): False, + model.selection( + "FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1" + ): True, + model.selection( + "FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2" + ): False, + model.selection( + "FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1" + ): False, model.selection("FACE", "Extrusion_1_1_2/From_Face"): False, model.selection("FACE", "Extrusion_1_1_2/To_Face"): False, - model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1"): False, - model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1" + ): False, + model.selection( + "FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2" + ): False, # Faces of the cylinder model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): True, # Edges of the box - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]"): True, - model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Back"): False, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Box_1_1/Left]"): True, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top]"): True, - model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Bottom"): False, - model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"): False, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left]"): True, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]"): True, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): True, - model.selection("EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front"): False, - model.selection("EDGE", "[Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): True, - model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): True, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]"): False, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Box_1_1/Right]"): False, - model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Back"): False, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top]"): False, - model.selection("EDGE", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]"): False, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right]"): False, - model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"): False, - model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Bottom"): False, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): False, - model.selection("EDGE", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): False, - model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front"): False, - model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): False, + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]", + ): True, + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Back" + ): False, + model.selection( + "EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Box_1_1/Left]" + ): True, + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top]", + ): True, + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Bottom" + ): False, + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top" + ): False, + model.selection( + "EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left]" + ): True, + model.selection( + "EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]" + ): True, + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Partition_1_1_1/Modified_Face&Box_1_1/Front]", + ): True, + model.selection( + "EDGE", "Partition_1_1_1/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front" + ): False, + model.selection( + "EDGE", "[Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]" + ): True, + model.selection( + "EDGE", + "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Front]", + ): True, + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]", + ): False, + model.selection( + "EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Box_1_1/Right]" + ): False, + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Back" + ): False, + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]" + ): False, + model.selection( + "EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right]" + ): False, + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top" + ): False, + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Bottom" + ): False, + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Front]", + ): False, + model.selection( + "EDGE", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Front]" + ): False, + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front" + ): False, + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Box_1_1/Front]", + ): False, # Edges of the extrusion - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][weak_name_2]"): False, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][weak_name_1]"): False, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]"): False, - 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]"): False, - 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/SketchCircle_1_2&weak_name_2]"): True, - 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/SketchLine_1]"): False, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]"): False, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][weak_name_2]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][weak_name_1]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]", + ): False, + 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]", + ): False, + 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/SketchCircle_1_2&weak_name_2]", + ): True, + 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/SketchLine_1]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]", + ): False, # Edges of the cylinder - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): True, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): True, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): True, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): True, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): True, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): True, # Vertices of the box - model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): True, - model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_4"): False, - model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left]"): True, - model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]"): True, - model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_2"): False, - model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_3"): False, - model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]"): True, - model.selection("VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_1"): False, - model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_3"): False, - model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right]"): False, - model.selection("VERTEX", "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): False, - model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_1"): False, - model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]"): False, - model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_2"): False, - model.selection("VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_4"): False, - model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Front]"): False, + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]", + ): True, + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_4" + ): False, + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Left]", + ): True, + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Front]", + ): True, + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_2" + ): False, + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_3" + ): False, + model.selection( + "VERTEX", + "[Partition_1_1_1/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Left]", + ): True, + model.selection( + "VERTEX", "Partition_1_1_1/Generated_Vertex&Plane_1/Plane_1&weak_name_1" + ): False, + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_3" + ): False, + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right]", + ): False, + model.selection( + "VERTEX", + "[Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Front]", + ): False, + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_1" + ): False, + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Back][Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Bottom]", + ): False, + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_2" + ): False, + model.selection( + "VERTEX", "Partition_1_1_2/Generated_Vertex&Plane_1/Plane_1&weak_name_4" + ): False, + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Box_1_1/Right][Partition_1_1_2/Modified_Face&Box_1_1/Front]", + ): False, # Vertices of the extrusion - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]"): False, - model.selection("VERTEX", "[_weak_name_6_Extrusion_1_1_2]e[_weak_name_5_Extrusion_1_1_2]e[_weak_name_3_Extrusion_1_1_2]e"): False, - model.selection("VERTEX", "[_weak_name_1_Extrusion_1_1_2]e[_weak_name_5_Extrusion_1_1_2]e[_weak_name_3_Extrusion_1_1_2]e"): False, - model.selection("VERTEX", "[_weak_name_6_Extrusion_1_1_2]e[_weak_name_4_Extrusion_1_1_2]e[_weak_name_2_Extrusion_1_1_2]e"): False, - model.selection("VERTEX", "[_weak_name_1_Extrusion_1_1_2]e[_weak_name_4_Extrusion_1_1_2]e[_weak_name_2_Extrusion_1_1_2]e"): False, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[_weak_name_6_Extrusion_1_1_2]e[_weak_name_5_Extrusion_1_1_2]e[_weak_name_3_Extrusion_1_1_2]e", + ): False, + model.selection( + "VERTEX", + "[_weak_name_1_Extrusion_1_1_2]e[_weak_name_5_Extrusion_1_1_2]e[_weak_name_3_Extrusion_1_1_2]e", + ): False, + model.selection( + "VERTEX", + "[_weak_name_6_Extrusion_1_1_2]e[_weak_name_4_Extrusion_1_1_2]e[_weak_name_2_Extrusion_1_1_2]e", + ): False, + model.selection( + "VERTEX", + "[_weak_name_1_Extrusion_1_1_2]e[_weak_name_4_Extrusion_1_1_2]e[_weak_name_2_Extrusion_1_1_2]e", + ): False, # Vertices of the cylinder - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): True, - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): True, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): True, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): True, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnPlane_Exclude.py b/src/FiltersPlugin/Test/TestFilter_OnPlane_Exclude.py index 66156bfc1..5337a27c5 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnPlane_Exclude.py +++ b/src/FiltersPlugin/Test/TestFilter_OnPlane_Exclude.py @@ -24,10 +24,42 @@ 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/OX"), 20, 2, model.selection("EDGE", "PartSet/OY"), 20, 3) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 50) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnPlane", exclude = True, args = [model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Top"), model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Left")])]) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, + model.selection("EDGE", "PartSet/OY"), + 20, + 3, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 50, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnPlane", + exclude=True, + args=[ + model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Top"), + model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Left"), + ], + ) + ], +) model.end() Reference = { @@ -57,52 +89,181 @@ Reference = { model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): True, # Edges of the original box - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): True, # Edges of translated box - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Left][LinearCopy_1_1_6/MF:Translated&Box_1_1/Top]"): False, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Right][LinearCopy_1_1_6/MF:Translated&Box_1_1/Top]"): False, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Front][LinearCopy_1_1_6/MF:Translated&Box_1_1/Top]"): False, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Back][LinearCopy_1_1_6/MF:Translated&Box_1_1/Top]"): False, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Back][LinearCopy_1_1_6/MF:Translated&Box_1_1/Left]"): True, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Front][LinearCopy_1_1_6/MF:Translated&Box_1_1/Left]"): True, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Front][LinearCopy_1_1_6/MF:Translated&Box_1_1/Right]"): True, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Back][LinearCopy_1_1_6/MF:Translated&Box_1_1/Right]"): True, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Left][LinearCopy_1_1_6/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Right][LinearCopy_1_1_6/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Front][LinearCopy_1_1_6/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("EDGE", "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Back][LinearCopy_1_1_6/MF:Translated&Box_1_1/Bottom]"): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Left][LinearCopy_1_1_6/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Right][LinearCopy_1_1_6/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Front][LinearCopy_1_1_6/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Back][LinearCopy_1_1_6/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Back][LinearCopy_1_1_6/MF:Translated&Box_1_1/Left]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Front][LinearCopy_1_1_6/MF:Translated&Box_1_1/Left]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Front][LinearCopy_1_1_6/MF:Translated&Box_1_1/Right]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Back][LinearCopy_1_1_6/MF:Translated&Box_1_1/Right]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Left][LinearCopy_1_1_6/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Right][LinearCopy_1_1_6/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Front][LinearCopy_1_1_6/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "EDGE", + "[LinearCopy_1_1_6/MF:Translated&Box_1_1/Back][LinearCopy_1_1_6/MF:Translated&Box_1_1/Bottom]", + ): True, # Edges of the cylinder - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): False, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): True, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): False, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): False, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): True, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): False, # Vertices of the original box - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): True, # Vertices of translated box - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]"): True, - } + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Left][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Front][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_5/MF:Translated&Box_1_1/Back][LinearCopy_1_1_5/MF:Translated&Box_1_1/Right][LinearCopy_1_1_5/MF:Translated&Box_1_1/Bottom]", + ): True, +} model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnPlane_Multi.py b/src/FiltersPlugin/Test/TestFilter_OnPlane_Multi.py index af5fdebd7..0d27949ba 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnPlane_Multi.py +++ b/src/FiltersPlugin/Test/TestFilter_OnPlane_Multi.py @@ -29,10 +29,18 @@ SketchLine_1 = Sketch_1.addLine(40, 30, 5, 30) SketchLine_2 = Sketch_1.addLine(5, 30, 5, 3) SketchLine_3 = Sketch_1.addLine(5, 3, 40, 3) SketchLine_4 = Sketch_1.addLine(40, 3, 40, 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()) +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()) @@ -42,102 +50,314 @@ Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To SketchLine_5 = Sketch_2.addLine(18, 39, 29, 39) SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_5.result()) SketchLine_6 = Sketch_2.addLine(29, 39, 29, 21) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result()) SketchLine_7 = Sketch_2.addLine(29, 21, 46, 21) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result()) SketchLine_8 = Sketch_2.addLine(46, 21, 46, 11) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result()) SketchLine_9 = Sketch_2.addLine(46, 11, 29, 11) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_9.result()) SketchLine_10 = Sketch_2.addLine(29, 11, 29, -3) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_10.result()) SketchLine_11 = Sketch_2.addLine(29, -3, 18, -3) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchLine_12 = Sketch_2.addLine(18, -3, 18, 11) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_12.result()) SketchLine_13 = Sketch_2.addLine(18, 11, 3, 11) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchLine_14 = Sketch_2.addLine(3, 11, 3, 21) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_14.result()) SketchLine_15 = Sketch_2.addLine(3, 21, 18, 21) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_15.result()) SketchLine_16 = Sketch_2.addLine(18, 21, 18, 39) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchLine_16.endPoint()) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_5.startPoint(), SketchLine_16.endPoint() +) SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_16.result()) SketchConstraintHorizontal_7 = Sketch_2.setHorizontal(SketchLine_13.result()) SketchConstraintHorizontal_8 = Sketch_2.setHorizontal(SketchLine_11.result()) -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_16.result(), SketchLine_12.endPoint()) -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_6.result(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_15.result(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_13.result(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchLine_16.result(), SketchLine_12.endPoint() +) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchLine_6.result(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_15.result(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchLine_13.result(), SketchLine_10.startPoint() +) model.do() -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r")], model.selection(), 0, 10, [model.selection("SOLID", "Extrusion_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_2/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r", + ) + ], + model.selection(), + 0, + 10, + [model.selection("SOLID", "Extrusion_1_1")], +) # two smae filters with two planes each -Filters = model.filters(Part_1_doc, [ - model.addFilter(name = "OnPlane", args = [model.selection("FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16"), model.selection("FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6")]), - model.addFilter(name = "OnPlane", args = [model.selection("FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15"), model.selection("FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13")])]) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnPlane", + args=[ + model.selection( + "FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16" + ), + model.selection( + "FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6" + ), + ], + ), + model.addFilter( + name="OnPlane", + args=[ + model.selection( + "FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15" + ), + model.selection( + "FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13" + ), + ], + ), + ], +) model.end() # 4 edges are in result: intersection of pairs of planes Reference = { - model.selection("EDGE", "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15]"): True, - model.selection("EDGE", "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7]"): True, - model.selection("EDGE", "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12]"): True, - model.selection("EDGE", "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10]"): True, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10)2]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10)2]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12]"): False, - model.selection("EDGE", "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10)2][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12]"): False, - model.selection("EDGE", "([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13])([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15])([ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13])([ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15])"): False, - model.selection("EDGE", "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10)2][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13]"): False, - model.selection("EDGE", "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15)(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13)2][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15]"): False, - model.selection("EDGE", "[Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16][ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15)(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13)2]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15)(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13)2]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16]"): False, - model.selection("EDGE", "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15)(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13)2][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16]"): False, - model.selection("EDGE", "[Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7)(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9)2]"): False, - model.selection("EDGE", "([ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10])([ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12])([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10])([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12])"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12)2]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10]"): False, - model.selection("EDGE", "([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16])([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6])([ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16][ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face])([ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6])"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12)2]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12)2]"): False, - model.selection("EDGE", "([ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7])([ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9])([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7])([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9])"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12)2]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9]"): False, - model.selection("EDGE", "[Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7]"): False, - model.selection("EDGE", "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7)(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9)2][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4]"): False, - model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7)(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9)2]"): False, - model.selection("EDGE", "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7)(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9)2][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4]"): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15]", + ): True, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7]", + ): True, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12]", + ): True, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10]", + ): True, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10)2]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10)2]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12]", + ): False, + model.selection( + "EDGE", + "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10)2][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12]", + ): False, + model.selection( + "EDGE", + "([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13])([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15])([ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13])([ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15])", + ): False, + model.selection( + "EDGE", + "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10)2][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13]", + ): False, + model.selection( + "EDGE", + "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15)(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13)2][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16][ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15)(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13)2]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15)(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13)2]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16]", + ): False, + model.selection( + "EDGE", + "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_15)(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_13)2][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7)(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9)2]", + ): False, + model.selection( + "EDGE", + "([ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10])([ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12])([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10])([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12])", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12)2]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10]", + ): False, + model.selection( + "EDGE", + "([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16])([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6])([ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16][ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face])([ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6])", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12)2]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12)2]", + ): False, + model.selection( + "EDGE", + "([ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7])([ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9])([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7])([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9])", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_10)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_12)2]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7]", + ): False, + model.selection( + "EDGE", + "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7)(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9)2][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face][ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4]", + ): False, + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7)(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9)2]", + ): False, + model.selection( + "EDGE", + "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_7)(Extrusion_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_16)2(ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face)2(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)2(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9)2][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4]", + ): False, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OnShapeName.py b/src/FiltersPlugin/Test/TestFilter_OnShapeName.py index cf8e5429e..11731bc56 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnShapeName.py +++ b/src/FiltersPlugin/Test/TestFilter_OnShapeName.py @@ -31,14 +31,16 @@ partSet = model.moduleDocument() ### Create Part Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -model.addParameter(Part_1_doc, "rayon", '10.') -model.addParameter(Part_1_doc, "hauteur", '2.*rayon') +model.addParameter(Part_1_doc, "rayon", "10.") +model.addParameter(Part_1_doc, "hauteur", "2.*rayon") ### Create Sketch Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() ### Create SketchCircle @@ -48,7 +50,14 @@ Sketch_1.setRadius(SketchCircle_1.results()[1], "rayon ") model.do() ### Create Extrusion -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), "hauteur ", "hauteur/4.", "Faces|Wires") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection(), + "hauteur ", + "hauteur/4.", + "Faces|Wires", +) ### Create Sketch Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) @@ -57,7 +66,9 @@ Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchLine_1 = Sketch_2.addLine(12.5, -12.5, -12.5, -12.5) ### Create SketchProjection -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() ### Create SketchLine @@ -84,8 +95,12 @@ Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_5.startPoint()) Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchLine_6.startPoint()) Sketch_2.setCoincident(SketchLine_3.startPoint(), SketchLine_5.endPoint()) Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchLine_6.endPoint()) -Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_5.result()) -Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_6.result()) +Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_5.result() +) +Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_6.result() +) Sketch_2.setHorizontal(SketchLine_1.result()) Sketch_2.setVertical(SketchLine_2.result()) Sketch_2.setHorizontal(SketchLine_3.result()) @@ -95,7 +110,14 @@ Sketch_2.setEqual(SketchLine_3.result(), SketchLine_2.result()) model.do() ### Create Extrusion -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_2")], model.selection(), 0, "2.*rayon", "Faces|Wires") +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_2")], + model.selection(), + 0, + "2.*rayon", + "Faces|Wires", +) ### Create Sketch Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) @@ -104,28 +126,53 @@ Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchLine_7 = Sketch_3.addLine(-4.930380657631324e-32, -6, -4.930380657631324e-32, 6) ### Create SketchProjection -SketchProjection_3 = Sketch_3.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_3 = Sketch_3.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_3 = SketchProjection_3.createdFeature() -Sketch_3.setMiddlePoint(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_7.result()) +Sketch_3.setMiddlePoint( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_7.result() +) Sketch_3.setVertical(SketchLine_7.result()) Sketch_3.setLength(SketchLine_7.result(), "1.2*rayon") model.do() ### Create Extrusion -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_3")], model.selection("EDGE", "PartSet/OZ"), "hauteur*1.4", "hauteur*0.4", "Edges") +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_3")], + model.selection("EDGE", "PartSet/OZ"), + "hauteur*1.4", + "hauteur*0.4", + "Edges", +) ### Create Extrusion -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("VERTEX", "PartSet/Origin")], model.selection("EDGE", "PartSet/OY"), "rayon*1.6", "rayon*1.6") +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [model.selection("VERTEX", "PartSet/Origin")], + model.selection("EDGE", "PartSet/OY"), + "rayon*1.6", + "rayon*1.6", +) ### Create Translation -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_4")], axis = model.selection("EDGE", "PartSet/OZ"), distance = "hauteur*0.5", keepSubResults = True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Extrusion_4")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance="hauteur*0.5", + keepSubResults=True, +) ### Create Partition -Partition_1_objects = [model.selection("COMPOUND", "all-in-Extrusion_1"), - model.selection("COMPOUND", "all-in-Extrusion_2"), - model.selection("COMPOUND", "all-in-Extrusion_3"), - model.selection("COMPOUND", "all-in-Translation_1")] -Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults = True) +Partition_1_objects = [ + model.selection("COMPOUND", "all-in-Extrusion_1"), + model.selection("COMPOUND", "all-in-Extrusion_2"), + model.selection("COMPOUND", "all-in-Extrusion_3"), + model.selection("COMPOUND", "all-in-Translation_1"), +] +Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults=True) Partition_1.result().subResult(0).setName("Volumes") Partition_1.result().subResult(0).subResult(0).setName("Cylindre bas") Partition_1.result().subResult(0).subResult(1).setName("Cylindre haut") @@ -136,15 +183,23 @@ Partition_1.result().subResult(3).setName("Poutre 2") model.end() model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnShapeName", args = ["Cube"])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="OnShapeName", args=["Cube"])] +) nFaces = len(Filters.select("FACE")) nEdges = len(Filters.select("EDGE")) nVerts = len(Filters.select("VERTEX")) model.end() -assert nFaces==9, "Wrong number of filtered faces in 1st filter: {}, expected 9".format(nFaces) -assert nEdges==19, "Wrong number of filtered edges in 1st filter: {}, expected 19".format(nEdges) -assert nVerts==14, "Wrong number of selected vertexes in 1st filter: {}, expected 14".format(nVerts) +assert ( + nFaces == 9 +), "Wrong number of filtered faces in 1st filter: {}, expected 9".format(nFaces) +assert ( + nEdges == 19 +), "Wrong number of filtered edges in 1st filter: {}, expected 19".format(nEdges) +assert ( + nVerts == 14 +), "Wrong number of selected vertexes in 1st filter: {}, expected 14".format(nVerts) from GeomAPI import * @@ -152,153 +207,169 @@ Reference = {} RefCube = Partition_1.result().subResult(0).subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(RefCube.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(RefCube, exp.current())] = True - exp.next() + Reference[model.selection(RefCube, exp.current())] = True + exp.next() exp = GeomAPI_ShapeExplorer(RefCube.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(RefCube, exp.current())] = True - exp.next() + Reference[model.selection(RefCube, exp.current())] = True + exp.next() exp = GeomAPI_ShapeExplorer(RefCube.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(RefCube, exp.current())] = True - exp.next() + Reference[model.selection(RefCube, exp.current())] = True + exp.next() -ResfCyl= Partition_1.result().subResult(0).subResult(0).resultSubShapePair()[0] +ResfCyl = Partition_1.result().subResult(0).subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResfCyl.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResfCyl, exp.current())] = False - exp.next() + Reference[model.selection(ResfCyl, exp.current())] = False + exp.next() exp = GeomAPI_ShapeExplorer(ResfCyl.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResfCyl, exp.current())] = False - exp.next() + Reference[model.selection(ResfCyl, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) ### ------------------------------------------------------------------------------ model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnShapeName", args = ["Poutre [0-9]"])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="OnShapeName", args=["Poutre [0-9]"])] +) nEdges = len(Filters.select("EDGE")) nVerts = len(Filters.select("VERTEX")) model.end() -assert nEdges==2, "Wrong number of filtered edges in 2d filter: {}, expected 2".format(nEdges) -assert nVerts==4, "Wrong number of selected vertexes in 2d filter: {}, expected 4".format(nVerts) +assert ( + nEdges == 2 +), "Wrong number of filtered edges in 2d filter: {}, expected 2".format(nEdges) +assert ( + nVerts == 4 +), "Wrong number of selected vertexes in 2d filter: {}, expected 4".format(nVerts) Reference = {} RefPoutre1 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(RefPoutre1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(RefPoutre1, exp.current())] = True - exp.next() + Reference[model.selection(RefPoutre1, exp.current())] = True + exp.next() exp = GeomAPI_ShapeExplorer(RefPoutre1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(RefPoutre1, exp.current())] = True - exp.next() + Reference[model.selection(RefPoutre1, exp.current())] = True + exp.next() RefPoutre2 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(RefPoutre2.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(RefPoutre2, exp.current())] = True - exp.next() + Reference[model.selection(RefPoutre2, exp.current())] = True + exp.next() exp = GeomAPI_ShapeExplorer(RefPoutre2.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(RefPoutre2, exp.current())] = True - exp.next() + Reference[model.selection(RefPoutre2, exp.current())] = True + exp.next() exp = GeomAPI_ShapeExplorer(ResfCyl.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResfCyl, exp.current())] = False - exp.next() + Reference[model.selection(ResfCyl, exp.current())] = False + exp.next() exp = GeomAPI_ShapeExplorer(ResfCyl.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResfCyl, exp.current())] = False - exp.next() + Reference[model.selection(ResfCyl, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) ### ------------------------------------------------------------------------------ model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnShapeName", args = ["Volumes"])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="OnShapeName", args=["Volumes"])] +) nSolids = len(Filters.select("SOLID")) nFaces = len(Filters.select("FACE")) nEdges = len(Filters.select("EDGE")) nVerts = len(Filters.select("VERTEX")) model.end() -assert nSolids==3, "Wrong number of filtered solids in 3rd filter: {}, expected 3".format(nSolids) -assert nFaces==15, "Wrong number of filtered faces in 3rd filter: {}, expected 15".format(nFaces) -assert nEdges==31, "Wrong number of filtered edges in 3rd filter: {}, expected 31".format(nEdges) -assert nVerts==19, "Wrong number of selected vertexes in 3rd filter: {}, expected 19".format(nVerts) +assert ( + nSolids == 3 +), "Wrong number of filtered solids in 3rd filter: {}, expected 3".format(nSolids) +assert ( + nFaces == 15 +), "Wrong number of filtered faces in 3rd filter: {}, expected 15".format(nFaces) +assert ( + nEdges == 31 +), "Wrong number of filtered edges in 3rd filter: {}, expected 31".format(nEdges) +assert ( + nVerts == 19 +), "Wrong number of selected vertexes in 3rd filter: {}, expected 19".format(nVerts) Reference = {} exp = GeomAPI_ShapeExplorer(RefCube.shape(), GeomAPI_Shape.SOLID) while exp.more(): - Reference[model.selection(RefCube, exp.current())] = True - exp.next() + Reference[model.selection(RefCube, exp.current())] = True + exp.next() exp = GeomAPI_ShapeExplorer(RefCube.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(RefCube, exp.current())] = True - exp.next() + Reference[model.selection(RefCube, exp.current())] = True + exp.next() exp = GeomAPI_ShapeExplorer(RefCube.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(RefCube, exp.current())] = True - exp.next() + Reference[model.selection(RefCube, exp.current())] = True + exp.next() exp = GeomAPI_ShapeExplorer(RefCube.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(RefCube, exp.current())] = True - exp.next() + Reference[model.selection(RefCube, exp.current())] = True + exp.next() exp = GeomAPI_ShapeExplorer(ResfCyl.shape(), GeomAPI_Shape.SOLID) while exp.more(): - Reference[model.selection(ResfCyl, exp.current())] = True - exp.next() + Reference[model.selection(ResfCyl, exp.current())] = True + exp.next() exp = GeomAPI_ShapeExplorer(ResfCyl.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResfCyl, exp.current())] = True - exp.next() + Reference[model.selection(ResfCyl, exp.current())] = True + exp.next() exp = GeomAPI_ShapeExplorer(ResfCyl.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResfCyl, exp.current())] = True - exp.next() + Reference[model.selection(ResfCyl, exp.current())] = True + exp.next() exp = GeomAPI_ShapeExplorer(ResfCyl.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResfCyl, exp.current())] = True - exp.next() + Reference[model.selection(ResfCyl, exp.current())] = True + exp.next() -ResfCyl2= Partition_1.result().subResult(0).subResult(1).resultSubShapePair()[0] +ResfCyl2 = Partition_1.result().subResult(0).subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResfCyl2.shape(), GeomAPI_Shape.SOLID) while exp.more(): - Reference[model.selection(ResfCyl2, exp.current())] = True - exp.next() + Reference[model.selection(ResfCyl2, exp.current())] = True + exp.next() exp = GeomAPI_ShapeExplorer(ResfCyl2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResfCyl2, exp.current())] = True - exp.next() + Reference[model.selection(ResfCyl2, exp.current())] = True + exp.next() exp = GeomAPI_ShapeExplorer(ResfCyl2.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(ResfCyl2, exp.current())] = True - exp.next() + Reference[model.selection(ResfCyl2, exp.current())] = True + exp.next() exp = GeomAPI_ShapeExplorer(ResfCyl2.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResfCyl2, exp.current())] = True - exp.next() + Reference[model.selection(ResfCyl2, exp.current())] = True + exp.next() exp = GeomAPI_ShapeExplorer(RefPoutre1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(RefPoutre1, exp.current())] = False - exp.next() + Reference[model.selection(RefPoutre1, exp.current())] = False + exp.next() exp = GeomAPI_ShapeExplorer(RefPoutre1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(RefPoutre1, exp.current())] = False - exp.next() + Reference[model.selection(RefPoutre1, exp.current())] = False + exp.next() RefPoutre2 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(RefPoutre2.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(RefPoutre2, exp.current())] = False - exp.next() + Reference[model.selection(RefPoutre2, exp.current())] = False + exp.next() exp = GeomAPI_ShapeExplorer(RefPoutre2.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(RefPoutre2, exp.current())] = False - exp.next() + Reference[model.selection(RefPoutre2, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OppositeToEdge.py b/src/FiltersPlugin/Test/TestFilter_OppositeToEdge.py index 7a55ed6e4..c9f13198b 100644 --- a/src/FiltersPlugin/Test/TestFilter_OppositeToEdge.py +++ b/src/FiltersPlugin/Test/TestFilter_OppositeToEdge.py @@ -24,13 +24,48 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 100, 100, 100) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], -50, -50, -50) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), model.selection("EDGE", "PartSet/OX"), 30) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), model.selection("EDGE", "PartSet/OY"), 30) -Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), model.selection("EDGE", "PartSet/OZ"), 30) -Partition_1_objects = [model.selection("SOLID", "Translation_1_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2"), model.selection("FACE", "Plane_3")] -Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults = True) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OppositeToEdge", args = [model.selection("EDGE", "Partition_1_1_7/Generated_Edge&Plane_2/Plane_2&Plane_1/Plane_1")])]) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_1_1")], -50, -50, -50 +) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOY"), + model.selection("EDGE", "PartSet/OX"), + 30, +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/YOZ"), + model.selection("EDGE", "PartSet/OY"), + 30, +) +Plane_6 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOZ"), + model.selection("EDGE", "PartSet/OZ"), + 30, +) +Partition_1_objects = [ + model.selection("SOLID", "Translation_1_1"), + model.selection("FACE", "Plane_1"), + model.selection("FACE", "Plane_2"), + model.selection("FACE", "Plane_3"), +] +Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults=True) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OppositeToEdge", + args=[ + model.selection( + "EDGE", + "Partition_1_1_7/Generated_Edge&Plane_2/Plane_2&Plane_1/Plane_1", + ) + ], + ) + ], +) model.end() from GeomAPI import * @@ -40,13 +75,13 @@ Reference = {} ResultBox_1 = Partition_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() # Vertices are not applicable too exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() # Edges of the partitioned box. # Note: the expected values have to be updated if ShapeExplorer will return another order of sub-shapes. @@ -55,168 +90,264 @@ while exp.more(): SubResult = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(SubResult.shape(), GeomAPI_Shape.EDGE) # edges of face 1 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 2 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 3 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 4 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 5 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 6 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +assert not exp.more() # sub-result 1 SubResult = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(SubResult.shape(), GeomAPI_Shape.EDGE) # edges of face 1 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 2 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 3 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 4 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 5 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 6 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -assert(not exp.more()) +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +assert not exp.more() # sub-result 2 SubResult = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(SubResult.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(SubResult, exp.current())] = False - exp.next() + Reference[model.selection(SubResult, exp.current())] = False + exp.next() # sub-result 3 SubResult = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(SubResult.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(SubResult, exp.current())] = False - exp.next() + Reference[model.selection(SubResult, exp.current())] = False + exp.next() # sub-result 4 SubResult = Partition_1.result().subResult(4).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(SubResult.shape(), GeomAPI_Shape.EDGE) # edges of face 1 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 2 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 3 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 4 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 5 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 6 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +assert not exp.more() # sub-result 5 SubResult = Partition_1.result().subResult(5).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(SubResult.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(SubResult, exp.current())] = False - exp.next() + Reference[model.selection(SubResult, exp.current())] = False + exp.next() # sub-result 6 SubResult = Partition_1.result().subResult(6).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(SubResult.shape(), GeomAPI_Shape.EDGE) # edges of face 1 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 2 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 3 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 4 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 5 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 6 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +assert not exp.more() # sub-result 7 SubResult = Partition_1.result().subResult(7).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(SubResult.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(SubResult, exp.current())] = False - exp.next() + Reference[model.selection(SubResult, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_OppositeToEdge_Exclude.py b/src/FiltersPlugin/Test/TestFilter_OppositeToEdge_Exclude.py index a2286991f..ad160cf3d 100644 --- a/src/FiltersPlugin/Test/TestFilter_OppositeToEdge_Exclude.py +++ b/src/FiltersPlugin/Test/TestFilter_OppositeToEdge_Exclude.py @@ -24,13 +24,49 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 100, 100, 100) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], -50, -50, -50) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), model.selection("EDGE", "PartSet/OX"), 30) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), model.selection("EDGE", "PartSet/OY"), 30) -Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), model.selection("EDGE", "PartSet/OZ"), 30) -Partition_1_objects = [model.selection("SOLID", "Translation_1_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2"), model.selection("FACE", "Plane_3")] -Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults = True) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "OppositeToEdge", exclude = True, args = [model.selection("EDGE", "Partition_1_1_7/Generated_Edge&Plane_2/Plane_2&Plane_1/Plane_1")])]) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_1_1")], -50, -50, -50 +) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOY"), + model.selection("EDGE", "PartSet/OX"), + 30, +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/YOZ"), + model.selection("EDGE", "PartSet/OY"), + 30, +) +Plane_6 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOZ"), + model.selection("EDGE", "PartSet/OZ"), + 30, +) +Partition_1_objects = [ + model.selection("SOLID", "Translation_1_1"), + model.selection("FACE", "Plane_1"), + model.selection("FACE", "Plane_2"), + model.selection("FACE", "Plane_3"), +] +Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults=True) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OppositeToEdge", + exclude=True, + args=[ + model.selection( + "EDGE", + "Partition_1_1_7/Generated_Edge&Plane_2/Plane_2&Plane_1/Plane_1", + ) + ], + ) + ], +) model.end() from GeomAPI import * @@ -40,13 +76,13 @@ Reference = {} ResultBox_1 = Partition_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() # Vertices are not applicable too exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() # Edges of the partitioned box. # Note: the expected values have to be updated if ShapeExplorer will return another order of sub-shapes. @@ -55,168 +91,264 @@ while exp.more(): SubResult = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(SubResult.shape(), GeomAPI_Shape.EDGE) # edges of face 1 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 2 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 3 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 4 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 5 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 6 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -assert(not exp.more()) +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +assert not exp.more() # sub-result 1 SubResult = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(SubResult.shape(), GeomAPI_Shape.EDGE) # edges of face 1 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 2 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 3 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 4 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 5 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 6 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +assert not exp.more() # sub-result 2 SubResult = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(SubResult.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(SubResult, exp.current())] = True - exp.next() + Reference[model.selection(SubResult, exp.current())] = True + exp.next() # sub-result 3 SubResult = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(SubResult.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(SubResult, exp.current())] = True - exp.next() + Reference[model.selection(SubResult, exp.current())] = True + exp.next() # sub-result 4 SubResult = Partition_1.result().subResult(4).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(SubResult.shape(), GeomAPI_Shape.EDGE) # edges of face 1 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 2 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 3 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 4 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 5 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 6 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -assert(not exp.more()) +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +assert not exp.more() # sub-result 5 SubResult = Partition_1.result().subResult(5).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(SubResult.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(SubResult, exp.current())] = True - exp.next() + Reference[model.selection(SubResult, exp.current())] = True + exp.next() # sub-result 6 SubResult = Partition_1.result().subResult(6).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(SubResult.shape(), GeomAPI_Shape.EDGE) # edges of face 1 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 2 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 3 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 4 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() # edges of face 5 -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() # edges of face 6 -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -Reference[model.selection(SubResult, exp.current())] = False; exp.next() -Reference[model.selection(SubResult, exp.current())] = True; exp.next() -assert(not exp.more()) +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +Reference[model.selection(SubResult, exp.current())] = False +exp.next() +Reference[model.selection(SubResult, exp.current())] = True +exp.next() +assert not exp.more() # sub-result 7 SubResult = Partition_1.result().subResult(7).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(SubResult.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(SubResult, exp.current())] = True - exp.next() + Reference[model.selection(SubResult, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_In.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_In.py index bedd139f4..40b954ca7 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_In.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_In.py @@ -26,54 +26,165 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 20, 0, 0, 20, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 20) SketchLine_3 = Sketch_1.addLine(0, 32.83768482493814, 29.63380351263586, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result()) -SketchLine_4 = Sketch_1.addLine(29.63380351263586, 0, 62.471488337574, 29.63380351263586) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(32.83768482493814, 62.471488337574, 0, 32.83768482493814) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_6.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_5.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_3.result(), 22, True) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_1.result() +) +SketchLine_4 = Sketch_1.addLine( + 29.63380351263586, 0, 62.471488337574, 29.63380351263586 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + 32.83768482493814, 62.471488337574, 0, 32.83768482493814 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_6.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_3.result(), SketchLine_5.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_3.result(), 22, True +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) SketchLine_7 = Sketch_1.addLine(0, 20, 0, 0) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint() +) SketchLine_8 = Sketch_1.addLine(0, 0, 20, 0) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_8.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f"), model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f")], model.selection(), 30, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f", + ), + model.selection( + "FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f" + ), + ], + model.selection(), + 30, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) SketchCircle_1 = Sketch_2.addCircle(28.24714778717828, 31.38901581881253, 10) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_9 = SketchProjection_3.createdFeature() -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_9.result(), 20, True) -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), False) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_9.result(), 20, True +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_10 = SketchProjection_4.createdFeature() -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_10.result(), 20, True) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_10.result(), 20, True +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 10) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 10, 0) -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), 0, 10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), -10, 20) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", exclude = True, args = [model.selection("SOLID", "Extrusion_1_1"), "in"])]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], + model.selection(), + 10, + 0, +) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + 0, + 10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + -10, + 20, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10 +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="RelativeToSolid", + exclude=True, + args=[model.selection("SOLID", "Extrusion_1_1"), "in"], + ) + ], +) model.end() Reference = { @@ -89,91 +200,262 @@ Reference = { model.selection("FACE", "Extrusion_1_2/From_Face"): True, model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7"): True, model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8"): True, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2"): True, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2" + ): True, # Faces of solid 3 model.selection("FACE", "Extrusion_2_1/To_Face"): True, model.selection("FACE", "Extrusion_2_1/From_Face"): True, - model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): True, # Faces of solid 4 model.selection("FACE", "Extrusion_3_1/To_Face"): True, model.selection("FACE", "Extrusion_3_1/From_Face"): False, - model.selection("FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): True, # Faces of solid 5 model.selection("FACE", "Extrusion_4_1/To_Face"): False, model.selection("FACE", "Extrusion_4_1/From_Face"): False, - model.selection("FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): False, # Faces of solid 6 model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): True, - # Edges of solid 1 - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): True, # Edges of solid 2 - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): True, # Edges of solid 3 - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): True, - model.selection("EDGE", "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])"): True, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): True, + model.selection( + "EDGE", + "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])", + ): True, # Edges of solid 4 - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): False, - model.selection("EDGE", "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])"): True, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])", + ): True, # Edges of solid 5 - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): False, - model.selection("EDGE", "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])"): False, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])", + ): False, # Edges of solid 6 - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): True, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): True, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): True, - + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): True, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): True, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): True, # Vertices of solid 1 - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): True, - 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]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): True, + 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]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): True, # Vertices of solid 2 - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): True, # Vertices of solid 3 - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): True, # Vertices of solid 4 - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): False, # Vertices of solid 5 - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): False, # Vertices of solid 6 - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): True, - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): True, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): True, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): True, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_InAndOn.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_InAndOn.py index 4731182f6..6c1889b51 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_InAndOn.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_InAndOn.py @@ -26,154 +26,444 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 20, 0, 0, 20, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 20) SketchLine_3 = Sketch_1.addLine(0, 32.83768482493814, 29.63380351263586, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result()) -SketchLine_4 = Sketch_1.addLine(29.63380351263586, 0, 62.471488337574, 29.63380351263586) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(32.83768482493814, 62.471488337574, 0, 32.83768482493814) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_6.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_5.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_3.result(), 22, True) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_1.result() +) +SketchLine_4 = Sketch_1.addLine( + 29.63380351263586, 0, 62.471488337574, 29.63380351263586 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + 32.83768482493814, 62.471488337574, 0, 32.83768482493814 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_6.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_3.result(), SketchLine_5.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_3.result(), 22, True +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) SketchLine_7 = Sketch_1.addLine(0, 20, 0, 0) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint() +) SketchLine_8 = Sketch_1.addLine(0, 0, 20, 0) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_8.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f"), model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f")], model.selection(), 30, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f", + ), + model.selection( + "FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f" + ), + ], + model.selection(), + 30, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) SketchCircle_1 = Sketch_2.addCircle(28.24714778717828, 31.38901581881253, 10) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_9 = SketchProjection_3.createdFeature() -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_9.result(), 20, True) -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), False) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_9.result(), 20, True +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_10 = SketchProjection_4.createdFeature() -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_10.result(), 20, True) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_10.result(), 20, True +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 10) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 10, 0) -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), 0, 10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), -10, 20) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", exclude = True, args = [model.selection("SOLID", "Extrusion_1_1"), "not_out"])]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], + model.selection(), + 10, + 0, +) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + 0, + 10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + -10, + 20, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10 +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="RelativeToSolid", + exclude=True, + args=[model.selection("SOLID", "Extrusion_1_1"), "not_out"], + ) + ], +) model.end() Reference = { # Faces of solid 1 model.selection("FACE", "Extrusion_1_1/To_Face"): False, model.selection("FACE", "Extrusion_1_1/From_Face"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6"): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3" + ): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4" + ): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5" + ): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6" + ): False, # Faces of solid 2 model.selection("FACE", "Extrusion_1_2/To_Face"): True, model.selection("FACE", "Extrusion_1_2/From_Face"): True, model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7"): True, model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8"): True, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2"): True, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2" + ): True, # Faces of solid 3 model.selection("FACE", "Extrusion_2_1/To_Face"): True, model.selection("FACE", "Extrusion_2_1/From_Face"): False, - model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): True, # Faces of solid 4 model.selection("FACE", "Extrusion_3_1/To_Face"): False, model.selection("FACE", "Extrusion_3_1/From_Face"): False, - model.selection("FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): False, # Faces of solid 5 model.selection("FACE", "Extrusion_4_1/To_Face"): False, model.selection("FACE", "Extrusion_4_1/From_Face"): False, - model.selection("FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): False, # Faces of solid 6 model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): True, - # Edges of solid 1 - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): False, # Edges of solid 2 - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): True, # Edges of solid 3 - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): False, - model.selection("EDGE", "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])"): True, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])", + ): True, # Edges of solid 4 - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): False, - model.selection("EDGE", "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])"): False, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])", + ): False, # Edges of solid 5 - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): False, - model.selection("EDGE", "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])"): False, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])", + ): False, # Edges of solid 6 - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): True, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): True, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): True, - + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): True, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): True, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): True, # Vertices of solid 1 - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): False, - 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, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): False, + 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, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, # Vertices of solid 2 - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): True, # Vertices of solid 3 - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): False, # Vertices of solid 4 - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): False, # Vertices of solid 5 - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): False, # Vertices of solid 6 - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): True, - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): True, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): True, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): True, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_NotOn.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_NotOn.py index 097302c7e..12f67e40d 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_NotOn.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_NotOn.py @@ -26,54 +26,165 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 20, 0, 0, 20, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 20) SketchLine_3 = Sketch_1.addLine(0, 32.83768482493814, 29.63380351263586, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result()) -SketchLine_4 = Sketch_1.addLine(29.63380351263586, 0, 62.471488337574, 29.63380351263586) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(32.83768482493814, 62.471488337574, 0, 32.83768482493814) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_6.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_5.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_3.result(), 22, True) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_1.result() +) +SketchLine_4 = Sketch_1.addLine( + 29.63380351263586, 0, 62.471488337574, 29.63380351263586 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + 32.83768482493814, 62.471488337574, 0, 32.83768482493814 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_6.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_3.result(), SketchLine_5.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_3.result(), 22, True +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) SketchLine_7 = Sketch_1.addLine(0, 20, 0, 0) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint() +) SketchLine_8 = Sketch_1.addLine(0, 0, 20, 0) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_8.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f"), model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f")], model.selection(), 30, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f", + ), + model.selection( + "FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f" + ), + ], + model.selection(), + 30, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) SketchCircle_1 = Sketch_2.addCircle(28.24714778717828, 31.38901581881253, 10) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_9 = SketchProjection_3.createdFeature() -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_9.result(), 20, True) -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), False) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_9.result(), 20, True +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_10 = SketchProjection_4.createdFeature() -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_10.result(), 20, True) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_10.result(), 20, True +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 10) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 10, 0) -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), 0, 10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), -10, 20) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", exclude = True, args = [model.selection("SOLID", "Extrusion_1_1"), "not_on"])]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], + model.selection(), + 10, + 0, +) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + 0, + 10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + -10, + 20, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10 +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="RelativeToSolid", + exclude=True, + args=[model.selection("SOLID", "Extrusion_1_1"), "not_on"], + ) + ], +) model.end() Reference = { @@ -87,93 +198,268 @@ Reference = { # Faces of solid 2 model.selection("FACE", "Extrusion_1_2/To_Face"): False, model.selection("FACE", "Extrusion_1_2/From_Face"): False, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7"): False, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8"): False, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2"): False, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7" + ): False, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8" + ): False, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2" + ): False, # Faces of solid 3 model.selection("FACE", "Extrusion_2_1/To_Face"): False, model.selection("FACE", "Extrusion_2_1/From_Face"): True, - model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): True, # Faces of solid 4 model.selection("FACE", "Extrusion_3_1/To_Face"): True, model.selection("FACE", "Extrusion_3_1/From_Face"): False, - model.selection("FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): True, # Faces of solid 5 model.selection("FACE", "Extrusion_4_1/To_Face"): False, model.selection("FACE", "Extrusion_4_1/From_Face"): False, - model.selection("FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): False, # Faces of solid 6 model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): True, - # Edges of solid 1 - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): True, # Edges of solid 2 - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): False, # Edges of solid 3 - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): True, - model.selection("EDGE", "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])"): True, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): True, + model.selection( + "EDGE", + "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])", + ): True, # Edges of solid 4 - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): False, - model.selection("EDGE", "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])"): True, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])", + ): True, # Edges of solid 5 - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): False, - model.selection("EDGE", "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])"): False, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])", + ): False, # Edges of solid 6 - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): True, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): True, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): False, - + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): True, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): True, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): False, # Vertices of solid 1 - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): True, - 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]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): True, + 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]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): True, # Vertices of solid 2 - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): False, # Vertices of solid 3 - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): True, # Vertices of solid 4 - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): False, # Vertices of solid 5 - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): False, # Vertices of solid 6 - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): False, - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): False, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): False, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): False, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_On.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_On.py index 401e24987..f70972bee 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_On.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_On.py @@ -26,154 +26,444 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 20, 0, 0, 20, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 20) SketchLine_3 = Sketch_1.addLine(0, 32.83768482493814, 29.63380351263586, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result()) -SketchLine_4 = Sketch_1.addLine(29.63380351263586, 0, 62.471488337574, 29.63380351263586) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(32.83768482493814, 62.471488337574, 0, 32.83768482493814) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_6.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_5.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_3.result(), 22, True) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_1.result() +) +SketchLine_4 = Sketch_1.addLine( + 29.63380351263586, 0, 62.471488337574, 29.63380351263586 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + 32.83768482493814, 62.471488337574, 0, 32.83768482493814 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_6.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_3.result(), SketchLine_5.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_3.result(), 22, True +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) SketchLine_7 = Sketch_1.addLine(0, 20, 0, 0) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint() +) SketchLine_8 = Sketch_1.addLine(0, 0, 20, 0) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_8.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f"), model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f")], model.selection(), 30, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f", + ), + model.selection( + "FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f" + ), + ], + model.selection(), + 30, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) SketchCircle_1 = Sketch_2.addCircle(28.24714778717828, 31.38901581881253, 10) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_9 = SketchProjection_3.createdFeature() -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_9.result(), 20, True) -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), False) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_9.result(), 20, True +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_10 = SketchProjection_4.createdFeature() -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_10.result(), 20, True) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_10.result(), 20, True +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 10) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 10, 0) -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), 0, 10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), -10, 20) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", exclude = True, args = [model.selection("SOLID", "Extrusion_1_1"), "on"])]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], + model.selection(), + 10, + 0, +) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + 0, + 10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + -10, + 20, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10 +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="RelativeToSolid", + exclude=True, + args=[model.selection("SOLID", "Extrusion_1_1"), "on"], + ) + ], +) model.end() Reference = { # Faces of solid 1 model.selection("FACE", "Extrusion_1_1/To_Face"): False, model.selection("FACE", "Extrusion_1_1/From_Face"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6"): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3" + ): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4" + ): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5" + ): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6" + ): False, # Faces of solid 2 model.selection("FACE", "Extrusion_1_2/To_Face"): True, model.selection("FACE", "Extrusion_1_2/From_Face"): True, model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7"): True, model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8"): True, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2"): True, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2" + ): True, # Faces of solid 3 model.selection("FACE", "Extrusion_2_1/To_Face"): True, model.selection("FACE", "Extrusion_2_1/From_Face"): False, - model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): True, # Faces of solid 4 model.selection("FACE", "Extrusion_3_1/To_Face"): False, model.selection("FACE", "Extrusion_3_1/From_Face"): True, - model.selection("FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): True, # Faces of solid 5 model.selection("FACE", "Extrusion_4_1/To_Face"): True, model.selection("FACE", "Extrusion_4_1/From_Face"): True, - model.selection("FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): True, # Faces of solid 6 model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): True, - # Edges of solid 1 - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): False, # Edges of solid 2 - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): True, # Edges of solid 3 - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): False, - model.selection("EDGE", "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])"): True, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])", + ): True, # Edges of solid 4 - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): True, - model.selection("EDGE", "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])"): True, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): True, + model.selection( + "EDGE", + "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])", + ): True, # Edges of solid 5 - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): True, - model.selection("EDGE", "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])"): True, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): True, + model.selection( + "EDGE", + "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])", + ): True, # Edges of solid 6 - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): True, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): True, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): True, - + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): True, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): True, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): True, # Vertices of solid 1 - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): False, - 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, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): False, + 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, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, # Vertices of solid 2 - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): True, # Vertices of solid 3 - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): False, # Vertices of solid 4 - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): True, # Vertices of solid 5 - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): True, # Vertices of solid 6 - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): True, - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): True, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): True, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): True, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_Out.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_Out.py index 44b4964a1..d3f9327dd 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_Out.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_Out.py @@ -26,54 +26,165 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 20, 0, 0, 20, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 20) SketchLine_3 = Sketch_1.addLine(0, 32.83768482493814, 29.63380351263586, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result()) -SketchLine_4 = Sketch_1.addLine(29.63380351263586, 0, 62.471488337574, 29.63380351263586) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(32.83768482493814, 62.471488337574, 0, 32.83768482493814) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_6.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_5.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_3.result(), 22, True) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_1.result() +) +SketchLine_4 = Sketch_1.addLine( + 29.63380351263586, 0, 62.471488337574, 29.63380351263586 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + 32.83768482493814, 62.471488337574, 0, 32.83768482493814 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_6.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_3.result(), SketchLine_5.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_3.result(), 22, True +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) SketchLine_7 = Sketch_1.addLine(0, 20, 0, 0) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint() +) SketchLine_8 = Sketch_1.addLine(0, 0, 20, 0) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_8.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f"), model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f")], model.selection(), 30, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f", + ), + model.selection( + "FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f" + ), + ], + model.selection(), + 30, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) SketchCircle_1 = Sketch_2.addCircle(28.24714778717828, 31.38901581881253, 10) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_9 = SketchProjection_3.createdFeature() -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_9.result(), 20, True) -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), False) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_9.result(), 20, True +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_10 = SketchProjection_4.createdFeature() -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_10.result(), 20, True) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_10.result(), 20, True +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 10) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 10, 0) -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), 0, 10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), -10, 20) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", exclude = True, args = [model.selection("SOLID", "Extrusion_1_1"), "out"])]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], + model.selection(), + 10, + 0, +) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + 0, + 10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + -10, + 20, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10 +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="RelativeToSolid", + exclude=True, + args=[model.selection("SOLID", "Extrusion_1_1"), "out"], + ) + ], +) model.end() Reference = { @@ -87,93 +198,268 @@ Reference = { # Faces of solid 2 model.selection("FACE", "Extrusion_1_2/To_Face"): False, model.selection("FACE", "Extrusion_1_2/From_Face"): False, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7"): False, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8"): False, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2"): False, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7" + ): False, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8" + ): False, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2" + ): False, # Faces of solid 3 model.selection("FACE", "Extrusion_2_1/To_Face"): False, model.selection("FACE", "Extrusion_2_1/From_Face"): True, - model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): True, # Faces of solid 4 model.selection("FACE", "Extrusion_3_1/To_Face"): True, model.selection("FACE", "Extrusion_3_1/From_Face"): True, - model.selection("FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): True, # Faces of solid 5 model.selection("FACE", "Extrusion_4_1/To_Face"): True, model.selection("FACE", "Extrusion_4_1/From_Face"): True, - model.selection("FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): True, # Faces of solid 6 model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): True, - # Edges of solid 1 - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): True, # Edges of solid 2 - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): False, # Edges of solid 3 - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): True, - model.selection("EDGE", "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])"): True, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): True, + model.selection( + "EDGE", + "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])", + ): True, # Edges of solid 4 - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): True, - model.selection("EDGE", "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])"): True, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): True, + model.selection( + "EDGE", + "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])", + ): True, # Edges of solid 5 - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): True, - model.selection("EDGE", "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])"): True, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): True, + model.selection( + "EDGE", + "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])", + ): True, # Edges of solid 6 - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): True, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): True, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): False, - + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): True, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): True, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): False, # Vertices of solid 1 - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): True, - 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]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): True, + 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]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): True, # Vertices of solid 2 - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): False, # Vertices of solid 3 - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): True, # Vertices of solid 4 - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): True, # Vertices of solid 5 - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): True, # Vertices of solid 6 - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): False, - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): False, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): False, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): False, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_OutAndOn.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_OutAndOn.py index a8ae1787d..cdf7845c6 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_OutAndOn.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_OutAndOn.py @@ -26,154 +26,448 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 20, 0, 0, 20, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 20) SketchLine_3 = Sketch_1.addLine(0, 32.83768482493814, 29.63380351263586, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result()) -SketchLine_4 = Sketch_1.addLine(29.63380351263586, 0, 62.471488337574, 29.63380351263586) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(32.83768482493814, 62.471488337574, 0, 32.83768482493814) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_6.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_5.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_3.result(), 22, True) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_1.result() +) +SketchLine_4 = Sketch_1.addLine( + 29.63380351263586, 0, 62.471488337574, 29.63380351263586 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + 32.83768482493814, 62.471488337574, 0, 32.83768482493814 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_6.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_3.result(), SketchLine_5.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_3.result(), 22, True +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) SketchLine_7 = Sketch_1.addLine(0, 20, 0, 0) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint() +) SketchLine_8 = Sketch_1.addLine(0, 0, 20, 0) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_8.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f"), model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f")], model.selection(), 30, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f", + ), + model.selection( + "FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f" + ), + ], + model.selection(), + 30, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) SketchCircle_1 = Sketch_2.addCircle(28.24714778717828, 31.38901581881253, 10) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_9 = SketchProjection_3.createdFeature() -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_9.result(), 20, True) -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), False) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_9.result(), 20, True +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_10 = SketchProjection_4.createdFeature() -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_10.result(), 20, True) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_10.result(), 20, True +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 10) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 10, 0) -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), 0, 10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), -10, 20) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", exclude = True, args = [model.selection("SOLID", "Extrusion_1_1"), "not_in"])]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], + model.selection(), + 10, + 0, +) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + 0, + 10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + -10, + 20, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10 +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="RelativeToSolid", + exclude=True, + args=[model.selection("SOLID", "Extrusion_1_1"), "not_in"], + ) + ], +) model.end() Reference = { # Faces of solid 1 model.selection("FACE", "Extrusion_1_1/To_Face"): False, model.selection("FACE", "Extrusion_1_1/From_Face"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6"): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3" + ): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4" + ): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5" + ): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6" + ): False, # Faces of solid 2 model.selection("FACE", "Extrusion_1_2/To_Face"): False, model.selection("FACE", "Extrusion_1_2/From_Face"): False, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7"): False, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8"): False, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2"): False, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7" + ): False, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8" + ): False, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2" + ): False, # Faces of solid 3 model.selection("FACE", "Extrusion_2_1/To_Face"): False, model.selection("FACE", "Extrusion_2_1/From_Face"): False, - model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): False, # Faces of solid 4 model.selection("FACE", "Extrusion_3_1/To_Face"): False, model.selection("FACE", "Extrusion_3_1/From_Face"): True, - model.selection("FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): True, # Faces of solid 5 model.selection("FACE", "Extrusion_4_1/To_Face"): True, model.selection("FACE", "Extrusion_4_1/From_Face"): True, - model.selection("FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): True, # Faces of solid 6 model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): True, - # Edges of solid 1 - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): False, # Edges of solid 2 - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): False, # Edges of solid 3 - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): False, - model.selection("EDGE", "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])"): False, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])", + ): False, # Edges of solid 4 - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): True, - model.selection("EDGE", "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])"): True, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): True, + model.selection( + "EDGE", + "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])", + ): True, # Edges of solid 5 - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): True, - model.selection("EDGE", "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])"): True, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): True, + model.selection( + "EDGE", + "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])", + ): True, # Edges of solid 6 - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): True, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): True, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): False, - + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): True, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): True, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): False, # Vertices of solid 1 - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): False, - 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, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): False, + 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, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, # Vertices of solid 2 - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): False, # Vertices of solid 3 - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): False, # Vertices of solid 4 - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): True, # Vertices of solid 5 - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): True, # Vertices of solid 6 - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): False, - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): False, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): False, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): False, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_In.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_In.py index 9888a9dd1..212f7030c 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_In.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_In.py @@ -26,154 +26,447 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 20, 0, 0, 20, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 20) SketchLine_3 = Sketch_1.addLine(0, 32.83768482493814, 29.63380351263586, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result()) -SketchLine_4 = Sketch_1.addLine(29.63380351263586, 0, 62.471488337574, 29.63380351263586) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(32.83768482493814, 62.471488337574, 0, 32.83768482493814) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_6.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_5.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_3.result(), 22, True) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_1.result() +) +SketchLine_4 = Sketch_1.addLine( + 29.63380351263586, 0, 62.471488337574, 29.63380351263586 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + 32.83768482493814, 62.471488337574, 0, 32.83768482493814 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_6.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_3.result(), SketchLine_5.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_3.result(), 22, True +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) SketchLine_7 = Sketch_1.addLine(0, 20, 0, 0) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint() +) SketchLine_8 = Sketch_1.addLine(0, 0, 20, 0) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_8.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f"), model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f")], model.selection(), 30, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f", + ), + model.selection( + "FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f" + ), + ], + model.selection(), + 30, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) SketchCircle_1 = Sketch_2.addCircle(28.24714778717828, 31.38901581881253, 10) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_9 = SketchProjection_3.createdFeature() -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_9.result(), 20, True) -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), False) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_9.result(), 20, True +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_10 = SketchProjection_4.createdFeature() -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_10.result(), 20, True) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_10.result(), 20, True +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 10) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 10, 0) -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), 0, 10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), -10, 20) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", args = [model.selection("SOLID", "Extrusion_1_1"), "in"])]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], + model.selection(), + 10, + 0, +) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + 0, + 10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + -10, + 20, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10 +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="RelativeToSolid", + args=[model.selection("SOLID", "Extrusion_1_1"), "in"], + ) + ], +) model.end() Reference = { # Faces of solid 1 model.selection("FACE", "Extrusion_1_1/To_Face"): False, model.selection("FACE", "Extrusion_1_1/From_Face"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6"): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3" + ): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4" + ): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5" + ): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6" + ): False, # Faces of solid 2 model.selection("FACE", "Extrusion_1_2/To_Face"): False, model.selection("FACE", "Extrusion_1_2/From_Face"): False, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7"): False, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8"): False, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2"): False, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7" + ): False, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8" + ): False, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2" + ): False, # Faces of solid 3 model.selection("FACE", "Extrusion_2_1/To_Face"): False, model.selection("FACE", "Extrusion_2_1/From_Face"): False, - model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): False, # Faces of solid 4 model.selection("FACE", "Extrusion_3_1/To_Face"): False, model.selection("FACE", "Extrusion_3_1/From_Face"): True, - model.selection("FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): False, # Faces of solid 5 model.selection("FACE", "Extrusion_4_1/To_Face"): True, model.selection("FACE", "Extrusion_4_1/From_Face"): True, - model.selection("FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): True, # Faces of solid 6 model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): False, - # Edges of solid 1 - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): False, # Edges of solid 2 - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): False, # Edges of solid 3 - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): False, - model.selection("EDGE", "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])"): False, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])", + ): False, # Edges of solid 4 - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): True, - model.selection("EDGE", "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])"): False, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): True, + model.selection( + "EDGE", + "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])", + ): False, # Edges of solid 5 - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): True, - model.selection("EDGE", "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])"): True, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): True, + model.selection( + "EDGE", + "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])", + ): True, # Edges of solid 6 - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): False, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): False, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): False, - + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): False, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): False, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): False, # Vertices of solid 1 - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): False, - 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, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): False, + 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, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, # Vertices of solid 2 - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): False, # Vertices of solid 3 - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): False, # Vertices of solid 4 - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): True, # Vertices of solid 5 - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): True, # Vertices of solid 6 - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): False, - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): False, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): False, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): False, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_InAndOn.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_InAndOn.py index b44f2a3ec..ac6f05660 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_InAndOn.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_InAndOn.py @@ -26,54 +26,164 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 20, 0, 0, 20, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 20) SketchLine_3 = Sketch_1.addLine(0, 32.83768482493814, 29.63380351263586, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result()) -SketchLine_4 = Sketch_1.addLine(29.63380351263586, 0, 62.471488337574, 29.63380351263586) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(32.83768482493814, 62.471488337574, 0, 32.83768482493814) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_6.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_5.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_3.result(), 22, True) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_1.result() +) +SketchLine_4 = Sketch_1.addLine( + 29.63380351263586, 0, 62.471488337574, 29.63380351263586 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + 32.83768482493814, 62.471488337574, 0, 32.83768482493814 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_6.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_3.result(), SketchLine_5.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_3.result(), 22, True +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) SketchLine_7 = Sketch_1.addLine(0, 20, 0, 0) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint() +) SketchLine_8 = Sketch_1.addLine(0, 0, 20, 0) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_8.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f"), model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f")], model.selection(), 30, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f", + ), + model.selection( + "FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f" + ), + ], + model.selection(), + 30, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) SketchCircle_1 = Sketch_2.addCircle(28.24714778717828, 31.38901581881253, 10) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_9 = SketchProjection_3.createdFeature() -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_9.result(), 20, True) -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), False) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_9.result(), 20, True +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_10 = SketchProjection_4.createdFeature() -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_10.result(), 20, True) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_10.result(), 20, True +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 10) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 10, 0) -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), 0, 10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), -10, 20) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", args = [model.selection("SOLID", "Extrusion_1_1"), "not_out"])]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], + model.selection(), + 10, + 0, +) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + 0, + 10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + -10, + 20, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10 +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="RelativeToSolid", + args=[model.selection("SOLID", "Extrusion_1_1"), "not_out"], + ) + ], +) model.end() Reference = { @@ -87,93 +197,268 @@ Reference = { # Faces of solid 2 model.selection("FACE", "Extrusion_1_2/To_Face"): False, model.selection("FACE", "Extrusion_1_2/From_Face"): False, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7"): False, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8"): False, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2"): False, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7" + ): False, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8" + ): False, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2" + ): False, # Faces of solid 3 model.selection("FACE", "Extrusion_2_1/To_Face"): False, model.selection("FACE", "Extrusion_2_1/From_Face"): True, - model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): False, # Faces of solid 4 model.selection("FACE", "Extrusion_3_1/To_Face"): True, model.selection("FACE", "Extrusion_3_1/From_Face"): True, - model.selection("FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): True, # Faces of solid 5 model.selection("FACE", "Extrusion_4_1/To_Face"): True, model.selection("FACE", "Extrusion_4_1/From_Face"): True, - model.selection("FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): True, # Faces of solid 6 model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): False, - # Edges of solid 1 - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): True, # Edges of solid 2 - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): False, # Edges of solid 3 - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): True, - model.selection("EDGE", "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])"): False, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): True, + model.selection( + "EDGE", + "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])", + ): False, # Edges of solid 4 - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): True, - model.selection("EDGE", "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])"): True, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): True, + model.selection( + "EDGE", + "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])", + ): True, # Edges of solid 5 - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): True, - model.selection("EDGE", "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])"): True, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): True, + model.selection( + "EDGE", + "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])", + ): True, # Edges of solid 6 - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): False, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): False, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): False, - + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): False, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): False, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): False, # Vertices of solid 1 - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): True, - 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]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): True, + 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]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): True, # Vertices of solid 2 - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): False, # Vertices of solid 3 - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): True, # Vertices of solid 4 - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): True, # Vertices of solid 5 - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): True, # Vertices of solid 6 - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): False, - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): False, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): False, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): False, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Multi.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Multi.py index 650113200..083fc5765 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Multi.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Multi.py @@ -24,38 +24,78 @@ 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(18.85055999990443, 20.40038647424626, 12.41450630559296) -SketchCircle_2 = Sketch_1.addCircle(25.08744138385902, 26.81117176326632, 2.271058181559462) +SketchCircle_1 = Sketch_1.addCircle( + 18.85055999990443, 20.40038647424626, 12.41450630559296 +) +SketchCircle_2 = Sketch_1.addCircle( + 25.08744138385902, 26.81117176326632, 2.271058181559462 +) SketchCircle_2.setName("SketchCircle_3") SketchCircle_2.result().setName("SketchCircle_3") SketchCircle_2.results()[1].setName("SketchCircle_3_2") model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_3 = Sketch_2.addCircle(30.95603034069762, 31.40670583726882, 10.95693005417035) +SketchCircle_3 = Sketch_2.addCircle( + 30.95603034069762, 31.40670583726882, 10.95693005417035 +) SketchCircle_3.setName("SketchCircle_4") SketchCircle_3.result().setName("SketchCircle_4") SketchCircle_3.results()[1].setName("SketchCircle_4_2") model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r-SketchCircle_3_2r_wire")], model.selection(), 50, 0) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_4_2r_wire")], model.selection(), 40, -10) -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_3_2f")], model.selection(), 20, -30) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r-SketchCircle_3_2r_wire")], + model.selection(), + 50, + 0, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_2/Face-SketchCircle_4_2r_wire")], + model.selection(), + 40, + -10, +) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_3_2f")], + model.selection(), + 20, + -30, +) # Two filters to search all face inside of two solids -Filters = model.filters(Part_1_doc, [ - model.addFilter(name = "RelativeToSolid", args = [model.selection("SOLID", "Extrusion_1_1"), "in"]), - model.addFilter(name = "RelativeToSolid", args = [model.selection("SOLID", "Extrusion_2_1"), "in"])]) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="RelativeToSolid", + args=[model.selection("SOLID", "Extrusion_1_1"), "in"], + ), + model.addFilter( + name="RelativeToSolid", + args=[model.selection("SOLID", "Extrusion_2_1"), "in"], + ), + ], +) model.end() # 3 faces of internal cylinder is inside Reference = { - model.selection("FACE", "Extrusion_3_1/Generated_Face&Sketch_1/SketchCircle_3_2"): True, + model.selection( + "FACE", "Extrusion_3_1/Generated_Face&Sketch_1/SketchCircle_3_2" + ): True, model.selection("FACE", "Extrusion_3_1/From_Face"): True, model.selection("FACE", "Extrusion_3_1/To_Face"): True, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2" + ): False, model.selection("FACE", "Extrusion_1_1/From_Face"): False, model.selection("FACE", "Extrusion_1_1/To_Face"): False, - model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_4_2"): False, + model.selection( + "FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_4_2" + ): False, model.selection("FACE", "Extrusion_2_1/From_Face"): False, - model.selection("FACE", "Extrusion_2_1/To_Face"): False + model.selection("FACE", "Extrusion_2_1/To_Face"): False, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_NotOn.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_NotOn.py index f3d478116..968b8cde3 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_NotOn.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_NotOn.py @@ -26,154 +26,443 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 20, 0, 0, 20, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 20) SketchLine_3 = Sketch_1.addLine(0, 32.83768482493814, 29.63380351263586, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result()) -SketchLine_4 = Sketch_1.addLine(29.63380351263586, 0, 62.471488337574, 29.63380351263586) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(32.83768482493814, 62.471488337574, 0, 32.83768482493814) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_6.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_5.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_3.result(), 22, True) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_1.result() +) +SketchLine_4 = Sketch_1.addLine( + 29.63380351263586, 0, 62.471488337574, 29.63380351263586 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + 32.83768482493814, 62.471488337574, 0, 32.83768482493814 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_6.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_3.result(), SketchLine_5.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_3.result(), 22, True +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) SketchLine_7 = Sketch_1.addLine(0, 20, 0, 0) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint() +) SketchLine_8 = Sketch_1.addLine(0, 0, 20, 0) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_8.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f"), model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f")], model.selection(), 30, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f", + ), + model.selection( + "FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f" + ), + ], + model.selection(), + 30, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) SketchCircle_1 = Sketch_2.addCircle(28.24714778717828, 31.38901581881253, 10) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_9 = SketchProjection_3.createdFeature() -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_9.result(), 20, True) -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), False) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_9.result(), 20, True +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_10 = SketchProjection_4.createdFeature() -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_10.result(), 20, True) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_10.result(), 20, True +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 10) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 10, 0) -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), 0, 10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), -10, 20) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", args = [model.selection("SOLID", "Extrusion_1_1"), "not_on"])]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], + model.selection(), + 10, + 0, +) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + 0, + 10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + -10, + 20, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10 +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="RelativeToSolid", + args=[model.selection("SOLID", "Extrusion_1_1"), "not_on"], + ) + ], +) model.end() Reference = { # Faces of solid 1 model.selection("FACE", "Extrusion_1_1/To_Face"): False, model.selection("FACE", "Extrusion_1_1/From_Face"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6"): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3" + ): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4" + ): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5" + ): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6" + ): False, # Faces of solid 2 model.selection("FACE", "Extrusion_1_2/To_Face"): True, model.selection("FACE", "Extrusion_1_2/From_Face"): True, model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7"): True, model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8"): True, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2"): True, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2" + ): True, # Faces of solid 3 model.selection("FACE", "Extrusion_2_1/To_Face"): True, model.selection("FACE", "Extrusion_2_1/From_Face"): False, - model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): False, # Faces of solid 4 model.selection("FACE", "Extrusion_3_1/To_Face"): False, model.selection("FACE", "Extrusion_3_1/From_Face"): True, - model.selection("FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): False, # Faces of solid 5 model.selection("FACE", "Extrusion_4_1/To_Face"): True, model.selection("FACE", "Extrusion_4_1/From_Face"): True, - model.selection("FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): True, # Faces of solid 6 model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): False, - # Edges of solid 1 - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): False, # Edges of solid 2 - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): True, # Edges of solid 3 - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): False, - model.selection("EDGE", "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])"): False, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])", + ): False, # Edges of solid 4 - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): True, - model.selection("EDGE", "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])"): False, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): True, + model.selection( + "EDGE", + "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])", + ): False, # Edges of solid 5 - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): True, - model.selection("EDGE", "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])"): True, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): True, + model.selection( + "EDGE", + "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])", + ): True, # Edges of solid 6 - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): False, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): False, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): True, - + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): False, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): False, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): True, # Vertices of solid 1 - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): False, - 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, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): False, + 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, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, # Vertices of solid 2 - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): True, # Vertices of solid 3 - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): False, # Vertices of solid 4 - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): True, # Vertices of solid 5 - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): True, # Vertices of solid 6 - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): True, - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): True, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): True, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): True, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_On.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_On.py index d1c4a93fa..7f6301a9b 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_On.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_On.py @@ -26,54 +26,164 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 20, 0, 0, 20, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 20) SketchLine_3 = Sketch_1.addLine(0, 32.83768482493814, 29.63380351263586, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result()) -SketchLine_4 = Sketch_1.addLine(29.63380351263586, 0, 62.471488337574, 29.63380351263586) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(32.83768482493814, 62.471488337574, 0, 32.83768482493814) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_6.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_5.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_3.result(), 22, True) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_1.result() +) +SketchLine_4 = Sketch_1.addLine( + 29.63380351263586, 0, 62.471488337574, 29.63380351263586 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + 32.83768482493814, 62.471488337574, 0, 32.83768482493814 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_6.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_3.result(), SketchLine_5.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_3.result(), 22, True +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) SketchLine_7 = Sketch_1.addLine(0, 20, 0, 0) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint() +) SketchLine_8 = Sketch_1.addLine(0, 0, 20, 0) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_8.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f"), model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f")], model.selection(), 30, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f", + ), + model.selection( + "FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f" + ), + ], + model.selection(), + 30, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) SketchCircle_1 = Sketch_2.addCircle(28.24714778717828, 31.38901581881253, 10) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_9 = SketchProjection_3.createdFeature() -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_9.result(), 20, True) -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), False) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_9.result(), 20, True +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_10 = SketchProjection_4.createdFeature() -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_10.result(), 20, True) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_10.result(), 20, True +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 10) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 10, 0) -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), 0, 10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), -10, 20) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", args = [model.selection("SOLID", "Extrusion_1_1"), "on"])]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], + model.selection(), + 10, + 0, +) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + 0, + 10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + -10, + 20, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10 +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="RelativeToSolid", + args=[model.selection("SOLID", "Extrusion_1_1"), "on"], + ) + ], +) model.end() Reference = { @@ -87,93 +197,268 @@ Reference = { # Faces of solid 2 model.selection("FACE", "Extrusion_1_2/To_Face"): False, model.selection("FACE", "Extrusion_1_2/From_Face"): False, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7"): False, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8"): False, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2"): False, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7" + ): False, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8" + ): False, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2" + ): False, # Faces of solid 3 model.selection("FACE", "Extrusion_2_1/To_Face"): False, model.selection("FACE", "Extrusion_2_1/From_Face"): True, - model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): False, # Faces of solid 4 model.selection("FACE", "Extrusion_3_1/To_Face"): True, model.selection("FACE", "Extrusion_3_1/From_Face"): False, - model.selection("FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): False, # Faces of solid 5 model.selection("FACE", "Extrusion_4_1/To_Face"): False, model.selection("FACE", "Extrusion_4_1/From_Face"): False, - model.selection("FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): False, # Faces of solid 6 model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): False, - # Edges of solid 1 - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): True, # Edges of solid 2 - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): False, # Edges of solid 3 - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): True, - model.selection("EDGE", "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])"): False, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): True, + model.selection( + "EDGE", + "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])", + ): False, # Edges of solid 4 - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): False, - model.selection("EDGE", "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])"): False, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])", + ): False, # Edges of solid 5 - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): False, - model.selection("EDGE", "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])"): False, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])", + ): False, # Edges of solid 6 - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): False, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): False, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): False, - + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): False, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): False, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): False, # Vertices of solid 1 - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): True, - 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]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): True, + 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]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): True, # Vertices of solid 2 - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): False, # Vertices of solid 3 - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): True, # Vertices of solid 4 - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): False, # Vertices of solid 5 - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): False, # Vertices of solid 6 - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): False, - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): False, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): False, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): False, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Out.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Out.py index 35ac04690..3e2ee122e 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Out.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Out.py @@ -26,154 +26,443 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 20, 0, 0, 20, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 20) SketchLine_3 = Sketch_1.addLine(0, 32.83768482493814, 29.63380351263586, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result()) -SketchLine_4 = Sketch_1.addLine(29.63380351263586, 0, 62.471488337574, 29.63380351263586) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(32.83768482493814, 62.471488337574, 0, 32.83768482493814) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_6.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_5.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_3.result(), 22, True) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_1.result() +) +SketchLine_4 = Sketch_1.addLine( + 29.63380351263586, 0, 62.471488337574, 29.63380351263586 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + 32.83768482493814, 62.471488337574, 0, 32.83768482493814 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_6.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_3.result(), SketchLine_5.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_3.result(), 22, True +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) SketchLine_7 = Sketch_1.addLine(0, 20, 0, 0) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint() +) SketchLine_8 = Sketch_1.addLine(0, 0, 20, 0) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_8.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f"), model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f")], model.selection(), 30, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f", + ), + model.selection( + "FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f" + ), + ], + model.selection(), + 30, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) SketchCircle_1 = Sketch_2.addCircle(28.24714778717828, 31.38901581881253, 10) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_9 = SketchProjection_3.createdFeature() -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_9.result(), 20, True) -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), False) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_9.result(), 20, True +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_10 = SketchProjection_4.createdFeature() -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_10.result(), 20, True) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_10.result(), 20, True +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 10) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 10, 0) -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), 0, 10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), -10, 20) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", args = [model.selection("SOLID", "Extrusion_1_1"), "out"])]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], + model.selection(), + 10, + 0, +) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + 0, + 10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + -10, + 20, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10 +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="RelativeToSolid", + args=[model.selection("SOLID", "Extrusion_1_1"), "out"], + ) + ], +) model.end() Reference = { # Faces of solid 1 model.selection("FACE", "Extrusion_1_1/To_Face"): False, model.selection("FACE", "Extrusion_1_1/From_Face"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"): False, - model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6"): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3" + ): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4" + ): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5" + ): False, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6" + ): False, # Faces of solid 2 model.selection("FACE", "Extrusion_1_2/To_Face"): True, model.selection("FACE", "Extrusion_1_2/From_Face"): True, model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7"): True, model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8"): True, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2"): True, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2" + ): True, # Faces of solid 3 model.selection("FACE", "Extrusion_2_1/To_Face"): True, model.selection("FACE", "Extrusion_2_1/From_Face"): False, - model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): False, # Faces of solid 4 model.selection("FACE", "Extrusion_3_1/To_Face"): False, model.selection("FACE", "Extrusion_3_1/From_Face"): False, - model.selection("FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): False, # Faces of solid 5 model.selection("FACE", "Extrusion_4_1/To_Face"): False, model.selection("FACE", "Extrusion_4_1/From_Face"): False, - model.selection("FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): False, # Faces of solid 6 model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): False, - # Edges of solid 1 - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): False, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): False, # Edges of solid 2 - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): True, # Edges of solid 3 - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): False, - model.selection("EDGE", "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])"): False, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])", + ): False, # Edges of solid 4 - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): False, - model.selection("EDGE", "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])"): False, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])", + ): False, # Edges of solid 5 - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): False, - model.selection("EDGE", "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])"): False, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])", + ): False, # Edges of solid 6 - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): False, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): False, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): True, - + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): False, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): False, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): True, # Vertices of solid 1 - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): False, - 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, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): False, + 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, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): False, # Vertices of solid 2 - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): True, # Vertices of solid 3 - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): False, # Vertices of solid 4 - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): False, # Vertices of solid 5 - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): False, # Vertices of solid 6 - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): True, - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): True, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): True, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): True, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_OutAndOn.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_OutAndOn.py index a45068d9d..2dcf083e3 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_OutAndOn.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_OutAndOn.py @@ -26,54 +26,164 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 20, 0, 0, 20, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 20) SketchLine_3 = Sketch_1.addLine(0, 32.83768482493814, 29.63380351263586, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result()) -SketchLine_4 = Sketch_1.addLine(29.63380351263586, 0, 62.471488337574, 29.63380351263586) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(32.83768482493814, 62.471488337574, 0, 32.83768482493814) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_6.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_5.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_3.result(), 22, True) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_1.result() +) +SketchLine_4 = Sketch_1.addLine( + 29.63380351263586, 0, 62.471488337574, 29.63380351263586 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 62.471488337574, 29.63380351263586, 32.83768482493814, 62.471488337574 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + 32.83768482493814, 62.471488337574, 0, 32.83768482493814 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_6.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_3.result(), SketchLine_5.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_3.result(), 22, True +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) SketchLine_7 = Sketch_1.addLine(0, 20, 0, 0) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint() +) SketchLine_8 = Sketch_1.addLine(0, 0, 20, 0) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_8.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f"), model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f")], model.selection(), 30, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f", + ), + model.selection( + "FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_7f-SketchLine_8f" + ), + ], + model.selection(), + 30, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) SketchCircle_1 = Sketch_2.addCircle(28.24714778717828, 31.38901581881253, 10) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_9 = SketchProjection_3.createdFeature() -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_9.result(), 20, True) -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), False) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_9.result(), 20, True +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_10 = SketchProjection_4.createdFeature() -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_10.result(), 20, True) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_10.result(), 20, True +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 10) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 10, 0) -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), 0, 10) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), -10, 20) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", args = [model.selection("SOLID", "Extrusion_1_1"), "not_in"])]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], + model.selection(), + 10, + 0, +) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + 0, + 10, +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + -10, + 20, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], 50, 10, 10 +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="RelativeToSolid", + args=[model.selection("SOLID", "Extrusion_1_1"), "not_in"], + ) + ], +) model.end() Reference = { @@ -89,91 +199,262 @@ Reference = { model.selection("FACE", "Extrusion_1_2/From_Face"): True, model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7"): True, model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8"): True, - model.selection("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2"): True, + model.selection( + "FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2" + ): True, # Faces of solid 3 model.selection("FACE", "Extrusion_2_1/To_Face"): True, model.selection("FACE", "Extrusion_2_1/From_Face"): True, - model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2"): True, + model.selection( + "FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): True, # Faces of solid 4 model.selection("FACE", "Extrusion_3_1/To_Face"): True, model.selection("FACE", "Extrusion_3_1/From_Face"): False, - model.selection("FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): False, # Faces of solid 5 model.selection("FACE", "Extrusion_4_1/To_Face"): False, model.selection("FACE", "Extrusion_4_1/From_Face"): False, - model.selection("FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2"): False, + model.selection( + "FACE", "Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2" + ): False, # Faces of solid 6 model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): False, - # Edges of solid 1 - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", + ): True, # Edges of solid 2 - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): True, - model.selection("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): True, # Edges of solid 3 - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): True, - model.selection("EDGE", "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])"): True, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): True, + model.selection( + "EDGE", + "([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face])([Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face])", + ): True, # Edges of solid 4 - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): True, - model.selection("EDGE", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): False, - model.selection("EDGE", "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])"): False, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): True, + model.selection( + "EDGE", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face])([Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face])", + ): False, # Edges of solid 5 - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): False, - model.selection("EDGE", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): False, - model.selection("EDGE", "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])"): False, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): False, + model.selection( + "EDGE", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): False, + model.selection( + "EDGE", + "([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face])([Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face])", + ): False, # Edges of solid 6 - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): False, - model.selection("EDGE", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): False, - model.selection("EDGE", "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])"): True, - + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): False, + model.selection( + "EDGE", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): False, + model.selection( + "EDGE", + "([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2])([Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3])", + ): True, # Vertices of solid 1 - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"): True, - 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]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]", + ): True, + 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]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]", + ): True, # Vertices of solid 2 - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]"): True, - model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_2/From_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_1_2/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/From_Face]", + ): True, # Vertices of solid 3 - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]"): True, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_2_1/From_Face]", + ): True, # Vertices of solid 4 - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]"): True, - model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/To_Face]", + ): True, + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_3_1/From_Face]", + ): False, # Vertices of solid 5 - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]"): False, - model.selection("VERTEX", "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]"): False, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/To_Face]", + ): False, + model.selection( + "VERTEX", + "[Extrusion_4_1/Generated_Face&Sketch_2/SketchCircle_1_2][Extrusion_4_1/From_Face]", + ): False, # Vertices of solid 6 - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]"): True, - model.selection("VERTEX", "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]"): True, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_2]", + ): True, + model.selection( + "VERTEX", + "[Translation_1_1/MF:Translated&Cylinder_1_1/Face_1][Translation_1_1/MF:Translated&Cylinder_1_1/Face_3]", + ): True, } model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Edge1.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Edge1.py index 449e7cbd9..337a60e7c 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Edge1.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Edge1.py @@ -25,12 +25,44 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", args = [model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), False])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection( + "EDGE", + "[Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]", + ), + False, + ], + ) + ], +) model.end() Reference = {} @@ -38,35 +70,41 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = False + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = False + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Edge2.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Edge2.py index b657bd235..ecf9081e7 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Edge2.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Edge2.py @@ -25,12 +25,43 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", args = [model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top"), False])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top" + ), + False, + ], + ) + ], +) model.end() Reference = {} @@ -38,38 +69,50 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = False + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = False + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_3, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = False; exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = False +exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Edge3.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Edge3.py index 72f1276b7..fcc0d77f4 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Edge3.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Edge3.py @@ -25,12 +25,44 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", args = [model.selection("EDGE", "([Cylinder_1_1/Face_1][Cylinder_1_1/Face_2])([Cylinder_1_1/Face_1][Cylinder_1_1/Face_3])"), False])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection( + "EDGE", + "([Cylinder_1_1/Face_1][Cylinder_1_1/Face_2])([Cylinder_1_1/Face_1][Cylinder_1_1/Face_3])", + ), + False, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +70,35 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = False + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = False + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = False + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultCylinder_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultCylinder_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultCylinder_1, exp.current())] = False; exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = False +exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Edge1.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Edge1.py index f8592b825..a34b85e02 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Edge1.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Edge1.py @@ -25,12 +25,45 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", exclude = True, args = [model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), False])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + exclude=True, + args=[ + model.selection( + "EDGE", + "[Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]", + ), + False, + ], + ) + ], +) model.end() Reference = {} @@ -38,35 +71,41 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = True + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = True + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Edge2.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Edge2.py index fe2fdcb8a..ed3fbc5c2 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Edge2.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Edge2.py @@ -25,12 +25,44 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", exclude = True, args = [model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top"), False])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + exclude=True, + args=[ + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top" + ), + False, + ], + ) + ], +) model.end() Reference = {} @@ -38,38 +70,50 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = True + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = True + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_3, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = True; exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = True +exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Edge3.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Edge3.py index 054807a51..196fe2688 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Edge3.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Edge3.py @@ -25,12 +25,45 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", exclude = True, args = [model.selection("EDGE", "([Cylinder_1_1/Face_1][Cylinder_1_1/Face_2])([Cylinder_1_1/Face_1][Cylinder_1_1/Face_3])"), False])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + exclude=True, + args=[ + model.selection( + "EDGE", + "([Cylinder_1_1/Face_1][Cylinder_1_1/Face_2])([Cylinder_1_1/Face_1][Cylinder_1_1/Face_3])", + ), + False, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +71,35 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = True + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = True + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = True + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultCylinder_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultCylinder_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultCylinder_1, exp.current())] = True; exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = True +exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Face1.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Face1.py index 91b729c6e..61c5d930e 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Face1.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Face1.py @@ -25,51 +25,93 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", exclude = True, args = [model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Left"), False])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + exclude=True, + args=[ + model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Left"), + False, + ], + ) + ], +) model.end() Reference = {} # Faces of the box ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_0, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = False; exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = False +exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = True + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Face2.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Face2.py index 39182d5f5..24fad5e19 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Face2.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Face2.py @@ -25,57 +25,111 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", exclude = True, args = [model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top"), False])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + exclude=True, + args=[ + model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top"), + False, + ], + ) + ], +) model.end() Reference = {} # Faces of the box ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_0, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = False; exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = False +exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_3, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = False; exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = False +exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Face3.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Face3.py index f3e899c3e..895dcf2b0 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Face3.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Face3.py @@ -25,12 +25,39 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", exclude = True, args = [model.selection("FACE", "Cylinder_1_1/Face_3"), False])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + exclude=True, + args=[model.selection("FACE", "Cylinder_1_1/Face_3"), False], + ) + ], +) model.end() Reference = {} @@ -38,32 +65,35 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = True + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = True + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = True + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultCylinder_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultCylinder_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultCylinder_1, exp.current())] = False; exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = False +exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Vertex1.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Vertex1.py index 31b242b27..9615c3159 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Vertex1.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Vertex1.py @@ -25,12 +25,45 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", exclude = True, args = [model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), False])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + exclude=True, + args=[ + model.selection( + "VERTEX", + "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]", + ), + False, + ], + ) + ], +) model.end() Reference = {} @@ -38,35 +71,41 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = True + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = True + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Vertex2.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Vertex2.py index 94839d5fb..40f702549 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Vertex2.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Vertex2.py @@ -25,57 +25,114 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", exclude = True, args = [model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Plane_1/Plane_1][Partition_1_1_2/Modified_Face&Plane_2/Plane_2]"), False])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + exclude=True, + args=[ + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Plane_1/Plane_1][Partition_1_1_2/Modified_Face&Plane_2/Plane_2]", + ), + False, + ], + ) + ], +) model.end() Reference = {} # Faces of the box ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_0, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = False; exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = False +exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_3, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = True; exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = True +exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Vertex3.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Vertex3.py index c7a992c76..695d9e7ff 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Vertex3.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Exclude_Vertex3.py @@ -25,12 +25,42 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", exclude = True, args = [model.selection("VERTEX", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]"), False])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + exclude=True, + args=[ + model.selection("VERTEX", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]"), + False, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +68,35 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = True + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = True + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = True + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultCylinder_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultCylinder_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultCylinder_1, exp.current())] = False; exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = False +exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Face1.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Face1.py index b37cd98d4..8dffb37ad 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Face1.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Face1.py @@ -25,51 +25,92 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", args = [model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Left"), False])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Left"), + False, + ], + ) + ], +) model.end() Reference = {} # Faces of the box ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_0, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = True; exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = True +exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = False + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Face2.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Face2.py index a3df0ce1e..46ecb8e39 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Face2.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Face2.py @@ -25,57 +25,110 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", args = [model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top"), False])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top"), + False, + ], + ) + ], +) model.end() Reference = {} # Faces of the box ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_0, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = True; exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = True +exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_3, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = True; exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = True +exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Face3.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Face3.py index 9fbc99b7b..b5b2a779a 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Face3.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Face3.py @@ -25,12 +25,38 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", args = [model.selection("FACE", "Cylinder_1_1/Face_3"), False])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[model.selection("FACE", "Cylinder_1_1/Face_3"), False], + ) + ], +) model.end() Reference = {} @@ -38,32 +64,35 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = False + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = False + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = False + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultCylinder_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultCylinder_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultCylinder_1, exp.current())] = True; exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = True +exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Multi.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Multi.py index 459748080..13dc1619b 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Multi.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Multi.py @@ -28,67 +28,161 @@ 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(-21.08194442253927, 8.656344751543489, 0, 30) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) SketchLine_3 = Sketch_1.addLine(0, 30, 25.98076211353316, 15) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(25.98076211353316, 15, 18.03758667002239, -13.92932705531892) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(18.03758667002239, -13.92932705531892, -11.39496253934835, -19.73665406849542) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(-11.39496253934835, -19.73665406849542, -21.08194442253927, 8.656344751543489) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.endPoint()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_5.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_1.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_6.result(), SketchLine_3.result()) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_5.result()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + 25.98076211353316, 15, 18.03758667002239, -13.92932705531892 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 18.03758667002239, -13.92932705531892, -11.39496253934835, -19.73665406849542 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + -11.39496253934835, -19.73665406849542, -21.08194442253927, 8.656344751543489 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_6.endPoint() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_5.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_4.result(), SketchLine_1.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_6.result(), SketchLine_3.result() +) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_5.result() +) SketchLine_7 = Sketch_1.addLine(-11.39496253934835, -19.73665406849542, 0, 0) SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_7.endPoint() +) SketchLine_8 = Sketch_1.addLine(-21.08194442253927, 8.656344751543489, 0, 0) SketchLine_8.setAuxiliary(True) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_8.endPoint() +) SketchLine_9 = Sketch_1.addLine(0, 30, 0, 0) SketchLine_9.setAuxiliary(True) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_9.endPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_9.endPoint() +) SketchLine_10 = Sketch_1.addLine(25.98076211353316, 15, 0, 0) SketchLine_10.setAuxiliary(True) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_10.endPoint() +) SketchLine_11 = Sketch_1.addLine(18.03758667002239, -13.92932705531892, 0, 0) SketchLine_11.setAuxiliary(True) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_11.endPoint()) -SketchConstraintEqual_5 = Sketch_1.setEqual(SketchLine_7.result(), SketchLine_8.result()) -SketchConstraintEqual_6 = Sketch_1.setEqual(SketchLine_11.result(), SketchLine_7.result()) -SketchConstraintEqual_7 = Sketch_1.setEqual(SketchLine_10.result(), SketchLine_9.result()) -SketchConstraintEqual_8 = Sketch_1.setEqual(SketchLine_10.result(), SketchLine_3.result()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_11.endPoint() +) +SketchConstraintEqual_5 = Sketch_1.setEqual( + SketchLine_7.result(), SketchLine_8.result() +) +SketchConstraintEqual_6 = Sketch_1.setEqual( + SketchLine_11.result(), SketchLine_7.result() +) +SketchConstraintEqual_7 = Sketch_1.setEqual( + SketchLine_10.result(), SketchLine_9.result() +) +SketchConstraintEqual_8 = Sketch_1.setEqual( + SketchLine_10.result(), SketchLine_3.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 30) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r", + ) + ], + model.selection(), + 10, + 0, +) model.do() # Two filters TopoConnectedFaces and not horizontal to search lateral face connected to two selected faces -Filters = model.filters(Part_1_doc, [ - model.addFilter(name = "TopoConnectedFaces", args = [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"), False]), - model.addFilter(name = "HorizontalFaces", exclude = True), - model.addFilter(name = "TopoConnectedFaces", args = [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"), False])]) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5" + ), + False, + ], + ), + model.addFilter(name="HorizontalFaces", exclude=True), + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3" + ), + False, + ], + ), + ], +) model.end() Result = Extrusion_1.feature().firstResult() exp = GeomAPI_ShapeExplorer(Result.shape(), GeomAPI_Shape.FACE) Reference = {} # 1 face is in result - between two selected faces for filters -Reference[model.selection(Result, exp.current())] = False; exp.next() -Reference[model.selection(Result, exp.current())] = False; exp.next() -Reference[model.selection(Result, exp.current())] = True; exp.next() -Reference[model.selection(Result, exp.current())] = False; exp.next() -Reference[model.selection(Result, exp.current())] = False; exp.next() -Reference[model.selection(Result, exp.current())] = False; exp.next() -Reference[model.selection(Result, exp.current())] = False; exp.next() +Reference[model.selection(Result, exp.current())] = False +exp.next() +Reference[model.selection(Result, exp.current())] = False +exp.next() +Reference[model.selection(Result, exp.current())] = True +exp.next() +Reference[model.selection(Result, exp.current())] = False +exp.next() +Reference[model.selection(Result, exp.current())] = False +exp.next() +Reference[model.selection(Result, exp.current())] = False +exp.next() +Reference[model.selection(Result, exp.current())] = False +exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Edge1.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Edge1.py index 6a61a9de6..1478216ab 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Edge1.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Edge1.py @@ -25,12 +25,44 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", args = [model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), True])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection( + "EDGE", + "[Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]", + ), + True, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +70,32 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = True + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = True + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = True + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Edge2.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Edge2.py index d6429d89b..b658b1147 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Edge2.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Edge2.py @@ -25,12 +25,43 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", args = [model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top"), True])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top" + ), + True, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +69,32 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = True + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = True + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = True + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Edge3.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Edge3.py index 1a21ed489..7d771b35a 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Edge3.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Edge3.py @@ -25,12 +25,44 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", args = [model.selection("EDGE", "([Cylinder_1_1/Face_1][Cylinder_1_1/Face_2])([Cylinder_1_1/Face_1][Cylinder_1_1/Face_3])"), True])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection( + "EDGE", + "([Cylinder_1_1/Face_1][Cylinder_1_1/Face_2])([Cylinder_1_1/Face_1][Cylinder_1_1/Face_3])", + ), + True, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +70,32 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = False + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = False + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = False + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Edge1.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Edge1.py index 7d080d4f6..48434b13a 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Edge1.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Edge1.py @@ -25,12 +25,45 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", exclude = True, args = [model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), True])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + exclude=True, + args=[ + model.selection( + "EDGE", + "[Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]", + ), + True, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +71,32 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = False + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = False + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = False + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Edge2.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Edge2.py index 149299a7f..863bb1939 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Edge2.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Edge2.py @@ -25,12 +25,44 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", exclude = True, args = [model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top"), True])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + exclude=True, + args=[ + model.selection( + "EDGE", "Partition_1_1_2/Generated_Edge&Plane_2/Plane_2&Box_1_1/Top" + ), + True, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +70,32 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = False + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = False + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = False + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Edge3.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Edge3.py index cbb355a9a..e7a3e5d4a 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Edge3.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Edge3.py @@ -25,12 +25,45 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", exclude = True, args = [model.selection("EDGE", "([Cylinder_1_1/Face_1][Cylinder_1_1/Face_2])([Cylinder_1_1/Face_1][Cylinder_1_1/Face_3])"), True])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + exclude=True, + args=[ + model.selection( + "EDGE", + "([Cylinder_1_1/Face_1][Cylinder_1_1/Face_2])([Cylinder_1_1/Face_1][Cylinder_1_1/Face_3])", + ), + True, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +71,32 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = True + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = True + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = True + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Face1.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Face1.py index feff1e337..03689c752 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Face1.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Face1.py @@ -25,12 +25,42 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", exclude = True, args = [model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Left"), True])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + exclude=True, + args=[ + model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Left"), + True, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +68,32 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = False + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = False + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = False + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Face2.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Face2.py index 6091acd75..cd89a605f 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Face2.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Face2.py @@ -25,12 +25,42 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", exclude = True, args = [model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top"), True])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + exclude=True, + args=[ + model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top"), + True, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +68,32 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = False + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = False + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = False + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Face3.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Face3.py index 3b29cdf79..65315442b 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Face3.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Face3.py @@ -25,12 +25,39 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", exclude = True, args = [model.selection("FACE", "Cylinder_1_1/Face_3"), True])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + exclude=True, + args=[model.selection("FACE", "Cylinder_1_1/Face_3"), True], + ) + ], +) model.end() Reference = {} @@ -38,32 +65,32 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = True + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = True + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = True + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Vertex1.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Vertex1.py index b4c71d747..2c2ff0fa6 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Vertex1.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Vertex1.py @@ -25,12 +25,45 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", exclude = True, args = [model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), True])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + exclude=True, + args=[ + model.selection( + "VERTEX", + "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]", + ), + True, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +71,32 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = False + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = False + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = False + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Vertex2.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Vertex2.py index 086b87456..7a56a8d98 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Vertex2.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Vertex2.py @@ -25,12 +25,45 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", exclude = True, args = [model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Plane_1/Plane_1][Partition_1_1_2/Modified_Face&Plane_2/Plane_2]"), True])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + exclude=True, + args=[ + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Plane_1/Plane_1][Partition_1_1_2/Modified_Face&Plane_2/Plane_2]", + ), + True, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +71,32 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = False + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = False + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = False + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Vertex3.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Vertex3.py index 0164eec7c..a5c8fb027 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Vertex3.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Exclude_Vertex3.py @@ -25,12 +25,42 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", exclude = True, args = [model.selection("VERTEX", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]"), True])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + exclude=True, + args=[ + model.selection("VERTEX", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]"), + True, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +68,32 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = True + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = True + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = True + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Face1.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Face1.py index b9cd89fa9..2a945dcd5 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Face1.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Face1.py @@ -25,12 +25,41 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", args = [model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Left"), True])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Left"), + True, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +67,32 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = True + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = True + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = True + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Face2.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Face2.py index 30d849e0f..d4ca6580c 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Face2.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Face2.py @@ -25,12 +25,41 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", args = [model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top"), True])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top"), + True, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +67,32 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = True + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = True + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = True + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Face3.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Face3.py index 134ac4ac2..7f9da861d 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Face3.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Face3.py @@ -25,12 +25,38 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", args = [model.selection("FACE", "Cylinder_1_1/Face_3"), True])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[model.selection("FACE", "Cylinder_1_1/Face_3"), True], + ) + ], +) model.end() Reference = {} @@ -38,32 +64,32 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = False + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = False + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = False + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Vertex1.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Vertex1.py index b7e3b1ddb..04529dbce 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Vertex1.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Vertex1.py @@ -25,12 +25,44 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", args = [model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), True])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection( + "VERTEX", + "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]", + ), + True, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +70,32 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = True + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = True + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = True + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Vertex2.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Vertex2.py index 91aa693bf..9b24cf7a7 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Vertex2.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Vertex2.py @@ -25,12 +25,44 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", args = [model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Plane_1/Plane_1][Partition_1_1_2/Modified_Face&Plane_2/Plane_2]"), True])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Plane_1/Plane_1][Partition_1_1_2/Modified_Face&Plane_2/Plane_2]", + ), + True, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +70,32 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = True + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = True + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = True + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = True - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = True + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Vertex3.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Vertex3.py index 252fd5465..7f0bcfe84 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Vertex3.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Prop_Vertex3.py @@ -25,12 +25,41 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", args = [model.selection("VERTEX", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]"), True])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection("VERTEX", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]"), + True, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +67,32 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = False + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = False + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = False + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Vertex1.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Vertex1.py index a1141dfc3..ce5501a91 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Vertex1.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Vertex1.py @@ -25,12 +25,44 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", args = [model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), False])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection( + "VERTEX", + "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]", + ), + False, + ], + ) + ], +) model.end() Reference = {} @@ -38,35 +70,41 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = False + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = False + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Vertex2.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Vertex2.py index 26e948148..675437456 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Vertex2.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Vertex2.py @@ -25,57 +25,113 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", args = [model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Plane_1/Plane_1][Partition_1_1_2/Modified_Face&Plane_2/Plane_2]"), False])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection( + "VERTEX", + "[Partition_1_1_2/Modified_Face&Box_1_1/Top][Partition_1_1_2/Modified_Face&Plane_1/Plane_1][Partition_1_1_2/Modified_Face&Plane_2/Plane_2]", + ), + False, + ], + ) + ], +) model.end() Reference = {} # Faces of the box ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_0, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_0, exp.current())] = True; exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_0, exp.current())] = True +exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_1, exp.current())] = True; exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_1, exp.current())] = True +exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_2, exp.current())] = False; exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_2, exp.current())] = False +exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultBox_3, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = False; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = True; exp.next() -Reference[model.selection(ResultBox_3, exp.current())] = False; exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = False +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = True +exp.next() +Reference[model.selection(ResultBox_3, exp.current())] = False +exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Vertex3.py b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Vertex3.py index f18b6298f..948b14b25 100644 --- a/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Vertex3.py +++ b/src/FiltersPlugin/Test/TestFilter_TopoConnectedFaces_Vertex3.py @@ -25,12 +25,41 @@ 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/Left"), model.selection("FACE", "Box_1_1/Right")) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("FACE", "Box_1_1/Back")) -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, keepSubResults = True) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "TopoConnectedFaces", args = [model.selection("VERTEX", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]"), False])]) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Left"), + model.selection("FACE", "Box_1_1/Right"), +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Box_1_1/Front"), + model.selection("FACE", "Box_1_1/Back"), +) +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, keepSubResults=True) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection("VERTEX", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]"), + False, + ], + ) + ], +) model.end() Reference = {} @@ -38,32 +67,35 @@ Reference = {} ResultBox_0 = Partition_1.result().subResult(0).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_0.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_0, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_0, exp.current())] = False + exp.next() ResultBox_1 = Partition_1.result().subResult(1).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_1, exp.current())] = False + exp.next() ResultBox_2 = Partition_1.result().subResult(2).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_2, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_2, exp.current())] = False + exp.next() ResultBox_3 = Partition_1.result().subResult(3).resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox_3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox_3, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox_3, exp.current())] = False + exp.next() # Faces of the cylinder ResultCylinder_1 = Cylinder_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultCylinder_1, exp.current())] = True; exp.next() -Reference[model.selection(ResultCylinder_1, exp.current())] = False; exp.next() -Reference[model.selection(ResultCylinder_1, exp.current())] = True; exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = True +exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = False +exp.next() +Reference[model.selection(ResultCylinder_1, exp.current())] = True +exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_VerticalFaces.py b/src/FiltersPlugin/Test/TestFilter_VerticalFaces.py index 676855104..315794789 100644 --- a/src/FiltersPlugin/Test/TestFilter_VerticalFaces.py +++ b/src/FiltersPlugin/Test/TestFilter_VerticalFaces.py @@ -24,10 +24,30 @@ 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/OX"), 20, 2, model.selection("EDGE", "PartSet/OY"), 20, 3) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 50) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "VerticalFaces")]) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, + model.selection("EDGE", "PartSet/OY"), + 20, + 3, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 50, +) +Filters = model.filters(Part_1_doc, [model.addFilter(name="VerticalFaces")]) model.end() Reference = { @@ -57,7 +77,13 @@ Reference = { model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): False, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): False, # Edges and vertices are not applicable - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): False, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): False, - } + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): False, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): False, +} model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_VerticalFaces_Exclude.py b/src/FiltersPlugin/Test/TestFilter_VerticalFaces_Exclude.py index 2b098b416..a52d40d93 100644 --- a/src/FiltersPlugin/Test/TestFilter_VerticalFaces_Exclude.py +++ b/src/FiltersPlugin/Test/TestFilter_VerticalFaces_Exclude.py @@ -24,10 +24,32 @@ 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/OX"), 20, 2, model.selection("EDGE", "PartSet/OY"), 20, 3) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 50) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "VerticalFaces", exclude = True)]) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 20, + 2, + model.selection("EDGE", "PartSet/OY"), + 20, + 3, +) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + 50, +) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="VerticalFaces", exclude=True)] +) model.end() Reference = { @@ -57,7 +79,13 @@ Reference = { model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): True, model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): True, # Edges and vertices are not applicable - model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True, - model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True, - } + model.selection( + "EDGE", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]", + ): True, + model.selection( + "VERTEX", + "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]", + ): True, +} model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilter_VolumeSize.py b/src/FiltersPlugin/Test/TestFilter_VolumeSize.py index 795e136f4..38c44906b 100644 --- a/src/FiltersPlugin/Test/TestFilter_VolumeSize.py +++ b/src/FiltersPlugin/Test/TestFilter_VolumeSize.py @@ -37,21 +37,33 @@ Point_1 = model.addPoint(Part_1_doc, 100, 0, 0) Point_2 = model.addPoint(Part_1_doc, 250, 50, 100) ### Create Box -Box_2 = model.addBox(Part_1_doc, model.selection("VERTEX", "all-in-Point_1"), model.selection("VERTEX", "all-in-Point_2")) +Box_2 = model.addBox( + Part_1_doc, + model.selection("VERTEX", "all-in-Point_1"), + model.selection("VERTEX", "all-in-Point_2"), +) ### Create Point Point_3 = model.addPoint(Part_1_doc, 100, 50, 250) ### Create Box -Box_3 = model.addBox(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]"), model.selection("VERTEX", "Point_3")) +Box_3 = model.addBox( + Part_1_doc, + model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]"), + model.selection("VERTEX", "Point_3"), +) ### Create CompSolid -CompSolid_1_objects = [model.selection("SOLID", "Box_3_1"), - model.selection("SOLID", "Box_2_1"), - model.selection("SOLID", "Box_1_1")] +CompSolid_1_objects = [ + model.selection("SOLID", "Box_3_1"), + model.selection("SOLID", "Box_2_1"), + model.selection("SOLID", "Box_1_1"), +] CompSolid_1 = model.addCompSolid(Part_1_doc, CompSolid_1_objects) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "VolumeSize", args = [ "inf" , 500000.0 ])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="VolumeSize", args=["inf", 500000.0])] +) model.end() @@ -63,12 +75,14 @@ ResultBox_3 = Box_3.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCompSolid_1.shape(), GeomAPI_Shape.SOLID) while exp.more(): - Reference[model.selection(ResultCompSolid_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCompSolid_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "VolumeSize", args = [ "infEq" , 500000.0 ])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="VolumeSize", args=["infEq", 500000.0])] +) model.end() Reference = {} @@ -82,7 +96,9 @@ Reference[model.selection(ResultBox_3, exp.current())] = False model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "VolumeSize", args = [ "sup" , 500000.0 ])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="VolumeSize", args=["sup", 500000.0])] +) model.end() Reference = {} @@ -96,7 +112,9 @@ Reference[model.selection(ResultBox_3, exp.current())] = True model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "VolumeSize", args = [ "inf" , 50.0 ])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="VolumeSize", args=["inf", 50.0])] +) model.end() Reference = {} @@ -110,30 +128,36 @@ Reference[model.selection(ResultBox_3, exp.current())] = False model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "VolumeSize", args = [ "supEq" , 500000.0 ])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="VolumeSize", args=["supEq", 500000.0])] +) model.end() Reference = {} exp = GeomAPI_ShapeExplorer(ResultCompSolid_1.shape(), GeomAPI_Shape.SOLID) while exp.more(): - Reference[model.selection(ResultCompSolid_1, exp.current())] = True - exp.next() + Reference[model.selection(ResultCompSolid_1, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "VolumeSize", args = [ "supEq" , 800000.0 ])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="VolumeSize", args=["supEq", 800000.0])] +) model.end() Reference = {} exp = GeomAPI_ShapeExplorer(ResultCompSolid_1.shape(), GeomAPI_Shape.SOLID) while exp.more(): - Reference[model.selection(ResultCompSolid_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCompSolid_1, exp.current())] = False + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "VolumeSize", args = [ "isBetween" , 50.0 , 600000.0])]) +Filters = model.filters( + Part_1_doc, [model.addFilter(name="VolumeSize", args=["isBetween", 50.0, 600000.0])] +) model.end() Reference = {} exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.SOLID) @@ -146,7 +170,10 @@ Reference[model.selection(ResultBox_3, exp.current())] = False model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Filters = model.filters(Part_1_doc, [model.addFilter(name = "VolumeSize", args = [ "isStrictlyBetween" , 500.0 , 750000.0])]) +Filters = model.filters( + Part_1_doc, + [model.addFilter(name="VolumeSize", args=["isStrictlyBetween", 500.0, 750000.0])], +) model.end() Reference = {} exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.SOLID) diff --git a/src/FiltersPlugin/Test/TestFilters.py b/src/FiltersPlugin/Test/TestFilters.py index 48f9ed902..82ed1498e 100644 --- a/src/FiltersPlugin/Test/TestFilters.py +++ b/src/FiltersPlugin/Test/TestFilters.py @@ -25,14 +25,25 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "BelongsTo", args = [model.selection("SOLID", "Box_1_1")]), model.addFilter(name = "HorizontalFaces"), model.addFilter(name = "OnGeometry", args = [model.selection("FACE", "PartSet/XOY")])]) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Box_1_1/Bottom"), Filters]) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter(name="BelongsTo", args=[model.selection("SOLID", "Box_1_1")]), + model.addFilter(name="HorizontalFaces"), + model.addFilter( + name="OnGeometry", args=[model.selection("FACE", "PartSet/XOY")] + ), + ], +) +Group_1 = model.addGroup( + Part_1_doc, [model.selection("FACE", "Box_1_1/Bottom"), Filters] +) model.end() aFactory = ModelAPI_Session.get().validators() GroupFeature = Group_1.feature() -assert(aFactory.validate(GroupFeature)) -assert(GroupFeature.selectionList("group_list").size() == 1) +assert aFactory.validate(GroupFeature) +assert GroupFeature.selectionList("group_list").size() == 1 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FiltersPlugin/Test/TestFilters_FilterName.py b/src/FiltersPlugin/Test/TestFilters_FilterName.py index 342215025..37274a9ae 100644 --- a/src/FiltersPlugin/Test/TestFilters_FilterName.py +++ b/src/FiltersPlugin/Test/TestFilters_FilterName.py @@ -34,7 +34,7 @@ Reference = [ "ExternalFaces", "HorizontalFaces", "VerticalFaces", - "TopoConnectedFaces" + "TopoConnectedFaces", ] model.begin() @@ -46,7 +46,7 @@ model.filters(Part_1_doc, []) filtersFactory = ModelAPI_Session.get().filters() for id in Reference: - filter = filtersFactory.filter(id) - name = filter.name() - assert(len(name) != 0) + filter = filtersFactory.filter(id) + name = filter.name() + assert len(name) != 0 model.end() diff --git a/src/FiltersPlugin/Test/TestFilters_IsReversed.py b/src/FiltersPlugin/Test/TestFilters_IsReversed.py index cdc80f18d..bdb1a9b77 100644 --- a/src/FiltersPlugin/Test/TestFilters_IsReversed.py +++ b/src/FiltersPlugin/Test/TestFilters_IsReversed.py @@ -25,14 +25,31 @@ 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) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "BelongsTo", args = [model.selection("SOLID", "LinearCopy_1_1_3")]), - model.addFilter(name = "OnPlane", exclude = True, args = [model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Top"), - model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Front") - ]) - ]) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OY"), + 20, + 3, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="BelongsTo", args=[model.selection("SOLID", "LinearCopy_1_1_3")] + ), + model.addFilter( + name="OnPlane", + exclude=True, + args=[ + model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Top"), + model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Front"), + ], + ), + ], +) model.end() -assert(Filters.feature().isReversed("BelongsTo") is False) -assert(Filters.feature().isReversed("OnPlane") is True) -assert(Filters.feature().isReversed("OnLine") is False) +assert Filters.feature().isReversed("BelongsTo") is False +assert Filters.feature().isReversed("OnPlane") is True +assert Filters.feature().isReversed("OnLine") is False diff --git a/src/FiltersPlugin/Test/TestFilters_Mixed1.py b/src/FiltersPlugin/Test/TestFilters_Mixed1.py index e59418975..f85e8bc3f 100644 --- a/src/FiltersPlugin/Test/TestFilters_Mixed1.py +++ b/src/FiltersPlugin/Test/TestFilters_Mixed1.py @@ -27,18 +27,53 @@ 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/Top")) SketchCircle_1 = Sketch_1.addCircle(5, 5, 3) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_1.result(), 5, True) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), False) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_1.result(), 5, True +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), False +) SketchLine_2 = SketchProjection_2.createdFeature() -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_2.result(), 5, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_2.result(), 5, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 3) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 5, 0) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 10, -5) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", args = [model.selection("SOLID", "Box_1_1"), "not_in"]), - model.addFilter(name = "TopoConnectedFaces", args = [model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_2_1/To_Face]")])]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], + model.selection(), + 5, + 0, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], + model.selection(), + 10, + -5, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="RelativeToSolid", args=[model.selection("SOLID", "Box_1_1"), "not_in"] + ), + model.addFilter( + name="TopoConnectedFaces", + args=[ + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_2_1/To_Face]", + ) + ], + ), + ], +) model.end() Reference = {} @@ -46,26 +81,38 @@ Reference = {} ResultBox = Box_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultBox.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultBox, exp.current())] = False - exp.next() + Reference[model.selection(ResultBox, exp.current())] = False + exp.next() # Faces of the first cylinder ResultCylinder_1 = Extrusion_1.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() + Reference[model.selection(ResultCylinder_1, exp.current())] = False + exp.next() # Faces of the second cylinder ResultCylinder_2 = Extrusion_2.result().resultSubShapePair()[0] exp = GeomAPI_ShapeExplorer(ResultCylinder_2.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(ResultCylinder_2, exp.current())] = True; exp.next() -Reference[model.selection(ResultCylinder_2, exp.current())] = False; exp.next() -Reference[model.selection(ResultCylinder_2, exp.current())] = True; exp.next() +Reference[model.selection(ResultCylinder_2, exp.current())] = True +exp.next() +Reference[model.selection(ResultCylinder_2, exp.current())] = False +exp.next() +Reference[model.selection(ResultCylinder_2, exp.current())] = True +exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_2_1/To_Face"), model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_1/SketchCircle_1_2"), Filters]) +Group_1 = model.addGroup( + Part_1_doc, + [ + model.selection("FACE", "Extrusion_2_1/To_Face"), + model.selection( + "FACE", "Extrusion_2_1/Generated_Face&Sketch_1/SketchCircle_1_2" + ), + Filters, + ], +) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FiltersPlugin/Test/TestFilters_Mixed2.py b/src/FiltersPlugin/Test/TestFilters_Mixed2.py index 717d08b1c..848c490cf 100644 --- a/src/FiltersPlugin/Test/TestFilters_Mixed2.py +++ b/src/FiltersPlugin/Test/TestFilters_Mixed2.py @@ -25,12 +25,29 @@ 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) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "BelongsTo", args = [model.selection("SOLID", "LinearCopy_1_1_3")]), - model.addFilter(name = "OnPlane", exclude = True, args = [model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Top"), - model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Front") - ]) - ]) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OY"), + 20, + 3, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="BelongsTo", args=[model.selection("SOLID", "LinearCopy_1_1_3")] + ), + model.addFilter( + name="OnPlane", + exclude=True, + args=[ + model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Top"), + model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Front"), + ], + ), + ], +) model.end() Box1 = LinearCopy_1.result().subResult(0).resultSubShapePair()[0] @@ -43,124 +60,208 @@ Reference = {} Reference[model.selection(Box1, emptyShape)] = False exp = GeomAPI_ShapeExplorer(Box1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(Box1, exp.current())] = False - exp.next() + Reference[model.selection(Box1, exp.current())] = False + exp.next() exp = GeomAPI_ShapeExplorer(Box1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(Box1, exp.current())] = False - exp.next() + Reference[model.selection(Box1, exp.current())] = False + exp.next() exp = GeomAPI_ShapeExplorer(Box1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(Box1, exp.current())] = False - exp.next() + Reference[model.selection(Box1, exp.current())] = False + exp.next() # Second box reference data Reference[model.selection(Box2, emptyShape)] = False exp = GeomAPI_ShapeExplorer(Box2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(Box2, exp.current())] = False - exp.next() + Reference[model.selection(Box2, exp.current())] = False + exp.next() exp = GeomAPI_ShapeExplorer(Box2.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(Box2, exp.current())] = False - exp.next() + Reference[model.selection(Box2, exp.current())] = False + exp.next() exp = GeomAPI_ShapeExplorer(Box2.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(Box2, exp.current())] = False - exp.next() + Reference[model.selection(Box2, exp.current())] = False + exp.next() # Third box reference data Reference[model.selection(Box3, emptyShape)] = True # faces exp = GeomAPI_ShapeExplorer(Box3.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +assert not exp.more() # edges exp = GeomAPI_ShapeExplorer(Box3.shape(), GeomAPI_Shape.EDGE) -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +assert not exp.more() # vertices exp = GeomAPI_ShapeExplorer(Box3.shape(), GeomAPI_Shape.VERTEX) -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +assert not exp.more() model.checkFilter(Part_1_doc, model, Filters, Reference) model.begin() -Group_1_objects = [model.selection("FACE", "LinearCopy_1_1_3/MF:Translated&Box_1_1/Back"), model.selection("FACE", "LinearCopy_1_1_3/MF:Translated&Box_1_1/Left"), model.selection("FACE", "LinearCopy_1_1_3/MF:Translated&Box_1_1/Right"), model.selection("FACE", "LinearCopy_1_1_3/MF:Translated&Box_1_1/Bottom"), Filters] +Group_1_objects = [ + model.selection("FACE", "LinearCopy_1_1_3/MF:Translated&Box_1_1/Back"), + model.selection("FACE", "LinearCopy_1_1_3/MF:Translated&Box_1_1/Left"), + model.selection("FACE", "LinearCopy_1_1_3/MF:Translated&Box_1_1/Right"), + model.selection("FACE", "LinearCopy_1_1_3/MF:Translated&Box_1_1/Bottom"), + Filters, +] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/FiltersPlugin/Test/TestFilters_Remove.py b/src/FiltersPlugin/Test/TestFilters_Remove.py index ccbb7f974..4d58f6999 100644 --- a/src/FiltersPlugin/Test/TestFilters_Remove.py +++ b/src/FiltersPlugin/Test/TestFilters_Remove.py @@ -25,12 +25,29 @@ 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) -Filters = model.filters(Part_1_doc, [model.addFilter(name = "BelongsTo", args = [model.selection("SOLID", "LinearCopy_1_1_3")]), - model.addFilter(name = "OnPlane", exclude = True, args = [model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Top"), - model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Front") - ]) - ]) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OY"), + 20, + 3, +) +Filters = model.filters( + Part_1_doc, + [ + model.addFilter( + name="BelongsTo", args=[model.selection("SOLID", "LinearCopy_1_1_3")] + ), + model.addFilter( + name="OnPlane", + exclude=True, + args=[ + model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Top"), + model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Front"), + ], + ), + ], +) model.end() Box1 = LinearCopy_1.result().subResult(0).resultSubShapePair()[0] @@ -43,119 +60,197 @@ Reference = {} Reference[model.selection(Box1, emptyShape)] = False exp = GeomAPI_ShapeExplorer(Box1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(Box1, exp.current())] = False - exp.next() + Reference[model.selection(Box1, exp.current())] = False + exp.next() exp = GeomAPI_ShapeExplorer(Box1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(Box1, exp.current())] = False - exp.next() + Reference[model.selection(Box1, exp.current())] = False + exp.next() exp = GeomAPI_ShapeExplorer(Box1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(Box1, exp.current())] = False - exp.next() + Reference[model.selection(Box1, exp.current())] = False + exp.next() # Second box reference data Reference[model.selection(Box2, emptyShape)] = False exp = GeomAPI_ShapeExplorer(Box2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(Box2, exp.current())] = False - exp.next() + Reference[model.selection(Box2, exp.current())] = False + exp.next() exp = GeomAPI_ShapeExplorer(Box2.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(Box2, exp.current())] = False - exp.next() + Reference[model.selection(Box2, exp.current())] = False + exp.next() exp = GeomAPI_ShapeExplorer(Box2.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(Box2, exp.current())] = False - exp.next() + Reference[model.selection(Box2, exp.current())] = False + exp.next() # Third box reference data Reference[model.selection(Box3, emptyShape)] = True # faces exp = GeomAPI_ShapeExplorer(Box3.shape(), GeomAPI_Shape.FACE) -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +assert not exp.more() # edges exp = GeomAPI_ShapeExplorer(Box3.shape(), GeomAPI_Shape.EDGE) -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +assert not exp.more() # vertices exp = GeomAPI_ShapeExplorer(Box3.shape(), GeomAPI_Shape.VERTEX) -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = True; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -Reference[model.selection(Box3, exp.current())] = False; exp.next() -assert(not exp.more()) +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = True +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +Reference[model.selection(Box3, exp.current())] = False +exp.next() +assert not exp.more() model.checkFilter(Part_1_doc, model, Filters, Reference) @@ -168,43 +263,43 @@ Reference = {} Reference[model.selection(Box1, emptyShape)] = False exp = GeomAPI_ShapeExplorer(Box1.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(Box1, exp.current())] = False - exp.next() + Reference[model.selection(Box1, exp.current())] = False + exp.next() exp = GeomAPI_ShapeExplorer(Box1.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(Box1, exp.current())] = False - exp.next() + Reference[model.selection(Box1, exp.current())] = False + exp.next() exp = GeomAPI_ShapeExplorer(Box1.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(Box1, exp.current())] = False - exp.next() + Reference[model.selection(Box1, exp.current())] = False + exp.next() # Second box reference data Reference[model.selection(Box2, emptyShape)] = False exp = GeomAPI_ShapeExplorer(Box2.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(Box2, exp.current())] = False - exp.next() + Reference[model.selection(Box2, exp.current())] = False + exp.next() exp = GeomAPI_ShapeExplorer(Box2.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(Box2, exp.current())] = False - exp.next() + Reference[model.selection(Box2, exp.current())] = False + exp.next() exp = GeomAPI_ShapeExplorer(Box2.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(Box2, exp.current())] = False - exp.next() + Reference[model.selection(Box2, exp.current())] = False + exp.next() # Third box reference data Reference[model.selection(Box3, emptyShape)] = True exp = GeomAPI_ShapeExplorer(Box3.shape(), GeomAPI_Shape.FACE) while exp.more(): - Reference[model.selection(Box3, exp.current())] = True - exp.next() + Reference[model.selection(Box3, exp.current())] = True + exp.next() exp = GeomAPI_ShapeExplorer(Box3.shape(), GeomAPI_Shape.EDGE) while exp.more(): - Reference[model.selection(Box3, exp.current())] = True - exp.next() + Reference[model.selection(Box3, exp.current())] = True + exp.next() exp = GeomAPI_ShapeExplorer(Box3.shape(), GeomAPI_Shape.VERTEX) while exp.more(): - Reference[model.selection(Box3, exp.current())] = True - exp.next() + Reference[model.selection(Box3, exp.current())] = True + exp.next() model.checkFilter(Part_1_doc, model, Filters, Reference) diff --git a/src/FiltersPlugin/Test/TestFilters_Select.py b/src/FiltersPlugin/Test/TestFilters_Select.py index 0ba8bcf9b..d77f21671 100644 --- a/src/FiltersPlugin/Test/TestFilters_Select.py +++ b/src/FiltersPlugin/Test/TestFilters_Select.py @@ -33,11 +33,13 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) model.do() ### Create Filters -filter_1 = model.addFilter(name = "OnPlane", - args = [model.selection("FACE", "Box_1_1/Left")]) +filter_1 = model.addFilter( + name="OnPlane", args=[model.selection("FACE", "Box_1_1/Left")] +) -filter_2 = model.addFilter(name = "OnPlane", - args = [model.selection("FACE", "Box_1_1/Top")]) +filter_2 = model.addFilter( + name="OnPlane", args=[model.selection("FACE", "Box_1_1/Top")] +) filters = model.filters(Part_1_doc, [filter_1, filter_2]) @@ -45,20 +47,23 @@ filters = model.filters(Part_1_doc, [filter_1, filter_2]) selected_edges = filters.select("Edges") group_1 = model.addGroup(Part_1_doc, "Edges", selected_edges) -assert(group_1.feature().results().size() == 1) +assert group_1.feature().results().size() == 1 # Check the selected edge aResult = group_1.results()[0].resultSubShapePair()[0] aShape = aResult.shape() aShapeExplorer = GeomAPI_ShapeExplorer(aShape, GeomAPI_Shape.EDGE) -assert(aShapeExplorer.more()) +assert aShapeExplorer.more() anEdge = aShapeExplorer.current() -assert(anEdge.edge().isLine() and math.fabs(anEdge.edge().line().direction().x() - 1.0) < 1.e-7) +assert ( + anEdge.edge().isLine() + and math.fabs(anEdge.edge().line().direction().x() - 1.0) < 1.0e-7 +) aLoc = anEdge.edge().line().location() -assert(math.fabs(aLoc.x()) < 1.e-7) -assert(math.fabs(aLoc.y()) < 1.e-7) -assert(math.fabs(aLoc.z() - 10.0) < 1.e-7) +assert math.fabs(aLoc.x()) < 1.0e-7 +assert math.fabs(aLoc.y()) < 1.0e-7 +assert math.fabs(aLoc.z() - 10.0) < 1.0e-7 aShapeExplorer.next() -assert(not aShapeExplorer.more()) +assert not aShapeExplorer.more() model.end() diff --git a/src/FiltersPlugin/Test/TestFilters_Supported.py b/src/FiltersPlugin/Test/TestFilters_Supported.py index a0e033b40..3353156e4 100644 --- a/src/FiltersPlugin/Test/TestFilters_Supported.py +++ b/src/FiltersPlugin/Test/TestFilters_Supported.py @@ -38,17 +38,65 @@ FILTER_EDGE_SIZE = "EdgeSize" FILTER_FACE_SIZE = "FaceSize" FILTER_VOLUME_SIZE = "VolumeSize" FILTER_FEATURE_EDGES = "FeatureEdges" -FILTER_CONTINUOUS_FACES= "ContinuousFaces" +FILTER_CONTINUOUS_FACES = "ContinuousFaces" FILTER_ON_SHAPE_NAME = "OnShapeName" # Reference data (supported filters) for each type of shape Reference = { - GeomAPI_Shape.VERTEX : [FILTER_BELONGS_TO, FILTER_ON_PLANE, FILTER_ON_LINE, FILTER_ON_PLANE_SIDE, FILTER_RELATIVE_TO_SOLID,FILTER_ON_SHAPE_NAME], - GeomAPI_Shape.EDGE : [FILTER_BELONGS_TO, FILTER_ON_PLANE, FILTER_ON_LINE, FILTER_ON_GEOMETRY, FILTER_ON_PLANE_SIDE, FILTER_OPPOSITE_TO_EDGE, FILTER_RELATIVE_TO_SOLID, FILTER_EDGE_SIZE, FILTER_FEATURE_EDGES,FILTER_ON_SHAPE_NAME], - GeomAPI_Shape.WIRE : [FILTER_BELONGS_TO, FILTER_ON_PLANE, FILTER_ON_PLANE_SIDE, FILTER_RELATIVE_TO_SOLID,FILTER_ON_SHAPE_NAME], - GeomAPI_Shape.FACE : [FILTER_BELONGS_TO, FILTER_ON_PLANE, FILTER_ON_GEOMETRY, FILTER_ON_PLANE_SIDE, FILTER_RELATIVE_TO_SOLID, FILTER_EXTERNAL_FACES, FILTER_HORIZONTAL_FACES, FILTER_VERTICAL_FACES, FILTER_CONNECTED_FACES, FILTER_FACE_SIZE, FILTER_CONTINUOUS_FACES,FILTER_ON_SHAPE_NAME], - GeomAPI_Shape.SHELL : [FILTER_BELONGS_TO, FILTER_ON_PLANE, FILTER_ON_PLANE_SIDE, FILTER_RELATIVE_TO_SOLID,FILTER_ON_SHAPE_NAME], - GeomAPI_Shape.SOLID : [FILTER_BELONGS_TO, FILTER_ON_PLANE_SIDE, FILTER_VOLUME_SIZE,FILTER_ON_SHAPE_NAME], + GeomAPI_Shape.VERTEX: [ + FILTER_BELONGS_TO, + FILTER_ON_PLANE, + FILTER_ON_LINE, + FILTER_ON_PLANE_SIDE, + FILTER_RELATIVE_TO_SOLID, + FILTER_ON_SHAPE_NAME, + ], + GeomAPI_Shape.EDGE: [ + FILTER_BELONGS_TO, + FILTER_ON_PLANE, + FILTER_ON_LINE, + FILTER_ON_GEOMETRY, + FILTER_ON_PLANE_SIDE, + FILTER_OPPOSITE_TO_EDGE, + FILTER_RELATIVE_TO_SOLID, + FILTER_EDGE_SIZE, + FILTER_FEATURE_EDGES, + FILTER_ON_SHAPE_NAME, + ], + GeomAPI_Shape.WIRE: [ + FILTER_BELONGS_TO, + FILTER_ON_PLANE, + FILTER_ON_PLANE_SIDE, + FILTER_RELATIVE_TO_SOLID, + FILTER_ON_SHAPE_NAME, + ], + GeomAPI_Shape.FACE: [ + FILTER_BELONGS_TO, + FILTER_ON_PLANE, + FILTER_ON_GEOMETRY, + FILTER_ON_PLANE_SIDE, + FILTER_RELATIVE_TO_SOLID, + FILTER_EXTERNAL_FACES, + FILTER_HORIZONTAL_FACES, + FILTER_VERTICAL_FACES, + FILTER_CONNECTED_FACES, + FILTER_FACE_SIZE, + FILTER_CONTINUOUS_FACES, + FILTER_ON_SHAPE_NAME, + ], + GeomAPI_Shape.SHELL: [ + FILTER_BELONGS_TO, + FILTER_ON_PLANE, + FILTER_ON_PLANE_SIDE, + FILTER_RELATIVE_TO_SOLID, + FILTER_ON_SHAPE_NAME, + ], + GeomAPI_Shape.SOLID: [ + FILTER_BELONGS_TO, + FILTER_ON_PLANE_SIDE, + FILTER_VOLUME_SIZE, + FILTER_ON_SHAPE_NAME, + ], } model.begin() @@ -60,10 +108,16 @@ model.filters(Part_1_doc, []) filtersFactory = ModelAPI_Session.get().filters() for type, res in Reference.items(): - filtersList = filtersFactory.filters(type) - for filter in filtersList: - filterID = filtersFactory.id(filter) - assert(filterID in res), "Filter \"{}\" is not applicable for {}".format(filterID, strByShapeType(type)) - res.remove(filterID) - assert(len(res) == 0), "There are more filters {}, which should be supported for {}".format(res, strByShapeType(type)) + filtersList = filtersFactory.filters(type) + for filter in filtersList: + filterID = filtersFactory.id(filter) + assert filterID in res, 'Filter "{}" is not applicable for {}'.format( + filterID, strByShapeType(type) + ) + res.remove(filterID) + assert ( + len(res) == 0 + ), "There are more filters {}, which should be supported for {}".format( + res, strByShapeType(type) + ) model.end() diff --git a/src/FiltersPlugin/Test/TestFilters_Validator.py b/src/FiltersPlugin/Test/TestFilters_Validator.py index 2ed907de7..32d762ef7 100644 --- a/src/FiltersPlugin/Test/TestFilters_Validator.py +++ b/src/FiltersPlugin/Test/TestFilters_Validator.py @@ -30,7 +30,14 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) model.do() # load 'Filters' plugin -FiltersFeature = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", args = [model.selection("FACE", "Box_1_1/Left")])]) +FiltersFeature = model.filters( + Part_1_doc, + [ + model.addFilter( + name="OnGeometry", args=[model.selection("FACE", "Box_1_1/Left")] + ) + ], +) FiltersFactory = ModelAPI_Session.get().filters() Filter = FiltersFactory.filter("OnGeometry") @@ -42,9 +49,11 @@ ValidatorReader.readAll() aFactory = ModelAPI_Session.get().validators() # no Group, thus not valid yet -assert(not aFactory.validate(FiltersFeature.feature())) +assert not aFactory.validate(FiltersFeature.feature()) -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Box_1_1/Left"), FiltersFeature]) -assert(aFactory.validate(FiltersFeature.feature())) +Group_1 = model.addGroup( + Part_1_doc, "Faces", [model.selection("FACE", "Box_1_1/Left"), FiltersFeature] +) +assert aFactory.validate(FiltersFeature.feature()) model.end() diff --git a/src/FiltersPlugin/Test/TestFilters_Xml.py b/src/FiltersPlugin/Test/TestFilters_Xml.py index 52df4747a..030e9d553 100644 --- a/src/FiltersPlugin/Test/TestFilters_Xml.py +++ b/src/FiltersPlugin/Test/TestFilters_Xml.py @@ -24,17 +24,17 @@ from ModelHighAPI import * # Map filter and emptyness of its XML representation Reference = { - "BelongsTo" : False, - "OnPlane" : False, - "OnLine" : False, - "OnGeometry" : False, - "OnPlaneSide" : False, - "OppositeToEdge" : False, - "RelativeToSolid" : False, - "ExternalFaces" : True, - "HorizontalFaces" : True, - "VerticalFaces" : True, - "TopoConnectedFaces" : False, + "BelongsTo": False, + "OnPlane": False, + "OnLine": False, + "OnGeometry": False, + "OnPlaneSide": False, + "OppositeToEdge": False, + "RelativeToSolid": False, + "ExternalFaces": True, + "HorizontalFaces": True, + "VerticalFaces": True, + "TopoConnectedFaces": False, } model.begin() @@ -46,7 +46,7 @@ model.filters(Part_1_doc, []) filtersFactory = ModelAPI_Session.get().filters() for id, res in Reference.items(): - filter = filtersFactory.filter(id) - xmlString = filter.xmlRepresentation() - assert((len(xmlString) == 0) == res) + filter = filtersFactory.filter(id) + xmlString = filter.xmlRepresentation() + assert (len(xmlString) == 0) == res model.end() diff --git a/src/GDMLPlugin/Test/TestCone.py b/src/GDMLPlugin/Test/TestCone.py index 48a3a3dbf..b8c52f0ca 100644 --- a/src/GDMLPlugin/Test/TestCone.py +++ b/src/GDMLPlugin/Test/TestCone.py @@ -35,4 +35,4 @@ model.testNbSubShapes(ConeSegment_1, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(ConeSegment_1, GeomAPI_Shape.VERTEX, [48]) model.testResultsVolumes(ConeSegment_1, [1545.663585663386584201361984015]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/GDMLPlugin/Test/TestEllipsoid.py b/src/GDMLPlugin/Test/TestEllipsoid.py index cf155dbf6..48cbc16c7 100644 --- a/src/GDMLPlugin/Test/TestEllipsoid.py +++ b/src/GDMLPlugin/Test/TestEllipsoid.py @@ -78,36 +78,36 @@ Part_5 = model.addPart(partSet) Part_5_doc = Part_5.document() Ellipsoid_5 = model.addEllipsoid(Part_5_doc, 0, 20, 30) model.do() -assert(Ellipsoid_5.feature().error() != "") +assert Ellipsoid_5.feature().error() != "" Part_5_doc.removeFeature(Ellipsoid_5.feature()) Ellipsoid_5 = model.addEllipsoid(Part_5_doc, 10, 0, 30) model.do() -assert(Ellipsoid_5.feature().error() != "") +assert Ellipsoid_5.feature().error() != "" Part_5_doc.removeFeature(Ellipsoid_5.feature()) Ellipsoid_5 = model.addEllipsoid(Part_5_doc, 10, 20, 0) model.do() -assert(Ellipsoid_5.feature().error() != "") +assert Ellipsoid_5.feature().error() != "" Part_5_doc.removeFeature(Ellipsoid_5.feature()) Ellipsoid_5 = model.addEllipsoid(Part_5_doc, 10, 20, 30, -5, 5) model.do() -assert(Ellipsoid_5.feature().error() != "") +assert Ellipsoid_5.feature().error() != "" Part_5_doc.removeFeature(Ellipsoid_5.feature()) Ellipsoid_5 = model.addEllipsoid(Part_5_doc, 10, 20, 30, 5, -5) model.do() -assert(Ellipsoid_5.feature().error() != "") +assert Ellipsoid_5.feature().error() != "" Part_5_doc.removeFeature(Ellipsoid_5.feature()) Ellipsoid_5 = model.addEllipsoid(Part_5_doc, 10, 20, 30, 0, 0) model.do() -assert(Ellipsoid_5.feature().error() != "") +assert Ellipsoid_5.feature().error() != "" Part_5_doc.removeFeature(Ellipsoid_5.feature()) partSet.removeFeature(Part_5.feature()) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/GDMLPlugin/doc/examples/cone.py b/src/GDMLPlugin/doc/examples/cone.py index fca755c35..3e1e60d7f 100644 --- a/src/GDMLPlugin/doc/examples/cone.py +++ b/src/GDMLPlugin/doc/examples/cone.py @@ -4,6 +4,6 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -ConeSegment_1 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, 12, 0 , 270) +ConeSegment_1 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, 12, 0, 270) model.do() model.end() diff --git a/src/GeomAPI/Test/Test2675.py b/src/GeomAPI/Test/Test2675.py index 96a580fbe..6e9170bb9 100644 --- a/src/GeomAPI/Test/Test2675.py +++ b/src/GeomAPI/Test/Test2675.py @@ -29,20 +29,54 @@ partSet = model.moduleDocument() 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(-85.62958302127123, 51.64856737222455, 159.4430553521271, 401.6485673722245) -SketchLine_2 = Sketch_1.addLine(159.4430553521271, 401.6485673722245, 909.4430553521272, 401.6485673722245) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(909.4430553521272, 401.6485673722245, 909.4430553521272, -98.35143262777548) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(909.4430553521272, -98.35143262777548, 551.916977573864, -398.3514326277755) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(551.916977573864, -398.3514326277755, -18.08302242613596, -398.3514326277755) -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) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.startPoint()) +SketchLine_1 = Sketch_1.addLine( + -85.62958302127123, 51.64856737222455, 159.4430553521271, 401.6485673722245 +) +SketchLine_2 = Sketch_1.addLine( + 159.4430553521271, 401.6485673722245, 909.4430553521272, 401.6485673722245 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 909.4430553521272, 401.6485673722245, 909.4430553521272, -98.35143262777548 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + 909.4430553521272, -98.35143262777548, 551.916977573864, -398.3514326277755 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 551.916977573864, -398.3514326277755, -18.08302242613596, -398.3514326277755 +) +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, +) +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()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) @@ -51,39 +85,86 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 100) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 750) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_3.result(), 500) 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) +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 +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_4.startPoint(), SketchLine_5.result(), 300 +) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_1.center(), SketchPoint_1.coordinates()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchPoint_1.coordinates() +) SketchCircle_1 = Sketch_1.addCircle(623.3624504738834, 247.4315530304268, 75) SketchCircle_2 = Sketch_1.addCircle(267.9975824521076, 55.86558171402226, 100) -SketchLine_7 = Sketch_1.addLine(-18.08302242613596, -98.35143262777552, 356.0223839531057, 103.3169707422677) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchLine_8 = Sketch_1.addLine(557.3438493481349, 211.8430112592427, 909.4430553521272, 401.6485673722245) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_8.endPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchLine_7.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_7.result()) +SketchLine_7 = Sketch_1.addLine( + -18.08302242613596, -98.35143262777552, 356.0223839531057, 103.3169707422677 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchLine_8 = Sketch_1.addLine( + 557.3438493481349, 211.8430112592427, 909.4430553521272, 401.6485673722245 +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_8.endPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchCircle_2.center(), SketchLine_7.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_7.result() +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchCircle_2.results()[1], 100) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchCircle_1.results()[1], 75) 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) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchCircle_1.results()[1]) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_2.endPoint(), 325) +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 +) +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-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")]) +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 * # check conical face aShape = Face_1.result().resultSubShapePair()[0].shape() -assert(aShape.isFace()) -assert(aShape.face().getCone() is not None) +assert aShape.isFace() +assert aShape.face().getCone() is not None model.end() diff --git a/src/GeomAPI/Test/Test2879.py b/src/GeomAPI/Test/Test2879.py index 9b8e394e8..3076e381e 100644 --- a/src/GeomAPI/Test/Test2879.py +++ b/src/GeomAPI/Test/Test2879.py @@ -21,7 +21,7 @@ from salome.shaper import model from GeomAPI import * import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 model.begin() partSet = model.moduleDocument() @@ -29,16 +29,25 @@ 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"), 10) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1")], True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_2_1")], + model.selection("EDGE", "PartSet/OX"), + 10, +) +Fuse_1 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1")], + True, +) model.do() model.end() aShape = Fuse_1.result().resultSubShapePair()[0].shape() -assert(aShape.isSolid()) +assert aShape.isSolid() aBox = aShape.solid().getParallelepiped() -assert(aBox is not None) -assert(aBox.isAxesAligned()) +assert aBox is not None +assert aBox.isAxesAligned() CORNER = GeomAPI_Pnt(0, 0, 0) WIDTH = 20 @@ -46,7 +55,17 @@ HEIGHT = 10 DEPTH = 10 aCorner = aBox.corner() -assert(aCorner.distance(CORNER) < TOLERANCE), "({}, {}, {}) != expected ({}, {}, {})".format(aCorner.x(), aCorner.y(), aCorner.z(), CORNER.x(), CORNER.y(), CORNER.z()) -assert(math.fabs(aBox.width() - WIDTH) < TOLERANCE), "Width {} != {}".format(aBox.width(), WIDTH) -assert(math.fabs(aBox.depth() - DEPTH) < TOLERANCE), "Depth {} != {}".format(aBox.depth(), DEPTH) -assert(math.fabs(aBox.height() - HEIGHT) < TOLERANCE), "Height {} != {}".format(aBox.height(), HEIGHT) +assert ( + aCorner.distance(CORNER) < TOLERANCE +), "({}, {}, {}) != expected ({}, {}, {})".format( + aCorner.x(), aCorner.y(), aCorner.z(), CORNER.x(), CORNER.y(), CORNER.z() +) +assert math.fabs(aBox.width() - WIDTH) < TOLERANCE, "Width {} != {}".format( + aBox.width(), WIDTH +) +assert math.fabs(aBox.depth() - DEPTH) < TOLERANCE, "Depth {} != {}".format( + aBox.depth(), DEPTH +) +assert math.fabs(aBox.height() - HEIGHT) < TOLERANCE, "Height {} != {}".format( + aBox.height(), HEIGHT +) diff --git a/src/GeomAPI/Test/TestAx123.py b/src/GeomAPI/Test/TestAx123.py index 7d93eb389..15ed2414c 100644 --- a/src/GeomAPI/Test/TestAx123.py +++ b/src/GeomAPI/Test/TestAx123.py @@ -21,7 +21,7 @@ import math from GeomAPI import * -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 origin = GeomAPI_Pnt(10, 0, 0) dir = GeomAPI_Dir(1, 0, 0) @@ -30,30 +30,30 @@ dir = GeomAPI_Dir(1, 0, 0) ax1 = GeomAPI_Ax1() ax1.setOrigin(origin) ax1.setDir(dir) -assert(ax1.origin().distance(origin) < TOLERANCE) -assert(math.fabs(ax1.dir().dot(dir) - 1.) < TOLERANCE) +assert ax1.origin().distance(origin) < TOLERANCE +assert math.fabs(ax1.dir().dot(dir) - 1.0) < TOLERANCE ax1.reverse() ax1 = ax1.reversed() -assert(ax1.origin().distance(origin) < TOLERANCE) -assert(math.fabs(ax1.dir().dot(dir) - 1.) < TOLERANCE) +assert ax1.origin().distance(origin) < TOLERANCE +assert math.fabs(ax1.dir().dot(dir) - 1.0) < TOLERANCE # Test GeomAPI_Ax2 ax2 = GeomAPI_Ax2() ax2.setOrigin(origin) ax2.setDir(dir) -assert(ax2.origin().distance(origin) < TOLERANCE) -assert(math.fabs(ax2.dir().dot(dir) - 1.) < TOLERANCE) +assert ax2.origin().distance(origin) < TOLERANCE +assert math.fabs(ax2.dir().dot(dir) - 1.0) < TOLERANCE ax2 = GeomAPI_Ax2(origin, dir) -assert(ax2.origin().distance(origin) < TOLERANCE) -assert(math.fabs(ax2.dir().dot(dir) - 1.) < TOLERANCE) +assert ax2.origin().distance(origin) < TOLERANCE +assert math.fabs(ax2.dir().dot(dir) - 1.0) < TOLERANCE dx = GeomAPI_Dir(0, 1, 0) ax2 = GeomAPI_Ax2(origin, dir, dx) -assert(ax2.origin().distance(origin) < TOLERANCE) -assert(math.fabs(ax2.dir().dot(dir) - 1.) < TOLERANCE) +assert ax2.origin().distance(origin) < TOLERANCE +assert math.fabs(ax2.dir().dot(dir) - 1.0) < TOLERANCE # Test GeomAPI_Ax3 @@ -63,19 +63,21 @@ ax3.setOrigin(origin) ax3.setNormal(dy) ax3.setDirX(dir) ax3.setDirY(dx) -assert(ax3.origin().distance(origin) < TOLERANCE) -assert(math.fabs(ax3.normal().dot(dy) - 1.) < TOLERANCE) -assert(math.fabs(ax3.dirX().dot(dir) - 1.) < TOLERANCE) -assert(math.fabs(ax3.dirY().dot(dx) - 1.) < TOLERANCE) +assert ax3.origin().distance(origin) < TOLERANCE +assert math.fabs(ax3.normal().dot(dy) - 1.0) < TOLERANCE +assert math.fabs(ax3.dirX().dot(dir) - 1.0) < TOLERANCE +assert math.fabs(ax3.dirY().dot(dx) - 1.0) < TOLERANCE ax3 = GeomAPI_Ax3(origin, dx, dir) -assert(ax3.origin().distance(origin) < TOLERANCE) -assert(math.fabs(ax3.normal().dot(dir) - 1.) < TOLERANCE) -assert(math.fabs(ax3.dirX().dot(dx) - 1.) < TOLERANCE) -assert(math.fabs(ax3.dirY().dot(dy) - 1.) < TOLERANCE) +assert ax3.origin().distance(origin) < TOLERANCE +assert math.fabs(ax3.normal().dot(dir) - 1.0) < TOLERANCE +assert math.fabs(ax3.dirX().dot(dx) - 1.0) < TOLERANCE +assert math.fabs(ax3.dirY().dot(dy) - 1.0) < TOLERANCE p2d = GeomAPI_Pnt2d(1, 2) -a2d = ax3.to2D(origin.x() + dx.x() * p2d.x() + dy.x() * p2d.y(), - origin.y() + dx.y() * p2d.x() + dy.y() * p2d.y(), - origin.z() + dx.z() * p2d.x() + dy.z() * p2d.y()) -assert(a2d.distance(p2d) < TOLERANCE) +a2d = ax3.to2D( + origin.x() + dx.x() * p2d.x() + dy.x() * p2d.y(), + origin.y() + dx.y() * p2d.x() + dy.y() * p2d.y(), + origin.z() + dx.z() * p2d.x() + dy.z() * p2d.y(), +) +assert a2d.distance(p2d) < TOLERANCE diff --git a/src/GeomAPI/Test/TestBox.py b/src/GeomAPI/Test/TestBox.py index bbe48538e..1b866a190 100644 --- a/src/GeomAPI/Test/TestBox.py +++ b/src/GeomAPI/Test/TestBox.py @@ -24,58 +24,107 @@ from salome.shaper import model import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + def checkBox(theFeature, theCorner, theWidth, theDepth, theHeight): aShape = theFeature.result().resultSubShapePair()[0].shape() - assert(aShape.isSolid()) + assert aShape.isSolid() aBox = aShape.solid().getParallelepiped() - assert(aBox is not None) - assert(aBox.isAxesAligned()) + assert aBox is not None + assert aBox.isAxesAligned() aCorner = aBox.corner() - assert(aCorner.distance(theCorner) < TOLERANCE), "({}, {}, {}) != expected ({}, {}, {})".format(aCorner.x(), aCorner.y(), aCorner.z(), theCorner.x(), theCorner.y(), theCorner.z()) - assert(math.fabs(aBox.width() - theWidth) < TOLERANCE), "Width {} != {}".format(aBox.width(), theWidth) - assert(math.fabs(aBox.depth() - theDepth) < TOLERANCE), "Depth {} != {}".format(aBox.depth(), theDepth) - assert(math.fabs(aBox.height() - theHeight) < TOLERANCE), "Height {} != {}".format(aBox.height(), theHeight) + assert ( + aCorner.distance(theCorner) < TOLERANCE + ), "({}, {}, {}) != expected ({}, {}, {})".format( + aCorner.x(), + aCorner.y(), + aCorner.z(), + theCorner.x(), + theCorner.y(), + theCorner.z(), + ) + assert math.fabs(aBox.width() - theWidth) < TOLERANCE, "Width {} != {}".format( + aBox.width(), theWidth + ) + assert math.fabs(aBox.depth() - theDepth) < TOLERANCE, "Depth {} != {}".format( + aBox.depth(), theDepth + ) + assert math.fabs(aBox.height() - theHeight) < TOLERANCE, "Height {} != {}".format( + aBox.height(), theHeight + ) + def assertParallelepiped(theBox, theCorner1, theCorner2): - assert(theBox is not None) - assert(theBox.isAxesAligned() == False) + assert theBox is not None + assert theBox.isAxesAligned() == False aCorner1 = theBox.corner() axes = theBox.axes() dirX = axes.dirX() dirY = axes.dirY() dirZ = axes.normal() - aCorner2 = GeomAPI.GeomAPI_Pnt(aCorner1.x() + dirX.x() * theBox.width() + dirY.x() * theBox.depth() + dirZ.x() * theBox.height(), - aCorner1.y() + dirX.y() * theBox.width() + dirY.y() * theBox.depth() + dirZ.y() * theBox.height(), - aCorner1.z() + dirX.z() * theBox.width() + dirY.z() * theBox.depth() + dirZ.z() * theBox.height()) - assert(aCorner1.distance(theCorner1) < TOLERANCE), "({}, {}, {}) != expected ({}, {}, {})".format(aCorner1.x(), aCorner1.y(), aCorner1.z(), theCorner1.x(), theCorner1.y(), theCorner1.z()) - assert(aCorner2.distance(theCorner2) < TOLERANCE), "({}, {}, {}) != expected ({}, {}, {})".format(aCorner2.x(), aCorner2.y(), aCorner2.z(), theCorner2.x(), theCorner2.y(), theCorner2.z()) + aCorner2 = GeomAPI.GeomAPI_Pnt( + aCorner1.x() + + dirX.x() * theBox.width() + + dirY.x() * theBox.depth() + + dirZ.x() * theBox.height(), + aCorner1.y() + + dirX.y() * theBox.width() + + dirY.y() * theBox.depth() + + dirZ.y() * theBox.height(), + aCorner1.z() + + dirX.z() * theBox.width() + + dirY.z() * theBox.depth() + + dirZ.z() * theBox.height(), + ) + assert ( + aCorner1.distance(theCorner1) < TOLERANCE + ), "({}, {}, {}) != expected ({}, {}, {})".format( + aCorner1.x(), + aCorner1.y(), + aCorner1.z(), + theCorner1.x(), + theCorner1.y(), + theCorner1.z(), + ) + assert ( + aCorner2.distance(theCorner2) < TOLERANCE + ), "({}, {}, {}) != expected ({}, {}, {})".format( + aCorner2.x(), + aCorner2.y(), + aCorner2.z(), + theCorner2.x(), + theCorner2.y(), + theCorner2.z(), + ) + def checkRotatedBox(theFeature, theCorner1, theCorner2): aShape = theFeature.result().resultSubShapePair()[0].shape() - assert(aShape.isSolid()) + assert aShape.isSolid() aBox = aShape.solid().getParallelepiped() assertParallelepiped(aBox, theCorner1, theCorner2) + def checkShellRotatedBox(theDocument, theFaceNames, theCorner1, theCorner2): aSelection = [] for name in theFaceNames: aSelection.append(model.selection("FACE", name)) aShell = model.addShell(theDocument, aSelection) aShape = aShell.result().resultSubShapePair()[0].shape() - assert(aShape.isShell()) + assert aShape.isShell() assertParallelepiped(aShape.shell().getParallelepiped(), theCorner1, theCorner2) theDocument.removeFeature(aShell.feature()) + def checkShellNotBox(theDocument, theFaceNames): aSelection = [] for name in theFaceNames: aSelection.append(model.selection("FACE", name)) aShell = model.addShell(theDocument, aSelection) aShape = aShell.result().resultSubShapePair()[0].shape() - assert(aShape.isShell()) - assert(aShape.shell().getParallelepiped() is None) + assert aShape.isShell() + assert aShape.shell().getParallelepiped() is None theDocument.removeFeature(aShell.feature()) @@ -90,17 +139,29 @@ 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) SketchLine_3 = Sketch_1.addLine(10, 20, 30, 20) SketchLine_4 = Sketch_1.addLine(30, 20, 30, 10) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.result()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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()) @@ -108,25 +169,68 @@ 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_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], 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 aCornerBox = GeomAPI.GeomAPI_Pnt(0, 0, 0) checkBox(Box_1, aCornerBox, ParamSize.value(), ParamSize.value(), ParamSize.value()) -aCornerPara = GeomAPI.GeomAPI_Pnt(ParamSize.value(), ParamSize.value(), ParamSize.value()) -checkBox(Extrusion_1, aCornerPara, ParamWidth.value(), ParamDepth.value(), ParamHeight.value()) +aCornerPara = GeomAPI.GeomAPI_Pnt( + ParamSize.value(), ParamSize.value(), ParamSize.value() +) +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&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_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()) +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]")) -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") +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", +) aRotDir = GeomAPI.GeomAPI_Dir(1, 1, 1) anAngle = ParamAngle.value() * math.pi / 180.0 @@ -135,34 +239,113 @@ aSinAngle = math.sin(anAngle) aCornerBox = GeomAPI.GeomAPI_Pnt(0, ParamSize.value(), 0) aCornerBox1 = GeomAPI.GeomAPI_Pnt(ParamSize.value(), 0, ParamSize.value()) -aCornerBox = GeomAPI.GeomAPI_Pnt(aCornerBox.x() * (aCosAngle + (1 - aCosAngle) * aRotDir.x()**2) + aCornerBox.y() * ((1 - aCosAngle) * aRotDir.x() * aRotDir.y() - aSinAngle * aRotDir.z()) + aCornerBox.z() * ((1 - aCosAngle) * aRotDir.x() * aRotDir.z() + aSinAngle * aRotDir.y()), - aCornerBox.x() * ((1 - aCosAngle) * aRotDir.x() * aRotDir.y() + aSinAngle * aRotDir.z()) + aCornerBox.y() * (aCosAngle + (1 - aCosAngle) * aRotDir.y()**2) + aCornerBox.z() * ((1 - aCosAngle) * aRotDir.y() * aRotDir.z() - aSinAngle * aRotDir.x()), - aCornerBox.x() * ((1 - aCosAngle) * aRotDir.x() * aRotDir.z() - aSinAngle * aRotDir.y()) + aCornerBox.y() * ((1 - aCosAngle) * aRotDir.y() * aRotDir.z() + aSinAngle * aRotDir.x()) + aCornerBox.z() * (aCosAngle + (1 - aCosAngle) * aRotDir.z()**2)) -aCornerBox1 = GeomAPI.GeomAPI_Pnt(aCornerBox1.x() * (aCosAngle + (1 - aCosAngle) * aRotDir.x()**2) + aCornerBox1.y() * ((1 - aCosAngle) * aRotDir.x() * aRotDir.y() - aSinAngle * aRotDir.z()) + aCornerBox1.z() * ((1 - aCosAngle) * aRotDir.x() * aRotDir.z() + aSinAngle * aRotDir.y()), - aCornerBox1.x() * ((1 - aCosAngle) * aRotDir.x() * aRotDir.y() + aSinAngle * aRotDir.z()) + aCornerBox1.y() * (aCosAngle + (1 - aCosAngle) * aRotDir.y()**2) + aCornerBox1.z() * ((1 - aCosAngle) * aRotDir.y() * aRotDir.z() - aSinAngle * aRotDir.x()), - aCornerBox1.x() * ((1 - aCosAngle) * aRotDir.x() * aRotDir.z() - aSinAngle * aRotDir.y()) + aCornerBox1.y() * ((1 - aCosAngle) * aRotDir.y() * aRotDir.z() + aSinAngle * aRotDir.x()) + aCornerBox1.z() * (aCosAngle + (1 - aCosAngle) * aRotDir.z()**2)) +aCornerBox = GeomAPI.GeomAPI_Pnt( + aCornerBox.x() * (aCosAngle + (1 - aCosAngle) * aRotDir.x() ** 2) + + aCornerBox.y() + * ((1 - aCosAngle) * aRotDir.x() * aRotDir.y() - aSinAngle * aRotDir.z()) + + aCornerBox.z() + * ((1 - aCosAngle) * aRotDir.x() * aRotDir.z() + aSinAngle * aRotDir.y()), + aCornerBox.x() + * ((1 - aCosAngle) * aRotDir.x() * aRotDir.y() + aSinAngle * aRotDir.z()) + + aCornerBox.y() * (aCosAngle + (1 - aCosAngle) * aRotDir.y() ** 2) + + aCornerBox.z() + * ((1 - aCosAngle) * aRotDir.y() * aRotDir.z() - aSinAngle * aRotDir.x()), + aCornerBox.x() + * ((1 - aCosAngle) * aRotDir.x() * aRotDir.z() - aSinAngle * aRotDir.y()) + + aCornerBox.y() + * ((1 - aCosAngle) * aRotDir.y() * aRotDir.z() + aSinAngle * aRotDir.x()) + + aCornerBox.z() * (aCosAngle + (1 - aCosAngle) * aRotDir.z() ** 2), +) +aCornerBox1 = GeomAPI.GeomAPI_Pnt( + aCornerBox1.x() * (aCosAngle + (1 - aCosAngle) * aRotDir.x() ** 2) + + aCornerBox1.y() + * ((1 - aCosAngle) * aRotDir.x() * aRotDir.y() - aSinAngle * aRotDir.z()) + + aCornerBox1.z() + * ((1 - aCosAngle) * aRotDir.x() * aRotDir.z() + aSinAngle * aRotDir.y()), + aCornerBox1.x() + * ((1 - aCosAngle) * aRotDir.x() * aRotDir.y() + aSinAngle * aRotDir.z()) + + aCornerBox1.y() * (aCosAngle + (1 - aCosAngle) * aRotDir.y() ** 2) + + aCornerBox1.z() + * ((1 - aCosAngle) * aRotDir.y() * aRotDir.z() - aSinAngle * aRotDir.x()), + aCornerBox1.x() + * ((1 - aCosAngle) * aRotDir.x() * aRotDir.z() - aSinAngle * aRotDir.y()) + + aCornerBox1.y() + * ((1 - aCosAngle) * aRotDir.y() * aRotDir.z() + aSinAngle * aRotDir.x()) + + aCornerBox1.z() * (aCosAngle + (1 - aCosAngle) * aRotDir.z() ** 2), +) checkRotatedBox(Rotation_2, aCornerBox, aCornerBox1) aCornerPara.setY(aCornerPara.y() + ParamWidth.value()) -aCornerPara1 = GeomAPI.GeomAPI_Pnt(aCornerPara.x() + ParamDepth.value(), aCornerPara.y() - ParamWidth.value(), aCornerPara.z() + ParamHeight.value()) -aCornerPara = GeomAPI.GeomAPI_Pnt(aCornerPara.x() * (aCosAngle + (1 - aCosAngle) * aRotDir.x()**2) + aCornerPara.y() * ((1 - aCosAngle) * aRotDir.x() * aRotDir.y() - aSinAngle * aRotDir.z()) + aCornerPara.z() * ((1 - aCosAngle) * aRotDir.x() * aRotDir.z() + aSinAngle * aRotDir.y()), - aCornerPara.x() * ((1 - aCosAngle) * aRotDir.x() * aRotDir.y() + aSinAngle * aRotDir.z()) + aCornerPara.y() * (aCosAngle + (1 - aCosAngle) * aRotDir.y()**2) + aCornerPara.z() * ((1 - aCosAngle) * aRotDir.y() * aRotDir.z() - aSinAngle * aRotDir.x()), - aCornerPara.x() * ((1 - aCosAngle) * aRotDir.x() * aRotDir.z() - aSinAngle * aRotDir.y()) + aCornerPara.y() * ((1 - aCosAngle) * aRotDir.y() * aRotDir.z() + aSinAngle * aRotDir.x()) + aCornerPara.z() * (aCosAngle + (1 - aCosAngle) * aRotDir.z()**2)) -aCornerPara1 = GeomAPI.GeomAPI_Pnt(aCornerPara1.x() * (aCosAngle + (1 - aCosAngle) * aRotDir.x()**2) + aCornerPara1.y() * ((1 - aCosAngle) * aRotDir.x() * aRotDir.y() - aSinAngle * aRotDir.z()) + aCornerPara1.z() * ((1 - aCosAngle) * aRotDir.x() * aRotDir.z() + aSinAngle * aRotDir.y()), - aCornerPara1.x() * ((1 - aCosAngle) * aRotDir.x() * aRotDir.y() + aSinAngle * aRotDir.z()) + aCornerPara1.y() * (aCosAngle + (1 - aCosAngle) * aRotDir.y()**2) + aCornerPara1.z() * ((1 - aCosAngle) * aRotDir.y() * aRotDir.z() - aSinAngle * aRotDir.x()), - aCornerPara1.x() * ((1 - aCosAngle) * aRotDir.x() * aRotDir.z() - aSinAngle * aRotDir.y()) + aCornerPara1.y() * ((1 - aCosAngle) * aRotDir.y() * aRotDir.z() + aSinAngle * aRotDir.x()) + aCornerPara1.z() * (aCosAngle + (1 - aCosAngle) * aRotDir.z()**2)) +aCornerPara1 = GeomAPI.GeomAPI_Pnt( + aCornerPara.x() + ParamDepth.value(), + aCornerPara.y() - ParamWidth.value(), + aCornerPara.z() + ParamHeight.value(), +) +aCornerPara = GeomAPI.GeomAPI_Pnt( + aCornerPara.x() * (aCosAngle + (1 - aCosAngle) * aRotDir.x() ** 2) + + aCornerPara.y() + * ((1 - aCosAngle) * aRotDir.x() * aRotDir.y() - aSinAngle * aRotDir.z()) + + aCornerPara.z() + * ((1 - aCosAngle) * aRotDir.x() * aRotDir.z() + aSinAngle * aRotDir.y()), + aCornerPara.x() + * ((1 - aCosAngle) * aRotDir.x() * aRotDir.y() + aSinAngle * aRotDir.z()) + + aCornerPara.y() * (aCosAngle + (1 - aCosAngle) * aRotDir.y() ** 2) + + aCornerPara.z() + * ((1 - aCosAngle) * aRotDir.y() * aRotDir.z() - aSinAngle * aRotDir.x()), + aCornerPara.x() + * ((1 - aCosAngle) * aRotDir.x() * aRotDir.z() - aSinAngle * aRotDir.y()) + + aCornerPara.y() + * ((1 - aCosAngle) * aRotDir.y() * aRotDir.z() + aSinAngle * aRotDir.x()) + + aCornerPara.z() * (aCosAngle + (1 - aCosAngle) * aRotDir.z() ** 2), +) +aCornerPara1 = GeomAPI.GeomAPI_Pnt( + aCornerPara1.x() * (aCosAngle + (1 - aCosAngle) * aRotDir.x() ** 2) + + aCornerPara1.y() + * ((1 - aCosAngle) * aRotDir.x() * aRotDir.y() - aSinAngle * aRotDir.z()) + + aCornerPara1.z() + * ((1 - aCosAngle) * aRotDir.x() * aRotDir.z() + aSinAngle * aRotDir.y()), + aCornerPara1.x() + * ((1 - aCosAngle) * aRotDir.x() * aRotDir.y() + aSinAngle * aRotDir.z()) + + aCornerPara1.y() * (aCosAngle + (1 - aCosAngle) * aRotDir.y() ** 2) + + aCornerPara1.z() + * ((1 - aCosAngle) * aRotDir.y() * aRotDir.z() - aSinAngle * aRotDir.x()), + aCornerPara1.x() + * ((1 - aCosAngle) * aRotDir.x() * aRotDir.z() - aSinAngle * aRotDir.y()) + + aCornerPara1.y() + * ((1 - aCosAngle) * aRotDir.y() * aRotDir.z() + aSinAngle * aRotDir.x()) + + aCornerPara1.z() * (aCosAngle + (1 - aCosAngle) * aRotDir.z() ** 2), +) 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/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"] +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/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"] +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) # Test 6. One more check the shell is not a box -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10, 45) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, + 45, +) Shell_objects = ["Cylinder_1_1/Face_2", "Cylinder_1_1/Face_4"] checkShellNotBox(Part_1_doc, Shell_objects) diff --git a/src/GeomAPI/Test/TestBuilders.py b/src/GeomAPI/Test/TestBuilders.py index bf884c8c0..66c1a2a53 100644 --- a/src/GeomAPI/Test/TestBuilders.py +++ b/src/GeomAPI/Test/TestBuilders.py @@ -31,7 +31,7 @@ from GeomAPI import GeomAPI_Pnt2d as pnt2d from GeomAPI import GeomAPI_Circ2d from GeomAPI import GeomAPI_Shape -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 center = pnt(10, 0, 0) normal = dir(0, 0, 1) @@ -42,37 +42,33 @@ minorRadius = 5 # Test 1. Elliptical edge ellipseEdge = edgeBuilder.ellipse(center, normal, xAxis, majorRadius, minorRadius) ellipse = ellipseEdge.ellipse() -assert(ellipse is not None) -assert(ellipse.center().distance(center) < TOLERANCE) -assert(ellipse.firstFocus().distance(pnt(18.66025404, 0., 0.)) < TOLERANCE) -assert(ellipse.secondFocus().distance(pnt(1.339745962, 0., 0.)) < TOLERANCE) -assert(ellipse.majorRadius() == majorRadius) -assert(ellipse.minorRadius() == minorRadius) +assert ellipse is not None +assert ellipse.center().distance(center) < TOLERANCE +assert ellipse.firstFocus().distance(pnt(18.66025404, 0.0, 0.0)) < TOLERANCE +assert ellipse.secondFocus().distance(pnt(1.339745962, 0.0, 0.0)) < TOLERANCE +assert ellipse.majorRadius() == majorRadius +assert ellipse.minorRadius() == minorRadius # Test 2. Square face -size = 100. +size = 100.0 squareFace = faceBuilder.squareFace(center, normal, size) -assert(squareFace.middlePoint().distance(center) < TOLERANCE) +assert squareFace.middlePoint().distance(center) < TOLERANCE # Test 3. Check are of the face -assert(tools.area(squareFace) == size**2) +assert tools.area(squareFace) == size**2 # Test 4. Check properties of wrong shapes -assert(tools.volume(None) == 0) -assert(tools.volume(GeomAPI_Shape()) == 0) -assert(tools.area(None) == 0) -assert(tools.area(GeomAPI_Shape()) == 0) -assert(tools.centreOfMass(None) is None) -assert(tools.centreOfMass(GeomAPI_Shape()) is None) +assert tools.volume(None) == 0 +assert tools.volume(GeomAPI_Shape()) == 0 +assert tools.area(None) == 0 +assert tools.area(GeomAPI_Shape()) == 0 +assert tools.centreOfMass(None) is None +assert tools.centreOfMass(GeomAPI_Shape()) is None # Test 5. Curve with duplicated points -points = [pnt(10, 0, 0), - pnt(20, 10, 0), - pnt(20, 10, 0), - pnt(10, 10, 0), - pnt(10, 0, 0)] +points = [pnt(10, 0, 0), pnt(20, 10, 0), pnt(20, 10, 0), pnt(10, 10, 0), pnt(10, 0, 0)] curve = curveBuilder.edge(points, True, True, None, None) -assert(curve is not None) +assert curve is not None # Test 6. Circle by center and radius center = pnt2d(5, 0) @@ -82,15 +78,15 @@ circleBuilder = circBuilder(plane) circleBuilder.setCenter(center) circleBuilder.setRadius(radius) circle = circBuilder.circle(circleBuilder) -assert(circle is not None) -assert(circle.center().distance(center) < TOLERANCE) -assert(circle.radius() == radius) +assert circle is not None +assert circle.center().distance(center) < TOLERANCE +assert circle.radius() == radius # Test 7. Circle by 3 points p1 = pnt2d(center.x() + radius, center.y()) p2 = pnt2d(center.x() - radius, center.y()) p3 = pnt2d(center.x(), center.y() + radius) circle = circBuilder.circle(p1, p2, p3) -assert(circle is not None) -assert(circle.center().distance(center) < TOLERANCE) -assert(circle.radius() == radius) +assert circle is not None +assert circle.center().distance(center) < TOLERANCE +assert circle.radius() == radius diff --git a/src/GeomAPI/Test/TestCone.py b/src/GeomAPI/Test/TestCone.py index 95e9c71b2..1ef407630 100644 --- a/src/GeomAPI/Test/TestCone.py +++ b/src/GeomAPI/Test/TestCone.py @@ -24,142 +24,349 @@ from salome.shaper import model import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + def assertCircle(theEdge, theCenter, theRadius): - assert(theEdge.isCircle()) + assert theEdge.isCircle() aCircle = theEdge.circle() - assert(aCircle.center().distance(theCenter) < TOLERANCE), "({}, {}, {}) != expected ({}, {}, {})".format(aCircle.center().x(), aCircle.center().y(), aCircle.center().z(), theCenter.x(), theCenter.y(), theCenter.z()) - assert(math.fabs(aCircle.radius() - theRadius) < TOLERANCE), "Radius {} != {}".format(aCircle.radius(), theRadius) + assert ( + aCircle.center().distance(theCenter) < TOLERANCE + ), "({}, {}, {}) != expected ({}, {}, {})".format( + aCircle.center().x(), + aCircle.center().y(), + aCircle.center().z(), + theCenter.x(), + theCenter.y(), + theCenter.z(), + ) + assert ( + math.fabs(aCircle.radius() - theRadius) < TOLERANCE + ), "Radius {} != {}".format(aCircle.radius(), theRadius) + def checkCircleEdge(theDocument, theEdgeName, theCenter, theRadius): anEdge = model.addEdge(theDocument, [model.selection("EDGE", theEdgeName)]) aShape = anEdge.result().resultSubShapePair()[0].shape() - assert(aShape.isEdge()) - assert(aShape.edge().isClosed()) + assert aShape.isEdge() + assert aShape.edge().isClosed() assertCircle(aShape.edge(), theCenter, theRadius) theDocument.removeFeature(anEdge.feature()) + def checkCircleFace(theDocument, theFaceName, theCenter, theRadius): aFaceFeature = model.addFace(theDocument, [model.selection("FACE", theFaceName)]) aShape = aFaceFeature.result().resultSubShapePair()[0].shape() - assert(aShape.isFace()) - aFace = aShape.face(); + assert aShape.isFace() + aFace = aShape.face() aSubs = aFace.subShapes(GeomAPI.GeomAPI_Shape.EDGE) - assert(aSubs.size() == 1) + assert aSubs.size() == 1 assertCircle(aSubs[0].edge(), theCenter, theRadius) theDocument.removeFeature(aFaceFeature.feature()) -def assertEllipse(theEdge, theFirstFocus, theSecondFocus, theMajorRadius, theMinorRadius, theNormal = None): - assert(theEdge.isEllipse()) - anEllipse = theEdge.ellipse() - assert(anEllipse.firstFocus().distance(theFirstFocus) < TOLERANCE), "({}, {}, {}) != expected ({}, {}, {})".format(anEllipse.firstFocus().x(), anEllipse.firstFocus().y(), anEllipse.firstFocus().z(), theFirstFocus.x(), theFirstFocus.y(), theFirstFocus.z()) - assert(anEllipse.secondFocus().distance(theSecondFocus) < TOLERANCE), "({}, {}, {}) != expected ({}, {}, {})".format(anEllipse.secondFocus().x(), anEllipse.secondFocus().y(), anEllipse.secondFocus().z(), theSecondFocus.x(), theSecondFocus.y(), theSecondFocus.z()) - assert(math.fabs(anEllipse.majorRadius() - theMajorRadius) < TOLERANCE), "Major radius {} != {}".format(anEllipse.majorRadius(), theMajorRadius) - assert(math.fabs(anEllipse.minorRadius() - theMinorRadius) < TOLERANCE), "Minor radius {} != {}".format(anEllipse.minorRadius(), theMinorRadius) - center = GeomAPI.GeomAPI_Pnt((theFirstFocus.x() + theSecondFocus.x()) * 0.5, (theFirstFocus.y() + theSecondFocus.y()) * 0.5, (theFirstFocus.z() + theSecondFocus.z()) * 0.5) - assert(anEllipse.center().distance(center) < TOLERANCE), "({}, {}, {}) != expected ({}, {}, {})".format(anEllipse.center().x(), anEllipse.center().y(), anEllipse.center().z(), center.x(), center.y(), center.z()) +def assertEllipse( + theEdge, + theFirstFocus, + theSecondFocus, + theMajorRadius, + theMinorRadius, + theNormal=None, +): + assert theEdge.isEllipse() + anEllipse = theEdge.ellipse() + assert ( + anEllipse.firstFocus().distance(theFirstFocus) < TOLERANCE + ), "({}, {}, {}) != expected ({}, {}, {})".format( + anEllipse.firstFocus().x(), + anEllipse.firstFocus().y(), + anEllipse.firstFocus().z(), + theFirstFocus.x(), + theFirstFocus.y(), + theFirstFocus.z(), + ) + assert ( + anEllipse.secondFocus().distance(theSecondFocus) < TOLERANCE + ), "({}, {}, {}) != expected ({}, {}, {})".format( + anEllipse.secondFocus().x(), + anEllipse.secondFocus().y(), + anEllipse.secondFocus().z(), + theSecondFocus.x(), + theSecondFocus.y(), + theSecondFocus.z(), + ) + assert ( + math.fabs(anEllipse.majorRadius() - theMajorRadius) < TOLERANCE + ), "Major radius {} != {}".format(anEllipse.majorRadius(), theMajorRadius) + assert ( + math.fabs(anEllipse.minorRadius() - theMinorRadius) < TOLERANCE + ), "Minor radius {} != {}".format(anEllipse.minorRadius(), theMinorRadius) + + center = GeomAPI.GeomAPI_Pnt( + (theFirstFocus.x() + theSecondFocus.x()) * 0.5, + (theFirstFocus.y() + theSecondFocus.y()) * 0.5, + (theFirstFocus.z() + theSecondFocus.z()) * 0.5, + ) + assert ( + anEllipse.center().distance(center) < TOLERANCE + ), "({}, {}, {}) != expected ({}, {}, {})".format( + anEllipse.center().x(), + anEllipse.center().y(), + anEllipse.center().z(), + center.x(), + center.y(), + center.z(), + ) if theNormal is not None: - assert(math.fabs(anEllipse.normal().dot(theNormal) - 1.) < TOLERANCE), "Normal ({}, {}, {}) != ({}, {}, {})".format(anEllipse.normal().x(), anEllipse.normal().y(), anEllipse.normal().z(), theNormal.x(), theNormal.y(), theNormal.z()) - -def checkEllipseEdge(theDocument, theEdgeName, theFirstFocus, theSecondFocus, theMajorRadius, theMinorRadius, theNormal): + assert ( + math.fabs(anEllipse.normal().dot(theNormal) - 1.0) < TOLERANCE + ), "Normal ({}, {}, {}) != ({}, {}, {})".format( + anEllipse.normal().x(), + anEllipse.normal().y(), + anEllipse.normal().z(), + theNormal.x(), + theNormal.y(), + theNormal.z(), + ) + + +def checkEllipseEdge( + theDocument, + theEdgeName, + theFirstFocus, + theSecondFocus, + theMajorRadius, + theMinorRadius, + theNormal, +): anEdge = model.addEdge(theDocument, [model.selection("EDGE", theEdgeName)]) aShape = anEdge.result().resultSubShapePair()[0].shape() - assert(aShape.isEdge()) - assertEllipse(aShape.edge(), theFirstFocus, theSecondFocus, theMajorRadius, theMinorRadius, theNormal) + assert aShape.isEdge() + assertEllipse( + aShape.edge(), + theFirstFocus, + theSecondFocus, + theMajorRadius, + theMinorRadius, + theNormal, + ) theDocument.removeFeature(anEdge.feature()) -def checkEllipseFace(theDocument, theFaceName, theFirstFocus, theSecondFocus, theMajorRadius, theMinorRadius): + +def checkEllipseFace( + theDocument, + theFaceName, + theFirstFocus, + theSecondFocus, + theMajorRadius, + theMinorRadius, +): aFaceFeature = model.addFace(theDocument, [model.selection("FACE", theFaceName)]) aShape = aFaceFeature.result().resultSubShapePair()[0].shape() - assert(aShape.isFace()) - aFace = aShape.face(); + assert aShape.isFace() + aFace = aShape.face() aSubs = aFace.subShapes(GeomAPI.GeomAPI_Shape.EDGE) - assert(aSubs.size() == 1) - assertEllipse(aSubs[0].edge(), theFirstFocus, theSecondFocus, theMajorRadius, theMinorRadius) + assert aSubs.size() == 1 + assertEllipse( + aSubs[0].edge(), theFirstFocus, theSecondFocus, theMajorRadius, theMinorRadius + ) theDocument.removeFeature(aFaceFeature.feature()) -def assertCone(theCone, theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight): - assert(theCone is not None) - assert(theCone.isSemiInfinite() == False) - assert(theCone.isInfinite() == False) + +def assertCone( + theCone, theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight +): + assert theCone is not None + assert theCone.isSemiInfinite() == False + assert theCone.isInfinite() == False anApex = theCone.apex() anAxis = theCone.axis() - assert(anApex.distance(theApex) < TOLERANCE), "({}, {}, {}) != expected ({}, {}, {})".format(anApex.x(), anApex.y(), anApex.z(), theApex.x(), theApex.y(), theApex.z()) - assert(anAxis.isParallel(theAxis, TOLERANCE)), "dir({}, {}, {}) is not parallel to dir({}, {}, {})".format(anAxis.x(), anAxis.y(), anAxis.z(), theAxis.x(), theAxis.y(), theAxis.z()) - assert(math.fabs(theCone.semiAngle() - theSemiAngle) < TOLERANCE), "SemiAngle {} != {}".format(theCone.semiAngle(), theSemiAngle) - assert(math.fabs(theCone.radius1() - theRadius1) < TOLERANCE), "Radius1 {} != {}".format(theCone.radius1(), theRadius1) - assert(math.fabs(theCone.radius2() - theRadius2) < TOLERANCE), "Radius2 {} != {}".format(theCone.radius2(), theRadius2) - assert(math.fabs(theCone.height() - theHeight) < TOLERANCE), "Height {} != {}".format(theCone.height(), theHeight) - -def checkConeFace(theDocument, theFaceName, theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight): + assert ( + anApex.distance(theApex) < TOLERANCE + ), "({}, {}, {}) != expected ({}, {}, {})".format( + anApex.x(), anApex.y(), anApex.z(), theApex.x(), theApex.y(), theApex.z() + ) + assert anAxis.isParallel( + theAxis, TOLERANCE + ), "dir({}, {}, {}) is not parallel to dir({}, {}, {})".format( + anAxis.x(), anAxis.y(), anAxis.z(), theAxis.x(), theAxis.y(), theAxis.z() + ) + assert ( + math.fabs(theCone.semiAngle() - theSemiAngle) < TOLERANCE + ), "SemiAngle {} != {}".format(theCone.semiAngle(), theSemiAngle) + assert ( + math.fabs(theCone.radius1() - theRadius1) < TOLERANCE + ), "Radius1 {} != {}".format(theCone.radius1(), theRadius1) + assert ( + math.fabs(theCone.radius2() - theRadius2) < TOLERANCE + ), "Radius2 {} != {}".format(theCone.radius2(), theRadius2) + assert ( + math.fabs(theCone.height() - theHeight) < TOLERANCE + ), "Height {} != {}".format(theCone.height(), theHeight) + + +def checkConeFace( + theDocument, + theFaceName, + theApex, + theAxis, + theSemiAngle, + theRadius1, + theRadius2, + theHeight, +): # check conical face aFace = model.addFace(theDocument, [model.selection("FACE", theFaceName)]) aShape = aFace.result().resultSubShapePair()[0].shape() - assert(aShape.isFace()) - assertCone(aShape.face().getCone(), theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight) + assert aShape.isFace() + assertCone( + aShape.face().getCone(), + theApex, + theAxis, + theSemiAngle, + theRadius1, + theRadius2, + theHeight, + ) theDocument.removeFeature(aFace.feature()) -def checkConeShell(theDocument, theFaceNames, theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight): + +def checkConeShell( + theDocument, + theFaceNames, + theApex, + theAxis, + theSemiAngle, + theRadius1, + theRadius2, + theHeight, +): # check conical shell aSelection = [] for name in theFaceNames: aSelection.append(model.selection("FACE", name)) aShell = model.addShell(theDocument, aSelection) aShape = aShell.result().resultSubShapePair()[0].shape() - assert(aShape.isShell()) - assertCone(aShape.shell().getCone(), theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight) + assert aShape.isShell() + assertCone( + aShape.shell().getCone(), + theApex, + theAxis, + theSemiAngle, + theRadius1, + theRadius2, + theHeight, + ) theDocument.removeFeature(aShell.feature()) -def checkConeSolid(theDocument, theFaceNames, theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight): + +def checkConeSolid( + theDocument, + theFaceNames, + theApex, + theAxis, + theSemiAngle, + theRadius1, + theRadius2, + theHeight, +): # check cone aSelection = [] for name in theFaceNames: aSelection.append(model.selection("FACE", name)) aSolid = model.addSolid(theDocument, aSelection) aShape = aSolid.result().resultSubShapePair()[0].shape() - assert(aShape.isSolid()) - assertCone(aShape.solid().getCone(), theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight) + assert aShape.isSolid() + assertCone( + aShape.solid().getCone(), + theApex, + theAxis, + theSemiAngle, + theRadius1, + theRadius2, + theHeight, + ) theDocument.removeFeature(aSolid.feature()) -def checkConeAll(theDocument, theFeature, theFaceName, theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight): + +def checkConeAll( + theDocument, + theFeature, + theFaceName, + theApex, + theAxis, + theSemiAngle, + theRadius1, + theRadius2, + theHeight, +): # check solid aShape = theFeature.result().resultSubShapePair()[0].shape() - assert(aShape.isSolid()) - assertCone(aShape.solid().getCone(), theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight) + assert aShape.isSolid() + assertCone( + aShape.solid().getCone(), + theApex, + theAxis, + theSemiAngle, + theRadius1, + theRadius2, + theHeight, + ) + + checkConeShell( + theDocument, + [theFaceName], + theApex, + theAxis, + theSemiAngle, + theRadius1, + theRadius2, + theHeight, + ) + checkConeFace( + theDocument, + theFaceName, + theApex, + theAxis, + theSemiAngle, + theRadius1, + theRadius2, + theHeight, + ) - checkConeShell(theDocument, [theFaceName], theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight) - checkConeFace(theDocument, theFaceName, theApex, theAxis, theSemiAngle, theRadius1, theRadius2, theHeight) def checkNonCone(theFeature): aShape = theFeature.result().resultSubShapePair()[0].shape() - assert(aShape.isSolid()) - assert(aShape.solid().getCone() is None) + assert aShape.isSolid() + assert aShape.solid().getCone() is None + def checkNonConeShell(theFeature): aShape = theFeature.result().resultSubShapePair()[0].shape() - assert(aShape.isShell()) - assert(aShape.shell().getCone() is None) + assert aShape.isShell() + assert aShape.shell().getCone() is None + def checkSegment(theDocument, theEdgeName, theStartPoint, theEndPoint): anEdgeFeature = model.addEdge(theDocument, [model.selection("EDGE", theEdgeName)]) aShape = anEdgeFeature.result().resultSubShapePair()[0].shape() - assert(aShape.isEdge()) + assert aShape.isEdge() anEdge = aShape.edge() - assert(anEdge.isLine()) - assert(anEdge.firstPoint().distance(theStartPoint) < TOLERANCE) - assert(anEdge.lastPoint().distance(theEndPoint) < TOLERANCE) + assert anEdge.isLine() + assert anEdge.firstPoint().distance(theStartPoint) < TOLERANCE + assert anEdge.lastPoint().distance(theEndPoint) < TOLERANCE theDocument.removeFeature(anEdgeFeature.feature()) + def checkVertex(theDocument, theVertexName, theCoordinates): aVertex = model.addVertex(theDocument, [model.selection("VERTEX", theVertexName)]) aShape = aVertex.result().resultSubShapePair()[0].shape() - assert(aShape.isVertex()) - assert(aShape.vertex().point().distance(theCoordinates) < TOLERANCE) + assert aShape.isVertex() + assert aShape.vertex().point().distance(theCoordinates) < TOLERANCE theDocument.removeFeature(aVertex.feature()) + def semiAngle(theRadius1, theRadius2, theHeight): return math.atan(math.fabs(theRadius1 - theRadius2) / theHeight) @@ -173,29 +380,93 @@ ParamR2 = model.addParameter(Part_1_doc, "R2", "5") ParamH = model.addParameter(Part_1_doc, "H", "70") ParamShift = model.addParameter(Part_1_doc, "Shift", "5") ParamAngle = model.addParameter(Part_1_doc, "Angle", "60") -Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R1", "R2", "H") +Cone_1 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "R1", + "R2", + "H", +) model.do() # Test 1. Check cone aSemiAngle = semiAngle(ParamR1.value(), ParamR2.value(), ParamH.value()) 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()) -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][weak_name_3]", GeomAPI.GeomAPI_Pnt(ParamR1.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value())) +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(), +) +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][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) model.do() 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][weak_name_3]", GeomAPI.GeomAPI_Pnt(0, 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value())) +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][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) @@ -203,68 +474,236 @@ ParamR1.setValue(10) model.do() 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()) -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][weak_name_3]", GeomAPI.GeomAPI_Pnt(ParamR1.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value())) +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(), +) +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][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") +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/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())) +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") +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 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/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/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/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()) +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/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/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&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()) +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&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 aNormal = GeomAPI.GeomAPI_Dir(1, 0, 0) -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, aNormal) +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, + aNormal, +) # Test 6. Compose a conical solid -Solid_1_objects = ["Rotation_1_1/MF:Rotated&Cone_1_1/Face_3", - "Partition_1_1_1/Modified_Face&Cone_1_1/Face_1", - "Partition_1_1_2/Modified_Face&Cone_1_1/Face_1", - "Rotation_1_1/MF:Rotated&Cone_1_1/Face_2"] -checkConeSolid(Part_1_doc, Solid_1_objects, anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value()) +Solid_1_objects = [ + "Rotation_1_1/MF:Rotated&Cone_1_1/Face_3", + "Partition_1_1_1/Modified_Face&Cone_1_1/Face_1", + "Partition_1_1_2/Modified_Face&Cone_1_1/Face_1", + "Rotation_1_1/MF:Rotated&Cone_1_1/Face_2", +] +checkConeSolid( + Part_1_doc, + Solid_1_objects, + anApex, + anAxis, + aSemiAngle, + ParamR1.value(), + ParamR2.value(), + ParamH.value(), +) # Test 7. Check non-cone -Cone_2 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10) -Cone_3 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10, 20) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cone_2_1"), model.selection("SOLID", "Cone_3_1")], True) +Cone_2 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 5, + 10, +) +Cone_3 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, + 20, +) +Fuse_1 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Cone_2_1"), model.selection("SOLID", "Cone_3_1")], + True, +) model.do() -Solid_2_objects = [model.selection("FACE", "Fuse_1_1/Modified_Face&Cone_2_1/Face_3&Cone_3_1/Face_3"), - model.selection("FACE", "Fuse_1_1/Modified_Face&Cone_2_1/Face_1"), - model.selection("FACE", "Fuse_1_1/Modified_Face&Cone_3_1/Face_1"), - model.selection("FACE", "Cone_3_1/Face_2")] +Solid_2_objects = [ + model.selection("FACE", "Fuse_1_1/Modified_Face&Cone_2_1/Face_3&Cone_3_1/Face_3"), + model.selection("FACE", "Fuse_1_1/Modified_Face&Cone_2_1/Face_1"), + model.selection("FACE", "Fuse_1_1/Modified_Face&Cone_3_1/Face_1"), + model.selection("FACE", "Cone_3_1/Face_2"), +] Solid_2 = model.addSolid(Part_1_doc, Solid_2_objects) checkNonCone(Solid_2) model.end() @@ -274,14 +713,22 @@ model.undo() # Test 8. Check non-conical shell model.begin() -Shell_1_objects = [model.selection("FACE", "Rotation_1_1/MF:Rotated&Cone_1_1/Face_3"), - model.selection("FACE", "Partition_1_1_1/Modified_Face&Cone_1_1/Face_1"), - model.selection("FACE", "Partition_1_1_2/Modified_Face&Cone_1_1/Face_1"), - model.selection("FACE", "Rotation_1_1/MF:Rotated&Cone_1_1/Face_2")] +Shell_1_objects = [ + model.selection("FACE", "Rotation_1_1/MF:Rotated&Cone_1_1/Face_3"), + model.selection("FACE", "Partition_1_1_1/Modified_Face&Cone_1_1/Face_1"), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Cone_1_1/Face_1"), + model.selection("FACE", "Rotation_1_1/MF:Rotated&Cone_1_1/Face_2"), +] Shell_1 = model.addShell(Part_1_doc, Shell_1_objects) checkNonConeShell(Shell_1) -Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Fuse_1_1/Modified_Face&Cone_2_1/Face_1"), model.selection("FACE", "Fuse_1_1/Modified_Face&Cone_3_1/Face_1")]) +Shell_2 = model.addShell( + Part_1_doc, + [ + model.selection("FACE", "Fuse_1_1/Modified_Face&Cone_2_1/Face_1"), + model.selection("FACE", "Fuse_1_1/Modified_Face&Cone_3_1/Face_1"), + ], +) checkNonConeShell(Shell_2) model.end() @@ -290,32 +737,47 @@ model.undo() # Test 9. Check error on conversion to wrong type of curve model.begin() -anEdge = model.addEdge(Part_1_doc, [model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Cone_1_1/Face_1][Rotation_1_1/MF:Rotated&Cone_1_1/Face_2]")]) +anEdge = model.addEdge( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Partition_1_1_2/Modified_Face&Cone_1_1/Face_1][Rotation_1_1/MF:Rotated&Cone_1_1/Face_2]", + ) + ], +) aShape = anEdge.result().resultSubShapePair()[0].shape() -assert(aShape.isEdge()) -assert(aShape.edge().ellipse() is None) -assert(aShape.edge().line() is None) +assert aShape.isEdge() +assert aShape.edge().ellipse() is None +assert aShape.edge().line() is None model.end() model.undo() model.begin() -anEdge = model.addEdge(Part_1_doc, [model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Cone_1_1/Face_1][weak_name_2]")]) +anEdge = model.addEdge( + Part_1_doc, + [ + model.selection( + "EDGE", "[Partition_1_1_2/Modified_Face&Cone_1_1/Face_1][weak_name_2]" + ) + ], +) aShape = anEdge.result().resultSubShapePair()[0].shape() -assert(aShape.isEdge()) -assert(aShape.edge().circle() is None) -assert(aShape.isSelfIntersected() == False) +assert aShape.isEdge() +assert aShape.edge().circle() is None +assert aShape.isSelfIntersected() == False # Test 10. Test cone constructors apex = GeomAPI_Pnt(10, 0, 0) dir = GeomAPI_Dir(1, 0, 0) semiAngle = math.pi / 4 cone = GeomAPI_Cone(apex, dir, semiAngle) -assert(cone.location().distance(apex) < TOLERANCE) +assert cone.location().distance(apex) < TOLERANCE radius = 5 cone = GeomAPI_Cone(apex, dir, semiAngle, radius) -assert(cone.location().distance(apex) < TOLERANCE) +assert cone.location().distance(apex) < TOLERANCE model.end() diff --git a/src/GeomAPI/Test/TestCylinder.py b/src/GeomAPI/Test/TestCylinder.py index e22d97e3d..338331bc9 100644 --- a/src/GeomAPI/Test/TestCylinder.py +++ b/src/GeomAPI/Test/TestCylinder.py @@ -24,62 +24,101 @@ from salome.shaper import model import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + def assertCylinder(theCylinder, theLocation, theAxis, theRadius, theHeight): - assert(theCylinder is not None) - assert(theCylinder.isInfinite() == False) + assert theCylinder is not None + assert theCylinder.isInfinite() == False aLoc = theCylinder.location() aDir = theCylinder.axis() - assert(aLoc.distance(theLocation) < TOLERANCE), "({}, {}, {}) != expected ({}, {}, {})".format(aLoc.x(), aLoc.y(), aLoc.z(), theLocation.x(), theLocation.y(), theLocation.z()) - assert(aDir.isParallel(theAxis, TOLERANCE)), "dir({}, {}, {}) is not parallel to dir({}, {}, {})".format(aDir.x(), aDir.y(), aDir.z(), theAxis.x(), theAxis.y(), theAxis.z()) - assert(math.fabs(theCylinder.radius() - theRadius) < TOLERANCE), "Radius {} != {}".format(theCylinder.radius(), theRadius) - assert(math.fabs(theCylinder.height() - theHeight) < TOLERANCE), "Height {} != {}".format(theCylinder.height(), theHeight) + assert ( + aLoc.distance(theLocation) < TOLERANCE + ), "({}, {}, {}) != expected ({}, {}, {})".format( + aLoc.x(), aLoc.y(), aLoc.z(), theLocation.x(), theLocation.y(), theLocation.z() + ) + assert aDir.isParallel( + theAxis, TOLERANCE + ), "dir({}, {}, {}) is not parallel to dir({}, {}, {})".format( + aDir.x(), aDir.y(), aDir.z(), theAxis.x(), theAxis.y(), theAxis.z() + ) + assert ( + math.fabs(theCylinder.radius() - theRadius) < TOLERANCE + ), "Radius {} != {}".format(theCylinder.radius(), theRadius) + assert ( + math.fabs(theCylinder.height() - theHeight) < TOLERANCE + ), "Height {} != {}".format(theCylinder.height(), theHeight) + -def checkCylinderFace(theDocument, theFaceName, theLocation, theAxis, theRadius, theHeight): +def checkCylinderFace( + theDocument, theFaceName, theLocation, theAxis, theRadius, theHeight +): aFace = model.addFace(theDocument, [model.selection("FACE", theFaceName)]) aShape = aFace.result().resultSubShapePair()[0].shape() - assert(aShape.isFace()) - assertCylinder(aShape.face().getCylinder(), theLocation, theAxis, theRadius, theHeight) + assert aShape.isFace() + assertCylinder( + aShape.face().getCylinder(), theLocation, theAxis, theRadius, theHeight + ) theDocument.removeFeature(aFace.feature()) -def checkCylinderShell(theDocument, theFaceNames, theLocation, theAxis, theRadius, theHeight): + +def checkCylinderShell( + theDocument, theFaceNames, theLocation, theAxis, theRadius, theHeight +): aSelection = [] for name in theFaceNames: aSelection.append(model.selection("FACE", name)) aShell = model.addShell(theDocument, aSelection) aShape = aShell.result().resultSubShapePair()[0].shape() - assert(aShape.isShell()) - assertCylinder(aShape.shell().getCylinder(), theLocation, theAxis, theRadius, theHeight) + assert aShape.isShell() + assertCylinder( + aShape.shell().getCylinder(), theLocation, theAxis, theRadius, theHeight + ) theDocument.removeFeature(aShell.feature()) -def checkCylinderSolid(theDocument, theFaceNames, theLocation, theAxis, theRadius, theHeight): + +def checkCylinderSolid( + theDocument, theFaceNames, theLocation, theAxis, theRadius, theHeight +): aSelection = [] for name in theFaceNames: aSelection.append(model.selection("FACE", name)) aSolid = model.addSolid(theDocument, aSelection) aShape = aSolid.result().resultSubShapePair()[0].shape() - assert(aShape.isSolid()) - assertCylinder(aShape.solid().getCylinder(), theLocation, theAxis, theRadius, theHeight) + assert aShape.isSolid() + assertCylinder( + aShape.solid().getCylinder(), theLocation, theAxis, theRadius, theHeight + ) theDocument.removeFeature(aSolid.feature()) -def checkCylinderAll(theDocument, theFeature, theFaceName, theLocation, theAxis, theRadius, theHeight): + +def checkCylinderAll( + theDocument, theFeature, theFaceName, theLocation, theAxis, theRadius, theHeight +): aShape = theFeature.result().resultSubShapePair()[0].shape() - assert(aShape.isSolid()) - assertCylinder(aShape.solid().getCylinder(), theLocation, theAxis, theRadius, theHeight) + assert aShape.isSolid() + assertCylinder( + aShape.solid().getCylinder(), theLocation, theAxis, theRadius, theHeight + ) + + checkCylinderShell( + theDocument, [theFaceName], theLocation, theAxis, theRadius, theHeight + ) + checkCylinderFace( + theDocument, theFaceName, theLocation, theAxis, theRadius, theHeight + ) - checkCylinderShell(theDocument, [theFaceName], theLocation, theAxis, theRadius, theHeight) - checkCylinderFace(theDocument, theFaceName, theLocation, theAxis, theRadius, theHeight) def checkNonCylinder(theFeature): aShape = theFeature.result().resultSubShapePair()[0].shape() - assert(aShape.isSolid()) - assert(aShape.solid().getCylinder() is None) + assert aShape.isSolid() + assert aShape.solid().getCylinder() is None + def checkNonCylindricalShell(theFeature): aShape = theFeature.result().resultSubShapePair()[0].shape() - assert(aShape.isShell()) - assert(aShape.shell().getCylinder() is None) + assert aShape.isShell() + assert aShape.shell().getCylinder() is None model.begin() @@ -89,38 +128,85 @@ Part_1_doc = Part_1.document() ParamH = model.addParameter(Part_1_doc, "H", "10") 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") +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "R") model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), "H", 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection(), + "H", + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) SketchLine_1 = Sketch_2.addLine(5, 20, 0, 20) SketchLine_2 = Sketch_2.addLine(0, 20, 0, 30) SketchLine_3 = Sketch_2.addLine(0, 30, 5, 30) SketchLine_4 = Sketch_2.addLine(5, 30, 5, 20) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_1.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_2 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_1.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() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_1.result()) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_2.result()) 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&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]"), 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) +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()) +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_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], 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 @@ -128,77 +214,223 @@ aLoc1 = GeomAPI.GeomAPI_Pnt(0, 0, 0) 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&Sketch_1/SketchCircle_1_2", aLoc2, anAxis, ParamR.value(), ParamH.value()) +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&Sketch_1/SketchCircle_1_2", + aLoc2, + anAxis, + ParamR.value(), + ParamH.value(), +) checkNonCylinder(Revolution_1) -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()) +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") -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OX"), "Angle") -Rotation_3 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], model.selection("EDGE", "PartSet/OX"), "Angle") +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Cylinder_1_1")], + model.selection("EDGE", "PartSet/OX"), + "Angle", +) +Rotation_2 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OX"), + "Angle", +) +Rotation_3 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Revolution_1_1")], + model.selection("EDGE", "PartSet/OX"), + "Angle", +) anAngle = ParamAngle.value() * math.pi / 180.0 aCosAngle = math.cos(anAngle) aSinAngle = math.sin(anAngle) -anAxis = GeomAPI.GeomAPI_Dir(0, anAxis.y() * aCosAngle - anAxis.z() * aSinAngle, anAxis.y() * aSinAngle + anAxis.z() * aCosAngle) -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/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()) +anAxis = GeomAPI.GeomAPI_Dir( + 0, + anAxis.y() * aCosAngle - anAxis.z() * aSinAngle, + anAxis.y() * aSinAngle + anAxis.z() * aCosAngle, +) +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/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/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()) +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) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "PartSet/XOY"), "2.2*H", False +) Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), "H", False) -Partition_1_objects = [model.selection("SOLID", "Rotation_3_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")] +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&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()) +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() +) # Test 4. Split cylinder and compose a solid -Partition_2 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Rotation_1_1"), model.selection("FACE", "PartSet/XOZ")]) -Solid_1_objects = ["(Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_3)(Partition_2_1_1/Modified_Face&PartSet/XOZ/XOZ)(Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_2)", - "Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_1&weak_name_2", - "Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_2", - "Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_3", - "Partition_2_1_2/Modified_Face&Cylinder_1_1/Face_1", - "Partition_2_1_2/Modified_Face&Cylinder_1_1/Face_2", - "Partition_2_1_2/Modified_Face&Cylinder_1_1/Face_3"] -checkCylinderSolid(Part_1_doc, Solid_1_objects, aLoc1, anAxis, 2 * ParamR.value(), ParamH.value()) +Partition_2 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "Rotation_1_1"), model.selection("FACE", "PartSet/XOZ")], +) +Solid_1_objects = [ + "(Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_3)(Partition_2_1_1/Modified_Face&PartSet/XOZ/XOZ)(Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_2)", + "Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_1&weak_name_2", + "Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_2", + "Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_3", + "Partition_2_1_2/Modified_Face&Cylinder_1_1/Face_1", + "Partition_2_1_2/Modified_Face&Cylinder_1_1/Face_2", + "Partition_2_1_2/Modified_Face&Cylinder_1_1/Face_3", +] +checkCylinderSolid( + Part_1_doc, Solid_1_objects, aLoc1, anAxis, 2 * ParamR.value(), ParamH.value() +) # Test 5. Check non-cylinder Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_2 = Sketch_3.addCircle(12.62721775445329, 9.188425784259302, 5) SketchCircle_3 = Sketch_3.addCircle(16.49821418064359, 12.35313535520289, 5) SketchConstraintRadius_2 = Sketch_3.setRadius(SketchCircle_2.results()[1], 5) -SketchConstraintEqual_1 = Sketch_3.setEqual(SketchCircle_2.results()[1], SketchCircle_3.results()[1]) -SketchConstraintDistance_1 = Sketch_3.setDistance(SketchCircle_2.center(), SketchCircle_3.center(), 5, True) +SketchConstraintEqual_1 = Sketch_3.setEqual( + SketchCircle_2.results()[1], SketchCircle_3.results()[1] +) +SketchConstraintDistance_1 = Sketch_3.setDistance( + SketchCircle_2.center(), SketchCircle_3.center(), 5, True +) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 10, 0) -Solid_1_objects = [model.selection("FACE", "Extrusion_2_1_1/From_Face"), model.selection("FACE", "Extrusion_2_1_1/To_Face"), model.selection("FACE", "Extrusion_2_1_2/From_Face"), model.selection("FACE", "Extrusion_2_1_2/Generated_Face&Sketch_3/SketchCircle_3_2&weak_name_2"), model.selection("FACE", "Extrusion_2_1_2/Generated_Face&Sketch_3/SketchCircle_3_2&weak_name_1"), model.selection("FACE", "Extrusion_2_1_2/To_Face"), model.selection("FACE", "Extrusion_2_1_3/From_Face"), model.selection("FACE", "Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_2_2"), model.selection("FACE", "Extrusion_2_1_3/To_Face")] +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 10, 0 +) +Solid_1_objects = [ + model.selection("FACE", "Extrusion_2_1_1/From_Face"), + model.selection("FACE", "Extrusion_2_1_1/To_Face"), + model.selection("FACE", "Extrusion_2_1_2/From_Face"), + model.selection( + "FACE", "Extrusion_2_1_2/Generated_Face&Sketch_3/SketchCircle_3_2&weak_name_2" + ), + model.selection( + "FACE", "Extrusion_2_1_2/Generated_Face&Sketch_3/SketchCircle_3_2&weak_name_1" + ), + model.selection("FACE", "Extrusion_2_1_2/To_Face"), + model.selection("FACE", "Extrusion_2_1_3/From_Face"), + model.selection("FACE", "Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_2_2"), + model.selection("FACE", "Extrusion_2_1_3/To_Face"), +] Solid_1 = model.addSolid(Part_1_doc, Solid_1_objects) checkNonCylinder(Solid_1) # Test 6. Check non-cylindrical shell -Shell_1_objects = [model.selection("FACE", "(Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_3)(Partition_2_1_1/Modified_Face&PartSet/XOZ/XOZ)(Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_2)"), - model.selection("FACE", "Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_1&weak_name_2"), - model.selection("FACE", "Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_2"), - model.selection("FACE", "Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_3"), - model.selection("FACE", "Partition_2_1_2/Modified_Face&Cylinder_1_1/Face_1"), - model.selection("FACE", "Partition_2_1_2/Modified_Face&Cylinder_1_1/Face_2"), - model.selection("FACE", "Partition_2_1_2/Modified_Face&Cylinder_1_1/Face_3")] +Shell_1_objects = [ + model.selection( + "FACE", + "(Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_3)(Partition_2_1_1/Modified_Face&PartSet/XOZ/XOZ)(Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_2)", + ), + model.selection( + "FACE", "Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_1&weak_name_2" + ), + model.selection("FACE", "Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_2"), + model.selection("FACE", "Partition_2_1_1/Modified_Face&Cylinder_1_1/Face_3"), + model.selection("FACE", "Partition_2_1_2/Modified_Face&Cylinder_1_1/Face_1"), + model.selection("FACE", "Partition_2_1_2/Modified_Face&Cylinder_1_1/Face_2"), + model.selection("FACE", "Partition_2_1_2/Modified_Face&Cylinder_1_1/Face_3"), +] Shell_1 = model.addShell(Part_1_doc, Shell_1_objects) checkNonCylindricalShell(Shell_1) -Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_2_2"), model.selection("FACE", "Extrusion_2_1_2/Generated_Face&Sketch_3/SketchCircle_3_2&weak_name_1")]) +Shell_2 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", "Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_2_2" + ), + model.selection( + "FACE", + "Extrusion_2_1_2/Generated_Face&Sketch_3/SketchCircle_3_2&weak_name_1", + ), + ], +) checkNonCylindricalShell(Shell_2) model.end() diff --git a/src/GeomAPI/Test/TestEllipse2d.py b/src/GeomAPI/Test/TestEllipse2d.py index 88308e961..f55170981 100644 --- a/src/GeomAPI/Test/TestEllipse2d.py +++ b/src/GeomAPI/Test/TestEllipse2d.py @@ -21,7 +21,7 @@ import math from GeomAPI import * -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 center = GeomAPI_Pnt2d(10, 0) xAxis = GeomAPI_Dir2d(1, 0) @@ -30,26 +30,26 @@ minorRadius = 5 # Test 1. Default ellipse ellipse = GeomAPI_Ellipse2d(center, xAxis, majorRadius, minorRadius) -assert(ellipse.center().distance(center) < TOLERANCE) -assert(ellipse.firstFocus().distance(GeomAPI_Pnt2d(18.66025404, 0.)) < TOLERANCE) -assert(ellipse.secondFocus().distance(GeomAPI_Pnt2d(1.339745962, 0.)) < TOLERANCE) -assert(ellipse.majorRadius() == majorRadius) -assert(ellipse.minorRadius() == minorRadius) +assert ellipse.center().distance(center) < TOLERANCE +assert ellipse.firstFocus().distance(GeomAPI_Pnt2d(18.66025404, 0.0)) < TOLERANCE +assert ellipse.secondFocus().distance(GeomAPI_Pnt2d(1.339745962, 0.0)) < TOLERANCE +assert ellipse.majorRadius() == majorRadius +assert ellipse.minorRadius() == minorRadius # Test 2. Ellipse with swapped radii ellipse = GeomAPI_Ellipse2d(center, xAxis, minorRadius, majorRadius) -assert(ellipse.center().distance(center) < TOLERANCE) -assert(ellipse.firstFocus().distance(GeomAPI_Pnt2d(10., 8.66025404)) < TOLERANCE) -assert(ellipse.secondFocus().distance(GeomAPI_Pnt2d(10., -8.66025404)) < TOLERANCE) -assert(ellipse.majorRadius() == majorRadius) -assert(ellipse.minorRadius() == minorRadius) +assert ellipse.center().distance(center) < TOLERANCE +assert ellipse.firstFocus().distance(GeomAPI_Pnt2d(10.0, 8.66025404)) < TOLERANCE +assert ellipse.secondFocus().distance(GeomAPI_Pnt2d(10.0, -8.66025404)) < TOLERANCE +assert ellipse.majorRadius() == majorRadius +assert ellipse.minorRadius() == minorRadius # Test 3. Ellipse by 3 points axisPnt = GeomAPI_Pnt2d(center.x() + majorRadius, center.y()) passedPnt = GeomAPI_Pnt2d(center.x(), center.y() + minorRadius) ellipse = GeomAPI_Ellipse2d(center, axisPnt, passedPnt) -assert(ellipse.center().distance(center) < TOLERANCE) -assert(ellipse.firstFocus().distance(GeomAPI_Pnt2d(18.66025404, 0.)) < TOLERANCE) -assert(ellipse.secondFocus().distance(GeomAPI_Pnt2d(1.339745962, 0.)) < TOLERANCE) -assert(ellipse.majorRadius() == majorRadius) -assert(ellipse.minorRadius() == minorRadius) +assert ellipse.center().distance(center) < TOLERANCE +assert ellipse.firstFocus().distance(GeomAPI_Pnt2d(18.66025404, 0.0)) < TOLERANCE +assert ellipse.secondFocus().distance(GeomAPI_Pnt2d(1.339745962, 0.0)) < TOLERANCE +assert ellipse.majorRadius() == majorRadius +assert ellipse.minorRadius() == minorRadius diff --git a/src/GeomAPI/Test/TestLine.py b/src/GeomAPI/Test/TestLine.py index 3693f2be7..57386b870 100644 --- a/src/GeomAPI/Test/TestLine.py +++ b/src/GeomAPI/Test/TestLine.py @@ -21,18 +21,18 @@ import math from GeomAPI import * -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 loc = GeomAPI_Pnt2d(10, 0) axis = GeomAPI_Dir2d(1, 0) # Test 1. GeomAPI_Lin2d line2d = GeomAPI_Lin2d(loc, axis) -assert(line2d.location().distance(loc) < TOLERANCE) -assert(line2d.isRight(GeomAPI_Pnt2d(15, 5))) +assert line2d.location().distance(loc) < TOLERANCE +assert line2d.isRight(GeomAPI_Pnt2d(15, 5)) # Test 2. GeomAPI_Lin ln1 = GeomAPI_Lin(10, 0, 0, 20, 0, 0) ln2 = GeomAPI_Lin(15, -1, 1, 15, 1, 1) -assert(ln1.isCoplanar(ln2) == False) -assert(ln1.contains(None, TOLERANCE) == False) +assert ln1.isCoplanar(ln2) == False +assert ln1.contains(None, TOLERANCE) == False diff --git a/src/GeomAPI/Test/TestPlanarEdge.py b/src/GeomAPI/Test/TestPlanarEdge.py index 60658117c..8938163c4 100644 --- a/src/GeomAPI/Test/TestPlanarEdge.py +++ b/src/GeomAPI/Test/TestPlanarEdge.py @@ -25,11 +25,18 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Interpolation_1_objects = [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/Left][Box_1_1/Bottom]"), 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/Top]")] -Interpolation_1 = model.addInterpolation(Part_1_doc, Interpolation_1_objects, False, False) +Interpolation_1_objects = [ + 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/Left][Box_1_1/Bottom]"), + 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/Top]"), +] +Interpolation_1 = model.addInterpolation( + Part_1_doc, Interpolation_1_objects, False, False +) aShape = Interpolation_1.result().resultSubShapePair()[0].shape() -assert(aShape.isEdge()) -assert(aShape.isPlanar() == False) +assert aShape.isEdge() +assert aShape.isPlanar() == False model.end() diff --git a/src/GeomAPI/Test/TestPolygon.py b/src/GeomAPI/Test/TestPolygon.py index 17204447a..c251a08f7 100644 --- a/src/GeomAPI/Test/TestPolygon.py +++ b/src/GeomAPI/Test/TestPolygon.py @@ -24,38 +24,42 @@ from salome.shaper import model import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + def assertRectangle(theWire): - assert(theWire is not None) + assert theWire is not None aCorners = [GeomAPI.GeomAPI_Pnt(0, 0, 0)] - assert(theWire.isRectangle(aCorners)) + assert theWire.isRectangle(aCorners) + def checkRectangleFace(theDocument, theFaceName): aFace = model.addFace(theDocument, [model.selection("FACE", theFaceName)]) aShape = aFace.result().resultSubShapePair()[0].shape() - assert(aShape.isFace()) + assert aShape.isFace() aSubs = aShape.subShapes(GeomAPI.GeomAPI_Shape.WIRE) - assert(aSubs.size() == 1) + assert aSubs.size() == 1 assertRectangle(aSubs[0].wire()) theDocument.removeFeature(aFace.feature()) + def checkRectangleWire(theDocument, theEdgeNames): aSelection = [] for name in theEdgeNames: aSelection.append(model.selection("EDGE", name)) aWire = model.addWire(theDocument, aSelection) aShape = aWire.result().resultSubShapePair()[0].shape() - assert(aShape.isWire()) - assert(aShape.wire().isClosed()) + assert aShape.isWire() + assert aShape.wire().isClosed() assertRectangle(aShape.wire()) theDocument.removeFeature(aWire.feature()) def assertPolygon(theWire): - assert(theWire is not None) + assert theWire is not None aCorners = [GeomAPI.GeomAPI_Pnt(0, 0, 0)] - assert(theWire.isPolygon(aCorners)) + assert theWire.isPolygon(aCorners) + def checkPolygonWire(theDocument, theEdgeNames): aSelection = [] @@ -63,22 +67,22 @@ def checkPolygonWire(theDocument, theEdgeNames): aSelection.append(model.selection("EDGE", name)) aWire = model.addWire(theDocument, aSelection) aShape = aWire.result().resultSubShapePair()[0].shape() - assert(aShape.isWire()) + assert aShape.isWire() assertPolygon(aShape.wire()) theDocument.removeFeature(aWire.feature()) + def checkPolyline(theDocument, theVertexNames): aSelection = [] for name in theVertexNames: aSelection.append(model.selection("VERTEX", name)) aWire = model.addPolyline3D(Part_1_doc, aSelection, False) aShape = aWire.result().resultSubShapePair()[0].shape() - assert(aShape.isWire()) + assert aShape.isWire() assertPolygon(aShape.wire()) theDocument.removeFeature(aWire.feature()) - model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) @@ -88,15 +92,33 @@ 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() diff --git a/src/GeomAPI/Test/TestSphere.py b/src/GeomAPI/Test/TestSphere.py index 4d8ab3bda..729878d21 100644 --- a/src/GeomAPI/Test/TestSphere.py +++ b/src/GeomAPI/Test/TestSphere.py @@ -24,45 +24,50 @@ from salome.shaper import model import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + def checkArc(theDocument, theEdgeName, theCenter, theRadius): # check edge (arc of circle) anEdge = model.addEdge(theDocument, [model.selection("EDGE", theEdgeName)]) aShape = anEdge.result().resultSubShapePair()[0].shape() - assert(aShape.isEdge()) + assert aShape.isEdge() anArcEdge = aShape.edge() - assert(anArcEdge.isArc()) + assert anArcEdge.isArc() aCircle = anArcEdge.circle() - assert(aCircle.center().distance(theCenter) < TOLERANCE) - assert(math.fabs(aCircle.radius() - theRadius) < TOLERANCE) + assert aCircle.center().distance(theCenter) < TOLERANCE + assert math.fabs(aCircle.radius() - theRadius) < TOLERANCE theDocument.removeFeature(anEdge.feature()) + def assertSphere(theSphere, theCenter, theRadius): - assert(theSphere is not None) - assert(theSphere.center().distance(theCenter) < TOLERANCE) - assert(math.fabs(theSphere.radius() - theRadius) < TOLERANCE) + assert theSphere is not None + assert theSphere.center().distance(theCenter) < TOLERANCE + assert math.fabs(theSphere.radius() - theRadius) < TOLERANCE + def checkSphereFace(theDocument, theFaceName, theCenter, theRadius): # check spherical face aFace = model.addFace(theDocument, [model.selection("FACE", theFaceName)]) aShape = aFace.result().resultSubShapePair()[0].shape() - assert(aShape.isFace()) + assert aShape.isFace() assertSphere(aShape.face().getSphere(), theCenter, theRadius) theDocument.removeFeature(aFace.feature()) + def checkSphereShell(theDocument, theFaceName, theCenter, theRadius): # check spherical shell aShell = model.addShell(theDocument, [model.selection("FACE", theFaceName)]) aShape = aShell.result().resultSubShapePair()[0].shape() - assert(aShape.isShell()) + assert aShape.isShell() assertSphere(aShape.shell().getSphere(), theCenter, theRadius) theDocument.removeFeature(aShell.feature()) + def checkSphereAll(theDocument, theFeature, theFaceName, theCenter, theRadius): # check solid aShape = theFeature.result().resultSubShapePair()[0].shape() - assert(aShape.isSolid()) + assert aShape.isSolid() assertSphere(aShape.solid().getSphere(), theCenter, theRadius) checkSphereShell(theDocument, theFaceName, theCenter, theRadius) @@ -71,10 +76,11 @@ def checkSphereAll(theDocument, theFeature, theFaceName, theCenter, theRadius): anArcName = "[" + theFaceName + "][weak_name_3]" checkArc(theDocument, anArcName, theCenter, theRadius) + def checkNonSphereShell(theFeature): aShape = theFeature.result().resultSubShapePair()[0].shape() - assert(aShape.isShell()) - assert(aShape.shell().getSphere() is None) + assert aShape.isShell() + assert aShape.shell().getSphere() is None model.begin() @@ -88,62 +94,182 @@ ParamAperture = model.addParameter(Part_1_doc, "Aperture", "360") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchArc_1 = Sketch_1.addArc(0, 0, 0, -50, 0, 50, False) SketchLine_1 = Sketch_1.addLine(0, 50, 0, -50) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_1.endPoint() +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_1.center()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_1.result()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_1.center() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_1.result() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) 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_2r-SketchLine_1f")], model.selection("EDGE", "Sketch_1/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&Sketch_1/SketchArc_1_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") +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/MF:Translated&Sketch_1/SketchArc_1_2", 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") +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/MF:Rotated&Sketch_1/SketchArc_1_2", 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/MF:Rotated&Sketch_1/SketchArc_1_2", 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/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()) +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(), +) # Test 5. Sheck non-spherical shell -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Rotation_1_1/MF:Rotated&Revolution_1_1/To_Face"), model.selection("FACE", "Rotation_1_1/MF:Rotated&Revolution_1_1/From_Face")]) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection("FACE", "Rotation_1_1/MF:Rotated&Revolution_1_1/To_Face"), + model.selection("FACE", "Rotation_1_1/MF:Rotated&Revolution_1_1/From_Face"), + ], +) checkNonSphereShell(Shell_1) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) -SketchLine_2 = Sketch_2.addLine(18.12152721893265, 20.53645178481853, 73.15172297255518, 20.53645178481853) +SketchLine_2 = Sketch_2.addLine( + 18.12152721893265, 20.53645178481853, 73.15172297255518, 20.53645178481853 +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_2.result()) -SketchArc_2 = Sketch_2.addArc(60.28852631862447, 20.53645178481853, 73.15172297255518, 20.53645178481853, 58.16589238004093, 33.22330534748203, False) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_2.result(), SketchArc_2.center()) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchArc_2.startPoint()) -SketchArc_3 = Sketch_2.addArc(40.15343392262997, 20.53645178481853, 18.12152721893265, 20.53645178481853, 58.16589238004093, 33.22330534748203, True) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_2.result(), SketchArc_3.center()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchArc_3.startPoint()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchArc_3.endPoint()) +SketchArc_2 = Sketch_2.addArc( + 60.28852631862447, + 20.53645178481853, + 73.15172297255518, + 20.53645178481853, + 58.16589238004093, + 33.22330534748203, + False, +) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_2.result(), SketchArc_2.center() +) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchArc_2.startPoint() +) +SketchArc_3 = Sketch_2.addArc( + 40.15343392262997, + 20.53645178481853, + 18.12152721893265, + 20.53645178481853, + 58.16589238004093, + 33.22330534748203, + True, +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_2.result(), SketchArc_3.center() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_2.startPoint(), SketchArc_3.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchArc_2.endPoint(), SketchArc_3.endPoint() +) model.do() -Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_2r-SketchArc_2_2f-SketchArc_3_2f")], model.selection("EDGE", "Sketch_2/SketchLine_2"), 360, 0) -Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Revolution_2_1/Generated_Face&Sketch_2/SketchArc_3_2"), model.selection("FACE", "Revolution_2_1/Generated_Face&Sketch_2/SketchArc_2_2")]) +Revolution_2 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_2r-SketchArc_2_2f-SketchArc_3_2f" + ) + ], + model.selection("EDGE", "Sketch_2/SketchLine_2"), + 360, + 0, +) +Shell_2 = model.addShell( + Part_1_doc, + [ + model.selection("FACE", "Revolution_2_1/Generated_Face&Sketch_2/SketchArc_3_2"), + model.selection("FACE", "Revolution_2_1/Generated_Face&Sketch_2/SketchArc_2_2"), + ], +) checkNonSphereShell(Shell_2) model.end() diff --git a/src/GeomAPI/Test/TestTorus.py b/src/GeomAPI/Test/TestTorus.py index 7c807af6d..7dd37bb7c 100644 --- a/src/GeomAPI/Test/TestTorus.py +++ b/src/GeomAPI/Test/TestTorus.py @@ -24,46 +24,90 @@ from salome.shaper import model import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + def assertTorus(theTorus, theCenter, theAxis, theMajorRadius, theMinorRadius): - assert(theTorus is not None) + assert theTorus is not None aCenter = theTorus.center() aDir = theTorus.direction() - assert(aCenter.distance(theCenter) < TOLERANCE), "({}, {}, {}) != expected ({}, {}, {})".format(aCenter.x(), aCenter.y(), aCenter.z(), theCenter.x(), theCenter.y(), theCenter.z()) - assert(aDir.isParallel(theAxis, TOLERANCE)), "dir({}, {}, {}) is not parallel to dir({}, {}, {})".format(aDir.x(), aDir.y(), aDir.z(), theAxis.x(), theAxis.y(), theAxis.z()) - assert(math.fabs(theTorus.majorRadius() - theMajorRadius) < TOLERANCE), "Major radius {} != {}".format(theTorus.majorRadius(), theMajorRadius) - assert(math.fabs(theTorus.minorRadius() - theMinorRadius) < TOLERANCE), "Minor radius {} != {}".format(theTorus.minorRadius(), theMinorRadius) - -def checkTorusFace(theDocument, theFaceName, theCenter, theAxis, theMajorRadius, theMinorRadius): + assert ( + aCenter.distance(theCenter) < TOLERANCE + ), "({}, {}, {}) != expected ({}, {}, {})".format( + aCenter.x(), + aCenter.y(), + aCenter.z(), + theCenter.x(), + theCenter.y(), + theCenter.z(), + ) + assert aDir.isParallel( + theAxis, TOLERANCE + ), "dir({}, {}, {}) is not parallel to dir({}, {}, {})".format( + aDir.x(), aDir.y(), aDir.z(), theAxis.x(), theAxis.y(), theAxis.z() + ) + assert ( + math.fabs(theTorus.majorRadius() - theMajorRadius) < TOLERANCE + ), "Major radius {} != {}".format(theTorus.majorRadius(), theMajorRadius) + assert ( + math.fabs(theTorus.minorRadius() - theMinorRadius) < TOLERANCE + ), "Minor radius {} != {}".format(theTorus.minorRadius(), theMinorRadius) + + +def checkTorusFace( + theDocument, theFaceName, theCenter, theAxis, theMajorRadius, theMinorRadius +): aFace = model.addFace(theDocument, [model.selection("FACE", theFaceName)]) aShape = aFace.result().resultSubShapePair()[0].shape() - assert(aShape.isFace()) - assertTorus(aShape.face().getTorus(), theCenter, theAxis, theMajorRadius, theMinorRadius) + assert aShape.isFace() + assertTorus( + aShape.face().getTorus(), theCenter, theAxis, theMajorRadius, theMinorRadius + ) theDocument.removeFeature(aFace.feature()) -def checkTorusShell(theDocument, theFaceNames, theCenter, theAxis, theMajorRadius, theMinorRadius): + +def checkTorusShell( + theDocument, theFaceNames, theCenter, theAxis, theMajorRadius, theMinorRadius +): aSelection = [] for name in theFaceNames: aSelection.append(model.selection("FACE", name)) aShell = model.addShell(theDocument, aSelection) aShape = aShell.result().resultSubShapePair()[0].shape() - assert(aShape.isShell()) - assertTorus(aShape.shell().getTorus(), theCenter, theAxis, theMajorRadius, theMinorRadius) + assert aShape.isShell() + assertTorus( + aShape.shell().getTorus(), theCenter, theAxis, theMajorRadius, theMinorRadius + ) theDocument.removeFeature(aShell.feature()) -def checkTorusAll(theDocument, theFeature, theFaceName, theCenter, theAxis, theMajorRadius, theMinorRadius): + +def checkTorusAll( + theDocument, + theFeature, + theFaceName, + theCenter, + theAxis, + theMajorRadius, + theMinorRadius, +): aShape = theFeature.result().resultSubShapePair()[0].shape() - assert(aShape.isSolid()) - assertTorus(aShape.solid().getTorus(), theCenter, theAxis, theMajorRadius, theMinorRadius) + assert aShape.isSolid() + assertTorus( + aShape.solid().getTorus(), theCenter, theAxis, theMajorRadius, theMinorRadius + ) + + checkTorusShell( + theDocument, [theFaceName], theCenter, theAxis, theMajorRadius, theMinorRadius + ) + checkTorusFace( + theDocument, theFaceName, theCenter, theAxis, theMajorRadius, theMinorRadius + ) - checkTorusShell(theDocument, [theFaceName], theCenter, theAxis, theMajorRadius, theMinorRadius) - checkTorusFace(theDocument, theFaceName, theCenter, theAxis, theMajorRadius, theMinorRadius) def checkNonTorusShell(theFeature): aShape = theFeature.result().resultSubShapePair()[0].shape() - assert(aShape.isShell()) - assert(aShape.shell().getTorus() is None) + assert aShape.isShell() + assert aShape.shell().getTorus() is None model.begin() @@ -73,38 +117,99 @@ Part_1_doc = Part_1.document() ParamRMax = model.addParameter(Part_1_doc, "RMax", "15") ParamRMin = model.addParameter(Part_1_doc, "RMin", "5") ParamAngle = model.addParameter(Part_1_doc, "Angle", "30") -Torus_1 = model.addTorus(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "RMax", "RMin") +Torus_1 = model.addTorus( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "RMax", + "RMin", +) model.do() # Test 1. Check torus aCenter = GeomAPI.GeomAPI_Pnt(0, 0, 0) anAxis = GeomAPI.GeomAPI_Dir(0, 0, 1) -checkTorusAll(Part_1_doc, Torus_1, "Torus_1_1/Face_1", aCenter, anAxis, ParamRMax.value(), ParamRMin.value()) +checkTorusAll( + Part_1_doc, + Torus_1, + "Torus_1_1/Face_1", + aCenter, + anAxis, + ParamRMax.value(), + ParamRMin.value(), +) # Test 2. Rotate torus -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Torus_1_1")], model.selection("EDGE", "PartSet/OX"), "Angle") +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Torus_1_1")], + model.selection("EDGE", "PartSet/OX"), + "Angle", +) anAngle = ParamAngle.value() * math.pi / 180.0 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/MF:Rotated&Torus_1_1/Face_1", aCenter, anAxis, ParamRMax.value(), ParamRMin.value()) +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/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_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&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()) +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() +) # Test 4. Check non-torus shell -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Partition_1_1_1/Modified_Face&Torus_1_1/Face_1"), model.selection("FACE", "Partition_1_1_1/Modified_Face&PartSet/YOZ/YOZ")]) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection("FACE", "Partition_1_1_1/Modified_Face&Torus_1_1/Face_1"), + model.selection("FACE", "Partition_1_1_1/Modified_Face&PartSet/YOZ/YOZ"), + ], +) checkNonTorusShell(Shell_1) -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("FACE", "PartSet/XOY"), True) -Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "_weak_name_1_Symmetry_1_1_1"), model.selection("FACE", "_weak_name_1_Symmetry_1_1_2")]) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("SHELL", "Shell_1_1")], + model.selection("FACE", "PartSet/XOY"), + True, +) +Shell_2 = model.addShell( + Part_1_doc, + [ + model.selection("FACE", "_weak_name_1_Symmetry_1_1_1"), + model.selection("FACE", "_weak_name_1_Symmetry_1_1_2"), + ], +) checkNonTorusShell(Shell_2) model.end() diff --git a/src/GeomDataAPI/Test/TestConstants.py b/src/GeomDataAPI/Test/TestConstants.py index 31c0dee80..f295e956f 100644 --- a/src/GeomDataAPI/Test/TestConstants.py +++ b/src/GeomDataAPI/Test/TestConstants.py @@ -17,10 +17,11 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#=============================================================================== +# =============================================================================== # Test GeomDataAPI static methods -#=============================================================================== +# =============================================================================== from GeomDataAPI import * -assert (GeomDataAPI_Point.typeId() == "Point") -assert (GeomDataAPI_Dir.typeId() == "Dir") -assert (GeomDataAPI_Point2D.typeId() == "Point2D") \ No newline at end of file + +assert GeomDataAPI_Point.typeId() == "Point" +assert GeomDataAPI_Dir.typeId() == "Dir" +assert GeomDataAPI_Point2D.typeId() == "Point2D" diff --git a/src/Locale/Test/TestUTF8.py b/src/Locale/Test/TestUTF8.py index 518b06603..e57821d8d 100644 --- a/src/Locale/Test/TestUTF8.py +++ b/src/Locale/Test/TestUTF8.py @@ -37,13 +37,20 @@ Sphere_1.setName("sphère") Sphere_1.result().setName("sphère") ### Create Shell -Shell_1_objects = [model.selection("FACE", "boîte/Left"), - model.selection("FACE", "boîte/Back"), - model.selection("FACE", "boîte/Bottom")] +Shell_1_objects = [ + model.selection("FACE", "boîte/Left"), + model.selection("FACE", "boîte/Back"), + model.selection("FACE", "boîte/Bottom"), +] Shell_1 = model.addShell(Part_1_doc, Shell_1_objects) ### Create Cut -Cut_1 = model.addCut(Part_1_doc, [model.selection("SHELL", "boîte")], [model.selection("COMPOUND", "all-in-sphère")], keepSubResults = True) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SHELL", "boîte")], + [model.selection("COMPOUND", "all-in-sphère")], + keepSubResults=True, +) Cut_1.result().subResult(0).setName("Cut_1_1_1") Cut_1.result().subResult(1).setName("Cut_1_1_2") Cut_1.result().subResult(2).setName("Cut_1_1_3") @@ -61,4 +68,4 @@ model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [18]) model.testResultsVolumes(Cut_1, [0.0]) model.testResultsAreas(Cut_1, [64.38055098]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test1064.py b/src/ModelAPI/Test/Test1064.py index 903c95906..c18391885 100644 --- a/src/ModelAPI/Test/Test1064.py +++ b/src/ModelAPI/Test/Test1064.py @@ -22,9 +22,9 @@ Unit test for testing the Part sub-shapes naming, described in the issue 1064 """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -34,9 +34,9 @@ __updated__ = "2015-10-16" aSession = ModelAPI_Session.get() -#========================================================================= +# ========================================================================= # Create a sketch triangle in PartSet -#========================================================================= +# ========================================================================= aPartSet = aSession.moduleDocument() aSession.startOperation() aSketchFeature = featureToCompositeFeature(aPartSet.addFeature("Sketch")) @@ -58,18 +58,18 @@ geomDataAPI_Point2D(aLine3.attribute("StartPoint")).setValue(0, 200) geomDataAPI_Point2D(aLine3.attribute("EndPoint")).setValue(0, 0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create a part -#========================================================================= +# ========================================================================= aSession.startOperation() aPartFeature = aPartSet.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +assert len(aPartFeature.results()) == 1 aPart = aSession.activeDocument() -#========================================================================= +# ========================================================================= # Make extrusion on triangle -#========================================================================= +# ========================================================================= aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult()) aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") @@ -80,9 +80,9 @@ anExtrusionFt.real("from_size").setValue(0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make a plane in PartSet on lateral face of the Extrusion -#========================================================================= +# ========================================================================= aSession.startOperation("Make Plane") aSession.setActiveDocument(aPartSet) aPlane = aPartSet.addFeature("Plane") @@ -93,33 +93,34 @@ aPlane.real("distance").setValue(0.001) aPlane.boolean("reverse").setValue(False) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Update the sketch edges in order to update the plane on the lateral face automatically -#========================================================================= +# ========================================================================= aSession.startOperation("UpdateLine") geomDataAPI_Point2D(aLine1.attribute("EndPoint")).setValue(400, 0) geomDataAPI_Point2D(aLine2.attribute("StartPoint")).setValue(400, 0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Check that the plane is also updated -#========================================================================= +# ========================================================================= -assert(len(aPlane.results()) > 0) +assert len(aPlane.results()) > 0 aShape = aPlane.firstResult().shape() aFace = GeomAPI_Face(aShape) -assert(aFace.isPlanar()) +assert aFace.isPlanar() aPln = aFace.getPlane() # Must be 0.4472135955, 0.894427191, 0.0 -assert(aPln.direction().x() > 0.44) -assert(aPln.direction().x() < 0.45) -assert(aPln.direction().y() > 0.89) -assert(aPln.direction().y() < 0.90) -assert(aPln.direction().z() == 0.) +assert aPln.direction().x() > 0.44 +assert aPln.direction().x() < 0.45 +assert aPln.direction().y() > 0.89 +assert aPln.direction().y() < 0.90 +assert aPln.direction().z() == 0.0 -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test1512.py b/src/ModelAPI/Test/Test1512.py index 6fabe5d2a..c29dcef9f 100644 --- a/src/ModelAPI/Test/Test1512.py +++ b/src/ModelAPI/Test/Test1512.py @@ -22,9 +22,9 @@ Unit test for testing the correct selection of feature by the faces after the BOPs applied """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -35,18 +35,18 @@ __updated__ = "2016-05-31" aSession = ModelAPI_Session.get() aPartSet = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Create a part -#========================================================================= +# ========================================================================= aSession.startOperation() aPartFeature = aPartSet.addFeature("Part") aSession.finishOperation() -assert (len(aPartFeature.results()) == 1) +assert len(aPartFeature.results()) == 1 aPart = aSession.activeDocument() -#========================================================================= +# ========================================================================= # Create a sketch rectangle in PartSet -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) aXOYPlane = objectToResult(aPartSet.objectByName("Construction", "XOY")) @@ -66,9 +66,9 @@ geomDataAPI_Point2D(aLine4.attribute("StartPoint")).setValue(0, 100) geomDataAPI_Point2D(aLine4.attribute("EndPoint")).setValue(0, 0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on rectangle -#========================================================================= +# ========================================================================= aSession.startOperation() aBox = aPart.addFeature("Extrusion") aBox.selectionList("base").append(aSketchFeature.firstResult(), None) @@ -77,20 +77,20 @@ aBox.real("to_size").setValue(50) aBox.real("from_size").setValue(0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create a cylindrical sketch for a big hole -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchFeature2 = featureToCompositeFeature(aPart.addFeature("Sketch")) -aSketchFeature2.selection("External").setValue(aXOYPlane, None); +aSketchFeature2.selection("External").setValue(aXOYPlane, None) aCirc1 = aSketchFeature2.addFeature("SketchCircle") geomDataAPI_Point2D(aCirc1.attribute("circle_center")).setValue(100, 50) aCirc1.real("circle_radius").setValue(40) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on a big circle -#========================================================================= +# ========================================================================= aSession.startOperation() aHoleExt = aPart.addFeature("Extrusion") aHoleExt.selectionList("base").append(aSketchFeature2.firstResult(), None) @@ -99,29 +99,29 @@ aHoleExt.real("to_size").setValue(60) aHoleExt.real("from_size").setValue(0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Do cut a hole from a box -#========================================================================= +# ========================================================================= aSession.startOperation() aCut1 = aPart.addFeature("Cut") aCut1.selectionList("main_objects").append(aBox.firstResult(), None) aCut1.selectionList("tool_objects").append(aHoleExt.firstResult(), None) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create a cylindrical sketch for a small tower -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchFeature3 = featureToCompositeFeature(aPart.addFeature("Sketch")) -aSketchFeature3.selection("External").setValue(aXOYPlane, None); +aSketchFeature3.selection("External").setValue(aXOYPlane, None) aCirc2 = aSketchFeature3.addFeature("SketchCircle") geomDataAPI_Point2D(aCirc2.attribute("circle_center")).setValue(20, 20) aCirc2.real("circle_radius").setValue(10) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make extrusion on a small circle -#========================================================================= +# ========================================================================= aSession.startOperation() aTower = aPart.addFeature("Extrusion") aTower.selectionList("base").append(aSketchFeature3.firstResult(), None) @@ -130,9 +130,9 @@ aTower.real("to_size").setValue(100) aTower.real("from_size").setValue(0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Do fuse with a tower. Tower must be an argument (not tool) to add the problem to the faces owners detection. -#========================================================================= +# ========================================================================= aSession.startOperation() aFuse = aPart.addFeature("Fuse") aFuse.string("creation_method").setValue("advanced") @@ -141,17 +141,19 @@ aFuse.selectionList("tool_objects").append(aCut1.firstResult(), None) aFuse.boolean("remove_intersection_edges").setValue(False) aSession.finishOperation() -#========================================================================= + +# ========================================================================= # Create a group feature to use the selection attribute for selection of faces by the name. -#========================================================================= +# ========================================================================= def check_owner(selection, topology_type, feature): - aSession.startOperation() - aGroup = aPart.addFeature("Group") - aGroup.selectionList("group_list").append(selection, topology_type) - aFace = aGroup.selectionList("group_list").value(0).value() - aTestFeature = aPart.producedByFeature(aFuse.firstResult(), aFace) - assert(aTestFeature.name() == feature.name()) - aSession.abortOperation() + aSession.startOperation() + aGroup = aPart.addFeature("Group") + aGroup.selectionList("group_list").append(selection, topology_type) + aFace = aGroup.selectionList("group_list").value(0).value() + aTestFeature = aPart.producedByFeature(aFuse.firstResult(), aFace) + assert aTestFeature.name() == feature.name() + aSession.abortOperation() + # check faces check_owner("Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4", "face", aBox) @@ -159,15 +161,24 @@ 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&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_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) +assert aFuse.firstResult().shape().isConnectedTopology() == False -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test1562.py b/src/ModelAPI/Test/Test1562.py index 376e52814..6b77e12e9 100644 --- a/src/ModelAPI/Test/Test1562.py +++ b/src/ModelAPI/Test/Test1562.py @@ -25,42 +25,124 @@ 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()) +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()) +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) +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) +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_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) @@ -70,12 +152,13 @@ model.do() # check the result validity from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(ExtrusionCut_2.feature())) +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()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test1757.py b/src/ModelAPI/Test/Test1757.py index c28eb9b71..f6af2c6a6 100644 --- a/src/ModelAPI/Test/Test1757.py +++ b/src/ModelAPI/Test/Test1757.py @@ -28,46 +28,100 @@ from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialize a part -#========================================================================= +# ========================================================================= model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -#========================================================================= +# ========================================================================= # Create a base box: rectangular sketch and extrusion -#========================================================================= +# ========================================================================= Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) -SketchLine_1 = Sketch_1.addLine(199.69219283509, 125.016366179415, -144.040270241704, 125.016366179415) -SketchLine_2 = Sketch_1.addLine(-144.040270241704, 125.016366179415, -144.040270241704, -111.365692746051) -SketchLine_3 = Sketch_1.addLine(-144.040270241704, -111.365692746051, 199.69219283509, -111.365692746051) -SketchLine_4 = Sketch_1.addLine(199.69219283509, -111.365692746051, 199.69219283509, 125.016366179415) -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()) +SketchLine_1 = Sketch_1.addLine( + 199.69219283509, 125.016366179415, -144.040270241704, 125.016366179415 +) +SketchLine_2 = Sketch_1.addLine( + -144.040270241704, 125.016366179415, -144.040270241704, -111.365692746051 +) +SketchLine_3 = Sketch_1.addLine( + -144.040270241704, -111.365692746051, 199.69219283509, -111.365692746051 +) +SketchLine_4 = Sketch_1.addLine( + 199.69219283509, -111.365692746051, 199.69219283509, 125.016366179415 +) +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(), 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"), 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) -SketchLine_8 = Sketch_2.addLine(-47.794137712106, -51.567231082425, -47.794137712106, -188.943752610533) -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()) +# ========================================================================= +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 +) +SketchLine_8 = Sketch_2.addLine( + -47.794137712106, -51.567231082425, -47.794137712106, -188.943752610533 +) +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()) @@ -75,32 +129,75 @@ SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result()) ExtrusionCut_1.setNestedSketch(Sketch_2) 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&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)")) +# ========================================================================= +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) -#========================================================================= +# ========================================================================= # Move a history line before this hole creation to modify groove -#========================================================================= +# ========================================================================= 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&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) -SketchLine_12 = Sketch_4.addLine(-176.701443076057, -84.473709256573, -176.701443076057, -151.212050129331) -SketchConstraintCoincidence_9 = Sketch_4.setCoincident(SketchLine_12.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_10 = Sketch_4.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_11 = Sketch_4.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_12 = Sketch_4.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +# ========================================================================= +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 +) +SketchLine_12 = Sketch_4.addLine( + -176.701443076057, -84.473709256573, -176.701443076057, -151.212050129331 +) +SketchConstraintCoincidence_9 = Sketch_4.setCoincident( + SketchLine_12.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_4.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_4.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_4.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchConstraintHorizontal_5 = Sketch_4.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_5 = Sketch_4.setVertical(SketchLine_10.result()) SketchConstraintHorizontal_6 = Sketch_4.setHorizontal(SketchLine_11.result()) @@ -110,20 +207,23 @@ ExtrusionCut_3.setNestedSketch(Sketch_4) model.do() -#========================================================================= +# ========================================================================= # Move a history line just to the end to recreate the cylindrical hole -#========================================================================= +# ========================================================================= Part_1.document().setCurrentFeature(ExtrusionCut_2.feature(), True) model.end() -#========================================================================= +# ========================================================================= # Check that the circle-sketch and the cylindrical-hole are correctly updated -#========================================================================= +# ========================================================================= 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/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 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/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()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test19019_1.py b/src/ModelAPI/Test/Test19019_1.py index ee87843aa..c817f688b 100644 --- a/src/ModelAPI/Test/Test19019_1.py +++ b/src/ModelAPI/Test/Test19019_1.py @@ -24,21 +24,45 @@ 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(-53.81455412066646, -50.08190818345371, 33.23044991620489, -41.72362634869452) -SketchArc_1 = Sketch_1.addArc(-10.71003639844217, -41.54978593924657, 33.23044991620489, -41.72362634869452, -53.81455412066646, -50.08190818345371, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.endPoint()) +SketchLine_1 = Sketch_1.addLine( + -53.81455412066646, -50.08190818345371, 33.23044991620489, -41.72362634869452 +) +SketchArc_1 = Sketch_1.addArc( + -10.71003639844217, + -41.54978593924657, + 33.23044991620489, + -41.72362634869452, + -53.81455412066646, + -50.08190818345371, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_1.endPoint() +) model.do() -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")], False) -Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False) -Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")]) -Wire_3 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")], False) +Wire_1 = model.addWire( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")], False +) +Wire_2 = model.addWire( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False +) +Face_1 = model.addFace( + Part_1_doc, + [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")], +) +Wire_3 = model.addWire( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")], False +) model.end() from ModelAPI import * + factory = ModelAPI_Session.get().validators() -assert(factory.validate(Wire_3.feature())) +assert factory.validate(Wire_3.feature()) from GeomAPI import * @@ -50,4 +74,4 @@ model.testNbSubShapes(Part_1, GeomAPI_Shape.EDGE, [3]) model.testNbSubShapes(Part_1, GeomAPI_Shape.VERTEX, [6]) model.testResultsAreas(Part_1, [3416.5596]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test19019_2.py b/src/ModelAPI/Test/Test19019_2.py index 00a74239a..bb2e9e2a3 100644 --- a/src/ModelAPI/Test/Test19019_2.py +++ b/src/ModelAPI/Test/Test19019_2.py @@ -47,132 +47,342 @@ SketchCircle_1 = Sketch_1.addCircle(0, 0, 50) SketchCircle_1.setName("SketchCircle_3") SketchCircle_1.result().setName("SketchCircle_3") SketchCircle_1.results()[1].setName("SketchCircle_3_2") -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "R") SketchLine_1 = Sketch_1.addLine(0, 50, 0, 50.5) SketchLine_1.setName("SketchLine_12") SketchLine_1.result().setName("SketchLine_12") -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchLine_2 = Sketch_1.addLine(0, 50.5, 0, 51) SketchLine_2.setName("SketchLine_13") SketchLine_2.result().setName("SketchLine_13") -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_2.result()) SketchCircle_2 = Sketch_1.addCircle(0, 0, 51) SketchCircle_2.setName("SketchCircle_4") SketchCircle_2.result().setName("SketchCircle_4") SketchCircle_2.results()[1].setName("SketchCircle_4_2") SketchConstraintRadius_2 = Sketch_1.setRadius(SketchCircle_2.results()[1], "R+2*r") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_2.results()[1]) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchCircle_2.results()[1] +) SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "OY"), False) SketchProjection_2.setName("SketchProjection_3") SketchProjection_2.result().setName("SketchProjection_3") SketchLine_3 = SketchProjection_2.createdFeature() SketchLine_3.setName("SketchLine_14") SketchLine_3.result().setName("SketchLine_14") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchAPI_Line(SketchLine_3).startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_1.result() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchCircle_2.center(), SketchAPI_Line(SketchLine_3).startPoint() +) SketchCircle_3 = Sketch_1.addCircle(0, 0, 50.5) SketchCircle_3.setName("SketchCircle_5") SketchCircle_3.result().setName("SketchCircle_5") SketchCircle_3.results()[1].setName("SketchCircle_5_2") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_3.results()[1]) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchCircle_3.center(), SketchAPI_Line(SketchLine_3).startPoint()) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_2.result(), SketchLine_1.result()], SketchCircle_1.center(), "alpha", 2, True) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_3.results()[1] +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchCircle_3.center(), SketchAPI_Line(SketchLine_3).startPoint() +) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchLine_2.result(), SketchLine_1.result()], + SketchCircle_1.center(), + "alpha", + 2, + True, +) [SketchLine_4, SketchLine_5] = SketchMultiRotation_1.rotated() SketchLine_5.setName("SketchLine_18") SketchLine_5.result().setName("SketchLine_18") SketchLine_4.setName("SketchLine_15") SketchLine_4.result().setName("SketchLine_15") -SketchMultiRotation_2 = Sketch_1.addRotation([SketchLine_2.result(), SketchLine_1.result()], SketchCircle_2.center(), "alpha+alpha_g1", 2, True) +SketchMultiRotation_2 = Sketch_1.addRotation( + [SketchLine_2.result(), SketchLine_1.result()], + SketchCircle_2.center(), + "alpha+alpha_g1", + 2, + True, +) [SketchLine_6, SketchLine_7] = SketchMultiRotation_2.rotated() SketchLine_7.setName("SketchLine_17") SketchLine_7.result().setName("SketchLine_17") SketchLine_6.setName("SketchLine_16") SketchLine_6.result().setName("SketchLine_16") -SketchMultiRotation_3 = Sketch_1.addRotation([SketchLine_1.result(), SketchLine_2.result()], SketchCircle_3.center(), "alpha+alpha_g1+alpha_g2", 2, True) +SketchMultiRotation_3 = Sketch_1.addRotation( + [SketchLine_1.result(), SketchLine_2.result()], + SketchCircle_3.center(), + "alpha+alpha_g1+alpha_g2", + 2, + True, +) [SketchLine_8, SketchLine_9] = SketchMultiRotation_3.rotated() SketchLine_9.setName("SketchLine_30") SketchLine_9.result().setName("SketchLine_30") SketchLine_8.setName("SketchLine_20") SketchLine_8.result().setName("SketchLine_20") -SketchMultiRotation_4 = Sketch_1.addRotation([SketchLine_2.result(), SketchLine_1.result()], SketchCircle_2.center(), "alpha", 2, True, True) +SketchMultiRotation_4 = Sketch_1.addRotation( + [SketchLine_2.result(), SketchLine_1.result()], + SketchCircle_2.center(), + "alpha", + 2, + True, + True, +) [SketchLine_10, SketchLine_11] = SketchMultiRotation_4.rotated() SketchLine_11.setName("SketchLine_32") SketchLine_11.result().setName("SketchLine_32") SketchLine_10.setName("SketchLine_21") SketchLine_10.result().setName("SketchLine_21") -SketchMultiRotation_5 = Sketch_1.addRotation([SketchLine_2.result(), SketchLine_1.result()], SketchCircle_1.center(), "alpha+alpha_d1", 2, True, True) +SketchMultiRotation_5 = Sketch_1.addRotation( + [SketchLine_2.result(), SketchLine_1.result()], + SketchCircle_1.center(), + "alpha+alpha_d1", + 2, + True, + True, +) [SketchLine_12, SketchLine_13] = SketchMultiRotation_5.rotated() SketchLine_13.setName("SketchLine_34") SketchLine_13.result().setName("SketchLine_34") SketchLine_12.setName("SketchLine_24") SketchLine_12.result().setName("SketchLine_24") -SketchMultiRotation_6 = Sketch_1.addRotation([SketchLine_2.result(), SketchLine_1.result()], SketchAPI_Line(SketchLine_3).startPoint(), "alpha+alpha_d1+alpha_d2", 2, True, True) +SketchMultiRotation_6 = Sketch_1.addRotation( + [SketchLine_2.result(), SketchLine_1.result()], + SketchAPI_Line(SketchLine_3).startPoint(), + "alpha+alpha_d1+alpha_d2", + 2, + True, + True, +) [SketchLine_14, SketchLine_15] = SketchMultiRotation_6.rotated() SketchLine_15.setName("SketchLine_36") SketchLine_15.result().setName("SketchLine_36") SketchLine_14.setName("SketchLine_31") SketchLine_14.result().setName("SketchLine_31") -SketchMultiRotation_7 = Sketch_1.addRotation([SketchLine_2.result(), SketchLine_1.result()], SketchCircle_3.center(), "alpha+alpha_d1+alpha_d2+alpha_d3", 2, True, True) +SketchMultiRotation_7 = Sketch_1.addRotation( + [SketchLine_2.result(), SketchLine_1.result()], + SketchCircle_3.center(), + "alpha+alpha_d1+alpha_d2+alpha_d3", + 2, + True, + True, +) [SketchLine_16, SketchLine_17] = SketchMultiRotation_7.rotated() SketchLine_17.setName("SketchLine_38") SketchLine_17.result().setName("SketchLine_38") SketchLine_16.setName("SketchLine_33") SketchLine_16.result().setName("SketchLine_33") -SketchMultiRotation_8 = Sketch_1.addRotation([SketchLine_2.result(), SketchLine_1.result()], SketchAPI_Line(SketchLine_3).startPoint(), "alpha+alpha_d1+alpha_d2+alpha_d3+alpha_d4", 2, True, True) +SketchMultiRotation_8 = Sketch_1.addRotation( + [SketchLine_2.result(), SketchLine_1.result()], + SketchAPI_Line(SketchLine_3).startPoint(), + "alpha+alpha_d1+alpha_d2+alpha_d3+alpha_d4", + 2, + True, + True, +) [SketchLine_18, SketchLine_19] = SketchMultiRotation_8.rotated() SketchLine_19.setName("SketchLine_40") SketchLine_19.result().setName("SketchLine_40") SketchLine_18.setName("SketchLine_35") SketchLine_18.result().setName("SketchLine_35") -SketchLine_20 = Sketch_1.addLine(32.13938048432696, 38.3022221559489, 32.13938048432696, 39.5987401577836) +SketchLine_20 = Sketch_1.addLine( + 32.13938048432696, 38.3022221559489, 32.13938048432696, 39.5987401577836 +) SketchLine_20.setName("SketchLine_47") SketchLine_20.result().setName("SketchLine_47") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_19).startPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchCircle_2.results()[1]) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_19).startPoint(), SketchLine_20.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_20.endPoint(), SketchCircle_2.results()[1] +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_20.result()) -SketchLine_21 = Sketch_1.addLine(-8.856057061013447, 50.22519540362261, -8.682408883346517, 49.2403876506104) +SketchLine_21 = Sketch_1.addLine( + -8.856057061013447, 50.22519540362261, -8.682408883346517, 49.2403876506104 +) SketchLine_21.setName("SketchLine_51") SketchLine_21.result().setName("SketchLine_51") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_4).endPoint(), SketchLine_21.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_21.endPoint()) -SketchArc_1 = Sketch_1.addArc(-8.769232972179982, 49.7327915271165, -8.856057061013447, 50.22519540362261, -8.682408883328591, 49.24038765058431, False) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_4).endPoint(), SketchLine_21.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_5).startPoint(), SketchLine_21.endPoint() +) +SketchArc_1 = Sketch_1.addArc( + -8.769232972179982, + 49.7327915271165, + -8.856057061013447, + 50.22519540362261, + -8.682408883328591, + 49.24038765058431, + False, +) SketchArc_1.setName("SketchArc_9") SketchArc_1.result().setName("SketchArc_9") SketchArc_1.results()[1].setName("SketchArc_9_2") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_4).startPoint(), SketchArc_1.center()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_4).endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_21.result(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_4).startPoint(), SketchArc_1.center() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_4).endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_21.result(), SketchArc_1.endPoint() +) model.do() Sketch_1.setName("Base") Sketch_1.result().setName("Base") -Sketch_1.changeFacesOrder([[SketchCircle_1.results()[1], SketchCircle_1.results()[1], SketchCircle_1.results()[1], SketchCircle_1.results()[1], SketchCircle_1.results()[1], SketchCircle_1.results()[1], SketchCircle_1.results()[1], SketchCircle_1.results()[1], SketchCircle_1.results()[1], SketchCircle_1.results()[1]], - [SketchLine_11.result(), SketchCircle_3.results()[1], SketchLine_1.result(), SketchCircle_1.results()[1]], - [SketchCircle_1.results()[1], SketchLine_8.result(), SketchCircle_3.results()[1], SketchCircle_3.results()[1], SketchLine_19.result(), SketchCircle_1.results()[1]], - [SketchLine_2.result(), SketchCircle_2.results()[1], SketchLine_4.result(), SketchCircle_3.results()[1]], - [SketchLine_1.result(), SketchCircle_3.results()[1], SketchLine_5.result(), SketchCircle_1.results()[1]], - [SketchCircle_2.results()[1], SketchCircle_2.results()[1], SketchLine_18.result(), SketchCircle_3.results()[1], SketchCircle_3.results()[1], SketchLine_9.result()], - [SketchCircle_3.results()[1], SketchArc_1.results()[1], SketchLine_5.result()], - [SketchLine_7.result(), SketchCircle_3.results()[1], SketchLine_8.result(), SketchCircle_1.results()[1]], - [SketchArc_1.results()[1], SketchCircle_3.results()[1], SketchLine_7.result(), SketchCircle_1.results()[1]], - [SketchLine_15.result(), SketchCircle_3.results()[1], SketchLine_13.result(), SketchCircle_1.results()[1]], - [SketchLine_13.result(), SketchCircle_3.results()[1], SketchLine_11.result(), SketchCircle_1.results()[1]], - [SketchLine_17.result(), SketchCircle_3.results()[1], SketchLine_15.result(), SketchCircle_1.results()[1]], - [SketchLine_4.result(), SketchArc_1.results()[1], SketchCircle_3.results()[1]], - [SketchCircle_3.results()[1], SketchLine_10.result(), SketchCircle_2.results()[1], SketchLine_2.result()], - [SketchCircle_3.results()[1], SketchLine_20.result(), SketchLine_19.result()], - [SketchCircle_2.results()[1], SketchLine_6.result(), SketchCircle_3.results()[1], SketchArc_1.results()[1]], - [SketchCircle_2.results()[1], SketchLine_9.result(), SketchCircle_3.results()[1], SketchLine_6.result()], - [SketchCircle_2.results()[1], SketchLine_10.result(), SketchCircle_3.results()[1], SketchLine_12.result()], - [SketchLine_20.result(), SketchCircle_3.results()[1], SketchLine_17.result(), SketchCircle_1.results()[1]], - [SketchCircle_2.results()[1], SketchLine_16.result(), SketchCircle_3.results()[1], SketchLine_20.result()], - [SketchCircle_2.results()[1], SketchLine_12.result(), SketchCircle_3.results()[1], SketchLine_14.result()], - [SketchCircle_2.results()[1], SketchLine_14.result(), SketchCircle_3.results()[1], SketchLine_16.result()], - [SketchCircle_2.results()[1], SketchLine_20.result(), SketchCircle_3.results()[1], SketchLine_18.result()] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchCircle_1.results()[1], + SketchCircle_1.results()[1], + SketchCircle_1.results()[1], + SketchCircle_1.results()[1], + SketchCircle_1.results()[1], + SketchCircle_1.results()[1], + SketchCircle_1.results()[1], + SketchCircle_1.results()[1], + SketchCircle_1.results()[1], + SketchCircle_1.results()[1], + ], + [ + SketchLine_11.result(), + SketchCircle_3.results()[1], + SketchLine_1.result(), + SketchCircle_1.results()[1], + ], + [ + SketchCircle_1.results()[1], + SketchLine_8.result(), + SketchCircle_3.results()[1], + SketchCircle_3.results()[1], + SketchLine_19.result(), + SketchCircle_1.results()[1], + ], + [ + SketchLine_2.result(), + SketchCircle_2.results()[1], + SketchLine_4.result(), + SketchCircle_3.results()[1], + ], + [ + SketchLine_1.result(), + SketchCircle_3.results()[1], + SketchLine_5.result(), + SketchCircle_1.results()[1], + ], + [ + SketchCircle_2.results()[1], + SketchCircle_2.results()[1], + SketchLine_18.result(), + SketchCircle_3.results()[1], + SketchCircle_3.results()[1], + SketchLine_9.result(), + ], + [SketchCircle_3.results()[1], SketchArc_1.results()[1], SketchLine_5.result()], + [ + SketchLine_7.result(), + SketchCircle_3.results()[1], + SketchLine_8.result(), + SketchCircle_1.results()[1], + ], + [ + SketchArc_1.results()[1], + SketchCircle_3.results()[1], + SketchLine_7.result(), + SketchCircle_1.results()[1], + ], + [ + SketchLine_15.result(), + SketchCircle_3.results()[1], + SketchLine_13.result(), + SketchCircle_1.results()[1], + ], + [ + SketchLine_13.result(), + SketchCircle_3.results()[1], + SketchLine_11.result(), + SketchCircle_1.results()[1], + ], + [ + SketchLine_17.result(), + SketchCircle_3.results()[1], + SketchLine_15.result(), + SketchCircle_1.results()[1], + ], + [SketchLine_4.result(), SketchArc_1.results()[1], SketchCircle_3.results()[1]], + [ + SketchCircle_3.results()[1], + SketchLine_10.result(), + SketchCircle_2.results()[1], + SketchLine_2.result(), + ], + [SketchCircle_3.results()[1], SketchLine_20.result(), SketchLine_19.result()], + [ + SketchCircle_2.results()[1], + SketchLine_6.result(), + SketchCircle_3.results()[1], + SketchArc_1.results()[1], + ], + [ + SketchCircle_2.results()[1], + SketchLine_9.result(), + SketchCircle_3.results()[1], + SketchLine_6.result(), + ], + [ + SketchCircle_2.results()[1], + SketchLine_10.result(), + SketchCircle_3.results()[1], + SketchLine_12.result(), + ], + [ + SketchLine_20.result(), + SketchCircle_3.results()[1], + SketchLine_17.result(), + SketchCircle_1.results()[1], + ], + [ + SketchCircle_2.results()[1], + SketchLine_16.result(), + SketchCircle_3.results()[1], + SketchLine_20.result(), + ], + [ + SketchCircle_2.results()[1], + SketchLine_12.result(), + SketchCircle_3.results()[1], + SketchLine_14.result(), + ], + [ + SketchCircle_2.results()[1], + SketchLine_14.result(), + SketchCircle_3.results()[1], + SketchLine_16.result(), + ], + [ + SketchCircle_2.results()[1], + SketchLine_20.result(), + SketchCircle_3.results()[1], + SketchLine_18.result(), + ], + ] +) model.do() Sketch_2 = model.addSketch(partSet, model.defaultPlane("XOZ")) SketchPoint_2 = Sketch_2.addPoint(-8.769232972179982, 0) @@ -180,21 +390,47 @@ SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Origin"), SketchProjection_3.setName("SketchProjection_4") SketchProjection_3.result().setName("SketchProjection_4") SketchPoint_3 = SketchProjection_3.createdFeature() -SketchConstraintDistanceHorizontal_1 = Sketch_2.setHorizontalDistance(SketchPoint_2.coordinates(), SketchAPI_Point(SketchPoint_3).coordinates(), "(R+r)*sin(pi/180*alpha)") +SketchConstraintDistanceHorizontal_1 = Sketch_2.setHorizontalDistance( + SketchPoint_2.coordinates(), + SketchAPI_Point(SketchPoint_3).coordinates(), + "(R+r)*sin(pi/180*alpha)", +) SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "OX"), False) SketchProjection_4.setName("SketchProjection_5") SketchProjection_4.result().setName("SketchProjection_5") SketchLine_22 = SketchProjection_4.createdFeature() SketchLine_22.setName("SketchLine_11") SketchLine_22.result().setName("SketchLine_11") -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_22.result()) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchPoint_2.coordinates(), SketchLine_22.result() +) SketchPoint_4 = Sketch_2.addPoint(-15.60535821593484, 0) -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_22.result(), SketchPoint_4.coordinates()) -SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance(SketchPoint_4.coordinates(), SketchAPI_Line(SketchLine_22).startPoint(), "(R+r)*sin(pi/180*(alpha+alpha_g1))") +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchLine_22.result(), SketchPoint_4.coordinates() +) +SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance( + SketchPoint_4.coordinates(), + SketchAPI_Line(SketchLine_22).startPoint(), + "(R+r)*sin(pi/180*(alpha+alpha_g1))", +) SketchPoint_5 = Sketch_2.addPoint(-22.13774291284841, 0) -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchPoint_5.coordinates(), SketchLine_22.result()) -SketchConstraintDistanceHorizontal_3 = Sketch_2.setHorizontalDistance(SketchPoint_5.coordinates(), SketchAPI_Line(SketchLine_22).startPoint(), "(R+r)*sin(pi/180*(alpha+alpha_g1+alpha_g2))") -SketchArc_2 = Sketch_2.addArc(9.891954789997728, 17.56243472757491, -8.769232972179982, 0, -15.60535821593484, 15, True) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchPoint_5.coordinates(), SketchLine_22.result() +) +SketchConstraintDistanceHorizontal_3 = Sketch_2.setHorizontalDistance( + SketchPoint_5.coordinates(), + SketchAPI_Line(SketchLine_22).startPoint(), + "(R+r)*sin(pi/180*(alpha+alpha_g1+alpha_g2))", +) +SketchArc_2 = Sketch_2.addArc( + 9.891954789997728, + 17.56243472757491, + -8.769232972179982, + 0, + -15.60535821593484, + 15, + True, +) SketchArc_2.setName("SketchArc_1") SketchArc_2.result().setName("SketchArc_1") SketchArc_2.results()[1].setName("SketchArc_1_2") @@ -207,239 +443,759 @@ SketchLine_23.result().setName("SketchLine_19") SketchLine_24 = Sketch_2.addLine(-15.60535821593484, 0, -15.60535821593484, 15) SketchLine_24.setName("SketchLine_22") SketchLine_24.result().setName("SketchLine_22") -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchLine_24.startPoint()) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_24.endPoint()) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchPoint_4.coordinates(), SketchLine_24.startPoint() +) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchArc_2.endPoint(), SketchLine_24.endPoint() +) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_24.result()) SketchLine_25 = Sketch_2.addLine(-15.60535821593484, 15, -22.13774291284841, 80) SketchLine_25.setName("SketchLine_23") SketchLine_25.result().setName("SketchLine_23") -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_25.startPoint()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchArc_2.endPoint(), SketchLine_25.startPoint() +) SketchLine_26 = Sketch_2.addLine(-22.13774291284841, 80, -22.13774291284841, 0) SketchLine_26.setName("SketchLine_25") SketchLine_26.result().setName("SketchLine_25") -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_25.endPoint(), SketchLine_26.startPoint()) -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchPoint_5.coordinates(), SketchLine_26.endPoint()) -SketchConstraintTangent_1 = Sketch_2.setTangent(SketchLine_25.result(), SketchArc_2.results()[1]) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchArc_2.startPoint(), SketchPoint_2.coordinates()) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_25.endPoint(), SketchLine_26.startPoint() +) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchPoint_5.coordinates(), SketchLine_26.endPoint() +) +SketchConstraintTangent_1 = Sketch_2.setTangent( + SketchLine_25.result(), SketchArc_2.results()[1] +) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchArc_2.startPoint(), SketchPoint_2.coordinates() +) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_26.result()) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_26.result(), "H") SketchLine_27 = Sketch_2.addLine(-22.13774291284841, 80, 0, 80) SketchLine_27.setName("SketchLine_26") SketchLine_27.result().setName("SketchLine_26") -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_27.endPoint(), SketchLine_23.result()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchLine_27.endPoint(), SketchLine_23.result() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_27.result()) SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_24.result(), "h_left_b") SketchLine_28 = Sketch_2.addLine(0, 90, 0, 80) SketchLine_28.setName("SketchLine_27") SketchLine_28.result().setName("SketchLine_27") -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_27.endPoint(), SketchLine_28.endPoint()) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchLine_27.endPoint(), SketchLine_28.endPoint() +) SketchLine_29 = Sketch_2.addLine(0, 80, 0, 0) SketchLine_29.setName("SketchLine_28") SketchLine_29.result().setName("SketchLine_28") -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_27.endPoint(), SketchLine_29.startPoint()) -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_29.endPoint()) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchLine_27.endPoint(), SketchLine_29.startPoint() +) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_29.endPoint() +) SketchLine_30 = Sketch_2.addLine(0, 0, -8.769232972179982, 0) SketchLine_30.setName("SketchLine_29") SketchLine_30.result().setName("SketchLine_29") -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_30.startPoint()) -SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_30.endPoint()) -SketchArc_3 = Sketch_2.addArc(-21.14275492577, 80.09999452769853, -22.13774291284841, 80, -21.85792509603332, 80.79894490330864, True) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_30.startPoint() +) +SketchConstraintCoincidence_30 = Sketch_2.setCoincident( + SketchPoint_2.coordinates(), SketchLine_30.endPoint() +) +SketchArc_3 = Sketch_2.addArc( + -21.14275492577, + 80.09999452769853, + -22.13774291284841, + 80, + -21.85792509603332, + 80.79894490330864, + True, +) SketchArc_3.setName("SketchArc_2") SketchArc_3.result().setName("SketchArc_2") SketchArc_3.results()[1].setName("SketchArc_2_2") -SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchLine_25.endPoint(), SketchArc_3.startPoint()) -SketchArc_4 = Sketch_2.addArc(0, 59.43674945504897, -21.85792509603332, 80.79894490330864, 0, 90, True) +SketchConstraintCoincidence_31 = Sketch_2.setCoincident( + SketchLine_25.endPoint(), SketchArc_3.startPoint() +) +SketchArc_4 = Sketch_2.addArc( + 0, 59.43674945504897, -21.85792509603332, 80.79894490330864, 0, 90, True +) SketchArc_4.setName("SketchArc_3") SketchArc_4.result().setName("SketchArc_3") SketchArc_4.results()[1].setName("SketchArc_3_2") -SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchArc_3.endPoint(), SketchArc_4.startPoint()) -SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchArc_4.endPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_32 = Sketch_2.setCoincident( + SketchArc_3.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintCoincidence_33 = Sketch_2.setCoincident( + SketchArc_4.endPoint(), SketchLine_28.startPoint() +) SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_28.result()) SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_28.result(), "h") -SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchLine_27.startPoint(), SketchLine_26.startPoint()) -SketchConstraintTangent_2 = Sketch_2.setTangent(SketchArc_3.results()[1], SketchArc_4.results()[1]) -SketchConstraintTangent_3 = Sketch_2.setTangent(SketchArc_3.results()[1], SketchLine_25.result()) +SketchConstraintCoincidence_34 = Sketch_2.setCoincident( + SketchLine_27.startPoint(), SketchLine_26.startPoint() +) +SketchConstraintTangent_2 = Sketch_2.setTangent( + SketchArc_3.results()[1], SketchArc_4.results()[1] +) +SketchConstraintTangent_3 = Sketch_2.setTangent( + SketchArc_3.results()[1], SketchLine_25.result() +) SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_3.results()[1], "2*r") SketchPoint_6 = Sketch_2.addPoint(8.769232972179982, 0) -SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchPoint_6.coordinates(), SketchLine_22.result()) -SketchConstraintDistanceHorizontal_4 = Sketch_2.setHorizontalDistance(SketchPoint_6.coordinates(), SketchLine_30.startPoint(), "(R+r)*sin(pi/180*alpha)") +SketchConstraintCoincidence_35 = Sketch_2.setCoincident( + SketchPoint_6.coordinates(), SketchLine_22.result() +) +SketchConstraintDistanceHorizontal_4 = Sketch_2.setHorizontalDistance( + SketchPoint_6.coordinates(), SketchLine_30.startPoint(), "(R+r)*sin(pi/180*alpha)" +) SketchPoint_7 = Sketch_2.addPoint(13.91968646875846, 0) -SketchConstraintCoincidence_36 = Sketch_2.setCoincident(SketchPoint_7.coordinates(), SketchLine_22.result()) -SketchConstraintDistanceHorizontal_5 = Sketch_2.setHorizontalDistance(SketchLine_30.startPoint(), SketchPoint_7.coordinates(), "(R+r)*sin(pi/180*(alpha+alpha_d1))") +SketchConstraintCoincidence_36 = Sketch_2.setCoincident( + SketchPoint_7.coordinates(), SketchLine_22.result() +) +SketchConstraintDistanceHorizontal_5 = Sketch_2.setHorizontalDistance( + SketchLine_30.startPoint(), + SketchPoint_7.coordinates(), + "(R+r)*sin(pi/180*(alpha+alpha_d1))", +) SketchPoint_8 = Sketch_2.addPoint(20.54020047532791, 0) -SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchPoint_8.coordinates(), SketchLine_22.result()) -SketchConstraintDistanceHorizontal_6 = Sketch_2.setHorizontalDistance(SketchPoint_8.coordinates(), SketchLine_30.startPoint(), "(R+r)*sin(pi/180*(alpha+alpha_d1+alpha_d2))") +SketchConstraintCoincidence_37 = Sketch_2.setCoincident( + SketchPoint_8.coordinates(), SketchLine_22.result() +) +SketchConstraintDistanceHorizontal_6 = Sketch_2.setHorizontalDistance( + SketchPoint_8.coordinates(), + SketchLine_30.startPoint(), + "(R+r)*sin(pi/180*(alpha+alpha_d1+alpha_d2))", +) SketchPoint_9 = Sketch_2.addPoint(26.76092284377685, 0) -SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchPoint_9.coordinates(), SketchLine_22.result()) -SketchConstraintDistanceHorizontal_7 = Sketch_2.setHorizontalDistance(SketchPoint_9.coordinates(), SketchLine_30.startPoint(), "(R+r)*sin(pi/180*(alpha+alpha_d1+alpha_d2+alpha_d3))") +SketchConstraintCoincidence_38 = Sketch_2.setCoincident( + SketchPoint_9.coordinates(), SketchLine_22.result() +) +SketchConstraintDistanceHorizontal_7 = Sketch_2.setHorizontalDistance( + SketchPoint_9.coordinates(), + SketchLine_30.startPoint(), + "(R+r)*sin(pi/180*(alpha+alpha_d1+alpha_d2+alpha_d3))", +) SketchPoint_10 = Sketch_2.addPoint(32.46077428917023, 0) -SketchConstraintCoincidence_39 = Sketch_2.setCoincident(SketchPoint_10.coordinates(), SketchLine_22.result()) -SketchConstraintDistanceHorizontal_8 = Sketch_2.setHorizontalDistance(SketchPoint_10.coordinates(), SketchLine_30.startPoint(), "(R+r)*sin(pi/180*(alpha+alpha_d1+alpha_d2+alpha_d3+alpha_d4))") +SketchConstraintCoincidence_39 = Sketch_2.setCoincident( + SketchPoint_10.coordinates(), SketchLine_22.result() +) +SketchConstraintDistanceHorizontal_8 = Sketch_2.setHorizontalDistance( + SketchPoint_10.coordinates(), + SketchLine_30.startPoint(), + "(R+r)*sin(pi/180*(alpha+alpha_d1+alpha_d2+alpha_d3+alpha_d4))", +) SketchLine_31 = Sketch_2.addLine(0, 0, 8.769232972179982, 0) SketchLine_31.setName("SketchLine_37") SketchLine_31.result().setName("SketchLine_37") -SketchConstraintCoincidence_40 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_31.startPoint()) -SketchConstraintCoincidence_41 = Sketch_2.setCoincident(SketchPoint_6.coordinates(), SketchLine_31.endPoint()) +SketchConstraintCoincidence_40 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_31.startPoint() +) +SketchConstraintCoincidence_41 = Sketch_2.setCoincident( + SketchPoint_6.coordinates(), SketchLine_31.endPoint() +) SketchLine_32 = Sketch_2.addLine(13.91968646875846, 10, 13.91968646875846, 0) SketchLine_32.setName("SketchLine_39") SketchLine_32.result().setName("SketchLine_39") -SketchConstraintCoincidence_42 = Sketch_2.setCoincident(SketchPoint_7.coordinates(), SketchLine_32.endPoint()) +SketchConstraintCoincidence_42 = Sketch_2.setCoincident( + SketchPoint_7.coordinates(), SketchLine_32.endPoint() +) SketchLine_33 = Sketch_2.addLine(13.91968646875846, 10, 20.54020047532791, 55) SketchLine_33.setName("SketchLine_41") SketchLine_33.result().setName("SketchLine_41") SketchLine_34 = Sketch_2.addLine(20.54020047532791, 55, 20.54020047532791, 0) SketchLine_34.setName("SketchLine_42") SketchLine_34.result().setName("SketchLine_42") -SketchConstraintCoincidence_43 = Sketch_2.setCoincident(SketchLine_33.endPoint(), SketchLine_34.startPoint()) -SketchConstraintCoincidence_44 = Sketch_2.setCoincident(SketchPoint_8.coordinates(), SketchLine_34.endPoint()) +SketchConstraintCoincidence_43 = Sketch_2.setCoincident( + SketchLine_33.endPoint(), SketchLine_34.startPoint() +) +SketchConstraintCoincidence_44 = Sketch_2.setCoincident( + SketchPoint_8.coordinates(), SketchLine_34.endPoint() +) SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_34.result()) -SketchArc_5 = Sketch_2.addArc(60.54593105342065, 49.11425556365985, 20.54020047532791, 55, 26.76092284377685, 71.33302436238394, True) +SketchArc_5 = Sketch_2.addArc( + 60.54593105342065, + 49.11425556365985, + 20.54020047532791, + 55, + 26.76092284377685, + 71.33302436238394, + True, +) SketchArc_5.setName("SketchArc_5") SketchArc_5.result().setName("SketchArc_5") SketchArc_5.results()[1].setName("SketchArc_5_2") -SketchConstraintCoincidence_45 = Sketch_2.setCoincident(SketchLine_33.endPoint(), SketchArc_5.startPoint()) -SketchLine_35 = Sketch_2.addLine(26.76092284377685, 0, 26.76092284377685, 71.33302436238394) +SketchConstraintCoincidence_45 = Sketch_2.setCoincident( + SketchLine_33.endPoint(), SketchArc_5.startPoint() +) +SketchLine_35 = Sketch_2.addLine( + 26.76092284377685, 0, 26.76092284377685, 71.33302436238394 +) SketchLine_35.setName("SketchLine_43") SketchLine_35.result().setName("SketchLine_43") -SketchConstraintCoincidence_46 = Sketch_2.setCoincident(SketchPoint_9.coordinates(), SketchLine_35.startPoint()) -SketchConstraintCoincidence_47 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_35.endPoint()) -SketchLine_36 = Sketch_2.addLine(26.76092284377685, 71.33302436238394, 32.46077428917023, 80) +SketchConstraintCoincidence_46 = Sketch_2.setCoincident( + SketchPoint_9.coordinates(), SketchLine_35.startPoint() +) +SketchConstraintCoincidence_47 = Sketch_2.setCoincident( + SketchArc_5.endPoint(), SketchLine_35.endPoint() +) +SketchLine_36 = Sketch_2.addLine( + 26.76092284377685, 71.33302436238394, 32.46077428917023, 80 +) SketchLine_36.setName("SketchLine_44") SketchLine_36.result().setName("SketchLine_44") -SketchConstraintCoincidence_48 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_36.startPoint()) +SketchConstraintCoincidence_48 = Sketch_2.setCoincident( + SketchArc_5.endPoint(), SketchLine_36.startPoint() +) SketchLine_37 = Sketch_2.addLine(32.46077428917023, 80, 32.46077428917023, 0) SketchLine_37.setName("SketchLine_45") SketchLine_37.result().setName("SketchLine_45") -SketchConstraintCoincidence_49 = Sketch_2.setCoincident(SketchLine_36.endPoint(), SketchLine_37.startPoint()) -SketchConstraintCoincidence_50 = Sketch_2.setCoincident(SketchPoint_10.coordinates(), SketchLine_37.endPoint()) +SketchConstraintCoincidence_49 = Sketch_2.setCoincident( + SketchLine_36.endPoint(), SketchLine_37.startPoint() +) +SketchConstraintCoincidence_50 = Sketch_2.setCoincident( + SketchPoint_10.coordinates(), SketchLine_37.endPoint() +) SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_37.result()) SketchConstraintVertical_9 = Sketch_2.setVertical(SketchLine_35.result()) SketchConstraintVertical_10 = Sketch_2.setVertical(SketchLine_32.result()) -SketchConstraintTangent_4 = Sketch_2.setTangent(SketchArc_5.results()[1], SketchLine_33.result()) -SketchConstraintTangent_5 = Sketch_2.setTangent(SketchLine_36.result(), SketchArc_5.results()[1]) +SketchConstraintTangent_4 = Sketch_2.setTangent( + SketchArc_5.results()[1], SketchLine_33.result() +) +SketchConstraintTangent_5 = Sketch_2.setTangent( + SketchLine_36.result(), SketchArc_5.results()[1] +) SketchConstraintLength_4 = Sketch_2.setLength(SketchLine_37.result(), "H") -SketchArc_6 = Sketch_2.addArc(0, 25.59750892852344, 0, 90, 32.1240655903332, 81.41619098175349, True) +SketchArc_6 = Sketch_2.addArc( + 0, 25.59750892852344, 0, 90, 32.1240655903332, 81.41619098175349, True +) SketchArc_6.setName("SketchArc_6") SketchArc_6.result().setName("SketchArc_6") SketchArc_6.results()[1].setName("SketchArc_6_2") -SketchConstraintCoincidence_51 = Sketch_2.setCoincident(SketchLine_23.result(), SketchArc_6.center()) -SketchConstraintCoincidence_52 = Sketch_2.setCoincident(SketchArc_6.startPoint(), SketchArc_4.endPoint()) -SketchConstraintCoincidence_53 = Sketch_2.setCoincident(SketchArc_4.center(), SketchLine_23.result()) -SketchArc_7 = Sketch_2.addArc(31.62526399033484, 80.54947478608211, 32.46077428917023, 80, 32.1240655903332, 81.41619098175349, False) +SketchConstraintCoincidence_51 = Sketch_2.setCoincident( + SketchLine_23.result(), SketchArc_6.center() +) +SketchConstraintCoincidence_52 = Sketch_2.setCoincident( + SketchArc_6.startPoint(), SketchArc_4.endPoint() +) +SketchConstraintCoincidence_53 = Sketch_2.setCoincident( + SketchArc_4.center(), SketchLine_23.result() +) +SketchArc_7 = Sketch_2.addArc( + 31.62526399033484, + 80.54947478608211, + 32.46077428917023, + 80, + 32.1240655903332, + 81.41619098175349, + False, +) SketchArc_7.setName("SketchArc_7") SketchArc_7.result().setName("SketchArc_7") SketchArc_7.results()[1].setName("SketchArc_7_2") -SketchConstraintCoincidence_54 = Sketch_2.setCoincident(SketchLine_36.endPoint(), SketchArc_7.startPoint()) -SketchConstraintCoincidence_55 = Sketch_2.setCoincident(SketchArc_7.endPoint(), SketchArc_6.endPoint()) -SketchConstraintTangent_6 = Sketch_2.setTangent(SketchLine_36.result(), SketchArc_7.results()[1]) -SketchConstraintTangent_7 = Sketch_2.setTangent(SketchArc_6.results()[1], SketchArc_7.results()[1]) +SketchConstraintCoincidence_54 = Sketch_2.setCoincident( + SketchLine_36.endPoint(), SketchArc_7.startPoint() +) +SketchConstraintCoincidence_55 = Sketch_2.setCoincident( + SketchArc_7.endPoint(), SketchArc_6.endPoint() +) +SketchConstraintTangent_6 = Sketch_2.setTangent( + SketchLine_36.result(), SketchArc_7.results()[1] +) +SketchConstraintTangent_7 = Sketch_2.setTangent( + SketchArc_6.results()[1], SketchArc_7.results()[1] +) SketchConstraintRadius_4 = Sketch_2.setRadius(SketchArc_7.results()[1], "2*r") -SketchConstraintCoincidence_56 = Sketch_2.setCoincident(SketchLine_32.startPoint(), SketchLine_33.startPoint()) -SketchArc_8 = Sketch_2.addArc(-3.275111686817561, 12.52974226731389, 13.91968646875846, 10, 8.769232972179982, 0, True) +SketchConstraintCoincidence_56 = Sketch_2.setCoincident( + SketchLine_32.startPoint(), SketchLine_33.startPoint() +) +SketchArc_8 = Sketch_2.addArc( + -3.275111686817561, + 12.52974226731389, + 13.91968646875846, + 10, + 8.769232972179982, + 0, + True, +) SketchArc_8.setName("SketchArc_8") SketchArc_8.result().setName("SketchArc_8") SketchArc_8.results()[1].setName("SketchArc_8_2") -SketchConstraintCoincidence_57 = Sketch_2.setCoincident(SketchArc_8.startPoint(), SketchLine_32.startPoint()) -SketchConstraintCoincidence_58 = Sketch_2.setCoincident(SketchArc_8.endPoint(), SketchLine_31.endPoint()) -SketchConstraintTangent_8 = Sketch_2.setTangent(SketchArc_8.results()[1], SketchLine_33.result()) +SketchConstraintCoincidence_57 = Sketch_2.setCoincident( + SketchArc_8.startPoint(), SketchLine_32.startPoint() +) +SketchConstraintCoincidence_58 = Sketch_2.setCoincident( + SketchArc_8.endPoint(), SketchLine_31.endPoint() +) +SketchConstraintTangent_8 = Sketch_2.setTangent( + SketchArc_8.results()[1], SketchLine_33.result() +) SketchConstraintLength_5 = Sketch_2.setLength(SketchLine_32.result(), "h_right_b") -SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance(SketchLine_37.startPoint(), SketchLine_34.startPoint(), "h_right_t") +SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance( + SketchLine_37.startPoint(), SketchLine_34.startPoint(), "h_right_t" +) SketchCircle_4 = Sketch_2.addCircle(0, -23.41154743026679, 25) SketchCircle_4.setName("SketchCircle_6") SketchCircle_4.result().setName("SketchCircle_6") SketchCircle_4.results()[1].setName("SketchCircle_6_2") -SketchConstraintCoincidence_59 = Sketch_2.setCoincident(SketchLine_23.result(), SketchCircle_4.center()) +SketchConstraintCoincidence_59 = Sketch_2.setCoincident( + SketchLine_23.result(), SketchCircle_4.center() +) SketchConstraintRadius_5 = Sketch_2.setRadius(SketchCircle_4.results()[1], "R_rotor") -SketchConstraintCoincidence_60 = Sketch_2.setCoincident(SketchCircle_4.results()[1], SketchArc_2.startPoint()) +SketchConstraintCoincidence_60 = Sketch_2.setCoincident( + SketchCircle_4.results()[1], SketchArc_2.startPoint() +) model.do() Sketch_2.setName("Shape") Sketch_2.result().setName("Shape") -Sketch_2.changeFacesOrder([[SketchLine_27.result(), SketchLine_28.result(), SketchArc_4.results()[1], SketchArc_3.results()[1]], - [SketchArc_2.results()[1], SketchCircle_4.results()[1], SketchLine_29.result(), SketchLine_27.result(), SketchLine_25.result()], - [SketchCircle_4.results()[1], SketchLine_30.result(), SketchLine_29.result()], - [SketchLine_30.result(), SketchCircle_4.results()[1], SketchCircle_4.results()[1], SketchLine_31.result()], - [SketchLine_28.result(), SketchLine_29.result(), SketchCircle_4.results()[1], SketchArc_8.results()[1], SketchLine_33.result(), SketchArc_5.results()[1], SketchLine_36.result(), SketchArc_7.results()[1], SketchArc_6.results()[1]], - [SketchLine_29.result(), SketchLine_31.result(), SketchCircle_4.results()[1]] - ]) +Sketch_2.changeFacesOrder( + [ + [ + SketchLine_27.result(), + SketchLine_28.result(), + SketchArc_4.results()[1], + SketchArc_3.results()[1], + ], + [ + SketchArc_2.results()[1], + SketchCircle_4.results()[1], + SketchLine_29.result(), + SketchLine_27.result(), + SketchLine_25.result(), + ], + [SketchCircle_4.results()[1], SketchLine_30.result(), SketchLine_29.result()], + [ + SketchLine_30.result(), + SketchCircle_4.results()[1], + SketchCircle_4.results()[1], + SketchLine_31.result(), + ], + [ + SketchLine_28.result(), + SketchLine_29.result(), + SketchCircle_4.results()[1], + SketchArc_8.results()[1], + SketchLine_33.result(), + SketchArc_5.results()[1], + SketchLine_36.result(), + SketchArc_7.results()[1], + SketchArc_6.results()[1], + ], + [SketchLine_29.result(), SketchLine_31.result(), SketchCircle_4.results()[1]], + ] +) model.do() Part_1 = model.addPart(partSet) Part_1.setName("Blade") Part_1.result().setName("Blade") Part_1_doc = Part_1.document() -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_1_2")], False) -Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_23")], False) -Wire_3 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_2_2")], False) -Wire_4 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_3_2")], False) -Wire_5 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_6_2")], False) -Wire_6 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_7_2")], False) -Wire_7 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_44")], False) -Wire_8 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_5_2")], False) -Wire_9 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_41")], False) -Wire_10 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_8_2")], False) -Wire_11 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_29")], False) -Wire_12 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_37")], False) -Face_1_objects = [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1"), model.selection("WIRE", "Wire_3_1"), model.selection("WIRE", "Wire_4_1"), model.selection("WIRE", "Wire_5_1"), model.selection("WIRE", "Wire_6_1"), model.selection("WIRE", "Wire_7_1"), model.selection("WIRE", "Wire_8_1"), model.selection("WIRE", "Wire_9_1"), model.selection("WIRE", "Wire_10_1"), model.selection("WIRE", "Wire_11_1"), model.selection("WIRE", "Wire_12_1")] +Wire_1 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_1_2")], False +) +Wire_2 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_23")], False +) +Wire_3 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_2_2")], False +) +Wire_4 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_3_2")], False +) +Wire_5 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_6_2")], False +) +Wire_6 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_7_2")], False +) +Wire_7 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_44")], False +) +Wire_8 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_5_2")], False +) +Wire_9 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_41")], False +) +Wire_10 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_8_2")], False +) +Wire_11 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_29")], False +) +Wire_12 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_37")], False +) +Face_1_objects = [ + model.selection("WIRE", "Wire_1_1"), + model.selection("WIRE", "Wire_2_1"), + model.selection("WIRE", "Wire_3_1"), + model.selection("WIRE", "Wire_4_1"), + model.selection("WIRE", "Wire_5_1"), + model.selection("WIRE", "Wire_6_1"), + model.selection("WIRE", "Wire_7_1"), + model.selection("WIRE", "Wire_8_1"), + model.selection("WIRE", "Wire_9_1"), + model.selection("WIRE", "Wire_10_1"), + model.selection("WIRE", "Wire_11_1"), + model.selection("WIRE", "Wire_12_1"), +] Face_1 = model.addFace(Part_1_doc, Face_1_objects) -Wire_13 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Base/SketchCircle_5_2")], False) -Pipe_1 = model.addPipe(Part_1_doc, [model.selection("WIRE", "Wire_13_1")], model.selection("EDGE", "PartSet/OZ")) -Pipe_2 = model.addPipe(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OY")) -Common_1 = model.addCommon(Part_1_doc, [model.selection("FACE", "Pipe_1_1"), model.selection("SOLID", "Pipe_2_1")]) -Scale_1 = model.addScale(Part_1_doc, [model.selection("FACE", "Common_1_1")] , model.selection("VERTEX", "PartSet/Origin"), "(R+2*r)/(R+r)" , "(R+2*r)/(R+r)", 1) -Wire_14 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_1_2")], False) -Wire_15 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_23")], False) -Wire_16 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_2_2")], False) -Wire_17 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_3_2")], False) -Wire_18 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_6_2")], False) -Wire_19 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_7_2")], False) -Wire_20 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_44")], False) -Wire_21 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_5_2")], False) -Wire_22 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_41")], False) -Wire_23 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_8_2")], False) -Wire_24 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_37")], False) -Wire_25 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_29")], False) -Face_2_objects = [model.selection("WIRE", "Wire_25_1"), model.selection("WIRE", "Wire_24_1"), model.selection("WIRE", "Wire_23_1"), model.selection("WIRE", "Wire_21_1"), model.selection("WIRE", "Wire_22_1"), model.selection("WIRE", "Wire_20_1"), model.selection("WIRE", "Wire_18_1"), model.selection("WIRE", "Wire_19_1"), model.selection("WIRE", "Wire_17_1"), model.selection("WIRE", "Wire_16_1"), model.selection("WIRE", "Wire_15_1"), model.selection("WIRE", "Wire_14_1")] +Wire_13 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Base/SketchCircle_5_2")], False +) +Pipe_1 = model.addPipe( + Part_1_doc, + [model.selection("WIRE", "Wire_13_1")], + model.selection("EDGE", "PartSet/OZ"), +) +Pipe_2 = model.addPipe( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("EDGE", "PartSet/OY"), +) +Common_1 = model.addCommon( + Part_1_doc, + [model.selection("FACE", "Pipe_1_1"), model.selection("SOLID", "Pipe_2_1")], +) +Scale_1 = model.addScale( + Part_1_doc, + [model.selection("FACE", "Common_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + "(R+2*r)/(R+r)", + "(R+2*r)/(R+r)", + 1, +) +Wire_14 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_1_2")], False +) +Wire_15 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_23")], False +) +Wire_16 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_2_2")], False +) +Wire_17 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_3_2")], False +) +Wire_18 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_6_2")], False +) +Wire_19 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_7_2")], False +) +Wire_20 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_44")], False +) +Wire_21 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_5_2")], False +) +Wire_22 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_41")], False +) +Wire_23 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_8_2")], False +) +Wire_24 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_37")], False +) +Wire_25 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_29")], False +) +Face_2_objects = [ + model.selection("WIRE", "Wire_25_1"), + model.selection("WIRE", "Wire_24_1"), + model.selection("WIRE", "Wire_23_1"), + model.selection("WIRE", "Wire_21_1"), + model.selection("WIRE", "Wire_22_1"), + model.selection("WIRE", "Wire_20_1"), + model.selection("WIRE", "Wire_18_1"), + model.selection("WIRE", "Wire_19_1"), + model.selection("WIRE", "Wire_17_1"), + model.selection("WIRE", "Wire_16_1"), + model.selection("WIRE", "Wire_15_1"), + model.selection("WIRE", "Wire_14_1"), +] Face_2 = model.addFace(Part_1_doc, Face_2_objects) -Wire_26 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Base/SketchCircle_5_2")], False) -Pipe_3 = model.addPipe(Part_1_doc, [model.selection("WIRE", "Wire_26_1")], model.selection("EDGE", "PartSet/OZ")) -Pipe_4 = model.addPipe(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OY")) -Common_2 = model.addCommon(Part_1_doc, [model.selection("FACE", "Pipe_3_1"), model.selection("SOLID", "Pipe_4_1")]) -Scale_2 = model.addScale(Part_1_doc, [model.selection("FACE", "Common_2_1")] , model.selection("VERTEX", "PartSet/Origin"), "R/(R+r)" , "R/(R+r)", 1) -Wire_27 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_1_2")], False) -Wire_28 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_23")], False) -Wire_29 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_2_2")], False) -Wire_30 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_3_2")], False) -Wire_31 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_6_2")], False) -Wire_32 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_7_2")], False) -Wire_33 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_44")], False) -Wire_34 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_5_2")], False) -Wire_35 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_41")], False) -Wire_36 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_8_2")], False) -Wire_37 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_37")], False) -Wire_38 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_29")], False) -Face_3_objects = [model.selection("WIRE", "Wire_27_1"), model.selection("WIRE", "Wire_28_1"), model.selection("WIRE", "Wire_29_1"), model.selection("WIRE", "Wire_30_1"), model.selection("WIRE", "Wire_31_1"), model.selection("WIRE", "Wire_32_1"), model.selection("WIRE", "Wire_33_1"), model.selection("WIRE", "Wire_34_1"), model.selection("WIRE", "Wire_35_1"), model.selection("WIRE", "Wire_36_1"), model.selection("WIRE", "Wire_37_1"), model.selection("WIRE", "Wire_38_1")] +Wire_26 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Base/SketchCircle_5_2")], False +) +Pipe_3 = model.addPipe( + Part_1_doc, + [model.selection("WIRE", "Wire_26_1")], + model.selection("EDGE", "PartSet/OZ"), +) +Pipe_4 = model.addPipe( + Part_1_doc, + [model.selection("FACE", "Face_2_1")], + model.selection("EDGE", "PartSet/OY"), +) +Common_2 = model.addCommon( + Part_1_doc, + [model.selection("FACE", "Pipe_3_1"), model.selection("SOLID", "Pipe_4_1")], +) +Scale_2 = model.addScale( + Part_1_doc, + [model.selection("FACE", "Common_2_1")], + model.selection("VERTEX", "PartSet/Origin"), + "R/(R+r)", + "R/(R+r)", + 1, +) +Wire_27 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_1_2")], False +) +Wire_28 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_23")], False +) +Wire_29 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_2_2")], False +) +Wire_30 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_3_2")], False +) +Wire_31 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_6_2")], False +) +Wire_32 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_7_2")], False +) +Wire_33 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_44")], False +) +Wire_34 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_5_2")], False +) +Wire_35 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_41")], False +) +Wire_36 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchArc_8_2")], False +) +Wire_37 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_37")], False +) +Wire_38 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Shape/SketchLine_29")], False +) +Face_3_objects = [ + model.selection("WIRE", "Wire_27_1"), + model.selection("WIRE", "Wire_28_1"), + model.selection("WIRE", "Wire_29_1"), + model.selection("WIRE", "Wire_30_1"), + model.selection("WIRE", "Wire_31_1"), + model.selection("WIRE", "Wire_32_1"), + model.selection("WIRE", "Wire_33_1"), + model.selection("WIRE", "Wire_34_1"), + model.selection("WIRE", "Wire_35_1"), + model.selection("WIRE", "Wire_36_1"), + model.selection("WIRE", "Wire_37_1"), + model.selection("WIRE", "Wire_38_1"), +] Face_3 = model.addFace(Part_1_doc, Face_3_objects) -Wire_39 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Base/SketchCircle_5_2")], False) -Pipe_5 = model.addPipe(Part_1_doc, [model.selection("WIRE", "Wire_39_1")], model.selection("EDGE", "PartSet/OZ")) -Pipe_6 = model.addPipe(Part_1_doc, [model.selection("FACE", "Face_3_1")], model.selection("EDGE", "PartSet/OY")) -Common_3 = model.addCommon(Part_1_doc, [model.selection("FACE", "Pipe_5_1"), model.selection("SOLID", "Pipe_6_1")]) -Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_9_1/Edge&Wire_22_1/Edge&Wire_35_1/Edge&Wire_26_1/Wire_26_1"), model.selection("EDGE", "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_9_1/Edge&Wire_22_1/Edge&Wire_35_1/Edge&Wire_13_1/Wire_13_1")]) -Filling_2 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_6_1/Edge&Wire_19_1/Edge&Wire_32_1/Edge&Wire_26_1/Wire_26_1"), model.selection("EDGE", "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_6_1/Edge&Wire_19_1/Edge&Wire_32_1/Edge&Wire_13_1/Wire_13_1")]) -Filling_3 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_10_1/Edge&Wire_23_1/Edge&Wire_36_1/Edge&Wire_26_1/Wire_26_1"), model.selection("EDGE", "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_10_1/Edge&Wire_23_1/Edge&Wire_36_1/Edge&Wire_13_1/Wire_13_1")]) -Filling_4 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_8_1/Edge&Wire_21_1/Edge&Wire_34_1/Edge&Wire_26_1/Wire_26_1"), model.selection("EDGE", "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_8_1/Edge&Wire_21_1/Edge&Wire_34_1/Edge&Wire_13_1/Wire_13_1")]) -Filling_5 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_7_1/Edge&Wire_20_1/Edge&Wire_33_1/Edge&Wire_13_1/Wire_13_1"), model.selection("EDGE", "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_7_1/Edge&Wire_20_1/Edge&Wire_33_1/Edge&Wire_26_1/Wire_26_1")]) -Filling_6 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_5_1/Edge&Wire_18_1/Edge&Wire_31_1/Edge&Wire_13_1/Wire_13_1"), model.selection("EDGE", "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_5_1/Edge&Wire_18_1/Edge&Wire_31_1/Edge&Wire_26_1/Wire_26_1")]) -Filling_7 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_4_1/Edge&Wire_17_1/Edge&Wire_30_1/Edge&Wire_13_1/Wire_13_1"), model.selection("EDGE", "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_4_1/Edge&Wire_17_1/Edge&Wire_30_1/Edge&Wire_26_1/Wire_26_1")]) -Filling_8 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_3_1/Edge&Wire_16_1/Edge&Wire_29_1/Edge&Wire_13_1/Wire_13_1"), model.selection("EDGE", "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_3_1/Edge&Wire_16_1/Edge&Wire_29_1/Edge&Wire_26_1/Wire_26_1")]) -Filling_9 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_2_1/Edge&Wire_15_1/Edge&Wire_28_1/Edge&Wire_13_1/Wire_13_1"), model.selection("EDGE", "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_2_1/Edge&Wire_15_1/Edge&Wire_28_1/Edge&Wire_26_1/Wire_26_1")]) -Filling_10 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_1_1/Edge&Wire_14_1/Edge&Wire_27_1/Edge&Wire_13_1/Wire_13_1"), model.selection("EDGE", "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_1_1/Edge&Wire_14_1/Edge&Wire_27_1/Edge&Wire_26_1/Wire_26_1")]) -Filling_11 = model.addFilling(Part_1_doc, [model.selection("EDGE", "(Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_10_1/Edge&Wire_23_1/Edge&Wire_36_1/Edge&Wire_26_1/Wire_26_1)(Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_9_1/Edge&Wire_22_1/Edge&Wire_35_1/Edge&Wire_26_1/Wire_26_1)2(Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_1_1/Edge&Wire_14_1/Edge&Wire_27_1/Edge&Wire_26_1/Wire_26_1)2"), model.selection("EDGE", "(Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_10_1/Edge&Wire_23_1/Edge&Wire_36_1/Edge&Wire_13_1/Wire_13_1)(Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_9_1/Edge&Wire_22_1/Edge&Wire_35_1/Edge&Wire_13_1/Wire_13_1)2(Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_1_1/Edge&Wire_14_1/Edge&Wire_27_1/Edge&Wire_13_1/Wire_13_1)2")]) -Filling_12 = model.addFilling(Part_1_doc, [model.selection("EDGE", "(Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_1_1/Edge&Wire_14_1/Edge&Wire_27_1/Edge&Wire_26_1/Wire_26_1)(Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_10_1/Edge&Wire_23_1/Edge&Wire_36_1/Edge&Wire_26_1/Wire_26_1)2(Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_2_1/Edge&Wire_15_1/Edge&Wire_28_1/Edge&Wire_26_1/Wire_26_1)2"), model.selection("EDGE", "(Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_1_1/Edge&Wire_14_1/Edge&Wire_27_1/Edge&Wire_13_1/Wire_13_1)(Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_10_1/Edge&Wire_23_1/Edge&Wire_36_1/Edge&Wire_13_1/Wire_13_1)2(Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_2_1/Edge&Wire_15_1/Edge&Wire_28_1/Edge&Wire_13_1/Wire_13_1)2")]) -Shell_1_objects = [model.selection("FACE", "Scale_1_1"), model.selection("FACE", "Scale_2_1"), model.selection("FACE", "Filling_1_1"), model.selection("FACE", "Filling_2_1"), model.selection("FACE", "Filling_3_1"), model.selection("FACE", "Filling_4_1"), model.selection("FACE", "Filling_5_1"), model.selection("FACE", "Filling_6_1"), model.selection("FACE", "Filling_7_1"), model.selection("FACE", "Filling_8_1"), model.selection("FACE", "Filling_9_1"), model.selection("FACE", "Filling_10_1"), model.selection("FACE", "Filling_11_1"), model.selection("FACE", "Filling_12_1")] +Wire_39 = model.addWire( + Part_1_doc, [model.selection("EDGE", "PartSet/Base/SketchCircle_5_2")], False +) +Pipe_5 = model.addPipe( + Part_1_doc, + [model.selection("WIRE", "Wire_39_1")], + model.selection("EDGE", "PartSet/OZ"), +) +Pipe_6 = model.addPipe( + Part_1_doc, + [model.selection("FACE", "Face_3_1")], + model.selection("EDGE", "PartSet/OY"), +) +Common_3 = model.addCommon( + Part_1_doc, + [model.selection("FACE", "Pipe_5_1"), model.selection("SOLID", "Pipe_6_1")], +) +Filling_1 = model.addFilling( + Part_1_doc, + [ + model.selection( + "EDGE", + "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_9_1/Edge&Wire_22_1/Edge&Wire_35_1/Edge&Wire_26_1/Wire_26_1", + ), + model.selection( + "EDGE", + "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_9_1/Edge&Wire_22_1/Edge&Wire_35_1/Edge&Wire_13_1/Wire_13_1", + ), + ], +) +Filling_2 = model.addFilling( + Part_1_doc, + [ + model.selection( + "EDGE", + "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_6_1/Edge&Wire_19_1/Edge&Wire_32_1/Edge&Wire_26_1/Wire_26_1", + ), + model.selection( + "EDGE", + "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_6_1/Edge&Wire_19_1/Edge&Wire_32_1/Edge&Wire_13_1/Wire_13_1", + ), + ], +) +Filling_3 = model.addFilling( + Part_1_doc, + [ + model.selection( + "EDGE", + "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_10_1/Edge&Wire_23_1/Edge&Wire_36_1/Edge&Wire_26_1/Wire_26_1", + ), + model.selection( + "EDGE", + "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_10_1/Edge&Wire_23_1/Edge&Wire_36_1/Edge&Wire_13_1/Wire_13_1", + ), + ], +) +Filling_4 = model.addFilling( + Part_1_doc, + [ + model.selection( + "EDGE", + "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_8_1/Edge&Wire_21_1/Edge&Wire_34_1/Edge&Wire_26_1/Wire_26_1", + ), + model.selection( + "EDGE", + "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_8_1/Edge&Wire_21_1/Edge&Wire_34_1/Edge&Wire_13_1/Wire_13_1", + ), + ], +) +Filling_5 = model.addFilling( + Part_1_doc, + [ + model.selection( + "EDGE", + "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_7_1/Edge&Wire_20_1/Edge&Wire_33_1/Edge&Wire_13_1/Wire_13_1", + ), + model.selection( + "EDGE", + "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_7_1/Edge&Wire_20_1/Edge&Wire_33_1/Edge&Wire_26_1/Wire_26_1", + ), + ], +) +Filling_6 = model.addFilling( + Part_1_doc, + [ + model.selection( + "EDGE", + "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_5_1/Edge&Wire_18_1/Edge&Wire_31_1/Edge&Wire_13_1/Wire_13_1", + ), + model.selection( + "EDGE", + "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_5_1/Edge&Wire_18_1/Edge&Wire_31_1/Edge&Wire_26_1/Wire_26_1", + ), + ], +) +Filling_7 = model.addFilling( + Part_1_doc, + [ + model.selection( + "EDGE", + "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_4_1/Edge&Wire_17_1/Edge&Wire_30_1/Edge&Wire_13_1/Wire_13_1", + ), + model.selection( + "EDGE", + "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_4_1/Edge&Wire_17_1/Edge&Wire_30_1/Edge&Wire_26_1/Wire_26_1", + ), + ], +) +Filling_8 = model.addFilling( + Part_1_doc, + [ + model.selection( + "EDGE", + "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_3_1/Edge&Wire_16_1/Edge&Wire_29_1/Edge&Wire_13_1/Wire_13_1", + ), + model.selection( + "EDGE", + "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_3_1/Edge&Wire_16_1/Edge&Wire_29_1/Edge&Wire_26_1/Wire_26_1", + ), + ], +) +Filling_9 = model.addFilling( + Part_1_doc, + [ + model.selection( + "EDGE", + "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_2_1/Edge&Wire_15_1/Edge&Wire_28_1/Edge&Wire_13_1/Wire_13_1", + ), + model.selection( + "EDGE", + "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_2_1/Edge&Wire_15_1/Edge&Wire_28_1/Edge&Wire_26_1/Wire_26_1", + ), + ], +) +Filling_10 = model.addFilling( + Part_1_doc, + [ + model.selection( + "EDGE", + "Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_1_1/Edge&Wire_14_1/Edge&Wire_27_1/Edge&Wire_13_1/Wire_13_1", + ), + model.selection( + "EDGE", + "Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_1_1/Edge&Wire_14_1/Edge&Wire_27_1/Edge&Wire_26_1/Wire_26_1", + ), + ], +) +Filling_11 = model.addFilling( + Part_1_doc, + [ + model.selection( + "EDGE", + "(Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_10_1/Edge&Wire_23_1/Edge&Wire_36_1/Edge&Wire_26_1/Wire_26_1)(Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_9_1/Edge&Wire_22_1/Edge&Wire_35_1/Edge&Wire_26_1/Wire_26_1)2(Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_1_1/Edge&Wire_14_1/Edge&Wire_27_1/Edge&Wire_26_1/Wire_26_1)2", + ), + model.selection( + "EDGE", + "(Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_10_1/Edge&Wire_23_1/Edge&Wire_36_1/Edge&Wire_13_1/Wire_13_1)(Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_9_1/Edge&Wire_22_1/Edge&Wire_35_1/Edge&Wire_13_1/Wire_13_1)2(Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_1_1/Edge&Wire_14_1/Edge&Wire_27_1/Edge&Wire_13_1/Wire_13_1)2", + ), + ], +) +Filling_12 = model.addFilling( + Part_1_doc, + [ + model.selection( + "EDGE", + "(Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_1_1/Edge&Wire_14_1/Edge&Wire_27_1/Edge&Wire_26_1/Wire_26_1)(Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_10_1/Edge&Wire_23_1/Edge&Wire_36_1/Edge&Wire_26_1/Wire_26_1)2(Scale_2_1/ME:Scaled&PartSet/OY/OY&Wire_2_1/Edge&Wire_15_1/Edge&Wire_28_1/Edge&Wire_26_1/Wire_26_1)2", + ), + model.selection( + "EDGE", + "(Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_1_1/Edge&Wire_14_1/Edge&Wire_27_1/Edge&Wire_13_1/Wire_13_1)(Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_10_1/Edge&Wire_23_1/Edge&Wire_36_1/Edge&Wire_13_1/Wire_13_1)2(Scale_1_1/ME:Scaled&PartSet/OY/OY&Wire_2_1/Edge&Wire_15_1/Edge&Wire_28_1/Edge&Wire_13_1/Wire_13_1)2", + ), + ], +) +Shell_1_objects = [ + model.selection("FACE", "Scale_1_1"), + model.selection("FACE", "Scale_2_1"), + model.selection("FACE", "Filling_1_1"), + model.selection("FACE", "Filling_2_1"), + model.selection("FACE", "Filling_3_1"), + model.selection("FACE", "Filling_4_1"), + model.selection("FACE", "Filling_5_1"), + model.selection("FACE", "Filling_6_1"), + model.selection("FACE", "Filling_7_1"), + model.selection("FACE", "Filling_8_1"), + model.selection("FACE", "Filling_9_1"), + model.selection("FACE", "Filling_10_1"), + model.selection("FACE", "Filling_11_1"), + model.selection("FACE", "Filling_12_1"), +] Shell_1 = model.addShell(Part_1_doc, Shell_1_objects) Solid_1 = model.addSolid(Part_1_doc, [model.selection("SHELL", "Shell_1_1")]) -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("FACE", "Shell_1_1/Modified_Face&Wire_26_1/Wire_26_1")], "r/2") +Fillet_1 = model.addFillet( + Part_1_doc, + [model.selection("FACE", "Shell_1_1/Modified_Face&Wire_26_1/Wire_26_1")], + "r/2", +) Fillet_1.result().setDeflection(1e-05) -Fillet_2 = model.addFillet(Part_1_doc, [model.selection("FACE", "Shell_1_1/Modified_Face&Wire_13_1/Wire_13_1")], "r/2") +Fillet_2 = model.addFillet( + Part_1_doc, + [model.selection("FACE", "Shell_1_1/Modified_Face&Wire_13_1/Wire_13_1")], + "r/2", +) Fillet_2.result().setDeflection(1e-05) Folder_1 = model.addFolder(Part_1_doc, Wire_1, Scale_1) Folder_1.setName("EXT") @@ -461,4 +1217,4 @@ model.testNbSubShapes(Part_1, GeomAPI_Shape.EDGE, [180]) model.testNbSubShapes(Part_1, GeomAPI_Shape.VERTEX, [360]) model.testResultsVolumes(Part_1, [3435.010412]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test19031.py b/src/ModelAPI/Test/Test19031.py index 0d63aa0ad..5ec22abbe 100644 --- a/src/ModelAPI/Test/Test19031.py +++ b/src/ModelAPI/Test/Test19031.py @@ -34,151 +34,395 @@ model.addParameter(Part_1_doc, "rib3", "13") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(193.5527547665121, 217.4086484957226, 25.4) SketchCircle_2 = Sketch_1.addCircle(193.5527547665121, 217.4086484957226, 38) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchCircle_2.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchCircle_2.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], 38) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchCircle_1.results()[1], 25.4) -SketchLine_1 = Sketch_1.addLine(231.5527547665122, 217.4085749004042, 231.5527547665122, 96.40864849572259) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_2.results()[1]) -SketchLine_2 = Sketch_1.addLine(212.5527547665122, 77.40864849572259, 79.55275476651215, 77.40864849572259) -SketchLine_3 = Sketch_1.addLine(79.55275476651215, 77.40864849572259, -35.01044899266839, 119.578215062531) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchArc_1 = Sketch_1.addArc(-28.44724523348785, 137.4086484957226, -35.01044899266839, 119.578215062531, -28.44724523348786, 156.4086484957226, True) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.startPoint()) -SketchLine_4 = Sketch_1.addLine(-28.44724523348786, 156.4086484957226, 96.55275476651215, 156.4086484957226) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(193.5527547665121, 217.4086484957226, 193.5527547665121, 96.40864849572259) +SketchLine_1 = Sketch_1.addLine( + 231.5527547665122, 217.4085749004042, 231.5527547665122, 96.40864849572259 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_2.results()[1] +) +SketchLine_2 = Sketch_1.addLine( + 212.5527547665122, 77.40864849572259, 79.55275476651215, 77.40864849572259 +) +SketchLine_3 = Sketch_1.addLine( + 79.55275476651215, 77.40864849572259, -35.01044899266839, 119.578215062531 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchArc_1 = Sketch_1.addArc( + -28.44724523348785, + 137.4086484957226, + -35.01044899266839, + 119.578215062531, + -28.44724523348786, + 156.4086484957226, + True, +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_1.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -28.44724523348786, 156.4086484957226, 96.55275476651215, 156.4086484957226 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 193.5527547665121, 217.4086484957226, 193.5527547665121, 96.40864849572259 +) SketchLine_5.setAuxiliary(True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(193.5527547665121, 96.40864849572259, -186.9071792634899, 96.40864849572259) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + 193.5527547665121, 96.40864849572259, -186.9071792634899, 96.40864849572259 +) SketchLine_6.setAuxiliary(True) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_6.result()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_1.results()[1]) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_1.results()[1]) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_4.result(), SketchArc_1.results()[1] +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_1.results()[1] +) SketchCircle_3 = Sketch_1.addCircle(-28.44724523348785, 137.4086484957226, 7) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_1.center(), SketchCircle_3.center()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchCircle_3.center() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_1.result()) -SketchArc_2 = Sketch_1.addArc(212.5527547665122, 96.40864849572259, 212.5527547665122, 77.40864849572259, 231.5527547665122, 96.40864849572259, False) +SketchArc_2 = Sketch_1.addArc( + 212.5527547665122, + 96.40864849572259, + 212.5527547665122, + 77.40864849572259, + 231.5527547665122, + 96.40864849572259, + False, +) SketchArc_2.setName("SketchArc_3") SketchArc_2.result().setName("SketchArc_3") SketchArc_2.results()[1].setName("SketchArc_3_2") SketchPoint_1 = Sketch_1.addPoint(231.5527547665122, 77.4086484957226) SketchPoint_1.setAuxiliary(True) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_5.startPoint(), SketchPoint_1.coordinates(), 140) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_2.result()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_1.endPoint()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_1.result()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_2.result()) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_5.startPoint(), SketchPoint_1.coordinates(), 140 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_1.result() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_2.result() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_1.endPoint() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_1.result() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_2.result() +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_2.results()[1], 19) SketchCircle_4 = Sketch_1.addCircle(212.5527547665122, 96.40864849572259, 7) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_2.center(), SketchCircle_4.center()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchCircle_4.center() +) SketchCircle_5 = Sketch_1.addCircle(149.5527547665122, 137.4086484957226, 7) -SketchLine_7 = Sketch_1.addLine(149.5527547665122, 137.4086484957226, -36.17794869484125, 137.4086484957226) +SketchLine_7 = Sketch_1.addLine( + 149.5527547665122, 137.4086484957226, -36.17794869484125, 137.4086484957226 +) SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchCircle_5.center(), SketchLine_7.startPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_7.result(), SketchLine_6.result()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_7.result()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchCircle_5.center(), SketchLine_7.startPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_7.result(), SketchLine_6.result() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_7.result() +) SketchCircle_6 = Sketch_1.addCircle(79.55275476651215, 96.4086484957226, 7) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_6.result(), SketchCircle_6.center()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_6.result(), SketchCircle_6.center() +) SketchCircle_7 = Sketch_1.addCircle(-3.447245233487854, 124.4086484957226, 5) SketchCircle_8 = Sketch_1.addCircle(174.5527547665122, 96.4086484957226, 5) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_6.result(), SketchCircle_8.center()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_3.results()[1], SketchCircle_6.results()[1]) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchCircle_6.results()[1], SketchCircle_5.results()[1]) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchCircle_5.results()[1], SketchCircle_4.results()[1]) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_1.center(), SketchCircle_4.center(), 241) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_6.result(), SketchCircle_8.center() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchCircle_3.results()[1], SketchCircle_6.results()[1] +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchCircle_6.results()[1], SketchCircle_5.results()[1] +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchCircle_5.results()[1], SketchCircle_4.results()[1] +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchArc_1.center(), SketchCircle_4.center(), 241 +) SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_3.results()[1], 7) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchCircle_8.results()[1], SketchCircle_7.results()[1]) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchCircle_8.results()[1], SketchCircle_7.results()[1] +) SketchConstraintRadius_5 = Sketch_1.setRadius(SketchCircle_7.results()[1], 5) -SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_3.startPoint(), SketchCircle_3.center(), 108) -SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance(SketchLine_3.startPoint(), SketchLine_7.startPoint(), 70) -SketchConstraintDistanceHorizontal_4 = Sketch_1.setHorizontalDistance(SketchCircle_8.center(), SketchLine_7.startPoint(), 25) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.startPoint(), SketchLine_6.result(), 19, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_7.result(), SketchCircle_6.center(), 41, True) -SketchLine_8 = Sketch_1.addLine(79.55275476651215, 77.40864849572259, 79.55275476651215, 115.4086484957226) +SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance( + SketchLine_3.startPoint(), SketchCircle_3.center(), 108 +) +SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance( + SketchLine_3.startPoint(), SketchLine_7.startPoint(), 70 +) +SketchConstraintDistanceHorizontal_4 = Sketch_1.setHorizontalDistance( + SketchCircle_8.center(), SketchLine_7.startPoint(), 25 +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.startPoint(), SketchLine_6.result(), 19, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_7.result(), SketchCircle_6.center(), 41, True +) +SketchLine_8 = Sketch_1.addLine( + 79.55275476651215, 77.40864849572259, 79.55275476651215, 115.4086484957226 +) SketchLine_8.setAuxiliary(True) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_8.startPoint() +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_8.result(), SketchCircle_6.center()) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchCircle_7.center(), SketchLine_7.result(), 13, True) -SketchConstraintDistanceHorizontal_5 = Sketch_1.setHorizontalDistance(SketchArc_1.center(), SketchCircle_7.center(), 25) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchLine_8.result(), SketchCircle_6.center() +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchCircle_7.center(), SketchLine_7.result(), 13, True +) +SketchConstraintDistanceHorizontal_5 = Sketch_1.setHorizontalDistance( + SketchArc_1.center(), SketchCircle_7.center(), 25 +) SketchConstraintRadius_6 = Sketch_1.setRadius(SketchArc_1.results()[1], 19) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_4.result()) -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchLine_1.result(), SketchCircle_2.results()[1]) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchLine_1.result(), SketchCircle_2.results()[1] +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), 125) -SketchArc_3 = Sketch_1.addArc(96.55275476651215, 215.5823348515451, 96.55275476651215, 156.4086484957226, 155.6041596876128, 219.3845360273737, False) +SketchArc_3 = Sketch_1.addArc( + 96.55275476651215, + 215.5823348515451, + 96.55275476651215, + 156.4086484957226, + 155.6041596876128, + 219.3845360273737, + False, +) SketchArc_3.setName("SketchArc_5") SketchArc_3.result().setName("SketchArc_5") SketchArc_3.results()[1].setName("SketchArc_5_2") -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_6 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_3.results()[1]) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchCircle_2.results()[1], SketchArc_3.endPoint()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_6 = Sketch_1.setTangent( + SketchLine_4.result(), SketchArc_3.results()[1] +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchCircle_2.results()[1], SketchArc_3.endPoint() +) model.do() -Sketch_1.changeFacesOrder([[SketchCircle_1.results()[1]], - [SketchCircle_2.results()[1], SketchCircle_2.results()[1], SketchArc_3.results()[1], SketchCircle_2.results()[1], SketchCircle_1.results()[1]], - [SketchCircle_4.results()[1]], - [SketchCircle_5.results()[1]], - [SketchCircle_6.results()[1]], - [SketchCircle_7.results()[1]], - [SketchCircle_8.results()[1]], - [SketchCircle_2.results()[1], SketchArc_3.results()[1]], - [SketchCircle_3.results()[1]], - [SketchArc_3.results()[1], SketchLine_4.result(), SketchArc_1.results()[1], SketchLine_3.result(), SketchLine_2.result(), SketchArc_2.results()[1], SketchLine_1.result(), SketchCircle_2.results()[1], SketchCircle_3.results()[1], SketchCircle_4.results()[1], SketchCircle_5.results()[1], SketchCircle_6.results()[1], SketchCircle_7.results()[1], SketchCircle_8.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [SketchCircle_1.results()[1]], + [ + SketchCircle_2.results()[1], + SketchCircle_2.results()[1], + SketchArc_3.results()[1], + SketchCircle_2.results()[1], + SketchCircle_1.results()[1], + ], + [SketchCircle_4.results()[1]], + [SketchCircle_5.results()[1]], + [SketchCircle_6.results()[1]], + [SketchCircle_7.results()[1]], + [SketchCircle_8.results()[1]], + [SketchCircle_2.results()[1], SketchArc_3.results()[1]], + [SketchCircle_3.results()[1]], + [ + SketchArc_3.results()[1], + SketchLine_4.result(), + SketchArc_1.results()[1], + SketchLine_3.result(), + SketchLine_2.result(), + SketchArc_2.results()[1], + SketchLine_1.result(), + SketchCircle_2.results()[1], + SketchCircle_3.results()[1], + SketchCircle_4.results()[1], + SketchCircle_5.results()[1], + SketchCircle_6.results()[1], + SketchCircle_7.results()[1], + SketchCircle_8.results()[1], + ], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_5_2r-SketchLine_4r-SketchArc_1_2f-SketchLine_3r-SketchLine_2r-SketchArc_3_2f-SketchLine_1r-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r-SketchCircle_5_2r-SketchCircle_6_2r-SketchCircle_7_2r-SketchCircle_8_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_2_2f-SketchArc_5_2r-SketchCircle_2_2f-SketchCircle_1_2r")], model.selection(), 19, 0) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4")) -SketchLine_9 = Sketch_2.addLine(41.55275476651212, -117.4829288507397, 41.55275476651212, -28.90149327102993) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchArc_5_2r-SketchLine_4r-SketchArc_1_2f-SketchLine_3r-SketchLine_2r-SketchArc_3_2f-SketchLine_1r-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r-SketchCircle_5_2r-SketchCircle_6_2r-SketchCircle_7_2r-SketchCircle_8_2r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_2_2f-SketchArc_5_2r-SketchCircle_2_2f-SketchCircle_1_2r", + ), + ], + model.selection(), + 19, + 0, +) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4"), +) +SketchLine_9 = Sketch_2.addLine( + 41.55275476651212, -117.4829288507397, 41.55275476651212, -28.90149327102993 +) SketchLine_9.setAuxiliary(True) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_9.result()) -SketchLine_10 = Sketch_2.addLine(96.55275476651215, -19, 75.65570703399533, -109.515058097161) -SketchLine_11 = Sketch_2.addLine(7.449802499028871, -109.515058097161, -13.44724523348792, -19) +SketchLine_10 = Sketch_2.addLine( + 96.55275476651215, -19, 75.65570703399533, -109.515058097161 +) +SketchLine_11 = Sketch_2.addLine( + 7.449802499028871, -109.515058097161, -13.44724523348792, -19 +) SketchLine_12 = Sketch_2.addLine(96.55275476651215, -19, -13.44724523348792, -19) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.endPoint()) -SketchArc_4 = Sketch_2.addArc(41.5527547665121, -101.6417711951257, 75.65570703399533, -109.515058097161, 7.449802499028871, -109.515058097161, True) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchLine_10.startPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.endPoint() +) +SketchArc_4 = Sketch_2.addArc( + 41.5527547665121, + -101.6417711951257, + 75.65570703399533, + -109.515058097161, + 7.449802499028871, + -109.515058097161, + True, +) SketchArc_4.setName("SketchArc_4") SketchArc_4.result().setName("SketchArc_4") SketchArc_4.results()[1].setName("SketchArc_4_2") -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchArc_4.startPoint()) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchArc_4.endPoint()) -SketchConstraintTangent_7 = Sketch_2.setTangent(SketchArc_4.results()[1], SketchLine_10.result()) -SketchConstraintTangent_8 = Sketch_2.setTangent(SketchArc_4.results()[1], SketchLine_11.result()) -SketchConstraintEqual_5 = Sketch_2.setEqual(SketchLine_10.result(), SketchLine_11.result()) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchLine_11.startPoint(), SketchArc_4.endPoint() +) +SketchConstraintTangent_7 = Sketch_2.setTangent( + SketchArc_4.results()[1], SketchLine_10.result() +) +SketchConstraintTangent_8 = Sketch_2.setTangent( + SketchArc_4.results()[1], SketchLine_11.result() +) +SketchConstraintEqual_5 = Sketch_2.setEqual( + SketchLine_10.result(), SketchLine_11.result() +) SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_12.result()) -SketchConstraintAngle_1 = Sketch_2.setAngle(SketchLine_10.result(), SketchLine_12.result(), 283, type = "Backward") +SketchConstraintAngle_1 = Sketch_2.setAngle( + SketchLine_10.result(), SketchLine_12.result(), 283, type="Backward" +) SketchConstraintRadius_7 = Sketch_2.setRadius(SketchArc_4.results()[1], 35) -SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_4"), True) +SketchProjection_1 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchLine_4"), True +) SketchLine_13 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_5_StartVertex"), True) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_5_StartVertex"), True +) SketchPoint_2 = SketchProjection_2.createdFeature() SketchPoint_3 = Sketch_2.addPoint(41.55275476651212, -19) -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_9.result()) -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_12.result(), SketchPoint_3.coordinates()) -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_5_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/To_Face]"), False) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchPoint_3.coordinates(), SketchLine_9.result() +) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchLine_12.result(), SketchPoint_3.coordinates() +) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_5_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/To_Face]", + ), + False, +) SketchPoint_4 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_12.startPoint()) -SketchConstraintDistanceHorizontal_6 = Sketch_2.setHorizontalDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchPoint_3.coordinates(), 152) -SketchConstraintMiddle_2 = Sketch_2.setMiddlePoint(SketchLine_12.result(), SketchPoint_3.coordinates()) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_12.startPoint() +) +SketchConstraintDistanceHorizontal_6 = Sketch_2.setHorizontalDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchPoint_3.coordinates(), 152 +) +SketchConstraintMiddle_2 = Sketch_2.setMiddlePoint( + SketchLine_12.result(), SketchPoint_3.coordinates() +) SketchCircle_9 = Sketch_2.addCircle(41.5527547665121, -101.6417711951257, 22.225) SketchCircle_9.setName("SketchCircle_12") SketchCircle_9.result().setName("SketchCircle_12") SketchCircle_9.results()[1].setName("SketchCircle_12_2") -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchArc_4.center(), SketchCircle_9.center()) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchArc_4.center(), SketchCircle_9.center() +) SketchConstraintRadius_8 = Sketch_2.setRadius(SketchCircle_9.results()[1], 22.225) model.do() -ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_12f-SketchLine_11r-SketchArc_4_2f-SketchLine_10r-SketchCircle_12_2r")], model.selection(), 0, 19, [model.selection("SOLID", "Extrusion_1_1_1")]) -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_1_1_2/From_Face")) -SketchCircle_10 = Sketch_3.addCircle(26.55177397544429, 51.01394267771718, 23.65265081716653) +ExtrusionFuse_1 = model.addExtrusionFuse( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_2/Face-SketchLine_12f-SketchLine_11r-SketchArc_4_2f-SketchLine_10r-SketchCircle_12_2r", + ) + ], + model.selection(), + 0, + 19, + [model.selection("SOLID", "Extrusion_1_1_1")], +) +Sketch_3 = model.addSketch( + Part_1_doc, model.selection("FACE", "ExtrusionFuse_1_1_2/From_Face") +) +SketchCircle_10 = Sketch_3.addCircle( + 26.55177397544429, 51.01394267771718, 23.65265081716653 +) SketchCircle_10.setName("SketchCircle_10") SketchCircle_10.result().setName("SketchCircle_10") SketchCircle_10.results()[1].setName("SketchCircle_10_2") model.do() -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchCircle_10_2r_wire")], model.selection(), model.selection("FACE", "ExtrusionFuse_1_1_2/Modified_Face&ExtrusionFuse_1_1_1/To_Face&ExtrusionFuse_1_1_2/To_Face&ExtrusionFuse_1_1_3/To_Face"), 0, model.selection(), 0, [model.selection("COMPSOLID", "ExtrusionFuse_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [model.selection("WIRE", "Sketch_3/Face-SketchCircle_10_2r_wire")], + model.selection(), + model.selection( + "FACE", + "ExtrusionFuse_1_1_2/Modified_Face&ExtrusionFuse_1_1_1/To_Face&ExtrusionFuse_1_1_2/To_Face&ExtrusionFuse_1_1_3/To_Face", + ), + 0, + model.selection(), + 0, + [model.selection("COMPSOLID", "ExtrusionFuse_1_1")], +) model.end() @@ -190,4 +434,4 @@ model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.EDGE, [158]) model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.VERTEX, [316]) model.testResultsVolumes(ExtrusionCut_1, [567425.6058]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test19058.py b/src/ModelAPI/Test/Test19058.py index ea15c81af..14118e8ec 100644 --- a/src/ModelAPI/Test/Test19058.py +++ b/src/ModelAPI/Test/Test19058.py @@ -28,84 +28,160 @@ Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "l", "50") width = model.addParameter(Part_1_doc, "width", "10") Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 9) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 9) -SketchArc_1 = Sketch_1.addArc(0, 0, 18.97366669488877, 0.9999860756345847, -18.97366670156818, 0.9999859489016699, False) +SketchArc_1 = Sketch_1.addArc( + 0, + 0, + 18.97366669488877, + 0.9999860756345847, + -18.97366670156818, + 0.9999859489016699, + False, +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_1.results()[1], 19) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.center(), SketchCircle_1.center()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchCircle_1.center() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchArc_1.center()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchArc_1.center() +) SketchLine_1 = Sketch_1.addLine(-44, -2.000000000000004, 44, -2) SketchLine_1.setName("SketchLine_2") SketchLine_1.result().setName("SketchLine_2") SketchLine_1.setAuxiliary(True) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchArc_2 = Sketch_1.addArc(-21.97366670156818, 1, -18.97366670156818, 0.9999859489016699, -21.97366670156818, -2, True) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_2.endPoint()) -SketchArc_3 = Sketch_1.addArc(21.97366669488877, 1, 18.97366669488877, 0.9999860756345847, 21.97366670156818, -2, False) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchArc_3.startPoint()) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_2.center(), SketchArc_2.startPoint(), 3) -SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchArc_3.center(), SketchArc_1.startPoint(), 3) +SketchArc_2 = Sketch_1.addArc( + -21.97366670156818, + 1, + -18.97366670156818, + 0.9999859489016699, + -21.97366670156818, + -2, + True, +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_2.endPoint() +) +SketchArc_3 = Sketch_1.addArc( + 21.97366669488877, + 1, + 18.97366669488877, + 0.9999860756345847, + 21.97366670156818, + -2, + False, +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchArc_3.startPoint() +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchArc_2.center(), SketchArc_2.startPoint(), 3 +) +SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance( + SketchArc_3.center(), SketchArc_1.startPoint(), 3 +) SketchLine_2 = Sketch_1.addLine(-21.97366670156818, -2, -44, -2.000000000000003) SketchLine_2.setName("SketchLine_3") SketchLine_2.result().setName("SketchLine_3") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_1.result() +) SketchLine_3 = Sketch_1.addLine(-44, -2.000000000000003, -44, -15) SketchLine_3.setName("SketchLine_4") SketchLine_3.result().setName("SketchLine_4") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(-44, -15, -18.09005251512554, -15) SketchLine_4.setName("SketchLine_5") SketchLine_4.result().setName("SketchLine_5") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(-18.09005251512554, -15, -18.09005251512554, -18) SketchLine_5.setName("SketchLine_6") SketchLine_5.result().setName("SketchLine_6") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(-18.09005251512554, -18, -4.999999999999997, -18) SketchLine_6.setName("SketchLine_7") SketchLine_6.result().setName("SketchLine_7") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(-4.999999999999997, -18, -4.999999999999997, -24) SketchLine_7.setName("SketchLine_8") SketchLine_7.result().setName("SketchLine_8") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(-4.999999999999997, -24, 5.000000000000002, -24) SketchLine_8.setName("SketchLine_9") SketchLine_8.result().setName("SketchLine_9") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(5.000000000000002, -24, 5.000000000000002, -18) SketchLine_9.setName("SketchLine_10") SketchLine_9.result().setName("SketchLine_10") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchLine_10 = Sketch_1.addLine(5.000000000000002, -18, 18.09005251512554, -18) SketchLine_10.setName("SketchLine_11") SketchLine_10.result().setName("SketchLine_11") -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchLine_11 = Sketch_1.addLine(18.09005251512554, -18, 18.09005251512554, -15) SketchLine_11.setName("SketchLine_12") SketchLine_11.result().setName("SketchLine_12") -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchLine_12 = Sketch_1.addLine(18.09005251512554, -15, 44, -15) SketchLine_12.setName("SketchLine_13") SketchLine_12.result().setName("SketchLine_13") -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchLine_13 = Sketch_1.addLine(44, -15, 44, -2.000000000000003) SketchLine_13.setName("SketchLine_14") SketchLine_13.result().setName("SketchLine_14") -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_1.result() +) SketchLine_14 = Sketch_1.addLine(44, -2.000000000000003, 21.97366670156818, -2) SketchLine_14.setName("SketchLine_15") SketchLine_14.result().setName("SketchLine_15") -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_14.endPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_14.endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_13.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_5.result()) @@ -126,35 +202,51 @@ SketchLine_15 = Sketch_1.addLine(0, 19, 0, -112) SketchLine_15.setName("SketchLine_16") SketchLine_15.result().setName("SketchLine_16") SketchLine_15.setAuxiliary(True) -SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_3 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_16 = SketchProjection_3.createdFeature() SketchLine_16.setName("SketchLine_17") SketchLine_16.result().setName("SketchLine_17") -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_15.startPoint(), SketchLine_16.result()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_15.startPoint(), SketchLine_16.result() +) SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_15.result()) -SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance(SketchLine_6.endPoint(), SketchLine_9.endPoint(), "width") +SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance( + SketchLine_6.endPoint(), SketchLine_9.endPoint(), "width" +) SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_14.result()) SketchLine_17 = Sketch_1.addLine(-44, -15, -44, -54.03211253603285) SketchLine_17.setName("SketchLine_18") SketchLine_17.result().setName("SketchLine_18") SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_17.result()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_17.startPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_17.startPoint(), SketchLine_3.endPoint() +) SketchLine_18 = Sketch_1.addLine(-39.73398465789798, -68, -16.15549442140351, -103) SketchLine_18.setName("SketchLine_19") SketchLine_18.result().setName("SketchLine_19") -SketchArc_4 = Sketch_1.addArc(0, -93, -16.15549442140351, -103, 16.15549442140351, -103, False) +SketchArc_4 = Sketch_1.addArc( + 0, -93, -16.15549442140351, -103, 16.15549442140351, -103, False +) SketchArc_4.setName("SketchArc_5") SketchArc_4.result().setName("SketchArc_5") SketchArc_4.results()[1].setName("SketchArc_5_2") -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchArc_4.startPoint()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchArc_4.startPoint() +) SketchLine_19 = Sketch_1.addLine(16.15549442140351, -103, 39.73398472457715, -68) SketchLine_19.setName("SketchLine_20") SketchLine_19.result().setName("SketchLine_20") -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_19.startPoint() +) SketchLine_20 = Sketch_1.addLine(44, -15, 44, -54.03211263501164) SketchLine_20.setName("SketchLine_21") SketchLine_20.result().setName("SketchLine_21") -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_20.startPoint() +) SketchConstraintVertical_9 = Sketch_1.setVertical(SketchLine_20.result()) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_4.results()[1], 19) SketchLine_21 = Sketch_1.addLine(-44, -46, 44.00000000000001, -46) @@ -162,91 +254,291 @@ SketchLine_21.setName("SketchLine_22") SketchLine_21.result().setName("SketchLine_22") SketchLine_21.setAuxiliary(True) SketchCircle_2 = Sketch_1.addCircle(-24.99999999999994, -46, 5) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_4.result(), SketchCircle_2.center(), 31, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_4.result(), SketchCircle_2.center(), 31, True +) SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], 5) SketchPoint_3 = Sketch_1.addPoint(-44, -46) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchLine_21.startPoint(), SketchPoint_3.coordinates()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchLine_21.startPoint(), SketchPoint_3.coordinates() +) SketchPoint_4 = Sketch_1.addPoint(25, -46) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_21.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_12.result(), SketchPoint_4.coordinates(), 31, True) -SketchMultiTranslation_1 = Sketch_1.addTranslation([SketchCircle_2.results()[1]], SketchCircle_2.center(), SketchPoint_4.coordinates(), 2) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_21.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_12.result(), SketchPoint_4.coordinates(), 31, True +) +SketchMultiTranslation_1 = Sketch_1.addTranslation( + [SketchCircle_2.results()[1]], + SketchCircle_2.center(), + SketchPoint_4.coordinates(), + 2, +) [SketchCircle_3] = SketchMultiTranslation_1.translated() -SketchConstraintDistanceHorizontal_4 = Sketch_1.setHorizontalDistance(SketchCircle_2.center(), SketchAPI_Circle(SketchCircle_3).center(), "l") +SketchConstraintDistanceHorizontal_4 = Sketch_1.setHorizontalDistance( + SketchCircle_2.center(), SketchAPI_Circle(SketchCircle_3).center(), "l" +) SketchLine_22 = Sketch_1.addLine(-39.733984657898, -68, 39.73398472457715, -68) SketchLine_22.setName("SketchLine_23") SketchLine_22.result().setName("SketchLine_23") SketchLine_22.setAuxiliary(True) SketchConstraintHorizontal_8 = Sketch_1.setHorizontal(SketchLine_22.result()) SketchPoint_5 = Sketch_1.addPoint(0, -112) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_5.coordinates(), SketchLine_8.result(), 88, True) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchArc_4.results()[1]) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchLine_15.startPoint(), SketchArc_1.results()[1]) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchArc_2.center(), SketchLine_2.startPoint(), 3) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_14.endPoint()) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchLine_14.result(), SketchArc_3.endPoint()) -SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchArc_3.center(), SketchArc_3.endPoint(), 3) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchPoint_5.coordinates(), SketchLine_8.result(), 88, True +) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchPoint_5.coordinates(), SketchArc_4.results()[1] +) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchLine_15.startPoint(), SketchArc_1.results()[1] +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchArc_2.center(), SketchLine_2.startPoint(), 3 +) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_14.endPoint() +) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchLine_14.result(), SketchArc_3.endPoint() +) +SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance( + SketchArc_3.center(), SketchArc_3.endPoint(), 3 +) SketchLine_23 = Sketch_1.addLine(-16.15549442140351, -103, 16.15549442140351, -103) SketchLine_23.setName("SketchLine_29") SketchLine_23.result().setName("SketchLine_29") SketchLine_23.setAuxiliary(True) SketchConstraintHorizontal_9 = Sketch_1.setHorizontal(SketchLine_23.result()) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_23.result()) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchLine_23.result(), SketchLine_19.startPoint()) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchLine_22.result(), SketchLine_18.startPoint()) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchLine_22.result(), SketchLine_19.endPoint()) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_17.endPoint(), SketchLine_20.endPoint(), 88, True) -SketchConstraintDistanceVertical_3 = Sketch_1.setVerticalDistance(SketchLine_21.startPoint(), SketchLine_18.startPoint(), 22) -SketchConstraintDistanceVertical_4 = Sketch_1.setVerticalDistance(SketchLine_18.startPoint(), SketchLine_18.endPoint(), 35) -SketchConstraintDistanceVertical_5 = Sketch_1.setVerticalDistance(SketchLine_20.startPoint(), SketchArc_4.endPoint(), 88) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_14.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_12.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_6.result(), SketchLine_10.result()) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_16).startPoint(), SketchLine_4.endPoint(), 23.5, True) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_16).startPoint(), SketchLine_11.endPoint(), 23.5, True) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_16).startPoint(), SketchLine_8.result(), 24, True) -SketchArc_5 = Sketch_1.addArc(-19, -54.03211253603285, -44, -54.03211253603285, -39.733984657898, -68, False) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchLine_23.result() +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchLine_23.result(), SketchLine_19.startPoint() +) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchLine_22.result(), SketchLine_18.startPoint() +) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchLine_22.result(), SketchLine_19.endPoint() +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_17.endPoint(), SketchLine_20.endPoint(), 88, True +) +SketchConstraintDistanceVertical_3 = Sketch_1.setVerticalDistance( + SketchLine_21.startPoint(), SketchLine_18.startPoint(), 22 +) +SketchConstraintDistanceVertical_4 = Sketch_1.setVerticalDistance( + SketchLine_18.startPoint(), SketchLine_18.endPoint(), 35 +) +SketchConstraintDistanceVertical_5 = Sketch_1.setVerticalDistance( + SketchLine_20.startPoint(), SketchArc_4.endPoint(), 88 +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_14.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_4.result(), SketchLine_12.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_6.result(), SketchLine_10.result() +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_16).startPoint(), SketchLine_4.endPoint(), 23.5, True +) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_16).startPoint(), SketchLine_11.endPoint(), 23.5, True +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_16).startPoint(), SketchLine_8.result(), 24, True +) +SketchArc_5 = Sketch_1.addArc( + -19, -54.03211253603285, -44, -54.03211253603285, -39.733984657898, -68, False +) SketchArc_5.setName("SketchArc_6") SketchArc_5.result().setName("SketchArc_6") SketchArc_5.results()[1].setName("SketchArc_6_2") -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchArc_5.startPoint()) -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_18.result(), SketchArc_5.endPoint()) -SketchArc_6 = Sketch_1.addArc(19, -54.03211263501164, 44, -54.03211263501164, 39.73398472457715, -68, True) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchArc_5.startPoint() +) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchLine_18.result(), SketchArc_5.endPoint() +) +SketchArc_6 = Sketch_1.addArc( + 19, -54.03211263501164, 44, -54.03211263501164, 39.73398472457715, -68, True +) SketchArc_6.setName("SketchArc_7") SketchArc_6.result().setName("SketchArc_7") SketchArc_6.results()[1].setName("SketchArc_7_2") -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchArc_6.startPoint()) -SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchLine_19.result(), SketchArc_6.endPoint()) -SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchArc_6.endPoint()) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchLine_20.endPoint(), SketchArc_6.startPoint() +) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident( + SketchLine_19.result(), SketchArc_6.endPoint() +) +SketchConstraintCoincidence_42 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchArc_6.endPoint() +) SketchConstraintRadius_5 = Sketch_1.setRadius(SketchArc_5.results()[1], 25) SketchConstraintRadius_6 = Sketch_1.setRadius(SketchArc_6.results()[1], 25) -SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_17.result()) -SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchLine_22.startPoint(), SketchArc_5.endPoint()) -SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchLine_19.endPoint()) -SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchLine_20.result()) -SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchArc_4.center(), SketchLine_15.result()) -SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchArc_4.endPoint()) -SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchLine_23.startPoint(), SketchLine_18.endPoint()) -SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchPoint_5.coordinates()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_17.result(), SketchArc_5.results()[1]) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_20.result(), SketchArc_6.results()[1]) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchLine_18.result()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_6.results()[1], SketchLine_19.result()) -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchLine_2.result(), SketchArc_2.results()[1]) -SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_52 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_13.result()) -SketchConstraintCoincidence_53 = Sketch_1.setCoincident(SketchLine_15.startPoint(), SketchArc_1.results()[1]) -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchPoint_4.coordinates(), SketchLine_15.result(), "l/2", True) +SketchConstraintCoincidence_43 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_17.result() +) +SketchConstraintCoincidence_44 = Sketch_1.setCoincident( + SketchLine_22.startPoint(), SketchArc_5.endPoint() +) +SketchConstraintCoincidence_45 = Sketch_1.setCoincident( + SketchLine_22.endPoint(), SketchLine_19.endPoint() +) +SketchConstraintCoincidence_46 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchLine_20.result() +) +SketchConstraintCoincidence_47 = Sketch_1.setCoincident( + SketchArc_4.center(), SketchLine_15.result() +) +SketchConstraintCoincidence_48 = Sketch_1.setCoincident( + SketchLine_23.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintCoincidence_49 = Sketch_1.setCoincident( + SketchLine_23.startPoint(), SketchLine_18.endPoint() +) +SketchConstraintCoincidence_50 = Sketch_1.setCoincident( + SketchLine_15.endPoint(), SketchPoint_5.coordinates() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_17.result(), SketchArc_5.results()[1] +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_20.result(), SketchArc_6.results()[1] +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_5.results()[1], SketchLine_18.result() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_6.results()[1], SketchLine_19.result() +) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchLine_2.result(), SketchArc_2.results()[1] +) +SketchConstraintCoincidence_51 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_52 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_13.result() +) +SketchConstraintCoincidence_53 = Sketch_1.setCoincident( + SketchLine_15.startPoint(), SketchArc_1.results()[1] +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchPoint_4.coordinates(), SketchLine_15.result(), "l/2", True +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchArc_2_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchArc_3_2r-SketchCircle_1_2r"), model.selection("FACE", "Sketch_1/Face-SketchLine_18f-SketchArc_6_2f-SketchLine_19f-SketchArc_5_2f-SketchLine_20f-SketchArc_7_2f-SketchLine_21r-SketchLine_13r-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchCircle_2_2r-SketchCircle_3_2r")], model.selection(), 10, 0) -Wire_1_objects = [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_3_2][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_15][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_14][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_13][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_12][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_11][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_10][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1_2/To_Face]"), 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_3][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1_1/To_Face]")] +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchArc_1_2f-SketchArc_2_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchArc_3_2r-SketchCircle_1_2r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_18f-SketchArc_6_2f-SketchLine_19f-SketchArc_5_2f-SketchLine_20f-SketchArc_7_2f-SketchLine_21r-SketchLine_13r-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchCircle_2_2r-SketchCircle_3_2r", + ), + ], + model.selection(), + 10, + 0, +) +Wire_1_objects = [ + 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_3_2][Extrusion_1_1_1/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_15][Extrusion_1_1_1/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_14][Extrusion_1_1_1/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_13][Extrusion_1_1_2/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_12][Extrusion_1_1_2/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_11][Extrusion_1_1_2/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_10][Extrusion_1_1_2/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1_2/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1_2/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1_2/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1_2/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1_2/To_Face]", + ), + 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_3][Extrusion_1_1_1/To_Face]", + ), + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1_1/To_Face]", + ), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False) -Recover_1 = model.addRecover(Part_1_doc, Wire_1, [Extrusion_1.result().subResult(0), Extrusion_1.result().subResult(1)]) +Recover_1 = model.addRecover( + Part_1_doc, + Wire_1, + [Extrusion_1.result().subResult(0), Extrusion_1.result().subResult(1)], +) Recover_1.result().setName("BaseHorizontale") -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Recover_1_2/Modified_Face&Extrusion_1_1_1/To_Face")], model.selection(), 40, 10) -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Extrusion_2_1/Generated_Face&Wire_1_1/Edge_16")]) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Recover_1_2/Modified_Face&Extrusion_1_1_1/To_Face")], + model.selection(), + 40, + 10, +) +Shell_1 = model.addShell( + Part_1_doc, + [model.selection("FACE", "Extrusion_2_1/Generated_Face&Wire_1_1/Edge_16")], +) Recover_2 = model.addRecover(Part_1_doc, Shell_1, [Extrusion_2.result()]) Recover_2.result().setName("BaseVerticale") -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection(), 0, 67) +Extrusion_3 = model.addExtrusion( + Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection(), 0, 67 +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) SketchLine_24 = Sketch_2.addLine(-24, 50, -91, 10) SketchLine_24.setName("SketchLine_24") @@ -254,45 +546,116 @@ SketchLine_24.result().setName("SketchLine_24") SketchLine_25 = Sketch_2.addLine(-91, 10, -95.16657804170339, 15.01933103534318) SketchLine_25.setName("SketchLine_25") SketchLine_25.result().setName("SketchLine_25") -SketchConstraintCoincidence_54 = Sketch_2.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint()) -SketchLine_26 = Sketch_2.addLine(-95.16657804170339, 15.01933103534318, -95.16657804170339, 56.48490151730473) +SketchConstraintCoincidence_54 = Sketch_2.setCoincident( + SketchLine_24.endPoint(), SketchLine_25.startPoint() +) +SketchLine_26 = Sketch_2.addLine( + -95.16657804170339, 15.01933103534318, -95.16657804170339, 56.48490151730473 +) SketchLine_26.setName("SketchLine_26") SketchLine_26.result().setName("SketchLine_26") -SketchConstraintCoincidence_55 = Sketch_2.setCoincident(SketchLine_25.endPoint(), SketchLine_26.startPoint()) -SketchLine_27 = Sketch_2.addLine(-95.16657804170339, 56.48490151730473, -23.26184103325994, 56.92117661842984) +SketchConstraintCoincidence_55 = Sketch_2.setCoincident( + SketchLine_25.endPoint(), SketchLine_26.startPoint() +) +SketchLine_27 = Sketch_2.addLine( + -95.16657804170339, 56.48490151730473, -23.26184103325994, 56.92117661842984 +) SketchLine_27.setName("SketchLine_27") SketchLine_27.result().setName("SketchLine_27") -SketchConstraintCoincidence_56 = Sketch_2.setCoincident(SketchLine_26.endPoint(), SketchLine_27.startPoint()) +SketchConstraintCoincidence_56 = Sketch_2.setCoincident( + SketchLine_26.endPoint(), SketchLine_27.startPoint() +) SketchLine_28 = Sketch_2.addLine(-23.26184103325994, 56.92117661842984, -24, 50) SketchLine_28.setName("SketchLine_28") SketchLine_28.result().setName("SketchLine_28") -SketchConstraintCoincidence_57 = Sketch_2.setCoincident(SketchLine_27.endPoint(), SketchLine_28.startPoint()) -SketchConstraintCoincidence_58 = Sketch_2.setCoincident(SketchLine_24.startPoint(), SketchLine_28.endPoint()) -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[BaseHorizontale/Modified_Face&Sketch_1/SketchLine_19][BaseHorizontale/Modified_Face&Extrusion_1_1_2/To_Face]"), False) +SketchConstraintCoincidence_57 = Sketch_2.setCoincident( + SketchLine_27.endPoint(), SketchLine_28.startPoint() +) +SketchConstraintCoincidence_58 = Sketch_2.setCoincident( + SketchLine_24.startPoint(), SketchLine_28.endPoint() +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[BaseHorizontale/Modified_Face&Sketch_1/SketchLine_19][BaseHorizontale/Modified_Face&Extrusion_1_1_2/To_Face]", + ), + False, +) SketchLine_29 = SketchProjection_4.createdFeature() SketchLine_29.setName("SketchLine_30") SketchLine_29.result().setName("SketchLine_30") -SketchConstraintCoincidence_59 = Sketch_2.setCoincident(SketchLine_25.startPoint(), SketchLine_29.result()) -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "[_weak_name_1_Extrusion_3_1_1][Extrusion_3_1_1/From_Face]"), False) +SketchConstraintCoincidence_59 = Sketch_2.setCoincident( + SketchLine_25.startPoint(), SketchLine_29.result() +) +SketchProjection_5 = Sketch_2.addProjection( + model.selection( + "EDGE", "[_weak_name_1_Extrusion_3_1_1][Extrusion_3_1_1/From_Face]" + ), + False, +) SketchLine_30 = SketchProjection_5.createdFeature() SketchLine_30.setName("SketchLine_31") SketchLine_30.result().setName("SketchLine_31") -SketchConstraintCoincidence_60 = Sketch_2.setCoincident(SketchLine_25.startPoint(), SketchLine_30.result()) -SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "[_weak_name_1_Extrusion_3_1_1][_weak_name_4_Extrusion_3_1_1]"), False) +SketchConstraintCoincidence_60 = Sketch_2.setCoincident( + SketchLine_25.startPoint(), SketchLine_30.result() +) +SketchProjection_6 = Sketch_2.addProjection( + model.selection( + "EDGE", "[_weak_name_1_Extrusion_3_1_1][_weak_name_4_Extrusion_3_1_1]" + ), + False, +) SketchLine_31 = SketchProjection_6.createdFeature() SketchLine_31.setName("SketchLine_32") SketchLine_31.result().setName("SketchLine_32") -SketchConstraintCoincidence_61 = Sketch_2.setCoincident(SketchLine_24.startPoint(), SketchAPI_Line(SketchLine_31).endPoint()) +SketchConstraintCoincidence_61 = Sketch_2.setCoincident( + SketchLine_24.startPoint(), SketchAPI_Line(SketchLine_31).endPoint() +) model.do() -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_28r-SketchLine_27r-SketchLine_26r-SketchLine_25r-SketchLine_24r_wire")], model.selection(), 50, 50) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1_1")], [model.selection("SOLID", "Extrusion_4_1")]) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "WIRE", + "Sketch_2/Face-SketchLine_28r-SketchLine_27r-SketchLine_26r-SketchLine_25r-SketchLine_24r_wire", + ) + ], + model.selection(), + 50, + 50, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Extrusion_3_1_1")], + [model.selection("SOLID", "Extrusion_4_1")], +) Cut_1.result().setName("AreteDiagonale") -Fuse_1_objects_1 = [model.selection("SOLID", "BaseHorizontale"), model.selection("SOLID", "BaseVerticale"), model.selection("SOLID", "AreteDiagonale")] -Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1, removeEdges = True, keepSubResults = True) -RemoveResults_1 = model.addRemoveResults(Part_1_doc, [model.selection("WIRE", "Wire_1_1")]) -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "BaseHorizontale/Modified_Face&Extrusion_1_1_2/To_Face")]) -Group_2 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "BaseHorizontale/Modified_Face&Sketch_2/SketchLine_24")]) -Group_3 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "BaseHorizontale/Modified_Face&Extrusion_2_1/To_Face")]) +Fuse_1_objects_1 = [ + model.selection("SOLID", "BaseHorizontale"), + model.selection("SOLID", "BaseVerticale"), + model.selection("SOLID", "AreteDiagonale"), +] +Fuse_1 = model.addFuse( + Part_1_doc, Fuse_1_objects_1, removeEdges=True, keepSubResults=True +) +RemoveResults_1 = model.addRemoveResults( + Part_1_doc, [model.selection("WIRE", "Wire_1_1")] +) +Group_1 = model.addGroup( + Part_1_doc, + "Faces", + [model.selection("FACE", "BaseHorizontale/Modified_Face&Extrusion_1_1_2/To_Face")], +) +Group_2 = model.addGroup( + Part_1_doc, + "Faces", + [model.selection("FACE", "BaseHorizontale/Modified_Face&Sketch_2/SketchLine_24")], +) +Group_3 = model.addGroup( + Part_1_doc, + "Faces", + [model.selection("FACE", "BaseHorizontale/Modified_Face&Extrusion_2_1/To_Face")], +) model.end() @@ -318,4 +681,4 @@ model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [150]) model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [300]) model.testResultsVolumes(Fuse_1, [155359.198457]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test19217.py b/src/ModelAPI/Test/Test19217.py index e18c19ba4..5db2abce8 100644 --- a/src/ModelAPI/Test/Test19217.py +++ b/src/ModelAPI/Test/Test19217.py @@ -28,15 +28,28 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) -SketchCircle_1 = Sketch_1.addCircle(47.53111880904039, 63.23707920074999, 11.27757708463696) +SketchCircle_1 = Sketch_1.addCircle( + 47.53111880904039, 63.23707920074999, 11.27757708463696 +) model.do() -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")]) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("COMPOUND", "all-in-Shell_1")], model.selection("EDGE", "PartSet/OZ"), 3, keepSubResults = True) -Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")]) +Shell_1 = model.addShell( + Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")] +) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Shell_1")], + model.selection("EDGE", "PartSet/OZ"), + 3, + keepSubResults=True, +) +Shell_2 = model.addShell( + Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")] +) model.end() from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Shell_2.feature())) +assert aFactory.validate(Shell_2.feature()) -assert(model.checkPythonDump()) \ No newline at end of file +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test19707.py b/src/ModelAPI/Test/Test19707.py index 60510f704..c628fdac2 100644 --- a/src/ModelAPI/Test/Test19707.py +++ b/src/ModelAPI/Test/Test19707.py @@ -24,39 +24,90 @@ 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(-59.0465954847056, -128.5053642637967, 53.14364970069066, -170.5009266857805) -SketchLine_2 = Sketch_1.addLine(53.14364970069066, -170.5009266857805, 137.6705343466976, -112.5874503884433) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(137.6705343466976, -112.5874503884433, 64.87485797099055, -26.90480166687218) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(64.87485797099055, -26.90480166687218, 3.969957323886124, -72.35673939469255) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(3.969957323886124, -72.35673939469255, -79.2369959888606, -34.8592213882167) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(-79.2369959888606, -34.8592213882167, -59.0465954847056, -128.5053642637967) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.endPoint()) -SketchLine_7 = Sketch_1.addLine(53.14364970069066, -170.5009266857805, 3.969957323886124, -72.35673939469255) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_7.endPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchLine_1.endPoint()) +SketchLine_1 = Sketch_1.addLine( + -59.0465954847056, -128.5053642637967, 53.14364970069066, -170.5009266857805 +) +SketchLine_2 = Sketch_1.addLine( + 53.14364970069066, -170.5009266857805, 137.6705343466976, -112.5874503884433 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 137.6705343466976, -112.5874503884433, 64.87485797099055, -26.90480166687218 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + 64.87485797099055, -26.90480166687218, 3.969957323886124, -72.35673939469255 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 3.969957323886124, -72.35673939469255, -79.2369959888606, -34.8592213882167 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + -79.2369959888606, -34.8592213882167, -59.0465954847056, -128.5053642637967 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_6.endPoint() +) +SketchLine_7 = Sketch_1.addLine( + 53.14364970069066, -170.5009266857805, 3.969957323886124, -72.35673939469255 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_7.endPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchLine_1.endPoint() +) 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.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3")) -SketchCircle_1 = Sketch_2.addCircle(110.5461396183937, -4.403937604408839, 25.15832463432426) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3"), +) +SketchCircle_1 = Sketch_2.addCircle( + 110.5461396183937, -4.403937604408839, 25.15832463432426 +) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), 10, 0) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + 10, + 0, +) model.end() from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Sketch_2.feature())) -assert(aFactory.validate(Extrusion_2.feature())) +assert aFactory.validate(Sketch_2.feature()) +assert aFactory.validate(Extrusion_2.feature()) # update the first extrusion to make the second bas plane selection invalid model.begin() -Extrusion_1.setBase([model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_7f-SketchLine_5f-SketchLine_6f")]) +Extrusion_1.setBase( + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_7f-SketchLine_5f-SketchLine_6f", + ) + ] +) model.end() # check that the second sketch and extrusion become invalid -assert(len(Sketch_2.results()) == 0) -assert(len(Extrusion_2.results()) == 0) +assert len(Sketch_2.results()) == 0 +assert len(Extrusion_2.results()) == 0 diff --git a/src/ModelAPI/Test/Test19726.py b/src/ModelAPI/Test/Test19726.py index 60f7cd2a1..303a7e18b 100644 --- a/src/ModelAPI/Test/Test19726.py +++ b/src/ModelAPI/Test/Test19726.py @@ -25,17 +25,39 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) -SketchCircle_1 = Sketch_1.addCircle(18.39021699364881, 11.50401662688171, 4.123179523509023) +SketchCircle_1 = Sketch_1.addCircle( + 18.39021699364881, 11.50401662688171, 4.123179523509023 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], + model.selection(), + 10, + 0, +) model.do() -Translation_1 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_1/")], axis = model.selection("EDGE", "Part_1/([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])"), distance = 20, keepSubResults = True) +Translation_1 = model.addTranslation( + partSet, + [model.selection("COMPOUND", "Part_1/")], + axis=model.selection( + "EDGE", + "Part_1/([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])", + ), + distance=20, + keepSubResults=True, +) aName1 = Translation_1.axisObject().namingName() model.end() # update the extrusion in the part, so, outside the part selection must be moved in history model.begin() -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], axis = model.selection("EDGE", "PartSet/OY"), angle = 45) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + axis=model.selection("EDGE", "PartSet/OY"), + angle=45, +) model.do() aSession = ModelAPI_Session.get() aSession.setActiveDocument(partSet) @@ -43,7 +65,7 @@ model.end() # check that name was changed to the rotation aName2 = Translation_1.axisObject().namingName() -assert(aName1 != aName2) -assert(len(aName2) > 7) +assert aName1 != aName2 +assert len(aName2) > 7 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test19912.py b/src/ModelAPI/Test/Test19912.py index f32fc0e5e..456ab4d97 100644 --- a/src/ModelAPI/Test/Test19912.py +++ b/src/ModelAPI/Test/Test19912.py @@ -29,7 +29,13 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(50, 50, 25) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0) +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(40, 42, 5) @@ -37,18 +43,24 @@ SketchCircle_3 = Sketch_2.addCircle(60, 60, 6) model.do() Face_1 = model.addFace(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")]) -Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1"), - model.selection("FACE", "Face_1_1"), - model.selection("FACE", "Face_1_2")] -Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults = True) -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Face_1_1/Face_1_1")]) +Partition_1_objects = [ + model.selection("SOLID", "Extrusion_1_1"), + model.selection("FACE", "Face_1_1"), + model.selection("FACE", "Face_1_2"), +] +Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, keepSubResults=True) +Group_1 = model.addGroup( + Part_1_doc, "Faces", [model.selection("FACE", "Face_1_1/Face_1_1")] +) model.end() -assert(len(Group_1.results()) == 1) +assert len(Group_1.results()) == 1 # remove Face_1_1 from the partition, so the group selection must become invalid model.begin() -Partition_1.setBase([model.selection("SOLID", "Extrusion_1_1"), model.selection("FACE", "Face_1_2")]) +Partition_1.setBase( + [model.selection("SOLID", "Extrusion_1_1"), model.selection("FACE", "Face_1_2")] +) model.end() -assert(len(Group_1.results()) == 0) +assert len(Group_1.results()) == 0 diff --git a/src/ModelAPI/Test/Test19932.py b/src/ModelAPI/Test/Test19932.py index bc812bbc6..447727834 100644 --- a/src/ModelAPI/Test/Test19932.py +++ b/src/ModelAPI/Test/Test19932.py @@ -35,18 +35,44 @@ Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_2 = Sketch_2.addCircle(10, -10, 20) model.do() ### Create Extrusion -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 20, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], + model.selection(), + 20, + 0, +) ### Create Extrusion -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r")], model.selection(), 10, 0) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r")], + model.selection(), + 10, + 0, +) ### Create Fuse -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1"), model.selection("COMPOUND", "all-in-Extrusion_2")], removeEdges = True, keepSubResults = True) +Fuse_1 = model.addFuse( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Extrusion_1"), + model.selection("COMPOUND", "all-in-Extrusion_2"), + ], + removeEdges=True, + keepSubResults=True, +) ### Create Fillet -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/To_Face")], 1, keepSubResults = True) +Fillet_1 = model.addFillet( + Part_1_doc, + [model.selection("FACE", "Extrusion_1_1/To_Face")], + 1, + keepSubResults=True, +) model.end() # check the fillet validity from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Fillet_1.feature())) +assert aFactory.validate(Fillet_1.feature()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test1995.py b/src/ModelAPI/Test/Test1995.py index ca79e8e4f..72034cf61 100644 --- a/src/ModelAPI/Test/Test1995.py +++ b/src/ModelAPI/Test/Test1995.py @@ -28,23 +28,61 @@ 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(175.5289977047663, 37.215818549061, -134.623385345167, 37.215818549061) -SketchLine_2 = Sketch_1.addLine(-134.623385345167, 37.215818549061, -134.623385345167, -108.7867760111381) -SketchLine_3 = Sketch_1.addLine(-134.623385345167, -108.7867760111381, 175.5289977047663, -108.7867760111381) -SketchLine_4 = Sketch_1.addLine(175.5289977047663, -108.7867760111381, 175.5289977047663, 37.215818549061) -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()) +SketchLine_1 = Sketch_1.addLine( + 175.5289977047663, 37.215818549061, -134.623385345167, 37.215818549061 +) +SketchLine_2 = Sketch_1.addLine( + -134.623385345167, 37.215818549061, -134.623385345167, -108.7867760111381 +) +SketchLine_3 = Sketch_1.addLine( + -134.623385345167, -108.7867760111381, 175.5289977047663, -108.7867760111381 +) +SketchLine_4 = Sketch_1.addLine( + 175.5289977047663, -108.7867760111381, 175.5289977047663, 37.215818549061 +) +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() -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) +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() # now remove axis to destroy naming structure if extrusion refers to it @@ -54,4 +92,5 @@ SketchLine_1.setStartPoint(170, -130) model.end() import ModelAPI -assert(ModelAPI.ModelAPI_Session.get().validators().validate(Sketch_2.feature())) + +assert ModelAPI.ModelAPI_Session.get().validators().validate(Sketch_2.feature()) diff --git a/src/ModelAPI/Test/Test1998.py b/src/ModelAPI/Test/Test1998.py index b52f7fea4..d4f4566a6 100644 --- a/src/ModelAPI/Test/Test1998.py +++ b/src/ModelAPI/Test/Test1998.py @@ -24,11 +24,19 @@ 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(-106.3464837049742, -78.0445969125214, -108.0617495711835, 165.5231560891939) +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/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")]) +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()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test19989.py b/src/ModelAPI/Test/Test19989.py index 06b7bb730..bb8e32b9a 100644 --- a/src/ModelAPI/Test/Test19989.py +++ b/src/ModelAPI/Test/Test19989.py @@ -29,14 +29,39 @@ SketchCircle_2 = Sketch_2.addCircle(24, 10, 8) 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")], model.selection(), 10, 0) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_2/Face-SketchCircle_2_2r")], model.selection(), 12, 0) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1"), model.selection("COMPOUND", "all-in-Extrusion_2")], keepSubResults = True) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), [model.selection("COMPOUND", "all-in-Fuse_1")]) -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face")) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "PartSet/Sketch_1/Face-SketchCircle_1_2r")], + model.selection(), + 10, + 0, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "PartSet/Sketch_2/Face-SketchCircle_2_2r")], + model.selection(), + 12, + 0, +) +Fuse_1 = model.addFuse( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Extrusion_1"), + model.selection("COMPOUND", "all-in-Extrusion_2"), + ], + keepSubResults=True, +) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, [], model.selection(), [model.selection("COMPOUND", "all-in-Fuse_1")] +) +Sketch_3 = model.addSketch( + Part_1_doc, model.selection("FACE", "Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face") +) SketchCircle_3 = Sketch_3.addCircle(32, 10, 2) ExtrusionCut_1.setNestedSketch(Sketch_3) -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Extrusion_2_1/To_Face")]) +Group_1 = model.addGroup( + Part_1_doc, "Faces", [model.selection("FACE", "Extrusion_2_1/To_Face")] +) model.end() # cause the update in the history for the group @@ -46,6 +71,11 @@ model.do() Part_1_doc.setCurrentFeature(Group_1.feature(), True) model.end() -assert(ExtrusionCut_1.feature().firstResult().shape().isSubShape(Group_1.groupList().value(0).value())) +assert ( + ExtrusionCut_1.feature() + .firstResult() + .shape() + .isSubShape(Group_1.groupList().value(0).value()) +) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test20170.py b/src/ModelAPI/Test/Test20170.py index 38a5ef1db..1e033822d 100644 --- a/src/ModelAPI/Test/Test20170.py +++ b/src/ModelAPI/Test/Test20170.py @@ -26,10 +26,39 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(8, 23, 2.5) SketchCircle_2 = Sketch_1.addCircle(14, 17, 2.5) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")], model.selection(), 10, 0) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")]) -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_2/Modified_Face&Sketch_1/SketchCircle_2_2][Compound_1_1_2/Modified_Face&Extrusion_1_2/To_Face]")], 2, keepSubResults = True) -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Fillet_1_1_2/GF:Fillet&Fillet_1_1_2/FilletSelected")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), + model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f"), + ], + model.selection(), + 10, + 0, +) +Compound_1 = model.addCompound( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_1_2"), + ], +) +Fillet_1 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Compound_1_1_2/Modified_Face&Sketch_1/SketchCircle_2_2][Compound_1_1_2/Modified_Face&Extrusion_1_2/To_Face]", + ) + ], + 2, + keepSubResults=True, +) +Group_1 = model.addGroup( + Part_1_doc, + "Faces", + [model.selection("FACE", "Fillet_1_1_2/GF:Fillet&Fillet_1_1_2/FilletSelected")], +) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test2170.py b/src/ModelAPI/Test/Test2170.py index 6a0f5aef6..7b37ca531 100644 --- a/src/ModelAPI/Test/Test2170.py +++ b/src/ModelAPI/Test/Test2170.py @@ -27,54 +27,108 @@ model.addParameter(Part_1_doc, "g", "5") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 200, 0, 0) SketchLine_2 = Sketch_1.addLine(0, 0, 250, 0) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(500, 0, 500, 200) SketchArc_1 = Sketch_1.addArc(250, 200.000000000003, 0, 200, 500, 200, True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_1.startPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3") -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_1.result(), SketchArc_1.results()[1]) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.result(), SketchArc_1.endPoint()) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_1.result(), SketchArc_1.results()[1] +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchArc_1.endPoint() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_4") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_3.endPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5") SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 250) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchPoint_1.coordinates()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchPoint_1.coordinates() +) 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-32, 0, 500, 0, False) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_2.center()) +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()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchArc_2.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_2.endPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_2.endPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_9") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_2.endPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_2.endPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.results()[1], SketchArc_2.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_2.results()[1], SketchArc_2.startPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_3.startPoint() +) 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_1r-SketchArc_2_2f-SketchLine_3f-SketchArc_1_2f")], model.selection(), 10, 0) +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&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")]) +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&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 from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) -assert(Group_1.groupList().size() == 2) -assert(Group_1.groupList().value(0).value().shapeTypeStr() == "VERTEX") -assert(Group_1.groupList().value(1).value().shapeTypeStr() == "VERTEX") +assert aFactory.validate(Group_1.feature()) +assert Group_1.groupList().size() == 2 +assert Group_1.groupList().value(0).value().shapeTypeStr() == "VERTEX" +assert Group_1.groupList().value(1).value().shapeTypeStr() == "VERTEX" -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test2228.py b/src/ModelAPI/Test/Test2228.py index 1c35b5154..4426d5481 100644 --- a/src/ModelAPI/Test/Test2228.py +++ b/src/ModelAPI/Test/Test2228.py @@ -24,55 +24,138 @@ partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "Origin")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 0.3529019640553777) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchCircle_2 = Sketch_1.addCircle(0, 0, 0.4492388920251514) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchCircle_2.center()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchCircle_2.center() +) 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_2_2f-SketchCircle_1_2r")], model.selection(), 5, 0) +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()) +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_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")]) +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) -SketchLine_4 = Sketch_3.addLine(-3.362323990279312, 7.155729512171993, -3.362323990279312, -0.5188129046480872) -SketchConstraintCoincidence_4 = Sketch_3.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +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 +) +SketchLine_4 = Sketch_3.addLine( + -3.362323990279312, 7.155729512171993, -3.362323990279312, -0.5188129046480872 +) +SketchConstraintCoincidence_4 = Sketch_3.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_3.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_3.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_3.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintHorizontal_1 = Sketch_3.setHorizontal(SketchLine_1.result()) 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_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_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")] +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_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_1) model.do() model.end() # check that remove sub-shapes contains correct selection from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Remove_SubShapes_1.feature())) -assert(Remove_SubShapes_1.subshapesToKeep().size() == 4) -assert(Remove_SubShapes_1.subshapesToKeep().value(0).namingName() == "Partition_1_1_1_1") -assert(Remove_SubShapes_1.subshapesToKeep().value(1).namingName() == "Partition_1_1_1_2") -assert(Remove_SubShapes_1.subshapesToKeep().value(2).namingName() == "Partition_1_1_1_3") -assert(Remove_SubShapes_1.subshapesToKeep().value(3).namingName() == "Partition_1_1_1_4") -assert(Remove_SubShapes_1.subshapesToRemove().size() == 1) -assert(Remove_SubShapes_1.subshapesToRemove().value(0).namingName() == "Partition_1_1_2") +assert aFactory.validate(Remove_SubShapes_1.feature()) +assert Remove_SubShapes_1.subshapesToKeep().size() == 4 +assert Remove_SubShapes_1.subshapesToKeep().value(0).namingName() == "Partition_1_1_1_1" +assert Remove_SubShapes_1.subshapesToKeep().value(1).namingName() == "Partition_1_1_1_2" +assert Remove_SubShapes_1.subshapesToKeep().value(2).namingName() == "Partition_1_1_1_3" +assert Remove_SubShapes_1.subshapesToKeep().value(3).namingName() == "Partition_1_1_1_4" +assert Remove_SubShapes_1.subshapesToRemove().size() == 1 +assert Remove_SubShapes_1.subshapesToRemove().value(0).namingName() == "Partition_1_1_2" diff --git a/src/ModelAPI/Test/Test2241.py b/src/ModelAPI/Test/Test2241.py index 37154f5cd..4b0e9c4bd 100644 --- a/src/ModelAPI/Test/Test2241.py +++ b/src/ModelAPI/Test/Test2241.py @@ -27,121 +27,398 @@ model.addParameter(Part_1_doc, "l", "10") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 60, 10, 60) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) SketchLine_3 = Sketch_1.addLine(10, 60, 10, 40) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(10, 40, 20, 40) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(20, 40, 20, 20) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(20, 20, 30, 20) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(30, 20, 30, 0) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.result()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.result() +) SketchLine_9 = Sketch_1.addLine(30, 0, 81.26217508737108, 0) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_8.result()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_8.result() +) SketchLine_10 = Sketch_1.addLine(0, 60, 0, 81.26217508737108) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_2.result() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) 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-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()) +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-34, -3.089278765476956e-34, 76.26217508737108, 0, 0, 76.26217508737108, False) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_2.center()) +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 = 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 = 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, False) +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") SketchConstraintLength_2.setName("SketchConstraintLength_3") -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_7.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_7.result() +) SketchConstraintEqual_1.setName("SketchConstraintEqual_2") -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_6.result(), SketchLine_4.result()) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_6.result(), SketchLine_4.result() +) SketchConstraintEqual_2.setName("SketchConstraintEqual_3") -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_3.result()) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_3.result() +) SketchConstraintEqual_3.setName("SketchConstraintEqual_4") -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_1.result()) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_4.result(), SketchLine_1.result() +) SketchConstraintEqual_4.setName("SketchConstraintEqual_5") model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchCircle_1 = Sketch_2.addCircle(9.082839147404137, 71.32948234489588, 2.005056553640547) -SketchCircle_2 = Sketch_2.addCircle(20.11065019242717, 63.7102674410618, 2.268462537186828) -SketchCircle_3 = Sketch_2.addCircle(26.52683116407693, 51.67992811921848, 2.727171758268866) -SketchCircle_4 = Sketch_2.addCircle(38.35666483055617, 58.29661474623231, 3.007584830460834) -SketchCircle_5 = Sketch_2.addCircle(33.94554041254697, 44.0607132153844, 3.054011155390377) -SketchCircle_6 = Sketch_2.addCircle(48.58245325412298, 42.45666797247195, 2.346858526438435) -SketchCircle_7 = Sketch_2.addCircle(38.95818179664835, 31.42885692744893, 3.547307159201095) -SketchCircle_8 = Sketch_2.addCircle(63.82088306179116, 27.41874382016783, 4.536925074373651) -SketchCircle_9 = Sketch_2.addCircle(50.18649849703544, 28.4212720969881, 4.820482891521984) -SketchCircle_10 = Sketch_2.addCircle(49.58498153094326, 15.18789884296047, 2.552020354335177) -SketchCircle_11 = Sketch_2.addCircle(66.22695092615982, 10.77677442495125, 4.536925074373645) -SketchCircle_12 = Sketch_2.addCircle(50.98852111849166, 6.165144351577979, 3.547307159201085) +SketchCircle_1 = Sketch_2.addCircle( + 9.082839147404137, 71.32948234489588, 2.005056553640547 +) +SketchCircle_2 = Sketch_2.addCircle( + 20.11065019242717, 63.7102674410618, 2.268462537186828 +) +SketchCircle_3 = Sketch_2.addCircle( + 26.52683116407693, 51.67992811921848, 2.727171758268866 +) +SketchCircle_4 = Sketch_2.addCircle( + 38.35666483055617, 58.29661474623231, 3.007584830460834 +) +SketchCircle_5 = Sketch_2.addCircle( + 33.94554041254697, 44.0607132153844, 3.054011155390377 +) +SketchCircle_6 = Sketch_2.addCircle( + 48.58245325412298, 42.45666797247195, 2.346858526438435 +) +SketchCircle_7 = Sketch_2.addCircle( + 38.95818179664835, 31.42885692744893, 3.547307159201095 +) +SketchCircle_8 = Sketch_2.addCircle( + 63.82088306179116, 27.41874382016783, 4.536925074373651 +) +SketchCircle_9 = Sketch_2.addCircle( + 50.18649849703544, 28.4212720969881, 4.820482891521984 +) +SketchCircle_10 = Sketch_2.addCircle( + 49.58498153094326, 15.18789884296047, 2.552020354335177 +) +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/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_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_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/Modified_Vertex&Sketch_1/SketchLine_9_StartVertex&Sketch_1/SketchLine_7_EndVertex")) -SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchPoint_1.result()) +SketchPoint_1 = Sketch_3.addPoint( + model.selection( + "VERTEX", + "Face_1_1/Modified_Vertex&Sketch_1/SketchLine_9_StartVertex&Sketch_1/SketchLine_7_EndVertex", + ) +) +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 = 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 = 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 = 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 = Sketch_3.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_26") SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_12.result()) SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_13.result()) SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_14.result()) -SketchConstraintEqual_5 = Sketch_3.setEqual(SketchLine_14.result(), SketchLine_13.result()) +SketchConstraintEqual_5 = Sketch_3.setEqual( + SketchLine_14.result(), SketchLine_13.result() +) 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/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) +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/Modified_Vertex&Sketch_1/SketchLine_9_StartVertex&Sketch_1/SketchLine_7_EndVertex"), model.selection("VERTEX", "Face_4_1/Modified_Vertex&Sketch_1/SketchLine_6_StartVertex&Sketch_1/SketchLine_5_EndVertex")) -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) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("FACE", "Recover_1_1")], + model.selection( + "VERTEX", + "Face_4_1/Modified_Vertex&Sketch_1/SketchLine_9_StartVertex&Sketch_1/SketchLine_7_EndVertex", + ), + model.selection( + "VERTEX", + "Face_4_1/Modified_Vertex&Sketch_1/SketchLine_6_StartVertex&Sketch_1/SketchLine_5_EndVertex", + ), +) +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/Modified_Vertex&Sketch_1/SketchLine_9_StartVertex&Sketch_1/SketchLine_7_EndVertex"), model.selection("VERTEX", "Face_4_1/Modified_Vertex&Sketch_1/SketchLine_4_StartVertex&Sketch_1/SketchLine_3_EndVertex")) -LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_2_1")], model.selection("EDGE", "PartSet/OX"), "l", 4) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("FACE", "Recover_2_1")], + model.selection( + "VERTEX", + "Face_4_1/Modified_Vertex&Sketch_1/SketchLine_9_StartVertex&Sketch_1/SketchLine_7_EndVertex", + ), + model.selection( + "VERTEX", + "Face_4_1/Modified_Vertex&Sketch_1/SketchLine_4_StartVertex&Sketch_1/SketchLine_3_EndVertex", + ), +) +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/Modified_Vertex&Sketch_1/SketchLine_9_StartVertex&Sketch_1/SketchLine_7_EndVertex"), model.selection("VERTEX", "LinearCopy_3_1_1/MV:Translated&Sketch_3/SketchLine_12_EndVertex&Sketch_3/SketchLine_13_StartVertex")) -LinearCopy_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_3_1")], model.selection("EDGE", "PartSet/OX"), "l", 3) +Translation_3 = model.addTranslation( + Part_1_doc, + [model.selection("FACE", "Recover_3_1")], + model.selection( + "VERTEX", + "Face_4_1/Modified_Vertex&Sketch_1/SketchLine_9_StartVertex&Sketch_1/SketchLine_7_EndVertex", + ), + model.selection( + "VERTEX", + "LinearCopy_3_1_1/MV:Translated&Sketch_3/SketchLine_12_EndVertex&Sketch_3/SketchLine_13_StartVertex", + ), +) +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/Modified_Vertex&Sketch_1/SketchLine_9_StartVertex&Sketch_1/SketchLine_7_EndVertex"), model.selection("VERTEX", "Face_4_1/Modified_Vertex&Sketch_1/SketchLine_10_StartVertex&Sketch_1/SketchLine_1_StartVertex")) -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")] +Translation_4 = model.addTranslation( + Part_1_doc, + [model.selection("FACE", "Recover_4_1")], + model.selection( + "VERTEX", + "Face_4_1/Modified_Vertex&Sketch_1/SketchLine_9_StartVertex&Sketch_1/SketchLine_7_EndVertex", + ), + model.selection( + "VERTEX", + "Face_4_1/Modified_Vertex&Sketch_1/SketchLine_10_StartVertex&Sketch_1/SketchLine_1_StartVertex", + ), +) +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_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_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") @@ -150,9 +427,52 @@ 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_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_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_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() @@ -166,14 +486,15 @@ model.end() # check that all groups are correct from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() for Group in [Group_1, Group_2, Group_3]: - assert(aFactory.validate(Group.feature())) - assert(Group.groupList().size() != 0) - for a in range(Group.groupList().size()): - assert(Group.groupList().value(a).value().shapeTypeStr() == "FACE") - assert(len(Group.groupList().value(a).namingName()) > 0) + assert aFactory.validate(Group.feature()) + assert Group.groupList().size() != 0 + for a in range(Group.groupList().size()): + assert Group.groupList().value(a).value().shapeTypeStr() == "FACE" + assert len(Group.groupList().value(a).namingName()) > 0 # for the issue #2892 check fix -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test2252.py b/src/ModelAPI/Test/Test2252.py index df32c1f85..258962f5e 100644 --- a/src/ModelAPI/Test/Test2252.py +++ b/src/ModelAPI/Test/Test2252.py @@ -28,41 +28,71 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(60, 0, 0, 0) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 60) SketchLine_3 = Sketch_1.addLine(0, 60, 60, 60) SketchLine_4 = Sketch_1.addLine(60, 60, 60, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 60) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) +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_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], 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) -Translation_1 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("EDGE", "OX"), 100) +Translation_1 = model.addTranslation( + partSet, + [model.selection("COMPOUND", "Part_1/")], + model.selection("EDGE", "OX"), + 100, +) model.do() # move timeline before Translation partSet.setCurrentFeature(Part_1.feature(), True) -Rotation_1 = model.addRotation(partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("EDGE", "OY"), 90) +Rotation_1 = model.addRotation( + partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("EDGE", "OY"), 90 +) model.do() # move timeline to the end of history partSet.setCurrentFeature(Translation_1.feature(), True) model.end() # check that rotation then translation were applied consequently -assert(partSet.size("Parts") == 1) +assert partSet.size("Parts") == 1 resShape = modelAPI_Result(partSet.object("Parts", 0)).shape() # height of extrusion 90 / 2 + translation 100 -assert(GeomAlgoAPI_ShapeTools.centreOfMass(resShape).x() == 145) +assert GeomAlgoAPI_ShapeTools.centreOfMass(resShape).x() == 145 # rotated -assert(floor(GeomAlgoAPI_ShapeTools.centreOfMass(resShape).z()) == -30) +assert floor(GeomAlgoAPI_ShapeTools.centreOfMass(resShape).z()) == -30 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test2276.py b/src/ModelAPI/Test/Test2276.py index 9a0e94be1..94944e285 100644 --- a/src/ModelAPI/Test/Test2276.py +++ b/src/ModelAPI/Test/Test2276.py @@ -24,16 +24,34 @@ 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.954190485756754, -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_2r")], model.selection(), 10, 0) +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) +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.954190485756754, -75.16051465706819, 33.11263086848982) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchCircle_2.center()) +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()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test2358_1.py b/src/ModelAPI/Test/Test2358_1.py index 3d59fb5c7..08e6a2586 100644 --- a/src/ModelAPI/Test/Test2358_1.py +++ b/src/ModelAPI/Test/Test2358_1.py @@ -26,26 +26,65 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 0, 50) SketchLine_2 = Sketch_1.addLine(0, 50, 50, 50) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(50, 50, 50, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(50, 0, 0, 0) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) SketchConstraintRigid_1 = Sketch_1.setFixed(SketchLine_1.startPoint()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), 50) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 50) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_1.result(), SketchLine_3.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_4.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result()) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_1.result(), SketchLine_3.result() +) +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_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], 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) +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"), 0, model.selection(), 0) -Cut_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) @@ -66,4 +105,4 @@ model.testResultsVolumes(Cut_1, [101488.717162133529200218617916107]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test2358_2.py b/src/ModelAPI/Test/Test2358_2.py index d83c73e4a..4efb5265a 100644 --- a/src/ModelAPI/Test/Test2358_2.py +++ b/src/ModelAPI/Test/Test2358_2.py @@ -27,30 +27,59 @@ model.addParameter(Part_1_doc, "h", "100") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 0, 50) SketchLine_2 = Sketch_1.addLine(0, 50, 50, 50) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(50, 50, 50, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(50, 0, 0, 0) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) SketchConstraintRigid_1 = Sketch_1.setFixed(SketchLine_1.startPoint()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), 50) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 50) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_1.result(), SketchLine_3.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_4.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result()) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_1.result(), SketchLine_3.result() +) +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_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], 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") SketchLine_5.result().setName("SketchLine_9") -SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_1 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_6 = SketchProjection_1.createdFeature() SketchLine_6.setName("SketchLine_10") SketchLine_6.result().setName("SketchLine_10") -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.result() +) SketchLine_7 = Sketch_2.addLine(0, 21.9014765990379, 0, 31.9014765990379) SketchLine_7.setName("SketchLine_11") SketchLine_7.result().setName("SketchLine_11") @@ -60,10 +89,18 @@ SketchLine_8.result().setName("SketchLine_12") SketchLine_9 = Sketch_2.addLine(10, 31.9014765990379, 10, 21.9014765990379) SketchLine_9.setName("SketchLine_13") SketchLine_9.result().setName("SketchLine_13") -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_8.result()) @@ -73,16 +110,34 @@ 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/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")]) +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") SketchLine_10.result().setName("SketchLine_14") -SketchProjection_2 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_2 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_11 = SketchProjection_2.createdFeature() SketchLine_11.setName("SketchLine_15") SketchLine_11.result().setName("SketchLine_15") -SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.result()) +SketchConstraintCoincidence_10 = Sketch_3.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.result() +) SketchLine_12 = Sketch_3.addLine(19.60939424565112, 0, 19.60939424565112, 5) SketchLine_12.setName("SketchLine_16") SketchLine_12.result().setName("SketchLine_16") @@ -92,10 +147,18 @@ SketchLine_13.result().setName("SketchLine_17") SketchLine_14 = Sketch_3.addLine(29.60939424565112, 5, 29.60939424565112, 0) SketchLine_14.setName("SketchLine_18") SketchLine_14.result().setName("SketchLine_18") -SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_11 = Sketch_3.setCoincident( + SketchLine_14.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_3.setCoincident( + SketchLine_10.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_3.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_10.result()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_12.result()) SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_13.result()) @@ -105,18 +168,126 @@ SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_13.result(), 10) 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/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]")] +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/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/GF:Fillet&Fillet_1_1/FilletSelected_14)(Fillet_1_1/MF:Fillet_Face&Sketch_3/SketchLine_12)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_15)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_1)"), -model.selection("FACE", "(Fillet_1_1/MF:Fillet_Face&Sketch_3/SketchLine_12)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_11)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_16)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_2)"), -model.selection("FACE", "(Fillet_1_1/MF:Fillet_Face&Sketch_3/SketchLine_9)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_13)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_6)"), -model.selection("FACE", "(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_5)(Fillet_1_1/MF:Fillet_Face&Sketch_3/SketchLine_9)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_12)") + model.selection( + "FACE", + "(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_14)(Fillet_1_1/MF:Fillet_Face&Sketch_3/SketchLine_12)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_15)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_1)", + ), + model.selection( + "FACE", + "(Fillet_1_1/MF:Fillet_Face&Sketch_3/SketchLine_12)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_11)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_16)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_2)", + ), + model.selection( + "FACE", + "(Fillet_1_1/MF:Fillet_Face&Sketch_3/SketchLine_9)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_13)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_6)", + ), + model.selection( + "FACE", + "(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_5)(Fillet_1_1/MF:Fillet_Face&Sketch_3/SketchLine_9)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_12)", + ), ] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) -Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_9][Fillet_1_1/MF:Fillet_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "[Fillet_1_1/MF:Fillet_Face&Sketch_1/SketchLine_3][Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_9]")]) -Group_3 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Fillet_1_1/MF:Fillet_Face&Sketch_3/SketchLine_9][ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchLine_13][Fillet_1_1/MF:Fillet_Face&Sketch_1/SketchLine_3]"), model.selection("VERTEX", "[ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchLine_13][Fillet_1_1/MF:Fillet_Face&Sketch_1/SketchLine_3][Fillet_1_1/MF:Fillet_Face&Sketch_3/SketchLine_12]")]) +Group_2 = model.addGroup( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_9][Fillet_1_1/MF:Fillet_Face&Extrusion_1_1/To_Face]", + ), + model.selection( + "EDGE", + "[Fillet_1_1/MF:Fillet_Face&Sketch_1/SketchLine_3][Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_9]", + ), + ], +) +Group_3 = model.addGroup( + Part_1_doc, + [ + model.selection( + "VERTEX", + "[Fillet_1_1/MF:Fillet_Face&Sketch_3/SketchLine_9][ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchLine_13][Fillet_1_1/MF:Fillet_Face&Sketch_1/SketchLine_3]", + ), + model.selection( + "VERTEX", + "[ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchLine_13][Fillet_1_1/MF:Fillet_Face&Sketch_1/SketchLine_3][Fillet_1_1/MF:Fillet_Face&Sketch_3/SketchLine_12]", + ), + ], +) model.do() Folder_1 = model.addFolder(Part_1_doc, Sketch_3, ExtrusionCut_2) @@ -141,4 +312,4 @@ model.checkGroup(Group_3, GeomAPI_Shape.VERTEX) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test2389.py b/src/ModelAPI/Test/Test2389.py index c79586094..222f7781a 100644 --- a/src/ModelAPI/Test/Test2389.py +++ b/src/ModelAPI/Test/Test2389.py @@ -31,40 +31,68 @@ 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) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 36) SketchLine_3 = Sketch_1.addLine(0, 36, 64, 36) SketchLine_4 = Sketch_1.addLine(64, 36, 64, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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_3.startPoint(), SketchLine_3.endPoint(), "Width") +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_3.startPoint(), SketchLine_3.endPoint(), "Width" +) 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()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_3.result() +) 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()) +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() +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_6.result()) -SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_2.endPoint(), SketchLine_5.startPoint(), "Width/32*11") -SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance(SketchLine_6.startPoint(), SketchLine_3.endPoint(), "Width/2") +SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance( + SketchLine_2.endPoint(), SketchLine_5.startPoint(), "Width/32*11" +) +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/SketchLine_5_StartVertex"), 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() != "") +assert SketchProjection_2.external().namingName() != "" -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test2391.py b/src/ModelAPI/Test/Test2391.py index 3da9a4e88..8b96936a9 100644 --- a/src/ModelAPI/Test/Test2391.py +++ b/src/ModelAPI/Test/Test2391.py @@ -51,163 +51,383 @@ model.addParameter(Part_1_doc, "Slot_Width", "8") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 3, 0.5, 2.5) SketchLine_2 = Sketch_1.addLine(0.5, 2.5, 9.5, 2.5) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(9.5, 2.5, 9.5, 3.1) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(9.5, 3.1, 24.86574363608673, 3.1) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(24.86574363608673, 3.1, 26, 3.3) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(26, 3.3, 26, 5.5) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(31, 10.5, 64, 10.5) SketchLine_8 = Sketch_1.addLine(64, 10.5, 64, 15) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(64, 15, 61, 15) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchLine_10 = Sketch_1.addLine(61, 15, 61, 12.75) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchLine_11 = Sketch_1.addLine(61, 12.75, 58, 12.75) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchLine_12 = Sketch_1.addLine(58, 12.75, 58, 14) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchLine_13 = Sketch_1.addLine(58, 14, 57, 15) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchLine_14 = Sketch_1.addLine(57, 15, 54, 15) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchLine_15 = Sketch_1.addLine(54, 15, 52.5, 16.5) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) SketchLine_16 = Sketch_1.addLine(52.5, 16.5, 35, 16.5) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) SketchLine_17 = Sketch_1.addLine(35, 16.5, 34, 15.5) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) SketchLine_18 = Sketch_1.addLine(34, 15.5, 32, 15.5) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) SketchLine_19 = Sketch_1.addLine(32, 15.5, 32, 19) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) SketchLine_20 = Sketch_1.addLine(32, 19, 22.5, 19) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) SketchLine_21 = Sketch_1.addLine(22.5, 19, 22.5, 13) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.startPoint() +) SketchLine_22 = Sketch_1.addLine(22.5, 13, 22, 12.5) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchLine_22.startPoint() +) SketchLine_23 = Sketch_1.addLine(22, 12.5, 22, 10) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.startPoint() +) SketchLine_24 = Sketch_1.addLine(22, 10, 20, 10) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_23.endPoint(), SketchLine_24.startPoint() +) SketchLine_25 = Sketch_1.addLine(20, 10, 20, 8.699999999999999) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_24.endPoint(), SketchLine_25.startPoint() +) SketchLine_26 = Sketch_1.addLine(20, 8.699999999999999, 18.5, 8.699999999999999) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_26.startPoint()) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_25.endPoint(), SketchLine_26.startPoint() +) SketchLine_27 = Sketch_1.addLine(18.5, 8.699999999999999, 18.5, 10) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_26.endPoint(), SketchLine_27.startPoint()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_26.endPoint(), SketchLine_27.startPoint() +) SketchLine_28 = Sketch_1.addLine(18.5, 10, 10.5, 10) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchLine_27.endPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchLine_27.endPoint(), SketchLine_28.startPoint() +) SketchLine_29 = Sketch_1.addLine(10.5, 10, 10.5, 8.699999999999999) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_28.endPoint(), SketchLine_29.startPoint() +) SketchLine_30 = Sketch_1.addLine(10.5, 8.699999999999999, 9, 8.699999999999999) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchLine_29.endPoint(), SketchLine_30.startPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchLine_29.endPoint(), SketchLine_30.startPoint() +) SketchLine_31 = Sketch_1.addLine(9, 8.699999999999999, 9, 10) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) SketchLine_32 = Sketch_1.addLine(9, 10, 0.5, 10) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchLine_31.endPoint(), SketchLine_32.startPoint() +) SketchLine_33 = Sketch_1.addLine(0.5, 10, 0, 9.5) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchLine_32.endPoint(), SketchLine_33.startPoint() +) SketchLine_34 = Sketch_1.addLine(0, 9.5, 0, 3) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchLine_33.endPoint(), SketchLine_34.startPoint()) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_34.endPoint()) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchLine_33.endPoint(), SketchLine_34.startPoint() +) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_34.endPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) -SketchConstraintAngle_1 = Sketch_1.setAngleComplementary(SketchLine_4.result(), SketchLine_5.result(), 10.00000000008873) +SketchConstraintAngle_1 = Sketch_1.setAngleComplementary( + SketchLine_4.result(), SketchLine_5.result(), 10.00000000008873 +) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.endPoint(), "D2_in/2") +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.endPoint(), "D2_in/2" +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_16.result(), SketchLine_7.result()) -SketchConstraintAngle_2 = Sketch_1.setAngleComplementary(SketchLine_15.result(), SketchLine_16.result(), 45.00000000000006) -SketchConstraintAngle_3 = Sketch_1.setAngleComplementary(SketchLine_13.result(), SketchLine_14.result(), 45.00000000000006) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_16.result(), SketchLine_7.result() +) +SketchConstraintAngle_2 = Sketch_1.setAngleComplementary( + SketchLine_15.result(), SketchLine_16.result(), 45.00000000000006 +) +SketchConstraintAngle_3 = Sketch_1.setAngleComplementary( + SketchLine_13.result(), SketchLine_14.result(), 45.00000000000006 +) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_12.result()) SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_10.result()) SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_11.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_17.result(), SketchLine_15.result()) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_17.result(), SketchLine_15.result() +) SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_19.result()) SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_18.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_20.result(), SketchLine_7.result()) -SketchConstraintParallel_3 = Sketch_1.setParallel(SketchLine_21.result(), SketchLine_19.result()) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_20.result(), SketchLine_7.result() +) +SketchConstraintParallel_3 = Sketch_1.setParallel( + SketchLine_21.result(), SketchLine_19.result() +) SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_23.result()) SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_24.result()) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_28.result(), SketchLine_24.result()) -SketchConstraintCollinear_2 = Sketch_1.setCollinear(SketchLine_32.result(), SketchLine_28.result()) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_28.result(), SketchLine_24.result() +) +SketchConstraintCollinear_2 = Sketch_1.setCollinear( + SketchLine_32.result(), SketchLine_28.result() +) SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_34.result()) SketchConstraintHorizontal_8 = Sketch_1.setHorizontal(SketchLine_30.result()) -SketchConstraintCollinear_3 = Sketch_1.setCollinear(SketchLine_26.result(), SketchLine_30.result()) +SketchConstraintCollinear_3 = Sketch_1.setCollinear( + SketchLine_26.result(), SketchLine_30.result() +) SketchConstraintVertical_9 = Sketch_1.setVertical(SketchLine_31.result()) SketchConstraintVertical_10 = Sketch_1.setVertical(SketchLine_29.result()) SketchConstraintVertical_11 = Sketch_1.setVertical(SketchLine_27.result()) SketchConstraintVertical_12 = Sketch_1.setVertical(SketchLine_25.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_24.result(), "D4_out/2", True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_30.result(), "D4_out/2-Channel_Depth", True) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_34.endPoint(), SketchLine_1.endPoint(), "Chamfer") -SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchLine_1.endPoint(), SketchLine_1.startPoint(), "Chamfer") -SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_34.startPoint(), SketchLine_33.startPoint(), "Chamfer") -SketchConstraintDistanceVertical_3 = Sketch_1.setVerticalDistance(SketchLine_34.startPoint(), SketchLine_33.startPoint(), "Chamfer") -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), + SketchLine_24.result(), + "D4_out/2", + True, +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), + SketchLine_30.result(), + "D4_out/2-Channel_Depth", + True, +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_34.endPoint(), SketchLine_1.endPoint(), "Chamfer" +) +SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance( + SketchLine_1.endPoint(), SketchLine_1.startPoint(), "Chamfer" +) +SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance( + SketchLine_34.startPoint(), SketchLine_33.startPoint(), "Chamfer" +) +SketchConstraintDistanceVertical_3 = Sketch_1.setVerticalDistance( + SketchLine_34.startPoint(), SketchLine_33.startPoint(), "Chamfer" +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_35 = SketchProjection_2.createdFeature() -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_35.result(), "D2_in/2+0.6", True) -SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance(SketchLine_3.endPoint(), SketchLine_5.endPoint(), "Depth/2") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_5.endPoint(), SketchLine_35.result(), "D2_in/2+0.8", True) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_35.result(), "D2_in/2+0.6", True +) +SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance( + SketchLine_3.endPoint(), SketchLine_5.endPoint(), "Depth/2" +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_5.endPoint(), SketchLine_35.result(), "D2_in/2+0.8", True +) SketchArc_1 = Sketch_1.addArc(31, 5.5, 31, 10.5, 26, 5.5, False) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_6.endPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_7.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_6.result()) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_6.endPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_7.result() +) +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.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") -SketchConstraintDistanceHorizontal_6 = Sketch_1.setHorizontalDistance(SketchLine_15.startPoint(), SketchLine_8.endPoint(), 10) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_35.result(), "D3_out/2", True) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_11.startPoint(), SketchLine_35.result(), "(D3_out+D1_in)/4", True) -SketchConstraintDistanceHorizontal_7 = Sketch_1.setHorizontalDistance(SketchLine_10.startPoint(), SketchLine_8.endPoint(), 3) -SketchConstraintDistanceHorizontal_8 = Sketch_1.setHorizontalDistance(SketchLine_12.endPoint(), SketchLine_10.startPoint(), 3) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_30.result(), SketchLine_26.result()) +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.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" +) +SketchConstraintDistanceHorizontal_6 = Sketch_1.setHorizontalDistance( + SketchLine_15.startPoint(), SketchLine_8.endPoint(), 10 +) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_35.result(), "D3_out/2", True +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchLine_11.startPoint(), SketchLine_35.result(), "(D3_out+D1_in)/4", True +) +SketchConstraintDistanceHorizontal_7 = Sketch_1.setHorizontalDistance( + SketchLine_10.startPoint(), SketchLine_8.endPoint(), 3 +) +SketchConstraintDistanceHorizontal_8 = Sketch_1.setHorizontalDistance( + SketchLine_12.endPoint(), SketchLine_10.startPoint(), 3 +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_30.result(), SketchLine_26.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_26.result(), "Channel_Width") -SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_28.result(), "Drill1Holder_Width") -SketchConstraintDistanceHorizontal_9 = Sketch_1.setHorizontalDistance(SketchArc_1.center(), SketchLine_7.endPoint(), "Depth") -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_16.startPoint(), SketchLine_35.result(), "D2_out/2", True) -SketchConstraintDistanceHorizontal_10 = Sketch_1.setHorizontalDistance(SketchLine_20.startPoint(), SketchLine_8.endPoint(), "Width/2") -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_17.endPoint(), SketchLine_35.result(), "D2_out/2-1", True) -SketchConstraintDistanceHorizontal_11 = Sketch_1.setHorizontalDistance(SketchLine_20.startPoint(), SketchLine_17.endPoint(), 2) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_35).startPoint(), SketchLine_34.result()) -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_35).startPoint(), SketchLine_20.result(), "D1_out/2", True) +SketchConstraintLength_2 = Sketch_1.setLength( + SketchLine_28.result(), "Drill1Holder_Width" +) +SketchConstraintDistanceHorizontal_9 = Sketch_1.setHorizontalDistance( + SketchArc_1.center(), SketchLine_7.endPoint(), "Depth" +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchLine_16.startPoint(), SketchLine_35.result(), "D2_out/2", True +) +SketchConstraintDistanceHorizontal_10 = Sketch_1.setHorizontalDistance( + SketchLine_20.startPoint(), SketchLine_8.endPoint(), "Width/2" +) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_17.endPoint(), SketchLine_35.result(), "D2_out/2-1", True +) +SketchConstraintDistanceHorizontal_11 = Sketch_1.setHorizontalDistance( + SketchLine_20.startPoint(), SketchLine_17.endPoint(), 2 +) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_35).startPoint(), SketchLine_34.result() +) +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_35).startPoint(), SketchLine_20.result(), "D1_out/2", True +) SketchPoint_2 = Sketch_1.addPoint(14.5, 10) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_28.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchPoint_2.coordinates(), SketchLine_28.result()) -SketchConstraintDistanceHorizontal_12 = Sketch_1.setHorizontalDistance(SketchPoint_2.coordinates(), SketchLine_24.startPoint(), "Drill1_Loc") -SketchConstraintDistanceHorizontal_13 = Sketch_1.setHorizontalDistance(SketchLine_34.startPoint(), SketchLine_9.startPoint(), "Width") -SketchConstraintDistanceHorizontal_14 = Sketch_1.setHorizontalDistance(SketchLine_14.startPoint(), SketchLine_12.endPoint(), 1) -SketchConstraintDistance_11 = Sketch_1.setDistance(SketchLine_23.startPoint(), SketchLine_35.result(), "(D4_out+D2_in)/2", True) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_28.result() +) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchPoint_2.coordinates(), SketchLine_28.result() +) +SketchConstraintDistanceHorizontal_12 = Sketch_1.setHorizontalDistance( + SketchPoint_2.coordinates(), SketchLine_24.startPoint(), "Drill1_Loc" +) +SketchConstraintDistanceHorizontal_13 = Sketch_1.setHorizontalDistance( + SketchLine_34.startPoint(), SketchLine_9.startPoint(), "Width" +) +SketchConstraintDistanceHorizontal_14 = Sketch_1.setHorizontalDistance( + SketchLine_14.startPoint(), SketchLine_12.endPoint(), 1 +) +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/SketchPoint_2"), True) +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/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/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&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) +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") +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&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")] +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&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() @@ -216,11 +436,13 @@ WidthParam.setValue(80) model.do() import ModelAPI -assert(ModelAPI.ModelAPI_Session.get().validators().validate(Fillet_2.feature())) + +assert ModelAPI.ModelAPI_Session.get().validators().validate(Fillet_2.feature()) from GeomAPI import * + model.testHaveNamingByType(Fillet_2, model, Part_1_doc, GeomAPI_Shape.FACE) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test2396.py b/src/ModelAPI/Test/Test2396.py index 10cbf0b2a..00be7025d 100644 --- a/src/ModelAPI/Test/Test2396.py +++ b/src/ModelAPI/Test/Test2396.py @@ -29,29 +29,99 @@ SketchLine_1 = Sketch_1.addLine(50, -50, -50, -50) SketchLine_2 = Sketch_1.addLine(-50, -50, -50, 50) SketchLine_3 = Sketch_1.addLine(-50, 50, 50, 50) SketchLine_4 = Sketch_1.addLine(50, 50, 50, -50) -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()) +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_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], 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/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_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() for res in Edge_1.results(): names.add(res.name()) -assert(len(names) == len(Edge_1.results())), "Some edges have equal name" +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_2r")], 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) @@ -64,4 +134,4 @@ model.testResultsVolumes(Extrusion_2, [78539.81633974483]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test2401.py b/src/ModelAPI/Test/Test2401.py index 41e9d4a50..64c4c8889 100644 --- a/src/ModelAPI/Test/Test2401.py +++ b/src/ModelAPI/Test/Test2401.py @@ -25,58 +25,134 @@ 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(0, 0, 0, 3) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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) +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()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) SketchLine_3 = Sketch_1.addLine(0, 3, 4, 7) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(4, 7, 8, 3) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(8, 3, 8, 0) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchProjection_3 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_6 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.result() +) SketchLine_7 = Sketch_1.addLine(8, 0, 0, 0) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_7.endPoint()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_3.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_3.result(), SketchLine_4.result()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_7.endPoint() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_4.result(), SketchLine_3.result() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_3.result(), SketchLine_4.result() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_1.result()) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_1.result() +) 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_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) +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) -SketchLine_10 = Sketch_2.addLine(-1.095841663628257, -5.449377136847041, 7.560741003605092, -5.449377136847041) -SketchLine_11 = Sketch_2.addLine(7.560741003605092, -5.449377136847041, 7.560741003605092, 9.43062705614625) -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()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +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 +) +SketchLine_10 = Sketch_2.addLine( + -1.095841663628257, -5.449377136847041, 7.560741003605092, -5.449377136847041 +) +SketchLine_11 = Sketch_2.addLine( + 7.560741003605092, -5.449377136847041, 7.560741003605092, 9.43062705614625 +) +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() +) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_8.result()) 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_8r-SketchLine_9f-SketchLine_10f-SketchLine_11f")]) -Split_1 = model.addSplit(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", + ) + ], +) +Split_1 = model.addSplit( + 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 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()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_8.endPoint() +) model.end() # check that the plane is located as previously model.testNbSubResults(Split_1, [2]) model.testResultsVolumes(Split_1, [120]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test2413.py b/src/ModelAPI/Test/Test2413.py index 7b7f6a718..f6121247e 100644 --- a/src/ModelAPI/Test/Test2413.py +++ b/src/ModelAPI/Test/Test2413.py @@ -25,54 +25,115 @@ 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(0, 0, 0, 50) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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) +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()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) SketchArc_1 = Sketch_1.addArc(0, 0, 0, 50, 50, 0, True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.center()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_1.center() +) SketchLine_3 = Sketch_1.addLine(0, 0, 50, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5") -SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_3 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_4 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.result()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.result() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_6") -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_3.endPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_1.endPoint() +) 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_3f-SketchArc_1_2f-SketchLine_1r")], 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&Sketch_1/SketchLine_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 * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Solid_1.feature()) == False) +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"), 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) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +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 +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_9") -SketchLine_7 = Sketch_2.addLine(18.50962242738747, 32.13572332177004, 14.9039069695087, 8.923908092675951) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchLine_7 = Sketch_2.addLine( + 18.50962242738747, 32.13572332177004, 14.9039069695087, 8.923908092675951 +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10") -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchLine_7.endPoint()) +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_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")] +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(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test2491.py b/src/ModelAPI/Test/Test2491.py index 6b91a5051..b323b0d99 100644 --- a/src/ModelAPI/Test/Test2491.py +++ b/src/ModelAPI/Test/Test2491.py @@ -26,29 +26,67 @@ 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(-17.23654191510763, 16.36770059625792, -4.760492650097915, 19.42518236023452) +SketchLine_1 = Sketch_1.addLine( + -17.23654191510763, 16.36770059625792, -4.760492650097915, 19.42518236023452 +) SketchLine_2 = Sketch_1.addLine(20, 2.492755359431925e-15, 20, -31) SketchLine_3 = Sketch_1.addLine(-25.74772708486752, -20, -17.21320343559642, -20) -SketchLine_4 = Sketch_1.addLine(-13.67766952966368, -21.46446609406726, 2.928932188134523, -38.07106781186547) -SketchArc_1 = Sketch_1.addArc(-17.21320343559642, -25, -13.67766952966368, -21.46446609406726, -17.21320343559642, -20, False) +SketchLine_4 = Sketch_1.addLine( + -13.67766952966368, -21.46446609406726, 2.928932188134523, -38.07106781186547 +) +SketchArc_1 = Sketch_1.addArc( + -17.21320343559642, + -25, + -13.67766952966368, + -21.46446609406726, + -17.21320343559642, + -20, + False, +) Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_4.startPoint()) Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_3.endPoint()) Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_4.result()) Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_3.result()) Sketch_1.setHorizontal(SketchLine_3.result()) Sketch_1.setVertical(SketchLine_2.result()) -SketchArc_2 = Sketch_1.addArc(0, 6.520200294596256e-23, -4.760492650097915, 19.42518236023452, 20, 2.492755359431925e-15, True) +SketchArc_2 = Sketch_1.addArc( + 0, + 6.520200294596256e-23, + -4.760492650097915, + 19.42518236023452, + 20, + 2.492755359431925e-15, + True, +) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_2.startPoint()) -SketchArc_3 = Sketch_1.addArc(-12, -5, -29.79117622747561, -17.94117647058824, -17.23654191510763, 16.36770059625792, True) +SketchArc_3 = Sketch_1.addArc( + -12, + -5, + -29.79117622747561, + -17.94117647058824, + -17.23654191510763, + 16.36770059625792, + True, +) Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_1.startPoint()) Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_1.result()) Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_2.startPoint()) -SketchArc_4 = Sketch_1.addArc(-25.74772708486752, -15, -29.79117622747561, -17.94117647058824, -25.74772708486752, -20, False) +SketchArc_4 = Sketch_1.addArc( + -25.74772708486752, + -15, + -29.79117622747561, + -17.94117647058824, + -25.74772708486752, + -20, + False, +) Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchArc_3.startPoint()) Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_3.startPoint()) Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_3.result()) Sketch_1.setTangent(SketchArc_4.results()[1], SketchArc_3.results()[1]) -SketchArc_5 = Sketch_1.addArc(10, -31, 20, -31, 2.928932188134523, -38.07106781186547, True) +SketchArc_5 = Sketch_1.addArc( + 10, -31, 20, -31, 2.928932188134523, -38.07106781186547, True +) Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_5.startPoint()) Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_4.endPoint()) Sketch_1.setTangent(SketchArc_5.results()[1], SketchLine_4.result()) @@ -80,16 +118,42 @@ Sketch_1.setDistance(SketchCircle_2.center(), SketchLine_3.result(), 20, True) Sketch_1.setVerticalDistance(SketchArc_2.center(), SketchCircle_3.center(), 25) Sketch_1.setHorizontalDistance(SketchLine_5.endPoint(), SketchArc_2.center(), 12) Sketch_1.setHorizontalDistance(SketchCircle_1.center(), SketchArc_2.center(), 22) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -Sketch_1.setCoincident(SketchCircle_2.center(), SketchAPI_Point(SketchPoint_1).coordinates()) +Sketch_1.setCoincident( + SketchCircle_2.center(), SketchAPI_Point(SketchPoint_1).coordinates() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_3_2f-SketchArc_4_2f-SketchLine_3f-SketchArc_1_2r-SketchLine_4f-SketchArc_5_2f-SketchLine_2r-SketchArc_2_2f-SketchLine_1r-SketchCircle_1_2r-SketchCircle_2_2r-SketchCircle_3_2r")], model.selection(), 6.5, 0) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2")) -SketchLine_6 = Sketch_2.addLine(14.45330132699559, 5.092287733454298, -12.15814035598059, 5.092287733454298) -SketchLine_7 = Sketch_2.addLine(-12.15814035598059, 5.092287733454298, -12.15814035598059, 23.78152371848275) -SketchLine_8 = Sketch_2.addLine(-12.15814035598059, 23.78152371848275, 14.45330132699559, 23.78152371848275) -SketchLine_9 = Sketch_2.addLine(14.45330132699559, 23.78152371848275, 14.45330132699559, 5.092287733454298) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchArc_3_2f-SketchArc_4_2f-SketchLine_3f-SketchArc_1_2r-SketchLine_4f-SketchArc_5_2f-SketchLine_2r-SketchArc_2_2f-SketchLine_1r-SketchCircle_1_2r-SketchCircle_2_2r-SketchCircle_3_2r", + ) + ], + model.selection(), + 6.5, + 0, +) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"), +) +SketchLine_6 = Sketch_2.addLine( + 14.45330132699559, 5.092287733454298, -12.15814035598059, 5.092287733454298 +) +SketchLine_7 = Sketch_2.addLine( + -12.15814035598059, 5.092287733454298, -12.15814035598059, 23.78152371848275 +) +SketchLine_8 = Sketch_2.addLine( + -12.15814035598059, 23.78152371848275, 14.45330132699559, 23.78152371848275 +) +SketchLine_9 = Sketch_2.addLine( + 14.45330132699559, 23.78152371848275, 14.45330132699559, 5.092287733454298 +) Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_6.startPoint()) Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) @@ -99,8 +163,20 @@ Sketch_2.setVertical(SketchLine_7.result()) Sketch_2.setHorizontal(SketchLine_8.result()) Sketch_2.setVertical(SketchLine_9.result()) model.do() -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r")], model.selection(), 0, 100, [model.selection("SOLID", "Extrusion_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_2/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r", + ) + ], + model.selection(), + 0, + 100, + [model.selection("SOLID", "Extrusion_1_1")], +) model.do() model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test2493.py b/src/ModelAPI/Test/Test2493.py index 0c7b9d3f8..956728cfe 100644 --- a/src/ModelAPI/Test/Test2493.py +++ b/src/ModelAPI/Test/Test2493.py @@ -28,25 +28,39 @@ Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "h1", "15") model.addParameter(Part_1_doc, "h3", "7") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 24) SketchCircle_1.setAuxiliary(True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "48/2") SketchCircle_2 = Sketch_1.addCircle(0, -24, 4) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.results()[1], SketchCircle_2.center()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.results()[1], SketchCircle_2.center() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_1 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchLine_1.result()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchCircle_2.center(), SketchLine_1.result() +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchCircle_2.results()[1], 4) -SketchLine_2 = Sketch_1.addLine(-7.50000000000032, -15.81138830084174, -7.500000000000001, -27) +SketchLine_2 = Sketch_1.addLine( + -7.50000000000032, -15.81138830084174, -7.500000000000001, -27 +) SketchLine_2.setName("SketchLine_3") SketchLine_2.result().setName("SketchLine_3") SketchLine_3 = Sketch_1.addLine(-4.500000000000001, -30, 4.500000000000001, -30) SketchLine_3.setName("SketchLine_4") SketchLine_3.result().setName("SketchLine_4") -SketchLine_4 = Sketch_1.addLine(7.500000000000001, -27, 7.49999999999943, -15.81138830084217) +SketchLine_4 = Sketch_1.addLine( + 7.500000000000001, -27, 7.49999999999943, -15.81138830084217 +) SketchLine_4.setName("SketchLine_5") SketchLine_4.result().setName("SketchLine_5") SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) @@ -54,54 +68,130 @@ SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintHorizontal_1.setName("SketchConstraintHorizontal_2") SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) SketchPoint_2 = Sketch_1.addPoint(0, -30) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_3.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_3.result() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_8") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.result()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_1.result() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_9") -SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_3 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_5 = SketchProjection_3.createdFeature() SketchLine_5.setName("SketchLine_6") SketchLine_5.result().setName("SketchLine_6") -SketchArc_1 = Sketch_1.addArc(-4.500000000000001, -27, -7.500000000000001, -27, -4.500000000000001, -30, False) +SketchArc_1 = Sketch_1.addArc( + -4.500000000000001, -27, -7.500000000000001, -27, -4.500000000000001, -30, False +) SketchPoint_3 = Sketch_1.addPoint(-7.500000000000001, -30) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchPoint_3.coordinates(), SketchLine_5.result(), 30, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchPoint_3.coordinates(), SketchLine_5.result(), 30, True +) SketchPoint_3.setAuxiliary(True) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_2.result()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_2.result() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_11") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_3.result()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_3.result() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_12") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.endPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_2.endPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_13") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_14") -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_2.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_3.result()) -SketchArc_2 = Sketch_1.addArc(4.500000000000001, -27, 4.500000000000001, -30, 7.500000000000001, -27, False) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_2.result() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_3.result() +) +SketchArc_2 = Sketch_1.addArc( + 4.500000000000001, -27, 4.500000000000001, -30, 7.500000000000001, -27, False +) SketchPoint_4 = Sketch_1.addPoint(7.5, -30) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchPoint_3.coordinates(), SketchPoint_4.coordinates(), 15, False) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchPoint_3.coordinates(), SketchPoint_4.coordinates(), 15, False +) SketchPoint_4.setAuxiliary(True) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_4.result()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_4.result() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_15") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_3.result()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_3.result() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_16") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_3.endPoint() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_17") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_18") -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_4.result()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_3.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchPoint_2.coordinates(), SketchLine_3.result()) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_4.result() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_3.result() +) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchPoint_2.coordinates(), SketchLine_3.result() +) SketchConstraintRadius_4 = Sketch_1.setRadius(SketchArc_1.results()[1], 3) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_2.results()[1], SketchArc_1.results()[1]) -SketchArc_3 = Sketch_1.addArc(0, 0, 7.49999999999943, -15.81138830084217, 17.44306393762918, 1.410503622037278, False) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_3.center()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchArc_2.results()[1], SketchArc_1.results()[1] +) +SketchArc_3 = Sketch_1.addArc( + 0, + 0, + 7.49999999999943, + -15.81138830084217, + 17.44306393762918, + 1.410503622037278, + False, +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_3.center() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_10") SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_3.results()[1], "35/2") -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_4.endPoint()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchLine_4.endPoint() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_20") -SketchMultiRotation_1_objects = [SketchLine_2.result(), SketchArc_1.results()[1], SketchLine_3.result(), SketchArc_2.results()[1], SketchLine_4.result(), SketchCircle_2.results()[1]] -SketchMultiRotation_1 = Sketch_1.addRotation(SketchMultiRotation_1_objects, SketchAPI_Line(SketchLine_5).startPoint(), 120, 3) -[SketchLine_6, SketchLine_7, SketchArc_4, SketchArc_5, SketchLine_8, SketchLine_9, SketchArc_6, SketchArc_7, SketchLine_10, SketchLine_11, SketchCircle_3, SketchCircle_4] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1_objects = [ + SketchLine_2.result(), + SketchArc_1.results()[1], + SketchLine_3.result(), + SketchArc_2.results()[1], + SketchLine_4.result(), + SketchCircle_2.results()[1], +] +SketchMultiRotation_1 = Sketch_1.addRotation( + SketchMultiRotation_1_objects, SketchAPI_Line(SketchLine_5).startPoint(), 120, 3 +) +[ + SketchLine_6, + SketchLine_7, + SketchArc_4, + SketchArc_5, + SketchLine_8, + SketchLine_9, + SketchArc_6, + SketchArc_7, + SketchLine_10, + SketchLine_11, + SketchCircle_3, + SketchCircle_4, +] = SketchMultiRotation_1.rotated() SketchLine_11.setName("SketchLine_12") SketchLine_11.result().setName("SketchLine_12") SketchLine_10.setName("SketchLine_9") @@ -118,120 +208,243 @@ SketchLine_7.setName("SketchLine_10") SketchLine_7.result().setName("SketchLine_10") SketchLine_6.setName("SketchLine_7") SketchLine_6.result().setName("SketchLine_7") -SketchArc_8 = Sketch_1.addArc(0, 0, -17.4430639376291, 1.410503622038327, -7.50000000000032, -15.81138830084174, False) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchLine_2.startPoint()) +SketchArc_8 = Sketch_1.addArc( + 0, + 0, + -17.4430639376291, + 1.410503622038327, + -7.50000000000032, + -15.81138830084174, + False, +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_8.endPoint(), SketchLine_2.startPoint() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_21") -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchArc_3.results()[1], SketchArc_8.results()[1]) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_3.center(), SketchArc_8.center()) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchArc_3.results()[1], SketchArc_8.results()[1] +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchArc_8.center() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_19") -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_8.startPoint(), SketchLine_11.result()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchArc_8.startPoint(), SketchLine_11.result() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_22") -SketchArc_9 = Sketch_1.addArc(0, 0, 9.943063937629693, 14.40088467880386, -9.943063937628841, 14.40088467880445, False) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchArc_9.endPoint(), SketchLine_7.result()) +SketchArc_9 = Sketch_1.addArc( + 0, + 0, + 9.943063937629693, + 14.40088467880386, + -9.943063937628841, + 14.40088467880445, + False, +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchArc_9.endPoint(), SketchLine_7.result() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_23") -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchArc_3.results()[1], SketchArc_9.results()[1]) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchArc_3.center(), SketchArc_9.center()) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchArc_3.results()[1], SketchArc_9.results()[1] +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchArc_9.center() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_24") -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_6.result() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_25") -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_9.startPoint(), SketchLine_10.result()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchArc_9.startPoint(), SketchLine_10.result() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_26") model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchArc_1_2f-SketchLine_4f-SketchArc_2_2f-SketchLine_5f-SketchArc_3_2f-SketchLine_7f-SketchArc_4_2f-SketchLine_9f-SketchArc_5_2f-SketchLine_9f-SketchArc_9_2f-SketchLine_10f-SketchArc_6_2f-SketchLine_11f-SketchArc_7_2f-SketchLine_12f-SketchArc_8_2f-SketchCircle_2_2r-SketchCircle_4_2r-SketchCircle_3_2r")], model.selection(), "h1", 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_3f-SketchArc_1_2f-SketchLine_4f-SketchArc_2_2f-SketchLine_5f-SketchArc_3_2f-SketchLine_7f-SketchArc_4_2f-SketchLine_9f-SketchArc_5_2f-SketchLine_9f-SketchArc_9_2f-SketchLine_10f-SketchArc_6_2f-SketchLine_11f-SketchArc_7_2f-SketchLine_12f-SketchArc_8_2f-SketchCircle_2_2r-SketchCircle_4_2r-SketchCircle_3_2r", + ) + ], + model.selection(), + "h1", + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchLine_12 = Sketch_2.addLine(-7.499999999996014, 12.99038105676981, 7.499999999996014, 12.99038105676981) +SketchLine_12 = Sketch_2.addLine( + -7.499999999996014, 12.99038105676981, 7.499999999996014, 12.99038105676981 +) SketchLine_12.setName("SketchLine_13") SketchLine_12.result().setName("SketchLine_13") SketchLine_13 = Sketch_2.addLine(7.499999999996014, 12.99038105676981, 15, 0) SketchLine_13.setName("SketchLine_14") SketchLine_13.result().setName("SketchLine_14") -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_27") SketchLine_14 = Sketch_2.addLine(15, 0, 7.499999999996014, -12.99038105676981) SketchLine_14.setName("SketchLine_15") SketchLine_14.result().setName("SketchLine_15") -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_28") -SketchLine_15 = Sketch_2.addLine(7.499999999996014, -12.99038105676981, -7.499999999996014, -12.99038105676981) +SketchLine_15 = Sketch_2.addLine( + 7.499999999996014, -12.99038105676981, -7.499999999996014, -12.99038105676981 +) SketchLine_15.setName("SketchLine_16") SketchLine_15.result().setName("SketchLine_16") -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_29") SketchLine_16 = Sketch_2.addLine(-7.499999999996014, -12.99038105676981, -15, 0) SketchLine_16.setName("SketchLine_17") SketchLine_16.result().setName("SketchLine_17") -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_30") SketchLine_17 = Sketch_2.addLine(-15, 0, -7.499999999996014, 12.99038105676981) SketchLine_17.setName("SketchLine_18") SketchLine_17.result().setName("SketchLine_18") -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_31") -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_12.startPoint(), SketchLine_17.endPoint()) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchLine_12.startPoint(), SketchLine_17.endPoint() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_32") SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_12.result()) SketchConstraintHorizontal_2.setName("SketchConstraintHorizontal_3") SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_15.result()) SketchConstraintHorizontal_3.setName("SketchConstraintHorizontal_4") -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_18 = SketchProjection_4.createdFeature() SketchLine_18.setName("SketchLine_19") SketchLine_18.result().setName("SketchLine_19") -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_19 = SketchProjection_5.createdFeature() SketchLine_19.setName("SketchLine_20") SketchLine_19.result().setName("SketchLine_20") -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchLine_18.result()) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchLine_18.result() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_33") -SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_18.result()) +SketchConstraintCoincidence_30 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_18.result() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_34") SketchPoint_5 = Sketch_2.addPoint(-1.694065894508601e-21, 12.99038105676981) -SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchPoint_5.coordinates(), SketchLine_12.result()) +SketchConstraintCoincidence_31 = Sketch_2.setCoincident( + SketchPoint_5.coordinates(), SketchLine_12.result() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_35") -SketchConstraintMiddle_2 = Sketch_2.setMiddlePoint(SketchLine_12.result(), SketchPoint_5.coordinates()) -SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchPoint_5.coordinates(), SketchLine_19.result()) +SketchConstraintMiddle_2 = Sketch_2.setMiddlePoint( + SketchLine_12.result(), SketchPoint_5.coordinates() +) +SketchConstraintCoincidence_32 = Sketch_2.setCoincident( + SketchPoint_5.coordinates(), SketchLine_19.result() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_36") SketchPoint_6 = Sketch_2.addPoint(-2.541098841762901e-21, -12.99038105676981) -SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchPoint_6.coordinates(), SketchLine_15.result()) +SketchConstraintCoincidence_33 = Sketch_2.setCoincident( + SketchPoint_6.coordinates(), SketchLine_15.result() +) SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_37") -SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchPoint_6.coordinates(), SketchLine_19.result()) +SketchConstraintCoincidence_34 = Sketch_2.setCoincident( + SketchPoint_6.coordinates(), SketchLine_19.result() +) SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_38") -SketchConstraintMiddle_3 = Sketch_2.setMiddlePoint(SketchLine_15.result(), SketchPoint_6.coordinates()) +SketchConstraintMiddle_3 = Sketch_2.setMiddlePoint( + SketchLine_15.result(), SketchPoint_6.coordinates() +) SketchCircle_5 = Sketch_2.addCircle(0, 0, 15) SketchCircle_5.setAuxiliary(True) -SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_18).startPoint(), SketchCircle_5.center()) +SketchConstraintCoincidence_35 = Sketch_2.setCoincident( + SketchAPI_Line(SketchLine_18).startPoint(), SketchCircle_5.center() +) SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_39") -SketchConstraintCoincidence_36 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchCircle_5.results()[1]) +SketchConstraintCoincidence_36 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchCircle_5.results()[1] +) SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_40") -SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchCircle_5.results()[1]) +SketchConstraintCoincidence_37 = Sketch_2.setCoincident( + SketchLine_16.startPoint(), SketchCircle_5.results()[1] +) SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_41") -SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchCircle_5.results()[1]) +SketchConstraintCoincidence_38 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchCircle_5.results()[1] +) SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_42") -SketchConstraintCoincidence_39 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchCircle_5.results()[1]) +SketchConstraintCoincidence_39 = Sketch_2.setCoincident( + SketchLine_17.endPoint(), SketchCircle_5.results()[1] +) SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_43") -SketchConstraintEqual_4 = Sketch_2.setEqual(SketchLine_17.result(), SketchLine_12.result()) -SketchConstraintEqual_5 = Sketch_2.setEqual(SketchLine_16.result(), SketchLine_15.result()) +SketchConstraintEqual_4 = Sketch_2.setEqual( + SketchLine_17.result(), SketchLine_12.result() +) +SketchConstraintEqual_5 = Sketch_2.setEqual( + SketchLine_16.result(), SketchLine_15.result() +) SketchConstraintRadius_5 = Sketch_2.setRadius(SketchCircle_5.results()[1], 15) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_18r-SketchLine_17r-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r")], model.selection(), "97-h3-h1", 0) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_2/Face-SketchLine_18r-SketchLine_17r-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r", + ) + ], + model.selection(), + "97-h3-h1", + 0, +) Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face")) -SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_6 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_20 = SketchProjection_6.createdFeature() SketchLine_20.setName("SketchLine_21") SketchLine_20.result().setName("SketchLine_21") SketchCircle_6 = Sketch_3.addCircle(0, 0, 10) -SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_20).startPoint(), SketchCircle_6.center()) +SketchConstraintCoincidence_40 = Sketch_3.setCoincident( + SketchAPI_Line(SketchLine_20).startPoint(), SketchCircle_6.center() +) SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_44") SketchConstraintRadius_6 = Sketch_3.setRadius(SketchCircle_6.results()[1], 10) model.do() -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_6_2f")], model.selection(), 0, 60, [model.selection("SOLID", "Extrusion_2_1")]) -Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/From_Face")) -SketchProjection_7 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OX"), False) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [model.selection("FACE", "Sketch_3/Face-SketchCircle_6_2f")], + model.selection(), + 0, + 60, + [model.selection("SOLID", "Extrusion_2_1")], +) +Sketch_4 = model.addSketch( + Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/From_Face") +) +SketchProjection_7 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_21 = SketchProjection_7.createdFeature() SketchLine_21.setName("SketchLine_22") SketchLine_21.result().setName("SketchLine_22") SketchCircle_7 = Sketch_4.addCircle(0, 0, 12.5) -SketchConstraintCoincidence_41 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_21).startPoint(), SketchCircle_7.center()) +SketchConstraintCoincidence_41 = Sketch_4.setCoincident( + SketchAPI_Line(SketchLine_21).startPoint(), SketchCircle_7.center() +) SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_45") SketchConstraintRadius_7 = Sketch_4.setRadius(SketchCircle_7.results()[1], "25/2") model.do() @@ -240,5 +453,6 @@ Extrusion_2.toSize().setValue(48) model.end() from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Sketch_4.feature())) +assert aFactory.validate(Sketch_4.feature()) diff --git a/src/ModelAPI/Test/Test2496.py b/src/ModelAPI/Test/Test2496.py index 65f94f6e0..c69a8aa9b 100644 --- a/src/ModelAPI/Test/Test2496.py +++ b/src/ModelAPI/Test/Test2496.py @@ -28,26 +28,58 @@ SketchLine_1 = Sketch_1.addLine(85, -50, -60, -50) SketchLine_2 = Sketch_1.addLine(-60, -50, -60, 45) SketchLine_3 = Sketch_1.addLine(-60, 45, 85, 45) SketchLine_4 = Sketch_1.addLine(85, 45, 85, -50) -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()) +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")]) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")) +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_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", "Partition_1_1_1"), model.selection("COMPOUND", "Partition_1_1")]) +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", "Partition_1_1_1"), + model.selection("COMPOUND", "Partition_1_1"), + ], +) model.do() -assert(Group_1.feature().error() == "") +assert Group_1.feature().error() == "" model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test2510.py b/src/ModelAPI/Test/Test2510.py index 9d32b3192..555f9d518 100644 --- a/src/ModelAPI/Test/Test2510.py +++ b/src/ModelAPI/Test/Test2510.py @@ -31,121 +31,303 @@ SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchLine_2 = Sketch_1.addLine(1.29, 2.37, 1.29, 0) SketchLine_3 = Sketch_1.addLine(1.29, 2.37, 1.31, 2.37) SketchLine_3.setAuxiliary(True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) -SketchArc_1 = Sketch_1.addArc(2.429999974807509, 2.369762445228637, 1.32, 2.475237825900849, 2.499428733897898, 3.48259875277915, True) +SketchArc_1 = Sketch_1.addArc( + 2.429999974807509, + 2.369762445228637, + 1.32, + 2.475237825900849, + 2.499428733897898, + 3.48259875277915, + True, +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 1.115) SketchLine_4 = Sketch_1.addLine(1.31, 2.37, 1.32, 2.475237825900849) SketchLine_4.setName("SketchLine_5") SketchLine_4.result().setName("SketchLine_5") -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_4.endPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_4.endPoint() +) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_2.result()) SketchPoint_1 = Sketch_1.addPoint(1.29, 0) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_2.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_2.result() +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_5 = SketchProjection_1.createdFeature() SketchLine_5.setName("SketchLine_6") SketchLine_5.result().setName("SketchLine_6") -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_5.result()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_5.result() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_6 = SketchProjection_2.createdFeature() SketchLine_6.setName("SketchLine_7") SketchLine_6.result().setName("SketchLine_7") -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_6.result(), 1.29, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchPoint_1.coordinates(), SketchLine_6.result(), 1.29, True +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 0.02) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_1.startPoint(), SketchLine_4.endPoint(), 0.01) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_4.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchArc_1.center(), 1.12, True) -SketchLine_7 = Sketch_1.addLine(2.499428733897898, 3.48259875277915, 2.429999974807509, 2.369762445228637) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_1.startPoint(), SketchLine_4.endPoint(), 0.01 +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_4.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchArc_1.center(), 1.12, True +) +SketchLine_7 = Sketch_1.addLine( + 2.499428733897898, 3.48259875277915, 2.429999974807509, 2.369762445228637 +) SketchLine_7.setName("SketchLine_8") 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.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]) -SketchArc_3 = Sketch_1.addArc(1.546759218272587, 0.0009649642070809712, 3.77688682869805, 3.017010693505298, 4.166514953924199, 2.685528408329715, True) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1]) +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.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] +) +SketchArc_3 = Sketch_1.addArc( + 1.546759218272587, + 0.0009649642070809712, + 3.77688682869805, + 3.017010693505298, + 4.166514953924199, + 2.685528408329715, + True, +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_3.results()[1], 3.751) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_2.results()[1], 2.4) -SketchLine_8 = Sketch_1.addLine(2.349985665002739, 1.087256027998574, 3.77688682869805, 3.017010693505298) +SketchLine_8 = Sketch_1.addLine( + 2.349985665002739, 1.087256027998574, 3.77688682869805, 3.017010693505298 +) 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.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) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_8.endPoint() +) +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.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) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_9.endPoint() +) +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") SketchLine_10.result().setName("SketchLine_11") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_10.startPoint()) -SketchArc_4 = Sketch_1.addArc(3.489606777155361, 1.501728514028915, 4.411514953924289, 2.446442922550623, 4.534275383417573, 2.308616054576027, True) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_4.startPoint()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_10.result(), SketchArc_4.results()[1]) -SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchArc_3.endPoint(), SketchArc_4.startPoint(), 0.245) -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(3.489606777155361, 1.501728514028915, 4.411514953924289, 2.446442922550623) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_10.startPoint() +) +SketchArc_4 = Sketch_1.addArc( + 3.489606777155361, + 1.501728514028915, + 4.411514953924289, + 2.446442922550623, + 4.534275383417573, + 2.308616054576027, + True, +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchLine_10.result(), SketchArc_4.results()[1] +) +SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance( + SketchArc_3.endPoint(), SketchArc_4.startPoint(), 0.245 +) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_10.result() +) +SketchLine_11 = Sketch_1.addLine( + 3.489606777155361, 1.501728514028915, 4.411514953924289, 2.446442922550623 +) SketchLine_11.setName("SketchLine_12") SketchLine_11.result().setName("SketchLine_12") SketchLine_11.setAuxiliary(True) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_4.center(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.endPoint()) -SketchLine_12 = Sketch_1.addLine(3.489606777155361, 1.501728514028915, 4.534275383417573, 2.308616054576027) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchArc_4.center(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.endPoint() +) +SketchLine_12 = Sketch_1.addLine( + 3.489606777155361, 1.501728514028915, 4.534275383417573, 2.308616054576027 +) SketchLine_12.setName("SketchLine_13") 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.018000000993595) +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.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()) -SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchArc_5.results()[1]) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_5.center(), SketchLine_5.result()) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_3.result(), "4.74/2", True) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.result()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_5.result()) -SketchArc_6 = Sketch_1.addArc(2.43, 2.369999999999995, 1.29, 2.37, 2.429999974807022, 3.510000000000007, True) +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() +) +SketchConstraintTangent_6 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchArc_5.results()[1] +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchArc_5.center(), SketchLine_5.result() +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchPoint_1.coordinates(), SketchLine_3.result(), "4.74/2", True +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_5.result() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_5.result() +) +SketchArc_6 = Sketch_1.addArc( + 2.43, 2.369999999999995, 1.29, 2.37, 2.429999974807022, 3.510000000000007, True +) SketchArc_6.setName("SketchArc_11") SketchArc_6.result().setName("SketchArc_11") SketchArc_6.results()[1].setName("SketchArc_11_2") -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_6.startPoint()) -SketchConstraintTangent_7 = Sketch_1.setTangent(SketchLine_2.result(), SketchArc_6.results()[1]) -SketchArc_7 = Sketch_1.addArc(2.430000026076943, 1.189999999999999, 2.429999974807022, 3.510000000000007, 3.806722385037566, 3.05736058283826, True) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchArc_6.startPoint() +) +SketchConstraintTangent_7 = Sketch_1.setTangent( + SketchLine_2.result(), SketchArc_6.results()[1] +) +SketchArc_7 = Sketch_1.addArc( + 2.430000026076943, + 1.189999999999999, + 2.429999974807022, + 3.510000000000007, + 3.806722385037566, + 3.05736058283826, + True, +) SketchArc_7.setName("SketchArc_12") SketchArc_7.result().setName("SketchArc_12") SketchArc_7.results()[1].setName("SketchArc_12_2") -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchArc_7.startPoint()) -SketchConstraintTangent_8 = Sketch_1.setTangent(SketchArc_6.results()[1], SketchArc_7.results()[1]) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchArc_6.endPoint(), SketchArc_7.startPoint() +) +SketchConstraintTangent_8 = Sketch_1.setTangent( + SketchArc_6.results()[1], SketchArc_7.results()[1] +) SketchConstraintRadius_5 = Sketch_1.setRadius(SketchArc_6.results()[1], 1.14) -SketchLine_13 = Sketch_1.addLine(2.429999974807509, 2.369762445228637, 2.429999974807022, 3.510000000000007) +SketchLine_13 = Sketch_1.addLine( + 2.429999974807509, 2.369762445228637, 2.429999974807022, 3.510000000000007 +) SketchLine_13.setName("SketchLine_17") SketchLine_13.result().setName("SketchLine_17") SketchLine_13.setAuxiliary(True) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_13.endPoint()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchArc_6.endPoint(), SketchLine_13.endPoint() +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_13.result()) SketchConstraintRadius_6 = Sketch_1.setRadius(SketchArc_7.results()[1], 2.32) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchArc_7.endPoint(), SketchLine_8.result()) -SketchArc_8 = Sketch_1.addArc(1.552665663222913, 0, 3.806722385037566, 3.05736058283826, 5.35111606287941, 0, True) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchArc_7.endPoint(), SketchLine_8.result() +) +SketchArc_8 = Sketch_1.addArc( + 1.552665663222913, 0, 3.806722385037566, 3.05736058283826, 5.35111606287941, 0, True +) SketchArc_8.setName("SketchArc_13") SketchArc_8.result().setName("SketchArc_13") SketchArc_8.results()[1].setName("SketchArc_13_2") -SketchConstraintMirror_1_objects = [SketchLine_2.result(), SketchLine_1.result(), SketchLine_4.result(), SketchArc_6.results()[1], SketchArc_7.results()[1], SketchArc_8.results()[1], SketchLine_13.result(), SketchLine_8.result()] -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_5.result(), SketchConstraintMirror_1_objects) -[SketchLine_14, SketchLine_15, SketchLine_16, SketchArc_9, SketchArc_10, SketchArc_11, SketchLine_17, SketchLine_18] = SketchConstraintMirror_1.mirrored() +SketchConstraintMirror_1_objects = [ + SketchLine_2.result(), + SketchLine_1.result(), + SketchLine_4.result(), + SketchArc_6.results()[1], + SketchArc_7.results()[1], + SketchArc_8.results()[1], + SketchLine_13.result(), + SketchLine_8.result(), +] +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_5.result(), SketchConstraintMirror_1_objects +) +[ + SketchLine_14, + SketchLine_15, + SketchLine_16, + SketchArc_9, + SketchArc_10, + SketchArc_11, + SketchLine_17, + SketchLine_18, +] = SketchConstraintMirror_1.mirrored() SketchLine_18.setName("SketchLine_19") SketchLine_18.result().setName("SketchLine_19") SketchLine_17.setName("SketchLine_18") @@ -165,89 +347,249 @@ 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()) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_8.center(), SketchLine_5.result()) -SketchArc_12 = Sketch_1.addArc(2.429999974807509, -2.369762445228637, 1.32, -2.475237825900849, 2.429999974807509, -3.484762445228914, False) +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() +) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchArc_8.center(), SketchLine_5.result() +) +SketchArc_12 = Sketch_1.addArc( + 2.429999974807509, + -2.369762445228637, + 1.32, + -2.475237825900849, + 2.429999974807509, + -3.484762445228914, + False, +) SketchArc_12.setName("SketchArc_15") SketchArc_12.result().setName("SketchArc_15") SketchArc_12.results()[1].setName("SketchArc_15_2") -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_12.center()) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_16).endPoint(), SketchArc_12.startPoint()) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchLine_17.result(), SketchArc_12.endPoint()) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_18.result()) -SketchArc_13 = Sketch_1.addArc(2.430961195591607, -1.197350205596287, 3.791202568545627, -3.03637143583555, 2.429999974807033, -3.484762445228914, True) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_12.center() +) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_16).endPoint(), SketchArc_12.startPoint() +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchLine_17.result(), SketchArc_12.endPoint() +) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchLine_18.result() +) +SketchArc_13 = Sketch_1.addArc( + 2.430961195591607, + -1.197350205596287, + 3.791202568545627, + -3.03637143583555, + 2.429999974807033, + -3.484762445228914, + True, +) SketchArc_13.setName("SketchArc_16") SketchArc_13.result().setName("SketchArc_16") SketchArc_13.results()[1].setName("SketchArc_16_2") -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchArc_13.startPoint()) -SketchConstraintTangent_10 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchArc_13.results()[1]) -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_13.endPoint(), SketchArc_12.endPoint()) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchArc_13.startPoint() +) +SketchConstraintTangent_10 = Sketch_1.setTangent( + SketchArc_5.results()[1], SketchArc_13.results()[1] +) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchArc_13.endPoint(), SketchArc_12.endPoint() +) SketchLine_19 = Sketch_1.addLine(1.125, 0, 1.125, 2.370000000000003) SketchLine_19.setName("SketchLine_20") SketchLine_19.result().setName("SketchLine_20") -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_19.startPoint(), SketchLine_5.result()) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchLine_19.startPoint(), SketchLine_5.result() +) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_19.result()) -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_3.result()) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_19.endPoint(), SketchLine_2.result(), 0.165, True) -SketchArc_14 = Sketch_1.addArc(2.43, 2.369999999999994, 1.125, 2.370000000000003, 2.429999974807022, 3.674999999999994, True) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_3.result() +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_19.endPoint(), SketchLine_2.result(), 0.165, True +) +SketchArc_14 = Sketch_1.addArc( + 2.43, + 2.369999999999994, + 1.125, + 2.370000000000003, + 2.429999974807022, + 3.674999999999994, + True, +) SketchArc_14.setName("SketchArc_17") SketchArc_14.result().setName("SketchArc_17") SketchArc_14.results()[1].setName("SketchArc_17_2") -SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchArc_14.startPoint()) -SketchArc_15 = Sketch_1.addArc(2.43000002278185, 1.189896770657599, 2.429999974807022, 3.674999999999994, 3.904833906055851, 3.190047534283911, True) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchArc_14.startPoint() +) +SketchArc_15 = Sketch_1.addArc( + 2.43000002278185, + 1.189896770657599, + 2.429999974807022, + 3.674999999999994, + 3.904833906055851, + 3.190047534283911, + True, +) 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_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) +SketchConstraintCoincidence_42 = Sketch_1.setCoincident( + SketchArc_14.endPoint(), SketchArc_15.startPoint() +) +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_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()) -SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchArc_16.center(), SketchLine_5.result()) -SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchArc_16.startPoint(), SketchLine_8.result()) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchAPI_Arc(SketchArc_11).endPoint(), SketchArc_16.endPoint(), 0.165, True) +SketchConstraintCoincidence_43 = Sketch_1.setCoincident( + SketchArc_15.endPoint(), SketchArc_16.startPoint() +) +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() +) +SketchConstraintCoincidence_47 = Sketch_1.setCoincident( + SketchArc_16.center(), SketchLine_5.result() +) +SketchConstraintCoincidence_48 = Sketch_1.setCoincident( + SketchArc_16.startPoint(), SketchLine_8.result() +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchAPI_Arc(SketchArc_11).endPoint(), SketchArc_16.endPoint(), 0.165, True +) SketchLine_20 = Sketch_1.addLine(1.05, 0, 1.05, 2.199861545438666) SketchLine_20.setName("SketchLine_22") SketchLine_20.result().setName("SketchLine_22") -SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchLine_20.startPoint(), SketchLine_5.result()) +SketchConstraintCoincidence_49 = Sketch_1.setCoincident( + SketchLine_20.startPoint(), SketchLine_5.result() +) SketchLine_21 = Sketch_1.addLine(1.05, 2.199861545438666, 1.08, 2.370000000000011) SketchLine_21.setName("SketchLine_23") SketchLine_21.result().setName("SketchLine_23") -SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) -SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_50 = Sketch_1.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.startPoint() +) +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(), 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) +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(), 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") SketchArc_17.result().setName("SketchArc_23") SketchArc_17.results()[1].setName("SketchArc_23_2") -SketchConstraintCoincidence_52 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchArc_17.startPoint()) -SketchConstraintCoincidence_53 = Sketch_1.setCoincident(SketchArc_17.center(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_54 = Sketch_1.setCoincident(SketchArc_17.endPoint(), SketchLine_13.result()) -SketchArc_18 = Sketch_1.addArc(2.43000002278185, 1.189896770657599, 2.429999974807022, 3.719762440932702, 3.93144708721947, 3.226039452870244, True) +SketchConstraintCoincidence_52 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchArc_17.startPoint() +) +SketchConstraintCoincidence_53 = Sketch_1.setCoincident( + SketchArc_17.center(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_54 = Sketch_1.setCoincident( + SketchArc_17.endPoint(), SketchLine_13.result() +) +SketchArc_18 = Sketch_1.addArc( + 2.43000002278185, + 1.189896770657599, + 2.429999974807022, + 3.719762440932702, + 3.93144708721947, + 3.226039452870244, + True, +) SketchArc_18.setName("SketchArc_24") SketchArc_18.result().setName("SketchArc_24") SketchArc_18.results()[1].setName("SketchArc_24_2") -SketchConstraintCoincidence_55 = Sketch_1.setCoincident(SketchArc_15.center(), SketchArc_18.center()) -SketchConstraintCoincidence_56 = Sketch_1.setCoincident(SketchArc_17.endPoint(), SketchArc_18.startPoint()) -SketchConstraintCoincidence_57 = Sketch_1.setCoincident(SketchArc_18.endPoint(), SketchLine_8.result()) -SketchArc_19 = Sketch_1.addArc(1.552616124088887, 0, 3.93144708721947, 3.226039452870244, 5.560878503552593, 0, True) +SketchConstraintCoincidence_55 = Sketch_1.setCoincident( + SketchArc_15.center(), SketchArc_18.center() +) +SketchConstraintCoincidence_56 = Sketch_1.setCoincident( + SketchArc_17.endPoint(), SketchArc_18.startPoint() +) +SketchConstraintCoincidence_57 = Sketch_1.setCoincident( + SketchArc_18.endPoint(), SketchLine_8.result() +) +SketchArc_19 = Sketch_1.addArc( + 1.552616124088887, + 0, + 3.93144708721947, + 3.226039452870244, + 5.560878503552593, + 0, + True, +) SketchArc_19.setName("SketchArc_25") SketchArc_19.result().setName("SketchArc_25") SketchArc_19.results()[1].setName("SketchArc_25_2") -SketchConstraintMirror_2_objects = [SketchLine_19.result(), SketchArc_14.results()[1], SketchArc_15.results()[1], SketchArc_16.results()[1], SketchLine_20.result(), SketchArc_19.results()[1], SketchArc_17.results()[1], SketchLine_21.result(), SketchArc_18.results()[1]] -SketchConstraintMirror_2 = Sketch_1.addMirror(SketchLine_5.result(), SketchConstraintMirror_2_objects) -[SketchLine_22, SketchArc_20, SketchArc_21, SketchArc_22, SketchLine_23, SketchArc_23, SketchArc_24, SketchLine_24, SketchArc_25] = SketchConstraintMirror_2.mirrored() +SketchConstraintMirror_2_objects = [ + SketchLine_19.result(), + SketchArc_14.results()[1], + SketchArc_15.results()[1], + SketchArc_16.results()[1], + SketchLine_20.result(), + SketchArc_19.results()[1], + SketchArc_17.results()[1], + SketchLine_21.result(), + SketchArc_18.results()[1], +] +SketchConstraintMirror_2 = Sketch_1.addMirror( + SketchLine_5.result(), SketchConstraintMirror_2_objects +) +[ + SketchLine_22, + SketchArc_20, + SketchArc_21, + SketchArc_22, + SketchLine_23, + SketchArc_23, + SketchArc_24, + SketchLine_24, + SketchArc_25, +] = SketchConstraintMirror_2.mirrored() SketchArc_25.setName("SketchArc_28") SketchArc_25.result().setName("SketchArc_28") SketchArc_25.results()[1].setName("SketchArc_28_2") @@ -272,70 +614,248 @@ 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()) -SketchConstraintCoincidence_59 = Sketch_1.setCoincident(SketchArc_19.endPoint(), SketchLine_5.result()) -SketchConstraintCoincidence_60 = Sketch_1.setCoincident(SketchArc_19.center(), SketchLine_5.result()) -SketchConstraintCoincidence_61 = Sketch_1.setCoincident(SketchArc_19.center(), SketchArc_16.center()) -SketchLine_25 = Sketch_1.addLine(2.429999974807022, -3.509999999999994, 2.429999974807022, -3.674999999999994) +SketchConstraintCoincidence_58 = Sketch_1.setCoincident( + SketchArc_18.endPoint(), SketchArc_19.startPoint() +) +SketchConstraintCoincidence_59 = Sketch_1.setCoincident( + SketchArc_19.endPoint(), SketchLine_5.result() +) +SketchConstraintCoincidence_60 = Sketch_1.setCoincident( + SketchArc_19.center(), SketchLine_5.result() +) +SketchConstraintCoincidence_61 = Sketch_1.setCoincident( + SketchArc_19.center(), SketchArc_16.center() +) +SketchLine_25 = Sketch_1.addLine( + 2.429999974807022, -3.509999999999994, 2.429999974807022, -3.674999999999994 +) SketchLine_25.setName("SketchLine_26") SketchLine_25.result().setName("SketchLine_26") -SketchConstraintCoincidence_62 = Sketch_1.setCoincident(SketchAPI_Arc(SketchArc_9).endPoint(), SketchLine_25.startPoint()) -SketchConstraintCoincidence_63 = Sketch_1.setCoincident(SketchAPI_Arc(SketchArc_20).endPoint(), SketchLine_25.endPoint()) -SketchLine_26 = Sketch_1.addLine(2.429999974807022, 3.510000000000007, 2.429999974807022, 3.674999999999994) +SketchConstraintCoincidence_62 = Sketch_1.setCoincident( + SketchAPI_Arc(SketchArc_9).endPoint(), SketchLine_25.startPoint() +) +SketchConstraintCoincidence_63 = Sketch_1.setCoincident( + SketchAPI_Arc(SketchArc_20).endPoint(), SketchLine_25.endPoint() +) +SketchLine_26 = Sketch_1.addLine( + 2.429999974807022, 3.510000000000007, 2.429999974807022, 3.674999999999994 +) SketchLine_26.setName("SketchLine_27") SketchLine_26.result().setName("SketchLine_27") -SketchConstraintCoincidence_64 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_26.startPoint()) -SketchConstraintCoincidence_65 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchLine_26.endPoint()) -SketchLine_27 = Sketch_1.addLine(2.429999974807022, 3.719762440932702, 2.429999974807022, 3.674999999999994) +SketchConstraintCoincidence_64 = Sketch_1.setCoincident( + SketchArc_6.endPoint(), SketchLine_26.startPoint() +) +SketchConstraintCoincidence_65 = Sketch_1.setCoincident( + SketchArc_14.endPoint(), SketchLine_26.endPoint() +) +SketchLine_27 = Sketch_1.addLine( + 2.429999974807022, 3.719762440932702, 2.429999974807022, 3.674999999999994 +) SketchLine_27.setName("SketchLine_28") SketchLine_27.result().setName("SketchLine_28") -SketchConstraintCoincidence_66 = Sketch_1.setCoincident(SketchArc_17.endPoint(), SketchLine_27.startPoint()) -SketchConstraintCoincidence_67 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchLine_27.endPoint()) -SketchLine_28 = Sketch_1.addLine(2.429999974807022, 3.510000000000032, 2.429999974807022, 3.484762445224835) +SketchConstraintCoincidence_66 = Sketch_1.setCoincident( + SketchArc_17.endPoint(), SketchLine_27.startPoint() +) +SketchConstraintCoincidence_67 = Sketch_1.setCoincident( + SketchArc_14.endPoint(), SketchLine_27.endPoint() +) +SketchLine_28 = Sketch_1.addLine( + 2.429999974807022, 3.510000000000032, 2.429999974807022, 3.484762445224835 +) SketchLine_28.setName("SketchLine_29") SketchLine_28.result().setName("SketchLine_29") -SketchConstraintCoincidence_68 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_28.startPoint()) -SketchConstraintCoincidence_69 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchArc_1.results()[1]) -SketchConstraintCoincidence_70 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchLine_13.result()) -SketchLine_29 = Sketch_1.addLine(2.429999974807022, -3.509999999999994, 2.429999974807033, -3.484762445228914) +SketchConstraintCoincidence_68 = Sketch_1.setCoincident( + SketchArc_6.endPoint(), SketchLine_28.startPoint() +) +SketchConstraintCoincidence_69 = Sketch_1.setCoincident( + SketchLine_28.endPoint(), SketchArc_1.results()[1] +) +SketchConstraintCoincidence_70 = Sketch_1.setCoincident( + SketchLine_28.endPoint(), SketchLine_13.result() +) +SketchLine_29 = Sketch_1.addLine( + 2.429999974807022, -3.509999999999994, 2.429999974807033, -3.484762445228914 +) SketchLine_29.setName("SketchLine_30") SketchLine_29.result().setName("SketchLine_30") -SketchConstraintCoincidence_71 = Sketch_1.setCoincident(SketchAPI_Arc(SketchArc_9).endPoint(), SketchLine_29.startPoint()) -SketchConstraintCoincidence_72 = Sketch_1.setCoincident(SketchArc_12.endPoint(), SketchLine_29.endPoint()) -SketchLine_30 = Sketch_1.addLine(2.429999974807022, -3.674999999999994, 2.429999974807022, -3.71976244093269) +SketchConstraintCoincidence_71 = Sketch_1.setCoincident( + SketchAPI_Arc(SketchArc_9).endPoint(), SketchLine_29.startPoint() +) +SketchConstraintCoincidence_72 = Sketch_1.setCoincident( + SketchArc_12.endPoint(), SketchLine_29.endPoint() +) +SketchLine_30 = Sketch_1.addLine( + 2.429999974807022, -3.674999999999994, 2.429999974807022, -3.71976244093269 +) SketchLine_30.setName("SketchLine_31") SketchLine_30.result().setName("SketchLine_31") -SketchConstraintCoincidence_73 = Sketch_1.setCoincident(SketchAPI_Arc(SketchArc_20).endPoint(), SketchLine_30.startPoint()) -SketchConstraintCoincidence_74 = Sketch_1.setCoincident(SketchAPI_Arc(SketchArc_24).endPoint(), SketchLine_30.endPoint()) -SketchLine_31 = Sketch_1.addLine(2.429999974807509, 2.369762445228637, 1.871489087529827, 3.334796428456965) +SketchConstraintCoincidence_73 = Sketch_1.setCoincident( + SketchAPI_Arc(SketchArc_20).endPoint(), SketchLine_30.startPoint() +) +SketchConstraintCoincidence_74 = Sketch_1.setCoincident( + SketchAPI_Arc(SketchArc_24).endPoint(), SketchLine_30.endPoint() +) +SketchLine_31 = Sketch_1.addLine( + 2.429999974807509, 2.369762445228637, 1.871489087529827, 3.334796428456965 +) SketchLine_31.setName("SketchLine_32") 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.93999999988066) -SketchLine_32 = Sketch_1.addLine(1.871489087529827, 3.334796428456965, 1.871489087529827, 3.598813126524882) +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.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") -SketchConstraintCoincidence_77 = Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) -SketchConstraintCoincidence_78 = Sketch_1.setCoincident(SketchLine_32.endPoint(), SketchArc_17.results()[1]) +SketchConstraintCoincidence_77 = Sketch_1.setCoincident( + SketchLine_31.endPoint(), SketchLine_32.startPoint() +) +SketchConstraintCoincidence_78 = Sketch_1.setCoincident( + SketchLine_32.endPoint(), SketchArc_17.results()[1] +) SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_32.result()) -SketchLine_33 = Sketch_1.addLine(1.871489087529829, -3.334796428460793, 1.871489087529829, -3.598813126524861) +SketchLine_33 = Sketch_1.addLine( + 1.871489087529829, -3.334796428460793, 1.871489087529829, -3.598813126524861 +) SketchLine_33.setName("SketchLine_34") SketchLine_33.result().setName("SketchLine_34") -SketchConstraintCoincidence_79 = Sketch_1.setCoincident(SketchLine_33.startPoint(), SketchArc_12.results()[1]) -SketchConstraintCoincidence_80 = Sketch_1.setCoincident(SketchLine_33.endPoint(), SketchArc_24.results()[1]) -SketchConstraintCoincidence_81 = Sketch_1.setCoincident(SketchLine_33.startPoint(), SketchLine_32.result()) +SketchConstraintCoincidence_79 = Sketch_1.setCoincident( + SketchLine_33.startPoint(), SketchArc_12.results()[1] +) +SketchConstraintCoincidence_80 = Sketch_1.setCoincident( + SketchLine_33.endPoint(), SketchArc_24.results()[1] +) +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/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/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_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/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") @@ -345,16 +865,38 @@ 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_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")] +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() # check names of partition results -assert(Partition_1.name() + "_1" == Partition_1.result().name()) -assert(Partition_1.name() + "_2" == Partition_1.results()[1].name()) +assert Partition_1.name() + "_1" == Partition_1.result().name() +assert Partition_1.name() + "_2" == Partition_1.results()[1].name() model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test2607.py b/src/ModelAPI/Test/Test2607.py index decf55bd7..60d64f091 100644 --- a/src/ModelAPI/Test/Test2607.py +++ b/src/ModelAPI/Test/Test2607.py @@ -23,20 +23,44 @@ 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"), 10, 10) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 10, +) Box_1 = model.addBox(Part_1_doc, 2, 20, 5) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("COMPOUND", "all-in-Box_1")], model.selection("EDGE", "PartSet/OZ"), 90, 2) +AngularCopy_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Box_1")], + model.selection("EDGE", "PartSet/OZ"), + 90, + 2, +) AngularCopy_1.setName("Cross") AngularCopy_1.result().setName("Cross") -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "all-in-Cross")], model.selection("EDGE", "PartSet/OZ"), -5, 2) +LinearCopy_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Cross")], + model.selection("EDGE", "PartSet/OZ"), + -5, + 2, +) model.end() # check names of the Linear copy: only higher level result must inherit the result name -assert(LinearCopy_1.result().name() == "Cross") -assert(LinearCopy_1.result().subResult(0).name() == "LinearCopy_1_1_1") -assert(LinearCopy_1.result().subResult(0).subResult(0).name() == "LinearCopy_1_1_1_1") -assert(LinearCopy_1.result().subResult(1).subResult(0).name() == "LinearCopy_1_1_2_1") -assert(LinearCopy_1.result().subResult(1).subResult(0).subResult(0).name() == "LinearCopy_1_1_2_1_1") -assert(LinearCopy_1.result().subResult(1).subResult(0).subResult(0).subResult(0).name() == "LinearCopy_1_1_2_1_1_1") +assert LinearCopy_1.result().name() == "Cross" +assert LinearCopy_1.result().subResult(0).name() == "LinearCopy_1_1_1" +assert LinearCopy_1.result().subResult(0).subResult(0).name() == "LinearCopy_1_1_1_1" +assert LinearCopy_1.result().subResult(1).subResult(0).name() == "LinearCopy_1_1_2_1" +assert ( + LinearCopy_1.result().subResult(1).subResult(0).subResult(0).name() + == "LinearCopy_1_1_2_1_1" +) +assert ( + LinearCopy_1.result().subResult(1).subResult(0).subResult(0).subResult(0).name() + == "LinearCopy_1_1_2_1_1_1" +) diff --git a/src/ModelAPI/Test/Test2627.py b/src/ModelAPI/Test/Test2627.py index aa3fa2d00..4c2c1472f 100644 --- a/src/ModelAPI/Test/Test2627.py +++ b/src/ModelAPI/Test/Test2627.py @@ -29,63 +29,160 @@ 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(10, 0, 0, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 8) SketchLine_3 = Sketch_1.addLine(0, 8, 10, 8) SketchLine_4 = Sketch_1.addLine(10, 8, 10, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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(2.5, -1.540743955509789e-33, 2.5, 8) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_1.result() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_3.result() +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), "L") SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), "H") -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_5.startPoint(), "L/4.") +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_5.startPoint(), "L/4." +) model.do() -Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_3r-SketchLine_2r-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_5r-SketchLine_1r")]) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_3r-SketchLine_2r-SketchLine_1r")]) +Shell_1 = model.addShell( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_5f-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_5r-SketchLine_1r", + ), + ], +) +Group_1 = model.addGroup( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_5f-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], +) Group_1.setName("face_g") Group_1.result().setName("face_g") -Group_2 = model.addGroup(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_5r-SketchLine_1r")]) +Group_2 = model.addGroup( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_5r-SketchLine_1r", + ) + ], +) Group_2.setName("face_d") Group_2.result().setName("face_d") -Group_3 = model.addGroup(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_3r-SketchLine_2r-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_5r-SketchLine_1r")]) +Group_3 = model.addGroup( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_5f-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_5r-SketchLine_1r", + ), + ], +) Group_3.setName("face_g_d") Group_3.result().setName("face_g_d") -Group_4 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Sketch_1/SubEdge_1&Sketch_1/SketchLine_1")]) +Group_4 = model.addGroup( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SubEdge_1&Sketch_1/SketchLine_1")] +) Group_4.setName("ligne_g") Group_4.result().setName("ligne_g") -Group_5 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Sketch_1/SubEdge_2&Sketch_1/SketchLine_1")]) +Group_5 = model.addGroup( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SubEdge_2&Sketch_1/SketchLine_1")] +) Group_5.setName("ligne_d") Group_5.result().setName("ligne_d") -Group_6 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Sketch_1/SubEdge_1&Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SubEdge_2&Sketch_1/SketchLine_1")]) +Group_6 = model.addGroup( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_1/SubEdge_1&Sketch_1/SketchLine_1"), + model.selection("EDGE", "Sketch_1/SubEdge_2&Sketch_1/SketchLine_1"), + ], +) Group_6.setName("ligne_g_d") Group_6.result().setName("ligne_g_d") -Group_7 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SubVertex_1&Sketch_1/SketchLine_2_EndVertex&Sketch_1/SketchLine_3_StartVertex")]) +Group_7 = model.addGroup( + Part_1_doc, + [ + model.selection( + "VERTEX", + "Sketch_1/SubVertex_1&Sketch_1/SketchLine_2_EndVertex&Sketch_1/SketchLine_3_StartVertex", + ) + ], +) Group_7.setName("coin_g") Group_7.result().setName("coin_g") -Group_8 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SubVertex_2&Sketch_1/SketchLine_3_EndVertex&Sketch_1/SketchLine_4_StartVertex")]) +Group_8 = model.addGroup( + Part_1_doc, + [ + model.selection( + "VERTEX", + "Sketch_1/SubVertex_2&Sketch_1/SketchLine_3_EndVertex&Sketch_1/SketchLine_4_StartVertex", + ) + ], +) Group_8.setName("coin_d") Group_8.result().setName("coin_d") -Group_9 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SubVertex_1&Sketch_1/SketchLine_2_EndVertex&Sketch_1/SketchLine_3_StartVertex"), model.selection("VERTEX", "Sketch_1/SubVertex_2&Sketch_1/SketchLine_3_EndVertex&Sketch_1/SketchLine_4_StartVertex")]) +Group_9 = model.addGroup( + Part_1_doc, + [ + model.selection( + "VERTEX", + "Sketch_1/SubVertex_1&Sketch_1/SketchLine_2_EndVertex&Sketch_1/SketchLine_3_StartVertex", + ), + model.selection( + "VERTEX", + "Sketch_1/SubVertex_2&Sketch_1/SketchLine_3_EndVertex&Sketch_1/SketchLine_4_StartVertex", + ), + ], +) Group_9.setName("coins") Group_9.result().setName("coins") model.end() # check all groups are correct from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() for i in range(Part_1_doc.size("Groups")): - GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", i))) - assert(aFactory.validate(GroupFeature)) + GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", i))) + assert aFactory.validate(GroupFeature) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test26745.py b/src/ModelAPI/Test/Test26745.py index a16cb7942..1e6733f19 100644 --- a/src/ModelAPI/Test/Test26745.py +++ b/src/ModelAPI/Test/Test26745.py @@ -27,33 +27,52 @@ partSet = model.moduleDocument() ### Create Part Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -model.addParameter(Part_1_doc, "EP_MIN", '0.001') -model.addParameter(Part_1_doc, "tube_r", '0.25') -model.addParameter(Part_1_doc, "tube_l", '1.0') -model.addParameter(Part_1_doc, "rugo_r_min", '0.005') -model.addParameter(Part_1_doc, "rugo_r_max", '0.1') +model.addParameter(Part_1_doc, "EP_MIN", "0.001") +model.addParameter(Part_1_doc, "tube_r", "0.25") +model.addParameter(Part_1_doc, "tube_l", "1.0") +model.addParameter(Part_1_doc, "rugo_r_min", "0.005") +model.addParameter(Part_1_doc, "rugo_r_max", "0.1") ### Create Sphere -Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "rugo_r_max") +Sphere_1 = model.addSphere( + Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "rugo_r_max" +) Sphere_1.setName("base") Sphere_1.result().setName("Sphere_1_1") ### Create Rotation -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("COMPOUND", "all-in-base")], axis = model.selection("EDGE", "PartSet/OX"), angle = 90, keepSubResults = True) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("COMPOUND", "all-in-base")], + axis=model.selection("EDGE", "PartSet/OX"), + angle=90, + keepSubResults=True, +) Rotation_1.result().setName("Rotation_1_1") ### Create Plane -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), "- 0.6*rugo_r_max", False) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "PartSet/XOY"), "- 0.6*rugo_r_max", False +) Plane_4.result().setName("plan_partition") ### Create Partition -Partition_1 = model.addPartition(Part_1_doc, [model.selection("COMPOUND", "all-in-Rotation_1"), model.selection("FACE", "plan_partition")], keepSubResults = True) +Partition_1 = model.addPartition( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Rotation_1"), + model.selection("FACE", "plan_partition"), + ], + keepSubResults=True, +) ### Create Partition -Partition_2_objects = [model.selection("SOLID", "Partition_1_1_1"), - model.selection("FACE", "PartSet/YOZ"), - model.selection("FACE", "PartSet/XOZ")] -Partition_2 = model.addPartition(Part_1_doc, Partition_2_objects, keepSubResults = True) +Partition_2_objects = [ + model.selection("SOLID", "Partition_1_1_1"), + model.selection("FACE", "PartSet/YOZ"), + model.selection("FACE", "PartSet/XOZ"), +] +Partition_2 = model.addPartition(Part_1_doc, Partition_2_objects, keepSubResults=True) Partition_2.setName("PARTITION") Partition_2.result().setName("PARTITION") Partition_2.result().subResult(0).setName("Partition_2_1_1") @@ -63,7 +82,12 @@ Partition_2.result().subResult(3).setName("Partition_2_1_4") Partition_2.result().subResult(4).setName("Partition_2_1_5") ### Create Translation -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "all-in-PARTITION")], vector = ["tube_l*0.5", 0, "tube_r+EP_MIN"], keepSubResults = True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "all-in-PARTITION")], + vector=["tube_l*0.5", 0, "tube_r+EP_MIN"], + keepSubResults=True, +) Translation_1.setName("RUGO") Translation_1.result().setName("RUGO") Translation_1.result().subResult(0).setName("Translation_1_1_1") @@ -74,26 +98,64 @@ Translation_1.result().subResult(0).subResult(3).setName("Translation_1_1_1_4") Translation_1.result().subResult(0).subResult(4).setName("Translation_1_1_1_5") ### Create Cylinder -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OX"), "tube_r", "tube_l") +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OX"), + "tube_r", + "tube_l", +) Cylinder_1.setName("tube_sain") Cylinder_1.result().setName("tube_sain") ### Create Cut -Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "all-in-tube_sain")], [model.selection("COMPOUND", "all-in-RUGO")], keepSubResults = True) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("COMPOUND", "all-in-tube_sain")], + [model.selection("COMPOUND", "all-in-RUGO")], + keepSubResults=True, +) Cut_1.result().setTransparency(0.7) ### Create Extrusion -Extrusion_1_objects = [model.selection("EDGE", "Translation_1_1_1_5/ME:Translated&plan_partition/plan_partition&Sphere_1_1/Face_1&new_weak_name_1"), - model.selection("EDGE", "Translation_1_1_1_5/ME:Translated&plan_partition/plan_partition&Sphere_1_1/Face_1&new_weak_name_2"), - model.selection("EDGE", "Translation_1_1_1_5/ME:Translated&plan_partition/plan_partition&Sphere_1_1/Face_1&new_weak_name_4"), - model.selection("EDGE", "Translation_1_1_1_5/ME:Translated&plan_partition/plan_partition&Sphere_1_1/Face_1&new_weak_name_3")] -Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection("EDGE", "PartSet/OZ"), 0, "2.*tube_r") +Extrusion_1_objects = [ + model.selection( + "EDGE", + "Translation_1_1_1_5/ME:Translated&plan_partition/plan_partition&Sphere_1_1/Face_1&new_weak_name_1", + ), + model.selection( + "EDGE", + "Translation_1_1_1_5/ME:Translated&plan_partition/plan_partition&Sphere_1_1/Face_1&new_weak_name_2", + ), + model.selection( + "EDGE", + "Translation_1_1_1_5/ME:Translated&plan_partition/plan_partition&Sphere_1_1/Face_1&new_weak_name_4", + ), + model.selection( + "EDGE", + "Translation_1_1_1_5/ME:Translated&plan_partition/plan_partition&Sphere_1_1/Face_1&new_weak_name_3", + ), +] +Extrusion_1 = model.addExtrusion( + Part_1_doc, + Extrusion_1_objects, + model.selection("EDGE", "PartSet/OZ"), + 0, + "2.*tube_r", +) ### Create Recover Recover_1 = model.addRecover(Part_1_doc, Extrusion_1, [Cut_1.result()]) ### Create Common -Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1"), model.selection("COMPOUND", "all-in-Recover_1")], keepSubResults = True) +Common_1 = model.addCommon( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Extrusion_1"), + model.selection("COMPOUND", "all-in-Recover_1"), + ], + keepSubResults=True, +) Common_1.result().subResult(0).setName("Common_1_1_1") Common_1.result().subResult(1).setName("Common_1_1_2") Common_1.result().subResult(2).setName("Common_1_1_3") @@ -103,23 +165,57 @@ Common_1.result().subResult(3).setName("Common_1_1_4") Recover_2 = model.addRecover(Part_1_doc, Common_1, [Recover_1.result()]) ### Create Partition -Partition_3 = model.addPartition(Part_1_doc, [model.selection("COMPOUND", "all-in-Common_1"), model.selection("COMPOUND", "all-in-Recover_2")], keepSubResults = True) +Partition_3 = model.addPartition( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Common_1"), + model.selection("COMPOUND", "all-in-Recover_2"), + ], + keepSubResults=True, +) Partition_3.result().setTransparency(0.53) Partition_3.result().subResult(0).setName("Partition_3_1_1") Partition_3.result().subResult(1).setName("Partition_3_1_2") ### Create Extrusion -Extrusion_2_objects = [model.selection("EDGE", "(Partition_3_1_1/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&__tube_sain/To_Edge)(Partition_3_1_1/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&tube_sain_4/To_Edge)(Common_1_1_4/Generated_Edge&____tube_sain/Face_1&plan_partition/plan_partition&Sphere_1_1/Face_1)2(Common_1_1_1/Generated_Edge&____tube_sain/Face_1&plan_partition/plan_partition&Sphere_1_1/Face_1)2(Partition_3_1_1/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&tube_sain_3/To_Edge)2(Partition_3_1_1/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&tube_sain_2/To_Edge)2"), - model.selection("EDGE", "[Partition_3_1_2/Modified_Face&plan_partition/plan_partition&Sphere_1_1/Face_1&new_weak_name_1][Partition_3_1_2/Modified_Face&plan_partition/plan_partition&Sphere_1_1/Face_1&new_weak_name_3]"), - model.selection("EDGE", "(Partition_3_1_1/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&tube_sain_3/To_Edge)(Partition_3_1_1/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&tube_sain_2/To_Edge)(Partition_3_1_1/Modified_Edge&PartSet/YOZ/YOZ&plan_partition/plan_partition&Sphere_1_1/Face_1)"), - model.selection("EDGE", "Partition_3_1_2/Modified_Edge&PartSet/YOZ/YOZ&plan_partition/plan_partition&Sphere_1_1/Face_1")] -Extrusion_2 = model.addExtrusion(Part_1_doc, Extrusion_2_objects, model.selection("EDGE", "PartSet/OX"), "tube_l", "tube_l") +Extrusion_2_objects = [ + model.selection( + "EDGE", + "(Partition_3_1_1/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&__tube_sain/To_Edge)(Partition_3_1_1/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&tube_sain_4/To_Edge)(Common_1_1_4/Generated_Edge&____tube_sain/Face_1&plan_partition/plan_partition&Sphere_1_1/Face_1)2(Common_1_1_1/Generated_Edge&____tube_sain/Face_1&plan_partition/plan_partition&Sphere_1_1/Face_1)2(Partition_3_1_1/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&tube_sain_3/To_Edge)2(Partition_3_1_1/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&tube_sain_2/To_Edge)2", + ), + model.selection( + "EDGE", + "[Partition_3_1_2/Modified_Face&plan_partition/plan_partition&Sphere_1_1/Face_1&new_weak_name_1][Partition_3_1_2/Modified_Face&plan_partition/plan_partition&Sphere_1_1/Face_1&new_weak_name_3]", + ), + model.selection( + "EDGE", + "(Partition_3_1_1/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&tube_sain_3/To_Edge)(Partition_3_1_1/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&tube_sain_2/To_Edge)(Partition_3_1_1/Modified_Edge&PartSet/YOZ/YOZ&plan_partition/plan_partition&Sphere_1_1/Face_1)", + ), + model.selection( + "EDGE", + "Partition_3_1_2/Modified_Edge&PartSet/YOZ/YOZ&plan_partition/plan_partition&Sphere_1_1/Face_1", + ), +] +Extrusion_2 = model.addExtrusion( + Part_1_doc, + Extrusion_2_objects, + model.selection("EDGE", "PartSet/OX"), + "tube_l", + "tube_l", +) ### Create Recover Recover_3 = model.addRecover(Part_1_doc, Extrusion_2, [Partition_3.result()], True) ### Create Common -Common_2 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_2"), model.selection("COMPOUND", "all-in-Recover_3")], keepSubResults = True) +Common_2 = model.addCommon( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Extrusion_2"), + model.selection("COMPOUND", "all-in-Recover_3"), + ], + keepSubResults=True, +) Common_2.result().subResult(0).setName("Common_2_1_1") Common_2.result().subResult(1).setName("Common_2_1_2") Common_2.result().subResult(2).setName("Common_2_1_3") @@ -133,7 +229,14 @@ Common_2.result().subResult(7).setName("Common_2_1_8") Recover_4 = model.addRecover(Part_1_doc, Common_2, [Recover_3.result()]) ### Create Partition -Partition_4 = model.addPartition(Part_1_doc, [model.selection("COMPOUND", "all-in-Common_2"), model.selection("COMPOUND", "all-in-Recover_4")], keepSubResults = True) +Partition_4 = model.addPartition( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Common_2"), + model.selection("COMPOUND", "all-in-Recover_4"), + ], + keepSubResults=True, +) Partition_4.result().setTransparency(0.67) Partition_4.result().subResult(0).setName("Partition_4_1_1") Partition_4.result().subResult(1).setName("Partition_4_1_2") @@ -142,13 +245,35 @@ Partition_4.result().subResult(3).setName("Partition_4_1_4") Partition_4.result().subResult(4).setName("Partition_4_1_5") ### Create Extrusion -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "(Partition_4_1_1/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&_tube_sain_3/To_Edge)(Partition_4_1_1/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&_tube_sain_4/To_Edge)(Common_2_1_6/Generated_Edge&_______tube_sain/Face_2&PartSet/YOZ/YOZ&Sphere_1_1/Face_1)3(Common_2_1_8/Generated_Edge&_______tube_sain/Face_2&PartSet/YOZ/YOZ&plan_partition/plan_partition&Sphere_1_1/Face_1)3(Common_2_1_4/Generated_Edge&_______tube_sain/Face_2&tube_sain_2/tube_sain_2)3(Common_2_1_2/Generated_Edge&_______tube_sain/Face_2&PartSet/YOZ/YOZ&Sphere_1_1/Face_1)3(Partition_4_1_1/Modified_Edge&_______tube_sain/Face_1&PartSet/YOZ/YOZ&plan_partition/plan_partition&Sphere_1_1/Face_1)3"), model.selection("EDGE", "(Partition_4_1_5/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&_tube_sain_4/To_Edge)(Partition_4_1_5/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&_tube_sain_3/To_Edge)")], model.selection("EDGE", "PartSet/OX"), "tube_l", 0) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "EDGE", + "(Partition_4_1_1/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&_tube_sain_3/To_Edge)(Partition_4_1_1/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&_tube_sain_4/To_Edge)(Common_2_1_6/Generated_Edge&_______tube_sain/Face_2&PartSet/YOZ/YOZ&Sphere_1_1/Face_1)3(Common_2_1_8/Generated_Edge&_______tube_sain/Face_2&PartSet/YOZ/YOZ&plan_partition/plan_partition&Sphere_1_1/Face_1)3(Common_2_1_4/Generated_Edge&_______tube_sain/Face_2&tube_sain_2/tube_sain_2)3(Common_2_1_2/Generated_Edge&_______tube_sain/Face_2&PartSet/YOZ/YOZ&Sphere_1_1/Face_1)3(Partition_4_1_1/Modified_Edge&_______tube_sain/Face_1&PartSet/YOZ/YOZ&plan_partition/plan_partition&Sphere_1_1/Face_1)3", + ), + model.selection( + "EDGE", + "(Partition_4_1_5/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&_tube_sain_4/To_Edge)(Partition_4_1_5/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&_tube_sain_3/To_Edge)", + ), + ], + model.selection("EDGE", "PartSet/OX"), + "tube_l", + 0, +) ### Create Recover Recover_5 = model.addRecover(Part_1_doc, Extrusion_3, [Partition_4.result()], True) ### Create Common -Common_3 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_3"), model.selection("COMPOUND", "all-in-Recover_5")], keepSubResults = True) +Common_3 = model.addCommon( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Extrusion_3"), + model.selection("COMPOUND", "all-in-Recover_5"), + ], + keepSubResults=True, +) Common_3.result().subResult(0).setName("Common_3_1_1") Common_3.result().subResult(1).setName("Common_3_1_2") @@ -156,7 +281,14 @@ Common_3.result().subResult(1).setName("Common_3_1_2") Recover_6 = model.addRecover(Part_1_doc, Common_3, [Recover_5.result()], True) ### Create Partition -Partition_5 = model.addPartition(Part_1_doc, [model.selection("COMPOUND", "all-in-Common_3"), model.selection("COMPOUND", "all-in-Recover_6")], keepSubResults = True) +Partition_5 = model.addPartition( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Common_3"), + model.selection("COMPOUND", "all-in-Recover_6"), + ], + keepSubResults=True, +) Partition_5.result().setTransparency(0.72) Partition_5.result().subResult(0).setName("Partition_5_1_1") Partition_5.result().subResult(1).setName("Partition_5_1_2") @@ -166,10 +298,32 @@ Partition_5.result().subResult(4).setName("Partition_5_1_5") Partition_5.result().subResult(5).setName("Partition_5_1_6") ### Create Extrusion -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "(Recover_6_1_3/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&__tube_sain_2/To_Edge)(Recover_6_1_3/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&________tube_sain/To_Edge)(Recover_6_1_3/Modified_Edge&PartSet/XOZ/XOZ&plan_partition/plan_partition&Sphere_1_1/Face_1)"), model.selection("EDGE", "Recover_6_1_3/Modified_Edge&PartSet/XOZ/XOZ&plan_partition/plan_partition&Sphere_1_1/Face_1")], model.selection("EDGE", "PartSet/OX"), 0, "tube_l") +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "EDGE", + "(Recover_6_1_3/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&__tube_sain_2/To_Edge)(Recover_6_1_3/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&________tube_sain/To_Edge)(Recover_6_1_3/Modified_Edge&PartSet/XOZ/XOZ&plan_partition/plan_partition&Sphere_1_1/Face_1)", + ), + model.selection( + "EDGE", + "Recover_6_1_3/Modified_Edge&PartSet/XOZ/XOZ&plan_partition/plan_partition&Sphere_1_1/Face_1", + ), + ], + model.selection("EDGE", "PartSet/OX"), + 0, + "tube_l", +) ### Create Common -Common_4 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "all-in-Partition_5"), model.selection("COMPOUND", "all-in-Extrusion_4")], keepSubResults = True) +Common_4 = model.addCommon( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Partition_5"), + model.selection("COMPOUND", "all-in-Extrusion_4"), + ], + keepSubResults=True, +) Common_4.result().subResult(0).setName("Common_4_1_1") Common_4.result().subResult(1).setName("Common_4_1_2") @@ -177,7 +331,14 @@ Common_4.result().subResult(1).setName("Common_4_1_2") Recover_7 = model.addRecover(Part_1_doc, Common_4, [Partition_5.result()], True) ### Create Partition -Partition_6 = model.addPartition(Part_1_doc, [model.selection("COMPOUND", "all-in-Common_4"), model.selection("COMPOUND", "all-in-Recover_7")], keepSubResults = True) +Partition_6 = model.addPartition( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Common_4"), + model.selection("COMPOUND", "all-in-Recover_7"), + ], + keepSubResults=True, +) Partition_6.result().setTransparency(0.72) Partition_6.result().subResult(0).setName("Partition_6_1_1") Partition_6.result().subResult(1).setName("Partition_6_1_2") @@ -188,7 +349,19 @@ Partition_6.result().subResult(5).setName("Partition_6_1_6") Partition_6.result().subResult(6).setName("Partition_6_1_7") ### Create Plane -Plane_5 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Recover_7_1_5/Modified_Vertex&_____________tube_sain/Face_3"), model.selection("VERTEX", "Recover_7_1_3/Modified_Vertex&_____________tube_sain/Face_3"), model.selection("VERTEX", "Recover_7_1_1/Modified_Vertex&_____________tube_sain/Face_2&new_weak_name_1")) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection( + "VERTEX", "Recover_7_1_5/Modified_Vertex&_____________tube_sain/Face_3" + ), + model.selection( + "VERTEX", "Recover_7_1_3/Modified_Vertex&_____________tube_sain/Face_3" + ), + model.selection( + "VERTEX", + "Recover_7_1_1/Modified_Vertex&_____________tube_sain/Face_2&new_weak_name_1", + ), +) ### Create Sketch Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2")) @@ -198,7 +371,13 @@ SketchLine_1 = Sketch_1.addLine(0, -0.08, 1, -0.08) Sketch_1.setHorizontal(SketchLine_1.result()) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Recover_7_1_1/Modified_Vertex&_____________tube_sain/Face_2&new_weak_name_2"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection( + "VERTEX", + "Recover_7_1_1/Modified_Vertex&_____________tube_sain/Face_2&new_weak_name_2", + ), + False, +) SketchPoint_1 = SketchProjection_1.createdFeature() Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.result()) @@ -211,7 +390,12 @@ SketchLine_3 = Sketch_1.addLine(1, 0.08, 0, 0.08) Sketch_1.setHorizontal(SketchLine_3.result()) ### Create SketchProjection -SketchProjection_2 = Sketch_1.addProjection(model.selection("VERTEX", "Recover_7_1_5/Modified_Vertex&_____________tube_sain/Face_3"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection( + "VERTEX", "Recover_7_1_5/Modified_Vertex&_____________tube_sain/Face_3" + ), + False, +) SketchPoint_2 = SketchProjection_2.createdFeature() Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchPoint_2.result()) @@ -228,7 +412,14 @@ model.do() Face_1 = model.addFace(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")]) ### Create Partition -Partition_7 = model.addPartition(Part_1_doc, [model.selection("COMPOUND", "all-in-Face_1"), model.selection("COMPOUND", "all-in-Partition_6")], keepSubResults = True) +Partition_7 = model.addPartition( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Face_1"), + model.selection("COMPOUND", "all-in-Partition_6"), + ], + keepSubResults=True, +) Partition_7.setName("Tube_rugueux") Partition_7.result().setName("Tube_rugueux") Partition_7.result().setTransparency(0.7) @@ -247,7 +438,22 @@ Partition_7.result().subResult(1).subResult(9).setName("Partition_7_1_2_10") Partition_7.result().subResult(1).subResult(10).setName("Partition_7_1_2_11") ### Create Extrusion -Extrusion_5 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "(Partition_6_1_7/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&___________tube_sain/To_Edge)(Partition_7_1_2_8/Modified_Edge&Sketch_1/SketchLine_3)"), model.selection("EDGE", "(Partition_6_1_7/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&___________tube_sain/To_Edge)(Partition_7_1_2_9/Modified_Edge&Sketch_1/SketchLine_3)")], model.selection("EDGE", "PartSet/OY"), 0, "tube_r") +Extrusion_5 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "EDGE", + "(Partition_6_1_7/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&___________tube_sain/To_Edge)(Partition_7_1_2_8/Modified_Edge&Sketch_1/SketchLine_3)", + ), + model.selection( + "EDGE", + "(Partition_6_1_7/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&___________tube_sain/To_Edge)(Partition_7_1_2_9/Modified_Edge&Sketch_1/SketchLine_3)", + ), + ], + model.selection("EDGE", "PartSet/OY"), + 0, + "tube_r", +) Extrusion_5.result().setName("Extrusion_5_1") Extrusion_5.results()[1].setName("Extrusion_5_2") @@ -256,7 +462,14 @@ Recover_8 = model.addRecover(Part_1_doc, Extrusion_5, [Partition_7.result()], Tr Recover_8.result().subResult(1).setTransparency(0.67) ### Create Common -Common_5 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_5"), model.selection("COMPOUND", "all-in-Recover_8")], keepSubResults = True) +Common_5 = model.addCommon( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Extrusion_5"), + model.selection("COMPOUND", "all-in-Recover_8"), + ], + keepSubResults=True, +) ### Create Recover Recover_9 = model.addRecover(Part_1_doc, Common_5, [Recover_8.result()], True) @@ -290,7 +503,22 @@ Recover_9.result().subResult(1).subResult(10).setName("Recover_10_1_2_11") Recover_9.result().subResult(1).subResult(10).setTransparency(0.64) ### Create Extrusion -Extrusion_6 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "(Recover_10_1_2_6/Modified_Edge&PartSet/YOZ/YOZ&Sphere_1_1/Face_1&_____________tube_sain/Face_1)(Recover_10_1_2_6/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&___tube_sain_2/To_Edge)(Recover_10_1_2_6/Modified_Edge&Sketch_1/SketchLine_1)"), model.selection("EDGE", "(Recover_10_1_2_7/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&___tube_sain_2/To_Edge)(Recover_10_1_2_7/Modified_Edge&_____________tube_sain/Face_1&PartSet/YOZ/YOZ&plan_partition/plan_partition&Sphere_1_1/Face_1)(Recover_10_1_2_7/Modified_Edge&Sketch_1/SketchLine_1)")], model.selection("EDGE", "PartSet/OY"), "tube_r", 0) +Extrusion_6 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "EDGE", + "(Recover_10_1_2_6/Modified_Edge&PartSet/YOZ/YOZ&Sphere_1_1/Face_1&_____________tube_sain/Face_1)(Recover_10_1_2_6/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&___tube_sain_2/To_Edge)(Recover_10_1_2_6/Modified_Edge&Sketch_1/SketchLine_1)", + ), + model.selection( + "EDGE", + "(Recover_10_1_2_7/Modified_Edge&plan_partition/plan_partition&Sphere_1_1/Face_1&___tube_sain_2/To_Edge)(Recover_10_1_2_7/Modified_Edge&_____________tube_sain/Face_1&PartSet/YOZ/YOZ&plan_partition/plan_partition&Sphere_1_1/Face_1)(Recover_10_1_2_7/Modified_Edge&Sketch_1/SketchLine_1)", + ), + ], + model.selection("EDGE", "PartSet/OY"), + "tube_r", + 0, +) ### Create Recover Recover_10 = model.addRecover(Part_1_doc, Extrusion_6, [Recover_8.result()], True) @@ -311,7 +539,14 @@ Recover_10.result().subResult(1).subResult(9).setName("Recover_9_1_2_10") Recover_10.result().subResult(1).subResult(10).setName("Recover_9_1_2_11") ### Create Common -Common_6 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_6"), model.selection("COMPOUND", "all-in-Recover_9")], keepSubResults = True) +Common_6 = model.addCommon( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Extrusion_6"), + model.selection("COMPOUND", "all-in-Recover_9"), + ], + keepSubResults=True, +) ### Create Recover Recover_11 = model.addRecover(Part_1_doc, Common_6, [Recover_10.result()], True) @@ -319,7 +554,16 @@ Recover_11 = model.addRecover(Part_1_doc, Common_6, [Recover_10.result()], True) model.do() ### Create Group -Group_1 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "Recover_11_1_2_10/Modified_Edge&_____________tube_sain/Face_2&__tube_sain_2/tube_sain_2")]) +Group_1 = model.addGroup( + Part_1_doc, + "Edges", + [ + model.selection( + "EDGE", + "Recover_11_1_2_10/Modified_Edge&_____________tube_sain/Face_2&__tube_sain_2/tube_sain_2", + ) + ], +) Group_1.setName("ValidEdge") Group_1.result().setName("ValidEdge") @@ -327,10 +571,11 @@ model.end() # check that resulting group selection is valid from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Group_1.feature())) -assert(Group_1.groupList().size() == 1) +assert aFactory.validate(Group_1.feature()) +assert Group_1.groupList().size() == 1 for a in range(1): - assert(Group_1.groupList().value(a).value().shapeTypeStr() == "EDGE") - assert(len(Group_1.groupList().value(a).namingName()) > 0) -assert(model.checkPythonDump()) + assert Group_1.groupList().value(a).value().shapeTypeStr() == "EDGE" + assert len(Group_1.groupList().value(a).namingName()) > 0 +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test2685.py b/src/ModelAPI/Test/Test2685.py index 22c169e57..ae84c788a 100644 --- a/src/ModelAPI/Test/Test2685.py +++ b/src/ModelAPI/Test/Test2685.py @@ -29,35 +29,63 @@ 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) +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) +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) +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) +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()) +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()) +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()) +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()) +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()) +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)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_WEAK) diff --git a/src/ModelAPI/Test/Test2828.py b/src/ModelAPI/Test/Test2828.py index 5dce40a6a..904f18dcd 100644 --- a/src/ModelAPI/Test/Test2828.py +++ b/src/ModelAPI/Test/Test2828.py @@ -26,14 +26,30 @@ model.addParameter(Part_1_doc, "a", "10") model.addParameter(Part_1_doc, "b", "20") ParamL = model.addParameter(Part_1_doc, "l", "100") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchLine_1 = Sketch_1.addLine(13.37522515430284, 1.633845843958015, -6.624774845697162, 1.633845843958015) -SketchLine_2 = Sketch_1.addLine(-6.624774845697162, 1.633845843958015, -6.624774845697162, -8.366154156041985) -SketchLine_3 = Sketch_1.addLine(-6.624774845697162, -8.366154156041985, 13.37522515430284, -8.366154156041985) -SketchLine_4 = Sketch_1.addLine(13.37522515430284, -8.366154156041985, 13.37522515430284, 1.633845843958015) -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()) +SketchLine_1 = Sketch_1.addLine( + 13.37522515430284, 1.633845843958015, -6.624774845697162, 1.633845843958015 +) +SketchLine_2 = Sketch_1.addLine( + -6.624774845697162, 1.633845843958015, -6.624774845697162, -8.366154156041985 +) +SketchLine_3 = Sketch_1.addLine( + -6.624774845697162, -8.366154156041985, 13.37522515430284, -8.366154156041985 +) +SketchLine_4 = Sketch_1.addLine( + 13.37522515430284, -8.366154156041985, 13.37522515430284, 1.633845843958015 +) +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()) @@ -41,15 +57,28 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), "a") SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), "b") 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(), "l", 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f", + ) + ], + model.selection(), + "l", + 0, +) model.do() from ModelAPI import * + aSession = ModelAPI_Session.get() aSession.blockAutoUpdate(True) model.testResultsVolumes(Extrusion_1, [20000]) ParamL.setValue(10) # emulate the "See preview" press during the transaction opened from ModelAPI import * + aSession = ModelAPI_Session.get() aSession.blockAutoUpdate(False) aSession.blockAutoUpdate(True) diff --git a/src/ModelAPI/Test/Test2859.py b/src/ModelAPI/Test/Test2859.py index 230ee8e11..903c58bee 100644 --- a/src/ModelAPI/Test/Test2859.py +++ b/src/ModelAPI/Test/Test2859.py @@ -30,15 +30,21 @@ param_h2 = model.addParameter(Part_1_doc, "h2", "70") model.addParameter(Part_1_doc, "h3", "7") model.addParameter(Part_1_doc, "d", "15") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchLine_1 = Sketch_1.addLine(-7.500000000000083, -15.81138830084192, -7.500000000000083, -26.99999999999995) +SketchLine_1 = Sketch_1.addLine( + -7.500000000000083, -15.81138830084192, -7.500000000000083, -26.99999999999995 +) SketchLine_1.setName("SketchLine_2") SketchLine_1.result().setName("SketchLine_2") SketchLine_2 = Sketch_1.addLine(-4.499999999999853, -30, 4.499999999999912, -30) SketchLine_2.setName("SketchLine_3") SketchLine_2.result().setName("SketchLine_3") -SketchLine_3 = Sketch_1.addLine(7.499999999999912, -27, 7.499999999999912, -15.81138830084196) +SketchLine_3 = Sketch_1.addLine( + 7.499999999999912, -27, 7.499999999999912, -15.81138830084196 +) SketchLine_3.setName("SketchLine_4") SketchLine_3.result().setName("SketchLine_4") SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) @@ -46,66 +52,151 @@ SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintHorizontal_1.setName("SketchConstraintHorizontal_2") SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) SketchPoint_2 = Sketch_1.addPoint(0, -30) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_2.result()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_2.result() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_6") -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_4 = SketchProjection_2.createdFeature() SketchLine_4.setName("SketchLine_5") SketchLine_4.result().setName("SketchLine_5") -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_4.result()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_4.result() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_7") -SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_3 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_5 = SketchProjection_3.createdFeature() SketchLine_5.setName("SketchLine_6") SketchLine_5.result().setName("SketchLine_6") -SketchArc_1 = Sketch_1.addArc(0, 0, -7.500000000000083, -15.81138830084192, -17.44306393762917, 1.410503622037771, True) +SketchArc_1 = Sketch_1.addArc( + 0, + 0, + -7.500000000000083, + -15.81138830084192, + -17.44306393762917, + 1.410503622037771, + True, +) SketchArc_1.setName("SketchArc_2") SketchArc_1.result().setName("SketchArc_2") SketchArc_1.results()[1].setName("SketchArc_2_2") -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchArc_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 17.5) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_1.startPoint() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_14") -SketchArc_2 = Sketch_1.addArc(-4.499999999999853, -27, -7.500000000000083, -26.99999999999995, -4.499999999999853, -30, False) +SketchArc_2 = Sketch_1.addArc( + -4.499999999999853, + -27, + -7.500000000000083, + -26.99999999999995, + -4.499999999999853, + -30, + False, +) SketchArc_2.setName("SketchArc_3") SketchArc_2.result().setName("SketchArc_3") SketchArc_2.results()[1].setName("SketchArc_3_2") SketchPoint_3 = Sketch_1.addPoint(-7.500000000000085, -30) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchPoint_3.coordinates(), SketchLine_5.result(), 30, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchPoint_3.coordinates(), SketchLine_5.result(), 30, True +) SketchPoint_3.setAuxiliary(True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_2.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_2.result() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_8") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_1.result()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_1.result() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_9") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_1.endPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_1.endPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_10") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_2.startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_11") -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_2.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_1.result()) -SketchArc_3 = Sketch_1.addArc(4.499999999999912, -27, 4.499999999999912, -30, 7.499999999999912, -27, False) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_2.result() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_1.result() +) +SketchArc_3 = Sketch_1.addArc( + 4.499999999999912, -27, 4.499999999999912, -30, 7.499999999999912, -27, False +) SketchArc_3.setName("SketchArc_4") SketchArc_3.result().setName("SketchArc_4") SketchArc_3.results()[1].setName("SketchArc_4_2") SketchPoint_4 = Sketch_1.addPoint(7.499999999999914, -30) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchPoint_3.coordinates(), SketchPoint_4.coordinates(), 15, False) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchPoint_3.coordinates(), SketchPoint_4.coordinates(), 15, False +) SketchPoint_4.setAuxiliary(True) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_3.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_3.result() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_13") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_2.result()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_2.result() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_15") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_2.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchLine_2.endPoint() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_16") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_17") -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_3.result()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_2.result()) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_3.result() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_2.result() +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 3) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_3.results()[1], SketchArc_2.results()[1]) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_1.result()) -SketchMultiRotation_1_objects = [SketchLine_1.result(), SketchArc_2.results()[1], SketchLine_2.result(), SketchArc_3.results()[1], SketchLine_3.result()] -SketchMultiRotation_1 = Sketch_1.addRotation(SketchMultiRotation_1_objects, SketchAPI_Line(SketchLine_5).startPoint(), 360, 3, True) -[SketchLine_6, SketchLine_7, SketchArc_4, SketchArc_5, SketchLine_8, SketchLine_9, SketchArc_6, SketchArc_7, SketchLine_10, SketchLine_11] = SketchMultiRotation_1.rotated() +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchArc_3.results()[1], SketchArc_2.results()[1] +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_1.result() +) +SketchMultiRotation_1_objects = [ + SketchLine_1.result(), + SketchArc_2.results()[1], + SketchLine_2.result(), + SketchArc_3.results()[1], + SketchLine_3.result(), +] +SketchMultiRotation_1 = Sketch_1.addRotation( + SketchMultiRotation_1_objects, + SketchAPI_Line(SketchLine_5).startPoint(), + 360, + 3, + True, +) +[ + SketchLine_6, + SketchLine_7, + SketchArc_4, + SketchArc_5, + SketchLine_8, + SketchLine_9, + SketchArc_6, + SketchArc_7, + SketchLine_10, + SketchLine_11, +] = SketchMultiRotation_1.rotated() SketchLine_11.setName("SketchLine_14") SketchLine_11.result().setName("SketchLine_14") SketchLine_10.setName("SketchLine_13") @@ -130,72 +221,153 @@ SketchLine_7.setName("SketchLine_8") SketchLine_7.result().setName("SketchLine_8") SketchLine_6.setName("SketchLine_7") SketchLine_6.result().setName("SketchLine_7") -SketchArc_8 = Sketch_1.addArc(0, 0, -9.943063937629109, 14.40088467880429, 9.94306393762926, 14.40088467880419, True) +SketchArc_8 = Sketch_1.addArc( + 0, + 0, + -9.943063937629109, + 14.40088467880429, + 9.94306393762926, + 14.40088467880419, + True, +) SketchArc_8.setName("SketchArc_10") SketchArc_8.result().setName("SketchArc_10") SketchArc_8.results()[1].setName("SketchArc_10_2") -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchArc_1.results()[1], SketchArc_8.results()[1]) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_1.center(), SketchArc_8.center()) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchArc_1.results()[1], SketchArc_8.results()[1] +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchArc_8.center() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_18") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_11.result()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_11.result() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_19") -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_8.startPoint(), SketchLine_7.result()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_8.startPoint(), SketchLine_7.result() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_20") -SketchArc_9 = Sketch_1.addArc(0, 0, 17.44306393762918, 1.410503622037589, 7.499999999999912, -15.81138830084196, True) +SketchArc_9 = Sketch_1.addArc( + 0, + 0, + 17.44306393762918, + 1.410503622037589, + 7.499999999999912, + -15.81138830084196, + True, +) SketchArc_9.setName("SketchArc_11") SketchArc_9.result().setName("SketchArc_11") SketchArc_9.results()[1].setName("SketchArc_11_2") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_9.endPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_9.endPoint(), SketchLine_3.endPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_12") -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchArc_8.results()[1], SketchArc_9.results()[1]) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_8.center(), SketchArc_9.center()) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchArc_8.results()[1], SketchArc_9.results()[1] +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchArc_8.center(), SketchArc_9.center() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_21") -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchLine_10.result()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchArc_8.endPoint(), SketchLine_10.result() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_22") -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchArc_9.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchArc_9.startPoint(), SketchLine_6.result() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_23") SketchCircle_1 = Sketch_1.addCircle(0, 0, 24) SketchCircle_1.setAuxiliary(True) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_24") SketchConstraintRadius_3 = Sketch_1.setRadius(SketchCircle_1.results()[1], 24) SketchCircle_2 = Sketch_1.addCircle(0, -24, 4) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchCircle_1.results()[1], SketchCircle_2.center()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchCircle_1.results()[1], SketchCircle_2.center() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_25") SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], 4) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchLine_4.result()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchCircle_2.center(), SketchLine_4.result() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_26") -SketchMultiRotation_2 = Sketch_1.addRotation([SketchCircle_2.results()[1]], SketchAPI_Line(SketchLine_4).startPoint(), 360, 3, True) +SketchMultiRotation_2 = Sketch_1.addRotation( + [SketchCircle_2.results()[1]], + SketchAPI_Line(SketchLine_4).startPoint(), + 360, + 3, + True, +) [SketchCircle_3, SketchCircle_4] = SketchMultiRotation_2.rotated() model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchArc_3_2f-SketchLine_3f-SketchArc_4_2f-SketchLine_4f-SketchArc_11_2f-SketchLine_7f-SketchArc_5_2f-SketchLine_10f-SketchArc_8_2f-SketchLine_13f-SketchArc_10_2f-SketchLine_8f-SketchArc_6_2f-SketchLine_11f-SketchArc_9_2f-SketchLine_14f-SketchArc_2_2f-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r")], model.selection(), "h1", 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_2f-SketchArc_3_2f-SketchLine_3f-SketchArc_4_2f-SketchLine_4f-SketchArc_11_2f-SketchLine_7f-SketchArc_5_2f-SketchLine_10f-SketchArc_8_2f-SketchLine_13f-SketchArc_10_2f-SketchLine_8f-SketchArc_6_2f-SketchLine_11f-SketchArc_9_2f-SketchLine_14f-SketchArc_2_2f-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r", + ) + ], + model.selection(), + "h1", + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_12 = SketchProjection_4.createdFeature() SketchLine_12.setName("SketchLine_12") SketchLine_12.result().setName("SketchLine_12") -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_13 = SketchProjection_5.createdFeature() SketchLine_13.setName("SketchLine_15") SketchLine_13.result().setName("SketchLine_15") SketchLine_14 = Sketch_2.addLine(7.500000000000332, 12.99038105676728, 15, 0) SketchLine_14.setName("SketchLine_16") SketchLine_14.result().setName("SketchLine_16") -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_12.result()) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_12.result() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_28") -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_14.startPoint(), "d", True) -SketchConstraintDistance_4 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_14.endPoint(), "d", True) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_14.startPoint(), "d", True +) +SketchConstraintDistance_4 = Sketch_2.setDistance( + SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_14.endPoint(), "d", True +) SketchLine_15 = Sketch_2.addLine(0, 0, 7.500000000000332, 12.99038105676728) SketchLine_15.setName("SketchLine_17") SketchLine_15.result().setName("SketchLine_17") SketchLine_15.setAuxiliary(True) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_15.startPoint() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_27") -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchLine_15.endPoint()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchLine_15.endPoint() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_29") -SketchConstraintAngle_1 = Sketch_2.setAngle(SketchLine_12.result(), SketchLine_15.result(), "360/6") -SketchMultiRotation_3 = Sketch_2.addRotation([SketchLine_14.result()], SketchAPI_Line(SketchLine_12).startPoint(), 360, 6, True) -[SketchLine_16, SketchLine_17, SketchLine_18, SketchLine_19, SketchLine_20] = SketchMultiRotation_3.rotated() +SketchConstraintAngle_1 = Sketch_2.setAngle( + SketchLine_12.result(), SketchLine_15.result(), "360/6" +) +SketchMultiRotation_3 = Sketch_2.addRotation( + [SketchLine_14.result()], SketchAPI_Line(SketchLine_12).startPoint(), 360, 6, True +) +[ + SketchLine_16, + SketchLine_17, + SketchLine_18, + SketchLine_19, + SketchLine_20, +] = SketchMultiRotation_3.rotated() SketchLine_20.setName("SketchLine_22") SketchLine_20.result().setName("SketchLine_22") SketchLine_19.setName("SketchLine_21") @@ -207,127 +379,398 @@ SketchLine_17.result().setName("SketchLine_19") SketchLine_16.setName("SketchLine_18") SketchLine_16.result().setName("SketchLine_18") model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_18r-SketchLine_19r-SketchLine_20r-SketchLine_21r-SketchLine_22r-SketchLine_16r_wire")], model.selection(), "h2-h3-h1", 0) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "WIRE", + "Sketch_2/Face-SketchLine_18r-SketchLine_19r-SketchLine_20r-SketchLine_21r-SketchLine_22r-SketchLine_16r_wire", + ) + ], + model.selection(), + "h2-h3-h1", + 0, +) Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face")) -SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_6 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_21 = SketchProjection_6.createdFeature() SketchLine_21.setName("SketchLine_23") SketchLine_21.result().setName("SketchLine_23") SketchCircle_5 = Sketch_3.addCircle(0, 0, 10) -SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_21).startPoint(), SketchCircle_5.center()) +SketchConstraintCoincidence_26 = Sketch_3.setCoincident( + SketchAPI_Line(SketchLine_21).startPoint(), SketchCircle_5.center() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_30") SketchConstraintRadius_5 = Sketch_3.setRadius(SketchCircle_5.results()[1], 10) model.do() -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")]) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_5_2f")], model.selection(), 0, 60, [model.selection("SOLID", "Fuse_1_1")]) -Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/From_Face")) -SketchProjection_7 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OX"), False) +Fuse_1 = model.addFuse( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_2_1"), + ], +) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [model.selection("FACE", "Sketch_3/Face-SketchCircle_5_2f")], + model.selection(), + 0, + 60, + [model.selection("SOLID", "Fuse_1_1")], +) +Sketch_4 = model.addSketch( + Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/From_Face") +) +SketchProjection_7 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_22 = SketchProjection_7.createdFeature() SketchLine_22.setName("SketchLine_24") SketchLine_22.result().setName("SketchLine_24") SketchCircle_6 = Sketch_4.addCircle(0, 0, 12.5) -SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_22).startPoint(), SketchCircle_6.center()) +SketchConstraintCoincidence_27 = Sketch_4.setCoincident( + SketchAPI_Line(SketchLine_22).startPoint(), SketchCircle_6.center() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_31") SketchConstraintRadius_6 = Sketch_4.setRadius(SketchCircle_6.results()[1], 12.5) model.do() -ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchArc_3_2f-SketchLine_3f-SketchArc_4_2f-SketchLine_4f-SketchArc_11_2f-SketchLine_7f-SketchArc_5_2f-SketchLine_10f-SketchArc_8_2f-SketchLine_13f-SketchArc_10_2f-SketchLine_8f-SketchArc_6_2f-SketchLine_11f-SketchArc_9_2f-SketchLine_14f-SketchArc_2_2f-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")]) -Fillet_1_objects = [model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_20]"), model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_21]"), model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_22]"), model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_16]"), model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_19]"), model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_18]")] +ExtrusionCut_2 = model.addExtrusionCut( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_4")], + model.selection(), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_2f-SketchArc_3_2f-SketchLine_3f-SketchArc_4_2f-SketchLine_4f-SketchArc_11_2f-SketchLine_7f-SketchArc_5_2f-SketchLine_10f-SketchArc_8_2f-SketchLine_13f-SketchArc_10_2f-SketchLine_8f-SketchArc_6_2f-SketchLine_11f-SketchArc_9_2f-SketchLine_14f-SketchArc_2_2f-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r", + ), + 0, + model.selection(), + 0, + [model.selection("SOLID", "ExtrusionCut_1_1")], +) +Fillet_1_objects = [ + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_20]", + ), + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_21]", + ), + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_22]", + ), + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_16]", + ), + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_19]", + ), + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_18]", + ), +] Fillet_1 = model.addFillet(Part_1_doc, Fillet_1_objects, 1) -Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_2_1/To_Face")) -SketchProjection_8 = Sketch_5.addProjection(model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Extrusion_2_1/To_Face][ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchCircle_5_2]__cc"), False) +Sketch_5 = model.addSketch( + Part_1_doc, + model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_2_1/To_Face"), +) +SketchProjection_8 = Sketch_5.addProjection( + model.selection( + "VERTEX", + "[ExtrusionCut_1_1/Modified_Face&Extrusion_2_1/To_Face][ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchCircle_5_2]__cc", + ), + False, +) SketchPoint_5 = SketchProjection_8.createdFeature() SketchCircle_7 = Sketch_5.addCircle(0, 0, 22) -SketchConstraintCoincidence_28 = Sketch_5.setCoincident(SketchPoint_5.result(), SketchCircle_7.center()) +SketchConstraintCoincidence_28 = Sketch_5.setCoincident( + SketchPoint_5.result(), SketchCircle_7.center() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_32") SketchConstraintRadius_7 = Sketch_5.setRadius(SketchCircle_7.results()[1], 22) model.do() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchCircle_7_2f")], model.selection(), "h3", 0) -Fuse_2 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Fillet_1_1"), model.selection("SOLID", "Extrusion_3_1")]) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_5/Face-SketchCircle_7_2f")], + model.selection(), + "h3", + 0, +) +Fuse_2 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Fillet_1_1"), model.selection("SOLID", "Extrusion_3_1")], +) Sketch_6 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) SketchLine_23 = Sketch_6.addLine(22, 70, 20, 70) SketchLine_23.setName("SketchLine_25") SketchLine_23.result().setName("SketchLine_25") -SketchProjection_9 = Sketch_6.addProjection(model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_5/SketchCircle_7_2][Extrusion_3_1/To_Face]"), False) +SketchProjection_9 = Sketch_6.addProjection( + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_5/SketchCircle_7_2][Extrusion_3_1/To_Face]", + ), + False, +) SketchPoint_6 = SketchProjection_9.createdFeature() -SketchConstraintCoincidence_29 = Sketch_6.setCoincident(SketchLine_23.startPoint(), SketchPoint_6.result()) +SketchConstraintCoincidence_29 = Sketch_6.setCoincident( + SketchLine_23.startPoint(), SketchPoint_6.result() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_33") SketchLine_24 = Sketch_6.addLine(20, 70, 22, 68.84529946162075) SketchLine_24.setName("SketchLine_26") SketchLine_24.result().setName("SketchLine_26") -SketchConstraintCoincidence_30 = Sketch_6.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) +SketchConstraintCoincidence_30 = Sketch_6.setCoincident( + SketchLine_23.endPoint(), SketchLine_24.startPoint() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_34") -SketchProjection_10 = Sketch_6.addProjection(model.selection("EDGE", "([Extrusion_3_1/Generated_Face&Sketch_5/SketchCircle_7_2][Extrusion_3_1/To_Face])_Fuse_2_1"), False) +SketchProjection_10 = Sketch_6.addProjection( + model.selection( + "EDGE", + "([Extrusion_3_1/Generated_Face&Sketch_5/SketchCircle_7_2][Extrusion_3_1/To_Face])_Fuse_2_1", + ), + False, +) SketchLine_25 = SketchProjection_10.createdFeature() SketchLine_25.setName("SketchLine_27") SketchLine_25.result().setName("SketchLine_27") -SketchConstraintCoincidence_31 = Sketch_6.setCoincident(SketchLine_24.endPoint(), SketchLine_25.result()) +SketchConstraintCoincidence_31 = Sketch_6.setCoincident( + SketchLine_24.endPoint(), SketchLine_25.result() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_35") SketchLine_26 = Sketch_6.addLine(22, 68.84529946162075, 22, 70) SketchLine_26.setName("SketchLine_28") SketchLine_26.result().setName("SketchLine_28") -SketchConstraintCoincidence_32 = Sketch_6.setCoincident(SketchLine_24.endPoint(), SketchLine_26.startPoint()) +SketchConstraintCoincidence_32 = Sketch_6.setCoincident( + SketchLine_24.endPoint(), SketchLine_26.startPoint() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_36") -SketchConstraintCoincidence_33 = Sketch_6.setCoincident(SketchLine_23.startPoint(), SketchLine_26.endPoint()) +SketchConstraintCoincidence_33 = Sketch_6.setCoincident( + SketchLine_23.startPoint(), SketchLine_26.endPoint() +) SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_37") SketchLine_27 = Sketch_6.addLine(21.99999999999999, 64, 22, 63) SketchLine_27.setName("SketchLine_29") SketchLine_27.result().setName("SketchLine_29") -SketchConstraintCoincidence_34 = Sketch_6.setCoincident(SketchLine_27.startPoint(), SketchLine_25.result()) +SketchConstraintCoincidence_34 = Sketch_6.setCoincident( + SketchLine_27.startPoint(), SketchLine_25.result() +) SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_38") -SketchConstraintCoincidence_35 = Sketch_6.setCoincident(SketchAPI_Line(SketchLine_25).startPoint(), SketchLine_27.endPoint()) +SketchConstraintCoincidence_35 = Sketch_6.setCoincident( + SketchAPI_Line(SketchLine_25).startPoint(), SketchLine_27.endPoint() +) SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_39") SketchLine_28 = Sketch_6.addLine(21.99999999999999, 64, 21.73205080756888, 63) SketchLine_28.setName("SketchLine_30") SketchLine_28.result().setName("SketchLine_30") -SketchConstraintCoincidence_36 = Sketch_6.setCoincident(SketchLine_27.startPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_36 = Sketch_6.setCoincident( + SketchLine_27.startPoint(), SketchLine_28.startPoint() +) SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_40") SketchLine_29 = Sketch_6.addLine(21.73205080756888, 63, 22, 63) SketchLine_29.setName("SketchLine_31") SketchLine_29.result().setName("SketchLine_31") -SketchConstraintCoincidence_37 = Sketch_6.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_37 = Sketch_6.setCoincident( + SketchLine_28.endPoint(), SketchLine_29.startPoint() +) SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_41") -SketchConstraintCoincidence_38 = Sketch_6.setCoincident(SketchAPI_Line(SketchLine_25).startPoint(), SketchLine_29.endPoint()) +SketchConstraintCoincidence_38 = Sketch_6.setCoincident( + SketchAPI_Line(SketchLine_25).startPoint(), SketchLine_29.endPoint() +) SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_42") SketchConstraintLength_1 = Sketch_6.setLength(SketchLine_23.result(), 2) -SketchConstraintAngle_2 = Sketch_6.setAngleBackward(SketchLine_23.result(), SketchLine_24.result(), 30) +SketchConstraintAngle_2 = Sketch_6.setAngleBackward( + SketchLine_23.result(), SketchLine_24.result(), 30 +) SketchConstraintHorizontal_2 = Sketch_6.setHorizontal(SketchLine_23.result()) SketchConstraintHorizontal_2.setName("SketchConstraintHorizontal_3") SketchConstraintHorizontal_3 = Sketch_6.setHorizontal(SketchLine_29.result()) SketchConstraintHorizontal_3.setName("SketchConstraintHorizontal_4") SketchConstraintLength_2 = Sketch_6.setLength(SketchLine_27.result(), 1) -SketchConstraintAngle_3 = Sketch_6.setAngle(SketchLine_28.result(), SketchLine_27.result(), 15) +SketchConstraintAngle_3 = Sketch_6.setAngle( + SketchLine_28.result(), SketchLine_27.result(), 15 +) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection("EDGE", "PartSet/OZ"), 360, 0) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Fuse_2_1")], [model.selection("SOLID", "Revolution_1_2"), model.selection("SOLID", "Revolution_1_1")]) -Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Cut_1_1/Modified_Face&Extrusion_3_1/To_Face")) -SketchProjection_11 = Sketch_7.addProjection(model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_6/SketchLine_26][Cut_1_1/Modified_Face&Extrusion_3_1/To_Face]__cc"), False) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_6")], + model.selection("EDGE", "PartSet/OZ"), + 360, + 0, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Fuse_2_1")], + [ + model.selection("SOLID", "Revolution_1_2"), + model.selection("SOLID", "Revolution_1_1"), + ], +) +Sketch_7 = model.addSketch( + Part_1_doc, model.selection("FACE", "Cut_1_1/Modified_Face&Extrusion_3_1/To_Face") +) +SketchProjection_11 = Sketch_7.addProjection( + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_6/SketchLine_26][Cut_1_1/Modified_Face&Extrusion_3_1/To_Face]__cc", + ), + False, +) SketchPoint_7 = SketchProjection_11.createdFeature() SketchCircle_8 = Sketch_7.addCircle(0, 0, 26) SketchCircle_8.setAuxiliary(True) -SketchConstraintCoincidence_39 = Sketch_7.setCoincident(SketchPoint_7.result(), SketchCircle_8.center()) +SketchConstraintCoincidence_39 = Sketch_7.setCoincident( + SketchPoint_7.result(), SketchCircle_8.center() +) SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_43") SketchConstraintRadius_8 = Sketch_7.setRadius(SketchCircle_8.results()[1], 26) SketchCircle_9 = Sketch_7.addCircle(0, -26, 5.25) -SketchConstraintCoincidence_40 = Sketch_7.setCoincident(SketchCircle_8.results()[1], SketchCircle_9.center()) +SketchConstraintCoincidence_40 = Sketch_7.setCoincident( + SketchCircle_8.results()[1], SketchCircle_9.center() +) SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_44") -SketchProjection_12 = Sketch_7.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_12 = Sketch_7.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_30 = SketchProjection_12.createdFeature() SketchLine_30.setName("SketchLine_32") SketchLine_30.result().setName("SketchLine_32") SketchConstraintRadius_9 = Sketch_7.setRadius(SketchCircle_9.results()[1], 5.25) -SketchConstraintCoincidence_41 = Sketch_7.setCoincident(SketchCircle_9.center(), SketchLine_30.result()) +SketchConstraintCoincidence_41 = Sketch_7.setCoincident( + SketchCircle_9.center(), SketchLine_30.result() +) SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_45") -SketchMultiRotation_4 = Sketch_7.addRotation([SketchCircle_9.results()[1]], SketchAPI_Line(SketchLine_30).startPoint(), 360, 16, True) -[SketchCircle_10, SketchCircle_11, SketchCircle_12, SketchCircle_13, SketchCircle_14, SketchCircle_15, SketchCircle_16, SketchCircle_17, SketchCircle_18, SketchCircle_19, SketchCircle_20, SketchCircle_21, SketchCircle_22, SketchCircle_23, SketchCircle_24] = SketchMultiRotation_4.rotated() +SketchMultiRotation_4 = Sketch_7.addRotation( + [SketchCircle_9.results()[1]], + SketchAPI_Line(SketchLine_30).startPoint(), + 360, + 16, + True, +) +[ + SketchCircle_10, + SketchCircle_11, + SketchCircle_12, + SketchCircle_13, + SketchCircle_14, + SketchCircle_15, + SketchCircle_16, + SketchCircle_17, + SketchCircle_18, + SketchCircle_19, + SketchCircle_20, + SketchCircle_21, + SketchCircle_22, + SketchCircle_23, + SketchCircle_24, +] = SketchMultiRotation_4.rotated() model.do() -Extrusion_4_objects = [model.selection("FACE", "Sketch_7/Face-SketchCircle_19_2f-SketchCircle_20_2r-SketchCircle_19_2f-SketchCircle_19_2f-SketchCircle_18_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_18_2f-SketchCircle_19_2r-SketchCircle_18_2f-SketchCircle_17_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_17_2f-SketchCircle_18_2r-SketchCircle_18_2r-SketchCircle_17_2f-SketchCircle_16_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_15_2f-SketchCircle_15_2f-SketchCircle_16_2r-SketchCircle_15_2f-SketchCircle_14_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_16_2f-SketchCircle_16_2f-SketchCircle_17_2r-SketchCircle_17_2r-SketchCircle_16_2f-SketchCircle_15_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_14_2f-SketchCircle_14_2f-SketchCircle_15_2r-SketchCircle_14_2f-SketchCircle_13_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_13_2f-SketchCircle_13_2f-SketchCircle_14_2r-SketchCircle_13_2f-SketchCircle_12_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_12_2f-SketchCircle_12_2f-SketchCircle_13_2r-SketchCircle_12_2f-SketchCircle_11_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_11_2f-SketchCircle_11_2f-SketchCircle_12_2r-SketchCircle_11_2f-SketchCircle_10_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_9_2r-SketchCircle_10_2f-SketchCircle_10_2f-SketchCircle_11_2r-SketchCircle_10_2f-SketchCircle_9_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_9_2f-SketchCircle_24_2r-SketchCircle_24_2r-SketchCircle_9_2f-SketchCircle_10_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_24_2f-SketchCircle_23_2r-SketchCircle_24_2f-SketchCircle_9_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_23_2f-SketchCircle_24_2r-SketchCircle_23_2f-SketchCircle_23_2f-SketchCircle_22_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_22_2f-SketchCircle_23_2r-SketchCircle_22_2f-SketchCircle_22_2f-SketchCircle_21_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_21_2f-SketchCircle_22_2r-SketchCircle_21_2f-SketchCircle_21_2f-SketchCircle_20_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_20_2f-SketchCircle_21_2r-SketchCircle_20_2f-SketchCircle_20_2f-SketchCircle_19_2r")] -Extrusion_4 = model.addExtrusion(Part_1_doc, Extrusion_4_objects, model.selection(), model.selection("FACE", "Sketch_5/Face-SketchCircle_7_2f"), 0, model.selection(), 0) +Extrusion_4_objects = [ + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_19_2f-SketchCircle_20_2r-SketchCircle_19_2f-SketchCircle_19_2f-SketchCircle_18_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_18_2f-SketchCircle_19_2r-SketchCircle_18_2f-SketchCircle_17_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_17_2f-SketchCircle_18_2r-SketchCircle_18_2r-SketchCircle_17_2f-SketchCircle_16_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_15_2f-SketchCircle_15_2f-SketchCircle_16_2r-SketchCircle_15_2f-SketchCircle_14_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_16_2f-SketchCircle_16_2f-SketchCircle_17_2r-SketchCircle_17_2r-SketchCircle_16_2f-SketchCircle_15_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_14_2f-SketchCircle_14_2f-SketchCircle_15_2r-SketchCircle_14_2f-SketchCircle_13_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_13_2f-SketchCircle_13_2f-SketchCircle_14_2r-SketchCircle_13_2f-SketchCircle_12_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_12_2f-SketchCircle_12_2f-SketchCircle_13_2r-SketchCircle_12_2f-SketchCircle_11_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_11_2f-SketchCircle_11_2f-SketchCircle_12_2r-SketchCircle_11_2f-SketchCircle_10_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_9_2r-SketchCircle_10_2f-SketchCircle_10_2f-SketchCircle_11_2r-SketchCircle_10_2f-SketchCircle_9_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_9_2f-SketchCircle_24_2r-SketchCircle_24_2r-SketchCircle_9_2f-SketchCircle_10_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_24_2f-SketchCircle_23_2r-SketchCircle_24_2f-SketchCircle_9_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_23_2f-SketchCircle_24_2r-SketchCircle_23_2f-SketchCircle_23_2f-SketchCircle_22_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_22_2f-SketchCircle_23_2r-SketchCircle_22_2f-SketchCircle_22_2f-SketchCircle_21_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_21_2f-SketchCircle_22_2r-SketchCircle_21_2f-SketchCircle_21_2f-SketchCircle_20_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_20_2f-SketchCircle_21_2r-SketchCircle_20_2f-SketchCircle_20_2f-SketchCircle_19_2r", + ), +] +Extrusion_4 = model.addExtrusion( + Part_1_doc, + Extrusion_4_objects, + model.selection(), + model.selection("FACE", "Sketch_5/Face-SketchCircle_7_2f"), + 0, + model.selection(), + 0, +) model.do() # change the parameter value param_h2.setValue(90) model.end() # check the final extrusion is valid: aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Extrusion_4.feature())) +assert aFactory.validate(Extrusion_4.feature()) -model.testResultsVolumes(Extrusion_4, [597.118881248058755772945005447, 597.118881248058755772945005447, 597.118881248058755772945005447, 597.118881248058755772945005447, 597.118881248058755772945005447, 597.118881248058755772945005447, 597.118881248058755772945005447, 597.118881248058755772945005447, 597.118881248058755772945005447, 597.118881248058755772945005447, 597.118881248058755772945005447, 597.118881248058755772945005447, 597.118881248058755772945005447, 597.118881248058755772945005447, 597.118881248058755772945005447, 597.118881248058755772945005447]) +model.testResultsVolumes( + Extrusion_4, + [ + 597.118881248058755772945005447, + 597.118881248058755772945005447, + 597.118881248058755772945005447, + 597.118881248058755772945005447, + 597.118881248058755772945005447, + 597.118881248058755772945005447, + 597.118881248058755772945005447, + 597.118881248058755772945005447, + 597.118881248058755772945005447, + 597.118881248058755772945005447, + 597.118881248058755772945005447, + 597.118881248058755772945005447, + 597.118881248058755772945005447, + 597.118881248058755772945005447, + 597.118881248058755772945005447, + 597.118881248058755772945005447, + ], +) diff --git a/src/ModelAPI/Test/Test2873.py b/src/ModelAPI/Test/Test2873.py index 433bf2b2a..4dc695967 100644 --- a/src/ModelAPI/Test/Test2873.py +++ b/src/ModelAPI/Test/Test2873.py @@ -34,17 +34,36 @@ SketchLine_1 = Sketch_1.addLine(50, -50, -50, -50) SketchLine_2 = Sketch_1.addLine(-50, -50, -50, 50) SketchLine_3 = Sketch_1.addLine(-50, 50, 50, 50) SketchLine_4 = Sketch_1.addLine(50, 50, 50, -50) -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()) +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")]) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_4")]) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], +) +Edge_1 = model.addEdge( + Part_1_doc, + [model.selection("EDGE", "Face_1_1/Modified_Edge&Sketch_1/SketchLine_4")], +) Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "PartSet/Origin")]) Folder_1 = model.addFolder(Part_1_doc, Face_1, Face_1) Folder_2 = model.addFolder(Part_1_doc, Edge_1, Edge_1) @@ -59,4 +78,4 @@ Folder_3 = model.addFolder(Part_1_doc, Vertex_1, Vertex_1) model.do() model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test2901.py b/src/ModelAPI/Test/Test2901.py index 98ce2d9e9..6fe926b2f 100644 --- a/src/ModelAPI/Test/Test2901.py +++ b/src/ModelAPI/Test/Test2901.py @@ -33,18 +33,28 @@ model.addParameter(Part_1_doc, "h", "25") model.addParameter(Part_1_doc, "r", "25") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(200, 0, 0, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchLine_2 = Sketch_1.addLine(0, 0, 0, 100) SketchLine_3 = Sketch_1.addLine(0, 100, 200, 100) SketchLine_4 = Sketch_1.addLine(200, 100, 200, 0) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_2") -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3") -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_4") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5") SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) @@ -52,49 +62,108 @@ SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "l") SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), "b") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_6") SketchCircle_1 = Sketch_1.addCircle(50, 50, 25) SketchCircle_2 = Sketch_1.addCircle(150, 50, 25) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "r") -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_2.result(), "l/4", True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_1.result(), "b/2", True) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_2.result(), "l/4", True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_1.result(), "b/2", True +) SketchLine_5 = Sketch_1.addLine(50, 50, 150, 50) SketchLine_5.setAuxiliary(True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchCircle_2.center(), SketchLine_5.endPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8") SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_5.endPoint(), SketchLine_4.result(), "l/4", True) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_5.endPoint(), SketchLine_4.result(), "l/4", True +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "h", 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "h", 0 +) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 100, False) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("FACE", "Plane_1")]) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2")]) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("FACE", "Plane_1")], +) +Group_1 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2")], +) Group_1.setName("Inlet") Group_1.result().setName("Inlet") -Group_2 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4")]) +Group_2 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4")], +) Group_2.setName("Outlet") Group_2.result().setName("Outlet") -Group_3_objects = [model.selection("FACE", "Partition_1_1_1/Modified_Face&Extrusion_1_1_1/To_Face"), model.selection("FACE", "Partition_1_1_1/Modified_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Partition_1_1_1/Modified_Face&Extrusion_1_1_1/From_Face"), model.selection("FACE", "Partition_1_1_1/Modified_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Extrusion_1_1_1/From_Face"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Extrusion_1_1_1/To_Face")] +Group_3_objects = [ + model.selection("FACE", "Partition_1_1_1/Modified_Face&Extrusion_1_1_1/To_Face"), + model.selection("FACE", "Partition_1_1_1/Modified_Face&Sketch_1/SketchLine_1"), + model.selection("FACE", "Partition_1_1_1/Modified_Face&Extrusion_1_1_1/From_Face"), + model.selection("FACE", "Partition_1_1_1/Modified_Face&Sketch_1/SketchLine_3"), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Sketch_1/SketchLine_3"), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Extrusion_1_1_1/From_Face"), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Sketch_1/SketchLine_1"), + model.selection("FACE", "Partition_1_1_2/Modified_Face&Extrusion_1_1_1/To_Face"), +] Group_3 = model.addGroup(Part_1_doc, Group_3_objects) Group_3.setName("Wall") Group_3.result().setName("Wall") -Group_4 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Partition_1_1_3"), model.selection("SOLID", "Partition_1_1_4")]) +Group_4 = model.addGroup( + Part_1_doc, + [ + model.selection("SOLID", "Partition_1_1_3"), + model.selection("SOLID", "Partition_1_1_4"), + ], +) Group_4.setName("Cylinders") Group_4.result().setName("Cylinders") Group_4.result().setColor(170, 0, 0) -Group_5 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Partition_1_1_2")]) +Group_5 = model.addGroup( + Part_1_doc, + [ + model.selection("SOLID", "Partition_1_1_1"), + model.selection("SOLID", "Partition_1_1_2"), + ], +) Group_5.setName("Fluide") Group_5.result().setName("Fluide") Group_5.result().setColor(0, 0, 255) -Group_6 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_2_2")]) +Group_6 = model.addGroup( + Part_1_doc, + [ + model.selection( + "FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2" + ), + model.selection( + "FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_2_2" + ), + ], +) Group_6.setName("Faces_cyl") Group_6.result().setName("Faces_cyl") Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 10, False) -Partition_2 = model.addPartition(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1"), model.selection("FACE", "Plane_2")]) +Partition_2 = model.addPartition( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1"), model.selection("FACE", "Plane_2")], +) model.do() # move groups after the latest partitiion Part_1_doc.moveFeature(Group_1.feature(), Partition_2.feature()) @@ -107,19 +176,20 @@ model.end() # check groups are correct: group name, number of elements, elements type Group_Info = [ -(Group_1, 2, GeomAPI_Shape.FACE), # Inlet -(Group_2, 2, GeomAPI_Shape.FACE), # Outlet -(Group_3, 12, GeomAPI_Shape.FACE), # Wall -(Group_4, 4, GeomAPI_Shape.SOLID), # Cylinders -(Group_5, 4, GeomAPI_Shape.SOLID), # Fluide -(Group_6, 4, GeomAPI_Shape.FACE)] # Faces_cyl + (Group_1, 2, GeomAPI_Shape.FACE), # Inlet + (Group_2, 2, GeomAPI_Shape.FACE), # Outlet + (Group_3, 12, GeomAPI_Shape.FACE), # Wall + (Group_4, 4, GeomAPI_Shape.SOLID), # Cylinders + (Group_5, 4, GeomAPI_Shape.SOLID), # Fluide + (Group_6, 4, GeomAPI_Shape.FACE), +] # Faces_cyl aFactory = ModelAPI_Session.get().validators() for group in Group_Info: - selectionList = group[0].feature().selectionList("group_list") - assert(selectionList.size() == group[1]) - assert(aFactory.validate(group[0].feature())) - for i in range(group[1]): - assert(group[0].groupList().value(i).value().shapeType() == group[2]) + selectionList = group[0].feature().selectionList("group_list") + assert selectionList.size() == group[1] + assert aFactory.validate(group[0].feature()) + for i in range(group[1]): + assert group[0].groupList().value(i).value().shapeType() == group[2] -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test2903.py b/src/ModelAPI/Test/Test2903.py index 190eabe20..2b1eac6e8 100644 --- a/src/ModelAPI/Test/Test2903.py +++ b/src/ModelAPI/Test/Test2903.py @@ -25,17 +25,42 @@ 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) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 10) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "all-in-Box_1"), model.selection("COMPOUND", "all-in-Cylinder_1")], True) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("COMPOUND", "all-in-Fuse_1"), model.selection("COMPOUND", "all-in-Sphere_1")]) +Fuse_1 = model.addFuse( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Box_1"), + model.selection("COMPOUND", "all-in-Cylinder_1"), + ], + True, +) +Partition_1 = model.addPartition( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Fuse_1"), + model.selection("COMPOUND", "all-in-Sphere_1"), + ], +) model.do() aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Fuse_1.feature())) -assert(aFactory.validate(Partition_1.feature())) +assert aFactory.validate(Fuse_1.feature()) +assert aFactory.validate(Partition_1.feature()) # Modify Fuse to add sphere thatwas used in Partition -Fuse_1.setMainObjects([model.selection("COMPOUND", "all-in-Box_1"), model.selection("COMPOUND", "all-in-Cylinder_1"), model.selection("COMPOUND", "all-in-Sphere_1")]) +Fuse_1.setMainObjects( + [ + model.selection("COMPOUND", "all-in-Box_1"), + model.selection("COMPOUND", "all-in-Cylinder_1"), + model.selection("COMPOUND", "all-in-Sphere_1"), + ] +) model.end() # partition must become invalid because it refers to the same object as fuse -assert(aFactory.validate(Fuse_1.feature())) -assert(not aFactory.validate(Partition_1.feature())) +assert aFactory.validate(Fuse_1.feature()) +assert not aFactory.validate(Partition_1.feature()) diff --git a/src/ModelAPI/Test/Test3020.py b/src/ModelAPI/Test/Test3020.py index 04099ef5e..7949d5c1d 100644 --- a/src/ModelAPI/Test/Test3020.py +++ b/src/ModelAPI/Test/Test3020.py @@ -27,16 +27,30 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(25, 20, 10) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 20, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], + model.selection(), + 20, + 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) +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(25, 20, 5) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchCircle_2.center()) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchPoint_1.result(), SketchCircle_2.center() +) model.end() # check the sketch_2 projection and the whole sketch is valid after selection of the circle center from another part aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(SketchProjection_1.feature())) -assert(aFactory.validate(Sketch_2.feature())) +assert aFactory.validate(SketchProjection_1.feature()) +assert aFactory.validate(Sketch_2.feature()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/Test3116.py b/src/ModelAPI/Test/Test3116.py index 50bbeeef8..a30ee4605 100644 --- a/src/ModelAPI/Test/Test3116.py +++ b/src/ModelAPI/Test/Test3116.py @@ -28,12 +28,15 @@ SketchCircle_1 = Sketch_1.addCircle(16, 15, 3) model.do() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Edge_1 = model.addEdge(Part_1_doc, [model.selection("COMPOUND", "PartSet/all-in-Sketch_1")], False) +Edge_1 = model.addEdge( + Part_1_doc, [model.selection("COMPOUND", "PartSet/all-in-Sketch_1")], False +) model.end() # check the result validity from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Edge_1.feature())) +assert aFactory.validate(Edge_1.feature()) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestBlockRecalculation.py b/src/ModelAPI/Test/TestBlockRecalculation.py index 6b560dadd..06465e96e 100644 --- a/src/ModelAPI/Test/TestBlockRecalculation.py +++ b/src/ModelAPI/Test/TestBlockRecalculation.py @@ -33,44 +33,152 @@ param_a1 = model.addParameter(partSet, "a1", "35") param_a2 = model.addParameter(partSet, "a2", "150") Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 35.14523516719186, 10, 35.14523516719186) -SketchLine_2 = Sketch_1.addLine(10.57357643635423, 33.32608312288851, 6.47781621490927, 30.45820094113327) +SketchLine_2 = Sketch_1.addLine( + 10.57357643635423, 33.32608312288851, 6.47781621490927, 30.45820094113327 +) SketchLine_3 = Sketch_1.addLine(6.47781621490927, 30.45820094113327, 3, 23) SketchLine_4 = Sketch_1.addLine(3, 23, 3, 3) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_3") SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "OX"), False) SketchLine_5 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_2.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_2.endPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_4") SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "OY"), False) SketchLine_6 = SketchProjection_2.createdFeature() SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), "l1") -SketchArc_1 = Sketch_1.addArc(10.00000000000669, 34.14523516718319, 10.57357643635423, 33.32608312288851, 10, 35.14523516719186, False) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.endPoint()) -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_1 = Sketch_1.addArc( + 10.00000000000669, + 34.14523516718319, + 10.57357643635423, + 33.32608312288851, + 10, + 35.14523516719186, + False, +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.endPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_1.result() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_2.result() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 1) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_2.result(), "a2") +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_3.result(), SketchLine_2.result(), "a2" +) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), "l2") -SketchConstraintAngle_2 = Sketch_1.setAngleBackward(SketchLine_2.result(), SketchLine_1.result(), "a1") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.result()) +SketchConstraintAngle_2 = Sketch_1.setAngleBackward( + SketchLine_2.result(), SketchLine_1.result(), "a1" +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_6.result() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_4.endPoint(), SketchAPI_Line(SketchLine_6).startPoint(), 3) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_4.endPoint(), SketchAPI_Line(SketchLine_6).startPoint(), 3) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_4.endPoint(), SketchAPI_Line(SketchLine_6).startPoint(), 3 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_4.endPoint(), SketchAPI_Line(SketchLine_6).startPoint(), 3 +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_1.result(), "l1/2") -SketchConstraintMirror_1_objects = [SketchLine_1.result(), SketchArc_1.results()[1], SketchLine_2.result(), SketchLine_3.result(), SketchLine_4.result()] -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_6.result(), SketchConstraintMirror_1_objects) -[SketchLine_7, SketchArc_2, SketchLine_8, SketchLine_9, SketchLine_10] = SketchConstraintMirror_1.mirrored() -SketchMultiRotation_1_objects = [SketchLine_10.result(), SketchLine_9.result(), SketchLine_8.result(), SketchArc_2.results()[1], SketchLine_7.result(), SketchLine_1.result(), SketchArc_1.results()[1], SketchLine_2.result(), SketchLine_3.result(), SketchLine_4.result()] -SketchMultiRotation_1 = Sketch_1.addRotation(SketchMultiRotation_1_objects, SketchAPI_Line(SketchLine_6).startPoint(), 360, 4, True) -[SketchLine_10, SketchLine_11, SketchLine_12, SketchLine_13, SketchLine_9, SketchLine_14, SketchLine_15, SketchLine_16, SketchLine_8, SketchLine_17, SketchLine_18, SketchLine_19, SketchArc_2, SketchArc_3, SketchArc_4, SketchArc_5, SketchLine_7, SketchLine_20, SketchLine_21, SketchLine_22, SketchLine_23, SketchLine_24, SketchLine_25, SketchArc_6, SketchArc_7, SketchArc_8, SketchLine_26, SketchLine_27, SketchLine_28, SketchLine_29, SketchLine_30, SketchLine_31, SketchLine_32, SketchLine_33, SketchLine_34] = SketchMultiRotation_1.rotated() +SketchConstraintMirror_1_objects = [ + SketchLine_1.result(), + SketchArc_1.results()[1], + SketchLine_2.result(), + SketchLine_3.result(), + SketchLine_4.result(), +] +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_6.result(), SketchConstraintMirror_1_objects +) +[ + SketchLine_7, + SketchArc_2, + SketchLine_8, + SketchLine_9, + SketchLine_10, +] = SketchConstraintMirror_1.mirrored() +SketchMultiRotation_1_objects = [ + SketchLine_10.result(), + SketchLine_9.result(), + SketchLine_8.result(), + SketchArc_2.results()[1], + SketchLine_7.result(), + SketchLine_1.result(), + SketchArc_1.results()[1], + SketchLine_2.result(), + SketchLine_3.result(), + SketchLine_4.result(), +] +SketchMultiRotation_1 = Sketch_1.addRotation( + SketchMultiRotation_1_objects, + SketchAPI_Line(SketchLine_6).startPoint(), + 360, + 4, + True, +) +[ + SketchLine_10, + SketchLine_11, + SketchLine_12, + SketchLine_13, + SketchLine_9, + SketchLine_14, + SketchLine_15, + SketchLine_16, + SketchLine_8, + SketchLine_17, + SketchLine_18, + SketchLine_19, + SketchArc_2, + SketchArc_3, + SketchArc_4, + SketchArc_5, + SketchLine_7, + SketchLine_20, + SketchLine_21, + SketchLine_22, + SketchLine_23, + SketchLine_24, + SketchLine_25, + SketchArc_6, + SketchArc_7, + SketchArc_8, + SketchLine_26, + SketchLine_27, + SketchLine_28, + SketchLine_29, + SketchLine_30, + SketchLine_31, + SketchLine_32, + SketchLine_33, + SketchLine_34, +] = SketchMultiRotation_1.rotated() 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")], model.selection(), 5, 0) -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/To_Face_1"), model.selection("FACE", "Extrusion_1_1/From_Face_1")], 1) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1")], model.selection(), 5, 0 +) +Fillet_1 = model.addFillet( + Part_1_doc, + [ + model.selection("FACE", "Extrusion_1_1/To_Face_1"), + model.selection("FACE", "Extrusion_1_1/From_Face_1"), + ], + 1, +) model.end() # creation of the model time @@ -79,10 +187,11 @@ print("Creation time: {0}".format(creationTime)) # disable automatic recalculation, so, modification of parameters cause norecomputation immediately from ModelAPI import * + aSession = ModelAPI_Session.get() aSession.blockAutoUpdate(True) -#update parameters one by one +# update parameters one by one model.begin() param_l1.setValue(15) model.do() @@ -103,4 +212,4 @@ print("Modification time: {0}".format(modificationTime)) model.testResultsVolumes(Fillet_1, [3242.917586105217651493148878217]) # check that 4 modification of parameters was not slower than 2 update of model (without block it is minimum 3 times of creation time) -assert(modificationTime < 2. * creationTime) +assert modificationTime < 2.0 * creationTime diff --git a/src/ModelAPI/Test/TestConstants.py b/src/ModelAPI/Test/TestConstants.py index 31da49d10..73f27e4b5 100644 --- a/src/ModelAPI/Test/TestConstants.py +++ b/src/ModelAPI/Test/TestConstants.py @@ -17,13 +17,14 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#=============================================================================== +# =============================================================================== # Test ModelAPI static methods -#=============================================================================== +# =============================================================================== from ModelAPI import * -assert (ModelAPI_Feature.group() == "Features") -assert (ModelAPI_AttributeDocRef.typeId() == "DocRef") -assert (ModelAPI_AttributeDouble.typeId() == "Double") -assert (ModelAPI_AttributeReference.typeId() == "Reference") -assert (ModelAPI_AttributeRefAttr.typeId() == "RefAttr") -assert (ModelAPI_AttributeRefList.typeId() == "RefList") \ No newline at end of file + +assert ModelAPI_Feature.group() == "Features" +assert ModelAPI_AttributeDocRef.typeId() == "DocRef" +assert ModelAPI_AttributeDouble.typeId() == "Double" +assert ModelAPI_AttributeReference.typeId() == "Reference" +assert ModelAPI_AttributeRefAttr.typeId() == "RefAttr" +assert ModelAPI_AttributeRefList.typeId() == "RefList" diff --git a/src/ModelAPI/Test/TestContainerSelector.py b/src/ModelAPI/Test/TestContainerSelector.py index 55d9c9213..994a7b8a9 100644 --- a/src/ModelAPI/Test/TestContainerSelector.py +++ b/src/ModelAPI/Test/TestContainerSelector.py @@ -27,7 +27,15 @@ 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]]")]) +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()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestCustomName_BooleanCut.py b/src/ModelAPI/Test/TestCustomName_BooleanCut.py index bb1acb719..d7b735c04 100644 --- a/src/ModelAPI/Test/TestCustomName_BooleanCut.py +++ b/src/ModelAPI/Test/TestCustomName_BooleanCut.py @@ -27,16 +27,28 @@ 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(70, 0, 0, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 50) SketchLine_3 = Sketch_1.addLine(0, 50, 70, 50) SketchLine_4 = Sketch_1.addLine(70, 50, 70, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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()) @@ -44,35 +56,82 @@ 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_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], 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_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" + ), +) 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) SketchLine_8 = Sketch_2.addLine(10, -5, 10, 55) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_9 = 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", "PartSet/Origin"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_7.endPoint(), 5) -SketchConstraintDistanceHorizontal_1 = Sketch_2.setHorizontalDistance(SketchLine_8.startPoint(), SketchAPI_Point(SketchPoint_2).coordinates(), 10) +SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_7.endPoint(), 5 +) +SketchConstraintDistanceHorizontal_1 = Sketch_2.setHorizontalDistance( + SketchLine_8.startPoint(), SketchAPI_Point(SketchPoint_2).coordinates(), 10 +) 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_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r")], 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") -Cut_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(Cut_1.result().name() == Extrusion_1.result().name()), "Boolean CUT name '{}' != '{}'".format(Cut_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() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestCustomName_CommonCompSolid.py b/src/ModelAPI/Test/TestCustomName_CommonCompSolid.py index 7291e64c0..4f0d43995 100644 --- a/src/ModelAPI/Test/TestCustomName_CommonCompSolid.py +++ b/src/ModelAPI/Test/TestCustomName_CommonCompSolid.py @@ -27,35 +27,69 @@ 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_objects = [model.selection("SOLID", "plate"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")] +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&_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) +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()) +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&_plate/Bottom"), 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") -Common_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 = Common_1.result() CommonResultName = CommonResult.name() -assert(CommonResultName == Partition_1.result().name()), "Name of Boolean COMMON result '{}' != '{}'".format(CommonResultName, Partition_1.result().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 = Common_1.name() + "_1" for i in range(0, CommonResult.numberOfSubs()): - refName = BooleanName + '_' + str(i + 1) - subResult = CommonResult.subResult(i) - assert(subResult.name() == refName), "Boolean COMMON sub-result {} name '{}' != '{}'".format(i, subResult.name(), refName) + refName = BooleanName + "_" + str(i + 1) + subResult = CommonResult.subResult(i) + assert ( + subResult.name() == refName + ), "Boolean COMMON sub-result {} name '{}' != '{}'".format( + i, subResult.name(), refName + ) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestCustomName_CutCompSolid.py b/src/ModelAPI/Test/TestCustomName_CutCompSolid.py index 52cd37774..66631801d 100644 --- a/src/ModelAPI/Test/TestCustomName_CutCompSolid.py +++ b/src/ModelAPI/Test/TestCustomName_CutCompSolid.py @@ -27,60 +27,125 @@ 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) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 80) SketchLine_3 = Sketch_1.addLine(0, 80, 80, 80) SketchLine_4 = Sketch_1.addLine(80, 80, 80, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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(35, 80, 65, 0) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_3.result()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_3.result() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_1.result() +) SketchLine_6 = Sketch_1.addLine(0, 20, 80, 50) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_4.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_5.result(), SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_4.result() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_5.result(), SketchLine_6.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 80) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_6.startPoint(), SketchLine_1.endPoint(), 20) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_5.endPoint(), SketchLine_1.startPoint(), 15) -SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchLine_6.endPoint(), SketchLine_1.startPoint(), 50) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_6.startPoint(), SketchLine_1.endPoint(), 20 +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_5.endPoint(), SketchLine_1.startPoint(), 15 +) +SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance( + SketchLine_6.endPoint(), SketchLine_1.startPoint(), 50 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 50, 0) +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", "Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_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", "[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) +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) +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_2r")], model.selection(), model.selection(), 10, model.selection("FACE", "Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_3"), 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")]) +Cut_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 = Cut_1.result() CutResultName = CutResult.name() -assert(CutResultName == Extrusion_1.result().name()), "Name of Boolean CUT result '{}' != '{}'".format(CutResultName, Extrusion_1.result().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 = Cut_1.name() + "_1" for i in range(0, CutResult.numberOfSubs()): - refName = BooleanName + '_' + str(i + 1) - subResult = CutResult.subResult(i) - assert(subResult.name() == refName), "Boolean CUT sub-result {} name '{}' != '{}'".format(i, subResult.name(), refName) + refName = BooleanName + "_" + str(i + 1) + subResult = CutResult.subResult(i) + assert ( + subResult.name() == refName + ), "Boolean CUT sub-result {} name '{}' != '{}'".format( + i, subResult.name(), refName + ) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestCustomName_CutGroup.py b/src/ModelAPI/Test/TestCustomName_CutGroup.py index 4ead3dea5..a054d42cf 100644 --- a/src/ModelAPI/Test/TestCustomName_CutGroup.py +++ b/src/ModelAPI/Test/TestCustomName_CutGroup.py @@ -27,16 +27,28 @@ 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(70, 0, 0, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 40) SketchLine_3 = Sketch_1.addLine(0, 40, 70, 40) SketchLine_4 = Sketch_1.addLine(70, 40, 70, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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()) @@ -45,63 +57,153 @@ SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 70) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 40) SketchCircle_1 = Sketch_1.addCircle(30, 70, 20) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 20) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_3.result(), 30, True) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchCircle_1.center(), SketchLine_2.startPoint(), 30) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_3.result(), 30, True +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchCircle_1.center(), SketchLine_2.startPoint(), 30 +) SketchLine_5 = Sketch_1.addLine(12.50000000006628, -45.31088913249455, 30, -15) SketchLine_6 = Sketch_1.addLine(30, -15, 47.50000000006629, -45.31088913249455) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchLine_7 = Sketch_1.addLine(47.50000000006629, -45.31088913249455, 12.50000000006628, -45.31088913249455) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_7.endPoint()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_7.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_6.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchLine_7 = Sketch_1.addLine( + 47.50000000006629, -45.31088913249455, 12.50000000006628, -45.31088913249455 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_7.endPoint() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_7.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_6.result() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) 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) +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_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], 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_7r-SketchLine_6r-SketchLine_5r")], 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 = 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")) 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()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +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() +) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_9.result()) 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&Sketch_1/SketchLine_3][box/Generated_Face&Sketch_1/SketchLine_2][box/From_Face]"), 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) +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_8r-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") -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")]) +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 = 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 = Cut_1.name() + "_" + str(i + 1) - for sub in range(0, BooleanResults[i].numberOfSubs()): - refName = BooleanName + '_' + str(sub + 1) - subResult = BooleanResults[i].subResult(sub) - assert(subResult.name() == refName), "Name of sub-result {} of result {} of Boolean CUT '{}' != '{}'".format(sub, i, subResult.name(), refName) + assert ( + BooleanResults[i].name() == Extrusions[i].result().name() + ), "Name of result {} of Boolean CUT '{}' != '{}'".format( + i, BooleanResults[i].name(), Extrusions[i].result().name() + ) + 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) + assert ( + subResult.name() == refName + ), "Name of sub-result {} of result {} of Boolean CUT '{}' != '{}'".format( + sub, i, subResult.name(), refName + ) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestCustomName_DefaultName.py b/src/ModelAPI/Test/TestCustomName_DefaultName.py index c08259ef9..cec76e7ea 100644 --- a/src/ModelAPI/Test/TestCustomName_DefaultName.py +++ b/src/ModelAPI/Test/TestCustomName_DefaultName.py @@ -25,10 +25,14 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 10) -Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("SOLID", "Sphere_1_1")]) +Boolean_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + [model.selection("SOLID", "Sphere_1_1")], +) Boolean_1.result().setName("Boolean_1_1") model.do() model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestCustomName_ExtrudeFace.py b/src/ModelAPI/Test/TestCustomName_ExtrudeFace.py index ade11febc..01f84e7a7 100644 --- a/src/ModelAPI/Test/TestCustomName_ExtrudeFace.py +++ b/src/ModelAPI/Test/TestCustomName_ExtrudeFace.py @@ -25,26 +25,48 @@ 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(0, 0, 68.31067519504786, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(68.31067519504786, 0, 0, 68.31067519504786) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(0, 68.31067519504786, 0, 0) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) 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()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_1.result() +) model.do() -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_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) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("FACE", "triangle")], model.selection(), 10, 0 +) model.do() -assert(Extrusion_1.result().name() == Face_1.result().name()), "Extrusion name '{}' != '{}'".format(Extrusion_1.result().name(), Face_1.result().name()) +assert ( + Extrusion_1.result().name() == Face_1.result().name() +), "Extrusion name '{}' != '{}'".format( + Extrusion_1.result().name(), Face_1.result().name() +) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestCustomName_ExtrusionCut.py b/src/ModelAPI/Test/TestCustomName_ExtrusionCut.py index fee05aeb0..0db3c6652 100644 --- a/src/ModelAPI/Test/TestCustomName_ExtrusionCut.py +++ b/src/ModelAPI/Test/TestCustomName_ExtrusionCut.py @@ -25,40 +25,85 @@ 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.00000000000001, 0, 0, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 50) SketchLine_3 = Sketch_1.addLine(0, 50, 50, 50) SketchLine_4 = Sketch_1.addLine(50, 50, 50.00000000000001, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 50) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result()) +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_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], 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")]) +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")) 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) +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&Sketch_1/SketchLine_1][plate/To_Face]"), False) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_5.result(), 20, True +) +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) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_6.result(), 15, True +) SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_1.results()[1], 10) ExtrusionCut_1.setNestedSketch(Sketch_2) model.do() -assert(ExtrusionCut_1.result().name() == Extrusion_1.result().name()), "ExtrusionCut name '{}' != '{}'".format(ExtrusionCut_1.result().name(), Extrusion_1.result().name()) +assert ( + ExtrusionCut_1.result().name() == Extrusion_1.result().name() +), "ExtrusionCut name '{}' != '{}'".format( + ExtrusionCut_1.result().name(), Extrusion_1.result().name() +) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestCustomName_ExtrusionCutFace.py b/src/ModelAPI/Test/TestCustomName_ExtrusionCutFace.py index 319934f63..d07b66b6d 100644 --- a/src/ModelAPI/Test/TestCustomName_ExtrusionCutFace.py +++ b/src/ModelAPI/Test/TestCustomName_ExtrusionCutFace.py @@ -28,13 +28,26 @@ 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/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")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [model.selection("FACE", "circle")], + model.selection(), + 0, + 3, + [model.selection("SOLID", "box")], +) model.do() -assert(ExtrusionCut_1.result().name() == Box_1.result().name()), "ExtrusionCut name '{}' != '{}'".format(ExtrusionCut_1.result().name(), Box_1.result().name()) +assert ( + ExtrusionCut_1.result().name() == Box_1.result().name() +), "ExtrusionCut name '{}' != '{}'".format( + ExtrusionCut_1.result().name(), Box_1.result().name() +) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestCustomName_MultiTranslation.py b/src/ModelAPI/Test/TestCustomName_MultiTranslation.py index 42cd73358..af0ac889b 100644 --- a/src/ModelAPI/Test/TestCustomName_MultiTranslation.py +++ b/src/ModelAPI/Test/TestCustomName_MultiTranslation.py @@ -26,22 +26,49 @@ 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) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) Cylinder_1.result().setName("cylinder") -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) +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 = LinearCopy_1.result() TransResultName = TransResult.name() -assert(TransResultName == Cylinder_1.result().name()), "MultiTranslation name '{}' != '{}'".format(TransResultName, Cylinder_1.result().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) +assert ( + NB_COPIES == TransResult.numberOfSubs() +), "Number of results {} is not equal to reference {}".format( + TransResult.numberOfSubs(), NB_COPIES +) MultiTranslationName = LinearCopy_1.name() + "_1" for i in range(0, NB_COPIES): - refName = MultiTranslationName + '_' + str(i + 1) - subResult = TransResult.subResult(i) - assert(subResult.name() == refName), "MultiTranslation sub-result {} name '{}' != '{}'".format(i, subResult.name(), refName) + refName = MultiTranslationName + "_" + str(i + 1) + subResult = TransResult.subResult(i) + assert ( + subResult.name() == refName + ), "MultiTranslation sub-result {} name '{}' != '{}'".format( + i, subResult.name(), refName + ) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestCustomName_Partition.py b/src/ModelAPI/Test/TestCustomName_Partition.py index 200879f10..dd5325e04 100644 --- a/src/ModelAPI/Test/TestCustomName_Partition.py +++ b/src/ModelAPI/Test/TestCustomName_Partition.py @@ -23,23 +23,35 @@ 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) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) Cylinder_1.result().setName("cylinder") Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Box_1.result().setName("box") -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "box"), model.selection("SOLID", "cylinder")]) +Partition_1 = model.addPartition( + Part_1_doc, [model.selection("SOLID", "box"), model.selection("SOLID", "cylinder")] +) model.do() PartitionResult = Partition_1.result() PartitionResultName = PartitionResult.name() -assert(PartitionResultName == Box_1.result().name()), "Partition name '{}' != '{}'".format(PartitionResultName, Box_1.result().name()) +assert ( + PartitionResultName == Box_1.result().name() +), "Partition name '{}' != '{}'".format(PartitionResultName, Box_1.result().name()) # check sub-result names PartitionName = Partition_1.name() + "_1" for i in range(0, PartitionResult.numberOfSubs()): - refName = PartitionName + '_' + str(i + 1) - subResult = PartitionResult.subResult(i) - assert(subResult.name() == refName), "Partition sub-result {} name '{}' != '{}'".format(i, subResult.name(), refName) + refName = PartitionName + "_" + str(i + 1) + subResult = PartitionResult.subResult(i) + assert ( + subResult.name() == refName + ), "Partition sub-result {} name '{}' != '{}'".format(i, subResult.name(), refName) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestCustomName_Placement.py b/src/ModelAPI/Test/TestCustomName_Placement.py index 03933f1c1..5c03c3e30 100644 --- a/src/ModelAPI/Test/TestCustomName_Placement.py +++ b/src/ModelAPI/Test/TestCustomName_Placement.py @@ -25,31 +25,89 @@ 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, 76.16895059675974, 30, 16.16895059675975) -SketchLine_2 = Sketch_1.addLine(30, 16.16895059675975, 55.98076211353315, 31.16895059675975) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(55.98076211353315, 31.16895059675975, 30, 76.16895059675974) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) +SketchLine_2 = Sketch_1.addLine( + 30, 16.16895059675975, 55.98076211353315, 31.16895059675975 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 55.98076211353315, 31.16895059675975, 30, 76.16895059675974 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +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.00000000000014) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_2.result(), SketchLine_3.result() +) +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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_4 = SketchProjection_1.createdFeature() -SketchConstraintMirror_1_objects = [SketchLine_2.result(), SketchLine_1.result(), SketchLine_3.result()] -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_4.result(), SketchConstraintMirror_1_objects) +SketchConstraintMirror_1_objects = [ + SketchLine_2.result(), + SketchLine_1.result(), + SketchLine_3.result(), +] +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_4.result(), SketchConstraintMirror_1_objects +) [SketchLine_5, SketchLine_6, SketchLine_7] = SketchConstraintMirror_1.mirrored() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_4.result(), 30, True) +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_1r-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_6r-SketchLine_7r-SketchLine_5r")], model.selection("EDGE", "Sketch_1/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/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) +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()) +assert ( + Placement_1.result().name() == Revolution_1.result().name() +), "Placement name '{}' != '{}'".format( + Placement_1.result().name(), Revolution_1.result().name() +) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestCustomName_Recover.py b/src/ModelAPI/Test/TestCustomName_Recover.py index f1cc62af2..fd541cbbf 100644 --- a/src/ModelAPI/Test/TestCustomName_Recover.py +++ b/src/ModelAPI/Test/TestCustomName_Recover.py @@ -23,23 +23,41 @@ 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) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) Cylinder_1.result().setName("cylinder") -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "cylinder/Face_2"), 10, False) -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "cylinder")], model.selection("FACE", "Plane_1")) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "cylinder/Face_2"), 10, False +) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "cylinder")], + model.selection("FACE", "Plane_1"), +) model.do() # check the name of the Symmetry SymmetryName = Symmetry_1.result().name() -assert(SymmetryName == Cylinder_1.result().name()), "Symmetry name '{}' != '{}'".format(SymmetryName, Cylinder_1.result().name()) +assert SymmetryName == Cylinder_1.result().name(), "Symmetry name '{}' != '{}'".format( + SymmetryName, Cylinder_1.result().name() +) # recover original cylinder Recover_1 = model.addRecover(Part_1_doc, Symmetry_1, [Cylinder_1.result()]) model.do() # check the name of the recovered result is not the cylinder name -assert(Recover_1.result().name() != SymmetryName), "Recovered feature SHOULD NOT have the same name as original feature '{}'".format(SymmetryName) +assert ( + Recover_1.result().name() != SymmetryName +), "Recovered feature SHOULD NOT have the same name as original feature '{}'".format( + SymmetryName +) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestCustomName_Rename.py b/src/ModelAPI/Test/TestCustomName_Rename.py index c7b7c1e2f..17f9d6b57 100644 --- a/src/ModelAPI/Test/TestCustomName_Rename.py +++ b/src/ModelAPI/Test/TestCustomName_Rename.py @@ -23,25 +23,37 @@ 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) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) Cylinder_1.result().setName("cylinder") Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Box_1.result().setName("box") -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "box"), model.selection("SOLID", "cylinder")]) +Partition_1 = model.addPartition( + Part_1_doc, [model.selection("SOLID", "box"), model.selection("SOLID", "cylinder")] +) model.do() # check name of result and its subs before rename PartitionResult = Partition_1.result() PartitionResultName = PartitionResult.name() -assert(PartitionResultName == Box_1.result().name()), "Partition name '{}' != '{}'".format(PartitionResultName, Box_1.result().name()) +assert ( + PartitionResultName == Box_1.result().name() +), "Partition name '{}' != '{}'".format(PartitionResultName, Box_1.result().name()) # check sub-result names PartitionName = Partition_1.name() + "_1" PartitionSubresultNames = [] for i in range(0, PartitionResult.numberOfSubs()): - refName = PartitionName + '_' + str(i + 1) - subResult = PartitionResult.subResult(i) - assert(subResult.name() == refName), "Partition sub-result {} name '{}' != '{}'".format(i, subResult.name(), refName) - PartitionSubresultNames.append(refName) + refName = PartitionName + "_" + str(i + 1) + subResult = PartitionResult.subResult(i) + assert ( + subResult.name() == refName + ), "Partition sub-result {} name '{}' != '{}'".format(i, subResult.name(), refName) + PartitionSubresultNames.append(refName) # rename original objects before the Partition Cylinder_1.result().setName("new_cylinder") @@ -49,12 +61,20 @@ Box_1.result().setName("new_box") model.do() # check names of the Partition does not changed -assert(PartitionResultName == PartitionResult.name()), "After rename: Partition name '{}' != '{}'".format(PartitionResult.name(), PartitionResultName) +assert ( + PartitionResultName == PartitionResult.name() +), "After rename: Partition name '{}' != '{}'".format( + PartitionResult.name(), PartitionResultName +) for i in range(0, PartitionResult.numberOfSubs()): - refName = PartitionSubresultNames[i] - subResult = PartitionResult.subResult(i) - assert(subResult.name() == refName), "After rename: Partition sub-result {} name '{}' != '{}'".format(i, subResult.name(), refName) + refName = PartitionSubresultNames[i] + subResult = PartitionResult.subResult(i) + assert ( + subResult.name() == refName + ), "After rename: Partition sub-result {} name '{}' != '{}'".format( + i, subResult.name(), refName + ) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestCustomName_RotateGroup.py b/src/ModelAPI/Test/TestCustomName_RotateGroup.py index 5b40dd0aa..3f7fc1552 100644 --- a/src/ModelAPI/Test/TestCustomName_RotateGroup.py +++ b/src/ModelAPI/Test/TestCustomName_RotateGroup.py @@ -23,32 +23,87 @@ 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) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) Cylinder_1.result().setName("cylinder") Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) -SketchArc_1 = Sketch_1.addArc(13.72530642620941, 12.64599334927434, 17.72530642621026, 15.64599334928998, 17.72530642621026, 9.645993349258699, False) -SketchArc_2 = Sketch_1.addArc(21.72530642620941, 12.64599334927434, 17.72530642621026, 9.645993349258699, 17.72530642621026, 15.64599334928998, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchArc_2.endPoint()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_1.results()[1], SketchArc_2.results()[1]) -SketchLine_1 = Sketch_1.addLine(13.72530642620941, 12.64599334927434, 21.72530642620941, 12.64599334927434) +SketchArc_1 = Sketch_1.addArc( + 13.72530642620941, + 12.64599334927434, + 17.72530642621026, + 15.64599334928998, + 17.72530642621026, + 9.645993349258699, + False, +) +SketchArc_2 = Sketch_1.addArc( + 21.72530642620941, + 12.64599334927434, + 17.72530642621026, + 9.645993349258699, + 17.72530642621026, + 15.64599334928998, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchArc_2.endPoint() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchArc_1.results()[1], SketchArc_2.results()[1] +) +SketchLine_1 = Sketch_1.addLine( + 13.72530642620941, 12.64599334927434, 21.72530642620941, 12.64599334927434 +) SketchLine_1.setAuxiliary(True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_1.endPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_1.endPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) 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) +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_2r-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) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "prism"), model.selection("SOLID", "cylinder")], + model.selection("EDGE", "PartSet/OX"), + 30, +) model.do() RotationResults = Rotation_1.results() -assert(RotationResults[0].name() == Extrusion_1.result().name()), "Rotation name [0] '{}' != '{}'".format(RotationResults[0].name(), Extrusion_1.result().name()) -assert(RotationResults[1].name() == Cylinder_1.result().name()), "Rotation name [1] '{}' != '{}'".format(RotationResults[1].name(), Cylinder_1.result().name()) +assert ( + RotationResults[0].name() == Extrusion_1.result().name() +), "Rotation name [0] '{}' != '{}'".format( + RotationResults[0].name(), Extrusion_1.result().name() +) +assert ( + RotationResults[1].name() == Cylinder_1.result().name() +), "Rotation name [1] '{}' != '{}'".format( + RotationResults[1].name(), Cylinder_1.result().name() +) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestCustomName_Translation.py b/src/ModelAPI/Test/TestCustomName_Translation.py index 052b903c5..78a5c3979 100644 --- a/src/ModelAPI/Test/TestCustomName_Translation.py +++ b/src/ModelAPI/Test/TestCustomName_Translation.py @@ -23,13 +23,31 @@ 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) +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][cylinder/Face_2])([cylinder/Face_1][cylinder/Face_3])"), 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()) +assert ( + Translation_1.result().name() == Cylinder_1.result().name() +), "Translation name '{}' != '{}'".format( + Translation_1.result().name(), Cylinder_1.result().name() +) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestDocument.py b/src/ModelAPI/Test/TestDocument.py index 564601038..966706844 100644 --- a/src/ModelAPI/Test/TestDocument.py +++ b/src/ModelAPI/Test/TestDocument.py @@ -22,87 +22,88 @@ Unit test for Model_Document/ModelAPI_Document class """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * __updated__ = "2014-12-26" -#========================================================================= +# ========================================================================= # Creation and activation of documents -#========================================================================= +# ========================================================================= aSession = ModelAPI_Session.get() -assert(aSession.moduleDocument()) -assert(aSession.moduleDocument().id() == 0) -assert(aSession.moduleDocument().kind() == "PartSet") -assert(aSession.hasModuleDocument()) +assert aSession.moduleDocument() +assert aSession.moduleDocument().id() == 0 +assert aSession.moduleDocument().kind() == "PartSet" +assert aSession.hasModuleDocument() # Create a new document aSession.startOperation() aSession.moduleDocument().addFeature("Part") aSession.finishOperation() -assert(aSession.activeDocument()) -assert(aSession.activeDocument().id() == 1) -assert(aSession.activeDocument().kind() == "Part") +assert aSession.activeDocument() +assert aSession.activeDocument().id() == 1 +assert aSession.activeDocument().kind() == "Part" # Activate root doc aRootDoc = aSession.document(0) -assert(aRootDoc) +assert aRootDoc aSession.startOperation() aSession.setActiveDocument(aRootDoc, False) aSession.finishOperation() -assert(aSession.activeDocument()) -assert(aSession.activeDocument().id() == 0) +assert aSession.activeDocument() +assert aSession.activeDocument().id() == 0 # check all opened docs allDocsList = aSession.allOpenedDocuments() -assert(len(allDocsList) != 0) +assert len(allDocsList) != 0 # Activate Part_1 doc back for further testing aSession.startOperation() aSession.setActiveDocument(aSession.document(1), False) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Duplication of a document -#========================================================================= +# ========================================================================= aPart = aSession.activeDocument() -assert(aPart.size("Features") == 0) +assert aPart.size("Features") == 0 # Create a point in the current document to check if it is duplicated aSession.startOperation() aFeature = aPart.addFeature("Point") aFeatureData = aFeature.data() -assert(aFeatureData is not None) -geomDataAPI_Point(aFeatureData.attribute("point3d")).setValue(15., 10., 20.) +assert aFeatureData is not None +geomDataAPI_Point(aFeatureData.attribute("point3d")).setValue(15.0, 10.0, 20.0) aSession.finishOperation() -assert(aPart.size("Features") == 1) +assert aPart.size("Features") == 1 # Duplicate the document -assert(aSession.moduleDocument().size("Parts") == 1) +assert aSession.moduleDocument().size("Parts") == 1 aSession.startOperation() aPart.addFeature("Duplicate") aSession.finishOperation() -assert(aSession.moduleDocument().size("Parts") == 2) +assert aSession.moduleDocument().size("Parts") == 2 aCopyOfPart = aSession.activeDocument() -assert(aCopyOfPart.id() == 2) -assert(aCopyOfPart.kind() == "Part") -assert(aCopyOfPart.size("Features") == 1) -assert(aCopyOfPart != aPart) -#========================================================================= +assert aCopyOfPart.id() == 2 +assert aCopyOfPart.kind() == "Part" +assert aCopyOfPart.size("Features") == 1 +assert aCopyOfPart != aPart +# ========================================================================= # Remove document -#========================================================================= -assert(aSession.moduleDocument().size("Parts") == 2) +# ========================================================================= +assert aSession.moduleDocument().size("Parts") == 2 aSession.startOperation() aPart.addFeature("Remove") aSession.finishOperation() # First part is deleted, but active is Part_2, so, it is still active -assert(aSession.moduleDocument().size("Parts") == 1) -assert(aSession.activeDocument().id() == aCopyOfPart.id()) +assert aSession.moduleDocument().size("Parts") == 1 +assert aSession.activeDocument().id() == aCopyOfPart.id() # Remove another one document aSession.startOperation() aDoc2 = aSession.document(2) aSession.setActiveDocument(aDoc2, False) aDoc2.addFeature("Remove") aSession.finishOperation() -assert(aSession.moduleDocument().size("Parts") == 0) -assert(aSession.activeDocument()) +assert aSession.moduleDocument().size("Parts") == 0 +assert aSession.activeDocument() from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestDoubleArray.py b/src/ModelAPI/Test/TestDoubleArray.py index 55c97b22e..e2d7650a0 100644 --- a/src/ModelAPI/Test/TestDoubleArray.py +++ b/src/ModelAPI/Test/TestDoubleArray.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -29,21 +29,21 @@ import math aSession = ModelAPI_Session.get() -#========================================================================= +# ========================================================================= # Test double array attribute -#========================================================================= +# ========================================================================= aPartSet = aSession.moduleDocument() aSession.startOperation() aSketchFeature = featureToCompositeFeature(aPartSet.addFeature("Sketch")) aFeatureData = aSketchFeature.data() anArray = aFeatureData.addAttribute("double_array", "DoubleArray") aFeatureData.realArray("double_array").setSize(5) -assert(aFeatureData.realArray("double_array").size() == 5) +assert aFeatureData.realArray("double_array").size() == 5 aFeatureData.realArray("double_array").setValue(0, 1) -assert(math.fabs(aFeatureData.realArray("double_array").value(0) - 1) < 10 ** -7) +assert math.fabs(aFeatureData.realArray("double_array").value(0) - 1) < 10**-7 aFeatureData.realArray("double_array").setValue(1, 1.5) -assert(math.fabs(aFeatureData.realArray("double_array").value(1) - 1.5) < 10 ** -7) +assert math.fabs(aFeatureData.realArray("double_array").value(1) - 1.5) < 10**-7 -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= diff --git a/src/ModelAPI/Test/TestExternalConstruction.py b/src/ModelAPI/Test/TestExternalConstruction.py index 93013e4bc..fddde5501 100644 --- a/src/ModelAPI/Test/TestExternalConstruction.py +++ b/src/ModelAPI/Test/TestExternalConstruction.py @@ -26,14 +26,26 @@ partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(-104, 73, 102, 265) SketchLine_2 = Sketch_1.addLine(102, 265, 192, -1) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(192, -1, -104, 73) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) model.do() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "PartSet/Sketch_1")], model.selection("EDGE", "PartSet/Sketch_1/SketchLine_3"), 360, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("COMPOUND", "PartSet/Sketch_1")], + model.selection("EDGE", "PartSet/Sketch_1/SketchLine_3"), + 360, + 0, +) model.end() from GeomAPI import GeomAPI_Shape @@ -46,4 +58,4 @@ model.testNbSubShapes(Revolution_1, GeomAPI_Shape.EDGE, [8]) model.testNbSubShapes(Revolution_1, GeomAPI_Shape.VERTEX, [16]) model.testResultsVolumes(Revolution_1, [17830100]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestFeatureSelection_1.py b/src/ModelAPI/Test/TestFeatureSelection_1.py index 16a26355f..1908b4c9a 100644 --- a/src/ModelAPI/Test/TestFeatureSelection_1.py +++ b/src/ModelAPI/Test/TestFeatureSelection_1.py @@ -28,10 +28,16 @@ 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/Top"), 5, True) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("COMPOUND", "all-in-Box_1"), model.selection("FACE", "all-in-Plane_1")]) +Partition_1 = model.addPartition( + Part_1_doc, + [ + model.selection("COMPOUND", "all-in-Box_1"), + model.selection("FACE", "all-in-Plane_1"), + ], +) model.end() -assert(len(Partition_1.results()) == 1) -assert(Partition_1.result().numberOfSubs() == 2) +assert len(Partition_1.results()) == 1 +assert Partition_1.result().numberOfSubs() == 2 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestFeatureSelection_2.py b/src/ModelAPI/Test/TestFeatureSelection_2.py index 31c42286a..1d57a0c43 100644 --- a/src/ModelAPI/Test/TestFeatureSelection_2.py +++ b/src/ModelAPI/Test/TestFeatureSelection_2.py @@ -31,32 +31,62 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Param_N = model.addParameter(Part_1_doc, "n", "3") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(30, 0, 15) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center(), 30, True) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchCircle_1.results()[1]], SketchAPI_Line(SketchLine_1).startPoint(), 360, "n=", True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_1.center() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center(), 30, True +) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchCircle_1.results()[1]], + SketchAPI_Line(SketchLine_1).startPoint(), + 360, + "n=", + True, +) [SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated() SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 15) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) +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")) SketchCircle_4 = Sketch_2.addCircle(25, 5, 4) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_4.results()[1], 4) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) 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) +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_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")]) +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() # update the parameter N => number of sketch contours is changed Param_N.setValue(4) model.end() -assert(Cut_1.result().numberOfSubs() == 4) +assert Cut_1.result().numberOfSubs() == 4 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestFolder_Create.py b/src/ModelAPI/Test/TestFolder_Create.py index 0c9cd6d14..048b11d7c 100644 --- a/src/ModelAPI/Test/TestFolder_Create.py +++ b/src/ModelAPI/Test/TestFolder_Create.py @@ -17,83 +17,99 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * __updated__ = "2017-11-22" -#========================================================================= +# ========================================================================= # Test 1. Check the Folder is created in PartSet -#========================================================================= +# ========================================================================= aSession = ModelAPI_Session.get() aPartSetDoc = aSession.activeDocument() aSession.startOperation() aPoint0 = aPartSetDoc.addFeature("Point") aPoint0Data = aPoint0.data() -assert(aPoint0Data is not None) -geomDataAPI_Point(aPoint0Data.attribute("point3d")).setValue(0., 0., 0.) +assert aPoint0Data is not None +geomDataAPI_Point(aPoint0Data.attribute("point3d")).setValue(0.0, 0.0, 0.0) aPoint0Data.string("creation_method").setValue("by_xyz") aSession.finishOperation() aSession.startOperation() aPoint1 = aPartSetDoc.addFeature("Point") aPoint1Data = aPoint1.data() -assert(aPoint1Data is not None) -geomDataAPI_Point(aPoint1Data.attribute("point3d")).setValue(0., 0., 0.) +assert aPoint1Data is not None +geomDataAPI_Point(aPoint1Data.attribute("point3d")).setValue(0.0, 0.0, 0.0) aPoint1Data.string("creation_method").setValue("by_xyz") aSession.finishOperation() -assert(aPartSetDoc.size("Features") == 2), "Wrong number of features: {}".format(aPartSetDoc.size("Features")) +assert aPartSetDoc.size("Features") == 2, "Wrong number of features: {}".format( + aPartSetDoc.size("Features") +) # Folder before the feature aSession.startOperation() aFolder1 = aPartSetDoc.addFolder(aPoint1) aSession.finishOperation() -assert(aPartSetDoc.size("Folders") == 1), "Wrong number of folders: {}".format(aPartSetDoc.size("Folders")) -assert(aPartSetDoc.size("Features") == 3), "Wrong number of features: {}".format(aPartSetDoc.size("Features")) +assert aPartSetDoc.size("Folders") == 1, "Wrong number of folders: {}".format( + aPartSetDoc.size("Folders") +) +assert aPartSetDoc.size("Features") == 3, "Wrong number of features: {}".format( + aPartSetDoc.size("Features") +) FOLDER_NAME_EXPECTED = "Folder_1" -assert(aFolder1.name() == FOLDER_NAME_EXPECTED), "Actual name '{}', expected '{}'".format(aFolder1.name(), FOLDER_NAME_EXPECTED) +assert ( + aFolder1.name() == FOLDER_NAME_EXPECTED +), "Actual name '{}', expected '{}'".format(aFolder1.name(), FOLDER_NAME_EXPECTED) ## Folder at the end of features list -#aSession.startOperation() -#aPartSetDoc.addFolder() -#aSession.finishOperation() -#assert(aPartSetDoc.size("Folders") == 2) +# aSession.startOperation() +# aPartSetDoc.addFolder() +# aSession.finishOperation() +# assert(aPartSetDoc.size("Folders") == 2) -#========================================================================= +# ========================================================================= # Test 2. Check the Folder is created in a Part -#========================================================================= +# ========================================================================= aSession.startOperation() aPart = aSession.moduleDocument().addFeature("Part") aSession.finishOperation() # check part is a last feature aFeaturesList = aSession.moduleDocument().allObjects() -aLast = aFeaturesList[len(aFeaturesList)-1] -assert(aLast.data().isEqual(aPart.data())), "Part is not a last object in the list" +aLast = aFeaturesList[len(aFeaturesList) - 1] +assert aLast.data().isEqual(aPart.data()), "Part is not a last object in the list" # add point and a folder before it aPartDoc = aSession.activeDocument() aSession.startOperation() aPoint2 = aPartDoc.addFeature("Point") aPoint2Data = aPoint2.data() -assert(aPoint2Data is not None) -geomDataAPI_Point(aPoint2Data.attribute("point3d")).setValue(0., 0., 0.) +assert aPoint2Data is not None +geomDataAPI_Point(aPoint2Data.attribute("point3d")).setValue(0.0, 0.0, 0.0) aPoint2Data.string("creation_method").setValue("by_xyz") aSession.finishOperation() -assert(aPartDoc.size("Features") == 1), "Wrong number of features: {}".format(aPartDoc.size("Features")) +assert aPartDoc.size("Features") == 1, "Wrong number of features: {}".format( + aPartDoc.size("Features") +) aSession.startOperation() aFolder2 = aPartDoc.addFolder(aPoint2) aSession.finishOperation() -assert(aPartDoc.size("Folders") == 1), "Wrong number of folders: {}".format(aPartDoc.size("Folders")) -assert(aPartDoc.size("Features") == 2), "Wrong number of features: {}".format(aPartDoc.size("Features")) +assert aPartDoc.size("Folders") == 1, "Wrong number of folders: {}".format( + aPartDoc.size("Folders") +) +assert aPartDoc.size("Features") == 2, "Wrong number of features: {}".format( + aPartDoc.size("Features") +) FOLDER_NAME_EXPECTED = "Folder_1" -assert(aFolder2.name() == FOLDER_NAME_EXPECTED), "Actual name '{}', expected '{}'".format(aFolder2.name(), FOLDER_NAME_EXPECTED) +assert ( + aFolder2.name() == FOLDER_NAME_EXPECTED +), "Actual name '{}', expected '{}'".format(aFolder2.name(), FOLDER_NAME_EXPECTED) diff --git a/src/ModelAPI/Test/TestFolder_CustomName.py b/src/ModelAPI/Test/TestFolder_CustomName.py index a1c470a83..712e1d8cf 100644 --- a/src/ModelAPI/Test/TestFolder_CustomName.py +++ b/src/ModelAPI/Test/TestFolder_CustomName.py @@ -26,22 +26,56 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 0, 50) SketchLine_2 = Sketch_1.addLine(0, 50, 50, 50) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(50, 50, 50, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(50, 0, 0, 0) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) SketchConstraintRigid_1 = Sketch_1.setFixed(SketchLine_1.startPoint()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), 50) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 50) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_1.result(), SketchLine_3.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_4.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result()) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_1.result(), SketchLine_3.result() +) +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_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) +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) @@ -49,5 +83,5 @@ Folder_1.setName("Box") model.end() -assert(Folder_1.name() == "Box") -assert(model.checkPythonDump()) +assert Folder_1.name() == "Box" +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestFolder_Empty.py b/src/ModelAPI/Test/TestFolder_Empty.py index 6cc7a3536..416befcb5 100644 --- a/src/ModelAPI/Test/TestFolder_Empty.py +++ b/src/ModelAPI/Test/TestFolder_Empty.py @@ -26,22 +26,56 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 0, 50) SketchLine_2 = Sketch_1.addLine(0, 50, 50, 50) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(50, 50, 50, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(50, 0, 0, 0) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) SketchConstraintRigid_1 = Sketch_1.setFixed(SketchLine_1.startPoint()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), 50) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 50) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_1.result(), SketchLine_3.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_4.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result()) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_1.result(), SketchLine_3.result() +) +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_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) +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) @@ -49,4 +83,4 @@ Folder_1 = model.addFolder(Part_1_doc) model.end() # empty folder is not dumped -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) == False) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) == False diff --git a/src/ModelAPI/Test/TestFolder_Remove.py b/src/ModelAPI/Test/TestFolder_Remove.py index f337847b4..0035d9db5 100644 --- a/src/ModelAPI/Test/TestFolder_Remove.py +++ b/src/ModelAPI/Test/TestFolder_Remove.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * @@ -32,26 +32,26 @@ def newPoint(theDocument, theX, theY, theZ): aSession.startOperation() aPoint = theDocument.addFeature("Point") aPointData = aPoint.data() - assert(aPointData is not None) + assert aPointData is not None geomDataAPI_Point(aPointData.attribute("point3d")).setValue(theX, theY, theZ) aPointData.string("creation_method").setValue("by_xyz") aSession.finishOperation() return aPoint -#========================================================================= +# ========================================================================= # Prepare some features and folders -#========================================================================= +# ========================================================================= aSession.startOperation() aPart = aSession.moduleDocument().addFeature("Part") aSession.finishOperation() # add points aPartDoc = aSession.activeDocument() -aPoint1 = newPoint(aPartDoc, 0., 0., 0.) -aPoint2 = newPoint(aPartDoc, 10., 0., 0.) -aPoint3 = newPoint(aPartDoc, 10., 10., 0.) -aPoint4 = newPoint(aPartDoc, 0., 10., 0.) +aPoint1 = newPoint(aPartDoc, 0.0, 0.0, 0.0) +aPoint2 = newPoint(aPartDoc, 10.0, 0.0, 0.0) +aPoint3 = newPoint(aPartDoc, 10.0, 10.0, 0.0) +aPoint4 = newPoint(aPartDoc, 0.0, 10.0, 0.0) # add folders aSession.startOperation() @@ -70,10 +70,10 @@ toFolder.append(aPoint1) aSession.startOperation() aFolder = aPartDoc.findFolderBelow(toFolder) -assert(aFolder is not None) +assert aFolder is not None isAdded = aPartDoc.moveToFolder(toFolder, aFolder) aSession.finishOperation() -assert(isAdded) +assert isAdded toFolder = FeatureList() toFolder.append(aPoint3) @@ -81,72 +81,139 @@ toFolder.append(aPoint4) aSession.startOperation() aFolder = aPartDoc.findFolderAbove(toFolder) -assert(aFolder is not None) +assert aFolder is not None isAdded = aPartDoc.moveToFolder(toFolder, aFolder) aSession.finishOperation() -assert(isAdded) +assert isAdded NB_FEATURES_FULL = 7 -NB_FEATURES_OUT = 4 - -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) - -assert(aPartDoc.index(aFolder1, True) == 0), "Wrong index of the folder: {}".format(aPartDoc.index(aFolder1, True)) -assert(aPartDoc.index(aFolder2, True) == 1), "Wrong index of the folder: {}".format(aPartDoc.index(aFolder2, True)) -assert(aPartDoc.index(aFolder3, True) == 3), "Wrong index of the folder: {}".format(aPartDoc.index(aFolder3, True)) - -assert(aPartDoc.index(aPoint1, True) == -1), "Wrong index of the point: {}".format(aPartDoc.index(aPoint1, True)) -assert(aPartDoc.index(aPoint2, True) == 2), "Wrong index of the point: {}".format(aPartDoc.index(aPoint2, True)) -assert(aPartDoc.index(aPoint3, True) == -1), "Wrong index of the point: {}".format(aPartDoc.index(aPoint3, True)) -assert(aPartDoc.index(aPoint4, True) == -1), "Wrong index of the point: {}".format(aPartDoc.index(aPoint4, True)) - - -#========================================================================= +NB_FEATURES_OUT = 4 + +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) + +assert aPartDoc.index(aFolder1, True) == 0, "Wrong index of the folder: {}".format( + aPartDoc.index(aFolder1, True) +) +assert aPartDoc.index(aFolder2, True) == 1, "Wrong index of the folder: {}".format( + aPartDoc.index(aFolder2, True) +) +assert aPartDoc.index(aFolder3, True) == 3, "Wrong index of the folder: {}".format( + aPartDoc.index(aFolder3, True) +) + +assert aPartDoc.index(aPoint1, True) == -1, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint1, True) +) +assert aPartDoc.index(aPoint2, True) == 2, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint2, True) +) +assert aPartDoc.index(aPoint3, True) == -1, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint3, True) +) +assert aPartDoc.index(aPoint4, True) == -1, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint4, True) +) + + +# ========================================================================= # Test 1. Remove empty folder -#========================================================================= +# ========================================================================= aSession.startOperation() aPartDoc.removeFolder(aFolder2) aSession.finishOperation() NB_FEATURES_FULL -= 1 -NB_FEATURES_OUT -= 1 - -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) - -assert(aPartDoc.index(aFolder1, True) == 0), "Wrong index of the folder: {}".format(aPartDoc.index(aFolder1, True)) -assert(aPartDoc.index(aFolder2, True) == -1), "Wrong index of the folder: {}".format(aPartDoc.index(aFolder2, True)) -assert(aPartDoc.index(aFolder3, True) == 2), "Wrong index of the folder: {}".format(aPartDoc.index(aFolder3, True)) - -assert(aPartDoc.index(aPoint1, True) == -1), "Wrong index of the point: {}".format(aPartDoc.index(aPoint1, True)) -assert(aPartDoc.index(aPoint2, True) == 1), "Wrong index of the point: {}".format(aPartDoc.index(aPoint2, True)) -assert(aPartDoc.index(aPoint3, True) == -1), "Wrong index of the point: {}".format(aPartDoc.index(aPoint3, True)) -assert(aPartDoc.index(aPoint4, True) == -1), "Wrong index of the point: {}".format(aPartDoc.index(aPoint4, True)) - - -#========================================================================= +NB_FEATURES_OUT -= 1 + +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) + +assert aPartDoc.index(aFolder1, True) == 0, "Wrong index of the folder: {}".format( + aPartDoc.index(aFolder1, True) +) +assert aPartDoc.index(aFolder2, True) == -1, "Wrong index of the folder: {}".format( + aPartDoc.index(aFolder2, True) +) +assert aPartDoc.index(aFolder3, True) == 2, "Wrong index of the folder: {}".format( + aPartDoc.index(aFolder3, True) +) + +assert aPartDoc.index(aPoint1, True) == -1, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint1, True) +) +assert aPartDoc.index(aPoint2, True) == 1, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint2, True) +) +assert aPartDoc.index(aPoint3, True) == -1, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint3, True) +) +assert aPartDoc.index(aPoint4, True) == -1, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint4, True) +) + + +# ========================================================================= # Test 2. Remove non-empty folder -#========================================================================= +# ========================================================================= aSession.startOperation() aPartDoc.removeFolder(aFolder3) aSession.finishOperation() NB_FEATURES_FULL -= 1 -NB_FEATURES_OUT += 1 - -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) - -assert(aPartDoc.index(aFolder1, True) == 0), "Wrong index of the folder: {}".format(aPartDoc.index(aFolder1, True)) -assert(aPartDoc.index(aFolder2, True) == -1), "Wrong index of the folder: {}".format(aPartDoc.index(aFolder2, True)) -assert(aPartDoc.index(aFolder3, True) == -1), "Wrong index of the folder: {}".format(aPartDoc.index(aFolder3, True)) - -assert(aPartDoc.index(aPoint1, True) == -1), "Wrong index of the point: {}".format(aPartDoc.index(aPoint1, True)) -assert(aPartDoc.index(aPoint2, True) == 1), "Wrong index of the point: {}".format(aPartDoc.index(aPoint2, True)) -assert(aPartDoc.index(aPoint3, True) == 2), "Wrong index of the point: {}".format(aPartDoc.index(aPoint3, True)) -assert(aPartDoc.index(aPoint4, True) == 3), "Wrong index of the point: {}".format(aPartDoc.index(aPoint4, True)) +NB_FEATURES_OUT += 1 + +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) + +assert aPartDoc.index(aFolder1, True) == 0, "Wrong index of the folder: {}".format( + aPartDoc.index(aFolder1, True) +) +assert aPartDoc.index(aFolder2, True) == -1, "Wrong index of the folder: {}".format( + aPartDoc.index(aFolder2, True) +) +assert aPartDoc.index(aFolder3, True) == -1, "Wrong index of the folder: {}".format( + aPartDoc.index(aFolder3, True) +) + +assert aPartDoc.index(aPoint1, True) == -1, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint1, True) +) +assert aPartDoc.index(aPoint2, True) == 1, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint2, True) +) +assert aPartDoc.index(aPoint3, True) == 2, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint3, True) +) +assert aPartDoc.index(aPoint4, True) == 3, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint4, True) +) from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestFolder_Sketch.py b/src/ModelAPI/Test/TestFolder_Sketch.py index df27bd244..006150285 100644 --- a/src/ModelAPI/Test/TestFolder_Sketch.py +++ b/src/ModelAPI/Test/TestFolder_Sketch.py @@ -36,18 +36,43 @@ model.do() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(50, 50, 25) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), 50, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], + model.selection(), + 50, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchCircle_2 = Sketch_2.addCircle(100, -100, 50) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 10, 0) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 10, [model.selection("SOLID", "Extrusion_2_1")]) -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face_1")) -SketchProjection_1 = Sketch_3.addProjection(model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_3/SketchCircle_2_2][Extrusion_2_1/To_Face]__cc"), False) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 10, 0 +) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [], + model.selection(), + 0, + 10, + [model.selection("SOLID", "Extrusion_2_1")], +) +Sketch_3 = model.addSketch( + Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face_1") +) +SketchProjection_1 = Sketch_3.addProjection( + model.selection( + "VERTEX", + "[Extrusion_2_1/Generated_Face&Sketch_3/SketchCircle_2_2][Extrusion_2_1/To_Face]__cc", + ), + False, +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_3 = Sketch_3.addCircle(100, -100, 25) -SketchConstraintCoincidence_1 = Sketch_3.setCoincident(SketchPoint_1.result(), SketchCircle_3.center()) +SketchConstraintCoincidence_1 = Sketch_3.setCoincident( + SketchPoint_1.result(), SketchCircle_3.center() +) ExtrusionCut_1.setNestedSketch(Sketch_3) model.do() model.end() @@ -56,19 +81,27 @@ model.end() aSession = ModelAPI_Session.get() aPartDoc = aSession.activeDocument() -#========================================================================= +# ========================================================================= # Test 1. Sketch and extrusion could be added to the folder above -#========================================================================= +# ========================================================================= aSession.startOperation() Folder_1 = aPartDoc.addFolder(Sketch_1.feature()) aSession.finishOperation() NB_FEATURES_FULL = 7 -NB_FEATURES_OUT = 7 +NB_FEATURES_OUT = 7 # full number of features -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) # number of features outside the folder -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) toFolder = FeatureList() toFolder.append(Sketch_1.feature()) @@ -77,39 +110,55 @@ toFolder.append(Extrusion_1.feature()) # move features to the folder aSession.startOperation() aFolder = aPartDoc.findFolderAbove(toFolder) -assert(aFolder is not None and aFolder.data().isEqual(Folder_1.data())) +assert aFolder is not None and aFolder.data().isEqual(Folder_1.data()) isAdded = aPartDoc.moveToFolder(toFolder, aFolder) aSession.finishOperation() -assert(isAdded) +assert isAdded NB_FEATURES_OUT -= 2 # full number of features -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) # number of features outside the folder -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) # check the index of the sketch in the folder aFound = aPartDoc.findContainingFolder(Sketch_1.feature()) -assert(aFound[0].data().isEqual(aFolder.data())) -assert(aFound[1] == 0) +assert aFound[0].data().isEqual(aFolder.data()) +assert aFound[1] == 0 # check the index of the extrusion in the folder aFound = aPartDoc.findContainingFolder(Extrusion_1.feature()) -assert(aFound[0].data().isEqual(aFolder.data())) -assert(aFound[1] == 1) +assert aFound[0].data().isEqual(aFolder.data()) +assert aFound[1] == 1 -#========================================================================= +# ========================================================================= # Test 2. Sketch could be added to the folder below -#========================================================================= +# ========================================================================= aSession.startOperation() Folder_2 = aPartDoc.addFolder(Extrusion_2.feature()) aSession.finishOperation() NB_FEATURES_FULL += 1 -NB_FEATURES_OUT += 1 +NB_FEATURES_OUT += 1 # full number of features -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) # number of features outside the folder -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) toFolder = FeatureList() toFolder.append(Sketch_2.feature()) @@ -117,47 +166,67 @@ toFolder.append(Sketch_2.feature()) # move feature to the folder aSession.startOperation() aFolder = aPartDoc.findFolderBelow(toFolder) -assert(aFolder is not None and aFolder.data().isEqual(Folder_2.data())) +assert aFolder is not None and aFolder.data().isEqual(Folder_2.data()) isAdded = aPartDoc.moveToFolder(toFolder, aFolder) aSession.finishOperation() -assert(isAdded) +assert isAdded NB_FEATURES_OUT -= 1 # full number of features -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) # number of features outside the folder -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) # check the index of the sketch in the folder aFound = aPartDoc.findContainingFolder(Sketch_2.feature()) -assert(aFound[0].data().isEqual(aFolder.data())) -assert(aFound[1] == 0) +assert aFound[0].data().isEqual(aFolder.data()) +assert aFound[1] == 0 # check sketch is the last feature in the folder aLastFeature = Folder_2.lastVisibleFeature() -assert(aLastFeature.getKind() == "Sketch") +assert aLastFeature.getKind() == "Sketch" -#========================================================================= +# ========================================================================= # Test 3. Sketch could be removed from the folder -#========================================================================= +# ========================================================================= fromFolder = FeatureList() fromFolder.append(Sketch_1.feature()) aSession.startOperation() isMovedOut = aPartDoc.removeFromFolder(fromFolder) aSession.finishOperation() -assert(isMovedOut) -assert(aPartDoc.index(Sketch_1.feature(), True) == 1), "Wrong index of the {}: {}".format(Sketch_1.feature().name(), aPartDoc.index(Sketch_1.feature(), True)) +assert isMovedOut +assert ( + aPartDoc.index(Sketch_1.feature(), True) == 1 +), "Wrong index of the {}: {}".format( + Sketch_1.feature().name(), aPartDoc.index(Sketch_1.feature(), True) +) NB_FEATURES_OUT += 1 # full number of features -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) # number of features outside the folder -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) -#========================================================================= +# ========================================================================= # Test 4. Add 2 sketches to the folder below -#========================================================================= +# ========================================================================= toFolder = FeatureList() toFolder.append(Sketch_0.feature()) @@ -166,25 +235,34 @@ toFolder.append(Sketch_1.feature()) # move features to the folder aSession.startOperation() aFolder = aPartDoc.findFolderBelow(toFolder) -assert(aFolder is not None and aFolder.data().isEqual(Folder_1.data())) +assert aFolder is not None and aFolder.data().isEqual(Folder_1.data()) isAdded = aPartDoc.moveToFolder(toFolder, aFolder) aSession.finishOperation() -assert(isAdded) +assert isAdded NB_FEATURES_OUT -= 2 # full number of features -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) # number of features outside the folder -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) # check the index of the sketch in the folder aFound = aPartDoc.findContainingFolder(Sketch_0.feature()) -assert(aFound[0].data().isEqual(aFolder.data())) -assert(aFound[1] == 0) +assert aFound[0].data().isEqual(aFolder.data()) +assert aFound[1] == 0 # check the index of the extrusion in the folder aFound = aPartDoc.findContainingFolder(Sketch_1.feature()) -assert(aFound[0].data().isEqual(aFolder.data())) -assert(aFound[1] == 1) +assert aFound[0].data().isEqual(aFolder.data()) +assert aFound[1] == 1 from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestFolder_Stability.py b/src/ModelAPI/Test/TestFolder_Stability.py index 57827fa9b..c13adc67f 100644 --- a/src/ModelAPI/Test/TestFolder_Stability.py +++ b/src/ModelAPI/Test/TestFolder_Stability.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Test checks stability of the foldering mechanism due to incorrect input parameters -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * @@ -32,44 +32,54 @@ def newPoint(theDocument, theX, theY, theZ): aSession.startOperation() aPoint = theDocument.addFeature("Point") aPointData = aPoint.data() - assert(aPointData is not None) + assert aPointData is not None geomDataAPI_Point(aPointData.attribute("point3d")).setValue(theX, theY, theZ) aPointData.string("creation_method").setValue("by_xyz") aSession.finishOperation() return aPoint -#========================================================================= +# ========================================================================= # Initialization of the model -#========================================================================= +# ========================================================================= aSession.startOperation() aPart = aSession.moduleDocument().addFeature("Part") aSession.finishOperation() # add point and a folder before it aPartDoc = aSession.activeDocument() -aPoint1 = newPoint(aPartDoc, 0., 0., 0.) +aPoint1 = newPoint(aPartDoc, 0.0, 0.0, 0.0) aSession.startOperation() aFolder1 = aPartDoc.addFolder(aPoint1) aSession.finishOperation() NB_FEATURES_FULL = 2 -NB_FEATURES_OUT = 2 +NB_FEATURES_OUT = 2 -assert(aPartDoc.size("Folders") == 1), "Wrong number of folders: {}".format(aPartDoc.size("Folders")) -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}".format(aPartDoc.size("Features")) +assert aPartDoc.size("Folders") == 1, "Wrong number of folders: {}".format( + aPartDoc.size("Folders") +) +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}".format(aPartDoc.size("Features")) -#========================================================================= +# ========================================================================= # Test 1. Check number of features out of folder # and absense of the crash while getting size of incorrect group -#========================================================================= -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) -assert(aPartDoc.size("Construction", True) == 1), "Wrong size: {}".format(aPartDoc.size("Construction", True)) - -#========================================================================= +# ========================================================================= +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) +assert aPartDoc.size("Construction", True) == 1, "Wrong size: {}".format( + aPartDoc.size("Construction", True) +) + +# ========================================================================= # Test 2. Add a feature to the folder and check number of features once again -#========================================================================= +# ========================================================================= toFolder = FeatureList() toFolder.append(aPoint1) @@ -78,15 +88,21 @@ aFolder2 = aPartDoc.addFolder(aPoint1) aSession.finishOperation() NB_FEATURES_FULL += 1 -NB_FEATURES_OUT += 1 +NB_FEATURES_OUT += 1 aSession.startOperation() aFolder = aPartDoc.findFolderAbove(toFolder) -assert(aFolder is not None) +assert aFolder is not None isAdded = aPartDoc.moveToFolder(toFolder, aFolder) aSession.finishOperation() -assert(isAdded) +assert isAdded NB_FEATURES_OUT -= 1 -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) -assert(aPartDoc.size("Construction", True) == 1), "Wrong size: {}".format(aPartDoc.size("Construction", True)) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) +assert aPartDoc.size("Construction", True) == 1, "Wrong size: {}".format( + aPartDoc.size("Construction", True) +) diff --git a/src/ModelAPI/Test/TestFolder_Update.py b/src/ModelAPI/Test/TestFolder_Update.py index bff7ab0a4..31461f264 100644 --- a/src/ModelAPI/Test/TestFolder_Update.py +++ b/src/ModelAPI/Test/TestFolder_Update.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * @@ -32,35 +32,41 @@ def newPoint(theDocument, theX, theY, theZ): aSession.startOperation() aPoint = theDocument.addFeature("Point") aPointData = aPoint.data() - assert(aPointData is not None) + assert aPointData is not None geomDataAPI_Point(aPointData.attribute("point3d")).setValue(theX, theY, theZ) aPointData.string("creation_method").setValue("by_xyz") aSession.finishOperation() return aPoint -#========================================================================= +# ========================================================================= # Test 1. Add a point into a folder above -#========================================================================= +# ========================================================================= aSession.startOperation() aPart = aSession.moduleDocument().addFeature("Part") aSession.finishOperation() # add point and a folder before it aPartDoc = aSession.activeDocument() -aPoint1 = newPoint(aPartDoc, 0., 0., 0.) +aPoint1 = newPoint(aPartDoc, 0.0, 0.0, 0.0) aSession.startOperation() aFolder1 = aPartDoc.addFolder(aPoint1) aSession.finishOperation() NB_FEATURES_FULL = 2 -NB_FEATURES_OUT = 2 - -assert(aPartDoc.size("Folders") == 1), "Wrong number of folders: {}".format(aPartDoc.size("Folders")) -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}".format(aPartDoc.size("Features")) +NB_FEATURES_OUT = 2 + +assert aPartDoc.size("Folders") == 1, "Wrong number of folders: {}".format( + aPartDoc.size("Folders") +) +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}".format(aPartDoc.size("Features")) FOLDER_NAME_EXPECTED = "Folder_1" -assert(aFolder1.name() == FOLDER_NAME_EXPECTED), "Actual name '{}', expected '{}'".format(aFolder1.name(), FOLDER_NAME_EXPECTED) +assert ( + aFolder1.name() == FOLDER_NAME_EXPECTED +), "Actual name '{}', expected '{}'".format(aFolder1.name(), FOLDER_NAME_EXPECTED) toFolder = FeatureList() toFolder.append(aPoint1) @@ -68,29 +74,45 @@ toFolder.append(aPoint1) # move point to the folder aSession.startOperation() aFolder = aPartDoc.findFolderAbove(toFolder) -assert(aFolder is not None) +assert aFolder is not None isAdded = aPartDoc.moveToFolder(toFolder, aFolder) aSession.finishOperation() -assert(isAdded) +assert isAdded NB_FEATURES_OUT -= 1 # full number of features -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) # number of features outside the folder -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) # check the index of the point in the folder aFound = aPartDoc.findContainingFolder(aPoint1) -assert(aFound[0].data().isEqual(aFolder1.data())) -assert(aFound[1] == 0) +assert aFound[0].data().isEqual(aFolder1.data()) +assert aFound[1] == 0 -#========================================================================= +# ========================================================================= # Test 2. Add a point, check it is added to a folder, then move it out -#========================================================================= -aPoint2 = newPoint(aPartDoc, 10., 0., 0.) +# ========================================================================= +aPoint2 = newPoint(aPartDoc, 10.0, 0.0, 0.0) NB_FEATURES_FULL += 1 -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) fromFolder = FeatureList() fromFolder.append(aPoint2) @@ -98,16 +120,24 @@ fromFolder.append(aPoint2) aSession.startOperation() isMovedOut = aPartDoc.removeFromFolder(fromFolder) aSession.finishOperation() -assert(isMovedOut) +assert isMovedOut NB_FEATURES_OUT += 1 -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) - -#========================================================================= +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) + +# ========================================================================= # Test 3. Add a point into a folder below -#========================================================================= -aPoint3 = newPoint(aPartDoc, 10., 10., 0.) +# ========================================================================= +aPoint3 = newPoint(aPartDoc, 10.0, 10.0, 0.0) NB_FEATURES_FULL += 1 NB_FEATURES_OUT += 1 @@ -120,9 +150,19 @@ aSession.finishOperation() NB_FEATURES_FULL += 1 NB_FEATURES_OUT += 1 -assert(aPartDoc.size("Folders") == 2), "Wrong number of folders: {}".format(aPartDoc.size("Folders")) -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) +assert aPartDoc.size("Folders") == 2, "Wrong number of folders: {}".format( + aPartDoc.size("Folders") +) +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) toFolder = FeatureList() toFolder.append(aPoint2) @@ -130,38 +170,58 @@ toFolder.append(aPoint2) # move point to the folder aSession.startOperation() aFolder = aPartDoc.findFolderBelow(toFolder) -assert(aFolder is not None) +assert aFolder is not None isAdded = aPartDoc.moveToFolder(toFolder, aFolder) aSession.finishOperation() -assert(isAdded) +assert isAdded NB_FEATURES_OUT -= 1 -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) # check the index of the point in the folder aFound = aPartDoc.findContainingFolder(aPoint2) -assert(aFound[0].data().isEqual(aFolder2.data())) -assert(aFound[1] == 0) +assert aFound[0].data().isEqual(aFolder2.data()) +assert aFound[1] == 0 aFound = aPartDoc.findContainingFolder(aPoint3) -assert(aFound == -1) +assert aFound == -1 -#========================================================================= +# ========================================================================= # Test 4. Add several points into a folder -#========================================================================= -aPoint4 = newPoint(aPartDoc, 0., 10., 0.) +# ========================================================================= +aPoint4 = newPoint(aPartDoc, 0.0, 10.0, 0.0) NB_FEATURES_FULL += 1 NB_FEATURES_OUT += 1 -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) # index without respect to foldering -assert(aPartDoc.index(aPoint4) == 5), "Wrong index of the point: {}".format(aPartDoc.index(aPoint4)) +assert aPartDoc.index(aPoint4) == 5, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint4) +) # index according to folders -assert(aPartDoc.index(aPoint4, True) == 3), "Wrong index of the point: {}".format(aPartDoc.index(aPoint4, True)) +assert aPartDoc.index(aPoint4, True) == 3, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint4, True) +) # add a folder aSession.startOperation() @@ -171,16 +231,34 @@ aSession.finishOperation() NB_FEATURES_FULL += 1 NB_FEATURES_OUT += 1 -assert(aPartDoc.size("Folders") == 3), "Wrong number of folders: {}".format(aPartDoc.size("Folders")) -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) +assert aPartDoc.size("Folders") == 3, "Wrong number of folders: {}".format( + aPartDoc.size("Folders") +) +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) # index without respect to foldering -assert(aPartDoc.index(aFolder3) == 4), "Wrong index of the folder: {}".format(aPartDoc.index(aFolder3)) -assert(aPartDoc.index(aPoint4) == 6), "Wrong index of the point: {}".format(aPartDoc.index(aPoint4)) +assert aPartDoc.index(aFolder3) == 4, "Wrong index of the folder: {}".format( + aPartDoc.index(aFolder3) +) +assert aPartDoc.index(aPoint4) == 6, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint4) +) # index according to folders -assert(aPartDoc.index(aFolder3, True) == 2), "Wrong index of the folder: {}".format(aPartDoc.index(aFolder3, True)) -assert(aPartDoc.index(aPoint4, True) == 4), "Wrong index of the point: {}".format(aPartDoc.index(aPoint4, True)) +assert aPartDoc.index(aFolder3, True) == 2, "Wrong index of the folder: {}".format( + aPartDoc.index(aFolder3, True) +) +assert aPartDoc.index(aPoint4, True) == 4, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint4, True) +) toFolder = FeatureList() toFolder.append(aPoint3) @@ -189,46 +267,66 @@ toFolder.append(aPoint4) # move point to the folder aSession.startOperation() aFolder = aPartDoc.findFolderAbove(toFolder) -assert(aFolder is not None) +assert aFolder is not None isAdded = aPartDoc.moveToFolder(toFolder, aFolder) aSession.finishOperation() -assert(isAdded) +assert isAdded NB_FEATURES_OUT -= 2 -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) # index without respect to foldering -assert(aPartDoc.index(aFolder3) == 4), "Wrong index of the folder: {}".format(aPartDoc.index(aFolder3)) -assert(aPartDoc.index(aPoint3) == 5), "Wrong index of the point: {}".format(aPartDoc.index(aPoint3)) -assert(aPartDoc.index(aPoint4) == 6), "Wrong index of the point: {}".format(aPartDoc.index(aPoint4)) +assert aPartDoc.index(aFolder3) == 4, "Wrong index of the folder: {}".format( + aPartDoc.index(aFolder3) +) +assert aPartDoc.index(aPoint3) == 5, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint3) +) +assert aPartDoc.index(aPoint4) == 6, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint4) +) # index according to folders -assert(aPartDoc.index(aFolder3, True) == 2), "Wrong index of the folder: {}".format(aPartDoc.index(aFolder3, True)) -assert(aPartDoc.index(aPoint3, True) == -1), "Wrong index of the point: {}".format(aPartDoc.index(aPoint3, True)) -assert(aPartDoc.index(aPoint4, True) == -1), "Wrong index of the point: {}".format(aPartDoc.index(aPoint4, True)) +assert aPartDoc.index(aFolder3, True) == 2, "Wrong index of the folder: {}".format( + aPartDoc.index(aFolder3, True) +) +assert aPartDoc.index(aPoint3, True) == -1, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint3, True) +) +assert aPartDoc.index(aPoint4, True) == -1, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint4, True) +) # check the index of the point in the folder aFound = aPartDoc.findContainingFolder(aPoint3) -assert(aFound[0].data().isEqual(aFolder3.data())) -assert(aFound[1] == 0) +assert aFound[0].data().isEqual(aFolder3.data()) +assert aFound[1] == 0 aFound = aPartDoc.findContainingFolder(aPoint4) -assert(aFound[0].data().isEqual(aFolder3.data())) -assert(aFound[1] == 1) +assert aFound[0].data().isEqual(aFolder3.data()) +assert aFound[1] == 1 -aPoint5 = newPoint(aPartDoc, 0., 0., 10.) +aPoint5 = newPoint(aPartDoc, 0.0, 0.0, 10.0) fromFolder = FeatureList() fromFolder.append(aPoint5) aSession.startOperation() isMovedOut = aPartDoc.removeFromFolder(fromFolder) aSession.finishOperation() -assert(isMovedOut) +assert isMovedOut # add more points to the folder to move them out -aPoint6 = newPoint(aPartDoc, 10., 0., 10.) -aPoint7 = newPoint(aPartDoc, 10., 10., 10.) -aPoint8 = newPoint(aPartDoc, 0., 10., 10.) +aPoint6 = newPoint(aPartDoc, 10.0, 0.0, 10.0) +aPoint7 = newPoint(aPartDoc, 10.0, 10.0, 10.0) +aPoint8 = newPoint(aPartDoc, 0.0, 10.0, 10.0) toFolder = FeatureList() toFolder.append(aPoint5) @@ -239,68 +337,108 @@ toFolder.append(aPoint8) # move point to the folder aSession.startOperation() aFolder = aPartDoc.findFolderAbove(toFolder) -assert(aFolder is not None) +assert aFolder is not None isAdded = aPartDoc.moveToFolder(toFolder, aFolder) aSession.finishOperation() -assert(isAdded) +assert isAdded NB_FEATURES_FULL += 4 -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) - -assert(aPartDoc.index(aPoint5, True) == -1), "Wrong index of the point: {}".format(aPartDoc.index(aPoint5, True)) -assert(aPartDoc.index(aPoint6, True) == -1), "Wrong index of the point: {}".format(aPartDoc.index(aPoint6, True)) -assert(aPartDoc.index(aPoint7, True) == -1), "Wrong index of the point: {}".format(aPartDoc.index(aPoint7, True)) -assert(aPartDoc.index(aPoint8, True) == -1), "Wrong index of the point: {}".format(aPartDoc.index(aPoint8, True)) - -assert(aFolder3.reference("first_feature").value() is not None) -assert(aFolder3.reference("last_feature").value() is not None) - -#========================================================================= +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) + +assert aPartDoc.index(aPoint5, True) == -1, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint5, True) +) +assert aPartDoc.index(aPoint6, True) == -1, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint6, True) +) +assert aPartDoc.index(aPoint7, True) == -1, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint7, True) +) +assert aPartDoc.index(aPoint8, True) == -1, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint8, True) +) + +assert aFolder3.reference("first_feature").value() is not None +assert aFolder3.reference("last_feature").value() is not None + +# ========================================================================= # Test 5. Remove a point from a folder before it -#========================================================================= +# ========================================================================= fromFolder = FeatureList() fromFolder.append(aPoint3) aSession.startOperation() isMovedOut = aPartDoc.removeFromFolder(fromFolder) aSession.finishOperation() -assert(isMovedOut) +assert isMovedOut NB_FEATURES_OUT += 1 -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) - -assert(aPartDoc.index(aPoint3, True) == 2), "Wrong index of the point: {}".format(aPartDoc.index(aPoint3, True)) -assert(aPartDoc.index(aFolder3, True) == 3), "Wrong index of the folder: {}".format(aPartDoc.index(aFolder3, True)) - -assert(aFolder3.reference("first_feature").value() is not None) -assert(aFolder3.reference("last_feature").value() is not None) - -#========================================================================= +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) + +assert aPartDoc.index(aPoint3, True) == 2, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint3, True) +) +assert aPartDoc.index(aFolder3, True) == 3, "Wrong index of the folder: {}".format( + aPartDoc.index(aFolder3, True) +) + +assert aFolder3.reference("first_feature").value() is not None +assert aFolder3.reference("last_feature").value() is not None + +# ========================================================================= # Test 6. Remove a point from a folder after it -#========================================================================= +# ========================================================================= fromFolder = FeatureList() fromFolder.append(aPoint8) aSession.startOperation() isMovedOut = aPartDoc.removeFromFolder(fromFolder) aSession.finishOperation() -assert(isMovedOut) +assert isMovedOut NB_FEATURES_OUT += 1 -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) - -assert(aPartDoc.index(aPoint8, True) == 4), "Wrong index of the point: {}".format(aPartDoc.index(aPoint8, True)) -assert(aPartDoc.index(aFolder3, True) == 3), "Wrong index of the folder: {}".format(aPartDoc.index(aFolder3, True)) - -assert(aFolder3.reference("first_feature").value() is not None) -assert(aFolder3.reference("last_feature").value() is not None) - -#========================================================================= +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) + +assert aPartDoc.index(aPoint8, True) == 4, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint8, True) +) +assert aPartDoc.index(aFolder3, True) == 3, "Wrong index of the folder: {}".format( + aPartDoc.index(aFolder3, True) +) + +assert aFolder3.reference("first_feature").value() is not None +assert aFolder3.reference("last_feature").value() is not None + +# ========================================================================= # Test 7. Try to remove several points which are not start nor end in a folder -#========================================================================= +# ========================================================================= fromFolder = FeatureList() fromFolder.append(aPoint5) fromFolder.append(aPoint6) @@ -308,22 +446,38 @@ fromFolder.append(aPoint6) aSession.startOperation() isMovedOut = aPartDoc.removeFromFolder(fromFolder) aSession.finishOperation() -assert(isMovedOut is False) - -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) - -assert(aPartDoc.index(aFolder3, True) == 3), "Wrong index of the folder: {}".format(aPartDoc.index(aFolder3, True)) -assert(aPartDoc.index(aPoint5, True) == -1), "Wrong index of the point: {}".format(aPartDoc.index(aPoint5, True)) -assert(aPartDoc.index(aPoint6, True) == -1), "Wrong index of the point: {}".format(aPartDoc.index(aPoint6, True)) -assert(aPartDoc.index(aPoint8, True) == 4), "Wrong index of the point: {}".format(aPartDoc.index(aPoint8, True)) - -assert(aFolder3.reference("first_feature").value() is not None) -assert(aFolder3.reference("last_feature").value() is not None) - -#========================================================================= +assert isMovedOut is False + +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) + +assert aPartDoc.index(aFolder3, True) == 3, "Wrong index of the folder: {}".format( + aPartDoc.index(aFolder3, True) +) +assert aPartDoc.index(aPoint5, True) == -1, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint5, True) +) +assert aPartDoc.index(aPoint6, True) == -1, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint6, True) +) +assert aPartDoc.index(aPoint8, True) == 4, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint8, True) +) + +assert aFolder3.reference("first_feature").value() is not None +assert aFolder3.reference("last_feature").value() is not None + +# ========================================================================= # Test 8. Remove several points from a folder after it -#========================================================================= +# ========================================================================= fromFolder = FeatureList() fromFolder.append(aPoint6) fromFolder.append(aPoint7) @@ -331,23 +485,39 @@ fromFolder.append(aPoint7) aSession.startOperation() isMovedOut = aPartDoc.removeFromFolder(fromFolder) aSession.finishOperation() -assert(isMovedOut) +assert isMovedOut NB_FEATURES_OUT += 2 -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) - -assert(aPartDoc.index(aFolder3, True) == 3), "Wrong index of the folder: {}".format(aPartDoc.index(aFolder3, True)) -assert(aPartDoc.index(aPoint6, True) == 4), "Wrong index of the point: {}".format(aPartDoc.index(aPoint6, True)) -assert(aPartDoc.index(aPoint7, True) == 5), "Wrong index of the point: {}".format(aPartDoc.index(aPoint7, True)) -assert(aPartDoc.index(aPoint8, True) == 6), "Wrong index of the point: {}".format(aPartDoc.index(aPoint8, True)) - -assert(aFolder3.reference("first_feature").value() is not None) -assert(aFolder3.reference("last_feature").value() is not None) - -#========================================================================= +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) + +assert aPartDoc.index(aFolder3, True) == 3, "Wrong index of the folder: {}".format( + aPartDoc.index(aFolder3, True) +) +assert aPartDoc.index(aPoint6, True) == 4, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint6, True) +) +assert aPartDoc.index(aPoint7, True) == 5, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint7, True) +) +assert aPartDoc.index(aPoint8, True) == 6, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint8, True) +) + +assert aFolder3.reference("first_feature").value() is not None +assert aFolder3.reference("last_feature").value() is not None + +# ========================================================================= # Test 9. Remove all remaining points from a folder after it -#========================================================================= +# ========================================================================= fromFolder = FeatureList() fromFolder.append(aPoint4) fromFolder.append(aPoint5) @@ -355,26 +525,47 @@ fromFolder.append(aPoint5) aSession.startOperation() isMovedOut = aPartDoc.removeFromFolder(fromFolder, False) aSession.finishOperation() -assert(isMovedOut) +assert isMovedOut NB_FEATURES_OUT += 2 -assert(aPartDoc.size("Features") == NB_FEATURES_FULL), "Wrong number of features: {}, expected: {}".format(aPartDoc.size("Features"), NB_FEATURES_FULL) -assert(aPartDoc.size("Features", True) == NB_FEATURES_OUT), "Wrong number of features outside a folder: {}, expected: {}".format(aPartDoc.size("Features", True), NB_FEATURES_OUT) - -assert(aPartDoc.index(aFolder3, True) == 3), "Wrong index of the folder: {}".format(aPartDoc.index(aFolder3, True)) -assert(aPartDoc.index(aPoint4, True) == 4), "Wrong index of the point: {}".format(aPartDoc.index(aPoint4, True)) -assert(aPartDoc.index(aPoint5, True) == 5), "Wrong index of the point: {}".format(aPartDoc.index(aPoint5, True)) -assert(aPartDoc.index(aPoint6, True) == 6), "Wrong index of the point: {}".format(aPartDoc.index(aPoint6, True)) -assert(aPartDoc.index(aPoint7, True) == 7), "Wrong index of the point: {}".format(aPartDoc.index(aPoint7, True)) -assert(aPartDoc.index(aPoint8, True) == 8), "Wrong index of the point: {}".format(aPartDoc.index(aPoint8, True)) +assert ( + aPartDoc.size("Features") == NB_FEATURES_FULL +), "Wrong number of features: {}, expected: {}".format( + aPartDoc.size("Features"), NB_FEATURES_FULL +) +assert ( + aPartDoc.size("Features", True) == NB_FEATURES_OUT +), "Wrong number of features outside a folder: {}, expected: {}".format( + aPartDoc.size("Features", True), NB_FEATURES_OUT +) + +assert aPartDoc.index(aFolder3, True) == 3, "Wrong index of the folder: {}".format( + aPartDoc.index(aFolder3, True) +) +assert aPartDoc.index(aPoint4, True) == 4, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint4, True) +) +assert aPartDoc.index(aPoint5, True) == 5, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint5, True) +) +assert aPartDoc.index(aPoint6, True) == 6, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint6, True) +) +assert aPartDoc.index(aPoint7, True) == 7, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint7, True) +) +assert aPartDoc.index(aPoint8, True) == 8, "Wrong index of the point: {}".format( + aPartDoc.index(aPoint8, True) +) # folder is empty -assert(aFolder3.reference("first_feature").value() is None) -assert(aFolder3.reference("last_feature").value() is None) +assert aFolder3.reference("first_feature").value() is None +assert aFolder3.reference("last_feature").value() is None # remove empty folder aSession.startOperation() aPartDoc.removeFolder(aFolder3) aSession.finishOperation() from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestGeomNamingBoxWithFillet.py b/src/ModelAPI/Test/TestGeomNamingBoxWithFillet.py index 51aaea51e..3163022a4 100644 --- a/src/ModelAPI/Test/TestGeomNamingBoxWithFillet.py +++ b/src/ModelAPI/Test/TestGeomNamingBoxWithFillet.py @@ -28,56 +28,136 @@ 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) +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) +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) +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()) +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()) +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()) +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")) +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()) +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) +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) +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) +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); +param_p.setValue(30) from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Fillet_1.feature())) +assert aFactory.validate(Fillet_1.feature()) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestGeomNamingEdgeByFilter.py b/src/ModelAPI/Test/TestGeomNamingEdgeByFilter.py index d679c960f..0f66bba45 100644 --- a/src/ModelAPI/Test/TestGeomNamingEdgeByFilter.py +++ b/src/ModelAPI/Test/TestGeomNamingEdgeByFilter.py @@ -25,23 +25,45 @@ 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_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_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) +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")) +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 aFactory.validate(Placement_1.feature()) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/ModelAPI/Test/TestGeomNamingPlacement.py b/src/ModelAPI/Test/TestGeomNamingPlacement.py index fe2ce838e..85e0dc136 100644 --- a/src/ModelAPI/Test/TestGeomNamingPlacement.py +++ b/src/ModelAPI/Test/TestGeomNamingPlacement.py @@ -31,48 +31,131 @@ 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()) +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) +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) +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) +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()) +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) +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) +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) +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")]) +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) +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) @@ -80,7 +163,8 @@ model.end() # check that placement is valid from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Placement_1.feature())) +assert aFactory.validate(Placement_1.feature()) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/ModelAPI/Test/TestGeomNamingRevolution.py b/src/ModelAPI/Test/TestGeomNamingRevolution.py index edfc30f6b..51d45fbb3 100644 --- a/src/ModelAPI/Test/TestGeomNamingRevolution.py +++ b/src/ModelAPI/Test/TestGeomNamingRevolution.py @@ -28,14 +28,30 @@ 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()) +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()) @@ -45,23 +61,65 @@ 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) +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) +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) +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()) +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) +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) +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) @@ -69,7 +127,8 @@ model.end() # check that revolution is valid from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Revolution_1.feature())) +assert aFactory.validate(Revolution_1.feature()) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/ModelAPI/Test/TestGeomNamingSketchPlane.py b/src/ModelAPI/Test/TestGeomNamingSketchPlane.py index 32b888569..fd4289fa7 100644 --- a/src/ModelAPI/Test/TestGeomNamingSketchPlane.py +++ b/src/ModelAPI/Test/TestGeomNamingSketchPlane.py @@ -25,22 +25,54 @@ 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()) +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()) @@ -49,50 +81,124 @@ 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()) +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")) +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()) +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) +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) +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")) +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 = 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 = 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 = 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 = 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")]) +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) @@ -100,5 +206,6 @@ 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())) +assert aFactory.validate(ExtrusionCut_2.feature()) diff --git a/src/ModelAPI/Test/TestIntArray.py b/src/ModelAPI/Test/TestIntArray.py index 84505b960..02d4bbb58 100644 --- a/src/ModelAPI/Test/TestIntArray.py +++ b/src/ModelAPI/Test/TestIntArray.py @@ -22,9 +22,9 @@ Unit test for testing the Part sub-shapes naming, described in the issue 1064 """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -34,9 +34,9 @@ __updated__ = "2015-10-16" aSession = ModelAPI_Session.get() -#========================================================================= +# ========================================================================= # Create a sketch triangle in PartSet -#========================================================================= +# ========================================================================= aPartSet = aSession.moduleDocument() aSession.startOperation() aSketchFeature = featureToCompositeFeature(aPartSet.addFeature("Sketch")) @@ -47,8 +47,8 @@ anArray = aFeatureData.addAttribute("IntArray_1", "IntArray") aFeatureData.intArray("IntArray_1").setSize(5) aSession.finishOperation() -assert(aFeatureData.intArray("IntArray_1").size() == 5) +assert aFeatureData.intArray("IntArray_1").size() == 5 -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= diff --git a/src/ModelAPI/Test/TestMovePart1.py b/src/ModelAPI/Test/TestMovePart1.py index 8f90e0fd1..01ed01f9e 100644 --- a/src/ModelAPI/Test/TestMovePart1.py +++ b/src/ModelAPI/Test/TestMovePart1.py @@ -32,7 +32,9 @@ model.do() ### Create Sketch_2 with reference to Sketch_1 circle Sketch_2 = model.addSketch(partSet, model.defaultPlane("XOY")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchCircle_1_2"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchCircle_1_2"), False +) SketchCircle_2 = SketchProjection_2.createdFeature() SketchCircle_3 = Sketch_2.addCircle(34.92852513931564, 34.57180354201876, 20) Sketch_2.setCoincident(SketchCircle_2.results()[1], SketchCircle_3.center()) @@ -41,17 +43,38 @@ model.do() ### Create Part_1: Extrusion of Sketch_1 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_2f")], model.selection(), 10, 0, "Faces|Wires") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "PartSet/Sketch_1/Face-SketchCircle_1_2f")], + model.selection(), + 10, + 0, + "Faces|Wires", +) model.do() ### Create Part_2: Extrusion of Sketch_2 Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() -Extrusion_2 = model.addExtrusion(Part_2_doc, [model.selection("FACE", "PartSet/Sketch_2/Face-SketchCircle_3_2f")], model.selection(), 20, 0, "Faces|Wires") +Extrusion_2 = model.addExtrusion( + Part_2_doc, + [model.selection("FACE", "PartSet/Sketch_2/Face-SketchCircle_3_2f")], + model.selection(), + 20, + 0, + "Faces|Wires", +) model.do() ### Create Placement of Part_2 over a Part_1 -Placement_1 = model.addPlacement(partSet, [model.selection("COMPOUND", "Part_2/")], model.selection("FACE", "Part_2/Extrusion_1_1/From_Face"), model.selection("FACE", "Part_1/Extrusion_1_1/To_Face"), centering = True, keepSubResults = True) +Placement_1 = model.addPlacement( + partSet, + [model.selection("COMPOUND", "Part_2/")], + model.selection("FACE", "Part_2/Extrusion_1_1/From_Face"), + model.selection("FACE", "Part_1/Extrusion_1_1/To_Face"), + centering=True, + keepSubResults=True, +) ### Create independent Part_3 Part_3 = model.addPart(partSet) @@ -59,66 +82,79 @@ Part_3_doc = Part_3.document() Sketch_3 = model.addSketch(Part_3_doc, model.defaultPlane("XOY")) SketchCircle_4 = Sketch_3.addCircle(-60, 65, 10) model.do() -Extrusion_3 = model.addExtrusion(Part_3_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0, "Faces|Wires") +Extrusion_3 = model.addExtrusion( + Part_3_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], + model.selection(), + 10, + 0, + "Faces|Wires", +) model.do() model.end() # test the movement of parts ability and produced errors + # checking ability to move theWhat to position after theTo and produced error theError def checkMovement(theWhat, theTo, theError): - aWhatList = model.FeatureList() - aWhatList.append(theWhat.feature()) - if not theTo is None and not isinstance(theTo, model.ModelAPI_Object): - theTo = theTo.feature() - anError = model.validateMovement(theTo, aWhatList).strip() - aListCheck = theError.split('\n') - aListGet = anError.split('\n') - assert(len(aListCheck) == len(aListGet)) - # sort the second part of received list strings by name to keep stability of tests - aListGetSort = [] - for aLGet in aListGet: - if aLGet.find("-> ") > 0: - aRightPart = aLGet.split('-> ')[1].split(' ') - aRightPart.sort() - aListGetSort.append(aLGet.split('-> ')[0] + '-> ' + ' '.join(aRightPart)) - else: - aListGetSort.append(aLGet) - for anErr in aListCheck: - #print("Looking for " + anErr + " in " + str(aListGet)) - assert(aListGetSort.count(anErr) == 1) + aWhatList = model.FeatureList() + aWhatList.append(theWhat.feature()) + if not theTo is None and not isinstance(theTo, model.ModelAPI_Object): + theTo = theTo.feature() + anError = model.validateMovement(theTo, aWhatList).strip() + aListCheck = theError.split("\n") + aListGet = anError.split("\n") + assert len(aListCheck) == len(aListGet) + # sort the second part of received list strings by name to keep stability of tests + aListGetSort = [] + for aLGet in aListGet: + if aLGet.find("-> ") > 0: + aRightPart = aLGet.split("-> ")[1].split(" ") + aRightPart.sort() + aListGetSort.append(aLGet.split("-> ")[0] + "-> " + " ".join(aRightPart)) + else: + aListGetSort.append(aLGet) + for anErr in aListCheck: + # print("Looking for " + anErr + " in " + str(aListGet)) + assert aListGetSort.count(anErr) == 1 + # movement to very first location actually means movement after the first invisible objects, coordinate system hidden ones aLastHidden = None for aFeat in partSet.allObjects(): - if aFeat.isInHistory(): - break - aLastHidden = model.objectToFeature(aFeat) - -checkMovement(Part_1, None, 'Part_1 -> Origin Sketch_1') -checkMovement(Part_1, aLastHidden, 'Part_1 -> Sketch_1') -checkMovement(Part_1, Sketch_1, 'Part_1 -> Sketch_1') -checkMovement(Part_1, Sketch_2, '') -checkMovement(Part_1, Part_2, '') -checkMovement(Part_1, Placement_1, 'Placement_1 -> Part_1') -checkMovement(Part_1, Part_3, 'Placement_1 -> Part_1') - -checkMovement(Part_2, None, 'Part_2 -> Origin Sketch_1 Sketch_2') -checkMovement(Part_2, aLastHidden, 'Part_2 -> Sketch_1 Sketch_2') -checkMovement(Part_2, Sketch_1, 'Part_2 -> Sketch_1 Sketch_2') # in GUI this is not the case, because it drops after invisible sketch components -checkMovement(Part_2, Sketch_2, 'Part_2 -> Sketch_2') # in GUI this is not the case, because it drops after invisible sketch components -checkMovement(Part_2, Part_1, '') -checkMovement(Part_2, Placement_1, 'Placement_1 -> Part_2') -checkMovement(Part_2, Part_3, 'Placement_1 -> Part_2') - -checkMovement(Part_3, None, '') -checkMovement(Part_3, aLastHidden, '') -checkMovement(Part_3, Sketch_1, '') -checkMovement(Part_3, Sketch_2, '') -checkMovement(Part_3, Part_1, '') -checkMovement(Part_3, Part_2, '') -checkMovement(Part_3, Placement_1, '') + if aFeat.isInHistory(): + break + aLastHidden = model.objectToFeature(aFeat) + +checkMovement(Part_1, None, "Part_1 -> Origin Sketch_1") +checkMovement(Part_1, aLastHidden, "Part_1 -> Sketch_1") +checkMovement(Part_1, Sketch_1, "Part_1 -> Sketch_1") +checkMovement(Part_1, Sketch_2, "") +checkMovement(Part_1, Part_2, "") +checkMovement(Part_1, Placement_1, "Placement_1 -> Part_1") +checkMovement(Part_1, Part_3, "Placement_1 -> Part_1") + +checkMovement(Part_2, None, "Part_2 -> Origin Sketch_1 Sketch_2") +checkMovement(Part_2, aLastHidden, "Part_2 -> Sketch_1 Sketch_2") +checkMovement( + Part_2, Sketch_1, "Part_2 -> Sketch_1 Sketch_2" +) # in GUI this is not the case, because it drops after invisible sketch components +checkMovement( + Part_2, Sketch_2, "Part_2 -> Sketch_2" +) # in GUI this is not the case, because it drops after invisible sketch components +checkMovement(Part_2, Part_1, "") +checkMovement(Part_2, Placement_1, "Placement_1 -> Part_2") +checkMovement(Part_2, Part_3, "Placement_1 -> Part_2") + +checkMovement(Part_3, None, "") +checkMovement(Part_3, aLastHidden, "") +checkMovement(Part_3, Sketch_1, "") +checkMovement(Part_3, Sketch_2, "") +checkMovement(Part_3, Part_1, "") +checkMovement(Part_3, Part_2, "") +checkMovement(Part_3, Placement_1, "") # do movement Part_2 after Sketch_2 anAfterSketch_2 = partSet.nextFeature(Part_1.feature(), True) @@ -127,8 +163,8 @@ partSet.moveFeature(Part_2.feature(), anAfterSketch_2) model.end() # check the movement is performed anAfter = partSet.nextFeature(anAfterSketch_2) -assert(anAfter.name() == 'Part_2') +assert anAfter.name() == "Part_2" anAfter = partSet.nextFeature(anAfter) -assert(anAfter.name() == 'Part_1') +assert anAfter.name() == "Part_1" anAfter = partSet.nextFeature(anAfter) -assert(anAfter.name() == 'Placement_1') +assert anAfter.name() == "Placement_1" diff --git a/src/ModelAPI/Test/TestMovePart2.py b/src/ModelAPI/Test/TestMovePart2.py index 0d546cff2..35c256e8c 100644 --- a/src/ModelAPI/Test/TestMovePart2.py +++ b/src/ModelAPI/Test/TestMovePart2.py @@ -26,12 +26,21 @@ 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 50) Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0, "Faces|Wires") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection(), + 10, + 0, + "Faces|Wires", +) model.do() ### Create Plane_4 and Sketch_2, independent @@ -43,13 +52,22 @@ model.do() ### Create Part_2, an edge on Sketch_2 Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() -Edge_1 = model.addEdge(Part_2_doc, [model.selection("EDGE", "PartSet/Sketch_1/SketchCircle_1_2")], False) +Edge_1 = model.addEdge( + Part_2_doc, [model.selection("EDGE", "PartSet/Sketch_1/SketchCircle_1_2")], False +) model.do() ### Create Part_3, small cylinder on a Sketch_2 Part_3 = model.addPart(partSet) Part_3_doc = Part_3.document() -Extrusion_2 = model.addExtrusion(Part_3_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0, "Faces|Wires") +Extrusion_2 = model.addExtrusion( + Part_3_doc, + [model.selection("FACE", "PartSet/Sketch_1/Face-SketchCircle_1_2r")], + model.selection(), + 10, + 0, + "Faces|Wires", +) model.do() ### Create Part_4, a box, independent @@ -69,23 +87,56 @@ Sketch_3.setVertical(SketchLine_2.result()) Sketch_3.setHorizontal(SketchLine_3.result()) Sketch_3.setVertical(SketchLine_4.result()) model.do() -Extrusion_3 = model.addExtrusion(Part_4_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 0, "Faces|Wires") +Extrusion_3 = model.addExtrusion( + Part_4_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f", + ) + ], + model.selection(), + 10, + 0, + "Faces|Wires", +) model.do() ### Create Placement of Part_4 on the top face of Part_1 -Placement_1 = model.addPlacement(partSet, [model.selection("COMPOUND", "Part_4/")], model.selection("FACE", "Part_4/Extrusion_1_1/From_Face"), model.selection("FACE", "Part_1/Extrusion_1_1/To_Face"), keepSubResults = True) +Placement_1 = model.addPlacement( + partSet, + [model.selection("COMPOUND", "Part_4/")], + model.selection("FACE", "Part_4/Extrusion_1_1/From_Face"), + model.selection("FACE", "Part_1/Extrusion_1_1/To_Face"), + keepSubResults=True, +) ### Create Part_5, revolution Part_5 = model.addPart(partSet) Part_5_doc = Part_5.document() Sketch_4 = model.addSketch(Part_5_doc, model.defaultPlane("XOY")) -SketchCircle_3 = Sketch_4.addCircle(71.54809194299482, -51.10206832217438, 4.892982649360998) +SketchCircle_3 = Sketch_4.addCircle( + 71.54809194299482, -51.10206832217438, 4.892982649360998 +) model.do() -Revolution_1 = model.addRevolution(Part_5_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection("EDGE", "PartSet/OX"), -30, 0) +Revolution_1 = model.addRevolution( + Part_5_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], + model.selection("EDGE", "PartSet/OX"), + -30, + 0, +) model.do() ### Create Placement_2 of Part_5 revolution to Part_3 to face -Placement_2 = model.addPlacement(partSet, [model.selection("COMPOUND", "Part_5/")], model.selection("FACE", "Part_5/Revolution_1_1/From_Face"), model.selection("FACE", "Part_3/Extrusion_1_1/To_Face"), centering = True, keepSubResults = True) +Placement_2 = model.addPlacement( + partSet, + [model.selection("COMPOUND", "Part_5/")], + model.selection("FACE", "Part_5/Revolution_1_1/From_Face"), + model.selection("FACE", "Part_3/Extrusion_1_1/To_Face"), + centering=True, + keepSubResults=True, +) model.end() # Check multiple placement of Part_1, Part_3 and Part_5 after theSketch_2 @@ -94,10 +145,10 @@ aWhatList.append(Part_1.feature()) aWhatList.append(Part_3.feature()) aWhatList.append(Part_5.feature()) anError = model.validateMovement(SketchCircle_2.feature(), aWhatList).strip() -assert(len(anError) == 0) +assert len(anError) == 0 # check also that they cannot be moved after Placement_1 anError = model.validateMovement(Placement_1.feature(), aWhatList).strip() -assert(anError == 'Placement_1 -> Part_1') +assert anError == "Placement_1 -> Part_1" # do movement model.do() partSet.moveFeature(Part_1.feature(), SketchCircle_2.feature()) @@ -106,8 +157,18 @@ partSet.moveFeature(Part_5.feature(), Part_3.feature()) model.end() # check the resulting list of features -aNames = ['Plane_4', 'Sketch_1', 'Part_1', 'Part_3', 'Part_5', 'Part_2', 'Part_4', 'Placement_1', 'Placement_2'] +aNames = [ + "Plane_4", + "Sketch_1", + "Part_1", + "Part_3", + "Part_5", + "Part_2", + "Part_4", + "Placement_1", + "Placement_2", +] for aNameIndex in range(9): - aFeatureName = model.objectToFeature(partSet.object("Features", aNameIndex)).name() - assert(aNames[aNameIndex] == aFeatureName) + aFeatureName = model.objectToFeature(partSet.object("Features", aNameIndex)).name() + assert aNames[aNameIndex] == aFeatureName diff --git a/src/ModelAPI/Test/TestResults.py b/src/ModelAPI/Test/TestResults.py index bf303bef8..8023da8fb 100644 --- a/src/ModelAPI/Test/TestResults.py +++ b/src/ModelAPI/Test/TestResults.py @@ -22,43 +22,44 @@ Cover specific working with the data model results """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * __updated__ = "2016-20-16" aSession = ModelAPI_Session.get() -#========================================================================= +# ========================================================================= # Check getting the initial construction plane by name -#========================================================================= +# ========================================================================= aPartSet = aSession.moduleDocument() aSession.startOperation() aPlaneX = aPartSet.addFeature("Plane") aPlaneX.string("creation_method").setValue("by_general_equation") -aPlaneX.real("A").setValue(1.) -aPlaneX.real("B").setValue(0.) -aPlaneX.real("C").setValue(0.) -aPlaneX.real("D").setValue(0.) -assert(aPlaneX) +aPlaneX.real("A").setValue(1.0) +aPlaneX.real("B").setValue(0.0) +aPlaneX.real("C").setValue(0.0) +aPlaneX.real("D").setValue(0.0) +assert aPlaneX aSession.finishOperation() aSession.startOperation() aColors = aPlaneX.lastResult().data().intArray("Color") -assert(aColors) +assert aColors # default colors, not filled array -assert(aColors.size() == 0) +assert aColors.size() == 0 aColors.setSize(3) aColors.setValue(0, 100) aColors.setValue(1, 200) aColors.setValue(2, 250) -assert(aColors.size() == 3) -assert(aColors.value(0) == 100) -assert(aColors.value(1) == 200) -assert(aColors.value(2) == 250) +assert aColors.size() == 3 +assert aColors.value(0) == 100 +assert aColors.value(1) == 200 +assert aColors.value(2) == 250 aSession.finishOperation() from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestSaveOpen1.py b/src/ModelAPI/Test/TestSaveOpen1.py index ce71b5e50..9fd824637 100644 --- a/src/ModelAPI/Test/TestSaveOpen1.py +++ b/src/ModelAPI/Test/TestSaveOpen1.py @@ -29,21 +29,23 @@ model.end() # check save document in a current folder with TemporaryDirectory() as tmp_dir: - aSession = ModelAPI_Session.get() - aFiles = StringList() - aSession.save(tmp_dir, aFiles) - assert(len(aFiles) == 1) + aSession = ModelAPI_Session.get() + aFiles = StringList() + aSession.save(tmp_dir, aFiles) + assert len(aFiles) == 1 -# check open of the same document - assert(aSession.load(tmp_dir) == False) # error because this document is already opened + # check open of the same document + assert ( + aSession.load(tmp_dir) == False + ) # error because this document is already opened -# close the current document - aSession.closeAll() + # close the current document + aSession.closeAll() -# open again: it must be correct now - assert(aSession.load(tmp_dir)) + # open again: it must be correct now + assert aSession.load(tmp_dir) -# check the created point is opened - partSet = model.moduleDocument() - assert(partSet.size("Features") == 1) - assert(partSet.object("Features", 0).data().name() == Point_name) + # check the created point is opened + partSet = model.moduleDocument() + assert partSet.size("Features") == 1 + assert partSet.object("Features", 0).data().name() == Point_name diff --git a/src/ModelAPI/Test/TestSaveOpen2.py b/src/ModelAPI/Test/TestSaveOpen2.py index b48337be0..5567ddea1 100644 --- a/src/ModelAPI/Test/TestSaveOpen2.py +++ b/src/ModelAPI/Test/TestSaveOpen2.py @@ -26,45 +26,65 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")]) -Field_1 = model.addField(Part_1_doc, 1, "DOUBLE", 1, ["Comp 1"], [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]")]) +Group_1 = model.addGroup( + Part_1_doc, + [ + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), + ], +) +Field_1 = model.addField( + Part_1_doc, + 1, + "DOUBLE", + 1, + ["Comp 1"], + [ + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), + model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), + ], +) Field_1.addStep(0, 5, [[0], [3], [4]]) model.do() -Translation_1 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("EDGE", "OY"), 20) +Translation_1 = model.addTranslation( + partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("EDGE", "OY"), 20 +) model.end() # check save document in a current folder with TemporaryDirectory() as tmp_dir: - aSession = ModelAPI_Session.get() - aFiles = StringList() - aSession.save(tmp_dir, aFiles) - assert(len(aFiles) == 3) + aSession = ModelAPI_Session.get() + aFiles = StringList() + aSession.save(tmp_dir, aFiles) + assert len(aFiles) == 3 - # check open of the same document - assert(aSession.load(tmp_dir) == False) # error because this document is already opened + # check open of the same document + assert ( + aSession.load(tmp_dir) == False + ) # error because this document is already opened - # close the current document - aSession.closeAll() + # close the current document + aSession.closeAll() - # open again: it must be correct now - assert(aSession.load(tmp_dir)) + # open again: it must be correct now + assert aSession.load(tmp_dir) - # activate the Part of session - model.begin() - partSet = model.moduleDocument() - assert(partSet.size("Features") == 2) - aPart = objectToFeature(partSet.object("Features", 0)) - aPartResult = modelAPI_ResultPart(aPart.results()[0]) - aPartResult.activate() - aPartDoc = aPartResult.partDoc() - aSession.setActiveDocument(aPartDoc, True) - model.do() - # check the field result data - aFieldFeature = aPartDoc.objectByName("Features", "Field_1") - aFieldResult = modelAPI_ResultField(objectToFeature(aFieldFeature).results()[0]) - assert(aFieldResult.textLine(0) == "5") - aSession.setActiveDocument(partSet, True) - model.do() - aTranslation = objectToFeature(partSet.objectByName("Features", "Translation_1")) - partSet.setCurrentFeature(aTranslation, True) - model.end() + # activate the Part of session + model.begin() + partSet = model.moduleDocument() + assert partSet.size("Features") == 2 + aPart = objectToFeature(partSet.object("Features", 0)) + aPartResult = modelAPI_ResultPart(aPart.results()[0]) + aPartResult.activate() + aPartDoc = aPartResult.partDoc() + aSession.setActiveDocument(aPartDoc, True) + model.do() + # check the field result data + aFieldFeature = aPartDoc.objectByName("Features", "Field_1") + aFieldResult = modelAPI_ResultField(objectToFeature(aFieldFeature).results()[0]) + assert aFieldResult.textLine(0) == "5" + aSession.setActiveDocument(partSet, True) + model.do() + aTranslation = objectToFeature(partSet.objectByName("Features", "Translation_1")) + partSet.setCurrentFeature(aTranslation, True) + model.end() diff --git a/src/ModelAPI/Test/TestSelectionCircleCenter.py b/src/ModelAPI/Test/TestSelectionCircleCenter.py index 0c9de807b..fa1d7a096 100644 --- a/src/ModelAPI/Test/TestSelectionCircleCenter.py +++ b/src/ModelAPI/Test/TestSelectionCircleCenter.py @@ -30,56 +30,114 @@ SketchLine_1 = Sketch_1.addLine(15, 10, -10, 10) SketchLine_2 = Sketch_1.addLine(-10, 10, -10, -10) SketchLine_3 = Sketch_1.addLine(-10, -10, 20, -10) SketchLine_4 = Sketch_1.addLine(20, -10, 20, 5) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_2") -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3") -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_4") 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(15, 5, 20, 5, 15, 10, False) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_4.endPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_4.endPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.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_4.result()) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_1.result() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_4.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 20) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_3.result(), 30) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 5) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchProjection_1.setName("SketchProjection_3") SketchProjection_1.result().setName("SketchProjection_3") SketchPoint_1 = SketchProjection_1.createdFeature() SketchPoint_1.setName("SketchPoint_3") SketchPoint_1.result().setName("SketchPoint_3") -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_2.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_2.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_2.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_2.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 10 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchArc_1_2f")], model.selection(), 10, 0) -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]")], 10) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Fillet_1_1/MF:Fillet&Extrusion_1_1/To_Face")) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchArc_1_2f", + ) + ], + model.selection(), + 10, + 0, +) +Fillet_1 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]", + ) + ], + 10, +) +Sketch_2 = model.addSketch( + Part_1_doc, model.selection("FACE", "Fillet_1_1/MF:Fillet&Extrusion_1_1/To_Face") +) SketchLine_5 = Sketch_2.addLine(15, 5, 0, 0) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Fillet_1_1/MF:Fillet&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2]__cc"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Fillet_1_1/MF:Fillet&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2]__cc", + ), + False, +) SketchProjection_2.setName("SketchProjection_1") SketchProjection_2.result().setName("SketchProjection_1") SketchPoint_2 = SketchProjection_2.createdFeature() SketchPoint_2.setName("SketchPoint_1") SketchPoint_2.result().setName("SketchPoint_1") -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchPoint_2.result()) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_5.startPoint(), SketchPoint_2.result() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7") -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected][Fillet_1_1/MF:Fillet&Extrusion_1_1/To_Face]__cc"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected][Fillet_1_1/MF:Fillet&Extrusion_1_1/To_Face]__cc", + ), + False, +) SketchProjection_3.setName("SketchProjection_2") SketchProjection_3.result().setName("SketchProjection_2") SketchPoint_3 = SketchProjection_3.createdFeature() SketchPoint_3.setName("SketchPoint_2") SketchPoint_3.result().setName("SketchPoint_2") -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchPoint_3.result()) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchPoint_3.result() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8") model.end() # check that the second line-point was created on the point, not arc -assert(len(SketchPoint_3.feature().results()) == 1) -assert(SketchPoint_3.feature().firstResult().shape().isVertex()) +assert len(SketchPoint_3.feature().results()) == 1 +assert SketchPoint_3.feature().firstResult().shape().isVertex() diff --git a/src/ModelAPI/Test/TestSelectionInPart.py b/src/ModelAPI/Test/TestSelectionInPart.py index 0adaca14d..d2cad36bb 100644 --- a/src/ModelAPI/Test/TestSelectionInPart.py +++ b/src/ModelAPI/Test/TestSelectionInPart.py @@ -42,99 +42,260 @@ SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Origin"), False) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result()) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_1.result() +) SketchLine_5 = Sketch_1.addLine(-8, 0.2, -7.8, 0) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_5.endPoint() +) SketchLine_6 = Sketch_1.addLine(7.8, 0, 8, 0.2) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_6.endPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_6.endPoint() +) SketchLine_7 = Sketch_1.addLine(-8, 15.8, -7.8, 16) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_7.endPoint() +) SketchLine_8 = Sketch_1.addLine(7.8, 16, 8, 15.8) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_8.endPoint()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_3.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_6.result()) -SketchConstraintEqual_5 = Sketch_1.setEqual(SketchLine_6.result(), SketchLine_7.result()) -SketchConstraintEqual_6 = Sketch_1.setEqual(SketchLine_7.result(), SketchLine_8.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_5.startPoint(), SketchLine_4.result(), "ShaftSize", True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_1.endPoint(), SketchLine_3.result(), "ShaftSize", True) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_5.startPoint(), SketchLine_1.endPoint(), "ShaftChamfer") -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_1.endPoint(), SketchLine_5.startPoint(), "ShaftChamfer") +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_4.startPoint(), SketchLine_8.endPoint() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_3.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_6.result() +) +SketchConstraintEqual_5 = Sketch_1.setEqual( + SketchLine_6.result(), SketchLine_7.result() +) +SketchConstraintEqual_6 = Sketch_1.setEqual( + SketchLine_7.result(), SketchLine_8.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_5.startPoint(), SketchLine_4.result(), "ShaftSize", True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_1.endPoint(), SketchLine_3.result(), "ShaftSize", True +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_5.startPoint(), SketchLine_1.endPoint(), "ShaftChamfer" +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_1.endPoint(), SketchLine_5.startPoint(), "ShaftChamfer" +) model.do() Part_1 = model.addPart(partSet) Part_1.setName("TurnShaft") Part_1.result().setName("TurnShaft") Part_1.result().setColor(75, 75, 75) Part_1_doc = Part_1.document() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchLine_6f-SketchLine_4r-SketchLine_8r-SketchLine_3r-SketchLine_7r-SketchLine_2r-SketchLine_5f-SketchLine_1r")], model.selection(), 100, 0) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_4"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")]) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_2")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/Sketch_1/SketchLine_7"), True) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "PartSet/Sketch_1/Face-SketchLine_6f-SketchLine_4r-SketchLine_8r-SketchLine_3r-SketchLine_7r-SketchLine_2r-SketchLine_5f-SketchLine_1r", + ) + ], + model.selection(), + 100, + 0, +) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [], + model.selection(), + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_4" + ), + 0, + model.selection(), + 0, + [model.selection("SOLID", "Extrusion_1_1")], +) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection( + "FACE", "Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_2" + ), +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/Sketch_1/SketchLine_7"), True +) SketchLine_9 = SketchProjection_2.createdFeature() SketchLine_10 = Sketch_2.addLine(0, 15.8, 0.2, 16) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_9).startPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchAPI_Line(SketchLine_9).startPoint(), SketchLine_10.startPoint() +) SketchLine_11 = Sketch_2.addLine(0.2, 16, 0, 16) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_9).endPoint(), SketchLine_11.endPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchAPI_Line(SketchLine_9).endPoint(), SketchLine_11.endPoint() +) SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_11.result()) -SketchConstraintEqual_7 = Sketch_2.setEqual(SketchLine_9.result(), SketchLine_11.result()) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/Sketch_1/SketchLine_5"), True) +SketchConstraintEqual_7 = Sketch_2.setEqual( + SketchLine_9.result(), SketchLine_11.result() +) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/Sketch_1/SketchLine_5"), True +) SketchLine_12 = SketchProjection_3.createdFeature() SketchLine_13 = Sketch_2.addLine(0, 0.2, 0.2, 0) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_13.startPoint() +) SketchLine_14 = Sketch_2.addLine(0.2, 0, 0, 0) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_12).endPoint(), SketchLine_14.endPoint()) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchAPI_Line(SketchLine_12).endPoint(), SketchLine_14.endPoint() +) SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_14.result()) -SketchConstraintEqual_8 = Sketch_2.setEqual(SketchLine_12.result(), SketchLine_14.result()) +SketchConstraintEqual_8 = Sketch_2.setEqual( + SketchLine_12.result(), SketchLine_14.result() +) ExtrusionCut_1.setNestedSketch(Sketch_2) -ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&PartSet/Sketch_1/SketchLine_1"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")]) -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&PartSet/Sketch_1/SketchLine_3")) -SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&PartSet/Sketch_1/SketchLine_3][ExtrusionCut_1_1/Generated_Face&Sketch_1/SketchLine_2]"), False) +ExtrusionCut_2 = model.addExtrusionCut( + Part_1_doc, + [], + model.selection(), + model.selection( + "FACE", "ExtrusionCut_1_1/Modified_Face&PartSet/Sketch_1/SketchLine_1" + ), + 0, + model.selection(), + 0, + [model.selection("SOLID", "ExtrusionCut_1_1")], +) +Sketch_3 = model.addSketch( + Part_1_doc, + model.selection( + "FACE", "ExtrusionCut_1_1/Modified_Face&PartSet/Sketch_1/SketchLine_3" + ), +) +SketchProjection_4 = Sketch_3.addProjection( + model.selection( + "EDGE", + "[ExtrusionCut_1_1/Modified_Face&PartSet/Sketch_1/SketchLine_3][ExtrusionCut_1_1/Generated_Face&Sketch_1/SketchLine_2]", + ), + False, +) SketchLine_15 = SketchProjection_4.createdFeature() -SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "PartSet/Sketch_1/SketchLine_2_EndVertex"), False) +SketchProjection_5 = Sketch_3.addProjection( + model.selection("VERTEX", "PartSet/Sketch_1/SketchLine_2_EndVertex"), False +) SketchPoint_2 = SketchProjection_5.createdFeature() SketchLine_16 = Sketch_3.addLine(0, -8, 0.2, -8) -SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_15 = Sketch_3.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_16.startPoint() +) SketchLine_17 = Sketch_3.addLine(0.2, -8, 0, -7.8) -SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_16 = Sketch_3.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) SketchLine_18 = Sketch_3.addLine(0, -7.8, 0, -8) -SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) -SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_18.endPoint()) +SketchConstraintCoincidence_17 = Sketch_3.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) +SketchConstraintCoincidence_18 = Sketch_3.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_18.endPoint() +) SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_16.result()) SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_18.result()) -SketchConstraintEqual_9 = Sketch_3.setEqual(SketchLine_16.result(), SketchLine_18.result()) -SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchLine_15.result()) -SketchProjection_6 = Sketch_3.addProjection(model.selection("VERTEX", "PartSet/Sketch_1/SketchLine_8_EndVertex"), False) +SketchConstraintEqual_9 = Sketch_3.setEqual( + SketchLine_16.result(), SketchLine_18.result() +) +SketchConstraintCoincidence_19 = Sketch_3.setCoincident( + SketchLine_16.endPoint(), SketchLine_15.result() +) +SketchProjection_6 = Sketch_3.addProjection( + model.selection("VERTEX", "PartSet/Sketch_1/SketchLine_8_EndVertex"), False +) SketchPoint_3 = SketchProjection_6.createdFeature() SketchLine_19 = Sketch_3.addLine(0, 8, 0, 7.8) -SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_19.startPoint() +) SketchLine_20 = Sketch_3.addLine(0, 7.8, 0.2, 8) -SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_21 = Sketch_3.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) SketchLine_21 = Sketch_3.addLine(0.2, 8, 0, 8) -SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) -SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_21.endPoint()) +SketchConstraintCoincidence_22 = Sketch_3.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.startPoint() +) +SketchConstraintCoincidence_23 = Sketch_3.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_21.endPoint() +) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_19.result()) SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_21.result()) -SketchConstraintEqual_10 = Sketch_3.setEqual(SketchLine_19.result(), SketchLine_21.result()) -SketchConstraintCoincidence_24 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_15.result()) +SketchConstraintEqual_10 = Sketch_3.setEqual( + SketchLine_19.result(), SketchLine_21.result() +) +SketchConstraintCoincidence_24 = Sketch_3.setCoincident( + SketchLine_20.endPoint(), SketchLine_15.result() +) ExtrusionCut_2.setNestedSketch(Sketch_3) -ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 3, [model.selection("SOLID", "ExtrusionCut_2_1")]) -Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&PartSet/Sketch_1/SketchLine_3")) +ExtrusionCut_3 = model.addExtrusionCut( + Part_1_doc, + [], + model.selection(), + 0, + 3, + [model.selection("SOLID", "ExtrusionCut_2_1")], +) +Sketch_4 = model.addSketch( + Part_1_doc, + model.selection( + "FACE", "ExtrusionCut_1_1/Modified_Face&PartSet/Sketch_1/SketchLine_3" + ), +) SketchCircle_1 = Sketch_4.addCircle(10, 0, 5) -SketchProjection_7 = Sketch_4.addProjection(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_2]"), False) +SketchProjection_7 = Sketch_4.addProjection( + model.selection( + "EDGE", + "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_2]", + ), + False, +) SketchLine_22 = SketchProjection_7.createdFeature() SketchLine_23 = Sketch_4.addLine(10, 0, 0, 0) SketchLine_23.setAuxiliary(True) -SketchConstraintCoincidence_25 = Sketch_4.setCoincident(SketchCircle_1.center(), SketchLine_23.startPoint()) -SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchLine_23.endPoint(), SketchLine_22.result()) -SketchConstraintMiddle_2 = Sketch_4.setMiddlePoint(SketchLine_23.endPoint(), SketchLine_22.result()) -SketchConstraintPerpendicular_1 = Sketch_4.setPerpendicular(SketchLine_23.result(), SketchLine_22.result()) +SketchConstraintCoincidence_25 = Sketch_4.setCoincident( + SketchCircle_1.center(), SketchLine_23.startPoint() +) +SketchConstraintCoincidence_26 = Sketch_4.setCoincident( + SketchLine_23.endPoint(), SketchLine_22.result() +) +SketchConstraintMiddle_2 = Sketch_4.setMiddlePoint( + SketchLine_23.endPoint(), SketchLine_22.result() +) +SketchConstraintPerpendicular_1 = Sketch_4.setPerpendicular( + SketchLine_23.result(), SketchLine_22.result() +) SketchConstraintRadius_1 = Sketch_4.setRadius(SketchCircle_1.results()[1], 5) SketchConstraintLength_1 = Sketch_4.setLength(SketchLine_23.result(), 10) ExtrusionCut_3.setNestedSketch(Sketch_4) @@ -144,16 +305,33 @@ Part_2.setName("Stamp") Part_2.result().setName("Stamp") Part_2_doc = Part_2.document() Sketch_5 = model.addSketch(Part_2_doc, model.defaultPlane("XOZ")) -SketchProjection_8 = Sketch_5.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_8 = Sketch_5.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_4 = SketchProjection_8.createdFeature() SketchCircle_2 = Sketch_5.addCircle(0, 0, 5) -SketchConstraintCoincidence_27 = Sketch_5.setCoincident(SketchPoint_4.result(), SketchCircle_2.center()) +SketchConstraintCoincidence_27 = Sketch_5.setCoincident( + SketchPoint_4.result(), SketchCircle_2.center() +) SketchConstraintRadius_2 = Sketch_5.setRadius(SketchCircle_2.results()[1], 5) model.do() -Extrusion_2 = model.addExtrusion(Part_2_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0) +Extrusion_2 = model.addExtrusion( + Part_2_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection(), + 10, + 0, +) model.do() -Placement_1 = model.addPlacement(partSet, [model.selection("COMPOUND", "Stamp/")], model.selection("FACE", "Stamp/Extrusion_1_1/To_Face"), model.selection("FACE", "TurnShaft/ExtrusionCut_3_1/From_Face"), False, True) +Placement_1 = model.addPlacement( + partSet, + [model.selection("COMPOUND", "Stamp/")], + model.selection("FACE", "Stamp/Extrusion_1_1/To_Face"), + model.selection("FACE", "TurnShaft/ExtrusionCut_3_1/From_Face"), + False, + True, +) model.end() # check that names of selection are exported and imported correctly -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestSelectionInitialization.py b/src/ModelAPI/Test/TestSelectionInitialization.py index d5222faa3..6df0a91ec 100644 --- a/src/ModelAPI/Test/TestSelectionInitialization.py +++ b/src/ModelAPI/Test/TestSelectionInitialization.py @@ -31,25 +31,25 @@ model.end() # save document in a current folder with TemporaryDirectory() as tmp_dir: - aSession = ModelAPI_Session.get() - aFiles = StringList() - aSession.save(tmp_dir, aFiles) - # close the current document - aSession.closeAll() - # open the saved document - assert(aSession.load(tmp_dir)) + aSession = ModelAPI_Session.get() + aFiles = StringList() + aSession.save(tmp_dir, aFiles) + # close the current document + aSession.closeAll() + # open the saved document + assert aSession.load(tmp_dir) - # activate the Part of session - model.begin() - partSet = model.moduleDocument() - assert(partSet.size("Features") == 1) - aPart = objectToFeature(partSet.object("Features", 0)) - aPartResult = modelAPI_ResultPart(aPart.results()[0]) - aPartResult.activate() - aPartDoc = aPartResult.partDoc() - aSession.setActiveDocument(aPartDoc, True) - model.end() + # activate the Part of session + model.begin() + partSet = model.moduleDocument() + assert partSet.size("Features") == 1 + aPart = objectToFeature(partSet.object("Features", 0)) + aPartResult = modelAPI_ResultPart(aPart.results()[0]) + aPartResult.activate() + aPartDoc = aPartResult.partDoc() + aSession.setActiveDocument(aPartDoc, True) + model.end() - # check the sphere location (it should not be "Origin" - default one) - aSphere = objectToFeature(aPartDoc.objectByName("Features", "Sphere_1")) - assert(aSphere.selection("center_point").namingName() == "Point_1") + # check the sphere location (it should not be "Origin" - default one) + aSphere = objectToFeature(aPartDoc.objectByName("Features", "Sphere_1")) + assert aSphere.selection("center_point").namingName() == "Point_1" diff --git a/src/ModelAPI/Test/TestSelectionRestore.py b/src/ModelAPI/Test/TestSelectionRestore.py index c87b737b4..6d5b8dfb0 100644 --- a/src/ModelAPI/Test/TestSelectionRestore.py +++ b/src/ModelAPI/Test/TestSelectionRestore.py @@ -36,20 +36,36 @@ model.addParameter(Part_1_doc, "ep_dalles", "0.12") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0.275, 3.325, -0.375, 3.325) SketchLine_2 = Sketch_1.addLine(-0.375, 3.325, -0.375, -0.325) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(-0.375, -0.325, 4.275, -0.325) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(4.275, -0.325, 4.275, 1.325) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(4.275, 1.325, 3.625, 1.325) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(3.625, 1.325, 3.625, 0.325) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(3.625, 0.325, 0.275, 0.3250000000000001) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(0.275, 0.3250000000000001, 0.275, 3.325) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.endPoint()) +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_1.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_3.result()) @@ -62,23 +78,52 @@ 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", False) +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", False) +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", False) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_1.result()) +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_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")) +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) SketchLine_14 = Sketch_2.addLine(2.26, -1.69, 2.26, -2.31) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_12.result()) SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_13.result()) @@ -86,35 +131,80 @@ SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_14.result()) 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", False) +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", False +) SketchConstraintDistance_4.setName("SketchConstraintDistance_6") -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_12.result(), "0.21+ep_poteau/2", False) +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"), False) +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"), False) +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", False) +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", False) +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_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")) +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") SketchLine_18 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_18.setName("SketchLine_16") SketchLine_18.result().setName("SketchLine_16") -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_17.startPoint(), SketchLine_18.result()) -SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchLine_18.result()) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_17.startPoint(), SketchLine_18.result() +) +SketchConstraintCoincidence_14 = Sketch_3.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.result() +) SketchLine_19 = Sketch_3.addLine(0, 1.2, 0, 0) SketchLine_19.setName("SketchLine_17") SketchLine_19.result().setName("SketchLine_17") -SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_19.startPoint(), SketchLine_18.result()) -SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchLine_18.result()) +SketchConstraintCoincidence_15 = Sketch_3.setCoincident( + SketchLine_19.startPoint(), SketchLine_18.result() +) +SketchConstraintCoincidence_16 = Sketch_3.setCoincident( + SketchLine_19.endPoint(), SketchLine_18.result() +) SketchLine_20 = Sketch_3.addLine(0, 0, 0.95, 0) SketchLine_20.setName("SketchLine_18") SketchLine_20.result().setName("SketchLine_18") @@ -124,20 +214,37 @@ SketchLine_21.result().setName("SketchLine_19") SketchLine_22 = Sketch_3.addLine(2.525000000000001, 0, 3.975000000000001, 0) SketchLine_22.setName("SketchLine_20") SketchLine_22.result().setName("SketchLine_20") -SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchLine_21.result()) -SketchConstraintCoincidence_18 = 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_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]")) +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_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") +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") SketchConstraintLength_8.setName("SketchConstraintLength_7") @@ -147,104 +254,386 @@ SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_23.result()) 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", False) +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&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]")) +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, False) +SketchConstraintDistance_9 = Sketch_3.setDistance( + SketchLine_17.startPoint(), SketchLine_26.result(), 0.375, False +) SketchConstraintDistance_9.setName("SketchConstraintDistance_12") model.do() -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_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")) +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&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()) +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_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()) +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_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()) +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_objects = [model.selection("EDGE", "Sketch_4/SketchLine_26"), model.selection("EDGE", "Sketch_4/SketchLine_27"), model.selection("EDGE", "Sketch_4/SketchLine_28")] +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")) +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&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()) +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_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()) +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_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()) +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_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()) +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_37 = Sketch_5.setCoincident(SketchLine_34.startPoint(), SketchLine_33.result()) -SketchLine_35 = Sketch_5.addLine(2.075000000000001, 1.905974842767296, 2.075000000000001, 0) +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_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()) +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", False) +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 = 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/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]] +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_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]] +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/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_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")] +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_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) # create groups model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) @@ -255,10 +644,11 @@ EpVoiles.setValue(0.18) model.do() from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() for i in range(Part_1_doc.size("Groups")): - GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", i))) - assert(aFactory.validate(GroupFeature) == False) + GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", i))) + assert aFactory.validate(GroupFeature) == False # move edges back, so, intersection re-appeared, so, groups should become valid @@ -267,5 +657,5 @@ EpVoiles.setValue(0.17) model.end() for i in range(Part_1_doc.size("Groups")): - GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", i))) - assert(aFactory.validate(GroupFeature)) + GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", i))) + assert aFactory.validate(GroupFeature) diff --git a/src/ModelAPI/Test/TestSelectionScope.py b/src/ModelAPI/Test/TestSelectionScope.py index 4ec61a358..8a19503ce 100644 --- a/src/ModelAPI/Test/TestSelectionScope.py +++ b/src/ModelAPI/Test/TestSelectionScope.py @@ -27,53 +27,132 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() lenParam = model.addParameter(Part_1_doc, "len", "50") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) -SketchLine_1 = Sketch_1.addLine(33.62835038363171, 25.06143222506393, -25.8286189258312, 25.06143222506393) -SketchLine_2 = Sketch_1.addLine(-25.8286189258312, 25.06143222506393, -25.8286189258312, -21.22549872122762) -SketchLine_3 = Sketch_1.addLine(-25.8286189258312, -21.22549872122762, 33.62835038363171, -21.22549872122762) -SketchLine_4 = Sketch_1.addLine(33.62835038363171, -21.22549872122762, 33.62835038363171, 25.06143222506393) -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()) +SketchLine_1 = Sketch_1.addLine( + 33.62835038363171, 25.06143222506393, -25.8286189258312, 25.06143222506393 +) +SketchLine_2 = Sketch_1.addLine( + -25.8286189258312, 25.06143222506393, -25.8286189258312, -21.22549872122762 +) +SketchLine_3 = Sketch_1.addLine( + -25.8286189258312, -21.22549872122762, 33.62835038363171, -21.22549872122762 +) +SketchLine_4 = Sketch_1.addLine( + 33.62835038363171, -21.22549872122762, 33.62835038363171, 25.06143222506393 +) +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(), 10, 0) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 5, 5, [model.selection("SOLID", "Extrusion_1_1")]) +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) Sketch_2_dirx = GeomAPI_Dir(1, 0, 0) -Sketch_2 = model.addSketch(Part_1_doc, GeomAPI_Ax3(Sketch_2_origin, Sketch_2_dirx, Sketch_2_norm)) -SketchLine_5 = Sketch_2.addLine(8.950511508951408, 45.06143222506392, -10.86847826086957, 45.06143222506392) -SketchLine_6 = Sketch_2.addLine(-10.86847826086957, 45.06143222506392, -10.86847826086957, -4.938567774936073) -SketchLine_7 = Sketch_2.addLine(-10.86847826086957, -4.938567774936073, 8.950511508951408, -4.938567774936073) -SketchLine_8 = Sketch_2.addLine(8.950511508951408, -4.938567774936073, 8.950511508951408, 45.06143222506392) -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()) +Sketch_2 = model.addSketch( + Part_1_doc, GeomAPI_Ax3(Sketch_2_origin, Sketch_2_dirx, Sketch_2_norm) +) +SketchLine_5 = Sketch_2.addLine( + 8.950511508951408, 45.06143222506392, -10.86847826086957, 45.06143222506392 +) +SketchLine_6 = Sketch_2.addLine( + -10.86847826086957, 45.06143222506392, -10.86847826086957, -4.938567774936073 +) +SketchLine_7 = Sketch_2.addLine( + -10.86847826086957, -4.938567774936073, 8.950511508951408, -4.938567774936073 +) +SketchLine_8 = Sketch_2.addLine( + 8.950511508951408, -4.938567774936073, 8.950511508951408, 45.06143222506392 +) +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()) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_8.result(), "len") -SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"), 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) +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/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) +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) model.do() # update selection of cylinder base points -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.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 -assert(Cylinder_1.feature().results().size() == 1) -assert(Cylinder_2.feature().results().size() == 1) +assert Cylinder_1.feature().results().size() == 1 +assert Cylinder_2.feature().results().size() == 1 diff --git a/src/ModelAPI/Test/TestSelectorShell.py b/src/ModelAPI/Test/TestSelectorShell.py index 4b2fd161f..a6b6764a0 100644 --- a/src/ModelAPI/Test/TestSelectorShell.py +++ b/src/ModelAPI/Test/TestSelectorShell.py @@ -31,12 +31,15 @@ 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()) -aGroup.selectionList("group_list").setSelectionType("SHELL") # to compute the shape for the whole result selection correctly +aGroup.selectionList("group_list").setSelectionType( + "SHELL" +) # to compute the shape for the whole result selection correctly model.end() # check that the resulting group is correct from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(aGroup)) +assert aFactory.validate(aGroup) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestUndoRedo.py b/src/ModelAPI/Test/TestUndoRedo.py index 68c7abc09..b6c3a194e 100644 --- a/src/ModelAPI/Test/TestUndoRedo.py +++ b/src/ModelAPI/Test/TestUndoRedo.py @@ -22,33 +22,34 @@ from GeomDataAPI import * aSession = ModelAPI_Session.get() aDoc = aSession.moduleDocument() -assert(not aSession.canUndo()) -assert(not aSession.canRedo()) +assert not aSession.canUndo() +assert not aSession.canRedo() aSession.startOperation() aFeature = aDoc.addFeature("Point") -geomDataAPI_Point(aFeature.attribute("point3d")).setValue(1., -1., 0.) +geomDataAPI_Point(aFeature.attribute("point3d")).setValue(1.0, -1.0, 0.0) aFeature.string("creation_method").setValue("by_xyz") aFeatureName = aFeature.name() # "2" is because Origin is the first point -assert(aFeatureName == "Point_2") +assert aFeatureName == "Point_2" aFeature.execute() aSession.finishOperation() -assert(aDoc.size("Construction") == 8) -assert(aSession.canUndo()) -assert(not aSession.canRedo()) +assert aDoc.size("Construction") == 8 +assert aSession.canUndo() +assert not aSession.canRedo() aSession.undo() -assert(aDoc.size("Construction") == 7) -assert(not aSession.canUndo()) -assert(aSession.canRedo()) +assert aDoc.size("Construction") == 7 +assert not aSession.canUndo() +assert aSession.canRedo() aSession.redo() -assert(aDoc.size("Construction") == 8) -assert(aSession.canUndo()) -assert(not aSession.canRedo()) +assert aDoc.size("Construction") == 8 +assert aSession.canUndo() +assert not aSession.canRedo() from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/ModelAPI/Test/TestWeakNaming2125.py b/src/ModelAPI/Test/TestWeakNaming2125.py index a8cd1a32f..9421c1646 100644 --- a/src/ModelAPI/Test/TestWeakNaming2125.py +++ b/src/ModelAPI/Test/TestWeakNaming2125.py @@ -26,36 +26,119 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 207.1440202435477) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchCircle_2 = Sketch_1.addCircle(0, 0, 103.3027146966417) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchCircle_2.center()) +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) +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")) -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()) -SketchConstraintTangent_1 = Sketch_2.setTangent(SketchCircle_4.results()[1], SketchArc_1.results()[1]) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchArc_1.center(), SketchCircle_3.results()[1]) -SketchArc_2 = Sketch_2.addArc(0, 0, 22.73963059863011, 100.7688447087372, -98.26117835861152, -31.87776170424295, False) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchCircle_3.result(), SketchArc_2.center()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchArc_1.results()[1], SketchArc_2.endPoint()) +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() +) +SketchConstraintTangent_1 = Sketch_2.setTangent( + SketchCircle_4.results()[1], SketchArc_1.results()[1] +) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchArc_1.center(), SketchCircle_3.results()[1] +) +SketchArc_2 = Sketch_2.addArc( + 0, + 0, + 22.73963059863011, + 100.7688447087372, + -98.26117835861152, + -31.87776170424295, + False, +) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchCircle_3.result(), SketchArc_2.center() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchArc_1.startPoint(), SketchArc_2.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/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/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchCircle_1_2&weak_name_2]"), False) +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/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/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]) +SketchConstraintCoincidence_10 = Sketch_3.setCoincident( + SketchArc_3.endPoint(), SketchArc_4.results()[1] +) model.do() model.do() model.end() from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Sketch_3.feature())) +assert aFactory.validate(Sketch_3.feature()) diff --git a/src/ModelAPI/Test/TestWeakNaming2222.py b/src/ModelAPI/Test/TestWeakNaming2222.py index 8c40dd43a..57ac2fb2d 100644 --- a/src/ModelAPI/Test/TestWeakNaming2222.py +++ b/src/ModelAPI/Test/TestWeakNaming2222.py @@ -32,20 +32,36 @@ model.addParameter(Part_1_doc, "ep_dalles", "0.12") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0.275, 3.325, -0.375, 3.325) SketchLine_2 = Sketch_1.addLine(-0.375, 3.325, -0.375, -0.325) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(-0.375, -0.325, 4.275, -0.325) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(4.275, -0.325, 4.275, 1.325) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(4.275, 1.325, 3.625, 1.325) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(3.625, 1.325, 3.625, 0.325) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(3.625, 0.325, 0.275, 0.3250000000000001) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(0.275, 0.3250000000000001, 0.275, 3.325) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.endPoint()) +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_1.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_3.result()) @@ -58,23 +74,52 @@ 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", False) +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", False) +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", False) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_1.result()) +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_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")) +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) SketchLine_14 = Sketch_2.addLine(2.26, -1.69, 2.26, -2.31) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_12.result()) SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_13.result()) @@ -82,35 +127,80 @@ SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_14.result()) 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", False) +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", False +) SketchConstraintDistance_4.setName("SketchConstraintDistance_6") -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_12.result(), "0.21+ep_poteau/2", False) +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"), False) +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"), False) +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", False) +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", False) +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_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")) +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") SketchLine_18 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_18.setName("SketchLine_16") SketchLine_18.result().setName("SketchLine_16") -SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_17.startPoint(), SketchLine_18.result()) -SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchLine_18.result()) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_17.startPoint(), SketchLine_18.result() +) +SketchConstraintCoincidence_14 = Sketch_3.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.result() +) SketchLine_19 = Sketch_3.addLine(0, 1.2, 0, 0) SketchLine_19.setName("SketchLine_17") SketchLine_19.result().setName("SketchLine_17") -SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_19.startPoint(), SketchLine_18.result()) -SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchLine_18.result()) +SketchConstraintCoincidence_15 = Sketch_3.setCoincident( + SketchLine_19.startPoint(), SketchLine_18.result() +) +SketchConstraintCoincidence_16 = Sketch_3.setCoincident( + SketchLine_19.endPoint(), SketchLine_18.result() +) SketchLine_20 = Sketch_3.addLine(0, 0, 0.95, 0) SketchLine_20.setName("SketchLine_18") SketchLine_20.result().setName("SketchLine_18") @@ -120,20 +210,37 @@ SketchLine_21.result().setName("SketchLine_19") SketchLine_22 = Sketch_3.addLine(2.525000000000001, 0, 3.975000000000001, 0) SketchLine_22.setName("SketchLine_20") SketchLine_22.result().setName("SketchLine_20") -SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchLine_21.result()) -SketchConstraintCoincidence_18 = 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_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]")) +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_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") +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") SketchConstraintLength_8.setName("SketchConstraintLength_7") @@ -143,104 +250,386 @@ SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_23.result()) 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", False) +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&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]")) +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, False) +SketchConstraintDistance_9 = Sketch_3.setDistance( + SketchLine_17.startPoint(), SketchLine_26.result(), 0.375, False +) SketchConstraintDistance_9.setName("SketchConstraintDistance_12") model.do() -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_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")) +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&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()) +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_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()) +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_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()) +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_objects = [model.selection("EDGE", "Sketch_4/SketchLine_26"), model.selection("EDGE", "Sketch_4/SketchLine_27"), model.selection("EDGE", "Sketch_4/SketchLine_28")] +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")) +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&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()) +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_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()) +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_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()) +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_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()) +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_37 = Sketch_5.setCoincident(SketchLine_34.startPoint(), SketchLine_33.result()) -SketchLine_35 = Sketch_5.addLine(2.075000000000001, 1.905974842767296, 2.075000000000001, 0) +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_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()) +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", False) +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 = 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/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]] +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_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]] +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/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_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")] +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_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) diff --git a/src/ModelAPI/Test/TestWeakNaming2245.py b/src/ModelAPI/Test/TestWeakNaming2245.py index d9f253b07..1c2dd097e 100644 --- a/src/ModelAPI/Test/TestWeakNaming2245.py +++ b/src/ModelAPI/Test/TestWeakNaming2245.py @@ -24,20 +24,46 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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/OZ"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_1 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 0, 39.7470266529203, 0, -39.7470266529203, 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(SketchArc_1.endPoint(), SketchLine_1.result()) +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( + SketchArc_1.endPoint(), SketchLine_1.result() +) SketchLine_2 = Sketch_1.addLine(0, -39.7470266529203, 0, 39.7470266529203) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.endPoint()) +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("COMPOUND", "Sketch_1")], model.selection("EDGE", "PartSet/OZ"), 360, 0) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Revolution_1_1"), model.selection("FACE", "PartSet/XOY")]) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection("EDGE", "PartSet/OZ"), + 360, + 0, +) +Partition_1 = model.addPartition( + Part_1_doc, + [ + model.selection("SOLID", "Revolution_1_1"), + model.selection("FACE", "PartSet/XOY"), + ], +) model.do() model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2247.py b/src/ModelAPI/Test/TestWeakNaming2247.py index ad649f3fe..28e453553 100644 --- a/src/ModelAPI/Test/TestWeakNaming2247.py +++ b/src/ModelAPI/Test/TestWeakNaming2247.py @@ -24,35 +24,77 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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/OZ"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_1 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 0, 85.6495043418947, 0, -85.6495043418947, 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(SketchArc_1.endPoint(), SketchLine_1.result()) +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( + SketchArc_1.endPoint(), SketchLine_1.result() +) SketchLine_2 = Sketch_1.addLine(0, -85.6495043418947, 0, 85.6495043418947) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.endPoint()) +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("COMPOUND", "Sketch_1")], model.selection("EDGE", "PartSet/OZ"), 360, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection("EDGE", "PartSet/OZ"), + 360, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) -SketchLine_3 = Sketch_2.addLine(42.96245524296674, 29.66455242966749, -38.35933503836317, 29.66455242966749) -SketchLine_4 = Sketch_2.addLine(-38.35933503836317, 29.66455242966749, -38.35933503836317, -29.66455242966754) -SketchLine_5 = Sketch_2.addLine(-38.35933503836317, -29.66455242966754, 42.96245524296674, -29.66455242966754) -SketchLine_6 = Sketch_2.addLine(42.96245524296674, -29.66455242966754, 42.96245524296674, 29.66455242966749) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchLine_3 = Sketch_2.addLine( + 42.96245524296674, 29.66455242966749, -38.35933503836317, 29.66455242966749 +) +SketchLine_4 = Sketch_2.addLine( + -38.35933503836317, 29.66455242966749, -38.35933503836317, -29.66455242966754 +) +SketchLine_5 = Sketch_2.addLine( + -38.35933503836317, -29.66455242966754, 42.96245524296674, -29.66455242966754 +) +SketchLine_6 = Sketch_2.addLine( + 42.96245524296674, -29.66455242966754, 42.96245524296674, 29.66455242966749 +) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_6.result()) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 100, 100) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 100, 100 +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Revolution_1_1")], + [model.selection("SOLID", "Extrusion_1_1")], +) model.do() model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc) model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2248.py b/src/ModelAPI/Test/TestWeakNaming2248.py index d0afa5fb3..a79f55af0 100644 --- a/src/ModelAPI/Test/TestWeakNaming2248.py +++ b/src/ModelAPI/Test/TestWeakNaming2248.py @@ -24,27 +24,71 @@ 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(162.2066367177775, 151.0353807454788, -151.0353807454788, 151.0353807454788) -SketchLine_2 = Sketch_1.addLine(-151.0353807454788, 151.0353807454788, -151.0353807454788, -54.96257938370976) -SketchLine_3 = Sketch_1.addLine(-151.0353807454788, -54.96257938370976, 162.2066367177775, -54.96257938370976) -SketchLine_4 = Sketch_1.addLine(162.2066367177775, -54.96257938370976, 162.2066367177775, 151.0353807454788) -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()) +SketchLine_1 = Sketch_1.addLine( + 162.2066367177775, 151.0353807454788, -151.0353807454788, 151.0353807454788 +) +SketchLine_2 = Sketch_1.addLine( + -151.0353807454788, 151.0353807454788, -151.0353807454788, -54.96257938370976 +) +SketchLine_3 = Sketch_1.addLine( + -151.0353807454788, -54.96257938370976, 162.2066367177775, -54.96257938370976 +) +SketchLine_4 = Sketch_1.addLine( + 162.2066367177775, -54.96257938370976, 162.2066367177775, 151.0353807454788 +) +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(-6.962011033302339, 151.0353807454788, -151.0353807454788, 151.0353807454788, 38.42912054470763, 14.29920764454234, False) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_1.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_2.result(), SketchArc_1.results()[1]) -SketchArc_2 = Sketch_1.addArc(162.2066367177775, 234.3997613131608, 162.2066367177775, -54.96257938370976, -46.91927508365465, 34.40746839468006, True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_2.startPoint()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_2.results()[1]) -SketchCircle_1 = Sketch_1.addCircle(-8.043304300055087, 108.5846080507436, 59.51166177475501) +SketchArc_1 = Sketch_1.addArc( + -6.962011033302339, + 151.0353807454788, + -151.0353807454788, + 151.0353807454788, + 38.42912054470763, + 14.29920764454234, + False, +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchArc_1.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_2.result(), SketchArc_1.results()[1] +) +SketchArc_2 = Sketch_1.addArc( + 162.2066367177775, + 234.3997613131608, + 162.2066367177775, + -54.96257938370976, + -46.91927508365465, + 34.40746839468006, + True, +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_2.results()[1] +) +SketchCircle_1 = Sketch_1.addCircle( + -8.043304300055087, 108.5846080507436, 59.51166177475501 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) model.do() model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2261.py b/src/ModelAPI/Test/TestWeakNaming2261.py index 343522a67..ac21d09b2 100644 --- a/src/ModelAPI/Test/TestWeakNaming2261.py +++ b/src/ModelAPI/Test/TestWeakNaming2261.py @@ -24,36 +24,113 @@ 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(500.0000311770457, 317.8294573643411, -308.1395348837211, 317.8294573643411) -SketchLine_2 = Sketch_1.addLine(-308.1395348837211, 317.8294573643411, -308.1395348837211, -263.9724263224183) -SketchLine_3 = Sketch_1.addLine(-308.1395348837211, -263.9724263224183, 500.0000311770457, -263.9724263224183) -SketchLine_4 = Sketch_1.addLine(500.0000311770457, -263.9724263224183, 500.0000311770457, 317.8294573643411) -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()) +SketchLine_1 = Sketch_1.addLine( + 500.0000311770457, 317.8294573643411, -308.1395348837211, 317.8294573643411 +) +SketchLine_2 = Sketch_1.addLine( + -308.1395348837211, 317.8294573643411, -308.1395348837211, -263.9724263224183 +) +SketchLine_3 = Sketch_1.addLine( + -308.1395348837211, -263.9724263224183, 500.0000311770457, -263.9724263224183 +) +SketchLine_4 = Sketch_1.addLine( + 500.0000311770457, -263.9724263224183, 500.0000311770457, 317.8294573643411 +) +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(-118.2170542635659, 222.8682170542636, 141.685090902591) -SketchCircle_2 = Sketch_1.addCircle(294.5736434108529, -40.69767441860468, 113.2187726277406) -SketchArc_1 = Sketch_1.addArc(500.0000311770867, -335287.7996679137, 500.0000311770457, -263.9724263224183, -639.534183538502, -265.9104108427558, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_1.results()[1]) -SketchArc_2 = Sketch_1.addArc(-638.1195022375863, -681.8252609710054, -639.534183538502, -265.9104108427558, -316.014851248167, -418.6983758160058, True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1]) -SketchArc_3 = Sketch_1.addArc(-167.5780303038277, -297.4405230733651, -316.014851248167, -418.6983758160058, -17.4411870157839, -178.2940378070349, False) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1]) -SketchArc_4 = Sketch_1.addArc(-301.8048538198685, -403.9610406236078, -17.4411870157839, -178.2940378070349, -637.5573748460384, -265.908384788777, False) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchArc_4.startPoint()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchArc_4.results()[1]) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_2.results()[1], SketchArc_4.endPoint()) +SketchCircle_1 = Sketch_1.addCircle( + -118.2170542635659, 222.8682170542636, 141.685090902591 +) +SketchCircle_2 = Sketch_1.addCircle( + 294.5736434108529, -40.69767441860468, 113.2187726277406 +) +SketchArc_1 = Sketch_1.addArc( + 500.0000311770867, + -335287.7996679137, + 500.0000311770457, + -263.9724263224183, + -639.534183538502, + -265.9104108427558, + True, +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_1.results()[1] +) +SketchArc_2 = Sketch_1.addArc( + -638.1195022375863, + -681.8252609710054, + -639.534183538502, + -265.9104108427558, + -316.014851248167, + -418.6983758160058, + True, +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchArc_2.results()[1] +) +SketchArc_3 = Sketch_1.addArc( + -167.5780303038277, + -297.4405230733651, + -316.014851248167, + -418.6983758160058, + -17.4411870157839, + -178.2940378070349, + False, +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) +SketchArc_4 = Sketch_1.addArc( + -301.8048538198685, + -403.9610406236078, + -17.4411870157839, + -178.2940378070349, + -637.5573748460384, + -265.908384788777, + False, +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchArc_4.results()[1] +) +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) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OX"), 400) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 100, 0 +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OX"), + 400, +) model.do() model.testHaveNamingSubshapes(Translation_1, model, Part_1_doc) model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2291.py b/src/ModelAPI/Test/TestWeakNaming2291.py index db4f80fd1..b90e16b68 100644 --- a/src/ModelAPI/Test/TestWeakNaming2291.py +++ b/src/ModelAPI/Test/TestWeakNaming2291.py @@ -24,36 +24,101 @@ 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(36.44136828644502, 18.79607416879796, -16.36664961636829, 18.79607416879796) -SketchLine_2 = Sketch_1.addLine(-16.36664961636829, 18.79607416879796, -16.36664961636829, -16.62237851662404) -SketchLine_3 = Sketch_1.addLine(-16.36664961636829, -16.62237851662404, 36.44136828644502, -16.62237851662404) -SketchLine_4 = Sketch_1.addLine(36.44136828644502, -16.62237851662404, 36.44136828644502, 18.79607416879796) -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()) +SketchLine_1 = Sketch_1.addLine( + 36.44136828644502, 18.79607416879796, -16.36664961636829, 18.79607416879796 +) +SketchLine_2 = Sketch_1.addLine( + -16.36664961636829, 18.79607416879796, -16.36664961636829, -16.62237851662404 +) +SketchLine_3 = Sketch_1.addLine( + -16.36664961636829, -16.62237851662404, 36.44136828644502, -16.62237851662404 +) +SketchLine_4 = Sketch_1.addLine( + 36.44136828644502, -16.62237851662404, 36.44136828644502, 18.79607416879796 +) +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(), 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) -SketchLine_8 = Sketch_2.addLine(-3.660618520812283, 7.885614342469023, -3.660618520812283, -7.666051414039341) -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()) +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 +) +SketchLine_8 = Sketch_2.addLine( + -3.660618520812283, 7.885614342469023, -3.660618520812283, -7.666051414039341 +) +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()) model.do() -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")]) +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) model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2335.py b/src/ModelAPI/Test/TestWeakNaming2335.py index 05a9d4666..036a5ffd0 100644 --- a/src/ModelAPI/Test/TestWeakNaming2335.py +++ b/src/ModelAPI/Test/TestWeakNaming2335.py @@ -24,8 +24,17 @@ 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) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Cylinder_1_1")]) +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", "Box_1_1"), model.selection("SOLID", "Cylinder_1_1")], +) model.do() model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2375.py b/src/ModelAPI/Test/TestWeakNaming2375.py index 821cb8be0..179962e4d 100644 --- a/src/ModelAPI/Test/TestWeakNaming2375.py +++ b/src/ModelAPI/Test/TestWeakNaming2375.py @@ -28,24 +28,46 @@ 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) +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()) +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()) +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()) +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) +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()) +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()) +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()) +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()) @@ -55,158 +77,402 @@ 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_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) +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) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchCircle_2 = Sketch_2.addCircle(4.113620667976081, 2.375000000000003, 1.1) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_2.center()) +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()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_3.center() +) 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]) +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] +) SketchLine_9 = Sketch_2.addLine(0, 0, 4.113620667976081, 2.375000000000003) SketchLine_9.setAuxiliary(True) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchCircle_2.center(), SketchLine_9.endPoint()) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchCircle_2.center(), SketchLine_9.endPoint() +) 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()) +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-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()) +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/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) -SketchConstraintAngle_3 = Sketch_2.setAngle(SketchLine_10.result(), SketchLine_11.result(), 120.0000000001004) +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 +) +SketchConstraintAngle_3 = Sketch_2.setAngle( + SketchLine_10.result(), SketchLine_11.result(), 120.0000000001004 +) SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_9.result(), 4.75) SketchCircle_5 = Sketch_2.addCircle(2.552173139647412, 4.006109367611208, 0.65) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_5.center()) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_5.center() +) SketchCircle_6 = Sketch_2.addCircle(2.552173139647412, 4.006109367611208, 0.8) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_6.center()) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchCircle_5.center(), SketchCircle_6.center()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_6.center() +) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchCircle_5.center(), SketchCircle_6.center() +) SketchCircle_7 = Sketch_2.addCircle(4.745479052513824, 0.20719208998535, 0.65) -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_7.center()) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_7.center() +) SketchCircle_8 = Sketch_2.addCircle(4.745479052513824, 0.20719208998535, 0.8) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_8.center()) -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchCircle_7.center(), SketchCircle_8.center()) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_8.center() +) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchCircle_7.center(), SketchCircle_8.center() +) SketchLine_13 = Sketch_2.addLine(0, 0, 2.552173139647412, 4.006109367611208) SketchLine_13.setAuxiliary(True) -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchCircle_5.center(), SketchLine_13.endPoint()) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchCircle_5.center(), SketchLine_13.endPoint() +) SketchLine_14 = Sketch_2.addLine(0, 0, 4.745479052513824, 0.20719208998535) SketchLine_14.setAuxiliary(True) -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchCircle_7.center(), SketchLine_14.endPoint()) -SketchConstraintEqual_3 = Sketch_2.setEqual(SketchCircle_7.results()[1], SketchCircle_5.results()[1]) -SketchConstraintEqual_4 = Sketch_2.setEqual(SketchCircle_8.results()[1], SketchCircle_6.results()[1]) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchCircle_7.center(), SketchLine_14.endPoint() +) +SketchConstraintEqual_3 = Sketch_2.setEqual( + SketchCircle_7.results()[1], SketchCircle_5.results()[1] +) +SketchConstraintEqual_4 = Sketch_2.setEqual( + SketchCircle_8.results()[1], SketchCircle_6.results()[1] +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_7.results()[1], 0.65) SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_8.results()[1], 0.8) SketchCircle_9 = Sketch_2.addCircle(-2.552173139482203, 4.006109367717388, 0.65) -SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_9.center()) +SketchConstraintCoincidence_30 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_9.center() +) SketchCircle_10 = Sketch_2.addCircle(-4.745479052513825, 0.2071920899853395, 0.65) -SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_10.center()) +SketchConstraintCoincidence_31 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_10.center() +) SketchCircle_11 = Sketch_2.addCircle(-2.552173139482203, 4.006109367717388, 0.8) -SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_11.center()) +SketchConstraintCoincidence_32 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_11.center() +) SketchCircle_12 = Sketch_2.addCircle(-4.745479052513825, 0.2071920899853395, 0.8) -SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchCircle_10.center(), SketchCircle_12.center()) -SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchCircle_9.center(), SketchCircle_11.center()) -SketchConstraintEqual_5 = Sketch_2.setEqual(SketchCircle_6.results()[1], SketchCircle_11.results()[1]) -SketchConstraintEqual_6 = Sketch_2.setEqual(SketchCircle_5.results()[1], SketchCircle_9.results()[1]) -SketchConstraintEqual_7 = Sketch_2.setEqual(SketchCircle_9.results()[1], SketchCircle_10.results()[1]) -SketchConstraintEqual_8 = Sketch_2.setEqual(SketchCircle_11.results()[1], SketchCircle_12.results()[1]) +SketchConstraintCoincidence_33 = Sketch_2.setCoincident( + SketchCircle_10.center(), SketchCircle_12.center() +) +SketchConstraintCoincidence_34 = Sketch_2.setCoincident( + SketchCircle_9.center(), SketchCircle_11.center() +) +SketchConstraintEqual_5 = Sketch_2.setEqual( + SketchCircle_6.results()[1], SketchCircle_11.results()[1] +) +SketchConstraintEqual_6 = Sketch_2.setEqual( + SketchCircle_5.results()[1], SketchCircle_9.results()[1] +) +SketchConstraintEqual_7 = Sketch_2.setEqual( + SketchCircle_9.results()[1], SketchCircle_10.results()[1] +) +SketchConstraintEqual_8 = Sketch_2.setEqual( + SketchCircle_11.results()[1], SketchCircle_12.results()[1] +) SketchLine_15 = Sketch_2.addLine(-2.552173139482203, 4.006109367717388, 0, 0) SketchLine_15.setAuxiliary(True) -SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchCircle_9.center(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_36 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_15.endPoint()) +SketchConstraintCoincidence_35 = Sketch_2.setCoincident( + SketchCircle_9.center(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_36 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_15.endPoint() +) SketchLine_16 = Sketch_2.addLine(-4.745479052513825, 0.2071920899853395, 0, 0) SketchLine_16.setAuxiliary(True) -SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchCircle_10.center(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_16.endPoint()) +SketchConstraintCoincidence_37 = Sketch_2.setCoincident( + SketchCircle_10.center(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_38 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_16.endPoint() +) SketchCircle_13 = Sketch_2.addCircle(-2.193305912870557, -4.213301457594897, 0.8) -SketchConstraintCoincidence_39 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_13.center()) +SketchConstraintCoincidence_39 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_13.center() +) SketchCircle_14 = Sketch_2.addCircle(2.193305912973027, -4.213301457541542, 0.8) -SketchConstraintCoincidence_40 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_14.center()) -SketchConstraintEqual_9 = Sketch_2.setEqual(SketchCircle_14.results()[1], SketchCircle_13.results()[1]) -SketchConstraintEqual_10 = Sketch_2.setEqual(SketchCircle_12.results()[1], SketchCircle_13.results()[1]) +SketchConstraintCoincidence_40 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_14.center() +) +SketchConstraintEqual_9 = Sketch_2.setEqual( + SketchCircle_14.results()[1], SketchCircle_13.results()[1] +) +SketchConstraintEqual_10 = Sketch_2.setEqual( + SketchCircle_12.results()[1], SketchCircle_13.results()[1] +) SketchLine_17 = Sketch_2.addLine(0, 0, -2.193305912870557, -4.213301457594897) SketchLine_17.setAuxiliary(True) -SketchConstraintCoincidence_41 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_17.startPoint()) -SketchConstraintCoincidence_42 = Sketch_2.setCoincident(SketchCircle_13.center(), SketchLine_17.endPoint()) +SketchConstraintCoincidence_41 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_17.startPoint() +) +SketchConstraintCoincidence_42 = Sketch_2.setCoincident( + SketchCircle_13.center(), SketchLine_17.endPoint() +) SketchLine_18 = Sketch_2.addLine(0, 0, 2.193305912973027, -4.213301457541542) SketchLine_18.setAuxiliary(True) -SketchConstraintCoincidence_43 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_18.startPoint()) -SketchConstraintCoincidence_44 = Sketch_2.setCoincident(SketchCircle_14.center(), SketchLine_18.endPoint()) -SketchConstraintAngle_4 = Sketch_2.setAngleBackward(SketchLine_9.result(), SketchLine_14.result(), "angle") -SketchConstraintAngle_5 = Sketch_2.setAngle(SketchLine_9.result(), SketchLine_13.result(), "angle") -SketchConstraintAngle_6 = Sketch_2.setAngleBackward(SketchLine_10.result(), SketchLine_15.result(), "angle") -SketchConstraintAngle_7 = Sketch_2.setAngleBackward(SketchLine_16.result(), SketchLine_10.result(), "angle") -SketchConstraintAngle_8 = Sketch_2.setAngle(SketchLine_17.result(), SketchLine_11.result(), "angle") -SketchConstraintAngle_9 = Sketch_2.setAngle(SketchLine_11.result(), SketchLine_18.result(), "angle") -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchConstraintCoincidence_43 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_18.startPoint() +) +SketchConstraintCoincidence_44 = Sketch_2.setCoincident( + SketchCircle_14.center(), SketchLine_18.endPoint() +) +SketchConstraintAngle_4 = Sketch_2.setAngleBackward( + SketchLine_9.result(), SketchLine_14.result(), "angle" +) +SketchConstraintAngle_5 = Sketch_2.setAngle( + SketchLine_9.result(), SketchLine_13.result(), "angle" +) +SketchConstraintAngle_6 = Sketch_2.setAngleBackward( + SketchLine_10.result(), SketchLine_15.result(), "angle" +) +SketchConstraintAngle_7 = Sketch_2.setAngleBackward( + SketchLine_16.result(), SketchLine_10.result(), "angle" +) +SketchConstraintAngle_8 = Sketch_2.setAngle( + SketchLine_17.result(), SketchLine_11.result(), "angle" +) +SketchConstraintAngle_9 = Sketch_2.setAngle( + SketchLine_11.result(), SketchLine_18.result(), "angle" +) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_19 = SketchProjection_5.createdFeature() SketchCircle_15 = Sketch_2.addCircle(0, 5, 0.45) -SketchConstraintCoincidence_45 = Sketch_2.setCoincident(SketchLine_19.result(), SketchCircle_15.center()) +SketchConstraintCoincidence_45 = Sketch_2.setCoincident( + SketchLine_19.result(), SketchCircle_15.center() +) SketchConstraintRadius_4 = Sketch_2.setRadius(SketchCircle_15.results()[1], 0.45) SketchLine_20 = Sketch_2.addLine(0, 0, 4.385635518227006, -2.793957963403483) SketchLine_20.setAuxiliary(True) -SketchConstraintCoincidence_46 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_46 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_20.startPoint() +) SketchCircle_16 = Sketch_2.addCircle(3.373565783251674, -2.149198433387089, 0.3) -SketchConstraintCoincidence_47 = Sketch_2.setCoincident(SketchLine_20.result(), SketchCircle_16.center()) +SketchConstraintCoincidence_47 = Sketch_2.setCoincident( + SketchLine_20.result(), SketchCircle_16.center() +) SketchCircle_17 = Sketch_2.addCircle(4.385635518227006, -2.793957963403483, 0.5) -SketchConstraintCoincidence_48 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchCircle_17.center()) +SketchConstraintCoincidence_48 = Sketch_2.setCoincident( + SketchLine_20.endPoint(), SketchCircle_17.center() +) SketchConstraintRadius_5 = Sketch_2.setRadius(SketchCircle_16.results()[1], 0.3) SketchConstraintRadius_6 = Sketch_2.setRadius(SketchCircle_17.results()[1], 0.5) -SketchConstraintAngle_10 = Sketch_2.setAngleBackward(SketchLine_14.result(), SketchLine_20.result(), 35.00000000000006) -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchCircle_15.center(), SketchLine_12.result(), 5, True) -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_16.center(), SketchAPI_Line(SketchLine_19).startPoint(), 4, True) -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_19).startPoint(), SketchCircle_17.center(), 5.2, True) +SketchConstraintAngle_10 = Sketch_2.setAngleBackward( + SketchLine_14.result(), SketchLine_20.result(), 35.00000000000006 +) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchCircle_15.center(), SketchLine_12.result(), 5, True +) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_16.center(), SketchAPI_Line(SketchLine_19).startPoint(), 4, True +) +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&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")]) +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&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&Sketch_1/SketchLine_7"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")]) +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()) +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/SketchLine_3"), False) +SketchConstraintCoincidence_50 = Sketch_3.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.startPoint() +) +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()) +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/SketchLine_5"), False) +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/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()) +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/SketchLine_4"), False) +SketchConstraintCoincidence_56 = Sketch_3.setCoincident( + SketchLine_22.endPoint(), SketchLine_24.result() +) +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/SketchLine_4"), False) +SketchConstraintParallel_1 = Sketch_3.setParallel( + SketchLine_25.result(), SketchLine_27.result() +) +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) +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&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")]) +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&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() model.testHaveNamingEdges(Cut_1, model, Part_1_doc) model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2437.py b/src/ModelAPI/Test/TestWeakNaming2437.py index 123b34fda..7bfcb85bc 100644 --- a/src/ModelAPI/Test/TestWeakNaming2437.py +++ b/src/ModelAPI/Test/TestWeakNaming2437.py @@ -39,81 +39,183 @@ model.addParameter(Part_1_doc, "LegTopFillet", "2") model.addParameter(Part_1_doc, "BottomCutFillet", "2") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchLine_1 = Sketch_1.addLine(0, 84.99999999999999, 11, 85) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) SketchLine_3 = Sketch_1.addLine(11, 85, 24.4927071104659, 8.479055466987994) SketchLine_4 = Sketch_1.addLine(27.44713036948842, 6, 56, 6) SketchLine_5 = Sketch_1.addLine(56, 6, 56, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_4") -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_6 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.result() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_5") SketchLine_7 = Sketch_1.addLine(56, 0, 20.91066030079079, 0) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_7.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_6") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_6.result() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_7") -SketchLine_8 = Sketch_1.addLine(20.91066030079079, 0, 17.67553693029129, 18.34729635533419) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchLine_8 = Sketch_1.addLine( + 20.91066030079079, 0, 17.67553693029129, 18.34729635533419 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_8") SketchLine_9 = Sketch_1.addLine(15.70592142426623, 20, 0, 20) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_2.result() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_10") SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_4.endPoint(), SketchLine_6.result(), 6, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_9.endPoint(), SketchLine_6.result(), 20, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_2.result(), "Width/2", True) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_4.result(), SketchLine_3.result(), "Draft") -SketchArc_1 = Sketch_1.addArc(15.70592142426623, 18, 17.67553693029129, 18.34729635533419, 15.70592142426623, 20, False) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_4.endPoint(), SketchLine_6.result(), 6, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_9.endPoint(), SketchLine_6.result(), 20, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_7.startPoint(), SketchLine_2.result(), "Width/2", True +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_4.result(), SketchLine_3.result(), "Draft" +) +SketchArc_1 = Sketch_1.addArc( + 15.70592142426623, + 18, + 17.67553693029129, + 18.34729635533419, + 15.70592142426623, + 20, + False, +) SketchPoint_1 = Sketch_1.addPoint(17.3841206866215, 20) SketchPoint_1.setAuxiliary(True) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_3.result(), "LegThick", True) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_8.result()) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchPoint_1.coordinates(), SketchLine_3.result(), "LegThick", True +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_8.result() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_11") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_9.result()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_9.result() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_12") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_8.endPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_13") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_9.startPoint() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_14") -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_8.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_9.result()) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_8.result() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_9.result() +) SketchPoint_2 = Sketch_1.addPoint(11, 85) SketchPoint_2.setAuxiliary(True) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_7.result(), 85, True) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_2.result(), "TDE/2", True) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.result()) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchPoint_2.coordinates(), SketchLine_7.result(), 85, True +) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchPoint_2.coordinates(), SketchLine_2.result(), "TDE/2", True +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_1.result() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_15") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_3.result()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_3.result() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_16") -SketchArc_2 = Sketch_1.addArc(27.44713036950173, 9.00000000000146, 24.4927071104659, 8.479055466987994, 27.44713036948842, 6, False) +SketchArc_2 = Sketch_1.addArc( + 27.44713036950173, + 9.00000000000146, + 24.4927071104659, + 8.479055466987994, + 27.44713036948842, + 6, + False, +) SketchArc_2.setName("SketchArc_3") SketchArc_2.result().setName("SketchArc_3") SketchArc_2.results()[1].setName("SketchArc_3_2") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_3.endPoint() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_19") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_20") -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_3.result()) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_3.result() +) SketchConstraintTangent_3.setName("SketchConstraintTangent_5") -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_4.result()) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_4.result() +) SketchConstraintTangent_4.setName("SketchConstraintTangent_6") SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_2.results()[1], "BaseLegFillet") SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_1.results()[1], "LegTopFillet") -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_8.result()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchPoint_2.coordinates()) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_3.result(), SketchLine_8.result() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchPoint_2.coordinates() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_17") -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.endPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_1.endPoint() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_18") -SketchConstraintMirror_1_objects = [SketchLine_3.result(), SketchLine_1.result(), SketchLine_4.result(), SketchLine_7.result(), SketchArc_2.results()[1], SketchLine_5.result(), SketchLine_8.result(), SketchLine_9.result(), SketchArc_1.results()[1]] -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_2.result(), SketchConstraintMirror_1_objects) -[SketchLine_10, SketchLine_11, SketchLine_12, SketchLine_13, SketchArc_3, SketchLine_14, SketchLine_15, SketchLine_16, SketchArc_4] = SketchConstraintMirror_1.mirrored() +SketchConstraintMirror_1_objects = [ + SketchLine_3.result(), + SketchLine_1.result(), + SketchLine_4.result(), + SketchLine_7.result(), + SketchArc_2.results()[1], + SketchLine_5.result(), + SketchLine_8.result(), + SketchLine_9.result(), + SketchArc_1.results()[1], +] +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_2.result(), SketchConstraintMirror_1_objects +) +[ + SketchLine_10, + SketchLine_11, + SketchLine_12, + SketchLine_13, + SketchArc_3, + SketchLine_14, + SketchLine_15, + SketchLine_16, + SketchArc_4, +] = SketchConstraintMirror_1.mirrored() SketchArc_4.setName("SketchArc_5") SketchArc_4.result().setName("SketchArc_5") SketchArc_4.results()[1].setName("SketchArc_5_2") @@ -125,65 +227,143 @@ Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_17 = Sketch_2.addLine(-18, 39.99999999999999, 18, 39.99999999999999) SketchLine_18 = Sketch_2.addLine(20, 37.99999999999999, 20, -5) SketchLine_19 = Sketch_2.addLine(20, -5, -20, -5) -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_22") SketchLine_20 = Sketch_2.addLine(-20, -5, -20, 37.99999999999999) -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_23") SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_18.result()) SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_20.result()) SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_17.result()) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_19.result()) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_21 = SketchProjection_3.createdFeature() -SketchArc_5 = Sketch_2.addArc(18, 37.99999999999999, 20, 37.99999999999999, 18, 39.99999999999999, False) +SketchArc_5 = Sketch_2.addArc( + 18, 37.99999999999999, 20, 37.99999999999999, 18, 39.99999999999999, False +) SketchArc_5.setName("SketchArc_6") SketchArc_5.result().setName("SketchArc_6") SketchArc_5.results()[1].setName("SketchArc_6_2") SketchPoint_3 = Sketch_2.addPoint(20, 40) SketchPoint_3.setAuxiliary(True) -SketchConstraintDistance_7 = Sketch_2.setDistance(SketchPoint_3.coordinates(), SketchLine_21.result(), 40, True) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_17.result()) +SketchConstraintDistance_7 = Sketch_2.setDistance( + SketchPoint_3.coordinates(), SketchLine_21.result(), 40, True +) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchPoint_3.coordinates(), SketchLine_17.result() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_25") -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_18.result()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchPoint_3.coordinates(), SketchLine_18.result() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_26") -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchArc_5.startPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchArc_5.startPoint(), SketchLine_18.startPoint() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_27") -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_17.endPoint()) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchArc_5.endPoint(), SketchLine_17.endPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_28") -SketchConstraintTangent_5 = Sketch_2.setTangent(SketchArc_5.results()[1], SketchLine_17.result()) +SketchConstraintTangent_5 = Sketch_2.setTangent( + SketchArc_5.results()[1], SketchLine_17.result() +) SketchConstraintTangent_5.setName("SketchConstraintTangent_7") -SketchConstraintTangent_6 = Sketch_2.setTangent(SketchArc_5.results()[1], SketchLine_18.result()) +SketchConstraintTangent_6 = Sketch_2.setTangent( + SketchArc_5.results()[1], SketchLine_18.result() +) SketchConstraintTangent_6.setName("SketchConstraintTangent_8") -SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_5.results()[1], "BottomCutFillet") -SketchArc_6 = Sketch_2.addArc(-18, 37.99999999999999, -18, 39.99999999999999, -20, 37.99999999999999, False) +SketchConstraintRadius_3 = Sketch_2.setRadius( + SketchArc_5.results()[1], "BottomCutFillet" +) +SketchArc_6 = Sketch_2.addArc( + -18, 37.99999999999999, -18, 39.99999999999999, -20, 37.99999999999999, False +) SketchArc_6.setName("SketchArc_7") SketchArc_6.result().setName("SketchArc_7") SketchArc_6.results()[1].setName("SketchArc_7_2") -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchArc_6.startPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchArc_6.startPoint(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_24") -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchArc_6.endPoint(), SketchLine_20.endPoint()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchArc_6.endPoint(), SketchLine_20.endPoint() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_29") -SketchConstraintTangent_7 = Sketch_2.setTangent(SketchArc_6.results()[1], SketchLine_17.result()) +SketchConstraintTangent_7 = Sketch_2.setTangent( + SketchArc_6.results()[1], SketchLine_17.result() +) SketchConstraintTangent_7.setName("SketchConstraintTangent_9") -SketchConstraintTangent_8 = Sketch_2.setTangent(SketchArc_6.results()[1], SketchLine_20.result()) +SketchConstraintTangent_8 = Sketch_2.setTangent( + SketchArc_6.results()[1], SketchLine_20.result() +) SketchConstraintTangent_8.setName("SketchConstraintTangent_10") -SketchConstraintRadius_4 = Sketch_2.setRadius(SketchArc_6.results()[1], "BottomCutFillet") -SketchConstraintDistance_8 = Sketch_2.setDistance(SketchLine_19.startPoint(), SketchLine_21.result(), 5, True) -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchConstraintRadius_4 = Sketch_2.setRadius( + SketchArc_6.results()[1], "BottomCutFillet" +) +SketchConstraintDistance_8 = Sketch_2.setDistance( + SketchLine_19.startPoint(), SketchLine_21.result(), 5, True +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) 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) +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/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_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/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_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")]) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection(), 10, 0) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection(), 10, 0) -Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], [model.selection("SOLID", "Extrusion_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection(), 10, 0 +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection(), 10, 0 +) +Smash_1 = model.addSmash( + Part_1_doc, + [model.selection("SOLID", "Extrusion_2_1")], + [model.selection("SOLID", "Extrusion_1_1")], +) model.do() model.testHaveNamingSubshapes(Smash_1, model, Part_1_doc) model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2445.py b/src/ModelAPI/Test/TestWeakNaming2445.py index 7cb4b5f56..e6c38e20a 100644 --- a/src/ModelAPI/Test/TestWeakNaming2445.py +++ b/src/ModelAPI/Test/TestWeakNaming2445.py @@ -28,91 +28,179 @@ model.addParameter(Part_1_doc, "L1", "100") model.addParameter(Part_1_doc, "R2", "40") model.addParameter(Part_1_doc, "L2", "50") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 50) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "R1") SketchLine_1 = Sketch_1.addLine(0, 49.99999999999999, 0, 31.81980515339405) SketchLine_2 = Sketch_1.addLine(-1.202451477893311e-021, -31.81980515339534, 0, -50) SketchLine_2.setName("SketchLine_3") SketchLine_2.result().setName("SketchLine_3") -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchCircle_1.results()[1] +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_4") SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_3 = SketchProjection_2.createdFeature() SketchLine_3.setName("SketchLine_4") SketchLine_3.result().setName("SketchLine_4") -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.result(), SketchLine_1.startPoint()) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_1.result(), SketchLine_2.result()) -SketchLine_4 = Sketch_1.addLine(0, 31.81980515339405, 31.81980515339462, -6.650124210799604e-013) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchLine_1.startPoint() +) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_1.result(), SketchLine_2.result() +) +SketchLine_4 = Sketch_1.addLine( + 0, 31.81980515339405, 31.81980515339462, -6.650124210799604e-013 +) SketchLine_4.setName("SketchLine_5") SketchLine_4.result().setName("SketchLine_5") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5") -SketchLine_5 = Sketch_1.addLine(31.81980515339462, -6.650124210799604e-013, -1.202451477893311e-021, -31.81980515339534) +SketchLine_5 = Sketch_1.addLine( + 31.81980515339462, + -6.650124210799604e-013, + -1.202451477893311e-021, + -31.81980515339534, +) SketchLine_5.setName("SketchLine_6") SketchLine_5.result().setName("SketchLine_6") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_6") -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_5.endPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7") -SketchLine_6 = Sketch_1.addLine(-1.202451477893311e-021, -31.81980515339534, -31.8198051533955, -6.650124202329274e-013) +SketchLine_6 = Sketch_1.addLine( + -1.202451477893311e-021, + -31.81980515339534, + -31.8198051533955, + -6.650124202329274e-013, +) SketchLine_6.setName("SketchLine_7") SketchLine_6.result().setName("SketchLine_7") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_6.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8") -SketchLine_7 = Sketch_1.addLine(-31.8198051533955, -6.650124202329274e-013, -8.789247626282909e-013, 31.81980515339405) +SketchLine_7 = Sketch_1.addLine( + -31.8198051533955, + -6.650124202329274e-013, + -8.789247626282909e-013, + 31.81980515339405, +) SketchLine_7.setName("SketchLine_8") SketchLine_7.result().setName("SketchLine_8") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_9") -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_7.result(), SketchLine_4.result()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_7.result(), SketchLine_5.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_6.result()) -SketchLine_8 = Sketch_1.addLine(-31.8198051533955, -6.650124202329274e-013, -50, -8.919190713816664e-015) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_7.result(), SketchLine_4.result() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_7.result(), SketchLine_5.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_6.result() +) +SketchLine_8 = Sketch_1.addLine( + -31.8198051533955, -6.650124202329274e-013, -50, -8.919190713816664e-015 +) SketchLine_8.setName("SketchLine_9") SketchLine_8.result().setName("SketchLine_9") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchCircle_1.results()[1] +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_12") -SketchLine_9 = Sketch_1.addLine(31.81980515339462, -6.650124210799604e-013, 50, -8.919190733668999e-015) +SketchLine_9 = Sketch_1.addLine( + 31.81980515339462, -6.650124210799604e-013, 50, -8.919190733668999e-015 +) SketchLine_9.setName("SketchLine_10") SketchLine_9.result().setName("SketchLine_10") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_9.startPoint() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_13") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchCircle_1.results()[1] +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_14") -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_7.result(), SketchLine_5.result()) -SketchConstraintCollinear_2 = Sketch_1.setCollinear(SketchLine_8.result(), SketchLine_9.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_7.result(), SketchLine_5.result() +) +SketchConstraintCollinear_2 = Sketch_1.setCollinear( + SketchLine_8.result(), SketchLine_9.result() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_8.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_8.result(), SketchLine_1.result()) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result()) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_8.result(), SketchLine_1.result() +) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_1.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), "R1*0.9") SketchConstraintLength_1.setName("SketchConstraintLength_2") model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "L1", "L1") +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "L1", "L1" +) Extrusion_1.result().setName("tuyau_principal") Extrusion_1.result().subResult(0).setName("Extrusion_1_1_1") Extrusion_1.result().subResult(1).setName("Extrusion_1_1_2") Extrusion_1.result().subResult(2).setName("Extrusion_1_1_3") Extrusion_1.result().subResult(3).setName("Extrusion_1_1_4") Extrusion_1.result().subResult(4).setName("Extrusion_1_1_5") -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("COMPSOLID", "tuyau_principal")], model.selection("EDGE", "PartSet/OX"), 45) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("COMPSOLID", "tuyau_principal")], + model.selection("EDGE", "PartSet/OX"), + 45, +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_3.createdFeature() SketchCircle_2 = Sketch_2.addCircle(0, 0, 40) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchCircle_2.center()) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchPoint_2.result(), SketchCircle_2.center() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_15") SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], "R2") model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 0, "R1+L2") +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], + model.selection(), + 0, + "R1+L2", +) Extrusion_2.result().setName("piquage") -Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "piquage")], [model.selection("COMPSOLID", "tuyau_principal")]) +Smash_1 = model.addSmash( + Part_1_doc, + [model.selection("SOLID", "piquage")], + [model.selection("COMPSOLID", "tuyau_principal")], +) Smash_1.result().setName("té") Smash_1.result().setColor(153, 76, 153) Smash_1.result().subResult(0).setName("Smash_1_1_1") @@ -127,7 +215,9 @@ Smash_1.result().subResult(4).setName("Smash_1_1_5") Smash_1.result().subResult(4).setColor(204, 0, 204) Smash_1.result().subResult(5).setName("Smash_1_1_6") Smash_1.result().subResult(5).setColor(76, 76, 153) -Recover_1 = model.addRecover(Part_1_doc, Smash_1, [Extrusion_2.result(), Rotation_1.result()]) +Recover_1 = model.addRecover( + Part_1_doc, Smash_1, [Extrusion_2.result(), Rotation_1.result()] +) Recover_1.result().setName("tuyau_principal") Recover_1.result().subResult(0).setName("Recover_1_1_1") Recover_1.result().subResult(1).setName("Recover_1_1_2") @@ -135,7 +225,13 @@ Recover_1.result().subResult(2).setName("Recover_1_1_3") Recover_1.result().subResult(3).setName("Recover_1_1_4") Recover_1.result().subResult(4).setName("Recover_1_1_5") Recover_1.results()[1].setName("piquage") -Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("COMPSOLID", "tuyau_principal"), model.selection("SOLID", "piquage")]) +Intersection_1 = model.addIntersection( + Part_1_doc, + [ + model.selection("COMPSOLID", "tuyau_principal"), + model.selection("SOLID", "piquage"), + ], +) Intersection_1.result().setName("intersection") Intersection_1.result().subResult(0).setName("Intersection_1_1_1") Intersection_1.result().subResult(1).setName("Intersection_1_1_2") @@ -154,7 +250,13 @@ Intersection_1.result().subResult(13).setName("Intersection_1_1_14") Intersection_1.result().subResult(14).setName("Intersection_1_1_15") Intersection_1.result().subResult(15).setName("Intersection_1_1_16") Intersection_1.result().subResult(16).setName("Intersection_1_1_17") -Edge_1_objects = [model.selection("EDGE", "Intersection_1_1_3"), model.selection("EDGE", "Intersection_1_1_12"), model.selection("EDGE", "Intersection_1_1_14"), model.selection("EDGE", "Intersection_1_1_5"), model.selection("EDGE", "Intersection_1_1_1")] +Edge_1_objects = [ + model.selection("EDGE", "Intersection_1_1_3"), + model.selection("EDGE", "Intersection_1_1_12"), + model.selection("EDGE", "Intersection_1_1_14"), + model.selection("EDGE", "Intersection_1_1_5"), + model.selection("EDGE", "Intersection_1_1_1"), +] Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects) Edge_1.results()[1].setName("intersection_1") Edge_1.results()[2].setName("intersection_2") diff --git a/src/ModelAPI/Test/TestWeakNaming2446.py b/src/ModelAPI/Test/TestWeakNaming2446.py index 704c6b9a7..81788b13b 100644 --- a/src/ModelAPI/Test/TestWeakNaming2446.py +++ b/src/ModelAPI/Test/TestWeakNaming2446.py @@ -24,22 +24,46 @@ 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("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 40) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 40) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() SketchCircle_2 = Sketch_2.addCircle(0, 0, 40) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchCircle_2.center()) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchPoint_2.result(), SketchCircle_2.center() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], 40) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 10, 10) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 10) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], [model.selection("SOLID", "Extrusion_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], + model.selection(), + 10, + 10, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], + model.selection(), + 10, + 10, +) +Fuse_1 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Extrusion_2_1")], + [model.selection("SOLID", "Extrusion_1_1")], +) model.do() model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) model.end() diff --git a/src/ModelAPI/Test/TestWeakNaming2452.py b/src/ModelAPI/Test/TestWeakNaming2452.py index 65e2bc30d..a5e3db742 100644 --- a/src/ModelAPI/Test/TestWeakNaming2452.py +++ b/src/ModelAPI/Test/TestWeakNaming2452.py @@ -24,72 +24,176 @@ 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(-20.13803680981595, 73.73619631901842, -73.42638036809818, 73.73619631901842) -SketchLine_2 = Sketch_1.addLine(-73.42638036809818, 73.73619631901842, -73.42638036809818, 32.22085889570552) -SketchLine_3 = Sketch_1.addLine(-73.42638036809818, 32.22085889570552, -20.13803680981595, 32.22085889570552) -SketchLine_4 = Sketch_1.addLine(-20.13803680981595, 32.22085889570552, -20.13803680981595, 73.73619631901842) -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()) +SketchLine_1 = Sketch_1.addLine( + -20.13803680981595, 73.73619631901842, -73.42638036809818, 73.73619631901842 +) +SketchLine_2 = Sketch_1.addLine( + -73.42638036809818, 73.73619631901842, -73.42638036809818, 32.22085889570552 +) +SketchLine_3 = Sketch_1.addLine( + -73.42638036809818, 32.22085889570552, -20.13803680981595, 32.22085889570552 +) +SketchLine_4 = Sketch_1.addLine( + -20.13803680981595, 32.22085889570552, -20.13803680981595, 73.73619631901842 +) +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(82.41104294478531, 71.56748466257669, 24.47546012269937, 71.56748466257669) -SketchLine_6 = Sketch_1.addLine(24.47546012269937, 71.56748466257669, 24.47546012269937, 17.96932515337424) -SketchLine_7 = Sketch_1.addLine(24.47546012269937, 17.96932515337424, 82.41104294478531, 17.96932515337424) -SketchLine_8 = Sketch_1.addLine(82.41104294478531, 17.96932515337424, 82.41104294478531, 71.56748466257669) -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()) +SketchLine_5 = Sketch_1.addLine( + 82.41104294478531, 71.56748466257669, 24.47546012269937, 71.56748466257669 +) +SketchLine_6 = Sketch_1.addLine( + 24.47546012269937, 71.56748466257669, 24.47546012269937, 17.96932515337424 +) +SketchLine_7 = Sketch_1.addLine( + 24.47546012269937, 17.96932515337424, 82.41104294478531, 17.96932515337424 +) +SketchLine_8 = Sketch_1.addLine( + 82.41104294478531, 17.96932515337424, 82.41104294478531, 71.56748466257669 +) +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(-0.3098159509202501, -18.89877300613497, -69.70858895705524, -18.89877300613497) -SketchLine_10 = Sketch_1.addLine(-69.70858895705524, -18.89877300613497, -69.70858895705524, -72.80674846625769) -SketchLine_11 = Sketch_1.addLine(-69.70858895705524, -72.80674846625769, -0.3098159509202501, -72.80674846625769) -SketchLine_12 = Sketch_1.addLine(-0.3098159509202501, -72.80674846625769, -0.3098159509202501, -18.89877300613497) -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()) +SketchLine_9 = Sketch_1.addLine( + -0.3098159509202501, -18.89877300613497, -69.70858895705524, -18.89877300613497 +) +SketchLine_10 = Sketch_1.addLine( + -69.70858895705524, -18.89877300613497, -69.70858895705524, -72.80674846625769 +) +SketchLine_11 = Sketch_1.addLine( + -69.70858895705524, -72.80674846625769, -0.3098159509202501, -72.80674846625769 +) +SketchLine_12 = Sketch_1.addLine( + -0.3098159509202501, -72.80674846625769, -0.3098159509202501, -18.89877300613497 +) +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(74.04601226993866, -25.09509202453988, 29.74233128834356, -25.09509202453988) -SketchLine_14 = Sketch_1.addLine(29.74233128834356, -25.09509202453988, 29.74233128834356, -77.45398773006136) -SketchLine_15 = Sketch_1.addLine(29.74233128834356, -77.45398773006136, 74.04601226993866, -77.45398773006136) -SketchLine_16 = Sketch_1.addLine(74.04601226993866, -77.45398773006136, 74.04601226993866, -25.09509202453988) -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()) +SketchLine_13 = Sketch_1.addLine( + 74.04601226993866, -25.09509202453988, 29.74233128834356, -25.09509202453988 +) +SketchLine_14 = Sketch_1.addLine( + 29.74233128834356, -25.09509202453988, 29.74233128834356, -77.45398773006136 +) +SketchLine_15 = Sketch_1.addLine( + 29.74233128834356, -77.45398773006136, 74.04601226993866, -77.45398773006136 +) +SketchLine_16 = Sketch_1.addLine( + 74.04601226993866, -77.45398773006136, 74.04601226993866, -25.09509202453988 +) +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()) -SketchLine_17 = Sketch_1.addLine(52.66871165644174, 52.66871165644174, -42.75460122699386, 52.66871165644174) -SketchLine_18 = Sketch_1.addLine(-42.75460122699386, 52.66871165644174, -42.75460122699386, -41.51533742331289) -SketchLine_19 = Sketch_1.addLine(-42.75460122699386, -41.51533742331289, 52.66871165644174, -41.51533742331289) -SketchLine_20 = Sketch_1.addLine(52.66871165644174, -41.51533742331289, 52.66871165644174, 52.66871165644174) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_17.startPoint()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) +SketchLine_17 = Sketch_1.addLine( + 52.66871165644174, 52.66871165644174, -42.75460122699386, 52.66871165644174 +) +SketchLine_18 = Sketch_1.addLine( + -42.75460122699386, 52.66871165644174, -42.75460122699386, -41.51533742331289 +) +SketchLine_19 = Sketch_1.addLine( + -42.75460122699386, -41.51533742331289, 52.66871165644174, -41.51533742331289 +) +SketchLine_20 = Sketch_1.addLine( + 52.66871165644174, -41.51533742331289, 52.66871165644174, 52.66871165644174 +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_20.endPoint(), SketchLine_17.startPoint() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) SketchConstraintHorizontal_9 = Sketch_1.setHorizontal(SketchLine_17.result()) SketchConstraintVertical_9 = Sketch_1.setVertical(SketchLine_18.result()) 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_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_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")]) +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_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_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) model.end() diff --git a/src/ModelAPI/Test/TestWeakNamingSortOrder.py b/src/ModelAPI/Test/TestWeakNamingSortOrder.py index aa7097900..a46c2215e 100644 --- a/src/ModelAPI/Test/TestWeakNamingSortOrder.py +++ b/src/ModelAPI/Test/TestWeakNamingSortOrder.py @@ -29,10 +29,26 @@ Point_2 = model.addPoint(Part_1_doc, 10, 0, 0) Point_3 = model.addPoint(Part_1_doc, 0, 10, 0) Point_4 = model.addPoint(Part_1_doc, 20, 10, 0) Point_5 = model.addPoint(Part_1_doc, 10, 20, 0) -Polyline_1 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_4")], False) -Polyline_2 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_2"), model.selection("VERTEX", "Point_3")], False) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("WIRE", "Polyline_1_1"), model.selection("WIRE", "Polyline_2_1")]) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Compound_1_1_2", 1)], model.selection("EDGE", "PartSet/OY"), 10) +Polyline_1 = model.addPolyline3D( + Part_1_doc, + [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_4")], + False, +) +Polyline_2 = model.addPolyline3D( + Part_1_doc, + [model.selection("VERTEX", "Point_2"), model.selection("VERTEX", "Point_3")], + False, +) +Compound_1 = model.addCompound( + Part_1_doc, + [model.selection("WIRE", "Polyline_1_1"), model.selection("WIRE", "Polyline_2_1")], +) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("EDGE", "Compound_1_1_2", 1)], + model.selection("EDGE", "PartSet/OY"), + 10, +) model.do() model.testNbResults(Translation_1, 1) @@ -47,9 +63,16 @@ Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) Box_2 = model.addBox(Part_2_doc, 4, 4, 4) -Translation_2 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_2_1")], 3, 3, 3) -Compound_2 = model.addCompound(Part_2_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1")]) -Translation_3 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Compound_1_1", 0)], 10, 0, 0) +Translation_2 = model.addTranslation( + Part_2_doc, [model.selection("SOLID", "Box_2_1")], 3, 3, 3 +) +Compound_2 = model.addCompound( + Part_2_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1")], +) +Translation_3 = model.addTranslation( + Part_2_doc, [model.selection("SOLID", "Compound_1_1", 0)], 10, 0, 0 +) model.do() model.testNbResults(Translation_3, 1) @@ -67,10 +90,24 @@ Box_3 = model.addBox(Part_3_doc, 10, 10, 10) Box_4 = model.addBox(Part_3_doc, 10, 10, 10) Point_6 = model.addPoint(Part_3_doc, 5, 5, 0) Point_7 = model.addPoint(Part_3_doc, 5, 5, 10) -Axis_4 = model.addAxis(Part_3_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")) -Rotation_1 = model.addRotation(Part_3_doc, [model.selection("SOLID", "Box_2_1")], model.selection("EDGE", "Axis_1"), 45) -Compound_3 = model.addCompound(Part_3_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Rotation_1_1")]) -Translation_4 = model.addTranslation(Part_3_doc, [model.selection("SOLID", "Compound_1_1", 1)], 10, 0, 0) +Axis_4 = model.addAxis( + Part_3_doc, + model.selection("VERTEX", "Point_1"), + model.selection("VERTEX", "Point_2"), +) +Rotation_1 = model.addRotation( + Part_3_doc, + [model.selection("SOLID", "Box_2_1")], + model.selection("EDGE", "Axis_1"), + 45, +) +Compound_3 = model.addCompound( + Part_3_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Rotation_1_1")], +) +Translation_4 = model.addTranslation( + Part_3_doc, [model.selection("SOLID", "Compound_1_1", 1)], 10, 0, 0 +) model.do() model.testNbResults(Translation_4, 1) @@ -86,8 +123,16 @@ Part_4 = model.addPart(partSet) Part_4_doc = Part_4.document() Box_5 = model.addBox(Part_4_doc, 10, 10, 10) Box_6 = model.addBox(Part_4_doc, 10, 10, 10) -Compound_4 = model.addCompound(Part_4_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Box_2_1")]) -Translation_5 = model.addTranslation(Part_4_doc, [model.selection("SOLID", "Compound_1_1", 1)], model.selection("EDGE", "PartSet/OZ"), 10) +Compound_4 = model.addCompound( + Part_4_doc, + [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Box_2_1")], +) +Translation_5 = model.addTranslation( + Part_4_doc, + [model.selection("SOLID", "Compound_1_1", 1)], + model.selection("EDGE", "PartSet/OZ"), + 10, +) model.do() model.testNbResults(Translation_5, 1) diff --git a/src/ModelGeomAlgo/Test/TestPoint2D.py b/src/ModelGeomAlgo/Test/TestPoint2D.py index c3382602b..1d944abba 100644 --- a/src/ModelGeomAlgo/Test/TestPoint2D.py +++ b/src/ModelGeomAlgo/Test/TestPoint2D.py @@ -22,9 +22,9 @@ Unit test for testing the Point2D algorithms """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * from GeomAlgoAPI import * @@ -36,4 +36,5 @@ __updated__ = "2016-07-20" aSession = ModelAPI_Session.get() from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/ModelHighAPI/Test/Test18451.py b/src/ModelHighAPI/Test/Test18451.py index b617f2cfa..91a7dc6d7 100644 --- a/src/ModelHighAPI/Test/Test18451.py +++ b/src/ModelHighAPI/Test/Test18451.py @@ -29,67 +29,119 @@ model.addParameter(Part_1_doc, "ep", "0.5875") model.addParameter(Part_1_doc, "ep2", "0.35") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(-4.81482486096809e-34, 0.6, -0.08939999999999999, 0.6) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchLine_3 = Sketch_1.addLine(-0.08939999999999999, 0.6, -0.08939999999999999, 0.46) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) SketchLine_4 = Sketch_1.addLine(-0.08939999999999999, 0.46, -0.2894, 0.46) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchLine_5 = Sketch_1.addLine(-0.2894, 0.46, -0.2894, 0.36) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result()) SketchLine_6 = Sketch_1.addLine(-0.2894, 0.36, -0.08940000000000001, 0.36) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(-0.08940000000000001, 0.36, -0.08940000000000001, -0.5600000000000001) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchLine_7 = Sketch_1.addLine( + -0.08940000000000001, 0.36, -0.08940000000000001, -0.5600000000000001 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result()) -SketchLine_8 = Sketch_1.addLine(-0.08852125812784814, -0.571165474137811, -0.07285119438446976, -0.5729508523825384) -SketchLine_9 = Sketch_1.addLine(-0.07285119438446976, -0.5729508523825384, -0.0654, -0.6028359607518391) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchLine_8 = Sketch_1.addLine( + -0.08852125812784814, -0.571165474137811, -0.07285119438446976, -0.5729508523825384 +) +SketchLine_9 = Sketch_1.addLine( + -0.07285119438446976, -0.5729508523825384, -0.0654, -0.6028359607518391 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8") -SketchLine_10 = Sketch_1.addLine(-0.0654, -0.6028359607518391, -0.0654, -1.285035960751839) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_10 = Sketch_1.addLine( + -0.0654, -0.6028359607518391, -0.0654, -1.285035960751839 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_9") SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(-0.0654, -1.285035960751839, 0.3076, -1.285035960751839) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchLine_11 = Sketch_1.addLine( + -0.0654, -1.285035960751839, 0.3076, -1.285035960751839 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10") SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_11.result()) SketchLine_12 = Sketch_1.addLine(0.3076, -1.285035960751839, 0.3076, -1.045635960751839) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11") SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_12.result()) -SketchLine_13 = Sketch_1.addLine(0.3076, -1.045635960751839, 0.007599999999999971, -1.045635960751839) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchLine_13 = Sketch_1.addLine( + 0.3076, -1.045635960751839, 0.007599999999999971, -1.045635960751839 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_12") SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_13.result()) -SketchLine_14 = Sketch_1.addLine(0.007599999999999971, -1.045635960751839, 0.007599999999999971, -0.3926359607518392) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchLine_14 = Sketch_1.addLine( + 0.007599999999999971, -1.045635960751839, 0.007599999999999971, -0.3926359607518392 +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_13") SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_14.result()) -SketchLine_15 = Sketch_1.addLine(0.007599999999999971, -0.3926359607518392, 0, -0.3307389278992326) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchLine_15 = Sketch_1.addLine( + 0.007599999999999971, -0.3926359607518392, 0, -0.3307389278992326 +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_14") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_15.endPoint(), SketchLine_2.result() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_21") SketchLine_16 = Sketch_1.addLine(-4.235164485203422e-23, 0.6, 0, -0.3307389278992326) SketchLine_16.setName("SketchLine_20") SketchLine_16.result().setName("SketchLine_20") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.endPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.endPoint() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_23") -SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 0.08939999999999999) +SketchConstraintLength_1 = Sketch_1.setLength( + SketchLine_1.result(), 0.08939999999999999 +) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_3.result(), 0.14) SketchConstraintLength_2.setName("SketchConstraintLength_5") SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_4.result(), 0.2) SketchConstraintLength_3.setName("SketchConstraintLength_6") SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_5.result(), 0.1) SketchConstraintLength_4.setName("SketchConstraintLength_7") -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchLine_3.result() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_24") SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_7.result(), 0.92) SketchConstraintLength_5.setName("SketchConstraintLength_8") @@ -101,216 +153,476 @@ SketchConstraintLength_8 = Sketch_1.setLength(SketchLine_12.result(), 0.2394) SketchConstraintLength_8.setName("SketchConstraintLength_11") SketchConstraintLength_9 = Sketch_1.setLength(SketchLine_13.result(), 0.3) SketchConstraintLength_9.setName("SketchConstraintLength_12") -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_10.startPoint(), SketchLine_7.result(), 0.024, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_10.startPoint(), SketchLine_7.result(), 0.024, True +) SketchPoint_1 = Sketch_1.addPoint(-0.08852125812784814, -0.571165474137811) -SketchLine_17 = Sketch_1.addLine(-0.08940000000000001, -0.5600000000000001, -0.08852125812784814, -0.571165474137811) +SketchLine_17 = Sketch_1.addLine( + -0.08940000000000001, -0.5600000000000001, -0.08852125812784814, -0.571165474137811 +) SketchLine_17.setName("SketchLine_21") SketchLine_17.result().setName("SketchLine_21") -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_7") -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_26") -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchPoint_1.coordinates()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_8.startPoint(), SketchPoint_1.coordinates() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_27") -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_28") -SketchConstraintAngle_1 = Sketch_1.setAngleBackward(SketchLine_10.result(), SketchLine_9.result(), 166) -SketchConstraintAngle_2 = Sketch_1.setAngleBackward(SketchLine_17.result(), SketchLine_8.result(), 101) -SketchConstraintAngle_3 = Sketch_1.setAngleBackward(SketchLine_7.result(), SketchLine_17.result(), 175.5) +SketchConstraintAngle_1 = Sketch_1.setAngleBackward( + SketchLine_10.result(), SketchLine_9.result(), 166 +) +SketchConstraintAngle_2 = Sketch_1.setAngleBackward( + SketchLine_17.result(), SketchLine_8.result(), 101 +) +SketchConstraintAngle_3 = Sketch_1.setAngleBackward( + SketchLine_7.result(), SketchLine_17.result(), 175.5 +) SketchConstraintLength_10 = Sketch_1.setLength(SketchLine_17.result(), 0.0112) SketchConstraintLength_10.setName("SketchConstraintLength_13") SketchConstraintLength_11 = Sketch_1.setLength(SketchLine_9.result(), 0.0308) SketchConstraintLength_11.setName("SketchConstraintLength_14") SketchConstraintLength_12 = Sketch_1.setLength(SketchLine_14.result(), 0.653) SketchConstraintLength_12.setName("SketchConstraintLength_15") -SketchConstraintAngle_4 = Sketch_1.setAngleBackward(SketchLine_14.result(), SketchLine_15.result(), 173) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintAngle_4 = Sketch_1.setAngleBackward( + SketchLine_14.result(), SketchLine_15.result(), 173 +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_18 = SketchProjection_2.createdFeature() SketchLine_18.setName("SketchLine_22") SketchLine_18.result().setName("SketchLine_22") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_18.result(), 0.6, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_18.result(), 0.6, True +) SketchLine_19 = Sketch_1.addLine(-0.08939999999999999, 0.46, -0.08940000000000001, 0.36) SketchLine_19.setName("SketchLine_23") SketchLine_19.result().setName("SketchLine_23") -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_19.startPoint() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_29") -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_19.endPoint()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_19.endPoint() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_30") -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_16.startPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_16.startPoint(), SketchLine_1.startPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_25") model.do() -Sketch_1.changeFacesOrder([[SketchLine_4.result(), SketchLine_5.result(), SketchLine_6.result(), SketchLine_19.result()], - [SketchLine_1.result(), SketchLine_3.result(), SketchLine_19.result(), SketchLine_7.result(), SketchLine_17.result(), SketchLine_8.result(), SketchLine_9.result(), SketchLine_10.result(), SketchLine_11.result(), SketchLine_12.result(), SketchLine_13.result(), SketchLine_14.result(), SketchLine_15.result(), SketchLine_16.result()] - ]) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_23f-SketchLine_7f-SketchLine_21f-SketchLine_8f-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchLine_20r")], model.selection(), "ep", "ep") -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_23r")], model.selection(), "ep2", "ep2") +Sketch_1.changeFacesOrder( + [ + [ + SketchLine_4.result(), + SketchLine_5.result(), + SketchLine_6.result(), + SketchLine_19.result(), + ], + [ + SketchLine_1.result(), + SketchLine_3.result(), + SketchLine_19.result(), + SketchLine_7.result(), + SketchLine_17.result(), + SketchLine_8.result(), + SketchLine_9.result(), + SketchLine_10.result(), + SketchLine_11.result(), + SketchLine_12.result(), + SketchLine_13.result(), + SketchLine_14.result(), + SketchLine_15.result(), + SketchLine_16.result(), + ], + ] +) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_23f-SketchLine_7f-SketchLine_21f-SketchLine_8f-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchLine_20r", + ) + ], + model.selection(), + "ep", + "ep", +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_23r", + ) + ], + model.selection(), + "ep2", + "ep2", +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) -SketchLine_20 = Sketch_2.addLine(-3.021110559767089e-34, 0.6, -0.5875, 0.5401656539390112) +SketchLine_20 = Sketch_2.addLine( + -3.021110559767089e-34, 0.6, -0.5875, 0.5401656539390112 +) SketchLine_20.setName("SketchLine_24") SketchLine_20.result().setName("SketchLine_24") -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), False +) SketchPoint_2 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_20.startPoint(), SketchPoint_2.result()) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchLine_20.startPoint(), SketchPoint_2.result() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_31") -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_20][Extrusion_1_1/To_Face]"), False) +SketchProjection_4 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_20][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_21 = SketchProjection_4.createdFeature() SketchLine_21.setName("SketchLine_25") SketchLine_21.result().setName("SketchLine_25") -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_21.result()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.result() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_32") SketchLine_22 = Sketch_2.addLine(-0.5875, 0.5401656539390112, -0.5875, 0.6) SketchLine_22.setName("SketchLine_26") SketchLine_22.result().setName("SketchLine_26") -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_22.startPoint()) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchLine_20.endPoint(), SketchLine_22.startPoint() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_33") -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_21).startPoint(), SketchLine_22.endPoint()) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchAPI_Line(SketchLine_21).startPoint(), SketchLine_22.endPoint() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_34") -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_20]"), True) +SketchProjection_5 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_20]", + ), + True, +) SketchLine_23 = SketchProjection_5.createdFeature() SketchLine_23.setName("SketchLine_27") SketchLine_23.result().setName("SketchLine_27") -SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_6 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_24 = SketchProjection_6.createdFeature() SketchLine_24.setName("SketchLine_28") SketchLine_24.result().setName("SketchLine_28") -SketchConstraintMirror_1 = Sketch_2.addMirror(SketchLine_24.result(), [SketchLine_20.result(), SketchLine_22.result()]) +SketchConstraintMirror_1 = Sketch_2.addMirror( + SketchLine_24.result(), [SketchLine_20.result(), SketchLine_22.result()] +) [SketchLine_25, SketchLine_26] = SketchConstraintMirror_1.mirrored() SketchLine_26.setName("SketchLine_30") SketchLine_26.result().setName("SketchLine_30") SketchLine_25.setName("SketchLine_29") SketchLine_25.result().setName("SketchLine_29") model.do() -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_2")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_2")], + model.selection(), + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7"), + 0, + model.selection(), + 0, + [model.selection("SOLID", "Extrusion_1_1")], +) Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) -SketchLine_27 = Sketch_3.addLine(-2.319541823598068e-23, 0.1790140882246268, 0.375, 0.1396) +SketchLine_27 = Sketch_3.addLine( + -2.319541823598068e-23, 0.1790140882246268, 0.375, 0.1396 +) SketchLine_27.setName("SketchLine_31") SketchLine_27.result().setName("SketchLine_31") -SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_20"), False) +SketchProjection_7 = Sketch_3.addProjection( + model.selection("EDGE", "Sketch_1/SketchLine_20"), False +) SketchLine_28 = SketchProjection_7.createdFeature() SketchLine_28.setName("SketchLine_32") SketchLine_28.result().setName("SketchLine_32") -SketchConstraintCoincidence_28 = Sketch_3.setCoincident(SketchLine_27.startPoint(), SketchLine_28.result()) +SketchConstraintCoincidence_28 = Sketch_3.setCoincident( + SketchLine_27.startPoint(), SketchLine_28.result() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_35") SketchLine_29 = Sketch_3.addLine(0.375, 0.1396, 3.347, 0.1396) SketchLine_29.setName("SketchLine_33") SketchLine_29.result().setName("SketchLine_33") -SketchConstraintCoincidence_29 = Sketch_3.setCoincident(SketchLine_27.endPoint(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_29 = Sketch_3.setCoincident( + SketchLine_27.endPoint(), SketchLine_29.startPoint() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_36") SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_29.result()) SketchLine_30 = Sketch_3.addLine(3.347, 0.1396, 3.347, 0) SketchLine_30.setName("SketchLine_34") SketchLine_30.result().setName("SketchLine_34") -SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchLine_29.endPoint(), SketchLine_30.startPoint()) +SketchConstraintCoincidence_30 = Sketch_3.setCoincident( + SketchLine_29.endPoint(), SketchLine_30.startPoint() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_37") -SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_8 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_31 = SketchProjection_8.createdFeature() SketchLine_31.setName("SketchLine_35") SketchLine_31.result().setName("SketchLine_35") -SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchLine_30.endPoint(), SketchLine_31.result()) +SketchConstraintCoincidence_31 = Sketch_3.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.result() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_38") SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_30.result()) SketchLine_32 = Sketch_3.addLine(3.347, 0, 0, 0) SketchLine_32.setName("SketchLine_36") SketchLine_32.result().setName("SketchLine_36") -SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchLine_30.endPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_32 = Sketch_3.setCoincident( + SketchLine_30.endPoint(), SketchLine_32.startPoint() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_39") -SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_31).startPoint(), SketchLine_32.endPoint()) +SketchConstraintCoincidence_33 = Sketch_3.setCoincident( + SketchAPI_Line(SketchLine_31).startPoint(), SketchLine_32.endPoint() +) SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_40") SketchLine_33 = Sketch_3.addLine(-2.319541823598068e-23, 0.1790140882246268, 0, 0) SketchLine_33.setName("SketchLine_37") SketchLine_33.result().setName("SketchLine_37") -SketchConstraintCoincidence_34 = Sketch_3.setCoincident(SketchLine_27.startPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_34 = Sketch_3.setCoincident( + SketchLine_27.startPoint(), SketchLine_33.startPoint() +) SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_41") -SketchConstraintCoincidence_35 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_31).startPoint(), SketchLine_33.endPoint()) +SketchConstraintCoincidence_35 = Sketch_3.setCoincident( + SketchAPI_Line(SketchLine_31).startPoint(), SketchLine_33.endPoint() +) SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_42") SketchConstraintLength_13 = Sketch_3.setLength(SketchLine_32.result(), 3.347) SketchConstraintLength_13.setName("SketchConstraintLength_16") -SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_9 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_34 = SketchProjection_9.createdFeature() SketchLine_34.setName("SketchLine_38") SketchLine_34.result().setName("SketchLine_38") -SketchConstraintDistance_3 = Sketch_3.setDistance(SketchLine_27.endPoint(), SketchLine_34.result(), 0.375, True) -SketchConstraintDistance_4 = Sketch_3.setDistance(SketchLine_27.endPoint(), SketchLine_32.result(), 0.1396, True) -SketchConstraintAngle_5 = Sketch_3.setAngle(SketchLine_29.result(), SketchLine_27.result(), 174) +SketchConstraintDistance_3 = Sketch_3.setDistance( + SketchLine_27.endPoint(), SketchLine_34.result(), 0.375, True +) +SketchConstraintDistance_4 = Sketch_3.setDistance( + SketchLine_27.endPoint(), SketchLine_32.result(), 0.1396, True +) +SketchConstraintAngle_5 = Sketch_3.setAngle( + SketchLine_29.result(), SketchLine_27.result(), 174 +) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection("EDGE", "PartSet/OX"), 360, 0) -Fuse_1_objects_1 = [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "ExtrusionCut_1_1"), model.selection("SOLID", "Revolution_1_1")] +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_3")], + model.selection("EDGE", "PartSet/OX"), + 360, + 0, +) +Fuse_1_objects_1 = [ + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "ExtrusionCut_1_1"), + model.selection("SOLID", "Revolution_1_1"), +] Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1, False) -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Fuse_1_1/Modified_Face&Sketch_1/SketchLine_20][Revolution_1_1/Generated_Face&Sketch_3/SketchLine_31]")], 0.05) +Fillet_1 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Sketch_1/SketchLine_20][Revolution_1_1/Generated_Face&Sketch_3/SketchLine_31]", + ) + ], + 0.05, +) Sketch_4 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) SketchLine_35 = Sketch_4.addLine(3.347, 0.183, 3.347, -0.344869487384476) SketchLine_35.setName("SketchLine_39") SketchLine_35.result().setName("SketchLine_39") SketchConstraintVertical_8 = Sketch_4.setVertical(SketchLine_35.result()) -SketchProjection_10 = Sketch_4.addProjection(model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_3/SketchLine_33][Revolution_1_1/Generated_Face&Sketch_3/SketchLine_34]"), False) +SketchProjection_10 = Sketch_4.addProjection( + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_3/SketchLine_33][Revolution_1_1/Generated_Face&Sketch_3/SketchLine_34]", + ), + False, +) SketchPoint_3 = SketchProjection_10.createdFeature() -SketchConstraintCoincidence_36 = Sketch_4.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_35.result()) +SketchConstraintCoincidence_36 = Sketch_4.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_35.result() +) SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_43") SketchLine_36 = Sketch_4.addLine(3.347, 0.183, 3.744000000000001, 0.183) SketchLine_36.setName("SketchLine_40") SketchLine_36.result().setName("SketchLine_40") -SketchConstraintCoincidence_37 = Sketch_4.setCoincident(SketchLine_35.startPoint(), SketchLine_36.startPoint()) +SketchConstraintCoincidence_37 = Sketch_4.setCoincident( + SketchLine_35.startPoint(), SketchLine_36.startPoint() +) SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_44") SketchConstraintHorizontal_7 = Sketch_4.setHorizontal(SketchLine_36.result()) SketchLine_37 = Sketch_4.addLine(3.744000000000001, 0.183, 3.744000000000001, -0.192) SketchLine_37.setName("SketchLine_41") SketchLine_37.result().setName("SketchLine_41") -SketchConstraintCoincidence_38 = Sketch_4.setCoincident(SketchLine_36.endPoint(), SketchLine_37.startPoint()) +SketchConstraintCoincidence_38 = Sketch_4.setCoincident( + SketchLine_36.endPoint(), SketchLine_37.startPoint() +) SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_45") SketchConstraintVertical_9 = Sketch_4.setVertical(SketchLine_37.result()) SketchConstraintLength_14 = Sketch_4.setLength(SketchLine_36.result(), 0.397) SketchConstraintLength_14.setName("SketchConstraintLength_17") SketchConstraintLength_15 = Sketch_4.setLength(SketchLine_37.result(), 0.375) SketchConstraintLength_15.setName("SketchConstraintLength_18") -SketchArc_1 = Sketch_4.addArc(3.665500000000001, -0.192, 3.744000000000001, -0.192, 3.700263973859845, -0.2623826407679625, True) -SketchConstraintCoincidence_39 = Sketch_4.setCoincident(SketchLine_37.endPoint(), SketchArc_1.startPoint()) +SketchArc_1 = Sketch_4.addArc( + 3.665500000000001, + -0.192, + 3.744000000000001, + -0.192, + 3.700263973859845, + -0.2623826407679625, + True, +) +SketchConstraintCoincidence_39 = Sketch_4.setCoincident( + SketchLine_37.endPoint(), SketchArc_1.startPoint() +) SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_46") -SketchConstraintTangent_1 = Sketch_4.setTangent(SketchLine_37.result(), SketchArc_1.results()[1]) -SketchArc_2 = Sketch_4.addArc(3.347, 0.452830512615524, 3.700263973859845, -0.2623826407679625, 3.347, -0.344869487384476, True) -SketchConstraintCoincidence_40 = Sketch_4.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint()) +SketchConstraintTangent_1 = Sketch_4.setTangent( + SketchLine_37.result(), SketchArc_1.results()[1] +) +SketchArc_2 = Sketch_4.addArc( + 3.347, + 0.452830512615524, + 3.700263973859845, + -0.2623826407679625, + 3.347, + -0.344869487384476, + True, +) +SketchConstraintCoincidence_40 = Sketch_4.setCoincident( + SketchArc_1.endPoint(), SketchArc_2.startPoint() +) SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_47") -SketchConstraintTangent_2 = Sketch_4.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1]) -SketchConstraintCoincidence_41 = Sketch_4.setCoincident(SketchArc_2.endPoint(), SketchLine_35.endPoint()) +SketchConstraintTangent_2 = Sketch_4.setTangent( + SketchArc_1.results()[1], SketchArc_2.results()[1] +) +SketchConstraintCoincidence_41 = Sketch_4.setCoincident( + SketchArc_2.endPoint(), SketchLine_35.endPoint() +) SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_48") SketchConstraintRadius_1 = Sketch_4.setRadius(SketchArc_1.results()[1], 0.0785) -SketchProjection_11 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_11 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_38 = SketchProjection_11.createdFeature() SketchLine_38.setName("SketchLine_42") SketchLine_38.result().setName("SketchLine_42") -SketchConstraintDistance_5 = Sketch_4.setDistance(SketchLine_35.startPoint(), SketchLine_38.result(), 0.183, True) -SketchConstraintCoincidence_42 = Sketch_4.setCoincident(SketchArc_2.center(), SketchLine_35.result()) +SketchConstraintDistance_5 = Sketch_4.setDistance( + SketchLine_35.startPoint(), SketchLine_38.result(), 0.183, True +) +SketchConstraintCoincidence_42 = Sketch_4.setCoincident( + SketchArc_2.center(), SketchLine_35.result() +) SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_49") SketchConstraintRadius_2 = Sketch_4.setRadius(SketchArc_2.results()[1], 0.7977) model.do() -Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchLine_39r-SketchArc_2_2f-SketchArc_1_2f-SketchLine_41r-SketchLine_40r")], model.selection("EDGE", "Sketch_4/SketchLine_39"), 360, 0) -Fuse_2 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Fillet_1_1"), model.selection("SOLID", "Revolution_2_1")], False) -Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_2_1/Generated_Face&Sketch_4/SketchLine_40")) -SketchProjection_12 = Sketch_5.addProjection(model.selection("EDGE", "Sketch_4/SketchLine_40"), False) +Revolution_2 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_4/Face-SketchLine_39r-SketchArc_2_2f-SketchArc_1_2f-SketchLine_41r-SketchLine_40r", + ) + ], + model.selection("EDGE", "Sketch_4/SketchLine_39"), + 360, + 0, +) +Fuse_2 = model.addFuse( + Part_1_doc, + [ + model.selection("SOLID", "Fillet_1_1"), + model.selection("SOLID", "Revolution_2_1"), + ], + False, +) +Sketch_5 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Revolution_2_1/Generated_Face&Sketch_4/SketchLine_40"), +) +SketchProjection_12 = Sketch_5.addProjection( + model.selection("EDGE", "Sketch_4/SketchLine_40"), False +) SketchLine_39 = SketchProjection_12.createdFeature() SketchLine_39.setName("SketchLine_43") SketchLine_39.result().setName("SketchLine_43") SketchCircle_1 = Sketch_5.addCircle(3.447, 0, 0.02725) -SketchConstraintCoincidence_43 = Sketch_5.setCoincident(SketchLine_39.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_43 = Sketch_5.setCoincident( + SketchLine_39.result(), SketchCircle_1.center() +) SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_50") SketchConstraintRadius_3 = Sketch_5.setRadius(SketchCircle_1.results()[1], 0.02725) -SketchConstraintDistance_6 = Sketch_5.setDistance(SketchAPI_Line(SketchLine_39).startPoint(), SketchCircle_1.center(), 0.1, True) +SketchConstraintDistance_6 = Sketch_5.setDistance( + SketchAPI_Line(SketchLine_39).startPoint(), SketchCircle_1.center(), 0.1, True +) model.do() -ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_5")], model.selection(), 0.1123, 0, [model.selection("SOLID", "Fuse_2_1")]) +ExtrusionFuse_1 = model.addExtrusionFuse( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_5")], + model.selection(), + 0.1123, + 0, + [model.selection("SOLID", "Fuse_2_1")], +) Sketch_6 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchProjection_13 = Sketch_6.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_13 = Sketch_6.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_40 = SketchProjection_13.createdFeature() SketchLine_40.setName("SketchLine_44") SketchLine_40.result().setName("SketchLine_44") SketchCircle_2 = Sketch_6.addCircle(3.347, 0, 0.0535464) SketchConstraintRadius_4 = Sketch_6.setRadius(SketchCircle_2.results()[1], 0.0535464) -SketchIntersectionPoint_1 = Sketch_6.addIntersectionPoint(model.selection("EDGE", "Sketch_4/SketchLine_39"), False) +SketchIntersectionPoint_1 = Sketch_6.addIntersectionPoint( + model.selection("EDGE", "Sketch_4/SketchLine_39"), False +) [SketchPoint_4] = SketchIntersectionPoint_1.intersectionPoints() -SketchConstraintCoincidence_44 = Sketch_6.setCoincident(SketchCircle_2.center(), SketchAPI_Point(SketchPoint_4).coordinates()) +SketchConstraintCoincidence_44 = Sketch_6.setCoincident( + SketchCircle_2.center(), SketchAPI_Point(SketchPoint_4).coordinates() +) SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_51") model.do() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_6/Face-SketchCircle_2_2f")], model.selection(), 0, 0.5586) -Fuse_3 = model.addFuse(Part_1_doc, [model.selection("SOLID", "ExtrusionFuse_1_1"), model.selection("SOLID", "Extrusion_3_1")], False) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 1.2912, False) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_6/Face-SketchCircle_2_2f")], + model.selection(), + 0, + 0.5586, +) +Fuse_3 = model.addFuse( + Part_1_doc, + [ + model.selection("SOLID", "ExtrusionFuse_1_1"), + model.selection("SOLID", "Extrusion_3_1"), + ], + False, +) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 1.2912, False +) Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) SketchLine_41 = Sketch_7.addLine(-0.80851, 0.003178, -0.80851, 0.253178) SketchLine_41.setName("SketchLine_45") @@ -319,39 +631,63 @@ SketchConstraintVertical_10 = Sketch_7.setVertical(SketchLine_41.result()) SketchLine_42 = Sketch_7.addLine(-0.80851, 0.253178, -0.80851, 0.003178) SketchLine_42.setName("SketchLine_46") SketchLine_42.result().setName("SketchLine_46") -SketchConstraintCoincidence_45 = Sketch_7.setCoincident(SketchLine_41.endPoint(), SketchLine_42.startPoint()) +SketchConstraintCoincidence_45 = Sketch_7.setCoincident( + SketchLine_41.endPoint(), SketchLine_42.startPoint() +) SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_52") -SketchConstraintCoincidence_46 = Sketch_7.setCoincident(SketchLine_41.startPoint(), SketchLine_42.endPoint()) +SketchConstraintCoincidence_46 = Sketch_7.setCoincident( + SketchLine_41.startPoint(), SketchLine_42.endPoint() +) SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_53") -SketchProjection_14 = Sketch_7.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_14 = Sketch_7.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_43 = SketchProjection_14.createdFeature() SketchLine_43.setName("SketchLine_47") SketchLine_43.result().setName("SketchLine_47") -SketchProjection_15 = Sketch_7.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_15 = Sketch_7.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_44 = SketchProjection_15.createdFeature() SketchLine_44.setName("SketchLine_48") SketchLine_44.result().setName("SketchLine_48") -SketchConstraintDistance_7 = Sketch_7.setDistance(SketchLine_41.startPoint(), SketchLine_43.result(), 0.80851, True) +SketchConstraintDistance_7 = Sketch_7.setDistance( + SketchLine_41.startPoint(), SketchLine_43.result(), 0.80851, True +) SketchConstraintDistance_7.setName("SketchConstraintDistance_8") SketchConstraintLength_16 = Sketch_7.setLength(SketchLine_41.result(), 0.25) SketchConstraintLength_16.setName("SketchConstraintLength_19") -SketchArc_3 = Sketch_7.addArc(-0.7325, 0.253178, -0.80851, 0.253178, -0.7325, 0.3291879999999999, True) -SketchConstraintCoincidence_47 = Sketch_7.setCoincident(SketchLine_41.endPoint(), SketchArc_3.startPoint()) +SketchArc_3 = Sketch_7.addArc( + -0.7325, 0.253178, -0.80851, 0.253178, -0.7325, 0.3291879999999999, True +) +SketchConstraintCoincidence_47 = Sketch_7.setCoincident( + SketchLine_41.endPoint(), SketchArc_3.startPoint() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_54") -SketchConstraintTangent_3 = Sketch_7.setTangent(SketchLine_41.result(), SketchArc_3.results()[1]) +SketchConstraintTangent_3 = Sketch_7.setTangent( + SketchLine_41.result(), SketchArc_3.results()[1] +) SketchLine_45 = Sketch_7.addLine(-0.7325, 0.253178, -0.7325, 0.3291879999999999) SketchLine_45.setName("SketchLine_49") SketchLine_45.result().setName("SketchLine_49") SketchLine_45.setAuxiliary(True) -SketchConstraintCoincidence_48 = Sketch_7.setCoincident(SketchArc_3.center(), SketchLine_45.startPoint()) +SketchConstraintCoincidence_48 = Sketch_7.setCoincident( + SketchArc_3.center(), SketchLine_45.startPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_55") -SketchConstraintCoincidence_49 = Sketch_7.setCoincident(SketchArc_3.endPoint(), SketchLine_45.endPoint()) +SketchConstraintCoincidence_49 = Sketch_7.setCoincident( + SketchArc_3.endPoint(), SketchLine_45.endPoint() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_56") SketchConstraintVertical_11 = Sketch_7.setVertical(SketchLine_45.result()) -SketchLine_46 = Sketch_7.addLine(-0.7325, 0.3291879999999999, -0.6591320000000001, 0.3291879999999999) +SketchLine_46 = Sketch_7.addLine( + -0.7325, 0.3291879999999999, -0.6591320000000001, 0.3291879999999999 +) SketchLine_46.setName("SketchLine_50") SketchLine_46.result().setName("SketchLine_50") -SketchConstraintCoincidence_50 = Sketch_7.setCoincident(SketchArc_3.endPoint(), SketchLine_46.startPoint()) +SketchConstraintCoincidence_50 = Sketch_7.setCoincident( + SketchArc_3.endPoint(), SketchLine_46.startPoint() +) SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_57") SketchConstraintHorizontal_8 = Sketch_7.setHorizontal(SketchLine_46.result()) SketchConstraintLength_17 = Sketch_7.setLength(SketchLine_46.result(), 0.073368) @@ -359,118 +695,265 @@ SketchConstraintLength_17.setName("SketchConstraintLength_20") SketchLine_47 = Sketch_7.addLine(-0.4815101245041479, 0.278, 0, -1.355252715606881e-20) SketchLine_47.setName("SketchLine_51") SketchLine_47.result().setName("SketchLine_51") -SketchLine_48 = Sketch_7.addLine(0, -1.355252715606881e-20, -0.3375518398718391, -1.355252715606881e-20) +SketchLine_48 = Sketch_7.addLine( + 0, -1.355252715606881e-20, -0.3375518398718391, -1.355252715606881e-20 +) SketchLine_48.setName("SketchLine_52") SketchLine_48.result().setName("SketchLine_52") SketchLine_48.setAuxiliary(True) -SketchConstraintCoincidence_51 = Sketch_7.setCoincident(SketchLine_47.endPoint(), SketchLine_48.startPoint()) +SketchConstraintCoincidence_51 = Sketch_7.setCoincident( + SketchLine_47.endPoint(), SketchLine_48.startPoint() +) SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_58") SketchConstraintHorizontal_9 = Sketch_7.setHorizontal(SketchLine_48.result()) -SketchConstraintAngle_6 = Sketch_7.setAngle(SketchLine_47.result(), SketchLine_48.result(), 30) -SketchConstraintCoincidence_52 = Sketch_7.setCoincident(SketchLine_47.endPoint(), SketchAPI_Line(SketchLine_44).startPoint()) +SketchConstraintAngle_6 = Sketch_7.setAngle( + SketchLine_47.result(), SketchLine_48.result(), 30 +) +SketchConstraintCoincidence_52 = Sketch_7.setCoincident( + SketchLine_47.endPoint(), SketchAPI_Line(SketchLine_44).startPoint() +) SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_59") -SketchConstraintDistance_8 = Sketch_7.setDistance(SketchLine_47.startPoint(), SketchLine_44.result(), 0.278, True) +SketchConstraintDistance_8 = Sketch_7.setDistance( + SketchLine_47.startPoint(), SketchLine_44.result(), 0.278, True +) SketchConstraintDistance_8.setName("SketchConstraintDistance_9") -SketchConstraintDistance_9 = Sketch_7.setDistance(SketchLine_45.startPoint(), SketchLine_43.result(), 0.7325, True) +SketchConstraintDistance_9 = Sketch_7.setDistance( + SketchLine_45.startPoint(), SketchLine_43.result(), 0.7325, True +) SketchConstraintDistance_9.setName("SketchConstraintDistance_10") -SketchArc_4 = Sketch_7.addArc(-0.6591320000000001, -0.004579113372898896, -0.6591320000000001, 0.3291879999999999, -0.4815101245041478, 0.278, True) -SketchConstraintCoincidence_53 = Sketch_7.setCoincident(SketchLine_46.endPoint(), SketchArc_4.startPoint()) +SketchArc_4 = Sketch_7.addArc( + -0.6591320000000001, + -0.004579113372898896, + -0.6591320000000001, + 0.3291879999999999, + -0.4815101245041478, + 0.278, + True, +) +SketchConstraintCoincidence_53 = Sketch_7.setCoincident( + SketchLine_46.endPoint(), SketchArc_4.startPoint() +) SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_60") -SketchConstraintTangent_4 = Sketch_7.setTangent(SketchLine_46.result(), SketchArc_4.results()[1]) -SketchConstraintCoincidence_54 = Sketch_7.setCoincident(SketchArc_4.endPoint(), SketchLine_47.startPoint()) +SketchConstraintTangent_4 = Sketch_7.setTangent( + SketchLine_46.result(), SketchArc_4.results()[1] +) +SketchConstraintCoincidence_54 = Sketch_7.setCoincident( + SketchArc_4.endPoint(), SketchLine_47.startPoint() +) SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_61") -SketchConstraintDistance_10 = Sketch_7.setDistance(SketchLine_41.startPoint(), SketchLine_48.result(), 0.003178, True) +SketchConstraintDistance_10 = Sketch_7.setDistance( + SketchLine_41.startPoint(), SketchLine_48.result(), 0.003178, True +) SketchConstraintDistance_10.setName("SketchConstraintDistance_13") model.do() -Plane_5 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OZ"), model.selection("VERTEX", "Sketch_7/SketchLine_45_StartVertex"), True) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "PartSet/OZ"), + model.selection("VERTEX", "Sketch_7/SketchLine_45_StartVertex"), + True, +) Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2")) -SketchProjection_16 = Sketch_8.addProjection(model.selection("VERTEX", "Sketch_7/SketchLine_45_StartVertex"), False) +SketchProjection_16 = Sketch_8.addProjection( + model.selection("VERTEX", "Sketch_7/SketchLine_45_StartVertex"), False +) SketchPoint_5 = SketchProjection_16.createdFeature() SketchCircle_3 = Sketch_8.addCircle(1.2912, -0.80851, 0.02655) -SketchConstraintCoincidence_55 = Sketch_8.setCoincident(SketchPoint_5.result(), SketchCircle_3.center()) +SketchConstraintCoincidence_55 = Sketch_8.setCoincident( + SketchPoint_5.result(), SketchCircle_3.center() +) SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_62") SketchConstraintRadius_5 = Sketch_8.setRadius(SketchCircle_3.results()[1], 0.02655) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchCircle_3_2f")]) -Wire_1_objects = [model.selection("EDGE", "Sketch_7/SketchLine_45"), model.selection("EDGE", "Sketch_7/SketchArc_3_2"), model.selection("EDGE", "Sketch_7/SketchLine_50"), model.selection("EDGE", "Sketch_7/SketchArc_4_2"), model.selection("EDGE", "Sketch_7/SketchLine_51")] +Face_1 = model.addFace( + Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchCircle_3_2f")] +) +Wire_1_objects = [ + model.selection("EDGE", "Sketch_7/SketchLine_45"), + model.selection("EDGE", "Sketch_7/SketchArc_3_2"), + model.selection("EDGE", "Sketch_7/SketchLine_50"), + model.selection("EDGE", "Sketch_7/SketchArc_4_2"), + model.selection("EDGE", "Sketch_7/SketchLine_51"), +] Wire_1 = model.addWire(Part_1_doc, Wire_1_objects) -Pipe_1 = model.addPipe(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("WIRE", "Wire_1_1")) -Fuse_4 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Pipe_1_1"), model.selection("SOLID", "Fuse_3_1")], False) -Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 1.1407, True) +Pipe_1 = model.addPipe( + Part_1_doc, + [model.selection("FACE", "Face_1_1")], + model.selection("WIRE", "Wire_1_1"), +) +Fuse_4 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Pipe_1_1"), model.selection("SOLID", "Fuse_3_1")], + False, +) +Plane_6 = model.addPlane( + Part_1_doc, model.selection("FACE", "PartSet/XOY"), 1.1407, True +) Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_3")) SketchLine_49 = Sketch_9.addLine(0.5219, -0.3643, 0.5219, -0.1143) SketchLine_49.setName("SketchLine_53") SketchLine_49.result().setName("SketchLine_53") SketchConstraintVertical_12 = Sketch_9.setVertical(SketchLine_49.result()) -SketchProjection_17 = Sketch_9.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_17 = Sketch_9.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_50 = SketchProjection_17.createdFeature() SketchLine_50.setName("SketchLine_54") SketchLine_50.result().setName("SketchLine_54") -SketchProjection_18 = Sketch_9.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_18 = Sketch_9.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_51 = SketchProjection_18.createdFeature() SketchLine_51.setName("SketchLine_55") SketchLine_51.result().setName("SketchLine_55") -SketchConstraintDistance_11 = Sketch_9.setDistance(SketchLine_49.endPoint(), SketchLine_50.result(), 0.5219, True) +SketchConstraintDistance_11 = Sketch_9.setDistance( + SketchLine_49.endPoint(), SketchLine_50.result(), 0.5219, True +) SketchConstraintDistance_11.setName("SketchConstraintDistance_11") -SketchConstraintDistance_12 = Sketch_9.setDistance(SketchLine_49.startPoint(), SketchLine_51.result(), 0.3643, True) +SketchConstraintDistance_12 = Sketch_9.setDistance( + SketchLine_49.startPoint(), SketchLine_51.result(), 0.3643, True +) SketchConstraintDistance_12.setName("SketchConstraintDistance_12") SketchConstraintLength_18 = Sketch_9.setLength(SketchLine_49.result(), 0.25) SketchConstraintLength_18.setName("SketchConstraintLength_21") -SketchArc_5 = Sketch_9.addArc(0.4075999999999999, -0.1143, 0.5219, -0.1143, 0.4075999999999999, 2.344010062074957e-33, False) -SketchConstraintCoincidence_56 = Sketch_9.setCoincident(SketchLine_49.endPoint(), SketchArc_5.startPoint()) +SketchArc_5 = Sketch_9.addArc( + 0.4075999999999999, + -0.1143, + 0.5219, + -0.1143, + 0.4075999999999999, + 2.344010062074957e-33, + False, +) +SketchConstraintCoincidence_56 = Sketch_9.setCoincident( + SketchLine_49.endPoint(), SketchArc_5.startPoint() +) SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_63") -SketchConstraintTangent_5 = Sketch_9.setTangent(SketchLine_49.result(), SketchArc_5.results()[1]) -SketchLine_52 = Sketch_9.addLine(0.4075999999999999, 2.344010062074957e-33, 0, -1.207680510878222e-22) +SketchConstraintTangent_5 = Sketch_9.setTangent( + SketchLine_49.result(), SketchArc_5.results()[1] +) +SketchLine_52 = Sketch_9.addLine( + 0.4075999999999999, 2.344010062074957e-33, 0, -1.207680510878222e-22 +) SketchLine_52.setName("SketchLine_56") SketchLine_52.result().setName("SketchLine_56") -SketchConstraintCoincidence_57 = Sketch_9.setCoincident(SketchArc_5.endPoint(), SketchLine_52.startPoint()) +SketchConstraintCoincidence_57 = Sketch_9.setCoincident( + SketchArc_5.endPoint(), SketchLine_52.startPoint() +) SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_64") SketchConstraintHorizontal_10 = Sketch_9.setHorizontal(SketchLine_52.result()) -SketchConstraintCoincidence_58 = Sketch_9.setCoincident(SketchLine_52.endPoint(), SketchAPI_Line(SketchLine_50).startPoint()) +SketchConstraintCoincidence_58 = Sketch_9.setCoincident( + SketchLine_52.endPoint(), SketchAPI_Line(SketchLine_50).startPoint() +) SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_65") -SketchLine_53 = Sketch_9.addLine(0.4075999999999999, 2.344010062074957e-33, 0.4075999999999999, -0.1143) +SketchLine_53 = Sketch_9.addLine( + 0.4075999999999999, 2.344010062074957e-33, 0.4075999999999999, -0.1143 +) SketchLine_53.setName("SketchLine_57") SketchLine_53.result().setName("SketchLine_57") SketchLine_53.setAuxiliary(True) -SketchConstraintCoincidence_59 = Sketch_9.setCoincident(SketchArc_5.endPoint(), SketchLine_53.startPoint()) +SketchConstraintCoincidence_59 = Sketch_9.setCoincident( + SketchArc_5.endPoint(), SketchLine_53.startPoint() +) SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_66") -SketchConstraintCoincidence_60 = Sketch_9.setCoincident(SketchArc_5.center(), SketchLine_53.endPoint()) +SketchConstraintCoincidence_60 = Sketch_9.setCoincident( + SketchArc_5.center(), SketchLine_53.endPoint() +) SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_67") SketchConstraintVertical_13 = Sketch_9.setVertical(SketchLine_53.result()) model.do() -Plane_7 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OY"), model.selection("VERTEX", "Sketch_9/SketchLine_53_StartVertex"), True) +Plane_7 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "PartSet/OY"), + model.selection("VERTEX", "Sketch_9/SketchLine_53_StartVertex"), + True, +) Sketch_10 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_4")) -SketchProjection_19 = Sketch_10.addProjection(model.selection("VERTEX", "Sketch_9/SketchLine_53_StartVertex"), False) +SketchProjection_19 = Sketch_10.addProjection( + model.selection("VERTEX", "Sketch_9/SketchLine_53_StartVertex"), False +) SketchPoint_6 = SketchProjection_19.createdFeature() SketchCircle_4 = Sketch_10.addCircle(0.5219, 1.1407, 0.05355) -SketchConstraintCoincidence_61 = Sketch_10.setCoincident(SketchPoint_6.result(), SketchCircle_4.center()) +SketchConstraintCoincidence_61 = Sketch_10.setCoincident( + SketchPoint_6.result(), SketchCircle_4.center() +) SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_68") SketchConstraintRadius_6 = Sketch_10.setRadius(SketchCircle_4.results()[1], 0.05355) model.do() -Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_10/SketchCircle_4_2")]) -Wire_2_objects = [model.selection("EDGE", "Sketch_9/SketchLine_53"), model.selection("EDGE", "Sketch_9/SketchArc_5_2"), model.selection("EDGE", "Sketch_9/SketchLine_56")] +Face_2 = model.addFace( + Part_1_doc, [model.selection("EDGE", "Sketch_10/SketchCircle_4_2")] +) +Wire_2_objects = [ + model.selection("EDGE", "Sketch_9/SketchLine_53"), + model.selection("EDGE", "Sketch_9/SketchArc_5_2"), + model.selection("EDGE", "Sketch_9/SketchLine_56"), +] Wire_2 = model.addWire(Part_1_doc, Wire_2_objects) -Pipe_2 = model.addPipe(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("WIRE", "Wire_2_1")) -Fuse_5 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Pipe_2_1"), model.selection("SOLID", "Fuse_4_1")], False) -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Fuse_5_1")], model.selection("FACE", "PartSet/YOZ"), False) -Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_1_1")], model.selection("FACE", "PartSet/XOZ"), False) -Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Symmetry_2_1/MF:Symmetried&Pipe_2_1/From_Face_1")]) +Pipe_2 = model.addPipe( + Part_1_doc, + [model.selection("FACE", "Face_2_1")], + model.selection("WIRE", "Wire_2_1"), +) +Fuse_5 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Pipe_2_1"), model.selection("SOLID", "Fuse_4_1")], + False, +) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Fuse_5_1")], + model.selection("FACE", "PartSet/YOZ"), + False, +) +Symmetry_2 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Symmetry_1_1")], + model.selection("FACE", "PartSet/XOZ"), + False, +) +Group_1 = model.addGroup( + Part_1_doc, + "Faces", + [model.selection("FACE", "Symmetry_2_1/MF:Symmetried&Pipe_2_1/From_Face_1")], +) Group_1.setName("Outlet_1") Group_1.result().setName("Outlet_1") -Group_2 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Symmetry_2_1/MF:Symmetried&Pipe_1_1/From_Face_1")]) +Group_2 = model.addGroup( + Part_1_doc, + "Faces", + [model.selection("FACE", "Symmetry_2_1/MF:Symmetried&Pipe_1_1/From_Face_1")], +) Group_2.setName("Inlet_1") Group_2.result().setName("Inlet_1") -Group_3 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Symmetry_2_1/MF:Symmetried&Extrusion_3_1/From_Face")]) +Group_3 = model.addGroup( + Part_1_doc, + "Faces", + [model.selection("FACE", "Symmetry_2_1/MF:Symmetried&Extrusion_3_1/From_Face")], +) Group_3.setName("Outlet_2") Group_3.result().setName("Outlet_2") -Group_4 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Symmetry_2_1/MF:Symmetried&ExtrusionFuse_1_1/To_Face")]) +Group_4 = model.addGroup( + Part_1_doc, + "Faces", + [model.selection("FACE", "Symmetry_2_1/MF:Symmetried&ExtrusionFuse_1_1/To_Face")], +) Group_4.setName("Inlet_2") Group_4.result().setName("Inlet_2") -Group_5 = model.addGroup(Part_1_doc, "Faces", [model.selection("SOLID", "Symmetry_2_1")]) +Group_5 = model.addGroup( + Part_1_doc, "Faces", [model.selection("SOLID", "Symmetry_2_1")] +) Group_5.setName("Group_faces") Group_5.result().setName("Group_faces") -GroupSubstraction_1_objects_2 = [model.selection("COMPOUND", "Outlet_1"), model.selection("COMPOUND", "Inlet_1"), model.selection("COMPOUND", "Outlet_2"), model.selection("COMPOUND", "Inlet_2")] -GroupSubstraction_1 = model.addGroupSubstraction(Part_1_doc, [model.selection("COMPOUND", "Group_faces")], GroupSubstraction_1_objects_2) +GroupSubstraction_1_objects_2 = [ + model.selection("COMPOUND", "Outlet_1"), + model.selection("COMPOUND", "Inlet_1"), + model.selection("COMPOUND", "Outlet_2"), + model.selection("COMPOUND", "Inlet_2"), +] +GroupSubstraction_1 = model.addGroupSubstraction( + Part_1_doc, + [model.selection("COMPOUND", "Group_faces")], + GroupSubstraction_1_objects_2, +) GroupSubstraction_1.result().setName("Wall") model.end() @@ -485,16 +968,19 @@ model.testNbSubShapes(Symmetry_2, GeomAPI_Shape.VERTEX, [384]) model.testResultsVolumes(Symmetry_2, [0.714262940088946862715602037]) from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() # Check that the features are not in error for i in range(Part_1_doc.size("Features")): - feature = objectToFeature(Part_1_doc.object("Features", i)) - name = feature.name() - error = feature.error() - assert(error == ''), "The feature {0} is in error: {1}".format(name, error) - assert(aFactory.validate(feature)), "The feature {0} is in error: {1}".format(name, error) + feature = objectToFeature(Part_1_doc.object("Features", i)) + name = feature.name() + error = feature.error() + assert error == "", "The feature {0} is in error: {1}".format(name, error) + assert aFactory.validate(feature), "The feature {0} is in error: {1}".format( + name, error + ) -assert(Part_1_doc.size("Groups") == 6) +assert Part_1_doc.size("Groups") == 6 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelHighAPI/Test/Test19031.py b/src/ModelHighAPI/Test/Test19031.py index 1b21f3b9e..0dc763098 100644 --- a/src/ModelHighAPI/Test/Test19031.py +++ b/src/ModelHighAPI/Test/Test19031.py @@ -34,152 +34,400 @@ model.addParameter(Part_1_doc, "rib3", "13") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(193.5527547665121, 217.4086484957226, 25.4) SketchCircle_2 = Sketch_1.addCircle(193.5527547665121, 217.4086484957226, 38) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchCircle_2.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchCircle_2.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], 38) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchCircle_1.results()[1], 25.4) -SketchLine_1 = Sketch_1.addLine(231.5527547665122, 217.4085749004042, 231.5527547665122, 96.40864849572259) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_2.results()[1]) -SketchLine_2 = Sketch_1.addLine(212.5527547665122, 77.40864849572259, 79.55275476651215, 77.40864849572259) -SketchLine_3 = Sketch_1.addLine(79.55275476651215, 77.40864849572259, -35.01044899266839, 119.578215062531) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchArc_1 = Sketch_1.addArc(-28.44724523348785, 137.4086484957226, -35.01044899266839, 119.578215062531, -28.44724523348786, 156.4086484957226, True) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.startPoint()) -SketchLine_4 = Sketch_1.addLine(-28.44724523348786, 156.4086484957226, 96.55275476651215, 156.4086484957226) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(193.5527547665121, 217.4086484957226, 193.5527547665121, 96.40864849572259) +SketchLine_1 = Sketch_1.addLine( + 231.5527547665122, 217.4085749004042, 231.5527547665122, 96.40864849572259 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_2.results()[1] +) +SketchLine_2 = Sketch_1.addLine( + 212.5527547665122, 77.40864849572259, 79.55275476651215, 77.40864849572259 +) +SketchLine_3 = Sketch_1.addLine( + 79.55275476651215, 77.40864849572259, -35.01044899266839, 119.578215062531 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchArc_1 = Sketch_1.addArc( + -28.44724523348785, + 137.4086484957226, + -35.01044899266839, + 119.578215062531, + -28.44724523348786, + 156.4086484957226, + True, +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_1.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -28.44724523348786, 156.4086484957226, 96.55275476651215, 156.4086484957226 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + 193.5527547665121, 217.4086484957226, 193.5527547665121, 96.40864849572259 +) SketchLine_5.setAuxiliary(True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(193.5527547665121, 96.40864849572259, -186.9071792634899, 96.40864849572259) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + 193.5527547665121, 96.40864849572259, -186.9071792634899, 96.40864849572259 +) SketchLine_6.setAuxiliary(True) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_6.result()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_1.results()[1]) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_1.results()[1]) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_4.result(), SketchArc_1.results()[1] +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_1.results()[1] +) SketchCircle_3 = Sketch_1.addCircle(-28.44724523348785, 137.4086484957226, 7) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_1.center(), SketchCircle_3.center()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchCircle_3.center() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_1.result()) -SketchArc_2 = Sketch_1.addArc(212.5527547665122, 96.40864849572259, 212.5527547665122, 77.40864849572259, 231.5527547665122, 96.40864849572259, False) +SketchArc_2 = Sketch_1.addArc( + 212.5527547665122, + 96.40864849572259, + 212.5527547665122, + 77.40864849572259, + 231.5527547665122, + 96.40864849572259, + False, +) SketchArc_2.setName("SketchArc_3") SketchArc_2.result().setName("SketchArc_3") SketchArc_2.results()[1].setName("SketchArc_3_2") SketchPoint_1 = Sketch_1.addPoint(231.5527547665122, 77.4086484957226) SketchPoint_1.setAuxiliary(True) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_5.startPoint(), SketchPoint_1.coordinates(), 140) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_2.result()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_1.endPoint()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_1.result()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_2.result()) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_5.startPoint(), SketchPoint_1.coordinates(), 140 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_1.result() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_2.result() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_1.endPoint() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_1.result() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_2.result() +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_2.results()[1], 19) SketchCircle_4 = Sketch_1.addCircle(212.5527547665122, 96.40864849572259, 7) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_2.center(), SketchCircle_4.center()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchCircle_4.center() +) SketchCircle_5 = Sketch_1.addCircle(149.5527547665122, 137.4086484957226, 7) -SketchLine_7 = Sketch_1.addLine(149.5527547665122, 137.4086484957226, -36.17794869484125, 137.4086484957226) +SketchLine_7 = Sketch_1.addLine( + 149.5527547665122, 137.4086484957226, -36.17794869484125, 137.4086484957226 +) SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchCircle_5.center(), SketchLine_7.startPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_7.result(), SketchLine_6.result()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_7.result()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchCircle_5.center(), SketchLine_7.startPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_7.result(), SketchLine_6.result() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_7.result() +) SketchCircle_6 = Sketch_1.addCircle(79.55275476651215, 96.4086484957226, 7) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_6.result(), SketchCircle_6.center()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_6.result(), SketchCircle_6.center() +) SketchCircle_7 = Sketch_1.addCircle(-3.447245233487854, 124.4086484957226, 5) SketchCircle_8 = Sketch_1.addCircle(174.5527547665122, 96.4086484957226, 5) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_6.result(), SketchCircle_8.center()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_3.results()[1], SketchCircle_6.results()[1]) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchCircle_6.results()[1], SketchCircle_5.results()[1]) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchCircle_5.results()[1], SketchCircle_4.results()[1]) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_1.center(), SketchCircle_4.center(), 241) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_6.result(), SketchCircle_8.center() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchCircle_3.results()[1], SketchCircle_6.results()[1] +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchCircle_6.results()[1], SketchCircle_5.results()[1] +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchCircle_5.results()[1], SketchCircle_4.results()[1] +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchArc_1.center(), SketchCircle_4.center(), 241 +) SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_3.results()[1], 7) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchCircle_8.results()[1], SketchCircle_7.results()[1]) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchCircle_8.results()[1], SketchCircle_7.results()[1] +) SketchConstraintRadius_5 = Sketch_1.setRadius(SketchCircle_7.results()[1], 5) -SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_3.startPoint(), SketchCircle_3.center(), 108) -SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance(SketchLine_3.startPoint(), SketchLine_7.startPoint(), 70) -SketchConstraintDistanceHorizontal_4 = Sketch_1.setHorizontalDistance(SketchCircle_8.center(), SketchLine_7.startPoint(), 25) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.startPoint(), SketchLine_6.result(), 19, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_7.result(), SketchCircle_6.center(), 41, True) -SketchLine_8 = Sketch_1.addLine(79.55275476651215, 77.40864849572259, 79.55275476651215, 115.4086484957226) +SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance( + SketchLine_3.startPoint(), SketchCircle_3.center(), 108 +) +SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance( + SketchLine_3.startPoint(), SketchLine_7.startPoint(), 70 +) +SketchConstraintDistanceHorizontal_4 = Sketch_1.setHorizontalDistance( + SketchCircle_8.center(), SketchLine_7.startPoint(), 25 +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.startPoint(), SketchLine_6.result(), 19, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_7.result(), SketchCircle_6.center(), 41, True +) +SketchLine_8 = Sketch_1.addLine( + 79.55275476651215, 77.40864849572259, 79.55275476651215, 115.4086484957226 +) SketchLine_8.setAuxiliary(True) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_8.startPoint() +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_8.result(), SketchCircle_6.center()) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchCircle_7.center(), SketchLine_7.result(), 13, True) -SketchConstraintDistanceHorizontal_5 = Sketch_1.setHorizontalDistance(SketchArc_1.center(), SketchCircle_7.center(), 25) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchLine_8.result(), SketchCircle_6.center() +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchCircle_7.center(), SketchLine_7.result(), 13, True +) +SketchConstraintDistanceHorizontal_5 = Sketch_1.setHorizontalDistance( + SketchArc_1.center(), SketchCircle_7.center(), 25 +) SketchConstraintRadius_6 = Sketch_1.setRadius(SketchArc_1.results()[1], 19) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_4.result()) -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchLine_1.result(), SketchCircle_2.results()[1]) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchLine_1.result(), SketchCircle_2.results()[1] +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), 125) -SketchArc_3 = Sketch_1.addArc(96.55275476651215, 215.5823348515451, 96.55275476651215, 156.4086484957226, 155.6041596876128, 219.3845360273737, False) +SketchArc_3 = Sketch_1.addArc( + 96.55275476651215, + 215.5823348515451, + 96.55275476651215, + 156.4086484957226, + 155.6041596876128, + 219.3845360273737, + False, +) SketchArc_3.setName("SketchArc_5") SketchArc_3.result().setName("SketchArc_5") SketchArc_3.results()[1].setName("SketchArc_5_2") -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_6 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_3.results()[1]) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchCircle_2.results()[1], SketchArc_3.endPoint()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_6 = Sketch_1.setTangent( + SketchLine_4.result(), SketchArc_3.results()[1] +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchCircle_2.results()[1], SketchArc_3.endPoint() +) model.do() -Sketch_1.changeFacesOrder([[SketchCircle_1.results()[1]], - [SketchCircle_2.results()[1], SketchCircle_2.results()[1], SketchArc_3.results()[1], SketchCircle_2.results()[1], SketchCircle_1.results()[1]], - [SketchCircle_4.results()[1]], - [SketchCircle_5.results()[1]], - [SketchCircle_6.results()[1]], - [SketchCircle_7.results()[1]], - [SketchCircle_8.results()[1]], - [SketchCircle_2.results()[1], SketchArc_3.results()[1]], - [SketchCircle_3.results()[1]], - [SketchArc_3.results()[1], SketchLine_4.result(), SketchArc_1.results()[1], SketchLine_3.result(), SketchLine_2.result(), SketchArc_2.results()[1], SketchLine_1.result(), SketchCircle_2.results()[1], SketchCircle_3.results()[1], SketchCircle_4.results()[1], SketchCircle_5.results()[1], SketchCircle_6.results()[1], SketchCircle_7.results()[1], SketchCircle_8.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [SketchCircle_1.results()[1]], + [ + SketchCircle_2.results()[1], + SketchCircle_2.results()[1], + SketchArc_3.results()[1], + SketchCircle_2.results()[1], + SketchCircle_1.results()[1], + ], + [SketchCircle_4.results()[1]], + [SketchCircle_5.results()[1]], + [SketchCircle_6.results()[1]], + [SketchCircle_7.results()[1]], + [SketchCircle_8.results()[1]], + [SketchCircle_2.results()[1], SketchArc_3.results()[1]], + [SketchCircle_3.results()[1]], + [ + SketchArc_3.results()[1], + SketchLine_4.result(), + SketchArc_1.results()[1], + SketchLine_3.result(), + SketchLine_2.result(), + SketchArc_2.results()[1], + SketchLine_1.result(), + SketchCircle_2.results()[1], + SketchCircle_3.results()[1], + SketchCircle_4.results()[1], + SketchCircle_5.results()[1], + SketchCircle_6.results()[1], + SketchCircle_7.results()[1], + SketchCircle_8.results()[1], + ], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_5_2r-SketchLine_4r-SketchArc_1_2f-SketchLine_3r-SketchLine_2r-SketchArc_3_2f-SketchLine_1r-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r-SketchCircle_5_2r-SketchCircle_6_2r-SketchCircle_7_2r-SketchCircle_8_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_2_2f-SketchArc_5_2r-SketchCircle_2_2f-SketchCircle_1_2r")], model.selection(), 19, 0) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4")) -SketchLine_9 = Sketch_2.addLine(41.55275476651212, -117.4829288507397, 41.55275476651212, -28.90149327102993) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchArc_5_2r-SketchLine_4r-SketchArc_1_2f-SketchLine_3r-SketchLine_2r-SketchArc_3_2f-SketchLine_1r-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r-SketchCircle_5_2r-SketchCircle_6_2r-SketchCircle_7_2r-SketchCircle_8_2r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_2_2f-SketchArc_5_2r-SketchCircle_2_2f-SketchCircle_1_2r", + ), + ], + model.selection(), + 19, + 0, +) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4"), +) +SketchLine_9 = Sketch_2.addLine( + 41.55275476651212, -117.4829288507397, 41.55275476651212, -28.90149327102993 +) SketchLine_9.setAuxiliary(True) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_9.result()) -SketchLine_10 = Sketch_2.addLine(96.55275476651215, -19, 75.65570703399533, -109.515058097161) -SketchLine_11 = Sketch_2.addLine(7.449802499028871, -109.515058097161, -13.44724523348792, -19) +SketchLine_10 = Sketch_2.addLine( + 96.55275476651215, -19, 75.65570703399533, -109.515058097161 +) +SketchLine_11 = Sketch_2.addLine( + 7.449802499028871, -109.515058097161, -13.44724523348792, -19 +) SketchLine_12 = Sketch_2.addLine(96.55275476651215, -19, -13.44724523348792, -19) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.endPoint()) -SketchArc_4 = Sketch_2.addArc(41.5527547665121, -101.6417711951257, 75.65570703399533, -109.515058097161, 7.449802499028871, -109.515058097161, True) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchLine_10.startPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.endPoint() +) +SketchArc_4 = Sketch_2.addArc( + 41.5527547665121, + -101.6417711951257, + 75.65570703399533, + -109.515058097161, + 7.449802499028871, + -109.515058097161, + True, +) SketchArc_4.setName("SketchArc_4") SketchArc_4.result().setName("SketchArc_4") SketchArc_4.results()[1].setName("SketchArc_4_2") -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchArc_4.startPoint()) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchArc_4.endPoint()) -SketchConstraintTangent_7 = Sketch_2.setTangent(SketchArc_4.results()[1], SketchLine_10.result()) -SketchConstraintTangent_8 = Sketch_2.setTangent(SketchArc_4.results()[1], SketchLine_11.result()) -SketchConstraintEqual_5 = Sketch_2.setEqual(SketchLine_10.result(), SketchLine_11.result()) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchLine_11.startPoint(), SketchArc_4.endPoint() +) +SketchConstraintTangent_7 = Sketch_2.setTangent( + SketchArc_4.results()[1], SketchLine_10.result() +) +SketchConstraintTangent_8 = Sketch_2.setTangent( + SketchArc_4.results()[1], SketchLine_11.result() +) +SketchConstraintEqual_5 = Sketch_2.setEqual( + SketchLine_10.result(), SketchLine_11.result() +) SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_12.result()) -SketchConstraintAngle_1 = Sketch_2.setAngle(SketchLine_10.result(), SketchLine_12.result(), 283, type = "Backward") +SketchConstraintAngle_1 = Sketch_2.setAngle( + SketchLine_10.result(), SketchLine_12.result(), 283, type="Backward" +) SketchConstraintRadius_7 = Sketch_2.setRadius(SketchArc_4.results()[1], 35) -SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_4"), True) +SketchProjection_1 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchLine_4"), True +) SketchLine_13 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_5_StartVertex"), True) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_5_StartVertex"), True +) SketchPoint_2 = SketchProjection_2.createdFeature() SketchPoint_3 = Sketch_2.addPoint(41.55275476651212, -19) -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_9.result()) -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_12.result(), SketchPoint_3.coordinates()) -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_5_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/To_Face]"), False) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchPoint_3.coordinates(), SketchLine_9.result() +) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchLine_12.result(), SketchPoint_3.coordinates() +) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "VERTEX", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_5_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/To_Face]", + ), + False, +) SketchPoint_4 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_12.startPoint()) -SketchConstraintDistanceHorizontal_6 = Sketch_2.setHorizontalDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchPoint_3.coordinates(), 152) -SketchConstraintMiddle_2 = Sketch_2.setMiddlePoint(SketchLine_12.result(), SketchPoint_3.coordinates()) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_12.startPoint() +) +SketchConstraintDistanceHorizontal_6 = Sketch_2.setHorizontalDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchPoint_3.coordinates(), 152 +) +SketchConstraintMiddle_2 = Sketch_2.setMiddlePoint( + SketchLine_12.result(), SketchPoint_3.coordinates() +) SketchCircle_9 = Sketch_2.addCircle(41.5527547665121, -101.6417711951257, 22.225) SketchCircle_9.setName("SketchCircle_12") SketchCircle_9.result().setName("SketchCircle_12") SketchCircle_9.results()[1].setName("SketchCircle_12_2") -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchArc_4.center(), SketchCircle_9.center()) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchArc_4.center(), SketchCircle_9.center() +) SketchConstraintRadius_8 = Sketch_2.setRadius(SketchCircle_9.results()[1], 22.225) model.do() -ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_12f-SketchLine_11r-SketchArc_4_2f-SketchLine_10r-SketchCircle_12_2r")], model.selection(), 0, 19, [model.selection("SOLID", "Extrusion_1_1_1")]) -ExtrusionFuse_2 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_2_2f-SketchArc_5_2r-SketchCircle_2_2f-SketchCircle_1_2r")], model.selection(), 64, 0, [model.selection("SOLID", "ExtrusionFuse_1_1_1")]) -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_1_1_2/From_Face")) +ExtrusionFuse_1 = model.addExtrusionFuse( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_2/Face-SketchLine_12f-SketchLine_11r-SketchArc_4_2f-SketchLine_10r-SketchCircle_12_2r", + ) + ], + model.selection(), + 0, + 19, + [model.selection("SOLID", "Extrusion_1_1_1")], +) +ExtrusionFuse_2 = model.addExtrusionFuse( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_2_2f-SketchArc_5_2r-SketchCircle_2_2f-SketchCircle_1_2r", + ) + ], + model.selection(), + 64, + 0, + [model.selection("SOLID", "ExtrusionFuse_1_1_1")], +) +Sketch_3 = model.addSketch( + Part_1_doc, model.selection("FACE", "ExtrusionFuse_1_1_2/From_Face") +) SketchCircle_10 = Sketch_3.addCircle(41.5527547664253, 101.6417711951057, 22.225) SketchCircle_10.setName("SketchCircle_10") SketchCircle_10.result().setName("SketchCircle_10") SketchCircle_10.results()[1].setName("SketchCircle_10_2") SketchConstraintRadius_9 = Sketch_3.setRadius(SketchCircle_10.results()[1], "cir2") -SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "[ExtrusionFuse_1_1_2/Generated_Face&Sketch_2/SketchArc_4_2][ExtrusionFuse_1_1_2/From_Face]"), False) +SketchProjection_4 = Sketch_3.addProjection( + model.selection( + "EDGE", + "[ExtrusionFuse_1_1_2/Generated_Face&Sketch_2/SketchArc_4_2][ExtrusionFuse_1_1_2/From_Face]", + ), + False, +) SketchArc_5 = SketchProjection_4.createdFeature() SketchArc_5.setName("SketchArc_6") SketchArc_5.result().setName("SketchArc_6") @@ -188,174 +436,469 @@ SketchCircle_11 = Sketch_3.addCircle(41.5527547664253, 101.6417711951057, 35) SketchCircle_11.setName("SketchCircle_11") SketchCircle_11.result().setName("SketchCircle_11") SketchCircle_11.results()[1].setName("SketchCircle_11_2") -SketchConstraintCoincidence_29 = Sketch_3.setCoincident(SketchCircle_10.center(), SketchCircle_11.center()) -SketchConstraintTangent_9 = Sketch_3.setTangent(SketchArc_5.results()[1], SketchCircle_11.results()[1]) +SketchConstraintCoincidence_29 = Sketch_3.setCoincident( + SketchCircle_10.center(), SketchCircle_11.center() +) +SketchConstraintTangent_9 = Sketch_3.setTangent( + SketchArc_5.results()[1], SketchCircle_11.results()[1] +) SketchConstraintRadius_10 = Sketch_3.setRadius(SketchCircle_11.results()[1], 35) model.do() -ExtrusionFuse_3 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_11_2f-SketchCircle_10_2r")], model.selection(), 0, 55, [model.selection("SOLID", "ExtrusionFuse_2_1_1")]) -Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_2_1_2/Modified_Face&Extrusion_1_1_1/From_Face")) -SketchLine_14 = Sketch_4.addLine(96.55275476651215, -156.4086484957226, 231.5527547665121, -156.4086484957226) -SketchProjection_5 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_2/SketchProjection_1_EndVertex"), False) +ExtrusionFuse_3 = model.addExtrusionFuse( + Part_1_doc, + [model.selection("FACE", "Sketch_3/Face-SketchCircle_11_2f-SketchCircle_10_2r")], + model.selection(), + 0, + 55, + [model.selection("SOLID", "ExtrusionFuse_2_1_1")], +) +Sketch_4 = model.addSketch( + Part_1_doc, + model.selection( + "FACE", "ExtrusionFuse_2_1_2/Modified_Face&Extrusion_1_1_1/From_Face" + ), +) +SketchLine_14 = Sketch_4.addLine( + 96.55275476651215, -156.4086484957226, 231.5527547665121, -156.4086484957226 +) +SketchProjection_5 = Sketch_4.addProjection( + model.selection("VERTEX", "Sketch_2/SketchProjection_1_EndVertex"), False +) SketchPoint_5 = SketchProjection_5.createdFeature() -SketchConstraintCoincidence_30 = Sketch_4.setCoincident(SketchLine_14.startPoint(), SketchPoint_5.result()) -SketchProjection_6 = Sketch_4.addProjection(model.selection("EDGE", "[ExtrusionFuse_2_1_2/Modified_Face&Sketch_1/SketchLine_1][ExtrusionFuse_2_1_2/Modified_Face&Extrusion_1_1_1/From_Face]"), False) +SketchConstraintCoincidence_30 = Sketch_4.setCoincident( + SketchLine_14.startPoint(), SketchPoint_5.result() +) +SketchProjection_6 = Sketch_4.addProjection( + model.selection( + "EDGE", + "[ExtrusionFuse_2_1_2/Modified_Face&Sketch_1/SketchLine_1][ExtrusionFuse_2_1_2/Modified_Face&Extrusion_1_1_1/From_Face]", + ), + False, +) SketchLine_15 = SketchProjection_6.createdFeature() -SketchConstraintCoincidence_31 = Sketch_4.setCoincident(SketchLine_14.endPoint(), SketchLine_15.result()) -SketchConstraintPerpendicular_1 = Sketch_4.setPerpendicular(SketchLine_14.result(), SketchLine_15.result()) -SketchProjection_7 = Sketch_4.addProjection(model.selection("EDGE", "[ExtrusionFuse_2_1_2/Generated_Face&Sketch_1/SketchCircle_2_2][ExtrusionFuse_2_1_2/Modified_Face&Extrusion_1_1_1/From_Face]"), True) +SketchConstraintCoincidence_31 = Sketch_4.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.result() +) +SketchConstraintPerpendicular_1 = Sketch_4.setPerpendicular( + SketchLine_14.result(), SketchLine_15.result() +) +SketchProjection_7 = Sketch_4.addProjection( + model.selection( + "EDGE", + "[ExtrusionFuse_2_1_2/Generated_Face&Sketch_1/SketchCircle_2_2][ExtrusionFuse_2_1_2/Modified_Face&Extrusion_1_1_1/From_Face]", + ), + True, +) SketchArc_6 = SketchProjection_7.createdFeature() SketchArc_6.setName("SketchArc_7") SketchArc_6.result().setName("SketchArc_7") SketchArc_6.results()[1].setName("SketchArc_7_2") -SketchLine_16 = Sketch_4.addLine(231.5527547665121, -156.4086484957226, 231.5527547665122, -217.4085749004042) -SketchConstraintCoincidence_32 = Sketch_4.setCoincident(SketchLine_14.endPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_33 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_15).startPoint(), SketchLine_16.endPoint()) -SketchProjection_8 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/SketchArc_5_2"), True) +SketchLine_16 = Sketch_4.addLine( + 231.5527547665121, -156.4086484957226, 231.5527547665122, -217.4085749004042 +) +SketchConstraintCoincidence_32 = Sketch_4.setCoincident( + SketchLine_14.endPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_33 = Sketch_4.setCoincident( + SketchAPI_Line(SketchLine_15).startPoint(), SketchLine_16.endPoint() +) +SketchProjection_8 = Sketch_4.addProjection( + model.selection("EDGE", "Sketch_1/SketchArc_5_2"), True +) SketchArc_7 = SketchProjection_8.createdFeature() SketchArc_7.setName("SketchArc_8") SketchArc_7.result().setName("SketchArc_8") SketchArc_7.results()[1].setName("SketchArc_8_2") model.do() -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_4")], model.selection(), 0, "ext1", [model.selection("SOLID", "ExtrusionFuse_3_1_1")]) -Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_2_1_4/To_Face")) -SketchProjection_9 = Sketch_5.addProjection(model.selection("VERTEX", "Sketch_1/SketchCircle_1"), True) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_4")], + model.selection(), + 0, + "ext1", + [model.selection("SOLID", "ExtrusionFuse_3_1_1")], +) +Sketch_5 = model.addSketch( + Part_1_doc, model.selection("FACE", "ExtrusionFuse_2_1_4/To_Face") +) +SketchProjection_9 = Sketch_5.addProjection( + model.selection("VERTEX", "Sketch_1/SketchCircle_1"), True +) SketchPoint_6 = SketchProjection_9.createdFeature() model.do() -Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("VERTEX", "Sketch_5/SketchPoint_6"), False) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "Sketch_1/SketchLine_5"), + model.selection("VERTEX", "Sketch_5/SketchPoint_6"), + False, +) Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchLine_17 = Sketch_6.addLine(181.9085749004042, -52.16576914538749, 181.9085749004042, -19) +SketchLine_17 = Sketch_6.addLine( + 181.9085749004042, -52.16576914538749, 181.9085749004042, -19 +) SketchLine_18 = Sketch_6.addLine(181.9085749004042, -19, 110.7843534440984, -19) -SketchConstraintCoincidence_34 = Sketch_6.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) -SketchLine_19 = Sketch_6.addLine(110.7843534440984, -19, 181.9085749004042, -52.16576914538749) -SketchConstraintCoincidence_35 = Sketch_6.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -SketchConstraintCoincidence_36 = Sketch_6.setCoincident(SketchLine_17.startPoint(), SketchLine_19.endPoint()) +SketchConstraintCoincidence_34 = Sketch_6.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) +SketchLine_19 = Sketch_6.addLine( + 110.7843534440984, -19, 181.9085749004042, -52.16576914538749 +) +SketchConstraintCoincidence_35 = Sketch_6.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) +SketchConstraintCoincidence_36 = Sketch_6.setCoincident( + SketchLine_17.startPoint(), SketchLine_19.endPoint() +) SketchLine_20 = Sketch_6.addLine(179.4085749004042, -51, 179.4085749004042, -19) -SketchProjection_10 = Sketch_6.addProjection(model.selection("EDGE", "[(Extrusion_1_1_2/To_Face)(ExtrusionFuse_2_1_4/To_Face)(ExtrusionFuse_2_1_4/Generated_Face&Sketch_1/SketchArc_5_2)2(ExtrusionFuse_2_1_4/Generated_Face&Sketch_1/SketchCircle_1_2)2][ExtrusionFuse_2_1_4/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1]"), False) +SketchProjection_10 = Sketch_6.addProjection( + model.selection( + "EDGE", + "[(Extrusion_1_1_2/To_Face)(ExtrusionFuse_2_1_4/To_Face)(ExtrusionFuse_2_1_4/Generated_Face&Sketch_1/SketchArc_5_2)2(ExtrusionFuse_2_1_4/Generated_Face&Sketch_1/SketchCircle_1_2)2][ExtrusionFuse_2_1_4/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1]", + ), + False, +) SketchLine_21 = SketchProjection_10.createdFeature() -SketchConstraintParallel_2 = Sketch_6.setParallel(SketchLine_20.result(), SketchLine_21.result()) +SketchConstraintParallel_2 = Sketch_6.setParallel( + SketchLine_20.result(), SketchLine_21.result() +) SketchConstraintVertical_5 = Sketch_6.setVertical(SketchLine_17.result()) SketchConstraintHorizontal_5 = Sketch_6.setHorizontal(SketchLine_18.result()) -SketchProjection_11 = Sketch_6.addProjection(model.selection("EDGE", "[(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchArc_5_2)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchCircle_2_2)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_6_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_8_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_4_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_7_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_5_2)][ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_1]"), False) +SketchProjection_11 = Sketch_6.addProjection( + model.selection( + "EDGE", + "[(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchArc_5_2)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchCircle_2_2)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_6_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_8_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_4_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_7_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_5_2)][ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_1]", + ), + False, +) SketchLine_22 = SketchProjection_11.createdFeature() -SketchConstraintCoincidence_37 = Sketch_6.setCoincident(SketchLine_22.result(), SketchLine_18.startPoint()) -SketchConstraintCoincidence_38 = Sketch_6.setCoincident(SketchLine_20.startPoint(), SketchLine_19.result()) -SketchConstraintCoincidence_39 = Sketch_6.setCoincident(SketchLine_20.endPoint(), SketchLine_18.result()) -SketchConstraintDistanceHorizontal_7 = Sketch_6.setHorizontalDistance(SketchLine_20.startPoint(), SketchLine_19.endPoint(), 2.5) -SketchConstraintAngle_2 = Sketch_6.setAngle(SketchLine_18.result(), SketchLine_19.result(), 335, type = "Backward") +SketchConstraintCoincidence_37 = Sketch_6.setCoincident( + SketchLine_22.result(), SketchLine_18.startPoint() +) +SketchConstraintCoincidence_38 = Sketch_6.setCoincident( + SketchLine_20.startPoint(), SketchLine_19.result() +) +SketchConstraintCoincidence_39 = Sketch_6.setCoincident( + SketchLine_20.endPoint(), SketchLine_18.result() +) +SketchConstraintDistanceHorizontal_7 = Sketch_6.setHorizontalDistance( + SketchLine_20.startPoint(), SketchLine_19.endPoint(), 2.5 +) +SketchConstraintAngle_2 = Sketch_6.setAngle( + SketchLine_18.result(), SketchLine_19.result(), 335, type="Backward" +) SketchConstraintLength_2 = Sketch_6.setLength(SketchLine_20.result(), 32) -SketchConstraintDistanceHorizontal_8 = Sketch_6.setHorizontalDistance(SketchLine_20.startPoint(), SketchAPI_Line(SketchLine_21).endPoint(), 38) +SketchConstraintDistanceHorizontal_8 = Sketch_6.setHorizontalDistance( + SketchLine_20.startPoint(), SketchAPI_Line(SketchLine_21).endPoint(), 38 +) model.do() -ExtrusionFuse_4 = model.addExtrusionFuse(Part_1_doc, [model.selection("WIRE", "Sketch_6/Face-SketchLine_18f-SketchLine_19f-SketchLine_20f_wire"), model.selection("WIRE", "Sketch_6/Face-SketchLine_17r-SketchLine_18f-SketchLine_20r-SketchLine_19f_wire")], model.selection(), "rib1", "rib1", [model.selection("SOLID", "ExtrusionCut_1_1_2")]) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_1"), model.selection("VERTEX", "Sketch_3/SketchCircle_10")) +ExtrusionFuse_4 = model.addExtrusionFuse( + Part_1_doc, + [ + model.selection( + "WIRE", "Sketch_6/Face-SketchLine_18f-SketchLine_19f-SketchLine_20f_wire" + ), + model.selection( + "WIRE", + "Sketch_6/Face-SketchLine_17r-SketchLine_18f-SketchLine_20r-SketchLine_19f_wire", + ), + ], + model.selection(), + "rib1", + "rib1", + [model.selection("SOLID", "ExtrusionCut_1_1_2")], +) +Plane_5 = model.addPlane( + Part_1_doc, + model.selection("FACE", "Plane_1"), + model.selection("VERTEX", "Sketch_3/SketchCircle_10"), +) Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2")) -SketchProjection_12 = Sketch_7.addProjection(model.selection("VERTEX", "ExtrusionFuse_3_1_4/Generated_Vertex&ExtrusionFuse_1_1_2/To_Face"), False) +SketchProjection_12 = Sketch_7.addProjection( + model.selection( + "VERTEX", "ExtrusionFuse_3_1_4/Generated_Vertex&ExtrusionFuse_1_1_2/To_Face" + ), + False, +) SketchPoint_7 = SketchProjection_12.createdFeature() -SketchProjection_13 = Sketch_7.addProjection(model.selection("VERTEX", "Sketch_2/SketchPoint_3"), False) +SketchProjection_13 = Sketch_7.addProjection( + model.selection("VERTEX", "Sketch_2/SketchPoint_3"), False +) SketchPoint_8 = SketchProjection_13.createdFeature() model.do() -ExtrusionFuse_5 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "ExtrusionFuse_3_1_5/Modified_Face&ExtrusionFuse_1_1_2/From_Face&ExtrusionFuse_3_1_5/To_Face")], model.selection(), 5, 0, [model.selection("SOLID", "ExtrusionFuse_4_1_3")]) +ExtrusionFuse_5 = model.addExtrusionFuse( + Part_1_doc, + [ + model.selection( + "FACE", + "ExtrusionFuse_3_1_5/Modified_Face&ExtrusionFuse_1_1_2/From_Face&ExtrusionFuse_3_1_5/To_Face", + ) + ], + model.selection(), + 5, + 0, + [model.selection("SOLID", "ExtrusionFuse_4_1_3")], +) Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2")) -SketchLine_23 = Sketch_8.addLine(137.4086484957226, -66.64177119510566, 137.4086484957226, -19) -SketchProjection_14 = Sketch_8.addProjection(model.selection("VERTEX", "[ExtrusionFuse_5_1_3/Modified_Face&ExtrusionFuse_1_1_2/From_Face][(ExtrusionFuse_5_1_3/Modified_Face&Sketch_2/SketchLine_10)(ExtrusionFuse_5_1_3/Modified_Face&ExtrusionFuse_1_1_2/From_Face)(ExtrusionFuse_3_1_6/Modified_Face&ExtrusionFuse_1_1_2/To_Face)(ExtrusionFuse_5_1_3/Modified_Face&Sketch_2/SketchLine_11)2][(ExtrusionFuse_5_1_3/Modified_Face&Sketch_2/SketchLine_11)(ExtrusionFuse_5_1_3/Modified_Face&ExtrusionFuse_1_1_2/From_Face)(ExtrusionFuse_3_1_6/Modified_Face&ExtrusionFuse_1_1_2/To_Face)(ExtrusionFuse_5_1_3/Modified_Face&Sketch_2/SketchLine_10)2]"), False) +SketchLine_23 = Sketch_8.addLine( + 137.4086484957226, -66.64177119510566, 137.4086484957226, -19 +) +SketchProjection_14 = Sketch_8.addProjection( + model.selection( + "VERTEX", + "[ExtrusionFuse_5_1_3/Modified_Face&ExtrusionFuse_1_1_2/From_Face][(ExtrusionFuse_5_1_3/Modified_Face&Sketch_2/SketchLine_10)(ExtrusionFuse_5_1_3/Modified_Face&ExtrusionFuse_1_1_2/From_Face)(ExtrusionFuse_3_1_6/Modified_Face&ExtrusionFuse_1_1_2/To_Face)(ExtrusionFuse_5_1_3/Modified_Face&Sketch_2/SketchLine_11)2][(ExtrusionFuse_5_1_3/Modified_Face&Sketch_2/SketchLine_11)(ExtrusionFuse_5_1_3/Modified_Face&ExtrusionFuse_1_1_2/From_Face)(ExtrusionFuse_3_1_6/Modified_Face&ExtrusionFuse_1_1_2/To_Face)(ExtrusionFuse_5_1_3/Modified_Face&Sketch_2/SketchLine_10)2]", + ), + False, +) SketchPoint_9 = SketchProjection_14.createdFeature() -SketchConstraintCoincidence_40 = Sketch_8.setCoincident(SketchLine_23.startPoint(), SketchPoint_9.result()) +SketchConstraintCoincidence_40 = Sketch_8.setCoincident( + SketchLine_23.startPoint(), SketchPoint_9.result() +) SketchLine_24 = Sketch_8.addLine(137.4086484957226, -19, 104.0495211712532, -19) -SketchConstraintCoincidence_41 = Sketch_8.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) -SketchLine_25 = Sketch_8.addLine(104.0495211712532, -19, 137.4086484957226, -66.64177119510566) -SketchConstraintCoincidence_42 = Sketch_8.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint()) -SketchConstraintCoincidence_43 = Sketch_8.setCoincident(SketchLine_23.startPoint(), SketchLine_25.endPoint()) +SketchConstraintCoincidence_41 = Sketch_8.setCoincident( + SketchLine_23.endPoint(), SketchLine_24.startPoint() +) +SketchLine_25 = Sketch_8.addLine( + 104.0495211712532, -19, 137.4086484957226, -66.64177119510566 +) +SketchConstraintCoincidence_42 = Sketch_8.setCoincident( + SketchLine_24.endPoint(), SketchLine_25.startPoint() +) +SketchConstraintCoincidence_43 = Sketch_8.setCoincident( + SketchLine_23.startPoint(), SketchLine_25.endPoint() +) SketchConstraintHorizontal_6 = Sketch_8.setHorizontal(SketchLine_24.result()) SketchConstraintVertical_6 = Sketch_8.setVertical(SketchLine_23.result()) -SketchProjection_15 = Sketch_8.addProjection(model.selection("EDGE", "[(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchArc_5_2)(ExtrusionFuse_4_1_5/Modified_Face&Sketch_1/SketchCircle_2_2)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_6_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_8_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_4_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_7_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_5_2)][ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_1]"), False) +SketchProjection_15 = Sketch_8.addProjection( + model.selection( + "EDGE", + "[(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchArc_5_2)(ExtrusionFuse_4_1_5/Modified_Face&Sketch_1/SketchCircle_2_2)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_6_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_8_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_4_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_7_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_5_2)][ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_1]", + ), + False, +) SketchLine_26 = SketchProjection_15.createdFeature() -SketchConstraintCoincidence_44 = Sketch_8.setCoincident(SketchLine_24.startPoint(), SketchLine_26.result()) -SketchConstraintAngle_3 = Sketch_8.setAngle(SketchLine_25.result(), SketchLine_24.result(), 55, type = "Direct") +SketchConstraintCoincidence_44 = Sketch_8.setCoincident( + SketchLine_24.startPoint(), SketchLine_26.result() +) +SketchConstraintAngle_3 = Sketch_8.setAngle( + SketchLine_25.result(), SketchLine_24.result(), 55, type="Direct" +) model.do() -Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_3_1_4/From_Face")) -SketchProjection_16 = Sketch_9.addProjection(model.selection("VERTEX", "Sketch_2/SketchCircle_12"), True) +Sketch_9 = model.addSketch( + Part_1_doc, model.selection("FACE", "ExtrusionFuse_3_1_4/From_Face") +) +SketchProjection_16 = Sketch_9.addProjection( + model.selection("VERTEX", "Sketch_2/SketchCircle_12"), True +) SketchPoint_10 = SketchProjection_16.createdFeature() model.do() Sketch_10 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2")) -SketchLine_27 = Sketch_10.addLine(156.4086484957226, -101.6417711951257, 192.4086484957226, -101.6417711951257) +SketchLine_27 = Sketch_10.addLine( + 156.4086484957226, -101.6417711951257, 192.4086484957226, -101.6417711951257 +) SketchLine_27.setAuxiliary(True) -SketchProjection_17 = Sketch_10.addProjection(model.selection("VERTEX", "Sketch_2/SketchCircle_12"), False) +SketchProjection_17 = Sketch_10.addProjection( + model.selection("VERTEX", "Sketch_2/SketchCircle_12"), False +) SketchPoint_11 = SketchProjection_17.createdFeature() -SketchConstraintCoincidence_45 = Sketch_10.setCoincident(SketchLine_27.startPoint(), SketchPoint_11.result()) -SketchProjection_18 = Sketch_10.addProjection(model.selection("VERTEX", "Sketch_9/SketchPoint_10"), False) +SketchConstraintCoincidence_45 = Sketch_10.setCoincident( + SketchLine_27.startPoint(), SketchPoint_11.result() +) +SketchProjection_18 = Sketch_10.addProjection( + model.selection("VERTEX", "Sketch_9/SketchPoint_10"), False +) SketchPoint_12 = SketchProjection_18.createdFeature() -SketchConstraintCoincidence_46 = Sketch_10.setCoincident(SketchLine_27.endPoint(), SketchPoint_12.result()) -SketchProjection_19 = Sketch_10.addProjection(model.selection("EDGE", "([ExtrusionFuse_3_1_4/Generated_Face&Sketch_3/SketchCircle_11_2][ExtrusionFuse_3_1_4/From_Face])"), False) +SketchConstraintCoincidence_46 = Sketch_10.setCoincident( + SketchLine_27.endPoint(), SketchPoint_12.result() +) +SketchProjection_19 = Sketch_10.addProjection( + model.selection( + "EDGE", + "([ExtrusionFuse_3_1_4/Generated_Face&Sketch_3/SketchCircle_11_2][ExtrusionFuse_3_1_4/From_Face])", + ), + False, +) SketchLine_28 = SketchProjection_19.createdFeature() SketchLine_28.setName("SketchLine_29") SketchLine_28.result().setName("SketchLine_29") -SketchLine_29 = Sketch_10.addLine(191.4029952552692, -71.64177119510568, 156.4086484957226, -71.64177119510568) +SketchLine_29 = Sketch_10.addLine( + 191.4029952552692, -71.64177119510568, 156.4086484957226, -71.64177119510568 +) SketchLine_29.setName("SketchLine_30") SketchLine_29.result().setName("SketchLine_30") -SketchProjection_20 = Sketch_10.addProjection(model.selection("EDGE", "Sketch_2/SketchLine_9"), False) +SketchProjection_20 = Sketch_10.addProjection( + model.selection("EDGE", "Sketch_2/SketchLine_9"), False +) SketchLine_30 = SketchProjection_20.createdFeature() SketchLine_30.setName("SketchLine_31") SketchLine_30.result().setName("SketchLine_31") -SketchConstraintCoincidence_47 = Sketch_10.setCoincident(SketchLine_29.endPoint(), SketchLine_30.result()) -SketchLine_31 = Sketch_10.addLine(156.4086484957226, -71.64177119510568, 156.4086484957226, -15.63910975456751) +SketchConstraintCoincidence_47 = Sketch_10.setCoincident( + SketchLine_29.endPoint(), SketchLine_30.result() +) +SketchLine_31 = Sketch_10.addLine( + 156.4086484957226, -71.64177119510568, 156.4086484957226, -15.63910975456751 +) SketchLine_31.setName("SketchLine_32") SketchLine_31.result().setName("SketchLine_32") -SketchConstraintCoincidence_48 = Sketch_10.setCoincident(SketchLine_29.endPoint(), SketchLine_31.startPoint()) -SketchLine_32 = Sketch_10.addLine(156.4086484957226, -15.63910975456751, 191.4029952552692, -71.64177119510568) +SketchConstraintCoincidence_48 = Sketch_10.setCoincident( + SketchLine_29.endPoint(), SketchLine_31.startPoint() +) +SketchLine_32 = Sketch_10.addLine( + 156.4086484957226, -15.63910975456751, 191.4029952552692, -71.64177119510568 +) SketchLine_32.setName("SketchLine_33") SketchLine_32.result().setName("SketchLine_33") -SketchConstraintCoincidence_49 = Sketch_10.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) -SketchConstraintCoincidence_50 = Sketch_10.setCoincident(SketchLine_29.startPoint(), SketchLine_32.endPoint()) +SketchConstraintCoincidence_49 = Sketch_10.setCoincident( + SketchLine_31.endPoint(), SketchLine_32.startPoint() +) +SketchConstraintCoincidence_50 = Sketch_10.setCoincident( + SketchLine_29.startPoint(), SketchLine_32.endPoint() +) SketchConstraintHorizontal_7 = Sketch_10.setHorizontal(SketchLine_29.result()) SketchConstraintVertical_7 = Sketch_10.setVertical(SketchLine_31.result()) -SketchConstraintAngle_4 = Sketch_10.setAngle(SketchLine_32.result(), SketchLine_31.result(), 328, type = "Backward") -SketchLine_33 = Sketch_10.addLine(188.2786484957226, -66.64177119510568, 156.4086484957226, -66.64177119510568) +SketchConstraintAngle_4 = Sketch_10.setAngle( + SketchLine_32.result(), SketchLine_31.result(), 328, type="Backward" +) +SketchLine_33 = Sketch_10.addLine( + 188.2786484957226, -66.64177119510568, 156.4086484957226, -66.64177119510568 +) SketchLine_33.setName("SketchLine_34") SketchLine_33.result().setName("SketchLine_34") -SketchConstraintCoincidence_51 = Sketch_10.setCoincident(SketchLine_33.endPoint(), SketchLine_31.result()) -SketchConstraintParallel_3 = Sketch_10.setParallel(SketchLine_33.result(), SketchLine_29.result()) -SketchConstraintCoincidence_52 = Sketch_10.setCoincident(SketchLine_33.startPoint(), SketchLine_32.result()) -SketchConstraintDistanceVertical_2 = Sketch_10.setVerticalDistance(SketchLine_32.endPoint(), SketchLine_33.startPoint(), 5) +SketchConstraintCoincidence_51 = Sketch_10.setCoincident( + SketchLine_33.endPoint(), SketchLine_31.result() +) +SketchConstraintParallel_3 = Sketch_10.setParallel( + SketchLine_33.result(), SketchLine_29.result() +) +SketchConstraintCoincidence_52 = Sketch_10.setCoincident( + SketchLine_33.startPoint(), SketchLine_32.result() +) +SketchConstraintDistanceVertical_2 = Sketch_10.setVerticalDistance( + SketchLine_32.endPoint(), SketchLine_33.startPoint(), 5 +) SketchConstraintLength_3 = Sketch_10.setLength(SketchLine_33.result(), 31.87) -SketchConstraintCoincidence_53 = Sketch_10.setCoincident(SketchLine_28.result(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_53 = Sketch_10.setCoincident( + SketchLine_28.result(), SketchLine_33.startPoint() +) model.do() -ExtrusionFuse_6 = model.addExtrusionFuse(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_10")], model.selection(), "rib2", "rib2", [model.selection("SOLID", "ExtrusionFuse_5_1_3"), model.selection("SOLID", "ExtrusionFuse_5_1_2")]) -ExtrusionFuse_7 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchLine_23r-SketchLine_24f-SketchLine_25f")], model.selection(), "rib3", "rib3", [model.selection("SOLID", "ExtrusionFuse_6_1_7")]) -Sketch_11 = model.addSketch(Part_1_doc, model.selection("FACE", "(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchArc_5_2)(ExtrusionFuse_4_1_5/Modified_Face&Sketch_1/SketchCircle_2_2)(ExtrusionFuse_7_1_2/Generated_Face&Sketch_8/SketchLine_24)(ExtrusionFuse_4_1_7/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionFuse_4_1_6/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(ExtrusionFuse_7_1_2/Modified_Face&Sketch_2/SketchLine_12&Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_6_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_8_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_4_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_7_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_5_2)")) -SketchProjection_21 = Sketch_11.addProjection(model.selection("VERTEX", "[(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchArc_5_2)(ExtrusionFuse_4_1_5/Modified_Face&Sketch_1/SketchCircle_2_2)(ExtrusionFuse_7_1_2/Generated_Face&Sketch_8/SketchLine_24)(ExtrusionFuse_4_1_7/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionFuse_4_1_6/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(ExtrusionFuse_7_1_2/Modified_Face&Sketch_2/SketchLine_12&Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_6_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_8_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_4_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_7_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_5_2)][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2]__cc"), False) +ExtrusionFuse_6 = model.addExtrusionFuse( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_10")], + model.selection(), + "rib2", + "rib2", + [ + model.selection("SOLID", "ExtrusionFuse_5_1_3"), + model.selection("SOLID", "ExtrusionFuse_5_1_2"), + ], +) +ExtrusionFuse_7 = model.addExtrusionFuse( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_8/Face-SketchLine_23r-SketchLine_24f-SketchLine_25f" + ) + ], + model.selection(), + "rib3", + "rib3", + [model.selection("SOLID", "ExtrusionFuse_6_1_7")], +) +Sketch_11 = model.addSketch( + Part_1_doc, + model.selection( + "FACE", + "(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchArc_5_2)(ExtrusionFuse_4_1_5/Modified_Face&Sketch_1/SketchCircle_2_2)(ExtrusionFuse_7_1_2/Generated_Face&Sketch_8/SketchLine_24)(ExtrusionFuse_4_1_7/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionFuse_4_1_6/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(ExtrusionFuse_7_1_2/Modified_Face&Sketch_2/SketchLine_12&Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_6_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_8_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_4_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_7_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_5_2)", + ), +) +SketchProjection_21 = Sketch_11.addProjection( + model.selection( + "VERTEX", + "[(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchArc_5_2)(ExtrusionFuse_4_1_5/Modified_Face&Sketch_1/SketchCircle_2_2)(ExtrusionFuse_7_1_2/Generated_Face&Sketch_8/SketchLine_24)(ExtrusionFuse_4_1_7/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionFuse_4_1_6/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(ExtrusionFuse_7_1_2/Modified_Face&Sketch_2/SketchLine_12&Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_6_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_8_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_4_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_7_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_5_2)][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2]__cc", + ), + False, +) SketchPoint_13 = SketchProjection_21.createdFeature() SketchCircle_12 = Sketch_11.addCircle(-28.44724523348785, 137.4086484957226, 13) SketchCircle_12.setName("SketchCircle_13") SketchCircle_12.result().setName("SketchCircle_13") SketchCircle_12.results()[1].setName("SketchCircle_13_2") -SketchConstraintCoincidence_54 = Sketch_11.setCoincident(SketchPoint_13.result(), SketchCircle_12.center()) -SketchProjection_22 = Sketch_11.addProjection(model.selection("VERTEX", "[(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchArc_5_2)(ExtrusionFuse_4_1_5/Modified_Face&Sketch_1/SketchCircle_2_2)(ExtrusionFuse_7_1_2/Generated_Face&Sketch_8/SketchLine_24)(ExtrusionFuse_4_1_7/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionFuse_4_1_6/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(ExtrusionFuse_7_1_2/Modified_Face&Sketch_2/SketchLine_12&Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_6_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_8_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_4_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_7_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_5_2)][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_6_2]__cc"), False) +SketchConstraintCoincidence_54 = Sketch_11.setCoincident( + SketchPoint_13.result(), SketchCircle_12.center() +) +SketchProjection_22 = Sketch_11.addProjection( + model.selection( + "VERTEX", + "[(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchArc_5_2)(ExtrusionFuse_4_1_5/Modified_Face&Sketch_1/SketchCircle_2_2)(ExtrusionFuse_7_1_2/Generated_Face&Sketch_8/SketchLine_24)(ExtrusionFuse_4_1_7/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionFuse_4_1_6/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(ExtrusionFuse_7_1_2/Modified_Face&Sketch_2/SketchLine_12&Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_6_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_8_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_4_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_7_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_5_2)][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_6_2]__cc", + ), + False, +) SketchPoint_14 = SketchProjection_22.createdFeature() SketchCircle_13 = Sketch_11.addCircle(79.55275476651215, 96.4086484957226, 13) SketchCircle_13.setName("SketchCircle_14") SketchCircle_13.result().setName("SketchCircle_14") SketchCircle_13.results()[1].setName("SketchCircle_14_2") -SketchConstraintCoincidence_55 = Sketch_11.setCoincident(SketchPoint_14.result(), SketchCircle_13.center()) -SketchProjection_23 = Sketch_11.addProjection(model.selection("VERTEX", "[(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchArc_5_2)(ExtrusionFuse_4_1_5/Modified_Face&Sketch_1/SketchCircle_2_2)(ExtrusionFuse_7_1_2/Generated_Face&Sketch_8/SketchLine_24)(ExtrusionFuse_4_1_7/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionFuse_4_1_6/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(ExtrusionFuse_7_1_2/Modified_Face&Sketch_2/SketchLine_12&Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_6_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_8_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_4_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_7_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_5_2)][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_5_2]__cc"), False) +SketchConstraintCoincidence_55 = Sketch_11.setCoincident( + SketchPoint_14.result(), SketchCircle_13.center() +) +SketchProjection_23 = Sketch_11.addProjection( + model.selection( + "VERTEX", + "[(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchArc_5_2)(ExtrusionFuse_4_1_5/Modified_Face&Sketch_1/SketchCircle_2_2)(ExtrusionFuse_7_1_2/Generated_Face&Sketch_8/SketchLine_24)(ExtrusionFuse_4_1_7/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionFuse_4_1_6/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(ExtrusionFuse_7_1_2/Modified_Face&Sketch_2/SketchLine_12&Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_6_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_8_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_4_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_7_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_5_2)][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_5_2]__cc", + ), + False, +) SketchPoint_15 = SketchProjection_23.createdFeature() SketchCircle_14 = Sketch_11.addCircle(149.5527547665122, 137.4086484957226, 13) SketchCircle_14.setName("SketchCircle_15") SketchCircle_14.result().setName("SketchCircle_15") SketchCircle_14.results()[1].setName("SketchCircle_15_2") -SketchConstraintCoincidence_56 = Sketch_11.setCoincident(SketchPoint_15.result(), SketchCircle_14.center()) -SketchProjection_24 = Sketch_11.addProjection(model.selection("VERTEX", "[(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchArc_5_2)(ExtrusionFuse_4_1_5/Modified_Face&Sketch_1/SketchCircle_2_2)(ExtrusionFuse_7_1_2/Generated_Face&Sketch_8/SketchLine_24)(ExtrusionFuse_4_1_7/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionFuse_4_1_6/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(ExtrusionFuse_7_1_2/Modified_Face&Sketch_2/SketchLine_12&Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_6_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_8_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_4_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_7_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_5_2)][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2]__cc"), False) +SketchConstraintCoincidence_56 = Sketch_11.setCoincident( + SketchPoint_15.result(), SketchCircle_14.center() +) +SketchProjection_24 = Sketch_11.addProjection( + model.selection( + "VERTEX", + "[(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchArc_5_2)(ExtrusionFuse_4_1_5/Modified_Face&Sketch_1/SketchCircle_2_2)(ExtrusionFuse_7_1_2/Generated_Face&Sketch_8/SketchLine_24)(ExtrusionFuse_4_1_7/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionFuse_4_1_6/Modified_Face&Extrusion_1_1_1/To_Face)(ExtrusionCut_1_1_6/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(ExtrusionFuse_7_1_2/Modified_Face&Sketch_2/SketchLine_12&Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_6_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_8_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_4_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_7_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_3_2)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_5_2)][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_3_2]__cc", + ), + False, +) SketchPoint_16 = SketchProjection_24.createdFeature() SketchCircle_15 = Sketch_11.addCircle(212.5527547665122, 96.40864849572259, 13) SketchCircle_15.setName("SketchCircle_16") SketchCircle_15.result().setName("SketchCircle_16") SketchCircle_15.results()[1].setName("SketchCircle_16_2") -SketchConstraintCoincidence_57 = Sketch_11.setCoincident(SketchPoint_16.result(), SketchCircle_15.center()) -SketchConstraintEqual_6 = Sketch_11.setEqual(SketchCircle_12.results()[1], SketchCircle_13.results()[1]) -SketchConstraintEqual_7 = Sketch_11.setEqual(SketchCircle_13.results()[1], SketchCircle_14.results()[1]) -SketchConstraintEqual_8 = Sketch_11.setEqual(SketchCircle_14.results()[1], SketchCircle_15.results()[1]) +SketchConstraintCoincidence_57 = Sketch_11.setCoincident( + SketchPoint_16.result(), SketchCircle_15.center() +) +SketchConstraintEqual_6 = Sketch_11.setEqual( + SketchCircle_12.results()[1], SketchCircle_13.results()[1] +) +SketchConstraintEqual_7 = Sketch_11.setEqual( + SketchCircle_13.results()[1], SketchCircle_14.results()[1] +) +SketchConstraintEqual_8 = Sketch_11.setEqual( + SketchCircle_14.results()[1], SketchCircle_15.results()[1] +) SketchConstraintRadius_11 = Sketch_11.setRadius(SketchCircle_12.results()[1], 13) model.do() -ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_11")], model.selection(), 0, 2, [model.selection("SOLID", "ExtrusionFuse_7_1_2")]) -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2]")], 19) +ExtrusionCut_2 = model.addExtrusionCut( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_11")], + model.selection(), + 0, + 2, + [model.selection("SOLID", "ExtrusionFuse_7_1_2")], +) +Fillet_1 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2]", + ) + ], + 19, +) model.end() @@ -367,4 +910,4 @@ model.testNbSubShapes(Fillet_1, GeomAPI_Shape.EDGE, [624]) model.testNbSubShapes(Fillet_1, GeomAPI_Shape.VERTEX, [1248]) model.testResultsVolumes(Fillet_1, [867199.641696438]) -assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) +assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/src/ModelHighAPI/Test/Test19990_1.py b/src/ModelHighAPI/Test/Test19990_1.py index a9deed86c..cb60d2037 100644 --- a/src/ModelHighAPI/Test/Test19990_1.py +++ b/src/ModelHighAPI/Test/Test19990_1.py @@ -30,36 +30,73 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) ### Create SketchArc -SketchArc_1 = Sketch_1.addArc(56.24665913968287, -62.02452773486242, 35.57563613077872, -17.19150878248001, 88.70981046865168, -24.82997724138561, False) +SketchArc_1 = Sketch_1.addArc( + 56.24665913968287, + -62.02452773486242, + 35.57563613077872, + -17.19150878248001, + 88.70981046865168, + -24.82997724138561, + False, +) ### Create SketchLine -SketchLine_1 = Sketch_1.addLine(88.70981046865168, -24.82997724138561, 35.57563613077872, -17.19150878248001) +SketchLine_1 = Sketch_1.addLine( + 88.70981046865168, -24.82997724138561, 35.57563613077872, -17.19150878248001 +) Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) model.do() ### Create Extrusion -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", (56.24665913968287, -64.29248088508524, 0))], model.selection(), 50, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", (56.24665913968287, -64.29248088508524, 0))], + model.selection(), + 50, + 0, +) ### Create Sketch -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", (56.24665913968287, -64.29248088508524, 50))) +Sketch_2 = model.addSketch( + Part_1_doc, model.selection("FACE", (56.24665913968287, -64.29248088508524, 50)) +) ### Create SketchProjection -SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", (56.24665913968287, -62.02452773486242, 50)), False) +SketchProjection_1 = Sketch_2.addProjection( + model.selection("VERTEX", (56.24665913968287, -62.02452773486242, 50)), False +) SketchPoint_1 = SketchProjection_1.createdFeature() ### Create SketchArc -SketchArc_2 = Sketch_2.addArc(56.24665913968287, -62.02452773486242, 45.34418302532956, -36.70999577489869, 82.89389484228845, -54.98078276603709, False) +SketchArc_2 = Sketch_2.addArc( + 56.24665913968287, + -62.02452773486242, + 45.34418302532956, + -36.70999577489869, + 82.89389484228845, + -54.98078276603709, + False, +) Sketch_2.setCoincident(SketchPoint_1.result(), SketchArc_2.center()) ### Create SketchLine -SketchLine_2 = Sketch_2.addLine(82.89389484228843, -54.98078276603709, 45.34418302532956, -36.70999577489869) +SketchLine_2 = Sketch_2.addLine( + 82.89389484228843, -54.98078276603709, 45.34418302532956, -36.70999577489869 +) Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_2.startPoint()) Sketch_2.setCoincident(SketchArc_2.startPoint(), SketchLine_2.endPoint()) model.do() ### Create ExtrusionCut -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", (64.11903893380899, -45.84538927046789, 50))], model.selection(), 0, 10, [model.selection("SOLID", (55.99758335516852, -63.75630399502394, 25))]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [model.selection("WIRE", (64.11903893380899, -45.84538927046789, 50))], + model.selection(), + 0, + 10, + [model.selection("SOLID", (55.99758335516852, -63.75630399502394, 25))], +) model.end() @@ -73,4 +110,4 @@ model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.VERTEX, [48]) model.testResultsVolumes(ExtrusionCut_1, [347314.47596]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelHighAPI/Test/Test19990_2.py b/src/ModelHighAPI/Test/Test19990_2.py index 65da7b611..250acdeb1 100644 --- a/src/ModelHighAPI/Test/Test19990_2.py +++ b/src/ModelHighAPI/Test/Test19990_2.py @@ -36,7 +36,9 @@ Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() ### Create ImportResult -ImportResult_1 = model.addImportResult(Part_2_doc, [model.selection("SOLID", (5.000000000000001, 5.000000000000001, 5))]) +ImportResult_1 = model.addImportResult( + Part_2_doc, [model.selection("SOLID", (5.000000000000001, 5.000000000000001, 5))] +) model.end() @@ -58,4 +60,4 @@ model.testNbSubShapes(Part_2, GeomAPI_Shape.EDGE, [24]) model.testNbSubShapes(Part_2, GeomAPI_Shape.VERTEX, [48]) model.testResultsVolumes(Part_2, [1000]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelHighAPI/Test/Test20167.py b/src/ModelHighAPI/Test/Test20167.py index 91ecf1b58..e70ed7caa 100644 --- a/src/ModelHighAPI/Test/Test20167.py +++ b/src/ModelHighAPI/Test/Test20167.py @@ -30,15 +30,21 @@ model.addParameter(Part_1_doc, "h2", "70") model.addParameter(Part_1_doc, "h3", "7") model.addParameter(Part_1_doc, "d", "15") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchLine_1 = Sketch_1.addLine(-7.500000000000083, -15.81138830084192, -7.500000000000083, -26.99999999999995) +SketchLine_1 = Sketch_1.addLine( + -7.500000000000083, -15.81138830084192, -7.500000000000083, -26.99999999999995 +) SketchLine_1.setName("SketchLine_2") SketchLine_1.result().setName("SketchLine_2") SketchLine_2 = Sketch_1.addLine(-4.499999999999853, -30, 4.499999999999912, -30) SketchLine_2.setName("SketchLine_3") SketchLine_2.result().setName("SketchLine_3") -SketchLine_3 = Sketch_1.addLine(7.499999999999912, -27, 7.499999999999912, -15.81138830084196) +SketchLine_3 = Sketch_1.addLine( + 7.499999999999912, -27, 7.499999999999912, -15.81138830084196 +) SketchLine_3.setName("SketchLine_4") SketchLine_3.result().setName("SketchLine_4") SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) @@ -46,67 +52,152 @@ SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintHorizontal_1.setName("SketchConstraintHorizontal_2") SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) SketchPoint_2 = Sketch_1.addPoint(0, -30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_2.result() +) SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_6") -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_4 = SketchProjection_2.createdFeature() SketchLine_4.setName("SketchLine_5") SketchLine_4.result().setName("SketchLine_5") -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_4.result()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_4.result() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_7") -SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_3 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_5 = SketchProjection_3.createdFeature() SketchLine_5.setName("SketchLine_6") SketchLine_5.result().setName("SketchLine_6") -SketchArc_1 = Sketch_1.addArc(0, 0, -7.500000000000083, -15.81138830084192, -17.44306393762917, 1.410503622037771, True) +SketchArc_1 = Sketch_1.addArc( + 0, + 0, + -7.500000000000083, + -15.81138830084192, + -17.44306393762917, + 1.410503622037771, + True, +) SketchArc_1.setName("SketchArc_2") SketchArc_1.result().setName("SketchArc_2") SketchArc_1.results()[1].setName("SketchArc_2_2") -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchArc_1.center() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_3") SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 17.5) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_1.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_14") -SketchArc_2 = Sketch_1.addArc(-4.499999999999853, -27, -7.500000000000083, -26.99999999999995, -4.499999999999853, -30, False) +SketchArc_2 = Sketch_1.addArc( + -4.499999999999853, + -27, + -7.500000000000083, + -26.99999999999995, + -4.499999999999853, + -30, + False, +) SketchArc_2.setName("SketchArc_3") SketchArc_2.result().setName("SketchArc_3") SketchArc_2.results()[1].setName("SketchArc_3_2") SketchPoint_3 = Sketch_1.addPoint(-7.500000000000085, -30) SketchPoint_3.setAuxiliary(True) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchPoint_3.coordinates(), SketchLine_5.result(), 30, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_2.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchPoint_3.coordinates(), SketchLine_5.result(), 30, True +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_2.result() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_8") -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_1.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_1.result() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_9") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_1.endPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_1.endPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_10") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_2.startPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_11") -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_2.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_1.result()) -SketchArc_3 = Sketch_1.addArc(4.499999999999912, -27, 4.499999999999912, -30, 7.499999999999912, -27, False) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_2.result() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_1.result() +) +SketchArc_3 = Sketch_1.addArc( + 4.499999999999912, -27, 4.499999999999912, -30, 7.499999999999912, -27, False +) SketchArc_3.setName("SketchArc_4") SketchArc_3.result().setName("SketchArc_4") SketchArc_3.results()[1].setName("SketchArc_4_2") SketchPoint_4 = Sketch_1.addPoint(7.499999999999914, -30) SketchPoint_4.setAuxiliary(True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchPoint_3.coordinates(), SketchPoint_4.coordinates(), 15, False) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_3.result()) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchPoint_3.coordinates(), SketchPoint_4.coordinates(), 15, False +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_3.result() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_13") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_2.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_2.result() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_15") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_2.endPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchLine_2.endPoint() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_16") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_17") -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_3.result()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_2.result()) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_3.result() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_2.result() +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 3) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_3.results()[1], SketchArc_2.results()[1]) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_1.result()) -SketchMultiRotation_1_objects = [SketchLine_1.result(), SketchArc_2.results()[1], SketchLine_2.result(), SketchArc_3.results()[1], SketchLine_3.result()] -SketchMultiRotation_1 = Sketch_1.addRotation(SketchMultiRotation_1_objects, SketchAPI_Line(SketchLine_5).startPoint(), 360, 3, True) -[SketchLine_6, SketchLine_7, SketchArc_4, SketchArc_5, SketchLine_8, SketchLine_9, SketchArc_6, SketchArc_7, SketchLine_10, SketchLine_11] = SketchMultiRotation_1.rotated() +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchArc_3.results()[1], SketchArc_2.results()[1] +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_1.result() +) +SketchMultiRotation_1_objects = [ + SketchLine_1.result(), + SketchArc_2.results()[1], + SketchLine_2.result(), + SketchArc_3.results()[1], + SketchLine_3.result(), +] +SketchMultiRotation_1 = Sketch_1.addRotation( + SketchMultiRotation_1_objects, + SketchAPI_Line(SketchLine_5).startPoint(), + 360, + 3, + True, +) +[ + SketchLine_6, + SketchLine_7, + SketchArc_4, + SketchArc_5, + SketchLine_8, + SketchLine_9, + SketchArc_6, + SketchArc_7, + SketchLine_10, + SketchLine_11, +] = SketchMultiRotation_1.rotated() SketchLine_11.setName("SketchLine_14") SketchLine_11.result().setName("SketchLine_14") SketchLine_10.setName("SketchLine_13") @@ -131,72 +222,153 @@ SketchLine_7.setName("SketchLine_8") SketchLine_7.result().setName("SketchLine_8") SketchLine_6.setName("SketchLine_7") SketchLine_6.result().setName("SketchLine_7") -SketchArc_8 = Sketch_1.addArc(0, 0, -9.943063937629109, 14.40088467880429, 9.94306393762926, 14.40088467880419, True) +SketchArc_8 = Sketch_1.addArc( + 0, + 0, + -9.943063937629109, + 14.40088467880429, + 9.94306393762926, + 14.40088467880419, + True, +) SketchArc_8.setName("SketchArc_10") SketchArc_8.result().setName("SketchArc_10") SketchArc_8.results()[1].setName("SketchArc_10_2") -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchArc_1.results()[1], SketchArc_8.results()[1]) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.center(), SketchArc_8.center()) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchArc_1.results()[1], SketchArc_8.results()[1] +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchArc_8.center() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_18") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_11.result()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_11.result() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_19") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_8.startPoint(), SketchLine_7.result()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_8.startPoint(), SketchLine_7.result() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_20") -SketchArc_9 = Sketch_1.addArc(0, 0, 17.44306393762918, 1.410503622037589, 7.499999999999912, -15.81138830084196, True) +SketchArc_9 = Sketch_1.addArc( + 0, + 0, + 17.44306393762918, + 1.410503622037589, + 7.499999999999912, + -15.81138830084196, + True, +) SketchArc_9.setName("SketchArc_11") SketchArc_9.result().setName("SketchArc_11") SketchArc_9.results()[1].setName("SketchArc_11_2") -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_9.endPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_9.endPoint(), SketchLine_3.endPoint() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_12") -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchArc_8.results()[1], SketchArc_9.results()[1]) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_8.center(), SketchArc_9.center()) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchArc_8.results()[1], SketchArc_9.results()[1] +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchArc_8.center(), SketchArc_9.center() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_21") -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchLine_10.result()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchArc_8.endPoint(), SketchLine_10.result() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_22") -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchArc_9.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchArc_9.startPoint(), SketchLine_6.result() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_23") SketchCircle_1 = Sketch_1.addCircle(0, 0, 24) SketchCircle_1.setAuxiliary(True) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_24") SketchConstraintRadius_3 = Sketch_1.setRadius(SketchCircle_1.results()[1], 24) SketchCircle_2 = Sketch_1.addCircle(0, -24, 4) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchCircle_1.results()[1], SketchCircle_2.center()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchCircle_1.results()[1], SketchCircle_2.center() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_25") SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], 4) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchLine_4.result()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchCircle_2.center(), SketchLine_4.result() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_26") -SketchMultiRotation_2 = Sketch_1.addRotation([SketchCircle_2.results()[1]], SketchAPI_Line(SketchLine_4).startPoint(), 360, 3, True) +SketchMultiRotation_2 = Sketch_1.addRotation( + [SketchCircle_2.results()[1]], + SketchAPI_Line(SketchLine_4).startPoint(), + 360, + 3, + True, +) [SketchCircle_3, SketchCircle_4] = SketchMultiRotation_2.rotated() model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchArc_3_2f-SketchLine_3f-SketchArc_4_2f-SketchLine_4f-SketchArc_11_2f-SketchLine_7f-SketchArc_5_2f-SketchLine_10f-SketchArc_8_2f-SketchLine_13f-SketchArc_10_2f-SketchLine_8f-SketchArc_6_2f-SketchLine_11f-SketchArc_9_2f-SketchLine_14f-SketchArc_2_2f-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r")], model.selection(), "h1", 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_2f-SketchArc_3_2f-SketchLine_3f-SketchArc_4_2f-SketchLine_4f-SketchArc_11_2f-SketchLine_7f-SketchArc_5_2f-SketchLine_10f-SketchArc_8_2f-SketchLine_13f-SketchArc_10_2f-SketchLine_8f-SketchArc_6_2f-SketchLine_11f-SketchArc_9_2f-SketchLine_14f-SketchArc_2_2f-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r", + ) + ], + model.selection(), + "h1", + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) -SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_12 = SketchProjection_4.createdFeature() SketchLine_12.setName("SketchLine_12") SketchLine_12.result().setName("SketchLine_12") -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_13 = SketchProjection_5.createdFeature() SketchLine_13.setName("SketchLine_15") SketchLine_13.result().setName("SketchLine_15") SketchLine_14 = Sketch_2.addLine(7.500000000000332, 12.99038105676728, 15, 0) SketchLine_14.setName("SketchLine_16") SketchLine_14.result().setName("SketchLine_16") -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_12.result()) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_12.result() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_28") -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_14.startPoint(), "d", True) -SketchConstraintDistance_4 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_14.endPoint(), "d", True) +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_14.startPoint(), "d", True +) +SketchConstraintDistance_4 = Sketch_2.setDistance( + SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_14.endPoint(), "d", True +) SketchLine_15 = Sketch_2.addLine(0, 0, 7.500000000000332, 12.99038105676728) SketchLine_15.setName("SketchLine_17") SketchLine_15.result().setName("SketchLine_17") SketchLine_15.setAuxiliary(True) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_15.startPoint() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_27") -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchLine_15.endPoint()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchLine_15.endPoint() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_29") -SketchConstraintAngle_1 = Sketch_2.setAngle(SketchLine_12.result(), SketchLine_15.result(), "360/6") -SketchMultiRotation_3 = Sketch_2.addRotation([SketchLine_14.result()], SketchAPI_Line(SketchLine_12).startPoint(), 360, 6, True) -[SketchLine_16, SketchLine_17, SketchLine_18, SketchLine_19, SketchLine_20] = SketchMultiRotation_3.rotated() +SketchConstraintAngle_1 = Sketch_2.setAngle( + SketchLine_12.result(), SketchLine_15.result(), "360/6" +) +SketchMultiRotation_3 = Sketch_2.addRotation( + [SketchLine_14.result()], SketchAPI_Line(SketchLine_12).startPoint(), 360, 6, True +) +[ + SketchLine_16, + SketchLine_17, + SketchLine_18, + SketchLine_19, + SketchLine_20, +] = SketchMultiRotation_3.rotated() SketchLine_20.setName("SketchLine_22") SketchLine_20.result().setName("SketchLine_22") SketchLine_19.setName("SketchLine_21") @@ -208,162 +380,437 @@ SketchLine_17.result().setName("SketchLine_19") SketchLine_16.setName("SketchLine_18") SketchLine_16.result().setName("SketchLine_18") model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_18r-SketchLine_19r-SketchLine_20r-SketchLine_21r-SketchLine_22r-SketchLine_16r_wire")], model.selection(), "h2-h3-h1", 0) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "WIRE", + "Sketch_2/Face-SketchLine_18r-SketchLine_19r-SketchLine_20r-SketchLine_21r-SketchLine_22r-SketchLine_16r_wire", + ) + ], + model.selection(), + "h2-h3-h1", + 0, +) Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face")) -SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_6 = Sketch_3.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_21 = SketchProjection_6.createdFeature() SketchLine_21.setName("SketchLine_23") SketchLine_21.result().setName("SketchLine_23") SketchCircle_5 = Sketch_3.addCircle(0, 0, 10) -SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_21).startPoint(), SketchCircle_5.center()) +SketchConstraintCoincidence_26 = Sketch_3.setCoincident( + SketchAPI_Line(SketchLine_21).startPoint(), SketchCircle_5.center() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_30") SketchConstraintRadius_5 = Sketch_3.setRadius(SketchCircle_5.results()[1], 10) model.do() -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")]) -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_5_2f")], model.selection(), 0, 60, [model.selection("SOLID", "Fuse_1_1")]) -Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/From_Face")) -SketchProjection_7 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OX"), False) +Fuse_1 = model.addFuse( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_2_1"), + ], +) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [model.selection("FACE", "Sketch_3/Face-SketchCircle_5_2f")], + model.selection(), + 0, + 60, + [model.selection("SOLID", "Fuse_1_1")], +) +Sketch_4 = model.addSketch( + Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/From_Face") +) +SketchProjection_7 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_22 = SketchProjection_7.createdFeature() SketchLine_22.setName("SketchLine_24") SketchLine_22.result().setName("SketchLine_24") SketchCircle_6 = Sketch_4.addCircle(0, 0, 12.5) -SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_22).startPoint(), SketchCircle_6.center()) +SketchConstraintCoincidence_27 = Sketch_4.setCoincident( + SketchAPI_Line(SketchLine_22).startPoint(), SketchCircle_6.center() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_31") SketchConstraintRadius_6 = Sketch_4.setRadius(SketchCircle_6.results()[1], 12.5) model.do() -ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchArc_3_2f-SketchLine_3f-SketchArc_4_2f-SketchLine_4f-SketchArc_11_2f-SketchLine_7f-SketchArc_5_2f-SketchLine_10f-SketchArc_8_2f-SketchLine_13f-SketchArc_10_2f-SketchLine_8f-SketchArc_6_2f-SketchLine_11f-SketchArc_9_2f-SketchLine_14f-SketchArc_2_2f-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")]) -Fillet_1_objects = [model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_20]"), model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_21]"), model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_22]"), model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_16]"), model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_19]"), model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_18]")] +ExtrusionCut_2 = model.addExtrusionCut( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_4")], + model.selection(), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_2f-SketchArc_3_2f-SketchLine_3f-SketchArc_4_2f-SketchLine_4f-SketchArc_11_2f-SketchLine_7f-SketchArc_5_2f-SketchLine_10f-SketchArc_8_2f-SketchLine_13f-SketchArc_10_2f-SketchLine_8f-SketchArc_6_2f-SketchLine_11f-SketchArc_9_2f-SketchLine_14f-SketchArc_2_2f-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r", + ), + 0, + model.selection(), + 0, + [model.selection("SOLID", "ExtrusionCut_1_1")], +) +Fillet_1_objects = [ + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_20]", + ), + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_21]", + ), + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_22]", + ), + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_16]", + ), + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_19]", + ), + model.selection( + "EDGE", + "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_18]", + ), +] Fillet_1 = model.addFillet(Part_1_doc, Fillet_1_objects, 1) -Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_2_1/To_Face")) -SketchProjection_8 = Sketch_5.addProjection(model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Extrusion_2_1/To_Face][ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchCircle_5_2]__cc"), False) +Sketch_5 = model.addSketch( + Part_1_doc, + model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_2_1/To_Face"), +) +SketchProjection_8 = Sketch_5.addProjection( + model.selection( + "VERTEX", + "[ExtrusionCut_1_1/Modified_Face&Extrusion_2_1/To_Face][ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchCircle_5_2]__cc", + ), + False, +) SketchPoint_5 = SketchProjection_8.createdFeature() SketchCircle_7 = Sketch_5.addCircle(0, 0, 22) -SketchConstraintCoincidence_28 = Sketch_5.setCoincident(SketchPoint_5.result(), SketchCircle_7.center()) +SketchConstraintCoincidence_28 = Sketch_5.setCoincident( + SketchPoint_5.result(), SketchCircle_7.center() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_32") SketchConstraintRadius_7 = Sketch_5.setRadius(SketchCircle_7.results()[1], 22) model.do() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchCircle_7_2f")], model.selection(), "h3", 0) -Fuse_2 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Fillet_1_1"), model.selection("SOLID", "Extrusion_3_1")]) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_5/Face-SketchCircle_7_2f")], + model.selection(), + "h3", + 0, +) +Fuse_2 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Fillet_1_1"), model.selection("SOLID", "Extrusion_3_1")], +) Sketch_6 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) SketchLine_23 = Sketch_6.addLine(22, 70, 20, 70) SketchLine_23.setName("SketchLine_25") SketchLine_23.result().setName("SketchLine_25") -SketchProjection_9 = Sketch_6.addProjection(model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_5/SketchCircle_7_2][Extrusion_3_1/To_Face]"), False) +SketchProjection_9 = Sketch_6.addProjection( + model.selection( + "VERTEX", + "[Extrusion_3_1/Generated_Face&Sketch_5/SketchCircle_7_2][Extrusion_3_1/To_Face]", + ), + False, +) SketchPoint_6 = SketchProjection_9.createdFeature() -SketchConstraintCoincidence_29 = Sketch_6.setCoincident(SketchLine_23.startPoint(), SketchPoint_6.result()) +SketchConstraintCoincidence_29 = Sketch_6.setCoincident( + SketchLine_23.startPoint(), SketchPoint_6.result() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_33") SketchLine_24 = Sketch_6.addLine(20, 70, 22, 68.84529946162075) SketchLine_24.setName("SketchLine_26") SketchLine_24.result().setName("SketchLine_26") -SketchConstraintCoincidence_30 = Sketch_6.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) +SketchConstraintCoincidence_30 = Sketch_6.setCoincident( + SketchLine_23.endPoint(), SketchLine_24.startPoint() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_34") -SketchProjection_10 = Sketch_6.addProjection(model.selection("EDGE", "([Extrusion_3_1/Generated_Face&Sketch_5/SketchCircle_7_2][Extrusion_3_1/To_Face])_Fuse_2_1"), False) +SketchProjection_10 = Sketch_6.addProjection( + model.selection( + "EDGE", + "([Extrusion_3_1/Generated_Face&Sketch_5/SketchCircle_7_2][Extrusion_3_1/To_Face])_Fuse_2_1", + ), + False, +) SketchLine_25 = SketchProjection_10.createdFeature() SketchLine_25.setName("SketchLine_27") SketchLine_25.result().setName("SketchLine_27") -SketchConstraintCoincidence_31 = Sketch_6.setCoincident(SketchLine_24.endPoint(), SketchLine_25.result()) +SketchConstraintCoincidence_31 = Sketch_6.setCoincident( + SketchLine_24.endPoint(), SketchLine_25.result() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_35") SketchLine_26 = Sketch_6.addLine(22, 68.84529946162075, 22, 70) SketchLine_26.setName("SketchLine_28") SketchLine_26.result().setName("SketchLine_28") -SketchConstraintCoincidence_32 = Sketch_6.setCoincident(SketchLine_24.endPoint(), SketchLine_26.startPoint()) +SketchConstraintCoincidence_32 = Sketch_6.setCoincident( + SketchLine_24.endPoint(), SketchLine_26.startPoint() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_36") -SketchConstraintCoincidence_33 = Sketch_6.setCoincident(SketchLine_23.startPoint(), SketchLine_26.endPoint()) +SketchConstraintCoincidence_33 = Sketch_6.setCoincident( + SketchLine_23.startPoint(), SketchLine_26.endPoint() +) SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_37") SketchLine_27 = Sketch_6.addLine(21.99999999999999, 64, 22, 63) SketchLine_27.setName("SketchLine_29") SketchLine_27.result().setName("SketchLine_29") -SketchConstraintCoincidence_34 = Sketch_6.setCoincident(SketchLine_27.startPoint(), SketchLine_25.result()) +SketchConstraintCoincidence_34 = Sketch_6.setCoincident( + SketchLine_27.startPoint(), SketchLine_25.result() +) SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_38") -SketchConstraintCoincidence_35 = Sketch_6.setCoincident(SketchAPI_Line(SketchLine_25).startPoint(), SketchLine_27.endPoint()) +SketchConstraintCoincidence_35 = Sketch_6.setCoincident( + SketchAPI_Line(SketchLine_25).startPoint(), SketchLine_27.endPoint() +) SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_39") SketchLine_28 = Sketch_6.addLine(21.99999999999999, 64, 21.73205080756888, 63) SketchLine_28.setName("SketchLine_30") SketchLine_28.result().setName("SketchLine_30") -SketchConstraintCoincidence_36 = Sketch_6.setCoincident(SketchLine_27.startPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_36 = Sketch_6.setCoincident( + SketchLine_27.startPoint(), SketchLine_28.startPoint() +) SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_40") SketchLine_29 = Sketch_6.addLine(21.73205080756888, 63, 22, 63) SketchLine_29.setName("SketchLine_31") SketchLine_29.result().setName("SketchLine_31") -SketchConstraintCoincidence_37 = Sketch_6.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_37 = Sketch_6.setCoincident( + SketchLine_28.endPoint(), SketchLine_29.startPoint() +) SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_41") -SketchConstraintCoincidence_38 = Sketch_6.setCoincident(SketchAPI_Line(SketchLine_25).startPoint(), SketchLine_29.endPoint()) +SketchConstraintCoincidence_38 = Sketch_6.setCoincident( + SketchAPI_Line(SketchLine_25).startPoint(), SketchLine_29.endPoint() +) SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_42") SketchConstraintLength_1 = Sketch_6.setLength(SketchLine_23.result(), 2) -SketchConstraintAngle_2 = Sketch_6.setAngleBackward(SketchLine_23.result(), SketchLine_24.result(), 30) +SketchConstraintAngle_2 = Sketch_6.setAngleBackward( + SketchLine_23.result(), SketchLine_24.result(), 30 +) SketchConstraintHorizontal_2 = Sketch_6.setHorizontal(SketchLine_23.result()) SketchConstraintHorizontal_2.setName("SketchConstraintHorizontal_3") SketchConstraintHorizontal_3 = Sketch_6.setHorizontal(SketchLine_29.result()) SketchConstraintHorizontal_3.setName("SketchConstraintHorizontal_4") SketchConstraintLength_2 = Sketch_6.setLength(SketchLine_27.result(), 1) -SketchConstraintAngle_3 = Sketch_6.setAngle(SketchLine_28.result(), SketchLine_27.result(), 15) +SketchConstraintAngle_3 = Sketch_6.setAngle( + SketchLine_28.result(), SketchLine_27.result(), 15 +) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection("EDGE", "PartSet/OZ"), 360, 0) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Fuse_2_1")], [model.selection("SOLID", "Revolution_1_2"), model.selection("SOLID", "Revolution_1_1")]) -Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Cut_1_1/Modified_Face&Extrusion_3_1/To_Face")) -SketchProjection_11 = Sketch_7.addProjection(model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_6/SketchLine_26][Cut_1_1/Modified_Face&Extrusion_3_1/To_Face]__cc"), False) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_6")], + model.selection("EDGE", "PartSet/OZ"), + 360, + 0, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Fuse_2_1")], + [ + model.selection("SOLID", "Revolution_1_2"), + model.selection("SOLID", "Revolution_1_1"), + ], +) +Sketch_7 = model.addSketch( + Part_1_doc, model.selection("FACE", "Cut_1_1/Modified_Face&Extrusion_3_1/To_Face") +) +SketchProjection_11 = Sketch_7.addProjection( + model.selection( + "VERTEX", + "[Revolution_1_1/Generated_Face&Sketch_6/SketchLine_26][Cut_1_1/Modified_Face&Extrusion_3_1/To_Face]__cc", + ), + False, +) SketchPoint_7 = SketchProjection_11.createdFeature() SketchCircle_8 = Sketch_7.addCircle(0, 0, 26) SketchCircle_8.setAuxiliary(True) -SketchConstraintCoincidence_39 = Sketch_7.setCoincident(SketchPoint_7.result(), SketchCircle_8.center()) +SketchConstraintCoincidence_39 = Sketch_7.setCoincident( + SketchPoint_7.result(), SketchCircle_8.center() +) SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_43") SketchConstraintRadius_8 = Sketch_7.setRadius(SketchCircle_8.results()[1], 26) SketchCircle_9 = Sketch_7.addCircle(0, -26, 5.25) -SketchConstraintCoincidence_40 = Sketch_7.setCoincident(SketchCircle_8.results()[1], SketchCircle_9.center()) +SketchConstraintCoincidence_40 = Sketch_7.setCoincident( + SketchCircle_8.results()[1], SketchCircle_9.center() +) SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_44") -SketchProjection_12 = Sketch_7.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_12 = Sketch_7.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_30 = SketchProjection_12.createdFeature() SketchLine_30.setName("SketchLine_32") SketchLine_30.result().setName("SketchLine_32") SketchConstraintRadius_9 = Sketch_7.setRadius(SketchCircle_9.results()[1], 5.25) -SketchConstraintCoincidence_41 = Sketch_7.setCoincident(SketchCircle_9.center(), SketchLine_30.result()) +SketchConstraintCoincidence_41 = Sketch_7.setCoincident( + SketchCircle_9.center(), SketchLine_30.result() +) SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_45") -SketchMultiRotation_4 = Sketch_7.addRotation([SketchCircle_9.results()[1]], SketchAPI_Line(SketchLine_30).startPoint(), 360, 16, True) -[SketchCircle_10, SketchCircle_11, SketchCircle_12, SketchCircle_13, SketchCircle_14, SketchCircle_15, SketchCircle_16, SketchCircle_17, SketchCircle_18, SketchCircle_19, SketchCircle_20, SketchCircle_21, SketchCircle_22, SketchCircle_23, SketchCircle_24] = SketchMultiRotation_4.rotated() +SketchMultiRotation_4 = Sketch_7.addRotation( + [SketchCircle_9.results()[1]], + SketchAPI_Line(SketchLine_30).startPoint(), + 360, + 16, + True, +) +[ + SketchCircle_10, + SketchCircle_11, + SketchCircle_12, + SketchCircle_13, + SketchCircle_14, + SketchCircle_15, + SketchCircle_16, + SketchCircle_17, + SketchCircle_18, + SketchCircle_19, + SketchCircle_20, + SketchCircle_21, + SketchCircle_22, + SketchCircle_23, + SketchCircle_24, +] = SketchMultiRotation_4.rotated() model.do() -Extrusion_4_objects = [model.selection("FACE", "Sketch_7/Face-SketchCircle_19_2f-SketchCircle_20_2r-SketchCircle_19_2f-SketchCircle_19_2f-SketchCircle_18_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_18_2f-SketchCircle_19_2r-SketchCircle_18_2f-SketchCircle_17_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_17_2f-SketchCircle_18_2r-SketchCircle_18_2r-SketchCircle_17_2f-SketchCircle_16_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_15_2f-SketchCircle_15_2f-SketchCircle_16_2r-SketchCircle_15_2f-SketchCircle_14_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_16_2f-SketchCircle_16_2f-SketchCircle_17_2r-SketchCircle_17_2r-SketchCircle_16_2f-SketchCircle_15_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_14_2f-SketchCircle_14_2f-SketchCircle_15_2r-SketchCircle_14_2f-SketchCircle_13_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_13_2f-SketchCircle_13_2f-SketchCircle_14_2r-SketchCircle_13_2f-SketchCircle_12_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_12_2f-SketchCircle_12_2f-SketchCircle_13_2r-SketchCircle_12_2f-SketchCircle_11_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_11_2f-SketchCircle_11_2f-SketchCircle_12_2r-SketchCircle_11_2f-SketchCircle_10_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_9_2r-SketchCircle_10_2f-SketchCircle_10_2f-SketchCircle_11_2r-SketchCircle_10_2f-SketchCircle_9_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_9_2f-SketchCircle_24_2r-SketchCircle_24_2r-SketchCircle_9_2f-SketchCircle_10_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_24_2f-SketchCircle_23_2r-SketchCircle_24_2f-SketchCircle_9_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_23_2f-SketchCircle_24_2r-SketchCircle_23_2f-SketchCircle_23_2f-SketchCircle_22_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_22_2f-SketchCircle_23_2r-SketchCircle_22_2f-SketchCircle_22_2f-SketchCircle_21_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_21_2f-SketchCircle_22_2r-SketchCircle_21_2f-SketchCircle_21_2f-SketchCircle_20_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_20_2f-SketchCircle_21_2r-SketchCircle_20_2f-SketchCircle_20_2f-SketchCircle_19_2r")] -Extrusion_4 = model.addExtrusion(Part_1_doc, Extrusion_4_objects, model.selection(), model.selection("FACE", "Sketch_5/Face-SketchCircle_7_2f"), 0, model.selection(), 0) -Cut_2 = model.addCut(Part_1_doc, [model.selection("SOLID", "Cut_1_1")], [model.selection("COMPOUND", "all-in-Extrusion_4")]) +Extrusion_4_objects = [ + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_19_2f-SketchCircle_20_2r-SketchCircle_19_2f-SketchCircle_19_2f-SketchCircle_18_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_18_2f-SketchCircle_19_2r-SketchCircle_18_2f-SketchCircle_17_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_17_2f-SketchCircle_18_2r-SketchCircle_18_2r-SketchCircle_17_2f-SketchCircle_16_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_15_2f-SketchCircle_15_2f-SketchCircle_16_2r-SketchCircle_15_2f-SketchCircle_14_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_16_2f-SketchCircle_16_2f-SketchCircle_17_2r-SketchCircle_17_2r-SketchCircle_16_2f-SketchCircle_15_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_14_2f-SketchCircle_14_2f-SketchCircle_15_2r-SketchCircle_14_2f-SketchCircle_13_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_13_2f-SketchCircle_13_2f-SketchCircle_14_2r-SketchCircle_13_2f-SketchCircle_12_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_12_2f-SketchCircle_12_2f-SketchCircle_13_2r-SketchCircle_12_2f-SketchCircle_11_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_11_2f-SketchCircle_11_2f-SketchCircle_12_2r-SketchCircle_11_2f-SketchCircle_10_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_9_2r-SketchCircle_10_2f-SketchCircle_10_2f-SketchCircle_11_2r-SketchCircle_10_2f-SketchCircle_9_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_9_2f-SketchCircle_24_2r-SketchCircle_24_2r-SketchCircle_9_2f-SketchCircle_10_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_24_2f-SketchCircle_23_2r-SketchCircle_24_2f-SketchCircle_9_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_23_2f-SketchCircle_24_2r-SketchCircle_23_2f-SketchCircle_23_2f-SketchCircle_22_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_22_2f-SketchCircle_23_2r-SketchCircle_22_2f-SketchCircle_22_2f-SketchCircle_21_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_21_2f-SketchCircle_22_2r-SketchCircle_21_2f-SketchCircle_21_2f-SketchCircle_20_2r", + ), + model.selection( + "FACE", + "Sketch_7/Face-SketchCircle_20_2f-SketchCircle_21_2r-SketchCircle_20_2f-SketchCircle_20_2f-SketchCircle_19_2r", + ), +] +Extrusion_4 = model.addExtrusion( + Part_1_doc, + Extrusion_4_objects, + model.selection(), + model.selection("FACE", "Sketch_5/Face-SketchCircle_7_2f"), + 0, + model.selection(), + 0, +) +Cut_2 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Cut_1_1")], + [model.selection("COMPOUND", "all-in-Extrusion_4")], +) Sketch_8 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) SketchLine_31 = Sketch_8.addLine(0, 97, 4.25, 97) SketchLine_31.setName("SketchLine_33") SketchLine_31.result().setName("SketchLine_33") -SketchProjection_13 = Sketch_8.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_13 = Sketch_8.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_32 = SketchProjection_13.createdFeature() SketchLine_32.setName("SketchLine_34") SketchLine_32.result().setName("SketchLine_34") -SketchConstraintCoincidence_42 = Sketch_8.setCoincident(SketchLine_31.startPoint(), SketchLine_32.result()) +SketchConstraintCoincidence_42 = Sketch_8.setCoincident( + SketchLine_31.startPoint(), SketchLine_32.result() +) SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_46") SketchLine_33 = Sketch_8.addLine(4.25, 97, 4.25, 91.05) SketchLine_33.setName("SketchLine_35") SketchLine_33.result().setName("SketchLine_35") -SketchConstraintCoincidence_43 = Sketch_8.setCoincident(SketchLine_31.endPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_43 = Sketch_8.setCoincident( + SketchLine_31.endPoint(), SketchLine_33.startPoint() +) SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_47") SketchLine_34 = Sketch_8.addLine(4.25, 91.05, 6, 89.3) SketchLine_34.setName("SketchLine_36") SketchLine_34.result().setName("SketchLine_36") -SketchConstraintCoincidence_44 = Sketch_8.setCoincident(SketchLine_33.endPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_44 = Sketch_8.setCoincident( + SketchLine_33.endPoint(), SketchLine_34.startPoint() +) SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_48") SketchLine_35 = Sketch_8.addLine(6, 89.3, 6, 70) SketchLine_35.setName("SketchLine_37") SketchLine_35.result().setName("SketchLine_37") -SketchConstraintCoincidence_45 = Sketch_8.setCoincident(SketchLine_34.endPoint(), SketchLine_35.startPoint()) +SketchConstraintCoincidence_45 = Sketch_8.setCoincident( + SketchLine_34.endPoint(), SketchLine_35.startPoint() +) SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_49") SketchLine_36 = Sketch_8.addLine(6, 70, 0, 70) SketchLine_36.setName("SketchLine_38") SketchLine_36.result().setName("SketchLine_38") -SketchConstraintCoincidence_46 = Sketch_8.setCoincident(SketchLine_35.endPoint(), SketchLine_36.startPoint()) +SketchConstraintCoincidence_46 = Sketch_8.setCoincident( + SketchLine_35.endPoint(), SketchLine_36.startPoint() +) SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_50") -SketchProjection_14 = Sketch_8.addProjection(model.selection("VERTEX", "Sketch_7/SketchCircle_8"), False) +SketchProjection_14 = Sketch_8.addProjection( + model.selection("VERTEX", "Sketch_7/SketchCircle_8"), False +) SketchPoint_8 = SketchProjection_14.createdFeature() -SketchConstraintCoincidence_47 = Sketch_8.setCoincident(SketchLine_36.endPoint(), SketchPoint_8.result()) +SketchConstraintCoincidence_47 = Sketch_8.setCoincident( + SketchLine_36.endPoint(), SketchPoint_8.result() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_51") SketchLine_37 = Sketch_8.addLine(0, 70, 0, 97) SketchLine_37.setName("SketchLine_39") SketchLine_37.result().setName("SketchLine_39") -SketchConstraintCoincidence_48 = Sketch_8.setCoincident(SketchLine_36.endPoint(), SketchLine_37.startPoint()) +SketchConstraintCoincidence_48 = Sketch_8.setCoincident( + SketchLine_36.endPoint(), SketchLine_37.startPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_52") -SketchConstraintCoincidence_49 = Sketch_8.setCoincident(SketchLine_31.startPoint(), SketchLine_37.endPoint()) +SketchConstraintCoincidence_49 = Sketch_8.setCoincident( + SketchLine_31.startPoint(), SketchLine_37.endPoint() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_53") SketchConstraintHorizontal_4 = Sketch_8.setHorizontal(SketchLine_36.result()) SketchConstraintHorizontal_4.setName("SketchConstraintHorizontal_5") @@ -374,22 +821,58 @@ SketchConstraintVertical_4 = Sketch_8.setVertical(SketchLine_35.result()) SketchConstraintLength_3 = Sketch_8.setLength(SketchLine_31.result(), 4.25) SketchConstraintLength_4 = Sketch_8.setLength(SketchLine_36.result(), 6) SketchConstraintLength_5 = Sketch_8.setLength(SketchLine_35.result(), 19.3) -SketchConstraintAngle_4 = Sketch_8.setAngle(SketchLine_34.result(), SketchLine_31.result(), 45) -SketchProjection_15 = Sketch_8.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintAngle_4 = Sketch_8.setAngle( + SketchLine_34.result(), SketchLine_31.result(), 45 +) +SketchProjection_15 = Sketch_8.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_38 = SketchProjection_15.createdFeature() SketchLine_38.setName("SketchLine_40") SketchLine_38.result().setName("SketchLine_40") -SketchConstraintDistance_5 = Sketch_8.setDistance(SketchLine_33.startPoint(), SketchLine_38.result(), 97, True) +SketchConstraintDistance_5 = Sketch_8.setDistance( + SketchLine_33.startPoint(), SketchLine_38.result(), 97, True +) model.do() -Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchLine_39r-SketchLine_38r-SketchLine_37r-SketchLine_36r-SketchLine_35r-SketchLine_33r")], model.selection("EDGE", "PartSet/OZ"), 360, 0) -Fuse_3 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cut_2_1"), model.selection("SOLID", "Revolution_2_1")]) -Fillet_2 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Fuse_3_1/Modified_Face&Extrusion_3_1/To_Face][Revolution_2_1/Generated_Face&Sketch_8/SketchLine_37]")], 1) +Revolution_2 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_8/Face-SketchLine_39r-SketchLine_38r-SketchLine_37r-SketchLine_36r-SketchLine_35r-SketchLine_33r", + ) + ], + model.selection("EDGE", "PartSet/OZ"), + 360, + 0, +) +Fuse_3 = model.addFuse( + Part_1_doc, + [model.selection("SOLID", "Cut_2_1"), model.selection("SOLID", "Revolution_2_1")], +) +Fillet_2 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Fuse_3_1/Modified_Face&Extrusion_3_1/To_Face][Revolution_2_1/Generated_Face&Sketch_8/SketchLine_37]", + ) + ], + 1, +) model.testHaveNamingSubshapes(Fillet_2, model, Part_1_doc) -Group_4_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_2_2"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_3_2"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_4_2")] +Group_4_objects = [ + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_2_2"), + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_3_2"), + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_4_2"), +] Group_4 = model.addGroup(Part_1_doc, Group_4_objects) Group_4.setName("SCREW") Group_4.result().setName("SCREW") -Group_5 = model.addGroup(Part_1_doc, [model.selection("FACE", "Revolution_2_1/Generated_Face&Sketch_8/SketchLine_33")]) +Group_5 = model.addGroup( + Part_1_doc, + [model.selection("FACE", "Revolution_2_1/Generated_Face&Sketch_8/SketchLine_33")], +) Group_5.setName("TOP") Group_5.result().setName("TOP") model.do() @@ -406,16 +889,19 @@ model.testNbSubShapes(Fillet_2, GeomAPI_Shape.VERTEX, [1056]) model.testResultsVolumes(Fillet_2, [41200.919845003852969966828823090]) from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() # Check that the features are not in error for i in range(Part_1_doc.size("Features")): - feature = objectToFeature(Part_1_doc.object("Features", i)) - name = feature.name() - error = feature.error() - assert(error == ''), "The feature {0} is in error: {1}".format(name, error) - assert(aFactory.validate(feature)), "The feature {0} is in error: {1}".format(name, error) + feature = objectToFeature(Part_1_doc.object("Features", i)) + name = feature.name() + error = feature.error() + assert error == "", "The feature {0} is in error: {1}".format(name, error) + assert aFactory.validate(feature), "The feature {0} is in error: {1}".format( + name, error + ) -assert(Part_1_doc.size("Groups") == 5) +assert Part_1_doc.size("Groups") == 5 -assert(model.checkPythonDump()) \ No newline at end of file +assert model.checkPythonDump() diff --git a/src/ModelHighAPI/Test/Test2488.py b/src/ModelHighAPI/Test/Test2488.py index 0ab88ed41..400069f92 100644 --- a/src/ModelHighAPI/Test/Test2488.py +++ b/src/ModelHighAPI/Test/Test2488.py @@ -27,24 +27,46 @@ 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, 4, 6.2, 4) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +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()) +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()) +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()) +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) +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()) +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()) +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()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_8.endPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result()) @@ -54,28 +76,62 @@ 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_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) +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) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchCircle_2 = Sketch_2.addCircle(4.113620667973598, 2.375000000005359, 1.1) SketchCircle_2.setName("SketchCircle_3") SketchCircle_2.result().setName("SketchCircle_3") SketchCircle_2.results()[1].setName("SketchCircle_3_2") -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_2.center()) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_2.center() +) SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_1.results()[1], 4.75) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], 1.1) 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/SketchLine_1"), False) +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/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) +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 +) [SketchCircle_3, SketchCircle_4] = SketchMultiRotation_1.rotated() SketchCircle_4.setName("SketchCircle_5") SketchCircle_4.result().setName("SketchCircle_5") @@ -87,39 +143,75 @@ SketchCircle_5 = Sketch_2.addCircle(4.745479052513824, 0.2071920899853478, 0.65) SketchCircle_5.setName("SketchCircle_6") SketchCircle_5.result().setName("SketchCircle_6") SketchCircle_5.results()[1].setName("SketchCircle_6_2") -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_5.center()) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_5.center() +) SketchCircle_6 = Sketch_2.addCircle(4.745479052513824, 0.2071920899853478, 0.8) SketchCircle_6.setName("SketchCircle_7") SketchCircle_6.result().setName("SketchCircle_7") SketchCircle_6.results()[1].setName("SketchCircle_7_2") -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchCircle_5.center(), SketchCircle_6.center()) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchCircle_5.center(), SketchCircle_6.center() +) SketchCircle_7 = Sketch_2.addCircle(2.5521731400059, 4.006109367385169, 0.8) SketchCircle_7.setName("SketchCircle_8") SketchCircle_7.result().setName("SketchCircle_8") SketchCircle_7.results()[1].setName("SketchCircle_8_2") -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_7.center()) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_7.center() +) SketchCircle_8 = Sketch_2.addCircle(2.5521731400059, 4.006109367385169, 0.65) SketchCircle_8.setName("SketchCircle_9") SketchCircle_8.result().setName("SketchCircle_9") SketchCircle_8.results()[1].setName("SketchCircle_9_2") -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_8.center()) -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchCircle_7.center(), SketchCircle_8.center()) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchCircle_1.results()[1], SketchCircle_8.center() +) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchCircle_7.center(), SketchCircle_8.center() +) SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_6.results()[1], 0.8) SketchConstraintRadius_4 = Sketch_2.setRadius(SketchCircle_5.results()[1], 0.65) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchCircle_5.results()[1], SketchCircle_8.results()[1]) -SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_7.results()[1], SketchCircle_6.results()[1]) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchCircle_5.results()[1], SketchCircle_8.results()[1] +) +SketchConstraintEqual_2 = Sketch_2.setEqual( + SketchCircle_7.results()[1], SketchCircle_6.results()[1] +) SketchLine_11 = Sketch_2.addLine(0, 0, 4.745479052513824, 0.2071920899853478) SketchLine_11.setAuxiliary(True) -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchCircle_5.center(), SketchLine_11.endPoint()) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchCircle_5.center(), SketchLine_11.endPoint() +) SketchLine_12 = Sketch_2.addLine(2.5521731400059, 4.006109367385169, 0, 0) SketchLine_12.setAuxiliary(True) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchCircle_7.center(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_12.endPoint()) -SketchConstraintAngle_2 = Sketch_2.setAngle(SketchLine_11.result(), SketchLine_9.result(), 27.5) -SketchConstraintAngle_3 = Sketch_2.setAngle(SketchLine_9.result(), SketchLine_12.result(), 27.5) -SketchMultiRotation_2 = Sketch_2.addRotation([SketchCircle_7.results()[1], SketchCircle_6.results()[1]], SketchCircle_1.center(), 120, 3) -[SketchCircle_9, SketchCircle_10, SketchCircle_11, SketchCircle_12] = SketchMultiRotation_2.rotated() +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchCircle_7.center(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_12.endPoint() +) +SketchConstraintAngle_2 = Sketch_2.setAngle( + SketchLine_11.result(), SketchLine_9.result(), 27.5 +) +SketchConstraintAngle_3 = Sketch_2.setAngle( + SketchLine_9.result(), SketchLine_12.result(), 27.5 +) +SketchMultiRotation_2 = Sketch_2.addRotation( + [SketchCircle_7.results()[1], SketchCircle_6.results()[1]], + SketchCircle_1.center(), + 120, + 3, +) +[ + SketchCircle_9, + SketchCircle_10, + SketchCircle_11, + SketchCircle_12, +] = SketchMultiRotation_2.rotated() SketchCircle_12.setName("SketchCircle_13") SketchCircle_12.result().setName("SketchCircle_13") SketchCircle_12.results()[1].setName("SketchCircle_13_2") @@ -132,7 +224,12 @@ SketchCircle_10.results()[1].setName("SketchCircle_12_2") SketchCircle_9.setName("SketchCircle_10") SketchCircle_9.result().setName("SketchCircle_10") SketchCircle_9.results()[1].setName("SketchCircle_10_2") -SketchMultiRotation_3 = Sketch_2.addRotation([SketchCircle_8.results()[1], SketchCircle_5.results()[1]], SketchAPI_Line(SketchLine_10).startPoint(), 120, 2) +SketchMultiRotation_3 = Sketch_2.addRotation( + [SketchCircle_8.results()[1], SketchCircle_5.results()[1]], + SketchAPI_Line(SketchLine_10).startPoint(), + 120, + 2, +) [SketchCircle_13, SketchCircle_14] = SketchMultiRotation_3.rotated() SketchCircle_14.setName("SketchCircle_15") SketchCircle_14.result().setName("SketchCircle_15") @@ -154,29 +251,80 @@ SketchCircle_17.result().setName("SketchCircle_18") SketchCircle_17.results()[1].setName("SketchCircle_18_2") SketchLine_13 = Sketch_2.addLine(0, 0, 0, 5) SketchLine_13.setAuxiliary(True) -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchCircle_15.center(), SketchLine_13.endPoint()) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchCircle_15.center(), SketchLine_13.endPoint() +) SketchLine_14 = Sketch_2.addLine(0, 0, 4.259590630302757, -2.982597469025442) SketchLine_14.setAuxiliary(True) -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchCircle_17.center(), SketchLine_14.endPoint()) -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchCircle_16.center(), SketchLine_14.result()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchCircle_17.center(), SketchLine_14.endPoint() +) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchCircle_16.center(), SketchLine_14.result() +) SketchConstraintRadius_5 = Sketch_2.setRadius(SketchCircle_16.results()[1], 0.3) SketchConstraintRadius_6 = Sketch_2.setRadius(SketchCircle_17.results()[1], 0.5) -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_10).startPoint(), SketchCircle_16.center(), 4, True) -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_1.center(), SketchCircle_17.center(), 5.2, True) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchAPI_Line(SketchLine_10).startPoint(), SketchCircle_16.center(), 4, True +) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchCircle_17.center(), 5.2, True +) SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_13.result(), 5) SketchConstraintRadius_7 = Sketch_2.setRadius(SketchCircle_15.results()[1], 0.45) -SketchConstraintAngle_4 = Sketch_2.setAngleBackward(SketchLine_10.result(), SketchLine_14.result(), 35) -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchConstraintAngle_4 = Sketch_2.setAngleBackward( + SketchLine_10.result(), SketchLine_14.result(), 35 +) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_15 = SketchProjection_5.createdFeature() -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_15.result()) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_15.result() +) model.do() -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")]) +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() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelHighAPI/Test/TestDeflectionDump.py b/src/ModelHighAPI/Test/TestDeflectionDump.py index 7c7301131..2f6665776 100644 --- a/src/ModelHighAPI/Test/TestDeflectionDump.py +++ b/src/ModelHighAPI/Test/TestDeflectionDump.py @@ -24,11 +24,19 @@ 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(-325.90051457976, -18.010291595197, 258.003584159371) +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_2r")], 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() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelHighAPI/Test/TestDouble.py b/src/ModelHighAPI/Test/TestDouble.py index b3c215534..5f7420f47 100644 --- a/src/ModelHighAPI/Test/TestDouble.py +++ b/src/ModelHighAPI/Test/TestDouble.py @@ -21,13 +21,13 @@ import unittest import ModelHighAPI -class DoubleTestCase(unittest.TestCase): +class DoubleTestCase(unittest.TestCase): def test_create_default(self): default = ModelHighAPI.ModelHighAPI_Double() def test_create_from_double(self): - from_double = ModelHighAPI.ModelHighAPI_Double(100.) + from_double = ModelHighAPI.ModelHighAPI_Double(100.0) def test_create_from_text(self): from_string = ModelHighAPI.ModelHighAPI_Double("200 + x") diff --git a/src/ModelHighAPI/Test/TestInteger.py b/src/ModelHighAPI/Test/TestInteger.py index d9962a28f..23c8f69fc 100644 --- a/src/ModelHighAPI/Test/TestInteger.py +++ b/src/ModelHighAPI/Test/TestInteger.py @@ -21,8 +21,8 @@ import unittest import ModelHighAPI -class IntegerTestCase(unittest.TestCase): +class IntegerTestCase(unittest.TestCase): def test_create_default(self): default = ModelHighAPI.ModelHighAPI_Integer() diff --git a/src/ModelHighAPI/Test/TestRefAttr.py b/src/ModelHighAPI/Test/TestRefAttr.py index 1566e3b45..1c52e9a50 100644 --- a/src/ModelHighAPI/Test/TestRefAttr.py +++ b/src/ModelHighAPI/Test/TestRefAttr.py @@ -23,8 +23,8 @@ import ModelAPI import ModelHighAPI from salome.shaper import model -class FeaturesFixture(unittest.TestCase): +class FeaturesFixture(unittest.TestCase): def setUp(self): model.begin() # Create part @@ -39,7 +39,6 @@ class FeaturesFixture(unittest.TestCase): class RefAttrTestCase(FeaturesFixture): - def test_create_default(self): ModelHighAPI.ModelHighAPI_RefAttr() diff --git a/src/ModelHighAPI/Test/TestReference.py b/src/ModelHighAPI/Test/TestReference.py index d6c653b6d..4da9f2e0e 100644 --- a/src/ModelHighAPI/Test/TestReference.py +++ b/src/ModelHighAPI/Test/TestReference.py @@ -23,8 +23,8 @@ import ModelAPI import ModelHighAPI from salome.shaper import model -class FeaturesFixture(unittest.TestCase): +class FeaturesFixture(unittest.TestCase): def setUp(self): model.begin() # Create part @@ -39,7 +39,6 @@ class FeaturesFixture(unittest.TestCase): class RefAttrTestCase(FeaturesFixture): - def test_create_default(self): ModelHighAPI.ModelHighAPI_Reference() diff --git a/src/ModelHighAPI/Test/TestSetColors.py b/src/ModelHighAPI/Test/TestSetColors.py index 0a72bb5be..e26134080 100644 --- a/src/ModelHighAPI/Test/TestSetColors.py +++ b/src/ModelHighAPI/Test/TestSetColors.py @@ -29,7 +29,7 @@ Part_1_doc = Part_1.document() ### Create Box Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Box_1.result().setColor(random=True) -assert(Box_1.result().resultSubShapePair()[0].data().intArray("Color").isInitialized()) +assert Box_1.result().resultSubShapePair()[0].data().intArray("Color").isInitialized() ### Create next Box Box_2 = model.addBox(Part_1_doc, 10, 10, 10) @@ -38,11 +38,13 @@ aGreen = 200 aBlue = 100 Box_2.result().setColor(aRed, aGreen, aBlue) -assert(Box_2.result().resultSubShapePair()[0].data().intArray("Color").isInitialized()) -assert(Box_2.result().resultSubShapePair()[0].data().intArray("Color").value(0) == aRed) -assert(Box_2.result().resultSubShapePair()[0].data().intArray("Color").value(1) == aGreen) -assert(Box_2.result().resultSubShapePair()[0].data().intArray("Color").value(2) == aBlue) +assert Box_2.result().resultSubShapePair()[0].data().intArray("Color").isInitialized() +assert Box_2.result().resultSubShapePair()[0].data().intArray("Color").value(0) == aRed +assert ( + Box_2.result().resultSubShapePair()[0].data().intArray("Color").value(1) == aGreen +) +assert Box_2.result().resultSubShapePair()[0].data().intArray("Color").value(2) == aBlue model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ModelHighAPI/Test/TestUndoRedo.py b/src/ModelHighAPI/Test/TestUndoRedo.py index 7713154b7..40681daa2 100644 --- a/src/ModelHighAPI/Test/TestUndoRedo.py +++ b/src/ModelHighAPI/Test/TestUndoRedo.py @@ -27,10 +27,10 @@ model.do() Point_2 = model.addPoint(Part_1_doc, 0, 0, 0) model.end() -assert(Part_1_doc.size("Construction") == 1) +assert Part_1_doc.size("Construction") == 1 model.undo() -assert(Part_1_doc.size("Construction") == 0) +assert Part_1_doc.size("Construction") == 0 model.redo() -assert(Part_1_doc.size("Construction") == 1) +assert Part_1_doc.size("Construction") == 1 diff --git a/src/ParametersPlugin/Test/Test1806.py b/src/ParametersPlugin/Test/Test1806.py index 35f8789df..9325e6045 100644 --- a/src/ParametersPlugin/Test/Test1806.py +++ b/src/ParametersPlugin/Test/Test1806.py @@ -22,9 +22,9 @@ Unit test for testing the expression evaluation even no parameters are created """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * from GeomDataAPI import * @@ -33,17 +33,17 @@ __updated__ = "2016-11-23" aSession = ModelAPI_Session.get() aPartSet = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Create a part -#========================================================================= +# ========================================================================= aSession.startOperation() aPartFeature = aPartSet.addFeature("Part") aSession.finishOperation() aPart = aSession.activeDocument() -#========================================================================= +# ========================================================================= # Create a sketch with a line and length -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) aXOYPlane = objectToResult(aPartSet.objectByName("Construction", "XOY")) @@ -62,9 +62,10 @@ aDistance.real("ConstraintValue").setText("25/2") aSession.finishOperation() -assert(aDistance.real("ConstraintValue").value() == 12.5) -#========================================================================= +assert aDistance.real("ConstraintValue").value() == 12.5 +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/ParametersPlugin/Test/Test19036.py b/src/ParametersPlugin/Test/Test19036.py index f12450a0d..0ac8da664 100644 --- a/src/ParametersPlugin/Test/Test19036.py +++ b/src/ParametersPlugin/Test/Test19036.py @@ -37,12 +37,14 @@ Sketch_1.setHorizontal(SketchLine_1.result()) Sketch_1.setVertical(SketchLine_2.result()) Sketch_1.setHorizontal(SketchLine_3.result()) Sketch_1.setVertical(SketchLine_4.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_5 = SketchProjection_1.createdFeature() Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_5.result(), "a", True) model.do() model.end() -assert(Sketch_1.feature().error() == "") -assert(model.checkPythonDump()) +assert Sketch_1.feature().error() == "" +assert model.checkPythonDump() diff --git a/src/ParametersPlugin/Test/Test2392.py b/src/ParametersPlugin/Test/Test2392.py index 9f2b8bbc1..2c93b1cfd 100644 --- a/src/ParametersPlugin/Test/Test2392.py +++ b/src/ParametersPlugin/Test/Test2392.py @@ -29,16 +29,21 @@ model.addParameter(Part_1_doc, "Lambda", "1.8", "Engagement chracteristic") model.addParameter(Part_1_doc, "K", "0.565", "Tooth height coefficient") model.addParameter(Part_1_doc, "De", "d1*Lambda*(K+1./tan(pi/z))", "External diameter") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 38.16365) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "De/2") model.end() # due to the scenario, change the active document model.begin() from ModelAPI import * + aSession = ModelAPI_Session.get() aSession.setActiveDocument(partSet, False) model.do() @@ -50,8 +55,9 @@ aSession.setActiveDocument(Part_1_doc, False) model.end() import math -TOLERANCE = 1.e-7 + +TOLERANCE = 1.0e-7 # check the circle radius value -assert(math.fabs(SketchCircle_1.radius().value() - 64.95456276) < TOLERANCE) +assert math.fabs(SketchCircle_1.radius().value() - 64.95456276) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/ParametersPlugin/Test/Test2474.py b/src/ParametersPlugin/Test/Test2474.py index 64c488a55..492d1bdb4 100644 --- a/src/ParametersPlugin/Test/Test2474.py +++ b/src/ParametersPlugin/Test/Test2474.py @@ -25,14 +25,30 @@ model.addParameter(partSet, "l", "200") 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(138.3632494179343, 48.5641040948674, -61.63675058206567, 48.5641040948674) -SketchLine_2 = Sketch_1.addLine(-61.63675058206567, 48.5641040948674, -61.63675058206567, -46.51114810194107) -SketchLine_3 = Sketch_1.addLine(-61.63675058206567, -46.51114810194107, 138.3632494179343, -46.51114810194107) -SketchLine_4 = Sketch_1.addLine(138.3632494179343, -46.51114810194107, 138.3632494179343, 48.5641040948674) -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()) +SketchLine_1 = Sketch_1.addLine( + 138.3632494179343, 48.5641040948674, -61.63675058206567, 48.5641040948674 +) +SketchLine_2 = Sketch_1.addLine( + -61.63675058206567, 48.5641040948674, -61.63675058206567, -46.51114810194107 +) +SketchLine_3 = Sketch_1.addLine( + -61.63675058206567, -46.51114810194107, 138.3632494179343, -46.51114810194107 +) +SketchLine_4 = Sketch_1.addLine( + 138.3632494179343, -46.51114810194107, 138.3632494179343, 48.5641040948674 +) +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()) @@ -44,4 +60,4 @@ model.end() # Check that after substitution of module document "l" by part document "l" the value is updated aValue = SketchConstraintLength_1.feature().real("ConstraintValue").value() -assert(aValue == 300) +assert aValue == 300 diff --git a/src/ParametersPlugin/Test/TestImportInvalidParameters.py b/src/ParametersPlugin/Test/TestImportInvalidParameters.py index 3b4ef6c7f..247f2669a 100644 --- a/src/ParametersPlugin/Test/TestImportInvalidParameters.py +++ b/src/ParametersPlugin/Test/TestImportInvalidParameters.py @@ -33,4 +33,4 @@ aDir = os.path.join(data_dir, nameFile) aListOfParameters = model.importParameters(Part_1_doc, aDir) -assert(len(aListOfParameters) == 0) +assert len(aListOfParameters) == 0 diff --git a/src/ParametersPlugin/Test/TestImportParameters.py b/src/ParametersPlugin/Test/TestImportParameters.py index 071a2c90f..22a739fbc 100644 --- a/src/ParametersPlugin/Test/TestImportParameters.py +++ b/src/ParametersPlugin/Test/TestImportParameters.py @@ -35,6 +35,6 @@ aListOfParameters = model.importParameters(Part_1_doc, aDir) Box_1 = model.addBox(Part_1_doc, "Longueur", "Largeur", "Hauteur") -assert(len(Box_1.feature().error()) == 0) -assert(len(aListOfParameters) == 5) -assert(model.checkPythonDump()) +assert len(Box_1.feature().error()) == 0 +assert len(aListOfParameters) == 5 +assert model.checkPythonDump() diff --git a/src/ParametersPlugin/Test/TestParameterChangeValue.py b/src/ParametersPlugin/Test/TestParameterChangeValue.py index 2b52b976b..939b4c555 100644 --- a/src/ParametersPlugin/Test/TestParameterChangeValue.py +++ b/src/ParametersPlugin/Test/TestParameterChangeValue.py @@ -35,9 +35,9 @@ static const std::string MY_VALUE_ID("State"); """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from GeomDataAPI import * from ModelAPI import * import math @@ -46,7 +46,8 @@ from salome.shaper import model __updated__ = "2015-04-27" -#========================================================================= + +# ========================================================================= # Create several parameters and a feature. # 1. Basic parameter definition: # x1 = 150.0, y1 = 200.0 @@ -56,7 +57,7 @@ __updated__ = "2015-04-27" # CircleCenter = (x1 + 10.0, x1 + 20.0), CircleRadius = x1 # 3. Change value # x1 = 200.0 -#========================================================================= +# ========================================================================= class TestParameterRename(unittest.TestCase): def setUp(self): self.aSession = ModelAPI_Session.get() @@ -65,7 +66,7 @@ class TestParameterRename(unittest.TestCase): self.createFeature() def tearDown(self): - assert(model.checkPythonDump()) + assert model.checkPythonDump() self.aSession.closeAll() def createParameters(self): @@ -85,7 +86,7 @@ class TestParameterRename(unittest.TestCase): aParam = self.dtParams["x2"] aResultAttr = modelAPI_ResultParameter(aParam.firstResult()) - self.assertEqual(aResultAttr.data().real("Value").value(), 450.) + self.assertEqual(aResultAttr.data().real("Value").value(), 450.0) def createFeature(self): self.aSession.startOperation() @@ -100,8 +101,8 @@ class TestParameterRename(unittest.TestCase): aSketchCircle = aSketchFeature.addFeature("SketchCircle") anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center")) aRadiusAttr = aSketchCircle.real("circle_radius") - anCircleCentr.setValue(10., 20.) - aRadiusAttr.setValue(10.) + anCircleCentr.setValue(10.0, 20.0) + aRadiusAttr.setValue(10.0) self.aSession.finishOperation() self.anCircleCentr = anCircleCentr @@ -117,15 +118,15 @@ class TestParameterRename(unittest.TestCase): anOY = aSketchFeature.addFeature("SketchLine") aStartPoint = geomDataAPI_Point2D(anOY.attribute("StartPoint")) anEndPoint = geomDataAPI_Point2D(anOY.attribute("EndPoint")) - aStartPoint.setValue(0., 0.) - anEndPoint.setValue(0., 100.) + aStartPoint.setValue(0.0, 0.0) + anEndPoint.setValue(0.0, 100.0) anOYRes = modelAPI_Result(self.aDocument.objectByName("Construction", "OY")) anOY.selection("External").setValue(anOYRes, anOYRes.shape()) anOY.execute() refattrB.setObject(modelAPI_ResultConstruction(anOY.firstResult())) value = aDistanceConstraint1.real("ConstraintValue") value.setText("x1 + 10.0") - aDistanceConstraint1.execute(); + aDistanceConstraint1.execute() # fix Y coordinate aDistanceConstraint2 = aSketchFeature.addFeature("SketchConstraintDistance") refattrA = aDistanceConstraint2.refattr("ConstraintEntityA") @@ -134,15 +135,15 @@ class TestParameterRename(unittest.TestCase): anOX = aSketchFeature.addFeature("SketchLine") aStartPoint = geomDataAPI_Point2D(anOX.attribute("StartPoint")) anEndPoint = geomDataAPI_Point2D(anOX.attribute("EndPoint")) - aStartPoint.setValue(0., 0.) - anEndPoint.setValue(100., 0.) + aStartPoint.setValue(0.0, 0.0) + anEndPoint.setValue(100.0, 0.0) anOXRes = modelAPI_Result(self.aDocument.objectByName("Construction", "OX")) anOX.selection("External").setValue(anOXRes, anOXRes.shape()) anOX.execute() refattrB.setObject(modelAPI_ResultConstruction(anOX.firstResult())) value = aDistanceConstraint2.real("ConstraintValue") value.setText("x1 + 20.0") - aDistanceConstraint2.execute(); + aDistanceConstraint2.execute() # fix radius aRadiusConstraint = aSketchFeature.addFeature("SketchConstraintRadius") refattrA = aRadiusConstraint.refattr("ConstraintEntityA") @@ -152,9 +153,9 @@ class TestParameterRename(unittest.TestCase): aRadiusConstraint.execute() self.aSession.finishOperation() - self.assertEqual(self.anCircleCentr.x(), 160.) - self.assertEqual(self.anCircleCentr.y(), 170.) - self.assertEqual(aRadiusAttr.value(), 150.) + self.assertEqual(self.anCircleCentr.x(), 160.0) + self.assertEqual(self.anCircleCentr.y(), 170.0) + self.assertEqual(aRadiusAttr.value(), 150.0) def test_change_value(self): aParam = self.dtParams["x1"] @@ -164,19 +165,20 @@ class TestParameterRename(unittest.TestCase): self.aSession.finishOperation() # Check value of the parameter - self.assertEqual(aResultAttr.data().real("Value").value(), 200.) + self.assertEqual(aResultAttr.data().real("Value").value(), 200.0) # Check value of references aParam = self.dtParams["x2"] aResultAttr = modelAPI_ResultParameter(aParam.firstResult()) - self.assertEqual(aResultAttr.data().real("Value").value(), 500.) + self.assertEqual(aResultAttr.data().real("Value").value(), 500.0) # Check value in the feature - self.assertEqual(self.anCircleCentr.x(), 210.) - self.assertEqual(self.anCircleCentr.y(), 220.) - self.assertEqual(self.aRadiusAttr.value(), 200.) + self.assertEqual(self.anCircleCentr.x(), 210.0) + self.assertEqual(self.anCircleCentr.y(), 220.0) + self.assertEqual(self.aRadiusAttr.value(), 200.0) + if __name__ == "__main__": test_program = unittest.main(exit=False) assert test_program.result.wasSuccessful(), "Test failed" -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= diff --git a/src/ParametersPlugin/Test/TestParameterCreation.py b/src/ParametersPlugin/Test/TestParameterCreation.py index 5382b1db8..52234d2ec 100644 --- a/src/ParametersPlugin/Test/TestParameterCreation.py +++ b/src/ParametersPlugin/Test/TestParameterCreation.py @@ -35,9 +35,9 @@ static const std::string MY_VALUE_ID("State"); """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from GeomDataAPI import * from ModelAPI import * import math @@ -46,9 +46,9 @@ __updated__ = "2015-04-27" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -59,7 +59,7 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create several parameters. # 1. Basic parameter definition: # x1 = 150.0, y1 = 50.0, cr1 = 100.0, cl = 250.0; @@ -67,7 +67,7 @@ aSession.finishOperation() # x2 = x1 + 100.0, y2 = y1/2. # 3. Check math module # tm = 2 * pi -#========================================================================= +# ========================================================================= ltNames = ["x1", "y1", "cr1", "cl1"] ltExpressions = ["150.", "50.", "100.", "250."] dtParams = {} @@ -80,16 +80,16 @@ for name, expr in zip(ltNames, ltExpressions): aParamExpr.setValue(expr) dtParams[name] = aParam aSession.finishOperation() -assert (len(dtParams) == len(ltNames)) +assert len(dtParams) == len(ltNames) # Check results for name, expr in zip(ltNames, ltExpressions): aParam = dtParams[name] aResultAttr = modelAPI_ResultParameter(aParam.firstResult()) - assert(aResultAttr.data()) - assert(aResultAttr.data().real("Value")) + assert aResultAttr.data() + assert aResultAttr.data().real("Value") aResultValue = aResultAttr.data().real("Value").value() print(aResultValue, " == ", float(expr)) - assert(aResultValue == float(expr)) + assert aResultValue == float(expr) # Check referencing between parameters aSession.startOperation() @@ -107,16 +107,16 @@ aSession.finishOperation() aParam = dtParams["x2"] aResultAttr = modelAPI_ResultParameter(aParam.firstResult()) -assert(aResultAttr.data()) -assert(aResultAttr.data().real("Value")) +assert aResultAttr.data() +assert aResultAttr.data().real("Value") aX2Value = aResultAttr.data().real("Value").value() -assert (aX2Value == 250.) +assert aX2Value == 250.0 aParam = dtParams["y2"] aResultAttr = modelAPI_ResultParameter(aParam.firstResult()) -assert(aResultAttr.data()) -assert(aResultAttr.data().real("Value")) +assert aResultAttr.data() +assert aResultAttr.data().real("Value") aY2Value = aResultAttr.data().real("Value").value() -assert (aY2Value == 25.) +assert aY2Value == 25.0 # check math aSession.startOperation() aParam = aDocument.addFeature("Parameter") @@ -126,21 +126,21 @@ aParamExpr = aParam.string("expression") aParamExpr.setValue("round(2 * pi, 6)") aSession.finishOperation() aResultAttr = modelAPI_ResultParameter(aParam.firstResult()) -assert(aResultAttr.data()) -assert(aResultAttr.data().real("Value")) +assert aResultAttr.data() +assert aResultAttr.data().real("Value") aTmValue = aResultAttr.data().real("Value").value() -assert (aTmValue == round(2 * math.pi, 6)) -#========================================================================= +assert aTmValue == round(2 * math.pi, 6) +# ========================================================================= # Use parameters to set radius of a circle : # 1. Create a circle (250., 250), r = 25. # 2. Create a radius constraint and set 'cr1' as text value of constraint -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCircle = aSketchFeature.addFeature("SketchCircle") anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center")) aRadiusAttr = aSketchCircle.real("circle_radius") -anCircleCentr.setValue(250., 250) -aRadiusAttr.setValue(25.) +anCircleCentr.setValue(250.0, 250) +aRadiusAttr.setValue(25.0) aSession.finishOperation() # Apply parameter aSession.startOperation() @@ -151,19 +151,19 @@ aRadiusConstrAttr = aRadiusConstraint.real("ConstraintValue") aRadiusConstrAttr.setText("cr1") aRadiusConstraint.execute() aSession.finishOperation() -assert(aRadiusAttr.value() == 100.) -#========================================================================= +assert aRadiusAttr.value() == 100.0 +# ========================================================================= # Use parameters for a length constraint on a line: # 1. Create a line A(10., 10.) - B(-10., -10.) # 2. Create a length constraint, l = 100; # 3. Set a 'cl1' as text value of length attribute -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchLine = aSketchFeature.addFeature("SketchLine") aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) -aLineStartPoint.setValue(10., 10.) -aLineEndPoint.setValue(-10., -10.) +aLineStartPoint.setValue(10.0, 10.0) +aLineEndPoint.setValue(-10.0, -10.0) aSession.finishOperation() # Length constraint aSession.startOperation() @@ -178,10 +178,11 @@ aSession.startOperation() aLengthAttr = aLengthConstraint.real("ConstraintValue") aLengthAttr.setText("cl1") aSession.finishOperation() -assert(aLengthAttr.value() == 250.) -#========================================================================= +assert aLengthAttr.value() == 250.0 +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/ParametersPlugin/Test/TestParameterCreationError.py b/src/ParametersPlugin/Test/TestParameterCreationError.py index 205ee4bf6..929544fce 100644 --- a/src/ParametersPlugin/Test/TestParameterCreationError.py +++ b/src/ParametersPlugin/Test/TestParameterCreationError.py @@ -27,9 +27,9 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() aPart1 = model.addParameter(Part_1_doc, "Doing", "123", "Longueur de la pièce") try: - aPart2 = model.addParameter(Part_1_doc, "Doing", "323", "Long") + aPart2 = model.addParameter(Part_1_doc, "Doing", "323", "Long") except SyntaxError as anError: - assert(anError != "") - assert(str(anError).find("Variable name is not unique.") != -1) + assert anError != "" + assert str(anError).find("Variable name is not unique.") != -1 model.end() diff --git a/src/ParametersPlugin/Test/TestParameterDelete.py b/src/ParametersPlugin/Test/TestParameterDelete.py index 159a6cb1b..556ba5b37 100644 --- a/src/ParametersPlugin/Test/TestParameterDelete.py +++ b/src/ParametersPlugin/Test/TestParameterDelete.py @@ -21,10 +21,15 @@ 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) + assert ( + math.fabs(dx**2 + dy**2 - theLength**2) < 1.0e-8 + ), "Line length {} is not equal to expected {}".format( + math.sqrt(dx**2 + dy**2), theLength + ) model.begin() @@ -45,7 +50,9 @@ 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()) +SketchLine_1.startPoint().setValue( + SketchLine_1.startPoint().x() + 10.0, SketchLine_1.startPoint().y() +) model.do() assertLineLength(SketchLine_1, aLength) diff --git a/src/ParametersPlugin/Test/TestParameterErrorMsg.py b/src/ParametersPlugin/Test/TestParameterErrorMsg.py index 7546fbd56..e34861b42 100644 --- a/src/ParametersPlugin/Test/TestParameterErrorMsg.py +++ b/src/ParametersPlugin/Test/TestParameterErrorMsg.py @@ -25,20 +25,20 @@ partSet = model.moduleDocument() try: Param1 = model.addParameter(partSet, "", "100") except SyntaxError as anError: - assert(str(anError).find("Attribute \"variable\" value is empty.") != -1) + assert str(anError).find('Attribute "variable" value is empty.') != -1 # check error on empty value try: Param2 = model.addParameter(partSet, "L", "") except SyntaxError as anError: - assert(str(anError).find("Expression is empty.") != -1) + assert str(anError).find("Expression is empty.") != -1 # check error if name is not variable try: Param3 = model.addParameter(partSet, "100", "100") except SyntaxError as anError: - assert(str(anError).find("Incorrect variable name.") != -1) + assert str(anError).find("Incorrect variable name.") != -1 # check error on wrong value expression try: Param4 = model.addParameter(partSet, "N", "+-.so&@") except SyntaxError as anError: - assert(str(anError).find("invalid syntax") != -1) + assert str(anError).find("invalid syntax") != -1 model.end() diff --git a/src/ParametersPlugin/Test/TestParameterRename.py b/src/ParametersPlugin/Test/TestParameterRename.py index 6f1c95cbb..7769ec837 100644 --- a/src/ParametersPlugin/Test/TestParameterRename.py +++ b/src/ParametersPlugin/Test/TestParameterRename.py @@ -35,9 +35,9 @@ static const std::string MY_VALUE_ID("State"); """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from GeomDataAPI import * from ModelAPI import * import math @@ -46,7 +46,8 @@ from salome.shaper import model __updated__ = "2015-04-27" -#========================================================================= + +# ========================================================================= # Create several parameters and a feature. # 1. Basic parameter definition: # x1 = 150.0, y1 = 200.0 @@ -58,7 +59,7 @@ __updated__ = "2015-04-27" # x1 -> a1 # 4. Check renaming to not unique name # x1 -> y1 -#========================================================================= +# ========================================================================= class TestParameterRename(unittest.TestCase): def setUp(self): self.aSession = ModelAPI_Session.get() @@ -71,8 +72,8 @@ class TestParameterRename(unittest.TestCase): self.createFeature() def tearDown(self): - #assert(model.checkPythonDump()) - #self.aSession.closeAll() + # assert(model.checkPythonDump()) + # self.aSession.closeAll() pass def createParameters(self): @@ -92,7 +93,7 @@ class TestParameterRename(unittest.TestCase): aParam = self.dtParams["x2"] aResultAttr = modelAPI_ResultParameter(aParam.firstResult()) - self.assertEqual(aResultAttr.data().real("Value").value(), 450.) + self.assertEqual(aResultAttr.data().real("Value").value(), 450.0) def createFeature(self): self.aSession.startOperation() @@ -107,8 +108,8 @@ class TestParameterRename(unittest.TestCase): aSketchCircle = aSketchFeature.addFeature("SketchCircle") anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center")) aRadiusAttr = aSketchCircle.real("circle_radius") - anCircleCentr.setValue(10., 20.) - aRadiusAttr.setValue(10.) + anCircleCentr.setValue(10.0, 20.0) + aRadiusAttr.setValue(10.0) self.aSession.finishOperation() self.anCircleCentr = anCircleCentr @@ -124,14 +125,14 @@ class TestParameterRename(unittest.TestCase): anOY = aSketchFeature.addFeature("SketchLine") aStartPoint = geomDataAPI_Point2D(anOY.attribute("StartPoint")) anEndPoint = geomDataAPI_Point2D(anOY.attribute("EndPoint")) - aStartPoint.setValue(0., 0.) - anEndPoint.setValue(0., 100.) + aStartPoint.setValue(0.0, 0.0) + anEndPoint.setValue(0.0, 100.0) anOY.selection("External").selectSubShape("EDGE", "PartSet/OY") anOY.execute() refattrB.setObject(modelAPI_ResultConstruction(anOY.firstResult())) valueX = aDistanceConstraint1.real("ConstraintValue") valueX.setText("x1 + 10.0") - aDistanceConstraint1.execute(); + aDistanceConstraint1.execute() # fix Y coordinate aDistanceConstraint2 = aSketchFeature.addFeature("SketchConstraintDistance") refattrA = aDistanceConstraint2.refattr("ConstraintEntityA") @@ -140,14 +141,14 @@ class TestParameterRename(unittest.TestCase): anOX = aSketchFeature.addFeature("SketchLine") aStartPoint = geomDataAPI_Point2D(anOX.attribute("StartPoint")) anEndPoint = geomDataAPI_Point2D(anOX.attribute("EndPoint")) - aStartPoint.setValue(0., 0.) - anEndPoint.setValue(100., 0.) + aStartPoint.setValue(0.0, 0.0) + anEndPoint.setValue(100.0, 0.0) anOX.selection("External").selectSubShape("EDGE", "PartSet/OX") anOX.execute() refattrB.setObject(modelAPI_ResultConstruction(anOX.firstResult())) valueY = aDistanceConstraint2.real("ConstraintValue") valueY.setText("x1 + 20.0") - aDistanceConstraint2.execute(); + aDistanceConstraint2.execute() # fix radius aRadiusConstraint = aSketchFeature.addFeature("SketchConstraintRadius") refattrA = aRadiusConstraint.refattr("ConstraintEntityA") @@ -161,9 +162,9 @@ class TestParameterRename(unittest.TestCase): self.aCircleCenterY = valueY self.aCircleRadius = aRadiusConstrAttr - self.assertEqual(self.anCircleCentr.x(), 160.) - self.assertEqual(self.anCircleCentr.y(), 170.) - self.assertEqual(aRadiusAttr.value(), 150.) + self.assertEqual(self.anCircleCentr.x(), 160.0) + self.assertEqual(self.anCircleCentr.y(), 170.0) + self.assertEqual(aRadiusAttr.value(), 150.0) # add a line and rotate it around origin self.aSession.startOperation() @@ -171,10 +172,10 @@ class TestParameterRename(unittest.TestCase): aStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) aEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) aStartPoint.setText("px", "0") - aEndPoint.setValue(0., 0.) + aEndPoint.setValue(0.0, 0.0) self.aSession.finishOperation() self.aSession.startOperation() - aEndPoint.move(100., 0.) + aEndPoint.move(100.0, 0.0) self.aSession.finishOperation() self.aSession.startOperation() @@ -220,9 +221,9 @@ class TestParameterRename(unittest.TestCase): self.assertEqual(self.aCircleCenterY.text(), "a1 + 20.0") self.assertEqual(self.aCircleRadius.text(), "a1") # Check values - self.assertEqual(self.anCircleCentr.x(), 160.) - self.assertEqual(self.anCircleCentr.y(), 170.) - self.assertEqual(self.aRadiusAttr.value(), 150.) + self.assertEqual(self.anCircleCentr.x(), 160.0) + self.assertEqual(self.anCircleCentr.y(), 170.0) + self.assertEqual(self.aRadiusAttr.value(), 150.0) def test_rename_integer(self): # rename integer parameter @@ -259,15 +260,15 @@ class TestParameterRename(unittest.TestCase): 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.) + self.assertEqual(self.aPoint2D.x(), 50.0) + self.assertEqual(self.aPoint3D.x(), 50.0) def test_rename_not_unique(self): # Rename to not unique name aParam = self.dtParams["x1"] aParamX1 = aParam aResultAttr = modelAPI_ResultParameter(aParam.firstResult()) - self.aSession.startOperation() # don't finish operation until feature is valid (real case) + self.aSession.startOperation() # don't finish operation until feature is valid (real case) aResultAttr.data().setName("y1") # Check rename in the parameter (Expected: renamed, but invalid) self.assertEqual(aParam.name(), "y1") @@ -281,13 +282,13 @@ class TestParameterRename(unittest.TestCase): self.assertEqual(self.aCircleCenterY.text(), "x1 + 20.0") self.assertEqual(self.aCircleRadius.text(), "x1") # Check values - self.assertEqual(self.anCircleCentr.x(), 160.) - self.assertEqual(self.anCircleCentr.y(), 170.) - self.assertEqual(self.aRadiusAttr.value(), 150.) + self.assertEqual(self.anCircleCentr.x(), 160.0) + self.assertEqual(self.anCircleCentr.y(), 170.0) + self.assertEqual(self.aRadiusAttr.value(), 150.0) # rename to the correct one, but new aResultAttr.data().setName("xx1") - self.aSession.finishOperation() # feature becomes valid + self.aSession.finishOperation() # feature becomes valid # Check rename in the parameter (Expected: renamed) self.assertEqual(validators.validate(aParamX1), True) self.assertEqual(aParamX1.name(), "xx1") @@ -300,14 +301,14 @@ class TestParameterRename(unittest.TestCase): self.assertEqual(self.aCircleCenterY.text(), "xx1 + 20.0") self.assertEqual(self.aCircleRadius.text(), "xx1") # Check values - self.assertEqual(self.anCircleCentr.x(), 160.) - self.assertEqual(self.anCircleCentr.y(), 170.) - self.assertEqual(self.aRadiusAttr.value(), 150.) + self.assertEqual(self.anCircleCentr.x(), 160.0) + self.assertEqual(self.anCircleCentr.y(), 170.0) + self.assertEqual(self.aRadiusAttr.value(), 150.0) if __name__ == "__main__": test_program = unittest.main(exit=False) assert test_program.result.wasSuccessful(), "Test failed" -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= diff --git a/src/ParametersPlugin/Test/TestParametersMgr.py b/src/ParametersPlugin/Test/TestParametersMgr.py index 4e65a0fcc..5320b8b07 100644 --- a/src/ParametersPlugin/Test/TestParametersMgr.py +++ b/src/ParametersPlugin/Test/TestParametersMgr.py @@ -23,9 +23,9 @@ class ParametersPlugin_ParametersMgr """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from ModelAPI import * __updated__ = "2018-12-05" @@ -36,6 +36,6 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aKind = "ParametersMgr" aParamMgr = aDocument.addFeature(aKind) -assert(aParamMgr is not None) -assert(aParamMgr.getKind() == aKind) +assert aParamMgr is not None +assert aParamMgr.getKind() == aKind aSession.finishOperation() diff --git a/src/ParametersPlugin/Test/TestQuotesInComment.py b/src/ParametersPlugin/Test/TestQuotesInComment.py index bec5642b1..7206b636d 100644 --- a/src/ParametersPlugin/Test/TestQuotesInComment.py +++ b/src/ParametersPlugin/Test/TestQuotesInComment.py @@ -24,13 +24,13 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -model.addParameter(Part_1_doc, "a", '10', 'longueur de l\'aile') -model.addParameter(Part_1_doc, "b", '12', 'trou à l\"origine') -model.addParameter(Part_1_doc, "c", '14', 'l\'opposé de l\"origine') +model.addParameter(Part_1_doc, "a", "10", "longueur de l'aile") +model.addParameter(Part_1_doc, "b", "12", 'trou à l"origine') +model.addParameter(Part_1_doc, "c", "14", "l'opposé de l\"origine") Box_1 = model.addBox(Part_1_doc, "a", "b", "c") model.end() -assert(len(Box_1.feature().error()) == 0) -assert(model.checkPythonDump()) +assert len(Box_1.feature().error()) == 0 +assert model.checkPythonDump() diff --git a/src/PartSetAPI/Test/TestRemoveDuplicate.py b/src/PartSetAPI/Test/TestRemoveDuplicate.py index a33f09940..7808157c8 100644 --- a/src/PartSetAPI/Test/TestRemoveDuplicate.py +++ b/src/PartSetAPI/Test/TestRemoveDuplicate.py @@ -28,7 +28,11 @@ PartSet = model.moduleDocument() Part_1 = model.addPart(PartSet) Part_1_doc = Part_1.document() Point_2 = model.addPoint(Part_1_doc, 100, 50, 20) -Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Point_1")) +Axis_4 = model.addAxis( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("VERTEX", "Point_1"), +) model.do() # Duplicate this part twice, duplicate the first Copy also @@ -41,8 +45,8 @@ model.do() assert PartSet.size("Parts") == 4 i = 0 for n in ["Part_1", "Part_3", "Part_2", "Part_4"]: - assert PartSet.object("Parts", i).data().name() == n - i = i + 1 + assert PartSet.object("Parts", i).data().name() == n + i = i + 1 # Remove the middle Part model.removePart(Copy_2) @@ -54,8 +58,8 @@ model.do() assert PartSet.size("Parts") == 3 i = 0 for n in ["Part_1", "Part_2", "Part_4"]: - assert PartSet.object("Parts", i).data().name() == n - i = i + 1 + assert PartSet.object("Parts", i).data().name() == n + i = i + 1 # Remove a first copy model.removePart(Copy_1) @@ -70,5 +74,5 @@ model.undo() assert PartSet.size("Parts") == 3 i = 0 for n in ["Part_1", "Part_2", "Part_4"]: - assert PartSet.object("Parts", i).data().name() == n - i = i + 1 + assert PartSet.object("Parts", i).data().name() == n + i = i + 1 diff --git a/src/PrimitivesPlugin/doc/examples/box2.py b/src/PrimitivesPlugin/doc/examples/box2.py index 08336a61f..fd3e8f11c 100644 --- a/src/PrimitivesPlugin/doc/examples/box2.py +++ b/src/PrimitivesPlugin/doc/examples/box2.py @@ -6,6 +6,10 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Point_2 = model.addPoint(Part_1_doc, 20, 30, 40) Point_3 = model.addPoint(Part_1_doc, 40, 40, 50) -Box_2 = model.addBox(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")) +Box_2 = model.addBox( + Part_1_doc, + model.selection("VERTEX", "Point_1"), + model.selection("VERTEX", "Point_2"), +) model.do() model.end() diff --git a/src/PrimitivesPlugin/doc/examples/cone.py b/src/PrimitivesPlugin/doc/examples/cone.py index 33a8c3c50..622ff29e1 100644 --- a/src/PrimitivesPlugin/doc/examples/cone.py +++ b/src/PrimitivesPlugin/doc/examples/cone.py @@ -4,6 +4,13 @@ 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) +Cone_1 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 5, + 10, +) model.do() model.end() diff --git a/src/PrimitivesPlugin/doc/examples/cylinder1.py b/src/PrimitivesPlugin/doc/examples/cylinder1.py index 59ca22553..4028a7e34 100644 --- a/src/PrimitivesPlugin/doc/examples/cylinder1.py +++ b/src/PrimitivesPlugin/doc/examples/cylinder1.py @@ -4,6 +4,12 @@ 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) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) model.do() model.end() diff --git a/src/PrimitivesPlugin/doc/examples/cylinder2.py b/src/PrimitivesPlugin/doc/examples/cylinder2.py index 4129d7e2a..2465b5c48 100644 --- a/src/PrimitivesPlugin/doc/examples/cylinder2.py +++ b/src/PrimitivesPlugin/doc/examples/cylinder2.py @@ -4,6 +4,13 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Cylinder_2 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), model.selection("EDGE", "PartSet/OX"), 5, 10, 45) +Cylinder_2 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), + model.selection("EDGE", "PartSet/OX"), + 5, + 10, + 45, +) model.do() model.end() diff --git a/src/PrimitivesPlugin/doc/examples/sphere2.py b/src/PrimitivesPlugin/doc/examples/sphere2.py index 81f469ea2..8386c3c5c 100644 --- a/src/PrimitivesPlugin/doc/examples/sphere2.py +++ b/src/PrimitivesPlugin/doc/examples/sphere2.py @@ -4,6 +4,6 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Sphere_1 = model.addSphere(Part_1_doc,5,10,180,245,0,90) +Sphere_1 = model.addSphere(Part_1_doc, 5, 10, 180, 245, 0, 90) model.do() model.end() diff --git a/src/PrimitivesPlugin/doc/examples/torus.py b/src/PrimitivesPlugin/doc/examples/torus.py index ac7080525..640038f7a 100644 --- a/src/PrimitivesPlugin/doc/examples/torus.py +++ b/src/PrimitivesPlugin/doc/examples/torus.py @@ -4,6 +4,12 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Torus_1 = model.addTorus(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 15, 3) +Torus_1 = model.addTorus( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 15, + 3, +) model.do() model.end() diff --git a/src/PythonAPI/Test/Test2044.py b/src/PythonAPI/Test/Test2044.py index b099e5c3b..d5ae15e6d 100644 --- a/src/PythonAPI/Test/Test2044.py +++ b/src/PythonAPI/Test/Test2044.py @@ -25,18 +25,39 @@ 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(-184.375, -81.25, -71.87500000000006, 206.2500000000001) -SketchLine_2 = Sketch_1.addLine(-71.87500000000006, 206.2500000000001, 281.2500000000001, 178.125) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_2 = Sketch_1.addLine( + -71.87500000000006, 206.2500000000001, 281.2500000000001, 178.125 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(281.2500000000001, 178.125, 184.3750000000001, -109.375) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(184.3750000000001, -109.375, -184.375, -81.25) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_4.endPoint() +) model.do() -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", "PartSet/OZ"), 50, 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", "PartSet/OZ"), + 50, + 0, +) model.do() Extrusion_1.setDirection(model.selection("EDGE", "OX")) model.do() model.end() -assert (len(Extrusion_1.feature().error()) != 0) +assert len(Extrusion_1.feature().error()) != 0 diff --git a/src/PythonAPI/Test/TestAddRectangle.py b/src/PythonAPI/Test/TestAddRectangle.py index 3d0d28f78..5d4676754 100644 --- a/src/PythonAPI/Test/TestAddRectangle.py +++ b/src/PythonAPI/Test/TestAddRectangle.py @@ -48,4 +48,4 @@ rectangle_6 = sketch.addRectangleCentered(108, 59, 125, 175) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/PythonAPI/Test/TestCR.py b/src/PythonAPI/Test/TestCR.py index de9e7565f..11e985dc9 100644 --- a/src/PythonAPI/Test/TestCR.py +++ b/src/PythonAPI/Test/TestCR.py @@ -19,19 +19,21 @@ from salome.shaper import model, geom + def isCRImplemented(): CR = geom.CanonicalRecognition() return CR.isImplemented() + def GetShapeType(theShape): CR = geom.CanonicalRecognition() if CR.isLine(theShape, 0.1)[0]: return "Line" if CR.isPlane(theShape, 0.1)[0]: if CR.isCircle(theShape, 0.1)[0]: - return ("Plane","Circle") + return ("Plane", "Circle") if CR.isEllipse(theShape, 0.1)[0]: - return ("Plane","Ellipse") + return ("Plane", "Ellipse") return "Plane" if CR.isSphere(theShape, 0.1)[0]: return "Sphere" @@ -50,7 +52,13 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() ### Create Cylinder -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) +Cylinder_1 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) ### Create Shell Plane_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Cylinder_1_1/Face_2")]) @@ -59,42 +67,96 @@ Plane_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Cylinder_1_1/Face Recover_1 = model.addRecover(Part_1_doc, Plane_1, [Cylinder_1.result()]) ### Create Shell -Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Recover_1_1/Modified_Face&Cylinder_1_1/Face_1")]) +Shell_2 = model.addShell( + Part_1_doc, + [model.selection("FACE", "Recover_1_1/Modified_Face&Cylinder_1_1/Face_1")], +) ### Create Wire -Circle_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "[Recover_1_1/Modified_Face&Cylinder_1_1/Face_1][new_weak_name_2]")], False) +Circle_1 = model.addWire( + Part_1_doc, + [ + model.selection( + "EDGE", "[Recover_1_1/Modified_Face&Cylinder_1_1/Face_1][new_weak_name_2]" + ) + ], + False, +) ### Create Recover Recover_2 = model.addRecover(Part_1_doc, Circle_1, [Shell_2.result()]) ### Create Edge -Line_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "(Recover_2_1/Modified_Edge&Wire_1_1/Edge)")], False) +Line_1 = model.addEdge( + Part_1_doc, + [model.selection("EDGE", "(Recover_2_1/Modified_Edge&Wire_1_1/Edge)")], + False, +) ### Create Recover Cylinder_3 = model.addRecover(Part_1_doc, Line_1, [Recover_2.result()]) ### Create Sphere Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 10) -SphereShell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sphere_1_1/Face_1")]) +SphereShell_1 = model.addShell( + Part_1_doc, [model.selection("FACE", "Sphere_1_1/Face_1")] +) ### Create Cone -Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 0, 10) +Cone_1 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 0, + 10, +) ConeShell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Cone_1_1/Face_1")]) ### Create Sketch Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() ### Create SketchEllipse -SketchEllipse_1 = Sketch_1.addEllipse(-37.39690313669599, -52.92905511857006, 61.08141071866921, -16.40734649833807, 41.5747486523393) -[SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchPoint_8, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + -37.39690313669599, + -52.92905511857006, + 61.08141071866921, + -16.40734649833807, + 41.5747486523393, +) +[ + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchPoint_8, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) model.do() ### Create Wire -EllipseWire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchEllipse_1")], False) +EllipseWire_1 = model.addWire( + Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchEllipse_1")], False +) model.end() @@ -109,10 +171,10 @@ aEllipseShape = EllipseWire_1.defaultResult().shape() ### Check shapes types if isCRImplemented(): - assert (GetShapeType(aPlaneShape) == "Plane") - assert (GetShapeType(aCircleShape)[1] == "Circle") - assert (GetShapeType(aLineShape) == "Line") - assert (GetShapeType(aCylinderShape) == "Cylinder") - assert (GetShapeType(aSphereShape) == "Sphere") - assert (GetShapeType(aConeShape) == "Cone") - assert (GetShapeType(aEllipseShape)[1] == "Ellipse") + assert GetShapeType(aPlaneShape) == "Plane" + assert GetShapeType(aCircleShape)[1] == "Circle" + assert GetShapeType(aLineShape) == "Line" + assert GetShapeType(aCylinderShape) == "Cylinder" + assert GetShapeType(aSphereShape) == "Sphere" + assert GetShapeType(aConeShape) == "Cone" + assert GetShapeType(aEllipseShape)[1] == "Ellipse" diff --git a/src/PythonAPI/Test/TestFeatures.py b/src/PythonAPI/Test/TestFeatures.py index ea25cb865..05bcf5e37 100644 --- a/src/PythonAPI/Test/TestFeatures.py +++ b/src/PythonAPI/Test/TestFeatures.py @@ -23,11 +23,11 @@ import ModelAPI from salome.shaper import model -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Fixtures -class FeaturesFixture(unittest.TestCase): +class FeaturesFixture(unittest.TestCase): def setUp(self): model.begin() # Create part @@ -42,11 +42,12 @@ class FeaturesFixture(unittest.TestCase): # It does not set any attributes, so features invalid, and dump also invalid. model.reset() -#----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- # TestCases -class FeaturesTestCase(FeaturesFixture): +class FeaturesTestCase(FeaturesFixture): # def test_assert_error_on_empty_args(self): # features = [ # # Implemented in C++, add* without arguments doesn't exist @@ -75,14 +76,17 @@ class FeaturesTestCase(FeaturesFixture): def test_initialize_without_attributes(self): import ConstructionAPI + ConstructionAPI.ConstructionAPI_Axis(self.part.addFeature("Axis")) ConstructionAPI.ConstructionAPI_Plane(self.part.addFeature("Plane")) ConstructionAPI.ConstructionAPI_Point(self.part.addFeature("Point")) import ExchangeAPI + ExchangeAPI.ExchangeAPI_Import(self.part.addFeature("Import")) import FeaturesAPI + FeaturesAPI.FeaturesAPI_BooleanCut(self.part.addFeature("BooleanCut")) FeaturesAPI.FeaturesAPI_BooleanFuse(self.part.addFeature("BooleanFuse")) FeaturesAPI.FeaturesAPI_BooleanCommon(self.part.addFeature("BooleanCommon")) @@ -99,15 +103,19 @@ class FeaturesTestCase(FeaturesFixture): FeaturesAPI.FeaturesAPI_Translation(self.part.addFeature("Translation")) import CollectionAPI + CollectionAPI.CollectionAPI_Group(self.part.addFeature("Group")) import PrimitivesAPI + PrimitivesAPI.PrimitivesAPI_Box(self.part.addFeature("Box")) import ParametersAPI + ParametersAPI.ParametersAPI_Parameter(self.part.addFeature("Parameter")) -#----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- if __name__ == "__main__": test_program = unittest.main(exit=False) diff --git a/src/PythonAPI/Test/TestFeaturesExtrusion.py b/src/PythonAPI/Test/TestFeaturesExtrusion.py index c21522e4b..6632e969d 100644 --- a/src/PythonAPI/Test/TestFeaturesExtrusion.py +++ b/src/PythonAPI/Test/TestFeaturesExtrusion.py @@ -23,11 +23,11 @@ import ModelAPI from salome.shaper import model -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Fixtures -class FeaturesAddExtrusionFixture(unittest.TestCase): +class FeaturesAddExtrusionFixture(unittest.TestCase): def setUp(self): model.begin() # Create part @@ -37,12 +37,11 @@ class FeaturesAddExtrusionFixture(unittest.TestCase): def tearDown(self): model.end() - assert(model.checkPythonDump()) + assert model.checkPythonDump() model.reset() class FeaturesExtrusionFixture(FeaturesAddExtrusionFixture): - def setUp(self): FeaturesAddExtrusionFixture.setUp(self) # Create extrusion @@ -57,11 +56,12 @@ class FeaturesExtrusionFixture(FeaturesAddExtrusionFixture): def tearDown(self): FeaturesAddExtrusionFixture.tearDown(self) -#----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- # TestCases -class FeaturesAddExtrusionTestCase(FeaturesAddExtrusionFixture): +class FeaturesAddExtrusionTestCase(FeaturesAddExtrusionFixture): def test_add_extrusion_by_face_and_size(self): sketch = model.addSketch(self.part, model.defaultPlane("XOY")) circle = sketch.addCircle(0, 0, 10) @@ -99,45 +99,56 @@ class FeaturesAddExtrusionTestCase(FeaturesAddExtrusionFixture): base = base_sketch.selectFace() to_object = to_sketch.selectFace()[0] from_object = from_sketch.selectFace()[0] - extrusion = model.addExtrusion(self.part, base, - to_object, 15, - from_object, 20) + extrusion = model.addExtrusion(self.part, base, to_object, 15, from_object, 20) self.assertEqual(extrusion.creationMethod().value(), "ByPlanesAndOffsets") self.assertEqual(extrusion.toSize().isInitialized(), False) self.assertEqual(extrusion.fromSize().isInitialized(), False) -# self.assertEqual(extrusion.getToObject().context(), -# to_sketch.result()) + # self.assertEqual(extrusion.getToObject().context(), + # to_sketch.result()) self.assertEqual(extrusion.toOffset().value(), 15) -# self.assertEqual(extrusion.getFromObject().context(), -# from_sketch.result()) + # self.assertEqual(extrusion.getFromObject().context(), + # from_sketch.result()) self.assertEqual(extrusion.fromOffset().value(), 20) class FeaturesExtrusionTestCase(FeaturesExtrusionFixture): - def test_extrusion_feature_calls(self): # call method of the feature self.assertEqual(self.extrusion.getKind(), "Extrusion") def test_extrusion_get_attribute(self): # call method of the feature - self.assertTrue(isinstance(self.extrusion.baseObjects(), - ModelAPI.ModelAPI_AttributeSelectionList)) - self.assertTrue(isinstance(self.extrusion.creationMethod(), - ModelAPI.ModelAPI_AttributeString)) - self.assertTrue(isinstance(self.extrusion.toSize(), - ModelAPI.ModelAPI_AttributeDouble)) - self.assertTrue(isinstance(self.extrusion.fromSize(), - ModelAPI.ModelAPI_AttributeDouble)) - self.assertTrue(isinstance(self.extrusion.toObject(), - ModelAPI.ModelAPI_AttributeSelection)) - self.assertTrue(isinstance(self.extrusion.toOffset(), - ModelAPI.ModelAPI_AttributeDouble)) - self.assertTrue(isinstance(self.extrusion.fromObject(), - ModelAPI.ModelAPI_AttributeSelection)) - self.assertTrue(isinstance(self.extrusion.fromOffset(), - ModelAPI.ModelAPI_AttributeDouble)) + self.assertTrue( + isinstance( + self.extrusion.baseObjects(), ModelAPI.ModelAPI_AttributeSelectionList + ) + ) + self.assertTrue( + isinstance( + self.extrusion.creationMethod(), ModelAPI.ModelAPI_AttributeString + ) + ) + self.assertTrue( + isinstance(self.extrusion.toSize(), ModelAPI.ModelAPI_AttributeDouble) + ) + self.assertTrue( + isinstance(self.extrusion.fromSize(), ModelAPI.ModelAPI_AttributeDouble) + ) + self.assertTrue( + isinstance(self.extrusion.toObject(), ModelAPI.ModelAPI_AttributeSelection) + ) + self.assertTrue( + isinstance(self.extrusion.toOffset(), ModelAPI.ModelAPI_AttributeDouble) + ) + self.assertTrue( + isinstance( + self.extrusion.fromObject(), ModelAPI.ModelAPI_AttributeSelection + ) + ) + self.assertTrue( + isinstance(self.extrusion.fromOffset(), ModelAPI.ModelAPI_AttributeDouble) + ) def test_extrusion_set_sizes(self): self.extrusion.setSizes(15, 20) diff --git a/src/PythonAPI/Test/TestFeaturesRevolution.py b/src/PythonAPI/Test/TestFeaturesRevolution.py index 2a23e44ed..c4d9ae450 100644 --- a/src/PythonAPI/Test/TestFeaturesRevolution.py +++ b/src/PythonAPI/Test/TestFeaturesRevolution.py @@ -23,11 +23,11 @@ import ModelAPI from salome.shaper import model -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Fixtures -class FeaturesAddRevolutionFixture(unittest.TestCase): +class FeaturesAddRevolutionFixture(unittest.TestCase): def setUp(self): model.begin() # Create part @@ -37,12 +37,11 @@ class FeaturesAddRevolutionFixture(unittest.TestCase): def tearDown(self): model.end() - assert(model.checkPythonDump()) + assert model.checkPythonDump() model.reset() class FeaturesRevolutionFixture(FeaturesAddRevolutionFixture): - def setUp(self): FeaturesAddRevolutionFixture.setUp(self) # Create revolution @@ -64,11 +63,12 @@ class FeaturesRevolutionFixture(FeaturesAddRevolutionFixture): def tearDown(self): FeaturesAddRevolutionFixture.tearDown(self) -#----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- # TestCases -class FeaturesAddRevolutionTestCase(FeaturesAddRevolutionFixture): +class FeaturesAddRevolutionTestCase(FeaturesAddRevolutionFixture): def test_add_revolution_by_face_and_angles(self): # base base_sketch = model.addSketch(self.part, model.defaultPlane("XOY")) @@ -113,9 +113,9 @@ class FeaturesAddRevolutionTestCase(FeaturesAddRevolutionFixture): to_obejct = to_sketch.selectFace()[0] from_object = from_sketch.selectFace()[0] - self.revolution = model.addRevolution(self.part, base, axis_object, - to_obejct, 15, - from_object, 20) + self.revolution = model.addRevolution( + self.part, base, axis_object, to_obejct, 15, from_object, 20 + ) self.assertEqual(self.revolution.creationMethod().value(), "ByPlanesAndOffsets") self.assertNotEqual(self.revolution.toObject().context(), None) @@ -125,31 +125,45 @@ class FeaturesAddRevolutionTestCase(FeaturesAddRevolutionFixture): class FeaturesRevolutionTestCase(FeaturesRevolutionFixture): - def test_revolution_feature_calls(self): # call method of the feature self.assertEqual(self.revolution.getKind(), "Revolution") def test_revolution_get_attribute(self): # call method of the feature - self.assertTrue(isinstance(self.revolution.baseObjects(), - ModelAPI.ModelAPI_AttributeSelectionList)) - self.assertTrue(isinstance(self.revolution.axis(), - ModelAPI.ModelAPI_AttributeSelection)) - self.assertTrue(isinstance(self.revolution.creationMethod(), - ModelAPI.ModelAPI_AttributeString)) - self.assertTrue(isinstance(self.revolution.toAngle(), - ModelAPI.ModelAPI_AttributeDouble)) - self.assertTrue(isinstance(self.revolution.fromAngle(), - ModelAPI.ModelAPI_AttributeDouble)) - self.assertTrue(isinstance(self.revolution.toObject(), - ModelAPI.ModelAPI_AttributeSelection)) - self.assertTrue(isinstance(self.revolution.toOffset(), - ModelAPI.ModelAPI_AttributeDouble)) - self.assertTrue(isinstance(self.revolution.fromObject(), - ModelAPI.ModelAPI_AttributeSelection)) - self.assertTrue(isinstance(self.revolution.fromOffset(), - ModelAPI.ModelAPI_AttributeDouble)) + self.assertTrue( + isinstance( + self.revolution.baseObjects(), ModelAPI.ModelAPI_AttributeSelectionList + ) + ) + self.assertTrue( + isinstance(self.revolution.axis(), ModelAPI.ModelAPI_AttributeSelection) + ) + self.assertTrue( + isinstance( + self.revolution.creationMethod(), ModelAPI.ModelAPI_AttributeString + ) + ) + self.assertTrue( + isinstance(self.revolution.toAngle(), ModelAPI.ModelAPI_AttributeDouble) + ) + self.assertTrue( + isinstance(self.revolution.fromAngle(), ModelAPI.ModelAPI_AttributeDouble) + ) + self.assertTrue( + isinstance(self.revolution.toObject(), ModelAPI.ModelAPI_AttributeSelection) + ) + self.assertTrue( + isinstance(self.revolution.toOffset(), ModelAPI.ModelAPI_AttributeDouble) + ) + self.assertTrue( + isinstance( + self.revolution.fromObject(), ModelAPI.ModelAPI_AttributeSelection + ) + ) + self.assertTrue( + isinstance(self.revolution.fromOffset(), ModelAPI.ModelAPI_AttributeDouble) + ) def test_revolution_set_angles(self): self.revolution.setAngles(90, 270) diff --git a/src/PythonAPI/Test/TestModel.py b/src/PythonAPI/Test/TestModel.py index aa56a4282..a7d75b2a7 100644 --- a/src/PythonAPI/Test/TestModel.py +++ b/src/PythonAPI/Test/TestModel.py @@ -20,6 +20,7 @@ import unittest from salome.shaper import model + class ModelTestCase(unittest.TestCase): def setUp(self): model.begin() @@ -28,12 +29,13 @@ class ModelTestCase(unittest.TestCase): def tearDown(self): model.end() - assert(model.checkPythonDump()) + assert model.checkPythonDump() def test_add_sketch(self): plane = model.defaultPlane("XOY") model.addSketch(self.part, plane) + if __name__ == "__main__": test_program = unittest.main(exit=False) assert test_program.result.wasSuccessful(), "Test failed" diff --git a/src/PythonAPI/Test/TestPrimitivesBox.py b/src/PythonAPI/Test/TestPrimitivesBox.py index 164d3b9b8..98e2cfedc 100644 --- a/src/PythonAPI/Test/TestPrimitivesBox.py +++ b/src/PythonAPI/Test/TestPrimitivesBox.py @@ -23,8 +23,8 @@ import ModelAPI from salome.shaper import model -class PrimitivesAddBox(unittest.TestCase): +class PrimitivesAddBox(unittest.TestCase): def setUp(self): model.begin() # Create part @@ -36,27 +36,29 @@ class PrimitivesAddBox(unittest.TestCase): model.end() model.reset() -#----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- # TestCases -class PrimitivesAddBoxTestCase(PrimitivesAddBox): +class PrimitivesAddBoxTestCase(PrimitivesAddBox): def test_add_box_by_dimensions(self): box = model.addBox(self.part, 50, 20, 10) model.do() - self.assertEqual(box.creationMethod().value(),"BoxByDimensions") - self.assertEqual(box.dx().value(),50) - self.assertEqual(box.dy().value(),20) - self.assertEqual(box.dz().value(),10) + self.assertEqual(box.creationMethod().value(), "BoxByDimensions") + self.assertEqual(box.dx().value(), 50) + self.assertEqual(box.dy().value(), 20) + self.assertEqual(box.dz().value(), 10) def test_add_box_by_two_points(self): - point1 = model.addPoint(self.part,0,0,0).result() - point2 = model.addPoint(self.part,10,10,10).result() + point1 = model.addPoint(self.part, 0, 0, 0).result() + point2 = model.addPoint(self.part, 10, 10, 10).result() box = model.addBox(self.part, point1, point2) model.do() - self.assertEqual(box.creationMethod().value(),"BoxByTwoPoints") - self.assertEqual(box.firstPoint().context().shape().isVertex(),True) - self.assertEqual(box.secondPoint().context().shape().isVertex(),True) + self.assertEqual(box.creationMethod().value(), "BoxByTwoPoints") + self.assertEqual(box.firstPoint().context().shape().isVertex(), True) + self.assertEqual(box.secondPoint().context().shape().isVertex(), True) + if __name__ == "__main__": test_program = unittest.main(exit=False) diff --git a/src/PythonAPI/Test/TestShapeInfo.py b/src/PythonAPI/Test/TestShapeInfo.py index 5c03ad2ed..03d2e6b92 100644 --- a/src/PythonAPI/Test/TestShapeInfo.py +++ b/src/PythonAPI/Test/TestShapeInfo.py @@ -33,17 +33,49 @@ SketchLine_2 = Sketch_1.addLine(-100, 30, -100, -12) SketchLine_3 = Sketch_1.addLine(-100, -12, 100, -12) SketchLine_4 = Sketch_1.addLine(100, -12, 100, 30) 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(), 8, 0, "Faces|Wires") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f", + ) + ], + model.selection(), + 8, + 0, + "Faces|Wires", +) ### Create tool-set: all the needed types of edges and surfaces Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) SketchCircle_1 = Sketch_2.addCircle(-80, 10, 5) SketchEllipse_1 = Sketch_2.addEllipse(-51, 10, -39, 10, 5) -SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) # moon SketchArc_1 = Sketch_2.addArc(-22, 10, -22, 2, -22, 18, False) SketchEllipticArc_1 = Sketch_2.addEllipticArc(-22, 10, -22, 17, -22, 2, -22, 18, False) -SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipticArc_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) # cone SketchLine_9 = Sketch_2.addLine(3, 14, 3, -2) SketchLine_10 = Sketch_2.addLine(3, -2, 11, 14) @@ -57,72 +89,176 @@ SketchLine_13 = Sketch_2.addLine(76, 14, 76, 0) SketchArc_2 = Sketch_2.addArc(76, 7, 76, 14, 76, 0, True) model.do() ### Create extrusions and revolutions -Extrusion_2_objects = [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r"), - model.selection("FACE", "Sketch_2/Face-SketchEllipse_1f"), - model.selection("FACE", "Sketch_2/Face-SketchArc_1_2f-SketchEllipticArc_1r")] -Extrusion_2 = model.addExtrusion(Part_1_doc, Extrusion_2_objects, model.selection(), 8, 0, "Faces|Wires") -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9f-SketchLine_10f-SketchLine_11f")], model.selection("EDGE", "Sketch_2/SketchLine_9"), 180, 0) -Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection("EDGE", "Sketch_2/SketchLine_12"), 180, 0) -Revolution_3 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_13f-SketchArc_2_2f")], model.selection("EDGE", "Sketch_2/SketchLine_13"), 180, 0) +Extrusion_2_objects = [ + model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r"), + model.selection("FACE", "Sketch_2/Face-SketchEllipse_1f"), + model.selection("FACE", "Sketch_2/Face-SketchArc_1_2f-SketchEllipticArc_1r"), +] +Extrusion_2 = model.addExtrusion( + Part_1_doc, Extrusion_2_objects, model.selection(), 8, 0, "Faces|Wires" +) +Revolution_1 = model.addRevolution( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_9f-SketchLine_10f-SketchLine_11f" + ) + ], + model.selection("EDGE", "Sketch_2/SketchLine_9"), + 180, + 0, +) +Revolution_2 = model.addRevolution( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], + model.selection("EDGE", "Sketch_2/SketchLine_12"), + 180, + 0, +) +Revolution_3 = model.addRevolution( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchLine_13f-SketchArc_2_2f")], + model.selection("EDGE", "Sketch_2/SketchLine_13"), + 180, + 0, +) model.do() ### Fuse all -Fuse_1_objects_1 = [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.selection("SOLID", "Revolution_1_1"), - model.selection("SOLID", "Revolution_2_1"), - model.selection("SOLID", "Revolution_3_1")] -Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1, keepSubResults = True) +Fuse_1_objects_1 = [ + 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.selection("SOLID", "Revolution_1_1"), + model.selection("SOLID", "Revolution_2_1"), + model.selection("SOLID", "Revolution_3_1"), +] +Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1, keepSubResults=True) model.end() + # a method to compare tupes: element by element, double values are compared with precision 1.e-9 def compareTuples(theT1, theT2): - assert(len(theT1) == len(theT2)) - for i in range(len(theT1)): - assert(type(theT1[i]) == type(theT2[i])) - if type(theT1[i]) == float: - #print("Compare " + "{:0.9f}".format(theT1[i]) + " and " + "{:0.9f}".format(theT2[i])); - assert("{:0.9f}".format(theT1[i]) == "{:0.9f}".format(theT2[i])) - else: - assert(theT1[i] == theT2[i]) + assert len(theT1) == len(theT2) + for i in range(len(theT1)): + assert type(theT1[i]) == type(theT2[i]) + if type(theT1[i]) == float: + # print("Compare " + "{:0.9f}".format(theT1[i]) + " and " + "{:0.9f}".format(theT2[i])); + assert "{:0.9f}".format(theT1[i]) == "{:0.9f}".format(theT2[i]) + else: + assert theT1[i] == theT2[i] # check the whole solid aSolid = Fuse_1.feature().firstResult().shape() anInfo = geom.shapeInfo(aSolid) -compareTuples(anInfo, ('Solid',)) +compareTuples(anInfo, ("Solid",)) # check the shell aShell = aSolid.subShapes(GeomAPI_Shape.SHELL)[0] anInfo = geom.shapeInfo(aShell) -compareTuples(anInfo, ('Shell',)) +compareTuples(anInfo, ("Shell",)) # check faces aFaces = aShell.subShapes(GeomAPI_Shape.FACE) -compareTuples(geom.shapeInfo(aFaces[0]), ('Rectangle', 100.0, 30.0, 8.0, -0.0, 1.0, -0.0, 8.0, 200.0)) -compareTuples(geom.shapeInfo(aFaces[6]), ('Cone', 3.0, -2.0, 8.0, -0.0, 1.0, -0.0, 0.0, 8.0, 16.)) -compareTuples(geom.shapeInfo(aFaces[8]), ('Sphere', 76.0, 7.0, 8.0, 7.0)) -compareTuples(geom.shapeInfo(aFaces[9]), ('Cylinder', -80.0, 10.0, 16.0, -0.0, -0.0, -1.0, 5.0, 8.0)) -compareTuples(geom.shapeInfo(aFaces[10]), ('Face',)) # linear extrusion surface -compareTuples(geom.shapeInfo(aFaces[13]), ('Torus', 39.0, 10.0, 8.0, -0.0, 1.0, -0.0, 9.0, 5.0)) -compareTuples(geom.shapeInfo(aFaces[14]), ('Disk', -80.0, 10.0, 16.0, 0.0, 0.0, 1.0, 5.0)) # circular disk -compareTuples(geom.shapeInfo(aFaces[15]), ('Disk', -51.0, 10.0, 16.0, 0.0, 0.0, 1.0, 13.0, 5.0)) # elliptical disk -compareTuples(geom.shapeInfo(aFaces[16]), ('Plane', 0.0, 0.0, 16.0, 0.0, 0.0, 1.0)) +compareTuples( + geom.shapeInfo(aFaces[0]), + ("Rectangle", 100.0, 30.0, 8.0, -0.0, 1.0, -0.0, 8.0, 200.0), +) +compareTuples( + geom.shapeInfo(aFaces[6]), ("Cone", 3.0, -2.0, 8.0, -0.0, 1.0, -0.0, 0.0, 8.0, 16.0) +) +compareTuples(geom.shapeInfo(aFaces[8]), ("Sphere", 76.0, 7.0, 8.0, 7.0)) +compareTuples( + geom.shapeInfo(aFaces[9]), + ("Cylinder", -80.0, 10.0, 16.0, -0.0, -0.0, -1.0, 5.0, 8.0), +) +compareTuples(geom.shapeInfo(aFaces[10]), ("Face",)) # linear extrusion surface +compareTuples( + geom.shapeInfo(aFaces[13]), ("Torus", 39.0, 10.0, 8.0, -0.0, 1.0, -0.0, 9.0, 5.0) +) +compareTuples( + geom.shapeInfo(aFaces[14]), ("Disk", -80.0, 10.0, 16.0, 0.0, 0.0, 1.0, 5.0) +) # circular disk +compareTuples( + geom.shapeInfo(aFaces[15]), ("Disk", -51.0, 10.0, 16.0, 0.0, 0.0, 1.0, 13.0, 5.0) +) # elliptical disk +compareTuples(geom.shapeInfo(aFaces[16]), ("Plane", 0.0, 0.0, 16.0, 0.0, 0.0, 1.0)) # check wires aWires = aShell.subShapes(GeomAPI_Shape.WIRE) -compareTuples(geom.shapeInfo(aWires[0]), ('Polygon', True, 100.0, 30.0, 8.0, 100.0, 30.0, 0.0, -100.0, 30.0, 0.0, -100.0, 30.0, 8.0)) -compareTuples(geom.shapeInfo(aWires[6]), ('Wire', True)) +compareTuples( + geom.shapeInfo(aWires[0]), + ( + "Polygon", + True, + 100.0, + 30.0, + 8.0, + 100.0, + 30.0, + 0.0, + -100.0, + 30.0, + 0.0, + -100.0, + 30.0, + 8.0, + ), +) +compareTuples(geom.shapeInfo(aWires[6]), ("Wire", True)) # check edges anEdges = aFaces[0].subShapes(GeomAPI_Shape.EDGE) -compareTuples(geom.shapeInfo(anEdges[0]), ('Line segment', 100.0, 30.0, 0.0, 100.0, 30.0, 8.0)) -anEdges = aFaces[6].subShapes(GeomAPI_Shape.EDGE) # cone -compareTuples(geom.shapeInfo(anEdges[0]), ('Edge', True)) # Degenerated edge -compareTuples(geom.shapeInfo(anEdges[1]), ('Arc of circle', 3.0, 14.0, 8.0, 0.0, -1.0, 0.0, 8.0, 11.0, 14.0, 8.0, -5.0, 14.0, 8.0)) -anEdges = aFaces[9].subShapes(GeomAPI_Shape.EDGE) # cylinder -compareTuples(geom.shapeInfo(anEdges[2]), ('Circle', -80.0, 10.0, 8.0, 0.0, 0.0, 1.0, 5.0)) -anEdges = aFaces[10].subShapes(GeomAPI_Shape.EDGE) # ellipse -compareTuples(geom.shapeInfo(anEdges[2]), ('Ellipse', -51.0, 10.0, 8.0, 0.0, 0.0, 1.0, 13.0, 5.0)) -anEdges = aFaces[16].subShapes(GeomAPI_Shape.EDGE) # moon top -compareTuples(geom.shapeInfo(anEdges[1]), ('Arc of ellipse', -22.0, 10.0, 16.0, 0.0, -0.0, 1.0, 8.0, 3.872983346207417, -22.0, 2.0, 16.0, -22.0, 18.0, 16.0)) +compareTuples( + geom.shapeInfo(anEdges[0]), ("Line segment", 100.0, 30.0, 0.0, 100.0, 30.0, 8.0) +) +anEdges = aFaces[6].subShapes(GeomAPI_Shape.EDGE) # cone +compareTuples(geom.shapeInfo(anEdges[0]), ("Edge", True)) # Degenerated edge +compareTuples( + geom.shapeInfo(anEdges[1]), + ( + "Arc of circle", + 3.0, + 14.0, + 8.0, + 0.0, + -1.0, + 0.0, + 8.0, + 11.0, + 14.0, + 8.0, + -5.0, + 14.0, + 8.0, + ), +) +anEdges = aFaces[9].subShapes(GeomAPI_Shape.EDGE) # cylinder +compareTuples( + geom.shapeInfo(anEdges[2]), ("Circle", -80.0, 10.0, 8.0, 0.0, 0.0, 1.0, 5.0) +) +anEdges = aFaces[10].subShapes(GeomAPI_Shape.EDGE) # ellipse +compareTuples( + geom.shapeInfo(anEdges[2]), ("Ellipse", -51.0, 10.0, 8.0, 0.0, 0.0, 1.0, 13.0, 5.0) +) +anEdges = aFaces[16].subShapes(GeomAPI_Shape.EDGE) # moon top +compareTuples( + geom.shapeInfo(anEdges[1]), + ( + "Arc of ellipse", + -22.0, + 10.0, + 16.0, + 0.0, + -0.0, + 1.0, + 8.0, + 3.872983346207417, + -22.0, + 2.0, + 16.0, + -22.0, + 18.0, + 16.0, + ), +) # check vertex aVertex = aSolid.subShapes(GeomAPI_Shape.VERTEX)[0] -compareTuples(geom.shapeInfo(aVertex), ('Vertex', 100.0, 30.0, 0.0)) +compareTuples(geom.shapeInfo(aVertex), ("Vertex", 100.0, 30.0, 0.0)) diff --git a/src/PythonAPI/Test/TestSketcher.py b/src/PythonAPI/Test/TestSketcher.py index bd901f6fa..bc03a053a 100644 --- a/src/PythonAPI/Test/TestSketcher.py +++ b/src/PythonAPI/Test/TestSketcher.py @@ -23,6 +23,7 @@ from salome.shaper import model # Delta value for almost equal comparisons DELTA = 1e-10 + class SketcherTestCase(unittest.TestCase): def setUp(self): model.begin() @@ -33,5 +34,5 @@ class SketcherTestCase(unittest.TestCase): def tearDown(self): model.end() - assert(model.checkPythonDump()) + assert model.checkPythonDump() model.reset() diff --git a/src/PythonAPI/Test/TestSketcherAddArc.py b/src/PythonAPI/Test/TestSketcherAddArc.py index 8a9c80fd6..556a2ffa3 100644 --- a/src/PythonAPI/Test/TestSketcherAddArc.py +++ b/src/PythonAPI/Test/TestSketcherAddArc.py @@ -24,6 +24,7 @@ from salome.shaper import geom from TestSketcher import SketcherTestCase + class SketcherAddArc(SketcherTestCase): def test_arc_by_coords(self): arc = self.sketch.addArc(0, 1, 0, 0, 1, 1, False) diff --git a/src/PythonAPI/Test/TestSketcherAddCircle.py b/src/PythonAPI/Test/TestSketcherAddCircle.py index 7d1d94b9b..bbb972324 100644 --- a/src/PythonAPI/Test/TestSketcherAddCircle.py +++ b/src/PythonAPI/Test/TestSketcherAddCircle.py @@ -21,6 +21,7 @@ import unittest from salome.shaper import model from TestSketcher import SketcherTestCase + class SketcherAddCircle(SketcherTestCase): def test_add_cricle(self): circle = self.sketch.addCircle(0, 10, 20) diff --git a/src/PythonAPI/Test/TestSketcherAddLine.py b/src/PythonAPI/Test/TestSketcherAddLine.py index 09922c1ee..d440c4059 100644 --- a/src/PythonAPI/Test/TestSketcherAddLine.py +++ b/src/PythonAPI/Test/TestSketcherAddLine.py @@ -21,6 +21,7 @@ import unittest from salome.shaper import model from TestSketcher import SketcherTestCase + class SketcherAddLine(SketcherTestCase): def test_add_line(self): line = self.sketch.addLine(0, 0, 0, 1) @@ -41,4 +42,4 @@ class SketcherAddLine(SketcherTestCase): if __name__ == "__main__": test_program = unittest.main(verbosity=2, exit=False) - assert test_program.result.wasSuccessful(), "Test failed" \ No newline at end of file + assert test_program.result.wasSuccessful(), "Test failed" diff --git a/src/PythonAPI/Test/TestSketcherAddMirror.py b/src/PythonAPI/Test/TestSketcherAddMirror.py index 11d2e8735..9b5236b33 100644 --- a/src/PythonAPI/Test/TestSketcherAddMirror.py +++ b/src/PythonAPI/Test/TestSketcherAddMirror.py @@ -25,6 +25,7 @@ from GeomDataAPI import geomDataAPI_Point2D import logging + class SketcherAddLine(SketcherTestCase): def setUp(self): SketcherTestCase.setUp(self) @@ -45,5 +46,6 @@ class SketcherAddLine(SketcherTestCase): # self.assertEqual(center.x(), -30, msg="%s"%(dir(mirrored_circle))) # self.assertTrue(False, msg="%s" % (dir(mirrored_circle))) + if __name__ == "__main__": unittest.main(verbosity=2, exit=False) diff --git a/src/PythonAPI/Test/TestSketcherAddPoint.py b/src/PythonAPI/Test/TestSketcherAddPoint.py index 730d93ead..461a6f8a2 100644 --- a/src/PythonAPI/Test/TestSketcherAddPoint.py +++ b/src/PythonAPI/Test/TestSketcherAddPoint.py @@ -21,6 +21,7 @@ import unittest from salome.shaper import model from TestSketcher import SketcherTestCase + class SketcherAddPoint(SketcherTestCase): def test_add_point(self): point = self.sketch.addPoint(0, 1) @@ -35,6 +36,7 @@ class SketcherAddPoint(SketcherTestCase): self.assertEqual(point.coordinates().x(), 1.0) self.assertEqual(point.coordinates().y(), 2.0) + if __name__ == "__main__": test_program = unittest.main(verbosity=2, exit=False) - assert test_program.result.wasSuccessful(), "Test failed" \ No newline at end of file + assert test_program.result.wasSuccessful(), "Test failed" diff --git a/src/PythonAPI/Test/TestSketcherSetAngle.py b/src/PythonAPI/Test/TestSketcherSetAngle.py index 65d15e949..4afba7e0f 100644 --- a/src/PythonAPI/Test/TestSketcherSetAngle.py +++ b/src/PythonAPI/Test/TestSketcherSetAngle.py @@ -23,6 +23,7 @@ import math import TestSketcher from TestSketcher import SketcherTestCase + class SketcherSetAngle(SketcherTestCase): def runTest(self): # Set the constraint @@ -32,23 +33,23 @@ class SketcherSetAngle(SketcherTestCase): # Commit the transaction model.do() # Check the result - dot_product = (l1.endPoint().x() - l1.startPoint().x()) * \ - (l2.endPoint().x() - l2.startPoint().x()) + \ - (l1.endPoint().y() - l1.startPoint().y()) * \ - (l2.endPoint().y() - l2.startPoint().y()) + dot_product = (l1.endPoint().x() - l1.startPoint().x()) * ( + l2.endPoint().x() - l2.startPoint().x() + ) + (l1.endPoint().y() - l1.startPoint().y()) * ( + l2.endPoint().y() - l2.startPoint().y() + ) norm_1 = math.sqrt( - math.pow((l1.endPoint().x() - l1.startPoint().x()), 2) + - math.pow((l1.endPoint().y() - l1.startPoint().y()), 2) - ) + math.pow((l1.endPoint().x() - l1.startPoint().x()), 2) + + math.pow((l1.endPoint().y() - l1.startPoint().y()), 2) + ) norm_2 = math.sqrt( - math.pow((l2.endPoint().x() - l2.startPoint().x()), 2) + - math.pow((l2.endPoint().y() - l2.startPoint().y()), 2) - ) + math.pow((l2.endPoint().x() - l2.startPoint().x()), 2) + + math.pow((l2.endPoint().y() - l2.startPoint().y()), 2) + ) angle = math.acos(dot_product / (norm_1 * norm_2)) - self.assertAlmostEqual( - angle * 180 / math.pi, 30.0, delta=TestSketcher.DELTA - ) + self.assertAlmostEqual(angle * 180 / math.pi, 30.0, delta=TestSketcher.DELTA) + if __name__ == "__main__": test_program = unittest.main(exit=False) - assert test_program.result.wasSuccessful(), "Test failed" \ No newline at end of file + assert test_program.result.wasSuccessful(), "Test failed" diff --git a/src/PythonAPI/Test/TestSketcherSetCoincident.py b/src/PythonAPI/Test/TestSketcherSetCoincident.py index ae65cb670..f0c2ccd94 100644 --- a/src/PythonAPI/Test/TestSketcherSetCoincident.py +++ b/src/PythonAPI/Test/TestSketcherSetCoincident.py @@ -21,6 +21,7 @@ import unittest from salome.shaper import model from TestSketcher import SketcherTestCase + class SketcherSetCoincident(SketcherTestCase): def test_set_coincident(self): l1 = self.sketch.addLine(0, 0, 0, 1) @@ -38,6 +39,7 @@ class SketcherSetCoincident(SketcherTestCase): with self.assertRaises(TypeError): self.sketch.setCoincident(l1.endPoint()) + if __name__ == "__main__": test_program = unittest.main(verbosity=2, exit=False) - assert test_program.result.wasSuccessful(), "Test failed" \ No newline at end of file + assert test_program.result.wasSuccessful(), "Test failed" diff --git a/src/PythonAPI/Test/TestSketcherSetEqual.py b/src/PythonAPI/Test/TestSketcherSetEqual.py index 4475ff96b..2b65d91fd 100644 --- a/src/PythonAPI/Test/TestSketcherSetEqual.py +++ b/src/PythonAPI/Test/TestSketcherSetEqual.py @@ -23,6 +23,7 @@ import math import TestSketcher from TestSketcher import SketcherTestCase + class SketcherSetEqual(SketcherTestCase): def test_length_equality(self): # Set the constraint @@ -33,13 +34,13 @@ class SketcherSetEqual(SketcherTestCase): model.do() # Check the result length_1 = math.sqrt( - math.pow((l1.endPoint().x() - l1.startPoint().x()), 2) + - math.pow((l1.endPoint().y() - l1.startPoint().y()), 2) - ) + math.pow((l1.endPoint().x() - l1.startPoint().x()), 2) + + math.pow((l1.endPoint().y() - l1.startPoint().y()), 2) + ) length_2 = math.sqrt( - math.pow((l2.endPoint().x() - l2.startPoint().x()), 2) + - math.pow((l2.endPoint().y() - l2.startPoint().y()), 2) - ) + math.pow((l2.endPoint().x() - l2.startPoint().x()), 2) + + math.pow((l2.endPoint().y() - l2.startPoint().y()), 2) + ) self.assertAlmostEqual(length_1, length_2, delta=TestSketcher.DELTA) def test_radius_equality(self): @@ -53,8 +54,9 @@ class SketcherSetEqual(SketcherTestCase): self.assertAlmostEqual( circle_1.radius().value(), circle_2.radius().value(), - delta=TestSketcher.DELTA - ) + delta=TestSketcher.DELTA, + ) + if __name__ == "__main__": suite = unittest.TestLoader().loadTestsFromTestCase(SketcherSetEqual) diff --git a/src/PythonAPI/Test/TestSketcherSetFillet.py b/src/PythonAPI/Test/TestSketcherSetFillet.py index 0b2866ada..701f6c136 100644 --- a/src/PythonAPI/Test/TestSketcherSetFillet.py +++ b/src/PythonAPI/Test/TestSketcherSetFillet.py @@ -21,6 +21,7 @@ import unittest from salome.shaper import model from TestSketcher import SketcherTestCase + class SketcherSetFillet(SketcherTestCase): def test_fillet(self): l1 = self.sketch.addLine(0, 0, 0, 1) @@ -36,6 +37,7 @@ class SketcherSetFillet(SketcherTestCase): self.sketch.setFilletWithRadius(l1.startPoint(), 10.0) model.do() + if __name__ == "__main__": test_program = unittest.main(verbosity=2, exit=False) - assert test_program.result.wasSuccessful(), "Test failed" \ No newline at end of file + assert test_program.result.wasSuccessful(), "Test failed" diff --git a/src/PythonAPI/Test/TestSketcherSetFixed.py b/src/PythonAPI/Test/TestSketcherSetFixed.py index 55829d1ee..0bd39774b 100644 --- a/src/PythonAPI/Test/TestSketcherSetFixed.py +++ b/src/PythonAPI/Test/TestSketcherSetFixed.py @@ -21,6 +21,7 @@ import unittest from salome.shaper import model from TestSketcher import SketcherTestCase + class SketcherSetFixed(SketcherTestCase): def runTest(self): circle = self.sketch.addCircle(0, 10, 20) @@ -30,5 +31,6 @@ class SketcherSetFixed(SketcherTestCase): model.do() self.assertEqual((circle.center().x(), circle.center().y()), (0, 10)) + if __name__ == "__main__": unittest.main(verbosity=2, exit=False) diff --git a/src/PythonAPI/Test/TestSketcherSetHorizontal.py b/src/PythonAPI/Test/TestSketcherSetHorizontal.py index 8d40c65dc..b8b8102a8 100644 --- a/src/PythonAPI/Test/TestSketcherSetHorizontal.py +++ b/src/PythonAPI/Test/TestSketcherSetHorizontal.py @@ -21,6 +21,7 @@ import unittest from salome.shaper import model from TestSketcher import SketcherTestCase + class SketcherSetHorizontal(SketcherTestCase): def runTest(self): line = self.sketch.addLine(0, 0, 1, 1) @@ -28,6 +29,7 @@ class SketcherSetHorizontal(SketcherTestCase): model.do() self.assertEqual(line.startPoint().y(), line.endPoint().y()) + if __name__ == "__main__": test_program = unittest.main(exit=False) - assert test_program.result.wasSuccessful(), "Test failed" \ No newline at end of file + assert test_program.result.wasSuccessful(), "Test failed" diff --git a/src/PythonAPI/Test/TestSketcherSetLength.py b/src/PythonAPI/Test/TestSketcherSetLength.py index 998719cab..dec6f9c52 100644 --- a/src/PythonAPI/Test/TestSketcherSetLength.py +++ b/src/PythonAPI/Test/TestSketcherSetLength.py @@ -23,6 +23,7 @@ import math import TestSketcher from TestSketcher import SketcherTestCase + class SketcherSetLength(SketcherTestCase): def runTest(self): # Set the constraint @@ -32,11 +33,12 @@ class SketcherSetLength(SketcherTestCase): model.do() # Check the result length = math.sqrt( - math.pow((line.endPoint().x() - line.startPoint().x()), 2) + - math.pow((line.endPoint().y() - line.startPoint().y()), 2) - ) + math.pow((line.endPoint().x() - line.startPoint().x()), 2) + + math.pow((line.endPoint().y() - line.startPoint().y()), 2) + ) self.assertAlmostEqual(length, 25.0, delta=TestSketcher.DELTA) + if __name__ == "__main__": test_program = unittest.main(exit=False) - assert test_program.result.wasSuccessful(), "Test failed" \ No newline at end of file + assert test_program.result.wasSuccessful(), "Test failed" diff --git a/src/PythonAPI/Test/TestSketcherSetParallel.py b/src/PythonAPI/Test/TestSketcherSetParallel.py index e060e6df5..8a9717edf 100644 --- a/src/PythonAPI/Test/TestSketcherSetParallel.py +++ b/src/PythonAPI/Test/TestSketcherSetParallel.py @@ -21,6 +21,7 @@ import unittest from salome.shaper import model from TestSketcher import SketcherTestCase + class SketcherSetParallel(SketcherTestCase): def runTest(self): l1 = self.sketch.addLine(0, 0, 0, 1) @@ -28,6 +29,7 @@ class SketcherSetParallel(SketcherTestCase): self.sketch.setParallel(l1, l2) model.do() + if __name__ == "__main__": test_program = unittest.main(exit=False) - assert test_program.result.wasSuccessful(), "Test failed" \ No newline at end of file + assert test_program.result.wasSuccessful(), "Test failed" diff --git a/src/PythonAPI/Test/TestSketcherSetPerpendicular.py b/src/PythonAPI/Test/TestSketcherSetPerpendicular.py index ca79c8c03..3034e49cd 100644 --- a/src/PythonAPI/Test/TestSketcherSetPerpendicular.py +++ b/src/PythonAPI/Test/TestSketcherSetPerpendicular.py @@ -22,20 +22,24 @@ from salome.shaper import model import TestSketcher from TestSketcher import SketcherTestCase + class SketcherSetPerpendicular(SketcherTestCase): """Test case for prependicular constraint testing.""" + def runTest(self): l1 = self.sketch.addLine(0, 0, 0, 1) l2 = self.sketch.addLine(0, 0, 1, 1) self.sketch.setPerpendicular(l1, l2) model.do() - dot_product = (l1.endPoint().x() - l1.startPoint().x()) * \ - (l2.endPoint().x() - l2.startPoint().x()) + \ - (l1.endPoint().y() - l1.startPoint().y()) * \ - (l2.endPoint().y() - l2.startPoint().y()) + dot_product = (l1.endPoint().x() - l1.startPoint().x()) * ( + l2.endPoint().x() - l2.startPoint().x() + ) + (l1.endPoint().y() - l1.startPoint().y()) * ( + l2.endPoint().y() - l2.startPoint().y() + ) self.assertAlmostEqual(dot_product, 0.0, delta=TestSketcher.DELTA) + if __name__ == "__main__": test_program = unittest.main(exit=False) - assert test_program.result.wasSuccessful(), "Test failed" \ No newline at end of file + assert test_program.result.wasSuccessful(), "Test failed" diff --git a/src/PythonAPI/Test/TestSketcherSetRadius.py b/src/PythonAPI/Test/TestSketcherSetRadius.py index cd333a4d7..a38ba7bef 100644 --- a/src/PythonAPI/Test/TestSketcherSetRadius.py +++ b/src/PythonAPI/Test/TestSketcherSetRadius.py @@ -21,6 +21,7 @@ import unittest from salome.shaper import model from TestSketcher import SketcherTestCase + class SketcherSetRadius(SketcherTestCase): def test_set_radius(self): circle = self.sketch.addCircle(0, 10, 20) @@ -36,6 +37,7 @@ class SketcherSetRadius(SketcherTestCase): model.do() self.assertEqual(circle.radius().value(), 25.0) + if __name__ == "__main__": test_program = unittest.main(verbosity=2, exit=False) - assert test_program.result.wasSuccessful(), "Test failed" \ No newline at end of file + assert test_program.result.wasSuccessful(), "Test failed" diff --git a/src/PythonAPI/Test/TestSketcherSetTangent.py b/src/PythonAPI/Test/TestSketcherSetTangent.py index 559113714..4bd8396a3 100644 --- a/src/PythonAPI/Test/TestSketcherSetTangent.py +++ b/src/PythonAPI/Test/TestSketcherSetTangent.py @@ -21,14 +21,13 @@ import unittest from salome.shaper import model from TestSketcher import SketcherTestCase + class SketcherSetTangent(SketcherTestCase): def setUp(self): SketcherTestCase.setUp(self) self.line = self.sketch.addLine(0, 0, 0, 1) self.arc = self.sketch.addArc(0, 1, 0, 0, 1, 1, False) - self.sketch.setCoincident( - self.line.startPoint(), self.arc.startPoint() - ) + self.sketch.setCoincident(self.line.startPoint(), self.arc.startPoint()) def test_set_tangent(self): self.sketch.setTangent(self.line, self.arc) @@ -39,6 +38,7 @@ class SketcherSetTangent(SketcherTestCase): with self.assertRaises(TypeError): self.sketch.setTangent(None, self.arc) + if __name__ == "__main__": test_program = unittest.main(verbosity=2, exit=False) - assert test_program.result.wasSuccessful(), "Test failed" \ No newline at end of file + assert test_program.result.wasSuccessful(), "Test failed" diff --git a/src/PythonAPI/Test/TestSketcherSetVertical.py b/src/PythonAPI/Test/TestSketcherSetVertical.py index e93d48d44..00222ee34 100644 --- a/src/PythonAPI/Test/TestSketcherSetVertical.py +++ b/src/PythonAPI/Test/TestSketcherSetVertical.py @@ -21,6 +21,7 @@ import unittest from salome.shaper import model from TestSketcher import SketcherTestCase + class SketcherSetVertical(SketcherTestCase): def runTest(self): line = self.sketch.addLine(0, 0, 1, 1) @@ -28,6 +29,7 @@ class SketcherSetVertical(SketcherTestCase): model.do() self.assertEqual(line.startPoint().x(), line.endPoint().x()) + if __name__ == "__main__": test_program = unittest.main(exit=False) - assert test_program.result.wasSuccessful(), "Test failed" \ No newline at end of file + assert test_program.result.wasSuccessful(), "Test failed" diff --git a/src/PythonAPI/doc/source/conf.py b/src/PythonAPI/doc/source/conf.py index 3696e5546..cf811e2df 100644 --- a/src/PythonAPI/doc/source/conf.py +++ b/src/PythonAPI/doc/source/conf.py @@ -18,74 +18,74 @@ import sphinx # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath('..')) -sys.path.insert(0, os.path.abspath('../..')) -sys.path.insert(0, os.path.abspath('../../..')) +sys.path.insert(0, os.path.abspath("..")) +sys.path.insert(0, os.path.abspath("../..")) +sys.path.insert(0, os.path.abspath("../../..")) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.autodoc', - 'sphinx.ext.doctest', - 'sphinx.ext.todo', - 'sphinx.ext.coverage', - 'sphinx.ext.viewcode', - 'sphinx.ext.autosummary', + "sphinx.ext.autodoc", + "sphinx.ext.doctest", + "sphinx.ext.todo", + "sphinx.ext.coverage", + "sphinx.ext.viewcode", + "sphinx.ext.autosummary", ] # Optional extensions -extra_extensions = ['sphinx_rtd_theme'] -if sphinx.version_info[:2] < (1,3): - extra_extensions += ['sphinxcontrib.napoleon'] +extra_extensions = ["sphinx_rtd_theme"] +if sphinx.version_info[:2] < (1, 3): + extra_extensions += ["sphinxcontrib.napoleon"] else: - extra_extensions += ['sphinx.ext.napoleon'] + extra_extensions += ["sphinx.ext.napoleon"] for ext in extra_extensions: try: importlib.import_module(ext) extensions.append(ext) - globals().update({'use_{}'.format(ext):True}) + globals().update({"use_{}".format(ext): True}) except: - globals().update({'use_{}'.format(ext):False}) + globals().update({"use_{}".format(ext): False}) # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix of source filenames. -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = 'Shaper python API' -copyright = '2014-2023 CEA, EDF' +project = "Shaper python API" +copyright = "2014-2023 CEA, EDF" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '0.4' +version = "0.4" # The full version, including alpha/beta/rc tags. -release = '0.4' +release = "0.4" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -93,27 +93,27 @@ exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all # documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. -#keep_warnings = False +# keep_warnings = False # -- Options for HTML output ---------------------------------------------- @@ -121,134 +121,137 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. if use_sphinx_rtd_theme: - html_theme = 'sphinx_rtd_theme' + html_theme = "sphinx_rtd_theme" else: - html_theme = 'default' if sphinx.version_info[:2] < (1,3) else 'classic' + html_theme = "default" if sphinx.version_info[:2] < (1, 3) else "classic" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. themes_options = {} -themes_options['classic'] = { - 'body_max_width':'none', - 'body_min_width':0, +themes_options["classic"] = { + "body_max_width": "none", + "body_min_width": 0, } html_theme_options = themes_options.get(html_theme, {}) # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. -#html_extra_path = [] +# html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = 'ShaperpythonAPIdoc' +htmlhelp_basename = "ShaperpythonAPIdoc" # -- Options for LaTeX output --------------------------------------------- latex_elements = { -# The paper size ('letterpaper' or 'a4paper'). -#'papersize': 'letterpaper', - -# The font size ('10pt', '11pt' or '12pt'). -#'pointsize': '10pt', - -# Additional stuff for the LaTeX preamble. -#'preamble': '', + # The paper size ('letterpaper' or 'a4paper'). + #'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + #'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index', 'ShaperpythonAPI.tex', 'Shaper python API Documentation', - 'Renaud Nédélec', 'manual'), + ( + "index", + "ShaperpythonAPI.tex", + "Shaper python API Documentation", + "Renaud Nédélec", + "manual", + ), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True # -- Options for manual page output --------------------------------------- @@ -256,12 +259,17 @@ latex_documents = [ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'shaperpythonapi', 'Shaper python API Documentation', - ['Renaud Nédélec'], 1) + ( + "index", + "shaperpythonapi", + "Shaper python API Documentation", + ["Renaud Nédélec"], + 1, + ) ] # If true, show URL addresses after external links. -#man_show_urls = False +# man_show_urls = False # -- Options for Texinfo output ------------------------------------------- @@ -270,22 +278,27 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'ShaperpythonAPI', 'Shaper python API Documentation', - 'Renaud Nédélec', 'ShaperpythonAPI', 'One line description of project.', - 'Miscellaneous'), + ( + "index", + "ShaperpythonAPI", + "Shaper python API Documentation", + "Renaud Nédélec", + "ShaperpythonAPI", + "One line description of project.", + "Miscellaneous", + ), ] # Documents to append as an appendix to all manuals. -#texinfo_appendices = [] +# texinfo_appendices = [] # If false, no module index is generated. -#texinfo_domain_indices = True +# texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' +# texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. -#texinfo_no_detailmenu = False - -autodoc_member_order = 'bysource' +# texinfo_no_detailmenu = False +autodoc_member_order = "bysource" diff --git a/src/PythonAPI/examples/MakeBrick1.py b/src/PythonAPI/examples/MakeBrick1.py index 682a5d513..dc4e89cbb 100644 --- a/src/PythonAPI/examples/MakeBrick1.py +++ b/src/PythonAPI/examples/MakeBrick1.py @@ -100,4 +100,4 @@ model.do() mybox.setSize(80) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/PythonAPI/examples/MakeBrick2.py b/src/PythonAPI/examples/MakeBrick2.py index 4fdf9356a..b7484dcf2 100644 --- a/src/PythonAPI/examples/MakeBrick2.py +++ b/src/PythonAPI/examples/MakeBrick2.py @@ -93,4 +93,4 @@ model.do() mybox.setSize(40) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/PythonAPI/examples/Platine.py b/src/PythonAPI/examples/Platine.py index a3e32d5e2..0fc0b974d 100644 --- a/src/PythonAPI/examples/Platine.py +++ b/src/PythonAPI/examples/Platine.py @@ -28,6 +28,7 @@ from salome.shaper import model # Should be removed import os import ModelAPI + # END DEBUG PURPOSES # Initialisation @@ -46,6 +47,7 @@ model.addParameter(part, "L", str(L)) model.addParameter(part, "E", str(E)) model.addParameter(part, "P", str(P)) + def vertical_body(): # Create YOZ sketch sketch = model.addSketch(part, model.defaultPlane("YOZ")) @@ -75,12 +77,22 @@ def vertical_body(): return body + def bottom_body(): # Create XOY sketch 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)] + points = [ + (0, 0), + (0, L), + (P, L), + (P, 16 + 16), + (P - 20, 16 + 16), + (P - 20, 16), + (P, 16), + (P, 0), + ] points = [(p[0], -p[1]) for p in points] # as we look to back of the face geom_points = [geom.Pnt2d(*p) for p in points] left, top, v2, h2, v1, h1, right, bottom = model.addPolygon(sketch, *geom_points) @@ -110,12 +122,14 @@ def bottom_body(): sketch.setCoincident(arc.endPoint(), h1.startPoint()) # Binding - left_e = sketch.addLine("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]") + 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()) # Dimensions - #sketch.setLength(v1, 16) + # sketch.setLength(v1, 16) sketch.setLength(v2, 32) sketch.setLength(h2, 20) sketch.setLength(right, 16) @@ -129,6 +143,7 @@ def bottom_body(): return body + def body_3(): # Create XOZ sketch sketch = model.addSketch(part, "Boolean_1_1/Modified_Face&Sketch_1/SketchLine_3") @@ -139,7 +154,14 @@ def body_3(): points = [(0, 0), (0, H), (l, H), (l + 2 * r, H), (L, H), (L, 0)] points = [(p[0], -p[1]) for p in points] # as we look to back of the face geom_points = [geom.Pnt2d(*p) for p in points] - left, top_left, top_middle, top_right, right, bottom, = model.addPolygon(sketch, *geom_points) + ( + left, + top_left, + top_middle, + top_right, + right, + bottom, + ) = model.addPolygon(sketch, *geom_points) points = [(l + r, H), (l + 2 * r, H), (l, H)] points = [(p[0], -p[1]) for p in points] # as we look to back of the face @@ -169,7 +191,9 @@ def body_3(): sketch.setRadius(arc, r) # Binding - bottom_e = sketch.addLine("[Boolean_1_1/Modified_Face&Sketch_2/SketchLine_6][Extrusion_2_1/To_Face]") + 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()) @@ -180,6 +204,7 @@ def body_3(): return body + def body_4(): # Create XOZ 2nd sketch sketch = model.addSketch(part, "Boolean_2_1/Modified_Face&Sketch_2/SketchLine_6") @@ -191,11 +216,15 @@ def body_4(): left, diagonal, bottom = model.addPolygon(sketch, *geom_points) # Binding - bottom_e = sketch.addLine("[Boolean_2_1/Modified_Face&Extrusion_2_1/To_Face][Boolean_2_1/Modified_Face&Sketch_2/SketchLine_6]") + 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&Extrusion_3_1/From_Face][Extrusion_3_1/Generated_Face&Sketch_3/SketchLine_18]") + 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() #!!! @@ -221,16 +250,16 @@ model.do() # START DEBUG PURPOSES # prepare a study without last operation to trap floating problem with degenerated line -#aPathToStore = os.path.join(os.getcwd(), "Data") -#print aPathToStore -#if not os.path.exists(aPathToStore): +# aPathToStore = os.path.join(os.getcwd(), "Data") +# print aPathToStore +# if not os.path.exists(aPathToStore): # os.mkdir(aPathToStore) -#results = ModelAPI.StringList() -#ModelAPI.ModelAPI_Session.get().save(aPathToStore, results) +# results = ModelAPI.StringList() +# ModelAPI.ModelAPI_Session.get().save(aPathToStore, results) # END DEBUG PURPOSES b4 = body_4() boolean = model.addFuse(part, boolean.results() + b4.results()) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/PythonAPI/geom/CanonicalRecognition.py b/src/PythonAPI/geom/CanonicalRecognition.py index 44b025582..74fbb5a88 100644 --- a/src/PythonAPI/geom/CanonicalRecognition.py +++ b/src/PythonAPI/geom/CanonicalRecognition.py @@ -17,64 +17,88 @@ from GeomAlgoAPI import GeomAlgoAPI_CanonicalRecognition + class CanonicalRecognition: "The class provides recognition of canonical shapes" - def isPlane(self, shape, tolerance, normal = [], origin = []): + def isPlane(self, shape, tolerance, normal=[], origin=[]): """ Check if shape is planar Usage: > CR.isPlane(shape, tolerance, normal, origin) """ - return GeomAlgoAPI_CanonicalRecognition.isPlane(shape, tolerance, normal, origin) + return GeomAlgoAPI_CanonicalRecognition.isPlane( + shape, tolerance, normal, origin + ) - def isSphere(self, shape, tolerance, origin = [], radius = 0.0): + def isSphere(self, shape, tolerance, origin=[], radius=0.0): """ Check if shape is spherical Usage: > CR.isSphere(shape, tolerance, origin, radius) """ - return GeomAlgoAPI_CanonicalRecognition.isSphere(shape, tolerance, origin, radius) + return GeomAlgoAPI_CanonicalRecognition.isSphere( + shape, tolerance, origin, radius + ) - def isCone(self, shape, tolerance, axis = [], apex = [], halfAngle = 0.0): + def isCone(self, shape, tolerance, axis=[], apex=[], halfAngle=0.0): """ Check if shape is conical Usage: > CR.isCone(shape, tolerance, axis, apex, halfAngle) """ - return GeomAlgoAPI_CanonicalRecognition.isCone(shape, tolerance, axis, apex, halfAngle) + return GeomAlgoAPI_CanonicalRecognition.isCone( + shape, tolerance, axis, apex, halfAngle + ) - def isCylinder(self, shape, tolerance, axis = [], origin = [], radius = 0.0): + def isCylinder(self, shape, tolerance, axis=[], origin=[], radius=0.0): """ Check if shape is cylinder Usage: > CR.isCylinder(shape, tolerance, axis, origin, radius) """ - return GeomAlgoAPI_CanonicalRecognition.isCylinder(shape, tolerance, axis, origin, radius) + return GeomAlgoAPI_CanonicalRecognition.isCylinder( + shape, tolerance, axis, origin, radius + ) - def isLine(self, edge, tolerance, direction = [], origin = []): + def isLine(self, edge, tolerance, direction=[], origin=[]): """ Check if edge/wire is line Usage: > CR.isLine(edge, tolerance, direction, origin) """ - return GeomAlgoAPI_CanonicalRecognition.isLine(edge, tolerance, direction, origin) + return GeomAlgoAPI_CanonicalRecognition.isLine( + edge, tolerance, direction, origin + ) - def isCircle(self, edge, tolerance, normal = [], origin = [], radius = 0.0): + def isCircle(self, edge, tolerance, normal=[], origin=[], radius=0.0): """ Check if edge/wire is circle Usage: > CR.isCircle(edge, tolerance, normal, origin, radius) """ - return GeomAlgoAPI_CanonicalRecognition.isCircle(edge, tolerance, normal, origin, radius) + return GeomAlgoAPI_CanonicalRecognition.isCircle( + edge, tolerance, normal, origin, radius + ) - def isEllipse(self, edge, tolerance, normal = [], dirX = [], origin = [], majorRadius = 0.0, minorRadius = 0.0): + def isEllipse( + self, + edge, + tolerance, + normal=[], + dirX=[], + origin=[], + majorRadius=0.0, + minorRadius=0.0, + ): """ Check if edge/wire is ellipse Usage: > CR.isEllipse(edge, tolerance, normal, dirX, origin, majorRadius, minorRadius) """ - return GeomAlgoAPI_CanonicalRecognition.isEllipse(edge, tolerance, normal, dirX, origin, majorRadius, minorRadius) + return GeomAlgoAPI_CanonicalRecognition.isEllipse( + edge, tolerance, normal, dirX, origin, majorRadius, minorRadius + ) def isImplemented(self): """ diff --git a/src/PythonAPI/geom/ShapeInfo.py b/src/PythonAPI/geom/ShapeInfo.py index b855bf5f9..d5f9f07c8 100644 --- a/src/PythonAPI/geom/ShapeInfo.py +++ b/src/PythonAPI/geom/ShapeInfo.py @@ -1,19 +1,20 @@ import GeomAlgoAPI + # A python implementation of shapeInfo functionality. # By the given shape it will provide information, similar to data, displayed in the second part # of Inspection Panel on selection of face, edge or vertex. # The method returns a tuple with same data and in the same order as it is presented in the # Information Panel: type of shape, then values (may be not-numerical, like Boolean 'Closed' for Polygon). def shapeInfo(theShape): - anInfo = GeomAlgoAPI.GeomAlgoAPI_ShapeInfo(theShape) - aVals = anInfo.values() - aResList = [anInfo.shapeType()] - for aVal in aVals: - if aVal.type() == 0: - aResList.append(aVal.string()) - elif aVal.type() == 1: - aResList.append(aVal.real()) - elif aVal.type() == 2: - aResList.append(aVal.boolean()) - return tuple(aResList) + anInfo = GeomAlgoAPI.GeomAlgoAPI_ShapeInfo(theShape) + aVals = anInfo.values() + aResList = [anInfo.shapeType()] + for aVal in aVals: + if aVal.type() == 0: + aResList.append(aVal.string()) + elif aVal.type() == 1: + aResList.append(aVal.real()) + elif aVal.type() == 2: + aResList.append(aVal.boolean()) + return tuple(aResList) diff --git a/src/PythonAPI/geom/__init__.py b/src/PythonAPI/geom/__init__.py index ef1388dea..f3c551c33 100644 --- a/src/PythonAPI/geom/__init__.py +++ b/src/PythonAPI/geom/__init__.py @@ -21,22 +21,22 @@ # Swigged interfaces to Modeling Data -from GeomAPI import GeomAPI_Circ as Circ +from GeomAPI import GeomAPI_Circ as Circ from GeomAPI import GeomAPI_Circ2d as Circ2d -from GeomAPI import GeomAPI_Dir as Dir -from GeomAPI import GeomAPI_Lin as Lin -from GeomAPI import GeomAPI_Lin2d as Lin2d -from GeomAPI import GeomAPI_Pnt as Pnt -from GeomAPI import GeomAPI_Pnt2d as Pnt2d -from GeomAPI import GeomAPI_XY as XY -from GeomAPI import GeomAPI_XYZ as XYZ +from GeomAPI import GeomAPI_Dir as Dir +from GeomAPI import GeomAPI_Lin as Lin +from GeomAPI import GeomAPI_Lin2d as Lin2d +from GeomAPI import GeomAPI_Pnt as Pnt +from GeomAPI import GeomAPI_Pnt2d as Pnt2d +from GeomAPI import GeomAPI_XY as XY +from GeomAPI import GeomAPI_XYZ as XYZ -from GeomAPI import GeomAPI_Shape as Shape +from GeomAPI import GeomAPI_Shape as Shape # Swigged interfaces to Modeling Algorithms -from GeomAlgoAPI import GeomAlgoAPI_Boolean as Boolean +from GeomAlgoAPI import GeomAlgoAPI_Boolean as Boolean from .ShapeInfo import * from .CanonicalRecognition import * diff --git a/src/PythonAPI/initConfig.py b/src/PythonAPI/initConfig.py index 2b97ca726..caf0d7a76 100644 --- a/src/PythonAPI/initConfig.py +++ b/src/PythonAPI/initConfig.py @@ -29,4 +29,4 @@ import ConfigAPI salome.salome_init() aCorbaModules = salome.modulcat.GetComponentList() for aName in aCorbaModules: - ConfigAPI.Config_ModuleReader.addDependencyModule(aName) + ConfigAPI.Config_ModuleReader.addDependencyModule(aName) diff --git a/src/PythonAPI/model/__init__.py b/src/PythonAPI/model/__init__.py index 50b1e6a67..61449ddc9 100644 --- a/src/PythonAPI/model/__init__.py +++ b/src/PythonAPI/model/__init__.py @@ -26,8 +26,8 @@ All features are available via model.add*() functions. Exceptions are: # General purpose functions and abstract root classes -from .services import * -from .roots import * +from .services import * +from .roots import * # Built-in features @@ -48,8 +48,10 @@ from .tests import * # Add-on features from .addons import * + # move functions from .addons to top level (model) package import inspect + for attribute_name in dir(addons): attribute = getattr(addons, attribute_name) if inspect.isfunction(attribute): diff --git a/src/PythonAPI/model/addons/__init__.py b/src/PythonAPI/model/addons/__init__.py index 58b4f7f38..1b5ba87fc 100644 --- a/src/PythonAPI/model/addons/__init__.py +++ b/src/PythonAPI/model/addons/__init__.py @@ -30,4 +30,4 @@ for loader, module_name, is_pkg in pkgutil.walk_packages(__path__): if inspect.isfunction(attribute): globals()[attribute_name] = attribute -del pkgutil, inspect \ No newline at end of file +del pkgutil, inspect diff --git a/src/PythonAPI/model/build/__init__.py b/src/PythonAPI/model/build/__init__.py index 0d865e719..e73692f70 100644 --- a/src/PythonAPI/model/build/__init__.py +++ b/src/PythonAPI/model/build/__init__.py @@ -19,6 +19,17 @@ """Package for Build plugin for the Parametric Geometry API of the Modeler. """ -from BuildAPI import addVertex, addEdge, addInterpolation, addWire, addPolyline3D, addFace, addShell, addSolid, addCompSolid, addCompound +from BuildAPI import ( + addVertex, + addEdge, + addInterpolation, + addWire, + addPolyline3D, + addFace, + addShell, + addSolid, + addCompSolid, + addCompound, +) from BuildAPI import addSubShapes from BuildAPI import addFilling diff --git a/src/PythonAPI/model/collection/__init__.py b/src/PythonAPI/model/collection/__init__.py index cb1b5472a..fdcc8de47 100644 --- a/src/PythonAPI/model/collection/__init__.py +++ b/src/PythonAPI/model/collection/__init__.py @@ -20,4 +20,9 @@ """ from CollectionAPI import addGroup, addField -from CollectionAPI import addGroupAddition, addGroupIntersection, addGroupSubstraction, addGroupShape +from CollectionAPI import ( + addGroupAddition, + addGroupIntersection, + addGroupSubstraction, + addGroupShape, +) diff --git a/src/PythonAPI/model/connection/__init__.py b/src/PythonAPI/model/connection/__init__.py index 236b2e561..3cf5b51c0 100644 --- a/src/PythonAPI/model/connection/__init__.py +++ b/src/PythonAPI/model/connection/__init__.py @@ -19,4 +19,4 @@ """Package for Connection plugin for the Parametric Geometry API of the Modeler. """ -from ConnectorAPI import exportToGEOM \ No newline at end of file +from ConnectorAPI import exportToGEOM diff --git a/src/PythonAPI/model/dump/DumpAssistant.py b/src/PythonAPI/model/dump/DumpAssistant.py index fc7a20f22..00a3d12af 100644 --- a/src/PythonAPI/model/dump/DumpAssistant.py +++ b/src/PythonAPI/model/dump/DumpAssistant.py @@ -28,6 +28,7 @@ import SketchAPI import sys import inspect + def singleton(cls): instance = cls() instance.__call__ = lambda: instance @@ -38,7 +39,6 @@ def singleton(cls): # Collect information about features that may be dumped and stores the model as a Python script @singleton class DumpAssistant(ModelHighAPI.ModelHighAPI_Dumper): - ## Constructor def __init__(self): ModelHighAPI.ModelHighAPI_Dumper.__init__(self) @@ -54,8 +54,14 @@ class DumpAssistant(ModelHighAPI.ModelHighAPI_Dumper): # Use copy of sys.modules to avoid exception "dictionary changed size during iteration" sys_modules = sys.modules.copy() for aModule in sys_modules: - for aName, anObj in inspect.getmembers(sys_modules[aModule], inspect.isclass): - if issubclass(anObj, ModelHighAPI.ModelHighAPI_Interface) and hasattr(anObj, "ID") and anObj.dump != ModelHighAPI.ModelHighAPI_Interface.dump: + for aName, anObj in inspect.getmembers( + sys_modules[aModule], inspect.isclass + ): + if ( + issubclass(anObj, ModelHighAPI.ModelHighAPI_Interface) + and hasattr(anObj, "ID") + and anObj.dump != ModelHighAPI.ModelHighAPI_Interface.dump + ): self.myFeatures[anObj.ID()] = anObj self.myWrapperNames[anObj.ID()] = aName @@ -67,7 +73,12 @@ class DumpAssistant(ModelHighAPI.ModelHighAPI_Dumper): # Dump only feature created by user (in history). # Also dump Export and RemoveResults features (hard-coded here in order not to change the data model). # For all other features, just keep their name. - if theForce or theFeature.isInHistory() or aFeatureKind=="Export" or aFeatureKind=="RemoveResults": + if ( + theForce + or theFeature.isInHistory() + or aFeatureKind == "Export" + or aFeatureKind == "RemoveResults" + ): aDumper = self.myFeatures[aFeatureKind](theFeature) # Dump comment for the operation before the dumping of the feature to improve the readability of a script. if self.dumpCommentBeforeFeature(theFeature): @@ -99,7 +110,9 @@ class DumpAssistant(ModelHighAPI.ModelHighAPI_Dumper): def attributeGetter(self, theFeature, theAttrName): aFeatureKind = theFeature.getKind() if aFeatureKind in self.myFeatures: - return self.myFeatures[aFeatureKind](theFeature).attributeGetter(theAttrName) + return self.myFeatures[aFeatureKind](theFeature).attributeGetter( + theAttrName + ) return std_string() ## Return name of wrapper feature @@ -112,15 +125,17 @@ class DumpAssistant(ModelHighAPI.ModelHighAPI_Dumper): ## Exports the dumped variables names to the SHAPERSTUDY def exportVariable(self, theEntry, theVarName): try: - if self.myEngine == None: - import SHAPERSTUDY_utils - aComponent = SHAPERSTUDY_utils.findOrCreateComponent() - self.myEngine = SHAPERSTUDY_utils.getEngine() - if self.myEngine != 1: - self.myEngine.StoreVariableName(theEntry, theVarName) + if self.myEngine == None: + import SHAPERSTUDY_utils + + aComponent = SHAPERSTUDY_utils.findOrCreateComponent() + self.myEngine = SHAPERSTUDY_utils.getEngine() + if self.myEngine != 1: + self.myEngine.StoreVariableName(theEntry, theVarName) except: - self.myEngine = 1 # invalid access + self.myEngine = 1 # invalid access pass + # Instance of dumper dumper = DumpAssistant diff --git a/src/PythonAPI/model/exchange/tools.py b/src/PythonAPI/model/exchange/tools.py index 31455ff31..b982316b0 100644 --- a/src/PythonAPI/model/exchange/tools.py +++ b/src/PythonAPI/model/exchange/tools.py @@ -19,7 +19,10 @@ import os + def removeFile(theFilename): - try: os.remove(theFilename) - except OSError: pass + try: + os.remove(theFilename) + except OSError: + pass assert not os.path.exists(theFilename), "Cannot remove file {}".format(theFilename) diff --git a/src/PythonAPI/model/gdml/__init__.py b/src/PythonAPI/model/gdml/__init__.py index 578ab8045..ca65ccf45 100644 --- a/src/PythonAPI/model/gdml/__init__.py +++ b/src/PythonAPI/model/gdml/__init__.py @@ -20,4 +20,3 @@ """ from GDMLAPI import addConeSegment, addEllipsoid - diff --git a/src/PythonAPI/model/parameter/import_parameter.py b/src/PythonAPI/model/parameter/import_parameter.py index 5a1fd3742..ad1a92604 100644 --- a/src/PythonAPI/model/parameter/import_parameter.py +++ b/src/PythonAPI/model/parameter/import_parameter.py @@ -20,16 +20,17 @@ from salome.shaper import model import codecs, sys + def changeTab(theLine): - aResult = theLine.split("#")[0].replace("\t"," ") - aResult += theLine[len(aResult):] + aResult = theLine.split("#")[0].replace("\t", " ") + aResult += theLine[len(aResult) :] return aResult -def importParameters(theDocument, theFileName): +def importParameters(theDocument, theFileName): aResult = [] try: - aFile = codecs.open(theFileName, 'r', encoding = 'utf_8_sig') + aFile = codecs.open(theFileName, "r", encoding="utf_8_sig") except IOError as e: print("Failed to read file: %s" % str(e)) return aResult @@ -55,11 +56,15 @@ def importParameters(theDocument, theFileName): aComment = aLine - if(len(aName) > 0): + if len(aName) > 0: try: - aResult.append(model.addParameter(theDocument, aName, aParameter.strip(), aComment.strip())) + aResult.append( + model.addParameter( + theDocument, aName, aParameter.strip(), aComment.strip() + ) + ) except SyntaxError as anError: - print(anError, file = sys.stderr) + print(anError, file=sys.stderr) aFile.close() return aResult diff --git a/src/PythonAPI/model/partset/__init__.py b/src/PythonAPI/model/partset/__init__.py index 12267f8db..6032c64f7 100644 --- a/src/PythonAPI/model/partset/__init__.py +++ b/src/PythonAPI/model/partset/__init__.py @@ -19,4 +19,4 @@ """Package for PartSet plugin for the Parametric Geometry API of the Modeler. """ -from PartSetAPI import addPart, duplicatePart, removePart \ No newline at end of file +from PartSetAPI import addPart, duplicatePart, removePart diff --git a/src/PythonAPI/model/roots.py b/src/PythonAPI/model/roots.py index 09c87a7e8..876377079 100644 --- a/src/PythonAPI/model/roots.py +++ b/src/PythonAPI/model/roots.py @@ -23,6 +23,7 @@ Author: Daniel Brunier-Coulin import ModelAPI + class Feature(ModelAPI.ModelAPI_Feature): """Base class of user-defined Python features.""" @@ -32,8 +33,7 @@ class Feature(ModelAPI.ModelAPI_Feature): def addRealInput(self, inputid): """F.addRealInput(str) -- add real attribute""" - self.data().addAttribute(inputid, - ModelAPI.ModelAPI_AttributeDouble.typeId()) + self.data().addAttribute(inputid, ModelAPI.ModelAPI_AttributeDouble.typeId()) def getRealInput(self, inputid): """F.getRealInput(str) -- get real value of the attribute""" @@ -49,4 +49,3 @@ class Feature(ModelAPI.ModelAPI_Feature): body = self.document().createBody(self.data()) body.store(shape) self.setResult(body) - diff --git a/src/PythonAPI/model/services/__init__.py b/src/PythonAPI/model/services/__init__.py index 67b4fb9c6..630ca5c5f 100644 --- a/src/PythonAPI/model/services/__init__.py +++ b/src/PythonAPI/model/services/__init__.py @@ -30,52 +30,68 @@ from ModelHighAPI import addFolder, removeFolder from ModelHighAPI import ModelHighAPI_Selection as selection from ModelAPI import findPartFeature + # a method used for the python dump of the SHAPER STUDY def publishToShaperStudy(): - begin() - activeDocument().addFeature("PublishToStudy") - end() + begin() + activeDocument().addFeature("PublishToStudy") + end() + # returns unique identifier of the feature : id of part it belongs to + ":" + id of feature # the second argument may be the number of result if feature has more than one result (1 corresponds to the second result, etc) def featureStringId(theFeature, *theArgs): - aRoot = moduleDocument() - aCurrent = theFeature.feature().document() - if aRoot and aCurrent: - aRes = str(findPartFeature(aRoot, aCurrent).data().featureId()) + ":" + str(theFeature.feature().data().featureId()) - if len(theArgs) == 1: - aRes += ":" + str(theArgs[0]) - return aRes - return "" + aRoot = moduleDocument() + aCurrent = theFeature.feature().document() + if aRoot and aCurrent: + aRes = ( + str(findPartFeature(aRoot, aCurrent).data().featureId()) + + ":" + + str(theFeature.feature().data().featureId()) + ) + if len(theArgs) == 1: + aRes += ":" + str(theArgs[0]) + return aRes + return "" import os + def getTmpFileName(thePrefix, theSuffix): - import tempfile - tempdir = tempfile.gettempdir() - tmp_file = tempfile.NamedTemporaryFile(suffix=theSuffix, prefix=thePrefix, dir=tempdir, delete=False) - tmp_filename = tmp_file.name - if os.name == "nt": - tmp_filename.replace("\\", "/") - tmp_file.close() - return tmp_filename + import tempfile + + tempdir = tempfile.gettempdir() + tmp_file = tempfile.NamedTemporaryFile( + suffix=theSuffix, prefix=thePrefix, dir=tempdir, delete=False + ) + tmp_filename = tmp_file.name + if os.name == "nt": + tmp_filename.replace("\\", "/") + tmp_file.close() + return tmp_filename + def removeTmpFile(theFilename): - try: os.remove(theFilename) - except OSError: pass + try: + os.remove(theFilename) + except OSError: + pass + # Verify the Python dump with generating the auxiliary filenames from ModelHighAPI import CHECK_NAMING_AND_GEOMETRICAL from ModelHighAPI import checkPyDump -def checkPythonDump(theDumpMode = CHECK_NAMING_AND_GEOMETRICAL): - aPrefix = getTmpFileName("check_dump_", '') - aNaming = aPrefix + ".py" - aGeo = aPrefix + "_geo.py" - aWeak = aPrefix + "_weak.py" - isOk = checkPyDump(aNaming, aGeo, aWeak, theDumpMode) - removeTmpFile(aPrefix) - removeTmpFile(aNaming) - removeTmpFile(aGeo) - removeTmpFile(aWeak) - return isOk + + +def checkPythonDump(theDumpMode=CHECK_NAMING_AND_GEOMETRICAL): + aPrefix = getTmpFileName("check_dump_", "") + aNaming = aPrefix + ".py" + aGeo = aPrefix + "_geo.py" + aWeak = aPrefix + "_weak.py" + isOk = checkPyDump(aNaming, aGeo, aWeak, theDumpMode) + removeTmpFile(aPrefix) + removeTmpFile(aNaming) + removeTmpFile(aGeo) + removeTmpFile(aWeak) + return isOk diff --git a/src/PythonAPI/model/sketcher/tests.py b/src/PythonAPI/model/sketcher/tests.py index 4bd4ca9a9..b8a8397bb 100644 --- a/src/PythonAPI/model/sketcher/tests.py +++ b/src/PythonAPI/model/sketcher/tests.py @@ -23,18 +23,21 @@ import ModelHighAPI import math from salome.shaper.model.sketcher import tools -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -def assertPoint(thePoint, theCoords, theTolerance = TOLERANCE): - """ Verifies coordinates of the point - """ + +def assertPoint(thePoint, theCoords, theTolerance=TOLERANCE): + """Verifies coordinates of the point""" aPoint = tools.toList(thePoint) - assert((aPoint[0]-theCoords[0])**2 + (aPoint[1]-theCoords[1])**2 < theTolerance**2), "Wrong '{}' point {}, expected {}".format(thePoint.id(), aPoint, theCoords) + assert (aPoint[0] - theCoords[0]) ** 2 + ( + aPoint[1] - theCoords[1] + ) ** 2 < theTolerance**2, "Wrong '{}' point {}, expected {}".format( + thePoint.id(), aPoint, theCoords + ) -def assertLine(theLine, theStart, theEnd, theTolerance = TOLERANCE): - """ Verifies coordinates of line extremities - """ +def assertLine(theLine, theStart, theEnd, theTolerance=TOLERANCE): + """Verifies coordinates of line extremities""" aLine = tools.toSketchFeature(theLine) aStartPnt = geomDataAPI_Point2D(aLine.attribute("StartPoint")) @@ -45,9 +48,8 @@ def assertLine(theLine, theStart, theEnd, theTolerance = TOLERANCE): assertPoint(aEndPnt, theEnd, theTolerance) -def assertCircle(theCircle, theCenter, theRadius, theTolerance = TOLERANCE): - """ Verifies attributes of circle - """ +def assertCircle(theCircle, theCenter, theRadius, theTolerance=TOLERANCE): + """Verifies attributes of circle""" aCircle = tools.toSketchFeature(theCircle) aCenter = geomDataAPI_Point2D(aCircle.attribute("circle_center")) @@ -55,12 +57,14 @@ def assertCircle(theCircle, theCenter, theRadius, theTolerance = TOLERANCE): assertPoint(aCenter, theCenter, theTolerance) aRadius = aCircle.real("circle_radius") - assert aRadius.value() == theRadius, "Wrong circle radius {}, expected {}".format(aRadius.value(), theRadius) + assert aRadius.value() == theRadius, "Wrong circle radius {}, expected {}".format( + aRadius.value(), theRadius + ) -def assertArc(theArc, theCenter, theStart, theEnd, theTolerance = TOLERANCE): - """ Verifies coordinates of arc points and the consistency of the arc. - Some of points may be empty lists. +def assertArc(theArc, theCenter, theStart, theEnd, theTolerance=TOLERANCE): + """Verifies coordinates of arc points and the consistency of the arc. + Some of points may be empty lists. """ anArc = tools.toSketchFeature(theArc) @@ -78,8 +82,7 @@ def assertArc(theArc, theCenter, theStart, theEnd, theTolerance = TOLERANCE): def assertArcValidity(theArc): - """ Tests whether the arc is correctly defined - """ + """Tests whether the arc is correctly defined""" anArc = tools.toSketchFeature(theArc) aCenterPnt = geomDataAPI_Point2D(anArc.attribute("center_point")) @@ -88,40 +91,53 @@ def assertArcValidity(theArc): aRadius = anArc.real("radius") aDistCS = tools.distancePointPoint(aCenterPnt, aStartPnt) aDistCE = tools.distancePointPoint(aCenterPnt, aEndPnt) - assert math.fabs(aDistCS - aDistCE) < TOLERANCE, "Wrong arc: center-start distance {}, center-end distance {}".format(aDistCS, aDistCE) - assert math.fabs(aRadius.value() - aDistCS) < TOLERANCE, "Wrong arc: radius is {}, expected {}".format(aRadius.value(), aDistCS) + assert ( + math.fabs(aDistCS - aDistCE) < TOLERANCE + ), "Wrong arc: center-start distance {}, center-end distance {}".format( + aDistCS, aDistCE + ) + assert ( + math.fabs(aRadius.value() - aDistCS) < TOLERANCE + ), "Wrong arc: radius is {}, expected {}".format(aRadius.value(), aDistCS) -def checkSketch(theSketch, theDOF = -1): - """ Tests the sketch is valid and DoF is equal to the given - """ - assert(theSketch.feature().error() == ""), "Sketch failed: {}".format(theSketch.feature().error()) - assert(theSketch.solverError().value() == ""), "Sketch solver failed: {}".format(theSketch.solverError().value()) +def checkSketch(theSketch, theDOF=-1): + """Tests the sketch is valid and DoF is equal to the given""" + assert theSketch.feature().error() == "", "Sketch failed: {}".format( + theSketch.feature().error() + ) + assert theSketch.solverError().value() == "", "Sketch solver failed: {}".format( + theSketch.solverError().value() + ) if theDOF != -1: aDOF = tools.dof(theSketch) - assert(aDOF == theDOF), "Sketch DoF {} is wrong. Expected {}".format(aDOF, theDOF) + assert aDOF == theDOF, "Sketch DoF {} is wrong. Expected {}".format( + aDOF, theDOF + ) def checkSketchErrorDegenerated(theSketch): - """ Verify the sketch reports error about degenerated geometry - """ + """Verify the sketch reports error about degenerated geometry""" errorValue = theSketch.solverError().value() - assert(errorValue != "") - assert(errorValue.find("degenerated") >= 0) + assert errorValue != "" + assert errorValue.find("degenerated") >= 0 -def compareSketches(theReference, theSketch, TOLERANCE = 1.e-5): - """ Compare sketches for the sequence of features - """ +def compareSketches(theReference, theSketch, TOLERANCE=1.0e-5): + """Compare sketches for the sequence of features""" errors = "" # compare sketches degree of freedom if tools.dof(theReference) != tools.dof(theSketch): - errors += "\nError in DoF (actual = {}, expected = {})".format(tools.dof(theSketch), tools.dof(theReference)) + errors += "\nError in DoF (actual = {}, expected = {})".format( + tools.dof(theSketch), tools.dof(theReference) + ) # compare sketch solver error if theReference.solverError().value() != theSketch.solverError().value(): - errors += "\nError in solver message (actual = '{}', expected = '{}')".format(theSketch.solverError().value(), theReference.solverError().value()) + errors += "\nError in solver message (actual = '{}', expected = '{}')".format( + theSketch.solverError().value(), theReference.solverError().value() + ) aRefSketch = featureToCompositeFeature(theReference.feature()) anActualSketch = featureToCompositeFeature(theSketch.feature()) @@ -130,29 +146,51 @@ def compareSketches(theReference, theSketch, TOLERANCE = 1.e-5): aRefNbSubs = aRefSketch.numberOfSubs() anActualNbSubs = anActualSketch.numberOfSubs() if aRefNbSubs != anActualNbSubs: - errors += "\nError in number of sub-features (actual = {}, expected = {})".format(anActualNbSubs, aRefNbSubs) + errors += ( + "\nError in number of sub-features (actual = {}, expected = {})".format( + anActualNbSubs, aRefNbSubs + ) + ) for index in range(min(aRefNbSubs, anActualNbSubs)): aRefFeature = aRefSketch.subFeature(index) aFeature = anActualSketch.subFeature(index) # compare types of subs if aFeature.getKind() != aRefFeature.getKind(): - errors += "\nWrong sketch feature (actual = '{}', expected = '{}')".format(aFeature.name(), aRefFeature.name()) + errors += "\nWrong sketch feature (actual = '{}', expected = '{}')".format( + aFeature.name(), aRefFeature.name() + ) continue # compare attributes aRefAttrs = aRefFeature.data().attributes("") anAttrs = aFeature.data().attributes("") for ref, attr in zip(aRefAttrs, anAttrs): if ref.attributeType() != attr.attributeType(): - errors += "\nWrong sequence of attributes (feature = '{}', reference = '{}')".format(aFeature.name(), aRefFeature.name()) + errors += "\nWrong sequence of attributes (feature = '{}', reference = '{}')".format( + aFeature.name(), aRefFeature.name() + ) elif not attr.isInitialized() or not ref.isInitialized(): if attr.isInitialized() != ref.isInitialized(): - errors += "\nAttribute '{}' initialization is different (feature = '{}', reference = '{}'): actual = {}, expected = {}".format(attr.id(), aFeature.name(), aRefFeature.name(), attr.isInitialized(), ref.isInitialized()) + errors += "\nAttribute '{}' initialization is different (feature = '{}', reference = '{}'): actual = {}, expected = {}".format( + attr.id(), + aFeature.name(), + aRefFeature.name(), + attr.isInitialized(), + ref.isInitialized(), + ) elif ref.attributeType() == GeomDataAPI_Point2D.typeId(): aRefPoint = geomDataAPI_Point2D(ref) aPoint = geomDataAPI_Point2D(attr) if tools.distancePointPoint(aPoint, aRefPoint) > TOLERANCE: - errors += "\nWrong coordinates '{}' (feature = '{}', reference = '{}'): actual = ({}, {}), expected = ({}, {})".format(attr.id(), aFeature.name(), aRefFeature.name(), aPoint.x(), aPoint.y(), aRefPoint.x(), aRefPoint.y()) + errors += "\nWrong coordinates '{}' (feature = '{}', reference = '{}'): actual = ({}, {}), expected = ({}, {})".format( + attr.id(), + aFeature.name(), + aRefFeature.name(), + aPoint.x(), + aPoint.y(), + aRefPoint.x(), + aRefPoint.y(), + ) elif ref.attributeType() == GeomDataAPI_Point2DArray.typeId(): aRefPoints = geomDataAPI_Point2DArray(ref) aPoints = geomDataAPI_Point2DArray(attr) @@ -160,17 +198,30 @@ def compareSketches(theReference, theSketch, TOLERANCE = 1.e-5): aRefPoint = aRefPoints.pnt(pInd) aPoint = aPoints.pnt(pInd) if tools.distancePointPoint(aPoint, aRefPoint) > TOLERANCE: - errors += "\nWrong coordinates '{}', index {} (feature = '{}', reference = '{}'): actual = ({}, {}), expected = ({}, {})".format(attr.id(), pInd, aFeature.name(), aRefFeature.name(), aPoint.x(), aPoint.y(), aRefPoint.x(), aRefPoint.y()) + errors += "\nWrong coordinates '{}', index {} (feature = '{}', reference = '{}'): actual = ({}, {}), expected = ({}, {})".format( + attr.id(), + pInd, + aFeature.name(), + aRefFeature.name(), + aPoint.x(), + aPoint.y(), + aRefPoint.x(), + aRefPoint.y(), + ) elif ref.attributeType() == ModelAPI_AttributeBoolean.typeId(): aRefVal = modelAPI_AttributeBoolean(ref).value() aVal = modelAPI_AttributeBoolean(attr).value() if aVal != aRefVal: - errors += "\nWrong boolean value '{}' (feature = '{}', reference = '{}'): actual = {}, expected = {}".format(attr.id(), aFeature.name(), aRefFeature.name(), aVal, aRefVal) + errors += "\nWrong boolean value '{}' (feature = '{}', reference = '{}'): actual = {}, expected = {}".format( + attr.id(), aFeature.name(), aRefFeature.name(), aVal, aRefVal + ) elif ref.attributeType() == ModelAPI_AttributeDouble.typeId(): aRefVal = modelAPI_AttributeDouble(ref).value() aVal = modelAPI_AttributeDouble(attr).value() if math.fabs(aVal - aRefVal) > TOLERANCE: - errors += "\nWrong real value '{}' (feature = '{}', reference = '{}'): actual = {}, expected = {}".format(attr.id(), aFeature.name(), aRefFeature.name(), aVal, aRefVal) + errors += "\nWrong real value '{}' (feature = '{}', reference = '{}'): actual = {}, expected = {}".format( + attr.id(), aFeature.name(), aRefFeature.name(), aVal, aRefVal + ) elif ref.attributeType() == ModelAPI_AttributeDoubleArray.typeId(): aRefArray = modelAPI_AttributeDoubleArray(ref) anArray = modelAPI_AttributeDoubleArray(attr) @@ -178,12 +229,21 @@ def compareSketches(theReference, theSketch, TOLERANCE = 1.e-5): aRefVal = aRefArray.value(vInd) aVal = anArray.value(vInd) if math.fabs(aVal - aRefVal) > TOLERANCE: - errors += "\nWrong real value '{}' index {} (feature = '{}', reference = '{}'): actual = {}, expected = {}".format(attr.id(), vInd, aFeature.name(), aRefFeature.name(), aVal, aRefVal) + errors += "\nWrong real value '{}' index {} (feature = '{}', reference = '{}'): actual = {}, expected = {}".format( + attr.id(), + vInd, + aFeature.name(), + aRefFeature.name(), + aVal, + aRefVal, + ) elif ref.attributeType() == ModelAPI_AttributeInteger.typeId(): aRefVal = modelAPI_AttributeInteger(ref).value() aVal = modelAPI_AttributeInteger(attr).value() if aVal != aRefVal: - errors += "\nWrong integer value '{}' (feature = '{}', reference = '{}'): actual = {}, expected = {}".format(attr.id(), aFeature.name(), aRefFeature.name(), aVal, aRefVal) + errors += "\nWrong integer value '{}' (feature = '{}', reference = '{}'): actual = {}, expected = {}".format( + attr.id(), aFeature.name(), aRefFeature.name(), aVal, aRefVal + ) elif ref.attributeType() == ModelAPI_AttributeIntArray.typeId(): aRefArray = modelAPI_AttributeIntArray(ref) anArray = modelAPI_AttributeIntArray(attr) @@ -191,6 +251,13 @@ def compareSketches(theReference, theSketch, TOLERANCE = 1.e-5): aRefVal = aRefArray.value(vInd) aVal = anArray.value(vInd) if aVal != aRefVal: - errors += "\nWrong integer value '{}' index {} (feature = '{}', reference = '{}'): actual = {}, expected = {}".format(attr.id(), vInd, aFeature.name(), aRefFeature.name(), aVal, aRefVal) + errors += "\nWrong integer value '{}' index {} (feature = '{}', reference = '{}'): actual = {}, expected = {}".format( + attr.id(), + vInd, + aFeature.name(), + aRefFeature.name(), + aVal, + aRefVal, + ) return errors diff --git a/src/PythonAPI/model/sketcher/tools.py b/src/PythonAPI/model/sketcher/tools.py index c335dbaff..fdf3d249a 100644 --- a/src/PythonAPI/model/sketcher/tools.py +++ b/src/PythonAPI/model/sketcher/tools.py @@ -23,6 +23,7 @@ from GeomDataAPI import * from ModelAPI import * import math + def addPolyline(sketch, *coords): """Add a poly-line to sketch. @@ -53,28 +54,26 @@ def addPolygon(sketch, *coords): c0 = coords[0] cn = coords[len(coords) - 1] ln = sketch.addLine(cn, c0) - sketch.setCoincident( - pg[len(coords) - 2].endPoint(), ln.startPoint() - ) - sketch.setCoincident( - ln.endPoint(), pg[0].startPoint() - ) + sketch.setCoincident(pg[len(coords) - 2].endPoint(), ln.startPoint()) + sketch.setCoincident(ln.endPoint(), pg[0].startPoint()) pg.append(ln) return pg + def dof(sketch): - """ Extract degrees of freedom for the given sketch - """ + """Extract degrees of freedom for the given sketch""" aSketch = sketch if issubclass(type(aSketch), ModelHighAPI.ModelHighAPI_Interface): aSketch = sketch.feature() - return int(''.join(filter(str.isdigit, aSketch.string("SolverDOF").value()))) + return int("".join(filter(str.isdigit, aSketch.string("SolverDOF").value()))) + def distancePointPoint(thePoint1, thePoint2): aPnt1 = toList(thePoint1) aPnt2 = toList(thePoint2) return math.hypot(aPnt1[0] - aPnt2[0], aPnt1[1] - aPnt2[1]) + def signedDistancePointLine(thePoint, theLine): aPoint = toList(thePoint) aLine = toSketchFeature(theLine) @@ -83,12 +82,16 @@ def signedDistancePointLine(thePoint, theLine): aLineEnd = geomDataAPI_Point2D(aLine.attribute("EndPoint")).pnt().xy() aLineDir = aLineEnd.decreased(aLineStart) aLineLen = aLineEnd.distance(aLineStart) - aCross = (aPoint[0] - aLineStart.x()) * aLineDir.y() - (aPoint[1] - aLineStart.y()) * aLineDir.x() + aCross = (aPoint[0] - aLineStart.x()) * aLineDir.y() - ( + aPoint[1] - aLineStart.y() + ) * aLineDir.x() return aCross / aLineLen + def distancePointLine(thePoint, theLine): return math.fabs(signedDistancePointLine(thePoint, theLine)) + def lastSubFeature(theSketch, theKind): """ obtains last feature of given kind from the sketch @@ -96,17 +99,18 @@ def lastSubFeature(theSketch, theKind): aSketch = featureToCompositeFeature(toSketchFeature(theSketch)) for anIndex in range(aSketch.numberOfSubs() - 1, -1, -1): aSub = aSketch.subFeature(anIndex) - if (aSub.getKind() == theKind): + if aSub.getKind() == theKind: return aSub + def toSketchFeature(theEntity): - """ Converts entity to sketch feature if possible - """ + """Converts entity to sketch feature if possible""" if issubclass(type(theEntity), ModelHighAPI.ModelHighAPI_Interface): return theEntity.feature() else: return theEntity + def toList(thePoint): if issubclass(type(thePoint), list): return thePoint diff --git a/src/PythonAPI/model/tests/__init__.py b/src/PythonAPI/model/tests/__init__.py index fe789dcfc..c8739f068 100644 --- a/src/PythonAPI/model/tests/__init__.py +++ b/src/PythonAPI/model/tests/__init__.py @@ -16,4 +16,4 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from .tests import * \ No newline at end of file +from .tests import * diff --git a/src/PythonAPI/model/tests/tests.py b/src/PythonAPI/model/tests/tests.py index c944dadde..4ddb80c7d 100644 --- a/src/PythonAPI/model/tests/tests.py +++ b/src/PythonAPI/model/tests/tests.py @@ -25,451 +25,575 @@ from ModelHighAPI import * import math from salome.shaper.model import sketcher -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 aShapeTypes = { - GeomAPI_Shape.SOLID: "GeomAPI_Shape.SOLID", - GeomAPI_Shape.FACE: "GeomAPI_Shape.FACE", - GeomAPI_Shape.EDGE: "GeomAPI_Shape.EDGE", - GeomAPI_Shape.VERTEX: "GeomAPI_Shape.VERTEX"} - - -def generateTests(theFeature, theFeatureName, theTestsList = []): - """ Generates tests for theFeature. - :param theFeature: feature to test. Should be ModelHighAPI_Interface. - :param theFeatureName: feature name to put in test commands. - :param theTestsList: list of test to be generated. If empty generates all tests. - """ - if "testNbResults" in theTestsList or len(theTestsList) == 0: - aNbResults = len(theFeature.results()) - print("model.testNbResults({}, {})".format(theFeatureName, aNbResults)) + GeomAPI_Shape.SOLID: "GeomAPI_Shape.SOLID", + GeomAPI_Shape.FACE: "GeomAPI_Shape.FACE", + GeomAPI_Shape.EDGE: "GeomAPI_Shape.EDGE", + GeomAPI_Shape.VERTEX: "GeomAPI_Shape.VERTEX", +} + + +def generateTests(theFeature, theFeatureName, theTestsList=[]): + """Generates tests for theFeature. + :param theFeature: feature to test. Should be ModelHighAPI_Interface. + :param theFeatureName: feature name to put in test commands. + :param theTestsList: list of test to be generated. If empty generates all tests. + """ + if "testNbResults" in theTestsList or len(theTestsList) == 0: + aNbResults = len(theFeature.results()) + print("model.testNbResults({}, {})".format(theFeatureName, aNbResults)) + + if "testNbSubResults" in theTestsList or len(theTestsList) == 0: + aNbResults = len(theFeature.results()) + aNbSubResults = [] + for anIndex in range(0, aNbResults): + aNbSubResults.append(theFeature.results()[anIndex].numberOfSubs()) + print("model.testNbSubResults({}, {})".format(theFeatureName, aNbSubResults)) + + if "testNbSubShapes" in theTestsList or len(theTestsList) == 0: + aNbResults = len(theFeature.results()) + for aShapeType in aShapeTypes: + aNbSubShapes = [] + for anIndex in range(0, aNbResults): + aShape = theFeature.results()[anIndex].resultSubShapePair()[0].shape() + aNbResultSubShapes = 0 + aShapeExplorer = GeomAPI_ShapeExplorer(aShape, aShapeType) + while aShapeExplorer.more(): + aNbResultSubShapes += 1 + aShapeExplorer.next() + aNbSubShapes.append(aNbResultSubShapes) + print( + "model.testNbSubShapes({}, {}, {})".format( + theFeatureName, aShapeTypes[aShapeType], aNbSubShapes + ) + ) + + if "testResultsVolumes" in theTestsList or len(theTestsList) == 0: + aNbResults = len(theFeature.results()) + aResultsVolumes = [] + for anIndex in range(0, aNbResults): + aResultsVolumes.append( + GeomAlgoAPI_ShapeTools.volume( + theFeature.results()[anIndex].resultSubShapePair()[0].shape() + ) + ) + print( + "model.testResultsVolumes({}, [{}])".format( + theFeatureName, ", ".join("{:0.27f}".format(i) for i in aResultsVolumes) + ) + ) + + if "testResultsAreas" in theTestsList or len(theTestsList) == 0: + aNbResults = len(theFeature.results()) + aResultsAreas = [] + for anIndex in range(0, aNbResults): + aResultsAreas.append( + GeomAlgoAPI_ShapeTools.area( + theFeature.results()[anIndex].resultSubShapePair()[0].shape() + ) + ) + print( + "model.testResultsAreas({}, [{}])".format( + theFeatureName, ", ".join("{:0.27f}".format(i) for i in aResultsAreas) + ) + ) - if "testNbSubResults" in theTestsList or len(theTestsList) == 0: - aNbResults = len(theFeature.results()) - aNbSubResults = [] - for anIndex in range(0, aNbResults): - aNbSubResults.append(theFeature.results()[anIndex].numberOfSubs()) - print("model.testNbSubResults({}, {})".format(theFeatureName, aNbSubResults)) - if "testNbSubShapes" in theTestsList or len(theTestsList) == 0: +def testNbResults(theFeature, theExpectedNbResults): + """Tests number of feature results. + :param theFeature: feature to test. + :param theExpectedNbResults: expected number of results. + """ aNbResults = len(theFeature.results()) - for aShapeType in aShapeTypes: - aNbSubShapes = [] - for anIndex in range(0, aNbResults): - aShape = theFeature.results()[anIndex].resultSubShapePair()[0].shape() - aNbResultSubShapes = 0 - aShapeExplorer = GeomAPI_ShapeExplorer(aShape, aShapeType) - while aShapeExplorer.more(): - aNbResultSubShapes += 1 - aShapeExplorer.next() - aNbSubShapes.append(aNbResultSubShapes) - print("model.testNbSubShapes({}, {}, {})".format(theFeatureName, aShapeTypes[aShapeType], aNbSubShapes)) + assert ( + aNbResults == theExpectedNbResults + ), "Number of results: {}. Expected: {}.".format(aNbResults, theExpectedNbResults) - if "testResultsVolumes" in theTestsList or len(theTestsList) == 0: - aNbResults = len(theFeature.results()) - aResultsVolumes = [] - for anIndex in range(0, aNbResults): - aResultsVolumes.append(GeomAlgoAPI_ShapeTools.volume(theFeature.results()[anIndex].resultSubShapePair()[0].shape())) - print("model.testResultsVolumes({}, [{}])".format(theFeatureName, ", ".join("{:0.27f}".format(i) for i in aResultsVolumes))) - if "testResultsAreas" in theTestsList or len(theTestsList) == 0: +def testNbSubResults(theFeature, theExpectedNbSubResults): + """Tests number of feature sub-results for each result. + :param theFeature: feature to test. + :param theExpectedNbSubResults: list of sub-results numbers. Size of list should be equal to len(theFeature.results()). + """ aNbResults = len(theFeature.results()) - aResultsAreas = [] + aListSize = len(theExpectedNbSubResults) + assert ( + aNbResults == aListSize + ), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) for anIndex in range(0, aNbResults): - aResultsAreas.append(GeomAlgoAPI_ShapeTools.area(theFeature.results()[anIndex].resultSubShapePair()[0].shape())) - print("model.testResultsAreas({}, [{}])".format(theFeatureName, ", ".join("{:0.27f}".format(i) for i in aResultsAreas))) - - -def testNbResults(theFeature, theExpectedNbResults): - """ Tests number of feature results. - :param theFeature: feature to test. - :param theExpectedNbResults: expected number of results. - """ - aNbResults = len(theFeature.results()) - assert (aNbResults == theExpectedNbResults), "Number of results: {}. Expected: {}.".format(aNbResults, theExpectedNbResults) - - -def testNbSubResults(theFeature, theExpectedNbSubResults): - """ Tests number of feature sub-results for each result. - :param theFeature: feature to test. - :param theExpectedNbSubResults: list of sub-results numbers. Size of list should be equal to len(theFeature.results()). - """ - aNbResults = len(theFeature.results()) - aListSize = len(theExpectedNbSubResults) - assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) - for anIndex in range(0, aNbResults): - aNbSubResults = theFeature.results()[anIndex].numberOfSubs() - anExpectedNbSubResults = theExpectedNbSubResults[anIndex] - assert (aNbSubResults == anExpectedNbSubResults), "Number of sub-results for result[{}]: {}. Expected: {}.".format(anIndex, aNbSubResults, anExpectedNbSubResults) + aNbSubResults = theFeature.results()[anIndex].numberOfSubs() + anExpectedNbSubResults = theExpectedNbSubResults[anIndex] + assert ( + aNbSubResults == anExpectedNbSubResults + ), "Number of sub-results for result[{}]: {}. Expected: {}.".format( + anIndex, aNbSubResults, anExpectedNbSubResults + ) def testNbSubShapes(theFeature, theShapeType, theExpectedNbSubShapes): - """ Tests number of feature sub-shapes of passed type for each result. - :param theFeature: feature to test. - :param theShapeType: shape type of sub-shapes to test. - :param theExpectedNbSubShapes: list of sub-shapes numbers. Size of list should be equal to len(theFeature.results()). - """ - aNbResults = len(theFeature.results()) - aListSize = len(theExpectedNbSubShapes) - assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) - for anIndex in range(0, aNbResults): - aNbResultSubShapes = 0 - anExpectedNbSubShapes = theExpectedNbSubShapes[anIndex] - aShape = theFeature.results()[anIndex].resultSubShapePair()[0].shape() - aShapeExplorer = GeomAPI_ShapeExplorer(aShape, theShapeType) - while aShapeExplorer.more(): - aNbResultSubShapes += 1 - aShapeExplorer.next() - assert (aNbResultSubShapes == anExpectedNbSubShapes), "Number of sub-shapes of type {} for result[{}]: {}. Expected: {}.".format(aShapeTypes[theShapeType], anIndex, aNbResultSubShapes, anExpectedNbSubShapes) + """Tests number of feature sub-shapes of passed type for each result. + :param theFeature: feature to test. + :param theShapeType: shape type of sub-shapes to test. + :param theExpectedNbSubShapes: list of sub-shapes numbers. Size of list should be equal to len(theFeature.results()). + """ + aNbResults = len(theFeature.results()) + aListSize = len(theExpectedNbSubShapes) + assert ( + aNbResults == aListSize + ), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) + for anIndex in range(0, aNbResults): + aNbResultSubShapes = 0 + anExpectedNbSubShapes = theExpectedNbSubShapes[anIndex] + aShape = theFeature.results()[anIndex].resultSubShapePair()[0].shape() + aShapeExplorer = GeomAPI_ShapeExplorer(aShape, theShapeType) + while aShapeExplorer.more(): + aNbResultSubShapes += 1 + aShapeExplorer.next() + assert ( + aNbResultSubShapes == anExpectedNbSubShapes + ), "Number of sub-shapes of type {} for result[{}]: {}. Expected: {}.".format( + aShapeTypes[theShapeType], + anIndex, + aNbResultSubShapes, + anExpectedNbSubShapes, + ) def testNbUniqueSubShapes(theFeature, theShapeType, theExpectedNbSubShapes): - """ Tests number of unique feature sub-shapes of passed type for each result. - :param theFeature: feature to test. - :param theShapeType: shape type of sub-shapes to test. - :param theExpectedNbSubShapes: list of sub-shapes numbers. Size of list should be equal to len(theFeature.results()). - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - aListSize = len(theExpectedNbSubShapes) - assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) - for anIndex in range(0, aNbResults): - aNbResultSubShapes = 0 - anExpectedNbSubShapes = theExpectedNbSubShapes[anIndex] - aNbResultSubShapes = aResults[anIndex].shape().subShapes(theShapeType, True).size() - assert (aNbResultSubShapes == anExpectedNbSubShapes), "Number of sub-shapes of type {} for result[{}]: {}. Expected: {}.".format(aShapeTypes[theShapeType], anIndex, aNbResultSubShapes, anExpectedNbSubShapes) + """Tests number of unique feature sub-shapes of passed type for each result. + :param theFeature: feature to test. + :param theShapeType: shape type of sub-shapes to test. + :param theExpectedNbSubShapes: list of sub-shapes numbers. Size of list should be equal to len(theFeature.results()). + """ + aResults = theFeature.feature().results() + aNbResults = len(aResults) + aListSize = len(theExpectedNbSubShapes) + assert ( + aNbResults == aListSize + ), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) + for anIndex in range(0, aNbResults): + aNbResultSubShapes = 0 + anExpectedNbSubShapes = theExpectedNbSubShapes[anIndex] + aNbResultSubShapes = ( + aResults[anIndex].shape().subShapes(theShapeType, True).size() + ) + assert ( + aNbResultSubShapes == anExpectedNbSubShapes + ), "Number of sub-shapes of type {} for result[{}]: {}. Expected: {}.".format( + aShapeTypes[theShapeType], + anIndex, + aNbResultSubShapes, + anExpectedNbSubShapes, + ) def testCompound(theFeature, NbSubRes, NbSolid, NbFace, NbEdge, NbVertex): - """ Tests number of unique sub-shapes in compound result - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - assert (aNbResults == 1), "Number of results: {} not equal to 1.".format(aNbResults) - assert aResults[0].shape().isCompound(), "Result shape type: {}. Expected: COMPOUND.".format(aResults[0].shape().shapeTypeStr()) - testNbSubResults(theFeature, NbSubRes) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.SOLID, NbSolid) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.FACE, NbFace) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.EDGE, NbEdge) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.VERTEX, NbVertex) + """Tests number of unique sub-shapes in compound result""" + aResults = theFeature.feature().results() + aNbResults = len(aResults) + assert aNbResults == 1, "Number of results: {} not equal to 1.".format(aNbResults) + assert ( + aResults[0].shape().isCompound() + ), "Result shape type: {}. Expected: COMPOUND.".format( + aResults[0].shape().shapeTypeStr() + ) + testNbSubResults(theFeature, NbSubRes) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.SOLID, NbSolid) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.FACE, NbFace) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.EDGE, NbEdge) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.VERTEX, NbVertex) def testCompSolid(theFeature, NbSubRes, NbSolid, NbFace, NbEdge, NbVertex): - """ Tests number of unique sub-shapes in compsolid result - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - assert (aNbResults == 1), "Number of results: {} not equal to 1.".format(aNbResults) - assert aResults[0].shape().isCompSolid(), "Result shape type: {}. Expected: COMPSOLID.".format(aResults[0].shape().shapeTypeStr()) - testNbSubResults(theFeature, NbSubRes) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.SOLID, NbSolid) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.FACE, NbFace) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.EDGE, NbEdge) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.VERTEX, NbVertex) + """Tests number of unique sub-shapes in compsolid result""" + aResults = theFeature.feature().results() + aNbResults = len(aResults) + assert aNbResults == 1, "Number of results: {} not equal to 1.".format(aNbResults) + assert ( + aResults[0].shape().isCompSolid() + ), "Result shape type: {}. Expected: COMPSOLID.".format( + aResults[0].shape().shapeTypeStr() + ) + testNbSubResults(theFeature, NbSubRes) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.SOLID, NbSolid) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.FACE, NbFace) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.EDGE, NbEdge) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.VERTEX, NbVertex) def testResults(theFeature, NbRes, NbSubRes, NbShell, NbFace, NbEdge, NbVertex): - """ Tests numbers of unique sub-shapes in the results - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - assert (aNbResults == NbRes), "Number of results: {} not equal to {}}.".format(aNbResults, NbRes) - testNbSubResults(theFeature, NbSubRes) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.SHELL, NbShell) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.FACE, NbFace) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.EDGE, NbEdge) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.VERTEX, NbVertex) - - -def testResultsVolumes(theFeature, theExpectedResultsVolumes, theNbSignificantDigits = 7): - """ Tests results volumes. - :param theFeature: feature to test. - :param theExpectedResultsVolumes: list of results volumes. Size of list should be equal to len(theFeature.results()). - """ - aTolerance = 10**(-theNbSignificantDigits) - aNbResults = len(theFeature.results()) - aListSize = len(theExpectedResultsVolumes) - assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) - for anIndex in range(0, aNbResults): - aResultVolume = GeomAlgoAPI_ShapeTools.volume(theFeature.results()[anIndex].resultSubShapePair()[0].shape()) - 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 * math.fabs(anExpectedResultVolume), "Volume of result[{}]: {:0.27f}. Expected: {:0.27f}. The first {} significant digits not equal.".format(anIndex, aResultVolume, anExpectedResultVolume, theNbSignificantDigits) - - -def testResultsAreas(theFeature, theExpectedResultsVolumes, theNbSignificantDigits = 7): - """ Tests results areas. - :param theFeature: feature to test. - :param theExpectedResultsAreas: list of results areas. Size of list should be equal to len(theFeature.results()). - """ - aTolerance = 10**(-theNbSignificantDigits) - aNbResults = len(theFeature.results()) - aListSize = len(theExpectedResultsVolumes) - assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) - for anIndex in range(0, aNbResults): - aResultVolume = GeomAlgoAPI_ShapeTools.area(theFeature.results()[anIndex].resultSubShapePair()[0].shape()) - 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 * math.fabs(anExpectedResultVolume), "Area 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 - :param theFeature: feature to test. - """ - # open transaction since all the checking are performed in tests after model.end() call - theModel.begin() - # Get feature result/sub-result - aResult = theFeature.results()[0].resultSubShapePair()[0] - # Get result/sub-result shape - shape = aResult.shape() - # Create shape explorer with desired shape type - shapeExplorer = GeomAPI_ShapeExplorer(shape, GeomAPI_Shape.FACE) - # Create list, and store selections in it - selectionList = [] - while shapeExplorer.more(): - selection = theModel.selection(aResult, shapeExplorer.current()) # First argument should be result/sub-result, second is sub-shape on this result/sub-result - selectionList.append(selection) - shapeExplorer.next() - # Create group with this selection list - Group_1 = theModel.addGroup(thePartDoc, selectionList) - theModel.end() - - # Now you can check that all selected shapes in group have right shape type and name. - groupFeature = Group_1.feature() - groupSelectionList = groupFeature.selectionList("group_list") - assert(groupSelectionList.size() == len(selectionList)) - for index in range(0, groupSelectionList.size()): - attrSelection = groupSelectionList.value(index) - shape = attrSelection.value() - name = attrSelection.namingName() - assert(shape.isFace()) - assert(name != ""), "String empty" - -def testHaveNamingEdges(theFeature, theModel, thePartDoc) : - """ Tests if all edges of result have a name - :param theFeature: feature to test. - """ - # Get feature result/sub-result - aResult = theFeature.results()[0].resultSubShapePair()[0] - # Get result/sub-result shape - shape = aResult.shape() - # Create shape explorer with desired shape type - shapeExplorer = GeomAPI_ShapeExplorer(shape, GeomAPI_Shape.EDGE) - # Create list, and store selections in it - selectionList = [] - while shapeExplorer.more(): - selection = theModel.selection(aResult, shapeExplorer.current()) # First argument should be result/sub-result, second is sub-shape on this result/sub-result - selectionList.append(selection) - shapeExplorer.next() - # Create group with this selection list - Group_1 = theModel.addGroup(thePartDoc, selectionList) - theModel.do() - theModel.end() - - # Now you can check that all selected shapes in group have right shape type and name. - groupFeature = Group_1.feature() - groupSelectionList = groupFeature.selectionList("group_list") - theModel.end() - assert(groupSelectionList.size() == len(selectionList)) - for index in range(0, groupSelectionList.size()): - attrSelection = groupSelectionList.value(index) - shape = attrSelection.value() - name = attrSelection.namingName() - assert(shape.isEdge()) - assert(name != ""), "String empty" - -def lowerLevelSubResults(theResult, theList): - """ Collects in a list all lover level sub-results (without children). - Auxiliary method for context correct definition. - """ - nbSubs = theResult.numberOfSubs() - if nbSubs == 0: - theList.append(theResult) - else: - for sub in range(0, nbSubs): - lowerLevelSubResults(theResult.subResult(sub), theList) - -def testHaveNamingByType(theFeature, theModel, thePartDoc, theSubshapeType) : - """ Tests if all sub-shapes of result have a unique name - :param theFeature: feature to test. - :param theSubshapeType: type of sub-shape - """ - if not theFeature.results(): - return - aFirstRes = theFeature.results()[0] - aResList = [] - lowerLevelSubResults(aFirstRes, aResList) - - selectionList = [] - shapesList = [] # to append only unique shapes (not isSame) - for aR in aResList: + """Tests numbers of unique sub-shapes in the results""" + aResults = theFeature.feature().results() + aNbResults = len(aResults) + assert aNbResults == NbRes, "Number of results: {} not equal to {}}.".format( + aNbResults, NbRes + ) + testNbSubResults(theFeature, NbSubRes) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.SHELL, NbShell) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.FACE, NbFace) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.EDGE, NbEdge) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.VERTEX, NbVertex) + + +def testResultsVolumes(theFeature, theExpectedResultsVolumes, theNbSignificantDigits=7): + """Tests results volumes. + :param theFeature: feature to test. + :param theExpectedResultsVolumes: list of results volumes. Size of list should be equal to len(theFeature.results()). + """ + aTolerance = 10 ** (-theNbSignificantDigits) + aNbResults = len(theFeature.results()) + aListSize = len(theExpectedResultsVolumes) + assert ( + aNbResults == aListSize + ), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) + for anIndex in range(0, aNbResults): + aResultVolume = GeomAlgoAPI_ShapeTools.volume( + theFeature.results()[anIndex].resultSubShapePair()[0].shape() + ) + 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 * math.fabs( + anExpectedResultVolume + ), "Volume of result[{}]: {:0.27f}. Expected: {:0.27f}. The first {} significant digits not equal.".format( + anIndex, aResultVolume, anExpectedResultVolume, theNbSignificantDigits + ) + + +def testResultsAreas(theFeature, theExpectedResultsVolumes, theNbSignificantDigits=7): + """Tests results areas. + :param theFeature: feature to test. + :param theExpectedResultsAreas: list of results areas. Size of list should be equal to len(theFeature.results()). + """ + aTolerance = 10 ** (-theNbSignificantDigits) + aNbResults = len(theFeature.results()) + aListSize = len(theExpectedResultsVolumes) + assert ( + aNbResults == aListSize + ), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) + for anIndex in range(0, aNbResults): + aResultVolume = GeomAlgoAPI_ShapeTools.area( + theFeature.results()[anIndex].resultSubShapePair()[0].shape() + ) + 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 * math.fabs( + anExpectedResultVolume + ), "Area 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 + :param theFeature: feature to test. + """ + # open transaction since all the checking are performed in tests after model.end() call + theModel.begin() # Get feature result/sub-result - aResult = aR.resultSubShapePair()[0] + aResult = theFeature.results()[0].resultSubShapePair()[0] # Get result/sub-result shape shape = aResult.shape() # Create shape explorer with desired shape type - shapeExplorer = GeomAPI_ShapeExplorer(shape, theSubshapeType) + shapeExplorer = GeomAPI_ShapeExplorer(shape, GeomAPI_Shape.FACE) # Create list, and store selections in it + selectionList = [] while shapeExplorer.more(): - current = shapeExplorer.current() - if current.isEdge() and GeomAPI.GeomAPI_Edge(current).isDegenerated(): # skip degenerative edges because they are not selected + selection = theModel.selection( + aResult, shapeExplorer.current() + ) # First argument should be result/sub-result, second is sub-shape on this result/sub-result + selectionList.append(selection) shapeExplorer.next() - continue - aDuplicate = False - for alreadyThere in shapesList: - if alreadyThere.isSame(current): - aDuplicate = True - if aDuplicate: + # Create group with this selection list + Group_1 = theModel.addGroup(thePartDoc, selectionList) + theModel.end() + + # Now you can check that all selected shapes in group have right shape type and name. + groupFeature = Group_1.feature() + groupSelectionList = groupFeature.selectionList("group_list") + assert groupSelectionList.size() == len(selectionList) + for index in range(0, groupSelectionList.size()): + attrSelection = groupSelectionList.value(index) + shape = attrSelection.value() + name = attrSelection.namingName() + assert shape.isFace() + assert name != "", "String empty" + + +def testHaveNamingEdges(theFeature, theModel, thePartDoc): + """Tests if all edges of result have a name + :param theFeature: feature to test. + """ + # Get feature result/sub-result + aResult = theFeature.results()[0].resultSubShapePair()[0] + # Get result/sub-result shape + shape = aResult.shape() + # Create shape explorer with desired shape type + shapeExplorer = GeomAPI_ShapeExplorer(shape, GeomAPI_Shape.EDGE) + # Create list, and store selections in it + selectionList = [] + while shapeExplorer.more(): + selection = theModel.selection( + aResult, shapeExplorer.current() + ) # First argument should be result/sub-result, second is sub-shape on this result/sub-result + selectionList.append(selection) shapeExplorer.next() - continue - shapesList.append(current) - selection = theModel.selection(aResult, current) # First argument should be result/sub-result, second is sub-shape on this result/sub-result - selectionList.append(selection) - shapeExplorer.next() - # Create group with this selection list - # (do not create group if nothing is selected) - if (len(selectionList) == 0): - return - Group_1 = theModel.addGroup(thePartDoc, selectionList) - theModel.do() - - groupSelectionList = Group_1.feature().selectionList("group_list") - assert(groupSelectionList.size() == len(selectionList)) - - # Check that all selected shapes in group have right shape type and unique name. - checkGroup(Group_1, theSubshapeType) - -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) + # Create group with this selection list + Group_1 = theModel.addGroup(thePartDoc, selectionList) + theModel.do() + theModel.end() + + # Now you can check that all selected shapes in group have right shape type and name. + groupFeature = Group_1.feature() + groupSelectionList = groupFeature.selectionList("group_list") + theModel.end() + assert groupSelectionList.size() == len(selectionList) + for index in range(0, groupSelectionList.size()): + attrSelection = groupSelectionList.value(index) + shape = attrSelection.value() + name = attrSelection.namingName() + assert shape.isEdge() + assert name != "", "String empty" + + +def lowerLevelSubResults(theResult, theList): + """Collects in a list all lover level sub-results (without children). + Auxiliary method for context correct definition. + """ + nbSubs = theResult.numberOfSubs() + if nbSubs == 0: + theList.append(theResult) + else: + for sub in range(0, nbSubs): + lowerLevelSubResults(theResult.subResult(sub), theList) + + +def testHaveNamingByType(theFeature, theModel, thePartDoc, theSubshapeType): + """Tests if all sub-shapes of result have a unique name + :param theFeature: feature to test. + :param theSubshapeType: type of sub-shape + """ + if not theFeature.results(): + return + aFirstRes = theFeature.results()[0] + aResList = [] + lowerLevelSubResults(aFirstRes, aResList) + + selectionList = [] + shapesList = [] # to append only unique shapes (not isSame) + for aR in aResList: + # Get feature result/sub-result + aResult = aR.resultSubShapePair()[0] + # Get result/sub-result shape + shape = aResult.shape() + # Create shape explorer with desired shape type + shapeExplorer = GeomAPI_ShapeExplorer(shape, theSubshapeType) + # Create list, and store selections in it + while shapeExplorer.more(): + current = shapeExplorer.current() + if ( + current.isEdge() and GeomAPI.GeomAPI_Edge(current).isDegenerated() + ): # skip degenerative edges because they are not selected + shapeExplorer.next() + continue + aDuplicate = False + for alreadyThere in shapesList: + if alreadyThere.isSame(current): + aDuplicate = True + if aDuplicate: + shapeExplorer.next() + continue + shapesList.append(current) + selection = theModel.selection( + aResult, current + ) # First argument should be result/sub-result, second is sub-shape on this result/sub-result + selectionList.append(selection) + shapeExplorer.next() + # Create group with this selection list + # (do not create group if nothing is selected) + if len(selectionList) == 0: + return + Group_1 = theModel.addGroup(thePartDoc, selectionList) + theModel.do() + + groupSelectionList = Group_1.feature().selectionList("group_list") + assert groupSelectionList.size() == len(selectionList) + + # Check that all selected shapes in group have right shape type and unique name. + checkGroup(Group_1, theSubshapeType) + + +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) + def testNbSubFeatures(theComposite, theKindOfSub, theExpectedCount): - """ Tests number of sub-features of the given type - :param theComposite composite feature to check its subs - :param theKindOfSub kind of sub-feature to calculate count - :param theExpectedCount expected number of sub-features - """ - count = 0 - for aSub in theComposite.features().list(): - aFeature = ModelAPI_Feature.feature(aSub) - if aFeature is not None and aFeature.getKind() == theKindOfSub: - count += 1 - assert (count == theExpectedCount), "Number of sub-features of type {}: {}, expected {}".format(theKindOfSub, count, theExpectedCount) + """Tests number of sub-features of the given type + :param theComposite composite feature to check its subs + :param theKindOfSub kind of sub-feature to calculate count + :param theExpectedCount expected number of sub-features + """ + count = 0 + for aSub in theComposite.features().list(): + aFeature = ModelAPI_Feature.feature(aSub) + if aFeature is not None and aFeature.getKind() == theKindOfSub: + count += 1 + assert ( + count == theExpectedCount + ), "Number of sub-features of type {}: {}, expected {}".format( + theKindOfSub, count, theExpectedCount + ) + def assertSketchArc(theArcFeature): - """ Tests whether the arc is correctly defined - """ - aCenterPnt = geomDataAPI_Point2D(theArcFeature.attribute("center_point")) - aStartPnt = geomDataAPI_Point2D(theArcFeature.attribute("start_point")) - aEndPnt = geomDataAPI_Point2D(theArcFeature.attribute("end_point")) - aRadius = theArcFeature.real("radius") - aDistCS = sketcher.tools.distancePointPoint(aCenterPnt, aStartPnt) - aDistCE = sketcher.tools.distancePointPoint(aCenterPnt, aEndPnt) - assert math.fabs(aDistCS - aDistCE) < TOLERANCE, "Wrong arc: center-start distance {}, center-end distance {}".format(aDistCS, aDistCE) - assert math.fabs(aRadius.value() -aDistCS) < TOLERANCE, "Wrong arc: radius is {0}, expected {1}".format(aRadius.value(), aDistCS) - -def checkResult(theFeature,theModel,NbRes,NbSubRes,NbSolid,NbFace,NbEdge,NbVertex): - """ Tests numbers of sub-shapes in results - """ - theModel.testNbResults(theFeature, NbRes) - theModel.testNbSubResults(theFeature, NbSubRes) - theModel.testNbSubShapes(theFeature, GeomAPI_Shape.SOLID, NbSolid) - theModel.testNbSubShapes(theFeature, GeomAPI_Shape.FACE, NbFace) - theModel.testNbSubShapes(theFeature, GeomAPI_Shape.EDGE, NbEdge) - theModel.testNbSubShapes(theFeature, GeomAPI_Shape.VERTEX, NbVertex) + """Tests whether the arc is correctly defined""" + aCenterPnt = geomDataAPI_Point2D(theArcFeature.attribute("center_point")) + aStartPnt = geomDataAPI_Point2D(theArcFeature.attribute("start_point")) + aEndPnt = geomDataAPI_Point2D(theArcFeature.attribute("end_point")) + aRadius = theArcFeature.real("radius") + aDistCS = sketcher.tools.distancePointPoint(aCenterPnt, aStartPnt) + aDistCE = sketcher.tools.distancePointPoint(aCenterPnt, aEndPnt) + assert ( + math.fabs(aDistCS - aDistCE) < TOLERANCE + ), "Wrong arc: center-start distance {}, center-end distance {}".format( + aDistCS, aDistCE + ) + assert ( + math.fabs(aRadius.value() - aDistCS) < TOLERANCE + ), "Wrong arc: radius is {0}, expected {1}".format(aRadius.value(), aDistCS) + + +def checkResult( + theFeature, theModel, NbRes, NbSubRes, NbSolid, NbFace, NbEdge, NbVertex +): + """Tests numbers of sub-shapes in results""" + theModel.testNbResults(theFeature, NbRes) + theModel.testNbSubResults(theFeature, NbSubRes) + theModel.testNbSubShapes(theFeature, GeomAPI_Shape.SOLID, NbSolid) + theModel.testNbSubShapes(theFeature, GeomAPI_Shape.FACE, NbFace) + theModel.testNbSubShapes(theFeature, GeomAPI_Shape.EDGE, NbEdge) + theModel.testNbSubShapes(theFeature, GeomAPI_Shape.VERTEX, NbVertex) + def checkGroup(theGroup, theShapeType): - """ Check that all selected shapes in group have correct shape type and unique name - """ - groupFeature = theGroup.feature() - groupSelectionList = groupFeature.selectionList("group_list") - presented_names = set() - for index in range(0, groupSelectionList.size()): - attrSelection = groupSelectionList.value(index) - shape = attrSelection.value() - name = attrSelection.namingName() - if theShapeType == GeomAPI_Shape.VERTEX: - assert(shape.isVertex()) - elif theShapeType == GeomAPI_Shape.EDGE: - assert(shape.isEdge()) - elif theShapeType == GeomAPI_Shape.FACE: - assert(shape.isFace()) - assert(name != ""), "String empty" - presented_names.add(name) - assert(len(presented_names) == groupSelectionList.size()), "Some names are not unique" + """Check that all selected shapes in group have correct shape type and unique name""" + groupFeature = theGroup.feature() + groupSelectionList = groupFeature.selectionList("group_list") + presented_names = set() + for index in range(0, groupSelectionList.size()): + attrSelection = groupSelectionList.value(index) + shape = attrSelection.value() + name = attrSelection.namingName() + if theShapeType == GeomAPI_Shape.VERTEX: + assert shape.isVertex() + elif theShapeType == GeomAPI_Shape.EDGE: + assert shape.isEdge() + elif theShapeType == GeomAPI_Shape.FACE: + assert shape.isFace() + assert name != "", "String empty" + presented_names.add(name) + assert ( + len(presented_names) == groupSelectionList.size() + ), "Some names are not unique" + def createSubShape(thePartDoc, theModel, theSelection): - """ Create feature according to the type of the given subshape - """ - if theSelection.shapeType() == "VERTEX": - return theModel.addVertex(thePartDoc, [theSelection]) - elif theSelection.shapeType() == "EDGE": - return theModel.addEdge(thePartDoc, [theSelection]) - elif theSelection.shapeType() == "FACE": - return theModel.addFace(thePartDoc, [theSelection]) + """Create feature according to the type of the given subshape""" + if theSelection.shapeType() == "VERTEX": + return theModel.addVertex(thePartDoc, [theSelection]) + elif theSelection.shapeType() == "EDGE": + return theModel.addEdge(thePartDoc, [theSelection]) + elif theSelection.shapeType() == "FACE": + return theModel.addFace(thePartDoc, [theSelection]) + def checkFilter(thePartDoc, theModel, theFilter, theShapesList): - """ Check filter's work on specified shape. - Shapes given as a dictionary of selection and expected result. - """ - aFiltersFactory = ModelAPI_Session.get().filters() - for sel, res in theShapesList.items(): - needUndo = False - shapeName = "" - shapeType = "UNKNOWN" - if sel.variantType() == ModelHighAPI_Selection.VT_ResultSubShapePair: - parent = sel.resultSubShapePair()[0] - shape = sel.resultSubShapePair()[1] - if shape.isNull(): - shape = sel.resultSubShapePair()[0].shape() - shapeName = sel.name() - shapeType = shape.shapeTypeStr() - else: - needUndo = True - theModel.begin() - subShapeFeature = createSubShape(thePartDoc, theModel, sel) - theModel.end() - parent = subShapeFeature.results()[0].resultSubShapePair()[0] - shape = subShapeFeature.results()[0].resultSubShapePair()[0].shape() - shapeType = sel.typeSubShapeNamePair()[0] - shapeName = sel.typeSubShapeNamePair()[1] - assert aFiltersFactory.isValid(theFilter.feature(), parent, shape) == res, "Filter result for {} \"{}\" incorrect. Expected {}.".format(shapeType, shapeName, res) - if needUndo: - theModel.undo() + """Check filter's work on specified shape. + Shapes given as a dictionary of selection and expected result. + """ + aFiltersFactory = ModelAPI_Session.get().filters() + for sel, res in theShapesList.items(): + needUndo = False + shapeName = "" + shapeType = "UNKNOWN" + if sel.variantType() == ModelHighAPI_Selection.VT_ResultSubShapePair: + parent = sel.resultSubShapePair()[0] + shape = sel.resultSubShapePair()[1] + if shape.isNull(): + shape = sel.resultSubShapePair()[0].shape() + shapeName = sel.name() + shapeType = shape.shapeTypeStr() + else: + needUndo = True + theModel.begin() + subShapeFeature = createSubShape(thePartDoc, theModel, sel) + theModel.end() + parent = subShapeFeature.results()[0].resultSubShapePair()[0] + shape = subShapeFeature.results()[0].resultSubShapePair()[0].shape() + shapeType = sel.typeSubShapeNamePair()[0] + shapeName = sel.typeSubShapeNamePair()[1] + assert ( + aFiltersFactory.isValid(theFilter.feature(), parent, shape) == res + ), 'Filter result for {} "{}" incorrect. Expected {}.'.format( + shapeType, shapeName, res + ) + if needUndo: + theModel.undo() + def checkFeaturesValidity(thePartDoc): - """ Check that the features are not in error - """ - aFactory = ModelAPI_Session.get().validators() - - nbFeatures = thePartDoc.size("Features") - - assert nbFeatures>0, "No features found in part doc" - - for i in range(nbFeatures): - partObject = thePartDoc.object("Features", i) - # Check the data - partObjectData = partObject.data() - name = partObjectData.name() - error = partObjectData.error() - # raise the error message if there is one - assert error == '', "The feature data {0} is in error: {1}".format(name, error) - # raise an error if the the feature is not valid (without error message) - assert partObject.data().isValid(), "The feature data {0} is in error.".format(name) - # Same checks for the feature itself - feature = objectToFeature(partObject) - if feature is None: - # Folders are not real features - continue - # raise the error message if there is one - assert error == '', "The feature {0} is in error: {1}".format(name, error) - # raise an error if the the feature is not valid (without error message) - assert aFactory.validate(feature), "The feature {0} is in error.".format(name) + """Check that the features are not in error""" + aFactory = ModelAPI_Session.get().validators() + + nbFeatures = thePartDoc.size("Features") + + assert nbFeatures > 0, "No features found in part doc" + + for i in range(nbFeatures): + partObject = thePartDoc.object("Features", i) + # Check the data + partObjectData = partObject.data() + name = partObjectData.name() + error = partObjectData.error() + # raise the error message if there is one + assert error == "", "The feature data {0} is in error: {1}".format(name, error) + # raise an error if the the feature is not valid (without error message) + assert partObject.data().isValid(), "The feature data {0} is in error.".format( + name + ) + # Same checks for the feature itself + feature = objectToFeature(partObject) + if feature is None: + # Folders are not real features + continue + # raise the error message if there is one + assert error == "", "The feature {0} is in error: {1}".format(name, error) + # raise an error if the the feature is not valid (without error message) + assert aFactory.validate(feature), "The feature {0} is in error.".format(name) diff --git a/src/PythonAddons/Test/TestRectangle.py b/src/PythonAddons/Test/TestRectangle.py index e2629eda6..f6482ec2f 100755 --- a/src/PythonAddons/Test/TestRectangle.py +++ b/src/PythonAddons/Test/TestRectangle.py @@ -33,4 +33,4 @@ endPoint = geom.Pnt2d(100, 100) rectangle_2 = sketch.addRectangle(startPoint, endPoint) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/PythonAddons/Test/TestRectangleCentered.py b/src/PythonAddons/Test/TestRectangleCentered.py index ded993abe..6982d0dde 100755 --- a/src/PythonAddons/Test/TestRectangleCentered.py +++ b/src/PythonAddons/Test/TestRectangleCentered.py @@ -22,29 +22,37 @@ from salome.shaper import geom from SketchAPI import * -def checkRectangle(lines, center, corner, tolerance = 1.e-7): - dx = corner.x() - center.x() - dy = corner.y() - center.y() - points = [geom.Pnt2d(center.x() - dx, center.y() - dy), - geom.Pnt2d(center.x() - dx, center.y() + dy), - geom.Pnt2d(center.x() + dx, center.y() + dy), - geom.Pnt2d(center.x() + dx, center.y() - dy)] - for i in range(0, 4): - line = SketchAPI_Line(lines[i]) - sp = line.startPoint().pnt() - sp_ref = points[i-1] - assert(sp.distance(sp_ref) <= tolerance) - ep = line.endPoint().pnt() - ep_ref = points[i] - assert(ep.distance(ep_ref) <= tolerance) - -def checkRectangleL(lines, valref, tolerance = 1.e-5): - for i in range(0, 4): - line = SketchAPI_Line(lines[i]) - #print (line.defaultResult().shape().edge().length()) - #print (valref[i%2]) - #print (abs(line.defaultResult().shape().edge().length()-valref[i%2])) - assert(abs(line.defaultResult().shape().edge().length()-valref[i%2]) <= tolerance) + +def checkRectangle(lines, center, corner, tolerance=1.0e-7): + dx = corner.x() - center.x() + dy = corner.y() - center.y() + points = [ + geom.Pnt2d(center.x() - dx, center.y() - dy), + geom.Pnt2d(center.x() - dx, center.y() + dy), + geom.Pnt2d(center.x() + dx, center.y() + dy), + geom.Pnt2d(center.x() + dx, center.y() - dy), + ] + for i in range(0, 4): + line = SketchAPI_Line(lines[i]) + sp = line.startPoint().pnt() + sp_ref = points[i - 1] + assert sp.distance(sp_ref) <= tolerance + ep = line.endPoint().pnt() + ep_ref = points[i] + assert ep.distance(ep_ref) <= tolerance + + +def checkRectangleL(lines, valref, tolerance=1.0e-5): + for i in range(0, 4): + line = SketchAPI_Line(lines[i]) + # print (line.defaultResult().shape().edge().length()) + # print (valref[i%2]) + # print (abs(line.defaultResult().shape().edge().length()-valref[i%2])) + assert ( + abs(line.defaultResult().shape().edge().length() - valref[i % 2]) + <= tolerance + ) + model.begin() partSet = model.moduleDocument() @@ -71,43 +79,61 @@ model.end() checkRectangle(lines_2, geom.Pnt2d(0.0, 0.0), endPoint) model.begin() -rectangle_3 = sketch.addRectangleCentered(SketchAPI_Line(lines_1[0]).startPoint(), SketchAPI_Line(lines_2[0]).endPoint()) +rectangle_3 = sketch.addRectangleCentered( + SketchAPI_Line(lines_1[0]).startPoint(), SketchAPI_Line(lines_2[0]).endPoint() +) lines_3 = rectangle_3.lines() model.end() -checkRectangle(lines_3, SketchAPI_Line(lines_1[0]).startPoint().pnt(), SketchAPI_Line(lines_2[0]).endPoint().pnt()) +checkRectangle( + lines_3, + SketchAPI_Line(lines_1[0]).startPoint().pnt(), + SketchAPI_Line(lines_2[0]).endPoint().pnt(), +) # move center of rectangle SHIFT = 1.0 center = SketchAPI_Line(lines_1[0]).startPoint().pnt() -valref = [ \ -400.86931 , 200.78509 , \ -401.73886 , 201.57021 , \ -402.60865 , 202.35537 , \ -403.47866 , 203.14056 , \ -404.34890 , 203.92580 ] +valref = [ + 400.86931, + 200.78509, + 401.73886, + 201.57021, + 402.60865, + 202.35537, + 403.47866, + 203.14056, + 404.34890, + 203.92580, +] for i in range(0, 5): - center.setX(center.x() + SHIFT) - center.setY(center.y() + SHIFT) - model.begin() - sketch.move(SketchAPI_Line(lines_1[0]).startPoint(), center) - model.end() - checkRectangleL(lines_3, valref[2*i:]) + center.setX(center.x() + SHIFT) + center.setY(center.y() + SHIFT) + model.begin() + sketch.move(SketchAPI_Line(lines_1[0]).startPoint(), center) + model.end() + checkRectangleL(lines_3, valref[2 * i :]) # move corner of rectangle corner = SketchAPI_Line(lines_2[0]).endPoint().pnt() -valref = [ \ -403.11209 , 202.95437 , \ -401.87551 , 201.98300 , \ -400.63915 , 201.01169 , \ -399.40301 , 200.04043 , \ -398.16710 , 199.06922 ] +valref = [ + 403.11209, + 202.95437, + 401.87551, + 201.98300, + 400.63915, + 201.01169, + 399.40301, + 200.04043, + 398.16710, + 199.06922, +] for i in range(0, 5): - corner.setX(corner.x() + SHIFT) - corner.setY(corner.y() + SHIFT) - model.begin() - sketch.move(SketchAPI_Line(lines_2[0]).endPoint(), corner) - model.end() - checkRectangleL(lines_3, valref[2*i:]) - -assert(model.checkPythonDump()) + corner.setX(corner.x() + SHIFT) + corner.setY(corner.y() + SHIFT) + model.begin() + sketch.move(SketchAPI_Line(lines_2[0]).endPoint(), corner) + model.end() + checkRectangleL(lines_3, valref[2 * i :]) + +assert model.checkPythonDump() diff --git a/src/PythonAddons/Test/TestcompoundVertices.py b/src/PythonAddons/Test/TestcompoundVertices.py index f84decb04..6d9611414 100755 --- a/src/PythonAddons/Test/TestcompoundVertices.py +++ b/src/PythonAddons/Test/TestcompoundVertices.py @@ -25,10 +25,14 @@ import os aSession = ModelAPI_Session.get() + def getFilePath(fileName): - path = os.path.join(os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "macros", "compoundVertices") + path = os.path.join( + os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "macros", "compoundVertices" + ) return os.path.join(path, fileName) + theFile = getFilePath("compoundVertices.txt") aSession.startOperation("Create part for import") diff --git a/src/PythonAddons/Test/TestimportParameters.py b/src/PythonAddons/Test/TestimportParameters.py index 2cc443ac5..f72db7f65 100755 --- a/src/PythonAddons/Test/TestimportParameters.py +++ b/src/PythonAddons/Test/TestimportParameters.py @@ -25,10 +25,14 @@ import os aSession = ModelAPI_Session.get() + def getFilePath(fileName): - path = os.path.join(os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "macros", "importParameters") + path = os.path.join( + os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "macros", "importParameters" + ) return os.path.join(path, fileName) + theFile = getFilePath("importParameters.txt") aSession.startOperation("Create part for import") @@ -44,4 +48,4 @@ file = anImportFeature.string(aFieldName) file.setValue(theFile) aSession.finishOperation() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/PythonAddons/Test/TestmidSurface_1.py b/src/PythonAddons/Test/TestmidSurface_1.py index 0ed5c0e54..1fec65118 100755 --- a/src/PythonAddons/Test/TestmidSurface_1.py +++ b/src/PythonAddons/Test/TestmidSurface_1.py @@ -24,10 +24,14 @@ import os aSession = ModelAPI_Session.get() + def getFilePath(fileName): - path = os.path.join(os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "macros", "midSurface") + path = os.path.join( + os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "macros", "midSurface" + ) return os.path.join(path, fileName) + theFile = getFilePath("midSurface_1.stp") aSession.startOperation("Create part for mid surface") @@ -43,10 +47,18 @@ aFile = anImportFeature.string(aFieldName) aFile.setValue(theFile) aSession.finishOperation() -#for cle in ("Construction", "Bodies", "Groups", "Folders"): - #print (cle,":",aPart.size(cle)) +# for cle in ("Construction", "Bodies", "Groups", "Folders"): +# print (cle,":",aPart.size(cle)) -assert(aPart.size("Construction") == 7), "Right number of construction: {}".format(aPart.size("Construction")) -assert(aPart.size("Bodies") == 8), "Right number of construction: {}".format(aPart.size("Bodies")) -assert(aPart.size("Groups") == 2), "Right number of construction: {}".format(aPart.size("Groups")) -assert(aPart.size("Folders") == 4), "Wrong number of folders: {}".format(aPart.size("Folders")) +assert aPart.size("Construction") == 7, "Right number of construction: {}".format( + aPart.size("Construction") +) +assert aPart.size("Bodies") == 8, "Right number of construction: {}".format( + aPart.size("Bodies") +) +assert aPart.size("Groups") == 2, "Right number of construction: {}".format( + aPart.size("Groups") +) +assert aPart.size("Folders") == 4, "Wrong number of folders: {}".format( + aPart.size("Folders") +) diff --git a/src/PythonAddons/Test/TestmidSurface_2.py b/src/PythonAddons/Test/TestmidSurface_2.py index db90421f6..e032b550d 100755 --- a/src/PythonAddons/Test/TestmidSurface_2.py +++ b/src/PythonAddons/Test/TestmidSurface_2.py @@ -24,10 +24,14 @@ import os aSession = ModelAPI_Session.get() + def getFilePath(fileName): - path = os.path.join(os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "macros", "midSurface") + path = os.path.join( + os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "macros", "midSurface" + ) return os.path.join(path, fileName) + theFile = getFilePath("midSurface_2.stp") aSession.startOperation("Create part for mid surface") @@ -43,10 +47,18 @@ aFile = anImportFeature.string(aFieldName) aFile.setValue(theFile) aSession.finishOperation() -#for cle in ("Construction", "Bodies", "Groups", "Folders"): - #print (cle,":",aPart.size(cle)) +# for cle in ("Construction", "Bodies", "Groups", "Folders"): +# print (cle,":",aPart.size(cle)) -assert(aPart.size("Construction") == 32), "Right number of construction: {}".format(aPart.size("Construction")) -assert(aPart.size("Bodies") == 24), "Right number of construction: {}".format(aPart.size("Bodies")) -assert(aPart.size("Groups") == 10), "Right number of construction: {}".format(aPart.size("Groups")) -assert(aPart.size("Folders") == 13), "Wrong number of folders: {}".format(aPart.size("Folders")) +assert aPart.size("Construction") == 32, "Right number of construction: {}".format( + aPart.size("Construction") +) +assert aPart.size("Bodies") == 24, "Right number of construction: {}".format( + aPart.size("Bodies") +) +assert aPart.size("Groups") == 10, "Right number of construction: {}".format( + aPart.size("Groups") +) +assert aPart.size("Folders") == 13, "Wrong number of folders: {}".format( + aPart.size("Folders") +) diff --git a/src/PythonAddons/Test/TestpipeNetwork_2par2.py b/src/PythonAddons/Test/TestpipeNetwork_2par2.py index e48905f78..4a8aa199a 100755 --- a/src/PythonAddons/Test/TestpipeNetwork_2par2.py +++ b/src/PythonAddons/Test/TestpipeNetwork_2par2.py @@ -26,11 +26,15 @@ from ModelAPI import * aSession = ModelAPI_Session.get() + def getFilePath(fileName): """Le fichier décrivant le réseau""" - path = os.path.join(os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "macros", "pipeNetwork") + path = os.path.join( + os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "macros", "pipeNetwork" + ) return os.path.join(path, fileName) + theFile = getFilePath("pipeNetwork_2par2.txt") aSession.startOperation("Create part for pipe network") @@ -46,6 +50,10 @@ aFile = anImportFeature.string(aFieldName) aFile.setValue(theFile) aSession.finishOperation() -assert(aPart.size("Construction") == 42), "Right number of construction: {}".format(aPart.size("Construction")) +assert aPart.size("Construction") == 42, "Right number of construction: {}".format( + aPart.size("Construction") +) -assert(aPart.size("Folders") == 1), "Right number of folders: {}".format(aPart.size("Folders")) +assert aPart.size("Folders") == 1, "Right number of folders: {}".format( + aPart.size("Folders") +) diff --git a/src/PythonAddons/Test/TestpipeNetwork_parligne.py b/src/PythonAddons/Test/TestpipeNetwork_parligne.py index 2ed7326ce..0a77d31a0 100755 --- a/src/PythonAddons/Test/TestpipeNetwork_parligne.py +++ b/src/PythonAddons/Test/TestpipeNetwork_parligne.py @@ -26,11 +26,15 @@ from ModelAPI import * aSession = ModelAPI_Session.get() + def getFilePath(fileName): """Le fichier décrivant le réseau""" - path = os.path.join(os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "macros", "pipeNetwork") + path = os.path.join( + os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "macros", "pipeNetwork" + ) return os.path.join(path, fileName) + theFile = getFilePath("pipeNetwork_ligne.txt") aSession.startOperation("Create part for pipe network") @@ -46,6 +50,10 @@ aFile = anImportFeature.string(aFieldName) aFile.setValue(theFile) aSession.finishOperation() -assert(aPart.size("Construction") == 46), "Right number of construction: {}".format(aPart.size("Construction")) +assert aPart.size("Construction") == 46, "Right number of construction: {}".format( + aPart.size("Construction") +) -assert(aPart.size("Folders") == 1), "Right number of folders: {}".format(aPart.size("Folders")) +assert aPart.size("Folders") == 1, "Right number of folders: {}".format( + aPart.size("Folders") +) diff --git a/src/PythonAddons/__init__.py b/src/PythonAddons/__init__.py index d891abb5f..8ac9c204a 100755 --- a/src/PythonAddons/__init__.py +++ b/src/PythonAddons/__init__.py @@ -16,4 +16,4 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -"""User-defined features""" \ No newline at end of file +"""User-defined features""" diff --git a/src/PythonAddons/addons_Features.py b/src/PythonAddons/addons_Features.py index b081b7486..619d924d2 100755 --- a/src/PythonAddons/addons_Features.py +++ b/src/PythonAddons/addons_Features.py @@ -59,6 +59,7 @@ class PythonFeaturesPlugin(ModelAPI.ModelAPI_Plugin): return aFeature + # The plugin object plugin = PythonFeaturesPlugin() plugin.__disown__() diff --git a/src/PythonAddons/doc/examples/pipeNetwork.py b/src/PythonAddons/doc/examples/pipeNetwork.py index 17019580a..5f9b4d2bf 100755 --- a/src/PythonAddons/doc/examples/pipeNetwork.py +++ b/src/PythonAddons/doc/examples/pipeNetwork.py @@ -7,12 +7,13 @@ Copyright 2022 EDF __revision__ = "V02.01" -#================================================================================= +# ================================================================================= # theFile = fichier texte de la description du réseau theFile = "/home/D68518/pipeNetwork_ligne.txt" -#================================================================================= +# ================================================================================= import salome + salome.standalone() salome.salome_init() @@ -36,4 +37,4 @@ aFile.setValue(theFile) aSession.finishOperation() if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser() + salome.sg.updateObjBrowser() diff --git a/src/PythonAddons/doc/examples/rectangle/feature.py b/src/PythonAddons/doc/examples/rectangle/feature.py index 8d2aacbed..32ca1cbae 100755 --- a/src/PythonAddons/doc/examples/rectangle/feature.py +++ b/src/PythonAddons/doc/examples/rectangle/feature.py @@ -26,6 +26,7 @@ from salome.shaper import model import ModelAPI import GeomDataAPI + class SketchPlugin_Rectangle(model.Feature): """ Implementation of rectangle creation. @@ -33,7 +34,7 @@ class SketchPlugin_Rectangle(model.Feature): It produced 2 horizontal lines and 2 vertical lines connected by coincidence constraints """ -# Initializations + # Initializations def __init__(self): """x.__init__(...) initializes x; see x.__class__.__doc__ for signature""" @@ -68,19 +69,28 @@ class SketchPlugin_Rectangle(model.Feature): """Override Feature.getKind()""" return SketchPlugin_Rectangle.ID() - -# Initialization of the rectangle + # Initialization of the rectangle def initAttributes(self): """Override Feature.initAttributes()""" # Flag whether the rectangle is accessory - self.data().addAttribute(self.AUXILIARY_ID(), ModelAPI.ModelAPI_AttributeBoolean.typeId()) + self.data().addAttribute( + self.AUXILIARY_ID(), ModelAPI.ModelAPI_AttributeBoolean.typeId() + ) # Creating corners of the rectangle - self.data().addAttribute(self.START_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId()) - self.data().addAttribute(self.END_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId()) + self.data().addAttribute( + self.START_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId() + ) + self.data().addAttribute( + self.END_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId() + ) # Creating list to store lines - self.data().addAttribute(self.LINES_LIST_ID(), ModelAPI.ModelAPI_AttributeRefList.typeId()) - ModelAPI.ModelAPI_Session.get().validators().registerNotObligatory(self.getKind(), self.LINES_LIST_ID()) + self.data().addAttribute( + self.LINES_LIST_ID(), ModelAPI.ModelAPI_AttributeRefList.typeId() + ) + ModelAPI.ModelAPI_Session.get().validators().registerNotObligatory( + self.getKind(), self.LINES_LIST_ID() + ) def isMacro(self): """ @@ -89,7 +99,7 @@ class SketchPlugin_Rectangle(model.Feature): """ return True -# Edition of the rectangle + # Edition of the rectangle def execute(self): # Retrieving list of already created lines @@ -97,13 +107,13 @@ class SketchPlugin_Rectangle(model.Feature): aNbLines = aLinesList.size() if aNbLines == 1: # Create 1-4 lines to compose the rectangle - for i in range (0, 3): + for i in range(0, 3): aLine = self.__sketch.addFeature("SketchLine") aLinesList.append(aLine) self.updateLines() aNbLines = aLinesList.size() # Create constraints to keep the rectangle - for i in range (0, aNbLines): + for i in range(0, aNbLines): aLine = ModelAPI.objectToFeature(aLinesList.object(i)) # connect neighbor lines by coincidence iPrev = i - 1 @@ -120,7 +130,7 @@ class SketchPlugin_Rectangle(model.Feature): # Update coordinates of created lines self.updateLines() # Add horizontal and vertical constraint for the lines which already have result - for i in range (0, aNbLines): + for i in range(0, aNbLines): if self.__isHV[i]: continue aLine = ModelAPI.objectToFeature(aLinesList.object(i)) @@ -139,7 +149,7 @@ class SketchPlugin_Rectangle(model.Feature): if theID == self.START_ID() or theID == self.END_ID(): # Search the sketch containing this rectangle self.__sketch = None - aRefs = self.data().refsToMe(); + aRefs = self.data().refsToMe() for iter in aRefs: aFeature = ModelAPI.objectToFeature(iter.owner()) if aFeature.getKind() == "Sketch": @@ -150,26 +160,27 @@ class SketchPlugin_Rectangle(model.Feature): aNbLines = aLinesList.size() if aNbLines == 0: # Create first line to be able to create a coincidence with selected point/feature - for i in range (0, 1): + for i in range(0, 1): aLine = self.__sketch.addFeature("SketchLine") aLinesList.append(aLine) - aStartPoint = GeomDataAPI.geomDataAPI_Point2D(self.attribute(self.START_ID())) + aStartPoint = GeomDataAPI.geomDataAPI_Point2D( + self.attribute(self.START_ID()) + ) aEndPoint = GeomDataAPI.geomDataAPI_Point2D(self.attribute(self.END_ID())) if aStartPoint.isInitialized() and aEndPoint.isInitialized(): - self.updateLines() + self.updateLines() else: - self.updateStartPoint() + self.updateStartPoint() if theID == self.AUXILIARY_ID(): anAuxiliary = self.data().boolean(self.AUXILIARY_ID()).value() aLinesList = self.reflist(self.LINES_LIST_ID()) aNbLines = aLinesList.size() # Update coordinates of rectangle lines - for i in range (0, aNbLines): + for i in range(0, aNbLines): aLine = ModelAPI.objectToFeature(aLinesList.object(i)) aLine.data().boolean("Auxiliary").setValue(anAuxiliary) - def updateLines(self): # Retrieving list of already created lines aLinesList = self.reflist(self.LINES_LIST_ID()) @@ -181,11 +192,11 @@ class SketchPlugin_Rectangle(model.Feature): anAuxiliary = self.data().boolean(self.AUXILIARY_ID()).value() # Update coordinates of rectangle lines - for i in range (0, aNbLines): + for i in range(0, aNbLines): aLine = ModelAPI.objectToFeature(aLinesList.object(i)) aLineStart = GeomDataAPI.geomDataAPI_Point2D(aLine.attribute("StartPoint")) aLineEnd = GeomDataAPI.geomDataAPI_Point2D(aLine.attribute("EndPoint")) - aLineStart.setValue(aX[i-1], aY[i-1]) + aLineStart.setValue(aX[i - 1], aY[i - 1]) aLineEnd.setValue(aX[i], aY[i]) aLine.data().boolean("Auxiliary").setValue(anAuxiliary) @@ -199,7 +210,7 @@ class SketchPlugin_Rectangle(model.Feature): aY = aStartPoint.y() # Update coordinates of rectangle lines - for i in range (0, aNbLines): + for i in range(0, aNbLines): aLine = ModelAPI.objectToFeature(aLinesList.object(i)) aLineStart = GeomDataAPI.geomDataAPI_Point2D(aLine.attribute("EndPoint")) aLineStart.setValue(aX, aY) diff --git a/src/PythonAddons/macros/__init__.py b/src/PythonAddons/macros/__init__.py index 8527fc918..f1c066211 100755 --- a/src/PythonAddons/macros/__init__.py +++ b/src/PythonAddons/macros/__init__.py @@ -22,4 +22,4 @@ Such feature is not registered in the application history. Instead, only the operations it encapsulates are registered. For editing the result of such feature, the user edits the operations used in the macro-feature. -""" \ No newline at end of file +""" diff --git a/src/PythonAddons/macros/compoundVertices/__init__.py b/src/PythonAddons/macros/compoundVertices/__init__.py index 31169cdd2..b20a65e72 100755 --- a/src/PythonAddons/macros/compoundVertices/__init__.py +++ b/src/PythonAddons/macros/compoundVertices/__init__.py @@ -16,4 +16,3 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # - diff --git a/src/PythonAddons/macros/compoundVertices/feature.py b/src/PythonAddons/macros/compoundVertices/feature.py index 7230c421e..914eeac44 100755 --- a/src/PythonAddons/macros/compoundVertices/feature.py +++ b/src/PythonAddons/macros/compoundVertices/feature.py @@ -25,11 +25,11 @@ from salome.shaper import model from salome.shaper import geom import ModelAPI + class compoundVertices(model.Feature): - """Import of Construction points - """ + """Import of Construction points""" -# Feature initializations + # Feature initializations def __init__(self): """x.__init__(...) initializes x; see x.__class__.__doc__ for signature""" @@ -54,39 +54,43 @@ class compoundVertices(model.Feature): """Override Feature.getKind()""" return compoundVertices.ID() - -# Initialization of the dialog panel + # Initialization of the dialog panel def initAttributes(self): """Override Feature.initAttributes()""" # Creating the input argument of the feature - self.data().addAttribute(self.FILE_ID(), ModelAPI.ModelAPI_AttributeString.typeId()) - self.data().addAttribute(self.SEPARATOR_ID(), ModelAPI.ModelAPI_AttributeString.typeId()) + self.data().addAttribute( + self.FILE_ID(), ModelAPI.ModelAPI_AttributeString.typeId() + ) + self.data().addAttribute( + self.SEPARATOR_ID(), ModelAPI.ModelAPI_AttributeString.typeId() + ) self.lfeatures = [] self.folder = None self.separator = " " -# Execution of the Import + # Execution of the Import def execute(self): """F.execute() -- execute the Feature""" # Retrieving the user input - apath = self.string(self.FILE_ID()) + apath = self.string(self.FILE_ID()) aseparator = self.string(self.SEPARATOR_ID()).value() if aseparator: self.separator = aseparator filepath = apath.value() - if filepath != "" : + if filepath != "": part = model.activeDocument() - if self.lfeatures : + if self.lfeatures: for feature in self.lfeatures: - part.removeFeature(feature.feature()) + part.removeFeature(feature.feature()) self.lfeatures = [] model.removeFolder(self.folder) from os.path import basename + filename = basename(filepath) nameRes = "Points_" + filename @@ -98,13 +102,18 @@ class compoundVertices(model.Feature): coord = line.split(self.separator) if len(coord) != 3: return - x = float(coord[0]); y = float(coord[1]); z = float(coord[2]); - point = model.addPoint(part, x,y,z); point.execute(True); self.lfeatures.append(point) - #vertex = model.addVertex(part, [point.result()]); vertex.execute(True); self.lfeatures.append(vertex) + x = float(coord[0]) + y = float(coord[1]) + z = float(coord[2]) + point = model.addPoint(part, x, y, z) + point.execute(True) + self.lfeatures.append(point) + # vertex = model.addVertex(part, [point.result()]); vertex.execute(True); self.lfeatures.append(vertex) lVertices.append(point.result()) file.close() compound = model.addCompound(part, lVertices) - compound.execute(True); self.lfeatures.append(compound) + compound.execute(True) + self.lfeatures.append(compound) compound.result().setName(nameRes) self.folder = model.addFolder(part, self.lfeatures[0], compound) self.folder.setName(nameRes) diff --git a/src/PythonAddons/macros/importParameters/__init__.py b/src/PythonAddons/macros/importParameters/__init__.py index 31169cdd2..b20a65e72 100755 --- a/src/PythonAddons/macros/importParameters/__init__.py +++ b/src/PythonAddons/macros/importParameters/__init__.py @@ -16,4 +16,3 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # - diff --git a/src/PythonAddons/macros/importParameters/feature.py b/src/PythonAddons/macros/importParameters/feature.py index 19581ee8a..9a9b121d1 100755 --- a/src/PythonAddons/macros/importParameters/feature.py +++ b/src/PythonAddons/macros/importParameters/feature.py @@ -26,11 +26,11 @@ from salome.shaper import geom import ModelAPI import ParametersAPI + class importParameters(model.Feature): - """Import of Construction points - """ + """Import of Construction points""" -# Feature initializations + # Feature initializations def __init__(self): """x.__init__(...) initializes x; see x.__class__.__doc__ for signature""" @@ -50,48 +50,49 @@ class importParameters(model.Feature): """Override Feature.getKind()""" return importParameters.ID() - -# Initialization of the dialog panel + # Initialization of the dialog panel def initAttributes(self): """Override Feature.initAttributes()""" # Creating the input argument of the feature - self.data().addAttribute(self.FILE_ID(), ModelAPI.ModelAPI_AttributeString.typeId()) - + self.data().addAttribute( + self.FILE_ID(), ModelAPI.ModelAPI_AttributeString.typeId() + ) -# Get existing parameters names + # Get existing parameters names def existingParameters(self): - """ Returns list of already existing parameters names""" + """Returns list of already existing parameters names""" aDoc = model.activeDocument() - aNbFeatures = aDoc.numInternalFeatures(); + aNbFeatures = aDoc.numInternalFeatures() aNames = [] for i in range(aNbFeatures): - aParamFeature = aDoc.internalFeature(i); + aParamFeature = aDoc.internalFeature(i) if aParamFeature is not None: - if aParamFeature.getKind() == ParametersAPI.ParametersAPI_Parameter.ID(): + if ( + aParamFeature.getKind() + == ParametersAPI.ParametersAPI_Parameter.ID() + ): aNames.append(aParamFeature.name()) return aNames - -# Execution of the Import + # Execution of the Import def execute(self): """F.execute() -- execute the Feature""" # Retrieving the user input - apath = self.string(self.FILE_ID()) + apath = self.string(self.FILE_ID()) filepath = apath.value() - #print("filepath : ", filepath) - if filepath != "" : - + # print("filepath : ", filepath) + if filepath != "": # Creating the parameters in the current document part = model.activeDocument() aNames = self.existingParameters() with open(filepath) as file: for line in file: - defParameters = line.replace("\n","").split(' ') - if len(defParameters) == 2 : + defParameters = line.replace("\n", "").split(" ") + if len(defParameters) == 2: if defParameters[0] not in aNames: model.addParameter(part, defParameters[0], defParameters[1]) aNames.append(defParameters[0]) diff --git a/src/PythonAddons/macros/midSurface/__init__.py b/src/PythonAddons/macros/midSurface/__init__.py index cb192e2ef..4d4984a46 100755 --- a/src/PythonAddons/macros/midSurface/__init__.py +++ b/src/PythonAddons/macros/midSurface/__init__.py @@ -16,4 +16,3 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # - diff --git a/src/PythonAddons/macros/midSurface/feature.py b/src/PythonAddons/macros/midSurface/feature.py index ccecf63f0..9e7cc3a9f 100755 --- a/src/PythonAddons/macros/midSurface/feature.py +++ b/src/PythonAddons/macros/midSurface/feature.py @@ -39,10 +39,11 @@ import ModelAPI from macros.midSurface.surfaceMediane import SurfaceMediane + class midSurface(model.Feature): """Création des fibres neutres""" -# Feature initializations + # Feature initializations def __init__(self): """x.__init__(...) initializes x; see x.__class__.__doc__ for signature""" @@ -62,35 +63,36 @@ class midSurface(model.Feature): """Override Feature.getKind()""" return midSurface.ID() - -#==================================================================================== -# Initialization of the dialog panel + # ==================================================================================== + # Initialization of the dialog panel def initAttributes(self): """Override Feature.initAttributes()""" # Creating the input argument of the feature - self.data().addAttribute(self.FILE_ID(), ModelAPI.ModelAPI_AttributeString_typeId()) + self.data().addAttribute( + self.FILE_ID(), ModelAPI.ModelAPI_AttributeString_typeId() + ) -#==================================================================================== -# Execution + # ==================================================================================== + # Execution def execute(self): """F.execute() -- execute the Feature""" # Retrieving the user input - apath = self.string(self.FILE_ID()) + apath = self.string(self.FILE_ID()) filepath = apath.value() - #print("filepath : '{}'".format(filepath)) - if filepath != "" : + # print("filepath : '{}'".format(filepath)) + if filepath != "": if os.path.isfile(filepath): # print("filepath : {}".format(filepath)) # Lancement du script de création des fibres neutres l_options = list() l_options.append("-v") - #l_options.append("-vmax") - #l_options.append("-export_step") + # l_options.append("-vmax") + # l_options.append("-export_step") s_med = SurfaceMediane(l_options) - erreur, message = s_med.surf_fic_cao (filepath) + erreur, message = s_med.surf_fic_cao(filepath) del s_med if erreur: self.setError(message) diff --git a/src/PythonAddons/macros/midSurface/midSurface_1.py b/src/PythonAddons/macros/midSurface/midSurface_1.py index 14402cd72..3c2028d02 100755 --- a/src/PythonAddons/macros/midSurface/midSurface_1.py +++ b/src/PythonAddons/macros/midSurface/midSurface_1.py @@ -37,20 +37,30 @@ SketchLine_2 = Sketch_1.addLine(51, 0, 51, 150) Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_1.endPoint()) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_3 = SketchProjection_1.createdFeature() Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_3.result()) Sketch_1.setVertical(SketchLine_2.result()) Sketch_1.setLength(SketchLine_2.result(), "Hauteur") -Sketch_1.setCoincident(SketchAPI_Line(SketchLine_3).startPoint(), SketchLine_1.startPoint()) +Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_3).startPoint(), SketchLine_1.startPoint() +) ### Create SketchProjection -SketchProjection_2 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_2.createdFeature() -Sketch_1.setHorizontalDistance(SketchLine_2.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), "R_ext") +Sketch_1.setHorizontalDistance( + SketchLine_2.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), "R_ext" +) ### Create SketchProjection -SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchProjection_3 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_4 = SketchProjection_3.createdFeature() ### Create SketchArc @@ -60,9 +70,13 @@ Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.startPoint()) Sketch_1.setCoincident(SketchLine_4.result(), SketchArc_1.endPoint()) ### Create SketchProjection -SketchProjection_4 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_4 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_4.createdFeature() -Sketch_1.setVerticalDistance(SketchArc_1.center(), SketchAPI_Point(SketchPoint_2).coordinates(), "Hauteur") +Sketch_1.setVerticalDistance( + SketchArc_1.center(), SketchAPI_Point(SketchPoint_2).coordinates(), "Hauteur" +) ### Create SketchLine SketchLine_5 = Sketch_1.addLine(0, 0, 0, 0.5) @@ -106,23 +120,42 @@ Sketch_1.setHorizontal(SketchLine_10.result()) model.do() ### Create Revolution -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection("EDGE", "PartSet/OZ"), 360, 0, "Faces") +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_1")], + model.selection("EDGE", "PartSet/OZ"), + 360, + 0, + "Faces", +) ### Create Box Box_1 = model.addBox(Part_1_doc, "R_ext*1.2", "R_ext*.2", "Hauteur*0.5") ### Create Translation -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "all-in-Box_1")], vector = ["R_ext*0.15", "-R_ext*0.1", "Hauteur*0.9"], keepSubResults = True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Box_1")], + vector=["R_ext*0.15", "-R_ext*0.1", "Hauteur*0.9"], + keepSubResults=True, +) ### Create Cut -Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "all-in-Revolution_1")], [model.selection("COMPOUND", "all-in-Translation_1")], keepSubResults = True) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Revolution_1")], + [model.selection("COMPOUND", "all-in-Translation_1")], + keepSubResults=True, +) Cut_1.result().setName(nom_objet) ### Exportation -print ("Exportation dans {}".format(fichier)) -export = model.exportToFile(Part_1_doc, fichier, [model.selection("COMPSOLID", nom_objet)]) +print("Exportation dans {}".format(fichier)) +export = model.exportToFile( + Part_1_doc, fichier, [model.selection("COMPSOLID", nom_objet)] +) model.end() if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser() + salome.sg.updateObjBrowser() diff --git a/src/PythonAddons/macros/midSurface/midSurface_2.py b/src/PythonAddons/macros/midSurface/midSurface_2.py index 7f8dd5226..e9ad73693 100755 --- a/src/PythonAddons/macros/midSurface/midSurface_2.py +++ b/src/PythonAddons/macros/midSurface/midSurface_2.py @@ -18,26 +18,26 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() -model.addParameter(partSet, "H", '24') -model.addParameter(partSet, "L", '36') -model.addParameter(partSet, "h", '2') -model.addParameter(partSet, "theta_1", '45') -model.addParameter(partSet, "C_x", '30') -model.addParameter(partSet, "DX", '90') -model.addParameter(partSet, "C_y", '40') -model.addParameter(partSet, "R_int", '50', 'Rayon interne') -model.addParameter(partSet, "R_ext", '51', 'Rayon externe') -model.addParameter(partSet, "R_1", '15') -model.addParameter(partSet, "R_2", '20') -model.addParameter(partSet, "R_3", '5') -model.addParameter(partSet, "theta_2", '60') -model.addParameter(partSet, "B_1", '6') -model.addParameter(partSet, "Ep", '0.5', 'Epaisseur') -model.addParameter(partSet, "Hauteur", '150.', 'Hauteur') -model.addParameter(partSet, "coeff", '0.00001', 'Coefficient') +model.addParameter(partSet, "H", "24") +model.addParameter(partSet, "L", "36") +model.addParameter(partSet, "h", "2") +model.addParameter(partSet, "theta_1", "45") +model.addParameter(partSet, "C_x", "30") +model.addParameter(partSet, "DX", "90") +model.addParameter(partSet, "C_y", "40") +model.addParameter(partSet, "R_int", "50", "Rayon interne") +model.addParameter(partSet, "R_ext", "51", "Rayon externe") +model.addParameter(partSet, "R_1", "15") +model.addParameter(partSet, "R_2", "20") +model.addParameter(partSet, "R_3", "5") +model.addParameter(partSet, "theta_2", "60") +model.addParameter(partSet, "B_1", "6") +model.addParameter(partSet, "Ep", "0.5", "Epaisseur") +model.addParameter(partSet, "Hauteur", "150.", "Hauteur") +model.addParameter(partSet, "coeff", "0.00001", "Coefficient") # 1. Deux solides plans minces -#============================= +# ============================= ### Create Part Part_1 = model.addPart(partSet) @@ -50,16 +50,22 @@ Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(0, 0, 48, 0) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) +Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates() +) ### Create SketchLine SketchLine_2 = Sketch_1.addLine(48, 0, 103.7207793864215, 55.72077938642148) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) ### Create SketchLine -SketchLine_3 = Sketch_1.addLine(103.7207793864215, 55.72077938642148, 78.26493526370577, 81.17662350913719) +SketchLine_3 = Sketch_1.addLine( + 103.7207793864215, 55.72077938642148, 78.26493526370577, 81.17662350913719 +) Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) ### Create SketchLine @@ -77,11 +83,15 @@ Sketch_1.setLength(SketchLine_1.result(), "2*H") Sketch_1.setEqual(SketchLine_2.result(), SketchLine_4.result()) ### Create SketchProjection -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_6 = SketchProjection_2.createdFeature() ### Create SketchConstraintAngle -Sketch_1.setAngle(SketchLine_6.result(), SketchLine_2.result(), "theta_1", type = "Direct") +Sketch_1.setAngle( + SketchLine_6.result(), SketchLine_2.result(), "theta_1", type="Direct" +) Sketch_1.setPerpendicular(SketchLine_2.result(), SketchLine_3.result()) Sketch_1.setLength(SketchLine_3.result(), "L") @@ -92,11 +102,15 @@ Sketch_1.setHorizontal(SketchLine_7.result()) Sketch_1.setLength(SketchLine_7.result(), "4*H") ### Create SketchLine -SketchLine_8 = Sketch_1.addLine(-96, 4.800000000000001, -4.800000000000001, 4.800000000000001) +SketchLine_8 = Sketch_1.addLine( + -96, 4.800000000000001, -4.800000000000001, 4.800000000000001 +) Sketch_1.setHorizontal(SketchLine_8.result()) ### Create SketchLine -SketchLine_9 = Sketch_1.addLine(-4.800000000000001, 4.800000000000001, -4.800000000000001, 72) +SketchLine_9 = Sketch_1.addLine( + -4.800000000000001, 4.800000000000001, -4.800000000000001, 72 +) Sketch_1.setVertical(SketchLine_9.result()) Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) @@ -118,7 +132,14 @@ Sketch_1.setName("Objet_2_Sketch") Sketch_1.result().setName("Objet_2_Sketch") ### Create Extrusion -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Objet_2_Sketch")], model.selection(), "h", 0, "Faces|Wires") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Objet_2_Sketch")], + model.selection(), + "h", + 0, + "Faces|Wires", +) Extrusion_1.setName("Objet_2") Extrusion_1.result().setName("Objet_2") Extrusion_1.result().subResult(0).setName("Extrusion_1_1_1") @@ -126,7 +147,7 @@ Extrusion_1.result().subResult(1).setName("Extrusion_1_1_2") model.do() # 2. Un cylindre découpé -#======================= +# ======================= ### Create Part Part_2 = model.addPart(partSet) @@ -140,10 +161,16 @@ SketchCircle_1 = Sketch_2.addCircle(30, 40, 50) Sketch_2.setRadius(SketchCircle_1.results()[1], "R_int") ### Create SketchProjection -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_3.createdFeature() -Sketch_2.setHorizontalDistance(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_2).coordinates(), "C_x") -Sketch_2.setVerticalDistance(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_2).coordinates(), "C_y") +Sketch_2.setHorizontalDistance( + SketchCircle_1.center(), SketchAPI_Point(SketchPoint_2).coordinates(), "C_x" +) +Sketch_2.setVerticalDistance( + SketchCircle_1.center(), SketchAPI_Point(SketchPoint_2).coordinates(), "C_y" +) ### Create SketchCircle SketchCircle_2 = Sketch_2.addCircle(30, 40, 51) @@ -154,20 +181,36 @@ Sketch_2.setName("Objet_6_base_Sketch") Sketch_2.result().setName("Objet_6_base_Sketch") ### Create Extrusion -Extrusion_2 = model.addExtrusion(Part_2_doc, [model.selection("COMPOUND", "all-in-Objet_6_base_Sketch")], model.selection(), "DX", 0, "Faces|Wires") +Extrusion_2 = model.addExtrusion( + Part_2_doc, + [model.selection("COMPOUND", "all-in-Objet_6_base_Sketch")], + model.selection(), + "DX", + 0, + "Faces|Wires", +) Extrusion_2.setName("Objet_6_base_Extrusion") Extrusion_2.result().setName("Objet_6_base_Extrusion") Extrusion_2.result().subResult(0).setName("Objet_6_base_Extrusion_1") Extrusion_2.result().subResult(1).setName("Objet_6_base_Extrusion_2") ### Create Remove_SubShapes -Remove_SubShapes_1 = model.addRemoveSubShapes(Part_2_doc, model.selection("COMPSOLID", "Objet_6_base_Extrusion")) -Remove_SubShapes_1.setSubShapesToKeep([model.selection("SOLID", "Objet_6_base_Extrusion_2")]) +Remove_SubShapes_1 = model.addRemoveSubShapes( + Part_2_doc, model.selection("COMPSOLID", "Objet_6_base_Extrusion") +) +Remove_SubShapes_1.setSubShapesToKeep( + [model.selection("SOLID", "Objet_6_base_Extrusion_2")] +) Remove_SubShapes_1.setName("Objet_6_base_RemoveSubShapes") Remove_SubShapes_1.result().setName("Objet_6_base") ### Create Translation -Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Objet_6_base")], vector = ["H", "L", "H+L"], keepSubResults = True) +Translation_1 = model.addTranslation( + Part_2_doc, + [model.selection("SOLID", "Objet_6_base")], + vector=["H", "L", "H+L"], + keepSubResults=True, +) Translation_1.setName("Objet_6_Translation") Translation_1.result().setName("Objet_6_Translation") @@ -182,12 +225,22 @@ Point_3.setName("Objet_6_Point_2") Point_3.result().setName("Objet_6_Point_2") ### Create Axis -Axis_4 = model.addAxis(Part_2_doc, model.selection("VERTEX", "Objet_6_Point_1"), model.selection("VERTEX", "Objet_6_Point_2")) +Axis_4 = model.addAxis( + Part_2_doc, + model.selection("VERTEX", "Objet_6_Point_1"), + model.selection("VERTEX", "Objet_6_Point_2"), +) Axis_4.setName("Objet_6_Axe") Axis_4.result().setName("Objet_6_Axe") ### Create Rotation -Rotation_1 = model.addRotation(Part_2_doc, [model.selection("SOLID", "Objet_6_Translation")], axis = model.selection("EDGE", "Objet_6_Axe"), angle = 30, keepSubResults = True) +Rotation_1 = model.addRotation( + Part_2_doc, + [model.selection("SOLID", "Objet_6_Translation")], + axis=model.selection("EDGE", "Objet_6_Axe"), + angle=30, + keepSubResults=True, +) Rotation_1.setName("Objet_6_Rotation") Rotation_1.result().setName("Objet_6_Rotation") @@ -198,15 +251,21 @@ Sketch_3 = model.addSketch(Part_2_doc, model.standardPlane("XOY")) SketchLine_12 = Sketch_3.addLine(36, 120, 59.99999999999999, 78.43078061834694) ### Create SketchLine -SketchLine_13 = Sketch_3.addLine(59.99999999999999, 78.43078061834694, 80.78460969082653, 90.43078061834694) +SketchLine_13 = Sketch_3.addLine( + 59.99999999999999, 78.43078061834694, 80.78460969082653, 90.43078061834694 +) Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) ### Create SketchLine -SketchLine_14 = Sketch_3.addLine(80.78460969082653, 90.43078061834694, 104.7846096908265, 48.86156123669388) +SketchLine_14 = Sketch_3.addLine( + 80.78460969082653, 90.43078061834694, 104.7846096908265, 48.86156123669388 +) Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) ### Create SketchLine -SketchLine_15 = Sketch_3.addLine(104.7846096908265, 48.86156123669388, 60.37400840781982, 30.64896961216652) +SketchLine_15 = Sketch_3.addLine( + 104.7846096908265, 48.86156123669388, 60.37400840781982, 30.64896961216652 +) Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) ### Create SketchLine @@ -225,27 +284,47 @@ Sketch_3.setPerpendicular(SketchLine_13.result(), SketchLine_12.result()) Sketch_3.setEqual(SketchLine_14.result(), SketchLine_16.result()) ### Create SketchProjection -SketchProjection_4 = Sketch_3.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_4 = Sketch_3.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_3 = SketchProjection_4.createdFeature() -Sketch_3.setHorizontalDistance(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_16.endPoint(), "L") -Sketch_3.setVerticalDistance(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_16.endPoint(), "2*L") +Sketch_3.setHorizontalDistance( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_16.endPoint(), "L" +) +Sketch_3.setVerticalDistance( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_16.endPoint(), "2*L" +) Sketch_3.setLength(SketchLine_14.result(), "2.*H") Sketch_3.setLength(SketchLine_13.result(), "H") ### Create SketchConstraintAngle -Sketch_3.setAngle(SketchLine_17.result(), SketchLine_12.result(), 30, type = "Direct") +Sketch_3.setAngle(SketchLine_17.result(), SketchLine_12.result(), 30, type="Direct") Sketch_3.setLength(SketchLine_15.result(), "2.*H") model.do() Sketch_3.setName("Objet_6_Sketch_bloc_a") Sketch_3.result().setName("Objet_6_Sketch_bloc_a") ### Create Extrusion -Extrusion_3 = model.addExtrusion(Part_2_doc, [model.selection("COMPOUND", "Objet_6_Sketch_bloc_a")], model.selection(), 200, 100, "Faces|Wires") +Extrusion_3 = model.addExtrusion( + Part_2_doc, + [model.selection("COMPOUND", "Objet_6_Sketch_bloc_a")], + model.selection(), + 200, + 100, + "Faces|Wires", +) Extrusion_3.setName("Objet_6_a") Extrusion_3.result().setName("Objet_6_a") ### Create Common -Common_1 = model.addCommon(Part_2_doc, [model.selection("SOLID", "Objet_6_Rotation"), model.selection("SOLID", "Objet_6_a")], keepSubResults = True) +Common_1 = model.addCommon( + Part_2_doc, + [ + model.selection("SOLID", "Objet_6_Rotation"), + model.selection("SOLID", "Objet_6_a"), + ], + keepSubResults=True, +) Common_1.setName("Objet_6") Common_1.result().setName("Objet_6") Common_1.result().subResult(0).setName("Common_1_1_1") @@ -256,24 +335,41 @@ Folder_1.setName("Objet_6_création") model.do() # 3. Un tore découpé -#=================== +# =================== ### Create Part Part_3 = model.addPart(partSet) Part_3_doc = Part_3.document() ### Create Torus -Torus_1 = model.addTorus(Part_3_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R_2", "R_3") +Torus_1 = model.addTorus( + Part_3_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "R_2", + "R_3", +) Torus_1.setName("Objet_8_Tore_1") Torus_1.result().setName("Objet_8_Tore_1") ### Create Torus -Torus_2 = model.addTorus(Part_3_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R_2", "R_3-h") +Torus_2 = model.addTorus( + Part_3_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "R_2", + "R_3-h", +) Torus_2.setName("Objet_8_Tore_2") Torus_2.result().setName("Objet_8_Tore_2") ### Create Cut -Cut_1 = model.addCut(Part_3_doc, [model.selection("SOLID", "Objet_8_Tore_1")], [model.selection("SOLID", "Objet_8_Tore_2")], keepSubResults = True) +Cut_1 = model.addCut( + Part_3_doc, + [model.selection("SOLID", "Objet_8_Tore_1")], + [model.selection("SOLID", "Objet_8_Tore_2")], + keepSubResults=True, +) Cut_1.setName("Objet_8_Cut") Cut_1.result().setName("Objet_8_Cut") @@ -294,11 +390,15 @@ SketchLine_20 = Sketch_4.addLine(6, 5, 31.05255888325765, -9.464101615137745) Sketch_4.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) ### Create SketchLine -SketchLine_21 = Sketch_4.addLine(31.05255888325765, -9.464101615137745, 25.05255888325765, -19.85640646055101) +SketchLine_21 = Sketch_4.addLine( + 31.05255888325765, -9.464101615137745, 25.05255888325765, -19.85640646055101 +) Sketch_4.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) ### Create SketchLine -SketchLine_22 = Sketch_4.addLine(25.05255888325765, -19.85640646055101, 6, -8.856406460550954) +SketchLine_22 = Sketch_4.addLine( + 25.05255888325765, -19.85640646055101, 6, -8.856406460550954 +) Sketch_4.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint()) ### Create SketchLine @@ -312,7 +412,9 @@ Sketch_4.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) Sketch_4.setHorizontal(SketchLine_24.result()) ### Create SketchProjection -SketchProjection_5 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_5 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_25 = SketchProjection_5.createdFeature() Sketch_4.setCoincident(SketchLine_18.startPoint(), SketchLine_25.result()) Sketch_4.setCoincident(SketchLine_24.endPoint(), SketchLine_25.result()) @@ -321,33 +423,68 @@ Sketch_4.setPerpendicular(SketchLine_20.result(), SketchLine_21.result()) Sketch_4.setPerpendicular(SketchLine_22.result(), SketchLine_21.result()) ### Create SketchConstraintAngle -Sketch_4.setAngle(SketchLine_23.result(), SketchLine_22.result(), "theta_2", type = "Direct") +Sketch_4.setAngle( + SketchLine_23.result(), SketchLine_22.result(), "theta_2", type="Direct" +) Sketch_4.setLength(SketchLine_18.result(), "B_1") Sketch_4.setLength(SketchLine_21.result(), "2.*B_1") ### Create SketchProjection -SketchProjection_6 = Sketch_4.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_6 = Sketch_4.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_4 = SketchProjection_6.createdFeature() -Sketch_4.setVerticalDistance(SketchLine_20.startPoint(), SketchAPI_Point(SketchPoint_4).coordinates(), "R_2/4.") +Sketch_4.setVerticalDistance( + SketchLine_20.startPoint(), SketchAPI_Point(SketchPoint_4).coordinates(), "R_2/4." +) Sketch_4.setLength(SketchLine_22.result(), "1.1*R_2") Sketch_4.setLength(SketchLine_23.result(), "R_2") Sketch_4.setEqual(SketchLine_20.result(), SketchLine_19.result()) ### Create SketchConstraintMirror -SketchConstraintMirror_1_objects = [SketchLine_24.result(), SketchLine_23.result(), SketchLine_18.result(), SketchLine_19.result(), SketchLine_21.result(), SketchLine_20.result(), SketchLine_22.result()] -SketchConstraintMirror_1 = Sketch_4.addMirror(SketchLine_25.result(), SketchConstraintMirror_1_objects) -[SketchLine_26, SketchLine_27, SketchLine_28, SketchLine_29, SketchLine_30, SketchLine_31, SketchLine_32] = SketchConstraintMirror_1.mirrored() +SketchConstraintMirror_1_objects = [ + SketchLine_24.result(), + SketchLine_23.result(), + SketchLine_18.result(), + SketchLine_19.result(), + SketchLine_21.result(), + SketchLine_20.result(), + SketchLine_22.result(), +] +SketchConstraintMirror_1 = Sketch_4.addMirror( + SketchLine_25.result(), SketchConstraintMirror_1_objects +) +[ + SketchLine_26, + SketchLine_27, + SketchLine_28, + SketchLine_29, + SketchLine_30, + SketchLine_31, + SketchLine_32, +] = SketchConstraintMirror_1.mirrored() model.do() Sketch_4.setName("Objet_8_Sketch_bloc_b") Sketch_4.result().setName("Objet_8_Sketch_bloc_b") ### Create Extrusion -Extrusion_4 = model.addExtrusion(Part_3_doc, [model.selection("COMPOUND", "Objet_8_Sketch_bloc_b")], model.selection(), "4.*R_3", "4.*R_3", "Faces|Wires") +Extrusion_4 = model.addExtrusion( + Part_3_doc, + [model.selection("COMPOUND", "Objet_8_Sketch_bloc_b")], + model.selection(), + "4.*R_3", + "4.*R_3", + "Faces|Wires", +) Extrusion_4.setName("Objet_8_b") Extrusion_4.result().setName("Objet_8_b") ### Create Common -Common_2 = model.addCommon(Part_3_doc, [model.selection("SOLID", "Objet_8_Cut"), model.selection("SOLID", "Objet_8_b")], keepSubResults = True) +Common_2 = model.addCommon( + Part_3_doc, + [model.selection("SOLID", "Objet_8_Cut"), model.selection("SOLID", "Objet_8_b")], + keepSubResults=True, +) Common_2.setName("Objet_8_Common") Common_2.result().setName("Objet_8_Common") Common_2.result().subResult(0).setName("Common_1_1_1") @@ -366,12 +503,22 @@ Point_5.setName("Objet_8_Point_2") Point_5.result().setName("Objet_8_Point_2") ### Create Axis -Axis_5 = model.addAxis(Part_3_doc, model.selection("VERTEX", "Objet_8_Point_1"), model.selection("VERTEX", "Objet_8_Point_2")) +Axis_5 = model.addAxis( + Part_3_doc, + model.selection("VERTEX", "Objet_8_Point_1"), + model.selection("VERTEX", "Objet_8_Point_2"), +) Axis_5.setName("Objet_8_Axe") Axis_5.result().setName("Objet_8_Axe") ### Create Rotation -Rotation_2 = model.addRotation(Part_3_doc, [model.selection("COMPOUND", "Objet_8_Common")], axis = model.selection("EDGE", "Objet_8_Axe"), angle = 45, keepSubResults = True) +Rotation_2 = model.addRotation( + Part_3_doc, + [model.selection("COMPOUND", "Objet_8_Common")], + axis=model.selection("EDGE", "Objet_8_Axe"), + angle=45, + keepSubResults=True, +) Rotation_2.setName("Objet_8") Rotation_2.result().setName("Objet_8") Rotation_2.result().subResult(0).setName("Rotation_1_1_1") @@ -384,24 +531,43 @@ Folder_2.setName("Objet_8_création") model.do() # 4. Un cône découpé -#=================== +# =================== ### Create Part Part_4 = model.addPart(partSet) Part_4_doc = Part_4.document() ### Create Cone -Cone_1 = model.addCone(Part_4_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R_2", "R_3", "DX") +Cone_1 = model.addCone( + Part_4_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "R_2", + "R_3", + "DX", +) Cone_1.setName("Objet_9_Cone_1") Cone_1.result().setName("Objet_9_Cone_1") ### Create Cone -Cone_2 = model.addCone(Part_4_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R_2-h", "R_3-h", "DX") +Cone_2 = model.addCone( + Part_4_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "R_2-h", + "R_3-h", + "DX", +) Cone_2.setName("Objet_9_Cone_2") Cone_2.result().setName("Objet_9_Cone_2") ### Create Cut -Cut_2 = model.addCut(Part_4_doc, [model.selection("SOLID", "Objet_9_Cone_1")], [model.selection("SOLID", "Objet_9_Cone_2")], keepSubResults = True) +Cut_2 = model.addCut( + Part_4_doc, + [model.selection("SOLID", "Objet_9_Cone_1")], + [model.selection("SOLID", "Objet_9_Cone_2")], + keepSubResults=True, +) Cut_2.setName("Objet_9_Cut") Cut_2.result().setName("Objet_9_Cut") @@ -422,11 +588,15 @@ SketchLine_35 = Sketch_5.addLine(6, 5, 31.05255888325765, -9.464101615137745) Sketch_5.setCoincident(SketchLine_34.endPoint(), SketchLine_35.startPoint()) ### Create SketchLine -SketchLine_36 = Sketch_5.addLine(31.05255888325765, -9.464101615137745, 25.05255888325765, -19.85640646055101) +SketchLine_36 = Sketch_5.addLine( + 31.05255888325765, -9.464101615137745, 25.05255888325765, -19.85640646055101 +) Sketch_5.setCoincident(SketchLine_35.endPoint(), SketchLine_36.startPoint()) ### Create SketchLine -SketchLine_37 = Sketch_5.addLine(25.05255888325765, -19.85640646055101, 6, -8.856406460550954) +SketchLine_37 = Sketch_5.addLine( + 25.05255888325765, -19.85640646055101, 6, -8.856406460550954 +) Sketch_5.setCoincident(SketchLine_36.endPoint(), SketchLine_37.startPoint()) ### Create SketchLine @@ -440,7 +610,9 @@ Sketch_5.setCoincident(SketchLine_38.endPoint(), SketchLine_39.startPoint()) Sketch_5.setHorizontal(SketchLine_39.result()) ### Create SketchProjection -SketchProjection_7 = Sketch_5.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_7 = Sketch_5.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_40 = SketchProjection_7.createdFeature() Sketch_5.setCoincident(SketchLine_33.startPoint(), SketchLine_40.result()) Sketch_5.setCoincident(SketchLine_39.endPoint(), SketchLine_40.result()) @@ -449,38 +621,79 @@ Sketch_5.setPerpendicular(SketchLine_35.result(), SketchLine_36.result()) Sketch_5.setPerpendicular(SketchLine_37.result(), SketchLine_36.result()) ### Create SketchConstraintAngle -Sketch_5.setAngle(SketchLine_38.result(), SketchLine_37.result(), "theta_2", type = "Direct") +Sketch_5.setAngle( + SketchLine_38.result(), SketchLine_37.result(), "theta_2", type="Direct" +) Sketch_5.setLength(SketchLine_33.result(), "B_1") Sketch_5.setLength(SketchLine_36.result(), "2.*B_1") ### Create SketchProjection -SketchProjection_8 = Sketch_5.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_8 = Sketch_5.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_5 = SketchProjection_8.createdFeature() -Sketch_5.setVerticalDistance(SketchLine_35.startPoint(), SketchAPI_Point(SketchPoint_5).coordinates(), "R_2/4.") +Sketch_5.setVerticalDistance( + SketchLine_35.startPoint(), SketchAPI_Point(SketchPoint_5).coordinates(), "R_2/4." +) Sketch_5.setLength(SketchLine_37.result(), "1.1*R_2") Sketch_5.setLength(SketchLine_38.result(), "R_2") Sketch_5.setEqual(SketchLine_35.result(), SketchLine_34.result()) ### Create SketchConstraintMirror -SketchConstraintMirror_2_objects = [SketchLine_39.result(), SketchLine_38.result(), SketchLine_33.result(), SketchLine_34.result(), SketchLine_36.result(), SketchLine_35.result(), SketchLine_37.result()] -SketchConstraintMirror_2 = Sketch_5.addMirror(SketchLine_40.result(), SketchConstraintMirror_2_objects) -[SketchLine_41, SketchLine_42, SketchLine_43, SketchLine_44, SketchLine_45, SketchLine_46, SketchLine_47] = SketchConstraintMirror_2.mirrored() +SketchConstraintMirror_2_objects = [ + SketchLine_39.result(), + SketchLine_38.result(), + SketchLine_33.result(), + SketchLine_34.result(), + SketchLine_36.result(), + SketchLine_35.result(), + SketchLine_37.result(), +] +SketchConstraintMirror_2 = Sketch_5.addMirror( + SketchLine_40.result(), SketchConstraintMirror_2_objects +) +[ + SketchLine_41, + SketchLine_42, + SketchLine_43, + SketchLine_44, + SketchLine_45, + SketchLine_46, + SketchLine_47, +] = SketchConstraintMirror_2.mirrored() model.do() Sketch_5.setName("Objet_9_Sketch_bloc_b") Sketch_5.result().setName("Objet_9_Sketch_bloc_b") ### Create Extrusion -Extrusion_5 = model.addExtrusion(Part_4_doc, [model.selection("COMPOUND", "Objet_9_Sketch_bloc_b")], model.selection(), "4.*R_3", "4.*R_3", "Faces|Wires") +Extrusion_5 = model.addExtrusion( + Part_4_doc, + [model.selection("COMPOUND", "Objet_9_Sketch_bloc_b")], + model.selection(), + "4.*R_3", + "4.*R_3", + "Faces|Wires", +) Extrusion_5.setName("Objet_9_b") Extrusion_5.result().setName("Objet_9_b") ### Create Rotation -Rotation_3 = model.addRotation(Part_4_doc, [model.selection("SOLID", "Objet_9_b")], axis = model.selection("EDGE", "PartSet/OX"), angle = 10, keepSubResults = True) +Rotation_3 = model.addRotation( + Part_4_doc, + [model.selection("SOLID", "Objet_9_b")], + axis=model.selection("EDGE", "PartSet/OX"), + angle=10, + keepSubResults=True, +) Rotation_3.setName("Objet_9_b_1") Rotation_3.result().setName("Objet_9_b_1") ### Create Common -Common_3 = model.addCommon(Part_4_doc, [model.selection("SOLID", "Objet_9_Cut"), model.selection("SOLID", "Objet_9_b_1")], keepSubResults = True) +Common_3 = model.addCommon( + Part_4_doc, + [model.selection("SOLID", "Objet_9_Cut"), model.selection("SOLID", "Objet_9_b_1")], + keepSubResults=True, +) Common_3.setName("Objet_9_Common") Common_3.result().setName("Objet_9_Common") Common_3.result().subResult(0).setName("Common_1_1_1") @@ -489,7 +702,13 @@ Common_3.result().subResult(2).setName("Common_1_1_3") Common_3.result().subResult(3).setName("Common_1_1_4") ### Create Translation -Translation_2 = model.addTranslation(Part_4_doc, [model.selection("COMPOUND", "all-in-Objet_9_Common")], axis = model.selection("EDGE", "PartSet/OZ"), distance = "-2*R_2", keepSubResults = True) +Translation_2 = model.addTranslation( + Part_4_doc, + [model.selection("COMPOUND", "all-in-Objet_9_Common")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance="-2*R_2", + keepSubResults=True, +) Translation_2.setName("Objet_9_Common") Translation_2.result().setName("Objet_9_Common") Translation_2.result().subResult(0).setName("Translation_1_1_1") @@ -509,12 +728,22 @@ Point_7.setName("Objet_9_Point_2") Point_7.result().setName("Objet_9_Point_2") ### Create Axis -Axis_6 = model.addAxis(Part_4_doc, model.selection("VERTEX", "Objet_9_Point_1"), model.selection("VERTEX", "Objet_9_Point_2")) +Axis_6 = model.addAxis( + Part_4_doc, + model.selection("VERTEX", "Objet_9_Point_1"), + model.selection("VERTEX", "Objet_9_Point_2"), +) Axis_6.setName("Objet_9_Axe") Axis_6.result().setName("Objet_9_Axe") ### Create Rotation -Rotation_4 = model.addRotation(Part_4_doc, [model.selection("COMPOUND", "Objet_9_Common")], axis = model.selection("EDGE", "Objet_9_Axe"), angle = 45, keepSubResults = True) +Rotation_4 = model.addRotation( + Part_4_doc, + [model.selection("COMPOUND", "Objet_9_Common")], + axis=model.selection("EDGE", "Objet_9_Axe"), + angle=45, + keepSubResults=True, +) Rotation_4.setName("Objet_9") Rotation_4.result().setName("Objet_9") Rotation_4.result().subResult(0).setName("Rotation_2_1_1") @@ -528,32 +757,38 @@ Folder_3.setName("Objet_9_création") model.do() # 5. Assemblage des composants -#============================= +# ============================= ### Create Part Part_5 = model.addPart(partSet) Part_5_doc = Part_5.document() ### Create ImportResult -ImportResult_1_objects = [model.selection("COMPOUND", "Part_4/Objet_9"), - model.selection("COMPOUND", "Part_3/Objet_8"), - model.selection("COMPOUND", "Part_2/Objet_6"), - model.selection("COMPSOLID", "Part_1/Objet_2")] +ImportResult_1_objects = [ + model.selection("COMPOUND", "Part_4/Objet_9"), + model.selection("COMPOUND", "Part_3/Objet_8"), + model.selection("COMPOUND", "Part_2/Objet_6"), + model.selection("COMPSOLID", "Part_1/Objet_2"), +] ImportResult_1 = model.addImportResult(Part_5_doc, ImportResult_1_objects) ### Create Partition -Partition_1_objects = [model.selection("COMPOUND", "ImportResult_1_1"), - model.selection("COMPOUND", "ImportResult_1_2"), - model.selection("COMPOUND", "ImportResult_1_3"), - model.selection("COMPSOLID", "ImportResult_1_4")] -Partition_1 = model.addPartition(Part_5_doc, Partition_1_objects, keepSubResults = True) +Partition_1_objects = [ + model.selection("COMPOUND", "ImportResult_1_1"), + model.selection("COMPOUND", "ImportResult_1_2"), + model.selection("COMPOUND", "ImportResult_1_3"), + model.selection("COMPSOLID", "ImportResult_1_4"), +] +Partition_1 = model.addPartition(Part_5_doc, Partition_1_objects, keepSubResults=True) Partition_1.result().setName(nom_objet) ### Exportation -print ("Exportation dans {}".format(fichier)) -export = model.exportToFile(Part_5_doc, fichier, [model.selection("COMPSOLID", nom_objet)]) +print("Exportation dans {}".format(fichier)) +export = model.exportToFile( + Part_5_doc, fichier, [model.selection("COMPSOLID", nom_objet)] +) model.end() if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser() + salome.sg.updateObjBrowser() diff --git a/src/PythonAddons/macros/midSurface/surfaceMediane.py b/src/PythonAddons/macros/midSurface/surfaceMediane.py index 04990d102..0890cd2d1 100755 --- a/src/PythonAddons/macros/midSurface/surfaceMediane.py +++ b/src/PythonAddons/macros/midSurface/surfaceMediane.py @@ -38,7 +38,7 @@ Gérald NICOLAS __revision__ = "V11.27" -#========================= Les imports - Début =================================== +# ========================= Les imports - Début =================================== import os import tempfile @@ -56,13 +56,13 @@ from GeomAlgoAPI import * import numpy as np -#========================== Les imports - Fin ==================================== +# ========================== Les imports - Fin ==================================== D_FMT = dict() D_FMT["stp"] = ["stp", "step"] D_FMT["igs"] = ["igs", "iges"] for CLE in ("brep", "xao"): - D_FMT[CLE] = [CLE] + D_FMT[CLE] = [CLE] # statut = 0 si pas encore traité, 1 si traité avec succès, 2 si trop mince, -1 si pas assez mince, -2 si impossible. D_COLOR_R = dict() @@ -88,217 +88,224 @@ TRANSPARENCE = 0.7 # Limite basse de l'épaisseur pour pouvoir faire les intersections EP_MIN = 0.0001 -#EP_MIN = 0.1 -#========================= Début de la fonction ================================== +# EP_MIN = 0.1 +# ========================= Début de la fonction ================================== -def decode_cao (fmt_cao): - """Décode le format de la cao -Entrées : - :fmt_cao: format du fichier, step, iges, etc. -Sorties : - :fmt_cao_0: format décodé -""" +def decode_cao(fmt_cao): + """Décode le format de la cao - fmt_cao_0 = "" + Entrées : + :fmt_cao: format du fichier, step, iges, etc. + Sorties : + :fmt_cao_0: format décodé""" - fmt_cao_low = fmt_cao.lower() + fmt_cao_0 = "" - for cle, l_aux in D_FMT.items(): - if ( fmt_cao_low in l_aux ): - fmt_cao_0 = cle - break + fmt_cao_low = fmt_cao.lower() - return fmt_cao_0 + for cle, l_aux in D_FMT.items(): + if fmt_cao_low in l_aux: + fmt_cao_0 = cle + break -#========================= Fin de la fonction =================================== + return fmt_cao_0 -#========================= Début de la fonction ================================== -def import_cao (part_doc, ficcao, nom_objet=None, verbose=False): - """Importation d'une cao +# ========================= Fin de la fonction =================================== -Entrées : - :part_doc: part - :ficcao: le fichier de la CAO - :nom_objet: nom à donner à l'objet lu, éventuellement -Sorties : - :objet: l'objet importé dans SHAPER -""" +# ========================= Début de la fonction ================================== - nom_fonction = __name__ + "/import_cao" - blabla = "Dans {} :\n".format(nom_fonction) - message_0 = "Fichier : {}\n".format(ficcao) - if verbose: - message = blabla + message_0 - message += "nom_objet : {}".format(nom_objet) - print (message) - message = message_0 - erreur = 0 +def import_cao(part_doc, ficcao, nom_objet=None, verbose=False): + """Importation d'une cao - objet = None + Entrées : + :part_doc: part + :ficcao: le fichier de la CAO + :nom_objet: nom à donner à l'objet lu, éventuellement + Sorties : + :objet: l'objet importé dans SHAPER""" - laux = ficcao.split(".") - fmt_cao_0 = decode_cao (laux[-1]) + nom_fonction = __name__ + "/import_cao" + blabla = "Dans {} :\n".format(nom_fonction) + message_0 = "Fichier : {}\n".format(ficcao) + if verbose: + message = blabla + message_0 + message += "nom_objet : {}".format(nom_objet) + print(message) + message = message_0 - if ( fmt_cao_0 not in ("stp", "brep", "igs", "xao") ): - message += "Le format de CAO est inconnu" - erreur = 1 + erreur = 0 - elif not ficcao: - message += "Le fichier de CAO n'a pas été décodé correctement." - erreur = 2 + objet = None - elif not os.path.isfile(ficcao): - message += "Le fichier de CAO est inconnu." - erreur = 3 + laux = ficcao.split(".") + fmt_cao_0 = decode_cao(laux[-1]) - else: + if fmt_cao_0 not in ("stp", "brep", "igs", "xao"): + message += "Le format de CAO est inconnu" + erreur = 1 - message = "" - objet = model.addImport(part_doc, ficcao) - exec_nom (objet, nom_objet) - model.do() + elif not ficcao: + message += "Le fichier de CAO n'a pas été décodé correctement." + erreur = 2 - if verbose: - texte = "Objet : '{}'\n".format(objet.result().name()) - texte += "De type : '{}'".format(objet.result().shapeType()) - print (texte) + elif not os.path.isfile(ficcao): + message += "Le fichier de CAO est inconnu." + erreur = 3 - return erreur, message, objet + else: + message = "" + objet = model.addImport(part_doc, ficcao) + exec_nom(objet, nom_objet) + model.do() -#========================= Fin de la fonction =================================== + if verbose: + texte = "Objet : '{}'\n".format(objet.result().name()) + texte += "De type : '{}'".format(objet.result().shapeType()) + print(texte) -#========================= Début de la fonction ================================== + return erreur, message, objet -def couleur_objet (objet, n_recur=0, coul_r=1, coul_g=0, coul_b=0, verbose=False): - """Appliquer une couleur à un objet et à ses sous_objets -Entrées : - :objet: objet à traiter - :n_recur: niveau de récursivité - :coul_r,coul_g,coul_b: code RGB de la couleur à appliquer +# ========================= Fin de la fonction =================================== -Sorties : - :rang: rang du sous-objet -""" +# ========================= Début de la fonction ================================== - nom_fonction = __name__ + "/couleur_objet" - blabla = "Dans {} :".format(nom_fonction) - if verbose: - print (blabla) - print_tab(n_recur, "objet : ", objet.name()) - print_tab(n_recur, "RGB = ({},{},{})".format(coul_r,coul_g,coul_b)) +def couleur_objet(objet, n_recur=0, coul_r=1, coul_g=0, coul_b=0, verbose=False): + """Appliquer une couleur à un objet et à ses sous_objets -# 1. Au premier passage, il faut garder la référence au résultat principal + Entrées : + :objet: objet à traiter + :n_recur: niveau de récursivité + :coul_r,coul_g,coul_b: code RGB de la couleur à appliquer - if ( n_recur == 0 ): - objet_0 = objet.result() - else: - objet_0 = objet + Sorties : + :rang: rang du sous-objet""" -# 2. On descend dans l'arborescence des sous-objets jusqu'à en trouver un qui n'en n'a pas + nom_fonction = __name__ + "/couleur_objet" + blabla = "Dans {} :".format(nom_fonction) - nb_sub_results = objet_0.numberOfSubs() + if verbose: + print(blabla) + print_tab(n_recur, "objet : ", objet.name()) + print_tab(n_recur, "RGB = ({},{},{})".format(coul_r, coul_g, coul_b)) - if verbose: - texte = "formé de {} sous-objets".format(nb_sub_results) - print_tab(n_recur, "Examen de l'objet '{}' ".format(objet_0.name()), texte) + # 1. Au premier passage, il faut garder la référence au résultat principal - for n_sobj in range(nb_sub_results): + if n_recur == 0: + objet_0 = objet.result() + else: + objet_0 = objet + + # 2. On descend dans l'arborescence des sous-objets jusqu'à en trouver un qui n'en n'a pas + + nb_sub_results = objet_0.numberOfSubs() + + if verbose: + texte = "formé de {} sous-objets".format(nb_sub_results) + print_tab(n_recur, "Examen de l'objet '{}' ".format(objet_0.name()), texte) -# 2.1. Exploration récursive de l'arborescence + for n_sobj in range(nb_sub_results): + # 2.1. Exploration récursive de l'arborescence - couleur_objet ( objet_0.subResult(n_sobj), n_recur+1, coul_r, coul_g, coul_b, verbose ) + couleur_objet( + objet_0.subResult(n_sobj), n_recur + 1, coul_r, coul_g, coul_b, verbose + ) -# 2.2. Cet objet n'a pas de sous-objets : on le colore - if verbose: - print_tab(n_recur, "Couleur affectée à l'objet ",objet_0.name()) - objet_0.setColor (int(coul_r),int(coul_g),int(coul_b)) + # 2.2. Cet objet n'a pas de sous-objets : on le colore + if verbose: + print_tab(n_recur, "Couleur affectée à l'objet ", objet_0.name()) + objet_0.setColor(int(coul_r), int(coul_g), int(coul_b)) - #print ("sortie de {}".format(nom_fonction)) + # print ("sortie de {}".format(nom_fonction)) -#========================= Fin de la fonction =================================== -#========================= Début de la fonction ================================== +# ========================= Fin de la fonction =================================== -def print_tab (nb_tab, message, argu=None, saut_av=False, saut_ap=False): - """Imprime avec des tabulations +# ========================= Début de la fonction ================================== -Entrées : - :nb_tab: nombre de tabulations à appliquer - :message: message principal - :argu: argument du format - :saut_av: saut de ligne avant le texte - :saut_ap: saut de ligne après le texte -""" - texte = "" +def print_tab(nb_tab, message, argu=None, saut_av=False, saut_ap=False): + """Imprime avec des tabulations - if saut_av: - texte += "\n" + Entrées : + :nb_tab: nombre de tabulations à appliquer + :message: message principal + :argu: argument du format + :saut_av: saut de ligne avant le texte + :saut_ap: saut de ligne après le texte""" - for _ in range(nb_tab): - texte += "\t" + texte = "" - texte += message - if ( argu is not None ): - texte += "{}".format(argu) + if saut_av: + texte += "\n" - if saut_ap: - texte += "\n" + for _ in range(nb_tab): + texte += "\t" - print (texte) + texte += message + if argu is not None: + texte += "{}".format(argu) -#========================= Fin de la fonction =================================== + if saut_ap: + texte += "\n" -#========================= Début de la fonction ================================== + print(texte) -def nommage (objet, nom, couleur=None): - """Nomme un objet et son résultat -Entrées : - :objet: objet à traiter - :nom: nom à attribuer - :couleur: éventuellement couleur -""" +# ========================= Fin de la fonction =================================== - objet.setName(nom) - objet.result().setName(nom) +# ========================= Début de la fonction ================================== - if ( couleur is not None ): - objet.result().setColor(couleur[0], couleur[1], couleur[2]) -#========================= Fin de la fonction =================================== +def nommage(objet, nom, couleur=None): + """Nomme un objet et son résultat -#========================= Début de la fonction ================================== + Entrées : + :objet: objet à traiter + :nom: nom à attribuer + :couleur: éventuellement couleur""" -def exec_nom (fonction, nom=None, couleur=None): - """Exécute la fonction puis éventuellement la nomme et nomme son résultat ; Couleur éventuelle + objet.setName(nom) + objet.result().setName(nom) -Attention : il faut commencer par exécuter la fonction sinon l enommage n'est pas cohérent en mode macro. Mystère... + if couleur is not None: + objet.result().setColor(couleur[0], couleur[1], couleur[2]) -Entrées : - :fonction: fonction à traiter - :nom: nom à attribuer éventuellement - :couleur: éventuellement couleur -""" - fonction.execute(True) +# ========================= Fin de la fonction =================================== - if ( nom is not None ): - nommage (fonction, nom, couleur) +# ========================= Début de la fonction ================================== -#========================= Fin de la fonction =================================== +def exec_nom(fonction, nom=None, couleur=None): + """Exécute la fonction puis éventuellement la nomme et nomme son résultat ; Couleur éventuelle -#=================================== La classe =================================== + Attention : il faut commencer par exécuter la fonction sinon l enommage n'est pas cohérent en mode macro. Mystère... -class SurfaceMediane (object): + Entrées : + :fonction: fonction à traiter + :nom: nom à attribuer éventuellement + :couleur: éventuellement couleur""" - """Calcul des surfaces médianes de solides minces + fonction.execute(True) + + if nom is not None: + nommage(fonction, nom, couleur) + + +# ========================= Fin de la fonction =================================== + + +# =================================== La classe =================================== + + +class SurfaceMediane(object): + + """Calcul des surfaces médianes de solides minces L'objectif de ce programme est de créer les surfaces médianes, encore appelées fibres neutres, pour \ une structure qui est un solide ou un assemblage de solides (compound). @@ -359,2335 +366,2639 @@ _cree_face_mediane --> _cree_face_mediane_plane """ -# A. La base - - message_info = "" - _verbose = 0 - _verbose_max = 0 - affiche_aide_globale = 0 - -# B. Les variables - - _choix_objet = 0 - _export_step = False - nom_solide = None - nom_solide_aux = None - _epsilon = 5.e-2 - part_doc = None - - ficcao = None - rep_step = None - objet_principal = None - # Pour chaque sous-objet dans l'ordre de l'arborescence : nom - l_noms_so = list() - # Statut de chaque sous-objet connu par son nom : - # 0 si pas encore traité, 1 si traité avec succès, 2 si trop mince, -1 si pas assez mince, -2 si impossible. - d_statut_so = dict() - # Liste des faces médianes créées et des fonctions initiales - l_faces_m = list() - # La fonction initiale - fonction_0 = None - - faces_pb_nb = 0 - faces_pb_msg = "" - -#=========================== Début de la méthode ================================= - - def __init__ ( self, liste_option ): - - """Le constructeur de la classe SurfaceMediane - -Décodage des arguments -On cherche ici les arguments généraux : aide, verbeux -""" - - for option in liste_option : - - #print (option) - if isinstance(option,str): - saux = option.upper() - #print (saux) - if saux in ( "-H", "-HELP" ): - self.affiche_aide_globale = 1 - elif saux == "-V" : - self._verbose = 1 - elif saux == "-VMAX" : - self._verbose = 1 - self._verbose_max = 1 - elif saux == "-EXPORT_STEP": - self._export_step = True - elif saux == "-NO_EXPORT_STEP": - self._export_step = False - -#=========================== Fin de la méthode ================================== - -#=========================== Début de la méthode ================================= - - def __del__(self): - """A la suppression de l'instance de classe""" - if self._verbose_max: - print ("Suppression de l'instance de la classe.") - -#=========================== Fin de la méthode ================================== - -#=========================== Début de la méthode ================================= - - def _nom_sous_objets (self, objet, lecture, n_recur=0, rang=0): - """Gère les noms des sous_objets solides - -Entrées : - :objet: objet à traiter - :lecture: vrai pour lire les noms, faux pour les attribuer - :n_recur: niveau de récursivité - :rang: rang du sous-objet - -Sorties : - :rang: rang du sous-objet -""" - - nom_fonction = __name__ + "/_nom_sous_objets" - blabla = "Dans {} :\n".format(nom_fonction) - - if self._verbose_max: - prefixe = "" - for _ in range(n_recur): - prefixe += "\t" - texte = "\n{}{}".format(prefixe,blabla) - texte += "{}n_recur = {}".format(prefixe,n_recur) - texte += "\n{}lecture = {}".format(prefixe,lecture) - print (texte) - -# 1. Au premier passage, il faut garder la référence au résultat principal - - if ( n_recur == 0 ): - objet_0 = objet.result() - if self._verbose_max: - print ("d_statut_so = {}".format(self.d_statut_so)) - else: - objet_0 = objet - -# 2. On descend dans l'arborescence des sous-objets jusqu'à en trouver un qui n'en n'a pas - - nb_sub_results = objet_0.numberOfSubs() - - if self._verbose_max: - texte = "{}Examen de l'objet '{}' ".format(prefixe,objet_0.name()) - texte += "de type '{}'".format(objet_0.shapeType()) - texte += "\n{}objet.result().numberOfSubs() : {}".format(prefixe,nb_sub_results) - print (texte) - - for n_sobj in range(nb_sub_results): - -# 2.1. Exploration récursive de l'arborescence - - rang = self._nom_sous_objets ( objet_0.subResult(n_sobj), lecture, n_recur+1, rang ) - -# 2.2. Cet objet n'a pas de sous-objets. Si c'est un solide, on le traite - - if ( objet_0.shapeType() == "SOLID" ): - # A la lecture, on enregistre le nom - if lecture: - nom = objet_0.name() - self.l_noms_so.append(nom) - self.d_statut_so[nom] = 0 - # A la récupération, on redonne le nom et on affecte une couleur dépendant de l'état - else: - nom = self.l_noms_so[rang] - objet_0.setName(nom) - etat = self.d_statut_so[nom] - objet_0.setColor (D_COLOR_R[etat],D_COLOR_G[etat],D_COLOR_B[etat]) - if ( etat == 1 ): - objet_0.setTransparency (TRANSPARENCE) - rang += 1 - - return rang - -#=========================== Fin de la méthode ================================== - -#=========================== Début de la méthode ================================= - - def _isole_solide ( self, solide, n_recur ): - """Isole le solide de son arboresence - -Entrées : - :solide: le solide à traiter - :n_recur: numéro de la récurrence - -Sorties : - :objet: le solide isolé - :recover: la fonction de récupération -""" - - nom_fonction = __name__ + "/_isole_solide" - blabla = "Dans {} :".format(nom_fonction) - if self._verbose_max: - print_tab (n_recur, blabla) - texte = "Pour le solide '{}' ".format(solide.name()) - texte += "de l'objet principal '{}'".format(self.objet_principal.name()) - print_tab (n_recur, texte) - - if ( solide.name() != self.objet_principal.name() ): - objet, recover = self._isole_solide_a ( solide, n_recur ) - - else: - objet, recover = self._isole_solide_b ( solide, n_recur ) - - if self._verbose_max: - print_tab (n_recur, "objet final : ", objet.name()) - print_tab (n_recur, "fonction_0 : {}".format(self.fonction_0)) - print_tab (n_recur, "recover : {}".format(recover)) - - return objet, recover - -#=========================== Fin de la méthode ================================== - -#=========================== Début de la méthode ================================= - - def _isole_solide_a ( self, solide, n_recur ): - """Isole le solide de son arboresence - -Entrées : - :solide: le solide à traiter - :n_recur: numéro de la récurrence - -Sorties : - :objet: le solide isolé - :recover: la fonction de récupération -""" - - nom_fonction = __name__ + "/_isole_solide_a" - blabla = "Dans {} :".format(nom_fonction) - if self._verbose_max: - print_tab (n_recur, blabla) - texte = "Pour le solide '{}' ".format(solide.name()) - texte += "de l'objet principal '{}'".format(self.objet_principal.name()) - print_tab (n_recur, texte) - - if self._verbose_max: - print_tab (n_recur, ". Extraction du solide '{}'".format(self.objet_principal.name())) - -# 1. Extraction du solide - remove_subshapes = model.addRemoveSubShapes(self.part_doc, model.selection("COMPOUND", self.objet_principal.name())) - remove_subshapes.setSubShapesToKeep([model.selection("SOLID", solide.name())]) - - self.nom_solide_aux = "{}_S".format(solide.name()) - if self._verbose_max: - print_tab (n_recur, "\tAttribution à remove_subshapes.result() du nom '{}'".format(self.nom_solide_aux)) - exec_nom (remove_subshapes,self.nom_solide_aux) - - self.fonction_0 = remove_subshapes - -# 2. Récupération de l'objet principal - recover = model.addRecover(self.part_doc, remove_subshapes, [self.objet_principal]) - if self._verbose_max: - print_tab (n_recur, "\tAttribution à recover du nom '{}'".format(self.objet_principal.name())) - exec_nom (recover,self.objet_principal.name()) - - return remove_subshapes.result(), recover - -#=========================== Fin de la méthode ================================== - -#=========================== Début de la méthode ================================= - - def _isole_solide_b ( self, solide, n_recur ): - """Isole le solide de son arboresence - -Entrées : - :solide: le solide à traiter - :n_recur: numéro de la récurrence - -Sorties : - :objet: le solide isolé - :recover: la fonction de récupération -""" - - nom_fonction = __name__ + "/_isole_solide_b" - blabla = "Dans {} :".format(nom_fonction) - if self._verbose_max: - print_tab (n_recur, blabla) - texte = "Pour le solide '{}' ".format(solide.name()) - texte += "de l'objet principal '{}'".format(self.objet_principal.name()) - print_tab (n_recur, texte) - - if self._verbose_max: - print_tab (n_recur, ". Mise en place du solide") - - self.nom_solide_aux = self.objet_principal.name() - self.fonction_0 = None - - return solide, None - -#=========================== Fin de la méthode ================================== - -#=========================== Début de la méthode ================================= - - def _faces_du_solide ( self, solide, n_recur=0 ): - """Détermine les faces d'un solide - -Entrées : - :solide: solide SHAPER à traiter - :n_recur: niveau de récursivité - -Sorties : - :l_faces_car: pour chaque face du solide (surface,caractéristiques) -""" - - nom_fonction = __name__ + "/_faces_du_solide" - blabla = "Dans {} :".format(nom_fonction) - if self._verbose_max: - print_tab (n_recur, blabla, saut_av=True) - - l_faces = list() - - if self._verbose_max: - print_tab (n_recur, ".. Traitement du solide ", self.nom_solide) - print_tab (n_recur, ".. shapeType : ", solide.shapeType()) - - #print (dir(solide)) - #print_tab (n_recur, "volume = ", GeomAlgoAPI_ShapeTools.volume(solide.shape())) -# 1. Repérage des faces - objResult = solide.resultSubShapePair()[0] - l_faces = list() - exp = GeomAPI_ShapeExplorer(objResult.shape(), GeomAPI_Shape.FACE) - while exp.more(): - l_faces.append(exp.current().face()) - exp.next() - -# 2. Calcul - l_faces_car = list() - for iface, face in enumerate(l_faces): - surf = GeomAlgoAPI_ShapeTools.area(face) - caract = geom.shapeInfo(face) - if self._verbose_max: - print_tab (n_recur, "\tFace n°{} ; ".format(iface), "surface = {}, caractéristiques = {}".format(surf,caract)) - l_faces_car.append((surf,caract)) - - return l_faces_car - -#=========================== Fin de la méthode ================================== - -#=========================== Début de la méthode ================================= - - def _calcul_caract_faces ( self, solide, n_recur ): - """Calcule les caractéristiques géométriques des faces du solide - -Entrées : - :solide: solide SHAPER à traiter - :n_recur: niveau de récursivité - -Sorties : - :tb_caract: tableau des caractéristiques géométriques des faces -""" - - nom_fonction = __name__ + "/_calcul_caract_faces" - blabla = "Dans {} :".format(nom_fonction) - if self._verbose_max: - print_tab (n_recur, blabla, saut_av=True) - print_tab (n_recur, ".. Traitement du solide ", self.nom_solide) - print_tab (n_recur, ".. shapeType : ", solide.shapeType()) - -# 1. Repérage des faces - objResult = solide.resultSubShapePair()[0] - l_faces = list() - exp = GeomAPI_ShapeExplorer(objResult.shape(), GeomAPI_Shape.FACE) - while exp.more(): - l_faces.append(exp.current().face()) - exp.next() - -# 2. Caractéristiques - nb_faces = len(l_faces) - tb_caract = np.zeros((nb_faces,3), dtype = 'object') - for iaux, face in enumerate(l_faces): - surf = GeomAlgoAPI_ShapeTools.area(face) - caract = geom.shapeInfo(face) - if self._verbose_max: - print_tab (n_recur, "\tFace n°{} ; ".format(iaux), "surface = {}, caractéristiques = {}".format(surf,caract)) - - tb_caract [iaux][0] = face - tb_caract [iaux][1] = surf - tb_caract [iaux][2] = caract - - #if self._verbose_max: - #for iaux in range(nb_faces): - #print ("\t. tb_caract : {} {}".format(surf,tb_caract[iaux][2])) - - return tb_caract - -#=========================== Fin de la méthode ================================== - -#=========================== Début de la méthode ================================= - - def _tri_faces ( self, tb_caract, n_recur ): - """Trie les faces en fonction de leurs surfaces - -Entrées : - :tb_caract: tableau des caractéristiques géométriques des faces - :n_recur: niveau de récursivité - -Sorties : - :tb_caract_1[-1], tb_caract_1[-2]: les caractéristiques des 2 faces les plus grandes -""" - - erreur = 0 - message = "" - - nom_fonction = __name__ + "/_tri_faces" - blabla = "Dans {} :".format(nom_fonction) - -# 1. Tri du tableau en fonction des surfaces - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "tb_caract brut : ") - for iaux, caract in enumerate(tb_caract): - print_tab (n_recur, "Face {} : ".format(iaux), caract) - - tb_caract_1 = sorted(tb_caract, key=lambda colonnes: colonnes[1]) - if self._verbose_max: - print () - print_tab (n_recur, "tb_caract trié de la plus petite à la plus grande surface :") - for caract in tb_caract_1: - print_tab (n_recur, "", caract) - print () - - if self._verbose_max: - texte = "\tSurface de la plus grande face : {}, de caractéristiques {}\n".format(tb_caract_1[-1][1],tb_caract_1[-1][2]) - texte += "\tSurface de la face suivante : {}, de caractéristiques {}".format(tb_caract_1[-2][1],tb_caract_1[-2][2]) - print (texte) - -# 2. La surface suivante doit être différente, sinon ce n'est pas un solide mince - if ( len(tb_caract) > 2 ): - - if self._verbose_max: - texte += "\tSurface de la 3ème face suivante : {}, de caractéristiques {}".format(tb_caract_1[-3][1],tb_caract_1[-3][2]) - print (texte) - ecart = np.abs((tb_caract_1[-1][1]-tb_caract_1[-3][1])/tb_caract_1[-1][1]) - if ( ecart < self._epsilon ): - message = "\nSolide '{}'\n".format(self.nom_solide) - message += ". Surface de la plus grande face : {}\n".format(tb_caract_1[-1][1]) - message += ". Surface de la 1ère face suivante : {}\n".format(tb_caract_1[-2][1]) - message += ". Surface de la 2ème face suivante : {}\n".format(tb_caract_1[-3][1]) - if self._verbose_max: - message += ". Ecart relatif :{:4.1f}%\n".format(ecart*100.) - message += "L'écart est trop faible par rapport à la limite de {}%.\n".format(self._epsilon*100.) - message += "==> Impossible de créer la face médiane car le solide n'est pas assez mince.\n" - erreur = -1 - self.d_statut_so[self.nom_solide] = -1 - self.faces_pb_nb += 1 - self.faces_pb_msg += message - - return erreur, message, tb_caract_1[-1], tb_caract_1[-2] - -#=========================== Fin de la méthode ================================== - -#=========================== Début de la méthode ================================= - - def _verif_epaisseur ( self, epaisseur ): - """Contrôle de la validité de l'épaisseur - -Entrées : - :epaisseur: épaisseur du solide -""" - - nom_fonction = __name__ + "/_verif_epaisseur" - blabla = "Dans {} :\n".format(nom_fonction) - - if self._verbose_max: - texte = blabla - texte += ". Epaisseur du solide : {}\n".format(epaisseur) - texte += ". EP_MIN : {}".format(EP_MIN) - print (texte) - - if ( epaisseur <= EP_MIN ): - message = "\nSolide '{}'\n".format(self.nom_solide) - message += ". Epaisseur : {}\n".format(epaisseur) - message += "L'épaisseur est trop faible par rapport à la limite de {}.\n".format(EP_MIN) - message += "==> Impossible de créer la face médiane car le solide est trop mince.\n" - erreur = 2 - self.d_statut_so[self.nom_solide] = 2 - self.faces_pb_nb += 1 - self.faces_pb_msg += message - - else: - erreur = 0 - #print ("erreur = {}".format(erreur)) - - return erreur - -#=========================== Fin de la méthode ================================== - -#=========================== Début de la méthode ================================= - - def _cree_face_mediane ( self, solide, caract_face_1, caract_face_2, tb_caract, n_recur ): - """Crée la face médiane entre deux autres - -Entrées : - :solide: solide SHAPER à traiter - :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes - :tb_caract: tableau des caractéristiques géométriques des faces - :n_recur: niveau de récursivité - -Sorties : - :face: la face médiane créée -""" - - nom_fonction = __name__ + "/_cree_face_mediane" - blabla = "Dans {} :".format(nom_fonction) - - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "face_1 : " ,caract_face_1) - print_tab (n_recur, "face_2 : " ,caract_face_2) - - erreur = 0 - face = None - -# 1. Forme de la face - forme = caract_face_1[2][0] - -# 2. Traitement selon la forme de la face -# 2.1. Face plane - if forme in ( "Disk", "Plane", "Rectangle" ): - erreur, face = self._cree_face_mediane_plane ( solide, caract_face_1, caract_face_2, tb_caract, n_recur ) - -# 2.2. Face cylindrique - elif ( forme == "Cylinder" ): - erreur, face = self._cree_face_mediane_cylindre ( solide, caract_face_1, caract_face_2, n_recur ) - -# 2.3. Face sphérique - elif ( forme == "Sphere" ): - erreur, face = self._cree_face_mediane_sphere ( caract_face_1, caract_face_2, n_recur ) - -# 2.4. Face torique - elif ( forme == "Torus" ): - erreur, face = self._cree_face_mediane_tore ( caract_face_1, caract_face_2, n_recur ) - -# 2.5. Face conique - elif ( forme == "Cone" ): - erreur, face = self._cree_face_mediane_cone ( caract_face_1, caract_face_2, n_recur ) - -# 2.N. Face de forme inconnue - else: - message = "\nSolide '{}'\n".format(self.nom_solide) - message += "sa face la plus grande est de forme : {}\n".format(forme) - message += "==> Impossible de créer la face médiane.\n" - erreur = -2 - self.d_statut_so[self.nom_solide] = -2 - self.faces_pb_nb += 1 - self.faces_pb_msg += message - -# 3. Gestion de la face produite - - if face is not None: - self._cree_face_mediane_0 ( face, n_recur ) - - return erreur, face - -#=========================== Fin de la méthode ================================== - -#=========================== Début de la méthode ================================= - - def _cree_face_mediane_0 ( self, face, n_recur ): - """Gestion de la face médiane créée entre deux autres - -Entrées : - :face: la face médiane créée - :n_recur: niveau de récursivité -""" - - nom_fonction = __name__ + "/_cree_face_mediane_0" - blabla = "Dans {} :".format(nom_fonction) - - if self._verbose_max: - print_tab (n_recur, blabla) - -# 1. Nom de la face - nom_face = self.nom_solide+"_M" - if self._verbose_max: - print_tab (n_recur,"Nom de la face créée : ", nom_face) - #if ( self.nom_solide_aux != self.objet_principal.name() ): - #nom_face += "S" - nommage (face, nom_face) - -# 2. Mémorisation de la face et de la fonction initiale - self.l_faces_m.append((face, self.fonction_0)) - -# 3. Couleur verte pour la face - couleur_objet (face, coul_r=0, coul_g=170, coul_b=0, verbose=self._verbose_max) - -# 4. Changement de statut pour le solide - self.d_statut_so[self.nom_solide] = 1 - -#=========================== Fin de la méthode ================================== - -#=========================== Début de la méthode ================================= - - def _cree_face_mediane_plane ( self, solide, caract_face_1, caract_face_2, tb_caract, n_recur ): - """Crée la face médiane entre deux autres - cas des surfaces planes - -Entrées : - :solide: l'objet solide à traiter - :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes - :tb_caract: tableau des caractéristiques géométriques des faces - :n_recur: niveau de récursivité - -Sorties : - :face: la face médiane -""" - - nom_fonction = __name__ + "/_cree_face_mediane_plane" - blabla = "Dans {} :".format(nom_fonction) - if self._verbose_max: - print_tab (n_recur, blabla) - -# Caractéristiques des surfaces - coo_x, coo_y, coo_z, vnor_x, vnor_y, vnor_z, taille, d_face_1_2 = self._cree_face_mediane_plane_0 ( solide, caract_face_1, caract_face_2, tb_caract, n_recur ) - -# Contrôle de la validité de l'épaisseur - erreur = self._verif_epaisseur ( d_face_1_2 ) - -# Création de la face - if not erreur: - face = self._cree_face_mediane_plane_1 ( solide, (coo_x, coo_y, coo_z),(vnor_x, vnor_y, vnor_z), taille, d_face_1_2, n_recur ) - else: - face = None - - return erreur, face - -#=========================== Fin de la méthode ================================== - -#=========================== Début de la méthode ================================= - - def _cree_face_mediane_plane_0 ( self, solide, caract_face_1, caract_face_2, tb_caract, n_recur ): - """Crée la face médiane entre deux autres - cas des surfaces planes - -Décodage des caractéristiques - -Entrées : - :solide: l'objet solide à traiter - :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes - :tb_caract: tableau des caractéristiques géométriques des faces - :n_recur: niveau de récursivité - -Sorties : - :coo_x, coo_y, coo_z: coordonnées du centre de la base - :vnor_x, vnor_y, vnor_z: coordonnées du vecteur normal - :taille: estimation de la taille de la future face - :d_face_1_2: la distance entre les deux faces -""" - - nom_fonction = __name__ + "/_cree_face_mediane_plane_0" - blabla = "Dans {} :".format(nom_fonction) - - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "caract_face_1 : ", caract_face_1) - print_tab (n_recur, "caract_face_2 : ", caract_face_2) - -# 1. Caractéristiques de la base -# Coordonnées du centre de la base - coo_x = caract_face_1[2][1] - coo_y = caract_face_1[2][2] - coo_z = caract_face_1[2][3] -# Coordonnées du vecteur normal - vnor_x = caract_face_1[2][4] - vnor_y = caract_face_1[2][5] - vnor_z = caract_face_1[2][6] - -# 2. Taille - -# taille : une longueur caractéristique pour être certain de tout prendre - l_diag = self._calcul_lg_caract_0 ( solide, tb_caract, n_recur ) - taille = 10.*l_diag - if self._verbose_max: - print_tab (n_recur, "Taille englobante : ", taille) - -# 3. Distance entre les deux faces - face_1 = caract_face_1[0] - face_2 = caract_face_2[0] - d_face_1_2 = GeomAlgoAPI_ShapeTools.minimalDistance(face_1, face_2) - if self._verbose_max: - print_tab (n_recur, "Distance entre les deux faces = ", d_face_1_2) - - return coo_x, coo_y, coo_z, vnor_x, vnor_y, vnor_z, taille, d_face_1_2 - -#=========================== Fin de la méthode ================================== - -#=========================== Début de la méthode ================================= - - def _cree_face_mediane_plane_1 ( self, solide, coo_c, vnor, taille, d_face_1_2, n_recur ): - """Crée la face médiane entre deux autres - cas des surfaces planes - -Création des objets de construction et de la face médiane - -Entrées : - :solide: l'objet solide à traiter - :coo_c: coordonnées du centre de la base - :vnor: coordonnées du vecteur normal - :taille: estimation de la taille de la future face - :d_face_1_2: la distance entre les deux faces - :n_recur: niveau de récursivité - -Sorties : - :face: la face médiane -""" - - nom_fonction = __name__ + "/_cree_face_mediane_plane_1" - blabla = "Dans {} :".format(nom_fonction) - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "Centre : ({}, {}, {})".format(coo_c[0], coo_c[1], coo_c[2])) - print_tab (n_recur, "Normale : ({}, {}, {})".format(vnor[0], vnor[1], vnor[2])) - print_tab (n_recur, "Taille : ", taille) - print_tab (n_recur, "Distance entre les deux faces : ", d_face_1_2) - -# 1. Préalables - _, v_norm, plan = self._cree_centre_axe_plan ( coo_c, vnor, self.nom_solide, n_recur ) - -# 2. Création de l'esquisse - sketch = self._cree_face_mediane_plane_1_a ( plan, taille, n_recur ) - -# 3. La face - face = self._cree_face_mediane_plane_1_b ( solide, sketch, v_norm, d_face_1_2, n_recur ) - - #print ("fin de {}".format(nom_fonction)) + # A. La base + + message_info = "" + _verbose = 0 + _verbose_max = 0 + affiche_aide_globale = 0 + + # B. Les variables + + _choix_objet = 0 + _export_step = False + nom_solide = None + nom_solide_aux = None + _epsilon = 5.0e-2 + part_doc = None + + ficcao = None + rep_step = None + objet_principal = None + # Pour chaque sous-objet dans l'ordre de l'arborescence : nom + l_noms_so = list() + # Statut de chaque sous-objet connu par son nom : + # 0 si pas encore traité, 1 si traité avec succès, 2 si trop mince, -1 si pas assez mince, -2 si impossible. + d_statut_so = dict() + # Liste des faces médianes créées et des fonctions initiales + l_faces_m = list() + # La fonction initiale + fonction_0 = None + + faces_pb_nb = 0 + faces_pb_msg = "" + + # =========================== Début de la méthode ================================= + + def __init__(self, liste_option): + """Le constructeur de la classe SurfaceMediane + + Décodage des arguments + On cherche ici les arguments généraux : aide, verbeux""" + + for option in liste_option: + # print (option) + if isinstance(option, str): + saux = option.upper() + # print (saux) + if saux in ("-H", "-HELP"): + self.affiche_aide_globale = 1 + elif saux == "-V": + self._verbose = 1 + elif saux == "-VMAX": + self._verbose = 1 + self._verbose_max = 1 + elif saux == "-EXPORT_STEP": + self._export_step = True + elif saux == "-NO_EXPORT_STEP": + self._export_step = False + + # =========================== Fin de la méthode ================================== + + # =========================== Début de la méthode ================================= + + def __del__(self): + """A la suppression de l'instance de classe""" + if self._verbose_max: + print("Suppression de l'instance de la classe.") - return face + # =========================== Fin de la méthode ================================== -#=========================== Fin de la méthode ================================== + # =========================== Début de la méthode ================================= -#=========================== Début de la méthode ================================= + def _nom_sous_objets(self, objet, lecture, n_recur=0, rang=0): + """Gère les noms des sous_objets solides - def _cree_face_mediane_plane_1_a ( self, plan, taille, n_recur ): - """Crée la face médiane entre deux autres - cas des surfaces planes - l'esquisse + Entrées : + :objet: objet à traiter + :lecture: vrai pour lire les noms, faux pour les attribuer + :n_recur: niveau de récursivité + :rang: rang du sous-objet -Entrées : - :plan: plan - :taille: estimation de la taille de la future face - :n_recur: niveau de récursivité + Sorties : + :rang: rang du sous-objet""" -Sorties : - :sketch: l'esquisse -""" + nom_fonction = __name__ + "/_nom_sous_objets" + blabla = "Dans {} :\n".format(nom_fonction) - nom_fonction = __name__ + "/_cree_face_mediane_plane_1_a" - blabla = "Dans {} :".format(nom_fonction) - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "Plan : {}".format(plan.name())) - print_tab (n_recur, "taille : {}".format(taille)) + if self._verbose_max: + prefixe = "" + for _ in range(n_recur): + prefixe += "\t" + texte = "\n{}{}".format(prefixe, blabla) + texte += "{}n_recur = {}".format(prefixe, n_recur) + texte += "\n{}lecture = {}".format(prefixe, lecture) + print(texte) + + # 1. Au premier passage, il faut garder la référence au résultat principal + + if n_recur == 0: + objet_0 = objet.result() + if self._verbose_max: + print("d_statut_so = {}".format(self.d_statut_so)) + else: + objet_0 = objet - sketch = model.addSketch(self.part_doc, model.selection("FACE", plan.name())) - sketch.execute(True) + # 2. On descend dans l'arborescence des sous-objets jusqu'à en trouver un qui n'en n'a pas - ### Create SketchLine - SketchLine_1 = sketch.addLine(-taille/2., taille/2., taille/2., taille/2.) - SketchLine_1.execute(True) + nb_sub_results = objet_0.numberOfSubs() - ### Create SketchLine - SketchLine_2 = sketch.addLine(taille/2., taille/2., taille/2., -taille/2.) - SketchLine_2.execute(True) + if self._verbose_max: + texte = "{}Examen de l'objet '{}' ".format(prefixe, objet_0.name()) + texte += "de type '{}'".format(objet_0.shapeType()) + texte += "\n{}objet.result().numberOfSubs() : {}".format( + prefixe, nb_sub_results + ) + print(texte) - ### Create SketchLine - SketchLine_3 = sketch.addLine(taille/2., -taille/2., -taille/2., -taille/2.) - SketchLine_3.execute(True) + for n_sobj in range(nb_sub_results): + # 2.1. Exploration récursive de l'arborescence - ### Create SketchLine - SketchLine_4 = sketch.addLine(-taille/2., -taille/2., -taille/2., taille/2.) - SketchLine_4.execute(True) + rang = self._nom_sous_objets( + objet_0.subResult(n_sobj), lecture, n_recur + 1, rang + ) - model.do() + # 2.2. Cet objet n'a pas de sous-objets. Si c'est un solide, on le traite - nom_sketch = "{}_esquisse".format(self.nom_solide) - exec_nom (sketch,nom_sketch) + if objet_0.shapeType() == "SOLID": + # A la lecture, on enregistre le nom + if lecture: + nom = objet_0.name() + self.l_noms_so.append(nom) + self.d_statut_so[nom] = 0 + # A la récupération, on redonne le nom et on affecte une couleur dépendant de l'état + else: + nom = self.l_noms_so[rang] + objet_0.setName(nom) + etat = self.d_statut_so[nom] + objet_0.setColor(D_COLOR_R[etat], D_COLOR_G[etat], D_COLOR_B[etat]) + if etat == 1: + objet_0.setTransparency(TRANSPARENCE) + rang += 1 - #print ("fin de {}".format(nom_fonction)) + return rang - return sketch + # =========================== Fin de la méthode ================================== -#=========================== Fin de la méthode ================================== + # =========================== Début de la méthode ================================= -#=========================== Début de la méthode ================================= + def _isole_solide(self, solide, n_recur): + """Isole le solide de son arboresence - def _cree_face_mediane_plane_1_b ( self, solide, sketch, v_norm, d_face_1_2, n_recur ): - """Crée la face médiane entre deux autres - cas des surfaces planes + Entrées : + :solide: le solide à traiter + :n_recur: numéro de la récurrence -Création de la face médiane + Sorties : + :objet: le solide isolé + :recover: la fonction de récupération""" -Entrées : - :solide: l'objet solide à traiter - :sketch: l'esquisse - :v_norm: vecteur normal - :d_face_1_2: la distance entre les deux faces - :n_recur: niveau de récursivité + nom_fonction = __name__ + "/_isole_solide" + blabla = "Dans {} :".format(nom_fonction) + if self._verbose_max: + print_tab(n_recur, blabla) + texte = "Pour le solide '{}' ".format(solide.name()) + texte += "de l'objet principal '{}'".format(self.objet_principal.name()) + print_tab(n_recur, texte) -Sorties : - :face: la face médiane -""" + if solide.name() != self.objet_principal.name(): + objet, recover = self._isole_solide_a(solide, n_recur) - nom_fonction = __name__ + "/_cree_face_mediane_plane_1_b" - blabla = "Dans {} :".format(nom_fonction) - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "Esquisse : ", sketch.name()) - print_tab (n_recur, "Distance entre les deux faces : ", d_face_1_2) + else: + objet, recover = self._isole_solide_b(solide, n_recur) -# 1. Copie du solide pour gérer les intersections - #Copy_1 = model.addCopy(self.part_doc, [model.selection("COMPOUND", "all-in-{}".format(self.nom_solide_aux))], 1) - Copy_1 = model.addMultiTranslation(self.part_doc, [model.selection("SOLID", self.nom_solide_aux)], model.selection("EDGE", "PartSet/OX"), 0, 1, keepSubResults = True) - nom = "{}_Copy_1".format(self.nom_solide_aux) - exec_nom (Copy_1,nom) - if self._verbose_max: - print_tab (n_recur, "Après addMultiTranslation Copy_1 de nom ", nom) - nom_solide = Copy_1.result().name() + if self._verbose_max: + print_tab(n_recur, "objet final : ", objet.name()) + print_tab(n_recur, "fonction_0 : {}".format(self.fonction_0)) + print_tab(n_recur, "recover : {}".format(recover)) - ### Create Recover - Recover_1 = model.addRecover(self.part_doc, Copy_1, [solide]) - nom = "{}_Recover_1".format(self.nom_solide_aux) - exec_nom (Recover_1,nom) - if self._verbose_max: - print_tab (n_recur, "Après addRecover Recover_1 de nom ", nom) + return objet, recover -# 2. Création d'une face ; on la translate d'une demi-épaisseur. - for iaux in range(2): + # =========================== Fin de la méthode ================================== -# 2.1. Création d'une face à partir du sketch et translation perpendiculaire au plan de la face -# On essaie les 2 côtés alternativement car on ne sait pas lequel sera le bon + # =========================== Début de la méthode ================================= - d_trans = -0.5*d_face_1_2*float(2*iaux-1) + def _isole_solide_a(self, solide, n_recur): + """Isole le solide de son arboresence - face = self._cree_face_mediane_plane_2 ( sketch.name(), v_norm.name(), nom_solide, d_trans, iaux, n_recur ) + Entrées : + :solide: le solide à traiter + :n_recur: numéro de la récurrence -# 2.2. Si on est du bon côté, alors on intersecte la face avec le solide et c'est bon - if face.results(): - face = self._cree_face_mediane_plane_11 ( face, Recover_1, n_recur ) - break + Sorties : + :objet: le solide isolé + :recover: la fonction de récupération""" -# 2.3. Si l'intersection est vide, on crée une nouvelle copie du solide avant de tester l'autre côté - else: + nom_fonction = __name__ + "/_isole_solide_a" + blabla = "Dans {} :".format(nom_fonction) if self._verbose_max: - print_tab (n_recur, "L'intersection est vide. On essaie l'autre côté") + print_tab(n_recur, blabla) + texte = "Pour le solide '{}' ".format(solide.name()) + texte += "de l'objet principal '{}'".format(self.objet_principal.name()) + print_tab(n_recur, texte) - ### Create LinearCopy - #Copy_2 = model.addCopy(self.part_doc, [model.selection("COMPOUND", "all-in-{}".format(self.nom_solide_aux))], 1) - Copy_2 = model.addMultiTranslation(self.part_doc, [model.selection("SOLID", Recover_1.result().name())], model.selection("EDGE", "PartSet/OX"), 0, 1, keepSubResults = True) - nom = "{}_Copy_2".format(self.nom_solide_aux) - exec_nom (Copy_2,nom) if self._verbose_max: - print_tab (n_recur, "Après addMultiTranslation Copy_2 de nom ", nom) - nom_solide = Copy_2.result().name() - - #print ("fin de {}".format(nom_fonction)) + print_tab( + n_recur, + ". Extraction du solide '{}'".format(self.objet_principal.name()), + ) + + # 1. Extraction du solide + remove_subshapes = model.addRemoveSubShapes( + self.part_doc, model.selection("COMPOUND", self.objet_principal.name()) + ) + remove_subshapes.setSubShapesToKeep([model.selection("SOLID", solide.name())]) + + self.nom_solide_aux = "{}_S".format(solide.name()) + if self._verbose_max: + print_tab( + n_recur, + "\tAttribution à remove_subshapes.result() du nom '{}'".format( + self.nom_solide_aux + ), + ) + exec_nom(remove_subshapes, self.nom_solide_aux) + + self.fonction_0 = remove_subshapes + + # 2. Récupération de l'objet principal + recover = model.addRecover( + self.part_doc, remove_subshapes, [self.objet_principal] + ) + if self._verbose_max: + print_tab( + n_recur, + "\tAttribution à recover du nom '{}'".format( + self.objet_principal.name() + ), + ) + exec_nom(recover, self.objet_principal.name()) - return face + return remove_subshapes.result(), recover -#=========================== Fin de la méthode ================================== + # =========================== Fin de la méthode ================================== -#=========================== Début de la méthode ================================= + # =========================== Début de la méthode ================================= - def _cree_face_mediane_plane_11 ( self, face, Recover_1, n_recur ): - """Crée la face médiane entre deux autres - cas des surfaces planes + def _isole_solide_b(self, solide, n_recur): + """Isole le solide de son arboresence -Création des objets de construction et de la face médiane + Entrées : + :solide: le solide à traiter + :n_recur: numéro de la récurrence -Entrées : - :face: la face médiane - :Recover_1: la récupératiuon du solide - :n_recur: niveau de récursivité + Sorties : + :objet: le solide isolé + :recover: la fonction de récupération""" -Sorties : - :face: la face médiane -""" - - nom_fonction = __name__ + "/_cree_face_mediane_plane_11" - blabla = "Dans {} :".format(nom_fonction) - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "face : ", face.name()) + nom_fonction = __name__ + "/_isole_solide_b" + blabla = "Dans {} :".format(nom_fonction) + if self._verbose_max: + print_tab(n_recur, blabla) + texte = "Pour le solide '{}' ".format(solide.name()) + texte += "de l'objet principal '{}'".format(self.objet_principal.name()) + print_tab(n_recur, texte) - # Si on traite un objet solide unique, on le récupère - if ( self.nom_solide_aux == self.objet_principal.name() ): - if self._verbose_max: - print_tab (n_recur, "On traite un objet solide unique ==> on le récupère.") - Recover_2 = model.addRecover(self.part_doc, face, [Recover_1.result()]) - nom = "{}_Recover_2".format(self.nom_solide_aux) - exec_nom (Recover_2,nom) + if self._verbose_max: + print_tab(n_recur, ". Mise en place du solide") - nb_inter = face.result().numberOfSubs() - if self._verbose_max: - print_tab (n_recur, "Nombre d'intersections : ", nb_inter) + self.nom_solide_aux = self.objet_principal.name() + self.fonction_0 = None - if (nb_inter > 1 ): - face = self._cree_face_mediane_plane_3 ( face ) + return solide, None - return face + # =========================== Fin de la méthode ================================== -#=========================== Fin de la méthode ================================== + # =========================== Début de la méthode ================================= -#=========================== Début de la méthode ================================= + def _faces_du_solide(self, solide, n_recur=0): + """Détermine les faces d'un solide - def _cree_face_mediane_plane_2 ( self, nom_sketch, nom_normal, nom_solide, d_trans, icpt, n_recur ): - """Crée la face médiane entre deux autres - cas des surfaces planes + Entrées : + :solide: solide SHAPER à traiter + :n_recur: niveau de récursivité -Intersection de la face avec le solide + Sorties : + :l_faces_car: pour chaque face du solide (surface,caractéristiques)""" -Entrées : - :nom_sketch: nom de l'esquisse - :nom_normal: nom du vecteur normal - :nom_solide: nom du solide à intersecter - :d_trans: la distance de translation - :icpt: numéro de la tentative + nom_fonction = __name__ + "/_faces_du_solide" + blabla = "Dans {} :".format(nom_fonction) + if self._verbose_max: + print_tab(n_recur, blabla, saut_av=True) -Sorties : - :face: la face médiane -""" + l_faces = list() - nom_fonction = __name__ + "/_cree_face_mediane_plane_2" - blabla = "Dans {} :".format(nom_fonction) - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "nom_sketch : ", nom_sketch) - print_tab (n_recur, "nom_normal : ", nom_normal) - print_tab (n_recur, "nom_solide : ", nom_solide) - print_tab (n_recur, "d_trans : ", d_trans) + if self._verbose_max: + print_tab(n_recur, ".. Traitement du solide ", self.nom_solide) + print_tab(n_recur, ".. shapeType : ", solide.shapeType()) + + # print (dir(solide)) + # print_tab (n_recur, "volume = ", GeomAlgoAPI_ShapeTools.volume(solide.shape())) + # 1. Repérage des faces + objResult = solide.resultSubShapePair()[0] + l_faces = list() + exp = GeomAPI_ShapeExplorer(objResult.shape(), GeomAPI_Shape.FACE) + while exp.more(): + l_faces.append(exp.current().face()) + exp.next() + + # 2. Calcul + l_faces_car = list() + for iface, face in enumerate(l_faces): + surf = GeomAlgoAPI_ShapeTools.area(face) + caract = geom.shapeInfo(face) + if self._verbose_max: + print_tab( + n_recur, + "\tFace n°{} ; ".format(iface), + "surface = {}, caractéristiques = {}".format(surf, caract), + ) + l_faces_car.append((surf, caract)) + + return l_faces_car + + # =========================== Fin de la méthode ================================== + + # =========================== Début de la méthode ================================= + + def _calcul_caract_faces(self, solide, n_recur): + """Calcule les caractéristiques géométriques des faces du solide + + Entrées : + :solide: solide SHAPER à traiter + :n_recur: niveau de récursivité + + Sorties : + :tb_caract: tableau des caractéristiques géométriques des faces""" + + nom_fonction = __name__ + "/_calcul_caract_faces" + blabla = "Dans {} :".format(nom_fonction) + if self._verbose_max: + print_tab(n_recur, blabla, saut_av=True) + print_tab(n_recur, ".. Traitement du solide ", self.nom_solide) + print_tab(n_recur, ".. shapeType : ", solide.shapeType()) + + # 1. Repérage des faces + objResult = solide.resultSubShapePair()[0] + l_faces = list() + exp = GeomAPI_ShapeExplorer(objResult.shape(), GeomAPI_Shape.FACE) + while exp.more(): + l_faces.append(exp.current().face()) + exp.next() + + # 2. Caractéristiques + nb_faces = len(l_faces) + tb_caract = np.zeros((nb_faces, 3), dtype="object") + for iaux, face in enumerate(l_faces): + surf = GeomAlgoAPI_ShapeTools.area(face) + caract = geom.shapeInfo(face) + if self._verbose_max: + print_tab( + n_recur, + "\tFace n°{} ; ".format(iaux), + "surface = {}, caractéristiques = {}".format(surf, caract), + ) + + tb_caract[iaux][0] = face + tb_caract[iaux][1] = surf + tb_caract[iaux][2] = caract + + # if self._verbose_max: + # for iaux in range(nb_faces): + # print ("\t. tb_caract : {} {}".format(surf,tb_caract[iaux][2])) + + return tb_caract + + # =========================== Fin de la méthode ================================== + + # =========================== Début de la méthode ================================= + + def _tri_faces(self, tb_caract, n_recur): + """Trie les faces en fonction de leurs surfaces + + Entrées : + :tb_caract: tableau des caractéristiques géométriques des faces + :n_recur: niveau de récursivité + + Sorties : + :tb_caract_1[-1], tb_caract_1[-2]: les caractéristiques des 2 faces les plus grandes + """ - # Création d'une face - Face_1 = model.addFace(self.part_doc, [model.selection("COMPOUND", "all-in-{}".format(nom_sketch))]) - nom = "{}_Face_1_{}".format(self.nom_solide_aux,icpt) - exec_nom (Face_1,nom) - if self._verbose_max: - print_tab (n_recur, "Après addFace pour Face_1 de nom ", nom) + erreur = 0 + message = "" -# On la translate - Translation_1 = model.addTranslation(self.part_doc, [model.selection("FACE", Face_1.result().name())], axis = model.selection("EDGE", nom_normal), distance = d_trans, keepSubResults = True) - nom = "{}_trans_{}".format(self.nom_solide_aux,icpt) - exec_nom (Translation_1,nom) - if self._verbose_max: - print_tab (n_recur, "Après addTranslation pour Translation_1 de nom ", nom) - Translation_1.result().setColor(85, 0, 255) + nom_fonction = __name__ + "/_tri_faces" + blabla = "Dans {} :".format(nom_fonction) -# Intersection de cette face avec le solide initial - face = self._creation_face_inter ( Translation_1.result().name(), nom_solide ) + # 1. Tri du tableau en fonction des surfaces + if self._verbose_max: + print_tab(n_recur, blabla) + print_tab(n_recur, "tb_caract brut : ") + for iaux, caract in enumerate(tb_caract): + print_tab(n_recur, "Face {} : ".format(iaux), caract) - return face + tb_caract_1 = sorted(tb_caract, key=lambda colonnes: colonnes[1]) + if self._verbose_max: + print() + print_tab( + n_recur, "tb_caract trié de la plus petite à la plus grande surface :" + ) + for caract in tb_caract_1: + print_tab(n_recur, "", caract) + print() -#=========================== Fin de la méthode ================================== + if self._verbose_max: + texte = "\tSurface de la plus grande face : {}, de caractéristiques {}\n".format( + tb_caract_1[-1][1], tb_caract_1[-1][2] + ) + texte += "\tSurface de la face suivante : {}, de caractéristiques {}".format( + tb_caract_1[-2][1], tb_caract_1[-2][2] + ) + print(texte) + + # 2. La surface suivante doit être différente, sinon ce n'est pas un solide mince + if len(tb_caract) > 2: + if self._verbose_max: + texte += "\tSurface de la 3ème face suivante : {}, de caractéristiques {}".format( + tb_caract_1[-3][1], tb_caract_1[-3][2] + ) + print(texte) + ecart = np.abs( + (tb_caract_1[-1][1] - tb_caract_1[-3][1]) / tb_caract_1[-1][1] + ) + if ecart < self._epsilon: + message = "\nSolide '{}'\n".format(self.nom_solide) + message += ". Surface de la plus grande face : {}\n".format( + tb_caract_1[-1][1] + ) + message += ". Surface de la 1ère face suivante : {}\n".format( + tb_caract_1[-2][1] + ) + message += ". Surface de la 2ème face suivante : {}\n".format( + tb_caract_1[-3][1] + ) + if self._verbose_max: + message += ". Ecart relatif :{:4.1f}%\n".format(ecart * 100.0) + message += ( + "L'écart est trop faible par rapport à la limite de {}%.\n".format( + self._epsilon * 100.0 + ) + ) + message += "==> Impossible de créer la face médiane car le solide n'est pas assez mince.\n" + erreur = -1 + self.d_statut_so[self.nom_solide] = -1 + self.faces_pb_nb += 1 + self.faces_pb_msg += message + + return erreur, message, tb_caract_1[-1], tb_caract_1[-2] + + # =========================== Fin de la méthode ================================== + + # =========================== Début de la méthode ================================= + + def _verif_epaisseur(self, epaisseur): + """Contrôle de la validité de l'épaisseur + + Entrées : + :epaisseur: épaisseur du solide""" + + nom_fonction = __name__ + "/_verif_epaisseur" + blabla = "Dans {} :\n".format(nom_fonction) -#=========================== Début de la méthode ================================= + if self._verbose_max: + texte = blabla + texte += ". Epaisseur du solide : {}\n".format(epaisseur) + texte += ". EP_MIN : {}".format(EP_MIN) + print(texte) + + if epaisseur <= EP_MIN: + message = "\nSolide '{}'\n".format(self.nom_solide) + message += ". Epaisseur : {}\n".format(epaisseur) + message += ( + "L'épaisseur est trop faible par rapport à la limite de {}.\n".format( + EP_MIN + ) + ) + message += "==> Impossible de créer la face médiane car le solide est trop mince.\n" + erreur = 2 + self.d_statut_so[self.nom_solide] = 2 + self.faces_pb_nb += 1 + self.faces_pb_msg += message - def _cree_face_mediane_plane_3 ( self, face ): - """Crée la face médiane entre deux autres - cas des surfaces planes + else: + erreur = 0 + # print ("erreur = {}".format(erreur)) -Fusion des 2 intersections + return erreur -Entrées : - :face: la face médiane composée de plusieurs intersections + # =========================== Fin de la méthode ================================== -Sorties : - :face_m: la face médiane -""" + # =========================== Début de la méthode ================================= - nom_fonction = __name__ + "/_cree_face_mediane_plane_3" - blabla = "Dans {} :\n".format(nom_fonction) - if self._verbose_max: - texte = blabla - print (texte) + def _cree_face_mediane( + self, solide, caract_face_1, caract_face_2, tb_caract, n_recur + ): + """Crée la face médiane entre deux autres -# Nommage des sous-objets - l_fuse = list() - for iaux in range(face.result().numberOfSubs()): - nom = "{}_common_{}".format(self.nom_solide_aux,iaux) - face.result().subResult(iaux).setName(nom) - l_fuse.append(model.selection("FACE", '{}'.format(nom))) + Entrées : + :solide: solide SHAPER à traiter + :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes + :tb_caract: tableau des caractéristiques géométriques des faces + :n_recur: niveau de récursivité -# Fusion - if self._verbose_max: - print ("Fusion de {} faces.".format(len(l_fuse))) - face_m = model.addFuse(self.part_doc, l_fuse, keepSubResults = True) - face_m.execute(True) + Sorties : + :face: la face médiane créée""" - return face_m + nom_fonction = __name__ + "/_cree_face_mediane" + blabla = "Dans {} :".format(nom_fonction) -#=========================== Fin de la méthode ================================== + if self._verbose_max: + print_tab(n_recur, blabla) + print_tab(n_recur, "face_1 : ", caract_face_1) + print_tab(n_recur, "face_2 : ", caract_face_2) -#=========================== Début de la méthode ================================= + erreur = 0 + face = None + + # 1. Forme de la face + forme = caract_face_1[2][0] + + # 2. Traitement selon la forme de la face + # 2.1. Face plane + if forme in ("Disk", "Plane", "Rectangle"): + erreur, face = self._cree_face_mediane_plane( + solide, caract_face_1, caract_face_2, tb_caract, n_recur + ) + + # 2.2. Face cylindrique + elif forme == "Cylinder": + erreur, face = self._cree_face_mediane_cylindre( + solide, caract_face_1, caract_face_2, n_recur + ) + + # 2.3. Face sphérique + elif forme == "Sphere": + erreur, face = self._cree_face_mediane_sphere( + caract_face_1, caract_face_2, n_recur + ) + + # 2.4. Face torique + elif forme == "Torus": + erreur, face = self._cree_face_mediane_tore( + caract_face_1, caract_face_2, n_recur + ) + + # 2.5. Face conique + elif forme == "Cone": + erreur, face = self._cree_face_mediane_cone( + caract_face_1, caract_face_2, n_recur + ) + + # 2.N. Face de forme inconnue + else: + message = "\nSolide '{}'\n".format(self.nom_solide) + message += "sa face la plus grande est de forme : {}\n".format(forme) + message += "==> Impossible de créer la face médiane.\n" + erreur = -2 + self.d_statut_so[self.nom_solide] = -2 + self.faces_pb_nb += 1 + self.faces_pb_msg += message - def _cree_face_mediane_cylindre ( self, solide, caract_face_1, caract_face_2, n_recur ): - """Crée la face médiane entre deux autres - cas des cylindres + # 3. Gestion de la face produite -Entrées : - :solide: solide SHAPER à traiter - :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes - :n_recur: niveau de récursivité + if face is not None: + self._cree_face_mediane_0(face, n_recur) -Sorties : - :face: la face médiane -""" + return erreur, face - nom_fonction = __name__ + "/_cree_face_mediane_cylindre" - blabla = "Dans {} :".format(nom_fonction) + # =========================== Fin de la méthode ================================== -# Les deux faces - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "face_1 : ", caract_face_1) - print_tab (n_recur, "face_2 : ", caract_face_2) + # =========================== Début de la méthode ================================= -# Caractéristiques des cylindres - coo_x, coo_y, coo_z, axe_x, axe_y, axe_z, rayon, hauteur, epaisseur = self._cree_face_mediane_cylindre_0 ( solide, caract_face_1, caract_face_2, n_recur ) + def _cree_face_mediane_0(self, face, n_recur): + """Gestion de la face médiane créée entre deux autres -# Contrôle de la validité de l'épaisseur - erreur = self._verif_epaisseur ( epaisseur ) + Entrées : + :face: la face médiane créée + :n_recur: niveau de récursivité""" -# Création de la face, de couleur bleue si problème - if not erreur: - face = self._cree_face_mediane_cylindre_1 ( (coo_x, coo_y, coo_z), (axe_x, axe_y, axe_z), rayon, hauteur, n_recur ) - else: - couleur_objet (solide, n_recur, coul_r=0, coul_g=0, coul_b=255, verbose=self._verbose_max) - face = None + nom_fonction = __name__ + "/_cree_face_mediane_0" + blabla = "Dans {} :".format(nom_fonction) - return erreur, face + if self._verbose_max: + print_tab(n_recur, blabla) -#=========================== Fin de la méthode ================================== + # 1. Nom de la face + nom_face = self.nom_solide + "_M" + if self._verbose_max: + print_tab(n_recur, "Nom de la face créée : ", nom_face) + # if ( self.nom_solide_aux != self.objet_principal.name() ): + # nom_face += "S" + nommage(face, nom_face) -#=========================== Début de la méthode ================================= + # 2. Mémorisation de la face et de la fonction initiale + self.l_faces_m.append((face, self.fonction_0)) - def _cree_face_mediane_cylindre_0 ( self, solide, caract_face_1, caract_face_2, n_recur ): - """Crée la face médiane entre deux autres - cas des cylindres + # 3. Couleur verte pour la face + couleur_objet(face, coul_r=0, coul_g=170, coul_b=0, verbose=self._verbose_max) -Décodage des caractéristiques + # 4. Changement de statut pour le solide + self.d_statut_so[self.nom_solide] = 1 -Entrées : - :solide: l'objet solide à traiter - :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes - :n_recur: niveau de récursivité + # =========================== Fin de la méthode ================================== -Sorties : - :coo_x, coo_y, coo_z: coordonnées du centre de la base - :axe_x, axe_y, axe_z: coordonnées de l'axe - :rayon: rayon moyen entre les deux faces - :hauteur: hauteur du cylindre - :epaisseur: épaisseur de l'interface entre les deux faces -""" + # =========================== Début de la méthode ================================= - nom_fonction = __name__ + "/_cree_face_mediane_cylindre_0" - blabla = "Dans {} :".format(nom_fonction) + def _cree_face_mediane_plane( + self, solide, caract_face_1, caract_face_2, tb_caract, n_recur + ): + """Crée la face médiane entre deux autres - cas des surfaces planes - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "face_1 : ", caract_face_1) - print_tab (n_recur, "face_2 : ", caract_face_2) - -# Coordonnées du centre de la base - coo_x = caract_face_1[2][1] - coo_y = caract_face_1[2][2] - coo_z = caract_face_1[2][3] -# Coordonnées de l'axe - axe_x = caract_face_1[2][4] - axe_y = caract_face_1[2][5] - axe_z = caract_face_1[2][6] -# Rayons - rayon = (caract_face_2[2][7]+caract_face_1[2][7])/2. -# Hauteur : une longueur caractéristique pour être certain de tout prendre - l_diag = self._calcul_lg_caract_1 ( solide, n_recur ) - hauteur = 10.*l_diag - if self._verbose_max: - print_tab (n_recur, "Hauteur englobante : ", hauteur) -# Epaisseur - epaisseur = np.abs(caract_face_2[2][7]-caract_face_1[2][7]) - - return coo_x, coo_y, coo_z, axe_x, axe_y, axe_z, rayon, hauteur, epaisseur - -#=========================== Fin de la méthode ================================== - -#=========================== Début de la méthode ================================= - - def _cree_face_mediane_cylindre_1 ( self, coo_c, v_axe, rayon, hauteur, n_recur ): - """Crée la face médiane entre deux autres - cas des cylindres - -Création des objets temporaires et de la face externe du cylindre support - -Entrées : - :coo_x, coo_y, coo_z: coordonnées du centre de la base - :axe_x, axe_y, axe_z: coordonnées de l'axe - :rayon: rayon moyen entre les deux faces - :hauteur: hauteur du cylindre - :n_recur: niveau de récursivité - -Sorties : - :face: la face médiane -""" - nom_fonction = __name__ + "/_cree_face_mediane_cylindre_1" - blabla = "Dans {} :\n".format(nom_fonction) + Entrées : + :solide: l'objet solide à traiter + :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes + :tb_caract: tableau des caractéristiques géométriques des faces + :n_recur: niveau de récursivité -# Les caractéristiques du cylindre à créer - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "Centre : ({}, {}, {})".format(coo_c[0], coo_c[1], coo_c[2])) - print_tab (n_recur, "Axe : ({}, {}, {})".format(v_axe[0], v_axe[1], v_axe[2])) - print_tab (n_recur, "Rayon : ", rayon) - print_tab (n_recur, "Hauteur : ", hauteur) + Sorties : + :face: la face médiane""" -# 1. Création du point central - centre = model.addPoint(self.part_doc, coo_c[0], coo_c[1], coo_c[2]) - nom_centre = "{}_centre".format(self.nom_solide) - exec_nom (centre,nom_centre) - if self.fonction_0 is None: - self.fonction_0 = centre + nom_fonction = __name__ + "/_cree_face_mediane_plane" + blabla = "Dans {} :".format(nom_fonction) + if self._verbose_max: + print_tab(n_recur, blabla) + + # Caractéristiques des surfaces + ( + coo_x, + coo_y, + coo_z, + vnor_x, + vnor_y, + vnor_z, + taille, + d_face_1_2, + ) = self._cree_face_mediane_plane_0( + solide, caract_face_1, caract_face_2, tb_caract, n_recur + ) + + # Contrôle de la validité de l'épaisseur + erreur = self._verif_epaisseur(d_face_1_2) + + # Création de la face + if not erreur: + face = self._cree_face_mediane_plane_1( + solide, + (coo_x, coo_y, coo_z), + (vnor_x, vnor_y, vnor_z), + taille, + d_face_1_2, + n_recur, + ) + else: + face = None -# 2. Création du vecteur axial - axe = model.addAxis(self.part_doc, v_axe[0], v_axe[1], v_axe[2]) - nom_axe = "{}_vecteur".format(self.nom_solide) - exec_nom (axe,nom_axe) + return erreur, face -# 3. Création du cylindre en volume, de rayon médian - Cylinder_1 = model.addCylinder(self.part_doc, model.selection("VERTEX", nom_centre), model.selection("EDGE", nom_axe), rayon, hauteur) - nom = "{}_Cylinder_1".format(self.nom_solide) - exec_nom (Cylinder_1,nom) + # =========================== Fin de la méthode ================================== -# 4. Création du cylindre en surface - cylindre = self._creation_face_surface ( nom, "cylindre" ) + # =========================== Début de la méthode ================================= -# 5. Mise en place - Translation_1 = model.addTranslation(self.part_doc, [model.selection("COMPOUND", cylindre.name())], axis = model.selection("EDGE", nom_axe), distance = -0.5*hauteur, keepSubResults = True) - nom = "{}_Translation_1".format(self.nom_solide) - exec_nom (Translation_1,nom) + def _cree_face_mediane_plane_0( + self, solide, caract_face_1, caract_face_2, tb_caract, n_recur + ): + """Crée la face médiane entre deux autres - cas des surfaces planes -# 6. Intersection de la face cylindrique avec le solide initial - face = self._creation_face_inter ( nom ) + Décodage des caractéristiques - return face + Entrées : + :solide: l'objet solide à traiter + :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes + :tb_caract: tableau des caractéristiques géométriques des faces + :n_recur: niveau de récursivité -#=========================== Fin de la méthode ================================== + Sorties : + :coo_x, coo_y, coo_z: coordonnées du centre de la base + :vnor_x, vnor_y, vnor_z: coordonnées du vecteur normal + :taille: estimation de la taille de la future face + :d_face_1_2: la distance entre les deux faces""" -#=========================== Début de la méthode ================================= + nom_fonction = __name__ + "/_cree_face_mediane_plane_0" + blabla = "Dans {} :".format(nom_fonction) - def _cree_face_mediane_sphere ( self, caract_face_1, caract_face_2, n_recur ): - """Crée la face médiane entre deux autres - cas des sphères + if self._verbose_max: + print_tab(n_recur, blabla) + print_tab(n_recur, "caract_face_1 : ", caract_face_1) + print_tab(n_recur, "caract_face_2 : ", caract_face_2) + + # 1. Caractéristiques de la base + # Coordonnées du centre de la base + coo_x = caract_face_1[2][1] + coo_y = caract_face_1[2][2] + coo_z = caract_face_1[2][3] + # Coordonnées du vecteur normal + vnor_x = caract_face_1[2][4] + vnor_y = caract_face_1[2][5] + vnor_z = caract_face_1[2][6] + + # 2. Taille + + # taille : une longueur caractéristique pour être certain de tout prendre + l_diag = self._calcul_lg_caract_0(solide, tb_caract, n_recur) + taille = 10.0 * l_diag + if self._verbose_max: + print_tab(n_recur, "Taille englobante : ", taille) -Entrées : - :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes - :n_recur: niveau de récursivité + # 3. Distance entre les deux faces + face_1 = caract_face_1[0] + face_2 = caract_face_2[0] + d_face_1_2 = GeomAlgoAPI_ShapeTools.minimalDistance(face_1, face_2) + if self._verbose_max: + print_tab(n_recur, "Distance entre les deux faces = ", d_face_1_2) -Sorties : - :face: la face médiane -""" + return coo_x, coo_y, coo_z, vnor_x, vnor_y, vnor_z, taille, d_face_1_2 - nom_fonction = __name__ + "/_cree_face_mediane_sphere" - blabla = "Dans {} :".format(nom_fonction) + # =========================== Fin de la méthode ================================== -# Les deux faces - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "face_1 : ", caract_face_1) - print_tab (n_recur, "face_2 : ", caract_face_2) + # =========================== Début de la méthode ================================= -# Caractéristiques des sphères - coo_x, coo_y, coo_z, rayon, epaisseur = self._cree_face_mediane_sphere_0 ( caract_face_1, caract_face_2, n_recur ) + def _cree_face_mediane_plane_1( + self, solide, coo_c, vnor, taille, d_face_1_2, n_recur + ): + """Crée la face médiane entre deux autres - cas des surfaces planes -# Contrôle de la validité de l'épaisseur - erreur = self._verif_epaisseur ( epaisseur ) + Création des objets de construction et de la face médiane -# Création de la face - if not erreur: - face = self._cree_face_mediane_sphere_1 ( coo_x, coo_y, coo_z, rayon ) - else: - face = None + Entrées : + :solide: l'objet solide à traiter + :coo_c: coordonnées du centre de la base + :vnor: coordonnées du vecteur normal + :taille: estimation de la taille de la future face + :d_face_1_2: la distance entre les deux faces + :n_recur: niveau de récursivité - return erreur, face + Sorties : + :face: la face médiane""" -#=========================== Fin de la méthode ================================== + nom_fonction = __name__ + "/_cree_face_mediane_plane_1" + blabla = "Dans {} :".format(nom_fonction) + if self._verbose_max: + print_tab(n_recur, blabla) + print_tab( + n_recur, "Centre : ({}, {}, {})".format(coo_c[0], coo_c[1], coo_c[2]) + ) + print_tab( + n_recur, "Normale : ({}, {}, {})".format(vnor[0], vnor[1], vnor[2]) + ) + print_tab(n_recur, "Taille : ", taille) + print_tab(n_recur, "Distance entre les deux faces : ", d_face_1_2) -#=========================== Début de la méthode ================================= + # 1. Préalables + _, v_norm, plan = self._cree_centre_axe_plan( + coo_c, vnor, self.nom_solide, n_recur + ) - def _cree_face_mediane_sphere_0 ( self, caract_face_1, caract_face_2, n_recur ): - """Crée la face médiane entre deux autres - cas des sphères + # 2. Création de l'esquisse + sketch = self._cree_face_mediane_plane_1_a(plan, taille, n_recur) -Décodage des caractéristiques + # 3. La face + face = self._cree_face_mediane_plane_1_b( + solide, sketch, v_norm, d_face_1_2, n_recur + ) -Entrées : - :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes - :n_recur: niveau de récursivité + # print ("fin de {}".format(nom_fonction)) -Sorties : - :coo_x, coo_y, coo_z: coordonnées du centre de la sphère - :rayon: rayon moyen entre les deux faces - :epaisseur: épaisseur de l'interface entre les deux faces -""" + return face - nom_fonction = __name__ + "/_cree_face_mediane_sphere_0" - blabla = "Dans {} :".format(nom_fonction) + # =========================== Fin de la méthode ================================== -# Les deux faces - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "face_1 : ", caract_face_1) - print_tab (n_recur, "face_2 : ", caract_face_2) + # =========================== Début de la méthode ================================= -# Coordonnées du centre de la sphère - coo_x = caract_face_1[2][1] - coo_y = caract_face_1[2][2] - coo_z = caract_face_1[2][3] -# Rayons - rayon = (caract_face_2[2][4]+caract_face_1[2][4])/2. -# Epaisseur - epaisseur = np.abs(caract_face_2[2][4]-caract_face_1[2][4]) + def _cree_face_mediane_plane_1_a(self, plan, taille, n_recur): + """Crée la face médiane entre deux autres - cas des surfaces planes - l'esquisse - return coo_x, coo_y, coo_z, rayon, epaisseur + Entrées : + :plan: plan + :taille: estimation de la taille de la future face + :n_recur: niveau de récursivité -#=========================== Fin de la méthode ================================== + Sorties : + :sketch: l'esquisse""" -#=========================== Début de la méthode ================================= + nom_fonction = __name__ + "/_cree_face_mediane_plane_1_a" + blabla = "Dans {} :".format(nom_fonction) + if self._verbose_max: + print_tab(n_recur, blabla) + print_tab(n_recur, "Plan : {}".format(plan.name())) + print_tab(n_recur, "taille : {}".format(taille)) + + sketch = model.addSketch(self.part_doc, model.selection("FACE", plan.name())) + sketch.execute(True) + + ### Create SketchLine + SketchLine_1 = sketch.addLine( + -taille / 2.0, taille / 2.0, taille / 2.0, taille / 2.0 + ) + SketchLine_1.execute(True) + + ### Create SketchLine + SketchLine_2 = sketch.addLine( + taille / 2.0, taille / 2.0, taille / 2.0, -taille / 2.0 + ) + SketchLine_2.execute(True) + + ### Create SketchLine + SketchLine_3 = sketch.addLine( + taille / 2.0, -taille / 2.0, -taille / 2.0, -taille / 2.0 + ) + SketchLine_3.execute(True) + + ### Create SketchLine + SketchLine_4 = sketch.addLine( + -taille / 2.0, -taille / 2.0, -taille / 2.0, taille / 2.0 + ) + SketchLine_4.execute(True) - def _cree_face_mediane_sphere_1 ( self, coo_x, coo_y, coo_z, rayon ): - """Crée la face médiane entre deux autres - cas des sphères + model.do() -Création des objets de construction et de la face externe de la sphère support + nom_sketch = "{}_esquisse".format(self.nom_solide) + exec_nom(sketch, nom_sketch) -Entrées : - :coo_x, coo_y, coo_z: coordonnées du centre de la sphère - :rayon: rayon moyen entre les deux faces + # print ("fin de {}".format(nom_fonction)) -Sorties : - :face: la face externe de la sphère support -""" + return sketch - nom_fonction = __name__ + "/_cree_face_mediane_sphere_1" - blabla = "Dans {} :\n".format(nom_fonction) + # =========================== Fin de la méthode ================================== -# Les caractéristiques de la sphère à créer - if self._verbose_max: - texte = blabla - texte += "Centre : ({}, {}, {})\n".format(coo_x, coo_y, coo_z) - texte += "Rayon : {}".format(rayon) - print (texte) + # =========================== Début de la méthode ================================= -# 1. Création du point central - centre = model.addPoint(self.part_doc, coo_x, coo_y, coo_z) - nom_centre = "{}_centre".format(self.nom_solide) - exec_nom (centre,nom_centre) - if self.fonction_0 is None: - self.fonction_0 = centre + def _cree_face_mediane_plane_1_b(self, solide, sketch, v_norm, d_face_1_2, n_recur): + """Crée la face médiane entre deux autres - cas des surfaces planes -# 2. Création de la sphère en volume, de rayon médian - Sphere_1 = model.addSphere(self.part_doc, model.selection("VERTEX", nom_centre), rayon) - nom = "{}_Sphere_1".format(self.nom_solide) - exec_nom (Sphere_1,nom) + Création de la face médiane -# 3. Création de la sphère en surface - sphere = self._creation_face_surface ( nom, "sphere" ) + Entrées : + :solide: l'objet solide à traiter + :sketch: l'esquisse + :v_norm: vecteur normal + :d_face_1_2: la distance entre les deux faces + :n_recur: niveau de récursivité -# 4. Intersection de la face sphérique avec le solide initial - face = self._creation_face_inter ( sphere.name() ) + Sorties : + :face: la face médiane""" - return face + nom_fonction = __name__ + "/_cree_face_mediane_plane_1_b" + blabla = "Dans {} :".format(nom_fonction) + if self._verbose_max: + print_tab(n_recur, blabla) + print_tab(n_recur, "Esquisse : ", sketch.name()) + print_tab(n_recur, "Distance entre les deux faces : ", d_face_1_2) + + # 1. Copie du solide pour gérer les intersections + # Copy_1 = model.addCopy(self.part_doc, [model.selection("COMPOUND", "all-in-{}".format(self.nom_solide_aux))], 1) + Copy_1 = model.addMultiTranslation( + self.part_doc, + [model.selection("SOLID", self.nom_solide_aux)], + model.selection("EDGE", "PartSet/OX"), + 0, + 1, + keepSubResults=True, + ) + nom = "{}_Copy_1".format(self.nom_solide_aux) + exec_nom(Copy_1, nom) + if self._verbose_max: + print_tab(n_recur, "Après addMultiTranslation Copy_1 de nom ", nom) + nom_solide = Copy_1.result().name() -#=========================== Fin de la méthode ================================== + ### Create Recover + Recover_1 = model.addRecover(self.part_doc, Copy_1, [solide]) + nom = "{}_Recover_1".format(self.nom_solide_aux) + exec_nom(Recover_1, nom) + if self._verbose_max: + print_tab(n_recur, "Après addRecover Recover_1 de nom ", nom) + + # 2. Création d'une face ; on la translate d'une demi-épaisseur. + for iaux in range(2): + # 2.1. Création d'une face à partir du sketch et translation perpendiculaire au plan de la face + # On essaie les 2 côtés alternativement car on ne sait pas lequel sera le bon + + d_trans = -0.5 * d_face_1_2 * float(2 * iaux - 1) + + face = self._cree_face_mediane_plane_2( + sketch.name(), v_norm.name(), nom_solide, d_trans, iaux, n_recur + ) + + # 2.2. Si on est du bon côté, alors on intersecte la face avec le solide et c'est bon + if face.results(): + face = self._cree_face_mediane_plane_11(face, Recover_1, n_recur) + break + + # 2.3. Si l'intersection est vide, on crée une nouvelle copie du solide avant de tester l'autre côté + else: + if self._verbose_max: + print_tab( + n_recur, "L'intersection est vide. On essaie l'autre côté" + ) + + ### Create LinearCopy + # Copy_2 = model.addCopy(self.part_doc, [model.selection("COMPOUND", "all-in-{}".format(self.nom_solide_aux))], 1) + Copy_2 = model.addMultiTranslation( + self.part_doc, + [model.selection("SOLID", Recover_1.result().name())], + model.selection("EDGE", "PartSet/OX"), + 0, + 1, + keepSubResults=True, + ) + nom = "{}_Copy_2".format(self.nom_solide_aux) + exec_nom(Copy_2, nom) + if self._verbose_max: + print_tab(n_recur, "Après addMultiTranslation Copy_2 de nom ", nom) + nom_solide = Copy_2.result().name() + + # print ("fin de {}".format(nom_fonction)) + + return face + + # =========================== Fin de la méthode ================================== + + # =========================== Début de la méthode ================================= + + def _cree_face_mediane_plane_11(self, face, Recover_1, n_recur): + """Crée la face médiane entre deux autres - cas des surfaces planes + + Création des objets de construction et de la face médiane + + Entrées : + :face: la face médiane + :Recover_1: la récupératiuon du solide + :n_recur: niveau de récursivité + + Sorties : + :face: la face médiane""" + + nom_fonction = __name__ + "/_cree_face_mediane_plane_11" + blabla = "Dans {} :".format(nom_fonction) + if self._verbose_max: + print_tab(n_recur, blabla) + print_tab(n_recur, "face : ", face.name()) + + # Si on traite un objet solide unique, on le récupère + if self.nom_solide_aux == self.objet_principal.name(): + if self._verbose_max: + print_tab( + n_recur, "On traite un objet solide unique ==> on le récupère." + ) + Recover_2 = model.addRecover(self.part_doc, face, [Recover_1.result()]) + nom = "{}_Recover_2".format(self.nom_solide_aux) + exec_nom(Recover_2, nom) + + nb_inter = face.result().numberOfSubs() + if self._verbose_max: + print_tab(n_recur, "Nombre d'intersections : ", nb_inter) -#=========================== Début de la méthode ================================= + if nb_inter > 1: + face = self._cree_face_mediane_plane_3(face) - def _cree_face_mediane_tore ( self, caract_face_1, caract_face_2, n_recur ): - """Crée la face médiane entre deux autres - cas des tores + return face -Entrées : - :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes - :n_recur: niveau de récursivité + # =========================== Fin de la méthode ================================== -Sorties : - :face: la face médiane -""" + # =========================== Début de la méthode ================================= - nom_fonction = __name__ + "/_cree_face_mediane_tore" - blabla = "Dans {} :".format(nom_fonction) + def _cree_face_mediane_plane_2( + self, nom_sketch, nom_normal, nom_solide, d_trans, icpt, n_recur + ): + """Crée la face médiane entre deux autres - cas des surfaces planes -# Les deux faces - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "face_1 : ", caract_face_1) - print_tab (n_recur, "face_2 : ", caract_face_2) + Intersection de la face avec le solide -# Caractéristiques des tores - coo_x, coo_y, coo_z, axe_x, axe_y, axe_z, rayon_1, rayon_2 = self._cree_face_mediane_tore_0 ( caract_face_1, caract_face_2, n_recur ) + Entrées : + :nom_sketch: nom de l'esquisse + :nom_normal: nom du vecteur normal + :nom_solide: nom du solide à intersecter + :d_trans: la distance de translation + :icpt: numéro de la tentative -# Contrôle de la validité de l'épaisseur (bidon) - erreur = self._verif_epaisseur ( EP_MIN*10. ) + Sorties : + :face: la face médiane""" -# Création de la face - if not erreur: - face = self._cree_face_mediane_tore_1 ( coo_x, coo_y, coo_z, axe_x, axe_y, axe_z, rayon_1, rayon_2 ) - else: - face = None + nom_fonction = __name__ + "/_cree_face_mediane_plane_2" + blabla = "Dans {} :".format(nom_fonction) + if self._verbose_max: + print_tab(n_recur, blabla) + print_tab(n_recur, "nom_sketch : ", nom_sketch) + print_tab(n_recur, "nom_normal : ", nom_normal) + print_tab(n_recur, "nom_solide : ", nom_solide) + print_tab(n_recur, "d_trans : ", d_trans) + + # Création d'une face + Face_1 = model.addFace( + self.part_doc, [model.selection("COMPOUND", "all-in-{}".format(nom_sketch))] + ) + nom = "{}_Face_1_{}".format(self.nom_solide_aux, icpt) + exec_nom(Face_1, nom) + if self._verbose_max: + print_tab(n_recur, "Après addFace pour Face_1 de nom ", nom) + + # On la translate + Translation_1 = model.addTranslation( + self.part_doc, + [model.selection("FACE", Face_1.result().name())], + axis=model.selection("EDGE", nom_normal), + distance=d_trans, + keepSubResults=True, + ) + nom = "{}_trans_{}".format(self.nom_solide_aux, icpt) + exec_nom(Translation_1, nom) + if self._verbose_max: + print_tab(n_recur, "Après addTranslation pour Translation_1 de nom ", nom) + Translation_1.result().setColor(85, 0, 255) - return erreur, face + # Intersection de cette face avec le solide initial + face = self._creation_face_inter(Translation_1.result().name(), nom_solide) -#=========================== Fin de la méthode ================================== + return face -#=========================== Début de la méthode ================================= + # =========================== Fin de la méthode ================================== - def _cree_face_mediane_tore_0 ( self, caract_face_1, caract_face_2, n_recur ): - """Crée la face médiane entre deux autres - cas des tores + # =========================== Début de la méthode ================================= -Décodage des caractéristiques + def _cree_face_mediane_plane_3(self, face): + """Crée la face médiane entre deux autres - cas des surfaces planes -Entrées : - :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes - :n_recur: niveau de récursivité + Fusion des 2 intersections -Sorties : - :coo_x, coo_y, coo_z: coordonnées du centre du tore - :axe_x, axe_y, axe_z: coordonnées de l'axe - :rayon_1 : rayon principal - :rayon_2 : rayon secondaire -""" + Entrées : + :face: la face médiane composée de plusieurs intersections - nom_fonction = __name__ + "/_cree_face_mediane_tore_0" - blabla = "Dans {} :".format(nom_fonction) + Sorties : + :face_m: la face médiane""" -# Les deux faces - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "face_1 : ", caract_face_1) - print_tab (n_recur, "face_2 : ", caract_face_2) + nom_fonction = __name__ + "/_cree_face_mediane_plane_3" + blabla = "Dans {} :\n".format(nom_fonction) + if self._verbose_max: + texte = blabla + print(texte) -# Coordonnées du centre du tore - coo_x = caract_face_1[2][1] - coo_y = caract_face_1[2][2] - coo_z = caract_face_1[2][3] -# Coordonnées de l'axe - axe_x = caract_face_1[2][4] - axe_y = caract_face_1[2][5] - axe_z = caract_face_1[2][6] -# Rayons - rayon_1 = caract_face_2[2][7] - rayon_2 = (caract_face_2[2][8]+caract_face_1[2][8])/2. + # Nommage des sous-objets + l_fuse = list() + for iaux in range(face.result().numberOfSubs()): + nom = "{}_common_{}".format(self.nom_solide_aux, iaux) + face.result().subResult(iaux).setName(nom) + l_fuse.append(model.selection("FACE", "{}".format(nom))) - return coo_x, coo_y, coo_z, axe_x, axe_y, axe_z, rayon_1, rayon_2 + # Fusion + if self._verbose_max: + print("Fusion de {} faces.".format(len(l_fuse))) + face_m = model.addFuse(self.part_doc, l_fuse, keepSubResults=True) + face_m.execute(True) -#=========================== Fin de la méthode ================================== + return face_m -#=========================== Début de la méthode ================================= + # =========================== Fin de la méthode ================================== - def _cree_face_mediane_tore_1 ( self, coo_x, coo_y, coo_z, axe_x, axe_y, axe_z, rayon_1, rayon_2 ): - """Crée la face médiane entre deux autres - cas des tores + # =========================== Début de la méthode ================================= -Création des objets de construction et de la face externe du tore support + def _cree_face_mediane_cylindre( + self, solide, caract_face_1, caract_face_2, n_recur + ): + """Crée la face médiane entre deux autres - cas des cylindres -Entrées : - :coo_x, coo_y, coo_z: coordonnées du centre du tore - :axe_x, axe_y, axe_z: coordonnées de l'axe - :rayon_1 : rayon principal - :rayon_2 : rayon secondaire + Entrées : + :solide: solide SHAPER à traiter + :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes + :n_recur: niveau de récursivité -Sorties : - :face: la face externe du tore support -""" + Sorties : + :face: la face médiane""" - nom_fonction = __name__ + "/_cree_face_mediane_tore_1" - blabla = "Dans {} :\n".format(nom_fonction) + nom_fonction = __name__ + "/_cree_face_mediane_cylindre" + blabla = "Dans {} :".format(nom_fonction) -# Les deux faces - if self._verbose_max: - texte = blabla - texte += "Centre : ({}, {}, {})\n".format(coo_x, coo_y, coo_z) - texte += "Axe : ({}, {}, {})\n".format(axe_x, axe_y, axe_z) - texte += "Rayon principal : {}\n".format(rayon_1) - texte += "Rayon secondaire : {}".format(rayon_2) - print (texte) + # Les deux faces + if self._verbose_max: + print_tab(n_recur, blabla) + print_tab(n_recur, "face_1 : ", caract_face_1) + print_tab(n_recur, "face_2 : ", caract_face_2) + + # Caractéristiques des cylindres + ( + coo_x, + coo_y, + coo_z, + axe_x, + axe_y, + axe_z, + rayon, + hauteur, + epaisseur, + ) = self._cree_face_mediane_cylindre_0( + solide, caract_face_1, caract_face_2, n_recur + ) + + # Contrôle de la validité de l'épaisseur + erreur = self._verif_epaisseur(epaisseur) + + # Création de la face, de couleur bleue si problème + if not erreur: + face = self._cree_face_mediane_cylindre_1( + (coo_x, coo_y, coo_z), (axe_x, axe_y, axe_z), rayon, hauteur, n_recur + ) + else: + couleur_objet( + solide, + n_recur, + coul_r=0, + coul_g=0, + coul_b=255, + verbose=self._verbose_max, + ) + face = None -# 1. Création du point central - centre = model.addPoint(self.part_doc, coo_x, coo_y, coo_z) - nom_centre = "{}_centre".format(self.nom_solide) - exec_nom (centre,nom_centre) + return erreur, face -# 2. Création de l'axe - axe = model.addAxis(self.part_doc, axe_x, axe_y, axe_z) - nom_axe = "{}_axe".format(self.nom_solide) - exec_nom (axe,nom_axe) + # =========================== Fin de la méthode ================================== -# 3. Création du tore en volume, de rayon médian - Tore_1 = model.addTorus(self.part_doc, model.selection("VERTEX", nom_centre), model.selection("EDGE", nom_axe), rayon_1, rayon_2) - nom = "{}_Tore_1".format(self.nom_solide) - exec_nom (Tore_1,nom) + # =========================== Début de la méthode ================================= -# 4. Création du tore en surface - tore = self._creation_face_surface ( nom, "tore" ) + def _cree_face_mediane_cylindre_0( + self, solide, caract_face_1, caract_face_2, n_recur + ): + """Crée la face médiane entre deux autres - cas des cylindres -# 5. Intersection de la face torique avec le solide initial - face = self._creation_face_inter ( tore.name() ) + Décodage des caractéristiques - return face + Entrées : + :solide: l'objet solide à traiter + :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes + :n_recur: niveau de récursivité -#=========================== Fin de la méthode ================================== + Sorties : + :coo_x, coo_y, coo_z: coordonnées du centre de la base + :axe_x, axe_y, axe_z: coordonnées de l'axe + :rayon: rayon moyen entre les deux faces + :hauteur: hauteur du cylindre + :epaisseur: épaisseur de l'interface entre les deux faces""" -#=========================== Début de la méthode ================================= + nom_fonction = __name__ + "/_cree_face_mediane_cylindre_0" + blabla = "Dans {} :".format(nom_fonction) - def _cree_face_mediane_cone ( self, caract_face_1, caract_face_2, n_recur ): - """Crée la face médiane entre deux autres - cas des cônes + if self._verbose_max: + print_tab(n_recur, blabla) + print_tab(n_recur, "face_1 : ", caract_face_1) + print_tab(n_recur, "face_2 : ", caract_face_2) + + # Coordonnées du centre de la base + coo_x = caract_face_1[2][1] + coo_y = caract_face_1[2][2] + coo_z = caract_face_1[2][3] + # Coordonnées de l'axe + axe_x = caract_face_1[2][4] + axe_y = caract_face_1[2][5] + axe_z = caract_face_1[2][6] + # Rayons + rayon = (caract_face_2[2][7] + caract_face_1[2][7]) / 2.0 + # Hauteur : une longueur caractéristique pour être certain de tout prendre + l_diag = self._calcul_lg_caract_1(solide, n_recur) + hauteur = 10.0 * l_diag + if self._verbose_max: + print_tab(n_recur, "Hauteur englobante : ", hauteur) + # Epaisseur + epaisseur = np.abs(caract_face_2[2][7] - caract_face_1[2][7]) -Entrées : - :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes - :n_recur: niveau de récursivité + return coo_x, coo_y, coo_z, axe_x, axe_y, axe_z, rayon, hauteur, epaisseur -Sorties : - :face: la face médiane -""" + # =========================== Fin de la méthode ================================== - nom_fonction = __name__ + "/_cree_face_mediane_cone" - blabla = "Dans {} :".format(nom_fonction) + # =========================== Début de la méthode ================================= -# Les deux faces - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "face_1 : ", caract_face_1) - print_tab (n_recur, "face_2 : ", caract_face_2) + def _cree_face_mediane_cylindre_1(self, coo_c, v_axe, rayon, hauteur, n_recur): + """Crée la face médiane entre deux autres - cas des cylindres -# Caractéristiques des cônes - coo_x, coo_y, coo_z, axe_x, axe_y, axe_z, rayon_1, rayon_2, hauteur = self._cree_face_mediane_cone_0 ( caract_face_1, caract_face_2, n_recur ) + Création des objets temporaires et de la face externe du cylindre support -# Contrôle de la validité de l'épaisseur (bidon) - erreur = self._verif_epaisseur ( EP_MIN*10. ) + Entrées : + :coo_x, coo_y, coo_z: coordonnées du centre de la base + :axe_x, axe_y, axe_z: coordonnées de l'axe + :rayon: rayon moyen entre les deux faces + :hauteur: hauteur du cylindre + :n_recur: niveau de récursivité -# Création de la face - if not erreur: - face = self._cree_face_mediane_cone_1 ( coo_x, coo_y, coo_z, axe_x, axe_y, axe_z, rayon_1, rayon_2, hauteur ) - else: - face = None + Sorties : + :face: la face médiane""" + nom_fonction = __name__ + "/_cree_face_mediane_cylindre_1" + blabla = "Dans {} :\n".format(nom_fonction) - return erreur, face + # Les caractéristiques du cylindre à créer + if self._verbose_max: + print_tab(n_recur, blabla) + print_tab( + n_recur, "Centre : ({}, {}, {})".format(coo_c[0], coo_c[1], coo_c[2]) + ) + print_tab( + n_recur, "Axe : ({}, {}, {})".format(v_axe[0], v_axe[1], v_axe[2]) + ) + print_tab(n_recur, "Rayon : ", rayon) + print_tab(n_recur, "Hauteur : ", hauteur) + + # 1. Création du point central + centre = model.addPoint(self.part_doc, coo_c[0], coo_c[1], coo_c[2]) + nom_centre = "{}_centre".format(self.nom_solide) + exec_nom(centre, nom_centre) + if self.fonction_0 is None: + self.fonction_0 = centre + + # 2. Création du vecteur axial + axe = model.addAxis(self.part_doc, v_axe[0], v_axe[1], v_axe[2]) + nom_axe = "{}_vecteur".format(self.nom_solide) + exec_nom(axe, nom_axe) + + # 3. Création du cylindre en volume, de rayon médian + Cylinder_1 = model.addCylinder( + self.part_doc, + model.selection("VERTEX", nom_centre), + model.selection("EDGE", nom_axe), + rayon, + hauteur, + ) + nom = "{}_Cylinder_1".format(self.nom_solide) + exec_nom(Cylinder_1, nom) + + # 4. Création du cylindre en surface + cylindre = self._creation_face_surface(nom, "cylindre") + + # 5. Mise en place + Translation_1 = model.addTranslation( + self.part_doc, + [model.selection("COMPOUND", cylindre.name())], + axis=model.selection("EDGE", nom_axe), + distance=-0.5 * hauteur, + keepSubResults=True, + ) + nom = "{}_Translation_1".format(self.nom_solide) + exec_nom(Translation_1, nom) + + # 6. Intersection de la face cylindrique avec le solide initial + face = self._creation_face_inter(nom) + + return face + + # =========================== Fin de la méthode ================================== + + # =========================== Début de la méthode ================================= + + def _cree_face_mediane_sphere(self, caract_face_1, caract_face_2, n_recur): + """Crée la face médiane entre deux autres - cas des sphères + + Entrées : + :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes + :n_recur: niveau de récursivité + + Sorties : + :face: la face médiane""" + + nom_fonction = __name__ + "/_cree_face_mediane_sphere" + blabla = "Dans {} :".format(nom_fonction) + + # Les deux faces + if self._verbose_max: + print_tab(n_recur, blabla) + print_tab(n_recur, "face_1 : ", caract_face_1) + print_tab(n_recur, "face_2 : ", caract_face_2) -#=========================== Fin de la méthode ================================== + # Caractéristiques des sphères + coo_x, coo_y, coo_z, rayon, epaisseur = self._cree_face_mediane_sphere_0( + caract_face_1, caract_face_2, n_recur + ) -#=========================== Début de la méthode ================================= + # Contrôle de la validité de l'épaisseur + erreur = self._verif_epaisseur(epaisseur) - def _cree_face_mediane_cone_0 ( self, caract_face_1, caract_face_2, n_recur ): - """Crée la face médiane entre deux autres - cas des cônes + # Création de la face + if not erreur: + face = self._cree_face_mediane_sphere_1(coo_x, coo_y, coo_z, rayon) + else: + face = None -Décodage des caractéristiques + return erreur, face -Entrées : - :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes - :n_recur: niveau de récursivité + # =========================== Fin de la méthode ================================== -Sorties : - :coo_x, coo_y, coo_z: coordonnées du centre de la base - :axe_x, axe_y, axe_z: coordonnées de l'axe - :rayon_1, rayon_2: rayons moyens du côté de la base et à l'opposé - :hauteur: hauteur du cône -""" + # =========================== Début de la méthode ================================= - nom_fonction = __name__ + "/_cree_face_mediane_cone_0" - blabla = "Dans {} :".format(nom_fonction) + def _cree_face_mediane_sphere_0(self, caract_face_1, caract_face_2, n_recur): + """Crée la face médiane entre deux autres - cas des sphères -# Les deux faces - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "face_1 : ", caract_face_1) - print_tab (n_recur, "face_2 : ", caract_face_2) - -# Coordonnées du centre de la base - coo_x = caract_face_1[2][1] - coo_y = caract_face_1[2][2] - coo_z = caract_face_1[2][3] -# Coordonnées de l'axe - axe_x = caract_face_1[2][4] - axe_y = caract_face_1[2][5] - axe_z = caract_face_1[2][6] -# Rayons - rayon_1 = (caract_face_2[2][7]+caract_face_1[2][7])/2. - rayon_2 = (caract_face_2[2][8]+caract_face_1[2][8])/2. -# Hauteur - hauteur = caract_face_1[2][9] - -# Bilan - if self._verbose_max: - print_tab (n_recur, "coo_x : ", coo_x) - print_tab (n_recur, "coo_y : ", coo_y) - print_tab (n_recur, "coo_z : ", coo_z) - print_tab (n_recur, "axe_x : ", axe_x) - print_tab (n_recur, "axe_y : ", axe_y) - print_tab (n_recur, "axe_z : ", axe_z) - print_tab (n_recur, "rayon_1 : ", rayon_1) - print_tab (n_recur, "rayon_2 : ", rayon_2) - print_tab (n_recur, "hauteur : ", hauteur) - - return coo_x, coo_y, coo_z, axe_x, axe_y, axe_z, rayon_1, rayon_2, hauteur - -#=========================== Fin de la méthode ================================== - -#=========================== Début de la méthode ================================= - - def _cree_face_mediane_cone_1 ( self, coo_x, coo_y, coo_z, axe_x, axe_y, axe_z, rayon_1, rayon_2, hauteur ): - """Crée la face médiane entre deux autres - cas des cônes - -Création des objets de construction et de la face externe du cône support - -Entrées : - :coo_x, coo_y, coo_z: coordonnées du centre de la base - :axe_x, axe_y, axe_z: coordonnées de l'axe - :rayon_1, rayon_2: rayons moyens du côté de la base et à l'opposé - :hauteur: hauteur du cône - -Sorties : - :face: la face externe du cône support -""" - nom_fonction = __name__ + "/_cree_face_mediane_cone_1" - blabla = "Dans {} :\n".format(nom_fonction) + Décodage des caractéristiques -# Les deux faces - if self._verbose_max: - texte = blabla - texte += "Centre : ({}, {}, {})\n".format(coo_x, coo_y, coo_z) - texte += "Axe : ({}, {}, {})\n".format(axe_x, axe_y, axe_z) - texte += "Rayons : {}, {}\n".format(rayon_1, rayon_2) - texte += "Hauteur : {}".format(hauteur) - print (texte) + Entrées : + :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes + :n_recur: niveau de récursivité -# 1. Création du point central de la base, côté rayon_1 - centre_1 = model.addPoint(self.part_doc, coo_x, coo_y, coo_z) - nom_centre_1 = "{}_centre_1".format(self.nom_solide) - exec_nom (centre_1,nom_centre_1) + Sorties : + :coo_x, coo_y, coo_z: coordonnées du centre de la sphère + :rayon: rayon moyen entre les deux faces + :epaisseur: épaisseur de l'interface entre les deux faces""" -# 2. Création du point central, du côté de rayon_2 - centre_2 = model.addPoint(self.part_doc, coo_x+hauteur*axe_x, coo_y+hauteur*axe_y, coo_z+hauteur*axe_z) - nom_centre_2 = "{}_centre_2".format(self.nom_solide) - exec_nom (centre_2,nom_centre_2) + nom_fonction = __name__ + "/_cree_face_mediane_sphere_0" + blabla = "Dans {} :".format(nom_fonction) -# 3. Création de l'axe - axe = model.addAxis(self.part_doc, model.selection("VERTEX", nom_centre_1), model.selection("VERTEX", nom_centre_2)) - nom_axe = "{}_axe".format(self.nom_solide) - exec_nom (axe,nom_axe) + # Les deux faces + if self._verbose_max: + print_tab(n_recur, blabla) + print_tab(n_recur, "face_1 : ", caract_face_1) + print_tab(n_recur, "face_2 : ", caract_face_2) -# 4. Création du cône en volume, de rayon médian -# 4.1. Calculs des rayons haut et bas, de sa hauteur et de la valeur de la translation - rayon_b, rayon_s, hauteur_c, d_trans = self._cree_face_mediane_cone_2 ( rayon_1, rayon_2, hauteur ) + # Coordonnées du centre de la sphère + coo_x = caract_face_1[2][1] + coo_y = caract_face_1[2][2] + coo_z = caract_face_1[2][3] + # Rayons + rayon = (caract_face_2[2][4] + caract_face_1[2][4]) / 2.0 + # Epaisseur + epaisseur = np.abs(caract_face_2[2][4] - caract_face_1[2][4]) -# 4.2. Création du grand cône - Cone_1 = model.addCone(self.part_doc, model.selection("VERTEX", nom_centre_1), model.selection("EDGE", nom_axe), rayon_b, rayon_s, hauteur_c) - nom_1 = "{}_Cone_1".format(self.nom_solide) - exec_nom (Cone_1,nom_1) + return coo_x, coo_y, coo_z, rayon, epaisseur -# 4.3. Translation pour superposer au cône de départ - Translation_1 = model.addTranslation(self.part_doc, [model.selection("SOLID", nom_1)], axis = model.selection("EDGE", nom_axe), distance = d_trans, keepSubResults = True) - nom_2 = "{}_Cone_1_trans".format(self.nom_solide) - exec_nom (Translation_1,nom_2) + # =========================== Fin de la méthode ================================== -# 5. Création du cône en surface - nom = "{}/MF:Translated&{}".format(nom_2,nom_1) - cone = self._creation_face_surface ( nom, "cone" ) + # =========================== Début de la méthode ================================= -# 6. Intersection de la face conique avec le solide initial - face = self._creation_face_inter ( cone.name() ) + def _cree_face_mediane_sphere_1(self, coo_x, coo_y, coo_z, rayon): + """Crée la face médiane entre deux autres - cas des sphères - return face + Création des objets de construction et de la face externe de la sphère support -#=========================== Fin de la méthode ================================== + Entrées : + :coo_x, coo_y, coo_z: coordonnées du centre de la sphère + :rayon: rayon moyen entre les deux faces -#=========================== Début de la méthode ================================= + Sorties : + :face: la face externe de la sphère support""" - def _cree_face_mediane_cone_2 ( self, rayon_1, rayon_2, hauteur ): - """Crée la face médiane entre deux autres - cas des cônes + nom_fonction = __name__ + "/_cree_face_mediane_sphere_1" + blabla = "Dans {} :\n".format(nom_fonction) -Calcul des caractéristiques du cône enveloppant. Merci Thalès ! -Le coefficient multiplicateur est choisi pour être certain de tout prendre. On calcule la -plus petite valeur et on ajoute arbitrairement 5. + # Les caractéristiques de la sphère à créer + if self._verbose_max: + texte = blabla + texte += "Centre : ({}, {}, {})\n".format(coo_x, coo_y, coo_z) + texte += "Rayon : {}".format(rayon) + print(texte) -Remarque : on ne peut pas avoir un cône pointu car il est situé entre deux cônes donc il y a une épaisseur. + # 1. Création du point central + centre = model.addPoint(self.part_doc, coo_x, coo_y, coo_z) + nom_centre = "{}_centre".format(self.nom_solide) + exec_nom(centre, nom_centre) + if self.fonction_0 is None: + self.fonction_0 = centre -Entrées : - :rayon_1, rayon_2: rayons moyens du côté de la base et à l'opposé - :hauteur: hauteur du cône + # 2. Création de la sphère en volume, de rayon médian + Sphere_1 = model.addSphere( + self.part_doc, model.selection("VERTEX", nom_centre), rayon + ) + nom = "{}_Sphere_1".format(self.nom_solide) + exec_nom(Sphere_1, nom) -Sorties : - :rayon_b: rayon du cône - partie basse - :rayon_s: rayon du cône - partie supérieure - :hauteur_c: hauteur du cône - :d_trans: distance de translation selon l'axe -""" - nom_fonction = __name__ + "/_cree_face_mediane_cone_2" - blabla = "Dans {} :\n".format(nom_fonction) + # 3. Création de la sphère en surface + sphere = self._creation_face_surface(nom, "sphere") -# Objectif - if self._verbose_max: - texte = blabla - texte += "rayon_1 : {}\n".format(rayon_1) - texte += "rayon_2 : {}\n".format(rayon_2) - texte += "Hauteur : {}".format(hauteur) - print (texte) - - bonus = 5. - -# 1. Cas étroit en bas - if ( rayon_1 < rayon_2 ): -# Distance entre la pointe et la base - coeff_a = rayon_1/(rayon_2-rayon_1) - d_pointe_base = hauteur*coeff_a - coeff = coeff_a + 1. + bonus - if self._verbose_max: - print ("Cas étroit en bas") - print ("Distance de la pointe à la base : {}*{} = {}".format(coeff_a,hauteur,d_pointe_base)) - rayon_b = 0. - rayon_s = coeff*(rayon_2-rayon_1) - d_trans = -d_pointe_base - -# 2. Cas étroit en haut -# Manifestement cela n'arrive jamais une fois passé par du step et réimporté dans SHAPER - else: -# Distance entre la pointe et le haut - coeff_a = rayon_1/(rayon_1-rayon_2) - d_pointe_haut = hauteur*coeff_a - coeff = coeff_a + 1. + bonus - if self._verbose_max: - print ("Cas étroit en haut") - print ("Distance de la pointe et le haut : {}*{} = {}".format(coeff_a,hauteur,d_pointe_haut)) - rayon_b = coeff*(rayon_1-rayon_2) - rayon_s = 0. - d_trans = -bonus*hauteur - -# 3. La hauteur - hauteur_c = coeff*hauteur - - if self._verbose_max: - texte = "rayon_b : {}\n".format(rayon_b) - texte += "rayon_s : {}\n".format(rayon_s) - texte += "Translation : {}".format(d_trans) - print (texte) - - return rayon_b, rayon_s, hauteur_c, d_trans - -#=========================== Fin de la méthode ================================== - -#=========================== Début de la méthode ================================= - - def _cree_centre_axe_plan ( self, coo_c, vect, prefixe, n_recur ): - """Crée un centre, un axe, un plan - -Entrées : - :coo_c: coordonnées du centre de la base - :vect: coordonnées du vecteur - :prefix: prefixe du nom des objets - :n_recur: niveau de récursivité - -Sorties : - :centre: centre - :normal: vecteur normal - :plan: plan -""" + # 4. Intersection de la face sphérique avec le solide initial + face = self._creation_face_inter(sphere.name()) - nom_fonction = __name__ + "/_cree_centre_axe_plan" - blabla = "Dans {} :".format(nom_fonction) - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "Centre : ({}, {}, {})".format(coo_c[0], coo_c[1], coo_c[2])) - print_tab (n_recur, "Normale : ({}, {}, {})".format(vect[0], vect[1], vect[2])) + return face -# Création du point central - centre = model.addPoint(self.part_doc, coo_c[0], coo_c[1], coo_c[2]) - nom_centre = "{}_centre".format(prefixe) - exec_nom (centre,nom_centre) - if self.fonction_0 is None: - self.fonction_0 = centre + # =========================== Fin de la méthode ================================== -# Création du vecteur - vecteur = model.addAxis(self.part_doc, vect[0], vect[1], vect[2]) - nom_vect = "{}_vecteur".format(prefixe) - exec_nom (vecteur,nom_vect) + # =========================== Début de la méthode ================================= -# Création du plan perpendiculaire au vecteur normal - plan = model.addPlane(self.part_doc, model.selection("EDGE", vecteur.name()), model.selection("VERTEX", centre.name()), True) - nom_plan = "{}_plan".format(prefixe) - exec_nom (plan,nom_plan) + def _cree_face_mediane_tore(self, caract_face_1, caract_face_2, n_recur): + """Crée la face médiane entre deux autres - cas des tores - #print ("fin de {}".format(nom_fonction)) + Entrées : + :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes + :n_recur: niveau de récursivité - return centre, vecteur, plan + Sorties : + :face: la face médiane""" -#=========================== Fin de la méthode ================================== + nom_fonction = __name__ + "/_cree_face_mediane_tore" + blabla = "Dans {} :".format(nom_fonction) -#=========================== Début de la méthode ================================= + # Les deux faces + if self._verbose_max: + print_tab(n_recur, blabla) + print_tab(n_recur, "face_1 : ", caract_face_1) + print_tab(n_recur, "face_2 : ", caract_face_2) + + # Caractéristiques des tores + ( + coo_x, + coo_y, + coo_z, + axe_x, + axe_y, + axe_z, + rayon_1, + rayon_2, + ) = self._cree_face_mediane_tore_0(caract_face_1, caract_face_2, n_recur) + + # Contrôle de la validité de l'épaisseur (bidon) + erreur = self._verif_epaisseur(EP_MIN * 10.0) + + # Création de la face + if not erreur: + face = self._cree_face_mediane_tore_1( + coo_x, coo_y, coo_z, axe_x, axe_y, axe_z, rayon_1, rayon_2 + ) + else: + face = None - def _calcul_lg_caract_0 ( self, objet, tb_caract, n_recur ): - """Crée une longueur caractéristique de l'objet formés de surfaces planes + return erreur, face -Les caractéristiques sont comme en IHM avec 'Inspection' : -. Si la face est un rectangle, la caractéristique est : - Xcoin, Ycoin, Zcoin, Xnormale, Ynormale, Znormale, Largeur, Hauteur -. Si la face est un polygone, elle est vue comme un plan et la caractéristique est : - Xcentre, Ycentre, Zcentre, Xnormale, Ynormale, Znormale -. Si la face est un disque, elle est vue comme un plan et la caractéristique est : - Xcentre, Ycentre, Zcentre, Xnormale, Ynormale, Znormale, Rayon + # =========================== Fin de la méthode ================================== -Si on se contente de raisonner avec la boîte englobante de la face, on a le risque qu'elle ne soit pas au bon endroit. + # =========================== Début de la méthode ================================= -Il faut ici calculer la dimension d'une boîte centrée sur l'origine qui englobe à coup sûr le solide. + def _cree_face_mediane_tore_0(self, caract_face_1, caract_face_2, n_recur): + """Crée la face médiane entre deux autres - cas des tores -Entrées : - :objet: l'objet à traiter - :tb_caract: tableau des caractéristiques géométriques des faces - :n_recur: niveau de récursivité + Décodage des caractéristiques -Sorties : - :l_caract: longueur caractéristique de l'objet -""" + Entrées : + :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes + :n_recur: niveau de récursivité - nom_fonction = __name__ + "/_calcul_lg_caract_0" - blabla = "Dans {} :".format(nom_fonction) + Sorties : + :coo_x, coo_y, coo_z: coordonnées du centre du tore + :axe_x, axe_y, axe_z: coordonnées de l'axe + :rayon_1 : rayon principal + :rayon_2 : rayon secondaire""" - if self._verbose_max: - print_tab (n_recur, blabla) - -# 1. On parcourt toutes les faces en repérant les rectangles. -# Pour ces rectangles on va calculer les plus grandes valeurs des coordonnées et des épaisseurs. - - avec_rectangle = False - xyz_max = 0. - d_max = 0. - for iaux, caract in enumerate(tb_caract): - if self._verbose_max: - print_tab (n_recur, "Face {} : ".format(iaux), caract) - if ( caract[-1][0] == "Rectangle" ): - avec_rectangle = True - xyz_max = max(xyz_max,abs(caract[-1][1]),abs(caract[-1][2]),abs(caract[-1][3])) - d_max = max(d_max,caract[-1][7],caract[-1][8]) - - if self._verbose_max: - print_tab (n_recur, "xyz_max : ", xyz_max) - print_tab (n_recur, "d_max : ", d_max) - -# 2. Longueur -# 2.1. S'il y avait des rectangles, on prend un cube plus grand - if avec_rectangle: - l_caract = (xyz_max+d_max)*np.sqrt(3.) -# 2.2. Sinon, on peut utiliser la formule classique - else: - l_caract = self._calcul_lg_caract_1 ( objet, n_recur ) + nom_fonction = __name__ + "/_cree_face_mediane_tore_0" + blabla = "Dans {} :".format(nom_fonction) - if self._verbose_max: - print_tab (n_recur, "Longueur caractéristique : ", l_caract) + # Les deux faces + if self._verbose_max: + print_tab(n_recur, blabla) + print_tab(n_recur, "face_1 : ", caract_face_1) + print_tab(n_recur, "face_2 : ", caract_face_2) - return l_caract + # Coordonnées du centre du tore + coo_x = caract_face_1[2][1] + coo_y = caract_face_1[2][2] + coo_z = caract_face_1[2][3] + # Coordonnées de l'axe + axe_x = caract_face_1[2][4] + axe_y = caract_face_1[2][5] + axe_z = caract_face_1[2][6] + # Rayons + rayon_1 = caract_face_2[2][7] + rayon_2 = (caract_face_2[2][8] + caract_face_1[2][8]) / 2.0 -#=========================== Fin de la méthode ================================== + return coo_x, coo_y, coo_z, axe_x, axe_y, axe_z, rayon_1, rayon_2 -#=========================== Début de la méthode ================================= + # =========================== Fin de la méthode ================================== - def _calcul_lg_caract_1 ( self, objet, n_recur ): - """Crée une longueur caractéristique de l'objet + # =========================== Début de la méthode ================================= -Entrées : - :objet: l'objet à traiter - :n_recur: niveau de récursivité + def _cree_face_mediane_tore_1( + self, coo_x, coo_y, coo_z, axe_x, axe_y, axe_z, rayon_1, rayon_2 + ): + """Crée la face médiane entre deux autres - cas des tores -Sorties : - :l_caract: longueur caractéristique de l'objet -""" + Création des objets de construction et de la face externe du tore support - nom_fonction = __name__ + "/_calcul_lg_caract_1" - blabla = "Dans {} :".format(nom_fonction) + Entrées : + :coo_x, coo_y, coo_z: coordonnées du centre du tore + :axe_x, axe_y, axe_z: coordonnées de l'axe + :rayon_1 : rayon principal + :rayon_2 : rayon secondaire - if self._verbose_max: - print_tab (n_recur, blabla) + Sorties : + :face: la face externe du tore support""" - properties = model.getGeometryCalculation(self.part_doc,model.selection("{}".format(objet.shapeType()), "{}".format(objet.name()))) - l_caract = properties[0] + nom_fonction = __name__ + "/_cree_face_mediane_tore_1" + blabla = "Dans {} :\n".format(nom_fonction) - if self._verbose_max: - print_tab (n_recur, "Longueur caractéristique : ", l_caract) + # Les deux faces + if self._verbose_max: + texte = blabla + texte += "Centre : ({}, {}, {})\n".format(coo_x, coo_y, coo_z) + texte += "Axe : ({}, {}, {})\n".format(axe_x, axe_y, axe_z) + texte += "Rayon principal : {}\n".format(rayon_1) + texte += "Rayon secondaire : {}".format(rayon_2) + print(texte) - return l_caract + # 1. Création du point central + centre = model.addPoint(self.part_doc, coo_x, coo_y, coo_z) + nom_centre = "{}_centre".format(self.nom_solide) + exec_nom(centre, nom_centre) -#=========================== Fin de la méthode ================================== + # 2. Création de l'axe + axe = model.addAxis(self.part_doc, axe_x, axe_y, axe_z) + nom_axe = "{}_axe".format(self.nom_solide) + exec_nom(axe, nom_axe) -#=========================== Début de la méthode ================================= + # 3. Création du tore en volume, de rayon médian + Tore_1 = model.addTorus( + self.part_doc, + model.selection("VERTEX", nom_centre), + model.selection("EDGE", nom_axe), + rayon_1, + rayon_2, + ) + nom = "{}_Tore_1".format(self.nom_solide) + exec_nom(Tore_1, nom) - def _cree_revolution ( self, nom_sketch, nom_centre, coo_x, coo_y, coo_z, axe_x, axe_y, axe_z, nom_objet ): - """Crée un volume de révolution + # 4. Création du tore en surface + tore = self._creation_face_surface(nom, "tore") -Entrées : - :nom_sketch: nom de l'esquisse à révolutionner - :nom_centre: nom du point associé au centre du volume de révolution - :coo_x, coo_y, coo_z: coordonnées du centre du tore - :axe_x, axe_y, axe_z: coordonnées de l'axe - :rayon_1 : rayon principal - :rayon_2 : rayon secondaire - :nom_objet: nom de l'objet 2D créé -""" + # 5. Intersection de la face torique avec le solide initial + face = self._creation_face_inter(tore.name()) - nom_fonction = __name__ + "/_cree_revolution" - blabla = "Dans {} :\n".format(nom_fonction) + return face - if self._verbose_max: - texte = blabla - texte += "Centre : ({}, {}, {})\n".format(coo_x, coo_y, coo_z) - texte += "Axe : ({}, {}, {})\n".format(axe_x, axe_y, axe_z) - print (texte) + # =========================== Fin de la méthode ================================== -# Création d'un point décalé par rapport au point central - point = model.addPoint(self.part_doc, coo_x+axe_x, coo_y+axe_y, coo_z+axe_z) - nom_point = "{}_point".format(self.nom_solide) - exec_nom (point,nom_point) + # =========================== Début de la méthode ================================= -# Création de l'axe de la rotation - axe_r = model.addAxis(self.part_doc, model.selection("VERTEX", nom_centre), model.selection("VERTEX", nom_point)) - nom_axe_r = "{}_axe_r".format(self.nom_solide) - exec_nom (axe_r,nom_axe_r) + def _cree_face_mediane_cone(self, caract_face_1, caract_face_2, n_recur): + """Crée la face médiane entre deux autres - cas des cônes -# Création de l'objet complet - objet = model.addRevolution(self.part_doc, [model.selection("COMPOUND", nom_sketch)], model.selection("EDGE", nom_axe_r), 360, 0, "Edges") - exec_nom (objet, nom_objet, (85, 0, 255)) + Entrées : + :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes + :n_recur: niveau de récursivité -#=========================== Fin de la méthode ================================== + Sorties : + :face: la face médiane""" -#=========================== Début de la méthode ================================= + nom_fonction = __name__ + "/_cree_face_mediane_cone" + blabla = "Dans {} :".format(nom_fonction) - def _creation_face_surface ( self, nom_objet, suffixe ): - """Crée la face qui est la surface externe d'un objet + # Les deux faces + if self._verbose_max: + print_tab(n_recur, blabla) + print_tab(n_recur, "face_1 : ", caract_face_1) + print_tab(n_recur, "face_2 : ", caract_face_2) + + # Caractéristiques des cônes + ( + coo_x, + coo_y, + coo_z, + axe_x, + axe_y, + axe_z, + rayon_1, + rayon_2, + hauteur, + ) = self._cree_face_mediane_cone_0(caract_face_1, caract_face_2, n_recur) + + # Contrôle de la validité de l'épaisseur (bidon) + erreur = self._verif_epaisseur(EP_MIN * 10.0) + + # Création de la face + if not erreur: + face = self._cree_face_mediane_cone_1( + coo_x, coo_y, coo_z, axe_x, axe_y, axe_z, rayon_1, rayon_2, hauteur + ) + else: + face = None -. Crée le groupe de la face externe -. Transforme le groupe en face résultat + return erreur, face -Entrées : - :nom_objet: nom de l'objet 3D à traiter - :suffixe: suffixe pour nommer l'objet 2D - :nom_solide: nom du solide initial ; si None, on prend self.nom_solide_aux + # =========================== Fin de la méthode ================================== -Sorties : - :objet_2d: l'objet 2D support de la face externe de l'objet 3D -""" + # =========================== Début de la méthode ================================= - nom_fonction = __name__ + "/_creation_face_surface" - blabla = "Dans {} :\n".format(nom_fonction) + def _cree_face_mediane_cone_0(self, caract_face_1, caract_face_2, n_recur): + """Crée la face médiane entre deux autres - cas des cônes - if self._verbose_max: - print (blabla) + Décodage des caractéristiques -# 1. Le groupe de la surface - groupe = model.addGroup(self.part_doc, "Faces", [model.selection("FACE", "{}/Face_1".format(nom_objet))]) - nom = "{}_{}_groupe".format(self.nom_solide,suffixe) - exec_nom (groupe, nom, (85, 0, 255)) + Entrées : + :caract_face_1, caract_face_2: les caractéristiques des 2 faces les plus grandes + :n_recur: niveau de récursivité -# 2. Création de la face en surface - objet_2d = model.addGroupShape(self.part_doc, [model.selection("COMPOUND", nom)]) - nom = "{}_{}".format(self.nom_solide,suffixe) - exec_nom (objet_2d, nom, (85, 0, 255)) + Sorties : + :coo_x, coo_y, coo_z: coordonnées du centre de la base + :axe_x, axe_y, axe_z: coordonnées de l'axe + :rayon_1, rayon_2: rayons moyens du côté de la base et à l'opposé + :hauteur: hauteur du cône""" - return objet_2d + nom_fonction = __name__ + "/_cree_face_mediane_cone_0" + blabla = "Dans {} :".format(nom_fonction) -#=========================== Fin de la méthode ================================== + # Les deux faces + if self._verbose_max: + print_tab(n_recur, blabla) + print_tab(n_recur, "face_1 : ", caract_face_1) + print_tab(n_recur, "face_2 : ", caract_face_2) + + # Coordonnées du centre de la base + coo_x = caract_face_1[2][1] + coo_y = caract_face_1[2][2] + coo_z = caract_face_1[2][3] + # Coordonnées de l'axe + axe_x = caract_face_1[2][4] + axe_y = caract_face_1[2][5] + axe_z = caract_face_1[2][6] + # Rayons + rayon_1 = (caract_face_2[2][7] + caract_face_1[2][7]) / 2.0 + rayon_2 = (caract_face_2[2][8] + caract_face_1[2][8]) / 2.0 + # Hauteur + hauteur = caract_face_1[2][9] + + # Bilan + if self._verbose_max: + print_tab(n_recur, "coo_x : ", coo_x) + print_tab(n_recur, "coo_y : ", coo_y) + print_tab(n_recur, "coo_z : ", coo_z) + print_tab(n_recur, "axe_x : ", axe_x) + print_tab(n_recur, "axe_y : ", axe_y) + print_tab(n_recur, "axe_z : ", axe_z) + print_tab(n_recur, "rayon_1 : ", rayon_1) + print_tab(n_recur, "rayon_2 : ", rayon_2) + print_tab(n_recur, "hauteur : ", hauteur) -#=========================== Début de la méthode ================================= + return coo_x, coo_y, coo_z, axe_x, axe_y, axe_z, rayon_1, rayon_2, hauteur - def _creation_face_inter ( self, nom_objet, nom_solide=None ): - """Crée la face par intersection entre l'objet initial et une face complète + # =========================== Fin de la méthode ================================== -. Repère la face principale de l'objet support -. Réalise l'intersection avec le solide initial + # =========================== Début de la méthode ================================= -Entrées : - :nom_objet: nom de l'objet 2D créé - :nom_solide: nom du solide initial ; si None, on prend self.nom_solide_aux + def _cree_face_mediane_cone_1( + self, coo_x, coo_y, coo_z, axe_x, axe_y, axe_z, rayon_1, rayon_2, hauteur + ): + """Crée la face médiane entre deux autres - cas des cônes -Sorties : - :face: la face externe de l'objet support intersecté avec le solide initial -""" + Création des objets de construction et de la face externe du cône support - nom_fonction = __name__ + "/_creation_face_inter" - blabla = "Dans {} :\n".format(nom_fonction) + Entrées : + :coo_x, coo_y, coo_z: coordonnées du centre de la base + :axe_x, axe_y, axe_z: coordonnées de l'axe + :rayon_1, rayon_2: rayons moyens du côté de la base et à l'opposé + :hauteur: hauteur du cône - if self._verbose_max: - texte = blabla - texte += "nom_objet = {}\n".format(nom_objet) - texte += "nom_solide = {}".format(nom_solide) - print (texte) + Sorties : + :face: la face externe du cône support""" + nom_fonction = __name__ + "/_cree_face_mediane_cone_1" + blabla = "Dans {} :\n".format(nom_fonction) - if nom_solide is None: - nom_solide = self.nom_solide_aux + # Les deux faces + if self._verbose_max: + texte = blabla + texte += "Centre : ({}, {}, {})\n".format(coo_x, coo_y, coo_z) + texte += "Axe : ({}, {}, {})\n".format(axe_x, axe_y, axe_z) + texte += "Rayons : {}, {}\n".format(rayon_1, rayon_2) + texte += "Hauteur : {}".format(hauteur) + print(texte) + + # 1. Création du point central de la base, côté rayon_1 + centre_1 = model.addPoint(self.part_doc, coo_x, coo_y, coo_z) + nom_centre_1 = "{}_centre_1".format(self.nom_solide) + exec_nom(centre_1, nom_centre_1) + + # 2. Création du point central, du côté de rayon_2 + centre_2 = model.addPoint( + self.part_doc, + coo_x + hauteur * axe_x, + coo_y + hauteur * axe_y, + coo_z + hauteur * axe_z, + ) + nom_centre_2 = "{}_centre_2".format(self.nom_solide) + exec_nom(centre_2, nom_centre_2) + + # 3. Création de l'axe + axe = model.addAxis( + self.part_doc, + model.selection("VERTEX", nom_centre_1), + model.selection("VERTEX", nom_centre_2), + ) + nom_axe = "{}_axe".format(self.nom_solide) + exec_nom(axe, nom_axe) + + # 4. Création du cône en volume, de rayon médian + # 4.1. Calculs des rayons haut et bas, de sa hauteur et de la valeur de la translation + rayon_b, rayon_s, hauteur_c, d_trans = self._cree_face_mediane_cone_2( + rayon_1, rayon_2, hauteur + ) + + # 4.2. Création du grand cône + Cone_1 = model.addCone( + self.part_doc, + model.selection("VERTEX", nom_centre_1), + model.selection("EDGE", nom_axe), + rayon_b, + rayon_s, + hauteur_c, + ) + nom_1 = "{}_Cone_1".format(self.nom_solide) + exec_nom(Cone_1, nom_1) + + # 4.3. Translation pour superposer au cône de départ + Translation_1 = model.addTranslation( + self.part_doc, + [model.selection("SOLID", nom_1)], + axis=model.selection("EDGE", nom_axe), + distance=d_trans, + keepSubResults=True, + ) + nom_2 = "{}_Cone_1_trans".format(self.nom_solide) + exec_nom(Translation_1, nom_2) + + # 5. Création du cône en surface + nom = "{}/MF:Translated&{}".format(nom_2, nom_1) + cone = self._creation_face_surface(nom, "cone") + + # 6. Intersection de la face conique avec le solide initial + face = self._creation_face_inter(cone.name()) + + return face + + # =========================== Fin de la méthode ================================== + + # =========================== Début de la méthode ================================= + + def _cree_face_mediane_cone_2(self, rayon_1, rayon_2, hauteur): + """Crée la face médiane entre deux autres - cas des cônes + + Calcul des caractéristiques du cône enveloppant. Merci Thalès ! + Le coefficient multiplicateur est choisi pour être certain de tout prendre. On calcule la + plus petite valeur et on ajoute arbitrairement 5. + + Remarque : on ne peut pas avoir un cône pointu car il est situé entre deux cônes donc il y a une épaisseur. + + Entrées : + :rayon_1, rayon_2: rayons moyens du côté de la base et à l'opposé + :hauteur: hauteur du cône + + Sorties : + :rayon_b: rayon du cône - partie basse + :rayon_s: rayon du cône - partie supérieure + :hauteur_c: hauteur du cône + :d_trans: distance de translation selon l'axe""" + nom_fonction = __name__ + "/_cree_face_mediane_cone_2" + blabla = "Dans {} :\n".format(nom_fonction) + + # Objectif + if self._verbose_max: + texte = blabla + texte += "rayon_1 : {}\n".format(rayon_1) + texte += "rayon_2 : {}\n".format(rayon_2) + texte += "Hauteur : {}".format(hauteur) + print(texte) + + bonus = 5.0 + + # 1. Cas étroit en bas + if rayon_1 < rayon_2: + # Distance entre la pointe et la base + coeff_a = rayon_1 / (rayon_2 - rayon_1) + d_pointe_base = hauteur * coeff_a + coeff = coeff_a + 1.0 + bonus + if self._verbose_max: + print("Cas étroit en bas") + print( + "Distance de la pointe à la base : {}*{} = {}".format( + coeff_a, hauteur, d_pointe_base + ) + ) + rayon_b = 0.0 + rayon_s = coeff * (rayon_2 - rayon_1) + d_trans = -d_pointe_base + + # 2. Cas étroit en haut + # Manifestement cela n'arrive jamais une fois passé par du step et réimporté dans SHAPER + else: + # Distance entre la pointe et le haut + coeff_a = rayon_1 / (rayon_1 - rayon_2) + d_pointe_haut = hauteur * coeff_a + coeff = coeff_a + 1.0 + bonus + if self._verbose_max: + print("Cas étroit en haut") + print( + "Distance de la pointe et le haut : {}*{} = {}".format( + coeff_a, hauteur, d_pointe_haut + ) + ) + rayon_b = coeff * (rayon_1 - rayon_2) + rayon_s = 0.0 + d_trans = -bonus * hauteur + + # 3. La hauteur + hauteur_c = coeff * hauteur - face = model.addCommon(self.part_doc, [model.selection("SOLID", nom_solide), model.selection("FACE", nom_objet)], keepSubResults = True) - face.execute(True) + if self._verbose_max: + texte = "rayon_b : {}\n".format(rayon_b) + texte += "rayon_s : {}\n".format(rayon_s) + texte += "Translation : {}".format(d_trans) + print(texte) - return face + return rayon_b, rayon_s, hauteur_c, d_trans -#=========================== Fin de la méthode ================================== + # =========================== Fin de la méthode ================================== -#=========================== Début de la méthode ================================= + # =========================== Début de la méthode ================================= - def face_mediane_solide (self, solide, n_recur=0): - """Calcul de la face médiane pour un solide + def _cree_centre_axe_plan(self, coo_c, vect, prefixe, n_recur): + """Crée un centre, un axe, un plan -Entrées : - :solide: solide SHAPER à traiter - :n_recur: niveau de récursivité + Entrées : + :coo_c: coordonnées du centre de la base + :vect: coordonnées du vecteur + :prefix: prefixe du nom des objets + :n_recur: niveau de récursivité -Sorties : - :erreur: code d'erreur - :message: message d'erreur -""" + Sorties : + :centre: centre + :normal: vecteur normal + :plan: plan""" - nom_fonction = __name__ + "/face_mediane_solide" - blabla = "Dans {} :".format(nom_fonction) + nom_fonction = __name__ + "/_cree_centre_axe_plan" + blabla = "Dans {} :".format(nom_fonction) + if self._verbose_max: + print_tab(n_recur, blabla) + print_tab( + n_recur, "Centre : ({}, {}, {})".format(coo_c[0], coo_c[1], coo_c[2]) + ) + print_tab( + n_recur, "Normale : ({}, {}, {})".format(vect[0], vect[1], vect[2]) + ) + + # Création du point central + centre = model.addPoint(self.part_doc, coo_c[0], coo_c[1], coo_c[2]) + nom_centre = "{}_centre".format(prefixe) + exec_nom(centre, nom_centre) + if self.fonction_0 is None: + self.fonction_0 = centre + + # Création du vecteur + vecteur = model.addAxis(self.part_doc, vect[0], vect[1], vect[2]) + nom_vect = "{}_vecteur".format(prefixe) + exec_nom(vecteur, nom_vect) + + # Création du plan perpendiculaire au vecteur normal + plan = model.addPlane( + self.part_doc, + model.selection("EDGE", vecteur.name()), + model.selection("VERTEX", centre.name()), + True, + ) + nom_plan = "{}_plan".format(prefixe) + exec_nom(plan, nom_plan) + + # print ("fin de {}".format(nom_fonction)) + + return centre, vecteur, plan + + # =========================== Fin de la méthode ================================== + + # =========================== Début de la méthode ================================= + + def _calcul_lg_caract_0(self, objet, tb_caract, n_recur): + """Crée une longueur caractéristique de l'objet formés de surfaces planes + + Les caractéristiques sont comme en IHM avec 'Inspection' : + . Si la face est un rectangle, la caractéristique est : + Xcoin, Ycoin, Zcoin, Xnormale, Ynormale, Znormale, Largeur, Hauteur + . Si la face est un polygone, elle est vue comme un plan et la caractéristique est : + Xcentre, Ycentre, Zcentre, Xnormale, Ynormale, Znormale + . Si la face est un disque, elle est vue comme un plan et la caractéristique est : + Xcentre, Ycentre, Zcentre, Xnormale, Ynormale, Znormale, Rayon + + Si on se contente de raisonner avec la boîte englobante de la face, on a le risque qu'elle ne soit pas au bon endroit. + + Il faut ici calculer la dimension d'une boîte centrée sur l'origine qui englobe à coup sûr le solide. + + Entrées : + :objet: l'objet à traiter + :tb_caract: tableau des caractéristiques géométriques des faces + :n_recur: niveau de récursivité + + Sorties : + :l_caract: longueur caractéristique de l'objet""" + + nom_fonction = __name__ + "/_calcul_lg_caract_0" + blabla = "Dans {} :".format(nom_fonction) - if self._verbose_max: - print_tab (n_recur, blabla, saut_av=True) - if self._verbose: - print_tab (n_recur, "Traitement du solide ", solide.name()) + if self._verbose_max: + print_tab(n_recur, blabla) + + # 1. On parcourt toutes les faces en repérant les rectangles. + # Pour ces rectangles on va calculer les plus grandes valeurs des coordonnées et des épaisseurs. + + avec_rectangle = False + xyz_max = 0.0 + d_max = 0.0 + for iaux, caract in enumerate(tb_caract): + if self._verbose_max: + print_tab(n_recur, "Face {} : ".format(iaux), caract) + if caract[-1][0] == "Rectangle": + avec_rectangle = True + xyz_max = max( + xyz_max, abs(caract[-1][1]), abs(caract[-1][2]), abs(caract[-1][3]) + ) + d_max = max(d_max, caract[-1][7], caract[-1][8]) -# 1. Préalables + if self._verbose_max: + print_tab(n_recur, "xyz_max : ", xyz_max) + print_tab(n_recur, "d_max : ", d_max) + + # 2. Longueur + # 2.1. S'il y avait des rectangles, on prend un cube plus grand + if avec_rectangle: + l_caract = (xyz_max + d_max) * np.sqrt(3.0) + # 2.2. Sinon, on peut utiliser la formule classique + else: + l_caract = self._calcul_lg_caract_1(objet, n_recur) - erreur = 0 - message = "" + if self._verbose_max: + print_tab(n_recur, "Longueur caractéristique : ", l_caract) - while not erreur : + return l_caract -# 2. Calcul des caractéristiques géométriques des faces + # =========================== Fin de la méthode ================================== - tb_caract = self._calcul_caract_faces ( solide, n_recur ) + # =========================== Début de la méthode ================================= -# 3. Tri des faces en fonction de leurs caractéristiques géométriques + def _calcul_lg_caract_1(self, objet, n_recur): + """Crée une longueur caractéristique de l'objet - erreur, message, caract_face_1, caract_face_2 = self._tri_faces ( tb_caract, n_recur ) - if erreur: - break + Entrées : + :objet: l'objet à traiter + :n_recur: niveau de récursivité -# 4. Création de la face médiane + Sorties : + :l_caract: longueur caractéristique de l'objet""" - erreur, face = self._cree_face_mediane ( solide, caract_face_1, caract_face_2, tb_caract, n_recur ) - if ( erreur or ( face is None ) ): - break + nom_fonction = __name__ + "/_calcul_lg_caract_1" + blabla = "Dans {} :".format(nom_fonction) -# 6. Exportation step + if self._verbose_max: + print_tab(n_recur, blabla) - if self._export_step: - fichier = os.path.join(self.rep_step, "{}.stp".format(face.result().name())) - export = model.exportToFile(self.part_doc, fichier, [model.selection(face.result().shapeType(), face.result().name())]) - export.execute(True) - model.do() + properties = model.getGeometryCalculation( + self.part_doc, + model.selection("{}".format(objet.shapeType()), "{}".format(objet.name())), + ) + l_caract = properties[0] -# 7. La fin + if self._verbose_max: + print_tab(n_recur, "Longueur caractéristique : ", l_caract) + + return l_caract + + # =========================== Fin de la méthode ================================== + + # =========================== Début de la méthode ================================= + + def _cree_revolution( + self, + nom_sketch, + nom_centre, + coo_x, + coo_y, + coo_z, + axe_x, + axe_y, + axe_z, + nom_objet, + ): + """Crée un volume de révolution + + Entrées : + :nom_sketch: nom de l'esquisse à révolutionner + :nom_centre: nom du point associé au centre du volume de révolution + :coo_x, coo_y, coo_z: coordonnées du centre du tore + :axe_x, axe_y, axe_z: coordonnées de l'axe + :rayon_1 : rayon principal + :rayon_2 : rayon secondaire + :nom_objet: nom de l'objet 2D créé""" + + nom_fonction = __name__ + "/_cree_revolution" + blabla = "Dans {} :\n".format(nom_fonction) - break + if self._verbose_max: + texte = blabla + texte += "Centre : ({}, {}, {})\n".format(coo_x, coo_y, coo_z) + texte += "Axe : ({}, {}, {})\n".format(axe_x, axe_y, axe_z) + print(texte) + + # Création d'un point décalé par rapport au point central + point = model.addPoint( + self.part_doc, coo_x + axe_x, coo_y + axe_y, coo_z + axe_z + ) + nom_point = "{}_point".format(self.nom_solide) + exec_nom(point, nom_point) + + # Création de l'axe de la rotation + axe_r = model.addAxis( + self.part_doc, + model.selection("VERTEX", nom_centre), + model.selection("VERTEX", nom_point), + ) + nom_axe_r = "{}_axe_r".format(self.nom_solide) + exec_nom(axe_r, nom_axe_r) + + # Création de l'objet complet + objet = model.addRevolution( + self.part_doc, + [model.selection("COMPOUND", nom_sketch)], + model.selection("EDGE", nom_axe_r), + 360, + 0, + "Edges", + ) + exec_nom(objet, nom_objet, (85, 0, 255)) + + # =========================== Fin de la méthode ================================== + + # =========================== Début de la méthode ================================= + + def _creation_face_surface(self, nom_objet, suffixe): + """Crée la face qui est la surface externe d'un objet + + . Crée le groupe de la face externe + . Transforme le groupe en face résultat + + Entrées : + :nom_objet: nom de l'objet 3D à traiter + :suffixe: suffixe pour nommer l'objet 2D + :nom_solide: nom du solide initial ; si None, on prend self.nom_solide_aux + + Sorties : + :objet_2d: l'objet 2D support de la face externe de l'objet 3D""" + + nom_fonction = __name__ + "/_creation_face_surface" + blabla = "Dans {} :\n".format(nom_fonction) - if ( erreur and self._verbose_max ): - print (blabla, message) + if self._verbose_max: + print(blabla) - return erreur, message + # 1. Le groupe de la surface + groupe = model.addGroup( + self.part_doc, + "Faces", + [model.selection("FACE", "{}/Face_1".format(nom_objet))], + ) + nom = "{}_{}_groupe".format(self.nom_solide, suffixe) + exec_nom(groupe, nom, (85, 0, 255)) -#=========================== Fin de la méthode ================================== + # 2. Création de la face en surface + objet_2d = model.addGroupShape( + self.part_doc, [model.selection("COMPOUND", nom)] + ) + nom = "{}_{}".format(self.nom_solide, suffixe) + exec_nom(objet_2d, nom, (85, 0, 255)) -#=========================== Début de la méthode ================================= + return objet_2d - def _traitement_objet (self, solide, n_recur=0): - """Traitement d'un objet + # =========================== Fin de la méthode ================================== -Entrées : - :solide: solide SHAPER à traiter - :n_recur: niveau de récursivité + # =========================== Début de la méthode ================================= -Sorties : - :erreur: code d'erreur - :message: message d'erreur -""" + def _creation_face_inter(self, nom_objet, nom_solide=None): + """Crée la face par intersection entre l'objet initial et une face complète - nom_fonction = __name__ + "/_traitement_objet" - blabla = "Dans {} :".format(nom_fonction) + . Repère la face principale de l'objet support + . Réalise l'intersection avec le solide initial - if self._verbose_max: - print_tab (n_recur, blabla, saut_av=True) - texte = "solide = {} ".format(solide.name()) - print_tab (n_recur, texte, solide) + Entrées : + :nom_objet: nom de l'objet 2D créé + :nom_solide: nom du solide initial ; si None, on prend self.nom_solide_aux -# 1. En cas d'exportation step, répertoire de travail associé à l'éventuel fichier de départ -# Attention à ne pas recréer le répertoire à chaque fois - if self._export_step: + Sorties : + :face: la face externe de l'objet support intersecté avec le solide initial""" - if self.rep_step is None: + nom_fonction = __name__ + "/_creation_face_inter" + blabla = "Dans {} :\n".format(nom_fonction) if self._verbose_max: - print_tab (n_recur, "Préparation de l'export STEP") - - if self.ficcao is None: - self.rep_step = tempfile.mkdtemp(prefix="{}_".format(self.objet_principal.name())) - else: - self.rep_step = os.path.join(os.path.dirname(self.ficcao),"{}_M".format(self.objet_principal.name())) - if os.path.isdir(self.rep_step): - l_aux = os.listdir(self.rep_step) - for nomfic in l_aux: - os.remove(os.path.join(self.rep_step,nomfic)) - else: - os.mkdir(self.rep_step) - - if self._verbose_max: - print_tab (n_recur, "Les fichiers CAO des surfaces seront dans le répertoire {}".format(self.rep_step)) + texte = blabla + texte += "nom_objet = {}\n".format(nom_objet) + texte += "nom_solide = {}".format(nom_solide) + print(texte) -# 2. Calcul réel de la face médiane + if nom_solide is None: + nom_solide = self.nom_solide_aux - erreur, message = self.face_mediane_solide (solide, n_recur) + face = model.addCommon( + self.part_doc, + [model.selection("SOLID", nom_solide), model.selection("FACE", nom_objet)], + keepSubResults=True, + ) + face.execute(True) - return erreur, message + return face -#=========================== Fin de la méthode ================================== + # =========================== Fin de la méthode ================================== -#=========================== Début de la méthode ================================= + # =========================== Début de la méthode ================================= - def surf_fic_cao (self, ficcao, nom_objet=None): - """Calcule la surface médiane pour un objet dans un fichier passé en argument + def face_mediane_solide(self, solide, n_recur=0): + """Calcul de la face médiane pour un solide -Entrées : - :ficcao: fichier de l'objet à traiter - :nom_objet: un nom à donner à l'objet à traiter + Entrées : + :solide: solide SHAPER à traiter + :n_recur: niveau de récursivité -Sorties : - :erreur: code d'erreur - :message: message d'erreur -""" + Sorties : + :erreur: code d'erreur + :message: message d'erreur""" - nom_fonction = __name__ + "/surf_fic_cao" - blabla = "Dans {} :".format(nom_fonction) - - if self._verbose_max: - print (blabla) - - erreur = 0 - message = "" + nom_fonction = __name__ + "/face_mediane_solide" + blabla = "Dans {} :".format(nom_fonction) - model.begin() + if self._verbose_max: + print_tab(n_recur, blabla, saut_av=True) + if self._verbose: + print_tab(n_recur, "Traitement du solide ", solide.name()) - while not erreur : + # 1. Préalables - if self.affiche_aide_globale: - break + erreur = 0 + message = "" -# 1. Définition de la pièce + while not erreur: + # 2. Calcul des caractéristiques géométriques des faces - self.part_doc = model.activeDocument() - if ( self.part_doc.kind() == "PartSet" ): - part = model.addPart(self.part_doc) - self.part_doc = part.document() + tb_caract = self._calcul_caract_faces(solide, n_recur) -# 2. Import de la CAO + # 3. Tri des faces en fonction de leurs caractéristiques géométriques - self.ficcao = ficcao - print ("Traitement du fichier {}".format(ficcao)) + erreur, message, caract_face_1, caract_face_2 = self._tri_faces( + tb_caract, n_recur + ) + if erreur: + break - erreur, message, objet = import_cao (self.part_doc, ficcao, nom_objet, self._verbose_max) - if erreur: - break + # 4. Création de la face médiane -# 3. Calcul des surfaces + erreur, face = self._cree_face_mediane( + solide, caract_face_1, caract_face_2, tb_caract, n_recur + ) + if erreur or (face is None): + break - erreur, message = self.surf_objet_shaper ( objet ) - if erreur: - break - #print (message) + # 6. Exportation step - break + if self._export_step: + fichier = os.path.join( + self.rep_step, "{}.stp".format(face.result().name()) + ) + export = model.exportToFile( + self.part_doc, + fichier, + [model.selection(face.result().shapeType(), face.result().name())], + ) + export.execute(True) + model.do() - if ( erreur and self._verbose_max ): - print (blabla, message) + # 7. La fin - return erreur, message + break -#=========================== Fin de la méthode ================================== + if erreur and self._verbose_max: + print(blabla, message) -#=========================== Début de la méthode ================================= + return erreur, message - def surf_objet_shaper (self, objet): - """Calcule les surfaces médianes pour un objet SHAPER passé en argument + # =========================== Fin de la méthode ================================== -Entrées : - :objet: objet à traiter + # =========================== Début de la méthode ================================= -Sorties : - :erreur: code d'erreur - :message: message d'erreur -""" + def _traitement_objet(self, solide, n_recur=0): + """Traitement d'un objet - nom_fonction = __name__ + "/surf_objet_shaper" - blabla = "Dans {} :".format(nom_fonction) + Entrées : + :solide: solide SHAPER à traiter + :n_recur: niveau de récursivité - if self._verbose_max: - print (blabla) + Sorties : + :erreur: code d'erreur + :message: message d'erreur""" - erreur = 0 - message = "" + nom_fonction = __name__ + "/_traitement_objet" + blabla = "Dans {} :".format(nom_fonction) - while not erreur : - - if self.affiche_aide_globale: - break - -# 1. Acquisition de la liste des noms des sous-objets solides + if self._verbose_max: + print_tab(n_recur, blabla, saut_av=True) + texte = "solide = {} ".format(solide.name()) + print_tab(n_recur, texte, solide) + + # 1. En cas d'exportation step, répertoire de travail associé à l'éventuel fichier de départ + # Attention à ne pas recréer le répertoire à chaque fois + if self._export_step: + if self.rep_step is None: + if self._verbose_max: + print_tab(n_recur, "Préparation de l'export STEP") + + if self.ficcao is None: + self.rep_step = tempfile.mkdtemp( + prefix="{}_".format(self.objet_principal.name()) + ) + else: + self.rep_step = os.path.join( + os.path.dirname(self.ficcao), + "{}_M".format(self.objet_principal.name()), + ) + if os.path.isdir(self.rep_step): + l_aux = os.listdir(self.rep_step) + for nomfic in l_aux: + os.remove(os.path.join(self.rep_step, nomfic)) + else: + os.mkdir(self.rep_step) + + if self._verbose_max: + print_tab( + n_recur, + "Les fichiers CAO des surfaces seront dans le répertoire {}".format( + self.rep_step + ), + ) + + # 2. Calcul réel de la face médiane + + erreur, message = self.face_mediane_solide(solide, n_recur) + + return erreur, message + + # =========================== Fin de la méthode ================================== + + # =========================== Début de la méthode ================================= + + def surf_fic_cao(self, ficcao, nom_objet=None): + """Calcule la surface médiane pour un objet dans un fichier passé en argument + + Entrées : + :ficcao: fichier de l'objet à traiter + :nom_objet: un nom à donner à l'objet à traiter + + Sorties : + :erreur: code d'erreur + :message: message d'erreur""" + + nom_fonction = __name__ + "/surf_fic_cao" + blabla = "Dans {} :".format(nom_fonction) - self.d_statut_so = dict() - self.l_noms_so = list() - self.l_faces_m = list() + if self._verbose_max: + print(blabla) - _ = self._nom_sous_objets (objet, True) - if self._verbose_max: - print ("Noms des sous-objets : {}".format(self.l_noms_so)) + erreur = 0 + message = "" -# 2. Les faces médianes + model.begin() - erreur, message = self._surf_objet_shaper_0 ( objet ) - if erreur: - break + while not erreur: + if self.affiche_aide_globale: + break -# 3. Gestion des faces créées + # 1. Définition de la pièce - self._surf_objet_shaper_1 ( ) + self.part_doc = model.activeDocument() + if self.part_doc.kind() == "PartSet": + part = model.addPart(self.part_doc) + self.part_doc = part.document() -# 4. Futur message pour le résultat + # 2. Import de la CAO - if ( self._export_step and not erreur ): - message = "Les fichiers des CAO des surfaces sont dans le répertoire {}".format(self.rep_step) + self.ficcao = ficcao + print("Traitement du fichier {}".format(ficcao)) - break + erreur, message, objet = import_cao( + self.part_doc, ficcao, nom_objet, self._verbose_max + ) + if erreur: + break - return erreur, message + # 3. Calcul des surfaces -#=========================== Fin de la méthode ================================== + erreur, message = self.surf_objet_shaper(objet) + if erreur: + break + # print (message) -#=========================== Début de la méthode ================================= + break - def _surf_objet_shaper_0 (self, objet, n_recur=0): - """Calcule les surfaces médianes pour un objet SHAPER passé en argument + if erreur and self._verbose_max: + print(blabla, message) -Entrées : - :objet: objet à traiter - :n_recur: niveau de récursivité + return erreur, message -Sorties : - :erreur: code d'erreur - :message: message d'erreur -""" + # =========================== Fin de la méthode ================================== - nom_fonction = __name__ + "/_surf_objet_shaper_0" - blabla = "Dans {} :".format(nom_fonction) + # =========================== Début de la méthode ================================= - if self._verbose_max: - print_tab (n_recur, blabla) - print_tab (n_recur, "n_recur = ", n_recur) + def surf_objet_shaper(self, objet): + """Calcule les surfaces médianes pour un objet SHAPER passé en argument - erreur = 0 - message = "" + Entrées : + :objet: objet à traiter - while not erreur : + Sorties : + :erreur: code d'erreur + :message: message d'erreur""" -# 1. Au premier passage, il faut récupérer la pièce SHAPER et garder la référence au résultat principal + nom_fonction = __name__ + "/surf_objet_shaper" + blabla = "Dans {} :".format(nom_fonction) - if ( n_recur == 0 ): - self.part_doc = model.activeDocument() - objet_0 = objet.result() - self.objet_principal = objet_0 - objet_bis = objet.defaultResult().shape() - if self._verbose_max: - print_tab (0, "Examen de l'objet initial ", objet.result().name(), saut_av=True) - print_tab (0, "Type python : ", type(objet)) - print_tab (0, "Type {} / {} ; volume = ".format(objet_bis.shapeType(),objet_bis.shapeTypeStr()), GeomAlgoAPI_ShapeTools.volume(objet_bis)) - else: - objet_0 = objet if self._verbose_max: - print_tab (n_recur, "Examen de l'objet ", objet.name(), saut_av=True) - print_tab (n_recur, "Type python : ", type(objet)) - print_tab (n_recur, "shapeType : ", objet.shapeType()) + print(blabla) -# 2. On descend dans l'arborescence des sous-objets jusqu'à en trouver un qui n'en n'a pas - - nb_sub_results = objet_0.numberOfSubs() - - if self._verbose_max: - print_tab (n_recur, "Examen de l'objet '{}' de type ".format(objet_0.name()), objet_0.shapeType(), saut_av=True) - print_tab (n_recur, "objet.result().numberOfSubs() : ", nb_sub_results) - - for n_sobj in range(nb_sub_results): + erreur = 0 + message = "" -# 2.1. Exploration récursive de l'arborescence + while not erreur: + if self.affiche_aide_globale: + break - erreur, message = self._surf_objet_shaper_0 ( objet_0.subResult(n_sobj), n_recur+1 ) - if erreur: - break + # 1. Acquisition de la liste des noms des sous-objets solides - if erreur: - break + self.d_statut_so = dict() + self.l_noms_so = list() + self.l_faces_m = list() -# 2.2. Cet objet n'a pas de sous-objets. Si c'est un solide, on le traite + _ = self._nom_sous_objets(objet, True) + if self._verbose_max: + print("Noms des sous-objets : {}".format(self.l_noms_so)) - if ( objet_0.shapeType() == "SOLID" ): - erreur, message = self.surf_solide_shaper ( objet_0, n_recur ) - if erreur: - break + # 2. Les faces médianes -# 3. Futur message pour le résultat + erreur, message = self._surf_objet_shaper_0(objet) + if erreur: + break - if self._export_step: - message = "Les fichiers STEP des surfaces sont dans le répertoire {}".format(self.rep_step) + # 3. Gestion des faces créées - break + self._surf_objet_shaper_1() - return erreur, message + # 4. Futur message pour le résultat -#=========================== Fin de la méthode ================================== + if self._export_step and not erreur: + message = "Les fichiers des CAO des surfaces sont dans le répertoire {}".format( + self.rep_step + ) -#=========================== Début de la méthode ================================= + break - def _surf_objet_shaper_1 (self, n_recur=0): - """Gestion des surfaces médianes créées + return erreur, message -Entrées : - :n_recur: niveau de récursivité + # =========================== Fin de la méthode ================================== -Sorties : - :erreur: code d'erreur - :message: message d'erreur -""" + # =========================== Début de la méthode ================================= - nom_fonction = __name__ + "/_surf_objet_shaper_1" - blabla = "Dans {} :\n".format(nom_fonction) + def _surf_objet_shaper_0(self, objet, n_recur=0): + """Calcule les surfaces médianes pour un objet SHAPER passé en argument - if self._verbose_max: - print_tab (n_recur, blabla) - -# 1. Informations sur les faces à problème - - if self.faces_pb_nb: - if ( self.faces_pb_nb == 1 ): - texte = "1 face pose" - else: - texte = "{} faces posent".format(self.faces_pb_nb) - print_tab (n_recur, "{} problème.".format(texte), self.faces_pb_msg, saut_av=True) - -# 2. Si plus d'une face a été créée - if ( len(self.l_faces_m) > 1 ): - -# 2.1. Partition du paquet de faces - - if self._verbose_max: - print_tab (n_recur, "Partitionnnement des faces créées.") - -# 2.1.1. Pour une raison mystérieuse, il faut commencer par les faces entières, puis mettre les sous-faces éventuelles - d_faces = dict() - for (face,_) in self.l_faces_m: - if not face.result().numberOfSubs(): - d_faces[face.name()] = [face.name()] - for (face,_) in self.l_faces_m: - nb_sub_results = face.result().numberOfSubs() - if nb_sub_results: - laux = list() - for n_sobj in range(nb_sub_results): - laux.append(face.result().subResult(n_sobj).name()) - d_faces[face.name()] = laux - - l_objets = list() - for _, laux in d_faces.items(): - for s_face_n in laux: - l_objets.append(model.selection("FACE", s_face_n)) - - Partition_1 = model.addPartition(self.part_doc, l_objets, keepSubResults = True) - nom = "{}_M".format(self.objet_principal.name()) - exec_nom (Partition_1,nom) - - iaux = 0 - for face_n, laux in d_faces.items(): - Partition_1.result().subResult(iaux).setName("{}".format(face_n)) - if ( len(laux) > 1 ): - for jaux, s_face_n in enumerate(laux): - Partition_1.result().subResult(iaux).subResult(jaux).setName("{}_M".format(s_face_n)) - iaux += 1 - couleur_objet (Partition_1, n_recur, coul_r=0, coul_g=170, coul_b=0, verbose=self._verbose_max) - -# 2.2. Récupération des faces individuelles - - if self._verbose_max: - print_tab (n_recur, "Récupération des faces individuelles.") - - l_objets = list() - for iaux, (face,_) in enumerate(self.l_faces_m): - l_objets.append(face.result()) - - Recover_1 = model.addRecover(self.part_doc, Partition_1, l_objets) - exec_nom (Recover_1) - for iaux, (face,_) in enumerate(self.l_faces_m): - Recover_1.results()[iaux].setName("{}".format(face.name())) - Recover_1.results()[iaux].setColor(0, 170, 0) - nb_sub_results = Recover_1.results()[iaux].numberOfSubs() - for n_sobj in range(nb_sub_results): - Recover_1.results()[iaux].subResult(n_sobj).setName("{}_{}".format(face.name(),n_sobj)) - Recover_1.results()[iaux].subResult(n_sobj).setColor(0, 170, 0) + Entrées : + :objet: objet à traiter + :n_recur: niveau de récursivité -# 3. Mise en dossier + Sorties : + :erreur: code d'erreur + :message: message d'erreur""" - if self._verbose_max: - print_tab (n_recur, "Mise en dossier.") + nom_fonction = __name__ + "/_surf_objet_shaper_0" + blabla = "Dans {} :".format(nom_fonction) - for (face,fonction_0) in self.l_faces_m: - if fonction_0 is not None: - nom = face.name()[:-2] if self._verbose_max: - print ( "Dossier {} de {} à {}".format(nom,fonction_0.name(),face.name())) - dossier = model.addFolder(self.part_doc, fonction_0, face) - dossier.setName(nom) - - if ( len(self.l_faces_m) > 1 ): - - nom = self.objet_principal.name() - if self._verbose_max: - print ( "Dossier {} de {} à {}".format(nom,Partition_1.name(),Recover_1.name())) - dossier = model.addFolder(self.part_doc, Partition_1, Recover_1) - dossier.setName(nom) - -#=========================== Fin de la méthode ================================== - -#=========================== Début de la méthode ================================= + print_tab(n_recur, blabla) + print_tab(n_recur, "n_recur = ", n_recur) - def surf_solide_shaper (self, solide, n_recur): - """Calcule les surfaces médianes pour un solide SHAPER solide passé en argument + erreur = 0 + message = "" -Entrées : - :solide: solide SHAPER à traiter - :n_recur: numéro de la récurrence + while not erreur: + # 1. Au premier passage, il faut récupérer la pièce SHAPER et garder la référence au résultat principal + + if n_recur == 0: + self.part_doc = model.activeDocument() + objet_0 = objet.result() + self.objet_principal = objet_0 + objet_bis = objet.defaultResult().shape() + if self._verbose_max: + print_tab( + 0, + "Examen de l'objet initial ", + objet.result().name(), + saut_av=True, + ) + print_tab(0, "Type python : ", type(objet)) + print_tab( + 0, + "Type {} / {} ; volume = ".format( + objet_bis.shapeType(), objet_bis.shapeTypeStr() + ), + GeomAlgoAPI_ShapeTools.volume(objet_bis), + ) + else: + objet_0 = objet + if self._verbose_max: + print_tab(n_recur, "Examen de l'objet ", objet.name(), saut_av=True) + print_tab(n_recur, "Type python : ", type(objet)) + print_tab(n_recur, "shapeType : ", objet.shapeType()) + + # 2. On descend dans l'arborescence des sous-objets jusqu'à en trouver un qui n'en n'a pas + + nb_sub_results = objet_0.numberOfSubs() + + if self._verbose_max: + print_tab( + n_recur, + "Examen de l'objet '{}' de type ".format(objet_0.name()), + objet_0.shapeType(), + saut_av=True, + ) + print_tab(n_recur, "objet.result().numberOfSubs() : ", nb_sub_results) + + for n_sobj in range(nb_sub_results): + # 2.1. Exploration récursive de l'arborescence + + erreur, message = self._surf_objet_shaper_0( + objet_0.subResult(n_sobj), n_recur + 1 + ) + if erreur: + break + + if erreur: + break + + # 2.2. Cet objet n'a pas de sous-objets. Si c'est un solide, on le traite + + if objet_0.shapeType() == "SOLID": + erreur, message = self.surf_solide_shaper(objet_0, n_recur) + if erreur: + break + + # 3. Futur message pour le résultat + + if self._export_step: + message = ( + "Les fichiers STEP des surfaces sont dans le répertoire {}".format( + self.rep_step + ) + ) + + break + + return erreur, message + + # =========================== Fin de la méthode ================================== + + # =========================== Début de la méthode ================================= + + def _surf_objet_shaper_1(self, n_recur=0): + """Gestion des surfaces médianes créées + + Entrées : + :n_recur: niveau de récursivité + + Sorties : + :erreur: code d'erreur + :message: message d'erreur""" + + nom_fonction = __name__ + "/_surf_objet_shaper_1" + blabla = "Dans {} :\n".format(nom_fonction) -Sorties : - :erreur: code d'erreur - :message: message d'erreur -""" + if self._verbose_max: + print_tab(n_recur, blabla) + + # 1. Informations sur les faces à problème + + if self.faces_pb_nb: + if self.faces_pb_nb == 1: + texte = "1 face pose" + else: + texte = "{} faces posent".format(self.faces_pb_nb) + print_tab( + n_recur, "{} problème.".format(texte), self.faces_pb_msg, saut_av=True + ) + + # 2. Si plus d'une face a été créée + if len(self.l_faces_m) > 1: + # 2.1. Partition du paquet de faces + + if self._verbose_max: + print_tab(n_recur, "Partitionnnement des faces créées.") + + # 2.1.1. Pour une raison mystérieuse, il faut commencer par les faces entières, puis mettre les sous-faces éventuelles + d_faces = dict() + for face, _ in self.l_faces_m: + if not face.result().numberOfSubs(): + d_faces[face.name()] = [face.name()] + for face, _ in self.l_faces_m: + nb_sub_results = face.result().numberOfSubs() + if nb_sub_results: + laux = list() + for n_sobj in range(nb_sub_results): + laux.append(face.result().subResult(n_sobj).name()) + d_faces[face.name()] = laux + + l_objets = list() + for _, laux in d_faces.items(): + for s_face_n in laux: + l_objets.append(model.selection("FACE", s_face_n)) + + Partition_1 = model.addPartition( + self.part_doc, l_objets, keepSubResults=True + ) + nom = "{}_M".format(self.objet_principal.name()) + exec_nom(Partition_1, nom) + + iaux = 0 + for face_n, laux in d_faces.items(): + Partition_1.result().subResult(iaux).setName("{}".format(face_n)) + if len(laux) > 1: + for jaux, s_face_n in enumerate(laux): + Partition_1.result().subResult(iaux).subResult(jaux).setName( + "{}_M".format(s_face_n) + ) + iaux += 1 + couleur_objet( + Partition_1, + n_recur, + coul_r=0, + coul_g=170, + coul_b=0, + verbose=self._verbose_max, + ) + + # 2.2. Récupération des faces individuelles + + if self._verbose_max: + print_tab(n_recur, "Récupération des faces individuelles.") + + l_objets = list() + for iaux, (face, _) in enumerate(self.l_faces_m): + l_objets.append(face.result()) + + Recover_1 = model.addRecover(self.part_doc, Partition_1, l_objets) + exec_nom(Recover_1) + for iaux, (face, _) in enumerate(self.l_faces_m): + Recover_1.results()[iaux].setName("{}".format(face.name())) + Recover_1.results()[iaux].setColor(0, 170, 0) + nb_sub_results = Recover_1.results()[iaux].numberOfSubs() + for n_sobj in range(nb_sub_results): + Recover_1.results()[iaux].subResult(n_sobj).setName( + "{}_{}".format(face.name(), n_sobj) + ) + Recover_1.results()[iaux].subResult(n_sobj).setColor(0, 170, 0) + + # 3. Mise en dossier - nom_fonction = __name__ + "/surf_solide_shaper" - blabla = "Dans {} :".format(nom_fonction) + if self._verbose_max: + print_tab(n_recur, "Mise en dossier.") + + for face, fonction_0 in self.l_faces_m: + if fonction_0 is not None: + nom = face.name()[:-2] + if self._verbose_max: + print( + "Dossier {} de {} à {}".format( + nom, fonction_0.name(), face.name() + ) + ) + dossier = model.addFolder(self.part_doc, fonction_0, face) + dossier.setName(nom) + + if len(self.l_faces_m) > 1: + nom = self.objet_principal.name() + if self._verbose_max: + print( + "Dossier {} de {} à {}".format( + nom, Partition_1.name(), Recover_1.name() + ) + ) + dossier = model.addFolder(self.part_doc, Partition_1, Recover_1) + dossier.setName(nom) + + # =========================== Fin de la méthode ================================== + + # =========================== Début de la méthode ================================= + + def surf_solide_shaper(self, solide, n_recur): + """Calcule les surfaces médianes pour un solide SHAPER solide passé en argument + + Entrées : + :solide: solide SHAPER à traiter + :n_recur: numéro de la récurrence + + Sorties : + :erreur: code d'erreur + :message: message d'erreur""" + + nom_fonction = __name__ + "/surf_solide_shaper" + blabla = "Dans {} :".format(nom_fonction) - if self._verbose_max: - print_tab (n_recur, blabla, saut_av=True) + if self._verbose_max: + print_tab(n_recur, blabla, saut_av=True) - erreur = 0 - message = "" + erreur = 0 + message = "" - while not erreur : + while not erreur: + self.nom_solide = solide.name() + if self._verbose_max: + print_tab(n_recur, "solide : ", self.nom_solide) - self.nom_solide = solide.name() - if self._verbose_max: - print_tab (n_recur, "solide : ", self.nom_solide) + # 1. Isolement du solide + solide_aux, recover = self._isole_solide(solide, n_recur) -# 1. Isolement du solide - solide_aux, recover = self._isole_solide ( solide, n_recur ) + # 2. Traitement de l'objet correspondant + erreur, message = self._traitement_objet(solide_aux, n_recur=n_recur) -# 2. Traitement de l'objet correspondant - erreur, message = self._traitement_objet ( solide_aux, n_recur=n_recur ) + if erreur and self._verbose_max: + print(blabla, message) - if ( erreur and self._verbose_max ): - print (blabla, message) + # 3. Neutralisation des erreurs dues à l'épaisseur + if erreur in (-2, -1, 2): + erreur = 0 + message = "" + if erreur: + break -# 3. Neutralisation des erreurs dues à l'épaisseur - if ( erreur in (-2,-1,2) ): - erreur = 0 - message = "" - if erreur: - break + # 4. Mise en forme de l'objet principal récupéré + if recover is not None: + _ = self._nom_sous_objets(recover, False) -# 4. Mise en forme de l'objet principal récupéré - if ( recover is not None ): - _ = self._nom_sous_objets (recover, False) + break - break + return erreur, message - return erreur, message -#=========================== Fin de la méthode ================================== +# =========================== Fin de la méthode ================================== -#========================== Fin de la classe ==================================== +# ========================== Fin de la classe ==================================== diff --git a/src/PythonAddons/macros/pipeNetwork/__init__.py b/src/PythonAddons/macros/pipeNetwork/__init__.py index 31169cdd2..b20a65e72 100755 --- a/src/PythonAddons/macros/pipeNetwork/__init__.py +++ b/src/PythonAddons/macros/pipeNetwork/__init__.py @@ -16,4 +16,3 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # - diff --git a/src/PythonAddons/macros/pipeNetwork/feature.py b/src/PythonAddons/macros/pipeNetwork/feature.py index 1ff9ec621..86f4a600e 100755 --- a/src/PythonAddons/macros/pipeNetwork/feature.py +++ b/src/PythonAddons/macros/pipeNetwork/feature.py @@ -33,22 +33,26 @@ import numpy as np # Si erreur : + def raiseException(texte): """En cas d'erreur""" - print (texte) + print(texte) + -def printverbose (texte, nb=0, verbose=False): +def printverbose(texte, nb=0, verbose=False): """Impression controlée""" if verbose: if nb: texte_a = "" for _ in range(nb): texte_a += "=" - print (texte_a) - print (texte) + print(texte_a) + print(texte) + class pipeNetwork(model.Feature): """Creation of a network of pipes""" + lfeatures = list() ledges = list() folder = None @@ -62,7 +66,7 @@ class pipeNetwork(model.Feature): _verbose = False _verbose_max = False -# Feature initializations + # Feature initializations def __init__(self): """x.__init__(...) initializes x; see x.__class__.__doc__ for signature""" @@ -78,27 +82,28 @@ class pipeNetwork(model.Feature): """Returns ID of the file select parameter.""" return "file_path" - #@staticmethod - #def HEXAS_ID(): - #"""Returns ID of the radius parameter.""" - #return "blocking" + # @staticmethod + # def HEXAS_ID(): + # """Returns ID of the radius parameter.""" + # return "blocking" def getKind(self): """Override Feature.getKind()""" return pipeNetwork.ID() - -#==================================================================================== -# Initialization of the dialog panel + # ==================================================================================== + # Initialization of the dialog panel def initAttributes(self): """Override Feature.initAttributes()""" # Creating the input argument of the feature - self.data().addAttribute(self.FILE_ID(), ModelAPI.ModelAPI_AttributeString.typeId()) - #self.data().addAttribute(self.HEXAS_ID(), ModelAPI.ModelAPI_AttributeBoolean.typeId()) + self.data().addAttribute( + self.FILE_ID(), ModelAPI.ModelAPI_AttributeString.typeId() + ) + # self.data().addAttribute(self.HEXAS_ID(), ModelAPI.ModelAPI_AttributeBoolean.typeId()) -#==================================================================================== -# Retrieve parent pipe + # ==================================================================================== + # Retrieve parent pipe def decodingCode(self, code): """decodingCode""" @@ -106,29 +111,29 @@ class pipeNetwork(model.Feature): if len(splitCode) <= 1: previousCode = "" else: - previousCode = code[:len(code)-len(splitCode[-1])-1] + previousCode = code[: len(code) - len(splitCode[-1]) - 1] return previousCode -#==================================================================================== + # ==================================================================================== def readNodeInfo(self, line): """Lecture des noeuds -La ligne à décoder est formée des informations : -. l'identifiant du noeud -. si les coordonnées sont données en absolu : "-" suivi des 3 coordonnées -. si les coordonnées sont données en relatif : l'identifiant du noeud de départ, suivi des 3 coordonnées de la translation -Par défaut, on supposera que la connection est angulaire et que ce n'est pas une extrémité. + La ligne à décoder est formée des informations : + . l'identifiant du noeud + . si les coordonnées sont données en absolu : "-" suivi des 3 coordonnées + . si les coordonnées sont données en relatif : l'identifiant du noeud de départ, suivi des 3 coordonnées de la translation + Par défaut, on supposera que la connection est angulaire et que ce n'est pas une extrémité. """ - #print(line) + # print(line) texte = line splitLine = line.split() - if ( len(splitLine) != 5 ): + if len(splitLine) != 5: diagno = 1 elif splitLine[0] in self.infoPoints: texte += "\nThis node was already declared." diagno = 2 - elif ( splitLine[1] not in self.infoPoints ) and ( splitLine[1] != "-" ): + elif (splitLine[1] not in self.infoPoints) and (splitLine[1] != "-"): texte += "\nThe starting point was not seen before." diagno = 3 else: @@ -139,62 +144,77 @@ Par défaut, on supposera que la connection est angulaire et que ce n'est pas un self.infoPoints[splitLine[0]]["X"] = float(splitLine[2]) self.infoPoints[splitLine[0]]["Y"] = float(splitLine[3]) self.infoPoints[splitLine[0]]["Z"] = float(splitLine[4]) - else : - self.infoPoints[splitLine[0]]["X"] = self.infoPoints[splitLine[1]]["X"] + float(splitLine[2]) - self.infoPoints[splitLine[0]]["Y"] = self.infoPoints[splitLine[1]]["Y"] + float(splitLine[3]) - self.infoPoints[splitLine[0]]["Z"] = self.infoPoints[splitLine[1]]["Z"] + float(splitLine[4]) - printverbose ("Enregistrement du point ({},{},{})".format(self.infoPoints[splitLine[0]]["X"],self.infoPoints[splitLine[0]]["Y"],self.infoPoints[splitLine[0]]["Z"]), verbose=self._verbose) + else: + self.infoPoints[splitLine[0]]["X"] = self.infoPoints[splitLine[1]][ + "X" + ] + float(splitLine[2]) + self.infoPoints[splitLine[0]]["Y"] = self.infoPoints[splitLine[1]][ + "Y" + ] + float(splitLine[3]) + self.infoPoints[splitLine[0]]["Z"] = self.infoPoints[splitLine[1]][ + "Z" + ] + float(splitLine[4]) + printverbose( + "Enregistrement du point ({},{},{})".format( + self.infoPoints[splitLine[0]]["X"], + self.infoPoints[splitLine[0]]["Y"], + self.infoPoints[splitLine[0]]["Z"], + ), + verbose=self._verbose, + ) self.infoPoints[splitLine[0]]["Fillet"] = "angular_connection" self.infoPoints[splitLine[0]]["isEnd"] = False - #print ("Retour de readNodeInfo = {}".format(diagno)) + # print ("Retour de readNodeInfo = {}".format(diagno)) return diagno, texte -#==================================================================================== + # ==================================================================================== def readConnectivity(self, line, method): """Lecture des connectivités -La ligne à décoder est formée des informations : -. si la méthode est par ligne : la liste des identifiants des noeuds formant le trajet -. si la méthode est 2 par 2 : chaque tronçon est décrit par les identifiants des 2 noeuds -Par défaut, on supposera que la méthode est par ligne. + La ligne à décoder est formée des informations : + . si la méthode est par ligne : la liste des identifiants des noeuds formant le trajet + . si la méthode est 2 par 2 : chaque tronçon est décrit par les identifiants des 2 noeuds + Par défaut, on supposera que la méthode est par ligne. """ splitLine = line.split() - printverbose ("Enregistrement du tronçon : {}".format(splitLine),verbose=self._verbose) + printverbose( + "Enregistrement du tronçon : {}".format(splitLine), verbose=self._verbose + ) diagno = 0 - if ( method == self.twopartwo ): + if method == self.twopartwo: if self.connectivities: # Recherche si le tronçon existe déjà ou s'il est nouveau existe = False for key, val in self.connectivities.items(): - #print(key, " ******* {}".format(val)) - if val['chainage'][-1] == splitLine[0]: + # print(key, " ******* {}".format(val)) + if val["chainage"][-1] == splitLine[0]: # Le tronçon existe - val['chainage'].append(splitLine[1]) - #print("On complète le tronçon") + val["chainage"].append(splitLine[1]) + # print("On complète le tronçon") existe = True break # Le tronçon n'existe pas if not existe: - #print("On démarre un nouveau tronçon - Cas 2") + # print("On démarre un nouveau tronçon - Cas 2") self.newConnectivity(splitLine[0], splitLine) - else : - #print("On démarre un nouveau tronçon - Cas 1") + else: + # print("On démarre un nouveau tronçon - Cas 1") self.newConnectivity(splitLine[0], splitLine) - else : + else: self.newConnectivity(splitLine[0], splitLine) - #print ("Retour de readConnectivity = {}".format(diagno)) + # print ("Retour de readConnectivity = {}".format(diagno)) return diagno -#==================================================================================== + # ==================================================================================== def correctConnectivity(self): """Correction des connectivités pour tenir compte de points alignés -Si 3 points sont alignés sur une ligne et qu'aucune ligne ne part du point central, -il faut scinder la ligne au niveau de ce point pour traiter correctement la suite : on se mettrait -à créer un plan avec ces 3 points alignés et tout s'effondre ensuite. + Si 3 points sont alignés sur une ligne et qu'aucune ligne ne part du point central, + il faut scinder la ligne au niveau de ce point pour traiter correctement la suite : on se mettrait + à créer un plan avec ces 3 points alignés et tout s'effondre ensuite. """ while True: # On explore toutes les lignes et on cherche un cas où sur une ligne 3 points consécutifs sont alignés @@ -211,62 +231,64 @@ il faut scinder la ligne au niveau de ce point pour traiter correctement la suit def correctConnectivity_a(self, l_noeuds): """On explore toutes les lignes et on cherche un cas où sur une ligne 3 points consécutifs sont alignés -Entrées : - :l_noeuds: liste des noeuds de la ligne + Entrées : + :l_noeuds: liste des noeuds de la ligne -Sorties : - :modif: on a modifié ou non la description des lignes + Sorties : + :modif: on a modifié ou non la description des lignes """ modif = False nb_points = len(l_noeuds) - printverbose ("Analyse de {}".format(l_noeuds), verbose=self._verbose_max) - #print ("nb_points = {}".format(nb_points)) + printverbose("Analyse de {}".format(l_noeuds), verbose=self._verbose_max) + # print ("nb_points = {}".format(nb_points)) indice = 0 nb_test = nb_points - 2 for iaux in range(nb_test): # Calcul de l'angle entre les 3 points de la séquence vect = list() - #print ("({},{},{}".format(l_noeuds[iaux],l_noeuds[iaux+1],l_noeuds[iaux+2])) + # print ("({},{},{}".format(l_noeuds[iaux],l_noeuds[iaux+1],l_noeuds[iaux+2])) for jaux in range(3): - coox = self.infoPoints[l_noeuds[iaux+jaux]]["X"] - cooy = self.infoPoints[l_noeuds[iaux+jaux]]["Y"] - cooz = self.infoPoints[l_noeuds[iaux+jaux]]["Z"] - vect.append(np.array((coox,cooy,cooz),np.float)) - cosinus = np.dot(vect[1]-vect[0],vect[1]-vect[2])/(np.linalg.norm(vect[1]-vect[0])* np.linalg.norm(vect[1]-vect[2])) - #print ("cosinus = {}".format(cosinus)) + coox = self.infoPoints[l_noeuds[iaux + jaux]]["X"] + cooy = self.infoPoints[l_noeuds[iaux + jaux]]["Y"] + cooz = self.infoPoints[l_noeuds[iaux + jaux]]["Z"] + vect.append(np.array((coox, cooy, cooz), np.float)) + cosinus = np.dot(vect[1] - vect[0], vect[1] - vect[2]) / ( + np.linalg.norm(vect[1] - vect[0]) * np.linalg.norm(vect[1] - vect[2]) + ) + # print ("cosinus = {}".format(cosinus)) # Si l'angle est plat, c'est que les 3 points sont alignés : on arrête... sauf si ce point est un départ d'une autre ! - if ( (1.-np.abs(cosinus)) < 1.e-4 ): - indice = iaux+1 + if (1.0 - np.abs(cosinus)) < 1.0e-4: + indice = iaux + 1 if l_noeuds[indice] not in self.connectivities: break else: indice = 0 # Si un angle plat a été trouvé, on scinde la ligne if indice: - #print ("id_noeud_debut = {}, {}".format(l_noeuds[0], l_noeuds[:indice+1])) - #print ("id_noeud_new = {}, {}".format(l_noeuds[indice], l_noeuds[indice:])) - self.newConnectivity(l_noeuds[0], l_noeuds[:indice+1]) + # print ("id_noeud_debut = {}, {}".format(l_noeuds[0], l_noeuds[:indice+1])) + # print ("id_noeud_new = {}, {}".format(l_noeuds[indice], l_noeuds[indice:])) + self.newConnectivity(l_noeuds[0], l_noeuds[: indice + 1]) self.newConnectivity(l_noeuds[indice], l_noeuds[indice:]) modif = True return modif -#==================================================================================== + # ==================================================================================== def newConnectivity(self, key, value): """newConnectivity""" self.connectivities[key] = dict() - self.connectivities[key]['chainage'] = value + self.connectivities[key]["chainage"] = value -#==================================================================================== + # ==================================================================================== def readFillet(self, line): """Décodage des caractéristiques de la connection entre deux tuyaux -La ligne est formée de deux informations : -. l'identifiant du noeud -. la caractérisation de la connection : "angular_connection" ou "radius=xxx" + La ligne est formée de deux informations : + . l'identifiant du noeud + . la caractérisation de la connection : "angular_connection" ou "radius=xxx" """ splitLine = line.split() if len(splitLine) != 2: @@ -285,10 +307,10 @@ La ligne est formée de deux informations : else: print(line) diagno = 3 - #print ("Retour de readFillet = {}".format(diagno)) + # print ("Retour de readFillet = {}".format(diagno)) return diagno -#==================================================================================== + # ==================================================================================== def retrieveSubshapesforWire(self, copy, key, ind): """retrieveSubshapesforWire""" @@ -298,160 +320,223 @@ La ligne est formée de deux informations : subshapesForWire = list() currentInd = 0 isPipe = True - #print("Current chainage : {}".format(self.connectivities[key]['chainage'][ind:])) - #print("Indice de démarrage = {}".format(ind)) + # print("Current chainage : {}".format(self.connectivities[key]['chainage'][ind:])) + # print("Indice de démarrage = {}".format(ind)) - while exp.more() and not end : - #print("Analyse Edge n°", currentInd) - #print(" => ", self.connectivities[key]['chainage'][currentInd], " - ", self.connectivities[key]['chainage'][currentInd+1]) - #print(" ==> ", self.infoPoints[self.connectivities[key]['chainage'][currentInd]]["isAngular"], " - ", self.infoPoints[self.connectivities[key]['chainage'][currentInd+1]]["isAngular"]) + while exp.more() and not end: + # print("Analyse Edge n°", currentInd) + # print(" => ", self.connectivities[key]['chainage'][currentInd], " - ", self.connectivities[key]['chainage'][currentInd+1]) + # print(" ==> ", self.infoPoints[self.connectivities[key]['chainage'][currentInd]]["isAngular"], " - ", self.infoPoints[self.connectivities[key]['chainage'][currentInd+1]]["isAngular"]) cur = exp.current().edge() if currentInd < ind: - #print("Edge non prise en compte") - #print("test si fillet : ", currentInd+1, ind, self.infoPoints[self.connectivities[key]['chainage'][currentInd+1]]["Fillet"]) - if currentInd+1 <= ind and self.infoPoints[self.connectivities[key]['chainage'][currentInd+1]]["Fillet"] == "radius" and not self.infoPoints[self.connectivities[key]['chainage'][currentInd]]["isAngular"]: - #print("Fillet à ne pas prendre en compte") + # print("Edge non prise en compte") + # print("test si fillet : ", currentInd+1, ind, self.infoPoints[self.connectivities[key]['chainage'][currentInd+1]]["Fillet"]) + if ( + currentInd + 1 <= ind + and self.infoPoints[ + self.connectivities[key]["chainage"][currentInd + 1] + ]["Fillet"] + == "radius" + and not self.infoPoints[ + self.connectivities[key]["chainage"][currentInd] + ]["isAngular"] + ): + # print("Fillet à ne pas prendre en compte") exp.next() cur = exp.current().edge() - else : + else: subshapesForWire.append(model.selection(copy.defaultResult(), cur)) - #print("Mode normal - Nb segments dans le wire : {}".format(len(subshapesForWire))) + # print("Mode normal - Nb segments dans le wire : {}".format(len(subshapesForWire))) # Cas du fillet : on récupère l'edge suivante - if self.infoPoints[self.connectivities[key]['chainage'][currentInd]]["isAngular"] or self.infoPoints[self.connectivities[key]['chainage'][currentInd+1]]["isAngular"]: + if ( + self.infoPoints[self.connectivities[key]["chainage"][currentInd]][ + "isAngular" + ] + or self.infoPoints[ + self.connectivities[key]["chainage"][currentInd + 1] + ]["isAngular"] + ): end = True - #print("Nb segments dans le wire : {}".format(len(subshapesForWire))) - if ( len(subshapesForWire) == 1 ): - #print("Coude droit en cours") + # print("Nb segments dans le wire : {}".format(len(subshapesForWire))) + if len(subshapesForWire) == 1: + # print("Coude droit en cours") currentInd += 1 isPipe = False - else : - #print("Coude droit à venir") + else: + # print("Coude droit à venir") subshapesForWire = subshapesForWire[:-1] - elif self.infoPoints[self.connectivities[key]['chainage'][currentInd]]["Fillet"] == "radius": - #print("Ajout edge start Fillet") + elif ( + self.infoPoints[self.connectivities[key]["chainage"][currentInd]][ + "Fillet" + ] + == "radius" + ): + # print("Ajout edge start Fillet") exp.next() cur = exp.current().edge() subshapesForWire.append(model.selection(copy.defaultResult(), cur)) - #currentInd = currentInd+1 - #print("Mode Fillet - Nb segments dans le wire : {}".format(len(subshapesForWire))) - elif self.infoPoints[self.connectivities[key]['chainage'][currentInd+1]]["Fillet"] == "radius": - #print("Ajout edge end Fillet") + # currentInd = currentInd+1 + # print("Mode Fillet - Nb segments dans le wire : {}".format(len(subshapesForWire))) + elif ( + self.infoPoints[ + self.connectivities[key]["chainage"][currentInd + 1] + ]["Fillet"] + == "radius" + ): + # print("Ajout edge end Fillet") exp.next() cur = exp.current().edge() subshapesForWire.append(model.selection(copy.defaultResult(), cur)) - #print("Mode Fillet - Nb segments dans le wire : {}".format(len(subshapesForWire))) - else : - if self.infoPoints[self.connectivities[key]['chainage'][currentInd+1]]["isEnd"]: - #print("Fin détecte") - currentInd = currentInd+1 + # print("Mode Fillet - Nb segments dans le wire : {}".format(len(subshapesForWire))) + else: + if self.infoPoints[ + self.connectivities[key]["chainage"][currentInd + 1] + ]["isEnd"]: + # print("Fin détecte") + currentInd = currentInd + 1 end = True - #else : - #print("Branchement") + # else : + # print("Branchement") if not end: - currentInd = currentInd+1 + currentInd = currentInd + 1 exp.next() - #print("End = {} {}".format(end,self.connectivities[key]['chainage'][currentInd])) + # print("End = {} {}".format(end,self.connectivities[key]['chainage'][currentInd])) - return subshapesForWire, currentInd, isPipe, self.connectivities[key]['chainage'][currentInd] + return ( + subshapesForWire, + currentInd, + isPipe, + self.connectivities[key]["chainage"][currentInd], + ) -#==================================================================================== + # ==================================================================================== def retrieveLastElement(self, obj, typeOfElement): """retrieveLastElement""" exp = GeomAPI_ShapeExplorer(obj.defaultResult().shape(), typeOfElement) while exp.more(): cur = None - if typeOfElement == GeomAPI_Shape.VERTEX : + if typeOfElement == GeomAPI_Shape.VERTEX: cur = exp.current().vertex() - elif typeOfElement == GeomAPI_Shape.EDGE : + elif typeOfElement == GeomAPI_Shape.EDGE: cur = exp.current().edge() - elif typeOfElement == GeomAPI_Shape.FACE : + elif typeOfElement == GeomAPI_Shape.FACE: cur = exp.current().face() - elif typeOfElement == GeomAPI_Shape.SOLID : + elif typeOfElement == GeomAPI_Shape.SOLID: cur = exp.current().solid() if cur is not None: exp.next() cur = model.selection(obj.defaultResult(), cur) return cur -#==================================================================================== + # ==================================================================================== def retrieveFirstElement(self, obj, typeOfElement): """retrieveFirstElement""" exp = GeomAPI_ShapeExplorer(obj.defaultResult().shape(), typeOfElement) cur = None - if typeOfElement == GeomAPI_Shape.VERTEX : + if typeOfElement == GeomAPI_Shape.VERTEX: cur = exp.current().vertex() - elif typeOfElement == GeomAPI_Shape.EDGE : + elif typeOfElement == GeomAPI_Shape.EDGE: cur = exp.current().edge() - elif typeOfElement == GeomAPI_Shape.FACE : + elif typeOfElement == GeomAPI_Shape.FACE: cur = exp.current().face() - elif typeOfElement == GeomAPI_Shape.SOLID : + elif typeOfElement == GeomAPI_Shape.SOLID: cur = exp.current().solid() if cur is not None: exp.next() cur = model.selection(obj.defaultResult(), cur) return cur -#==================================================================================== + # ==================================================================================== def createPipe(self, part, connectivityInfos): """createPipe""" lPipes = list() startFace = None fuse = None - for ind in range(len(connectivityInfos['paths'])): - printverbose ("Step = {}".format(ind), 80, verbose=self._verbose_max) + for ind in range(len(connectivityInfos["paths"])): + printverbose("Step = {}".format(ind), 80, verbose=self._verbose_max) if ind == 0: - startFace = connectivityInfos['sketch'] - if connectivityInfos['isPipe'][ind] : - pipe = model.addPipe(part, [startFace], connectivityInfos['paths'][ind].result()) - else : + startFace = connectivityInfos["sketch"] + if connectivityInfos["isPipe"][ind]: + pipe = model.addPipe( + part, [startFace], connectivityInfos["paths"][ind].result() + ) + else: # recherche du plan - if self.infoPoints[connectivityInfos['ends'][ind]]['isAngular']: - pipe = model.addExtrusion(part, [startFace], model.selection(), self.infoPoints[connectivityInfos['ends'][ind]]['plane'], 0, model.selection(), 0, "Faces|Wires") - else : + if self.infoPoints[connectivityInfos["ends"][ind]]["isAngular"]: + pipe = model.addExtrusion( + part, + [startFace], + model.selection(), + self.infoPoints[connectivityInfos["ends"][ind]]["plane"], + 0, + model.selection(), + 0, + "Faces|Wires", + ) + else: # le plan cible n'existe pas - edge = model.addAxis(part, self.infoPoints[connectivityInfos['starts'][ind]]['point'], self.infoPoints[connectivityInfos['ends'][ind]]['point']) + edge = model.addAxis( + part, + self.infoPoints[connectivityInfos["starts"][ind]]["point"], + self.infoPoints[connectivityInfos["ends"][ind]]["point"], + ) edge.execute(True) - self.lfeatures.append(edge)# self.retrieveFirstElement(connectivityInfos['paths'][ind], GeomAPI_Shape.EDGE) + self.lfeatures.append( + edge + ) # self.retrieveFirstElement(connectivityInfos['paths'][ind], GeomAPI_Shape.EDGE) self.ledges.append(edge) - point = self.retrieveLastElement(connectivityInfos['paths'][ind], GeomAPI_Shape.VERTEX) + point = self.retrieveLastElement( + connectivityInfos["paths"][ind], GeomAPI_Shape.VERTEX + ) plane = model.addPlane(part, edge.result(), point, True) plane.execute(True) self.lfeatures.append(plane) - pipe = model.addExtrusion(part, [startFace], edge.result(), plane.result(), 0, model.selection(), 0, "Faces|Wires") + pipe = model.addExtrusion( + part, + [startFace], + edge.result(), + plane.result(), + 0, + model.selection(), + 0, + "Faces|Wires", + ) pipe.execute(True) self.lfeatures.append(pipe) lPipes.append(pipe.result()) - if ( ind < len(connectivityInfos['paths'])-1 ): + if ind < len(connectivityInfos["paths"]) - 1: copy = model.addCopy(part, [model.selection(pipe.defaultResult())], 1) copy.execute(True) self.lfeatures.append(copy) startFace = self.retrieveLastElement(copy, GeomAPI_Shape.FACE) - if len(lPipes) > 1 : + if len(lPipes) > 1: fuse = model.addFuse(part, lPipes, False) fuse.execute(True) self.lfeatures.append(fuse) - else : + else: return pipe return fuse -#========================================================== + # ========================================================== -#========================================================== -# Création des différents éléments + # ========================================================== + # Création des différents éléments def createPoints(self, part): """Création des points -Le point est créé en tant qu'objet de construction avec ses coordonnées. -Il est nommé conformément au texte donné dans le fichier de données. Cela n'a qu'un intérêt graphique mais agréable en débogage. -""" - print("========================= Création des noeuds ============================") + Le point est créé en tant qu'objet de construction avec ses coordonnées. + Il est nommé conformément au texte donné dans le fichier de données. Cela n'a qu'un intérêt graphique mais agréable en débogage. + """ + print( + "========================= Création des noeuds ============================" + ) for key, value in self.infoPoints.items(): - printverbose ("Noeud : '{}'".format(key), verbose=self._verbose) - point = model.addPoint(part, value['X'], value['Y'], value['Z']) + printverbose("Noeud : '{}'".format(key), verbose=self._verbose) + point = model.addPoint(part, value["X"], value["Y"], value["Z"]) point.execute(True) point.setName(key) point.result().setName(key) @@ -461,19 +546,21 @@ Il est nommé conformément au texte donné dans le fichier de données. Cela n' def createPolylines(self, part): """Création des polylines -La polyligne est créée en tant que résultat en enchaînant ses points. -Elle est nommée conformément aux 1er et dernier noeud. Cela n'a qu'un intérêt graphique mais agréable en débogage. -""" - print("========================= Création des polylines =========================") + La polyligne est créée en tant que résultat en enchaînant ses points. + Elle est nommée conformément aux 1er et dernier noeud. Cela n'a qu'un intérêt graphique mais agréable en débogage. + """ + print( + "========================= Création des polylines =========================" + ) for key, value in self.connectivities.items(): - printverbose ("Ligne : {}".format(value['chainage']), verbose=self._verbose) + printverbose("Ligne : {}".format(value["chainage"]), verbose=self._verbose) lPoints = list() - for id_noeud in value['chainage']: + for id_noeud in value["chainage"]: lPoints.append(self.infoPoints[id_noeud]["point"]) id_noeud_fin = id_noeud polyline = model.addPolyline3D(part, lPoints, False) polyline.execute(True) - nom = "L_{}_{}".format(key,id_noeud_fin) + nom = "L_{}_{}".format(key, id_noeud_fin) polyline.setName(nom) polyline.result().setName(nom) self.lfeatures.append(polyline) @@ -482,18 +569,39 @@ Elle est nommée conformément aux 1er et dernier noeud. Cela n'a qu'un intérê def createFillets(self, part): """Création des fillets -Le fillet est créé en tant que résultat. -Il est nommé conformément au noeud d'application. Cela n'a qu'un intérêt graphique mais agréable en débogage. -""" - print("========================= Création des fillets ===========================") + Le fillet est créé en tant que résultat. + Il est nommé conformément au noeud d'application. Cela n'a qu'un intérêt graphique mais agréable en débogage. + """ + print( + "========================= Création des fillets ===========================" + ) for key, value in self.connectivities.items(): - printverbose ("Examen de la ligne démarrant sur le noeud '{}'".format(key), verbose=self._verbose) + printverbose( + "Examen de la ligne démarrant sur le noeud '{}'".format(key), + verbose=self._verbose, + ) # recherche des noeuds fillets value["fillet"] = value["polyline"] - for id_noeud in value['chainage']: - if self.infoPoints[id_noeud]["Fillet"] == "radius" : - printverbose ("\tFillet sur le noeud '{}'".format(id_noeud), verbose=self._verbose) - fillet1D = model.addFillet(part, [model.selection("VERTEX", (self.infoPoints[id_noeud]["X"],self.infoPoints[id_noeud]["Y"],self.infoPoints[id_noeud]["Z"]))], self.infoPoints[id_noeud]["Radius"]) + for id_noeud in value["chainage"]: + if self.infoPoints[id_noeud]["Fillet"] == "radius": + printverbose( + "\tFillet sur le noeud '{}'".format(id_noeud), + verbose=self._verbose, + ) + fillet1D = model.addFillet( + part, + [ + model.selection( + "VERTEX", + ( + self.infoPoints[id_noeud]["X"], + self.infoPoints[id_noeud]["Y"], + self.infoPoints[id_noeud]["Z"], + ), + ) + ], + self.infoPoints[id_noeud]["Radius"], + ) fillet1D.execute(True) nom = "F_{}".format(id_noeud) fillet1D.setName(nom) @@ -501,113 +609,188 @@ Il est nommé conformément au noeud d'application. Cela n'a qu'un intérêt gra self.lfeatures.append(fillet1D) value["fillet"] = fillet1D -#========================================================== + # ========================================================== def searchRightConnections(self, part): """Recherche des coudes droits""" - print("========================= Recherche des coudes droits ====================") + print( + "========================= Recherche des coudes droits ====================" + ) for key, value in self.connectivities.items(): - printverbose ("Examen de la ligne démarrant sur le noeud '{}'".format(key), verbose=self._verbose) + printverbose( + "Examen de la ligne démarrant sur le noeud '{}'".format(key), + verbose=self._verbose, + ) # recherche des noeuds fillets - for ind, id_noeud in enumerate(value['chainage']): - printverbose ("\tNoeud '{}' : {}".format(id_noeud,self.infoPoints[id_noeud]["Fillet"]), verbose=self._verbose) - if ( ( ind == 0 ) or ( ind == len(value['chainage'])-1 ) ): + for ind, id_noeud in enumerate(value["chainage"]): + printverbose( + "\tNoeud '{}' : {}".format( + id_noeud, self.infoPoints[id_noeud]["Fillet"] + ), + verbose=self._verbose, + ) + if (ind == 0) or (ind == len(value["chainage"]) - 1): self.infoPoints[id_noeud]["isAngular"] = False - else : - if self.infoPoints[id_noeud]["Fillet"] == "radius" : + else: + if self.infoPoints[id_noeud]["Fillet"] == "radius": self.infoPoints[id_noeud]["isAngular"] = False - else : + else: if id_noeud in self.connectivities: self.infoPoints[id_noeud]["isAngular"] = False - else : + else: self.infoPoints[id_noeud]["isAngular"] = True # Axe d'extrusion - #print(ind-1, ind, ind+1) - printverbose ("\t\tCréation du plan passant par les points : ('{}','{}','{}')".format(value["chainage"][ind-1], id_noeud, value["chainage"][ind+1]), verbose=self._verbose) - #print(self.infoPoints[value["chainage"][ind-1]]["point"]) - - tmpPlane = model.addPlane(part, self.infoPoints[value["chainage"][ind-1]]["point"], self.infoPoints[id_noeud]["point"], self.infoPoints[value["chainage"][ind+1]]["point"]) + # print(ind-1, ind, ind+1) + printverbose( + "\t\tCréation du plan passant par les points : ('{}','{}','{}')".format( + value["chainage"][ind - 1], + id_noeud, + value["chainage"][ind + 1], + ), + verbose=self._verbose, + ) + # print(self.infoPoints[value["chainage"][ind-1]]["point"]) + + tmpPlane = model.addPlane( + part, + self.infoPoints[value["chainage"][ind - 1]]["point"], + self.infoPoints[id_noeud]["point"], + self.infoPoints[value["chainage"][ind + 1]]["point"], + ) tmpPlane.execute(True) self.lfeatures.append(tmpPlane) - axis = model.addAxis(part, tmpPlane.result(), self.infoPoints[id_noeud]["point"]) + axis = model.addAxis( + part, + tmpPlane.result(), + self.infoPoints[id_noeud]["point"], + ) axis.execute(True) self.lfeatures.append(axis) self.infoPoints[id_noeud]["axis"] = axis.result() # Edge à extruder - tmpEdge = model.addEdge(part, self.infoPoints[id_noeud]["point"], self.infoPoints[value["chainage"][ind+1]]["point"]) + tmpEdge = model.addEdge( + part, + self.infoPoints[id_noeud]["point"], + self.infoPoints[value["chainage"][ind + 1]]["point"], + ) tmpEdge.execute(True) self.lfeatures.append(tmpEdge) - length = model.measureDistance(part, self.infoPoints[value["chainage"][ind-1]]["point"], self.infoPoints[id_noeud]["point"]) - point = model.addPoint(part, tmpEdge.result(), length, False, False) + length = model.measureDistance( + part, + self.infoPoints[value["chainage"][ind - 1]]["point"], + self.infoPoints[id_noeud]["point"], + ) + point = model.addPoint( + part, tmpEdge.result(), length, False, False + ) point.execute(True) self.lfeatures.append(point) - baseEdge = model.addEdge(part, self.infoPoints[value["chainage"][ind-1]]["point"], point.result()) + baseEdge = model.addEdge( + part, + self.infoPoints[value["chainage"][ind - 1]]["point"], + point.result(), + ) baseEdge.execute(True) self.lfeatures.append(baseEdge) - middlePoint = model.addPoint(part, baseEdge.result(), 0.5, True, False) + middlePoint = model.addPoint( + part, baseEdge.result(), 0.5, True, False + ) middlePoint.execute(True) self.lfeatures.append(middlePoint) - Edge = model.addEdge(part, self.infoPoints[id_noeud]["point"], middlePoint.result()) + Edge = model.addEdge( + part, + self.infoPoints[id_noeud]["point"], + middlePoint.result(), + ) Edge.execute(True) self.lfeatures.append(Edge) self.ledges.append(Edge) # Extrusion - plane = model.addExtrusion(part, [Edge.result()], axis.result(), 10, 0) + plane = model.addExtrusion( + part, [Edge.result()], axis.result(), 10, 0 + ) plane.execute(True) self.lfeatures.append(plane) self.infoPoints[id_noeud]["plane"] = plane.result() def createPaths(self, part): """Création des paths pour le pipeNetwork""" - print("========================= Création des paths =============================") + print( + "========================= Création des paths =============================" + ) for key, value in self.connectivities.items(): - printverbose ("Ligne démarrant sur le noeud '{}'".format(key), verbose=self._verbose) + printverbose( + "Ligne démarrant sur le noeud '{}'".format(key), verbose=self._verbose + ) # recherche des noeuds fillets value["paths"] = list() value["isPipe"] = list() value["starts"] = list() value["ends"] = list() ind = 0 - copy = value['fillet'] - while ind < len(value['chainage'])-1: - value["starts"].append(self.connectivities[key]['chainage'][ind]) - objectsForPath, ind, isPipe, end_noeud = self.retrieveSubshapesforWire(copy, key, ind) + copy = value["fillet"] + while ind < len(value["chainage"]) - 1: + value["starts"].append(self.connectivities[key]["chainage"][ind]) + objectsForPath, ind, isPipe, end_noeud = self.retrieveSubshapesforWire( + copy, key, ind + ) if self._verbose_max: print("************************* ind = {}".format(ind)) - print("************************* objectsForPath = {}".format(objectsForPath)) + print( + "************************* objectsForPath = {}".format( + objectsForPath + ) + ) path = model.addWire(part, objectsForPath, False) path.execute(True) self.lfeatures.append(path) value["paths"].append(path) value["isPipe"].append(isPipe) value["ends"].append(end_noeud) - if ind < len(value['chainage'])-1: - copy = model.addCopy(part, [model.selection(copy.defaultResult())], 1) + if ind < len(value["chainage"]) - 1: + copy = model.addCopy( + part, [model.selection(copy.defaultResult())], 1 + ) copy.execute(True) self.lfeatures.append(copy) def createSketches(self, part): """Création des sketchs""" - print("========================= Création des sketchs =========================") + print( + "========================= Création des sketchs =========================" + ) for key, value in self.connectivities.items(): - printverbose ("Ligne démarrant sur le noeud '{}'".format(key), verbose=self._verbose) + printverbose( + "Ligne démarrant sur le noeud '{}'".format(key), verbose=self._verbose + ) # Creating sketch - edge = model.addEdge(part, self.infoPoints[value["chainage"][0]]["point"], self.infoPoints[value["chainage"][1]]["point"]) + edge = model.addEdge( + part, + self.infoPoints[value["chainage"][0]]["point"], + self.infoPoints[value["chainage"][1]]["point"], + ) edge.execute(True) self.lfeatures.append(edge) - plane = model.addPlane(part, edge.result(), self.infoPoints[value["chainage"][0]]["point"], True) + plane = model.addPlane( + part, + edge.result(), + self.infoPoints[value["chainage"][0]]["point"], + True, + ) plane.execute(True) self.lfeatures.append(plane) sketch = model.addSketch(part, plane.result()) sketch.execute(True) self.lfeatures.append(sketch) - SketchProjection = sketch.addProjection(self.infoPoints[value["chainage"][0]]["point"], False) + SketchProjection = sketch.addProjection( + self.infoPoints[value["chainage"][0]]["point"], False + ) SketchProjection.execute(True) SketchPoint = SketchProjection.createdFeature() SketchPoint.execute(True) - SketchCircle = sketch.addCircle(0,0,self.radius) + SketchCircle = sketch.addCircle(0, 0, self.radius) SketchCircle.execute(True) sketch.setCoincident(SketchPoint.result(), SketchCircle.center()) sketch.setRadius(SketchCircle.results()[1], self.radius) @@ -619,7 +802,9 @@ Il est nommé conformément au noeud d'application. Cela n'a qu'un intérêt gra """Création des pipes""" print("========================= Création des pipes =========================") for key, value in self.connectivities.items(): - printverbose ("Ligne démarrant sur le noeud '{}'".format(key), verbose=self._verbose) + printverbose( + "Ligne démarrant sur le noeud '{}'".format(key), verbose=self._verbose + ) pipe = self.createPipe(part, value) value["pipe"] = pipe.result() @@ -628,7 +813,7 @@ Il est nommé conformément au noeud d'application. Cela n'a qu'un intérêt gra lPipes = list() for key, value in self.connectivities.items(): lPipes.append(value["pipe"]) - if len(lPipes) > 1 : + if len(lPipes) > 1: fuse = model.addFuse(part, lPipes, False) fuse.execute(True) fuse.setName(nameRes) @@ -636,9 +821,9 @@ Il est nommé conformément au noeud d'application. Cela n'a qu'un intérêt gra else: lPipes[0].setName(nameRes) -#========================================================== + # ========================================================== - def print_info (self, verbose, comment=""): + def print_info(self, verbose, comment=""): """Impression si verbose est valide. Avec un comentaire introductif éventuellement.""" if verbose: texte = "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" @@ -652,24 +837,23 @@ Il est nommé conformément au noeud d'application. Cela n'a qu'un intérêt gra for key, value in self.connectivities.items(): texte += "\n{} : {}".format(key, value) texte += "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" - print(texte+"\n") + print(texte + "\n") -#========================================================== + # ========================================================== -# Execution of the Import + # Execution of the Import def execute(self): """F.execute() -- execute the Feature""" # Retrieving the user input - apath = self.string(self.FILE_ID()) + apath = self.string(self.FILE_ID()) filepath = apath.value() - if filepath != "" : - + if filepath != "": # A. Initialisation part = model.activeDocument() - if self.lfeatures : + if self.lfeatures: for feature in self.lfeatures: part.removeFeature(feature.feature()) self.lfeatures = list() @@ -679,76 +863,118 @@ Il est nommé conformément au noeud d'application. Cela n'a qu'un intérêt gra self.connectivities = dict() from os.path import basename + filename = basename(filepath) - if ( "." in filename ): - laux= filename.split(".") + if "." in filename: + laux = filename.split(".") nameRes = laux[0] for saux in laux[1:-1]: - nameRes+="."+saux + nameRes += "." + saux else: nameRes = filename # Creating the construction points in the current document # B. Traitement du fichier - print ("\n=============== Traitement du fichier {}".format(filepath)) + print("\n=============== Traitement du fichier {}".format(filepath)) error = 0 while True: - # B.1. Lecture du fichier - with open(filepath, encoding='utf-8') as afile: + with open(filepath, encoding="utf-8") as afile: summary = 0 method = self.parligne for line in afile: - printverbose (line[:-1], verbose=self._verbose_max) + printverbose(line[:-1], verbose=self._verbose_max) # B.1.1. Repérages if line == "\n": - printverbose ("========================= Saut de ligne =========================", verbose=self._verbose_max) + printverbose( + "========================= Saut de ligne =========================", + verbose=self._verbose_max, + ) continue if line[0] == "#" or line[:3] == "...": continue - if summary == 0 and line[:-1] == "nodes section" : - printverbose ("========================= Lecture des coordonnées ==============================", 80, verbose=self._verbose) + if summary == 0 and line[:-1] == "nodes section": + printverbose( + "========================= Lecture des coordonnées ==============================", + 80, + verbose=self._verbose, + ) summary = 1 continue - if summary == 1 and line[:-1] == "connectivity section" : - printverbose ("========================= Lecture de la connectivité ===========================", 80, verbose=self._verbose) + if summary == 1 and line[:-1] == "connectivity section": + printverbose( + "========================= Lecture de la connectivité ===========================", + 80, + verbose=self._verbose, + ) summary = 2 continue - if summary == 2 and line[:6] == "method" : - printverbose ("===================== summary == 2 method =========================", verbose=self._verbose_max) + if summary == 2 and line[:6] == "method": + printverbose( + "===================== summary == 2 method =========================", + verbose=self._verbose_max, + ) method = line[7:-1] - printverbose ("Méthode : '{}'".format(method), verbose=self._verbose) + printverbose( + "Méthode : '{}'".format(method), verbose=self._verbose + ) if method not in (self.twopartwo, self.parligne): raiseException("Problem with type of connectivity") continue - if summary == 2 and line[:-1] == "fillets section" : - printverbose ("========================= Lecture des fillets =========================", 80, verbose=self._verbose) + if summary == 2 and line[:-1] == "fillets section": + printverbose( + "========================= Lecture des fillets =========================", + 80, + verbose=self._verbose, + ) summary = 3 continue # B.1.2. Enregistrement des données if summary == 1: - printverbose ("===================== summary == 1 =========================", 80, verbose=self._verbose_max) + printverbose( + "===================== summary == 1 =========================", + 80, + verbose=self._verbose_max, + ) diagno, texte = self.readNodeInfo(line[:-1]) if diagno: - raiseException("{}\nProblem with description of nodes.".format(texte)) + raiseException( + "{}\nProblem with description of nodes.".format( + texte + ) + ) continue if summary == 2: - printverbose ("===================== summary == 2 =========================", 80, verbose=self._verbose_max) - diagno = self.readConnectivity(line[:-1],method) + printverbose( + "===================== summary == 2 =========================", + 80, + verbose=self._verbose_max, + ) + diagno = self.readConnectivity(line[:-1], method) if diagno: - raiseException("Problem with description of connectivities") + raiseException( + "Problem with description of connectivities" + ) continue if summary == 3: - printverbose ("===================== summary == 3 =========================", 80, verbose=self._verbose_max) + printverbose( + "===================== summary == 3 =========================", + 80, + verbose=self._verbose_max, + ) diagno = self.readFillet(line[:-1]) if diagno: raiseException("Problem with description of fillets") continue - printverbose ("===================== Rien =========================", 80, verbose=self._verbose_max) + printverbose( + "===================== Rien =========================", + 80, + verbose=self._verbose_max, + ) if diagno: error = diagno break @@ -756,17 +982,16 @@ Il est nommé conformément au noeud d'application. Cela n'a qu'un intérêt gra if error: break - # B.2. Gestion des points alignés - self.print_info (self._verbose_max, "avant gestion des points alignés") + self.print_info(self._verbose_max, "avant gestion des points alignés") - self.correctConnectivity () + self.correctConnectivity() # B.3. Signalement de la fin d'une chaine for _, value in self.connectivities.items(): - self.infoPoints[value['chainage'][-1]]["isEnd"] = True + self.infoPoints[value["chainage"][-1]]["isEnd"] = True - self.print_info (self._verbose_max, "avant les création de points, etc.") + self.print_info(self._verbose_max, "avant les création de points, etc.") # B.4. Creation des points self.createPoints(part) @@ -786,18 +1011,24 @@ Il est nommé conformément au noeud d'application. Cela n'a qu'un intérêt gra # B.9. Création des sketchs pour le pipeNetwork self.createSketches(part) - self.print_info (self._verbose_max, "après la création des sketchs") + self.print_info(self._verbose_max, "après la création des sketchs") # B.10. Création des pipes self.createPipes(part, nameRes) # B.11. Dossier pour les opérations internes - print("========================= Mise en dossier =========================") - self.folder = model.addFolder(part, self.lfeatures[0], self.lfeatures[-1]) + print( + "========================= Mise en dossier =========================" + ) + self.folder = model.addFolder( + part, self.lfeatures[0], self.lfeatures[-1] + ) self.folder.setName("{}_inter".format(nameRes)) # B.12. Ménage des résultats inutiles - print("========================= Ménage des résultats inutiles ==================") + print( + "========================= Ménage des résultats inutiles ==================" + ) laux = list() for iaux in range(len(self.ledges)): laux.append(model.selection("EDGE", "Edge_{}_1".format(iaux))) diff --git a/src/PythonAddons/macros/rectangle/feature.py b/src/PythonAddons/macros/rectangle/feature.py index f719c435a..f85ad79eb 100755 --- a/src/PythonAddons/macros/rectangle/feature.py +++ b/src/PythonAddons/macros/rectangle/feature.py @@ -26,6 +26,7 @@ from salome.shaper import model import ModelAPI import GeomDataAPI + class SketchPlugin_Rectangle(model.Feature): """ Implementation of rectangle creation. @@ -33,7 +34,7 @@ class SketchPlugin_Rectangle(model.Feature): It produced 2 horizontal lines and 2 vertical lines connected by coincidence constraints """ -# Initializations + # Initializations def __init__(self): """x.__init__(...) initializes x; see x.__class__.__doc__ for signature""" @@ -94,32 +95,50 @@ class SketchPlugin_Rectangle(model.Feature): """Returns ID of a corner.""" return "RectCornerPoint" - def getKind(self): """Override Feature.getKind()""" return SketchPlugin_Rectangle.ID() - -# Initialization of the rectangle + # Initialization of the rectangle def initAttributes(self): """Override Feature.initAttributes()""" # Flag whether the rectangle is accessory - self.data().addAttribute(self.AUXILIARY_ID(), ModelAPI.ModelAPI_AttributeBoolean.typeId()) + self.data().addAttribute( + self.AUXILIARY_ID(), ModelAPI.ModelAPI_AttributeBoolean.typeId() + ) # Creating corners of the rectangle - self.data().addAttribute(self.START_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId()) - self.data().addAttribute(self.END_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId()) + self.data().addAttribute( + self.START_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId() + ) + self.data().addAttribute( + self.END_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId() + ) # Creating list to store lines - self.data().addAttribute(self.LINES_LIST_ID(), ModelAPI.ModelAPI_AttributeRefList.typeId()) - ModelAPI.ModelAPI_Session.get().validators().registerNotObligatory(self.getKind(), self.LINES_LIST_ID()) + self.data().addAttribute( + self.LINES_LIST_ID(), ModelAPI.ModelAPI_AttributeRefList.typeId() + ) + ModelAPI.ModelAPI_Session.get().validators().registerNotObligatory( + self.getKind(), self.LINES_LIST_ID() + ) # Type of rectangle - self.data().addAttribute(self.RECTANGLE_TYPE_ID(), ModelAPI.ModelAPI_AttributeString.typeId()) + self.data().addAttribute( + self.RECTANGLE_TYPE_ID(), ModelAPI.ModelAPI_AttributeString.typeId() + ) # Center and corner of the rectangle - self.data().addAttribute(self.CENTER_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId()) - self.data().addAttribute(self.CORNER_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId()) - - self.data().addAttribute(self.CENTER_REF_ID(), ModelAPI.ModelAPI_AttributeRefAttr.typeId()) - ModelAPI.ModelAPI_Session.get().validators().registerNotObligatory(self.getKind(), self.CENTER_REF_ID()) + self.data().addAttribute( + self.CENTER_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId() + ) + self.data().addAttribute( + self.CORNER_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId() + ) + + self.data().addAttribute( + self.CENTER_REF_ID(), ModelAPI.ModelAPI_AttributeRefAttr.typeId() + ) + ModelAPI.ModelAPI_Session.get().validators().registerNotObligatory( + self.getKind(), self.CENTER_REF_ID() + ) def isMacro(self): """ @@ -128,7 +147,7 @@ class SketchPlugin_Rectangle(model.Feature): """ return True -# Edition of the rectangle + # Edition of the rectangle def execute(self): # Retrieving list of already created lines @@ -136,14 +155,14 @@ class SketchPlugin_Rectangle(model.Feature): aNbLines = aLinesList.size() if aNbLines == 1: # Create 1-4 lines to compose the rectangle - for i in range (0, 3): + for i in range(0, 3): aLine = self.__sketch.addFeature("SketchLine") aLinesList.append(aLine) self.updateLines() aNbLines = aLinesList.size() aStartPoints = [] # Create constraints to keep the rectangle - for i in range (0, aNbLines): + for i in range(0, aNbLines): aLine = ModelAPI.objectToFeature(aLinesList.object(i)) # connect neighbor lines by coincidence iPrev = i - 1 @@ -161,16 +180,25 @@ class SketchPlugin_Rectangle(model.Feature): # Update coordinates of created lines self.updateLines() # Create auxiliary diagonals in case of centered rectangle - if self.string(self.RECTANGLE_TYPE_ID()).value() == self.RECTANGLE_CENTERED_ID(): + if ( + self.string(self.RECTANGLE_TYPE_ID()).value() + == self.RECTANGLE_CENTERED_ID() + ): aDiag1 = self.__sketch.addFeature("SketchLine") aLinesList.append(aDiag1) aDiag2 = self.__sketch.addFeature("SketchLine") aLinesList.append(aDiag2) # coincidences in corners - aPoints = [aDiag1.attribute("StartPoint"), aDiag2.attribute("StartPoint"), - aDiag1.attribute("EndPoint"), aDiag2.attribute("EndPoint")] - for i in range (0, len(aPoints)): - aCoincidence = self.__sketch.addFeature("SketchConstraintCoincidence") + aPoints = [ + aDiag1.attribute("StartPoint"), + aDiag2.attribute("StartPoint"), + aDiag1.attribute("EndPoint"), + aDiag2.attribute("EndPoint"), + ] + for i in range(0, len(aPoints)): + aCoincidence = self.__sketch.addFeature( + "SketchConstraintCoincidence" + ) aRefAttrA = aCoincidence.refattr("ConstraintEntityA") aRefAttrB = aCoincidence.refattr("ConstraintEntityB") aRefAttrA.setAttr(aStartPoints[i]) @@ -183,18 +211,20 @@ class SketchPlugin_Rectangle(model.Feature): refPnt = self.getReferencePoint(self.refattr(self.CENTER_REF_ID())) if refPnt is not None: for line in [aDiag1.lastResult(), aDiag2.lastResult()]: - aCoincidence = self.__sketch.addFeature("SketchConstraintCoincidence") + aCoincidence = self.__sketch.addFeature( + "SketchConstraintCoincidence" + ) aCoincidence.refattr("ConstraintEntityA").setAttr(refPnt) aCoincidence.refattr("ConstraintEntityB").setObject(line) # Perpendicular for the lines which already have result - for i in range (0, 3): + for i in range(0, 3): if self.__isPERP[i]: continue aLine_A = ModelAPI.objectToFeature(aLinesList.object(i)) aLineResult_A = aLine_A.lastResult() if aLineResult_A is None: continue - aLine_B = ModelAPI.objectToFeature(aLinesList.object(i+1)) + aLine_B = ModelAPI.objectToFeature(aLinesList.object(i + 1)) aLineResult_B = aLine_B.lastResult() if aLineResult_B is None: continue @@ -206,10 +236,16 @@ class SketchPlugin_Rectangle(model.Feature): self.__isPERP[i] = True def attributeChanged(self, theID): - if theID == self.START_ID() or theID == self.END_ID() or theID == self.CENTER_ID() or theID == self.CENTER_REF_ID() or theID == self.CORNER_ID(): + if ( + theID == self.START_ID() + or theID == self.END_ID() + or theID == self.CENTER_ID() + or theID == self.CENTER_REF_ID() + or theID == self.CORNER_ID() + ): # Search the sketch containing this rectangle self.__sketch = None - aRefs = self.data().refsToMe(); + aRefs = self.data().refsToMe() for iter in aRefs: aFeature = ModelAPI.objectToFeature(iter.owner()) if aFeature.getKind() == "Sketch": @@ -220,24 +256,30 @@ class SketchPlugin_Rectangle(model.Feature): aNbLines = aLinesList.size() if aNbLines == 0: # Create first line to be able to create a coincidence with selected point/feature - for i in range (0, 1): + for i in range(0, 1): aLine = self.__sketch.addFeature("SketchLine") aLinesList.append(aLine) - aStartPoint = GeomDataAPI.geomDataAPI_Point2D(self.attribute(self.START_ID())) + aStartPoint = GeomDataAPI.geomDataAPI_Point2D( + self.attribute(self.START_ID()) + ) aEndPoint = GeomDataAPI.geomDataAPI_Point2D(self.attribute(self.END_ID())) - aCenter = self.getPointByRef(self.attribute(self.CENTER_ID()), self.refattr(self.CENTER_REF_ID())) + aCenter = self.getPointByRef( + self.attribute(self.CENTER_ID()), self.refattr(self.CENTER_REF_ID()) + ) aCorner = GeomDataAPI.geomDataAPI_Point2D(self.attribute(self.CORNER_ID())) - if (aStartPoint.isInitialized() and aEndPoint.isInitialized()) or (aCenter is not None and aCorner.isInitialized()): - self.updateLines() + if (aStartPoint.isInitialized() and aEndPoint.isInitialized()) or ( + aCenter is not None and aCorner.isInitialized() + ): + self.updateLines() else: - self.updateStartPoint() + self.updateStartPoint() if theID == self.AUXILIARY_ID(): anAuxiliary = self.data().boolean(self.AUXILIARY_ID()).value() aLinesList = self.reflist(self.LINES_LIST_ID()) aNbLines = aLinesList.size() # Update coordinates of rectangle lines - for i in range (0, aNbLines): + for i in range(0, aNbLines): aLine = ModelAPI.objectToFeature(aLinesList.object(i)) aLine.data().boolean("Auxiliary").setValue(anAuxiliary) @@ -264,15 +306,22 @@ class SketchPlugin_Rectangle(model.Feature): # Retrieving list of already created lines aLinesList = self.reflist(self.LINES_LIST_ID()) aNbLines = min(aLinesList.size(), 4) - if self.string(self.RECTANGLE_TYPE_ID()).value() == self.RECTANGLE_CENTERED_ID(): - aCenter = self.getPointByRef(self.attribute(self.CENTER_ID()), self.refattr(self.CENTER_REF_ID())) + if ( + self.string(self.RECTANGLE_TYPE_ID()).value() + == self.RECTANGLE_CENTERED_ID() + ): + aCenter = self.getPointByRef( + self.attribute(self.CENTER_ID()), self.refattr(self.CENTER_REF_ID()) + ) aCorner = GeomDataAPI.geomDataAPI_Point2D(self.attribute(self.CORNER_ID())) aStartX = 2.0 * aCenter.x() - aCorner.x() aStartY = 2.0 * aCenter.y() - aCorner.y() aX = [aStartX, aStartX, aCorner.x(), aCorner.x()] aY = [aStartY, aCorner.y(), aCorner.y(), aStartY] else: - aStartPoint = GeomDataAPI.geomDataAPI_Point2D(self.attribute(self.START_ID())) + aStartPoint = GeomDataAPI.geomDataAPI_Point2D( + self.attribute(self.START_ID()) + ) aEndPoint = GeomDataAPI.geomDataAPI_Point2D(self.attribute(self.END_ID())) aX = [aStartPoint.x(), aStartPoint.x(), aEndPoint.x(), aEndPoint.x()] aY = [aStartPoint.y(), aEndPoint.y(), aEndPoint.y(), aStartPoint.y()] @@ -280,30 +329,37 @@ class SketchPlugin_Rectangle(model.Feature): # do not recalculate the rectrangle after each update wasBlocked = [] - for i in range (0, aLinesList.size()): - wasBlocked.append(aLinesList.object(i).data().blockSendAttributeUpdated(True)) + for i in range(0, aLinesList.size()): + wasBlocked.append( + aLinesList.object(i).data().blockSendAttributeUpdated(True) + ) # Update coordinates of rectangle lines - for i in range (0, aNbLines): + for i in range(0, aNbLines): aLine = ModelAPI.objectToFeature(aLinesList.object(i)) aLineStart = GeomDataAPI.geomDataAPI_Point2D(aLine.attribute("StartPoint")) aLineEnd = GeomDataAPI.geomDataAPI_Point2D(aLine.attribute("EndPoint")) - aLineStart.setValue(aX[i-1], aY[i-1]) + aLineStart.setValue(aX[i - 1], aY[i - 1]) aLineEnd.setValue(aX[i], aY[i]) aLine.data().boolean("Auxiliary").setValue(anAuxiliary) # Update auxiliary diagonals - if self.string(self.RECTANGLE_TYPE_ID()).value() == self.RECTANGLE_CENTERED_ID(): - for i in range (aNbLines, aLinesList.size()): + if ( + self.string(self.RECTANGLE_TYPE_ID()).value() + == self.RECTANGLE_CENTERED_ID() + ): + for i in range(aNbLines, aLinesList.size()): aLine = ModelAPI.objectToFeature(aLinesList.object(i)) - aLineStart = GeomDataAPI.geomDataAPI_Point2D(aLine.attribute("StartPoint")) + aLineStart = GeomDataAPI.geomDataAPI_Point2D( + aLine.attribute("StartPoint") + ) aLineEnd = GeomDataAPI.geomDataAPI_Point2D(aLine.attribute("EndPoint")) - aLineStart.setValue(aX[i-aNbLines-1], aY[i-aNbLines-1]) - aLineEnd.setValue(aX[i-aNbLines+1], aY[i-aNbLines+1]) + aLineStart.setValue(aX[i - aNbLines - 1], aY[i - aNbLines - 1]) + aLineEnd.setValue(aX[i - aNbLines + 1], aY[i - aNbLines + 1]) aLine.data().boolean("Auxiliary").setValue(True) # update the rectangle - for i in range (0, aLinesList.size()): + for i in range(0, aLinesList.size()): aLinesList.object(i).data().blockSendAttributeUpdated(wasBlocked[i], True) def updateStartPoint(self): @@ -316,12 +372,14 @@ class SketchPlugin_Rectangle(model.Feature): aX = aStartPoint.x() aY = aStartPoint.y() else: - aCenter = self.getPointByRef(self.attribute(self.CENTER_ID()), self.refattr(self.CENTER_REF_ID())) + aCenter = self.getPointByRef( + self.attribute(self.CENTER_ID()), self.refattr(self.CENTER_REF_ID()) + ) aX = aCenter.x() aY = aCenter.y() # Update coordinates of rectangle lines - for i in range (0, aNbLines): + for i in range(0, aNbLines): aLine = ModelAPI.objectToFeature(aLinesList.object(i)) aLineStart = GeomDataAPI.geomDataAPI_Point2D(aLine.attribute("EndPoint")) aLineStart.setValue(aX, aY) diff --git a/src/SketchAPI/Test/TestFreePoints.py b/src/SketchAPI/Test/TestFreePoints.py index afdcf3451..845bcf91e 100644 --- a/src/SketchAPI/Test/TestFreePoints.py +++ b/src/SketchAPI/Test/TestFreePoints.py @@ -26,27 +26,41 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(46.22261352148133, 0, 23.58244120674807) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_1.center() +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_2.addPoint(-17.08115772475531, -35.96860682980034) -SketchLine_2 = Sketch_2.addLine(-21.65537897222015, 0.8259975132940123, 39.97043562830241, -43.0039721165161) +SketchLine_2 = Sketch_2.addLine( + -21.65537897222015, 0.8259975132940123, 39.97043562830241, -43.0039721165161 +) SketchPoint_2 = Sketch_2.addPoint(15.99061885657872, -44.35579681082369) -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchPoint_2.coordinates(), SketchLine_2.result(), 15, True) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), True) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchPoint_2.coordinates(), SketchLine_2.result(), 15, True +) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), True +) SketchPoint_3 = SketchProjection_2.createdFeature() -SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "Sketch_1/SketchCircle_1_2"), False) +SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint( + model.selection("EDGE", "Sketch_1/SketchCircle_1_2"), False +) [SketchPoint_4, SketchPoint_5] = SketchIntersectionPoint_1.intersectionPoints() -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_2.result(), 25, True) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_2.result(), 25, True +) model.do() FreePoints1 = Sketch_1.getFreePoints() -assert(len(FreePoints1) == 0) +assert len(FreePoints1) == 0 FreePoints2 = Sketch_2.getFreePoints() -assert(len(FreePoints2) == 3) +assert len(FreePoints2) == 3 model.end() diff --git a/src/SketchAPI/Test/TestSketch.py b/src/SketchAPI/Test/TestSketch.py index 3425165c5..fb2df20b1 100644 --- a/src/SketchAPI/Test/TestSketch.py +++ b/src/SketchAPI/Test/TestSketch.py @@ -26,20 +26,33 @@ import SketchAPI from salome.shaper import geom from salome.shaper import model -class SketchTestCase(unittest.TestCase): +class SketchTestCase(unittest.TestCase): def setUp(self): model.begin() self.session = ModelAPI.ModelAPI_Session.get() aPartSet = self.session.moduleDocument() self.doc = model.addPart(aPartSet).document() - model.addCylinder(self.doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) - model.addCylinder(self.doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 10, 90) + model.addCylinder( + self.doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, + ) + model.addCylinder( + self.doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10, + 10, + 90, + ) self.sketch = model.addSketch(self.doc, model.defaultPlane("XOY")) def tearDown(self): model.end() - assert(model.checkPythonDump()) + assert model.checkPythonDump() self.session.closeAll() def checkPoint(self, thePoint, theReference): @@ -47,70 +60,82 @@ class SketchTestCase(unittest.TestCase): self.assertAlmostEqual(thePoint.y(), theReference.y(), 6) def test_circle_by_point(self): - """ Test 1. Create point by GeomAPI_Pnt and circle coincident by the center - """ - point = geom.Pnt2d(10., 10.) + """Test 1. Create point by GeomAPI_Pnt and circle coincident by the center""" + point = geom.Pnt2d(10.0, 10.0) aPoint = self.sketch.addPoint(point) - aCircle = self.sketch.addCircle(point, 10.) + aCircle = self.sketch.addCircle(point, 10.0) aCoincidence = self.sketch.setCoincident(aPoint.coordinates(), aCircle.center()) model.do() self.checkPoint(aPoint.coordinates(), point) self.checkPoint(aCircle.center(), point) def test_circle_by_external(self): - """ Test 2. Create point and circle by external features - """ + """Test 2. Create point and circle by external features""" aPoint = self.sketch.addPoint("PartSet/Origin") aCircle = self.sketch.addCircle("[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]") model.do() - point = geom.Pnt2d(0., 0.) + point = geom.Pnt2d(0.0, 0.0) self.checkPoint(aPoint.coordinates(), point) self.checkPoint(aCircle.center(), point) def test_circle_center_passed(self): - """ Test 3. Create circle by center and passed point - """ - aCenter = geom.Pnt2d(10., 10.) - aPassed = geom.Pnt2d(20., 30.) + """Test 3. Create circle by center and passed point""" + aCenter = geom.Pnt2d(10.0, 10.0) + aPassed = geom.Pnt2d(20.0, 30.0) self.sketch.addCircle(aCenter.x(), aCenter.y(), aPassed.x(), aPassed.y()) model.do() - aCircle1 = SketchAPI.SketchAPI_Circle(model.lastSubFeature(self.sketch, "SketchCircle")) + aCircle1 = SketchAPI.SketchAPI_Circle( + model.lastSubFeature(self.sketch, "SketchCircle") + ) self.sketch.addCircle(aCenter, aPassed) model.do() - aCircle2 = SketchAPI.SketchAPI_Circle(model.lastSubFeature(self.sketch, "SketchCircle")) + aCircle2 = SketchAPI.SketchAPI_Circle( + model.lastSubFeature(self.sketch, "SketchCircle") + ) - aRadius = math.sqrt((aCenter.x()-aPassed.x())**2 + (aCenter.y()-aPassed.y())**2) + aRadius = math.sqrt( + (aCenter.x() - aPassed.x()) ** 2 + (aCenter.y() - aPassed.y()) ** 2 + ) self.checkPoint(aCircle1.center(), aCenter) self.assertAlmostEqual(aCircle1.radius().value(), aRadius, 6) self.checkPoint(aCircle2.center(), aCenter) self.assertAlmostEqual(aCircle2.radius().value(), aRadius, 6) def test_circle_by_three_points(self): - """ Test 4. Create circle by three passed points - """ - aCenter = geom.Pnt2d(10., 10.) - aRadius = 5. - - self.sketch.addCircle(aCenter.x() - aRadius, aCenter.y(), aCenter.x() + aRadius, aCenter.y(), aCenter.x(), aCenter.y() + aRadius) + """Test 4. Create circle by three passed points""" + aCenter = geom.Pnt2d(10.0, 10.0) + aRadius = 5.0 + + self.sketch.addCircle( + aCenter.x() - aRadius, + aCenter.y(), + aCenter.x() + aRadius, + aCenter.y(), + aCenter.x(), + aCenter.y() + aRadius, + ) model.do() - aCircle = SketchAPI.SketchAPI_Circle(model.lastSubFeature(self.sketch, "SketchCircle")) + aCircle = SketchAPI.SketchAPI_Circle( + model.lastSubFeature(self.sketch, "SketchCircle") + ) self.checkPoint(aCircle.center(), aCenter) self.assertAlmostEqual(aCircle.radius().value(), aRadius, 6) def test_arc_by_three_points(self): - """ Test 5. Create arc by three passed points - """ - aCenter = geom.Pnt2d(10., 10.) - aRadius = 5. + """Test 5. Create arc by three passed points""" + aCenter = geom.Pnt2d(10.0, 10.0) + aRadius = 5.0 aPoint1 = geom.Pnt2d(aCenter.x() - aRadius, aCenter.y()) aPoint2 = geom.Pnt2d(aCenter.x() + aRadius, aCenter.y()) aPoint3 = geom.Pnt2d(aCenter.x(), aCenter.y() + aRadius) - self.sketch.addArc(aPoint1.x(), aPoint1.y(), aPoint2.x(), aPoint2.y(), aPoint3.x(), aPoint3.y()) + self.sketch.addArc( + aPoint1.x(), aPoint1.y(), aPoint2.x(), aPoint2.y(), aPoint3.x(), aPoint3.y() + ) model.do() anArc1 = SketchAPI.SketchAPI_Arc(model.lastSubFeature(self.sketch, "SketchArc")) @@ -125,15 +150,14 @@ class SketchTestCase(unittest.TestCase): self.assertAlmostEqual(anArc2.radius().value(), aRadius, 6) def test_arc_by_tangent_point(self): - """ Test 6. Create arc tangent to a line - """ - aTgPnt = geom.Pnt2d(10., 0.) - aRadius = 5. + """Test 6. Create arc tangent to a line""" + aTgPnt = geom.Pnt2d(10.0, 0.0) + aRadius = 5.0 - aLine = self.sketch.addLine(0., 0., aTgPnt.x(), aTgPnt.y()) + aLine = self.sketch.addLine(0.0, 0.0, aTgPnt.x(), aTgPnt.y()) model.do() - aPassed = geom.Pnt2d(aTgPnt.x(), aTgPnt.y() + 2. * aRadius) + aPassed = geom.Pnt2d(aTgPnt.x(), aTgPnt.y() + 2.0 * aRadius) self.sketch.addArc(aLine.endPoint(), aPassed, False) model.do() anArc = SketchAPI.SketchAPI_Arc(model.lastSubFeature(self.sketch, "SketchArc")) @@ -143,41 +167,43 @@ class SketchTestCase(unittest.TestCase): self.assertAlmostEqual(anArc.radius().value(), aRadius, 6) def test_arc_by_external(self): - """ Test 7. Create arc by external feature - """ - anArc = self.sketch.addArc(model.selection("EDGE", "[Cylinder_2_1/Face_1][Cylinder_2_1/Face_3]")) + """Test 7. Create arc by external feature""" + anArc = self.sketch.addArc( + model.selection("EDGE", "[Cylinder_2_1/Face_1][Cylinder_2_1/Face_3]") + ) model.do() - point = geom.Pnt2d(0., 0.) + point = geom.Pnt2d(0.0, 0.0) self.checkPoint(anArc.center(), point) self.assertAlmostEqual(anArc.radius().value(), 10, 6) def test_arc_by_name(self): - """ Test 8. Create arc by external feature - """ + """Test 8. Create arc by external feature""" anArc = self.sketch.addArc("[Cylinder_2_1/Face_1][Cylinder_2_1/Face_3]") model.do() - point = geom.Pnt2d(0., 0.) + point = geom.Pnt2d(0.0, 0.0) self.checkPoint(anArc.center(), point) self.assertAlmostEqual(anArc.radius().value(), 10, 6) def test_point_by_intersection(self): - """ Test 9. Create point as intersection with external edge given by a name - """ + """Test 9. Create point as intersection with external edge given by a name""" self.sketch.addIntersectionPoint("[Cylinder_2_1/Face_1][Cylinder_2_1/Face_4]") model.do() - aPoint = SketchAPI.SketchAPI_Point(model.lastSubFeature(self.sketch, "SketchPoint")) + aPoint = SketchAPI.SketchAPI_Point( + model.lastSubFeature(self.sketch, "SketchPoint") + ) - point = geom.Pnt2d(10., 0.) + point = geom.Pnt2d(10.0, 0.0) self.checkPoint(aPoint.coordinates(), point) def test_arc_by_projection(self): - """ Test 10. Create arc by projection of external feature - """ - self.sketch.addProjection(model.selection("EDGE", "[Cylinder_2_1/Face_1][Cylinder_2_1/Face_3]")) + """Test 10. Create arc by projection of external feature""" + self.sketch.addProjection( + model.selection("EDGE", "[Cylinder_2_1/Face_1][Cylinder_2_1/Face_3]") + ) model.do() anArc = SketchAPI.SketchAPI_Arc(model.lastSubFeature(self.sketch, "SketchArc")) - point = geom.Pnt2d(0., 0.) + point = geom.Pnt2d(0.0, 0.0) self.checkPoint(anArc.center(), point) self.assertAlmostEqual(anArc.radius().value(), 10, 6) diff --git a/src/SketchPlugin/Test/Test1061.py b/src/SketchPlugin/Test/Test1061.py index a81940c6c..d5acd5b76 100644 --- a/src/SketchPlugin/Test/Test1061.py +++ b/src/SketchPlugin/Test/Test1061.py @@ -34,12 +34,16 @@ SketchLine_1 = Sketch_1.addLine(70, 120, 50, 25) SketchLine_2 = Sketch_1.addLine(50, 25, 170, 50) DISTANCE = 100 -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.endPoint(), SketchLine_2.startPoint(), DISTANCE) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_1.endPoint(), SketchLine_2.startPoint(), DISTANCE +) model.do() # check distance between points -aDist2 = (SketchLine_1.endPoint().x() - SketchLine_2.startPoint().x())**2 + (SketchLine_1.endPoint().y() - SketchLine_2.startPoint().y())**2 -assert(aDist2 < 1e-12) -assert(Sketch_1.solverError() != "") +aDist2 = (SketchLine_1.endPoint().x() - SketchLine_2.startPoint().x()) ** 2 + ( + SketchLine_1.endPoint().y() - SketchLine_2.startPoint().y() +) ** 2 +assert aDist2 < 1e-12 +assert Sketch_1.solverError() != "" model.end() diff --git a/src/SketchPlugin/Test/Test1577.py b/src/SketchPlugin/Test/Test1577.py index d8ca74b5c..2f678778d 100644 --- a/src/SketchPlugin/Test/Test1577.py +++ b/src/SketchPlugin/Test/Test1577.py @@ -54,68 +54,137 @@ SketchConstraintRigid_1 = Sketch_1.setFixed(SketchPoint_1.coordinates()) SketchLine_1 = Sketch_1.addLine(6.277, 12.18846022232796, 6.277, -8.121250994790044) SketchLine_1.setAuxiliary(True) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_1.result(), "Wall_R+Wall_T1", False) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchPoint_1.coordinates(), SketchLine_1.result(), "Wall_R+Wall_T1", False +) SketchLine_2 = Sketch_1.addLine(6.538, -3.45, 7.777, -3.45) SketchLine_3 = Sketch_1.addLine(7.777, -3.45, 7.777, -6.45) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(7.777, -6.45, 0, -6.45) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(0, -6.45, 0, -3.45) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(0, -3.45, 6.188, -3.45) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_4.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_6.result(), "Base_Off", False) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_2.result(), "Base_Off", False) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_2.endPoint(), SketchLine_4.result(), "Base_H", False) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_4.startPoint(), SketchLine_1.result(), "Base_B", False) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_5.startPoint(), SketchLine_1.result(), "Wall_R+Wall_T1", False) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_1.result(), "Wall_T1", False) -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_1.result(), SketchLine_2.startPoint(), "Wall_T2", False) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchPoint_1.coordinates(), SketchLine_6.result(), "Base_Off", False +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchPoint_1.coordinates(), SketchLine_2.result(), "Base_Off", False +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_2.endPoint(), SketchLine_4.result(), "Base_H", False +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_4.startPoint(), SketchLine_1.result(), "Base_B", False +) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_5.startPoint(), SketchLine_1.result(), "Wall_R+Wall_T1", False +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchLine_6.endPoint(), SketchLine_1.result(), "Wall_T1", False +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchLine_1.result(), SketchLine_2.startPoint(), "Wall_T2", False +) SketchLine_7 = Sketch_1.addLine(5.677, -4.05, 6.877, -4.05) SketchLine_8 = Sketch_1.addLine(6.877, -4.05, 7.027, -4.25) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(7.027, -4.25, 7.027, -5.85) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchLine_10 = Sketch_1.addLine(7.027, -5.85, 5.527, -5.85) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchLine_11 = Sketch_1.addLine(5.527, -5.85, 5.527, -4.25) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchLine_12 = Sketch_1.addLine(5.527, -4.25, 5.677, -4.05) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchLine_12.endPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchLine_12.endPoint() +) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_11.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_10.result()) -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_10.endPoint(), SketchLine_1.result(), "StrGal_B", False) -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchLine_10.startPoint(), SketchLine_1.result(), "StrGal_B", False) -SketchConstraintDistance_11 = Sketch_1.setDistance(SketchLine_12.endPoint(), SketchLine_1.result(), "StrGal_BU", False) -SketchConstraintDistance_12 = Sketch_1.setDistance(SketchLine_7.endPoint(), SketchLine_1.result(), "StrGal_BU", False) -SketchConstraintDistance_13 = Sketch_1.setDistance(SketchLine_7.endPoint(), SketchLine_10.result(), "StrGal_H", False) -SketchConstraintDistance_14 = Sketch_1.setDistance(SketchLine_7.endPoint(), SketchLine_2.result(), 0.6, True) -SketchConstraintDistance_15 = Sketch_1.setDistance(SketchLine_9.startPoint(), SketchLine_7.result(), "StrGal_Inc", False) -SketchConstraintDistance_16 = Sketch_1.setDistance(SketchLine_11.endPoint(), SketchLine_7.result(), "StrGal_Inc", False) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_10.endPoint(), SketchLine_1.result(), "StrGal_B", False +) +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchLine_10.startPoint(), SketchLine_1.result(), "StrGal_B", False +) +SketchConstraintDistance_11 = Sketch_1.setDistance( + SketchLine_12.endPoint(), SketchLine_1.result(), "StrGal_BU", False +) +SketchConstraintDistance_12 = Sketch_1.setDistance( + SketchLine_7.endPoint(), SketchLine_1.result(), "StrGal_BU", False +) +SketchConstraintDistance_13 = Sketch_1.setDistance( + SketchLine_7.endPoint(), SketchLine_10.result(), "StrGal_H", False +) +SketchConstraintDistance_14 = Sketch_1.setDistance( + SketchLine_7.endPoint(), SketchLine_2.result(), 0.6, True +) +SketchConstraintDistance_15 = Sketch_1.setDistance( + SketchLine_9.startPoint(), SketchLine_7.result(), "StrGal_Inc", False +) +SketchConstraintDistance_16 = Sketch_1.setDistance( + SketchLine_11.endPoint(), SketchLine_7.result(), "StrGal_Inc", False +) SketchLine_13 = Sketch_1.addLine(6.188, -3.45, 6.188, 0.287301537219) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_13.startPoint() +) SketchLine_14 = Sketch_1.addLine(6.538, -3.45, 6.538, -1.380737101082) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_14.startPoint() +) SketchLine_15 = Sketch_1.addLine(6.538, -1.380737101082, 6.366, -1.102730661365) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) SketchLine_16 = Sketch_1.addLine(6.366, -1.102730661365, 6.366, 0.21779992729) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_13.result()) SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_14.result()) SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_16.result()) -SketchConstraintDistance_17 = Sketch_1.setDistance(SketchLine_16.endPoint(), SketchLine_1.result(), "Wall_T1", False) +SketchConstraintDistance_17 = Sketch_1.setDistance( + SketchLine_16.endPoint(), SketchLine_1.result(), "Wall_T1", False +) model.do() # store coordinates of the gallery -Lines = [SketchLine_7, SketchLine_8, SketchLine_9, SketchLine_10, SketchLine_11, SketchLine_12] +Lines = [ + SketchLine_7, + SketchLine_8, + SketchLine_9, + SketchLine_10, + SketchLine_11, + SketchLine_12, +] RefCoorindates = [] for line in Lines: RefCoorindates.append(line.startPoint().x()) @@ -123,17 +192,19 @@ for line in Lines: RefCoorindates.append(line.endPoint().x()) RefCoorindates.append(line.endPoint().y()) -SketchConstraintDistance_18 = Sketch_1.setDistance(SketchLine_14.endPoint(), SketchLine_2.result(), "Wall_H", True) +SketchConstraintDistance_18 = Sketch_1.setDistance( + SketchLine_14.endPoint(), SketchLine_2.result(), "Wall_H", True +) model.do() # check coordinates of lines are not changed TOLERANCE = 1e-6 index = 0 for line in Lines: - assert(math.fabs(line.startPoint().x() - RefCoorindates[index]) < TOLERANCE) - assert(math.fabs(line.startPoint().y() - RefCoorindates[index + 1]) < TOLERANCE) - assert(math.fabs(line.endPoint().x() - RefCoorindates[index + 2]) < TOLERANCE) - assert(math.fabs(line.endPoint().y() - RefCoorindates[index + 3]) < TOLERANCE) + assert math.fabs(line.startPoint().x() - RefCoorindates[index]) < TOLERANCE + assert math.fabs(line.startPoint().y() - RefCoorindates[index + 1]) < TOLERANCE + assert math.fabs(line.endPoint().x() - RefCoorindates[index + 2]) < TOLERANCE + assert math.fabs(line.endPoint().y() - RefCoorindates[index + 3]) < TOLERANCE index += 4 model.end() diff --git a/src/SketchPlugin/Test/Test1578.py b/src/SketchPlugin/Test/Test1578.py index 9e5b6f8d3..626796758 100644 --- a/src/SketchPlugin/Test/Test1578.py +++ b/src/SketchPlugin/Test/Test1578.py @@ -50,106 +50,316 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 115.7437109013936, 7.586243611563176) SketchLine_1.setAuxiliary(True) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_2.result(), SketchLine_1.result(), "angle/2") +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_2.result(), SketchLine_1.result(), "angle/2" +) SketchLine_3 = Sketch_1.addLine(0, 0, 101.5823409704896, 13.37356889953941) SketchLine_3.setAuxiliary(True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchPoint_1.result()) -SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_2.result(), SketchLine_3.result(), "angle") +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchPoint_1.result() +) +SketchConstraintAngle_2 = Sketch_1.setAngle( + SketchLine_2.result(), SketchLine_3.result(), "angle" +) SketchArc_1 = Sketch_1.addArc(0, 0, 75, 0, 74.35836460303578, 9.789464416503867, False) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.center(), SketchPoint_1.result()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchPoint_1.result() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_3.result() +) SketchArc_2 = Sketch_1.addArc(0, 0, 120, 0, 118.9733833648573, 15.66314306640619, False) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_2.center(), SketchPoint_1.result()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchPoint_1.result() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_3.result() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "R_stator_int") SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], "R_stator_ext") -SketchLine_4 = Sketch_1.addLine(74.35836460303578, 9.789464416503867, 118.9733833648573, 15.66314306640619) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_4.endPoint()) +SketchLine_4 = Sketch_1.addLine( + 74.35836460303578, 9.789464416503867, 118.9733833648573, 15.66314306640619 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_4.endPoint() +) SketchLine_5 = Sketch_1.addLine(75, 0, 120, 0) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_5.endPoint()) -SketchArc_3 = Sketch_1.addArc(0, 0, 76.22453904297332, 3.392587167080116, 76.01524902943686, 6.585735721443648, False) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_3.center(), SketchPoint_1.result()) -SketchArc_4 = Sketch_1.addArc(0, 0, 78.14887552638105, 2.827234330967321, 77.84932919450701, 7.397428199400126, False) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_4.center(), SketchPoint_1.result()) -SketchArc_5 = Sketch_1.addArc(0, 0, 93.65305549448868, 2.630835712510912, 93.19523358987767, 9.615848175181137, False) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_5.center(), SketchPoint_1.result()) -SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_3.results()[1], "R_stator_int+h") -SketchConstraintRadius_4 = Sketch_1.setRadius(SketchArc_4.results()[1], "R_stator_int+h+h1") -SketchConstraintRadius_5 = Sketch_1.setRadius(SketchArc_5.results()[1], "R_stator_int+h+h1+h2") -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_5.endPoint(), SketchLine_1.result(), "Length_3") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchArc_5.startPoint(), SketchLine_1.result(), "Length_3") -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchArc_4.endPoint(), SketchLine_1.result(), "Length_2") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchArc_4.startPoint(), SketchLine_1.result(), "Length_2") -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchArc_3.endPoint(), SketchLine_1.result(), "Length_1") -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchArc_3.startPoint(), SketchLine_1.result(), "Length_1") -SketchLine_6 = Sketch_1.addLine(77.84932919450701, 7.397428199400126, 93.19523358987767, 9.615848175181137) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_6.endPoint()) -SketchLine_7 = Sketch_1.addLine(78.14887552638105, 2.827234330967321, 93.65305549448868, 2.630835712510912) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchArc_5.startPoint(), SketchLine_7.endPoint()) -SketchLine_8 = Sketch_1.addLine(76.01524902943686, 6.585735721443648, 74.71774217241287, 6.500692629007779) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchArc_1.results()[1]) -SketchLine_9 = Sketch_1.addLine(76.22453904297332, 3.392587167080116, 74.92703218594932, 3.307544074644247) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchArc_1.results()[1]) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_8.result(), SketchLine_1.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_9.result(), SketchLine_1.result()) -SketchArc_6 = Sketch_1.addArc(92.99435209423221, 6.095171858515482, 93.19523358987767, 9.615848175181137, 93.65305549448868, 2.630835712510912, True) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchArc_6.startPoint()) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchArc_6.startPoint()) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_5.startPoint(), SketchArc_6.endPoint()) -SketchArc_7 = Sketch_1.addArc(78.08372875230802, 4.389817544749706, 76.015249029437, 6.585735721444, 77.84932919450701, 7.397428199400126, True) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchArc_7.startPoint()) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchArc_7.startPoint()) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchArc_7.endPoint()) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchArc_7.endPoint()) -SketchArc_8 = Sketch_1.addArc(77.98869779703921, 5.839709741271425, 76.22453904297301, 3.39258716708, 78.14887552638105, 2.827234330967321, False) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchArc_8.startPoint()) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchArc_8.startPoint()) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchArc_8.endPoint()) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchArc_8.endPoint()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_7.results()[1], SketchArc_8.results()[1]) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_5.endPoint() +) +SketchArc_3 = Sketch_1.addArc( + 0, + 0, + 76.22453904297332, + 3.392587167080116, + 76.01524902943686, + 6.585735721443648, + False, +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchPoint_1.result() +) +SketchArc_4 = Sketch_1.addArc( + 0, + 0, + 78.14887552638105, + 2.827234330967321, + 77.84932919450701, + 7.397428199400126, + False, +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_4.center(), SketchPoint_1.result() +) +SketchArc_5 = Sketch_1.addArc( + 0, + 0, + 93.65305549448868, + 2.630835712510912, + 93.19523358987767, + 9.615848175181137, + False, +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_5.center(), SketchPoint_1.result() +) +SketchConstraintRadius_3 = Sketch_1.setRadius( + SketchArc_3.results()[1], "R_stator_int+h" +) +SketchConstraintRadius_4 = Sketch_1.setRadius( + SketchArc_4.results()[1], "R_stator_int+h+h1" +) +SketchConstraintRadius_5 = Sketch_1.setRadius( + SketchArc_5.results()[1], "R_stator_int+h+h1+h2" +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_5.endPoint(), SketchLine_1.result(), "Length_3" +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchArc_5.startPoint(), SketchLine_1.result(), "Length_3" +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchArc_4.endPoint(), SketchLine_1.result(), "Length_2" +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchArc_4.startPoint(), SketchLine_1.result(), "Length_2" +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchArc_3.endPoint(), SketchLine_1.result(), "Length_1" +) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchArc_3.startPoint(), SketchLine_1.result(), "Length_1" +) +SketchLine_6 = Sketch_1.addLine( + 77.84932919450701, 7.397428199400126, 93.19523358987767, 9.615848175181137 +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchLine_6.endPoint() +) +SketchLine_7 = Sketch_1.addLine( + 78.14887552638105, 2.827234330967321, 93.65305549448868, 2.630835712510912 +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchArc_4.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchArc_5.startPoint(), SketchLine_7.endPoint() +) +SketchLine_8 = Sketch_1.addLine( + 76.01524902943686, 6.585735721443648, 74.71774217241287, 6.500692629007779 +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchArc_1.results()[1] +) +SketchLine_9 = Sketch_1.addLine( + 76.22453904297332, 3.392587167080116, 74.92703218594932, 3.307544074644247 +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchArc_1.results()[1] +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_8.result(), SketchLine_1.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_9.result(), SketchLine_1.result() +) +SketchArc_6 = Sketch_1.addArc( + 92.99435209423221, + 6.095171858515482, + 93.19523358987767, + 9.615848175181137, + 93.65305549448868, + 2.630835712510912, + True, +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchArc_6.startPoint() +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchArc_6.startPoint() +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchArc_5.startPoint(), SketchArc_6.endPoint() +) +SketchArc_7 = Sketch_1.addArc( + 78.08372875230802, + 4.389817544749706, + 76.015249029437, + 6.585735721444, + 77.84932919450701, + 7.397428199400126, + True, +) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchArc_7.startPoint() +) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchLine_8.startPoint(), SketchArc_7.startPoint() +) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchArc_7.endPoint() +) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchArc_7.endPoint() +) +SketchArc_8 = Sketch_1.addArc( + 77.98869779703921, + 5.839709741271425, + 76.22453904297301, + 3.39258716708, + 78.14887552638105, + 2.827234330967321, + False, +) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchArc_8.startPoint() +) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchLine_9.startPoint(), SketchArc_8.startPoint() +) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchArc_4.startPoint(), SketchArc_8.endPoint() +) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchArc_8.endPoint() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchArc_7.results()[1], SketchArc_8.results()[1] +) SketchArc_9 = Sketch_1.addArc(0, 0, 78.14887552638101, 2.827234330967, 78.2, 0, True) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_9.center(), SketchPoint_1.result()) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchArc_9.startPoint()) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchArc_9.startPoint()) -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchArc_9.startPoint()) -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchArc_9.endPoint(), SketchLine_5.result()) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchArc_9.center(), SketchPoint_1.result() +) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchArc_4.startPoint(), SketchArc_9.startPoint() +) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchArc_9.startPoint() +) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchArc_8.endPoint(), SketchArc_9.startPoint() +) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchArc_9.endPoint(), SketchLine_5.result() +) model.do() model.checkSketch(Sketch_1) # Check sketch is valid after adding the arc -SketchArc_10 = Sketch_1.addArc(0, 0, 77.84932919450699, 7.397428199400125, 77.5309881595101, 10.20714823162807, False) -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_10.center()) -SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchArc_10.startPoint()) -SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchLine_4.result(), SketchArc_10.endPoint()) +SketchArc_10 = Sketch_1.addArc( + 0, + 0, + 77.84932919450699, + 7.397428199400125, + 77.5309881595101, + 10.20714823162807, + False, +) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_10.center() +) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchArc_10.startPoint() +) +SketchConstraintCoincidence_42 = Sketch_1.setCoincident( + SketchLine_4.result(), SketchArc_10.endPoint() +) model.do() model.checkSketch(Sketch_1) # Check sketch is valid after multi-rotation -SketchMultiRotation_1_objects = [SketchArc_1.results()[1], SketchLine_9.result(), SketchLine_8.result(), SketchArc_3.results()[1], SketchArc_8.results()[1], SketchArc_7.results()[1], SketchArc_9.results()[1], SketchArc_4.results()[1], SketchArc_10.results()[1], SketchLine_4.result(), SketchLine_7.result(), SketchLine_6.result(), SketchArc_5.results()[1], SketchArc_6.results()[1], SketchArc_2.results()[1]] -SketchMultiRotation_1 = Sketch_1.addRotation(SketchMultiRotation_1_objects, SketchLine_2.startPoint(), "angle", 12) +SketchMultiRotation_1_objects = [ + SketchArc_1.results()[1], + SketchLine_9.result(), + SketchLine_8.result(), + SketchArc_3.results()[1], + SketchArc_8.results()[1], + SketchArc_7.results()[1], + SketchArc_9.results()[1], + SketchArc_4.results()[1], + SketchArc_10.results()[1], + SketchLine_4.result(), + SketchLine_7.result(), + SketchLine_6.result(), + SketchArc_5.results()[1], + SketchArc_6.results()[1], + SketchArc_2.results()[1], +] +SketchMultiRotation_1 = Sketch_1.addRotation( + SketchMultiRotation_1_objects, SketchLine_2.startPoint(), "angle", 12 +) model.do() model.checkSketch(Sketch_1) # Move arc's extremity and check sketch -SketchArc_121 = Sketch_1.addArc(0, 0, 36.41124276672319, 6.344317038870018, 8.424960444516818, 35.98678924293296, False) -SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_121.center()) +SketchArc_121 = Sketch_1.addArc( + 0, + 0, + 36.41124276672319, + 6.344317038870018, + 8.424960444516818, + 35.98678924293296, + False, +) +SketchConstraintCoincidence_43 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_121.center() +) model.do() for i in range(0, 10): - Sketch_1.move(SketchArc_121.startPoint(), SketchArc_121.startPoint().x() + 1., SketchArc_121.startPoint().y()) + Sketch_1.move( + SketchArc_121.startPoint(), + SketchArc_121.startPoint().x() + 1.0, + SketchArc_121.startPoint().y(), + ) model.do() model.checkSketch(Sketch_1) diff --git a/src/SketchPlugin/Test/Test1673.py b/src/SketchPlugin/Test/Test1673.py index 86d955ad0..e0c4a8114 100644 --- a/src/SketchPlugin/Test/Test1673.py +++ b/src/SketchPlugin/Test/Test1673.py @@ -30,7 +30,7 @@ import math MOVE_BUILD_RATIO = 0.1 NUM_MOVES = 50 # tolerance for comparison of reals -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 model.begin() partSet = model.moduleDocument() @@ -52,27 +52,37 @@ SketchLine_1.result().setName("SketchLine_2") SketchLine_2 = Sketch_1.addLine(-7.782, -3.45, -7.782, -6.45) SketchLine_2.setName("SketchLine_3") SketchLine_2.result().setName("SketchLine_3") -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_2") SketchLine_3 = Sketch_1.addLine(-7.782, -6.45, 0, -6.45) SketchLine_3.setName("SketchLine_4") SketchLine_3.result().setName("SketchLine_4") -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3") SketchLine_4 = Sketch_1.addLine(0, -6.45, 0, -3.45) SketchLine_4.setName("SketchLine_5") SketchLine_4.result().setName("SketchLine_5") -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_4") SketchLine_5 = Sketch_1.addLine(0, -3.45, -6.188, -3.45) SketchLine_5.setName("SketchLine_6") SketchLine_5.result().setName("SketchLine_6") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5") SketchLine_6 = Sketch_1.addLine(-6.188, -3.45, -6.188, 9.025) SketchLine_6.setName("SketchLine_7") SketchLine_6.result().setName("SketchLine_7") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_6") SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_1.result()) @@ -88,26 +98,42 @@ SketchLine_7.result().setName("SketchLine_8") SketchLine_8 = Sketch_1.addLine(-6.376, -2.25, -6.538, -2.4) SketchLine_8.setName("SketchLine_9") SketchLine_8.result().setName("SketchLine_9") -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7") SketchLine_9 = Sketch_1.addLine(-6.538, -2.4, -6.538, -3.45) SketchLine_9.setName("SketchLine_10") SketchLine_9.result().setName("SketchLine_10") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_9.endPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_9.endPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_9") SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintVertical_4.setName("SketchConstraintVertical_5") SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintVertical_5.setName("SketchConstraintVertical_6") -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_2.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_4.result(), SketchLine_2.result() +) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_5.result(), 3.45) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_6.result(), 6.188) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_9.result(), 0.35) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchPoint_1.coordinates(), SketchLine_5.result(), 3.45 +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchPoint_1.coordinates(), SketchLine_6.result(), 6.188 +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchLine_9.result(), 0.35 +) SketchConstraintDistance_3.setName("SketchConstraintDistance_4") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_7.result(), "ep_jupe") +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchLine_7.result(), "ep_jupe" +) SketchConstraintDistance_4.setName("SketchConstraintDistance_5") SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), 3) SketchLine_10 = Sketch_1.addLine(-6.282, 0.5300728101808314, -6.282, -4.926040141145169) @@ -116,7 +142,9 @@ SketchLine_10.result().setName("SketchLine_11") SketchLine_10.setAuxiliary(True) SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_10.result()) SketchConstraintVertical_6.setName("SketchConstraintVertical_7") -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_10.result(), "ep_jupe/2") +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchLine_10.result(), "ep_jupe/2" +) SketchConstraintDistance_5.setName("SketchConstraintDistance_6") SketchLine_11 = Sketch_1.addLine(-5.532, -4.05, -7.032, -4.05) SketchLine_11.setName("SketchLine_12") @@ -130,13 +158,21 @@ SketchLine_13.result().setName("SketchLine_14") SketchLine_14 = Sketch_1.addLine(-5.532, -5.85, -5.532, -4.05) SketchLine_14.setName("SketchLine_15") SketchLine_14.result().setName("SketchLine_15") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchLine_11.startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_12") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_13") SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_12.result()) @@ -146,50 +182,82 @@ SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_14.result()) SketchConstraintVertical_8.setName("SketchConstraintVertical_9") SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_13.result(), "width_gallery") SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_14.result(), 1.8) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_11.startPoint(), SketchLine_10.result(), "width_gallery/2") +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_11.startPoint(), SketchLine_10.result(), "width_gallery/2" +) SketchConstraintDistance_6.setName("SketchConstraintDistance_7") -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_12.startPoint(), SketchLine_1.result(), 0.6) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchLine_12.startPoint(), SketchLine_1.result(), 0.6 +) SketchConstraintDistance_7.setName("SketchConstraintDistance_8") -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_10.result(), "width_gallery") +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchLine_2.startPoint(), SketchLine_10.result(), "width_gallery" +) SketchConstraintDistance_8.setName("SketchConstraintDistance_9") SketchLine_15 = Sketch_1.addLine(model.selection("VERTEX", "PartSet/OZ")) SketchLine_15.setName("Axis_Z") SketchLine_15.result().setName("Axis_Z") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_15.result()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_15.result() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_14") SketchLine_16 = Sketch_1.addLine(model.selection("VERTEX", "PartSet/OX")) SketchLine_16.setName("Axis_X") SketchLine_16.result().setName("Axis_X") -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_8.startPoint(), SketchLine_16.result(), 2.25) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_8.startPoint(), SketchLine_16.result(), 2.25 +) SketchConstraintDistance_9.setName("SketchConstraintDistance_10") SketchLine_17 = Sketch_1.addLine(-6.376, -2.25, -7.479754760955, -2.25) SketchLine_17.setAuxiliary(True) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_15") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_8.startPoint(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_16") SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_17.result()) -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchLine_9.startPoint(), SketchLine_17.result(), 0.15) +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchLine_9.startPoint(), SketchLine_17.result(), 0.15 +) SketchConstraintDistance_10.setName("SketchConstraintDistance_11") -SketchConstraintDistance_11 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_16.result(), "h_bas_dome") +SketchConstraintDistance_11 = Sketch_1.setDistance( + SketchLine_6.endPoint(), SketchLine_16.result(), "h_bas_dome" +) SketchConstraintDistance_11.setName("SketchConstraintDistance_12") -SketchConstraintDistance_12 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_16.result(), "h_bas_dome") +SketchConstraintDistance_12 = Sketch_1.setDistance( + SketchLine_7.startPoint(), SketchLine_16.result(), "h_bas_dome" +) SketchConstraintDistance_12.setName("SketchConstraintDistance_13") SketchLine_18 = Sketch_1.addLine(-6.188, 9.025, -6.082, 9.532) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_18.startPoint() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_17") SketchLine_19 = Sketch_1.addLine(-6.376, 9.025, -6.538, 9.187) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchLine_19.startPoint() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_18") SketchLine_20 = Sketch_1.addLine(-6.538, 9.187, -6.538, 10.256) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_19") SketchLine_21 = Sketch_1.addLine(-6.538, 10.256, -6.188, 10.256) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.startPoint() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_20") -SketchConstraintDistance_13 = Sketch_1.setDistance(SketchLine_19.endPoint(), SketchLine_16.result(), 9.187) +SketchConstraintDistance_13 = Sketch_1.setDistance( + SketchLine_19.endPoint(), SketchLine_16.result(), 9.187 +) SketchConstraintDistance_13.setName("SketchConstraintDistance_14") -SketchConstraintDistance_14 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_20.result(), 0.35) +SketchConstraintDistance_14 = Sketch_1.setDistance( + SketchLine_6.endPoint(), SketchLine_20.result(), 0.35 +) SketchConstraintDistance_14.setName("SketchConstraintDistance_15") SketchConstraintVertical_9 = Sketch_1.setVertical(SketchLine_20.result()) SketchConstraintVertical_9.setName("SketchConstraintVertical_10") @@ -197,51 +265,91 @@ SketchConstraintVertical_10 = Sketch_1.setVertical(SketchLine_20.result()) SketchConstraintVertical_10.setName("SketchConstraintVertical_11") SketchLine_22 = Sketch_1.addLine(-6.376, 9.025, -7.650292531, 9.025) SketchLine_22.setAuxiliary(True) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchLine_22.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchLine_22.startPoint() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_21") -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_19.startPoint(), SketchLine_22.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_19.startPoint(), SketchLine_22.startPoint() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_22") SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_22.result()) SketchConstraintHorizontal_8 = Sketch_1.setHorizontal(SketchLine_21.result()) SketchLine_23 = Sketch_1.addLine(-6.188, 10.256, -4.938, 10.97786688777511) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchLine_23.startPoint()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchLine_23.startPoint() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_23") SketchArc_1 = Sketch_1.addArc(0, 2.425, -4.938, 10.97786688777511, 0, 12.301, True) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_15.result()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_15.result() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_24") -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchArc_1.startPoint()) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_23.endPoint(), SketchArc_1.startPoint() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_25") -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_15.result()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_15.result() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_26") -SketchConstraintDistance_15 = Sketch_1.setDistance(SketchLine_16.result(), SketchArc_1.center(), 2.425) +SketchConstraintDistance_15 = Sketch_1.setDistance( + SketchLine_16.result(), SketchArc_1.center(), 2.425 +) SketchConstraintDistance_15.setName("SketchConstraintDistance_16") -SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "r_dome+demi_ep_dome") +SketchConstraintRadius_1 = Sketch_1.setRadius( + SketchArc_1.results()[1], "r_dome+demi_ep_dome" +) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_21.result(), 0.35) SketchLine_24 = Sketch_1.addLine(-4.938, 10.97786688777511, 0, 2.425) SketchLine_24.setAuxiliary(True) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchLine_23.endPoint(), SketchLine_24.startPoint() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_27") -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_24.startPoint()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_24.startPoint() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_28") -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_24.endPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_24.endPoint() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_29") -SketchConstraintAngle_1 = Sketch_1.setAngleBackward(SketchLine_24.result(), SketchLine_15.result(), 30) -SketchConstraintDistance_16 = Sketch_1.setDistance(SketchLine_20.endPoint(), SketchLine_16.result(), 10.256) +SketchConstraintAngle_1 = Sketch_1.setAngleBackward( + SketchLine_24.result(), SketchLine_15.result(), 30 +) +SketchConstraintDistance_16 = Sketch_1.setDistance( + SketchLine_20.endPoint(), SketchLine_16.result(), 10.256 +) SketchConstraintDistance_16.setName("SketchConstraintDistance_17") -SketchConstraintDistance_17 = Sketch_1.setDistance(SketchLine_18.endPoint(), SketchLine_16.result(), 9.532) +SketchConstraintDistance_17 = Sketch_1.setDistance( + SketchLine_18.endPoint(), SketchLine_16.result(), 9.532 +) SketchConstraintDistance_17.setName("SketchConstraintDistance_18") -SketchConstraintDistance_18 = Sketch_1.setDistance(SketchLine_18.endPoint(), SketchLine_6.result(), 0.106) +SketchConstraintDistance_18 = Sketch_1.setDistance( + SketchLine_18.endPoint(), SketchLine_6.result(), 0.106 +) SketchConstraintDistance_18.setName("SketchConstraintDistance_19") -SketchArc_2 = Sketch_1.addArc(-4.79378612024245, 9.263, -6.082, 9.532, -6.022198038184096, 9.735080670922804, True) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchArc_2.startPoint()) +SketchArc_2 = Sketch_1.addArc( + -4.79378612024245, 9.263, -6.082, 9.532, -6.022198038184096, 9.735080670922804, True +) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchArc_2.startPoint() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_30") -SketchConstraintDistance_19 = Sketch_1.setDistance(SketchArc_2.center(), SketchLine_16.result(), 9.263) +SketchConstraintDistance_19 = Sketch_1.setDistance( + SketchArc_2.center(), SketchLine_16.result(), 9.263 +) SketchConstraintDistance_19.setName("SketchConstraintDistance_20") SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 1.316) SketchPoint_2 = Sketch_1.addPoint(0, 0) -SketchLine_25 = Sketch_1.addLine(-4.79378612024245, 9.263, -4.793786120242411, 9.813514482867) +SketchLine_25 = Sketch_1.addLine( + -4.79378612024245, 9.263, -4.793786120242411, 9.813514482867 +) SketchLine_25.setAuxiliary(True) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_25.startPoint()) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_25.startPoint() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_31") SketchConstraintVertical_11 = Sketch_1.setVertical(SketchLine_25.result()) SketchConstraintVertical_11.setName("SketchConstraintVertical_12") @@ -255,24 +363,27 @@ nbMoves = 0 # Two vertical constraints: due to #1889 the sketch is invalid now, not overconstrained from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -assert(not aFactory.validate(SketchConstraintVertical_10.feature())) -#assert Sketch_1.solverError().value() != "", "FAILED: Sketch should report over-constrained situation" +assert not aFactory.validate(SketchConstraintVertical_10.feature()) +# assert Sketch_1.solverError().value() != "", "FAILED: Sketch should report over-constrained situation" # Remove duplicated Vertical constraints Part_1_doc.removeFeature(SketchConstraintVertical_10.feature()) model.do() -assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation" +assert ( + Sketch_1.solverError().value() == "" +), "FAILED: Sketch should NOT report over-constrained situation" -#========================================================================= +# ========================================================================= # Move end point of SketchArc_2 -#========================================================================= +# ========================================================================= aCenter = SketchArc_2.center() aEndPoint = SketchArc_2.endPoint() aDeltaX = aEndPoint.x() - aCenter.x() aDeltaY = aEndPoint.y() - aCenter.y() -anAngle = math.pi / 100. +anAngle = math.pi / 100.0 aCos = math.cos(anAngle) aSin = math.sin(anAngle) @@ -283,16 +394,23 @@ for ang in range(0, NUM_MOVES): aEndPoint.setValue(X, Y) model.do() movementTime = timer() - movementTime - assert math.fabs(aEndPoint.x() - X) < TOLERANCE and math.fabs(aEndPoint.y() - Y) < TOLERANCE, "({0}, {1}) != ({2}, {3})".format(aEndPoint.x(), aEndPoint.y(), X, Y) + assert ( + math.fabs(aEndPoint.x() - X) < TOLERANCE + and math.fabs(aEndPoint.y() - Y) < TOLERANCE + ), "({0}, {1}) != ({2}, {3})".format(aEndPoint.x(), aEndPoint.y(), X, Y) averageTime += movementTime nbMoves += 1 aDeltaX = aEndPoint.x() - aCenter.x() aDeltaY = aEndPoint.y() - aCenter.y() averageTime /= nbMoves print("Movement average time: {0}".format(averageTime)) -assert averageTime < expectedTime, "Average time to move point {0} is greater than expected {1}".format(averageTime, expectedTime) +assert ( + averageTime < expectedTime +), "Average time to move point {0} is greater than expected {1}".format( + averageTime, expectedTime +) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test1779.py b/src/SketchPlugin/Test/Test1779.py index 5df46783f..bc46fd17d 100644 --- a/src/SketchPlugin/Test/Test1779.py +++ b/src/SketchPlugin/Test/Test1779.py @@ -33,43 +33,77 @@ Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "width_hole", "24.5") ParamH = model.addParameter(Part_1_doc, "height", "6.5") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(-22.07107063584519, -12.07106498788576, -38.67766953846773, 4.535533914736781) +SketchLine_1 = Sketch_1.addLine( + -22.07107063584519, -12.07106498788576, -38.67766953846773, 4.535533914736781 +) SketchLine_1.setName("SketchLine_13") SketchLine_1.result().setName("SketchLine_13") -SketchLine_2 = Sketch_1.addLine(-46.85786524463795, 6.000000076973941, -42.21320335935584, 6.000000076973941) +SketchLine_2 = Sketch_1.addLine( + -46.85786524463795, 6.000000076973941, -42.21320335935584, 6.000000076973941 +) SketchLine_2.setName("SketchLine_14") SketchLine_2.result().setName("SketchLine_14") SketchLine_3 = Sketch_1.addLine(-5, -5, -5, 26) SketchLine_3.setName("SketchLine_2") SketchLine_3.result().setName("SketchLine_2") -SketchArc_1 = Sketch_1.addArc(-15, -5, -5, -5, -22.07107063584519, -12.07106498788576, True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchArc_1.startPoint()) +SketchArc_1 = Sketch_1.addArc( + -15, -5, -5, -5, -22.07107063584519, -12.07106498788576, True +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchArc_1.startPoint() +) SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_3") SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) -SketchArc_2 = Sketch_1.addArc(-49.99999999999999, 6.483314850521824, -67.33333268454413, -3.4944393079507, -62.30717627979378, 22.24825735019753, True) -SketchLine_4 = Sketch_1.addLine(-62.30717627979378, 22.24825735019753, -37.30717688933122, 41.76494210080364) +SketchArc_2 = Sketch_1.addArc( + -49.99999999999999, + 6.483314850521824, + -67.33333268454413, + -3.4944393079507, + -62.30717627979378, + 22.24825735019753, + True, +) +SketchLine_4 = Sketch_1.addLine( + -62.30717627979378, 22.24825735019753, -37.30717688933122, 41.76494210080364 +) SketchLine_4.setName("SketchLine_5") SketchLine_4.result().setName("SketchLine_5") -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_8") -SketchArc_3 = Sketch_1.addArc(-25, 26.00000007697395, -37.30717688933122, 41.76494210080364, -5, 26, True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchArc_3.startPoint()) +SketchArc_3 = Sketch_1.addArc( + -25, 26.00000007697395, -37.30717688933122, 41.76494210080364, -5, 26, True +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchArc_3.startPoint() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_9") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_3.endPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_3.endPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_10") SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_3.results()[1], 20) SketchConstraintRadius_1.setName("SketchConstraintRadius_2") SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 31) SketchCircle_1 = Sketch_1.addCircle(-25, 26.00000007697395, 10) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_3.center(), SketchCircle_1.center()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchCircle_1.center() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_11") -SketchLine_5 = Sketch_1.addLine(-25, 26.00000007697395, -9.394737677428997, 26.00000007697395) +SketchLine_5 = Sketch_1.addLine( + -25, 26.00000007697395, -9.394737677428997, 26.00000007697395 +) SketchLine_5.setName("SketchLine_6") SketchLine_5.result().setName("SketchLine_6") SketchLine_5.setAuxiliary(True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_12") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_13") SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintHorizontal_1.setName("SketchConstraintHorizontal_2") @@ -80,11 +114,17 @@ SketchLine_6 = Sketch_1.addLine(-15, -5, -5, -5) SketchLine_6.setName("SketchLine_7") SketchLine_6.result().setName("SketchLine_7") SketchLine_6.setAuxiliary(True) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_6.startPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_14") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_6.endPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_6.endPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_15") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_6.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_6.endPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_16") SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintHorizontal_2.setName("SketchConstraintHorizontal_3") @@ -92,125 +132,246 @@ SketchLine_7 = Sketch_1.addLine(-25, 26.00000007697395, -25, 49.221836288079) SketchLine_7.setName("SketchLine_8") SketchLine_7.result().setName("SketchLine_8") SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_7.startPoint() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_17") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_7.startPoint() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_18") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_7.startPoint() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_19") SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_7.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_2.center(), SketchLine_7.result(), 25) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_2.center(), SketchLine_7.result(), 25 +) SketchCircle_3 = Sketch_1.addCircle(-43.99999999999999, 21.00000007697395, 6.5) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_3.center(), SketchLine_7.result(), 19) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchCircle_2.center(), SketchLine_5.result(), 25) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchCircle_3.center(), SketchLine_7.result(), 19 +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchCircle_2.center(), SketchLine_5.result(), 25 +) SketchConstraintDistance_3.setName("SketchConstraintDistance_4") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchCircle_2.center(), SketchLine_7.result(), 7) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchCircle_2.center(), SketchLine_7.result(), 7 +) SketchConstraintDistance_4.setName("SketchConstraintDistance_5") -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_3.result()) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_3.result() +) SketchConstraintTangent_1.setName("SketchConstraintTangent_2") -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_3.results()[1]) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_4.result(), SketchArc_3.results()[1] +) SketchConstraintTangent_2.setName("SketchConstraintTangent_3") -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_4.result()) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_4.result() +) SketchConstraintTangent_3.setName("SketchConstraintTangent_4") SketchLine_8 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_8.setName("SketchLine_9") SketchLine_8.result().setName("SketchLine_9") -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchArc_1.startPoint(), SketchLine_8.result(), 5) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchArc_1.startPoint(), SketchLine_8.result(), 5 +) SketchConstraintDistance_5.setName("SketchConstraintDistance_8") SketchLine_9 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_9.setName("SketchLine_10") SketchLine_9.result().setName("SketchLine_10") -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchArc_1.startPoint(), SketchLine_9.result(), 5) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchArc_1.startPoint(), SketchLine_9.result(), 5 +) SketchConstraintDistance_6.setName("SketchConstraintDistance_9") SketchPoint_1 = Sketch_1.addPoint(-59.46448692526128, -4.535554660152811) -SketchArc_4 = Sketch_1.addArc(-63, -0.9999999230260515, -67.33333268454413, -3.4944393079507, -59.46448692526128, -4.535554660152811, False) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchArc_4.startPoint()) +SketchArc_4 = Sketch_1.addArc( + -63, + -0.9999999230260515, + -67.33333268454413, + -3.4944393079507, + -59.46448692526128, + -4.535554660152811, + False, +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchArc_4.startPoint() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_21") SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_4.results()[1], 5) SketchConstraintRadius_3.setName("SketchConstraintRadius_4") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchPoint_1.coordinates()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchPoint_1.coordinates() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_22") SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], 6.5) SketchConstraintRadius_4.setName("SketchConstraintRadius_5") SketchConstraintRadius_5 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) SketchConstraintRadius_5.setName("SketchConstraintRadius_6") -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_3.results()[1], SketchCircle_2.results()[1]) -SketchArc_5 = Sketch_1.addArc(-42.21320351257037, 1.000000076973942, -38.67766953846773, 4.535533914736781, -42.21320335935584, 6.000000076973941, False) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_5.startPoint(), SketchLine_1.endPoint()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchCircle_3.results()[1], SketchCircle_2.results()[1] +) +SketchArc_5 = Sketch_1.addArc( + -42.21320351257037, + 1.000000076973942, + -38.67766953846773, + 4.535533914736781, + -42.21320335935584, + 6.000000076973941, + False, +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_5.startPoint(), SketchLine_1.endPoint() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_27") -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_2.endPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchLine_2.endPoint() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_28") -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchLine_1.result()) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_5.results()[1], SketchLine_1.result() +) SketchConstraintTangent_4.setName("SketchConstraintTangent_7") -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchLine_2.result()) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchArc_5.results()[1], SketchLine_2.result() +) SketchConstraintTangent_5.setName("SketchConstraintTangent_8") SketchConstraintRadius_6 = Sketch_1.setRadius(SketchArc_5.results()[1], 5) SketchConstraintRadius_6.setName("SketchConstraintRadius_7") SketchPoint_2 = Sketch_1.addPoint(-46.85786524463795, 6.000000076973941) SketchPoint_2.setName("SketchPoint_3") SketchPoint_2.result().setName("SketchPoint_3") -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_2.startPoint() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_38") -SketchLine_10 = Sketch_1.addLine(-46.85786524463795, 6.000000076973941, -46.85786524463795, -6.278575593100925) +SketchLine_10 = Sketch_1.addLine( + -46.85786524463795, 6.000000076973941, -46.85786524463795, -6.278575593100925 +) SketchLine_10.setName("SketchLine_22") SketchLine_10.result().setName("SketchLine_22") SketchLine_10.setAuxiliary(True) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_10.startPoint() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_40") -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_10.startPoint() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_41") SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_10.result()) SketchConstraintVertical_3.setName("SketchConstraintVertical_5") SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintHorizontal_3.setName("SketchConstraintHorizontal_8") -SketchArc_6 = Sketch_1.addArc(SketchLine_2.startPoint(), -50.3933775416084, 4.535554723500073, False) +SketchArc_6 = Sketch_1.addArc( + SketchLine_2.startPoint(), -50.3933775416084, 4.535554723500073, False +) model.do() -SketchArc_6 = SketchAPI_Arc(model.lastSubFeature(featureToCompositeFeature(Sketch_1.feature()), "SketchArc")) -SketchLine_11 = Sketch_1.addLine(-50.3933775416084, 4.535554723500073, -59.46448692526128, -4.535554660152811) +SketchArc_6 = SketchAPI_Arc( + model.lastSubFeature(featureToCompositeFeature(Sketch_1.feature()), "SketchArc") +) +SketchLine_11 = Sketch_1.addLine( + -50.3933775416084, 4.535554723500073, -59.46448692526128, -4.535554660152811 +) SketchLine_11.setName("SketchLine_21") SketchLine_11.result().setName("SketchLine_21") -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchArc_6.endPoint()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchArc_6.endPoint() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_30") -SketchConstraintTangent_7 = Sketch_1.setTangent(SketchArc_6.results()[1], SketchLine_11.result()) +SketchConstraintTangent_7 = Sketch_1.setTangent( + SketchArc_6.results()[1], SketchLine_11.result() +) SketchConstraintTangent_7.setName("SketchConstraintTangent_10") SketchConstraintRadius_7 = Sketch_1.setRadius(SketchArc_6.results()[1], 5) SketchConstraintRadius_7.setName("SketchConstraintRadius_8") -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchArc_3.center(), SketchLine_2.result(), 20) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchArc_3.center(), SketchLine_2.result(), 20 +) SketchConstraintDistance_7.setName("SketchConstraintDistance_10") -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchArc_4.center(), SketchLine_5.result(), 27) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchArc_4.center(), SketchLine_5.result(), 27 +) SketchConstraintDistance_8.setName("SketchConstraintDistance_12") -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_11.endPoint()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_11.endPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_31") -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchArc_4.center(), SketchLine_7.result(), 38) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchArc_4.center(), SketchLine_7.result(), 38 +) SketchConstraintDistance_9.setName("SketchConstraintDistance_13") -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchCircle_3.center(), SketchLine_5.result(), 5) +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchCircle_3.center(), SketchLine_5.result(), 5 +) SketchConstraintDistance_10.setName("SketchConstraintDistance_14") -SketchConstraintTangent_8 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_11.result()) +SketchConstraintTangent_8 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchLine_11.result() +) SketchConstraintTangent_8.setName("SketchConstraintTangent_11") -SketchConstraintTangent_9 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_4.results()[1]) +SketchConstraintTangent_9 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_4.results()[1] +) SketchConstraintTangent_9.setName("SketchConstraintTangent_12") SketchConstraintRadius_8 = Sketch_1.setRadius(SketchArc_2.results()[1], 20) SketchConstraintRadius_8.setName("SketchConstraintRadius_9") SketchCircle_4 = Sketch_1.addCircle(-58.99999999999999, 10.00000007697395, 6.5) -SketchConstraintDistance_11 = Sketch_1.setDistance(SketchCircle_4.center(), SketchLine_7.result(), 34) +SketchConstraintDistance_11 = Sketch_1.setDistance( + SketchCircle_4.center(), SketchLine_7.result(), 34 +) SketchConstraintDistance_11.setName("SketchConstraintDistance_15") -SketchConstraintDistance_12 = Sketch_1.setDistance(SketchCircle_4.center(), SketchLine_5.result(), 16) +SketchConstraintDistance_12 = Sketch_1.setDistance( + SketchCircle_4.center(), SketchLine_5.result(), 16 +) SketchConstraintDistance_12.setName("SketchConstraintDistance_16") -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchCircle_2.results()[1], SketchCircle_4.results()[1]) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.endPoint()) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchCircle_2.results()[1], SketchCircle_4.results()[1] +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_1.endPoint() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_32") -SketchConstraintAngle_1 = Sketch_1.setAngleBackward(SketchLine_1.result(), SketchLine_2.result(), 135) -SketchConstraintTangent_10 = Sketch_1.setTangent(SketchLine_1.result(), SketchArc_1.results()[1]) +SketchConstraintAngle_1 = Sketch_1.setAngleBackward( + SketchLine_1.result(), SketchLine_2.result(), 135 +) +SketchConstraintTangent_10 = Sketch_1.setTangent( + SketchLine_1.result(), SketchArc_1.results()[1] +) SketchConstraintTangent_10.setName("SketchConstraintTangent_13") -SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_11.result(), SketchLine_10.result(), 45) +SketchConstraintAngle_2 = Sketch_1.setAngle( + SketchLine_11.result(), SketchLine_10.result(), 45 +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchArc_3_2f-SketchLine_5r-SketchArc_2_2f-SketchArc_4_2f-SketchLine_21r-SketchArc_6_2r-SketchLine_14f-SketchArc_5_2r-SketchLine_13r-SketchCircle_2_2r-SketchCircle_1_2r-SketchCircle_4_2r-SketchCircle_3_2r")], model.selection(), "height", 0) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2")) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchArc_3_2f-SketchLine_5r-SketchArc_2_2f-SketchArc_4_2f-SketchLine_21r-SketchArc_6_2r-SketchLine_14f-SketchArc_5_2r-SketchLine_13r-SketchCircle_2_2r-SketchCircle_1_2r-SketchCircle_4_2r-SketchCircle_3_2r", + ) + ], + model.selection(), + "height", + 0, +) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"), +) SketchLine_12 = Sketch_2.addLine(38.24999999999999, 6.5, 13.75, 6.5) -SketchLine_13 = Sketch_2.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face_1]")) +SketchLine_13 = Sketch_2.addLine( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face_1]", + ) +) SketchLine_13.setName("SketchLine_15") SketchLine_13.result().setName("SketchLine_15") -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.result()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.result() +) SketchLine_14 = Sketch_2.addLine(13.75, 6.5, 13.75, 4.5) SketchLine_14.setName("SketchLine_16") SketchLine_14.result().setName("SketchLine_16") @@ -220,12 +381,20 @@ SketchLine_15.result().setName("SketchLine_17") SketchLine_16 = Sketch_2.addLine(38.24999999999999, 4.5, 38.24999999999999, 6.5) SketchLine_16.setName("SketchLine_18") SketchLine_16.result().setName("SketchLine_18") -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_14.startPoint() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_33") -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_34") -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_35") SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_12.result()) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_14.result()) @@ -234,23 +403,37 @@ SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_16.result()) SketchConstraintVertical_5.setName("SketchConstraintVertical_6") SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_14.result(), 2) SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_12.result(), "width_hole") -SketchConstraintDistance_13 = Sketch_2.setDistance(SketchLine_13.endPoint(), SketchLine_16.result(), "width_hole/2") +SketchConstraintDistance_13 = Sketch_2.setDistance( + SketchLine_13.endPoint(), SketchLine_16.result(), "width_hole/2" +) SketchConstraintDistance_13.setName("SketchConstraintDistance_17") model.do() -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_12r-SketchLine_16f-SketchLine_17f-SketchLine_18f")], model.selection(), 0, 100, [model.selection("SOLID", "Extrusion_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_2/Face-SketchLine_12r-SketchLine_16f-SketchLine_17f-SketchLine_18f", + ) + ], + model.selection(), + 0, + 100, + [model.selection("SOLID", "Extrusion_1_1")], +) model.do() # check ExtrusionCut_1 is valid -assert(ExtrusionCut_1.feature().error() == "") +assert ExtrusionCut_1.feature().error() == "" # change parameter and check validity again ParamH.setValue(10) model.do() -assert(ExtrusionCut_1.feature().error() == "") +assert ExtrusionCut_1.feature().error() == "" # revert parameter ParamH.setValue(6.5) model.do() -assert(ExtrusionCut_1.feature().error() == "") +assert ExtrusionCut_1.feature().error() == "" model.end() diff --git a/src/SketchPlugin/Test/Test19089.py b/src/SketchPlugin/Test/Test19089.py index 3fb36fedc..cc98588d9 100644 --- a/src/SketchPlugin/Test/Test19089.py +++ b/src/SketchPlugin/Test/Test19089.py @@ -29,144 +29,337 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, -200, 0) SketchLine_1.setAuxiliary(True) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchPoint_1.result() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchLine_2 = Sketch_1.addLine(0, 0, 125.8640781685023, 155.4291923249108) SketchLine_2.setAuxiliary(True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.startPoint()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.startPoint() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_3 = SketchProjection_2.createdFeature() -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_2.result(), SketchLine_3.result(), 51, type = "Direct") -SketchProjection_3 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_2.result(), SketchLine_3.result(), 51, type="Direct" +) +SketchProjection_3 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint()) -SketchProjection_4 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.startPoint() +) +SketchProjection_4 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_3 = SketchProjection_4.createdFeature() -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_1.startPoint() +) SketchCircle_1 = Sketch_1.addCircle(-130, 0, 30) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 30) SketchCircle_2 = Sketch_1.addCircle(-130, 0, 15) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchCircle_2.center()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchCircle_2.center() +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchCircle_2.results()[1], 15) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchCircle_2.center()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchCircle_2.center() +) SketchCircle_3 = Sketch_1.addCircle(0, 0, 22) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_3.center()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_3.center() +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchCircle_3.results()[1], 22) -SketchProjection_5 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_5 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_4 = SketchProjection_5.createdFeature() -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_1.startPoint() +) SketchCircle_4 = Sketch_1.addCircle(79.92368958823798, 98.69753716583253, 25) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_2.result(), SketchCircle_4.center()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchCircle_4.center() +) SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_4.results()[1], 25) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_4.center(), SketchLine_1.startPoint(), 127, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_4.center(), SketchLine_1.startPoint(), 127, True +) SketchCircle_5 = Sketch_1.addCircle(79.92368958823798, 98.69753716583253, 10.5) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchCircle_4.center(), SketchCircle_5.center()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchCircle_4.center(), SketchCircle_5.center() +) SketchConstraintRadius_5 = Sketch_1.setRadius(SketchCircle_5.results()[1], 10.5) SketchCircle_6 = Sketch_1.addCircle(-22, 0, 50) SketchConstraintRadius_6 = Sketch_1.setRadius(SketchCircle_6.results()[1], 50) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchCircle_1.center(), SketchLine_1.startPoint(), 130) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchCircle_6.center(), SketchCircle_3.results()[1]) -SketchLine_4 = Sketch_1.addLine(-135.5555553202231, -29.48110929195068, -31.25925965787122, -49.13518200422299) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchCircle_6.results()[1]) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_4.result(), SketchCircle_6.results()[1]) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_4.result(), SketchCircle_1.results()[1]) -SketchLine_5 = Sketch_1.addLine(100.207326266124, 84.08336295232411, 18.56727244892193, -29.22834935563313) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchCircle_1.center(), SketchLine_1.startPoint(), 130 +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchCircle_6.center(), SketchCircle_3.results()[1] +) +SketchLine_4 = Sketch_1.addLine( + -135.5555553202231, -29.48110929195068, -31.25925965787122, -49.13518200422299 +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchCircle_6.results()[1] +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_4.result(), SketchCircle_6.results()[1] +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_4.result(), SketchCircle_1.results()[1] +) +SketchLine_5 = Sketch_1.addLine( + 100.207326266124, 84.08336295232411, 18.56727244892193, -29.22834935563313 +) SketchLine_5.setName("SketchLine_7") SketchLine_5.result().setName("SketchLine_7") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchCircle_4.results()[1]) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchCircle_6.results()[1]) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchLine_5.result(), SketchCircle_4.results()[1]) -SketchProjection_6 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchCircle_4.results()[1] +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchCircle_6.results()[1] +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchLine_5.result(), SketchCircle_4.results()[1] +) +SketchProjection_6 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_5 = SketchProjection_6.createdFeature() -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_5).coordinates(), SketchLine_1.startPoint()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_5.result(), SketchCircle_6.results()[1]) -SketchProjection_7 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_5).coordinates(), SketchLine_1.startPoint() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchLine_5.result(), SketchCircle_6.results()[1] +) +SketchProjection_7 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_6 = SketchProjection_7.createdFeature() -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_6).coordinates(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_6).coordinates(), SketchLine_1.startPoint() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 200) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 200) -SketchProjection_8 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_8 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_6 = SketchProjection_8.createdFeature() SketchLine_6.setName("SketchLine_9") SketchLine_6.result().setName("SketchLine_9") -SketchLine_7 = Sketch_1.addLine(-58.90083370282744, 5.000000000000203, -28.28427124763085, 5.000000000033542) +SketchLine_7 = Sketch_1.addLine( + -58.90083370282744, 5.000000000000203, -28.28427124763085, 5.000000000033542 +) SketchLine_7.setName("SketchLine_11") SketchLine_7.result().setName("SketchLine_11") SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_7.result()) -SketchArc_1 = Sketch_1.addArc(1.092525663159903, -2.072674848391145, -23.6595708565321, 8.099435269932149, 1.823223447996278, 24.67810433886826, True) +SketchArc_1 = Sketch_1.addArc( + 1.092525663159903, + -2.072674848391145, + -23.6595708565321, + 8.099435269932149, + 1.823223447996278, + 24.67810433886826, + True, +) SketchArc_1.setName("SketchArc_2") SketchArc_1.result().setName("SketchArc_2") SketchArc_1.results()[1].setName("SketchArc_2_2") -SketchArc_2 = Sketch_1.addArc(-28.28427124755999, 10.00000000000959, -28.28427124763085, 5.000000000033542, -23.6595708565321, 8.099435269932149, False) +SketchArc_2 = Sketch_1.addArc( + -28.28427124755999, + 10.00000000000959, + -28.28427124763085, + 5.000000000033542, + -23.6595708565321, + 8.099435269932149, + False, +) SketchArc_2.setName("SketchArc_3") SketchArc_2.result().setName("SketchArc_3") SketchArc_2.results()[1].setName("SketchArc_3_2") -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchArc_2.endPoint()) -SketchBSpline_1 = Sketch_1.addSpline(poles = [(5.42506581245492, 28.95281880404086), (8.251261958075688, 26.29329599041063), (7.364240199526506, 23.57679185485375), (1.82322344799795, 24.67810433886992)]) -[SketchPoint_7, SketchPoint_8, SketchPoint_9, SketchPoint_10] = SketchBSpline_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_8, SketchLine_9, SketchLine_10] = SketchBSpline_1.controlPolygon(auxiliary = [0, 1, 2]) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_10).coordinates(), SketchArc_1.results()[1]) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchArc_2.results()[1]) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchArc_2.results()[1]) -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchLine_7.result(), SketchArc_2.results()[1]) -SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_1.results()[1]) -SketchArc_3 = Sketch_1.addArc(-59.53980728749703, 7.416963540217947, -62.03603251498611, 7.554293849432937, -58.90083370282744, 5.000000000000203, False) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchArc_2.endPoint() +) +SketchBSpline_1 = Sketch_1.addSpline( + poles=[ + (5.42506581245492, 28.95281880404086), + (8.251261958075688, 26.29329599041063), + (7.364240199526506, 23.57679185485375), + (1.82322344799795, 24.67810433886992), + ] +) +[ + SketchPoint_7, + SketchPoint_8, + SketchPoint_9, + SketchPoint_10, +] = SketchBSpline_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[SketchLine_8, SketchLine_9, SketchLine_10] = SketchBSpline_1.controlPolygon( + auxiliary=[0, 1, 2] +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_10).coordinates(), SketchArc_1.results()[1] +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchArc_2.results()[1] +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchArc_2.results()[1] +) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchLine_7.result(), SketchArc_2.results()[1] +) +SketchConstraintTangent_6 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_1.results()[1] +) +SketchArc_3 = Sketch_1.addArc( + -59.53980728749703, + 7.416963540217947, + -62.03603251498611, + 7.554293849432937, + -58.90083370282744, + 5.000000000000203, + False, +) SketchArc_3.setName("SketchArc_4") SketchArc_3.result().setName("SketchArc_4") SketchArc_3.results()[1].setName("SketchArc_4_2") -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchArc_3.endPoint()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_7.result()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchArc_3.endPoint() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_7.result() +) SketchConstraintRadius_7 = Sketch_1.setRadius(SketchArc_3.results()[1], 2.5) SketchConstraintRadius_8 = Sketch_1.setRadius(SketchArc_2.results()[1], 5) -SketchProjection_9 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_9 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_11 = SketchProjection_9.createdFeature() -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_7.endPoint(), SketchAPI_Point(SketchPoint_11).coordinates(), 5) -SketchProjection_10 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_7.endPoint(), SketchAPI_Point(SketchPoint_11).coordinates(), 5 +) +SketchProjection_10 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_12 = SketchProjection_10.createdFeature() -SketchProjection_11 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_11 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_13 = SketchProjection_11.createdFeature() SketchConstraintRigid_1 = Sketch_1.setFixed(SketchBSpline_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchArc_2.center(), SketchLine_1.startPoint(), 30, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchArc_3.center(), SketchAPI_Point(SketchPoint_1).coordinates(), 60, True) -SketchProjection_12 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchArc_2.center(), SketchLine_1.startPoint(), 30, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchArc_3.center(), SketchAPI_Point(SketchPoint_1).coordinates(), 60, True +) +SketchProjection_12 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_11 = SketchProjection_12.createdFeature() SketchLine_11.setName("SketchLine_13") SketchLine_11.result().setName("SketchLine_13") -SketchProjection_13 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_13 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_12 = SketchProjection_13.createdFeature() SketchLine_12.setName("SketchLine_15") SketchLine_12.result().setName("SketchLine_15") -SketchProjection_14 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_14 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_13 = SketchProjection_14.createdFeature() SketchLine_13.setName("SketchLine_16") SketchLine_13.result().setName("SketchLine_16") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchArc_3.center(), SketchArc_2.center(), 31.3620887458, True) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchArc_1.center(), SketchAPI_Point(SketchPoint_1).coordinates(), 2.34298812456, True) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchArc_1.results()[1], SketchArc_1.startPoint()) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_2.results()[1], SketchLine_7.endPoint()) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_10.result()) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchArc_3.results()[1]) -SketchArc_4 = Sketch_1.addArc(-24.2523466963382, 5.475617146697203, 5.42506581245492, 28.95281880404086, -62.03603251498611, 7.554293849432937, False) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchArc_3.center(), SketchArc_2.center(), 31.3620887458, True +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchArc_1.center(), + SketchAPI_Point(SketchPoint_1).coordinates(), + 2.34298812456, + True, +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchArc_1.results()[1], SketchArc_1.startPoint() +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchArc_2.results()[1], SketchLine_7.endPoint() +) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_10.result() +) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchArc_3.results()[1] +) +SketchArc_4 = Sketch_1.addArc( + -24.2523466963382, + 5.475617146697203, + 5.42506581245492, + 28.95281880404086, + -62.03603251498611, + 7.554293849432937, + False, +) SketchArc_4.setName("SketchArc_5") SketchArc_4.result().setName("SketchArc_5") SketchArc_4.results()[1].setName("SketchArc_5_2") -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchBSpline_1.startPoint(), SketchArc_4.startPoint()) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchArc_4.endPoint()) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchBSpline_1.startPoint(), SketchArc_4.startPoint() +) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchArc_4.endPoint() +) SketchConstraintRadius_9 = Sketch_1.setRadius(SketchArc_4.results()[1], 37.8408220164) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchBSpline_1.startPoint()) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchBSpline_1.startPoint()) -SketchConstraintTangent_7 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchArc_3.results()[1]) -SketchProjection_15 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchArc_4.startPoint(), SketchBSpline_1.startPoint() +) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchArc_4.startPoint(), SketchBSpline_1.startPoint() +) +SketchConstraintTangent_7 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchArc_3.results()[1] +) +SketchProjection_15 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_14 = SketchProjection_15.createdFeature() SketchLine_14.setName("SketchLine_17") SketchLine_14.result().setName("SketchLine_17") -SketchConstraintMirror_1_objects = [SketchArc_1.results()[1], SketchArc_2.results()[1], SketchLine_7.result(), SketchArc_3.results()[1], SketchArc_4.results()[1]] -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_14.result(), SketchConstraintMirror_1_objects) -[SketchArc_5, SketchArc_6, SketchLine_15, SketchArc_7, SketchArc_8] = SketchConstraintMirror_1.mirrored() +SketchConstraintMirror_1_objects = [ + SketchArc_1.results()[1], + SketchArc_2.results()[1], + SketchLine_7.result(), + SketchArc_3.results()[1], + SketchArc_4.results()[1], +] +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_14.result(), SketchConstraintMirror_1_objects +) +[ + SketchArc_5, + SketchArc_6, + SketchLine_15, + SketchArc_7, + SketchArc_8, +] = SketchConstraintMirror_1.mirrored() SketchArc_8.setName("SketchArc_9") SketchArc_8.result().setName("SketchArc_9") SketchArc_8.results()[1].setName("SketchArc_9_2") @@ -181,126 +374,329 @@ SketchArc_6.results()[1].setName("SketchArc_7_2") SketchArc_5.setName("SketchArc_6") SketchArc_5.result().setName("SketchArc_6") SketchArc_5.results()[1].setName("SketchArc_6_2") -SketchProjection_16 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_16 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_16 = SketchProjection_16.createdFeature() SketchLine_16.setName("SketchLine_19") SketchLine_16.result().setName("SketchLine_19") -SketchProjection_17 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_17 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_17 = SketchProjection_17.createdFeature() SketchLine_17.setName("SketchLine_20") SketchLine_17.result().setName("SketchLine_20") SketchCircle_7 = Sketch_1.addCircle(-15, -2.323482427062702e-11, 4) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_7.center()) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchCircle_7.center() +) SketchConstraintRadius_10 = Sketch_1.setRadius(SketchCircle_7.results()[1], 4) -SketchProjection_18 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_18 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_14 = SketchProjection_18.createdFeature() -SketchMultiRotation_1 = Sketch_1.addRotation([SketchCircle_7.results()[1]], SketchAPI_Point(SketchPoint_14).coordinates(), 360, 7, True) -[SketchCircle_8, SketchCircle_9, SketchCircle_10, SketchCircle_11, SketchCircle_12, SketchCircle_13] = SketchMultiRotation_1.rotated() -SketchProjection_19 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchCircle_7.results()[1]], + SketchAPI_Point(SketchPoint_14).coordinates(), + 360, + 7, + True, +) +[ + SketchCircle_8, + SketchCircle_9, + SketchCircle_10, + SketchCircle_11, + SketchCircle_12, + SketchCircle_13, +] = SketchMultiRotation_1.rotated() +SketchProjection_19 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_15 = SketchProjection_19.createdFeature() -SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchCircle_7.center(), SketchAPI_Point(SketchPoint_15).coordinates(), 15) -SketchArc_9 = Sketch_1.addArc(1.920808383685174, -28.25067992433036, 1.823223447996874, -24.67810433889008, 5.425065812456392, -28.95281880404202, True) +SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance( + SketchCircle_7.center(), SketchAPI_Point(SketchPoint_15).coordinates(), 15 +) +SketchArc_9 = Sketch_1.addArc( + 1.920808383685174, + -28.25067992433036, + 1.823223447996874, + -24.67810433889008, + 5.425065812456392, + -28.95281880404202, + True, +) SketchArc_9.setName("SketchArc_10") SketchArc_9.result().setName("SketchArc_10") SketchArc_9.results()[1].setName("SketchArc_10_2") -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchAPI_Arc(SketchArc_5).endPoint(), SketchArc_9.startPoint()) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchAPI_Arc(SketchArc_8).startPoint(), SketchArc_9.endPoint()) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchAPI_Arc(SketchArc_5).endPoint(), SketchArc_9.results()[1]) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchAPI_Arc(SketchArc_8).startPoint(), SketchArc_8.results()[1]) -SketchConstraintTangent_8 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchArc_9.results()[1]) -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchLine_4.result(), SketchLine_4.endPoint()) -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchCircle_6.center(), SketchLine_1.result()) -SketchLine_18 = Sketch_1.addLine(-135.5313764125274, 29.48565541043907, -34.10055249047601, 48.51367466421663) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchAPI_Arc(SketchArc_5).endPoint(), SketchArc_9.startPoint() +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchAPI_Arc(SketchArc_8).startPoint(), SketchArc_9.endPoint() +) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchAPI_Arc(SketchArc_5).endPoint(), SketchArc_9.results()[1] +) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchAPI_Arc(SketchArc_8).startPoint(), SketchArc_8.results()[1] +) +SketchConstraintTangent_8 = Sketch_1.setTangent( + SketchArc_5.results()[1], SketchArc_9.results()[1] +) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchLine_4.result(), SketchLine_4.endPoint() +) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchLine_4.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchCircle_6.center(), SketchLine_1.result() +) +SketchLine_18 = Sketch_1.addLine( + -135.5313764125274, 29.48565541043907, -34.10055249047601, 48.51367466421663 +) SketchLine_18.setName("SketchLine_28") SketchLine_18.result().setName("SketchLine_28") -SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchLine_18.startPoint(), SketchCircle_1.results()[1]) -SketchLine_19 = Sketch_1.addLine(-34.10055249047601, 48.51367466421663, 65.46602437165166, 119.093024701899) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident( + SketchLine_18.startPoint(), SketchCircle_1.results()[1] +) +SketchLine_19 = Sketch_1.addLine( + -34.10055249047601, 48.51367466421663, 65.46602437165166, 119.093024701899 +) SketchLine_19.setName("SketchLine_31") SketchLine_19.result().setName("SketchLine_31") -SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchCircle_4.results()[1]) -SketchConstraintTangent_9 = Sketch_1.setTangent(SketchLine_19.result(), SketchCircle_4.results()[1]) -SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchCircle_6.results()[1]) -SketchConstraintTangent_10 = Sketch_1.setTangent(SketchLine_18.result(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchLine_18.startPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_42 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) +SketchConstraintCoincidence_43 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchCircle_4.results()[1] +) +SketchConstraintTangent_9 = Sketch_1.setTangent( + SketchLine_19.result(), SketchCircle_4.results()[1] +) +SketchConstraintCoincidence_44 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchCircle_6.results()[1] +) +SketchConstraintTangent_10 = Sketch_1.setTangent( + SketchLine_18.result(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_45 = Sketch_1.setCoincident( + SketchLine_18.startPoint(), SketchCircle_1.results()[1] +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_18.result(), 103.200181968) model.do() -Sketch_1.changeFacesOrder([[SketchCircle_1.results()[1], SketchCircle_1.results()[1], SketchCircle_1.results()[1], SketchCircle_2.results()[1]], - [SketchCircle_2.results()[1]], - [SketchCircle_3.results()[1], SketchCircle_7.results()[1], SketchCircle_8.results()[1], SketchCircle_9.results()[1], SketchCircle_10.results()[1], SketchCircle_11.results()[1], SketchCircle_12.results()[1], SketchCircle_13.results()[1]], - [SketchCircle_7.results()[1]], - [SketchCircle_4.results()[1], SketchCircle_4.results()[1], SketchCircle_4.results()[1], SketchCircle_5.results()[1]], - [SketchCircle_5.results()[1]], - [SketchCircle_6.results()[1], SketchCircle_6.results()[1], SketchCircle_6.results()[1], SketchCircle_6.results()[1], SketchCircle_3.results()[1], SketchArc_3.results()[1], SketchArc_4.results()[1], SketchBSpline_1.result(), SketchArc_1.results()[1], SketchArc_2.results()[1], SketchLine_7.result(), SketchArc_5.results()[1], SketchArc_9.results()[1], SketchArc_8.results()[1], SketchArc_7.results()[1], SketchLine_15.result(), SketchArc_6.results()[1]], - [SketchCircle_1.results()[1], SketchLine_4.result(), SketchCircle_6.results()[1], SketchLine_18.result(), SketchCircle_1.results()[1]], - [SketchCircle_9.results()[1]], - [SketchCircle_8.results()[1]], - [SketchCircle_10.results()[1]], - [SketchCircle_11.results()[1]], - [SketchCircle_12.results()[1]], - [SketchCircle_13.results()[1]], - [SketchArc_6.results()[1], SketchLine_15.result(), SketchArc_7.results()[1], SketchArc_8.results()[1], SketchArc_9.results()[1], SketchArc_5.results()[1]], - [SketchLine_7.result(), SketchArc_2.results()[1], SketchArc_1.results()[1], SketchBSpline_1.result(), SketchArc_4.results()[1], SketchArc_3.results()[1]], - [SketchLine_19.result(), SketchCircle_6.results()[1], SketchCircle_6.results()[1], SketchLine_5.result(), SketchCircle_4.results()[1]] - ]) +Sketch_1.changeFacesOrder( + [ + [ + SketchCircle_1.results()[1], + SketchCircle_1.results()[1], + SketchCircle_1.results()[1], + SketchCircle_2.results()[1], + ], + [SketchCircle_2.results()[1]], + [ + SketchCircle_3.results()[1], + SketchCircle_7.results()[1], + SketchCircle_8.results()[1], + SketchCircle_9.results()[1], + SketchCircle_10.results()[1], + SketchCircle_11.results()[1], + SketchCircle_12.results()[1], + SketchCircle_13.results()[1], + ], + [SketchCircle_7.results()[1]], + [ + SketchCircle_4.results()[1], + SketchCircle_4.results()[1], + SketchCircle_4.results()[1], + SketchCircle_5.results()[1], + ], + [SketchCircle_5.results()[1]], + [ + SketchCircle_6.results()[1], + SketchCircle_6.results()[1], + SketchCircle_6.results()[1], + SketchCircle_6.results()[1], + SketchCircle_3.results()[1], + SketchArc_3.results()[1], + SketchArc_4.results()[1], + SketchBSpline_1.result(), + SketchArc_1.results()[1], + SketchArc_2.results()[1], + SketchLine_7.result(), + SketchArc_5.results()[1], + SketchArc_9.results()[1], + SketchArc_8.results()[1], + SketchArc_7.results()[1], + SketchLine_15.result(), + SketchArc_6.results()[1], + ], + [ + SketchCircle_1.results()[1], + SketchLine_4.result(), + SketchCircle_6.results()[1], + SketchLine_18.result(), + SketchCircle_1.results()[1], + ], + [SketchCircle_9.results()[1]], + [SketchCircle_8.results()[1]], + [SketchCircle_10.results()[1]], + [SketchCircle_11.results()[1]], + [SketchCircle_12.results()[1]], + [SketchCircle_13.results()[1]], + [ + SketchArc_6.results()[1], + SketchLine_15.result(), + SketchArc_7.results()[1], + SketchArc_8.results()[1], + SketchArc_9.results()[1], + SketchArc_5.results()[1], + ], + [ + SketchLine_7.result(), + SketchArc_2.results()[1], + SketchArc_1.results()[1], + SketchBSpline_1.result(), + SketchArc_4.results()[1], + SketchArc_3.results()[1], + ], + [ + SketchLine_19.result(), + SketchCircle_6.results()[1], + SketchCircle_6.results()[1], + SketchLine_5.result(), + SketchCircle_4.results()[1], + ], + ] +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_20 = Sketch_2.addLine(-108.2203399093874, 29.36510735335589, -63.72579508004998, 37.75878764820845) +SketchLine_20 = Sketch_2.addLine( + -108.2203399093874, 29.36510735335589, -63.72579508004998, 37.75878764820845 +) SketchLine_20.setName("SketchLine_21") SketchLine_20.result().setName("SketchLine_21") -SketchArc_10 = Sketch_2.addArc(-107.4788517859555, 25.43443296082969, -108.2203399093874, 29.36510735335589, -110.1251963597947, 22.43495436799721, False) +SketchArc_10 = Sketch_2.addArc( + -107.4788517859555, + 25.43443296082969, + -108.2203399093874, + 29.36510735335589, + -110.1251963597947, + 22.43495436799721, + False, +) SketchArc_10.setName("SketchArc_11") SketchArc_10.result().setName("SketchArc_11") SketchArc_10.results()[1].setName("SketchArc_11_2") -SketchConstraintCoincidence_46 = Sketch_2.setCoincident(SketchLine_20.startPoint(), SketchArc_10.startPoint()) -SketchProjection_20 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchCircle_1_2"), False) +SketchConstraintCoincidence_46 = Sketch_2.setCoincident( + SketchLine_20.startPoint(), SketchArc_10.startPoint() +) +SketchProjection_20 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchCircle_1_2"), False +) SketchProjection_20.setName("SketchProjection_22") SketchProjection_20.result().setName("SketchProjection_22") SketchCircle_14 = SketchProjection_20.createdFeature() SketchCircle_14.setName("SketchCircle_15") SketchCircle_14.result().setName("SketchCircle_15") SketchCircle_14.results()[1].setName("SketchCircle_15_2") -SketchArc_11 = Sketch_2.addArc(-129.9193971816675, -0.0007264653618642836, -110.1251963597947, 22.43495436799721, -100.0000021084595, -1.97639539394689e-07, True) +SketchArc_11 = Sketch_2.addArc( + -129.9193971816675, + -0.0007264653618642836, + -110.1251963597947, + 22.43495436799721, + -100.0000021084595, + -1.97639539394689e-07, + True, +) SketchArc_11.setName("SketchArc_12") SketchArc_11.result().setName("SketchArc_12") SketchArc_11.results()[1].setName("SketchArc_12_2") -SketchConstraintCoincidence_47 = Sketch_2.setCoincident(SketchArc_10.endPoint(), SketchArc_11.startPoint()) -SketchConstraintTangent_11 = Sketch_2.setTangent(SketchCircle_14.results()[1], SketchArc_11.results()[1]) -SketchArc_12 = Sketch_2.addArc(-63.07696996052059, 34.31945200772628, -63.72579508004998, 37.75878764820845, -60.38663142706861, 32.0806830976656, True) +SketchConstraintCoincidence_47 = Sketch_2.setCoincident( + SketchArc_10.endPoint(), SketchArc_11.startPoint() +) +SketchConstraintTangent_11 = Sketch_2.setTangent( + SketchCircle_14.results()[1], SketchArc_11.results()[1] +) +SketchArc_12 = Sketch_2.addArc( + -63.07696996052059, + 34.31945200772628, + -63.72579508004998, + 37.75878764820845, + -60.38663142706861, + 32.0806830976656, + True, +) SketchArc_12.setName("SketchArc_13") SketchArc_12.result().setName("SketchArc_13") SketchArc_12.results()[1].setName("SketchArc_13_2") -SketchConstraintCoincidence_48 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchArc_12.startPoint()) -SketchProjection_21 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False) +SketchConstraintCoincidence_48 = Sketch_2.setCoincident( + SketchLine_20.endPoint(), SketchArc_12.startPoint() +) +SketchProjection_21 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchLine_1"), False +) SketchProjection_21.setName("SketchProjection_23") SketchProjection_21.result().setName("SketchProjection_23") SketchLine_21 = SketchProjection_21.createdFeature() SketchLine_21.setName("SketchLine_23") SketchLine_21.result().setName("SketchLine_23") -SketchProjection_22 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchCircle_6_2"), False) +SketchProjection_22 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchCircle_6_2"), False +) SketchProjection_22.setName("SketchProjection_24") SketchProjection_22.result().setName("SketchProjection_24") SketchCircle_15 = SketchProjection_22.createdFeature() SketchCircle_15.setName("SketchCircle_16") SketchCircle_15.result().setName("SketchCircle_16") SketchCircle_15.results()[1].setName("SketchCircle_16_2") -SketchArc_13 = Sketch_2.addArc(-21.7845712738051, -0.04223390990592879, -60.38663142706861, 32.0806830976656, -72.00408013001039, 1.63407197686378e-12, False) +SketchArc_13 = Sketch_2.addArc( + -21.7845712738051, + -0.04223390990592879, + -60.38663142706861, + 32.0806830976656, + -72.00408013001039, + 1.63407197686378e-12, + False, +) SketchArc_13.setName("SketchArc_14") SketchArc_13.result().setName("SketchArc_14") SketchArc_13.results()[1].setName("SketchArc_14_2") -SketchConstraintCoincidence_49 = Sketch_2.setCoincident(SketchArc_12.endPoint(), SketchArc_13.startPoint()) -SketchConstraintCoincidence_50 = Sketch_2.setCoincident(SketchLine_21.result(), SketchArc_13.endPoint()) -SketchConstraintTangent_12 = Sketch_2.setTangent(SketchCircle_15.results()[1], SketchArc_13.results()[1]) -SketchProjection_23 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_49 = Sketch_2.setCoincident( + SketchArc_12.endPoint(), SketchArc_13.startPoint() +) +SketchConstraintCoincidence_50 = Sketch_2.setCoincident( + SketchLine_21.result(), SketchArc_13.endPoint() +) +SketchConstraintTangent_12 = Sketch_2.setTangent( + SketchCircle_15.results()[1], SketchArc_13.results()[1] +) +SketchProjection_23 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchProjection_23.setName("SketchProjection_25") SketchProjection_23.result().setName("SketchProjection_25") SketchLine_22 = SketchProjection_23.createdFeature() SketchLine_22.setName("SketchLine_24") SketchLine_22.result().setName("SketchLine_24") -SketchConstraintMirror_2_objects = [SketchArc_11.results()[1], SketchArc_10.results()[1], SketchLine_20.result(), SketchArc_12.results()[1], SketchArc_13.results()[1]] -SketchConstraintMirror_2 = Sketch_2.addMirror(SketchLine_22.result(), SketchConstraintMirror_2_objects) -[SketchArc_14, SketchArc_15, SketchLine_23, SketchArc_16, SketchArc_17] = SketchConstraintMirror_2.mirrored() +SketchConstraintMirror_2_objects = [ + SketchArc_11.results()[1], + SketchArc_10.results()[1], + SketchLine_20.result(), + SketchArc_12.results()[1], + SketchArc_13.results()[1], +] +SketchConstraintMirror_2 = Sketch_2.addMirror( + SketchLine_22.result(), SketchConstraintMirror_2_objects +) +[ + SketchArc_14, + SketchArc_15, + SketchLine_23, + SketchArc_16, + SketchArc_17, +] = SketchConstraintMirror_2.mirrored() SketchArc_17.setName("SketchArc_18") SketchArc_17.result().setName("SketchArc_18") SketchArc_17.results()[1].setName("SketchArc_18_2") @@ -315,126 +711,357 @@ SketchArc_15.results()[1].setName("SketchArc_16_2") SketchArc_14.setName("SketchArc_15") SketchArc_14.result().setName("SketchArc_15") SketchArc_14.results()[1].setName("SketchArc_15_2") -SketchConstraintTangent_13 = Sketch_2.setTangent(SketchLine_20.result(), SketchArc_12.results()[1]) -SketchConstraintTangent_14 = Sketch_2.setTangent(SketchArc_12.results()[1], SketchArc_13.results()[1]) -SketchConstraintCoincidence_51 = Sketch_2.setCoincident(SketchAPI_Arc(SketchArc_17).endPoint(), SketchArc_17.results()[1]) -SketchConstraintTangent_15 = Sketch_2.setTangent(SketchLine_20.result(), SketchArc_10.results()[1]) -SketchConstraintTangent_16 = Sketch_2.setTangent(SketchArc_10.results()[1], SketchArc_11.results()[1]) -SketchConstraintCoincidence_52 = Sketch_2.setCoincident(SketchArc_10.startPoint(), SketchArc_10.results()[1]) -SketchConstraintCoincidence_53 = Sketch_2.setCoincident(SketchArc_10.results()[1], SketchArc_11.startPoint()) -SketchConstraintCoincidence_54 = Sketch_2.setCoincident(SketchLine_20.result(), SketchArc_12.startPoint()) -SketchConstraintCoincidence_55 = Sketch_2.setCoincident(SketchArc_12.results()[1], SketchArc_13.startPoint()) +SketchConstraintTangent_13 = Sketch_2.setTangent( + SketchLine_20.result(), SketchArc_12.results()[1] +) +SketchConstraintTangent_14 = Sketch_2.setTangent( + SketchArc_12.results()[1], SketchArc_13.results()[1] +) +SketchConstraintCoincidence_51 = Sketch_2.setCoincident( + SketchAPI_Arc(SketchArc_17).endPoint(), SketchArc_17.results()[1] +) +SketchConstraintTangent_15 = Sketch_2.setTangent( + SketchLine_20.result(), SketchArc_10.results()[1] +) +SketchConstraintTangent_16 = Sketch_2.setTangent( + SketchArc_10.results()[1], SketchArc_11.results()[1] +) +SketchConstraintCoincidence_52 = Sketch_2.setCoincident( + SketchArc_10.startPoint(), SketchArc_10.results()[1] +) +SketchConstraintCoincidence_53 = Sketch_2.setCoincident( + SketchArc_10.results()[1], SketchArc_11.startPoint() +) +SketchConstraintCoincidence_54 = Sketch_2.setCoincident( + SketchLine_20.result(), SketchArc_12.startPoint() +) +SketchConstraintCoincidence_55 = Sketch_2.setCoincident( + SketchArc_12.results()[1], SketchArc_13.startPoint() +) SketchConstraintRadius_11 = Sketch_2.setRadius(SketchArc_12.results()[1], 3.5) SketchConstraintRadius_12 = Sketch_2.setRadius(SketchArc_10.results()[1], 4) -SketchConstraintCoincidence_56 = Sketch_2.setCoincident(SketchArc_11.results()[1], SketchAPI_Arc(SketchArc_14).endPoint()) +SketchConstraintCoincidence_56 = Sketch_2.setCoincident( + SketchArc_11.results()[1], SketchAPI_Arc(SketchArc_14).endPoint() +) SketchConstraintLength_4 = Sketch_2.setLength(SketchLine_20.result(), 45.2793364297) -SketchConstraintCoincidence_57 = Sketch_2.setCoincident(SketchAPI_Arc(SketchArc_14).endPoint(), SketchArc_14.results()[1]) -SketchConstraintCoincidence_58 = Sketch_2.setCoincident(SketchAPI_Arc(SketchArc_17).endPoint(), SketchArc_17.results()[1]) -SketchConstraintCoincidence_59 = Sketch_2.setCoincident(SketchArc_13.startPoint(), SketchArc_12.results()[1]) -SketchConstraintCoincidence_60 = Sketch_2.setCoincident(SketchArc_12.startPoint(), SketchArc_12.results()[1]) -SketchConstraintCoincidence_61 = Sketch_2.setCoincident(SketchArc_12.results()[1], SketchArc_12.startPoint()) -SketchConstraintDistance_6 = Sketch_2.setDistance(SketchArc_11.center(), SketchArc_11.startPoint(), 29.9193944029, True) -SketchConstraintDistance_7 = Sketch_2.setDistance(SketchArc_13.startPoint(), SketchArc_11.startPoint(), 50.6652250259, True) -SketchConstraintDistance_8 = Sketch_2.setDistance(SketchArc_11.center(), SketchArc_13.startPoint(), 76.5769047851, True) -SketchConstraintCoincidence_62 = Sketch_2.setCoincident(SketchArc_11.results()[1], SketchArc_11.startPoint()) -SketchConstraintCoincidence_63 = Sketch_2.setCoincident(SketchArc_11.results()[1], SketchAPI_Arc(SketchArc_14).endPoint()) -SketchConstraintCoincidence_64 = Sketch_2.setCoincident(SketchArc_11.results()[1], SketchAPI_Arc(SketchArc_14).endPoint()) -SketchConstraintCoincidence_65 = Sketch_2.setCoincident(SketchAPI_Arc(SketchArc_14).endPoint(), SketchArc_14.results()[1]) -SketchConstraintCoincidence_66 = Sketch_2.setCoincident(SketchArc_11.results()[1], SketchAPI_Arc(SketchArc_14).endPoint()) -SketchConstraintCoincidence_67 = Sketch_2.setCoincident(SketchArc_11.endPoint(), SketchAPI_Arc(SketchArc_14).endPoint()) -SketchLine_24 = Sketch_2.addLine(-7.203775711146425, 59.55358300428642, 47.2787789287226, 98.97639550686296) +SketchConstraintCoincidence_57 = Sketch_2.setCoincident( + SketchAPI_Arc(SketchArc_14).endPoint(), SketchArc_14.results()[1] +) +SketchConstraintCoincidence_58 = Sketch_2.setCoincident( + SketchAPI_Arc(SketchArc_17).endPoint(), SketchArc_17.results()[1] +) +SketchConstraintCoincidence_59 = Sketch_2.setCoincident( + SketchArc_13.startPoint(), SketchArc_12.results()[1] +) +SketchConstraintCoincidence_60 = Sketch_2.setCoincident( + SketchArc_12.startPoint(), SketchArc_12.results()[1] +) +SketchConstraintCoincidence_61 = Sketch_2.setCoincident( + SketchArc_12.results()[1], SketchArc_12.startPoint() +) +SketchConstraintDistance_6 = Sketch_2.setDistance( + SketchArc_11.center(), SketchArc_11.startPoint(), 29.9193944029, True +) +SketchConstraintDistance_7 = Sketch_2.setDistance( + SketchArc_13.startPoint(), SketchArc_11.startPoint(), 50.6652250259, True +) +SketchConstraintDistance_8 = Sketch_2.setDistance( + SketchArc_11.center(), SketchArc_13.startPoint(), 76.5769047851, True +) +SketchConstraintCoincidence_62 = Sketch_2.setCoincident( + SketchArc_11.results()[1], SketchArc_11.startPoint() +) +SketchConstraintCoincidence_63 = Sketch_2.setCoincident( + SketchArc_11.results()[1], SketchAPI_Arc(SketchArc_14).endPoint() +) +SketchConstraintCoincidence_64 = Sketch_2.setCoincident( + SketchArc_11.results()[1], SketchAPI_Arc(SketchArc_14).endPoint() +) +SketchConstraintCoincidence_65 = Sketch_2.setCoincident( + SketchAPI_Arc(SketchArc_14).endPoint(), SketchArc_14.results()[1] +) +SketchConstraintCoincidence_66 = Sketch_2.setCoincident( + SketchArc_11.results()[1], SketchAPI_Arc(SketchArc_14).endPoint() +) +SketchConstraintCoincidence_67 = Sketch_2.setCoincident( + SketchArc_11.endPoint(), SketchAPI_Arc(SketchArc_14).endPoint() +) +SketchLine_24 = Sketch_2.addLine( + -7.203775711146425, 59.55358300428642, 47.2787789287226, 98.97639550686296 +) SketchLine_24.setName("SketchLine_26") SketchLine_24.result().setName("SketchLine_26") -SketchArc_18 = Sketch_2.addArc(50.55721779942619, 95.89389070242963, 47.2787789287226, 98.97639550686296, 55.03684890396159, 96.32156558298746, True) +SketchArc_18 = Sketch_2.addArc( + 50.55721779942619, + 95.89389070242963, + 47.2787789287226, + 98.97639550686296, + 55.03684890396159, + 96.32156558298746, + True, +) SketchArc_18.setName("SketchArc_19") SketchArc_18.result().setName("SketchArc_19") SketchArc_18.results()[1].setName("SketchArc_19_2") -SketchConstraintCoincidence_68 = Sketch_2.setCoincident(SketchLine_24.endPoint(), SketchArc_18.startPoint()) -SketchLine_25 = Sketch_2.addLine(39.0900005798679, 9.274871667252444, 80.48467495124737, 66.72930178826182) +SketchConstraintCoincidence_68 = Sketch_2.setCoincident( + SketchLine_24.endPoint(), SketchArc_18.startPoint() +) +SketchLine_25 = Sketch_2.addLine( + 39.0900005798679, 9.274871667252444, 80.48467495124737, 66.72930178826182 +) SketchLine_25.setName("SketchLine_29") SketchLine_25.result().setName("SketchLine_29") -SketchProjection_24 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_7"), False) +SketchProjection_24 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchLine_7"), False +) SketchProjection_24.setName("SketchProjection_27") SketchProjection_24.result().setName("SketchProjection_27") SketchLine_26 = SketchProjection_24.createdFeature() SketchLine_26.setName("SketchLine_30") SketchLine_26.result().setName("SketchLine_30") -SketchConstraintParallel_1 = Sketch_2.setParallel(SketchLine_25.result(), SketchLine_26.result()) +SketchConstraintParallel_1 = Sketch_2.setParallel( + SketchLine_25.result(), SketchLine_26.result() +) SketchConstraintParallel_1.setName("SketchConstraintParallel_3") -SketchArc_19 = Sketch_2.addArc(-22.21517834131148, -0.05169265751652471, -5.438628098470478, 47.2846200948962, 26.60573908050227, 11.72528265108334, True) +SketchArc_19 = Sketch_2.addArc( + -22.21517834131148, + -0.05169265751652471, + -5.438628098470478, + 47.2846200948962, + 26.60573908050227, + 11.72528265108334, + True, +) SketchArc_19.setName("SketchArc_23") SketchArc_19.result().setName("SketchArc_23") SketchArc_19.results()[1].setName("SketchArc_23_2") -SketchConstraintCoincidence_69 = Sketch_2.setCoincident(SketchCircle_15.results()[1], SketchArc_19.endPoint()) -SketchConstraintTangent_17 = Sketch_2.setTangent(SketchCircle_15.results()[1], SketchArc_19.results()[1]) +SketchConstraintCoincidence_69 = Sketch_2.setCoincident( + SketchCircle_15.results()[1], SketchArc_19.endPoint() +) +SketchConstraintTangent_17 = Sketch_2.setTangent( + SketchCircle_15.results()[1], SketchArc_19.results()[1] +) SketchConstraintTangent_17.setName("SketchConstraintTangent_20") -SketchArc_20 = Sketch_2.addArc(33.41054909313598, 13.3667937486244, 26.60573908050227, 11.72528265108334, 39.0900005798679, 9.274871667252444, False) +SketchArc_20 = Sketch_2.addArc( + 33.41054909313598, + 13.3667937486244, + 26.60573908050227, + 11.72528265108334, + 39.0900005798679, + 9.274871667252444, + False, +) SketchArc_20.setName("SketchArc_24") SketchArc_20.result().setName("SketchArc_24") SketchArc_20.results()[1].setName("SketchArc_24_2") -SketchConstraintCoincidence_70 = Sketch_2.setCoincident(SketchArc_19.endPoint(), SketchArc_20.startPoint()) -SketchConstraintCoincidence_71 = Sketch_2.setCoincident(SketchLine_25.startPoint(), SketchArc_20.endPoint()) -SketchArc_21 = Sketch_2.addArc(-3.100260658330086, 53.88250160664763, -5.438628098470478, 47.2846200948962, -7.203775711146425, 59.55358300428642, True) +SketchConstraintCoincidence_70 = Sketch_2.setCoincident( + SketchArc_19.endPoint(), SketchArc_20.startPoint() +) +SketchConstraintCoincidence_71 = Sketch_2.setCoincident( + SketchLine_25.startPoint(), SketchArc_20.endPoint() +) +SketchArc_21 = Sketch_2.addArc( + -3.100260658330086, + 53.88250160664763, + -5.438628098470478, + 47.2846200948962, + -7.203775711146425, + 59.55358300428642, + True, +) SketchArc_21.setName("SketchArc_27") SketchArc_21.result().setName("SketchArc_27") SketchArc_21.results()[1].setName("SketchArc_27_2") -SketchConstraintCoincidence_72 = Sketch_2.setCoincident(SketchArc_19.startPoint(), SketchArc_21.startPoint()) -SketchConstraintCoincidence_73 = Sketch_2.setCoincident(SketchArc_21.results()[1], SketchArc_21.endPoint()) -SketchConstraintCoincidence_74 = Sketch_2.setCoincident(SketchArc_21.results()[1], SketchArc_19.startPoint()) -SketchConstraintCoincidence_75 = Sketch_2.setCoincident(SketchArc_20.endPoint(), SketchLine_25.result()) -SketchProjection_25 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchCircle_4_2"), False) +SketchConstraintCoincidence_72 = Sketch_2.setCoincident( + SketchArc_19.startPoint(), SketchArc_21.startPoint() +) +SketchConstraintCoincidence_73 = Sketch_2.setCoincident( + SketchArc_21.results()[1], SketchArc_21.endPoint() +) +SketchConstraintCoincidence_74 = Sketch_2.setCoincident( + SketchArc_21.results()[1], SketchArc_19.startPoint() +) +SketchConstraintCoincidence_75 = Sketch_2.setCoincident( + SketchArc_20.endPoint(), SketchLine_25.result() +) +SketchProjection_25 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchCircle_4_2"), False +) SketchProjection_25.setName("SketchProjection_28") SketchProjection_25.result().setName("SketchProjection_28") SketchCircle_16 = SketchProjection_25.createdFeature() SketchCircle_16.setName("SketchCircle_17") SketchCircle_16.result().setName("SketchCircle_17") SketchCircle_16.results()[1].setName("SketchCircle_17_2") -SketchArc_22 = Sketch_2.addArc(79.92369017333566, 98.69753728269234, 55.03684890396159, 96.32156558298746, 77.30496849970196, 73.83506738671026, False) +SketchArc_22 = Sketch_2.addArc( + 79.92369017333566, + 98.69753728269234, + 55.03684890396159, + 96.32156558298746, + 77.30496849970196, + 73.83506738671026, + False, +) SketchArc_22.setName("SketchArc_22") SketchArc_22.result().setName("SketchArc_22") SketchArc_22.results()[1].setName("SketchArc_22_2") -SketchConstraintCoincidence_76 = Sketch_2.setCoincident(SketchCircle_16.results()[1], SketchArc_22.endPoint()) -SketchConstraintTangent_18 = Sketch_2.setTangent(SketchCircle_16.results()[1], SketchArc_22.results()[1]) -SketchConstraintCoincidence_77 = Sketch_2.setCoincident(SketchArc_22.startPoint(), SketchArc_18.endPoint()) -SketchConstraintCoincidence_78 = Sketch_2.setCoincident(SketchArc_22.results()[1], SketchArc_22.startPoint()) -SketchArc_23 = Sketch_2.addArc(76.83359861298372, 69.35982289158008, 77.30496849970196, 73.83506738671026, 80.48467495124737, 66.72930178826182, True) +SketchConstraintCoincidence_76 = Sketch_2.setCoincident( + SketchCircle_16.results()[1], SketchArc_22.endPoint() +) +SketchConstraintTangent_18 = Sketch_2.setTangent( + SketchCircle_16.results()[1], SketchArc_22.results()[1] +) +SketchConstraintCoincidence_77 = Sketch_2.setCoincident( + SketchArc_22.startPoint(), SketchArc_18.endPoint() +) +SketchConstraintCoincidence_78 = Sketch_2.setCoincident( + SketchArc_22.results()[1], SketchArc_22.startPoint() +) +SketchArc_23 = Sketch_2.addArc( + 76.83359861298372, + 69.35982289158008, + 77.30496849970196, + 73.83506738671026, + 80.48467495124737, + 66.72930178826182, + True, +) SketchArc_23.setName("SketchArc_25") SketchArc_23.result().setName("SketchArc_25") SketchArc_23.results()[1].setName("SketchArc_25_2") -SketchConstraintCoincidence_79 = Sketch_2.setCoincident(SketchArc_22.endPoint(), SketchArc_23.startPoint()) -SketchConstraintCoincidence_80 = Sketch_2.setCoincident(SketchLine_25.endPoint(), SketchArc_23.endPoint()) -SketchConstraintCoincidence_81 = Sketch_2.setCoincident(SketchLine_25.endPoint(), SketchLine_25.result()) -SketchConstraintCoincidence_82 = Sketch_2.setCoincident(SketchArc_18.results()[1], SketchLine_24.endPoint()) +SketchConstraintCoincidence_79 = Sketch_2.setCoincident( + SketchArc_22.endPoint(), SketchArc_23.startPoint() +) +SketchConstraintCoincidence_80 = Sketch_2.setCoincident( + SketchLine_25.endPoint(), SketchArc_23.endPoint() +) +SketchConstraintCoincidence_81 = Sketch_2.setCoincident( + SketchLine_25.endPoint(), SketchLine_25.result() +) +SketchConstraintCoincidence_82 = Sketch_2.setCoincident( + SketchArc_18.results()[1], SketchLine_24.endPoint() +) SketchConstraintRadius_13 = Sketch_2.setRadius(SketchArc_18.results()[1], 4.5) -SketchConstraintCoincidence_83 = Sketch_2.setCoincident(SketchArc_21.endPoint(), SketchLine_24.startPoint()) +SketchConstraintCoincidence_83 = Sketch_2.setCoincident( + SketchArc_21.endPoint(), SketchLine_24.startPoint() +) SketchConstraintRadius_14 = Sketch_2.setRadius(SketchArc_21.results()[1], 7) -SketchConstraintCoincidence_84 = Sketch_2.setCoincident(SketchArc_19.startPoint(), SketchArc_21.results()[1]) -SketchConstraintCoincidence_85 = Sketch_2.setCoincident(SketchArc_19.startPoint(), SketchArc_19.results()[1]) +SketchConstraintCoincidence_84 = Sketch_2.setCoincident( + SketchArc_19.startPoint(), SketchArc_21.results()[1] +) +SketchConstraintCoincidence_85 = Sketch_2.setCoincident( + SketchArc_19.startPoint(), SketchArc_19.results()[1] +) SketchConstraintRadius_15 = Sketch_2.setRadius(SketchArc_20.results()[1], 7) SketchConstraintRadius_16 = Sketch_2.setRadius(SketchArc_23.results()[1], 4.5) -SketchConstraintTangent_19 = Sketch_2.setTangent(SketchArc_18.results()[1], SketchArc_22.results()[1]) -SketchConstraintTangent_20 = Sketch_2.setTangent(SketchArc_22.results()[1], SketchArc_23.results()[1]) -SketchConstraintTangent_21 = Sketch_2.setTangent(SketchArc_23.results()[1], SketchLine_25.result()) -SketchConstraintTangent_22 = Sketch_2.setTangent(SketchLine_25.result(), SketchArc_20.results()[1]) -SketchConstraintTangent_23 = Sketch_2.setTangent(SketchArc_20.results()[1], SketchArc_19.results()[1]) -SketchConstraintTangent_24 = Sketch_2.setTangent(SketchArc_19.results()[1], SketchArc_21.results()[1]) -SketchConstraintTangent_25 = Sketch_2.setTangent(SketchArc_21.results()[1], SketchLine_24.result()) -SketchConstraintDistance_9 = Sketch_2.setDistance(SketchArc_21.center(), SketchArc_23.center(), 81.41848269099999, True) -SketchConstraintDistance_10 = Sketch_2.setDistance(SketchArc_20.center(), SketchArc_18.center(), 84.2895603895, True) -SketchConstraintDistance_11 = Sketch_2.setDistance(SketchArc_22.center(), SketchArc_22.startPoint(), 25, True) -SketchConstraintDistance_12 = Sketch_2.setDistance(SketchLine_24.endPoint(), SketchLine_25.endPoint(), 46.287215906, True) -SketchConstraintDistance_13 = Sketch_2.setDistance(SketchArc_21.endPoint(), SketchArc_20.endPoint(), 68.34517084860001, True) -SketchConstraintCoincidence_86 = Sketch_2.setCoincident(SketchArc_15.results()[1], SketchAPI_Arc(SketchArc_15).endPoint()) +SketchConstraintTangent_19 = Sketch_2.setTangent( + SketchArc_18.results()[1], SketchArc_22.results()[1] +) +SketchConstraintTangent_20 = Sketch_2.setTangent( + SketchArc_22.results()[1], SketchArc_23.results()[1] +) +SketchConstraintTangent_21 = Sketch_2.setTangent( + SketchArc_23.results()[1], SketchLine_25.result() +) +SketchConstraintTangent_22 = Sketch_2.setTangent( + SketchLine_25.result(), SketchArc_20.results()[1] +) +SketchConstraintTangent_23 = Sketch_2.setTangent( + SketchArc_20.results()[1], SketchArc_19.results()[1] +) +SketchConstraintTangent_24 = Sketch_2.setTangent( + SketchArc_19.results()[1], SketchArc_21.results()[1] +) +SketchConstraintTangent_25 = Sketch_2.setTangent( + SketchArc_21.results()[1], SketchLine_24.result() +) +SketchConstraintDistance_9 = Sketch_2.setDistance( + SketchArc_21.center(), SketchArc_23.center(), 81.41848269099999, True +) +SketchConstraintDistance_10 = Sketch_2.setDistance( + SketchArc_20.center(), SketchArc_18.center(), 84.2895603895, True +) +SketchConstraintDistance_11 = Sketch_2.setDistance( + SketchArc_22.center(), SketchArc_22.startPoint(), 25, True +) +SketchConstraintDistance_12 = Sketch_2.setDistance( + SketchLine_24.endPoint(), SketchLine_25.endPoint(), 46.287215906, True +) +SketchConstraintDistance_13 = Sketch_2.setDistance( + SketchArc_21.endPoint(), SketchArc_20.endPoint(), 68.34517084860001, True +) +SketchConstraintCoincidence_86 = Sketch_2.setCoincident( + SketchArc_15.results()[1], SketchAPI_Arc(SketchArc_15).endPoint() +) SketchConstraintRadius_17 = Sketch_2.setRadius(SketchArc_13.results()[1], 50.2195265874) SketchConstraintLength_5 = Sketch_2.setLength(SketchLine_24.result(), 67.2495866582) model.do() -Sketch_2.changeFacesOrder([[SketchArc_21.results()[1], SketchArc_19.results()[1], SketchArc_20.results()[1], SketchLine_25.result(), SketchArc_23.results()[1], SketchArc_22.results()[1], SketchArc_18.results()[1], SketchLine_24.result()], - [SketchArc_10.results()[1], SketchArc_11.results()[1], SketchArc_14.results()[1], SketchArc_15.results()[1], SketchLine_23.result(), SketchArc_16.results()[1], SketchArc_17.results()[1], SketchArc_13.results()[1], SketchArc_12.results()[1], SketchLine_20.result()] - ]) +Sketch_2.changeFacesOrder( + [ + [ + SketchArc_21.results()[1], + SketchArc_19.results()[1], + SketchArc_20.results()[1], + SketchLine_25.result(), + SketchArc_23.results()[1], + SketchArc_22.results()[1], + SketchArc_18.results()[1], + SketchLine_24.result(), + ], + [ + SketchArc_10.results()[1], + SketchArc_11.results()[1], + SketchArc_14.results()[1], + SketchArc_15.results()[1], + SketchLine_23.result(), + SketchArc_16.results()[1], + SketchArc_17.results()[1], + SketchArc_13.results()[1], + SketchArc_12.results()[1], + SketchLine_20.result(), + ], + ] +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_1_2f-SketchCircle_1_2f-SketchCircle_2_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_6_2f-SketchCircle_6_2f-SketchCircle_6_2f-SketchCircle_6_2f-SketchCircle_3_2r-SketchArc_4_2r-SketchArc_5_2r-SketchBSpline_1f-SketchArc_2_2f-SketchArc_3_2r-SketchLine_11r-SketchArc_6_2f-SketchArc_10_2r-SketchArc_9_2r-SketchArc_8_2r-SketchLine_18f-SketchArc_7_2r")], model.selection(), 41, 0) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_4f-SketchCircle_6_2r-SketchLine_28r-SketchCircle_1_2r"), model.selection("FACE", "Sketch_1/Face-SketchLine_31r-SketchCircle_6_2r-SketchCircle_6_2r-SketchLine_7r-SketchCircle_4_2r")], model.selection(), 20, 0) -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_2")], model.selection(), 50, -15) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_1_2f-SketchCircle_1_2f-SketchCircle_2_2r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchCircle_6_2f-SketchCircle_6_2f-SketchCircle_6_2f-SketchCircle_6_2f-SketchCircle_3_2r-SketchArc_4_2r-SketchArc_5_2r-SketchBSpline_1f-SketchArc_2_2f-SketchArc_3_2r-SketchLine_11r-SketchArc_6_2f-SketchArc_10_2r-SketchArc_9_2r-SketchArc_8_2r-SketchLine_18f-SketchArc_7_2r", + ), + ], + model.selection(), + 41, + 0, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchCircle_1_2r-SketchLine_4f-SketchCircle_6_2r-SketchLine_28r-SketchCircle_1_2r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_31r-SketchCircle_6_2r-SketchCircle_6_2r-SketchLine_7r-SketchCircle_4_2r", + ), + ], + model.selection(), + 20, + 0, +) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "all-in-Sketch_2")], + model.selection(), + 50, + -15, +) model.testNbResults(Extrusion_3, 2) model.testNbSubResults(Extrusion_3, [0, 0]) @@ -444,13 +1071,61 @@ model.testNbSubShapes(Extrusion_3, GeomAPI_Shape.EDGE, [48, 60]) model.testNbSubShapes(Extrusion_3, GeomAPI_Shape.VERTEX, [96, 120]) model.testResultsVolumes(Extrusion_3, [148061.943741445, 88885.950576849]) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_3_2f-SketchCircle_7_2r-SketchCircle_8_2r-SketchCircle_9_2r-SketchCircle_10_2r-SketchCircle_11_2r-SketchCircle_12_2r-SketchCircle_13_2r")], model.selection(), 36, 0) -Extrusion_5 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_4_2f-SketchCircle_4_2f-SketchCircle_4_2f-SketchCircle_5_2r")], model.selection(), 20, 0) +Extrusion_4 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchCircle_3_2f-SketchCircle_7_2r-SketchCircle_8_2r-SketchCircle_9_2r-SketchCircle_10_2r-SketchCircle_11_2r-SketchCircle_12_2r-SketchCircle_13_2r", + ) + ], + model.selection(), + 36, + 0, +) +Extrusion_5 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchCircle_4_2f-SketchCircle_4_2f-SketchCircle_4_2f-SketchCircle_5_2r", + ) + ], + model.selection(), + 20, + 0, +) Extrusion_5.result().setColor(162, 177, 85) -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = -12.5, keepSubResults = True) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1")], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=-12.5, + keepSubResults=True, +) Translation_1.result().setColor(162, 177, 85) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")], [model.selection("SOLID", "Extrusion_3_2"), model.selection("SOLID", "Extrusion_3_1")], keepSubResults = True) -Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_4_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = -10, keepSubResults = True) +Cut_1 = model.addCut( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "Extrusion_2_2"), + ], + [ + model.selection("SOLID", "Extrusion_3_2"), + model.selection("SOLID", "Extrusion_3_1"), + ], + keepSubResults=True, +) +Translation_2 = model.addTranslation( + Part_1_doc, + [ + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_4_1"), + ], + axis=model.selection("EDGE", "PartSet/OZ"), + distance=-10, + keepSubResults=True, +) Translation_2.result().setColor(162, 177, 85) Translation_2.results()[1].setColor(162, 177, 85) diff --git a/src/SketchPlugin/Test/Test19101.py b/src/SketchPlugin/Test/Test19101.py index 4dfd9a07b..0e9ae3cee 100644 --- a/src/SketchPlugin/Test/Test19101.py +++ b/src/SketchPlugin/Test/Test19101.py @@ -25,20 +25,31 @@ 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.selection("FACE", "Box_1_1/Top")) -SketchLine_1 = Sketch_1.addLine(3.455185109181585, 2.504529791754867, 6.714574768930328, 7.155950452021305) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"), True) +SketchLine_1 = Sketch_1.addLine( + 3.455185109181585, 2.504529791754867, 6.714574768930328, 7.155950452021305 +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"), True +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), True) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), True +) SketchLine_2 = SketchProjection_2.createdFeature() -SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), True) -SketchProjection_4 = Sketch_1.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), True) +SketchProjection_3 = Sketch_1.addProjection( + model.selection("EDGE", "Sketch_1/SketchLine_1"), True +) +SketchProjection_4 = Sketch_1.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), True +) model.do() model.end() from ModelAPI import * + validators = ModelAPI_Session.get().validators() -assert(validators.validate(SketchProjection_1.feature())) -assert(validators.validate(SketchProjection_2.feature())) -assert(not validators.validate(SketchProjection_3.feature())) -assert(not validators.validate(SketchProjection_4.feature())) +assert validators.validate(SketchProjection_1.feature()) +assert validators.validate(SketchProjection_2.feature()) +assert not validators.validate(SketchProjection_3.feature()) +assert not validators.validate(SketchProjection_4.feature()) diff --git a/src/SketchPlugin/Test/Test1924.py b/src/SketchPlugin/Test/Test1924.py index 1b7f767a5..f0863c2a3 100644 --- a/src/SketchPlugin/Test/Test1924.py +++ b/src/SketchPlugin/Test/Test1924.py @@ -35,7 +35,9 @@ SketchLine_2 = Sketch_1.addLine(50, 25, 170, 50) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) SketchMultiRotation_1_objects = [SketchLine_1.result(), SketchLine_2.result()] # names of rotated objects: "SketchLine_3", "SketchLine_4" -SketchMultiRotation_1 = Sketch_1.addRotation(SketchMultiRotation_1_objects, SketchPoint_1.coordinates(), 90, 2) +SketchMultiRotation_1 = Sketch_1.addRotation( + SketchMultiRotation_1_objects, SketchPoint_1.coordinates(), 90, 2 +) # line named "SketchLine_5" SketchLine_5 = Sketch_1.addLine(0, 100, 100, 100) # change number of rotated objects. @@ -44,4 +46,4 @@ SketchMultiRotation_1.numberOfObjects().setValue(3) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test1963.py b/src/SketchPlugin/Test/Test1963.py index 8a4054b74..78220ee06 100644 --- a/src/SketchPlugin/Test/Test1963.py +++ b/src/SketchPlugin/Test/Test1963.py @@ -31,72 +31,122 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(6.188, 9.263, 6.188, -3.45) SketchLine_2 = Sketch_1.addLine(6.188, -3.45, 0, -3.45) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(0, -3.45, 0, -6.45) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(0, -6.45, 10.31630157312683, -6.45) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(10.31630157312683, -6.45, 10.31630157312683, -3.45) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(10.31630157312683, -3.45, 6.538, -3.45) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_3.result()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_2.result() +) SketchLine_7 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_7.setName("SketchLine_8") SketchLine_7.result().setName("SketchLine_8") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_7.result()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_7.result() +) SketchLine_8 = Sketch_1.addLine(6.188, 9.263, 6.376, 9.263) SketchLine_8.setName("SketchLine_9") SketchLine_8.result().setName("SketchLine_9") SketchLine_8.setAuxiliary(True) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_8.startPoint() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_1.result(), 6.188) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_7.startPoint(), SketchLine_1.result(), 6.188 +) SketchLine_9 = Sketch_1.addLine(6.376, 9.263, 6.376, -2.284019283906062) SketchLine_9.setName("SketchLine_10") SketchLine_9.result().setName("SketchLine_10") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchLine_10 = Sketch_1.addLine(6.376, -2.284019283906062, 6.538, -2.359739840005481) SketchLine_10.setName("SketchLine_11") SketchLine_10.result().setName("SketchLine_11") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchLine_11 = Sketch_1.addLine(6.538, -2.359739840005481, 6.538, -3.45) SketchLine_11.setName("SketchLine_12") SketchLine_11.result().setName("SketchLine_12") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_11.endPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_11.endPoint() +) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_11.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_9.result(), 0.188) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_1.result(), SketchLine_11.endPoint(), 0.35) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_9.result(), 0.188 +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_1.result(), SketchLine_11.endPoint(), 0.35 +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 3) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_2.result(), 3.45) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_7.startPoint(), SketchLine_2.result(), 3.45 +) SketchLine_12 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_12.setName("SketchLine_13") SketchLine_12.result().setName("SketchLine_13") -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_12.result(), 9.263) -SketchLine_13 = Sketch_1.addLine(7.131011037651645, -4.08833050970321, 5.469691015801997, -4.08833050970321) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_12.result(), 9.263 +) +SketchLine_13 = Sketch_1.addLine( + 7.131011037651645, -4.08833050970321, 5.469691015801997, -4.08833050970321 +) SketchLine_13.setName("SketchLine_14") SketchLine_13.result().setName("SketchLine_14") -SketchLine_14 = Sketch_1.addLine(5.469691015801997, -4.08833050970321, 5.469691015801997, -5.799435189085778) +SketchLine_14 = Sketch_1.addLine( + 5.469691015801997, -4.08833050970321, 5.469691015801997, -5.799435189085778 +) SketchLine_14.setName("SketchLine_15") SketchLine_14.result().setName("SketchLine_15") -SketchLine_15 = Sketch_1.addLine(5.469691015801997, -5.799435189085778, 7.131011037651645, -5.799435189085778) +SketchLine_15 = Sketch_1.addLine( + 5.469691015801997, -5.799435189085778, 7.131011037651645, -5.799435189085778 +) SketchLine_15.setName("SketchLine_16") SketchLine_15.result().setName("SketchLine_16") -SketchLine_16 = Sketch_1.addLine(7.131011037651645, -5.799435189085778, 7.131011037651645, -4.08833050970321) +SketchLine_16 = Sketch_1.addLine( + 7.131011037651645, -5.799435189085778, 7.131011037651645, -4.08833050970321 +) SketchLine_16.setName("SketchLine_17") SketchLine_16.result().setName("SketchLine_17") -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()) +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_5 = Sketch_1.setHorizontal(SketchLine_13.result()) SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_14.result()) SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_15.result()) @@ -105,20 +155,30 @@ SketchLine_17 = Sketch_1.addLine(6.282, 9.263, 6.282, -4.088330509703209) SketchLine_17.setName("SketchLine_18") SketchLine_17.result().setName("SketchLine_18") SketchLine_17.setAuxiliary(True) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_17.startPoint(), SketchLine_8.result()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_13.result()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_17.startPoint(), SketchLine_8.result() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_13.result() +) SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_17.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_17.startPoint(), SketchLine_8.result()) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchLine_17.startPoint(), SketchLine_8.result() +) model.do() # check sketch is correct -assert(Sketch_1.solverError().value() == "") +assert Sketch_1.solverError().value() == "" -SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint(SketchLine_17.endPoint(), SketchLine_13.result()) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_17.endPoint(), SketchLine_5.result(), 1.5, True) +SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint( + SketchLine_17.endPoint(), SketchLine_13.result() +) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_17.endPoint(), SketchLine_5.result(), 1.5, True +) model.do() # check sketch is still correct -assert(Sketch_1.solverError().value() == "") +assert Sketch_1.solverError().value() == "" model.end() diff --git a/src/SketchPlugin/Test/Test1966.py b/src/SketchPlugin/Test/Test1966.py index aed3c15d7..7fde76272 100644 --- a/src/SketchPlugin/Test/Test1966.py +++ b/src/SketchPlugin/Test/Test1966.py @@ -29,11 +29,12 @@ import math # convenient ratio of time moving point to time creating sketch MOVE_BUILD_RATIO = 0.2 # tolerance for comparison of reals -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -#========================================================================= + +# ========================================================================= # Auxiliary functions -#========================================================================= +# ========================================================================= def angle(theStartPoint1, theEndPoint1, theStartPoint2, theEndPoint2): # subroutine to calculate angle between two lines aDirX1 = theEndPoint1.x() - theStartPoint1.x() @@ -46,11 +47,12 @@ def angle(theStartPoint1, theEndPoint1, theStartPoint2, theEndPoint2): aDot = aDirX1 * aDirX2 + aDirY1 * aDirY2 anAngle = math.acos(aDot / aLen1 / aLen2) - return round(anAngle * 180. / math.pi, 6) + return round(anAngle * 180.0 / math.pi, 6) + -#========================================================================= +# ========================================================================= # Initial model -#========================================================================= +# ========================================================================= model.begin() partSet = model.moduleDocument() @@ -64,21 +66,37 @@ sketchTime = timer() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(-6.376, 9.025, -6.376, -2.25) SketchLine_2 = Sketch_1.addLine(-6.376, -2.25, -6.538, -2.4) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(-6.538, -2.4, -6.538, -3.45) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(-6.538, -3.45, -7.782, -3.45) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(-7.782, -3.45, -7.782, -6.45) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(-7.782, -6.45, 0, -6.45) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(0, -6.45, 0, -3.45) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(0, -3.45, -6.188, -3.45) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(-6.188, -3.45, -6.188, 9.025) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_3.result()) @@ -87,200 +105,454 @@ SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_8.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_4.result()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_4.result() +) SketchLine_10 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OZ")) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchLine_10.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_8.startPoint(), SketchLine_10.result() +) SketchLine_11 = Sketch_1.addLine(-6.376, 9.025, -6.538, 9.187) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_11.startPoint() +) SketchLine_12 = Sketch_1.addLine(-6.538, 9.187, -6.538, 10.256) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchLine_13 = Sketch_1.addLine(-6.538, 10.256, -6.188, 10.256) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchLine_14 = Sketch_1.addLine(-6.188, 9.025, -6.084266646261868, 9.523738867722166) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_13.result()) SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_12.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), 3) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_9.result(), "ep_jupe") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_4.startPoint(), SketchLine_9.result(), 0.35) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_10.result(), 6.188) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_2.startPoint(), SketchLine_9.result(), "ep_jupe" +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_4.startPoint(), SketchLine_9.result(), 0.35 +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_10.result(), 6.188 +) SketchLine_15 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_15.result(), 9.025) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_15.result(), 9.025 +) SketchLine_16 = Sketch_1.addLine(-6.376, 9.025, -6.188, 9.025) SketchLine_16.setAuxiliary(True) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_16.endPoint()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_14.startPoint(), SketchLine_16.endPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_16.endPoint() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_14.startPoint(), SketchLine_16.endPoint() +) SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_16.result()) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_15.result(), 2.25) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_3.startPoint(), SketchLine_15.result(), 2.4) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_4.startPoint(), SketchLine_15.result(), 3.45) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_2.startPoint(), SketchLine_15.result(), 2.25 +) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_3.startPoint(), SketchLine_15.result(), 2.4 +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchLine_4.startPoint(), SketchLine_15.result(), 3.45 +) SketchLine_17 = Sketch_1.addLine(-6.282, 9.025, -6.282, -4.050005366189866) SketchLine_17.setAuxiliary(True) SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_17.result()) SketchPoint_1 = Sketch_1.addPoint(-6.282, 9.025) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_17.startPoint(), SketchPoint_1.coordinates()) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_16.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchPoint_1.coordinates(), SketchLine_16.result()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_17.startPoint(), SketchPoint_1.coordinates() +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_16.result() +) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchPoint_1.coordinates(), SketchLine_16.result() +) SketchLine_18 = Sketch_1.addLine(-5.532, -4.050005366189866, -7.032, -4.050005366189866) SketchLine_19 = Sketch_1.addLine(-7.032, -4.050005366189866, -7.032, -5.850005366189865) SketchLine_20 = Sketch_1.addLine(-7.032, -5.850005366189865, -5.532, -5.850005366189865) SketchLine_21 = Sketch_1.addLine(-5.532, -5.850005366189865, -5.532, -4.050005366189866) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchLine_18.startPoint()) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchLine_18.startPoint() +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.startPoint() +) SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_18.result()) SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_19.result()) SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_20.result()) SketchConstraintVertical_9 = Sketch_1.setVertical(SketchLine_21.result()) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_20.result(), 1.5) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_19.result(), 1.8) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_18.result()) -SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint(SketchLine_18.result(), SketchLine_17.endPoint()) -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_17.endPoint(), SketchLine_5.result(), 1.5) -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_11.endPoint(), SketchLine_17.result(), 0.256) -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchLine_11.endPoint(), SketchLine_15.result(), 9.187) -SketchConstraintDistance_11 = Sketch_1.setDistance(SketchLine_12.endPoint(), SketchLine_15.result(), 10.256) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.result() +) +SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint( + SketchLine_18.result(), SketchLine_17.endPoint() +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchLine_17.endPoint(), SketchLine_5.result(), 1.5 +) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_11.endPoint(), SketchLine_17.result(), 0.256 +) +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchLine_11.endPoint(), SketchLine_15.result(), 9.187 +) +SketchConstraintDistance_11 = Sketch_1.setDistance( + SketchLine_12.endPoint(), SketchLine_15.result(), 10.256 +) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_13.result(), 0.35) SketchLine_22 = Sketch_1.addLine(-6.188, 10.256, -4.938, 10.97786688777511) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_22.startPoint()) -SketchArc_1 = Sketch_1.addArc(-4.794548536090929, 9.26204592494933, -6.084266646261868, 9.523738867722166, -5.676829966640709, 10.23848613167324, True) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchArc_1.startPoint()) -SketchLine_23 = Sketch_1.addLine(-5.676829966640709, 10.23848613167324, -4.794548536090929, 9.26204592494933) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_22.startPoint() +) +SketchArc_1 = Sketch_1.addArc( + -4.794548536090929, + 9.26204592494933, + -6.084266646261868, + 9.523738867722166, + -5.676829966640709, + 10.23848613167324, + True, +) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchArc_1.startPoint() +) +SketchLine_23 = Sketch_1.addLine( + -5.676829966640709, 10.23848613167324, -4.794548536090929, 9.26204592494933 +) SketchLine_23.setAuxiliary(True) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_23.startPoint()) -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchArc_1.center()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_23.startPoint() +) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchLine_23.endPoint(), SketchArc_1.center() +) SketchArc_2 = Sketch_1.addArc(0, 2.425, -4.938, 10.97786688777511, 0, 12.301, True) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_10.result()) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_10.result()) -SketchConstraintDistance_12 = Sketch_1.setDistance(SketchArc_2.center(), SketchLine_15.result(), 2.425) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_10.result() +) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchLine_22.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_10.result() +) +SketchConstraintDistance_12 = Sketch_1.setDistance( + SketchArc_2.center(), SketchLine_15.result(), 2.425 +) SketchLine_24 = Sketch_1.addLine(0, 12.301, 0, 12.137) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_24.startPoint()) -SketchArc_3 = Sketch_1.addArc(0, 2.425, -5.877900790328188, 10.25907418263698, 2.067397663006541, 11.99831201324782, True) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_24.startPoint() +) +SketchArc_3 = Sketch_1.addArc( + 0, + 2.425, + -5.877900790328188, + 10.25907418263698, + 2.067397663006541, + 11.99831201324782, + True, +) SketchArc_3.setName("SketchArc_4") SketchArc_3.result().setName("SketchArc_4") SketchArc_3.results()[1].setName("SketchArc_4_2") SketchArc_3.setAuxiliary(True) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchArc_2.center(), SketchArc_3.center()) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchArc_3.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_3.results()[1], 9.794) SketchPoint_2 = Sketch_1.addPoint(0, 12.219) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_24.result()) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchArc_3.results()[1]) -SketchConstraintMiddle_3 = Sketch_1.setMiddlePoint(SketchPoint_2.coordinates(), SketchLine_24.result()) -SketchLine_25 = Sketch_1.addLine(-5.676829966640709, 10.23848613167324, -5.417460848824602, 10.45671600291324) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_25.startPoint()) -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchLine_23.startPoint(), SketchLine_25.startPoint()) -SketchLine_26 = Sketch_1.addLine(-5.417460848824602, 10.45671600291324, -5.143396378647499, 10.65615482129426) -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_26.startPoint()) -SketchLine_27 = Sketch_1.addLine(-5.143396378647499, 10.65615482129426, -4.856000000000008, 10.83583872155447) -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchLine_26.endPoint(), SketchLine_27.startPoint()) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_24.result() +) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchArc_3.results()[1] +) +SketchConstraintMiddle_3 = Sketch_1.setMiddlePoint( + SketchPoint_2.coordinates(), SketchLine_24.result() +) +SketchLine_25 = Sketch_1.addLine( + -5.676829966640709, 10.23848613167324, -5.417460848824602, 10.45671600291324 +) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_25.startPoint() +) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchLine_23.startPoint(), SketchLine_25.startPoint() +) +SketchLine_26 = Sketch_1.addLine( + -5.417460848824602, 10.45671600291324, -5.143396378647499, 10.65615482129426 +) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchLine_25.endPoint(), SketchLine_26.startPoint() +) +SketchLine_27 = Sketch_1.addLine( + -5.143396378647499, 10.65615482129426, -4.856000000000008, 10.83583872155447 +) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchLine_26.endPoint(), SketchLine_27.startPoint() +) SketchArc_4 = Sketch_1.addArc(0, 2.425, -4.856, 10.83583872155447, 0, 12.137, True) SketchArc_4.setName("SketchArc_5") SketchArc_4.result().setName("SketchArc_5") SketchArc_4.results()[1].setName("SketchArc_5_2") -SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchArc_2.center(), SketchArc_4.center()) -SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchArc_3.center(), SketchArc_4.center()) -SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchLine_27.endPoint(), SketchArc_4.startPoint()) -SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchArc_4.endPoint()) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchArc_4.center() +) +SketchConstraintCoincidence_42 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchArc_4.center() +) +SketchConstraintCoincidence_43 = Sketch_1.setCoincident( + SketchLine_27.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintCoincidence_44 = Sketch_1.setCoincident( + SketchLine_24.endPoint(), SketchArc_4.endPoint() +) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_24.result(), "0.082*2") SketchLine_28 = Sketch_1.addLine(-4.938, 10.97786688777511, 0, 2.425) SketchLine_28.setAuxiliary(True) -SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchLine_28.startPoint()) -SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_28.startPoint()) -SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_28.endPoint()) -SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_28.endPoint()) -SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchArc_4.center(), SketchLine_28.endPoint()) -SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchLine_28.result(), SketchLine_27.endPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngleBackward(SketchLine_28.result(), SketchLine_10.result(), 30) +SketchConstraintCoincidence_45 = Sketch_1.setCoincident( + SketchLine_22.endPoint(), SketchLine_28.startPoint() +) +SketchConstraintCoincidence_46 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_28.startPoint() +) +SketchConstraintCoincidence_47 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_28.endPoint() +) +SketchConstraintCoincidence_48 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_28.endPoint() +) +SketchConstraintCoincidence_49 = Sketch_1.setCoincident( + SketchArc_4.center(), SketchLine_28.endPoint() +) +SketchConstraintCoincidence_50 = Sketch_1.setCoincident( + SketchLine_28.result(), SketchLine_27.endPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngleBackward( + SketchLine_28.result(), SketchLine_10.result(), 30 +) SketchLine_29 = Sketch_1.addLine(-5.143396378647499, 10.65615482129426, 0, 2.425) SketchLine_29.setAuxiliary(True) -SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_29.endPoint()) -SketchConstraintCoincidence_52 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_29.endPoint()) -SketchConstraintCoincidence_53 = Sketch_1.setCoincident(SketchArc_4.center(), SketchLine_29.endPoint()) -SketchConstraintCoincidence_54 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchLine_29.endPoint()) -SketchConstraintCoincidence_55 = Sketch_1.setCoincident(SketchLine_26.endPoint(), SketchLine_29.startPoint()) -SketchConstraintAngle_2 = Sketch_1.setAngleBackward(SketchLine_29.result(), SketchLine_10.result(), 32) +SketchConstraintCoincidence_51 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_29.endPoint() +) +SketchConstraintCoincidence_52 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_29.endPoint() +) +SketchConstraintCoincidence_53 = Sketch_1.setCoincident( + SketchArc_4.center(), SketchLine_29.endPoint() +) +SketchConstraintCoincidence_54 = Sketch_1.setCoincident( + SketchLine_28.endPoint(), SketchLine_29.endPoint() +) +SketchConstraintCoincidence_55 = Sketch_1.setCoincident( + SketchLine_26.endPoint(), SketchLine_29.startPoint() +) +SketchConstraintAngle_2 = Sketch_1.setAngleBackward( + SketchLine_29.result(), SketchLine_10.result(), 32 +) SketchLine_30 = Sketch_1.addLine(-5.417460848824602, 10.45671600291324, 0, 2.425) SketchLine_30.setAuxiliary(True) -SketchConstraintCoincidence_56 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_30.endPoint()) -SketchConstraintCoincidence_57 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_30.endPoint()) -SketchConstraintCoincidence_58 = Sketch_1.setCoincident(SketchArc_4.center(), SketchLine_30.endPoint()) -SketchConstraintCoincidence_59 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchLine_30.endPoint()) -SketchConstraintCoincidence_60 = Sketch_1.setCoincident(SketchLine_29.endPoint(), SketchLine_30.endPoint()) -SketchConstraintCoincidence_61 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_30.startPoint()) -SketchConstraintAngle_3 = Sketch_1.setAngleBackward(SketchLine_30.result(), SketchLine_10.result(), 34) +SketchConstraintCoincidence_56 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_30.endPoint() +) +SketchConstraintCoincidence_57 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_30.endPoint() +) +SketchConstraintCoincidence_58 = Sketch_1.setCoincident( + SketchArc_4.center(), SketchLine_30.endPoint() +) +SketchConstraintCoincidence_59 = Sketch_1.setCoincident( + SketchLine_28.endPoint(), SketchLine_30.endPoint() +) +SketchConstraintCoincidence_60 = Sketch_1.setCoincident( + SketchLine_29.endPoint(), SketchLine_30.endPoint() +) +SketchConstraintCoincidence_61 = Sketch_1.setCoincident( + SketchLine_25.endPoint(), SketchLine_30.startPoint() +) +SketchConstraintAngle_3 = Sketch_1.setAngleBackward( + SketchLine_30.result(), SketchLine_10.result(), 34 +) SketchLine_31 = Sketch_1.addLine(0, 2.425, -5.676829966640709, 10.23848613167324) SketchLine_31.setName("SketchLine_35") SketchLine_31.result().setName("SketchLine_35") SketchLine_31.setAuxiliary(True) -SketchConstraintCoincidence_62 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_31.startPoint()) -SketchConstraintCoincidence_63 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_31.startPoint()) -SketchConstraintCoincidence_64 = Sketch_1.setCoincident(SketchArc_4.center(), SketchLine_31.startPoint()) -SketchConstraintCoincidence_65 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchLine_31.startPoint()) -SketchConstraintCoincidence_66 = Sketch_1.setCoincident(SketchLine_29.endPoint(), SketchLine_31.startPoint()) -SketchConstraintCoincidence_67 = Sketch_1.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) -SketchConstraintCoincidence_68 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_31.endPoint()) -SketchConstraintAngle_4 = Sketch_1.setAngleBackward(SketchLine_31.result(), SketchLine_10.result(), 36) +SketchConstraintCoincidence_62 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_31.startPoint() +) +SketchConstraintCoincidence_63 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_31.startPoint() +) +SketchConstraintCoincidence_64 = Sketch_1.setCoincident( + SketchArc_4.center(), SketchLine_31.startPoint() +) +SketchConstraintCoincidence_65 = Sketch_1.setCoincident( + SketchLine_28.endPoint(), SketchLine_31.startPoint() +) +SketchConstraintCoincidence_66 = Sketch_1.setCoincident( + SketchLine_29.endPoint(), SketchLine_31.startPoint() +) +SketchConstraintCoincidence_67 = Sketch_1.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) +SketchConstraintCoincidence_68 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_31.endPoint() +) +SketchConstraintAngle_4 = Sketch_1.setAngleBackward( + SketchLine_31.result(), SketchLine_10.result(), 36 +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_1.results()[1], 1.316) -SketchLine_32 = Sketch_1.addLine(-4.794548536090929, 9.26204592494933, -4.794548536090929, 9.764655753971969) +SketchLine_32 = Sketch_1.addLine( + -4.794548536090929, 9.26204592494933, -4.794548536090929, 9.764655753971969 +) SketchLine_32.setName("SketchLine_38") SketchLine_32.result().setName("SketchLine_38") SketchLine_32.setAuxiliary(True) -SketchConstraintCoincidence_69 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_32.startPoint()) -SketchConstraintCoincidence_70 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_69 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_32.startPoint() +) +SketchConstraintCoincidence_70 = Sketch_1.setCoincident( + SketchLine_23.endPoint(), SketchLine_32.startPoint() +) SketchConstraintVertical_10 = Sketch_1.setVertical(SketchLine_32.result()) -SketchConstraintAngle_5 = Sketch_1.setAngleBackward(SketchLine_23.result(), SketchLine_32.result(), 42.1) -SketchLine_33 = Sketch_1.addLine(-4.794548536090929, 9.26204592494933, -5.10267883886141, 9.26204592494933) +SketchConstraintAngle_5 = Sketch_1.setAngleBackward( + SketchLine_23.result(), SketchLine_32.result(), 42.1 +) +SketchLine_33 = Sketch_1.addLine( + -4.794548536090929, 9.26204592494933, -5.10267883886141, 9.26204592494933 +) SketchLine_33.setName("SketchLine_39") SketchLine_33.result().setName("SketchLine_39") SketchLine_33.setAuxiliary(True) -SketchConstraintCoincidence_71 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_33.startPoint()) -SketchConstraintCoincidence_72 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_33.startPoint()) -SketchConstraintCoincidence_73 = Sketch_1.setCoincident(SketchLine_32.startPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_71 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_33.startPoint() +) +SketchConstraintCoincidence_72 = Sketch_1.setCoincident( + SketchLine_23.endPoint(), SketchLine_33.startPoint() +) +SketchConstraintCoincidence_73 = Sketch_1.setCoincident( + SketchLine_32.startPoint(), SketchLine_33.startPoint() +) SketchConstraintHorizontal_8 = Sketch_1.setHorizontal(SketchLine_33.result()) -SketchLine_34 = Sketch_1.addLine(-6.084266646261868, 9.523738867722166, -4.794548536090929, 9.26204592494933) +SketchLine_34 = Sketch_1.addLine( + -6.084266646261868, 9.523738867722166, -4.794548536090929, 9.26204592494933 +) SketchLine_34.setName("SketchLine_40") SketchLine_34.result().setName("SketchLine_40") SketchLine_34.setAuxiliary(True) -SketchConstraintCoincidence_74 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_34.startPoint()) -SketchConstraintCoincidence_75 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_34.startPoint()) -SketchConstraintCoincidence_76 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_34.endPoint()) -SketchConstraintCoincidence_77 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_34.endPoint()) -SketchConstraintCoincidence_78 = Sketch_1.setCoincident(SketchLine_32.startPoint(), SketchLine_34.endPoint()) -SketchConstraintCoincidence_79 = Sketch_1.setCoincident(SketchLine_33.startPoint(), SketchLine_34.endPoint()) -SketchConstraintCoincidence_80 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_10.result()) -SketchConstraintAngle_6 = Sketch_1.setAngleBackward(SketchLine_33.result(), SketchLine_34.result(), 11.47) -SketchLine_35 = Sketch_1.addLine(-5.676829966640709, 10.23848613167324, -5.756768760952487, 10.34851244290823) +SketchConstraintCoincidence_74 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchLine_34.startPoint() +) +SketchConstraintCoincidence_75 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_34.startPoint() +) +SketchConstraintCoincidence_76 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_34.endPoint() +) +SketchConstraintCoincidence_77 = Sketch_1.setCoincident( + SketchLine_23.endPoint(), SketchLine_34.endPoint() +) +SketchConstraintCoincidence_78 = Sketch_1.setCoincident( + SketchLine_32.startPoint(), SketchLine_34.endPoint() +) +SketchConstraintCoincidence_79 = Sketch_1.setCoincident( + SketchLine_33.startPoint(), SketchLine_34.endPoint() +) +SketchConstraintCoincidence_80 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_10.result() +) +SketchConstraintAngle_6 = Sketch_1.setAngleBackward( + SketchLine_33.result(), SketchLine_34.result(), 11.47 +) +SketchLine_35 = Sketch_1.addLine( + -5.676829966640709, 10.23848613167324, -5.756768760952487, 10.34851244290823 +) SketchLine_35.setName("SketchLine_36") SketchLine_35.result().setName("SketchLine_36") SketchLine_35.setAuxiliary(True) -SketchConstraintCoincidence_81 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_35.startPoint()) -SketchConstraintCoincidence_82 = Sketch_1.setCoincident(SketchLine_23.startPoint(), SketchLine_35.startPoint()) -SketchConstraintCoincidence_83 = Sketch_1.setCoincident(SketchLine_25.startPoint(), SketchLine_35.startPoint()) -SketchConstraintCoincidence_84 = Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchLine_35.startPoint()) -SketchConstraintCoincidence_85 = Sketch_1.setCoincident(SketchLine_35.endPoint(), SketchArc_3.results()[1]) -SketchLine_36 = Sketch_1.addLine(-5.417460848824602, 10.45671600291324, -5.476735296592498, 10.54459398560407) +SketchConstraintCoincidence_81 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_35.startPoint() +) +SketchConstraintCoincidence_82 = Sketch_1.setCoincident( + SketchLine_23.startPoint(), SketchLine_35.startPoint() +) +SketchConstraintCoincidence_83 = Sketch_1.setCoincident( + SketchLine_25.startPoint(), SketchLine_35.startPoint() +) +SketchConstraintCoincidence_84 = Sketch_1.setCoincident( + SketchLine_31.endPoint(), SketchLine_35.startPoint() +) +SketchConstraintCoincidence_85 = Sketch_1.setCoincident( + SketchLine_35.endPoint(), SketchArc_3.results()[1] +) +SketchLine_36 = Sketch_1.addLine( + -5.417460848824602, 10.45671600291324, -5.476735296592498, 10.54459398560407 +) SketchLine_36.setName("SketchLine_37") SketchLine_36.result().setName("SketchLine_37") SketchLine_36.setAuxiliary(True) -SketchConstraintCoincidence_86 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_36.startPoint()) -SketchConstraintCoincidence_87 = Sketch_1.setCoincident(SketchLine_26.startPoint(), SketchLine_36.startPoint()) -SketchConstraintCoincidence_88 = Sketch_1.setCoincident(SketchLine_30.startPoint(), SketchLine_36.startPoint()) -SketchConstraintCoincidence_89 = Sketch_1.setCoincident(SketchLine_36.endPoint(), SketchArc_3.results()[1]) -SketchLine_37 = Sketch_1.addLine(-5.143396378647499, 10.65615482129426, -5.190029273900022, 10.73078305375603) +SketchConstraintCoincidence_86 = Sketch_1.setCoincident( + SketchLine_25.endPoint(), SketchLine_36.startPoint() +) +SketchConstraintCoincidence_87 = Sketch_1.setCoincident( + SketchLine_26.startPoint(), SketchLine_36.startPoint() +) +SketchConstraintCoincidence_88 = Sketch_1.setCoincident( + SketchLine_30.startPoint(), SketchLine_36.startPoint() +) +SketchConstraintCoincidence_89 = Sketch_1.setCoincident( + SketchLine_36.endPoint(), SketchArc_3.results()[1] +) +SketchLine_37 = Sketch_1.addLine( + -5.143396378647499, 10.65615482129426, -5.190029273900022, 10.73078305375603 +) SketchLine_37.setName("SketchLine_41") SketchLine_37.result().setName("SketchLine_41") SketchLine_37.setAuxiliary(True) -SketchConstraintCoincidence_90 = Sketch_1.setCoincident(SketchLine_26.endPoint(), SketchLine_37.startPoint()) -SketchConstraintCoincidence_91 = Sketch_1.setCoincident(SketchLine_27.startPoint(), SketchLine_37.startPoint()) -SketchConstraintCoincidence_92 = Sketch_1.setCoincident(SketchLine_29.startPoint(), SketchLine_37.startPoint()) -SketchConstraintCoincidence_93 = Sketch_1.setCoincident(SketchLine_37.endPoint(), SketchArc_3.results()[1]) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_35.result(), SketchLine_31.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_36.result(), SketchLine_30.result()) -SketchConstraintParallel_3 = Sketch_1.setParallel(SketchLine_37.result(), SketchLine_29.result()) +SketchConstraintCoincidence_90 = Sketch_1.setCoincident( + SketchLine_26.endPoint(), SketchLine_37.startPoint() +) +SketchConstraintCoincidence_91 = Sketch_1.setCoincident( + SketchLine_27.startPoint(), SketchLine_37.startPoint() +) +SketchConstraintCoincidence_92 = Sketch_1.setCoincident( + SketchLine_29.startPoint(), SketchLine_37.startPoint() +) +SketchConstraintCoincidence_93 = Sketch_1.setCoincident( + SketchLine_37.endPoint(), SketchArc_3.results()[1] +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_35.result(), SketchLine_31.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_36.result(), SketchLine_30.result() +) +SketchConstraintParallel_3 = Sketch_1.setParallel( + SketchLine_37.result(), SketchLine_29.result() +) SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_35.result(), 0.136) SketchConstraintLength_7 = Sketch_1.setLength(SketchLine_36.result(), 0.106) SketchConstraintLength_8 = Sketch_1.setLength(SketchLine_37.result(), 0.088) @@ -292,30 +564,44 @@ expectedTime = MOVE_BUILD_RATIO * sketchTime averageTime = 0 nbMoves = 0 -#========================================================================= +# ========================================================================= # Move point under the Middle point constraint and check execution time. # This point is fully constrained, so its coordinates should not be changed. -#========================================================================= +# ========================================================================= aPoint = SketchPoint_1.coordinates() X = aPoint.x() Y = aPoint.y() -deltas = [(0.0, 0.1), (0.1, 0.0), (-0.1, 0.1), (1.0, 0.0), (0.0, -1.0), (-0.5, -0.2), (-0.3, 0.3)] +deltas = [ + (0.0, 0.1), + (0.1, 0.0), + (-0.1, 0.1), + (1.0, 0.0), + (0.0, -1.0), + (-0.5, -0.2), + (-0.3, 0.3), +] for deltaX, deltaY in deltas: movementTime = timer() aPoint.setValue(X, Y + 0.1) model.do() movementTime = timer() - movementTime - assert movementTime < expectedTime, "Time to move point {0} is greater than expected {1}".format(movementTime, expectedTime) - assert math.fabs(aPoint.x() - X) < TOLERANCE and math.fabs(aPoint.y() - Y) < TOLERANCE, "({0}, {1}) != ({2}, {3})".format(aPoint.x(), aPoint.y(), X, Y) + assert ( + movementTime < expectedTime + ), "Time to move point {0} is greater than expected {1}".format( + movementTime, expectedTime + ) + assert ( + math.fabs(aPoint.x() - X) < TOLERANCE and math.fabs(aPoint.y() - Y) < TOLERANCE + ), "({0}, {1}) != ({2}, {3})".format(aPoint.x(), aPoint.y(), X, Y) averageTime += movementTime nbMoves += 1 print("Movement average time: {0}".format(averageTime / nbMoves)) -#========================================================================= +# ========================================================================= # Change value of SketchConstraintAngle_6 and check execution time. # Check constrained objects are satisfy this constraint. # Check the middle point stays on its place. -#========================================================================= +# ========================================================================= averageTime = 0 nbMoves = 0 for ang in range(12, 30): @@ -323,9 +609,20 @@ for ang in range(12, 30): SketchConstraintAngle_6.feature().real("AngleValue").setValue(ang) model.do() movementTime = timer() - movementTime - assert movementTime < expectedTime, "Time to change angle {0} is greater than expected {1}".format(movementTime, expectedTime) - curAngle = angle(SketchLine_33.startPoint(), SketchLine_33.endPoint(), SketchLine_34.endPoint(), SketchLine_34.startPoint()) - assert math.fabs(curAngle - ang) < TOLERANCE, "angle {0} != {1} expected".format(curAngle, ang) + assert ( + movementTime < expectedTime + ), "Time to change angle {0} is greater than expected {1}".format( + movementTime, expectedTime + ) + curAngle = angle( + SketchLine_33.startPoint(), + SketchLine_33.endPoint(), + SketchLine_34.endPoint(), + SketchLine_34.startPoint(), + ) + assert math.fabs(curAngle - ang) < TOLERANCE, "angle {0} != {1} expected".format( + curAngle, ang + ) averageTime += movementTime nbMoves += 1 print("Changing angle average time: {0}".format(averageTime / nbMoves)) @@ -333,4 +630,4 @@ print("Changing angle average time: {0}".format(averageTime / nbMoves)) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test1967.py b/src/SketchPlugin/Test/Test1967.py index a59dfbbb4..ab2ccd4ea 100644 --- a/src/SketchPlugin/Test/Test1967.py +++ b/src/SketchPlugin/Test/Test1967.py @@ -29,7 +29,7 @@ import math # convenient ratio of time moving point to time creating sketch MOVE_BUILD_RATIO = 0.1 # tolerance for comparison of reals -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 model.begin() partSet = model.moduleDocument() @@ -43,21 +43,37 @@ sketchTime = timer() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(-6.376, 9.025, -6.376, -2.25) SketchLine_2 = Sketch_1.addLine(-6.376, -2.25, -6.538, -2.4) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(-6.538, -2.4, -6.538, -3.45) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(-6.538, -3.45, -7.782, -3.45) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(-7.782, -3.45, -7.782, -6.45) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(-7.782, -6.45, 0, -6.45) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(0, -6.45, 0, -3.45) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(0, -3.45, -6.188, -3.45) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(-6.188, -3.45, -6.188, 9.025) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_3.result()) @@ -66,35 +82,69 @@ SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_8.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_4.result()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_4.result() +) SketchLine_10 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OZ")) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchLine_10.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_8.startPoint(), SketchLine_10.result() +) SketchLine_11 = Sketch_1.addLine(-6.376, 9.025, -6.538, 9.187) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_11.startPoint() +) SketchLine_12 = Sketch_1.addLine(-6.538, 9.187, -6.538, 10.256) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchLine_13 = Sketch_1.addLine(-6.538, 10.256, -6.188, 10.256) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchLine_14 = Sketch_1.addLine(-6.188, 9.025, -6.084266646261862, 9.523738867722171) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_13.result()) SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_12.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), 3) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_9.result(), "ep_jupe") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_4.startPoint(), SketchLine_9.result(), 0.35) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_10.result(), 6.188) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_2.startPoint(), SketchLine_9.result(), "ep_jupe" +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_4.startPoint(), SketchLine_9.result(), 0.35 +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_10.result(), 6.188 +) SketchLine_15 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_15.result(), 9.025) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_15.result(), 9.025 +) SketchLine_16 = Sketch_1.addLine(-6.376, 9.025, -6.188, 9.025) SketchLine_16.setAuxiliary(True) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_16.endPoint()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_14.startPoint(), SketchLine_16.endPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_16.endPoint() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_14.startPoint(), SketchLine_16.endPoint() +) SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_16.result()) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_15.result(), 2.25) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_3.startPoint(), SketchLine_15.result(), 2.4) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_4.startPoint(), SketchLine_15.result(), 3.45) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_2.startPoint(), SketchLine_15.result(), 2.25 +) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_3.startPoint(), SketchLine_15.result(), 2.4 +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchLine_4.startPoint(), SketchLine_15.result(), 3.45 +) SketchLine_17 = Sketch_1.addLine(-6.282, 9.025, -6.282, -4.050005366189865) SketchLine_17.setAuxiliary(True) SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_17.result()) @@ -102,167 +152,385 @@ SketchLine_18 = Sketch_1.addLine(-5.532, -4.050005366189866, -7.032, -4.05000536 SketchLine_19 = Sketch_1.addLine(-7.032, -4.050005366189866, -7.032, -5.850005366189865) SketchLine_20 = Sketch_1.addLine(-7.032, -5.850005366189865, -5.532, -5.850005366189865) SketchLine_21 = Sketch_1.addLine(-5.532, -5.850005366189865, -5.532, -4.050005366189866) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchLine_18.startPoint()) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchLine_18.startPoint() +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.startPoint() +) SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_18.result()) SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_19.result()) SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_20.result()) SketchConstraintVertical_9 = Sketch_1.setVertical(SketchLine_21.result()) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_20.result(), 1.5) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_19.result(), 1.8) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_18.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_18.result(), SketchLine_17.endPoint()) -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_17.endPoint(), SketchLine_5.result(), 1.5) -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_11.endPoint(), SketchLine_17.result(), 0.256) -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchLine_11.endPoint(), SketchLine_15.result(), 9.187) -SketchConstraintDistance_11 = Sketch_1.setDistance(SketchLine_12.endPoint(), SketchLine_15.result(), 10.256) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.result() +) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchLine_18.result(), SketchLine_17.endPoint() +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchLine_17.endPoint(), SketchLine_5.result(), 1.5 +) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_11.endPoint(), SketchLine_17.result(), 0.256 +) +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchLine_11.endPoint(), SketchLine_15.result(), 9.187 +) +SketchConstraintDistance_11 = Sketch_1.setDistance( + SketchLine_12.endPoint(), SketchLine_15.result(), 10.256 +) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_13.result(), 0.35) SketchLine_22 = Sketch_1.addLine(-6.188, 10.256, -4.938, 10.97786688777511) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_22.startPoint()) -SketchArc_1 = Sketch_1.addArc(-4.794548536090929, 9.26204592494933, -6.084266646261862, 9.523738867722171, -5.676829966640709, 10.23848613167324, True) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchArc_1.startPoint()) -SketchLine_23 = Sketch_1.addLine(-5.676829966640709, 10.23848613167324, -4.794548536090929, 9.26204592494933) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_22.startPoint() +) +SketchArc_1 = Sketch_1.addArc( + -4.794548536090929, + 9.26204592494933, + -6.084266646261862, + 9.523738867722171, + -5.676829966640709, + 10.23848613167324, + True, +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchArc_1.startPoint() +) +SketchLine_23 = Sketch_1.addLine( + -5.676829966640709, 10.23848613167324, -4.794548536090929, 9.26204592494933 +) SketchLine_23.setAuxiliary(True) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_23.startPoint()) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchArc_1.center()) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_23.startPoint() +) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_23.endPoint(), SketchArc_1.center() +) SketchArc_2 = Sketch_1.addArc(0, 2.425, -4.938, 10.97786688777511, 0, 12.301, True) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_10.result()) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_10.result()) -SketchConstraintDistance_12 = Sketch_1.setDistance(SketchArc_2.center(), SketchLine_15.result(), 2.425) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_10.result() +) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_22.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_10.result() +) +SketchConstraintDistance_12 = Sketch_1.setDistance( + SketchArc_2.center(), SketchLine_15.result(), 2.425 +) SketchLine_24 = Sketch_1.addLine(0, 12.301, 0, 12.137) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_24.startPoint()) -SketchArc_3 = Sketch_1.addArc(0, 2.425, -5.877900790328188, 10.25907418263698, 2.067397663006541, 11.99831201324782, True) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_24.startPoint() +) +SketchArc_3 = Sketch_1.addArc( + 0, + 2.425, + -5.877900790328188, + 10.25907418263698, + 2.067397663006541, + 11.99831201324782, + True, +) SketchArc_3.setName("SketchArc_4") SketchArc_3.result().setName("SketchArc_4") SketchArc_3.results()[1].setName("SketchArc_4_2") SketchArc_3.setAuxiliary(True) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_2.center(), SketchArc_3.center()) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchArc_3.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_3.results()[1], 9.794) SketchPoint_1 = Sketch_1.addPoint(0, 12.219) SketchPoint_1.setName("SketchPoint_2") SketchPoint_1.result().setName("SketchPoint_2") -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_24.result()) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_3.results()[1]) -SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint(SketchPoint_1.coordinates(), SketchLine_24.result()) -SketchLine_25 = Sketch_1.addLine(-5.676829966640709, 10.23848613167324, -5.417460848824602, 10.45671600291324) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_25.startPoint()) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchLine_23.startPoint(), SketchLine_25.startPoint()) -SketchLine_26 = Sketch_1.addLine(-5.417460848824602, 10.45671600291324, -5.143396378647499, 10.65615482129426) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_26.startPoint()) -SketchLine_27 = Sketch_1.addLine(-5.143396378647499, 10.65615482129426, -4.856, 10.83583872155447) -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchLine_26.endPoint(), SketchLine_27.startPoint()) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_24.result() +) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_3.results()[1] +) +SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint( + SketchPoint_1.coordinates(), SketchLine_24.result() +) +SketchLine_25 = Sketch_1.addLine( + -5.676829966640709, 10.23848613167324, -5.417460848824602, 10.45671600291324 +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_25.startPoint() +) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchLine_23.startPoint(), SketchLine_25.startPoint() +) +SketchLine_26 = Sketch_1.addLine( + -5.417460848824602, 10.45671600291324, -5.143396378647499, 10.65615482129426 +) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchLine_25.endPoint(), SketchLine_26.startPoint() +) +SketchLine_27 = Sketch_1.addLine( + -5.143396378647499, 10.65615482129426, -4.856, 10.83583872155447 +) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchLine_26.endPoint(), SketchLine_27.startPoint() +) SketchArc_4 = Sketch_1.addArc(0, 2.425, -4.856, 10.83583872155447, 0, 12.137, True) SketchArc_4.setName("SketchArc_5") SketchArc_4.result().setName("SketchArc_5") SketchArc_4.results()[1].setName("SketchArc_5_2") -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchArc_2.center(), SketchArc_4.center()) -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchArc_3.center(), SketchArc_4.center()) -SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchLine_27.endPoint(), SketchArc_4.startPoint()) -SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchArc_4.endPoint()) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchArc_4.center() +) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchArc_4.center() +) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident( + SketchLine_27.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintCoincidence_42 = Sketch_1.setCoincident( + SketchLine_24.endPoint(), SketchArc_4.endPoint() +) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_24.result(), "0.082*2") SketchLine_28 = Sketch_1.addLine(-4.938, 10.97786688777511, 0, 2.425) SketchLine_28.setAuxiliary(True) -SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchLine_28.startPoint()) -SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_28.startPoint()) -SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_28.endPoint()) -SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_28.endPoint()) -SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchArc_4.center(), SketchLine_28.endPoint()) -SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchLine_28.result(), SketchLine_27.endPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngleBackward(SketchLine_28.result(), SketchLine_10.result(), 30) +SketchConstraintCoincidence_43 = Sketch_1.setCoincident( + SketchLine_22.endPoint(), SketchLine_28.startPoint() +) +SketchConstraintCoincidence_44 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_28.startPoint() +) +SketchConstraintCoincidence_45 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_28.endPoint() +) +SketchConstraintCoincidence_46 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_28.endPoint() +) +SketchConstraintCoincidence_47 = Sketch_1.setCoincident( + SketchArc_4.center(), SketchLine_28.endPoint() +) +SketchConstraintCoincidence_48 = Sketch_1.setCoincident( + SketchLine_28.result(), SketchLine_27.endPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngleBackward( + SketchLine_28.result(), SketchLine_10.result(), 30 +) SketchLine_29 = Sketch_1.addLine(-5.143396378647499, 10.65615482129426, 0, 2.425) SketchLine_29.setAuxiliary(True) -SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_29.endPoint()) -SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_29.endPoint()) -SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchArc_4.center(), SketchLine_29.endPoint()) -SketchConstraintCoincidence_52 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchLine_29.endPoint()) -SketchConstraintCoincidence_53 = Sketch_1.setCoincident(SketchLine_26.endPoint(), SketchLine_29.startPoint()) -SketchConstraintAngle_2 = Sketch_1.setAngleBackward(SketchLine_29.result(), SketchLine_10.result(), 32) +SketchConstraintCoincidence_49 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_29.endPoint() +) +SketchConstraintCoincidence_50 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_29.endPoint() +) +SketchConstraintCoincidence_51 = Sketch_1.setCoincident( + SketchArc_4.center(), SketchLine_29.endPoint() +) +SketchConstraintCoincidence_52 = Sketch_1.setCoincident( + SketchLine_28.endPoint(), SketchLine_29.endPoint() +) +SketchConstraintCoincidence_53 = Sketch_1.setCoincident( + SketchLine_26.endPoint(), SketchLine_29.startPoint() +) +SketchConstraintAngle_2 = Sketch_1.setAngleBackward( + SketchLine_29.result(), SketchLine_10.result(), 32 +) SketchLine_30 = Sketch_1.addLine(-5.417460848824602, 10.45671600291324, 0, 2.425) SketchLine_30.setAuxiliary(True) -SketchConstraintCoincidence_54 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_30.endPoint()) -SketchConstraintCoincidence_55 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_30.endPoint()) -SketchConstraintCoincidence_56 = Sketch_1.setCoincident(SketchArc_4.center(), SketchLine_30.endPoint()) -SketchConstraintCoincidence_57 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchLine_30.endPoint()) -SketchConstraintCoincidence_58 = Sketch_1.setCoincident(SketchLine_29.endPoint(), SketchLine_30.endPoint()) -SketchConstraintCoincidence_59 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_30.startPoint()) -SketchConstraintAngle_3 = Sketch_1.setAngleBackward(SketchLine_30.result(), SketchLine_10.result(), 34) +SketchConstraintCoincidence_54 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_30.endPoint() +) +SketchConstraintCoincidence_55 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_30.endPoint() +) +SketchConstraintCoincidence_56 = Sketch_1.setCoincident( + SketchArc_4.center(), SketchLine_30.endPoint() +) +SketchConstraintCoincidence_57 = Sketch_1.setCoincident( + SketchLine_28.endPoint(), SketchLine_30.endPoint() +) +SketchConstraintCoincidence_58 = Sketch_1.setCoincident( + SketchLine_29.endPoint(), SketchLine_30.endPoint() +) +SketchConstraintCoincidence_59 = Sketch_1.setCoincident( + SketchLine_25.endPoint(), SketchLine_30.startPoint() +) +SketchConstraintAngle_3 = Sketch_1.setAngleBackward( + SketchLine_30.result(), SketchLine_10.result(), 34 +) SketchLine_31 = Sketch_1.addLine(0, 2.425, -5.676829966640709, 10.23848613167324) SketchLine_31.setName("SketchLine_35") SketchLine_31.result().setName("SketchLine_35") SketchLine_31.setAuxiliary(True) -SketchConstraintCoincidence_60 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_31.startPoint()) -SketchConstraintCoincidence_61 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_31.startPoint()) -SketchConstraintCoincidence_62 = Sketch_1.setCoincident(SketchArc_4.center(), SketchLine_31.startPoint()) -SketchConstraintCoincidence_63 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchLine_31.startPoint()) -SketchConstraintCoincidence_64 = Sketch_1.setCoincident(SketchLine_29.endPoint(), SketchLine_31.startPoint()) -SketchConstraintCoincidence_65 = Sketch_1.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) -SketchConstraintCoincidence_66 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_31.endPoint()) -SketchConstraintAngle_4 = Sketch_1.setAngleBackward(SketchLine_31.result(), SketchLine_10.result(), 36) +SketchConstraintCoincidence_60 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_31.startPoint() +) +SketchConstraintCoincidence_61 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_31.startPoint() +) +SketchConstraintCoincidence_62 = Sketch_1.setCoincident( + SketchArc_4.center(), SketchLine_31.startPoint() +) +SketchConstraintCoincidence_63 = Sketch_1.setCoincident( + SketchLine_28.endPoint(), SketchLine_31.startPoint() +) +SketchConstraintCoincidence_64 = Sketch_1.setCoincident( + SketchLine_29.endPoint(), SketchLine_31.startPoint() +) +SketchConstraintCoincidence_65 = Sketch_1.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) +SketchConstraintCoincidence_66 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_31.endPoint() +) +SketchConstraintAngle_4 = Sketch_1.setAngleBackward( + SketchLine_31.result(), SketchLine_10.result(), 36 +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_1.results()[1], 1.316) -SketchLine_32 = Sketch_1.addLine(-4.794548536090929, 9.26204592494933, -4.794548536090929, 9.764655753971969) +SketchLine_32 = Sketch_1.addLine( + -4.794548536090929, 9.26204592494933, -4.794548536090929, 9.764655753971969 +) SketchLine_32.setName("SketchLine_38") SketchLine_32.result().setName("SketchLine_38") SketchLine_32.setAuxiliary(True) -SketchConstraintCoincidence_67 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_32.startPoint()) -SketchConstraintCoincidence_68 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_67 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_32.startPoint() +) +SketchConstraintCoincidence_68 = Sketch_1.setCoincident( + SketchLine_23.endPoint(), SketchLine_32.startPoint() +) SketchConstraintVertical_10 = Sketch_1.setVertical(SketchLine_32.result()) -SketchConstraintAngle_5 = Sketch_1.setAngleBackward(SketchLine_23.result(), SketchLine_32.result(), 42.1) -SketchLine_33 = Sketch_1.addLine(-4.794548536090929, 9.26204592494933, -5.10267883886141, 9.26204592494933) +SketchConstraintAngle_5 = Sketch_1.setAngleBackward( + SketchLine_23.result(), SketchLine_32.result(), 42.1 +) +SketchLine_33 = Sketch_1.addLine( + -4.794548536090929, 9.26204592494933, -5.10267883886141, 9.26204592494933 +) SketchLine_33.setName("SketchLine_39") SketchLine_33.result().setName("SketchLine_39") SketchLine_33.setAuxiliary(True) -SketchConstraintCoincidence_69 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_33.startPoint()) -SketchConstraintCoincidence_70 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_33.startPoint()) -SketchConstraintCoincidence_71 = Sketch_1.setCoincident(SketchLine_32.startPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_69 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_33.startPoint() +) +SketchConstraintCoincidence_70 = Sketch_1.setCoincident( + SketchLine_23.endPoint(), SketchLine_33.startPoint() +) +SketchConstraintCoincidence_71 = Sketch_1.setCoincident( + SketchLine_32.startPoint(), SketchLine_33.startPoint() +) SketchConstraintHorizontal_8 = Sketch_1.setHorizontal(SketchLine_33.result()) -SketchLine_34 = Sketch_1.addLine(-6.084266646261862, 9.523738867722171, -4.794548536090929, 9.26204592494933) +SketchLine_34 = Sketch_1.addLine( + -6.084266646261862, 9.523738867722171, -4.794548536090929, 9.26204592494933 +) SketchLine_34.setName("SketchLine_40") SketchLine_34.result().setName("SketchLine_40") SketchLine_34.setAuxiliary(True) -SketchConstraintCoincidence_72 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_34.startPoint()) -SketchConstraintCoincidence_73 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_34.startPoint()) -SketchConstraintCoincidence_74 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_34.endPoint()) -SketchConstraintCoincidence_75 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_34.endPoint()) -SketchConstraintCoincidence_76 = Sketch_1.setCoincident(SketchLine_32.startPoint(), SketchLine_34.endPoint()) -SketchConstraintCoincidence_77 = Sketch_1.setCoincident(SketchLine_33.startPoint(), SketchLine_34.endPoint()) -SketchConstraintCoincidence_78 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_10.result()) -SketchConstraintAngle_6 = Sketch_1.setAngleBackward(SketchLine_33.result(), SketchLine_34.result(), 11.47) -SketchLine_35 = Sketch_1.addLine(-5.676829966640709, 10.23848613167324, -5.756768760952487, 10.34851244290823) +SketchConstraintCoincidence_72 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchLine_34.startPoint() +) +SketchConstraintCoincidence_73 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_34.startPoint() +) +SketchConstraintCoincidence_74 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_34.endPoint() +) +SketchConstraintCoincidence_75 = Sketch_1.setCoincident( + SketchLine_23.endPoint(), SketchLine_34.endPoint() +) +SketchConstraintCoincidence_76 = Sketch_1.setCoincident( + SketchLine_32.startPoint(), SketchLine_34.endPoint() +) +SketchConstraintCoincidence_77 = Sketch_1.setCoincident( + SketchLine_33.startPoint(), SketchLine_34.endPoint() +) +SketchConstraintCoincidence_78 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_10.result() +) +SketchConstraintAngle_6 = Sketch_1.setAngleBackward( + SketchLine_33.result(), SketchLine_34.result(), 11.47 +) +SketchLine_35 = Sketch_1.addLine( + -5.676829966640709, 10.23848613167324, -5.756768760952487, 10.34851244290823 +) SketchLine_35.setName("SketchLine_36") SketchLine_35.result().setName("SketchLine_36") SketchLine_35.setAuxiliary(True) -SketchConstraintCoincidence_79 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_35.startPoint()) -SketchConstraintCoincidence_80 = Sketch_1.setCoincident(SketchLine_23.startPoint(), SketchLine_35.startPoint()) -SketchConstraintCoincidence_81 = Sketch_1.setCoincident(SketchLine_25.startPoint(), SketchLine_35.startPoint()) -SketchConstraintCoincidence_82 = Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchLine_35.startPoint()) -SketchConstraintCoincidence_83 = Sketch_1.setCoincident(SketchLine_35.endPoint(), SketchArc_3.results()[1]) -SketchLine_36 = Sketch_1.addLine(-5.417460848824602, 10.45671600291324, -5.476735296592498, 10.54459398560407) +SketchConstraintCoincidence_79 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_35.startPoint() +) +SketchConstraintCoincidence_80 = Sketch_1.setCoincident( + SketchLine_23.startPoint(), SketchLine_35.startPoint() +) +SketchConstraintCoincidence_81 = Sketch_1.setCoincident( + SketchLine_25.startPoint(), SketchLine_35.startPoint() +) +SketchConstraintCoincidence_82 = Sketch_1.setCoincident( + SketchLine_31.endPoint(), SketchLine_35.startPoint() +) +SketchConstraintCoincidence_83 = Sketch_1.setCoincident( + SketchLine_35.endPoint(), SketchArc_3.results()[1] +) +SketchLine_36 = Sketch_1.addLine( + -5.417460848824602, 10.45671600291324, -5.476735296592498, 10.54459398560407 +) SketchLine_36.setName("SketchLine_37") SketchLine_36.result().setName("SketchLine_37") SketchLine_36.setAuxiliary(True) -SketchConstraintCoincidence_84 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_36.startPoint()) -SketchConstraintCoincidence_85 = Sketch_1.setCoincident(SketchLine_26.startPoint(), SketchLine_36.startPoint()) -SketchConstraintCoincidence_86 = Sketch_1.setCoincident(SketchLine_30.startPoint(), SketchLine_36.startPoint()) -SketchConstraintCoincidence_87 = Sketch_1.setCoincident(SketchLine_36.endPoint(), SketchArc_3.results()[1]) -SketchLine_37 = Sketch_1.addLine(-5.143396378647499, 10.65615482129426, -5.190029273900022, 10.73078305375603) +SketchConstraintCoincidence_84 = Sketch_1.setCoincident( + SketchLine_25.endPoint(), SketchLine_36.startPoint() +) +SketchConstraintCoincidence_85 = Sketch_1.setCoincident( + SketchLine_26.startPoint(), SketchLine_36.startPoint() +) +SketchConstraintCoincidence_86 = Sketch_1.setCoincident( + SketchLine_30.startPoint(), SketchLine_36.startPoint() +) +SketchConstraintCoincidence_87 = Sketch_1.setCoincident( + SketchLine_36.endPoint(), SketchArc_3.results()[1] +) +SketchLine_37 = Sketch_1.addLine( + -5.143396378647499, 10.65615482129426, -5.190029273900022, 10.73078305375603 +) SketchLine_37.setName("SketchLine_41") SketchLine_37.result().setName("SketchLine_41") SketchLine_37.setAuxiliary(True) -SketchConstraintCoincidence_88 = Sketch_1.setCoincident(SketchLine_26.endPoint(), SketchLine_37.startPoint()) -SketchConstraintCoincidence_89 = Sketch_1.setCoincident(SketchLine_27.startPoint(), SketchLine_37.startPoint()) -SketchConstraintCoincidence_90 = Sketch_1.setCoincident(SketchLine_29.startPoint(), SketchLine_37.startPoint()) -SketchConstraintCoincidence_91 = Sketch_1.setCoincident(SketchLine_37.endPoint(), SketchArc_3.results()[1]) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_35.result(), SketchLine_31.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_36.result(), SketchLine_30.result()) -SketchConstraintParallel_3 = Sketch_1.setParallel(SketchLine_37.result(), SketchLine_29.result()) +SketchConstraintCoincidence_88 = Sketch_1.setCoincident( + SketchLine_26.endPoint(), SketchLine_37.startPoint() +) +SketchConstraintCoincidence_89 = Sketch_1.setCoincident( + SketchLine_27.startPoint(), SketchLine_37.startPoint() +) +SketchConstraintCoincidence_90 = Sketch_1.setCoincident( + SketchLine_29.startPoint(), SketchLine_37.startPoint() +) +SketchConstraintCoincidence_91 = Sketch_1.setCoincident( + SketchLine_37.endPoint(), SketchArc_3.results()[1] +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_35.result(), SketchLine_31.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_36.result(), SketchLine_30.result() +) +SketchConstraintParallel_3 = Sketch_1.setParallel( + SketchLine_37.result(), SketchLine_29.result() +) SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_35.result(), 0.136) SketchConstraintLength_7 = Sketch_1.setLength(SketchLine_36.result(), 0.106) SketchConstraintLength_8 = Sketch_1.setLength(SketchLine_37.result(), 0.088) -SketchConstraintCoincidence_92 = Sketch_1.setCoincident(SketchLine_17.startPoint(), SketchLine_16.result()) -SketchConstraintMiddle_3 = Sketch_1.setMiddlePoint(SketchLine_17.startPoint(), SketchLine_16.result()) +SketchConstraintCoincidence_92 = Sketch_1.setCoincident( + SketchLine_17.startPoint(), SketchLine_16.result() +) +SketchConstraintMiddle_3 = Sketch_1.setMiddlePoint( + SketchLine_17.startPoint(), SketchLine_16.result() +) model.do() sketchTime = timer() - sketchTime @@ -271,21 +539,35 @@ expectedTime = MOVE_BUILD_RATIO * sketchTime averageTime = 0 nbMoves = 0 -#========================================================================= +# ========================================================================= # Move point under the Middle point constraint and check execution time. # This point is fully constrained, so its coordinates should not be changed. -#========================================================================= +# ========================================================================= aPoint = SketchLine_17.startPoint() X = aPoint.x() Y = aPoint.y() -deltas = [(0.0, 0.1), (0.1, 0.0), (-0.1, 0.1), (1.0, 0.0), (0.0, -1.0), (-0.5, -0.2), (-0.3, 0.3)] +deltas = [ + (0.0, 0.1), + (0.1, 0.0), + (-0.1, 0.1), + (1.0, 0.0), + (0.0, -1.0), + (-0.5, -0.2), + (-0.3, 0.3), +] for deltaX, deltaY in deltas: movementTime = timer() aPoint.setValue(X, Y + 0.1) model.do() movementTime = timer() - movementTime - assert movementTime < expectedTime, "Time to move point {0} is greater than expected {1}".format(movementTime, expectedTime) - assert math.fabs(aPoint.x() - X) < TOLERANCE and math.fabs(aPoint.y() - Y) < TOLERANCE, "({0}, {1}) != ({2}, {3})".format(aPoint.x(), aPoint.y(), X, Y) + assert ( + movementTime < expectedTime + ), "Time to move point {0} is greater than expected {1}".format( + movementTime, expectedTime + ) + assert ( + math.fabs(aPoint.x() - X) < TOLERANCE and math.fabs(aPoint.y() - Y) < TOLERANCE + ), "({0}, {1}) != ({2}, {3})".format(aPoint.x(), aPoint.y(), X, Y) averageTime += movementTime nbMoves += 1 @@ -294,4 +576,4 @@ print("Movement average time: {0}".format(averageTime / nbMoves)) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test2018.py b/src/SketchPlugin/Test/Test2018.py index 7e3cefed9..f855c1bc2 100644 --- a/src/SketchPlugin/Test/Test2018.py +++ b/src/SketchPlugin/Test/Test2018.py @@ -29,6 +29,7 @@ from ModelGeomAlgo import ModelGeomAlgo_Point2D from SketchAPI import SketchAPI_Arc from salome.shaper import model + def getArcs(theSketch): anArcs = [] for aSubObj in theSketch.features().list(): @@ -41,21 +42,37 @@ def getArcs(theSketch): model.begin() partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) -SketchCircle_1 = Sketch_1.addCircle(-316.2976090885591, -103.0319555403832, 230.3644881376851) +SketchCircle_1 = Sketch_1.addCircle( + -316.2976090885591, -103.0319555403832, 230.3644881376851 +) SketchCircle_1.setAuxiliary(True) -SketchLine_1 = Sketch_1.addLine(-489.6131019153831, 48.7229038254136, -457.9545454545454, 334.0909090909091) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) -SketchLine_2 = Sketch_1.addLine(-457.9545454545454, 334.0909090909091, -251.2069112222553, 117.9454153513332) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1]) +SketchLine_1 = Sketch_1.addLine( + -489.6131019153831, 48.7229038254136, -457.9545454545454, 334.0909090909091 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) +SketchLine_2 = Sketch_1.addLine( + -457.9545454545454, 334.0909090909091, -251.2069112222553, 117.9454153513332 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchCircle_1.results()[1] +) # prepare point on circle -SketchLine_intersecting = Sketch_1.addLine(-316.2976090885591, -103.0319555403832, -457.9545454545454, 334.0909090909091) -Intersection_Point = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchCircle_1.feature(), FeatureList([SketchLine_intersecting.feature()])) +SketchLine_intersecting = Sketch_1.addLine( + -316.2976090885591, -103.0319555403832, -457.9545454545454, 334.0909090909091 +) +Intersection_Point = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchCircle_1.feature(), FeatureList([SketchLine_intersecting.feature()]) +) removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()])) GeomPoint = Intersection_Point[0] -#perform split +# perform split Sketch_1.addSplit(SketchCircle_1, Sketch_1.to2D(GeomPoint)) model.do() @@ -63,11 +80,11 @@ anArcs = getArcs(Sketch_1) # check auxiliary flags for arc in anArcs: aCurrentArc = SketchAPI_Arc(arc) - assert(aCurrentArc.auxiliary().value()) + assert aCurrentArc.auxiliary().value() aCurrentArc.setAuxiliary(False) model.do() - assert(aCurrentArc.auxiliary().value() == False) + assert aCurrentArc.auxiliary().value() == False model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test20274_1.py b/src/SketchPlugin/Test/Test20274_1.py index 6fa878da9..3f159577d 100644 --- a/src/SketchPlugin/Test/Test20274_1.py +++ b/src/SketchPlugin/Test/Test20274_1.py @@ -38,7 +38,9 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(50, 0, 41.0188620508502, 41.01886205085074) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_2 = SketchProjection_1.createdFeature() Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) @@ -47,19 +49,27 @@ SketchLine_3 = Sketch_1.addLine(41.0188620508502, 41.01886205085074, 0, 50) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) ### Create SketchProjection -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_4 = SketchProjection_2.createdFeature() Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.result()) ### Create SketchLine -SketchLine_5 = Sketch_1.addLine(41.0188620508502, 41.01886205085074, 70.71067811865088, 70.71067811866516) +SketchLine_5 = Sketch_1.addLine( + 41.0188620508502, 41.01886205085074, 70.71067811865088, 70.71067811866516 +) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.startPoint()) ### Create SketchCircle SketchCircle_1 = Sketch_1.addCircle(0, 0, 100) SketchCircle_1.setAuxiliary(True) -Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchCircle_1.center()) -Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).endPoint(), SketchCircle_1.results()[1]) +Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchCircle_1.center() +) +Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).endPoint(), SketchCircle_1.results()[1] +) Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchCircle_1.results()[1]) Sketch_1.setMiddlePoint(SketchLine_1.startPoint(), SketchLine_2.result()) Sketch_1.setMiddlePoint(SketchLine_3.endPoint(), SketchLine_4.result()) @@ -68,25 +78,54 @@ Sketch_1.setEqual(SketchLine_1.result(), SketchLine_5.result()) Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_5.result()) ### Create SketchMultiRotation -SketchMultiRotation_1_objects = [SketchLine_1.result(), SketchLine_3.result(), SketchLine_5.result()] -SketchMultiRotation_1 = Sketch_1.addRotation(SketchMultiRotation_1_objects, SketchCircle_1.center(), 360, 4, True) -[SketchLine_6, SketchLine_7, SketchLine_8, SketchLine_9, SketchLine_10, SketchLine_11, SketchLine_12, SketchLine_13, SketchLine_14] = SketchMultiRotation_1.rotatedList() +SketchMultiRotation_1_objects = [ + SketchLine_1.result(), + SketchLine_3.result(), + SketchLine_5.result(), +] +SketchMultiRotation_1 = Sketch_1.addRotation( + SketchMultiRotation_1_objects, SketchCircle_1.center(), 360, 4, True +) +[ + SketchLine_6, + SketchLine_7, + SketchLine_8, + SketchLine_9, + SketchLine_10, + SketchLine_11, + SketchLine_12, + SketchLine_13, + SketchLine_14, +] = SketchMultiRotation_1.rotatedList() model.do() ### Create Extrusion -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 100, 0, "Edges") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + 100, + 0, + "Edges", +) model.end() ### Store volumes of sub-shapes as a reference -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 REFERENCE = [] resultExtrusion_1 = Extrusion_1.result() for ind in range(resultExtrusion_1.numberOfSubs()): - REFERENCE.append(GeomAlgoAPI_ShapeTools.volume(resultExtrusion_1.subResult(ind).resultSubShapePair()[0].shape())) + REFERENCE.append( + GeomAlgoAPI_ShapeTools.volume( + resultExtrusion_1.subResult(ind).resultSubShapePair()[0].shape() + ) + ) ### Add new edges to Sketch_1 then check the Extrusion and update reference data model.begin() -SketchLine_6 = Sketch_1.addLine(70.71067811865088, 70.71067811866516, 77.78174593052023, 77.78174593052023) +SketchLine_6 = Sketch_1.addLine( + 70.71067811865088, 70.71067811866516, 77.78174593052023, 77.78174593052023 +) Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) Sketch_1.setCollinear(SketchLine_5.result(), SketchLine_6.result()) Sketch_1.setLength(SketchLine_6.result(), 10) @@ -96,17 +135,21 @@ model.end() resultExtrusion_1 = Extrusion_1.result() for ind in range(resultExtrusion_1.numberOfSubs()): - area = GeomAlgoAPI_ShapeTools.volume(resultExtrusion_1.subResult(ind).resultSubShapePair()[0].shape()) - if (ind < len(REFERENCE)): - assert(math.fabs(REFERENCE[ind] - area) < TOLERANCE) - else: - REFERENCE.append(area) + area = GeomAlgoAPI_ShapeTools.volume( + resultExtrusion_1.subResult(ind).resultSubShapePair()[0].shape() + ) + if ind < len(REFERENCE): + assert math.fabs(REFERENCE[ind] - area) < TOLERANCE + else: + REFERENCE.append(area) -assert(model.checkPythonDump(model.CHECK_NAMING)) +assert model.checkPythonDump(model.CHECK_NAMING) ### Check results after dump resultExtrusion_1 = Extrusion_1.result() -assert(len(REFERENCE) == resultExtrusion_1.numberOfSubs()) +assert len(REFERENCE) == resultExtrusion_1.numberOfSubs() for ind in range(resultExtrusion_1.numberOfSubs()): - area = GeomAlgoAPI_ShapeTools.volume(resultExtrusion_1.subResult(ind).resultSubShapePair()[0].shape()) - assert(math.fabs(REFERENCE[ind] - area) < TOLERANCE) + area = GeomAlgoAPI_ShapeTools.volume( + resultExtrusion_1.subResult(ind).resultSubShapePair()[0].shape() + ) + assert math.fabs(REFERENCE[ind] - area) < TOLERANCE diff --git a/src/SketchPlugin/Test/Test20274_2.py b/src/SketchPlugin/Test/Test20274_2.py index ea60c2172..dd77d1232 100644 --- a/src/SketchPlugin/Test/Test20274_2.py +++ b/src/SketchPlugin/Test/Test20274_2.py @@ -38,7 +38,9 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(50, 0, 41.0188620508502, 41.01886205085074) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_2 = SketchProjection_1.createdFeature() Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) @@ -47,19 +49,27 @@ SketchLine_3 = Sketch_1.addLine(41.0188620508502, 41.01886205085074, 0, 50) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) ### Create SketchProjection -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_4 = SketchProjection_2.createdFeature() Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.result()) ### Create SketchLine -SketchLine_5 = Sketch_1.addLine(41.0188620508502, 41.01886205085074, 70.71067811865088, 70.71067811866516) +SketchLine_5 = Sketch_1.addLine( + 41.0188620508502, 41.01886205085074, 70.71067811865088, 70.71067811866516 +) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.startPoint()) ### Create SketchCircle SketchCircle_1 = Sketch_1.addCircle(0, 0, 100) SketchCircle_1.setAuxiliary(True) -Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchCircle_1.center()) -Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).endPoint(), SketchCircle_1.results()[1]) +Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchCircle_1.center() +) +Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).endPoint(), SketchCircle_1.results()[1] +) Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchCircle_1.results()[1]) Sketch_1.setMiddlePoint(SketchLine_1.startPoint(), SketchLine_2.result()) Sketch_1.setMiddlePoint(SketchLine_3.endPoint(), SketchLine_4.result()) @@ -68,25 +78,47 @@ Sketch_1.setEqual(SketchLine_1.result(), SketchLine_5.result()) Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_5.result()) ### Create SketchMultiTranslation -SketchMultiTranslation_1_objects = [SketchLine_1.result(), SketchLine_3.result(), SketchLine_5.result()] -SketchMultiTranslation_1 = Sketch_1.addTranslation(SketchMultiTranslation_1_objects, SketchAPI_Line(SketchLine_4).startPoint(), SketchLine_5.endPoint(), 2) +SketchMultiTranslation_1_objects = [ + SketchLine_1.result(), + SketchLine_3.result(), + SketchLine_5.result(), +] +SketchMultiTranslation_1 = Sketch_1.addTranslation( + SketchMultiTranslation_1_objects, + SketchAPI_Line(SketchLine_4).startPoint(), + SketchLine_5.endPoint(), + 2, +) [SketchLine_7, SketchLine_8, SketchLine_9] = SketchMultiTranslation_1.translatedList() model.do() ### Create Extrusion -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 100, 0, "Edges") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + 100, + 0, + "Edges", +) model.end() ### Store volumes of sub-shapes as a reference -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 REFERENCE = [] resultExtrusion_1 = Extrusion_1.result() for ind in range(resultExtrusion_1.numberOfSubs()): - REFERENCE.append(GeomAlgoAPI_ShapeTools.volume(resultExtrusion_1.subResult(ind).resultSubShapePair()[0].shape())) + REFERENCE.append( + GeomAlgoAPI_ShapeTools.volume( + resultExtrusion_1.subResult(ind).resultSubShapePair()[0].shape() + ) + ) ### Add new edges to Sketch_1 then check the Extrusion and update reference data model.begin() -SketchLine_6 = Sketch_1.addLine(70.71067811865088, 70.71067811866516, 77.78174593052023, 77.78174593052023) +SketchLine_6 = Sketch_1.addLine( + 70.71067811865088, 70.71067811866516, 77.78174593052023, 77.78174593052023 +) Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) Sketch_1.setCollinear(SketchLine_5.result(), SketchLine_6.result()) Sketch_1.setLength(SketchLine_6.result(), 10) @@ -96,17 +128,21 @@ model.end() resultExtrusion_1 = Extrusion_1.result() for ind in range(resultExtrusion_1.numberOfSubs()): - area = GeomAlgoAPI_ShapeTools.volume(resultExtrusion_1.subResult(ind).resultSubShapePair()[0].shape()) - if (ind < len(REFERENCE)): - assert(math.fabs(REFERENCE[ind] - area) < TOLERANCE) - else: - REFERENCE.append(area) + area = GeomAlgoAPI_ShapeTools.volume( + resultExtrusion_1.subResult(ind).resultSubShapePair()[0].shape() + ) + if ind < len(REFERENCE): + assert math.fabs(REFERENCE[ind] - area) < TOLERANCE + else: + REFERENCE.append(area) -assert(model.checkPythonDump(model.CHECK_NAMING)) +assert model.checkPythonDump(model.CHECK_NAMING) ### Check results after dump resultExtrusion_1 = Extrusion_1.result() -assert(len(REFERENCE) == resultExtrusion_1.numberOfSubs()) +assert len(REFERENCE) == resultExtrusion_1.numberOfSubs() for ind in range(resultExtrusion_1.numberOfSubs()): - area = GeomAlgoAPI_ShapeTools.volume(resultExtrusion_1.subResult(ind).resultSubShapePair()[0].shape()) - assert(math.fabs(REFERENCE[ind] - area) < TOLERANCE) + area = GeomAlgoAPI_ShapeTools.volume( + resultExtrusion_1.subResult(ind).resultSubShapePair()[0].shape() + ) + assert math.fabs(REFERENCE[ind] - area) < TOLERANCE diff --git a/src/SketchPlugin/Test/Test20274_3.py b/src/SketchPlugin/Test/Test20274_3.py index 9bc0f8982..77a7b283d 100644 --- a/src/SketchPlugin/Test/Test20274_3.py +++ b/src/SketchPlugin/Test/Test20274_3.py @@ -38,7 +38,9 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(50, 0, 41.0188620508502, 41.01886205085074) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_2 = SketchProjection_1.createdFeature() Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) @@ -47,19 +49,27 @@ SketchLine_3 = Sketch_1.addLine(41.0188620508502, 41.01886205085074, 0, 50) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) ### Create SketchProjection -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_4 = SketchProjection_2.createdFeature() Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.result()) ### Create SketchLine -SketchLine_5 = Sketch_1.addLine(41.0188620508502, 41.01886205085074, 70.71067811865088, 70.71067811866516) +SketchLine_5 = Sketch_1.addLine( + 41.0188620508502, 41.01886205085074, 70.71067811865088, 70.71067811866516 +) Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.startPoint()) ### Create SketchCircle SketchCircle_1 = Sketch_1.addCircle(0, 0, 100) SketchCircle_1.setAuxiliary(True) -Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchCircle_1.center()) -Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).endPoint(), SketchCircle_1.results()[1]) +Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchCircle_1.center() +) +Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).endPoint(), SketchCircle_1.results()[1] +) Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchCircle_1.results()[1]) Sketch_1.setMiddlePoint(SketchLine_1.startPoint(), SketchLine_2.result()) Sketch_1.setMiddlePoint(SketchLine_3.endPoint(), SketchLine_4.result()) @@ -68,25 +78,44 @@ Sketch_1.setEqual(SketchLine_1.result(), SketchLine_5.result()) Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_5.result()) ### Create SketchConstraintMirror -SketchConstraintMirror_1_objects = [SketchLine_1.result(), SketchLine_3.result(), SketchLine_5.result()] -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_2.result(), SketchConstraintMirror_1_objects) +SketchConstraintMirror_1_objects = [ + SketchLine_1.result(), + SketchLine_3.result(), + SketchLine_5.result(), +] +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_2.result(), SketchConstraintMirror_1_objects +) [SketchLine_7, SketchLine_8, SketchLine_9] = SketchConstraintMirror_1.mirrored() model.do() ### Create Extrusion -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 100, 0, "Edges") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + 100, + 0, + "Edges", +) model.end() ### Store volumes of sub-shapes as a reference -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 REFERENCE = [] resultExtrusion_1 = Extrusion_1.result() for ind in range(resultExtrusion_1.numberOfSubs()): - REFERENCE.append(GeomAlgoAPI_ShapeTools.volume(resultExtrusion_1.subResult(ind).resultSubShapePair()[0].shape())) + REFERENCE.append( + GeomAlgoAPI_ShapeTools.volume( + resultExtrusion_1.subResult(ind).resultSubShapePair()[0].shape() + ) + ) ### Add new edges to Sketch_1 then check the Extrusion and update reference data model.begin() -SketchLine_6 = Sketch_1.addLine(70.71067811865088, 70.71067811866516, 77.78174593052023, 77.78174593052023) +SketchLine_6 = Sketch_1.addLine( + 70.71067811865088, 70.71067811866516, 77.78174593052023, 77.78174593052023 +) Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) Sketch_1.setCollinear(SketchLine_5.result(), SketchLine_6.result()) Sketch_1.setLength(SketchLine_6.result(), 10) @@ -96,17 +125,21 @@ model.end() resultExtrusion_1 = Extrusion_1.result() for ind in range(resultExtrusion_1.numberOfSubs()): - area = GeomAlgoAPI_ShapeTools.volume(resultExtrusion_1.subResult(ind).resultSubShapePair()[0].shape()) - if (ind < len(REFERENCE)): - assert(math.fabs(REFERENCE[ind] - area) < TOLERANCE) - else: - REFERENCE.append(area) + area = GeomAlgoAPI_ShapeTools.volume( + resultExtrusion_1.subResult(ind).resultSubShapePair()[0].shape() + ) + if ind < len(REFERENCE): + assert math.fabs(REFERENCE[ind] - area) < TOLERANCE + else: + REFERENCE.append(area) -assert(model.checkPythonDump(model.CHECK_NAMING)) +assert model.checkPythonDump(model.CHECK_NAMING) ### Check results after dump resultExtrusion_1 = Extrusion_1.result() -assert(len(REFERENCE) == resultExtrusion_1.numberOfSubs()) +assert len(REFERENCE) == resultExtrusion_1.numberOfSubs() for ind in range(resultExtrusion_1.numberOfSubs()): - area = GeomAlgoAPI_ShapeTools.volume(resultExtrusion_1.subResult(ind).resultSubShapePair()[0].shape()) - assert(math.fabs(REFERENCE[ind] - area) < TOLERANCE) + area = GeomAlgoAPI_ShapeTools.volume( + resultExtrusion_1.subResult(ind).resultSubShapePair()[0].shape() + ) + assert math.fabs(REFERENCE[ind] - area) < TOLERANCE diff --git a/src/SketchPlugin/Test/Test2034_1.py b/src/SketchPlugin/Test/Test2034_1.py index e193cb854..520cf066c 100644 --- a/src/SketchPlugin/Test/Test2034_1.py +++ b/src/SketchPlugin/Test/Test2034_1.py @@ -32,23 +32,37 @@ Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 30, 30, 0) SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "OY"), False) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "OX"), False) SketchLine_3 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_1.endPoint(), 30, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_1.startPoint(), 30, True) -SketchArc_1 = Sketch_1.addArc(-1.010399194398717, -1.010399194382958, 0, 30, 30, 0, False) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_1.endPoint(), 30, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_1.startPoint(), 30, True +) +SketchArc_1 = Sketch_1.addArc( + -1.010399194398717, -1.010399194382958, 0, 30, 30, 0, False +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchArc_1.endPoint() +) model.do() # check sketch is correct -assert(Sketch_1.solverError().value() == "") +assert Sketch_1.solverError().value() == "" # add coincidence between center of arc and an origin Sketch_1.setCoincident(SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint()) model.do() -assert(Sketch_1.solverError().value() != "") +assert Sketch_1.solverError().value() != "" model.end() diff --git a/src/SketchPlugin/Test/Test2034_2.py b/src/SketchPlugin/Test/Test2034_2.py index fb417aa99..6cf2ddedc 100644 --- a/src/SketchPlugin/Test/Test2034_2.py +++ b/src/SketchPlugin/Test/Test2034_2.py @@ -28,24 +28,38 @@ model.begin() partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(2.537917624456907, 8.497392663945117, 15) -SketchLine_1 = Sketch_1.addLine(-12.22290362866818, 11.16537990805196, 2.537924341198721, 8.497429825311462) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) -SketchLine_2 = Sketch_1.addLine(2.537924341198721, 8.497429825311462, 17.29875231106562, 5.829479742570965) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1]) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_1.result(), SketchLine_2.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) +SketchLine_1 = Sketch_1.addLine( + -12.22290362866818, 11.16537990805196, 2.537924341198721, 8.497429825311462 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) +SketchLine_2 = Sketch_1.addLine( + 2.537924341198721, 8.497429825311462, 17.29875231106562, 5.829479742570965 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_1.result(), SketchLine_2.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 15) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 15) model.do() # check sketch is correct -assert(Sketch_1.solverError().value() == "") +assert Sketch_1.solverError().value() == "" # add coincidence between center of circle and the end point of line Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.endPoint()) model.do() -assert(Sketch_1.solverError().value() != "") +assert Sketch_1.solverError().value() != "" model.end() diff --git a/src/SketchPlugin/Test/Test2034_3.py b/src/SketchPlugin/Test/Test2034_3.py index 239c7e603..972ba3975 100644 --- a/src/SketchPlugin/Test/Test2034_3.py +++ b/src/SketchPlugin/Test/Test2034_3.py @@ -32,38 +32,66 @@ Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(5, 0, 0, 5) SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "OX"), False) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "OZ"), False) SketchLine_3 = SketchProjection_2.createdFeature() SketchLine_4 = Sketch_1.addLine(0, 5, -5, 0) SketchLine_5 = Sketch_1.addLine(-5, 0, 5, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.startPoint()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_3.result()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_4.startPoint()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_1.result()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_1.result(), SketchLine_4.result() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.startPoint(), SketchLine_3.result() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_4.result(), SketchLine_1.result() +) 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/SketchLine_4_EndVertex"), 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/SketchLine_1_StartVertex"), False) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchPoint_1.result(), SketchArc_1.startPoint() +) +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/SketchLine_1_EndVertex"), False) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchArc_1.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates() +) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False +) SketchPoint_3 = SketchProjection_5.createdFeature() model.do() # check sketch is correct -assert(Sketch_2.solverError().value() == "") +assert Sketch_2.solverError().value() == "" # add coincidence between center of arc and a point from the first sketch -Sketch_2.setCoincident(SketchArc_1.center(), SketchAPI_Point(SketchPoint_3).coordinates()) +Sketch_2.setCoincident( + SketchArc_1.center(), SketchAPI_Point(SketchPoint_3).coordinates() +) model.do() -assert(Sketch_2.solverError().value() != "") +assert Sketch_2.solverError().value() != "" model.end() diff --git a/src/SketchPlugin/Test/Test2062.py b/src/SketchPlugin/Test/Test2062.py index 20f1e0a0d..2648db10b 100644 --- a/src/SketchPlugin/Test/Test2062.py +++ b/src/SketchPlugin/Test/Test2062.py @@ -24,14 +24,18 @@ partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(10, 10, 10, 100) SketchLine_2 = Sketch_1.addLine(10, 100, 100, 10) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) model.do() # make non-perpendicular line perpendicular -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_2.result()) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_1.result(), SketchLine_2.result() +) model.do() # this moves the line -assert(SketchLine_1.startPoint().x() != 10) +assert SketchLine_1.startPoint().x() != 10 model.end() model.undo() # undo must move the line exactly back -assert(SketchLine_1.startPoint().x() == 10) +assert SketchLine_1.startPoint().x() == 10 diff --git a/src/SketchPlugin/Test/Test2095.py b/src/SketchPlugin/Test/Test2095.py index 62150d2cb..a79990e76 100644 --- a/src/SketchPlugin/Test/Test2095.py +++ b/src/SketchPlugin/Test/Test2095.py @@ -28,21 +28,27 @@ partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(lineStart[0], lineStart[1], lineEnd[0], lineEnd[1]) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "OX")) -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_2.result(), [SketchLine_1.result()]) +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_2.result(), [SketchLine_1.result()] +) [SketchLine_3] = SketchConstraintMirror_1.mirrored() SketchLine_4 = Sketch_1.addLine(lineEnd[0], lineEnd[1], lineEnd[0], -lineEnd[1]) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_3).endPoint(), SketchLine_4.endPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_3).endPoint(), SketchLine_4.endPoint() +) Sketch_1.setFillet(SketchLine_1.endPoint()) model.do() -assert(SketchLine_1.startPoint().x() == SketchAPI_Line(SketchLine_3).startPoint().x()) -assert(SketchLine_1.startPoint().y() == -SketchAPI_Line(SketchLine_3).startPoint().y()) -assert(SketchLine_1.endPoint().x() == SketchAPI_Line(SketchLine_3).endPoint().x()) -assert(SketchLine_1.endPoint().y() == -SketchAPI_Line(SketchLine_3).endPoint().y()) -assert(SketchLine_1.endPoint().x() != lineEnd[0]) -assert(SketchLine_1.endPoint().y() != lineEnd[1]) +assert SketchLine_1.startPoint().x() == SketchAPI_Line(SketchLine_3).startPoint().x() +assert SketchLine_1.startPoint().y() == -SketchAPI_Line(SketchLine_3).startPoint().y() +assert SketchLine_1.endPoint().x() == SketchAPI_Line(SketchLine_3).endPoint().x() +assert SketchLine_1.endPoint().y() == -SketchAPI_Line(SketchLine_3).endPoint().y() +assert SketchLine_1.endPoint().x() != lineEnd[0] +assert SketchLine_1.endPoint().y() != lineEnd[1] model.end() diff --git a/src/SketchPlugin/Test/Test2115.py b/src/SketchPlugin/Test/Test2115.py index 6c7accea7..ad4769d6b 100644 --- a/src/SketchPlugin/Test/Test2115.py +++ b/src/SketchPlugin/Test/Test2115.py @@ -32,38 +32,78 @@ Part_1_doc = Part_1.document() # Create a centered rectangle (from the 2115 issue description) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(132.9002660287441, 132.9002660287441, -132.9002660287441, 132.9002660287441) -SketchLine_2 = Sketch_1.addLine(-132.9002660287441, 132.9002660287441, -132.9002660287441, -132.9002660287441) -SketchLine_3 = Sketch_1.addLine(-132.9002660287441, -132.9002660287441, 132.9002660287441, -132.9002660287441) -SketchLine_4 = Sketch_1.addLine(132.9002660287441, -132.9002660287441, 132.9002660287441, 132.9002660287441) -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()) +SketchLine_1 = Sketch_1.addLine( + 132.9002660287441, 132.9002660287441, -132.9002660287441, 132.9002660287441 +) +SketchLine_2 = Sketch_1.addLine( + -132.9002660287441, 132.9002660287441, -132.9002660287441, -132.9002660287441 +) +SketchLine_3 = Sketch_1.addLine( + -132.9002660287441, -132.9002660287441, 132.9002660287441, -132.9002660287441 +) +SketchLine_4 = Sketch_1.addLine( + 132.9002660287441, -132.9002660287441, 132.9002660287441, 132.9002660287441 +) +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(-132.9002660287441, -132.9002660287441, 132.9002660287441, 132.9002660287441) +SketchLine_5 = Sketch_1.addLine( + -132.9002660287441, -132.9002660287441, 132.9002660287441, 132.9002660287441 +) SketchLine_5.setAuxiliary(True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint()) -SketchLine_6 = Sketch_1.addLine(-132.9002660287441, 132.9002660287441, 132.9002660287441, -132.9002660287441) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.endPoint() +) +SketchLine_6 = Sketch_1.addLine( + -132.9002660287441, 132.9002660287441, 132.9002660287441, -132.9002660287441 +) SketchLine_6.setAuxiliary(True) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_6.endPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_6.endPoint() +) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_5.result()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_5.result() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_6.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) # create a circle by 3 points of this rectangle (to make the last as a line later) -circle = Sketch_1.addCircle(SketchLine_2.startPoint().pnt(), SketchLine_1.startPoint().pnt(), SketchLine_3.endPoint().pnt()) +circle = Sketch_1.addCircle( + SketchLine_2.startPoint().pnt(), + SketchLine_1.startPoint().pnt(), + SketchLine_3.endPoint().pnt(), +) # create by the real references circle.feature().refattr("first_point_ref").setAttr(SketchLine_2.startPoint()) circle.feature().refattr("second_point_ref").setAttr(SketchLine_1.startPoint()) -circle.feature().refattr("third_point_ref").setObject(SketchLine_6.feature().firstResult()) +circle.feature().refattr("third_point_ref").setObject( + SketchLine_6.feature().firstResult() +) # here there was a crash in the issue (actually, sketch is overconstrained, so, assertion is not used, just call for validators) aFactory = ModelAPI_Session.get().validators() aFactory.validate(circle.feature()) diff --git a/src/SketchPlugin/Test/Test2119.py b/src/SketchPlugin/Test/Test2119.py index d35cdbdd2..e0755e10f 100644 --- a/src/SketchPlugin/Test/Test2119.py +++ b/src/SketchPlugin/Test/Test2119.py @@ -37,79 +37,211 @@ model.addParameter(Part_1_doc, "c", "100") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(-45, 0, 0, 0) SketchLine_2 = Sketch_1.addLine(0, 0, 23.33965093306752, 8.494938217797719) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(33.83092017818969, 6.16907982180411, 40, 0) SketchLine_4 = Sketch_1.addLine(40, 0, 55, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(55, 0, 55, 48) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(55, 48, 15, 48) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(15, 48, 15, 63) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(15, 63, -15, 63) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(-15, 63, -15, 35) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_8.result()) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_1.result(), SketchLine_4.result()) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_1.result(), SketchLine_4.result() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_4.endPoint(), 15, False) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_1.endPoint(), 40, False) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_4.endPoint(), "c", False) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_8.startPoint(), SketchLine_6.result(), 15, False) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_8.startPoint(), SketchLine_5.result(), 40, False) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_4.endPoint(), 15, False +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_1.endPoint(), 40, False +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_4.endPoint(), "c", False +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_8.startPoint(), SketchLine_6.result(), 15, False +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_8.startPoint(), SketchLine_5.result(), 40, False +) SketchLine_10 = Sketch_1.addLine(-45, 5, -45, 0) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_10.endPoint() +) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_9.startPoint(), SketchLine_1.result(), "a", False) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_9.startPoint(), SketchLine_1.result(), "a", False +) SketchArc_1 = Sketch_1.addArc(-45, 35, -45, 5, -15, 35, False) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_10.result()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_10.startPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_1.result(), 45) -SketchConstraintAngle_2 = Sketch_1.setAngleBackward(SketchLine_2.result(), SketchLine_4.result(), 20) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_9.endPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_9.result()) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_1.result(), 35, False) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_10.result() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_10.startPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_3.result(), SketchLine_1.result(), 45 +) +SketchConstraintAngle_2 = Sketch_1.setAngleBackward( + SketchLine_2.result(), SketchLine_4.result(), 20 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_9.endPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_9.result() +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_1.result(), 35, False +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 30) -SketchArc_2 = Sketch_1.addArc(26.75985236632421, -0.9019879900613652, 33.83092017818969, 6.16907982180411, 23.33965093306752, 8.494938217797719, False) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_2.endPoint()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_2.result()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_3.result()) +SketchArc_2 = Sketch_1.addArc( + 26.75985236632421, + -0.9019879900613652, + 33.83092017818969, + 6.16907982180411, + 23.33965093306752, + 8.494938217797719, + False, +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_2.endPoint() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_2.result() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_3.result() +) 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()) +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_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") +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) +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()) +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/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) +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/Modified_Face&Sketch_1/SketchArc_1_2][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])2([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2([ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])2"), False) +SketchProjection_3 = Sketch_3.addProjection( + model.selection( + "EDGE", + "([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])2([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2([ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])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/Modified_Face&Sketch_1/SketchArc_1_2][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])2([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2([ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2"), False) +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/Modified_Face&Sketch_1/SketchArc_1_2][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])2([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2([ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2", + ), + False, +) SketchArc_4 = SketchProjection_4.createdFeature() -SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchArc_3.endPoint(), SketchArc_4.results()[1]) +SketchConstraintCoincidence_18 = Sketch_3.setCoincident( + SketchArc_3.endPoint(), SketchArc_4.results()[1] +) SketchLine_12 = Sketch_3.addLine(-15, 46.0103340429751, -15, 35) -SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchArc_3.startPoint(), SketchLine_12.startPoint()) -SketchArc_5 = Sketch_3.addArc(-24.92022800465918, 31.2515971841183, -15, 35, -17.02045759563166, 24.17663606626138, True) -SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchArc_5.startPoint()) -SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchArc_3.endPoint(), SketchArc_5.endPoint()) +SketchConstraintCoincidence_19 = Sketch_3.setCoincident( + SketchArc_3.startPoint(), SketchLine_12.startPoint() +) +SketchArc_5 = Sketch_3.addArc( + -24.92022800465918, + 31.2515971841183, + -15, + 35, + -17.02045759563166, + 24.17663606626138, + True, +) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchArc_5.startPoint() +) +SketchConstraintCoincidence_21 = Sketch_3.setCoincident( + SketchArc_3.endPoint(), SketchArc_5.endPoint() +) model.do() model.end() @@ -143,4 +275,4 @@ model.do() model.end() model.checkSketch(Sketch_3) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test2134.py b/src/SketchPlugin/Test/Test2134.py index 291ad8765..8df377d3a 100644 --- a/src/SketchPlugin/Test/Test2134.py +++ b/src/SketchPlugin/Test/Test2134.py @@ -29,21 +29,37 @@ partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(6.188, 9.025, 6.188, -3.45) SketchLine_2 = Sketch_1.addLine(6.188, -3.45, 0, -3.45) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(0, -3.45, 0, -6.45) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(0, -6.45, 7.782000000000002, -6.45) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(7.781999999999998, -6.45, 7.782, -3.45) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(7.782000000000002, -3.45, 6.538000000000001, -3.45) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(6.538000000000001, -3.45, 6.538, -2.4) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(6.538000000000002, -2.4, 6.375999999999999, -2.25) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(6.375999999999999, -2.25, 6.375999999999999, 9.025) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_5.result()) @@ -51,137 +67,327 @@ SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_7.result()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchLine_2.result() +) SketchLine_10 = Sketch_1.addLine(model.selection("EDGE", "OZ")) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_10.result()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_10.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_10.result() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_10.result() +) SketchLine_11 = Sketch_1.addLine(6.187999999999999, 9.025, 6.375999999999999, 9.025) SketchLine_11.setAuxiliary(True) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_11.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_11.endPoint() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_11.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_10.startPoint(), SketchLine_2.result(), 3.45) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.startPoint(), SketchLine_1.result(), 6.188) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_10.startPoint(), SketchLine_2.result(), 3.45 +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_3.startPoint(), SketchLine_1.result(), 6.188 +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_11.result(), 0.188) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_3.result(), 3) -SketchLine_12 = Sketch_1.addLine(7.032000000000001, -4.050000000000001, 5.532000000000001, -4.050000000000001) -SketchLine_13 = Sketch_1.addLine(5.532000000000001, -4.050000000000001, 5.532000000000001, -5.850000000000001) -SketchLine_14 = Sketch_1.addLine(5.532000000000001, -5.850000000000001, 7.032000000000001, -5.850000000000001) -SketchLine_15 = Sketch_1.addLine(7.032000000000001, -5.850000000000001, 7.032000000000001, -4.050000000000001) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchLine_12 = Sketch_1.addLine( + 7.032000000000001, -4.050000000000001, 5.532000000000001, -4.050000000000001 +) +SketchLine_13 = Sketch_1.addLine( + 5.532000000000001, -4.050000000000001, 5.532000000000001, -5.850000000000001 +) +SketchLine_14 = Sketch_1.addLine( + 5.532000000000001, -5.850000000000001, 7.032000000000001, -5.850000000000001 +) +SketchLine_15 = Sketch_1.addLine( + 7.032000000000001, -5.850000000000001, 7.032000000000001, -4.050000000000001 +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_15.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_12.result()) SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_13.result()) SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_14.result()) SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_15.result()) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_14.result(), 1.5) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_13.result(), 1.8) -SketchLine_16 = Sketch_1.addLine(6.282000000000001, 9.025000000000011, 6.282000000000001, -4.05) +SketchLine_16 = Sketch_1.addLine( + 6.282000000000001, 9.025000000000011, 6.282000000000001, -4.05 +) SketchLine_16.setAuxiliary(True) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_16.startPoint(), SketchLine_11.result()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_12.result()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_16.startPoint(), SketchLine_11.result() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_16.endPoint(), SketchLine_12.result() +) SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_16.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_12.result(), SketchLine_16.endPoint()) -SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint(SketchLine_16.startPoint(), SketchLine_11.result()) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_16.endPoint(), SketchLine_5.result(), 1.5) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_16.endPoint(), SketchLine_7.result(), 0.256) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchLine_12.result(), SketchLine_16.endPoint() +) +SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint( + SketchLine_16.startPoint(), SketchLine_11.result() +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_16.endPoint(), SketchLine_5.result(), 1.5 +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_16.endPoint(), SketchLine_7.result(), 0.256 +) SketchLine_17 = Sketch_1.addLine(model.selection("EDGE", "OX")) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_17.result(), 9.025) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_17.result(), 2.25) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_7.endPoint(), SketchLine_17.result(), 2.4) -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_12.result(), 0.6) -SketchLine_18 = Sketch_1.addLine(6.375999999999999, 9.025, 6.537999999999997, 9.186999999999998) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_18.startPoint()) -SketchLine_19 = Sketch_1.addLine(6.538000000000008, 9.187000000000008, 6.537999999999997, 10.256) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_17.result(), 9.025 +) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_17.result(), 2.25 +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchLine_7.endPoint(), SketchLine_17.result(), 2.4 +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchLine_2.startPoint(), SketchLine_12.result(), 0.6 +) +SketchLine_18 = Sketch_1.addLine( + 6.375999999999999, 9.025, 6.537999999999997, 9.186999999999998 +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_18.startPoint() +) +SketchLine_19 = Sketch_1.addLine( + 6.538000000000008, 9.187000000000008, 6.537999999999997, 10.256 +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) SketchLine_20 = Sketch_1.addLine(6.537999999999997, 10.256, 6.187999999999997, 10.256) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) -SketchLine_21 = Sketch_1.addLine(6.187999999999997, 10.256, 4.93800000000044, 10.97786688777776) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) +SketchLine_21 = Sketch_1.addLine( + 6.187999999999997, 10.256, 4.93800000000044, 10.97786688777776 +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.startPoint() +) SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_19.result()) SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_20.result()) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_20.result(), 0.35) -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_16.startPoint(), SketchLine_19.result(), 0.256) -SketchConstraintAngle_1 = Sketch_1.setAngleComplementary(SketchLine_18.result(), SketchLine_11.result(), 45) -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchLine_19.endPoint(), SketchLine_17.result(), 10.256) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_16.startPoint(), SketchLine_19.result(), 0.256 +) +SketchConstraintAngle_1 = Sketch_1.setAngleComplementary( + SketchLine_18.result(), SketchLine_11.result(), 45 +) +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchLine_19.endPoint(), SketchLine_17.result(), 10.256 +) SketchLine_22 = Sketch_1.addLine(6.188, 9.025, 6.081999999999999, 9.532) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_22.startPoint()) -SketchArc_1 = Sketch_1.addArc(0, 2.425, 4.93800000000044, 10.97786688777776, 0, 12.301, False) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_10.result(), SketchArc_1.center()) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_10.result(), SketchArc_1.endPoint()) -SketchArc_2 = Sketch_1.addArc(-1.129352735403899e-028, 2.425, 4.856000000000012, 10.83583872155449, 0, 12.137, False) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchLine_10.result(), SketchArc_2.center()) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_10.result(), SketchArc_2.endPoint()) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_1.center(), SketchArc_2.center()) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_22.startPoint() +) +SketchArc_1 = Sketch_1.addArc( + 0, 2.425, 4.93800000000044, 10.97786688777776, 0, 12.301, False +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_10.result(), SketchArc_1.center() +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_10.result(), SketchArc_1.endPoint() +) +SketchArc_2 = Sketch_1.addArc( + -1.129352735403899e-028, + 2.425, + 4.856000000000012, + 10.83583872155449, + 0, + 12.137, + False, +) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchLine_10.result(), SketchArc_2.center() +) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_10.result(), SketchArc_2.endPoint() +) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchArc_2.center() +) SketchLine_23 = Sketch_1.addLine(0, 12.301, 0, 12.137) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_23.startPoint()) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_23.endPoint()) -SketchConstraintDistance_11 = Sketch_1.setDistance(SketchArc_2.center(), SketchLine_17.result(), 2.425) -SketchArc_3 = Sketch_1.addArc(1.409050931477502e-030, 2.425, -1.654361225106055e-024, 12.219, 5.756768760952482, 10.34851244290824, True) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_23.startPoint() +) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_23.endPoint() +) +SketchConstraintDistance_11 = Sketch_1.setDistance( + SketchArc_2.center(), SketchLine_17.result(), 2.425 +) +SketchArc_3 = Sketch_1.addArc( + 1.409050931477502e-030, + 2.425, + -1.654361225106055e-024, + 12.219, + 5.756768760952482, + 10.34851244290824, + True, +) SketchArc_3.setAuxiliary(True) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_1.center(), SketchArc_3.center()) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchLine_23.result(), SketchArc_3.startPoint()) -SketchConstraintMiddle_3 = Sketch_1.setMiddlePoint(SketchLine_23.result(), SketchArc_3.startPoint()) -SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_3.results()[1], 9.794000000000001) -SketchLine_24 = Sketch_1.addLine(4.856000000000012, 10.83583872155449, 5.1433963786475, 10.65615482129429) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_24.startPoint()) -SketchLine_25 = Sketch_1.addLine(5.1433963786475, 10.65615482129429, 5.417460848824597, 10.45671600291325) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint()) -SketchLine_26 = Sketch_1.addLine(5.417460848824597, 10.45671600291325, 5.676945960870162, 10.23864578403355) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_26.startPoint()) -SketchArc_4 = Sketch_1.addArc(4.79378612024245, 9.263, 6.082, 9.532, 5.676945960870163, 10.23864578403355, False) -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchArc_4.startPoint()) -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_26.endPoint()) -SketchConstraintDistance_12 = Sketch_1.setDistance(SketchArc_4.startPoint(), SketchLine_17.result(), 9.532) -SketchConstraintDistance_13 = Sketch_1.setDistance(SketchArc_4.startPoint(), SketchLine_1.result(), 0.106) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchArc_3.center() +) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchLine_23.result(), SketchArc_3.startPoint() +) +SketchConstraintMiddle_3 = Sketch_1.setMiddlePoint( + SketchLine_23.result(), SketchArc_3.startPoint() +) +SketchConstraintRadius_1 = Sketch_1.setRadius( + SketchArc_3.results()[1], 9.794000000000001 +) +SketchLine_24 = Sketch_1.addLine( + 4.856000000000012, 10.83583872155449, 5.1433963786475, 10.65615482129429 +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_24.startPoint() +) +SketchLine_25 = Sketch_1.addLine( + 5.1433963786475, 10.65615482129429, 5.417460848824597, 10.45671600291325 +) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchLine_24.endPoint(), SketchLine_25.startPoint() +) +SketchLine_26 = Sketch_1.addLine( + 5.417460848824597, 10.45671600291325, 5.676945960870162, 10.23864578403355 +) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchLine_25.endPoint(), SketchLine_26.startPoint() +) +SketchArc_4 = Sketch_1.addArc( + 4.79378612024245, 9.263, 6.082, 9.532, 5.676945960870163, 10.23864578403355, False +) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchLine_22.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_26.endPoint() +) +SketchConstraintDistance_12 = Sketch_1.setDistance( + SketchArc_4.startPoint(), SketchLine_17.result(), 9.532 +) +SketchConstraintDistance_13 = Sketch_1.setDistance( + SketchArc_4.startPoint(), SketchLine_1.result(), 0.106 +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_4.results()[1], 1.316) -SketchConstraintDistance_14 = Sketch_1.setDistance(SketchArc_4.center(), SketchLine_17.result(), 9.263) -SketchLine_27 = Sketch_1.addLine(-1.129352735403899e-028, 2.425, 4.897000000000013, 10.90685280466482) +SketchConstraintDistance_14 = Sketch_1.setDistance( + SketchArc_4.center(), SketchLine_17.result(), 9.263 +) +SketchLine_27 = Sketch_1.addLine( + -1.129352735403899e-028, 2.425, 4.897000000000013, 10.90685280466482 +) SketchLine_27.setAuxiliary(True) -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_27.startPoint()) -SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchLine_27.endPoint(), SketchArc_3.results()[1]) -SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_27.result()) -SketchLine_28 = Sketch_1.addLine(-2.420652665866155e-034, 2.425, 5.190029273900023, 10.73078305375606) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_27.startPoint() +) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident( + SketchLine_27.endPoint(), SketchArc_3.results()[1] +) +SketchConstraintCoincidence_42 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_27.result() +) +SketchLine_28 = Sketch_1.addLine( + -2.420652665866155e-034, 2.425, 5.190029273900023, 10.73078305375606 +) SketchLine_28.setAuxiliary(True) -SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_28.startPoint()) -SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchArc_3.results()[1]) -SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchLine_28.result(), SketchLine_24.endPoint()) +SketchConstraintCoincidence_43 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_28.startPoint() +) +SketchConstraintCoincidence_44 = Sketch_1.setCoincident( + SketchLine_28.endPoint(), SketchArc_3.results()[1] +) +SketchConstraintCoincidence_45 = Sketch_1.setCoincident( + SketchLine_28.result(), SketchLine_24.endPoint() +) SketchLine_29 = Sketch_1.addLine(0, 2.425, 5.476735296592496, 10.54459398560408) SketchLine_29.setAuxiliary(True) -SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_29.startPoint()) -SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchLine_29.endPoint(), SketchArc_3.results()[1]) -SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_29.result()) -SketchLine_30 = Sketch_1.addLine(-1.129352735403899e-028, 2.425, 5.756768760952482, 10.34851244290824) +SketchConstraintCoincidence_46 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_29.startPoint() +) +SketchConstraintCoincidence_47 = Sketch_1.setCoincident( + SketchLine_29.endPoint(), SketchArc_3.results()[1] +) +SketchConstraintCoincidence_48 = Sketch_1.setCoincident( + SketchLine_25.endPoint(), SketchLine_29.result() +) +SketchLine_30 = Sketch_1.addLine( + -1.129352735403899e-028, 2.425, 5.756768760952482, 10.34851244290824 +) SketchLine_30.setAuxiliary(True) -SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_30.startPoint()) -SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_30.endPoint()) -SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_30.result()) -SketchConstraintDistance_15 = Sketch_1.setDistance(SketchArc_3.startPoint(), SketchLine_23.endPoint(), 0.082) -SketchConstraintDistance_16 = Sketch_1.setDistance(SketchLine_24.endPoint(), SketchLine_28.endPoint(), 0.088) -SketchConstraintDistance_17 = Sketch_1.setDistance(SketchLine_25.endPoint(), SketchLine_29.endPoint(), 0.106) -SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_30.result(), SketchLine_10.result(), 36) -SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_29.result(), SketchLine_10.result(), 34) -SketchConstraintAngle_4 = Sketch_1.setAngle(SketchLine_28.result(), SketchLine_10.result(), 32) -SketchConstraintAngle_5 = Sketch_1.setAngle(SketchLine_27.result(), SketchLine_10.result(), 30) -SketchConstraintCoincidence_52 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_27.result()) +SketchConstraintCoincidence_49 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_30.startPoint() +) +SketchConstraintCoincidence_50 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_30.endPoint() +) +SketchConstraintCoincidence_51 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_30.result() +) +SketchConstraintDistance_15 = Sketch_1.setDistance( + SketchArc_3.startPoint(), SketchLine_23.endPoint(), 0.082 +) +SketchConstraintDistance_16 = Sketch_1.setDistance( + SketchLine_24.endPoint(), SketchLine_28.endPoint(), 0.088 +) +SketchConstraintDistance_17 = Sketch_1.setDistance( + SketchLine_25.endPoint(), SketchLine_29.endPoint(), 0.106 +) +SketchConstraintAngle_2 = Sketch_1.setAngle( + SketchLine_30.result(), SketchLine_10.result(), 36 +) +SketchConstraintAngle_3 = Sketch_1.setAngle( + SketchLine_29.result(), SketchLine_10.result(), 34 +) +SketchConstraintAngle_4 = Sketch_1.setAngle( + SketchLine_28.result(), SketchLine_10.result(), 32 +) +SketchConstraintAngle_5 = Sketch_1.setAngle( + SketchLine_27.result(), SketchLine_10.result(), 30 +) +SketchConstraintCoincidence_52 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_27.result() +) model.do() # check sketch is correct -assert(Sketch_1.solverError().value() == "") +assert Sketch_1.solverError().value() == "" # add coincidence between center of arc and a point from the first sketch -SketchConstraintDistance_18 = Sketch_1.setDistance(SketchLine_28.endPoint(), SketchLine_21.result(), 0.088, True) +SketchConstraintDistance_18 = Sketch_1.setDistance( + SketchLine_28.endPoint(), SketchLine_21.result(), 0.088, True +) model.do() -assert(Sketch_1.solverError().value() != "") +assert Sketch_1.solverError().value() != "" # remove constraint, check sketch is correct now partSet.removeFeature(SketchConstraintDistance_18.feature()) model.do() -assert(Sketch_1.solverError().value() == "") +assert Sketch_1.solverError().value() == "" model.end() -assert(model.checkPythonDump()) \ No newline at end of file +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test2157.py b/src/SketchPlugin/Test/Test2157.py index 71019bf34..e7c3994e8 100644 --- a/src/SketchPlugin/Test/Test2157.py +++ b/src/SketchPlugin/Test/Test2157.py @@ -24,17 +24,27 @@ 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.02956299682377, 22.92420172826143, 50.52730937285911, 55.74918048752026) -SketchLine_2 = Sketch_1.addLine(37.41590909090908, 14.23181818181818, 32.3113094484989, 39.36625633556781) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result()) -SketchLine_3 = Sketch_1.addLine(32.3113094484989, 39.36625633556781, 60.59999999999999, 33.28409090909091) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_1 = Sketch_1.addLine( + 14.02956299682377, 22.92420172826143, 50.52730937285911, 55.74918048752026 +) +SketchLine_2 = Sketch_1.addLine( + 37.41590909090908, 14.23181818181818, 32.3113094484989, 39.36625633556781 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_1.result() +) +SketchLine_3 = Sketch_1.addLine( + 32.3113094484989, 39.36625633556781, 60.59999999999999, 33.28409090909091 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) model.do() SketchFillet_1 = Sketch_1.setFillet(SketchLine_2.endPoint()) model.do() -assert(Sketch_1.feature().error() == "") -assert(Sketch_1.solverError().value() == "") +assert Sketch_1.feature().error() == "" +assert Sketch_1.solverError().value() == "" model.end() diff --git a/src/SketchPlugin/Test/Test2157_2.py b/src/SketchPlugin/Test/Test2157_2.py index edd068147..cc7ddd211 100644 --- a/src/SketchPlugin/Test/Test2157_2.py +++ b/src/SketchPlugin/Test/Test2157_2.py @@ -26,20 +26,28 @@ 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) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() SketchLine_3 = Sketch_1.addLine(60, 10, 0, 0) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.endPoint() +) SketchLine_4 = Sketch_1.addLine(20, 50, 0, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_4.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_4.endPoint() +) model.do() SketchFillet_1 = Sketch_1.setFillet(SketchLine_3.endPoint()) model.do() -assert(Sketch_1.feature().error() == "") -assert(Sketch_1.solverError().value() == "") +assert Sketch_1.feature().error() == "" +assert Sketch_1.solverError().value() == "" model.end() diff --git a/src/SketchPlugin/Test/Test2224.py b/src/SketchPlugin/Test/Test2224.py index de0e5ba50..15e5e35cd 100644 --- a/src/SketchPlugin/Test/Test2224.py +++ b/src/SketchPlugin/Test/Test2224.py @@ -32,10 +32,24 @@ 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(8.985073018276022, 21.83713948745567, 31.50462311471469, 21.83713948745567) -SketchArc_1 = Sketch_1.addArc(31.50462311471469, -6.977379981512561, 31.50462311471469, 21.83713948745567, 25.29690414212808, 21.16050830785517, True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_1.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_1.result(), SketchArc_1.results()[1]) +SketchLine_1 = Sketch_1.addLine( + 8.985073018276022, 21.83713948745567, 31.50462311471469, 21.83713948745567 +) +SketchArc_1 = Sketch_1.addArc( + 31.50462311471469, + -6.977379981512561, + 31.50462311471469, + 21.83713948745567, + 25.29690414212808, + 21.16050830785517, + True, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_1.result(), SketchArc_1.results()[1] +) model.do() model.end() diff --git a/src/SketchPlugin/Test/Test2229.py b/src/SketchPlugin/Test/Test2229.py index d399495d7..428097a85 100644 --- a/src/SketchPlugin/Test/Test2229.py +++ b/src/SketchPlugin/Test/Test2229.py @@ -29,14 +29,18 @@ model.addParameter(Part_1_doc, "Wall_T1", "0.089") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(0, 2.424999999999997) SketchLine_1 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_1.result() +) SketchConstraintRigid_1 = Sketch_1.setFixed(SketchPoint_1.coordinates()) SketchLine_2 = Sketch_1.addLine(6.277, 3.700188311077954, 6.277, -1.894463229482514) SketchLine_2.setAuxiliary(True) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_2.result(), "Wall_R+Wall_T1") +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchPoint_1.coordinates(), SketchLine_2.result(), "Wall_R+Wall_T1" +) model.end() # check that resulting sketch is not valid (since PlanGCS 0.18) aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Sketch_1.feature()) == False) +assert aFactory.validate(Sketch_1.feature()) == False diff --git a/src/SketchPlugin/Test/Test2239.py b/src/SketchPlugin/Test/Test2239.py index 87bb71bc5..3525d3535 100644 --- a/src/SketchPlugin/Test/Test2239.py +++ b/src/SketchPlugin/Test/Test2239.py @@ -32,27 +32,51 @@ Parameter_N = model.addParameter(Part_1_doc, "N", "5") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(20, 0, 0, 0) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 20) SketchLine_3 = Sketch_1.addLine(0, 20, 20, 20) SketchLine_4 = Sketch_1.addLine(20, 20, 20, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_4.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 20) SketchLine_5 = Sketch_1.addLine(20, 0, 30, 0) SketchLine_5.setAuxiliary(True) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_1.startPoint() +) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_5.result(), 10) -SketchMultiTranslation_1_objects = [SketchLine_1.result(), SketchLine_2.result(), SketchLine_3.result(), SketchLine_4.result()] -SketchMultiTranslation_1 = Sketch_1.addTranslation(SketchMultiTranslation_1_objects, SketchLine_1.endPoint(), SketchLine_5.endPoint(), "N") +SketchMultiTranslation_1_objects = [ + SketchLine_1.result(), + SketchLine_2.result(), + SketchLine_3.result(), + SketchLine_4.result(), +] +SketchMultiTranslation_1 = Sketch_1.addTranslation( + SketchMultiTranslation_1_objects, + SketchLine_1.endPoint(), + SketchLine_5.endPoint(), + "N", +) model.do() from GeomAPI import GeomAPI_Shape @@ -64,13 +88,13 @@ model.testNbSubShapes(Sketch_1, GeomAPI_Shape.VERTEX, [40]) # check MultiTranslation error Parameter_N.setValue(1) model.do() -assert(SketchMultiTranslation_1.feature().error() != "") +assert SketchMultiTranslation_1.feature().error() != "" # check MultiTranslation error disappears Parameter_N.setValue(2) model.do() -assert(SketchMultiTranslation_1.feature().error() == "") +assert SketchMultiTranslation_1.feature().error() == "" model.testNbResults(Sketch_1, 1) model.testNbSubShapes(Sketch_1, GeomAPI_Shape.EDGE, [8]) @@ -79,7 +103,7 @@ model.testNbSubShapes(Sketch_1, GeomAPI_Shape.VERTEX, [16]) # check MultiTranslation is still correct Parameter_N.setValue(5) model.do() -assert(SketchMultiTranslation_1.feature().error() == "") +assert SketchMultiTranslation_1.feature().error() == "" model.testNbResults(Sketch_1, 1) model.testNbSubShapes(Sketch_1, GeomAPI_Shape.EDGE, [20]) @@ -88,4 +112,4 @@ model.testNbSubShapes(Sketch_1, GeomAPI_Shape.VERTEX, [40]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test2273.py b/src/SketchPlugin/Test/Test2273.py index bd2c9aa50..f044049cb 100644 --- a/src/SketchPlugin/Test/Test2273.py +++ b/src/SketchPlugin/Test/Test2273.py @@ -29,70 +29,81 @@ from SketchAPI import * model.begin() partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(-65.36884900412264, 10.74954405845571, -18.59380593895045, 62.75409504395774) +SketchLine_1 = Sketch_1.addLine( + -65.36884900412264, 10.74954405845571, -18.59380593895045, 62.75409504395774 +) SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Origin"), False) SketchPoint_1 = SketchProjection_1.createdFeature() # Test 1. Check MultiRotation error -SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_1.result()], SketchAPI_Point(SketchPoint_1).coordinates(), 90, 3) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchLine_1.result()], SketchAPI_Point(SketchPoint_1).coordinates(), 90, 3 +) [SketchLine_2, SketchLine_3] = SketchMultiRotation_1.rotated() model.do() # check MultiRotation has NO error -assert(SketchMultiRotation_1.feature().error() == "") +assert SketchMultiRotation_1.feature().error() == "" # change center of MultiRotation to extremity of generated feature, check an error appears SketchMultiRotation_1.center().setAttr(SketchAPI_Line(SketchLine_2).startPoint()) model.do() -assert(SketchMultiRotation_1.feature().error() != "") +assert SketchMultiRotation_1.feature().error() != "" # revert changes => no error SketchMultiRotation_1.center().setAttr(SketchAPI_Point(SketchPoint_1).coordinates()) model.do() -assert(SketchMultiRotation_1.feature().error() == "") +assert SketchMultiRotation_1.feature().error() == "" # Test 2. Check MultiRotation error -SketchMultiTranslation_1 = Sketch_1.addTranslation([SketchLine_1.result()], SketchLine_1.startPoint(), SketchAPI_Line(SketchLine_2).endPoint(), 2) +SketchMultiTranslation_1 = Sketch_1.addTranslation( + [SketchLine_1.result()], + SketchLine_1.startPoint(), + SketchAPI_Line(SketchLine_2).endPoint(), + 2, +) [SketchLine_4] = SketchMultiTranslation_1.translated() model.do() # check MultiTranslation has NO error -assert(SketchMultiTranslation_1.feature().error() == "") +assert SketchMultiTranslation_1.feature().error() == "" # change start point to extremity of generated feature, check an error appears SketchMultiTranslation_1.startPoint().setAttr(SketchAPI_Line(SketchLine_4).endPoint()) model.do() -assert(SketchMultiTranslation_1.feature().error() != "") +assert SketchMultiTranslation_1.feature().error() != "" # revert changes => no error SketchMultiTranslation_1.startPoint().setAttr(SketchLine_1.startPoint()) model.do() -assert(SketchMultiTranslation_1.feature().error() == "") +assert SketchMultiTranslation_1.feature().error() == "" # change end point to extremity of generated feature, check an error appears SketchMultiTranslation_1.endPoint().setAttr(SketchAPI_Line(SketchLine_4).endPoint()) model.do() -assert(SketchMultiTranslation_1.feature().error() != "") +assert SketchMultiTranslation_1.feature().error() != "" # revert changes => no error SketchMultiTranslation_1.endPoint().setAttr(SketchAPI_Line(SketchLine_2).endPoint()) model.do() -assert(SketchMultiTranslation_1.feature().error() == "") +assert SketchMultiTranslation_1.feature().error() == "" # Test 3. Check Mirror error -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_2.result(), [SketchLine_1.result(), SketchLine_3.result()]) +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_2.result(), [SketchLine_1.result(), SketchLine_3.result()] +) [SketchLine_5, SketchLine_6] = SketchConstraintMirror_1.mirrored() model.do() # check Mirror has NO error -assert(SketchConstraintMirror_1.feature().error() == "") +assert SketchConstraintMirror_1.feature().error() == "" # change mirror line to generated feature, check an error appears SketchConstraintMirror_1.mirrorLine().setObject(SketchLine_5.feature().firstResult()) model.do() -assert(SketchConstraintMirror_1.feature().error() != "") +assert SketchConstraintMirror_1.feature().error() != "" # revert changes => no error SketchConstraintMirror_1.mirrorLine().setObject(SketchLine_2.feature().firstResult()) model.do() -assert(SketchConstraintMirror_1.feature().error() == "") +assert SketchConstraintMirror_1.feature().error() == "" model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test2280.py b/src/SketchPlugin/Test/Test2280.py index 7f3c4a78c..26edb7f77 100644 --- a/src/SketchPlugin/Test/Test2280.py +++ b/src/SketchPlugin/Test/Test2280.py @@ -29,15 +29,23 @@ 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) +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() -assert(Sketch_1.feature().error() == "") -assert(Sketch_1.solverError().value() == "") +assert Sketch_1.feature().error() == "" +assert Sketch_1.solverError().value() == "" model.testNbSubFeatures(Sketch_1, "SketchArc", 0) model.testNbSubFeatures(Sketch_1, "SketchCircle", 2) @@ -45,8 +53,8 @@ model.testNbSubFeatures(Sketch_1, "SketchCircle", 2) SketchTrim_1 = Sketch_1.addTrim(SketchCircle_2, GeomAPI_Pnt2d(0.0, 18.0)) model.do() -assert(Sketch_1.feature().error() == "") -assert(Sketch_1.solverError().value() == "") +assert Sketch_1.feature().error() == "" +assert Sketch_1.solverError().value() == "" model.testNbSubFeatures(Sketch_1, "SketchArc", 1) model.testNbSubFeatures(Sketch_1, "SketchCircle", 1) diff --git a/src/SketchPlugin/Test/Test2287.py b/src/SketchPlugin/Test/Test2287.py index f56300621..635ff6fbe 100644 --- a/src/SketchPlugin/Test/Test2287.py +++ b/src/SketchPlugin/Test/Test2287.py @@ -27,13 +27,17 @@ 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/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/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/SketchProjection_1") +assert Edge_1.baseObjects().value(0).namingName() == "Sketch_2/SketchProjection_1" -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test2341.py b/src/SketchPlugin/Test/Test2341.py index 829d654bf..b6318a29d 100644 --- a/src/SketchPlugin/Test/Test2341.py +++ b/src/SketchPlugin/Test/Test2341.py @@ -33,13 +33,21 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(-5.830951894848558, -7.5, -11, -7.5) SketchLine_2 = Sketch_1.addLine(-11, -7.5, -11, -10) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(-11, -10, 11, -10) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(11, -10, 11, -7.5) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(11, -7.5, 5.8309518948453, -7.5) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) @@ -51,98 +59,228 @@ SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_3.result(), 22) SketchConstraintLength_3.setName("SketchConstraintLength_5") SketchLine_6 = Sketch_1.addLine(-6, 12, 6, 12) SketchLine_7 = Sketch_1.addLine(6, 12, 6, 8.121320343559642) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(-6, 12, -6, 7.365459931328117) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchLine_8.startPoint() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_6.result(), 12) SketchConstraintLength_4.setName("SketchConstraintLength_6") -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchProjection_3 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_3 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_3 = SketchProjection_3.createdFeature() -SketchProjection_4 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_4 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_4 = SketchProjection_4.createdFeature() -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_4.startPoint(), 10) -SketchProjection_5 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_4.startPoint(), 10 +) +SketchProjection_5 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_5 = SketchProjection_5.createdFeature() -SketchArc_1 = Sketch_1.addArc(0, 0, -5.830951894848558, -7.5, -6, 7.365459931328117, True) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchPoint_5.result(), SketchArc_1.center()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 0, 0, -5.830951894848558, -7.5, -6, 7.365459931328117, True +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchPoint_5.result(), SketchArc_1.center() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_1.startPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 9.5) -SketchProjection_6 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_6 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_6 = SketchProjection_6.createdFeature() -SketchArc_2 = Sketch_1.addArc(0, 0, 5.8309518948453, -7.5, 7.693909752490621, 5.572589408930978, False) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_6.result(), SketchArc_2.center()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchArc_2.startPoint()) +SketchArc_2 = Sketch_1.addArc( + 0, 0, 5.8309518948453, -7.5, 7.693909752490621, 5.572589408930978, False +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchPoint_6.result(), SketchArc_2.center() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchArc_2.startPoint() +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 9.5) -SketchArc_3 = Sketch_1.addArc(0, 0, 1.561361948645558, 3.6826822922052, 3.682682292205201, 1.561361948645557, False) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_3.center()) +SketchArc_3 = Sketch_1.addArc( + 0, + 0, + 1.561361948645558, + 3.6826822922052, + 3.682682292205201, + 1.561361948645557, + False, +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_3.center() +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_3.results()[1], 4) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_6.endPoint(), SketchArc_1.center(), 6) -SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_3.endPoint(), SketchArc_1.center(), 11) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchArc_1.endPoint()) -SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchLine_8.startPoint(), SketchLine_2.endPoint(), 22) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_6.endPoint(), SketchArc_1.center(), 6 +) +SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance( + SketchLine_3.endPoint(), SketchArc_1.center(), 11 +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchArc_1.endPoint() +) +SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance( + SketchLine_8.startPoint(), SketchLine_2.endPoint(), 22 +) SketchLine_9 = Sketch_1.addLine(0, 0, 14.14213562373095, 14.14213562373095) SketchLine_9.setAuxiliary(True) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_9.startPoint()) -SketchProjection_7 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_9.startPoint() +) +SketchProjection_7 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_10 = SketchProjection_7.createdFeature() -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_10.result(), SketchLine_9.result(), 45) -SketchLine_11 = Sketch_1.addLine(7.693909752490621, 5.572589408930978, 3.682682292205201, 1.561361948645557) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_11.endPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_9.result(), SketchLine_11.result()) -SketchLine_12 = Sketch_1.addLine(6, 8.121320343559642, 1.561361948645558, 3.6826822922052) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_12.endPoint()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_9.result(), SketchLine_12.result()) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_12.startPoint(), SketchLine_7.endPoint()) -SketchLine_13 = Sketch_1.addLine(3.682682292205201, 1.561361948645557, 1.561361948645558, 3.6826822922052) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_10.result(), SketchLine_9.result(), 45 +) +SketchLine_11 = Sketch_1.addLine( + 7.693909752490621, 5.572589408930978, 3.682682292205201, 1.561361948645557 +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_11.endPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_9.result(), SketchLine_11.result() +) +SketchLine_12 = Sketch_1.addLine( + 6, 8.121320343559642, 1.561361948645558, 3.6826822922052 +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchLine_12.endPoint() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_9.result(), SketchLine_12.result() +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_12.startPoint(), SketchLine_7.endPoint() +) +SketchLine_13 = Sketch_1.addLine( + 3.682682292205201, 1.561361948645557, 1.561361948645558, 3.6826822922052 +) SketchLine_13.setAuxiliary(True) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_13.endPoint()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchLine_13.endPoint() +) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_13.result(), 3) SketchConstraintLength_5.setName("SketchConstraintLength_7") -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_3.endPoint(), SketchLine_9.result(), 1.5, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_3.endPoint(), SketchLine_9.result(), 1.5, True +) 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_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")) +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/SketchLine_6_EndVertex"), 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/SketchLine_6_StartVertex"), False) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchPoint_7.result() +) +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()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchPoint_8.result() +) SketchLine_15 = Sketch_2.addLine(-6, 0, -6, -3.5) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) SketchLine_16 = Sketch_2.addLine(-6, -3.5, -6, -10.5) -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) +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&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), 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()) +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()) +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&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/To_Face]"), 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()) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_10).coordinates(), SketchLine_15.endPoint() +) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_18.result()) SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_16.result()) SketchLine_19 = Sketch_2.addLine(6, -10.5, -6, -10.5) SketchLine_19.setAuxiliary(True) -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_19.startPoint(), SketchLine_18.endPoint()) -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_16.endPoint()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_18.result(), SketchLine_16.result()) -SketchProjection_12 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchLine_19.startPoint(), SketchLine_18.endPoint() +) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchLine_19.endPoint(), SketchLine_16.endPoint() +) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_18.result(), SketchLine_16.result() +) +SketchProjection_12 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_20 = SketchProjection_12.createdFeature() model.do() @@ -153,19 +291,31 @@ lineEnd = [SketchLine_20.endPoint().x(), SketchLine_20.endPoint().y()] # Try to move a line provided by projection of OZ axis # move start point -Sketch_2.move(SketchLine_20.startPoint(), lineStart[0] + 1., lineStart[1] + 1.) +Sketch_2.move(SketchLine_20.startPoint(), lineStart[0] + 1.0, lineStart[1] + 1.0) model.do() -assert(SketchLine_20.startPoint().x() == lineStart[0] and SketchLine_20.startPoint().y() == lineStart[1]) +assert ( + SketchLine_20.startPoint().x() == lineStart[0] + and SketchLine_20.startPoint().y() == lineStart[1] +) # move end point -Sketch_2.move(SketchLine_20.endPoint(), lineEnd[0] + 1., lineEnd[1] + 1.) +Sketch_2.move(SketchLine_20.endPoint(), lineEnd[0] + 1.0, lineEnd[1] + 1.0) model.do() -assert(SketchLine_20.endPoint().x() == lineEnd[0] and SketchLine_20.endPoint().y() == lineEnd[1]) +assert ( + SketchLine_20.endPoint().x() == lineEnd[0] + and SketchLine_20.endPoint().y() == lineEnd[1] +) # move whole line -Sketch_2.move(SketchLine_20.result(), 50., 50.) +Sketch_2.move(SketchLine_20.result(), 50.0, 50.0) model.do() -assert(SketchLine_20.startPoint().x() == lineStart[0] and SketchLine_20.startPoint().y() == lineStart[1]) -assert(SketchLine_20.endPoint().x() == lineEnd[0] and SketchLine_20.endPoint().y() == lineEnd[1]) +assert ( + SketchLine_20.startPoint().x() == lineStart[0] + and SketchLine_20.startPoint().y() == lineStart[1] +) +assert ( + SketchLine_20.endPoint().x() == lineEnd[0] + and SketchLine_20.endPoint().y() == lineEnd[1] +) model.end() diff --git a/src/SketchPlugin/Test/Test2376.py b/src/SketchPlugin/Test/Test2376.py index 5e197c0fa..f5fea00e7 100644 --- a/src/SketchPlugin/Test/Test2376.py +++ b/src/SketchPlugin/Test/Test2376.py @@ -32,16 +32,22 @@ SketchLine_1 = Sketch_1.addLine(20, 25, 50, 25) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "OX"), False) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.endPoint(), SketchLine_2.result(), 25, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_1.endPoint(), SketchLine_2.result(), 25, True +) model.do() SKETCH_DOF = 2 model.checkSketch(Sketch_1, SKETCH_DOF) # add one more distance constraint, DoF should be the same -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_2.result(), 25, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_2.result(), 25, True +) model.do() -assert Sketch_1.solverError().value() != "", "FAILED: Sketch should report over-constrained situation" +assert ( + Sketch_1.solverError().value() != "" +), "FAILED: Sketch should report over-constrained situation" # remove last constraint partSet.removeFeature(SketchConstraintDistance_2.feature()) @@ -50,4 +56,4 @@ model.checkSketch(Sketch_1, SKETCH_DOF) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test2390.py b/src/SketchPlugin/Test/Test2390.py index 2bcfac8e0..997fe10b3 100644 --- a/src/SketchPlugin/Test/Test2390.py +++ b/src/SketchPlugin/Test/Test2390.py @@ -41,76 +41,155 @@ Param_Drill2DepthMax = 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) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 36) SketchLine_3 = Sketch_1.addLine(0, 36, 64, 36) SketchLine_4 = Sketch_1.addLine(64, 36, 64, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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_3.startPoint(), SketchLine_3.endPoint(), "Width") +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_3.startPoint(), SketchLine_3.endPoint(), "Width" +) 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()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_3.result() +) 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()) +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() +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_6.result()) -SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_2.endPoint(), SketchLine_5.startPoint(), "Width/32*11") -SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance(SketchLine_6.startPoint(), SketchLine_3.endPoint(), "Width/2") +SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance( + SketchLine_2.endPoint(), SketchLine_5.startPoint(), "Width/32*11" +) +SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance( + SketchLine_6.startPoint(), SketchLine_3.endPoint(), "Width/2" +) model.do() Sketch_4 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchLine_52 = Sketch_4.addLine(28.5, -19, 28.5, 0) -SketchProjection_12 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_12 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_53 = SketchProjection_12.createdFeature() -SketchConstraintCoincidence_47 = Sketch_4.setCoincident(SketchLine_52.endPoint(), SketchLine_53.result()) +SketchConstraintCoincidence_47 = Sketch_4.setCoincident( + SketchLine_52.endPoint(), SketchLine_53.result() +) SketchLine_54 = Sketch_4.addLine(28.5, 0, 29, 0) -SketchConstraintCoincidence_48 = Sketch_4.setCoincident(SketchLine_52.endPoint(), SketchLine_54.startPoint()) -SketchConstraintCoincidence_49 = Sketch_4.setCoincident(SketchLine_54.endPoint(), SketchLine_53.result()) +SketchConstraintCoincidence_48 = Sketch_4.setCoincident( + SketchLine_52.endPoint(), SketchLine_54.startPoint() +) +SketchConstraintCoincidence_49 = Sketch_4.setCoincident( + SketchLine_54.endPoint(), SketchLine_53.result() +) SketchLine_55 = Sketch_4.addLine(29, 0, 29, -11.5) -SketchConstraintCoincidence_50 = Sketch_4.setCoincident(SketchLine_54.endPoint(), SketchLine_55.startPoint()) +SketchConstraintCoincidence_50 = Sketch_4.setCoincident( + SketchLine_54.endPoint(), SketchLine_55.startPoint() +) SketchLine_56 = Sketch_4.addLine(28.5, -19, 29.9, -19) -SketchConstraintCoincidence_51 = Sketch_4.setCoincident(SketchLine_52.startPoint(), SketchLine_56.startPoint()) +SketchConstraintCoincidence_51 = Sketch_4.setCoincident( + SketchLine_52.startPoint(), SketchLine_56.startPoint() +) SketchLine_57 = Sketch_4.addLine(29.9, -19, 29.4, -18.5) -SketchConstraintCoincidence_52 = Sketch_4.setCoincident(SketchLine_56.endPoint(), SketchLine_57.startPoint()) +SketchConstraintCoincidence_52 = Sketch_4.setCoincident( + SketchLine_56.endPoint(), SketchLine_57.startPoint() +) SketchLine_58 = Sketch_4.addLine(29.4, -18.5, 29.4, -12.5) -SketchConstraintCoincidence_53 = Sketch_4.setCoincident(SketchLine_57.endPoint(), SketchLine_58.startPoint()) +SketchConstraintCoincidence_53 = Sketch_4.setCoincident( + SketchLine_57.endPoint(), SketchLine_58.startPoint() +) SketchArc_2 = Sketch_4.addArc(27.95, -12.5, 29.4, -12.5, 29, -11.5, False) -SketchConstraintCoincidence_54 = Sketch_4.setCoincident(SketchLine_58.endPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_55 = Sketch_4.setCoincident(SketchLine_55.endPoint(), SketchArc_2.endPoint()) +SketchConstraintCoincidence_54 = Sketch_4.setCoincident( + SketchLine_58.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_55 = Sketch_4.setCoincident( + SketchLine_55.endPoint(), SketchArc_2.endPoint() +) 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/SketchLine_5_EndVertex"), 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/SketchLine_3"), False) +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/SketchLine_3"), False +) SketchLine_59 = SketchProjection_14.createdFeature() -SketchConstraintAngle_6 = Sketch_4.setAngle(SketchLine_57.result(), SketchLine_56.result(), 45) +SketchConstraintAngle_6 = Sketch_4.setAngle( + SketchLine_57.result(), SketchLine_56.result(), 45 +) SketchConstraintLength_4 = Sketch_4.setLength(SketchLine_56.result(), "Drill2_Radius") -SketchConstraintMirror_2 = Sketch_4.addMirror(SketchLine_53.result(), [SketchLine_59.result()]) +SketchConstraintMirror_2 = Sketch_4.addMirror( + SketchLine_53.result(), [SketchLine_59.result()] +) [SketchLine_60] = SketchConstraintMirror_2.mirrored() SketchLine_60.setAuxiliary(True) -SketchConstraintCoincidence_56 = Sketch_4.setCoincident(SketchLine_56.startPoint(), SketchLine_60.result()) -SketchConstraintDistance_12 = Sketch_4.setDistance(SketchArc_2.endPoint(), SketchLine_60.result(), "Drill2_DepthMax", True) -SketchConstraintDistance_13 = Sketch_4.setDistance(SketchLine_58.endPoint(), SketchLine_60.result(), "Drill2_DepthMin", True) -SketchConstraintDistance_14 = Sketch_4.setDistance(SketchLine_57.endPoint(), SketchLine_60.result(), 0.5, True) -SketchConstraintTangent_3 = Sketch_4.setTangent(SketchLine_58.result(), SketchArc_2.results()[1]) +SketchConstraintCoincidence_56 = Sketch_4.setCoincident( + SketchLine_56.startPoint(), SketchLine_60.result() +) +SketchConstraintDistance_12 = Sketch_4.setDistance( + SketchArc_2.endPoint(), SketchLine_60.result(), "Drill2_DepthMax", True +) +SketchConstraintDistance_13 = Sketch_4.setDistance( + SketchLine_58.endPoint(), SketchLine_60.result(), "Drill2_DepthMin", True +) +SketchConstraintDistance_14 = Sketch_4.setDistance( + SketchLine_57.endPoint(), SketchLine_60.result(), 0.5, True +) +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_11f-SketchLine_12f-SketchLine_13f-SketchArc_1_2f-SketchLine_10r-SketchLine_9r-SketchLine_7r")], model.selection("EDGE", "Sketch_2/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 @@ -138,7 +217,9 @@ model.testNbSubShapes(Revolution_1, GeomAPI_Shape.SOLID, [1]) model.testNbSubShapes(Revolution_1, GeomAPI_Shape.FACE, [6]) model.testNbSubShapes(Revolution_1, GeomAPI_Shape.EDGE, [18]) model.testNbSubShapes(Revolution_1, GeomAPI_Shape.VERTEX, [36]) -model.testResultsVolumes(Revolution_1, [41.691543241529835484016075497], SIGNIFICANT_DIGITS) +model.testResultsVolumes( + Revolution_1, [41.691543241529835484016075497], SIGNIFICANT_DIGITS +) # Update Width parameter once again Param_Width.setValue(150) @@ -151,9 +232,11 @@ model.testNbSubShapes(Revolution_1, GeomAPI_Shape.SOLID, [1]) model.testNbSubShapes(Revolution_1, GeomAPI_Shape.FACE, [6]) model.testNbSubShapes(Revolution_1, GeomAPI_Shape.EDGE, [18]) model.testNbSubShapes(Revolution_1, GeomAPI_Shape.VERTEX, [36]) -model.testResultsVolumes(Revolution_1, [41.691543241529835484016075497], SIGNIFICANT_DIGITS) +model.testResultsVolumes( + Revolution_1, [41.691543241529835484016075497], SIGNIFICANT_DIGITS +) model.end() # TODO: uncomment following line when issue #2389 is fixed -#assert(model.checkPythonDump()) +# assert(model.checkPythonDump()) diff --git a/src/SketchPlugin/Test/Test2393.py b/src/SketchPlugin/Test/Test2393.py index 1540053ee..6f30e80e8 100644 --- a/src/SketchPlugin/Test/Test2393.py +++ b/src/SketchPlugin/Test/Test2393.py @@ -35,22 +35,32 @@ Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Top"), 10, False) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchLine_1.result()], SketchAPI_Point(SketchPoint_1).coordinates(), 90, 3 +) [SketchLine_1, SketchLine_2, SketchLine_3] = SketchMultiRotation_1.rotated() model.do() model.checkSketch(Sketch_1, 0) SketchLine_2 = SketchAPI_Line(SketchLine_2) -Sketch_1.move(SketchLine_2.startPoint(), SketchLine_2.startPoint().x() + 1, SketchLine_2.startPoint().y() + 1) +Sketch_1.move( + SketchLine_2.startPoint(), + SketchLine_2.startPoint().x() + 1, + SketchLine_2.startPoint().y() + 1, +) model.do() model.checkSketch(Sketch_1, 0) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test24015.py b/src/SketchPlugin/Test/Test24015.py index 1110d007f..690108bfa 100644 --- a/src/SketchPlugin/Test/Test24015.py +++ b/src/SketchPlugin/Test/Test24015.py @@ -30,20 +30,44 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) ### Create SketchLine -SketchLine_1 = Sketch_1.addLine(-62.43672548686145, -3.439140342201228, 39.05146750980462, 70.99404207935532) +SketchLine_1 = Sketch_1.addLine( + -62.43672548686145, -3.439140342201228, 39.05146750980462, 70.99404207935532 +) SketchLine_1.setAuxiliary(True) ### Create SketchEllipse -SketchEllipse_1 = Sketch_1.addEllipse(-11.02958888389993, 34.2637358599971, -5.505025597864623, 77.21113625278682, 25) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_2, SketchLine_3] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + -11.02958888389993, 34.2637358599971, -5.505025597864623, 77.21113625278682, 25 +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_2, + SketchLine_3, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) Sketch_1.setCoincident(SketchLine_1.result(), SketchEllipse_1.center()) Sketch_1.setLength(SketchLine_3.result(), 50) Sketch_1.setLength(SketchLine_2.result(), 100) ### Create SketchConstraintAngle -Sketch_1.setAngle(SketchLine_1.result(), SketchLine_2.result(), 0, type = "Direct") +Sketch_1.setAngle(SketchLine_1.result(), SketchLine_2.result(), 0, type="Direct") model.do() model.end() -assert(Sketch_1.feature().error() == "") +assert Sketch_1.feature().error() == "" diff --git a/src/SketchPlugin/Test/Test2425.py b/src/SketchPlugin/Test/Test2425.py index 0004265ba..6c74a1b53 100644 --- a/src/SketchPlugin/Test/Test2425.py +++ b/src/SketchPlugin/Test/Test2425.py @@ -33,40 +33,76 @@ SketchLine_1 = Sketch_1.addLine(10, 50, 20, 50) SketchLine_2 = Sketch_1.addLine(20, 50, 20, 60) SketchLine_3 = Sketch_1.addLine(20, 60, 10, 60) SketchLine_4 = Sketch_1.addLine(10, 60, 10, 50) -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()) +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(10, 10, 90, 10) -SketchMultiTranslation_1_objects = [SketchLine_2.result(), SketchLine_1.result(), SketchLine_3.result(), SketchLine_4.result()] -SketchMultiTranslation_1 = Sketch_1.addTranslation(SketchMultiTranslation_1_objects, SketchLine_5.startPoint(), SketchLine_5.endPoint(), "n", True) -[SketchLine_6, SketchLine_7, SketchLine_8, SketchLine_9, SketchLine_10, SketchLine_11, SketchLine_12, SketchLine_13, SketchLine_14, SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18, SketchLine_19, SketchLine_20, SketchLine_21] = SketchMultiTranslation_1.translated() +SketchMultiTranslation_1_objects = [ + SketchLine_2.result(), + SketchLine_1.result(), + SketchLine_3.result(), + SketchLine_4.result(), +] +SketchMultiTranslation_1 = Sketch_1.addTranslation( + SketchMultiTranslation_1_objects, + SketchLine_5.startPoint(), + SketchLine_5.endPoint(), + "n", + True, +) +[ + SketchLine_6, + SketchLine_7, + SketchLine_8, + SketchLine_9, + SketchLine_10, + SketchLine_11, + SketchLine_12, + SketchLine_13, + SketchLine_14, + SketchLine_15, + SketchLine_16, + SketchLine_17, + SketchLine_18, + SketchLine_19, + SketchLine_20, + SketchLine_21, +] = SketchMultiTranslation_1.translated() model.do() # change parameter, check original lines are not changed Param.setValue(3) -assert(SketchLine_1.startPoint().x() == 10 and SketchLine_1.startPoint().y() == 50) -assert(SketchLine_1.endPoint().x() == 20 and SketchLine_1.endPoint().y() == 50) -assert(SketchLine_2.startPoint().x() == 20 and SketchLine_2.startPoint().y() == 50) -assert(SketchLine_2.endPoint().x() == 20 and SketchLine_2.endPoint().y() == 60) -assert(SketchLine_3.startPoint().x() == 20 and SketchLine_3.startPoint().y() == 60) -assert(SketchLine_3.endPoint().x() == 10 and SketchLine_3.endPoint().y() == 60) -assert(SketchLine_4.startPoint().x() == 10 and SketchLine_4.startPoint().y() == 60) -assert(SketchLine_4.endPoint().x() == 10 and SketchLine_4.endPoint().y() == 50) +assert SketchLine_1.startPoint().x() == 10 and SketchLine_1.startPoint().y() == 50 +assert SketchLine_1.endPoint().x() == 20 and SketchLine_1.endPoint().y() == 50 +assert SketchLine_2.startPoint().x() == 20 and SketchLine_2.startPoint().y() == 50 +assert SketchLine_2.endPoint().x() == 20 and SketchLine_2.endPoint().y() == 60 +assert SketchLine_3.startPoint().x() == 20 and SketchLine_3.startPoint().y() == 60 +assert SketchLine_3.endPoint().x() == 10 and SketchLine_3.endPoint().y() == 60 +assert SketchLine_4.startPoint().x() == 10 and SketchLine_4.startPoint().y() == 60 +assert SketchLine_4.endPoint().x() == 10 and SketchLine_4.endPoint().y() == 50 model.end() # undo parameter changing, check original lines are not changed model.undo() -assert(SketchLine_1.startPoint().x() == 10 and SketchLine_1.startPoint().y() == 50) -assert(SketchLine_1.endPoint().x() == 20 and SketchLine_1.endPoint().y() == 50) -assert(SketchLine_2.startPoint().x() == 20 and SketchLine_2.startPoint().y() == 50) -assert(SketchLine_2.endPoint().x() == 20 and SketchLine_2.endPoint().y() == 60) -assert(SketchLine_3.startPoint().x() == 20 and SketchLine_3.startPoint().y() == 60) -assert(SketchLine_3.endPoint().x() == 10 and SketchLine_3.endPoint().y() == 60) -assert(SketchLine_4.startPoint().x() == 10 and SketchLine_4.startPoint().y() == 60) -assert(SketchLine_4.endPoint().x() == 10 and SketchLine_4.endPoint().y() == 50) +assert SketchLine_1.startPoint().x() == 10 and SketchLine_1.startPoint().y() == 50 +assert SketchLine_1.endPoint().x() == 20 and SketchLine_1.endPoint().y() == 50 +assert SketchLine_2.startPoint().x() == 20 and SketchLine_2.startPoint().y() == 50 +assert SketchLine_2.endPoint().x() == 20 and SketchLine_2.endPoint().y() == 60 +assert SketchLine_3.startPoint().x() == 20 and SketchLine_3.startPoint().y() == 60 +assert SketchLine_3.endPoint().x() == 10 and SketchLine_3.endPoint().y() == 60 +assert SketchLine_4.startPoint().x() == 10 and SketchLine_4.startPoint().y() == 60 +assert SketchLine_4.endPoint().x() == 10 and SketchLine_4.endPoint().y() == 50 diff --git a/src/SketchPlugin/Test/Test2427.py b/src/SketchPlugin/Test/Test2427.py index ca0f7dd84..05196a7b1 100644 --- a/src/SketchPlugin/Test/Test2427.py +++ b/src/SketchPlugin/Test/Test2427.py @@ -33,27 +33,55 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 9.085455512028094, 9.085455512028094) SketchLine_1.setAuxiliary(True) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_2.result(), SketchLine_1.result(), 45) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchAPI_Line(SketchLine_2).startPoint()) -SketchArc_1 = Sketch_1.addArc(0, 0, 3.427521359192312, 2.062061427864143, 2.06206142786378, 3.427521359191917, True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.center()) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_2.result(), SketchLine_1.result(), 45 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchAPI_Line(SketchLine_2).startPoint() +) +SketchArc_1 = Sketch_1.addArc( + 0, + 0, + 3.427521359192312, + 2.062061427864143, + 2.06206142786378, + 3.427521359191917, + True, +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_1.center() +) SketchLine_3 = Sketch_1.addLine(6, 7.365459931328136, 6, 12) SketchLine_4 = Sketch_1.addLine(6, 12, -6, 12) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(-6, 12, -6, 7.365459931328136) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 4) SketchLine_6 = Sketch_1.addLine(-5.8309518948453, -7.5, -11, -7.5) SketchLine_7 = Sketch_1.addLine(-11, -7.5, -11, -10) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(-11, -10, 11, -10) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(11, -10, 11, -7.5) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchLine_10 = Sketch_1.addLine(11, -7.5, 5.830951894845301, -7.5) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_10.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_8.result()) @@ -64,47 +92,115 @@ SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_8.result(), 22) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_4.result(), 12) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_4.result(), SketchLine_7.endPoint(), 22, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_4.result(), SketchLine_7.endPoint(), 22, True +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 2.5) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_2.result(), 10, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_2.result(), 10, True +) SketchPoint_1 = Sketch_1.addPoint(0, -10) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_8.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_8.result(), SketchPoint_1.coordinates()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_8.result() +) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchLine_8.result(), SketchPoint_1.coordinates() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_11 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_11.result(), SketchPoint_1.coordinates()) -SketchLine_12 = Sketch_1.addLine(2.06206142786378, 3.427521359191917, 6, 7.365459931328136) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_3.startPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_12.result(), SketchLine_1.result()) -SketchLine_13 = Sketch_1.addLine(3.427521359192312, 2.062061427864143, 8.000256151511394, 5.123075395720331) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_13.startPoint()) -SketchArc_2 = Sketch_1.addArc(0, 0, 8.000256151511394, 5.123075395720331, 5.830951894845301, -7.5, True) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_2.center()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_13.endPoint()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_2.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_11.result(), SketchPoint_1.coordinates() +) +SketchLine_12 = Sketch_1.addLine( + 2.06206142786378, 3.427521359191917, 6, 7.365459931328136 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_12.result(), SketchLine_1.result() +) +SketchLine_13 = Sketch_1.addLine( + 3.427521359192312, 2.062061427864143, 8.000256151511394, 5.123075395720331 +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_13.startPoint() +) +SketchArc_2 = Sketch_1.addArc( + 0, 0, 8.000256151511394, 5.123075395720331, 5.830951894845301, -7.5, True +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_2.center() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_13.endPoint() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchArc_2.endPoint() +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 9.5) -SketchLine_14 = Sketch_1.addLine(3.427521359192312, 2.062061427864143, 2.06206142786378, 3.427521359191917) +SketchLine_14 = Sketch_1.addLine( + 3.427521359192312, 2.062061427864143, 2.06206142786378, 3.427521359191917 +) SketchLine_14.setAuxiliary(True) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchArc_1.endPoint() +) SketchPoint_2 = Sketch_1.addPoint(2.744791393527834, 2.744791393527835) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_14.result()) -SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint(SketchLine_14.result(), SketchPoint_2.coordinates()) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_14.result(), SketchPoint_2.coordinates()) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.result()) -SketchArc_3 = Sketch_1.addArc(0, 0, -6, 7.365459931328136, -5.8309518948453, -7.5, False) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchArc_3.startPoint()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchArc_3.endPoint()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_2.results()[1], SketchArc_3.results()[1]) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_14.result() +) +SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint( + SketchLine_14.result(), SketchPoint_2.coordinates() +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_14.result(), SketchPoint_2.coordinates() +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_1.result() +) +SketchArc_3 = Sketch_1.addArc( + 0, 0, -6, 7.365459931328136, -5.8309518948453, -7.5, False +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchArc_3.endPoint() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) SketchPoint_3 = Sketch_1.addPoint(0, 12) -SketchConstraintMiddle_3 = Sketch_1.setMiddlePoint(SketchLine_4.result(), SketchPoint_3.coordinates()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_11.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_7.result(), SketchLine_9.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_6.result(), SketchLine_10.result()) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_5.result()) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_13.endPoint(), SketchLine_12.result(), 3, True) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_1.result()) +SketchConstraintMiddle_3 = Sketch_1.setMiddlePoint( + SketchLine_4.result(), SketchPoint_3.coordinates() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_11.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_7.result(), SketchLine_9.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_6.result(), SketchLine_10.result() +) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_5.result() +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_13.endPoint(), SketchLine_12.result(), 3, True +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_1.result() +) model.do() model.end() @@ -128,4 +224,4 @@ model.do() model.end() model.checkSketch(Sketch_1) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test2440.py b/src/SketchPlugin/Test/Test2440.py index d6989ea3c..b4630fc5d 100644 --- a/src/SketchPlugin/Test/Test2440.py +++ b/src/SketchPlugin/Test/Test2440.py @@ -43,21 +43,28 @@ 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/Shape_2"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "profile_top_1/Shape_2"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() model.do() -assert(SketchProjection_1.feature().error() == "") +assert SketchProjection_1.feature().error() == "" -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates() +) model.do() -assert(SketchConstraintCoincidence_1.feature().error() == "") -assert(Sketch_1.feature().error() == "") -assert(Sketch_1.solverError().value() == "") +assert SketchConstraintCoincidence_1.feature().error() == "" +assert Sketch_1.feature().error() == "" +assert Sketch_1.solverError().value() == "" REF_POINT = [-0.0215, 0.5492] -TOLERANCE = 1.e-7 -assert(fabs(SketchLine_1.endPoint().x() - REF_POINT[0]) < TOLERANCE and fabs(SketchLine_1.endPoint().y() - REF_POINT[1]) < TOLERANCE) +TOLERANCE = 1.0e-7 +assert ( + fabs(SketchLine_1.endPoint().x() - REF_POINT[0]) < TOLERANCE + and fabs(SketchLine_1.endPoint().y() - REF_POINT[1]) < TOLERANCE +) model.end() diff --git a/src/SketchPlugin/Test/Test2481.py b/src/SketchPlugin/Test/Test2481.py index 32a753726..9e360307e 100644 --- a/src/SketchPlugin/Test/Test2481.py +++ b/src/SketchPlugin/Test/Test2481.py @@ -35,25 +35,37 @@ SketchLine_1 = Sketch_1.addLine(70, 0, 0, 0) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 45) SketchLine_3 = Sketch_1.addLine(0, 45, 70, 45) SketchLine_4 = Sketch_1.addLine(70, 45, 70, 0) -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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.startPoint() +) model.do() SketchFillet_1 = Sketch_1.setFillet(SketchAPI_Point(SketchPoint_1).coordinates()) model.do() -assert(Sketch_1.feature().error() == "") -assert(Sketch_1.solverError().value() == "") +assert Sketch_1.feature().error() == "" +assert Sketch_1.solverError().value() == "" model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test2654.py b/src/SketchPlugin/Test/Test2654.py index aaa829037..36aa3e22e 100644 --- a/src/SketchPlugin/Test/Test2654.py +++ b/src/SketchPlugin/Test/Test2654.py @@ -32,32 +32,62 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "h", "3.5") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchLine_1 = Sketch_1.addLine(-5.833254622789047, -7.49820915323854, -11, -7.49820915323854) +SketchLine_1 = Sketch_1.addLine( + -5.833254622789047, -7.49820915323854, -11, -7.49820915323854 +) SketchLine_2 = Sketch_1.addLine(-11, -7.49820915323854, -11, -9.998209153238539) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_4") SketchLine_3 = Sketch_1.addLine(-11, -9.998209153238539, 11, -9.998209153238539) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_5") SketchLine_4 = Sketch_1.addLine(11, -9.998209153238539, 11, -7.49820915323854) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_6") -SketchLine_5 = Sketch_1.addLine(11, -7.49820915323854, 5.833254622789045, -7.49820915323854) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchLine_5 = Sketch_1.addLine( + 11, -7.49820915323854, 5.833254622789045, -7.49820915323854 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_7") -SketchLine_6 = Sketch_1.addLine(-5.994422407538528, 7.37, -5.994422407538528, 12.00179084676146) -SketchLine_7 = Sketch_1.addLine(-5.994422407538528, 12.00179084676146, 6.005577592461473, 12.00179084676146) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchLine_6 = Sketch_1.addLine( + -5.994422407538528, 7.37, -5.994422407538528, 12.00179084676146 +) +SketchLine_7 = Sketch_1.addLine( + -5.994422407538528, 12.00179084676146, 6.005577592461473, 12.00179084676146 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_10") -SketchLine_8 = Sketch_1.addLine(6.005577592461473, 12.00179084676146, 6.005577592461473, 8.12179084676146) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchLine_8 = Sketch_1.addLine( + 6.005577592461473, 12.00179084676146, 6.005577592461473, 8.12179084676146 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_11") -SketchLine_9 = Sketch_1.addLine(6.005577592461473, 8.12179084676146, 1.564947006609954, 3.681160260909941) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchLine_9 = Sketch_1.addLine( + 6.005577592461473, 8.12179084676146, 1.564947006609954, 3.681160260909941 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_12") -SketchLine_10 = Sketch_1.addLine(3.684201429703701, 1.557773996884403, 7.696054479856212, 5.569627047036913) +SketchLine_10 = Sketch_1.addLine( + 3.684201429703701, 1.557773996884403, 7.696054479856212, 5.569627047036913 +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) @@ -66,101 +96,244 @@ SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintHorizontal_3.setName("SketchConstraintHorizontal_4") -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_9.result(), SketchLine_10.result()) -SketchArc_1 = Sketch_1.addArc(0, 0, 1.564947006609954, 3.681160260909941, 3.684201429703701, 1.557773996884403, False) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center()) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_9.result(), SketchLine_10.result() +) +SketchArc_1 = Sketch_1.addArc( + 0, + 0, + 1.564947006609954, + 3.681160260909941, + 3.684201429703701, + 1.557773996884403, + False, +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchArc_1.center() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_8") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchArc_1.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchArc_1.startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_16") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_10.startPoint(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_10.startPoint(), SketchArc_1.endPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_17") -SketchArc_2 = Sketch_1.addArc(0, 0, -5.994422407538528, 7.37, -5.833254622789047, -7.49820915323854, False) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_2.center()) +SketchArc_2 = Sketch_1.addArc( + 0, 0, -5.994422407538528, 7.37, -5.833254622789047, -7.49820915323854, False +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_2.center() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_13") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchArc_2.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchArc_2.startPoint() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_18") SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_8.result(), 3.88) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_7.result(), 12) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_9.result(), 6.28) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_11 = SketchProjection_2.createdFeature() SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 4) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 9.5) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_5.result(), SketchLine_1.result()) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_5.result(), SketchLine_1.result() +) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_3.result(), 22) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_4.result(), 2.5) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_6.endPoint(), SketchLine_2.endPoint(), 22) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_11.result(), SketchLine_10.result(), 45) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.startPoint(), SketchLine_10.result(), 3, True) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_6.endPoint(), SketchLine_2.endPoint(), 22 +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_11.result(), SketchLine_10.result(), 45 +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.startPoint(), SketchLine_10.result(), 3, True +) SketchLine_12 = Sketch_1.addLine(0, -9.998209153238539, 0, 0) SketchLine_12.setAuxiliary(True) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_12.startPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_12.startPoint(), SketchLine_3.result() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_20") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_12.endPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_12.endPoint() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_21") SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_12.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_3.result(), SketchLine_12.startPoint()) -SketchArc_3 = Sketch_1.addArc(0, 0, 5.833254622789045, -7.49820915323854, 7.696054479856212, 5.569627047036913, False) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_3.endPoint()) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchLine_3.result(), SketchLine_12.startPoint() +) +SketchArc_3 = Sketch_1.addArc( + 0, + 0, + 5.833254622789045, + -7.49820915323854, + 7.696054479856212, + 5.569627047036913, + False, +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchArc_3.endPoint() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_19") -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_2.results()[1], SketchArc_3.results()[1]) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_2.center(), SketchArc_3.center()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchArc_3.center() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_22") -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchArc_3.startPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchArc_3.startPoint() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_24") -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_2.endPoint()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_2.endPoint() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_23") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_11.result(), SketchArc_2.startPoint(), 7.37, True) +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-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) +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&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"), 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&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/To_Face]"), 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()) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_13.startPoint() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_25") -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_13.endPoint()) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_13.endPoint() +) 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 = 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&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), 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 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchPoint_5.result() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_28") SketchLine_15 = Sketch_2.addLine(-5.994422407538528, -3.5, -5.994422407538528, -10.5) -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_29") SketchLine_16 = Sketch_2.addLine(6.005577592461473, 0, 6.005577592461473, -3.5) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_16.startPoint() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_30") -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_16.endPoint()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_16.endPoint() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_31") SketchLine_17 = Sketch_2.addLine(6.005577592461473, -3.5, 6.005577592461473, -10.5) -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_32") -SketchArc_4 = Sketch_2.addArc(0.005577592461472826, -10.5, -5.994422407538528, -10.5, 6.005577592461473, -10.5, False) +SketchArc_4 = Sketch_2.addArc( + 0.005577592461472826, + -10.5, + -5.994422407538528, + -10.5, + 6.005577592461473, + -10.5, + False, +) SketchArc_4.setName("SketchArc_5") SketchArc_4.result().setName("SketchArc_5") SketchArc_4.results()[1].setName("SketchArc_5_2") -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchArc_4.startPoint()) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchLine_15.endPoint(), SketchArc_4.startPoint() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_35") -SketchConstraintTangent_1 = Sketch_2.setTangent(SketchLine_15.result(), SketchArc_4.results()[1]) +SketchConstraintTangent_1 = Sketch_2.setTangent( + SketchLine_15.result(), SketchArc_4.results()[1] +) SketchConstraintTangent_1.setName("SketchConstraintTangent_2") -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_17.result(), SketchArc_4.endPoint()) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchLine_17.result(), SketchArc_4.endPoint() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_36") -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchArc_4.endPoint(), SketchLine_17.endPoint()) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchArc_4.endPoint(), SketchLine_17.endPoint() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_33") -SketchConstraintParallel_2 = Sketch_2.setParallel(SketchLine_17.result(), SketchLine_15.result()) +SketchConstraintParallel_2 = Sketch_2.setParallel( + SketchLine_17.result(), SketchLine_15.result() +) 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()) +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-SketchArc_5_2f-SketchLine_17r-SketchLine_16r")], 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() @@ -171,7 +344,7 @@ Split_1 = Sketch_2.addSplit(SketchLine_17, geom.Pnt2d(6.005577592461473, -7)) model.do() # Check the split leads to sketch failure -assert(Split_1.feature().error() != "") +assert Split_1.feature().error() != "" # Remove the split feature Part_1_doc.removeFeature(Split_1.feature()) @@ -179,4 +352,4 @@ model.do() model.checkSketch(Sketch_2, 0) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test2711.py b/src/SketchPlugin/Test/Test2711.py index 3a47439ca..ba04af8d2 100644 --- a/src/SketchPlugin/Test/Test2711.py +++ b/src/SketchPlugin/Test/Test2711.py @@ -33,16 +33,28 @@ partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(-0.4, -0.45, 3.6, -0.45) SketchLine_2 = Sketch_1.addLine(3.6, -0.45, 3.6, 0.2) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(3.6, 0.2, 0.25, 0.2) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(0.25, 0.2, 0.25, 3.55) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(0.25, 3.55, -0.4, 3.55) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(-0.4, 3.55, -0.4, -0.45) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.endPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_6.endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_6.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_2.result()) @@ -55,16 +67,22 @@ SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_6.result(), 4) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_1.result(), 4) SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "OY"), False) SketchLine_7 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_7.result(), 0.4, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchLine_7.result(), 0.4, True +) SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "OX"), False) SketchLine_8 = SketchProjection_2.createdFeature() -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.startPoint(), SketchLine_8.result(), 0.2, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_3.startPoint(), SketchLine_8.result(), 0.2, True +) model.do() model.checkSketch(Sketch_1, 0) SketchPoint_1 = Sketch_1.addPoint(2, 0.2) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_3.result()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_3.result() +) model.do() model.checkSketch(Sketch_1, 1) @@ -74,9 +92,13 @@ model.do() model.checkSketch(Sketch_1, 2) -SketchLine_9 = SketchAPI_Line(model.lastSubFeature(featureToCompositeFeature(Sketch_1.feature()), "SketchLine")) +SketchLine_9 = SketchAPI_Line( + model.lastSubFeature(featureToCompositeFeature(Sketch_1.feature()), "SketchLine") +) SketchPoint_2 = Sketch_1.addPoint(3, 0.2) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_9.result()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_9.result() +) model.do() model.checkSketch(Sketch_1, 3) @@ -88,4 +110,4 @@ model.checkSketch(Sketch_1, 4) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test2741.py b/src/SketchPlugin/Test/Test2741.py index 18826dd25..d2afc5aab 100644 --- a/src/SketchPlugin/Test/Test2741.py +++ b/src/SketchPlugin/Test/Test2741.py @@ -28,10 +28,18 @@ 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) +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 diff --git a/src/SketchPlugin/Test/Test2810.py b/src/SketchPlugin/Test/Test2810.py index f5b3ffbff..685c1609f 100644 --- a/src/SketchPlugin/Test/Test2810.py +++ b/src/SketchPlugin/Test/Test2810.py @@ -36,12 +36,14 @@ 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()) +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() != "") +assert Sketch_1.feature().error() != "" model.end() diff --git a/src/SketchPlugin/Test/Test2824.py b/src/SketchPlugin/Test/Test2824.py index 91e285756..8829a3645 100644 --- a/src/SketchPlugin/Test/Test2824.py +++ b/src/SketchPlugin/Test/Test2824.py @@ -28,22 +28,38 @@ from GeomDataAPI import * import math -TOLERANCE = 1.e-6 +TOLERANCE = 1.0e-6 model.begin() partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOZ")) -SketchArc_1 = Sketch_1.addArc(7.554548355024374, 9.322927740745062, 20, 30.60489708262655, 31.5458454490763, 15, True) +SketchArc_1 = Sketch_1.addArc( + 7.554548355024374, + 9.322927740745062, + 20, + 30.60489708262655, + 31.5458454490763, + 15, + True, +) SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "OZ"), False) SketchLine_1 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.startPoint(), SketchLine_1.result(), 20, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.startPoint(), SketchLine_1.result(), 20, True +) SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "OX"), False) SketchLine_2 = SketchProjection_2.createdFeature() -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchArc_1.endPoint(), SketchLine_2.result(), 15, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchArc_1.endPoint(), SketchLine_2.result(), 15, True +) model.do() # move the arc like the user does for i in range(0, 10): - Sketch_1.move(SketchArc_1.startPoint(), SketchArc_1.startPoint().x(), SketchArc_1.startPoint().y() + 5) + Sketch_1.move( + SketchArc_1.startPoint(), + SketchArc_1.startPoint().x(), + SketchArc_1.startPoint().y() + 5, + ) model.end() model.undo() @@ -56,9 +72,9 @@ aShapeExplorer = GeomAPI_ShapeExplorer(anArcShape, GeomAPI_Shape.VERTEX) aPoint = aShapeExplorer.current().vertex().point() aEndShapeX = aPoint.x() -assert(math.fabs(aEndAttrX - aEndShapeX) < TOLERANCE) +assert math.fabs(aEndAttrX - aEndShapeX) < TOLERANCE aShapeExplorer.next() aPoint = aShapeExplorer.current().vertex().point() -aStartShapeY = aPoint.z() # in 3D sketch y iz Z -assert(math.fabs(aStartAttrY - aStartShapeY) < TOLERANCE) +aStartShapeY = aPoint.z() # in 3D sketch y iz Z +assert math.fabs(aStartAttrY - aStartShapeY) < TOLERANCE diff --git a/src/SketchPlugin/Test/Test2860.py b/src/SketchPlugin/Test/Test2860.py index 4b2d619a1..dafe318ad 100644 --- a/src/SketchPlugin/Test/Test2860.py +++ b/src/SketchPlugin/Test/Test2860.py @@ -29,13 +29,19 @@ from SketchAPI import * model.begin() partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(-9.326798599059195, -0.7578903795715272, 33.09960827213365, 41.66851649162133) +SketchLine_1 = Sketch_1.addLine( + -9.326798599059195, -0.7578903795715272, 33.09960827213365, 41.66851649162133 +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 60) SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "OY"), False) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_2.result(), 45) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_1.endPoint(), 5) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_2.result(), 45 +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_1.endPoint(), 5 +) model.do() model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test2894.py b/src/SketchPlugin/Test/Test2894.py index f1ee25104..9c27bdda2 100644 --- a/src/SketchPlugin/Test/Test2894.py +++ b/src/SketchPlugin/Test/Test2894.py @@ -31,23 +31,45 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchLine_1 = Sketch_1.addLine(5.899967103122234, 12, -6.100032896877766, 12) -SketchLine_2 = Sketch_1.addLine(-6.100032896877766, 12, -6.100032896877766, 7.282829028407098) -SketchLine_3 = Sketch_1.addLine(5.899967103122234, 8.178211638264205, 5.899967103122234, 12) +SketchLine_2 = Sketch_1.addLine( + -6.100032896877766, 12, -6.100032896877766, 7.282829028407098 +) +SketchLine_3 = Sketch_1.addLine( + 5.899967103122234, 8.178211638264205, 5.899967103122234, 12 +) SketchLine_3.setName("SketchLine_4") SketchLine_3.result().setName("SketchLine_4") -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = 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()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 12) -SketchArc_1 = Sketch_1.addArc(0, 0, -6.100032896877766, 7.282829028407098, -5.830951894845431, -7.499999999999899, False) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center()) +SketchArc_1 = Sketch_1.addArc( + 0, + 0, + -6.100032896877766, + 7.282829028407098, + -5.830951894845431, + -7.499999999999899, + False, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchArc_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 9.5) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchArc_1.startPoint() +) SketchLine_4 = Sketch_1.addLine(11, -7.5, 5.830951894845414, -7.49999999999991) SketchLine_4.setName("SketchLine_5") SketchLine_4.result().setName("SketchLine_5") @@ -60,64 +82,122 @@ SketchLine_6.result().setName("SketchLine_7") SketchLine_7 = Sketch_1.addLine(11, -10, 11, -7.5) SketchLine_7.setName("SketchLine_8") SketchLine_7.result().setName("SketchLine_8") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_5.result(), 2.5) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_6.result(), 22) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_6.result(), 22, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_6.result(), 10, True) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_5.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 11) -SketchArc_2 = Sketch_1.addArc(0, 0, 5.830951894845414, -7.49999999999991, 7.627518755950849, 5.663122603973648, False) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_1.results()[1], SketchArc_2.results()[1]) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.center(), SketchArc_2.center()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_2.startPoint(), SketchLine_6.result(), 22, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_6.result(), 10, True +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_5.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 11 +) +SketchArc_2 = Sketch_1.addArc( + 0, + 0, + 5.830951894845414, + -7.49999999999991, + 7.627518755950849, + 5.663122603973648, + False, +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchArc_1.results()[1], SketchArc_2.results()[1] +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchArc_2.center() +) SketchLine_8 = Sketch_1.addLine(-5.830951894845431, -7.499999999999899, -11, -7.5) SketchLine_8.setName("SketchLine_9") SketchLine_8.result().setName("SketchLine_9") -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_4.result(), SketchLine_8.result()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_4.endPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_8.startPoint()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_4.result(), SketchLine_8.result() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_4.endPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_8.startPoint() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_9 = SketchProjection_2.createdFeature() SketchLine_9.setName("SketchLine_11") SketchLine_9.result().setName("SketchLine_11") -SketchLine_10 = Sketch_1.addLine(7.627518755950849, 5.663122603973648, 3.634350614531546, 1.669954462554345) +SketchLine_10 = Sketch_1.addLine( + 7.627518755950849, 5.663122603973648, 3.634350614531546, 1.669954462554345 +) SketchLine_10.setName("SketchLine_13") SketchLine_10.result().setName("SketchLine_13") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_10.startPoint(), SketchArc_2.endPoint()) -SketchLine_11 = Sketch_1.addLine(1.446475147749155, 3.724719682891128, 5.899967103122234, 8.178211638264205) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_10.startPoint(), SketchArc_2.endPoint() +) +SketchLine_11 = Sketch_1.addLine( + 1.446475147749155, 3.724719682891128, 5.899967103122234, 8.178211638264205 +) SketchLine_11.setName("SketchLine_14") SketchLine_11.result().setName("SketchLine_14") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_11.endPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_11.result(), SketchLine_10.result()) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_11.endPoint(), SketchLine_10.result(), 3, True) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_11.endPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_11.result(), SketchLine_10.result() +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_11.endPoint(), SketchLine_10.result(), 3, True +) SketchLine_12 = Sketch_1.addLine(0, 0, 6.816423472140706, 6.816423472140705) SketchLine_12.setName("SketchLine_12") SketchLine_12.result().setName("SketchLine_12") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_12.startPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_9.result(), SketchLine_12.result(), 45) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_12.result(), SketchLine_11.result()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_12.startPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_9.result(), SketchLine_12.result(), 45 +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_12.result(), SketchLine_11.result() +) SketchCircle_1 = Sketch_1.addCircle(0, 0, 4) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center() +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchCircle_1.results()[1], 4) model.do() # Perform first trim -SketchTrim = Sketch_1.addTrim(SketchCircle_1, GeomAPI.GeomAPI_Pnt2d(3.31110220786, 2.24423754741)) +SketchTrim = Sketch_1.addTrim( + SketchCircle_1, GeomAPI.GeomAPI_Pnt2d(3.31110220786, 2.24423754741) +) SketchTrim.execute() model.do() # Check trim does not crash if the selected point is not in specified edge aLastArc = model.lastSubFeature(Sketch_1, "SketchArc") -SketchTrim = Sketch_1.addTrim(aLastArc, GeomAPI.GeomAPI_Pnt2d(3.31110220786, 2.24423754741)) +SketchTrim = Sketch_1.addTrim( + aLastArc, GeomAPI.GeomAPI_Pnt2d(3.31110220786, 2.24423754741) +) SketchTrim.execute() model.do() model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test3019.py b/src/SketchPlugin/Test/Test3019.py index 6855949b9..23cf0a07a 100644 --- a/src/SketchPlugin/Test/Test3019.py +++ b/src/SketchPlugin/Test/Test3019.py @@ -37,28 +37,68 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(15, -8.660254037843767, 15, 8.660254037843762) SketchLine_2 = Sketch_1.addLine(15, 8.660254037843762, 0, 0) SketchLine_2.setAuxiliary(True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(0, 0, 15, -8.660254037843767) SketchLine_3.setAuxiliary(True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_1.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_1.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_1.result() +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.startPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.startPoint(), SketchLine_1.result(), "k/2", True) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_1.result()], SketchLine_3.startPoint(), 360, 6, True) -[SketchLine_4, SketchLine_5, SketchLine_6, SketchLine_7, SketchLine_8] = SketchMultiRotation_1.rotated() +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.startPoint(), SketchLine_1.result(), "k/2", True +) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchLine_1.result()], SketchLine_3.startPoint(), 360, 6, True +) +[ + SketchLine_4, + SketchLine_5, + SketchLine_6, + SketchLine_7, + SketchLine_8, +] = SketchMultiRotation_1.rotated() SketchCircle_1 = Sketch_1.addCircle(0, 0, 10) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "M") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_3.startPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchCircle_1_2r")], model.selection(), "h", 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchCircle_1_2r", + ) + ], + model.selection(), + "h", + 0, +) Point_2 = model.addPoint(Part_1_doc, "0", "0", "h/2") Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "Point_1"), 19.5) -Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Sphere_1_1")]) +Common_1 = model.addCommon( + Part_1_doc, + [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Sphere_1_1")], +) Folder_1 = model.addFolder(Part_1_doc, Sketch_1, Extrusion_1) Folder_2 = model.addFolder(Part_1_doc, Point_2, Sphere_1) model.end() @@ -71,4 +111,4 @@ model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [114]) model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [228]) model.testResultsVolumes(Common_1, [9302.86764641653]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test3087_1.py b/src/SketchPlugin/Test/Test3087_1.py index c35d54b44..57c326358 100644 --- a/src/SketchPlugin/Test/Test3087_1.py +++ b/src/SketchPlugin/Test/Test3087_1.py @@ -22,6 +22,7 @@ from salome.shaper import model from EventsAPI import * from ModelAPI import * + class FreeShapesListener(EventsAPI.Events_Listener): def __init__(self): Events_Listener.__init__(self) @@ -35,7 +36,7 @@ class FreeShapesListener(EventsAPI.Events_Listener): def processEvent(self, theMessage): message = messageToUpdatedMessage(theMessage) objs = message.objects() - assert(len(objs) == 3) + assert len(objs) == 3 self.myEventProcessed = True @@ -48,18 +49,22 @@ if __name__ == "__main__": Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(10, 10, -10, 10) SketchLine_2 = Sketch_1.addLine(-10, 10, -10, -10) - SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) + SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() + ) SketchLine_3 = Sketch_1.addLine(-10, -10, 10, -10) - SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) + SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() + ) SketchConstraintRigid_1 = Sketch_1.setFixed(SketchLine_1.startPoint()) SketchConstraintRigid_2 = Sketch_1.setFixed(SketchLine_3.endPoint()) model.end() # send message to find the free shapes in the sketch event = Events_Loop.eventByName("GetDoFObjects") - ModelAPI_EventCreator.get().sendUpdated(Sketch_1.feature(), event); - Events_Loop.loop().flush(event); + ModelAPI_EventCreator.get().sendUpdated(Sketch_1.feature(), event) + Events_Loop.loop().flush(event) - assert(listener.myEventProcessed) + assert listener.myEventProcessed # explicitly remove the listener to improve code coverage listener.__del__() diff --git a/src/SketchPlugin/Test/Test3087_2.py b/src/SketchPlugin/Test/Test3087_2.py index b53c2bc50..83fe74621 100644 --- a/src/SketchPlugin/Test/Test3087_2.py +++ b/src/SketchPlugin/Test/Test3087_2.py @@ -22,6 +22,7 @@ from salome.shaper import model from EventsAPI import * from ModelAPI import * + class FreeShapesListener(EventsAPI.Events_Listener): def __init__(self): Events_Listener.__init__(self) @@ -35,7 +36,7 @@ class FreeShapesListener(EventsAPI.Events_Listener): def processEvent(self, theMessage): message = messageToUpdatedMessage(theMessage) objs = message.objects() - assert(len(objs) == 4) + assert len(objs) == 4 self.myEventProcessed = True @@ -48,21 +49,27 @@ if __name__ == "__main__": Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(10, 10, -10, 10) SketchLine_2 = Sketch_1.addLine(-10, 10, -10, -10) - SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) + SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() + ) SketchLine_3 = Sketch_1.addLine(-10, -10, 10, -10) - SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) + SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() + ) SketchConstraintRigid_1 = Sketch_1.setFixed(SketchLine_1.startPoint()) SketchConstraintRigid_2 = Sketch_1.setFixed(SketchLine_3.endPoint()) SketchCircle_1 = Sketch_1.addCircle(-10, 10, 10) - SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.center()) + SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.center() + ) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10) model.end() # send message to find the free shapes in the sketch event = Events_Loop.eventByName("GetDoFObjects") - ModelAPI_EventCreator.get().sendUpdated(Sketch_1.feature(), event); - Events_Loop.loop().flush(event); + ModelAPI_EventCreator.get().sendUpdated(Sketch_1.feature(), event) + Events_Loop.loop().flush(event) - assert(listener.myEventProcessed) + assert listener.myEventProcessed # explicitly remove the listener to improve code coverage listener.__del__() diff --git a/src/SketchPlugin/Test/Test3132.py b/src/SketchPlugin/Test/Test3132.py index 12626cf6e..97f235f65 100644 --- a/src/SketchPlugin/Test/Test3132.py +++ b/src/SketchPlugin/Test/Test3132.py @@ -33,35 +33,109 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(ELL_CENTER_X, ELL_CENTER_Y, ELL_CENTER_X + math.sqrt(ELL_MAJOR_RAD**2 + ELL_MINOR_RAD**2), ELL_CENTER_Y, ELL_MINOR_RAD) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + ELL_CENTER_X, + ELL_CENTER_Y, + ELL_CENTER_X + math.sqrt(ELL_MAJOR_RAD**2 + ELL_MINOR_RAD**2), + ELL_CENTER_Y, + ELL_MINOR_RAD, +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) model.do() -assert(model.dof(Sketch_1) == DOF_1) +assert model.dof(Sketch_1) == DOF_1 # trim the ellipse -ANGLE = math.pi/4 -Sketch_1.addTrim(SketchEllipse_1.feature(), GeomAPI_Pnt2d(ELL_CENTER_X + ELL_MAJOR_RAD * math.cos(ANGLE), ELL_CENTER_Y + ELL_MINOR_RAD * math.sin(ANGLE))) +ANGLE = math.pi / 4 +Sketch_1.addTrim( + SketchEllipse_1.feature(), + GeomAPI_Pnt2d( + ELL_CENTER_X + ELL_MAJOR_RAD * math.cos(ANGLE), + ELL_CENTER_Y + ELL_MINOR_RAD * math.sin(ANGLE), + ), +) model.do() -assert(model.dof(Sketch_1) == DOF_1) +assert model.dof(Sketch_1) == DOF_1 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchEllipse_2 = Sketch_2.addEllipse(ELL_CENTER_X, ELL_CENTER_Y, ELL_CENTER_X + math.sqrt(ELL_MAJOR_RAD**2 + ELL_MINOR_RAD**2), ELL_CENTER_Y, ELL_MINOR_RAD) -[SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11, SketchPoint_12, SketchPoint_13, SketchPoint_14, SketchLine_3, SketchLine_4] = SketchEllipse_2.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchLine_5 = Sketch_2.addLine(15.23538168732762, 24.77570901315218, 37.44845404222143, 43.05543771157006) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchEllipse_2.result()) -SketchLine_6 = Sketch_2.addLine(37.44845404222143, 43.05543771157006, 37.66137837703927, 15.83721541173749) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchEllipse_2.result()) +SketchEllipse_2 = Sketch_2.addEllipse( + ELL_CENTER_X, + ELL_CENTER_Y, + ELL_CENTER_X + math.sqrt(ELL_MAJOR_RAD**2 + ELL_MINOR_RAD**2), + ELL_CENTER_Y, + ELL_MINOR_RAD, +) +[ + SketchPoint_8, + SketchPoint_9, + SketchPoint_10, + SketchPoint_11, + SketchPoint_12, + SketchPoint_13, + SketchPoint_14, + SketchLine_3, + SketchLine_4, +] = SketchEllipse_2.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchLine_5 = Sketch_2.addLine( + 15.23538168732762, 24.77570901315218, 37.44845404222143, 43.05543771157006 +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_5.startPoint(), SketchEllipse_2.result() +) +SketchLine_6 = Sketch_2.addLine( + 37.44845404222143, 43.05543771157006, 37.66137837703927, 15.83721541173749 +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchEllipse_2.result() +) model.do() -assert(model.dof(Sketch_2) == DOF_2) +assert model.dof(Sketch_2) == DOF_2 # split the ellipse -Sketch_2.addSplit(SketchEllipse_2.feature(), GeomAPI_Pnt2d(ELL_CENTER_X + ELL_MAJOR_RAD * math.cos(ANGLE), ELL_CENTER_Y + ELL_MINOR_RAD * math.sin(ANGLE))) +Sketch_2.addSplit( + SketchEllipse_2.feature(), + GeomAPI_Pnt2d( + ELL_CENTER_X + ELL_MAJOR_RAD * math.cos(ANGLE), + ELL_CENTER_Y + ELL_MINOR_RAD * math.sin(ANGLE), + ), +) DOF_2 += 3 model.do() -assert(model.dof(Sketch_2) == DOF_2) +assert model.dof(Sketch_2) == DOF_2 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test3154.py b/src/SketchPlugin/Test/Test3154.py index fab145e32..6034f3d6f 100755 --- a/src/SketchPlugin/Test/Test3154.py +++ b/src/SketchPlugin/Test/Test3154.py @@ -26,17 +26,31 @@ 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) +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_3]"), True) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]"), True +) SketchCircle_1 = SketchProjection_1.createdFeature() -SketchLine_1 = Sketch_1.addLine(-0.2715703110882526, -4.992619509449466, -1.152966889672805, 4.865251005995354) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) +SketchLine_1 = Sketch_1.addLine( + -0.2715703110882526, -4.992619509449466, -1.152966889672805, 4.865251005995354 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) model.do() SketchSplit_1 = Sketch_1.addSplit(SketchAPI_Circle(SketchCircle_1), geom.Pnt2d(-5, 0)) model.end() # check Split is invalid -assert(SketchSplit_1.feature().error() != "") +assert SketchSplit_1.feature().error() != "" diff --git a/src/SketchPlugin/Test/Test3170.py b/src/SketchPlugin/Test/Test3170.py index 14ad9805c..ef3f6a33e 100644 --- a/src/SketchPlugin/Test/Test3170.py +++ b/src/SketchPlugin/Test/Test3170.py @@ -22,16 +22,34 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(-17.82085345143611, 21.43637119696745, -32.3626718085896, -17.44370962732489) -SketchLine_2 = Sketch_1.addLine(-32.3626718085896, -17.44370962732489, 6.049253461791531, -11.27075409452475) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(6.049253461791531, -11.27075409452475, -17.82085345143611, 21.43637119696745) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) -SketchLine_4 = Sketch_1.addLine(-32.3626718085896, -17.44370962732489, -5.812861704098991, 4.982867573918385) +SketchLine_1 = Sketch_1.addLine( + -17.82085345143611, 21.43637119696745, -32.3626718085896, -17.44370962732489 +) +SketchLine_2 = Sketch_1.addLine( + -32.3626718085896, -17.44370962732489, 6.049253461791531, -11.27075409452475 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 6.049253461791531, -11.27075409452475, -17.82085345143611, 21.43637119696745 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) +SketchLine_4 = Sketch_1.addLine( + -32.3626718085896, -17.44370962732489, -5.812861704098991, 4.982867573918385 +) SketchLine_4.setAuxiliary(True) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_3.result() +) model.end() DoF = model.dof(Sketch_1) @@ -41,7 +59,7 @@ Sketch_1.setFillet(SketchLine_2.startPoint()) DoF += 3 model.end() -assert(model.dof(Sketch_1) == DoF) +assert model.dof(Sketch_1) == DoF model.testNbSubFeatures(Sketch_1, "SketchPoint", 0) model.testNbSubFeatures(Sketch_1, "SketchLine", 4) @@ -49,4 +67,4 @@ model.testNbSubFeatures(Sketch_1, "SketchArc", 1) model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 5) model.testNbSubFeatures(Sketch_1, "SketchConstraintTangent", 2) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/Test3240.py b/src/SketchPlugin/Test/Test3240.py index 51f151734..be27a1835 100644 --- a/src/SketchPlugin/Test/Test3240.py +++ b/src/SketchPlugin/Test/Test3240.py @@ -24,15 +24,30 @@ from salome.shaper import model ORIGIN = GeomAPI_Pnt(0, 0, 0) NB_COPIES = 8 -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 model.begin() partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "OX"), True) SketchLine_1 = SketchProjection_1.createdFeature() -SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_1.result()], SketchAPI_Line(SketchLine_1).startPoint(), 360, NB_COPIES, True) -[SketchLine_1, SketchLine_2, SketchLine_3, SketchLine_4, SketchLine_5, SketchLine_6, SketchLine_7, SketchLine_8] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchLine_1.result()], + SketchAPI_Line(SketchLine_1).startPoint(), + 360, + NB_COPIES, + True, +) +[ + SketchLine_1, + SketchLine_2, + SketchLine_3, + SketchLine_4, + SketchLine_5, + SketchLine_6, + SketchLine_7, + SketchLine_8, +] = SketchMultiRotation_1.rotated() model.do() model.end() @@ -41,6 +56,6 @@ model.testNbSubShapes(Sketch_1, GeomAPI_Shape.EDGE, [NB_COPIES]) model.testNbSubShapes(Sketch_1, GeomAPI_Shape.VERTEX, [2 * NB_COPIES]) midPnt = Sketch_1.defaultResult().shape().middlePoint() -assert(midPnt.distance(ORIGIN) < TOLERANCE) +assert midPnt.distance(ORIGIN) < TOLERANCE -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestArcBehavior.py b/src/SketchPlugin/Test/TestArcBehavior.py index 7c4d84776..9f998cd22 100644 --- a/src/SketchPlugin/Test/TestArcBehavior.py +++ b/src/SketchPlugin/Test/TestArcBehavior.py @@ -25,9 +25,9 @@ """ -#========================================================================= +# ========================================================================= # of the test -#========================================================================= +# ========================================================================= from GeomAPI import * from GeomDataAPI import * from ModelAPI import * @@ -36,11 +36,11 @@ from salome.shaper import model aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() -#aSketchFeature = aDocument.addFeature("Sketch") +# aSketchFeature = aDocument.addFeature("Sketch") aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) @@ -50,139 +50,139 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Test creation of arc and movements (of mouse coursor) of end point near to the start point: # edge must be the minimal length. -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchArc = aSketchFeature.addFeature("SketchArc") anArcCentr = geomDataAPI_Point2D(aSketchArc.attribute("center_point")) -anArcCentr.setValue(0., 0.) +anArcCentr.setValue(0.0, 0.0) anArcStartPoint = geomDataAPI_Point2D(aSketchArc.attribute("start_point")) -anArcStartPoint.setValue(0., 10.) +anArcStartPoint.setValue(0.0, 10.0) anArcEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("end_point")) -anArcEndPoint.setValue(1., 10.) +anArcEndPoint.setValue(1.0, 10.0) aSession.finishOperation() # the arc must be small, not near to the whole circle -assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 2. +assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 2.0 # move to the half-circle aSession.startOperation() -anArcEndPoint.setValue(10., 0.) +anArcEndPoint.setValue(10.0, 0.0) aSession.finishOperation() -assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 16. +assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 16.0 aSession.startOperation() -anArcEndPoint.setValue(0., -10.) +anArcEndPoint.setValue(0.0, -10.0) aSession.finishOperation() -assert shapeToEdge(aSketchArc.lastResult().shape()).length() > 31. -assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 32. +assert shapeToEdge(aSketchArc.lastResult().shape()).length() > 31.0 +assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 32.0 aSession.startOperation() -anArcEndPoint.setValue(-10., 0.) +anArcEndPoint.setValue(-10.0, 0.0) aSession.finishOperation() -assert shapeToEdge(aSketchArc.lastResult().shape()).length() > 47. -assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 48. +assert shapeToEdge(aSketchArc.lastResult().shape()).length() > 47.0 +assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 48.0 aSession.startOperation() -anArcEndPoint.setValue(-1., 10.) +anArcEndPoint.setValue(-1.0, 10.0) aSession.finishOperation() -assert shapeToEdge(aSketchArc.lastResult().shape()).length() > 60. +assert shapeToEdge(aSketchArc.lastResult().shape()).length() > 60.0 # move to the initial point at the right side: the edge must reset to the initial one aSession.startOperation() -anArcEndPoint.setValue(1., 10.) +anArcEndPoint.setValue(1.0, 10.0) aSession.finishOperation() -assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 2. +assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 2.0 # move to the counterclockwise direction aSession.startOperation() -anArcEndPoint.setValue(-1., 10.) +anArcEndPoint.setValue(-1.0, 10.0) aSession.finishOperation() -assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 2. +assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 2.0 aSession.startOperation() -anArcEndPoint.setValue(-10., 0.) +anArcEndPoint.setValue(-10.0, 0.0) aSession.finishOperation() -assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 16. +assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 16.0 aSession.startOperation() -anArcEndPoint.setValue(0., -10.) +anArcEndPoint.setValue(0.0, -10.0) aSession.finishOperation() -assert shapeToEdge(aSketchArc.lastResult().shape()).length() > 31. -assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 32. +assert shapeToEdge(aSketchArc.lastResult().shape()).length() > 31.0 +assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 32.0 aSession.startOperation() -anArcEndPoint.setValue(10., 0.) +anArcEndPoint.setValue(10.0, 0.0) aSession.finishOperation() assert shapeToEdge(aSketchArc.lastResult().shape()).length() > 46.5 assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 47.5 aSession.startOperation() -anArcEndPoint.setValue(1., 10.) +anArcEndPoint.setValue(1.0, 10.0) aSession.finishOperation() -assert shapeToEdge(aSketchArc.lastResult().shape()).length() > 60. +assert shapeToEdge(aSketchArc.lastResult().shape()).length() > 60.0 # check from the scratch that from initial state to counterclockwise position also works aSession.startOperation() aSketchArc = aSketchFeature.addFeature("SketchArc") anArcCentr = geomDataAPI_Point2D(aSketchArc.attribute("center_point")) -anArcCentr.setValue(0., 0.) +anArcCentr.setValue(0.0, 0.0) anArcStartPoint = geomDataAPI_Point2D(aSketchArc.attribute("start_point")) -anArcStartPoint.setValue(0., 10.) +anArcStartPoint.setValue(0.0, 10.0) anArcEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("end_point")) -anArcEndPoint.setValue(-1., 10.) +anArcEndPoint.setValue(-1.0, 10.0) aSession.finishOperation() # the arc must be small, not near to the whole circle -assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 2. -#========================================================================= +assert shapeToEdge(aSketchArc.lastResult().shape()).length() < 2.0 +# ========================================================================= # Test that movement of the center of arc does not change the orientation of the arc -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchArc = aSketchFeature.addFeature("SketchArc") anArcCentr = geomDataAPI_Point2D(aSketchArc.attribute("center_point")) -anArcCentr.setValue(0., 0.) +anArcCentr.setValue(0.0, 0.0) anArcStartPoint = geomDataAPI_Point2D(aSketchArc.attribute("start_point")) -anArcStartPoint.setValue(0., 10.) +anArcStartPoint.setValue(0.0, 10.0) anArcEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("end_point")) -anArcEndPoint.setValue(10, 0.) +anArcEndPoint.setValue(10, 0.0) aSession.finishOperation() anInversed = aSketchArc.boolean("reversed").value() for aCenterCoords in range(1, 20): - aSession.startOperation() - anArcCentr.setValue(aCenterCoords, aCenterCoords/2) # move center - aSession.finishOperation() - assert aSketchArc.boolean("reversed").value() == anInversed + aSession.startOperation() + anArcCentr.setValue(aCenterCoords, aCenterCoords / 2) # move center + aSession.finishOperation() + assert aSketchArc.boolean("reversed").value() == anInversed for aCenterCoords in range(20, -20, -1): - aSession.startOperation() - anArcCentr.setValue(aCenterCoords, aCenterCoords/2) # move center - aSession.finishOperation() - assert aSketchArc.boolean("reversed").value() == anInversed + aSession.startOperation() + anArcCentr.setValue(aCenterCoords, aCenterCoords / 2) # move center + aSession.finishOperation() + assert aSketchArc.boolean("reversed").value() == anInversed for aCenterCoords in range(-20, 20): - aSession.startOperation() - anArcCentr.setValue(aCenterCoords, aCenterCoords/2) # move center - aSession.finishOperation() - assert aSketchArc.boolean("reversed").value() == anInversed -#========================================================================= + aSession.startOperation() + anArcCentr.setValue(aCenterCoords, aCenterCoords / 2) # move center + aSession.finishOperation() + assert aSketchArc.boolean("reversed").value() == anInversed +# ========================================================================= # Test that movement of start point of arc does not break the arc -#========================================================================= +# ========================================================================= x = anArcCentr.x() y = anArcCentr.y() sx = anArcStartPoint.x() sy = anArcStartPoint.y() for aDelta in range(0, 20): - aSession.startOperation() - anArcStartPoint.setValue(sx, sy+aDelta) # move start point - aSession.finishOperation() - model.assertArcValidity(aSketchArc) + aSession.startOperation() + anArcStartPoint.setValue(sx, sy + aDelta) # move start point + aSession.finishOperation() + model.assertArcValidity(aSketchArc) for aDelta in range(20, -1, -1): - aSession.startOperation() - anArcStartPoint.setValue(sx, sy+aDelta) # move start point - aSession.finishOperation() - model.assertArcValidity(aSketchArc) -#========================================================================= + aSession.startOperation() + anArcStartPoint.setValue(sx, sy + aDelta) # move start point + aSession.finishOperation() + model.assertArcValidity(aSketchArc) +# ========================================================================= # Test that movement of end point of arc does not break the arc -#========================================================================= +# ========================================================================= x = anArcCentr.x() y = anArcCentr.y() sx = anArcEndPoint.x() sy = anArcEndPoint.y() for aDelta in range(0, 20): - aSession.startOperation() - anArcEndPoint.setValue(sx+aDelta, sy) # move end point - aSession.finishOperation() - model.assertArcValidity(aSketchArc) + aSession.startOperation() + anArcEndPoint.setValue(sx + aDelta, sy) # move end point + aSession.finishOperation() + model.assertArcValidity(aSketchArc) for aDelta in range(20, -1, -1): - aSession.startOperation() - anArcEndPoint.setValue(sx+aDelta, sy) # move end point - aSession.finishOperation() - model.assertArcValidity(aSketchArc) + aSession.startOperation() + anArcEndPoint.setValue(sx + aDelta, sy) # move end point + aSession.finishOperation() + model.assertArcValidity(aSketchArc) diff --git a/src/SketchPlugin/Test/TestBSplineAddPole.py b/src/SketchPlugin/Test/TestBSplineAddPole.py index 325c2d4ff..a923371ef 100644 --- a/src/SketchPlugin/Test/TestBSplineAddPole.py +++ b/src/SketchPlugin/Test/TestBSplineAddPole.py @@ -25,22 +25,38 @@ from salome.shaper import model from GeomAPI import * import random -TOLERANCE = 1.e-7 - -def assertSubFeatures(theSketch, theNbPoints, theNbLines, theNbSplines, theNbSplinesP, theNbCoincidences, theNbInternal): +TOLERANCE = 1.0e-7 + + +def assertSubFeatures( + theSketch, + theNbPoints, + theNbLines, + theNbSplines, + theNbSplinesP, + theNbCoincidences, + theNbInternal, +): model.testNbSubFeatures(theSketch, "SketchPoint", theNbPoints) model.testNbSubFeatures(theSketch, "SketchLine", theNbLines) model.testNbSubFeatures(theSketch, "SketchBSpline", theNbSplines) model.testNbSubFeatures(theSketch, "SketchBSplinePeriodic", theNbSplinesP) model.testNbSubFeatures(theSketch, "SketchConstraintCoincidence", theNbCoincidences) - model.testNbSubFeatures(theSketch, "SketchConstraintCoincidenceInternal", theNbInternal) + model.testNbSubFeatures( + theSketch, "SketchConstraintCoincidenceInternal", theNbInternal + ) + def assertPoles(thePoles, theReference): - assert(thePoles.size() == len(theReference)) + assert thePoles.size() == len(theReference) for ind in range(0, len(theReference)): pole = thePoles.pnt(ind) ref = GeomAPI_Pnt2d(theReference[ind][0], theReference[ind][1]) - assert(model.distancePointPoint(pole, ref) < TOLERANCE), "Index = {}, pole = ({}, {}), refdata = ({}, {})".format(ind, pole.x(), pole.y(), ref.x(), ref.y()) + assert ( + model.distancePointPoint(pole, ref) < TOLERANCE + ), "Index = {}, pole = ({}, {}), refdata = ({}, {})".format( + ind, pole.x(), pole.y(), ref.x(), ref.y() + ) model.begin() @@ -50,14 +66,33 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchBSpline_1_poles = [(-25, 5), (-15, 35), (15, 35), (28, 5)] -SketchBSpline_1 = Sketch_1.addSpline(poles = SketchBSpline_1_poles) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4] = SketchBSpline_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_1, SketchLine_2, SketchLine_3] = SketchBSpline_1.controlPolygon(auxiliary = [0, 1, 2]) +SketchBSpline_1 = Sketch_1.addSpline(poles=SketchBSpline_1_poles) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, +] = SketchBSpline_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[SketchLine_1, SketchLine_2, SketchLine_3] = SketchBSpline_1.controlPolygon( + auxiliary=[0, 1, 2] +) SketchBSplinePeriodic_1_poles = [(-20, -10), (20, -40), (20, -10), (-20, -40)] -SketchBSplinePeriodic_1 = Sketch_1.addSpline(poles = SketchBSplinePeriodic_1_poles, periodic = True) -[SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchPoint_8] = SketchBSplinePeriodic_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_4, SketchLine_5, SketchLine_6, SketchLine_7] = SketchBSplinePeriodic_1.controlPolygon(auxiliary = [0, 1, 2, 3]) +SketchBSplinePeriodic_1 = Sketch_1.addSpline( + poles=SketchBSplinePeriodic_1_poles, periodic=True +) +[ + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchPoint_8, +] = SketchBSplinePeriodic_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[ + SketchLine_4, + SketchLine_5, + SketchLine_6, + SketchLine_7, +] = SketchBSplinePeriodic_1.controlPolygon(auxiliary=[0, 1, 2, 3]) model.do() # check original values @@ -67,7 +102,15 @@ NBSPLINES = 1 NBSPLINESPERIODIC = 1 NBCOINCIDENCES = 0 NBINTERNAL = 22 -assertSubFeatures(Sketch_1, NBPOINTS, NBLINES, NBSPLINES, NBSPLINESPERIODIC, NBCOINCIDENCES, NBINTERNAL) +assertSubFeatures( + Sketch_1, + NBPOINTS, + NBLINES, + NBSPLINES, + NBSPLINESPERIODIC, + NBCOINCIDENCES, + NBINTERNAL, +) assertPoles(SketchBSpline_1.poles(), SketchBSpline_1_poles) assertPoles(SketchBSplinePeriodic_1.poles(), SketchBSplinePeriodic_1_poles) @@ -87,7 +130,15 @@ while ind < len(SketchBSpline_1_poles): NBPOINTS += 1 NBLINES += 1 NBINTERNAL += 3 - assertSubFeatures(Sketch_1, NBPOINTS, NBLINES, NBSPLINES, NBSPLINESPERIODIC, NBCOINCIDENCES, NBINTERNAL) + assertSubFeatures( + Sketch_1, + NBPOINTS, + NBLINES, + NBSPLINES, + NBSPLINESPERIODIC, + NBCOINCIDENCES, + NBINTERNAL, + ) assertPoles(SketchBSpline_1.poles(), SketchBSpline_1_poles) # add poles to periodic B-spline @@ -103,14 +154,22 @@ while ind < len(SketchBSplinePeriodic_1_poles): NBPOINTS += 1 NBLINES += 1 NBINTERNAL += 3 - assertSubFeatures(Sketch_1, NBPOINTS, NBLINES, NBSPLINES, NBSPLINESPERIODIC, NBCOINCIDENCES, NBINTERNAL) + assertSubFeatures( + Sketch_1, + NBPOINTS, + NBLINES, + NBSPLINES, + NBSPLINESPERIODIC, + NBCOINCIDENCES, + NBINTERNAL, + ) assertPoles(SketchBSplinePeriodic_1.poles(), SketchBSplinePeriodic_1_poles) model.end() # check error on incorrect action model.begin() -assert(not SketchBSpline_1.feature().customAction("wrong_action")) +assert not SketchBSpline_1.feature().customAction("wrong_action") model.end() -#assert(model.checkPythonDump()) +# assert(model.checkPythonDump()) diff --git a/src/SketchPlugin/Test/TestCenteredRectangle.py b/src/SketchPlugin/Test/TestCenteredRectangle.py index bc50da883..dfacb5e3f 100644 --- a/src/SketchPlugin/Test/TestCenteredRectangle.py +++ b/src/SketchPlugin/Test/TestCenteredRectangle.py @@ -32,7 +32,9 @@ h = model.addParameter(Part_1_doc, "h", "20") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) ### Create SketchProjection -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() ### Create SketchLine @@ -78,76 +80,93 @@ Sketch_1.setLength(SketchLine_6.result(), "h") model.do() ### Create Extrusion -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), 40, 0, "Faces|Wires") +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1f-SketchLine_4f-SketchLine_5f-SketchLine_6f", + ) + ], + model.selection(), + 40, + 0, + "Faces|Wires", +) model.end() -#============================================================================================= +# ============================================================================================= # Tests : -#============================================================================================= +# ============================================================================================= from GeomDataAPI import * from ModelAPI import * from GeomAPI import * from SketchAPI import SketchAPI_Sketch, SketchAPI_SketchEntity + def isSymetricX(line): aStart = geomDataAPI_Point2D(line.attribute("StartPoint")) - aEnd = geomDataAPI_Point2D(line.attribute("EndPoint")) + aEnd = geomDataAPI_Point2D(line.attribute("EndPoint")) return aStart.x() == -aEnd.x() + def isSymetricY(line): aStart = geomDataAPI_Point2D(line.attribute("StartPoint")) - aEnd = geomDataAPI_Point2D(line.attribute("EndPoint")) + aEnd = geomDataAPI_Point2D(line.attribute("EndPoint")) return aStart.y() == -aEnd.y() + def isSymetricXY(line): aStart = geomDataAPI_Point2D(line.attribute("StartPoint")) - aEnd = geomDataAPI_Point2D(line.attribute("EndPoint")) + aEnd = geomDataAPI_Point2D(line.attribute("EndPoint")) return (aStart.x() == -aEnd.x()) and (aStart.y() == -aEnd.y()) -#========================================================================= + +# ========================================================================= def checkLinesSymetry(aSketchFeature): -#========================================================================= -# Checks the lines of rectangle are symetric around the origin - aNbSubs = aSketchFeature.numberOfSubs() - aNbLines = 0 - nbAux = 0 - for i in range (0, aNbSubs): - aFeature = objectToFeature(aSketchFeature.subFeature(i)) - if aFeature.getKind() == "SketchLine": - aLastLine = aFeature - entity = SketchAPI_SketchEntity(aLastLine) - if entity.auxiliary().value(): # auxiliary line - assert isSymetricXY(aLastLine) - nbAux +=1 - else: - assert (isSymetricX(aLastLine) or isSymetricY(aLastLine)) - aNbLines = aNbLines + 1 - assert (nbAux == 2) - assert (aNbLines == 4) - assert (model.dof(aSketchFeature) == 0) + # ========================================================================= + # Checks the lines of rectangle are symetric around the origin + aNbSubs = aSketchFeature.numberOfSubs() + aNbLines = 0 + nbAux = 0 + for i in range(0, aNbSubs): + aFeature = objectToFeature(aSketchFeature.subFeature(i)) + if aFeature.getKind() == "SketchLine": + aLastLine = aFeature + entity = SketchAPI_SketchEntity(aLastLine) + if entity.auxiliary().value(): # auxiliary line + assert isSymetricXY(aLastLine) + nbAux += 1 + else: + assert isSymetricX(aLastLine) or isSymetricY(aLastLine) + aNbLines = aNbLines + 1 + assert nbAux == 2 + assert aNbLines == 4 + assert model.dof(aSketchFeature) == 0 + Part_doc = model.activeDocument() for feat in Part_doc.allFeatures(): - if feat.getKind() == "Sketch": - sketch = feat + if feat.getKind() == "Sketch": + sketch = feat aSketchFeature = featureToCompositeFeature(sketch) -#========================================================================= +# ========================================================================= # Check the lines of rectangle are symetric around the origin -#========================================================================= +# ========================================================================= checkLinesSymetry(aSketchFeature) -#========================================================================= +# ========================================================================= # Change the dimensions of the rectangle -#========================================================================= +# ========================================================================= aSession = ModelAPI_Session.get() aSession.startOperation() -l.setValue(80.) -h.setValue(55.) +l.setValue(80.0) +h.setValue(55.0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Check the lines of rectangle are symetric around the origin -#========================================================================= +# ========================================================================= checkLinesSymetry(aSketchFeature) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestChangeSketchPlane1.py b/src/SketchPlugin/Test/TestChangeSketchPlane1.py index 21fde9f4d..df811fef9 100644 --- a/src/SketchPlugin/Test/TestChangeSketchPlane1.py +++ b/src/SketchPlugin/Test/TestChangeSketchPlane1.py @@ -21,13 +21,20 @@ from SketchAPI import * from salome.shaper import model import math -def checkMiddlePoint(feature, x, y, z, tolerance = 1.e-7): + +def checkMiddlePoint(feature, x, y, z, tolerance=1.0e-7): shape = feature.results()[0].resultSubShapePair()[0].shape() - assert(shape is not None) + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "X: {} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "Y: {} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "Z: {} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "X: {} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "Y: {} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "Z: {} != {}".format( + middlePoint.z(), z + ) model.begin() @@ -37,15 +44,30 @@ 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/Left")) SketchCircle_1 = Sketch_1.addCircle(4, 5.52786404500042, 3) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_1.result(), 6, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_1.result(), 6, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 3) -SketchIntersectionPoint_1 = Sketch_1.addIntersectionPoint(model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), False) +SketchIntersectionPoint_1 = Sketch_1.addIntersectionPoint( + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), False +) [SketchPoint_1] = SketchIntersectionPoint_1.intersectionPoints() -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 6, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center(), 6, True +) model.do() -ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 1, 0, [model.selection("SOLID", "Box_1_1")]) +ExtrusionFuse_1 = model.addExtrusionFuse( + Part_1_doc, + [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], + model.selection(), + 1, + 0, + [model.selection("SOLID", "Box_1_1")], +) model.end() SKETCH_DOF = 0 @@ -67,7 +89,7 @@ checkMiddlePoint(ExtrusionFuse_1, 4.972503122, 4.84876717, 5.0145146) model.begin() Sketch_1.setPlane(model.selection("FACE", "Box_1_1/Front")) model.end() -assert(SketchIntersectionPoint_1.feature().error() != "") +assert SketchIntersectionPoint_1.feature().error() != "" # revert error model.undo() @@ -104,4 +126,4 @@ model.testResultsVolumes(ExtrusionFuse_1, [1028.2743338823]) checkMiddlePoint(ExtrusionFuse_1, 5.0, 0.73606797, 5.5) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestChangeSketchPlane2.py b/src/SketchPlugin/Test/TestChangeSketchPlane2.py index a84257f2f..339558606 100644 --- a/src/SketchPlugin/Test/TestChangeSketchPlane2.py +++ b/src/SketchPlugin/Test/TestChangeSketchPlane2.py @@ -21,13 +21,21 @@ from SketchAPI import * from salome.shaper import model import math -def checkMiddlePoint(feature, x, y, z, tolerance = 1.e-6): + +def checkMiddlePoint(feature, x, y, z, tolerance=1.0e-6): shape = feature.results()[0].resultSubShapePair()[0].shape() - assert(shape is not None) + assert shape is not None middlePoint = shape.middlePoint() - assert(math.fabs(middlePoint.x() - x) < tolerance), "X: {} != {}".format(middlePoint.x(), x) - assert(math.fabs(middlePoint.y() - y) < tolerance), "Y: {} != {}".format(middlePoint.y(), y) - assert(math.fabs(middlePoint.z() - z) < tolerance), "Z: {} != {}".format(middlePoint.z(), z) + assert math.fabs(middlePoint.x() - x) < tolerance, "X: {} != {}".format( + middlePoint.x(), x + ) + assert math.fabs(middlePoint.y() - y) < tolerance, "Y: {} != {}".format( + middlePoint.y(), y + ) + assert math.fabs(middlePoint.z() - z) < tolerance, "Z: {} != {}".format( + middlePoint.z(), z + ) + model.begin() partSet = model.moduleDocument() @@ -36,16 +44,28 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 20, 0) SketchLine_2 = Sketch_1.addLine(20, 0, 30, 20) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(30, 20, 50, 20) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(50, 20, 50, 40) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(50, 40, 0, 40) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(0, 40, 0, 0) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.endPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_6.endPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) @@ -56,42 +76,114 @@ SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_6.result(), 40) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_4.result(), 20) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_3.result(), 20) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_1.result(), 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) +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_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), 30, 0) -ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [], model.selection(), 10, 0, [model.selection("SOLID", "Extrusion_1_1")]) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3")) +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(), + 30, + 0, +) +ExtrusionFuse_1 = model.addExtrusionFuse( + Part_1_doc, + [], + model.selection(), + 10, + 0, + [model.selection("SOLID", "Extrusion_1_1")], +) +Sketch_2 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"), +) SketchCircle_1 = Sketch_2.addCircle(33, 25, 5) SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_1.results()[1], 5) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]", + ), + False, +) SketchLine_7 = SketchProjection_2.createdFeature() -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_7.result(), 3, True) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_7.result(), 3, True +) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]", + ), + False, +) SketchLine_8 = SketchProjection_3.createdFeature() -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_8.result(), 5, True) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_8.result(), 5, True +) ExtrusionFuse_1.setNestedSketch(Sketch_2) -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_1_1/Modified_Face&Extrusion_1_1/To_Face")) -SketchIntersectionPoint_1 = Sketch_3.addIntersectionPoint(model.selection("EDGE", "[ExtrusionFuse_1_1/Generated_Face&Sketch_2/SketchCircle_1_2][ExtrusionFuse_1_1/To_Face]"), False) +Sketch_3 = model.addSketch( + Part_1_doc, + model.selection("FACE", "ExtrusionFuse_1_1/Modified_Face&Extrusion_1_1/To_Face"), +) +SketchIntersectionPoint_1 = Sketch_3.addIntersectionPoint( + model.selection( + "EDGE", + "[ExtrusionFuse_1_1/Generated_Face&Sketch_2/SketchCircle_1_2][ExtrusionFuse_1_1/To_Face]", + ), + False, +) [SketchPoint_2] = SketchIntersectionPoint_1.intersectionPoints() SketchLine_9 = Sketch_3.addLine(33.5, 10, 32.5, 10) SketchLine_10 = Sketch_3.addLine(32.5, 10, 32.5, 17) SketchLine_11 = Sketch_3.addLine(32.5, 17, 33.5, 17) SketchLine_12 = Sketch_3.addLine(33.5, 17, 33.5, 10) -SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_8 = Sketch_3.setCoincident( + SketchLine_12.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_3.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_3.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_10.result()) SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_12.result()) -SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_9.result()) +SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_9.result() +) SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_9.result(), 1) SketchConstraintLength_7 = Sketch_3.setLength(SketchLine_12.result(), 7) model.do() -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r")], model.selection(), 0, 1, [model.selection("SOLID", "ExtrusionFuse_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_3/Face-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r", + ) + ], + model.selection(), + 0, + 1, + [model.selection("SOLID", "ExtrusionFuse_1_1")], +) model.end() SKETCH_DOF = 0 @@ -113,7 +205,9 @@ checkMiddlePoint(ExtrusionCut_1, 21.09174756, 23.41211647, 15.165448698) # change plane of Fuse's sketch model.begin() -Sketch_2.setPlane(model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5")) +Sketch_2.setPlane( + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5") +) model.end() model.checkSketch(Sketch_1, SKETCH_DOF) @@ -134,7 +228,9 @@ checkMiddlePoint(ExtrusionCut_1, 21.0948367, 23.919988, 15.169366862) model.undo() # and set another model.begin() -Sketch_2.setPlane(model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2")) +Sketch_2.setPlane( + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2") +) model.end() model.checkSketch(Sketch_1, SKETCH_DOF) @@ -155,14 +251,18 @@ checkMiddlePoint(ExtrusionCut_1, 21.00046446, 23.51391548, 15.073978) model.undo() # and set another which fails the projection model.begin() -Sketch_2.setPlane(model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6")) +Sketch_2.setPlane( + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6") +) model.end() -assert(SketchProjection_3.feature().error() != "") +assert SketchProjection_3.feature().error() != "" # undo the error model.undo() model.begin() -Sketch_3.setPlane(model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), True) +Sketch_3.setPlane( + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), True +) model.end() model.checkSketch(Sketch_1, SKETCH_DOF) @@ -179,4 +279,4 @@ model.testResultsVolumes(ExtrusionCut_1, [45760.15911273]) checkMiddlePoint(ExtrusionCut_1, 21.08920837, 23.40914618, 15.16787737) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestChangeSketchPlane3.py b/src/SketchPlugin/Test/TestChangeSketchPlane3.py index 3a0dd62db..7779f1662 100644 --- a/src/SketchPlugin/Test/TestChangeSketchPlane3.py +++ b/src/SketchPlugin/Test/TestChangeSketchPlane3.py @@ -21,11 +21,13 @@ from SketchAPI import * from salome.shaper import model import math -def checkSketchLine(theLine, theX1, theY1, theX2, theY2, theTolerance = 1.e-7): - assert(math.fabs(theLine.startPoint().x() - theX1) < theTolerance) - assert(math.fabs(theLine.startPoint().y() - theY1) < theTolerance) - assert(math.fabs(theLine.endPoint().x() - theX2) < theTolerance) - assert(math.fabs(theLine.endPoint().y() - theY2) < theTolerance) + +def checkSketchLine(theLine, theX1, theY1, theX2, theY2, theTolerance=1.0e-7): + assert math.fabs(theLine.startPoint().x() - theX1) < theTolerance + assert math.fabs(theLine.startPoint().y() - theY1) < theTolerance + assert math.fabs(theLine.endPoint().x() - theX2) < theTolerance + assert math.fabs(theLine.endPoint().y() - theY2) < theTolerance + model.begin() partSet = model.moduleDocument() @@ -35,14 +37,26 @@ ParamD1 = model.addParameter(Part_1_doc, "D1", "80") ParamD2 = model.addParameter(Part_1_doc, "D2", "30") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 80, 30, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), 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", "PartSet/OX"), False) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_3 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchAPI_Line(SketchLine_2).startPoint(), "D1", True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_1.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), "D2", True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchAPI_Line(SketchLine_2).startPoint(), "D1", True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_1.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), "D2", True +) model.do() model.end() model.checkSketch(Sketch_1, 0) @@ -60,4 +74,4 @@ model.end() model.checkSketch(Sketch_1, 0) checkSketchLine(SketchLine_1, 0, ParamD1.value(), ParamD2.value(), 0) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestChangeSketchPlane4.py b/src/SketchPlugin/Test/TestChangeSketchPlane4.py index 0aff31e6e..1e0047514 100644 --- a/src/SketchPlugin/Test/TestChangeSketchPlane4.py +++ b/src/SketchPlugin/Test/TestChangeSketchPlane4.py @@ -24,39 +24,80 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) -SketchCircle_1 = Sketch_1.addCircle(-29.162567194092, -4.973946236013575, 24.14811574522286) +SketchCircle_1 = Sketch_1.addCircle( + -29.162567194092, -4.973946236013575, 24.14811574522286 +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_2.addLine(-77.4631035991525, 93.73498685458384, -26.22597517262966, 46.04636096467877) -SketchLine_2 = Sketch_2.addLine(-26.22597517262966, 46.04636096467877, 72.15826607546271, 123.5085570887089) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_2.addLine(72.15826607546271, 123.5085570887089, -77.4631035991525, 93.73498685458384) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) +SketchLine_1 = Sketch_2.addLine( + -77.4631035991525, 93.73498685458384, -26.22597517262966, 46.04636096467877 +) +SketchLine_2 = Sketch_2.addLine( + -26.22597517262966, 46.04636096467877, 72.15826607546271, 123.5085570887089 +) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_2.addLine( + 72.15826607546271, 123.5085570887089, -77.4631035991525, 93.73498685458384 +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection(), 50, 50) -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2")) -SketchProjection_1 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchCircle_1_2"), True) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f" + ) + ], + model.selection(), + 50, + 50, +) +Sketch_3 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2"), +) +SketchProjection_1 = Sketch_3.addProjection( + model.selection("EDGE", "Sketch_1/SketchCircle_1_2"), True +) SketchEllipse_1 = SketchProjection_1.createdFeature() -SketchLine_4 = Sketch_3.addLine(-38.4752072906812, 8.839586602068252, -81.23746009846235, -13.43622256955389) -SketchConstraintCoincidence_4 = Sketch_3.setCoincident(SketchLine_4.startPoint(), SketchEllipse_1.result()) -SketchLine_5 = Sketch_3.addLine(-81.23746009846235, -13.43622256955389, -38.77350759536917, -18.22647561616226) -SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_5.endPoint(), SketchEllipse_1.result()) +SketchLine_4 = Sketch_3.addLine( + -38.4752072906812, 8.839586602068252, -81.23746009846235, -13.43622256955389 +) +SketchConstraintCoincidence_4 = Sketch_3.setCoincident( + SketchLine_4.startPoint(), SketchEllipse_1.result() +) +SketchLine_5 = Sketch_3.addLine( + -81.23746009846235, -13.43622256955389, -38.77350759536917, -18.22647561616226 +) +SketchConstraintCoincidence_5 = Sketch_3.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_3.setCoincident( + SketchLine_5.endPoint(), SketchEllipse_1.result() +) model.do() model.end() model.checkSketch(Sketch_3, 4) model.testNbSubFeatures(Sketch_3, "SketchConstraintCoincidence", 3) ellipse1 = SketchEllipse_1.results()[-1].resultSubShapePair()[0].shape() -assert(ellipse1.isEdge() and ellipse1.edge().isEllipse()) +assert ellipse1.isEdge() and ellipse1.edge().isEllipse() model.begin() -Sketch_3.setPlane(model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_1")) +Sketch_3.setPlane( + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_1") +) model.end() model.checkSketch(Sketch_3, 4) model.testNbSubFeatures(Sketch_3, "SketchConstraintCoincidence", 3) ellipse1 = SketchEllipse_1.results()[-1].resultSubShapePair()[0].shape() -assert(ellipse1.isEdge() and ellipse1.edge().isEllipse()) +assert ellipse1.isEdge() and ellipse1.edge().isEllipse() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintAngle.py b/src/SketchPlugin/Test/TestConstraintAngle.py index ebe140d07..d63a4583a 100644 --- a/src/SketchPlugin/Test/TestConstraintAngle.py +++ b/src/SketchPlugin/Test/TestConstraintAngle.py @@ -35,16 +35,17 @@ from ModelAPI import * import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Auxiliary functions -#========================================================================= +# ========================================================================= + def angle(theLine1, theLine2): # subroutine to angle between two lines aStartPoint1 = geomDataAPI_Point2D(theLine1.attribute("StartPoint")) - aEndPoint1 = geomDataAPI_Point2D(theLine1.attribute("EndPoint")) + aEndPoint1 = geomDataAPI_Point2D(theLine1.attribute("EndPoint")) aStartPoint2 = geomDataAPI_Point2D(theLine2.attribute("StartPoint")) - aEndPoint2 = geomDataAPI_Point2D(theLine2.attribute("EndPoint")) + aEndPoint2 = geomDataAPI_Point2D(theLine2.attribute("EndPoint")) aDirX1 = aEndPoint1.x() - aStartPoint1.x() aDirY1 = aEndPoint1.y() - aStartPoint1.y() @@ -56,12 +57,12 @@ def angle(theLine1, theLine2): aDot = aDirX1 * aDirX2 + aDirY1 * aDirY2 anAngle = math.acos(aDot / aLen1 / aLen2) - return round(anAngle * 180. / math.pi, 6) + return round(anAngle * 180.0 / math.pi, 6) -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2015-09-18" @@ -71,9 +72,9 @@ ANGLE_BACKWARD = 2 aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -84,36 +85,36 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create two lines -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchLineA = aSketchFeature.addFeature("SketchLine") aStartPoint = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint")) aEndPoint = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint")) -aStartPoint.setValue(-10., 25.) -aEndPoint.setValue(100., 25.) +aStartPoint.setValue(-10.0, 25.0) +aEndPoint.setValue(100.0, 25.0) aSketchLineB = aSketchFeature.addFeature("SketchLine") aStartPoint = geomDataAPI_Point2D(aSketchLineB.attribute("StartPoint")) aEndPoint = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint")) -aStartPoint.setValue(-10., 15.) -aEndPoint.setValue(80., 50.) +aStartPoint.setValue(-10.0, 15.0) +aEndPoint.setValue(80.0, 50.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 8) -#========================================================================= +assert model.dof(aSketchFeature) == 8 +# ========================================================================= # Make a constraint to keep the angle -#========================================================================= -ANGLE_DEGREE = 30. +# ========================================================================= +ANGLE_DEGREE = 30.0 aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintAngle") aConstraint.integer("AngleType").setValue(ANGLE_DIRECT) anAngleVal = aConstraint.real("AngleValue") refattrA = aConstraint.refattr("ConstraintEntityA") refattrB = aConstraint.refattr("ConstraintEntityB") -assert (not anAngleVal.isInitialized()) -assert (not refattrA.isInitialized()) -assert (not refattrB.isInitialized()) +assert not anAngleVal.isInitialized() +assert not refattrA.isInitialized() +assert not refattrB.isInitialized() refattrA.setObject(aSketchLineA.firstResult()) refattrB.setObject(aSketchLineB.firstResult()) anAngleVal.setValue(ANGLE_DEGREE) @@ -124,57 +125,57 @@ aFlyoutPoint = geomDataAPI_Point2D(aConstraint.attribute("ConstraintFlyoutValueP aFlyoutPoint.setValue(50.0, 100.0) aSession.finishOperation() aSession.abortOperation() -assert (anAngleVal.isInitialized()) -assert (refattrA.isInitialized()) -assert (refattrB.isInitialized()) -assert (angle(aSketchLineA, aSketchLineB) == ANGLE_DEGREE) -assert (model.dof(aSketchFeature) == 7) -#========================================================================= +assert anAngleVal.isInitialized() +assert refattrA.isInitialized() +assert refattrB.isInitialized() +assert angle(aSketchLineA, aSketchLineB) == ANGLE_DEGREE +assert model.dof(aSketchFeature) == 7 +# ========================================================================= # Move line, check that angle is constant -#========================================================================= +# ========================================================================= aSession.startOperation() aStartPoint = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint")) -aStartPoint.setValue(0., -30.) +aStartPoint.setValue(0.0, -30.0) aConstraint.execute() aSession.finishOperation() -assert (angle(aSketchLineA, aSketchLineB) == ANGLE_DEGREE) -assert (model.dof(aSketchFeature) == 7) -#========================================================================= +assert angle(aSketchLineA, aSketchLineB) == ANGLE_DEGREE +assert model.dof(aSketchFeature) == 7 +# ========================================================================= # Change angle value and check the lines are moved -#========================================================================= -NEW_ANGLE_DEGREE = 60. +# ========================================================================= +NEW_ANGLE_DEGREE = 60.0 aSession.startOperation() anAngleVal.setValue(NEW_ANGLE_DEGREE) aConstraint.execute() aSession.finishOperation() -assert (angle(aSketchLineA, aSketchLineB) == NEW_ANGLE_DEGREE) -assert (model.dof(aSketchFeature) == 7) -#========================================================================= +assert angle(aSketchLineA, aSketchLineB) == NEW_ANGLE_DEGREE +assert model.dof(aSketchFeature) == 7 +# ========================================================================= # Change angle type -#========================================================================= +# ========================================================================= aSession.startOperation() aConstraint.integer("AngleType").setValue(ANGLE_COMPLEMENTARY) aSession.finishOperation() -assert (angle(aSketchLineA, aSketchLineB) == NEW_ANGLE_DEGREE) +assert angle(aSketchLineA, aSketchLineB) == NEW_ANGLE_DEGREE aSession.startOperation() aConstraint.integer("AngleType").setValue(ANGLE_BACKWARD) aSession.finishOperation() -assert (angle(aSketchLineA, aSketchLineB) == NEW_ANGLE_DEGREE) -assert (model.dof(aSketchFeature) == 7) -#========================================================================= +assert angle(aSketchLineA, aSketchLineB) == NEW_ANGLE_DEGREE +assert model.dof(aSketchFeature) == 7 +# ========================================================================= # Remove constraint, move line's point to check the constraint is not applied -#========================================================================= +# ========================================================================= aSession.startOperation() aDocument.removeFeature(aConstraint) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 8) +assert model.dof(aSketchFeature) == 8 aSession.startOperation() -aStartPoint.setValue(-30., 0.) +aStartPoint.setValue(-30.0, 0.0) aSession.finishOperation() -assert (angle(aSketchLineA, aSketchLineB) != NEW_ANGLE_DEGREE) -assert (model.dof(aSketchFeature) == 8) -#========================================================================= +assert angle(aSketchLineA, aSketchLineB) != NEW_ANGLE_DEGREE +assert model.dof(aSketchFeature) == 8 +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintAngleBehaviorBackward_1.py b/src/SketchPlugin/Test/TestConstraintAngleBehaviorBackward_1.py index 08754a866..5ec47f33f 100644 --- a/src/SketchPlugin/Test/TestConstraintAngleBehaviorBackward_1.py +++ b/src/SketchPlugin/Test/TestConstraintAngleBehaviorBackward_1.py @@ -23,9 +23,9 @@ import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2019-12-12" @@ -35,9 +35,9 @@ ANGLE_BACKWARD = 2 aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -48,66 +48,73 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create two lines -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchLineA = aSketchFeature.addFeature("SketchLine") aStartPointA = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint")) aEndPointA = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint")) -aStartPointA.setValue(-100., 25.) -aEndPointA.setValue(100., -25.) +aStartPointA.setValue(-100.0, 25.0) +aEndPointA.setValue(100.0, -25.0) aSketchLineB = aSketchFeature.addFeature("SketchLine") aStartPointB = geomDataAPI_Point2D(aSketchLineB.attribute("StartPoint")) aEndPointB = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint")) -aStartPointB.setValue(-100., -25.) -aEndPointB.setValue(100., 25.) +aStartPointB.setValue(-100.0, -25.0) +aEndPointB.setValue(100.0, 25.0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make a constraint to keep the angle -#========================================================================= -ANGLE_DEGREE = 330. +# ========================================================================= +ANGLE_DEGREE = 330.0 aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintAngle") anAngleType = aConstraint.integer("AngleType") anAngleType.setValue(ANGLE_DIRECT) -geomDataAPI_Point2D(aConstraint.attribute("SelectedPointA")).setValue(aStartPointA.pnt()) -geomDataAPI_Point2D(aConstraint.attribute("SelectedPointB")).setValue(aStartPointB.pnt()) +geomDataAPI_Point2D(aConstraint.attribute("SelectedPointA")).setValue( + aStartPointA.pnt() +) +geomDataAPI_Point2D(aConstraint.attribute("SelectedPointB")).setValue( + aStartPointB.pnt() +) aConstraint.refattr("ConstraintEntityA").setObject(aSketchLineA.firstResult()) aConstraint.refattr("ConstraintEntityB").setObject(aSketchLineB.firstResult()) anAngleVal = aConstraint.real("AngleValue") -anAngleVal.setValue(360. - ANGLE_DEGREE) +anAngleVal.setValue(360.0 - ANGLE_DEGREE) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Change the type of the constraint -#========================================================================= +# ========================================================================= aSession.startOperation() anAngleType.setValue(ANGLE_BACKWARD) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Move presentation of the angle and check the angle value -#========================================================================= +# ========================================================================= pointsA = [aStartPointA.pnt(), aEndPointA.pnt()] pointsB = [aStartPointB.pnt(), aEndPointB.pnt()] -refs = [(pointsA[0], pointsB[1], 540. - ANGLE_DEGREE), - (pointsA[1], pointsB[1], ANGLE_DEGREE), - (pointsA[1], pointsB[0], 540. - ANGLE_DEGREE), - (pointsA[0], pointsB[0], ANGLE_DEGREE) - ] +refs = [ + (pointsA[0], pointsB[1], 540.0 - ANGLE_DEGREE), + (pointsA[1], pointsB[1], ANGLE_DEGREE), + (pointsA[1], pointsB[0], 540.0 - ANGLE_DEGREE), + (pointsA[0], pointsB[0], ANGLE_DEGREE), +] aFlyoutPoint = geomDataAPI_Point2D(aConstraint.attribute("ConstraintFlyoutValuePnt")) for ref in refs: aSession.startOperation() - aFlyoutPoint.setValue(0.5 * (ref[0].x() + ref[1].x()), 0.5 * (ref[0].y() + ref[1].y())) + aFlyoutPoint.setValue( + 0.5 * (ref[0].x() + ref[1].x()), 0.5 * (ref[0].y() + ref[1].y()) + ) aSession.finishOperation() - assert(anAngleType.value() == ANGLE_BACKWARD) - assert(anAngleVal.value() == ref[2]) - assert(aStartPointA.x() == pointsA[0].x() and aStartPointA.y() == pointsA[0].y()) - assert(aEndPointA.x() == pointsA[1].x() and aEndPointA.y() == pointsA[1].y()) - assert(aStartPointB.x() == pointsB[0].x() and aStartPointB.y() == pointsB[0].y()) - assert(aEndPointB.x() == pointsB[1].x() and aEndPointB.y() == pointsB[1].y()) -#========================================================================= + assert anAngleType.value() == ANGLE_BACKWARD + assert anAngleVal.value() == ref[2] + assert aStartPointA.x() == pointsA[0].x() and aStartPointA.y() == pointsA[0].y() + assert aEndPointA.x() == pointsA[1].x() and aEndPointA.y() == pointsA[1].y() + assert aStartPointB.x() == pointsB[0].x() and aStartPointB.y() == pointsB[0].y() + assert aEndPointB.x() == pointsB[1].x() and aEndPointB.y() == pointsB[1].y() +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintAngleBehaviorBackward_2.py b/src/SketchPlugin/Test/TestConstraintAngleBehaviorBackward_2.py index 68b34d372..ad6d73d7b 100644 --- a/src/SketchPlugin/Test/TestConstraintAngleBehaviorBackward_2.py +++ b/src/SketchPlugin/Test/TestConstraintAngleBehaviorBackward_2.py @@ -23,9 +23,9 @@ import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2019-12-12" @@ -35,9 +35,9 @@ ANGLE_BACKWARD = 2 aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -48,60 +48,67 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create two lines -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchLineA = aSketchFeature.addFeature("SketchLine") aStartPointA = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint")) aEndPointA = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint")) -aStartPointA.setValue(-100., 25.) -aEndPointA.setValue(100., -25.) +aStartPointA.setValue(-100.0, 25.0) +aEndPointA.setValue(100.0, -25.0) aSketchLineB = aSketchFeature.addFeature("SketchLine") aStartPointB = geomDataAPI_Point2D(aSketchLineB.attribute("StartPoint")) aEndPointB = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint")) -aStartPointB.setValue(-100., -25.) -aEndPointB.setValue(100., 25.) +aStartPointB.setValue(-100.0, -25.0) +aEndPointB.setValue(100.0, 25.0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make a constraint to keep the angle -#========================================================================= -ANGLE_DEGREE = 330. +# ========================================================================= +ANGLE_DEGREE = 330.0 aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintAngle") anAngleType = aConstraint.integer("AngleType") anAngleType.setValue(ANGLE_BACKWARD) -geomDataAPI_Point2D(aConstraint.attribute("SelectedPointA")).setValue(aStartPointA.pnt()) -geomDataAPI_Point2D(aConstraint.attribute("SelectedPointB")).setValue(aStartPointB.pnt()) +geomDataAPI_Point2D(aConstraint.attribute("SelectedPointA")).setValue( + aStartPointA.pnt() +) +geomDataAPI_Point2D(aConstraint.attribute("SelectedPointB")).setValue( + aStartPointB.pnt() +) aConstraint.refattr("ConstraintEntityA").setObject(aSketchLineA.firstResult()) aConstraint.refattr("ConstraintEntityB").setObject(aSketchLineB.firstResult()) anAngleVal = aConstraint.real("AngleValue") anAngleVal.setValue(ANGLE_DEGREE) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Move presentation of the angle and check the angle value -#========================================================================= +# ========================================================================= pointsA = [aStartPointA.pnt(), aEndPointA.pnt()] pointsB = [aStartPointB.pnt(), aEndPointB.pnt()] -refs = [(pointsA[0], pointsB[1], 540. - ANGLE_DEGREE), - (pointsA[1], pointsB[1], ANGLE_DEGREE), - (pointsA[1], pointsB[0], 540. - ANGLE_DEGREE), - (pointsA[0], pointsB[0], ANGLE_DEGREE) - ] +refs = [ + (pointsA[0], pointsB[1], 540.0 - ANGLE_DEGREE), + (pointsA[1], pointsB[1], ANGLE_DEGREE), + (pointsA[1], pointsB[0], 540.0 - ANGLE_DEGREE), + (pointsA[0], pointsB[0], ANGLE_DEGREE), +] aFlyoutPoint = geomDataAPI_Point2D(aConstraint.attribute("ConstraintFlyoutValuePnt")) for ref in refs: aSession.startOperation() - aFlyoutPoint.setValue(0.5 * (ref[0].x() + ref[1].x()), 0.5 * (ref[0].y() + ref[1].y())) + aFlyoutPoint.setValue( + 0.5 * (ref[0].x() + ref[1].x()), 0.5 * (ref[0].y() + ref[1].y()) + ) aSession.finishOperation() - assert(anAngleType.value() == ANGLE_BACKWARD) - assert(anAngleVal.value() == ref[2]) - assert(aStartPointA.x() == pointsA[0].x() and aStartPointA.y() == pointsA[0].y()) - assert(aEndPointA.x() == pointsA[1].x() and aEndPointA.y() == pointsA[1].y()) - assert(aStartPointB.x() == pointsB[0].x() and aStartPointB.y() == pointsB[0].y()) - assert(aEndPointB.x() == pointsB[1].x() and aEndPointB.y() == pointsB[1].y()) -#========================================================================= + assert anAngleType.value() == ANGLE_BACKWARD + assert anAngleVal.value() == ref[2] + assert aStartPointA.x() == pointsA[0].x() and aStartPointA.y() == pointsA[0].y() + assert aEndPointA.x() == pointsA[1].x() and aEndPointA.y() == pointsA[1].y() + assert aStartPointB.x() == pointsB[0].x() and aStartPointB.y() == pointsB[0].y() + assert aEndPointB.x() == pointsB[1].x() and aEndPointB.y() == pointsB[1].y() +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintAngleBehaviorDirect.py b/src/SketchPlugin/Test/TestConstraintAngleBehaviorDirect.py index e62f69f6b..c8986345b 100644 --- a/src/SketchPlugin/Test/TestConstraintAngleBehaviorDirect.py +++ b/src/SketchPlugin/Test/TestConstraintAngleBehaviorDirect.py @@ -23,9 +23,9 @@ import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2019-12-12" @@ -35,9 +35,9 @@ ANGLE_BACKWARD = 2 aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -48,60 +48,67 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create two lines -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchLineA = aSketchFeature.addFeature("SketchLine") aStartPointA = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint")) aEndPointA = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint")) -aStartPointA.setValue(-100., 25.) -aEndPointA.setValue(100., -25.) +aStartPointA.setValue(-100.0, 25.0) +aEndPointA.setValue(100.0, -25.0) aSketchLineB = aSketchFeature.addFeature("SketchLine") aStartPointB = geomDataAPI_Point2D(aSketchLineB.attribute("StartPoint")) aEndPointB = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint")) -aStartPointB.setValue(-100., -25.) -aEndPointB.setValue(100., 25.) +aStartPointB.setValue(-100.0, -25.0) +aEndPointB.setValue(100.0, 25.0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make a constraint to keep the angle -#========================================================================= -ANGLE_DEGREE = 30. +# ========================================================================= +ANGLE_DEGREE = 30.0 aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintAngle") anAngleType = aConstraint.integer("AngleType") anAngleType.setValue(ANGLE_DIRECT) -geomDataAPI_Point2D(aConstraint.attribute("SelectedPointA")).setValue(aStartPointA.pnt()) -geomDataAPI_Point2D(aConstraint.attribute("SelectedPointB")).setValue(aStartPointB.pnt()) +geomDataAPI_Point2D(aConstraint.attribute("SelectedPointA")).setValue( + aStartPointA.pnt() +) +geomDataAPI_Point2D(aConstraint.attribute("SelectedPointB")).setValue( + aStartPointB.pnt() +) aConstraint.refattr("ConstraintEntityA").setObject(aSketchLineA.firstResult()) aConstraint.refattr("ConstraintEntityB").setObject(aSketchLineB.firstResult()) anAngleVal = aConstraint.real("AngleValue") anAngleVal.setValue(ANGLE_DEGREE) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Move presentation of the angle and check the angle value -#========================================================================= +# ========================================================================= pointsA = [aStartPointA.pnt(), aEndPointA.pnt()] pointsB = [aStartPointB.pnt(), aEndPointB.pnt()] -refs = [(pointsA[0], pointsB[1], 180. - ANGLE_DEGREE), - (pointsA[1], pointsB[1], ANGLE_DEGREE), - (pointsA[1], pointsB[0], 180. - ANGLE_DEGREE), - (pointsA[0], pointsB[0], ANGLE_DEGREE) - ] +refs = [ + (pointsA[0], pointsB[1], 180.0 - ANGLE_DEGREE), + (pointsA[1], pointsB[1], ANGLE_DEGREE), + (pointsA[1], pointsB[0], 180.0 - ANGLE_DEGREE), + (pointsA[0], pointsB[0], ANGLE_DEGREE), +] aFlyoutPoint = geomDataAPI_Point2D(aConstraint.attribute("ConstraintFlyoutValuePnt")) for ref in refs: aSession.startOperation() - aFlyoutPoint.setValue(0.5 * (ref[0].x() + ref[1].x()), 0.5 * (ref[0].y() + ref[1].y())) + aFlyoutPoint.setValue( + 0.5 * (ref[0].x() + ref[1].x()), 0.5 * (ref[0].y() + ref[1].y()) + ) aSession.finishOperation() - assert(anAngleType.value() == ANGLE_DIRECT) - assert(anAngleVal.value() == ref[2]) - assert(aStartPointA.x() == pointsA[0].x() and aStartPointA.y() == pointsA[0].y()) - assert(aEndPointA.x() == pointsA[1].x() and aEndPointA.y() == pointsA[1].y()) - assert(aStartPointB.x() == pointsB[0].x() and aStartPointB.y() == pointsB[0].y()) - assert(aEndPointB.x() == pointsB[1].x() and aEndPointB.y() == pointsB[1].y()) -#========================================================================= + assert anAngleType.value() == ANGLE_DIRECT + assert anAngleVal.value() == ref[2] + assert aStartPointA.x() == pointsA[0].x() and aStartPointA.y() == pointsA[0].y() + assert aEndPointA.x() == pointsA[1].x() and aEndPointA.y() == pointsA[1].y() + assert aStartPointB.x() == pointsB[0].x() and aStartPointB.y() == pointsB[0].y() + assert aEndPointB.x() == pointsB[1].x() and aEndPointB.y() == pointsB[1].y() +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintAngleBehaviorSupplementary_1.py b/src/SketchPlugin/Test/TestConstraintAngleBehaviorSupplementary_1.py index 8ca4923ef..6dbe697dc 100644 --- a/src/SketchPlugin/Test/TestConstraintAngleBehaviorSupplementary_1.py +++ b/src/SketchPlugin/Test/TestConstraintAngleBehaviorSupplementary_1.py @@ -23,9 +23,9 @@ import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2019-12-12" @@ -35,9 +35,9 @@ ANGLE_BACKWARD = 2 aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -48,66 +48,73 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create two lines -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchLineA = aSketchFeature.addFeature("SketchLine") aStartPointA = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint")) aEndPointA = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint")) -aStartPointA.setValue(-100., 25.) -aEndPointA.setValue(100., -25.) +aStartPointA.setValue(-100.0, 25.0) +aEndPointA.setValue(100.0, -25.0) aSketchLineB = aSketchFeature.addFeature("SketchLine") aStartPointB = geomDataAPI_Point2D(aSketchLineB.attribute("StartPoint")) aEndPointB = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint")) -aStartPointB.setValue(-100., -25.) -aEndPointB.setValue(100., 25.) +aStartPointB.setValue(-100.0, -25.0) +aEndPointB.setValue(100.0, 25.0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make a constraint to keep the angle -#========================================================================= -ANGLE_DEGREE = 30. +# ========================================================================= +ANGLE_DEGREE = 30.0 aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintAngle") anAngleType = aConstraint.integer("AngleType") anAngleType.setValue(ANGLE_DIRECT) -geomDataAPI_Point2D(aConstraint.attribute("SelectedPointA")).setValue(aStartPointA.pnt()) -geomDataAPI_Point2D(aConstraint.attribute("SelectedPointB")).setValue(aStartPointB.pnt()) +geomDataAPI_Point2D(aConstraint.attribute("SelectedPointA")).setValue( + aStartPointA.pnt() +) +geomDataAPI_Point2D(aConstraint.attribute("SelectedPointB")).setValue( + aStartPointB.pnt() +) aConstraint.refattr("ConstraintEntityA").setObject(aSketchLineA.firstResult()) aConstraint.refattr("ConstraintEntityB").setObject(aSketchLineB.firstResult()) anAngleVal = aConstraint.real("AngleValue") anAngleVal.setValue(ANGLE_DEGREE) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Change the type of the constraint -#========================================================================= +# ========================================================================= aSession.startOperation() anAngleType.setValue(ANGLE_COMPLEMENTARY) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Move presentation of the angle and check the angle value -#========================================================================= +# ========================================================================= pointsA = [aStartPointA.pnt(), aEndPointA.pnt()] pointsB = [aStartPointB.pnt(), aEndPointB.pnt()] -refs = [(pointsA[0], pointsB[0], ANGLE_DEGREE), - (pointsA[0], pointsB[1], 180. - ANGLE_DEGREE), - (pointsA[1], pointsB[1], ANGLE_DEGREE), - (pointsA[1], pointsB[0], 180. - ANGLE_DEGREE), - ] +refs = [ + (pointsA[0], pointsB[0], ANGLE_DEGREE), + (pointsA[0], pointsB[1], 180.0 - ANGLE_DEGREE), + (pointsA[1], pointsB[1], ANGLE_DEGREE), + (pointsA[1], pointsB[0], 180.0 - ANGLE_DEGREE), +] aFlyoutPoint = geomDataAPI_Point2D(aConstraint.attribute("ConstraintFlyoutValuePnt")) for ref in refs: aSession.startOperation() - aFlyoutPoint.setValue(0.5 * (ref[0].x() + ref[1].x()), 0.5 * (ref[0].y() + ref[1].y())) + aFlyoutPoint.setValue( + 0.5 * (ref[0].x() + ref[1].x()), 0.5 * (ref[0].y() + ref[1].y()) + ) aSession.finishOperation() - assert(anAngleType.value() == ANGLE_COMPLEMENTARY) - assert(anAngleVal.value() == ref[2]) - assert(aStartPointA.x() == pointsA[0].x() and aStartPointA.y() == pointsA[0].y()) - assert(aEndPointA.x() == pointsA[1].x() and aEndPointA.y() == pointsA[1].y()) - assert(aStartPointB.x() == pointsB[0].x() and aStartPointB.y() == pointsB[0].y()) - assert(aEndPointB.x() == pointsB[1].x() and aEndPointB.y() == pointsB[1].y()) -#========================================================================= + assert anAngleType.value() == ANGLE_COMPLEMENTARY + assert anAngleVal.value() == ref[2] + assert aStartPointA.x() == pointsA[0].x() and aStartPointA.y() == pointsA[0].y() + assert aEndPointA.x() == pointsA[1].x() and aEndPointA.y() == pointsA[1].y() + assert aStartPointB.x() == pointsB[0].x() and aStartPointB.y() == pointsB[0].y() + assert aEndPointB.x() == pointsB[1].x() and aEndPointB.y() == pointsB[1].y() +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintAngleBehaviorSupplementary_2.py b/src/SketchPlugin/Test/TestConstraintAngleBehaviorSupplementary_2.py index 0bed57c8f..3526be95b 100644 --- a/src/SketchPlugin/Test/TestConstraintAngleBehaviorSupplementary_2.py +++ b/src/SketchPlugin/Test/TestConstraintAngleBehaviorSupplementary_2.py @@ -23,9 +23,9 @@ import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2019-12-12" @@ -35,9 +35,9 @@ ANGLE_BACKWARD = 2 aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -48,60 +48,67 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create two lines -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchLineA = aSketchFeature.addFeature("SketchLine") aStartPointA = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint")) aEndPointA = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint")) -aStartPointA.setValue(-100., 25.) -aEndPointA.setValue(100., -25.) +aStartPointA.setValue(-100.0, 25.0) +aEndPointA.setValue(100.0, -25.0) aSketchLineB = aSketchFeature.addFeature("SketchLine") aStartPointB = geomDataAPI_Point2D(aSketchLineB.attribute("StartPoint")) aEndPointB = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint")) -aStartPointB.setValue(-100., -25.) -aEndPointB.setValue(100., 25.) +aStartPointB.setValue(-100.0, -25.0) +aEndPointB.setValue(100.0, 25.0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Make a constraint to keep the angle -#========================================================================= -ANGLE_DEGREE = 30. +# ========================================================================= +ANGLE_DEGREE = 30.0 aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintAngle") anAngleType = aConstraint.integer("AngleType") anAngleType.setValue(ANGLE_COMPLEMENTARY) -geomDataAPI_Point2D(aConstraint.attribute("SelectedPointA")).setValue(aStartPointA.pnt()) -geomDataAPI_Point2D(aConstraint.attribute("SelectedPointB")).setValue(aStartPointB.pnt()) +geomDataAPI_Point2D(aConstraint.attribute("SelectedPointA")).setValue( + aStartPointA.pnt() +) +geomDataAPI_Point2D(aConstraint.attribute("SelectedPointB")).setValue( + aStartPointB.pnt() +) aConstraint.refattr("ConstraintEntityA").setObject(aSketchLineA.firstResult()) aConstraint.refattr("ConstraintEntityB").setObject(aSketchLineB.firstResult()) anAngleVal = aConstraint.real("AngleValue") anAngleVal.setValue(ANGLE_DEGREE) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Move presentation of the angle and check the angle value -#========================================================================= +# ========================================================================= pointsA = [aStartPointA.pnt(), aEndPointA.pnt()] pointsB = [aStartPointB.pnt(), aEndPointB.pnt()] -refs = [(pointsA[0], pointsB[0], ANGLE_DEGREE), - (pointsA[0], pointsB[1], 180. - ANGLE_DEGREE), - (pointsA[1], pointsB[1], ANGLE_DEGREE), - (pointsA[1], pointsB[0], 180. - ANGLE_DEGREE), - ] +refs = [ + (pointsA[0], pointsB[0], ANGLE_DEGREE), + (pointsA[0], pointsB[1], 180.0 - ANGLE_DEGREE), + (pointsA[1], pointsB[1], ANGLE_DEGREE), + (pointsA[1], pointsB[0], 180.0 - ANGLE_DEGREE), +] aFlyoutPoint = geomDataAPI_Point2D(aConstraint.attribute("ConstraintFlyoutValuePnt")) for ref in refs: aSession.startOperation() - aFlyoutPoint.setValue(0.5 * (ref[0].x() + ref[1].x()), 0.5 * (ref[0].y() + ref[1].y())) + aFlyoutPoint.setValue( + 0.5 * (ref[0].x() + ref[1].x()), 0.5 * (ref[0].y() + ref[1].y()) + ) aSession.finishOperation() - assert(anAngleType.value() == ANGLE_COMPLEMENTARY) - assert(anAngleVal.value() == ref[2]) - assert(aStartPointA.x() == pointsA[0].x() and aStartPointA.y() == pointsA[0].y()) - assert(aEndPointA.x() == pointsA[1].x() and aEndPointA.y() == pointsA[1].y()) - assert(aStartPointB.x() == pointsB[0].x() and aStartPointB.y() == pointsB[0].y()) - assert(aEndPointB.x() == pointsB[1].x() and aEndPointB.y() == pointsB[1].y()) -#========================================================================= + assert anAngleType.value() == ANGLE_COMPLEMENTARY + assert anAngleVal.value() == ref[2] + assert aStartPointA.x() == pointsA[0].x() and aStartPointA.y() == pointsA[0].y() + assert aEndPointA.x() == pointsA[1].x() and aEndPointA.y() == pointsA[1].y() + assert aStartPointB.x() == pointsB[0].x() and aStartPointB.y() == pointsB[0].y() + assert aEndPointB.x() == pointsB[1].x() and aEndPointB.y() == pointsB[1].y() +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintAngleEllipse.py b/src/SketchPlugin/Test/TestConstraintAngleEllipse.py index c9eaeda8f..70e600d53 100644 --- a/src/SketchPlugin/Test/TestConstraintAngleEllipse.py +++ b/src/SketchPlugin/Test/TestConstraintAngleEllipse.py @@ -31,92 +31,123 @@ from SketchAPI import * __updated__ = "2019-09-12" + class TestAngleEllipse(unittest.TestCase): - def setUp(self): - axisStart = GeomAPI_Pnt2d(30., 60.) - axisEnd = GeomAPI_Pnt2d(80., 50.) - passedPoint = GeomAPI_Pnt2d(60., 60.) - self.myAngle = 60 - - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - macroEllipse = self.mySketch.addEllipse(axisStart, axisEnd, passedPoint, False) - self.myDOF = 5 - self.myOX = self.mySketch.addLine("OX") - model.do() - self.myEllipse = SketchAPI_Ellipse(model.lastSubFeature(self.mySketch, "SketchEllipse")) - self.myCenter = macroEllipse.center() - self.myFocus1 = macroEllipse.focus1() - self.myFocus2 = macroEllipse.focus2() - self.myMajorAxis = macroEllipse.majorAxis() - self.myMajorStart = macroEllipse.majorAxisStart() - self.myMajorEnd = macroEllipse.majorAxisEnd() - self.myMinorAxis = macroEllipse.minorAxis() - self.myMinorStart = macroEllipse.minorAxisStart() - self.myMinorEnd = macroEllipse.minorAxisEnd() - - - def tearDown(self): - model.end() - self.checkDOF() - self.assertPoints(self.myCenter.coordinates(), self.myEllipse.center()) - self.assertPoints(self.myFocus1.coordinates(), self.myEllipse.firstFocus()) - self.assertPoints(self.myFocus2.coordinates(), self.myEllipse.secondFocus()) - self.assertPoints(self.myMajorStart.coordinates(), self.myEllipse.majorAxisNegative()) - self.assertPoints(self.myMajorEnd.coordinates(), self.myEllipse.majorAxisPositive()) - self.assertPoints(self.myMajorAxis.startPoint(), self.myEllipse.majorAxisNegative()) - self.assertPoints(self.myMajorAxis.endPoint(), self.myEllipse.majorAxisPositive()) - self.assertPoints(self.myMinorStart.coordinates(), self.myEllipse.minorAxisNegative()) - self.assertPoints(self.myMinorEnd.coordinates(), self.myEllipse.minorAxisPositive()) - self.assertPoints(self.myMinorAxis.startPoint(), self.myEllipse.minorAxisNegative()) - self.assertPoints(self.myMinorAxis.endPoint(), self.myEllipse.minorAxisPositive()) - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidenceInternal", 11) - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def assertPoints(self, thePoint1, thePoint2): - self.assertAlmostEqual(thePoint1.x(), thePoint2.x()) - self.assertAlmostEqual(thePoint1.y(), thePoint2.y()) - - def assertAngle(self, theStart, theEnd, theAngle): - dirX = (theEnd.x() - theStart.x()) / math.hypot(theEnd.x() - theStart.x(), theEnd.y() - theStart.y()) - self.assertAlmostEqual(math.fabs(dirX), math.cos(theAngle * math.pi / 180)) - - - def test_angle_major_axis(self): - """ Test 1. Make angle between major axis of ellipse and OX - """ - self.mySketch.setAngle(self.myOX.result(), self.myMajorAxis.result(), self.myAngle) - self.myDOF -= 1 - model.do() - self.assertAngle(self.myMajorAxis.startPoint(), self.myMajorAxis.endPoint(), self.myAngle) - self.assertAngle(self.myMajorStart.coordinates(), self.myMajorEnd.coordinates(), self.myAngle) - model.testNbSubFeatures(self.mySketch, "SketchConstraintAngle", 1) - - def test_angle_minor_axis(self): - """ Test 2. Make angle between minor axis of ellipse and OX - """ - self.mySketch.setAngle(self.myOX.result(), self.myMinorAxis.result(), self.myAngle) - self.myDOF -= 1 - model.do() - self.assertAngle(self.myMinorAxis.startPoint(), self.myMinorAxis.endPoint(), self.myAngle) - self.assertAngle(self.myMinorStart.coordinates(), self.myMinorEnd.coordinates(), self.myAngle) - model.testNbSubFeatures(self.mySketch, "SketchConstraintAngle", 1) - - def test_angle_ellipse_axes(self): - """ Test 3. Set angle between axes of an ellipse. Check conflicting constraints. - """ - self.mySketch.setAngle(self.myMajorAxis.result(), self.myMinorAxis.result(), self.myAngle) - model.end() - self.assertNotEqual(self.mySketch.solverError(), "") - model.undo() - model.begin() + def setUp(self): + axisStart = GeomAPI_Pnt2d(30.0, 60.0) + axisEnd = GeomAPI_Pnt2d(80.0, 50.0) + passedPoint = GeomAPI_Pnt2d(60.0, 60.0) + self.myAngle = 60 + + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + macroEllipse = self.mySketch.addEllipse(axisStart, axisEnd, passedPoint, False) + self.myDOF = 5 + self.myOX = self.mySketch.addLine("OX") + model.do() + self.myEllipse = SketchAPI_Ellipse( + model.lastSubFeature(self.mySketch, "SketchEllipse") + ) + self.myCenter = macroEllipse.center() + self.myFocus1 = macroEllipse.focus1() + self.myFocus2 = macroEllipse.focus2() + self.myMajorAxis = macroEllipse.majorAxis() + self.myMajorStart = macroEllipse.majorAxisStart() + self.myMajorEnd = macroEllipse.majorAxisEnd() + self.myMinorAxis = macroEllipse.minorAxis() + self.myMinorStart = macroEllipse.minorAxisStart() + self.myMinorEnd = macroEllipse.minorAxisEnd() + + def tearDown(self): + model.end() + self.checkDOF() + self.assertPoints(self.myCenter.coordinates(), self.myEllipse.center()) + self.assertPoints(self.myFocus1.coordinates(), self.myEllipse.firstFocus()) + self.assertPoints(self.myFocus2.coordinates(), self.myEllipse.secondFocus()) + self.assertPoints( + self.myMajorStart.coordinates(), self.myEllipse.majorAxisNegative() + ) + self.assertPoints( + self.myMajorEnd.coordinates(), self.myEllipse.majorAxisPositive() + ) + self.assertPoints( + self.myMajorAxis.startPoint(), self.myEllipse.majorAxisNegative() + ) + self.assertPoints( + self.myMajorAxis.endPoint(), self.myEllipse.majorAxisPositive() + ) + self.assertPoints( + self.myMinorStart.coordinates(), self.myEllipse.minorAxisNegative() + ) + self.assertPoints( + self.myMinorEnd.coordinates(), self.myEllipse.minorAxisPositive() + ) + self.assertPoints( + self.myMinorAxis.startPoint(), self.myEllipse.minorAxisNegative() + ) + self.assertPoints( + self.myMinorAxis.endPoint(), self.myEllipse.minorAxisPositive() + ) + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintCoincidenceInternal", 11 + ) + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def assertPoints(self, thePoint1, thePoint2): + self.assertAlmostEqual(thePoint1.x(), thePoint2.x()) + self.assertAlmostEqual(thePoint1.y(), thePoint2.y()) + + def assertAngle(self, theStart, theEnd, theAngle): + dirX = (theEnd.x() - theStart.x()) / math.hypot( + theEnd.x() - theStart.x(), theEnd.y() - theStart.y() + ) + self.assertAlmostEqual(math.fabs(dirX), math.cos(theAngle * math.pi / 180)) + + def test_angle_major_axis(self): + """Test 1. Make angle between major axis of ellipse and OX""" + self.mySketch.setAngle( + self.myOX.result(), self.myMajorAxis.result(), self.myAngle + ) + self.myDOF -= 1 + model.do() + self.assertAngle( + self.myMajorAxis.startPoint(), self.myMajorAxis.endPoint(), self.myAngle + ) + self.assertAngle( + self.myMajorStart.coordinates(), self.myMajorEnd.coordinates(), self.myAngle + ) + model.testNbSubFeatures(self.mySketch, "SketchConstraintAngle", 1) + + def test_angle_minor_axis(self): + """Test 2. Make angle between minor axis of ellipse and OX""" + self.mySketch.setAngle( + self.myOX.result(), self.myMinorAxis.result(), self.myAngle + ) + self.myDOF -= 1 + model.do() + self.assertAngle( + self.myMinorAxis.startPoint(), self.myMinorAxis.endPoint(), self.myAngle + ) + self.assertAngle( + self.myMinorStart.coordinates(), self.myMinorEnd.coordinates(), self.myAngle + ) + model.testNbSubFeatures(self.mySketch, "SketchConstraintAngle", 1) + + def test_angle_ellipse_axes(self): + """Test 3. Set angle between axes of an ellipse. Check conflicting constraints.""" + self.mySketch.setAngle( + self.myMajorAxis.result(), self.myMinorAxis.result(), self.myAngle + ) + model.end() + self.assertNotEqual(self.mySketch.solverError(), "") + model.undo() + model.begin() if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestConstraintAngle_v0_1.py b/src/SketchPlugin/Test/TestConstraintAngle_v0_1.py index cb08be5bc..392f1d73b 100644 --- a/src/SketchPlugin/Test/TestConstraintAngle_v0_1.py +++ b/src/SketchPlugin/Test/TestConstraintAngle_v0_1.py @@ -24,225 +24,648 @@ 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(-17.48270627886662, -77.57247534383079, 0.4653113240225388, -68.74815303974528) -SketchLine_2 = Sketch_1.addLine(0.4653113240225388, -68.74815303974528, 8.542125432770632, -50.45156664083665) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(8.542125432770632, -50.45156664083665, -8.178735979228234, 7.171456480488104) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-17.48270627886662, -77.57247534383079, -36.90385046950819, -72.79553507559329) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(-48.71075203912585, -56.65251567631857, -36.90385046950819, -72.79553507559329) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.endPoint()) -SketchLine_6 = Sketch_1.addLine(-48.71075203912585, -56.65251567631857, -47.37883052420096, -36.69691533260352) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_6.startPoint()) -SketchLine_7 = Sketch_1.addLine(-30.39232801419296, -18.99499937550162, -47.37883052420096, -36.69691533260352) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.endPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_2.result(), 220) -SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_2.result(), 140) -SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_4.result(), 140) -SketchConstraintAngle_4 = Sketch_1.setAngle(SketchLine_6.result(), SketchLine_5.result(), 220) -SketchConstraintAngle_5 = Sketch_1.setAngle(SketchLine_5.result(), SketchLine_4.result(), 220) -SketchConstraintAngle_6 = Sketch_1.setAngle(SketchLine_6.result(), SketchLine_7.result(), 140) +SketchLine_1 = Sketch_1.addLine( + -17.48270627886662, -77.57247534383079, 0.4653113240225388, -68.74815303974528 +) +SketchLine_2 = Sketch_1.addLine( + 0.4653113240225388, -68.74815303974528, 8.542125432770632, -50.45156664083665 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 8.542125432770632, -50.45156664083665, -8.178735979228234, 7.171456480488104 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -17.48270627886662, -77.57247534383079, -36.90385046950819, -72.79553507559329 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + -48.71075203912585, -56.65251567631857, -36.90385046950819, -72.79553507559329 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.endPoint() +) +SketchLine_6 = Sketch_1.addLine( + -48.71075203912585, -56.65251567631857, -47.37883052420096, -36.69691533260352 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_6.startPoint() +) +SketchLine_7 = Sketch_1.addLine( + -30.39232801419296, -18.99499937550162, -47.37883052420096, -36.69691533260352 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.endPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_2.result(), 220 +) +SketchConstraintAngle_2 = Sketch_1.setAngle( + SketchLine_3.result(), SketchLine_2.result(), 140 +) +SketchConstraintAngle_3 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_4.result(), 140 +) +SketchConstraintAngle_4 = Sketch_1.setAngle( + SketchLine_6.result(), SketchLine_5.result(), 220 +) +SketchConstraintAngle_5 = Sketch_1.setAngle( + SketchLine_5.result(), SketchLine_4.result(), 220 +) +SketchConstraintAngle_6 = Sketch_1.setAngle( + SketchLine_6.result(), SketchLine_7.result(), 140 +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_4.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_5.result()) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_6.result()) -SketchLine_8 = Sketch_1.addLine(14.775406531722, -47.38691166633646, -20.64529817713098, 1.042146531487715) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_1.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_4.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_5.result() +) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_6.result() +) +SketchLine_8 = Sketch_1.addLine( + 14.775406531722, -47.38691166633646, -20.64529817713098, 1.042146531487715 +) SketchPoint_1 = Sketch_1.addPoint(2.968504962104344, -31.24389226706174) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_3.result()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_8.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.endPoint(), SketchPoint_1.coordinates(), 20, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.startPoint(), SketchPoint_1.coordinates(), 20, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_3.endPoint(), 40, True) -SketchConstraintEqual_5 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_8.result()) -SketchLine_9 = Sketch_1.addLine(19.58460105006861, -42.37517030669127, -30.26368721382418, -8.981336187802668) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_9.result()) -SketchConstraintEqual_6 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_9.result()) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_9.startPoint(), SketchPoint_1.coordinates(), 20, True) -SketchConstraintAngle_7 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_8.result(), 20) -SketchConstraintAngle_8 = Sketch_1.setAngle(SketchLine_9.result(), SketchLine_8.result(), 340) -SketchLine_10 = Sketch_1.addLine(3.875430505227681, -29.75334619738324, -48.69363438803513, -0.8311502875301234) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_3.result() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_8.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_2.endPoint(), SketchPoint_1.coordinates(), 20, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_8.startPoint(), SketchPoint_1.coordinates(), 20, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchPoint_1.coordinates(), SketchLine_3.endPoint(), 40, True +) +SketchConstraintEqual_5 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_8.result() +) +SketchLine_9 = Sketch_1.addLine( + 19.58460105006861, -42.37517030669127, -30.26368721382418, -8.981336187802668 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_9.result() +) +SketchConstraintEqual_6 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_9.result() +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_9.startPoint(), SketchPoint_1.coordinates(), 20, True +) +SketchConstraintAngle_7 = Sketch_1.setAngle( + SketchLine_3.result(), SketchLine_8.result(), 20 +) +SketchConstraintAngle_8 = Sketch_1.setAngle( + SketchLine_9.result(), SketchLine_8.result(), 340 +) +SketchLine_10 = Sketch_1.addLine( + 3.875430505227681, -29.75334619738324, -48.69363438803513, -0.8311502875301234 +) SketchPoint_2 = Sketch_1.addPoint(-13.64759112585992, -20.1126142274322) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_10.result()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_9.result()) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_10.startPoint(), 20, True) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_9.endPoint(), 20, True) -SketchConstraintEqual_7 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(0.001529676402264532, -26.13785899518266, -31.94417752476854, -12.03580011868412) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_11.result()) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_11.endPoint(), SketchPoint_2.coordinates(), 20, True) -SketchConstraintAngle_9 = Sketch_1.setAngle(SketchLine_9.result(), SketchLine_10.result(), 185) -SketchConstraintAngle_10 = Sketch_1.setAngle(SketchLine_11.result(), SketchLine_10.result(), 355) -SketchLine_12 = Sketch_1.addLine(5.283311970593094, -26.56404104269606, -51.50939731876596, -7.20976059690448) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_12.result()) -SketchConstraintEqual_8 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_12.result()) -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_12.startPoint(), 20, True) -SketchConstraintAngle_11 = Sketch_1.setAngle(SketchLine_12.result(), SketchLine_11.result(), 355) -SketchLine_13 = Sketch_1.addLine(25.19469725542325, -29.66649476390714, -33.06873531650151, -15.33567395919474) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_13.result()) -SketchConstraintEqual_9 = Sketch_1.setEqual(SketchLine_12.result(), SketchLine_13.result()) -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_13.endPoint(), SketchPoint_2.coordinates(), 20, True) -SketchConstraintAngle_12 = Sketch_1.setAngle(SketchLine_12.result(), SketchLine_13.result(), 185) -SketchLine_14 = Sketch_1.addLine(25.87956617560386, -26.24481087018098, -33.41116977659181, -17.04651590605781) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_14.result()) -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchLine_14.endPoint(), SketchPoint_2.coordinates(), 20, True) -SketchConstraintAngle_13 = Sketch_1.setAngle(SketchLine_13.result(), SketchLine_14.result(), 5) -SketchConstraintEqual_10 = Sketch_1.setEqual(SketchLine_13.result(), SketchLine_14.result()) -SketchLine_15 = Sketch_1.addLine(26.26360956157018, -22.77645725728195, -33.60319146957497, -18.78069271250733) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_15.result()) -SketchConstraintEqual_11 = Sketch_1.setEqual(SketchLine_14.result(), SketchLine_15.result()) -SketchConstraintDistance_11 = Sketch_1.setDistance(SketchLine_15.endPoint(), SketchPoint_2.coordinates(), 20, True) -SketchConstraintAngle_14 = Sketch_1.setAngle(SketchLine_15.result(), SketchLine_14.result(), 355) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchLine_15.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_10.result() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_9.result() +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchPoint_2.coordinates(), SketchLine_10.startPoint(), 20, True +) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchPoint_2.coordinates(), SketchLine_9.endPoint(), 20, True +) +SketchConstraintEqual_7 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_10.result() +) +SketchLine_11 = Sketch_1.addLine( + 0.001529676402264532, -26.13785899518266, -31.94417752476854, -12.03580011868412 +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_11.result() +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchLine_11.endPoint(), SketchPoint_2.coordinates(), 20, True +) +SketchConstraintAngle_9 = Sketch_1.setAngle( + SketchLine_9.result(), SketchLine_10.result(), 185 +) +SketchConstraintAngle_10 = Sketch_1.setAngle( + SketchLine_11.result(), SketchLine_10.result(), 355 +) +SketchLine_12 = Sketch_1.addLine( + 5.283311970593094, -26.56404104269606, -51.50939731876596, -7.20976059690448 +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_12.result() +) +SketchConstraintEqual_8 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_12.result() +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchPoint_2.coordinates(), SketchLine_12.startPoint(), 20, True +) +SketchConstraintAngle_11 = Sketch_1.setAngle( + SketchLine_12.result(), SketchLine_11.result(), 355 +) +SketchLine_13 = Sketch_1.addLine( + 25.19469725542325, -29.66649476390714, -33.06873531650151, -15.33567395919474 +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_13.result() +) +SketchConstraintEqual_9 = Sketch_1.setEqual( + SketchLine_12.result(), SketchLine_13.result() +) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_13.endPoint(), SketchPoint_2.coordinates(), 20, True +) +SketchConstraintAngle_12 = Sketch_1.setAngle( + SketchLine_12.result(), SketchLine_13.result(), 185 +) +SketchLine_14 = Sketch_1.addLine( + 25.87956617560386, -26.24481087018098, -33.41116977659181, -17.04651590605781 +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_14.result() +) +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchLine_14.endPoint(), SketchPoint_2.coordinates(), 20, True +) +SketchConstraintAngle_13 = Sketch_1.setAngle( + SketchLine_13.result(), SketchLine_14.result(), 5 +) +SketchConstraintEqual_10 = Sketch_1.setEqual( + SketchLine_13.result(), SketchLine_14.result() +) +SketchLine_15 = Sketch_1.addLine( + 26.26360956157018, -22.77645725728195, -33.60319146957497, -18.78069271250733 +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_15.result() +) +SketchConstraintEqual_11 = Sketch_1.setEqual( + SketchLine_14.result(), SketchLine_15.result() +) +SketchConstraintDistance_11 = Sketch_1.setDistance( + SketchLine_15.endPoint(), SketchPoint_2.coordinates(), 20, True +) +SketchConstraintAngle_14 = Sketch_1.setAngle( + SketchLine_15.result(), SketchLine_14.result(), 355 +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchLine_15.result() +) -SketchLine_16 = Sketch_1.addLine(60.00388909712782, -76.09960829009104, 78.00643494689578, -67.38706888260469) -SketchLine_17 = Sketch_1.addLine(78.00643494689578, -67.38706888260469, 86.19687277706721, -49.141063069) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) -SketchLine_18 = Sketch_1.addLine(86.19687277706721, -49.141063069, 69.83467154684908, 8.584826884311665) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) -SketchLine_19 = Sketch_1.addLine(60.00388909712782, -76.09960829009104, 40.61282650688053, -71.20198727360641) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_16.startPoint(), SketchLine_19.startPoint()) -SketchLine_20 = Sketch_1.addLine(28.90654086978602, -54.98585713775849, 40.61282650688053, -71.20198727360641) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.endPoint()) -SketchLine_21 = Sketch_1.addLine(28.90654086978602, -54.98585713775849, 30.36253333631381, -35.03892539532215) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_20.startPoint(), SketchLine_21.startPoint()) -SketchLine_22 = Sketch_1.addLine(47.45878924889096, -17.44298467461911, 30.36253333631381, -35.03892539532215) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchLine_22.endPoint()) -SketchConstraintAngle_15 = Sketch_1.setAngleComplementary(SketchLine_16.result(), SketchLine_17.result(), 40) -SketchConstraintAngle_16 = Sketch_1.setAngleComplementary(SketchLine_18.result(), SketchLine_17.result(), 40) -SketchConstraintAngle_17 = Sketch_1.setAngleComplementary(SketchLine_16.result(), SketchLine_19.result(), 40) -SketchConstraintAngle_18 = Sketch_1.setAngleComplementary(SketchLine_21.result(), SketchLine_20.result(), 40) -SketchConstraintAngle_19 = Sketch_1.setAngleComplementary(SketchLine_20.result(), SketchLine_19.result(), 40) -SketchConstraintAngle_20 = Sketch_1.setAngleComplementary(SketchLine_21.result(), SketchLine_22.result(), 40) +SketchLine_16 = Sketch_1.addLine( + 60.00388909712782, -76.09960829009104, 78.00643494689578, -67.38706888260469 +) +SketchLine_17 = Sketch_1.addLine( + 78.00643494689578, -67.38706888260469, 86.19687277706721, -49.141063069 +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) +SketchLine_18 = Sketch_1.addLine( + 86.19687277706721, -49.141063069, 69.83467154684908, 8.584826884311665 +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) +SketchLine_19 = Sketch_1.addLine( + 60.00388909712782, -76.09960829009104, 40.61282650688053, -71.20198727360641 +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_16.startPoint(), SketchLine_19.startPoint() +) +SketchLine_20 = Sketch_1.addLine( + 28.90654086978602, -54.98585713775849, 40.61282650688053, -71.20198727360641 +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.endPoint() +) +SketchLine_21 = Sketch_1.addLine( + 28.90654086978602, -54.98585713775849, 30.36253333631381, -35.03892539532215 +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_20.startPoint(), SketchLine_21.startPoint() +) +SketchLine_22 = Sketch_1.addLine( + 47.45878924889096, -17.44298467461911, 30.36253333631381, -35.03892539532215 +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchLine_22.endPoint() +) +SketchConstraintAngle_15 = Sketch_1.setAngleComplementary( + SketchLine_16.result(), SketchLine_17.result(), 40 +) +SketchConstraintAngle_16 = Sketch_1.setAngleComplementary( + SketchLine_18.result(), SketchLine_17.result(), 40 +) +SketchConstraintAngle_17 = Sketch_1.setAngleComplementary( + SketchLine_16.result(), SketchLine_19.result(), 40 +) +SketchConstraintAngle_18 = Sketch_1.setAngleComplementary( + SketchLine_21.result(), SketchLine_20.result(), 40 +) +SketchConstraintAngle_19 = Sketch_1.setAngleComplementary( + SketchLine_20.result(), SketchLine_19.result(), 40 +) +SketchConstraintAngle_20 = Sketch_1.setAngleComplementary( + SketchLine_21.result(), SketchLine_22.result(), 40 +) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_17.result(), 20) -SketchConstraintEqual_12 = Sketch_1.setEqual(SketchLine_17.result(), SketchLine_16.result()) -SketchConstraintEqual_13 = Sketch_1.setEqual(SketchLine_17.result(), SketchLine_19.result()) -SketchConstraintEqual_14 = Sketch_1.setEqual(SketchLine_17.result(), SketchLine_20.result()) -SketchConstraintEqual_15 = Sketch_1.setEqual(SketchLine_17.result(), SketchLine_21.result()) -SketchLine_23 = Sketch_1.addLine(92.44909133742235, -46.11522988707736, 57.3302344261388, 2.533160520466375) +SketchConstraintEqual_12 = Sketch_1.setEqual( + SketchLine_17.result(), SketchLine_16.result() +) +SketchConstraintEqual_13 = Sketch_1.setEqual( + SketchLine_17.result(), SketchLine_19.result() +) +SketchConstraintEqual_14 = Sketch_1.setEqual( + SketchLine_17.result(), SketchLine_20.result() +) +SketchConstraintEqual_15 = Sketch_1.setEqual( + SketchLine_17.result(), SketchLine_21.result() +) +SketchLine_23 = Sketch_1.addLine( + 92.44909133742235, -46.11522988707736, 57.3302344261388, 2.533160520466375 +) SketchPoint_3 = Sketch_1.addPoint(80.74280570032784, -29.89909975122945) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_18.result()) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_23.result()) -SketchConstraintDistance_12 = Sketch_1.setDistance(SketchLine_17.endPoint(), SketchPoint_3.coordinates(), 20, True) -SketchConstraintDistance_13 = Sketch_1.setDistance(SketchLine_23.startPoint(), SketchPoint_3.coordinates(), 20, True) -SketchConstraintDistance_14 = Sketch_1.setDistance(SketchPoint_3.coordinates(), SketchLine_18.endPoint(), 40, True) -SketchConstraintEqual_16 = Sketch_1.setEqual(SketchLine_18.result(), SketchLine_23.result()) -SketchLine_24 = Sketch_1.addLine(97.289359083568, -41.13349208617944, 47.64969893384747, -7.430315081329468) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_24.result()) -SketchConstraintEqual_17 = Sketch_1.setEqual(SketchLine_18.result(), SketchLine_24.result()) -SketchConstraintDistance_15 = Sketch_1.setDistance(SketchLine_24.startPoint(), SketchPoint_3.coordinates(), 20, True) -SketchConstraintAngle_21 = Sketch_1.setAngleComplementary(SketchLine_18.result(), SketchLine_23.result(), 160) -SketchConstraintAngle_22 = Sketch_1.setAngleComplementary(SketchLine_24.result(), SketchLine_23.result(), 160) -SketchLine_25 = Sketch_1.addLine(81.65898287743471, -28.41422234660911, 29.27079119639352, 0.8343224443798635) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_18.result() +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_23.result() +) +SketchConstraintDistance_12 = Sketch_1.setDistance( + SketchLine_17.endPoint(), SketchPoint_3.coordinates(), 20, True +) +SketchConstraintDistance_13 = Sketch_1.setDistance( + SketchLine_23.startPoint(), SketchPoint_3.coordinates(), 20, True +) +SketchConstraintDistance_14 = Sketch_1.setDistance( + SketchPoint_3.coordinates(), SketchLine_18.endPoint(), 40, True +) +SketchConstraintEqual_16 = Sketch_1.setEqual( + SketchLine_18.result(), SketchLine_23.result() +) +SketchLine_24 = Sketch_1.addLine( + 97.289359083568, -41.13349208617944, 47.64969893384747, -7.430315081329468 +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_24.result() +) +SketchConstraintEqual_17 = Sketch_1.setEqual( + SketchLine_18.result(), SketchLine_24.result() +) +SketchConstraintDistance_15 = Sketch_1.setDistance( + SketchLine_24.startPoint(), SketchPoint_3.coordinates(), 20, True +) +SketchConstraintAngle_21 = Sketch_1.setAngleComplementary( + SketchLine_18.result(), SketchLine_23.result(), 160 +) +SketchConstraintAngle_22 = Sketch_1.setAngleComplementary( + SketchLine_24.result(), SketchLine_23.result(), 160 +) +SketchLine_25 = Sketch_1.addLine( + 81.65898287743471, -28.41422234660911, 29.27079119639352, 0.8343224443798635 +) SketchPoint_4 = Sketch_1.addPoint(64.19625231708766, -18.66470741627946) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_25.result()) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_24.result()) -SketchConstraintDistance_16 = Sketch_1.setDistance(SketchPoint_4.coordinates(), SketchLine_25.startPoint(), 20, True) -SketchConstraintDistance_17 = Sketch_1.setDistance(SketchPoint_4.coordinates(), SketchLine_24.endPoint(), 20, True) -SketchConstraintEqual_18 = Sketch_1.setEqual(SketchLine_24.result(), SketchLine_25.result()) -SketchLine_26 = Sketch_1.addLine(95.51651619313817, -32.72404055044315, 45.95024650348294, -10.47426958610802) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_26.result()) -SketchConstraintDistance_18 = Sketch_1.setDistance(SketchLine_26.endPoint(), SketchPoint_4.coordinates(), 20, True) -SketchConstraintAngle_23 = Sketch_1.setAngleComplementary(SketchLine_24.result(), SketchLine_25.result(), 5) -SketchConstraintAngle_24 = Sketch_1.setAngleComplementary(SketchLine_26.result(), SketchLine_25.result(), 5) -SketchLine_27 = Sketch_1.addLine(83.08667026246893, -25.23373396888348, 26.41541642632507, -5.526654311071399) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_27.result()) -SketchConstraintEqual_19 = Sketch_1.setEqual(SketchLine_24.result(), SketchLine_27.result()) -SketchConstraintDistance_19 = Sketch_1.setDistance(SketchPoint_4.coordinates(), SketchLine_27.startPoint(), 20, True) -SketchConstraintAngle_25 = Sketch_1.setAngleComplementary(SketchLine_27.result(), SketchLine_26.result(), 5) -SketchLine_28 = Sketch_1.addLine(102.9783774975822, -28.45994944924871, 44.80518972684035, -13.76708639979482) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_28.result()) -SketchConstraintEqual_20 = Sketch_1.setEqual(SketchLine_27.result(), SketchLine_28.result()) -SketchConstraintDistance_20 = Sketch_1.setDistance(SketchLine_28.endPoint(), SketchPoint_4.coordinates(), 20, True) -SketchConstraintAngle_26 = Sketch_1.setAngleComplementary(SketchLine_27.result(), SketchLine_28.result(), 5) -SketchLine_29 = Sketch_1.addLine(103.6845113974033, -25.04259067061018, 44.45212277692985, -15.47576578911409) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_29.result()) -SketchConstraintDistance_21 = Sketch_1.setDistance(SketchLine_29.endPoint(), SketchPoint_4.coordinates(), 20, True) -SketchConstraintAngle_27 = Sketch_1.setAngleComplementary(SketchLine_28.result(), SketchLine_29.result(), 175) -SketchConstraintEqual_21 = Sketch_1.setEqual(SketchLine_28.result(), SketchLine_29.result()) -SketchLine_30 = Sketch_1.addLine(104.0901158019603, -21.57669234933498, 44.24932057465131, -17.20871494975169) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_30.result()) -SketchConstraintEqual_22 = Sketch_1.setEqual(SketchLine_29.result(), SketchLine_30.result()) -SketchConstraintDistance_22 = Sketch_1.setDistance(SketchLine_30.endPoint(), SketchPoint_4.coordinates(), 20, True) -SketchConstraintAngle_28 = Sketch_1.setAngleComplementary(SketchLine_30.result(), SketchLine_29.result(), 175) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchLine_22.startPoint(), SketchLine_30.result()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_25.result() +) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_24.result() +) +SketchConstraintDistance_16 = Sketch_1.setDistance( + SketchPoint_4.coordinates(), SketchLine_25.startPoint(), 20, True +) +SketchConstraintDistance_17 = Sketch_1.setDistance( + SketchPoint_4.coordinates(), SketchLine_24.endPoint(), 20, True +) +SketchConstraintEqual_18 = Sketch_1.setEqual( + SketchLine_24.result(), SketchLine_25.result() +) +SketchLine_26 = Sketch_1.addLine( + 95.51651619313817, -32.72404055044315, 45.95024650348294, -10.47426958610802 +) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_26.result() +) +SketchConstraintDistance_18 = Sketch_1.setDistance( + SketchLine_26.endPoint(), SketchPoint_4.coordinates(), 20, True +) +SketchConstraintAngle_23 = Sketch_1.setAngleComplementary( + SketchLine_24.result(), SketchLine_25.result(), 5 +) +SketchConstraintAngle_24 = Sketch_1.setAngleComplementary( + SketchLine_26.result(), SketchLine_25.result(), 5 +) +SketchLine_27 = Sketch_1.addLine( + 83.08667026246893, -25.23373396888348, 26.41541642632507, -5.526654311071399 +) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_27.result() +) +SketchConstraintEqual_19 = Sketch_1.setEqual( + SketchLine_24.result(), SketchLine_27.result() +) +SketchConstraintDistance_19 = Sketch_1.setDistance( + SketchPoint_4.coordinates(), SketchLine_27.startPoint(), 20, True +) +SketchConstraintAngle_25 = Sketch_1.setAngleComplementary( + SketchLine_27.result(), SketchLine_26.result(), 5 +) +SketchLine_28 = Sketch_1.addLine( + 102.9783774975822, -28.45994944924871, 44.80518972684035, -13.76708639979482 +) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_28.result() +) +SketchConstraintEqual_20 = Sketch_1.setEqual( + SketchLine_27.result(), SketchLine_28.result() +) +SketchConstraintDistance_20 = Sketch_1.setDistance( + SketchLine_28.endPoint(), SketchPoint_4.coordinates(), 20, True +) +SketchConstraintAngle_26 = Sketch_1.setAngleComplementary( + SketchLine_27.result(), SketchLine_28.result(), 5 +) +SketchLine_29 = Sketch_1.addLine( + 103.6845113974033, -25.04259067061018, 44.45212277692985, -15.47576578911409 +) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_29.result() +) +SketchConstraintDistance_21 = Sketch_1.setDistance( + SketchLine_29.endPoint(), SketchPoint_4.coordinates(), 20, True +) +SketchConstraintAngle_27 = Sketch_1.setAngleComplementary( + SketchLine_28.result(), SketchLine_29.result(), 175 +) +SketchConstraintEqual_21 = Sketch_1.setEqual( + SketchLine_28.result(), SketchLine_29.result() +) +SketchLine_30 = Sketch_1.addLine( + 104.0901158019603, -21.57669234933498, 44.24932057465131, -17.20871494975169 +) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_30.result() +) +SketchConstraintEqual_22 = Sketch_1.setEqual( + SketchLine_29.result(), SketchLine_30.result() +) +SketchConstraintDistance_22 = Sketch_1.setDistance( + SketchLine_30.endPoint(), SketchPoint_4.coordinates(), 20, True +) +SketchConstraintAngle_28 = Sketch_1.setAngleComplementary( + SketchLine_30.result(), SketchLine_29.result(), 175 +) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchLine_22.startPoint(), SketchLine_30.result() +) -SketchLine_31 = Sketch_1.addLine(138.7804692087479, -78.2421341225341, 156.7284871354776, -69.4178124771163) -SketchLine_32 = Sketch_1.addLine(156.7284871354776, -69.4178124771163, 164.8053019156854, -51.12122637461573) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) -SketchLine_33 = Sketch_1.addLine(164.8053019156854, -51.12122637461573, 148.0844426183728, 6.501797360341752) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint()) -SketchLine_34 = Sketch_1.addLine(138.7804692087479, -78.2421341225341, 119.3593251934135, -73.46519314156717) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchLine_31.startPoint(), SketchLine_34.startPoint()) -SketchLine_35 = Sketch_1.addLine(107.5524242162226, -57.32217330899532, 119.3593251934135, -73.46519314156717) -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchLine_34.endPoint(), SketchLine_35.endPoint()) -SketchLine_36 = Sketch_1.addLine(107.5524242162226, -57.32217330899532, 108.8843464634908, -37.36657301415998) -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_35.startPoint(), SketchLine_36.startPoint()) -SketchLine_37 = Sketch_1.addLine(125.8708496231354, -19.66465768043951, 108.8843464634908, -37.36657301415998) -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchLine_36.endPoint(), SketchLine_37.endPoint()) -SketchConstraintAngle_29 = Sketch_1.setAngleBackward(SketchLine_31.result(), SketchLine_32.result(), 140) -SketchConstraintAngle_30 = Sketch_1.setAngleBackward(SketchLine_33.result(), SketchLine_32.result(), 220) -SketchConstraintAngle_31 = Sketch_1.setAngleBackward(SketchLine_31.result(), SketchLine_34.result(), 220) -SketchConstraintAngle_32 = Sketch_1.setAngleBackward(SketchLine_36.result(), SketchLine_35.result(), 140) -SketchConstraintAngle_33 = Sketch_1.setAngleBackward(SketchLine_35.result(), SketchLine_34.result(), 140) -SketchConstraintAngle_34 = Sketch_1.setAngleBackward(SketchLine_36.result(), SketchLine_37.result(), 220) +SketchLine_31 = Sketch_1.addLine( + 138.7804692087479, -78.2421341225341, 156.7284871354776, -69.4178124771163 +) +SketchLine_32 = Sketch_1.addLine( + 156.7284871354776, -69.4178124771163, 164.8053019156854, -51.12122637461573 +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchLine_31.endPoint(), SketchLine_32.startPoint() +) +SketchLine_33 = Sketch_1.addLine( + 164.8053019156854, -51.12122637461573, 148.0844426183728, 6.501797360341752 +) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchLine_32.endPoint(), SketchLine_33.startPoint() +) +SketchLine_34 = Sketch_1.addLine( + 138.7804692087479, -78.2421341225341, 119.3593251934135, -73.46519314156717 +) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchLine_31.startPoint(), SketchLine_34.startPoint() +) +SketchLine_35 = Sketch_1.addLine( + 107.5524242162226, -57.32217330899532, 119.3593251934135, -73.46519314156717 +) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchLine_34.endPoint(), SketchLine_35.endPoint() +) +SketchLine_36 = Sketch_1.addLine( + 107.5524242162226, -57.32217330899532, 108.8843464634908, -37.36657301415998 +) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchLine_35.startPoint(), SketchLine_36.startPoint() +) +SketchLine_37 = Sketch_1.addLine( + 125.8708496231354, -19.66465768043951, 108.8843464634908, -37.36657301415998 +) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchLine_36.endPoint(), SketchLine_37.endPoint() +) +SketchConstraintAngle_29 = Sketch_1.setAngleBackward( + SketchLine_31.result(), SketchLine_32.result(), 140 +) +SketchConstraintAngle_30 = Sketch_1.setAngleBackward( + SketchLine_33.result(), SketchLine_32.result(), 220 +) +SketchConstraintAngle_31 = Sketch_1.setAngleBackward( + SketchLine_31.result(), SketchLine_34.result(), 220 +) +SketchConstraintAngle_32 = Sketch_1.setAngleBackward( + SketchLine_36.result(), SketchLine_35.result(), 140 +) +SketchConstraintAngle_33 = Sketch_1.setAngleBackward( + SketchLine_35.result(), SketchLine_34.result(), 140 +) +SketchConstraintAngle_34 = Sketch_1.setAngleBackward( + SketchLine_36.result(), SketchLine_37.result(), 220 +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_32.result(), 20) -SketchConstraintEqual_23 = Sketch_1.setEqual(SketchLine_32.result(), SketchLine_31.result()) -SketchConstraintEqual_24 = Sketch_1.setEqual(SketchLine_32.result(), SketchLine_34.result()) -SketchConstraintEqual_25 = Sketch_1.setEqual(SketchLine_32.result(), SketchLine_35.result()) -SketchConstraintEqual_26 = Sketch_1.setEqual(SketchLine_32.result(), SketchLine_36.result()) -SketchLine_38 = Sketch_1.addLine(171.0385831271055, -48.05657162886843, 135.6178801955327, 0.3724878688471688) +SketchConstraintEqual_23 = Sketch_1.setEqual( + SketchLine_32.result(), SketchLine_31.result() +) +SketchConstraintEqual_24 = Sketch_1.setEqual( + SketchLine_32.result(), SketchLine_34.result() +) +SketchConstraintEqual_25 = Sketch_1.setEqual( + SketchLine_32.result(), SketchLine_35.result() +) +SketchConstraintEqual_26 = Sketch_1.setEqual( + SketchLine_32.result(), SketchLine_36.result() +) +SketchLine_38 = Sketch_1.addLine( + 171.0385831271055, -48.05657162886843, 135.6178801955327, 0.3724878688471688 +) SketchPoint_5 = Sketch_1.addPoint(159.2316821499145, -31.91355179629657) -SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_33.result()) -SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_38.result()) -SketchConstraintDistance_23 = Sketch_1.setDistance(SketchLine_32.endPoint(), SketchPoint_5.coordinates(), 20, True) -SketchConstraintDistance_24 = Sketch_1.setDistance(SketchLine_38.startPoint(), SketchPoint_5.coordinates(), 20, True) -SketchConstraintDistance_25 = Sketch_1.setDistance(SketchPoint_5.coordinates(), SketchLine_33.endPoint(), 40, True) -SketchConstraintEqual_27 = Sketch_1.setEqual(SketchLine_33.result(), SketchLine_38.result()) -SketchLine_39 = Sketch_1.addLine(175.8477778293761, -43.04483044571408, 125.9994907909914, -9.650994497461493) -SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_39.result()) -SketchConstraintEqual_28 = Sketch_1.setEqual(SketchLine_33.result(), SketchLine_39.result()) -SketchConstraintDistance_26 = Sketch_1.setDistance(SketchLine_39.startPoint(), SketchPoint_5.coordinates(), 20, True) -SketchConstraintAngle_35 = Sketch_1.setAngleBackward(SketchLine_33.result(), SketchLine_38.result(), 340) -SketchConstraintAngle_36 = Sketch_1.setAngleBackward(SketchLine_39.result(), SketchLine_38.result(), 20) -SketchLine_40 = Sketch_1.addLine(160.1386077477389, -30.42300575990098, 107.5695439158812, -1.500807920835093) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident( + SketchPoint_5.coordinates(), SketchLine_33.result() +) +SketchConstraintCoincidence_42 = Sketch_1.setCoincident( + SketchPoint_5.coordinates(), SketchLine_38.result() +) +SketchConstraintDistance_23 = Sketch_1.setDistance( + SketchLine_32.endPoint(), SketchPoint_5.coordinates(), 20, True +) +SketchConstraintDistance_24 = Sketch_1.setDistance( + SketchLine_38.startPoint(), SketchPoint_5.coordinates(), 20, True +) +SketchConstraintDistance_25 = Sketch_1.setDistance( + SketchPoint_5.coordinates(), SketchLine_33.endPoint(), 40, True +) +SketchConstraintEqual_27 = Sketch_1.setEqual( + SketchLine_33.result(), SketchLine_38.result() +) +SketchLine_39 = Sketch_1.addLine( + 175.8477778293761, -43.04483044571408, 125.9994907909914, -9.650994497461493 +) +SketchConstraintCoincidence_43 = Sketch_1.setCoincident( + SketchPoint_5.coordinates(), SketchLine_39.result() +) +SketchConstraintEqual_28 = Sketch_1.setEqual( + SketchLine_33.result(), SketchLine_39.result() +) +SketchConstraintDistance_26 = Sketch_1.setDistance( + SketchLine_39.startPoint(), SketchPoint_5.coordinates(), 20, True +) +SketchConstraintAngle_35 = Sketch_1.setAngleBackward( + SketchLine_33.result(), SketchLine_38.result(), 340 +) +SketchConstraintAngle_36 = Sketch_1.setAngleBackward( + SketchLine_39.result(), SketchLine_38.result(), 20 +) +SketchLine_40 = Sketch_1.addLine( + 160.1386077477389, -30.42300575990098, 107.5695439158812, -1.500807920835093 +) SketchPoint_6 = Sketch_1.addPoint(142.615586470453, -20.78227314687903) -SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_40.result()) -SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_39.result()) -SketchConstraintDistance_27 = Sketch_1.setDistance(SketchPoint_6.coordinates(), SketchLine_40.startPoint(), 20, True) -SketchConstraintDistance_28 = Sketch_1.setDistance(SketchPoint_6.coordinates(), SketchLine_39.endPoint(), 20, True) -SketchConstraintEqual_29 = Sketch_1.setEqual(SketchLine_39.result(), SketchLine_40.result()) -SketchLine_41 = Sketch_1.addLine(147.1612701207084, -22.78891223719074, 124.3190003679524, -12.70545836667124) -SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_41.result()) -SketchConstraintDistance_29 = Sketch_1.setDistance(SketchLine_41.endPoint(), SketchPoint_6.coordinates(), 20, True) -SketchConstraintAngle_37 = Sketch_1.setAngleBackward(SketchLine_39.result(), SketchLine_40.result(), 175) -SketchConstraintAngle_38 = Sketch_1.setAngleBackward(SketchLine_41.result(), SketchLine_40.result(), 5) -SketchLine_42 = Sketch_1.addLine(161.5464893301474, -27.23370065688114, 104.7537807510641, -7.879418126874779) -SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_42.result()) -SketchConstraintEqual_30 = Sketch_1.setEqual(SketchLine_39.result(), SketchLine_42.result()) -SketchConstraintDistance_30 = Sketch_1.setDistance(SketchPoint_6.coordinates(), SketchLine_42.startPoint(), 20, True) -SketchConstraintAngle_39 = Sketch_1.setAngleBackward(SketchLine_42.result(), SketchLine_41.result(), 5) -SketchLine_43 = Sketch_1.addLine(181.4578745011218, -30.33615510881286, 123.1944424551186, -16.0053321659121) -SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_43.result()) -SketchConstraintEqual_31 = Sketch_1.setEqual(SketchLine_42.result(), SketchLine_43.result()) -SketchConstraintDistance_31 = Sketch_1.setDistance(SketchLine_43.endPoint(), SketchPoint_6.coordinates(), 20, True) -SketchConstraintAngle_40 = Sketch_1.setAngleBackward(SketchLine_42.result(), SketchLine_43.result(), 175) -SketchLine_44 = Sketch_1.addLine(182.1427435468735, -26.91447124022047, 122.8520079322427, -17.71617410020831) -SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_44.result()) -SketchConstraintDistance_32 = Sketch_1.setDistance(SketchLine_44.endPoint(), SketchPoint_6.coordinates(), 20, True) -SketchConstraintAngle_41 = Sketch_1.setAngleBackward(SketchLine_43.result(), SketchLine_44.result(), 355) -SketchConstraintEqual_32 = Sketch_1.setEqual(SketchLine_43.result(), SketchLine_44.result()) -SketchLine_45 = Sketch_1.addLine(182.5267870601237, -23.44611764141531, 122.6599861756176, -19.45035089961089) -SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_45.result()) -SketchConstraintEqual_33 = Sketch_1.setEqual(SketchLine_44.result(), SketchLine_45.result()) -SketchConstraintDistance_33 = Sketch_1.setDistance(SketchLine_45.endPoint(), SketchPoint_6.coordinates(), 20, True) -SketchConstraintAngle_42 = Sketch_1.setAngleBackward(SketchLine_45.result(), SketchLine_44.result(), 5) -SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_37.startPoint(), SketchLine_45.result()) +SketchConstraintCoincidence_44 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_40.result() +) +SketchConstraintCoincidence_45 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_39.result() +) +SketchConstraintDistance_27 = Sketch_1.setDistance( + SketchPoint_6.coordinates(), SketchLine_40.startPoint(), 20, True +) +SketchConstraintDistance_28 = Sketch_1.setDistance( + SketchPoint_6.coordinates(), SketchLine_39.endPoint(), 20, True +) +SketchConstraintEqual_29 = Sketch_1.setEqual( + SketchLine_39.result(), SketchLine_40.result() +) +SketchLine_41 = Sketch_1.addLine( + 147.1612701207084, -22.78891223719074, 124.3190003679524, -12.70545836667124 +) +SketchConstraintCoincidence_46 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_41.result() +) +SketchConstraintDistance_29 = Sketch_1.setDistance( + SketchLine_41.endPoint(), SketchPoint_6.coordinates(), 20, True +) +SketchConstraintAngle_37 = Sketch_1.setAngleBackward( + SketchLine_39.result(), SketchLine_40.result(), 175 +) +SketchConstraintAngle_38 = Sketch_1.setAngleBackward( + SketchLine_41.result(), SketchLine_40.result(), 5 +) +SketchLine_42 = Sketch_1.addLine( + 161.5464893301474, -27.23370065688114, 104.7537807510641, -7.879418126874779 +) +SketchConstraintCoincidence_47 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_42.result() +) +SketchConstraintEqual_30 = Sketch_1.setEqual( + SketchLine_39.result(), SketchLine_42.result() +) +SketchConstraintDistance_30 = Sketch_1.setDistance( + SketchPoint_6.coordinates(), SketchLine_42.startPoint(), 20, True +) +SketchConstraintAngle_39 = Sketch_1.setAngleBackward( + SketchLine_42.result(), SketchLine_41.result(), 5 +) +SketchLine_43 = Sketch_1.addLine( + 181.4578745011218, -30.33615510881286, 123.1944424551186, -16.0053321659121 +) +SketchConstraintCoincidence_48 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_43.result() +) +SketchConstraintEqual_31 = Sketch_1.setEqual( + SketchLine_42.result(), SketchLine_43.result() +) +SketchConstraintDistance_31 = Sketch_1.setDistance( + SketchLine_43.endPoint(), SketchPoint_6.coordinates(), 20, True +) +SketchConstraintAngle_40 = Sketch_1.setAngleBackward( + SketchLine_42.result(), SketchLine_43.result(), 175 +) +SketchLine_44 = Sketch_1.addLine( + 182.1427435468735, -26.91447124022047, 122.8520079322427, -17.71617410020831 +) +SketchConstraintCoincidence_49 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_44.result() +) +SketchConstraintDistance_32 = Sketch_1.setDistance( + SketchLine_44.endPoint(), SketchPoint_6.coordinates(), 20, True +) +SketchConstraintAngle_41 = Sketch_1.setAngleBackward( + SketchLine_43.result(), SketchLine_44.result(), 355 +) +SketchConstraintEqual_32 = Sketch_1.setEqual( + SketchLine_43.result(), SketchLine_44.result() +) +SketchLine_45 = Sketch_1.addLine( + 182.5267870601237, -23.44611764141531, 122.6599861756176, -19.45035089961089 +) +SketchConstraintCoincidence_50 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_45.result() +) +SketchConstraintEqual_33 = Sketch_1.setEqual( + SketchLine_44.result(), SketchLine_45.result() +) +SketchConstraintDistance_33 = Sketch_1.setDistance( + SketchLine_45.endPoint(), SketchPoint_6.coordinates(), 20, True +) +SketchConstraintAngle_42 = Sketch_1.setAngleBackward( + SketchLine_45.result(), SketchLine_44.result(), 5 +) +SketchConstraintCoincidence_51 = Sketch_1.setCoincident( + SketchLine_37.startPoint(), SketchLine_45.result() +) model.do() -Extrusion_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_9f-SketchLine_15f-SketchLine_7f-SketchLine_6r-SketchLine_5f-SketchLine_4r"), model.selection("FACE", "Sketch_1/Face-SketchLine_16f-SketchLine_17f-SketchLine_18f-SketchLine_24f-SketchLine_30f-SketchLine_22f-SketchLine_21r-SketchLine_20f-SketchLine_19r"), model.selection("FACE", "Sketch_1/Face-SketchLine_31f-SketchLine_32f-SketchLine_33f-SketchLine_39f-SketchLine_45f-SketchLine_37f-SketchLine_36r-SketchLine_35f-SketchLine_34r")] -Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection(), 10, 0) +Extrusion_1_objects = [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_9f-SketchLine_15f-SketchLine_7f-SketchLine_6r-SketchLine_5f-SketchLine_4r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_16f-SketchLine_17f-SketchLine_18f-SketchLine_24f-SketchLine_30f-SketchLine_22f-SketchLine_21r-SketchLine_20f-SketchLine_19r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_31f-SketchLine_32f-SketchLine_33f-SketchLine_39f-SketchLine_45f-SketchLine_37f-SketchLine_36r-SketchLine_35f-SketchLine_34r", + ), +] +Extrusion_1 = model.addExtrusion( + Part_1_doc, Extrusion_1_objects, model.selection(), 10, 0 +) model.end() @@ -258,4 +681,4 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [54, 54, 54]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [108, 108, 108]) model.testResultsVolumes(Extrusion_1, [REF_VOLUME, REF_VOLUME, REF_VOLUME]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintAngle_v0_2.py b/src/SketchPlugin/Test/TestConstraintAngle_v0_2.py index 9054d7b66..299d7f2c2 100644 --- a/src/SketchPlugin/Test/TestConstraintAngle_v0_2.py +++ b/src/SketchPlugin/Test/TestConstraintAngle_v0_2.py @@ -26,225 +26,648 @@ Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "Ang", "140") model.addParameter(Part_1_doc, "dAng", "5") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(-17.48270627886662, -77.57247534383079, 0.4653113240225388, -68.74815303974528) -SketchLine_2 = Sketch_1.addLine(0.4653113240225388, -68.74815303974528, 8.542125432770632, -50.45156664083665) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(8.542125432770632, -50.45156664083665, -8.178735979228234, 7.171456480488104) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-17.48270627886662, -77.57247534383079, -36.90385046950819, -72.79553507559329) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(-48.71075203912585, -56.65251567631857, -36.90385046950819, -72.79553507559329) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.endPoint()) -SketchLine_6 = Sketch_1.addLine(-48.71075203912585, -56.65251567631857, -47.37883052420096, -36.69691533260352) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_6.startPoint()) -SketchLine_7 = Sketch_1.addLine(-30.39232801419296, -18.99499937550162, -47.37883052420096, -36.69691533260352) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.endPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_2.result(), "360-Ang") -SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_2.result(), "Ang") -SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_4.result(), "Ang") -SketchConstraintAngle_4 = Sketch_1.setAngle(SketchLine_6.result(), SketchLine_5.result(), "360-Ang") -SketchConstraintAngle_5 = Sketch_1.setAngle(SketchLine_5.result(), SketchLine_4.result(), "360-Ang") -SketchConstraintAngle_6 = Sketch_1.setAngle(SketchLine_6.result(), SketchLine_7.result(), "Ang") +SketchLine_1 = Sketch_1.addLine( + -17.48270627886662, -77.57247534383079, 0.4653113240225388, -68.74815303974528 +) +SketchLine_2 = Sketch_1.addLine( + 0.4653113240225388, -68.74815303974528, 8.542125432770632, -50.45156664083665 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 8.542125432770632, -50.45156664083665, -8.178735979228234, 7.171456480488104 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -17.48270627886662, -77.57247534383079, -36.90385046950819, -72.79553507559329 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + -48.71075203912585, -56.65251567631857, -36.90385046950819, -72.79553507559329 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.endPoint() +) +SketchLine_6 = Sketch_1.addLine( + -48.71075203912585, -56.65251567631857, -47.37883052420096, -36.69691533260352 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_6.startPoint() +) +SketchLine_7 = Sketch_1.addLine( + -30.39232801419296, -18.99499937550162, -47.37883052420096, -36.69691533260352 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.endPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_2.result(), "360-Ang" +) +SketchConstraintAngle_2 = Sketch_1.setAngle( + SketchLine_3.result(), SketchLine_2.result(), "Ang" +) +SketchConstraintAngle_3 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_4.result(), "Ang" +) +SketchConstraintAngle_4 = Sketch_1.setAngle( + SketchLine_6.result(), SketchLine_5.result(), "360-Ang" +) +SketchConstraintAngle_5 = Sketch_1.setAngle( + SketchLine_5.result(), SketchLine_4.result(), "360-Ang" +) +SketchConstraintAngle_6 = Sketch_1.setAngle( + SketchLine_6.result(), SketchLine_7.result(), "Ang" +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_4.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_5.result()) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_6.result()) -SketchLine_8 = Sketch_1.addLine(14.775406531722, -47.38691166633646, -20.64529817713098, 1.042146531487715) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_1.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_4.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_5.result() +) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_6.result() +) +SketchLine_8 = Sketch_1.addLine( + 14.775406531722, -47.38691166633646, -20.64529817713098, 1.042146531487715 +) SketchPoint_1 = Sketch_1.addPoint(2.968504962104344, -31.24389226706174) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_3.result()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_8.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.endPoint(), SketchPoint_1.coordinates(), 20, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.startPoint(), SketchPoint_1.coordinates(), 20, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_3.endPoint(), 40, True) -SketchConstraintEqual_5 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_8.result()) -SketchLine_9 = Sketch_1.addLine(19.58460105006861, -42.37517030669127, -30.26368721382418, -8.981336187802668) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_9.result()) -SketchConstraintEqual_6 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_9.result()) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_9.startPoint(), SketchPoint_1.coordinates(), 20, True) -SketchConstraintAngle_7 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_8.result(), "(180-Ang)/2") -SketchConstraintAngle_8 = Sketch_1.setAngle(SketchLine_9.result(), SketchLine_8.result(), "360-(180-Ang)/2") -SketchLine_10 = Sketch_1.addLine(3.875430505227681, -29.75334619738324, -48.69363438803513, -0.8311502875301234) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_3.result() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_8.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_2.endPoint(), SketchPoint_1.coordinates(), 20, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_8.startPoint(), SketchPoint_1.coordinates(), 20, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchPoint_1.coordinates(), SketchLine_3.endPoint(), 40, True +) +SketchConstraintEqual_5 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_8.result() +) +SketchLine_9 = Sketch_1.addLine( + 19.58460105006861, -42.37517030669127, -30.26368721382418, -8.981336187802668 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_9.result() +) +SketchConstraintEqual_6 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_9.result() +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_9.startPoint(), SketchPoint_1.coordinates(), 20, True +) +SketchConstraintAngle_7 = Sketch_1.setAngle( + SketchLine_3.result(), SketchLine_8.result(), "(180-Ang)/2" +) +SketchConstraintAngle_8 = Sketch_1.setAngle( + SketchLine_9.result(), SketchLine_8.result(), "360-(180-Ang)/2" +) +SketchLine_10 = Sketch_1.addLine( + 3.875430505227681, -29.75334619738324, -48.69363438803513, -0.8311502875301234 +) SketchPoint_2 = Sketch_1.addPoint(-13.64759112585992, -20.1126142274322) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_10.result()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_9.result()) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_10.startPoint(), 20, True) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_9.endPoint(), 20, True) -SketchConstraintEqual_7 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(0.001529676402264532, -26.13785899518266, -31.94417752476854, -12.03580011868412) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_11.result()) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_11.endPoint(), SketchPoint_2.coordinates(), 20, True) -SketchConstraintAngle_9 = Sketch_1.setAngle(SketchLine_9.result(), SketchLine_10.result(), "180+dAng") -SketchConstraintAngle_10 = Sketch_1.setAngle(SketchLine_11.result(), SketchLine_10.result(), "360-dAng") -SketchLine_12 = Sketch_1.addLine(5.283311970593094, -26.56404104269606, -51.50939731876596, -7.20976059690448) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_12.result()) -SketchConstraintEqual_8 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_12.result()) -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_12.startPoint(), 20, True) -SketchConstraintAngle_11 = Sketch_1.setAngle(SketchLine_12.result(), SketchLine_11.result(), "360-dAng") -SketchLine_13 = Sketch_1.addLine(25.19469725542325, -29.66649476390714, -33.06873531650151, -15.33567395919474) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_13.result()) -SketchConstraintEqual_9 = Sketch_1.setEqual(SketchLine_12.result(), SketchLine_13.result()) -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_13.endPoint(), SketchPoint_2.coordinates(), 20, True) -SketchConstraintAngle_12 = Sketch_1.setAngle(SketchLine_12.result(), SketchLine_13.result(), "180+dAng") -SketchLine_14 = Sketch_1.addLine(25.87956617560386, -26.24481087018098, -33.41116977659181, -17.04651590605781) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_14.result()) -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchLine_14.endPoint(), SketchPoint_2.coordinates(), 20, True) -SketchConstraintAngle_13 = Sketch_1.setAngle(SketchLine_13.result(), SketchLine_14.result(), "dAng") -SketchConstraintEqual_10 = Sketch_1.setEqual(SketchLine_13.result(), SketchLine_14.result()) -SketchLine_15 = Sketch_1.addLine(26.26360956157018, -22.77645725728195, -33.60319146957497, -18.78069271250733) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_15.result()) -SketchConstraintEqual_11 = Sketch_1.setEqual(SketchLine_14.result(), SketchLine_15.result()) -SketchConstraintDistance_11 = Sketch_1.setDistance(SketchLine_15.endPoint(), SketchPoint_2.coordinates(), 20, True) -SketchConstraintAngle_14 = Sketch_1.setAngle(SketchLine_15.result(), SketchLine_14.result(), "360-dAng") -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchLine_15.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_10.result() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_9.result() +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchPoint_2.coordinates(), SketchLine_10.startPoint(), 20, True +) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchPoint_2.coordinates(), SketchLine_9.endPoint(), 20, True +) +SketchConstraintEqual_7 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_10.result() +) +SketchLine_11 = Sketch_1.addLine( + 0.001529676402264532, -26.13785899518266, -31.94417752476854, -12.03580011868412 +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_11.result() +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchLine_11.endPoint(), SketchPoint_2.coordinates(), 20, True +) +SketchConstraintAngle_9 = Sketch_1.setAngle( + SketchLine_9.result(), SketchLine_10.result(), "180+dAng" +) +SketchConstraintAngle_10 = Sketch_1.setAngle( + SketchLine_11.result(), SketchLine_10.result(), "360-dAng" +) +SketchLine_12 = Sketch_1.addLine( + 5.283311970593094, -26.56404104269606, -51.50939731876596, -7.20976059690448 +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_12.result() +) +SketchConstraintEqual_8 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_12.result() +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchPoint_2.coordinates(), SketchLine_12.startPoint(), 20, True +) +SketchConstraintAngle_11 = Sketch_1.setAngle( + SketchLine_12.result(), SketchLine_11.result(), "360-dAng" +) +SketchLine_13 = Sketch_1.addLine( + 25.19469725542325, -29.66649476390714, -33.06873531650151, -15.33567395919474 +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_13.result() +) +SketchConstraintEqual_9 = Sketch_1.setEqual( + SketchLine_12.result(), SketchLine_13.result() +) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_13.endPoint(), SketchPoint_2.coordinates(), 20, True +) +SketchConstraintAngle_12 = Sketch_1.setAngle( + SketchLine_12.result(), SketchLine_13.result(), "180+dAng" +) +SketchLine_14 = Sketch_1.addLine( + 25.87956617560386, -26.24481087018098, -33.41116977659181, -17.04651590605781 +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_14.result() +) +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchLine_14.endPoint(), SketchPoint_2.coordinates(), 20, True +) +SketchConstraintAngle_13 = Sketch_1.setAngle( + SketchLine_13.result(), SketchLine_14.result(), "dAng" +) +SketchConstraintEqual_10 = Sketch_1.setEqual( + SketchLine_13.result(), SketchLine_14.result() +) +SketchLine_15 = Sketch_1.addLine( + 26.26360956157018, -22.77645725728195, -33.60319146957497, -18.78069271250733 +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_15.result() +) +SketchConstraintEqual_11 = Sketch_1.setEqual( + SketchLine_14.result(), SketchLine_15.result() +) +SketchConstraintDistance_11 = Sketch_1.setDistance( + SketchLine_15.endPoint(), SketchPoint_2.coordinates(), 20, True +) +SketchConstraintAngle_14 = Sketch_1.setAngle( + SketchLine_15.result(), SketchLine_14.result(), "360-dAng" +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchLine_15.result() +) -SketchLine_16 = Sketch_1.addLine(60.00388909712782, -76.09960829009104, 78.00643494689578, -67.38706888260469) -SketchLine_17 = Sketch_1.addLine(78.00643494689578, -67.38706888260469, 86.19687277706721, -49.141063069) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) -SketchLine_18 = Sketch_1.addLine(86.19687277706721, -49.141063069, 69.83467154684908, 8.584826884311665) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) -SketchLine_19 = Sketch_1.addLine(60.00388909712782, -76.09960829009104, 40.61282650688053, -71.20198727360641) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_16.startPoint(), SketchLine_19.startPoint()) -SketchLine_20 = Sketch_1.addLine(28.90654086978602, -54.98585713775849, 40.61282650688053, -71.20198727360641) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.endPoint()) -SketchLine_21 = Sketch_1.addLine(28.90654086978602, -54.98585713775849, 30.36253333631381, -35.03892539532215) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_20.startPoint(), SketchLine_21.startPoint()) -SketchLine_22 = Sketch_1.addLine(47.45878924889096, -17.44298467461911, 30.36253333631381, -35.03892539532215) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchLine_22.endPoint()) -SketchConstraintAngle_15 = Sketch_1.setAngleComplementary(SketchLine_16.result(), SketchLine_17.result(), "180-Ang") -SketchConstraintAngle_16 = Sketch_1.setAngleComplementary(SketchLine_18.result(), SketchLine_17.result(), "180-Ang") -SketchConstraintAngle_17 = Sketch_1.setAngleComplementary(SketchLine_16.result(), SketchLine_19.result(), "180-Ang") -SketchConstraintAngle_18 = Sketch_1.setAngleComplementary(SketchLine_21.result(), SketchLine_20.result(), "180-Ang") -SketchConstraintAngle_19 = Sketch_1.setAngleComplementary(SketchLine_20.result(), SketchLine_19.result(), "180-Ang") -SketchConstraintAngle_20 = Sketch_1.setAngleComplementary(SketchLine_21.result(), SketchLine_22.result(), "180-Ang") +SketchLine_16 = Sketch_1.addLine( + 60.00388909712782, -76.09960829009104, 78.00643494689578, -67.38706888260469 +) +SketchLine_17 = Sketch_1.addLine( + 78.00643494689578, -67.38706888260469, 86.19687277706721, -49.141063069 +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) +SketchLine_18 = Sketch_1.addLine( + 86.19687277706721, -49.141063069, 69.83467154684908, 8.584826884311665 +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) +SketchLine_19 = Sketch_1.addLine( + 60.00388909712782, -76.09960829009104, 40.61282650688053, -71.20198727360641 +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_16.startPoint(), SketchLine_19.startPoint() +) +SketchLine_20 = Sketch_1.addLine( + 28.90654086978602, -54.98585713775849, 40.61282650688053, -71.20198727360641 +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.endPoint() +) +SketchLine_21 = Sketch_1.addLine( + 28.90654086978602, -54.98585713775849, 30.36253333631381, -35.03892539532215 +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_20.startPoint(), SketchLine_21.startPoint() +) +SketchLine_22 = Sketch_1.addLine( + 47.45878924889096, -17.44298467461911, 30.36253333631381, -35.03892539532215 +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchLine_22.endPoint() +) +SketchConstraintAngle_15 = Sketch_1.setAngleComplementary( + SketchLine_16.result(), SketchLine_17.result(), "180-Ang" +) +SketchConstraintAngle_16 = Sketch_1.setAngleComplementary( + SketchLine_18.result(), SketchLine_17.result(), "180-Ang" +) +SketchConstraintAngle_17 = Sketch_1.setAngleComplementary( + SketchLine_16.result(), SketchLine_19.result(), "180-Ang" +) +SketchConstraintAngle_18 = Sketch_1.setAngleComplementary( + SketchLine_21.result(), SketchLine_20.result(), "180-Ang" +) +SketchConstraintAngle_19 = Sketch_1.setAngleComplementary( + SketchLine_20.result(), SketchLine_19.result(), "180-Ang" +) +SketchConstraintAngle_20 = Sketch_1.setAngleComplementary( + SketchLine_21.result(), SketchLine_22.result(), "180-Ang" +) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_17.result(), 20) -SketchConstraintEqual_12 = Sketch_1.setEqual(SketchLine_17.result(), SketchLine_16.result()) -SketchConstraintEqual_13 = Sketch_1.setEqual(SketchLine_17.result(), SketchLine_19.result()) -SketchConstraintEqual_14 = Sketch_1.setEqual(SketchLine_17.result(), SketchLine_20.result()) -SketchConstraintEqual_15 = Sketch_1.setEqual(SketchLine_17.result(), SketchLine_21.result()) -SketchLine_23 = Sketch_1.addLine(92.44909133742235, -46.11522988707736, 57.3302344261388, 2.533160520466375) +SketchConstraintEqual_12 = Sketch_1.setEqual( + SketchLine_17.result(), SketchLine_16.result() +) +SketchConstraintEqual_13 = Sketch_1.setEqual( + SketchLine_17.result(), SketchLine_19.result() +) +SketchConstraintEqual_14 = Sketch_1.setEqual( + SketchLine_17.result(), SketchLine_20.result() +) +SketchConstraintEqual_15 = Sketch_1.setEqual( + SketchLine_17.result(), SketchLine_21.result() +) +SketchLine_23 = Sketch_1.addLine( + 92.44909133742235, -46.11522988707736, 57.3302344261388, 2.533160520466375 +) SketchPoint_3 = Sketch_1.addPoint(80.74280570032784, -29.89909975122945) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_18.result()) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_23.result()) -SketchConstraintDistance_12 = Sketch_1.setDistance(SketchLine_17.endPoint(), SketchPoint_3.coordinates(), 20, True) -SketchConstraintDistance_13 = Sketch_1.setDistance(SketchLine_23.startPoint(), SketchPoint_3.coordinates(), 20, True) -SketchConstraintDistance_14 = Sketch_1.setDistance(SketchPoint_3.coordinates(), SketchLine_18.endPoint(), 40, True) -SketchConstraintEqual_16 = Sketch_1.setEqual(SketchLine_18.result(), SketchLine_23.result()) -SketchLine_24 = Sketch_1.addLine(97.289359083568, -41.13349208617944, 47.64969893384747, -7.430315081329468) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_24.result()) -SketchConstraintEqual_17 = Sketch_1.setEqual(SketchLine_18.result(), SketchLine_24.result()) -SketchConstraintDistance_15 = Sketch_1.setDistance(SketchLine_24.startPoint(), SketchPoint_3.coordinates(), 20, True) -SketchConstraintAngle_21 = Sketch_1.setAngleComplementary(SketchLine_18.result(), SketchLine_23.result(), "90+Ang/2") -SketchConstraintAngle_22 = Sketch_1.setAngleComplementary(SketchLine_24.result(), SketchLine_23.result(), "90+Ang/2") -SketchLine_25 = Sketch_1.addLine(81.65898287743471, -28.41422234660911, 29.27079119639352, 0.8343224443798635) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_18.result() +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_23.result() +) +SketchConstraintDistance_12 = Sketch_1.setDistance( + SketchLine_17.endPoint(), SketchPoint_3.coordinates(), 20, True +) +SketchConstraintDistance_13 = Sketch_1.setDistance( + SketchLine_23.startPoint(), SketchPoint_3.coordinates(), 20, True +) +SketchConstraintDistance_14 = Sketch_1.setDistance( + SketchPoint_3.coordinates(), SketchLine_18.endPoint(), 40, True +) +SketchConstraintEqual_16 = Sketch_1.setEqual( + SketchLine_18.result(), SketchLine_23.result() +) +SketchLine_24 = Sketch_1.addLine( + 97.289359083568, -41.13349208617944, 47.64969893384747, -7.430315081329468 +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_24.result() +) +SketchConstraintEqual_17 = Sketch_1.setEqual( + SketchLine_18.result(), SketchLine_24.result() +) +SketchConstraintDistance_15 = Sketch_1.setDistance( + SketchLine_24.startPoint(), SketchPoint_3.coordinates(), 20, True +) +SketchConstraintAngle_21 = Sketch_1.setAngleComplementary( + SketchLine_18.result(), SketchLine_23.result(), "90+Ang/2" +) +SketchConstraintAngle_22 = Sketch_1.setAngleComplementary( + SketchLine_24.result(), SketchLine_23.result(), "90+Ang/2" +) +SketchLine_25 = Sketch_1.addLine( + 81.65898287743471, -28.41422234660911, 29.27079119639352, 0.8343224443798635 +) SketchPoint_4 = Sketch_1.addPoint(64.19625231708766, -18.66470741627946) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_25.result()) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_24.result()) -SketchConstraintDistance_16 = Sketch_1.setDistance(SketchPoint_4.coordinates(), SketchLine_25.startPoint(), 20, True) -SketchConstraintDistance_17 = Sketch_1.setDistance(SketchPoint_4.coordinates(), SketchLine_24.endPoint(), 20, True) -SketchConstraintEqual_18 = Sketch_1.setEqual(SketchLine_24.result(), SketchLine_25.result()) -SketchLine_26 = Sketch_1.addLine(95.51651619313817, -32.72404055044315, 45.95024650348294, -10.47426958610802) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_26.result()) -SketchConstraintDistance_18 = Sketch_1.setDistance(SketchLine_26.endPoint(), SketchPoint_4.coordinates(), 20, True) -SketchConstraintAngle_23 = Sketch_1.setAngleComplementary(SketchLine_24.result(), SketchLine_25.result(), "dAng") -SketchConstraintAngle_24 = Sketch_1.setAngleComplementary(SketchLine_26.result(), SketchLine_25.result(), "dAng") -SketchLine_27 = Sketch_1.addLine(83.08667026246893, -25.23373396888348, 26.41541642632507, -5.526654311071399) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_27.result()) -SketchConstraintEqual_19 = Sketch_1.setEqual(SketchLine_24.result(), SketchLine_27.result()) -SketchConstraintDistance_19 = Sketch_1.setDistance(SketchPoint_4.coordinates(), SketchLine_27.startPoint(), 20, True) -SketchConstraintAngle_25 = Sketch_1.setAngleComplementary(SketchLine_27.result(), SketchLine_26.result(), "dAng") -SketchLine_28 = Sketch_1.addLine(102.9783774975822, -28.45994944924871, 44.80518972684035, -13.76708639979482) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_28.result()) -SketchConstraintEqual_20 = Sketch_1.setEqual(SketchLine_27.result(), SketchLine_28.result()) -SketchConstraintDistance_20 = Sketch_1.setDistance(SketchLine_28.endPoint(), SketchPoint_4.coordinates(), 20, True) -SketchConstraintAngle_26 = Sketch_1.setAngleComplementary(SketchLine_27.result(), SketchLine_28.result(), "dAng") -SketchLine_29 = Sketch_1.addLine(103.6845113974033, -25.04259067061018, 44.45212277692985, -15.47576578911409) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_29.result()) -SketchConstraintDistance_21 = Sketch_1.setDistance(SketchLine_29.endPoint(), SketchPoint_4.coordinates(), 20, True) -SketchConstraintAngle_27 = Sketch_1.setAngleComplementary(SketchLine_28.result(), SketchLine_29.result(), "180-dAng") -SketchConstraintEqual_21 = Sketch_1.setEqual(SketchLine_28.result(), SketchLine_29.result()) -SketchLine_30 = Sketch_1.addLine(104.0901158019603, -21.57669234933498, 44.24932057465131, -17.20871494975169) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_30.result()) -SketchConstraintEqual_22 = Sketch_1.setEqual(SketchLine_29.result(), SketchLine_30.result()) -SketchConstraintDistance_22 = Sketch_1.setDistance(SketchLine_30.endPoint(), SketchPoint_4.coordinates(), 20, True) -SketchConstraintAngle_28 = Sketch_1.setAngleComplementary(SketchLine_30.result(), SketchLine_29.result(), "180-dAng") -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchLine_22.startPoint(), SketchLine_30.result()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_25.result() +) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_24.result() +) +SketchConstraintDistance_16 = Sketch_1.setDistance( + SketchPoint_4.coordinates(), SketchLine_25.startPoint(), 20, True +) +SketchConstraintDistance_17 = Sketch_1.setDistance( + SketchPoint_4.coordinates(), SketchLine_24.endPoint(), 20, True +) +SketchConstraintEqual_18 = Sketch_1.setEqual( + SketchLine_24.result(), SketchLine_25.result() +) +SketchLine_26 = Sketch_1.addLine( + 95.51651619313817, -32.72404055044315, 45.95024650348294, -10.47426958610802 +) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_26.result() +) +SketchConstraintDistance_18 = Sketch_1.setDistance( + SketchLine_26.endPoint(), SketchPoint_4.coordinates(), 20, True +) +SketchConstraintAngle_23 = Sketch_1.setAngleComplementary( + SketchLine_24.result(), SketchLine_25.result(), "dAng" +) +SketchConstraintAngle_24 = Sketch_1.setAngleComplementary( + SketchLine_26.result(), SketchLine_25.result(), "dAng" +) +SketchLine_27 = Sketch_1.addLine( + 83.08667026246893, -25.23373396888348, 26.41541642632507, -5.526654311071399 +) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_27.result() +) +SketchConstraintEqual_19 = Sketch_1.setEqual( + SketchLine_24.result(), SketchLine_27.result() +) +SketchConstraintDistance_19 = Sketch_1.setDistance( + SketchPoint_4.coordinates(), SketchLine_27.startPoint(), 20, True +) +SketchConstraintAngle_25 = Sketch_1.setAngleComplementary( + SketchLine_27.result(), SketchLine_26.result(), "dAng" +) +SketchLine_28 = Sketch_1.addLine( + 102.9783774975822, -28.45994944924871, 44.80518972684035, -13.76708639979482 +) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_28.result() +) +SketchConstraintEqual_20 = Sketch_1.setEqual( + SketchLine_27.result(), SketchLine_28.result() +) +SketchConstraintDistance_20 = Sketch_1.setDistance( + SketchLine_28.endPoint(), SketchPoint_4.coordinates(), 20, True +) +SketchConstraintAngle_26 = Sketch_1.setAngleComplementary( + SketchLine_27.result(), SketchLine_28.result(), "dAng" +) +SketchLine_29 = Sketch_1.addLine( + 103.6845113974033, -25.04259067061018, 44.45212277692985, -15.47576578911409 +) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_29.result() +) +SketchConstraintDistance_21 = Sketch_1.setDistance( + SketchLine_29.endPoint(), SketchPoint_4.coordinates(), 20, True +) +SketchConstraintAngle_27 = Sketch_1.setAngleComplementary( + SketchLine_28.result(), SketchLine_29.result(), "180-dAng" +) +SketchConstraintEqual_21 = Sketch_1.setEqual( + SketchLine_28.result(), SketchLine_29.result() +) +SketchLine_30 = Sketch_1.addLine( + 104.0901158019603, -21.57669234933498, 44.24932057465131, -17.20871494975169 +) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_30.result() +) +SketchConstraintEqual_22 = Sketch_1.setEqual( + SketchLine_29.result(), SketchLine_30.result() +) +SketchConstraintDistance_22 = Sketch_1.setDistance( + SketchLine_30.endPoint(), SketchPoint_4.coordinates(), 20, True +) +SketchConstraintAngle_28 = Sketch_1.setAngleComplementary( + SketchLine_30.result(), SketchLine_29.result(), "180-dAng" +) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchLine_22.startPoint(), SketchLine_30.result() +) -SketchLine_31 = Sketch_1.addLine(138.7804692087479, -78.2421341225341, 156.7284871354776, -69.4178124771163) -SketchLine_32 = Sketch_1.addLine(156.7284871354776, -69.4178124771163, 164.8053019156854, -51.12122637461573) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) -SketchLine_33 = Sketch_1.addLine(164.8053019156854, -51.12122637461573, 148.0844426183728, 6.501797360341752) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint()) -SketchLine_34 = Sketch_1.addLine(138.7804692087479, -78.2421341225341, 119.3593251934135, -73.46519314156717) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchLine_31.startPoint(), SketchLine_34.startPoint()) -SketchLine_35 = Sketch_1.addLine(107.5524242162226, -57.32217330899532, 119.3593251934135, -73.46519314156717) -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchLine_34.endPoint(), SketchLine_35.endPoint()) -SketchLine_36 = Sketch_1.addLine(107.5524242162226, -57.32217330899532, 108.8843464634908, -37.36657301415998) -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_35.startPoint(), SketchLine_36.startPoint()) -SketchLine_37 = Sketch_1.addLine(125.8708496231354, -19.66465768043951, 108.8843464634908, -37.36657301415998) -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchLine_36.endPoint(), SketchLine_37.endPoint()) -SketchConstraintAngle_29 = Sketch_1.setAngleBackward(SketchLine_31.result(), SketchLine_32.result(), "Ang") -SketchConstraintAngle_30 = Sketch_1.setAngleBackward(SketchLine_33.result(), SketchLine_32.result(), "360-Ang") -SketchConstraintAngle_31 = Sketch_1.setAngleBackward(SketchLine_31.result(), SketchLine_34.result(), "360-Ang") -SketchConstraintAngle_32 = Sketch_1.setAngleBackward(SketchLine_36.result(), SketchLine_35.result(), "Ang") -SketchConstraintAngle_33 = Sketch_1.setAngleBackward(SketchLine_35.result(), SketchLine_34.result(), "Ang") -SketchConstraintAngle_34 = Sketch_1.setAngleBackward(SketchLine_36.result(), SketchLine_37.result(), "360-Ang") +SketchLine_31 = Sketch_1.addLine( + 138.7804692087479, -78.2421341225341, 156.7284871354776, -69.4178124771163 +) +SketchLine_32 = Sketch_1.addLine( + 156.7284871354776, -69.4178124771163, 164.8053019156854, -51.12122637461573 +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchLine_31.endPoint(), SketchLine_32.startPoint() +) +SketchLine_33 = Sketch_1.addLine( + 164.8053019156854, -51.12122637461573, 148.0844426183728, 6.501797360341752 +) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchLine_32.endPoint(), SketchLine_33.startPoint() +) +SketchLine_34 = Sketch_1.addLine( + 138.7804692087479, -78.2421341225341, 119.3593251934135, -73.46519314156717 +) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchLine_31.startPoint(), SketchLine_34.startPoint() +) +SketchLine_35 = Sketch_1.addLine( + 107.5524242162226, -57.32217330899532, 119.3593251934135, -73.46519314156717 +) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchLine_34.endPoint(), SketchLine_35.endPoint() +) +SketchLine_36 = Sketch_1.addLine( + 107.5524242162226, -57.32217330899532, 108.8843464634908, -37.36657301415998 +) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchLine_35.startPoint(), SketchLine_36.startPoint() +) +SketchLine_37 = Sketch_1.addLine( + 125.8708496231354, -19.66465768043951, 108.8843464634908, -37.36657301415998 +) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchLine_36.endPoint(), SketchLine_37.endPoint() +) +SketchConstraintAngle_29 = Sketch_1.setAngleBackward( + SketchLine_31.result(), SketchLine_32.result(), "Ang" +) +SketchConstraintAngle_30 = Sketch_1.setAngleBackward( + SketchLine_33.result(), SketchLine_32.result(), "360-Ang" +) +SketchConstraintAngle_31 = Sketch_1.setAngleBackward( + SketchLine_31.result(), SketchLine_34.result(), "360-Ang" +) +SketchConstraintAngle_32 = Sketch_1.setAngleBackward( + SketchLine_36.result(), SketchLine_35.result(), "Ang" +) +SketchConstraintAngle_33 = Sketch_1.setAngleBackward( + SketchLine_35.result(), SketchLine_34.result(), "Ang" +) +SketchConstraintAngle_34 = Sketch_1.setAngleBackward( + SketchLine_36.result(), SketchLine_37.result(), "360-Ang" +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_32.result(), 20) -SketchConstraintEqual_23 = Sketch_1.setEqual(SketchLine_32.result(), SketchLine_31.result()) -SketchConstraintEqual_24 = Sketch_1.setEqual(SketchLine_32.result(), SketchLine_34.result()) -SketchConstraintEqual_25 = Sketch_1.setEqual(SketchLine_32.result(), SketchLine_35.result()) -SketchConstraintEqual_26 = Sketch_1.setEqual(SketchLine_32.result(), SketchLine_36.result()) -SketchLine_38 = Sketch_1.addLine(171.0385831271055, -48.05657162886843, 135.6178801955327, 0.3724878688471688) +SketchConstraintEqual_23 = Sketch_1.setEqual( + SketchLine_32.result(), SketchLine_31.result() +) +SketchConstraintEqual_24 = Sketch_1.setEqual( + SketchLine_32.result(), SketchLine_34.result() +) +SketchConstraintEqual_25 = Sketch_1.setEqual( + SketchLine_32.result(), SketchLine_35.result() +) +SketchConstraintEqual_26 = Sketch_1.setEqual( + SketchLine_32.result(), SketchLine_36.result() +) +SketchLine_38 = Sketch_1.addLine( + 171.0385831271055, -48.05657162886843, 135.6178801955327, 0.3724878688471688 +) SketchPoint_5 = Sketch_1.addPoint(159.2316821499145, -31.91355179629657) -SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_33.result()) -SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_38.result()) -SketchConstraintDistance_23 = Sketch_1.setDistance(SketchLine_32.endPoint(), SketchPoint_5.coordinates(), 20, True) -SketchConstraintDistance_24 = Sketch_1.setDistance(SketchLine_38.startPoint(), SketchPoint_5.coordinates(), 20, True) -SketchConstraintDistance_25 = Sketch_1.setDistance(SketchPoint_5.coordinates(), SketchLine_33.endPoint(), 40, True) -SketchConstraintEqual_27 = Sketch_1.setEqual(SketchLine_33.result(), SketchLine_38.result()) -SketchLine_39 = Sketch_1.addLine(175.8477778293761, -43.04483044571408, 125.9994907909914, -9.650994497461493) -SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_39.result()) -SketchConstraintEqual_28 = Sketch_1.setEqual(SketchLine_33.result(), SketchLine_39.result()) -SketchConstraintDistance_26 = Sketch_1.setDistance(SketchLine_39.startPoint(), SketchPoint_5.coordinates(), 20, True) -SketchConstraintAngle_35 = Sketch_1.setAngleBackward(SketchLine_33.result(), SketchLine_38.result(), "360-(180-Ang)/2") -SketchConstraintAngle_36 = Sketch_1.setAngleBackward(SketchLine_39.result(), SketchLine_38.result(), "(180-Ang)/2") -SketchLine_40 = Sketch_1.addLine(160.1386077477389, -30.42300575990098, 107.5695439158812, -1.500807920835093) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident( + SketchPoint_5.coordinates(), SketchLine_33.result() +) +SketchConstraintCoincidence_42 = Sketch_1.setCoincident( + SketchPoint_5.coordinates(), SketchLine_38.result() +) +SketchConstraintDistance_23 = Sketch_1.setDistance( + SketchLine_32.endPoint(), SketchPoint_5.coordinates(), 20, True +) +SketchConstraintDistance_24 = Sketch_1.setDistance( + SketchLine_38.startPoint(), SketchPoint_5.coordinates(), 20, True +) +SketchConstraintDistance_25 = Sketch_1.setDistance( + SketchPoint_5.coordinates(), SketchLine_33.endPoint(), 40, True +) +SketchConstraintEqual_27 = Sketch_1.setEqual( + SketchLine_33.result(), SketchLine_38.result() +) +SketchLine_39 = Sketch_1.addLine( + 175.8477778293761, -43.04483044571408, 125.9994907909914, -9.650994497461493 +) +SketchConstraintCoincidence_43 = Sketch_1.setCoincident( + SketchPoint_5.coordinates(), SketchLine_39.result() +) +SketchConstraintEqual_28 = Sketch_1.setEqual( + SketchLine_33.result(), SketchLine_39.result() +) +SketchConstraintDistance_26 = Sketch_1.setDistance( + SketchLine_39.startPoint(), SketchPoint_5.coordinates(), 20, True +) +SketchConstraintAngle_35 = Sketch_1.setAngleBackward( + SketchLine_33.result(), SketchLine_38.result(), "360-(180-Ang)/2" +) +SketchConstraintAngle_36 = Sketch_1.setAngleBackward( + SketchLine_39.result(), SketchLine_38.result(), "(180-Ang)/2" +) +SketchLine_40 = Sketch_1.addLine( + 160.1386077477389, -30.42300575990098, 107.5695439158812, -1.500807920835093 +) SketchPoint_6 = Sketch_1.addPoint(142.615586470453, -20.78227314687903) -SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_40.result()) -SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_39.result()) -SketchConstraintDistance_27 = Sketch_1.setDistance(SketchPoint_6.coordinates(), SketchLine_40.startPoint(), 20, True) -SketchConstraintDistance_28 = Sketch_1.setDistance(SketchPoint_6.coordinates(), SketchLine_39.endPoint(), 20, True) -SketchConstraintEqual_29 = Sketch_1.setEqual(SketchLine_39.result(), SketchLine_40.result()) -SketchLine_41 = Sketch_1.addLine(147.1612701207084, -22.78891223719074, 124.3190003679524, -12.70545836667124) -SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_41.result()) -SketchConstraintDistance_29 = Sketch_1.setDistance(SketchLine_41.endPoint(), SketchPoint_6.coordinates(), 20, True) -SketchConstraintAngle_37 = Sketch_1.setAngleBackward(SketchLine_39.result(), SketchLine_40.result(), "180-dAng") -SketchConstraintAngle_38 = Sketch_1.setAngleBackward(SketchLine_41.result(), SketchLine_40.result(), "dAng") -SketchLine_42 = Sketch_1.addLine(161.5464893301474, -27.23370065688114, 104.7537807510641, -7.879418126874779) -SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_42.result()) -SketchConstraintEqual_30 = Sketch_1.setEqual(SketchLine_39.result(), SketchLine_42.result()) -SketchConstraintDistance_30 = Sketch_1.setDistance(SketchPoint_6.coordinates(), SketchLine_42.startPoint(), 20, True) -SketchConstraintAngle_39 = Sketch_1.setAngleBackward(SketchLine_42.result(), SketchLine_41.result(), "dAng") -SketchLine_43 = Sketch_1.addLine(181.4578745011218, -30.33615510881286, 123.1944424551186, -16.0053321659121) -SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_43.result()) -SketchConstraintEqual_31 = Sketch_1.setEqual(SketchLine_42.result(), SketchLine_43.result()) -SketchConstraintDistance_31 = Sketch_1.setDistance(SketchLine_43.endPoint(), SketchPoint_6.coordinates(), 20, True) -SketchConstraintAngle_40 = Sketch_1.setAngleBackward(SketchLine_42.result(), SketchLine_43.result(), "180-dAng") -SketchLine_44 = Sketch_1.addLine(182.1427435468735, -26.91447124022047, 122.8520079322427, -17.71617410020831) -SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_44.result()) -SketchConstraintDistance_32 = Sketch_1.setDistance(SketchLine_44.endPoint(), SketchPoint_6.coordinates(), 20, True) -SketchConstraintAngle_41 = Sketch_1.setAngleBackward(SketchLine_43.result(), SketchLine_44.result(), "360-dAng") -SketchConstraintEqual_32 = Sketch_1.setEqual(SketchLine_43.result(), SketchLine_44.result()) -SketchLine_45 = Sketch_1.addLine(182.5267870601237, -23.44611764141531, 122.6599861756176, -19.45035089961089) -SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_45.result()) -SketchConstraintEqual_33 = Sketch_1.setEqual(SketchLine_44.result(), SketchLine_45.result()) -SketchConstraintDistance_33 = Sketch_1.setDistance(SketchLine_45.endPoint(), SketchPoint_6.coordinates(), 20, True) -SketchConstraintAngle_42 = Sketch_1.setAngleBackward(SketchLine_45.result(), SketchLine_44.result(), "dAng") -SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_37.startPoint(), SketchLine_45.result()) +SketchConstraintCoincidence_44 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_40.result() +) +SketchConstraintCoincidence_45 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_39.result() +) +SketchConstraintDistance_27 = Sketch_1.setDistance( + SketchPoint_6.coordinates(), SketchLine_40.startPoint(), 20, True +) +SketchConstraintDistance_28 = Sketch_1.setDistance( + SketchPoint_6.coordinates(), SketchLine_39.endPoint(), 20, True +) +SketchConstraintEqual_29 = Sketch_1.setEqual( + SketchLine_39.result(), SketchLine_40.result() +) +SketchLine_41 = Sketch_1.addLine( + 147.1612701207084, -22.78891223719074, 124.3190003679524, -12.70545836667124 +) +SketchConstraintCoincidence_46 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_41.result() +) +SketchConstraintDistance_29 = Sketch_1.setDistance( + SketchLine_41.endPoint(), SketchPoint_6.coordinates(), 20, True +) +SketchConstraintAngle_37 = Sketch_1.setAngleBackward( + SketchLine_39.result(), SketchLine_40.result(), "180-dAng" +) +SketchConstraintAngle_38 = Sketch_1.setAngleBackward( + SketchLine_41.result(), SketchLine_40.result(), "dAng" +) +SketchLine_42 = Sketch_1.addLine( + 161.5464893301474, -27.23370065688114, 104.7537807510641, -7.879418126874779 +) +SketchConstraintCoincidence_47 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_42.result() +) +SketchConstraintEqual_30 = Sketch_1.setEqual( + SketchLine_39.result(), SketchLine_42.result() +) +SketchConstraintDistance_30 = Sketch_1.setDistance( + SketchPoint_6.coordinates(), SketchLine_42.startPoint(), 20, True +) +SketchConstraintAngle_39 = Sketch_1.setAngleBackward( + SketchLine_42.result(), SketchLine_41.result(), "dAng" +) +SketchLine_43 = Sketch_1.addLine( + 181.4578745011218, -30.33615510881286, 123.1944424551186, -16.0053321659121 +) +SketchConstraintCoincidence_48 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_43.result() +) +SketchConstraintEqual_31 = Sketch_1.setEqual( + SketchLine_42.result(), SketchLine_43.result() +) +SketchConstraintDistance_31 = Sketch_1.setDistance( + SketchLine_43.endPoint(), SketchPoint_6.coordinates(), 20, True +) +SketchConstraintAngle_40 = Sketch_1.setAngleBackward( + SketchLine_42.result(), SketchLine_43.result(), "180-dAng" +) +SketchLine_44 = Sketch_1.addLine( + 182.1427435468735, -26.91447124022047, 122.8520079322427, -17.71617410020831 +) +SketchConstraintCoincidence_49 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_44.result() +) +SketchConstraintDistance_32 = Sketch_1.setDistance( + SketchLine_44.endPoint(), SketchPoint_6.coordinates(), 20, True +) +SketchConstraintAngle_41 = Sketch_1.setAngleBackward( + SketchLine_43.result(), SketchLine_44.result(), "360-dAng" +) +SketchConstraintEqual_32 = Sketch_1.setEqual( + SketchLine_43.result(), SketchLine_44.result() +) +SketchLine_45 = Sketch_1.addLine( + 182.5267870601237, -23.44611764141531, 122.6599861756176, -19.45035089961089 +) +SketchConstraintCoincidence_50 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_45.result() +) +SketchConstraintEqual_33 = Sketch_1.setEqual( + SketchLine_44.result(), SketchLine_45.result() +) +SketchConstraintDistance_33 = Sketch_1.setDistance( + SketchLine_45.endPoint(), SketchPoint_6.coordinates(), 20, True +) +SketchConstraintAngle_42 = Sketch_1.setAngleBackward( + SketchLine_45.result(), SketchLine_44.result(), "dAng" +) +SketchConstraintCoincidence_51 = Sketch_1.setCoincident( + SketchLine_37.startPoint(), SketchLine_45.result() +) model.do() -Extrusion_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_9f-SketchLine_15f-SketchLine_7f-SketchLine_6r-SketchLine_5f-SketchLine_4r"), model.selection("FACE", "Sketch_1/Face-SketchLine_16f-SketchLine_17f-SketchLine_18f-SketchLine_24f-SketchLine_30f-SketchLine_22f-SketchLine_21r-SketchLine_20f-SketchLine_19r"), model.selection("FACE", "Sketch_1/Face-SketchLine_31f-SketchLine_32f-SketchLine_33f-SketchLine_39f-SketchLine_45f-SketchLine_37f-SketchLine_36r-SketchLine_35f-SketchLine_34r")] -Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection(), 10, 0) +Extrusion_1_objects = [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_9f-SketchLine_15f-SketchLine_7f-SketchLine_6r-SketchLine_5f-SketchLine_4r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_16f-SketchLine_17f-SketchLine_18f-SketchLine_24f-SketchLine_30f-SketchLine_22f-SketchLine_21r-SketchLine_20f-SketchLine_19r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_31f-SketchLine_32f-SketchLine_33f-SketchLine_39f-SketchLine_45f-SketchLine_37f-SketchLine_36r-SketchLine_35f-SketchLine_34r", + ), +] +Extrusion_1 = model.addExtrusion( + Part_1_doc, Extrusion_1_objects, model.selection(), 10, 0 +) model.end() @@ -260,4 +683,4 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [54, 54, 54]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [108, 108, 108]) model.testResultsVolumes(Extrusion_1, [REF_VOLUME, REF_VOLUME, REF_VOLUME]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintAngle_v20191210_1.py b/src/SketchPlugin/Test/TestConstraintAngle_v20191210_1.py index 249f4121b..9d949b598 100644 --- a/src/SketchPlugin/Test/TestConstraintAngle_v20191210_1.py +++ b/src/SketchPlugin/Test/TestConstraintAngle_v20191210_1.py @@ -24,224 +24,647 @@ 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(-17.48270627886662, -77.57247534383079, 0.4653113240225388, -68.74815303974528) -SketchLine_2 = Sketch_1.addLine(0.4653113240225388, -68.74815303974528, 8.542125432770632, -50.45156664083665) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(8.542125432770632, -50.45156664083665, -8.178735979228234, 7.171456480488104) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-17.48270627886662, -77.57247534383079, -36.90385046950819, -72.79553507559329) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(-48.71075203912585, -56.65251567631857, -36.90385046950819, -72.79553507559329) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.endPoint()) -SketchLine_6 = Sketch_1.addLine(-48.71075203912585, -56.65251567631857, -47.37883052420096, -36.69691533260352) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_6.startPoint()) -SketchLine_7 = Sketch_1.addLine(-30.39232801419296, -18.99499937550162, -47.37883052420096, -36.69691533260352) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.endPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_2.result(), 140, type = "Direct") -SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_2.result(), 140, type = "Direct") -SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_4.result(), 140, type = "Direct") -SketchConstraintAngle_4 = Sketch_1.setAngle(SketchLine_6.result(), SketchLine_5.result(), 140, type = "Direct") -SketchConstraintAngle_5 = Sketch_1.setAngle(SketchLine_5.result(), SketchLine_4.result(), 140, type = "Direct") -SketchConstraintAngle_6 = Sketch_1.setAngle(SketchLine_6.result(), SketchLine_7.result(), 140, type = "Direct") +SketchLine_1 = Sketch_1.addLine( + -17.48270627886662, -77.57247534383079, 0.4653113240225388, -68.74815303974528 +) +SketchLine_2 = Sketch_1.addLine( + 0.4653113240225388, -68.74815303974528, 8.542125432770632, -50.45156664083665 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 8.542125432770632, -50.45156664083665, -8.178735979228234, 7.171456480488104 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -17.48270627886662, -77.57247534383079, -36.90385046950819, -72.79553507559329 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + -48.71075203912585, -56.65251567631857, -36.90385046950819, -72.79553507559329 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.endPoint() +) +SketchLine_6 = Sketch_1.addLine( + -48.71075203912585, -56.65251567631857, -47.37883052420096, -36.69691533260352 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_6.startPoint() +) +SketchLine_7 = Sketch_1.addLine( + -30.39232801419296, -18.99499937550162, -47.37883052420096, -36.69691533260352 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.endPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_2.result(), 140, type="Direct" +) +SketchConstraintAngle_2 = Sketch_1.setAngle( + SketchLine_3.result(), SketchLine_2.result(), 140, type="Direct" +) +SketchConstraintAngle_3 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_4.result(), 140, type="Direct" +) +SketchConstraintAngle_4 = Sketch_1.setAngle( + SketchLine_6.result(), SketchLine_5.result(), 140, type="Direct" +) +SketchConstraintAngle_5 = Sketch_1.setAngle( + SketchLine_5.result(), SketchLine_4.result(), 140, type="Direct" +) +SketchConstraintAngle_6 = Sketch_1.setAngle( + SketchLine_6.result(), SketchLine_7.result(), 140, type="Direct" +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_4.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_5.result()) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_6.result()) -SketchLine_8 = Sketch_1.addLine(14.775406531722, -47.38691166633646, -20.64529817713098, 1.042146531487715) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_1.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_4.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_5.result() +) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_6.result() +) +SketchLine_8 = Sketch_1.addLine( + 14.775406531722, -47.38691166633646, -20.64529817713098, 1.042146531487715 +) SketchPoint_1 = Sketch_1.addPoint(2.968504962104344, -31.24389226706174) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_3.result()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_8.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.endPoint(), SketchPoint_1.coordinates(), 20, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.startPoint(), SketchPoint_1.coordinates(), 20, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_3.endPoint(), 40, True) -SketchConstraintEqual_5 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_8.result()) -SketchLine_9 = Sketch_1.addLine(19.58460105006861, -42.37517030669127, -30.26368721382418, -8.981336187802668) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_9.result()) -SketchConstraintEqual_6 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_9.result()) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_9.startPoint(), SketchPoint_1.coordinates(), 20, True) -SketchConstraintAngle_7 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_8.result(), 20, type = "Direct") -SketchConstraintAngle_8 = Sketch_1.setAngle(SketchLine_9.result(), SketchLine_8.result(), 20, type = "Direct") -SketchLine_10 = Sketch_1.addLine(3.875430505227681, -29.75334619738324, -48.69363438803513, -0.8311502875301234) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_3.result() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_8.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_2.endPoint(), SketchPoint_1.coordinates(), 20, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_8.startPoint(), SketchPoint_1.coordinates(), 20, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchPoint_1.coordinates(), SketchLine_3.endPoint(), 40, True +) +SketchConstraintEqual_5 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_8.result() +) +SketchLine_9 = Sketch_1.addLine( + 19.58460105006861, -42.37517030669127, -30.26368721382418, -8.981336187802668 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_9.result() +) +SketchConstraintEqual_6 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_9.result() +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_9.startPoint(), SketchPoint_1.coordinates(), 20, True +) +SketchConstraintAngle_7 = Sketch_1.setAngle( + SketchLine_3.result(), SketchLine_8.result(), 20, type="Direct" +) +SketchConstraintAngle_8 = Sketch_1.setAngle( + SketchLine_9.result(), SketchLine_8.result(), 20, type="Direct" +) +SketchLine_10 = Sketch_1.addLine( + 3.875430505227681, -29.75334619738324, -48.69363438803513, -0.8311502875301234 +) SketchPoint_2 = Sketch_1.addPoint(-13.64759112585992, -20.1126142274322) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_10.result()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_9.result()) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_10.startPoint(), 20, True) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_9.endPoint(), 20, True) -SketchConstraintEqual_7 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(0.001529676402264532, -26.13785899518266, -31.94417752476854, -12.03580011868412) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_11.result()) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_11.endPoint(), SketchPoint_2.coordinates(), 20, True) -SketchConstraintAngle_9 = Sketch_1.setAngle(SketchLine_9.result(), SketchLine_10.result(), 175, type = "Direct") -SketchConstraintAngle_10 = Sketch_1.setAngle(SketchLine_11.result(), SketchLine_10.result(), 5, type = "Direct") -SketchLine_12 = Sketch_1.addLine(5.283311970593094, -26.56404104269606, -51.50939731876596, -7.20976059690448) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_12.result()) -SketchConstraintEqual_8 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_12.result()) -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_12.startPoint(), 20, True) -SketchConstraintAngle_11 = Sketch_1.setAngle(SketchLine_12.result(), SketchLine_11.result(), 5, type = "Direct") -SketchLine_13 = Sketch_1.addLine(25.19469725542325, -29.66649476390714, -33.06873531650151, -15.33567395919474) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_13.result()) -SketchConstraintEqual_9 = Sketch_1.setEqual(SketchLine_12.result(), SketchLine_13.result()) -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_13.endPoint(), SketchPoint_2.coordinates(), 20, True) -SketchConstraintAngle_12 = Sketch_1.setAngle(SketchLine_12.result(), SketchLine_13.result(), 175, type = "Direct") -SketchLine_14 = Sketch_1.addLine(25.87956617560386, -26.24481087018098, -33.41116977659181, -17.04651590605781) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_14.result()) -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchLine_14.endPoint(), SketchPoint_2.coordinates(), 20, True) -SketchConstraintAngle_13 = Sketch_1.setAngle(SketchLine_13.result(), SketchLine_14.result(), 5, type = "Direct") -SketchConstraintEqual_10 = Sketch_1.setEqual(SketchLine_13.result(), SketchLine_14.result()) -SketchLine_15 = Sketch_1.addLine(26.26360956157018, -22.77645725728195, -33.60319146957497, -18.78069271250733) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_15.result()) -SketchConstraintEqual_11 = Sketch_1.setEqual(SketchLine_14.result(), SketchLine_15.result()) -SketchConstraintDistance_11 = Sketch_1.setDistance(SketchLine_15.endPoint(), SketchPoint_2.coordinates(), 20, True) -SketchConstraintAngle_14 = Sketch_1.setAngle(SketchLine_15.result(), SketchLine_14.result(), 5, type = "Direct") -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchLine_15.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_10.result() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_9.result() +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchPoint_2.coordinates(), SketchLine_10.startPoint(), 20, True +) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchPoint_2.coordinates(), SketchLine_9.endPoint(), 20, True +) +SketchConstraintEqual_7 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_10.result() +) +SketchLine_11 = Sketch_1.addLine( + 0.001529676402264532, -26.13785899518266, -31.94417752476854, -12.03580011868412 +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_11.result() +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchLine_11.endPoint(), SketchPoint_2.coordinates(), 20, True +) +SketchConstraintAngle_9 = Sketch_1.setAngle( + SketchLine_9.result(), SketchLine_10.result(), 175, type="Direct" +) +SketchConstraintAngle_10 = Sketch_1.setAngle( + SketchLine_11.result(), SketchLine_10.result(), 5, type="Direct" +) +SketchLine_12 = Sketch_1.addLine( + 5.283311970593094, -26.56404104269606, -51.50939731876596, -7.20976059690448 +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_12.result() +) +SketchConstraintEqual_8 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_12.result() +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchPoint_2.coordinates(), SketchLine_12.startPoint(), 20, True +) +SketchConstraintAngle_11 = Sketch_1.setAngle( + SketchLine_12.result(), SketchLine_11.result(), 5, type="Direct" +) +SketchLine_13 = Sketch_1.addLine( + 25.19469725542325, -29.66649476390714, -33.06873531650151, -15.33567395919474 +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_13.result() +) +SketchConstraintEqual_9 = Sketch_1.setEqual( + SketchLine_12.result(), SketchLine_13.result() +) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_13.endPoint(), SketchPoint_2.coordinates(), 20, True +) +SketchConstraintAngle_12 = Sketch_1.setAngle( + SketchLine_12.result(), SketchLine_13.result(), 175, type="Direct" +) +SketchLine_14 = Sketch_1.addLine( + 25.87956617560386, -26.24481087018098, -33.41116977659181, -17.04651590605781 +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_14.result() +) +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchLine_14.endPoint(), SketchPoint_2.coordinates(), 20, True +) +SketchConstraintAngle_13 = Sketch_1.setAngle( + SketchLine_13.result(), SketchLine_14.result(), 5, type="Direct" +) +SketchConstraintEqual_10 = Sketch_1.setEqual( + SketchLine_13.result(), SketchLine_14.result() +) +SketchLine_15 = Sketch_1.addLine( + 26.26360956157018, -22.77645725728195, -33.60319146957497, -18.78069271250733 +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_15.result() +) +SketchConstraintEqual_11 = Sketch_1.setEqual( + SketchLine_14.result(), SketchLine_15.result() +) +SketchConstraintDistance_11 = Sketch_1.setDistance( + SketchLine_15.endPoint(), SketchPoint_2.coordinates(), 20, True +) +SketchConstraintAngle_14 = Sketch_1.setAngle( + SketchLine_15.result(), SketchLine_14.result(), 5, type="Direct" +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchLine_15.result() +) -SketchLine_16 = Sketch_1.addLine(60.00388909712782, -76.09960829009104, 78.00643494689578, -67.38706888260469) -SketchLine_17 = Sketch_1.addLine(78.00643494689578, -67.38706888260469, 86.19687277706721, -49.141063069) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) -SketchLine_18 = Sketch_1.addLine(86.19687277706721, -49.141063069, 69.83467154684908, 8.584826884311665) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) -SketchLine_19 = Sketch_1.addLine(60.00388909712782, -76.09960829009104, 40.61282650688053, -71.20198727360641) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_16.startPoint(), SketchLine_19.startPoint()) -SketchLine_20 = Sketch_1.addLine(28.90654086978602, -54.98585713775849, 40.61282650688053, -71.20198727360641) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.endPoint()) -SketchLine_21 = Sketch_1.addLine(28.90654086978602, -54.98585713775849, 30.36253333631381, -35.03892539532215) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_20.startPoint(), SketchLine_21.startPoint()) -SketchLine_22 = Sketch_1.addLine(47.45878924889096, -17.44298467461911, 30.36253333631381, -35.03892539532215) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchLine_22.endPoint()) -SketchConstraintAngle_15 = Sketch_1.setAngle(SketchLine_16.result(), SketchLine_17.result(), 40, type = "Supplementary") -SketchConstraintAngle_16 = Sketch_1.setAngle(SketchLine_18.result(), SketchLine_17.result(), 40, type = "Supplementary") -SketchConstraintAngle_17 = Sketch_1.setAngle(SketchLine_16.result(), SketchLine_19.result(), 40, type = "Supplementary") -SketchConstraintAngle_18 = Sketch_1.setAngle(SketchLine_21.result(), SketchLine_20.result(), 40, type = "Supplementary") -SketchConstraintAngle_19 = Sketch_1.setAngle(SketchLine_20.result(), SketchLine_19.result(), 40, type = "Supplementary") -SketchConstraintAngle_20 = Sketch_1.setAngle(SketchLine_21.result(), SketchLine_22.result(), 40, type = "Supplementary") +SketchLine_16 = Sketch_1.addLine( + 60.00388909712782, -76.09960829009104, 78.00643494689578, -67.38706888260469 +) +SketchLine_17 = Sketch_1.addLine( + 78.00643494689578, -67.38706888260469, 86.19687277706721, -49.141063069 +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) +SketchLine_18 = Sketch_1.addLine( + 86.19687277706721, -49.141063069, 69.83467154684908, 8.584826884311665 +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) +SketchLine_19 = Sketch_1.addLine( + 60.00388909712782, -76.09960829009104, 40.61282650688053, -71.20198727360641 +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_16.startPoint(), SketchLine_19.startPoint() +) +SketchLine_20 = Sketch_1.addLine( + 28.90654086978602, -54.98585713775849, 40.61282650688053, -71.20198727360641 +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.endPoint() +) +SketchLine_21 = Sketch_1.addLine( + 28.90654086978602, -54.98585713775849, 30.36253333631381, -35.03892539532215 +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_20.startPoint(), SketchLine_21.startPoint() +) +SketchLine_22 = Sketch_1.addLine( + 47.45878924889096, -17.44298467461911, 30.36253333631381, -35.03892539532215 +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchLine_22.endPoint() +) +SketchConstraintAngle_15 = Sketch_1.setAngle( + SketchLine_16.result(), SketchLine_17.result(), 40, type="Supplementary" +) +SketchConstraintAngle_16 = Sketch_1.setAngle( + SketchLine_18.result(), SketchLine_17.result(), 40, type="Supplementary" +) +SketchConstraintAngle_17 = Sketch_1.setAngle( + SketchLine_16.result(), SketchLine_19.result(), 40, type="Supplementary" +) +SketchConstraintAngle_18 = Sketch_1.setAngle( + SketchLine_21.result(), SketchLine_20.result(), 40, type="Supplementary" +) +SketchConstraintAngle_19 = Sketch_1.setAngle( + SketchLine_20.result(), SketchLine_19.result(), 40, type="Supplementary" +) +SketchConstraintAngle_20 = Sketch_1.setAngle( + SketchLine_21.result(), SketchLine_22.result(), 40, type="Supplementary" +) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_17.result(), 20) -SketchConstraintEqual_12 = Sketch_1.setEqual(SketchLine_17.result(), SketchLine_16.result()) -SketchConstraintEqual_13 = Sketch_1.setEqual(SketchLine_17.result(), SketchLine_19.result()) -SketchConstraintEqual_14 = Sketch_1.setEqual(SketchLine_17.result(), SketchLine_20.result()) -SketchConstraintEqual_15 = Sketch_1.setEqual(SketchLine_17.result(), SketchLine_21.result()) -SketchLine_23 = Sketch_1.addLine(92.44909133742235, -46.11522988707736, 57.3302344261388, 2.533160520466375) +SketchConstraintEqual_12 = Sketch_1.setEqual( + SketchLine_17.result(), SketchLine_16.result() +) +SketchConstraintEqual_13 = Sketch_1.setEqual( + SketchLine_17.result(), SketchLine_19.result() +) +SketchConstraintEqual_14 = Sketch_1.setEqual( + SketchLine_17.result(), SketchLine_20.result() +) +SketchConstraintEqual_15 = Sketch_1.setEqual( + SketchLine_17.result(), SketchLine_21.result() +) +SketchLine_23 = Sketch_1.addLine( + 92.44909133742235, -46.11522988707736, 57.3302344261388, 2.533160520466375 +) SketchPoint_3 = Sketch_1.addPoint(80.74280570032784, -29.89909975122945) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_18.result()) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_23.result()) -SketchConstraintDistance_12 = Sketch_1.setDistance(SketchLine_17.endPoint(), SketchPoint_3.coordinates(), 20, True) -SketchConstraintDistance_13 = Sketch_1.setDistance(SketchLine_23.startPoint(), SketchPoint_3.coordinates(), 20, True) -SketchConstraintDistance_14 = Sketch_1.setDistance(SketchPoint_3.coordinates(), SketchLine_18.endPoint(), 40, True) -SketchConstraintEqual_16 = Sketch_1.setEqual(SketchLine_18.result(), SketchLine_23.result()) -SketchLine_24 = Sketch_1.addLine(97.289359083568, -41.13349208617944, 47.64969893384747, -7.430315081329468) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_24.result()) -SketchConstraintEqual_17 = Sketch_1.setEqual(SketchLine_18.result(), SketchLine_24.result()) -SketchConstraintDistance_15 = Sketch_1.setDistance(SketchLine_24.startPoint(), SketchPoint_3.coordinates(), 20, True) -SketchConstraintAngle_21 = Sketch_1.setAngle(SketchLine_18.result(), SketchLine_23.result(), 160, type = "Supplementary") -SketchConstraintAngle_22 = Sketch_1.setAngle(SketchLine_24.result(), SketchLine_23.result(), 160, type = "Supplementary") -SketchLine_25 = Sketch_1.addLine(81.65898287743471, -28.41422234660911, 29.27079119639352, 0.8343224443798635) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_18.result() +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_23.result() +) +SketchConstraintDistance_12 = Sketch_1.setDistance( + SketchLine_17.endPoint(), SketchPoint_3.coordinates(), 20, True +) +SketchConstraintDistance_13 = Sketch_1.setDistance( + SketchLine_23.startPoint(), SketchPoint_3.coordinates(), 20, True +) +SketchConstraintDistance_14 = Sketch_1.setDistance( + SketchPoint_3.coordinates(), SketchLine_18.endPoint(), 40, True +) +SketchConstraintEqual_16 = Sketch_1.setEqual( + SketchLine_18.result(), SketchLine_23.result() +) +SketchLine_24 = Sketch_1.addLine( + 97.289359083568, -41.13349208617944, 47.64969893384747, -7.430315081329468 +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_24.result() +) +SketchConstraintEqual_17 = Sketch_1.setEqual( + SketchLine_18.result(), SketchLine_24.result() +) +SketchConstraintDistance_15 = Sketch_1.setDistance( + SketchLine_24.startPoint(), SketchPoint_3.coordinates(), 20, True +) +SketchConstraintAngle_21 = Sketch_1.setAngle( + SketchLine_18.result(), SketchLine_23.result(), 160, type="Supplementary" +) +SketchConstraintAngle_22 = Sketch_1.setAngle( + SketchLine_24.result(), SketchLine_23.result(), 160, type="Supplementary" +) +SketchLine_25 = Sketch_1.addLine( + 81.65898287743471, -28.41422234660911, 29.27079119639352, 0.8343224443798635 +) SketchPoint_4 = Sketch_1.addPoint(64.19625231708766, -18.66470741627946) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_25.result()) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_24.result()) -SketchConstraintDistance_16 = Sketch_1.setDistance(SketchPoint_4.coordinates(), SketchLine_25.startPoint(), 20, True) -SketchConstraintDistance_17 = Sketch_1.setDistance(SketchPoint_4.coordinates(), SketchLine_24.endPoint(), 20, True) -SketchConstraintEqual_18 = Sketch_1.setEqual(SketchLine_24.result(), SketchLine_25.result()) -SketchLine_26 = Sketch_1.addLine(95.51651619313817, -32.72404055044315, 45.95024650348294, -10.47426958610802) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_26.result()) -SketchConstraintDistance_18 = Sketch_1.setDistance(SketchLine_26.endPoint(), SketchPoint_4.coordinates(), 20, True) -SketchConstraintAngle_23 = Sketch_1.setAngle(SketchLine_24.result(), SketchLine_25.result(), 5, type = "Supplementary") -SketchConstraintAngle_24 = Sketch_1.setAngle(SketchLine_26.result(), SketchLine_25.result(), 5, type = "Supplementary") -SketchLine_27 = Sketch_1.addLine(83.08667026246893, -25.23373396888348, 26.41541642632507, -5.526654311071399) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_27.result()) -SketchConstraintEqual_19 = Sketch_1.setEqual(SketchLine_24.result(), SketchLine_27.result()) -SketchConstraintDistance_19 = Sketch_1.setDistance(SketchPoint_4.coordinates(), SketchLine_27.startPoint(), 20, True) -SketchConstraintAngle_25 = Sketch_1.setAngle(SketchLine_27.result(), SketchLine_26.result(), 5, type = "Supplementary") -SketchLine_28 = Sketch_1.addLine(102.9783774975822, -28.45994944924871, 44.80518972684035, -13.76708639979482) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_28.result()) -SketchConstraintEqual_20 = Sketch_1.setEqual(SketchLine_27.result(), SketchLine_28.result()) -SketchConstraintDistance_20 = Sketch_1.setDistance(SketchLine_28.endPoint(), SketchPoint_4.coordinates(), 20, True) -SketchConstraintAngle_26 = Sketch_1.setAngle(SketchLine_27.result(), SketchLine_28.result(), 5, type = "Supplementary") -SketchLine_29 = Sketch_1.addLine(103.6845113974033, -25.04259067061018, 44.45212277692985, -15.47576578911409) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_29.result()) -SketchConstraintDistance_21 = Sketch_1.setDistance(SketchLine_29.endPoint(), SketchPoint_4.coordinates(), 20, True) -SketchConstraintAngle_27 = Sketch_1.setAngle(SketchLine_28.result(), SketchLine_29.result(), 175, type = "Supplementary") -SketchConstraintEqual_21 = Sketch_1.setEqual(SketchLine_28.result(), SketchLine_29.result()) -SketchLine_30 = Sketch_1.addLine(104.0901158019603, -21.57669234933498, 44.24932057465131, -17.20871494975169) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_30.result()) -SketchConstraintEqual_22 = Sketch_1.setEqual(SketchLine_29.result(), SketchLine_30.result()) -SketchConstraintDistance_22 = Sketch_1.setDistance(SketchLine_30.endPoint(), SketchPoint_4.coordinates(), 20, True) -SketchConstraintAngle_28 = Sketch_1.setAngle(SketchLine_30.result(), SketchLine_29.result(), 175, type = "Supplementary") -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchLine_22.startPoint(), SketchLine_30.result()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_25.result() +) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_24.result() +) +SketchConstraintDistance_16 = Sketch_1.setDistance( + SketchPoint_4.coordinates(), SketchLine_25.startPoint(), 20, True +) +SketchConstraintDistance_17 = Sketch_1.setDistance( + SketchPoint_4.coordinates(), SketchLine_24.endPoint(), 20, True +) +SketchConstraintEqual_18 = Sketch_1.setEqual( + SketchLine_24.result(), SketchLine_25.result() +) +SketchLine_26 = Sketch_1.addLine( + 95.51651619313817, -32.72404055044315, 45.95024650348294, -10.47426958610802 +) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_26.result() +) +SketchConstraintDistance_18 = Sketch_1.setDistance( + SketchLine_26.endPoint(), SketchPoint_4.coordinates(), 20, True +) +SketchConstraintAngle_23 = Sketch_1.setAngle( + SketchLine_24.result(), SketchLine_25.result(), 5, type="Supplementary" +) +SketchConstraintAngle_24 = Sketch_1.setAngle( + SketchLine_26.result(), SketchLine_25.result(), 5, type="Supplementary" +) +SketchLine_27 = Sketch_1.addLine( + 83.08667026246893, -25.23373396888348, 26.41541642632507, -5.526654311071399 +) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_27.result() +) +SketchConstraintEqual_19 = Sketch_1.setEqual( + SketchLine_24.result(), SketchLine_27.result() +) +SketchConstraintDistance_19 = Sketch_1.setDistance( + SketchPoint_4.coordinates(), SketchLine_27.startPoint(), 20, True +) +SketchConstraintAngle_25 = Sketch_1.setAngle( + SketchLine_27.result(), SketchLine_26.result(), 5, type="Supplementary" +) +SketchLine_28 = Sketch_1.addLine( + 102.9783774975822, -28.45994944924871, 44.80518972684035, -13.76708639979482 +) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_28.result() +) +SketchConstraintEqual_20 = Sketch_1.setEqual( + SketchLine_27.result(), SketchLine_28.result() +) +SketchConstraintDistance_20 = Sketch_1.setDistance( + SketchLine_28.endPoint(), SketchPoint_4.coordinates(), 20, True +) +SketchConstraintAngle_26 = Sketch_1.setAngle( + SketchLine_27.result(), SketchLine_28.result(), 5, type="Supplementary" +) +SketchLine_29 = Sketch_1.addLine( + 103.6845113974033, -25.04259067061018, 44.45212277692985, -15.47576578911409 +) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_29.result() +) +SketchConstraintDistance_21 = Sketch_1.setDistance( + SketchLine_29.endPoint(), SketchPoint_4.coordinates(), 20, True +) +SketchConstraintAngle_27 = Sketch_1.setAngle( + SketchLine_28.result(), SketchLine_29.result(), 175, type="Supplementary" +) +SketchConstraintEqual_21 = Sketch_1.setEqual( + SketchLine_28.result(), SketchLine_29.result() +) +SketchLine_30 = Sketch_1.addLine( + 104.0901158019603, -21.57669234933498, 44.24932057465131, -17.20871494975169 +) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_30.result() +) +SketchConstraintEqual_22 = Sketch_1.setEqual( + SketchLine_29.result(), SketchLine_30.result() +) +SketchConstraintDistance_22 = Sketch_1.setDistance( + SketchLine_30.endPoint(), SketchPoint_4.coordinates(), 20, True +) +SketchConstraintAngle_28 = Sketch_1.setAngle( + SketchLine_30.result(), SketchLine_29.result(), 175, type="Supplementary" +) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchLine_22.startPoint(), SketchLine_30.result() +) -SketchLine_31 = Sketch_1.addLine(138.7804692087479, -78.2421341225341, 156.7284871354776, -69.4178124771163) -SketchLine_32 = Sketch_1.addLine(156.7284871354776, -69.4178124771163, 164.8053019156854, -51.12122637461573) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) -SketchLine_33 = Sketch_1.addLine(164.8053019156854, -51.12122637461573, 148.0844426183728, 6.501797360341752) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint()) -SketchLine_34 = Sketch_1.addLine(138.7804692087479, -78.2421341225341, 119.3593251934135, -73.46519314156717) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchLine_31.startPoint(), SketchLine_34.startPoint()) -SketchLine_35 = Sketch_1.addLine(107.5524242162226, -57.32217330899532, 119.3593251934135, -73.46519314156717) -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchLine_34.endPoint(), SketchLine_35.endPoint()) -SketchLine_36 = Sketch_1.addLine(107.5524242162226, -57.32217330899532, 108.8843464634908, -37.36657301415998) -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_35.startPoint(), SketchLine_36.startPoint()) -SketchLine_37 = Sketch_1.addLine(125.8708496231354, -19.66465768043951, 108.8843464634908, -37.36657301415998) -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchLine_36.endPoint(), SketchLine_37.endPoint()) -SketchConstraintAngle_29 = Sketch_1.setAngle(SketchLine_31.result(), SketchLine_32.result(), 220, type = "Backward") -SketchConstraintAngle_30 = Sketch_1.setAngle(SketchLine_33.result(), SketchLine_32.result(), 220, type = "Backward") -SketchConstraintAngle_31 = Sketch_1.setAngle(SketchLine_31.result(), SketchLine_34.result(), 220, type = "Backward") -SketchConstraintAngle_32 = Sketch_1.setAngle(SketchLine_36.result(), SketchLine_35.result(), 220, type = "Backward") -SketchConstraintAngle_33 = Sketch_1.setAngle(SketchLine_35.result(), SketchLine_34.result(), 220, type = "Backward") -SketchConstraintAngle_34 = Sketch_1.setAngle(SketchLine_36.result(), SketchLine_37.result(), 220, type = "Backward") +SketchLine_31 = Sketch_1.addLine( + 138.7804692087479, -78.2421341225341, 156.7284871354776, -69.4178124771163 +) +SketchLine_32 = Sketch_1.addLine( + 156.7284871354776, -69.4178124771163, 164.8053019156854, -51.12122637461573 +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchLine_31.endPoint(), SketchLine_32.startPoint() +) +SketchLine_33 = Sketch_1.addLine( + 164.8053019156854, -51.12122637461573, 148.0844426183728, 6.501797360341752 +) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchLine_32.endPoint(), SketchLine_33.startPoint() +) +SketchLine_34 = Sketch_1.addLine( + 138.7804692087479, -78.2421341225341, 119.3593251934135, -73.46519314156717 +) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchLine_31.startPoint(), SketchLine_34.startPoint() +) +SketchLine_35 = Sketch_1.addLine( + 107.5524242162226, -57.32217330899532, 119.3593251934135, -73.46519314156717 +) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchLine_34.endPoint(), SketchLine_35.endPoint() +) +SketchLine_36 = Sketch_1.addLine( + 107.5524242162226, -57.32217330899532, 108.8843464634908, -37.36657301415998 +) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchLine_35.startPoint(), SketchLine_36.startPoint() +) +SketchLine_37 = Sketch_1.addLine( + 125.8708496231354, -19.66465768043951, 108.8843464634908, -37.36657301415998 +) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchLine_36.endPoint(), SketchLine_37.endPoint() +) +SketchConstraintAngle_29 = Sketch_1.setAngle( + SketchLine_31.result(), SketchLine_32.result(), 220, type="Backward" +) +SketchConstraintAngle_30 = Sketch_1.setAngle( + SketchLine_33.result(), SketchLine_32.result(), 220, type="Backward" +) +SketchConstraintAngle_31 = Sketch_1.setAngle( + SketchLine_31.result(), SketchLine_34.result(), 220, type="Backward" +) +SketchConstraintAngle_32 = Sketch_1.setAngle( + SketchLine_36.result(), SketchLine_35.result(), 220, type="Backward" +) +SketchConstraintAngle_33 = Sketch_1.setAngle( + SketchLine_35.result(), SketchLine_34.result(), 220, type="Backward" +) +SketchConstraintAngle_34 = Sketch_1.setAngle( + SketchLine_36.result(), SketchLine_37.result(), 220, type="Backward" +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_32.result(), 20) -SketchConstraintEqual_23 = Sketch_1.setEqual(SketchLine_32.result(), SketchLine_31.result()) -SketchConstraintEqual_24 = Sketch_1.setEqual(SketchLine_32.result(), SketchLine_34.result()) -SketchConstraintEqual_25 = Sketch_1.setEqual(SketchLine_32.result(), SketchLine_35.result()) -SketchConstraintEqual_26 = Sketch_1.setEqual(SketchLine_32.result(), SketchLine_36.result()) -SketchLine_38 = Sketch_1.addLine(171.0385831271055, -48.05657162886843, 135.6178801955327, 0.3724878688471688) +SketchConstraintEqual_23 = Sketch_1.setEqual( + SketchLine_32.result(), SketchLine_31.result() +) +SketchConstraintEqual_24 = Sketch_1.setEqual( + SketchLine_32.result(), SketchLine_34.result() +) +SketchConstraintEqual_25 = Sketch_1.setEqual( + SketchLine_32.result(), SketchLine_35.result() +) +SketchConstraintEqual_26 = Sketch_1.setEqual( + SketchLine_32.result(), SketchLine_36.result() +) +SketchLine_38 = Sketch_1.addLine( + 171.0385831271055, -48.05657162886843, 135.6178801955327, 0.3724878688471688 +) SketchPoint_5 = Sketch_1.addPoint(159.2316821499145, -31.91355179629657) -SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_33.result()) -SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_38.result()) -SketchConstraintDistance_23 = Sketch_1.setDistance(SketchLine_32.endPoint(), SketchPoint_5.coordinates(), 20, True) -SketchConstraintDistance_24 = Sketch_1.setDistance(SketchLine_38.startPoint(), SketchPoint_5.coordinates(), 20, True) -SketchConstraintDistance_25 = Sketch_1.setDistance(SketchPoint_5.coordinates(), SketchLine_33.endPoint(), 40, True) -SketchConstraintEqual_27 = Sketch_1.setEqual(SketchLine_33.result(), SketchLine_38.result()) -SketchLine_39 = Sketch_1.addLine(175.8477778293761, -43.04483044571408, 125.9994907909914, -9.650994497461493) -SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_39.result()) -SketchConstraintEqual_28 = Sketch_1.setEqual(SketchLine_33.result(), SketchLine_39.result()) -SketchConstraintDistance_26 = Sketch_1.setDistance(SketchLine_39.startPoint(), SketchPoint_5.coordinates(), 20, True) -SketchConstraintAngle_35 = Sketch_1.setAngle(SketchLine_33.result(), SketchLine_38.result(), 340, type = "Backward") -SketchConstraintAngle_36 = Sketch_1.setAngle(SketchLine_39.result(), SketchLine_38.result(), 340, type = "Backward") -SketchLine_40 = Sketch_1.addLine(160.1386077477389, -30.42300575990098, 107.5695439158812, -1.500807920835093) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident( + SketchPoint_5.coordinates(), SketchLine_33.result() +) +SketchConstraintCoincidence_42 = Sketch_1.setCoincident( + SketchPoint_5.coordinates(), SketchLine_38.result() +) +SketchConstraintDistance_23 = Sketch_1.setDistance( + SketchLine_32.endPoint(), SketchPoint_5.coordinates(), 20, True +) +SketchConstraintDistance_24 = Sketch_1.setDistance( + SketchLine_38.startPoint(), SketchPoint_5.coordinates(), 20, True +) +SketchConstraintDistance_25 = Sketch_1.setDistance( + SketchPoint_5.coordinates(), SketchLine_33.endPoint(), 40, True +) +SketchConstraintEqual_27 = Sketch_1.setEqual( + SketchLine_33.result(), SketchLine_38.result() +) +SketchLine_39 = Sketch_1.addLine( + 175.8477778293761, -43.04483044571408, 125.9994907909914, -9.650994497461493 +) +SketchConstraintCoincidence_43 = Sketch_1.setCoincident( + SketchPoint_5.coordinates(), SketchLine_39.result() +) +SketchConstraintEqual_28 = Sketch_1.setEqual( + SketchLine_33.result(), SketchLine_39.result() +) +SketchConstraintDistance_26 = Sketch_1.setDistance( + SketchLine_39.startPoint(), SketchPoint_5.coordinates(), 20, True +) +SketchConstraintAngle_35 = Sketch_1.setAngle( + SketchLine_33.result(), SketchLine_38.result(), 340, type="Backward" +) +SketchConstraintAngle_36 = Sketch_1.setAngle( + SketchLine_39.result(), SketchLine_38.result(), 340, type="Backward" +) +SketchLine_40 = Sketch_1.addLine( + 160.1386077477389, -30.42300575990098, 107.5695439158812, -1.500807920835093 +) SketchPoint_6 = Sketch_1.addPoint(142.615586470453, -20.78227314687903) -SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_40.result()) -SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_39.result()) -SketchConstraintDistance_27 = Sketch_1.setDistance(SketchPoint_6.coordinates(), SketchLine_40.startPoint(), 20, True) -SketchConstraintDistance_28 = Sketch_1.setDistance(SketchPoint_6.coordinates(), SketchLine_39.endPoint(), 20, True) -SketchConstraintEqual_29 = Sketch_1.setEqual(SketchLine_39.result(), SketchLine_40.result()) -SketchLine_41 = Sketch_1.addLine(147.1612701207084, -22.78891223719074, 124.3190003679524, -12.70545836667124) -SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_41.result()) -SketchConstraintDistance_29 = Sketch_1.setDistance(SketchLine_41.endPoint(), SketchPoint_6.coordinates(), 20, True) -SketchConstraintAngle_37 = Sketch_1.setAngle(SketchLine_39.result(), SketchLine_40.result(), 185, type = "Backward") -SketchConstraintAngle_38 = Sketch_1.setAngle(SketchLine_41.result(), SketchLine_40.result(), 355, type = "Backward") -SketchLine_42 = Sketch_1.addLine(161.5464893301474, -27.23370065688114, 104.7537807510641, -7.879418126874779) -SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_42.result()) -SketchConstraintEqual_30 = Sketch_1.setEqual(SketchLine_39.result(), SketchLine_42.result()) -SketchConstraintDistance_30 = Sketch_1.setDistance(SketchPoint_6.coordinates(), SketchLine_42.startPoint(), 20, True) -SketchConstraintAngle_39 = Sketch_1.setAngle(SketchLine_42.result(), SketchLine_41.result(), 355, type = "Backward") -SketchLine_43 = Sketch_1.addLine(181.4578745011218, -30.33615510881286, 123.1944424551186, -16.0053321659121) -SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_43.result()) -SketchConstraintEqual_31 = Sketch_1.setEqual(SketchLine_42.result(), SketchLine_43.result()) -SketchConstraintDistance_31 = Sketch_1.setDistance(SketchLine_43.endPoint(), SketchPoint_6.coordinates(), 20, True) -SketchConstraintAngle_40 = Sketch_1.setAngle(SketchLine_42.result(), SketchLine_43.result(), 185, type = "Backward") -SketchLine_44 = Sketch_1.addLine(182.1427435468735, -26.91447124022047, 122.8520079322427, -17.71617410020831) -SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_44.result()) -SketchConstraintDistance_32 = Sketch_1.setDistance(SketchLine_44.endPoint(), SketchPoint_6.coordinates(), 20, True) -SketchConstraintAngle_41 = Sketch_1.setAngle(SketchLine_43.result(), SketchLine_44.result(), 355, type = "Backward") -SketchConstraintEqual_32 = Sketch_1.setEqual(SketchLine_43.result(), SketchLine_44.result()) -SketchLine_45 = Sketch_1.addLine(182.5267870601237, -23.44611764141531, 122.6599861756176, -19.45035089961089) -SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_45.result()) -SketchConstraintEqual_33 = Sketch_1.setEqual(SketchLine_44.result(), SketchLine_45.result()) -SketchConstraintDistance_33 = Sketch_1.setDistance(SketchLine_45.endPoint(), SketchPoint_6.coordinates(), 20, True) -SketchConstraintAngle_42 = Sketch_1.setAngle(SketchLine_45.result(), SketchLine_44.result(), 355, type = "Backward") -SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_37.startPoint(), SketchLine_45.result()) +SketchConstraintCoincidence_44 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_40.result() +) +SketchConstraintCoincidence_45 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_39.result() +) +SketchConstraintDistance_27 = Sketch_1.setDistance( + SketchPoint_6.coordinates(), SketchLine_40.startPoint(), 20, True +) +SketchConstraintDistance_28 = Sketch_1.setDistance( + SketchPoint_6.coordinates(), SketchLine_39.endPoint(), 20, True +) +SketchConstraintEqual_29 = Sketch_1.setEqual( + SketchLine_39.result(), SketchLine_40.result() +) +SketchLine_41 = Sketch_1.addLine( + 147.1612701207084, -22.78891223719074, 124.3190003679524, -12.70545836667124 +) +SketchConstraintCoincidence_46 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_41.result() +) +SketchConstraintDistance_29 = Sketch_1.setDistance( + SketchLine_41.endPoint(), SketchPoint_6.coordinates(), 20, True +) +SketchConstraintAngle_37 = Sketch_1.setAngle( + SketchLine_39.result(), SketchLine_40.result(), 185, type="Backward" +) +SketchConstraintAngle_38 = Sketch_1.setAngle( + SketchLine_41.result(), SketchLine_40.result(), 355, type="Backward" +) +SketchLine_42 = Sketch_1.addLine( + 161.5464893301474, -27.23370065688114, 104.7537807510641, -7.879418126874779 +) +SketchConstraintCoincidence_47 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_42.result() +) +SketchConstraintEqual_30 = Sketch_1.setEqual( + SketchLine_39.result(), SketchLine_42.result() +) +SketchConstraintDistance_30 = Sketch_1.setDistance( + SketchPoint_6.coordinates(), SketchLine_42.startPoint(), 20, True +) +SketchConstraintAngle_39 = Sketch_1.setAngle( + SketchLine_42.result(), SketchLine_41.result(), 355, type="Backward" +) +SketchLine_43 = Sketch_1.addLine( + 181.4578745011218, -30.33615510881286, 123.1944424551186, -16.0053321659121 +) +SketchConstraintCoincidence_48 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_43.result() +) +SketchConstraintEqual_31 = Sketch_1.setEqual( + SketchLine_42.result(), SketchLine_43.result() +) +SketchConstraintDistance_31 = Sketch_1.setDistance( + SketchLine_43.endPoint(), SketchPoint_6.coordinates(), 20, True +) +SketchConstraintAngle_40 = Sketch_1.setAngle( + SketchLine_42.result(), SketchLine_43.result(), 185, type="Backward" +) +SketchLine_44 = Sketch_1.addLine( + 182.1427435468735, -26.91447124022047, 122.8520079322427, -17.71617410020831 +) +SketchConstraintCoincidence_49 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_44.result() +) +SketchConstraintDistance_32 = Sketch_1.setDistance( + SketchLine_44.endPoint(), SketchPoint_6.coordinates(), 20, True +) +SketchConstraintAngle_41 = Sketch_1.setAngle( + SketchLine_43.result(), SketchLine_44.result(), 355, type="Backward" +) +SketchConstraintEqual_32 = Sketch_1.setEqual( + SketchLine_43.result(), SketchLine_44.result() +) +SketchLine_45 = Sketch_1.addLine( + 182.5267870601237, -23.44611764141531, 122.6599861756176, -19.45035089961089 +) +SketchConstraintCoincidence_50 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_45.result() +) +SketchConstraintEqual_33 = Sketch_1.setEqual( + SketchLine_44.result(), SketchLine_45.result() +) +SketchConstraintDistance_33 = Sketch_1.setDistance( + SketchLine_45.endPoint(), SketchPoint_6.coordinates(), 20, True +) +SketchConstraintAngle_42 = Sketch_1.setAngle( + SketchLine_45.result(), SketchLine_44.result(), 355, type="Backward" +) +SketchConstraintCoincidence_51 = Sketch_1.setCoincident( + SketchLine_37.startPoint(), SketchLine_45.result() +) model.do() -Extrusion_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_9f-SketchLine_15f-SketchLine_7f-SketchLine_6r-SketchLine_5f-SketchLine_4r"), model.selection("FACE", "Sketch_1/Face-SketchLine_16f-SketchLine_17f-SketchLine_18f-SketchLine_24f-SketchLine_30f-SketchLine_22f-SketchLine_21r-SketchLine_20f-SketchLine_19r"), model.selection("FACE", "Sketch_1/Face-SketchLine_31f-SketchLine_32f-SketchLine_33f-SketchLine_39f-SketchLine_45f-SketchLine_37f-SketchLine_36r-SketchLine_35f-SketchLine_34r")] -Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection(), 10, 0) +Extrusion_1_objects = [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_9f-SketchLine_15f-SketchLine_7f-SketchLine_6r-SketchLine_5f-SketchLine_4r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_16f-SketchLine_17f-SketchLine_18f-SketchLine_24f-SketchLine_30f-SketchLine_22f-SketchLine_21r-SketchLine_20f-SketchLine_19r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_31f-SketchLine_32f-SketchLine_33f-SketchLine_39f-SketchLine_45f-SketchLine_37f-SketchLine_36r-SketchLine_35f-SketchLine_34r", + ), +] +Extrusion_1 = model.addExtrusion( + Part_1_doc, Extrusion_1_objects, model.selection(), 10, 0 +) model.do() model.end() @@ -258,4 +681,4 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [54, 54, 54]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [108, 108, 108]) model.testResultsVolumes(Extrusion_1, [REF_VOLUME, REF_VOLUME, REF_VOLUME]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintAngle_v20191210_2.py b/src/SketchPlugin/Test/TestConstraintAngle_v20191210_2.py index 4c18e927f..50f545e18 100644 --- a/src/SketchPlugin/Test/TestConstraintAngle_v20191210_2.py +++ b/src/SketchPlugin/Test/TestConstraintAngle_v20191210_2.py @@ -26,223 +26,646 @@ Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "Ang", "140") model.addParameter(Part_1_doc, "dAng", "5") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(-17.48270627886662, -77.57247534383079, 0.4653113240225388, -68.74815303974528) -SketchLine_2 = Sketch_1.addLine(0.4653113240225388, -68.74815303974528, 8.542125432770632, -50.45156664083665) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(8.542125432770632, -50.45156664083665, -8.178735979228234, 7.171456480488104) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-17.48270627886662, -77.57247534383079, -36.90385046950819, -72.79553507559329) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(-48.71075203912585, -56.65251567631857, -36.90385046950819, -72.79553507559329) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.endPoint()) -SketchLine_6 = Sketch_1.addLine(-48.71075203912585, -56.65251567631857, -47.37883052420096, -36.69691533260352) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_6.startPoint()) -SketchLine_7 = Sketch_1.addLine(-30.39232801419296, -18.99499937550162, -47.37883052420096, -36.69691533260352) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.endPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_2.result(), "Ang", type = "Direct") -SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_2.result(), "Ang", type = "Direct") -SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_4.result(), "Ang", type = "Direct") -SketchConstraintAngle_4 = Sketch_1.setAngle(SketchLine_6.result(), SketchLine_5.result(), "Ang", type = "Direct") -SketchConstraintAngle_5 = Sketch_1.setAngle(SketchLine_5.result(), SketchLine_4.result(), "Ang", type = "Direct") -SketchConstraintAngle_6 = Sketch_1.setAngle(SketchLine_6.result(), SketchLine_7.result(), "Ang", type = "Direct") +SketchLine_1 = Sketch_1.addLine( + -17.48270627886662, -77.57247534383079, 0.4653113240225388, -68.74815303974528 +) +SketchLine_2 = Sketch_1.addLine( + 0.4653113240225388, -68.74815303974528, 8.542125432770632, -50.45156664083665 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 8.542125432770632, -50.45156664083665, -8.178735979228234, 7.171456480488104 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -17.48270627886662, -77.57247534383079, -36.90385046950819, -72.79553507559329 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + -48.71075203912585, -56.65251567631857, -36.90385046950819, -72.79553507559329 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.endPoint() +) +SketchLine_6 = Sketch_1.addLine( + -48.71075203912585, -56.65251567631857, -47.37883052420096, -36.69691533260352 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_6.startPoint() +) +SketchLine_7 = Sketch_1.addLine( + -30.39232801419296, -18.99499937550162, -47.37883052420096, -36.69691533260352 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.endPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_2.result(), "Ang", type="Direct" +) +SketchConstraintAngle_2 = Sketch_1.setAngle( + SketchLine_3.result(), SketchLine_2.result(), "Ang", type="Direct" +) +SketchConstraintAngle_3 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_4.result(), "Ang", type="Direct" +) +SketchConstraintAngle_4 = Sketch_1.setAngle( + SketchLine_6.result(), SketchLine_5.result(), "Ang", type="Direct" +) +SketchConstraintAngle_5 = Sketch_1.setAngle( + SketchLine_5.result(), SketchLine_4.result(), "Ang", type="Direct" +) +SketchConstraintAngle_6 = Sketch_1.setAngle( + SketchLine_6.result(), SketchLine_7.result(), "Ang", type="Direct" +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 20) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_4.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_5.result()) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_6.result()) -SketchLine_8 = Sketch_1.addLine(14.775406531722, -47.38691166633646, -20.64529817713098, 1.042146531487715) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_1.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_4.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_5.result() +) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_6.result() +) +SketchLine_8 = Sketch_1.addLine( + 14.775406531722, -47.38691166633646, -20.64529817713098, 1.042146531487715 +) SketchPoint_1 = Sketch_1.addPoint(2.968504962104344, -31.24389226706174) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_3.result()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_8.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.endPoint(), SketchPoint_1.coordinates(), 20, True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_8.startPoint(), SketchPoint_1.coordinates(), 20, True) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_3.endPoint(), 40, True) -SketchConstraintEqual_5 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_8.result()) -SketchLine_9 = Sketch_1.addLine(19.58460105006861, -42.37517030669127, -30.26368721382418, -8.981336187802668) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_9.result()) -SketchConstraintEqual_6 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_9.result()) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_9.startPoint(), SketchPoint_1.coordinates(), 20, True) -SketchConstraintAngle_7 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_8.result(), "(180-Ang)/2", type = "Direct") -SketchConstraintAngle_8 = Sketch_1.setAngle(SketchLine_9.result(), SketchLine_8.result(), "(180-Ang)/2", type = "Direct") -SketchLine_10 = Sketch_1.addLine(3.875430505227681, -29.75334619738324, -48.69363438803513, -0.8311502875301234) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_3.result() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_8.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_2.endPoint(), SketchPoint_1.coordinates(), 20, True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_8.startPoint(), SketchPoint_1.coordinates(), 20, True +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchPoint_1.coordinates(), SketchLine_3.endPoint(), 40, True +) +SketchConstraintEqual_5 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_8.result() +) +SketchLine_9 = Sketch_1.addLine( + 19.58460105006861, -42.37517030669127, -30.26368721382418, -8.981336187802668 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_9.result() +) +SketchConstraintEqual_6 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_9.result() +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_9.startPoint(), SketchPoint_1.coordinates(), 20, True +) +SketchConstraintAngle_7 = Sketch_1.setAngle( + SketchLine_3.result(), SketchLine_8.result(), "(180-Ang)/2", type="Direct" +) +SketchConstraintAngle_8 = Sketch_1.setAngle( + SketchLine_9.result(), SketchLine_8.result(), "(180-Ang)/2", type="Direct" +) +SketchLine_10 = Sketch_1.addLine( + 3.875430505227681, -29.75334619738324, -48.69363438803513, -0.8311502875301234 +) SketchPoint_2 = Sketch_1.addPoint(-13.64759112585992, -20.1126142274322) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_10.result()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_9.result()) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_10.startPoint(), 20, True) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_9.endPoint(), 20, True) -SketchConstraintEqual_7 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_10.result()) -SketchLine_11 = Sketch_1.addLine(0.001529676402264532, -26.13785899518266, -31.94417752476854, -12.03580011868412) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_11.result()) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_11.endPoint(), SketchPoint_2.coordinates(), 20, True) -SketchConstraintAngle_9 = Sketch_1.setAngle(SketchLine_9.result(), SketchLine_10.result(), "180-dAng", type = "Direct") -SketchConstraintAngle_10 = Sketch_1.setAngle(SketchLine_11.result(), SketchLine_10.result(), "dAng", type = "Direct") -SketchLine_12 = Sketch_1.addLine(5.283311970593094, -26.56404104269606, -51.50939731876596, -7.20976059690448) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_12.result()) -SketchConstraintEqual_8 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_12.result()) -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_12.startPoint(), 20, True) -SketchConstraintAngle_11 = Sketch_1.setAngle(SketchLine_12.result(), SketchLine_11.result(), "dAng", type = "Direct") -SketchLine_13 = Sketch_1.addLine(25.19469725542325, -29.66649476390714, -33.06873531650151, -15.33567395919474) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_13.result()) -SketchConstraintEqual_9 = Sketch_1.setEqual(SketchLine_12.result(), SketchLine_13.result()) -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_13.endPoint(), SketchPoint_2.coordinates(), 20, True) -SketchConstraintAngle_12 = Sketch_1.setAngle(SketchLine_12.result(), SketchLine_13.result(), "180-dAng", type = "Direct") -SketchLine_14 = Sketch_1.addLine(25.87956617560386, -26.24481087018098, -33.41116977659181, -17.04651590605781) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_14.result()) -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchLine_14.endPoint(), SketchPoint_2.coordinates(), 20, True) -SketchConstraintAngle_13 = Sketch_1.setAngle(SketchLine_13.result(), SketchLine_14.result(), "dAng", type = "Direct") -SketchConstraintEqual_10 = Sketch_1.setEqual(SketchLine_13.result(), SketchLine_14.result()) -SketchLine_15 = Sketch_1.addLine(26.26360956157018, -22.77645725728195, -33.60319146957497, -18.78069271250733) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_15.result()) -SketchConstraintEqual_11 = Sketch_1.setEqual(SketchLine_14.result(), SketchLine_15.result()) -SketchConstraintDistance_11 = Sketch_1.setDistance(SketchLine_15.endPoint(), SketchPoint_2.coordinates(), 20, True) -SketchConstraintAngle_14 = Sketch_1.setAngle(SketchLine_15.result(), SketchLine_14.result(), "dAng", type = "Direct") -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchLine_15.result()) -SketchLine_16 = Sketch_1.addLine(60.00388909712782, -76.09960829009104, 78.00643494689578, -67.38706888260469) -SketchLine_17 = Sketch_1.addLine(78.00643494689578, -67.38706888260469, 86.19687277706721, -49.141063069) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) -SketchLine_18 = Sketch_1.addLine(86.19687277706721, -49.141063069, 69.83467154684908, 8.584826884311665) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) -SketchLine_19 = Sketch_1.addLine(60.00388909712782, -76.09960829009104, 40.61282650688053, -71.20198727360641) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_16.startPoint(), SketchLine_19.startPoint()) -SketchLine_20 = Sketch_1.addLine(28.90654086978602, -54.98585713775849, 40.61282650688053, -71.20198727360641) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.endPoint()) -SketchLine_21 = Sketch_1.addLine(28.90654086978602, -54.98585713775849, 30.36253333631381, -35.03892539532215) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_20.startPoint(), SketchLine_21.startPoint()) -SketchLine_22 = Sketch_1.addLine(47.45878924889096, -17.44298467461911, 30.36253333631381, -35.03892539532215) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchLine_22.endPoint()) -SketchConstraintAngle_15 = Sketch_1.setAngle(SketchLine_16.result(), SketchLine_17.result(), "180-Ang", type = "Supplementary") -SketchConstraintAngle_16 = Sketch_1.setAngle(SketchLine_18.result(), SketchLine_17.result(), "180-Ang", type = "Supplementary") -SketchConstraintAngle_17 = Sketch_1.setAngle(SketchLine_16.result(), SketchLine_19.result(), "180-Ang", type = "Supplementary") -SketchConstraintAngle_18 = Sketch_1.setAngle(SketchLine_21.result(), SketchLine_20.result(), "180-Ang", type = "Supplementary") -SketchConstraintAngle_19 = Sketch_1.setAngle(SketchLine_20.result(), SketchLine_19.result(), "180-Ang", type = "Supplementary") -SketchConstraintAngle_20 = Sketch_1.setAngle(SketchLine_21.result(), SketchLine_22.result(), "180-Ang", type = "Supplementary") +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_10.result() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_9.result() +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchPoint_2.coordinates(), SketchLine_10.startPoint(), 20, True +) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchPoint_2.coordinates(), SketchLine_9.endPoint(), 20, True +) +SketchConstraintEqual_7 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_10.result() +) +SketchLine_11 = Sketch_1.addLine( + 0.001529676402264532, -26.13785899518266, -31.94417752476854, -12.03580011868412 +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_11.result() +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchLine_11.endPoint(), SketchPoint_2.coordinates(), 20, True +) +SketchConstraintAngle_9 = Sketch_1.setAngle( + SketchLine_9.result(), SketchLine_10.result(), "180-dAng", type="Direct" +) +SketchConstraintAngle_10 = Sketch_1.setAngle( + SketchLine_11.result(), SketchLine_10.result(), "dAng", type="Direct" +) +SketchLine_12 = Sketch_1.addLine( + 5.283311970593094, -26.56404104269606, -51.50939731876596, -7.20976059690448 +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_12.result() +) +SketchConstraintEqual_8 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_12.result() +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchPoint_2.coordinates(), SketchLine_12.startPoint(), 20, True +) +SketchConstraintAngle_11 = Sketch_1.setAngle( + SketchLine_12.result(), SketchLine_11.result(), "dAng", type="Direct" +) +SketchLine_13 = Sketch_1.addLine( + 25.19469725542325, -29.66649476390714, -33.06873531650151, -15.33567395919474 +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_13.result() +) +SketchConstraintEqual_9 = Sketch_1.setEqual( + SketchLine_12.result(), SketchLine_13.result() +) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_13.endPoint(), SketchPoint_2.coordinates(), 20, True +) +SketchConstraintAngle_12 = Sketch_1.setAngle( + SketchLine_12.result(), SketchLine_13.result(), "180-dAng", type="Direct" +) +SketchLine_14 = Sketch_1.addLine( + 25.87956617560386, -26.24481087018098, -33.41116977659181, -17.04651590605781 +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_14.result() +) +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchLine_14.endPoint(), SketchPoint_2.coordinates(), 20, True +) +SketchConstraintAngle_13 = Sketch_1.setAngle( + SketchLine_13.result(), SketchLine_14.result(), "dAng", type="Direct" +) +SketchConstraintEqual_10 = Sketch_1.setEqual( + SketchLine_13.result(), SketchLine_14.result() +) +SketchLine_15 = Sketch_1.addLine( + 26.26360956157018, -22.77645725728195, -33.60319146957497, -18.78069271250733 +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_15.result() +) +SketchConstraintEqual_11 = Sketch_1.setEqual( + SketchLine_14.result(), SketchLine_15.result() +) +SketchConstraintDistance_11 = Sketch_1.setDistance( + SketchLine_15.endPoint(), SketchPoint_2.coordinates(), 20, True +) +SketchConstraintAngle_14 = Sketch_1.setAngle( + SketchLine_15.result(), SketchLine_14.result(), "dAng", type="Direct" +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchLine_15.result() +) +SketchLine_16 = Sketch_1.addLine( + 60.00388909712782, -76.09960829009104, 78.00643494689578, -67.38706888260469 +) +SketchLine_17 = Sketch_1.addLine( + 78.00643494689578, -67.38706888260469, 86.19687277706721, -49.141063069 +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) +SketchLine_18 = Sketch_1.addLine( + 86.19687277706721, -49.141063069, 69.83467154684908, 8.584826884311665 +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) +SketchLine_19 = Sketch_1.addLine( + 60.00388909712782, -76.09960829009104, 40.61282650688053, -71.20198727360641 +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_16.startPoint(), SketchLine_19.startPoint() +) +SketchLine_20 = Sketch_1.addLine( + 28.90654086978602, -54.98585713775849, 40.61282650688053, -71.20198727360641 +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.endPoint() +) +SketchLine_21 = Sketch_1.addLine( + 28.90654086978602, -54.98585713775849, 30.36253333631381, -35.03892539532215 +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_20.startPoint(), SketchLine_21.startPoint() +) +SketchLine_22 = Sketch_1.addLine( + 47.45878924889096, -17.44298467461911, 30.36253333631381, -35.03892539532215 +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchLine_22.endPoint() +) +SketchConstraintAngle_15 = Sketch_1.setAngle( + SketchLine_16.result(), SketchLine_17.result(), "180-Ang", type="Supplementary" +) +SketchConstraintAngle_16 = Sketch_1.setAngle( + SketchLine_18.result(), SketchLine_17.result(), "180-Ang", type="Supplementary" +) +SketchConstraintAngle_17 = Sketch_1.setAngle( + SketchLine_16.result(), SketchLine_19.result(), "180-Ang", type="Supplementary" +) +SketchConstraintAngle_18 = Sketch_1.setAngle( + SketchLine_21.result(), SketchLine_20.result(), "180-Ang", type="Supplementary" +) +SketchConstraintAngle_19 = Sketch_1.setAngle( + SketchLine_20.result(), SketchLine_19.result(), "180-Ang", type="Supplementary" +) +SketchConstraintAngle_20 = Sketch_1.setAngle( + SketchLine_21.result(), SketchLine_22.result(), "180-Ang", type="Supplementary" +) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_17.result(), 20) -SketchConstraintEqual_12 = Sketch_1.setEqual(SketchLine_17.result(), SketchLine_16.result()) -SketchConstraintEqual_13 = Sketch_1.setEqual(SketchLine_17.result(), SketchLine_19.result()) -SketchConstraintEqual_14 = Sketch_1.setEqual(SketchLine_17.result(), SketchLine_20.result()) -SketchConstraintEqual_15 = Sketch_1.setEqual(SketchLine_17.result(), SketchLine_21.result()) -SketchLine_23 = Sketch_1.addLine(92.44909133742235, -46.11522988707736, 57.3302344261388, 2.533160520466375) +SketchConstraintEqual_12 = Sketch_1.setEqual( + SketchLine_17.result(), SketchLine_16.result() +) +SketchConstraintEqual_13 = Sketch_1.setEqual( + SketchLine_17.result(), SketchLine_19.result() +) +SketchConstraintEqual_14 = Sketch_1.setEqual( + SketchLine_17.result(), SketchLine_20.result() +) +SketchConstraintEqual_15 = Sketch_1.setEqual( + SketchLine_17.result(), SketchLine_21.result() +) +SketchLine_23 = Sketch_1.addLine( + 92.44909133742235, -46.11522988707736, 57.3302344261388, 2.533160520466375 +) SketchPoint_3 = Sketch_1.addPoint(80.74280570032784, -29.89909975122945) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_18.result()) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_23.result()) -SketchConstraintDistance_12 = Sketch_1.setDistance(SketchLine_17.endPoint(), SketchPoint_3.coordinates(), 20, True) -SketchConstraintDistance_13 = Sketch_1.setDistance(SketchLine_23.startPoint(), SketchPoint_3.coordinates(), 20, True) -SketchConstraintDistance_14 = Sketch_1.setDistance(SketchPoint_3.coordinates(), SketchLine_18.endPoint(), 40, True) -SketchConstraintEqual_16 = Sketch_1.setEqual(SketchLine_18.result(), SketchLine_23.result()) -SketchLine_24 = Sketch_1.addLine(97.289359083568, -41.13349208617944, 47.64969893384747, -7.430315081329468) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_24.result()) -SketchConstraintEqual_17 = Sketch_1.setEqual(SketchLine_18.result(), SketchLine_24.result()) -SketchConstraintDistance_15 = Sketch_1.setDistance(SketchLine_24.startPoint(), SketchPoint_3.coordinates(), 20, True) -SketchConstraintAngle_21 = Sketch_1.setAngle(SketchLine_18.result(), SketchLine_23.result(), "90+Ang/2", type = "Supplementary") -SketchConstraintAngle_22 = Sketch_1.setAngle(SketchLine_24.result(), SketchLine_23.result(), "90+Ang/2", type = "Supplementary") -SketchLine_25 = Sketch_1.addLine(81.65898287743471, -28.41422234660911, 29.27079119639352, 0.8343224443798635) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_18.result() +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_23.result() +) +SketchConstraintDistance_12 = Sketch_1.setDistance( + SketchLine_17.endPoint(), SketchPoint_3.coordinates(), 20, True +) +SketchConstraintDistance_13 = Sketch_1.setDistance( + SketchLine_23.startPoint(), SketchPoint_3.coordinates(), 20, True +) +SketchConstraintDistance_14 = Sketch_1.setDistance( + SketchPoint_3.coordinates(), SketchLine_18.endPoint(), 40, True +) +SketchConstraintEqual_16 = Sketch_1.setEqual( + SketchLine_18.result(), SketchLine_23.result() +) +SketchLine_24 = Sketch_1.addLine( + 97.289359083568, -41.13349208617944, 47.64969893384747, -7.430315081329468 +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchLine_24.result() +) +SketchConstraintEqual_17 = Sketch_1.setEqual( + SketchLine_18.result(), SketchLine_24.result() +) +SketchConstraintDistance_15 = Sketch_1.setDistance( + SketchLine_24.startPoint(), SketchPoint_3.coordinates(), 20, True +) +SketchConstraintAngle_21 = Sketch_1.setAngle( + SketchLine_18.result(), SketchLine_23.result(), "90+Ang/2", type="Supplementary" +) +SketchConstraintAngle_22 = Sketch_1.setAngle( + SketchLine_24.result(), SketchLine_23.result(), "90+Ang/2", type="Supplementary" +) +SketchLine_25 = Sketch_1.addLine( + 81.65898287743471, -28.41422234660911, 29.27079119639352, 0.8343224443798635 +) SketchPoint_4 = Sketch_1.addPoint(64.19625231708766, -18.66470741627946) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_25.result()) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_24.result()) -SketchConstraintDistance_16 = Sketch_1.setDistance(SketchPoint_4.coordinates(), SketchLine_25.startPoint(), 20, True) -SketchConstraintDistance_17 = Sketch_1.setDistance(SketchPoint_4.coordinates(), SketchLine_24.endPoint(), 20, True) -SketchConstraintEqual_18 = Sketch_1.setEqual(SketchLine_24.result(), SketchLine_25.result()) -SketchLine_26 = Sketch_1.addLine(95.51651619313817, -32.72404055044315, 45.95024650348294, -10.47426958610802) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_26.result()) -SketchConstraintDistance_18 = Sketch_1.setDistance(SketchLine_26.endPoint(), SketchPoint_4.coordinates(), 20, True) -SketchConstraintAngle_23 = Sketch_1.setAngle(SketchLine_24.result(), SketchLine_25.result(), "dAng", type = "Supplementary") -SketchConstraintAngle_24 = Sketch_1.setAngle(SketchLine_26.result(), SketchLine_25.result(), "dAng", type = "Supplementary") -SketchLine_27 = Sketch_1.addLine(83.08667026246893, -25.23373396888348, 26.41541642632507, -5.526654311071399) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_27.result()) -SketchConstraintEqual_19 = Sketch_1.setEqual(SketchLine_24.result(), SketchLine_27.result()) -SketchConstraintDistance_19 = Sketch_1.setDistance(SketchPoint_4.coordinates(), SketchLine_27.startPoint(), 20, True) -SketchConstraintAngle_25 = Sketch_1.setAngle(SketchLine_27.result(), SketchLine_26.result(), "dAng", type = "Supplementary") -SketchLine_28 = Sketch_1.addLine(102.9783774975822, -28.45994944924871, 44.80518972684035, -13.76708639979482) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_28.result()) -SketchConstraintEqual_20 = Sketch_1.setEqual(SketchLine_27.result(), SketchLine_28.result()) -SketchConstraintDistance_20 = Sketch_1.setDistance(SketchLine_28.endPoint(), SketchPoint_4.coordinates(), 20, True) -SketchConstraintAngle_26 = Sketch_1.setAngle(SketchLine_27.result(), SketchLine_28.result(), "dAng", type = "Supplementary") -SketchLine_29 = Sketch_1.addLine(103.6845113974033, -25.04259067061018, 44.45212277692985, -15.47576578911409) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_29.result()) -SketchConstraintDistance_21 = Sketch_1.setDistance(SketchLine_29.endPoint(), SketchPoint_4.coordinates(), 20, True) -SketchConstraintAngle_27 = Sketch_1.setAngle(SketchLine_28.result(), SketchLine_29.result(), "180-dAng", type = "Supplementary") -SketchConstraintEqual_21 = Sketch_1.setEqual(SketchLine_28.result(), SketchLine_29.result()) -SketchLine_30 = Sketch_1.addLine(104.0901158019603, -21.57669234933498, 44.24932057465131, -17.20871494975169) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_30.result()) -SketchConstraintEqual_22 = Sketch_1.setEqual(SketchLine_29.result(), SketchLine_30.result()) -SketchConstraintDistance_22 = Sketch_1.setDistance(SketchLine_30.endPoint(), SketchPoint_4.coordinates(), 20, True) -SketchConstraintAngle_28 = Sketch_1.setAngle(SketchLine_30.result(), SketchLine_29.result(), "180-dAng", type = "Supplementary") -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchLine_22.startPoint(), SketchLine_30.result()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_25.result() +) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_24.result() +) +SketchConstraintDistance_16 = Sketch_1.setDistance( + SketchPoint_4.coordinates(), SketchLine_25.startPoint(), 20, True +) +SketchConstraintDistance_17 = Sketch_1.setDistance( + SketchPoint_4.coordinates(), SketchLine_24.endPoint(), 20, True +) +SketchConstraintEqual_18 = Sketch_1.setEqual( + SketchLine_24.result(), SketchLine_25.result() +) +SketchLine_26 = Sketch_1.addLine( + 95.51651619313817, -32.72404055044315, 45.95024650348294, -10.47426958610802 +) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_26.result() +) +SketchConstraintDistance_18 = Sketch_1.setDistance( + SketchLine_26.endPoint(), SketchPoint_4.coordinates(), 20, True +) +SketchConstraintAngle_23 = Sketch_1.setAngle( + SketchLine_24.result(), SketchLine_25.result(), "dAng", type="Supplementary" +) +SketchConstraintAngle_24 = Sketch_1.setAngle( + SketchLine_26.result(), SketchLine_25.result(), "dAng", type="Supplementary" +) +SketchLine_27 = Sketch_1.addLine( + 83.08667026246893, -25.23373396888348, 26.41541642632507, -5.526654311071399 +) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_27.result() +) +SketchConstraintEqual_19 = Sketch_1.setEqual( + SketchLine_24.result(), SketchLine_27.result() +) +SketchConstraintDistance_19 = Sketch_1.setDistance( + SketchPoint_4.coordinates(), SketchLine_27.startPoint(), 20, True +) +SketchConstraintAngle_25 = Sketch_1.setAngle( + SketchLine_27.result(), SketchLine_26.result(), "dAng", type="Supplementary" +) +SketchLine_28 = Sketch_1.addLine( + 102.9783774975822, -28.45994944924871, 44.80518972684035, -13.76708639979482 +) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_28.result() +) +SketchConstraintEqual_20 = Sketch_1.setEqual( + SketchLine_27.result(), SketchLine_28.result() +) +SketchConstraintDistance_20 = Sketch_1.setDistance( + SketchLine_28.endPoint(), SketchPoint_4.coordinates(), 20, True +) +SketchConstraintAngle_26 = Sketch_1.setAngle( + SketchLine_27.result(), SketchLine_28.result(), "dAng", type="Supplementary" +) +SketchLine_29 = Sketch_1.addLine( + 103.6845113974033, -25.04259067061018, 44.45212277692985, -15.47576578911409 +) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_29.result() +) +SketchConstraintDistance_21 = Sketch_1.setDistance( + SketchLine_29.endPoint(), SketchPoint_4.coordinates(), 20, True +) +SketchConstraintAngle_27 = Sketch_1.setAngle( + SketchLine_28.result(), SketchLine_29.result(), "180-dAng", type="Supplementary" +) +SketchConstraintEqual_21 = Sketch_1.setEqual( + SketchLine_28.result(), SketchLine_29.result() +) +SketchLine_30 = Sketch_1.addLine( + 104.0901158019603, -21.57669234933498, 44.24932057465131, -17.20871494975169 +) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchPoint_4.coordinates(), SketchLine_30.result() +) +SketchConstraintEqual_22 = Sketch_1.setEqual( + SketchLine_29.result(), SketchLine_30.result() +) +SketchConstraintDistance_22 = Sketch_1.setDistance( + SketchLine_30.endPoint(), SketchPoint_4.coordinates(), 20, True +) +SketchConstraintAngle_28 = Sketch_1.setAngle( + SketchLine_30.result(), SketchLine_29.result(), "180-dAng", type="Supplementary" +) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchLine_22.startPoint(), SketchLine_30.result() +) -SketchLine_31 = Sketch_1.addLine(138.7804692087479, -78.2421341225341, 156.7284871354776, -69.4178124771163) -SketchLine_32 = Sketch_1.addLine(156.7284871354776, -69.4178124771163, 164.8053019156854, -51.12122637461573) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) -SketchLine_33 = Sketch_1.addLine(164.8053019156854, -51.12122637461573, 148.0844426183728, 6.501797360341752) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint()) -SketchLine_34 = Sketch_1.addLine(138.7804692087479, -78.2421341225341, 119.3593251934135, -73.46519314156717) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchLine_31.startPoint(), SketchLine_34.startPoint()) -SketchLine_35 = Sketch_1.addLine(107.5524242162226, -57.32217330899532, 119.3593251934135, -73.46519314156717) -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchLine_34.endPoint(), SketchLine_35.endPoint()) -SketchLine_36 = Sketch_1.addLine(107.5524242162226, -57.32217330899532, 108.8843464634908, -37.36657301415998) -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_35.startPoint(), SketchLine_36.startPoint()) -SketchLine_37 = Sketch_1.addLine(125.8708496231354, -19.66465768043951, 108.8843464634908, -37.36657301415998) -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchLine_36.endPoint(), SketchLine_37.endPoint()) -SketchConstraintAngle_29 = Sketch_1.setAngle(SketchLine_31.result(), SketchLine_32.result(), "360-Ang", type = "Backward") -SketchConstraintAngle_30 = Sketch_1.setAngle(SketchLine_33.result(), SketchLine_32.result(), "360-Ang", type = "Backward") -SketchConstraintAngle_31 = Sketch_1.setAngle(SketchLine_31.result(), SketchLine_34.result(), "360-Ang", type = "Backward") -SketchConstraintAngle_32 = Sketch_1.setAngle(SketchLine_36.result(), SketchLine_35.result(), "360-Ang", type = "Backward") -SketchConstraintAngle_33 = Sketch_1.setAngle(SketchLine_35.result(), SketchLine_34.result(), "360-Ang", type = "Backward") -SketchConstraintAngle_34 = Sketch_1.setAngle(SketchLine_36.result(), SketchLine_37.result(), "360-Ang", type = "Backward") +SketchLine_31 = Sketch_1.addLine( + 138.7804692087479, -78.2421341225341, 156.7284871354776, -69.4178124771163 +) +SketchLine_32 = Sketch_1.addLine( + 156.7284871354776, -69.4178124771163, 164.8053019156854, -51.12122637461573 +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchLine_31.endPoint(), SketchLine_32.startPoint() +) +SketchLine_33 = Sketch_1.addLine( + 164.8053019156854, -51.12122637461573, 148.0844426183728, 6.501797360341752 +) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchLine_32.endPoint(), SketchLine_33.startPoint() +) +SketchLine_34 = Sketch_1.addLine( + 138.7804692087479, -78.2421341225341, 119.3593251934135, -73.46519314156717 +) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchLine_31.startPoint(), SketchLine_34.startPoint() +) +SketchLine_35 = Sketch_1.addLine( + 107.5524242162226, -57.32217330899532, 119.3593251934135, -73.46519314156717 +) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchLine_34.endPoint(), SketchLine_35.endPoint() +) +SketchLine_36 = Sketch_1.addLine( + 107.5524242162226, -57.32217330899532, 108.8843464634908, -37.36657301415998 +) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchLine_35.startPoint(), SketchLine_36.startPoint() +) +SketchLine_37 = Sketch_1.addLine( + 125.8708496231354, -19.66465768043951, 108.8843464634908, -37.36657301415998 +) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchLine_36.endPoint(), SketchLine_37.endPoint() +) +SketchConstraintAngle_29 = Sketch_1.setAngle( + SketchLine_31.result(), SketchLine_32.result(), "360-Ang", type="Backward" +) +SketchConstraintAngle_30 = Sketch_1.setAngle( + SketchLine_33.result(), SketchLine_32.result(), "360-Ang", type="Backward" +) +SketchConstraintAngle_31 = Sketch_1.setAngle( + SketchLine_31.result(), SketchLine_34.result(), "360-Ang", type="Backward" +) +SketchConstraintAngle_32 = Sketch_1.setAngle( + SketchLine_36.result(), SketchLine_35.result(), "360-Ang", type="Backward" +) +SketchConstraintAngle_33 = Sketch_1.setAngle( + SketchLine_35.result(), SketchLine_34.result(), "360-Ang", type="Backward" +) +SketchConstraintAngle_34 = Sketch_1.setAngle( + SketchLine_36.result(), SketchLine_37.result(), "360-Ang", type="Backward" +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_32.result(), 20) -SketchConstraintEqual_23 = Sketch_1.setEqual(SketchLine_32.result(), SketchLine_31.result()) -SketchConstraintEqual_24 = Sketch_1.setEqual(SketchLine_32.result(), SketchLine_34.result()) -SketchConstraintEqual_25 = Sketch_1.setEqual(SketchLine_32.result(), SketchLine_35.result()) -SketchConstraintEqual_26 = Sketch_1.setEqual(SketchLine_32.result(), SketchLine_36.result()) -SketchLine_38 = Sketch_1.addLine(171.0385831271055, -48.05657162886843, 135.6178801955327, 0.3724878688471688) +SketchConstraintEqual_23 = Sketch_1.setEqual( + SketchLine_32.result(), SketchLine_31.result() +) +SketchConstraintEqual_24 = Sketch_1.setEqual( + SketchLine_32.result(), SketchLine_34.result() +) +SketchConstraintEqual_25 = Sketch_1.setEqual( + SketchLine_32.result(), SketchLine_35.result() +) +SketchConstraintEqual_26 = Sketch_1.setEqual( + SketchLine_32.result(), SketchLine_36.result() +) +SketchLine_38 = Sketch_1.addLine( + 171.0385831271055, -48.05657162886843, 135.6178801955327, 0.3724878688471688 +) SketchPoint_5 = Sketch_1.addPoint(159.2316821499145, -31.91355179629657) -SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_33.result()) -SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_38.result()) -SketchConstraintDistance_23 = Sketch_1.setDistance(SketchLine_32.endPoint(), SketchPoint_5.coordinates(), 20, True) -SketchConstraintDistance_24 = Sketch_1.setDistance(SketchLine_38.startPoint(), SketchPoint_5.coordinates(), 20, True) -SketchConstraintDistance_25 = Sketch_1.setDistance(SketchPoint_5.coordinates(), SketchLine_33.endPoint(), 40, True) -SketchConstraintEqual_27 = Sketch_1.setEqual(SketchLine_33.result(), SketchLine_38.result()) -SketchLine_39 = Sketch_1.addLine(175.8477778293761, -43.04483044571408, 125.9994907909914, -9.650994497461493) -SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_39.result()) -SketchConstraintEqual_28 = Sketch_1.setEqual(SketchLine_33.result(), SketchLine_39.result()) -SketchConstraintDistance_26 = Sketch_1.setDistance(SketchLine_39.startPoint(), SketchPoint_5.coordinates(), 20, True) -SketchConstraintAngle_35 = Sketch_1.setAngle(SketchLine_33.result(), SketchLine_38.result(), "360-(180-Ang)/2", type = "Backward") -SketchConstraintAngle_36 = Sketch_1.setAngle(SketchLine_39.result(), SketchLine_38.result(), "360-(180-Ang)/2", type = "Backward") -SketchLine_40 = Sketch_1.addLine(160.1386077477389, -30.42300575990098, 107.5695439158812, -1.500807920835093) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident( + SketchPoint_5.coordinates(), SketchLine_33.result() +) +SketchConstraintCoincidence_42 = Sketch_1.setCoincident( + SketchPoint_5.coordinates(), SketchLine_38.result() +) +SketchConstraintDistance_23 = Sketch_1.setDistance( + SketchLine_32.endPoint(), SketchPoint_5.coordinates(), 20, True +) +SketchConstraintDistance_24 = Sketch_1.setDistance( + SketchLine_38.startPoint(), SketchPoint_5.coordinates(), 20, True +) +SketchConstraintDistance_25 = Sketch_1.setDistance( + SketchPoint_5.coordinates(), SketchLine_33.endPoint(), 40, True +) +SketchConstraintEqual_27 = Sketch_1.setEqual( + SketchLine_33.result(), SketchLine_38.result() +) +SketchLine_39 = Sketch_1.addLine( + 175.8477778293761, -43.04483044571408, 125.9994907909914, -9.650994497461493 +) +SketchConstraintCoincidence_43 = Sketch_1.setCoincident( + SketchPoint_5.coordinates(), SketchLine_39.result() +) +SketchConstraintEqual_28 = Sketch_1.setEqual( + SketchLine_33.result(), SketchLine_39.result() +) +SketchConstraintDistance_26 = Sketch_1.setDistance( + SketchLine_39.startPoint(), SketchPoint_5.coordinates(), 20, True +) +SketchConstraintAngle_35 = Sketch_1.setAngle( + SketchLine_33.result(), SketchLine_38.result(), "360-(180-Ang)/2", type="Backward" +) +SketchConstraintAngle_36 = Sketch_1.setAngle( + SketchLine_39.result(), SketchLine_38.result(), "360-(180-Ang)/2", type="Backward" +) +SketchLine_40 = Sketch_1.addLine( + 160.1386077477389, -30.42300575990098, 107.5695439158812, -1.500807920835093 +) SketchPoint_6 = Sketch_1.addPoint(142.615586470453, -20.78227314687903) -SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_40.result()) -SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_39.result()) -SketchConstraintDistance_27 = Sketch_1.setDistance(SketchPoint_6.coordinates(), SketchLine_40.startPoint(), 20, True) -SketchConstraintDistance_28 = Sketch_1.setDistance(SketchPoint_6.coordinates(), SketchLine_39.endPoint(), 20, True) -SketchConstraintEqual_29 = Sketch_1.setEqual(SketchLine_39.result(), SketchLine_40.result()) -SketchLine_41 = Sketch_1.addLine(147.1612701207084, -22.78891223719074, 124.3190003679524, -12.70545836667124) -SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_41.result()) -SketchConstraintDistance_29 = Sketch_1.setDistance(SketchLine_41.endPoint(), SketchPoint_6.coordinates(), 20, True) -SketchConstraintAngle_37 = Sketch_1.setAngle(SketchLine_39.result(), SketchLine_40.result(), "180+dAng", type = "Backward") -SketchConstraintAngle_38 = Sketch_1.setAngle(SketchLine_41.result(), SketchLine_40.result(), "360-dAng", type = "Backward") -SketchLine_42 = Sketch_1.addLine(161.5464893301474, -27.23370065688114, 104.7537807510641, -7.879418126874779) -SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_42.result()) -SketchConstraintEqual_30 = Sketch_1.setEqual(SketchLine_39.result(), SketchLine_42.result()) -SketchConstraintDistance_30 = Sketch_1.setDistance(SketchPoint_6.coordinates(), SketchLine_42.startPoint(), 20, True) -SketchConstraintAngle_39 = Sketch_1.setAngle(SketchLine_42.result(), SketchLine_41.result(), "360-dAng", type = "Backward") -SketchLine_43 = Sketch_1.addLine(181.4578745011218, -30.33615510881286, 123.1944424551186, -16.0053321659121) -SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_43.result()) -SketchConstraintEqual_31 = Sketch_1.setEqual(SketchLine_42.result(), SketchLine_43.result()) -SketchConstraintDistance_31 = Sketch_1.setDistance(SketchLine_43.endPoint(), SketchPoint_6.coordinates(), 20, True) -SketchConstraintAngle_40 = Sketch_1.setAngle(SketchLine_42.result(), SketchLine_43.result(), "180+dAng", type = "Backward") -SketchLine_44 = Sketch_1.addLine(182.1427435468735, -26.91447124022047, 122.8520079322427, -17.71617410020831) -SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_44.result()) -SketchConstraintDistance_32 = Sketch_1.setDistance(SketchLine_44.endPoint(), SketchPoint_6.coordinates(), 20, True) -SketchConstraintAngle_41 = Sketch_1.setAngle(SketchLine_43.result(), SketchLine_44.result(), "360-dAng", type = "Backward") -SketchConstraintEqual_32 = Sketch_1.setEqual(SketchLine_43.result(), SketchLine_44.result()) -SketchLine_45 = Sketch_1.addLine(182.5267870601237, -23.44611764141531, 122.6599861756176, -19.45035089961089) -SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_45.result()) -SketchConstraintEqual_33 = Sketch_1.setEqual(SketchLine_44.result(), SketchLine_45.result()) -SketchConstraintDistance_33 = Sketch_1.setDistance(SketchLine_45.endPoint(), SketchPoint_6.coordinates(), 20, True) -SketchConstraintAngle_42 = Sketch_1.setAngle(SketchLine_45.result(), SketchLine_44.result(), "360-dAng", type = "Backward") -SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_37.startPoint(), SketchLine_45.result()) +SketchConstraintCoincidence_44 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_40.result() +) +SketchConstraintCoincidence_45 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_39.result() +) +SketchConstraintDistance_27 = Sketch_1.setDistance( + SketchPoint_6.coordinates(), SketchLine_40.startPoint(), 20, True +) +SketchConstraintDistance_28 = Sketch_1.setDistance( + SketchPoint_6.coordinates(), SketchLine_39.endPoint(), 20, True +) +SketchConstraintEqual_29 = Sketch_1.setEqual( + SketchLine_39.result(), SketchLine_40.result() +) +SketchLine_41 = Sketch_1.addLine( + 147.1612701207084, -22.78891223719074, 124.3190003679524, -12.70545836667124 +) +SketchConstraintCoincidence_46 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_41.result() +) +SketchConstraintDistance_29 = Sketch_1.setDistance( + SketchLine_41.endPoint(), SketchPoint_6.coordinates(), 20, True +) +SketchConstraintAngle_37 = Sketch_1.setAngle( + SketchLine_39.result(), SketchLine_40.result(), "180+dAng", type="Backward" +) +SketchConstraintAngle_38 = Sketch_1.setAngle( + SketchLine_41.result(), SketchLine_40.result(), "360-dAng", type="Backward" +) +SketchLine_42 = Sketch_1.addLine( + 161.5464893301474, -27.23370065688114, 104.7537807510641, -7.879418126874779 +) +SketchConstraintCoincidence_47 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_42.result() +) +SketchConstraintEqual_30 = Sketch_1.setEqual( + SketchLine_39.result(), SketchLine_42.result() +) +SketchConstraintDistance_30 = Sketch_1.setDistance( + SketchPoint_6.coordinates(), SketchLine_42.startPoint(), 20, True +) +SketchConstraintAngle_39 = Sketch_1.setAngle( + SketchLine_42.result(), SketchLine_41.result(), "360-dAng", type="Backward" +) +SketchLine_43 = Sketch_1.addLine( + 181.4578745011218, -30.33615510881286, 123.1944424551186, -16.0053321659121 +) +SketchConstraintCoincidence_48 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_43.result() +) +SketchConstraintEqual_31 = Sketch_1.setEqual( + SketchLine_42.result(), SketchLine_43.result() +) +SketchConstraintDistance_31 = Sketch_1.setDistance( + SketchLine_43.endPoint(), SketchPoint_6.coordinates(), 20, True +) +SketchConstraintAngle_40 = Sketch_1.setAngle( + SketchLine_42.result(), SketchLine_43.result(), "180+dAng", type="Backward" +) +SketchLine_44 = Sketch_1.addLine( + 182.1427435468735, -26.91447124022047, 122.8520079322427, -17.71617410020831 +) +SketchConstraintCoincidence_49 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_44.result() +) +SketchConstraintDistance_32 = Sketch_1.setDistance( + SketchLine_44.endPoint(), SketchPoint_6.coordinates(), 20, True +) +SketchConstraintAngle_41 = Sketch_1.setAngle( + SketchLine_43.result(), SketchLine_44.result(), "360-dAng", type="Backward" +) +SketchConstraintEqual_32 = Sketch_1.setEqual( + SketchLine_43.result(), SketchLine_44.result() +) +SketchLine_45 = Sketch_1.addLine( + 182.5267870601237, -23.44611764141531, 122.6599861756176, -19.45035089961089 +) +SketchConstraintCoincidence_50 = Sketch_1.setCoincident( + SketchPoint_6.coordinates(), SketchLine_45.result() +) +SketchConstraintEqual_33 = Sketch_1.setEqual( + SketchLine_44.result(), SketchLine_45.result() +) +SketchConstraintDistance_33 = Sketch_1.setDistance( + SketchLine_45.endPoint(), SketchPoint_6.coordinates(), 20, True +) +SketchConstraintAngle_42 = Sketch_1.setAngle( + SketchLine_45.result(), SketchLine_44.result(), "360-dAng", type="Backward" +) +SketchConstraintCoincidence_51 = Sketch_1.setCoincident( + SketchLine_37.startPoint(), SketchLine_45.result() +) model.do() -Extrusion_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_9f-SketchLine_15f-SketchLine_7f-SketchLine_6r-SketchLine_5f-SketchLine_4r"), model.selection("FACE", "Sketch_1/Face-SketchLine_16f-SketchLine_17f-SketchLine_18f-SketchLine_24f-SketchLine_30f-SketchLine_22f-SketchLine_21r-SketchLine_20f-SketchLine_19r"), model.selection("FACE", "Sketch_1/Face-SketchLine_31f-SketchLine_32f-SketchLine_33f-SketchLine_39f-SketchLine_45f-SketchLine_37f-SketchLine_36r-SketchLine_35f-SketchLine_34r")] -Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection(), 10, 0) +Extrusion_1_objects = [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_9f-SketchLine_15f-SketchLine_7f-SketchLine_6r-SketchLine_5f-SketchLine_4r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_16f-SketchLine_17f-SketchLine_18f-SketchLine_24f-SketchLine_30f-SketchLine_22f-SketchLine_21r-SketchLine_20f-SketchLine_19r", + ), + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_31f-SketchLine_32f-SketchLine_33f-SketchLine_39f-SketchLine_45f-SketchLine_37f-SketchLine_36r-SketchLine_35f-SketchLine_34r", + ), +] +Extrusion_1 = model.addExtrusion( + Part_1_doc, Extrusion_1_objects, model.selection(), 10, 0 +) model.do() model.end() @@ -259,4 +682,4 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [54, 54, 54]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [108, 108, 108]) model.testResultsVolumes(Extrusion_1, [REF_VOLUME, REF_VOLUME, REF_VOLUME]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintCoincidence.py b/src/SketchPlugin/Test/TestConstraintCoincidence.py index 23045c35a..7455776d8 100644 --- a/src/SketchPlugin/Test/TestConstraintCoincidence.py +++ b/src/SketchPlugin/Test/TestConstraintCoincidence.py @@ -40,55 +40,57 @@ from ModelAPI import * import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2014-10-28" -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -#========================================================================= +# ========================================================================= # Auxiliary functions -#========================================================================= +# ========================================================================= def checkPointOnLine(point, line): aStart = geomDataAPI_Point2D(line.attribute("StartPoint")) - aEnd = geomDataAPI_Point2D(line.attribute("EndPoint")) + aEnd = geomDataAPI_Point2D(line.attribute("EndPoint")) aDirX = aEnd.x() - aStart.x() aDirY = aEnd.y() - aStart.y() aVecX = point.x() - aStart.x() aVecY = point.y() - aStart.y() - assert (math.fabs(aDirX * aVecY - aDirY * aVecX) <= TOLERANCE) + assert math.fabs(aDirX * aVecY - aDirY * aVecX) <= TOLERANCE + def checkPointOnCircle(point, circle): aCenter = geomDataAPI_Point2D(circle.attribute("circle_center")) aRadius = circle.real("circle_radius").value() aDist = math.hypot(point.x() - aCenter.x(), point.y() - aCenter.y()) - assert (math.fabs(aDist - aRadius) <= TOLERANCE) + assert math.fabs(aDist - aRadius) <= TOLERANCE + def checkPointOnArc(point, arc): - aStart = geomDataAPI_Point2D(arc.attribute("start_point")) + aStart = geomDataAPI_Point2D(arc.attribute("start_point")) aCenter = geomDataAPI_Point2D(arc.attribute("center_point")) aRadius = math.hypot(aStart.x() - aCenter.x(), aStart.y() - aCenter.y()) aDist = math.hypot(point.x() - aCenter.x(), point.y() - aCenter.y()) - assert (math.fabs(aDist - aRadius) <= TOLERANCE) + assert math.fabs(aDist - aRadius) <= TOLERANCE -#========================================================================= +# ========================================================================= # Start of test -#========================================================================= +# ========================================================================= aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() # add an origin aSession.startOperation() aFeature = aDocument.addFeature("Point") -geomDataAPI_Point(aFeature.attribute("point3d")).setValue(0., 0., 0.) +geomDataAPI_Point(aFeature.attribute("point3d")).setValue(0.0, 0.0, 0.0) aFeature.string("creation_method").setValue("by_xyz") anOriginName = aFeature.name() aSession.finishOperation() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchFeature = featureToCompositeFeature(aDocument.addFeature("Sketch")) origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) @@ -98,28 +100,28 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create a line and an arc -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchArc = aSketchFeature.addFeature("SketchArc") anArcCentr = geomDataAPI_Point2D(aSketchArc.attribute("center_point")) anArcStartPoint = geomDataAPI_Point2D(aSketchArc.attribute("start_point")) anArcEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("end_point")) -anArcCentr.setValue(10., 10.) -anArcStartPoint.setValue(0., 50.) -anArcEndPoint.setValue(50., 0.) +anArcCentr.setValue(10.0, 10.0) +anArcStartPoint.setValue(0.0, 50.0) +anArcEndPoint.setValue(50.0, 0.0) aSketchLine = aSketchFeature.addFeature("SketchLine") aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) # Lets initialize line start at circle's end: -aLineStartPoint.setValue(50., 0.) -aLineEndPoint.setValue(100., 25.) +aLineStartPoint.setValue(50.0, 0.0) +aLineEndPoint.setValue(100.0, 25.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 9) -#========================================================================= +assert model.dof(aSketchFeature) == 9 +# ========================================================================= # Link arc's end and line's start points with concidence constraint -#========================================================================= +# ========================================================================= aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintCoincidence") reflistA = aConstraint.refattr("ConstraintEntityA") @@ -128,39 +130,39 @@ reflistA.setAttr(anArcEndPoint) reflistB.setAttr(aLineStartPoint) aConstraint.execute() aSession.finishOperation() -assert (model.dof(aSketchFeature) == 7) -#========================================================================= +assert model.dof(aSketchFeature) == 7 +# ========================================================================= # Check values and move one constrainted object -#========================================================================= -assert (anArcEndPoint.x() == aLineStartPoint.x()) -assert (anArcEndPoint.y() == aLineStartPoint.y()) -deltaX = deltaY = 40. +# ========================================================================= +assert anArcEndPoint.x() == aLineStartPoint.x() +assert anArcEndPoint.y() == aLineStartPoint.y() +deltaX = deltaY = 40.0 # move line aSession.startOperation() -aLineStartPoint.setValue(aLineStartPoint.x() + deltaX, - aLineStartPoint.y() + deltaY) -aLineEndPoint.setValue(aLineEndPoint.x() + deltaX, - aLineEndPoint.y() + deltaY) +aLineStartPoint.setValue(aLineStartPoint.x() + deltaX, aLineStartPoint.y() + deltaY) +aLineEndPoint.setValue(aLineEndPoint.x() + deltaX, aLineEndPoint.y() + deltaY) aSession.finishOperation() # check that arc's points are moved also -assert (anArcEndPoint.x() == aLineStartPoint.x()) -assert (anArcEndPoint.y() == aLineStartPoint.y()) -assert (model.dof(aSketchFeature) == 7) -#========================================================================= +assert anArcEndPoint.x() == aLineStartPoint.x() +assert anArcEndPoint.y() == aLineStartPoint.y() +assert model.dof(aSketchFeature) == 7 +# ========================================================================= # Remove coincidence and move the line -#========================================================================= +# ========================================================================= aSession.startOperation() aDocument.removeFeature(aConstraint) aSession.finishOperation() aSession.startOperation() -aLineStartPoint.setValue(70., 0.) +aLineStartPoint.setValue(70.0, 0.0) aSession.finishOperation() -assert (anArcEndPoint.x() != aLineStartPoint.x() or anArcEndPoint.y() != aLineStartPoint.y()) -assert (model.dof(aSketchFeature) == 9) +assert ( + anArcEndPoint.x() != aLineStartPoint.x() or anArcEndPoint.y() != aLineStartPoint.y() +) +assert model.dof(aSketchFeature) == 9 -#========================================================================= +# ========================================================================= # Add constraint point-on-line -#========================================================================= +# ========================================================================= aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintCoincidence") reflistA = aConstraint.refattr("ConstraintEntityA") @@ -170,31 +172,31 @@ reflistB.setObject(aSketchLine.lastResult()) aConstraint.execute() aSession.finishOperation() checkPointOnLine(anArcStartPoint, aSketchLine) -assert (model.dof(aSketchFeature) == 8) -#========================================================================= +assert model.dof(aSketchFeature) == 8 +# ========================================================================= # Add constraint point-on-circle -#========================================================================= +# ========================================================================= aSession.startOperation() # create circle with center coincident with origin aSketchCircle = aSketchFeature.addFeature("SketchCircle") aCircleCenter = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center")) aCircleRadius = aSketchCircle.real("circle_radius") -aCircleCenter.setValue(10., 10.) -aCircleRadius.setValue(25.) +aCircleCenter.setValue(10.0, 10.0) +aCircleRadius.setValue(25.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 11) +assert model.dof(aSketchFeature) == 11 # create origin aSession.startOperation() anOrigRes = modelAPI_Result(aDocument.objectByName("Construction", anOriginName)) -assert (anOrigRes) +assert anOrigRes anOrigShape = anOrigRes.shape() -assert (anOrigShape) +assert anOrigShape anOrigin = aSketchFeature.addFeature("SketchPoint") anOriginCoord = geomDataAPI_Point2D(anOrigin.attribute("PointCoordinates")) -anOriginCoord.setValue(0., 0.) +anOriginCoord.setValue(0.0, 0.0) anOrigin.selection("External").setValue(anOrigRes, anOrigShape) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 11) +assert model.dof(aSketchFeature) == 11 # coincidence between center of circle and the origin aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintCoincidence") @@ -203,7 +205,7 @@ reflistB = aConstraint.refattr("ConstraintEntityB") reflistA.setAttr(aCircleCenter) reflistB.setObject(anOrigin.lastResult()) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 9) +assert model.dof(aSketchFeature) == 9 # point-on-circle aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintCoincidence") @@ -214,10 +216,10 @@ reflistB.setAttr(aLineEndPoint) aConstraint.execute() aSession.finishOperation() checkPointOnCircle(aLineEndPoint, aSketchCircle) -assert (model.dof(aSketchFeature) == 8) -#========================================================================= +assert model.dof(aSketchFeature) == 8 +# ========================================================================= # Add constraint point-on-arc -#========================================================================= +# ========================================================================= aSession.startOperation("constraint point-on-arc") aConstraint = aSketchFeature.addFeature("SketchConstraintCoincidence") reflistA = aConstraint.refattr("ConstraintEntityA") @@ -228,27 +230,27 @@ aConstraint.execute() aSession.finishOperation() checkPointOnArc(aCircleCenter, aSketchArc) # check center of circle is still in origin -assert (aCircleCenter.x() == 0. and aCircleCenter.y() == 0.) -assert (model.dof(aSketchFeature) == 7) +assert aCircleCenter.x() == 0.0 and aCircleCenter.y() == 0.0 +assert model.dof(aSketchFeature) == 7 -#========================================================================= +# ========================================================================= # Create two more lines and set multi-coincidence between their extremities -#========================================================================= +# ========================================================================= aSession.startOperation() # line 2 aLine2 = aSketchFeature.addFeature("SketchLine") aLine2StartPoint = geomDataAPI_Point2D(aLine2.attribute("StartPoint")) aLine2EndPoint = geomDataAPI_Point2D(aLine2.attribute("EndPoint")) -aLine2StartPoint.setValue(50., 0.) -aLine2EndPoint.setValue(100., 0.) +aLine2StartPoint.setValue(50.0, 0.0) +aLine2EndPoint.setValue(100.0, 0.0) # line 3 aLine3 = aSketchFeature.addFeature("SketchLine") aLine3StartPoint = geomDataAPI_Point2D(aLine3.attribute("StartPoint")) aLine3EndPoint = geomDataAPI_Point2D(aLine3.attribute("EndPoint")) -aLine3StartPoint.setValue(50., 0.) -aLine3EndPoint.setValue(0., 100.) +aLine3StartPoint.setValue(50.0, 0.0) +aLine3EndPoint.setValue(0.0, 100.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 15) +assert model.dof(aSketchFeature) == 15 # coincidences between extremities of lines aSession.startOperation() aConstraint12 = aSketchFeature.addFeature("SketchConstraintCoincidence") @@ -268,24 +270,34 @@ refAttrA.setAttr(aLine3StartPoint) refAttrB.setAttr(aLineStartPoint) aSession.finishOperation() # check the points have same coordinates -assert (aLineStartPoint.x() == aLine2StartPoint.x() and aLineStartPoint.y() == aLine2StartPoint.y()) -assert (aLineStartPoint.x() == aLine3StartPoint.x() and aLineStartPoint.y() == aLine3StartPoint.y()) -assert (model.dof(aSketchFeature) == 11) -#========================================================================= +assert ( + aLineStartPoint.x() == aLine2StartPoint.x() + and aLineStartPoint.y() == aLine2StartPoint.y() +) +assert ( + aLineStartPoint.x() == aLine3StartPoint.x() + and aLineStartPoint.y() == aLine3StartPoint.y() +) +assert model.dof(aSketchFeature) == 11 +# ========================================================================= # Move one line and check other have been updated too -#========================================================================= +# ========================================================================= aSession.startOperation() -aLine3StartPoint.setValue(aLine3StartPoint.x() + deltaX, - aLine3StartPoint.y() + deltaY) -aLine3EndPoint.setValue(aLine3EndPoint.x() + deltaX, - aLine3EndPoint.y() + deltaY) +aLine3StartPoint.setValue(aLine3StartPoint.x() + deltaX, aLine3StartPoint.y() + deltaY) +aLine3EndPoint.setValue(aLine3EndPoint.x() + deltaX, aLine3EndPoint.y() + deltaY) aSession.finishOperation() -assert (aLineStartPoint.x() == aLine2StartPoint.x() and aLineStartPoint.y() == aLine2StartPoint.y()) -assert (aLineStartPoint.x() == aLine3StartPoint.x() and aLineStartPoint.y() == aLine3StartPoint.y()) -assert (model.dof(aSketchFeature) == 11) -#========================================================================= +assert ( + aLineStartPoint.x() == aLine2StartPoint.x() + and aLineStartPoint.y() == aLine2StartPoint.y() +) +assert ( + aLineStartPoint.x() == aLine3StartPoint.x() + and aLineStartPoint.y() == aLine3StartPoint.y() +) +assert model.dof(aSketchFeature) == 11 +# ========================================================================= # Fix a line and move another connected segment -#========================================================================= +# ========================================================================= coordX = aLineStartPoint.x() coordY = aLineStartPoint.y() aSession.startOperation() @@ -295,37 +307,39 @@ refAttrA.setObject(aLine2.lastResult()) aSession.finishOperation() # move another line aSession.startOperation() -aLine3StartPoint.setValue(aLine3StartPoint.x() + deltaX, - aLine3StartPoint.y() + deltaY) -aLine3EndPoint.setValue(aLine3EndPoint.x() + deltaX, - aLine3EndPoint.y() + deltaY) +aLine3StartPoint.setValue(aLine3StartPoint.x() + deltaX, aLine3StartPoint.y() + deltaY) +aLine3EndPoint.setValue(aLine3EndPoint.x() + deltaX, aLine3EndPoint.y() + deltaY) aSession.finishOperation() -assert (aLineStartPoint.x() == coordX and aLineStartPoint.y() == coordY) -assert (aLine2StartPoint.x() == coordX and aLine2StartPoint.y() == coordY) -assert (aLine3StartPoint.x() == coordX and aLine3StartPoint.y() == coordY) -assert (model.dof(aSketchFeature) == 7) -#========================================================================= +assert aLineStartPoint.x() == coordX and aLineStartPoint.y() == coordY +assert aLine2StartPoint.x() == coordX and aLine2StartPoint.y() == coordY +assert aLine3StartPoint.x() == coordX and aLine3StartPoint.y() == coordY +assert model.dof(aSketchFeature) == 7 +# ========================================================================= # Detach fixed line and move one of remaining -#========================================================================= +# ========================================================================= aSession.startOperation() aDocument.removeFeature(aConstraint12) aDocument.removeFeature(aConstraint23) aSession.finishOperation() # move line -deltaX = 1. -deltaY = 0. +deltaX = 1.0 +deltaY = 0.0 aSession.startOperation() -aLineStartPoint.setValue(aLineStartPoint.x() + deltaX, - aLineStartPoint.y() + deltaY) -aLineEndPoint.setValue(aLineEndPoint.x() + deltaX, - aLineEndPoint.y() + deltaY) +aLineStartPoint.setValue(aLineStartPoint.x() + deltaX, aLineStartPoint.y() + deltaY) +aLineEndPoint.setValue(aLineEndPoint.x() + deltaX, aLineEndPoint.y() + deltaY) aSession.finishOperation() -assert (aLineStartPoint.x() != aLine2StartPoint.x() or aLineStartPoint.y() != aLine2StartPoint.y()) -assert (aLineStartPoint.x() == aLine3StartPoint.x() and aLineStartPoint.y() == aLine3StartPoint.y()) -assert (model.dof(aSketchFeature) == 9) +assert ( + aLineStartPoint.x() != aLine2StartPoint.x() + or aLineStartPoint.y() != aLine2StartPoint.y() +) +assert ( + aLineStartPoint.x() == aLine3StartPoint.x() + and aLineStartPoint.y() == aLine3StartPoint.y() +) +assert model.dof(aSketchFeature) == 9 -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintCoincidenceBSpline.py b/src/SketchPlugin/Test/TestConstraintCoincidenceBSpline.py index 33d89caa3..a41133266 100644 --- a/src/SketchPlugin/Test/TestConstraintCoincidenceBSpline.py +++ b/src/SketchPlugin/Test/TestConstraintCoincidenceBSpline.py @@ -31,143 +31,155 @@ from SketchAPI import * __updated__ = "2020-01-21" + class TestCoincidenceBSpline(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - - self.myPoles = [GeomAPI_Pnt2d(-10, -30), GeomAPI_Pnt2d(20, -15), GeomAPI_Pnt2d(-10, 0), GeomAPI_Pnt2d(20, 15), GeomAPI_Pnt2d(-10, 30)] - self.myWeights = [1, 3, 5, 3, 1] - self.mySpline = self.mySketch.addSpline(poles = self.myPoles, weights = self.myWeights) - self.myControlPoles = self.mySpline.controlPoles(auxiliary = [0, 1, 2, 3, 4]) - self.myControlLines = self.mySpline.controlPolygon(auxiliary = [0, 1, 2, 3]) - - self.myDOF = len(self.myPoles) * 2 - self.myOrigin = self.mySketch.addPoint("Origin") - self.myOX = self.mySketch.addLine("OX") - model.do() - self.myExpectFailure = False - self.myNbPoints = len(self.myPoles) + 1 - self.myNbLines = len(self.myPoles) - self.myNbBSplines = 1 - self.myNbInternalConstraints = len(self.myPoles) * 3 - 2 - self.myNbCoincidences = 1 - - def tearDown(self): - model.end() - if self.myExpectFailure: - assert(self.mySketch.solverError() != ""), "PlaneGCS limitation: if you see this message, then PlaneGCS has solved the set of constraints correctly" - model.undo() - else: - self.checkDOF() - model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) - model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) - model.testNbSubFeatures(self.mySketch, "SketchBSpline", self.myNbBSplines) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidenceInternal", self.myNbInternalConstraints) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", self.myNbCoincidences) - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def setCoincidentWithOrigin(self, thePoint): - self.mySketch.setCoincident(thePoint, self.myOrigin.coordinates()) - self.myDOF -= 2 - model.do() - - def setCoincidentWithOX(self, thePoint): - self.mySketch.setCoincident(thePoint, self.myOX.result()) - self.myDOF -= 1 - model.do() - - def assertPoles(self): - poles = self.mySpline.poles() - assert(poles.size() == len(self.myPoles)) - for index in range(0, len(self.myPoles)): - self.assertPoints(self.myPoles[index], poles.pnt(index)) - - def assertPoints(self, thePoint1, thePoint2): - self.assertAlmostEqual(thePoint1.x(), thePoint2.x()) - self.assertAlmostEqual(thePoint1.y(), thePoint2.y()) - - def assertPointOnLine(self, thePoint, theLineStart, theLineEnd): - vecP = [thePoint.x() - theLineStart.x(), thePoint.y() - theLineStart.y()] - vecL = [theLineEnd.x() - theLineStart.x(), theLineEnd.y() - theLineStart.y()] - dist = math.fabs(vecP[0] * vecL[1] - vecP[1] * vecL[0]) / math.hypot(vecL[0], vecL[1]) - self.assertAlmostEqual(dist, 0.0) - - def assertPointOnSpline(self, thePoint, theSpline): - point = GeomAPI_Pnt(thePoint.x(), thePoint.y(), 0.0) - bspline = GeomAPI_Curve(theSpline.results()[-1].resultSubShapePair()[0].shape()) - proj = bspline.project(point) - self.assertAlmostEqual(point.distance(proj), 0.0) - - - def test_origin_equal_start_point(self): - """ Test 1. Make start point of B-spline coincident with the Origin - """ - self.setCoincidentWithOrigin(self.mySpline.startPoint()) - self.myPoles[0].setX(0) - self.myPoles[0].setY(0) - self.assertPoles() - - def test_origin_equal_end_point(self): - """ Test 2. Make end point of B-spline coincident with the Origin - """ - self.setCoincidentWithOrigin(self.mySpline.endPoint()) - self.myPoles[-1].setX(0) - self.myPoles[-1].setY(0) - self.assertPoles() - - def test_origin_equal_pole(self): - """ Test 3. Make one of B-spline poles coincident with the Origin - """ - self.setCoincidentWithOrigin(SketchAPI_Point(self.myControlPoles[1]).coordinates()) - self.myPoles[1].setX(0) - self.myPoles[1].setY(0) - self.assertPoles() - - def test_origin_on_bspline(self): - """ Test 4. (expected failure) Make Origin lying on the B-spline curve - """ - self.mySketch.setCoincident(self.mySpline.defaultResult(), self.myOrigin.coordinates()) - self.myDOF -= 1 - model.do() - self.myExpectFailure = True - - def test_point_on_bspline(self): - """ Test 5. Place free point on the B-spline curve - """ - point = self.mySketch.addPoint(1, 0) - self.mySketch.setCoincident(self.myOX.defaultResult(), point.coordinates()) - self.mySketch.setCoincident(self.mySpline.defaultResult(), point.coordinates()) - model.do() - self.myNbPoints += 1 - self.myNbCoincidences += 1 - self.assertPointOnSpline(point.coordinates(), self.mySpline) - - - def test_start_point_on_axis(self): - """ Test 6. Make start point of B-spline coincident with the OX - """ - self.setCoincidentWithOX(self.mySpline.startPoint()) - self.myPoles[0].setY(0) - self.assertPoles() - - def test_end_point_on_axis(self): - """ Test 7. Make end point of B-spline coincident with the OX - """ - self.setCoincidentWithOX(self.mySpline.endPoint()) - self.myPoles[-1].setY(0) - self.assertPoles() - - def test_pole_on_axis(self): - """ Test 8. Make one of B-spline poles coincident with the OX - """ - self.setCoincidentWithOX(SketchAPI_Point(self.myControlPoles[1]).coordinates()) - self.myPoles[1].setY(0) - self.assertPoles() + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + + self.myPoles = [ + GeomAPI_Pnt2d(-10, -30), + GeomAPI_Pnt2d(20, -15), + GeomAPI_Pnt2d(-10, 0), + GeomAPI_Pnt2d(20, 15), + GeomAPI_Pnt2d(-10, 30), + ] + self.myWeights = [1, 3, 5, 3, 1] + self.mySpline = self.mySketch.addSpline( + poles=self.myPoles, weights=self.myWeights + ) + self.myControlPoles = self.mySpline.controlPoles(auxiliary=[0, 1, 2, 3, 4]) + self.myControlLines = self.mySpline.controlPolygon(auxiliary=[0, 1, 2, 3]) + + self.myDOF = len(self.myPoles) * 2 + self.myOrigin = self.mySketch.addPoint("Origin") + self.myOX = self.mySketch.addLine("OX") + model.do() + self.myExpectFailure = False + self.myNbPoints = len(self.myPoles) + 1 + self.myNbLines = len(self.myPoles) + self.myNbBSplines = 1 + self.myNbInternalConstraints = len(self.myPoles) * 3 - 2 + self.myNbCoincidences = 1 + + def tearDown(self): + model.end() + if self.myExpectFailure: + assert ( + self.mySketch.solverError() != "" + ), "PlaneGCS limitation: if you see this message, then PlaneGCS has solved the set of constraints correctly" + model.undo() + else: + self.checkDOF() + model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) + model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) + model.testNbSubFeatures(self.mySketch, "SketchBSpline", self.myNbBSplines) + model.testNbSubFeatures( + self.mySketch, + "SketchConstraintCoincidenceInternal", + self.myNbInternalConstraints, + ) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintCoincidence", self.myNbCoincidences + ) + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def setCoincidentWithOrigin(self, thePoint): + self.mySketch.setCoincident(thePoint, self.myOrigin.coordinates()) + self.myDOF -= 2 + model.do() + + def setCoincidentWithOX(self, thePoint): + self.mySketch.setCoincident(thePoint, self.myOX.result()) + self.myDOF -= 1 + model.do() + + def assertPoles(self): + poles = self.mySpline.poles() + assert poles.size() == len(self.myPoles) + for index in range(0, len(self.myPoles)): + self.assertPoints(self.myPoles[index], poles.pnt(index)) + + def assertPoints(self, thePoint1, thePoint2): + self.assertAlmostEqual(thePoint1.x(), thePoint2.x()) + self.assertAlmostEqual(thePoint1.y(), thePoint2.y()) + + def assertPointOnLine(self, thePoint, theLineStart, theLineEnd): + vecP = [thePoint.x() - theLineStart.x(), thePoint.y() - theLineStart.y()] + vecL = [theLineEnd.x() - theLineStart.x(), theLineEnd.y() - theLineStart.y()] + dist = math.fabs(vecP[0] * vecL[1] - vecP[1] * vecL[0]) / math.hypot( + vecL[0], vecL[1] + ) + self.assertAlmostEqual(dist, 0.0) + + def assertPointOnSpline(self, thePoint, theSpline): + point = GeomAPI_Pnt(thePoint.x(), thePoint.y(), 0.0) + bspline = GeomAPI_Curve(theSpline.results()[-1].resultSubShapePair()[0].shape()) + proj = bspline.project(point) + self.assertAlmostEqual(point.distance(proj), 0.0) + + def test_origin_equal_start_point(self): + """Test 1. Make start point of B-spline coincident with the Origin""" + self.setCoincidentWithOrigin(self.mySpline.startPoint()) + self.myPoles[0].setX(0) + self.myPoles[0].setY(0) + self.assertPoles() + + def test_origin_equal_end_point(self): + """Test 2. Make end point of B-spline coincident with the Origin""" + self.setCoincidentWithOrigin(self.mySpline.endPoint()) + self.myPoles[-1].setX(0) + self.myPoles[-1].setY(0) + self.assertPoles() + + def test_origin_equal_pole(self): + """Test 3. Make one of B-spline poles coincident with the Origin""" + self.setCoincidentWithOrigin( + SketchAPI_Point(self.myControlPoles[1]).coordinates() + ) + self.myPoles[1].setX(0) + self.myPoles[1].setY(0) + self.assertPoles() + + def test_origin_on_bspline(self): + """Test 4. (expected failure) Make Origin lying on the B-spline curve""" + self.mySketch.setCoincident( + self.mySpline.defaultResult(), self.myOrigin.coordinates() + ) + self.myDOF -= 1 + model.do() + self.myExpectFailure = True + + def test_point_on_bspline(self): + """Test 5. Place free point on the B-spline curve""" + point = self.mySketch.addPoint(1, 0) + self.mySketch.setCoincident(self.myOX.defaultResult(), point.coordinates()) + self.mySketch.setCoincident(self.mySpline.defaultResult(), point.coordinates()) + model.do() + self.myNbPoints += 1 + self.myNbCoincidences += 1 + self.assertPointOnSpline(point.coordinates(), self.mySpline) + + def test_start_point_on_axis(self): + """Test 6. Make start point of B-spline coincident with the OX""" + self.setCoincidentWithOX(self.mySpline.startPoint()) + self.myPoles[0].setY(0) + self.assertPoles() + + def test_end_point_on_axis(self): + """Test 7. Make end point of B-spline coincident with the OX""" + self.setCoincidentWithOX(self.mySpline.endPoint()) + self.myPoles[-1].setY(0) + self.assertPoles() + + def test_pole_on_axis(self): + """Test 8. Make one of B-spline poles coincident with the OX""" + self.setCoincidentWithOX(SketchAPI_Point(self.myControlPoles[1]).coordinates()) + self.myPoles[1].setY(0) + self.assertPoles() if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestConstraintCoincidenceEllipse.py b/src/SketchPlugin/Test/TestConstraintCoincidenceEllipse.py index 2d6ec9d87..1ecdf1380 100644 --- a/src/SketchPlugin/Test/TestConstraintCoincidenceEllipse.py +++ b/src/SketchPlugin/Test/TestConstraintCoincidenceEllipse.py @@ -31,215 +31,245 @@ from SketchAPI import * __updated__ = "2019-09-12" + class TestCoincidenceEllipse(unittest.TestCase): - def setUp(self): - axisStart = GeomAPI_Pnt2d(30., 60.) - axisEnd = GeomAPI_Pnt2d(80., 50.) - passedPoint = GeomAPI_Pnt2d(60., 60.) - - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - macroEllipse = self.mySketch.addEllipse(axisStart, axisEnd, passedPoint, False) - self.myDOF = 5 - self.myOrigin = self.mySketch.addPoint("Origin") - self.myOX = self.mySketch.addLine("OX") - model.do() - self.myEllipse = SketchAPI_Ellipse(model.lastSubFeature(self.mySketch, "SketchEllipse")) - self.myCenter = macroEllipse.center() - self.myFocus1 = macroEllipse.focus1() - self.myFocus2 = macroEllipse.focus2() - self.myMajorAxis = macroEllipse.majorAxis() - self.myMajorStart = macroEllipse.majorAxisStart() - self.myMajorEnd = macroEllipse.majorAxisEnd() - self.myMinorAxis = macroEllipse.minorAxis() - self.myMinorStart = macroEllipse.minorAxisStart() - self.myMinorEnd = macroEllipse.minorAxisEnd() - self.myExpectFailure = False - self.myNbCoindicences = 1 - - def tearDown(self): - model.end() - if self.myExpectFailure: - assert(self.mySketch.solverError() != ""), "PlaneGCS limitation: if you see this message, then PlaneGCS has solved the set of constraints correctly" - model.undo() - else: - self.checkDOF() - self.assertPoints(self.myCenter.coordinates(), self.myEllipse.center()) - self.assertPoints(self.myFocus1.coordinates(), self.myEllipse.firstFocus()) - self.assertPoints(self.myFocus2.coordinates(), self.myEllipse.secondFocus()) - self.assertPoints(self.myMajorStart.coordinates(), self.myEllipse.majorAxisNegative()) - self.assertPoints(self.myMajorEnd.coordinates(), self.myEllipse.majorAxisPositive()) - self.assertPoints(self.myMajorAxis.startPoint(), self.myEllipse.majorAxisNegative()) - self.assertPoints(self.myMajorAxis.endPoint(), self.myEllipse.majorAxisPositive()) - self.assertPoints(self.myMinorStart.coordinates(), self.myEllipse.minorAxisNegative()) - self.assertPoints(self.myMinorEnd.coordinates(), self.myEllipse.minorAxisPositive()) - self.assertPoints(self.myMinorAxis.startPoint(), self.myEllipse.minorAxisNegative()) - self.assertPoints(self.myMinorAxis.endPoint(), self.myEllipse.minorAxisPositive()) - model.testNbSubFeatures(self.mySketch, "SketchPoint", 8) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidenceInternal", 11) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", self.myNbCoindicences) - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkPointFixing(self, thePoint): - self.mySketch.setCoincident(thePoint, self.myOrigin.coordinates()) - self.myDOF -= 2 - model.do() - if not self.myExpectFailure: - self.assertPoints(thePoint, self.myOrigin.coordinates()) - self.assertGreater(self.myEllipse.majorRadius().value(), 0.0) - self.assertGreater(self.myEllipse.minorRadius().value(), 0.0) - - def assertPoints(self, thePoint1, thePoint2): - self.assertAlmostEqual(thePoint1.x(), thePoint2.x(), delta = 1.e-6) - self.assertAlmostEqual(thePoint1.y(), thePoint2.y(), delta = 1.e-6) - - def checkPointOnAxis(self, thePoint): - self.mySketch.setCoincident(thePoint, self.myOX.result()) - self.myDOF -= 1 - model.do() - if not self.myExpectFailure: - self.assertAlmostEqual(thePoint.y(), 0.0, delta = 1.e-6) - self.assertGreater(self.myEllipse.majorRadius().value(), 0.0) - self.assertGreater(self.myEllipse.minorRadius().value(), 0.0) - - def checkPointOnLine(self, thePoint, theLineStart, theLineEnd): - vecP = [thePoint.x() - theLineStart.x(), thePoint.y() - theLineStart.y()] - vecL = [theLineEnd.x() - theLineStart.x(), theLineEnd.y() - theLineStart.y()] - dist = math.fabs(vecP[0] * vecL[1] - vecP[1] * vecL[0]) / math.hypot(vecL[0], vecL[1]) - - self.assertAlmostEqual(dist, 0.0, delta = 1.e-6) - self.assertGreater(self.myEllipse.majorRadius().value(), 0.0) - self.assertGreater(self.myEllipse.minorRadius().value(), 0.0) - - def checkPointOnEllipse(self, thePoint, theEllipse): - firstFocus2d = GeomAPI_Pnt2d(theEllipse.firstFocus().x(), theEllipse.firstFocus().y()) - distPF1 = model.distancePointPoint(firstFocus2d, thePoint) - secondFocus2d = GeomAPI_Pnt2d(theEllipse.secondFocus().x(), theEllipse.secondFocus().y()) - distPF2 = model.distancePointPoint(secondFocus2d, thePoint) - self.assertAlmostEqual(distPF1 + distPF2, 2.0 * theEllipse.majorRadius().value(), 7) - - - def test_concident_center(self): - """ Test 1. Make center of ellipse coincident with the Origin - """ - self.checkPointFixing(self.myCenter.coordinates()) - - def test_coincident_first_focus(self): - """ Test 2. Make first focus of ellipse coincident with the Origin - """ - self.checkPointFixing(self.myFocus1.coordinates()) - - def test_coincident_second_focus(self): - """ Test 3. Make second focus of ellipse coincident with the Origin - """ - self.checkPointFixing(self.myFocus2.coordinates()) - - def test_coincident_major_axis_start(self): - """ Test 4. Make start point on the major axis of ellipse coincident with the Origin - """ - self.checkPointFixing(self.myMajorStart.coordinates()) - - def test_coincident_major_axis_end(self): - """ Test 5. Make end point on the major axis of ellipse coincident with the Origin - """ - self.checkPointFixing(self.myMajorEnd.coordinates()) - - def test_coincident_minor_axis_start(self): - """ Test 6. Make start point on the minor axis of ellipse coincident with the Origin - """ - self.checkPointFixing(self.myMinorStart.coordinates()) - # workaround: kill the constraint to avoid instability on dump check - model.end() - model.undo() - model.begin() - self.myDOF += 2 - self.myNbCoindicences -= 1 - - def test_coincident_minor_axis_end(self): - """ Test 7. Make end point on the minor axis of ellipse coincident with the Origin. - Check solver is failed to compute the coincidence. - """ - self.myExpectFailure = True - self.checkPointFixing(self.myMinorEnd.coordinates()) - - - def test_center_on_line(self): - """ Test 8. Make center of ellipse coincident with the OX - """ - self.checkPointOnAxis(self.myCenter.coordinates()) - - def test_first_focus_on_line(self): - """ Test 9. Make first focus of ellipse coincident with the OX - """ - self.checkPointOnAxis(self.myFocus1.coordinates()) - - def test_second_focus_on_line(self): - """ Test 10. Make second focus of ellipse coincident with the OX - """ - self.checkPointOnAxis(self.myFocus2.coordinates()) - - def test_major_axis_start_on_line(self): - """ Test 11. Make start point on the major axis of ellipse coincident with the OX - """ - self.checkPointOnAxis(self.myMajorStart.coordinates()) - - def test_major_axis_end_on_line(self): - """ Test 12. Make end point on the major axis of ellipse coincident with the OX - """ - self.checkPointOnAxis(self.myMajorEnd.coordinates()) - - def test_minor_axis_start_on_line(self): - """ Test 13. Make start point on the minor axis of ellipse coincident with the OX - """ - self.checkPointOnAxis(self.myMinorStart.coordinates()) - - def test_minor_axis_end_on_line(self): - """ Test 14. Make end point on the minor axis of ellipse coincident with the OX - """ - self.myExpectFailure = True - self.checkPointOnAxis(self.myMinorEnd.coordinates()) - - - def test_origin_on_major_axis(self): - """ Test 15. Make origin coincident with the major axis of the ellipse - """ - self.mySketch.setCoincident(self.myMajorAxis.result(), self.myOrigin.coordinates()) - self.myDOF -= 1 - model.do() - self.checkPointOnLine(self.myOrigin.coordinates(), self.myMajorStart.coordinates(), self.myMajorEnd.coordinates()) - - def test_origin_on_minor_axis(self): - """ Test 16. Make origin coincident with the minor axis of the ellipse - """ - self.mySketch.setCoincident(self.myMinorAxis.result(), self.myOrigin.coordinates()) - self.myDOF -= 1 - model.end() - # solver shows wrong result - assert(self.mySketch.solverError() != ""), "PlaneGCS limitation: if you see this message, then PlaneGCS has solved the set of constraints correctly" - model.undo() - - # move ellipse and set coincidence once again - model.begin() - self.mySketch.move(self.myMinorStart, 20, 10) - model.do() - self.mySketch.setCoincident(self.myMinorAxis.results()[-1], self.myOrigin.coordinates()) - model.do() - self.checkPointOnLine(self.myOrigin.coordinates(), self.myMinorStart.coordinates(), self.myMinorEnd.coordinates()) - - - def test_origin_on_ellipse(self): - """ Test 17. Make origin coincident with the ellipse - """ - self.mySketch.setCoincident(self.myEllipse.results()[-1], self.myOrigin.coordinates()) - self.myDOF -= 1 - model.do() - self.checkPointOnEllipse(self.myOrigin.coordinates(), self.myEllipse) + def setUp(self): + axisStart = GeomAPI_Pnt2d(30.0, 60.0) + axisEnd = GeomAPI_Pnt2d(80.0, 50.0) + passedPoint = GeomAPI_Pnt2d(60.0, 60.0) + + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + macroEllipse = self.mySketch.addEllipse(axisStart, axisEnd, passedPoint, False) + self.myDOF = 5 + self.myOrigin = self.mySketch.addPoint("Origin") + self.myOX = self.mySketch.addLine("OX") + model.do() + self.myEllipse = SketchAPI_Ellipse( + model.lastSubFeature(self.mySketch, "SketchEllipse") + ) + self.myCenter = macroEllipse.center() + self.myFocus1 = macroEllipse.focus1() + self.myFocus2 = macroEllipse.focus2() + self.myMajorAxis = macroEllipse.majorAxis() + self.myMajorStart = macroEllipse.majorAxisStart() + self.myMajorEnd = macroEllipse.majorAxisEnd() + self.myMinorAxis = macroEllipse.minorAxis() + self.myMinorStart = macroEllipse.minorAxisStart() + self.myMinorEnd = macroEllipse.minorAxisEnd() + self.myExpectFailure = False + self.myNbCoindicences = 1 + + def tearDown(self): + model.end() + if self.myExpectFailure: + assert ( + self.mySketch.solverError() != "" + ), "PlaneGCS limitation: if you see this message, then PlaneGCS has solved the set of constraints correctly" + model.undo() + else: + self.checkDOF() + self.assertPoints(self.myCenter.coordinates(), self.myEllipse.center()) + self.assertPoints(self.myFocus1.coordinates(), self.myEllipse.firstFocus()) + self.assertPoints(self.myFocus2.coordinates(), self.myEllipse.secondFocus()) + self.assertPoints( + self.myMajorStart.coordinates(), self.myEllipse.majorAxisNegative() + ) + self.assertPoints( + self.myMajorEnd.coordinates(), self.myEllipse.majorAxisPositive() + ) + self.assertPoints( + self.myMajorAxis.startPoint(), self.myEllipse.majorAxisNegative() + ) + self.assertPoints( + self.myMajorAxis.endPoint(), self.myEllipse.majorAxisPositive() + ) + self.assertPoints( + self.myMinorStart.coordinates(), self.myEllipse.minorAxisNegative() + ) + self.assertPoints( + self.myMinorEnd.coordinates(), self.myEllipse.minorAxisPositive() + ) + self.assertPoints( + self.myMinorAxis.startPoint(), self.myEllipse.minorAxisNegative() + ) + self.assertPoints( + self.myMinorAxis.endPoint(), self.myEllipse.minorAxisPositive() + ) + model.testNbSubFeatures(self.mySketch, "SketchPoint", 8) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintCoincidenceInternal", 11 + ) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintCoincidence", self.myNbCoindicences + ) + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointFixing(self, thePoint): + self.mySketch.setCoincident(thePoint, self.myOrigin.coordinates()) + self.myDOF -= 2 + model.do() + if not self.myExpectFailure: + self.assertPoints(thePoint, self.myOrigin.coordinates()) + self.assertGreater(self.myEllipse.majorRadius().value(), 0.0) + self.assertGreater(self.myEllipse.minorRadius().value(), 0.0) + + def assertPoints(self, thePoint1, thePoint2): + self.assertAlmostEqual(thePoint1.x(), thePoint2.x(), delta=1.0e-6) + self.assertAlmostEqual(thePoint1.y(), thePoint2.y(), delta=1.0e-6) + + def checkPointOnAxis(self, thePoint): + self.mySketch.setCoincident(thePoint, self.myOX.result()) + self.myDOF -= 1 + model.do() + if not self.myExpectFailure: + self.assertAlmostEqual(thePoint.y(), 0.0, delta=1.0e-6) + self.assertGreater(self.myEllipse.majorRadius().value(), 0.0) + self.assertGreater(self.myEllipse.minorRadius().value(), 0.0) + + def checkPointOnLine(self, thePoint, theLineStart, theLineEnd): + vecP = [thePoint.x() - theLineStart.x(), thePoint.y() - theLineStart.y()] + vecL = [theLineEnd.x() - theLineStart.x(), theLineEnd.y() - theLineStart.y()] + dist = math.fabs(vecP[0] * vecL[1] - vecP[1] * vecL[0]) / math.hypot( + vecL[0], vecL[1] + ) + + self.assertAlmostEqual(dist, 0.0, delta=1.0e-6) + self.assertGreater(self.myEllipse.majorRadius().value(), 0.0) + self.assertGreater(self.myEllipse.minorRadius().value(), 0.0) + + def checkPointOnEllipse(self, thePoint, theEllipse): + firstFocus2d = GeomAPI_Pnt2d( + theEllipse.firstFocus().x(), theEllipse.firstFocus().y() + ) + distPF1 = model.distancePointPoint(firstFocus2d, thePoint) + secondFocus2d = GeomAPI_Pnt2d( + theEllipse.secondFocus().x(), theEllipse.secondFocus().y() + ) + distPF2 = model.distancePointPoint(secondFocus2d, thePoint) + self.assertAlmostEqual( + distPF1 + distPF2, 2.0 * theEllipse.majorRadius().value(), 7 + ) + + def test_concident_center(self): + """Test 1. Make center of ellipse coincident with the Origin""" + self.checkPointFixing(self.myCenter.coordinates()) + + def test_coincident_first_focus(self): + """Test 2. Make first focus of ellipse coincident with the Origin""" + self.checkPointFixing(self.myFocus1.coordinates()) + + def test_coincident_second_focus(self): + """Test 3. Make second focus of ellipse coincident with the Origin""" + self.checkPointFixing(self.myFocus2.coordinates()) + + def test_coincident_major_axis_start(self): + """Test 4. Make start point on the major axis of ellipse coincident with the Origin""" + self.checkPointFixing(self.myMajorStart.coordinates()) + + def test_coincident_major_axis_end(self): + """Test 5. Make end point on the major axis of ellipse coincident with the Origin""" + self.checkPointFixing(self.myMajorEnd.coordinates()) + + def test_coincident_minor_axis_start(self): + """Test 6. Make start point on the minor axis of ellipse coincident with the Origin""" + self.checkPointFixing(self.myMinorStart.coordinates()) + # workaround: kill the constraint to avoid instability on dump check + model.end() + model.undo() + model.begin() + self.myDOF += 2 + self.myNbCoindicences -= 1 + + def test_coincident_minor_axis_end(self): + """Test 7. Make end point on the minor axis of ellipse coincident with the Origin. + Check solver is failed to compute the coincidence. + """ + self.myExpectFailure = True + self.checkPointFixing(self.myMinorEnd.coordinates()) + + def test_center_on_line(self): + """Test 8. Make center of ellipse coincident with the OX""" + self.checkPointOnAxis(self.myCenter.coordinates()) + + def test_first_focus_on_line(self): + """Test 9. Make first focus of ellipse coincident with the OX""" + self.checkPointOnAxis(self.myFocus1.coordinates()) + + def test_second_focus_on_line(self): + """Test 10. Make second focus of ellipse coincident with the OX""" + self.checkPointOnAxis(self.myFocus2.coordinates()) + + def test_major_axis_start_on_line(self): + """Test 11. Make start point on the major axis of ellipse coincident with the OX""" + self.checkPointOnAxis(self.myMajorStart.coordinates()) + + def test_major_axis_end_on_line(self): + """Test 12. Make end point on the major axis of ellipse coincident with the OX""" + self.checkPointOnAxis(self.myMajorEnd.coordinates()) + + def test_minor_axis_start_on_line(self): + """Test 13. Make start point on the minor axis of ellipse coincident with the OX""" + self.checkPointOnAxis(self.myMinorStart.coordinates()) + + def test_minor_axis_end_on_line(self): + """Test 14. Make end point on the minor axis of ellipse coincident with the OX""" + self.myExpectFailure = True + self.checkPointOnAxis(self.myMinorEnd.coordinates()) + + def test_origin_on_major_axis(self): + """Test 15. Make origin coincident with the major axis of the ellipse""" + self.mySketch.setCoincident( + self.myMajorAxis.result(), self.myOrigin.coordinates() + ) + self.myDOF -= 1 + model.do() + self.checkPointOnLine( + self.myOrigin.coordinates(), + self.myMajorStart.coordinates(), + self.myMajorEnd.coordinates(), + ) + + def test_origin_on_minor_axis(self): + """Test 16. Make origin coincident with the minor axis of the ellipse""" + self.mySketch.setCoincident( + self.myMinorAxis.result(), self.myOrigin.coordinates() + ) + self.myDOF -= 1 + model.end() + # solver shows wrong result + assert ( + self.mySketch.solverError() != "" + ), "PlaneGCS limitation: if you see this message, then PlaneGCS has solved the set of constraints correctly" + model.undo() + + # move ellipse and set coincidence once again + model.begin() + self.mySketch.move(self.myMinorStart, 20, 10) + model.do() + self.mySketch.setCoincident( + self.myMinorAxis.results()[-1], self.myOrigin.coordinates() + ) + model.do() + self.checkPointOnLine( + self.myOrigin.coordinates(), + self.myMinorStart.coordinates(), + self.myMinorEnd.coordinates(), + ) + + def test_origin_on_ellipse(self): + """Test 17. Make origin coincident with the ellipse""" + self.mySketch.setCoincident( + self.myEllipse.results()[-1], self.myOrigin.coordinates() + ) + self.myDOF -= 1 + model.do() + self.checkPointOnEllipse(self.myOrigin.coordinates(), self.myEllipse) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestConstraintCoincidenceEllipticArc.py b/src/SketchPlugin/Test/TestConstraintCoincidenceEllipticArc.py index 2c8e85480..7b5efb9d6 100644 --- a/src/SketchPlugin/Test/TestConstraintCoincidenceEllipticArc.py +++ b/src/SketchPlugin/Test/TestConstraintCoincidenceEllipticArc.py @@ -31,268 +31,302 @@ from SketchAPI import * __updated__ = "2019-10-02" + class TestCoincidenceEllipticArc(unittest.TestCase): - def setUp(self): - center = GeomAPI_Pnt2d(-10., 5.) - axisEnd = GeomAPI_Pnt2d(40., -5.) - startPoint = GeomAPI_Pnt2d(20., 5.) - endPoint = GeomAPI_Pnt2d(-40., 5.) - - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - macroEllipticArc = self.mySketch.addEllipticArc(center, axisEnd, startPoint, endPoint, False) - self.myDOF = 7 - self.myOrigin = self.mySketch.addPoint("Origin") - self.myOX = self.mySketch.addLine("OX") - model.do() - self.myEllipticArc = SketchAPI_EllipticArc(model.lastSubFeature(self.mySketch, "SketchEllipticArc")) - self.myCenter = macroEllipticArc.center() - self.myFocus1 = macroEllipticArc.focus1() - self.myFocus2 = macroEllipticArc.focus2() - self.myMajorAxis = macroEllipticArc.majorAxis() - self.myMajorStart = macroEllipticArc.majorAxisStart() - self.myMajorEnd = macroEllipticArc.majorAxisEnd() - self.myMinorAxis = macroEllipticArc.minorAxis() - self.myMinorStart = macroEllipticArc.minorAxisStart() - self.myMinorEnd = macroEllipticArc.minorAxisEnd() - self.myExpectFailure = False - - def tearDown(self): - model.end() - if self.myExpectFailure: - assert(self.mySketch.solverError() != ""), "PlaneGCS limitation: if you see this message, then PlaneGCS has solved the set of constraints correctly" - model.undo() - else: - self.checkDOF() - self.assertPoints(self.myCenter.coordinates(), self.myEllipticArc.center()) - self.assertPoints(self.myFocus1.coordinates(), self.myEllipticArc.firstFocus()) - self.assertPoints(self.myFocus2.coordinates(), self.myEllipticArc.secondFocus()) - self.assertPoints(self.myMajorStart.coordinates(), self.myEllipticArc.majorAxisNegative()) - self.assertPoints(self.myMajorEnd.coordinates(), self.myEllipticArc.majorAxisPositive()) - self.assertPoints(self.myMajorAxis.startPoint(), self.myEllipticArc.majorAxisNegative()) - self.assertPoints(self.myMajorAxis.endPoint(), self.myEllipticArc.majorAxisPositive()) - self.assertPoints(self.myMinorStart.coordinates(), self.myEllipticArc.minorAxisNegative()) - self.assertPoints(self.myMinorEnd.coordinates(), self.myEllipticArc.minorAxisPositive()) - self.assertPoints(self.myMinorAxis.startPoint(), self.myEllipticArc.minorAxisNegative()) - self.assertPoints(self.myMinorAxis.endPoint(), self.myEllipticArc.minorAxisPositive()) - model.testNbSubFeatures(self.mySketch, "SketchPoint", 8) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidenceInternal", 11) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkPointFixing(self, thePoint): - self.mySketch.setCoincident(thePoint, self.myOrigin.coordinates()) - self.myDOF -= 2 - model.do() - if not self.myExpectFailure: - self.assertPoints(thePoint, self.myOrigin.coordinates()) - self.assertGreater(self.myEllipticArc.majorRadius().value(), 0.0) - self.assertGreater(self.myEllipticArc.minorRadius().value(), 0.0) - - def assertPoints(self, thePoint1, thePoint2): - self.assertAlmostEqual(thePoint1.x(), thePoint2.x()) - self.assertAlmostEqual(thePoint1.y(), thePoint2.y()) - - def checkPointOnAxis(self, thePoint): - self.mySketch.setCoincident(thePoint, self.myOX.result()) - self.myDOF -= 1 - model.do() - if not self.myExpectFailure: - self.assertAlmostEqual(thePoint.y(), 0.0) - self.assertGreater(self.myEllipticArc.majorRadius().value(), 0.0) - self.assertGreater(self.myEllipticArc.minorRadius().value(), 0.0) - - def checkPointOnLine(self, thePoint, theLineStart, theLineEnd): - vecP = [thePoint.x() - theLineStart.x(), thePoint.y() - theLineStart.y()] - vecL = [theLineEnd.x() - theLineStart.x(), theLineEnd.y() - theLineStart.y()] - dist = math.fabs(vecP[0] * vecL[1] - vecP[1] * vecL[0]) / math.hypot(vecL[0], vecL[1]) - - self.assertAlmostEqual(dist, 0.0) - self.assertGreater(self.myEllipticArc.majorRadius().value(), 0.0) - self.assertGreater(self.myEllipticArc.minorRadius().value(), 0.0) - - def checkPointOnEllipse(self, thePoint, theEllipse): - firstFocus2d = GeomAPI_Pnt2d(theEllipse.firstFocus().x(), theEllipse.firstFocus().y()) - distPF1 = model.distancePointPoint(firstFocus2d, thePoint) - secondFocus2d = GeomAPI_Pnt2d(theEllipse.secondFocus().x(), theEllipse.secondFocus().y()) - distPF2 = model.distancePointPoint(secondFocus2d, thePoint) - self.assertAlmostEqual(distPF1 + distPF2, 2.0 * theEllipse.majorRadius().value(), 7) - - - def test_concident_center(self): - """ Test 1. Make center of elliptic arc coincident with the Origin - """ - self.checkPointFixing(self.myCenter.coordinates()) - - def test_coincident_first_focus(self): - """ Test 2. Make first focus of elliptic arc coincident with the Origin - """ - self.checkPointFixing(self.myFocus1.coordinates()) - - def test_coincident_second_focus(self): - """ Test 3. Make second focus of elliptic arc coincident with the Origin - """ - self.checkPointFixing(self.myFocus2.coordinates()) - - def test_coincident_major_axis_start(self): - """ Test 4. Make start point on the major axis of elliptic arc coincident with the Origin - """ - self.checkPointFixing(self.myMajorStart.coordinates()) - - def test_coincident_major_axis_end(self): - """ Test 5. Make end point on the major axis of elliptic arc coincident with the Origin - """ - self.checkPointFixing(self.myMajorEnd.coordinates()) - - def test_coincident_minor_axis_start(self): - """ Test 6. Make start point on the minor axis of elliptic arc coincident with the Origin - """ - self.checkPointFixing(self.myMinorStart.coordinates()) - - def test_coincident_minor_axis_end(self): - """ Test 7. Make end point on the minor axis of elliptic arc coincident with the Origin. - Check solver is failed to compute the coincidence. - """ - self.myExpectFailure = True - self.checkPointFixing(self.myMinorEnd.coordinates()) - - def test_coincident_start(self): - """ Test 8. Make start point of elliptic arc coincident with the Origin. - Check solver is failed to compute the coincidence. - """ - self.myExpectFailure = True - self.checkPointFixing(self.myEllipticArc.startPoint()) - - def test_coincident_end(self): - """ Test 9. Make end point of elliptic arc coincident with the Origin - """ - self.checkPointFixing(self.myEllipticArc.endPoint()) - - - def test_center_on_line(self): - """ Test 10. Make center of elliptic arc coincident with the OX - """ - self.checkPointOnAxis(self.myCenter.coordinates()) - - def test_first_focus_on_line(self): - """ Test 11. Make first focus of elliptic arc coincident with the OX - """ - self.checkPointOnAxis(self.myFocus1.coordinates()) - - def test_second_focus_on_line(self): - """ Test 12. Make second focus of elliptic arc coincident with the OX - """ - self.checkPointOnAxis(self.myFocus2.coordinates()) - - def test_major_axis_start_on_line(self): - """ Test 13. Make start point on the major axis of elliptic arc coincident with the OX - """ - self.checkPointOnAxis(self.myMajorStart.coordinates()) - - def test_major_axis_end_on_line(self): - """ Test 14. Make end point on the major axis of elliptic arc coincident with the OX - """ - self.checkPointOnAxis(self.myMajorEnd.coordinates()) - - def test_minor_axis_start_on_line(self): - """ Test 15. Make start point on the minor axis of elliptic arc coincident with the OX - """ - self.checkPointOnAxis(self.myMinorStart.coordinates()) - - def test_minor_axis_end_on_line(self): - """ Test 16. Make end point on the minor axis of elliptic arc coincident with the OX - """ - self.myExpectFailure = True - self.checkPointOnAxis(self.myMinorEnd.coordinates()) - - def test_coincident_start_on_line(self): - """ Test 17. Make start point of elliptic arc coincident with the OX - """ - self.checkPointOnAxis(self.myEllipticArc.startPoint()) - - def test_coincident_end_on_line(self): - """ Test 18. Make end point of elliptic arc coincident with the OX - """ - self.checkPointOnAxis(self.myEllipticArc.endPoint()) - - - def test_origin_on_major_axis(self): - """ Test 19. Make origin coincident with the major axis of the elliptic arc - """ - self.mySketch.setCoincident(self.myMajorAxis.result(), self.myOrigin.coordinates()) - self.myDOF -= 1 - model.do() - self.checkPointOnLine(self.myOrigin.coordinates(), self.myMajorStart.coordinates(), self.myMajorEnd.coordinates()) - - def test_origin_on_minor_axis(self): - """ Test 20. Make origin coincident with the minor axis of the elliptic arc - """ - self.mySketch.setCoincident(self.myMinorAxis.result(), self.myOrigin.coordinates()) - self.myDOF -= 1 - model.end() - # solver shows wrong result - assert(self.mySketch.solverError() != ""), "PlaneGCS limitation: if you see this message, then PlaneGCS has solved the set of constraints correctly" - model.undo() - - # move elliptic arc and set coincidence once again - model.begin() - self.mySketch.move(self.myMinorStart, 20, 10) - model.do() - self.mySketch.setCoincident(self.myMinorAxis.results()[-1], self.myOrigin.coordinates()) - model.do() - self.checkPointOnLine(self.myOrigin.coordinates(), self.myMinorStart.coordinates(), self.myMinorEnd.coordinates()) - - - def test_origin_on_ellipse(self): - """ Test 21. Make origin coincident with the elliptic arc - """ - self.mySketch.setCoincident(self.myEllipticArc.results()[-1], self.myOrigin.coordinates()) - self.myDOF -= 1 - model.do() - self.checkPointOnEllipse(self.myOrigin.coordinates(), self.myEllipticArc) - - - def test_start_on_major_axis(self): - """ Test 22. Make coincident the start point of the arc and the end of its major axis - """ - self.myEllipticArc.startPoint().setValue(38, -2) - model.do() - self.mySketch.setCoincident(self.myEllipticArc.startPoint(), self.myMajorAxis.endPoint()) - self.myDOF -= 1 - model.do() - self.assertPoints(self.myMajorAxis.endPoint(), self.myEllipticArc.startPoint()) - - def test_end_on_major_axis(self): - """ Test 23. Make coincident the end point of the arc and the start of its major axis - """ - self.myEllipticArc.endPoint().setValue(-58, 12) - model.do() - self.mySketch.setCoincident(self.myMajorAxis.startPoint(), self.myEllipticArc.endPoint()) - self.myDOF -= 1 - model.do() - self.assertPoints(self.myMajorAxis.startPoint(), self.myEllipticArc.endPoint()) - - def test_start_on_minor_axis(self): - """ Test 22. Make coincident the start point of the arc and the end of its minor axis - """ - self.mySketch.setCoincident(self.myMinorAxis.endPoint(), self.myEllipticArc.startPoint()) - self.myDOF -= 1 - model.do() - self.assertPoints(self.myMinorAxis.endPoint(), self.myEllipticArc.startPoint()) - - def test_end_on_minor_axis(self): - """ Test 23. Make coincident the end point of the arc and the start of its minor axis - """ - self.mySketch.setCoincident(self.myEllipticArc.endPoint(), self.myMinorAxis.startPoint()) - self.myDOF -= 1 - model.do() - self.assertPoints(self.myMinorAxis.startPoint(), self.myEllipticArc.endPoint()) + def setUp(self): + center = GeomAPI_Pnt2d(-10.0, 5.0) + axisEnd = GeomAPI_Pnt2d(40.0, -5.0) + startPoint = GeomAPI_Pnt2d(20.0, 5.0) + endPoint = GeomAPI_Pnt2d(-40.0, 5.0) + + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + macroEllipticArc = self.mySketch.addEllipticArc( + center, axisEnd, startPoint, endPoint, False + ) + self.myDOF = 7 + self.myOrigin = self.mySketch.addPoint("Origin") + self.myOX = self.mySketch.addLine("OX") + model.do() + self.myEllipticArc = SketchAPI_EllipticArc( + model.lastSubFeature(self.mySketch, "SketchEllipticArc") + ) + self.myCenter = macroEllipticArc.center() + self.myFocus1 = macroEllipticArc.focus1() + self.myFocus2 = macroEllipticArc.focus2() + self.myMajorAxis = macroEllipticArc.majorAxis() + self.myMajorStart = macroEllipticArc.majorAxisStart() + self.myMajorEnd = macroEllipticArc.majorAxisEnd() + self.myMinorAxis = macroEllipticArc.minorAxis() + self.myMinorStart = macroEllipticArc.minorAxisStart() + self.myMinorEnd = macroEllipticArc.minorAxisEnd() + self.myExpectFailure = False + + def tearDown(self): + model.end() + if self.myExpectFailure: + assert ( + self.mySketch.solverError() != "" + ), "PlaneGCS limitation: if you see this message, then PlaneGCS has solved the set of constraints correctly" + model.undo() + else: + self.checkDOF() + self.assertPoints(self.myCenter.coordinates(), self.myEllipticArc.center()) + self.assertPoints( + self.myFocus1.coordinates(), self.myEllipticArc.firstFocus() + ) + self.assertPoints( + self.myFocus2.coordinates(), self.myEllipticArc.secondFocus() + ) + self.assertPoints( + self.myMajorStart.coordinates(), self.myEllipticArc.majorAxisNegative() + ) + self.assertPoints( + self.myMajorEnd.coordinates(), self.myEllipticArc.majorAxisPositive() + ) + self.assertPoints( + self.myMajorAxis.startPoint(), self.myEllipticArc.majorAxisNegative() + ) + self.assertPoints( + self.myMajorAxis.endPoint(), self.myEllipticArc.majorAxisPositive() + ) + self.assertPoints( + self.myMinorStart.coordinates(), self.myEllipticArc.minorAxisNegative() + ) + self.assertPoints( + self.myMinorEnd.coordinates(), self.myEllipticArc.minorAxisPositive() + ) + self.assertPoints( + self.myMinorAxis.startPoint(), self.myEllipticArc.minorAxisNegative() + ) + self.assertPoints( + self.myMinorAxis.endPoint(), self.myEllipticArc.minorAxisPositive() + ) + model.testNbSubFeatures(self.mySketch, "SketchPoint", 8) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintCoincidenceInternal", 11 + ) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointFixing(self, thePoint): + self.mySketch.setCoincident(thePoint, self.myOrigin.coordinates()) + self.myDOF -= 2 + model.do() + if not self.myExpectFailure: + self.assertPoints(thePoint, self.myOrigin.coordinates()) + self.assertGreater(self.myEllipticArc.majorRadius().value(), 0.0) + self.assertGreater(self.myEllipticArc.minorRadius().value(), 0.0) + + def assertPoints(self, thePoint1, thePoint2): + self.assertAlmostEqual(thePoint1.x(), thePoint2.x()) + self.assertAlmostEqual(thePoint1.y(), thePoint2.y()) + + def checkPointOnAxis(self, thePoint): + self.mySketch.setCoincident(thePoint, self.myOX.result()) + self.myDOF -= 1 + model.do() + if not self.myExpectFailure: + self.assertAlmostEqual(thePoint.y(), 0.0) + self.assertGreater(self.myEllipticArc.majorRadius().value(), 0.0) + self.assertGreater(self.myEllipticArc.minorRadius().value(), 0.0) + + def checkPointOnLine(self, thePoint, theLineStart, theLineEnd): + vecP = [thePoint.x() - theLineStart.x(), thePoint.y() - theLineStart.y()] + vecL = [theLineEnd.x() - theLineStart.x(), theLineEnd.y() - theLineStart.y()] + dist = math.fabs(vecP[0] * vecL[1] - vecP[1] * vecL[0]) / math.hypot( + vecL[0], vecL[1] + ) + + self.assertAlmostEqual(dist, 0.0) + self.assertGreater(self.myEllipticArc.majorRadius().value(), 0.0) + self.assertGreater(self.myEllipticArc.minorRadius().value(), 0.0) + + def checkPointOnEllipse(self, thePoint, theEllipse): + firstFocus2d = GeomAPI_Pnt2d( + theEllipse.firstFocus().x(), theEllipse.firstFocus().y() + ) + distPF1 = model.distancePointPoint(firstFocus2d, thePoint) + secondFocus2d = GeomAPI_Pnt2d( + theEllipse.secondFocus().x(), theEllipse.secondFocus().y() + ) + distPF2 = model.distancePointPoint(secondFocus2d, thePoint) + self.assertAlmostEqual( + distPF1 + distPF2, 2.0 * theEllipse.majorRadius().value(), 7 + ) + + def test_concident_center(self): + """Test 1. Make center of elliptic arc coincident with the Origin""" + self.checkPointFixing(self.myCenter.coordinates()) + + def test_coincident_first_focus(self): + """Test 2. Make first focus of elliptic arc coincident with the Origin""" + self.checkPointFixing(self.myFocus1.coordinates()) + + def test_coincident_second_focus(self): + """Test 3. Make second focus of elliptic arc coincident with the Origin""" + self.checkPointFixing(self.myFocus2.coordinates()) + + def test_coincident_major_axis_start(self): + """Test 4. Make start point on the major axis of elliptic arc coincident with the Origin""" + self.checkPointFixing(self.myMajorStart.coordinates()) + + def test_coincident_major_axis_end(self): + """Test 5. Make end point on the major axis of elliptic arc coincident with the Origin""" + self.checkPointFixing(self.myMajorEnd.coordinates()) + + def test_coincident_minor_axis_start(self): + """Test 6. Make start point on the minor axis of elliptic arc coincident with the Origin""" + self.checkPointFixing(self.myMinorStart.coordinates()) + + def test_coincident_minor_axis_end(self): + """Test 7. Make end point on the minor axis of elliptic arc coincident with the Origin. + Check solver is failed to compute the coincidence. + """ + self.myExpectFailure = True + self.checkPointFixing(self.myMinorEnd.coordinates()) + + def test_coincident_start(self): + """Test 8. Make start point of elliptic arc coincident with the Origin. + Check solver is failed to compute the coincidence. + """ + self.myExpectFailure = True + self.checkPointFixing(self.myEllipticArc.startPoint()) + + def test_coincident_end(self): + """Test 9. Make end point of elliptic arc coincident with the Origin""" + self.checkPointFixing(self.myEllipticArc.endPoint()) + + def test_center_on_line(self): + """Test 10. Make center of elliptic arc coincident with the OX""" + self.checkPointOnAxis(self.myCenter.coordinates()) + + def test_first_focus_on_line(self): + """Test 11. Make first focus of elliptic arc coincident with the OX""" + self.checkPointOnAxis(self.myFocus1.coordinates()) + + def test_second_focus_on_line(self): + """Test 12. Make second focus of elliptic arc coincident with the OX""" + self.checkPointOnAxis(self.myFocus2.coordinates()) + + def test_major_axis_start_on_line(self): + """Test 13. Make start point on the major axis of elliptic arc coincident with the OX""" + self.checkPointOnAxis(self.myMajorStart.coordinates()) + + def test_major_axis_end_on_line(self): + """Test 14. Make end point on the major axis of elliptic arc coincident with the OX""" + self.checkPointOnAxis(self.myMajorEnd.coordinates()) + + def test_minor_axis_start_on_line(self): + """Test 15. Make start point on the minor axis of elliptic arc coincident with the OX""" + self.checkPointOnAxis(self.myMinorStart.coordinates()) + + def test_minor_axis_end_on_line(self): + """Test 16. Make end point on the minor axis of elliptic arc coincident with the OX""" + self.myExpectFailure = True + self.checkPointOnAxis(self.myMinorEnd.coordinates()) + + def test_coincident_start_on_line(self): + """Test 17. Make start point of elliptic arc coincident with the OX""" + self.checkPointOnAxis(self.myEllipticArc.startPoint()) + + def test_coincident_end_on_line(self): + """Test 18. Make end point of elliptic arc coincident with the OX""" + self.checkPointOnAxis(self.myEllipticArc.endPoint()) + + def test_origin_on_major_axis(self): + """Test 19. Make origin coincident with the major axis of the elliptic arc""" + self.mySketch.setCoincident( + self.myMajorAxis.result(), self.myOrigin.coordinates() + ) + self.myDOF -= 1 + model.do() + self.checkPointOnLine( + self.myOrigin.coordinates(), + self.myMajorStart.coordinates(), + self.myMajorEnd.coordinates(), + ) + + def test_origin_on_minor_axis(self): + """Test 20. Make origin coincident with the minor axis of the elliptic arc""" + self.mySketch.setCoincident( + self.myMinorAxis.result(), self.myOrigin.coordinates() + ) + self.myDOF -= 1 + model.end() + # solver shows wrong result + assert ( + self.mySketch.solverError() != "" + ), "PlaneGCS limitation: if you see this message, then PlaneGCS has solved the set of constraints correctly" + model.undo() + + # move elliptic arc and set coincidence once again + model.begin() + self.mySketch.move(self.myMinorStart, 20, 10) + model.do() + self.mySketch.setCoincident( + self.myMinorAxis.results()[-1], self.myOrigin.coordinates() + ) + model.do() + self.checkPointOnLine( + self.myOrigin.coordinates(), + self.myMinorStart.coordinates(), + self.myMinorEnd.coordinates(), + ) + + def test_origin_on_ellipse(self): + """Test 21. Make origin coincident with the elliptic arc""" + self.mySketch.setCoincident( + self.myEllipticArc.results()[-1], self.myOrigin.coordinates() + ) + self.myDOF -= 1 + model.do() + self.checkPointOnEllipse(self.myOrigin.coordinates(), self.myEllipticArc) + + def test_start_on_major_axis(self): + """Test 22. Make coincident the start point of the arc and the end of its major axis""" + self.myEllipticArc.startPoint().setValue(38, -2) + model.do() + self.mySketch.setCoincident( + self.myEllipticArc.startPoint(), self.myMajorAxis.endPoint() + ) + self.myDOF -= 1 + model.do() + self.assertPoints(self.myMajorAxis.endPoint(), self.myEllipticArc.startPoint()) + + def test_end_on_major_axis(self): + """Test 23. Make coincident the end point of the arc and the start of its major axis""" + self.myEllipticArc.endPoint().setValue(-58, 12) + model.do() + self.mySketch.setCoincident( + self.myMajorAxis.startPoint(), self.myEllipticArc.endPoint() + ) + self.myDOF -= 1 + model.do() + self.assertPoints(self.myMajorAxis.startPoint(), self.myEllipticArc.endPoint()) + + def test_start_on_minor_axis(self): + """Test 22. Make coincident the start point of the arc and the end of its minor axis""" + self.mySketch.setCoincident( + self.myMinorAxis.endPoint(), self.myEllipticArc.startPoint() + ) + self.myDOF -= 1 + model.do() + self.assertPoints(self.myMinorAxis.endPoint(), self.myEllipticArc.startPoint()) + + def test_end_on_minor_axis(self): + """Test 23. Make coincident the end point of the arc and the start of its minor axis""" + self.mySketch.setCoincident( + self.myEllipticArc.endPoint(), self.myMinorAxis.startPoint() + ) + self.myDOF -= 1 + model.do() + self.assertPoints(self.myMinorAxis.startPoint(), self.myEllipticArc.endPoint()) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestConstraintCollinear.py b/src/SketchPlugin/Test/TestConstraintCollinear.py index adc12ea51..c60fda05e 100644 --- a/src/SketchPlugin/Test/TestConstraintCollinear.py +++ b/src/SketchPlugin/Test/TestConstraintCollinear.py @@ -28,9 +28,9 @@ """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from GeomDataAPI import * from ModelAPI import * @@ -40,153 +40,168 @@ from salome.shaper import model __updated__ = "2017-03-06" + class TestConstraintCollinear(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myTolerance = 1.e-6 - self.myDOF = 0 - - def tearDown(self): - model.end() - assert(model.checkPythonDump()) - - def checkVectorCollinearity(self, theX1, theY1, theX2, theY2): - aLen1 = math.hypot(theX1, theY1) - aLen2 = math.hypot(theX2, theY2) - aDot = theX1 * theX2 + theY1 * theY2 - self.assertTrue(math.fabs(math.fabs(aDot) - aLen1 * aLen2) < self.myTolerance**2, "Vectors ({0}, {1}) and ({2}, {3}) do not collinear".format(theX1, theY1, theX2, theY2)) - - def checkLineCollinearity(self, theLine1, theLine2): - aStartPoint1 = theLine1.startPoint() - aEndPoint1 = theLine1.endPoint() - aStartPoint2 = theLine2.startPoint() - aEndPoint2 = theLine2.endPoint() - - aDir1x, aDir1y = aEndPoint1.x() - aStartPoint1.x(), aEndPoint1.y() - aStartPoint1.y() - aDir2x, aDir2y = aEndPoint2.x() - aStartPoint1.x(), aEndPoint2.y() - aStartPoint1.y() - aDir3x, aDir3y = aStartPoint2.x() - aStartPoint1.x(), aStartPoint2.y() - aStartPoint1.y() - self.checkVectorCollinearity(aDir1x, aDir1y, aDir2x, aDir2y) - self.checkVectorCollinearity(aDir1x, aDir1y, aDir3x, aDir3y) - - def moveLineAndCheckCollinearity(self, theLine1, theLine2): - deltaX = deltaY = 10. - - theLine1.startPoint().setValue(theLine1.startPoint().x() + deltaX, theLine1.startPoint().y() + deltaY) - model.do() - self.checkLineCollinearity(theLine1, theLine2) - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - theLine1.endPoint().setValue(theLine1.endPoint().x() - deltaX, theLine1.endPoint().y() - deltaY) - model.do() - self.checkLineCollinearity(theLine1, theLine2) - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def test_collinear_base(self): - """ Test 1. Collinearity two independent lines - """ - aSketchLineA = self.mySketch.addLine(0., 25., 85., 25.) - aSketchLineB = self.mySketch.addLine(0., 50., 80., 75.) - self.myDOF += 8 - self.assertEqual(model.dof(self.mySketch), self.myDOF) - self.mySketch.setCollinear(aSketchLineA, aSketchLineB) - self.myDOF -= 2 - model.do() - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - self.checkLineCollinearity(aSketchLineA, aSketchLineB) - self.moveLineAndCheckCollinearity(aSketchLineA, aSketchLineB) - - def test_collinear_connected_lines(self): - """ Test 2. Collinearity of two lines in polyline - """ - aSketchLineA = self.mySketch.addLine(10., 20., 30., 40.) - aSketchLineB = self.mySketch.addLine(30., 40., 30., 70.) - self.myDOF += 8 - self.assertEqual(model.dof(self.mySketch), self.myDOF) - self.mySketch.setCoincident(aSketchLineA.endPoint(), aSketchLineB.startPoint()) - self.myDOF -= 2 - model.do() - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - self.mySketch.setCollinear(aSketchLineA, aSketchLineB) - self.myDOF -= 1 - model.do() - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - self.checkLineCollinearity(aSketchLineA, aSketchLineB) - self.moveLineAndCheckCollinearity(aSketchLineA, aSketchLineB) - - def test_collinear_point_on_line(self): - """ Test 3. Collinearity for line which extremity is coincident with other line - """ - aSketchLineA = self.mySketch.addLine(10., 20., 30., 40.) - aSketchLineB = self.mySketch.addLine(20., 40., 30., 70.) - self.myDOF += 8 - self.assertEqual(model.dof(self.mySketch), self.myDOF) - self.mySketch.setCoincident(aSketchLineA.result(), aSketchLineB.startPoint()) - self.myDOF -= 1 - model.do() - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - self.mySketch.setCollinear(aSketchLineA, aSketchLineB) - self.myDOF -= 1 - model.do() - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - self.checkLineCollinearity(aSketchLineA, aSketchLineB) - self.moveLineAndCheckCollinearity(aSketchLineA, aSketchLineB) - - def test_already_collinear(self): - """ Test 4. Collinearity two lines connected by extremities to each other - """ - aSketchLineA = self.mySketch.addLine(10., 20., 40., 50.) - aSketchLineB = self.mySketch.addLine(20., 40., 40., 70.) - self.myDOF += 8 - self.assertEqual(model.dof(self.mySketch), self.myDOF) - self.mySketch.setCoincident(aSketchLineA.result(), aSketchLineB.startPoint()) - self.mySketch.setCoincident(aSketchLineA.endPoint(), aSketchLineB.result()) - self.myDOF -= 2 - model.do() - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - aCollinear = self.mySketch.setCollinear(aSketchLineA, aSketchLineB) - model.do() - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - # check error message and remove non valid constraint - self.assertNotEqual(self.mySketch.solverError().value(), "") - self.myDocument.removeFeature(aCollinear.feature()) - model.do() - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def test_already_collinear2(self): - """ Test 5. Collinearity of two lines when one line is fully on other - """ - aSketchLineA = self.mySketch.addLine(10., 20., 30., 40.) - aSketchLineB = self.mySketch.addLine(20., 40., 30., 70.) - self.myDOF += 8 - self.assertEqual(model.dof(self.mySketch), self.myDOF) - self.mySketch.setCoincident(aSketchLineA.result(), aSketchLineB.startPoint()) - self.mySketch.setCoincident(aSketchLineA.result(), aSketchLineB.endPoint()) - self.myDOF -= 2 - model.do() - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - aCollinear = self.mySketch.setCollinear(aSketchLineA, aSketchLineB) - model.do() - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - # check error message and remove non valid constraint - self.assertNotEqual(self.mySketch.solverError().value(), "") - self.myDocument.removeFeature(aCollinear.feature()) - model.do() - self.assertEqual(model.dof(self.mySketch), self.myDOF) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myTolerance = 1.0e-6 + self.myDOF = 0 + + def tearDown(self): + model.end() + assert model.checkPythonDump() + + def checkVectorCollinearity(self, theX1, theY1, theX2, theY2): + aLen1 = math.hypot(theX1, theY1) + aLen2 = math.hypot(theX2, theY2) + aDot = theX1 * theX2 + theY1 * theY2 + self.assertTrue( + math.fabs(math.fabs(aDot) - aLen1 * aLen2) < self.myTolerance**2, + "Vectors ({0}, {1}) and ({2}, {3}) do not collinear".format( + theX1, theY1, theX2, theY2 + ), + ) + + def checkLineCollinearity(self, theLine1, theLine2): + aStartPoint1 = theLine1.startPoint() + aEndPoint1 = theLine1.endPoint() + aStartPoint2 = theLine2.startPoint() + aEndPoint2 = theLine2.endPoint() + + aDir1x, aDir1y = ( + aEndPoint1.x() - aStartPoint1.x(), + aEndPoint1.y() - aStartPoint1.y(), + ) + aDir2x, aDir2y = ( + aEndPoint2.x() - aStartPoint1.x(), + aEndPoint2.y() - aStartPoint1.y(), + ) + aDir3x, aDir3y = ( + aStartPoint2.x() - aStartPoint1.x(), + aStartPoint2.y() - aStartPoint1.y(), + ) + self.checkVectorCollinearity(aDir1x, aDir1y, aDir2x, aDir2y) + self.checkVectorCollinearity(aDir1x, aDir1y, aDir3x, aDir3y) + + def moveLineAndCheckCollinearity(self, theLine1, theLine2): + deltaX = deltaY = 10.0 + + theLine1.startPoint().setValue( + theLine1.startPoint().x() + deltaX, theLine1.startPoint().y() + deltaY + ) + model.do() + self.checkLineCollinearity(theLine1, theLine2) + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + theLine1.endPoint().setValue( + theLine1.endPoint().x() - deltaX, theLine1.endPoint().y() - deltaY + ) + model.do() + self.checkLineCollinearity(theLine1, theLine2) + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def test_collinear_base(self): + """Test 1. Collinearity two independent lines""" + aSketchLineA = self.mySketch.addLine(0.0, 25.0, 85.0, 25.0) + aSketchLineB = self.mySketch.addLine(0.0, 50.0, 80.0, 75.0) + self.myDOF += 8 + self.assertEqual(model.dof(self.mySketch), self.myDOF) + self.mySketch.setCollinear(aSketchLineA, aSketchLineB) + self.myDOF -= 2 + model.do() + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + self.checkLineCollinearity(aSketchLineA, aSketchLineB) + self.moveLineAndCheckCollinearity(aSketchLineA, aSketchLineB) + + def test_collinear_connected_lines(self): + """Test 2. Collinearity of two lines in polyline""" + aSketchLineA = self.mySketch.addLine(10.0, 20.0, 30.0, 40.0) + aSketchLineB = self.mySketch.addLine(30.0, 40.0, 30.0, 70.0) + self.myDOF += 8 + self.assertEqual(model.dof(self.mySketch), self.myDOF) + self.mySketch.setCoincident(aSketchLineA.endPoint(), aSketchLineB.startPoint()) + self.myDOF -= 2 + model.do() + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + self.mySketch.setCollinear(aSketchLineA, aSketchLineB) + self.myDOF -= 1 + model.do() + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + self.checkLineCollinearity(aSketchLineA, aSketchLineB) + self.moveLineAndCheckCollinearity(aSketchLineA, aSketchLineB) + + def test_collinear_point_on_line(self): + """Test 3. Collinearity for line which extremity is coincident with other line""" + aSketchLineA = self.mySketch.addLine(10.0, 20.0, 30.0, 40.0) + aSketchLineB = self.mySketch.addLine(20.0, 40.0, 30.0, 70.0) + self.myDOF += 8 + self.assertEqual(model.dof(self.mySketch), self.myDOF) + self.mySketch.setCoincident(aSketchLineA.result(), aSketchLineB.startPoint()) + self.myDOF -= 1 + model.do() + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + self.mySketch.setCollinear(aSketchLineA, aSketchLineB) + self.myDOF -= 1 + model.do() + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + self.checkLineCollinearity(aSketchLineA, aSketchLineB) + self.moveLineAndCheckCollinearity(aSketchLineA, aSketchLineB) + + def test_already_collinear(self): + """Test 4. Collinearity two lines connected by extremities to each other""" + aSketchLineA = self.mySketch.addLine(10.0, 20.0, 40.0, 50.0) + aSketchLineB = self.mySketch.addLine(20.0, 40.0, 40.0, 70.0) + self.myDOF += 8 + self.assertEqual(model.dof(self.mySketch), self.myDOF) + self.mySketch.setCoincident(aSketchLineA.result(), aSketchLineB.startPoint()) + self.mySketch.setCoincident(aSketchLineA.endPoint(), aSketchLineB.result()) + self.myDOF -= 2 + model.do() + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + aCollinear = self.mySketch.setCollinear(aSketchLineA, aSketchLineB) + model.do() + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + # check error message and remove non valid constraint + self.assertNotEqual(self.mySketch.solverError().value(), "") + self.myDocument.removeFeature(aCollinear.feature()) + model.do() + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def test_already_collinear2(self): + """Test 5. Collinearity of two lines when one line is fully on other""" + aSketchLineA = self.mySketch.addLine(10.0, 20.0, 30.0, 40.0) + aSketchLineB = self.mySketch.addLine(20.0, 40.0, 30.0, 70.0) + self.myDOF += 8 + self.assertEqual(model.dof(self.mySketch), self.myDOF) + self.mySketch.setCoincident(aSketchLineA.result(), aSketchLineB.startPoint()) + self.mySketch.setCoincident(aSketchLineA.result(), aSketchLineB.endPoint()) + self.myDOF -= 2 + model.do() + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + aCollinear = self.mySketch.setCollinear(aSketchLineA, aSketchLineB) + model.do() + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + # check error message and remove non valid constraint + self.assertNotEqual(self.mySketch.solverError().value(), "") + self.myDocument.removeFeature(aCollinear.feature()) + model.do() + self.assertEqual(model.dof(self.mySketch), self.myDOF) + if __name__ == "__main__": test_program = unittest.main(exit=False) assert test_program.result.wasSuccessful(), "Test failed" -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= diff --git a/src/SketchPlugin/Test/TestConstraintCollinearEllipse.py b/src/SketchPlugin/Test/TestConstraintCollinearEllipse.py index 0ad75b820..1f0f2cffb 100644 --- a/src/SketchPlugin/Test/TestConstraintCollinearEllipse.py +++ b/src/SketchPlugin/Test/TestConstraintCollinearEllipse.py @@ -31,101 +31,118 @@ from SketchAPI import * __updated__ = "2019-09-18" + class TestCollinearEllipse(unittest.TestCase): - def setUp(self): - axisStart = GeomAPI_Pnt2d(30., 60.) - axisEnd = GeomAPI_Pnt2d(80., 50.) - passedPoint = GeomAPI_Pnt2d(60., 60.) - - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - macroEllipse = self.mySketch.addEllipse(axisStart, axisEnd, passedPoint, False) - self.myDOF = 5 - self.myOX = self.mySketch.addLine("OX") - model.do() - self.myEllipse = SketchAPI_Ellipse(model.lastSubFeature(self.mySketch, "SketchEllipse")) - self.myCenter = macroEllipse.center() - self.myFocus1 = macroEllipse.focus1() - self.myFocus2 = macroEllipse.focus2() - self.myMajorAxis = macroEllipse.majorAxis() - self.myMajorStart = macroEllipse.majorAxisStart() - self.myMajorEnd = macroEllipse.majorAxisEnd() - self.myMinorAxis = macroEllipse.minorAxis() - self.myMinorStart = macroEllipse.minorAxisStart() - self.myMinorEnd = macroEllipse.minorAxisEnd() - - - def tearDown(self): - model.end() - self.checkDOF() - self.assertPoints(self.myCenter.coordinates(), self.myEllipse.center()) - self.assertPoints(self.myFocus1.coordinates(), self.myEllipse.firstFocus()) - self.assertPoints(self.myFocus2.coordinates(), self.myEllipse.secondFocus()) - self.assertPoints(self.myMajorStart.coordinates(), self.myEllipse.majorAxisNegative()) - self.assertPoints(self.myMajorEnd.coordinates(), self.myEllipse.majorAxisPositive()) - self.assertPoints(self.myMajorAxis.startPoint(), self.myEllipse.majorAxisNegative()) - self.assertPoints(self.myMajorAxis.endPoint(), self.myEllipse.majorAxisPositive()) - self.assertPoints(self.myMinorStart.coordinates(), self.myEllipse.minorAxisNegative()) - self.assertPoints(self.myMinorEnd.coordinates(), self.myEllipse.minorAxisPositive()) - self.assertPoints(self.myMinorAxis.startPoint(), self.myEllipse.minorAxisNegative()) - self.assertPoints(self.myMinorAxis.endPoint(), self.myEllipse.minorAxisPositive()) - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidenceInternal", 11) - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def assertPoints(self, thePoint1, thePoint2): - self.assertAlmostEqual(thePoint1.x(), thePoint2.x()) - self.assertAlmostEqual(thePoint1.y(), thePoint2.y()) - - - def test_collinear_major_axis(self): - """ Test 1. Make major axis of ellipse collinear with OX - """ - self.mySketch.setCollinear(self.myOX.result(), self.myMajorAxis.result()) - self.myDOF -= 2 - model.do() - self.assertAlmostEqual(self.myMajorAxis.startPoint().y(), 0) - self.assertAlmostEqual(self.myMajorAxis.endPoint().y(), 0) - self.assertAlmostEqual(self.myMajorStart.coordinates().y(), 0) - self.assertAlmostEqual(self.myMajorEnd.coordinates().y(), 0) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCollinear", 1) - - def test_collinear_minor_axis(self): - """ Test 2. Make minor axis of ellipse collinear with OX - """ - self.mySketch.setCollinear(self.myOX.result(), self.myMinorAxis.result()) - self.myDOF -= 2 - model.end() - # solver shows wrong result - assert(self.mySketch.solverError() != ""), "PlaneGCS limitation: if you see this message, then PlaneGCS has solved the set of constraints correctly" - model.undo() - - model.begin() - self.mySketch.move(self.myMinorStart.coordinates(), 0, 70) - self.mySketch.move(self.myMinorEnd.coordinates(), 50, 70) - model.do() - self.mySketch.setCollinear(self.myOX.result(), self.myMinorAxis.result()) - model.do() - self.assertAlmostEqual(self.myMinorAxis.startPoint().y(), 0) - self.assertAlmostEqual(self.myMinorAxis.endPoint().y(), 0) - self.assertAlmostEqual(self.myMinorStart.coordinates().y(), 0) - self.assertAlmostEqual(self.myMinorEnd.coordinates().y(), 0) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCollinear", 1) - - def test_collinear_ellipse_axes(self): - """ Test 3. Set collinear axes of an ellipse. Check conflicting constraints. - """ - self.mySketch.setCollinear(self.myMajorAxis, self.myMinorAxis) - model.end() - self.assertNotEqual(self.mySketch.solverError(), "") - model.undo() - model.begin() + def setUp(self): + axisStart = GeomAPI_Pnt2d(30.0, 60.0) + axisEnd = GeomAPI_Pnt2d(80.0, 50.0) + passedPoint = GeomAPI_Pnt2d(60.0, 60.0) + + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + macroEllipse = self.mySketch.addEllipse(axisStart, axisEnd, passedPoint, False) + self.myDOF = 5 + self.myOX = self.mySketch.addLine("OX") + model.do() + self.myEllipse = SketchAPI_Ellipse( + model.lastSubFeature(self.mySketch, "SketchEllipse") + ) + self.myCenter = macroEllipse.center() + self.myFocus1 = macroEllipse.focus1() + self.myFocus2 = macroEllipse.focus2() + self.myMajorAxis = macroEllipse.majorAxis() + self.myMajorStart = macroEllipse.majorAxisStart() + self.myMajorEnd = macroEllipse.majorAxisEnd() + self.myMinorAxis = macroEllipse.minorAxis() + self.myMinorStart = macroEllipse.minorAxisStart() + self.myMinorEnd = macroEllipse.minorAxisEnd() + + def tearDown(self): + model.end() + self.checkDOF() + self.assertPoints(self.myCenter.coordinates(), self.myEllipse.center()) + self.assertPoints(self.myFocus1.coordinates(), self.myEllipse.firstFocus()) + self.assertPoints(self.myFocus2.coordinates(), self.myEllipse.secondFocus()) + self.assertPoints( + self.myMajorStart.coordinates(), self.myEllipse.majorAxisNegative() + ) + self.assertPoints( + self.myMajorEnd.coordinates(), self.myEllipse.majorAxisPositive() + ) + self.assertPoints( + self.myMajorAxis.startPoint(), self.myEllipse.majorAxisNegative() + ) + self.assertPoints( + self.myMajorAxis.endPoint(), self.myEllipse.majorAxisPositive() + ) + self.assertPoints( + self.myMinorStart.coordinates(), self.myEllipse.minorAxisNegative() + ) + self.assertPoints( + self.myMinorEnd.coordinates(), self.myEllipse.minorAxisPositive() + ) + self.assertPoints( + self.myMinorAxis.startPoint(), self.myEllipse.minorAxisNegative() + ) + self.assertPoints( + self.myMinorAxis.endPoint(), self.myEllipse.minorAxisPositive() + ) + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintCoincidenceInternal", 11 + ) + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def assertPoints(self, thePoint1, thePoint2): + self.assertAlmostEqual(thePoint1.x(), thePoint2.x()) + self.assertAlmostEqual(thePoint1.y(), thePoint2.y()) + + def test_collinear_major_axis(self): + """Test 1. Make major axis of ellipse collinear with OX""" + self.mySketch.setCollinear(self.myOX.result(), self.myMajorAxis.result()) + self.myDOF -= 2 + model.do() + self.assertAlmostEqual(self.myMajorAxis.startPoint().y(), 0) + self.assertAlmostEqual(self.myMajorAxis.endPoint().y(), 0) + self.assertAlmostEqual(self.myMajorStart.coordinates().y(), 0) + self.assertAlmostEqual(self.myMajorEnd.coordinates().y(), 0) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCollinear", 1) + + def test_collinear_minor_axis(self): + """Test 2. Make minor axis of ellipse collinear with OX""" + self.mySketch.setCollinear(self.myOX.result(), self.myMinorAxis.result()) + self.myDOF -= 2 + model.end() + # solver shows wrong result + assert ( + self.mySketch.solverError() != "" + ), "PlaneGCS limitation: if you see this message, then PlaneGCS has solved the set of constraints correctly" + model.undo() + + model.begin() + self.mySketch.move(self.myMinorStart.coordinates(), 0, 70) + self.mySketch.move(self.myMinorEnd.coordinates(), 50, 70) + model.do() + self.mySketch.setCollinear(self.myOX.result(), self.myMinorAxis.result()) + model.do() + self.assertAlmostEqual(self.myMinorAxis.startPoint().y(), 0) + self.assertAlmostEqual(self.myMinorAxis.endPoint().y(), 0) + self.assertAlmostEqual(self.myMinorStart.coordinates().y(), 0) + self.assertAlmostEqual(self.myMinorEnd.coordinates().y(), 0) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCollinear", 1) + + def test_collinear_ellipse_axes(self): + """Test 3. Set collinear axes of an ellipse. Check conflicting constraints.""" + self.mySketch.setCollinear(self.myMajorAxis, self.myMinorAxis) + model.end() + self.assertNotEqual(self.mySketch.solverError(), "") + model.undo() + model.begin() if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestConstraintDistance.py b/src/SketchPlugin/Test/TestConstraintDistance.py index 3b0181b13..dbf7f7683 100644 --- a/src/SketchPlugin/Test/TestConstraintDistance.py +++ b/src/SketchPlugin/Test/TestConstraintDistance.py @@ -43,18 +43,18 @@ from ModelAPI import * import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2014-10-28" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -65,149 +65,175 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create a point and a line -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchPoint = aSketchFeature.addFeature("SketchPoint") -aSketchPointCoords = geomDataAPI_Point2D( - aSketchPoint.attribute("PointCoordinates")) -aSketchPointCoords.setValue(50., 50.) +aSketchPointCoords = geomDataAPI_Point2D(aSketchPoint.attribute("PointCoordinates")) +aSketchPointCoords.setValue(50.0, 50.0) aSketchLine = aSketchFeature.addFeature("SketchLine") aLineAStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) aLineAEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) -aLineAStartPoint.setValue(0., 25.) -aLineAEndPoint.setValue(100., 25.) +aLineAStartPoint.setValue(0.0, 25.0) +aLineAEndPoint.setValue(100.0, 25.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 6) -#========================================================================= +assert model.dof(aSketchFeature) == 6 +# ========================================================================= # Make a constraint to keep the distance -#========================================================================= -PT_PT_DIST = 25. -aDist = model.distancePointPoint(aSketchPointCoords, aLineAStartPoint); -assert (aDist != PT_PT_DIST) +# ========================================================================= +PT_PT_DIST = 25.0 +aDist = model.distancePointPoint(aSketchPointCoords, aLineAStartPoint) +assert aDist != PT_PT_DIST aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintDistance") aDistance = aConstraint.real("ConstraintValue") refattrA = aConstraint.refattr("ConstraintEntityA") refattrB = aConstraint.refattr("ConstraintEntityB") -assert (not aDistance.isInitialized()) -assert (not refattrA.isInitialized()) -assert (not refattrB.isInitialized()) +assert not aDistance.isInitialized() +assert not refattrA.isInitialized() +assert not refattrB.isInitialized() aLineResult = aSketchLine.firstResult() -assert (aLineResult is not None) +assert aLineResult is not None # the following line is necessary to check automatic calculation of a distance aConstraint.execute() refattrA.setAttr(aSketchPointCoords) refattrB.setAttr(aLineAStartPoint) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 5) +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(50.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) -#========================================================================= +assert refattrA.isInitialized() +assert refattrB.isInitialized() +assert aDistance.isInitialized() +assert ( + math.fabs(aDistance.value() - aDist) < 1.0e-4 +), "Distance values are different: {0} != {1}".format(aDistance.value(), aDist) +assert model.dof(aSketchFeature) == 5 +# ========================================================================= # Change distance value -#========================================================================= +# ========================================================================= aSession.startOperation() aDistance.setValue(PT_PT_DIST) aSession.finishOperation() -assert (math.fabs(model.distancePointPoint(aSketchPointCoords, aLineAStartPoint) - PT_PT_DIST) < 1.e-10) -assert (model.dof(aSketchFeature) == 5) -#========================================================================= +assert ( + math.fabs( + model.distancePointPoint(aSketchPointCoords, aLineAStartPoint) - PT_PT_DIST + ) + < 1.0e-10 +) +assert model.dof(aSketchFeature) == 5 +# ========================================================================= # Move line, check that distance is constant -#========================================================================= +# ========================================================================= aSession.startOperation() -aLineAStartPoint.setValue(0., 40.) -aLineAEndPoint.setValue(100., 40.) +aLineAStartPoint.setValue(0.0, 40.0) +aLineAEndPoint.setValue(100.0, 40.0) aSession.finishOperation() -assert (math.fabs(model.distancePointPoint(aSketchPointCoords, aLineAStartPoint) - PT_PT_DIST) < 1.e-10) -assert (model.dof(aSketchFeature) == 5) -#========================================================================= +assert ( + math.fabs( + model.distancePointPoint(aSketchPointCoords, aLineAStartPoint) - PT_PT_DIST + ) + < 1.0e-10 +) +assert model.dof(aSketchFeature) == 5 +# ========================================================================= # Remove constraint, check the points are unconstrained now -#========================================================================= +# ========================================================================= aSession.startOperation() aDocument.removeFeature(aConstraint) aSession.finishOperation() aSession.startOperation() -aSketchPointCoords.setValue(0., 0.) +aSketchPointCoords.setValue(0.0, 0.0) aSession.finishOperation() -assert (math.fabs(model.distancePointPoint(aSketchPointCoords, aLineAStartPoint) - PT_PT_DIST) > 1.e-10) -assert (model.dof(aSketchFeature) == 6) +assert ( + math.fabs( + model.distancePointPoint(aSketchPointCoords, aLineAStartPoint) - PT_PT_DIST + ) + > 1.0e-10 +) +assert model.dof(aSketchFeature) == 6 -#========================================================================= +# ========================================================================= # Add distance between point and line -#========================================================================= -PT_LINE_DIST = 50. +# ========================================================================= +PT_LINE_DIST = 50.0 aDist = model.distancePointLine(aSketchPointCoords, aSketchLine) aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintDistance") aDistance = aConstraint.real("ConstraintValue") refattrA = aConstraint.refattr("ConstraintEntityA") refattrB = aConstraint.refattr("ConstraintEntityB") -assert (not aDistance.isInitialized()) -assert (not refattrA.isInitialized()) -assert (not refattrB.isInitialized()) +assert not aDistance.isInitialized() +assert not refattrA.isInitialized() +assert not refattrB.isInitialized() aLineResult = aSketchLine.firstResult() -assert (aLineResult is not None) +assert aLineResult is not None refattrA.setObject(aLineResult) refattrB.setAttr(aSketchPointCoords) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 5) +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(50.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) +assert refattrA.isInitialized() +assert refattrB.isInitialized() +assert aDistance.isInitialized() +assert ( + math.fabs(aDistance.value() - aDist) < 1.0e-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) +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) -#========================================================================= +assert refattrA.isInitialized() +assert refattrB.isInitialized() +assert aDistance.isInitialized() +assert ( + math.fabs(aDistance.value() - aDist) < 1.0e-4 +), "Distance values are different: {0} != {1}".format(aDistance.value(), aDist) +assert model.dof(aSketchFeature) == 5 +# ========================================================================= # Change distance value -#========================================================================= +# ========================================================================= aSession.startOperation() aDistance.setValue(PT_LINE_DIST) aSession.finishOperation() -assert (math.fabs(model.distancePointLine(aSketchPointCoords, aSketchLine) - PT_LINE_DIST) < 1.e-10) -assert (model.dof(aSketchFeature) == 5) -#========================================================================= +assert ( + math.fabs(model.distancePointLine(aSketchPointCoords, aSketchLine) - PT_LINE_DIST) + < 1.0e-10 +) +assert model.dof(aSketchFeature) == 5 +# ========================================================================= # Set distance between line boundaries -#========================================================================= +# ========================================================================= aSession.startOperation() refattrA.setAttr(aLineAStartPoint) refattrB.setAttr(aLineAEndPoint) aSession.finishOperation() -assert (math.fabs(model.distancePointPoint(aLineAStartPoint, aLineAEndPoint) - PT_LINE_DIST) < 1.e-10) -assert (model.dof(aSketchFeature) == 5) -#========================================================================= +assert ( + math.fabs(model.distancePointPoint(aLineAStartPoint, aLineAEndPoint) - PT_LINE_DIST) + < 1.0e-10 +) +assert model.dof(aSketchFeature) == 5 +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintDistanceBehavior.py b/src/SketchPlugin/Test/TestConstraintDistanceBehavior.py index 720255968..1dbf06862 100644 --- a/src/SketchPlugin/Test/TestConstraintDistanceBehavior.py +++ b/src/SketchPlugin/Test/TestConstraintDistanceBehavior.py @@ -21,7 +21,7 @@ from salome.shaper import model from SketchAPI import * import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 model.begin() partSet = model.moduleDocument() @@ -29,7 +29,7 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() DistanceParam = model.addParameter(Part_1_doc, "distance", "10.") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchRectangle_1 = Sketch_1.addRectangle(20., 20., 70., 50.) +SketchRectangle_1 = Sketch_1.addRectangle(20.0, 20.0, 70.0, 50.0) [SketchLine_1, SketchLine_2, SketchLine_3, SketchLine_4] = SketchRectangle_1.lines() Sketch_1.setVertical(SketchLine_4.result()) firstPoint = SketchAPI_Line(SketchLine_2).startPoint() @@ -40,8 +40,12 @@ model.do() # Test 1. # ============================================================================= # horizontal distance constraint -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(firstPoint, secondPoint, 10) -SketchConstraintDistanceHorizontal_1.feature().real("ConstraintValue").setText(DistanceParam.name().value()) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + firstPoint, secondPoint, 10 +) +SketchConstraintDistanceHorizontal_1.feature().real("ConstraintValue").setText( + DistanceParam.name().value() +) model.do() # changing the parameter @@ -51,7 +55,9 @@ for param in range(11, 31, 2): DistanceParam.setValue(param) model.do() dist = secondPoint.x() - firstPoint.x() - assert math.fabs(dist - param) < TOLERANCE, "Incorrect horizontal distance {}, expected {}".format(dist, param) + assert ( + math.fabs(dist - param) < TOLERANCE + ), "Incorrect horizontal distance {}, expected {}".format(dist, param) model.testNbSubFeatures(Sketch_1, "SketchLine", 4) model.testNbSubFeatures(Sketch_1, "SketchConstraintDistanceHorizontal", 1) @@ -64,8 +70,12 @@ model.do() # Test 2. # ============================================================================= # Vertical distance constraint -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(firstPoint, secondPoint, 10) -SketchConstraintDistanceVertical_1.feature().real("ConstraintValue").setText(DistanceParam.name().value()) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + firstPoint, secondPoint, 10 +) +SketchConstraintDistanceVertical_1.feature().real("ConstraintValue").setText( + DistanceParam.name().value() +) model.do() # changing the parameter @@ -75,7 +85,9 @@ for param in range(11, 31, 2): DistanceParam.setValue(param) model.do() dist = secondPoint.y() - firstPoint.y() - assert math.fabs(dist - param) < TOLERANCE, "Incorrect vertical distance {}, expected {}".format(dist, param) + assert ( + math.fabs(dist - param) < TOLERANCE + ), "Incorrect vertical distance {}, expected {}".format(dist, param) model.testNbSubFeatures(Sketch_1, "SketchLine", 4) model.testNbSubFeatures(Sketch_1, "SketchConstraintDistanceVertical", 1) @@ -96,16 +108,21 @@ for param in range(11, 31, 2): DistanceParam.setValue(param) model.do() if param < 0: - assert SketchConstraintDistance_1.feature().error() != '', "ERROR: Sketch should not be valid due to negative distance value" - elif param == 0: # constraint is valid, but lead to degenerated geometry - assert Sketch_1.feature().error() != '', "ERROR: Sketch should not be valid due to negative distance value" + assert ( + SketchConstraintDistance_1.feature().error() != "" + ), "ERROR: Sketch should not be valid due to negative distance value" + elif param == 0: # constraint is valid, but lead to degenerated geometry + assert ( + Sketch_1.feature().error() != "" + ), "ERROR: Sketch should not be valid due to negative distance value" else: dist = model.distancePointPoint(firstPoint, secondPoint) - assert math.fabs(dist - math.fabs(param)) < TOLERANCE, "Incorrect distance {}, expected {}".format(dist, math.fabs(param)) + assert ( + math.fabs(dist - math.fabs(param)) < TOLERANCE + ), "Incorrect distance {}, expected {}".format(dist, math.fabs(param)) model.testNbSubFeatures(Sketch_1, "SketchLine", 4) model.testNbSubFeatures(Sketch_1, "SketchConstraintDistance", 1) # leave distance constraint alive model.end() - diff --git a/src/SketchPlugin/Test/TestConstraintDistanceEllipse.py b/src/SketchPlugin/Test/TestConstraintDistanceEllipse.py index 6c53ba2f7..ac9330757 100644 --- a/src/SketchPlugin/Test/TestConstraintDistanceEllipse.py +++ b/src/SketchPlugin/Test/TestConstraintDistanceEllipse.py @@ -30,171 +30,194 @@ from GeomAPI import * from SketchAPI import * __updated__ = "2019-09-12" -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + class TestDistanceEllipse(unittest.TestCase): - def setUp(self): - axisStart = GeomAPI_Pnt2d(20., 60.) - axisEnd = GeomAPI_Pnt2d(80., 50.) - passedPoint = GeomAPI_Pnt2d(60., 70.) - - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - macroEllipse = self.mySketch.addEllipse(axisStart, axisEnd, passedPoint, False) - self.myDOF = 5 - self.myOrigin = self.mySketch.addPoint("Origin") - self.myOX = self.mySketch.addLine("OX") - model.do() - self.myEllipse = SketchAPI_Ellipse(model.lastSubFeature(self.mySketch, "SketchEllipse")) - self.myCenter = macroEllipse.center() - self.myFocus1 = macroEllipse.focus1() - self.myFocus2 = macroEllipse.focus2() - self.myMajorAxis = macroEllipse.majorAxis() - self.myMajorStart = macroEllipse.majorAxisStart() - self.myMajorEnd = macroEllipse.majorAxisEnd() - self.myMinorAxis = macroEllipse.minorAxis() - self.myMinorStart = macroEllipse.minorAxisStart() - self.myMinorEnd = macroEllipse.minorAxisEnd() - self.myExpectFailure = False - self.myDistance = 50 - - def tearDown(self): - model.end() - if self.myExpectFailure: - assert(self.mySketch.solverError() != ""), "PlaneGCS limitation: if you see this message, then PlaneGCS has solved the set of constraints correctly" - model.undo() - else: - self.checkDOF() - self.assertPoints(self.myCenter.coordinates(), self.myEllipse.center()) - self.assertPoints(self.myFocus1.coordinates(), self.myEllipse.firstFocus()) - self.assertPoints(self.myFocus2.coordinates(), self.myEllipse.secondFocus()) - self.assertPoints(self.myMajorStart.coordinates(), self.myEllipse.majorAxisNegative()) - self.assertPoints(self.myMajorEnd.coordinates(), self.myEllipse.majorAxisPositive()) - self.assertPoints(self.myMajorAxis.startPoint(), self.myEllipse.majorAxisNegative()) - self.assertPoints(self.myMajorAxis.endPoint(), self.myEllipse.majorAxisPositive()) - self.assertPoints(self.myMinorStart.coordinates(), self.myEllipse.minorAxisNegative()) - self.assertPoints(self.myMinorEnd.coordinates(), self.myEllipse.minorAxisPositive()) - self.assertPoints(self.myMinorAxis.startPoint(), self.myEllipse.minorAxisNegative()) - self.assertPoints(self.myMinorAxis.endPoint(), self.myEllipse.minorAxisPositive()) - model.testNbSubFeatures(self.mySketch, "SketchPoint", 8) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidenceInternal", 11) - model.testNbSubFeatures(self.mySketch, "SketchConstraintDistance", 1) - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkPointPointDistance(self, thePoint1, thePoint2): - self.mySketch.setDistance(thePoint1, thePoint2, self.myDistance) - self.myDOF -= 1 - model.do() - if not self.myExpectFailure: - NB_DIGITS = math.floor(-math.log10(TOLERANCE) - math.log10(self.myDistance)) - self.assertAlmostEqual(model.distancePointPoint(thePoint1, thePoint2), self.myDistance, NB_DIGITS) - self.assertGreater(self.myEllipse.majorRadius().value(), 0.0) - self.assertGreater(self.myEllipse.minorRadius().value(), 0.0) - - def checkPointLineDistance(self, thePoint, theLine): - self.mySketch.setDistance(thePoint, theLine.result(), self.myDistance) - self.myDOF -= 1 - model.do() - NB_DIGITS = math.floor(-math.log10(TOLERANCE) - math.log10(self.myDistance)) - self.assertAlmostEqual(model.distancePointLine(thePoint, theLine), self.myDistance, NB_DIGITS) - self.assertGreater(self.myEllipse.majorRadius().value(), 0.0) - self.assertGreater(self.myEllipse.minorRadius().value(), 0.0) - - def assertPoints(self, thePoint1, thePoint2): - NB_DIGITS = math.floor(-math.log10(TOLERANCE) - math.log10(self.myDistance)) - self.assertAlmostEqual(thePoint1.x(), thePoint2.x(), NB_DIGITS) - self.assertAlmostEqual(thePoint1.y(), thePoint2.y(), NB_DIGITS) - - - def test_distance_center(self): - """ Test 1. Set distance to the Origin from the center of ellipse - """ - self.checkPointPointDistance(self.myCenter.coordinates(), self.myOrigin.coordinates()) - - def test_distance_first_focus(self): - """ Test 2. Set distance to the Origin from the first focus of ellipse - """ - self.checkPointPointDistance(self.myFocus1.coordinates(), self.myOrigin.coordinates()) - - def test_distance_second_focus(self): - """ Test 3. Set distance to the Origin from the second focus of ellipse - """ - self.checkPointPointDistance(self.myFocus2.coordinates(), self.myOrigin.coordinates()) - - def test_distance_major_axis_start(self): - """ Test 4. Set distance to the Origin from the start point on the major axis of ellipse - """ - self.checkPointPointDistance(self.myMajorStart.coordinates(), self.myOrigin.coordinates()) - - def test_distance_major_axis_end(self): - """ Test 5. Set distance to the Origin from the end point on the major axis of ellipse - """ - self.checkPointPointDistance(self.myMajorEnd.coordinates(), self.myOrigin.coordinates()) - - def test_distance_minor_axis_start(self): - """ Test 6. Set distance to the Origin from the start point on the minor axis of ellipse - """ - self.checkPointPointDistance(self.myMinorStart.coordinates(), self.myOrigin.coordinates()) - - def test_distance_minor_axis_end(self): - """ Test 7. Set distance to the Origin from the end point on the minor axis of ellipse - """ - self.myExpectFailure = True - self.checkPointPointDistance(self.myMinorEnd.coordinates(), self.myOrigin.coordinates()) - - - def test_distance_center_to_line(self): - """ Test 8. Set distance from theOX to the center of ellipse - """ - self.checkPointLineDistance(self.myCenter.coordinates(), self.myOX) - - def test_distance_first_focus_to_line(self): - """ Test 9. Set distance from theOX to the first focus of ellipse - """ - self.checkPointLineDistance(self.myFocus1.coordinates(), self.myOX) - - def test_distance_second_focus_to_line(self): - """ Test 10. Set distance from theOX to the second focus of ellipse - """ - self.checkPointLineDistance(self.myFocus2.coordinates(), self.myOX) - - def test_distance_major_axis_start_to_line(self): - """ Test 11. Set distance from theOX to the start point on the major axis of ellipse - """ - self.checkPointLineDistance(self.myMajorStart.coordinates(), self.myOX) - - def test_distance_major_axis_end_to_line(self): - """ Test 12. Set distance from theOX to the end point on the major axis of ellipse - """ - self.checkPointLineDistance(self.myMajorEnd.coordinates(), self.myOX) - - def test_distance_minor_axis_start_to_line(self): - """ Test 13. Set distance from theOX to the start point on the minor axis of ellipse - """ - self.checkPointLineDistance(self.myMinorStart.coordinates(), self.myOX) - - def test_distance_minor_axis_end_to_line(self): - """ Test 14. Set distance from theOX to the end point on the minor axis of ellipse - """ - self.myDistance = 150 - self.checkPointLineDistance(self.myMinorEnd.coordinates(), self.myOX) - - - def test_distance_origin_to_major_axis(self): - """ Test 15. Set distance from the Origin to the major axis of the ellipse - """ - self.checkPointLineDistance(self.myOrigin.coordinates(), self.myMajorAxis) - - def test_distance_origin_to_minor_axis(self): - """ Test 16. Set distance from the Origin to the minor axis of the ellipse - """ - self.checkPointLineDistance(self.myOrigin.coordinates(), self.myMinorAxis) + def setUp(self): + axisStart = GeomAPI_Pnt2d(20.0, 60.0) + axisEnd = GeomAPI_Pnt2d(80.0, 50.0) + passedPoint = GeomAPI_Pnt2d(60.0, 70.0) + + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + macroEllipse = self.mySketch.addEllipse(axisStart, axisEnd, passedPoint, False) + self.myDOF = 5 + self.myOrigin = self.mySketch.addPoint("Origin") + self.myOX = self.mySketch.addLine("OX") + model.do() + self.myEllipse = SketchAPI_Ellipse( + model.lastSubFeature(self.mySketch, "SketchEllipse") + ) + self.myCenter = macroEllipse.center() + self.myFocus1 = macroEllipse.focus1() + self.myFocus2 = macroEllipse.focus2() + self.myMajorAxis = macroEllipse.majorAxis() + self.myMajorStart = macroEllipse.majorAxisStart() + self.myMajorEnd = macroEllipse.majorAxisEnd() + self.myMinorAxis = macroEllipse.minorAxis() + self.myMinorStart = macroEllipse.minorAxisStart() + self.myMinorEnd = macroEllipse.minorAxisEnd() + self.myExpectFailure = False + self.myDistance = 50 + + def tearDown(self): + model.end() + if self.myExpectFailure: + assert ( + self.mySketch.solverError() != "" + ), "PlaneGCS limitation: if you see this message, then PlaneGCS has solved the set of constraints correctly" + model.undo() + else: + self.checkDOF() + self.assertPoints(self.myCenter.coordinates(), self.myEllipse.center()) + self.assertPoints(self.myFocus1.coordinates(), self.myEllipse.firstFocus()) + self.assertPoints(self.myFocus2.coordinates(), self.myEllipse.secondFocus()) + self.assertPoints( + self.myMajorStart.coordinates(), self.myEllipse.majorAxisNegative() + ) + self.assertPoints( + self.myMajorEnd.coordinates(), self.myEllipse.majorAxisPositive() + ) + self.assertPoints( + self.myMajorAxis.startPoint(), self.myEllipse.majorAxisNegative() + ) + self.assertPoints( + self.myMajorAxis.endPoint(), self.myEllipse.majorAxisPositive() + ) + self.assertPoints( + self.myMinorStart.coordinates(), self.myEllipse.minorAxisNegative() + ) + self.assertPoints( + self.myMinorEnd.coordinates(), self.myEllipse.minorAxisPositive() + ) + self.assertPoints( + self.myMinorAxis.startPoint(), self.myEllipse.minorAxisNegative() + ) + self.assertPoints( + self.myMinorAxis.endPoint(), self.myEllipse.minorAxisPositive() + ) + model.testNbSubFeatures(self.mySketch, "SketchPoint", 8) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintCoincidenceInternal", 11 + ) + model.testNbSubFeatures(self.mySketch, "SketchConstraintDistance", 1) + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointPointDistance(self, thePoint1, thePoint2): + self.mySketch.setDistance(thePoint1, thePoint2, self.myDistance) + self.myDOF -= 1 + model.do() + if not self.myExpectFailure: + NB_DIGITS = math.floor(-math.log10(TOLERANCE) - math.log10(self.myDistance)) + self.assertAlmostEqual( + model.distancePointPoint(thePoint1, thePoint2), + self.myDistance, + NB_DIGITS, + ) + self.assertGreater(self.myEllipse.majorRadius().value(), 0.0) + self.assertGreater(self.myEllipse.minorRadius().value(), 0.0) + + def checkPointLineDistance(self, thePoint, theLine): + self.mySketch.setDistance(thePoint, theLine.result(), self.myDistance) + self.myDOF -= 1 + model.do() + NB_DIGITS = math.floor(-math.log10(TOLERANCE) - math.log10(self.myDistance)) + self.assertAlmostEqual( + model.distancePointLine(thePoint, theLine), self.myDistance, NB_DIGITS + ) + self.assertGreater(self.myEllipse.majorRadius().value(), 0.0) + self.assertGreater(self.myEllipse.minorRadius().value(), 0.0) + + def assertPoints(self, thePoint1, thePoint2): + NB_DIGITS = math.floor(-math.log10(TOLERANCE) - math.log10(self.myDistance)) + self.assertAlmostEqual(thePoint1.x(), thePoint2.x(), NB_DIGITS) + self.assertAlmostEqual(thePoint1.y(), thePoint2.y(), NB_DIGITS) + + def test_distance_center(self): + """Test 1. Set distance to the Origin from the center of ellipse""" + self.checkPointPointDistance( + self.myCenter.coordinates(), self.myOrigin.coordinates() + ) + + def test_distance_first_focus(self): + """Test 2. Set distance to the Origin from the first focus of ellipse""" + self.checkPointPointDistance( + self.myFocus1.coordinates(), self.myOrigin.coordinates() + ) + + def test_distance_second_focus(self): + """Test 3. Set distance to the Origin from the second focus of ellipse""" + self.checkPointPointDistance( + self.myFocus2.coordinates(), self.myOrigin.coordinates() + ) + + def test_distance_major_axis_start(self): + """Test 4. Set distance to the Origin from the start point on the major axis of ellipse""" + self.checkPointPointDistance( + self.myMajorStart.coordinates(), self.myOrigin.coordinates() + ) + + def test_distance_major_axis_end(self): + """Test 5. Set distance to the Origin from the end point on the major axis of ellipse""" + self.checkPointPointDistance( + self.myMajorEnd.coordinates(), self.myOrigin.coordinates() + ) + + def test_distance_minor_axis_start(self): + """Test 6. Set distance to the Origin from the start point on the minor axis of ellipse""" + self.checkPointPointDistance( + self.myMinorStart.coordinates(), self.myOrigin.coordinates() + ) + + def test_distance_minor_axis_end(self): + """Test 7. Set distance to the Origin from the end point on the minor axis of ellipse""" + self.myExpectFailure = True + self.checkPointPointDistance( + self.myMinorEnd.coordinates(), self.myOrigin.coordinates() + ) + + def test_distance_center_to_line(self): + """Test 8. Set distance from theOX to the center of ellipse""" + self.checkPointLineDistance(self.myCenter.coordinates(), self.myOX) + + def test_distance_first_focus_to_line(self): + """Test 9. Set distance from theOX to the first focus of ellipse""" + self.checkPointLineDistance(self.myFocus1.coordinates(), self.myOX) + + def test_distance_second_focus_to_line(self): + """Test 10. Set distance from theOX to the second focus of ellipse""" + self.checkPointLineDistance(self.myFocus2.coordinates(), self.myOX) + + def test_distance_major_axis_start_to_line(self): + """Test 11. Set distance from theOX to the start point on the major axis of ellipse""" + self.checkPointLineDistance(self.myMajorStart.coordinates(), self.myOX) + + def test_distance_major_axis_end_to_line(self): + """Test 12. Set distance from theOX to the end point on the major axis of ellipse""" + self.checkPointLineDistance(self.myMajorEnd.coordinates(), self.myOX) + + def test_distance_minor_axis_start_to_line(self): + """Test 13. Set distance from theOX to the start point on the minor axis of ellipse""" + self.checkPointLineDistance(self.myMinorStart.coordinates(), self.myOX) + + def test_distance_minor_axis_end_to_line(self): + """Test 14. Set distance from theOX to the end point on the minor axis of ellipse""" + self.myDistance = 150 + self.checkPointLineDistance(self.myMinorEnd.coordinates(), self.myOX) + + def test_distance_origin_to_major_axis(self): + """Test 15. Set distance from the Origin to the major axis of the ellipse""" + self.checkPointLineDistance(self.myOrigin.coordinates(), self.myMajorAxis) + + def test_distance_origin_to_minor_axis(self): + """Test 16. Set distance from the Origin to the minor axis of the ellipse""" + self.checkPointLineDistance(self.myOrigin.coordinates(), self.myMinorAxis) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestConstraintDistanceHorizontal.py b/src/SketchPlugin/Test/TestConstraintDistanceHorizontal.py index 671ff2a46..29b79b2d5 100644 --- a/src/SketchPlugin/Test/TestConstraintDistanceHorizontal.py +++ b/src/SketchPlugin/Test/TestConstraintDistanceHorizontal.py @@ -34,9 +34,9 @@ from ModelAPI import * import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2017-05-10" @@ -47,11 +47,12 @@ def horizontalDistance(point1, point2): """ return point2.x() - point1.x() + aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -62,166 +63,210 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create two movable and one fixed point -#========================================================================= +# ========================================================================= aSession.startOperation() aPoint1 = aSketchFeature.addFeature("SketchPoint") aPoint1Coords = geomDataAPI_Point2D(aPoint1.attribute("PointCoordinates")) -aPoint1Coords.setValue(50., 50.) +aPoint1Coords.setValue(50.0, 50.0) aSession.finishOperation() aSession.startOperation() aPoint2 = aSketchFeature.addFeature("SketchPoint") aPoint2Coords = geomDataAPI_Point2D(aPoint2.attribute("PointCoordinates")) -aPoint2Coords.setValue(70., 70.) +aPoint2Coords.setValue(70.0, 70.0) aSession.finishOperation() aSession.startOperation() anOriginResult = modelAPI_Result(aDocument.objectByName("Construction", "Origin")) anOriginShape = anOriginResult.shape() anExtPoint = aSketchFeature.addFeature("SketchPoint") anExtCoords = geomDataAPI_Point2D(anExtPoint.attribute("PointCoordinates")) -anExtCoords.setValue(0., 0.) +anExtCoords.setValue(0.0, 0.0) anExtPoint.selection("External").setValue(anOriginResult, anOriginShape) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 4) +assert model.dof(aSketchFeature) == 4 -#========================================================================= +# ========================================================================= # Create a constraint to keep horizontal distance between movable points -#========================================================================= -DISTANCE1 = 25. +# ========================================================================= +DISTANCE1 = 25.0 aSession.startOperation() aHDist1 = aSketchFeature.addFeature("SketchConstraintDistanceHorizontal") aDistance = aHDist1.real("ConstraintValue") refattrA = aHDist1.refattr("ConstraintEntityA") refattrB = aHDist1.refattr("ConstraintEntityB") -assert (not aDistance.isInitialized()) -assert (not refattrA.isInitialized()) -assert (not refattrB.isInitialized()) +assert not aDistance.isInitialized() +assert not refattrA.isInitialized() +assert not refattrB.isInitialized() refattrA.setObject(aPoint1.lastResult()) refattrB.setObject(aPoint2.lastResult()) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 3) +assert model.dof(aSketchFeature) == 3 # set flyout point then abort operation, after that check the Distance is correct aSession.startOperation() aFlyoutPoint = geomDataAPI_Point2D(aHDist1.attribute("ConstraintFlyoutValuePnt")) aFlyoutPoint.setValue(50.0, 100.0) aSession.abortOperation() -assert (refattrA.isInitialized()) -assert (refattrB.isInitialized()) -assert (aDistance.isInitialized()) +assert refattrA.isInitialized() +assert refattrB.isInitialized() +assert aDistance.isInitialized() aSession.startOperation() aDistance.setValue(DISTANCE1) aSession.finishOperation() -assert math.fabs(horizontalDistance(aPoint1Coords, aPoint2Coords) - DISTANCE1) < 1.e-5, "Distance values are different: {0} != {1}".format(horizontalDistance(aPoint1Coords, aPoint2Coords), DISTANCE1) -assert (model.dof(aSketchFeature) == 3) -#========================================================================= +assert ( + math.fabs(horizontalDistance(aPoint1Coords, aPoint2Coords) - DISTANCE1) < 1.0e-5 +), "Distance values are different: {0} != {1}".format( + horizontalDistance(aPoint1Coords, aPoint2Coords), DISTANCE1 +) +assert model.dof(aSketchFeature) == 3 +# ========================================================================= # Change a distance value -#========================================================================= -d = DISTANCE1 + 21. -dStep = -5. -while d >= -30.: +# ========================================================================= +d = DISTANCE1 + 21.0 +dStep = -5.0 +while d >= -30.0: aSession.startOperation() DISTANCE1 = d aDistance.setValue(DISTANCE1) aSession.finishOperation() - assert math.fabs(horizontalDistance(aPoint1Coords, aPoint2Coords) - DISTANCE1) < 1.e-5, "Distance values are different: {0} != {1}".format(horizontalDistance(aPoint1Coords, aPoint2Coords), DISTANCE1) + assert ( + math.fabs(horizontalDistance(aPoint1Coords, aPoint2Coords) - DISTANCE1) < 1.0e-5 + ), "Distance values are different: {0} != {1}".format( + horizontalDistance(aPoint1Coords, aPoint2Coords), DISTANCE1 + ) d += dStep -assert (model.dof(aSketchFeature) == 3) +assert model.dof(aSketchFeature) == 3 -#========================================================================= +# ========================================================================= # Create a constraint to keep horizontal distance between fixed and movable points -#========================================================================= -DISTANCE2 = 50. +# ========================================================================= +DISTANCE2 = 50.0 aSession.startOperation() aHDist2 = aSketchFeature.addFeature("SketchConstraintDistanceHorizontal") aDistance = aHDist2.real("ConstraintValue") refattrA = aHDist2.refattr("ConstraintEntityA") refattrB = aHDist2.refattr("ConstraintEntityB") -assert (not aDistance.isInitialized()) -assert (not refattrA.isInitialized()) -assert (not refattrB.isInitialized()) +assert not aDistance.isInitialized() +assert not refattrA.isInitialized() +assert not refattrB.isInitialized() refattrA.setObject(anExtPoint.lastResult()) refattrB.setAttr(aPoint1Coords) aDistance.setValue(DISTANCE2) aSession.finishOperation() -assert math.fabs(horizontalDistance(anExtCoords, aPoint1Coords) - DISTANCE2) < 1.e-5, "Distance values are different: {0} != {1}".format(horizontalDistance(anExtCoords, aPoint1Coords), DISTANCE2) -assert math.fabs(aPoint1Coords.x() - DISTANCE2) < 1.e-5, "Wrong point coordinates ({}, {}), expected x = {}".format(aPoint1Coords.x(), aPoint1Coords.y(), DISTANCE2) -assert (model.dof(aSketchFeature) == 2) -#========================================================================= +assert ( + math.fabs(horizontalDistance(anExtCoords, aPoint1Coords) - DISTANCE2) < 1.0e-5 +), "Distance values are different: {0} != {1}".format( + horizontalDistance(anExtCoords, aPoint1Coords), DISTANCE2 +) +assert ( + math.fabs(aPoint1Coords.x() - DISTANCE2) < 1.0e-5 +), "Wrong point coordinates ({}, {}), expected x = {}".format( + aPoint1Coords.x(), aPoint1Coords.y(), DISTANCE2 +) +assert model.dof(aSketchFeature) == 2 +# ========================================================================= # Change a distance value (check previous constraint is applied too) -#========================================================================= +# ========================================================================= d = DISTANCE2 -dStep = -7. -while d >= -50.: +dStep = -7.0 +while d >= -50.0: aSession.startOperation() DISTANCE2 = d aDistance.setValue(DISTANCE2) aSession.finishOperation() - assert math.fabs(horizontalDistance(anExtCoords, aPoint1Coords) - DISTANCE2) < 1.e-5, "Distance values are different: {0} != {1}".format(horizontalDistance(anExtCoords, aPoint1Coords), DISTANCE2) - assert math.fabs(aPoint1Coords.x() - DISTANCE2) < 1.e-5, "Wrong point coordinates ({}, {}), expected x = {}".format(aPoint1Coords.x(), aPoint1Coords.y(), DISTANCE2) - assert math.fabs(horizontalDistance(aPoint1Coords, aPoint2Coords) - DISTANCE1) < 1.e-5, "Distance values are different: {0} != {1}".format(horizontalDistance(aPoint1Coords, aPoint2Coords), DISTANCE1) + assert ( + math.fabs(horizontalDistance(anExtCoords, aPoint1Coords) - DISTANCE2) < 1.0e-5 + ), "Distance values are different: {0} != {1}".format( + horizontalDistance(anExtCoords, aPoint1Coords), DISTANCE2 + ) + assert ( + math.fabs(aPoint1Coords.x() - DISTANCE2) < 1.0e-5 + ), "Wrong point coordinates ({}, {}), expected x = {}".format( + aPoint1Coords.x(), aPoint1Coords.y(), DISTANCE2 + ) + assert ( + math.fabs(horizontalDistance(aPoint1Coords, aPoint2Coords) - DISTANCE1) < 1.0e-5 + ), "Distance values are different: {0} != {1}".format( + horizontalDistance(aPoint1Coords, aPoint2Coords), DISTANCE1 + ) d += dStep -assert (model.dof(aSketchFeature) == 2) +assert model.dof(aSketchFeature) == 2 -#========================================================================= +# ========================================================================= # Remove first distance -#========================================================================= +# ========================================================================= aStoredCoords = [aPoint2Coords.x(), aPoint2Coords.y()] aSession.startOperation() aDocument.removeFeature(aHDist1) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 3) +assert model.dof(aSketchFeature) == 3 aSession.startOperation() -DISTANCE2 = 20. +DISTANCE2 = 20.0 aDistance.setValue(DISTANCE2) aSession.finishOperation() -assert math.fabs(horizontalDistance(anExtCoords, aPoint1Coords) - DISTANCE2) < 1.e-5, "Distance values are different: {0} != {1}".format(horizontalDistance(anExtCoords, aPoint1Coords), DISTANCE2) -assert math.fabs(aPoint1Coords.x() - DISTANCE2) < 1.e-5, "Wrong point coordinates ({}, {}), expected x = {}".format(aPoint1Coords.x(), aPoint1Coords.y(), DISTANCE2) +assert ( + math.fabs(horizontalDistance(anExtCoords, aPoint1Coords) - DISTANCE2) < 1.0e-5 +), "Distance values are different: {0} != {1}".format( + horizontalDistance(anExtCoords, aPoint1Coords), DISTANCE2 +) +assert ( + math.fabs(aPoint1Coords.x() - DISTANCE2) < 1.0e-5 +), "Wrong point coordinates ({}, {}), expected x = {}".format( + aPoint1Coords.x(), aPoint1Coords.y(), DISTANCE2 +) assert aPoint2Coords.x() == aStoredCoords[0] and aPoint2Coords.y() == aStoredCoords[1] -#========================================================================= +# ========================================================================= # Create line and set horizontal distance between line boundaries -#========================================================================= +# ========================================================================= aSession.startOperation() aLine = aSketchFeature.addFeature("SketchLine") aStartPoint = geomDataAPI_Point2D(aLine.attribute("StartPoint")) aEndPoint = geomDataAPI_Point2D(aLine.attribute("EndPoint")) -aStartPoint.setValue(50., 0.) -aEndPoint.setValue(100., 20.) +aStartPoint.setValue(50.0, 0.0) +aEndPoint.setValue(100.0, 20.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 7) +assert model.dof(aSketchFeature) == 7 -DISTANCE3 = 50. +DISTANCE3 = 50.0 aSession.startOperation() aHDist3 = aSketchFeature.addFeature("SketchConstraintDistanceHorizontal") aDistance = aHDist3.real("ConstraintValue") refattrA = aHDist3.refattr("ConstraintEntityA") refattrB = aHDist3.refattr("ConstraintEntityB") -assert (not aDistance.isInitialized()) -assert (not refattrA.isInitialized()) -assert (not refattrB.isInitialized()) +assert not aDistance.isInitialized() +assert not refattrA.isInitialized() +assert not refattrB.isInitialized() refattrA.setAttr(aStartPoint) refattrB.setAttr(aEndPoint) aDistance.setValue(DISTANCE3) aSession.finishOperation() -assert math.fabs(horizontalDistance(aStartPoint, aEndPoint) - DISTANCE3) < 1.e-5, "Distance values are different: {0} != {1}".format(horizontalDistance(aStartPoint, aEndPoint), DISTANCE3) -assert (model.dof(aSketchFeature) == 6) -#========================================================================= +assert ( + math.fabs(horizontalDistance(aStartPoint, aEndPoint) - DISTANCE3) < 1.0e-5 +), "Distance values are different: {0} != {1}".format( + horizontalDistance(aStartPoint, aEndPoint), DISTANCE3 +) +assert model.dof(aSketchFeature) == 6 +# ========================================================================= # Change a distance value -#========================================================================= +# ========================================================================= d = DISTANCE3 -dStep = -7. -while d >= -50.: +dStep = -7.0 +while d >= -50.0: aSession.startOperation() DISTANCE3 = d aDistance.setValue(DISTANCE3) aSession.finishOperation() - assert math.fabs(horizontalDistance(aStartPoint, aEndPoint) - DISTANCE3) < 1.e-5, "Distance values are different: {0} != {1}".format(horizontalDistance(aStartPoint, aEndPoint), DISTANCE3) + assert ( + math.fabs(horizontalDistance(aStartPoint, aEndPoint) - DISTANCE3) < 1.0e-5 + ), "Distance values are different: {0} != {1}".format( + horizontalDistance(aStartPoint, aEndPoint), DISTANCE3 + ) d += dStep -assert (model.dof(aSketchFeature) == 6) +assert model.dof(aSketchFeature) == 6 -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintDistanceHorizontalZero.py b/src/SketchPlugin/Test/TestConstraintDistanceHorizontalZero.py index 0a7dbb447..fba4054ca 100644 --- a/src/SketchPlugin/Test/TestConstraintDistanceHorizontalZero.py +++ b/src/SketchPlugin/Test/TestConstraintDistanceHorizontalZero.py @@ -28,92 +28,123 @@ from salome.shaper import model from SketchAPI import * __updated__ = "2019-10-22" -TOLERANCE = 1.e-6 +TOLERANCE = 1.0e-6 + class TestZeroDistanceHorizontal(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myLine1 = self.mySketch.addLine(10, 10, 45, 27.5) - self.myLine2 = self.mySketch.addLine(20, 15, 30, 40) - self.myLine3 = self.mySketch.addLine(10, 0, 10, 10) - model.do() - self.myDOF = 12 - - def tearDown(self): - model.end() - model.checkSketch(self.mySketch, self.myDOF) - - def assertDistanceHorizontal(self, theObject1, theObject2, theDistance): - dist = theObject2.x() - theObject1.x() - self.assertTrue(math.fabs(dist - theDistance) < TOLERANCE, "Current distance = {}, reference = {}".format(dist, theDistance)) - model.checkSketch(self.mySketch, self.myDOF) - - - def test_distance_positive_nzznz(self): - """ Test 1. Change distance from non-zero to zero and back to non-zero - """ - dist = self.mySketch.setHorizontalDistance(self.myLine1.startPoint(), self.myLine2.startPoint(), 10) - self.myDOF -= 1 - model.do() - self.assertDistanceHorizontal(self.myLine1.startPoint(), self.myLine2.startPoint(), 10) - - SketchAPI_Constraint(dist).setValue(0) - model.do() - self.assertDistanceHorizontal(self.myLine1.startPoint(), self.myLine2.startPoint(), 0) - - SketchAPI_Constraint(dist).setValue(10) - model.do() - self.assertDistanceHorizontal(self.myLine1.startPoint(), self.myLine2.startPoint(), 10) - - def test_distance_negative_nzznz(self): - """ Test 2. Change distance from non-zero to zero and back to non-zero - """ - dist = self.mySketch.setHorizontalDistance(self.myLine1.endPoint(), self.myLine2.endPoint(), 15) - self.myDOF -= 1 - model.do() - self.assertDistanceHorizontal(self.myLine1.endPoint(), self.myLine2.endPoint(), -15) - - SketchAPI_Constraint(dist).setValue(0) - model.do() - self.assertDistanceHorizontal(self.myLine1.endPoint(), self.myLine2.endPoint(), 0) - - SketchAPI_Constraint(dist).setValue(10) - model.do() - self.assertDistanceHorizontal(self.myLine1.endPoint(), self.myLine2.endPoint(), -10) - - def test_distance_equal_znzz(self): - """ Test 3. Change distance from zero to non-zero and back to zero - """ - dist = self.mySketch.setHorizontalDistance(self.myLine1.startPoint(), self.myLine3.endPoint(), 0) - self.myDOF -= 1 - model.do() - self.assertDistanceHorizontal(self.myLine1.startPoint(), self.myLine3.endPoint(), 0) - - SketchAPI_Constraint(dist).setValue(10) - model.do() - self.assertDistanceHorizontal(self.myLine1.startPoint(), self.myLine3.endPoint(), 10) - - SketchAPI_Constraint(dist).setValue(0) - model.do() - self.assertDistanceHorizontal(self.myLine1.startPoint(), self.myLine3.endPoint(), 0) - - def test_distance_notequal_znzz(self): - """ Test 4. Change distance from zero to non-zero and back to zero - """ - dist = self.mySketch.setHorizontalDistance(self.myLine1.startPoint(), self.myLine3.startPoint(), 0) - self.myDOF -= 1 - model.do() - self.assertDistanceHorizontal(self.myLine1.startPoint(), self.myLine3.startPoint(), 0) - - SketchAPI_Constraint(dist).setValue(10) - model.do() - self.assertDistanceHorizontal(self.myLine1.startPoint(), self.myLine3.startPoint(), 10) - - SketchAPI_Constraint(dist).setValue(0) - model.do() - self.assertDistanceHorizontal(self.myLine1.startPoint(), self.myLine3.startPoint(), 0) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myLine1 = self.mySketch.addLine(10, 10, 45, 27.5) + self.myLine2 = self.mySketch.addLine(20, 15, 30, 40) + self.myLine3 = self.mySketch.addLine(10, 0, 10, 10) + model.do() + self.myDOF = 12 + + def tearDown(self): + model.end() + model.checkSketch(self.mySketch, self.myDOF) + + def assertDistanceHorizontal(self, theObject1, theObject2, theDistance): + dist = theObject2.x() - theObject1.x() + self.assertTrue( + math.fabs(dist - theDistance) < TOLERANCE, + "Current distance = {}, reference = {}".format(dist, theDistance), + ) + model.checkSketch(self.mySketch, self.myDOF) + + def test_distance_positive_nzznz(self): + """Test 1. Change distance from non-zero to zero and back to non-zero""" + dist = self.mySketch.setHorizontalDistance( + self.myLine1.startPoint(), self.myLine2.startPoint(), 10 + ) + self.myDOF -= 1 + model.do() + self.assertDistanceHorizontal( + self.myLine1.startPoint(), self.myLine2.startPoint(), 10 + ) + + SketchAPI_Constraint(dist).setValue(0) + model.do() + self.assertDistanceHorizontal( + self.myLine1.startPoint(), self.myLine2.startPoint(), 0 + ) + + SketchAPI_Constraint(dist).setValue(10) + model.do() + self.assertDistanceHorizontal( + self.myLine1.startPoint(), self.myLine2.startPoint(), 10 + ) + + def test_distance_negative_nzznz(self): + """Test 2. Change distance from non-zero to zero and back to non-zero""" + dist = self.mySketch.setHorizontalDistance( + self.myLine1.endPoint(), self.myLine2.endPoint(), 15 + ) + self.myDOF -= 1 + model.do() + self.assertDistanceHorizontal( + self.myLine1.endPoint(), self.myLine2.endPoint(), -15 + ) + + SketchAPI_Constraint(dist).setValue(0) + model.do() + self.assertDistanceHorizontal( + self.myLine1.endPoint(), self.myLine2.endPoint(), 0 + ) + + SketchAPI_Constraint(dist).setValue(10) + model.do() + self.assertDistanceHorizontal( + self.myLine1.endPoint(), self.myLine2.endPoint(), -10 + ) + + def test_distance_equal_znzz(self): + """Test 3. Change distance from zero to non-zero and back to zero""" + dist = self.mySketch.setHorizontalDistance( + self.myLine1.startPoint(), self.myLine3.endPoint(), 0 + ) + self.myDOF -= 1 + model.do() + self.assertDistanceHorizontal( + self.myLine1.startPoint(), self.myLine3.endPoint(), 0 + ) + + SketchAPI_Constraint(dist).setValue(10) + model.do() + self.assertDistanceHorizontal( + self.myLine1.startPoint(), self.myLine3.endPoint(), 10 + ) + + SketchAPI_Constraint(dist).setValue(0) + model.do() + self.assertDistanceHorizontal( + self.myLine1.startPoint(), self.myLine3.endPoint(), 0 + ) + + def test_distance_notequal_znzz(self): + """Test 4. Change distance from zero to non-zero and back to zero""" + dist = self.mySketch.setHorizontalDistance( + self.myLine1.startPoint(), self.myLine3.startPoint(), 0 + ) + self.myDOF -= 1 + model.do() + self.assertDistanceHorizontal( + self.myLine1.startPoint(), self.myLine3.startPoint(), 0 + ) + + SketchAPI_Constraint(dist).setValue(10) + model.do() + self.assertDistanceHorizontal( + self.myLine1.startPoint(), self.myLine3.startPoint(), 10 + ) + + SketchAPI_Constraint(dist).setValue(0) + model.do() + self.assertDistanceHorizontal( + self.myLine1.startPoint(), self.myLine3.startPoint(), 0 + ) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestConstraintDistanceVertical.py b/src/SketchPlugin/Test/TestConstraintDistanceVertical.py index 5b1458b68..8808c73c2 100644 --- a/src/SketchPlugin/Test/TestConstraintDistanceVertical.py +++ b/src/SketchPlugin/Test/TestConstraintDistanceVertical.py @@ -34,9 +34,9 @@ from ModelAPI import * import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2017-05-10" @@ -47,11 +47,12 @@ def verticalDistance(point1, point2): """ return point2.y() - point1.y() + aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -62,166 +63,210 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create two movable and one fixed point -#========================================================================= +# ========================================================================= aSession.startOperation() aPoint1 = aSketchFeature.addFeature("SketchPoint") aPoint1Coords = geomDataAPI_Point2D(aPoint1.attribute("PointCoordinates")) -aPoint1Coords.setValue(50., 50.) +aPoint1Coords.setValue(50.0, 50.0) aSession.finishOperation() aSession.startOperation() aPoint2 = aSketchFeature.addFeature("SketchPoint") aPoint2Coords = geomDataAPI_Point2D(aPoint2.attribute("PointCoordinates")) -aPoint2Coords.setValue(70., 70.) +aPoint2Coords.setValue(70.0, 70.0) aSession.finishOperation() aSession.startOperation() anOriginResult = modelAPI_Result(aDocument.objectByName("Construction", "Origin")) anOriginShape = anOriginResult.shape() anExtPoint = aSketchFeature.addFeature("SketchPoint") anExtCoords = geomDataAPI_Point2D(anExtPoint.attribute("PointCoordinates")) -anExtCoords.setValue(0., 0.) +anExtCoords.setValue(0.0, 0.0) anExtPoint.selection("External").setValue(anOriginResult, anOriginShape) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 4) +assert model.dof(aSketchFeature) == 4 -#========================================================================= +# ========================================================================= # Create a constraint to keep vertical distance between movable points -#========================================================================= -DISTANCE1 = 25. +# ========================================================================= +DISTANCE1 = 25.0 aSession.startOperation() aVDist1 = aSketchFeature.addFeature("SketchConstraintDistanceVertical") aDistance = aVDist1.real("ConstraintValue") refattrA = aVDist1.refattr("ConstraintEntityA") refattrB = aVDist1.refattr("ConstraintEntityB") -assert (not aDistance.isInitialized()) -assert (not refattrA.isInitialized()) -assert (not refattrB.isInitialized()) +assert not aDistance.isInitialized() +assert not refattrA.isInitialized() +assert not refattrB.isInitialized() refattrA.setObject(aPoint1.lastResult()) refattrB.setObject(aPoint2.lastResult()) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 3) +assert model.dof(aSketchFeature) == 3 # set flyout point then abort operation, after that check the Distance is correct aSession.startOperation() aFlyoutPoint = geomDataAPI_Point2D(aVDist1.attribute("ConstraintFlyoutValuePnt")) aFlyoutPoint.setValue(50.0, 100.0) aSession.abortOperation() -assert (refattrA.isInitialized()) -assert (refattrB.isInitialized()) -assert (aDistance.isInitialized()) +assert refattrA.isInitialized() +assert refattrB.isInitialized() +assert aDistance.isInitialized() aSession.startOperation() aDistance.setValue(DISTANCE1) aSession.finishOperation() -assert math.fabs(verticalDistance(aPoint1Coords, aPoint2Coords) - DISTANCE1) < 1.e-5, "Distance values are different: {0} != {1}".format(verticalDistance(aPoint1Coords, aPoint2Coords), DISTANCE1) -assert (model.dof(aSketchFeature) == 3) -#========================================================================= +assert ( + math.fabs(verticalDistance(aPoint1Coords, aPoint2Coords) - DISTANCE1) < 1.0e-5 +), "Distance values are different: {0} != {1}".format( + verticalDistance(aPoint1Coords, aPoint2Coords), DISTANCE1 +) +assert model.dof(aSketchFeature) == 3 +# ========================================================================= # Change a distance value -#========================================================================= -d = DISTANCE1 + 21. -dStep = -5. -while d >= -30.: +# ========================================================================= +d = DISTANCE1 + 21.0 +dStep = -5.0 +while d >= -30.0: aSession.startOperation() DISTANCE1 = d aDistance.setValue(DISTANCE1) aSession.finishOperation() - assert math.fabs(verticalDistance(aPoint1Coords, aPoint2Coords) - DISTANCE1) < 1.e-5, "Distance values are different: {0} != {1}".format(verticalDistance(aPoint1Coords, aPoint2Coords), DISTANCE1) + assert ( + math.fabs(verticalDistance(aPoint1Coords, aPoint2Coords) - DISTANCE1) < 1.0e-5 + ), "Distance values are different: {0} != {1}".format( + verticalDistance(aPoint1Coords, aPoint2Coords), DISTANCE1 + ) d += dStep -assert (model.dof(aSketchFeature) == 3) +assert model.dof(aSketchFeature) == 3 -#========================================================================= +# ========================================================================= # Create a constraint to keep vertical distance between fixed and movable points -#========================================================================= -DISTANCE2 = 50. +# ========================================================================= +DISTANCE2 = 50.0 aSession.startOperation() aVDist2 = aSketchFeature.addFeature("SketchConstraintDistanceVertical") aDistance = aVDist2.real("ConstraintValue") refattrA = aVDist2.refattr("ConstraintEntityA") refattrB = aVDist2.refattr("ConstraintEntityB") -assert (not aDistance.isInitialized()) -assert (not refattrA.isInitialized()) -assert (not refattrB.isInitialized()) +assert not aDistance.isInitialized() +assert not refattrA.isInitialized() +assert not refattrB.isInitialized() refattrA.setObject(anExtPoint.lastResult()) refattrB.setAttr(aPoint1Coords) aDistance.setValue(DISTANCE2) aSession.finishOperation() -assert math.fabs(verticalDistance(anExtCoords, aPoint1Coords) - DISTANCE2) < 1.e-5, "Distance values are different: {0} != {1}".format(verticalDistance(anExtCoords, aPoint1Coords), DISTANCE2) -assert math.fabs(aPoint1Coords.y() - DISTANCE2) < 1.e-5, "Wrong point coordinates ({}, {}), expected y = {}".format(aPoint1Coords.x(), aPoint1Coords.y(), DISTANCE2) -assert (model.dof(aSketchFeature) == 2) -#========================================================================= +assert ( + math.fabs(verticalDistance(anExtCoords, aPoint1Coords) - DISTANCE2) < 1.0e-5 +), "Distance values are different: {0} != {1}".format( + verticalDistance(anExtCoords, aPoint1Coords), DISTANCE2 +) +assert ( + math.fabs(aPoint1Coords.y() - DISTANCE2) < 1.0e-5 +), "Wrong point coordinates ({}, {}), expected y = {}".format( + aPoint1Coords.x(), aPoint1Coords.y(), DISTANCE2 +) +assert model.dof(aSketchFeature) == 2 +# ========================================================================= # Change a distance value (check previous constraint is applied too) -#========================================================================= +# ========================================================================= d = DISTANCE2 -dStep = -7. -while d >= -50.: +dStep = -7.0 +while d >= -50.0: aSession.startOperation() DISTANCE2 = d aDistance.setValue(DISTANCE2) aSession.finishOperation() - assert math.fabs(verticalDistance(anExtCoords, aPoint1Coords) - DISTANCE2) < 1.e-5, "Distance values are different: {0} != {1}".format(verticalDistance(anExtCoords, aPoint1Coords), DISTANCE2) - assert math.fabs(aPoint1Coords.y() - DISTANCE2) < 1.e-5, "Wrong point coordinates ({}, {}), expected y = {}".format(aPoint1Coords.x(), aPoint1Coords.y(), DISTANCE2) - assert math.fabs(verticalDistance(aPoint1Coords, aPoint2Coords) - DISTANCE1) < 1.e-5, "Distance values are different: {0} != {1}".format(verticalDistance(aPoint1Coords, aPoint2Coords), DISTANCE1) + assert ( + math.fabs(verticalDistance(anExtCoords, aPoint1Coords) - DISTANCE2) < 1.0e-5 + ), "Distance values are different: {0} != {1}".format( + verticalDistance(anExtCoords, aPoint1Coords), DISTANCE2 + ) + assert ( + math.fabs(aPoint1Coords.y() - DISTANCE2) < 1.0e-5 + ), "Wrong point coordinates ({}, {}), expected y = {}".format( + aPoint1Coords.x(), aPoint1Coords.y(), DISTANCE2 + ) + assert ( + math.fabs(verticalDistance(aPoint1Coords, aPoint2Coords) - DISTANCE1) < 1.0e-5 + ), "Distance values are different: {0} != {1}".format( + verticalDistance(aPoint1Coords, aPoint2Coords), DISTANCE1 + ) d += dStep -assert (model.dof(aSketchFeature) == 2) +assert model.dof(aSketchFeature) == 2 -#========================================================================= +# ========================================================================= # Remove first distance -#========================================================================= +# ========================================================================= aStoredCoords = [aPoint2Coords.x(), aPoint2Coords.y()] aSession.startOperation() aDocument.removeFeature(aVDist1) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 3) +assert model.dof(aSketchFeature) == 3 aSession.startOperation() -DISTANCE2 = 20. +DISTANCE2 = 20.0 aDistance.setValue(DISTANCE2) aSession.finishOperation() -assert math.fabs(verticalDistance(anExtCoords, aPoint1Coords) - DISTANCE2) < 1.e-5, "Distance values are different: {0} != {1}".format(verticalDistance(anExtCoords, aPoint1Coords), DISTANCE2) -assert math.fabs(aPoint1Coords.y() - DISTANCE2) < 1.e-5, "Wrong point coordinates ({}, {}), expected y = {}".format(aPoint1Coords.x(), aPoint1Coords.y(), DISTANCE2) +assert ( + math.fabs(verticalDistance(anExtCoords, aPoint1Coords) - DISTANCE2) < 1.0e-5 +), "Distance values are different: {0} != {1}".format( + verticalDistance(anExtCoords, aPoint1Coords), DISTANCE2 +) +assert ( + math.fabs(aPoint1Coords.y() - DISTANCE2) < 1.0e-5 +), "Wrong point coordinates ({}, {}), expected y = {}".format( + aPoint1Coords.x(), aPoint1Coords.y(), DISTANCE2 +) assert aPoint2Coords.x() == aStoredCoords[0] and aPoint2Coords.y() == aStoredCoords[1] -#========================================================================= +# ========================================================================= # Create line and set vertical distance between line boundaries -#========================================================================= +# ========================================================================= aSession.startOperation() aLine = aSketchFeature.addFeature("SketchLine") aStartPoint = geomDataAPI_Point2D(aLine.attribute("StartPoint")) aEndPoint = geomDataAPI_Point2D(aLine.attribute("EndPoint")) -aStartPoint.setValue(50., 0.) -aEndPoint.setValue(100., 20.) +aStartPoint.setValue(50.0, 0.0) +aEndPoint.setValue(100.0, 20.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 7) +assert model.dof(aSketchFeature) == 7 -DISTANCE3 = 50. +DISTANCE3 = 50.0 aSession.startOperation() aVDist3 = aSketchFeature.addFeature("SketchConstraintDistanceVertical") aDistance = aVDist3.real("ConstraintValue") refattrA = aVDist3.refattr("ConstraintEntityA") refattrB = aVDist3.refattr("ConstraintEntityB") -assert (not aDistance.isInitialized()) -assert (not refattrA.isInitialized()) -assert (not refattrB.isInitialized()) +assert not aDistance.isInitialized() +assert not refattrA.isInitialized() +assert not refattrB.isInitialized() refattrA.setAttr(aStartPoint) refattrB.setAttr(aEndPoint) aDistance.setValue(DISTANCE3) aSession.finishOperation() -assert math.fabs(verticalDistance(aStartPoint, aEndPoint) - DISTANCE3) < 1.e-5, "Distance values are different: {0} != {1}".format(verticalDistance(aStartPoint, aEndPoint), DISTANCE3) -assert (model.dof(aSketchFeature) == 6) -#========================================================================= +assert ( + math.fabs(verticalDistance(aStartPoint, aEndPoint) - DISTANCE3) < 1.0e-5 +), "Distance values are different: {0} != {1}".format( + verticalDistance(aStartPoint, aEndPoint), DISTANCE3 +) +assert model.dof(aSketchFeature) == 6 +# ========================================================================= # Change a distance value -#========================================================================= +# ========================================================================= d = DISTANCE3 -dStep = -7. -while d >= -50.: +dStep = -7.0 +while d >= -50.0: aSession.startOperation() DISTANCE3 = d aDistance.setValue(DISTANCE3) aSession.finishOperation() - assert math.fabs(verticalDistance(aStartPoint, aEndPoint) - DISTANCE3) < 1.e-5, "Distance values are different: {0} != {1}".format(verticalDistance(aStartPoint, aEndPoint), DISTANCE3) + assert ( + math.fabs(verticalDistance(aStartPoint, aEndPoint) - DISTANCE3) < 1.0e-5 + ), "Distance values are different: {0} != {1}".format( + verticalDistance(aStartPoint, aEndPoint), DISTANCE3 + ) d += dStep -assert (model.dof(aSketchFeature) == 6) +assert model.dof(aSketchFeature) == 6 -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintDistanceVerticalZero.py b/src/SketchPlugin/Test/TestConstraintDistanceVerticalZero.py index c12885d5a..f4320ce0b 100644 --- a/src/SketchPlugin/Test/TestConstraintDistanceVerticalZero.py +++ b/src/SketchPlugin/Test/TestConstraintDistanceVerticalZero.py @@ -28,92 +28,123 @@ from salome.shaper import model from SketchAPI import * __updated__ = "2019-10-22" -TOLERANCE = 1.e-6 +TOLERANCE = 1.0e-6 + class TestZeroDistanceVertical(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myLine1 = self.mySketch.addLine(10, 10, 45, 27.5) - self.myLine2 = self.mySketch.addLine(20, 15, 30, 40) - self.myLine3 = self.mySketch.addLine(0, 10, 10, 10) - model.do() - self.myDOF = 12 - - def tearDown(self): - model.end() - model.checkSketch(self.mySketch, self.myDOF) - - def assertDistanceVertical(self, theObject1, theObject2, theDistance): - dist = theObject2.y() - theObject1.y() - self.assertTrue(math.fabs(dist - theDistance) < TOLERANCE, "Current distance = {}, reference = {}".format(dist, theDistance)) - model.checkSketch(self.mySketch, self.myDOF) - - - def test_distance_positive_nzznz(self): - """ Test 1. Change distance from non-zero to zero and back to non-zero - """ - dist = self.mySketch.setVerticalDistance(self.myLine1.startPoint(), self.myLine2.startPoint(), 5) - self.myDOF -= 1 - model.do() - self.assertDistanceVertical(self.myLine1.startPoint(), self.myLine2.startPoint(), 5) - - SketchAPI_Constraint(dist).setValue(0) - model.do() - self.assertDistanceVertical(self.myLine1.startPoint(), self.myLine2.startPoint(), 0) - - SketchAPI_Constraint(dist).setValue(10) - model.do() - self.assertDistanceVertical(self.myLine1.startPoint(), self.myLine2.startPoint(), 10) - - def test_distance_negative_nzznz(self): - """ Test 2. Change distance from non-zero to zero and back to non-zero - """ - dist = self.mySketch.setVerticalDistance(self.myLine1.endPoint(), self.myLine2.startPoint(), 12.5) - self.myDOF -= 1 - model.do() - self.assertDistanceVertical(self.myLine1.endPoint(), self.myLine2.startPoint(), -12.5) - - SketchAPI_Constraint(dist).setValue(0) - model.do() - self.assertDistanceVertical(self.myLine1.endPoint(), self.myLine2.startPoint(), 0) - - SketchAPI_Constraint(dist).setValue(12.5) - model.do() - self.assertDistanceVertical(self.myLine1.endPoint(), self.myLine2.startPoint(), -12.5) - - def test_distance_equal_znzz(self): - """ Test 3. Change distance from zero to non-zero and back to zero - """ - dist = self.mySketch.setVerticalDistance(self.myLine1.startPoint(), self.myLine3.endPoint(), 0) - self.myDOF -= 1 - model.do() - self.assertDistanceVertical(self.myLine1.startPoint(), self.myLine3.endPoint(), 0) - - SketchAPI_Constraint(dist).setValue(10) - model.do() - self.assertDistanceVertical(self.myLine1.startPoint(), self.myLine3.endPoint(), 10) - - SketchAPI_Constraint(dist).setValue(0) - model.do() - self.assertDistanceVertical(self.myLine1.startPoint(), self.myLine3.endPoint(), 0) - - def test_distance_notequal_znzz(self): - """ Test 4. Change distance from zero to non-zero and back to zero - """ - dist = self.mySketch.setVerticalDistance(self.myLine1.startPoint(), self.myLine3.startPoint(), 0) - self.myDOF -= 1 - model.do() - self.assertDistanceVertical(self.myLine1.startPoint(), self.myLine3.startPoint(), 0) - - SketchAPI_Constraint(dist).setValue(10) - model.do() - self.assertDistanceVertical(self.myLine1.startPoint(), self.myLine3.startPoint(), 10) - - SketchAPI_Constraint(dist).setValue(0) - model.do() - self.assertDistanceVertical(self.myLine1.startPoint(), self.myLine3.startPoint(), 0) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myLine1 = self.mySketch.addLine(10, 10, 45, 27.5) + self.myLine2 = self.mySketch.addLine(20, 15, 30, 40) + self.myLine3 = self.mySketch.addLine(0, 10, 10, 10) + model.do() + self.myDOF = 12 + + def tearDown(self): + model.end() + model.checkSketch(self.mySketch, self.myDOF) + + def assertDistanceVertical(self, theObject1, theObject2, theDistance): + dist = theObject2.y() - theObject1.y() + self.assertTrue( + math.fabs(dist - theDistance) < TOLERANCE, + "Current distance = {}, reference = {}".format(dist, theDistance), + ) + model.checkSketch(self.mySketch, self.myDOF) + + def test_distance_positive_nzznz(self): + """Test 1. Change distance from non-zero to zero and back to non-zero""" + dist = self.mySketch.setVerticalDistance( + self.myLine1.startPoint(), self.myLine2.startPoint(), 5 + ) + self.myDOF -= 1 + model.do() + self.assertDistanceVertical( + self.myLine1.startPoint(), self.myLine2.startPoint(), 5 + ) + + SketchAPI_Constraint(dist).setValue(0) + model.do() + self.assertDistanceVertical( + self.myLine1.startPoint(), self.myLine2.startPoint(), 0 + ) + + SketchAPI_Constraint(dist).setValue(10) + model.do() + self.assertDistanceVertical( + self.myLine1.startPoint(), self.myLine2.startPoint(), 10 + ) + + def test_distance_negative_nzznz(self): + """Test 2. Change distance from non-zero to zero and back to non-zero""" + dist = self.mySketch.setVerticalDistance( + self.myLine1.endPoint(), self.myLine2.startPoint(), 12.5 + ) + self.myDOF -= 1 + model.do() + self.assertDistanceVertical( + self.myLine1.endPoint(), self.myLine2.startPoint(), -12.5 + ) + + SketchAPI_Constraint(dist).setValue(0) + model.do() + self.assertDistanceVertical( + self.myLine1.endPoint(), self.myLine2.startPoint(), 0 + ) + + SketchAPI_Constraint(dist).setValue(12.5) + model.do() + self.assertDistanceVertical( + self.myLine1.endPoint(), self.myLine2.startPoint(), -12.5 + ) + + def test_distance_equal_znzz(self): + """Test 3. Change distance from zero to non-zero and back to zero""" + dist = self.mySketch.setVerticalDistance( + self.myLine1.startPoint(), self.myLine3.endPoint(), 0 + ) + self.myDOF -= 1 + model.do() + self.assertDistanceVertical( + self.myLine1.startPoint(), self.myLine3.endPoint(), 0 + ) + + SketchAPI_Constraint(dist).setValue(10) + model.do() + self.assertDistanceVertical( + self.myLine1.startPoint(), self.myLine3.endPoint(), 10 + ) + + SketchAPI_Constraint(dist).setValue(0) + model.do() + self.assertDistanceVertical( + self.myLine1.startPoint(), self.myLine3.endPoint(), 0 + ) + + def test_distance_notequal_znzz(self): + """Test 4. Change distance from zero to non-zero and back to zero""" + dist = self.mySketch.setVerticalDistance( + self.myLine1.startPoint(), self.myLine3.startPoint(), 0 + ) + self.myDOF -= 1 + model.do() + self.assertDistanceVertical( + self.myLine1.startPoint(), self.myLine3.startPoint(), 0 + ) + + SketchAPI_Constraint(dist).setValue(10) + model.do() + self.assertDistanceVertical( + self.myLine1.startPoint(), self.myLine3.startPoint(), 10 + ) + + SketchAPI_Constraint(dist).setValue(0) + model.do() + self.assertDistanceVertical( + self.myLine1.startPoint(), self.myLine3.startPoint(), 0 + ) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestConstraintDistanceZero.py b/src/SketchPlugin/Test/TestConstraintDistanceZero.py index 9b094ee08..0fdfa9bec 100644 --- a/src/SketchPlugin/Test/TestConstraintDistanceZero.py +++ b/src/SketchPlugin/Test/TestConstraintDistanceZero.py @@ -28,158 +28,166 @@ from salome.shaper import model from SketchAPI import * __updated__ = "2019-10-22" -TOLERANCE = 1.e-6 +TOLERANCE = 1.0e-6 + class TestZeroDistance(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myLine1 = self.mySketch.addLine(10, 10, 45, 27.5) - self.myLine2 = self.mySketch.addLine(20, 15, 30, 40) - self.myLine3 = self.mySketch.addLine(10, 0, 10, 10) - model.do() - self.myDOF = 12 - - def tearDown(self): - model.end() - model.checkSketch(self.mySketch, self.myDOF) - - def assertDistance(self, theObject1, theObject2, theDistance, isSigned = False): - dist = -1. - if issubclass(type(theObject1), SketchAPI_SketchEntity): - if isSigned: - dist = model.signedDistancePointLine(theObject2, theObject1) - else: - dist = model.distancePointLine(theObject2, theObject1) - elif issubclass(type(theObject2), SketchAPI_SketchEntity): - if isSigned: - dist = model.signedDistancePointLine(theObject1, theObject2) - else: - dist = model.distancePointLine(theObject1, theObject2) - else: - dist = model.distancePointPoint(theObject1, theObject2) - self.assertTrue(math.fabs(dist - theDistance) < TOLERANCE, "Current distance = {}, reference = {}".format(dist, theDistance)) - model.checkSketch(self.mySketch, self.myDOF) - - - def test_distance_points_nzznz(self): - """ Test 1. Change point-point distance from non-zero to zero and back to non-zero - """ - dist = self.mySketch.setDistance(self.myLine1.endPoint(), self.myLine2.endPoint(), 20) - self.myDOF -= 1 - model.do() - self.assertDistance(self.myLine1.endPoint(), self.myLine2.endPoint(), 20) - - SketchAPI_Constraint(dist).setValue(0) - self.myDOF -= 1 - model.do() - self.assertDistance(self.myLine1.endPoint(), self.myLine2.endPoint(), 0) - - SketchAPI_Constraint(dist).setValue(20) - self.myDOF += 1 - model.do() - self.assertDistance(self.myLine1.endPoint(), self.myLine2.endPoint(), 20) - - def test_distance_points_znzz(self): - """ Test 2. Change point-point distance from zero to non-zero and back to zero - """ - dist = self.mySketch.setDistance(self.myLine1.startPoint(), self.myLine3.endPoint(), 0) - self.myDOF -= 2 - model.do() - self.assertDistance(self.myLine1.startPoint(), self.myLine3.endPoint(), 0) - - SketchAPI_Constraint(dist).setValue(10) - self.myDOF += 1 - model.do() - self.assertDistance(self.myLine1.startPoint(), self.myLine3.endPoint(), 10) - - SketchAPI_Constraint(dist).setValue(0) - self.myDOF -= 1 - model.do() - self.assertDistance(self.myLine1.startPoint(), self.myLine3.endPoint(), 0) - - - def test_unsigned_distance_nzznz(self): - """ Test 3. Change unsigned point-line distance from non-zero to zero and back to non-zero - """ - dist = self.mySketch.setDistance(self.myLine1.result(), self.myLine2.endPoint(), 20) - self.myDOF -= 1 - model.do() - self.assertDistance(self.myLine1, self.myLine2.endPoint(), 20) - - SketchAPI_Constraint(dist).setValue(0) - model.do() - self.assertDistance(self.myLine1, self.myLine2.endPoint(), 0) - - SketchAPI_Constraint(dist).setValue(20) - model.do() - self.assertDistance(self.myLine1, self.myLine2.endPoint(), 20) - - def test_unsigned_distance_znzz(self): - """ Test 4. Change unsigned point-line distance from zero to non-zero and back to zero - """ - dist = self.mySketch.setDistance(self.myLine2.startPoint(), self.myLine1.result(), 0) - self.myDOF -= 1 - model.do() - self.assertDistance(self.myLine2.startPoint(), self.myLine1, 0) - - SketchAPI_Constraint(dist).setValue(10) - model.do() - self.assertDistance(self.myLine2.startPoint(), self.myLine1, 10) - - SketchAPI_Constraint(dist).setValue(0) - model.do() - self.assertDistance(self.myLine2.startPoint(), self.myLine1, 0) - - - def test_signed_distance_nzznz(self): - """ Test 5. Change signed point-line distance from non-zero to zero and back to non-zero - """ - dist = self.mySketch.setDistance(self.myLine1.result(), self.myLine2.endPoint(), 20, True) - self.myDOF -= 1 - model.do() - self.assertDistance(self.myLine1, self.myLine2.endPoint(), -20, True) - - SketchAPI_Constraint(dist).setValue(0) - model.do() - self.assertDistance(self.myLine1, self.myLine2.endPoint(), 0, True) - - SketchAPI_Constraint(dist).setValue(20) - model.do() - self.assertDistance(self.myLine1, self.myLine2.endPoint(), -20, True) - - def test_signed_distance_nzznz_2(self): - """ Test 6. Change signed point-line distance from non-zero to zero and back to non-zero - """ - dist = self.mySketch.setDistance(self.myLine3.startPoint(), self.myLine1.result(), 10, True) - self.myDOF -= 1 - model.do() - self.assertDistance(self.myLine1, self.myLine3.startPoint(), 10, True) - - SketchAPI_Constraint(dist).setValue(0) - model.do() - self.assertDistance(self.myLine1, self.myLine3.startPoint(), 0, True) - - SketchAPI_Constraint(dist).setValue(20) - model.do() - self.assertDistance(self.myLine1, self.myLine3.startPoint(), 20, True) - - def test_signed_distance_znzz(self): - """ Test 7. Change signed point-line distance from zero to non-zero and back to zero - """ - dist = self.mySketch.setDistance(self.myLine2.startPoint(), self.myLine1.result(), 0, True) - self.myDOF -= 1 - model.do() - self.assertDistance(self.myLine2.startPoint(), self.myLine1, 0) - - SketchAPI_Constraint(dist).setValue(10) - model.do() - self.assertDistance(self.myLine2.startPoint(), self.myLine1, 10) - - SketchAPI_Constraint(dist).setValue(0) - model.do() - self.assertDistance(self.myLine2.startPoint(), self.myLine1, 0) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myLine1 = self.mySketch.addLine(10, 10, 45, 27.5) + self.myLine2 = self.mySketch.addLine(20, 15, 30, 40) + self.myLine3 = self.mySketch.addLine(10, 0, 10, 10) + model.do() + self.myDOF = 12 + + def tearDown(self): + model.end() + model.checkSketch(self.mySketch, self.myDOF) + + def assertDistance(self, theObject1, theObject2, theDistance, isSigned=False): + dist = -1.0 + if issubclass(type(theObject1), SketchAPI_SketchEntity): + if isSigned: + dist = model.signedDistancePointLine(theObject2, theObject1) + else: + dist = model.distancePointLine(theObject2, theObject1) + elif issubclass(type(theObject2), SketchAPI_SketchEntity): + if isSigned: + dist = model.signedDistancePointLine(theObject1, theObject2) + else: + dist = model.distancePointLine(theObject1, theObject2) + else: + dist = model.distancePointPoint(theObject1, theObject2) + self.assertTrue( + math.fabs(dist - theDistance) < TOLERANCE, + "Current distance = {}, reference = {}".format(dist, theDistance), + ) + model.checkSketch(self.mySketch, self.myDOF) + + def test_distance_points_nzznz(self): + """Test 1. Change point-point distance from non-zero to zero and back to non-zero""" + dist = self.mySketch.setDistance( + self.myLine1.endPoint(), self.myLine2.endPoint(), 20 + ) + self.myDOF -= 1 + model.do() + self.assertDistance(self.myLine1.endPoint(), self.myLine2.endPoint(), 20) + + SketchAPI_Constraint(dist).setValue(0) + self.myDOF -= 1 + model.do() + self.assertDistance(self.myLine1.endPoint(), self.myLine2.endPoint(), 0) + + SketchAPI_Constraint(dist).setValue(20) + self.myDOF += 1 + model.do() + self.assertDistance(self.myLine1.endPoint(), self.myLine2.endPoint(), 20) + + def test_distance_points_znzz(self): + """Test 2. Change point-point distance from zero to non-zero and back to zero""" + dist = self.mySketch.setDistance( + self.myLine1.startPoint(), self.myLine3.endPoint(), 0 + ) + self.myDOF -= 2 + model.do() + self.assertDistance(self.myLine1.startPoint(), self.myLine3.endPoint(), 0) + + SketchAPI_Constraint(dist).setValue(10) + self.myDOF += 1 + model.do() + self.assertDistance(self.myLine1.startPoint(), self.myLine3.endPoint(), 10) + + SketchAPI_Constraint(dist).setValue(0) + self.myDOF -= 1 + model.do() + self.assertDistance(self.myLine1.startPoint(), self.myLine3.endPoint(), 0) + + def test_unsigned_distance_nzznz(self): + """Test 3. Change unsigned point-line distance from non-zero to zero and back to non-zero""" + dist = self.mySketch.setDistance( + self.myLine1.result(), self.myLine2.endPoint(), 20 + ) + self.myDOF -= 1 + model.do() + self.assertDistance(self.myLine1, self.myLine2.endPoint(), 20) + + SketchAPI_Constraint(dist).setValue(0) + model.do() + self.assertDistance(self.myLine1, self.myLine2.endPoint(), 0) + + SketchAPI_Constraint(dist).setValue(20) + model.do() + self.assertDistance(self.myLine1, self.myLine2.endPoint(), 20) + + def test_unsigned_distance_znzz(self): + """Test 4. Change unsigned point-line distance from zero to non-zero and back to zero""" + dist = self.mySketch.setDistance( + self.myLine2.startPoint(), self.myLine1.result(), 0 + ) + self.myDOF -= 1 + model.do() + self.assertDistance(self.myLine2.startPoint(), self.myLine1, 0) + + SketchAPI_Constraint(dist).setValue(10) + model.do() + self.assertDistance(self.myLine2.startPoint(), self.myLine1, 10) + + SketchAPI_Constraint(dist).setValue(0) + model.do() + self.assertDistance(self.myLine2.startPoint(), self.myLine1, 0) + + def test_signed_distance_nzznz(self): + """Test 5. Change signed point-line distance from non-zero to zero and back to non-zero""" + dist = self.mySketch.setDistance( + self.myLine1.result(), self.myLine2.endPoint(), 20, True + ) + self.myDOF -= 1 + model.do() + self.assertDistance(self.myLine1, self.myLine2.endPoint(), -20, True) + + SketchAPI_Constraint(dist).setValue(0) + model.do() + self.assertDistance(self.myLine1, self.myLine2.endPoint(), 0, True) + + SketchAPI_Constraint(dist).setValue(20) + model.do() + self.assertDistance(self.myLine1, self.myLine2.endPoint(), -20, True) + + def test_signed_distance_nzznz_2(self): + """Test 6. Change signed point-line distance from non-zero to zero and back to non-zero""" + dist = self.mySketch.setDistance( + self.myLine3.startPoint(), self.myLine1.result(), 10, True + ) + self.myDOF -= 1 + model.do() + self.assertDistance(self.myLine1, self.myLine3.startPoint(), 10, True) + + SketchAPI_Constraint(dist).setValue(0) + model.do() + self.assertDistance(self.myLine1, self.myLine3.startPoint(), 0, True) + + SketchAPI_Constraint(dist).setValue(20) + model.do() + self.assertDistance(self.myLine1, self.myLine3.startPoint(), 20, True) + + def test_signed_distance_znzz(self): + """Test 7. Change signed point-line distance from zero to non-zero and back to zero""" + dist = self.mySketch.setDistance( + self.myLine2.startPoint(), self.myLine1.result(), 0, True + ) + self.myDOF -= 1 + model.do() + self.assertDistance(self.myLine2.startPoint(), self.myLine1, 0) + + SketchAPI_Constraint(dist).setValue(10) + model.do() + self.assertDistance(self.myLine2.startPoint(), self.myLine1, 10) + + SketchAPI_Constraint(dist).setValue(0) + model.do() + self.assertDistance(self.myLine2.startPoint(), self.myLine1, 0) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestConstraintEqual.py b/src/SketchPlugin/Test/TestConstraintEqual.py index 9d95e54e0..b767e6826 100644 --- a/src/SketchPlugin/Test/TestConstraintEqual.py +++ b/src/SketchPlugin/Test/TestConstraintEqual.py @@ -32,15 +32,16 @@ from ModelAPI import * import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2015-03-16" -#========================================================================= + +# ========================================================================= # Auxiliary functions -#========================================================================= +# ========================================================================= def externalSketch(theDoc): aSketchFeature = featureToCompositeFeature(theDoc.addFeature("Sketch")) origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) @@ -52,15 +53,16 @@ def externalSketch(theDoc): # add circle defined by 3 points circle = aSketchFeature.addFeature("SketchMacroCircle") circle.string("circle_type").setValue("circle_type_by_three_points") - geomDataAPI_Point2D(circle.attribute("first_point")).setValue(-40., 50.) - geomDataAPI_Point2D(circle.attribute("second_point")).setValue(-50., 60.) - geomDataAPI_Point2D(circle.attribute("third_point")).setValue(-60., 50.) + geomDataAPI_Point2D(circle.attribute("first_point")).setValue(-40.0, 50.0) + geomDataAPI_Point2D(circle.attribute("second_point")).setValue(-50.0, 60.0) + geomDataAPI_Point2D(circle.attribute("third_point")).setValue(-60.0, 50.0) # add line line = aSketchFeature.addFeature("SketchLine") lineStart = geomDataAPI_Point2D(line.attribute("StartPoint")) lineEnd = geomDataAPI_Point2D(line.attribute("EndPoint")) - lineStart.setValue(-40., 35.) - lineEnd.setValue(-60., 25.) + lineStart.setValue(-40.0, 35.0) + lineEnd.setValue(-60.0, 25.0) + def lineLength(theLine): aLineStart = geomDataAPI_Point2D(theLine.attribute("StartPoint")) @@ -70,20 +72,20 @@ def lineLength(theLine): return math.hypot(aVecX, aVecY) -#========================================================================= +# ========================================================================= # Start of test -#========================================================================= +# ========================================================================= aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation external sketch -#========================================================================= +# ========================================================================= aSession.startOperation() externalSketch(aDocument) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -94,61 +96,61 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Creation of an arc and a circle -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchArc = aSketchFeature.addFeature("SketchArc") anArcCentr = geomDataAPI_Point2D(aSketchArc.attribute("center_point")) -anArcCentr.setValue(10., 10.) +anArcCentr.setValue(10.0, 10.0) anArcStartPoint = geomDataAPI_Point2D(aSketchArc.attribute("start_point")) -anArcStartPoint.setValue(0., 50.) +anArcStartPoint.setValue(0.0, 50.0) anArcEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("end_point")) -anArcEndPoint.setValue(50., 0.) +anArcEndPoint.setValue(50.0, 0.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 5) +assert model.dof(aSketchFeature) == 5 # Circle aSession.startOperation() aSketchCircle = aSketchFeature.addFeature("SketchCircle") anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center")) aCircleRadius = aSketchCircle.real("circle_radius") -anCircleCentr.setValue(-25., -25.) -aCircleRadius.setValue(25.) +anCircleCentr.setValue(-25.0, -25.0) +aCircleRadius.setValue(25.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 8) -#========================================================================= +assert model.dof(aSketchFeature) == 8 +# ========================================================================= # A constraint to make equal radii of arc and circle -#========================================================================= +# ========================================================================= aSession.startOperation() aConstraintEqRad = aSketchFeature.addFeature("SketchConstraintEqual") aRefObjectA = aConstraintEqRad.refattr("ConstraintEntityA") aRefObjectB = aConstraintEqRad.refattr("ConstraintEntityB") aResultA = modelAPI_ResultConstruction(aSketchArc.lastResult()) aResultB = modelAPI_ResultConstruction(aSketchCircle.lastResult()) -assert (aResultA is not None) -assert (aResultB is not None) +assert aResultA is not None +assert aResultB is not None aRefObjectA.setObject(aResultA) aRefObjectB.setObject(aResultB) aConstraintEqRad.execute() aSession.finishOperation() -aCircRadius = aCircleRadius.value(); +aCircRadius = aCircleRadius.value() anArcVecX = anArcStartPoint.x() - anArcCentr.x() anArcVecY = anArcStartPoint.y() - anArcCentr.y() anArcRadius = math.sqrt(anArcVecX**2 + anArcVecY**2) -assert (math.fabs(aCircRadius - anArcRadius) <= 1.e-10) -assert (model.dof(aSketchFeature) == 7) -#========================================================================= +assert math.fabs(aCircRadius - anArcRadius) <= 1.0e-10 +assert model.dof(aSketchFeature) == 7 +# ========================================================================= # A constraint to make equal radii of arc and external circle -#========================================================================= +# ========================================================================= aSession.startOperation() anExtCircle = aSketchFeature.addFeature("SketchCircle") anExtCircleCenter = geomDataAPI_Point2D(anExtCircle.attribute("circle_center")) anExtCircleRadius = anExtCircle.real("circle_radius") -anExtCircleCenter.setValue(-50., 50.) -anExtCircleRadius.setValue(10.) +anExtCircleCenter.setValue(-50.0, 50.0) +anExtCircleRadius.setValue(10.0) anExtCircle.selection("External").selectSubShape("EDGE", "Sketch_1/SketchCircle_1_2") aSession.finishOperation() -assert (model.dof(aSketchFeature) == 7) +assert model.dof(aSketchFeature) == 7 aSession.startOperation() aConstraintEqRad2 = aSketchFeature.addFeature("SketchConstraintEqual") aRefObjectA = aConstraintEqRad2.refattr("ConstraintEntityA") @@ -156,65 +158,65 @@ aRefObjectB = aConstraintEqRad2.refattr("ConstraintEntityB") aRefObjectA.setObject(aSketchCircle.lastResult()) aRefObjectB.setObject(anExtCircle.lastResult()) aSession.finishOperation() -assert (math.fabs(anExtCircleRadius.value() - aCircleRadius.value()) < 1.e-10) +assert math.fabs(anExtCircleRadius.value() - aCircleRadius.value()) < 1.0e-10 anArcVecX = anArcStartPoint.x() - anArcCentr.x() anArcVecY = anArcStartPoint.y() - anArcCentr.y() anArcRadius = math.sqrt(anArcVecX**2 + anArcVecY**2) -assert (math.fabs(anExtCircleRadius.value() - anArcRadius) <= 1.e-10) -assert (model.dof(aSketchFeature) == 6) +assert math.fabs(anExtCircleRadius.value() - anArcRadius) <= 1.0e-10 +assert model.dof(aSketchFeature) == 6 -#========================================================================= +# ========================================================================= # Creation of two different lines -#========================================================================= +# ========================================================================= # First Line aSession.startOperation() aSketchLine1 = aSketchFeature.addFeature("SketchLine") aLine1StartPoint = geomDataAPI_Point2D(aSketchLine1.attribute("StartPoint")) aLine1EndPoint = geomDataAPI_Point2D(aSketchLine1.attribute("EndPoint")) -aLine1StartPoint.setValue(0., 15.) -aLine1EndPoint.setValue(20., 25.) +aLine1StartPoint.setValue(0.0, 15.0) +aLine1EndPoint.setValue(20.0, 25.0) aSession.finishOperation() # Second Line aSession.startOperation() aSketchLine2 = aSketchFeature.addFeature("SketchLine") aLine2StartPoint = geomDataAPI_Point2D(aSketchLine2.attribute("StartPoint")) aLine2EndPoint = geomDataAPI_Point2D(aSketchLine2.attribute("EndPoint")) -aLine2StartPoint.setValue(0., 0.) -aLine2EndPoint.setValue(-1., 10.) +aLine2StartPoint.setValue(0.0, 0.0) +aLine2EndPoint.setValue(-1.0, 10.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 14) -#========================================================================= +assert model.dof(aSketchFeature) == 14 +# ========================================================================= # A constraint to make equal lengths of lines -#========================================================================= +# ========================================================================= aSession.startOperation() aConstraintEqLen = aSketchFeature.addFeature("SketchConstraintEqual") aRefObjectA = aConstraintEqLen.refattr("ConstraintEntityA") aRefObjectB = aConstraintEqLen.refattr("ConstraintEntityB") aResultA = modelAPI_ResultConstruction(aSketchLine1.firstResult()) aResultB = modelAPI_ResultConstruction(aSketchLine2.firstResult()) -assert (aResultA is not None) -assert (aResultB is not None) +assert aResultA is not None +assert aResultB is not None aRefObjectA.setObject(aResultA) aRefObjectB.setObject(aResultB) aConstraintEqLen.execute() aSession.finishOperation() aLine1Len = lineLength(aSketchLine1) aLine2Len = lineLength(aSketchLine2) -assert (math.fabs(aLine1Len - aLine2Len) < 1.e-10) -assert (model.dof(aSketchFeature) == 13) -#========================================================================= +assert math.fabs(aLine1Len - aLine2Len) < 1.0e-10 +assert model.dof(aSketchFeature) == 13 +# ========================================================================= # A constraint to make equal length of line with external line -#========================================================================= +# ========================================================================= aSession.startOperation() anExtLine = aSketchFeature.addFeature("SketchLine") anExtLineStart = geomDataAPI_Point2D(anExtLine.attribute("StartPoint")) anExtLineEnd = geomDataAPI_Point2D(anExtLine.attribute("EndPoint")) -anExtLineStart.setValue(-40., 35.) -anExtLineEnd.setValue(-60., 25.) +anExtLineStart.setValue(-40.0, 35.0) +anExtLineEnd.setValue(-60.0, 25.0) anExtLine.selection("External").selectSubShape("EDGE", "Sketch_1/SketchLine_1") anExtLineLen = lineLength(anExtLine) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 13) +assert model.dof(aSketchFeature) == 13 aSession.startOperation() aConstraintEqLen2 = aSketchFeature.addFeature("SketchConstraintEqual") aRefObjectA = aConstraintEqLen2.refattr("ConstraintEntityA") @@ -224,18 +226,18 @@ aRefObjectB.setObject(aSketchLine2.lastResult()) aSession.finishOperation() aLine1Len = lineLength(aSketchLine1) aLine2Len = lineLength(aSketchLine2) -assert (math.fabs(aLine1Len - anExtLineLen) < 1.e-10) -assert (math.fabs(aLine2Len - anExtLineLen) < 1.e-10) -assert (model.dof(aSketchFeature) == 12) -#========================================================================= +assert math.fabs(aLine1Len - anExtLineLen) < 1.0e-10 +assert math.fabs(aLine2Len - anExtLineLen) < 1.0e-10 +assert model.dof(aSketchFeature) == 12 +# ========================================================================= # Remove costraint to check the DOF -#========================================================================= +# ========================================================================= aSession.startOperation() aDocument.removeFeature(aConstraintEqLen2) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 13) -#========================================================================= +assert model.dof(aSketchFeature) == 13 +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintEqualEllipse.py b/src/SketchPlugin/Test/TestConstraintEqualEllipse.py index 293987205..0e417453c 100644 --- a/src/SketchPlugin/Test/TestConstraintEqualEllipse.py +++ b/src/SketchPlugin/Test/TestConstraintEqualEllipse.py @@ -29,45 +29,179 @@ DOF = 0 model.begin() partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(-27.88698315421018, 6.197107367602265, -8.725072906579975, 15.87998754592604, 11.10896680773502) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_1 = Sketch_1.addEllipse( + -27.88698315421018, + 6.197107367602265, + -8.725072906579975, + 15.87998754592604, + 11.10896680773502, +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) DOF += 5 -SketchEllipse_2 = Sketch_1.addEllipse(15.14848467636108, -15.95181340919842, 21.12194589112931, -20.27742325437541, 9.877448119278471) -[SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11, SketchPoint_12, SketchPoint_13, SketchPoint_14, SketchLine_3, SketchLine_4] = SketchEllipse_2.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipse_2 = Sketch_1.addEllipse( + 15.14848467636108, + -15.95181340919842, + 21.12194589112931, + -20.27742325437541, + 9.877448119278471, +) +[ + SketchPoint_8, + SketchPoint_9, + SketchPoint_10, + SketchPoint_11, + SketchPoint_12, + SketchPoint_13, + SketchPoint_14, + SketchLine_3, + SketchLine_4, +] = SketchEllipse_2.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) DOF += 5 -SketchEllipticArc_1 = Sketch_1.addEllipticArc(49.62123971365138, 13.34935433264426, 64.40153327705804, 5.234651852264014, 68.29270956846837, 8.653290073592997, 32.00833375829566, 14.82599483073829, False) -[SketchPoint_15, SketchPoint_16, SketchPoint_17, SketchPoint_18, SketchPoint_19, SketchPoint_20, SketchPoint_21, SketchLine_5, SketchLine_6] = SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipticArc_1 = Sketch_1.addEllipticArc( + 49.62123971365138, + 13.34935433264426, + 64.40153327705804, + 5.234651852264014, + 68.29270956846837, + 8.653290073592997, + 32.00833375829566, + 14.82599483073829, + False, +) +[ + SketchPoint_15, + SketchPoint_16, + SketchPoint_17, + SketchPoint_18, + SketchPoint_19, + SketchPoint_20, + SketchPoint_21, + SketchLine_5, + SketchLine_6, +] = SketchEllipticArc_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) DOF += 7 -SketchEllipticArc_2 = Sketch_1.addEllipticArc(7.849720447428027, 32.28934430567138, 19.71732573395684, 29.13862828729395, 12.53096585507117, 17.93622281956947, 4.288678376456463, 46.71874313598852, True) -[SketchPoint_22, SketchPoint_23, SketchPoint_24, SketchPoint_25, SketchPoint_26, SketchPoint_27, SketchPoint_28, SketchLine_7, SketchLine_8] = SketchEllipticArc_2.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipticArc_2 = Sketch_1.addEllipticArc( + 7.849720447428027, + 32.28934430567138, + 19.71732573395684, + 29.13862828729395, + 12.53096585507117, + 17.93622281956947, + 4.288678376456463, + 46.71874313598852, + True, +) +[ + SketchPoint_22, + SketchPoint_23, + SketchPoint_24, + SketchPoint_25, + SketchPoint_26, + SketchPoint_27, + SketchPoint_28, + SketchLine_7, + SketchLine_8, +] = SketchEllipticArc_2.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) DOF += 7 -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchEllipse_1.result(), SketchEllipse_2.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchEllipse_1.result(), SketchEllipse_2.result() +) DOF -= 2 -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchEllipse_1.result(), SketchEllipticArc_1.result()) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchEllipse_1.result(), SketchEllipticArc_1.result() +) DOF -= 2 -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchEllipticArc_1.result(), SketchEllipticArc_2.result()) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchEllipticArc_1.result(), SketchEllipticArc_2.result() +) DOF -= 2 model.do() model.end() -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -dist1 = model.distancePointPoint(SketchEllipse_1.majorAxisNegative(), SketchEllipse_1.majorAxisPositive()) -dist2 = model.distancePointPoint(SketchEllipse_2.majorAxisNegative(), SketchEllipse_2.majorAxisPositive()) -dist3 = model.distancePointPoint(SketchEllipticArc_1.majorAxisNegative(), SketchEllipticArc_1.majorAxisPositive()) -dist4 = model.distancePointPoint(SketchEllipticArc_2.majorAxisNegative(), SketchEllipticArc_2.majorAxisPositive()) -assert(math.fabs(dist1 - dist2) < TOLERANCE) -assert(math.fabs(dist1 - dist3) < TOLERANCE) -assert(math.fabs(dist1 - dist4) < TOLERANCE) +dist1 = model.distancePointPoint( + SketchEllipse_1.majorAxisNegative(), SketchEllipse_1.majorAxisPositive() +) +dist2 = model.distancePointPoint( + SketchEllipse_2.majorAxisNegative(), SketchEllipse_2.majorAxisPositive() +) +dist3 = model.distancePointPoint( + SketchEllipticArc_1.majorAxisNegative(), SketchEllipticArc_1.majorAxisPositive() +) +dist4 = model.distancePointPoint( + SketchEllipticArc_2.majorAxisNegative(), SketchEllipticArc_2.majorAxisPositive() +) +assert math.fabs(dist1 - dist2) < TOLERANCE +assert math.fabs(dist1 - dist3) < TOLERANCE +assert math.fabs(dist1 - dist4) < TOLERANCE -dist1 = model.distancePointPoint(SketchEllipse_1.minorAxisNegative(), SketchEllipse_1.minorAxisPositive()) -dist2 = model.distancePointPoint(SketchEllipse_2.minorAxisNegative(), SketchEllipse_2.minorAxisPositive()) -dist3 = model.distancePointPoint(SketchEllipticArc_1.minorAxisNegative(), SketchEllipticArc_1.minorAxisPositive()) -dist4 = model.distancePointPoint(SketchEllipticArc_2.minorAxisNegative(), SketchEllipticArc_2.minorAxisPositive()) -assert(math.fabs(dist1 - dist2) < TOLERANCE) -assert(math.fabs(dist1 - dist3) < TOLERANCE) -assert(math.fabs(dist1 - dist4) < TOLERANCE) +dist1 = model.distancePointPoint( + SketchEllipse_1.minorAxisNegative(), SketchEllipse_1.minorAxisPositive() +) +dist2 = model.distancePointPoint( + SketchEllipse_2.minorAxisNegative(), SketchEllipse_2.minorAxisPositive() +) +dist3 = model.distancePointPoint( + SketchEllipticArc_1.minorAxisNegative(), SketchEllipticArc_1.minorAxisPositive() +) +dist4 = model.distancePointPoint( + SketchEllipticArc_2.minorAxisNegative(), SketchEllipticArc_2.minorAxisPositive() +) +assert math.fabs(dist1 - dist2) < TOLERANCE +assert math.fabs(dist1 - dist3) < TOLERANCE +assert math.fabs(dist1 - dist4) < TOLERANCE -assert(model.dof(Sketch_1) == DOF) +assert model.dof(Sketch_1) == DOF -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintFixed.py b/src/SketchPlugin/Test/TestConstraintFixed.py index 0dd2cd89e..3c4d9c1bf 100644 --- a/src/SketchPlugin/Test/TestConstraintFixed.py +++ b/src/SketchPlugin/Test/TestConstraintFixed.py @@ -39,17 +39,17 @@ from ModelAPI import * from GeomAPI import * from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2014-11-21" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -60,9 +60,9 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create a triangle ABC -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchLineA = aSketchFeature.addFeature("SketchLine") aSketchLineB = aSketchFeature.addFeature("SketchLine") @@ -73,26 +73,30 @@ 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.) +aLineAStartPoint.setValue(25.0, 25.0) +aLineAEndPoint.setValue(100.0, 25.0) +aLineBStartPoint.setValue(100.0, 25.0) +aLineBEndPoint.setValue(60.0, 75.0) +aLineCStartPoint.setValue(60.0, 75.0) +aLineCEndPoint.setValue(25.0, 25.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 12) +assert model.dof(aSketchFeature) == 12 # Store initial values of lines kLineAStart = (aLineAStartPoint.x(), aLineAStartPoint.y()) -kLineAEnd = (aLineAEndPoint.x(), aLineAEndPoint.y()) +kLineAEnd = (aLineAEndPoint.x(), aLineAEndPoint.y()) kLineBStart = (aLineBStartPoint.x(), aLineBStartPoint.y()) -kLineBEnd = (aLineBEndPoint.x(), aLineBEndPoint.y()) +kLineBEnd = (aLineBEndPoint.x(), aLineBEndPoint.y()) kLineCStart = (aLineCStartPoint.x(), aLineCStartPoint.y()) -kLineCEnd = (aLineCEndPoint.x(), aLineCEndPoint.y()) -#========================================================================= +kLineCEnd = (aLineCEndPoint.x(), aLineCEndPoint.y()) +# ========================================================================= # Link triange lines with concidence -#========================================================================= -concidenceLinks = list(zip([aLineBStartPoint, aLineCStartPoint, aLineAStartPoint], - [aLineAEndPoint, aLineBEndPoint, aLineCEndPoint])) +# ========================================================================= +concidenceLinks = list( + zip( + [aLineBStartPoint, aLineCStartPoint, aLineAStartPoint], + [aLineAEndPoint, aLineBEndPoint, aLineCEndPoint], + ) +) aSession.startOperation() for eachLink in concidenceLinks: aConstraint = aSketchFeature.addFeature("SketchConstraintCoincidence") @@ -102,18 +106,18 @@ for eachLink in concidenceLinks: reflistB.setAttr(eachLink[1]) aConstraint.execute() aSession.finishOperation() -assert (model.dof(aSketchFeature) == 6) +assert model.dof(aSketchFeature) == 6 # Check that constarints doesn't affected lines' values -assert (kLineAStart == (aLineAStartPoint.x(), aLineAStartPoint.y())) -assert (kLineAEnd == (aLineAEndPoint.x(), aLineAEndPoint.y())) -assert (kLineBStart == (aLineBStartPoint.x(), aLineBStartPoint.y())) -assert (kLineBEnd == (aLineBEndPoint.x(), aLineBEndPoint.y())) -assert (kLineCStart == (aLineCStartPoint.x(), aLineCStartPoint.y())) -assert (kLineCEnd == (aLineCEndPoint.x(), aLineCEndPoint.y())) -#========================================================================= +assert kLineAStart == (aLineAStartPoint.x(), aLineAStartPoint.y()) +assert kLineAEnd == (aLineAEndPoint.x(), aLineAEndPoint.y()) +assert kLineBStart == (aLineBStartPoint.x(), aLineBStartPoint.y()) +assert kLineBEnd == (aLineBEndPoint.x(), aLineBEndPoint.y()) +assert kLineCStart == (aLineCStartPoint.x(), aLineCStartPoint.y()) +assert kLineCEnd == (aLineCEndPoint.x(), aLineCEndPoint.y()) +# ========================================================================= # Make line A rigid -#========================================================================= +# ========================================================================= aSession.startOperation() aRigidConstraint = aSketchFeature.addFeature("SketchConstraintRigid") eachRefattr = aRigidConstraint.refattr("ConstraintEntityA") @@ -122,58 +126,94 @@ for eachResult in lineResults: if eachResult.shape().isEdge(): break aResult = modelAPI_ResultConstruction(eachResult) -assert (aResult is not None) +assert aResult is not None eachRefattr.setObject(aResult) # aRigidConstraint.execute() aSession.finishOperation() # Check that constarints doesn't affected lines' values -assert ((aLineAStartPoint.x(), aLineAStartPoint.y()) == (aLineCEndPoint.x(), aLineCEndPoint.y())) -assert ((aLineBStartPoint.x(), aLineBStartPoint.y()) == (aLineAEndPoint.x(), aLineAEndPoint.y())) -assert ((aLineCStartPoint.x(), aLineCStartPoint.y()) == (aLineBEndPoint.x(), aLineBEndPoint.y())) -assert (model.dof(aSketchFeature) == 2) +assert (aLineAStartPoint.x(), aLineAStartPoint.y()) == ( + aLineCEndPoint.x(), + aLineCEndPoint.y(), +) +assert (aLineBStartPoint.x(), aLineBStartPoint.y()) == ( + aLineAEndPoint.x(), + aLineAEndPoint.y(), +) +assert (aLineCStartPoint.x(), aLineCStartPoint.y()) == ( + aLineBEndPoint.x(), + aLineBEndPoint.y(), +) +assert model.dof(aSketchFeature) == 2 -#========================================================================= +# ========================================================================= # Check that moving line A does not affect lines -#========================================================================= +# ========================================================================= aSession.startOperation() -aLineAEndPoint.setValue(90., 0.) +aLineAEndPoint.setValue(90.0, 0.0) aSession.finishOperation() # Check that constarint keep features' values -assert ((aLineAStartPoint.x(), aLineAStartPoint.y()) == (aLineCEndPoint.x(), aLineCEndPoint.y())) -assert ((aLineBStartPoint.x(), aLineBStartPoint.y()) == (aLineAEndPoint.x(), aLineAEndPoint.y())) -assert ((aLineCStartPoint.x(), aLineCStartPoint.y()) == (aLineBEndPoint.x(), aLineBEndPoint.y())) -assert (model.dof(aSketchFeature) == 2) +assert (aLineAStartPoint.x(), aLineAStartPoint.y()) == ( + aLineCEndPoint.x(), + aLineCEndPoint.y(), +) +assert (aLineBStartPoint.x(), aLineBStartPoint.y()) == ( + aLineAEndPoint.x(), + aLineAEndPoint.y(), +) +assert (aLineCStartPoint.x(), aLineCStartPoint.y()) == ( + aLineBEndPoint.x(), + aLineBEndPoint.y(), +) +assert model.dof(aSketchFeature) == 2 -#========================================================================= +# ========================================================================= # Check that moving line B does not affect lines -#========================================================================= +# ========================================================================= aSession.startOperation() -aLineBEndPoint.setValue(90., 150.) +aLineBEndPoint.setValue(90.0, 150.0) aSession.finishOperation() # Check that constarint keep features' values -assert ((aLineAStartPoint.x(), aLineAStartPoint.y()) == (aLineCEndPoint.x(), aLineCEndPoint.y())) -assert ((aLineBStartPoint.x(), aLineBStartPoint.y()) == (aLineAEndPoint.x(), aLineAEndPoint.y())) -assert ((aLineCStartPoint.x(), aLineCStartPoint.y()) == (aLineBEndPoint.x(), aLineBEndPoint.y())) -assert (model.dof(aSketchFeature) == 2) +assert (aLineAStartPoint.x(), aLineAStartPoint.y()) == ( + aLineCEndPoint.x(), + aLineCEndPoint.y(), +) +assert (aLineBStartPoint.x(), aLineBStartPoint.y()) == ( + aLineAEndPoint.x(), + aLineAEndPoint.y(), +) +assert (aLineCStartPoint.x(), aLineCStartPoint.y()) == ( + aLineBEndPoint.x(), + aLineBEndPoint.y(), +) +assert model.dof(aSketchFeature) == 2 -#========================================================================= +# ========================================================================= # Remove constraint, move line to check that it is not fixed -#========================================================================= +# ========================================================================= aSession.startOperation() aDocument.removeFeature(aRigidConstraint) -aLineBEndPoint.setValue(90., 150.) +aLineBEndPoint.setValue(90.0, 150.0) aSession.finishOperation() -assert ((aLineAStartPoint.x(), aLineAStartPoint.y()) == (aLineCEndPoint.x(), aLineCEndPoint.y())) -assert ((aLineBStartPoint.x(), aLineBStartPoint.y()) == (aLineAEndPoint.x(), aLineAEndPoint.y())) -assert ((aLineCStartPoint.x(), aLineCStartPoint.y()) == (aLineBEndPoint.x(), aLineBEndPoint.y())) -assert (model.dof(aSketchFeature) == 6) +assert (aLineAStartPoint.x(), aLineAStartPoint.y()) == ( + aLineCEndPoint.x(), + aLineCEndPoint.y(), +) +assert (aLineBStartPoint.x(), aLineBStartPoint.y()) == ( + aLineAEndPoint.x(), + aLineAEndPoint.y(), +) +assert (aLineCStartPoint.x(), aLineCStartPoint.y()) == ( + aLineBEndPoint.x(), + aLineBEndPoint.y(), +) +assert model.dof(aSketchFeature) == 6 -#========================================================================= +# ========================================================================= # Create circle, fix it and check the circle is not moved -#========================================================================= -aCenter = [10., 10.] -aRadius = 5. +# ========================================================================= +aCenter = [10.0, 10.0] +aRadius = 5.0 aSession.startOperation() aCircle = aSketchFeature.addFeature("SketchCircle") aCircleCenter = geomDataAPI_Point2D(aCircle.attribute("circle_center")) @@ -181,58 +221,58 @@ aCircleRadius = aCircle.real("circle_radius") aCircleCenter.setValue(aCenter[0], aCenter[1]) aCircleRadius.setValue(aRadius) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 9) +assert model.dof(aSketchFeature) == 9 # fixed constraints aSession.startOperation() aRigidConstraint = aSketchFeature.addFeature("SketchConstraintRigid") aRigidConstraint.refattr("ConstraintEntityA").setObject(aCircle.lastResult()) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 6) +assert model.dof(aSketchFeature) == 6 # move center of circle aSession.startOperation() -aCircleCenter.setValue(aCenter[0] + 1., aCenter[1] - 1.) +aCircleCenter.setValue(aCenter[0] + 1.0, aCenter[1] - 1.0) aSession.finishOperation() -assert (aCircleCenter.x() == aCenter[0] and aCircleCenter.y() == aCenter[1]) -assert (aCircleRadius.value() == aRadius) -assert (model.dof(aSketchFeature) == 6) +assert aCircleCenter.x() == aCenter[0] and aCircleCenter.y() == aCenter[1] +assert aCircleRadius.value() == aRadius +assert model.dof(aSketchFeature) == 6 # change radius of circle aSession.startOperation() -aCircleRadius.setValue(aRadius + 3.) +aCircleRadius.setValue(aRadius + 3.0) aSession.finishOperation() -assert (aCircleCenter.x() == aCenter[0] and aCircleCenter.y() == aCenter[1]) -assert (aCircleRadius.value() == aRadius) -assert (model.dof(aSketchFeature) == 6) +assert aCircleCenter.x() == aCenter[0] and aCircleCenter.y() == aCenter[1] +assert aCircleRadius.value() == aRadius +assert model.dof(aSketchFeature) == 6 -#========================================================================= +# ========================================================================= # Remove Fixed constraint and check the circle can be moved -#========================================================================= +# ========================================================================= aSession.startOperation() aDocument.removeFeature(aRigidConstraint) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 9) +assert model.dof(aSketchFeature) == 9 # move center of circle -aCenter = [aCenter[0] + 1., aCenter[1] - 1.] +aCenter = [aCenter[0] + 1.0, aCenter[1] - 1.0] aSession.startOperation() aCircleCenter.setValue(aCenter[0], aCenter[1]) aSession.finishOperation() -assert (aCircleCenter.x() == aCenter[0] and aCircleCenter.y() == aCenter[1]) -assert (aCircleRadius.value() == aRadius) -assert (model.dof(aSketchFeature) == 9) +assert aCircleCenter.x() == aCenter[0] and aCircleCenter.y() == aCenter[1] +assert aCircleRadius.value() == aRadius +assert model.dof(aSketchFeature) == 9 # change radius of circle -aRadius = aRadius + 3. +aRadius = aRadius + 3.0 aSession.startOperation() aCircleRadius.setValue(aRadius) aSession.finishOperation() -assert (aCircleCenter.x() == aCenter[0] and aCircleCenter.y() == aCenter[1]) -assert (aCircleRadius.value() == aRadius) -assert (model.dof(aSketchFeature) == 9) +assert aCircleCenter.x() == aCenter[0] and aCircleCenter.y() == aCenter[1] +assert aCircleRadius.value() == aRadius +assert model.dof(aSketchFeature) == 9 -#========================================================================= +# ========================================================================= # Create arc, fix it and check it is not moved -#========================================================================= -aCenter = [10., 10.] -aStart = [5., 10.] -aEnd = [10., 15.] +# ========================================================================= +aCenter = [10.0, 10.0] +aStart = [5.0, 10.0] +aEnd = [10.0, 15.0] aSession.startOperation() anArc = aSketchFeature.addFeature("SketchArc") anArcCenter = geomDataAPI_Point2D(anArc.attribute("center_point")) @@ -242,69 +282,69 @@ anArcCenter.setValue(aCenter[0], aCenter[1]) anArcStart.setValue(aStart[0], aStart[1]) anArcEnd.setValue(aEnd[0], aEnd[1]) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 14) +assert model.dof(aSketchFeature) == 14 # fixed constraints aSession.startOperation() aRigidConstraint = aSketchFeature.addFeature("SketchConstraintRigid") aRigidConstraint.refattr("ConstraintEntityA").setObject(anArc.lastResult()) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 9) +assert model.dof(aSketchFeature) == 9 # move center of arc aSession.startOperation() -anArcCenter.setValue(aCenter[0] + 1., aCenter[1] - 1.) +anArcCenter.setValue(aCenter[0] + 1.0, aCenter[1] - 1.0) aSession.finishOperation() -assert (anArcCenter.x() == aCenter[0] and anArcCenter.y() == aCenter[1]) -assert (anArcStart.x() == aStart[0] and anArcStart.y() == aStart[1]) -assert (anArcEnd.x() == aEnd[0] and anArcEnd.y() == aEnd[1]) -assert (model.dof(aSketchFeature) == 9) +assert anArcCenter.x() == aCenter[0] and anArcCenter.y() == aCenter[1] +assert anArcStart.x() == aStart[0] and anArcStart.y() == aStart[1] +assert anArcEnd.x() == aEnd[0] and anArcEnd.y() == aEnd[1] +assert model.dof(aSketchFeature) == 9 # move start point of arc aSession.startOperation() -anArcStart.setValue(aStart[0] + 1., aStart[1] - 1.) +anArcStart.setValue(aStart[0] + 1.0, aStart[1] - 1.0) aSession.finishOperation() -assert (anArcCenter.x() == aCenter[0] and anArcCenter.y() == aCenter[1]) -assert (anArcStart.x() == aStart[0] and anArcStart.y() == aStart[1]) -assert (anArcEnd.x() == aEnd[0] and anArcEnd.y() == aEnd[1]) -assert (model.dof(aSketchFeature) == 9) +assert anArcCenter.x() == aCenter[0] and anArcCenter.y() == aCenter[1] +assert anArcStart.x() == aStart[0] and anArcStart.y() == aStart[1] +assert anArcEnd.x() == aEnd[0] and anArcEnd.y() == aEnd[1] +assert model.dof(aSketchFeature) == 9 # move end point of arc aSession.startOperation() -anArcEnd.setValue(aEnd[0] + 1., aEnd[1] - 1.) +anArcEnd.setValue(aEnd[0] + 1.0, aEnd[1] - 1.0) aSession.finishOperation() -assert (anArcCenter.x() == aCenter[0] and anArcCenter.y() == aCenter[1]) -assert (anArcStart.x() == aStart[0] and anArcStart.y() == aStart[1]) -assert (anArcEnd.x() == aEnd[0] and anArcEnd.y() == aEnd[1]) -assert (model.dof(aSketchFeature) == 9) +assert anArcCenter.x() == aCenter[0] and anArcCenter.y() == aCenter[1] +assert anArcStart.x() == aStart[0] and anArcStart.y() == aStart[1] +assert anArcEnd.x() == aEnd[0] and anArcEnd.y() == aEnd[1] +assert model.dof(aSketchFeature) == 9 -#========================================================================= +# ========================================================================= # Remove Fixed constraint and check the arc can be moved -#========================================================================= +# ========================================================================= aSession.startOperation() aDocument.removeFeature(aRigidConstraint) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 14) +assert model.dof(aSketchFeature) == 14 # move center of arc aCenter = [anArcCenter.x(), anArcCenter.y()] aSession.startOperation() -anArcCenter.setValue(aCenter[0] + 1., aCenter[1] - 1.) +anArcCenter.setValue(aCenter[0] + 1.0, aCenter[1] - 1.0) aSession.finishOperation() -assert (anArcCenter.x() != aCenter[0] or anArcCenter.y() != aCenter[1]) -assert (model.dof(aSketchFeature) == 14) +assert anArcCenter.x() != aCenter[0] or anArcCenter.y() != aCenter[1] +assert model.dof(aSketchFeature) == 14 # move start point of arc aStart = [anArcStart.x(), anArcStart.y()] aSession.startOperation() -anArcStart.setValue(aStart[0] + 1., aStart[1] - 1.) +anArcStart.setValue(aStart[0] + 1.0, aStart[1] - 1.0) aSession.finishOperation() -assert (anArcStart.x() != aStart[0] or anArcStart.y() != aStart[1]) -assert (model.dof(aSketchFeature) == 14) +assert anArcStart.x() != aStart[0] or anArcStart.y() != aStart[1] +assert model.dof(aSketchFeature) == 14 # move end point of arc aEnd = [anArcEnd.x(), anArcEnd.y()] aSession.startOperation() -anArcEnd.setValue(aEnd[0] + 1., aEnd[1] - 1.) +anArcEnd.setValue(aEnd[0] + 1.0, aEnd[1] - 1.0) aSession.finishOperation() -assert (anArcEnd.x() != aEnd[0] or anArcEnd.y() != aEnd[1]) -assert (model.dof(aSketchFeature) == 14) +assert anArcEnd.x() != aEnd[0] or anArcEnd.y() != aEnd[1] +assert model.dof(aSketchFeature) == 14 -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintHorizontal.py b/src/SketchPlugin/Test/TestConstraintHorizontal.py index 605abad93..bbb6e7e49 100644 --- a/src/SketchPlugin/Test/TestConstraintHorizontal.py +++ b/src/SketchPlugin/Test/TestConstraintHorizontal.py @@ -30,17 +30,17 @@ from GeomDataAPI import * from ModelAPI import * from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2015-03-16" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -51,53 +51,51 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create non-horizontal line -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchLine = aSketchFeature.addFeature("SketchLine") aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) -aLineStartPoint.setValue(0., 15.) -aLineEndPoint.setValue(20., 25.) +aLineStartPoint.setValue(0.0, 15.0) +aLineEndPoint.setValue(20.0, 25.0) aSession.finishOperation() -assert(model.dof(aSketchFeature) == 4) -#========================================================================= +assert model.dof(aSketchFeature) == 4 +# ========================================================================= # Assign horizontal constraint for a line -#========================================================================= +# ========================================================================= aSession.startOperation() aHorizontalConstraint = aSketchFeature.addFeature("SketchConstraintHorizontal") refattrA = aHorizontalConstraint.refattr("ConstraintEntityA") aResult = modelAPI_ResultConstruction(aSketchLine.firstResult()) -assert (aResult is not None) +assert aResult is not None refattrA.setObject(aResult) aHorizontalConstraint.execute() aSession.finishOperation() -assert(aLineStartPoint.y() == aLineEndPoint.y()) -assert(model.dof(aSketchFeature) == 3) -#========================================================================= +assert aLineStartPoint.y() == aLineEndPoint.y() +assert model.dof(aSketchFeature) == 3 +# ========================================================================= # Move one of boundary points of a line -#========================================================================= -deltaX = deltaY = 10. +# ========================================================================= +deltaX = deltaY = 10.0 aSession.startOperation() -aLineStartPoint.setValue(aLineStartPoint.x() + deltaX, - aLineStartPoint.y() + deltaY) +aLineStartPoint.setValue(aLineStartPoint.x() + deltaX, aLineStartPoint.y() + deltaY) aSession.finishOperation() -assert(aLineStartPoint.y() == aLineEndPoint.y()) -assert(model.dof(aSketchFeature) == 3) -#========================================================================= +assert aLineStartPoint.y() == aLineEndPoint.y() +assert model.dof(aSketchFeature) == 3 +# ========================================================================= # Move other boundary point of a line -#========================================================================= -deltaX = -3. -deltaY = -10. +# ========================================================================= +deltaX = -3.0 +deltaY = -10.0 aSession.startOperation() -aLineEndPoint.setValue(aLineEndPoint.x() + deltaX, - aLineEndPoint.y() + deltaY) +aLineEndPoint.setValue(aLineEndPoint.x() + deltaX, aLineEndPoint.y() + deltaY) aSession.finishOperation() -assert(aLineStartPoint.y() == aLineEndPoint.y()) -assert(model.dof(aSketchFeature) == 3) -#========================================================================= +assert aLineStartPoint.y() == aLineEndPoint.y() +assert model.dof(aSketchFeature) == 3 +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintHorizontalValidator.py b/src/SketchPlugin/Test/TestConstraintHorizontalValidator.py index d5c9102da..0273857e0 100644 --- a/src/SketchPlugin/Test/TestConstraintHorizontalValidator.py +++ b/src/SketchPlugin/Test/TestConstraintHorizontalValidator.py @@ -23,47 +23,50 @@ selection segments that already have one of these constraint" """ -#========================================================================= +# ========================================================================= # of the test -#========================================================================= +# ========================================================================= from salome.shaper import model from ModelAPI import * import math -#========================================================================= + +# ========================================================================= # Creation of a part -#========================================================================= +# ========================================================================= model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(20, 20, 40, 80) SketchLine_2 = Sketch_1.addLine(40, 80, 60, 40) -SketchConstraintCoincidence_1 = 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_1.result()) model.do() -#========================================================================= +# ========================================================================= # Checking that sketch and constraints become invalid when to one line # two horizontal/vertical constraints are applied in any combination -#========================================================================= +# ========================================================================= aFactory = ModelAPI_Session.get().validators() -assert(aFactory.validate(Sketch_1.feature())) -assert(Sketch_1.feature().error() != '') -#========================================================================= +assert aFactory.validate(Sketch_1.feature()) +assert Sketch_1.feature().error() != "" +# ========================================================================= # Remove duplicated Vertical constraints -#========================================================================= +# ========================================================================= Part_1_doc.removeFeature(SketchConstraintVertical_1.feature()) -assert(aFactory.validate(Sketch_1.feature())) +assert aFactory.validate(Sketch_1.feature()) model.do() -#========================================================================= +# ========================================================================= # Checking that after excess constraints are removed or undone, # sketch becomes valid. -#========================================================================= -assert(aFactory.validate(Sketch_1.feature())) -assert(Sketch_1.feature().error() == '') +# ========================================================================= +assert aFactory.validate(Sketch_1.feature()) +assert Sketch_1.feature().error() == "" -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintLength.py b/src/SketchPlugin/Test/TestConstraintLength.py index ed9214d89..9226595f1 100644 --- a/src/SketchPlugin/Test/TestConstraintLength.py +++ b/src/SketchPlugin/Test/TestConstraintLength.py @@ -33,17 +33,17 @@ from ModelAPI import * import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2014-10-28" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -54,70 +54,69 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create a line with length 100 -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchLineA = aSketchFeature.addFeature("SketchLine") aLineAStartPoint = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint")) aLineAEndPoint = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint")) -aLineAStartPoint.setValue(0., 25.) -aLineAEndPoint.setValue(100., 25.) +aLineAStartPoint.setValue(0.0, 25.0) +aLineAEndPoint.setValue(100.0, 25.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 4) -#========================================================================= +assert model.dof(aSketchFeature) == 4 +# ========================================================================= # Make a constraint to keep the length -#========================================================================= +# ========================================================================= aSession.startOperation() aLengthConstraint = aSketchFeature.addFeature("SketchConstraintLength") refattrA = aLengthConstraint.refattr("ConstraintEntityA") aLength = aLengthConstraint.real("ConstraintValue") -assert (not refattrA.isInitialized()) -assert (not aLength.isInitialized()) +assert not refattrA.isInitialized() +assert not aLength.isInitialized() aResult = aSketchLineA.firstResult() -assert (aResult is not None) +assert aResult is not None refattrA.setObject(modelAPI_ResultConstruction(aResult)) # aLength.setValue(100.) aLengthConstraint.execute() aSession.finishOperation() -assert (aLength.isInitialized()) -assert (refattrA.isInitialized()) -assert (model.dof(aSketchFeature) == 3) -#========================================================================= +assert aLength.isInitialized() +assert refattrA.isInitialized() +assert model.dof(aSketchFeature) == 3 +# ========================================================================= # Check values and move one constrainted object -#========================================================================= -deltaX = 40. +# ========================================================================= +deltaX = 40.0 # move start point, check that end point are moved also -assert (aLineAStartPoint.x() == 0) -assert (aLineAStartPoint.y() == 25) -assert (aLineAEndPoint.x() == 100) -assert (aLineAEndPoint.y() == 25) +assert aLineAStartPoint.x() == 0 +assert aLineAStartPoint.y() == 25 +assert aLineAEndPoint.x() == 100 +assert aLineAEndPoint.y() == 25 aSession.startOperation() -aLineAStartPoint.setValue(aLineAStartPoint.x() + deltaX, - aLineAStartPoint.y()) +aLineAStartPoint.setValue(aLineAStartPoint.x() + deltaX, aLineAStartPoint.y()) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 3) -assert (aLineAStartPoint.y() == 25) -assert (aLineAEndPoint.y() == 25) +assert model.dof(aSketchFeature) == 3 +assert aLineAStartPoint.y() == 25 +assert aLineAEndPoint.y() == 25 # length of the line is the same -assert (math.fabs(aLineAEndPoint.x() - aLineAStartPoint.x() - 100) < 1.e-10) -#========================================================================= +assert math.fabs(aLineAEndPoint.x() - aLineAStartPoint.x() - 100) < 1.0e-10 +# ========================================================================= # Change the length value of the constraint -#========================================================================= +# ========================================================================= aSession.startOperation() -aLength.setValue(140.) +aLength.setValue(140.0) aLengthConstraint.execute() aSession.finishOperation() -assert (math.fabs(aLineAEndPoint.x() - aLineAStartPoint.x() - 140) < 1.e-10) -assert (model.dof(aSketchFeature) == 3) -#========================================================================= +assert math.fabs(aLineAEndPoint.x() - aLineAStartPoint.x() - 140) < 1.0e-10 +assert model.dof(aSketchFeature) == 3 +# ========================================================================= # TODO: improve test # 1. remove constraint, move line's start point to # check that constraint are not applied -#========================================================================= -#========================================================================= +# ========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintMiddlePoint.py b/src/SketchPlugin/Test/TestConstraintMiddlePoint.py index 9814bb731..1c402f7dd 100644 --- a/src/SketchPlugin/Test/TestConstraintMiddlePoint.py +++ b/src/SketchPlugin/Test/TestConstraintMiddlePoint.py @@ -41,39 +41,43 @@ from SketchAPI import * import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2016-01-29" -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -#========================================================================= +# ========================================================================= # Auxiliary functions -#========================================================================= +# ========================================================================= def checkMiddlePoint(point, line): aStart = geomDataAPI_Point2D(line.attribute("StartPoint")) - aEnd = geomDataAPI_Point2D(line.attribute("EndPoint")) - assert math.fabs(aStart.x() + aEnd.x() - 2.0 * point.x()) <= TOLERANCE, "x1={0}, x2={1}, mid={2}".format(aStart.x(), aEnd.x(), point.x()) - assert math.fabs(aStart.y() + aEnd.y() - 2.0 * point.y()) <= TOLERANCE, "y1={0}, y2={1}, mid={2}".format(aStart.y(), aEnd.y(), point.y()) + aEnd = geomDataAPI_Point2D(line.attribute("EndPoint")) + assert ( + math.fabs(aStart.x() + aEnd.x() - 2.0 * point.x()) <= TOLERANCE + ), "x1={0}, x2={1}, mid={2}".format(aStart.x(), aEnd.x(), point.x()) + assert ( + math.fabs(aStart.y() + aEnd.y() - 2.0 * point.y()) <= TOLERANCE + ), "y1={0}, y2={1}, mid={2}".format(aStart.y(), aEnd.y(), point.y()) -#========================================================================= +# ========================================================================= # Start of test -#========================================================================= +# ========================================================================= aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() # add an origin aSession.startOperation() aFeature = aDocument.addFeature("Point") -geomDataAPI_Point(aFeature.attribute("point3d")).setValue(0., 0., 0.) +geomDataAPI_Point(aFeature.attribute("point3d")).setValue(0.0, 0.0, 0.0) aFeature.string("creation_method").setValue("by_xyz") anOriginName = aFeature.name() aSession.finishOperation() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchFeature = featureToCompositeFeature(aDocument.addFeature("Sketch")) origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) @@ -83,25 +87,25 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create a two lines -#========================================================================= +# ========================================================================= aSession.startOperation() aLine1 = aSketchFeature.addFeature("SketchLine") aStartPoint1 = geomDataAPI_Point2D(aLine1.attribute("StartPoint")) aEndPoint1 = geomDataAPI_Point2D(aLine1.attribute("EndPoint")) -aStartPoint1.setValue(50., 0.) -aEndPoint1.setValue(100., 25.) +aStartPoint1.setValue(50.0, 0.0) +aEndPoint1.setValue(100.0, 25.0) aLine2 = aSketchFeature.addFeature("SketchLine") aStartPoint2 = geomDataAPI_Point2D(aLine2.attribute("StartPoint")) aEndPoint2 = geomDataAPI_Point2D(aLine2.attribute("EndPoint")) -aStartPoint2.setValue(10., 100.) -aEndPoint2.setValue(100., 25.) +aStartPoint2.setValue(10.0, 100.0) +aEndPoint2.setValue(100.0, 25.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 8) -#========================================================================= +assert model.dof(aSketchFeature) == 8 +# ========================================================================= # Make end point of second line middle point on first line -#========================================================================= +# ========================================================================= aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintMiddle") reflistA = aConstraint.refattr("ConstraintEntityA") @@ -112,16 +116,18 @@ reflistA.setAttr(aEndPoint2) reflistB.setObject(aLine1.lastResult()) aConstraint.execute() aSession.finishOperation() -#========================================================================= +# ========================================================================= # Check error message (this message is not a error but a limitation of PlaneGCS) # If the problem will be resolved, following block may be removed -#========================================================================= -assert aSketchFeature.string("SolverError").value() != "", "PlaneGCS limitation: if you see this message, then PlaneGCS has solved conflicting constraints when applying Middle constraint for the point out of the segment" +# ========================================================================= +assert ( + aSketchFeature.string("SolverError").value() != "" +), "PlaneGCS limitation: if you see this message, then PlaneGCS has solved conflicting constraints when applying Middle constraint for the point out of the segment" aSession.startOperation() aDocument.removeFeature(aConstraint) aSession.finishOperation() aSession.startOperation() -aEndPoint2.setValue(80., 25.) +aEndPoint2.setValue(80.0, 25.0) aConstraint = aSketchFeature.addFeature("SketchConstraintMiddle") reflistA = aConstraint.refattr("ConstraintEntityA") reflistB = aConstraint.refattr("ConstraintEntityB") @@ -131,47 +137,47 @@ reflistA.setAttr(aEndPoint2) reflistB.setObject(aLine1.lastResult()) aConstraint.execute() aSession.finishOperation() -assert (model.dof(aSketchFeature) == 6) +assert model.dof(aSketchFeature) == 6 -#========================================================================= +# ========================================================================= # Check values and move one constrainted object -#========================================================================= +# ========================================================================= checkMiddlePoint(aEndPoint2, aLine1) deltaX, deltaY = -80.0, -40.0 aSession.startOperation() aStartPoint1.setValue(aStartPoint1.x() + deltaX, aStartPoint1.y() + deltaY) aSession.finishOperation() checkMiddlePoint(aEndPoint2, aLine1) -assert (model.dof(aSketchFeature) == 6) -#========================================================================= +assert model.dof(aSketchFeature) == 6 +# ========================================================================= # Remove constraint and move the line -#========================================================================= +# ========================================================================= aCurX, aCurY = aEndPoint2.x(), aEndPoint2.y() aSession.startOperation() aDocument.removeFeature(aConstraint) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 8) +assert model.dof(aSketchFeature) == 8 aSession.startOperation() -aEndPoint1.setValue(90., 0.) +aEndPoint1.setValue(90.0, 0.0) aSession.finishOperation() -assert (aEndPoint2.x() == aCurX and aEndPoint2.y() == aCurY) -assert (model.dof(aSketchFeature) == 8) +assert aEndPoint2.x() == aCurX and aEndPoint2.y() == aCurY +assert model.dof(aSketchFeature) == 8 -#========================================================================= +# ========================================================================= # Set external point as a middle point -#========================================================================= +# ========================================================================= # create origin aSession.startOperation() anOrigRes = modelAPI_Result(aDocument.objectByName("Construction", anOriginName)) -assert (anOrigRes) +assert anOrigRes anOrigShape = anOrigRes.shape() -assert (anOrigShape) +assert anOrigShape anOrigin = aSketchFeature.addFeature("SketchPoint") anOriginCoord = geomDataAPI_Point2D(anOrigin.attribute("PointCoordinates")) -anOriginCoord.setValue(0., 0.) +anOriginCoord.setValue(0.0, 0.0) anOrigin.selection("External").setValue(anOrigRes, anOrigShape) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 8) +assert model.dof(aSketchFeature) == 8 # middle point constraint aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintMiddle") @@ -183,31 +189,31 @@ reflistA.setObject(aLine2.lastResult()) reflistB.setObject(anOrigin.lastResult()) aSession.finishOperation() checkMiddlePoint(anOriginCoord, aLine2) -assert (model.dof(aSketchFeature) == 6) -#========================================================================= +assert model.dof(aSketchFeature) == 6 +# ========================================================================= # Check origin coordinates does not changed -#========================================================================= -assert (anOriginCoord.x() == 0. and anOriginCoord.y() == 0.) +# ========================================================================= +assert anOriginCoord.x() == 0.0 and anOriginCoord.y() == 0.0 -#========================================================================= +# ========================================================================= # Add other line with one extremity coincident to the first line -#========================================================================= +# ========================================================================= aSession.startOperation() aLine3 = aSketchFeature.addFeature("SketchLine") aStartPoint3 = geomDataAPI_Point2D(aLine3.attribute("StartPoint")) aEndPoint3 = geomDataAPI_Point2D(aLine3.attribute("EndPoint")) -aStartPoint3.setValue(50., 50.) -aEndPoint3.setValue(50., 0.) +aStartPoint3.setValue(50.0, 50.0) +aEndPoint3.setValue(50.0, 0.0) aCoincidence = aSketchFeature.addFeature("SketchConstraintCoincidence") reflistA = aCoincidence.refattr("ConstraintEntityA") reflistB = aCoincidence.refattr("ConstraintEntityB") reflistA.setAttr(aEndPoint3) reflistB.setObject(aLine1.lastResult()) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 9) -#========================================================================= +assert model.dof(aSketchFeature) == 9 +# ========================================================================= # Set Middle point -#========================================================================= +# ========================================================================= aSession.startOperation() aMiddle = aSketchFeature.addFeature("SketchConstraintMiddle") reflistA = aMiddle.refattr("ConstraintEntityA") @@ -219,11 +225,11 @@ reflistB.setObject(aLine1.lastResult()) aSession.finishOperation() # check the point, and no error message assert aSketchFeature.string("SolverError").value() == "" -assert (model.dof(aSketchFeature) == 8) +assert model.dof(aSketchFeature) == 8 checkMiddlePoint(aEndPoint3, aLine1) -#========================================================================= +# ========================================================================= # Remove coincidence and move one line -#========================================================================= +# ========================================================================= aSession.startOperation() aDocument.removeFeature(aCoincidence) aSession.finishOperation() @@ -233,24 +239,24 @@ aStartPoint1.setValue(aStartPoint1.x() + deltaX, aStartPoint1.y() + deltaY) aEndPoint1.setValue(aEndPoint1.x() + deltaX, aEndPoint1.y() + deltaY) aSession.finishOperation() checkMiddlePoint(aEndPoint3, aLine1) -assert (model.dof(aSketchFeature) == 8) -#========================================================================= +assert model.dof(aSketchFeature) == 8 +# ========================================================================= # CreateLine -#========================================================================= +# ========================================================================= aSession.startOperation() aLine4 = aSketchFeature.addFeature("SketchLine") aStartPoint4 = geomDataAPI_Point2D(aLine4.attribute("StartPoint")) aEndPoint4 = geomDataAPI_Point2D(aLine4.attribute("EndPoint")) -aStartPoint4.setValue(2., 8.) -aEndPoint4.setValue(20., 14.) +aStartPoint4.setValue(2.0, 8.0) +aEndPoint4.setValue(20.0, 14.0) aRigidConstraint1 = aSketchFeature.addFeature("SketchConstraintRigid") aRigidConstraint1.refattr("ConstraintEntityA").setAttr(aStartPoint4) aRigidConstraint2 = aSketchFeature.addFeature("SketchConstraintRigid") aRigidConstraint2.refattr("ConstraintEntityA").setAttr(aEndPoint4) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Set middle point on line -#========================================================================= +# ========================================================================= aSession.startOperation() aMiddle = aSketchFeature.addFeature("SketchConstraintMiddle") reflistA = aMiddle.refattr("ConstraintEntityA") @@ -266,8 +272,8 @@ aMidPoint = geomDataAPI_Point2D(SketchAPI_Point(aPointRes).coordinates()) checkMiddlePoint(aMidPoint, aLine4) -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintMiddlePointOnArc.py b/src/SketchPlugin/Test/TestConstraintMiddlePointOnArc.py index 208cbf7d8..e817f9b4e 100644 --- a/src/SketchPlugin/Test/TestConstraintMiddlePointOnArc.py +++ b/src/SketchPlugin/Test/TestConstraintMiddlePointOnArc.py @@ -29,253 +29,270 @@ from GeomAPI import GeomAPI_Dir2d __updated__ = "2019-09-03" + class TestMiddlePointOnArc(unittest.TestCase): - def setUp(self): - model.begin() - self.myTestPassed = True - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myArc = self.mySketch.addArc(50, 50, 70, 50, 50, 70, False) - self.myLine = self.mySketch.addLine(55, 60, 50, 0) - self.myDOF = 9 - model.do() - self.checkDOF() - - def tearDown(self): - if self.myTestPassed: - model.assertArcValidity(self.myArc) - self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) - self.checkDOF() - model.end() - assert(model.checkPythonDump()) - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkMiddlePoint(self, thePoint, theArc): - self.myTestPassed = False - # check point on arc - dist = thePoint.distance(theArc.center().pnt()) - NB_DIGITS = 7 - math.floor(math.log10(theArc.radius().value())) - self.assertAlmostEqual(dist, theArc.radius().value(), NB_DIGITS) - # check middle point - dirPC = GeomAPI_Dir2d(thePoint.x() - theArc.center().x(), - thePoint.y() - theArc.center().y()) - dirSC = GeomAPI_Dir2d(theArc.startPoint().x() - theArc.center().x(), - theArc.startPoint().y() - theArc.center().y()) - dirEC = GeomAPI_Dir2d(theArc.endPoint().x() - theArc.center().x(), - theArc.endPoint().y() - theArc.center().y()) - angleSP = dirSC.angle(dirPC) - anglePE = dirPC.angle(dirEC) - self.assertAlmostEqual(angleSP, anglePE) - self.assertEqual(angleSP < 0, theArc.reversed().value()) - self.myTestPassed = True - - def rotatePoint(self, thePoint, theCenter, theAngle): - dirX = thePoint.x() - theCenter.x() - dirY = thePoint.y() - theCenter.y() - newX = theCenter.x() + dirX * math.cos(theAngle) - dirY * math.sin(theAngle) - newY = theCenter.y() + dirX * math.sin(theAngle) + dirY * math.cos(theAngle) - self.mySketch.move(thePoint, newX, newY) - - def moveArc(self): - ANGLE_STEP = math.pi * 5.0 / 180.0 - ANGLE_THRESHOLD = math.pi - # move start point of the arc clockwise - fullAngle = 0.0 - while fullAngle < ANGLE_THRESHOLD: - self.rotatePoint(self.myArc.startPoint(), self.myArc.center(), -ANGLE_STEP) - model.do() - self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) - fullAngle += ANGLE_STEP - # move start point of the arc conterclockwise - fullAngle = 0.0 - while fullAngle < ANGLE_THRESHOLD: - self.rotatePoint(self.myArc.startPoint(), self.myArc.center(), ANGLE_STEP) - model.do() - self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) - fullAngle += ANGLE_STEP - - # move end point of the arc clockwise - fullAngle = 0.0 - while fullAngle < ANGLE_THRESHOLD: - self.rotatePoint(self.myArc.endPoint(), self.myArc.center(), -ANGLE_STEP) - model.do() - self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) - fullAngle += ANGLE_STEP - # move end point of the arc conterclockwise - fullAngle = 0.0 - while fullAngle < ANGLE_THRESHOLD: - self.rotatePoint(self.myArc.endPoint(), self.myArc.center(), ANGLE_STEP) - model.do() - self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) - fullAngle += ANGLE_STEP - - # move center of the arc - DELTA = [1.0, 1.0] - for i in range(0, 40): - if i == 10 or i == 30: - DELTA = [-DELTA[0], -DELTA[1]] - self.mySketch.move(self.myArc.center(), self.myArc.center().x() + DELTA[0], self.myArc.center().y() + DELTA[1]) - model.do() - self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) - DELTA = [-1.0, 1.0] - for i in range(0, 40): - if i == 10 or i == 30: - DELTA = [-DELTA[0], -DELTA[1]] - self.mySketch.move(self.myArc.center(), self.myArc.center().x() + DELTA[0], self.myArc.center().y() + DELTA[1]) - model.do() - self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) - - def moveLine(self): - DELTA = [1.0, 0.0] - for i in range(0, 40): - if i == 10 or i == 30: - DELTA = [-DELTA[0], -DELTA[1]] - self.mySketch.move(self.myLine.startPoint(), self.myLine.startPoint().x() + DELTA[0], self.myLine.startPoint().y() + DELTA[1]) - model.do() - self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) - DELTA = [0.0, 1.0] - for i in range(0, 40): - if i == 10 or i == 30: - DELTA = [-DELTA[0], -DELTA[1]] - self.mySketch.move(self.myLine.startPoint(), self.myLine.startPoint().x() + DELTA[0], self.myLine.startPoint().y() + DELTA[1]) - model.do() - self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) - - - def test_middle_point_PA(self): - """ Test 1. Set middle point constraint (point is the first argument) - """ - self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[1]) - self.myDOF -= 2 - model.do() - - def test_middle_point_AP(self): - """ Test 2. Set middle point constraint (point is the second argument) - """ - self.mySketch.setMiddlePoint(self.myArc.results()[1], self.myLine.startPoint()) - self.myDOF -= 2 - model.do() - - def test_coincident_middle_point(self): - """ Test 3. Set middle point constraint for the point already coincident with the arc - """ - self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[1]) - model.do() - self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[1]) - self.myDOF -= 2 - model.do() - - def test_middle_point_coincident(self): - """ Test 4. Set concidence of the point and the arc which are already constrained with middle point - """ - self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[1]) - model.do() - self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[1]) - self.myDOF -= 2 - model.do() - - @unittest.expectedFailure - def test_middle_point_limitation(self): - """ Test 5. Check middle point fails if the point's coordinates are equal to the arc boundary point - """ - self.myLine.startPoint().setValue(self.myArc.endPoint().pnt()) - model.do() - coincidence = self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[1]) - self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[1]) - self.myDOF -= 2 - model.do() - # this check will fail due to the limitation of PlanGCS - self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) - - def test_middle_point_move_arc(self): - """ Test 6. Set middle point constraint and move arc - """ - self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[1]) - self.myDOF -= 2 - model.do() - self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) - self.moveArc() - - def test_middle_point_coincidence_move_arc(self): - """ Test 7. Set coincidence and middle point constraint and move arc - """ - self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[1]) - model.do() - self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[1]) - self.myDOF -= 2 - model.do() - self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) - self.moveArc() - - def test_middle_point_move_line(self): - """ Test 8. Set middle point constraint and move line - """ - self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[1]) - self.myDOF -= 2 - model.do() - self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) - self.moveLine() - - def test_middle_point_coincidence_move_line(self): - """ Test 9. Set coincidence and middle point constraint and move line - """ - self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[1]) - model.do() - self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[1]) - self.myDOF -= 2 - model.do() - self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) - self.moveLine() - - def test_remove_middle_point(self): - """ Test 10. Set and then remove middle point constraint - """ - mp = self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[1]) - self.myDOF -= 2 - model.do() - model.assertArcValidity(self.myArc) - self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) - self.checkDOF() - # remove middle point - self.myDocument.removeFeature(mp.feature()) - self.myDOF += 2 - model.do() - self.checkDOF() - # set flag False to avoid checking middle point constraint in tearDown() method - self.myTestPassed = False - - def test_middle_point_by_object(self): - """ Test 11. Set middle point constraint on Arc - """ - self.myArc = self.mySketch.addArc(6, 4, 15, 1, 14, 9, False) - self.mySketch.setFixed(self.myArc.center()) - self.mySketch.setRadius(self.myArc.results()[1], 10) - - SketchLine_2 = self.mySketch.addLine(6, 4, 16, 4) - SketchLine_2.setAuxiliary(True) - self.mySketch.setCoincident(self.myArc.center(), SketchLine_2.startPoint()) - self.mySketch.setCoincident(self.myArc.startPoint(), SketchLine_2.endPoint()) - self.mySketch.setHorizontal(SketchLine_2.result()) - - SketchLine_3 = self.mySketch.addLine(6, 4, 14.66025403784439, 9) - SketchLine_3.setAuxiliary(True) - self.mySketch.setCoincident(self.myArc.center(), SketchLine_3.startPoint()) - self.mySketch.setCoincident(self.myArc.endPoint(), SketchLine_3.endPoint()) - - ### Create SketchConstraintAngle - self.mySketch.setAngle(SketchLine_2.result(), SketchLine_3.result(), 30, type = "Direct") - - # Ajout d'un point auxiliaire au milieu - SketchPoint_02 = self.mySketch.setMiddlePoint(self.myArc.results()[1]) - model.do() - - aPoint = SketchPoint_02.coordinates().pnt() - self.checkMiddlePoint(aPoint, self.myArc) - - # set flag False to avoid checking middle point constraint in tearDown() method - self.myTestPassed = False + def setUp(self): + model.begin() + self.myTestPassed = True + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myArc = self.mySketch.addArc(50, 50, 70, 50, 50, 70, False) + self.myLine = self.mySketch.addLine(55, 60, 50, 0) + self.myDOF = 9 + model.do() + self.checkDOF() + + def tearDown(self): + if self.myTestPassed: + model.assertArcValidity(self.myArc) + self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) + self.checkDOF() + model.end() + assert model.checkPythonDump() + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkMiddlePoint(self, thePoint, theArc): + self.myTestPassed = False + # check point on arc + dist = thePoint.distance(theArc.center().pnt()) + NB_DIGITS = 7 - math.floor(math.log10(theArc.radius().value())) + self.assertAlmostEqual(dist, theArc.radius().value(), NB_DIGITS) + # check middle point + dirPC = GeomAPI_Dir2d( + thePoint.x() - theArc.center().x(), thePoint.y() - theArc.center().y() + ) + dirSC = GeomAPI_Dir2d( + theArc.startPoint().x() - theArc.center().x(), + theArc.startPoint().y() - theArc.center().y(), + ) + dirEC = GeomAPI_Dir2d( + theArc.endPoint().x() - theArc.center().x(), + theArc.endPoint().y() - theArc.center().y(), + ) + angleSP = dirSC.angle(dirPC) + anglePE = dirPC.angle(dirEC) + self.assertAlmostEqual(angleSP, anglePE) + self.assertEqual(angleSP < 0, theArc.reversed().value()) + self.myTestPassed = True + + def rotatePoint(self, thePoint, theCenter, theAngle): + dirX = thePoint.x() - theCenter.x() + dirY = thePoint.y() - theCenter.y() + newX = theCenter.x() + dirX * math.cos(theAngle) - dirY * math.sin(theAngle) + newY = theCenter.y() + dirX * math.sin(theAngle) + dirY * math.cos(theAngle) + self.mySketch.move(thePoint, newX, newY) + + def moveArc(self): + ANGLE_STEP = math.pi * 5.0 / 180.0 + ANGLE_THRESHOLD = math.pi + # move start point of the arc clockwise + fullAngle = 0.0 + while fullAngle < ANGLE_THRESHOLD: + self.rotatePoint(self.myArc.startPoint(), self.myArc.center(), -ANGLE_STEP) + model.do() + self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) + fullAngle += ANGLE_STEP + # move start point of the arc conterclockwise + fullAngle = 0.0 + while fullAngle < ANGLE_THRESHOLD: + self.rotatePoint(self.myArc.startPoint(), self.myArc.center(), ANGLE_STEP) + model.do() + self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) + fullAngle += ANGLE_STEP + + # move end point of the arc clockwise + fullAngle = 0.0 + while fullAngle < ANGLE_THRESHOLD: + self.rotatePoint(self.myArc.endPoint(), self.myArc.center(), -ANGLE_STEP) + model.do() + self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) + fullAngle += ANGLE_STEP + # move end point of the arc conterclockwise + fullAngle = 0.0 + while fullAngle < ANGLE_THRESHOLD: + self.rotatePoint(self.myArc.endPoint(), self.myArc.center(), ANGLE_STEP) + model.do() + self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) + fullAngle += ANGLE_STEP + + # move center of the arc + DELTA = [1.0, 1.0] + for i in range(0, 40): + if i == 10 or i == 30: + DELTA = [-DELTA[0], -DELTA[1]] + self.mySketch.move( + self.myArc.center(), + self.myArc.center().x() + DELTA[0], + self.myArc.center().y() + DELTA[1], + ) + model.do() + self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) + DELTA = [-1.0, 1.0] + for i in range(0, 40): + if i == 10 or i == 30: + DELTA = [-DELTA[0], -DELTA[1]] + self.mySketch.move( + self.myArc.center(), + self.myArc.center().x() + DELTA[0], + self.myArc.center().y() + DELTA[1], + ) + model.do() + self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) + + def moveLine(self): + DELTA = [1.0, 0.0] + for i in range(0, 40): + if i == 10 or i == 30: + DELTA = [-DELTA[0], -DELTA[1]] + self.mySketch.move( + self.myLine.startPoint(), + self.myLine.startPoint().x() + DELTA[0], + self.myLine.startPoint().y() + DELTA[1], + ) + model.do() + self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) + DELTA = [0.0, 1.0] + for i in range(0, 40): + if i == 10 or i == 30: + DELTA = [-DELTA[0], -DELTA[1]] + self.mySketch.move( + self.myLine.startPoint(), + self.myLine.startPoint().x() + DELTA[0], + self.myLine.startPoint().y() + DELTA[1], + ) + model.do() + self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) + + def test_middle_point_PA(self): + """Test 1. Set middle point constraint (point is the first argument)""" + self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[1]) + self.myDOF -= 2 + model.do() + + def test_middle_point_AP(self): + """Test 2. Set middle point constraint (point is the second argument)""" + self.mySketch.setMiddlePoint(self.myArc.results()[1], self.myLine.startPoint()) + self.myDOF -= 2 + model.do() + + def test_coincident_middle_point(self): + """Test 3. Set middle point constraint for the point already coincident with the arc""" + self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[1]) + model.do() + self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[1]) + self.myDOF -= 2 + model.do() + + def test_middle_point_coincident(self): + """Test 4. Set concidence of the point and the arc which are already constrained with middle point""" + self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[1]) + model.do() + self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[1]) + self.myDOF -= 2 + model.do() + + @unittest.expectedFailure + def test_middle_point_limitation(self): + """Test 5. Check middle point fails if the point's coordinates are equal to the arc boundary point""" + self.myLine.startPoint().setValue(self.myArc.endPoint().pnt()) + model.do() + coincidence = self.mySketch.setCoincident( + self.myLine.startPoint(), self.myArc.results()[1] + ) + self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[1]) + self.myDOF -= 2 + model.do() + # this check will fail due to the limitation of PlanGCS + self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) + + def test_middle_point_move_arc(self): + """Test 6. Set middle point constraint and move arc""" + self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[1]) + self.myDOF -= 2 + model.do() + self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) + self.moveArc() + + def test_middle_point_coincidence_move_arc(self): + """Test 7. Set coincidence and middle point constraint and move arc""" + self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[1]) + model.do() + self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[1]) + self.myDOF -= 2 + model.do() + self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) + self.moveArc() + + def test_middle_point_move_line(self): + """Test 8. Set middle point constraint and move line""" + self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[1]) + self.myDOF -= 2 + model.do() + self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) + self.moveLine() + + def test_middle_point_coincidence_move_line(self): + """Test 9. Set coincidence and middle point constraint and move line""" + self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[1]) + model.do() + self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[1]) + self.myDOF -= 2 + model.do() + self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) + self.moveLine() + + def test_remove_middle_point(self): + """Test 10. Set and then remove middle point constraint""" + mp = self.mySketch.setMiddlePoint( + self.myLine.startPoint(), self.myArc.results()[1] + ) + self.myDOF -= 2 + model.do() + model.assertArcValidity(self.myArc) + self.checkMiddlePoint(self.myLine.startPoint().pnt(), self.myArc) + self.checkDOF() + # remove middle point + self.myDocument.removeFeature(mp.feature()) + self.myDOF += 2 + model.do() + self.checkDOF() + # set flag False to avoid checking middle point constraint in tearDown() method + self.myTestPassed = False + + def test_middle_point_by_object(self): + """Test 11. Set middle point constraint on Arc""" + self.myArc = self.mySketch.addArc(6, 4, 15, 1, 14, 9, False) + self.mySketch.setFixed(self.myArc.center()) + self.mySketch.setRadius(self.myArc.results()[1], 10) + + SketchLine_2 = self.mySketch.addLine(6, 4, 16, 4) + SketchLine_2.setAuxiliary(True) + self.mySketch.setCoincident(self.myArc.center(), SketchLine_2.startPoint()) + self.mySketch.setCoincident(self.myArc.startPoint(), SketchLine_2.endPoint()) + self.mySketch.setHorizontal(SketchLine_2.result()) + + SketchLine_3 = self.mySketch.addLine(6, 4, 14.66025403784439, 9) + SketchLine_3.setAuxiliary(True) + self.mySketch.setCoincident(self.myArc.center(), SketchLine_3.startPoint()) + self.mySketch.setCoincident(self.myArc.endPoint(), SketchLine_3.endPoint()) + + ### Create SketchConstraintAngle + self.mySketch.setAngle( + SketchLine_2.result(), SketchLine_3.result(), 30, type="Direct" + ) + + # Ajout d'un point auxiliaire au milieu + SketchPoint_02 = self.mySketch.setMiddlePoint(self.myArc.results()[1]) + model.do() + + aPoint = SketchPoint_02.coordinates().pnt() + self.checkMiddlePoint(aPoint, self.myArc) + + # set flag False to avoid checking middle point constraint in tearDown() method + self.myTestPassed = False + if __name__ == "__main__": test_program = unittest.main(exit=False) diff --git a/src/SketchPlugin/Test/TestConstraintMiddlePointOnEllipticArc.py b/src/SketchPlugin/Test/TestConstraintMiddlePointOnEllipticArc.py index 714f9e949..c8a827ae0 100644 --- a/src/SketchPlugin/Test/TestConstraintMiddlePointOnEllipticArc.py +++ b/src/SketchPlugin/Test/TestConstraintMiddlePointOnEllipticArc.py @@ -30,312 +30,381 @@ from SketchAPI import * __updated__ = "2019-10-02" + class TestMiddlePointOnEllipticArc(unittest.TestCase): - def setUp(self): - model.begin() - self.myTestPassed = True - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myArc = self.mySketch.addEllipticArc(30, 20, 50, 30, 45, 40, 5, 6.11485435, False) - self.myLine = self.mySketch.addLine(10, 40, 40, 80) - self.myDOF = 11 - model.do() - self.checkDOF() - - def tearDown(self): - if self.myTestPassed: - self.assertArc(self.myArc) - self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) - self.checkDOF() - model.end() - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def toPeriod(self, theValue): - while theValue < -math.pi: - theValue += 2.0 * math.pi - while theValue >= math.pi: - theValue -= 2.0 * math.pi - return theValue - - def checkMiddlePoint(self, thePoint, theArc): - self.myTestPassed = False - anEllipse = theArc.defaultResult().shape().edge().ellipse() - # check point on ellipse - self.checkPointOnEllipse(thePoint, anEllipse) - # check angles - TOLERANCE = 1.e-5 - startPoint = GeomAPI_Pnt(theArc.startPoint().x(), theArc.startPoint().y(), 0) - isCalculated, startAngle = anEllipse.parameter(startPoint, TOLERANCE) - endPoint = GeomAPI_Pnt(theArc.endPoint().x(), theArc.endPoint().y(), 0) - isCalculated, endAngle = anEllipse.parameter(endPoint, TOLERANCE) - midPoint = GeomAPI_Pnt(thePoint.x(), thePoint.y(), 0) - isCalculated, midAngle = anEllipse.parameter(midPoint, TOLERANCE) - diffMS = self.toPeriod(midAngle - startAngle) - diffEM = self.toPeriod(endAngle - midAngle) - self.assertAlmostEqual(diffMS, diffEM) - self.assertEqual(diffMS < 0, theArc.reversed().value()) - self.myTestPassed = True - - def checkPointOnEllipse(self, theCoordinates, theEllipse): - point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) - firstFocus2d = GeomAPI_Pnt2d(theEllipse.firstFocus().x(), theEllipse.firstFocus().y()) - distPF1 = model.distancePointPoint(firstFocus2d, point) - secondFocus2d = GeomAPI_Pnt2d(theEllipse.secondFocus().x(), theEllipse.secondFocus().y()) - distPF2 = model.distancePointPoint(secondFocus2d, point) - if issubclass(type(theEllipse), SketchAPI_Ellipse): - majorRad = theEllipse.majorRadius().value() - else: - majorRad = theEllipse.majorRadius() - NB_DIGITS = 7 - math.floor(math.log10(majorRad)) - self.assertAlmostEqual(distPF1 + distPF2, 2.0 * majorRad, NB_DIGITS) - - def assertArc(self, theArc): - anEllipse = theArc.defaultResult().shape().edge().ellipse() - self.checkPointOnEllipse(theArc.startPoint(), anEllipse) - self.checkPointOnEllipse(theArc.endPoint(), anEllipse) - - def rotatePoint(self, thePoint, theCenter, theAngle): - dirX = thePoint.x() - theCenter.x() - dirY = thePoint.y() - theCenter.y() - newX = theCenter.x() + dirX * math.cos(theAngle) - dirY * math.sin(theAngle) - newY = theCenter.y() + dirX * math.sin(theAngle) + dirY * math.cos(theAngle) - self.mySketch.move(thePoint, newX, newY) - - def moveArc(self): - ANGLE_STEP = math.pi * 5.0 / 180.0 - ANGLE_THRESHOLD = math.pi / 2.0 - # move start point of the arc clockwise - fullAngle = 0.0 - while fullAngle < ANGLE_THRESHOLD: - self.rotatePoint(self.myArc.startPoint(), self.myArc.center(), -ANGLE_STEP) - model.do() - self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) - fullAngle += ANGLE_STEP - # move start point of the arc conterclockwise - fullAngle = 0.0 - while fullAngle < ANGLE_THRESHOLD: - self.rotatePoint(self.myArc.startPoint(), self.myArc.center(), ANGLE_STEP) - model.do() - self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) - fullAngle += ANGLE_STEP - - # move end point of the arc clockwise - fullAngle = 0.0 - while fullAngle < ANGLE_THRESHOLD: - self.rotatePoint(self.myArc.endPoint(), self.myArc.center(), -ANGLE_STEP) - model.do() - self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) - fullAngle += ANGLE_STEP - # move end point of the arc conterclockwise - fullAngle = 0.0 - while fullAngle < ANGLE_THRESHOLD: - self.rotatePoint(self.myArc.endPoint(), self.myArc.center(), ANGLE_STEP) - model.do() - self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) - fullAngle += ANGLE_STEP - - # move center of the arc - DELTA = [0.1, 0.1] - for i in range(0, 40): - if i == 10 or i == 30: - DELTA = [-DELTA[0], -DELTA[1]] - self.mySketch.move(self.myArc.center(), self.myArc.center().x() + DELTA[0], self.myArc.center().y() + DELTA[1]) - model.do() - self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) - DELTA = [-0.1, 0.1] - for i in range(0, 40): - if i == 10 or i == 30: - DELTA = [-DELTA[0], -DELTA[1]] - self.mySketch.move(self.myArc.center(), self.myArc.center().x() + DELTA[0], self.myArc.center().y() + DELTA[1]) - model.do() - self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) - - def moveLine(self): - DELTA = [0.1, 0.0] - for i in range(0, 40): - if i == 10 or i == 30: - DELTA = [-DELTA[0], -DELTA[1]] - self.mySketch.move(self.myLine.startPoint(), self.myLine.startPoint().x() + DELTA[0], self.myLine.startPoint().y() + DELTA[1]) - model.do() - self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) - DELTA = [0.0, 0.1] - for i in range(0, 40): - if i == 10 or i == 30: - DELTA = [-DELTA[0], -DELTA[1]] - self.mySketch.move(self.myLine.startPoint(), self.myLine.startPoint().x() + DELTA[0], self.myLine.startPoint().y() + DELTA[1]) - model.do() - self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) - - - def test_middle_point_PA(self): - """ Test 1. Set middle point constraint (point is the first argument) - """ - self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) - self.myDOF -= 2 - model.do() - - def test_middle_point_AP(self): - """ Test 2. Set middle point constraint (point is the second argument) - """ - self.mySketch.setMiddlePoint(self.myArc.results()[-1], self.myLine.startPoint()) - self.myDOF -= 2 - model.do() - - def test_coincident_middle_point(self): - """ Test 3. Set middle point constraint for the point already coincident with the arc - """ - self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[-1]) - model.do() - self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) - self.myDOF -= 2 - model.do() - - def test_middle_point_coincident(self): - """ Test 4. Set concidence of the point and the arc which are already constrained with middle point - """ - self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) - model.do() - self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[-1]) - self.myDOF -= 2 - model.do() - - @unittest.expectedFailure - def test_middle_point_limitation(self): - """ Test 5. Check middle point fails if the point's coordinates are equal to the arc start point - """ - self.myLine.startPoint().setValue(self.myArc.startPoint().pnt()) - model.do() - coincidence = self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[-1]) - self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) - self.myDOF -= 2 - model.do() - # this check will fail due to the limitation of PlanGCS - self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) - - def test_middle_point_equal_start(self): - """ Test 6. Check middle point does not fail if the point's coordinates are equal to the arc end point - """ - self.myLine.startPoint().setValue(self.myArc.endPoint().pnt()) - model.do() - coincidence = self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[-1]) - self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) - self.myDOF -= 2 - model.do() - - def test_middle_point_move_arc(self): - """ Test 7. Set middle point constraint and move arc - """ - self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) - self.myDOF -= 2 - model.do() - self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) - self.moveArc() - - def test_middle_point_coincidence_move_arc(self): - """ Test 8. Set coincidence and middle point constraint and move arc - """ - self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[-1]) - model.do() - self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) - self.myDOF -= 2 - model.do() - self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) - self.moveArc() - - def test_middle_point_move_line(self): - """ Test 9. Set middle point constraint and move line - """ - self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) - self.myDOF -= 2 - model.do() - self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) - self.moveLine() - - def test_middle_point_coincidence_move_line(self): - """ Test 10. Set coincidence and middle point constraint and move line - """ - self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[-1]) - model.do() - self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) - self.myDOF -= 2 - model.do() - self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) - self.moveLine() - - def test_remove_middle_point(self): - """ Test 11. Set and then remove middle point constraint - """ - mp = self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) - self.myDOF -= 2 - model.do() - self.assertArc(self.myArc) - self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) - self.checkDOF() - # remove middle point - self.myDocument.removeFeature(mp.feature()) - self.myDOF += 2 - model.do() - self.checkDOF() - # set flag False to avoid checking middle point constraint in tearDown() method - self.myTestPassed = False - - def test_middle_point_by_object(self): - """ Test 12. Set middle point constraint on elliptic arc - """ - - self.myArc = self.mySketch.addEllipticArc(26.13481199028052, 14.44743211950145, 27.10553481386106, 8.942189418241149, 30, 8.856406460551019, 22, 11, False) - [SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_4, SketchLine_5] = self.myArc.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") - self.mySketch.setLength(SketchLine_5.result(), 10) - self.mySketch.setLength(SketchLine_4.result(), 15) - - ### Create SketchProjection - SketchProjection_1 = self.mySketch.addProjection(model.selection("EDGE", "PartSet/OX"), False) - SketchLine_6 = SketchProjection_1.createdFeature() - - ### Create SketchConstraintAngle - self.mySketch.setAngle(SketchLine_6.result(), SketchLine_5.result(), 10, type = "Direct") - - ### Create SketchProjection - SketchProjection_2 = self.mySketch.addProjection(model.selection("EDGE", "PartSet/OX"), False) - SketchLine_7 = SketchProjection_2.createdFeature() - - ### Create SketchLine - SketchLine_8 = self.mySketch.addLine(22, 11, 30, 8.856406460551019) - SketchLine_8.setAuxiliary(True) - self.mySketch.setCoincident(self.myArc.endPoint(), SketchLine_8.startPoint()) - self.mySketch.setCoincident(self.myArc.startPoint(), SketchLine_8.endPoint()) - - ### Create SketchConstraintAngle - self.mySketch.setAngle(SketchLine_7.result(), SketchLine_8.result(), 15, type = "Direct") - - ### Create SketchProjection - SketchProjection_3 = self.mySketch.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) - SketchPoint_8 = SketchProjection_3.createdFeature() - self.mySketch.setHorizontalDistance(SketchAPI_Point(SketchPoint_8).coordinates(), SketchLine_8.startPoint(), 22) - - ### Create SketchProjection - SketchProjection_4 = self.mySketch.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) - SketchPoint_9 = SketchProjection_4.createdFeature() - self.mySketch.setVerticalDistance(SketchAPI_Point(SketchPoint_9).coordinates(), SketchLine_8.startPoint(), 11) - - ### Create SketchProjection - SketchProjection_5 = self.mySketch.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) - SketchPoint_10 = SketchProjection_5.createdFeature() - self.mySketch.setHorizontalDistance(SketchAPI_Point(SketchPoint_10).coordinates(), SketchLine_8.endPoint(), 30) - - # Create auxiliaire middle point - SketchPoint_03 = self.mySketch.setMiddlePoint(self.myArc.result()) - model.do() - - aPoint = SketchPoint_03.result().resultSubShapePair()[0].shape().vertex().point() - self.checkMiddlePoint(self.mySketch.to2D(aPoint), self.myArc) - - # set flag False to avoid checking middle point constraint in tearDown() method - self.myTestPassed = False + def setUp(self): + model.begin() + self.myTestPassed = True + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myArc = self.mySketch.addEllipticArc( + 30, 20, 50, 30, 45, 40, 5, 6.11485435, False + ) + self.myLine = self.mySketch.addLine(10, 40, 40, 80) + self.myDOF = 11 + model.do() + self.checkDOF() + + def tearDown(self): + if self.myTestPassed: + self.assertArc(self.myArc) + self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) + self.checkDOF() + model.end() + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def toPeriod(self, theValue): + while theValue < -math.pi: + theValue += 2.0 * math.pi + while theValue >= math.pi: + theValue -= 2.0 * math.pi + return theValue + + def checkMiddlePoint(self, thePoint, theArc): + self.myTestPassed = False + anEllipse = theArc.defaultResult().shape().edge().ellipse() + # check point on ellipse + self.checkPointOnEllipse(thePoint, anEllipse) + # check angles + TOLERANCE = 1.0e-5 + startPoint = GeomAPI_Pnt(theArc.startPoint().x(), theArc.startPoint().y(), 0) + isCalculated, startAngle = anEllipse.parameter(startPoint, TOLERANCE) + endPoint = GeomAPI_Pnt(theArc.endPoint().x(), theArc.endPoint().y(), 0) + isCalculated, endAngle = anEllipse.parameter(endPoint, TOLERANCE) + midPoint = GeomAPI_Pnt(thePoint.x(), thePoint.y(), 0) + isCalculated, midAngle = anEllipse.parameter(midPoint, TOLERANCE) + diffMS = self.toPeriod(midAngle - startAngle) + diffEM = self.toPeriod(endAngle - midAngle) + self.assertAlmostEqual(diffMS, diffEM) + self.assertEqual(diffMS < 0, theArc.reversed().value()) + self.myTestPassed = True + + def checkPointOnEllipse(self, theCoordinates, theEllipse): + point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) + firstFocus2d = GeomAPI_Pnt2d( + theEllipse.firstFocus().x(), theEllipse.firstFocus().y() + ) + distPF1 = model.distancePointPoint(firstFocus2d, point) + secondFocus2d = GeomAPI_Pnt2d( + theEllipse.secondFocus().x(), theEllipse.secondFocus().y() + ) + distPF2 = model.distancePointPoint(secondFocus2d, point) + if issubclass(type(theEllipse), SketchAPI_Ellipse): + majorRad = theEllipse.majorRadius().value() + else: + majorRad = theEllipse.majorRadius() + NB_DIGITS = 7 - math.floor(math.log10(majorRad)) + self.assertAlmostEqual(distPF1 + distPF2, 2.0 * majorRad, NB_DIGITS) + + def assertArc(self, theArc): + anEllipse = theArc.defaultResult().shape().edge().ellipse() + self.checkPointOnEllipse(theArc.startPoint(), anEllipse) + self.checkPointOnEllipse(theArc.endPoint(), anEllipse) + + def rotatePoint(self, thePoint, theCenter, theAngle): + dirX = thePoint.x() - theCenter.x() + dirY = thePoint.y() - theCenter.y() + newX = theCenter.x() + dirX * math.cos(theAngle) - dirY * math.sin(theAngle) + newY = theCenter.y() + dirX * math.sin(theAngle) + dirY * math.cos(theAngle) + self.mySketch.move(thePoint, newX, newY) + + def moveArc(self): + ANGLE_STEP = math.pi * 5.0 / 180.0 + ANGLE_THRESHOLD = math.pi / 2.0 + # move start point of the arc clockwise + fullAngle = 0.0 + while fullAngle < ANGLE_THRESHOLD: + self.rotatePoint(self.myArc.startPoint(), self.myArc.center(), -ANGLE_STEP) + model.do() + self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) + fullAngle += ANGLE_STEP + # move start point of the arc conterclockwise + fullAngle = 0.0 + while fullAngle < ANGLE_THRESHOLD: + self.rotatePoint(self.myArc.startPoint(), self.myArc.center(), ANGLE_STEP) + model.do() + self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) + fullAngle += ANGLE_STEP + + # move end point of the arc clockwise + fullAngle = 0.0 + while fullAngle < ANGLE_THRESHOLD: + self.rotatePoint(self.myArc.endPoint(), self.myArc.center(), -ANGLE_STEP) + model.do() + self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) + fullAngle += ANGLE_STEP + # move end point of the arc conterclockwise + fullAngle = 0.0 + while fullAngle < ANGLE_THRESHOLD: + self.rotatePoint(self.myArc.endPoint(), self.myArc.center(), ANGLE_STEP) + model.do() + self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) + fullAngle += ANGLE_STEP + + # move center of the arc + DELTA = [0.1, 0.1] + for i in range(0, 40): + if i == 10 or i == 30: + DELTA = [-DELTA[0], -DELTA[1]] + self.mySketch.move( + self.myArc.center(), + self.myArc.center().x() + DELTA[0], + self.myArc.center().y() + DELTA[1], + ) + model.do() + self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) + DELTA = [-0.1, 0.1] + for i in range(0, 40): + if i == 10 or i == 30: + DELTA = [-DELTA[0], -DELTA[1]] + self.mySketch.move( + self.myArc.center(), + self.myArc.center().x() + DELTA[0], + self.myArc.center().y() + DELTA[1], + ) + model.do() + self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) + + def moveLine(self): + DELTA = [0.1, 0.0] + for i in range(0, 40): + if i == 10 or i == 30: + DELTA = [-DELTA[0], -DELTA[1]] + self.mySketch.move( + self.myLine.startPoint(), + self.myLine.startPoint().x() + DELTA[0], + self.myLine.startPoint().y() + DELTA[1], + ) + model.do() + self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) + DELTA = [0.0, 0.1] + for i in range(0, 40): + if i == 10 or i == 30: + DELTA = [-DELTA[0], -DELTA[1]] + self.mySketch.move( + self.myLine.startPoint(), + self.myLine.startPoint().x() + DELTA[0], + self.myLine.startPoint().y() + DELTA[1], + ) + model.do() + self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) + + def test_middle_point_PA(self): + """Test 1. Set middle point constraint (point is the first argument)""" + self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) + self.myDOF -= 2 + model.do() + + def test_middle_point_AP(self): + """Test 2. Set middle point constraint (point is the second argument)""" + self.mySketch.setMiddlePoint(self.myArc.results()[-1], self.myLine.startPoint()) + self.myDOF -= 2 + model.do() + + def test_coincident_middle_point(self): + """Test 3. Set middle point constraint for the point already coincident with the arc""" + self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[-1]) + model.do() + self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) + self.myDOF -= 2 + model.do() + + def test_middle_point_coincident(self): + """Test 4. Set concidence of the point and the arc which are already constrained with middle point""" + self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) + model.do() + self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[-1]) + self.myDOF -= 2 + model.do() + + @unittest.expectedFailure + def test_middle_point_limitation(self): + """Test 5. Check middle point fails if the point's coordinates are equal to the arc start point""" + self.myLine.startPoint().setValue(self.myArc.startPoint().pnt()) + model.do() + coincidence = self.mySketch.setCoincident( + self.myLine.startPoint(), self.myArc.results()[-1] + ) + self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) + self.myDOF -= 2 + model.do() + # this check will fail due to the limitation of PlanGCS + self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) + + def test_middle_point_equal_start(self): + """Test 6. Check middle point does not fail if the point's coordinates are equal to the arc end point""" + self.myLine.startPoint().setValue(self.myArc.endPoint().pnt()) + model.do() + coincidence = self.mySketch.setCoincident( + self.myLine.startPoint(), self.myArc.results()[-1] + ) + self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) + self.myDOF -= 2 + model.do() + + def test_middle_point_move_arc(self): + """Test 7. Set middle point constraint and move arc""" + self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) + self.myDOF -= 2 + model.do() + self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) + self.moveArc() + + def test_middle_point_coincidence_move_arc(self): + """Test 8. Set coincidence and middle point constraint and move arc""" + self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[-1]) + model.do() + self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) + self.myDOF -= 2 + model.do() + self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) + self.moveArc() + + def test_middle_point_move_line(self): + """Test 9. Set middle point constraint and move line""" + self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) + self.myDOF -= 2 + model.do() + self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) + self.moveLine() + + def test_middle_point_coincidence_move_line(self): + """Test 10. Set coincidence and middle point constraint and move line""" + self.mySketch.setCoincident(self.myLine.startPoint(), self.myArc.results()[-1]) + model.do() + self.mySketch.setMiddlePoint(self.myLine.startPoint(), self.myArc.results()[-1]) + self.myDOF -= 2 + model.do() + self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) + self.moveLine() + + def test_remove_middle_point(self): + """Test 11. Set and then remove middle point constraint""" + mp = self.mySketch.setMiddlePoint( + self.myLine.startPoint(), self.myArc.results()[-1] + ) + self.myDOF -= 2 + model.do() + self.assertArc(self.myArc) + self.checkMiddlePoint(self.myLine.startPoint(), self.myArc) + self.checkDOF() + # remove middle point + self.myDocument.removeFeature(mp.feature()) + self.myDOF += 2 + model.do() + self.checkDOF() + # set flag False to avoid checking middle point constraint in tearDown() method + self.myTestPassed = False + + def test_middle_point_by_object(self): + """Test 12. Set middle point constraint on elliptic arc""" + + self.myArc = self.mySketch.addEllipticArc( + 26.13481199028052, + 14.44743211950145, + 27.10553481386106, + 8.942189418241149, + 30, + 8.856406460551019, + 22, + 11, + False, + ) + [ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_4, + SketchLine_5, + ] = self.myArc.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", + ) + self.mySketch.setLength(SketchLine_5.result(), 10) + self.mySketch.setLength(SketchLine_4.result(), 15) + + ### Create SketchProjection + SketchProjection_1 = self.mySketch.addProjection( + model.selection("EDGE", "PartSet/OX"), False + ) + SketchLine_6 = SketchProjection_1.createdFeature() + + ### Create SketchConstraintAngle + self.mySketch.setAngle( + SketchLine_6.result(), SketchLine_5.result(), 10, type="Direct" + ) + + ### Create SketchProjection + SketchProjection_2 = self.mySketch.addProjection( + model.selection("EDGE", "PartSet/OX"), False + ) + SketchLine_7 = SketchProjection_2.createdFeature() + + ### Create SketchLine + SketchLine_8 = self.mySketch.addLine(22, 11, 30, 8.856406460551019) + SketchLine_8.setAuxiliary(True) + self.mySketch.setCoincident(self.myArc.endPoint(), SketchLine_8.startPoint()) + self.mySketch.setCoincident(self.myArc.startPoint(), SketchLine_8.endPoint()) + + ### Create SketchConstraintAngle + self.mySketch.setAngle( + SketchLine_7.result(), SketchLine_8.result(), 15, type="Direct" + ) + + ### Create SketchProjection + SketchProjection_3 = self.mySketch.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False + ) + SketchPoint_8 = SketchProjection_3.createdFeature() + self.mySketch.setHorizontalDistance( + SketchAPI_Point(SketchPoint_8).coordinates(), SketchLine_8.startPoint(), 22 + ) + + ### Create SketchProjection + SketchProjection_4 = self.mySketch.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False + ) + SketchPoint_9 = SketchProjection_4.createdFeature() + self.mySketch.setVerticalDistance( + SketchAPI_Point(SketchPoint_9).coordinates(), SketchLine_8.startPoint(), 11 + ) + + ### Create SketchProjection + SketchProjection_5 = self.mySketch.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False + ) + SketchPoint_10 = SketchProjection_5.createdFeature() + self.mySketch.setHorizontalDistance( + SketchAPI_Point(SketchPoint_10).coordinates(), SketchLine_8.endPoint(), 30 + ) + + # Create auxiliaire middle point + SketchPoint_03 = self.mySketch.setMiddlePoint(self.myArc.result()) + model.do() + + aPoint = ( + SketchPoint_03.result().resultSubShapePair()[0].shape().vertex().point() + ) + self.checkMiddlePoint(self.mySketch.to2D(aPoint), self.myArc) + + # set flag False to avoid checking middle point constraint in tearDown() method + self.myTestPassed = False + if __name__ == "__main__": test_program = unittest.main(exit=False) assert test_program.result.wasSuccessful(), "Test failed" - assert(model.checkPythonDump()) + assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintParallel.py b/src/SketchPlugin/Test/TestConstraintParallel.py index abc20762a..f041be721 100644 --- a/src/SketchPlugin/Test/TestConstraintParallel.py +++ b/src/SketchPlugin/Test/TestConstraintParallel.py @@ -32,17 +32,17 @@ from GeomDataAPI import * from ModelAPI import * from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2014-10-28" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -53,50 +53,50 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create two lines which are not parallel -#========================================================================= +# ========================================================================= aSession.startOperation() # line A aSketchLineA = aSketchFeature.addFeature("SketchLine") aLineAStartPoint = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint")) aLineAEndPoint = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint")) aSketchLineB = aSketchFeature.addFeature("SketchLine") -aLineAStartPoint.setValue(0., 25) -aLineAEndPoint.setValue(85., 25) +aLineAStartPoint.setValue(0.0, 25) +aLineAEndPoint.setValue(85.0, 25) # line B aLineBStartPoint = geomDataAPI_Point2D(aSketchLineB.attribute("StartPoint")) aLineBEndPoint = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint")) -aLineBStartPoint.setValue(0., 50) -aLineBEndPoint.setValue(80., 75) +aLineBStartPoint.setValue(0.0, 50) +aLineBEndPoint.setValue(80.0, 75) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 8) -#========================================================================= +assert model.dof(aSketchFeature) == 8 +# ========================================================================= # Make a constraint to keep the length of the line constant # to parallel perpendicular constraint collapsing line to point -#========================================================================= +# ========================================================================= aSession.startOperation() for eachFeature in [aSketchLineA, aSketchLineB]: aLengthConstraint = aSketchFeature.addFeature("SketchConstraintLength") refattrA = aLengthConstraint.refattr("ConstraintEntityA") aResultA = modelAPI_ResultConstruction(eachFeature.firstResult()) - assert (aResultA is not None) + assert aResultA is not None refattrA.setObject(aResultA) aLengthConstraint.execute() aSession.finishOperation() # Coordinates of lines should not be changed after this constraint -assert (aLineAStartPoint.x() == 0) -assert (aLineAStartPoint.y() == 25) -assert (aLineAEndPoint.x() == 85) -assert (aLineAEndPoint.y() == 25) -assert (aLineBStartPoint.x() == 0) -assert (aLineBStartPoint.y() == 50) -assert (aLineBEndPoint.x() == 80) -assert (aLineBEndPoint.y() == 75) -assert (model.dof(aSketchFeature) == 6) -#========================================================================= +assert aLineAStartPoint.x() == 0 +assert aLineAStartPoint.y() == 25 +assert aLineAEndPoint.x() == 85 +assert aLineAEndPoint.y() == 25 +assert aLineBStartPoint.x() == 0 +assert aLineBStartPoint.y() == 50 +assert aLineBEndPoint.x() == 80 +assert aLineBEndPoint.y() == 75 +assert model.dof(aSketchFeature) == 6 +# ========================================================================= # Link lines with parallel constraint -#========================================================================= +# ========================================================================= aSession.startOperation() aParallelConstraint = aSketchFeature.addFeature("SketchConstraintParallel") refattrA = aParallelConstraint.refattr("ConstraintEntityA") @@ -104,34 +104,32 @@ refattrB = aParallelConstraint.refattr("ConstraintEntityB") # aResultA is already defined for the length constraint aResultA = modelAPI_ResultConstruction(aSketchLineA.firstResult()) aResultB = modelAPI_ResultConstruction(aSketchLineB.firstResult()) -assert (aResultA is not None) -assert (aResultB is not None) +assert aResultA is not None +assert aResultB is not None refattrA.setObject(aResultA) refattrB.setObject(aResultB) aParallelConstraint.execute() aSession.finishOperation() -assert (model.dof(aSketchFeature) == 5) -#========================================================================= +assert model.dof(aSketchFeature) == 5 +# ========================================================================= # Check values and move one constrainted object -#========================================================================= -deltaX = deltaY = 10. +# ========================================================================= +deltaX = deltaY = 10.0 # rotate line, check that reference's line points are moved also aLineBStartPointPrev = (aLineBStartPoint.x(), aLineBStartPoint.y()) aLineBEndPointPrev = (aLineBEndPoint.x(), aLineBEndPoint.y()) aSession.startOperation() -aLineAStartPoint.setValue(aLineAStartPoint.x() + deltaX, - aLineAStartPoint.y() + deltaY) -aLineAEndPoint.setValue(aLineAEndPoint.x() - deltaX, - aLineAEndPoint.y() - deltaY) +aLineAStartPoint.setValue(aLineAStartPoint.x() + deltaX, aLineAStartPoint.y() + deltaY) +aLineAEndPoint.setValue(aLineAEndPoint.x() - deltaX, aLineAEndPoint.y() - deltaY) aSession.finishOperation() aLineBStartPointNew = (aLineBStartPoint.x(), aLineBStartPoint.y()) aLineBEndPointNew = (aLineBEndPoint.x(), aLineBEndPoint.y()) -assert (aLineBStartPointPrev != aLineBStartPointNew) -assert (aLineBEndPointPrev != aLineBEndPointNew) -assert (model.dof(aSketchFeature) == 5) -#========================================================================= +assert aLineBStartPointPrev != aLineBStartPointNew +assert aLineBEndPointPrev != aLineBEndPointNew +assert model.dof(aSketchFeature) == 5 +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintPerpendicular.py b/src/SketchPlugin/Test/TestConstraintPerpendicular.py index b419965f7..2d644e126 100644 --- a/src/SketchPlugin/Test/TestConstraintPerpendicular.py +++ b/src/SketchPlugin/Test/TestConstraintPerpendicular.py @@ -39,17 +39,17 @@ from GeomDataAPI import * from ModelAPI import * from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2014-10-28" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -60,91 +60,91 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create two lines which are already perpendicular -#========================================================================= +# ========================================================================= aSession.startOperation() # line A aSketchLineA = aSketchFeature.addFeature("SketchLine") aLineAStartPoint = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint")) aLineAEndPoint = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint")) -aLineAStartPoint.setValue(0., 25) -aLineAEndPoint.setValue(85., 25) +aLineAStartPoint.setValue(0.0, 25) +aLineAEndPoint.setValue(85.0, 25) # line B aSketchLineB = aSketchFeature.addFeature("SketchLine") aLineBStartPoint = geomDataAPI_Point2D(aSketchLineB.attribute("StartPoint")) aLineBEndPoint = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint")) -aLineBStartPoint.setValue(25., 40.) -aLineBEndPoint.setValue(25., 125.) +aLineBStartPoint.setValue(25.0, 40.0) +aLineBEndPoint.setValue(25.0, 125.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 8) -#========================================================================= +assert model.dof(aSketchFeature) == 8 +# ========================================================================= # Make a constraint to keep the length of the line constant # to prevent perpendicular constraint collapsing line to point -#========================================================================= +# ========================================================================= aSession.startOperation() for eachFeature in [aSketchLineA, aSketchLineB]: aLengthConstraint = aSketchFeature.addFeature("SketchConstraintLength") eachRefattr = aLengthConstraint.refattr("ConstraintEntityA") eachResult = modelAPI_ResultConstruction(eachFeature.firstResult()) - assert (eachResult is not None) + assert eachResult is not None eachRefattr.setObject(eachResult) aLengthConstraint.execute() aSession.finishOperation() # Coordinates of lines should not be changed after this constraint -assert (aLineAStartPoint.x() == 0) -assert (aLineAStartPoint.y() == 25) -assert (aLineAEndPoint.x() == 85) -assert (aLineAEndPoint.y() == 25) -assert (aLineBStartPoint.x() == 25) -assert (aLineBStartPoint.y() == 40) -assert (aLineBEndPoint.x() == 25) -assert (aLineBEndPoint.y() == 125) -assert (model.dof(aSketchFeature) == 6) -#========================================================================= +assert aLineAStartPoint.x() == 0 +assert aLineAStartPoint.y() == 25 +assert aLineAEndPoint.x() == 85 +assert aLineAEndPoint.y() == 25 +assert aLineBStartPoint.x() == 25 +assert aLineBStartPoint.y() == 40 +assert aLineBEndPoint.x() == 25 +assert aLineBEndPoint.y() == 125 +assert model.dof(aSketchFeature) == 6 +# ========================================================================= # Link lines with perpendicular constraint -#========================================================================= +# ========================================================================= aSession.startOperation() aPerpendicularConstraint = aSketchFeature.addFeature("SketchConstraintPerpendicular") refattrA = aPerpendicularConstraint.refattr("ConstraintEntityA") refattrB = aPerpendicularConstraint.refattr("ConstraintEntityB") aResultA = modelAPI_ResultConstruction(aSketchLineA.firstResult()) aResultB = modelAPI_ResultConstruction(aSketchLineB.firstResult()) -assert (aResultA is not None) -assert (aResultB is not None) +assert aResultA is not None +assert aResultB is not None refattrA.setObject(aResultA) refattrB.setObject(aResultB) aPerpendicularConstraint.execute() aSession.finishOperation() -assert (model.dof(aSketchFeature) == 5) -#========================================================================= +assert model.dof(aSketchFeature) == 5 +# ========================================================================= # Check values and move one constrainted object -#========================================================================= -aLineBStartPointPrev = (aLineBStartPoint.x(),aLineBStartPoint.y()) -aLineBEndPointPrev = (aLineBEndPoint.x(),aLineBEndPoint.y()) -deltaX = deltaY = 5. +# ========================================================================= +aLineBStartPointPrev = (aLineBStartPoint.x(), aLineBStartPoint.y()) +aLineBEndPointPrev = (aLineBEndPoint.x(), aLineBEndPoint.y()) +deltaX = deltaY = 5.0 # move line without rotation, # check that reference's line points are not changed also aSession.startOperation() aLineAStartPoint.setValue(aLineAStartPoint.x() + deltaX, aLineAStartPoint.y() + deltaY) aLineAEndPoint.setValue(aLineAEndPoint.x() + deltaX, aLineAEndPoint.y() + deltaY) aSession.finishOperation() -assert (aLineBStartPointPrev == (aLineBStartPoint.x(), aLineBStartPoint.y())) -assert (aLineBEndPointPrev == (aLineBEndPoint.x(), aLineBEndPoint.y())) -aLineBStartPointPrev = (aLineBStartPoint.x(),aLineBStartPoint.y()) -aLineBEndPointPrev = (aLineBEndPoint.x(),aLineBEndPoint.y()) +assert aLineBStartPointPrev == (aLineBStartPoint.x(), aLineBStartPoint.y()) +assert aLineBEndPointPrev == (aLineBEndPoint.x(), aLineBEndPoint.y()) +aLineBStartPointPrev = (aLineBStartPoint.x(), aLineBStartPoint.y()) +aLineBEndPointPrev = (aLineBEndPoint.x(), aLineBEndPoint.y()) # rotate line, # check that reference's line points are moved also aSession.startOperation() aLineAStartPoint.setValue(aLineAStartPoint.x() + deltaX, aLineAStartPoint.y() + deltaY) aLineAEndPoint.setValue(aLineAEndPoint.x() - deltaX, aLineAEndPoint.y() - deltaY) aSession.finishOperation() -assert (aLineBStartPointPrev != (aLineBStartPoint.x(), aLineBStartPoint.y())) -assert (aLineBEndPointPrev != (aLineBEndPoint.x(), aLineBEndPoint.y())) -assert (model.dof(aSketchFeature) == 5) -#========================================================================= +assert aLineBStartPointPrev != (aLineBStartPoint.x(), aLineBStartPoint.y()) +assert aLineBEndPointPrev != (aLineBEndPoint.x(), aLineBEndPoint.y()) +assert model.dof(aSketchFeature) == 5 +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintPerpendicularArcLine.py b/src/SketchPlugin/Test/TestConstraintPerpendicularArcLine.py index c9aca9a92..be2f22d6d 100644 --- a/src/SketchPlugin/Test/TestConstraintPerpendicularArcLine.py +++ b/src/SketchPlugin/Test/TestConstraintPerpendicularArcLine.py @@ -27,28 +27,36 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(-35, -10, 20) SketchLine_1 = Sketch_1.addLine(-21, 2, 24, 21) SketchLine_2 = Sketch_1.addLine(24, 21, 20, -30) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchArc_1 = Sketch_1.addArc(25, -30, 42, -34, 13, -17.31142245955048, False) model.do() # check error on perpendicularity of circle and arc -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchCircle_1.results()[1], SketchArc_1.results()[1]) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchCircle_1.results()[1], SketchArc_1.results()[1] +) model.do() -assert(SketchConstraintPerpendicular_1.feature().error() != "") +assert SketchConstraintPerpendicular_1.feature().error() != "" # avoid the failure Part_1_doc.removeFeature(SketchConstraintPerpendicular_1.feature()) model.do() -assert(Sketch_1.feature().error() == "") +assert Sketch_1.feature().error() == "" # set correct constraints -SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular(SketchCircle_1.results()[1], SketchLine_1.result()) -SketchConstraintPerpendicular_3 = Sketch_1.setPerpendicular(SketchLine_2.result(), SketchArc_1.results()[1]) +SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular( + SketchCircle_1.results()[1], SketchLine_1.result() +) +SketchConstraintPerpendicular_3 = Sketch_1.setPerpendicular( + SketchLine_2.result(), SketchArc_1.results()[1] +) model.do() -TOLERANCE = 1.e-7 -assert(model.distancePointLine(SketchCircle_1.center(), SketchLine_1) < TOLERANCE) -assert(model.distancePointLine(SketchArc_1.center(), SketchLine_2) < TOLERANCE) +TOLERANCE = 1.0e-7 +assert model.distancePointLine(SketchCircle_1.center(), SketchLine_1) < TOLERANCE +assert model.distancePointLine(SketchArc_1.center(), SketchLine_2) < TOLERANCE model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintPerpendicularEllipseLine.py b/src/SketchPlugin/Test/TestConstraintPerpendicularEllipseLine.py index e0e05a2ba..0b5606191 100644 --- a/src/SketchPlugin/Test/TestConstraintPerpendicularEllipseLine.py +++ b/src/SketchPlugin/Test/TestConstraintPerpendicularEllipseLine.py @@ -21,7 +21,8 @@ from salome.shaper import model import math from GeomAPI import * -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + def checkPerpendicular(theLine, theEllipse): focus1 = theEllipse.firstFocus() @@ -38,7 +39,10 @@ def checkPerpendicular(theLine, theEllipse): pnt = GeomAPI_Pnt(x, y, 0) # check point on ellipse majorRad = theEllipse.majorRadius() - assert(math.fabs(pnt.distance(focus1) + pnt.distance(focus2) - 2.0 * majorRad) < TOLERANCE * majorRad) + assert ( + math.fabs(pnt.distance(focus1) + pnt.distance(focus2) - 2.0 * majorRad) + < TOLERANCE * majorRad + ) model.begin() @@ -49,28 +53,82 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(-40, 10, -20, 30) SketchArc_1 = Sketch_1.addArc(25, -30, 42, -34, 13, -17.31142245955048, False) SketchEllipse_1 = Sketch_1.addEllipse(-50, 0, -30, -5, 15) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_2, SketchLine_3] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchEllipticArc_1 = Sketch_1.addEllipticArc(5, 30, -5, 45, -7, 47, 15, 33.68010611, False) -[SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11, SketchPoint_12, SketchPoint_13, SketchPoint_14, SketchLine_4, SketchLine_5] = SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_2, + SketchLine_3, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchEllipticArc_1 = Sketch_1.addEllipticArc( + 5, 30, -5, 45, -7, 47, 15, 33.68010611, False +) +[ + SketchPoint_8, + SketchPoint_9, + SketchPoint_10, + SketchPoint_11, + SketchPoint_12, + SketchPoint_13, + SketchPoint_14, + SketchLine_4, + SketchLine_5, +] = SketchEllipticArc_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) model.do() # check error on perpendicularity of arc and elliptic arc -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchArc_1.results()[1], SketchEllipticArc_1.result()) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchArc_1.results()[1], SketchEllipticArc_1.result() +) model.do() -assert(SketchConstraintPerpendicular_1.feature().error() != "") +assert SketchConstraintPerpendicular_1.feature().error() != "" # avoid the failure Part_1_doc.removeFeature(SketchConstraintPerpendicular_1.feature()) model.do() -assert(Sketch_1.feature().error() == "") +assert Sketch_1.feature().error() == "" # set correct constraints -SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular(SketchEllipticArc_1.result(), SketchLine_1.result()) -SketchConstraintPerpendicular_3 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchEllipse_1.result()) +SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular( + SketchEllipticArc_1.result(), SketchLine_1.result() +) +SketchConstraintPerpendicular_3 = Sketch_1.setPerpendicular( + SketchLine_1.result(), SketchEllipse_1.result() +) model.do() -checkPerpendicular(SketchLine_1.defaultResult().shape().edge().line(), SketchEllipse_1.defaultResult().shape().edge().ellipse()) -checkPerpendicular(SketchLine_1.defaultResult().shape().edge().line(), SketchEllipticArc_1.defaultResult().shape().edge().ellipse()) +checkPerpendicular( + SketchLine_1.defaultResult().shape().edge().line(), + SketchEllipse_1.defaultResult().shape().edge().ellipse(), +) +checkPerpendicular( + SketchLine_1.defaultResult().shape().edge().line(), + SketchEllipticArc_1.defaultResult().shape().edge().ellipse(), +) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintRadius.py b/src/SketchPlugin/Test/TestConstraintRadius.py index 6555a9b17..0bfda6361 100644 --- a/src/SketchPlugin/Test/TestConstraintRadius.py +++ b/src/SketchPlugin/Test/TestConstraintRadius.py @@ -41,18 +41,18 @@ from ModelAPI import * import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2014-10-28" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -63,110 +63,110 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Creation of an arc and a circle -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchArc = aSketchFeature.addFeature("SketchArc") anArcCentr = geomDataAPI_Point2D(aSketchArc.attribute("center_point")) -anArcCentr.setValue(10., 10.) +anArcCentr.setValue(10.0, 10.0) anArcStartPoint = geomDataAPI_Point2D(aSketchArc.attribute("start_point")) -anArcStartPoint.setValue(0., 50.) +anArcStartPoint.setValue(0.0, 50.0) anArcEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("end_point")) -anArcEndPoint.setValue(50., 0.) +anArcEndPoint.setValue(50.0, 0.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 5) +assert model.dof(aSketchFeature) == 5 # Test changing the arc start/end point aSession.startOperation() -anArcStartPoint.setValue(anArcStartPoint.x(), 40.) -anArcStartPoint.setValue(0., 50.) -assert (math.hypot(anArcStartPoint.x() - 0., anArcStartPoint.y() - 50.) < 1.e-10) +anArcStartPoint.setValue(anArcStartPoint.x(), 40.0) +anArcStartPoint.setValue(0.0, 50.0) +assert math.hypot(anArcStartPoint.x() - 0.0, anArcStartPoint.y() - 50.0) < 1.0e-10 aSession.finishOperation() aSession.startOperation() -anArcEndPoint.setValue(40., anArcEndPoint.y()) -anArcEndPoint.setValue(50., 0.) -assert (math.hypot(anArcEndPoint.x() - 50., anArcEndPoint.y() - 0.) < 1.e-10) +anArcEndPoint.setValue(40.0, anArcEndPoint.y()) +anArcEndPoint.setValue(50.0, 0.0) +assert math.hypot(anArcEndPoint.x() - 50.0, anArcEndPoint.y() - 0.0) < 1.0e-10 aSession.finishOperation() -assert (model.dof(aSketchFeature) == 5) +assert model.dof(aSketchFeature) == 5 # Circle aSession.startOperation() aSketchCircle = aSketchFeature.addFeature("SketchCircle") anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center")) aCircleRadius = aSketchCircle.real("circle_radius") -anCircleCentr.setValue(-25., -25) -aCircleRadius.setValue(25.) +anCircleCentr.setValue(-25.0, -25) +aCircleRadius.setValue(25.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 8) -#========================================================================= +assert model.dof(aSketchFeature) == 8 +# ========================================================================= # Make a constraint to keep the radius of the arc -#========================================================================= +# ========================================================================= RADIUS = 40 aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintRadius") aRadius = aConstraint.real("ConstraintValue") aRefObject = aConstraint.refattr("ConstraintEntityA") aResult = aSketchArc.lastResult() -assert (aResult is not None) +assert aResult is not None aRefObject.setObject(modelAPI_ResultConstruction(aResult)) aRadius.setValue(RADIUS) aSession.finishOperation() -assert (aRadius.isInitialized()) -assert (aRefObject.isInitialized()) -assert (model.dof(aSketchFeature) == 7) -#========================================================================= +assert aRadius.isInitialized() +assert aRefObject.isInitialized() +assert model.dof(aSketchFeature) == 7 +# ========================================================================= # Make a constraint to keep the radius of the circle -#========================================================================= +# ========================================================================= aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintRadius") aRadius = aConstraint.real("ConstraintValue") aRefObject = aConstraint.refattr("ConstraintEntityA") aResult = aSketchCircle.lastResult() -assert (aResult is not None) +assert aResult is not None aRefObject.setObject(modelAPI_ResultConstruction(aResult)) aRadius.setValue(RADIUS) aSession.finishOperation() -assert (aRadius.isInitialized()) -assert (aRefObject.isInitialized()) -assert (model.dof(aSketchFeature) == 6) -#========================================================================= +assert aRadius.isInitialized() +assert aRefObject.isInitialized() +assert model.dof(aSketchFeature) == 6 +# ========================================================================= # Perform some actions and checks: # 1. Check that constraints does not change values # 2. Move one point of the arc # 3. Check that second point is moved also -#========================================================================= +# ========================================================================= distCS = model.distancePointPoint(anArcCentr, anArcStartPoint) distCE = model.distancePointPoint(anArcCentr, anArcEndPoint) -assert (math.fabs(distCS - RADIUS) < 1.e-10) -assert (math.fabs(distCE - RADIUS) < 1.e-10) +assert math.fabs(distCS - RADIUS) < 1.0e-10 +assert math.fabs(distCE - RADIUS) < 1.0e-10 anArcPrevEndPointX = anArcEndPoint.x() anArcPrevEndPointY = anArcEndPoint.y() # Move one point of the arc aSession.startOperation() anArcStartPoint.setValue(0, 60) aSession.finishOperation() -assert (anArcEndPoint.x() != anArcPrevEndPointX) -assert (anArcEndPoint.y() != anArcPrevEndPointY) +assert anArcEndPoint.x() != anArcPrevEndPointX +assert anArcEndPoint.y() != anArcPrevEndPointY distCS = model.distancePointPoint(anArcCentr, anArcStartPoint) distCE = model.distancePointPoint(anArcCentr, anArcEndPoint) -assert (math.fabs(distCS - RADIUS) < 1.e-10) -assert (math.fabs(distCE - RADIUS) < 1.e-10) -assert (model.dof(aSketchFeature) == 6) -#========================================================================= +assert math.fabs(distCS - RADIUS) < 1.0e-10 +assert math.fabs(distCE - RADIUS) < 1.0e-10 +assert model.dof(aSketchFeature) == 6 +# ========================================================================= # 4. Move the centr or the point of the arc # 5. Check radius is the same -#========================================================================= -assert (anCircleCentr.x() == -25) -assert (anCircleCentr.y() == -25) -assert (aCircleRadius.value() == RADIUS) +# ========================================================================= +assert anCircleCentr.x() == -25 +assert anCircleCentr.y() == -25 +assert aCircleRadius.value() == RADIUS aSession.startOperation() -anCircleCentr.setValue(100., 100.) +anCircleCentr.setValue(100.0, 100.0) aSession.finishOperation() -assert (anCircleCentr.x() == 100) -assert (anCircleCentr.y() == 100) -assert (aCircleRadius.value() == RADIUS) -assert (model.dof(aSketchFeature) == 6) -#========================================================================= +assert anCircleCentr.x() == 100 +assert anCircleCentr.y() == 100 +assert aCircleRadius.value() == RADIUS +assert model.dof(aSketchFeature) == 6 +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintRadiusFailure.py b/src/SketchPlugin/Test/TestConstraintRadiusFailure.py index 1f78c6df1..80724f130 100644 --- a/src/SketchPlugin/Test/TestConstraintRadiusFailure.py +++ b/src/SketchPlugin/Test/TestConstraintRadiusFailure.py @@ -28,6 +28,6 @@ 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() != "") +assert SketchConstraintRadius_1.feature().error() != "" model.end() diff --git a/src/SketchPlugin/Test/TestConstraintTangent.py b/src/SketchPlugin/Test/TestConstraintTangent.py index a601d08a8..1e0d2564a 100644 --- a/src/SketchPlugin/Test/TestConstraintTangent.py +++ b/src/SketchPlugin/Test/TestConstraintTangent.py @@ -33,17 +33,18 @@ from ModelAPI import * import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2015-03-17" + def checkArcLineTangency(theArc, theLine): """ subroutine to check that the line is tangent to arc/circle """ - if (theArc.getKind() == "SketchCircle"): + if theArc.getKind() == "SketchCircle": aCenter = geomDataAPI_Point2D(theArc.attribute("circle_center")) aRadius = theArc.real("circle_radius").value() else: @@ -51,7 +52,10 @@ def checkArcLineTangency(theArc, theLine): aStartPnt = geomDataAPI_Point2D(theArc.attribute("start_point")) aRadius = model.distancePointPoint(aStartPnt, aCenter) aDist = model.distancePointLine(aCenter, theLine) - assert math.fabs(aDist - aRadius) < 2.e-5, "aDist = {0}, aRadius = {1}".format(aDist, aRadius) + assert math.fabs(aDist - aRadius) < 2.0e-5, "aDist = {0}, aRadius = {1}".format( + aDist, aRadius + ) + def checkArcArcTangency(theArc1, theArc2): """ @@ -61,7 +65,7 @@ def checkArcArcTangency(theArc1, theArc2): aCenters = [] aRadii = [] for anArc in anArcs: - if (anArc.getKind() == "SketchCircle"): + if anArc.getKind() == "SketchCircle": aCenter = geomDataAPI_Point2D(anArc.attribute("circle_center")) aRadius = anArc.real("circle_radius").value() else: @@ -73,14 +77,16 @@ def checkArcArcTangency(theArc1, theArc2): aDist = model.distancePointPoint(aCenters[0], aCenters[1]) aRSum = aRadii[0] + aRadii[1] aRDiff = math.fabs(aRadii[0] - aRadii[1]) - assert math.fabs(aDist - aRSum) < 2.e-5 or math.fabs(aDist - aRDiff) < 2.e-5, "aDist = {0}, aRSum = {1}, aRDiff = {2}".format(aDist, aRSum, aRDiff) + assert ( + math.fabs(aDist - aRSum) < 2.0e-5 or math.fabs(aDist - aRDiff) < 2.0e-5 + ), "aDist = {0}, aRSum = {1}, aRDiff = {2}".format(aDist, aRSum, aRDiff) aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -91,41 +97,41 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # TEST 1. Arc-line tangency -#========================================================================= +# ========================================================================= # Creation of an arc and two lines -#========================================================================= +# ========================================================================= # Arc aSession.startOperation() aSketchArc1 = aSketchFeature.addFeature("SketchArc") anArcCentr = geomDataAPI_Point2D(aSketchArc1.attribute("center_point")) -anArcCentr.setValue(10., 10.) +anArcCentr.setValue(10.0, 10.0) anArcStartPoint = geomDataAPI_Point2D(aSketchArc1.attribute("start_point")) -anArcStartPoint.setValue(0., 50.) +anArcStartPoint.setValue(0.0, 50.0) anArcEndPoint = geomDataAPI_Point2D(aSketchArc1.attribute("end_point")) -anArcEndPoint.setValue(50., 0.) +anArcEndPoint.setValue(50.0, 0.0) aSession.finishOperation() # Line 1 aSession.startOperation() aSketchLine1 = aSketchFeature.addFeature("SketchLine") aLine1StartPoint = geomDataAPI_Point2D(aSketchLine1.attribute("StartPoint")) aLine1EndPoint = geomDataAPI_Point2D(aSketchLine1.attribute("EndPoint")) -aLine1StartPoint.setValue(0., 50.) -aLine1EndPoint.setValue(0., 100.) +aLine1StartPoint.setValue(0.0, 50.0) +aLine1EndPoint.setValue(0.0, 100.0) aSession.finishOperation() # Line 2 aSession.startOperation() aSketchLine2 = aSketchFeature.addFeature("SketchLine") aLine2StartPoint = geomDataAPI_Point2D(aSketchLine2.attribute("StartPoint")) aLine2EndPoint = geomDataAPI_Point2D(aSketchLine2.attribute("EndPoint")) -aLine2StartPoint.setValue(50., 0.) -aLine2EndPoint.setValue(100., 0.) +aLine2StartPoint.setValue(50.0, 0.0) +aLine2EndPoint.setValue(100.0, 0.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 13) -#========================================================================= +assert model.dof(aSketchFeature) == 13 +# ========================================================================= # Link arc points and lines points by the coincidence constraint -#========================================================================= +# ========================================================================= aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintCoincidence") reflistA = aConstraint.refattr("ConstraintEntityA") @@ -142,75 +148,75 @@ reflistA.setAttr(anArcEndPoint) reflistB.setAttr(aLine2StartPoint) aConstraint.execute() aSession.finishOperation() -assert (model.dof(aSketchFeature) == 9) -#========================================================================= +assert model.dof(aSketchFeature) == 9 +# ========================================================================= # Add tangency constraint and check correctness -#========================================================================= +# ========================================================================= aSession.startOperation() aTangency = aSketchFeature.addFeature("SketchConstraintTangent") aRefObjectA = aTangency.refattr("ConstraintEntityA") aRefObjectB = aTangency.refattr("ConstraintEntityB") anObjectA = modelAPI_ResultConstruction(aSketchArc1.lastResult()) anObjectB = modelAPI_ResultConstruction(aSketchLine1.lastResult()) -assert (anObjectA is not None) -assert (anObjectB is not None) +assert anObjectA is not None +assert anObjectB is not None aRefObjectA.setObject(anObjectA) aRefObjectB.setObject(anObjectB) aTangency.execute() aSession.finishOperation() checkArcLineTangency(aSketchArc1, aSketchLine1) -assert (model.dof(aSketchFeature) == 8) -#========================================================================= +assert model.dof(aSketchFeature) == 8 +# ========================================================================= # Add tangency constraint for arc and second line and check correctness -#========================================================================= +# ========================================================================= aSession.startOperation() aTangency = aSketchFeature.addFeature("SketchConstraintTangent") aRefObjectA = aTangency.refattr("ConstraintEntityA") aRefObjectB = aTangency.refattr("ConstraintEntityB") anObjectA = modelAPI_ResultConstruction(aSketchArc1.lastResult()) anObjectB = modelAPI_ResultConstruction(aSketchLine2.lastResult()) -assert (anObjectA is not None) -assert (anObjectB is not None) +assert anObjectA is not None +assert anObjectB is not None aRefObjectA.setObject(anObjectA) aRefObjectB.setObject(anObjectB) aTangency.execute() aSession.finishOperation() checkArcLineTangency(aSketchArc1, aSketchLine2) -assert (model.dof(aSketchFeature) == 7) +assert model.dof(aSketchFeature) == 7 -#========================================================================= +# ========================================================================= # TEST 2. Arc-arc tangency -#========================================================================= +# ========================================================================= # Creation of arcs -#========================================================================= +# ========================================================================= # Arc 1 aSession.startOperation() aSketchArc1 = aSketchFeature.addFeature("SketchArc") anArc1Centr = geomDataAPI_Point2D(aSketchArc1.attribute("center_point")) -anArc1Centr.setValue(10., 10.) +anArc1Centr.setValue(10.0, 10.0) anArc1StartPoint = geomDataAPI_Point2D(aSketchArc1.attribute("start_point")) -anArc1StartPoint.setValue(50., 0.) +anArc1StartPoint.setValue(50.0, 0.0) anArc1EndPoint = geomDataAPI_Point2D(aSketchArc1.attribute("end_point")) -anArc1EndPoint.setValue(0., 50.) +anArc1EndPoint.setValue(0.0, 50.0) aSession.finishOperation() # Arc 2 aSession.startOperation() aSketchArc2 = aSketchFeature.addFeature("SketchMacroArc") aSketchArc2.string("arc_type").setValue("by_three_points") anArc2StartPoint = geomDataAPI_Point2D(aSketchArc2.attribute("start_point_2")) -anArc2StartPoint.setValue(0., 50.) +anArc2StartPoint.setValue(0.0, 50.0) anArc2EndPoint = geomDataAPI_Point2D(aSketchArc2.attribute("end_point_2")) -anArc2EndPoint.setValue(-50., 0.) +anArc2EndPoint.setValue(-50.0, 0.0) anArc2PassedPoint = geomDataAPI_Point2D(aSketchArc2.attribute("passed_point")) -anArc2PassedPoint.setValue(-40., 40.) +anArc2PassedPoint.setValue(-40.0, 40.0) aSession.finishOperation() -#assert (model.dof(aSketchFeature) == 17) +# assert (model.dof(aSketchFeature) == 17) aSketchArc2 = model.lastSubFeature(aSketchFeature, "SketchArc") anArc2Centr = geomDataAPI_Point2D(aSketchArc2.attribute("center_point")) anArc2StartPoint = geomDataAPI_Point2D(aSketchArc2.attribute("start_point")) -#========================================================================= +# ========================================================================= # Link points of arcs by the coincidence constraint -#========================================================================= +# ========================================================================= aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintCoincidence") reflistA = aConstraint.refattr("ConstraintEntityA") @@ -219,28 +225,28 @@ reflistA.setAttr(anArc1EndPoint) reflistB.setAttr(anArc2StartPoint) aConstraint.execute() aSession.finishOperation() -assert (model.dof(aSketchFeature) == 15) -#========================================================================= +assert model.dof(aSketchFeature) == 15 +# ========================================================================= # Add tangency constraint and check correctness -#========================================================================= +# ========================================================================= aSession.startOperation() aTangency = aSketchFeature.addFeature("SketchConstraintTangent") aRefObjectA = aTangency.refattr("ConstraintEntityA") aRefObjectB = aTangency.refattr("ConstraintEntityB") anObjectA = modelAPI_ResultConstruction(aSketchArc1.lastResult()) anObjectB = modelAPI_ResultConstruction(aSketchArc2.lastResult()) -assert (anObjectA is not None) -assert (anObjectB is not None) +assert anObjectA is not None +assert anObjectB is not None aRefObjectA.setObject(anObjectA) aRefObjectB.setObject(anObjectB) aTangency.execute() aSession.finishOperation() checkArcArcTangency(aSketchArc1, aSketchArc2) -assert (model.dof(aSketchFeature) == 14) +assert model.dof(aSketchFeature) == 14 -#========================================================================= +# ========================================================================= # TEST 3. Tangency between non-connected objects should work -#========================================================================= +# ========================================================================= # 3.1 tangency between arc2 and line2 aSession.startOperation() aTangency = aSketchFeature.addFeature("SketchConstraintTangent") @@ -248,100 +254,114 @@ aRefObjectA = aTangency.refattr("ConstraintEntityA") aRefObjectB = aTangency.refattr("ConstraintEntityB") anObjectA = modelAPI_ResultConstruction(aSketchArc2.lastResult()) anObjectB = modelAPI_ResultConstruction(aSketchLine2.lastResult()) -assert (anObjectA is not None) -assert (anObjectB is not None) +assert anObjectA is not None +assert anObjectB is not None aRefObjectA.setObject(anObjectA) aRefObjectB.setObject(anObjectB) aTangency.execute() aSession.finishOperation() checkArcLineTangency(aSketchArc2, aSketchLine2) -assert (model.dof(aSketchFeature) == 13) +assert model.dof(aSketchFeature) == 13 aSession.startOperation() aDocument.removeFeature(aTangency) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 14) +assert model.dof(aSketchFeature) == 14 # 3.2 tangency between non-connected arcs aSession.startOperation() aSketchArc3 = aSketchFeature.addFeature("SketchArc") anArc3Centr = geomDataAPI_Point2D(aSketchArc3.attribute("center_point")) -anArc3Centr.setValue(100., -10.) +anArc3Centr.setValue(100.0, -10.0) anArc3StartPoint = geomDataAPI_Point2D(aSketchArc3.attribute("start_point")) -anArc3StartPoint.setValue(70., -10.) +anArc3StartPoint.setValue(70.0, -10.0) anArc3EndPoint = geomDataAPI_Point2D(aSketchArc3.attribute("end_point")) -anArc3EndPoint.setValue(100., 20.) +anArc3EndPoint.setValue(100.0, 20.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 19) +assert model.dof(aSketchFeature) == 19 aSession.startOperation() aTangency = aSketchFeature.addFeature("SketchConstraintTangent") -aTangency.refattr("ConstraintEntityA").setObject(modelAPI_ResultConstruction(aSketchArc2.lastResult())) -aTangency.refattr("ConstraintEntityB").setObject(modelAPI_ResultConstruction(aSketchArc3.lastResult())) +aTangency.refattr("ConstraintEntityA").setObject( + modelAPI_ResultConstruction(aSketchArc2.lastResult()) +) +aTangency.refattr("ConstraintEntityB").setObject( + modelAPI_ResultConstruction(aSketchArc3.lastResult()) +) aSession.finishOperation() checkArcArcTangency(aSketchArc2, aSketchArc3) -assert (model.dof(aSketchFeature) == 18) +assert model.dof(aSketchFeature) == 18 aSession.startOperation() aDocument.removeFeature(aSketchArc3) aDocument.removeFeature(aTangency) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 14) +assert model.dof(aSketchFeature) == 14 # 3.3 tangency between arc and circle aSession.startOperation() aCircle1 = aSketchFeature.addFeature("SketchCircle") aCircleCenter = geomDataAPI_Point2D(aCircle1.attribute("circle_center")) aCircleRadius = aCircle1.real("circle_radius") -aCircleCenter.setValue(150., 100.) -aCircleRadius.setValue(50.) +aCircleCenter.setValue(150.0, 100.0) +aCircleRadius.setValue(50.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 17) +assert model.dof(aSketchFeature) == 17 aSession.startOperation() aTangency1 = aSketchFeature.addFeature("SketchConstraintTangent") -aTangency1.refattr("ConstraintEntityA").setObject(modelAPI_ResultConstruction(aSketchArc2.lastResult())) -aTangency1.refattr("ConstraintEntityB").setObject(modelAPI_ResultConstruction(aCircle1.lastResult())) +aTangency1.refattr("ConstraintEntityA").setObject( + modelAPI_ResultConstruction(aSketchArc2.lastResult()) +) +aTangency1.refattr("ConstraintEntityB").setObject( + modelAPI_ResultConstruction(aCircle1.lastResult()) +) aSession.finishOperation() checkArcArcTangency(aSketchArc2, aCircle1) -assert (model.dof(aSketchFeature) == 16) +assert model.dof(aSketchFeature) == 16 # 3.4 tangency between two circles aSession.startOperation() aCircle2 = aSketchFeature.addFeature("SketchCircle") aCircleCenter = geomDataAPI_Point2D(aCircle2.attribute("circle_center")) aCircleRadius = aCircle2.real("circle_radius") -aCircleCenter.setValue(120., 70.) -aCircleRadius.setValue(20.) +aCircleCenter.setValue(120.0, 70.0) +aCircleRadius.setValue(20.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 19) +assert model.dof(aSketchFeature) == 19 aSession.startOperation() aTangency2 = aSketchFeature.addFeature("SketchConstraintTangent") -aTangency2.refattr("ConstraintEntityA").setObject(modelAPI_ResultConstruction(aCircle1.lastResult())) -aTangency2.refattr("ConstraintEntityB").setObject(modelAPI_ResultConstruction(aCircle2.lastResult())) +aTangency2.refattr("ConstraintEntityA").setObject( + modelAPI_ResultConstruction(aCircle1.lastResult()) +) +aTangency2.refattr("ConstraintEntityB").setObject( + modelAPI_ResultConstruction(aCircle2.lastResult()) +) aSession.finishOperation() checkArcArcTangency(aCircle1, aCircle2) -assert (model.dof(aSketchFeature) == 18) +assert model.dof(aSketchFeature) == 18 -#========================================================================= +# ========================================================================= # TEST 4. Creating of tangency arc by the option of the SketchArc feature -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchArc3 = aSketchFeature.addFeature("SketchMacroArc") aSketchArc3.string("arc_type").setValue("by_tangent_edge") anArc3Start = aSketchArc3.refattr("tangent_point") anArc3Start.setAttr(anArc1StartPoint) anArc3EndPoint = geomDataAPI_Point2D(aSketchArc3.attribute("end_point_3")) -anArc3EndPoint.setValue(anArc1StartPoint.x()-5, anArc1StartPoint.y()-30) +anArc3EndPoint.setValue(anArc1StartPoint.x() - 5, anArc1StartPoint.y() - 30) aSession.finishOperation() aSketchArc3 = model.lastSubFeature(aSketchFeature, "SketchArc") checkArcArcTangency(aSketchArc1, aSketchArc3) # freeze radius of tangent arc aSession.startOperation() aConstraintRadius = aSketchFeature.addFeature("SketchConstraintRadius") -aConstraintRadius.refattr("ConstraintEntityA").setObject(modelAPI_ResultConstruction(aSketchArc3.lastResult())) -aConstraintRadius.real("ConstraintValue").setValue(30.) +aConstraintRadius.refattr("ConstraintEntityA").setObject( + modelAPI_ResultConstruction(aSketchArc3.lastResult()) +) +aConstraintRadius.real("ConstraintValue").setValue(30.0) aSession.finishOperation() checkArcArcTangency(aSketchArc1, aSketchArc3) # do not check DoF here because it is unstable for tangent arcs, @@ -349,24 +369,24 @@ checkArcArcTangency(aSketchArc1, aSketchArc3) aSession.startOperation() ModelAPI.removeFeaturesAndReferences(FeatureSet([aSketchArc3])) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 18) +assert model.dof(aSketchFeature) == 18 -#========================================================================= +# ========================================================================= # TEST 5. Creating of tangency between line and circle -#========================================================================= +# ========================================================================= aSession.startOperation() aLine = aSketchFeature.addFeature("SketchLine") aLineStart = geomDataAPI_Point2D(aLine.attribute("StartPoint")) aLineEnd = geomDataAPI_Point2D(aLine.attribute("EndPoint")) -aLineStart.setValue(100., 100.) -aLineEnd.setValue(200., 200.) +aLineStart.setValue(100.0, 100.0) +aLineEnd.setValue(200.0, 200.0) aCircle = aSketchFeature.addFeature("SketchCircle") aCircleCenter = geomDataAPI_Point2D(aCircle.attribute("circle_center")) aCircleRadius = aCircle.real("circle_radius") -aCircleCenter.setValue(150., 100.) -aCircleRadius.setValue(20.) +aCircleCenter.setValue(150.0, 100.0) +aCircleRadius.setValue(20.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 25) +assert model.dof(aSketchFeature) == 25 aSession.startOperation() aTangency = aSketchFeature.addFeature("SketchConstraintTangent") @@ -374,17 +394,17 @@ aRefObjectA = aTangency.refattr("ConstraintEntityA") aRefObjectB = aTangency.refattr("ConstraintEntityB") anObjectA = modelAPI_ResultConstruction(aLine.lastResult()) anObjectB = modelAPI_ResultConstruction(aCircle.lastResult()) -assert (anObjectA is not None) -assert (anObjectB is not None) +assert anObjectA is not None +assert anObjectB is not None aRefObjectA.setObject(anObjectA) aRefObjectB.setObject(anObjectB) aTangency.execute() aSession.finishOperation() checkArcLineTangency(aCircle, aLine) -assert (model.dof(aSketchFeature) == 24) -#========================================================================= +assert model.dof(aSketchFeature) == 24 +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintTangentBSpline.py b/src/SketchPlugin/Test/TestConstraintTangentBSpline.py index 4cdda7cbd..2d61a3ffe 100644 --- a/src/SketchPlugin/Test/TestConstraintTangentBSpline.py +++ b/src/SketchPlugin/Test/TestConstraintTangentBSpline.py @@ -32,442 +32,486 @@ from SketchAPI import * __updated__ = "2020-01-22" -class TestTangentBSpline(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myPoles = [GeomAPI_Pnt2d(-10, -30), GeomAPI_Pnt2d(20, -15), GeomAPI_Pnt2d(-10, 0), GeomAPI_Pnt2d(20, 15), GeomAPI_Pnt2d(-10, 30)] - self.myWeights = [1, 3, 5, 3, 1] - self.mySpline = self.mySketch.addSpline(poles = self.myPoles, weights = self.myWeights) - self.myControlPoles = self.mySpline.controlPoles(auxiliary = [0, 1, 2, 3, 4]) - self.myControlLines = self.mySpline.controlPolygon(auxiliary = [0, 1, 2, 3]) - model.do() - - self.myExpectedFailure = False - self.myDOF = len(self.myPoles) * 2 - self.myNbPoints = len(self.myPoles) - self.myNbLines = len(self.myPoles) - 1 - self.myNbArcs = 0 - self.myNbCircles = 0 - self.myNbEllipses = 0 - self.myNbEllipticArcs = 0 - self.myNbBSplines = 1 - self.myNbInternals = len(self.myPoles) * 3 - 2 - self.myNbCoincidence = 0 - self.myNbTangency = 0 - - def tearDown(self): - model.end() - if self.myExpectedFailure: - assert(self.mySketch.solverError() != ""), "PlaneGCS limitation: if you see this message, then PlaneGCS has solved the set of constraints correctly" - model.undo() - else: - self.checkDOF() - model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) - model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) - model.testNbSubFeatures(self.mySketch, "SketchArc", self.myNbArcs) - model.testNbSubFeatures(self.mySketch, "SketchCircle", self.myNbCircles) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", self.myNbEllipses) - model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", self.myNbEllipticArcs) - model.testNbSubFeatures(self.mySketch, "SketchBSpline", self.myNbBSplines) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidenceInternal", self.myNbInternals) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", self.myNbCoincidence) - model.testNbSubFeatures(self.mySketch, "SketchConstraintTangent", self.myNbTangency) - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def assertTangentFeatures(self, theFeature1, theFeature2): - shapes = [theFeature1.results()[-1].resultSubShapePair()[0].shape(), - theFeature2.results()[-1].resultSubShapePair()[0].shape()] - for s in shapes: - e = shapeToEdge(s) - if e.isLine() or e.isArc() or e.isEllipse(): - params = e.getRange() - e.setRange(params[0] - 100, params[1] + 100) - # TODO (azv): complete checking the tangent curves - - def assertPointLineDistance(self, thePoint, theLine, theExpectedDistance = 0): - dist = model.distancePointLine(thePoint, theLine) - self.assertAlmostEqual(dist, theExpectedDistance) - - def assertTangentLineCircle(self, theLine, theCircle): - self.assertPointLineDistance(theCircle.center(), theLine, theCircle.radius().value()) - - def assertTangentLineEllipse(self, theLine, theEllipse): - aLine = GeomAPI_Lin2d(theLine.startPoint().pnt(), theLine.endPoint().pnt()) - projF1 = aLine.project(theEllipse.firstFocus().pnt()) - projF2 = aLine.project(theEllipse.secondFocus().pnt()) - - distF1P1 = model.distancePointPoint(theEllipse.firstFocus(), projF1) - distF2P2 = model.distancePointPoint(theEllipse.secondFocus(), projF2) - - tgPoint = GeomAPI_Pnt2d((projF1.x() * distF2P2 + projF2.x() * distF1P1) / (distF1P1 + distF2P2), (projF1.y() * distF2P2 + projF2.y() * distF1P1) / (distF1P1 + distF2P2)) - distF1T = model.distancePointPoint(theEllipse.firstFocus(), tgPoint) - distF2T = model.distancePointPoint(theEllipse.secondFocus(), tgPoint) - self.assertAlmostEqual(distF1T + distF2T, 2 * theEllipse.majorRadius().value()) - - - def test_line_tangent(self): - """ Test 1. Set tangency between B-spline and a line - """ - aLine = self.mySketch.addLine(10, -10, 90, 40) - self.myNbLines += 1 - self.myDOF += 4 - model.do() - - aTangency = self.mySketch.setTangent(self.mySpline.result(), aLine.result()) - model.end() - - self.assertNotEqual(aTangency.feature().error(), "") - model.undo() - model.begin() - - def test_circle_tangent(self): - """ Test 2. Set tangency between B-spline and a circle - """ - aCircle = self.mySketch.addCircle(10, 10, 20) - self.myNbCircles += 1 - self.myDOF += 3 - model.do() - - aTangency = self.mySketch.setTangent(self.mySpline.result(), aCircle.defaultResult()) - model.end() - - self.assertNotEqual(aTangency.feature().error(), "") - model.undo() - model.begin() - - def test_arc_tangent(self): - """ Test 3. Set tangency between B-spline and an arc - """ - anArc = self.mySketch.addArc(10, 10, 20, 10, 10, 20, False) - self.myNbArcs += 1 - self.myDOF += 5 - model.do() - - aTangency = self.mySketch.setTangent(self.mySpline.result(), anArc.defaultResult()) - model.end() - - self.assertNotEqual(aTangency.feature().error(), "") - model.undo() - model.begin() - - def test_ellipse_tangent(self): - """ Test 4. Set tangency between B-spline and an ellipse - """ - anEllipse = self.mySketch.addEllipse(10, 10, 20, 10, 7) - self.myNbEllipses += 1 - self.myDOF += 5 - model.do() - - aTangency = self.mySketch.setTangent(self.mySpline.result(), anEllipse.defaultResult()) - model.end() - - self.assertNotEqual(aTangency.feature().error(), "") - model.undo() - model.begin() - - def test_elliptic_arc_tangent(self): - """ Test 5. Set tangency between B-spline and an elliptic arc - """ - anEllipticArc = self.mySketch.addEllipticArc(10, 10, 20, 10, 22.2065556157337, 10, 10, 17, True) - self.myNbEllipticArcs += 1 - self.myDOF += 7 - model.do() - - aTangency = self.mySketch.setTangent(self.mySpline.result(), anEllipticArc.defaultResult()) - model.end() - - self.assertNotEqual(aTangency.feature().error(), "") - model.undo() - model.begin() - - def test_spline_tangent(self): - """ Test 6. Set tangency between two B-spline curves - """ - aSpline = self.mySketch.addSpline(poles = [(50, -20), (40, 0), (50, 20)]) - self.myNbBSplines += 1 - self.myDOF += aSpline.poles().size() * 2 - model.do() - - aTangency = self.mySketch.setTangent(self.mySpline.result(), aSpline.result()) - model.end() - - self.assertNotEqual(aTangency.feature().error(), "") - model.undo() - model.begin() - - - def test_line_tangent_coincident_by_pole(self): - """ Test 7. Set tangency between B-spline and a line coincident with B-spline start point - """ - aLine = self.mySketch.addLine(-15, -25, 50, 40) - self.myNbLines += 1 - self.myDOF += 4 - model.do() - - self.mySketch.setCoincident(self.mySpline.startPoint(), aLine.result()) - self.myNbCoincidence += 1 - self.myDOF -= 1 - model.do() - - aTangency = self.mySketch.setTangent(self.mySpline.result(), aLine.result()) - model.end() - - self.assertNotEqual(aTangency.feature().error(), "") - model.undo() - model.begin() - - def test_circle_tangent_coincident_by_pole(self): - """ Test 8. Set tangency between B-spline and a circle coincident with B-spline end point - """ - aCircle = self.mySketch.addCircle(10, 10, 20) - self.myNbCircles += 1 - self.myDOF += 3 - model.do() - - self.mySketch.setCoincident(self.mySpline.startPoint(), aCircle.defaultResult()) - self.myNbCoincidence += 1 - self.myDOF -= 1 - model.do() - - aTangency = self.mySketch.setTangent(self.mySpline.result(), aCircle.defaultResult()) - model.end() - - self.assertNotEqual(aTangency.feature().error(), "") - model.undo() - model.begin() - - def test_arc_tangent_coincident_by_pole(self): - """ Test 9. Set tangency between B-spline and an arc coincident with B-spline end point - """ - anArc = self.mySketch.addArc(10, 10, 20, 10, 10, 20, False) - self.myNbArcs += 1 - self.myDOF += 5 - model.do() - - self.mySketch.setCoincident(self.mySpline.endPoint(), anArc.defaultResult()) - self.myNbCoincidence += 1 - self.myDOF -= 1 - model.do() - - aTangency = self.mySketch.setTangent(self.mySpline.result(), anArc.defaultResult()) - model.end() - - self.assertNotEqual(aTangency.feature().error(), "") - model.undo() - model.begin() - - def test_ellipse_tangent_coincident_by_pole(self): - """ Test 10. Set tangency between B-spline and an ellipse coincident with B-spline start point - """ - anEllipse = self.mySketch.addEllipse(10, 10, 20, 10, 7) - self.myNbEllipses += 1 - self.myDOF += 5 - model.do() - - self.mySketch.setCoincident(self.mySpline.startPoint(), anEllipse.defaultResult()) - self.myNbCoincidence += 1 - self.myDOF -= 1 - model.do() - - aTangency = self.mySketch.setTangent(self.mySpline.result(), anEllipse.defaultResult()) - model.end() - - self.assertNotEqual(aTangency.feature().error(), "") - model.undo() - model.begin() - - def test_elliptic_arc_tangent_coincident_by_pole(self): - """ Test 11. Set tangency between B-spline and an elliptic arc coincident with B-spline start point - """ - anEllipticArc = self.mySketch.addEllipticArc(10, 10, 20, 10, 22.2065556157337, 10, 10, 17, True) - self.myNbEllipticArcs += 1 - self.myDOF += 7 - model.do() - - self.mySketch.setCoincident(self.mySpline.startPoint(), anEllipticArc.defaultResult()) - self.myNbCoincidence += 1 - self.myDOF -= 1 - model.do() - - aTangency = self.mySketch.setTangent(self.mySpline.result(), anEllipticArc.defaultResult()) - model.end() - - self.assertNotEqual(aTangency.feature().error(), "") - model.undo() - model.begin() - - - def test_line_tangent_coincident_by_boundaries(self): - """ Test 12. Set tangency between B-spline and a line, coincident by their start points - """ - aLine = self.mySketch.addLine(10, -10, 90, 40) - self.myNbLines += 1 - self.myDOF += 4 - model.do() - - self.mySketch.setCoincident(self.mySpline.startPoint(), aLine.startPoint()) - self.myNbCoincidence += 1 - self.myDOF -= 2 - model.do() - - self.mySketch.setTangent(self.mySpline.result(), aLine.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertPointLineDistance(aLine.endPoint(), self.myControlLines[0]) - - def test_arc_tangent_coincident_by_boundaries(self): - """ Test 13. Set tangency between B-spline and an arc, coincident by their start points - """ - anArc = self.mySketch.addArc(10, 10, 20, 10, 10, 20, False) - self.myNbArcs += 1 - self.myDOF += 5 - model.do() - - self.mySketch.setCoincident(self.mySpline.startPoint(), anArc.startPoint()) - self.myNbCoincidence += 1 - self.myDOF -= 2 - model.do() - - self.mySketch.setTangent(self.mySpline.result(), anArc.defaultResult()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentLineCircle(SketchAPI_Line(self.myControlLines[0]), anArc) - - def test_elliptic_arc_tangent_coincident_by_boundaries(self): - """ Test 14. Set tangency between B-spline and an elliptic arc, coincident by their start points - """ - anEllipticArc = self.mySketch.addEllipticArc(10, -10, 20, -10, 22.2065556157337, -10, 10, 3, True) - self.myNbEllipticArcs += 1 - self.myDOF += 7 - model.do() - - self.mySketch.setCoincident(self.mySpline.startPoint(), anEllipticArc.startPoint()) - self.myNbCoincidence += 1 - self.myDOF -= 2 - model.do() - - self.mySketch.setTangent(self.mySpline.result(), anEllipticArc.defaultResult()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentLineEllipse(SketchAPI_Line(self.myControlLines[0]), anEllipticArc) - - def test_spline_tangent_coincident_by_boundaries(self): - """ Test 15. Set tangency between two B-spline curves coincident with B-spline start point - """ - aSpline = self.mySketch.addSpline(poles = [(50, -20), (40, 0), (50, 20)]) - self.myNbBSplines += 1 - self.myDOF += aSpline.poles().size() * 2 - model.do() - - self.mySketch.setCoincident(self.mySpline.startPoint(), aSpline.startPoint()) - self.myNbCoincidence += 1 - self.myDOF -= 2 - model.do() - - self.mySketch.setTangent(self.mySpline.result(), aSpline.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - #self.assertPointLineDistance(aSpline.poles()[1], self.myControlLines[0]) - self.myExpectedFailure = True - - - def test_line_tangent_coincident_by_aux(self): - """ Test 16. Set tangency between B-spline and a line, coincident by their start points - """ - aLine = self.mySketch.addLine(10, -10, 90, 40) - self.myNbLines += 1 - self.myDOF += 4 - model.do() - - self.mySketch.setCoincident(SketchAPI_Point(self.myControlPoles[0]).coordinates(), aLine.startPoint()) - self.myNbCoincidence += 1 - self.myDOF -= 2 - model.do() - - self.mySketch.setTangent(self.mySpline.result(), aLine.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertPointLineDistance(aLine.endPoint(), self.myControlLines[0]) - - def test_arc_tangent_coincident_by_aux(self): - """ Test 17. Set tangency between B-spline and an arc, coincident by their start points - """ - anArc = self.mySketch.addArc(10, 10, 20, 10, 10, 20, False) - self.myNbArcs += 1 - self.myDOF += 5 - model.do() - - self.mySketch.setCoincident(SketchAPI_Point(self.myControlPoles[0]).coordinates(), anArc.startPoint()) - self.myNbCoincidence += 1 - self.myDOF -= 2 - model.do() - - self.mySketch.setTangent(self.mySpline.result(), anArc.defaultResult()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentLineCircle(SketchAPI_Line(self.myControlLines[0]), anArc) - - def test_elliptic_arc_tangent_coincident_by_aux(self): - """ Test 18. Set tangency between B-spline and an elliptic arc, coincident by their start points - """ - anEllipticArc = self.mySketch.addEllipticArc(10, 10, 20, 10, 22.2065556157337, 10, 10, 17, True) - self.myNbEllipticArcs += 1 - self.myDOF += 7 - model.do() - - self.mySketch.setCoincident(SketchAPI_Point(self.myControlPoles[0]).coordinates(), anEllipticArc.startPoint()) - self.myNbCoincidence += 1 - self.myDOF -= 2 - model.do() - - self.mySketch.setTangent(self.mySpline.result(), anEllipticArc.defaultResult()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentLineEllipse(SketchAPI_Line(self.myControlLines[0]), anEllipticArc) - - def test_spline_tangent_coincident_by_aux(self): - """ Test 19. Set tangency between two B-spline curves coincident with B-spline start point - """ - aSpline = self.mySketch.addSpline(poles = [(50, -20), (40, 0), (50, 20)]) - self.myNbBSplines += 1 - self.myDOF += aSpline.poles().size() * 2 - model.do() - - self.mySketch.setCoincident(SketchAPI_Point(self.myControlPoles[0]).coordinates(), aSpline.startPoint()) - self.myNbCoincidence += 1 - self.myDOF -= 2 - model.do() - - self.mySketch.setTangent(self.mySpline.result(), aSpline.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - #self.assertPointLineDistance(aSpline.poles().pnt(1), self.myControlLines[0]) - self.myExpectedFailure = True +class TestTangentBSpline(unittest.TestCase): + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myPoles = [ + GeomAPI_Pnt2d(-10, -30), + GeomAPI_Pnt2d(20, -15), + GeomAPI_Pnt2d(-10, 0), + GeomAPI_Pnt2d(20, 15), + GeomAPI_Pnt2d(-10, 30), + ] + self.myWeights = [1, 3, 5, 3, 1] + self.mySpline = self.mySketch.addSpline( + poles=self.myPoles, weights=self.myWeights + ) + self.myControlPoles = self.mySpline.controlPoles(auxiliary=[0, 1, 2, 3, 4]) + self.myControlLines = self.mySpline.controlPolygon(auxiliary=[0, 1, 2, 3]) + model.do() + + self.myExpectedFailure = False + self.myDOF = len(self.myPoles) * 2 + self.myNbPoints = len(self.myPoles) + self.myNbLines = len(self.myPoles) - 1 + self.myNbArcs = 0 + self.myNbCircles = 0 + self.myNbEllipses = 0 + self.myNbEllipticArcs = 0 + self.myNbBSplines = 1 + self.myNbInternals = len(self.myPoles) * 3 - 2 + self.myNbCoincidence = 0 + self.myNbTangency = 0 + + def tearDown(self): + model.end() + if self.myExpectedFailure: + assert ( + self.mySketch.solverError() != "" + ), "PlaneGCS limitation: if you see this message, then PlaneGCS has solved the set of constraints correctly" + model.undo() + else: + self.checkDOF() + model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) + model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) + model.testNbSubFeatures(self.mySketch, "SketchArc", self.myNbArcs) + model.testNbSubFeatures(self.mySketch, "SketchCircle", self.myNbCircles) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", self.myNbEllipses) + model.testNbSubFeatures( + self.mySketch, "SketchEllipticArc", self.myNbEllipticArcs + ) + model.testNbSubFeatures(self.mySketch, "SketchBSpline", self.myNbBSplines) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintCoincidenceInternal", self.myNbInternals + ) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintCoincidence", self.myNbCoincidence + ) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintTangent", self.myNbTangency + ) + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def assertTangentFeatures(self, theFeature1, theFeature2): + shapes = [ + theFeature1.results()[-1].resultSubShapePair()[0].shape(), + theFeature2.results()[-1].resultSubShapePair()[0].shape(), + ] + for s in shapes: + e = shapeToEdge(s) + if e.isLine() or e.isArc() or e.isEllipse(): + params = e.getRange() + e.setRange(params[0] - 100, params[1] + 100) + # TODO (azv): complete checking the tangent curves + + def assertPointLineDistance(self, thePoint, theLine, theExpectedDistance=0): + dist = model.distancePointLine(thePoint, theLine) + self.assertAlmostEqual(dist, theExpectedDistance) + + def assertTangentLineCircle(self, theLine, theCircle): + self.assertPointLineDistance( + theCircle.center(), theLine, theCircle.radius().value() + ) + + def assertTangentLineEllipse(self, theLine, theEllipse): + aLine = GeomAPI_Lin2d(theLine.startPoint().pnt(), theLine.endPoint().pnt()) + projF1 = aLine.project(theEllipse.firstFocus().pnt()) + projF2 = aLine.project(theEllipse.secondFocus().pnt()) + + distF1P1 = model.distancePointPoint(theEllipse.firstFocus(), projF1) + distF2P2 = model.distancePointPoint(theEllipse.secondFocus(), projF2) + + tgPoint = GeomAPI_Pnt2d( + (projF1.x() * distF2P2 + projF2.x() * distF1P1) / (distF1P1 + distF2P2), + (projF1.y() * distF2P2 + projF2.y() * distF1P1) / (distF1P1 + distF2P2), + ) + distF1T = model.distancePointPoint(theEllipse.firstFocus(), tgPoint) + distF2T = model.distancePointPoint(theEllipse.secondFocus(), tgPoint) + self.assertAlmostEqual(distF1T + distF2T, 2 * theEllipse.majorRadius().value()) + + def test_line_tangent(self): + """Test 1. Set tangency between B-spline and a line""" + aLine = self.mySketch.addLine(10, -10, 90, 40) + self.myNbLines += 1 + self.myDOF += 4 + model.do() + + aTangency = self.mySketch.setTangent(self.mySpline.result(), aLine.result()) + model.end() + + self.assertNotEqual(aTangency.feature().error(), "") + model.undo() + model.begin() + + def test_circle_tangent(self): + """Test 2. Set tangency between B-spline and a circle""" + aCircle = self.mySketch.addCircle(10, 10, 20) + self.myNbCircles += 1 + self.myDOF += 3 + model.do() + + aTangency = self.mySketch.setTangent( + self.mySpline.result(), aCircle.defaultResult() + ) + model.end() + + self.assertNotEqual(aTangency.feature().error(), "") + model.undo() + model.begin() + + def test_arc_tangent(self): + """Test 3. Set tangency between B-spline and an arc""" + anArc = self.mySketch.addArc(10, 10, 20, 10, 10, 20, False) + self.myNbArcs += 1 + self.myDOF += 5 + model.do() + + aTangency = self.mySketch.setTangent( + self.mySpline.result(), anArc.defaultResult() + ) + model.end() + + self.assertNotEqual(aTangency.feature().error(), "") + model.undo() + model.begin() + + def test_ellipse_tangent(self): + """Test 4. Set tangency between B-spline and an ellipse""" + anEllipse = self.mySketch.addEllipse(10, 10, 20, 10, 7) + self.myNbEllipses += 1 + self.myDOF += 5 + model.do() + + aTangency = self.mySketch.setTangent( + self.mySpline.result(), anEllipse.defaultResult() + ) + model.end() + + self.assertNotEqual(aTangency.feature().error(), "") + model.undo() + model.begin() + + def test_elliptic_arc_tangent(self): + """Test 5. Set tangency between B-spline and an elliptic arc""" + anEllipticArc = self.mySketch.addEllipticArc( + 10, 10, 20, 10, 22.2065556157337, 10, 10, 17, True + ) + self.myNbEllipticArcs += 1 + self.myDOF += 7 + model.do() + + aTangency = self.mySketch.setTangent( + self.mySpline.result(), anEllipticArc.defaultResult() + ) + model.end() + + self.assertNotEqual(aTangency.feature().error(), "") + model.undo() + model.begin() + + def test_spline_tangent(self): + """Test 6. Set tangency between two B-spline curves""" + aSpline = self.mySketch.addSpline(poles=[(50, -20), (40, 0), (50, 20)]) + self.myNbBSplines += 1 + self.myDOF += aSpline.poles().size() * 2 + model.do() + + aTangency = self.mySketch.setTangent(self.mySpline.result(), aSpline.result()) + model.end() + + self.assertNotEqual(aTangency.feature().error(), "") + model.undo() + model.begin() + + def test_line_tangent_coincident_by_pole(self): + """Test 7. Set tangency between B-spline and a line coincident with B-spline start point""" + aLine = self.mySketch.addLine(-15, -25, 50, 40) + self.myNbLines += 1 + self.myDOF += 4 + model.do() + + self.mySketch.setCoincident(self.mySpline.startPoint(), aLine.result()) + self.myNbCoincidence += 1 + self.myDOF -= 1 + model.do() + + aTangency = self.mySketch.setTangent(self.mySpline.result(), aLine.result()) + model.end() + + self.assertNotEqual(aTangency.feature().error(), "") + model.undo() + model.begin() + + def test_circle_tangent_coincident_by_pole(self): + """Test 8. Set tangency between B-spline and a circle coincident with B-spline end point""" + aCircle = self.mySketch.addCircle(10, 10, 20) + self.myNbCircles += 1 + self.myDOF += 3 + model.do() + + self.mySketch.setCoincident(self.mySpline.startPoint(), aCircle.defaultResult()) + self.myNbCoincidence += 1 + self.myDOF -= 1 + model.do() + + aTangency = self.mySketch.setTangent( + self.mySpline.result(), aCircle.defaultResult() + ) + model.end() + + self.assertNotEqual(aTangency.feature().error(), "") + model.undo() + model.begin() + + def test_arc_tangent_coincident_by_pole(self): + """Test 9. Set tangency between B-spline and an arc coincident with B-spline end point""" + anArc = self.mySketch.addArc(10, 10, 20, 10, 10, 20, False) + self.myNbArcs += 1 + self.myDOF += 5 + model.do() + + self.mySketch.setCoincident(self.mySpline.endPoint(), anArc.defaultResult()) + self.myNbCoincidence += 1 + self.myDOF -= 1 + model.do() + + aTangency = self.mySketch.setTangent( + self.mySpline.result(), anArc.defaultResult() + ) + model.end() + + self.assertNotEqual(aTangency.feature().error(), "") + model.undo() + model.begin() + + def test_ellipse_tangent_coincident_by_pole(self): + """Test 10. Set tangency between B-spline and an ellipse coincident with B-spline start point""" + anEllipse = self.mySketch.addEllipse(10, 10, 20, 10, 7) + self.myNbEllipses += 1 + self.myDOF += 5 + model.do() + + self.mySketch.setCoincident( + self.mySpline.startPoint(), anEllipse.defaultResult() + ) + self.myNbCoincidence += 1 + self.myDOF -= 1 + model.do() + + aTangency = self.mySketch.setTangent( + self.mySpline.result(), anEllipse.defaultResult() + ) + model.end() + + self.assertNotEqual(aTangency.feature().error(), "") + model.undo() + model.begin() + + def test_elliptic_arc_tangent_coincident_by_pole(self): + """Test 11. Set tangency between B-spline and an elliptic arc coincident with B-spline start point""" + anEllipticArc = self.mySketch.addEllipticArc( + 10, 10, 20, 10, 22.2065556157337, 10, 10, 17, True + ) + self.myNbEllipticArcs += 1 + self.myDOF += 7 + model.do() + + self.mySketch.setCoincident( + self.mySpline.startPoint(), anEllipticArc.defaultResult() + ) + self.myNbCoincidence += 1 + self.myDOF -= 1 + model.do() + + aTangency = self.mySketch.setTangent( + self.mySpline.result(), anEllipticArc.defaultResult() + ) + model.end() + + self.assertNotEqual(aTangency.feature().error(), "") + model.undo() + model.begin() + + def test_line_tangent_coincident_by_boundaries(self): + """Test 12. Set tangency between B-spline and a line, coincident by their start points""" + aLine = self.mySketch.addLine(10, -10, 90, 40) + self.myNbLines += 1 + self.myDOF += 4 + model.do() + + self.mySketch.setCoincident(self.mySpline.startPoint(), aLine.startPoint()) + self.myNbCoincidence += 1 + self.myDOF -= 2 + model.do() + + self.mySketch.setTangent(self.mySpline.result(), aLine.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertPointLineDistance(aLine.endPoint(), self.myControlLines[0]) + + def test_arc_tangent_coincident_by_boundaries(self): + """Test 13. Set tangency between B-spline and an arc, coincident by their start points""" + anArc = self.mySketch.addArc(10, 10, 20, 10, 10, 20, False) + self.myNbArcs += 1 + self.myDOF += 5 + model.do() + + self.mySketch.setCoincident(self.mySpline.startPoint(), anArc.startPoint()) + self.myNbCoincidence += 1 + self.myDOF -= 2 + model.do() + + self.mySketch.setTangent(self.mySpline.result(), anArc.defaultResult()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentLineCircle(SketchAPI_Line(self.myControlLines[0]), anArc) + + def test_elliptic_arc_tangent_coincident_by_boundaries(self): + """Test 14. Set tangency between B-spline and an elliptic arc, coincident by their start points""" + anEllipticArc = self.mySketch.addEllipticArc( + 10, -10, 20, -10, 22.2065556157337, -10, 10, 3, True + ) + self.myNbEllipticArcs += 1 + self.myDOF += 7 + model.do() + + self.mySketch.setCoincident( + self.mySpline.startPoint(), anEllipticArc.startPoint() + ) + self.myNbCoincidence += 1 + self.myDOF -= 2 + model.do() + + self.mySketch.setTangent(self.mySpline.result(), anEllipticArc.defaultResult()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentLineEllipse( + SketchAPI_Line(self.myControlLines[0]), anEllipticArc + ) + + def test_spline_tangent_coincident_by_boundaries(self): + """Test 15. Set tangency between two B-spline curves coincident with B-spline start point""" + aSpline = self.mySketch.addSpline(poles=[(50, -20), (40, 0), (50, 20)]) + self.myNbBSplines += 1 + self.myDOF += aSpline.poles().size() * 2 + model.do() + + self.mySketch.setCoincident(self.mySpline.startPoint(), aSpline.startPoint()) + self.myNbCoincidence += 1 + self.myDOF -= 2 + model.do() + + self.mySketch.setTangent(self.mySpline.result(), aSpline.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + # self.assertPointLineDistance(aSpline.poles()[1], self.myControlLines[0]) + self.myExpectedFailure = True + + def test_line_tangent_coincident_by_aux(self): + """Test 16. Set tangency between B-spline and a line, coincident by their start points""" + aLine = self.mySketch.addLine(10, -10, 90, 40) + self.myNbLines += 1 + self.myDOF += 4 + model.do() + + self.mySketch.setCoincident( + SketchAPI_Point(self.myControlPoles[0]).coordinates(), aLine.startPoint() + ) + self.myNbCoincidence += 1 + self.myDOF -= 2 + model.do() + + self.mySketch.setTangent(self.mySpline.result(), aLine.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertPointLineDistance(aLine.endPoint(), self.myControlLines[0]) + + def test_arc_tangent_coincident_by_aux(self): + """Test 17. Set tangency between B-spline and an arc, coincident by their start points""" + anArc = self.mySketch.addArc(10, 10, 20, 10, 10, 20, False) + self.myNbArcs += 1 + self.myDOF += 5 + model.do() + + self.mySketch.setCoincident( + SketchAPI_Point(self.myControlPoles[0]).coordinates(), anArc.startPoint() + ) + self.myNbCoincidence += 1 + self.myDOF -= 2 + model.do() + + self.mySketch.setTangent(self.mySpline.result(), anArc.defaultResult()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentLineCircle(SketchAPI_Line(self.myControlLines[0]), anArc) + + def test_elliptic_arc_tangent_coincident_by_aux(self): + """Test 18. Set tangency between B-spline and an elliptic arc, coincident by their start points""" + anEllipticArc = self.mySketch.addEllipticArc( + 10, 10, 20, 10, 22.2065556157337, 10, 10, 17, True + ) + self.myNbEllipticArcs += 1 + self.myDOF += 7 + model.do() + + self.mySketch.setCoincident( + SketchAPI_Point(self.myControlPoles[0]).coordinates(), + anEllipticArc.startPoint(), + ) + self.myNbCoincidence += 1 + self.myDOF -= 2 + model.do() + + self.mySketch.setTangent(self.mySpline.result(), anEllipticArc.defaultResult()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentLineEllipse( + SketchAPI_Line(self.myControlLines[0]), anEllipticArc + ) + + def test_spline_tangent_coincident_by_aux(self): + """Test 19. Set tangency between two B-spline curves coincident with B-spline start point""" + aSpline = self.mySketch.addSpline(poles=[(50, -20), (40, 0), (50, 20)]) + self.myNbBSplines += 1 + self.myDOF += aSpline.poles().size() * 2 + model.do() + + self.mySketch.setCoincident( + SketchAPI_Point(self.myControlPoles[0]).coordinates(), aSpline.startPoint() + ) + self.myNbCoincidence += 1 + self.myDOF -= 2 + model.do() + + self.mySketch.setTangent(self.mySpline.result(), aSpline.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + # self.assertPointLineDistance(aSpline.poles().pnt(1), self.myControlLines[0]) + self.myExpectedFailure = True if __name__ == "__main__": test_program = unittest.main(exit=False) assert test_program.result.wasSuccessful(), "Test failed" - #assert model.checkPythonDump() + # assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestConstraintTangentEllipse.py b/src/SketchPlugin/Test/TestConstraintTangentEllipse.py index e9fd9f2ef..221d0a950 100644 --- a/src/SketchPlugin/Test/TestConstraintTangentEllipse.py +++ b/src/SketchPlugin/Test/TestConstraintTangentEllipse.py @@ -31,321 +31,363 @@ from SketchAPI import * __updated__ = "2019-09-20" -class TestTangentEllipse(unittest.TestCase): - def setUp(self): - axisStart = GeomAPI_Pnt2d(20., 60.) - axisEnd = GeomAPI_Pnt2d(80., 50.) - passedPoint = GeomAPI_Pnt2d(60., 70.) - - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - macroEllipse = self.mySketch.addEllipse(axisStart, axisEnd, passedPoint, False) - model.do() - self.myEllipse = SketchAPI_Ellipse(model.lastSubFeature(self.mySketch, "SketchEllipse")) - self.myCenter = macroEllipse.center() - self.myFocus1 = macroEllipse.focus1() - self.myFocus2 = macroEllipse.focus2() - self.myMajorAxis = macroEllipse.majorAxis() - self.myMajorStart = macroEllipse.majorAxisStart() - self.myMajorEnd = macroEllipse.majorAxisEnd() - self.myMinorAxis = macroEllipse.minorAxis() - self.myMinorStart = macroEllipse.minorAxisStart() - self.myMinorEnd = macroEllipse.minorAxisEnd() - - self.myDOF = 5 - self.myNbPoints = 7 - self.myNbLines = 2 - self.myNbArcs = 0 - self.myNbCircles = 0 - self.myNbEllipses = 1 - self.myNbInternals = 11 - self.myNbCoincidence = 0 - self.myNbTangency = 0 - - def tearDown(self): - model.end() - self.checkDOF() - self.assertPoints(self.myCenter.coordinates(), self.myEllipse.center()) - self.assertPoints(self.myFocus1.coordinates(), self.myEllipse.firstFocus()) - self.assertPoints(self.myFocus2.coordinates(), self.myEllipse.secondFocus()) - self.assertPoints(self.myMajorStart.coordinates(), self.myEllipse.majorAxisNegative()) - self.assertPoints(self.myMajorEnd.coordinates(), self.myEllipse.majorAxisPositive()) - self.assertPoints(self.myMajorAxis.startPoint(), self.myEllipse.majorAxisNegative()) - self.assertPoints(self.myMajorAxis.endPoint(), self.myEllipse.majorAxisPositive()) - self.assertPoints(self.myMinorStart.coordinates(), self.myEllipse.minorAxisNegative()) - self.assertPoints(self.myMinorEnd.coordinates(), self.myEllipse.minorAxisPositive()) - self.assertPoints(self.myMinorAxis.startPoint(), self.myEllipse.minorAxisNegative()) - self.assertPoints(self.myMinorAxis.endPoint(), self.myEllipse.minorAxisPositive()) - model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) - model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) - model.testNbSubFeatures(self.mySketch, "SketchArc", self.myNbArcs) - model.testNbSubFeatures(self.mySketch, "SketchCircle", self.myNbCircles) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", self.myNbEllipses) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidenceInternal", self.myNbInternals) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", self.myNbCoincidence) - model.testNbSubFeatures(self.mySketch, "SketchConstraintTangent", self.myNbTangency) - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def assertTangentLineEllipse(self, theLine, theEllipse): - aLine = GeomAPI_Lin2d(theLine.startPoint().pnt(), theLine.endPoint().pnt()) - projF1 = aLine.project(theEllipse.firstFocus().pnt()) - projF2 = aLine.project(theEllipse.secondFocus().pnt()) - - distF1P1 = model.distancePointPoint(theEllipse.firstFocus(), projF1) - distF2P2 = model.distancePointPoint(theEllipse.secondFocus(), projF2) - - tgPoint = GeomAPI_Pnt2d((projF1.x() * distF2P2 + projF2.x() * distF1P1) / (distF1P1 + distF2P2), (projF1.y() * distF2P2 + projF2.y() * distF1P1) / (distF1P1 + distF2P2)) - distF1T = model.distancePointPoint(theEllipse.firstFocus(), tgPoint) - distF2T = model.distancePointPoint(theEllipse.secondFocus(), tgPoint) - self.assertAlmostEqual(distF1T + distF2T, 2 * theEllipse.majorRadius().value()) - - def assertTangentCircleEllipse(self, theCircle, theEllipse): - axis = GeomAPI_Dir2d(theEllipse.firstFocus().x() - theEllipse.center().x(), theEllipse.firstFocus().y() - theEllipse.center().y()) - anEllipse = GeomAPI_Ellipse2d(theEllipse.center().pnt(), axis, theEllipse.majorRadius().value(), theEllipse.minorRadius().value()) - aCircle = GeomAPI_Circ2d(theCircle.center().pnt(), GeomAPI_Dir2d(1, 0), theCircle.radius().value()) - - pOnE = GeomAPI_Pnt2d(0, 0) - pOnC = GeomAPI_Pnt2d(0, 0) - anEllipse.distance(aCircle, pOnE, pOnC) - self.assertAlmostEqual(model.distancePointPoint(pOnE, theCircle.center()), theCircle.radius().value()) - - dist1 = model.distancePointPoint(pOnC, theEllipse.firstFocus()) - dist2 = model.distancePointPoint(pOnC, theEllipse.secondFocus()) - self.assertAlmostEqual(dist1 + dist2, 2 * theEllipse.majorRadius().value()) - - def assertTangentEllipses(self, theEllipse1, theEllipse2): - axis1 = GeomAPI_Dir2d(theEllipse1.firstFocus().x() - theEllipse1.center().x(), theEllipse1.firstFocus().y() - theEllipse1.center().y()) - anEllipse1 = GeomAPI_Ellipse2d(theEllipse1.center().pnt(), axis1, theEllipse1.majorRadius().value(), theEllipse1.minorRadius().value()) - axis2 = GeomAPI_Dir2d(theEllipse2.firstFocus().x() - theEllipse2.center().x(), theEllipse2.firstFocus().y() - theEllipse2.center().y()) - anEllipse2 = GeomAPI_Ellipse2d(theEllipse2.center().pnt(), axis2, theEllipse2.majorRadius().value(), theEllipse2.minorRadius().value()) - - p1 = GeomAPI_Pnt2d(0, 0) - p2 = GeomAPI_Pnt2d(0, 0) - anEllipse1.distance(anEllipse2, p1, p2) - - dist1 = model.distancePointPoint(p2, theEllipse1.firstFocus()) - dist2 = model.distancePointPoint(p2, theEllipse1.secondFocus()) - self.assertAlmostEqual(dist1 + dist2, 2 * theEllipse1.majorRadius().value()) - - dist1 = model.distancePointPoint(p1, theEllipse2.firstFocus()) - dist2 = model.distancePointPoint(p1, theEllipse2.secondFocus()) - self.assertAlmostEqual(dist1 + dist2, 2 * theEllipse2.majorRadius().value()) - - def assertPoints(self, thePoint1, thePoint2): - self.assertAlmostEqual(thePoint1.x(), thePoint2.x()) - self.assertAlmostEqual(thePoint1.y(), thePoint2.y()) - - - def test_line_tangent(self): - """ Test 1. Set tangency between ellipse and a line - """ - aLine = self.mySketch.addLine(10, 10, 90, 40) - self.myNbLines += 1 - self.myDOF += 4 - model.do() - - self.mySketch.setTangent(self.myEllipse.result(), aLine.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentLineEllipse(aLine, self.myEllipse) - - - def test_line_coincident_then_tangent(self): - """ Test 2. Set tangency between ellipse and a line, if the extremity of the line is coincident with the ellipse - """ - aLine = self.mySketch.addLine(10, 10, 90, 40) - self.mySketch.setCoincident(aLine.endPoint(), self.myEllipse.result()) - self.myNbLines += 1 - self.myNbCoincidence += 1 - self.myDOF += 3 - model.do() - - self.mySketch.setTangent(self.myEllipse.result(), aLine.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentLineEllipse(aLine, self.myEllipse) - - - def test_line_tangent_then_coincident(self): - """ Test 3. Set tangency between ellipse and a line, after that apply coincidence of extremity of the line and the ellipse's curve - """ - aLine = self.mySketch.addLine(10, 10, 90, 40) - self.myNbLines += 1 - self.myDOF += 4 - model.do() - - self.mySketch.setTangent(self.myEllipse.result(), aLine.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.mySketch.setCoincident(aLine.startPoint(), self.myEllipse.result()) - self.myNbCoincidence += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentLineEllipse(aLine, self.myEllipse) - - - def test_line_tangent_then_remove_coincidence(self): - """ Test 4. Set tangency between ellipse and a line, which have a coincident point, then remove this coincidence - """ - aLine = self.mySketch.addLine(10, 10, 90, 40) - aCoincidence = self.mySketch.setCoincident(aLine.endPoint(), self.myEllipse.result()) - self.myNbLines += 1 - self.myNbCoincidence += 1 - self.myDOF += 3 - model.do() - - self.mySketch.setTangent(self.myEllipse.result(), aLine.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.myDocument.removeFeature(aCoincidence.feature()) - self.myNbCoincidence -= 1 - self.myDOF += 1 - model.do() - - self.assertTangentLineEllipse(aLine, self.myEllipse) - - - def test_circle_tangent(self): - """ Test 5. Set tangency between ellipse and a circle - """ - aCircle = self.mySketch.addCircle(30, 10, 20) - self.myNbCircles += 1 - self.myDOF += 3 - model.do() - - self.mySketch.setTangent(self.myEllipse.result(), aCircle.defaultResult()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentCircleEllipse(aCircle, self.myEllipse) - - - def test_circle_coincident_then_tangent(self): - """ Test 6. Set tangency between ellipse and a circle, if the circle is coincident with start point of ellipse's minor axis - """ - aCircle = self.mySketch.addCircle(30, 10, 20) - self.mySketch.setCoincident(self.myMinorStart.coordinates(), aCircle.defaultResult()) - self.myNbCircles += 1 - self.myNbCoincidence += 1 - self.myDOF += 2 - model.do() - - self.mySketch.setTangent(self.myEllipse.result(), aCircle.defaultResult()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentCircleEllipse(aCircle, self.myEllipse) - self.assertAlmostEqual(model.distancePointPoint(aCircle.center(), self.myMinorStart.coordinates()), aCircle.radius().value()) - - - def test_arc_tangent(self): - """ Test 7. Set tangency between ellipse and a circular arc - """ - anArc = self.mySketch.addArc(30, 10, 20, 10, 40, 10, False) - self.myNbArcs += 1 - self.myDOF += 5 - model.do() - - self.mySketch.setTangent(self.myEllipse.result(), anArc.results()[-1]) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentCircleEllipse(anArc, self.myEllipse) - - - def test_arc_coincident_then_tangent(self): - """ Test 8. Set tangency between ellipse and an arc, if the extremity of the arc is coincident with the ellipse - """ - anArc = self.mySketch.addArc(30, 10, 20, 10, 40, 10, False) - self.mySketch.setCoincident(anArc.endPoint(), self.myEllipse.result()) - self.myNbArcs += 1 - self.myNbCoincidence += 1 - self.myDOF += 4 - model.do() - - self.mySketch.setTangent(self.myEllipse.result(), anArc.results()[-1]) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentCircleEllipse(anArc, self.myEllipse) - - - def test_arc_tangent_then_coincident(self): - """ Test 9. Set tangency between ellipse and an arc, after that apply coincidence of extremity of the arc and the ellipse's curve - """ - anArc = self.mySketch.addArc(30, 10, 20, 10, 40, 10, False) - self.myNbArcs += 1 - self.myDOF += 5 - model.do() - - self.mySketch.setTangent(self.myEllipse.result(), anArc.results()[-1]) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.mySketch.setCoincident(anArc.startPoint(), self.myEllipse.result()) - self.myNbCoincidence += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentCircleEllipse(anArc, self.myEllipse) - - - def test_arc_tangent_then_remove_coincidence(self): - """ Test 10. Set tangency between ellipse and an arc, which have a coincident point, then remove this coincidence - """ - anArc = self.mySketch.addArc(30, 10, 20, 10, 40, 10, False) - aCoincidence = self.mySketch.setCoincident(anArc.endPoint(), self.myEllipse.result()) - self.myNbArcs += 1 - self.myNbCoincidence += 1 - self.myDOF += 4 - model.do() - - self.mySketch.setTangent(self.myEllipse.result(), anArc.results()[-1]) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.myDocument.removeFeature(aCoincidence.feature()) - self.myNbCoincidence -= 1 - self.myDOF += 1 - model.do() - - self.assertTangentCircleEllipse(anArc, self.myEllipse) - - - def test_ellipse_tangent(self): - """ Test 11. Set tangency between two ellipses - """ - anEllipse = self.mySketch.addEllipse(10, 10, 20, -50, 20) - self.myNbEllipses += 1 - self.myDOF += 5 - model.do() - - self.mySketch.setTangent(self.myEllipse.result(), anEllipse.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentEllipses(anEllipse, self.myEllipse) +class TestTangentEllipse(unittest.TestCase): + def setUp(self): + axisStart = GeomAPI_Pnt2d(20.0, 60.0) + axisEnd = GeomAPI_Pnt2d(80.0, 50.0) + passedPoint = GeomAPI_Pnt2d(60.0, 70.0) + + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + macroEllipse = self.mySketch.addEllipse(axisStart, axisEnd, passedPoint, False) + model.do() + self.myEllipse = SketchAPI_Ellipse( + model.lastSubFeature(self.mySketch, "SketchEllipse") + ) + self.myCenter = macroEllipse.center() + self.myFocus1 = macroEllipse.focus1() + self.myFocus2 = macroEllipse.focus2() + self.myMajorAxis = macroEllipse.majorAxis() + self.myMajorStart = macroEllipse.majorAxisStart() + self.myMajorEnd = macroEllipse.majorAxisEnd() + self.myMinorAxis = macroEllipse.minorAxis() + self.myMinorStart = macroEllipse.minorAxisStart() + self.myMinorEnd = macroEllipse.minorAxisEnd() + + self.myDOF = 5 + self.myNbPoints = 7 + self.myNbLines = 2 + self.myNbArcs = 0 + self.myNbCircles = 0 + self.myNbEllipses = 1 + self.myNbInternals = 11 + self.myNbCoincidence = 0 + self.myNbTangency = 0 + + def tearDown(self): + model.end() + self.checkDOF() + self.assertPoints(self.myCenter.coordinates(), self.myEllipse.center()) + self.assertPoints(self.myFocus1.coordinates(), self.myEllipse.firstFocus()) + self.assertPoints(self.myFocus2.coordinates(), self.myEllipse.secondFocus()) + self.assertPoints( + self.myMajorStart.coordinates(), self.myEllipse.majorAxisNegative() + ) + self.assertPoints( + self.myMajorEnd.coordinates(), self.myEllipse.majorAxisPositive() + ) + self.assertPoints( + self.myMajorAxis.startPoint(), self.myEllipse.majorAxisNegative() + ) + self.assertPoints( + self.myMajorAxis.endPoint(), self.myEllipse.majorAxisPositive() + ) + self.assertPoints( + self.myMinorStart.coordinates(), self.myEllipse.minorAxisNegative() + ) + self.assertPoints( + self.myMinorEnd.coordinates(), self.myEllipse.minorAxisPositive() + ) + self.assertPoints( + self.myMinorAxis.startPoint(), self.myEllipse.minorAxisNegative() + ) + self.assertPoints( + self.myMinorAxis.endPoint(), self.myEllipse.minorAxisPositive() + ) + model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) + model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) + model.testNbSubFeatures(self.mySketch, "SketchArc", self.myNbArcs) + model.testNbSubFeatures(self.mySketch, "SketchCircle", self.myNbCircles) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", self.myNbEllipses) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintCoincidenceInternal", self.myNbInternals + ) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintCoincidence", self.myNbCoincidence + ) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintTangent", self.myNbTangency + ) + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def assertTangentLineEllipse(self, theLine, theEllipse): + aLine = GeomAPI_Lin2d(theLine.startPoint().pnt(), theLine.endPoint().pnt()) + projF1 = aLine.project(theEllipse.firstFocus().pnt()) + projF2 = aLine.project(theEllipse.secondFocus().pnt()) + + distF1P1 = model.distancePointPoint(theEllipse.firstFocus(), projF1) + distF2P2 = model.distancePointPoint(theEllipse.secondFocus(), projF2) + + tgPoint = GeomAPI_Pnt2d( + (projF1.x() * distF2P2 + projF2.x() * distF1P1) / (distF1P1 + distF2P2), + (projF1.y() * distF2P2 + projF2.y() * distF1P1) / (distF1P1 + distF2P2), + ) + distF1T = model.distancePointPoint(theEllipse.firstFocus(), tgPoint) + distF2T = model.distancePointPoint(theEllipse.secondFocus(), tgPoint) + self.assertAlmostEqual(distF1T + distF2T, 2 * theEllipse.majorRadius().value()) + + def assertTangentCircleEllipse(self, theCircle, theEllipse): + axis = GeomAPI_Dir2d( + theEllipse.firstFocus().x() - theEllipse.center().x(), + theEllipse.firstFocus().y() - theEllipse.center().y(), + ) + anEllipse = GeomAPI_Ellipse2d( + theEllipse.center().pnt(), + axis, + theEllipse.majorRadius().value(), + theEllipse.minorRadius().value(), + ) + aCircle = GeomAPI_Circ2d( + theCircle.center().pnt(), GeomAPI_Dir2d(1, 0), theCircle.radius().value() + ) + + pOnE = GeomAPI_Pnt2d(0, 0) + pOnC = GeomAPI_Pnt2d(0, 0) + anEllipse.distance(aCircle, pOnE, pOnC) + self.assertAlmostEqual( + model.distancePointPoint(pOnE, theCircle.center()), + theCircle.radius().value(), + ) + + dist1 = model.distancePointPoint(pOnC, theEllipse.firstFocus()) + dist2 = model.distancePointPoint(pOnC, theEllipse.secondFocus()) + self.assertAlmostEqual(dist1 + dist2, 2 * theEllipse.majorRadius().value()) + + def assertTangentEllipses(self, theEllipse1, theEllipse2): + axis1 = GeomAPI_Dir2d( + theEllipse1.firstFocus().x() - theEllipse1.center().x(), + theEllipse1.firstFocus().y() - theEllipse1.center().y(), + ) + anEllipse1 = GeomAPI_Ellipse2d( + theEllipse1.center().pnt(), + axis1, + theEllipse1.majorRadius().value(), + theEllipse1.minorRadius().value(), + ) + axis2 = GeomAPI_Dir2d( + theEllipse2.firstFocus().x() - theEllipse2.center().x(), + theEllipse2.firstFocus().y() - theEllipse2.center().y(), + ) + anEllipse2 = GeomAPI_Ellipse2d( + theEllipse2.center().pnt(), + axis2, + theEllipse2.majorRadius().value(), + theEllipse2.minorRadius().value(), + ) + + p1 = GeomAPI_Pnt2d(0, 0) + p2 = GeomAPI_Pnt2d(0, 0) + anEllipse1.distance(anEllipse2, p1, p2) + + dist1 = model.distancePointPoint(p2, theEllipse1.firstFocus()) + dist2 = model.distancePointPoint(p2, theEllipse1.secondFocus()) + self.assertAlmostEqual(dist1 + dist2, 2 * theEllipse1.majorRadius().value()) + + dist1 = model.distancePointPoint(p1, theEllipse2.firstFocus()) + dist2 = model.distancePointPoint(p1, theEllipse2.secondFocus()) + self.assertAlmostEqual(dist1 + dist2, 2 * theEllipse2.majorRadius().value()) + + def assertPoints(self, thePoint1, thePoint2): + self.assertAlmostEqual(thePoint1.x(), thePoint2.x()) + self.assertAlmostEqual(thePoint1.y(), thePoint2.y()) + + def test_line_tangent(self): + """Test 1. Set tangency between ellipse and a line""" + aLine = self.mySketch.addLine(10, 10, 90, 40) + self.myNbLines += 1 + self.myDOF += 4 + model.do() + + self.mySketch.setTangent(self.myEllipse.result(), aLine.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentLineEllipse(aLine, self.myEllipse) + + def test_line_coincident_then_tangent(self): + """Test 2. Set tangency between ellipse and a line, if the extremity of the line is coincident with the ellipse""" + aLine = self.mySketch.addLine(10, 10, 90, 40) + self.mySketch.setCoincident(aLine.endPoint(), self.myEllipse.result()) + self.myNbLines += 1 + self.myNbCoincidence += 1 + self.myDOF += 3 + model.do() + + self.mySketch.setTangent(self.myEllipse.result(), aLine.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentLineEllipse(aLine, self.myEllipse) + + def test_line_tangent_then_coincident(self): + """Test 3. Set tangency between ellipse and a line, after that apply coincidence of extremity of the line and the ellipse's curve""" + aLine = self.mySketch.addLine(10, 10, 90, 40) + self.myNbLines += 1 + self.myDOF += 4 + model.do() + + self.mySketch.setTangent(self.myEllipse.result(), aLine.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.mySketch.setCoincident(aLine.startPoint(), self.myEllipse.result()) + self.myNbCoincidence += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentLineEllipse(aLine, self.myEllipse) + + def test_line_tangent_then_remove_coincidence(self): + """Test 4. Set tangency between ellipse and a line, which have a coincident point, then remove this coincidence""" + aLine = self.mySketch.addLine(10, 10, 90, 40) + aCoincidence = self.mySketch.setCoincident( + aLine.endPoint(), self.myEllipse.result() + ) + self.myNbLines += 1 + self.myNbCoincidence += 1 + self.myDOF += 3 + model.do() + + self.mySketch.setTangent(self.myEllipse.result(), aLine.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.myDocument.removeFeature(aCoincidence.feature()) + self.myNbCoincidence -= 1 + self.myDOF += 1 + model.do() + + self.assertTangentLineEllipse(aLine, self.myEllipse) + + def test_circle_tangent(self): + """Test 5. Set tangency between ellipse and a circle""" + aCircle = self.mySketch.addCircle(30, 10, 20) + self.myNbCircles += 1 + self.myDOF += 3 + model.do() + + self.mySketch.setTangent(self.myEllipse.result(), aCircle.defaultResult()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentCircleEllipse(aCircle, self.myEllipse) + + def test_circle_coincident_then_tangent(self): + """Test 6. Set tangency between ellipse and a circle, if the circle is coincident with start point of ellipse's minor axis""" + aCircle = self.mySketch.addCircle(30, 10, 20) + self.mySketch.setCoincident( + self.myMinorStart.coordinates(), aCircle.defaultResult() + ) + self.myNbCircles += 1 + self.myNbCoincidence += 1 + self.myDOF += 2 + model.do() + + self.mySketch.setTangent(self.myEllipse.result(), aCircle.defaultResult()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentCircleEllipse(aCircle, self.myEllipse) + self.assertAlmostEqual( + model.distancePointPoint(aCircle.center(), self.myMinorStart.coordinates()), + aCircle.radius().value(), + ) + + def test_arc_tangent(self): + """Test 7. Set tangency between ellipse and a circular arc""" + anArc = self.mySketch.addArc(30, 10, 20, 10, 40, 10, False) + self.myNbArcs += 1 + self.myDOF += 5 + model.do() + + self.mySketch.setTangent(self.myEllipse.result(), anArc.results()[-1]) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentCircleEllipse(anArc, self.myEllipse) + + def test_arc_coincident_then_tangent(self): + """Test 8. Set tangency between ellipse and an arc, if the extremity of the arc is coincident with the ellipse""" + anArc = self.mySketch.addArc(30, 10, 20, 10, 40, 10, False) + self.mySketch.setCoincident(anArc.endPoint(), self.myEllipse.result()) + self.myNbArcs += 1 + self.myNbCoincidence += 1 + self.myDOF += 4 + model.do() + + self.mySketch.setTangent(self.myEllipse.result(), anArc.results()[-1]) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentCircleEllipse(anArc, self.myEllipse) + + def test_arc_tangent_then_coincident(self): + """Test 9. Set tangency between ellipse and an arc, after that apply coincidence of extremity of the arc and the ellipse's curve""" + anArc = self.mySketch.addArc(30, 10, 20, 10, 40, 10, False) + self.myNbArcs += 1 + self.myDOF += 5 + model.do() + + self.mySketch.setTangent(self.myEllipse.result(), anArc.results()[-1]) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.mySketch.setCoincident(anArc.startPoint(), self.myEllipse.result()) + self.myNbCoincidence += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentCircleEllipse(anArc, self.myEllipse) + + def test_arc_tangent_then_remove_coincidence(self): + """Test 10. Set tangency between ellipse and an arc, which have a coincident point, then remove this coincidence""" + anArc = self.mySketch.addArc(30, 10, 20, 10, 40, 10, False) + aCoincidence = self.mySketch.setCoincident( + anArc.endPoint(), self.myEllipse.result() + ) + self.myNbArcs += 1 + self.myNbCoincidence += 1 + self.myDOF += 4 + model.do() + + self.mySketch.setTangent(self.myEllipse.result(), anArc.results()[-1]) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.myDocument.removeFeature(aCoincidence.feature()) + self.myNbCoincidence -= 1 + self.myDOF += 1 + model.do() + + self.assertTangentCircleEllipse(anArc, self.myEllipse) + + def test_ellipse_tangent(self): + """Test 11. Set tangency between two ellipses""" + anEllipse = self.mySketch.addEllipse(10, 10, 20, -50, 20) + self.myNbEllipses += 1 + self.myDOF += 5 + model.do() + + self.mySketch.setTangent(self.myEllipse.result(), anEllipse.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentEllipses(anEllipse, self.myEllipse) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestConstraintTangentEllipticArc.py b/src/SketchPlugin/Test/TestConstraintTangentEllipticArc.py index 05860426a..7bc05625c 100644 --- a/src/SketchPlugin/Test/TestConstraintTangentEllipticArc.py +++ b/src/SketchPlugin/Test/TestConstraintTangentEllipticArc.py @@ -31,426 +31,476 @@ from SketchAPI import * __updated__ = "2019-10-04" -class TestTangentEllipticArc(unittest.TestCase): - def setUp(self): - center = GeomAPI_Pnt2d(30., 20.) - axisEnd = GeomAPI_Pnt2d(50., 30.) - startPoint = GeomAPI_Pnt2d(45, 40) - endPoint = GeomAPI_Pnt2d(5, 6.11485435) - - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - macroEllipticArc = self.mySketch.addEllipticArc(center, axisEnd, startPoint, endPoint, False) - model.do() - self.myEllipticArc = SketchAPI_EllipticArc(model.lastSubFeature(self.mySketch, "SketchEllipticArc")) - self.myCenter = macroEllipticArc.center() - self.myFocus1 = macroEllipticArc.focus1() - self.myFocus2 = macroEllipticArc.focus2() - self.myMajorAxis = macroEllipticArc.majorAxis() - self.myMajorStart = macroEllipticArc.majorAxisStart() - self.myMajorEnd = macroEllipticArc.majorAxisEnd() - self.myMinorAxis = macroEllipticArc.minorAxis() - self.myMinorStart = macroEllipticArc.minorAxisStart() - self.myMinorEnd = macroEllipticArc.minorAxisEnd() - - self.myDOF = 7 - self.myNbPoints = 7 - self.myNbLines = 2 - self.myNbArcs = 0 - self.myNbCircles = 0 - self.myNbEllipses = 0 - self.myNbEllipticArcs = 1 - self.myNbInternals = 11 - self.myNbCoincidence = 0 - self.myNbTangency = 0 - - def tearDown(self): - model.end() - self.checkDOF() - self.assertPoints(self.myCenter.coordinates(), self.myEllipticArc.center()) - self.assertPoints(self.myFocus1.coordinates(), self.myEllipticArc.firstFocus()) - self.assertPoints(self.myFocus2.coordinates(), self.myEllipticArc.secondFocus()) - self.assertPoints(self.myMajorStart.coordinates(), self.myEllipticArc.majorAxisNegative()) - self.assertPoints(self.myMajorEnd.coordinates(), self.myEllipticArc.majorAxisPositive()) - self.assertPoints(self.myMajorAxis.startPoint(), self.myEllipticArc.majorAxisNegative()) - self.assertPoints(self.myMajorAxis.endPoint(), self.myEllipticArc.majorAxisPositive()) - self.assertPoints(self.myMinorStart.coordinates(), self.myEllipticArc.minorAxisNegative()) - self.assertPoints(self.myMinorEnd.coordinates(), self.myEllipticArc.minorAxisPositive()) - self.assertPoints(self.myMinorAxis.startPoint(), self.myEllipticArc.minorAxisNegative()) - self.assertPoints(self.myMinorAxis.endPoint(), self.myEllipticArc.minorAxisPositive()) - model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) - model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) - model.testNbSubFeatures(self.mySketch, "SketchArc", self.myNbArcs) - model.testNbSubFeatures(self.mySketch, "SketchCircle", self.myNbCircles) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", self.myNbEllipses) - model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", self.myNbEllipticArcs) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidenceInternal", self.myNbInternals) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", self.myNbCoincidence) - model.testNbSubFeatures(self.mySketch, "SketchConstraintTangent", self.myNbTangency) - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def assertTangentLineEllipse(self, theLine, theEllipticArc): - aLine = GeomAPI_Lin2d(theLine.startPoint().pnt(), theLine.endPoint().pnt()) - projF1 = aLine.project(theEllipticArc.firstFocus().pnt()) - projF2 = aLine.project(theEllipticArc.secondFocus().pnt()) - - distF1P1 = model.distancePointPoint(theEllipticArc.firstFocus(), projF1) - distF2P2 = model.distancePointPoint(theEllipticArc.secondFocus(), projF2) - - tgPoint = GeomAPI_Pnt2d((projF1.x() * distF2P2 + projF2.x() * distF1P1) / (distF1P1 + distF2P2), (projF1.y() * distF2P2 + projF2.y() * distF1P1) / (distF1P1 + distF2P2)) - distF1T = model.distancePointPoint(theEllipticArc.firstFocus(), tgPoint) - distF2T = model.distancePointPoint(theEllipticArc.secondFocus(), tgPoint) - NB_DIGITS = 7 - math.floor(math.log10(theEllipticArc.majorRadius().value())) - self.assertAlmostEqual(distF1T + distF2T, 2 * theEllipticArc.majorRadius().value(), NB_DIGITS) - - def assertTangentCircleEllipse(self, theCircle, theEllipticArc): - axis = GeomAPI_Dir2d(theEllipticArc.firstFocus().x() - theEllipticArc.center().x(), theEllipticArc.firstFocus().y() - theEllipticArc.center().y()) - anEllipticArc = GeomAPI_Ellipse2d(theEllipticArc.center().pnt(), axis, theEllipticArc.majorRadius().value(), theEllipticArc.minorRadius().value()) - aCircle = GeomAPI_Circ2d(theCircle.center().pnt(), GeomAPI_Dir2d(1, 0), theCircle.radius().value()) - - pOnE = GeomAPI_Pnt2d(0, 0) - pOnC = GeomAPI_Pnt2d(0, 0) - anEllipticArc.distance(aCircle, pOnE, pOnC) - self.assertAlmostEqual(model.distancePointPoint(pOnE, theCircle.center()), theCircle.radius().value()) - - dist1 = model.distancePointPoint(pOnC, theEllipticArc.firstFocus()) - dist2 = model.distancePointPoint(pOnC, theEllipticArc.secondFocus()) - NB_DIGITS = 7 - math.floor(math.log10(theEllipticArc.majorRadius().value())) - self.assertAlmostEqual(dist1 + dist2, 2 * theEllipticArc.majorRadius().value(), NB_DIGITS) - - def assertTangentEllipses(self, theEllipticArc1, theEllipticArc2): - axis1 = GeomAPI_Dir2d(theEllipticArc1.firstFocus().x() - theEllipticArc1.center().x(), theEllipticArc1.firstFocus().y() - theEllipticArc1.center().y()) - anEllipticArc1 = GeomAPI_Ellipse2d(theEllipticArc1.center().pnt(), axis1, theEllipticArc1.majorRadius().value(), theEllipticArc1.minorRadius().value()) - axis2 = GeomAPI_Dir2d(theEllipticArc2.firstFocus().x() - theEllipticArc2.center().x(), theEllipticArc2.firstFocus().y() - theEllipticArc2.center().y()) - anEllipticArc2 = GeomAPI_Ellipse2d(theEllipticArc2.center().pnt(), axis2, theEllipticArc2.majorRadius().value(), theEllipticArc2.minorRadius().value()) - - p1 = GeomAPI_Pnt2d(0, 0) - p2 = GeomAPI_Pnt2d(0, 0) - anEllipticArc1.distance(anEllipticArc2, p1, p2) - - dist1 = model.distancePointPoint(p2, theEllipticArc1.firstFocus()) - dist2 = model.distancePointPoint(p2, theEllipticArc1.secondFocus()) - NB_DIGITS = 7 - math.floor(math.log10(theEllipticArc1.majorRadius().value())) - self.assertAlmostEqual(dist1 + dist2, 2 * theEllipticArc1.majorRadius().value()) - - dist1 = model.distancePointPoint(p1, theEllipticArc2.firstFocus()) - dist2 = model.distancePointPoint(p1, theEllipticArc2.secondFocus()) - NB_DIGITS = 7 - math.floor(math.log10(theEllipticArc2.majorRadius().value())) - self.assertAlmostEqual(dist1 + dist2, 2 * theEllipticArc2.majorRadius().value(), NB_DIGITS) - - def assertPoints(self, thePoint1, thePoint2): - self.assertAlmostEqual(thePoint1.x(), thePoint2.x(), 6) - self.assertAlmostEqual(thePoint1.y(), thePoint2.y(), 6) - - - def test_line_tangent(self): - """ Test 1. Set tangency between elliptic arc and a line - """ - aLine = self.mySketch.addLine(10, -10, 90, 40) - self.myNbLines += 1 - self.myDOF += 4 - model.do() - - self.mySketch.setTangent(self.myEllipticArc.result(), aLine.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentLineEllipse(aLine, self.myEllipticArc) - - - def test_line_coincident_then_tangent(self): - """ Test 2. Set tangency between elliptic arc and a line, if the extremity of the line is coincident with the elliptic arc - """ - aLine = self.mySketch.addLine(10, -10, 90, 40) - self.mySketch.setCoincident(aLine.endPoint(), self.myEllipticArc.result()) - self.myNbLines += 1 - self.myNbCoincidence += 1 - self.myDOF += 3 - model.do() - - self.mySketch.setTangent(self.myEllipticArc.result(), aLine.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentLineEllipse(aLine, self.myEllipticArc) - - - def test_line_tangent_then_coincident(self): - """ Test 3. Set tangency between elliptic arc and a line, after that apply coincidence of extremity of the line and the elliptic arc's curve - """ - aLine = self.mySketch.addLine(10, -10, 90, 40) - self.myNbLines += 1 - self.myDOF += 4 - model.do() - - self.mySketch.setTangent(aLine.result(), self.myEllipticArc.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.mySketch.setCoincident(aLine.startPoint(), self.myEllipticArc.result()) - self.myNbCoincidence += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentLineEllipse(aLine, self.myEllipticArc) - - - def test_line_tangent_then_remove_coincidence(self): - """ Test 4. Set tangency between elliptic arc and a line, which have a coincident point, then remove this coincidence - """ - aLine = self.mySketch.addLine(10, -10, 90, 40) - aCoincidence = self.mySketch.setCoincident(aLine.endPoint(), self.myEllipticArc.result()) - self.myNbLines += 1 - self.myNbCoincidence += 1 - self.myDOF += 3 - model.do() - - self.mySketch.setTangent(self.myEllipticArc.result(), aLine.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.myDocument.removeFeature(aCoincidence.feature()) - self.myNbCoincidence -= 1 - self.myDOF += 1 - model.do() - - self.assertTangentLineEllipse(aLine, self.myEllipticArc) - - - def test_line_coincident_point_then_tangent(self): - """ Test 5. Set tangency between elliptic arc and a line, if the extremity of the line is coincident with the start point of elliptic arc - """ - aLine = self.mySketch.addLine(10, -10, 90, 40) - self.mySketch.setCoincident(aLine.endPoint(), self.myEllipticArc.startPoint()) - self.myNbLines += 1 - self.myNbCoincidence += 1 - self.myDOF += 2 - model.do() - - self.mySketch.setTangent(self.myEllipticArc.result(), aLine.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentLineEllipse(aLine, self.myEllipticArc) - - - def test_line_tangent_then_coincident_point(self): - """ Test 6. Set tangency between elliptic arc and a line, after that apply coincidence of extremities of the line and the elliptic arc - """ - aLine = self.mySketch.addLine(10, -10, 90, 40) - self.myNbLines += 1 - self.myDOF += 4 - model.do() - - self.mySketch.setTangent(self.myEllipticArc.result(), aLine.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentLineEllipse(aLine, self.myEllipticArc) - - self.mySketch.setCoincident(aLine.startPoint(), self.myEllipticArc.startPoint()) - self.myNbCoincidence += 1 - self.myDOF -= 2 - model.do() - - self.assertTangentLineEllipse(aLine, self.myEllipticArc) - - - def test_line_tangent_then_remove_coincidence_on_extremity(self): - """ Test 7. Set tangency between elliptic arc and a line, which have a coincident boundary point, then remove this coincidence - """ - aLine = self.mySketch.addLine(10, -10, 90, 40) - aCoincidence = self.mySketch.setCoincident(aLine.endPoint(), self.myEllipticArc.endPoint()) - self.myNbLines += 1 - self.myNbCoincidence += 1 - self.myDOF += 2 - model.do() - - self.mySketch.setTangent(self.myEllipticArc.result(), aLine.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.myDocument.removeFeature(aCoincidence.feature()) - self.myNbCoincidence -= 1 - self.myDOF += 2 - model.do() - - self.assertTangentLineEllipse(aLine, self.myEllipticArc) - - - def test_circle_tangent(self): - """ Test 8. Set tangency between elliptic arc and a circle - """ - aCircle = self.mySketch.addCircle(30, 10, 20) - self.myNbCircles += 1 - self.myDOF += 3 - model.do() - - self.mySketch.setTangent(self.myEllipticArc.result(), aCircle.defaultResult()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentCircleEllipse(aCircle, self.myEllipticArc) - - - def test_circle_coincident_then_tangent(self): - """ Test 9. Set tangency between elliptic arc and a circle, if the circle is coincident with start point of elliptic arc's minor axis - """ - aCircle = self.mySketch.addCircle(30, 10, 20) - self.mySketch.setCoincident(self.myEllipticArc.startPoint(), aCircle.defaultResult()) - self.myNbCircles += 1 - self.myNbCoincidence += 1 - self.myDOF += 2 - model.do() - - self.mySketch.setTangent(self.myEllipticArc.result(), aCircle.defaultResult()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentCircleEllipse(aCircle, self.myEllipticArc) - self.assertAlmostEqual(model.distancePointPoint(aCircle.center(), self.myEllipticArc.startPoint()), aCircle.radius().value()) - - - def test_arc_tangent(self): - """ Test 10. Set tangency between elliptic arc and a circular arc - """ - anArc = self.mySketch.addArc(30, -10, 40, -10, 20, -10, False) - self.myNbArcs += 1 - self.myDOF += 5 - model.do() - - self.mySketch.setTangent(self.myEllipticArc.result(), anArc.results()[-1]) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentCircleEllipse(anArc, self.myEllipticArc) - - - def test_arc_coincident_then_tangent(self): - """ Test 11. Set tangency between elliptic arc and an arc, if the extremities of the arcs are coincident - """ - anArc = self.mySketch.addArc(30, -10, 40, -10, 20, -10, False) - self.mySketch.setCoincident(anArc.endPoint(), self.myEllipticArc.startPoint()) - self.myNbArcs += 1 - self.myNbCoincidence += 1 - self.myDOF += 3 - model.do() - - self.mySketch.setTangent(self.myEllipticArc.result(), anArc.results()[-1]) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentCircleEllipse(anArc, self.myEllipticArc) - - - def test_arc_tangent_then_coincident(self): - """ Test 12. Set tangency between elliptic arc and an arc, after that apply coincidence of extremities of the arcs - """ - anArc = self.mySketch.addArc(30, -10, 40, -10, 20, -10, False) - self.myNbArcs += 1 - self.myDOF += 5 - model.do() - - self.mySketch.setTangent(self.myEllipticArc.result(), anArc.results()[-1]) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.mySketch.setCoincident(anArc.startPoint(), self.myEllipticArc.startPoint()) - self.myNbCoincidence += 1 - self.myDOF -= 2 - model.do() - - self.assertTangentCircleEllipse(anArc, self.myEllipticArc) - - - def test_arc_tangent_then_remove_coincidence(self): - """ Test 13. Set tangency between elliptic arc and an arc, which have a coincident point, then remove this coincidence - """ - anArc = self.mySketch.addArc(30, -10, 40, -10, 20, -10, False) - aCoincidence = self.mySketch.setCoincident(anArc.endPoint(), self.myEllipticArc.endPoint()) - self.myNbArcs += 1 - self.myNbCoincidence += 1 - self.myDOF += 4 - model.do() - - self.mySketch.setTangent(self.myEllipticArc.result(), anArc.results()[-1]) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.myDocument.removeFeature(aCoincidence.feature()) - self.myNbCoincidence -= 1 - self.myDOF += 1 - model.do() - - self.assertTangentCircleEllipse(anArc, self.myEllipticArc) - - - def test_ellipse_tangent(self): - """ Test 14. Set tangency between ellipse and elliptic arc - """ - anEllipse = self.mySketch.addEllipse(-30, 10, -10, 0, 20) - self.myNbEllipses += 1 - self.myDOF += 5 - model.do() - - self.mySketch.setTangent(self.myEllipticArc.result(), anEllipse.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentEllipses(anEllipse, self.myEllipticArc) - - - def test_elliptic_arcs_tangent(self): - """ Test 15. Set tangency between two elliptic arcs - """ - anEllipticArc = self.mySketch.addEllipticArc(35, 20, 60, 30, 40, 40, 20, -0.4890968089561491, True) - self.myNbEllipticArcs += 1 - self.myDOF += 7 - model.do() - - self.mySketch.setTangent(self.myEllipticArc.result(), anEllipticArc.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentEllipses(anEllipticArc, self.myEllipticArc) - - - def test_elliptic_arcs_coincident_then_tangent(self): - """ Test 16. Set tangency between two elliptic arcs, if their extremities are coincident - """ - anEllipticArc = self.mySketch.addEllipticArc(35, 20, 60, 30, 40, 40, 20, -0.4890968089561491, True) - self.mySketch.setCoincident(anEllipticArc.startPoint(), self.myEllipticArc.startPoint()) - self.myNbEllipticArcs += 1 - self.myNbCoincidence += 1 - self.myDOF += 5 - model.do() - - self.mySketch.setTangent(self.myEllipticArc.result(), anEllipticArc.result()) - self.myNbTangency += 1 - self.myDOF -= 1 - model.do() - - self.assertTangentEllipses(anEllipticArc, self.myEllipticArc) +class TestTangentEllipticArc(unittest.TestCase): + def setUp(self): + center = GeomAPI_Pnt2d(30.0, 20.0) + axisEnd = GeomAPI_Pnt2d(50.0, 30.0) + startPoint = GeomAPI_Pnt2d(45, 40) + endPoint = GeomAPI_Pnt2d(5, 6.11485435) + + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + macroEllipticArc = self.mySketch.addEllipticArc( + center, axisEnd, startPoint, endPoint, False + ) + model.do() + self.myEllipticArc = SketchAPI_EllipticArc( + model.lastSubFeature(self.mySketch, "SketchEllipticArc") + ) + self.myCenter = macroEllipticArc.center() + self.myFocus1 = macroEllipticArc.focus1() + self.myFocus2 = macroEllipticArc.focus2() + self.myMajorAxis = macroEllipticArc.majorAxis() + self.myMajorStart = macroEllipticArc.majorAxisStart() + self.myMajorEnd = macroEllipticArc.majorAxisEnd() + self.myMinorAxis = macroEllipticArc.minorAxis() + self.myMinorStart = macroEllipticArc.minorAxisStart() + self.myMinorEnd = macroEllipticArc.minorAxisEnd() + + self.myDOF = 7 + self.myNbPoints = 7 + self.myNbLines = 2 + self.myNbArcs = 0 + self.myNbCircles = 0 + self.myNbEllipses = 0 + self.myNbEllipticArcs = 1 + self.myNbInternals = 11 + self.myNbCoincidence = 0 + self.myNbTangency = 0 + + def tearDown(self): + model.end() + self.checkDOF() + self.assertPoints(self.myCenter.coordinates(), self.myEllipticArc.center()) + self.assertPoints(self.myFocus1.coordinates(), self.myEllipticArc.firstFocus()) + self.assertPoints(self.myFocus2.coordinates(), self.myEllipticArc.secondFocus()) + self.assertPoints( + self.myMajorStart.coordinates(), self.myEllipticArc.majorAxisNegative() + ) + self.assertPoints( + self.myMajorEnd.coordinates(), self.myEllipticArc.majorAxisPositive() + ) + self.assertPoints( + self.myMajorAxis.startPoint(), self.myEllipticArc.majorAxisNegative() + ) + self.assertPoints( + self.myMajorAxis.endPoint(), self.myEllipticArc.majorAxisPositive() + ) + self.assertPoints( + self.myMinorStart.coordinates(), self.myEllipticArc.minorAxisNegative() + ) + self.assertPoints( + self.myMinorEnd.coordinates(), self.myEllipticArc.minorAxisPositive() + ) + self.assertPoints( + self.myMinorAxis.startPoint(), self.myEllipticArc.minorAxisNegative() + ) + self.assertPoints( + self.myMinorAxis.endPoint(), self.myEllipticArc.minorAxisPositive() + ) + model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) + model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) + model.testNbSubFeatures(self.mySketch, "SketchArc", self.myNbArcs) + model.testNbSubFeatures(self.mySketch, "SketchCircle", self.myNbCircles) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", self.myNbEllipses) + model.testNbSubFeatures( + self.mySketch, "SketchEllipticArc", self.myNbEllipticArcs + ) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintCoincidenceInternal", self.myNbInternals + ) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintCoincidence", self.myNbCoincidence + ) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintTangent", self.myNbTangency + ) + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def assertTangentLineEllipse(self, theLine, theEllipticArc): + aLine = GeomAPI_Lin2d(theLine.startPoint().pnt(), theLine.endPoint().pnt()) + projF1 = aLine.project(theEllipticArc.firstFocus().pnt()) + projF2 = aLine.project(theEllipticArc.secondFocus().pnt()) + + distF1P1 = model.distancePointPoint(theEllipticArc.firstFocus(), projF1) + distF2P2 = model.distancePointPoint(theEllipticArc.secondFocus(), projF2) + + tgPoint = GeomAPI_Pnt2d( + (projF1.x() * distF2P2 + projF2.x() * distF1P1) / (distF1P1 + distF2P2), + (projF1.y() * distF2P2 + projF2.y() * distF1P1) / (distF1P1 + distF2P2), + ) + distF1T = model.distancePointPoint(theEllipticArc.firstFocus(), tgPoint) + distF2T = model.distancePointPoint(theEllipticArc.secondFocus(), tgPoint) + NB_DIGITS = 7 - math.floor(math.log10(theEllipticArc.majorRadius().value())) + self.assertAlmostEqual( + distF1T + distF2T, 2 * theEllipticArc.majorRadius().value(), NB_DIGITS + ) + + def assertTangentCircleEllipse(self, theCircle, theEllipticArc): + axis = GeomAPI_Dir2d( + theEllipticArc.firstFocus().x() - theEllipticArc.center().x(), + theEllipticArc.firstFocus().y() - theEllipticArc.center().y(), + ) + anEllipticArc = GeomAPI_Ellipse2d( + theEllipticArc.center().pnt(), + axis, + theEllipticArc.majorRadius().value(), + theEllipticArc.minorRadius().value(), + ) + aCircle = GeomAPI_Circ2d( + theCircle.center().pnt(), GeomAPI_Dir2d(1, 0), theCircle.radius().value() + ) + + pOnE = GeomAPI_Pnt2d(0, 0) + pOnC = GeomAPI_Pnt2d(0, 0) + anEllipticArc.distance(aCircle, pOnE, pOnC) + self.assertAlmostEqual( + model.distancePointPoint(pOnE, theCircle.center()), + theCircle.radius().value(), + ) + + dist1 = model.distancePointPoint(pOnC, theEllipticArc.firstFocus()) + dist2 = model.distancePointPoint(pOnC, theEllipticArc.secondFocus()) + NB_DIGITS = 7 - math.floor(math.log10(theEllipticArc.majorRadius().value())) + self.assertAlmostEqual( + dist1 + dist2, 2 * theEllipticArc.majorRadius().value(), NB_DIGITS + ) + + def assertTangentEllipses(self, theEllipticArc1, theEllipticArc2): + axis1 = GeomAPI_Dir2d( + theEllipticArc1.firstFocus().x() - theEllipticArc1.center().x(), + theEllipticArc1.firstFocus().y() - theEllipticArc1.center().y(), + ) + anEllipticArc1 = GeomAPI_Ellipse2d( + theEllipticArc1.center().pnt(), + axis1, + theEllipticArc1.majorRadius().value(), + theEllipticArc1.minorRadius().value(), + ) + axis2 = GeomAPI_Dir2d( + theEllipticArc2.firstFocus().x() - theEllipticArc2.center().x(), + theEllipticArc2.firstFocus().y() - theEllipticArc2.center().y(), + ) + anEllipticArc2 = GeomAPI_Ellipse2d( + theEllipticArc2.center().pnt(), + axis2, + theEllipticArc2.majorRadius().value(), + theEllipticArc2.minorRadius().value(), + ) + + p1 = GeomAPI_Pnt2d(0, 0) + p2 = GeomAPI_Pnt2d(0, 0) + anEllipticArc1.distance(anEllipticArc2, p1, p2) + + dist1 = model.distancePointPoint(p2, theEllipticArc1.firstFocus()) + dist2 = model.distancePointPoint(p2, theEllipticArc1.secondFocus()) + NB_DIGITS = 7 - math.floor(math.log10(theEllipticArc1.majorRadius().value())) + self.assertAlmostEqual(dist1 + dist2, 2 * theEllipticArc1.majorRadius().value()) + + dist1 = model.distancePointPoint(p1, theEllipticArc2.firstFocus()) + dist2 = model.distancePointPoint(p1, theEllipticArc2.secondFocus()) + NB_DIGITS = 7 - math.floor(math.log10(theEllipticArc2.majorRadius().value())) + self.assertAlmostEqual( + dist1 + dist2, 2 * theEllipticArc2.majorRadius().value(), NB_DIGITS + ) + + def assertPoints(self, thePoint1, thePoint2): + self.assertAlmostEqual(thePoint1.x(), thePoint2.x(), 6) + self.assertAlmostEqual(thePoint1.y(), thePoint2.y(), 6) + + def test_line_tangent(self): + """Test 1. Set tangency between elliptic arc and a line""" + aLine = self.mySketch.addLine(10, -10, 90, 40) + self.myNbLines += 1 + self.myDOF += 4 + model.do() + + self.mySketch.setTangent(self.myEllipticArc.result(), aLine.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentLineEllipse(aLine, self.myEllipticArc) + + def test_line_coincident_then_tangent(self): + """Test 2. Set tangency between elliptic arc and a line, if the extremity of the line is coincident with the elliptic arc""" + aLine = self.mySketch.addLine(10, -10, 90, 40) + self.mySketch.setCoincident(aLine.endPoint(), self.myEllipticArc.result()) + self.myNbLines += 1 + self.myNbCoincidence += 1 + self.myDOF += 3 + model.do() + + self.mySketch.setTangent(self.myEllipticArc.result(), aLine.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentLineEllipse(aLine, self.myEllipticArc) + + def test_line_tangent_then_coincident(self): + """Test 3. Set tangency between elliptic arc and a line, after that apply coincidence of extremity of the line and the elliptic arc's curve""" + aLine = self.mySketch.addLine(10, -10, 90, 40) + self.myNbLines += 1 + self.myDOF += 4 + model.do() + + self.mySketch.setTangent(aLine.result(), self.myEllipticArc.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.mySketch.setCoincident(aLine.startPoint(), self.myEllipticArc.result()) + self.myNbCoincidence += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentLineEllipse(aLine, self.myEllipticArc) + + def test_line_tangent_then_remove_coincidence(self): + """Test 4. Set tangency between elliptic arc and a line, which have a coincident point, then remove this coincidence""" + aLine = self.mySketch.addLine(10, -10, 90, 40) + aCoincidence = self.mySketch.setCoincident( + aLine.endPoint(), self.myEllipticArc.result() + ) + self.myNbLines += 1 + self.myNbCoincidence += 1 + self.myDOF += 3 + model.do() + + self.mySketch.setTangent(self.myEllipticArc.result(), aLine.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.myDocument.removeFeature(aCoincidence.feature()) + self.myNbCoincidence -= 1 + self.myDOF += 1 + model.do() + + self.assertTangentLineEllipse(aLine, self.myEllipticArc) + + def test_line_coincident_point_then_tangent(self): + """Test 5. Set tangency between elliptic arc and a line, if the extremity of the line is coincident with the start point of elliptic arc""" + aLine = self.mySketch.addLine(10, -10, 90, 40) + self.mySketch.setCoincident(aLine.endPoint(), self.myEllipticArc.startPoint()) + self.myNbLines += 1 + self.myNbCoincidence += 1 + self.myDOF += 2 + model.do() + + self.mySketch.setTangent(self.myEllipticArc.result(), aLine.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentLineEllipse(aLine, self.myEllipticArc) + + def test_line_tangent_then_coincident_point(self): + """Test 6. Set tangency between elliptic arc and a line, after that apply coincidence of extremities of the line and the elliptic arc""" + aLine = self.mySketch.addLine(10, -10, 90, 40) + self.myNbLines += 1 + self.myDOF += 4 + model.do() + + self.mySketch.setTangent(self.myEllipticArc.result(), aLine.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentLineEllipse(aLine, self.myEllipticArc) + + self.mySketch.setCoincident(aLine.startPoint(), self.myEllipticArc.startPoint()) + self.myNbCoincidence += 1 + self.myDOF -= 2 + model.do() + + self.assertTangentLineEllipse(aLine, self.myEllipticArc) + + def test_line_tangent_then_remove_coincidence_on_extremity(self): + """Test 7. Set tangency between elliptic arc and a line, which have a coincident boundary point, then remove this coincidence""" + aLine = self.mySketch.addLine(10, -10, 90, 40) + aCoincidence = self.mySketch.setCoincident( + aLine.endPoint(), self.myEllipticArc.endPoint() + ) + self.myNbLines += 1 + self.myNbCoincidence += 1 + self.myDOF += 2 + model.do() + + self.mySketch.setTangent(self.myEllipticArc.result(), aLine.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.myDocument.removeFeature(aCoincidence.feature()) + self.myNbCoincidence -= 1 + self.myDOF += 2 + model.do() + + self.assertTangentLineEllipse(aLine, self.myEllipticArc) + + def test_circle_tangent(self): + """Test 8. Set tangency between elliptic arc and a circle""" + aCircle = self.mySketch.addCircle(30, 10, 20) + self.myNbCircles += 1 + self.myDOF += 3 + model.do() + + self.mySketch.setTangent(self.myEllipticArc.result(), aCircle.defaultResult()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentCircleEllipse(aCircle, self.myEllipticArc) + + def test_circle_coincident_then_tangent(self): + """Test 9. Set tangency between elliptic arc and a circle, if the circle is coincident with start point of elliptic arc's minor axis""" + aCircle = self.mySketch.addCircle(30, 10, 20) + self.mySketch.setCoincident( + self.myEllipticArc.startPoint(), aCircle.defaultResult() + ) + self.myNbCircles += 1 + self.myNbCoincidence += 1 + self.myDOF += 2 + model.do() + + self.mySketch.setTangent(self.myEllipticArc.result(), aCircle.defaultResult()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentCircleEllipse(aCircle, self.myEllipticArc) + self.assertAlmostEqual( + model.distancePointPoint(aCircle.center(), self.myEllipticArc.startPoint()), + aCircle.radius().value(), + ) + + def test_arc_tangent(self): + """Test 10. Set tangency between elliptic arc and a circular arc""" + anArc = self.mySketch.addArc(30, -10, 40, -10, 20, -10, False) + self.myNbArcs += 1 + self.myDOF += 5 + model.do() + + self.mySketch.setTangent(self.myEllipticArc.result(), anArc.results()[-1]) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentCircleEllipse(anArc, self.myEllipticArc) + + def test_arc_coincident_then_tangent(self): + """Test 11. Set tangency between elliptic arc and an arc, if the extremities of the arcs are coincident""" + anArc = self.mySketch.addArc(30, -10, 40, -10, 20, -10, False) + self.mySketch.setCoincident(anArc.endPoint(), self.myEllipticArc.startPoint()) + self.myNbArcs += 1 + self.myNbCoincidence += 1 + self.myDOF += 3 + model.do() + + self.mySketch.setTangent(self.myEllipticArc.result(), anArc.results()[-1]) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentCircleEllipse(anArc, self.myEllipticArc) + + def test_arc_tangent_then_coincident(self): + """Test 12. Set tangency between elliptic arc and an arc, after that apply coincidence of extremities of the arcs""" + anArc = self.mySketch.addArc(30, -10, 40, -10, 20, -10, False) + self.myNbArcs += 1 + self.myDOF += 5 + model.do() + + self.mySketch.setTangent(self.myEllipticArc.result(), anArc.results()[-1]) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.mySketch.setCoincident(anArc.startPoint(), self.myEllipticArc.startPoint()) + self.myNbCoincidence += 1 + self.myDOF -= 2 + model.do() + + self.assertTangentCircleEllipse(anArc, self.myEllipticArc) + + def test_arc_tangent_then_remove_coincidence(self): + """Test 13. Set tangency between elliptic arc and an arc, which have a coincident point, then remove this coincidence""" + anArc = self.mySketch.addArc(30, -10, 40, -10, 20, -10, False) + aCoincidence = self.mySketch.setCoincident( + anArc.endPoint(), self.myEllipticArc.endPoint() + ) + self.myNbArcs += 1 + self.myNbCoincidence += 1 + self.myDOF += 4 + model.do() + + self.mySketch.setTangent(self.myEllipticArc.result(), anArc.results()[-1]) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.myDocument.removeFeature(aCoincidence.feature()) + self.myNbCoincidence -= 1 + self.myDOF += 1 + model.do() + + self.assertTangentCircleEllipse(anArc, self.myEllipticArc) + + def test_ellipse_tangent(self): + """Test 14. Set tangency between ellipse and elliptic arc""" + anEllipse = self.mySketch.addEllipse(-30, 10, -10, 0, 20) + self.myNbEllipses += 1 + self.myDOF += 5 + model.do() + + self.mySketch.setTangent(self.myEllipticArc.result(), anEllipse.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentEllipses(anEllipse, self.myEllipticArc) + + def test_elliptic_arcs_tangent(self): + """Test 15. Set tangency between two elliptic arcs""" + anEllipticArc = self.mySketch.addEllipticArc( + 35, 20, 60, 30, 40, 40, 20, -0.4890968089561491, True + ) + self.myNbEllipticArcs += 1 + self.myDOF += 7 + model.do() + + self.mySketch.setTangent(self.myEllipticArc.result(), anEllipticArc.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentEllipses(anEllipticArc, self.myEllipticArc) + + def test_elliptic_arcs_coincident_then_tangent(self): + """Test 16. Set tangency between two elliptic arcs, if their extremities are coincident""" + anEllipticArc = self.mySketch.addEllipticArc( + 35, 20, 60, 30, 40, 40, 20, -0.4890968089561491, True + ) + self.mySketch.setCoincident( + anEllipticArc.startPoint(), self.myEllipticArc.startPoint() + ) + self.myNbEllipticArcs += 1 + self.myNbCoincidence += 1 + self.myDOF += 5 + model.do() + + self.mySketch.setTangent(self.myEllipticArc.result(), anEllipticArc.result()) + self.myNbTangency += 1 + self.myDOF -= 1 + model.do() + + self.assertTangentEllipses(anEllipticArc, self.myEllipticArc) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestConstraintVertical.py b/src/SketchPlugin/Test/TestConstraintVertical.py index 388d22711..54494a637 100644 --- a/src/SketchPlugin/Test/TestConstraintVertical.py +++ b/src/SketchPlugin/Test/TestConstraintVertical.py @@ -30,17 +30,17 @@ from GeomDataAPI import * from ModelAPI import * from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2015-03-16" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -51,53 +51,51 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create non-vertical line -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchLine = aSketchFeature.addFeature("SketchLine") aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) -aLineStartPoint.setValue(0., 15.) -aLineEndPoint.setValue(20., 30.) +aLineStartPoint.setValue(0.0, 15.0) +aLineEndPoint.setValue(20.0, 30.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 4) -#========================================================================= +assert model.dof(aSketchFeature) == 4 +# ========================================================================= # Assign vertical constraint for a line -#========================================================================= +# ========================================================================= aSession.startOperation() aVerticalConstraint = aSketchFeature.addFeature("SketchConstraintVertical") refattrA = aVerticalConstraint.refattr("ConstraintEntityA") aResult = modelAPI_ResultConstruction(aSketchLine.firstResult()) -assert (aResult is not None) +assert aResult is not None refattrA.setObject(aResult) aVerticalConstraint.execute() aSession.finishOperation() -assert(aLineStartPoint.x() == aLineEndPoint.x()) -assert (model.dof(aSketchFeature) == 3) -#========================================================================= +assert aLineStartPoint.x() == aLineEndPoint.x() +assert model.dof(aSketchFeature) == 3 +# ========================================================================= # Move one of boundary points of a line -#========================================================================= -deltaX = deltaY = 10. +# ========================================================================= +deltaX = deltaY = 10.0 aSession.startOperation() -aLineStartPoint.setValue(aLineStartPoint.x() + deltaX, - aLineStartPoint.y() + deltaY) +aLineStartPoint.setValue(aLineStartPoint.x() + deltaX, aLineStartPoint.y() + deltaY) aSession.finishOperation() -assert(aLineStartPoint.x() == aLineEndPoint.x()) -assert (model.dof(aSketchFeature) == 3) -#========================================================================= +assert aLineStartPoint.x() == aLineEndPoint.x() +assert model.dof(aSketchFeature) == 3 +# ========================================================================= # Move other boundary point of a line -#========================================================================= -deltaX = -3. -deltaY = -10. +# ========================================================================= +deltaX = -3.0 +deltaY = -10.0 aSession.startOperation() -aLineEndPoint.setValue(aLineEndPoint.x() + deltaX, - aLineEndPoint.y() + deltaY) +aLineEndPoint.setValue(aLineEndPoint.x() + deltaX, aLineEndPoint.y() + deltaY) aSession.finishOperation() -assert(aLineStartPoint.x() == aLineEndPoint.x()) -assert (model.dof(aSketchFeature) == 3) -#========================================================================= +assert aLineStartPoint.x() == aLineEndPoint.x() +assert model.dof(aSketchFeature) == 3 +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestCreateArcByCenterStartEnd.py b/src/SketchPlugin/Test/TestCreateArcByCenterStartEnd.py index 1245cbbb6..b0f46a976 100644 --- a/src/SketchPlugin/Test/TestCreateArcByCenterStartEnd.py +++ b/src/SketchPlugin/Test/TestCreateArcByCenterStartEnd.py @@ -29,9 +29,9 @@ data()->addAttribute(SketchPlugin_Arc::END_ID(), GeomDataAPI_Point2D::typeId()); """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from GeomDataAPI import * from ModelAPI import * from SketchAPI import SketchAPI_Sketch @@ -40,11 +40,12 @@ from salome.shaper import model __updated__ = "2017-03-28" -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -#========================================================================= +# ========================================================================= # Auxiliary functions -#========================================================================= +# ========================================================================= + def verifyLastArc(theSketch, theCenter, theStart, theEnd): """ @@ -53,9 +54,13 @@ def verifyLastArc(theSketch, theCenter, theStart, theEnd): aLastArc = model.lastSubFeature(theSketch, "SketchArc") model.assertArc(aLastArc, theCenter, theStart, theEnd) + def verifyPointOnLine(thePoint, theLine): aDistance = model.distancePointLine(thePoint, theLine) - assert aDistance < TOLERANCE, "Point is not on Line, distance: {0}".format(aDistance) + assert aDistance < TOLERANCE, "Point is not on Line, distance: {0}".format( + aDistance + ) + def verifyPointOnCircle(thePoint, theCircular): if theCircular.getKind() == "SketchArc": @@ -67,14 +72,17 @@ def verifyPointOnCircle(thePoint, theCircular): aRadius = theCircular.real("circle_radius").value() else: return - assert math.fabs(model.distancePointPoint(aCenterPoint, thePoint) - aRadius) < TOLERANCE + assert ( + math.fabs(model.distancePointPoint(aCenterPoint, thePoint) - aRadius) + < TOLERANCE + ) aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -87,34 +95,34 @@ norm.setValue(0, 0, 1) aSession.finishOperation() aSketch = SketchAPI_Sketch(aSketchFeature) -#========================================================================= +# ========================================================================= # Test 1. Create an arc by center, start and end points -#========================================================================= -aCenter = [10., 10.] -aStart = [0., 50.] -aEnd = [50., 0.] +# ========================================================================= +aCenter = [10.0, 10.0] +aStart = [0.0, 50.0] +aEnd = [50.0, 0.0] aSession.startOperation() aSketchArc = aSketchFeature.addFeature("SketchArc") -assert (aSketchArc.getKind() == "SketchArc") +assert aSketchArc.getKind() == "SketchArc" anArcCenter = geomDataAPI_Point2D(aSketchArc.attribute("center_point")) -assert (not anArcCenter.isInitialized()) +assert not anArcCenter.isInitialized() anArcCenter.setValue(aCenter[0], aCenter[1]) anArcStartPoint = geomDataAPI_Point2D(aSketchArc.attribute("start_point")) -assert (not anArcStartPoint.isInitialized()) +assert not anArcStartPoint.isInitialized() anArcStartPoint.setValue(aStart[0], aStart[1]) anArcEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("end_point")) -assert (not anArcEndPoint.isInitialized()) +assert not anArcEndPoint.isInitialized() anArcEndPoint.setValue(aEnd[0], aEnd[1]) aSession.finishOperation() verifyLastArc(aSketchFeature, aCenter, aStart, aEnd) # Move center -aCenter = [15., 20.] +aCenter = [15.0, 20.0] aSession.startOperation() anArcCenter.setValue(aCenter[0], aCenter[1]) aSession.finishOperation() verifyLastArc(aSketchFeature, [], [], []) # Move start point -deltaX, deltaY = 5., 2. +deltaX, deltaY = 5.0, 2.0 aStart = [anArcStartPoint.x() + deltaX, anArcStartPoint.y() + deltaY] aSession.startOperation() anArcStartPoint.setValue(aStart[0], aStart[1]) @@ -129,51 +137,51 @@ verifyLastArc(aSketchFeature, [], [], []) # Check that changing the radius does not affect arc aSession.startOperation() anArcRadius = aSketchArc.real("radius") -aPrevRadius = anArcRadius.value(); -anArcRadius.setValue(aPrevRadius + 10.) +aPrevRadius = anArcRadius.value() +anArcRadius.setValue(aPrevRadius + 10.0) aSession.finishOperation() -assert (math.fabs(anArcRadius.value() - aPrevRadius) < TOLERANCE) +assert math.fabs(anArcRadius.value() - aPrevRadius) < TOLERANCE verifyLastArc(aSketchFeature, [], [], []) # Check that changing the angle does not affect arc aSession.startOperation() anArcAngle = aSketchArc.real("angle") aPrevAngle = anArcAngle.value() -anArcAngle.setValue(aPrevAngle + 10.) +anArcAngle.setValue(aPrevAngle + 10.0) aSession.finishOperation() -assert (math.fabs(anArcAngle.value() - aPrevAngle) < TOLERANCE) +assert math.fabs(anArcAngle.value() - aPrevAngle) < TOLERANCE verifyLastArc(aSketchFeature, [], [], []) -#========================================================================= +# ========================================================================= # Test 2. Create an arc as a macro-feature by center, start and end points -#========================================================================= +# ========================================================================= aSession.startOperation() anArc = aSketchFeature.addFeature("SketchMacroArc") -assert (anArc.getKind() == "SketchMacroArc") +assert anArc.getKind() == "SketchMacroArc" anArcCenter = geomDataAPI_Point2D(anArc.attribute("center_point")) -assert (not anArcCenter.isInitialized()) +assert not anArcCenter.isInitialized() anArcStart = geomDataAPI_Point2D(anArc.attribute("start_point_1")) -assert (not anArcStart.isInitialized()) +assert not anArcStart.isInitialized() anArcEnd = geomDataAPI_Point2D(anArc.attribute("end_point_1")) -assert (not anArcEnd.isInitialized()) +assert not anArcEnd.isInitialized() anArcType = anArc.string("arc_type") -assert (not anArcType.isInitialized()) +assert not anArcType.isInitialized() anArcType.setValue("by_center_and_points") anArcCenter.setValue(aCenter[0], aCenter[1]) anArcStart.setValue(aStart[0], aStart[1]) anArcEnd.setValue(aEnd[0], aEnd[1]) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 2) +assert aSketchFeature.numberOfSubs() == 2 verifyLastArc(aSketchFeature, [], [], []) -#========================================================================= +# ========================================================================= # Test 3. Create an arc by center and two points coincident to other points -#========================================================================= +# ========================================================================= # get previous arc aPrevArc = model.lastSubFeature(aSketchFeature, "SketchArc") aPrevArcStart = geomDataAPI_Point2D(aPrevArc.attribute("start_point")) aPrevArcEnd = geomDataAPI_Point2D(aPrevArc.attribute("end_point")) # create additional point -aPointCoordinates = [0., 0.] +aPointCoordinates = [0.0, 0.0] aSession.startOperation() aPoint = aSketchFeature.addFeature("SketchPoint") aPointCoord = geomDataAPI_Point2D(aPoint.attribute("PointCoordinates")) @@ -181,8 +189,8 @@ aPointCoord.setValue(aPointCoordinates[0], aPointCoordinates[1]) aPoint.selection("External").selectSubShape("VERTEX", "Origin") aSession.finishOperation() # create additional line -aLineStart = [20., -5.] -aLineEnd = [20., 20] +aLineStart = [20.0, -5.0] +aLineEnd = [20.0, 20] aSession.startOperation() aLine = aSketchFeature.addFeature("SketchLine") aLineStartPoint = geomDataAPI_Point2D(aLine.attribute("StartPoint")) @@ -195,15 +203,15 @@ aSession.startOperation() anArc = aSketchFeature.addFeature("SketchMacroArc") aCenter = geomDataAPI_Point2D(anArc.attribute("center_point")) aCenterRef = anArc.refattr("center_point_ref") -assert (not aCenterRef.isInitialized()) +assert not aCenterRef.isInitialized() aStart = geomDataAPI_Point2D(anArc.attribute("start_point_1")) aStartRef = anArc.refattr("start_point_ref") -assert (not aStartRef.isInitialized()) +assert not aStartRef.isInitialized() aEnd = geomDataAPI_Point2D(anArc.attribute("end_point_1")) aEndRef = anArc.refattr("end_point_ref") -assert (not aEndRef.isInitialized()) +assert not aEndRef.isInitialized() anArcType = anArc.string("arc_type") -assert (not anArcType.isInitialized()) +assert not anArcType.isInitialized() # initialize attributes anArcType.setValue("by_center_and_points") aCenterRef.setAttr(aPrevArcStart) @@ -215,20 +223,26 @@ aEnd.setValue(aPrevArcEnd.pnt()) aSession.finishOperation() # check the MacroArc is not valid (selection of end point is not possible) aLastFeature = aSketchFeature.subFeature(aSketchFeature.numberOfSubs() - 1) -assert aLastFeature.getKind() == "SketchMacroArc", "ERROR: SketchMacroArc has NOT expected to be valid" +assert ( + aLastFeature.getKind() == "SketchMacroArc" +), "ERROR: SketchMacroArc has NOT expected to be valid" # change end point reference to a line aSession.startOperation() aEndRef.setObject(aLine.lastResult()) aEnd.setValue(aLineStart[0], aLineStart[1]) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 8), "Number of subs {}".format(aSketchFeature.numberOfSubs()) +assert aSketchFeature.numberOfSubs() == 8, "Number of subs {}".format( + aSketchFeature.numberOfSubs() +) model.assertPoint(aPointCoord, aPointCoordinates) -verifyLastArc(aSketchFeature, [aPrevArcStart.x(), aPrevArcStart.y()], aPointCoordinates, []) +verifyLastArc( + aSketchFeature, [aPrevArcStart.x(), aPrevArcStart.y()], aPointCoordinates, [] +) model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 3) -#========================================================================= +# ========================================================================= # Test 4. Create an arc by center and points coincident to other features -#========================================================================= +# ========================================================================= # get previous arc aPrevArc = model.lastSubFeature(aSketchFeature, "SketchArc") aPrevArcCenter = geomDataAPI_Point2D(aPrevArc.attribute("center_point")) @@ -256,7 +270,9 @@ aStart.setValue(aPrevArcStart.pnt()) aEndRef.setObject(aLine.lastResult()) aEnd.setValue(aLineEndPoint.pnt()) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 12), "Number of subs {}".format(aSketchFeature.numberOfSubs()) +assert aSketchFeature.numberOfSubs() == 12, "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) @@ -271,9 +287,9 @@ 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") @@ -293,7 +309,9 @@ aStart.setValue(aLineEndPoint.pnt()) aEndRef.setObject(aPrevArc.lastResult()) aEnd.setValue(aPrevArcStart.pnt()) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 16), "Number of subs {}".format(aSketchFeature.numberOfSubs()) +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) @@ -308,9 +326,9 @@ 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")) @@ -333,11 +351,18 @@ anArcType = anArc.string("arc_type") 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]) +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]) +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()) +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")) @@ -347,9 +372,9 @@ 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()] @@ -367,11 +392,16 @@ anArcType = anArc.string("arc_type") 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]) +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()) +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")) @@ -381,8 +411,8 @@ verifyPointOnCircle(aEnd, aPrevArc) model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 11) model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 0) -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestCreateArcByTangentEdge.py b/src/SketchPlugin/Test/TestCreateArcByTangentEdge.py index 2663540d5..4fd492b9f 100644 --- a/src/SketchPlugin/Test/TestCreateArcByTangentEdge.py +++ b/src/SketchPlugin/Test/TestCreateArcByTangentEdge.py @@ -29,9 +29,9 @@ data()->addAttribute(SketchPlugin_Arc::END_ID(), GeomDataAPI_Point2D::typeId()); """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from GeomDataAPI import * from ModelAPI import * from SketchAPI import SketchAPI_Sketch @@ -40,11 +40,12 @@ from salome.shaper import model __updated__ = "2017-04-06" -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -#========================================================================= +# ========================================================================= # Auxiliary functions -#========================================================================= +# ========================================================================= + def verifyLastArc(theSketch, theCenter, theStart, theEnd): """ @@ -53,6 +54,7 @@ def verifyLastArc(theSketch, theCenter, theStart, theEnd): aLastArc = model.lastSubFeature(theSketch, "SketchArc") model.assertArc(aLastArc, theCenter, theStart, theEnd) + def verifyTangent(theFeature1, theFeature2): anArcs = [] aLines = [] @@ -67,39 +69,46 @@ def verifyTangent(theFeature1, theFeature2): elif len(anArcs) == 1 and len(aLines) == 1: verifyArcLineTangent(anArcs[0], aLines[0]) + def verifyArcArcTangent(theArc1, theArc2): aCenter1 = geomDataAPI_Point2D(theArc1.attribute("center_point")) - aStart1 = geomDataAPI_Point2D(theArc1.attribute("start_point")) + aStart1 = geomDataAPI_Point2D(theArc1.attribute("start_point")) aRadius1 = model.distancePointPoint(aStart1, aCenter1) aCenter2 = geomDataAPI_Point2D(theArc2.attribute("center_point")) - aStart2 = geomDataAPI_Point2D(theArc2.attribute("start_point")) + aStart2 = geomDataAPI_Point2D(theArc2.attribute("start_point")) aRadius2 = model.distancePointPoint(aStart2, aCenter2) aDistCC = model.distancePointPoint(aCenter1, aCenter2) aRSum = aRadius1 + aRadius2 aRDiff = math.fabs(aRadius1 - aRadius2) - assert math.fabs(aRSum - aDistCC) < TOLERANCE or math.fabs(aRDiff - aDistCC) < TOLERANCE, "Arcs do not tangent" + assert ( + math.fabs(aRSum - aDistCC) < TOLERANCE + or math.fabs(aRDiff - aDistCC) < TOLERANCE + ), "Arcs do not tangent" + def verifyArcLineTangent(theArc, theLine): aCenter = geomDataAPI_Point2D(theArc.attribute("center_point")) - aStart = geomDataAPI_Point2D(theArc.attribute("start_point")) + aStart = geomDataAPI_Point2D(theArc.attribute("start_point")) aRadius = model.distancePointPoint(aStart, aCenter) aDistCL = model.distancePointLine(aCenter, theLine) assert math.fabs(aDistCL - aRadius) < TOLERANCE, "Arc and line do not tangent" + def verifyPointOnLine(thePoint, theLine): aDistance = model.distancePointLine(thePoint, theLine) - assert aDistance < TOLERANCE, "Point is not on Line, distance: {0}".format(aDistance) - + assert aDistance < TOLERANCE, "Point is not on Line, distance: {0}".format( + aDistance + ) aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -113,8 +122,8 @@ aSession.finishOperation() aSketch = SketchAPI_Sketch(aSketchFeature) # auxiliary line -aLineStartPnt = [0., 0.] -aLineEndPnt = [50., 0.] +aLineStartPnt = [0.0, 0.0] +aLineEndPnt = [50.0, 0.0] aSession.startOperation() aSketchLine = aSketchFeature.addFeature("SketchLine") aLineStart = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) @@ -123,19 +132,19 @@ aLineStart.setValue(aLineStartPnt[0], aLineStartPnt[1]) aLineEnd.setValue(aLineEndPnt[0], aLineEndPnt[1]) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Test 1. Create an arc, tangent to the line -#========================================================================= -anArcEndPnt = [80., 20.] +# ========================================================================= +anArcEndPnt = [80.0, 20.0] aSession.startOperation() anArc = aSketchFeature.addFeature("SketchMacroArc") -assert (anArc.getKind() == "SketchMacroArc") +assert anArc.getKind() == "SketchMacroArc" anArcTgPnt = anArc.refattr("tangent_point") -assert (not anArcTgPnt.isInitialized()) +assert not anArcTgPnt.isInitialized() anArcEnd = geomDataAPI_Point2D(anArc.attribute("end_point_3")) -assert (not anArcEnd.isInitialized()) +assert not anArcEnd.isInitialized() anArcType = anArc.string("arc_type") -assert (not anArcType.isInitialized()) +assert not anArcType.isInitialized() # initialize attributes anArcType.setValue("by_tangent_edge") anArcTgPnt.setAttr(aLineEnd) @@ -147,12 +156,12 @@ verifyTangent(aLastArc, aSketchLine) model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 1) model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 1) -#========================================================================= +# ========================================================================= # Test 2. Create an arc, tangent to the previous arc -#========================================================================= +# ========================================================================= aPrevArc = aLastArc aPrevArcEnd = geomDataAPI_Point2D(aPrevArc.attribute("end_point")) -anArcEndPnt = [50., 100.] +anArcEndPnt = [50.0, 100.0] aSession.startOperation() anArc = aSketchFeature.addFeature("SketchMacroArc") anArcTgPnt = anArc.refattr("tangent_point") @@ -169,9 +178,9 @@ verifyTangent(aLastArc, aPrevArc) model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 2) model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 2) -#========================================================================= +# ========================================================================= # Test 3. Create an arc, tangent to the previous arc with end point on the line -#========================================================================= +# ========================================================================= aPrevArc = aLastArc aPrevArcEnd = geomDataAPI_Point2D(aPrevArc.attribute("end_point")) aSession.startOperation() @@ -194,8 +203,8 @@ verifyPointOnLine(aLastArcEnd, aSketchLine) model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 4) model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 3) -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestCreateArcByThreePoints.py b/src/SketchPlugin/Test/TestCreateArcByThreePoints.py index 0eaff9beb..886485872 100644 --- a/src/SketchPlugin/Test/TestCreateArcByThreePoints.py +++ b/src/SketchPlugin/Test/TestCreateArcByThreePoints.py @@ -23,9 +23,9 @@ Test creation methods of arc built by three points """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from GeomDataAPI import * from GeomAPI import * from ModelAPI import * @@ -36,10 +36,11 @@ import math __updated__ = "2017-03-22" -#========================================================================= +# ========================================================================= # Auxiliary functions -#========================================================================= -TOLERANCE = 1.e-7 +# ========================================================================= +TOLERANCE = 1.0e-7 + def verifyLastArc(theSketch, theX, theY, theR): """ @@ -49,13 +50,19 @@ def verifyLastArc(theSketch, theX, theY, theR): aCenter = geomDataAPI_Point2D(aLastArc.attribute("center_point")) model.assertPoint(aCenter, [theX, theY]) aRadius = aLastArc.real("radius") - assert aRadius.value() == theR, "Wrong radius {0}, expected {1}".format(aRadius.value(), theR) + assert aRadius.value() == theR, "Wrong radius {0}, expected {1}".format( + aRadius.value(), theR + ) + def verifyPointOnArc(thePoint, theArc): aCenter = geomDataAPI_Point2D(theArc.attribute("center_point")) aDistCP = model.distancePointPoint(aCenter, thePoint) aRadius = theArc.real("radius").value() - assert math.fabs(aDistCP - aRadius) < TOLERANCE, "Point is not on arc, distance: {0}, radius of arc: {1}".format(aDistCP, aRadius) + assert ( + math.fabs(aDistCP - aRadius) < TOLERANCE + ), "Point is not on arc, distance: {0}, radius of arc: {1}".format(aDistCP, aRadius) + def verifyTangentCircleArc(theCircle, theArc): aCircleCenter = geomDataAPI_Point2D(theCircle.attribute("circle_center")) @@ -66,10 +73,15 @@ def verifyTangentCircleArc(theCircle, theArc): anArcRadius = model.distancePointPoint(anArcCenter, anArcStart) verifyTangentCircular(aDistCC, aCircleRadius, anArcRadius) + def verifyTangentCircular(theDistBetweenCenters, theRadius1, theRadius2): aRSum = theRadius1 + theRadius2 aRDiff = math.fabs(theRadius1 - theRadius2) - assert math.fabs(aRSum - theDistBetweenCenters) < TOLERANCE or math.fabs(aRDiff - theDistBetweenCenters) < TOLERANCE, "Two circulars are not tangent" + assert ( + math.fabs(aRSum - theDistBetweenCenters) < TOLERANCE + or math.fabs(aRDiff - theDistBetweenCenters) < TOLERANCE + ), "Two circulars are not tangent" + def verifyTangentArcLine(theArc, theLine): aCenter = geomDataAPI_Point2D(theArc.attribute("center_point")) @@ -78,15 +90,15 @@ def verifyTangentArcLine(theArc, theLine): assert math.fabs(aDistCL - aRadius) < TOLERANCE, "Circle and line are not tangent" -#========================================================================= +# ========================================================================= # Start of test -#========================================================================= +# ========================================================================= aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -99,42 +111,42 @@ norm.setValue(0, 0, 1) aSession.finishOperation() aSketch = SketchAPI_Sketch(aSketchFeature) -#========================================================================= +# ========================================================================= # Test 1. Create an arc by three points -#========================================================================= -expectedCenter = [0., 0.] -expectedRadius = 10. +# ========================================================================= +expectedCenter = [0.0, 0.0] +expectedRadius = 10.0 aSession.startOperation() anArc = aSketchFeature.addFeature("SketchMacroArc") -assert (anArc.getKind() == "SketchMacroArc") +assert anArc.getKind() == "SketchMacroArc" anArcPnt1 = geomDataAPI_Point2D(anArc.attribute("start_point_2")) anArcPnt2 = geomDataAPI_Point2D(anArc.attribute("end_point_2")) anArcPnt3 = geomDataAPI_Point2D(anArc.attribute("passed_point")) -assert (not anArcPnt1.isInitialized()) -assert (not anArcPnt2.isInitialized()) -assert (not anArcPnt3.isInitialized()) +assert not anArcPnt1.isInitialized() +assert not anArcPnt2.isInitialized() +assert not anArcPnt3.isInitialized() anArcType = anArc.string("arc_type") -assert (not anArcType.isInitialized()) +assert not anArcType.isInitialized() anArcType.setValue("by_three_points") anArcPnt1.setValue(expectedCenter[0] - expectedRadius, expectedCenter[1]) anArcPnt2.setValue(expectedCenter[0] + expectedRadius, expectedCenter[1]) anArcPnt3.setValue(expectedCenter[0], expectedCenter[1] + expectedRadius) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 1) +assert aSketchFeature.numberOfSubs() == 1 verifyLastArc(aSketchFeature, expectedCenter[0], expectedCenter[1], expectedRadius) -#========================================================================= +# ========================================================================= # Test 2. Create an arc by three points coincident to other points -#========================================================================= +# ========================================================================= # get previous arc aPrevArc = model.lastSubFeature(aSketchFeature, "SketchArc") aPrevCenter = geomDataAPI_Point2D(aPrevArc.attribute("center_point")) aPrevCenterXY = [aPrevCenter.x(), aPrevCenter.y()] aPrevArcRadius = aPrevArc.real("radius").value() # create additional point and line -aPointCoodinates = [5., 20.] -aLineStart = [10., 0.] -aLineEnd = [10., 50.] +aPointCoodinates = [5.0, 20.0] +aLineStart = [10.0, 0.0] +aLineEnd = [10.0, 50.0] aSession.startOperation() aPoint = aSketchFeature.addFeature("SketchPoint") aPointCoord = geomDataAPI_Point2D(aPoint.attribute("PointCoordinates")) @@ -164,7 +176,7 @@ anArcPnt2.setValue(aPointCoord.pnt()) anArcPnt3Ref.setAttr(aStartPnt) anArcPnt3.setValue(aLineStart[0], aLineStart[1]) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 7) +assert aSketchFeature.numberOfSubs() == 7 # check the points do not change their positions model.assertPoint(aPrevCenter, aPrevCenterXY) model.assertPoint(aPointCoord, aPointCoodinates) @@ -177,9 +189,9 @@ verifyPointOnArc(aStartPnt, anArc) model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 3) model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 0) -#========================================================================= +# ========================================================================= # Test 3. Create an arc by three points an tangent with line -#========================================================================= +# ========================================================================= # create new arc aSession.startOperation() anArc = aSketchFeature.addFeature("SketchMacroArc") @@ -195,7 +207,7 @@ anArcPnt2.setValue(20, 40) anArcPnt3Ref.setObject(aLine.lastResult()) anArcPnt3.setValue(20, 25) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 9) +assert aSketchFeature.numberOfSubs() == 9 # check the points do not change their positions model.assertPoint(aPrevCenter, aPrevCenterXY) model.assertPoint(aPointCoord, aPointCoodinates) @@ -204,11 +216,11 @@ model.assertPoint(aStartPnt, aLineStart) model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 3) model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 1) -#========================================================================= +# ========================================================================= # Test 4. Create a arc by three points: # a. first two points are coincident to extremities of the line # b. check that this line is not selectable by third point -#========================================================================= +# ========================================================================= aSession.startOperation() anArc = aSketchFeature.addFeature("SketchMacroArc") anArcPnt1 = geomDataAPI_Point2D(anArc.attribute("start_point_2")) @@ -228,16 +240,18 @@ anArcPnt3Ref.setObject(aLine.lastResult()) anArcPnt3.setValue(aLineEnd[0], aLineEnd[1]) aSession.finishOperation() aLastFeature = aSketchFeature.subFeature(aSketchFeature.numberOfSubs() - 1) -assert aLastFeature.getKind() == "SketchMacroArc", "ERROR: SketchMacroArc has NOT expected to be valid" +assert ( + aLastFeature.getKind() == "SketchMacroArc" +), "ERROR: SketchMacroArc has NOT expected to be valid" aDocument.removeFeature(anArc) -assert (aSketchFeature.numberOfSubs() == 9) +assert aSketchFeature.numberOfSubs() == 9 -#========================================================================= +# ========================================================================= # Test 5. Create a arc by three points: # a. first two points are placed on both sides from line # b. check that this line is not selectable by third point -#========================================================================= -aDistanceFromLine = 20. +# ========================================================================= +aDistanceFromLine = 20.0 aSession.startOperation() anArc = aSketchFeature.addFeature("SketchMacroArc") anArcPnt1 = geomDataAPI_Point2D(anArc.attribute("start_point_2")) @@ -255,15 +269,17 @@ anArcPnt3Ref.setObject(aLine.lastResult()) anArcPnt3.setValue(aLineEnd[0], aLineEnd[1]) aSession.finishOperation() aLastFeature = aSketchFeature.subFeature(aSketchFeature.numberOfSubs() - 1) -assert aLastFeature.getKind() == "SketchMacroArc", "ERROR: SketchMacroArc has NOT expected to be valid" +assert ( + aLastFeature.getKind() == "SketchMacroArc" +), "ERROR: SketchMacroArc has NOT expected to be valid" aDocument.removeFeature(anArc) -assert (aSketchFeature.numberOfSubs() == 9) +assert aSketchFeature.numberOfSubs() == 9 -#========================================================================= +# ========================================================================= # Test 6. Create an arc by three points: # a. check that one point IS NOT selectable as first and second points simultaneously # b. check that one segment IS selectable by first and second points -#========================================================================= +# ========================================================================= aSession.startOperation() anArc = aSketchFeature.addFeature("SketchMacroArc") anArcPnt1 = geomDataAPI_Point2D(anArc.attribute("start_point_2")) @@ -279,11 +295,13 @@ anArcPnt1Ref.setAttr(aStartPnt) anArcPnt1.setValue(aStartPnt.pnt()) anArcPnt2Ref.setAttr(aStartPnt) anArcPnt2.setValue(aStartPnt.pnt()) -anArcPnt3.setValue(0., 0.) +anArcPnt3.setValue(0.0, 0.0) aSession.finishOperation() # check the macro arc is not valid aLastFeature = aSketchFeature.subFeature(aSketchFeature.numberOfSubs() - 1) -assert aLastFeature.getKind() == "SketchMacroArc", "ERROR: SketchMacroArc has NOT expected to be valid" +assert ( + aLastFeature.getKind() == "SketchMacroArc" +), "ERROR: SketchMacroArc has NOT expected to be valid" # reselect first points aSession.startOperation() anArcPnt1Ref.setObject(aLine.lastResult()) @@ -293,8 +311,10 @@ anArcPnt2.setValue(aEndPnt.pnt()) aSession.finishOperation() # check the macro arc is valid aLastFeature = aSketchFeature.subFeature(aSketchFeature.numberOfSubs() - 1) -assert aLastFeature.getKind() != "SketchMacroArc", "ERROR: SketchMacroArc is expected to be valid" -assert (aSketchFeature.numberOfSubs() == 12) +assert ( + aLastFeature.getKind() != "SketchMacroArc" +), "ERROR: SketchMacroArc is expected to be valid" +assert aSketchFeature.numberOfSubs() == 12 # check sub-features model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 5) model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 1) @@ -302,9 +322,10 @@ model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 1) model.do() model.end() -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestCreateArcByTransversalLine.py b/src/SketchPlugin/Test/TestCreateArcByTransversalLine.py index 526e29481..3d8b0b8cb 100644 --- a/src/SketchPlugin/Test/TestCreateArcByTransversalLine.py +++ b/src/SketchPlugin/Test/TestCreateArcByTransversalLine.py @@ -18,9 +18,9 @@ # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from GeomDataAPI import * from ModelAPI import * from SketchAPI import SketchAPI_Sketch @@ -29,11 +29,12 @@ from salome.shaper import model __updated__ = "2019-08-16" -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -#========================================================================= +# ========================================================================= # Auxiliary functions -#========================================================================= +# ========================================================================= + def verifyLastArc(theSketch, theCenter, theStart, theEnd): """ @@ -42,26 +43,29 @@ def verifyLastArc(theSketch, theCenter, theStart, theEnd): aLastArc = model.lastSubFeature(theSketch, "SketchArc") model.assertArc(aLastArc, theCenter, theStart, theEnd) + def verifyArcLineTransversal(theArc, theLine): aCenter = geomDataAPI_Point2D(theArc.attribute("center_point")) aDistCL = model.distancePointLine(aCenter, theLine) assert aDistCL < TOLERANCE, "Arc and line are not orthogonal" + def verifyPointOnArc(thePoint, theArc): aCenter = geomDataAPI_Point2D(theArc.attribute("center_point")) aStart = geomDataAPI_Point2D(theArc.attribute("start_point")) aRadius = model.distancePointPoint(aStart, aCenter) aDistPP = model.distancePointPoint(aCenter, thePoint) - assert math.fabs(aRadius - aDistPP) < TOLERANCE, "Point is not on Circle, distance: {0}".format(aDistPP) - + assert ( + math.fabs(aRadius - aDistPP) < TOLERANCE + ), "Point is not on Circle, distance: {0}".format(aDistPP) aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -75,8 +79,8 @@ aSession.finishOperation() aSketch = SketchAPI_Sketch(aSketchFeature) # auxiliary line -aLineStartPnt = [0., 0.] -aLineEndPnt = [50., 0.] +aLineStartPnt = [0.0, 0.0] +aLineEndPnt = [50.0, 0.0] aSession.startOperation() aSketchLine = aSketchFeature.addFeature("SketchLine") aLineStart = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) @@ -85,19 +89,19 @@ aLineStart.setValue(aLineStartPnt[0], aLineStartPnt[1]) aLineEnd.setValue(aLineEndPnt[0], aLineEndPnt[1]) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Test 1. Create an arc, orthogonal to the line -#========================================================================= -anArcEndPnt = [80., 20.] +# ========================================================================= +anArcEndPnt = [80.0, 20.0] aSession.startOperation() anArc = aSketchFeature.addFeature("SketchMacroArc") -assert (anArc.getKind() == "SketchMacroArc") +assert anArc.getKind() == "SketchMacroArc" anArcTgPnt = anArc.refattr("transversal_point") -assert (not anArcTgPnt.isInitialized()) +assert not anArcTgPnt.isInitialized() anArcEnd = geomDataAPI_Point2D(anArc.attribute("end_point_4")) -assert (not anArcEnd.isInitialized()) +assert not anArcEnd.isInitialized() anArcType = anArc.string("arc_type") -assert (not anArcType.isInitialized()) +assert not anArcType.isInitialized() # initialize attributes anArcType.setValue("by_transversal_line") anArcTgPnt.setAttr(aLineEnd) @@ -109,12 +113,12 @@ verifyArcLineTransversal(aLastArc, aSketchLine) model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 1) model.testNbSubFeatures(aSketch, "SketchConstraintPerpendicular", 1) -#========================================================================= +# ========================================================================= # Test 2. Create an arc, orthogonal to the previous arc (expect an error) -#========================================================================= +# ========================================================================= aPrevArc = aLastArc aPrevArcEnd = geomDataAPI_Point2D(aPrevArc.attribute("end_point")) -anArcEndPnt = [50., 100.] +anArcEndPnt = [50.0, 100.0] aSession.startOperation() anArc = aSketchFeature.addFeature("SketchMacroArc") anArcTgPnt = anArc.refattr("transversal_point") @@ -125,15 +129,15 @@ anArcType.setValue("by_transversal_line") anArcTgPnt.setAttr(aPrevArcEnd) anArcEnd.setValue(anArcEndPnt[0], anArcEndPnt[1]) aSession.finishOperation() -assert(anArc.error() != "") +assert anArc.error() != "" # remove failed feature aSession.startOperation() aDocument.removeFeature(anArc) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Test 3. Create an arc, orthogonal to the line with end point on the arc -#========================================================================= +# ========================================================================= aPrevArc = model.lastSubFeature(aSketchFeature, "SketchArc") aPrevArcEnd = geomDataAPI_Point2D(aPrevArc.attribute("end_point")) aSession.startOperation() @@ -156,8 +160,8 @@ verifyPointOnArc(aLastArcEnd, aPrevArc) model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 3) model.testNbSubFeatures(aSketch, "SketchConstraintPerpendicular", 2) -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestCreateArcChangeType.py b/src/SketchPlugin/Test/TestCreateArcChangeType.py index 76762bd4f..f6446be7c 100644 --- a/src/SketchPlugin/Test/TestCreateArcChangeType.py +++ b/src/SketchPlugin/Test/TestCreateArcChangeType.py @@ -23,9 +23,9 @@ Test attributes reset when changing creation method of an arc on-the-fly """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from GeomDataAPI import * from GeomAPI import * from ModelAPI import * @@ -40,47 +40,51 @@ __updated__ = "2017-04-06" ## Auxiliary functions ##========================================================================= + def assertNotInitializedByCenterAndPassed(theMacroArc): # check points aCenterPoint = geomDataAPI_Point2D(theMacroArc.attribute("center_point")) aStartPoint = geomDataAPI_Point2D(theMacroArc.attribute("start_point_1")) aEndPoint = geomDataAPI_Point2D(theMacroArc.attribute("end_point_1")) - assert (not aCenterPoint.isInitialized()) - assert (not aStartPoint.isInitialized()) - assert (not aEndPoint.isInitialized()) + assert not aCenterPoint.isInitialized() + assert not aStartPoint.isInitialized() + assert not aEndPoint.isInitialized() # check references aCenterPointRef = theMacroArc.refattr("center_point_ref") aStartPointRef = theMacroArc.refattr("start_point_ref") aEndPointRef = theMacroArc.refattr("end_point_ref") - assert (not aCenterPointRef.isInitialized()) - assert (not aStartPointRef.isInitialized()) - assert (not aEndPointRef.isInitialized()) + assert not aCenterPointRef.isInitialized() + assert not aStartPointRef.isInitialized() + assert not aEndPointRef.isInitialized() + def assertNotInitializedByThreePoints(theMacroArc): # check points aStartPoint = geomDataAPI_Point2D(theMacroArc.attribute("start_point_2")) aEndPoint = geomDataAPI_Point2D(theMacroArc.attribute("end_point_2")) aPassedPoint = geomDataAPI_Point2D(theMacroArc.attribute("passed_point")) - assert (not aStartPoint.isInitialized()) - assert (not aEndPoint.isInitialized()) - assert (not aPassedPoint.isInitialized()) + assert not aStartPoint.isInitialized() + assert not aEndPoint.isInitialized() + assert not aPassedPoint.isInitialized() # check references aStartPointRef = theMacroArc.refattr("start_point_ref") aEndPointRef = theMacroArc.refattr("end_point_ref") aPassedPointRef = theMacroArc.refattr("passed_point_ref") - assert (not aStartPointRef.isInitialized()) - assert (not aEndPointRef.isInitialized()) - assert (not aPassedPointRef.isInitialized()) + assert not aStartPointRef.isInitialized() + assert not aEndPointRef.isInitialized() + assert not aPassedPointRef.isInitialized() + def assertNotInitializedByTangentEdge(theMacroArc): # check end point aEndPoint = geomDataAPI_Point2D(theMacroArc.attribute("end_point_3")) - assert (not aEndPoint.isInitialized()) + assert not aEndPoint.isInitialized() # check references aTangentPointRef = theMacroArc.refattr("passed_point_ref") aEndPointRef = theMacroArc.refattr("end_point_ref") - assert (not aTangentPointRef.isInitialized()) - assert (not aEndPointRef.isInitialized()) + assert not aTangentPointRef.isInitialized() + assert not aEndPointRef.isInitialized() + def verifyLastArc(theSketch, theCenter, theStart, theEnd): """ @@ -90,15 +94,15 @@ def verifyLastArc(theSketch, theCenter, theStart, theEnd): model.assertArc(aLastArc, theCenter, theStart, theEnd) -#========================================================================= +# ========================================================================= # Start of test -#========================================================================= +# ========================================================================= aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -111,24 +115,24 @@ norm.setValue(0, 0, 1) aSession.finishOperation() aSketch = SketchAPI_Sketch(aSketchFeature) -#========================================================================= +# ========================================================================= # Creation of auxiliary features -#========================================================================= +# ========================================================================= aSession.startOperation() aSession.startOperation() aLine = aSketchFeature.addFeature("SketchLine") aLineStart = geomDataAPI_Point2D(aLine.attribute("StartPoint")) -aLineStart.setValue(10., 0.) +aLineStart.setValue(10.0, 0.0) aLineEnd = geomDataAPI_Point2D(aLine.attribute("EndPoint")) -aLineEnd.setValue(10., 50.) +aLineEnd.setValue(10.0, 50.0) aSession.finishOperation() aSession.startOperation() -#========================================================================= +# ========================================================================= # Test 1. Create an arc as a macro-feature and check all attributes are not initialized -#========================================================================= +# ========================================================================= anArc = aSketchFeature.addFeature("SketchMacroArc") -assert (anArc.getKind() == "SketchMacroArc") +assert anArc.getKind() == "SketchMacroArc" aCenterPoint = geomDataAPI_Point2D(anArc.attribute("center_point")) aPassedPoint = geomDataAPI_Point2D(anArc.attribute("passed_point")) aStartPoint1 = geomDataAPI_Point2D(anArc.attribute("start_point_1")) @@ -145,52 +149,52 @@ assertNotInitializedByCenterAndPassed(anArc) assertNotInitializedByThreePoints(anArc) assertNotInitializedByTangentEdge(anArc) anArcType = anArc.string("arc_type") -assert (not anArcType.isInitialized()) -#========================================================================= +assert not anArcType.isInitialized() +# ========================================================================= # Test 2. Initialize center of arc, check the three points are not initialized -#========================================================================= +# ========================================================================= anArcType.setValue("by_center_and_points") -aCenterPoint.setValue(-25., -25.) +aCenterPoint.setValue(-25.0, -25.0) assertNotInitializedByThreePoints(anArc) assertNotInitializedByTangentEdge(anArc) -#========================================================================= +# ========================================================================= # Test 3. Change type of circle and check the attributes related to center and passed point became uninitilized -#========================================================================= +# ========================================================================= anArcType.setValue("by_three_points") assertNotInitializedByCenterAndPassed(anArc) assertNotInitializedByTangentEdge(anArc) -#========================================================================= +# ========================================================================= # Test 4. Initialize two points and change type, they should became uninitialized -#========================================================================= -aStartPoint2.setValue(-10., 10.) -aEndPoint2.setValue(10., 10.) +# ========================================================================= +aStartPoint2.setValue(-10.0, 10.0) +aEndPoint2.setValue(10.0, 10.0) anArcType.setValue("by_center_and_points") assertNotInitializedByThreePoints(anArc) assertNotInitializedByTangentEdge(anArc) -#========================================================================= +# ========================================================================= # Test 5. Initialize center and passed points then change the type -#========================================================================= -aCenterPoint.setValue(-25., -25.) -aStartPoint1.setValue(0., 0.) -aEndPoint1.setValue(-50., 0.) +# ========================================================================= +aCenterPoint.setValue(-25.0, -25.0) +aStartPoint1.setValue(0.0, 0.0) +aEndPoint1.setValue(-50.0, 0.0) anArcType.setValue("by_three_points") assertNotInitializedByCenterAndPassed(anArc) assertNotInitializedByTangentEdge(anArc) -#========================================================================= +# ========================================================================= # Test 6. Initialize all three points then change the type twice -#========================================================================= -aStartPoint2.setValue(-10., 10.) -aEndPoint2.setValue(10., 10.) -aPassedPoint.setValue(0., 0.) +# ========================================================================= +aStartPoint2.setValue(-10.0, 10.0) +aEndPoint2.setValue(10.0, 10.0) +aPassedPoint.setValue(0.0, 0.0) anArcType.setValue("by_tangent_edge") assertNotInitializedByThreePoints(anArc) anArcType.setValue("by_center_and_points") assertNotInitializedByTangentEdge(anArc) anArcType.setValue("by_three_points") assertNotInitializedByCenterAndPassed(anArc) -#========================================================================= +# ========================================================================= # Test 7. Initialize first and third points then change the type -#========================================================================= +# ========================================================================= aStartPointRef.setAttr(aLineStart) aStartPoint2.setValue(aLineStart.pnt()) aPassedPointRef.setObject(aLine.lastResult()) @@ -198,40 +202,47 @@ aPassedPoint.setValue(aLineEnd.pnt()) anArcType.setValue("by_tangent_edge") assertNotInitializedByCenterAndPassed(anArc) assertNotInitializedByThreePoints(anArc) -#========================================================================= +# ========================================================================= # Test 8. Initialize tangent point then change type -#========================================================================= +# ========================================================================= aTangentPoint.setAttr(aLineEnd) anArcType.setValue("by_three_points") assertNotInitializedByCenterAndPassed(anArc) assertNotInitializedByTangentEdge(anArc) -#========================================================================= +# ========================================================================= # Test 9. Initialize tangent point and end point then change type -#========================================================================= +# ========================================================================= anArcType.setValue("by_tangent_edge") aTangentPoint.setAttr(aLineEnd) -aEndPoint3.setValue(50., 50.) +aEndPoint3.setValue(50.0, 50.0) anArcType.setValue("by_center_and_points") assertNotInitializedByThreePoints(anArc) assertNotInitializedByTangentEdge(anArc) -#========================================================================= +# ========================================================================= # Test 10. Initialize center and passed points and finish operation -#========================================================================= +# ========================================================================= aCenterPointRef.setObject(aLine.lastResult()) -aCenterPoint.setValue((aLineStart.x() + aLineEnd.x()) * 0.5, (aLineStart.y() + aLineEnd.y()) * 0.5) +aCenterPoint.setValue( + (aLineStart.x() + aLineEnd.x()) * 0.5, (aLineStart.y() + aLineEnd.y()) * 0.5 +) aStartPointRef.setAttr(aLineStart) aStartPoint1.setValue(aLineStart.pnt()) aEndPointRef.setObject(aLine.lastResult()) aEndPoint1.setValue(aLineEnd.pnt()) aSession.finishOperation() -NB_FEATURES_EXPECTED = 5 # line, arc and three coincidences -assert (aSketchFeature.numberOfSubs() == NB_FEATURES_EXPECTED), "Number of features in sketch {}, expected {}".format(aSketchFeature.numberOfSubs(), NB_FEATURES_EXPECTED) +NB_FEATURES_EXPECTED = 5 # line, arc and three coincidences +assert ( + aSketchFeature.numberOfSubs() == NB_FEATURES_EXPECTED +), "Number of features in sketch {}, expected {}".format( + aSketchFeature.numberOfSubs(), NB_FEATURES_EXPECTED +) verifyLastArc(aSketchFeature, [], [aLineStart.x(), aLineStart.y()], []) -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestCreateBSpline.py b/src/SketchPlugin/Test/TestCreateBSpline.py index 0013ab051..c9591b919 100644 --- a/src/SketchPlugin/Test/TestCreateBSpline.py +++ b/src/SketchPlugin/Test/TestCreateBSpline.py @@ -29,165 +29,190 @@ from SketchAPI import * __updated__ = "2020-01-17" + class TestBSpline(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myPoles = [GeomAPI_Pnt2d(50., 50.), GeomAPI_Pnt2d(70., 70.), GeomAPI_Pnt2d(80., 30.), GeomAPI_Pnt2d(50., 10.), GeomAPI_Pnt2d(10., -30.)] - self.myPolesCoordinates = [(50., 50.), (70., 70.), (80., 30.), (50., 10.), (10., -30.)] - self.myDegree = 3; - self.myDOF = 0 - self.myNbPoints = 0 - self.myNbLines = 0 - self.myNbSplines = 0 - - def tearDown(self): - self.checkDOF() - model.end() - model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) - model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) - model.testNbSubFeatures(self.mySketch, "SketchBSpline", self.myNbSplines) - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - - def test_bspline_by_coordinates(self): - """ Test 1. Create B-spline curve by coordinates of its poles - """ - self.mySpline = self.mySketch.addSpline(poles = self.myPolesCoordinates) - self.myDOF += len(self.myPolesCoordinates) * 2 - self.myNbSplines += 1 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) - - def test_bspline_by_poles(self): - """ Test 2. Create B-spline curve by poles - """ - self.mySpline = self.mySketch.addSpline(poles = self.myPoles) - self.myDOF += len(self.myPoles) * 2 - self.myNbSplines += 1 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) - - def test_bspline_by_degree_and_poles(self): - """ Test 3. Create B-spline curve by poles and degree - """ - self.myDegree = 4 - self.mySpline = self.mySketch.addSpline(degree = self.myDegree, poles = self.myPoles) - self.myDOF += len(self.myPoles) * 2 - self.myNbSplines += 1 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) - - def test_bspline_by_poles_and_weights(self): - """ Test 4. Create B-spline curve by poles and weights - """ - self.mySpline = self.mySketch.addSpline(poles = self.myPoles, weights = [1, 2, 3, 2, 1]) - self.myDOF += len(self.myPoles) * 2 - self.myNbSplines += 1 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) - - def test_bspline_by_parametric(self): - """ Test 5. Create B-spline curve by whole set of parameters - """ - self.myDegree = 5 - self.myPolesCoordinates = [(-79.8578274581199, 75.5284518447357), - (-64.6205376770376, 62.7428476092882), - (-49.3832478959552, 49.9572433738407), - (-34.1459581148729, 37.1716391383932), - (-18.9086683337906, 24.3860349029457), - (-3.55842111132817, 11.5056481200973), - (-3.37993197286247, 11.42995541724), - (-3.1778022626919, 11.4565662984205), - (-3.02498570721059, 11.575876223351), - (8.46852511720001, 27.9903107977019), - (19.8774589601206, 44.2839569245217), - (31.2863928030413, 60.5776030513415), - (42.6953266459619, 76.8712491781612), - (54.1042604888826, 93.164895304981) - ] - self.mySpline = self.mySketch.addSpline(degree = self.myDegree, - poles = self.myPolesCoordinates, - weights = [1, 1, 1, 1, 1, 1, 0.957903314642061, 0.95790331464206, 1, 1, 1, 1, 1, 1], - knots = [-494.543457494654, 500, 507.372773368102, 1501.91623086297], - multiplicities = [6, 4, 4, 6]) - self.myDOF += len(self.myPolesCoordinates) * 2 - self.myNbSplines += 1 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) - - def test_bspline_linear(self): - """ Test 6. Create B-spline curve by 2 poles - """ - self.myDegree = 1 - self.mySpline = self.mySketch.addSpline(poles = self.myPoles[:2]) - self.myDOF += 4 - self.myNbSplines += 1 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) - - def test_bspline_parabola(self): - """ Test 7. Create B-spline curve by 3 poles - """ - self.myDegree = 2 - self.mySpline = self.mySketch.addSpline(poles = self.myPoles[:3]) - self.myDOF += 6 - self.myNbSplines += 1 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) - - def test_bspline_with_poles(self): - """ Test 8. Create B-spline curve and points coincident with its poles - """ - self.mySpline = self.mySketch.addSpline(poles = self.myPoles) - self.mySpline.controlPoles(regular = [0, 2], auxiliary = [1, 3]) - self.myDOF += len(self.myPoles) * 2 - self.myNbSplines += 1 - self.myNbPoints += 4 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) - - def test_bspline_with_polygon(self): - """ Test 9. Create B-spline curve and its control polygon - """ - self.mySpline = self.mySketch.addSpline(poles = self.myPoles) - self.mySpline.controlPolygon(regular = [0, 2], auxiliary = [1, 3]) - self.myDOF += len(self.myPoles) * 2 - self.myNbSplines += 1 - self.myNbLines += 4 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myPoles = [ + GeomAPI_Pnt2d(50.0, 50.0), + GeomAPI_Pnt2d(70.0, 70.0), + GeomAPI_Pnt2d(80.0, 30.0), + GeomAPI_Pnt2d(50.0, 10.0), + GeomAPI_Pnt2d(10.0, -30.0), + ] + self.myPolesCoordinates = [ + (50.0, 50.0), + (70.0, 70.0), + (80.0, 30.0), + (50.0, 10.0), + (10.0, -30.0), + ] + self.myDegree = 3 + self.myDOF = 0 + self.myNbPoints = 0 + self.myNbLines = 0 + self.myNbSplines = 0 + + def tearDown(self): + self.checkDOF() + model.end() + model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) + model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) + model.testNbSubFeatures(self.mySketch, "SketchBSpline", self.myNbSplines) + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def test_bspline_by_coordinates(self): + """Test 1. Create B-spline curve by coordinates of its poles""" + self.mySpline = self.mySketch.addSpline(poles=self.myPolesCoordinates) + self.myDOF += len(self.myPolesCoordinates) * 2 + self.myNbSplines += 1 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + + def test_bspline_by_poles(self): + """Test 2. Create B-spline curve by poles""" + self.mySpline = self.mySketch.addSpline(poles=self.myPoles) + self.myDOF += len(self.myPoles) * 2 + self.myNbSplines += 1 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + + def test_bspline_by_degree_and_poles(self): + """Test 3. Create B-spline curve by poles and degree""" + self.myDegree = 4 + self.mySpline = self.mySketch.addSpline( + degree=self.myDegree, poles=self.myPoles + ) + self.myDOF += len(self.myPoles) * 2 + self.myNbSplines += 1 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + + def test_bspline_by_poles_and_weights(self): + """Test 4. Create B-spline curve by poles and weights""" + self.mySpline = self.mySketch.addSpline( + poles=self.myPoles, weights=[1, 2, 3, 2, 1] + ) + self.myDOF += len(self.myPoles) * 2 + self.myNbSplines += 1 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + + def test_bspline_by_parametric(self): + """Test 5. Create B-spline curve by whole set of parameters""" + self.myDegree = 5 + self.myPolesCoordinates = [ + (-79.8578274581199, 75.5284518447357), + (-64.6205376770376, 62.7428476092882), + (-49.3832478959552, 49.9572433738407), + (-34.1459581148729, 37.1716391383932), + (-18.9086683337906, 24.3860349029457), + (-3.55842111132817, 11.5056481200973), + (-3.37993197286247, 11.42995541724), + (-3.1778022626919, 11.4565662984205), + (-3.02498570721059, 11.575876223351), + (8.46852511720001, 27.9903107977019), + (19.8774589601206, 44.2839569245217), + (31.2863928030413, 60.5776030513415), + (42.6953266459619, 76.8712491781612), + (54.1042604888826, 93.164895304981), + ] + self.mySpline = self.mySketch.addSpline( + degree=self.myDegree, + poles=self.myPolesCoordinates, + weights=[ + 1, + 1, + 1, + 1, + 1, + 1, + 0.957903314642061, + 0.95790331464206, + 1, + 1, + 1, + 1, + 1, + 1, + ], + knots=[-494.543457494654, 500, 507.372773368102, 1501.91623086297], + multiplicities=[6, 4, 4, 6], + ) + self.myDOF += len(self.myPolesCoordinates) * 2 + self.myNbSplines += 1 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + + def test_bspline_linear(self): + """Test 6. Create B-spline curve by 2 poles""" + self.myDegree = 1 + self.mySpline = self.mySketch.addSpline(poles=self.myPoles[:2]) + self.myDOF += 4 + self.myNbSplines += 1 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + + def test_bspline_parabola(self): + """Test 7. Create B-spline curve by 3 poles""" + self.myDegree = 2 + self.mySpline = self.mySketch.addSpline(poles=self.myPoles[:3]) + self.myDOF += 6 + self.myNbSplines += 1 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + + def test_bspline_with_poles(self): + """Test 8. Create B-spline curve and points coincident with its poles""" + self.mySpline = self.mySketch.addSpline(poles=self.myPoles) + self.mySpline.controlPoles(regular=[0, 2], auxiliary=[1, 3]) + self.myDOF += len(self.myPoles) * 2 + self.myNbSplines += 1 + self.myNbPoints += 4 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + + def test_bspline_with_polygon(self): + """Test 9. Create B-spline curve and its control polygon""" + self.mySpline = self.mySketch.addSpline(poles=self.myPoles) + self.mySpline.controlPolygon(regular=[0, 2], auxiliary=[1, 3]) + self.myDOF += len(self.myPoles) * 2 + self.myNbSplines += 1 + self.myNbLines += 4 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + if __name__ == "__main__": test_program = unittest.main(exit=False) diff --git a/src/SketchPlugin/Test/TestCreateBSplinePeriodic.py b/src/SketchPlugin/Test/TestCreateBSplinePeriodic.py index 02291488a..3f71a04a5 100644 --- a/src/SketchPlugin/Test/TestCreateBSplinePeriodic.py +++ b/src/SketchPlugin/Test/TestCreateBSplinePeriodic.py @@ -29,154 +29,174 @@ from SketchAPI import * __updated__ = "2020-01-24" + class TestBSplinePeriodic(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myPoles = [GeomAPI_Pnt2d(50., 50.), GeomAPI_Pnt2d(70., 70.), GeomAPI_Pnt2d(80., 30.), GeomAPI_Pnt2d(50., 10.), GeomAPI_Pnt2d(10., -30.)] - self.myPolesCoordinates = [(50., 50.), (70., 70.), (80., 30.), (50., 10.), (10., -30.)] - self.myDegree = 3; - self.myDOF = 0 - self.myNbPoints = 0 - self.myNbLines = 0 - self.myNbSplines = 0 - - def tearDown(self): - self.checkDOF() - model.end() - model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) - model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) - model.testNbSubFeatures(self.mySketch, "SketchBSplinePeriodic", self.myNbSplines) - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - - def test_bspline_by_coordinates(self): - """ Test 1. Create B-spline curve by coordinates of its poles - """ - self.mySpline = self.mySketch.addSpline(poles = self.myPolesCoordinates, periodic = True) - self.myDOF += len(self.myPolesCoordinates) * 2 - self.myNbSplines += 1 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) - - def test_bspline_by_poles(self): - """ Test 2. Create B-spline curve by poles - """ - self.mySpline = self.mySketch.addSpline(poles = self.myPoles, periodic = True) - self.myDOF += len(self.myPoles) * 2 - self.myNbSplines += 1 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) - - def test_bspline_by_degree_and_poles(self): - """ Test 3. Create B-spline curve by poles and degree - """ - self.myDegree = 4 - self.mySpline = self.mySketch.addSpline(degree = self.myDegree, poles = self.myPoles, periodic = True) - self.myDOF += len(self.myPoles) * 2 - self.myNbSplines += 1 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) - - def test_bspline_by_poles_and_weights(self): - """ Test 4. Create B-spline curve by poles and weights - """ - self.mySpline = self.mySketch.addSpline(poles = self.myPoles, weights = [1, 2, 3, 2, 1], periodic = True) - self.myDOF += len(self.myPoles) * 2 - self.myNbSplines += 1 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) - - def test_bspline_by_parametric(self): - """ Test 5. Create B-spline curve by whole set of parameters - """ - self.myDegree = 3 - self.myPolesCoordinates = [(-10, 0), (-20, 20), (0, 10), (20, 20), - (10, 0), (20, -20), (0, -10), (-20, -20) - ] - self.mySpline = self.mySketch.addSpline(degree = self.myDegree, - poles = self.myPolesCoordinates, - weights = [1, 1, 1, 1, 1, 1, 1, 1], - knots = [0, 1, 2, 3, 4, 5, 6, 7, 8], - multiplicities = [1, 1, 1, 1, 1, 1, 1, 1, 1], - periodic = True) - self.myDOF += len(self.myPolesCoordinates) * 2 - self.myNbSplines += 1 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) - - def test_bspline_linear(self): - """ Test 6. Create B-spline curve by 2 poles - """ - self.myDegree = 1 - self.mySpline = self.mySketch.addSpline(poles = self.myPoles[:2], periodic = True) - self.myDOF += 4 - self.myNbSplines += 1 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) - - def test_bspline_parabola(self): - """ Test 7. Create B-spline curve by 3 poles - """ - self.myDegree = 2 - self.mySpline = self.mySketch.addSpline(poles = self.myPoles[:3], periodic = True) - self.myDOF += 6 - self.myNbSplines += 1 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) - - def test_bspline_with_poles(self): - """ Test 8. Create B-spline curve and points coincident with its poles - """ - self.mySpline = self.mySketch.addSpline(poles = self.myPoles, periodic = True) - self.mySpline.controlPoles(regular = [0, 2], auxiliary = [1, 3]) - self.myDOF += len(self.myPoles) * 2 - self.myNbSplines += 1 - self.myNbPoints += 4 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) - - def test_bspline_with_polygon(self): - """ Test 9. Create B-spline curve and its control polygon - """ - self.mySpline = self.mySketch.addSpline(poles = self.myPoles, periodic = True) - self.mySpline.controlPolygon(regular = [0, 2], auxiliary = [1, 3]) - self.myDOF += len(self.myPoles) * 2 - self.myNbSplines += 1 - self.myNbLines += 4 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myPoles = [ + GeomAPI_Pnt2d(50.0, 50.0), + GeomAPI_Pnt2d(70.0, 70.0), + GeomAPI_Pnt2d(80.0, 30.0), + GeomAPI_Pnt2d(50.0, 10.0), + GeomAPI_Pnt2d(10.0, -30.0), + ] + self.myPolesCoordinates = [ + (50.0, 50.0), + (70.0, 70.0), + (80.0, 30.0), + (50.0, 10.0), + (10.0, -30.0), + ] + self.myDegree = 3 + self.myDOF = 0 + self.myNbPoints = 0 + self.myNbLines = 0 + self.myNbSplines = 0 + + def tearDown(self): + self.checkDOF() + model.end() + model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) + model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) + model.testNbSubFeatures( + self.mySketch, "SketchBSplinePeriodic", self.myNbSplines + ) + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def test_bspline_by_coordinates(self): + """Test 1. Create B-spline curve by coordinates of its poles""" + self.mySpline = self.mySketch.addSpline( + poles=self.myPolesCoordinates, periodic=True + ) + self.myDOF += len(self.myPolesCoordinates) * 2 + self.myNbSplines += 1 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + + def test_bspline_by_poles(self): + """Test 2. Create B-spline curve by poles""" + self.mySpline = self.mySketch.addSpline(poles=self.myPoles, periodic=True) + self.myDOF += len(self.myPoles) * 2 + self.myNbSplines += 1 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + + def test_bspline_by_degree_and_poles(self): + """Test 3. Create B-spline curve by poles and degree""" + self.myDegree = 4 + self.mySpline = self.mySketch.addSpline( + degree=self.myDegree, poles=self.myPoles, periodic=True + ) + self.myDOF += len(self.myPoles) * 2 + self.myNbSplines += 1 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + + def test_bspline_by_poles_and_weights(self): + """Test 4. Create B-spline curve by poles and weights""" + self.mySpline = self.mySketch.addSpline( + poles=self.myPoles, weights=[1, 2, 3, 2, 1], periodic=True + ) + self.myDOF += len(self.myPoles) * 2 + self.myNbSplines += 1 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + + def test_bspline_by_parametric(self): + """Test 5. Create B-spline curve by whole set of parameters""" + self.myDegree = 3 + self.myPolesCoordinates = [ + (-10, 0), + (-20, 20), + (0, 10), + (20, 20), + (10, 0), + (20, -20), + (0, -10), + (-20, -20), + ] + self.mySpline = self.mySketch.addSpline( + degree=self.myDegree, + poles=self.myPolesCoordinates, + weights=[1, 1, 1, 1, 1, 1, 1, 1], + knots=[0, 1, 2, 3, 4, 5, 6, 7, 8], + multiplicities=[1, 1, 1, 1, 1, 1, 1, 1, 1], + periodic=True, + ) + self.myDOF += len(self.myPolesCoordinates) * 2 + self.myNbSplines += 1 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + + def test_bspline_linear(self): + """Test 6. Create B-spline curve by 2 poles""" + self.myDegree = 1 + self.mySpline = self.mySketch.addSpline(poles=self.myPoles[:2], periodic=True) + self.myDOF += 4 + self.myNbSplines += 1 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + + def test_bspline_parabola(self): + """Test 7. Create B-spline curve by 3 poles""" + self.myDegree = 2 + self.mySpline = self.mySketch.addSpline(poles=self.myPoles[:3], periodic=True) + self.myDOF += 6 + self.myNbSplines += 1 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + + def test_bspline_with_poles(self): + """Test 8. Create B-spline curve and points coincident with its poles""" + self.mySpline = self.mySketch.addSpline(poles=self.myPoles, periodic=True) + self.mySpline.controlPoles(regular=[0, 2], auxiliary=[1, 3]) + self.myDOF += len(self.myPoles) * 2 + self.myNbSplines += 1 + self.myNbPoints += 4 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + + def test_bspline_with_polygon(self): + """Test 9. Create B-spline curve and its control polygon""" + self.mySpline = self.mySketch.addSpline(poles=self.myPoles, periodic=True) + self.mySpline.controlPolygon(regular=[0, 2], auxiliary=[1, 3]) + self.myDOF += len(self.myPoles) * 2 + self.myNbSplines += 1 + self.myNbLines += 4 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + if __name__ == "__main__": test_program = unittest.main(exit=False) diff --git a/src/SketchPlugin/Test/TestCreateCircleByCenterAndPassed.py b/src/SketchPlugin/Test/TestCreateCircleByCenterAndPassed.py index 14c3c554e..753f3b282 100644 --- a/src/SketchPlugin/Test/TestCreateCircleByCenterAndPassed.py +++ b/src/SketchPlugin/Test/TestCreateCircleByCenterAndPassed.py @@ -23,9 +23,9 @@ Test creation methods of a circle built by a center and a passed point """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from GeomDataAPI import * from GeomAPI import * from ModelAPI import * @@ -36,10 +36,11 @@ import math __updated__ = "2017-03-22" -#========================================================================= +# ========================================================================= # Auxiliary functions -#========================================================================= -TOLERANCE = 1.e-7 +# ========================================================================= +TOLERANCE = 1.0e-7 + def verifyLastCircle(theSketch, theX, theY, theR): """ @@ -48,9 +49,13 @@ def verifyLastCircle(theSketch, theX, theY, theR): aLastCircle = model.lastSubFeature(theSketch, "SketchCircle") model.assertCircle(aLastCircle, [theX, theY], theR) + def verifyPointOnLine(thePoint, theLine): aDistance = model.distancePointLine(thePoint, theLine) - assert aDistance < TOLERANCE, "Point is not on Line, distance: {0}".format(aDistance) + assert aDistance < TOLERANCE, "Point is not on Line, distance: {0}".format( + aDistance + ) + def verifyTangentCircles(theCircle1, theCircle2): aCenter1 = geomDataAPI_Point2D(theCircle1.attribute("circle_center")) @@ -60,7 +65,11 @@ def verifyTangentCircles(theCircle1, theCircle2): aRadius2 = theCircle2.real("circle_radius").value() aRSum = aRadius1 + aRadius2 aRDiff = math.fabs(aRadius1 - aRadius2) - assert math.fabs(aRSum - aDistCC) < TOLERANCE or math.fabs(aRDiff - aDistCC) < TOLERANCE, "Circles do not tangent" + assert ( + math.fabs(aRSum - aDistCC) < TOLERANCE + or math.fabs(aRDiff - aDistCC) < TOLERANCE + ), "Circles do not tangent" + def verifyTangentCircleLine(theCircle, theLine): aCenter = geomDataAPI_Point2D(theCircle.attribute("circle_center")) @@ -69,15 +78,15 @@ def verifyTangentCircleLine(theCircle, theLine): assert math.fabs(aDistCL - aRadius) < TOLERANCE, "Circle and line are not tangent" -#========================================================================= +# ========================================================================= # Start of test -#========================================================================= +# ========================================================================= aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -90,64 +99,64 @@ norm.setValue(0, 0, 1) aSession.finishOperation() aSketch = SketchAPI_Sketch(aSketchFeature) -#========================================================================= +# ========================================================================= # Test 1. Create a circle by center and radius -#========================================================================= +# ========================================================================= aSession.startOperation() aCircle = aSketchFeature.addFeature("SketchCircle") -assert (aCircle.getKind() == "SketchCircle") +assert aCircle.getKind() == "SketchCircle" aCircleCenter = geomDataAPI_Point2D(aCircle.attribute("circle_center")) -assert (not aCircleCenter.isInitialized()) +assert not aCircleCenter.isInitialized() aCircleRadius = aCircle.real("circle_radius") -assert (type(aCircleRadius) == ModelAPI_AttributeDouble) +assert type(aCircleRadius) == ModelAPI_AttributeDouble # ModelAPI_AttributeDouble.typeId() is checked in ModelAPI_TestConstants -assert (aCircleRadius.attributeType() == ModelAPI_AttributeDouble.typeId()) -aCircleCenter.setValue(-25., -25) -aCircleRadius.setValue(25.) +assert aCircleRadius.attributeType() == ModelAPI_AttributeDouble.typeId() +aCircleCenter.setValue(-25.0, -25) +aCircleRadius.setValue(25.0) aSession.finishOperation() -verifyLastCircle(aSketchFeature, -25., -25., 25.) -#========================================================================= +verifyLastCircle(aSketchFeature, -25.0, -25.0, 25.0) +# ========================================================================= # Edit the Circle # 1. check that changing the center of a circle does not affect radius and vise versa # 2. also check that int is acceptable as well as a real -#========================================================================= +# ========================================================================= aSession.startOperation() aCircleCenter.setValue(10, 60) aSession.finishOperation() -verifyLastCircle(aSketchFeature, 10., 60., 25.) +verifyLastCircle(aSketchFeature, 10.0, 60.0, 25.0) aSession.startOperation() aCircleRadius.setValue(int(20)) aSession.finishOperation() -verifyLastCircle(aSketchFeature, 10., 60., 20.) +verifyLastCircle(aSketchFeature, 10.0, 60.0, 20.0) -#========================================================================= +# ========================================================================= # Test 2. Create a circle as a macro-feature by center and passed point -#========================================================================= +# ========================================================================= aSession.startOperation() aCircle = aSketchFeature.addFeature("SketchMacroCircle") -assert (aCircle.getKind() == "SketchMacroCircle") +assert aCircle.getKind() == "SketchMacroCircle" aCircleCenter = geomDataAPI_Point2D(aCircle.attribute("center_point")) -assert (not aCircleCenter.isInitialized()) +assert not aCircleCenter.isInitialized() aCirclePassed = geomDataAPI_Point2D(aCircle.attribute("passed_point")) -assert (not aCirclePassed.isInitialized()) +assert not aCirclePassed.isInitialized() aCircleType = aCircle.string("circle_type") -assert (not aCircleType.isInitialized()) +assert not aCircleType.isInitialized() aCircleType.setValue("circle_type_by_center_and_passed_points") -aCircleCenter.setValue(-25., -25) -aCirclePassed.setValue(0., -25.) +aCircleCenter.setValue(-25.0, -25) +aCirclePassed.setValue(0.0, -25.0) aRadius = model.distancePointPoint(aCircleCenter, aCirclePassed) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 2) -verifyLastCircle(aSketchFeature, -25., -25., aRadius) +assert aSketchFeature.numberOfSubs() == 2 +verifyLastCircle(aSketchFeature, -25.0, -25.0, aRadius) -#========================================================================= +# ========================================================================= # Test 3. Create a circle as a macro-feature by center and passed point coincident to other points -#========================================================================= +# ========================================================================= # get previous circle aPrevCircle = model.lastSubFeature(aSketchFeature, "SketchCircle") aPrevCenter = geomDataAPI_Point2D(aPrevCircle.attribute("circle_center")) # create additional point -aPointCoordinates = [0., 0.] +aPointCoordinates = [0.0, 0.0] aSession.startOperation() aPoint = aSketchFeature.addFeature("SketchPoint") aPointCoord = geomDataAPI_Point2D(aPoint.attribute("PointCoordinates")) @@ -158,12 +167,12 @@ aSession.startOperation() aCircle = aSketchFeature.addFeature("SketchMacroCircle") aCenter = geomDataAPI_Point2D(aCircle.attribute("center_point")) aCenterRef = aCircle.refattr("center_point_ref") -assert (not aCenterRef.isInitialized()) +assert not aCenterRef.isInitialized() aPassed = geomDataAPI_Point2D(aCircle.attribute("passed_point")) aPassedRef = aCircle.refattr("passed_point_ref") -assert (not aPassedRef.isInitialized()) +assert not aPassedRef.isInitialized() aCircleType = aCircle.string("circle_type") -assert (not aCircleType.isInitialized()) +assert not aCircleType.isInitialized() # initialize attributes aCircleType.setValue("circle_type_by_center_and_passed_points") aCenterRef.setObject(aPoint.lastResult()) @@ -172,22 +181,22 @@ aPassedRef.setAttr(aPrevCenter) aPassed.setValue(aPrevCenter.pnt()) aRadius = model.distancePointPoint(aPrevCenter, aPointCoord) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 6) +assert aSketchFeature.numberOfSubs() == 6 model.assertPoint(aPointCoord, aPointCoordinates) verifyLastCircle(aSketchFeature, aPointCoord.x(), aPointCoord.y(), aRadius) model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 2) -#========================================================================= +# ========================================================================= # Test 4. Create a circle as a macro-feature by center on a line and passed point on another circle -#========================================================================= +# ========================================================================= # get previous circle aPrevCircle = model.lastSubFeature(aSketchFeature, "SketchCircle") aPrevCenter = geomDataAPI_Point2D(aPrevCircle.attribute("circle_center")) aPrevCenterXY = [aPrevCenter.x(), aPrevCenter.y()] aPrevRadius = aPrevCircle.real("circle_radius").value() # create additional line -aLineStart = [10., 0.] -aLineEnd = [10., 50.] +aLineStart = [10.0, 0.0] +aLineEnd = [10.0, 50.0] aSession.startOperation() aLine = aSketchFeature.addFeature("SketchLine") aStartPnt = geomDataAPI_Point2D(aLine.attribute("StartPoint")) @@ -206,16 +215,19 @@ aCircleType = aCircle.string("circle_type") # initialize attributes aCircleType.setValue("circle_type_by_center_and_passed_points") aCenterRef.setObject(aLine.lastResult()) -anExpectedCenter = [(aLineStart[0] + aLineEnd[0]) * 0.5, (aLineStart[1] + aLineEnd[1]) * 0.5] +anExpectedCenter = [ + (aLineStart[0] + aLineEnd[0]) * 0.5, + (aLineStart[1] + aLineEnd[1]) * 0.5, +] aCenter.setValue(anExpectedCenter[0], anExpectedCenter[1]) aPassedRef.setObject(aPrevCircle.lastResult()) aPassed.setValue(aPrevCenter.x() + aPrevRadius, aPrevCenter.y()) aRadius = model.distancePointPoint(aCenter, aPassed) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 10) +assert aSketchFeature.numberOfSubs() == 10 # check connected features do not change their positions model.assertPoint(aPrevCenter, aPrevCenterXY) -assert(aPrevCircle.real("circle_radius").value() == aPrevRadius) +assert aPrevCircle.real("circle_radius").value() == aPrevRadius model.assertLine(aLine, aLineStart, aLineEnd) # verify newly created circle aCircle = model.lastSubFeature(aSketchFeature, "SketchCircle") @@ -226,9 +238,9 @@ verifyTangentCircles(aCircle, aPrevCircle) model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 3) model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 1) -#========================================================================= +# ========================================================================= # Test 5. Create a circle as a macro-feature by center and passed point on line -#========================================================================= +# ========================================================================= # create new circle aSession.startOperation() aCircle = aSketchFeature.addFeature("SketchMacroCircle") @@ -239,12 +251,15 @@ aPassedRef = aCircle.refattr("passed_point_ref") aCircleType = aCircle.string("circle_type") # initialize attributes aCircleType.setValue("circle_type_by_center_and_passed_points") -anExpectedCenter = [(aLineStart[0] + aLineEnd[0]) * 0.5 + 10., (aLineStart[1] + aLineEnd[1]) * 0.5] +anExpectedCenter = [ + (aLineStart[0] + aLineEnd[0]) * 0.5 + 10.0, + (aLineStart[1] + aLineEnd[1]) * 0.5, +] aCenter.setValue(anExpectedCenter[0], anExpectedCenter[1]) aPassedRef.setObject(aLine.lastResult()) aPassed.setValue(aLineStart[0], aLineStart[1]) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 12) +assert aSketchFeature.numberOfSubs() == 12 # check connected features do not change their positions model.assertLine(aLine, aLineStart, aLineEnd) # verify newly created circle @@ -255,10 +270,10 @@ verifyTangentCircleLine(aCircle, aLine) model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 3) model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 2) -#========================================================================= +# ========================================================================= # Test 5. Create a circle as a macro-feature by center and passed point placed on the same line # Check the circle is not created -#========================================================================= +# ========================================================================= aSession.startOperation() aCircle = aSketchFeature.addFeature("SketchMacroCircle") aCenter = geomDataAPI_Point2D(aCircle.attribute("center_point")) @@ -274,15 +289,18 @@ aPassedRef.setObject(aLine.lastResult()) aPassed.setValue(aLineStart[0], aLineStart[1]) aSession.finishOperation() aLastFeature = aSketchFeature.subFeature(aSketchFeature.numberOfSubs() - 1) -assert aLastFeature.getKind() == "SketchMacroCircle", "ERROR: SketchMacroCircle has NOT expected to be valid" +assert ( + aLastFeature.getKind() == "SketchMacroCircle" +), "ERROR: SketchMacroCircle has NOT expected to be valid" aSession.startOperation() aDocument.removeFeature(aCircle) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 12) +assert aSketchFeature.numberOfSubs() == 12 -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestCreateCircleByThreePoints.py b/src/SketchPlugin/Test/TestCreateCircleByThreePoints.py index 29c2f1988..69ac6bcc9 100644 --- a/src/SketchPlugin/Test/TestCreateCircleByThreePoints.py +++ b/src/SketchPlugin/Test/TestCreateCircleByThreePoints.py @@ -23,9 +23,9 @@ Test creation methods of a circle built by three points """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from GeomDataAPI import * from GeomAPI import * from ModelAPI import * @@ -36,10 +36,11 @@ import math __updated__ = "2017-03-22" -#========================================================================= +# ========================================================================= # Auxiliary functions -#========================================================================= -TOLERANCE = 1.e-7 +# ========================================================================= +TOLERANCE = 1.0e-7 + def verifyLastCircle(theSketch, theX, theY, theR): """ @@ -48,11 +49,17 @@ def verifyLastCircle(theSketch, theX, theY, theR): aLastCircle = model.lastSubFeature(theSketch, "SketchCircle") model.assertCircle(aLastCircle, [theX, theY], theR) + def verifyPointOnCircle(thePoint, theCircle): aCircleCenter = geomDataAPI_Point2D(theCircle.attribute("circle_center")) aDistCP = model.distancePointPoint(aCircleCenter, thePoint) aCircleRadius = theCircle.real("circle_radius").value() - assert math.fabs(aDistCP - aCircleRadius) < TOLERANCE, "Point is not on circle, distance: {0}, radius of circle: {1}".format(aDistCP, aCircleRadius) + assert ( + math.fabs(aDistCP - aCircleRadius) < TOLERANCE + ), "Point is not on circle, distance: {0}, radius of circle: {1}".format( + aDistCP, aCircleRadius + ) + def verifyTangentCircles(theCircle1, theCircle2): aCenter1 = geomDataAPI_Point2D(theCircle1.attribute("circle_center")) @@ -62,6 +69,7 @@ def verifyTangentCircles(theCircle1, theCircle2): aRadius2 = theCircle2.real("circle_radius").value() verifyTangentCircular(aDistCC, aRadius1, aRadius2) + def verifyTangentCircleArc(theCircle, theArc): aCircleCenter = geomDataAPI_Point2D(theCircle.attribute("circle_center")) anArcCenter = geomDataAPI_Point2D(theArc.attribute("center_point")) @@ -71,10 +79,15 @@ def verifyTangentCircleArc(theCircle, theArc): anArcRadius = model.distancePointPoint(anArcCenter, anArcStart) verifyTangentCircular(aDistCC, aCircleRadius, anArcRadius) + def verifyTangentCircular(theDistBetweenCenters, theRadius1, theRadius2): aRSum = theRadius1 + theRadius2 aRDiff = math.fabs(theRadius1 - theRadius2) - assert math.fabs(aRSum - theDistBetweenCenters) < TOLERANCE or math.fabs(aRDiff - theDistBetweenCenters) < TOLERANCE, "Two circulars are not tangent" + assert ( + math.fabs(aRSum - theDistBetweenCenters) < TOLERANCE + or math.fabs(aRDiff - theDistBetweenCenters) < TOLERANCE + ), "Two circulars are not tangent" + def verifyTangentCircleLine(theCircle, theLine): aCenter = geomDataAPI_Point2D(theCircle.attribute("circle_center")) @@ -83,15 +96,15 @@ def verifyTangentCircleLine(theCircle, theLine): assert math.fabs(aDistCL - aRadius) < TOLERANCE, "Circle and line are not tangent" -#========================================================================= +# ========================================================================= # Start of test -#========================================================================= +# ========================================================================= aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -104,42 +117,42 @@ norm.setValue(0, 0, 1) aSession.finishOperation() aSketch = SketchAPI_Sketch(aSketchFeature) -#========================================================================= +# ========================================================================= # Test 1. Create a circle by three points -#========================================================================= -expectedCenter = [0., 0.] -expectedRadius = 10. +# ========================================================================= +expectedCenter = [0.0, 0.0] +expectedRadius = 10.0 aSession.startOperation() aCircle = aSketchFeature.addFeature("SketchMacroCircle") -assert (aCircle.getKind() == "SketchMacroCircle") +assert aCircle.getKind() == "SketchMacroCircle" aCirclePnt1 = geomDataAPI_Point2D(aCircle.attribute("first_point")) aCirclePnt2 = geomDataAPI_Point2D(aCircle.attribute("second_point")) aCirclePnt3 = geomDataAPI_Point2D(aCircle.attribute("third_point")) -assert (not aCirclePnt1.isInitialized()) -assert (not aCirclePnt2.isInitialized()) -assert (not aCirclePnt3.isInitialized()) +assert not aCirclePnt1.isInitialized() +assert not aCirclePnt2.isInitialized() +assert not aCirclePnt3.isInitialized() aCircleType = aCircle.string("circle_type") -assert (not aCircleType.isInitialized()) +assert not aCircleType.isInitialized() aCircleType.setValue("circle_type_by_three_points") aCirclePnt1.setValue(expectedCenter[0] - expectedRadius, expectedCenter[1]) aCirclePnt2.setValue(expectedCenter[0] + expectedRadius, expectedCenter[1]) aCirclePnt3.setValue(expectedCenter[0], expectedCenter[1] + expectedRadius) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 1) +assert aSketchFeature.numberOfSubs() == 1 verifyLastCircle(aSketchFeature, expectedCenter[0], expectedCenter[1], expectedRadius) -#========================================================================= +# ========================================================================= # Test 2. Create a circle by three points coincident to other points -#========================================================================= +# ========================================================================= # get previous circle aPrevCircle = model.lastSubFeature(aSketchFeature, "SketchCircle") aPrevCenter = geomDataAPI_Point2D(aPrevCircle.attribute("circle_center")) aPrevCenterXY = [aPrevCenter.x(), aPrevCenter.y()] aPrevCircleRadius = aPrevCircle.real("circle_radius").value() # create additional point and line -aPointCoordinates = [5., 20.] -aLineStart = [10., 0.] -aLineEnd = [10., 50.] +aPointCoordinates = [5.0, 20.0] +aLineStart = [10.0, 0.0] +aLineEnd = [10.0, 50.0] aSession.startOperation() aPoint = aSketchFeature.addFeature("SketchPoint") aPointCoord = geomDataAPI_Point2D(aPoint.attribute("PointCoordinates")) @@ -169,7 +182,7 @@ aCirclePnt2.setValue(aPointCoord.pnt()) aCirclePnt3Ref.setAttr(aStartPnt) aCirclePnt3.setValue(aLineStart[0], aLineStart[1]) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 7) +assert aSketchFeature.numberOfSubs() == 7 # check the points do not change their positions model.assertPoint(aPrevCenter, aPrevCenterXY) model.assertPoint(aPointCoord, aPointCoordinates) @@ -182,12 +195,12 @@ verifyPointOnCircle(aStartPnt, aCircle) model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 3) model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 0) -#========================================================================= +# ========================================================================= # Test 3. Create a circle by three points and tangent to line, circle and arc -#========================================================================= +# ========================================================================= # create additional arc -anArcRadius = 5. -anArcCenter = [-10., 10.] +anArcRadius = 5.0 +anArcCenter = [-10.0, 10.0] anArcStart = [anArcCenter[0], anArcCenter[1] - anArcRadius] anArcEnd = [anArcCenter[0], anArcCenter[1] + anArcRadius] aSession.startOperation() @@ -218,10 +231,10 @@ aCirclePnt2.setValue(aLineEnd[0], aLineEnd[1]) aCirclePnt3Ref.setObject(anArc.lastResult()) aCirclePnt3.setValue(anArcCenter[0] + anArcRadius, anArcCenter[1]) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 12) +assert aSketchFeature.numberOfSubs() == 12 # check the tangent entities do not change their positions model.assertPoint(aPrevCenter, aPrevCenterXY) -assert (aPrevCircle.real("circle_radius").value() == aPrevCircleRadius) +assert aPrevCircle.real("circle_radius").value() == aPrevCircleRadius model.assertLine(aLine, aLineStart, aLineEnd) model.assertArc(anArc, anArcCenter, anArcStart, anArcEnd) # check newly created circle passes through the points @@ -232,11 +245,11 @@ verifyTangentCircleLine(aCircle, aLine) model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 3) model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 3) -#========================================================================= +# ========================================================================= # Test 4. Create a circle by three points: # a. first two points are coincident to extremities of the line # b. check that this line is not selectable by third point -#========================================================================= +# ========================================================================= aSession.startOperation() aCircle = aSketchFeature.addFeature("SketchMacroCircle") aCirclePnt1 = geomDataAPI_Point2D(aCircle.attribute("first_point")) @@ -256,18 +269,20 @@ aCirclePnt3Ref.setObject(aLine.lastResult()) aCirclePnt3.setValue(aLineEnd[0], aLineEnd[1]) aSession.finishOperation() aLastFeature = aSketchFeature.subFeature(aSketchFeature.numberOfSubs() - 1) -assert aLastFeature.getKind() == "SketchMacroCircle", "ERROR: SketchMacroCircle has NOT expected to be valid" +assert ( + aLastFeature.getKind() == "SketchMacroCircle" +), "ERROR: SketchMacroCircle has NOT expected to be valid" aSession.startOperation() aDocument.removeFeature(aCircle) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 12) +assert aSketchFeature.numberOfSubs() == 12 -#========================================================================= +# ========================================================================= # Test 5. Create a circle by three points: # a. first two points are placed on both sides from line # b. check that this line is not selectable by third point -#========================================================================= -aDistanceFromLine = 20. +# ========================================================================= +aDistanceFromLine = 20.0 aSession.startOperation() aCircle = aSketchFeature.addFeature("SketchMacroCircle") aCirclePnt1 = geomDataAPI_Point2D(aCircle.attribute("first_point")) @@ -285,16 +300,18 @@ aCirclePnt3Ref.setObject(aLine.lastResult()) aCirclePnt3.setValue(aLineEnd[0], aLineEnd[1]) aSession.finishOperation() aLastFeature = aSketchFeature.subFeature(aSketchFeature.numberOfSubs() - 1) -assert aLastFeature.getKind() == "SketchMacroCircle", "ERROR: SketchMacroCircle has NOT expected to be valid" +assert ( + aLastFeature.getKind() == "SketchMacroCircle" +), "ERROR: SketchMacroCircle has NOT expected to be valid" aSession.startOperation() aDocument.removeFeature(aCircle) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 12) +assert aSketchFeature.numberOfSubs() == 12 -#========================================================================= +# ========================================================================= # Auxiliary objects for the following tests -#========================================================================= +# ========================================================================= from salome.shaper import model model.begin() @@ -309,9 +326,9 @@ model.do() model.end() aSketchFeature = featureToCompositeFeature(Sketch_1.feature()) -#========================================================================= +# ========================================================================= # Test 6. Create a circle passing through a point and tangent to 2 lines -#========================================================================= +# ========================================================================= # create new circle aSession.startOperation() aCircle = aSketchFeature.addFeature("SketchMacroCircle") @@ -330,7 +347,7 @@ aCirclePnt2.setValue(SketchLine_1.startPoint().x(), SketchLine_1.startPoint().y( aCirclePnt3Ref.setObject(SketchLine_2.feature().lastResult()) aCirclePnt3.setValue(SketchLine_2.startPoint().x(), SketchLine_2.startPoint().y()) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 9) +assert aSketchFeature.numberOfSubs() == 9 # check newly created circle tangent to objects aCircle = model.lastSubFeature(aSketchFeature, "SketchCircle") verifyTangentCircleLine(aCircle, SketchLine_1.feature()) @@ -338,9 +355,9 @@ verifyTangentCircleLine(aCircle, SketchLine_2.feature()) model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 0) model.testNbSubFeatures(Sketch_1, "SketchConstraintTangent", 2) -#========================================================================= +# ========================================================================= # Test 7. Create a circle passing through a point and tangent to 2 circles -#========================================================================= +# ========================================================================= # create new circle aSession.startOperation() aCircle = aSketchFeature.addFeature("SketchMacroCircle") @@ -359,7 +376,7 @@ aCirclePnt2.setValue(40, 0) aCirclePnt3Ref.setObject(SketchCircle_2.feature().lastResult()) aCirclePnt3.setValue(30, 20) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 12) +assert aSketchFeature.numberOfSubs() == 12 # check newly created circle tangent to objects aCircle = model.lastSubFeature(aSketchFeature, "SketchCircle") verifyTangentCircles(aCircle, SketchCircle_3.feature()) @@ -367,9 +384,9 @@ verifyTangentCircles(aCircle, SketchCircle_2.feature()) model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 0) model.testNbSubFeatures(Sketch_1, "SketchConstraintTangent", 4) -#========================================================================= +# ========================================================================= # Test 8. Create a circle passing through a point and tangent to line and circle -#========================================================================= +# ========================================================================= # create new circle aSession.startOperation() aCircle = aSketchFeature.addFeature("SketchMacroCircle") @@ -388,7 +405,7 @@ aCirclePnt2.setValue(30, 0) aCirclePnt3Ref.setObject(SketchCircle_2.feature().lastResult()) aCirclePnt3.setValue(30, 20) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 15) +assert aSketchFeature.numberOfSubs() == 15 # check newly created circle tangent to objects aCircle = model.lastSubFeature(aSketchFeature, "SketchCircle") verifyTangentCircles(aCircle, SketchCircle_2.feature()) @@ -396,9 +413,9 @@ verifyTangentCircleLine(aCircle, SketchLine_3.feature()) model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 0) model.testNbSubFeatures(Sketch_1, "SketchConstraintTangent", 6) -#========================================================================= +# ========================================================================= # Test 9. Create a circle tangent to 3 lines -#========================================================================= +# ========================================================================= # create new circle aSession.startOperation() aCircle = aSketchFeature.addFeature("SketchMacroCircle") @@ -418,7 +435,7 @@ aCirclePnt2.setValue(30, 10) aCirclePnt3Ref.setObject(SketchLine_3.feature().lastResult()) aCirclePnt3.setValue(40, 0) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 19) +assert aSketchFeature.numberOfSubs() == 19 # check newly created circle tangent to objects aCircle = model.lastSubFeature(aSketchFeature, "SketchCircle") verifyTangentCircleLine(aCircle, SketchLine_1.feature()) @@ -427,9 +444,9 @@ verifyTangentCircleLine(aCircle, SketchLine_3.feature()) model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 0) model.testNbSubFeatures(Sketch_1, "SketchConstraintTangent", 9) -#========================================================================= +# ========================================================================= # Test 10. Create a circle tangent to a circle and 2 lines -#========================================================================= +# ========================================================================= # create new circle aSession.startOperation() aCircle = aSketchFeature.addFeature("SketchMacroCircle") @@ -449,7 +466,7 @@ aCirclePnt2.setValue(30, 10) aCirclePnt3Ref.setObject(SketchCircle_3.feature().lastResult()) aCirclePnt3.setValue(40, 0) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 23) +assert aSketchFeature.numberOfSubs() == 23 # check newly created circle tangent to objects aCircle = model.lastSubFeature(aSketchFeature, "SketchCircle") verifyTangentCircleLine(aCircle, SketchLine_1.feature()) @@ -458,9 +475,9 @@ verifyTangentCircles(aCircle, SketchCircle_3.feature()) model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 0) model.testNbSubFeatures(Sketch_1, "SketchConstraintTangent", 12) -#========================================================================= +# ========================================================================= # Test 11. Create a circle tangent to 3 circles -#========================================================================= +# ========================================================================= # create new circle aSession.startOperation() aCircle = aSketchFeature.addFeature("SketchMacroCircle") @@ -480,7 +497,7 @@ aCirclePnt2.setValue(30, 20) aCirclePnt3Ref.setObject(SketchCircle_3.feature().lastResult()) aCirclePnt3.setValue(40, 0) aSession.finishOperation() -assert (aSketchFeature.numberOfSubs() == 27) +assert aSketchFeature.numberOfSubs() == 27 # check newly created circle tangent to objects aCircle = model.lastSubFeature(aSketchFeature, "SketchCircle") verifyTangentCircles(aCircle, SketchCircle_1.feature()) @@ -489,8 +506,8 @@ verifyTangentCircles(aCircle, SketchCircle_3.feature()) model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 0) model.testNbSubFeatures(Sketch_1, "SketchConstraintTangent", 15) -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestCreateCircleChangeType.py b/src/SketchPlugin/Test/TestCreateCircleChangeType.py index 803561bfc..106752621 100644 --- a/src/SketchPlugin/Test/TestCreateCircleChangeType.py +++ b/src/SketchPlugin/Test/TestCreateCircleChangeType.py @@ -23,9 +23,9 @@ Test attributes reset when changing creation method of a circle on-the-fly """ -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from GeomDataAPI import * from GeomAPI import * from ModelAPI import * @@ -40,31 +40,34 @@ __updated__ = "2017-03-22" ## Auxiliary functions ##========================================================================= + def assertNotInitializedByCenterAndPassed(theMacroCircle): # check points aPassedPoint = geomDataAPI_Point2D(theMacroCircle.attribute("passed_point")) - assert (not aPassedPoint.isInitialized()) + assert not aPassedPoint.isInitialized() # check references aCenterPointRef = theMacroCircle.refattr("center_point_ref") aPassedPointRef = theMacroCircle.refattr("passed_point_ref") - assert (not aCenterPointRef.isInitialized()) - assert (not aPassedPointRef.isInitialized()) + assert not aCenterPointRef.isInitialized() + assert not aPassedPointRef.isInitialized() + def assertNotInitializedByThreePoints(theMacroCircle): # check points aFirstPoint = geomDataAPI_Point2D(theMacroCircle.attribute("first_point")) aSecondPoint = geomDataAPI_Point2D(theMacroCircle.attribute("second_point")) aThirdPoint = geomDataAPI_Point2D(theMacroCircle.attribute("third_point")) - assert (not aFirstPoint.isInitialized()) - assert (not aSecondPoint.isInitialized()) - assert (not aThirdPoint.isInitialized()) + assert not aFirstPoint.isInitialized() + assert not aSecondPoint.isInitialized() + assert not aThirdPoint.isInitialized() # check references aFirstPointRef = theMacroCircle.refattr("first_point_ref") aSecondPointRef = theMacroCircle.refattr("second_point_ref") aThirdPointRef = theMacroCircle.refattr("third_point_ref") - assert (not aFirstPointRef.isInitialized()) - assert (not aSecondPointRef.isInitialized()) - assert (not aThirdPointRef.isInitialized()) + assert not aFirstPointRef.isInitialized() + assert not aSecondPointRef.isInitialized() + assert not aThirdPointRef.isInitialized() + def verifyLastCircle(theSketch, theX, theY, theR): """ @@ -74,15 +77,15 @@ def verifyLastCircle(theSketch, theX, theY, theR): model.assertCircle(aLastCircle, [theX, theY], theR) -#========================================================================= +# ========================================================================= # Start of test -#========================================================================= +# ========================================================================= aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -95,24 +98,24 @@ norm.setValue(0, 0, 1) aSession.finishOperation() aSketch = SketchAPI_Sketch(aSketchFeature) -#========================================================================= +# ========================================================================= # Creation of auxiliary features -#========================================================================= +# ========================================================================= aSession.startOperation() aSession.startOperation() aLine = aSketchFeature.addFeature("SketchLine") aLineStart = geomDataAPI_Point2D(aLine.attribute("StartPoint")) -aLineStart.setValue(10., 0.) +aLineStart.setValue(10.0, 0.0) aLineEnd = geomDataAPI_Point2D(aLine.attribute("EndPoint")) -aLineEnd.setValue(10., 50.) +aLineEnd.setValue(10.0, 50.0) aSession.finishOperation() aSession.startOperation() -#========================================================================= +# ========================================================================= # Test 1. Create a circle as a macro-feature and check all attributes are not initialized -#========================================================================= +# ========================================================================= aCircle = aSketchFeature.addFeature("SketchMacroCircle") -assert (aCircle.getKind() == "SketchMacroCircle") +assert aCircle.getKind() == "SketchMacroCircle" aCenterPoint = geomDataAPI_Point2D(aCircle.attribute("center_point")) aPassedPoint = geomDataAPI_Point2D(aCircle.attribute("passed_point")) aFirstPoint = geomDataAPI_Point2D(aCircle.attribute("first_point")) @@ -126,54 +129,54 @@ aThirdPointRef = aCircle.refattr("third_point_ref") assertNotInitializedByCenterAndPassed(aCircle) assertNotInitializedByThreePoints(aCircle) aCircleType = aCircle.string("circle_type") -assert (not aCircleType.isInitialized()) -#========================================================================= +assert not aCircleType.isInitialized() +# ========================================================================= # Test 2. Initialize center of circle, check the three points are not initialized -#========================================================================= +# ========================================================================= aCircleType.setValue("circle_type_by_center_and_passed_points") -aCenterPoint.setValue(-25., -25.) +aCenterPoint.setValue(-25.0, -25.0) assertNotInitializedByThreePoints(aCircle) -#========================================================================= +# ========================================================================= # Test 3. Change type of circle and check the attributes related to center and passed point became uninitilized -#========================================================================= +# ========================================================================= aCircleType.setValue("circle_type_by_three_points") assertNotInitializedByCenterAndPassed(aCircle) -#========================================================================= +# ========================================================================= # Test 4. Initialize two points and change type, they should became uninitialized -#========================================================================= -aFirstPoint.setValue(-10., 10.) -aSecondPoint.setValue(10., 10.) +# ========================================================================= +aFirstPoint.setValue(-10.0, 10.0) +aSecondPoint.setValue(10.0, 10.0) aCircleType.setValue("circle_type_by_center_and_passed_points") assertNotInitializedByThreePoints(aCircle) -#========================================================================= +# ========================================================================= # Test 5. Initialize center and passed point then change the type -#========================================================================= -aCenterPoint.setValue(-25., -25.) -aPassedPoint.setValue(0., 0.) +# ========================================================================= +aCenterPoint.setValue(-25.0, -25.0) +aPassedPoint.setValue(0.0, 0.0) aCircleType.setValue("circle_type_by_three_points") assertNotInitializedByCenterAndPassed(aCircle) -#========================================================================= +# ========================================================================= # Test 6. Initialize all three points then change the type twice -#========================================================================= -aFirstPoint.setValue(-10., 10.) -aSecondPoint.setValue(10., 10.) -aThirdPoint.setValue(0., 0.) +# ========================================================================= +aFirstPoint.setValue(-10.0, 10.0) +aSecondPoint.setValue(10.0, 10.0) +aThirdPoint.setValue(0.0, 0.0) aCircleType.setValue("circle_type_by_center_and_passed_points") assertNotInitializedByThreePoints(aCircle) aCircleType.setValue("circle_type_by_three_points") assertNotInitializedByCenterAndPassed(aCircle) -#========================================================================= +# ========================================================================= # Test 7. Initialize first and third points then change the type -#========================================================================= +# ========================================================================= aFirstPointRef.setAttr(aLineStart) aFirstPoint.setValue(aLineStart.pnt()) aThirdPointRef.setObject(aLine.lastResult()) aThirdPoint.setValue(aLineEnd.pnt()) aCircleType.setValue("circle_type_by_center_and_passed_points") assertNotInitializedByThreePoints(aCircle) -#========================================================================= +# ========================================================================= # Test 8. Initialize center and passed points and finish operation -#========================================================================= +# ========================================================================= aCenterPointRef.setAttr(aLineStart) aCenterPoint.setValue(aLineStart.pnt()) aPassedPointRef.setAttr(aLineEnd) @@ -181,13 +184,18 @@ aPassedPoint.setValue(aLineEnd.pnt()) aSession.finishOperation() aRadius = model.distancePointPoint(aLineStart, aLineEnd) -NB_FEATURES_EXPECTED = 4 # line, circle and two coincidences -assert (aSketchFeature.numberOfSubs() == NB_FEATURES_EXPECTED), "Number of features in sketch {}, expected {}".format(aSketchFeature.numberOfSubs(), NB_FEATURES_EXPECTED) +NB_FEATURES_EXPECTED = 4 # line, circle and two coincidences +assert ( + aSketchFeature.numberOfSubs() == NB_FEATURES_EXPECTED +), "Number of features in sketch {}, expected {}".format( + aSketchFeature.numberOfSubs(), NB_FEATURES_EXPECTED +) verifyLastCircle(aSketchFeature, aLineStart.x(), aLineStart.y(), aRadius) -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestCreateEllipseByCenterSemiaxisAndPassed.py b/src/SketchPlugin/Test/TestCreateEllipseByCenterSemiaxisAndPassed.py index cc17181cd..4bd37314d 100644 --- a/src/SketchPlugin/Test/TestCreateEllipseByCenterSemiaxisAndPassed.py +++ b/src/SketchPlugin/Test/TestCreateEllipseByCenterSemiaxisAndPassed.py @@ -29,316 +29,367 @@ from SketchAPI import * __updated__ = "2019-09-09" + class TestEllipse(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myCenter = GeomAPI_Pnt2d(50., 50.) - self.myFocus = GeomAPI_Pnt2d(70., 50.) - self.myPassedPoint = GeomAPI_Pnt2d(60., 60.) - self.myMinorRadius = 20. - self.myDOF = 0 - - def tearDown(self): - self.checkDOF() - model.end() - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkPointsEqual(self, thePoint1, thePoint2): - self.assertAlmostEqual(thePoint1.x(), thePoint2.x(), 5) - self.assertAlmostEqual(thePoint1.y(), thePoint2.y(), 5) - - def checkPointOnLine(self, theCoordinates, theLine): - point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) - dist = model.distancePointLine(point, theLine) - self.assertAlmostEqual(dist, 0, 7) - - def checkPointOnCircle(self, theCoordinates, theCircle): - point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) - dist = model.distancePointPoint(point, theCircle.center()) - self.assertAlmostEqual(dist , theCircle.radius().value(), 7) - - def checkPointOnEllipse(self, theCoordinates, theEllipse): - point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) - firstFocus2d = GeomAPI_Pnt2d(theEllipse.firstFocus().x(), theEllipse.firstFocus().y()) - distPF1 = model.distancePointPoint(firstFocus2d, point) - secondFocus2d = GeomAPI_Pnt2d(theEllipse.secondFocus().x(), theEllipse.secondFocus().y()) - distPF2 = model.distancePointPoint(secondFocus2d, point) - if issubclass(type(theEllipse), SketchAPI_Ellipse): - majorRad = theEllipse.majorRadius().value() - else: - majorRad = theEllipse.majorRadius() - self.assertAlmostEqual(distPF1 + distPF2, 2.0 * majorRad, 7) - - - def test_ellipse_by_center_and_focus(self): - """ Test 1. Create ellipse by coordinates of center, focus and minor radius - """ - self.myEllipse1 = self.mySketch.addEllipse(self.myCenter.x(), self.myCenter.y(), self.myFocus.x(), self.myFocus.y(), self.myMinorRadius) - self.myDOF += 5 - - self.myEllipse2 = self.mySketch.addEllipse(self.myCenter, self.myFocus, self.myMinorRadius) - self.myDOF += 5 - model.do() - - # check both ellipses are equal - anEllipse1 = self.myEllipse1.defaultResult().shape().edge().ellipse() - anEllipse2 = self.myEllipse2.defaultResult().shape().edge().ellipse() - self.checkPointsEqual(anEllipse1.center(), anEllipse2.center()) - self.checkPointsEqual(anEllipse1.firstFocus(), anEllipse2.firstFocus()) - self.checkPointsEqual(anEllipse1.secondFocus(), anEllipse2.secondFocus()) - self.assertAlmostEqual(anEllipse1.minorRadius(), anEllipse2.minorRadius()) - self.assertAlmostEqual(anEllipse1.majorRadius(), anEllipse2.majorRadius()) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 0) - model.testNbSubFeatures(self.mySketch, "SketchLine", 0) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 2) - - def test_ellipse_by_semiaxis_and_passed(self): - """ Test 2. Create ellipse by coordinates of center, major semi-axis point and a passed point on ellipse - """ - self.myEllipse1 = self.mySketch.addEllipse(self.myCenter.x(), self.myCenter.y(), self.myFocus.x(), self.myFocus.y(), self.myPassedPoint.x(), self.myPassedPoint.y(), True) - self.myDOF += 5 - model.do() - anEllipseFeature1 = model.lastSubFeature(self.mySketch, "SketchEllipse") - - self.myEllipse2 = self.mySketch.addEllipse(self.myCenter, self.myFocus, self.myPassedPoint, True) - self.myDOF += 5 - model.do() - anEllipseFeature2 = model.lastSubFeature(self.mySketch, "SketchEllipse") - - # check both ellipses are equal - anEllipse1 = anEllipseFeature1.lastResult().shape().edge().ellipse() - anEllipse2 = anEllipseFeature2.lastResult().shape().edge().ellipse() - self.checkPointsEqual(anEllipse1.center(), anEllipse2.center()) - self.checkPointsEqual(anEllipse1.firstFocus(), anEllipse2.firstFocus()) - self.checkPointsEqual(anEllipse1.secondFocus(), anEllipse2.secondFocus()) - self.assertAlmostEqual(anEllipse1.minorRadius(), anEllipse2.minorRadius()) - self.assertAlmostEqual(anEllipse1.majorRadius(), anEllipse2.majorRadius()) - # check passed point on ellipse - self.checkPointOnEllipse(self.myPassedPoint, anEllipse1) - self.checkPointOnEllipse(self.myPassedPoint, anEllipse2) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 14) - model.testNbSubFeatures(self.mySketch, "SketchLine", 4) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 2) - - def test_ellipse_with_fixed_center(self): - """ Test 3. Create ellipse which center is coincident with another point - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse(aLine.endPoint(), self.myFocus, self.myPassedPoint, True) - self.myDOF += 3 - model.do() - # check ellipse - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - self.checkPointsEqual(anEllipse.center(), aLine.endPoint()) - self.checkPointOnEllipse(self.myPassedPoint, anEllipse) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_ellipse_with_center_on_line(self): - """ Test 4. Create ellipse which center is coincident with a line - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse([self.myCenter, aLine.result()], self.myFocus, self.myPassedPoint, True) - self.myDOF += 4 - model.do() - - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - # check center on line - self.checkPointOnLine(anEllipse.center(), aLine) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_ellipse_with_center_on_circle(self): - """ Test 5. Create ellipse which center is coincident with a circle - """ - aCircle = self.mySketch.addCircle(10, 10, 20) - self.myDOF += 3 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse([self.myCenter, aCircle.defaultResult()], self.myFocus, self.myPassedPoint, True) - self.myDOF += 4 - model.do() - - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - # check center on circle - self.checkPointOnCircle(anEllipse.center(), aCircle) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 2) - model.testNbSubFeatures(self.mySketch, "SketchCircle", 1) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_ellipse_with_center_on_ellipse(self): - """ Test 6. Create ellipse which center is coincident with another ellipse - """ - anOtherEllipse = self.mySketch.addEllipse(10, 10, 30, 20, 10) - self.myDOF += 5 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse([self.myCenter, anOtherEllipse.defaultResult()], self.myFocus, self.myPassedPoint, True) - self.myDOF += 4 - model.do() - - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - # check center on ellipse - self.checkPointOnEllipse(anEllipse.center(), anOtherEllipse) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 2) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 2) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_ellipse_with_fixed_axis(self): - """ Test 7. Create ellipse which point on major semi-axis is coincident with another point - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse(self.myCenter, aLine.endPoint(), self.myPassedPoint, True) - self.myDOF += 3 - model.do() - # check ellipse - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - self.checkPointOnEllipse(self.myPassedPoint, anEllipse) - self.checkPointOnEllipse(aLine.endPoint(), anEllipse) - # check distance is equal to major semi-axis - dist = model.distancePointPoint(GeomAPI_Pnt2d(anEllipse.center().x(), anEllipse.center().y()), aLine.endPoint()) - self.assertAlmostEqual(dist, anEllipse.majorRadius(), 7) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_ellipse_with_axis_on_line(self): - """ Test 8. Create ellipse which point on major semi-axis is coincident with a line - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse(self.myCenter, [self.myFocus, aLine.result()], self.myPassedPoint, True) - self.myDOF += 4 - model.do() - - anEllipse = SketchAPI_Ellipse(model.lastSubFeature(self.mySketch, "SketchEllipse")) - # check axis point on line - self.checkPointOnLine(anEllipse.majorAxisPositive(), aLine) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_ellipse_with_axis_on_circle(self): - """ Test 9. Create ellipse which point on major semi-axis is coincident with a circle - """ - aCircle = self.mySketch.addCircle(10, 10, 20) - self.myDOF += 3 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse(self.myCenter, [self.myFocus, aCircle.defaultResult()], self.myPassedPoint, True) - self.myDOF += 4 - model.do() - - anEllipse = SketchAPI_Ellipse(model.lastSubFeature(self.mySketch, "SketchEllipse")) - # check center on circle - self.checkPointOnCircle(anEllipse.majorAxisPositive(), aCircle) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 2) - model.testNbSubFeatures(self.mySketch, "SketchCircle", 1) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_ellipse_with_axis_on_ellipse(self): - """ Test 10. Create ellipse which point on major semi-axis is coincident with another ellipse - """ - anOtherEllipse = self.mySketch.addEllipse(10, 10, 90, 40, 30) - self.myDOF += 5 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse(self.myCenter, [self.myFocus, anOtherEllipse.defaultResult()], self.myPassedPoint, True) - self.myDOF += 4 - model.do() - - anEllipse = SketchAPI_Ellipse(model.lastSubFeature(self.mySketch, "SketchEllipse")) - # check center on ellipse - self.checkPointOnEllipse(anEllipse.majorAxisPositive(), anOtherEllipse) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 2) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 2) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_ellipse_with_fixed_passed_point(self): - """ Test 11. Create ellipse which passed point is coincident with another point - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse(self.myCenter, self.myFocus, aLine.endPoint(), True) - self.myDOF += 4 - model.do() - # check ellipse - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - self.checkPointOnEllipse(aLine.endPoint(), anEllipse) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_ellipse_with_passed_point_on_line(self): - """ Test 12. Create ellipse which passed point is placed on a line. - Check no constraints is applied. - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse(self.myCenter, self.myFocus, [self.myPassedPoint, aLine.result()], True) - self.myDOF += 5 - model.do() - - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - self.checkPointOnEllipse(self.myPassedPoint, anEllipse) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - # check neither coincidence nor tangent feature exists - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 0) - model.testNbSubFeatures(self.mySketch, "SketchConstraintTangent", 0) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myCenter = GeomAPI_Pnt2d(50.0, 50.0) + self.myFocus = GeomAPI_Pnt2d(70.0, 50.0) + self.myPassedPoint = GeomAPI_Pnt2d(60.0, 60.0) + self.myMinorRadius = 20.0 + self.myDOF = 0 + + def tearDown(self): + self.checkDOF() + model.end() + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointsEqual(self, thePoint1, thePoint2): + self.assertAlmostEqual(thePoint1.x(), thePoint2.x(), 5) + self.assertAlmostEqual(thePoint1.y(), thePoint2.y(), 5) + + def checkPointOnLine(self, theCoordinates, theLine): + point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) + dist = model.distancePointLine(point, theLine) + self.assertAlmostEqual(dist, 0, 7) + + def checkPointOnCircle(self, theCoordinates, theCircle): + point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) + dist = model.distancePointPoint(point, theCircle.center()) + self.assertAlmostEqual(dist, theCircle.radius().value(), 7) + + def checkPointOnEllipse(self, theCoordinates, theEllipse): + point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) + firstFocus2d = GeomAPI_Pnt2d( + theEllipse.firstFocus().x(), theEllipse.firstFocus().y() + ) + distPF1 = model.distancePointPoint(firstFocus2d, point) + secondFocus2d = GeomAPI_Pnt2d( + theEllipse.secondFocus().x(), theEllipse.secondFocus().y() + ) + distPF2 = model.distancePointPoint(secondFocus2d, point) + if issubclass(type(theEllipse), SketchAPI_Ellipse): + majorRad = theEllipse.majorRadius().value() + else: + majorRad = theEllipse.majorRadius() + self.assertAlmostEqual(distPF1 + distPF2, 2.0 * majorRad, 7) + + def test_ellipse_by_center_and_focus(self): + """Test 1. Create ellipse by coordinates of center, focus and minor radius""" + self.myEllipse1 = self.mySketch.addEllipse( + self.myCenter.x(), + self.myCenter.y(), + self.myFocus.x(), + self.myFocus.y(), + self.myMinorRadius, + ) + self.myDOF += 5 + + self.myEllipse2 = self.mySketch.addEllipse( + self.myCenter, self.myFocus, self.myMinorRadius + ) + self.myDOF += 5 + model.do() + + # check both ellipses are equal + anEllipse1 = self.myEllipse1.defaultResult().shape().edge().ellipse() + anEllipse2 = self.myEllipse2.defaultResult().shape().edge().ellipse() + self.checkPointsEqual(anEllipse1.center(), anEllipse2.center()) + self.checkPointsEqual(anEllipse1.firstFocus(), anEllipse2.firstFocus()) + self.checkPointsEqual(anEllipse1.secondFocus(), anEllipse2.secondFocus()) + self.assertAlmostEqual(anEllipse1.minorRadius(), anEllipse2.minorRadius()) + self.assertAlmostEqual(anEllipse1.majorRadius(), anEllipse2.majorRadius()) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 0) + model.testNbSubFeatures(self.mySketch, "SketchLine", 0) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 2) + + def test_ellipse_by_semiaxis_and_passed(self): + """Test 2. Create ellipse by coordinates of center, major semi-axis point and a passed point on ellipse""" + self.myEllipse1 = self.mySketch.addEllipse( + self.myCenter.x(), + self.myCenter.y(), + self.myFocus.x(), + self.myFocus.y(), + self.myPassedPoint.x(), + self.myPassedPoint.y(), + True, + ) + self.myDOF += 5 + model.do() + anEllipseFeature1 = model.lastSubFeature(self.mySketch, "SketchEllipse") + + self.myEllipse2 = self.mySketch.addEllipse( + self.myCenter, self.myFocus, self.myPassedPoint, True + ) + self.myDOF += 5 + model.do() + anEllipseFeature2 = model.lastSubFeature(self.mySketch, "SketchEllipse") + + # check both ellipses are equal + anEllipse1 = anEllipseFeature1.lastResult().shape().edge().ellipse() + anEllipse2 = anEllipseFeature2.lastResult().shape().edge().ellipse() + self.checkPointsEqual(anEllipse1.center(), anEllipse2.center()) + self.checkPointsEqual(anEllipse1.firstFocus(), anEllipse2.firstFocus()) + self.checkPointsEqual(anEllipse1.secondFocus(), anEllipse2.secondFocus()) + self.assertAlmostEqual(anEllipse1.minorRadius(), anEllipse2.minorRadius()) + self.assertAlmostEqual(anEllipse1.majorRadius(), anEllipse2.majorRadius()) + # check passed point on ellipse + self.checkPointOnEllipse(self.myPassedPoint, anEllipse1) + self.checkPointOnEllipse(self.myPassedPoint, anEllipse2) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 14) + model.testNbSubFeatures(self.mySketch, "SketchLine", 4) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 2) + + def test_ellipse_with_fixed_center(self): + """Test 3. Create ellipse which center is coincident with another point""" + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + aLine.endPoint(), self.myFocus, self.myPassedPoint, True + ) + self.myDOF += 3 + model.do() + # check ellipse + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + self.checkPointsEqual(anEllipse.center(), aLine.endPoint()) + self.checkPointOnEllipse(self.myPassedPoint, anEllipse) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_ellipse_with_center_on_line(self): + """Test 4. Create ellipse which center is coincident with a line""" + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + [self.myCenter, aLine.result()], self.myFocus, self.myPassedPoint, True + ) + self.myDOF += 4 + model.do() + + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + # check center on line + self.checkPointOnLine(anEllipse.center(), aLine) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_ellipse_with_center_on_circle(self): + """Test 5. Create ellipse which center is coincident with a circle""" + aCircle = self.mySketch.addCircle(10, 10, 20) + self.myDOF += 3 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + [self.myCenter, aCircle.defaultResult()], + self.myFocus, + self.myPassedPoint, + True, + ) + self.myDOF += 4 + model.do() + + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + # check center on circle + self.checkPointOnCircle(anEllipse.center(), aCircle) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 2) + model.testNbSubFeatures(self.mySketch, "SketchCircle", 1) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_ellipse_with_center_on_ellipse(self): + """Test 6. Create ellipse which center is coincident with another ellipse""" + anOtherEllipse = self.mySketch.addEllipse(10, 10, 30, 20, 10) + self.myDOF += 5 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + [self.myCenter, anOtherEllipse.defaultResult()], + self.myFocus, + self.myPassedPoint, + True, + ) + self.myDOF += 4 + model.do() + + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + # check center on ellipse + self.checkPointOnEllipse(anEllipse.center(), anOtherEllipse) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 2) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 2) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_ellipse_with_fixed_axis(self): + """Test 7. Create ellipse which point on major semi-axis is coincident with another point""" + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + self.myCenter, aLine.endPoint(), self.myPassedPoint, True + ) + self.myDOF += 3 + model.do() + # check ellipse + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + self.checkPointOnEllipse(self.myPassedPoint, anEllipse) + self.checkPointOnEllipse(aLine.endPoint(), anEllipse) + # check distance is equal to major semi-axis + dist = model.distancePointPoint( + GeomAPI_Pnt2d(anEllipse.center().x(), anEllipse.center().y()), + aLine.endPoint(), + ) + self.assertAlmostEqual(dist, anEllipse.majorRadius(), 7) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_ellipse_with_axis_on_line(self): + """Test 8. Create ellipse which point on major semi-axis is coincident with a line""" + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + self.myCenter, [self.myFocus, aLine.result()], self.myPassedPoint, True + ) + self.myDOF += 4 + model.do() + + anEllipse = SketchAPI_Ellipse( + model.lastSubFeature(self.mySketch, "SketchEllipse") + ) + # check axis point on line + self.checkPointOnLine(anEllipse.majorAxisPositive(), aLine) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_ellipse_with_axis_on_circle(self): + """Test 9. Create ellipse which point on major semi-axis is coincident with a circle""" + aCircle = self.mySketch.addCircle(10, 10, 20) + self.myDOF += 3 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + self.myCenter, + [self.myFocus, aCircle.defaultResult()], + self.myPassedPoint, + True, + ) + self.myDOF += 4 + model.do() + + anEllipse = SketchAPI_Ellipse( + model.lastSubFeature(self.mySketch, "SketchEllipse") + ) + # check center on circle + self.checkPointOnCircle(anEllipse.majorAxisPositive(), aCircle) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 2) + model.testNbSubFeatures(self.mySketch, "SketchCircle", 1) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_ellipse_with_axis_on_ellipse(self): + """Test 10. Create ellipse which point on major semi-axis is coincident with another ellipse""" + anOtherEllipse = self.mySketch.addEllipse(10, 10, 90, 40, 30) + self.myDOF += 5 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + self.myCenter, + [self.myFocus, anOtherEllipse.defaultResult()], + self.myPassedPoint, + True, + ) + self.myDOF += 4 + model.do() + + anEllipse = SketchAPI_Ellipse( + model.lastSubFeature(self.mySketch, "SketchEllipse") + ) + # check center on ellipse + self.checkPointOnEllipse(anEllipse.majorAxisPositive(), anOtherEllipse) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 2) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 2) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_ellipse_with_fixed_passed_point(self): + """Test 11. Create ellipse which passed point is coincident with another point""" + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + self.myCenter, self.myFocus, aLine.endPoint(), True + ) + self.myDOF += 4 + model.do() + # check ellipse + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + self.checkPointOnEllipse(aLine.endPoint(), anEllipse) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_ellipse_with_passed_point_on_line(self): + """Test 12. Create ellipse which passed point is placed on a line. + Check no constraints is applied. + """ + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + self.myCenter, self.myFocus, [self.myPassedPoint, aLine.result()], True + ) + self.myDOF += 5 + model.do() + + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + self.checkPointOnEllipse(self.myPassedPoint, anEllipse) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + # check neither coincidence nor tangent feature exists + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 0) + model.testNbSubFeatures(self.mySketch, "SketchConstraintTangent", 0) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestCreateEllipseByExternal.py b/src/SketchPlugin/Test/TestCreateEllipseByExternal.py index 4c6b801f6..a6d40441c 100644 --- a/src/SketchPlugin/Test/TestCreateEllipseByExternal.py +++ b/src/SketchPlugin/Test/TestCreateEllipseByExternal.py @@ -30,53 +30,50 @@ from SketchAPI import * __updated__ = "2019-09-12" # reference data -CENTER_POINT = GeomAPI_Pnt2d(50., 50.) -FOCUS_POINT = GeomAPI_Pnt2d(70., 60.) -MINOR_RADIUS = 10. +CENTER_POINT = GeomAPI_Pnt2d(50.0, 50.0) +FOCUS_POINT = GeomAPI_Pnt2d(70.0, 60.0) +MINOR_RADIUS = 10.0 -class TestEllipse(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myDOF = 0 - - def tearDown(self): - self.checkDOF() - model.end() - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - def checkPointsEqual(self, thePoint1, thePoint2): - self.assertAlmostEqual(thePoint1.x(), thePoint2.x(), 5) - self.assertAlmostEqual(thePoint1.y(), thePoint2.y(), 5) - - - def test_ellipse_by_external_name(self): - """ Test 1. Create ellipse by name of external edge - """ - self.myEllipse = self.mySketch.addEllipse("Sketch_1/SketchEllipse_1") - model.do() - - # check ellipse parameters - anEllipse = self.myEllipse.defaultResult().shape().edge().ellipse() - self.checkPointsEqual(anEllipse.center(), CENTER_POINT) - self.checkPointsEqual(anEllipse.firstFocus(), FOCUS_POINT) - self.assertAlmostEqual(anEllipse.minorRadius(), MINOR_RADIUS) - - def test_ellipse_by_external_selection(self): - """ Test 2. Create ellipse by selected edge - """ - self.myEllipse = self.mySketch.addEllipse(ELLIPSE.results()[-1]) - model.do() - - # check ellipse parameters - anEllipse = self.myEllipse.defaultResult().shape().edge().ellipse() - self.checkPointsEqual(anEllipse.center(), CENTER_POINT) - self.checkPointsEqual(anEllipse.firstFocus(), FOCUS_POINT) - self.assertAlmostEqual(anEllipse.minorRadius(), MINOR_RADIUS) +class TestEllipse(unittest.TestCase): + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myDOF = 0 + + def tearDown(self): + self.checkDOF() + model.end() + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointsEqual(self, thePoint1, thePoint2): + self.assertAlmostEqual(thePoint1.x(), thePoint2.x(), 5) + self.assertAlmostEqual(thePoint1.y(), thePoint2.y(), 5) + + def test_ellipse_by_external_name(self): + """Test 1. Create ellipse by name of external edge""" + self.myEllipse = self.mySketch.addEllipse("Sketch_1/SketchEllipse_1") + model.do() + + # check ellipse parameters + anEllipse = self.myEllipse.defaultResult().shape().edge().ellipse() + self.checkPointsEqual(anEllipse.center(), CENTER_POINT) + self.checkPointsEqual(anEllipse.firstFocus(), FOCUS_POINT) + self.assertAlmostEqual(anEllipse.minorRadius(), MINOR_RADIUS) + + def test_ellipse_by_external_selection(self): + """Test 2. Create ellipse by selected edge""" + self.myEllipse = self.mySketch.addEllipse(ELLIPSE.results()[-1]) + model.do() + + # check ellipse parameters + anEllipse = self.myEllipse.defaultResult().shape().edge().ellipse() + self.checkPointsEqual(anEllipse.center(), CENTER_POINT) + self.checkPointsEqual(anEllipse.firstFocus(), FOCUS_POINT) + self.assertAlmostEqual(anEllipse.minorRadius(), MINOR_RADIUS) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestCreateEllipseByMajorAxisAndPassed.py b/src/SketchPlugin/Test/TestCreateEllipseByMajorAxisAndPassed.py index 2b7f01a93..86bda9158 100644 --- a/src/SketchPlugin/Test/TestCreateEllipseByMajorAxisAndPassed.py +++ b/src/SketchPlugin/Test/TestCreateEllipseByMajorAxisAndPassed.py @@ -29,288 +29,356 @@ from SketchAPI import * __updated__ = "2019-09-12" + class TestEllipse(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myAxisStart = GeomAPI_Pnt2d(30., 60.) - self.myAxisEnd = GeomAPI_Pnt2d(80., 50.) - self.myPassedPoint = GeomAPI_Pnt2d(60., 60.) - self.myDOF = 0 - - def tearDown(self): - self.checkDOF() - model.end() - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkPointsEqual(self, thePoint1, thePoint2): - self.assertAlmostEqual(thePoint1.x(), thePoint2.x(), 5) - self.assertAlmostEqual(thePoint1.y(), thePoint2.y(), 5) - - def checkPointOnLine(self, theCoordinates, theLine): - point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) - dist = model.distancePointLine(point, theLine) - self.assertAlmostEqual(dist, 0, 7) - - def checkPointOnCircle(self, theCoordinates, theCircle): - point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) - dist = model.distancePointPoint(point, theCircle.center()) - self.assertAlmostEqual(dist , theCircle.radius().value(), 7) - - def checkPointOnEllipse(self, theCoordinates, theEllipse): - point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) - firstFocus2d = GeomAPI_Pnt2d(theEllipse.firstFocus().x(), theEllipse.firstFocus().y()) - distPF1 = model.distancePointPoint(firstFocus2d, point) - secondFocus2d = GeomAPI_Pnt2d(theEllipse.secondFocus().x(), theEllipse.secondFocus().y()) - distPF2 = model.distancePointPoint(secondFocus2d, point) - self.assertAlmostEqual(distPF1 + distPF2, 2.0 * theEllipse.majorRadius(), 7) - - - def test_ellipse_by_axis_and_passed(self): - """ Test 1. Create ellipse by points defining major semi-axis and a passed point on ellipse - """ - self.myEllipse1 = self.mySketch.addEllipse(self.myAxisStart.x(), self.myAxisStart.y(), self.myAxisEnd.x(), self.myAxisEnd.y(), self.myPassedPoint.x(), self.myPassedPoint.y(), False) - self.myDOF += 5 - model.do() - anEllipseFeature1 = model.lastSubFeature(self.mySketch, "SketchEllipse") - - self.myEllipse2 = self.mySketch.addEllipse(self.myAxisStart, self.myAxisEnd, self.myPassedPoint, False) - self.myDOF += 5 - model.do() - anEllipseFeature2 = model.lastSubFeature(self.mySketch, "SketchEllipse") - - # check both ellipses are equal - anEllipse1 = anEllipseFeature1.lastResult().shape().edge().ellipse() - anEllipse2 = anEllipseFeature2.lastResult().shape().edge().ellipse() - self.checkPointsEqual(anEllipse1.center(), anEllipse2.center()) - self.checkPointsEqual(anEllipse1.firstFocus(), anEllipse2.firstFocus()) - self.checkPointsEqual(anEllipse1.secondFocus(), anEllipse2.secondFocus()) - self.assertAlmostEqual(anEllipse1.minorRadius(), anEllipse2.minorRadius()) - self.assertAlmostEqual(anEllipse1.majorRadius(), anEllipse2.majorRadius()) - # check passed point on ellipse - self.checkPointOnEllipse(self.myPassedPoint, anEllipse1) - self.checkPointOnEllipse(self.myPassedPoint, anEllipse2) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 14) - model.testNbSubFeatures(self.mySketch, "SketchLine", 4) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 2) - - def test_ellipse_with_fixed_axis_start(self): - """ Test 2. Create ellipse which negative point on the major axis coincident with another point - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse(aLine.startPoint(), self.myAxisEnd, self.myPassedPoint, False) - self.myDOF += 3 - model.do() - # check ellipse - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - self.checkPointOnEllipse(self.myPassedPoint, anEllipse) - self.checkPointOnEllipse(aLine.startPoint(), anEllipse) - # check distance is equal to major semi-axis - dist = model.distancePointPoint(GeomAPI_Pnt2d(anEllipse.center().x(), anEllipse.center().y()), aLine.startPoint()) - self.assertAlmostEqual(dist, anEllipse.majorRadius(), 7) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_ellipse_with_axis_start_on_line(self): - """ Test 3. Create ellipse which negative point on the major axis coincident with a line - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse([self.myAxisStart, aLine.result()], self.myAxisEnd, self.myPassedPoint, False) - self.myDOF += 4 - model.do() - - anEllipse = SketchAPI_Ellipse(model.lastSubFeature(self.mySketch, "SketchEllipse")) - # check negative point of major axis on line - self.checkPointOnLine(anEllipse.majorAxisNegative(), aLine) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_ellipse_with_axis_start_on_circle(self): - """ Test 4. Create ellipse which negative point on the major axis coincident with a circle - """ - aCircle = self.mySketch.addCircle(10, 10, 20) - self.myDOF += 3 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse([self.myAxisStart, aCircle.defaultResult()], self.myAxisEnd, self.myPassedPoint, False) - self.myDOF += 4 - model.do() - - anEllipse = SketchAPI_Ellipse(model.lastSubFeature(self.mySketch, "SketchEllipse")) - # check center on circle - self.checkPointOnCircle(anEllipse.majorAxisNegative(), aCircle) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 2) - model.testNbSubFeatures(self.mySketch, "SketchCircle", 1) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_ellipse_with_axis_start_on_ellipse(self): - """ Test 5. Create ellipse which negative point on the major axis coincident with another ellipse - """ - anOtherEllipse = self.mySketch.addEllipse(10, 10, 30, 20, 10) - self.myDOF += 5 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse([self.myAxisStart, anOtherEllipse.defaultResult()], self.myAxisEnd, self.myPassedPoint, False) - self.myDOF += 4 - model.do() - - anEllipse = SketchAPI_Ellipse(model.lastSubFeature(self.mySketch, "SketchEllipse")) - # check center on ellipse - self.checkPointOnEllipse(anEllipse.majorAxisNegative(), anOtherEllipse.defaultResult().shape().edge().ellipse()) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 2) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 2) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_ellipse_with_fixed_axis_end(self): - """ Test 6. Create ellipse which positive point on the major axis coincident with another point - """ - aLine = self.mySketch.addLine(10, 10, 90, 40) - self.myDOF += 4 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse(self.myAxisStart, aLine.endPoint(), self.myPassedPoint, False) - self.myDOF += 3 - model.do() - # check ellipse - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - self.checkPointOnEllipse(self.myPassedPoint, anEllipse) - self.checkPointOnEllipse(aLine.endPoint(), anEllipse) - # check distance is equal to major semi-axis - dist = model.distancePointPoint(GeomAPI_Pnt2d(anEllipse.center().x(), anEllipse.center().y()), aLine.endPoint()) - self.assertAlmostEqual(dist, anEllipse.majorRadius(), 7) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_ellipse_with_axis_end_on_line(self): - """ Test 7. Create ellipse which negative point on the major axis coincident with a line - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse(self.myAxisStart, [self.myAxisEnd, aLine.result()], self.myPassedPoint, False) - self.myDOF += 4 - model.do() - - anEllipse = SketchAPI_Ellipse(model.lastSubFeature(self.mySketch, "SketchEllipse")) - # check axis point on line - self.checkPointOnLine(anEllipse.majorAxisPositive(), aLine) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_ellipse_with_axis_end_on_circle(self): - """ Test 8. Create ellipse which negative point on the major axis coincident with a circle - """ - aCircle = self.mySketch.addCircle(10, 10, 20) - self.myDOF += 3 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse(self.myAxisStart, [self.myAxisEnd, aCircle.defaultResult()], self.myPassedPoint, False) - self.myDOF += 4 - model.do() - - anEllipse = SketchAPI_Ellipse(model.lastSubFeature(self.mySketch, "SketchEllipse")) - # check center on circle - self.checkPointOnCircle(anEllipse.majorAxisPositive(), aCircle) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 2) - model.testNbSubFeatures(self.mySketch, "SketchCircle", 1) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_ellipse_with_axis_end_on_ellipse(self): - """ Test 9. Create ellipse which negative point on the major axis coincident with another ellipse - """ - anOtherEllipse = self.mySketch.addEllipse(10, 10, 90, 40, 30) - self.myDOF += 5 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse(self.myAxisStart, [self.myAxisEnd, anOtherEllipse.defaultResult()], self.myPassedPoint, False) - self.myDOF += 4 - model.do() - - anEllipse = SketchAPI_Ellipse(model.lastSubFeature(self.mySketch, "SketchEllipse")) - # check center on ellipse - self.checkPointOnEllipse(anEllipse.majorAxisPositive(), anOtherEllipse.defaultResult().shape().edge().ellipse()) - # check coincidence feature exists - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 2) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 2) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_ellipse_with_fixed_passed_point(self): - """ Test 10. Create ellipse which passed point is coincident with another point - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse(self.myAxisStart, self.myAxisEnd, aLine.endPoint(), False) - self.myDOF += 4 - model.do() - # check ellipse - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - self.checkPointOnEllipse(aLine.endPoint(), anEllipse) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_ellipse_with_passed_point_on_line(self): - """ Test 11. Create ellipse which passed point is placed on a line. - Check no constraints is applied. - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.myEllipse1 = self.mySketch.addEllipse(self.myAxisStart, self.myAxisEnd, [self.myPassedPoint, aLine.result()], False) - self.myDOF += 5 - model.do() - - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - self.checkPointOnEllipse(self.myPassedPoint, anEllipse) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - # check neither coincidence nor tangent feature exists - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 0) - model.testNbSubFeatures(self.mySketch, "SketchConstraintTangent", 0) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myAxisStart = GeomAPI_Pnt2d(30.0, 60.0) + self.myAxisEnd = GeomAPI_Pnt2d(80.0, 50.0) + self.myPassedPoint = GeomAPI_Pnt2d(60.0, 60.0) + self.myDOF = 0 + + def tearDown(self): + self.checkDOF() + model.end() + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointsEqual(self, thePoint1, thePoint2): + self.assertAlmostEqual(thePoint1.x(), thePoint2.x(), 5) + self.assertAlmostEqual(thePoint1.y(), thePoint2.y(), 5) + + def checkPointOnLine(self, theCoordinates, theLine): + point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) + dist = model.distancePointLine(point, theLine) + self.assertAlmostEqual(dist, 0, 7) + + def checkPointOnCircle(self, theCoordinates, theCircle): + point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) + dist = model.distancePointPoint(point, theCircle.center()) + self.assertAlmostEqual(dist, theCircle.radius().value(), 7) + + def checkPointOnEllipse(self, theCoordinates, theEllipse): + point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) + firstFocus2d = GeomAPI_Pnt2d( + theEllipse.firstFocus().x(), theEllipse.firstFocus().y() + ) + distPF1 = model.distancePointPoint(firstFocus2d, point) + secondFocus2d = GeomAPI_Pnt2d( + theEllipse.secondFocus().x(), theEllipse.secondFocus().y() + ) + distPF2 = model.distancePointPoint(secondFocus2d, point) + self.assertAlmostEqual(distPF1 + distPF2, 2.0 * theEllipse.majorRadius(), 7) + + def test_ellipse_by_axis_and_passed(self): + """Test 1. Create ellipse by points defining major semi-axis and a passed point on ellipse""" + self.myEllipse1 = self.mySketch.addEllipse( + self.myAxisStart.x(), + self.myAxisStart.y(), + self.myAxisEnd.x(), + self.myAxisEnd.y(), + self.myPassedPoint.x(), + self.myPassedPoint.y(), + False, + ) + self.myDOF += 5 + model.do() + anEllipseFeature1 = model.lastSubFeature(self.mySketch, "SketchEllipse") + + self.myEllipse2 = self.mySketch.addEllipse( + self.myAxisStart, self.myAxisEnd, self.myPassedPoint, False + ) + self.myDOF += 5 + model.do() + anEllipseFeature2 = model.lastSubFeature(self.mySketch, "SketchEllipse") + + # check both ellipses are equal + anEllipse1 = anEllipseFeature1.lastResult().shape().edge().ellipse() + anEllipse2 = anEllipseFeature2.lastResult().shape().edge().ellipse() + self.checkPointsEqual(anEllipse1.center(), anEllipse2.center()) + self.checkPointsEqual(anEllipse1.firstFocus(), anEllipse2.firstFocus()) + self.checkPointsEqual(anEllipse1.secondFocus(), anEllipse2.secondFocus()) + self.assertAlmostEqual(anEllipse1.minorRadius(), anEllipse2.minorRadius()) + self.assertAlmostEqual(anEllipse1.majorRadius(), anEllipse2.majorRadius()) + # check passed point on ellipse + self.checkPointOnEllipse(self.myPassedPoint, anEllipse1) + self.checkPointOnEllipse(self.myPassedPoint, anEllipse2) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 14) + model.testNbSubFeatures(self.mySketch, "SketchLine", 4) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 2) + + def test_ellipse_with_fixed_axis_start(self): + """Test 2. Create ellipse which negative point on the major axis coincident with another point""" + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + aLine.startPoint(), self.myAxisEnd, self.myPassedPoint, False + ) + self.myDOF += 3 + model.do() + # check ellipse + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + self.checkPointOnEllipse(self.myPassedPoint, anEllipse) + self.checkPointOnEllipse(aLine.startPoint(), anEllipse) + # check distance is equal to major semi-axis + dist = model.distancePointPoint( + GeomAPI_Pnt2d(anEllipse.center().x(), anEllipse.center().y()), + aLine.startPoint(), + ) + self.assertAlmostEqual(dist, anEllipse.majorRadius(), 7) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_ellipse_with_axis_start_on_line(self): + """Test 3. Create ellipse which negative point on the major axis coincident with a line""" + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + [self.myAxisStart, aLine.result()], + self.myAxisEnd, + self.myPassedPoint, + False, + ) + self.myDOF += 4 + model.do() + + anEllipse = SketchAPI_Ellipse( + model.lastSubFeature(self.mySketch, "SketchEllipse") + ) + # check negative point of major axis on line + self.checkPointOnLine(anEllipse.majorAxisNegative(), aLine) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_ellipse_with_axis_start_on_circle(self): + """Test 4. Create ellipse which negative point on the major axis coincident with a circle""" + aCircle = self.mySketch.addCircle(10, 10, 20) + self.myDOF += 3 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + [self.myAxisStart, aCircle.defaultResult()], + self.myAxisEnd, + self.myPassedPoint, + False, + ) + self.myDOF += 4 + model.do() + + anEllipse = SketchAPI_Ellipse( + model.lastSubFeature(self.mySketch, "SketchEllipse") + ) + # check center on circle + self.checkPointOnCircle(anEllipse.majorAxisNegative(), aCircle) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 2) + model.testNbSubFeatures(self.mySketch, "SketchCircle", 1) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_ellipse_with_axis_start_on_ellipse(self): + """Test 5. Create ellipse which negative point on the major axis coincident with another ellipse""" + anOtherEllipse = self.mySketch.addEllipse(10, 10, 30, 20, 10) + self.myDOF += 5 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + [self.myAxisStart, anOtherEllipse.defaultResult()], + self.myAxisEnd, + self.myPassedPoint, + False, + ) + self.myDOF += 4 + model.do() + + anEllipse = SketchAPI_Ellipse( + model.lastSubFeature(self.mySketch, "SketchEllipse") + ) + # check center on ellipse + self.checkPointOnEllipse( + anEllipse.majorAxisNegative(), + anOtherEllipse.defaultResult().shape().edge().ellipse(), + ) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 2) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 2) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_ellipse_with_fixed_axis_end(self): + """Test 6. Create ellipse which positive point on the major axis coincident with another point""" + aLine = self.mySketch.addLine(10, 10, 90, 40) + self.myDOF += 4 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + self.myAxisStart, aLine.endPoint(), self.myPassedPoint, False + ) + self.myDOF += 3 + model.do() + # check ellipse + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + self.checkPointOnEllipse(self.myPassedPoint, anEllipse) + self.checkPointOnEllipse(aLine.endPoint(), anEllipse) + # check distance is equal to major semi-axis + dist = model.distancePointPoint( + GeomAPI_Pnt2d(anEllipse.center().x(), anEllipse.center().y()), + aLine.endPoint(), + ) + self.assertAlmostEqual(dist, anEllipse.majorRadius(), 7) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_ellipse_with_axis_end_on_line(self): + """Test 7. Create ellipse which negative point on the major axis coincident with a line""" + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + self.myAxisStart, + [self.myAxisEnd, aLine.result()], + self.myPassedPoint, + False, + ) + self.myDOF += 4 + model.do() + + anEllipse = SketchAPI_Ellipse( + model.lastSubFeature(self.mySketch, "SketchEllipse") + ) + # check axis point on line + self.checkPointOnLine(anEllipse.majorAxisPositive(), aLine) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_ellipse_with_axis_end_on_circle(self): + """Test 8. Create ellipse which negative point on the major axis coincident with a circle""" + aCircle = self.mySketch.addCircle(10, 10, 20) + self.myDOF += 3 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + self.myAxisStart, + [self.myAxisEnd, aCircle.defaultResult()], + self.myPassedPoint, + False, + ) + self.myDOF += 4 + model.do() + + anEllipse = SketchAPI_Ellipse( + model.lastSubFeature(self.mySketch, "SketchEllipse") + ) + # check center on circle + self.checkPointOnCircle(anEllipse.majorAxisPositive(), aCircle) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 2) + model.testNbSubFeatures(self.mySketch, "SketchCircle", 1) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_ellipse_with_axis_end_on_ellipse(self): + """Test 9. Create ellipse which negative point on the major axis coincident with another ellipse""" + anOtherEllipse = self.mySketch.addEllipse(10, 10, 90, 40, 30) + self.myDOF += 5 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + self.myAxisStart, + [self.myAxisEnd, anOtherEllipse.defaultResult()], + self.myPassedPoint, + False, + ) + self.myDOF += 4 + model.do() + + anEllipse = SketchAPI_Ellipse( + model.lastSubFeature(self.mySketch, "SketchEllipse") + ) + # check center on ellipse + self.checkPointOnEllipse( + anEllipse.majorAxisPositive(), + anOtherEllipse.defaultResult().shape().edge().ellipse(), + ) + # check coincidence feature exists + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 2) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 2) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_ellipse_with_fixed_passed_point(self): + """Test 10. Create ellipse which passed point is coincident with another point""" + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + self.myAxisStart, self.myAxisEnd, aLine.endPoint(), False + ) + self.myDOF += 4 + model.do() + # check ellipse + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + self.checkPointOnEllipse(aLine.endPoint(), anEllipse) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_ellipse_with_passed_point_on_line(self): + """Test 11. Create ellipse which passed point is placed on a line. + Check no constraints is applied. + """ + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.myEllipse1 = self.mySketch.addEllipse( + self.myAxisStart, + self.myAxisEnd, + [self.myPassedPoint, aLine.result()], + False, + ) + self.myDOF += 5 + model.do() + + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipse") + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + self.checkPointOnEllipse(self.myPassedPoint, anEllipse) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + # check neither coincidence nor tangent feature exists + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 0) + model.testNbSubFeatures(self.mySketch, "SketchConstraintTangent", 0) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestCreateEllipticArc.py b/src/SketchPlugin/Test/TestCreateEllipticArc.py index 851eee9b2..92aca16b1 100644 --- a/src/SketchPlugin/Test/TestCreateEllipticArc.py +++ b/src/SketchPlugin/Test/TestCreateEllipticArc.py @@ -29,348 +29,409 @@ from SketchAPI import * __updated__ = "2019-10-01" + class TestEllipticArc(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myCenter = GeomAPI_Pnt2d(50., 50.) - self.myFocus = GeomAPI_Pnt2d(70., 60.) - self.myStartPoint = GeomAPI_Pnt2d(60., 65.) - self.myEndPoint = GeomAPI_Pnt2d(60., 42.535751) - self.myDOF = 0 - - def tearDown(self): - self.checkDOF() - model.end() - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkPointsEqual(self, thePoint1, thePoint2): - self.assertAlmostEqual(thePoint1.x(), thePoint2.x(), 5) - self.assertAlmostEqual(thePoint1.y(), thePoint2.y(), 5) - - def checkPointOnLine(self, theCoordinates, theLine): - point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) - dist = model.distancePointLine(point, theLine) - self.assertAlmostEqual(dist, 0, 7) - - def checkPointOnCircle(self, theCoordinates, theCircle): - point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) - dist = model.distancePointPoint(point, theCircle.center()) - self.assertAlmostEqual(dist , theCircle.radius().value(), 7) - - def checkPointOnEllipse(self, theCoordinates, theEllipse): - point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) - firstFocus2d = GeomAPI_Pnt2d(theEllipse.firstFocus().x(), theEllipse.firstFocus().y()) - distPF1 = model.distancePointPoint(firstFocus2d, point) - secondFocus2d = GeomAPI_Pnt2d(theEllipse.secondFocus().x(), theEllipse.secondFocus().y()) - distPF2 = model.distancePointPoint(secondFocus2d, point) - if issubclass(type(theEllipse), SketchAPI_Ellipse): - majorRad = theEllipse.majorRadius().value() - else: - majorRad = theEllipse.majorRadius() - self.assertAlmostEqual(distPF1 + distPF2, 2.0 * majorRad, 7) - - - def test_elliptic_arc_by_coordinates(self): - """ Test 1. Create elliptic arc by coordinates of center, point on the major axis, start and end points - """ - self.myEllipse1 = self.mySketch.addEllipticArc(self.myCenter.x(), self.myCenter.y(), - self.myFocus.x(), self.myFocus.y(), - self.myStartPoint.x(), self.myStartPoint.y(), - self.myEndPoint.x(), self.myEndPoint.y(), False) - self.myDOF += 7 - - self.myEllipse2 = self.mySketch.addEllipticArc(self.myCenter.x(), self.myCenter.y(), - self.myFocus.x(), self.myFocus.y(), - self.myStartPoint.x(), self.myStartPoint.y(), - self.myEndPoint.x(), self.myEndPoint.y(), True) - self.myDOF += 7 - model.do() - - # check both ellipses are equal - anArcEdge1 = self.myEllipse1.defaultResult().shape().edge() - anArcEdge2 = self.myEllipse2.defaultResult().shape().edge() - anEllipse1 = anArcEdge1.ellipse() - anEllipse2 = anArcEdge2.ellipse() - self.checkPointsEqual(anEllipse1.center(), anEllipse2.center()) - self.checkPointsEqual(anEllipse1.firstFocus(), anEllipse2.firstFocus()) - self.checkPointsEqual(anEllipse1.secondFocus(), anEllipse2.secondFocus()) - self.assertAlmostEqual(anEllipse1.minorRadius(), anEllipse2.minorRadius()) - self.assertAlmostEqual(anEllipse1.majorRadius(), anEllipse2.majorRadius()) - self.checkPointsEqual(self.myEllipse1.startPoint(), self.myEllipse2.startPoint()) - self.checkPointsEqual(self.myEllipse1.endPoint(), self.myEllipse2.endPoint()) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 0) - model.testNbSubFeatures(self.mySketch, "SketchLine", 0) - model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 2) - # check middle points are different - assert(anArcEdge1.middlePoint().x() < self.myStartPoint.x()) - assert(anArcEdge2.middlePoint().x() > self.myStartPoint.x()) - - def test_elliptic_arc_by_points(self): - """ Test 2. Create elliptic arc by points - """ - self.mySketch.addEllipticArc(self.myCenter, self.myFocus, self.myStartPoint, self.myEndPoint, False) - self.myDOF += 7 - model.do() - anEllipseFeature1 = model.lastSubFeature(self.mySketch, "SketchEllipticArc") - self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature1) - - self.mySketch.addEllipticArc(self.myCenter, self.myFocus, self.myStartPoint, self.myEndPoint, True) - self.myDOF += 7 - model.do() - anEllipseFeature2 = model.lastSubFeature(self.mySketch, "SketchEllipticArc") - self.myEllipse2 = SketchAPI_EllipticArc(anEllipseFeature2) - - # check both ellipses are equal - anArcEdge1 = anEllipseFeature1.lastResult().shape().edge() - anArcEdge2 = anEllipseFeature2.lastResult().shape().edge() - anEllipse1 = anArcEdge1.ellipse() - anEllipse2 = anArcEdge2.ellipse() - self.checkPointsEqual(anEllipse1.center(), anEllipse2.center()) - self.checkPointsEqual(anEllipse1.firstFocus(), anEllipse2.firstFocus()) - self.checkPointsEqual(anEllipse1.secondFocus(), anEllipse2.secondFocus()) - self.assertAlmostEqual(anEllipse1.minorRadius(), anEllipse2.minorRadius()) - self.assertAlmostEqual(anEllipse1.majorRadius(), anEllipse2.majorRadius()) - self.checkPointsEqual(self.myEllipse1.startPoint(), self.myEllipse2.startPoint()) - self.checkPointsEqual(self.myEllipse1.endPoint(), self.myEllipse2.endPoint()) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 14) - model.testNbSubFeatures(self.mySketch, "SketchLine", 4) - model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 2) - # check middle points are different - assert(anArcEdge1.middlePoint().x() < self.myStartPoint.x()) - assert(anArcEdge2.middlePoint().x() > self.myStartPoint.x()) - - def test_elliptic_arc_with_fixed_center(self): - """ Test 3. Create elliptic arc which center is coincident with another point - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.mySketch.addEllipticArc(aLine.endPoint(), self.myFocus, self.myStartPoint, self.myEndPoint, True) - self.myDOF += 5 - model.do() - # check ellipse - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipticArc") - self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature) - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - self.checkPointsEqual(anEllipse.center(), aLine.endPoint()) - self.checkPointOnEllipse(self.myStartPoint, anEllipse) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_elliptic_arc_with_center_on_line(self): - """ Test 4. Create elliptic arc which center is coincident with a line - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.mySketch.addEllipticArc([self.myCenter, aLine.result()], self.myFocus, self.myStartPoint, self.myEndPoint, False) - self.myDOF += 6 - model.do() - - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipticArc") - self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature) - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - # check center on line - self.checkPointOnLine(anEllipse.center(), aLine) - self.checkPointOnEllipse(self.myEllipse1.startPoint(), anEllipse) - self.checkPointOnEllipse(self.myEllipse1.endPoint(), anEllipse) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_elliptic_arc_with_center_on_circle(self): - """ Test 5. Create elliptic arc which center is coincident with a circle - """ - aCircle = self.mySketch.addCircle(10, 10, 20) - self.myDOF += 3 - model.do() - - self.mySketch.addEllipticArc([self.myCenter, aCircle.defaultResult()], self.myFocus, self.myStartPoint, self.myEndPoint, False) - self.myDOF += 6 - model.do() - - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipticArc") - self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature) - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - # check center on circle - self.checkPointOnCircle(anEllipse.center(), aCircle) - self.checkPointOnEllipse(self.myEllipse1.startPoint(), anEllipse) - self.checkPointOnEllipse(self.myEllipse1.endPoint(), anEllipse) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 2) - model.testNbSubFeatures(self.mySketch, "SketchCircle", 1) - model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_elliptic_arc_with_center_on_ellipse(self): - """ Test 6. Create elliptic arc which center is coincident with another ellipse - """ - anOtherEllipse = self.mySketch.addEllipse(10, 10, 30, 20, 10) - self.myDOF += 5 - model.do() - - self.mySketch.addEllipticArc([self.myCenter, anOtherEllipse.defaultResult()], self.myFocus, self.myStartPoint, self.myEndPoint, False) - self.myDOF += 6 - model.do() - - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipticArc") - self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature) - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - # check center on ellipse - self.checkPointOnEllipse(anEllipse.center(), anOtherEllipse) - self.checkPointOnEllipse(self.myEllipse1.startPoint(), anEllipse) - self.checkPointOnEllipse(self.myEllipse1.endPoint(), anEllipse) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 2) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) - model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_elliptic_arc_with_fixed_axis(self): - """ Test 7. Create elliptic arc which point on major semi-axis is coincident with another point - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.mySketch.addEllipticArc(self.myCenter, aLine.endPoint(), self.myStartPoint, self.myEndPoint, False) - self.myDOF += 6 - model.do() - # check ellipse - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipticArc") - self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature) - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - self.checkPointOnEllipse(self.myStartPoint, anEllipse) - self.checkPointOnEllipse(aLine.endPoint(), anEllipse) - # check distance is equal to major semi-axis - dist = model.distancePointPoint(GeomAPI_Pnt2d(anEllipse.center().x(), anEllipse.center().y()), aLine.endPoint()) - self.assertAlmostEqual(dist, anEllipse.majorRadius(), 7) - self.checkPointsEqual(self.myEllipse1.majorAxisPositive(), aLine.endPoint()) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_elliptic_arc_with_axis_on_line(self): - """ Test 8. Create elliptic arc which point on major semi-axis is coincident with a line. - Check no coincidence constraint is created. - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.mySketch.addEllipticArc(self.myCenter, [self.myFocus, aLine.result()], self.myStartPoint, self.myEndPoint, True) - self.myDOF += 7 - model.do() - - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 0) - - def test_elliptic_arc_with_fixed_start_point(self): - """ Test 9. Create elliptic arc which start point is coincident with another point - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.mySketch.addEllipticArc(self.myCenter, self.myFocus, aLine.endPoint(), self.myEndPoint, True) - self.myDOF += 5 - model.do() - # check ellipse - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipticArc") - self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature) - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - self.checkPointOnEllipse(aLine.endPoint(), anEllipse) - self.checkPointsEqual(aLine.endPoint(), self.myEllipse1.startPoint()) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_elliptic_arc_with_start_point_on_line(self): - """ Test 10. Create elliptic arc which start point is placed on a line. - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.mySketch.addEllipticArc(self.myCenter, self.myFocus, [self.myStartPoint, aLine.result()], self.myEndPoint, False) - self.myDOF += 6 - model.do() - - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipticArc") - self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature) - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - self.checkPointOnLine(self.myEllipse1.startPoint(), aLine) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_elliptic_arc_with_fixed_end_point(self): - """ Test 11. Create elliptic arc which end point is coincident with another point - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.mySketch.addEllipticArc(self.myCenter, self.myFocus, self.myStartPoint, aLine.endPoint(), True) - self.myDOF += 5 - model.do() - # check ellipse - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipticArc") - self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature) - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - self.checkPointOnEllipse(aLine.endPoint(), anEllipse) - self.checkPointsEqual(aLine.endPoint(), self.myEllipse1.endPoint()) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) - - def test_elliptic_arc_with_end_point_on_line(self): - """ Test 12. Create elliptic arc which end point is placed on a line. - """ - aLine = self.mySketch.addLine(10, 10, 30, 40) - self.myDOF += 4 - model.do() - - self.mySketch.addEllipticArc(self.myCenter, self.myFocus, self.myStartPoint, [self.myEndPoint, aLine.result()], False) - self.myDOF += 6 - model.do() - - anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipticArc") - self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature) - anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() - self.checkPointOnLine(self.myEllipse1.endPoint(), aLine) - # check number of features - model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) - model.testNbSubFeatures(self.mySketch, "SketchLine", 3) - model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myCenter = GeomAPI_Pnt2d(50.0, 50.0) + self.myFocus = GeomAPI_Pnt2d(70.0, 60.0) + self.myStartPoint = GeomAPI_Pnt2d(60.0, 65.0) + self.myEndPoint = GeomAPI_Pnt2d(60.0, 42.535751) + self.myDOF = 0 + + def tearDown(self): + self.checkDOF() + model.end() + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointsEqual(self, thePoint1, thePoint2): + self.assertAlmostEqual(thePoint1.x(), thePoint2.x(), 5) + self.assertAlmostEqual(thePoint1.y(), thePoint2.y(), 5) + + def checkPointOnLine(self, theCoordinates, theLine): + point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) + dist = model.distancePointLine(point, theLine) + self.assertAlmostEqual(dist, 0, 7) + + def checkPointOnCircle(self, theCoordinates, theCircle): + point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) + dist = model.distancePointPoint(point, theCircle.center()) + self.assertAlmostEqual(dist, theCircle.radius().value(), 7) + + def checkPointOnEllipse(self, theCoordinates, theEllipse): + point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) + firstFocus2d = GeomAPI_Pnt2d( + theEllipse.firstFocus().x(), theEllipse.firstFocus().y() + ) + distPF1 = model.distancePointPoint(firstFocus2d, point) + secondFocus2d = GeomAPI_Pnt2d( + theEllipse.secondFocus().x(), theEllipse.secondFocus().y() + ) + distPF2 = model.distancePointPoint(secondFocus2d, point) + if issubclass(type(theEllipse), SketchAPI_Ellipse): + majorRad = theEllipse.majorRadius().value() + else: + majorRad = theEllipse.majorRadius() + self.assertAlmostEqual(distPF1 + distPF2, 2.0 * majorRad, 7) + + def test_elliptic_arc_by_coordinates(self): + """Test 1. Create elliptic arc by coordinates of center, point on the major axis, start and end points""" + self.myEllipse1 = self.mySketch.addEllipticArc( + self.myCenter.x(), + self.myCenter.y(), + self.myFocus.x(), + self.myFocus.y(), + self.myStartPoint.x(), + self.myStartPoint.y(), + self.myEndPoint.x(), + self.myEndPoint.y(), + False, + ) + self.myDOF += 7 + + self.myEllipse2 = self.mySketch.addEllipticArc( + self.myCenter.x(), + self.myCenter.y(), + self.myFocus.x(), + self.myFocus.y(), + self.myStartPoint.x(), + self.myStartPoint.y(), + self.myEndPoint.x(), + self.myEndPoint.y(), + True, + ) + self.myDOF += 7 + model.do() + + # check both ellipses are equal + anArcEdge1 = self.myEllipse1.defaultResult().shape().edge() + anArcEdge2 = self.myEllipse2.defaultResult().shape().edge() + anEllipse1 = anArcEdge1.ellipse() + anEllipse2 = anArcEdge2.ellipse() + self.checkPointsEqual(anEllipse1.center(), anEllipse2.center()) + self.checkPointsEqual(anEllipse1.firstFocus(), anEllipse2.firstFocus()) + self.checkPointsEqual(anEllipse1.secondFocus(), anEllipse2.secondFocus()) + self.assertAlmostEqual(anEllipse1.minorRadius(), anEllipse2.minorRadius()) + self.assertAlmostEqual(anEllipse1.majorRadius(), anEllipse2.majorRadius()) + self.checkPointsEqual( + self.myEllipse1.startPoint(), self.myEllipse2.startPoint() + ) + self.checkPointsEqual(self.myEllipse1.endPoint(), self.myEllipse2.endPoint()) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 0) + model.testNbSubFeatures(self.mySketch, "SketchLine", 0) + model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 2) + # check middle points are different + assert anArcEdge1.middlePoint().x() < self.myStartPoint.x() + assert anArcEdge2.middlePoint().x() > self.myStartPoint.x() + + def test_elliptic_arc_by_points(self): + """Test 2. Create elliptic arc by points""" + self.mySketch.addEllipticArc( + self.myCenter, self.myFocus, self.myStartPoint, self.myEndPoint, False + ) + self.myDOF += 7 + model.do() + anEllipseFeature1 = model.lastSubFeature(self.mySketch, "SketchEllipticArc") + self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature1) + + self.mySketch.addEllipticArc( + self.myCenter, self.myFocus, self.myStartPoint, self.myEndPoint, True + ) + self.myDOF += 7 + model.do() + anEllipseFeature2 = model.lastSubFeature(self.mySketch, "SketchEllipticArc") + self.myEllipse2 = SketchAPI_EllipticArc(anEllipseFeature2) + + # check both ellipses are equal + anArcEdge1 = anEllipseFeature1.lastResult().shape().edge() + anArcEdge2 = anEllipseFeature2.lastResult().shape().edge() + anEllipse1 = anArcEdge1.ellipse() + anEllipse2 = anArcEdge2.ellipse() + self.checkPointsEqual(anEllipse1.center(), anEllipse2.center()) + self.checkPointsEqual(anEllipse1.firstFocus(), anEllipse2.firstFocus()) + self.checkPointsEqual(anEllipse1.secondFocus(), anEllipse2.secondFocus()) + self.assertAlmostEqual(anEllipse1.minorRadius(), anEllipse2.minorRadius()) + self.assertAlmostEqual(anEllipse1.majorRadius(), anEllipse2.majorRadius()) + self.checkPointsEqual( + self.myEllipse1.startPoint(), self.myEllipse2.startPoint() + ) + self.checkPointsEqual(self.myEllipse1.endPoint(), self.myEllipse2.endPoint()) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 14) + model.testNbSubFeatures(self.mySketch, "SketchLine", 4) + model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 2) + # check middle points are different + assert anArcEdge1.middlePoint().x() < self.myStartPoint.x() + assert anArcEdge2.middlePoint().x() > self.myStartPoint.x() + + def test_elliptic_arc_with_fixed_center(self): + """Test 3. Create elliptic arc which center is coincident with another point""" + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.mySketch.addEllipticArc( + aLine.endPoint(), self.myFocus, self.myStartPoint, self.myEndPoint, True + ) + self.myDOF += 5 + model.do() + # check ellipse + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipticArc") + self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature) + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + self.checkPointsEqual(anEllipse.center(), aLine.endPoint()) + self.checkPointOnEllipse(self.myStartPoint, anEllipse) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_elliptic_arc_with_center_on_line(self): + """Test 4. Create elliptic arc which center is coincident with a line""" + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.mySketch.addEllipticArc( + [self.myCenter, aLine.result()], + self.myFocus, + self.myStartPoint, + self.myEndPoint, + False, + ) + self.myDOF += 6 + model.do() + + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipticArc") + self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature) + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + # check center on line + self.checkPointOnLine(anEllipse.center(), aLine) + self.checkPointOnEllipse(self.myEllipse1.startPoint(), anEllipse) + self.checkPointOnEllipse(self.myEllipse1.endPoint(), anEllipse) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_elliptic_arc_with_center_on_circle(self): + """Test 5. Create elliptic arc which center is coincident with a circle""" + aCircle = self.mySketch.addCircle(10, 10, 20) + self.myDOF += 3 + model.do() + + self.mySketch.addEllipticArc( + [self.myCenter, aCircle.defaultResult()], + self.myFocus, + self.myStartPoint, + self.myEndPoint, + False, + ) + self.myDOF += 6 + model.do() + + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipticArc") + self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature) + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + # check center on circle + self.checkPointOnCircle(anEllipse.center(), aCircle) + self.checkPointOnEllipse(self.myEllipse1.startPoint(), anEllipse) + self.checkPointOnEllipse(self.myEllipse1.endPoint(), anEllipse) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 2) + model.testNbSubFeatures(self.mySketch, "SketchCircle", 1) + model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_elliptic_arc_with_center_on_ellipse(self): + """Test 6. Create elliptic arc which center is coincident with another ellipse""" + anOtherEllipse = self.mySketch.addEllipse(10, 10, 30, 20, 10) + self.myDOF += 5 + model.do() + + self.mySketch.addEllipticArc( + [self.myCenter, anOtherEllipse.defaultResult()], + self.myFocus, + self.myStartPoint, + self.myEndPoint, + False, + ) + self.myDOF += 6 + model.do() + + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipticArc") + self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature) + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + # check center on ellipse + self.checkPointOnEllipse(anEllipse.center(), anOtherEllipse) + self.checkPointOnEllipse(self.myEllipse1.startPoint(), anEllipse) + self.checkPointOnEllipse(self.myEllipse1.endPoint(), anEllipse) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 2) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", 1) + model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_elliptic_arc_with_fixed_axis(self): + """Test 7. Create elliptic arc which point on major semi-axis is coincident with another point""" + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.mySketch.addEllipticArc( + self.myCenter, aLine.endPoint(), self.myStartPoint, self.myEndPoint, False + ) + self.myDOF += 6 + model.do() + # check ellipse + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipticArc") + self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature) + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + self.checkPointOnEllipse(self.myStartPoint, anEllipse) + self.checkPointOnEllipse(aLine.endPoint(), anEllipse) + # check distance is equal to major semi-axis + dist = model.distancePointPoint( + GeomAPI_Pnt2d(anEllipse.center().x(), anEllipse.center().y()), + aLine.endPoint(), + ) + self.assertAlmostEqual(dist, anEllipse.majorRadius(), 7) + self.checkPointsEqual(self.myEllipse1.majorAxisPositive(), aLine.endPoint()) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_elliptic_arc_with_axis_on_line(self): + """Test 8. Create elliptic arc which point on major semi-axis is coincident with a line. + Check no coincidence constraint is created. + """ + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.mySketch.addEllipticArc( + self.myCenter, + [self.myFocus, aLine.result()], + self.myStartPoint, + self.myEndPoint, + True, + ) + self.myDOF += 7 + model.do() + + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 0) + + def test_elliptic_arc_with_fixed_start_point(self): + """Test 9. Create elliptic arc which start point is coincident with another point""" + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.mySketch.addEllipticArc( + self.myCenter, self.myFocus, aLine.endPoint(), self.myEndPoint, True + ) + self.myDOF += 5 + model.do() + # check ellipse + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipticArc") + self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature) + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + self.checkPointOnEllipse(aLine.endPoint(), anEllipse) + self.checkPointsEqual(aLine.endPoint(), self.myEllipse1.startPoint()) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_elliptic_arc_with_start_point_on_line(self): + """Test 10. Create elliptic arc which start point is placed on a line.""" + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.mySketch.addEllipticArc( + self.myCenter, + self.myFocus, + [self.myStartPoint, aLine.result()], + self.myEndPoint, + False, + ) + self.myDOF += 6 + model.do() + + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipticArc") + self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature) + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + self.checkPointOnLine(self.myEllipse1.startPoint(), aLine) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_elliptic_arc_with_fixed_end_point(self): + """Test 11. Create elliptic arc which end point is coincident with another point""" + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.mySketch.addEllipticArc( + self.myCenter, self.myFocus, self.myStartPoint, aLine.endPoint(), True + ) + self.myDOF += 5 + model.do() + # check ellipse + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipticArc") + self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature) + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + self.checkPointOnEllipse(aLine.endPoint(), anEllipse) + self.checkPointsEqual(aLine.endPoint(), self.myEllipse1.endPoint()) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) + + def test_elliptic_arc_with_end_point_on_line(self): + """Test 12. Create elliptic arc which end point is placed on a line.""" + aLine = self.mySketch.addLine(10, 10, 30, 40) + self.myDOF += 4 + model.do() + + self.mySketch.addEllipticArc( + self.myCenter, + self.myFocus, + self.myStartPoint, + [self.myEndPoint, aLine.result()], + False, + ) + self.myDOF += 6 + model.do() + + anEllipseFeature = model.lastSubFeature(self.mySketch, "SketchEllipticArc") + self.myEllipse1 = SketchAPI_EllipticArc(anEllipseFeature) + anEllipse = anEllipseFeature.lastResult().shape().edge().ellipse() + self.checkPointOnLine(self.myEllipse1.endPoint(), aLine) + # check number of features + model.testNbSubFeatures(self.mySketch, "SketchPoint", 7) + model.testNbSubFeatures(self.mySketch, "SketchLine", 3) + model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", 1) + model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", 1) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestCreateEllipticArcByExternal.py b/src/SketchPlugin/Test/TestCreateEllipticArcByExternal.py index fef3d62b6..115bdc3f6 100644 --- a/src/SketchPlugin/Test/TestCreateEllipticArcByExternal.py +++ b/src/SketchPlugin/Test/TestCreateEllipticArcByExternal.py @@ -30,108 +30,109 @@ from SketchAPI import * __updated__ = "2019-10-02" # reference data -CENTER_POINT = GeomAPI_Pnt2d(50., 50.) -MAJOR_AXIS_POINT = GeomAPI_Pnt2d(70., 60.) -START_POINT = GeomAPI_Pnt2d(60., 65.) -END_POINT = GeomAPI_Pnt2d(60., 42.535751) +CENTER_POINT = GeomAPI_Pnt2d(50.0, 50.0) +MAJOR_AXIS_POINT = GeomAPI_Pnt2d(70.0, 60.0) +START_POINT = GeomAPI_Pnt2d(60.0, 65.0) +END_POINT = GeomAPI_Pnt2d(60.0, 42.535751) ARC_LENGTH_1 = 0 ARC_LENGTH_2 = 0 -class TestEllipticArcByExternal(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myDOF = 0 - - def tearDown(self): - self.checkDOF() - model.end() - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkPointsEqual(self, thePoint1, thePoint2): - self.assertAlmostEqual(thePoint1.x(), thePoint2.x(), 5) - self.assertAlmostEqual(thePoint1.y(), thePoint2.y(), 5) - - - def test_elliptic_arc_by_external_name_1(self): - """ Test 1. Create elliptic arc by name of external edge (direct) - """ - self.myEllipse = self.mySketch.addEllipticArc("Sketch_1/SketchEllipticArc_1") - model.do() - - # check ellipse parameters - anArcEdge = self.myEllipse.defaultResult().shape().edge() - anEllipse = anArcEdge.ellipse() - self.checkPointsEqual(anEllipse.center(), CENTER_POINT) - self.checkPointsEqual(self.myEllipse.majorAxisPositive(), MAJOR_AXIS_POINT) - self.checkPointsEqual(self.myEllipse.startPoint(), START_POINT) - self.checkPointsEqual(self.myEllipse.endPoint(), END_POINT) - self.assertAlmostEqual(anArcEdge.length(), ARC_LENGTH_1) - - def test_elliptic_arc_by_external_name_2(self): - """ Test 2. Create elliptic arc by name of external edge (reversed) - """ - self.myEllipse = self.mySketch.addEllipticArc("Sketch_1/SketchEllipticArc_2") - model.do() - - # check ellipse parameters - anArcEdge = self.myEllipse.defaultResult().shape().edge() - anEllipse = anArcEdge.ellipse() - self.checkPointsEqual(anEllipse.center(), CENTER_POINT) - self.checkPointsEqual(self.myEllipse.majorAxisPositive(), MAJOR_AXIS_POINT) - self.checkPointsEqual(anArcEdge.firstPoint(), END_POINT) - self.checkPointsEqual(anArcEdge.lastPoint(), START_POINT) - self.assertAlmostEqual(anArcEdge.length(), ARC_LENGTH_2) - - def test_elliptic_arc_by_external_selection_1(self): - """ Test 3. Create elliptic arc by selected edge (direct) - """ - self.myEllipse = self.mySketch.addEllipticArc(ELLIPTIC_ARC_1.results()[-1]) - model.do() - - # check ellipse parameters - anArcEdge = self.myEllipse.defaultResult().shape().edge() - anEllipse = anArcEdge.ellipse() - self.checkPointsEqual(anEllipse.center(), CENTER_POINT) - self.checkPointsEqual(self.myEllipse.majorAxisPositive(), MAJOR_AXIS_POINT) - self.checkPointsEqual(self.myEllipse.startPoint(), START_POINT) - self.checkPointsEqual(self.myEllipse.endPoint(), END_POINT) - self.assertAlmostEqual(anArcEdge.length(), ARC_LENGTH_1) - - def test_elliptic_arc_by_external_selection_2(self): - """ Test 4. Create elliptic arc by selected edge (reversed) - """ - self.myEllipse = self.mySketch.addEllipticArc(ELLIPTIC_ARC_2.results()[-1]) - model.do() - - # check ellipse parameters - anArcEdge = self.myEllipse.defaultResult().shape().edge() - anEllipse = anArcEdge.ellipse() - self.checkPointsEqual(anEllipse.center(), CENTER_POINT) - self.checkPointsEqual(self.myEllipse.majorAxisPositive(), MAJOR_AXIS_POINT) - self.checkPointsEqual(self.myEllipse.startPoint(), END_POINT) - self.checkPointsEqual(self.myEllipse.endPoint(), START_POINT) - self.assertAlmostEqual(anArcEdge.length(), ARC_LENGTH_2) +class TestEllipticArcByExternal(unittest.TestCase): + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myDOF = 0 + + def tearDown(self): + self.checkDOF() + model.end() + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointsEqual(self, thePoint1, thePoint2): + self.assertAlmostEqual(thePoint1.x(), thePoint2.x(), 5) + self.assertAlmostEqual(thePoint1.y(), thePoint2.y(), 5) + + def test_elliptic_arc_by_external_name_1(self): + """Test 1. Create elliptic arc by name of external edge (direct)""" + self.myEllipse = self.mySketch.addEllipticArc("Sketch_1/SketchEllipticArc_1") + model.do() + + # check ellipse parameters + anArcEdge = self.myEllipse.defaultResult().shape().edge() + anEllipse = anArcEdge.ellipse() + self.checkPointsEqual(anEllipse.center(), CENTER_POINT) + self.checkPointsEqual(self.myEllipse.majorAxisPositive(), MAJOR_AXIS_POINT) + self.checkPointsEqual(self.myEllipse.startPoint(), START_POINT) + self.checkPointsEqual(self.myEllipse.endPoint(), END_POINT) + self.assertAlmostEqual(anArcEdge.length(), ARC_LENGTH_1) + + def test_elliptic_arc_by_external_name_2(self): + """Test 2. Create elliptic arc by name of external edge (reversed)""" + self.myEllipse = self.mySketch.addEllipticArc("Sketch_1/SketchEllipticArc_2") + model.do() + + # check ellipse parameters + anArcEdge = self.myEllipse.defaultResult().shape().edge() + anEllipse = anArcEdge.ellipse() + self.checkPointsEqual(anEllipse.center(), CENTER_POINT) + self.checkPointsEqual(self.myEllipse.majorAxisPositive(), MAJOR_AXIS_POINT) + self.checkPointsEqual(anArcEdge.firstPoint(), END_POINT) + self.checkPointsEqual(anArcEdge.lastPoint(), START_POINT) + self.assertAlmostEqual(anArcEdge.length(), ARC_LENGTH_2) + + def test_elliptic_arc_by_external_selection_1(self): + """Test 3. Create elliptic arc by selected edge (direct)""" + self.myEllipse = self.mySketch.addEllipticArc(ELLIPTIC_ARC_1.results()[-1]) + model.do() + + # check ellipse parameters + anArcEdge = self.myEllipse.defaultResult().shape().edge() + anEllipse = anArcEdge.ellipse() + self.checkPointsEqual(anEllipse.center(), CENTER_POINT) + self.checkPointsEqual(self.myEllipse.majorAxisPositive(), MAJOR_AXIS_POINT) + self.checkPointsEqual(self.myEllipse.startPoint(), START_POINT) + self.checkPointsEqual(self.myEllipse.endPoint(), END_POINT) + self.assertAlmostEqual(anArcEdge.length(), ARC_LENGTH_1) + + def test_elliptic_arc_by_external_selection_2(self): + """Test 4. Create elliptic arc by selected edge (reversed)""" + self.myEllipse = self.mySketch.addEllipticArc(ELLIPTIC_ARC_2.results()[-1]) + model.do() + + # check ellipse parameters + anArcEdge = self.myEllipse.defaultResult().shape().edge() + anEllipse = anArcEdge.ellipse() + self.checkPointsEqual(anEllipse.center(), CENTER_POINT) + self.checkPointsEqual(self.myEllipse.majorAxisPositive(), MAJOR_AXIS_POINT) + self.checkPointsEqual(self.myEllipse.startPoint(), END_POINT) + self.checkPointsEqual(self.myEllipse.endPoint(), START_POINT) + self.assertAlmostEqual(anArcEdge.length(), ARC_LENGTH_2) if __name__ == "__main__": model.begin() aDocument = model.moduleDocument() aSketch = model.addSketch(aDocument, model.defaultPlane("XOY")) - aSketch.addEllipticArc(CENTER_POINT, MAJOR_AXIS_POINT, START_POINT, END_POINT, False) + aSketch.addEllipticArc( + CENTER_POINT, MAJOR_AXIS_POINT, START_POINT, END_POINT, False + ) model.do() - ELLIPTIC_ARC_1 = SketchAPI_EllipticArc(model.lastSubFeature(aSketch, "SketchEllipticArc")) + ELLIPTIC_ARC_1 = SketchAPI_EllipticArc( + model.lastSubFeature(aSketch, "SketchEllipticArc") + ) ARC_LENGTH_1 = ELLIPTIC_ARC_1.defaultResult().shape().edge().length() aSketch.addEllipticArc(CENTER_POINT, MAJOR_AXIS_POINT, START_POINT, END_POINT, True) model.end() - ELLIPTIC_ARC_2 = SketchAPI_EllipticArc(model.lastSubFeature(aSketch, "SketchEllipticArc")) + ELLIPTIC_ARC_2 = SketchAPI_EllipticArc( + model.lastSubFeature(aSketch, "SketchEllipticArc") + ) ARC_LENGTH_2 = ELLIPTIC_ARC_2.defaultResult().shape().edge().length() # redefine end point diff --git a/src/SketchPlugin/Test/TestCreateMacroBSpline.py b/src/SketchPlugin/Test/TestCreateMacroBSpline.py index 4fee0c3d7..c2295666d 100644 --- a/src/SketchPlugin/Test/TestCreateMacroBSpline.py +++ b/src/SketchPlugin/Test/TestCreateMacroBSpline.py @@ -31,131 +31,142 @@ from SketchAPI import * __updated__ = "2020-01-31" + class TestMacroBSpline(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myPoint = self.mySketch.addPoint(50., 50.) - self.myLine = self.mySketch.addLine(30., -1., 70., 19.) - - self.myPoles = [[GeomAPI_Pnt2d(50., 50.), self.myPoint.coordinates()], - GeomAPI_Pnt2d(70., 70.), - (80., 30.), - [GeomAPI_Pnt2d(50., 10.), self.myLine.result()], - GeomAPI_Pnt2d(20., 10.) - ] - - self.myDegree = 3; - self.myDOF = 6 - self.myNbPoints = 1 - self.myNbLines = 1 - self.myNbSplines = 0 - self.myNbSplinesP = 0 - self.myNbCoincidences = 0 - self.myNbInternal = 0 - - def tearDown(self): - self.checkDOF() - model.end() - model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) - model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) - model.testNbSubFeatures(self.mySketch, "SketchBSpline", self.myNbSplines) - model.testNbSubFeatures(self.mySketch, "SketchBSplinePeriodic", self.myNbSplinesP) - model.testNbSubFeatures(self.mySketch, "SketchMacroBSpline", 0) - model.testNbSubFeatures(self.mySketch, "SketchMacroBSplinePeriodic", 0) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidence", self.myNbCoincidences) - model.testNbSubFeatures(self.mySketch, "SketchConstraintCoincidenceInternal", self.myNbInternal) - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - - def test_bspline_non_periodic(self): - """ Test 1. Create B-spline curve by poles and references to other shapes - """ - self.mySpline = self.mySketch.addSpline(poles = self.myPoles) - self.myDOF += len(self.myPoles) * 2 - 3 - self.myNbSplines += 1 - self.myNbPoints += len(self.myPoles) - self.myNbLines += len(self.myPoles) - 1 - self.myNbCoincidences += 2 - self.myNbInternal += len(self.myPoles) * 3 - 2 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) - - def test_bspline_periodic(self): - """ Test 2. Create periodic B-spline curve by poles and references to other shapes - """ - self.mySpline = self.mySketch.addSpline(poles = self.myPoles, periodic = True) - self.myDOF += len(self.myPoles) * 2 - 3 - self.myNbSplinesP += 1 - self.myNbPoints += len(self.myPoles) - self.myNbLines += len(self.myPoles) - self.myNbCoincidences += 2 - self.myNbInternal += len(self.myPoles) * 3 - model.do() - - assert(self.mySpline.feature()) - assert(self.mySpline.feature().error() == "") - assert(self.mySpline.degree().value() == self.myDegree) - - def test_bspline_lowlevel(self): - """ Test 3. Create macro B-spline on low-level to test attributeRefAttrList - """ - model.end() - session = ModelAPI_Session.get() - sketch = featureToCompositeFeature(self.mySketch.feature()) - session.startOperation() - bspline = sketch.addFeature("SketchMacroBSpline") - poles = geomDataAPI_Point2DArray(bspline.attribute("poles")) - weights = bspline.data().realArray("weights") - polesRef = bspline.data().refattrlist("poles_ref") - bspline.boolean("need_control_poly").setValue(False) - - poles.setSize(3); weights.setSize(3) - poles.setPnt(0, GeomAPI_Pnt2d(50., 50.)); weights.setValue(0, 1.0); polesRef.append(self.myPoint.coordinates()) - poles.setPnt(1, GeomAPI_Pnt2d(50., 10.)); weights.setValue(1, 1.0); polesRef.append(self.myLine.defaultResult()) - poles.setPnt(2, GeomAPI_Pnt2d(20., 10.)); weights.setValue(2, 1.0); polesRef.append(None) - - assert(polesRef.isInList(self.myPoint.coordinates())) - assert(not polesRef.isInList(self.myLine.startPoint())) - assert(polesRef.isInList(self.myLine.defaultResult())) - assert(not polesRef.isInList(self.myPoint.defaultResult())) - - assert(polesRef.isAttribute(0)) - assert(not polesRef.isAttribute(1)) - assert(not polesRef.isAttribute(2)) - assert(not polesRef.isAttribute(3)) - - assert(polesRef.attribute(0) is not None) - assert(polesRef.attribute(1) is None) - assert(polesRef.attribute(2) is None) - assert(polesRef.attribute(3) is None) - assert(polesRef.object(0) is not None) - assert(polesRef.object(1) is not None) - assert(polesRef.object(2) is None) - assert(polesRef.object(3) is None) - - polesRef.remove(self.myPoint.coordinates()) - polesRef.remove(self.myLine.defaultResult()) - assert(polesRef.size() == 1) - polesRef.removeLast() - - polesRef.append(self.myPoint.coordinates()) - polesRef.append(None) - polesRef.append(self.myLine.defaultResult()) - polesRef.removeLast() - polesRef.append(self.myLine.defaultResult()) - - session.finishOperation() - model.begin() - self.myDOF += 6 - self.myNbSplines += 1 + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myPoint = self.mySketch.addPoint(50.0, 50.0) + self.myLine = self.mySketch.addLine(30.0, -1.0, 70.0, 19.0) + + self.myPoles = [ + [GeomAPI_Pnt2d(50.0, 50.0), self.myPoint.coordinates()], + GeomAPI_Pnt2d(70.0, 70.0), + (80.0, 30.0), + [GeomAPI_Pnt2d(50.0, 10.0), self.myLine.result()], + GeomAPI_Pnt2d(20.0, 10.0), + ] + + self.myDegree = 3 + self.myDOF = 6 + self.myNbPoints = 1 + self.myNbLines = 1 + self.myNbSplines = 0 + self.myNbSplinesP = 0 + self.myNbCoincidences = 0 + self.myNbInternal = 0 + + def tearDown(self): + self.checkDOF() + model.end() + model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) + model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) + model.testNbSubFeatures(self.mySketch, "SketchBSpline", self.myNbSplines) + model.testNbSubFeatures( + self.mySketch, "SketchBSplinePeriodic", self.myNbSplinesP + ) + model.testNbSubFeatures(self.mySketch, "SketchMacroBSpline", 0) + model.testNbSubFeatures(self.mySketch, "SketchMacroBSplinePeriodic", 0) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintCoincidence", self.myNbCoincidences + ) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintCoincidenceInternal", self.myNbInternal + ) + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def test_bspline_non_periodic(self): + """Test 1. Create B-spline curve by poles and references to other shapes""" + self.mySpline = self.mySketch.addSpline(poles=self.myPoles) + self.myDOF += len(self.myPoles) * 2 - 3 + self.myNbSplines += 1 + self.myNbPoints += len(self.myPoles) + self.myNbLines += len(self.myPoles) - 1 + self.myNbCoincidences += 2 + self.myNbInternal += len(self.myPoles) * 3 - 2 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + + def test_bspline_periodic(self): + """Test 2. Create periodic B-spline curve by poles and references to other shapes""" + self.mySpline = self.mySketch.addSpline(poles=self.myPoles, periodic=True) + self.myDOF += len(self.myPoles) * 2 - 3 + self.myNbSplinesP += 1 + self.myNbPoints += len(self.myPoles) + self.myNbLines += len(self.myPoles) + self.myNbCoincidences += 2 + self.myNbInternal += len(self.myPoles) * 3 + model.do() + + assert self.mySpline.feature() + assert self.mySpline.feature().error() == "" + assert self.mySpline.degree().value() == self.myDegree + + def test_bspline_lowlevel(self): + """Test 3. Create macro B-spline on low-level to test attributeRefAttrList""" + model.end() + session = ModelAPI_Session.get() + sketch = featureToCompositeFeature(self.mySketch.feature()) + session.startOperation() + bspline = sketch.addFeature("SketchMacroBSpline") + poles = geomDataAPI_Point2DArray(bspline.attribute("poles")) + weights = bspline.data().realArray("weights") + polesRef = bspline.data().refattrlist("poles_ref") + bspline.boolean("need_control_poly").setValue(False) + + poles.setSize(3) + weights.setSize(3) + poles.setPnt(0, GeomAPI_Pnt2d(50.0, 50.0)) + weights.setValue(0, 1.0) + polesRef.append(self.myPoint.coordinates()) + poles.setPnt(1, GeomAPI_Pnt2d(50.0, 10.0)) + weights.setValue(1, 1.0) + polesRef.append(self.myLine.defaultResult()) + poles.setPnt(2, GeomAPI_Pnt2d(20.0, 10.0)) + weights.setValue(2, 1.0) + polesRef.append(None) + + assert polesRef.isInList(self.myPoint.coordinates()) + assert not polesRef.isInList(self.myLine.startPoint()) + assert polesRef.isInList(self.myLine.defaultResult()) + assert not polesRef.isInList(self.myPoint.defaultResult()) + + assert polesRef.isAttribute(0) + assert not polesRef.isAttribute(1) + assert not polesRef.isAttribute(2) + assert not polesRef.isAttribute(3) + + assert polesRef.attribute(0) is not None + assert polesRef.attribute(1) is None + assert polesRef.attribute(2) is None + assert polesRef.attribute(3) is None + assert polesRef.object(0) is not None + assert polesRef.object(1) is not None + assert polesRef.object(2) is None + assert polesRef.object(3) is None + + polesRef.remove(self.myPoint.coordinates()) + polesRef.remove(self.myLine.defaultResult()) + assert polesRef.size() == 1 + polesRef.removeLast() + + polesRef.append(self.myPoint.coordinates()) + polesRef.append(None) + polesRef.append(self.myLine.defaultResult()) + polesRef.removeLast() + polesRef.append(self.myLine.defaultResult()) + + session.finishOperation() + model.begin() + self.myDOF += 6 + self.myNbSplines += 1 + if __name__ == "__main__": test_program = unittest.main(exit=False) diff --git a/src/SketchPlugin/Test/TestCurveFitting1.py b/src/SketchPlugin/Test/TestCurveFitting1.py index e6f5ec9ef..bbbf122ac 100644 --- a/src/SketchPlugin/Test/TestCurveFitting1.py +++ b/src/SketchPlugin/Test/TestCurveFitting1.py @@ -34,132 +34,151 @@ from GeomAlgoAPI import GeomAlgoAPI_ShapeTools as shapetools __updated__ = "2020-06-27" -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + class TestInterpolation(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - coordinates = [(50., 50.), (70., 70.), (80., 30.), (50., 10.), (10., -30.)] - self.myPoints = [] - self.myPointRefs = [] - for p in coordinates: - self.myPoints.append(self.mySketch.addPoint(p[0], p[1])) - self.myPointRefs.append(self.myPoints[-1].coordinates()) - self.myDOF = 10 - self.myNbPoints = len(self.myPoints) - self.myNbLines = 0 - self.myNbSplines = 0 - self.myNbPeriodicSplines = 0 - - def tearDown(self): - self.checkDOF() - model.end() - model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) - model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) - model.testNbSubFeatures(self.mySketch, "SketchBSpline", self.myNbSplines) - model.testNbSubFeatures(self.mySketch, "SketchBSplinePeriodic", self.myNbPeriodicSplines) - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkPointsOnCurve(self, theCurve): - for p in self.myPoints: - shape = p.defaultResult().shape() - self.assertTrue(shapetools.minimalDistance(shape, theCurve) < TOLERANCE) - - - def test_interpolation(self): - """ Test 1. Create B-spline curve by set of points - """ - self.mySpline = self.mySketch.addInterpolation(self.myPointRefs) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - len(self.myPointRefs) - 2 - self.myNbSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 3) - self.assertTrue(curve.isPeriodic() == False) - EXPECTED_LEN = 172.237458 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge) - - def test_interpolation_periodic(self): - """ Test 2. Create periodic B-spline curve by set of points - """ - self.mySpline = self.mySketch.addInterpolation(self.myPointRefs, periodic = True) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - len(self.myPointRefs) - self.myNbPeriodicSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 3) - self.assertTrue(curve.isPeriodic() == True) - EXPECTED_LEN = 262.60929483 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge) - - def test_interpolation_closed(self): - """ Test 3. Create closed but not periodic B-spline curve by set of points - """ - self.mySpline = self.mySketch.addInterpolation(self.myPointRefs, closed = True) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - len(self.myPointRefs) - 3 - self.myNbSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 3) - self.assertTrue(curve.isPeriodic() == False) - self.assertTrue(curve.poles()[0].distance(curve.poles()[-1]) < TOLERANCE) - EXPECTED_LEN = 274.25674928 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge) - - def test_interpolation_reorder(self): - """ Test 4. Check reordering of points works properly - """ - model.do() - # use low-level API to create feature - curveFitting = featureToCompositeFeature(self.mySketch.feature()).addFeature("SketchCurveFitting") - curveFitting.string("type").setValue("interpolation_type") - curveFitting.boolean("periodic").setValue(False) - curveFitting.boolean("closed").setValue(False) - pointsAttr = curveFitting.refattrlist("points") - for ind in [0, 3, 4, 2, 1]: - pointsAttr.append(self.myPointRefs[ind]) - # perform reordering - curveFitting.customAction("reorder_points") - model.do() - - self.mySpline = SketchAPI_BSpline(model.lastSubFeature(self.mySketch, "SketchBSpline")) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - len(self.myPointRefs) - 2 - self.myNbSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 3) - self.assertTrue(curve.isPeriodic() == False) - EXPECTED_LEN = 172.237458 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + coordinates = [ + (50.0, 50.0), + (70.0, 70.0), + (80.0, 30.0), + (50.0, 10.0), + (10.0, -30.0), + ] + self.myPoints = [] + self.myPointRefs = [] + for p in coordinates: + self.myPoints.append(self.mySketch.addPoint(p[0], p[1])) + self.myPointRefs.append(self.myPoints[-1].coordinates()) + self.myDOF = 10 + self.myNbPoints = len(self.myPoints) + self.myNbLines = 0 + self.myNbSplines = 0 + self.myNbPeriodicSplines = 0 + + def tearDown(self): + self.checkDOF() + model.end() + model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) + model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) + model.testNbSubFeatures(self.mySketch, "SketchBSpline", self.myNbSplines) + model.testNbSubFeatures( + self.mySketch, "SketchBSplinePeriodic", self.myNbPeriodicSplines + ) + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointsOnCurve(self, theCurve): + for p in self.myPoints: + shape = p.defaultResult().shape() + self.assertTrue(shapetools.minimalDistance(shape, theCurve) < TOLERANCE) + + def test_interpolation(self): + """Test 1. Create B-spline curve by set of points""" + self.mySpline = self.mySketch.addInterpolation(self.myPointRefs) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 - len(self.myPointRefs) - 2 + self.myNbSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 3) + self.assertTrue(curve.isPeriodic() == False) + EXPECTED_LEN = 172.237458 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge) + + def test_interpolation_periodic(self): + """Test 2. Create periodic B-spline curve by set of points""" + self.mySpline = self.mySketch.addInterpolation(self.myPointRefs, periodic=True) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 - len(self.myPointRefs) + self.myNbPeriodicSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 3) + self.assertTrue(curve.isPeriodic() == True) + EXPECTED_LEN = 262.60929483 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge) + + def test_interpolation_closed(self): + """Test 3. Create closed but not periodic B-spline curve by set of points""" + self.mySpline = self.mySketch.addInterpolation(self.myPointRefs, closed=True) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 - len(self.myPointRefs) - 3 + self.myNbSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 3) + self.assertTrue(curve.isPeriodic() == False) + self.assertTrue(curve.poles()[0].distance(curve.poles()[-1]) < TOLERANCE) + EXPECTED_LEN = 274.25674928 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge) + + def test_interpolation_reorder(self): + """Test 4. Check reordering of points works properly""" + model.do() + # use low-level API to create feature + curveFitting = featureToCompositeFeature(self.mySketch.feature()).addFeature( + "SketchCurveFitting" + ) + curveFitting.string("type").setValue("interpolation_type") + curveFitting.boolean("periodic").setValue(False) + curveFitting.boolean("closed").setValue(False) + pointsAttr = curveFitting.refattrlist("points") + for ind in [0, 3, 4, 2, 1]: + pointsAttr.append(self.myPointRefs[ind]) + # perform reordering + curveFitting.customAction("reorder_points") + model.do() + + self.mySpline = SketchAPI_BSpline( + model.lastSubFeature(self.mySketch, "SketchBSpline") + ) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 - len(self.myPointRefs) - 2 + self.myNbSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 3) + self.assertTrue(curve.isPeriodic() == False) + EXPECTED_LEN = 172.237458 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestCurveFitting2.py b/src/SketchPlugin/Test/TestCurveFitting2.py index cab7868fc..7edf1f5a5 100644 --- a/src/SketchPlugin/Test/TestCurveFitting2.py +++ b/src/SketchPlugin/Test/TestCurveFitting2.py @@ -34,143 +34,162 @@ from GeomAlgoAPI import GeomAlgoAPI_ShapeTools as shapetools __updated__ = "2020-06-27" -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 POINT_NAMES = [] + class TestInterpolationExternal(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myPoints = [] - self.myPointRefs = [] - for name in POINT_NAMES: - proj = self.mySketch.addProjection(model.selection("VERTEX", name), False) - self.myPoints.append(SketchAPI_Point(proj.createdFeature())) - self.myPointRefs.append(self.myPoints[-1].coordinates()) - self.myDOF = 0 - self.myNbPoints = len(self.myPoints) - self.myNbLines = 0 - self.myNbSplines = 0 - self.myNbPeriodicSplines = 0 - - def tearDown(self): - self.checkDOF() - model.end() - model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) - model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) - model.testNbSubFeatures(self.mySketch, "SketchBSpline", self.myNbSplines) - model.testNbSubFeatures(self.mySketch, "SketchBSplinePeriodic", self.myNbPeriodicSplines) - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkPointsOnCurve(self, theCurve): - for p in self.myPoints: - shape = p.defaultResult().shape() - self.assertTrue(shapetools.minimalDistance(shape, theCurve) < TOLERANCE) - - - def test_interpolation(self): - """ Test 1. Create B-spline curve by set of points - """ - self.mySpline = self.mySketch.addInterpolation(self.myPointRefs) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - len(self.myPointRefs) - 2 - self.myNbSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 3) - self.assertTrue(curve.isPeriodic() == False) - EXPECTED_LEN = 172.237458 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge) - - def test_interpolation_periodic(self): - """ Test 2. Create periodic B-spline curve by set of points - """ - self.mySpline = self.mySketch.addInterpolation(self.myPointRefs, periodic = True) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - len(self.myPointRefs) - self.myNbPeriodicSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 3) - self.assertTrue(curve.isPeriodic() == True) - EXPECTED_LEN = 262.60929483 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge) - - def test_interpolation_closed(self): - """ Test 3. Create closed but not periodic B-spline curve by set of points - """ - self.mySpline = self.mySketch.addInterpolation(self.myPointRefs, closed = True) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - len(self.myPointRefs) - 3 - self.myNbSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 3) - self.assertTrue(curve.isPeriodic() == False) - self.assertTrue(curve.poles()[0].distance(curve.poles()[-1]) < TOLERANCE) - EXPECTED_LEN = 274.25674928 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge) - - def test_interpolation_reorder(self): - """ Test 4. Check reordering of points works properly - """ - model.do() - # use low-level API to create feature - curveFitting = featureToCompositeFeature(self.mySketch.feature()).addFeature("SketchCurveFitting") - curveFitting.string("type").setValue("interpolation_type") - curveFitting.boolean("periodic").setValue(False) - curveFitting.boolean("closed").setValue(False) - pointsAttr = curveFitting.refattrlist("points") - for ind in [0, 3, 4, 2, 1]: - pointsAttr.append(self.myPointRefs[ind]) - # perform reordering - curveFitting.customAction("reorder_points") - model.do() - - self.mySpline = SketchAPI_BSpline(model.lastSubFeature(self.mySketch, "SketchBSpline")) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - len(self.myPointRefs) - 2 - self.myNbSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 3) - self.assertTrue(curve.isPeriodic() == False) - EXPECTED_LEN = 172.237458 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myPoints = [] + self.myPointRefs = [] + for name in POINT_NAMES: + proj = self.mySketch.addProjection(model.selection("VERTEX", name), False) + self.myPoints.append(SketchAPI_Point(proj.createdFeature())) + self.myPointRefs.append(self.myPoints[-1].coordinates()) + self.myDOF = 0 + self.myNbPoints = len(self.myPoints) + self.myNbLines = 0 + self.myNbSplines = 0 + self.myNbPeriodicSplines = 0 + + def tearDown(self): + self.checkDOF() + model.end() + model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) + model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) + model.testNbSubFeatures(self.mySketch, "SketchBSpline", self.myNbSplines) + model.testNbSubFeatures( + self.mySketch, "SketchBSplinePeriodic", self.myNbPeriodicSplines + ) + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointsOnCurve(self, theCurve): + for p in self.myPoints: + shape = p.defaultResult().shape() + self.assertTrue(shapetools.minimalDistance(shape, theCurve) < TOLERANCE) + + def test_interpolation(self): + """Test 1. Create B-spline curve by set of points""" + self.mySpline = self.mySketch.addInterpolation(self.myPointRefs) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 - len(self.myPointRefs) - 2 + self.myNbSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 3) + self.assertTrue(curve.isPeriodic() == False) + EXPECTED_LEN = 172.237458 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge) + + def test_interpolation_periodic(self): + """Test 2. Create periodic B-spline curve by set of points""" + self.mySpline = self.mySketch.addInterpolation(self.myPointRefs, periodic=True) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 - len(self.myPointRefs) + self.myNbPeriodicSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 3) + self.assertTrue(curve.isPeriodic() == True) + EXPECTED_LEN = 262.60929483 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge) + + def test_interpolation_closed(self): + """Test 3. Create closed but not periodic B-spline curve by set of points""" + self.mySpline = self.mySketch.addInterpolation(self.myPointRefs, closed=True) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 - len(self.myPointRefs) - 3 + self.myNbSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 3) + self.assertTrue(curve.isPeriodic() == False) + self.assertTrue(curve.poles()[0].distance(curve.poles()[-1]) < TOLERANCE) + EXPECTED_LEN = 274.25674928 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge) + + def test_interpolation_reorder(self): + """Test 4. Check reordering of points works properly""" + model.do() + # use low-level API to create feature + curveFitting = featureToCompositeFeature(self.mySketch.feature()).addFeature( + "SketchCurveFitting" + ) + curveFitting.string("type").setValue("interpolation_type") + curveFitting.boolean("periodic").setValue(False) + curveFitting.boolean("closed").setValue(False) + pointsAttr = curveFitting.refattrlist("points") + for ind in [0, 3, 4, 2, 1]: + pointsAttr.append(self.myPointRefs[ind]) + # perform reordering + curveFitting.customAction("reorder_points") + model.do() + + self.mySpline = SketchAPI_BSpline( + model.lastSubFeature(self.mySketch, "SketchBSpline") + ) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 - len(self.myPointRefs) - 2 + self.myNbSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 3) + self.assertTrue(curve.isPeriodic() == False) + EXPECTED_LEN = 172.237458 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge) if __name__ == "__main__": # Create a sketch with the external points model.begin() document = model.moduleDocument() - coordinates = [(50., 50.), (70., 70.), (80., 30.), (50., 10.), (10., -30.)] + coordinates = [ + (50.0, 50.0), + (70.0, 70.0), + (80.0, 30.0), + (50.0, 10.0), + (10.0, -30.0), + ] for p in coordinates: - point3D = model.addPoint(document, p[0], p[1], 0) - POINT_NAMES.append(point3D.name()) + point3D = model.addPoint(document, p[0], p[1], 0) + POINT_NAMES.append(point3D.name()) model.end() # Run testing diff --git a/src/SketchPlugin/Test/TestCurveFitting3.py b/src/SketchPlugin/Test/TestCurveFitting3.py index 40abd4c5b..18466dcbc 100644 --- a/src/SketchPlugin/Test/TestCurveFitting3.py +++ b/src/SketchPlugin/Test/TestCurveFitting3.py @@ -34,195 +34,226 @@ from GeomAlgoAPI import GeomAlgoAPI_ShapeTools as shapetools __updated__ = "2020-06-28" -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + class TestApproximation(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - coordinates = [(50., 50.), (70., 70.), (80., 30.), (50., 10.), (10., -30.)] - self.myPoints = [] - self.myPointRefs = [] - for p in coordinates: - self.myPoints.append(self.mySketch.addPoint(p[0], p[1])) - self.myPointRefs.append(self.myPoints[-1].coordinates()) - self.myDOF = 10 - self.myNbPoints = len(self.myPoints) - self.myNbLines = 0 - self.myNbSplines = 0 - self.myNbPeriodicSplines = 0 - - def tearDown(self): - self.checkDOF() - model.end() - model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) - model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) - model.testNbSubFeatures(self.mySketch, "SketchBSpline", self.myNbSplines) - model.testNbSubFeatures(self.mySketch, "SketchBSplinePeriodic", self.myNbPeriodicSplines) - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkPointsOnCurve(self, theCurve, theTolerance = 1.e-3): - for p in self.myPoints: - shape = p.defaultResult().shape() - self.assertTrue(shapetools.minimalDistance(shape, theCurve) < theTolerance) - - - def test_approximation_default(self): - """ Test 1. Create B-spline curve approximating a set of points with the default precision - """ - self.mySpline = self.mySketch.addApproximation(self.myPointRefs) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - 4 - self.myNbSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 4) - self.assertTrue(curve.isPeriodic() == False) - EXPECTED_LEN = 189.17832318 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge) - - def test_approximation_custom(self): - """ Test 2. Create B-spline curve approximating a set of points with the custom precision - """ - PRECISION = 10 - self.mySpline = self.mySketch.addApproximation(self.myPointRefs, precision = PRECISION) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - 4 - self.myNbSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 3) - self.assertTrue(curve.isPeriodic() == False) - EXPECTED_LEN = 166.97400096 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge, PRECISION) - - def test_approximation_periodic_default(self): - """ Test 3. Create periodic B-spline curve approximating set of points with the default precision - """ - self.mySpline = self.mySketch.addApproximation(self.myPointRefs, periodic = True) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - self.myNbPeriodicSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 3) - self.assertTrue(curve.isPeriodic() == True) - EXPECTED_LEN = 390.98013747 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge) - - def test_approximation_periodic_custom(self): - """ Test 4. Create periodic B-spline curve approximating set of points with the custom precision - """ - PRECISION = 10 - self.mySpline = self.mySketch.addApproximation(self.myPointRefs, precision = PRECISION, periodic = True) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - self.myNbPeriodicSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 3) - self.assertTrue(curve.isPeriodic() == True) - EXPECTED_LEN = 390.98013747 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge, PRECISION) - - def test_approximation_closed_default(self): - """ Test 5. Create closed but not periodic B-spline curve approximating set of points with the default precision - """ - self.mySpline = self.mySketch.addApproximation(self.myPointRefs, closed = True) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - 4 - self.myNbSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 5) - self.assertTrue(curve.isPeriodic() == False) - self.assertTrue(curve.poles()[0].distance(curve.poles()[-1]) < TOLERANCE) - EXPECTED_LEN = 413.18489109 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge) - - def test_approximation_closed_custom(self): - """ Test 6. Create closed but not periodic B-spline curve approximating set of points with the custom precision - """ - PRECISION = 10 - self.mySpline = self.mySketch.addApproximation(self.myPointRefs, precision = PRECISION, closed = True) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - 4 - self.myNbSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 3) - self.assertTrue(curve.isPeriodic() == False) - self.assertTrue(curve.poles()[0].distance(curve.poles()[-1]) < TOLERANCE) - EXPECTED_LEN = 276.27724118 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge, PRECISION) - - def test_approximation_reorder(self): - """ Test 7. Check reordering of points works properly - """ - PRECISION = 10 - model.do() - # use low-level API to create feature - curveFitting = featureToCompositeFeature(self.mySketch.feature()).addFeature("SketchCurveFitting") - curveFitting.string("type").setValue("approximation_type") - curveFitting.real("precision").setValue(PRECISION) - curveFitting.boolean("periodic").setValue(False) - curveFitting.boolean("closed").setValue(False) - pointsAttr = curveFitting.refattrlist("points") - for ind in [0, 3, 4, 2, 1]: - pointsAttr.append(self.myPointRefs[ind]) - # perform reordering - curveFitting.customAction("reorder_points") - model.do() - - self.mySpline = SketchAPI_BSpline(model.lastSubFeature(self.mySketch, "SketchBSpline")) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - 4 - self.myNbSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 3) - self.assertTrue(curve.isPeriodic() == False) - EXPECTED_LEN = 166.97400096 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge, PRECISION) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + coordinates = [ + (50.0, 50.0), + (70.0, 70.0), + (80.0, 30.0), + (50.0, 10.0), + (10.0, -30.0), + ] + self.myPoints = [] + self.myPointRefs = [] + for p in coordinates: + self.myPoints.append(self.mySketch.addPoint(p[0], p[1])) + self.myPointRefs.append(self.myPoints[-1].coordinates()) + self.myDOF = 10 + self.myNbPoints = len(self.myPoints) + self.myNbLines = 0 + self.myNbSplines = 0 + self.myNbPeriodicSplines = 0 + + def tearDown(self): + self.checkDOF() + model.end() + model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) + model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) + model.testNbSubFeatures(self.mySketch, "SketchBSpline", self.myNbSplines) + model.testNbSubFeatures( + self.mySketch, "SketchBSplinePeriodic", self.myNbPeriodicSplines + ) + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointsOnCurve(self, theCurve, theTolerance=1.0e-3): + for p in self.myPoints: + shape = p.defaultResult().shape() + self.assertTrue(shapetools.minimalDistance(shape, theCurve) < theTolerance) + + def test_approximation_default(self): + """Test 1. Create B-spline curve approximating a set of points with the default precision""" + self.mySpline = self.mySketch.addApproximation(self.myPointRefs) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 - 4 + self.myNbSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 4) + self.assertTrue(curve.isPeriodic() == False) + EXPECTED_LEN = 189.17832318 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge) + + def test_approximation_custom(self): + """Test 2. Create B-spline curve approximating a set of points with the custom precision""" + PRECISION = 10 + self.mySpline = self.mySketch.addApproximation( + self.myPointRefs, precision=PRECISION + ) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 - 4 + self.myNbSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 3) + self.assertTrue(curve.isPeriodic() == False) + EXPECTED_LEN = 166.97400096 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge, PRECISION) + + def test_approximation_periodic_default(self): + """Test 3. Create periodic B-spline curve approximating set of points with the default precision""" + self.mySpline = self.mySketch.addApproximation(self.myPointRefs, periodic=True) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 + self.myNbPeriodicSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 3) + self.assertTrue(curve.isPeriodic() == True) + EXPECTED_LEN = 390.98013747 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge) + + def test_approximation_periodic_custom(self): + """Test 4. Create periodic B-spline curve approximating set of points with the custom precision""" + PRECISION = 10 + self.mySpline = self.mySketch.addApproximation( + self.myPointRefs, precision=PRECISION, periodic=True + ) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 + self.myNbPeriodicSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 3) + self.assertTrue(curve.isPeriodic() == True) + EXPECTED_LEN = 390.98013747 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge, PRECISION) + + def test_approximation_closed_default(self): + """Test 5. Create closed but not periodic B-spline curve approximating set of points with the default precision""" + self.mySpline = self.mySketch.addApproximation(self.myPointRefs, closed=True) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 - 4 + self.myNbSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 5) + self.assertTrue(curve.isPeriodic() == False) + self.assertTrue(curve.poles()[0].distance(curve.poles()[-1]) < TOLERANCE) + EXPECTED_LEN = 413.18489109 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge) + + def test_approximation_closed_custom(self): + """Test 6. Create closed but not periodic B-spline curve approximating set of points with the custom precision""" + PRECISION = 10 + self.mySpline = self.mySketch.addApproximation( + self.myPointRefs, precision=PRECISION, closed=True + ) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 - 4 + self.myNbSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 3) + self.assertTrue(curve.isPeriodic() == False) + self.assertTrue(curve.poles()[0].distance(curve.poles()[-1]) < TOLERANCE) + EXPECTED_LEN = 276.27724118 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge, PRECISION) + + def test_approximation_reorder(self): + """Test 7. Check reordering of points works properly""" + PRECISION = 10 + model.do() + # use low-level API to create feature + curveFitting = featureToCompositeFeature(self.mySketch.feature()).addFeature( + "SketchCurveFitting" + ) + curveFitting.string("type").setValue("approximation_type") + curveFitting.real("precision").setValue(PRECISION) + curveFitting.boolean("periodic").setValue(False) + curveFitting.boolean("closed").setValue(False) + pointsAttr = curveFitting.refattrlist("points") + for ind in [0, 3, 4, 2, 1]: + pointsAttr.append(self.myPointRefs[ind]) + # perform reordering + curveFitting.customAction("reorder_points") + model.do() + + self.mySpline = SketchAPI_BSpline( + model.lastSubFeature(self.mySketch, "SketchBSpline") + ) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 - 4 + self.myNbSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 3) + self.assertTrue(curve.isPeriodic() == False) + EXPECTED_LEN = 166.97400096 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge, PRECISION) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestCurveFitting4.py b/src/SketchPlugin/Test/TestCurveFitting4.py index 108766c60..e6da7cf0f 100644 --- a/src/SketchPlugin/Test/TestCurveFitting4.py +++ b/src/SketchPlugin/Test/TestCurveFitting4.py @@ -34,206 +34,237 @@ from GeomAlgoAPI import GeomAlgoAPI_ShapeTools as shapetools __updated__ = "2020-06-28" -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 POINT_NAMES = [] + class TestApproximationExternal(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myPoints = [] - self.myPointRefs = [] - for name in POINT_NAMES: - proj = self.mySketch.addProjection(model.selection("VERTEX", name), False) - self.myPoints.append(SketchAPI_Point(proj.createdFeature())) - self.myPointRefs.append(self.myPoints[-1].coordinates()) - self.myDOF = 0 - self.myNbPoints = len(self.myPoints) - self.myNbLines = 0 - self.myNbSplines = 0 - self.myNbPeriodicSplines = 0 - - def tearDown(self): - self.checkDOF() - model.end() - model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) - model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) - model.testNbSubFeatures(self.mySketch, "SketchBSpline", self.myNbSplines) - model.testNbSubFeatures(self.mySketch, "SketchBSplinePeriodic", self.myNbPeriodicSplines) - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkPointsOnCurve(self, theCurve, theTolerance = 1.e-3): - for p in self.myPoints: - shape = p.defaultResult().shape() - self.assertTrue(shapetools.minimalDistance(shape, theCurve) < theTolerance) - - - def test_approximation_default(self): - """ Test 1. Create B-spline curve approximating a set of points with the default precision - """ - self.mySpline = self.mySketch.addApproximation(self.myPointRefs) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - 4 - self.myNbSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 4) - self.assertTrue(curve.isPeriodic() == False) - EXPECTED_LEN = 189.17832318 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge) - - def test_approximation_custom(self): - """ Test 2. Create B-spline curve approximating a set of points with the custom precision - """ - PRECISION = 10 - self.mySpline = self.mySketch.addApproximation(self.myPointRefs, precision = PRECISION) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - 4 - self.myNbSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 3) - self.assertTrue(curve.isPeriodic() == False) - EXPECTED_LEN = 166.97400096 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge, PRECISION) - - def test_approximation_periodic_default(self): - """ Test 3. Create periodic B-spline curve approximating set of points with the default precision - """ - self.mySpline = self.mySketch.addApproximation(self.myPointRefs, periodic = True) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - self.myNbPeriodicSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 3) - self.assertTrue(curve.isPeriodic() == True) - EXPECTED_LEN = 390.98013747 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge) - - def test_approximation_periodic_custom(self): - """ Test 4. Create periodic B-spline curve approximating set of points with the custom precision - """ - PRECISION = 10 - self.mySpline = self.mySketch.addApproximation(self.myPointRefs, precision = PRECISION, periodic = True) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - self.myNbPeriodicSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 3) - self.assertTrue(curve.isPeriodic() == True) - EXPECTED_LEN = 390.98013747 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge, PRECISION) - - def test_approximation_closed_default(self): - """ Test 5. Create closed but not periodic B-spline curve approximating set of points with the default precision - """ - self.mySpline = self.mySketch.addApproximation(self.myPointRefs, closed = True) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - 4 - self.myNbSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 5) - self.assertTrue(curve.isPeriodic() == False) - self.assertTrue(curve.poles()[0].distance(curve.poles()[-1]) < TOLERANCE) - EXPECTED_LEN = 413.18489109 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge) - - def test_approximation_closed_custom(self): - """ Test 6. Create closed but not periodic B-spline curve approximating set of points with the custom precision - """ - PRECISION = 10 - self.mySpline = self.mySketch.addApproximation(self.myPointRefs, precision = PRECISION, closed = True) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - 4 - self.myNbSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 3) - self.assertTrue(curve.isPeriodic() == False) - self.assertTrue(curve.poles()[0].distance(curve.poles()[-1]) < TOLERANCE) - EXPECTED_LEN = 276.27724118 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge, PRECISION) - - def test_approximation_reorder(self): - """ Test 7. Check reordering of points works properly - """ - PRECISION = 10 - model.do() - # use low-level API to create feature - curveFitting = featureToCompositeFeature(self.mySketch.feature()).addFeature("SketchCurveFitting") - curveFitting.string("type").setValue("approximation_type") - curveFitting.real("precision").setValue(PRECISION) - curveFitting.boolean("periodic").setValue(False) - curveFitting.boolean("closed").setValue(False) - pointsAttr = curveFitting.refattrlist("points") - for ind in [0, 3, 4, 2, 1]: - pointsAttr.append(self.myPointRefs[ind]) - # perform reordering - curveFitting.customAction("reorder_points") - model.do() - - self.mySpline = SketchAPI_BSpline(model.lastSubFeature(self.mySketch, "SketchBSpline")) - edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) - curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) - self.myDOF += len(curve.poles()) * 2 - 4 - self.myNbSplines += 1 - model.do() - - self.assertTrue(self.mySpline.feature()) - self.assertTrue(self.mySpline.feature().error() == "") - self.assertTrue(self.mySpline.degree().value() == 3) - self.assertTrue(curve.isPeriodic() == False) - EXPECTED_LEN = 166.97400096 - self.assertTrue(math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN)) - # check points lying of the created curve - self.checkPointsOnCurve(edge, PRECISION) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myPoints = [] + self.myPointRefs = [] + for name in POINT_NAMES: + proj = self.mySketch.addProjection(model.selection("VERTEX", name), False) + self.myPoints.append(SketchAPI_Point(proj.createdFeature())) + self.myPointRefs.append(self.myPoints[-1].coordinates()) + self.myDOF = 0 + self.myNbPoints = len(self.myPoints) + self.myNbLines = 0 + self.myNbSplines = 0 + self.myNbPeriodicSplines = 0 + + def tearDown(self): + self.checkDOF() + model.end() + model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) + model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) + model.testNbSubFeatures(self.mySketch, "SketchBSpline", self.myNbSplines) + model.testNbSubFeatures( + self.mySketch, "SketchBSplinePeriodic", self.myNbPeriodicSplines + ) + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointsOnCurve(self, theCurve, theTolerance=1.0e-3): + for p in self.myPoints: + shape = p.defaultResult().shape() + self.assertTrue(shapetools.minimalDistance(shape, theCurve) < theTolerance) + + def test_approximation_default(self): + """Test 1. Create B-spline curve approximating a set of points with the default precision""" + self.mySpline = self.mySketch.addApproximation(self.myPointRefs) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 - 4 + self.myNbSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 4) + self.assertTrue(curve.isPeriodic() == False) + EXPECTED_LEN = 189.17832318 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge) + + def test_approximation_custom(self): + """Test 2. Create B-spline curve approximating a set of points with the custom precision""" + PRECISION = 10 + self.mySpline = self.mySketch.addApproximation( + self.myPointRefs, precision=PRECISION + ) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 - 4 + self.myNbSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 3) + self.assertTrue(curve.isPeriodic() == False) + EXPECTED_LEN = 166.97400096 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge, PRECISION) + + def test_approximation_periodic_default(self): + """Test 3. Create periodic B-spline curve approximating set of points with the default precision""" + self.mySpline = self.mySketch.addApproximation(self.myPointRefs, periodic=True) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 + self.myNbPeriodicSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 3) + self.assertTrue(curve.isPeriodic() == True) + EXPECTED_LEN = 390.98013747 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge) + + def test_approximation_periodic_custom(self): + """Test 4. Create periodic B-spline curve approximating set of points with the custom precision""" + PRECISION = 10 + self.mySpline = self.mySketch.addApproximation( + self.myPointRefs, precision=PRECISION, periodic=True + ) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 + self.myNbPeriodicSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 3) + self.assertTrue(curve.isPeriodic() == True) + EXPECTED_LEN = 390.98013747 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge, PRECISION) + + def test_approximation_closed_default(self): + """Test 5. Create closed but not periodic B-spline curve approximating set of points with the default precision""" + self.mySpline = self.mySketch.addApproximation(self.myPointRefs, closed=True) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 - 4 + self.myNbSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 5) + self.assertTrue(curve.isPeriodic() == False) + self.assertTrue(curve.poles()[0].distance(curve.poles()[-1]) < TOLERANCE) + EXPECTED_LEN = 413.18489109 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge) + + def test_approximation_closed_custom(self): + """Test 6. Create closed but not periodic B-spline curve approximating set of points with the custom precision""" + PRECISION = 10 + self.mySpline = self.mySketch.addApproximation( + self.myPointRefs, precision=PRECISION, closed=True + ) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 - 4 + self.myNbSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 3) + self.assertTrue(curve.isPeriodic() == False) + self.assertTrue(curve.poles()[0].distance(curve.poles()[-1]) < TOLERANCE) + EXPECTED_LEN = 276.27724118 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge, PRECISION) + + def test_approximation_reorder(self): + """Test 7. Check reordering of points works properly""" + PRECISION = 10 + model.do() + # use low-level API to create feature + curveFitting = featureToCompositeFeature(self.mySketch.feature()).addFeature( + "SketchCurveFitting" + ) + curveFitting.string("type").setValue("approximation_type") + curveFitting.real("precision").setValue(PRECISION) + curveFitting.boolean("periodic").setValue(False) + curveFitting.boolean("closed").setValue(False) + pointsAttr = curveFitting.refattrlist("points") + for ind in [0, 3, 4, 2, 1]: + pointsAttr.append(self.myPointRefs[ind]) + # perform reordering + curveFitting.customAction("reorder_points") + model.do() + + self.mySpline = SketchAPI_BSpline( + model.lastSubFeature(self.mySketch, "SketchBSpline") + ) + edge = GeomAPI_Edge(self.mySpline.defaultResult().shape()) + curve = GeomAPI_BSpline(GeomAPI_Curve(edge)) + self.myDOF += len(curve.poles()) * 2 - 4 + self.myNbSplines += 1 + model.do() + + self.assertTrue(self.mySpline.feature()) + self.assertTrue(self.mySpline.feature().error() == "") + self.assertTrue(self.mySpline.degree().value() == 3) + self.assertTrue(curve.isPeriodic() == False) + EXPECTED_LEN = 166.97400096 + self.assertTrue( + math.fabs(edge.length() - EXPECTED_LEN) < TOLERANCE, + "Curve length: {}; expected: {}".format(edge.length(), EXPECTED_LEN), + ) + # check points lying of the created curve + self.checkPointsOnCurve(edge, PRECISION) if __name__ == "__main__": # Create a sketch with the external points model.begin() document = model.moduleDocument() - coordinates = [(50., 50.), (70., 70.), (80., 30.), (50., 10.), (10., -30.)] + coordinates = [ + (50.0, 50.0), + (70.0, 70.0), + (80.0, 30.0), + (50.0, 10.0), + (10.0, -30.0), + ] for p in coordinates: - point3D = model.addPoint(document, p[0], p[1], 0) - POINT_NAMES.append(point3D.name()) + point3D = model.addPoint(document, p[0], p[1], 0) + POINT_NAMES.append(point3D.name()) model.end() # Run testing diff --git a/src/SketchPlugin/Test/TestDegeneratedGeometry.py b/src/SketchPlugin/Test/TestDegeneratedGeometry.py index 3a22ce18c..04f136698 100644 --- a/src/SketchPlugin/Test/TestDegeneratedGeometry.py +++ b/src/SketchPlugin/Test/TestDegeneratedGeometry.py @@ -30,16 +30,22 @@ Part_1_doc = Part_1.document() # Test 1. Make a circle degenerated ####################################### Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(25, 20, 25) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_1.result(), SketchCircle_1.results()[1]) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_1.result(), SketchCircle_1.results()[1] +) model.do() model.end() # case 1: undo the error model.begin() -aCoincidence = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center()) +aCoincidence = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center() +) model.do() model.end() model.checkSketchErrorDegenerated(Sketch_1) @@ -48,7 +54,9 @@ model.checkSketch(Sketch_1) # case 2: remove degeneracy-producting constraint model.begin() -aCoincidence = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center()) +aCoincidence = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center() +) model.do() model.checkSketchErrorDegenerated(Sketch_1) Part_1_doc.removeFeature(aCoincidence.feature()) @@ -58,7 +66,9 @@ model.checkSketch(Sketch_1) # case 3: remove degenerated edge model.begin() -aCoincidence = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center()) +aCoincidence = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_1).startPoint(), SketchCircle_1.center() +) model.do() model.checkSketchErrorDegenerated(Sketch_1) ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchCircle_1.feature()])) @@ -120,7 +130,15 @@ model.checkSketch(Sketch_2) ####################################### model.begin() Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchArc_1 = Sketch_3.addArc(-23.95261096318143, -9.48105223640866, -4.386575834490306, -17.91131183048461, -20.45766592507274, 11.53523589116715, False) +SketchArc_1 = Sketch_3.addArc( + -23.95261096318143, + -9.48105223640866, + -4.386575834490306, + -17.91131183048461, + -20.45766592507274, + 11.53523589116715, + False, +) model.do() model.end() @@ -149,4 +167,4 @@ model.do() model.checkSketchErrorDegenerated(Sketch_3) ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchArc_1.feature()])) model.end() -assert(Sketch_3.solverError().value() == "") +assert Sketch_3.solverError().value() == "" diff --git a/src/SketchPlugin/Test/TestDistanceDump.py b/src/SketchPlugin/Test/TestDistanceDump.py index 5171af371..6533f3701 100644 --- a/src/SketchPlugin/Test/TestDistanceDump.py +++ b/src/SketchPlugin/Test/TestDistanceDump.py @@ -31,24 +31,56 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Parameter_1 = model.addParameter(Part_1_doc, "a", "10") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(22.18754371333437, 31.96766851898132, 36.16301361286303, 24.640865178987) -SketchLine_2 = Sketch_1.addLine(36.16301361286303, 24.640865178987, 45.95667186595785, 26.6618199092043) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(45.95667186595785, 26.6618199092043, 55.95667186595785, 16.6618199092043) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_2.result(), Parameter_1.name().value(), True) -SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), Parameter_1.name().value()) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_2.endPoint(), SketchLine_3.endPoint(), Parameter_1.name().value()) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_2.endPoint(), SketchLine_3.endPoint(), Parameter_1.name().value()) +SketchLine_1 = Sketch_1.addLine( + 22.18754371333437, 31.96766851898132, 36.16301361286303, 24.640865178987 +) +SketchLine_2 = Sketch_1.addLine( + 36.16301361286303, 24.640865178987, 45.95667186595785, 26.6618199092043 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 45.95667186595785, 26.6618199092043, 55.95667186595785, 16.6618199092043 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_2.result(), Parameter_1.name().value(), True +) +SketchConstraintLength_1 = Sketch_1.setLength( + SketchLine_2.result(), Parameter_1.name().value() +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_2.endPoint(), SketchLine_3.endPoint(), Parameter_1.name().value() +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_2.endPoint(), SketchLine_3.endPoint(), Parameter_1.name().value() +) model.do() model.end() + def assertEqual(str1, str2): - assert(str1 == str2), "{} != {}".format(str1, str2) + assert str1 == str2, "{} != {}".format(str1, str2) + -assertEqual(SketchConstraintDistance_1.feature().real("ConstraintValue").text(), Parameter_1.name().value()) -assertEqual(SketchConstraintLength_1.feature().real("ConstraintValue").text(), Parameter_1.name().value()) -assertEqual(SketchConstraintDistanceHorizontal_1.feature().real("DistanceValue").text(), Parameter_1.name().value()) -assertEqual(SketchConstraintDistanceVertical_1.feature().real("DistanceValue").text(), Parameter_1.name().value()) +assertEqual( + SketchConstraintDistance_1.feature().real("ConstraintValue").text(), + Parameter_1.name().value(), +) +assertEqual( + SketchConstraintLength_1.feature().real("ConstraintValue").text(), + Parameter_1.name().value(), +) +assertEqual( + SketchConstraintDistanceHorizontal_1.feature().real("DistanceValue").text(), + Parameter_1.name().value(), +) +assertEqual( + SketchConstraintDistanceVertical_1.feature().real("DistanceValue").text(), + Parameter_1.name().value(), +) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned01.py b/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned01.py index 264f46ea5..d6fd911cc 100644 --- a/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned01.py +++ b/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned01.py @@ -21,7 +21,7 @@ from salome.shaper import model from SketchAPI import * import math -TOLERANCE = 1.e-5 +TOLERANCE = 1.0e-5 model.begin() partSet = model.moduleDocument() @@ -39,7 +39,9 @@ Sketch_1.setSignedDistance(Point_1.result(), SketchAPI_Line(Line_4).result(), "d Point_2 = Sketch_1.addPoint(230, 80) Sketch_1.setUnsignedDistance(Point_2.result(), SketchAPI_Line(Line_4).result(), "d") model.do() -assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation" +assert ( + Sketch_1.solverError().value() == "" +), "FAILED: Sketch should NOT report over-constrained situation" line = model.toSketchFeature(Line_4) signedDist1 = model.signedDistancePointLine(Point_1, line) @@ -49,19 +51,30 @@ signedDist2 = model.signedDistancePointLine(Point_2, line) widthParam.setValue(300) model.do() curDist = model.signedDistancePointLine(Point_1, line) -assert(math.fabs(signedDist1 - curDist) < TOLERANCE), "Expected {}, actual {}".format(signedDist1, curDist) +assert math.fabs(signedDist1 - curDist) < TOLERANCE, "Expected {}, actual {}".format( + signedDist1, curDist +) curDist = model.signedDistancePointLine(Point_2, line) -assert(math.fabs(math.fabs(signedDist2) - math.fabs(curDist)) < TOLERANCE), "Expected {}, actual {}".format(signedDist2, -curDist) -assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation" +assert ( + math.fabs(math.fabs(signedDist2) - math.fabs(curDist)) < TOLERANCE +), "Expected {}, actual {}".format(signedDist2, -curDist) +assert ( + Sketch_1.solverError().value() == "" +), "FAILED: Sketch should NOT report over-constrained situation" # revert rectangle width and check distances again widthParam.setValue(300) model.do() curDist = model.signedDistancePointLine(Point_1, line) -assert(math.fabs(signedDist1 - curDist) < TOLERANCE), "Expected {}, actual {}".format(signedDist1, curDist) +assert math.fabs(signedDist1 - curDist) < TOLERANCE, "Expected {}, actual {}".format( + signedDist1, curDist +) curDist = model.signedDistancePointLine(Point_2, line) -assert(math.fabs(math.fabs(signedDist2) - math.fabs(curDist)) < TOLERANCE), "Expected {}, actual {}".format(signedDist2, -curDist) -assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation" +assert ( + math.fabs(math.fabs(signedDist2) - math.fabs(curDist)) < TOLERANCE +), "Expected {}, actual {}".format(signedDist2, -curDist) +assert ( + Sketch_1.solverError().value() == "" +), "FAILED: Sketch should NOT report over-constrained situation" model.end() - diff --git a/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned02.py b/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned02.py index 0945ea326..908e8262a 100644 --- a/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned02.py +++ b/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned02.py @@ -21,7 +21,7 @@ from salome.shaper import model from SketchAPI import * import math -TOLERANCE = 1.e-5 +TOLERANCE = 1.0e-5 model.begin() partSet = model.moduleDocument() @@ -39,7 +39,9 @@ Sketch_1.setSignedDistance(Circle_1.center(), SketchAPI_Line(Line_4).result(), " Circle_2 = Sketch_1.addCircle(230, 80, 20) Sketch_1.setUnsignedDistance(Circle_2.center(), SketchAPI_Line(Line_4).result(), "d") model.do() -assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation" +assert ( + Sketch_1.solverError().value() == "" +), "FAILED: Sketch should NOT report over-constrained situation" center1 = Circle_1.center() center2 = Circle_2.center() @@ -51,19 +53,30 @@ signedDist2 = model.signedDistancePointLine(center2, line) widthParam.setValue(300) model.do() curDist = model.signedDistancePointLine(center1, line) -assert(math.fabs(signedDist1 - curDist) < TOLERANCE), "Expected {}, actual {}".format(signedDist1, curDist) +assert math.fabs(signedDist1 - curDist) < TOLERANCE, "Expected {}, actual {}".format( + signedDist1, curDist +) curDist = model.signedDistancePointLine(center2, line) -assert(math.fabs(math.fabs(signedDist2) - math.fabs(curDist)) < TOLERANCE), "Expected {}, actual {}".format(signedDist2, -curDist) -assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation" +assert ( + math.fabs(math.fabs(signedDist2) - math.fabs(curDist)) < TOLERANCE +), "Expected {}, actual {}".format(signedDist2, -curDist) +assert ( + Sketch_1.solverError().value() == "" +), "FAILED: Sketch should NOT report over-constrained situation" # revert rectangle width and check distances again widthParam.setValue(200) model.do() curDist = model.signedDistancePointLine(center1, line) -assert(math.fabs(signedDist1 - curDist) < TOLERANCE), "Expected {}, actual {}".format(signedDist1, curDist) +assert math.fabs(signedDist1 - curDist) < TOLERANCE, "Expected {}, actual {}".format( + signedDist1, curDist +) curDist = model.signedDistancePointLine(center2, line) -assert(math.fabs(math.fabs(signedDist2) - math.fabs(curDist)) < TOLERANCE), "Expected {}, actual {}".format(signedDist2, -curDist) -assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation" +assert ( + math.fabs(math.fabs(signedDist2) - math.fabs(curDist)) < TOLERANCE +), "Expected {}, actual {}".format(signedDist2, -curDist) +assert ( + Sketch_1.solverError().value() == "" +), "FAILED: Sketch should NOT report over-constrained situation" model.end() - diff --git a/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned03.py b/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned03.py index db0102551..d8491d546 100644 --- a/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned03.py +++ b/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned03.py @@ -21,7 +21,7 @@ from salome.shaper import model from SketchAPI import * import math -TOLERANCE = 1.e-5 +TOLERANCE = 1.0e-5 model.begin() partSet = model.moduleDocument() @@ -38,7 +38,9 @@ Line_5 = Sketch_1.addLine(230, 40, 230, 80) Sketch_1.setSignedDistance(Line_5.startPoint(), SketchAPI_Line(Line_4).result(), "d") Sketch_1.setUnsignedDistance(Line_5.endPoint(), SketchAPI_Line(Line_4).result(), "d") model.do() -assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation" +assert ( + Sketch_1.solverError().value() == "" +), "FAILED: Sketch should NOT report over-constrained situation" start = Line_5.startPoint() end = Line_5.endPoint() @@ -50,19 +52,30 @@ signedDist2 = model.signedDistancePointLine(end, line) widthParam.setValue(300) model.do() curDist = model.signedDistancePointLine(start, line) -assert(math.fabs(signedDist1 - curDist) < TOLERANCE), "Expected {}, actual {}".format(signedDist1, curDist) +assert math.fabs(signedDist1 - curDist) < TOLERANCE, "Expected {}, actual {}".format( + signedDist1, curDist +) curDist = model.signedDistancePointLine(end, line) -assert(math.fabs(math.fabs(signedDist2) - math.fabs(curDist)) < TOLERANCE), "Expected {}, actual {}".format(signedDist2, -curDist) -assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation" +assert ( + math.fabs(math.fabs(signedDist2) - math.fabs(curDist)) < TOLERANCE +), "Expected {}, actual {}".format(signedDist2, -curDist) +assert ( + Sketch_1.solverError().value() == "" +), "FAILED: Sketch should NOT report over-constrained situation" # revert rectangle width and check distances again widthParam.setValue(200) model.do() curDist = model.signedDistancePointLine(start, line) -assert(math.fabs(signedDist1 - curDist) < TOLERANCE), "Expected {}, actual {}".format(signedDist1, curDist) +assert math.fabs(signedDist1 - curDist) < TOLERANCE, "Expected {}, actual {}".format( + signedDist1, curDist +) curDist = model.signedDistancePointLine(end, line) -assert(math.fabs(math.fabs(signedDist2) - math.fabs(curDist)) < TOLERANCE), "Expected {}, actual {}".format(signedDist2, -curDist) -assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation" +assert ( + math.fabs(math.fabs(signedDist2) - math.fabs(curDist)) < TOLERANCE +), "Expected {}, actual {}".format(signedDist2, -curDist) +assert ( + Sketch_1.solverError().value() == "" +), "FAILED: Sketch should NOT report over-constrained situation" model.end() - diff --git a/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned04.py b/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned04.py index 5d4f8cd98..383d90de6 100644 --- a/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned04.py +++ b/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned04.py @@ -21,7 +21,7 @@ from salome.shaper import model from SketchAPI import * import math -TOLERANCE = 1.e-5 +TOLERANCE = 1.0e-5 model.begin() partSet = model.moduleDocument() @@ -38,7 +38,9 @@ Arc_1 = Sketch_1.addArc(250, 60, 230, 40, 230, 80, False) Sketch_1.setSignedDistance(Arc_1.startPoint(), SketchAPI_Line(Line_4).result(), "d") Sketch_1.setUnsignedDistance(Arc_1.endPoint(), SketchAPI_Line(Line_4).result(), "d") model.do() -assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation" +assert ( + Sketch_1.solverError().value() == "" +), "FAILED: Sketch should NOT report over-constrained situation" start = Arc_1.startPoint() end = Arc_1.endPoint() @@ -50,21 +52,32 @@ signedDist2 = model.signedDistancePointLine(end, line) widthParam.setValue(300) model.do() curDist = model.signedDistancePointLine(start, line) -assert(math.fabs(signedDist1 - curDist) < TOLERANCE), "Expected {}, actual {}".format(signedDist1, curDist) +assert math.fabs(signedDist1 - curDist) < TOLERANCE, "Expected {}, actual {}".format( + signedDist1, curDist +) curDist = model.signedDistancePointLine(end, line) -assert(math.fabs(math.fabs(signedDist2) - math.fabs(curDist)) < TOLERANCE), "Expected {}, actual {}".format(signedDist2, -curDist) +assert ( + math.fabs(math.fabs(signedDist2) - math.fabs(curDist)) < TOLERANCE +), "Expected {}, actual {}".format(signedDist2, -curDist) model.assertArcValidity(Arc_1) -assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation" +assert ( + Sketch_1.solverError().value() == "" +), "FAILED: Sketch should NOT report over-constrained situation" # revert rectangle width and check distances again widthParam.setValue(200) model.do() curDist = model.signedDistancePointLine(start, line) -assert(math.fabs(signedDist1 - curDist) < TOLERANCE), "Expected {}, actual {}".format(signedDist1, curDist) +assert math.fabs(signedDist1 - curDist) < TOLERANCE, "Expected {}, actual {}".format( + signedDist1, curDist +) curDist = model.signedDistancePointLine(end, line) -assert(math.fabs(math.fabs(signedDist2) - math.fabs(curDist)) < TOLERANCE), "Expected {}, actual {}".format(signedDist2, -curDist) +assert ( + math.fabs(math.fabs(signedDist2) - math.fabs(curDist)) < TOLERANCE +), "Expected {}, actual {}".format(signedDist2, -curDist) model.assertArcValidity(Arc_1) -assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation" +assert ( + Sketch_1.solverError().value() == "" +), "FAILED: Sketch should NOT report over-constrained situation" model.end() - diff --git a/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned05.py b/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned05.py index 85b99a234..43a9afaf7 100644 --- a/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned05.py +++ b/src/SketchPlugin/Test/TestDistanceSignedVsUnsigned05.py @@ -21,7 +21,7 @@ from salome.shaper import model from SketchAPI import * import math -TOLERANCE = 1.e-5 +TOLERANCE = 1.0e-5 model.begin() partSet = model.moduleDocument() @@ -42,7 +42,9 @@ Line_5 = Sketch_1.addLine(260, 0, 260, 100) Sketch_1.setSignedDistance(Point_1.result(), Line_5.result(), "d") Sketch_1.setUnsignedDistance(Point_2.result(), Line_5.result(), "d") model.do() -assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation" +assert ( + Sketch_1.solverError().value() == "" +), "FAILED: Sketch should NOT report over-constrained situation" line4 = model.toSketchFeature(Line_4) line5 = model.toSketchFeature(Line_5) @@ -55,27 +57,46 @@ signedDist25 = model.signedDistancePointLine(Point_2, line5) widthParam.setValue(300) model.do() curDist = model.signedDistancePointLine(Point_1, line4) -assert(math.fabs(signedDist14 - curDist) < TOLERANCE), "Expected {}, actual {}".format(signedDist14, curDist) +assert math.fabs(signedDist14 - curDist) < TOLERANCE, "Expected {}, actual {}".format( + signedDist14, curDist +) curDist = model.signedDistancePointLine(Point_2, line4) -assert(math.fabs(math.fabs(signedDist24) - math.fabs(curDist)) < TOLERANCE), "Expected {}, actual {}".format(signedDist24, -curDist) +assert ( + math.fabs(math.fabs(signedDist24) - math.fabs(curDist)) < TOLERANCE +), "Expected {}, actual {}".format(signedDist24, -curDist) curDist = model.signedDistancePointLine(Point_1, line5) -assert(math.fabs(signedDist15 - curDist) < TOLERANCE), "Expected {}, actual {}".format(signedDist15, curDist) +assert math.fabs(signedDist15 - curDist) < TOLERANCE, "Expected {}, actual {}".format( + signedDist15, curDist +) curDist = model.signedDistancePointLine(Point_2, line5) -assert(math.fabs(math.fabs(signedDist25) - math.fabs(curDist)) < TOLERANCE), "Expected {}, actual {}".format(signedDist25, -curDist) -assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation" +assert ( + math.fabs(math.fabs(signedDist25) - math.fabs(curDist)) < TOLERANCE +), "Expected {}, actual {}".format(signedDist25, -curDist) +assert ( + Sketch_1.solverError().value() == "" +), "FAILED: Sketch should NOT report over-constrained situation" # revert rectangle width and check distances again widthParam.setValue(200) model.do() curDist = model.signedDistancePointLine(Point_1, line4) -assert(math.fabs(signedDist14 - curDist) < TOLERANCE), "Expected {}, actual {}".format(signedDist14, curDist) +assert math.fabs(signedDist14 - curDist) < TOLERANCE, "Expected {}, actual {}".format( + signedDist14, curDist +) curDist = model.signedDistancePointLine(Point_2, line4) -assert(math.fabs(math.fabs(signedDist24) - math.fabs(curDist)) < TOLERANCE), "Expected {}, actual {}".format(signedDist24, -curDist) +assert ( + math.fabs(math.fabs(signedDist24) - math.fabs(curDist)) < TOLERANCE +), "Expected {}, actual {}".format(signedDist24, -curDist) curDist = model.signedDistancePointLine(Point_1, line5) -assert(math.fabs(signedDist15 - curDist) < TOLERANCE), "Expected {}, actual {}".format(signedDist15, curDist) +assert math.fabs(signedDist15 - curDist) < TOLERANCE, "Expected {}, actual {}".format( + signedDist15, curDist +) curDist = model.signedDistancePointLine(Point_2, line5) -assert(math.fabs(math.fabs(signedDist25) - math.fabs(curDist)) < TOLERANCE), "Expected {}, actual {}".format(signedDist25, -curDist) -assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation" +assert ( + math.fabs(math.fabs(signedDist25) - math.fabs(curDist)) < TOLERANCE +), "Expected {}, actual {}".format(signedDist25, -curDist) +assert ( + Sketch_1.solverError().value() == "" +), "FAILED: Sketch should NOT report over-constrained situation" model.end() - diff --git a/src/SketchPlugin/Test/TestEdgesOrder.py b/src/SketchPlugin/Test/TestEdgesOrder.py index f977283c5..0ad9471a9 100644 --- a/src/SketchPlugin/Test/TestEdgesOrder.py +++ b/src/SketchPlugin/Test/TestEdgesOrder.py @@ -31,18 +31,30 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(40, 5, 40, -25) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) SketchLine_2 = Sketch_1.addLine(40, -25, -10, -25) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 50) SketchLine_3 = Sketch_1.addLine(-10, -25, -10, 5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(-10, 5, 40, 5) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_4.endPoint() +) model.do() # Change Length references -SketchConstraintLength_1.feature().refattr("ConstraintEntityA").setObject(SketchLine_3.feature().lastResult()) -SketchConstraintLength_2.feature().refattr("ConstraintEntityA").setObject(SketchLine_4.feature().lastResult()) +SketchConstraintLength_1.feature().refattr("ConstraintEntityA").setObject( + SketchLine_3.feature().lastResult() +) +SketchConstraintLength_2.feature().refattr("ConstraintEntityA").setObject( + SketchLine_4.feature().lastResult() +) model.do() # Remove the first line, then build it and constraints from scratch Part_1_doc.removeFeature(SketchConstraintCoincidence_1.feature()) @@ -54,103 +66,318 @@ 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_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r")], 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&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&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), False) +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&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&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_5.startPoint(), SketchPoint_1.result() +) +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&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False) +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&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&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), False) +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&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) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchLine_8.endPoint()) +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, +) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_5.startPoint(), SketchLine_8.endPoint() +) 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&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&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), False) +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&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&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident( + SketchLine_9.startPoint(), SketchPoint_5.result() +) +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()) +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&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False) +SketchConstraintCoincidence_15 = Sketch_3.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +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&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"), False) +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&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) -SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_9.startPoint(), SketchLine_12.endPoint()) +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, +) +SketchConstraintCoincidence_19 = Sketch_3.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident( + SketchLine_9.startPoint(), SketchLine_12.endPoint() +) 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&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&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"), False) +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&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&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False) +SketchConstraintCoincidence_21 = Sketch_4.setCoincident( + SketchLine_13.startPoint(), SketchPoint_9.result() +) +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()) +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&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"), False) +SketchConstraintCoincidence_23 = Sketch_4.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) +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&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"), False) +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&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) -SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_28 = Sketch_4.setCoincident(SketchLine_13.startPoint(), SketchLine_16.endPoint()) +SketchConstraintCoincidence_26 = Sketch_4.setCoincident( + SketchLine_15.endPoint(), SketchPoint_12.result() +) +SketchLine_16 = Sketch_4.addLine( + -7.390401047140179, 8.881784197001252e-016, 22.60959895285983, 0 +) +SketchConstraintCoincidence_27 = Sketch_4.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_28 = Sketch_4.setCoincident( + SketchLine_13.startPoint(), SketchLine_16.endPoint() +) 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&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&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"), False) +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&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&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"), False) +SketchConstraintCoincidence_29 = Sketch_5.setCoincident( + SketchLine_17.startPoint(), SketchPoint_13.result() +) +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()) +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&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False) +SketchConstraintCoincidence_31 = Sketch_5.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) +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&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), False) +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&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) -SketchConstraintCoincidence_35 = Sketch_5.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_36 = Sketch_5.setCoincident(SketchLine_17.startPoint(), SketchLine_20.endPoint()) +SketchConstraintCoincidence_34 = Sketch_5.setCoincident( + SketchLine_19.endPoint(), SketchPoint_16.result() +) +SketchLine_20 = Sketch_5.addLine( + 39.35022675011398, 4.440892098500626e-016, -10.64977324988603, 0 +) +SketchConstraintCoincidence_35 = Sketch_5.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) +SketchConstraintCoincidence_36 = Sketch_5.setCoincident( + SketchLine_17.startPoint(), SketchLine_20.endPoint() +) Extrusion_5.setNestedSketch(Sketch_5) model.do() model.end() @@ -161,7 +388,7 @@ model.testResultsVolumes(Extrusion_3, [3000]) model.testResultsVolumes(Extrusion_4, [5000]) model.testResultsVolumes(Extrusion_5, [2000]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() # check volumes after dump and restore model.testResultsVolumes(Extrusion_2, [4000]) diff --git a/src/SketchPlugin/Test/TestFillet.py b/src/SketchPlugin/Test/TestFillet.py index 4ded8ccd4..58c418474 100644 --- a/src/SketchPlugin/Test/TestFillet.py +++ b/src/SketchPlugin/Test/TestFillet.py @@ -33,10 +33,11 @@ from ModelAPI import * import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Auxiliary functions -#========================================================================= -TOLERANCE = 1.e-7 +# ========================================================================= +TOLERANCE = 1.0e-7 + def createSketch1(theSketch): global aEndPoint1, aEndPoint2 @@ -47,23 +48,23 @@ def createSketch1(theSketch): # Line1 aSketchLine1 = theSketch.addFeature("SketchLine") aStartPoint1 = geomDataAPI_Point2D(aSketchLine1.attribute("StartPoint")) - aEndPoint1 = geomDataAPI_Point2D(aSketchLine1.attribute("EndPoint")) - aStartPoint1.setValue(-10., -10.) - aEndPoint1.setValue(-10., 10.) + aEndPoint1 = geomDataAPI_Point2D(aSketchLine1.attribute("EndPoint")) + aStartPoint1.setValue(-10.0, -10.0) + aEndPoint1.setValue(-10.0, 10.0) allFeatures.append(aSketchLine1) # Line2 aSketchLine2 = theSketch.addFeature("SketchLine") aStartPoint2 = geomDataAPI_Point2D(aSketchLine2.attribute("StartPoint")) - aEndPoint2 = geomDataAPI_Point2D(aSketchLine2.attribute("EndPoint")) - aStartPoint2.setValue(-10., 10.) - aEndPoint2.setValue(10., 10.) + aEndPoint2 = geomDataAPI_Point2D(aSketchLine2.attribute("EndPoint")) + aStartPoint2.setValue(-10.0, 10.0) + aEndPoint2.setValue(10.0, 10.0) allFeatures.append(aSketchLine2) # Line3 aSketchLine3 = theSketch.addFeature("SketchLine") aStartPoint3 = geomDataAPI_Point2D(aSketchLine3.attribute("StartPoint")) - aEndPoint3 = geomDataAPI_Point2D(aSketchLine3.attribute("EndPoint")) - aStartPoint3.setValue(10., 10.) - aEndPoint3.setValue(10., -10.) + aEndPoint3 = geomDataAPI_Point2D(aSketchLine3.attribute("EndPoint")) + aStartPoint3.setValue(10.0, 10.0) + aEndPoint3.setValue(10.0, -10.0) allFeatures.append(aSketchLine3) # Coincidence1 aCoincidence1 = theSketch.addFeature("SketchConstraintCoincidence") @@ -87,18 +88,18 @@ def createSketch2(theSketch): # Line aSketchLine = theSketch.addFeature("SketchLine") aStartPoint1 = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) - aEndPoint1 = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) - aStartPoint1.setValue(10., 10.) - aEndPoint1.setValue(30., 15.) + aEndPoint1 = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) + aStartPoint1.setValue(10.0, 10.0) + aEndPoint1.setValue(30.0, 15.0) allFeatures.append(aSketchLine) # Arc aSketchArc = theSketch.addFeature("SketchArc") aStartPoint2 = geomDataAPI_Point2D(aSketchArc.attribute("start_point")) - aEndPoint2 = geomDataAPI_Point2D(aSketchArc.attribute("end_point")) + aEndPoint2 = geomDataAPI_Point2D(aSketchArc.attribute("end_point")) aCenterPoint = geomDataAPI_Point2D(aSketchArc.attribute("center_point")) - aCenterPoint.setValue(20., 10.) - aStartPoint2.setValue(10., 10.) - aEndPoint2.setValue(20., 0.) + aCenterPoint.setValue(20.0, 10.0) + aStartPoint2.setValue(10.0, 10.0) + aEndPoint2.setValue(20.0, 0.0) allFeatures.append(aSketchArc) # Coincidence aCoincidence = theSketch.addFeature("SketchConstraintCoincidence") @@ -108,24 +109,30 @@ def createSketch2(theSketch): aSession.finishOperation() return allFeatures + def checkSmoothness(theSketch): aPtPtCoincidences = getCoincidences(theSketch) for coinc in aPtPtCoincidences: aConnectedFeatures = connectedFeatures(coinc) - assert(len(aConnectedFeatures) == 2) + assert len(aConnectedFeatures) == 2 if aConnectedFeatures[0].getKind() == "SketchArc": if aConnectedFeatures[1].getKind() == "SketchArc": checkArcArcSmoothness(aConnectedFeatures[0], aConnectedFeatures[1]) elif aConnectedFeatures[1].getKind() == "SketchLine": checkArcLineSmoothness(aConnectedFeatures[0], aConnectedFeatures[1]) - elif aConnectedFeatures[0].getKind() == "SketchLine" and aConnectedFeatures[1].getKind() == "SketchArc": + elif ( + aConnectedFeatures[0].getKind() == "SketchLine" + and aConnectedFeatures[1].getKind() == "SketchArc" + ): checkArcLineSmoothness(aConnectedFeatures[1], aConnectedFeatures[0]) + def checkArcLineSmoothness(theArc, theLine): aCenter = geomDataAPI_Point2D(theArc.attribute("center_point")) aDistance = model.distancePointLine(aCenter, theLine) aRadius = arcRadius(theArc) - assert(math.fabs(aRadius - aDistance) < TOLERANCE) + assert math.fabs(aRadius - aDistance) < TOLERANCE + def checkArcArcSmoothness(theArc1, theArc2): aCenter1 = geomDataAPI_Point2D(theArc1.attribute("center_point")) @@ -135,7 +142,11 @@ def checkArcArcSmoothness(theArc1, theArc2): aRadius2 = arcRadius(theArc2) aRadSum = aRadius1 + aRadius2 aRadDiff = math.fabs(aRadius1 - aRadius2) - assert(math.fabs(aDistance - aRadSum) < TOLERANCE or math.fabs(aDistance - aRadDiff) < TOLERANCE) + assert ( + math.fabs(aDistance - aRadSum) < TOLERANCE + or math.fabs(aDistance - aRadDiff) < TOLERANCE + ) + def getCoincidences(theSketch): aCoincidences = [] @@ -148,6 +159,7 @@ def getCoincidences(theSketch): aCoincidences.append(aSubFeature) return aCoincidences + def connectedFeatures(theCoincidence): anEntityA = theCoincidence.refattr("ConstraintEntityA") anEntityB = theCoincidence.refattr("ConstraintEntityB") @@ -155,23 +167,24 @@ def connectedFeatures(theCoincidence): aFeatureB = ModelAPI.ModelAPI_Feature.feature(anEntityB.attr().owner()) return [aFeatureA, aFeatureB] + def arcRadius(theArc): aCenter = geomDataAPI_Point2D(theArc.attribute("center_point")) aStart = geomDataAPI_Point2D(theArc.attribute("start_point")) return model.distancePointPoint(aCenter, aStart) -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2015-09-18" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -182,41 +195,41 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Initialize sketch by three connected lines -#========================================================================= +# ========================================================================= createSketch1(aSketchFeature) -assert (model.dof(aSketchFeature) == 8) -#========================================================================= +assert model.dof(aSketchFeature) == 8 +# ========================================================================= # Create the Fillet -#========================================================================= +# ========================================================================= aSession.startOperation() aFillet = aSketchFeature.addFeature("SketchFillet") -aFillet.refattr("fillet_point").setAttr(aEndPoint1); +aFillet.refattr("fillet_point").setAttr(aEndPoint1) aSession.finishOperation() aSession.startOperation() aFillet = aSketchFeature.addFeature("SketchFillet") -aFillet.refattr("fillet_point").setAttr(aEndPoint2); +aFillet.refattr("fillet_point").setAttr(aEndPoint2) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Verify the objects of fillet are created -#========================================================================= +# ========================================================================= checkSmoothness(aSketchFeature) -assert (model.dof(aSketchFeature) == 10) -#========================================================================= +assert model.dof(aSketchFeature) == 10 +# ========================================================================= # Move a line and check the fillet is correct -#========================================================================= -DELTA_X = DELTA_Y = 10. +# ========================================================================= +DELTA_X = DELTA_Y = 10.0 aSession.startOperation() aEndPoint1.setValue(aEndPoint1.x() + DELTA_X, aEndPoint1.y() + DELTA_Y) aSession.finishOperation() checkSmoothness(aSketchFeature) -assert (model.dof(aSketchFeature) == 10) +assert model.dof(aSketchFeature) == 10 -#========================================================================= +# ========================================================================= # Create another sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -227,37 +240,37 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 1, 0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Initialize sketch by line and arc -#========================================================================= +# ========================================================================= createSketch2(aSketchFeature) -assert (model.dof(aSketchFeature) == 7) -#========================================================================= +assert model.dof(aSketchFeature) == 7 +# ========================================================================= # Create the Fillet -#========================================================================= +# ========================================================================= aSession.startOperation() aFillet = aSketchFeature.addFeature("SketchFillet") aFillet.refattr("fillet_point").setAttr(aStartPoint1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Verify the objects of fillet are created -#========================================================================= +# ========================================================================= checkSmoothness(aSketchFeature) -assert (model.dof(aSketchFeature) == 8) -#========================================================================= +assert model.dof(aSketchFeature) == 8 +# ========================================================================= # Move a line and check the fillet is correct -#========================================================================= -DELTA_X = 1. -DELTA_Y = -2. +# ========================================================================= +DELTA_X = 1.0 +DELTA_Y = -2.0 aSession.startOperation() aStartPoint1.setValue(aStartPoint1.x() + DELTA_X, aStartPoint1.y() + DELTA_Y) aSession.finishOperation() checkSmoothness(aSketchFeature) -assert (model.dof(aSketchFeature) == 8) -#========================================================================= +assert model.dof(aSketchFeature) == 8 +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= # TODO: Improve Fillet test case by moving one of filleted objectes and check coincidence and tangency are correct -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestFilletAfterFolder.py b/src/SketchPlugin/Test/TestFilletAfterFolder.py index ce9299f19..0ddd11645 100644 --- a/src/SketchPlugin/Test/TestFilletAfterFolder.py +++ b/src/SketchPlugin/Test/TestFilletAfterFolder.py @@ -30,16 +30,28 @@ Part_1_doc = Part_1.document() model.addParameter(Part_1_doc, "Size", "80") 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) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 80) SketchLine_3 = Sketch_1.addLine(0, 80, 80, 80) SketchLine_4 = Sketch_1.addLine(80, 80, 80, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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()) @@ -47,7 +59,18 @@ 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_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], 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() @@ -55,16 +78,28 @@ model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_5 = Sketch_2.addLine(80, 0, 0, 0) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchPoint_2.result()) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchPoint_2.result() +) SketchLine_6 = Sketch_2.addLine(0, 0, 0, 80) SketchLine_7 = Sketch_2.addLine(0, 80, 80, 80) SketchLine_8 = Sketch_2.addLine(80, 80, 80, 0) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_8.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_10 = 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()) @@ -78,10 +113,16 @@ for line in lines: Sketch_2.setFillet(line.endPoint()) model.do() -assert(Sketch_2.solverError().value() == "") +assert Sketch_2.solverError().value() == "" -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 0, "2*Size") +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_2")], + model.selection(), + 0, + "2*Size", +) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestFilletInteracting.py b/src/SketchPlugin/Test/TestFilletInteracting.py index 60585162a..aeb8ac0be 100644 --- a/src/SketchPlugin/Test/TestFilletInteracting.py +++ b/src/SketchPlugin/Test/TestFilletInteracting.py @@ -33,602 +33,697 @@ from salome.shaper import model __updated__ = "2017-03-06" + def isArcLineSmooth(theArc, theLine, theTolerance): - aCenter = geomDataAPI_Point2D(theArc.attribute("center_point")) - aDistance = model.distancePointLine(aCenter, theLine) - aRadius = arcRadius(theArc) - return math.fabs(aRadius - aDistance) < theTolerance + aCenter = geomDataAPI_Point2D(theArc.attribute("center_point")) + aDistance = model.distancePointLine(aCenter, theLine) + aRadius = arcRadius(theArc) + return math.fabs(aRadius - aDistance) < theTolerance + def isArcArcSmooth(theArc1, theArc2, theTolerance): - aCenter1 = geomDataAPI_Point2D(theArc1.attribute("center_point")) - aCenter2 = geomDataAPI_Point2D(theArc2.attribute("center_point")) - aDistance = model.distancePointPoint(aCenter1, aCenter2) - aRadius1 = arcRadius(theArc1) - aRadius2 = arcRadius(theArc2) - aRadSum = aRadius1 + aRadius2 - aRadDiff = math.fabs(aRadius1 - aRadius2) - return math.fabs(aDistance - aRadSum) < theTolerance or math.fabs(aDistance - aRadDiff) < theTolerance + aCenter1 = geomDataAPI_Point2D(theArc1.attribute("center_point")) + aCenter2 = geomDataAPI_Point2D(theArc2.attribute("center_point")) + aDistance = model.distancePointPoint(aCenter1, aCenter2) + aRadius1 = arcRadius(theArc1) + aRadius2 = arcRadius(theArc2) + aRadSum = aRadius1 + aRadius2 + aRadDiff = math.fabs(aRadius1 - aRadius2) + return ( + math.fabs(aDistance - aRadSum) < theTolerance + or math.fabs(aDistance - aRadDiff) < theTolerance + ) -def arcRadius(theArc): - aCenter = geomDataAPI_Point2D(theArc.attribute("center_point")) - aStart = geomDataAPI_Point2D(theArc.attribute("start_point")) - return model.distancePointPoint(aCenter, aStart) +def arcRadius(theArc): + aCenter = geomDataAPI_Point2D(theArc.attribute("center_point")) + aStart = geomDataAPI_Point2D(theArc.attribute("start_point")) + return model.distancePointPoint(aCenter, aStart) class TestFilletInteracting(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myTolerance = 1.e-6 - self.myDOF = 0 - - def tearDown(self): - model.end() - self.assertTrue(model.checkPythonDump()) - model.reset() - - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def collectFeatures(self): - self.myFeatures = {} - for aSubObj in self.mySketch.features().list(): - aFeature = ModelAPI.ModelAPI_Feature.feature(aSubObj) - if aFeature is not None: - if self.myFeatures.get(aFeature.getKind()) == None: - self.myFeatures[aFeature.getKind()] = 1 + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myTolerance = 1.0e-6 + self.myDOF = 0 + + def tearDown(self): + model.end() + self.assertTrue(model.checkPythonDump()) + model.reset() + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def collectFeatures(self): + self.myFeatures = {} + for aSubObj in self.mySketch.features().list(): + aFeature = ModelAPI.ModelAPI_Feature.feature(aSubObj) + if aFeature is not None: + if self.myFeatures.get(aFeature.getKind()) == None: + self.myFeatures[aFeature.getKind()] = 1 + else: + self.myFeatures[aFeature.getKind()] += 1 + + def checkNbFeatures(self, theFeatureKind, theFeatureCount): + if theFeatureCount == 0: + self.assertIsNone(self.myFeatures.get(theFeatureKind)) else: - self.myFeatures[aFeature.getKind()] += 1 - - def checkNbFeatures(self, theFeatureKind, theFeatureCount): - if theFeatureCount == 0: - self.assertIsNone(self.myFeatures.get(theFeatureKind)) - else: - self.assertIsNotNone(self.myFeatures.get(theFeatureKind), "No features of kind {0} but expected {1}".format(theFeatureKind, theFeatureCount)) - self.assertEqual(self.myFeatures[theFeatureKind], theFeatureCount, "Observed number of {0} is {1} but expected {2}".format(theFeatureKind, self.myFeatures[theFeatureKind], theFeatureCount)) - - def checkFillet(self): - aPtPtCoincidences = self.getCoincidences() - for coinc in aPtPtCoincidences: - aConnectedFeatures = self.connectedFeatures(coinc) - self.assertEqual(len(aConnectedFeatures), 2) - if aConnectedFeatures[0].getKind() == "SketchArc": - if aConnectedFeatures[1].getKind() == "SketchArc": - self.assertTrue(isArcArcSmooth(aConnectedFeatures[0], aConnectedFeatures[1], self.myTolerance)) - elif aConnectedFeatures[1].getKind() == "SketchLine": - self.assertTrue(isArcLineSmooth(aConnectedFeatures[0], aConnectedFeatures[1], self.myTolerance)) - elif aConnectedFeatures[0].getKind() == "SketchLine" and aConnectedFeatures[1].getKind() == "SketchArc": - self.assertTrue(isArcLineSmooth(aConnectedFeatures[1], aConnectedFeatures[0], self.myTolerance)) - - def getCoincidences(self): - aCoincidences = [] - for aSubObj in self.mySketch.features().list(): - aSubFeature = ModelAPI.ModelAPI_Feature.feature(aSubObj) - if aSubFeature is not None and aSubFeature.getKind() == "SketchConstraintCoincidence": - anEntityA = aSubFeature.refattr("ConstraintEntityA") - anEntityB = aSubFeature.refattr("ConstraintEntityB") - if not anEntityA.isObject() and not anEntityB.isObject(): - aCoincidences.append(aSubFeature) - return aCoincidences - - def connectedFeatures(self, theCoincidence): - anEntityA = theCoincidence.refattr("ConstraintEntityA") - anEntityB = theCoincidence.refattr("ConstraintEntityB") - aFeatureA = ModelAPI.ModelAPI_Feature.feature(anEntityA.attr().owner()) - aFeatureB = ModelAPI.ModelAPI_Feature.feature(anEntityB.attr().owner()) - return [aFeatureA, aFeatureB] - - - def test_fillet_two_lines(self): - """ Test 1. Fillet on two connected lines - """ - aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.) - aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.) - self.myDOF += 8 - self.checkDOF() - self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint()) - self.myDOF -= 2 - model.do() - self.checkDOF() - self.mySketch.setFillet(aSketchLineA.startPoint()) - self.myDOF += 1 - model.do() - self.checkFillet() - self.checkDOF() - - self.collectFeatures() - self.checkNbFeatures("SketchLine", 2) - self.checkNbFeatures("SketchArc", 1) - self.checkNbFeatures("SketchConstraintCoincidence", 2) - self.checkNbFeatures("SketchConstraintTangent", 2) - self.checkNbFeatures("SketchFillet", 0) - - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) - - def test_wrong_fillet_two_lines(self): - """ Test 2. Check the fillet is wrong on two connected lines when selecting incorrect point - """ - aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.) - aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.) - self.myDOF += 8 - self.checkDOF() - self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint()) - self.myDOF -= 2 - model.do() - self.checkDOF() - aFillet = self.mySketch.setFillet(aSketchLineA.endPoint()) - model.do() - self.checkDOF() - - self.collectFeatures() - self.checkNbFeatures("SketchLine", 2) - self.checkNbFeatures("SketchArc", 0) # no arcs should be created - self.checkNbFeatures("SketchConstraintCoincidence", 1) # number of coincidences should not change - self.checkNbFeatures("SketchConstraintTangent", 0) # no tangencies should not be created - self.checkNbFeatures("SketchFillet", 1) # fillet feature should still exist. it should be wrong - - # sketch is invalid, so, no results at all - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, []) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, []) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, []) - - # remove fillet for correct python dump - self.myDocument.removeFeature(aFillet.feature()) - - def test_fillet_arc_line(self): - """ Test 3. Fillet on connected arc and line - """ - aSketchLine = self.mySketch.addLine(10., 10., 20., 10.) - aSketchArc = self.mySketch.addArc(20., 10., 20., 20., 10., 10., False) - self.myDOF += 9 - self.checkDOF() - self.mySketch.setCoincident(aSketchLine.startPoint(), aSketchArc.endPoint()) - self.myDOF -= 2 - model.do() - self.checkDOF() - self.mySketch.setFillet(aSketchLine.startPoint()) - self.myDOF += 1 - model.do() - self.checkFillet() - self.checkDOF() - - self.collectFeatures() - self.checkNbFeatures("SketchLine", 1) - self.checkNbFeatures("SketchArc", 2) - self.checkNbFeatures("SketchConstraintCoincidence", 2) - self.checkNbFeatures("SketchConstraintTangent", 2) - self.checkNbFeatures("SketchFillet", 0) - - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) - - def test_fillet_two_arcs(self): - """ Test 4. Fillet on two connected arcs - """ - aSketchArc1 = self.mySketch.addArc(20., 0., 20., 20., 10., 17.32050807568877293, False) - aSketchArc2 = self.mySketch.addArc(20., 34.64101615137754586, 20., 14.64101615137754586, 10., 17.32050807568877293, True) - self.myDOF += 10 - self.checkDOF() - self.mySketch.setCoincident(aSketchArc1.endPoint(), aSketchArc2.endPoint()) - self.myDOF -= 2 - model.do() - self.checkDOF() - self.mySketch.setFillet(aSketchArc1.endPoint()) - self.myDOF += 1 - model.do() - self.checkFillet() - self.checkDOF() - - self.collectFeatures() - self.checkNbFeatures("SketchLine", 0) - self.checkNbFeatures("SketchArc", 3) - self.checkNbFeatures("SketchConstraintCoincidence", 2) - self.checkNbFeatures("SketchConstraintTangent", 2) - self.checkNbFeatures("SketchFillet", 0) - - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) - - def test_fillet_with_horizontal_vertical(self): - """ Test 5. Fillet on two connected lines in case of Horizontal or Vertical constraints applied - """ - aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.) - aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.) - self.myDOF += 8 - self.checkDOF() - self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint()) - self.myDOF -= 2 - model.do() - self.checkDOF() - self.mySketch.setHorizontal(aSketchLineA.result()) - self.mySketch.setVertical(aSketchLineB.result()) - self.myDOF -= 2 - model.do() - self.checkDOF() - self.mySketch.setFillet(aSketchLineA.startPoint()) - self.myDOF += 1 - model.do() - self.checkFillet() - self.checkDOF() - - self.collectFeatures() - self.checkNbFeatures("SketchLine", 2) - self.checkNbFeatures("SketchArc", 1) - self.checkNbFeatures("SketchConstraintCoincidence", 2) - self.checkNbFeatures("SketchConstraintTangent", 2) - self.checkNbFeatures("SketchConstraintHorizontal", 1) - self.checkNbFeatures("SketchConstraintVertical", 1) - self.checkNbFeatures("SketchFillet", 0) - - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) - - def test_fillet_with_orthogonal(self): - """ Test 6. Fillet on two connected lines in case of Perpendicular constraint applied - """ - aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.) - aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.) - self.myDOF += 8 - self.checkDOF() - self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint()) - self.myDOF -= 2 - model.do() - self.checkDOF() - self.mySketch.setPerpendicular(aSketchLineA.result(), aSketchLineB.result()) - self.myDOF -= 1 - model.do() - self.checkDOF() - self.mySketch.setFillet(aSketchLineA.startPoint()) - self.myDOF += 1 - model.do() - self.checkFillet() - self.checkDOF() - - self.collectFeatures() - self.checkNbFeatures("SketchLine", 2) - self.checkNbFeatures("SketchArc", 1) - self.checkNbFeatures("SketchConstraintCoincidence", 2) - self.checkNbFeatures("SketchConstraintTangent", 2) - self.checkNbFeatures("SketchConstraintPerpendicular", 1) - self.checkNbFeatures("SketchFillet", 0) - - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) - - def test_fillet_with_parallel(self): - """ Test 7. Fillet on two connected lines in case of Parallel constraint applied - """ - aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.) - aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.) - self.myDOF += 8 - self.checkDOF() - self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint()) - self.myDOF -= 2 - model.do() - self.checkDOF() - # third line to apply parallel constraint - aSketchLineC = self.mySketch.addLine(10., 0., 20., 5.) - self.myDOF += 4 - self.mySketch.setParallel(aSketchLineB.result(), aSketchLineC.result()) - self.myDOF -= 1 - model.do() - self.checkDOF() - self.mySketch.setFillet(aSketchLineA.startPoint()) - self.myDOF += 1 - model.do() - self.checkFillet() - self.checkDOF() - - self.collectFeatures() - self.checkNbFeatures("SketchLine", 3) - self.checkNbFeatures("SketchArc", 1) - self.checkNbFeatures("SketchConstraintCoincidence", 2) - self.checkNbFeatures("SketchConstraintTangent", 2) - self.checkNbFeatures("SketchConstraintParallel", 1) - self.checkNbFeatures("SketchFillet", 0) - - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [4]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [8]) - - def test_fillet_with_equal_lines(self): - """ Test 8. Fillet on two connected lines in case of Equal constraint applied - """ - aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.) - aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.) - self.myDOF += 8 - self.checkDOF() - self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint()) - self.myDOF -= 2 - model.do() - self.checkDOF() - self.mySketch.setEqual(aSketchLineA.result(), aSketchLineB.result()) - self.myDOF -= 1 - model.do() - self.checkDOF() - self.mySketch.setFillet(aSketchLineA.startPoint()) - self.myDOF += 2 # Equal has been removed - model.do() - self.checkFillet() - self.checkDOF() - - self.collectFeatures() - self.checkNbFeatures("SketchLine", 2) - self.checkNbFeatures("SketchArc", 1) - self.checkNbFeatures("SketchConstraintCoincidence", 2) - self.checkNbFeatures("SketchConstraintTangent", 2) - self.checkNbFeatures("SketchConstraintEqual", 0) # Equal constraint expected to be removed - self.checkNbFeatures("SketchFillet", 0) - - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) - - def test_fillet_with_equal_arcs(self): - """ Test 9. Fillet on two connected arcs in case of Equal constraint applied - """ - aSketchArc1 = self.mySketch.addArc(20., 0., 20., 20., 10., 17.32050807568877293, False) - aSketchArc2 = self.mySketch.addArc(20., 34.64101615137754586, 20., 14.64101615137754586, 10., 17.32050807568877293, True) - self.myDOF += 10 - self.checkDOF() - self.mySketch.setCoincident(aSketchArc1.endPoint(), aSketchArc2.endPoint()) - self.myDOF -= 2 - model.do() - self.checkDOF() - self.mySketch.setEqual(aSketchArc1.results()[1], aSketchArc2.results()[1]) - self.myDOF -= 1 - model.do() - self.checkDOF() - self.mySketch.setFillet(aSketchArc1.endPoint()) - self.myDOF += 2 # Equal has been removed - model.do() - self.checkFillet() - self.checkDOF() - - self.collectFeatures() - self.checkNbFeatures("SketchLine", 0) - self.checkNbFeatures("SketchArc", 3) - self.checkNbFeatures("SketchConstraintCoincidence", 2) - self.checkNbFeatures("SketchConstraintTangent", 2) - self.checkNbFeatures("SketchConstraintEqual", 0) # Equal constraint expected to be removed - self.checkNbFeatures("SketchFillet", 0) - - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) - - def test_fillet_with_length(self): - """ Test 10. Fillet on two connected lines in case of Length constraint applied - """ - aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.) - aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.) - self.myDOF += 8 - self.checkDOF() - self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint()) - self.myDOF -= 2 - model.do() - self.checkDOF() - self.mySketch.setLength(aSketchLineA.result(), 15.) - self.myDOF -= 1 - model.do() - self.checkDOF() - self.mySketch.setFillet(aSketchLineA.startPoint()) - self.myDOF += 1 - model.do() - self.checkFillet() - self.checkDOF() - - self.collectFeatures() - self.checkNbFeatures("SketchLine", 2) - self.checkNbFeatures("SketchArc", 1) - self.checkNbFeatures("SketchConstraintCoincidence", 4) # Additionally 2 coincidences for apex with fillet objects - self.checkNbFeatures("SketchConstraintTangent", 2) - self.checkNbFeatures("SketchConstraintLength", 0) # Length constraint expected to be removed - self.checkNbFeatures("SketchConstraintDistance", 1) # Distance constraint should appear instead of Length - self.checkNbFeatures("SketchFillet", 0) - - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) - - def test_fillet_with_radius(self): - """ Test 11. Fillet on connected arc and line in case of Radius constraint is applied to arc - """ - aSketchLine = self.mySketch.addLine(10., 10., 20., 10.) - aSketchArc = self.mySketch.addArc(0., 10., 0., 20., 10., 10., True) - self.myDOF += 9 - self.checkDOF() - self.mySketch.setCoincident(aSketchLine.startPoint(), aSketchArc.endPoint()) - self.myDOF -= 2 - model.do() - self.checkDOF() - self.mySketch.setRadius(aSketchArc.results()[1], 12.) - self.myDOF -= 1 - model.do() - self.checkDOF() - self.mySketch.setFillet(aSketchLine.startPoint()) - self.myDOF += 1 - model.do() - self.checkFillet() - self.checkDOF() - - self.collectFeatures() - self.checkNbFeatures("SketchLine", 1) - self.checkNbFeatures("SketchArc", 2) - self.checkNbFeatures("SketchConstraintCoincidence", 2) - self.checkNbFeatures("SketchConstraintTangent", 2) - self.checkNbFeatures("SketchConstraintRadius", 1) - self.checkNbFeatures("SketchFillet", 0) - - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) - - def test_fillet_with_distance(self): - """ Test 12. Fillet on two connected lines in case of Distance constraint applied - """ - aSketchLineA = self.mySketch.addLine(20, 20, 70, 20) - aSketchLineB = self.mySketch.addLine(70, 20, 70, 53.16624790355412) - aSketchLineC = self.mySketch.addLine(70, 53.16624790355412, 20, 20) - self.myDOF += 12 - model.do() - self.checkDOF() - # coincidences - self.mySketch.setCoincident(aSketchLineA.endPoint(), aSketchLineB.startPoint()) - self.mySketch.setCoincident(aSketchLineB.endPoint(), aSketchLineC.startPoint()) - self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineC.endPoint()) - self.myDOF -= 6 - model.do() - self.checkDOF() - # other constraints - self.mySketch.setHorizontal(aSketchLineA.result()) - self.mySketch.setVertical(aSketchLineB.result()) - self.myDOF -= 2 - model.do() - self.checkDOF() - # construction point - aProjection = self.mySketch.addProjection(model.selection("VERTEX", "Origin"), False) - aSketchPoint = SketchAPI_Point(aProjection.createdFeature()) - model.do() - # distances - self.mySketch.setLength(aSketchLineA.result(), 50) - self.mySketch.setDistance(aSketchLineA.startPoint(), aSketchLineC.startPoint(), 60, True) - self.mySketch.setHorizontalDistance(aSketchPoint.coordinates(), aSketchLineA.startPoint(), 20) - self.mySketch.setVerticalDistance(aSketchPoint.coordinates(), aSketchLineC.endPoint(), 20) - self.myDOF -= 4 - model.do() - self.checkDOF() - - self.mySketch.setFillet(aSketchLineA.startPoint()) - self.myDOF += 1 - model.do() - self.checkFillet() - self.checkDOF() - - self.collectFeatures() - self.checkNbFeatures("SketchLine", 3) - self.checkNbFeatures("SketchArc", 1) - self.checkNbFeatures("SketchConstraintCoincidence", 6) # Additionally 2 coincidences for apex with fillet objects - self.checkNbFeatures("SketchConstraintHorizontal", 1) - self.checkNbFeatures("SketchConstraintVertical", 1) - self.checkNbFeatures("SketchConstraintTangent", 2) - self.checkNbFeatures("SketchConstraintLength", 0) # Length translated to Distance - self.checkNbFeatures("SketchConstraintDistance", 2) # Length translated to Distance - self.checkNbFeatures("SketchConstraintDistanceHorizontal", 1) - self.checkNbFeatures("SketchConstraintDistanceVertical", 1) - self.checkNbFeatures("SketchFillet", 0) - - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [4]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [8]) - - def test_fillet_with_fixed_point(self): - """ Test 13. Fillet on two connected lines in case of Fixed constraint applied to the fillet point - """ - aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.) - aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.) - self.myDOF += 8 - self.checkDOF() - self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint()) - self.myDOF -= 2 - model.do() - self.checkDOF() - self.mySketch.setFixed(aSketchLineA.startPoint()) - self.myDOF -= 2 - model.do() - self.checkDOF() - self.mySketch.setFillet(aSketchLineA.startPoint()) - self.myDOF += 3 # Fixed constraint has been removed - model.do() - self.checkFillet() - self.checkDOF() - - self.collectFeatures() - self.checkNbFeatures("SketchLine", 2) - self.checkNbFeatures("SketchArc", 1) - self.checkNbFeatures("SketchConstraintCoincidence", 2) - self.checkNbFeatures("SketchConstraintTangent", 2) - self.checkNbFeatures("SketchConstraintFixed", 0) # Fixed constraint expected to be removed - self.checkNbFeatures("SketchFillet", 0) - - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) - - def test_fillet_with_fixed_line(self): - """ Test 14. Fillet on two connected lines in case of Fixed constraint applied to one of lines - """ - aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.) - aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.) - self.myDOF += 8 - self.checkDOF() - self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint()) - self.myDOF -= 2 - model.do() - self.checkDOF() - self.mySketch.setFixed(aSketchLineA.result()) - self.myDOF -= 4 - model.do() - self.checkDOF() - self.mySketch.setFillet(aSketchLineA.startPoint()) - self.myDOF += 1 - model.do() - self.checkFillet() - self.checkDOF() - - self.collectFeatures() - self.checkNbFeatures("SketchLine", 2) - self.checkNbFeatures("SketchArc", 1) - self.checkNbFeatures("SketchConstraintCoincidence", 2) - self.checkNbFeatures("SketchConstraintTangent", 2) - self.checkNbFeatures("SketchConstraintLength", 0) # Fixed constraint expected to be kept - self.checkNbFeatures("SketchFillet", 0) - - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) - - def test_fillet_with_angle(self): - """ Test 15. Fillet on two connected lines in case of Perpendicular constraint applied - """ - aSketchLineA = self.mySketch.addLine(10., 10., 20., 10.) - aSketchLineB = self.mySketch.addLine(10., 10., 10., 20.) - self.myDOF += 8 - self.checkDOF() - self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineB.startPoint()) - self.myDOF -= 2 - model.do() - self.checkDOF() - self.mySketch.setAngle(aSketchLineA.result(), aSketchLineB.result(), 60.) - self.myDOF -= 1 - model.do() - self.checkDOF() - self.mySketch.setFillet(aSketchLineA.startPoint()) - self.myDOF += 1 - model.do() - self.checkFillet() - self.checkDOF() - - self.collectFeatures() - self.checkNbFeatures("SketchLine", 2) - self.checkNbFeatures("SketchArc", 1) - self.checkNbFeatures("SketchConstraintCoincidence", 2) - self.checkNbFeatures("SketchConstraintTangent", 2) - self.checkNbFeatures("SketchConstraintAngle", 1) - self.checkNbFeatures("SketchFillet", 0) - - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) - model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) + self.assertIsNotNone( + self.myFeatures.get(theFeatureKind), + "No features of kind {0} but expected {1}".format( + theFeatureKind, theFeatureCount + ), + ) + self.assertEqual( + self.myFeatures[theFeatureKind], + theFeatureCount, + "Observed number of {0} is {1} but expected {2}".format( + theFeatureKind, self.myFeatures[theFeatureKind], theFeatureCount + ), + ) + + def checkFillet(self): + aPtPtCoincidences = self.getCoincidences() + for coinc in aPtPtCoincidences: + aConnectedFeatures = self.connectedFeatures(coinc) + self.assertEqual(len(aConnectedFeatures), 2) + if aConnectedFeatures[0].getKind() == "SketchArc": + if aConnectedFeatures[1].getKind() == "SketchArc": + self.assertTrue( + isArcArcSmooth( + aConnectedFeatures[0], + aConnectedFeatures[1], + self.myTolerance, + ) + ) + elif aConnectedFeatures[1].getKind() == "SketchLine": + self.assertTrue( + isArcLineSmooth( + aConnectedFeatures[0], + aConnectedFeatures[1], + self.myTolerance, + ) + ) + elif ( + aConnectedFeatures[0].getKind() == "SketchLine" + and aConnectedFeatures[1].getKind() == "SketchArc" + ): + self.assertTrue( + isArcLineSmooth( + aConnectedFeatures[1], aConnectedFeatures[0], self.myTolerance + ) + ) + + def getCoincidences(self): + aCoincidences = [] + for aSubObj in self.mySketch.features().list(): + aSubFeature = ModelAPI.ModelAPI_Feature.feature(aSubObj) + if ( + aSubFeature is not None + and aSubFeature.getKind() == "SketchConstraintCoincidence" + ): + anEntityA = aSubFeature.refattr("ConstraintEntityA") + anEntityB = aSubFeature.refattr("ConstraintEntityB") + if not anEntityA.isObject() and not anEntityB.isObject(): + aCoincidences.append(aSubFeature) + return aCoincidences + + def connectedFeatures(self, theCoincidence): + anEntityA = theCoincidence.refattr("ConstraintEntityA") + anEntityB = theCoincidence.refattr("ConstraintEntityB") + aFeatureA = ModelAPI.ModelAPI_Feature.feature(anEntityA.attr().owner()) + aFeatureB = ModelAPI.ModelAPI_Feature.feature(anEntityB.attr().owner()) + return [aFeatureA, aFeatureB] + + def test_fillet_two_lines(self): + """Test 1. Fillet on two connected lines""" + aSketchLineA = self.mySketch.addLine(10.0, 10.0, 20.0, 10.0) + aSketchLineB = self.mySketch.addLine(10.0, 10.0, 10.0, 20.0) + self.myDOF += 8 + self.checkDOF() + self.mySketch.setCoincident( + aSketchLineA.startPoint(), aSketchLineB.startPoint() + ) + self.myDOF -= 2 + model.do() + self.checkDOF() + self.mySketch.setFillet(aSketchLineA.startPoint()) + self.myDOF += 1 + model.do() + self.checkFillet() + self.checkDOF() + + self.collectFeatures() + self.checkNbFeatures("SketchLine", 2) + self.checkNbFeatures("SketchArc", 1) + self.checkNbFeatures("SketchConstraintCoincidence", 2) + self.checkNbFeatures("SketchConstraintTangent", 2) + self.checkNbFeatures("SketchFillet", 0) + + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) + + def test_wrong_fillet_two_lines(self): + """Test 2. Check the fillet is wrong on two connected lines when selecting incorrect point""" + aSketchLineA = self.mySketch.addLine(10.0, 10.0, 20.0, 10.0) + aSketchLineB = self.mySketch.addLine(10.0, 10.0, 10.0, 20.0) + self.myDOF += 8 + self.checkDOF() + self.mySketch.setCoincident( + aSketchLineA.startPoint(), aSketchLineB.startPoint() + ) + self.myDOF -= 2 + model.do() + self.checkDOF() + aFillet = self.mySketch.setFillet(aSketchLineA.endPoint()) + model.do() + self.checkDOF() + + self.collectFeatures() + self.checkNbFeatures("SketchLine", 2) + self.checkNbFeatures("SketchArc", 0) # no arcs should be created + self.checkNbFeatures( + "SketchConstraintCoincidence", 1 + ) # number of coincidences should not change + self.checkNbFeatures( + "SketchConstraintTangent", 0 + ) # no tangencies should not be created + self.checkNbFeatures( + "SketchFillet", 1 + ) # fillet feature should still exist. it should be wrong + + # sketch is invalid, so, no results at all + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, []) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, []) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, []) + + # remove fillet for correct python dump + self.myDocument.removeFeature(aFillet.feature()) + + def test_fillet_arc_line(self): + """Test 3. Fillet on connected arc and line""" + aSketchLine = self.mySketch.addLine(10.0, 10.0, 20.0, 10.0) + aSketchArc = self.mySketch.addArc(20.0, 10.0, 20.0, 20.0, 10.0, 10.0, False) + self.myDOF += 9 + self.checkDOF() + self.mySketch.setCoincident(aSketchLine.startPoint(), aSketchArc.endPoint()) + self.myDOF -= 2 + model.do() + self.checkDOF() + self.mySketch.setFillet(aSketchLine.startPoint()) + self.myDOF += 1 + model.do() + self.checkFillet() + self.checkDOF() + + self.collectFeatures() + self.checkNbFeatures("SketchLine", 1) + self.checkNbFeatures("SketchArc", 2) + self.checkNbFeatures("SketchConstraintCoincidence", 2) + self.checkNbFeatures("SketchConstraintTangent", 2) + self.checkNbFeatures("SketchFillet", 0) + + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) + + def test_fillet_two_arcs(self): + """Test 4. Fillet on two connected arcs""" + aSketchArc1 = self.mySketch.addArc( + 20.0, 0.0, 20.0, 20.0, 10.0, 17.32050807568877293, False + ) + aSketchArc2 = self.mySketch.addArc( + 20.0, + 34.64101615137754586, + 20.0, + 14.64101615137754586, + 10.0, + 17.32050807568877293, + True, + ) + self.myDOF += 10 + self.checkDOF() + self.mySketch.setCoincident(aSketchArc1.endPoint(), aSketchArc2.endPoint()) + self.myDOF -= 2 + model.do() + self.checkDOF() + self.mySketch.setFillet(aSketchArc1.endPoint()) + self.myDOF += 1 + model.do() + self.checkFillet() + self.checkDOF() + + self.collectFeatures() + self.checkNbFeatures("SketchLine", 0) + self.checkNbFeatures("SketchArc", 3) + self.checkNbFeatures("SketchConstraintCoincidence", 2) + self.checkNbFeatures("SketchConstraintTangent", 2) + self.checkNbFeatures("SketchFillet", 0) + + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) + + def test_fillet_with_horizontal_vertical(self): + """Test 5. Fillet on two connected lines in case of Horizontal or Vertical constraints applied""" + aSketchLineA = self.mySketch.addLine(10.0, 10.0, 20.0, 10.0) + aSketchLineB = self.mySketch.addLine(10.0, 10.0, 10.0, 20.0) + self.myDOF += 8 + self.checkDOF() + self.mySketch.setCoincident( + aSketchLineA.startPoint(), aSketchLineB.startPoint() + ) + self.myDOF -= 2 + model.do() + self.checkDOF() + self.mySketch.setHorizontal(aSketchLineA.result()) + self.mySketch.setVertical(aSketchLineB.result()) + self.myDOF -= 2 + model.do() + self.checkDOF() + self.mySketch.setFillet(aSketchLineA.startPoint()) + self.myDOF += 1 + model.do() + self.checkFillet() + self.checkDOF() + + self.collectFeatures() + self.checkNbFeatures("SketchLine", 2) + self.checkNbFeatures("SketchArc", 1) + self.checkNbFeatures("SketchConstraintCoincidence", 2) + self.checkNbFeatures("SketchConstraintTangent", 2) + self.checkNbFeatures("SketchConstraintHorizontal", 1) + self.checkNbFeatures("SketchConstraintVertical", 1) + self.checkNbFeatures("SketchFillet", 0) + + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) + + def test_fillet_with_orthogonal(self): + """Test 6. Fillet on two connected lines in case of Perpendicular constraint applied""" + aSketchLineA = self.mySketch.addLine(10.0, 10.0, 20.0, 10.0) + aSketchLineB = self.mySketch.addLine(10.0, 10.0, 10.0, 20.0) + self.myDOF += 8 + self.checkDOF() + self.mySketch.setCoincident( + aSketchLineA.startPoint(), aSketchLineB.startPoint() + ) + self.myDOF -= 2 + model.do() + self.checkDOF() + self.mySketch.setPerpendicular(aSketchLineA.result(), aSketchLineB.result()) + self.myDOF -= 1 + model.do() + self.checkDOF() + self.mySketch.setFillet(aSketchLineA.startPoint()) + self.myDOF += 1 + model.do() + self.checkFillet() + self.checkDOF() + + self.collectFeatures() + self.checkNbFeatures("SketchLine", 2) + self.checkNbFeatures("SketchArc", 1) + self.checkNbFeatures("SketchConstraintCoincidence", 2) + self.checkNbFeatures("SketchConstraintTangent", 2) + self.checkNbFeatures("SketchConstraintPerpendicular", 1) + self.checkNbFeatures("SketchFillet", 0) + + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) + + def test_fillet_with_parallel(self): + """Test 7. Fillet on two connected lines in case of Parallel constraint applied""" + aSketchLineA = self.mySketch.addLine(10.0, 10.0, 20.0, 10.0) + aSketchLineB = self.mySketch.addLine(10.0, 10.0, 10.0, 20.0) + self.myDOF += 8 + self.checkDOF() + self.mySketch.setCoincident( + aSketchLineA.startPoint(), aSketchLineB.startPoint() + ) + self.myDOF -= 2 + model.do() + self.checkDOF() + # third line to apply parallel constraint + aSketchLineC = self.mySketch.addLine(10.0, 0.0, 20.0, 5.0) + self.myDOF += 4 + self.mySketch.setParallel(aSketchLineB.result(), aSketchLineC.result()) + self.myDOF -= 1 + model.do() + self.checkDOF() + self.mySketch.setFillet(aSketchLineA.startPoint()) + self.myDOF += 1 + model.do() + self.checkFillet() + self.checkDOF() + + self.collectFeatures() + self.checkNbFeatures("SketchLine", 3) + self.checkNbFeatures("SketchArc", 1) + self.checkNbFeatures("SketchConstraintCoincidence", 2) + self.checkNbFeatures("SketchConstraintTangent", 2) + self.checkNbFeatures("SketchConstraintParallel", 1) + self.checkNbFeatures("SketchFillet", 0) + + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [4]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [8]) + + def test_fillet_with_equal_lines(self): + """Test 8. Fillet on two connected lines in case of Equal constraint applied""" + aSketchLineA = self.mySketch.addLine(10.0, 10.0, 20.0, 10.0) + aSketchLineB = self.mySketch.addLine(10.0, 10.0, 10.0, 20.0) + self.myDOF += 8 + self.checkDOF() + self.mySketch.setCoincident( + aSketchLineA.startPoint(), aSketchLineB.startPoint() + ) + self.myDOF -= 2 + model.do() + self.checkDOF() + self.mySketch.setEqual(aSketchLineA.result(), aSketchLineB.result()) + self.myDOF -= 1 + model.do() + self.checkDOF() + self.mySketch.setFillet(aSketchLineA.startPoint()) + self.myDOF += 2 # Equal has been removed + model.do() + self.checkFillet() + self.checkDOF() + + self.collectFeatures() + self.checkNbFeatures("SketchLine", 2) + self.checkNbFeatures("SketchArc", 1) + self.checkNbFeatures("SketchConstraintCoincidence", 2) + self.checkNbFeatures("SketchConstraintTangent", 2) + self.checkNbFeatures( + "SketchConstraintEqual", 0 + ) # Equal constraint expected to be removed + self.checkNbFeatures("SketchFillet", 0) + + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) + + def test_fillet_with_equal_arcs(self): + """Test 9. Fillet on two connected arcs in case of Equal constraint applied""" + aSketchArc1 = self.mySketch.addArc( + 20.0, 0.0, 20.0, 20.0, 10.0, 17.32050807568877293, False + ) + aSketchArc2 = self.mySketch.addArc( + 20.0, + 34.64101615137754586, + 20.0, + 14.64101615137754586, + 10.0, + 17.32050807568877293, + True, + ) + self.myDOF += 10 + self.checkDOF() + self.mySketch.setCoincident(aSketchArc1.endPoint(), aSketchArc2.endPoint()) + self.myDOF -= 2 + model.do() + self.checkDOF() + self.mySketch.setEqual(aSketchArc1.results()[1], aSketchArc2.results()[1]) + self.myDOF -= 1 + model.do() + self.checkDOF() + self.mySketch.setFillet(aSketchArc1.endPoint()) + self.myDOF += 2 # Equal has been removed + model.do() + self.checkFillet() + self.checkDOF() + + self.collectFeatures() + self.checkNbFeatures("SketchLine", 0) + self.checkNbFeatures("SketchArc", 3) + self.checkNbFeatures("SketchConstraintCoincidence", 2) + self.checkNbFeatures("SketchConstraintTangent", 2) + self.checkNbFeatures( + "SketchConstraintEqual", 0 + ) # Equal constraint expected to be removed + self.checkNbFeatures("SketchFillet", 0) + + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) + + def test_fillet_with_length(self): + """Test 10. Fillet on two connected lines in case of Length constraint applied""" + aSketchLineA = self.mySketch.addLine(10.0, 10.0, 20.0, 10.0) + aSketchLineB = self.mySketch.addLine(10.0, 10.0, 10.0, 20.0) + self.myDOF += 8 + self.checkDOF() + self.mySketch.setCoincident( + aSketchLineA.startPoint(), aSketchLineB.startPoint() + ) + self.myDOF -= 2 + model.do() + self.checkDOF() + self.mySketch.setLength(aSketchLineA.result(), 15.0) + self.myDOF -= 1 + model.do() + self.checkDOF() + self.mySketch.setFillet(aSketchLineA.startPoint()) + self.myDOF += 1 + model.do() + self.checkFillet() + self.checkDOF() + + self.collectFeatures() + self.checkNbFeatures("SketchLine", 2) + self.checkNbFeatures("SketchArc", 1) + self.checkNbFeatures( + "SketchConstraintCoincidence", 4 + ) # Additionally 2 coincidences for apex with fillet objects + self.checkNbFeatures("SketchConstraintTangent", 2) + self.checkNbFeatures( + "SketchConstraintLength", 0 + ) # Length constraint expected to be removed + self.checkNbFeatures( + "SketchConstraintDistance", 1 + ) # Distance constraint should appear instead of Length + self.checkNbFeatures("SketchFillet", 0) + + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) + + def test_fillet_with_radius(self): + """Test 11. Fillet on connected arc and line in case of Radius constraint is applied to arc""" + aSketchLine = self.mySketch.addLine(10.0, 10.0, 20.0, 10.0) + aSketchArc = self.mySketch.addArc(0.0, 10.0, 0.0, 20.0, 10.0, 10.0, True) + self.myDOF += 9 + self.checkDOF() + self.mySketch.setCoincident(aSketchLine.startPoint(), aSketchArc.endPoint()) + self.myDOF -= 2 + model.do() + self.checkDOF() + self.mySketch.setRadius(aSketchArc.results()[1], 12.0) + self.myDOF -= 1 + model.do() + self.checkDOF() + self.mySketch.setFillet(aSketchLine.startPoint()) + self.myDOF += 1 + model.do() + self.checkFillet() + self.checkDOF() + + self.collectFeatures() + self.checkNbFeatures("SketchLine", 1) + self.checkNbFeatures("SketchArc", 2) + self.checkNbFeatures("SketchConstraintCoincidence", 2) + self.checkNbFeatures("SketchConstraintTangent", 2) + self.checkNbFeatures("SketchConstraintRadius", 1) + self.checkNbFeatures("SketchFillet", 0) + + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) + + def test_fillet_with_distance(self): + """Test 12. Fillet on two connected lines in case of Distance constraint applied""" + aSketchLineA = self.mySketch.addLine(20, 20, 70, 20) + aSketchLineB = self.mySketch.addLine(70, 20, 70, 53.16624790355412) + aSketchLineC = self.mySketch.addLine(70, 53.16624790355412, 20, 20) + self.myDOF += 12 + model.do() + self.checkDOF() + # coincidences + self.mySketch.setCoincident(aSketchLineA.endPoint(), aSketchLineB.startPoint()) + self.mySketch.setCoincident(aSketchLineB.endPoint(), aSketchLineC.startPoint()) + self.mySketch.setCoincident(aSketchLineA.startPoint(), aSketchLineC.endPoint()) + self.myDOF -= 6 + model.do() + self.checkDOF() + # other constraints + self.mySketch.setHorizontal(aSketchLineA.result()) + self.mySketch.setVertical(aSketchLineB.result()) + self.myDOF -= 2 + model.do() + self.checkDOF() + # construction point + aProjection = self.mySketch.addProjection( + model.selection("VERTEX", "Origin"), False + ) + aSketchPoint = SketchAPI_Point(aProjection.createdFeature()) + model.do() + # distances + self.mySketch.setLength(aSketchLineA.result(), 50) + self.mySketch.setDistance( + aSketchLineA.startPoint(), aSketchLineC.startPoint(), 60, True + ) + self.mySketch.setHorizontalDistance( + aSketchPoint.coordinates(), aSketchLineA.startPoint(), 20 + ) + self.mySketch.setVerticalDistance( + aSketchPoint.coordinates(), aSketchLineC.endPoint(), 20 + ) + self.myDOF -= 4 + model.do() + self.checkDOF() + + self.mySketch.setFillet(aSketchLineA.startPoint()) + self.myDOF += 1 + model.do() + self.checkFillet() + self.checkDOF() + + self.collectFeatures() + self.checkNbFeatures("SketchLine", 3) + self.checkNbFeatures("SketchArc", 1) + self.checkNbFeatures( + "SketchConstraintCoincidence", 6 + ) # Additionally 2 coincidences for apex with fillet objects + self.checkNbFeatures("SketchConstraintHorizontal", 1) + self.checkNbFeatures("SketchConstraintVertical", 1) + self.checkNbFeatures("SketchConstraintTangent", 2) + self.checkNbFeatures( + "SketchConstraintLength", 0 + ) # Length translated to Distance + self.checkNbFeatures( + "SketchConstraintDistance", 2 + ) # Length translated to Distance + self.checkNbFeatures("SketchConstraintDistanceHorizontal", 1) + self.checkNbFeatures("SketchConstraintDistanceVertical", 1) + self.checkNbFeatures("SketchFillet", 0) + + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [4]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [8]) + + def test_fillet_with_fixed_point(self): + """Test 13. Fillet on two connected lines in case of Fixed constraint applied to the fillet point""" + aSketchLineA = self.mySketch.addLine(10.0, 10.0, 20.0, 10.0) + aSketchLineB = self.mySketch.addLine(10.0, 10.0, 10.0, 20.0) + self.myDOF += 8 + self.checkDOF() + self.mySketch.setCoincident( + aSketchLineA.startPoint(), aSketchLineB.startPoint() + ) + self.myDOF -= 2 + model.do() + self.checkDOF() + self.mySketch.setFixed(aSketchLineA.startPoint()) + self.myDOF -= 2 + model.do() + self.checkDOF() + self.mySketch.setFillet(aSketchLineA.startPoint()) + self.myDOF += 3 # Fixed constraint has been removed + model.do() + self.checkFillet() + self.checkDOF() + + self.collectFeatures() + self.checkNbFeatures("SketchLine", 2) + self.checkNbFeatures("SketchArc", 1) + self.checkNbFeatures("SketchConstraintCoincidence", 2) + self.checkNbFeatures("SketchConstraintTangent", 2) + self.checkNbFeatures( + "SketchConstraintFixed", 0 + ) # Fixed constraint expected to be removed + self.checkNbFeatures("SketchFillet", 0) + + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) + + def test_fillet_with_fixed_line(self): + """Test 14. Fillet on two connected lines in case of Fixed constraint applied to one of lines""" + aSketchLineA = self.mySketch.addLine(10.0, 10.0, 20.0, 10.0) + aSketchLineB = self.mySketch.addLine(10.0, 10.0, 10.0, 20.0) + self.myDOF += 8 + self.checkDOF() + self.mySketch.setCoincident( + aSketchLineA.startPoint(), aSketchLineB.startPoint() + ) + self.myDOF -= 2 + model.do() + self.checkDOF() + self.mySketch.setFixed(aSketchLineA.result()) + self.myDOF -= 4 + model.do() + self.checkDOF() + self.mySketch.setFillet(aSketchLineA.startPoint()) + self.myDOF += 1 + model.do() + self.checkFillet() + self.checkDOF() + + self.collectFeatures() + self.checkNbFeatures("SketchLine", 2) + self.checkNbFeatures("SketchArc", 1) + self.checkNbFeatures("SketchConstraintCoincidence", 2) + self.checkNbFeatures("SketchConstraintTangent", 2) + self.checkNbFeatures( + "SketchConstraintLength", 0 + ) # Fixed constraint expected to be kept + self.checkNbFeatures("SketchFillet", 0) + + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) + + def test_fillet_with_angle(self): + """Test 15. Fillet on two connected lines in case of Perpendicular constraint applied""" + aSketchLineA = self.mySketch.addLine(10.0, 10.0, 20.0, 10.0) + aSketchLineB = self.mySketch.addLine(10.0, 10.0, 10.0, 20.0) + self.myDOF += 8 + self.checkDOF() + self.mySketch.setCoincident( + aSketchLineA.startPoint(), aSketchLineB.startPoint() + ) + self.myDOF -= 2 + model.do() + self.checkDOF() + self.mySketch.setAngle(aSketchLineA.result(), aSketchLineB.result(), 60.0) + self.myDOF -= 1 + model.do() + self.checkDOF() + self.mySketch.setFillet(aSketchLineA.startPoint()) + self.myDOF += 1 + model.do() + self.checkFillet() + self.checkDOF() + + self.collectFeatures() + self.checkNbFeatures("SketchLine", 2) + self.checkNbFeatures("SketchArc", 1) + self.checkNbFeatures("SketchConstraintCoincidence", 2) + self.checkNbFeatures("SketchConstraintTangent", 2) + self.checkNbFeatures("SketchConstraintAngle", 1) + self.checkNbFeatures("SketchFillet", 0) + + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.FACE, [0]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.EDGE, [3]) + model.testNbSubShapes(self.mySketch, GeomAPI_Shape.VERTEX, [6]) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestHighload.py b/src/SketchPlugin/Test/TestHighload.py index e7d20fd24..d897d2add 100644 --- a/src/SketchPlugin/Test/TestHighload.py +++ b/src/SketchPlugin/Test/TestHighload.py @@ -26,9 +26,9 @@ from ModelAPI import * import math -#========================================================================= +# ========================================================================= # Useful subroutines -#========================================================================= +# ========================================================================= def distance(pointA, pointB): """ subroutine to calculate distance between two points @@ -41,7 +41,7 @@ def distance(pointA, pointB): def createNAngle(theSketch, theN, theRadius, theEdgeLength=0): # Create an N-Angle at (0,0) - rad = 2. * math.pi / theN + rad = 2.0 * math.pi / theN points = [] for a in range(theN): x = round(math.cos(rad * a), 10) * theRadius @@ -97,17 +97,18 @@ def moveTo(theLines, theDeltaX, theDeltaY): aStart.setValue(aStart.x() + theDeltaX, aStart.y() + theDeltaY) anEnd.setValue(anEnd.x() + theDeltaX, anEnd.y() + theDeltaY) -#========================================================================= + +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2014-11-27" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -118,11 +119,11 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create 4x4 polygons N = {5, 21} -#========================================================================= +# ========================================================================= aDOF = 0 -deltaX = deltaY = 50. +deltaX = deltaY = 50.0 n = 5 aSession.startOperation() for i in range(4): @@ -132,16 +133,17 @@ for i in range(4): moveTo(allNangleLines, deltaX, deltaY) aDOF += n n += 1 - deltaX += 110. - deltaY += 110. - deltaX = 50. + deltaX += 110.0 + deltaY += 110.0 + deltaX = 50.0 aSession.finishOperation() -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.dof(aSketchFeature) == aDOF) -assert(model.checkPythonDump()) + +assert model.dof(aSketchFeature) == aDOF +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestIntersectionChangeEdge.py b/src/SketchPlugin/Test/TestIntersectionChangeEdge.py index 797f3e676..59257d9c7 100644 --- a/src/SketchPlugin/Test/TestIntersectionChangeEdge.py +++ b/src/SketchPlugin/Test/TestIntersectionChangeEdge.py @@ -31,80 +31,205 @@ 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(0, 0, 13.75, -26.66341125962693, -24.98309575119448, 16.60857991180005, False) -SketchArc_2 = Sketch_1.addArc(0, 0, 53.75, -26.66341125962693, -53.75, -26.66341125962693, False) +SketchArc_1 = Sketch_1.addArc( + 0, 0, 13.75, -26.66341125962693, -24.98309575119448, 16.60857991180005, False +) +SketchArc_2 = Sketch_1.addArc( + 0, 0, 53.75, -26.66341125962693, -53.75, -26.66341125962693, False +) SketchLine_1 = Sketch_1.addLine(13.75, -26.66341125962693, 53.75, -26.66341125962693) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_1.endPoint()) -SketchLine_2 = Sketch_1.addLine(-24.98309575119448, 16.60857991180005, -53.75, -26.66341125962693) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_2.endPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_1.endPoint() +) +SketchLine_2 = Sketch_1.addLine( + -24.98309575119448, 16.60857991180005, -53.75, -26.66341125962693 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_2.endPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_2.center(), SketchArc_1.center()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_2.result(), SketchArc_1.results()[1]) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchArc_1.center() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_2.result(), SketchArc_1.results()[1] +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_1.result() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 30) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_2.center(), SketchAPI_Point(SketchPoint_1).coordinates()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchAPI_Point(SketchPoint_1).coordinates() +) 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-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) +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/SketchArc_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) SketchLine_5 = Sketch_2.addLine(70, -60, -70, -60) SketchLine_6 = Sketch_2.addLine(-70, -60, -70, 60) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_4.result()) SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_5.result(), 60, True) -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_3.result(), 60, True) -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) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_5.result(), 60, True +) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_3.result(), 60, True +) +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_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")]) +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/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 +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.0e-7 Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) -SketchIntersectionPoint_1 = Sketch_3.addIntersectionPoint(model.selection("EDGE", "Intersection_1_1"), True) +SketchIntersectionPoint_1 = Sketch_3.addIntersectionPoint( + model.selection("EDGE", "Intersection_1_1"), True +) model.do() for ref in REF_DATA: SketchIntersectionPoint_1.setByExternalEdgeName(ref[0]) aPoints = SketchIntersectionPoint_1.intersectionPoints() - assert(len(aPoints) == ref[1]), "Intersection with edge {} produce {} points, expected {}".format(ref[0], aPoints.size(), ref[1]) + assert ( + len(aPoints) == ref[1] + ), "Intersection with edge {} produce {} points, expected {}".format( + ref[0], aPoints.size(), ref[1] + ) # check coordinates ind = 0 for p in aPoints: pnt = SketchAPI_Point(p) - delta = (pnt.coordinates().x() - ref[2][ind][0])**2 + (pnt.coordinates().y() - ref[2][ind][1])**2 - assert(delta < TOLERANCE * TOLERANCE), "Wrong coordinates of intersection with edge {}: ({}, {}) != expected ({}, {})".format(ref[0], pnt.coordinates().x(), pnt.coordinates().y(), ref[2][ind][0], ref[2][ind][1]) + delta = (pnt.coordinates().x() - ref[2][ind][0]) ** 2 + ( + pnt.coordinates().y() - ref[2][ind][1] + ) ** 2 + assert ( + delta < TOLERANCE * TOLERANCE + ), "Wrong coordinates of intersection with edge {}: ({}, {}) != expected ({}, {})".format( + ref[0], + pnt.coordinates().x(), + pnt.coordinates().y(), + ref[2][ind][0], + ref[2][ind][1], + ) ind += 1 model.do() model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestIntersectionWithCircle.py b/src/SketchPlugin/Test/TestIntersectionWithCircle.py index 10783d9af..e92c8f402 100644 --- a/src/SketchPlugin/Test/TestIntersectionWithCircle.py +++ b/src/SketchPlugin/Test/TestIntersectionWithCircle.py @@ -35,58 +35,153 @@ ParamD = model.addParameter(Part_1_doc, "D", "12") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(21.25834261322606, 21.25834261322606, 0, 0) SketchLine_2 = Sketch_1.addLine(0, 0, 50, -4.088404617988313e-023) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(50, -4.088404617988313e-023, 50, 50) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(50, 50, 28.74165738677394, 28.74165738677394) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_4.result(), SketchLine_1.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_3.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_4.result()) -SketchArc_1 = Sketch_1.addArc(31, 19, 21.25834261322606, 21.25834261322606, 28.74165738677394, 28.74165738677394, False) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchArc_1.endPoint()) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_4.result(), SketchLine_1.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_3.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_4.result() +) +SketchArc_1 = Sketch_1.addArc( + 31, + 19, + 21.25834261322606, + 21.25834261322606, + 28.74165738677394, + 28.74165738677394, + False, +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchArc_1.endPoint() +) 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) +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_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) +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&Sketch_1/SketchArc_1_2][Extrusion_1_1/To_Face]"), 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) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_2).coordinates()) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchCircle_1.center(), SketchAPI_Point(SketchPoint_2).coordinates() +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 1) SketchLine_5 = Sketch_2.addLine(23.85857157145715, 10.5, 23.85857157145715, 5) SketchLine_6 = Sketch_2.addLine(22.85857157145715, 6, 22.85857157145715, 10.5) SketchLine_7 = Sketch_2.addLine(22.85857157145715, 10.5, 23.85857157145715, 10.5) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchLine_7.endPoint()) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_5.result()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_5.startPoint(), SketchLine_7.endPoint() +) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_5.result() +) SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_5.result()) SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result()) SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_7.result()) -SketchConstraintDistanceHorizontal_1 = Sketch_2.setHorizontalDistance(SketchLine_6.endPoint(), SketchLine_5.startPoint(), 1) -SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance(SketchLine_5.startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 0.5) -SketchArc_2 = Sketch_2.addArc(23.85857157145715, 6, 23.85857157145715, 5, 22.85857157145715, 6, True) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_5.result(), SketchArc_2.center()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_6.startPoint()) -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()) +SketchConstraintDistanceHorizontal_1 = Sketch_2.setHorizontalDistance( + SketchLine_6.endPoint(), SketchLine_5.startPoint(), 1 +) +SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance( + SketchLine_5.startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 0.5 +) +SketchArc_2 = Sketch_2.addArc( + 23.85857157145715, 6, 23.85857157145715, 5, 22.85857157145715, 6, True +) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_5.result(), SketchArc_2.center() +) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchArc_2.endPoint(), SketchLine_6.startPoint() +) +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_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")]) +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() -assert(SketchIntersectionPoint_1.feature().results().size() == 2) +assert SketchIntersectionPoint_1.feature().results().size() == 2 model.testNbResults(ExtrusionCut_1, 1) model.testNbSubResults(ExtrusionCut_1, [0]) @@ -98,9 +193,9 @@ model.testResultsVolumes(ExtrusionCut_1, [9451.611727849665840039961040020]) # change parameter and check intersection validity ParamD.setValue(15) -model.do(); +model.do() -assert(SketchIntersectionPoint_1.feature().results().size() == 2) +assert SketchIntersectionPoint_1.feature().results().size() == 2 model.testNbResults(ExtrusionCut_1, 1) model.testNbSubResults(ExtrusionCut_1, [0]) @@ -112,9 +207,9 @@ model.testResultsVolumes(ExtrusionCut_1, [9451.152473626798382611013948917]) # change parameter and check intersection validity ParamD.setValue(19) -model.do(); +model.do() -assert(SketchIntersectionPoint_1.feature().results().size() == 2) +assert SketchIntersectionPoint_1.feature().results().size() == 2 model.testNbResults(ExtrusionCut_1, 1) model.testNbSubResults(ExtrusionCut_1, [0]) @@ -126,9 +221,9 @@ model.testResultsVolumes(ExtrusionCut_1, [9448.046243665688962209969758987]) # change parameter and check intersection validity ParamD.setValue(23) -model.do(); +model.do() -assert(SketchIntersectionPoint_1.feature().results().size() == 1) +assert SketchIntersectionPoint_1.feature().results().size() == 1 model.testNbResults(ExtrusionCut_1, 1) model.testNbSubResults(ExtrusionCut_1, [0]) @@ -140,9 +235,9 @@ model.testResultsVolumes(ExtrusionCut_1, [9458.635858820198336616158485413]) # change parameter and check intersection validity ParamD.setValue(29) -model.do(); +model.do() -assert(SketchIntersectionPoint_1.feature().results().size() == 1) +assert SketchIntersectionPoint_1.feature().results().size() == 1 model.testNbResults(ExtrusionCut_1, 1) model.testNbSubResults(ExtrusionCut_1, [0]) @@ -154,4 +249,4 @@ model.testResultsVolumes(ExtrusionCut_1, [9463.846034357124153757467865944]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestIntersectionWithLine.py b/src/SketchPlugin/Test/TestIntersectionWithLine.py index b062cf769..9f222a897 100644 --- a/src/SketchPlugin/Test/TestIntersectionWithLine.py +++ b/src/SketchPlugin/Test/TestIntersectionWithLine.py @@ -34,50 +34,102 @@ Part_1_doc = Part_1.document() ParamD = model.addParameter(Part_1_doc, "D", "40") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 50, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(50, 0, 50, 10) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(50, 10, 40, 10) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(40, 10, 40, 30) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(40, 30, 50, 30) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(50, 30, 50, 40) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(50, 40, 0, 50) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(0, 50, 0, 0) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_8.endPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_2.result(), SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_6.result()) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_2.result(), SketchLine_6.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_6.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 50) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_8.result(), 50) 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) +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_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&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) +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&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()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_1.results()[1], 5) ExtrusionCut_1.setNestedSketch(Sketch_2) model.do() -assert(SketchIntersectionPoint_1.feature().results().empty() == False) +assert SketchIntersectionPoint_1.feature().results().empty() == False model.testNbResults(ExtrusionCut_1, 1) model.testNbSubResults(ExtrusionCut_1, [0]) @@ -89,9 +141,9 @@ model.testResultsVolumes(ExtrusionCut_1, [20303.650459150881943060085177422]) # change parameter and check intersection validity ParamD.setValue(35) -model.do(); +model.do() -assert(SketchIntersectionPoint_1.feature().results().empty() == False) +assert SketchIntersectionPoint_1.feature().results().empty() == False model.testNbResults(ExtrusionCut_1, 1) model.testNbSubResults(ExtrusionCut_1, [0]) @@ -103,18 +155,20 @@ model.testResultsVolumes(ExtrusionCut_1, [19303.650459150881943060085177422]) # change parameter and check the intersection is not valid now ParamD.setValue(60) -model.do(); -assert(SketchIntersectionPoint_1.feature().results().empty() == True) +model.do() +assert SketchIntersectionPoint_1.feature().results().empty() == True # change parameter to initial value and check intersection validity ParamD.setValue(40) -model.do(); +model.do() # coincidence of circle center and intersection point is lost on previous step, restore it [SketchPoint_2] = SketchIntersectionPoint_1.intersectionPoints() -Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchCircle_1.center()) +Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchCircle_1.center() +) model.do() -assert(SketchIntersectionPoint_1.feature().results().empty() == False) +assert SketchIntersectionPoint_1.feature().results().empty() == False model.testNbResults(ExtrusionCut_1, 1) model.testNbSubResults(ExtrusionCut_1, [0]) @@ -126,4 +180,4 @@ model.testResultsVolumes(ExtrusionCut_1, [20303.650459150881943060085177422]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestIntersectionWithSpline.py b/src/SketchPlugin/Test/TestIntersectionWithSpline.py index d41b787e6..fad943040 100644 --- a/src/SketchPlugin/Test/TestIntersectionWithSpline.py +++ b/src/SketchPlugin/Test/TestIntersectionWithSpline.py @@ -33,57 +33,157 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() ParamD = model.addParameter(Part_1_doc, "D", "5") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchArc_1 = Sketch_1.addArc(-20, 0, -12.51615726667241, -49.43674845641531, -67.51615726667241, 15.56325154358469, False) -SketchLine_1 = Sketch_1.addLine(-67.51615726667241, 15.56325154358469, -12.51615726667241, 15.56325154358469) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) -SketchLine_2 = Sketch_1.addLine(-12.51615726667241, 15.56325154358469, -12.51615726667241, -49.43674845641531) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.endPoint()) +SketchArc_1 = Sketch_1.addArc( + -20, + 0, + -12.51615726667241, + -49.43674845641531, + -67.51615726667241, + 15.56325154358469, + False, +) +SketchLine_1 = Sketch_1.addLine( + -67.51615726667241, 15.56325154358469, -12.51615726667241, 15.56325154358469 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.startPoint() +) +SketchLine_2 = Sketch_1.addLine( + -12.51615726667241, 15.56325154358469, -12.51615726667241, -49.43674845641531 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_2.endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_3 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_3.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_3.result() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 50) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 65) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_1.center(), SketchAPI_Line(SketchLine_3).startPoint(), 20) +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_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")]) +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) SketchLine_5 = Sketch_2.addLine(20, -37.28019411294778, 20, 40) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_2.addLine(20, 40, -34.11217447219568, 40) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchLine_6.endPoint()) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchLine_4.startPoint(), SketchLine_6.endPoint() +) SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_5.result()) SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_6.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_2.createdFeature() -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_5.result(), 20, True) -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_6.result(), 40, True) -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) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_5.result(), 20, True +) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_6.result(), 40, True +) +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_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&Sketch_2/SketchLine_4")) -SketchIntersectionPoint_1 = Sketch_3.addIntersectionPoint(model.selection("EDGE", "Intersection_1_1"), False) +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&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) -SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_2).coordinates()) +SketchConstraintCoincidence_8 = Sketch_3.setCoincident( + SketchCircle_1.center(), SketchAPI_Point(SketchPoint_2).coordinates() +) SketchCircle_2 = Sketch_3.addCircle(21.47998214403209, 0, 5) -SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchCircle_2.center(), SketchAPI_Point(SketchPoint_3).coordinates()) -SketchConstraintEqual_1 = Sketch_3.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) +SketchConstraintCoincidence_9 = Sketch_3.setCoincident( + SketchCircle_2.center(), SketchAPI_Point(SketchPoint_3).coordinates() +) +SketchConstraintEqual_1 = Sketch_3.setEqual( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) SketchConstraintRadius_2 = Sketch_3.setRadius(SketchCircle_1.results()[1], 5) ExtrusionFuse_1.setNestedSketch(Sketch_3) model.do() -assert(SketchIntersectionPoint_1.feature().results().size() == 2) +assert SketchIntersectionPoint_1.feature().results().size() == 2 model.testNbResults(ExtrusionFuse_1, 1) model.testNbSubResults(ExtrusionFuse_1, [0]) @@ -95,9 +195,9 @@ model.testResultsVolumes(ExtrusionFuse_1, [43388.789797644698410294950008392]) # change parameter and check intersection validity ParamD.setValue(15) -model.do(); +model.do() -assert(SketchIntersectionPoint_1.feature().results().size() == 2) +assert SketchIntersectionPoint_1.feature().results().size() == 2 model.testNbResults(ExtrusionFuse_1, 1) model.testNbSubResults(ExtrusionFuse_1, [0]) @@ -109,9 +209,9 @@ model.testResultsVolumes(ExtrusionFuse_1, [64385.484780074148147832602262497]) # change parameter and check single intersection ParamD.setValue(25) -model.do(); +model.do() -assert(SketchIntersectionPoint_1.feature().results().size() == 1) +assert SketchIntersectionPoint_1.feature().results().size() == 1 model.testNbResults(ExtrusionFuse_1, 1) model.testNbSubResults(ExtrusionFuse_1, [0]) @@ -123,19 +223,23 @@ model.testResultsVolumes(ExtrusionFuse_1, [89638.890852351003559306263923645]) # change parameter and check intersection is NOT valid now ParamD.setValue(50) -model.do(); +model.do() -assert(SketchIntersectionPoint_1.feature().results().empty()) +assert SketchIntersectionPoint_1.feature().results().empty() # revert parameter to original value and reset coincidences ParamD.setValue(5) model.do() [SketchPoint_2, SketchPoint_3] = SketchIntersectionPoint_1.intersectionPoints() -SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_2).coordinates()) -SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchCircle_2.center(), SketchAPI_Point(SketchPoint_3).coordinates()) +SketchConstraintCoincidence_8 = Sketch_3.setCoincident( + SketchCircle_1.center(), SketchAPI_Point(SketchPoint_2).coordinates() +) +SketchConstraintCoincidence_9 = Sketch_3.setCoincident( + SketchCircle_2.center(), SketchAPI_Point(SketchPoint_3).coordinates() +) model.do() -assert(SketchIntersectionPoint_1.feature().results().size() == 2) +assert SketchIntersectionPoint_1.feature().results().size() == 2 model.testNbResults(ExtrusionFuse_1, 1) model.testNbSubResults(ExtrusionFuse_1, [0]) @@ -147,4 +251,4 @@ model.testResultsVolumes(ExtrusionFuse_1, [43388.789797644698410294950008392]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestMirror.py b/src/SketchPlugin/Test/TestMirror.py index e6c978e20..dbf736b74 100644 --- a/src/SketchPlugin/Test/TestMirror.py +++ b/src/SketchPlugin/Test/TestMirror.py @@ -33,42 +33,47 @@ from ModelAPI import * import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2015-03-17" -#========================================================================= + +# ========================================================================= # Auxiliary functions -#========================================================================= +# ========================================================================= def normalize(theDir): aLen = math.hypot(theDir[0], theDir[1]) - if aLen < 1.e-10: + if aLen < 1.0e-10: aLen = 1.0 return [theDir[0] / aLen, theDir[1] / aLen] + def checkMirror(theListInit, theListMirr, theMirrorLine): - TOL = 6.e-5 + TOL = 6.0e-5 aListSize = theListInit.size() aLineStartPoint = geomDataAPI_Point2D(theMirrorLine.attribute("StartPoint")) aLineEndPoint = geomDataAPI_Point2D(theMirrorLine.attribute("EndPoint")) - aLineDir = [aLineEndPoint.x() - aLineStartPoint.x(), aLineEndPoint.y() - aLineStartPoint.y()] + aLineDir = [ + aLineEndPoint.x() - aLineStartPoint.x(), + aLineEndPoint.y() - aLineStartPoint.y(), + ] aLineDir = normalize(aLineDir) for ind in range(0, aListSize): aFeatureB = ModelAPI_Feature.feature(theListInit.object(ind)) aFeatureC = ModelAPI_Feature.feature(theListMirr.object(ind)) - assert(aFeatureB is not None) - assert(aFeatureC is not None) - assert(aFeatureB.getKind() == aFeatureC.getKind()) + assert aFeatureB is not None + assert aFeatureC is not None + assert aFeatureB.getKind() == aFeatureC.getKind() anAttributes = [] - if (aFeatureB.getKind() == "SketchLine"): - anAttributes = ['StartPoint', 'EndPoint'] - elif (aFeatureB.getKind() == "SketchArc"): - anAttributes = ['center_point', 'start_point', 'end_point'] + if aFeatureB.getKind() == "SketchLine": + anAttributes = ["StartPoint", "EndPoint"] + elif aFeatureB.getKind() == "SketchArc": + anAttributes = ["center_point", "start_point", "end_point"] for key in anAttributes: aPointB = geomDataAPI_Point2D(aFeatureB.attribute(key)) @@ -83,14 +88,14 @@ def checkMirror(theListInit, theListMirr, theMirrorLine): assert math.fabs(aCross) < TOL, "aCross = {0}".format(aCross) -#========================================================================= +# ========================================================================= # Start of test -#========================================================================= +# ========================================================================= aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -101,39 +106,39 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Creation of an arc and two lines -#========================================================================= +# ========================================================================= # Arc aSession.startOperation() aSketchArc1 = aSketchFeature.addFeature("SketchArc") anArcCentr = geomDataAPI_Point2D(aSketchArc1.attribute("center_point")) -anArcCentr.setValue(10., 10.) +anArcCentr.setValue(10.0, 10.0) anArcStartPoint = geomDataAPI_Point2D(aSketchArc1.attribute("start_point")) -anArcStartPoint.setValue(0., 50.) +anArcStartPoint.setValue(0.0, 50.0) anArcEndPoint = geomDataAPI_Point2D(aSketchArc1.attribute("end_point")) -anArcEndPoint.setValue(50., 0.) +anArcEndPoint.setValue(50.0, 0.0) aSession.finishOperation() # Line 1 aSession.startOperation() aSketchLine1 = aSketchFeature.addFeature("SketchLine") aLine1StartPoint = geomDataAPI_Point2D(aSketchLine1.attribute("StartPoint")) aLine1EndPoint = geomDataAPI_Point2D(aSketchLine1.attribute("EndPoint")) -aLine1StartPoint.setValue(0., 50.) -aLine1EndPoint.setValue(0., 100.) +aLine1StartPoint.setValue(0.0, 50.0) +aLine1EndPoint.setValue(0.0, 100.0) aSession.finishOperation() # Line 2 aSession.startOperation() aSketchLine2 = aSketchFeature.addFeature("SketchLine") aLine2StartPoint = geomDataAPI_Point2D(aSketchLine2.attribute("StartPoint")) aLine2EndPoint = geomDataAPI_Point2D(aSketchLine2.attribute("EndPoint")) -aLine2StartPoint.setValue(50., 0.) -aLine2EndPoint.setValue(100., 0.) +aLine2StartPoint.setValue(50.0, 0.0) +aLine2EndPoint.setValue(100.0, 0.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 13) -#========================================================================= +assert model.dof(aSketchFeature) == 13 +# ========================================================================= # Link arc points and lines points by the coincidence constraint -#========================================================================= +# ========================================================================= aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintCoincidence") reflistA = aConstraint.refattr("ConstraintEntityA") @@ -150,37 +155,37 @@ reflistA.setAttr(anArcEndPoint) reflistB.setAttr(aLine2StartPoint) aConstraint.execute() aSession.finishOperation() -assert (model.dof(aSketchFeature) == 9) -#========================================================================= +assert model.dof(aSketchFeature) == 9 +# ========================================================================= # Add tangency constraint and check correctness -#========================================================================= +# ========================================================================= aSession.startOperation() aTangency = aSketchFeature.addFeature("SketchConstraintTangent") aRefObjectA = aTangency.refattr("ConstraintEntityA") aRefObjectB = aTangency.refattr("ConstraintEntityB") anObjectA = modelAPI_ResultConstruction(aSketchArc1.lastResult()) anObjectB = modelAPI_ResultConstruction(aSketchLine1.lastResult()) -assert (anObjectA is not None) -assert (anObjectB is not None) +assert anObjectA is not None +assert anObjectB is not None aRefObjectA.setObject(anObjectA) aRefObjectB.setObject(anObjectB) aTangency.execute() aSession.finishOperation() -assert (model.dof(aSketchFeature) == 8) -#========================================================================= +assert model.dof(aSketchFeature) == 8 +# ========================================================================= # Create mirror line -#========================================================================= +# ========================================================================= aSession.startOperation() aMirrorLine = aSketchFeature.addFeature("SketchLine") aLineStartPoint = geomDataAPI_Point2D(aMirrorLine.attribute("StartPoint")) aLineEndPoint = geomDataAPI_Point2D(aMirrorLine.attribute("EndPoint")) -aLineStartPoint.setValue(100., 0.) -aLineEndPoint.setValue(100., 100.) +aLineStartPoint.setValue(100.0, 0.0) +aLineEndPoint.setValue(100.0, 100.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 12) -#========================================================================= +assert model.dof(aSketchFeature) == 12 +# ========================================================================= # Make mirror for objects created above -#========================================================================= +# ========================================================================= aSession.startOperation() aMirror = aSketchFeature.addFeature("SketchConstraintMirror") aRefObjectA = aMirror.refattr("ConstraintEntityA") @@ -191,48 +196,50 @@ aRefListInitial.append(aSketchArc1.lastResult()) aRefListInitial.append(aSketchLine2.lastResult()) aMirror.execute() aSession.finishOperation() -assert (model.dof(aSketchFeature) == 12) -#========================================================================= +assert model.dof(aSketchFeature) == 12 +# ========================================================================= # Verify the simmetricity of all mirrored objects -#========================================================================= +# ========================================================================= aRefListB = aMirror.reflist("ConstraintEntityB") aRefListC = aMirror.reflist("ConstraintEntityC") -assert (aRefListB.size() == 3) -assert (aRefListC.size() == 3) +assert aRefListB.size() == 3 +assert aRefListC.size() == 3 checkMirror(aRefListB, aRefListC, aMirrorLine) -assert (model.dof(aSketchFeature) == 12) +assert model.dof(aSketchFeature) == 12 -#========================================================================= +# ========================================================================= # Remove object from mirror -#========================================================================= +# ========================================================================= aSession.startOperation() aRefListInitial.remove(aSketchLine2.lastResult()) aSession.finishOperation() -assert (aRefListB.size() == 2) -assert (aRefListC.size() == 2) +assert aRefListB.size() == 2 +assert aRefListC.size() == 2 checkMirror(aRefListB, aRefListC, aMirrorLine) -assert (model.dof(aSketchFeature) == 12) +assert model.dof(aSketchFeature) == 12 -#========================================================================= +# ========================================================================= # Clear list of mirrored features -#========================================================================= +# ========================================================================= aSession.startOperation() aRefListInitial.clear() -assert (aRefListB.size() == 0) -assert (aRefListC.size() == 0) +assert aRefListB.size() == 0 +assert aRefListC.size() == 0 # add arc once again aRefListInitial.append(aSketchArc1.lastResult()) aSession.finishOperation() -assert (aRefListB.size() == 1) -assert (aRefListC.size() == 1) +assert aRefListB.size() == 1 +assert aRefListC.size() == 1 checkMirror(aRefListB, aRefListC, aMirrorLine) -assert (model.dof(aSketchFeature) == 12) +assert model.dof(aSketchFeature) == 12 -#========================================================================= +# ========================================================================= # Create distance between original and mirrored entities (check the error appears) -#========================================================================= +# ========================================================================= aSketchErrorAttr = aSketchFeature.string("SolverError") -assert len(aSketchErrorAttr.value()) == 0, "Sketch failed with error: {}".format(aSketchErrorAttr.value()) +assert len(aSketchErrorAttr.value()) == 0, "Sketch failed with error: {}".format( + aSketchErrorAttr.value() +) aMirroredArc = model.lastSubFeature(aSketchFeature, "SketchArc") aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintDistance") @@ -242,16 +249,18 @@ anArcStartPoint = geomDataAPI_Point2D(aSketchArc1.attribute("start_point")) aMirroredArcStartPoint = geomDataAPI_Point2D(aMirroredArc.attribute("start_point")) refAttrA.setAttr(anArcStartPoint) refAttrB.setAttr(aMirroredArcStartPoint) -aConstraint.real("ConstraintValue").setValue(200.) +aConstraint.real("ConstraintValue").setValue(200.0) aSession.finishOperation() print("Sketch error : {}".format(aSketchErrorAttr.value())) -assert len(aSketchErrorAttr.value()) != 0, "ERROR: Sketch has not been failed as expected" +assert ( + len(aSketchErrorAttr.value()) != 0 +), "ERROR: Sketch has not been failed as expected" aSession.startOperation() aDocument.removeFeature(aConstraint) aSession.finishOperation() -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestMoveArc.py b/src/SketchPlugin/Test/TestMoveArc.py index c62945c1b..ec4a99f0c 100644 --- a/src/SketchPlugin/Test/TestMoveArc.py +++ b/src/SketchPlugin/Test/TestMoveArc.py @@ -27,320 +27,307 @@ from salome.shaper import model __updated__ = "2017-05-11" + class TestMoveArc(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myCenter = [50., 50.] - self.myStart = [70., 50.] - self.myEnd = [50., 70.] - self.myArc = self.mySketch.addArc(self.myCenter[0], self.myCenter[1], self.myStart[0], self.myStart[1], self.myEnd[0], self.myEnd[1], False) - self.myDOF = 5 - model.do() - self.checkDOF() - - def tearDown(self): - model.assertArcValidity(self.myArc) - self.checkDOF() - model.end() - assert(model.checkPythonDump()) - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkPointCoordinates(self, thePoint, theCoordinates): - self.assertAlmostEqual(thePoint.x(), theCoordinates[0], 5) - self.assertAlmostEqual(thePoint.y(), theCoordinates[1], 5) - - def checkPointOnArc(self, theCoordinates): - distPC = model.distancePointPoint(self.myArc.center(), theCoordinates) - radius = model.distancePointPoint(self.myArc.center(), self.myArc.startPoint()) - self.assertAlmostEqual(distPC, radius, 5) - - def checkArcRadius(self): - radius = model.distancePointPoint(self.myArc.center(), self.myArc.startPoint()) - self.assertAlmostEqual(radius, self.myRadius, 5) - - def fixArcRadius(self): - self.myRadius = 20. - self.mySketch.setRadius(self.myArc.results()[1], self.myRadius) - self.myDOF -= 1 - model.do() - self.checkDOF() - - def fixPoint(self, thePoint): - self.mySketch.setFixed(thePoint) - self.myDOF -= 2 - model.do() - self.checkDOF() - - def fixArc(self): - self.mySketch.setFixed(self.myArc.results()[1]) - self.myDOF -= 5 - model.do() - self.checkDOF() - - - def test_move_center_of_free_arc(self): - """ Test 1. Movement of center of a free arc - """ - newPosition = [self.myCenter[0] + 10., self.myCenter[1] - 15.] - self.mySketch.move(self.myArc.center(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.center(), newPosition) - - def test_move_start_of_free_arc(self): - """ Test 2. Movement of start point of a free arc - """ - newPosition = [self.myStart[0] - 10., self.myStart[1] + 5.] - self.mySketch.move(self.myArc.startPoint(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.center(), self.myCenter) - self.checkPointCoordinates(self.myArc.startPoint(), newPosition) - - def test_move_end_of_free_arc(self): - """ Test 3. Movement of end point of a free arc - """ - newPosition = [self.myEnd[0] + 10., self.myEnd[1] + 5.] - self.mySketch.move(self.myArc.endPoint(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.center(), self.myCenter) - self.checkPointCoordinates(self.myArc.endPoint(), newPosition) - - def test_move_free_arc(self): - """ Test 4. Movement of a free arc dragging the edge - """ - newPosition = [100., 80.] - self.mySketch.move(self.myArc.defaultResult(), newPosition[0], newPosition[1]) - model.do() - self.checkPointOnArc(newPosition) - self.checkPointCoordinates(self.myArc.center(), self.myCenter) - - def test_move_center_of_arc_fixed_center(self): - """ Test 5. Movement of center of the arc with fixed center (nothing should be changed) - """ - self.fixPoint(self.myArc.center()) - - newPosition = [self.myCenter[0] + 10., self.myCenter[1] - 15.] - self.mySketch.move(self.myArc.center(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.center(), self.myCenter) - - def test_move_start_of_arc_fixed_center(self): - """ Test 6. Movement of start point of the arc with fixed center - """ - self.fixPoint(self.myArc.center()) - - newPosition = [self.myStart[0] - 10., self.myStart[1] + 5.] - self.mySketch.move(self.myArc.startPoint(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.center(), self.myCenter) - self.checkPointCoordinates(self.myArc.startPoint(), newPosition) - - def test_move_end_of_arc_fixed_center(self): - """ Test 7. Movement of end point of the arc with fixed center - """ - self.fixPoint(self.myArc.center()) - - newPosition = [self.myEnd[0] + 10., self.myEnd[1] + 5.] - self.mySketch.move(self.myArc.endPoint(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.center(), self.myCenter) - self.checkPointCoordinates(self.myArc.endPoint(), newPosition) - - def test_move_arc_fixed_center(self): - """ Test 8. Movement of the arc with fixed center dragging the edge - """ - self.fixPoint(self.myArc.center()) - - newPosition = [100., 80.] - self.mySketch.move(self.myArc.defaultResult(), newPosition[0], newPosition[1]) - model.do() - self.checkPointOnArc(newPosition) - self.checkPointCoordinates(self.myArc.center(), self.myCenter) - - def test_move_center_of_arc_fixed_start(self): - """ Test 9. Movement of center of the arc with fixed start point - """ - self.fixPoint(self.myArc.startPoint()) - - newPosition = [self.myCenter[0] + 10., self.myCenter[1] - 15.] - self.mySketch.move(self.myArc.center(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.center(), newPosition) - self.checkPointCoordinates(self.myArc.startPoint(), self.myStart) - - def test_move_start_of_arc_fixed_start(self): - """ Test 10. Movement of start point of the arc with fixed start point (nothing should be changed) - """ - self.fixPoint(self.myArc.startPoint()) - - newPosition = [self.myStart[0] - 10., self.myStart[1] + 5.] - self.mySketch.move(self.myArc.startPoint(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.center(), self.myCenter) - self.checkPointCoordinates(self.myArc.startPoint(), self.myStart) - self.checkPointCoordinates(self.myArc.endPoint(), self.myEnd) - - def test_move_end_of_arc_fixed_start(self): - """ Test 11. Movement of end point of the arc with fixed start point - """ - self.fixPoint(self.myArc.startPoint()) - - newPosition = [self.myEnd[0] + 10., self.myEnd[1] + 5.] - self.mySketch.move(self.myArc.endPoint(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.startPoint(), self.myStart) - self.assertNotEqual(self.myArc.center().x(), self.myCenter[0]) - self.assertNotEqual(self.myArc.center().y(), self.myCenter[1]) - - def test_move_arc_fixed_start(self): - """ Test 12. Movement of the arc with fixed start point dragging the edge - """ - self.fixPoint(self.myArc.startPoint()) - - newPosition = [100., 80.] - self.mySketch.move(self.myArc.defaultResult(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.startPoint(), self.myStart) - self.assertNotEqual(self.myArc.center().x(), self.myCenter[0]) - self.assertNotEqual(self.myArc.center().y(), self.myCenter[1]) - - def test_move_center_of_arc_fixed_end(self): - """ Test 13. Movement of center of the arc with fixed end point - """ - self.fixPoint(self.myArc.endPoint()) - - newPosition = [self.myCenter[0] + 10., self.myCenter[1] - 15.] - self.mySketch.move(self.myArc.center(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.center(), newPosition) - self.checkPointCoordinates(self.myArc.endPoint(), self.myEnd) - - def test_move_start_of_arc_fixed_end(self): - """ Test 14. Movement of start point of the arc with fixed end point - """ - self.fixPoint(self.myArc.endPoint()) - - newPosition = [self.myStart[0] - 10., self.myStart[1] + 5.] - self.mySketch.move(self.myArc.startPoint(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.endPoint(), self.myEnd) - self.assertNotEqual(self.myArc.center().x(), self.myCenter[0]) - self.assertNotEqual(self.myArc.center().y(), self.myCenter[1]) - - def test_move_end_of_arc_fixed_end(self): - """ Test 15. Movement of end point of the arc with fixed end point (nothing should be changed) - """ - self.fixPoint(self.myArc.endPoint()) - - newPosition = [self.myEnd[0] + 10., self.myEnd[1] + 5.] - self.mySketch.move(self.myArc.endPoint(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.center(), self.myCenter) - self.checkPointCoordinates(self.myArc.startPoint(), self.myStart) - self.checkPointCoordinates(self.myArc.endPoint(), self.myEnd) - - def test_move_arc_fixed_end(self): - """ Test 16. Movement of the arc with fixed end point dragging the edge - """ - self.fixPoint(self.myArc.endPoint()) - - newPosition = [100., 80.] - self.mySketch.move(self.myArc.defaultResult(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.endPoint(), self.myEnd) - self.assertTrue(fabs(self.myArc.center().x() - self.myCenter[0]) > 1.e-5 or fabs(self.myArc.center().y() - self.myCenter[1]) > 1.e-5) - - def test_move_center_of_arc_fixed_radius(self): - """ Test 17. Movement of center of the arc with fixed radius - """ - self.fixArcRadius() - - newPosition = [self.myCenter[0] + 10., self.myCenter[1] - 15.] - self.mySketch.move(self.myArc.center(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.center(), newPosition) - self.checkArcRadius() - - def test_move_start_of_arc_fixed_radius(self): - """ Test 18. Movement of start point of the arc with fixed radius - """ - self.fixArcRadius() - - newPosition = [self.myStart[0] - 10., self.myStart[1] + 5.] - self.mySketch.move(self.myArc.startPoint(), newPosition[0], newPosition[1]) - model.do() - self.checkArcRadius() - - def test_move_end_of_arc_fixed_radius(self): - """ Test 19. Movement of end point of the arc with fixed radius - """ - self.fixArcRadius() - - newPosition = [self.myEnd[0] + 10., self.myEnd[1] + 5.] - self.mySketch.move(self.myArc.endPoint(), newPosition[0], newPosition[1]) - model.do() - self.checkArcRadius() - - def test_move_arc_fixed_radius(self): - """ Test 20. Movement of the arc with fixed radius dragging the edge - """ - self.fixArcRadius() - - newPosition = [100., 80.] - self.mySketch.move(self.myArc.defaultResult(), newPosition[0], newPosition[1]) - model.do() - self.checkArcRadius() - - def test_move_center_of_fixed_arc(self): - """ Test 21. Movement of center of fully fixed arc (nothing should be changed) - """ - self.fixArc() - - newPosition = [self.myCenter[0] + 10., self.myCenter[1] - 15.] - self.mySketch.move(self.myArc.center(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.center(), self.myCenter) - self.checkPointCoordinates(self.myArc.startPoint(), self.myStart) - self.checkPointCoordinates(self.myArc.endPoint(), self.myEnd) - - def test_move_start_of_fixed_arc(self): - """ Test 22. Movement of start point of fully fixed arc (nothing should be changed) - """ - self.fixArc() - - newPosition = [self.myStart[0] - 10., self.myStart[1] + 5.] - self.mySketch.move(self.myArc.startPoint(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.center(), self.myCenter) - self.checkPointCoordinates(self.myArc.startPoint(), self.myStart) - self.checkPointCoordinates(self.myArc.endPoint(), self.myEnd) - - def test_move_end_of_fixed_arc(self): - """ Test 23. Movement of end point of fully fixed arc (nothing should be changed) - """ - self.fixArc() - - newPosition = [self.myEnd[0] + 10., self.myEnd[1] + 5.] - self.mySketch.move(self.myArc.endPoint(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.center(), self.myCenter) - self.checkPointCoordinates(self.myArc.startPoint(), self.myStart) - self.checkPointCoordinates(self.myArc.endPoint(), self.myEnd) - - def test_move_fixed_arc(self): - """ Test 24. Movement of fully fixed arc (nothing should be changed) - """ - self.fixArc() - - newPosition = [100., 80.] - self.mySketch.move(self.myArc.defaultResult(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myArc.center(), self.myCenter) - self.checkPointCoordinates(self.myArc.startPoint(), self.myStart) - self.checkPointCoordinates(self.myArc.endPoint(), self.myEnd) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myCenter = [50.0, 50.0] + self.myStart = [70.0, 50.0] + self.myEnd = [50.0, 70.0] + self.myArc = self.mySketch.addArc( + self.myCenter[0], + self.myCenter[1], + self.myStart[0], + self.myStart[1], + self.myEnd[0], + self.myEnd[1], + False, + ) + self.myDOF = 5 + model.do() + self.checkDOF() + + def tearDown(self): + model.assertArcValidity(self.myArc) + self.checkDOF() + model.end() + assert model.checkPythonDump() + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointCoordinates(self, thePoint, theCoordinates): + self.assertAlmostEqual(thePoint.x(), theCoordinates[0], 5) + self.assertAlmostEqual(thePoint.y(), theCoordinates[1], 5) + + def checkPointOnArc(self, theCoordinates): + distPC = model.distancePointPoint(self.myArc.center(), theCoordinates) + radius = model.distancePointPoint(self.myArc.center(), self.myArc.startPoint()) + self.assertAlmostEqual(distPC, radius, 5) + + def checkArcRadius(self): + radius = model.distancePointPoint(self.myArc.center(), self.myArc.startPoint()) + self.assertAlmostEqual(radius, self.myRadius, 5) + + def fixArcRadius(self): + self.myRadius = 20.0 + self.mySketch.setRadius(self.myArc.results()[1], self.myRadius) + self.myDOF -= 1 + model.do() + self.checkDOF() + + def fixPoint(self, thePoint): + self.mySketch.setFixed(thePoint) + self.myDOF -= 2 + model.do() + self.checkDOF() + + def fixArc(self): + self.mySketch.setFixed(self.myArc.results()[1]) + self.myDOF -= 5 + model.do() + self.checkDOF() + + def test_move_center_of_free_arc(self): + """Test 1. Movement of center of a free arc""" + newPosition = [self.myCenter[0] + 10.0, self.myCenter[1] - 15.0] + self.mySketch.move(self.myArc.center(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.center(), newPosition) + + def test_move_start_of_free_arc(self): + """Test 2. Movement of start point of a free arc""" + newPosition = [self.myStart[0] - 10.0, self.myStart[1] + 5.0] + self.mySketch.move(self.myArc.startPoint(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.center(), self.myCenter) + self.checkPointCoordinates(self.myArc.startPoint(), newPosition) + + def test_move_end_of_free_arc(self): + """Test 3. Movement of end point of a free arc""" + newPosition = [self.myEnd[0] + 10.0, self.myEnd[1] + 5.0] + self.mySketch.move(self.myArc.endPoint(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.center(), self.myCenter) + self.checkPointCoordinates(self.myArc.endPoint(), newPosition) + + def test_move_free_arc(self): + """Test 4. Movement of a free arc dragging the edge""" + newPosition = [100.0, 80.0] + self.mySketch.move(self.myArc.defaultResult(), newPosition[0], newPosition[1]) + model.do() + self.checkPointOnArc(newPosition) + self.checkPointCoordinates(self.myArc.center(), self.myCenter) + + def test_move_center_of_arc_fixed_center(self): + """Test 5. Movement of center of the arc with fixed center (nothing should be changed)""" + self.fixPoint(self.myArc.center()) + + newPosition = [self.myCenter[0] + 10.0, self.myCenter[1] - 15.0] + self.mySketch.move(self.myArc.center(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.center(), self.myCenter) + + def test_move_start_of_arc_fixed_center(self): + """Test 6. Movement of start point of the arc with fixed center""" + self.fixPoint(self.myArc.center()) + + newPosition = [self.myStart[0] - 10.0, self.myStart[1] + 5.0] + self.mySketch.move(self.myArc.startPoint(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.center(), self.myCenter) + self.checkPointCoordinates(self.myArc.startPoint(), newPosition) + + def test_move_end_of_arc_fixed_center(self): + """Test 7. Movement of end point of the arc with fixed center""" + self.fixPoint(self.myArc.center()) + + newPosition = [self.myEnd[0] + 10.0, self.myEnd[1] + 5.0] + self.mySketch.move(self.myArc.endPoint(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.center(), self.myCenter) + self.checkPointCoordinates(self.myArc.endPoint(), newPosition) + + def test_move_arc_fixed_center(self): + """Test 8. Movement of the arc with fixed center dragging the edge""" + self.fixPoint(self.myArc.center()) + + newPosition = [100.0, 80.0] + self.mySketch.move(self.myArc.defaultResult(), newPosition[0], newPosition[1]) + model.do() + self.checkPointOnArc(newPosition) + self.checkPointCoordinates(self.myArc.center(), self.myCenter) + + def test_move_center_of_arc_fixed_start(self): + """Test 9. Movement of center of the arc with fixed start point""" + self.fixPoint(self.myArc.startPoint()) + + newPosition = [self.myCenter[0] + 10.0, self.myCenter[1] - 15.0] + self.mySketch.move(self.myArc.center(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.center(), newPosition) + self.checkPointCoordinates(self.myArc.startPoint(), self.myStart) + + def test_move_start_of_arc_fixed_start(self): + """Test 10. Movement of start point of the arc with fixed start point (nothing should be changed)""" + self.fixPoint(self.myArc.startPoint()) + + newPosition = [self.myStart[0] - 10.0, self.myStart[1] + 5.0] + self.mySketch.move(self.myArc.startPoint(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.center(), self.myCenter) + self.checkPointCoordinates(self.myArc.startPoint(), self.myStart) + self.checkPointCoordinates(self.myArc.endPoint(), self.myEnd) + + def test_move_end_of_arc_fixed_start(self): + """Test 11. Movement of end point of the arc with fixed start point""" + self.fixPoint(self.myArc.startPoint()) + + newPosition = [self.myEnd[0] + 10.0, self.myEnd[1] + 5.0] + self.mySketch.move(self.myArc.endPoint(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.startPoint(), self.myStart) + self.assertNotEqual(self.myArc.center().x(), self.myCenter[0]) + self.assertNotEqual(self.myArc.center().y(), self.myCenter[1]) + + def test_move_arc_fixed_start(self): + """Test 12. Movement of the arc with fixed start point dragging the edge""" + self.fixPoint(self.myArc.startPoint()) + + newPosition = [100.0, 80.0] + self.mySketch.move(self.myArc.defaultResult(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.startPoint(), self.myStart) + self.assertNotEqual(self.myArc.center().x(), self.myCenter[0]) + self.assertNotEqual(self.myArc.center().y(), self.myCenter[1]) + + def test_move_center_of_arc_fixed_end(self): + """Test 13. Movement of center of the arc with fixed end point""" + self.fixPoint(self.myArc.endPoint()) + + newPosition = [self.myCenter[0] + 10.0, self.myCenter[1] - 15.0] + self.mySketch.move(self.myArc.center(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.center(), newPosition) + self.checkPointCoordinates(self.myArc.endPoint(), self.myEnd) + + def test_move_start_of_arc_fixed_end(self): + """Test 14. Movement of start point of the arc with fixed end point""" + self.fixPoint(self.myArc.endPoint()) + + newPosition = [self.myStart[0] - 10.0, self.myStart[1] + 5.0] + self.mySketch.move(self.myArc.startPoint(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.endPoint(), self.myEnd) + self.assertNotEqual(self.myArc.center().x(), self.myCenter[0]) + self.assertNotEqual(self.myArc.center().y(), self.myCenter[1]) + + def test_move_end_of_arc_fixed_end(self): + """Test 15. Movement of end point of the arc with fixed end point (nothing should be changed)""" + self.fixPoint(self.myArc.endPoint()) + + newPosition = [self.myEnd[0] + 10.0, self.myEnd[1] + 5.0] + self.mySketch.move(self.myArc.endPoint(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.center(), self.myCenter) + self.checkPointCoordinates(self.myArc.startPoint(), self.myStart) + self.checkPointCoordinates(self.myArc.endPoint(), self.myEnd) + + def test_move_arc_fixed_end(self): + """Test 16. Movement of the arc with fixed end point dragging the edge""" + self.fixPoint(self.myArc.endPoint()) + + newPosition = [100.0, 80.0] + self.mySketch.move(self.myArc.defaultResult(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.endPoint(), self.myEnd) + self.assertTrue( + fabs(self.myArc.center().x() - self.myCenter[0]) > 1.0e-5 + or fabs(self.myArc.center().y() - self.myCenter[1]) > 1.0e-5 + ) + + def test_move_center_of_arc_fixed_radius(self): + """Test 17. Movement of center of the arc with fixed radius""" + self.fixArcRadius() + + newPosition = [self.myCenter[0] + 10.0, self.myCenter[1] - 15.0] + self.mySketch.move(self.myArc.center(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.center(), newPosition) + self.checkArcRadius() + + def test_move_start_of_arc_fixed_radius(self): + """Test 18. Movement of start point of the arc with fixed radius""" + self.fixArcRadius() + + newPosition = [self.myStart[0] - 10.0, self.myStart[1] + 5.0] + self.mySketch.move(self.myArc.startPoint(), newPosition[0], newPosition[1]) + model.do() + self.checkArcRadius() + + def test_move_end_of_arc_fixed_radius(self): + """Test 19. Movement of end point of the arc with fixed radius""" + self.fixArcRadius() + + newPosition = [self.myEnd[0] + 10.0, self.myEnd[1] + 5.0] + self.mySketch.move(self.myArc.endPoint(), newPosition[0], newPosition[1]) + model.do() + self.checkArcRadius() + + def test_move_arc_fixed_radius(self): + """Test 20. Movement of the arc with fixed radius dragging the edge""" + self.fixArcRadius() + + newPosition = [100.0, 80.0] + self.mySketch.move(self.myArc.defaultResult(), newPosition[0], newPosition[1]) + model.do() + self.checkArcRadius() + + def test_move_center_of_fixed_arc(self): + """Test 21. Movement of center of fully fixed arc (nothing should be changed)""" + self.fixArc() + + newPosition = [self.myCenter[0] + 10.0, self.myCenter[1] - 15.0] + self.mySketch.move(self.myArc.center(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.center(), self.myCenter) + self.checkPointCoordinates(self.myArc.startPoint(), self.myStart) + self.checkPointCoordinates(self.myArc.endPoint(), self.myEnd) + + def test_move_start_of_fixed_arc(self): + """Test 22. Movement of start point of fully fixed arc (nothing should be changed)""" + self.fixArc() + + newPosition = [self.myStart[0] - 10.0, self.myStart[1] + 5.0] + self.mySketch.move(self.myArc.startPoint(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.center(), self.myCenter) + self.checkPointCoordinates(self.myArc.startPoint(), self.myStart) + self.checkPointCoordinates(self.myArc.endPoint(), self.myEnd) + + def test_move_end_of_fixed_arc(self): + """Test 23. Movement of end point of fully fixed arc (nothing should be changed)""" + self.fixArc() + + newPosition = [self.myEnd[0] + 10.0, self.myEnd[1] + 5.0] + self.mySketch.move(self.myArc.endPoint(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.center(), self.myCenter) + self.checkPointCoordinates(self.myArc.startPoint(), self.myStart) + self.checkPointCoordinates(self.myArc.endPoint(), self.myEnd) + + def test_move_fixed_arc(self): + """Test 24. Movement of fully fixed arc (nothing should be changed)""" + self.fixArc() + + newPosition = [100.0, 80.0] + self.mySketch.move(self.myArc.defaultResult(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myArc.center(), self.myCenter) + self.checkPointCoordinates(self.myArc.startPoint(), self.myStart) + self.checkPointCoordinates(self.myArc.endPoint(), self.myEnd) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestMoveBSpline.py b/src/SketchPlugin/Test/TestMoveBSpline.py index c7033c10e..ce1ee787b 100644 --- a/src/SketchPlugin/Test/TestMoveBSpline.py +++ b/src/SketchPlugin/Test/TestMoveBSpline.py @@ -30,386 +30,403 @@ from salome.shaper import model __updated__ = "2020-01-20" -class TestMoveBSpline(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myPoles = [GeomAPI_Pnt2d(20., 50.), - GeomAPI_Pnt2d(70., 70.), - GeomAPI_Pnt2d(80., 30.), - GeomAPI_Pnt2d(50., 10.), - GeomAPI_Pnt2d(90., -30.)] - self.mySpline = self.mySketch.addSpline(poles = self.myPoles) - self.myDOF = len(self.myPoles) * 2 - model.do() - self.checkDOF() - - def tearDown(self): - self.checkDOF() - model.end() - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkPointCoordinates(self, thePoint, theCoordinates): - aCoord = [] - if issubclass(type(theCoordinates), GeomAPI_Pnt2d): - aCoord = [theCoordinates.x(), theCoordinates.y()] - else: - aCoord = theCoordinates - DIGITS = 7 - math.floor(math.log10(math.hypot(aCoord[0], aCoord[1]))) - self.assertAlmostEqual(thePoint.x(), aCoord[0], DIGITS) - self.assertAlmostEqual(thePoint.y(), aCoord[1], DIGITS) - - def checkPoles(self, theBSpline, theCoordinates): - poles = theBSpline.poles() - for index, point in zip(range(0, len(theCoordinates)), theCoordinates): - self.checkPointCoordinates(poles.pnt(index), point) - - def fixPoint(self, thePoint): - self.mySketch.setFixed(thePoint) - self.myDOF -= 2 - model.do() - self.checkDOF() - - - def test_move_free_bspline(self): - """ Test 1. Movement of a free B-spline dragging the edge - """ - oldPosition = GeomAPI_Edge(self.mySpline.defaultResult().shape()).middlePoint() - newPosition = GeomAPI_Pnt2d(120., 90.) - self.mySketch.move(self.mySpline.defaultResult(), newPosition) - model.do() - - # plane is XOY, no need to project oldPosition point - dx = newPosition.x() - oldPosition.x() - dy = newPosition.y() - oldPosition.y() - - newPoles = [] - for pole in self.myPoles: - newPoles.append(GeomAPI_Pnt2d(pole.x() + dx, pole.y() + dy)) - self.checkPoles(self.mySpline, newPoles) - - def test_move_start_point(self): - """ Test 2. Movement of start point of a free B-spline curve - """ - newPoles = self.myPoles - - newPoles[0].setX(newPoles[0].x() - 20.) - newPoles[0].setY(newPoles[0].y() + 10.) - self.mySketch.move(self.mySpline.startPoint(), newPoles[0]) - model.do() - - self.checkPoles(self.mySpline, newPoles) - - def test_move_end_point(self): - """ Test 3. Movement of end point of a free B-spline curve - """ - newPoles = self.myPoles - - newPoles[-1].setX(newPoles[-1].x() + 20.) - newPoles[-1].setY(newPoles[-1].y() + 10.) - self.mySketch.move(self.mySpline.endPoint(), newPoles[-1]) - model.do() - - self.checkPoles(self.mySpline, newPoles) - - - def test_move_bspline_with_start_point_fixed(self): - """ Test 4. Movement of a B-spline dragging the edge when start point is fixed - """ - self.fixPoint(self.mySpline.startPoint()) - model.do() - - oldPosition = GeomAPI_Edge(self.mySpline.defaultResult().shape()).middlePoint() - newPosition = GeomAPI_Pnt2d(120., 90.) - self.mySketch.move(self.mySpline.defaultResult(), newPosition) - model.do() - - # plane is XOY, no need to project oldPosition point - dx = newPosition.x() - oldPosition.x() - dy = newPosition.y() - oldPosition.y() - - newPoles = [self.myPoles[0]] - for pole in self.myPoles[1:]: - newPoles.append(GeomAPI_Pnt2d(pole.x() + dx, pole.y() + dy)) - self.checkPoles(self.mySpline, newPoles) - - def test_move_start_point_with_start_point_fixed(self): - """ Test 5. Movement of start point of a free B-spline curve has no result if the first pole is fixed - """ - self.fixPoint(self.mySpline.startPoint()) - model.do() - - self.mySketch.move(self.mySpline.startPoint(), self.myPoles[0].x() - 10., self.myPoles[0].y() + 10.) - model.do() - - self.checkPoles(self.mySpline, self.myPoles) - - def test_move_end_point_with_start_point_fixed(self): - """ Test 6. Movement of end point of a free B-spline curve when start point is fixed - """ - self.fixPoint(self.mySpline.startPoint()) - model.do() - - newPoles = self.myPoles - - newPoles[-1].setX(newPoles[-1].x() + 20.) - newPoles[-1].setY(newPoles[-1].y() + 10.) - self.mySketch.move(self.mySpline.endPoint(), newPoles[-1]) - model.do() - - self.checkPoles(self.mySpline, newPoles) - - - def test_move_bspline_with_end_point_fixed(self): - """ Test 7. Movement of a B-spline dragging the edge when end point is fixed - """ - self.fixPoint(self.mySpline.endPoint()) - model.do() - - oldPosition = GeomAPI_Edge(self.mySpline.defaultResult().shape()).middlePoint() - newPosition = GeomAPI_Pnt2d(120., 90.) - self.mySketch.move(self.mySpline.defaultResult(), newPosition) - model.do() - - # plane is XOY, no need to project oldPosition point - dx = newPosition.x() - oldPosition.x() - dy = newPosition.y() - oldPosition.y() - - newPoles = [] - for pole in self.myPoles[:-1]: - newPoles.append(GeomAPI_Pnt2d(pole.x() + dx, pole.y() + dy)) - newPoles.append(self.myPoles[-1]) - self.checkPoles(self.mySpline, newPoles) - - def test_move_start_point_with_end_point_fixed(self): - """ Test 8. Movement of start point of a free B-spline curve when end point is fixed - """ - self.fixPoint(self.mySpline.endPoint()) - model.do() - - newPoles = self.myPoles - - newPoles[0].setX(newPoles[0].x() + 20.) - newPoles[0].setY(newPoles[0].y() + 10.) - self.mySketch.move(self.mySpline.startPoint(), self.myPoles[0]) - model.do() - - self.checkPoles(self.mySpline, self.myPoles) - - def test_move_end_point_with_end_point_fixed(self): - """ Test 9. Movement of end point of a free B-spline curve has no result if the last pole is fixed - """ - self.fixPoint(self.mySpline.endPoint()) - model.do() - - self.mySketch.move(self.mySpline.endPoint(), self.myPoles[-1].x() + 10., self.myPoles[-1].y() + 10.) - model.do() - - self.checkPoles(self.mySpline, self.myPoles) - - - def test_move_fixed_bspline(self): - """ Test 10. Movement of a fully fixed B-spline - """ - self.mySketch.setFixed(self.mySpline.defaultResult()) - self.myDOF = 0 - model.do() - - newPosition = GeomAPI_Pnt2d(120., 90.) - self.mySketch.move(self.mySpline.defaultResult(), newPosition) - model.do() - - self.checkPoles(self.mySpline, self.myPoles) - - def test_move_start_point_of_fixed_bspline(self): - """ Test 11. Movement of start point of a fully fixed B-spline curve - """ - self.mySketch.setFixed(self.mySpline.defaultResult()) - self.myDOF = 0 - model.do() - - self.mySketch.move(self.mySpline.startPoint(), self.myPoles[0].x() + 10., self.myPoles[0].y() + 10.) - model.do() - - self.checkPoles(self.mySpline, self.myPoles) - - def test_move_end_point_of_fixed_bspline(self): - """ Test 12. Movement of end point of a fully fixed B-spline curve - """ - self.mySketch.setFixed(self.mySpline.defaultResult()) - self.myDOF = 0 - model.do() - - self.mySketch.move(self.mySpline.endPoint(), self.myPoles[-1].x() + 10., self.myPoles[-1].y() + 10.) - model.do() - - self.checkPoles(self.mySpline, self.myPoles) - - - def test_move_bspline_with_fixed_pole(self): - """ Test 13. Movement of a B-spline curve with fixed pole - """ - [Point_1, Point_2, Point_3, Point_4, Point_5] = self.mySpline.controlPoles(auxiliary = [0, 1, 2, 3, 4]) - model.do() - - self.fixPoint(Point_2.defaultResult()) - model.do() - - oldPosition = GeomAPI_Edge(self.mySpline.defaultResult().shape()).middlePoint() - newPosition = GeomAPI_Pnt2d(120., 90.) - self.mySketch.move(self.mySpline.defaultResult(), newPosition) - model.do() - - # plane is XOY, no need to project oldPosition point - dx = newPosition.x() - oldPosition.x() - dy = newPosition.y() - oldPosition.y() - - newPoles = [] - for pole in self.myPoles: - newPoles.append(GeomAPI_Pnt2d(pole.x() + dx, pole.y() + dy)) - newPoles[1].setX(newPoles[1].x() - dx) - newPoles[1].setY(newPoles[1].y() - dy) - self.checkPoles(self.mySpline, newPoles) - - def test_move_start_point_with_fixed_pole(self): - """ Test 14. Movement of start point of a B-spline curve with fixed pole - """ - [Point_1, Point_2, Point_3, Point_4, Point_5] = self.mySpline.controlPoles(auxiliary = [0, 1, 2, 3, 4]) - model.do() - - self.fixPoint(Point_2.defaultResult()) - model.do() - - newPoles = self.myPoles - - newPoles[0].setX(newPoles[0].x() + 20.) - newPoles[0].setY(newPoles[0].y() + 10.) - self.mySketch.move(self.mySpline.startPoint(), newPoles[0]) - model.do() - - self.checkPoles(self.mySpline, newPoles) - - def test_move_end_point_with_fixed_pole(self): - """ Test 15. Movement of end point of a B-spline curve with fixed pole - """ - [Point_1, Point_2, Point_3, Point_4, Point_5] = self.mySpline.controlPoles(auxiliary = [0, 1, 2, 3, 4]) - model.do() - - self.fixPoint(Point_2.defaultResult()) - model.do() - - newPoles = self.myPoles - - newPoles[-1].setX(newPoles[-1].x() + 20.) - newPoles[-1].setY(newPoles[-1].y() + 10.) - self.mySketch.move(self.mySpline.endPoint(), newPoles[-1]) - model.do() - - self.checkPoles(self.mySpline, newPoles) - - - def test_move_bspline_with_fixed_segment(self): - """ Test 16. Movement of a B-spline curve with fixed control segment - """ - [Line_1, Line_2, Line_3, Line_4] = self.mySpline.controlPolygon(auxiliary = [0, 1, 2, 3]) - model.do() - - self.mySketch.setFixed(Line_1.defaultResult()) - self.myDOF -= 4 - model.do() - - oldPosition = GeomAPI_Edge(self.mySpline.defaultResult().shape()).middlePoint() - newPosition = GeomAPI_Pnt2d(120., 90.) - self.mySketch.move(self.mySpline.defaultResult(), newPosition) - model.do() - - # plane is XOY, no need to project oldPosition point - dx = newPosition.x() - oldPosition.x() - dy = newPosition.y() - oldPosition.y() - - newPoles = [self.myPoles[0], self.myPoles[1]] - for pole in self.myPoles[2:]: - newPoles.append(GeomAPI_Pnt2d(pole.x() + dx, pole.y() + dy)) - self.checkPoles(self.mySpline, newPoles) - - def test_move_start_point_with_fixed_segment(self): - """ Test 17. Movement of start point of a B-spline curve with fixed control segment - """ - [Line_1, Line_2, Line_3, Line_4] = self.mySpline.controlPolygon(auxiliary = [0, 1, 2, 3]) - model.do() - - self.mySketch.setFixed(Line_1.defaultResult()) - self.myDOF -= 4 - model.do() - - self.mySketch.move(self.mySpline.startPoint(), self.myPoles[0].x() + 10., self.myPoles[0].y() - 20.) - model.do() - - self.checkPoles(self.mySpline, self.myPoles) - - def test_move_end_point_with_fixed_segment(self): - """ Test 18. Movement of end point of a B-spline curve with fixed control segment - """ - [Line_1, Line_2, Line_3, Line_4] = self.mySpline.controlPolygon(auxiliary = [0, 1, 2, 3]) - model.do() - - self.mySketch.setFixed(Line_1.defaultResult()) - self.myDOF -= 4 - model.do() - - newPoles = self.myPoles - - newPoles[-1].setX(newPoles[-1].x() + 20.) - newPoles[-1].setY(newPoles[-1].y() + 10.) - self.mySketch.move(self.mySpline.endPoint(), newPoles[-1]) - model.do() - - self.checkPoles(self.mySpline, newPoles) - - - def test_move_pole_of_free_bspline(self): - """ Test 19. Movement of a pole of a B-spline curve - """ - [Point_1, Point_2, Point_3, Point_4, Point_5] = self.mySpline.controlPoles(auxiliary = [0, 1, 2, 3, 4]) - [Line_1, Line_2, Line_3, Line_4] = self.mySpline.controlPolygon(auxiliary = [0, 1, 2, 3]) - model.do() - - newPoles = self.myPoles - - newPoles[2].setX(newPoles[2].x() + 20.) - newPoles[2].setY(newPoles[2].y() + 20.) - self.mySketch.move(SketchAPI_Point(Point_3).coordinates(), newPoles[2]) - model.do() - - self.checkPoles(self.mySpline, newPoles) - - def test_move_segment_of_free_bspline(self): - """ Test 20. Movement of a control segment of a B-spline curve - """ - [Point_1, Point_2, Point_3, Point_4, Point_5] = self.mySpline.controlPoles(auxiliary = [0, 1, 2, 3, 4]) - [Line_1, Line_2, Line_3, Line_4] = self.mySpline.controlPolygon(auxiliary = [0, 1, 2, 3]) - model.do() - - oldPosition = GeomAPI_Pnt2d(0.5 * (self.myPoles[2].x() + self.myPoles[3].x()), - 0.5 * (self.myPoles[2].y() + self.myPoles[3].y())) - newPosition = GeomAPI_Pnt2d(120., 90.) - self.mySketch.move(SketchAPI_Line(Line_3).defaultResult(), newPosition) - model.do() - - dx = newPosition.x() - oldPosition.x() - dy = newPosition.y() - oldPosition.y() - - newPoles = self.myPoles - newPoles[2].setX(newPoles[2].x() + dx) - newPoles[2].setY(newPoles[2].y() + dy) - newPoles[3].setX(newPoles[3].x() + dx) - newPoles[3].setY(newPoles[3].y() + dy) - - self.checkPoles(self.mySpline, newPoles) +class TestMoveBSpline(unittest.TestCase): + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myPoles = [ + GeomAPI_Pnt2d(20.0, 50.0), + GeomAPI_Pnt2d(70.0, 70.0), + GeomAPI_Pnt2d(80.0, 30.0), + GeomAPI_Pnt2d(50.0, 10.0), + GeomAPI_Pnt2d(90.0, -30.0), + ] + self.mySpline = self.mySketch.addSpline(poles=self.myPoles) + self.myDOF = len(self.myPoles) * 2 + model.do() + self.checkDOF() + + def tearDown(self): + self.checkDOF() + model.end() + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointCoordinates(self, thePoint, theCoordinates): + aCoord = [] + if issubclass(type(theCoordinates), GeomAPI_Pnt2d): + aCoord = [theCoordinates.x(), theCoordinates.y()] + else: + aCoord = theCoordinates + DIGITS = 7 - math.floor(math.log10(math.hypot(aCoord[0], aCoord[1]))) + self.assertAlmostEqual(thePoint.x(), aCoord[0], DIGITS) + self.assertAlmostEqual(thePoint.y(), aCoord[1], DIGITS) + + def checkPoles(self, theBSpline, theCoordinates): + poles = theBSpline.poles() + for index, point in zip(range(0, len(theCoordinates)), theCoordinates): + self.checkPointCoordinates(poles.pnt(index), point) + + def fixPoint(self, thePoint): + self.mySketch.setFixed(thePoint) + self.myDOF -= 2 + model.do() + self.checkDOF() + + def test_move_free_bspline(self): + """Test 1. Movement of a free B-spline dragging the edge""" + oldPosition = GeomAPI_Edge(self.mySpline.defaultResult().shape()).middlePoint() + newPosition = GeomAPI_Pnt2d(120.0, 90.0) + self.mySketch.move(self.mySpline.defaultResult(), newPosition) + model.do() + + # plane is XOY, no need to project oldPosition point + dx = newPosition.x() - oldPosition.x() + dy = newPosition.y() - oldPosition.y() + + newPoles = [] + for pole in self.myPoles: + newPoles.append(GeomAPI_Pnt2d(pole.x() + dx, pole.y() + dy)) + self.checkPoles(self.mySpline, newPoles) + + def test_move_start_point(self): + """Test 2. Movement of start point of a free B-spline curve""" + newPoles = self.myPoles + + newPoles[0].setX(newPoles[0].x() - 20.0) + newPoles[0].setY(newPoles[0].y() + 10.0) + self.mySketch.move(self.mySpline.startPoint(), newPoles[0]) + model.do() + + self.checkPoles(self.mySpline, newPoles) + + def test_move_end_point(self): + """Test 3. Movement of end point of a free B-spline curve""" + newPoles = self.myPoles + + newPoles[-1].setX(newPoles[-1].x() + 20.0) + newPoles[-1].setY(newPoles[-1].y() + 10.0) + self.mySketch.move(self.mySpline.endPoint(), newPoles[-1]) + model.do() + + self.checkPoles(self.mySpline, newPoles) + + def test_move_bspline_with_start_point_fixed(self): + """Test 4. Movement of a B-spline dragging the edge when start point is fixed""" + self.fixPoint(self.mySpline.startPoint()) + model.do() + + oldPosition = GeomAPI_Edge(self.mySpline.defaultResult().shape()).middlePoint() + newPosition = GeomAPI_Pnt2d(120.0, 90.0) + self.mySketch.move(self.mySpline.defaultResult(), newPosition) + model.do() + + # plane is XOY, no need to project oldPosition point + dx = newPosition.x() - oldPosition.x() + dy = newPosition.y() - oldPosition.y() + + newPoles = [self.myPoles[0]] + for pole in self.myPoles[1:]: + newPoles.append(GeomAPI_Pnt2d(pole.x() + dx, pole.y() + dy)) + self.checkPoles(self.mySpline, newPoles) + + def test_move_start_point_with_start_point_fixed(self): + """Test 5. Movement of start point of a free B-spline curve has no result if the first pole is fixed""" + self.fixPoint(self.mySpline.startPoint()) + model.do() + + self.mySketch.move( + self.mySpline.startPoint(), + self.myPoles[0].x() - 10.0, + self.myPoles[0].y() + 10.0, + ) + model.do() + + self.checkPoles(self.mySpline, self.myPoles) + + def test_move_end_point_with_start_point_fixed(self): + """Test 6. Movement of end point of a free B-spline curve when start point is fixed""" + self.fixPoint(self.mySpline.startPoint()) + model.do() + + newPoles = self.myPoles + + newPoles[-1].setX(newPoles[-1].x() + 20.0) + newPoles[-1].setY(newPoles[-1].y() + 10.0) + self.mySketch.move(self.mySpline.endPoint(), newPoles[-1]) + model.do() + + self.checkPoles(self.mySpline, newPoles) + + def test_move_bspline_with_end_point_fixed(self): + """Test 7. Movement of a B-spline dragging the edge when end point is fixed""" + self.fixPoint(self.mySpline.endPoint()) + model.do() + + oldPosition = GeomAPI_Edge(self.mySpline.defaultResult().shape()).middlePoint() + newPosition = GeomAPI_Pnt2d(120.0, 90.0) + self.mySketch.move(self.mySpline.defaultResult(), newPosition) + model.do() + + # plane is XOY, no need to project oldPosition point + dx = newPosition.x() - oldPosition.x() + dy = newPosition.y() - oldPosition.y() + + newPoles = [] + for pole in self.myPoles[:-1]: + newPoles.append(GeomAPI_Pnt2d(pole.x() + dx, pole.y() + dy)) + newPoles.append(self.myPoles[-1]) + self.checkPoles(self.mySpline, newPoles) + + def test_move_start_point_with_end_point_fixed(self): + """Test 8. Movement of start point of a free B-spline curve when end point is fixed""" + self.fixPoint(self.mySpline.endPoint()) + model.do() + + newPoles = self.myPoles + + newPoles[0].setX(newPoles[0].x() + 20.0) + newPoles[0].setY(newPoles[0].y() + 10.0) + self.mySketch.move(self.mySpline.startPoint(), self.myPoles[0]) + model.do() + + self.checkPoles(self.mySpline, self.myPoles) + + def test_move_end_point_with_end_point_fixed(self): + """Test 9. Movement of end point of a free B-spline curve has no result if the last pole is fixed""" + self.fixPoint(self.mySpline.endPoint()) + model.do() + + self.mySketch.move( + self.mySpline.endPoint(), + self.myPoles[-1].x() + 10.0, + self.myPoles[-1].y() + 10.0, + ) + model.do() + + self.checkPoles(self.mySpline, self.myPoles) + + def test_move_fixed_bspline(self): + """Test 10. Movement of a fully fixed B-spline""" + self.mySketch.setFixed(self.mySpline.defaultResult()) + self.myDOF = 0 + model.do() + + newPosition = GeomAPI_Pnt2d(120.0, 90.0) + self.mySketch.move(self.mySpline.defaultResult(), newPosition) + model.do() + + self.checkPoles(self.mySpline, self.myPoles) + + def test_move_start_point_of_fixed_bspline(self): + """Test 11. Movement of start point of a fully fixed B-spline curve""" + self.mySketch.setFixed(self.mySpline.defaultResult()) + self.myDOF = 0 + model.do() + + self.mySketch.move( + self.mySpline.startPoint(), + self.myPoles[0].x() + 10.0, + self.myPoles[0].y() + 10.0, + ) + model.do() + + self.checkPoles(self.mySpline, self.myPoles) + + def test_move_end_point_of_fixed_bspline(self): + """Test 12. Movement of end point of a fully fixed B-spline curve""" + self.mySketch.setFixed(self.mySpline.defaultResult()) + self.myDOF = 0 + model.do() + + self.mySketch.move( + self.mySpline.endPoint(), + self.myPoles[-1].x() + 10.0, + self.myPoles[-1].y() + 10.0, + ) + model.do() + + self.checkPoles(self.mySpline, self.myPoles) + + def test_move_bspline_with_fixed_pole(self): + """Test 13. Movement of a B-spline curve with fixed pole""" + [Point_1, Point_2, Point_3, Point_4, Point_5] = self.mySpline.controlPoles( + auxiliary=[0, 1, 2, 3, 4] + ) + model.do() + + self.fixPoint(Point_2.defaultResult()) + model.do() + + oldPosition = GeomAPI_Edge(self.mySpline.defaultResult().shape()).middlePoint() + newPosition = GeomAPI_Pnt2d(120.0, 90.0) + self.mySketch.move(self.mySpline.defaultResult(), newPosition) + model.do() + + # plane is XOY, no need to project oldPosition point + dx = newPosition.x() - oldPosition.x() + dy = newPosition.y() - oldPosition.y() + + newPoles = [] + for pole in self.myPoles: + newPoles.append(GeomAPI_Pnt2d(pole.x() + dx, pole.y() + dy)) + newPoles[1].setX(newPoles[1].x() - dx) + newPoles[1].setY(newPoles[1].y() - dy) + self.checkPoles(self.mySpline, newPoles) + + def test_move_start_point_with_fixed_pole(self): + """Test 14. Movement of start point of a B-spline curve with fixed pole""" + [Point_1, Point_2, Point_3, Point_4, Point_5] = self.mySpline.controlPoles( + auxiliary=[0, 1, 2, 3, 4] + ) + model.do() + + self.fixPoint(Point_2.defaultResult()) + model.do() + + newPoles = self.myPoles + + newPoles[0].setX(newPoles[0].x() + 20.0) + newPoles[0].setY(newPoles[0].y() + 10.0) + self.mySketch.move(self.mySpline.startPoint(), newPoles[0]) + model.do() + + self.checkPoles(self.mySpline, newPoles) + + def test_move_end_point_with_fixed_pole(self): + """Test 15. Movement of end point of a B-spline curve with fixed pole""" + [Point_1, Point_2, Point_3, Point_4, Point_5] = self.mySpline.controlPoles( + auxiliary=[0, 1, 2, 3, 4] + ) + model.do() + + self.fixPoint(Point_2.defaultResult()) + model.do() + + newPoles = self.myPoles + + newPoles[-1].setX(newPoles[-1].x() + 20.0) + newPoles[-1].setY(newPoles[-1].y() + 10.0) + self.mySketch.move(self.mySpline.endPoint(), newPoles[-1]) + model.do() + + self.checkPoles(self.mySpline, newPoles) + + def test_move_bspline_with_fixed_segment(self): + """Test 16. Movement of a B-spline curve with fixed control segment""" + [Line_1, Line_2, Line_3, Line_4] = self.mySpline.controlPolygon( + auxiliary=[0, 1, 2, 3] + ) + model.do() + + self.mySketch.setFixed(Line_1.defaultResult()) + self.myDOF -= 4 + model.do() + + oldPosition = GeomAPI_Edge(self.mySpline.defaultResult().shape()).middlePoint() + newPosition = GeomAPI_Pnt2d(120.0, 90.0) + self.mySketch.move(self.mySpline.defaultResult(), newPosition) + model.do() + + # plane is XOY, no need to project oldPosition point + dx = newPosition.x() - oldPosition.x() + dy = newPosition.y() - oldPosition.y() + + newPoles = [self.myPoles[0], self.myPoles[1]] + for pole in self.myPoles[2:]: + newPoles.append(GeomAPI_Pnt2d(pole.x() + dx, pole.y() + dy)) + self.checkPoles(self.mySpline, newPoles) + + def test_move_start_point_with_fixed_segment(self): + """Test 17. Movement of start point of a B-spline curve with fixed control segment""" + [Line_1, Line_2, Line_3, Line_4] = self.mySpline.controlPolygon( + auxiliary=[0, 1, 2, 3] + ) + model.do() + + self.mySketch.setFixed(Line_1.defaultResult()) + self.myDOF -= 4 + model.do() + + self.mySketch.move( + self.mySpline.startPoint(), + self.myPoles[0].x() + 10.0, + self.myPoles[0].y() - 20.0, + ) + model.do() + + self.checkPoles(self.mySpline, self.myPoles) + + def test_move_end_point_with_fixed_segment(self): + """Test 18. Movement of end point of a B-spline curve with fixed control segment""" + [Line_1, Line_2, Line_3, Line_4] = self.mySpline.controlPolygon( + auxiliary=[0, 1, 2, 3] + ) + model.do() + + self.mySketch.setFixed(Line_1.defaultResult()) + self.myDOF -= 4 + model.do() + + newPoles = self.myPoles + + newPoles[-1].setX(newPoles[-1].x() + 20.0) + newPoles[-1].setY(newPoles[-1].y() + 10.0) + self.mySketch.move(self.mySpline.endPoint(), newPoles[-1]) + model.do() + + self.checkPoles(self.mySpline, newPoles) + + def test_move_pole_of_free_bspline(self): + """Test 19. Movement of a pole of a B-spline curve""" + [Point_1, Point_2, Point_3, Point_4, Point_5] = self.mySpline.controlPoles( + auxiliary=[0, 1, 2, 3, 4] + ) + [Line_1, Line_2, Line_3, Line_4] = self.mySpline.controlPolygon( + auxiliary=[0, 1, 2, 3] + ) + model.do() + + newPoles = self.myPoles + + newPoles[2].setX(newPoles[2].x() + 20.0) + newPoles[2].setY(newPoles[2].y() + 20.0) + self.mySketch.move(SketchAPI_Point(Point_3).coordinates(), newPoles[2]) + model.do() + + self.checkPoles(self.mySpline, newPoles) + + def test_move_segment_of_free_bspline(self): + """Test 20. Movement of a control segment of a B-spline curve""" + [Point_1, Point_2, Point_3, Point_4, Point_5] = self.mySpline.controlPoles( + auxiliary=[0, 1, 2, 3, 4] + ) + [Line_1, Line_2, Line_3, Line_4] = self.mySpline.controlPolygon( + auxiliary=[0, 1, 2, 3] + ) + model.do() + + oldPosition = GeomAPI_Pnt2d( + 0.5 * (self.myPoles[2].x() + self.myPoles[3].x()), + 0.5 * (self.myPoles[2].y() + self.myPoles[3].y()), + ) + newPosition = GeomAPI_Pnt2d(120.0, 90.0) + self.mySketch.move(SketchAPI_Line(Line_3).defaultResult(), newPosition) + model.do() + + dx = newPosition.x() - oldPosition.x() + dy = newPosition.y() - oldPosition.y() + + newPoles = self.myPoles + newPoles[2].setX(newPoles[2].x() + dx) + newPoles[2].setY(newPoles[2].y() + dy) + newPoles[3].setX(newPoles[3].x() + dx) + newPoles[3].setY(newPoles[3].y() + dy) + + self.checkPoles(self.mySpline, newPoles) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestMoveBSplinePeriodic.py b/src/SketchPlugin/Test/TestMoveBSplinePeriodic.py index 411e3ef2f..0c8541f6a 100644 --- a/src/SketchPlugin/Test/TestMoveBSplinePeriodic.py +++ b/src/SketchPlugin/Test/TestMoveBSplinePeriodic.py @@ -30,173 +30,178 @@ from salome.shaper import model __updated__ = "2020-01-20" -class TestMoveBSpline(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myPoles = [GeomAPI_Pnt2d(20., 50.), - GeomAPI_Pnt2d(70., 70.), - GeomAPI_Pnt2d(80., 30.), - GeomAPI_Pnt2d(50., -10.), - GeomAPI_Pnt2d(90., -30.)] - self.mySpline = self.mySketch.addSpline(poles = self.myPoles, periodic = True) - self.myDOF = len(self.myPoles) * 2 - model.do() - self.checkDOF() - - def tearDown(self): - self.checkDOF() - model.end() - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkPointCoordinates(self, thePoint, theCoordinates): - aCoord = [] - if issubclass(type(theCoordinates), GeomAPI_Pnt2d): - aCoord = [theCoordinates.x(), theCoordinates.y()] - else: - aCoord = theCoordinates - DIGITS = 7 - math.floor(math.log10(math.hypot(aCoord[0], aCoord[1]))) - self.assertAlmostEqual(thePoint.x(), aCoord[0], DIGITS) - self.assertAlmostEqual(thePoint.y(), aCoord[1], DIGITS) - - def checkPoles(self, theBSpline, theCoordinates): - poles = theBSpline.poles() - for index, point in zip(range(0, len(theCoordinates)), theCoordinates): - self.checkPointCoordinates(poles.pnt(index), point) - - def fixPoint(self, thePoint): - self.mySketch.setFixed(thePoint) - self.myDOF -= 2 - model.do() - self.checkDOF() - - - def test_move_free_bspline(self): - """ Test 1. Movement of a free B-spline dragging the edge - """ - oldPosition = GeomAPI_Edge(self.mySpline.defaultResult().shape()).middlePoint() - newPosition = GeomAPI_Pnt2d(120., 90.) - self.mySketch.move(self.mySpline.defaultResult(), newPosition) - model.do() - - # plane is XOY, no need to project oldPosition point - dx = newPosition.x() - oldPosition.x() - dy = newPosition.y() - oldPosition.y() - - newPoles = [] - for pole in self.myPoles: - newPoles.append(GeomAPI_Pnt2d(pole.x() + dx, pole.y() + dy)) - self.checkPoles(self.mySpline, newPoles) - - - def test_move_fixed_bspline(self): - """ Test 2. Movement of a fully fixed B-spline - """ - self.mySketch.setFixed(self.mySpline.defaultResult()) - self.myDOF = 0 - model.do() - - newPosition = GeomAPI_Pnt2d(120., 90.) - self.mySketch.move(self.mySpline.defaultResult(), newPosition) - model.do() - - self.checkPoles(self.mySpline, self.myPoles) - - - def test_move_bspline_with_fixed_pole(self): - """ Test 3. Movement of a B-spline curve with fixed pole - """ - [Point_1, Point_2, Point_3, Point_4, Point_5] = self.mySpline.controlPoles(auxiliary = [0, 1, 2, 3, 4]) - model.do() - - self.fixPoint(Point_2.defaultResult()) - model.do() - - oldPosition = GeomAPI_Edge(self.mySpline.defaultResult().shape()).middlePoint() - newPosition = GeomAPI_Pnt2d(120., 90.) - self.mySketch.move(self.mySpline.defaultResult(), newPosition) - model.do() - - # plane is XOY, no need to project oldPosition point - dx = newPosition.x() - oldPosition.x() - dy = newPosition.y() - oldPosition.y() - - newPoles = [] - for pole in self.myPoles: - newPoles.append(GeomAPI_Pnt2d(pole.x() + dx, pole.y() + dy)) - newPoles[1].setX(newPoles[1].x() - dx) - newPoles[1].setY(newPoles[1].y() - dy) - self.checkPoles(self.mySpline, newPoles) - - - def test_move_bspline_with_fixed_segment(self): - """ Test 4. Movement of a B-spline curve with fixed control segment - """ - [Line_1, Line_2, Line_3, Line_4, Line_5] = self.mySpline.controlPolygon(auxiliary = [0, 1, 2, 3, 4]) - model.do() - - self.mySketch.setFixed(Line_1.defaultResult()) - self.myDOF -= 4 - model.do() - - oldPosition = GeomAPI_Edge(self.mySpline.defaultResult().shape()).middlePoint() - newPosition = GeomAPI_Pnt2d(120., 90.) - self.mySketch.move(self.mySpline.defaultResult(), newPosition) - model.do() - - # plane is XOY, no need to project oldPosition point - dx = newPosition.x() - oldPosition.x() - dy = newPosition.y() - oldPosition.y() - - newPoles = [self.myPoles[0], self.myPoles[1]] - for pole in self.myPoles[2:]: - newPoles.append(GeomAPI_Pnt2d(pole.x() + dx, pole.y() + dy)) - self.checkPoles(self.mySpline, newPoles) - - - def test_move_pole_of_free_bspline(self): - """ Test 5. Movement of a pole of a B-spline curve - """ - [Point_1, Point_2, Point_3, Point_4, Point_5] = self.mySpline.controlPoles(auxiliary = [0, 1, 2, 3, 4]) - [Line_1, Line_2, Line_3, Line_4, Line_5] = self.mySpline.controlPolygon(auxiliary = [0, 1, 2, 3, 4]) - model.do() - - newPoles = self.myPoles - - newPoles[2].setX(newPoles[2].x() + 20.) - newPoles[2].setY(newPoles[2].y() + 20.) - self.mySketch.move(SketchAPI_Point(Point_3).coordinates(), newPoles[2]) - model.do() - - self.checkPoles(self.mySpline, newPoles) - - def test_move_segment_of_free_bspline(self): - """ Test 6. Movement of a control segment of a B-spline curve - """ - [Point_1, Point_2, Point_3, Point_4, Point_5] = self.mySpline.controlPoles(auxiliary = [0, 1, 2, 3, 4]) - [Line_1, Line_2, Line_3, Line_4, Line_5] = self.mySpline.controlPolygon(auxiliary = [0, 1, 2, 3, 4]) - model.do() - - oldPosition = GeomAPI_Pnt2d(0.5 * (self.myPoles[2].x() + self.myPoles[3].x()), - 0.5 * (self.myPoles[2].y() + self.myPoles[3].y())) - newPosition = GeomAPI_Pnt2d(120., 90.) - self.mySketch.move(SketchAPI_Line(Line_3).defaultResult(), newPosition) - model.do() - - dx = newPosition.x() - oldPosition.x() - dy = newPosition.y() - oldPosition.y() - - newPoles = self.myPoles - newPoles[2].setX(newPoles[2].x() + dx) - newPoles[2].setY(newPoles[2].y() + dy) - newPoles[3].setX(newPoles[3].x() + dx) - newPoles[3].setY(newPoles[3].y() + dy) - - self.checkPoles(self.mySpline, newPoles) +class TestMoveBSpline(unittest.TestCase): + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myPoles = [ + GeomAPI_Pnt2d(20.0, 50.0), + GeomAPI_Pnt2d(70.0, 70.0), + GeomAPI_Pnt2d(80.0, 30.0), + GeomAPI_Pnt2d(50.0, -10.0), + GeomAPI_Pnt2d(90.0, -30.0), + ] + self.mySpline = self.mySketch.addSpline(poles=self.myPoles, periodic=True) + self.myDOF = len(self.myPoles) * 2 + model.do() + self.checkDOF() + + def tearDown(self): + self.checkDOF() + model.end() + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointCoordinates(self, thePoint, theCoordinates): + aCoord = [] + if issubclass(type(theCoordinates), GeomAPI_Pnt2d): + aCoord = [theCoordinates.x(), theCoordinates.y()] + else: + aCoord = theCoordinates + DIGITS = 7 - math.floor(math.log10(math.hypot(aCoord[0], aCoord[1]))) + self.assertAlmostEqual(thePoint.x(), aCoord[0], DIGITS) + self.assertAlmostEqual(thePoint.y(), aCoord[1], DIGITS) + + def checkPoles(self, theBSpline, theCoordinates): + poles = theBSpline.poles() + for index, point in zip(range(0, len(theCoordinates)), theCoordinates): + self.checkPointCoordinates(poles.pnt(index), point) + + def fixPoint(self, thePoint): + self.mySketch.setFixed(thePoint) + self.myDOF -= 2 + model.do() + self.checkDOF() + + def test_move_free_bspline(self): + """Test 1. Movement of a free B-spline dragging the edge""" + oldPosition = GeomAPI_Edge(self.mySpline.defaultResult().shape()).middlePoint() + newPosition = GeomAPI_Pnt2d(120.0, 90.0) + self.mySketch.move(self.mySpline.defaultResult(), newPosition) + model.do() + + # plane is XOY, no need to project oldPosition point + dx = newPosition.x() - oldPosition.x() + dy = newPosition.y() - oldPosition.y() + + newPoles = [] + for pole in self.myPoles: + newPoles.append(GeomAPI_Pnt2d(pole.x() + dx, pole.y() + dy)) + self.checkPoles(self.mySpline, newPoles) + + def test_move_fixed_bspline(self): + """Test 2. Movement of a fully fixed B-spline""" + self.mySketch.setFixed(self.mySpline.defaultResult()) + self.myDOF = 0 + model.do() + + newPosition = GeomAPI_Pnt2d(120.0, 90.0) + self.mySketch.move(self.mySpline.defaultResult(), newPosition) + model.do() + + self.checkPoles(self.mySpline, self.myPoles) + + def test_move_bspline_with_fixed_pole(self): + """Test 3. Movement of a B-spline curve with fixed pole""" + [Point_1, Point_2, Point_3, Point_4, Point_5] = self.mySpline.controlPoles( + auxiliary=[0, 1, 2, 3, 4] + ) + model.do() + + self.fixPoint(Point_2.defaultResult()) + model.do() + + oldPosition = GeomAPI_Edge(self.mySpline.defaultResult().shape()).middlePoint() + newPosition = GeomAPI_Pnt2d(120.0, 90.0) + self.mySketch.move(self.mySpline.defaultResult(), newPosition) + model.do() + + # plane is XOY, no need to project oldPosition point + dx = newPosition.x() - oldPosition.x() + dy = newPosition.y() - oldPosition.y() + + newPoles = [] + for pole in self.myPoles: + newPoles.append(GeomAPI_Pnt2d(pole.x() + dx, pole.y() + dy)) + newPoles[1].setX(newPoles[1].x() - dx) + newPoles[1].setY(newPoles[1].y() - dy) + self.checkPoles(self.mySpline, newPoles) + + def test_move_bspline_with_fixed_segment(self): + """Test 4. Movement of a B-spline curve with fixed control segment""" + [Line_1, Line_2, Line_3, Line_4, Line_5] = self.mySpline.controlPolygon( + auxiliary=[0, 1, 2, 3, 4] + ) + model.do() + + self.mySketch.setFixed(Line_1.defaultResult()) + self.myDOF -= 4 + model.do() + + oldPosition = GeomAPI_Edge(self.mySpline.defaultResult().shape()).middlePoint() + newPosition = GeomAPI_Pnt2d(120.0, 90.0) + self.mySketch.move(self.mySpline.defaultResult(), newPosition) + model.do() + + # plane is XOY, no need to project oldPosition point + dx = newPosition.x() - oldPosition.x() + dy = newPosition.y() - oldPosition.y() + + newPoles = [self.myPoles[0], self.myPoles[1]] + for pole in self.myPoles[2:]: + newPoles.append(GeomAPI_Pnt2d(pole.x() + dx, pole.y() + dy)) + self.checkPoles(self.mySpline, newPoles) + + def test_move_pole_of_free_bspline(self): + """Test 5. Movement of a pole of a B-spline curve""" + [Point_1, Point_2, Point_3, Point_4, Point_5] = self.mySpline.controlPoles( + auxiliary=[0, 1, 2, 3, 4] + ) + [Line_1, Line_2, Line_3, Line_4, Line_5] = self.mySpline.controlPolygon( + auxiliary=[0, 1, 2, 3, 4] + ) + model.do() + + newPoles = self.myPoles + + newPoles[2].setX(newPoles[2].x() + 20.0) + newPoles[2].setY(newPoles[2].y() + 20.0) + self.mySketch.move(SketchAPI_Point(Point_3).coordinates(), newPoles[2]) + model.do() + + self.checkPoles(self.mySpline, newPoles) + + def test_move_segment_of_free_bspline(self): + """Test 6. Movement of a control segment of a B-spline curve""" + [Point_1, Point_2, Point_3, Point_4, Point_5] = self.mySpline.controlPoles( + auxiliary=[0, 1, 2, 3, 4] + ) + [Line_1, Line_2, Line_3, Line_4, Line_5] = self.mySpline.controlPolygon( + auxiliary=[0, 1, 2, 3, 4] + ) + model.do() + + oldPosition = GeomAPI_Pnt2d( + 0.5 * (self.myPoles[2].x() + self.myPoles[3].x()), + 0.5 * (self.myPoles[2].y() + self.myPoles[3].y()), + ) + newPosition = GeomAPI_Pnt2d(120.0, 90.0) + self.mySketch.move(SketchAPI_Line(Line_3).defaultResult(), newPosition) + model.do() + + dx = newPosition.x() - oldPosition.x() + dy = newPosition.y() - oldPosition.y() + + newPoles = self.myPoles + newPoles[2].setX(newPoles[2].x() + dx) + newPoles[2].setY(newPoles[2].y() + dy) + newPoles[3].setX(newPoles[3].x() + dx) + newPoles[3].setY(newPoles[3].y() + dy) + + self.checkPoles(self.mySpline, newPoles) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestMoveCircle.py b/src/SketchPlugin/Test/TestMoveCircle.py index b48900e2b..120190fd0 100644 --- a/src/SketchPlugin/Test/TestMoveCircle.py +++ b/src/SketchPlugin/Test/TestMoveCircle.py @@ -27,121 +27,127 @@ from salome.shaper import model __updated__ = "2017-05-11" + class TestMoveCircle(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myCenter = [70., 50.] - self.myRadius = 20. - self.myCircle = self.mySketch.addCircle(self.myCenter[0], self.myCenter[1], self.myRadius) - self.myDOF = 3 - model.do() - self.checkDOF() - - def tearDown(self): - self.checkDOF() - model.end() - assert(model.checkPythonDump()) - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkPointCoordinates(self, thePoint, theCoordinates): - self.assertAlmostEqual(thePoint.x(), theCoordinates[0]) - self.assertAlmostEqual(thePoint.y(), theCoordinates[1]) - - def checkPointOnCircle(self, theCoordinates): - self.assertAlmostEqual(model.distancePointPoint(self.myCircle.center(), theCoordinates), self.myCircle.radius().value()) - - def fixCircleRadius(self): - self.mySketch.setRadius(self.myCircle.results()[1], self.myRadius) - self.myDOF -= 1 - model.do() - self.checkDOF() - - def fixCircleCenter(self): - self.mySketch.setFixed(self.myCircle.center()) - self.myDOF -= 2 - model.do() - self.checkDOF() - - - def test_move_center_free_circle(self): - """ Test 1. Movement of central point of a free circle - """ - newPosition = [self.myCenter[0] + 20., self.myCenter[1] + 10.] - self.mySketch.move(self.myCircle.center(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myCircle.center(), newPosition) - self.assertAlmostEqual(self.myCircle.radius().value(), self.myRadius) - - def test_move_free_circle(self): - """ Test 2. Movement of a free circle dragging the edge - """ - newPosition = [120., 90.] - self.mySketch.move(self.myCircle.defaultResult(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myCircle.center(), self.myCenter) - self.checkPointOnCircle(newPosition) - self.assertNotEqual(self.myCircle.radius().value(), self.myRadius) - - def test_move_center_circle_fixed_radius(self): - """ Test 3. Movement of central point of a circle with fixed radius - """ - self.fixCircleRadius() - - newPosition = [self.myCenter[0] + 20., self.myCenter[1] + 10.] - self.mySketch.move(self.myCircle.center(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myCircle.center(), newPosition) - self.assertAlmostEqual(self.myCircle.radius().value(), self.myRadius) - - def test_move_circle_fixed_radius(self): - """ Test 4. Movement of a circle with fixed radius - """ - self.fixCircleRadius() - - newPosition = [120., 90.] - self.mySketch.move(self.myCircle.defaultResult(), newPosition[0], newPosition[1]) - model.do() - self.assertAlmostEqual(self.myCircle.radius().value(), self.myRadius) - self.assertNotEqual(self.myCircle.center().x(), self.myCenter[0]) - self.assertNotEqual(self.myCircle.center().y(), self.myCenter[1]) - - def test_move_center_circle_fixed_center(self): - """ Test 5. Movement of central point of a circle with fixed center (nothing should be changed) - """ - self.fixCircleCenter() - - newPosition = [self.myCenter[0] + 20., self.myCenter[1] + 10.] - self.mySketch.move(self.myCircle.center(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myCircle.center(), self.myCenter) - self.assertAlmostEqual(self.myCircle.radius().value(), self.myRadius) - - def test_move_circle_fixed_center(self): - """ Test 6. Movement of a circle with fixed center - """ - self.fixCircleCenter() - - newPosition = [120., 90.] - self.mySketch.move(self.myCircle.defaultResult(), newPosition[0], newPosition[1]) - model.do() - self.checkPointOnCircle(newPosition) - self.assertNotEqual(self.myCircle.radius().value(), self.myRadius) - - def test_move_fixed_circle(self): - """ Test 7. Trying to move fully fixed circle - """ - self.fixCircleCenter() - self.fixCircleRadius() - - newPosition = [120., 90.] - self.mySketch.move(self.myCircle.defaultResult(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myCircle.center(), self.myCenter) - self.assertAlmostEqual(self.myCircle.radius().value(), self.myRadius) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myCenter = [70.0, 50.0] + self.myRadius = 20.0 + self.myCircle = self.mySketch.addCircle( + self.myCenter[0], self.myCenter[1], self.myRadius + ) + self.myDOF = 3 + model.do() + self.checkDOF() + + def tearDown(self): + self.checkDOF() + model.end() + assert model.checkPythonDump() + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointCoordinates(self, thePoint, theCoordinates): + self.assertAlmostEqual(thePoint.x(), theCoordinates[0]) + self.assertAlmostEqual(thePoint.y(), theCoordinates[1]) + + def checkPointOnCircle(self, theCoordinates): + self.assertAlmostEqual( + model.distancePointPoint(self.myCircle.center(), theCoordinates), + self.myCircle.radius().value(), + ) + + def fixCircleRadius(self): + self.mySketch.setRadius(self.myCircle.results()[1], self.myRadius) + self.myDOF -= 1 + model.do() + self.checkDOF() + + def fixCircleCenter(self): + self.mySketch.setFixed(self.myCircle.center()) + self.myDOF -= 2 + model.do() + self.checkDOF() + + def test_move_center_free_circle(self): + """Test 1. Movement of central point of a free circle""" + newPosition = [self.myCenter[0] + 20.0, self.myCenter[1] + 10.0] + self.mySketch.move(self.myCircle.center(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myCircle.center(), newPosition) + self.assertAlmostEqual(self.myCircle.radius().value(), self.myRadius) + + def test_move_free_circle(self): + """Test 2. Movement of a free circle dragging the edge""" + newPosition = [120.0, 90.0] + self.mySketch.move( + self.myCircle.defaultResult(), newPosition[0], newPosition[1] + ) + model.do() + self.checkPointCoordinates(self.myCircle.center(), self.myCenter) + self.checkPointOnCircle(newPosition) + self.assertNotEqual(self.myCircle.radius().value(), self.myRadius) + + def test_move_center_circle_fixed_radius(self): + """Test 3. Movement of central point of a circle with fixed radius""" + self.fixCircleRadius() + + newPosition = [self.myCenter[0] + 20.0, self.myCenter[1] + 10.0] + self.mySketch.move(self.myCircle.center(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myCircle.center(), newPosition) + self.assertAlmostEqual(self.myCircle.radius().value(), self.myRadius) + + def test_move_circle_fixed_radius(self): + """Test 4. Movement of a circle with fixed radius""" + self.fixCircleRadius() + + newPosition = [120.0, 90.0] + self.mySketch.move( + self.myCircle.defaultResult(), newPosition[0], newPosition[1] + ) + model.do() + self.assertAlmostEqual(self.myCircle.radius().value(), self.myRadius) + self.assertNotEqual(self.myCircle.center().x(), self.myCenter[0]) + self.assertNotEqual(self.myCircle.center().y(), self.myCenter[1]) + + def test_move_center_circle_fixed_center(self): + """Test 5. Movement of central point of a circle with fixed center (nothing should be changed)""" + self.fixCircleCenter() + + newPosition = [self.myCenter[0] + 20.0, self.myCenter[1] + 10.0] + self.mySketch.move(self.myCircle.center(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myCircle.center(), self.myCenter) + self.assertAlmostEqual(self.myCircle.radius().value(), self.myRadius) + + def test_move_circle_fixed_center(self): + """Test 6. Movement of a circle with fixed center""" + self.fixCircleCenter() + + newPosition = [120.0, 90.0] + self.mySketch.move( + self.myCircle.defaultResult(), newPosition[0], newPosition[1] + ) + model.do() + self.checkPointOnCircle(newPosition) + self.assertNotEqual(self.myCircle.radius().value(), self.myRadius) + + def test_move_fixed_circle(self): + """Test 7. Trying to move fully fixed circle""" + self.fixCircleCenter() + self.fixCircleRadius() + + newPosition = [120.0, 90.0] + self.mySketch.move( + self.myCircle.defaultResult(), newPosition[0], newPosition[1] + ) + model.do() + self.checkPointCoordinates(self.myCircle.center(), self.myCenter) + self.assertAlmostEqual(self.myCircle.radius().value(), self.myRadius) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestMoveEllipse.py b/src/SketchPlugin/Test/TestMoveEllipse.py index 320b6e398..a24bce802 100644 --- a/src/SketchPlugin/Test/TestMoveEllipse.py +++ b/src/SketchPlugin/Test/TestMoveEllipse.py @@ -29,210 +29,286 @@ from salome.shaper import model __updated__ = "2019-09-12" + class TestMoveEllipse(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myCenter = [70., 50.] - self.myFocus = [100., 70.] - self.myMinorRadius = 20. - self.myEllipse = self.mySketch.addEllipse(self.myCenter[0], self.myCenter[1], self.myFocus[0], self.myFocus[1], self.myMinorRadius) - self.myDOF = 5 - model.do() - self.checkDOF() - self.myMajorRadius = self.myEllipse.majorRadius().value() - self.NB_DIGITS_RADIUS = 7 - math.floor(math.log10(self.myMinorRadius)) - - def tearDown(self): - self.checkDOF() - model.end() - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkPointCoordinates(self, thePoint, theCoordinates): - aCoord = [] - if issubclass(type(theCoordinates), GeomAPI_Pnt2d): - aCoord = [theCoordinates.x(), theCoordinates.y()] - else: - aCoord = theCoordinates - DIGITS = 7 - math.floor(math.log10(math.hypot(aCoord[0], aCoord[1]))) - self.assertAlmostEqual(thePoint.x(), aCoord[0], DIGITS) - self.assertAlmostEqual(thePoint.y(), aCoord[1], DIGITS) - - def checkPointOnEllipse(self, theCoordinates, theEllipse): - point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) - firstFocus2d = GeomAPI_Pnt2d(theEllipse.firstFocus().x(), theEllipse.firstFocus().y()) - distPF1 = model.distancePointPoint(firstFocus2d, point) - secondFocus2d = GeomAPI_Pnt2d(theEllipse.secondFocus().x(), theEllipse.secondFocus().y()) - distPF2 = model.distancePointPoint(secondFocus2d, point) - self.assertAlmostEqual(distPF1 + distPF2, 2.0 * theEllipse.majorRadius().value(), 7 - math.floor(math.log10(2.0 * theEllipse.majorRadius().value()))) - - def fixMajorRadius(self): - self.mySketch.setDistance(self.myEllipse.center(), self.myEllipse.majorAxisPositive(), self.myMajorRadius) - self.myDOF -= 1 - model.do() - self.checkDOF() - - def fixMinorRadius(self): - self.mySketch.setDistance(self.myEllipse.center(), self.myEllipse.minorAxisPositive(), self.myMinorRadius) - self.myDOF -= 1 - model.do() - self.checkDOF() - - def fixPoint(self, thePoint): - self.mySketch.setFixed(thePoint) - self.myDOF -= 2 - model.do() - self.checkDOF() - - - def test_move_center_free_ellipse(self): - """ Test 1. Movement of central point of a free ellipse - """ - newPosition = [self.myCenter[0] + 20., self.myCenter[1] + 10.] - self.mySketch.move(self.myEllipse.center(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myEllipse.center(), newPosition) - self.assertAlmostEqual(self.myEllipse.minorRadius().value(), self.myMinorRadius, self.NB_DIGITS_RADIUS) - self.assertAlmostEqual(self.myEllipse.majorRadius().value(), self.myMajorRadius, self.NB_DIGITS_RADIUS) - - def test_move_free_ellipse(self): - """ Test 2. Movement of a free ellipse dragging the edge - """ - newPosition = GeomAPI_Pnt2d(120., 90.) - self.mySketch.move(self.myEllipse.defaultResult(), newPosition.x(), newPosition.y()) - model.do() - self.checkPointCoordinates(self.myEllipse.center(), self.myCenter) - self.checkPointOnEllipse(newPosition, self.myEllipse) - self.assertNotEqual(self.myEllipse.minorRadius().value(), self.myMinorRadius) - self.assertNotEqual(self.myEllipse.majorRadius().value(), self.myMajorRadius) - - def test_move_center_ellipse_fixed_major_radius(self): - """ Test 3. Movement of central point of ellipse with fixed major radius - """ - self.fixMajorRadius() - - newPosition = [self.myCenter[0] + 20., self.myCenter[1] + 10.] - self.mySketch.move(self.myEllipse.center(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myEllipse.center(), newPosition) - self.assertAlmostEqual(self.myEllipse.minorRadius().value(), self.myMinorRadius, self.NB_DIGITS_RADIUS) - self.assertAlmostEqual(self.myEllipse.majorRadius().value(), self.myMajorRadius, self.NB_DIGITS_RADIUS) - - def test_move_ellipse_fixed_major_radius(self): - """ Test 4. Movement of ellipse with fixed major radius - """ - self.fixMajorRadius() - - newPosition = GeomAPI_Pnt2d(80., 80.) - self.mySketch.move(self.myEllipse.defaultResult(), newPosition.x(), newPosition.y()) - model.do() - self.checkPointOnEllipse(newPosition, self.myEllipse) - self.assertNotEqual(self.myEllipse.minorRadius().value(), self.myMinorRadius) - self.assertAlmostEqual(self.myEllipse.majorRadius().value(), self.myMajorRadius, self.NB_DIGITS_RADIUS) - - def test_move_center_ellipse_fixed_minor_radius(self): - """ Test 5. Movement of central point of ellipse with fixed minor radius - """ - self.fixMinorRadius() - - newPosition = [self.myCenter[0] + 20., self.myCenter[1] + 10.] - self.mySketch.move(self.myEllipse.center(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myEllipse.center(), newPosition) - self.assertAlmostEqual(self.myEllipse.minorRadius().value(), self.myMinorRadius, self.NB_DIGITS_RADIUS) - self.assertAlmostEqual(self.myEllipse.majorRadius().value(), self.myMajorRadius, self.NB_DIGITS_RADIUS) - - def test_move_ellipse_fixed_minor_radius(self): - """ Test 6. Movement of ellipse with fixed minor radius - """ - self.fixMinorRadius() - - newPosition = GeomAPI_Pnt2d(120., 90.) - self.mySketch.move(self.myEllipse.defaultResult(), newPosition.x(), newPosition.y()) - model.do() - self.checkPointOnEllipse(newPosition, self.myEllipse) - self.assertAlmostEqual(self.myEllipse.minorRadius().value(), self.myMinorRadius, self.NB_DIGITS_RADIUS) - self.assertNotEqual(self.myEllipse.majorRadius().value(), self.myMajorRadius) - - def test_move_center_ellipse_fixed_center(self): - """ Test 7. Movement of central point of ellipse with fixed center (nothing should be changed) - """ - self.fixPoint(self.myEllipse.center()) - - newPosition = [self.myCenter[0] + 20., self.myCenter[1] + 10.] - self.mySketch.move(self.myEllipse.center(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myEllipse.center(), self.myCenter) - self.assertAlmostEqual(self.myEllipse.minorRadius().value(), self.myMinorRadius, self.NB_DIGITS_RADIUS) - self.assertAlmostEqual(self.myEllipse.majorRadius().value(), self.myMajorRadius, self.NB_DIGITS_RADIUS) - - def test_move_ellipse_fixed_center(self): - """ Test 8. Movement of ellipse with fixed center - """ - self.fixPoint(self.myEllipse.center()) - - newPosition = GeomAPI_Pnt2d(120., 90.) - self.mySketch.move(self.myEllipse.defaultResult(), newPosition.x(), newPosition.y()) - model.do() - self.checkPointOnEllipse(newPosition, self.myEllipse) - self.assertNotEqual(self.myEllipse.minorRadius().value(), self.myMinorRadius) - self.assertNotEqual(self.myEllipse.majorRadius().value(), self.myMajorRadius) - - def test_move_center_ellipse_fixed_focus(self): - """ Test 9. Movement of central point of ellipse with fixed focus - """ - self.fixPoint(self.myEllipse.firstFocus()) - - newPosition = GeomAPI_Pnt2d(self.myCenter[0] + 20., self.myCenter[1] + 10.) - self.mySketch.move(self.myEllipse.center(), newPosition.x(), newPosition.y()) - model.do() - self.checkPointCoordinates(self.myEllipse.center(), newPosition) - self.checkPointCoordinates(self.myEllipse.firstFocus(), self.myFocus) - self.assertNotEqual(self.myEllipse.minorRadius().value(), self.myMinorRadius) - self.assertNotEqual(self.myEllipse.majorRadius().value(), self.myMajorRadius) - - def test_move_focus_ellipse_fixed_focus(self): - """ Test 10. Movement of a focus point of ellipse with fixed focus (nothing should be changed) - """ - self.fixPoint(self.myEllipse.firstFocus()) - - newPosition = GeomAPI_Pnt2d(self.myFocus[0] + 10., self.myFocus[1] + 10.) - self.mySketch.move(self.myEllipse.firstFocus(), newPosition.x(), newPosition.y()) - model.do() - self.checkPointCoordinates(self.myEllipse.firstFocus(), self.myFocus) - self.assertAlmostEqual(self.myEllipse.minorRadius().value(), self.myMinorRadius, self.NB_DIGITS_RADIUS) - self.assertAlmostEqual(self.myEllipse.majorRadius().value(), self.myMajorRadius, self.NB_DIGITS_RADIUS) - - def test_move_ellipse_fixed_focus(self): - """ Test 11. Movement of ellipse with fixed focus - """ - self.fixPoint(self.myEllipse.firstFocus()) - - newPosition = GeomAPI_Pnt2d(80., 90.) - self.mySketch.move(self.myEllipse.defaultResult(), newPosition.x(), newPosition.y()) - model.do() - self.checkPointOnEllipse(newPosition, self.myEllipse) - self.checkPointCoordinates(self.myEllipse.firstFocus(), self.myFocus) - self.assertNotEqual(self.myEllipse.minorRadius().value(), self.myMinorRadius) - self.assertNotEqual(self.myEllipse.majorRadius().value(), self.myMajorRadius) - - def test_move_fixed_ellipse(self): - """ Test 12. Trying to move fully fixed ellipse - """ - self.mySketch.setFixed(self.myEllipse.results()[-1]) - self.myDOF -= 5 - model.do() - self.checkDOF() - - newPosition = [120., 90.] - self.mySketch.move(self.myEllipse.defaultResult(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myEllipse.center(), self.myCenter) - self.checkPointCoordinates(self.myEllipse.firstFocus(), self.myFocus) - self.assertAlmostEqual(self.myEllipse.minorRadius().value(), self.myMinorRadius, self.NB_DIGITS_RADIUS) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myCenter = [70.0, 50.0] + self.myFocus = [100.0, 70.0] + self.myMinorRadius = 20.0 + self.myEllipse = self.mySketch.addEllipse( + self.myCenter[0], + self.myCenter[1], + self.myFocus[0], + self.myFocus[1], + self.myMinorRadius, + ) + self.myDOF = 5 + model.do() + self.checkDOF() + self.myMajorRadius = self.myEllipse.majorRadius().value() + self.NB_DIGITS_RADIUS = 7 - math.floor(math.log10(self.myMinorRadius)) + + def tearDown(self): + self.checkDOF() + model.end() + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointCoordinates(self, thePoint, theCoordinates): + aCoord = [] + if issubclass(type(theCoordinates), GeomAPI_Pnt2d): + aCoord = [theCoordinates.x(), theCoordinates.y()] + else: + aCoord = theCoordinates + DIGITS = 7 - math.floor(math.log10(math.hypot(aCoord[0], aCoord[1]))) + self.assertAlmostEqual(thePoint.x(), aCoord[0], DIGITS) + self.assertAlmostEqual(thePoint.y(), aCoord[1], DIGITS) + + def checkPointOnEllipse(self, theCoordinates, theEllipse): + point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) + firstFocus2d = GeomAPI_Pnt2d( + theEllipse.firstFocus().x(), theEllipse.firstFocus().y() + ) + distPF1 = model.distancePointPoint(firstFocus2d, point) + secondFocus2d = GeomAPI_Pnt2d( + theEllipse.secondFocus().x(), theEllipse.secondFocus().y() + ) + distPF2 = model.distancePointPoint(secondFocus2d, point) + self.assertAlmostEqual( + distPF1 + distPF2, + 2.0 * theEllipse.majorRadius().value(), + 7 - math.floor(math.log10(2.0 * theEllipse.majorRadius().value())), + ) + + def fixMajorRadius(self): + self.mySketch.setDistance( + self.myEllipse.center(), + self.myEllipse.majorAxisPositive(), + self.myMajorRadius, + ) + self.myDOF -= 1 + model.do() + self.checkDOF() + + def fixMinorRadius(self): + self.mySketch.setDistance( + self.myEllipse.center(), + self.myEllipse.minorAxisPositive(), + self.myMinorRadius, + ) + self.myDOF -= 1 + model.do() + self.checkDOF() + + def fixPoint(self, thePoint): + self.mySketch.setFixed(thePoint) + self.myDOF -= 2 + model.do() + self.checkDOF() + + def test_move_center_free_ellipse(self): + """Test 1. Movement of central point of a free ellipse""" + newPosition = [self.myCenter[0] + 20.0, self.myCenter[1] + 10.0] + self.mySketch.move(self.myEllipse.center(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myEllipse.center(), newPosition) + self.assertAlmostEqual( + self.myEllipse.minorRadius().value(), + self.myMinorRadius, + self.NB_DIGITS_RADIUS, + ) + self.assertAlmostEqual( + self.myEllipse.majorRadius().value(), + self.myMajorRadius, + self.NB_DIGITS_RADIUS, + ) + + def test_move_free_ellipse(self): + """Test 2. Movement of a free ellipse dragging the edge""" + newPosition = GeomAPI_Pnt2d(120.0, 90.0) + self.mySketch.move( + self.myEllipse.defaultResult(), newPosition.x(), newPosition.y() + ) + model.do() + self.checkPointCoordinates(self.myEllipse.center(), self.myCenter) + self.checkPointOnEllipse(newPosition, self.myEllipse) + self.assertNotEqual(self.myEllipse.minorRadius().value(), self.myMinorRadius) + self.assertNotEqual(self.myEllipse.majorRadius().value(), self.myMajorRadius) + + def test_move_center_ellipse_fixed_major_radius(self): + """Test 3. Movement of central point of ellipse with fixed major radius""" + self.fixMajorRadius() + + newPosition = [self.myCenter[0] + 20.0, self.myCenter[1] + 10.0] + self.mySketch.move(self.myEllipse.center(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myEllipse.center(), newPosition) + self.assertAlmostEqual( + self.myEllipse.minorRadius().value(), + self.myMinorRadius, + self.NB_DIGITS_RADIUS, + ) + self.assertAlmostEqual( + self.myEllipse.majorRadius().value(), + self.myMajorRadius, + self.NB_DIGITS_RADIUS, + ) + + def test_move_ellipse_fixed_major_radius(self): + """Test 4. Movement of ellipse with fixed major radius""" + self.fixMajorRadius() + + newPosition = GeomAPI_Pnt2d(80.0, 80.0) + self.mySketch.move( + self.myEllipse.defaultResult(), newPosition.x(), newPosition.y() + ) + model.do() + self.checkPointOnEllipse(newPosition, self.myEllipse) + self.assertNotEqual(self.myEllipse.minorRadius().value(), self.myMinorRadius) + self.assertAlmostEqual( + self.myEllipse.majorRadius().value(), + self.myMajorRadius, + self.NB_DIGITS_RADIUS, + ) + + def test_move_center_ellipse_fixed_minor_radius(self): + """Test 5. Movement of central point of ellipse with fixed minor radius""" + self.fixMinorRadius() + + newPosition = [self.myCenter[0] + 20.0, self.myCenter[1] + 10.0] + self.mySketch.move(self.myEllipse.center(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myEllipse.center(), newPosition) + self.assertAlmostEqual( + self.myEllipse.minorRadius().value(), + self.myMinorRadius, + self.NB_DIGITS_RADIUS, + ) + self.assertAlmostEqual( + self.myEllipse.majorRadius().value(), + self.myMajorRadius, + self.NB_DIGITS_RADIUS, + ) + + def test_move_ellipse_fixed_minor_radius(self): + """Test 6. Movement of ellipse with fixed minor radius""" + self.fixMinorRadius() + + newPosition = GeomAPI_Pnt2d(120.0, 90.0) + self.mySketch.move( + self.myEllipse.defaultResult(), newPosition.x(), newPosition.y() + ) + model.do() + self.checkPointOnEllipse(newPosition, self.myEllipse) + self.assertAlmostEqual( + self.myEllipse.minorRadius().value(), + self.myMinorRadius, + self.NB_DIGITS_RADIUS, + ) + self.assertNotEqual(self.myEllipse.majorRadius().value(), self.myMajorRadius) + + def test_move_center_ellipse_fixed_center(self): + """Test 7. Movement of central point of ellipse with fixed center (nothing should be changed)""" + self.fixPoint(self.myEllipse.center()) + + newPosition = [self.myCenter[0] + 20.0, self.myCenter[1] + 10.0] + self.mySketch.move(self.myEllipse.center(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myEllipse.center(), self.myCenter) + self.assertAlmostEqual( + self.myEllipse.minorRadius().value(), + self.myMinorRadius, + self.NB_DIGITS_RADIUS, + ) + self.assertAlmostEqual( + self.myEllipse.majorRadius().value(), + self.myMajorRadius, + self.NB_DIGITS_RADIUS, + ) + + def test_move_ellipse_fixed_center(self): + """Test 8. Movement of ellipse with fixed center""" + self.fixPoint(self.myEllipse.center()) + + newPosition = GeomAPI_Pnt2d(120.0, 90.0) + self.mySketch.move( + self.myEllipse.defaultResult(), newPosition.x(), newPosition.y() + ) + model.do() + self.checkPointOnEllipse(newPosition, self.myEllipse) + self.assertNotEqual(self.myEllipse.minorRadius().value(), self.myMinorRadius) + self.assertNotEqual(self.myEllipse.majorRadius().value(), self.myMajorRadius) + + def test_move_center_ellipse_fixed_focus(self): + """Test 9. Movement of central point of ellipse with fixed focus""" + self.fixPoint(self.myEllipse.firstFocus()) + + newPosition = GeomAPI_Pnt2d(self.myCenter[0] + 20.0, self.myCenter[1] + 10.0) + self.mySketch.move(self.myEllipse.center(), newPosition.x(), newPosition.y()) + model.do() + self.checkPointCoordinates(self.myEllipse.center(), newPosition) + self.checkPointCoordinates(self.myEllipse.firstFocus(), self.myFocus) + self.assertNotEqual(self.myEllipse.minorRadius().value(), self.myMinorRadius) + self.assertNotEqual(self.myEllipse.majorRadius().value(), self.myMajorRadius) + + def test_move_focus_ellipse_fixed_focus(self): + """Test 10. Movement of a focus point of ellipse with fixed focus (nothing should be changed)""" + self.fixPoint(self.myEllipse.firstFocus()) + + newPosition = GeomAPI_Pnt2d(self.myFocus[0] + 10.0, self.myFocus[1] + 10.0) + self.mySketch.move( + self.myEllipse.firstFocus(), newPosition.x(), newPosition.y() + ) + model.do() + self.checkPointCoordinates(self.myEllipse.firstFocus(), self.myFocus) + self.assertAlmostEqual( + self.myEllipse.minorRadius().value(), + self.myMinorRadius, + self.NB_DIGITS_RADIUS, + ) + self.assertAlmostEqual( + self.myEllipse.majorRadius().value(), + self.myMajorRadius, + self.NB_DIGITS_RADIUS, + ) + + def test_move_ellipse_fixed_focus(self): + """Test 11. Movement of ellipse with fixed focus""" + self.fixPoint(self.myEllipse.firstFocus()) + + newPosition = GeomAPI_Pnt2d(80.0, 90.0) + self.mySketch.move( + self.myEllipse.defaultResult(), newPosition.x(), newPosition.y() + ) + model.do() + self.checkPointOnEllipse(newPosition, self.myEllipse) + self.checkPointCoordinates(self.myEllipse.firstFocus(), self.myFocus) + self.assertNotEqual(self.myEllipse.minorRadius().value(), self.myMinorRadius) + self.assertNotEqual(self.myEllipse.majorRadius().value(), self.myMajorRadius) + + def test_move_fixed_ellipse(self): + """Test 12. Trying to move fully fixed ellipse""" + self.mySketch.setFixed(self.myEllipse.results()[-1]) + self.myDOF -= 5 + model.do() + self.checkDOF() + + newPosition = [120.0, 90.0] + self.mySketch.move( + self.myEllipse.defaultResult(), newPosition[0], newPosition[1] + ) + model.do() + self.checkPointCoordinates(self.myEllipse.center(), self.myCenter) + self.checkPointCoordinates(self.myEllipse.firstFocus(), self.myFocus) + self.assertAlmostEqual( + self.myEllipse.minorRadius().value(), + self.myMinorRadius, + self.NB_DIGITS_RADIUS, + ) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestMoveEllipticArc.py b/src/SketchPlugin/Test/TestMoveEllipticArc.py index dbe65e6b0..212410ffb 100644 --- a/src/SketchPlugin/Test/TestMoveEllipticArc.py +++ b/src/SketchPlugin/Test/TestMoveEllipticArc.py @@ -29,273 +29,362 @@ from salome.shaper import model __updated__ = "2019-10-15" + class TestMoveEllipticArc(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myCenter = GeomAPI_Pnt2d(70., 50.) - self.myAxisPoint = GeomAPI_Pnt2d(100., 70.) - self.myStartPoint = GeomAPI_Pnt2d(75., 75.) - self.myEndPoint = GeomAPI_Pnt2d(45., 55.) - macroEllipticArc = self.mySketch.addEllipticArc(self.myCenter, self.myAxisPoint, self.myStartPoint, self.myEndPoint, False) - self.myDOF = 7 - model.do() - self.checkDOF() - self.myEllipticArc = SketchAPI_EllipticArc(model.lastSubFeature(self.mySketch, "SketchEllipticArc")) - self.myMajorRadius = self.myEllipticArc.majorRadius().value() - self.myMinorRadius = self.myEllipticArc.minorRadius().value() - - def tearDown(self): - self.checkDOF() - self.checkPointOnEllipse(self.myEllipticArc.startPoint(), self.myEllipticArc) - self.checkPointOnEllipse(self.myEllipticArc.endPoint(), self.myEllipticArc) - model.end() - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkPointCoordinates(self, thePoint, theCoordinates): - aCoord = [] - if issubclass(type(theCoordinates), GeomAPI_Pnt2d): - aCoord = [theCoordinates.x(), theCoordinates.y()] - else: - aCoord = theCoordinates - DIGITS = 7 - math.ceil(math.log10(math.hypot(aCoord[0], aCoord[1]))) - self.assertAlmostEqual(thePoint.x(), aCoord[0], DIGITS) - self.assertAlmostEqual(thePoint.y(), aCoord[1], DIGITS) - - def checkPointOnEllipse(self, theCoordinates, theEllipticArc): - point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) - firstFocus2d = GeomAPI_Pnt2d(theEllipticArc.firstFocus().x(), theEllipticArc.firstFocus().y()) - distPF1 = model.distancePointPoint(firstFocus2d, point) - secondFocus2d = GeomAPI_Pnt2d(theEllipticArc.secondFocus().x(), theEllipticArc.secondFocus().y()) - distPF2 = model.distancePointPoint(secondFocus2d, point) - DIGITS = 7 - math.ceil(math.log10(theEllipticArc.majorRadius().value())) - self.assertAlmostEqual(distPF1 + distPF2, 2.0 * theEllipticArc.majorRadius().value(), DIGITS) - - def checkAlmostEqual(self, theValue1, theValue2): - DIGITS = 7 - math.ceil(math.log10(theValue1)) - self.assertAlmostEqual(theValue1, theValue2, DIGITS) - - def fixMajorRadius(self): - self.mySketch.setDistance(self.myEllipticArc.center(), self.myEllipticArc.majorAxisPositive(), self.myMajorRadius) - self.myDOF -= 1 - model.do() - self.checkDOF() - - def fixMinorRadius(self): - self.mySketch.setDistance(self.myEllipticArc.center(), self.myEllipticArc.minorAxisPositive(), self.myMinorRadius) - self.myDOF -= 1 - model.do() - self.checkDOF() - - def fixPoint(self, thePoint): - self.mySketch.setFixed(thePoint) - self.myDOF -= 2 - model.do() - self.checkDOF() - - - def test_move_center_free_ellipse(self): - """ Test 1. Movement of central point of a free elliptic arc - """ - newPosition = [self.myCenter.x() + 20., self.myCenter.y() + 10.] - self.mySketch.move(self.myEllipticArc.center(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myEllipticArc.center(), newPosition) - - def test_move_free_ellipse(self): - """ Test 2. Movement of a free ellipse dragging the edge - """ - newPosition = GeomAPI_Pnt2d(110., 80.) - self.mySketch.move(self.myEllipticArc.defaultResult(), newPosition.x(), newPosition.y()) - model.do() - self.checkPointCoordinates(self.myEllipticArc.center(), self.myCenter) - self.checkPointOnEllipse(newPosition, self.myEllipticArc) - self.assertNotEqual(self.myEllipticArc.minorRadius().value(), self.myMinorRadius) - self.assertNotEqual(self.myEllipticArc.majorRadius().value(), self.myMajorRadius) - - def test_move_center_ellipse_fixed_major_radius(self): - """ Test 3. Movement of central point of ellipse with fixed major radius - """ - self.fixMajorRadius() - - newPosition = [self.myCenter.x() + 20., self.myCenter.y() + 10.] - self.mySketch.move(self.myEllipticArc.center(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myEllipticArc.center(), newPosition) - self.checkAlmostEqual(self.myEllipticArc.majorRadius().value(), self.myMajorRadius) - - def test_move_ellipse_fixed_major_radius(self): - """ Test 4. Movement of ellipse with fixed major radius - """ - self.fixMajorRadius() - - newPosition = GeomAPI_Pnt2d(80., 80.) - self.mySketch.move(self.myEllipticArc.defaultResult(), newPosition.x(), newPosition.y()) - model.do() - self.checkPointOnEllipse(newPosition, self.myEllipticArc) - self.assertNotEqual(self.myEllipticArc.minorRadius().value(), self.myMinorRadius) - self.checkAlmostEqual(self.myEllipticArc.majorRadius().value(), self.myMajorRadius) - - def test_move_center_ellipse_fixed_minor_radius(self): - """ Test 5. Movement of central point of ellipse with fixed minor radius - """ - self.fixMinorRadius() - - newPosition = [self.myCenter.x() + 20., self.myCenter.y() + 10.] - self.mySketch.move(self.myEllipticArc.center(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myEllipticArc.center(), newPosition) - self.checkAlmostEqual(self.myEllipticArc.minorRadius().value(), self.myMinorRadius) - - def test_move_ellipse_fixed_minor_radius(self): - """ Test 6. Movement of ellipse with fixed minor radius - """ - self.fixMinorRadius() - - newPosition = GeomAPI_Pnt2d(110., 80.) - self.mySketch.move(self.myEllipticArc.defaultResult(), newPosition.x(), newPosition.y()) - model.do() - self.checkPointOnEllipse(newPosition, self.myEllipticArc) - self.checkAlmostEqual(self.myEllipticArc.minorRadius().value(), self.myMinorRadius) - self.assertNotEqual(self.myEllipticArc.majorRadius().value(), self.myMajorRadius) - - def test_move_center_ellipse_fixed_center(self): - """ Test 7. Movement of central point of ellipse with fixed center (nothing should be changed) - """ - self.fixPoint(self.myEllipticArc.center()) - - newPosition = [self.myCenter.x() + 20., self.myCenter.y() + 10.] - self.mySketch.move(self.myEllipticArc.center(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myEllipticArc.center(), self.myCenter) - self.checkAlmostEqual(self.myEllipticArc.minorRadius().value(), self.myMinorRadius) - self.checkAlmostEqual(self.myEllipticArc.majorRadius().value(), self.myMajorRadius) - - def test_move_ellipse_fixed_center(self): - """ Test 8. Movement of ellipse with fixed center - """ - self.fixPoint(self.myEllipticArc.center()) - - newPosition = GeomAPI_Pnt2d(110., 80.) - self.mySketch.move(self.myEllipticArc.defaultResult(), newPosition.x(), newPosition.y()) - model.do() - self.checkPointOnEllipse(newPosition, self.myEllipticArc) - self.assertNotEqual(self.myEllipticArc.minorRadius().value(), self.myMinorRadius) - self.assertNotEqual(self.myEllipticArc.majorRadius().value(), self.myMajorRadius) - - def test_move_center_ellipse_fixed_focus(self): - """ Test 9. Movement of central point of ellipse with fixed focus - """ - focus = [self.myEllipticArc.firstFocus().x(), self.myEllipticArc.firstFocus().y()] - self.fixPoint(self.myEllipticArc.firstFocus()) - - newPosition = GeomAPI_Pnt2d(self.myCenter.x() + 20., self.myCenter.y() + 10.) - self.mySketch.move(self.myEllipticArc.center(), newPosition.x(), newPosition.y()) - model.do() - self.checkPointCoordinates(self.myEllipticArc.center(), newPosition) - self.checkPointCoordinates(self.myEllipticArc.firstFocus(), focus) - self.assertNotEqual(self.myEllipticArc.minorRadius().value(), self.myMinorRadius) - self.assertNotEqual(self.myEllipticArc.majorRadius().value(), self.myMajorRadius) - - def test_move_focus_ellipse_fixed_focus(self): - """ Test 10. Movement of a focus point of ellipse with fixed focus (nothing should be changed) - """ - focus = [self.myEllipticArc.firstFocus().x(), self.myEllipticArc.firstFocus().y()] - self.fixPoint(self.myEllipticArc.firstFocus()) - - newPosition = GeomAPI_Pnt2d(focus[0] + 10., focus[1] + 10.) - self.mySketch.move(self.myEllipticArc.firstFocus(), newPosition.x(), newPosition.y()) - model.do() - self.checkPointCoordinates(self.myEllipticArc.firstFocus(), focus) - self.checkAlmostEqual(self.myEllipticArc.minorRadius().value(), self.myMinorRadius) - self.checkAlmostEqual(self.myEllipticArc.majorRadius().value(), self.myMajorRadius) - - def test_move_ellipse_fixed_focus(self): - """ Test 11. Movement of ellipse with fixed focus - """ - focus = [self.myEllipticArc.firstFocus().x(), self.myEllipticArc.firstFocus().y()] - self.fixPoint(self.myEllipticArc.firstFocus()) - - newPosition = GeomAPI_Pnt2d(80., 90.) - self.mySketch.move(self.myEllipticArc.defaultResult(), newPosition.x(), newPosition.y()) - model.do() - self.checkPointOnEllipse(newPosition, self.myEllipticArc) - self.checkPointCoordinates(self.myEllipticArc.firstFocus(), focus) - self.assertNotEqual(self.myEllipticArc.minorRadius().value(), self.myMinorRadius) - self.assertNotEqual(self.myEllipticArc.majorRadius().value(), self.myMajorRadius) - - def test_move_fixed_ellipse(self): - """ Test 12. Trying to move fully fixed ellipse - """ - self.mySketch.setFixed(self.myEllipticArc.results()[-1]) - self.myDOF -= 7 - model.do() - self.checkDOF() - - newPosition = [110., 80.] - self.mySketch.move(self.myEllipticArc.defaultResult(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myEllipticArc.center(), self.myCenter) - self.checkPointCoordinates(self.myEllipticArc.majorAxisPositive(), self.myAxisPoint) - self.checkPointCoordinates(self.myEllipticArc.startPoint(), self.myStartPoint) - self.checkPointCoordinates(self.myEllipticArc.endPoint(), self.myEndPoint) - self.checkAlmostEqual(self.myEllipticArc.majorRadius().value(), self.myMajorRadius) - self.checkAlmostEqual(self.myEllipticArc.minorRadius().value(), self.myMinorRadius) - - def test_move_start_point_free_ellipse(self): - """ Test 13. Trying to move start point of elliptic arc - """ - newPosition = [self.myStartPoint.x() + 10., self.myStartPoint.y() + 10.] - self.mySketch.move(self.myEllipticArc.startPoint(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myEllipticArc.startPoint(), newPosition) - - def test_move_end_point_free_ellipse(self): - """ Test 14. Trying to move end point of elliptic arc - """ - newPosition = [self.myEndPoint.x() - 10., self.myEndPoint.y() + 10.] - self.mySketch.move(self.myEllipticArc.endPoint(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myEllipticArc.endPoint(), newPosition) - - def test_move_start_point_fixed_ellipse(self): - """ Test 15. Trying to move start point of fully fixed ellipse - """ - self.mySketch.setFixed(self.myEllipticArc.results()[-1]) - self.myDOF -= 7 - model.do() - self.checkDOF() - - newPosition = [self.myStartPoint.x() + 10., self.myStartPoint.y() + 10.] - self.mySketch.move(self.myEllipticArc.startPoint(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myEllipticArc.center(), self.myCenter) - self.checkPointCoordinates(self.myEllipticArc.majorAxisPositive(), self.myAxisPoint) - self.checkPointCoordinates(self.myEllipticArc.startPoint(), self.myStartPoint) - self.checkPointCoordinates(self.myEllipticArc.endPoint(), self.myEndPoint) - self.checkAlmostEqual(self.myEllipticArc.majorRadius().value(), self.myMajorRadius) - self.checkAlmostEqual(self.myEllipticArc.minorRadius().value(), self.myMinorRadius) - - def test_move_end_point_fixed_ellipse(self): - """ Test 16. Trying to move end point of fully fixed ellipse - """ - self.mySketch.setFixed(self.myEllipticArc.results()[-1]) - self.myDOF -= 7 - model.do() - self.checkDOF() - - newPosition = [self.myEndPoint.x() - 10., self.myEndPoint.y() + 10.] - self.mySketch.move(self.myEllipticArc.endPoint(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myEllipticArc.center(), self.myCenter) - self.checkPointCoordinates(self.myEllipticArc.majorAxisPositive(), self.myAxisPoint) - self.checkPointCoordinates(self.myEllipticArc.startPoint(), self.myStartPoint) - self.checkPointCoordinates(self.myEllipticArc.endPoint(), self.myEndPoint) - self.checkAlmostEqual(self.myEllipticArc.majorRadius().value(), self.myMajorRadius) - self.checkAlmostEqual(self.myEllipticArc.minorRadius().value(), self.myMinorRadius) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myCenter = GeomAPI_Pnt2d(70.0, 50.0) + self.myAxisPoint = GeomAPI_Pnt2d(100.0, 70.0) + self.myStartPoint = GeomAPI_Pnt2d(75.0, 75.0) + self.myEndPoint = GeomAPI_Pnt2d(45.0, 55.0) + macroEllipticArc = self.mySketch.addEllipticArc( + self.myCenter, self.myAxisPoint, self.myStartPoint, self.myEndPoint, False + ) + self.myDOF = 7 + model.do() + self.checkDOF() + self.myEllipticArc = SketchAPI_EllipticArc( + model.lastSubFeature(self.mySketch, "SketchEllipticArc") + ) + self.myMajorRadius = self.myEllipticArc.majorRadius().value() + self.myMinorRadius = self.myEllipticArc.minorRadius().value() + + def tearDown(self): + self.checkDOF() + self.checkPointOnEllipse(self.myEllipticArc.startPoint(), self.myEllipticArc) + self.checkPointOnEllipse(self.myEllipticArc.endPoint(), self.myEllipticArc) + model.end() + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointCoordinates(self, thePoint, theCoordinates): + aCoord = [] + if issubclass(type(theCoordinates), GeomAPI_Pnt2d): + aCoord = [theCoordinates.x(), theCoordinates.y()] + else: + aCoord = theCoordinates + DIGITS = 7 - math.ceil(math.log10(math.hypot(aCoord[0], aCoord[1]))) + self.assertAlmostEqual(thePoint.x(), aCoord[0], DIGITS) + self.assertAlmostEqual(thePoint.y(), aCoord[1], DIGITS) + + def checkPointOnEllipse(self, theCoordinates, theEllipticArc): + point = GeomAPI_Pnt2d(theCoordinates.x(), theCoordinates.y()) + firstFocus2d = GeomAPI_Pnt2d( + theEllipticArc.firstFocus().x(), theEllipticArc.firstFocus().y() + ) + distPF1 = model.distancePointPoint(firstFocus2d, point) + secondFocus2d = GeomAPI_Pnt2d( + theEllipticArc.secondFocus().x(), theEllipticArc.secondFocus().y() + ) + distPF2 = model.distancePointPoint(secondFocus2d, point) + DIGITS = 7 - math.ceil(math.log10(theEllipticArc.majorRadius().value())) + self.assertAlmostEqual( + distPF1 + distPF2, 2.0 * theEllipticArc.majorRadius().value(), DIGITS + ) + + def checkAlmostEqual(self, theValue1, theValue2): + DIGITS = 7 - math.ceil(math.log10(theValue1)) + self.assertAlmostEqual(theValue1, theValue2, DIGITS) + + def fixMajorRadius(self): + self.mySketch.setDistance( + self.myEllipticArc.center(), + self.myEllipticArc.majorAxisPositive(), + self.myMajorRadius, + ) + self.myDOF -= 1 + model.do() + self.checkDOF() + + def fixMinorRadius(self): + self.mySketch.setDistance( + self.myEllipticArc.center(), + self.myEllipticArc.minorAxisPositive(), + self.myMinorRadius, + ) + self.myDOF -= 1 + model.do() + self.checkDOF() + + def fixPoint(self, thePoint): + self.mySketch.setFixed(thePoint) + self.myDOF -= 2 + model.do() + self.checkDOF() + + def test_move_center_free_ellipse(self): + """Test 1. Movement of central point of a free elliptic arc""" + newPosition = [self.myCenter.x() + 20.0, self.myCenter.y() + 10.0] + self.mySketch.move(self.myEllipticArc.center(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myEllipticArc.center(), newPosition) + + def test_move_free_ellipse(self): + """Test 2. Movement of a free ellipse dragging the edge""" + newPosition = GeomAPI_Pnt2d(110.0, 80.0) + self.mySketch.move( + self.myEllipticArc.defaultResult(), newPosition.x(), newPosition.y() + ) + model.do() + self.checkPointCoordinates(self.myEllipticArc.center(), self.myCenter) + self.checkPointOnEllipse(newPosition, self.myEllipticArc) + self.assertNotEqual( + self.myEllipticArc.minorRadius().value(), self.myMinorRadius + ) + self.assertNotEqual( + self.myEllipticArc.majorRadius().value(), self.myMajorRadius + ) + + def test_move_center_ellipse_fixed_major_radius(self): + """Test 3. Movement of central point of ellipse with fixed major radius""" + self.fixMajorRadius() + + newPosition = [self.myCenter.x() + 20.0, self.myCenter.y() + 10.0] + self.mySketch.move(self.myEllipticArc.center(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myEllipticArc.center(), newPosition) + self.checkAlmostEqual( + self.myEllipticArc.majorRadius().value(), self.myMajorRadius + ) + + def test_move_ellipse_fixed_major_radius(self): + """Test 4. Movement of ellipse with fixed major radius""" + self.fixMajorRadius() + + newPosition = GeomAPI_Pnt2d(80.0, 80.0) + self.mySketch.move( + self.myEllipticArc.defaultResult(), newPosition.x(), newPosition.y() + ) + model.do() + self.checkPointOnEllipse(newPosition, self.myEllipticArc) + self.assertNotEqual( + self.myEllipticArc.minorRadius().value(), self.myMinorRadius + ) + self.checkAlmostEqual( + self.myEllipticArc.majorRadius().value(), self.myMajorRadius + ) + + def test_move_center_ellipse_fixed_minor_radius(self): + """Test 5. Movement of central point of ellipse with fixed minor radius""" + self.fixMinorRadius() + + newPosition = [self.myCenter.x() + 20.0, self.myCenter.y() + 10.0] + self.mySketch.move(self.myEllipticArc.center(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myEllipticArc.center(), newPosition) + self.checkAlmostEqual( + self.myEllipticArc.minorRadius().value(), self.myMinorRadius + ) + + def test_move_ellipse_fixed_minor_radius(self): + """Test 6. Movement of ellipse with fixed minor radius""" + self.fixMinorRadius() + + newPosition = GeomAPI_Pnt2d(110.0, 80.0) + self.mySketch.move( + self.myEllipticArc.defaultResult(), newPosition.x(), newPosition.y() + ) + model.do() + self.checkPointOnEllipse(newPosition, self.myEllipticArc) + self.checkAlmostEqual( + self.myEllipticArc.minorRadius().value(), self.myMinorRadius + ) + self.assertNotEqual( + self.myEllipticArc.majorRadius().value(), self.myMajorRadius + ) + + def test_move_center_ellipse_fixed_center(self): + """Test 7. Movement of central point of ellipse with fixed center (nothing should be changed)""" + self.fixPoint(self.myEllipticArc.center()) + + newPosition = [self.myCenter.x() + 20.0, self.myCenter.y() + 10.0] + self.mySketch.move(self.myEllipticArc.center(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myEllipticArc.center(), self.myCenter) + self.checkAlmostEqual( + self.myEllipticArc.minorRadius().value(), self.myMinorRadius + ) + self.checkAlmostEqual( + self.myEllipticArc.majorRadius().value(), self.myMajorRadius + ) + + def test_move_ellipse_fixed_center(self): + """Test 8. Movement of ellipse with fixed center""" + self.fixPoint(self.myEllipticArc.center()) + + newPosition = GeomAPI_Pnt2d(110.0, 80.0) + self.mySketch.move( + self.myEllipticArc.defaultResult(), newPosition.x(), newPosition.y() + ) + model.do() + self.checkPointOnEllipse(newPosition, self.myEllipticArc) + self.assertNotEqual( + self.myEllipticArc.minorRadius().value(), self.myMinorRadius + ) + self.assertNotEqual( + self.myEllipticArc.majorRadius().value(), self.myMajorRadius + ) + + def test_move_center_ellipse_fixed_focus(self): + """Test 9. Movement of central point of ellipse with fixed focus""" + focus = [ + self.myEllipticArc.firstFocus().x(), + self.myEllipticArc.firstFocus().y(), + ] + self.fixPoint(self.myEllipticArc.firstFocus()) + + newPosition = GeomAPI_Pnt2d(self.myCenter.x() + 20.0, self.myCenter.y() + 10.0) + self.mySketch.move( + self.myEllipticArc.center(), newPosition.x(), newPosition.y() + ) + model.do() + self.checkPointCoordinates(self.myEllipticArc.center(), newPosition) + self.checkPointCoordinates(self.myEllipticArc.firstFocus(), focus) + self.assertNotEqual( + self.myEllipticArc.minorRadius().value(), self.myMinorRadius + ) + self.assertNotEqual( + self.myEllipticArc.majorRadius().value(), self.myMajorRadius + ) + + def test_move_focus_ellipse_fixed_focus(self): + """Test 10. Movement of a focus point of ellipse with fixed focus (nothing should be changed)""" + focus = [ + self.myEllipticArc.firstFocus().x(), + self.myEllipticArc.firstFocus().y(), + ] + self.fixPoint(self.myEllipticArc.firstFocus()) + + newPosition = GeomAPI_Pnt2d(focus[0] + 10.0, focus[1] + 10.0) + self.mySketch.move( + self.myEllipticArc.firstFocus(), newPosition.x(), newPosition.y() + ) + model.do() + self.checkPointCoordinates(self.myEllipticArc.firstFocus(), focus) + self.checkAlmostEqual( + self.myEllipticArc.minorRadius().value(), self.myMinorRadius + ) + self.checkAlmostEqual( + self.myEllipticArc.majorRadius().value(), self.myMajorRadius + ) + + def test_move_ellipse_fixed_focus(self): + """Test 11. Movement of ellipse with fixed focus""" + focus = [ + self.myEllipticArc.firstFocus().x(), + self.myEllipticArc.firstFocus().y(), + ] + self.fixPoint(self.myEllipticArc.firstFocus()) + + newPosition = GeomAPI_Pnt2d(80.0, 90.0) + self.mySketch.move( + self.myEllipticArc.defaultResult(), newPosition.x(), newPosition.y() + ) + model.do() + self.checkPointOnEllipse(newPosition, self.myEllipticArc) + self.checkPointCoordinates(self.myEllipticArc.firstFocus(), focus) + self.assertNotEqual( + self.myEllipticArc.minorRadius().value(), self.myMinorRadius + ) + self.assertNotEqual( + self.myEllipticArc.majorRadius().value(), self.myMajorRadius + ) + + def test_move_fixed_ellipse(self): + """Test 12. Trying to move fully fixed ellipse""" + self.mySketch.setFixed(self.myEllipticArc.results()[-1]) + self.myDOF -= 7 + model.do() + self.checkDOF() + + newPosition = [110.0, 80.0] + self.mySketch.move( + self.myEllipticArc.defaultResult(), newPosition[0], newPosition[1] + ) + model.do() + self.checkPointCoordinates(self.myEllipticArc.center(), self.myCenter) + self.checkPointCoordinates( + self.myEllipticArc.majorAxisPositive(), self.myAxisPoint + ) + self.checkPointCoordinates(self.myEllipticArc.startPoint(), self.myStartPoint) + self.checkPointCoordinates(self.myEllipticArc.endPoint(), self.myEndPoint) + self.checkAlmostEqual( + self.myEllipticArc.majorRadius().value(), self.myMajorRadius + ) + self.checkAlmostEqual( + self.myEllipticArc.minorRadius().value(), self.myMinorRadius + ) + + def test_move_start_point_free_ellipse(self): + """Test 13. Trying to move start point of elliptic arc""" + newPosition = [self.myStartPoint.x() + 10.0, self.myStartPoint.y() + 10.0] + self.mySketch.move( + self.myEllipticArc.startPoint(), newPosition[0], newPosition[1] + ) + model.do() + self.checkPointCoordinates(self.myEllipticArc.startPoint(), newPosition) + + def test_move_end_point_free_ellipse(self): + """Test 14. Trying to move end point of elliptic arc""" + newPosition = [self.myEndPoint.x() - 10.0, self.myEndPoint.y() + 10.0] + self.mySketch.move( + self.myEllipticArc.endPoint(), newPosition[0], newPosition[1] + ) + model.do() + self.checkPointCoordinates(self.myEllipticArc.endPoint(), newPosition) + + def test_move_start_point_fixed_ellipse(self): + """Test 15. Trying to move start point of fully fixed ellipse""" + self.mySketch.setFixed(self.myEllipticArc.results()[-1]) + self.myDOF -= 7 + model.do() + self.checkDOF() + + newPosition = [self.myStartPoint.x() + 10.0, self.myStartPoint.y() + 10.0] + self.mySketch.move( + self.myEllipticArc.startPoint(), newPosition[0], newPosition[1] + ) + model.do() + self.checkPointCoordinates(self.myEllipticArc.center(), self.myCenter) + self.checkPointCoordinates( + self.myEllipticArc.majorAxisPositive(), self.myAxisPoint + ) + self.checkPointCoordinates(self.myEllipticArc.startPoint(), self.myStartPoint) + self.checkPointCoordinates(self.myEllipticArc.endPoint(), self.myEndPoint) + self.checkAlmostEqual( + self.myEllipticArc.majorRadius().value(), self.myMajorRadius + ) + self.checkAlmostEqual( + self.myEllipticArc.minorRadius().value(), self.myMinorRadius + ) + + def test_move_end_point_fixed_ellipse(self): + """Test 16. Trying to move end point of fully fixed ellipse""" + self.mySketch.setFixed(self.myEllipticArc.results()[-1]) + self.myDOF -= 7 + model.do() + self.checkDOF() + + newPosition = [self.myEndPoint.x() - 10.0, self.myEndPoint.y() + 10.0] + self.mySketch.move( + self.myEllipticArc.endPoint(), newPosition[0], newPosition[1] + ) + model.do() + self.checkPointCoordinates(self.myEllipticArc.center(), self.myCenter) + self.checkPointCoordinates( + self.myEllipticArc.majorAxisPositive(), self.myAxisPoint + ) + self.checkPointCoordinates(self.myEllipticArc.startPoint(), self.myStartPoint) + self.checkPointCoordinates(self.myEllipticArc.endPoint(), self.myEndPoint) + self.checkAlmostEqual( + self.myEllipticArc.majorRadius().value(), self.myMajorRadius + ) + self.checkAlmostEqual( + self.myEllipticArc.minorRadius().value(), self.myMinorRadius + ) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestMoveLine.py b/src/SketchPlugin/Test/TestMoveLine.py index 17fc60def..17d081580 100644 --- a/src/SketchPlugin/Test/TestMoveLine.py +++ b/src/SketchPlugin/Test/TestMoveLine.py @@ -27,108 +27,107 @@ from salome.shaper import model __updated__ = "2017-05-11" + class TestMoveLine(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myStart = [70., 50.] - self.myEnd = [100., 20.] - self.myLine = self.mySketch.addLine(self.myStart[0], self.myStart[1], self.myEnd[0], self.myEnd[1]) - self.myDOF = 4 - model.do() - self.checkDOF() - - def tearDown(self): - self.checkDOF() - model.end() - assert(model.checkPythonDump()) - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def checkPointCoordinates(self, thePoint, theCoordinates): - self.assertAlmostEqual(thePoint.x(), theCoordinates[0]) - self.assertAlmostEqual(thePoint.y(), theCoordinates[1]) - - def checkPointOnLine(self, theCoordinates): - self.assertAlmostEqual(model.distancePointLine(theCoordinates, self.myLine), 0.) - - def test_move_start_of_free_line(self): - """ Test 1. Movement of start point of a free line - """ - newPosition = [self.myStart[0] + 20., self.myStart[1] + 10.] - self.mySketch.move(self.myLine.startPoint(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myLine.startPoint(), newPosition) - self.checkPointCoordinates(self.myLine.endPoint(), self.myEnd) - - def test_move_end_of_free_line(self): - """ Test 2. Movement of end point of a free line - """ - newPosition = [self.myEnd[0] + 20., self.myEnd[1] + 10.] - self.mySketch.move(self.myLine.endPoint(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myLine.startPoint(), self.myStart) - self.checkPointCoordinates(self.myLine.endPoint(), newPosition) - - def test_move_free_line(self): - """ Test 3. Movement of free line - """ - diff = [self.myEnd[0] - self.myStart[0], self.myEnd[1] - self.myStart[1]] - - newPosition = [100., 100.] - self.mySketch.move(self.myLine.defaultResult(), newPosition[0], newPosition[1]) - model.do() - self.checkPointOnLine(newPosition) - - # additionally check the line keeps geometry (relative positions of extremities) - startPoint = self.myLine.startPoint() - endPoint = [startPoint.x() + diff[0], startPoint.y() + diff[1]] - self.checkPointCoordinates(self.myLine.endPoint(), endPoint) - - def test_move_line_start_fixed(self): - """ Test 4. Movement of a line, which start point is fixed - """ - fixed = self.mySketch.setFixed(self.myLine.startPoint()) - self.myDOF -= 2 - model.do() - self.checkDOF() - - newPosition = [100., 100.] - self.mySketch.move(self.myLine.defaultResult(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myLine.startPoint(), self.myStart) - self.assertNotEqual(self.myLine.endPoint().x(), self.myEnd[0]) - self.assertNotEqual(self.myLine.endPoint().y(), self.myEnd[1]) - - def test_move_line_end_fixed(self): - """ Test 5. Movement of a line, which end point is fixed - """ - fixed = self.mySketch.setFixed(self.myLine.endPoint()) - self.myDOF -= 2 - model.do() - self.checkDOF() - - newPosition = [100., 100.] - self.mySketch.move(self.myLine.defaultResult(), newPosition[0], newPosition[1]) - model.do() - self.assertNotEqual(self.myLine.startPoint().x(), self.myStart[0]) - self.assertNotEqual(self.myLine.startPoint().y(), self.myStart[1]) - self.checkPointCoordinates(self.myLine.endPoint(), self.myEnd) - - def test_move_line_fully_fixed(self): - """ Test 6. Movement of fully fixed line (should not change its coordinates) - """ - fixed = self.mySketch.setFixed(self.myLine.defaultResult()) - self.myDOF -= 4 - model.do() - - newPosition = [100., 100.] - self.mySketch.move(self.myLine.defaultResult(), newPosition[0], newPosition[1]) - model.do() - self.checkPointCoordinates(self.myLine.startPoint(), self.myStart) - self.checkPointCoordinates(self.myLine.endPoint(), self.myEnd) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myStart = [70.0, 50.0] + self.myEnd = [100.0, 20.0] + self.myLine = self.mySketch.addLine( + self.myStart[0], self.myStart[1], self.myEnd[0], self.myEnd[1] + ) + self.myDOF = 4 + model.do() + self.checkDOF() + + def tearDown(self): + self.checkDOF() + model.end() + assert model.checkPythonDump() + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def checkPointCoordinates(self, thePoint, theCoordinates): + self.assertAlmostEqual(thePoint.x(), theCoordinates[0]) + self.assertAlmostEqual(thePoint.y(), theCoordinates[1]) + + def checkPointOnLine(self, theCoordinates): + self.assertAlmostEqual( + model.distancePointLine(theCoordinates, self.myLine), 0.0 + ) + + def test_move_start_of_free_line(self): + """Test 1. Movement of start point of a free line""" + newPosition = [self.myStart[0] + 20.0, self.myStart[1] + 10.0] + self.mySketch.move(self.myLine.startPoint(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myLine.startPoint(), newPosition) + self.checkPointCoordinates(self.myLine.endPoint(), self.myEnd) + + def test_move_end_of_free_line(self): + """Test 2. Movement of end point of a free line""" + newPosition = [self.myEnd[0] + 20.0, self.myEnd[1] + 10.0] + self.mySketch.move(self.myLine.endPoint(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myLine.startPoint(), self.myStart) + self.checkPointCoordinates(self.myLine.endPoint(), newPosition) + + def test_move_free_line(self): + """Test 3. Movement of free line""" + diff = [self.myEnd[0] - self.myStart[0], self.myEnd[1] - self.myStart[1]] + + newPosition = [100.0, 100.0] + self.mySketch.move(self.myLine.defaultResult(), newPosition[0], newPosition[1]) + model.do() + self.checkPointOnLine(newPosition) + + # additionally check the line keeps geometry (relative positions of extremities) + startPoint = self.myLine.startPoint() + endPoint = [startPoint.x() + diff[0], startPoint.y() + diff[1]] + self.checkPointCoordinates(self.myLine.endPoint(), endPoint) + + def test_move_line_start_fixed(self): + """Test 4. Movement of a line, which start point is fixed""" + fixed = self.mySketch.setFixed(self.myLine.startPoint()) + self.myDOF -= 2 + model.do() + self.checkDOF() + + newPosition = [100.0, 100.0] + self.mySketch.move(self.myLine.defaultResult(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myLine.startPoint(), self.myStart) + self.assertNotEqual(self.myLine.endPoint().x(), self.myEnd[0]) + self.assertNotEqual(self.myLine.endPoint().y(), self.myEnd[1]) + + def test_move_line_end_fixed(self): + """Test 5. Movement of a line, which end point is fixed""" + fixed = self.mySketch.setFixed(self.myLine.endPoint()) + self.myDOF -= 2 + model.do() + self.checkDOF() + + newPosition = [100.0, 100.0] + self.mySketch.move(self.myLine.defaultResult(), newPosition[0], newPosition[1]) + model.do() + self.assertNotEqual(self.myLine.startPoint().x(), self.myStart[0]) + self.assertNotEqual(self.myLine.startPoint().y(), self.myStart[1]) + self.checkPointCoordinates(self.myLine.endPoint(), self.myEnd) + + def test_move_line_fully_fixed(self): + """Test 6. Movement of fully fixed line (should not change its coordinates)""" + fixed = self.mySketch.setFixed(self.myLine.defaultResult()) + self.myDOF -= 4 + model.do() + + newPosition = [100.0, 100.0] + self.mySketch.move(self.myLine.defaultResult(), newPosition[0], newPosition[1]) + model.do() + self.checkPointCoordinates(self.myLine.startPoint(), self.myStart) + self.checkPointCoordinates(self.myLine.endPoint(), self.myEnd) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestMovePoint.py b/src/SketchPlugin/Test/TestMovePoint.py index 93d18ce44..2b03e9bf5 100644 --- a/src/SketchPlugin/Test/TestMovePoint.py +++ b/src/SketchPlugin/Test/TestMovePoint.py @@ -27,80 +27,81 @@ from salome.shaper import model __updated__ = "2017-05-11" + class TestMovePoint(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) - self.myOrigin = self.mySketch.addPoint(model.selection("VERTEX", "Origin")) - self.myPoint = self.mySketch.addPoint(70, 50) - self.myPointCoordinates = geomDataAPI_Point2D(self.myPoint.coordinates()) - self.myDOF = 2 - model.do() - self.checkDOF() - - def tearDown(self): - self.checkDOF() - model.end() - assert(model.checkPythonDump()) - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - def test_move_free_point(self): - """ Test 1. Movement of free point - """ - newPosition = [100., 100.] - self.mySketch.move(self.myPoint, newPosition[0], newPosition[1]) - model.do() - self.assertAlmostEqual(self.myPointCoordinates.x(), newPosition[0]) - self.assertAlmostEqual(self.myPointCoordinates.y(), newPosition[1]) - - def test_move_fixed_x(self): - """ Test 2. Movement of partially fixed point (fixed x coordinate) - """ - DISTANCE = 50. - horizDistance = self.mySketch.setHorizontalDistance(self.myOrigin.result(), self.myPoint.coordinates(), DISTANCE) - self.myDOF -= 1 - model.do() - self.checkDOF() - - newPosition = [100., 100.] - self.mySketch.move(self.myPoint, newPosition[0], newPosition[1]) - model.do() - self.assertAlmostEqual(self.myPointCoordinates.x(), DISTANCE) - self.assertAlmostEqual(self.myPointCoordinates.y(), newPosition[1]) - - def test_move_fixed_y(self): - """ Test 3. Movement of partially fixed point (fixed y coordinate) - """ - DISTANCE = 50. - vertDistance = self.mySketch.setVerticalDistance(self.myOrigin.result(), self.myPoint.coordinates(), DISTANCE) - self.myDOF -= 1 - model.do() - self.checkDOF() - - newPosition = [100., 100.] - self.mySketch.move(self.myPoint, newPosition[0], newPosition[1]) - model.do() - self.assertAlmostEqual(self.myPointCoordinates.x(), newPosition[0]) - self.assertAlmostEqual(self.myPointCoordinates.y(), DISTANCE) - - def test_move_fully_fixed(self): - """ Test 4. Movement of fully fixed point (should not be changed) - """ - coord = [self.myPointCoordinates.x(), self.myPointCoordinates.y()] - - fixed = self.mySketch.setFixed(self.myPoint.result()) - self.myDOF -= 2 - model.do() - self.checkDOF() - - newPosition = [100., 100.] - self.mySketch.move(self.myPoint, newPosition[0], newPosition[1]) - model.do() - self.assertAlmostEqual(self.myPointCoordinates.x(), coord[0]) - self.assertAlmostEqual(self.myPointCoordinates.y(), coord[1]) + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(self.myDocument, model.defaultPlane("XOY")) + self.myOrigin = self.mySketch.addPoint(model.selection("VERTEX", "Origin")) + self.myPoint = self.mySketch.addPoint(70, 50) + self.myPointCoordinates = geomDataAPI_Point2D(self.myPoint.coordinates()) + self.myDOF = 2 + model.do() + self.checkDOF() + + def tearDown(self): + self.checkDOF() + model.end() + assert model.checkPythonDump() + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def test_move_free_point(self): + """Test 1. Movement of free point""" + newPosition = [100.0, 100.0] + self.mySketch.move(self.myPoint, newPosition[0], newPosition[1]) + model.do() + self.assertAlmostEqual(self.myPointCoordinates.x(), newPosition[0]) + self.assertAlmostEqual(self.myPointCoordinates.y(), newPosition[1]) + + def test_move_fixed_x(self): + """Test 2. Movement of partially fixed point (fixed x coordinate)""" + DISTANCE = 50.0 + horizDistance = self.mySketch.setHorizontalDistance( + self.myOrigin.result(), self.myPoint.coordinates(), DISTANCE + ) + self.myDOF -= 1 + model.do() + self.checkDOF() + + newPosition = [100.0, 100.0] + self.mySketch.move(self.myPoint, newPosition[0], newPosition[1]) + model.do() + self.assertAlmostEqual(self.myPointCoordinates.x(), DISTANCE) + self.assertAlmostEqual(self.myPointCoordinates.y(), newPosition[1]) + + def test_move_fixed_y(self): + """Test 3. Movement of partially fixed point (fixed y coordinate)""" + DISTANCE = 50.0 + vertDistance = self.mySketch.setVerticalDistance( + self.myOrigin.result(), self.myPoint.coordinates(), DISTANCE + ) + self.myDOF -= 1 + model.do() + self.checkDOF() + + newPosition = [100.0, 100.0] + self.mySketch.move(self.myPoint, newPosition[0], newPosition[1]) + model.do() + self.assertAlmostEqual(self.myPointCoordinates.x(), newPosition[0]) + self.assertAlmostEqual(self.myPointCoordinates.y(), DISTANCE) + + def test_move_fully_fixed(self): + """Test 4. Movement of fully fixed point (should not be changed)""" + coord = [self.myPointCoordinates.x(), self.myPointCoordinates.y()] + + fixed = self.mySketch.setFixed(self.myPoint.result()) + self.myDOF -= 2 + model.do() + self.checkDOF() + + newPosition = [100.0, 100.0] + self.mySketch.move(self.myPoint, newPosition[0], newPosition[1]) + model.do() + self.assertAlmostEqual(self.myPointCoordinates.x(), coord[0]) + self.assertAlmostEqual(self.myPointCoordinates.y(), coord[1]) if __name__ == "__main__": diff --git a/src/SketchPlugin/Test/TestMovementComplex.py b/src/SketchPlugin/Test/TestMovementComplex.py index 6da54bc0e..880b924f5 100644 --- a/src/SketchPlugin/Test/TestMovementComplex.py +++ b/src/SketchPlugin/Test/TestMovementComplex.py @@ -26,7 +26,7 @@ from SketchAPI import * from GeomAPI import * import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 model.begin() partSet = model.moduleDocument() @@ -37,25 +37,47 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(20, 165, 175, 165) SketchLine_2 = Sketch_1.addLine(175, 165, 175, 120) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(175, 120, 80, 20) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(80, 20, 20, 20) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(20, 20, 20, 165) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.endPoint() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 155) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_2.result(), SketchLine_1.result()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_1.result(), SketchLine_4.result()) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_2.result(), SketchLine_1.result() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_1.result(), SketchLine_4.result() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 45) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_4.startPoint(), SketchLine_1.result(), 145) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_4.startPoint(), SketchLine_3.startPoint(), 95) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_4.startPoint(), SketchLine_1.result(), 145 +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_4.startPoint(), SketchLine_3.startPoint(), 95 +) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchPoint_1.coordinates(), SketchLine_5.endPoint(), 20) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchPoint_1.coordinates(), SketchLine_5.endPoint(), 165) +SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance( + SketchPoint_1.coordinates(), SketchLine_5.endPoint(), 20 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchPoint_1.coordinates(), SketchLine_5.endPoint(), 165 +) model.do() # ============================================================================= @@ -65,44 +87,44 @@ Sketch_1.setFillet(SketchLine_5.startPoint()) SketchArc_1 = SketchAPI_Arc(model.lastSubFeature(Sketch_1, "SketchArc")) model.do() anArcCenter = [SketchArc_1.center().x(), SketchArc_1.center().y()] -anArcStart = [SketchArc_1.startPoint().x(), SketchArc_1.startPoint().y()] -anArcEnd = [SketchArc_1.endPoint().x(), SketchArc_1.endPoint().y()] +anArcStart = [SketchArc_1.startPoint().x(), SketchArc_1.startPoint().y()] +anArcEnd = [SketchArc_1.endPoint().x(), SketchArc_1.endPoint().y()] # move arc dragging center -delta = [1., 1.] +delta = [1.0, 1.0] for i in range(1, 10): anArcCenter = [anArcCenter[0] + delta[0], anArcCenter[1] + delta[1]] Sketch_1.move(SketchArc_1.center(), anArcCenter[0], anArcCenter[1]) model.do() model.assertArcValidity(SketchArc_1) model.assertPoint(SketchArc_1.center(), anArcCenter) - assert(SketchArc_1.startPoint().x() == anArcStart[0]) - assert(SketchArc_1.endPoint().y() == anArcEnd[1]) + assert SketchArc_1.startPoint().x() == anArcStart[0] + assert SketchArc_1.endPoint().y() == anArcEnd[1] if i == 5: - delta = [-1., -1.] + delta = [-1.0, -1.0] # move arc dragging start point -delta = [1., 1.] +delta = [1.0, 1.0] aPosition = anArcStart for i in range(1, 10): aPosition = [aPosition[0] + delta[0], aPosition[1] + delta[1]] Sketch_1.move(SketchArc_1.startPoint(), aPosition[0], aPosition[1]) model.do() model.assertArcValidity(SketchArc_1) - assert(SketchArc_1.startPoint().x() == anArcStart[0]) - assert(SketchArc_1.endPoint().y() == anArcEnd[1]) + assert SketchArc_1.startPoint().x() == anArcStart[0] + assert SketchArc_1.endPoint().y() == anArcEnd[1] if i == 5: - delta = [-1., -1.] + delta = [-1.0, -1.0] # move arc dragging end point -delta = [1., 1.] +delta = [1.0, 1.0] aPosition = anArcEnd for i in range(1, 10): aPosition = [aPosition[0] + delta[0], aPosition[1] + delta[1]] Sketch_1.move(SketchArc_1.endPoint(), aPosition[0], aPosition[1]) model.do() model.assertArcValidity(SketchArc_1) - assert(SketchArc_1.startPoint().x() == anArcStart[0]) - assert(SketchArc_1.endPoint().y() == anArcEnd[1]) + assert SketchArc_1.startPoint().x() == anArcStart[0] + assert SketchArc_1.endPoint().y() == anArcEnd[1] if i == 5: - delta = [-1., -1.] + delta = [-1.0, -1.0] # ============================================================================= # Test 2. Create circle and move it near its potential position @@ -112,96 +134,125 @@ aCircleRadius = 5 SketchCircle_1 = Sketch_1.addCircle(aCircleCenter[0], aCircleCenter[1], aCircleRadius) model.do() # move center -delta = [3., 2.] +delta = [3.0, 2.0] for i in range(1, 15): aCircleCenter = [aCircleCenter[0] + delta[0], aCircleCenter[1] + delta[1]] Sketch_1.move(SketchCircle_1.center(), aCircleCenter[0], aCircleCenter[1]) model.do() model.assertPoint(SketchCircle_1.center(), aCircleCenter) - assert(SketchCircle_1.radius().value() == aCircleRadius) + assert SketchCircle_1.radius().value() == aCircleRadius # move circle by dragging edge aPosition = [aCircleCenter[0] + aCircleRadius, aCircleCenter[1]] -delta = [1., 1.] +delta = [1.0, 1.0] for i in range(1, 10): aPosition = [aPosition[0] + delta[0], aPosition[1] + delta[1]] Sketch_1.move(SketchCircle_1.defaultResult(), aPosition[0], aPosition[1]) model.do() model.assertPoint(SketchCircle_1.center(), aCircleCenter) - assert(math.fabs(SketchCircle_1.radius().value() - model.distancePointPoint(aPosition, aCircleCenter)) < TOLERANCE) + assert ( + math.fabs( + SketchCircle_1.radius().value() + - model.distancePointPoint(aPosition, aCircleCenter) + ) + < TOLERANCE + ) # ============================================================================= # Test 3. Constrain center of circle and move it again # ============================================================================= -SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance(SketchCircle_1.center(), SketchArc_1.startPoint(), 30) +SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance( + SketchCircle_1.center(), SketchArc_1.startPoint(), 30 +) model.do() # move center -delta = [1., 1.] +delta = [1.0, 1.0] aCircleCenter = [SketchCircle_1.center().x(), SketchCircle_1.center().y()] aPosition = aCircleCenter for i in range(1, 10): aPosition = [aPosition[0] + delta[0], aPosition[1] + delta[1]] Sketch_1.move(SketchCircle_1.center(), aPosition[0], aPosition[1]) model.do() - assert(SketchCircle_1.center().x() == aCircleCenter[0]) + assert SketchCircle_1.center().x() == aCircleCenter[0] if i == 5: - delta = [-1., -1.] + delta = [-1.0, -1.0] # move circle by dragging edge aCircleCenter = [SketchCircle_1.center().x(), SketchCircle_1.center().y()] aPosition = [aCircleCenter[0] + aCircleRadius, aCircleCenter[1]] -delta = [1., 1.] +delta = [1.0, 1.0] for i in range(1, 10): aPosition = [aPosition[0] + delta[0], aPosition[1] + delta[1]] Sketch_1.move(SketchCircle_1.defaultResult(), aPosition[0], aPosition[1]) model.do() model.assertPoint(SketchCircle_1.center(), aCircleCenter) - assert(math.fabs(SketchCircle_1.radius().value() - model.distancePointPoint(aPosition, aCircleCenter)) < TOLERANCE) + assert ( + math.fabs( + SketchCircle_1.radius().value() + - model.distancePointPoint(aPosition, aCircleCenter) + ) + < TOLERANCE + ) # set radius of the circle aCircleRadius = 17.5 -SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], aCircleRadius) +SketchConstraintRadius_1 = Sketch_1.setRadius( + SketchCircle_1.results()[1], aCircleRadius +) model.do() # move center -delta = [1., 1.] +delta = [1.0, 1.0] aCircleCenter = [SketchCircle_1.center().x(), SketchCircle_1.center().y()] aPosition = aCircleCenter for i in range(1, 10): aPosition = [aPosition[0] + delta[0], aPosition[1] + delta[1]] Sketch_1.move(SketchCircle_1.center(), aPosition[0], aPosition[1]) model.do() - assert(SketchCircle_1.center().x() == aCircleCenter[0]) - assert(SketchCircle_1.radius().value() == aCircleRadius) + assert SketchCircle_1.center().x() == aCircleCenter[0] + assert SketchCircle_1.radius().value() == aCircleRadius if i == 5: - delta = [-1., -1.] + delta = [-1.0, -1.0] # move circle by dragging edge aCircleCenter = [SketchCircle_1.center().x(), SketchCircle_1.center().y()] aPosition = [aCircleCenter[0] + aCircleRadius, aCircleCenter[1]] -delta = [1., 1.] +delta = [1.0, 1.0] for i in range(1, 10): aPosition = [aPosition[0] + delta[0], aPosition[1] + delta[1]] Sketch_1.move(SketchCircle_1.defaultResult(), aPosition[0], aPosition[1]) model.do() - assert(SketchCircle_1.center().x() == aCircleCenter[0]) - assert(SketchCircle_1.radius().value() == aCircleRadius) + assert SketchCircle_1.center().x() == aCircleCenter[0] + assert SketchCircle_1.radius().value() == aCircleRadius # ============================================================================= # Test 4. Set centers of circle and arc coincident and move circle # ============================================================================= -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchArc_1.center()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchArc_1.center() +) model.do() -assert(model.dof(Sketch_1) == 0) +assert model.dof(Sketch_1) == 0 # move circle aCircleCenter = [SketchCircle_1.center().x(), SketchCircle_1.center().y()] aPosition = [aCircleCenter[0], aCircleCenter[1] + aCircleRadius] -delta = [0., 1.] +delta = [0.0, 1.0] for i in range(1, 10): aPosition = [aPosition[0] + delta[0], aPosition[1] + delta[1]] Sketch_1.move(SketchCircle_1.defaultResult(), aPosition[0], aPosition[1]) model.do() model.assertPoint(SketchCircle_1.center(), aCircleCenter) - assert(SketchCircle_1.radius().value() == aCircleRadius) -assert(model.dof(Sketch_1) == 0) + assert SketchCircle_1.radius().value() == aCircleRadius +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_5r-SketchArc_1_2f-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r-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,36 +261,57 @@ 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() Sketch_2.setVertical(SketchLine_9.result()) -SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/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()) +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() +) SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_7.result(), 80) model.do() -assert(model.dof(Sketch_2) == 0) +assert model.dof(Sketch_2) == 0 # Create auxiliary lines for further holes SketchLine_11 = Sketch_2.addLine(20, 10, 175, 10) SketchLine_11.setAuxiliary(True) -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchLine_7.result()) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_9.result()) -SketchConstraintParallel_2 = Sketch_2.setParallel(SketchLine_11.result(), SketchLine_8.result()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident( + SketchLine_11.startPoint(), SketchLine_7.result() +) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_9.result() +) +SketchConstraintParallel_2 = Sketch_2.setParallel( + SketchLine_11.result(), SketchLine_8.result() +) SketchLine_12 = Sketch_2.addLine(150, 0, 150, 80) SketchLine_12.setAuxiliary(True) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_12.startPoint(), SketchLine_6.result()) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_8.result()) -SketchConstraintPerpendicular_2 = Sketch_2.setPerpendicular(SketchLine_11.result(), SketchLine_12.result()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident( + SketchLine_12.startPoint(), SketchLine_6.result() +) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_8.result() +) +SketchConstraintPerpendicular_2 = Sketch_2.setPerpendicular( + SketchLine_11.result(), SketchLine_12.result() +) model.do() -assert(model.dof(Sketch_2) == 2) +assert model.dof(Sketch_2) == 2 # ============================================================================= # Test 5. Create circular hole and move it # ============================================================================= SketchCircle_2 = Sketch_2.addCircle(50, 10, 10) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchCircle_2.center(), SketchLine_11.result()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchCircle_2.center(), SketchLine_11.result() +) model.do() # move center -delta = [2., 1.] +delta = [2.0, 1.0] aCircleCenter = [SketchCircle_2.center().x(), SketchCircle_2.center().y()] aCircleRadius = SketchCircle_2.radius().value() for i in range(1, 10): @@ -247,43 +319,87 @@ for i in range(1, 10): Sketch_2.move(SketchCircle_2.center(), aCircleCenter[0], aCircleCenter[1]) model.do() model.assertPoint(SketchCircle_2.center(), aCircleCenter) - assert(aCircleRadius == SketchCircle_2.radius().value()) + assert aCircleRadius == SketchCircle_2.radius().value() # move circle by dragging edge aCircleCenter = [SketchCircle_2.center().x(), SketchCircle_2.center().y()] aPosition = [aCircleCenter[0] + aCircleRadius, aCircleCenter[1]] -delta = [0., 1.] +delta = [0.0, 1.0] for i in range(1, 10): aPosition = [aPosition[0] + delta[0], aPosition[1] + delta[1]] Sketch_1.move(SketchCircle_2.defaultResult(), aPosition[0], aPosition[1]) model.do() model.assertPoint(SketchCircle_2.center(), aCircleCenter) - assert(math.fabs(SketchCircle_2.radius().value() - model.distancePointPoint(aPosition, aCircleCenter)) < TOLERANCE) + assert ( + math.fabs( + SketchCircle_2.radius().value() + - model.distancePointPoint(aPosition, aCircleCenter) + ) + < TOLERANCE + ) -SketchConstraintDistanceHorizontal_4 = Sketch_2.setHorizontalDistance(SketchLine_11.startPoint(), SketchCircle_2.center(), 21.5) +SketchConstraintDistanceHorizontal_4 = Sketch_2.setHorizontalDistance( + SketchLine_11.startPoint(), SketchCircle_2.center(), 21.5 +) model.do() -assert(model.dof(Sketch_2) == 3) +assert model.dof(Sketch_2) == 3 # ============================================================================= # Test 6. Create oval hole and move it # ============================================================================= anArcRadius = 5 anArcCenter = [SketchLine_11.endPoint().x() + anArcRadius, SketchCircle_2.center().y()] -SketchArc_2 = Sketch_2.addArc(anArcCenter[0], anArcCenter[1], anArcCenter[0], anArcCenter[1] + anArcRadius, anArcCenter[0], anArcCenter[1] - anArcRadius, True) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchArc_2.center(), SketchLine_11.result()) -SketchLine_13 = Sketch_2.addLine(anArcCenter[0], anArcCenter[1] + anArcRadius, SketchLine_12.startPoint().x(), anArcCenter[1] + anArcRadius) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchArc_2.startPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_12.result()) -SketchConstraintPerpendicular_3 = Sketch_2.setPerpendicular(SketchLine_13.result(), SketchLine_12.result()) -SketchLine_14 = Sketch_2.addLine(anArcCenter[0], anArcCenter[1] - anArcRadius, SketchLine_12.startPoint().x(), anArcCenter[1] - anArcRadius) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_12.result()) -SketchConstraintPerpendicular_4 = Sketch_2.setPerpendicular(SketchLine_14.result(), SketchLine_12.result()) -SketchConstraintTangent_1 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_13.result()) -SketchConstraintTangent_2 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_14.result()) +SketchArc_2 = Sketch_2.addArc( + anArcCenter[0], + anArcCenter[1], + anArcCenter[0], + anArcCenter[1] + anArcRadius, + anArcCenter[0], + anArcCenter[1] - anArcRadius, + True, +) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchArc_2.center(), SketchLine_11.result() +) +SketchLine_13 = Sketch_2.addLine( + anArcCenter[0], + anArcCenter[1] + anArcRadius, + SketchLine_12.startPoint().x(), + anArcCenter[1] + anArcRadius, +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchArc_2.startPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_12.result() +) +SketchConstraintPerpendicular_3 = Sketch_2.setPerpendicular( + SketchLine_13.result(), SketchLine_12.result() +) +SketchLine_14 = Sketch_2.addLine( + anArcCenter[0], + anArcCenter[1] - anArcRadius, + SketchLine_12.startPoint().x(), + anArcCenter[1] - anArcRadius, +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchArc_2.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_12.result() +) +SketchConstraintPerpendicular_4 = Sketch_2.setPerpendicular( + SketchLine_14.result(), SketchLine_12.result() +) +SketchConstraintTangent_1 = Sketch_2.setTangent( + SketchArc_2.results()[1], SketchLine_13.result() +) +SketchConstraintTangent_2 = Sketch_2.setTangent( + SketchArc_2.results()[1], SketchLine_14.result() +) model.do() -assert(model.dof(Sketch_2) == 5) +assert model.dof(Sketch_2) == 5 # move center of arc -delta = [-2., 1.] +delta = [-2.0, 1.0] anArcCenter = [SketchArc_2.center().x(), SketchArc_2.center().y()] for i in range(1, 10): anArcCenter = [anArcCenter[0] + delta[0], anArcCenter[1] + delta[1]] @@ -292,18 +408,26 @@ for i in range(1, 10): model.assertArc(SketchArc_2, anArcCenter, [], []) # Complete the oval hole -SketchConstraintMirror_1_objects = [SketchLine_13.result(), SketchArc_2.results()[1], SketchLine_14.result()] -SketchConstraintMirror_1 = Sketch_2.addMirror(SketchLine_12.result(), SketchConstraintMirror_1_objects) +SketchConstraintMirror_1_objects = [ + SketchLine_13.result(), + SketchArc_2.results()[1], + SketchLine_14.result(), +] +SketchConstraintMirror_1 = Sketch_2.addMirror( + SketchLine_12.result(), SketchConstraintMirror_1_objects +) [SketchLine_15, SketchArc_3, SketchLine_16] = SketchConstraintMirror_1.mirrored() model.do() # ============================================================================= # Test 7. Set arc and circle equal radii and move arc # ============================================================================= -SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_2.results()[1], SketchArc_2.results()[1]) +SketchConstraintEqual_2 = Sketch_2.setEqual( + SketchCircle_2.results()[1], SketchArc_2.results()[1] +) model.do() # move center of arc -delta = [-1., -1.] +delta = [-1.0, -1.0] anArcCenter = [SketchArc_2.center().x(), SketchArc_2.center().y()] aCircleCenter = [SketchCircle_2.center().x(), SketchCircle_2.center().y()] for i in range(1, 10): @@ -312,65 +436,160 @@ for i in range(1, 10): model.do() model.assertArc(SketchArc_2, anArcCenter, [], []) model.assertPoint(SketchCircle_2.center(), [aCircleCenter[0], anArcCenter[1]]) - anArcRadius = model.distancePointPoint(SketchArc_2.center(), SketchArc_2.startPoint()) - assert(math.fabs(SketchCircle_2.radius().value() - anArcRadius) < TOLERANCE) + anArcRadius = model.distancePointPoint( + SketchArc_2.center(), SketchArc_2.startPoint() + ) + assert math.fabs(SketchCircle_2.radius().value() - anArcRadius) < TOLERANCE # move arc by dragging edge aCircleCenter = [SketchCircle_2.center().x(), SketchCircle_2.center().y()] anArcCenter = [SketchArc_2.center().x(), SketchArc_2.center().y()] aPosition = [anArcCenter[0] + anArcRadius, anArcCenter[1]] -delta = [1., 1.] +delta = [1.0, 1.0] for i in range(1, 10): aPosition = [aPosition[0] + delta[0], aPosition[1] + delta[1]] Sketch_2.move(SketchArc_2.defaultResult(), aPosition[0], aPosition[1]) model.do() model.assertArc(SketchArc_2, anArcCenter, [], []) model.assertPoint(SketchCircle_2.center(), aCircleCenter) - anArcRadius = model.distancePointPoint(SketchArc_2.center(), SketchArc_2.startPoint()) - assert(math.fabs(SketchCircle_2.radius().value() - anArcRadius) < TOLERANCE) + anArcRadius = model.distancePointPoint( + SketchArc_2.center(), SketchArc_2.startPoint() + ) + assert math.fabs(SketchCircle_2.radius().value() - anArcRadius) < TOLERANCE if i == 5: - delta = [-1., -1.] + delta = [-1.0, -1.0] # Fix all DOF in Sketch_2 -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchArc_2.center(), SketchLine_9.result(), 21.5) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchArc_2.center(), SketchLine_9.result(), 21.5 +) SketchConstraintLength_4 = Sketch_2.setLength(SketchLine_13.result(), 3.5) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], 6.5) -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchCircle_2.center(), SketchLine_8.result(), 30) +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_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")]) +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&Extrusion_1_1/To_Face)(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(Fuse_1_1/Modified_Face&Sketch_2/SketchLine_7&Sketch_1/SketchLine_5)")) +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_2/SketchLine_7&Sketch_1/SketchLine_5)", + ), +) SketchLine_17 = Sketch_3.addLine(145, 0, 165, 0) -SketchProjection_2 = Sketch_3.addProjection(model.selection("VERTEX", "[Fuse_1_1/Modified_Face&Sketch_2/SketchLine_6&Extrusion_1_1/From_Face][Fuse_1_1/Modified_Face&Extrusion_2_1/To_Face&Sketch_1/SketchLine_1][Fuse_1_1/Modified_Face&Sketch_2/SketchLine_7&Sketch_1/SketchLine_5]")) +SketchProjection_2 = Sketch_3.addProjection( + model.selection( + "VERTEX", + "[Fuse_1_1/Modified_Face&Sketch_2/SketchLine_6&Extrusion_1_1/From_Face][Fuse_1_1/Modified_Face&Extrusion_2_1/To_Face&Sketch_1/SketchLine_1][Fuse_1_1/Modified_Face&Sketch_2/SketchLine_7&Sketch_1/SketchLine_5]", + ) +) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchAPI_Point(SketchPoint_2).result()) +SketchConstraintCoincidence_23 = Sketch_3.setCoincident( + SketchLine_17.endPoint(), SketchAPI_Point(SketchPoint_2).result() +) SketchLine_18 = Sketch_3.addLine(165, 0, 165, -20) SketchLine_19 = Sketch_3.addLine(165, -20, 145, -20) SketchLine_20 = Sketch_3.addLine(145, -20, 145, 0) -SketchConstraintCoincidence_24 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_17.startPoint()) -SketchConstraintCoincidence_25 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) -SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -SketchConstraintCoincidence_27 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_24 = Sketch_3.setCoincident( + SketchLine_20.endPoint(), SketchLine_17.startPoint() +) +SketchConstraintCoincidence_25 = Sketch_3.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) +SketchConstraintCoincidence_26 = Sketch_3.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) +SketchConstraintCoincidence_27 = Sketch_3.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_17.result()) SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_18.result()) SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_19.result()) SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_20.result()) SketchArc_4 = Sketch_3.addArc(145, -20, 165, -20, 145, 0, False) -SketchConstraintCoincidence_28 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchArc_4.center()) -SketchConstraintCoincidence_29 = Sketch_3.setCoincident(SketchLine_18.endPoint(), SketchArc_4.startPoint()) -SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchArc_4.endPoint(), SketchLine_20.endPoint()) +SketchConstraintCoincidence_28 = Sketch_3.setCoincident( + SketchLine_19.endPoint(), SketchArc_4.center() +) +SketchConstraintCoincidence_29 = Sketch_3.setCoincident( + SketchLine_18.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintCoincidence_30 = Sketch_3.setCoincident( + SketchArc_4.endPoint(), SketchLine_20.endPoint() +) SketchConstraintRadius_3 = Sketch_3.setRadius(SketchArc_4.results()[1], 20) 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&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_2/SketchLine_7&Sketch_1/SketchLine_5)]")) -SketchConstraintTangent_5 = Sketch_3.setTangent(SketchArc_5.results()[1], SketchLine_21.result()) +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&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_2/SketchLine_7&Sketch_1/SketchLine_5)]", + ) +) +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-SketchArc_4_2r-SketchLine_18r-SketchLine_17r")], model.selection(), model.selection("FACE", "Fuse_1_1/Modified_Face&Sketch_2/SketchLine_9&Sketch_1/SketchLine_2"), 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_2/SketchLine_9&Sketch_1/SketchLine_2)(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")]) +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_2/SketchLine_9&Sketch_1/SketchLine_2" + ), + 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_2/SketchLine_9&Sketch_1/SketchLine_2)(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() @@ -382,5 +601,4 @@ model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.EDGE, [140]) model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.VERTEX, [280]) model.testResultsVolumes(ExtrusionFuse_1, [260653.824775497108930721879005432]) -assert(model.checkPythonDump()) - +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestMultiRotation.py b/src/SketchPlugin/Test/TestMultiRotation.py index abc6842e4..f96805a3a 100644 --- a/src/SketchPlugin/Test/TestMultiRotation.py +++ b/src/SketchPlugin/Test/TestMultiRotation.py @@ -37,60 +37,63 @@ from ModelAPI import * import math from salome.shaper import model -#========================================================================= + +# ========================================================================= # Auxiliary functions -#========================================================================= +# ========================================================================= def createSketch(theSketch): # Initialize sketch by arc allFeatures = [] # Create arc aSketchArc = theSketch.addFeature("SketchArc") - aCenter = geomDataAPI_Point2D(aSketchArc.attribute("center_point")) + aCenter = geomDataAPI_Point2D(aSketchArc.attribute("center_point")) aStartPoint = geomDataAPI_Point2D(aSketchArc.attribute("start_point")) - aEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("end_point")) - aCenter.setValue(5., 5.) - aStartPoint.setValue(10., 5.) - aEndPoint.setValue(5., 10.) + aEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("end_point")) + aCenter.setValue(5.0, 5.0) + aStartPoint.setValue(10.0, 5.0) + aEndPoint.setValue(5.0, 10.0) allFeatures.append(aSketchArc) theSketch.execute() return allFeatures + def createLine(theSketch): aSketchLine = theSketch.addFeature("SketchLine") aStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) - aEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) - aStartPoint.setValue(7., 5.) - aEndPoint.setValue(1., 3.) + aEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) + aStartPoint.setValue(7.0, 5.0) + aEndPoint.setValue(1.0, 3.0) theSketch.execute() return aSketchLine + def checkRotation(theObjects, theNbObjects, theCenterX, theCenterY, theAngle): # Verify distances of the objects and the number of copies aFeatures = [] aSize = theObjects.size() - for i in range (0, aSize): + for i in range(0, aSize): feat = ModelAPI_Feature.feature(theObjects.object(i)) - assert(feat is not None) + assert feat is not None aFeatures.append(feat) - cosA = math.cos(theAngle * math.pi / 180.) + cosA = math.cos(theAngle * math.pi / 180.0) anInd = 0 for feat, next in zip(aFeatures[:-1], aFeatures[1:]): anInd = anInd + 1 - if (anInd > theNbObjects-1): + if anInd > theNbObjects - 1: anInd = 0 continue - assert(feat.getKind() == next.getKind()) + assert feat.getKind() == next.getKind() anAttributes = [] - if (feat.getKind() == "SketchLine"): - anAttributes.append('StartPoint') - anAttributes.append('EndPoint') - elif (feat.getKind() == "SketchArc"): - anAttributes.append('center_point') - anAttributes.append('start_point') - anAttributes.append('end_point') + if feat.getKind() == "SketchLine": + anAttributes.append("StartPoint") + anAttributes.append("EndPoint") + elif feat.getKind() == "SketchArc": + anAttributes.append("center_point") + anAttributes.append("start_point") + anAttributes.append("end_point") for attr in anAttributes: aPoint1 = geomDataAPI_Point2D(feat.attribute(attr)) @@ -102,22 +105,22 @@ def checkRotation(theObjects, theNbObjects, theCenterX, theCenterY, theAngle): aDirY2 = aPoint2.y() - theCenterY aLen2 = math.hypot(aDirX2, aDirY2) aLocCosA = (aDirX1 * aDirX2 + aDirY1 * aDirY2) / aLen1 / aLen2 - assert(math.fabs(aLocCosA - cosA) < 1.e-10) + assert math.fabs(aLocCosA - cosA) < 1.0e-10 # Check the number of copies is as planed - assert(anInd == theNbObjects-1) + assert anInd == theNbObjects - 1 -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2015-09-18" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -128,37 +131,37 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Initialize sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aFeaturesList = createSketch(aSketchFeature) aSession.finishOperation() -assert(model.dof(aSketchFeature) == 5) -#========================================================================= +assert model.dof(aSketchFeature) == 5 +# ========================================================================= # Global variables -#========================================================================= -CENTER_X = 0. -CENTER_Y = 0. -ANGLE = 30. -#========================================================================= +# ========================================================================= +CENTER_X = 0.0 +CENTER_Y = 0.0 +ANGLE = 30.0 +# ========================================================================= # Create rotation point -#========================================================================= +# ========================================================================= aSession.startOperation() aRotationPoint = aSketchFeature.addFeature("SketchPoint") aRotationPointPoint = geomDataAPI_Point2D(aRotationPoint.attribute("PointCoordinates")) aRotationPointPoint.setValue(CENTER_X, CENTER_Y) aSession.finishOperation() -assert(model.dof(aSketchFeature) == 7) -#========================================================================= +assert model.dof(aSketchFeature) == 7 +# ========================================================================= # Create the Rotation constraint -#========================================================================= +# ========================================================================= aSession.startOperation() aMultiRotation = aSketchFeature.addFeature("SketchMultiRotation") aRotList = aMultiRotation.reflist("MultiRotationList") for aFeature in aFeaturesList: aResult = modelAPI_ResultConstruction(aFeature.lastResult()) - assert(aResult is not None) + assert aResult is not None aRotList.append(aResult) aValueType = aMultiRotation.string("AngleType") @@ -177,66 +180,66 @@ aNbCopies = aMultiRotation.integer("MultiRotationObjects") aNbCopies.setValue(2) aMultiRotation.execute() aSession.finishOperation() -assert(model.dof(aSketchFeature) == 7) -#========================================================================= +assert model.dof(aSketchFeature) == 7 +# ========================================================================= # Verify the objects are moved for the specified distance -#========================================================================= +# ========================================================================= aRotated = aMultiRotation.reflist("ConstraintEntityB") checkRotation(aRotated, aNbCopies.value(), CENTER_X, CENTER_Y, ANGLE) -#========================================================================= +# ========================================================================= # Change number of copies and verify Rotation -#========================================================================= +# ========================================================================= aSession.startOperation() aNbCopies.setValue(3) aSession.finishOperation() aRotated = aMultiRotation.reflist("ConstraintEntityB") checkRotation(aRotated, aNbCopies.value(), CENTER_X, CENTER_Y, ANGLE) -assert(model.dof(aSketchFeature) == 7) +assert model.dof(aSketchFeature) == 7 -#========================================================================= +# ========================================================================= # Create new feature and add it into the Rotation -#========================================================================= +# ========================================================================= aSession.startOperation() aLine = createLine(aSketchFeature) aSession.finishOperation() aSession.startOperation() aResult = modelAPI_ResultConstruction(aLine.lastResult()) -assert(aResult is not None) +assert aResult is not None aRotList.append(aResult) aSession.finishOperation() checkRotation(aRotated, aNbCopies.value(), CENTER_X, CENTER_Y, ANGLE) -assert(model.dof(aSketchFeature) == 11) -#========================================================================= +assert model.dof(aSketchFeature) == 11 +# ========================================================================= # Move line and check the copies are moved too -#========================================================================= +# ========================================================================= aSession.startOperation() aStartPoint = geomDataAPI_Point2D(aLine.attribute("StartPoint")) -aStartPoint.setValue(12., 5.) +aStartPoint.setValue(12.0, 5.0) aSession.finishOperation() checkRotation(aRotated, aNbCopies.value(), CENTER_X, CENTER_Y, ANGLE) -assert(model.dof(aSketchFeature) == 11) -#========================================================================= +assert model.dof(aSketchFeature) == 11 +# ========================================================================= # Change number of copies and verify Rotation -#========================================================================= +# ========================================================================= aSession.startOperation() aNbCopies.setValue(2) aSession.finishOperation() checkRotation(aRotated, aNbCopies.value(), CENTER_X, CENTER_Y, ANGLE) -assert(model.dof(aSketchFeature) == 11) +assert model.dof(aSketchFeature) == 11 -#========================================================================= +# ========================================================================= # Remove a feature from the Rotation -#========================================================================= +# ========================================================================= aSession.startOperation() aRemoveIt = aRotList.object(0) aRotList.remove(aRemoveIt) aSession.finishOperation() checkRotation(aRotated, aNbCopies.value(), CENTER_X, CENTER_Y, ANGLE) -assert(model.dof(aSketchFeature) == 11) +assert model.dof(aSketchFeature) == 11 -#========================================================================= +# ========================================================================= # Clear the list of rotated features -#========================================================================= +# ========================================================================= aSession.startOperation() aRotList.clear() checkRotation(aRotated, 1, CENTER_X, CENTER_Y, ANGLE) @@ -244,9 +247,9 @@ checkRotation(aRotated, 1, CENTER_X, CENTER_Y, ANGLE) aRotList.append(aResult) aSession.finishOperation() checkRotation(aRotated, aNbCopies.value(), CENTER_X, CENTER_Y, ANGLE) -assert(model.dof(aSketchFeature) == 11) -#========================================================================= +assert model.dof(aSketchFeature) == 11 +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestMultiRotation01.py b/src/SketchPlugin/Test/TestMultiRotation01.py index c68eef26c..d08d1f1cf 100644 --- a/src/SketchPlugin/Test/TestMultiRotation01.py +++ b/src/SketchPlugin/Test/TestMultiRotation01.py @@ -27,13 +27,17 @@ 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, 20, 10, 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() model.do() -SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_1.result()], SketchAPI_Point(SketchPoint_1).coordinates(), 90, 5) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchLine_1.result()], SketchAPI_Point(SketchPoint_1).coordinates(), 90, 5 +) model.do() # check MultiRotation is invalid -assert(SketchMultiRotation_1.feature().error() != "") +assert SketchMultiRotation_1.feature().error() != "" model.end() diff --git a/src/SketchPlugin/Test/TestMultiRotation02.py b/src/SketchPlugin/Test/TestMultiRotation02.py index c8c3b365e..f959f1003 100644 --- a/src/SketchPlugin/Test/TestMultiRotation02.py +++ b/src/SketchPlugin/Test/TestMultiRotation02.py @@ -27,18 +27,22 @@ 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, 20, 10, 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() model.do() -SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_1.result()], SketchAPI_Point(SketchPoint_1).coordinates(), 200, 2) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchLine_1.result()], SketchAPI_Point(SketchPoint_1).coordinates(), 200, 2 +) model.do() # check MultiRotation is valid -assert(SketchMultiRotation_1.feature().error() == "") +assert SketchMultiRotation_1.feature().error() == "" # update number of copies to make MultiRotation invalid SketchMultiRotation_1.feature().integer("MultiRotationObjects").setValue(3) model.do() -assert(SketchMultiRotation_1.feature().error() != "") +assert SketchMultiRotation_1.feature().error() != "" model.end() diff --git a/src/SketchPlugin/Test/TestMultiRotation03.py b/src/SketchPlugin/Test/TestMultiRotation03.py index 80c532c0e..e253f7fc1 100644 --- a/src/SketchPlugin/Test/TestMultiRotation03.py +++ b/src/SketchPlugin/Test/TestMultiRotation03.py @@ -29,38 +29,55 @@ 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, 20, 10, 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() model.do() ROT_ANGLE = 90 ROT_COPIES = 3 -SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_1.result()], SketchAPI_Point(SketchPoint_1).coordinates(), ROT_ANGLE, ROT_COPIES) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchLine_1.result()], + SketchAPI_Point(SketchPoint_1).coordinates(), + ROT_ANGLE, + ROT_COPIES, +) model.do() -assert(SketchMultiRotation_1.angle().value() == ROT_ANGLE) +assert SketchMultiRotation_1.angle().value() == ROT_ANGLE # set angle value from single to full SketchMultiRotation_1.feature().string("AngleType").setValue("FullAngle") model.do() -assert(SketchMultiRotation_1.angle().value() == ROT_ANGLE*(ROT_COPIES - 1)) +assert SketchMultiRotation_1.angle().value() == ROT_ANGLE * (ROT_COPIES - 1) # check coordinates of center of mass of each line -REF_DATA = [[-20, 20], - [-20, -20]] -TOLERANCE = 1.e-7 +REF_DATA = [[-20, 20], [-20, -20]] +TOLERANCE = 1.0e-7 aLines = SketchMultiRotation_1.rotated() ind = 0 for lin in aLines: curShape = lin.feature().lastResult().shape() massCenter = GeomAlgoAPI_ShapeTools.centreOfMass(curShape) - assert(fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE and fabs(massCenter.y() - REF_DATA[ind][1]) < TOLERANCE and massCenter.z() == 0), "({}, {}, {}) != ({}, {}, {})".format(massCenter.x(), massCenter.y(), massCenter.z(), REF_DATA[ind][0], REF_DATA[ind][1], 0.0) + assert ( + fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE + and fabs(massCenter.y() - REF_DATA[ind][1]) < TOLERANCE + and massCenter.z() == 0 + ), "({}, {}, {}) != ({}, {}, {})".format( + massCenter.x(), + massCenter.y(), + massCenter.z(), + REF_DATA[ind][0], + REF_DATA[ind][1], + 0.0, + ) ind += 1 # set angle value from full to single SketchMultiRotation_1.feature().string("AngleType").setValue("SingleAngle") model.do() -assert(SketchMultiRotation_1.angle().value() == ROT_ANGLE) +assert SketchMultiRotation_1.angle().value() == ROT_ANGLE # check coordinates of center of mass of each line aLines = SketchMultiRotation_1.rotated() @@ -68,9 +85,20 @@ ind = 0 for lin in aLines: curShape = lin.feature().lastResult().shape() massCenter = GeomAlgoAPI_ShapeTools.centreOfMass(curShape) - assert(fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE and fabs(massCenter.y() - REF_DATA[ind][1]) < TOLERANCE and massCenter.z() == 0), "({}, {}, {}) != ({}, {}, {})".format(massCenter.x(), massCenter.y(), massCenter.z(), REF_DATA[ind][0], REF_DATA[ind][1], 0.0) + assert ( + fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE + and fabs(massCenter.y() - REF_DATA[ind][1]) < TOLERANCE + and massCenter.z() == 0 + ), "({}, {}, {}) != ({}, {}, {})".format( + massCenter.x(), + massCenter.y(), + massCenter.z(), + REF_DATA[ind][0], + REF_DATA[ind][1], + 0.0, + ) ind += 1 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestMultiRotation04.py b/src/SketchPlugin/Test/TestMultiRotation04.py index 55087a765..8df6b7786 100644 --- a/src/SketchPlugin/Test/TestMultiRotation04.py +++ b/src/SketchPlugin/Test/TestMultiRotation04.py @@ -29,34 +29,51 @@ 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, 20, 10, 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() model.do() ROT_ANGLE = 360 ROT_COPIES = 4 -SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_1.result()], SketchAPI_Point(SketchPoint_1).coordinates(), ROT_ANGLE, ROT_COPIES, True) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchLine_1.result()], + SketchAPI_Point(SketchPoint_1).coordinates(), + ROT_ANGLE, + ROT_COPIES, + True, +) model.do() -assert(SketchMultiRotation_1.angle().value() == ROT_ANGLE) +assert SketchMultiRotation_1.angle().value() == ROT_ANGLE # check coordinates of center of mass of each line -REF_DATA = [[-20, 20], - [-20, -20], - [20, -20]] -TOLERANCE = 1.e-7 +REF_DATA = [[-20, 20], [-20, -20], [20, -20]] +TOLERANCE = 1.0e-7 aLines = SketchMultiRotation_1.rotated() ind = 0 for lin in aLines: curShape = lin.feature().lastResult().shape() massCenter = GeomAlgoAPI_ShapeTools.centreOfMass(curShape) - assert(fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE and fabs(massCenter.y() - REF_DATA[ind][1]) < TOLERANCE and massCenter.z() == 0), "({}, {}, {}) != ({}, {}, {})".format(massCenter.x(), massCenter.y(), massCenter.z(), REF_DATA[ind][0], REF_DATA[ind][1], 0.0) + assert ( + fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE + and fabs(massCenter.y() - REF_DATA[ind][1]) < TOLERANCE + and massCenter.z() == 0 + ), "({}, {}, {}) != ({}, {}, {})".format( + massCenter.x(), + massCenter.y(), + massCenter.z(), + REF_DATA[ind][0], + REF_DATA[ind][1], + 0.0, + ) ind += 1 # set angle value from full to single SketchMultiRotation_1.feature().string("AngleType").setValue("SingleAngle") model.do() -assert(SketchMultiRotation_1.angle().value() == ROT_ANGLE/ROT_COPIES) +assert SketchMultiRotation_1.angle().value() == ROT_ANGLE / ROT_COPIES # check coordinates of center of mass of each line aLines = SketchMultiRotation_1.rotated() @@ -64,13 +81,26 @@ ind = 0 for lin in aLines: curShape = lin.feature().lastResult().shape() massCenter = GeomAlgoAPI_ShapeTools.centreOfMass(curShape) - assert(fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE and fabs(massCenter.y() - REF_DATA[ind][1]) < TOLERANCE and massCenter.z() == 0), "({}, {}, {}) != ({}, {}, {})".format(massCenter.x(), massCenter.y(), massCenter.z(), REF_DATA[ind][0], REF_DATA[ind][1], 0.0) + assert ( + fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE + and fabs(massCenter.y() - REF_DATA[ind][1]) < TOLERANCE + and massCenter.z() == 0 + ), "({}, {}, {}) != ({}, {}, {})".format( + massCenter.x(), + massCenter.y(), + massCenter.z(), + REF_DATA[ind][0], + REF_DATA[ind][1], + 0.0, + ) ind += 1 # set angle value from single to full SketchMultiRotation_1.feature().string("AngleType").setValue("FullAngle") model.do() -assert(SketchMultiRotation_1.angle().value() == ROT_ANGLE/ROT_COPIES*(ROT_COPIES - 1)) +assert SketchMultiRotation_1.angle().value() == ROT_ANGLE / ROT_COPIES * ( + ROT_COPIES - 1 +) # check coordinates of center of mass of each line aLines = SketchMultiRotation_1.rotated() @@ -78,9 +108,20 @@ ind = 0 for lin in aLines: curShape = lin.feature().lastResult().shape() massCenter = GeomAlgoAPI_ShapeTools.centreOfMass(curShape) - assert(fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE and fabs(massCenter.y() - REF_DATA[ind][1]) < TOLERANCE and massCenter.z() == 0), "({}, {}, {}) != ({}, {}, {})".format(massCenter.x(), massCenter.y(), massCenter.z(), REF_DATA[ind][0], REF_DATA[ind][1], 0.0) + assert ( + fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE + and fabs(massCenter.y() - REF_DATA[ind][1]) < TOLERANCE + and massCenter.z() == 0 + ), "({}, {}, {}) != ({}, {}, {})".format( + massCenter.x(), + massCenter.y(), + massCenter.z(), + REF_DATA[ind][0], + REF_DATA[ind][1], + 0.0, + ) ind += 1 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestMultiRotation05.py b/src/SketchPlugin/Test/TestMultiRotation05.py index abcbd8dd8..feb225a99 100644 --- a/src/SketchPlugin/Test/TestMultiRotation05.py +++ b/src/SketchPlugin/Test/TestMultiRotation05.py @@ -29,17 +29,24 @@ 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(10, 0, 30, 0) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() model.do() ROT_ANGLE = 20 ROT_COPIES = 15 -SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_1.result()], SketchAPI_Point(SketchPoint_1).coordinates(), ROT_ANGLE, ROT_COPIES) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchLine_1.result()], + SketchAPI_Point(SketchPoint_1).coordinates(), + ROT_ANGLE, + ROT_COPIES, +) model.do() # collect coordinates of centers as reference data -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 REF_DATA = [[]] aLines = SketchMultiRotation_1.rotated() for lin in aLines: @@ -53,7 +60,7 @@ FeatureMultiRotation = SketchMultiRotation_1.feature() # assign "reversed" flag FeatureMultiRotation.boolean("MultiRotationReversed").setValue(True) model.do() -assert(SketchMultiRotation_1.angle().value() == ROT_ANGLE) +assert SketchMultiRotation_1.angle().value() == ROT_ANGLE # check coordinates of center of mass of each line aLines = SketchMultiRotation_1.rotated() @@ -61,13 +68,24 @@ ind = 0 for lin in aLines: curShape = lin.feature().lastResult().shape() massCenter = GeomAlgoAPI_ShapeTools.centreOfMass(curShape) - assert(fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE and fabs(massCenter.y() + REF_DATA[ind][1]) < TOLERANCE and massCenter.z() == 0), "({}, {}, {}) != ({}, {}, {})".format(massCenter.x(), massCenter.y(), massCenter.z(), REF_DATA[ind][0], -REF_DATA[ind][1], 0.0) + assert ( + fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE + and fabs(massCenter.y() + REF_DATA[ind][1]) < TOLERANCE + and massCenter.z() == 0 + ), "({}, {}, {}) != ({}, {}, {})".format( + massCenter.x(), + massCenter.y(), + massCenter.z(), + REF_DATA[ind][0], + -REF_DATA[ind][1], + 0.0, + ) ind += 1 # drop "reversed" flag FeatureMultiRotation.boolean("MultiRotationReversed").setValue(False) model.do() -assert(SketchMultiRotation_1.angle().value() == ROT_ANGLE) +assert SketchMultiRotation_1.angle().value() == ROT_ANGLE # check coordinates of center of mass of each line aLines = SketchMultiRotation_1.rotated() @@ -75,13 +93,24 @@ ind = 0 for lin in aLines: curShape = lin.feature().lastResult().shape() massCenter = GeomAlgoAPI_ShapeTools.centreOfMass(curShape) - assert(fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE and fabs(massCenter.y() - REF_DATA[ind][1]) < TOLERANCE and massCenter.z() == 0), "({}, {}, {}) != ({}, {}, {})".format(massCenter.x(), massCenter.y(), massCenter.z(), REF_DATA[ind][0], REF_DATA[ind][1], 0.0) + assert ( + fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE + and fabs(massCenter.y() - REF_DATA[ind][1]) < TOLERANCE + and massCenter.z() == 0 + ), "({}, {}, {}) != ({}, {}, {})".format( + massCenter.x(), + massCenter.y(), + massCenter.z(), + REF_DATA[ind][0], + REF_DATA[ind][1], + 0.0, + ) ind += 1 # set angle value from single to full SketchMultiRotation_1.feature().string("AngleType").setValue("FullAngle") model.do() -assert(SketchMultiRotation_1.angle().value() == ROT_ANGLE*(ROT_COPIES - 1)) +assert SketchMultiRotation_1.angle().value() == ROT_ANGLE * (ROT_COPIES - 1) # check coordinates of center of mass of each line aLines = SketchMultiRotation_1.rotated() @@ -89,13 +118,24 @@ ind = 0 for lin in aLines: curShape = lin.feature().lastResult().shape() massCenter = GeomAlgoAPI_ShapeTools.centreOfMass(curShape) - assert(fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE and fabs(massCenter.y() - REF_DATA[ind][1]) < TOLERANCE and massCenter.z() == 0), "({}, {}, {}) != ({}, {}, {})".format(massCenter.x(), massCenter.y(), massCenter.z(), REF_DATA[ind][0], REF_DATA[ind][1], 0.0) + assert ( + fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE + and fabs(massCenter.y() - REF_DATA[ind][1]) < TOLERANCE + and massCenter.z() == 0 + ), "({}, {}, {}) != ({}, {}, {})".format( + massCenter.x(), + massCenter.y(), + massCenter.z(), + REF_DATA[ind][0], + REF_DATA[ind][1], + 0.0, + ) ind += 1 # assign "reversed" flag FeatureMultiRotation.boolean("MultiRotationReversed").setValue(True) model.do() -assert(SketchMultiRotation_1.angle().value() == ROT_ANGLE*(ROT_COPIES - 1)) +assert SketchMultiRotation_1.angle().value() == ROT_ANGLE * (ROT_COPIES - 1) # check coordinates of center of mass of each line aLines = SketchMultiRotation_1.rotated() @@ -103,9 +143,20 @@ ind = 0 for lin in aLines: curShape = lin.feature().lastResult().shape() massCenter = GeomAlgoAPI_ShapeTools.centreOfMass(curShape) - assert(fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE and fabs(massCenter.y() + REF_DATA[ind][1]) < TOLERANCE and massCenter.z() == 0), "({}, {}, {}) != ({}, {}, {})".format(massCenter.x(), massCenter.y(), massCenter.z(), REF_DATA[ind][0], -REF_DATA[ind][1], 0.0) + assert ( + fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE + and fabs(massCenter.y() + REF_DATA[ind][1]) < TOLERANCE + and massCenter.z() == 0 + ), "({}, {}, {}) != ({}, {}, {})".format( + massCenter.x(), + massCenter.y(), + massCenter.z(), + REF_DATA[ind][0], + -REF_DATA[ind][1], + 0.0, + ) ind += 1 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestMultiRotationWithParameter.py b/src/SketchPlugin/Test/TestMultiRotationWithParameter.py index ddc07c9ad..7d453740e 100644 --- a/src/SketchPlugin/Test/TestMultiRotationWithParameter.py +++ b/src/SketchPlugin/Test/TestMultiRotationWithParameter.py @@ -34,23 +34,46 @@ SketchLine_1 = Sketch_1.addLine(30, 20, 10, 20) SketchLine_2 = Sketch_1.addLine(10, 20, 10, 40) SketchLine_3 = Sketch_1.addLine(10, 40, 30, 40) SketchLine_4 = Sketch_1.addLine(30, 40, 30, 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()) +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()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) 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_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 10, 0) +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_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r", + ) + ], + model.selection(), + 10, + 0, +) model.do() # change parameters -N =[6, 5] +N = [6, 5] for n in N: Param.setValue(n) model.do() @@ -58,19 +81,32 @@ for n in N: model.do() # check coordinates of center of mass of each line -REF_DATA = [[-25.4415255451, 18.7810749942], - [-25.7237275125, -18.3926573083], - [9.54338762502, -30.1483623542], - [31.6218654326, -0.240055331703]] -TOLERANCE = 1.e-7 +REF_DATA = [ + [-25.4415255451, 18.7810749942], + [-25.7237275125, -18.3926573083], + [9.54338762502, -30.1483623542], + [31.6218654326, -0.240055331703], +] +TOLERANCE = 1.0e-7 aLines = SketchMultiRotation_1.rotated() ind = 0 for lin in aLines: curShape = lin.feature().lastResult().shape() massCenter = GeomAlgoAPI_ShapeTools.centreOfMass(curShape) - assert(fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE and fabs(massCenter.y() - REF_DATA[ind][1]) < TOLERANCE and massCenter.z() == 0), "({}, {}, {}) != ({}, {}, {})".format(massCenter.x(), massCenter.y(), massCenter.z(), REF_DATA[ind][0], REF_DATA[ind][1], 0.0) + assert ( + fabs(massCenter.x() - REF_DATA[ind][0]) < TOLERANCE + and fabs(massCenter.y() - REF_DATA[ind][1]) < TOLERANCE + and massCenter.z() == 0 + ), "({}, {}, {}) != ({}, {}, {})".format( + massCenter.x(), + massCenter.y(), + massCenter.z(), + REF_DATA[ind][0], + REF_DATA[ind][1], + 0.0, + ) ind += 1 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestMultiTranslation.py b/src/SketchPlugin/Test/TestMultiTranslation.py index 02aed600b..06500a9de 100644 --- a/src/SketchPlugin/Test/TestMultiTranslation.py +++ b/src/SketchPlugin/Test/TestMultiTranslation.py @@ -36,80 +36,83 @@ from GeomDataAPI import * from ModelAPI import * from salome.shaper import model -#========================================================================= + +# ========================================================================= # Auxiliary functions -#========================================================================= +# ========================================================================= def createSketch(theSketch): # Initialize sketch by arc allFeatures = [] # Create arc aSketchArc = theSketch.addFeature("SketchArc") - aCenter = geomDataAPI_Point2D(aSketchArc.attribute("center_point")) + aCenter = geomDataAPI_Point2D(aSketchArc.attribute("center_point")) aStartPoint = geomDataAPI_Point2D(aSketchArc.attribute("start_point")) - aEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("end_point")) - aCenter.setValue(5., 5.) - aStartPoint.setValue(10., 5.) - aEndPoint.setValue(5., 10.) + aEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("end_point")) + aCenter.setValue(5.0, 5.0) + aStartPoint.setValue(10.0, 5.0) + aEndPoint.setValue(5.0, 10.0) allFeatures.append(aSketchArc) theSketch.execute() return allFeatures + def createLine(theSketch): aSketchLine = theSketch.addFeature("SketchLine") aStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) - aEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) - aStartPoint.setValue(7., 5.) - aEndPoint.setValue(1., 3.) + aEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) + aStartPoint.setValue(7.0, 5.0) + aEndPoint.setValue(1.0, 3.0) theSketch.execute() return aSketchLine + def checkTranslation(theObjects, theNbObjects, theDeltaX, theDeltaY): # Verify distances of the objects and the number of copies aFeatures = [] aSize = theObjects.size() - for i in range (0, aSize): + for i in range(0, aSize): feat = ModelAPI_Feature.feature(theObjects.object(i)) - assert(feat is not None) + assert feat is not None aFeatures.append(feat) anInd = 0 for feat, next in zip(aFeatures[:-1], aFeatures[1:]): anInd = anInd + 1 - if (anInd > theNbObjects-1): + if anInd > theNbObjects - 1: anInd = 0 continue - assert(feat.getKind() == next.getKind()) + assert feat.getKind() == next.getKind() anAttributes = [] - if (feat.getKind() == "SketchLine"): - anAttributes.append('StartPoint') - anAttributes.append('EndPoint') - elif (feat.getKind() == "SketchArc"): - anAttributes.append('center_point') - anAttributes.append('start_point') - anAttributes.append('end_point') + if feat.getKind() == "SketchLine": + anAttributes.append("StartPoint") + anAttributes.append("EndPoint") + elif feat.getKind() == "SketchArc": + anAttributes.append("center_point") + anAttributes.append("start_point") + anAttributes.append("end_point") for attr in anAttributes: - aPoint1 = geomDataAPI_Point2D(feat.attribute(attr)) - aPoint2 = geomDataAPI_Point2D(next.attribute(attr)) - aDiffX = aPoint2.x() - aPoint1.x() - theDeltaX - aDiffY = aPoint2.y() - aPoint1.y() - theDeltaY - assert(aDiffX**2 + aDiffY**2 < 1.e-15) + aPoint1 = geomDataAPI_Point2D(feat.attribute(attr)) + aPoint2 = geomDataAPI_Point2D(next.attribute(attr)) + aDiffX = aPoint2.x() - aPoint1.x() - theDeltaX + aDiffY = aPoint2.y() - aPoint1.y() - theDeltaY + assert aDiffX**2 + aDiffY**2 < 1.0e-15 # Check the number of copies is as planed - assert(anInd == theNbObjects-1) + assert anInd == theNbObjects - 1 -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2015-09-18" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -120,25 +123,25 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Initialize sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aFeaturesList = createSketch(aSketchFeature) aSession.finishOperation() -assert(model.dof(aSketchFeature) == 5) -#========================================================================= +assert model.dof(aSketchFeature) == 5 +# ========================================================================= # Global variables -#========================================================================= -START_X = 0. -START_Y = 15. -DIR_X = 20. -DIR_Y = 10. -DELTA_X = -5. -DELTA_Y = 3. -#========================================================================= +# ========================================================================= +START_X = 0.0 +START_Y = 15.0 +DIR_X = 20.0 +DIR_Y = 10.0 +DELTA_X = -5.0 +DELTA_Y = 3.0 +# ========================================================================= # Create translation line -#========================================================================= +# ========================================================================= aSession.startOperation() aTransLine = aSketchFeature.addFeature("SketchLine") aTransLineStartPoint = geomDataAPI_Point2D(aTransLine.attribute("StartPoint")) @@ -146,16 +149,16 @@ aTransLineEndPoint = geomDataAPI_Point2D(aTransLine.attribute("EndPoint")) aTransLineStartPoint.setValue(START_X, START_Y) aTransLineEndPoint.setValue(START_X + DELTA_X, START_Y + DELTA_Y) aSession.finishOperation() -assert(model.dof(aSketchFeature) == 9) -#========================================================================= +assert model.dof(aSketchFeature) == 9 +# ========================================================================= # Create the Translation constraint -#========================================================================= +# ========================================================================= aSession.startOperation() aMultiTranslation = aSketchFeature.addFeature("SketchMultiTranslation") aTransList = aMultiTranslation.reflist("MultiTranslationList") for aFeature in aFeaturesList: aResult = modelAPI_ResultConstruction(aFeature.lastResult()) - assert(aResult is not None) + assert aResult is not None aTransList.append(aResult) aValueType = aMultiTranslation.string("ValueType") @@ -168,66 +171,66 @@ aNbCopies = aMultiTranslation.integer("MultiTranslationObjects") aNbCopies.setValue(2) aMultiTranslation.execute() aSession.finishOperation() -assert(model.dof(aSketchFeature) == 9) -#========================================================================= +assert model.dof(aSketchFeature) == 9 +# ========================================================================= # Verify the objects are moved for the specified distance -#========================================================================= +# ========================================================================= aTranslated = aMultiTranslation.reflist("ConstraintEntityB") checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y) -#========================================================================= +# ========================================================================= # Change number of copies and verify translation -#========================================================================= +# ========================================================================= aSession.startOperation() aNbCopies.setValue(3) aSession.finishOperation() aTranslated = aMultiTranslation.reflist("ConstraintEntityB") checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y) -assert(model.dof(aSketchFeature) == 9) +assert model.dof(aSketchFeature) == 9 -#========================================================================= +# ========================================================================= # Create new feature and add it into the Rotation -#========================================================================= +# ========================================================================= aSession.startOperation() aLine = createLine(aSketchFeature) aSession.finishOperation() aSession.startOperation() aResult = modelAPI_ResultConstruction(aLine.lastResult()) -assert(aResult is not None) +assert aResult is not None aTransList.append(aResult) aSession.finishOperation() checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y) -assert(model.dof(aSketchFeature) == 13) -#========================================================================= +assert model.dof(aSketchFeature) == 13 +# ========================================================================= # Move line and check the copies are moved too -#========================================================================= +# ========================================================================= aSession.startOperation() aStartPoint = geomDataAPI_Point2D(aLine.attribute("StartPoint")) -aStartPoint.setValue(12., 5.) +aStartPoint.setValue(12.0, 5.0) aSession.finishOperation() checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y) -assert(model.dof(aSketchFeature) == 13) -#========================================================================= +assert model.dof(aSketchFeature) == 13 +# ========================================================================= # Change number of copies and verify Rotation -#========================================================================= +# ========================================================================= aSession.startOperation() aNbCopies.setValue(2) aSession.finishOperation() checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y) -assert(model.dof(aSketchFeature) == 13) +assert model.dof(aSketchFeature) == 13 -#========================================================================= +# ========================================================================= # Remove a feature from the Rotation -#========================================================================= +# ========================================================================= aSession.startOperation() aRemoveIt = aTransList.object(0) aTransList.remove(aRemoveIt) aSession.finishOperation() checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y) -assert(model.dof(aSketchFeature) == 13) +assert model.dof(aSketchFeature) == 13 -#========================================================================= +# ========================================================================= # Clear the list of rotated features -#========================================================================= +# ========================================================================= aSession.startOperation() aTransList.clear() checkTranslation(aTranslated, 1, DELTA_X, DELTA_Y) @@ -235,9 +238,9 @@ checkTranslation(aTranslated, 1, DELTA_X, DELTA_Y) aTransList.append(aResult) aSession.finishOperation() checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y) -assert(model.dof(aSketchFeature) == 13) -#========================================================================= +assert model.dof(aSketchFeature) == 13 +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestOffset1.py b/src/SketchPlugin/Test/TestOffset1.py index fc30964b0..8b7fdecef 100644 --- a/src/SketchPlugin/Test/TestOffset1.py +++ b/src/SketchPlugin/Test/TestOffset1.py @@ -36,70 +36,72 @@ from ModelAPI import * import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2020-06-30" -#========================================================================= + +# ========================================================================= # Auxiliary functions -#========================================================================= +# ========================================================================= def normalize(theDir): aLen = math.hypot(theDir[0], theDir[1]) - if aLen < 1.e-10: + if aLen < 1.0e-10: aLen = 1.0 return [theDir[0] / aLen, theDir[1] / aLen] + def checkOffset(theListIn, theListOut, theOutToIn, theDist, isReversed, nbIn, nbOut): - TOL = 6.e-5 - aNbIn = theListIn.size() + TOL = 6.0e-5 + aNbIn = theListIn.size() aNbOut = theListOut.size() - #print("**checkOffset**") - assert (theListIn.size() == nbIn) - assert (theListOut.size() == nbOut) - assert (theOutToIn.size() == nbOut) + # print("**checkOffset**") + assert theListIn.size() == nbIn + assert theListOut.size() == nbOut + assert theOutToIn.size() == nbOut for ind in range(0, aNbOut): aFeatureOut = ModelAPI_Feature.feature(theListOut.object(ind)) - assert(aFeatureOut is not None) + assert aFeatureOut is not None anInInd = theOutToIn.value(ind) - if (anInInd == -1): - assert(aFeatureOut.getKind() == "SketchArc") + if anInInd == -1: + assert aFeatureOut.getKind() == "SketchArc" else: aFeatureIn = ModelAPI_Feature.feature(theListIn.object(anInInd)) - assert(aFeatureIn is not None) + assert aFeatureIn is not None - #print(aFeatureIn.getKind()) - if (aFeatureIn.getKind() == "SketchLine"): - assert(aFeatureOut.getKind() == aFeatureIn.getKind()) + # print(aFeatureIn.getKind()) + if aFeatureIn.getKind() == "SketchLine": + assert aFeatureOut.getKind() == aFeatureIn.getKind() # Line and its offset are parallel - aP1Out = geomDataAPI_Point2D(aFeatureOut.attribute('StartPoint')) - aP2Out = geomDataAPI_Point2D(aFeatureOut.attribute('EndPoint')) - aP1In = geomDataAPI_Point2D(aFeatureIn.attribute('StartPoint')) - aP2In = geomDataAPI_Point2D(aFeatureIn.attribute('EndPoint')) + aP1Out = geomDataAPI_Point2D(aFeatureOut.attribute("StartPoint")) + aP2Out = geomDataAPI_Point2D(aFeatureOut.attribute("EndPoint")) + aP1In = geomDataAPI_Point2D(aFeatureIn.attribute("StartPoint")) + aP2In = geomDataAPI_Point2D(aFeatureIn.attribute("EndPoint")) aDirOut = [aP2Out.x() - aP1Out.x(), aP2Out.y() - aP1Out.y()] - aDirIn = [ aP2In.x() - aP1In.x(), aP2In.y() - aP1In.y()] + aDirIn = [aP2In.x() - aP1In.x(), aP2In.y() - aP1In.y()] aCross = aDirOut[0] * aDirIn[1] - aDirOut[1] * aDirIn[0] assert math.fabs(aCross) < TOL, "aCross = {0}".format(aCross) - elif (aFeatureIn.getKind() == "SketchArc"): - assert(aFeatureOut.getKind() == aFeatureIn.getKind()) + elif aFeatureIn.getKind() == "SketchArc": + assert aFeatureOut.getKind() == aFeatureIn.getKind() # Arc and its offset have the same center - aCPOut = geomDataAPI_Point2D(aFeatureOut.attribute('center_point')) - aCPIn = geomDataAPI_Point2D(aFeatureIn.attribute('center_point')) - assert (math.fabs(aCPOut.x() - aCPIn.x()) < TOL) - assert (math.fabs(aCPOut.y() - aCPIn.y()) < TOL) + aCPOut = geomDataAPI_Point2D(aFeatureOut.attribute("center_point")) + aCPIn = geomDataAPI_Point2D(aFeatureIn.attribute("center_point")) + assert math.fabs(aCPOut.x() - aCPIn.x()) < TOL + assert math.fabs(aCPOut.y() - aCPIn.y()) < TOL -#========================================================================= +# ========================================================================= # Start of test -#========================================================================= +# ========================================================================= aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -110,39 +112,39 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Creation of an arc and two lines -#========================================================================= +# ========================================================================= # Arc aSession.startOperation() aSketchArc1 = aSketchFeature.addFeature("SketchArc") anArcCentr = geomDataAPI_Point2D(aSketchArc1.attribute("center_point")) -anArcCentr.setValue(10., 10.) +anArcCentr.setValue(10.0, 10.0) anArcStartPoint = geomDataAPI_Point2D(aSketchArc1.attribute("start_point")) -anArcStartPoint.setValue(50., 0.) +anArcStartPoint.setValue(50.0, 0.0) anArcEndPoint = geomDataAPI_Point2D(aSketchArc1.attribute("end_point")) -anArcEndPoint.setValue(0., 50.) +anArcEndPoint.setValue(0.0, 50.0) aSession.finishOperation() # Line 1 aSession.startOperation() aSketchLine1 = aSketchFeature.addFeature("SketchLine") aLine1StartPoint = geomDataAPI_Point2D(aSketchLine1.attribute("StartPoint")) aLine1EndPoint = geomDataAPI_Point2D(aSketchLine1.attribute("EndPoint")) -aLine1StartPoint.setValue(0., 50.) -aLine1EndPoint.setValue(-20., 0.) +aLine1StartPoint.setValue(0.0, 50.0) +aLine1EndPoint.setValue(-20.0, 0.0) aSession.finishOperation() # Line 2 aSession.startOperation() aSketchLine2 = aSketchFeature.addFeature("SketchLine") aLine2StartPoint = geomDataAPI_Point2D(aSketchLine2.attribute("StartPoint")) aLine2EndPoint = geomDataAPI_Point2D(aSketchLine2.attribute("EndPoint")) -aLine2StartPoint.setValue(50., 0.) -aLine2EndPoint.setValue(-20., 0.) +aLine2StartPoint.setValue(50.0, 0.0) +aLine2EndPoint.setValue(-20.0, 0.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 13) -#========================================================================= +assert model.dof(aSketchFeature) == 13 +# ========================================================================= # Link arc points and lines points by the coincidence constraints -#========================================================================= +# ========================================================================= aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintCoincidence") reflistA = aConstraint.refattr("ConstraintEntityA") @@ -167,10 +169,10 @@ reflistA.setAttr(aLine1EndPoint) reflistB.setAttr(aLine2EndPoint) aConstraint.execute() aSession.finishOperation() -assert (model.dof(aSketchFeature) == 7) -#========================================================================= +assert model.dof(aSketchFeature) == 7 +# ========================================================================= # Make offset for objects created above -#========================================================================= +# ========================================================================= VALUE = 13 IS_REVERSED = False aSession.startOperation() @@ -183,40 +185,40 @@ anOffset.real("offset_value").setValue(VALUE) anOffset.boolean("reversed").setValue(IS_REVERSED) anOffset.execute() aSession.finishOperation() -assert (model.dof(aSketchFeature) == 7) -#========================================================================= +assert model.dof(aSketchFeature) == 7 +# ========================================================================= # Verify all offset objects -#========================================================================= +# ========================================================================= aRefListA = anOffset.reflist("ConstraintEntityA") aRefListB = anOffset.reflist("ConstraintEntityB") anOffsetToBaseMap = anOffset.intArray("ConstraintEntityC") checkOffset(aRefListA, aRefListB, anOffsetToBaseMap, VALUE, IS_REVERSED, 3, 6) -assert (model.dof(aSketchFeature) == 7) +assert model.dof(aSketchFeature) == 7 -#========================================================================= +# ========================================================================= # Remove object from offset -#========================================================================= +# ========================================================================= aSession.startOperation() aRefListInitial.remove(aSketchLine2.lastResult()) aSession.finishOperation() checkOffset(aRefListA, aRefListB, anOffsetToBaseMap, VALUE, IS_REVERSED, 2, 4) -assert (model.dof(aSketchFeature) == 7) +assert model.dof(aSketchFeature) == 7 -#========================================================================= +# ========================================================================= # Clear list of objects -#========================================================================= +# ========================================================================= aSession.startOperation() aRefListInitial.clear() -#TODO: uncomment next line -#checkOffset(aRefListA, aRefListB, anOffsetToBaseMap, VALUE, IS_REVERSED, 0, 0) +# TODO: uncomment next line +# checkOffset(aRefListA, aRefListB, anOffsetToBaseMap, VALUE, IS_REVERSED, 0, 0) # add arc once again aRefListInitial.append(aSketchArc1.lastResult()) aSession.finishOperation() checkOffset(aRefListA, aRefListB, anOffsetToBaseMap, VALUE, IS_REVERSED, 1, 1) -assert (model.dof(aSketchFeature) == 7) +assert model.dof(aSketchFeature) == 7 -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestOffset2.py b/src/SketchPlugin/Test/TestOffset2.py index 288cac0a8..8513297e8 100644 --- a/src/SketchPlugin/Test/TestOffset2.py +++ b/src/SketchPlugin/Test/TestOffset2.py @@ -39,17 +39,21 @@ Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint()) model.do() -assert(model.dof(Sketch_1) == SKETCH_DOF) +assert model.dof(Sketch_1) == SKETCH_DOF ### Create SketchOffset -SketchOffset_1_objects = [SketchLine_1.result(), SketchArc_1.results()[1], SketchLine_2.result()] +SketchOffset_1_objects = [ + SketchLine_1.result(), + SketchArc_1.results()[1], + SketchLine_2.result(), +] SketchOffset_1 = Sketch_1.addOffset(SketchOffset_1_objects, 13, False) model.do() # DoF should not change -assert(model.dof(Sketch_1) == SKETCH_DOF) +assert model.dof(Sketch_1) == SKETCH_DOF # check number of features -assert(len(SketchOffset_1.offset()) == 5) +assert len(SketchOffset_1.offset()) == 5 model.testNbSubFeatures(Sketch_1, "SketchPoint", 0) model.testNbSubFeatures(Sketch_1, "SketchLine", 4) model.testNbSubFeatures(Sketch_1, "SketchArc", 4) @@ -58,4 +62,4 @@ model.testNbSubFeatures(Sketch_1, "SketchBSplinePeriodic", 0) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestOffset3.py b/src/SketchPlugin/Test/TestOffset3.py index 926522ce5..3b03e4c8c 100644 --- a/src/SketchPlugin/Test/TestOffset3.py +++ b/src/SketchPlugin/Test/TestOffset3.py @@ -32,7 +32,9 @@ SketchLine_1 = Sketch_1.addLine(0, 0, 0, 130) ### Create SketchProjection SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Origin"), False) SketchPoint_1 = SketchProjection_1.createdFeature() -Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) +Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates() +) Sketch_1.setVertical(SketchLine_1.result()) Sketch_1.setLength(SketchLine_1.result(), 130) @@ -42,23 +44,29 @@ Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) Sketch_1.setLength(SketchLine_2.result(), 60) ### Create SketchLine -SketchLine_3 = Sketch_1.addLine(52.63824701112046, 101.2039073554021, 199.7207674554361, 130.6442229064876) +SketchLine_3 = Sketch_1.addLine( + 52.63824701112046, 101.2039073554021, 199.7207674554361, 130.6442229064876 +) Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) Sketch_1.setLength(SketchLine_3.result(), 150) ### Create SketchConstraintAngle -Sketch_1.setAngle(SketchLine_3.result(), SketchLine_2.result(), 140, type = "Direct") +Sketch_1.setAngle(SketchLine_3.result(), SketchLine_2.result(), 140, type="Direct") ### Create SketchLine -SketchLine_4 = Sketch_1.addLine(158.0815949372134, 7.493180231252017, 199.7207674554361, 130.6442229064876) +SketchLine_4 = Sketch_1.addLine( + 158.0815949372134, 7.493180231252017, 199.7207674554361, 130.6442229064876 +) Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.endPoint()) Sketch_1.setLength(SketchLine_4.result(), 130) ### Create SketchConstraintAngle -Sketch_1.setAngle(SketchLine_3.result(), SketchLine_4.result(), 60, type = "Direct") +Sketch_1.setAngle(SketchLine_3.result(), SketchLine_4.result(), 60, type="Direct") ### Create SketchLine -SketchLine_5 = Sketch_1.addLine(158.0815949372134, 7.493180231252017, 106.6596776583922, 54.98830022657437) +SketchLine_5 = Sketch_1.addLine( + 158.0815949372134, 7.493180231252017, 106.6596776583922, 54.98830022657437 +) Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_5.startPoint()) Sketch_1.setLength(SketchLine_5.result(), 70) @@ -69,38 +77,49 @@ Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_1.startPoint()) Sketch_1.setLength(SketchLine_6.result(), 120) ### Create SketchConstraintAngle -Sketch_1.setAngle(SketchLine_6.result(), SketchLine_5.result(), 110, type = "Direct") +Sketch_1.setAngle(SketchLine_6.result(), SketchLine_5.result(), 110, type="Direct") ### SketchOffset objects -SketchOffset_objects = [SketchLine_1.result(), SketchLine_2.result(), SketchLine_3.result(), SketchLine_4.result(), SketchLine_5.result(), SketchLine_6.result()] +SketchOffset_objects = [ + SketchLine_1.result(), + SketchLine_2.result(), + SketchLine_3.result(), + SketchLine_4.result(), + SketchLine_5.result(), + SketchLine_6.result(), +] ### 1. "KeepDistance" mode -SketchOffset_1 = Sketch_1.addOffset(SketchOffset_objects, 8, False, "KeepDistance") # outside -SketchOffset_2 = Sketch_1.addOffset(SketchOffset_objects, 8, True, "KeepDistance") # inside +SketchOffset_1 = Sketch_1.addOffset( + SketchOffset_objects, 8, False, "KeepDistance" +) # outside +SketchOffset_2 = Sketch_1.addOffset( + SketchOffset_objects, 8, True, "KeepDistance" +) # inside model.do() -assert(len(SketchOffset_1.offset()) == 10) -assert(len(SketchOffset_2.offset()) == 8) +assert len(SketchOffset_1.offset()) == 10 +assert len(SketchOffset_2.offset()) == 8 ### 2. "Arcs" mode -SketchOffset_3 = Sketch_1.addOffset(SketchOffset_objects, 16, False, "Arcs") # outside -SketchOffset_4 = Sketch_1.addOffset(SketchOffset_objects, 16, True, "Arcs") # inside +SketchOffset_3 = Sketch_1.addOffset(SketchOffset_objects, 16, False, "Arcs") # outside +SketchOffset_4 = Sketch_1.addOffset(SketchOffset_objects, 16, True, "Arcs") # inside model.do() -assert(len(SketchOffset_3.offset()) == 12) -assert(len(SketchOffset_4.offset()) == 12) +assert len(SketchOffset_3.offset()) == 12 +assert len(SketchOffset_4.offset()) == 12 ### 3. "Lines" mode -SketchOffset_5 = Sketch_1.addOffset(SketchOffset_objects, 24, False, "Lines") # outside -SketchOffset_6 = Sketch_1.addOffset(SketchOffset_objects, 24, True, "Lines") # inside +SketchOffset_5 = Sketch_1.addOffset(SketchOffset_objects, 24, False, "Lines") # outside +SketchOffset_6 = Sketch_1.addOffset(SketchOffset_objects, 24, True, "Lines") # inside model.do() -assert(len(SketchOffset_5.offset()) == 6) -assert(len(SketchOffset_6.offset()) == 6) +assert len(SketchOffset_5.offset()) == 6 +assert len(SketchOffset_6.offset()) == 6 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestOffset4.py b/src/SketchPlugin/Test/TestOffset4.py index 81a6d8265..ac73da6fa 100644 --- a/src/SketchPlugin/Test/TestOffset4.py +++ b/src/SketchPlugin/Test/TestOffset4.py @@ -22,9 +22,9 @@ from salome.shaper import model -#========================================================================= +# ========================================================================= # Creation of a document and sketch -#========================================================================= +# ========================================================================= model.begin() partSet = model.moduleDocument() @@ -33,9 +33,9 @@ partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) -#========================================================================= +# ========================================================================= # Creation of a testing B-spline -#========================================================================= +# ========================================================================= ### Create SketchPoint SketchPoint_1 = Sketch_1.addPoint(0, 0) @@ -262,67 +262,250 @@ SketchPoint_56 = Sketch_1.addPoint(0.009866240000000002, -0.08397866) SketchPoint_56.setAuxiliary(True) ### Create SketchBSpline -SketchBSpline_1_poles = [(0, 0), - (9.014752251795682e-05, 0.05451214529317949), - (0.02532271171862411, 0.15579971775632), - (0.1083431350565314, 0.2748971692083296), - (0.2055162110916063, 0.3762476714704591), - (0.3226869043516477, 0.4417758873955893), - (0.4396106030030269, 0.5114950821406695), - (0.5686113665746824, 0.5543315380381274), - (0.7080109281378321, 0.6032643908580265), - (0.8627418437966349, 0.6310529967664337), - (1.038760710497959, 0.658153841986185), - (1.22044861142381, 0.6481760900098785), - (1.409221724680022, 0.652722089409154), - (1.576578009046891, 0.6165884029638471), - (1.750622207371201, 0.6101568179490738), - (1.923498511038718, 0.5633997285939256), - (2.101468637706691, 0.5160168977121142), - (2.26756869845679, 0.4799182653430439), - (2.415109663038519, 0.4380247760586003), - (2.559003214216268, 0.3937264274604114), - (2.717970834232034, 0.3510185960290838), - (2.881379255194576, 0.2994130045705585), - (3.044331614256414, 0.2554589350745441), - (3.196663224032949, 0.2002205281261157), - (3.35069087314937, 0.1557508658621287), - (3.498630901739528, 0.1100749985226144), - (3.626758629069007, 0.07354615416618171), - (3.739427723854896, 0.03597634464461345), - (3.813716543275791, 0.02837078095396758), - (3.876876038873482, -0.02879298081488075), - (3.682323148493558, 0.01775150116288641), - (3.59938700895519, 0.01042701260276316), - (3.435447203044759, 0.007149079513330239), - (3.314513764134776, -0.02220772128681934), - (3.182869424552179, -0.05232760411385898), - (3.042896269666394, -0.100514554949581), - (2.881422363667536, -0.1529357624091178), - (2.715356347244389, -0.2233467064371046), - (2.550824101050389, -0.2921770145749832), - (2.405271709687486, -0.3565989754466863), - (2.262755596020973, -0.4148284616349733), - (2.100460548570712, -0.490254433165252), - (1.907228846355101, -0.5500679945331017), - (1.712805296160232, -0.627643180207678), - (1.521165382362285, -0.66728412705947), - (1.336949022926033, -0.6896647036620358), - (1.155869424658838, -0.7022133877004375), - (0.9881820016357848, -0.7038771014232653), - (0.8328845467272493, -0.6739914151454918), - (0.6860350214810707, -0.638614040735098), - (0.5400698242489836, -0.6015646418675653), - (0.4182804086275665, -0.5270754227323547), - (0.302266907807943, -0.4533758717656259), - (0.1873191972961234, -0.3753781603200299), - (0.1039872761267704, -0.2741082432964857), - (0.04328037620103962, -0.1770551690563165), - (0.006988972040230026, -0.08835445483623842), - (-0.0008115069204040052, -0.02871741534942534), - (0, 0) - ] -SketchBSpline_1 = Sketch_1.addSpline(degree = 3, poles = SketchBSpline_1_poles, weights = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], knots = [0, 0.01841877717868692, 0.03640857044229438, 0.0503319019589481, 0.06751503486217877, 0.08331688612829682, 0.09815550484724707, 0.1151806897007172, 0.1352802264972665, 0.1533760897133781, 0.1776976203324573, 0.1991289647725509, 0.2196078542088847, 0.2376437370925934, 0.2601966555045284, 0.2823272796231457, 0.3025579520551492, 0.3199893311119836, 0.3363024715699076, 0.3555578894595023, 0.3779215054846461, 0.3966205779803185, 0.4149403217914447, 0.43491563393835, 0.453062794308183, 0.4693759347661071, 0.4820291845192418, 0.4942387027706504, 0.496746319874324, 0.5066094106685624, 0.5312792857910991, 0.5454960476108249, 0.5602561299909423, 0.5757710096568369, 0.592796194510307, 0.6123837212555427, 0.6354982845523691, 0.6562477832463178, 0.6751789135618669, 0.6915216952124962, 0.7104486749233012, 0.7380977836510125, 0.762628078574017, 0.7839805979515587, 0.8067422887543781, 0.8279279725980087, 0.8479059568735401, 0.8655249471990413, 0.8833680589533851, 0.9012352967057089, 0.9180940098763235, 0.9332074432767975, 0.9497886416105058, 0.9666426179720728, 0.9788770179440802, 0.9900778977399243, 1], multiplicities = [4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4]) +SketchBSpline_1_poles = [ + (0, 0), + (9.014752251795682e-05, 0.05451214529317949), + (0.02532271171862411, 0.15579971775632), + (0.1083431350565314, 0.2748971692083296), + (0.2055162110916063, 0.3762476714704591), + (0.3226869043516477, 0.4417758873955893), + (0.4396106030030269, 0.5114950821406695), + (0.5686113665746824, 0.5543315380381274), + (0.7080109281378321, 0.6032643908580265), + (0.8627418437966349, 0.6310529967664337), + (1.038760710497959, 0.658153841986185), + (1.22044861142381, 0.6481760900098785), + (1.409221724680022, 0.652722089409154), + (1.576578009046891, 0.6165884029638471), + (1.750622207371201, 0.6101568179490738), + (1.923498511038718, 0.5633997285939256), + (2.101468637706691, 0.5160168977121142), + (2.26756869845679, 0.4799182653430439), + (2.415109663038519, 0.4380247760586003), + (2.559003214216268, 0.3937264274604114), + (2.717970834232034, 0.3510185960290838), + (2.881379255194576, 0.2994130045705585), + (3.044331614256414, 0.2554589350745441), + (3.196663224032949, 0.2002205281261157), + (3.35069087314937, 0.1557508658621287), + (3.498630901739528, 0.1100749985226144), + (3.626758629069007, 0.07354615416618171), + (3.739427723854896, 0.03597634464461345), + (3.813716543275791, 0.02837078095396758), + (3.876876038873482, -0.02879298081488075), + (3.682323148493558, 0.01775150116288641), + (3.59938700895519, 0.01042701260276316), + (3.435447203044759, 0.007149079513330239), + (3.314513764134776, -0.02220772128681934), + (3.182869424552179, -0.05232760411385898), + (3.042896269666394, -0.100514554949581), + (2.881422363667536, -0.1529357624091178), + (2.715356347244389, -0.2233467064371046), + (2.550824101050389, -0.2921770145749832), + (2.405271709687486, -0.3565989754466863), + (2.262755596020973, -0.4148284616349733), + (2.100460548570712, -0.490254433165252), + (1.907228846355101, -0.5500679945331017), + (1.712805296160232, -0.627643180207678), + (1.521165382362285, -0.66728412705947), + (1.336949022926033, -0.6896647036620358), + (1.155869424658838, -0.7022133877004375), + (0.9881820016357848, -0.7038771014232653), + (0.8328845467272493, -0.6739914151454918), + (0.6860350214810707, -0.638614040735098), + (0.5400698242489836, -0.6015646418675653), + (0.4182804086275665, -0.5270754227323547), + (0.302266907807943, -0.4533758717656259), + (0.1873191972961234, -0.3753781603200299), + (0.1039872761267704, -0.2741082432964857), + (0.04328037620103962, -0.1770551690563165), + (0.006988972040230026, -0.08835445483623842), + (-0.0008115069204040052, -0.02871741534942534), + (0, 0), +] +SketchBSpline_1 = Sketch_1.addSpline( + degree=3, + poles=SketchBSpline_1_poles, + weights=[ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + ], + knots=[ + 0, + 0.01841877717868692, + 0.03640857044229438, + 0.0503319019589481, + 0.06751503486217877, + 0.08331688612829682, + 0.09815550484724707, + 0.1151806897007172, + 0.1352802264972665, + 0.1533760897133781, + 0.1776976203324573, + 0.1991289647725509, + 0.2196078542088847, + 0.2376437370925934, + 0.2601966555045284, + 0.2823272796231457, + 0.3025579520551492, + 0.3199893311119836, + 0.3363024715699076, + 0.3555578894595023, + 0.3779215054846461, + 0.3966205779803185, + 0.4149403217914447, + 0.43491563393835, + 0.453062794308183, + 0.4693759347661071, + 0.4820291845192418, + 0.4942387027706504, + 0.496746319874324, + 0.5066094106685624, + 0.5312792857910991, + 0.5454960476108249, + 0.5602561299909423, + 0.5757710096568369, + 0.592796194510307, + 0.6123837212555427, + 0.6354982845523691, + 0.6562477832463178, + 0.6751789135618669, + 0.6915216952124962, + 0.7104486749233012, + 0.7380977836510125, + 0.762628078574017, + 0.7839805979515587, + 0.8067422887543781, + 0.8279279725980087, + 0.8479059568735401, + 0.8655249471990413, + 0.8833680589533851, + 0.9012352967057089, + 0.9180940098763235, + 0.9332074432767975, + 0.9497886416105058, + 0.9666426179720728, + 0.9788770179440802, + 0.9900778977399243, + 1, + ], + multiplicities=[ + 4, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 4, + ], +) Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchBSpline_1.startPoint()) Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchBSpline_1.endPoint()) Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchBSpline_1.result()) @@ -383,16 +566,16 @@ Sketch_1.setCoincident(SketchPoint_56.coordinates(), SketchBSpline_1.result()) model.do() -#========================================================================= +# ========================================================================= # Make offset for testing B-spline -#========================================================================= +# ========================================================================= # This B-spline still failes on larger values and even smaller in reversed mode. -# But we still consider this as an impruvement because without approximation +# But we still consider this as an impruvement because without approximation # we have only "Offset algorithm failed" with the same conditions. # Common offset params -SketchOffset_1_objects = [ SketchBSpline_1 ] +SketchOffset_1_objects = [SketchBSpline_1] jointType = "KeepDistance" isApproximated = True @@ -400,20 +583,23 @@ isApproximated = True offsetValue = 10 isReversed = False -SketchOffset_1 = Sketch_1.addOffset(SketchOffset_1_objects, offsetValue, isReversed, jointType, isApproximated) +SketchOffset_1 = Sketch_1.addOffset( + SketchOffset_1_objects, offsetValue, isReversed, jointType, isApproximated +) model.do() # Hardcoded value was obtained by running the same script from SALOME Python Console. -assert(len(SketchOffset_1.offset()) == 124) +assert len(SketchOffset_1.offset()) == 124 # Test reversed offset offsetValue = 0.5 isReversed = True -SketchOffset_2 = Sketch_1.addOffset(SketchOffset_1_objects, offsetValue, isReversed, jointType, isApproximated) +SketchOffset_2 = Sketch_1.addOffset( + SketchOffset_1_objects, offsetValue, isReversed, jointType, isApproximated +) model.do() -assert(len(SketchOffset_2.offset()) == 101) +assert len(SketchOffset_2.offset()) == 101 model.end() - diff --git a/src/SketchPlugin/Test/TestPresentation.py b/src/SketchPlugin/Test/TestPresentation.py index 5cab8c98c..c50a038d6 100644 --- a/src/SketchPlugin/Test/TestPresentation.py +++ b/src/SketchPlugin/Test/TestPresentation.py @@ -28,67 +28,196 @@ from ModelAPI import * from GeomDataAPI import * from ConfigAPI import * -Config_PropManager().registerProp("Visualization", "dimension_value_size", "Dimension value size", Config_Prop.IntSpin, "16") -Config_PropManager().registerProp("Visualization", "sketch_dimension_color", "Dimension color", Config_Prop.Color, "64,128,255") + +Config_PropManager().registerProp( + "Visualization", + "dimension_value_size", + "Dimension value size", + Config_Prop.IntSpin, + "16", +) +Config_PropManager().registerProp( + "Visualization", + "sketch_dimension_color", + "Dimension color", + Config_Prop.Color, + "64,128,255", +) 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) +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()) +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()) +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) +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) +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 +) model.end() @@ -97,8 +226,8 @@ 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) +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 @@ -112,7 +241,7 @@ 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) +assert featureToPresentation(aCircle).getAISObject(None) is not None aSession.finishOperation() # Test presentation for MacroArc on low-level @@ -126,7 +255,7 @@ 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) +assert featureToPresentation(anArc).getAISObject(None) is not None aSession.finishOperation() # Test presentation for MacroEllipse on low-level @@ -140,7 +269,7 @@ anEllipseType.setValue("by_center_axis_point") anEllipsePnt1.setValue(10, 0) anEllipsePnt2.setValue(-10, 0) anEllipsePnt3.setValue(0, 5) -assert(featureToPresentation(anEllipse).getAISObject(None) is not None) +assert featureToPresentation(anEllipse).getAISObject(None) is not None aSession.finishOperation() # Test presentation for MacroEllipticArc on low-level @@ -154,7 +283,7 @@ anEllipticArcPnt1.setValue(0, 0) anEllipticArcPnt2.setValue(10, 0) anEllipticArcPnt3.setValue(0, 5) anEllipticArcPnt4.setValue(-10, 0) -assert(featureToPresentation(anEllipticArc).getAISObject(None) is not None) +assert featureToPresentation(anEllipticArc).getAISObject(None) is not None aSession.finishOperation() # Test presentation for MacroBSpline on low-level @@ -173,7 +302,7 @@ aWeights.setValue(1, 2) aWeights.setValue(2, 2) aWeights.setValue(3, 1) aBSpline.boolean("need_control_poly").setValue(True) -assert(featureToPresentation(aBSpline).getAISObject(None) is not None) +assert featureToPresentation(aBSpline).getAISObject(None) is not None aSession.finishOperation() # Test presentation for MacroBSplinePeriodic on low-level @@ -192,5 +321,5 @@ aWeights.setValue(1, 2) aWeights.setValue(2, 2) aWeights.setValue(3, 1) aBSplineP.boolean("need_control_poly").setValue(True) -assert(featureToPresentation(aBSplineP).getAISObject(None) is not None) +assert featureToPresentation(aBSplineP).getAISObject(None) is not None aSession.finishOperation() diff --git a/src/SketchPlugin/Test/TestProjection.py b/src/SketchPlugin/Test/TestProjection.py index 17b70c147..3b1d49fbd 100644 --- a/src/SketchPlugin/Test/TestProjection.py +++ b/src/SketchPlugin/Test/TestProjection.py @@ -27,21 +27,21 @@ from ModelAPI import * import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2016-05-16" -#========================================================================= +# ========================================================================= # Start of test -#========================================================================= +# ========================================================================= aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchFeature = featureToCompositeFeature(aDocument.addFeature("Sketch")) origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) @@ -51,34 +51,34 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create a line, circle and arc -#========================================================================= +# ========================================================================= aSession.startOperation() aLine = aSketchFeature.addFeature("SketchLine") aLineStart = geomDataAPI_Point2D(aLine.attribute("StartPoint")) aLineEnd = geomDataAPI_Point2D(aLine.attribute("EndPoint")) -aLineStart.setValue(10., 10.) -aLineEnd.setValue(40., 30.) +aLineStart.setValue(10.0, 10.0) +aLineEnd.setValue(40.0, 30.0) aCircle = aSketchFeature.addFeature("SketchCircle") aCircleCenter = geomDataAPI_Point2D(aCircle.attribute("circle_center")) aCircleRadius = aCircle.real("circle_radius") -aCircleCenter.setValue(-25., -25) -aCircleRadius.setValue(25.) +aCircleCenter.setValue(-25.0, -25) +aCircleRadius.setValue(25.0) anArc = aSketchFeature.addFeature("SketchArc") anArcCenter = geomDataAPI_Point2D(anArc.attribute("center_point")) anArcStart = geomDataAPI_Point2D(anArc.attribute("start_point")) anArcEnd = geomDataAPI_Point2D(anArc.attribute("end_point")) -anArcCenter.setValue(10., 10.) -anArcStart.setValue(50., 0.) -anArcEnd.setValue(0., 50.) +anArcCenter.setValue(10.0, 10.0) +anArcStart.setValue(50.0, 0.0) +anArcEnd.setValue(0.0, 50.0) aSession.finishOperation() -assert (model.dof(aSketchFeature) == 12) -#========================================================================= +assert model.dof(aSketchFeature) == 12 +# ========================================================================= # Create another sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchFeature = featureToCompositeFeature(aDocument.addFeature("Sketch")) origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) @@ -88,69 +88,79 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Project all features onto the new sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aLineProjector = aSketchFeature.addFeature("SketchProjection") -aLineProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/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/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/SketchArc_1_2") +anArcProjector.selection("ExternalFeature").selectSubShape( + "EDGE", "Sketch_1/SketchArc_1_2" +) anArcProjector.boolean("IncludeToResult").setValue(False) anArcProjector.execute() aSession.finishOperation() -assert (model.dof(aSketchFeature) == 0) -#========================================================================= +assert model.dof(aSketchFeature) == 0 +# ========================================================================= # Check projection coordinates -#========================================================================= -aProjLine = ModelAPI_Feature.feature(aLineProjector.refattr("ProjectedFeature").object()) -assert(aProjLine) +# ========================================================================= +aProjLine = ModelAPI_Feature.feature( + aLineProjector.refattr("ProjectedFeature").object() +) +assert aProjLine aProjLineStart = geomDataAPI_Point2D(aProjLine.attribute("StartPoint")) aProjLineEnd = geomDataAPI_Point2D(aProjLine.attribute("EndPoint")) -assert(math.fabs(aProjLineStart.x() - aLineStart.x()) < 1.e-10) -assert(math.fabs(aProjLineStart.y() - aLineStart.y()) < 1.e-10) -assert(math.fabs(aProjLineEnd.x() - aLineEnd.x()) < 1.e-10) -assert(math.fabs(aProjLineEnd.y() - aLineEnd.y()) < 1.e-10) +assert math.fabs(aProjLineStart.x() - aLineStart.x()) < 1.0e-10 +assert math.fabs(aProjLineStart.y() - aLineStart.y()) < 1.0e-10 +assert math.fabs(aProjLineEnd.x() - aLineEnd.x()) < 1.0e-10 +assert math.fabs(aProjLineEnd.y() - aLineEnd.y()) < 1.0e-10 -aProjCircle = ModelAPI_Feature.feature(aCircleProjector.refattr("ProjectedFeature").object()) -assert(aProjCircle) +aProjCircle = ModelAPI_Feature.feature( + aCircleProjector.refattr("ProjectedFeature").object() +) +assert aProjCircle aProjCircleCenter = geomDataAPI_Point2D(aProjCircle.attribute("circle_center")) aProjCircleRadius = aProjCircle.real("circle_radius") -assert(math.fabs(aProjCircleCenter.x() - aCircleCenter.x()) < 1.e-10) -assert(math.fabs(aProjCircleCenter.y() - aCircleCenter.y()) < 1.e-10) -assert(math.fabs(aProjCircleRadius.value() - aCircleRadius.value()) < 1.e-10) +assert math.fabs(aProjCircleCenter.x() - aCircleCenter.x()) < 1.0e-10 +assert math.fabs(aProjCircleCenter.y() - aCircleCenter.y()) < 1.0e-10 +assert math.fabs(aProjCircleRadius.value() - aCircleRadius.value()) < 1.0e-10 aProjArc = ModelAPI_Feature.feature(anArcProjector.refattr("ProjectedFeature").object()) aProjArcCenter = geomDataAPI_Point2D(aProjArc.attribute("center_point")) aProjArcStart = geomDataAPI_Point2D(aProjArc.attribute("start_point")) aProjArcEnd = geomDataAPI_Point2D(aProjArc.attribute("end_point")) -assert(math.fabs(aProjArcCenter.x() - anArcCenter.x()) < 1.e-10) -assert(math.fabs(aProjArcCenter.y() - anArcCenter.y()) < 1.e-10) -assert(math.fabs(aProjArcStart.x() - anArcStart.x()) < 1.e-10) -assert(math.fabs(aProjArcStart.y() - anArcStart.y()) < 1.e-10) -assert(math.fabs(aProjArcEnd.x() - anArcEnd.x()) < 1.e-10) -assert(math.fabs(aProjArcEnd.y() - anArcEnd.y()) < 1.e-10) -#========================================================================= +assert math.fabs(aProjArcCenter.x() - anArcCenter.x()) < 1.0e-10 +assert math.fabs(aProjArcCenter.y() - anArcCenter.y()) < 1.0e-10 +assert math.fabs(aProjArcStart.x() - anArcStart.x()) < 1.0e-10 +assert math.fabs(aProjArcStart.y() - anArcStart.y()) < 1.0e-10 +assert math.fabs(aProjArcEnd.x() - anArcEnd.x()) < 1.0e-10 +assert math.fabs(aProjArcEnd.y() - anArcEnd.y()) < 1.0e-10 +# ========================================================================= # Move original feature and check the projection is agreed -#========================================================================= +# ========================================================================= aSession.startOperation() -aLineStart.setValue(20., 0.) +aLineStart.setValue(20.0, 0.0) aSession.finishOperation() -assert(math.fabs(aProjLineStart.x() - aLineStart.x()) < 1.e-10) -assert(math.fabs(aProjLineStart.y() - aLineStart.y()) < 1.e-10) -assert(math.fabs(aProjLineEnd.x() - aLineEnd.x()) < 1.e-10) -assert(math.fabs(aProjLineEnd.y() - aLineEnd.y()) < 1.e-10) -assert (model.dof(aSketchFeature) == 0) -#========================================================================= +assert math.fabs(aProjLineStart.x() - aLineStart.x()) < 1.0e-10 +assert math.fabs(aProjLineStart.y() - aLineStart.y()) < 1.0e-10 +assert math.fabs(aProjLineEnd.x() - aLineEnd.x()) < 1.0e-10 +assert math.fabs(aProjLineEnd.y() - aLineEnd.y()) < 1.0e-10 +assert model.dof(aSketchFeature) == 0 +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestProjectionBSpline.py b/src/SketchPlugin/Test/TestProjectionBSpline.py index 26f03264a..1c8686952 100644 --- a/src/SketchPlugin/Test/TestProjectionBSpline.py +++ b/src/SketchPlugin/Test/TestProjectionBSpline.py @@ -28,21 +28,35 @@ Point_3 = model.addPoint(Part_1_doc, -5, 10, 15) Point_4 = model.addPoint(Part_1_doc, 10, 0, 20) Point_5 = model.addPoint(Part_1_doc, 10, -10, 15) Point_6 = model.addPoint(Part_1_doc, -5, -5, 12) -Interpolation_1_objects = [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2"), model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_4"), model.selection("VERTEX", "Point_5")] -Interpolation_1 = model.addInterpolation(Part_1_doc, Interpolation_1_objects, False, False) +Interpolation_1_objects = [ + model.selection("VERTEX", "Point_1"), + model.selection("VERTEX", "Point_2"), + model.selection("VERTEX", "Point_3"), + model.selection("VERTEX", "Point_4"), + model.selection("VERTEX", "Point_5"), +] +Interpolation_1 = model.addInterpolation( + Part_1_doc, Interpolation_1_objects, False, False +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Interpolation_1_1"), True) +SketchProjection_1 = Sketch_2.addProjection( + model.selection("EDGE", "Interpolation_1_1"), True +) SketchBSpline_1 = SketchProjection_1.createdFeature() model.do() Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) -SketchProjection_2 = Sketch_3.addProjection(model.selection("EDGE", "Interpolation_1_1"), True) +SketchProjection_2 = Sketch_3.addProjection( + model.selection("EDGE", "Interpolation_1_1"), True +) SketchBSpline_2 = SketchProjection_2.createdFeature() model.do() Sketch_4 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) -SketchProjection_3 = Sketch_4.addProjection(model.selection("EDGE", "Interpolation_1_1"), True) +SketchProjection_3 = Sketch_4.addProjection( + model.selection("EDGE", "Interpolation_1_1"), True +) SketchBSpline_3 = SketchProjection_3.createdFeature() model.do() @@ -51,20 +65,25 @@ model.end() from GeomAPI import * import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + def checkProjection(theBSpline3D, theBSpline2D, theFlags): - assert(theBSpline2D.isEdge() and theBSpline2D.edge().isBSpline()) + assert theBSpline2D.isEdge() and theBSpline2D.edge().isBSpline() poles2D = GeomAPI_BSpline(GeomAPI_Curve(theBSpline2D)).poles() poles3D = theBSpline3D.poles() - assert(poles2D.size() == poles3D.size()) + assert poles2D.size() == poles3D.size() for p2d, p3d in zip(poles2D, poles3D): - assert(math.fabs((p2d.x() - p3d.x()) * theFlags.x()) < TOLERANCE and - math.fabs((p2d.y() - p3d.y()) * theFlags.y()) < TOLERANCE and - math.fabs((p2d.z() - p3d.z()) * theFlags.z()) < TOLERANCE) + assert ( + math.fabs((p2d.x() - p3d.x()) * theFlags.x()) < TOLERANCE + and math.fabs((p2d.y() - p3d.y()) * theFlags.y()) < TOLERANCE + and math.fabs((p2d.z() - p3d.z()) * theFlags.z()) < TOLERANCE + ) -bspline0 = GeomAPI_BSpline(GeomAPI_Curve(Interpolation_1.results()[-1].resultSubShapePair()[0].shape())) +bspline0 = GeomAPI_BSpline( + GeomAPI_Curve(Interpolation_1.results()[-1].resultSubShapePair()[0].shape()) +) bsplineShape1 = SketchBSpline_1.results()[-1].resultSubShapePair()[0].shape() checkProjection(bspline0, bsplineShape1, GeomAPI_Pnt(1, 1, 0)) @@ -75,4 +94,4 @@ checkProjection(bspline0, bsplineShape2, GeomAPI_Pnt(1, 0, 1)) bsplineShape3 = SketchBSpline_3.results()[-1].resultSubShapePair()[0].shape() checkProjection(bspline0, bsplineShape3, GeomAPI_Pnt(0, 1, 1)) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestProjectionBSplinePeriodic.py b/src/SketchPlugin/Test/TestProjectionBSplinePeriodic.py index 305ae134c..e5c4043d4 100644 --- a/src/SketchPlugin/Test/TestProjectionBSplinePeriodic.py +++ b/src/SketchPlugin/Test/TestProjectionBSplinePeriodic.py @@ -28,21 +28,35 @@ Point_3 = model.addPoint(Part_1_doc, -5, 10, 15) Point_4 = model.addPoint(Part_1_doc, 10, 0, 20) Point_5 = model.addPoint(Part_1_doc, 10, -10, 15) Point_6 = model.addPoint(Part_1_doc, -5, -5, 12) -Interpolation_1_objects = [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2"), model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_4"), model.selection("VERTEX", "Point_5")] -Interpolation_1 = model.addInterpolation(Part_1_doc, Interpolation_1_objects, True, False) +Interpolation_1_objects = [ + model.selection("VERTEX", "Point_1"), + model.selection("VERTEX", "Point_2"), + model.selection("VERTEX", "Point_3"), + model.selection("VERTEX", "Point_4"), + model.selection("VERTEX", "Point_5"), +] +Interpolation_1 = model.addInterpolation( + Part_1_doc, Interpolation_1_objects, True, False +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Interpolation_1_1"), True) +SketchProjection_1 = Sketch_2.addProjection( + model.selection("EDGE", "Interpolation_1_1"), True +) SketchBSpline_1 = SketchProjection_1.createdFeature() model.do() Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) -SketchProjection_2 = Sketch_3.addProjection(model.selection("EDGE", "Interpolation_1_1"), True) +SketchProjection_2 = Sketch_3.addProjection( + model.selection("EDGE", "Interpolation_1_1"), True +) SketchBSpline_2 = SketchProjection_2.createdFeature() model.do() Sketch_4 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) -SketchProjection_3 = Sketch_4.addProjection(model.selection("EDGE", "Interpolation_1_1"), True) +SketchProjection_3 = Sketch_4.addProjection( + model.selection("EDGE", "Interpolation_1_1"), True +) SketchBSpline_3 = SketchProjection_3.createdFeature() model.do() @@ -51,20 +65,25 @@ model.end() from GeomAPI import * import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 + def checkProjection(theBSpline3D, theBSpline2D, theFlags): - assert(theBSpline2D.isEdge() and theBSpline2D.edge().isBSpline()) + assert theBSpline2D.isEdge() and theBSpline2D.edge().isBSpline() poles2D = GeomAPI_BSpline(GeomAPI_Curve(theBSpline2D)).poles() poles3D = theBSpline3D.poles() - assert(poles2D.size() == poles3D.size()) + assert poles2D.size() == poles3D.size() for p2d, p3d in zip(poles2D, poles3D): - assert(math.fabs((p2d.x() - p3d.x()) * theFlags.x()) < TOLERANCE and - math.fabs((p2d.y() - p3d.y()) * theFlags.y()) < TOLERANCE and - math.fabs((p2d.z() - p3d.z()) * theFlags.z()) < TOLERANCE) + assert ( + math.fabs((p2d.x() - p3d.x()) * theFlags.x()) < TOLERANCE + and math.fabs((p2d.y() - p3d.y()) * theFlags.y()) < TOLERANCE + and math.fabs((p2d.z() - p3d.z()) * theFlags.z()) < TOLERANCE + ) -bspline0 = GeomAPI_BSpline(GeomAPI_Curve(Interpolation_1.results()[-1].resultSubShapePair()[0].shape())) +bspline0 = GeomAPI_BSpline( + GeomAPI_Curve(Interpolation_1.results()[-1].resultSubShapePair()[0].shape()) +) bsplineShape1 = SketchBSpline_1.results()[-1].resultSubShapePair()[0].shape() checkProjection(bspline0, bsplineShape1, GeomAPI_Pnt(1, 1, 0)) @@ -75,4 +94,4 @@ checkProjection(bspline0, bsplineShape2, GeomAPI_Pnt(1, 0, 1)) bsplineShape3 = SketchBSpline_3.results()[-1].resultSubShapePair()[0].shape() checkProjection(bspline0, bsplineShape3, GeomAPI_Pnt(0, 1, 1)) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestProjectionBSplinePeriodicError.py b/src/SketchPlugin/Test/TestProjectionBSplinePeriodicError.py index 76bc62885..5034bd13e 100644 --- a/src/SketchPlugin/Test/TestProjectionBSplinePeriodicError.py +++ b/src/SketchPlugin/Test/TestProjectionBSplinePeriodicError.py @@ -26,37 +26,45 @@ partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) ### Create SketchBSpline -SketchBSpline_1_poles = [(39.56361839352194, -91.51890167437574), - (70.21199762078012, -72.31423451653721), - (42.28382694294977, -41.98350738641304), - (67.28504300461098, -31.5470157767404), - (50.62385917039768, -3.473688794131494), - (86.7958072325187, 15.01252243343181) - ] -SketchBSpline_1 = Sketch_1.addSpline(poles = SketchBSpline_1_poles) +SketchBSpline_1_poles = [ + (39.56361839352194, -91.51890167437574), + (70.21199762078012, -72.31423451653721), + (42.28382694294977, -41.98350738641304), + (67.28504300461098, -31.5470157767404), + (50.62385917039768, -3.473688794131494), + (86.7958072325187, 15.01252243343181), +] +SketchBSpline_1 = Sketch_1.addSpline(poles=SketchBSpline_1_poles) ### Create SketchBSplinePeriodic -SketchBSplinePeriodic_1_poles = [(42.08285838974091, 63.92994506772382), - (45.90231280862586, 109.3628979208621), - (103.3091534085915, 74.17970450461429), - (80.27079545144119, 67.78674592116529), - (119.1440714423075, 30.71538726951938), - (57.61745686692009, 20.1653082760922) - ] -SketchBSplinePeriodic_1 = Sketch_1.addSpline(poles = SketchBSplinePeriodic_1_poles, periodic = True) +SketchBSplinePeriodic_1_poles = [ + (42.08285838974091, 63.92994506772382), + (45.90231280862586, 109.3628979208621), + (103.3091534085915, 74.17970450461429), + (80.27079545144119, 67.78674592116529), + (119.1440714423075, 30.71538726951938), + (57.61745686692009, 20.1653082760922), +] +SketchBSplinePeriodic_1 = Sketch_1.addSpline( + poles=SketchBSplinePeriodic_1_poles, periodic=True +) model.do() ### Create Sketch Sketch_2 = model.addSketch(partSet, model.defaultPlane("YOZ")) ### Create SketchProjection -SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchBSpline_1"), True) +SketchProjection_1 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchBSpline_1"), True +) SketchBSpline_2 = SketchProjection_1.createdFeature() ### Create SketchProjection -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchBSplinePeriodic_1"), True) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchBSplinePeriodic_1"), True +) model.do() model.end() -assert(SketchProjection_1.feature().error() == "") -assert(SketchProjection_2.feature().error() != "") +assert SketchProjection_1.feature().error() == "" +assert SketchProjection_2.feature().error() != "" diff --git a/src/SketchPlugin/Test/TestProjectionEllipse.py b/src/SketchPlugin/Test/TestProjectionEllipse.py index 8c03a4231..19b4fd477 100644 --- a/src/SketchPlugin/Test/TestProjectionEllipse.py +++ b/src/SketchPlugin/Test/TestProjectionEllipse.py @@ -28,21 +28,58 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(0, -100, 20) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 20) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchAPI_Line(SketchLine_1).startPoint(), 100, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchAPI_Line(SketchLine_1).startPoint(), 100, True +) model.do() -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), model.selection("EDGE", "PartSet/OX"), 30) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), model.selection("FACE", "Plane_1"), 0, model.selection(), 0) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOZ"), + model.selection("EDGE", "PartSet/OX"), + 30, +) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + model.selection("FACE", "Plane_1"), + 0, + model.selection(), + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]"), True) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]", + ), + True, +) SketchCircle_2 = SketchProjection_2.createdFeature() model.do() Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face]"), True) +SketchProjection_3 = Sketch_3.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face]", + ), + True, +) SketchEllipse_1 = SketchProjection_3.createdFeature() -SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]"), True) +SketchProjection_4 = Sketch_3.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]", + ), + True, +) SketchEllipse_2 = SketchProjection_4.createdFeature() model.do() model.end() @@ -50,10 +87,10 @@ model.end() from GeomAPI import * circle = SketchCircle_2.results()[-1].resultSubShapePair()[0].shape() -assert(circle.isEdge() and circle.edge().isCircle()) +assert circle.isEdge() and circle.edge().isCircle() ellipse1 = SketchEllipse_1.results()[-1].resultSubShapePair()[0].shape() -assert(ellipse1.isEdge() and ellipse1.edge().isEllipse()) +assert ellipse1.isEdge() and ellipse1.edge().isEllipse() ellipse2 = SketchEllipse_2.results()[-1].resultSubShapePair()[0].shape() -assert(ellipse2.isEdge() and ellipse2.edge().isEllipse()) +assert ellipse2.isEdge() and ellipse2.edge().isEllipse() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestProjectionEllipticArc.py b/src/SketchPlugin/Test/TestProjectionEllipticArc.py index 3da5d0333..cdff6bf74 100644 --- a/src/SketchPlugin/Test/TestProjectionEllipticArc.py +++ b/src/SketchPlugin/Test/TestProjectionEllipticArc.py @@ -26,27 +26,72 @@ 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/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchLine_2 = Sketch_1.addLine(-17.32050807568878, -110, 0, -100) SketchLine_3 = Sketch_1.addLine(0, -100, 10, -117.3205080756888) -SketchArc_1 = Sketch_1.addArc(0, -100, 10, -117.3205080756888, -17.32050807568878, -110, False) +SketchArc_1 = Sketch_1.addArc( + 0, -100, 10, -117.3205080756888, -17.32050807568878, -110, False +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 20) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_1.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchAPI_Line(SketchLine_1).startPoint(), 100, True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_2.endPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.startPoint()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_2.result(), SketchLine_3.result()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_1.result(), 150) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchAPI_Line(SketchLine_1).startPoint(), 100, True +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_2.endPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_2.result(), SketchLine_3.result() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_3.result(), SketchLine_1.result(), 150 +) model.do() -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), model.selection("EDGE", "PartSet/OX"), 30) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), model.selection("FACE", "Plane_1"), 0, model.selection(), 0) +Plane_4 = model.addPlane( + Part_1_doc, + model.selection("FACE", "PartSet/XOZ"), + model.selection("EDGE", "PartSet/OX"), + 30, +) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + model.selection("FACE", "Plane_1"), + 0, + model.selection(), + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2]"), True) +SketchProjection_2 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2]", + ), + True, +) SketchEllipticArc_1 = SketchProjection_2.createdFeature() -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2]"), True) +SketchProjection_3 = Sketch_2.addProjection( + model.selection( + "EDGE", + "[Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2]", + ), + True, +) SketchEllipticArc_2 = SketchProjection_3.createdFeature() model.do() model.end() @@ -54,8 +99,8 @@ model.end() from GeomAPI import * ellipse1 = SketchEllipticArc_1.results()[-1].resultSubShapePair()[0].shape() -assert(ellipse1.isEdge() and ellipse1.edge().isEllipse()) +assert ellipse1.isEdge() and ellipse1.edge().isEllipse() ellipse2 = SketchEllipticArc_2.results()[-1].resultSubShapePair()[0].shape() -assert(ellipse2.isEdge() and ellipse2.edge().isEllipse()) +assert ellipse2.isEdge() and ellipse2.edge().isEllipse() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestProjectionIntoResult.py b/src/SketchPlugin/Test/TestProjectionIntoResult.py index c4f7876e2..3f1120ca9 100644 --- a/src/SketchPlugin/Test/TestProjectionIntoResult.py +++ b/src/SketchPlugin/Test/TestProjectionIntoResult.py @@ -25,9 +25,10 @@ from salome.shaper import model from GeomAPI import * -#============================================================================== +# ============================================================================== # Auxiliary functions -#============================================================================== +# ============================================================================== + # Project all features from 'theProjected' list. # Argument 'theFailed' shows indices of projections which should fail because of validator @@ -37,8 +38,8 @@ def testProjections(theDocument, theSketch, theProjected, theFailed): edgeProj = set() for type, name in theProjected: proj = theSketch.addProjection(model.selection(type, name), True) - assert(bool(proj.feature().error() != '') == bool(ind in theFailed)) - if proj.feature().error() != '': + assert bool(proj.feature().error() != "") == bool(ind in theFailed) + if proj.feature().error() != "": if proj.createdFeature() is not None: theDocument.removeFeature(proj.createdFeature().feature()) theDocument.removeFeature(proj.feature()) @@ -61,90 +62,200 @@ def testProjections(theDocument, theSketch, theProjected, theFailed): model.testNbSubShapes(theSketch, GeomAPI_Shape.EDGE, [len(edgeProj) - num]) -#============================================================================== +# ============================================================================== # Initial 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(-187.9303398287678, -363.2915373234726, 182.2190183849013) -SketchArc_1 = Sketch_1.addArc(-229.9631763073051, -65.7360230979784, -105.4201011859997, -97.06956797196608, -326.3502666769664, 19.13032715412109, False) -SketchLine_1 = Sketch_1.addLine(-438.4308780225287, -71.00741660505224, 161.0737545348623, -582.1237015141244) +SketchCircle_1 = Sketch_1.addCircle( + -187.9303398287678, -363.2915373234726, 182.2190183849013 +) +SketchArc_1 = Sketch_1.addArc( + -229.9631763073051, + -65.7360230979784, + -105.4201011859997, + -97.06956797196608, + -326.3502666769664, + 19.13032715412109, + False, +) +SketchLine_1 = Sketch_1.addLine( + -438.4308780225287, -71.00741660505224, 161.0737545348623, -582.1237015141244 +) SketchPoint_1 = Sketch_1.addPoint(-446.0706301668712, -312.4620987423343) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchLine_2 = Sketch_2.addLine(27.19276215608871, 61.51157581079401, 72.96621462024476, 0) +SketchLine_2 = Sketch_2.addLine( + 27.19276215608871, 61.51157581079401, 72.96621462024476, 0 +) SketchLine_3 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_4 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_4.result()) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_4.result() +) SketchLine_5 = Sketch_2.addLine(72.96621462024476, 0, 0, 0) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_3.startPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_3.startPoint(), SketchLine_5.endPoint() +) SketchLine_6 = Sketch_2.addLine(0, 0, 0, 61.51157581079401) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_3.startPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_3.result()) -SketchLine_7 = Sketch_2.addLine(0, 61.51157581079401, 27.19276215608871, 61.51157581079401) -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_3.startPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.result() +) +SketchLine_7 = Sketch_2.addLine( + 0, 61.51157581079401, 27.19276215608871, 61.51157581079401 +) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +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_7r-SketchLine_6r-SketchLine_5r-SketchLine_2r")], 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/SketchCircle_1_2"), - ("EDGE", "Sketch_1/SketchArc_1_2"), - ("EDGE", "Sketch_1/SketchLine_1"), - ("VERTEX", "Sketch_1/SketchPoint_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&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&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&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&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]") - ] +# ============================================================================== + +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/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&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&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&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&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&Sketch_2/SketchLine_5")) +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&Sketch_2/SketchLine_7")) +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")) +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) @@ -153,12 +264,18 @@ Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To 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&Sketch_2/SketchLine_6")) +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&Sketch_2/SketchLine_2")) +Sketch_8 = model.addSketch( + Part_1_doc, + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2"), +) aFailedIDs = set() testProjections(Part_1_doc, Sketch_8, aProjectedList, aFailedIDs) diff --git a/src/SketchPlugin/Test/TestProjectionUpdate.py b/src/SketchPlugin/Test/TestProjectionUpdate.py index ab1426436..9b65ccdc4 100644 --- a/src/SketchPlugin/Test/TestProjectionUpdate.py +++ b/src/SketchPlugin/Test/TestProjectionUpdate.py @@ -31,7 +31,9 @@ SketchLine_1 = Sketch_1.addLine(20, -50, 70, 50) model.do() Sketch_2 = model.addSketch(partSet, model.defaultPlane("YOZ")) -SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), True) +SketchProjection_1 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), True +) model.do() # change the feature projected (no crash expected) diff --git a/src/SketchPlugin/Test/TestProjectionWithoutReference.py b/src/SketchPlugin/Test/TestProjectionWithoutReference.py index 4a62e6d50..dff4c9190 100644 --- a/src/SketchPlugin/Test/TestProjectionWithoutReference.py +++ b/src/SketchPlugin/Test/TestProjectionWithoutReference.py @@ -32,87 +32,95 @@ __updated__ = "2020-07-07" CURVES = [] PLANE = None -class TestProjectionWithoutRef(unittest.TestCase): - def setUp(self): - model.begin() - self.myDocument = model.moduleDocument() - self.mySketch = model.addSketch(partSet, model.selection("FACE", PLANE.name())) - self.myDOF = 0 - self.myNbPoints = 1 - self.myNbLines = 1 - self.myNbCircles = 0 - self.myNbArcs = 0 - self.myNbEllipses = 2 - self.myNbEllipticArcs = 2 - self.myNbSplines = 1 - self.myNbPeriodicSplines = 1 - self.myNbProjections = 0 - self.myNbFixedConstraints = 0 - self.myNbEdgesInSketch = 0 - - def tearDown(self): - self.checkDOF() - model.end() - model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) - model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) - model.testNbSubFeatures(self.mySketch, "SketchCircle", self.myNbCircles) - model.testNbSubFeatures(self.mySketch, "SketchArc", self.myNbArcs) - model.testNbSubFeatures(self.mySketch, "SketchEllipse", self.myNbEllipses) - model.testNbSubFeatures(self.mySketch, "SketchEllipticArc", self.myNbEllipticArcs) - model.testNbSubFeatures(self.mySketch, "SketchBSpline", self.myNbSplines) - model.testNbSubFeatures(self.mySketch, "SketchBSplinePeriodic", self.myNbPeriodicSplines) - model.testNbSubFeatures(self.mySketch, "SketchProjection", self.myNbProjections) - model.testNbSubFeatures(self.mySketch, "SketchConstraintRigid", self.myNbFixedConstraints) - nbEdges = 0 - exp = GeomAPI_ShapeExplorer(self.mySketch.defaultResult().shape(), GeomAPI_Shape.EDGE) - while exp.more(): nbEdges += 1; exp.next() - self.assertEqual(self.myNbEdgesInSketch, nbEdges) - - def checkDOF(self): - self.assertEqual(model.dof(self.mySketch), self.myDOF) - - - def test_projection_withref_includeintoresult(self): - """ Test 1. Projection with the reference to the original shapes. Projected curves are composed into the sketch result. - """ - for c in CURVES: - self.mySketch.addProjection(c, keepResult = True) - self.myNbProjections = len(CURVES) - self.myNbEdgesInSketch = len(CURVES) - 1 - - def test_projection_withref_notincludeintoresult(self): - """ Test 2. Projection with the reference to the original shapes. Projected curves are NOT included into the sketch result. - """ - for c in CURVES: - self.mySketch.addProjection(c, keepResult = False) - self.myNbProjections = len(CURVES) - - def test_projection_withoutref_noconstraints(self): - """ Test 3. Projection without the reference to the original shapes. No additional constraints applied. - """ - for c in CURVES: - self.mySketch.addProjection(c, keepRefToOriginal = False) - model.do() - self.myNbEdgesInSketch = len(CURVES) - 1 - self.myDOF += 2 + 4 + 5 + 7 + 5 + 7 + 6 * 2 + 6 * 2 - def test_projection_withoutref_fixed(self): - """ Test 4. Projection without the reference to the original shapes. Additionally, Fixed constraints applied. - """ - model.end() - # use the low-level API to access the necessary attributes - session = ModelAPI_Session.get() - for c in CURVES: - session.startOperation() - proj = featureToCompositeFeature(self.mySketch.feature()).addFeature("SketchProjection") - proj.boolean("IncludeToResult").setValue(False) - proj.string("keep_reference").setValue("False") - proj.boolean("make_fixed").setValue(True) - c.fillAttribute(proj.selection("ExternalFeature")) - session.finishOperation() - self.myNbEdgesInSketch = len(CURVES) - 1 - self.myNbFixedConstraints = len(CURVES) - model.begin() +class TestProjectionWithoutRef(unittest.TestCase): + def setUp(self): + model.begin() + self.myDocument = model.moduleDocument() + self.mySketch = model.addSketch(partSet, model.selection("FACE", PLANE.name())) + self.myDOF = 0 + self.myNbPoints = 1 + self.myNbLines = 1 + self.myNbCircles = 0 + self.myNbArcs = 0 + self.myNbEllipses = 2 + self.myNbEllipticArcs = 2 + self.myNbSplines = 1 + self.myNbPeriodicSplines = 1 + self.myNbProjections = 0 + self.myNbFixedConstraints = 0 + self.myNbEdgesInSketch = 0 + + def tearDown(self): + self.checkDOF() + model.end() + model.testNbSubFeatures(self.mySketch, "SketchPoint", self.myNbPoints) + model.testNbSubFeatures(self.mySketch, "SketchLine", self.myNbLines) + model.testNbSubFeatures(self.mySketch, "SketchCircle", self.myNbCircles) + model.testNbSubFeatures(self.mySketch, "SketchArc", self.myNbArcs) + model.testNbSubFeatures(self.mySketch, "SketchEllipse", self.myNbEllipses) + model.testNbSubFeatures( + self.mySketch, "SketchEllipticArc", self.myNbEllipticArcs + ) + model.testNbSubFeatures(self.mySketch, "SketchBSpline", self.myNbSplines) + model.testNbSubFeatures( + self.mySketch, "SketchBSplinePeriodic", self.myNbPeriodicSplines + ) + model.testNbSubFeatures(self.mySketch, "SketchProjection", self.myNbProjections) + model.testNbSubFeatures( + self.mySketch, "SketchConstraintRigid", self.myNbFixedConstraints + ) + nbEdges = 0 + exp = GeomAPI_ShapeExplorer( + self.mySketch.defaultResult().shape(), GeomAPI_Shape.EDGE + ) + while exp.more(): + nbEdges += 1 + exp.next() + self.assertEqual(self.myNbEdgesInSketch, nbEdges) + + def checkDOF(self): + self.assertEqual(model.dof(self.mySketch), self.myDOF) + + def test_projection_withref_includeintoresult(self): + """Test 1. Projection with the reference to the original shapes. Projected curves are composed into the sketch result.""" + for c in CURVES: + self.mySketch.addProjection(c, keepResult=True) + self.myNbProjections = len(CURVES) + self.myNbEdgesInSketch = len(CURVES) - 1 + + def test_projection_withref_notincludeintoresult(self): + """Test 2. Projection with the reference to the original shapes. Projected curves are NOT included into the sketch result.""" + for c in CURVES: + self.mySketch.addProjection(c, keepResult=False) + self.myNbProjections = len(CURVES) + + def test_projection_withoutref_noconstraints(self): + """Test 3. Projection without the reference to the original shapes. No additional constraints applied.""" + for c in CURVES: + self.mySketch.addProjection(c, keepRefToOriginal=False) + model.do() + self.myNbEdgesInSketch = len(CURVES) - 1 + self.myDOF += 2 + 4 + 5 + 7 + 5 + 7 + 6 * 2 + 6 * 2 + + def test_projection_withoutref_fixed(self): + """Test 4. Projection without the reference to the original shapes. Additionally, Fixed constraints applied.""" + model.end() + # use the low-level API to access the necessary attributes + session = ModelAPI_Session.get() + for c in CURVES: + session.startOperation() + proj = featureToCompositeFeature(self.mySketch.feature()).addFeature( + "SketchProjection" + ) + proj.boolean("IncludeToResult").setValue(False) + proj.string("keep_reference").setValue("False") + proj.boolean("make_fixed").setValue(True) + c.fillAttribute(proj.selection("ExternalFeature")) + session.finishOperation() + self.myNbEdgesInSketch = len(CURVES) - 1 + self.myNbFixedConstraints = len(CURVES) + model.begin() if __name__ == "__main__": @@ -120,25 +128,67 @@ if __name__ == "__main__": partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(35, -40) - CURVES.append(model.selection("VERTEX", Sketch_1.name() + "/" + SketchPoint_1.name())) + CURVES.append( + model.selection("VERTEX", Sketch_1.name() + "/" + SketchPoint_1.name()) + ) SketchLine_1 = Sketch_1.addLine(20, -15, 40, 15) CURVES.append(model.selection("EDGE", Sketch_1.name() + "/" + SketchLine_1.name())) SketchCircle_1 = Sketch_1.addCircle(65, -30, 20) - CURVES.append(model.selection("EDGE", Sketch_1.name() + "/" + SketchCircle_1.defaultResult().data().name())) + CURVES.append( + model.selection( + "EDGE", Sketch_1.name() + "/" + SketchCircle_1.defaultResult().data().name() + ) + ) SketchArc_1 = Sketch_1.addArc(60, 15, 80, 0, 50, 33, False) - CURVES.append(model.selection("EDGE", Sketch_1.name() + "/" + SketchArc_1.defaultResult().data().name())) + CURVES.append( + model.selection( + "EDGE", Sketch_1.name() + "/" + SketchArc_1.defaultResult().data().name() + ) + ) SketchEllipse_1 = Sketch_1.addEllipse(25, 30, 40, 30, 10) - CURVES.append(model.selection("EDGE", Sketch_1.name() + "/" + SketchEllipse_1.defaultResult().data().name())) + CURVES.append( + model.selection( + "EDGE", + Sketch_1.name() + "/" + SketchEllipse_1.defaultResult().data().name(), + ) + ) SketchEllipticArc_1 = Sketch_1.addEllipticArc(40, 70, 55, 70, 45, 50, 25, 56, False) - CURVES.append(model.selection("EDGE", Sketch_1.name() + "/" + SketchEllipticArc_1.defaultResult().data().name())) - SketchBSpline_1_poles = [(95, -50), (130, -10), (100, 10), (125, 45), (90, 70), (55, 45)] - SketchBSpline_1 = Sketch_1.addSpline(poles = SketchBSpline_1_poles) - CURVES.append(model.selection("EDGE", Sketch_1.name() + "/" + SketchBSpline_1.name())) - SketchBSplinePeriodic_1_poles = [(95, 80), (135, 90), (145, 55), (130, 30), (125, 70), (105, 60)] - SketchBSplinePeriodic_1 = Sketch_1.addSpline(poles = SketchBSplinePeriodic_1_poles, periodic = True) - CURVES.append(model.selection("EDGE", Sketch_1.name() + "/" + SketchBSplinePeriodic_1.name())) + CURVES.append( + model.selection( + "EDGE", + Sketch_1.name() + "/" + SketchEllipticArc_1.defaultResult().data().name(), + ) + ) + SketchBSpline_1_poles = [ + (95, -50), + (130, -10), + (100, 10), + (125, 45), + (90, 70), + (55, 45), + ] + SketchBSpline_1 = Sketch_1.addSpline(poles=SketchBSpline_1_poles) + CURVES.append( + model.selection("EDGE", Sketch_1.name() + "/" + SketchBSpline_1.name()) + ) + SketchBSplinePeriodic_1_poles = [ + (95, 80), + (135, 90), + (145, 55), + (130, 30), + (125, 70), + (105, 60), + ] + SketchBSplinePeriodic_1 = Sketch_1.addSpline( + poles=SketchBSplinePeriodic_1_poles, periodic=True + ) + CURVES.append( + model.selection("EDGE", Sketch_1.name() + "/" + SketchBSplinePeriodic_1.name()) + ) model.do() - PLANE = model.addPlane(partSet, model.selection("FACE", "XOY"), model.selection("EDGE", "OY"), 45) + PLANE = model.addPlane( + partSet, model.selection("FACE", "XOY"), model.selection("EDGE", "OY"), 45 + ) model.end() test_program = unittest.main(exit=False) diff --git a/src/SketchPlugin/Test/TestRectangle1.py b/src/SketchPlugin/Test/TestRectangle1.py index df9665271..2233f5202 100644 --- a/src/SketchPlugin/Test/TestRectangle1.py +++ b/src/SketchPlugin/Test/TestRectangle1.py @@ -28,43 +28,50 @@ from GeomAPI import * import math from salome.shaper import model -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2016-02-05" -#========================================================================= +# ========================================================================= # Auxiliary functions -#========================================================================= +# ========================================================================= def isHorizontal(line): aStart = geomDataAPI_Point2D(line.attribute("StartPoint")) - aEnd = geomDataAPI_Point2D(line.attribute("EndPoint")) + aEnd = geomDataAPI_Point2D(line.attribute("EndPoint")) return aStart.y() == aEnd.y() + def isVertical(line): aStart = geomDataAPI_Point2D(line.attribute("StartPoint")) - aEnd = geomDataAPI_Point2D(line.attribute("EndPoint")) + aEnd = geomDataAPI_Point2D(line.attribute("EndPoint")) return aStart.x() == aEnd.x() + def isPerpendicular(line1, line2, tolerance): aStart1 = geomDataAPI_Point2D(line1.attribute("StartPoint")) - aEnd1 = geomDataAPI_Point2D(line1.attribute("EndPoint")) + aEnd1 = geomDataAPI_Point2D(line1.attribute("EndPoint")) aStart2 = geomDataAPI_Point2D(line2.attribute("StartPoint")) - aEnd2 = geomDataAPI_Point2D(line2.attribute("EndPoint")) - anAngle = abs(GeomAPI_Angle2d(aStart1.pnt(), aEnd1.pnt(), aStart2.pnt(), aEnd2.pnt()).angleDegree()) - #print("Angle = ", anAngle) - return abs(anAngle-90) < tolerance # or abs(anAngle-270) < tolerance + aEnd2 = geomDataAPI_Point2D(line2.attribute("EndPoint")) + anAngle = abs( + GeomAPI_Angle2d( + aStart1.pnt(), aEnd1.pnt(), aStart2.pnt(), aEnd2.pnt() + ).angleDegree() + ) + # print("Angle = ", anAngle) + return abs(anAngle - 90) < tolerance # or abs(anAngle-270) < tolerance + -#========================================================================= +# ========================================================================= # Start of test -#========================================================================= +# ========================================================================= aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchFeature = featureToCompositeFeature(aDocument.addFeature("Sketch")) origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) @@ -74,65 +81,65 @@ dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Create a rectangle -#========================================================================= +# ========================================================================= aSession.startOperation() aRectangle = aSketchFeature.addFeature("SketchRectangle") aRectangle.string("RectangleType").setValue("RectangleTypeByCorners") aStartCorner = geomDataAPI_Point2D(aRectangle.attribute("RectStartPoint")) aEndCorner = geomDataAPI_Point2D(aRectangle.attribute("RectEndPoint")) -aStartCorner.setValue(10., 10.) -aEndCorner.setValue(40., 30.) +aStartCorner.setValue(10.0, 10.0) +aEndCorner.setValue(40.0, 30.0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Check the lines of rectangle are parallel to the axes -#========================================================================= +# ========================================================================= aNbSubs = aSketchFeature.numberOfSubs() aNbLines = 0 -for i in range (0, aNbSubs): +for i in range(0, aNbSubs): aFeature = objectToFeature(aSketchFeature.subFeature(i)) if aFeature.getKind() == "SketchLine": aLastLine = aFeature - assert (isHorizontal(aLastLine) or isVertical(aLastLine)) + assert isHorizontal(aLastLine) or isVertical(aLastLine) aNbLines = aNbLines + 1 -assert (aNbLines == 4) -assert (model.dof(aSketchFeature) == 5) -#========================================================================= +assert aNbLines == 4 +assert model.dof(aSketchFeature) == 5 +# ========================================================================= # Move one of lines -#========================================================================= +# ========================================================================= aSession.startOperation() aLineEnd = geomDataAPI_Point2D(aLastLine.attribute("EndPoint")) -aLineEnd.setValue(41., 30.) +aLineEnd.setValue(41.0, 30.0) aSession.finishOperation() -#========================================================================= +# ========================================================================= # Check that we have still two pairs of lines with same length # and that connected lines are perpendicular -#========================================================================= +# ========================================================================= aNbSubs = aSketchFeature.numberOfSubs() aNbLines = 0 -tolerance = 1.e-5 +tolerance = 1.0e-5 valref = [0, 0] aPrevLine = None -for i in range (0, aNbSubs): +for i in range(0, aNbSubs): aFeature = objectToFeature(aSketchFeature.subFeature(i)) if aFeature.getKind() == "SketchLine": aLastLine = aFeature # Opposite lines must have same length edgeLen = aLastLine.lastResult().shape().edge().length() - if (valref[i%2] == 0): - valref[i%2] = edgeLen + if valref[i % 2] == 0: + valref[i % 2] = edgeLen else: - assert(abs(edgeLen-valref[i%2]) <= tolerance) + assert abs(edgeLen - valref[i % 2]) <= tolerance # Connected lines must be perpendicular if aPrevLine != None: - assert(isPerpendicular(aPrevLine, aLastLine, tolerance)) + assert isPerpendicular(aPrevLine, aLastLine, tolerance) aPrevLine = aLastLine aNbLines = aNbLines + 1 -assert (aNbLines == 4) -assert (model.dof(aSketchFeature) == 5) -#========================================================================= +assert aNbLines == 4 +assert model.dof(aSketchFeature) == 5 +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestRemainingDoF.py b/src/SketchPlugin/Test/TestRemainingDoF.py index eef20666f..74a839a53 100644 --- a/src/SketchPlugin/Test/TestRemainingDoF.py +++ b/src/SketchPlugin/Test/TestRemainingDoF.py @@ -22,6 +22,7 @@ from salome.shaper import model from EventsAPI import * from ModelAPI import * + class FreeShapesListener(EventsAPI.Events_Listener): def __init__(self): Events_Listener.__init__(self) @@ -35,8 +36,8 @@ class FreeShapesListener(EventsAPI.Events_Listener): def processEvent(self, theMessage): message = messageToUpdatedMessage(theMessage) objs = message.objects() - assert(len(objs) == 1) - assert(objectToFeature(objs[0]).getKind() == "SketchCircle") + assert len(objs) == 1 + assert objectToFeature(objs[0]).getKind() == "SketchCircle" self.myEventProcessed = True @@ -49,17 +50,23 @@ if __name__ == "__main__": Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(-30, 0, 14) SketchLine_1 = Sketch_1.addLine(-30, 0, 0, 0) - SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.startPoint()) - SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Origin"), False) + SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.startPoint() + ) + SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "Origin"), False + ) SketchPoint_1 = SketchProjection_1.createdFeature() - SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.result()) + SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() + ) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30) model.end() # send message to find the free shapes in the sketch event = Events_Loop.eventByName("GetDoFObjects") - ModelAPI_EventCreator.get().sendUpdated(Sketch_1.feature(), event); - Events_Loop.loop().flush(event); + ModelAPI_EventCreator.get().sendUpdated(Sketch_1.feature(), event) + Events_Loop.loop().flush(event) - assert(listener.myEventProcessed) + assert listener.myEventProcessed diff --git a/src/SketchPlugin/Test/TestRemoveBSpline.py b/src/SketchPlugin/Test/TestRemoveBSpline.py index b6f83afaf..0cfc07b8d 100644 --- a/src/SketchPlugin/Test/TestRemoveBSpline.py +++ b/src/SketchPlugin/Test/TestRemoveBSpline.py @@ -24,11 +24,17 @@ from salome.shaper import model from ModelAPI import * -def assertNbSubs(theSketch, theNbPoints, theNbLines, theNbSplines, theNbInternalConstraints): + +def assertNbSubs( + theSketch, theNbPoints, theNbLines, theNbSplines, theNbInternalConstraints +): model.testNbSubFeatures(theSketch, "SketchPoint", theNbPoints) model.testNbSubFeatures(theSketch, "SketchLine", theNbLines) model.testNbSubFeatures(theSketch, "SketchBSpline", theNbSplines) - model.testNbSubFeatures(theSketch, "SketchConstraintCoincidenceInternal", theNbInternalConstraints) + model.testNbSubFeatures( + theSketch, "SketchConstraintCoincidenceInternal", theNbInternalConstraints + ) + model.begin() partSet = model.moduleDocument() @@ -36,9 +42,9 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchBSpline_1_poles = [(-30, -10), (-15, 20), (0, -10), (15, 20), (30, -10)] -SketchBSpline_1 = Sketch_1.addSpline(poles = SketchBSpline_1_poles) -controlPoles = SketchBSpline_1.controlPoles(auxiliary = [0, 1, 2, 3, 4]) -controlLines = SketchBSpline_1.controlPolygon(auxiliary = [0, 1, 2, 3]) +SketchBSpline_1 = Sketch_1.addSpline(poles=SketchBSpline_1_poles) +controlPoles = SketchBSpline_1.controlPoles(auxiliary=[0, 1, 2, 3, 4]) +controlLines = SketchBSpline_1.controlPolygon(auxiliary=[0, 1, 2, 3]) model.do() model.end() @@ -48,8 +54,10 @@ DEFAULT_LINES = len(SketchBSpline_1_poles) - 1 DEFAULT_BSPLINES = 1 DEAFULT_INTERNALS = len(controlPoles) + len(controlLines) * 2 -assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_BSPLINES, DEAFULT_INTERNALS) -assert(model.dof(Sketch_1) == DEFAULT_DOF) +assertNbSubs( + Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_BSPLINES, DEAFULT_INTERNALS +) +assert model.dof(Sketch_1) == DEFAULT_DOF # Test 1. Remove auxiliary points one by one. for pnt in controlPoles: @@ -57,11 +65,19 @@ for pnt in controlPoles: removeFeaturesAndReferences(FeatureSet([pnt.feature()])) model.end() - assertNbSubs(Sketch_1, DEFAULT_POINTS - 1, DEFAULT_LINES, DEFAULT_BSPLINES, DEAFULT_INTERNALS - 1) - assert(model.dof(Sketch_1) == DEFAULT_DOF) + assertNbSubs( + Sketch_1, + DEFAULT_POINTS - 1, + DEFAULT_LINES, + DEFAULT_BSPLINES, + DEAFULT_INTERNALS - 1, + ) + assert model.dof(Sketch_1) == DEFAULT_DOF model.undo() - assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_BSPLINES, DEAFULT_INTERNALS) - assert(model.dof(Sketch_1) == DEFAULT_DOF) + assertNbSubs( + Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_BSPLINES, DEAFULT_INTERNALS + ) + assert model.dof(Sketch_1) == DEFAULT_DOF # Test 2. Remove auxiliary lines one by one. for ln in controlLines: @@ -69,11 +85,19 @@ for ln in controlLines: removeFeaturesAndReferences(FeatureSet([ln.feature()])) model.end() - assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES - 1, DEFAULT_BSPLINES, DEAFULT_INTERNALS - 2) - assert(model.dof(Sketch_1) == DEFAULT_DOF) + assertNbSubs( + Sketch_1, + DEFAULT_POINTS, + DEFAULT_LINES - 1, + DEFAULT_BSPLINES, + DEAFULT_INTERNALS - 2, + ) + assert model.dof(Sketch_1) == DEFAULT_DOF model.undo() - assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_BSPLINES, DEAFULT_INTERNALS) - assert(model.dof(Sketch_1) == DEFAULT_DOF) + assertNbSubs( + Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_BSPLINES, DEAFULT_INTERNALS + ) + assert model.dof(Sketch_1) == DEFAULT_DOF # Test 3. Remove the B-spline curve. model.begin() @@ -81,28 +105,38 @@ removeFeaturesAndReferences(FeatureSet([SketchBSpline_1.feature()])) model.end() assertNbSubs(Sketch_1, 0, 0, 0, 0) -assert(model.dof(Sketch_1) == 0) +assert model.dof(Sketch_1) == 0 model.undo() -assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_BSPLINES, DEAFULT_INTERNALS) -assert(model.dof(Sketch_1) == DEFAULT_DOF) +assertNbSubs( + Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_BSPLINES, DEAFULT_INTERNALS +) +assert model.dof(Sketch_1) == DEFAULT_DOF # Test 4. Remove some construction elements, make non-auxiliary a couple of the rest and check the dumping. model.begin() partSet = model.moduleDocument() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchBSpline_2_poles = [(-30, -10), (-15, -40), (0, -10), (15, -40), (30, -10)] -SketchBSpline_2 = Sketch_2.addSpline(poles = SketchBSpline_2_poles) -controlPoles2 = SketchBSpline_2.controlPoles(auxiliary = [0, 1, 2, 3, 4]) -controlLines2 = SketchBSpline_2.controlPolygon(auxiliary = [0, 1, 2, 3]) +SketchBSpline_2 = Sketch_2.addSpline(poles=SketchBSpline_2_poles) +controlPoles2 = SketchBSpline_2.controlPoles(auxiliary=[0, 1, 2, 3, 4]) +controlLines2 = SketchBSpline_2.controlPolygon(auxiliary=[0, 1, 2, 3]) model.do() model.end() model.begin() controlPoles2[1].setAuxiliary(False) controlLines2[2].setAuxiliary(False) -removeFeaturesAndReferences(FeatureSet([controlPoles2[2].feature(), controlLines2[0].feature()])) +removeFeaturesAndReferences( + FeatureSet([controlPoles2[2].feature(), controlLines2[0].feature()]) +) model.end() -assertNbSubs(Sketch_2, DEFAULT_POINTS - 1, DEFAULT_LINES - 1, DEFAULT_BSPLINES, DEAFULT_INTERNALS - 3) +assertNbSubs( + Sketch_2, + DEFAULT_POINTS - 1, + DEFAULT_LINES - 1, + DEFAULT_BSPLINES, + DEAFULT_INTERNALS - 3, +) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestRemoveBSplinePeriodic.py b/src/SketchPlugin/Test/TestRemoveBSplinePeriodic.py index 3c1c3b2b9..ffbf19875 100644 --- a/src/SketchPlugin/Test/TestRemoveBSplinePeriodic.py +++ b/src/SketchPlugin/Test/TestRemoveBSplinePeriodic.py @@ -24,11 +24,17 @@ from salome.shaper import model from ModelAPI import * -def assertNbSubs(theSketch, theNbPoints, theNbLines, theNbSplines, theNbInternalConstraints): + +def assertNbSubs( + theSketch, theNbPoints, theNbLines, theNbSplines, theNbInternalConstraints +): model.testNbSubFeatures(theSketch, "SketchPoint", theNbPoints) model.testNbSubFeatures(theSketch, "SketchLine", theNbLines) model.testNbSubFeatures(theSketch, "SketchBSplinePeriodic", theNbSplines) - model.testNbSubFeatures(theSketch, "SketchConstraintCoincidenceInternal", theNbInternalConstraints) + model.testNbSubFeatures( + theSketch, "SketchConstraintCoincidenceInternal", theNbInternalConstraints + ) + model.begin() partSet = model.moduleDocument() @@ -36,9 +42,9 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchBSpline_1_poles = [(-30, -10), (-15, 20), (0, -10), (15, 20), (30, -10)] -SketchBSpline_1 = Sketch_1.addSpline(poles = SketchBSpline_1_poles, periodic = True) -controlPoles = SketchBSpline_1.controlPoles(auxiliary = [0, 1, 2, 3, 4]) -controlLines = SketchBSpline_1.controlPolygon(auxiliary = [0, 1, 2, 3, 4]) +SketchBSpline_1 = Sketch_1.addSpline(poles=SketchBSpline_1_poles, periodic=True) +controlPoles = SketchBSpline_1.controlPoles(auxiliary=[0, 1, 2, 3, 4]) +controlLines = SketchBSpline_1.controlPolygon(auxiliary=[0, 1, 2, 3, 4]) model.do() model.end() @@ -48,8 +54,10 @@ DEFAULT_LINES = len(SketchBSpline_1_poles) DEFAULT_BSPLINES = 1 DEAFULT_INTERNALS = len(controlPoles) + len(controlLines) * 2 -assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_BSPLINES, DEAFULT_INTERNALS) -assert(model.dof(Sketch_1) == DEFAULT_DOF) +assertNbSubs( + Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_BSPLINES, DEAFULT_INTERNALS +) +assert model.dof(Sketch_1) == DEFAULT_DOF # Test 1. Remove auxiliary points one by one. for pnt in controlPoles: @@ -57,11 +65,19 @@ for pnt in controlPoles: removeFeaturesAndReferences(FeatureSet([pnt.feature()])) model.end() - assertNbSubs(Sketch_1, DEFAULT_POINTS - 1, DEFAULT_LINES, DEFAULT_BSPLINES, DEAFULT_INTERNALS - 1) - assert(model.dof(Sketch_1) == DEFAULT_DOF) + assertNbSubs( + Sketch_1, + DEFAULT_POINTS - 1, + DEFAULT_LINES, + DEFAULT_BSPLINES, + DEAFULT_INTERNALS - 1, + ) + assert model.dof(Sketch_1) == DEFAULT_DOF model.undo() - assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_BSPLINES, DEAFULT_INTERNALS) - assert(model.dof(Sketch_1) == DEFAULT_DOF) + assertNbSubs( + Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_BSPLINES, DEAFULT_INTERNALS + ) + assert model.dof(Sketch_1) == DEFAULT_DOF # Test 2. Remove auxiliary lines one by one. for ln in controlLines: @@ -69,11 +85,19 @@ for ln in controlLines: removeFeaturesAndReferences(FeatureSet([ln.feature()])) model.end() - assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES - 1, DEFAULT_BSPLINES, DEAFULT_INTERNALS - 2) - assert(model.dof(Sketch_1) == DEFAULT_DOF) + assertNbSubs( + Sketch_1, + DEFAULT_POINTS, + DEFAULT_LINES - 1, + DEFAULT_BSPLINES, + DEAFULT_INTERNALS - 2, + ) + assert model.dof(Sketch_1) == DEFAULT_DOF model.undo() - assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_BSPLINES, DEAFULT_INTERNALS) - assert(model.dof(Sketch_1) == DEFAULT_DOF) + assertNbSubs( + Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_BSPLINES, DEAFULT_INTERNALS + ) + assert model.dof(Sketch_1) == DEFAULT_DOF # Test 3. Remove the B-spline curve. model.begin() @@ -81,28 +105,38 @@ removeFeaturesAndReferences(FeatureSet([SketchBSpline_1.feature()])) model.end() assertNbSubs(Sketch_1, 0, 0, 0, 0) -assert(model.dof(Sketch_1) == 0) +assert model.dof(Sketch_1) == 0 model.undo() -assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_BSPLINES, DEAFULT_INTERNALS) -assert(model.dof(Sketch_1) == DEFAULT_DOF) +assertNbSubs( + Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_BSPLINES, DEAFULT_INTERNALS +) +assert model.dof(Sketch_1) == DEFAULT_DOF # Test 4. Remove some construction elements, make non-auxiliary a couple of the rest and check the dumping. model.begin() partSet = model.moduleDocument() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchBSpline_2_poles = [(-30, -10), (-15, -40), (0, -10), (15, -40), (30, -10)] -SketchBSpline_2 = Sketch_2.addSpline(poles = SketchBSpline_2_poles, periodic = True) -controlPoles2 = SketchBSpline_2.controlPoles(auxiliary = [0, 1, 2, 3, 4]) -controlLines2 = SketchBSpline_2.controlPolygon(auxiliary = [0, 1, 2, 3, 4]) +SketchBSpline_2 = Sketch_2.addSpline(poles=SketchBSpline_2_poles, periodic=True) +controlPoles2 = SketchBSpline_2.controlPoles(auxiliary=[0, 1, 2, 3, 4]) +controlLines2 = SketchBSpline_2.controlPolygon(auxiliary=[0, 1, 2, 3, 4]) model.do() model.end() model.begin() controlPoles2[1].setAuxiliary(False) controlLines2[2].setAuxiliary(False) -removeFeaturesAndReferences(FeatureSet([controlPoles2[2].feature(), controlLines2[0].feature()])) +removeFeaturesAndReferences( + FeatureSet([controlPoles2[2].feature(), controlLines2[0].feature()]) +) model.end() -assertNbSubs(Sketch_2, DEFAULT_POINTS - 1, DEFAULT_LINES - 1, DEFAULT_BSPLINES, DEAFULT_INTERNALS - 3) +assertNbSubs( + Sketch_2, + DEFAULT_POINTS - 1, + DEFAULT_LINES - 1, + DEFAULT_BSPLINES, + DEAFULT_INTERNALS - 3, +) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestRemoveEllipse.py b/src/SketchPlugin/Test/TestRemoveEllipse.py index 9488d3a46..1f5925c07 100644 --- a/src/SketchPlugin/Test/TestRemoveEllipse.py +++ b/src/SketchPlugin/Test/TestRemoveEllipse.py @@ -24,11 +24,17 @@ from salome.shaper import model from ModelAPI import * -def assertNbSubs(theSketch, theNbPoints, theNbLines, theNbEllipses, theNbInternalConstraints): + +def assertNbSubs( + theSketch, theNbPoints, theNbLines, theNbEllipses, theNbInternalConstraints +): model.testNbSubFeatures(theSketch, "SketchPoint", theNbPoints) model.testNbSubFeatures(theSketch, "SketchLine", theNbLines) model.testNbSubFeatures(theSketch, "SketchEllipse", theNbEllipses) - model.testNbSubFeatures(theSketch, "SketchConstraintCoincidenceInternal", theNbInternalConstraints) + model.testNbSubFeatures( + theSketch, "SketchConstraintCoincidenceInternal", theNbInternalConstraints + ) + model.begin() partSet = model.moduleDocument() @@ -36,7 +42,27 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchEllipse_1 = Sketch_1.addEllipse(40, 30, 70, 40, 20) -[Center, Focus1, Focus2, MajorAxisStart, MajorAxisEnd, MinorAxisStart, MinorAxisEnd, MajorAxisLine, MinorAxisLine] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +[ + Center, + Focus1, + Focus2, + MajorAxisStart, + MajorAxisEnd, + MinorAxisStart, + MinorAxisEnd, + MajorAxisLine, + MinorAxisLine, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) model.do() model.end() @@ -46,21 +72,39 @@ DEFAULT_LINES = 2 DEFAULT_ELLIPSES = 1 DEAFULT_INTERNALS = 11 -assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_ELLIPSES, DEAFULT_INTERNALS) -assert(model.dof(Sketch_1) == DEFAULT_DOF) +assertNbSubs( + Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_ELLIPSES, DEAFULT_INTERNALS +) +assert model.dof(Sketch_1) == DEFAULT_DOF # Test 1. Remove auxiliary points one by one. -points = [Center, Focus1, Focus2, MajorAxisStart, MajorAxisEnd, MinorAxisStart, MinorAxisEnd] +points = [ + Center, + Focus1, + Focus2, + MajorAxisStart, + MajorAxisEnd, + MinorAxisStart, + MinorAxisEnd, +] for pnt in points: model.begin() removeFeaturesAndReferences(FeatureSet([pnt.feature()])) model.end() - assertNbSubs(Sketch_1, DEFAULT_POINTS - 1, DEFAULT_LINES, DEFAULT_ELLIPSES, DEAFULT_INTERNALS - 1) - assert(model.dof(Sketch_1) == DEFAULT_DOF) + assertNbSubs( + Sketch_1, + DEFAULT_POINTS - 1, + DEFAULT_LINES, + DEFAULT_ELLIPSES, + DEAFULT_INTERNALS - 1, + ) + assert model.dof(Sketch_1) == DEFAULT_DOF model.undo() - assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_ELLIPSES, DEAFULT_INTERNALS) - assert(model.dof(Sketch_1) == DEFAULT_DOF) + assertNbSubs( + Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_ELLIPSES, DEAFULT_INTERNALS + ) + assert model.dof(Sketch_1) == DEFAULT_DOF # Test 2. Remove auxiliary axes one by one. lines = [MajorAxisLine, MinorAxisLine] @@ -69,11 +113,19 @@ for ln in lines: removeFeaturesAndReferences(FeatureSet([ln.feature()])) model.end() - assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES - 1, DEFAULT_ELLIPSES, DEAFULT_INTERNALS - 2) - assert(model.dof(Sketch_1) == DEFAULT_DOF) + assertNbSubs( + Sketch_1, + DEFAULT_POINTS, + DEFAULT_LINES - 1, + DEFAULT_ELLIPSES, + DEAFULT_INTERNALS - 2, + ) + assert model.dof(Sketch_1) == DEFAULT_DOF model.undo() - assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_ELLIPSES, DEAFULT_INTERNALS) - assert(model.dof(Sketch_1) == DEFAULT_DOF) + assertNbSubs( + Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_ELLIPSES, DEAFULT_INTERNALS + ) + assert model.dof(Sketch_1) == DEFAULT_DOF # Test 3. Remove the ellipse. model.begin() @@ -81,16 +133,38 @@ removeFeaturesAndReferences(FeatureSet([SketchEllipse_1.feature()])) model.end() assertNbSubs(Sketch_1, 0, 0, 0, 0) -assert(model.dof(Sketch_1) == 0) +assert model.dof(Sketch_1) == 0 model.undo() -assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_ELLIPSES, DEAFULT_INTERNALS) -assert(model.dof(Sketch_1) == DEFAULT_DOF) +assertNbSubs( + Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_ELLIPSES, DEAFULT_INTERNALS +) +assert model.dof(Sketch_1) == DEFAULT_DOF # Test 4. Remove some construction elements, make non-auxiliary a couple of the rest and check the dumping. model.begin() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchEllipse_2 = Sketch_2.addEllipse(40, -30, 70, 0, 10) -[Center, Focus1, Focus2, MajorAxisStart, MajorAxisEnd, MinorAxisStart, MinorAxisEnd, MajorAxisLine, MinorAxisLine] = SketchEllipse_2.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +[ + Center, + Focus1, + Focus2, + MajorAxisStart, + MajorAxisEnd, + MinorAxisStart, + MinorAxisEnd, + MajorAxisLine, + MinorAxisLine, +] = SketchEllipse_2.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) model.do() model.end() @@ -100,7 +174,13 @@ Focus1.setAuxiliary(False) MinorAxisEnd.setAuxiliary(False) model.end() -assertNbSubs(Sketch_2, DEFAULT_POINTS - 1, DEFAULT_LINES - 1, DEFAULT_ELLIPSES, DEAFULT_INTERNALS - 3) -assert(model.dof(Sketch_2) == DEFAULT_DOF) +assertNbSubs( + Sketch_2, + DEFAULT_POINTS - 1, + DEFAULT_LINES - 1, + DEFAULT_ELLIPSES, + DEAFULT_INTERNALS - 3, +) +assert model.dof(Sketch_2) == DEFAULT_DOF -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestRemoveEllipticArc.py b/src/SketchPlugin/Test/TestRemoveEllipticArc.py index 60bcc8bfe..0c928cda9 100644 --- a/src/SketchPlugin/Test/TestRemoveEllipticArc.py +++ b/src/SketchPlugin/Test/TestRemoveEllipticArc.py @@ -24,19 +24,47 @@ from salome.shaper import model from ModelAPI import * -def assertNbSubs(theSketch, theNbPoints, theNbLines, theNbEllipticArcs, theNbInternalConstraints): + +def assertNbSubs( + theSketch, theNbPoints, theNbLines, theNbEllipticArcs, theNbInternalConstraints +): model.testNbSubFeatures(theSketch, "SketchPoint", theNbPoints) model.testNbSubFeatures(theSketch, "SketchLine", theNbLines) model.testNbSubFeatures(theSketch, "SketchEllipticArc", theNbEllipticArcs) - model.testNbSubFeatures(theSketch, "SketchConstraintCoincidenceInternal", theNbInternalConstraints) + model.testNbSubFeatures( + theSketch, "SketchConstraintCoincidenceInternal", theNbInternalConstraints + ) + 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")) -SketchEllipticArc_1 = Sketch_1.addEllipticArc(40, 30, 70, 60, 60, 65, 60., 23.3257583582, False) -[Center, Focus1, Focus2, MajorAxisStart, MajorAxisEnd, MinorAxisStart, MinorAxisEnd, MajorAxisLine, MinorAxisLine] = SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipticArc_1 = Sketch_1.addEllipticArc( + 40, 30, 70, 60, 60, 65, 60.0, 23.3257583582, False +) +[ + Center, + Focus1, + Focus2, + MajorAxisStart, + MajorAxisEnd, + MinorAxisStart, + MinorAxisEnd, + MajorAxisLine, + MinorAxisLine, +] = SketchEllipticArc_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) model.do() model.end() @@ -46,21 +74,43 @@ DEFAULT_LINES = 2 DEFAULT_ELLIPTIC_ARCS = 1 DEAFULT_INTERNALS = 11 -assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_ELLIPTIC_ARCS, DEAFULT_INTERNALS) -assert(model.dof(Sketch_1) == DEFAULT_DOF) +assertNbSubs( + Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_ELLIPTIC_ARCS, DEAFULT_INTERNALS +) +assert model.dof(Sketch_1) == DEFAULT_DOF # Test 1. Remove auxiliary points one by one. -points = [Center, Focus1, Focus2, MajorAxisStart, MajorAxisEnd, MinorAxisStart, MinorAxisEnd] +points = [ + Center, + Focus1, + Focus2, + MajorAxisStart, + MajorAxisEnd, + MinorAxisStart, + MinorAxisEnd, +] for pnt in points: model.begin() removeFeaturesAndReferences(FeatureSet([pnt.feature()])) model.end() - assertNbSubs(Sketch_1, DEFAULT_POINTS - 1, DEFAULT_LINES, DEFAULT_ELLIPTIC_ARCS, DEAFULT_INTERNALS - 1) - assert(model.dof(Sketch_1) == DEFAULT_DOF) + assertNbSubs( + Sketch_1, + DEFAULT_POINTS - 1, + DEFAULT_LINES, + DEFAULT_ELLIPTIC_ARCS, + DEAFULT_INTERNALS - 1, + ) + assert model.dof(Sketch_1) == DEFAULT_DOF model.undo() - assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_ELLIPTIC_ARCS, DEAFULT_INTERNALS) - assert(model.dof(Sketch_1) == DEFAULT_DOF) + assertNbSubs( + Sketch_1, + DEFAULT_POINTS, + DEFAULT_LINES, + DEFAULT_ELLIPTIC_ARCS, + DEAFULT_INTERNALS, + ) + assert model.dof(Sketch_1) == DEFAULT_DOF # Test 2. Remove auxiliary axes one by one. lines = [MajorAxisLine, MinorAxisLine] @@ -69,11 +119,23 @@ for ln in lines: removeFeaturesAndReferences(FeatureSet([ln.feature()])) model.end() - assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES - 1, DEFAULT_ELLIPTIC_ARCS, DEAFULT_INTERNALS - 2) - assert(model.dof(Sketch_1) == DEFAULT_DOF) + assertNbSubs( + Sketch_1, + DEFAULT_POINTS, + DEFAULT_LINES - 1, + DEFAULT_ELLIPTIC_ARCS, + DEAFULT_INTERNALS - 2, + ) + assert model.dof(Sketch_1) == DEFAULT_DOF model.undo() - assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_ELLIPTIC_ARCS, DEAFULT_INTERNALS) - assert(model.dof(Sketch_1) == DEFAULT_DOF) + assertNbSubs( + Sketch_1, + DEFAULT_POINTS, + DEFAULT_LINES, + DEFAULT_ELLIPTIC_ARCS, + DEAFULT_INTERNALS, + ) + assert model.dof(Sketch_1) == DEFAULT_DOF # Test 3. Remove the elliptic arc. model.begin() @@ -81,16 +143,38 @@ removeFeaturesAndReferences(FeatureSet([SketchEllipticArc_1.feature()])) model.end() assertNbSubs(Sketch_1, 0, 0, 0, 0) -assert(model.dof(Sketch_1) == 0) +assert model.dof(Sketch_1) == 0 model.undo() -assertNbSubs(Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_ELLIPTIC_ARCS, DEAFULT_INTERNALS) -assert(model.dof(Sketch_1) == DEFAULT_DOF) +assertNbSubs( + Sketch_1, DEFAULT_POINTS, DEFAULT_LINES, DEFAULT_ELLIPTIC_ARCS, DEAFULT_INTERNALS +) +assert model.dof(Sketch_1) == DEFAULT_DOF # Test 4. Remove some construction elements, make non-auxiliary a couple of the rest and check the dumping. model.begin() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchEllipticArc_2 = Sketch_2.addEllipticArc(40, -30, 70, 0, 30, 10, 0, -20, True) -[Center, Focus1, Focus2, MajorAxisStart, MajorAxisEnd, MinorAxisStart, MinorAxisEnd, MajorAxisLine, MinorAxisLine] = SketchEllipticArc_2.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +[ + Center, + Focus1, + Focus2, + MajorAxisStart, + MajorAxisEnd, + MinorAxisStart, + MinorAxisEnd, + MajorAxisLine, + MinorAxisLine, +] = SketchEllipticArc_2.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) SketchEllipticArc_2.setAuxiliary(True) model.do() model.end() @@ -101,7 +185,13 @@ Focus1.setAuxiliary(False) MinorAxisLine.setAuxiliary(False) model.end() -assertNbSubs(Sketch_2, DEFAULT_POINTS - 1, DEFAULT_LINES - 1, DEFAULT_ELLIPTIC_ARCS, DEAFULT_INTERNALS - 3) -assert(model.dof(Sketch_2) == DEFAULT_DOF) +assertNbSubs( + Sketch_2, + DEFAULT_POINTS - 1, + DEFAULT_LINES - 1, + DEFAULT_ELLIPTIC_ARCS, + DEAFULT_INTERNALS - 3, +) +assert model.dof(Sketch_2) == DEFAULT_DOF -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestRemoveSketch.py b/src/SketchPlugin/Test/TestRemoveSketch.py index f5f0a8b80..3f02f6d7a 100644 --- a/src/SketchPlugin/Test/TestRemoveSketch.py +++ b/src/SketchPlugin/Test/TestRemoveSketch.py @@ -23,9 +23,9 @@ from GeomDataAPI import * from ModelAPI import * -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2017-02-01" aSession = ModelAPI_Session.get() @@ -47,8 +47,8 @@ aSession.startOperation() aSketchLine = aSketchFeature.addFeature("SketchLine") aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) -aLineStartPoint.setValue(50., 0.) -aLineEndPoint.setValue(100., 25.) +aLineStartPoint.setValue(50.0, 0.0) +aLineEndPoint.setValue(100.0, 25.0) aSession.finishOperation() # remove sketch @@ -56,6 +56,6 @@ aSession.startOperation() aDocument.removeFeature(aSketchFeature) aSession.finishOperation() -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= diff --git a/src/SketchPlugin/Test/TestSignedDistancePointLine.py b/src/SketchPlugin/Test/TestSignedDistancePointLine.py index 72de31b38..e767fc2bb 100644 --- a/src/SketchPlugin/Test/TestSignedDistancePointLine.py +++ b/src/SketchPlugin/Test/TestSignedDistancePointLine.py @@ -19,7 +19,7 @@ from salome.shaper import model import math -TOLERANCE = 1.e-5 +TOLERANCE = 1.0e-5 model.begin() partSet = model.moduleDocument() @@ -33,69 +33,204 @@ HeightParam = model.addParameter(Part_1_doc, "height", "900") LengthParam = model.addParameter(Part_1_doc, "length", "1460") PosParam = model.addParameter(Part_1_doc, "position", "71.99905090248758") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(-281.378739745974, 78.99909999999998, -98.87873974597397, 78.99909999999998) +SketchLine_1 = Sketch_1.addLine( + -281.378739745974, 78.99909999999998, -98.87873974597397, 78.99909999999998 +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchArc_1 = Sketch_1.addArc(174.031501908677, 71.9991, -98.87873974597397, 78.99909999999998, 446.941743563328, 78.9991, True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_1.startPoint()) -SketchArc_2 = Sketch_1.addArc(-554.288981400625, 71.9991, -281.378739745974, 78.99909999999998, -827.1992230552759, 78.9991, False) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_2.center(), SketchLine_1.result(), "clearance-wheel_R", True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_1.result(), "clearance-wheel_R", True) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_2.results()[1], SketchArc_1.results()[1]) +SketchArc_1 = Sketch_1.addArc( + 174.031501908677, + 71.9991, + -98.87873974597397, + 78.99909999999998, + 446.941743563328, + 78.9991, + True, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchArc_1.startPoint() +) +SketchArc_2 = Sketch_1.addArc( + -554.288981400625, + 71.9991, + -281.378739745974, + 78.99909999999998, + -827.1992230552759, + 78.9991, + False, +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_1.result() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_2.center(), SketchLine_1.result(), "clearance-wheel_R", True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_1.result(), "clearance-wheel_R", True +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchArc_2.results()[1], SketchArc_1.results()[1] +) SketchCircle_1 = Sketch_1.addCircle(-554.288981400625, 71.9991, 203) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_2.center(), SketchCircle_1.center()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchCircle_1.center() +) SketchCircle_2 = Sketch_1.addCircle(174.031501908677, 71.9991, 203) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.center(), SketchCircle_2.center()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchCircle_2.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "wheel_R") -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) -SketchLine_2 = Sketch_1.addLine(-827.1992230552759, 78.9991, -960.4001854579536, 78.9991) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(-960.4001854579536, 78.9991, -960.4001854579536, 368.9991) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-891.6236641114499, 437.7756213465037, -540.5628729569305, 437.7756213465037) -SketchLine_5 = Sketch_1.addLine(-540.5628729569305, 437.7756213465037, -349.330908394406, 768.9991) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(-349.330908394406, 768.9991, 308.3678499795216, 768.9991) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchLine_7 = Sketch_1.addLine(308.3678499795216, 768.9991, 499.5998145420464, 437.7756213465038) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchLine_8 = Sketch_1.addLine(499.5998145420464, 437.7756213465038, 499.5998145420464, 78.9991) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) +SketchLine_2 = Sketch_1.addLine( + -827.1992230552759, 78.9991, -960.4001854579536, 78.9991 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + -960.4001854579536, 78.9991, -960.4001854579536, 368.9991 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -891.6236641114499, 437.7756213465037, -540.5628729569305, 437.7756213465037 +) +SketchLine_5 = Sketch_1.addLine( + -540.5628729569305, 437.7756213465037, -349.330908394406, 768.9991 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + -349.330908394406, 768.9991, 308.3678499795216, 768.9991 +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchLine_7 = Sketch_1.addLine( + 308.3678499795216, 768.9991, 499.5998145420464, 437.7756213465038 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchLine_8 = Sketch_1.addLine( + 499.5998145420464, 437.7756213465038, 499.5998145420464, 78.9991 +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(499.5998145420464, 78.9991, 446.941743563328, 78.9991) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_9.endPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_9.endPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_8.result()) -SketchArc_3 = Sketch_1.addArc(-891.6236641114499, 368.9991, -891.6236641114499, 437.7756213465037, -960.4001854579536, 368.9991, False) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_3.endPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_3.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_4.result()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_5.result(), SketchLine_4.result(), 120.0000000000006) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchLine_4.result()) -SketchConstraintAngle_2 = Sketch_1.setAngleBackward(SketchLine_7.result(), SketchLine_6.result(), 120.0000000000006) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchArc_2.center(), SketchLine_2.startPoint(), "arc_R", True) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_2.endPoint(), SketchLine_5.endPoint(), "height-clearance") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_2.endPoint(), SketchLine_9.startPoint(), "length", True) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_2.result(), "hood_height", True) +SketchArc_3 = Sketch_1.addArc( + -891.6236641114499, + 368.9991, + -891.6236641114499, + 437.7756213465037, + -960.4001854579536, + 368.9991, + False, +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_3.endPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_3.result() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_4.result() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_5.result(), SketchLine_4.result(), 120.0000000000006 +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_8.startPoint(), SketchLine_4.result() +) +SketchConstraintAngle_2 = Sketch_1.setAngleBackward( + SketchLine_7.result(), SketchLine_6.result(), 120.0000000000006 +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchArc_2.center(), SketchLine_2.startPoint(), "arc_R", True +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_2.endPoint(), SketchLine_5.endPoint(), "height-clearance" +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_2.endPoint(), SketchLine_9.startPoint(), "length", True +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_2.result(), "hood_height", True +) SketchLine_10 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchCircle_2.center(), SketchLine_10.result(), "position", True) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchCircle_2.center(), SketchLine_10.result(), "position", True +) SketchPoint_1 = Sketch_1.addPoint(-910.4001854579535, 347.7756213465037) SketchPoint_2 = Sketch_1.addPoint(-910.9041532173604, 297.7781612460398) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_3.result(), 50, True) -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_4.result(), 90, True) -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchPoint_1.coordinates(), 50, True) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchPoint_1.coordinates(), SketchLine_3.result(), 50, True +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchPoint_1.coordinates(), SketchLine_4.result(), 90, True +) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchPoint_2.coordinates(), SketchPoint_1.coordinates(), 50, True +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "length/8") model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchArc_1_2r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchArc_3_2f-SketchLine_3r-SketchLine_2r-SketchArc_2_2r")], model.selection(), 500, 0) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")], model.selection(), 500, -400) -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")], model.selection(), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchArc_1_2r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchArc_3_2f-SketchLine_3r-SketchLine_2r-SketchArc_2_2r", + ) + ], + model.selection(), + 500, + 0, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), + model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f"), + ], + model.selection(), + 500, + -400, +) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [ + model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), + model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f"), + ], + model.selection(), + 100, + 0, +) model.do() # Verify point-line signed distance @@ -112,11 +247,21 @@ curDist2 = model.signedDistancePointLine(SketchArc_2.center(), SketchLine_1) curDist3 = model.signedDistancePointLine(SketchLine_3.endPoint(), SketchLine_2) curDist4 = model.signedDistancePointLine(SketchPoint_1, SketchLine_3) curDist5 = model.signedDistancePointLine(SketchPoint_1, SketchLine_4) -assert(math.fabs(dist1 - curDist1) < TOLERANCE), "Expected {}, actual {}".format(dist1, curDist1) -assert(math.fabs(dist2 - curDist2) < TOLERANCE), "Expected {}, actual {}".format(dist2, curDist2) -assert(math.fabs(dist3 - curDist3) < TOLERANCE), "Expected {}, actual {}".format(dist3, curDist3) -assert(math.fabs(dist4 - curDist4) < TOLERANCE), "Expected {}, actual {}".format(dist4, curDist4) -assert(math.fabs(dist5 - curDist5) < TOLERANCE), "Expected {}, actual {}".format(dist5, curDist5) +assert math.fabs(dist1 - curDist1) < TOLERANCE, "Expected {}, actual {}".format( + dist1, curDist1 +) +assert math.fabs(dist2 - curDist2) < TOLERANCE, "Expected {}, actual {}".format( + dist2, curDist2 +) +assert math.fabs(dist3 - curDist3) < TOLERANCE, "Expected {}, actual {}".format( + dist3, curDist3 +) +assert math.fabs(dist4 - curDist4) < TOLERANCE, "Expected {}, actual {}".format( + dist4, curDist4 +) +assert math.fabs(dist5 - curDist5) < TOLERANCE, "Expected {}, actual {}".format( + dist5, curDist5 +) LengthParam.setValue(2000) model.do() @@ -125,11 +270,21 @@ curDist2 = model.signedDistancePointLine(SketchArc_2.center(), SketchLine_1) curDist3 = model.signedDistancePointLine(SketchLine_3.endPoint(), SketchLine_2) curDist4 = model.signedDistancePointLine(SketchPoint_1, SketchLine_3) curDist5 = model.signedDistancePointLine(SketchPoint_1, SketchLine_4) -assert(math.fabs(dist1 - curDist1) < TOLERANCE), "Expected {}, actual {}".format(dist1, curDist1) -assert(math.fabs(dist2 - curDist2) < TOLERANCE), "Expected {}, actual {}".format(dist2, curDist2) -assert(math.fabs(dist3 - curDist3) < TOLERANCE), "Expected {}, actual {}".format(dist3, curDist3) -assert(math.fabs(dist4 - curDist4) < TOLERANCE), "Expected {}, actual {}".format(dist4, curDist4) -assert(math.fabs(dist5 - curDist5) < TOLERANCE), "Expected {}, actual {}".format(dist5, curDist5) +assert math.fabs(dist1 - curDist1) < TOLERANCE, "Expected {}, actual {}".format( + dist1, curDist1 +) +assert math.fabs(dist2 - curDist2) < TOLERANCE, "Expected {}, actual {}".format( + dist2, curDist2 +) +assert math.fabs(dist3 - curDist3) < TOLERANCE, "Expected {}, actual {}".format( + dist3, curDist3 +) +assert math.fabs(dist4 - curDist4) < TOLERANCE, "Expected {}, actual {}".format( + dist4, curDist4 +) +assert math.fabs(dist5 - curDist5) < TOLERANCE, "Expected {}, actual {}".format( + dist5, curDist5 +) HeightParam.setValue(1200) model.do() @@ -138,10 +293,20 @@ curDist2 = model.signedDistancePointLine(SketchArc_2.center(), SketchLine_1) curDist3 = model.signedDistancePointLine(SketchLine_3.endPoint(), SketchLine_2) curDist4 = model.signedDistancePointLine(SketchPoint_1, SketchLine_3) curDist5 = model.signedDistancePointLine(SketchPoint_1, SketchLine_4) -assert(math.fabs(dist1 - curDist1) < TOLERANCE), "Expected {}, actual {}".format(dist1, curDist1) -assert(math.fabs(dist2 - curDist2) < TOLERANCE), "Expected {}, actual {}".format(dist2, curDist2) -assert(math.fabs(dist3 - curDist3) < TOLERANCE), "Expected {}, actual {}".format(dist3, curDist3) -assert(math.fabs(dist4 - curDist4) < TOLERANCE), "Expected {}, actual {}".format(dist4, curDist4) -assert(math.fabs(dist5 - curDist5) < TOLERANCE), "Expected {}, actual {}".format(dist5, curDist5) +assert math.fabs(dist1 - curDist1) < TOLERANCE, "Expected {}, actual {}".format( + dist1, curDist1 +) +assert math.fabs(dist2 - curDist2) < TOLERANCE, "Expected {}, actual {}".format( + dist2, curDist2 +) +assert math.fabs(dist3 - curDist3) < TOLERANCE, "Expected {}, actual {}".format( + dist3, curDist3 +) +assert math.fabs(dist4 - curDist4) < TOLERANCE, "Expected {}, actual {}".format( + dist4, curDist4 +) +assert math.fabs(dist5 - curDist5) < TOLERANCE, "Expected {}, actual {}".format( + dist5, curDist5 +) model.end() diff --git a/src/SketchPlugin/Test/TestSignedDistancePointPoint.py b/src/SketchPlugin/Test/TestSignedDistancePointPoint.py index 31c52d6da..e407b822e 100644 --- a/src/SketchPlugin/Test/TestSignedDistancePointPoint.py +++ b/src/SketchPlugin/Test/TestSignedDistancePointPoint.py @@ -19,7 +19,7 @@ from salome.shaper import model import math -TOLERANCE = 1.e-5 +TOLERANCE = 1.0e-5 model.begin() partSet = model.moduleDocument() @@ -33,69 +33,204 @@ HeightParam = model.addParameter(Part_1_doc, "height", "900") LengthParam = model.addParameter(Part_1_doc, "length", "1460") PosParam = model.addParameter(Part_1_doc, "position", "71.99905090248758") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(-281.378739745974, 78.99909999999998, -98.87873974597397, 78.99909999999998) +SketchLine_1 = Sketch_1.addLine( + -281.378739745974, 78.99909999999998, -98.87873974597397, 78.99909999999998 +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchArc_1 = Sketch_1.addArc(174.031501908677, 71.9991, -98.87873974597397, 78.99909999999998, 446.941743563328, 78.9991, True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_1.startPoint()) -SketchArc_2 = Sketch_1.addArc(-554.288981400625, 71.9991, -281.378739745974, 78.99909999999998, -827.1992230552759, 78.9991, False) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_2.center(), SketchLine_1.result(), "clearance-wheel_R", True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_1.result(), "clearance-wheel_R", True) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_2.results()[1], SketchArc_1.results()[1]) +SketchArc_1 = Sketch_1.addArc( + 174.031501908677, + 71.9991, + -98.87873974597397, + 78.99909999999998, + 446.941743563328, + 78.9991, + True, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchArc_1.startPoint() +) +SketchArc_2 = Sketch_1.addArc( + -554.288981400625, + 71.9991, + -281.378739745974, + 78.99909999999998, + -827.1992230552759, + 78.9991, + False, +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_1.result() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_2.center(), SketchLine_1.result(), "clearance-wheel_R", True +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_1.result(), "clearance-wheel_R", True +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchArc_2.results()[1], SketchArc_1.results()[1] +) SketchCircle_1 = Sketch_1.addCircle(-554.288981400625, 71.9991, 203) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_2.center(), SketchCircle_1.center()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchCircle_1.center() +) SketchCircle_2 = Sketch_1.addCircle(174.031501908677, 71.9991, 203) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.center(), SketchCircle_2.center()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchCircle_2.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "wheel_R") -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) -SketchLine_2 = Sketch_1.addLine(-827.1992230552759, 78.9991, -960.4001854579536, 78.9991) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(-960.4001854579536, 78.9991, -960.4001854579536, 368.9991) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-891.6236641114499, 437.7756213465037, -540.5628729569305, 437.7756213465037) -SketchLine_5 = Sketch_1.addLine(-540.5628729569305, 437.7756213465037, -349.330908394406, 768.9991) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchLine_6 = Sketch_1.addLine(-349.330908394406, 768.9991, 308.3678499795216, 768.9991) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchLine_7 = Sketch_1.addLine(308.3678499795216, 768.9991, 499.5998145420464, 437.7756213465038) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchLine_8 = Sketch_1.addLine(499.5998145420464, 437.7756213465038, 499.5998145420464, 78.9991) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) +SketchLine_2 = Sketch_1.addLine( + -827.1992230552759, 78.9991, -960.4001854579536, 78.9991 +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + -960.4001854579536, 78.9991, -960.4001854579536, 368.9991 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -891.6236641114499, 437.7756213465037, -540.5628729569305, 437.7756213465037 +) +SketchLine_5 = Sketch_1.addLine( + -540.5628729569305, 437.7756213465037, -349.330908394406, 768.9991 +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchLine_6 = Sketch_1.addLine( + -349.330908394406, 768.9991, 308.3678499795216, 768.9991 +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchLine_7 = Sketch_1.addLine( + 308.3678499795216, 768.9991, 499.5998145420464, 437.7756213465038 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchLine_8 = Sketch_1.addLine( + 499.5998145420464, 437.7756213465038, 499.5998145420464, 78.9991 +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(499.5998145420464, 78.9991, 446.941743563328, 78.9991) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_9.endPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_9.endPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_8.result()) -SketchArc_3 = Sketch_1.addArc(-891.6236641114499, 368.9991, -891.6236641114499, 437.7756213465037, -960.4001854579536, 368.9991, False) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_3.endPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_3.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_4.result()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_5.result(), SketchLine_4.result(), 120.0000000000006) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchLine_4.result()) -SketchConstraintAngle_2 = Sketch_1.setAngleBackward(SketchLine_7.result(), SketchLine_6.result(), 120.0000000000006) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchArc_2.center(), SketchLine_2.startPoint(), "arc_R", True) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_2.endPoint(), SketchLine_5.endPoint(), "height-clearance") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_2.endPoint(), SketchLine_9.startPoint(), "length", True) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_2.result(), "hood_height", True) +SketchArc_3 = Sketch_1.addArc( + -891.6236641114499, + 368.9991, + -891.6236641114499, + 437.7756213465037, + -960.4001854579536, + 368.9991, + False, +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_3.endPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_3.result() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_4.result() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_5.result(), SketchLine_4.result(), 120.0000000000006 +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_8.startPoint(), SketchLine_4.result() +) +SketchConstraintAngle_2 = Sketch_1.setAngleBackward( + SketchLine_7.result(), SketchLine_6.result(), 120.0000000000006 +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchArc_2.center(), SketchLine_2.startPoint(), "arc_R", True +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_2.endPoint(), SketchLine_5.endPoint(), "height-clearance" +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_2.endPoint(), SketchLine_9.startPoint(), "length", True +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_2.result(), "hood_height", True +) SketchLine_10 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchCircle_2.center(), SketchLine_10.result(), "position", True) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchCircle_2.center(), SketchLine_10.result(), "position", True +) SketchPoint_1 = Sketch_1.addPoint(-910.4001854579535, 347.7756213465037) SketchPoint_2 = Sketch_1.addPoint(-910.9041532173604, 297.7781612460398) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_3.result(), 50, True) -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_4.result(), 90, True) -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchPoint_1.coordinates(), 50, True) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchPoint_1.coordinates(), SketchLine_3.result(), 50, True +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchPoint_1.coordinates(), SketchLine_4.result(), 90, True +) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchPoint_2.coordinates(), SketchPoint_1.coordinates(), 50, True +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "length/8") model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchArc_1_2r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchArc_3_2f-SketchLine_3r-SketchLine_2r-SketchArc_2_2r")], model.selection(), 500, 0) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")], model.selection(), 500, -400) -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")], model.selection(), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchArc_1_2r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchArc_3_2f-SketchLine_3r-SketchLine_2r-SketchArc_2_2r", + ) + ], + model.selection(), + 500, + 0, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [ + model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), + model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f"), + ], + model.selection(), + 500, + -400, +) +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [ + model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), + model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f"), + ], + model.selection(), + 100, + 0, +) model.do() # Verify point-point distance @@ -106,21 +241,33 @@ PosParam.setValue(300) model.do() curDist1 = model.distancePointPoint(SketchArc_2.center(), SketchLine_2.startPoint()) curDist2 = model.distancePointPoint(SketchPoint_1, SketchPoint_2) -assert(math.fabs(dist1 - curDist1) < TOLERANCE), "Expected {}, actual {}".format(dist1, curDist1) -assert(math.fabs(dist2 - curDist2) < TOLERANCE), "Expected {}, actual {}".format(dist2, curDist2) +assert math.fabs(dist1 - curDist1) < TOLERANCE, "Expected {}, actual {}".format( + dist1, curDist1 +) +assert math.fabs(dist2 - curDist2) < TOLERANCE, "Expected {}, actual {}".format( + dist2, curDist2 +) LengthParam.setValue(2000) model.do() curDist1 = model.distancePointPoint(SketchArc_2.center(), SketchLine_2.startPoint()) curDist2 = model.distancePointPoint(SketchPoint_1, SketchPoint_2) -assert(math.fabs(dist1 - curDist1) < TOLERANCE), "Expected {}, actual {}".format(dist1, curDist1) -assert(math.fabs(dist2 - curDist2) < TOLERANCE), "Expected {}, actual {}".format(dist2, curDist2) +assert math.fabs(dist1 - curDist1) < TOLERANCE, "Expected {}, actual {}".format( + dist1, curDist1 +) +assert math.fabs(dist2 - curDist2) < TOLERANCE, "Expected {}, actual {}".format( + dist2, curDist2 +) HeightParam.setValue(1200) model.do() curDist1 = model.distancePointPoint(SketchArc_2.center(), SketchLine_2.startPoint()) curDist2 = model.distancePointPoint(SketchPoint_1, SketchPoint_2) -assert(math.fabs(dist1 - curDist1) < TOLERANCE), "Expected {}, actual {}".format(dist1, curDist1) -assert(math.fabs(dist2 - curDist2) < TOLERANCE), "Expected {}, actual {}".format(dist2, curDist2) +assert math.fabs(dist1 - curDist1) < TOLERANCE, "Expected {}, actual {}".format( + dist1, curDist1 +) +assert math.fabs(dist2 - curDist2) < TOLERANCE, "Expected {}, actual {}".format( + dist2, curDist2 +) model.end() diff --git a/src/SketchPlugin/Test/TestSketchCopy01.py b/src/SketchPlugin/Test/TestSketchCopy01.py index 4f0e8910d..2e1ae0a54 100644 --- a/src/SketchPlugin/Test/TestSketchCopy01.py +++ b/src/SketchPlugin/Test/TestSketchCopy01.py @@ -28,99 +28,273 @@ SketchLine_1 = Sketch_1.addLine(-40, -72, 0, -72) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "OY"), False) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "OX"), False) SketchLine_3 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 0, -72, 72, 0, False) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.center()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.result(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.center() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchArc_1.endPoint() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 72) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) -SketchEllipticArc_1 = Sketch_1.addEllipticArc(25, 0, 25, 74.98833242578475, 72, 0, 25, 88.5, False) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_4, SketchLine_5] = SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.result(), SketchEllipticArc_1.center()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchEllipticArc_1.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchEllipticArc_1.endPoint(), SketchAPI_Line(SketchLine_4).endPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_1.endPoint() +) +SketchEllipticArc_1 = Sketch_1.addEllipticArc( + 25, 0, 25, 74.98833242578475, 72, 0, 25, 88.5, False +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_4, + SketchLine_5, +] = SketchEllipticArc_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchEllipticArc_1.center() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchEllipticArc_1.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchEllipticArc_1.endPoint(), SketchAPI_Line(SketchLine_4).endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchLine_6 = Sketch_1.addLine(7.834161075251729, 88.5, 25, 88.5) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.endPoint()) -SketchArc_2 = Sketch_1.addArc(-40, -8.616197183098587, -40, -72, -94.21171510314713, 24.22579430808612, True) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_2.startPoint()) -SketchArc_3 = Sketch_1.addArc(-60, 3.5, -94.21171510314713, 24.22579430808612, -60, 43.5, True) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1]) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.endPoint() +) +SketchArc_2 = Sketch_1.addArc( + -40, -8.616197183098587, -40, -72, -94.21171510314713, 24.22579430808612, True +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_2.startPoint() +) +SketchArc_3 = Sketch_1.addArc( + -60, 3.5, -94.21171510314713, 24.22579430808612, -60, 43.5, True +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_3.results()[1], 40) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 25, True) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_2).startPoint(), + SketchAPI_Point(SketchPoint_1).coordinates(), + 25, + True, +) SketchLine_7 = Sketch_1.addLine(-40, -72, -40, -8.616197183098587) SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_7.endPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_7.result(), 90, type = "Direct") -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_3.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), 60) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchArc_3.endPoint(), SketchLine_6.startPoint(), 45) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_7.endPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_7.result(), 90, type="Direct" +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchArc_3.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), 60 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchArc_3.endPoint(), SketchLine_6.startPoint(), 45 +) SketchLine_8 = Sketch_1.addLine(-60, 3.5, -60, 43.5) SketchLine_8.setAuxiliary(True) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_8.endPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_7.result(), SketchLine_8.result()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_8.endPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_7.result(), SketchLine_8.result() +) SketchCircle_1 = Sketch_1.addCircle(-60, 66, 22.5) SketchCircle_1.setAuxiliary(True) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_8.result(), SketchCircle_1.center()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_6.result(), SketchCircle_1.results()[1]) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_3.result(), 66, True) -SketchBSpline_1 = Sketch_1.addSpline(poles = [(-60, 43.5), (-40, 43.5), (-11.56553854601814, 88.5), (8.434461453981855, 88.5)], weights = [1, 3, 3, 1]) -[SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11] = SketchBSpline_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_9, SketchLine_10, SketchLine_11] = SketchBSpline_1.controlPolygon(auxiliary = [0, 1, 2]) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_11).coordinates(), SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_11.result()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_8).coordinates(), SketchArc_3.endPoint()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_8.result(), SketchCircle_1.center() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_6.result(), SketchCircle_1.results()[1] +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_3.result(), 66, True +) +SketchBSpline_1 = Sketch_1.addSpline( + poles=[ + (-60, 43.5), + (-40, 43.5), + (-11.56553854601814, 88.5), + (8.434461453981855, 88.5), + ], + weights=[1, 3, 3, 1], +) +[ + SketchPoint_8, + SketchPoint_9, + SketchPoint_10, + SketchPoint_11, +] = SketchBSpline_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[SketchLine_9, SketchLine_10, SketchLine_11] = SketchBSpline_1.controlPolygon( + auxiliary=[0, 1, 2] +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_11).coordinates(), SketchLine_6.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_11.result() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_8).coordinates(), SketchArc_3.endPoint() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_6.result() +) SketchLine_12 = Sketch_1.addLine(-19.07878402833891, -6, -23.3, -6) SketchLine_13 = Sketch_1.addLine(-23.3, -6, -23.3, 6) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchLine_14 = Sketch_1.addLine(-23.3, 6, -19.07878402833891, 6) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_14.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_13.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_12.result()) -SketchArc_4 = Sketch_1.addArc(0, 0, -19.07878402833891, -6, -19.07878402833891, 6, False) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_4.center()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchArc_4.endPoint()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_12.startPoint(), SketchArc_4.startPoint()) +SketchArc_4 = Sketch_1.addArc( + 0, 0, -19.07878402833891, -6, -19.07878402833891, 6, False +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_4.center() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_12.startPoint(), SketchArc_4.startPoint() +) SketchPoint_12 = Sketch_1.addPoint(-23.3, 0) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchPoint_12.coordinates(), SketchLine_3.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchPoint_12.coordinates(), SketchLine_13.result()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchPoint_12.coordinates(), SketchLine_3.result() +) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchPoint_12.coordinates(), SketchLine_13.result() +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_4.results()[1], 20) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_13.result(), 12) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_12.coordinates(), SketchAPI_Line(SketchLine_2).startPoint(), 23.3, True) -SketchBSplinePeriodic_1 = Sketch_1.addSpline(poles = [(-80, -23), (-80, 0), (-50, 0), (-50, -23)], periodic = True) -[SketchPoint_13, SketchPoint_14, SketchPoint_15, SketchPoint_16] = SketchBSplinePeriodic_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18] = SketchBSplinePeriodic_1.controlPolygon(auxiliary = [0, 1, 2, 3]) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_16.result(), SketchLine_5.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_18.result(), SketchLine_16.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_15.result(), SketchLine_17.result()) -SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular(SketchLine_18.result(), SketchLine_15.result()) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchPoint_12.coordinates(), SketchAPI_Line(SketchLine_2).startPoint(), 23.3, True +) +SketchBSplinePeriodic_1 = Sketch_1.addSpline( + poles=[(-80, -23), (-80, 0), (-50, 0), (-50, -23)], periodic=True +) +[ + SketchPoint_13, + SketchPoint_14, + SketchPoint_15, + SketchPoint_16, +] = SketchBSplinePeriodic_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[ + SketchLine_15, + SketchLine_16, + SketchLine_17, + SketchLine_18, +] = SketchBSplinePeriodic_1.controlPolygon(auxiliary=[0, 1, 2, 3]) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_16.result(), SketchLine_5.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_18.result(), SketchLine_16.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_15.result(), SketchLine_17.result() +) +SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular( + SketchLine_18.result(), SketchLine_15.result() +) SketchEllipse_1 = Sketch_1.addEllipse(35, 45, 35, 67.91287847483518, 10) -[SketchPoint_17, SketchPoint_18, SketchPoint_19, SketchPoint_20, SketchPoint_21, SketchPoint_22, SketchPoint_23, SketchLine_19, SketchLine_20] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_19.result()) +[ + SketchPoint_17, + SketchPoint_18, + SketchPoint_19, + SketchPoint_20, + SketchPoint_21, + SketchPoint_22, + SketchPoint_23, + SketchLine_19, + SketchLine_20, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_19.result() +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_16.result(), 30) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_15.result(), 23) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_19.result(), 50) SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_20.result(), 20) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_4.center(), 50, True) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_23).coordinates(), SketchLine_4.result()) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_3.result(), 45, True) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_4.center(), 50, True +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_23).coordinates(), SketchLine_4.result() +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_3.result(), 45, True +) SketchCircle_2 = Sketch_1.addCircle(0, 66, 12) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_2.result(), SketchCircle_2.center()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchCircle_2.center() +) SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], 12) SketchLine_21 = Sketch_1.addLine(-60, 66, 0, 66) SketchLine_21.setAuxiliary(True) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_21.startPoint() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_21.result()) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchCircle_2.center() +) model.do() Sketch_1_Copy = model.copySketch(partSet, Sketch_1) @@ -128,8 +302,8 @@ Sketch_1_Copy = model.copySketch(partSet, Sketch_1) model.end() error = model.compareSketches(Sketch_1, Sketch_1_Copy) -assert(error == ""), error +assert error == "", error -assert(partSet.size("Features") == 2) +assert partSet.size("Features") == 2 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSketchCopy02.py b/src/SketchPlugin/Test/TestSketchCopy02.py index f2840d513..162050297 100644 --- a/src/SketchPlugin/Test/TestSketchCopy02.py +++ b/src/SketchPlugin/Test/TestSketchCopy02.py @@ -29,110 +29,290 @@ SketchLine_1 = Sketch_1.addLine(-40, -72, 0, -72) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "OY"), False) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "OX"), False) SketchLine_3 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 0, -72, 72, 0, False) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.center()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.result(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.center() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchArc_1.endPoint() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 72) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) -SketchEllipticArc_1 = Sketch_1.addEllipticArc(25, 0, 25, 74.98833242578475, 72, 0, 25, 88.5, False) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_4, SketchLine_5] = SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.result(), SketchEllipticArc_1.center()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchEllipticArc_1.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchEllipticArc_1.endPoint(), SketchAPI_Line(SketchLine_4).endPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_1.endPoint() +) +SketchEllipticArc_1 = Sketch_1.addEllipticArc( + 25, 0, 25, 74.98833242578475, 72, 0, 25, 88.5, False +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_4, + SketchLine_5, +] = SketchEllipticArc_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchEllipticArc_1.center() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchEllipticArc_1.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchEllipticArc_1.endPoint(), SketchAPI_Line(SketchLine_4).endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchLine_6 = Sketch_1.addLine(7.834161075251729, 88.5, 25, 88.5) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.endPoint()) -SketchArc_2 = Sketch_1.addArc(-40, -8.616197183098587, -40, -72, -94.21171510314713, 24.22579430808612, True) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_2.startPoint()) -SketchArc_3 = Sketch_1.addArc(-60, 3.5, -94.21171510314713, 24.22579430808612, -60, 43.5, True) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1]) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.endPoint() +) +SketchArc_2 = Sketch_1.addArc( + -40, -8.616197183098587, -40, -72, -94.21171510314713, 24.22579430808612, True +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_2.startPoint() +) +SketchArc_3 = Sketch_1.addArc( + -60, 3.5, -94.21171510314713, 24.22579430808612, -60, 43.5, True +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_3.results()[1], 40) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 25, True) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_2).startPoint(), + SketchAPI_Point(SketchPoint_1).coordinates(), + 25, + True, +) SketchLine_7 = Sketch_1.addLine(-40, -72, -40, -8.616197183098587) SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_7.endPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_7.result(), 90, type = "Direct") -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_3.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), 60) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchArc_3.endPoint(), SketchLine_6.startPoint(), 45) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_7.endPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_7.result(), 90, type="Direct" +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchArc_3.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), 60 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchArc_3.endPoint(), SketchLine_6.startPoint(), 45 +) SketchLine_8 = Sketch_1.addLine(-60, 3.5, -60, 43.5) SketchLine_8.setAuxiliary(True) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_8.endPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_7.result(), SketchLine_8.result()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_8.endPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_7.result(), SketchLine_8.result() +) SketchCircle_1 = Sketch_1.addCircle(-60, 66, 22.5) SketchCircle_1.setAuxiliary(True) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_8.result(), SketchCircle_1.center()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_6.result(), SketchCircle_1.results()[1]) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_3.result(), 66, True) -SketchBSpline_1 = Sketch_1.addSpline(poles = [(-60, 43.5), (-40, 43.5), (-11.56553854601814, 88.5), (8.434461453981855, 88.5)], weights = [1, 3, 3, 1]) -[SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11] = SketchBSpline_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_9, SketchLine_10, SketchLine_11] = SketchBSpline_1.controlPolygon(auxiliary = [0, 1, 2]) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_11).coordinates(), SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_11.result()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_8).coordinates(), SketchArc_3.endPoint()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_8.result(), SketchCircle_1.center() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_6.result(), SketchCircle_1.results()[1] +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_3.result(), 66, True +) +SketchBSpline_1 = Sketch_1.addSpline( + poles=[ + (-60, 43.5), + (-40, 43.5), + (-11.56553854601814, 88.5), + (8.434461453981855, 88.5), + ], + weights=[1, 3, 3, 1], +) +[ + SketchPoint_8, + SketchPoint_9, + SketchPoint_10, + SketchPoint_11, +] = SketchBSpline_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[SketchLine_9, SketchLine_10, SketchLine_11] = SketchBSpline_1.controlPolygon( + auxiliary=[0, 1, 2] +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_11).coordinates(), SketchLine_6.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_11.result() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_8).coordinates(), SketchArc_3.endPoint() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_6.result() +) SketchLine_12 = Sketch_1.addLine(-19.07878402833891, -6, -23.3, -6) SketchLine_13 = Sketch_1.addLine(-23.3, -6, -23.3, 6) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchLine_14 = Sketch_1.addLine(-23.3, 6, -19.07878402833891, 6) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_14.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_13.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_12.result()) -SketchArc_4 = Sketch_1.addArc(0, 0, -19.07878402833891, -6, -19.07878402833891, 6, False) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_4.center()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchArc_4.endPoint()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_12.startPoint(), SketchArc_4.startPoint()) +SketchArc_4 = Sketch_1.addArc( + 0, 0, -19.07878402833891, -6, -19.07878402833891, 6, False +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_4.center() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_12.startPoint(), SketchArc_4.startPoint() +) SketchPoint_12 = Sketch_1.addPoint(-23.3, 0) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchPoint_12.coordinates(), SketchLine_3.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchPoint_12.coordinates(), SketchLine_13.result()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchPoint_12.coordinates(), SketchLine_3.result() +) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchPoint_12.coordinates(), SketchLine_13.result() +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_4.results()[1], 20) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_13.result(), 12) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_12.coordinates(), SketchAPI_Line(SketchLine_2).startPoint(), 23.3, True) -SketchBSplinePeriodic_1 = Sketch_1.addSpline(poles = [(-80, -23), (-80, 0), (-50, 0), (-50, -23)], periodic = True) -[SketchPoint_13, SketchPoint_14, SketchPoint_15, SketchPoint_16] = SketchBSplinePeriodic_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18] = SketchBSplinePeriodic_1.controlPolygon(auxiliary = [0, 1, 2, 3]) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_16.result(), SketchLine_5.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_18.result(), SketchLine_16.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_15.result(), SketchLine_17.result()) -SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular(SketchLine_18.result(), SketchLine_15.result()) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchPoint_12.coordinates(), SketchAPI_Line(SketchLine_2).startPoint(), 23.3, True +) +SketchBSplinePeriodic_1 = Sketch_1.addSpline( + poles=[(-80, -23), (-80, 0), (-50, 0), (-50, -23)], periodic=True +) +[ + SketchPoint_13, + SketchPoint_14, + SketchPoint_15, + SketchPoint_16, +] = SketchBSplinePeriodic_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[ + SketchLine_15, + SketchLine_16, + SketchLine_17, + SketchLine_18, +] = SketchBSplinePeriodic_1.controlPolygon(auxiliary=[0, 1, 2, 3]) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_16.result(), SketchLine_5.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_18.result(), SketchLine_16.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_15.result(), SketchLine_17.result() +) +SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular( + SketchLine_18.result(), SketchLine_15.result() +) SketchEllipse_1 = Sketch_1.addEllipse(35, 45, 35, 67.91287847483518, 10) -[SketchPoint_17, SketchPoint_18, SketchPoint_19, SketchPoint_20, SketchPoint_21, SketchPoint_22, SketchPoint_23, SketchLine_19, SketchLine_20] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_19.result()) +[ + SketchPoint_17, + SketchPoint_18, + SketchPoint_19, + SketchPoint_20, + SketchPoint_21, + SketchPoint_22, + SketchPoint_23, + SketchLine_19, + SketchLine_20, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_19.result() +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_16.result(), 30) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_15.result(), 23) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_19.result(), 50) SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_20.result(), 20) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_4.center(), 50, True) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_23).coordinates(), SketchLine_4.result()) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_3.result(), 45, True) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_4.center(), 50, True +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_23).coordinates(), SketchLine_4.result() +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_3.result(), 45, True +) SketchCircle_2 = Sketch_1.addCircle(0, 66, 12) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_2.result(), SketchCircle_2.center()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchCircle_2.center() +) SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], 12) SketchLine_21 = Sketch_1.addLine(-60, 66, 0, 66) SketchLine_21.setAuxiliary(True) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_21.startPoint() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_21.result()) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchCircle_2.center() +) model.do() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1_Copy = model.copySketch(Part_1_doc, Sketch_1) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", Sketch_1_Copy.name())], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", Sketch_1_Copy.name())], + model.selection(), + 10, + 0, +) model.end() error = model.compareSketches(Sketch_1, Sketch_1_Copy) -assert(error == ""), error +assert error == "", error model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [5]) @@ -142,7 +322,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [126]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [252]) model.testResultsVolumes(Extrusion_1, [213109.1306148178]) -assert(partSet.size("Features") == 2) -assert(Part_1_doc.size("Features") == 2) +assert partSet.size("Features") == 2 +assert Part_1_doc.size("Features") == 2 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSketchCopy03.py b/src/SketchPlugin/Test/TestSketchCopy03.py index d7ae10417..96b388683 100644 --- a/src/SketchPlugin/Test/TestSketchCopy03.py +++ b/src/SketchPlugin/Test/TestSketchCopy03.py @@ -29,111 +29,302 @@ SketchLine_1 = Sketch_1.addLine(-40, -72, 0, -72) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "OY"), False) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "OX"), False) SketchLine_3 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 0, -72, 72, 0, False) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.center()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.result(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.center() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchArc_1.endPoint() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 72) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) -SketchEllipticArc_1 = Sketch_1.addEllipticArc(25, 0, 25, 74.98833242578475, 72, 0, 25, 88.5, False) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_4, SketchLine_5] = SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.result(), SketchEllipticArc_1.center()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchEllipticArc_1.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchEllipticArc_1.endPoint(), SketchAPI_Line(SketchLine_4).endPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_1.endPoint() +) +SketchEllipticArc_1 = Sketch_1.addEllipticArc( + 25, 0, 25, 74.98833242578475, 72, 0, 25, 88.5, False +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_4, + SketchLine_5, +] = SketchEllipticArc_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchEllipticArc_1.center() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchEllipticArc_1.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchEllipticArc_1.endPoint(), SketchAPI_Line(SketchLine_4).endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchLine_6 = Sketch_1.addLine(7.834161075251729, 88.5, 25, 88.5) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.endPoint()) -SketchArc_2 = Sketch_1.addArc(-40, -8.616197183098587, -40, -72, -94.21171510314713, 24.22579430808612, True) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_2.startPoint()) -SketchArc_3 = Sketch_1.addArc(-60, 3.5, -94.21171510314713, 24.22579430808612, -60, 43.5, True) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1]) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.endPoint() +) +SketchArc_2 = Sketch_1.addArc( + -40, -8.616197183098587, -40, -72, -94.21171510314713, 24.22579430808612, True +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_2.startPoint() +) +SketchArc_3 = Sketch_1.addArc( + -60, 3.5, -94.21171510314713, 24.22579430808612, -60, 43.5, True +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_3.results()[1], 40) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 25, True) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_2).startPoint(), + SketchAPI_Point(SketchPoint_1).coordinates(), + 25, + True, +) SketchLine_7 = Sketch_1.addLine(-40, -72, -40, -8.616197183098587) SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_7.endPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_7.result(), 90, type = "Direct") -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_3.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), 60) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchArc_3.endPoint(), SketchLine_6.startPoint(), 45) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_7.endPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_7.result(), 90, type="Direct" +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchArc_3.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), 60 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchArc_3.endPoint(), SketchLine_6.startPoint(), 45 +) SketchLine_8 = Sketch_1.addLine(-60, 3.5, -60, 43.5) SketchLine_8.setAuxiliary(True) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_8.endPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_7.result(), SketchLine_8.result()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_8.endPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_7.result(), SketchLine_8.result() +) SketchCircle_1 = Sketch_1.addCircle(-60, 66, 22.5) SketchCircle_1.setAuxiliary(True) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_8.result(), SketchCircle_1.center()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_6.result(), SketchCircle_1.results()[1]) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_3.result(), 66, True) -SketchBSpline_1 = Sketch_1.addSpline(poles = [(-60, 43.5), (-40, 43.5), (-11.56553854601814, 88.5), (8.434461453981855, 88.5)], weights = [1, 3, 3, 1]) -[SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11] = SketchBSpline_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_9, SketchLine_10, SketchLine_11] = SketchBSpline_1.controlPolygon(auxiliary = [0, 1, 2]) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_11).coordinates(), SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_11.result()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_8).coordinates(), SketchArc_3.endPoint()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_8.result(), SketchCircle_1.center() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_6.result(), SketchCircle_1.results()[1] +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_3.result(), 66, True +) +SketchBSpline_1 = Sketch_1.addSpline( + poles=[ + (-60, 43.5), + (-40, 43.5), + (-11.56553854601814, 88.5), + (8.434461453981855, 88.5), + ], + weights=[1, 3, 3, 1], +) +[ + SketchPoint_8, + SketchPoint_9, + SketchPoint_10, + SketchPoint_11, +] = SketchBSpline_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[SketchLine_9, SketchLine_10, SketchLine_11] = SketchBSpline_1.controlPolygon( + auxiliary=[0, 1, 2] +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_11).coordinates(), SketchLine_6.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_11.result() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_8).coordinates(), SketchArc_3.endPoint() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_6.result() +) SketchLine_12 = Sketch_1.addLine(-19.07878402833891, -6, -23.3, -6) SketchLine_13 = Sketch_1.addLine(-23.3, -6, -23.3, 6) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchLine_14 = Sketch_1.addLine(-23.3, 6, -19.07878402833891, 6) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_14.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_13.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_12.result()) -SketchArc_4 = Sketch_1.addArc(0, 0, -19.07878402833891, -6, -19.07878402833891, 6, False) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_4.center()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchArc_4.endPoint()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_12.startPoint(), SketchArc_4.startPoint()) +SketchArc_4 = Sketch_1.addArc( + 0, 0, -19.07878402833891, -6, -19.07878402833891, 6, False +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_4.center() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_12.startPoint(), SketchArc_4.startPoint() +) SketchPoint_12 = Sketch_1.addPoint(-23.3, 0) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchPoint_12.coordinates(), SketchLine_3.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchPoint_12.coordinates(), SketchLine_13.result()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchPoint_12.coordinates(), SketchLine_3.result() +) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchPoint_12.coordinates(), SketchLine_13.result() +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_4.results()[1], 20) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_13.result(), 12) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_12.coordinates(), SketchAPI_Line(SketchLine_2).startPoint(), 23.3, True) -SketchBSplinePeriodic_1 = Sketch_1.addSpline(poles = [(-80, -23), (-80, 0), (-50, 0), (-50, -23)], periodic = True) -[SketchPoint_13, SketchPoint_14, SketchPoint_15, SketchPoint_16] = SketchBSplinePeriodic_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18] = SketchBSplinePeriodic_1.controlPolygon(auxiliary = [0, 1, 2, 3]) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_16.result(), SketchLine_5.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_18.result(), SketchLine_16.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_15.result(), SketchLine_17.result()) -SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular(SketchLine_18.result(), SketchLine_15.result()) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchPoint_12.coordinates(), SketchAPI_Line(SketchLine_2).startPoint(), 23.3, True +) +SketchBSplinePeriodic_1 = Sketch_1.addSpline( + poles=[(-80, -23), (-80, 0), (-50, 0), (-50, -23)], periodic=True +) +[ + SketchPoint_13, + SketchPoint_14, + SketchPoint_15, + SketchPoint_16, +] = SketchBSplinePeriodic_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[ + SketchLine_15, + SketchLine_16, + SketchLine_17, + SketchLine_18, +] = SketchBSplinePeriodic_1.controlPolygon(auxiliary=[0, 1, 2, 3]) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_16.result(), SketchLine_5.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_18.result(), SketchLine_16.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_15.result(), SketchLine_17.result() +) +SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular( + SketchLine_18.result(), SketchLine_15.result() +) SketchEllipse_1 = Sketch_1.addEllipse(35, 45, 35, 67.91287847483518, 10) -[SketchPoint_17, SketchPoint_18, SketchPoint_19, SketchPoint_20, SketchPoint_21, SketchPoint_22, SketchPoint_23, SketchLine_19, SketchLine_20] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_19.result()) +[ + SketchPoint_17, + SketchPoint_18, + SketchPoint_19, + SketchPoint_20, + SketchPoint_21, + SketchPoint_22, + SketchPoint_23, + SketchLine_19, + SketchLine_20, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_19.result() +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_16.result(), 30) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_15.result(), 23) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_19.result(), 50) SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_20.result(), 20) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_4.center(), 50, True) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_23).coordinates(), SketchLine_4.result()) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_3.result(), 45, True) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_4.center(), 50, True +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_23).coordinates(), SketchLine_4.result() +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_3.result(), 45, True +) SketchCircle_2 = Sketch_1.addCircle(0, 66, 12) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_2.result(), SketchCircle_2.center()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchCircle_2.center() +) SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], 12) SketchLine_21 = Sketch_1.addLine(-60, 66, 0, 66) SketchLine_21.setAuxiliary(True) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_21.startPoint() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_21.result()) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchCircle_2.center() +) 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-SketchLine_1r-SketchArc_1_2f-SketchEllipticArc_1f-SketchLine_6r-SketchBSpline_1r-SketchArc_3_2f-SketchArc_2_2f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchArc_4_2r-SketchBSplinePeriodic_1f-SketchEllipse_1r-SketchCircle_2_2r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "PartSet/Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchEllipticArc_1f-SketchLine_6r-SketchBSpline_1r-SketchArc_3_2f-SketchArc_2_2f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchArc_4_2r-SketchBSplinePeriodic_1f-SketchEllipse_1r-SketchCircle_2_2r", + ) + ], + model.selection(), + 10, + 0, +) Sketch_1_Copy = model.copySketch(Part_1_doc, Sketch_1) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", Sketch_1_Copy.name())], model.selection(), 0, 10) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", Sketch_1_Copy.name())], + model.selection(), + 0, + 10, +) model.end() error = model.compareSketches(Sketch_1, Sketch_1_Copy) -assert(error == ""), error +assert error == "", error model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [0]) @@ -151,7 +342,7 @@ model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.EDGE, [126]) model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.VERTEX, [252]) model.testResultsVolumes(Extrusion_2, [213109.1306148178]) -assert(partSet.size("Features") == 2) -assert(Part_1_doc.size("Features") == 3) +assert partSet.size("Features") == 2 +assert Part_1_doc.size("Features") == 3 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSketchCopy04.py b/src/SketchPlugin/Test/TestSketchCopy04.py index ced34cfc2..7f33c8b2d 100644 --- a/src/SketchPlugin/Test/TestSketchCopy04.py +++ b/src/SketchPlugin/Test/TestSketchCopy04.py @@ -29,104 +29,289 @@ SketchLine_1 = Sketch_1.addLine(-40, -72, 0, -72) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "OY"), False) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "OX"), False) SketchLine_3 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 0, -72, 72, 0, False) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.center()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.result(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.center() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchArc_1.endPoint() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 72) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) -SketchEllipticArc_1 = Sketch_1.addEllipticArc(25, 0, 25, 74.98833242578475, 72, 0, 25, 88.5, False) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_4, SketchLine_5] = SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.result(), SketchEllipticArc_1.center()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchEllipticArc_1.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchEllipticArc_1.endPoint(), SketchAPI_Line(SketchLine_4).endPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_1.endPoint() +) +SketchEllipticArc_1 = Sketch_1.addEllipticArc( + 25, 0, 25, 74.98833242578475, 72, 0, 25, 88.5, False +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_4, + SketchLine_5, +] = SketchEllipticArc_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchEllipticArc_1.center() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchEllipticArc_1.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchEllipticArc_1.endPoint(), SketchAPI_Line(SketchLine_4).endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchLine_6 = Sketch_1.addLine(7.834161075251729, 88.5, 25, 88.5) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.endPoint()) -SketchArc_2 = Sketch_1.addArc(-40, -8.616197183098587, -40, -72, -94.21171510314713, 24.22579430808612, True) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_2.startPoint()) -SketchArc_3 = Sketch_1.addArc(-60, 3.5, -94.21171510314713, 24.22579430808612, -60, 43.5, True) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1]) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.endPoint() +) +SketchArc_2 = Sketch_1.addArc( + -40, -8.616197183098587, -40, -72, -94.21171510314713, 24.22579430808612, True +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_2.startPoint() +) +SketchArc_3 = Sketch_1.addArc( + -60, 3.5, -94.21171510314713, 24.22579430808612, -60, 43.5, True +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_3.results()[1], 40) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 25, True) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_2).startPoint(), + SketchAPI_Point(SketchPoint_1).coordinates(), + 25, + True, +) SketchLine_7 = Sketch_1.addLine(-40, -72, -40, -8.616197183098587) SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_7.endPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_7.result(), 90, type = "Direct") -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_3.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), 60) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchArc_3.endPoint(), SketchLine_6.startPoint(), 45) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_7.endPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_7.result(), 90, type="Direct" +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchArc_3.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), 60 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchArc_3.endPoint(), SketchLine_6.startPoint(), 45 +) SketchLine_8 = Sketch_1.addLine(-60, 3.5, -60, 43.5) SketchLine_8.setAuxiliary(True) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_8.endPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_7.result(), SketchLine_8.result()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_8.endPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_7.result(), SketchLine_8.result() +) SketchCircle_1 = Sketch_1.addCircle(-60, 66, 22.5) SketchCircle_1.setAuxiliary(True) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_8.result(), SketchCircle_1.center()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_6.result(), SketchCircle_1.results()[1]) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_3.result(), 66, True) -SketchBSpline_1 = Sketch_1.addSpline(poles = [(-60, 43.5), (-40, 43.5), (-11.56553854601814, 88.5), (8.434461453981855, 88.5)], weights = [1, 3, 3, 1]) -[SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11] = SketchBSpline_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_9, SketchLine_10, SketchLine_11] = SketchBSpline_1.controlPolygon(auxiliary = [0, 1, 2]) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_11).coordinates(), SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_11.result()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_8).coordinates(), SketchArc_3.endPoint()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_8.result(), SketchCircle_1.center() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_6.result(), SketchCircle_1.results()[1] +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_3.result(), 66, True +) +SketchBSpline_1 = Sketch_1.addSpline( + poles=[ + (-60, 43.5), + (-40, 43.5), + (-11.56553854601814, 88.5), + (8.434461453981855, 88.5), + ], + weights=[1, 3, 3, 1], +) +[ + SketchPoint_8, + SketchPoint_9, + SketchPoint_10, + SketchPoint_11, +] = SketchBSpline_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[SketchLine_9, SketchLine_10, SketchLine_11] = SketchBSpline_1.controlPolygon( + auxiliary=[0, 1, 2] +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_11).coordinates(), SketchLine_6.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_11.result() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_8).coordinates(), SketchArc_3.endPoint() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_6.result() +) SketchLine_12 = Sketch_1.addLine(-19.07878402833891, -6, -23.3, -6) SketchLine_13 = Sketch_1.addLine(-23.3, -6, -23.3, 6) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchLine_14 = Sketch_1.addLine(-23.3, 6, -19.07878402833891, 6) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_14.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_13.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_12.result()) -SketchArc_4 = Sketch_1.addArc(0, 0, -19.07878402833891, -6, -19.07878402833891, 6, False) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_4.center()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchArc_4.endPoint()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_12.startPoint(), SketchArc_4.startPoint()) +SketchArc_4 = Sketch_1.addArc( + 0, 0, -19.07878402833891, -6, -19.07878402833891, 6, False +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_4.center() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_12.startPoint(), SketchArc_4.startPoint() +) SketchPoint_12 = Sketch_1.addPoint(-23.3, 0) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchPoint_12.coordinates(), SketchLine_3.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchPoint_12.coordinates(), SketchLine_13.result()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchPoint_12.coordinates(), SketchLine_3.result() +) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchPoint_12.coordinates(), SketchLine_13.result() +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_4.results()[1], 20) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_13.result(), 12) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_12.coordinates(), SketchAPI_Line(SketchLine_2).startPoint(), 23.3, True) -SketchBSplinePeriodic_1 = Sketch_1.addSpline(poles = [(-80, -23), (-80, 0), (-50, 0), (-50, -23)], periodic = True) -[SketchPoint_13, SketchPoint_14, SketchPoint_15, SketchPoint_16] = SketchBSplinePeriodic_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18] = SketchBSplinePeriodic_1.controlPolygon(auxiliary = [0, 1, 2, 3]) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_16.result(), SketchLine_5.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_18.result(), SketchLine_16.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_15.result(), SketchLine_17.result()) -SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular(SketchLine_18.result(), SketchLine_15.result()) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchPoint_12.coordinates(), SketchAPI_Line(SketchLine_2).startPoint(), 23.3, True +) +SketchBSplinePeriodic_1 = Sketch_1.addSpline( + poles=[(-80, -23), (-80, 0), (-50, 0), (-50, -23)], periodic=True +) +[ + SketchPoint_13, + SketchPoint_14, + SketchPoint_15, + SketchPoint_16, +] = SketchBSplinePeriodic_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[ + SketchLine_15, + SketchLine_16, + SketchLine_17, + SketchLine_18, +] = SketchBSplinePeriodic_1.controlPolygon(auxiliary=[0, 1, 2, 3]) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_16.result(), SketchLine_5.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_18.result(), SketchLine_16.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_15.result(), SketchLine_17.result() +) +SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular( + SketchLine_18.result(), SketchLine_15.result() +) SketchEllipse_1 = Sketch_1.addEllipse(35, 45, 35, 67.91287847483518, 10) -[SketchPoint_17, SketchPoint_18, SketchPoint_19, SketchPoint_20, SketchPoint_21, SketchPoint_22, SketchPoint_23, SketchLine_19, SketchLine_20] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_19.result()) +[ + SketchPoint_17, + SketchPoint_18, + SketchPoint_19, + SketchPoint_20, + SketchPoint_21, + SketchPoint_22, + SketchPoint_23, + SketchLine_19, + SketchLine_20, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_19.result() +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_16.result(), 30) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_15.result(), 23) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_19.result(), 50) SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_20.result(), 20) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_4.center(), 50, True) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_23).coordinates(), SketchLine_4.result()) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_3.result(), 45, True) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_4.center(), 50, True +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_23).coordinates(), SketchLine_4.result() +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_3.result(), 45, True +) SketchCircle_2 = Sketch_1.addCircle(0, 66, 12) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_2.result(), SketchCircle_2.center()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchCircle_2.center() +) SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], 12) SketchLine_21 = Sketch_1.addLine(-60, 66, 0, 66) SketchLine_21.setAuxiliary(True) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_21.startPoint() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_21.result()) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchCircle_2.center() +) 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-SketchLine_1r-SketchArc_1_2f-SketchEllipticArc_1f-SketchLine_6r-SketchBSpline_1r-SketchArc_3_2f-SketchArc_2_2f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchArc_4_2r-SketchBSplinePeriodic_1f-SketchEllipse_1r-SketchCircle_2_2r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "PartSet/Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchEllipticArc_1f-SketchLine_6r-SketchBSpline_1r-SketchArc_3_2f-SketchArc_2_2f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchArc_4_2r-SketchBSplinePeriodic_1f-SketchEllipse_1r-SketchCircle_2_2r", + ) + ], + model.selection(), + 10, + 0, +) # copy sketch to the partSet after the part Sketch_1_Copy = model.copySketch(partSet, Sketch_1) @@ -134,7 +319,7 @@ Sketch_1_Copy = model.copySketch(partSet, Sketch_1) model.end() error = model.compareSketches(Sketch_1, Sketch_1_Copy) -assert(error == ""), error +assert error == "", error model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [0]) @@ -144,7 +329,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [84]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [168]) model.testResultsVolumes(Extrusion_1, [183140.3921289446]) -assert(partSet.size("Features") == 3) -assert(Part_1_doc.size("Features") == 1) +assert partSet.size("Features") == 3 +assert Part_1_doc.size("Features") == 1 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSketchCopy05.py b/src/SketchPlugin/Test/TestSketchCopy05.py index 4676dbb2f..62f362c60 100644 --- a/src/SketchPlugin/Test/TestSketchCopy05.py +++ b/src/SketchPlugin/Test/TestSketchCopy05.py @@ -29,110 +29,294 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(-40, -72, 0, -72) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_3 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 0, -72, 72, 0, False) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.center()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.result(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.center() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchArc_1.endPoint() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 72) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) -SketchEllipticArc_1 = Sketch_1.addEllipticArc(25, 0, 25, 74.98833242578475, 72, 0, 25, 88.5, False) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_4, SketchLine_5] = SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.result(), SketchEllipticArc_1.center()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchEllipticArc_1.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchEllipticArc_1.endPoint(), SketchAPI_Line(SketchLine_4).endPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_1.endPoint() +) +SketchEllipticArc_1 = Sketch_1.addEllipticArc( + 25, 0, 25, 74.98833242578475, 72, 0, 25, 88.5, False +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_4, + SketchLine_5, +] = SketchEllipticArc_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchEllipticArc_1.center() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchEllipticArc_1.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchEllipticArc_1.endPoint(), SketchAPI_Line(SketchLine_4).endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchLine_6 = Sketch_1.addLine(7.834161075251729, 88.5, 25, 88.5) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.endPoint()) -SketchArc_2 = Sketch_1.addArc(-40, -8.616197183098587, -40, -72, -94.21171510314713, 24.22579430808612, True) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_2.startPoint()) -SketchArc_3 = Sketch_1.addArc(-60, 3.5, -94.21171510314713, 24.22579430808612, -60, 43.5, True) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1]) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.endPoint() +) +SketchArc_2 = Sketch_1.addArc( + -40, -8.616197183098587, -40, -72, -94.21171510314713, 24.22579430808612, True +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_2.startPoint() +) +SketchArc_3 = Sketch_1.addArc( + -60, 3.5, -94.21171510314713, 24.22579430808612, -60, 43.5, True +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_3.results()[1], 40) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 25, True) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_2).startPoint(), + SketchAPI_Point(SketchPoint_1).coordinates(), + 25, + True, +) SketchLine_7 = Sketch_1.addLine(-40, -72, -40, -8.616197183098587) SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_7.endPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_7.result(), 90, type = "Direct") -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_3.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), 60) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchArc_3.endPoint(), SketchLine_6.startPoint(), 45) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_7.endPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_7.result(), 90, type="Direct" +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchArc_3.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), 60 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchArc_3.endPoint(), SketchLine_6.startPoint(), 45 +) SketchLine_8 = Sketch_1.addLine(-60, 3.5, -60, 43.5) SketchLine_8.setAuxiliary(True) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_8.endPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_7.result(), SketchLine_8.result()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_8.endPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_7.result(), SketchLine_8.result() +) SketchCircle_1 = Sketch_1.addCircle(-60, 66, 22.5) SketchCircle_1.setAuxiliary(True) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_8.result(), SketchCircle_1.center()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_6.result(), SketchCircle_1.results()[1]) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_3.result(), 66, True) -SketchBSpline_1 = Sketch_1.addSpline(poles = [(-60, 43.5), (-40, 43.5), (-11.56553854601814, 88.5), (8.434461453981855, 88.5)], weights = [1, 3, 3, 1]) -[SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11] = SketchBSpline_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_9, SketchLine_10, SketchLine_11] = SketchBSpline_1.controlPolygon(auxiliary = [0, 1, 2]) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_11).coordinates(), SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_11.result()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_8).coordinates(), SketchArc_3.endPoint()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_8.result(), SketchCircle_1.center() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_6.result(), SketchCircle_1.results()[1] +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_3.result(), 66, True +) +SketchBSpline_1 = Sketch_1.addSpline( + poles=[ + (-60, 43.5), + (-40, 43.5), + (-11.56553854601814, 88.5), + (8.434461453981855, 88.5), + ], + weights=[1, 3, 3, 1], +) +[ + SketchPoint_8, + SketchPoint_9, + SketchPoint_10, + SketchPoint_11, +] = SketchBSpline_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[SketchLine_9, SketchLine_10, SketchLine_11] = SketchBSpline_1.controlPolygon( + auxiliary=[0, 1, 2] +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_11).coordinates(), SketchLine_6.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_11.result() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_8).coordinates(), SketchArc_3.endPoint() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_6.result() +) SketchLine_12 = Sketch_1.addLine(-19.07878402833891, -6, -23.3, -6) SketchLine_13 = Sketch_1.addLine(-23.3, -6, -23.3, 6) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchLine_14 = Sketch_1.addLine(-23.3, 6, -19.07878402833891, 6) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_14.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_13.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_12.result()) -SketchArc_4 = Sketch_1.addArc(0, 0, -19.07878402833891, -6, -19.07878402833891, 6, False) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_4.center()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchArc_4.endPoint()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_12.startPoint(), SketchArc_4.startPoint()) +SketchArc_4 = Sketch_1.addArc( + 0, 0, -19.07878402833891, -6, -19.07878402833891, 6, False +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_4.center() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_12.startPoint(), SketchArc_4.startPoint() +) SketchPoint_12 = Sketch_1.addPoint(-23.3, 0) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchPoint_12.coordinates(), SketchLine_3.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchPoint_12.coordinates(), SketchLine_13.result()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchPoint_12.coordinates(), SketchLine_3.result() +) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchPoint_12.coordinates(), SketchLine_13.result() +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_4.results()[1], 20) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_13.result(), 12) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_12.coordinates(), SketchAPI_Line(SketchLine_2).startPoint(), 23.3, True) -SketchBSplinePeriodic_1 = Sketch_1.addSpline(poles = [(-80, -23), (-80, 0), (-50, 0), (-50, -23)], periodic = True) -[SketchPoint_13, SketchPoint_14, SketchPoint_15, SketchPoint_16] = SketchBSplinePeriodic_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18] = SketchBSplinePeriodic_1.controlPolygon(auxiliary = [0, 1, 2, 3]) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_16.result(), SketchLine_5.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_18.result(), SketchLine_16.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_15.result(), SketchLine_17.result()) -SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular(SketchLine_18.result(), SketchLine_15.result()) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchPoint_12.coordinates(), SketchAPI_Line(SketchLine_2).startPoint(), 23.3, True +) +SketchBSplinePeriodic_1 = Sketch_1.addSpline( + poles=[(-80, -23), (-80, 0), (-50, 0), (-50, -23)], periodic=True +) +[ + SketchPoint_13, + SketchPoint_14, + SketchPoint_15, + SketchPoint_16, +] = SketchBSplinePeriodic_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[ + SketchLine_15, + SketchLine_16, + SketchLine_17, + SketchLine_18, +] = SketchBSplinePeriodic_1.controlPolygon(auxiliary=[0, 1, 2, 3]) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_16.result(), SketchLine_5.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_18.result(), SketchLine_16.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_15.result(), SketchLine_17.result() +) +SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular( + SketchLine_18.result(), SketchLine_15.result() +) SketchEllipse_1 = Sketch_1.addEllipse(35, 45, 35, 67.91287847483518, 10) -[SketchPoint_17, SketchPoint_18, SketchPoint_19, SketchPoint_20, SketchPoint_21, SketchPoint_22, SketchPoint_23, SketchLine_19, SketchLine_20] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_19.result()) +[ + SketchPoint_17, + SketchPoint_18, + SketchPoint_19, + SketchPoint_20, + SketchPoint_21, + SketchPoint_22, + SketchPoint_23, + SketchLine_19, + SketchLine_20, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_19.result() +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_16.result(), 30) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_15.result(), 23) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_19.result(), 50) SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_20.result(), 20) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_4.center(), 50, True) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_23).coordinates(), SketchLine_4.result()) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_3.result(), 45, True) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_4.center(), 50, True +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_23).coordinates(), SketchLine_4.result() +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_3.result(), 45, True +) SketchCircle_2 = Sketch_1.addCircle(0, 66, 12) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_2.result(), SketchCircle_2.center()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchCircle_2.center() +) SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], 12) SketchLine_21 = Sketch_1.addLine(-60, 66, 0, 66) SketchLine_21.setAuxiliary(True) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_21.startPoint() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_21.result()) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchCircle_2.center() +) model.do() Sketch_1_Copy = model.copySketch(Part_1_doc, Sketch_1) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", Sketch_1_Copy.name())], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", Sketch_1_Copy.name())], + model.selection(), + 10, + 0, +) model.end() error = model.compareSketches(Sketch_1, Sketch_1_Copy) -assert(error == ""), error +assert error == "", error model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [5]) @@ -142,7 +326,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [126]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [252]) model.testResultsVolumes(Extrusion_1, [213109.1306148178]) -assert(partSet.size("Features") == 1) -assert(Part_1_doc.size("Features") == 3) +assert partSet.size("Features") == 1 +assert Part_1_doc.size("Features") == 3 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSketchCopy06.py b/src/SketchPlugin/Test/TestSketchCopy06.py index 6a0eb2323..416f85529 100644 --- a/src/SketchPlugin/Test/TestSketchCopy06.py +++ b/src/SketchPlugin/Test/TestSketchCopy06.py @@ -29,112 +29,307 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(-40, -72, 0, -72) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_3 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 0, -72, 72, 0, False) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.center()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.result(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.center() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchArc_1.endPoint() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 72) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) -SketchEllipticArc_1 = Sketch_1.addEllipticArc(25, 0, 25, 74.98833242578475, 72, 0, 25, 88.5, False) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_4, SketchLine_5] = SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.result(), SketchEllipticArc_1.center()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchEllipticArc_1.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchEllipticArc_1.endPoint(), SketchAPI_Line(SketchLine_4).endPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_1.endPoint() +) +SketchEllipticArc_1 = Sketch_1.addEllipticArc( + 25, 0, 25, 74.98833242578475, 72, 0, 25, 88.5, False +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_4, + SketchLine_5, +] = SketchEllipticArc_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchEllipticArc_1.center() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchEllipticArc_1.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchEllipticArc_1.endPoint(), SketchAPI_Line(SketchLine_4).endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchLine_6 = Sketch_1.addLine(7.834161075251729, 88.5, 25, 88.5) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.endPoint()) -SketchArc_2 = Sketch_1.addArc(-40, -8.616197183098587, -40, -72, -94.21171510314713, 24.22579430808612, True) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_2.startPoint()) -SketchArc_3 = Sketch_1.addArc(-60, 3.5, -94.21171510314713, 24.22579430808612, -60, 43.5, True) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1]) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.endPoint() +) +SketchArc_2 = Sketch_1.addArc( + -40, -8.616197183098587, -40, -72, -94.21171510314713, 24.22579430808612, True +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_2.startPoint() +) +SketchArc_3 = Sketch_1.addArc( + -60, 3.5, -94.21171510314713, 24.22579430808612, -60, 43.5, True +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_3.results()[1], 40) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 25, True) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_2).startPoint(), + SketchAPI_Point(SketchPoint_1).coordinates(), + 25, + True, +) SketchLine_7 = Sketch_1.addLine(-40, -72, -40, -8.616197183098587) SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_7.endPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_7.result(), 90, type = "Direct") -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_3.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), 60) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchArc_3.endPoint(), SketchLine_6.startPoint(), 45) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_7.endPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_7.result(), 90, type="Direct" +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchArc_3.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), 60 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchArc_3.endPoint(), SketchLine_6.startPoint(), 45 +) SketchLine_8 = Sketch_1.addLine(-60, 3.5, -60, 43.5) SketchLine_8.setAuxiliary(True) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_8.endPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_7.result(), SketchLine_8.result()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_8.endPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_7.result(), SketchLine_8.result() +) SketchCircle_1 = Sketch_1.addCircle(-60, 66, 22.5) SketchCircle_1.setAuxiliary(True) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_8.result(), SketchCircle_1.center()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_6.result(), SketchCircle_1.results()[1]) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_3.result(), 66, True) -SketchBSpline_1 = Sketch_1.addSpline(poles = [(-60, 43.5), (-40, 43.5), (-11.56553854601814, 88.5), (8.434461453981855, 88.5)], weights = [1, 3, 3, 1]) -[SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11] = SketchBSpline_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_9, SketchLine_10, SketchLine_11] = SketchBSpline_1.controlPolygon(auxiliary = [0, 1, 2]) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_11).coordinates(), SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_11.result()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_8).coordinates(), SketchArc_3.endPoint()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_8.result(), SketchCircle_1.center() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_6.result(), SketchCircle_1.results()[1] +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_3.result(), 66, True +) +SketchBSpline_1 = Sketch_1.addSpline( + poles=[ + (-60, 43.5), + (-40, 43.5), + (-11.56553854601814, 88.5), + (8.434461453981855, 88.5), + ], + weights=[1, 3, 3, 1], +) +[ + SketchPoint_8, + SketchPoint_9, + SketchPoint_10, + SketchPoint_11, +] = SketchBSpline_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[SketchLine_9, SketchLine_10, SketchLine_11] = SketchBSpline_1.controlPolygon( + auxiliary=[0, 1, 2] +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_11).coordinates(), SketchLine_6.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_11.result() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_8).coordinates(), SketchArc_3.endPoint() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_6.result() +) SketchLine_12 = Sketch_1.addLine(-19.07878402833891, -6, -23.3, -6) SketchLine_13 = Sketch_1.addLine(-23.3, -6, -23.3, 6) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchLine_14 = Sketch_1.addLine(-23.3, 6, -19.07878402833891, 6) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_14.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_13.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_12.result()) -SketchArc_4 = Sketch_1.addArc(0, 0, -19.07878402833891, -6, -19.07878402833891, 6, False) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_4.center()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchArc_4.endPoint()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_12.startPoint(), SketchArc_4.startPoint()) +SketchArc_4 = Sketch_1.addArc( + 0, 0, -19.07878402833891, -6, -19.07878402833891, 6, False +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_4.center() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_12.startPoint(), SketchArc_4.startPoint() +) SketchPoint_12 = Sketch_1.addPoint(-23.3, 0) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchPoint_12.coordinates(), SketchLine_3.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchPoint_12.coordinates(), SketchLine_13.result()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchPoint_12.coordinates(), SketchLine_3.result() +) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchPoint_12.coordinates(), SketchLine_13.result() +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_4.results()[1], 20) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_13.result(), 12) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_12.coordinates(), SketchAPI_Line(SketchLine_2).startPoint(), 23.3, True) -SketchBSplinePeriodic_1 = Sketch_1.addSpline(poles = [(-80, -23), (-80, 0), (-50, 0), (-50, -23)], periodic = True) -[SketchPoint_13, SketchPoint_14, SketchPoint_15, SketchPoint_16] = SketchBSplinePeriodic_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18] = SketchBSplinePeriodic_1.controlPolygon(auxiliary = [0, 1, 2, 3]) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_16.result(), SketchLine_5.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_18.result(), SketchLine_16.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_15.result(), SketchLine_17.result()) -SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular(SketchLine_18.result(), SketchLine_15.result()) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchPoint_12.coordinates(), SketchAPI_Line(SketchLine_2).startPoint(), 23.3, True +) +SketchBSplinePeriodic_1 = Sketch_1.addSpline( + poles=[(-80, -23), (-80, 0), (-50, 0), (-50, -23)], periodic=True +) +[ + SketchPoint_13, + SketchPoint_14, + SketchPoint_15, + SketchPoint_16, +] = SketchBSplinePeriodic_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[ + SketchLine_15, + SketchLine_16, + SketchLine_17, + SketchLine_18, +] = SketchBSplinePeriodic_1.controlPolygon(auxiliary=[0, 1, 2, 3]) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_16.result(), SketchLine_5.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_18.result(), SketchLine_16.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_15.result(), SketchLine_17.result() +) +SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular( + SketchLine_18.result(), SketchLine_15.result() +) SketchEllipse_1 = Sketch_1.addEllipse(35, 45, 35, 67.91287847483518, 10) -[SketchPoint_17, SketchPoint_18, SketchPoint_19, SketchPoint_20, SketchPoint_21, SketchPoint_22, SketchPoint_23, SketchLine_19, SketchLine_20] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_19.result()) +[ + SketchPoint_17, + SketchPoint_18, + SketchPoint_19, + SketchPoint_20, + SketchPoint_21, + SketchPoint_22, + SketchPoint_23, + SketchLine_19, + SketchLine_20, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_19.result() +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_16.result(), 30) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_15.result(), 23) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_19.result(), 50) SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_20.result(), 20) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_4.center(), 50, True) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_23).coordinates(), SketchLine_4.result()) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_3.result(), 45, True) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_4.center(), 50, True +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_23).coordinates(), SketchLine_4.result() +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_3.result(), 45, True +) SketchCircle_2 = Sketch_1.addCircle(0, 66, 12) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_2.result(), SketchCircle_2.center()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchCircle_2.center() +) SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], 12) SketchLine_21 = Sketch_1.addLine(-60, 66, 0, 66) SketchLine_21.setAuxiliary(True) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_21.startPoint() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_21.result()) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchCircle_2.center() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchEllipticArc_1f-SketchLine_6r-SketchBSpline_1r-SketchArc_3_2f-SketchArc_2_2f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchArc_4_2r-SketchBSplinePeriodic_1f-SketchEllipse_1r-SketchCircle_2_2r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchEllipticArc_1f-SketchLine_6r-SketchBSpline_1r-SketchArc_3_2f-SketchArc_2_2f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchArc_4_2r-SketchBSplinePeriodic_1f-SketchEllipse_1r-SketchCircle_2_2r", + ) + ], + model.selection(), + 10, + 0, +) Sketch_1_Copy = model.copySketch(Part_1_doc, Sketch_1) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", Sketch_1_Copy.name())], model.selection(), 0, 10) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", Sketch_1_Copy.name())], + model.selection(), + 0, + 10, +) model.end() error = model.compareSketches(Sketch_1, Sketch_1_Copy) -assert(error == ""), error +assert error == "", error model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [0]) @@ -152,7 +347,7 @@ model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.EDGE, [126]) model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.VERTEX, [252]) model.testResultsVolumes(Extrusion_2, [213109.1306148178]) -assert(partSet.size("Features") == 1) -assert(Part_1_doc.size("Features") == 4) +assert partSet.size("Features") == 1 +assert Part_1_doc.size("Features") == 4 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSketchCopy07.py b/src/SketchPlugin/Test/TestSketchCopy07.py index 14ab8e221..19d3eccb6 100644 --- a/src/SketchPlugin/Test/TestSketchCopy07.py +++ b/src/SketchPlugin/Test/TestSketchCopy07.py @@ -29,111 +29,300 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(-40, -72, 0, -72) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_3 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 0, -72, 72, 0, False) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.center()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.result(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.center() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchArc_1.endPoint() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 72) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) -SketchEllipticArc_1 = Sketch_1.addEllipticArc(25, 0, 25, 74.98833242578475, 72, 0, 25, 88.5, False) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_4, SketchLine_5] = SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.result(), SketchEllipticArc_1.center()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchEllipticArc_1.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchEllipticArc_1.endPoint(), SketchAPI_Line(SketchLine_4).endPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_1.endPoint() +) +SketchEllipticArc_1 = Sketch_1.addEllipticArc( + 25, 0, 25, 74.98833242578475, 72, 0, 25, 88.5, False +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_4, + SketchLine_5, +] = SketchEllipticArc_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchEllipticArc_1.center() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchEllipticArc_1.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchEllipticArc_1.endPoint(), SketchAPI_Line(SketchLine_4).endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchLine_6 = Sketch_1.addLine(7.834161075251729, 88.5, 25, 88.5) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.endPoint()) -SketchArc_2 = Sketch_1.addArc(-40, -8.616197183098587, -40, -72, -94.21171510314713, 24.22579430808612, True) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_2.startPoint()) -SketchArc_3 = Sketch_1.addArc(-60, 3.5, -94.21171510314713, 24.22579430808612, -60, 43.5, True) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1]) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.endPoint() +) +SketchArc_2 = Sketch_1.addArc( + -40, -8.616197183098587, -40, -72, -94.21171510314713, 24.22579430808612, True +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_2.startPoint() +) +SketchArc_3 = Sketch_1.addArc( + -60, 3.5, -94.21171510314713, 24.22579430808612, -60, 43.5, True +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_3.results()[1], 40) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 25, True) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_2).startPoint(), + SketchAPI_Point(SketchPoint_1).coordinates(), + 25, + True, +) SketchLine_7 = Sketch_1.addLine(-40, -72, -40, -8.616197183098587) SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_7.endPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_7.result(), 90, type = "Direct") -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_3.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), 60) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchArc_3.endPoint(), SketchLine_6.startPoint(), 45) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_7.endPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_7.result(), 90, type="Direct" +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchArc_3.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), 60 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchArc_3.endPoint(), SketchLine_6.startPoint(), 45 +) SketchLine_8 = Sketch_1.addLine(-60, 3.5, -60, 43.5) SketchLine_8.setAuxiliary(True) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_8.endPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_7.result(), SketchLine_8.result()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_8.endPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_7.result(), SketchLine_8.result() +) SketchCircle_1 = Sketch_1.addCircle(-60, 66, 22.5) SketchCircle_1.setAuxiliary(True) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_8.result(), SketchCircle_1.center()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_6.result(), SketchCircle_1.results()[1]) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_3.result(), 66, True) -SketchBSpline_1 = Sketch_1.addSpline(poles = [(-60, 43.5), (-40, 43.5), (-11.56553854601814, 88.5), (8.434461453981855, 88.5)], weights = [1, 3, 3, 1]) -[SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11] = SketchBSpline_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_9, SketchLine_10, SketchLine_11] = SketchBSpline_1.controlPolygon(auxiliary = [0, 1, 2]) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_11).coordinates(), SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_11.result()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_8).coordinates(), SketchArc_3.endPoint()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_8.result(), SketchCircle_1.center() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_6.result(), SketchCircle_1.results()[1] +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_3.result(), 66, True +) +SketchBSpline_1 = Sketch_1.addSpline( + poles=[ + (-60, 43.5), + (-40, 43.5), + (-11.56553854601814, 88.5), + (8.434461453981855, 88.5), + ], + weights=[1, 3, 3, 1], +) +[ + SketchPoint_8, + SketchPoint_9, + SketchPoint_10, + SketchPoint_11, +] = SketchBSpline_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[SketchLine_9, SketchLine_10, SketchLine_11] = SketchBSpline_1.controlPolygon( + auxiliary=[0, 1, 2] +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_11).coordinates(), SketchLine_6.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_11.result() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_8).coordinates(), SketchArc_3.endPoint() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_6.result() +) SketchLine_12 = Sketch_1.addLine(-19.07878402833891, -6, -23.3, -6) SketchLine_13 = Sketch_1.addLine(-23.3, -6, -23.3, 6) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchLine_14 = Sketch_1.addLine(-23.3, 6, -19.07878402833891, 6) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_14.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_13.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_12.result()) -SketchArc_4 = Sketch_1.addArc(0, 0, -19.07878402833891, -6, -19.07878402833891, 6, False) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_4.center()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchArc_4.endPoint()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_12.startPoint(), SketchArc_4.startPoint()) +SketchArc_4 = Sketch_1.addArc( + 0, 0, -19.07878402833891, -6, -19.07878402833891, 6, False +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_4.center() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_12.startPoint(), SketchArc_4.startPoint() +) SketchPoint_12 = Sketch_1.addPoint(-23.3, 0) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchPoint_12.coordinates(), SketchLine_3.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchPoint_12.coordinates(), SketchLine_13.result()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchPoint_12.coordinates(), SketchLine_3.result() +) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchPoint_12.coordinates(), SketchLine_13.result() +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_4.results()[1], 20) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_13.result(), 12) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_12.coordinates(), SketchAPI_Line(SketchLine_2).startPoint(), 23.3, True) -SketchBSplinePeriodic_1 = Sketch_1.addSpline(poles = [(-80, -23), (-80, 0), (-50, 0), (-50, -23)], periodic = True) -[SketchPoint_13, SketchPoint_14, SketchPoint_15, SketchPoint_16] = SketchBSplinePeriodic_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18] = SketchBSplinePeriodic_1.controlPolygon(auxiliary = [0, 1, 2, 3]) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_16.result(), SketchLine_5.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_18.result(), SketchLine_16.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_15.result(), SketchLine_17.result()) -SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular(SketchLine_18.result(), SketchLine_15.result()) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchPoint_12.coordinates(), SketchAPI_Line(SketchLine_2).startPoint(), 23.3, True +) +SketchBSplinePeriodic_1 = Sketch_1.addSpline( + poles=[(-80, -23), (-80, 0), (-50, 0), (-50, -23)], periodic=True +) +[ + SketchPoint_13, + SketchPoint_14, + SketchPoint_15, + SketchPoint_16, +] = SketchBSplinePeriodic_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[ + SketchLine_15, + SketchLine_16, + SketchLine_17, + SketchLine_18, +] = SketchBSplinePeriodic_1.controlPolygon(auxiliary=[0, 1, 2, 3]) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_16.result(), SketchLine_5.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_18.result(), SketchLine_16.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_15.result(), SketchLine_17.result() +) +SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular( + SketchLine_18.result(), SketchLine_15.result() +) SketchEllipse_1 = Sketch_1.addEllipse(35, 45, 35, 67.91287847483518, 10) -[SketchPoint_17, SketchPoint_18, SketchPoint_19, SketchPoint_20, SketchPoint_21, SketchPoint_22, SketchPoint_23, SketchLine_19, SketchLine_20] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_19.result()) +[ + SketchPoint_17, + SketchPoint_18, + SketchPoint_19, + SketchPoint_20, + SketchPoint_21, + SketchPoint_22, + SketchPoint_23, + SketchLine_19, + SketchLine_20, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_19.result() +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_16.result(), 30) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_15.result(), 23) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_19.result(), 50) SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_20.result(), 20) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_4.center(), 50, True) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_23).coordinates(), SketchLine_4.result()) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_3.result(), 45, True) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_4.center(), 50, True +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_23).coordinates(), SketchLine_4.result() +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_3.result(), 45, True +) SketchCircle_2 = Sketch_1.addCircle(0, 66, 12) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_2.result(), SketchCircle_2.center()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchCircle_2.center() +) SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], 12) SketchLine_21 = Sketch_1.addLine(-60, 66, 0, 66) SketchLine_21.setAuxiliary(True) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_21.startPoint() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_21.result()) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchCircle_2.center() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchEllipticArc_1f-SketchLine_6r-SketchBSpline_1r-SketchArc_3_2f-SketchArc_2_2f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchArc_4_2r-SketchBSplinePeriodic_1f-SketchEllipse_1r-SketchCircle_2_2r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchEllipticArc_1f-SketchLine_6r-SketchBSpline_1r-SketchArc_3_2f-SketchArc_2_2f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchArc_4_2r-SketchBSplinePeriodic_1f-SketchEllipse_1r-SketchCircle_2_2r", + ) + ], + model.selection(), + 10, + 0, +) Sketch_1_Copy = model.copySketch(partSet, Sketch_1) model.end() error = model.compareSketches(Sketch_1, Sketch_1_Copy) -assert(error == ""), error +assert error == "", error model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [0]) @@ -143,7 +332,7 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [84]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [168]) model.testResultsVolumes(Extrusion_1, [183140.3921289446]) -assert(partSet.size("Features") == 2) -assert(Part_1_doc.size("Features") == 2) +assert partSet.size("Features") == 2 +assert Part_1_doc.size("Features") == 2 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSketchCopy08.py b/src/SketchPlugin/Test/TestSketchCopy08.py index ad0ee7832..00e14fe06 100644 --- a/src/SketchPlugin/Test/TestSketchCopy08.py +++ b/src/SketchPlugin/Test/TestSketchCopy08.py @@ -29,114 +29,309 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(-40, -72, 0, -72) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_3 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 0, -72, 72, 0, False) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.center()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.result(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.center() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchArc_1.endPoint() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 72) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) -SketchEllipticArc_1 = Sketch_1.addEllipticArc(25, 0, 25, 74.98833242578475, 72, 0, 25, 88.5, False) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_4, SketchLine_5] = SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.result(), SketchEllipticArc_1.center()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchEllipticArc_1.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchEllipticArc_1.endPoint(), SketchAPI_Line(SketchLine_4).endPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_1.endPoint() +) +SketchEllipticArc_1 = Sketch_1.addEllipticArc( + 25, 0, 25, 74.98833242578475, 72, 0, 25, 88.5, False +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_4, + SketchLine_5, +] = SketchEllipticArc_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchEllipticArc_1.center() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchEllipticArc_1.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchEllipticArc_1.endPoint(), SketchAPI_Line(SketchLine_4).endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchLine_6 = Sketch_1.addLine(7.834161075251729, 88.5, 25, 88.5) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.endPoint()) -SketchArc_2 = Sketch_1.addArc(-40, -8.616197183098587, -40, -72, -94.21171510314713, 24.22579430808612, True) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_2.startPoint()) -SketchArc_3 = Sketch_1.addArc(-60, 3.5, -94.21171510314713, 24.22579430808612, -60, 43.5, True) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1]) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.endPoint() +) +SketchArc_2 = Sketch_1.addArc( + -40, -8.616197183098587, -40, -72, -94.21171510314713, 24.22579430808612, True +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_2.startPoint() +) +SketchArc_3 = Sketch_1.addArc( + -60, 3.5, -94.21171510314713, 24.22579430808612, -60, 43.5, True +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_3.results()[1], 40) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 25, True) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_2).startPoint(), + SketchAPI_Point(SketchPoint_1).coordinates(), + 25, + True, +) SketchLine_7 = Sketch_1.addLine(-40, -72, -40, -8.616197183098587) SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_7.endPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_7.result(), 90, type = "Direct") -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_3.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), 60) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchArc_3.endPoint(), SketchLine_6.startPoint(), 45) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_7.endPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_7.result(), 90, type="Direct" +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchArc_3.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), 60 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchArc_3.endPoint(), SketchLine_6.startPoint(), 45 +) SketchLine_8 = Sketch_1.addLine(-60, 3.5, -60, 43.5) SketchLine_8.setAuxiliary(True) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_8.endPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_7.result(), SketchLine_8.result()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_8.endPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_7.result(), SketchLine_8.result() +) SketchCircle_1 = Sketch_1.addCircle(-60, 66, 22.5) SketchCircle_1.setAuxiliary(True) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_8.result(), SketchCircle_1.center()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_6.result(), SketchCircle_1.results()[1]) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_3.result(), 66, True) -SketchBSpline_1 = Sketch_1.addSpline(poles = [(-60, 43.5), (-40, 43.5), (-11.56553854601814, 88.5), (8.434461453981855, 88.5)], weights = [1, 3, 3, 1]) -[SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11] = SketchBSpline_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_9, SketchLine_10, SketchLine_11] = SketchBSpline_1.controlPolygon(auxiliary = [0, 1, 2]) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_11).coordinates(), SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_11.result()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_8).coordinates(), SketchArc_3.endPoint()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_8.result(), SketchCircle_1.center() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_6.result(), SketchCircle_1.results()[1] +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_3.result(), 66, True +) +SketchBSpline_1 = Sketch_1.addSpline( + poles=[ + (-60, 43.5), + (-40, 43.5), + (-11.56553854601814, 88.5), + (8.434461453981855, 88.5), + ], + weights=[1, 3, 3, 1], +) +[ + SketchPoint_8, + SketchPoint_9, + SketchPoint_10, + SketchPoint_11, +] = SketchBSpline_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[SketchLine_9, SketchLine_10, SketchLine_11] = SketchBSpline_1.controlPolygon( + auxiliary=[0, 1, 2] +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_11).coordinates(), SketchLine_6.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_11.result() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_8).coordinates(), SketchArc_3.endPoint() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_6.result() +) SketchLine_12 = Sketch_1.addLine(-19.07878402833891, -6, -23.3, -6) SketchLine_13 = Sketch_1.addLine(-23.3, -6, -23.3, 6) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchLine_14 = Sketch_1.addLine(-23.3, 6, -19.07878402833891, 6) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_14.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_13.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_12.result()) -SketchArc_4 = Sketch_1.addArc(0, 0, -19.07878402833891, -6, -19.07878402833891, 6, False) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_4.center()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchArc_4.endPoint()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_12.startPoint(), SketchArc_4.startPoint()) +SketchArc_4 = Sketch_1.addArc( + 0, 0, -19.07878402833891, -6, -19.07878402833891, 6, False +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_4.center() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_12.startPoint(), SketchArc_4.startPoint() +) SketchPoint_12 = Sketch_1.addPoint(-23.3, 0) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchPoint_12.coordinates(), SketchLine_3.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchPoint_12.coordinates(), SketchLine_13.result()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchPoint_12.coordinates(), SketchLine_3.result() +) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchPoint_12.coordinates(), SketchLine_13.result() +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_4.results()[1], 20) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_13.result(), 12) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_12.coordinates(), SketchAPI_Line(SketchLine_2).startPoint(), 23.3, True) -SketchBSplinePeriodic_1 = Sketch_1.addSpline(poles = [(-80, -23), (-80, 0), (-50, 0), (-50, -23)], periodic = True) -[SketchPoint_13, SketchPoint_14, SketchPoint_15, SketchPoint_16] = SketchBSplinePeriodic_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18] = SketchBSplinePeriodic_1.controlPolygon(auxiliary = [0, 1, 2, 3]) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_16.result(), SketchLine_5.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_18.result(), SketchLine_16.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_15.result(), SketchLine_17.result()) -SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular(SketchLine_18.result(), SketchLine_15.result()) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchPoint_12.coordinates(), SketchAPI_Line(SketchLine_2).startPoint(), 23.3, True +) +SketchBSplinePeriodic_1 = Sketch_1.addSpline( + poles=[(-80, -23), (-80, 0), (-50, 0), (-50, -23)], periodic=True +) +[ + SketchPoint_13, + SketchPoint_14, + SketchPoint_15, + SketchPoint_16, +] = SketchBSplinePeriodic_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[ + SketchLine_15, + SketchLine_16, + SketchLine_17, + SketchLine_18, +] = SketchBSplinePeriodic_1.controlPolygon(auxiliary=[0, 1, 2, 3]) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_16.result(), SketchLine_5.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_18.result(), SketchLine_16.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_15.result(), SketchLine_17.result() +) +SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular( + SketchLine_18.result(), SketchLine_15.result() +) SketchEllipse_1 = Sketch_1.addEllipse(35, 45, 35, 67.91287847483518, 10) -[SketchPoint_17, SketchPoint_18, SketchPoint_19, SketchPoint_20, SketchPoint_21, SketchPoint_22, SketchPoint_23, SketchLine_19, SketchLine_20] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_19.result()) +[ + SketchPoint_17, + SketchPoint_18, + SketchPoint_19, + SketchPoint_20, + SketchPoint_21, + SketchPoint_22, + SketchPoint_23, + SketchLine_19, + SketchLine_20, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_19.result() +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_16.result(), 30) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_15.result(), 23) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_19.result(), 50) SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_20.result(), 20) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_4.center(), 50, True) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_23).coordinates(), SketchLine_4.result()) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_3.result(), 45, True) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_4.center(), 50, True +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_23).coordinates(), SketchLine_4.result() +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_3.result(), 45, True +) SketchCircle_2 = Sketch_1.addCircle(0, 66, 12) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_2.result(), SketchCircle_2.center()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchCircle_2.center() +) SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], 12) SketchLine_21 = Sketch_1.addLine(-60, 66, 0, 66) SketchLine_21.setAuxiliary(True) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_21.startPoint() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_21.result()) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchCircle_2.center() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchEllipticArc_1f-SketchLine_6r-SketchBSpline_1r-SketchArc_3_2f-SketchArc_2_2f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchArc_4_2r-SketchBSplinePeriodic_1f-SketchEllipse_1r-SketchCircle_2_2r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchEllipticArc_1f-SketchLine_6r-SketchBSpline_1r-SketchArc_3_2f-SketchArc_2_2f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchArc_4_2r-SketchBSplinePeriodic_1f-SketchEllipse_1r-SketchCircle_2_2r", + ) + ], + model.selection(), + 10, + 0, +) Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Sketch_1_Copy = model.copySketch(Part_2_doc, Sketch_1) -Extrusion_2 = model.addExtrusion(Part_2_doc, [model.selection("FACE", Sketch_1_Copy.name())], model.selection(), 0, 10) +Extrusion_2 = model.addExtrusion( + Part_2_doc, + [model.selection("FACE", Sketch_1_Copy.name())], + model.selection(), + 0, + 10, +) model.end() error = model.compareSketches(Sketch_1, Sketch_1_Copy) -assert(error == ""), error +assert error == "", error model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [0]) @@ -154,8 +349,8 @@ model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.EDGE, [126]) model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.VERTEX, [252]) model.testResultsVolumes(Extrusion_2, [213109.1306148178]) -assert(partSet.size("Features") == 2) -assert(Part_1_doc.size("Features") == 2) -assert(Part_2_doc.size("Features") == 2) +assert partSet.size("Features") == 2 +assert Part_1_doc.size("Features") == 2 +assert Part_2_doc.size("Features") == 2 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSketchCopy09.py b/src/SketchPlugin/Test/TestSketchCopy09.py index f243c5d23..874c82f0b 100644 --- a/src/SketchPlugin/Test/TestSketchCopy09.py +++ b/src/SketchPlugin/Test/TestSketchCopy09.py @@ -29,115 +29,310 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(-40, -72, 0, -72) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_3 = SketchProjection_2.createdFeature() SketchArc_1 = Sketch_1.addArc(0, 0, 0, -72, 72, 0, False) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.center()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.result(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.center() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchArc_1.endPoint() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 72) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) -SketchEllipticArc_1 = Sketch_1.addEllipticArc(25, 0, 25, 74.98833242578475, 72, 0, 25, 88.5, False) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_4, SketchLine_5] = SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.result(), SketchEllipticArc_1.center()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchEllipticArc_1.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchEllipticArc_1.endPoint(), SketchAPI_Line(SketchLine_4).endPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_1.endPoint() +) +SketchEllipticArc_1 = Sketch_1.addEllipticArc( + 25, 0, 25, 74.98833242578475, 72, 0, 25, 88.5, False +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_4, + SketchLine_5, +] = SketchEllipticArc_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchEllipticArc_1.center() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchEllipticArc_1.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchEllipticArc_1.endPoint(), SketchAPI_Line(SketchLine_4).endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) SketchLine_6 = Sketch_1.addLine(7.834161075251729, 88.5, 25, 88.5) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.endPoint()) -SketchArc_2 = Sketch_1.addArc(-40, -8.616197183098587, -40, -72, -94.21171510314713, 24.22579430808612, True) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_2.startPoint()) -SketchArc_3 = Sketch_1.addArc(-60, 3.5, -94.21171510314713, 24.22579430808612, -60, 43.5, True) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1]) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchEllipticArc_1.majorAxisPositive(), SketchLine_6.endPoint() +) +SketchArc_2 = Sketch_1.addArc( + -40, -8.616197183098587, -40, -72, -94.21171510314713, 24.22579430808612, True +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_2.startPoint() +) +SketchArc_3 = Sketch_1.addArc( + -60, 3.5, -94.21171510314713, 24.22579430808612, -60, 43.5, True +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_3.results()[1], 40) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_4.result(), SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 25, True) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_4.result(), SketchLine_6.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_2).startPoint(), + SketchAPI_Point(SketchPoint_1).coordinates(), + 25, + True, +) SketchLine_7 = Sketch_1.addLine(-40, -72, -40, -8.616197183098587) SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_7.endPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_7.result(), 90, type = "Direct") -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_3.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), 60) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchArc_3.endPoint(), SketchLine_6.startPoint(), 45) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_7.endPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_7.result(), 90, type="Direct" +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchArc_3.endPoint(), SketchAPI_Line(SketchLine_2).startPoint(), 60 +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchArc_3.endPoint(), SketchLine_6.startPoint(), 45 +) SketchLine_8 = Sketch_1.addLine(-60, 3.5, -60, 43.5) SketchLine_8.setAuxiliary(True) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_8.endPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_7.result(), SketchLine_8.result()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_8.endPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_7.result(), SketchLine_8.result() +) SketchCircle_1 = Sketch_1.addCircle(-60, 66, 22.5) SketchCircle_1.setAuxiliary(True) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchCircle_1.results()[1]) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_8.result(), SketchCircle_1.center()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_6.result(), SketchCircle_1.results()[1]) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_3.result(), 66, True) -SketchBSpline_1 = Sketch_1.addSpline(poles = [(-60, 43.5), (-40, 43.5), (-11.56553854601814, 88.5), (8.434461453981855, 88.5)], weights = [1, 3, 3, 1]) -[SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11] = SketchBSpline_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_9, SketchLine_10, SketchLine_11] = SketchBSpline_1.controlPolygon(auxiliary = [0, 1, 2]) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_11).coordinates(), SketchLine_6.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_11.result()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_8).coordinates(), SketchArc_3.endPoint()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchCircle_1.results()[1] +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_8.result(), SketchCircle_1.center() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_6.result(), SketchCircle_1.results()[1] +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_3.result(), 66, True +) +SketchBSpline_1 = Sketch_1.addSpline( + poles=[ + (-60, 43.5), + (-40, 43.5), + (-11.56553854601814, 88.5), + (8.434461453981855, 88.5), + ], + weights=[1, 3, 3, 1], +) +[ + SketchPoint_8, + SketchPoint_9, + SketchPoint_10, + SketchPoint_11, +] = SketchBSpline_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[SketchLine_9, SketchLine_10, SketchLine_11] = SketchBSpline_1.controlPolygon( + auxiliary=[0, 1, 2] +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_11).coordinates(), SketchLine_6.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_11.result() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_8).coordinates(), SketchArc_3.endPoint() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_6.result() +) SketchLine_12 = Sketch_1.addLine(-19.07878402833891, -6, -23.3, -6) SketchLine_13 = Sketch_1.addLine(-23.3, -6, -23.3, 6) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchLine_14 = Sketch_1.addLine(-23.3, 6, -19.07878402833891, 6) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_14.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_13.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_12.result()) -SketchArc_4 = Sketch_1.addArc(0, 0, -19.07878402833891, -6, -19.07878402833891, 6, False) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_4.center()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchArc_4.endPoint()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_12.startPoint(), SketchArc_4.startPoint()) +SketchArc_4 = Sketch_1.addArc( + 0, 0, -19.07878402833891, -6, -19.07878402833891, 6, False +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_4.center() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_12.startPoint(), SketchArc_4.startPoint() +) SketchPoint_12 = Sketch_1.addPoint(-23.3, 0) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchPoint_12.coordinates(), SketchLine_3.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchPoint_12.coordinates(), SketchLine_13.result()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchPoint_12.coordinates(), SketchLine_3.result() +) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchPoint_12.coordinates(), SketchLine_13.result() +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_4.results()[1], 20) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_13.result(), 12) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_12.coordinates(), SketchAPI_Line(SketchLine_2).startPoint(), 23.3, True) -SketchBSplinePeriodic_1 = Sketch_1.addSpline(poles = [(-80, -23), (-80, 0), (-50, 0), (-50, -23)], periodic = True) -[SketchPoint_13, SketchPoint_14, SketchPoint_15, SketchPoint_16] = SketchBSplinePeriodic_1.controlPoles(auxiliary = [0, 1, 2, 3]) -[SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18] = SketchBSplinePeriodic_1.controlPolygon(auxiliary = [0, 1, 2, 3]) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_16.result(), SketchLine_5.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_18.result(), SketchLine_16.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_15.result(), SketchLine_17.result()) -SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular(SketchLine_18.result(), SketchLine_15.result()) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchPoint_12.coordinates(), SketchAPI_Line(SketchLine_2).startPoint(), 23.3, True +) +SketchBSplinePeriodic_1 = Sketch_1.addSpline( + poles=[(-80, -23), (-80, 0), (-50, 0), (-50, -23)], periodic=True +) +[ + SketchPoint_13, + SketchPoint_14, + SketchPoint_15, + SketchPoint_16, +] = SketchBSplinePeriodic_1.controlPoles(auxiliary=[0, 1, 2, 3]) +[ + SketchLine_15, + SketchLine_16, + SketchLine_17, + SketchLine_18, +] = SketchBSplinePeriodic_1.controlPolygon(auxiliary=[0, 1, 2, 3]) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_16.result(), SketchLine_5.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_18.result(), SketchLine_16.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_15.result(), SketchLine_17.result() +) +SketchConstraintPerpendicular_2 = Sketch_1.setPerpendicular( + SketchLine_18.result(), SketchLine_15.result() +) SketchEllipse_1 = Sketch_1.addEllipse(35, 45, 35, 67.91287847483518, 10) -[SketchPoint_17, SketchPoint_18, SketchPoint_19, SketchPoint_20, SketchPoint_21, SketchPoint_22, SketchPoint_23, SketchLine_19, SketchLine_20] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_19.result()) +[ + SketchPoint_17, + SketchPoint_18, + SketchPoint_19, + SketchPoint_20, + SketchPoint_21, + SketchPoint_22, + SketchPoint_23, + SketchLine_19, + SketchLine_20, +] = SketchEllipse_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_4.result(), SketchLine_19.result() +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_16.result(), 30) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_15.result(), 23) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_19.result(), 50) SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_20.result(), 20) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_4.center(), 50, True) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_23).coordinates(), SketchLine_4.result()) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_3.result(), 45, True) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_17).startPoint(), SketchArc_4.center(), 50, True +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_23).coordinates(), SketchLine_4.result() +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_17).coordinates(), SketchLine_3.result(), 45, True +) SketchCircle_2 = Sketch_1.addCircle(0, 66, 12) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_2.result(), SketchCircle_2.center()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchCircle_2.center() +) SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], 12) SketchLine_21 = Sketch_1.addLine(-60, 66, 0, 66) SketchLine_21.setAuxiliary(True) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_21.startPoint() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_21.result()) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchCircle_2.center() +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchEllipticArc_1f-SketchLine_6r-SketchBSpline_1r-SketchArc_3_2f-SketchArc_2_2f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchArc_4_2r-SketchBSplinePeriodic_1f-SketchEllipse_1r-SketchCircle_2_2r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchEllipticArc_1f-SketchLine_6r-SketchBSpline_1r-SketchArc_3_2f-SketchArc_2_2f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchArc_4_2r-SketchBSplinePeriodic_1f-SketchEllipse_1r-SketchCircle_2_2r", + ) + ], + model.selection(), + 10, + 0, +) Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Point_1 = model.addPoint(Part_2_doc, 10, 10, 10) Sketch_1_Copy = model.copySketch(Part_2_doc, Sketch_1) -Extrusion_2 = model.addExtrusion(Part_2_doc, [model.selection("FACE", Sketch_1_Copy.name())], model.selection(), 0, 10) +Extrusion_2 = model.addExtrusion( + Part_2_doc, + [model.selection("FACE", Sketch_1_Copy.name())], + model.selection(), + 0, + 10, +) model.end() error = model.compareSketches(Sketch_1, Sketch_1_Copy) -assert(error == ""), error +assert error == "", error model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [0]) @@ -155,8 +350,8 @@ model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.EDGE, [126]) model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.VERTEX, [252]) model.testResultsVolumes(Extrusion_2, [213109.1306148178]) -assert(partSet.size("Features") == 2) -assert(Part_1_doc.size("Features") == 2) -assert(Part_2_doc.size("Features") == 3) +assert partSet.size("Features") == 2 +assert Part_1_doc.size("Features") == 2 +assert Part_2_doc.size("Features") == 3 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSketchCopy10.py b/src/SketchPlugin/Test/TestSketchCopy10.py index 1b7317c02..541b73205 100644 --- a/src/SketchPlugin/Test/TestSketchCopy10.py +++ b/src/SketchPlugin/Test/TestSketchCopy10.py @@ -26,31 +26,65 @@ 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) +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.standardPlane("XOZ")) -SketchIntersectionPoint_1 = Sketch_1.addIntersectionPoint(model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), True) +SketchIntersectionPoint_1 = Sketch_1.addIntersectionPoint( + model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), True +) [SketchPoint_1, SketchPoint_2] = SketchIntersectionPoint_1.intersectionPoints() SketchCircle_1 = Sketch_1.addCircle(5, 10, 3) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 3) -SketchMultiTranslation_1 = Sketch_1.addTranslation([SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_2).coordinates(), SketchAPI_Point(SketchPoint_1).coordinates(), 3) +SketchMultiTranslation_1 = Sketch_1.addTranslation( + [SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_2).coordinates(), + SketchAPI_Point(SketchPoint_1).coordinates(), + 3, +) [SketchCircle_2, SketchCircle_3] = SketchMultiTranslation_1.translated() -SketchMultiRotation_1 = Sketch_1.addRotation([SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_2).coordinates(), 360, 5, True) -[SketchCircle_4, SketchCircle_5, SketchCircle_6, SketchCircle_7] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_2).coordinates(), + 360, + 5, + True, +) +[ + SketchCircle_4, + SketchCircle_5, + SketchCircle_6, + SketchCircle_7, +] = SketchMultiRotation_1.rotated() SketchLine_1 = Sketch_1.addLine(2.5, 1, 12.5, 5) SketchLine_1.setAuxiliary(True) SketchConstraintRigid_1 = Sketch_1.setFixed(SketchLine_1.result()) -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_1.result(), [SketchCircle_1.results()[1]]) +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_1.result(), [SketchCircle_1.results()[1]] +) [SketchCircle_8] = SketchConstraintMirror_1.mirrored() model.do() Sketch_1_Copy = model.copySketch(Part_1_doc, Sketch_1) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", Sketch_1_Copy.name())], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", Sketch_1_Copy.name())], + model.selection(), + 10, + 0, +) model.end() error = model.compareSketches(Sketch_1, Sketch_1_Copy) -assert(error == ""), error +assert error == "", error VOL = 282.743338823 @@ -59,9 +93,11 @@ model.testNbSubResults(Extrusion_1, [0, 0, 0, 0, 0, 0, 0, 0]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [1, 1, 1, 1, 1, 1, 1, 1]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [3, 3, 3, 3, 3, 3, 3, 3]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [6, 6, 6, 6, 6, 6, 6, 6]) -model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [12, 12, 12, 12, 12, 12, 12, 12]) +model.testNbSubShapes( + Extrusion_1, GeomAPI_Shape.VERTEX, [12, 12, 12, 12, 12, 12, 12, 12] +) model.testResultsVolumes(Extrusion_1, [VOL, VOL, VOL, VOL, VOL, VOL, VOL, VOL]) -assert(Part_1_doc.size("Features") == 4) +assert Part_1_doc.size("Features") == 4 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSketchCopy11.py b/src/SketchPlugin/Test/TestSketchCopy11.py index e72c158c4..39e74dd4b 100644 --- a/src/SketchPlugin/Test/TestSketchCopy11.py +++ b/src/SketchPlugin/Test/TestSketchCopy11.py @@ -26,32 +26,70 @@ 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) +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.standardPlane("XOZ")) -SketchIntersectionPoint_1 = Sketch_1.addIntersectionPoint(model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), True) +SketchIntersectionPoint_1 = Sketch_1.addIntersectionPoint( + model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), True +) [SketchPoint_1, SketchPoint_2] = SketchIntersectionPoint_1.intersectionPoints() SketchCircle_1 = Sketch_1.addCircle(5, 10, 3) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 3) -SketchMultiTranslation_1 = Sketch_1.addTranslation([SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_2).coordinates(), SketchAPI_Point(SketchPoint_1).coordinates(), 3) +SketchMultiTranslation_1 = Sketch_1.addTranslation( + [SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_2).coordinates(), + SketchAPI_Point(SketchPoint_1).coordinates(), + 3, +) [SketchCircle_2, SketchCircle_3] = SketchMultiTranslation_1.translated() -SketchMultiRotation_1 = Sketch_1.addRotation([SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_2).coordinates(), 360, 5, True) -[SketchCircle_4, SketchCircle_5, SketchCircle_6, SketchCircle_7] = SketchMultiRotation_1.rotated() -SketchLine_1 = Sketch_1.addLine(2.699367028097859, 1.399671792347037, 12.16381438587305, 5.532036131657337) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchCircle_1.results()[1]], + SketchAPI_Point(SketchPoint_2).coordinates(), + 360, + 5, + True, +) +[ + SketchCircle_4, + SketchCircle_5, + SketchCircle_6, + SketchCircle_7, +] = SketchMultiRotation_1.rotated() +SketchLine_1 = Sketch_1.addLine( + 2.699367028097859, 1.399671792347037, 12.16381438587305, 5.532036131657337 +) SketchLine_1.setAuxiliary(True) SketchConstraintRigid_1 = Sketch_1.setFixed(SketchLine_1.result()) -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_1.result(), [SketchCircle_1.results()[1]]) +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_1.result(), [SketchCircle_1.results()[1]] +) [SketchCircle_8] = SketchConstraintMirror_1.mirrored() model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0 +) Sketch_1_Copy = model.copySketch(Part_1_doc, Sketch_1) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", Sketch_1_Copy.name())], model.selection(), 0, 10) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", Sketch_1_Copy.name())], + model.selection(), + 0, + 10, +) model.end() error = model.compareSketches(Sketch_1, Sketch_1_Copy) -assert(error == ""), error +assert error == "", error VOL = 282.743338823 @@ -60,7 +98,9 @@ model.testNbSubResults(Extrusion_1, [0, 0, 0, 0, 0, 0, 0, 0]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [1, 1, 1, 1, 1, 1, 1, 1]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [3, 3, 3, 3, 3, 3, 3, 3]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [6, 6, 6, 6, 6, 6, 6, 6]) -model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [12, 12, 12, 12, 12, 12, 12, 12]) +model.testNbSubShapes( + Extrusion_1, GeomAPI_Shape.VERTEX, [12, 12, 12, 12, 12, 12, 12, 12] +) model.testResultsVolumes(Extrusion_1, [VOL, VOL, VOL, VOL, VOL, VOL, VOL, VOL]) model.testNbResults(Extrusion_2, 8) @@ -68,9 +108,11 @@ model.testNbSubResults(Extrusion_2, [0, 0, 0, 0, 0, 0, 0, 0]) model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.SOLID, [1, 1, 1, 1, 1, 1, 1, 1]) model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.FACE, [3, 3, 3, 3, 3, 3, 3, 3]) model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.EDGE, [6, 6, 6, 6, 6, 6, 6, 6]) -model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.VERTEX, [12, 12, 12, 12, 12, 12, 12, 12]) +model.testNbSubShapes( + Extrusion_2, GeomAPI_Shape.VERTEX, [12, 12, 12, 12, 12, 12, 12, 12] +) model.testResultsVolumes(Extrusion_2, [VOL, VOL, VOL, VOL, VOL, VOL, VOL, VOL]) -assert(Part_1_doc.size("Features") == 5) +assert Part_1_doc.size("Features") == 5 -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSketchCopy12.py b/src/SketchPlugin/Test/TestSketchCopy12.py index 360410f3c..a40cb9a8e 100644 --- a/src/SketchPlugin/Test/TestSketchCopy12.py +++ b/src/SketchPlugin/Test/TestSketchCopy12.py @@ -29,27 +29,49 @@ 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/Top")) SketchCircle_1 = Sketch_1.addCircle(2, 2, 1) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_1.result(), 2, True) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), False) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_1.result(), 2, True +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), False +) SketchLine_2 = SketchProjection_2.createdFeature() -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_2.result(), 2, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_2.result(), 2, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 1) model.do() Sketch_1_Copy = model.copySketch(Part_1_doc, Sketch_1) error = model.compareSketches(Sketch_1, Sketch_1_Copy) -assert(error == ""), error +assert error == "", error -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 0, 10, [model.selection("SOLID", "Box_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + 0, + 10, + [model.selection("SOLID", "Box_1_1")], +) Distance = model.lastSubFeature(Sketch_1_Copy, "SketchConstraintDistance") SketchAPI_Constraint(Distance).setValue(6) model.do() -ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_1_Copy")], model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_1_1")]) +ExtrusionCut_2 = model.addExtrusionCut( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1_Copy")], + model.selection(), + 0, + 10, + [model.selection("SOLID", "ExtrusionCut_1_1")], +) model.end() @@ -61,4 +83,4 @@ model.testNbSubShapes(ExtrusionCut_2, GeomAPI_Shape.EDGE, [36]) model.testNbSubShapes(ExtrusionCut_2, GeomAPI_Shape.VERTEX, [72]) model.testResultsVolumes(ExtrusionCut_2, [937.1681469282]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSketchCopy13.py b/src/SketchPlugin/Test/TestSketchCopy13.py index f06b8a91f..7b5668984 100644 --- a/src/SketchPlugin/Test/TestSketchCopy13.py +++ b/src/SketchPlugin/Test/TestSketchCopy13.py @@ -27,27 +27,44 @@ 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, 10, [model.selection("SOLID", "Box_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, [], model.selection(), 0, 10, [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(2, 2, 1) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_1 = SketchProjection_1.createdFeature() -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_1.result(), 2, True) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_1.result(), 2, True +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_2 = SketchProjection_2.createdFeature() -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_2.result(), 2, True) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_2.result(), 2, True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 1) ExtrusionCut_1.setNestedSketch(Sketch_1) Sketch_1_Copy = model.copySketch(Part_1_doc, Sketch_1) error = model.compareSketches(Sketch_1, Sketch_1_Copy) -assert(error == ""), error +assert error == "", error Distance = model.lastSubFeature(Sketch_1_Copy, "SketchConstraintDistance") SketchAPI_Constraint(Distance).setValue(6) model.do() -ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_1_Copy")], model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_1_1")]) +ExtrusionCut_2 = model.addExtrusionCut( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1_Copy")], + model.selection(), + 0, + 10, + [model.selection("SOLID", "ExtrusionCut_1_1")], +) model.end() @@ -59,4 +76,4 @@ model.testNbSubShapes(ExtrusionCut_2, GeomAPI_Shape.EDGE, [36]) model.testNbSubShapes(ExtrusionCut_2, GeomAPI_Shape.VERTEX, [72]) model.testResultsVolumes(ExtrusionCut_2, [937.1681469282]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSketchCopy14.py b/src/SketchPlugin/Test/TestSketchCopy14.py index 0d6f2e6a7..e8a8f6614 100644 --- a/src/SketchPlugin/Test/TestSketchCopy14.py +++ b/src/SketchPlugin/Test/TestSketchCopy14.py @@ -25,19 +25,31 @@ Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(50, 0, 0, 0) SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Origin"), False) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 50) SketchLine_3 = Sketch_1.addLine(0, 50, 50, 50) SketchLine_4 = Sketch_1.addLine(50, 50, 50, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_5 = 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()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_2.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 50) model.do() @@ -50,6 +62,6 @@ model.end() features = [Sketch_1, Copy1, Copy2, Copy3] for ind1 in range(len(features)): for ind2 in range(ind1 + 1, len(features)): - assert(features[ind1].name() != features[ind2].name()) + assert features[ind1].name() != features[ind2].name() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSketchDrawer.py b/src/SketchPlugin/Test/TestSketchDrawer.py index 75396c96c..6cc831884 100644 --- a/src/SketchPlugin/Test/TestSketchDrawer.py +++ b/src/SketchPlugin/Test/TestSketchDrawer.py @@ -26,40 +26,95 @@ 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()) +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()) +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 = 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()) +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 = 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()) +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) +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) +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) +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 = 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) +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, without dimensions Drawer1 = Part_1_doc.addFeature("SketchDrawer") @@ -77,15 +132,22 @@ PlaneSelection.fillAttribute(Drawer2.selection("plane")) model.end() # check that a sketch is created with valid elements -assert(Part_1_doc.size("Construction") == 3) # three sketches: base of extrusion and drawer's two +assert ( + Part_1_doc.size("Construction") == 3 +) # three sketches: base of extrusion and drawer's two from ModelAPI import * + aFactory = ModelAPI_Session.get().validators() -Sketch1 = objectToFeature(Part_1_doc.object("Features", 2)) # the first created sketch feature -assert(aFactory.validate(Sketch1)) -assert(len(Sketch1.results()) == 1) +Sketch1 = objectToFeature( + Part_1_doc.object("Features", 2) +) # the first created sketch feature +assert aFactory.validate(Sketch1) +assert len(Sketch1.results()) == 1 -Sketch2 = objectToFeature(Part_1_doc.object("Features", 3)) # the second created sketch feature -assert(aFactory.validate(Sketch2)) -assert(len(Sketch2.results()) == 1) +Sketch2 = objectToFeature( + Part_1_doc.object("Features", 3) +) # the second created sketch feature +assert aFactory.validate(Sketch2) +assert len(Sketch2.results()) == 1 diff --git a/src/SketchPlugin/Test/TestSketchPointLine.py b/src/SketchPlugin/Test/TestSketchPointLine.py index 4a64db52c..e5c479a86 100644 --- a/src/SketchPlugin/Test/TestSketchPointLine.py +++ b/src/SketchPlugin/Test/TestSketchPointLine.py @@ -17,9 +17,9 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= from GeomDataAPI import * from ModelAPI import * @@ -27,13 +27,13 @@ __updated__ = "2014-10-28" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) -assert (aSketchFeature.getKind() == "Sketch") +assert aSketchFeature.getKind() == "Sketch" origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) origin.setValue(0, 0, 0) dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX")) @@ -43,76 +43,77 @@ norm.setValue(0, 0, 1) aSession.finishOperation() # check that values have been changed origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) -assert (origin.x() == 0) -assert (origin.y() == 0) -assert (origin.z() == 0) +assert origin.x() == 0 +assert origin.y() == 0 +assert origin.z() == 0 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX")) -assert (dirx.x() == 1) -assert (dirx.y() == 0) -assert (dirx.z() == 0) +assert dirx.x() == 1 +assert dirx.y() == 0 +assert dirx.z() == 0 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) -assert (norm.x() == 0) -assert (norm.y() == 0) -assert (norm.z() == 1) -#========================================================================= +assert norm.x() == 0 +assert norm.y() == 0 +assert norm.z() == 1 +# ========================================================================= # Creation of a point -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchReflist = aSketchFeature.reflist("Features") -assert (not aSketchReflist.isInitialized()) -assert(aSketchReflist.size() == 0) -assert (len(aSketchReflist.list()) == 0) +assert not aSketchReflist.isInitialized() +assert aSketchReflist.size() == 0 +assert len(aSketchReflist.list()) == 0 # aSketchPoint = aDocument.addFeature("SketchPoint") aSketchPoint = aSketchFeature.addFeature("SketchPoint") -assert (aSketchPoint.getKind() == "SketchPoint") +assert aSketchPoint.getKind() == "SketchPoint" coords = geomDataAPI_Point2D(aSketchPoint.attribute("PointCoordinates")) -assert (not coords.isInitialized()) +assert not coords.isInitialized() # Simulate SketchPlugin_Point::move(...) -coords.setValue(10., 10.) -assert (coords.isInitialized()) +coords.setValue(10.0, 10.0) +assert coords.isInitialized() aSession.finishOperation() # check that values have been changed aSketchReflist = aSketchFeature.reflist("Features") -assert (aSketchReflist.size() == 1) -assert (len(aSketchReflist.list()) == 1) +assert aSketchReflist.size() == 1 +assert len(aSketchReflist.list()) == 1 coords = geomDataAPI_Point2D(aSketchPoint.attribute("PointCoordinates")) -assert (coords.x() == 10.0) -assert (coords.y() == 10.0) -#========================================================================= +assert coords.x() == 10.0 +assert coords.y() == 10.0 +# ========================================================================= # Creation of a line -#========================================================================= +# ========================================================================= aSession.startOperation() # aSketchLine = aDocument.addFeature("SketchLine") aSketchLine = aSketchFeature.addFeature("SketchLine") -assert (aSketchLine.getKind() == "SketchLine") -assert (aSketchReflist.size() == 2) -assert (len(aSketchReflist.list()) == 2) +assert aSketchLine.getKind() == "SketchLine" +assert aSketchReflist.size() == 2 +assert len(aSketchReflist.list()) == 2 aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) -assert (not aLineStartPoint.isInitialized()) -assert (not aLineEndPoint.isInitialized()) +assert not aLineStartPoint.isInitialized() +assert not aLineEndPoint.isInitialized() # Simulate SketchPlugin_Line::move(...) -aLineStartPoint.setValue(50., 50.) -aLineEndPoint.setValue(60., 60.) -assert (aLineStartPoint.isInitialized()) -assert (aLineEndPoint.isInitialized()) +aLineStartPoint.setValue(50.0, 50.0) +aLineEndPoint.setValue(60.0, 60.0) +assert aLineStartPoint.isInitialized() +assert aLineEndPoint.isInitialized() aSession.finishOperation() # check that values have been changed aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) -assert (aLineStartPoint.x() == 50.0) -assert (aLineStartPoint.y() == 50.0) -assert (aLineEndPoint.x() == 60.0) -assert (aLineEndPoint.y() == 60.0) -#========================================================================= +assert aLineStartPoint.x() == 50.0 +assert aLineStartPoint.y() == 50.0 +assert aLineEndPoint.x() == 60.0 +assert aLineEndPoint.y() == 60.0 +# ========================================================================= # Check the results -#========================================================================= +# ========================================================================= aResult = aSketchLine.firstResult() -assert (aResult is not None) +assert aResult is not None aResultConstruction = modelAPI_ResultConstruction(aResult) aShape = aResultConstruction.shape() -assert (aShape is not None) -assert (not aShape.isNull()) +assert aShape is not None +assert not aShape.isNull() from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSnowflake.py b/src/SketchPlugin/Test/TestSnowflake.py index f8e00e38f..de2810732 100644 --- a/src/SketchPlugin/Test/TestSnowflake.py +++ b/src/SketchPlugin/Test/TestSnowflake.py @@ -28,9 +28,9 @@ import math import random -#========================================================================= +# ========================================================================= # Useful subroutines -#========================================================================= +# ========================================================================= def mirrorDiagonal(theSketch, allLines): result = [] for aLine in allLines: @@ -55,8 +55,8 @@ def mirrorX(theSketch, allLines): aNewLine = aSketchFeature.addFeature("SketchLine") aNewStartPoint = geomDataAPI_Point2D(aNewLine.attribute("StartPoint")) aNewEndPoint = geomDataAPI_Point2D(aNewLine.attribute("EndPoint")) - aNewStartPoint.setValue(aStartPoint.x() * -1., aStartPoint.y()) - aNewEndPoint.setValue(anEndPoint.x() * -1., anEndPoint.y()) + aNewStartPoint.setValue(aStartPoint.x() * -1.0, aStartPoint.y()) + aNewEndPoint.setValue(anEndPoint.x() * -1.0, anEndPoint.y()) result.append(aNewLine) allLines.extend(result) @@ -70,8 +70,8 @@ def mirrorY(theSketch, allLines): aNewLine = aSketchFeature.addFeature("SketchLine") aNewStartPoint = geomDataAPI_Point2D(aNewLine.attribute("StartPoint")) aNewEndPoint = geomDataAPI_Point2D(aNewLine.attribute("EndPoint")) - aNewStartPoint.setValue(aStartPoint.x(), aStartPoint.y() * -1.) - aNewEndPoint.setValue(anEndPoint.x(), anEndPoint.y() * -1.) + aNewStartPoint.setValue(aStartPoint.x(), aStartPoint.y() * -1.0) + aNewEndPoint.setValue(anEndPoint.x(), anEndPoint.y() * -1.0) result.append(aNewLine) allLines.extend(result) @@ -81,9 +81,10 @@ def initContour(theNumLines): result = [] deltaY = random.uniform(20, 25) for i in range(1, theNumLines): - rangeXMax = (prevPoint[1] + deltaY) * (30. / i if i % 2 != 0 else 2) - newX = random.uniform(prevPoint[1] + deltaY, - max(rangeXMax, prevPoint[1] + deltaY + 25.)) + rangeXMax = (prevPoint[1] + deltaY) * (30.0 / i if i % 2 != 0 else 2) + newX = random.uniform( + prevPoint[1] + deltaY, max(rangeXMax, prevPoint[1] + deltaY + 25.0) + ) newPoint = (round(newX, 4), round(prevPoint[1] + deltaY, 4)) result.append((prevPoint, newPoint)) prevPoint = newPoint @@ -110,17 +111,17 @@ def makeLinesCoincident(theSketch, allLines): aConstraint.refattr("ConstraintEntityB").setAttr(valuePoints[1]) -#========================================================================= +# ========================================================================= # Initialization of the test -#========================================================================= +# ========================================================================= __updated__ = "2014-11-27" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() -#========================================================================= +# ========================================================================= # Creation of a sketch -#========================================================================= +# ========================================================================= aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) @@ -130,31 +131,53 @@ dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX")) dirx.setValue(1, 0, 0) norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) -#========================================================================= +# ========================================================================= # 1 With the predefined contour or a new random generated in X0Y # 2 Make complete contour using the diagonal, X and Y mirror symmetry # 3 Link all lines in contour with coincidence -#========================================================================= -initialContour = [((35, 0), (134.8224, 22.0494)), ((134.8224, 22.0494), (71.987, 44.0988)), - ((71.987, 44.0988), (205.1448, 66.1482)), ((205.1448, 66.1482), (127.862, 88.1976)), - ((127.862, 88.1976), (416.861, 110.247)), ((416.861, 110.247), (233.0475, 132.2964)), - ((233.0475, 132.2964), (251.1518, 154.3458)), ((251.1518, 154.3458), (351.0993, 176.3952)), - ((351.0993, 176.3952), (432.3397, 198.4446)), ((432.3397, 198.4446), (223.3246, 220.494)), - ((223.3246, 220.494), (617.4069, 242.5434)), ((617.4069, 242.5434), (479.6524, 264.5928)), - ((479.6524, 264.5928), (453.5778, 286.6422)), ((453.5778, 286.6422), (541.3463, 308.6916)), - ((541.3463, 308.6916), (564.5509, 330.741)), ((564.5509, 330.741), (636.9284, 352.7904)), - ((636.9284, 352.7904), (383.5946, 374.8398)), ((383.5946, 374.8398), (403.3764, 396.8892)), - ((403.3764, 396.8892), (463.9447, 418.9386)), ((463.9447, 418.9386), (669.1751, 440.988)), - ((669.1751, 440.988), (602.2044, 463.0374)), ((602.2044, 463.0374), (942.0456, 485.0868)), - ((942.0456, 485.0868), (526.574, 507.1362)), ((526.574, 507.1362), (826.3619, 529.1856)), - ((826.3619, 529.1856), (576.9488, 551.235)), ((576.9488, 551.235), (624.5595, 573.2844)), - ((624.5595, 573.2844), (648.7146, 595.3338)), ((648.7146, 595.3338), (1194.6944, 617.3832)), - ((1194.6944, 617.3832), (646.6597, 639.4326)), ((646.6597, 639.4326), (839.8201, 661.482)), - ((839.8201, 661.482), (690.7487, 683.5314)), ((690.7487, 683.5314), (1350.2538, 705.5808)), - ((1350.2538, 705.5808), (731.0722, 727.6302)), ((731.0722, 727.6302), (1324.0992, 749.6796)), - ((1324.0992, 749.6796), (790.4873, 771.729)), ((790.4873, 771.729), (813.9883, 793.7784)), - ((813.9883, 793.7784), (828.9997, 815.8278)), ((828.9997, 815.8278), (1321.9798, 837.8772)), - ((1321.9798, 837.8772), (872.1503, 859.9266)), ((872.1503, 859.9266), (859.9266, 859.9266))] +# ========================================================================= +initialContour = [ + ((35, 0), (134.8224, 22.0494)), + ((134.8224, 22.0494), (71.987, 44.0988)), + ((71.987, 44.0988), (205.1448, 66.1482)), + ((205.1448, 66.1482), (127.862, 88.1976)), + ((127.862, 88.1976), (416.861, 110.247)), + ((416.861, 110.247), (233.0475, 132.2964)), + ((233.0475, 132.2964), (251.1518, 154.3458)), + ((251.1518, 154.3458), (351.0993, 176.3952)), + ((351.0993, 176.3952), (432.3397, 198.4446)), + ((432.3397, 198.4446), (223.3246, 220.494)), + ((223.3246, 220.494), (617.4069, 242.5434)), + ((617.4069, 242.5434), (479.6524, 264.5928)), + ((479.6524, 264.5928), (453.5778, 286.6422)), + ((453.5778, 286.6422), (541.3463, 308.6916)), + ((541.3463, 308.6916), (564.5509, 330.741)), + ((564.5509, 330.741), (636.9284, 352.7904)), + ((636.9284, 352.7904), (383.5946, 374.8398)), + ((383.5946, 374.8398), (403.3764, 396.8892)), + ((403.3764, 396.8892), (463.9447, 418.9386)), + ((463.9447, 418.9386), (669.1751, 440.988)), + ((669.1751, 440.988), (602.2044, 463.0374)), + ((602.2044, 463.0374), (942.0456, 485.0868)), + ((942.0456, 485.0868), (526.574, 507.1362)), + ((526.574, 507.1362), (826.3619, 529.1856)), + ((826.3619, 529.1856), (576.9488, 551.235)), + ((576.9488, 551.235), (624.5595, 573.2844)), + ((624.5595, 573.2844), (648.7146, 595.3338)), + ((648.7146, 595.3338), (1194.6944, 617.3832)), + ((1194.6944, 617.3832), (646.6597, 639.4326)), + ((646.6597, 639.4326), (839.8201, 661.482)), + ((839.8201, 661.482), (690.7487, 683.5314)), + ((690.7487, 683.5314), (1350.2538, 705.5808)), + ((1350.2538, 705.5808), (731.0722, 727.6302)), + ((731.0722, 727.6302), (1324.0992, 749.6796)), + ((1324.0992, 749.6796), (790.4873, 771.729)), + ((790.4873, 771.729), (813.9883, 793.7784)), + ((813.9883, 793.7784), (828.9997, 815.8278)), + ((828.9997, 815.8278), (1321.9798, 837.8772)), + ((1321.9798, 837.8772), (872.1503, 859.9266)), + ((872.1503, 859.9266), (859.9266, 859.9266)), +] # Regenerate contour # initialContour = initContour(40) @@ -171,9 +194,10 @@ mirrorX(aSketchFeature, allLines) mirrorY(aSketchFeature, allLines) makeLinesCoincident(aSketchFeature, allLines) aSession.finishOperation() -#========================================================================= +# ========================================================================= # End of test -#========================================================================= +# ========================================================================= from salome.shaper import model -assert(model.checkPythonDump()) + +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSplit.py b/src/SketchPlugin/Test/TestSplit.py index 089de830f..e03811fb7 100644 --- a/src/SketchPlugin/Test/TestSplit.py +++ b/src/SketchPlugin/Test/TestSplit.py @@ -23,13 +23,13 @@ from ModelAPI import * from ModelGeomAlgo import ModelGeomAlgo_Point2D from salome.shaper import geom -SketchPointId = 'SketchPoint' -SketchLineId = 'SketchLine' -SketchArcId = 'SketchArc' -SketchConstraintCoincidenceId = 'SketchConstraintCoincidence' -SketchConstraintParallelId = 'SketchConstraintParallel' -SketchConstraintTangentId = 'SketchConstraintTangent' -SketchConstraintEqualId = 'SketchConstraintEqual' +SketchPointId = "SketchPoint" +SketchLineId = "SketchLine" +SketchArcId = "SketchArc" +SketchConstraintCoincidenceId = "SketchConstraintCoincidence" +SketchConstraintParallelId = "SketchConstraintParallel" +SketchConstraintTangentId = "SketchConstraintTangent" +SketchConstraintEqualId = "SketchConstraintEqual" # Test split on line with one point model.begin() @@ -39,7 +39,9 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 50, 100, 50) SketchPoint_1 = Sketch_1.addPoint(50, 50) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_1.result() +) GeomPoint = geom.Pnt2d(20, 50) Sketch_1.addSplit(SketchLine_1, GeomPoint) model.do() @@ -47,12 +49,12 @@ model.do() Sketch_1_feature = featureToCompositeFeature(Sketch_1.feature()) idList = [] for index in range(Sketch_1_feature.numberOfSubs()): - idList.append(Sketch_1_feature.subFeature(index).getKind()) + idList.append(Sketch_1_feature.subFeature(index).getKind()) -assert(idList.count(SketchLineId) == 2) -assert(idList.count(SketchPointId) == 1) -assert(idList.count(SketchConstraintCoincidenceId) == 3) -assert(idList.count(SketchConstraintParallelId) == 0) +assert idList.count(SketchLineId) == 2 +assert idList.count(SketchPointId) == 1 +assert idList.count(SketchConstraintCoincidenceId) == 3 +assert idList.count(SketchConstraintParallelId) == 0 # Test end # Test split on line with two points @@ -60,8 +62,12 @@ Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_2_1 = Sketch_2.addLine(0, 50, 100, 50) SketchPoint_2_1 = Sketch_2.addPoint(25, 50) SketchPoint_2_2 = Sketch_2.addPoint(75, 50) -SketchConstraintCoincidence_2_1 = Sketch_2.setCoincident(SketchPoint_2_1.coordinates(), SketchLine_2_1.result()) -SketchConstraintCoincidence_2_2 = Sketch_2.setCoincident(SketchPoint_2_2.coordinates(), SketchLine_2_1.result()) +SketchConstraintCoincidence_2_1 = Sketch_2.setCoincident( + SketchPoint_2_1.coordinates(), SketchLine_2_1.result() +) +SketchConstraintCoincidence_2_2 = Sketch_2.setCoincident( + SketchPoint_2_2.coordinates(), SketchLine_2_1.result() +) GeomPoint = geom.Pnt2d(40, 50) Sketch_2.addSplit(SketchLine_2_1, GeomPoint) model.do() @@ -69,12 +75,12 @@ model.do() Sketch_2_feature = featureToCompositeFeature(Sketch_2.feature()) idList = [] for index in range(Sketch_2_feature.numberOfSubs()): - idList.append(Sketch_2_feature.subFeature(index).getKind()) + idList.append(Sketch_2_feature.subFeature(index).getKind()) -assert(idList.count(SketchLineId) == 3) -assert(idList.count(SketchPointId) == 2) -assert(idList.count(SketchConstraintCoincidenceId) == 6) -assert(idList.count(SketchConstraintParallelId) == 0) +assert idList.count(SketchLineId) == 3 +assert idList.count(SketchPointId) == 2 +assert idList.count(SketchConstraintCoincidenceId) == 6 +assert idList.count(SketchConstraintParallelId) == 0 # Test end # Test split on circle with two points @@ -82,8 +88,12 @@ Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_3_1 = Sketch_3.addCircle(50, 50, 50) SketchPoint_3_1 = Sketch_3.addPoint(50, 0) SketchPoint_3_2 = Sketch_3.addPoint(50, 100) -SketchConstraintCoincidence_3_1 = Sketch_3.setCoincident(SketchPoint_3_1.coordinates(), SketchCircle_3_1.results()[1]) -SketchConstraintCoincidence_3_2 = Sketch_3.setCoincident(SketchPoint_3_2.coordinates(), SketchCircle_3_1.results()[1]) +SketchConstraintCoincidence_3_1 = Sketch_3.setCoincident( + SketchPoint_3_1.coordinates(), SketchCircle_3_1.results()[1] +) +SketchConstraintCoincidence_3_2 = Sketch_3.setCoincident( + SketchPoint_3_2.coordinates(), SketchCircle_3_1.results()[1] +) GeomPoint = geom.Pnt2d(0, 50) Sketch_3.addSplit(SketchCircle_3_1, GeomPoint) model.do() @@ -91,12 +101,12 @@ model.do() Sketch_3_feature = featureToCompositeFeature(Sketch_3.feature()) idList = [] for index in range(Sketch_3_feature.numberOfSubs()): - idList.append(Sketch_3_feature.subFeature(index).getKind()) + idList.append(Sketch_3_feature.subFeature(index).getKind()) -assert(idList.count(SketchArcId) == 2) -assert(idList.count(SketchPointId) == 2) -assert(idList.count(SketchConstraintCoincidenceId) == 6) -assert(idList.count(SketchConstraintTangentId) == 0) +assert idList.count(SketchArcId) == 2 +assert idList.count(SketchPointId) == 2 +assert idList.count(SketchConstraintCoincidenceId) == 6 +assert idList.count(SketchConstraintTangentId) == 0 # Test end # Test split on arc with one point @@ -106,10 +116,14 @@ Sketch_4.setFixed(SketchArc_4_1.startPoint()) Sketch_4.setFixed(SketchArc_4_1.endPoint()) Sketch_4.setRadius(SketchArc_4_1, 50) SketchPoint_4_1 = Sketch_4.addPoint(50, 100) -SketchConstraintCoincidence_4_1 = Sketch_4.setCoincident(SketchPoint_4_1.coordinates(), SketchArc_4_1.results()[1]) +SketchConstraintCoincidence_4_1 = Sketch_4.setCoincident( + SketchPoint_4_1.coordinates(), SketchArc_4_1.results()[1] +) # prepare point on circle SketchLine_intersecting = Sketch_4.addLine(0, 100, 50, 50) -Intersection_Point = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc_4_1.feature(), FeatureList([SketchLine_intersecting.feature()])) +Intersection_Point = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc_4_1.feature(), FeatureList([SketchLine_intersecting.feature()]) +) removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()])) Intersection_GeomPoint = Intersection_Point[0] Sketch_4.addSplit(SketchArc_4_1, Sketch_1.to2D(Intersection_GeomPoint)) @@ -118,13 +132,13 @@ model.do() Sketch_4_feature = featureToCompositeFeature(Sketch_4.feature()) idList = [] for index in range(Sketch_4_feature.numberOfSubs()): - idList.append(Sketch_4_feature.subFeature(index).getKind()) + idList.append(Sketch_4_feature.subFeature(index).getKind()) -assert(idList.count(SketchArcId) == 2) -assert(idList.count(SketchPointId) == 1) -assert(idList.count(SketchConstraintCoincidenceId) == 3) -assert(idList.count(SketchConstraintEqualId) == 0) -assert(idList.count(SketchConstraintTangentId) == 0) +assert idList.count(SketchArcId) == 2 +assert idList.count(SketchPointId) == 1 +assert idList.count(SketchConstraintCoincidenceId) == 3 +assert idList.count(SketchConstraintEqualId) == 0 +assert idList.count(SketchConstraintTangentId) == 0 # Test end # Test split on arc with two points @@ -134,8 +148,12 @@ Sketch_5.setFixed(SketchArc_5_1.startPoint()) Sketch_5.setFixed(SketchArc_5_1.endPoint()) Sketch_5.setRadius(SketchArc_5_1, 50) SketchLine_5_1 = Sketch_5.addLine(25, 93.301270189222, 75, 93.301270189222) -SketchConstraintCoincidence_5_1 = Sketch_5.setCoincident(SketchLine_5_1.startPoint(), SketchArc_5_1.results()[1]) -SketchConstraintCoincidence_5_2 = Sketch_5.setCoincident(SketchLine_5_1.endPoint(), SketchArc_5_1.results()[1]) +SketchConstraintCoincidence_5_1 = Sketch_5.setCoincident( + SketchLine_5_1.startPoint(), SketchArc_5_1.results()[1] +) +SketchConstraintCoincidence_5_2 = Sketch_5.setCoincident( + SketchLine_5_1.endPoint(), SketchArc_5_1.results()[1] +) SketchConstraintHorizontal_5_1 = Sketch_5.setHorizontal(SketchLine_5_1.result()) SketchConstraintLength_5_1 = Sketch_5.setLength(SketchLine_5_1.result(), 50) GeomPoint = geom.Pnt2d(50, 100) @@ -145,15 +163,15 @@ model.do() Sketch_5_feature = featureToCompositeFeature(Sketch_5.feature()) idList = [] for index in range(Sketch_5_feature.numberOfSubs()): - idList.append(Sketch_5_feature.subFeature(index).getKind()) + idList.append(Sketch_5_feature.subFeature(index).getKind()) -assert(idList.count(SketchArcId) == 3) -assert(idList.count(SketchPointId) == 0) -assert(idList.count(SketchConstraintCoincidenceId) == 6) -assert(idList.count(SketchConstraintEqualId) == 0) -assert(idList.count(SketchConstraintTangentId) == 0) +assert idList.count(SketchArcId) == 3 +assert idList.count(SketchPointId) == 0 +assert idList.count(SketchConstraintCoincidenceId) == 6 +assert idList.count(SketchConstraintEqualId) == 0 +assert idList.count(SketchConstraintTangentId) == 0 # Test end model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSplitEllipse.py b/src/SketchPlugin/Test/TestSplitEllipse.py index 9ecefc073..82f3f9a7f 100644 --- a/src/SketchPlugin/Test/TestSplitEllipse.py +++ b/src/SketchPlugin/Test/TestSplitEllipse.py @@ -34,14 +34,16 @@ NB_ELLIPSES = 1 NB_ELLIPTIC_ARCS = 0 NB_COINCIDENCES = 5 -TOLERANCE = 1.e-6 +TOLERANCE = 1.0e-6 + def checkFeaturesQuantity(theSketch): model.testNbSubFeatures(theSketch, "SketchLine", NB_LINES) model.testNbSubFeatures(theSketch, "SketchEllipse", NB_ELLIPSES) model.testNbSubFeatures(theSketch, "SketchEllipticArc", NB_ELLIPTIC_ARCS) model.testNbSubFeatures(theSketch, "SketchConstraintCoincidence", NB_COINCIDENCES) - assert(model.dof(theSketch) == DOF) + assert model.dof(theSketch) == DOF + def checkEllipticArcs(theSketch): for aSub in theSketch.features().list(): @@ -49,14 +51,24 @@ def checkEllipticArcs(theSketch): if aFeature is not None and aFeature.getKind() == "SketchEllipticArc": assertEllipticArc(SketchAPI_EllipticArc(aFeature)) + def assertEllipticArc(theArc): assertPoints(theArc.center(), CENTER) - assertPoints(theArc.majorAxisPositive(), geom.Pnt2d(CENTER.x() + MAJOR_RADIUS, CENTER.y())) - assertPoints(theArc.minorAxisPositive(), geom.Pnt2d(CENTER.x(), CENTER.y() + MINOR_RADIUS)) + assertPoints( + theArc.majorAxisPositive(), geom.Pnt2d(CENTER.x() + MAJOR_RADIUS, CENTER.y()) + ) + assertPoints( + theArc.minorAxisPositive(), geom.Pnt2d(CENTER.x(), CENTER.y() + MINOR_RADIUS) + ) + def assertPoints(thePoint1, thePoint2): - assert(math.fabs(thePoint1.x() - thePoint2.x()) < TOLERANCE), "{} != {}".format(thePoint1.x(), thePoint2.x()) - assert(math.fabs(thePoint1.y() - thePoint2.y()) < TOLERANCE), "{} != {}".format(thePoint1.y(), thePoint2.y()) + assert math.fabs(thePoint1.x() - thePoint2.x()) < TOLERANCE, "{} != {}".format( + thePoint1.x(), thePoint2.x() + ) + assert math.fabs(thePoint1.y() - thePoint2.y()) < TOLERANCE, "{} != {}".format( + thePoint1.y(), thePoint2.y() + ) model.begin() @@ -64,22 +76,46 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(CENTER.x(), CENTER.y(), CENTER.x() + math.sqrt(MAJOR_RADIUS**2 - MINOR_RADIUS**2), CENTER.y(), MINOR_RADIUS) -SketchLine_1 = Sketch_1.addLine(-16.74176451428603, -15.34869012470842, -16.85909682653373, 35.30399198463829) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchEllipse_1.result()) -SketchLine_2 = Sketch_1.addLine(-16.85909682653373, 35.30399198463829, 20.9032928583277, -19.27802168426675) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchEllipse_1.result()) -SketchLine_3 = Sketch_1.addLine(34.69765676551338, 36.08465583643841, 35.0422024535432, -15.96612629290852) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchEllipse_1.result()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchEllipse_1.result()) +SketchEllipse_1 = Sketch_1.addEllipse( + CENTER.x(), + CENTER.y(), + CENTER.x() + math.sqrt(MAJOR_RADIUS**2 - MINOR_RADIUS**2), + CENTER.y(), + MINOR_RADIUS, +) +SketchLine_1 = Sketch_1.addLine( + -16.74176451428603, -15.34869012470842, -16.85909682653373, 35.30399198463829 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchEllipse_1.result() +) +SketchLine_2 = Sketch_1.addLine( + -16.85909682653373, 35.30399198463829, 20.9032928583277, -19.27802168426675 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchEllipse_1.result() +) +SketchLine_3 = Sketch_1.addLine( + 34.69765676551338, 36.08465583643841, 35.0422024535432, -15.96612629290852 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchEllipse_1.result() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchEllipse_1.result() +) model.do() checkFeaturesQuantity(Sketch_1) checkEllipticArcs(Sketch_1) # split the ellipse -SketchSplit = Sketch_1.addSplit(SketchEllipse_1, geom.Pnt2d(CENTER.x() + MAJOR_RADIUS, CENTER.y())) +SketchSplit = Sketch_1.addSplit( + SketchEllipse_1, geom.Pnt2d(CENTER.x() + MAJOR_RADIUS, CENTER.y()) +) model.do() NB_ELLIPSES -= 1 NB_ELLIPTIC_ARCS += 2 @@ -91,8 +127,14 @@ checkEllipticArcs(Sketch_1) # split the middle arc of ellipse EllipticArc = SketchAPI_EllipticArc(model.lastSubFeature(Sketch_1, "SketchEllipticArc")) -ANGLE = -math.pi/2 - math.pi/10 -SketchSplit = Sketch_1.addSplit(EllipticArc, geom.Pnt2d(CENTER.x() + MAJOR_RADIUS * math.cos(ANGLE), CENTER.y() + MINOR_RADIUS * math.sin(ANGLE))) +ANGLE = -math.pi / 2 - math.pi / 10 +SketchSplit = Sketch_1.addSplit( + EllipticArc, + geom.Pnt2d( + CENTER.x() + MAJOR_RADIUS * math.cos(ANGLE), + CENTER.y() + MINOR_RADIUS * math.sin(ANGLE), + ), +) model.do() NB_ELLIPTIC_ARCS += 2 NB_COINCIDENCES += 4 @@ -104,10 +146,12 @@ checkEllipticArcs(Sketch_1) # try to split the boundary arc of ellipse, # it shoult fail, because there is no coincident points EllipticArc = SketchAPI_EllipticArc(model.lastSubFeature(Sketch_1, "SketchEllipticArc")) -SketchSplit = Sketch_1.addSplit(EllipticArc, geom.Pnt2d(CENTER.x() - MAJOR_RADIUS, CENTER.y())) +SketchSplit = Sketch_1.addSplit( + EllipticArc, geom.Pnt2d(CENTER.x() - MAJOR_RADIUS, CENTER.y()) +) model.end() aValidators = ModelAPI_Session.get().validators() -assert(not aValidators.validate(SketchSplit.feature())) +assert not aValidators.validate(SketchSplit.feature()) # remove previous split and add coincidence model.undo() @@ -121,7 +165,9 @@ NB_COINCIDENCES += 1 DOF -= 1 # split the boundary arc of ellipse -SketchSplit = Sketch_1.addSplit(EllipticArc, geom.Pnt2d(CENTER.x() - MAJOR_RADIUS, CENTER.y())) +SketchSplit = Sketch_1.addSplit( + EllipticArc, geom.Pnt2d(CENTER.x() - MAJOR_RADIUS, CENTER.y()) +) model.do() NB_ELLIPTIC_ARCS += 1 NB_COINCIDENCES += 4 @@ -132,4 +178,4 @@ checkEllipticArcs(Sketch_1) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSplitLine.py b/src/SketchPlugin/Test/TestSplitLine.py index 68aee450e..3c2afff33 100644 --- a/src/SketchPlugin/Test/TestSplitLine.py +++ b/src/SketchPlugin/Test/TestSplitLine.py @@ -29,12 +29,20 @@ 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()) +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()) +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()]) +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_2.result(), [SketchLine_1.result(), SketchLine_3.result()] +) [SketchLine_4, SketchLine_5] = SketchConstraintMirror_1.mirrored() model.do() @@ -43,7 +51,7 @@ model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 3) model.testNbSubFeatures(Sketch_1, "SketchConstraintLength", 1) model.testNbSubFeatures(Sketch_1, "SketchConstraintMirror", 1) -#perform split +# perform split SketchSplit = Sketch_1.addSplit(SketchLine_1, geom.Pnt2d(-12, -8)) SketchSplit.execute() model.do() @@ -55,4 +63,4 @@ model.testNbSubFeatures(Sketch_1, "SketchConstraintMirror", 0) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestSplitPreview.py b/src/SketchPlugin/Test/TestSplitPreview.py index 88f82c54b..f9416861a 100644 --- a/src/SketchPlugin/Test/TestSplitPreview.py +++ b/src/SketchPlugin/Test/TestSplitPreview.py @@ -23,7 +23,14 @@ 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") + +Config_PropManager().registerProp( + "Visualization", + "operation_remove_feature_color", + "Color of removed feature in operation", + Config_Prop.Color, + "255, 174, 201", +) # base sketch model.begin() @@ -36,17 +43,33 @@ 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()) +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()) +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()) +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()) +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() @@ -64,7 +87,7 @@ 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) +assert featureToPresentation(aSplit).getAISObject(None) is not None aSession.finishOperation() model.testNbSubFeatures(Sketch, "SketchArc", 0) @@ -83,7 +106,7 @@ 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) +assert featureToPresentation(aSplit).getAISObject(None) is not None aSession.finishOperation() model.testNbSubFeatures(Sketch, "SketchArc", 2) diff --git a/src/SketchPlugin/Test/TestTrimArc01.py b/src/SketchPlugin/Test/TestTrimArc01.py index 0a9e57da8..c878a1dc5 100644 --- a/src/SketchPlugin/Test/TestTrimArc01.py +++ b/src/SketchPlugin/Test/TestTrimArc01.py @@ -25,12 +25,12 @@ from ModelGeomAlgo import ModelGeomAlgo_Point2D from salome.shaper import geom import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -SketchLineId = 'SketchLine' -SketchArcId = 'SketchArc' -SketchConstraintCoincidenceId = 'SketchConstraintCoincidence' -SketchConstraintEqualId = 'SketchConstraintEqual' +SketchLineId = "SketchLine" +SketchArcId = "SketchArc" +SketchConstraintCoincidenceId = "SketchConstraintCoincidence" +SketchConstraintEqualId = "SketchConstraintEqual" aSession = ModelAPI_Session.get() model.begin() @@ -44,72 +44,84 @@ SketchArc = Sketch.addArc(50, 50, 30, 50, 50, 70, False) SketchLine = Sketch.addLine(32, 20, 82, 70) SketchLine_intersecting = Sketch.addLine(10, 40, 90, 40) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 3) +assert Sketch_features.numberOfSubs() == 3 -Arc_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc.feature(), FeatureList([SketchLine_intersecting.feature()])) -assert(len(Arc_Points) == 2) +Arc_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc.feature(), FeatureList([SketchLine_intersecting.feature()]) +) +assert len(Arc_Points) == 2 ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()])) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 2) +assert Sketch_features.numberOfSubs() == 2 -assert (len(Arc_Points) == 2) +assert len(Arc_Points) == 2 if Arc_Points[0].x() < Arc_Points[1].x(): - GeomPoint = Arc_Points[0] + GeomPoint = Arc_Points[0] else: - GeomPoint = Arc_Points[1] + GeomPoint = Arc_Points[1] -#check number of features before trim +# check number of features before trim Sketch_feature = featureToCompositeFeature(Sketch.feature()) idList_before = [] for index in range(Sketch_feature.numberOfSubs()): - idList_before.append(Sketch_feature.subFeature(index).getKind()) + idList_before.append(Sketch_feature.subFeature(index).getKind()) -assert(idList_before.count(SketchArcId) == 1) -assert(idList_before.count(SketchLineId) == 1) -assert(idList_before.count(SketchConstraintCoincidenceId) == 0) +assert idList_before.count(SketchArcId) == 1 +assert idList_before.count(SketchLineId) == 1 +assert idList_before.count(SketchConstraintCoincidenceId) == 0 -#perform trim +# perform trim SketchTrim = Sketch.addTrim(SketchArc, Sketch.to2D(GeomPoint)) SketchTrim.execute() model.do() -#check number of features after trim +# check number of features after trim SketchFeatures = featureToCompositeFeature(Sketch.feature()) idList_after = [] for SubIndex in range(SketchFeatures.numberOfSubs()): SubFeature = SketchFeatures.subFeature(SubIndex) idList_after.append(SubFeature.getKind()) if SubFeature.getKind() == SketchArcId: - SketchArc = SubFeature + SketchArc = SubFeature -assert(idList_after.count(SketchArcId) == 1) -assert(idList_after.count(SketchLineId) == 1) -assert(idList_after.count(SketchConstraintCoincidenceId) == 1) +assert idList_after.count(SketchArcId) == 1 +assert idList_after.count(SketchLineId) == 1 +assert idList_after.count(SketchConstraintCoincidenceId) == 1 -#check arc position intersections of created arc to an additional line +# check arc position intersections of created arc to an additional line SketchLine_intersecting_1 = Sketch.addLine(50, 50, 25, 25) SketchLine_intersecting_2 = Sketch.addLine(50, 50, 75, 25) SketchLine_intersecting_3 = Sketch.addLine(50, 50, 75, 75) SketchLine_intersecting_4 = Sketch.addLine(50, 50, 25, 75) -Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_1.feature()])) -Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_2.feature()])) -Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_3.feature()])) -Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_4.feature()])) - -assert(len(Intersection_Points_1) == 0) -assert(len(Intersection_Points_2) == 1) -assert(len(Intersection_Points_3) == 1) -assert(len(Intersection_Points_4) == 0) - -#add point for check +Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchLine_intersecting_1.feature()]) +) +Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchLine_intersecting_2.feature()]) +) +Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchLine_intersecting_3.feature()]) +) +Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchLine_intersecting_4.feature()]) +) + +assert len(Intersection_Points_1) == 0 +assert len(Intersection_Points_2) == 1 +assert len(Intersection_Points_3) == 1 +assert len(Intersection_Points_4) == 0 + +# add point for check SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y()) -Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchPoint.feature()])) -assert(len(Intersection_Points_5) == 0) +Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchPoint.feature()]) +) +assert len(Intersection_Points_5) == 0 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestTrimArc02.py b/src/SketchPlugin/Test/TestTrimArc02.py index a0fabb522..3b48ed902 100644 --- a/src/SketchPlugin/Test/TestTrimArc02.py +++ b/src/SketchPlugin/Test/TestTrimArc02.py @@ -25,12 +25,12 @@ from ModelGeomAlgo import ModelGeomAlgo_Point2D from salome.shaper import geom import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -SketchLineId = 'SketchLine' -SketchArcId = 'SketchArc' -SketchConstraintCoincidenceId = 'SketchConstraintCoincidence' -SketchConstraintEqualId = 'SketchConstraintEqual' +SketchLineId = "SketchLine" +SketchArcId = "SketchArc" +SketchConstraintCoincidenceId = "SketchConstraintCoincidence" +SketchConstraintEqualId = "SketchConstraintEqual" aSession = ModelAPI_Session.get() model.begin() @@ -44,38 +44,40 @@ SketchArc = Sketch.addArc(50, 50, 30, 50, 50, 70, False) SketchLine = Sketch.addLine(32, 20, 82, 70) SketchLine_intersecting = Sketch.addLine(10, 40, 90, 40) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 3) +assert Sketch_features.numberOfSubs() == 3 -Arc_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc.feature(), FeatureList([SketchLine_intersecting.feature()])) -assert(len(Arc_Points) == 2) +Arc_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc.feature(), FeatureList([SketchLine_intersecting.feature()]) +) +assert len(Arc_Points) == 2 ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()])) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 2) +assert Sketch_features.numberOfSubs() == 2 -assert (len(Arc_Points) == 2) +assert len(Arc_Points) == 2 if Arc_Points[0].x() < Arc_Points[1].x(): - GeomPoint = Arc_Points[1] + GeomPoint = Arc_Points[1] else: - GeomPoint = Arc_Points[0] + GeomPoint = Arc_Points[0] -#check number of features before trim +# check number of features before trim Sketch_feature = featureToCompositeFeature(Sketch.feature()) idList_before = [] for index in range(Sketch_feature.numberOfSubs()): - idList_before.append(Sketch_feature.subFeature(index).getKind()) + idList_before.append(Sketch_feature.subFeature(index).getKind()) -assert(idList_before.count(SketchArcId) == 1) -assert(idList_before.count(SketchLineId) == 1) -assert(idList_before.count(SketchConstraintCoincidenceId) == 0) +assert idList_before.count(SketchArcId) == 1 +assert idList_before.count(SketchLineId) == 1 +assert idList_before.count(SketchConstraintCoincidenceId) == 0 -#perform trim +# perform trim SketchTrim = Sketch.addTrim(SketchArc, Sketch.to2D(GeomPoint)) SketchTrim.execute() model.do() -#check number of features after trim +# check number of features after trim SketchFeatures = featureToCompositeFeature(Sketch.feature()) idList_after = [] anArcList = FeatureList() @@ -83,38 +85,48 @@ for SubIndex in range(SketchFeatures.numberOfSubs()): SubFeature = SketchFeatures.subFeature(SubIndex) idList_after.append(SubFeature.getKind()) if SubFeature.getKind() == SketchArcId: - SketchArc = SubFeature - anArcList.append(SubFeature) + SketchArc = SubFeature + anArcList.append(SubFeature) -assert(len(anArcList) == 2) -assert(idList_after.count(SketchArcId) == 2) -assert(idList_after.count(SketchLineId) == 1) -assert(idList_after.count(SketchConstraintCoincidenceId) == 3) -assert(idList_after.count(SketchConstraintEqualId) == 1) +assert len(anArcList) == 2 +assert idList_after.count(SketchArcId) == 2 +assert idList_after.count(SketchLineId) == 1 +assert idList_after.count(SketchConstraintCoincidenceId) == 3 +assert idList_after.count(SketchConstraintEqualId) == 1 -#check arc position intersections of created arc to an additional line +# check arc position intersections of created arc to an additional line SketchLine_intersecting_1 = Sketch.addLine(50, 50, 25, 25) SketchLine_intersecting_2 = Sketch.addLine(50, 50, 75, 25) SketchLine_intersecting_3 = Sketch.addLine(50, 50, 75, 75) SketchLine_intersecting_4 = Sketch.addLine(50, 50, 25, 75) -Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_1.feature(), anArcList) -Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_2.feature(), anArcList) -Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_3.feature(), anArcList) -Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_4.feature(), anArcList) - -assert(len(Intersection_Points_1) == 1) -assert(len(Intersection_Points_2) == 0) -assert(len(Intersection_Points_3) == 1) -assert(len(Intersection_Points_4) == 0) - -#add point for check +Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_1.feature(), anArcList +) +Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_2.feature(), anArcList +) +Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_3.feature(), anArcList +) +Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_4.feature(), anArcList +) + +assert len(Intersection_Points_1) == 1 +assert len(Intersection_Points_2) == 0 +assert len(Intersection_Points_3) == 1 +assert len(Intersection_Points_4) == 0 + +# add point for check SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y()) SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y()) -Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchPoint.feature(), anArcList) -assert(len(Intersection_Points_5) == 0) +Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchPoint.feature(), anArcList +) +assert len(Intersection_Points_5) == 0 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestTrimArc03.py b/src/SketchPlugin/Test/TestTrimArc03.py index a4ec82d0b..b0f6410b1 100644 --- a/src/SketchPlugin/Test/TestTrimArc03.py +++ b/src/SketchPlugin/Test/TestTrimArc03.py @@ -25,12 +25,12 @@ from ModelGeomAlgo import ModelGeomAlgo_Point2D from salome.shaper import geom import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -SketchLineId = 'SketchLine' -SketchArcId = 'SketchArc' -SketchConstraintCoincidenceId = 'SketchConstraintCoincidence' -SketchConstraintEqualId = 'SketchConstraintEqual' +SketchLineId = "SketchLine" +SketchArcId = "SketchArc" +SketchConstraintCoincidenceId = "SketchConstraintCoincidence" +SketchConstraintEqualId = "SketchConstraintEqual" aSession = ModelAPI_Session.get() model.begin() @@ -45,43 +45,51 @@ SketchLine_1 = Sketch.addLine(50, 20, 100, 20) SketchLine_2 = Sketch.addLine(100, 20, 70, 50) SketchLine_intersecting = Sketch.addLine(10, 40, 90, 40) -SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_1.startPoint(), SketchArc.results()[1]) -SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchLine_2.endPoint(), SketchArc.results()[1]) -SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1_1 = Sketch.setCoincident( + SketchLine_1.startPoint(), SketchArc.results()[1] +) +SketchConstraintCoincidence_1_3 = Sketch.setCoincident( + SketchLine_2.endPoint(), SketchArc.results()[1] +) +SketchConstraintCoincidence_1_2 = Sketch.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 7) +assert Sketch_features.numberOfSubs() == 7 -Arc_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc.feature(), FeatureList([SketchLine_intersecting.feature()])) -assert(len(Arc_Points) == 2) +Arc_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc.feature(), FeatureList([SketchLine_intersecting.feature()]) +) +assert len(Arc_Points) == 2 ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()])) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 6) +assert Sketch_features.numberOfSubs() == 6 -assert (len(Arc_Points) == 2) +assert len(Arc_Points) == 2 if Arc_Points[0].x() < Arc_Points[1].x(): - GeomPoint = Arc_Points[0] + GeomPoint = Arc_Points[0] else: - GeomPoint = Arc_Points[1] + GeomPoint = Arc_Points[1] -#check number of features before trim +# check number of features before trim Sketch_feature = featureToCompositeFeature(Sketch.feature()) idList_before = [] for index in range(Sketch_feature.numberOfSubs()): - idList_before.append(Sketch_feature.subFeature(index).getKind()) + idList_before.append(Sketch_feature.subFeature(index).getKind()) -assert(idList_before.count(SketchArcId) == 1) -assert(idList_before.count(SketchLineId) == 2) -assert(idList_before.count(SketchConstraintCoincidenceId) == 3) +assert idList_before.count(SketchArcId) == 1 +assert idList_before.count(SketchLineId) == 2 +assert idList_before.count(SketchConstraintCoincidenceId) == 3 -#perform trim +# perform trim SketchTrim = Sketch.addTrim(SketchArc, Sketch.to2D(GeomPoint)) SketchTrim.execute() model.do() -#check number of features after trim +# check number of features after trim SketchFeatures = featureToCompositeFeature(Sketch.feature()) idList_after = [] anArcList = FeatureList() @@ -89,36 +97,46 @@ for SubIndex in range(SketchFeatures.numberOfSubs()): SubFeature = SketchFeatures.subFeature(SubIndex) idList_after.append(SubFeature.getKind()) if SubFeature.getKind() == SketchArcId: - SketchArc = SubFeature - anArcList.append(SubFeature) + SketchArc = SubFeature + anArcList.append(SubFeature) -assert(len(anArcList) == 1) -assert(idList_after.count(SketchArcId) == 1) -assert(idList_after.count(SketchLineId) == 2) -assert(idList_after.count(SketchConstraintCoincidenceId) == 3) +assert len(anArcList) == 1 +assert idList_after.count(SketchArcId) == 1 +assert idList_after.count(SketchLineId) == 2 +assert idList_after.count(SketchConstraintCoincidenceId) == 3 -#check arc position intersections of created arc to an additional line +# check arc position intersections of created arc to an additional line SketchLine_intersecting_1 = Sketch.addLine(50, 50, 25, 25) SketchLine_intersecting_2 = Sketch.addLine(50, 50, 75, 25) SketchLine_intersecting_3 = Sketch.addLine(50, 50, 75, 75) SketchLine_intersecting_4 = Sketch.addLine(50, 50, 25, 75) -Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_1.feature(), anArcList) -Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_2.feature(), anArcList) -Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_3.feature(), anArcList) -Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_4.feature(), anArcList) - -assert(len(Intersection_Points_1) == 0) -assert(len(Intersection_Points_2) == 1) -assert(len(Intersection_Points_3) == 1) -assert(len(Intersection_Points_4) == 0) - -#add point for check +Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_1.feature(), anArcList +) +Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_2.feature(), anArcList +) +Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_3.feature(), anArcList +) +Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_4.feature(), anArcList +) + +assert len(Intersection_Points_1) == 0 +assert len(Intersection_Points_2) == 1 +assert len(Intersection_Points_3) == 1 +assert len(Intersection_Points_4) == 0 + +# add point for check SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y()) SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y()) -Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchPoint.feature(), anArcList) -assert(len(Intersection_Points_5) == 0) +Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchPoint.feature(), anArcList +) +assert len(Intersection_Points_5) == 0 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestTrimArc04.py b/src/SketchPlugin/Test/TestTrimArc04.py index 88d3f9047..536cdd130 100644 --- a/src/SketchPlugin/Test/TestTrimArc04.py +++ b/src/SketchPlugin/Test/TestTrimArc04.py @@ -25,12 +25,12 @@ from ModelGeomAlgo import ModelGeomAlgo_Point2D from salome.shaper import geom import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -SketchLineId = 'SketchLine' -SketchArcId = 'SketchArc' -SketchConstraintCoincidenceId = 'SketchConstraintCoincidence' -SketchConstraintEqualId = 'SketchConstraintEqual' +SketchLineId = "SketchLine" +SketchArcId = "SketchArc" +SketchConstraintCoincidenceId = "SketchConstraintCoincidence" +SketchConstraintEqualId = "SketchConstraintEqual" aSession = ModelAPI_Session.get() model.begin() @@ -45,43 +45,51 @@ SketchLine_1 = Sketch.addLine(50, 20, 100, 20) SketchLine_2 = Sketch.addLine(100, 20, 70, 50) SketchLine_intersecting = Sketch.addLine(10, 40, 90, 40) -SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_1.startPoint(), SketchArc.results()[1]) -SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchLine_2.endPoint(), SketchArc.results()[1]) -SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1_1 = Sketch.setCoincident( + SketchLine_1.startPoint(), SketchArc.results()[1] +) +SketchConstraintCoincidence_1_3 = Sketch.setCoincident( + SketchLine_2.endPoint(), SketchArc.results()[1] +) +SketchConstraintCoincidence_1_2 = Sketch.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 7) +assert Sketch_features.numberOfSubs() == 7 -Arc_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc.feature(), FeatureList([SketchLine_intersecting.feature()])) -assert(len(Arc_Points) == 2) +Arc_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc.feature(), FeatureList([SketchLine_intersecting.feature()]) +) +assert len(Arc_Points) == 2 ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()])) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 6) +assert Sketch_features.numberOfSubs() == 6 -assert (len(Arc_Points) == 2) +assert len(Arc_Points) == 2 if Arc_Points[0].x() < Arc_Points[1].x(): - GeomPoint = Arc_Points[1] + GeomPoint = Arc_Points[1] else: - GeomPoint = Arc_Points[0] + GeomPoint = Arc_Points[0] -#check number of features before trim +# check number of features before trim Sketch_feature = featureToCompositeFeature(Sketch.feature()) idList_before = [] for index in range(Sketch_feature.numberOfSubs()): - idList_before.append(Sketch_feature.subFeature(index).getKind()) + idList_before.append(Sketch_feature.subFeature(index).getKind()) -assert(idList_before.count(SketchArcId) == 1) -assert(idList_before.count(SketchLineId) == 2) -assert(idList_before.count(SketchConstraintCoincidenceId) == 3) +assert idList_before.count(SketchArcId) == 1 +assert idList_before.count(SketchLineId) == 2 +assert idList_before.count(SketchConstraintCoincidenceId) == 3 -#perform trim +# perform trim SketchTrim = Sketch.addTrim(SketchArc, Sketch.to2D(GeomPoint)) SketchTrim.execute() model.do() -#check number of features after trim +# check number of features after trim SketchFeatures = featureToCompositeFeature(Sketch.feature()) idList_after = [] anArcList = FeatureList() @@ -89,39 +97,49 @@ for SubIndex in range(SketchFeatures.numberOfSubs()): SubFeature = SketchFeatures.subFeature(SubIndex) idList_after.append(SubFeature.getKind()) if SubFeature.getKind() == SketchArcId: - SketchArc = SubFeature - anArcList.append(SubFeature) + SketchArc = SubFeature + anArcList.append(SubFeature) -assert(len(anArcList) == 2) -assert(idList_after.count(SketchArcId) == 2) -assert(idList_after.count(SketchLineId) == 2) +assert len(anArcList) == 2 +assert idList_after.count(SketchArcId) == 2 +assert idList_after.count(SketchLineId) == 2 # TODO: Verify number of coincidence constraints (should be 4). # It should be one point-point constraint between arc and line extremities # but not a pair of point-on-entity constraints -assert(idList_after.count(SketchConstraintCoincidenceId) == 5) +assert idList_after.count(SketchConstraintCoincidenceId) == 5 -#check arc position intersections of created arc to an additional line +# check arc position intersections of created arc to an additional line SketchLine_intersecting_1 = Sketch.addLine(50, 50, 25, 25) SketchLine_intersecting_2 = Sketch.addLine(50, 50, 75, 25) SketchLine_intersecting_3 = Sketch.addLine(50, 50, 75, 75) SketchLine_intersecting_4 = Sketch.addLine(50, 50, 25, 75) -Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_1.feature(), anArcList) -Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_2.feature(), anArcList) -Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_3.feature(), anArcList) -Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_4.feature(), anArcList) - -assert(len(Intersection_Points_1) == 1) -assert(len(Intersection_Points_2) == 0) -assert(len(Intersection_Points_3) == 1) -assert(len(Intersection_Points_4) == 0) - -#add point for check +Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_1.feature(), anArcList +) +Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_2.feature(), anArcList +) +Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_3.feature(), anArcList +) +Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_4.feature(), anArcList +) + +assert len(Intersection_Points_1) == 1 +assert len(Intersection_Points_2) == 0 +assert len(Intersection_Points_3) == 1 +assert len(Intersection_Points_4) == 0 + +# add point for check SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y()) SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y()) -Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchPoint.feature(), anArcList) -assert(len(Intersection_Points_5) == 0) +Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchPoint.feature(), anArcList +) +assert len(Intersection_Points_5) == 0 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestTrimArc05.py b/src/SketchPlugin/Test/TestTrimArc05.py index cd1406ebb..cdcbaf4ee 100644 --- a/src/SketchPlugin/Test/TestTrimArc05.py +++ b/src/SketchPlugin/Test/TestTrimArc05.py @@ -25,12 +25,12 @@ from ModelGeomAlgo import ModelGeomAlgo_Point2D from salome.shaper import geom import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -SketchLineId = 'SketchLine' -SketchArcId = 'SketchArc' -SketchConstraintCoincidenceId = 'SketchConstraintCoincidence' -SketchConstraintEqualId = 'SketchConstraintEqual' +SketchLineId = "SketchLine" +SketchArcId = "SketchArc" +SketchConstraintCoincidenceId = "SketchConstraintCoincidence" +SketchConstraintEqualId = "SketchConstraintEqual" aSession = ModelAPI_Session.get() model.begin() @@ -46,43 +46,51 @@ SketchLine_1 = Sketch.addLine(50, 20, 100, 20) SketchLine_2 = Sketch.addLine(100, 20, 70, 50) SketchLine_intersecting = Sketch.addLine(10, 40, 90, 40) -SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_1.startPoint(), SketchArc.results()[1]) -SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchLine_2.endPoint(), SketchArc.results()[1]) -SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1_1 = Sketch.setCoincident( + SketchLine_1.startPoint(), SketchArc.results()[1] +) +SketchConstraintCoincidence_1_3 = Sketch.setCoincident( + SketchLine_2.endPoint(), SketchArc.results()[1] +) +SketchConstraintCoincidence_1_2 = Sketch.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 7) +assert Sketch_features.numberOfSubs() == 7 -Arc_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc.feature(), FeatureList([SketchLine_intersecting.feature()])) -assert(len(Arc_Points) == 2) +Arc_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc.feature(), FeatureList([SketchLine_intersecting.feature()]) +) +assert len(Arc_Points) == 2 ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()])) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 6) +assert Sketch_features.numberOfSubs() == 6 -assert (len(Arc_Points) == 2) +assert len(Arc_Points) == 2 if Arc_Points[0].x() < Arc_Points[1].x(): - GeomPoint = Arc_Points[0] + GeomPoint = Arc_Points[0] else: - GeomPoint = Arc_Points[1] + GeomPoint = Arc_Points[1] -#check number of features before trim +# check number of features before trim Sketch_feature = featureToCompositeFeature(Sketch.feature()) idList_before = [] for index in range(Sketch_feature.numberOfSubs()): - idList_before.append(Sketch_feature.subFeature(index).getKind()) + idList_before.append(Sketch_feature.subFeature(index).getKind()) -assert(idList_before.count(SketchArcId) == 1) -assert(idList_before.count(SketchLineId) == 2) -assert(idList_before.count(SketchConstraintCoincidenceId) == 3) +assert idList_before.count(SketchArcId) == 1 +assert idList_before.count(SketchLineId) == 2 +assert idList_before.count(SketchConstraintCoincidenceId) == 3 -#perform trim +# perform trim SketchTrim = Sketch.addTrim(SketchArc, Sketch.to2D(GeomPoint)) SketchTrim.execute() model.do() -#check number of features after trim +# check number of features after trim SketchFeatures = featureToCompositeFeature(Sketch.feature()) idList_after = [] anArcList = FeatureList() @@ -90,36 +98,46 @@ for SubIndex in range(SketchFeatures.numberOfSubs()): SubFeature = SketchFeatures.subFeature(SubIndex) idList_after.append(SubFeature.getKind()) if SubFeature.getKind() == SketchArcId: - SketchArc = SubFeature - anArcList.append(SubFeature) + SketchArc = SubFeature + anArcList.append(SubFeature) -assert(len(anArcList) == 1) -assert(idList_after.count(SketchArcId) == 1) -assert(idList_after.count(SketchLineId) == 2) -assert(idList_after.count(SketchConstraintCoincidenceId) == 3) +assert len(anArcList) == 1 +assert idList_after.count(SketchArcId) == 1 +assert idList_after.count(SketchLineId) == 2 +assert idList_after.count(SketchConstraintCoincidenceId) == 3 -#check arc position intersections of created arc to an additional line +# check arc position intersections of created arc to an additional line SketchLine_intersecting_1 = Sketch.addLine(50, 50, 25, 25) SketchLine_intersecting_2 = Sketch.addLine(50, 50, 75, 25) SketchLine_intersecting_3 = Sketch.addLine(50, 50, 75, 75) SketchLine_intersecting_4 = Sketch.addLine(50, 50, 25, 75) -Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_1.feature(), anArcList) -Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_2.feature(), anArcList) -Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_3.feature(), anArcList) -Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_4.feature(), anArcList) - -assert(len(Intersection_Points_1) == 0) -assert(len(Intersection_Points_2) == 1) -assert(len(Intersection_Points_3) == 1) -assert(len(Intersection_Points_4) == 0) - -#add point for check +Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_1.feature(), anArcList +) +Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_2.feature(), anArcList +) +Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_3.feature(), anArcList +) +Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_4.feature(), anArcList +) + +assert len(Intersection_Points_1) == 0 +assert len(Intersection_Points_2) == 1 +assert len(Intersection_Points_3) == 1 +assert len(Intersection_Points_4) == 0 + +# add point for check SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y()) SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y()) -Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchPoint.feature(), anArcList) -assert(len(Intersection_Points_5) == 0) +Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchPoint.feature(), anArcList +) +assert len(Intersection_Points_5) == 0 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestTrimArc06.py b/src/SketchPlugin/Test/TestTrimArc06.py index 3569dd82a..f3ef96800 100644 --- a/src/SketchPlugin/Test/TestTrimArc06.py +++ b/src/SketchPlugin/Test/TestTrimArc06.py @@ -25,12 +25,12 @@ from ModelGeomAlgo import ModelGeomAlgo_Point2D from salome.shaper import geom import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -SketchLineId = 'SketchLine' -SketchArcId = 'SketchArc' -SketchConstraintCoincidenceId = 'SketchConstraintCoincidence' -SketchConstraintEqualId = 'SketchConstraintEqual' +SketchLineId = "SketchLine" +SketchArcId = "SketchArc" +SketchConstraintCoincidenceId = "SketchConstraintCoincidence" +SketchConstraintEqualId = "SketchConstraintEqual" aSession = ModelAPI_Session.get() model.begin() @@ -46,43 +46,51 @@ SketchLine_1 = Sketch.addLine(50, 20, 100, 20) SketchLine_2 = Sketch.addLine(100, 20, 70, 50) SketchLine_intersecting = Sketch.addLine(10, 40, 90, 40) -SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_1.startPoint(), SketchArc.results()[1]) -SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchLine_2.endPoint(), SketchArc.results()[1]) -SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1_1 = Sketch.setCoincident( + SketchLine_1.startPoint(), SketchArc.results()[1] +) +SketchConstraintCoincidence_1_3 = Sketch.setCoincident( + SketchLine_2.endPoint(), SketchArc.results()[1] +) +SketchConstraintCoincidence_1_2 = Sketch.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 7) +assert Sketch_features.numberOfSubs() == 7 -Arc_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc.feature(), FeatureList([SketchLine_intersecting.feature()])) -assert(len(Arc_Points) == 2) +Arc_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc.feature(), FeatureList([SketchLine_intersecting.feature()]) +) +assert len(Arc_Points) == 2 ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()])) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 6) +assert Sketch_features.numberOfSubs() == 6 -assert (len(Arc_Points) == 2) +assert len(Arc_Points) == 2 if Arc_Points[0].x() < Arc_Points[1].x(): - GeomPoint = Arc_Points[1] + GeomPoint = Arc_Points[1] else: - GeomPoint = Arc_Points[0] + GeomPoint = Arc_Points[0] -#check number of features before trim +# check number of features before trim Sketch_feature = featureToCompositeFeature(Sketch.feature()) idList_before = [] for index in range(Sketch_feature.numberOfSubs()): - idList_before.append(Sketch_feature.subFeature(index).getKind()) + idList_before.append(Sketch_feature.subFeature(index).getKind()) -assert(idList_before.count(SketchArcId) == 1) -assert(idList_before.count(SketchLineId) == 2) -assert(idList_before.count(SketchConstraintCoincidenceId) == 3) +assert idList_before.count(SketchArcId) == 1 +assert idList_before.count(SketchLineId) == 2 +assert idList_before.count(SketchConstraintCoincidenceId) == 3 -#perform trim +# perform trim SketchTrim = Sketch.addTrim(SketchArc, Sketch.to2D(GeomPoint)) SketchTrim.execute() model.do() -#check number of features after trim +# check number of features after trim SketchFeatures = featureToCompositeFeature(Sketch.feature()) idList_after = [] anArcList = FeatureList() @@ -90,38 +98,48 @@ for SubIndex in range(SketchFeatures.numberOfSubs()): SubFeature = SketchFeatures.subFeature(SubIndex) idList_after.append(SubFeature.getKind()) if SubFeature.getKind() == SketchArcId: - anArcList.append(SubFeature) + anArcList.append(SubFeature) -assert(len(anArcList) == 2) -assert(idList_after.count(SketchArcId) == 2) -assert(idList_after.count(SketchLineId) == 2) +assert len(anArcList) == 2 +assert idList_after.count(SketchArcId) == 2 +assert idList_after.count(SketchLineId) == 2 # TODO: Verify number of coincidence constraints (should be 4). # It should be one point-point constraint between arc and line extremities # but not a pair of point-on-entity constraints -assert(idList_after.count(SketchConstraintCoincidenceId) == 5) +assert idList_after.count(SketchConstraintCoincidenceId) == 5 -#check arc position intersections of created arc to an additional line +# check arc position intersections of created arc to an additional line SketchLine_intersecting_1 = Sketch.addLine(50, 50, 25, 25) SketchLine_intersecting_2 = Sketch.addLine(50, 50, 75, 25) SketchLine_intersecting_3 = Sketch.addLine(50, 50, 75, 75) SketchLine_intersecting_4 = Sketch.addLine(50, 50, 25, 75) -Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_1.feature(), anArcList) -Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_2.feature(), anArcList) -Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_3.feature(), anArcList) -Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_4.feature(), anArcList) - -assert(len(Intersection_Points_1) == 1) -assert(len(Intersection_Points_2) == 0) -assert(len(Intersection_Points_3) == 1) -assert(len(Intersection_Points_4) == 0) - -#add point for check +Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_1.feature(), anArcList +) +Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_2.feature(), anArcList +) +Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_3.feature(), anArcList +) +Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_4.feature(), anArcList +) + +assert len(Intersection_Points_1) == 1 +assert len(Intersection_Points_2) == 0 +assert len(Intersection_Points_3) == 1 +assert len(Intersection_Points_4) == 0 + +# add point for check SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y()) SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y()) -Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchPoint.feature(), anArcList) -assert(len(Intersection_Points_5) == 0) +Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchPoint.feature(), anArcList +) +assert len(Intersection_Points_5) == 0 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestTrimArc07.py b/src/SketchPlugin/Test/TestTrimArc07.py index 90d1d68c2..d53167e84 100644 --- a/src/SketchPlugin/Test/TestTrimArc07.py +++ b/src/SketchPlugin/Test/TestTrimArc07.py @@ -25,12 +25,12 @@ from ModelGeomAlgo import ModelGeomAlgo_Point2D from salome.shaper import geom import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -SketchLineId = 'SketchLine' -SketchArcId = 'SketchArc' -SketchConstraintCoincidenceId = 'SketchConstraintCoincidence' -SketchConstraintEqualId = 'SketchConstraintEqual' +SketchLineId = "SketchLine" +SketchArcId = "SketchArc" +SketchConstraintCoincidenceId = "SketchConstraintCoincidence" +SketchConstraintEqualId = "SketchConstraintEqual" aSession = ModelAPI_Session.get() model.begin() @@ -46,24 +46,32 @@ SketchLine = Sketch.addLine(60, 31, 60, 130) SketchLine_2 = Sketch.addLine(10, 40, 90, 40) # correct start point of SketchLine to belong the arc for trim -Intersected_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc_1.feature(), FeatureList([SketchLine.feature()])) -assert(len(Intersected_Points) == 2) +Intersected_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc_1.feature(), FeatureList([SketchLine.feature()]) +) +assert len(Intersected_Points) == 2 if Intersected_Points[0].y() < Intersected_Points[1].y(): - IntersectionPoint = Intersected_Points[0] + IntersectionPoint = Intersected_Points[0] else: - IntersectionPoint = Intersected_Points[1] + IntersectionPoint = Intersected_Points[1] SketchLine.startPoint().setValue(IntersectionPoint.x(), IntersectionPoint.y()) -SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchArc_1.results()[1], SketchLine.startPoint()) +SketchConstraintCoincidence_1_1 = Sketch.setCoincident( + SketchArc_1.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_1_2 = Sketch.setCoincident( + SketchArc_1.results()[1], SketchLine.startPoint() +) model.do() -#find point on arc, where to perform trim +# find point on arc, where to perform trim SketchLine_intersecting = Sketch.addLine(50, 50, 100, 0) -Geom_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc_1.feature(), FeatureList([SketchLine_intersecting.feature()])) -assert(len(Geom_Points) == 1) +Geom_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc_1.feature(), FeatureList([SketchLine_intersecting.feature()]) +) +assert len(Geom_Points) == 1 ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()])) model.do() GeomPoint = Geom_Points[0] @@ -74,4 +82,4 @@ SketchTrim.execute() model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestTrimArc08.py b/src/SketchPlugin/Test/TestTrimArc08.py index 0a5d04620..49dcc22e9 100644 --- a/src/SketchPlugin/Test/TestTrimArc08.py +++ b/src/SketchPlugin/Test/TestTrimArc08.py @@ -29,20 +29,34 @@ 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()) +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()) +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]) +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) @@ -64,4 +78,4 @@ model.testNbSubFeatures(Sketch_1, "SketchConstraintEqual", 1) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestTrimCircle01.py b/src/SketchPlugin/Test/TestTrimCircle01.py index e82321684..f1c909e1e 100644 --- a/src/SketchPlugin/Test/TestTrimCircle01.py +++ b/src/SketchPlugin/Test/TestTrimCircle01.py @@ -25,12 +25,12 @@ from ModelGeomAlgo import ModelGeomAlgo_Point2D from salome.shaper import geom import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -SketchLineId = 'SketchLine' -SketchArcId = 'SketchArc' -SketchCircleId = 'SketchCircle' -SketchConstraintCoincidenceId = 'SketchConstraintCoincidence' +SketchLineId = "SketchLine" +SketchArcId = "SketchArc" +SketchCircleId = "SketchCircle" +SketchConstraintCoincidenceId = "SketchConstraintCoincidence" aSession = ModelAPI_Session.get() model.begin() @@ -44,69 +44,77 @@ SketchCircle = Sketch.addCircle(50, 50, 20) SketchLine = Sketch.addLine(30, 75, 75, 30) SketchLine_intersecting = Sketch.addLine(10, 55, 90, 55) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 3) +assert Sketch_features.numberOfSubs() == 3 -Circle_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchCircle.feature(), FeatureList([SketchLine_intersecting.feature()])) -assert(len(Circle_Points) == 2) +Circle_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchCircle.feature(), FeatureList([SketchLine_intersecting.feature()]) +) +assert len(Circle_Points) == 2 ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()])) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 2) +assert Sketch_features.numberOfSubs() == 2 -assert (len(Circle_Points) == 2) +assert len(Circle_Points) == 2 if Circle_Points[0].x() < Circle_Points[1].x(): - GeomPoint = Circle_Points[0] + GeomPoint = Circle_Points[0] else: - GeomPoint = Circle_Points[1] + GeomPoint = Circle_Points[1] -#check number of features before trim +# check number of features before trim Sketch_feature = featureToCompositeFeature(Sketch.feature()) idList_before = [] for index in range(Sketch_feature.numberOfSubs()): - idList_before.append(Sketch_feature.subFeature(index).getKind()) + idList_before.append(Sketch_feature.subFeature(index).getKind()) -assert(idList_before.count(SketchCircleId) == 1) -assert(idList_before.count(SketchArcId) == 0) -assert(idList_before.count(SketchLineId) == 1) -assert(idList_before.count(SketchConstraintCoincidenceId) == 0) +assert idList_before.count(SketchCircleId) == 1 +assert idList_before.count(SketchArcId) == 0 +assert idList_before.count(SketchLineId) == 1 +assert idList_before.count(SketchConstraintCoincidenceId) == 0 -#perform trim +# perform trim SketchTrim = Sketch.addTrim(SketchCircle, Sketch.to2D(GeomPoint)) SketchTrim.execute() model.do() -#check number of features after trim +# check number of features after trim SketchFeatures = featureToCompositeFeature(Sketch.feature()) idList_after = [] for SubIndex in range(SketchFeatures.numberOfSubs()): SubFeature = SketchFeatures.subFeature(SubIndex) idList_after.append(SubFeature.getKind()) if SubFeature.getKind() == SketchArcId: - SketchArc = SubFeature + SketchArc = SubFeature -assert(idList_after.count(SketchCircleId) == 0) -assert(idList_after.count(SketchArcId) == 1) -assert(idList_after.count(SketchLineId) == 1) -assert(idList_after.count(SketchConstraintCoincidenceId) == 2) +assert idList_after.count(SketchCircleId) == 0 +assert idList_after.count(SketchArcId) == 1 +assert idList_after.count(SketchLineId) == 1 +assert idList_after.count(SketchConstraintCoincidenceId) == 2 -#check arc position intersections of created arc to an additional line +# check arc position intersections of created arc to an additional line SketchLine_intersecting_1 = Sketch.addLine(0, 0, 50, 50) SketchLine_intersecting_2 = Sketch.addLine(50, 50, 100, 100) -Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_1.feature()])) -Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_2.feature()])) +Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchLine_intersecting_1.feature()]) +) +Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchLine_intersecting_2.feature()]) +) -assert(len(Intersection_Points_1) == 0) -assert(len(Intersection_Points_2) == 1) +assert len(Intersection_Points_1) == 0 +assert len(Intersection_Points_2) == 1 -#add point for check +# add point for check SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y()) -Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchPoint.feature()])) -assert(len(Intersection_Points_3) == 0) +Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchPoint.feature()]) +) +assert len(Intersection_Points_3) == 0 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestTrimCircle02.py b/src/SketchPlugin/Test/TestTrimCircle02.py index dbc4661d8..a7c78e571 100644 --- a/src/SketchPlugin/Test/TestTrimCircle02.py +++ b/src/SketchPlugin/Test/TestTrimCircle02.py @@ -25,12 +25,12 @@ from ModelGeomAlgo import ModelGeomAlgo_Point2D from salome.shaper import geom import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -SketchLineId = 'SketchLine' -SketchArcId = 'SketchArc' -SketchCircleId = 'SketchCircle' -SketchConstraintCoincidenceId = 'SketchConstraintCoincidence' +SketchLineId = "SketchLine" +SketchArcId = "SketchArc" +SketchCircleId = "SketchCircle" +SketchConstraintCoincidenceId = "SketchConstraintCoincidence" aSession = ModelAPI_Session.get() model.begin() @@ -44,68 +44,76 @@ SketchCircle = Sketch.addCircle(50, 50, 20) SketchLine = Sketch.addLine(30, 75, 75, 30) SketchLine_intersecting = Sketch.addLine(10, 55, 90, 55) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 3) +assert Sketch_features.numberOfSubs() == 3 -Circle_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchCircle.feature(), FeatureList([SketchLine_intersecting.feature()])) -assert(len(Circle_Points) == 2) +Circle_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchCircle.feature(), FeatureList([SketchLine_intersecting.feature()]) +) +assert len(Circle_Points) == 2 ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()])) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 2) +assert Sketch_features.numberOfSubs() == 2 -assert (len(Circle_Points) == 2) +assert len(Circle_Points) == 2 if Circle_Points[0].x() < Circle_Points[1].x(): - GeomPoint = Circle_Points[1] + GeomPoint = Circle_Points[1] else: - GeomPoint = Circle_Points[0] + GeomPoint = Circle_Points[0] -#check number of features before trim +# check number of features before trim Sketch_feature = featureToCompositeFeature(Sketch.feature()) idList_before = [] for index in range(Sketch_feature.numberOfSubs()): - idList_before.append(Sketch_feature.subFeature(index).getKind()) + idList_before.append(Sketch_feature.subFeature(index).getKind()) -assert(idList_before.count(SketchCircleId) == 1) -assert(idList_before.count(SketchArcId) == 0) -assert(idList_before.count(SketchLineId) == 1) -assert(idList_before.count(SketchConstraintCoincidenceId) == 0) +assert idList_before.count(SketchCircleId) == 1 +assert idList_before.count(SketchArcId) == 0 +assert idList_before.count(SketchLineId) == 1 +assert idList_before.count(SketchConstraintCoincidenceId) == 0 -#perform trim +# perform trim SketchTrim = Sketch.addTrim(SketchCircle, Sketch.to2D(GeomPoint)) SketchTrim.execute() model.do() -#check number of features after trim +# check number of features after trim SketchFeatures = featureToCompositeFeature(Sketch.feature()) idList_after = [] for SubIndex in range(SketchFeatures.numberOfSubs()): SubFeature = SketchFeatures.subFeature(SubIndex) idList_after.append(SubFeature.getKind()) if SubFeature.getKind() == SketchArcId: - SketchArc = SubFeature + SketchArc = SubFeature -assert(idList_after.count(SketchCircleId) == 0) -assert(idList_after.count(SketchArcId) == 1) -assert(idList_after.count(SketchLineId) == 1) -assert(idList_after.count(SketchConstraintCoincidenceId) == 2) +assert idList_after.count(SketchCircleId) == 0 +assert idList_after.count(SketchArcId) == 1 +assert idList_after.count(SketchLineId) == 1 +assert idList_after.count(SketchConstraintCoincidenceId) == 2 -#check arc position intersections of created arc to an additional line +# check arc position intersections of created arc to an additional line SketchLine_intersecting_1 = Sketch.addLine(0, 0, 50, 50) SketchLine_intersecting_2 = Sketch.addLine(50, 50, 100, 100) -Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_1.feature()])) -Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_2.feature()])) +Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchLine_intersecting_1.feature()]) +) +Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchLine_intersecting_2.feature()]) +) -assert(len(Intersection_Points_1) == 1) -assert(len(Intersection_Points_2) == 0) +assert len(Intersection_Points_1) == 1 +assert len(Intersection_Points_2) == 0 -#add point for check +# add point for check SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y()) -Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchPoint.feature()])) -assert(len(Intersection_Points_3) == 0) +Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchPoint.feature()]) +) +assert len(Intersection_Points_3) == 0 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestTrimCircle03.py b/src/SketchPlugin/Test/TestTrimCircle03.py index 6b51baaba..59aed2859 100644 --- a/src/SketchPlugin/Test/TestTrimCircle03.py +++ b/src/SketchPlugin/Test/TestTrimCircle03.py @@ -25,12 +25,12 @@ from ModelGeomAlgo import ModelGeomAlgo_Point2D from salome.shaper import geom import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -SketchLineId = 'SketchLine' -SketchArcId = 'SketchArc' -SketchCircleId = 'SketchCircle' -SketchConstraintCoincidenceId = 'SketchConstraintCoincidence' +SketchLineId = "SketchLine" +SketchArcId = "SketchArc" +SketchCircleId = "SketchCircle" +SketchConstraintCoincidenceId = "SketchConstraintCoincidence" aSession = ModelAPI_Session.get() model.begin() @@ -44,73 +44,87 @@ SketchCircle = Sketch.addCircle(50, 50, 20) SketchLine_1 = Sketch.addLine(70, 50, 80, 80) SketchLine_2 = Sketch.addLine(80, 80, 50, 70) -SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_1.startPoint(), SketchCircle.results()[1]) -SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchLine_2.endPoint(), SketchCircle.results()[1]) +SketchConstraintCoincidence_1_1 = Sketch.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_1_2 = Sketch.setCoincident( + SketchLine_1.startPoint(), SketchCircle.results()[1] +) +SketchConstraintCoincidence_1_3 = Sketch.setCoincident( + SketchLine_2.endPoint(), SketchCircle.results()[1] +) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 6) -#intersection points on circle to prepare a trim selection point +assert Sketch_features.numberOfSubs() == 6 +# intersection points on circle to prepare a trim selection point SketchLine_intersecting = Sketch.addLine(10, 60, 90, 60) -Circle_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchCircle.feature(), FeatureList([SketchLine_intersecting.feature()])) -assert(len(Circle_Points) == 2) +Circle_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchCircle.feature(), FeatureList([SketchLine_intersecting.feature()]) +) +assert len(Circle_Points) == 2 ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()])) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 6) +assert Sketch_features.numberOfSubs() == 6 -assert (len(Circle_Points) == 2) +assert len(Circle_Points) == 2 if Circle_Points[0].x() < Circle_Points[1].x(): - GeomPoint = Circle_Points[0] + GeomPoint = Circle_Points[0] else: - GeomPoint = Circle_Points[1] + GeomPoint = Circle_Points[1] -#check number of features before trim +# check number of features before trim Sketch_feature = featureToCompositeFeature(Sketch.feature()) idList_before = [] for index in range(Sketch_feature.numberOfSubs()): - idList_before.append(Sketch_feature.subFeature(index).getKind()) + idList_before.append(Sketch_feature.subFeature(index).getKind()) -assert(idList_before.count(SketchCircleId) == 1) -assert(idList_before.count(SketchArcId) == 0) -assert(idList_before.count(SketchLineId) == 2) -assert(idList_before.count(SketchConstraintCoincidenceId) == 3) +assert idList_before.count(SketchCircleId) == 1 +assert idList_before.count(SketchArcId) == 0 +assert idList_before.count(SketchLineId) == 2 +assert idList_before.count(SketchConstraintCoincidenceId) == 3 -#perform trim +# perform trim SketchTrim = Sketch.addTrim(SketchCircle, Sketch.to2D(GeomPoint)) SketchTrim.execute() model.do() -#check number of features after trim +# check number of features after trim SketchFeatures = featureToCompositeFeature(Sketch.feature()) idList_after = [] for SubIndex in range(SketchFeatures.numberOfSubs()): SubFeature = SketchFeatures.subFeature(SubIndex) idList_after.append(SubFeature.getKind()) if SubFeature.getKind() == SketchArcId: - SketchArc = SubFeature + SketchArc = SubFeature -assert(idList_after.count(SketchCircleId) == 0) -assert(idList_after.count(SketchArcId) == 1) -assert(idList_after.count(SketchLineId) == 2) -assert(idList_after.count(SketchConstraintCoincidenceId) == 3) +assert idList_after.count(SketchCircleId) == 0 +assert idList_after.count(SketchArcId) == 1 +assert idList_after.count(SketchLineId) == 2 +assert idList_after.count(SketchConstraintCoincidenceId) == 3 -#check arc position intersections of created arc to an additional line +# check arc position intersections of created arc to an additional line SketchLine_intersecting_1 = Sketch.addLine(0, 0, 50, 50) SketchLine_intersecting_2 = Sketch.addLine(50, 50, 100, 100) -Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_1.feature()])) -Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_2.feature()])) +Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchLine_intersecting_1.feature()]) +) +Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchLine_intersecting_2.feature()]) +) -assert(len(Intersection_Points_1) == 0) -assert(len(Intersection_Points_2) == 1) +assert len(Intersection_Points_1) == 0 +assert len(Intersection_Points_2) == 1 -#add point for check +# add point for check SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y()) -Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchPoint.feature()])) -assert(len(Intersection_Points_3) == 0) +Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchPoint.feature()]) +) +assert len(Intersection_Points_3) == 0 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestTrimCircle04.py b/src/SketchPlugin/Test/TestTrimCircle04.py index 11e426941..afd63c00e 100644 --- a/src/SketchPlugin/Test/TestTrimCircle04.py +++ b/src/SketchPlugin/Test/TestTrimCircle04.py @@ -25,12 +25,12 @@ from ModelGeomAlgo import ModelGeomAlgo_Point2D from salome.shaper import geom import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -SketchLineId = 'SketchLine' -SketchArcId = 'SketchArc' -SketchCircleId = 'SketchCircle' -SketchConstraintCoincidenceId = 'SketchConstraintCoincidence' +SketchLineId = "SketchLine" +SketchArcId = "SketchArc" +SketchCircleId = "SketchCircle" +SketchConstraintCoincidenceId = "SketchConstraintCoincidence" aSession = ModelAPI_Session.get() model.begin() @@ -44,74 +44,88 @@ SketchCircle = Sketch.addCircle(50, 50, 20) SketchLine_1 = Sketch.addLine(70, 50, 80, 80) SketchLine_2 = Sketch.addLine(80, 80, 50, 70) -SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_1.startPoint(), SketchCircle.results()[1]) -SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchLine_2.endPoint(), SketchCircle.results()[1]) +SketchConstraintCoincidence_1_1 = Sketch.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_1_2 = Sketch.setCoincident( + SketchLine_1.startPoint(), SketchCircle.results()[1] +) +SketchConstraintCoincidence_1_3 = Sketch.setCoincident( + SketchLine_2.endPoint(), SketchCircle.results()[1] +) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 6) -#intersection points on circle to prepare a trim selection point +assert Sketch_features.numberOfSubs() == 6 +# intersection points on circle to prepare a trim selection point SketchLine_intersecting = Sketch.addLine(10, 60, 90, 60) -Circle_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchCircle.feature(), FeatureList([SketchLine_intersecting.feature()])) -assert(len(Circle_Points) == 2) +Circle_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchCircle.feature(), FeatureList([SketchLine_intersecting.feature()]) +) +assert len(Circle_Points) == 2 ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()])) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 6) +assert Sketch_features.numberOfSubs() == 6 -assert (len(Circle_Points) == 2) +assert len(Circle_Points) == 2 GeomPoint = Circle_Points[1] if Circle_Points[0].x() < Circle_Points[1].x(): - GeomPoint = Circle_Points[1] + GeomPoint = Circle_Points[1] else: - GeomPoint = Circle_Points[0] + GeomPoint = Circle_Points[0] -#check number of features before trim +# check number of features before trim Sketch_feature = featureToCompositeFeature(Sketch.feature()) idList_before = [] for index in range(Sketch_feature.numberOfSubs()): - idList_before.append(Sketch_feature.subFeature(index).getKind()) + idList_before.append(Sketch_feature.subFeature(index).getKind()) -assert(idList_before.count(SketchCircleId) == 1) -assert(idList_before.count(SketchArcId) == 0) -assert(idList_before.count(SketchLineId) == 2) -assert(idList_before.count(SketchConstraintCoincidenceId) == 3) +assert idList_before.count(SketchCircleId) == 1 +assert idList_before.count(SketchArcId) == 0 +assert idList_before.count(SketchLineId) == 2 +assert idList_before.count(SketchConstraintCoincidenceId) == 3 -#perform trim +# perform trim SketchTrim = Sketch.addTrim(SketchCircle, Sketch.to2D(GeomPoint)) SketchTrim.execute() model.do() -#check number of features after trim +# check number of features after trim SketchFeatures = featureToCompositeFeature(Sketch.feature()) idList_after = [] for SubIndex in range(SketchFeatures.numberOfSubs()): SubFeature = SketchFeatures.subFeature(SubIndex) idList_after.append(SubFeature.getKind()) if SubFeature.getKind() == SketchArcId: - SketchArc = SubFeature + SketchArc = SubFeature -assert(idList_after.count(SketchCircleId) == 0) -assert(idList_after.count(SketchArcId) == 1) -assert(idList_after.count(SketchLineId) == 2) -assert(idList_after.count(SketchConstraintCoincidenceId) == 3) +assert idList_after.count(SketchCircleId) == 0 +assert idList_after.count(SketchArcId) == 1 +assert idList_after.count(SketchLineId) == 2 +assert idList_after.count(SketchConstraintCoincidenceId) == 3 -#check arc position intersections of created arc to an additional line +# check arc position intersections of created arc to an additional line SketchLine_intersecting_1 = Sketch.addLine(0, 0, 50, 50) SketchLine_intersecting_2 = Sketch.addLine(50, 50, 100, 100) -Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_1.feature()])) -Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_2.feature()])) +Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchLine_intersecting_1.feature()]) +) +Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchLine_intersecting_2.feature()]) +) -assert(len(Intersection_Points_1) == 1) -assert(len(Intersection_Points_2) == 0) +assert len(Intersection_Points_1) == 1 +assert len(Intersection_Points_2) == 0 -#add point for check +# add point for check SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y()) -Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchPoint.feature()])) -assert(len(Intersection_Points_3) == 0) +Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchPoint.feature()]) +) +assert len(Intersection_Points_3) == 0 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestTrimCircle05.py b/src/SketchPlugin/Test/TestTrimCircle05.py index 54100c36f..68ea64a80 100644 --- a/src/SketchPlugin/Test/TestTrimCircle05.py +++ b/src/SketchPlugin/Test/TestTrimCircle05.py @@ -25,12 +25,12 @@ from ModelGeomAlgo import ModelGeomAlgo_Point2D from salome.shaper import geom import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -SketchPointId = 'SketchPoint' -SketchArcId = 'SketchArc' -SketchCircleId = 'SketchCircle' -SketchConstraintCoincidenceId = 'SketchConstraintCoincidence' +SketchPointId = "SketchPoint" +SketchArcId = "SketchArc" +SketchCircleId = "SketchCircle" +SketchConstraintCoincidenceId = "SketchConstraintCoincidence" aSession = ModelAPI_Session.get() model.begin() @@ -46,76 +46,92 @@ SketchPoint_2 = Sketch.addPoint(30, 50) SketchPoint_3 = Sketch.addPoint(50, 70) SketchPoint_4 = Sketch.addPoint(50, 30) -#coincidence point to circle -SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchPoint_1.results()[0], SketchCircle.results()[1]) -SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchPoint_2.results()[0], SketchCircle.results()[1]) - -#coincidence circle to point -SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchCircle.results()[1], SketchPoint_3.results()[0]) -SketchConstraintCoincidence_1_4 = Sketch.setCoincident(SketchCircle.results()[1], SketchPoint_4.results()[0]) +# coincidence point to circle +SketchConstraintCoincidence_1_1 = Sketch.setCoincident( + SketchPoint_1.results()[0], SketchCircle.results()[1] +) +SketchConstraintCoincidence_1_2 = Sketch.setCoincident( + SketchPoint_2.results()[0], SketchCircle.results()[1] +) + +# coincidence circle to point +SketchConstraintCoincidence_1_3 = Sketch.setCoincident( + SketchCircle.results()[1], SketchPoint_3.results()[0] +) +SketchConstraintCoincidence_1_4 = Sketch.setCoincident( + SketchCircle.results()[1], SketchPoint_4.results()[0] +) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 9) -#intersection points on circle to prepare a trim selection point +assert Sketch_features.numberOfSubs() == 9 +# intersection points on circle to prepare a trim selection point SketchLine_intersecting = Sketch.addLine(10, 60, 90, 60) -Circle_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchCircle.feature(), FeatureList([SketchLine_intersecting.feature()])) -assert(len(Circle_Points) == 2) +Circle_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchCircle.feature(), FeatureList([SketchLine_intersecting.feature()]) +) +assert len(Circle_Points) == 2 ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()])) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 9) +assert Sketch_features.numberOfSubs() == 9 -assert (len(Circle_Points) == 2) +assert len(Circle_Points) == 2 if Circle_Points[0].x() < Circle_Points[1].x(): - GeomPoint = Circle_Points[0] + GeomPoint = Circle_Points[0] else: - GeomPoint = Circle_Points[1] + GeomPoint = Circle_Points[1] -#check number of features before trim +# check number of features before trim Sketch_feature = featureToCompositeFeature(Sketch.feature()) idList_before = [] for index in range(Sketch_feature.numberOfSubs()): - idList_before.append(Sketch_feature.subFeature(index).getKind()) + idList_before.append(Sketch_feature.subFeature(index).getKind()) -assert(idList_before.count(SketchCircleId) == 1) -assert(idList_before.count(SketchArcId) == 0) -assert(idList_before.count(SketchPointId) == 4) -assert(idList_before.count(SketchConstraintCoincidenceId) == 4) +assert idList_before.count(SketchCircleId) == 1 +assert idList_before.count(SketchArcId) == 0 +assert idList_before.count(SketchPointId) == 4 +assert idList_before.count(SketchConstraintCoincidenceId) == 4 -#perform trim +# perform trim SketchTrim = Sketch.addTrim(SketchCircle, Sketch.to2D(GeomPoint)) SketchTrim.execute() model.do() -#check number of features after trim +# check number of features after trim SketchFeatures = featureToCompositeFeature(Sketch.feature()) idList_after = [] for SubIndex in range(SketchFeatures.numberOfSubs()): SubFeature = SketchFeatures.subFeature(SubIndex) idList_after.append(SubFeature.getKind()) if SubFeature.getKind() == SketchArcId: - SketchArc = SubFeature + SketchArc = SubFeature -assert(idList_after.count(SketchCircleId) == 0) -assert(idList_after.count(SketchArcId) == 1) -assert(idList_after.count(SketchPointId) == 4) -assert(idList_after.count(SketchConstraintCoincidenceId) == 4) +assert idList_after.count(SketchCircleId) == 0 +assert idList_after.count(SketchArcId) == 1 +assert idList_after.count(SketchPointId) == 4 +assert idList_after.count(SketchConstraintCoincidenceId) == 4 -#check arc position intersections of created arc to an additional line +# check arc position intersections of created arc to an additional line SketchLine_intersecting_1 = Sketch.addLine(0, 0, 100, 100) SketchLine_intersecting_2 = Sketch.addLine(0, 100, 100, 0) -Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_1.feature()])) -Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_2.feature()])) +Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchLine_intersecting_1.feature()]) +) +Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchLine_intersecting_2.feature()]) +) -assert(len(Intersection_Points_1) == 2) -assert(len(Intersection_Points_2) == 1) +assert len(Intersection_Points_1) == 2 +assert len(Intersection_Points_2) == 1 -#add point for check +# add point for check SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y()) -Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchPoint.feature()])) -assert(len(Intersection_Points_3) == 0) +Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchPoint.feature()]) +) +assert len(Intersection_Points_3) == 0 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestTrimCircleAndArc01.py b/src/SketchPlugin/Test/TestTrimCircleAndArc01.py index ddaeb0df0..6624f87de 100644 --- a/src/SketchPlugin/Test/TestTrimCircleAndArc01.py +++ b/src/SketchPlugin/Test/TestTrimCircleAndArc01.py @@ -25,12 +25,12 @@ from ModelGeomAlgo import ModelGeomAlgo_Point2D from salome.shaper import geom import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -SketchLineId = 'SketchLine' -SketchArcId = 'SketchArc' -SketchCircleId = 'SketchCircle' -SketchConstraintCoincidenceId = 'SketchConstraintCoincidence' +SketchLineId = "SketchLine" +SketchArcId = "SketchArc" +SketchCircleId = "SketchCircle" +SketchConstraintCoincidenceId = "SketchConstraintCoincidence" aSession = ModelAPI_Session.get() model.begin() @@ -45,97 +45,119 @@ SketchLine_1 = Sketch.addLine(45, 68, 45, 73) SketchLine_2 = Sketch.addLine(45, 73, 55, 73) SketchLine_3 = Sketch.addLine(55, 73, 55, 68) -SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchLine_1.startPoint(), SketchCircle.results()[1]) -SketchConstraintCoincidence_1_4 = Sketch.setCoincident(SketchLine_3.endPoint(), SketchCircle.results()[1]) +SketchConstraintCoincidence_1_1 = Sketch.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_1_2 = Sketch.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_1_3 = Sketch.setCoincident( + SketchLine_1.startPoint(), SketchCircle.results()[1] +) +SketchConstraintCoincidence_1_4 = Sketch.setCoincident( + SketchLine_3.endPoint(), SketchCircle.results()[1] +) SketchLine_4 = Sketch.addLine(68, 45, 73, 45) SketchLine_5 = Sketch.addLine(73, 45, 73, 55) SketchLine_6 = Sketch.addLine(73, 55, 68, 55) -SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchLine_4.startPoint(), SketchCircle.results()[1]) -SketchConstraintCoincidence_1_4 = Sketch.setCoincident(SketchLine_6.endPoint(), SketchCircle.results()[1]) +SketchConstraintCoincidence_1_1 = Sketch.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_1_2 = Sketch.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_1_3 = Sketch.setCoincident( + SketchLine_4.startPoint(), SketchCircle.results()[1] +) +SketchConstraintCoincidence_1_4 = Sketch.setCoincident( + SketchLine_6.endPoint(), SketchCircle.results()[1] +) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 15) -#intersection points on circle to prepare a trim selection point -#first intersection point - vertical +assert Sketch_features.numberOfSubs() == 15 +# intersection points on circle to prepare a trim selection point +# first intersection point - vertical SketchLine_intersecting = Sketch.addLine(48, 10, 48, 90) -Circle_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchCircle.feature(), FeatureList([SketchLine_intersecting.feature()])) -assert(len(Circle_Points) == 2) +Circle_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchCircle.feature(), FeatureList([SketchLine_intersecting.feature()]) +) +assert len(Circle_Points) == 2 ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()])) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 15) +assert Sketch_features.numberOfSubs() == 15 -assert (len(Circle_Points) == 2) +assert len(Circle_Points) == 2 GeomPoint = Circle_Points[1] if Circle_Points[0].y() < Circle_Points[1].y(): - GeomPoint = Circle_Points[1] + GeomPoint = Circle_Points[1] else: - GeomPoint = Circle_Points[0] + GeomPoint = Circle_Points[0] -#check number of features before trim +# check number of features before trim Sketch_feature = featureToCompositeFeature(Sketch.feature()) idList_before = [] for index in range(Sketch_feature.numberOfSubs()): - idList_before.append(Sketch_feature.subFeature(index).getKind()) + idList_before.append(Sketch_feature.subFeature(index).getKind()) -assert(idList_before.count(SketchCircleId) == 1) -assert(idList_before.count(SketchArcId) == 0) -assert(idList_before.count(SketchLineId) == 6) -assert(idList_before.count(SketchConstraintCoincidenceId) == 8) +assert idList_before.count(SketchCircleId) == 1 +assert idList_before.count(SketchArcId) == 0 +assert idList_before.count(SketchLineId) == 6 +assert idList_before.count(SketchConstraintCoincidenceId) == 8 -#perform trim: vertical +# perform trim: vertical SketchTrim = Sketch.addTrim(SketchCircle, Sketch.to2D(GeomPoint)) SketchTrim.execute() model.do() -#check number of features after trim +# check number of features after trim SketchFeatures = featureToCompositeFeature(Sketch.feature()) idList_after = [] for SubIndex in range(SketchFeatures.numberOfSubs()): SubFeature = SketchFeatures.subFeature(SubIndex) idList_after.append(SubFeature.getKind()) if SubFeature.getKind() == SketchArcId: - SketchArc = SubFeature + SketchArc = SubFeature -assert(idList_after.count(SketchCircleId) == 0) -assert(idList_after.count(SketchArcId) == 1) -assert(idList_after.count(SketchLineId) == 6) -assert(idList_after.count(SketchConstraintCoincidenceId) == 8) +assert idList_after.count(SketchCircleId) == 0 +assert idList_after.count(SketchArcId) == 1 +assert idList_after.count(SketchLineId) == 6 +assert idList_after.count(SketchConstraintCoincidenceId) == 8 -#add point for check +# add point for check SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y()) -Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchPoint.feature()])) -assert(len(Intersection_Points_3) == 0) +Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchPoint.feature()]) +) +assert len(Intersection_Points_3) == 0 -#perform trim: horizontal -#second intersection point - horizontal +# perform trim: horizontal +# second intersection point - horizontal SketchLine_intersecting_h = Sketch.addLine(10, 48, 72, 48) -Circle_Points_h = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_h.feature()])) -assert(len(Circle_Points_h) == 2) +Circle_Points_h = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchArc, FeatureList([SketchLine_intersecting_h.feature()]) +) +assert len(Circle_Points_h) == 2 ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting_h.feature()])) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 16) +assert Sketch_features.numberOfSubs() == 16 -assert (len(Circle_Points_h) == 2) +assert len(Circle_Points_h) == 2 GeomPoint = Circle_Points_h[1] if Circle_Points_h[0].x() < Circle_Points_h[1].x(): - GeomPoint_h = Circle_Points_h[1] + GeomPoint_h = Circle_Points_h[1] else: - GeomPoint_h = Circle_Points_h[0] + GeomPoint_h = Circle_Points_h[0] SketchTrim = Sketch.addTrim(SketchArc, Sketch.to2D(GeomPoint_h)) SketchTrim.execute() model.do() -#check number of features after trim +# check number of features after trim SketchFeatures = featureToCompositeFeature(Sketch.feature()) idList_after = [] anArcList = FeatureList() @@ -143,22 +165,24 @@ for SubIndex in range(SketchFeatures.numberOfSubs()): SubFeature = SketchFeatures.subFeature(SubIndex) idList_after.append(SubFeature.getKind()) if SubFeature.getKind() == SketchArcId: - anArcList.append(SubFeature) + anArcList.append(SubFeature) -assert(len(anArcList) == 2) +assert len(anArcList) == 2 -assert(idList_after.count(SketchCircleId) == 0) -assert(idList_after.count(SketchArcId) == 2) -assert(idList_after.count(SketchLineId) == 6) -assert(idList_after.count(SketchConstraintCoincidenceId) == 9) +assert idList_after.count(SketchCircleId) == 0 +assert idList_after.count(SketchArcId) == 2 +assert idList_after.count(SketchLineId) == 6 +assert idList_after.count(SketchConstraintCoincidenceId) == 9 -#add point for check +# add point for check SketchPoint = Sketch.addPoint(GeomPoint_h.x(), GeomPoint_h.y()) -Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchPoint.feature(), anArcList) -assert(len(Intersection_Points_5) == 0) +Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchPoint.feature(), anArcList +) +assert len(Intersection_Points_5) == 0 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestTrimEllipse.py b/src/SketchPlugin/Test/TestTrimEllipse.py index 9b5ad1ddb..6fb0635de 100644 --- a/src/SketchPlugin/Test/TestTrimEllipse.py +++ b/src/SketchPlugin/Test/TestTrimEllipse.py @@ -35,7 +35,8 @@ NB_ELLIPTIC_ARCS = 0 NB_COINCIDENCES = 6 NB_EQUALS = 0 -TOLERANCE = 1.e-6 +TOLERANCE = 1.0e-6 + def checkFeaturesQuantity(theSketch): model.testNbSubFeatures(theSketch, "SketchLine", NB_LINES) @@ -43,7 +44,8 @@ def checkFeaturesQuantity(theSketch): model.testNbSubFeatures(theSketch, "SketchEllipticArc", NB_ELLIPTIC_ARCS) model.testNbSubFeatures(theSketch, "SketchConstraintCoincidence", NB_COINCIDENCES) model.testNbSubFeatures(theSketch, "SketchConstraintEqual", NB_EQUALS) - assert(model.dof(theSketch) == DOF) + assert model.dof(theSketch) == DOF + def checkEllipticArcs(theSketch): for aSub in theSketch.features().list(): @@ -51,14 +53,24 @@ def checkEllipticArcs(theSketch): if aFeature is not None and aFeature.getKind() == "SketchEllipticArc": assertEllipticArc(SketchAPI_EllipticArc(aFeature)) + def assertEllipticArc(theArc): assertPoints(theArc.center(), CENTER) - assertPoints(theArc.majorAxisPositive(), geom.Pnt2d(CENTER.x() + MAJOR_RADIUS, CENTER.y())) - assertPoints(theArc.minorAxisPositive(), geom.Pnt2d(CENTER.x(), CENTER.y() + MINOR_RADIUS)) + assertPoints( + theArc.majorAxisPositive(), geom.Pnt2d(CENTER.x() + MAJOR_RADIUS, CENTER.y()) + ) + assertPoints( + theArc.minorAxisPositive(), geom.Pnt2d(CENTER.x(), CENTER.y() + MINOR_RADIUS) + ) + def assertPoints(thePoint1, thePoint2): - assert(math.fabs(thePoint1.x() - thePoint2.x()) < TOLERANCE), "{} != {}".format(thePoint1.x(), thePoint2.x()) - assert(math.fabs(thePoint1.y() - thePoint2.y()) < TOLERANCE), "{} != {}".format(thePoint1.y(), thePoint2.y()) + assert math.fabs(thePoint1.x() - thePoint2.x()) < TOLERANCE, "{} != {}".format( + thePoint1.x(), thePoint2.x() + ) + assert math.fabs(thePoint1.y() - thePoint2.y()) < TOLERANCE, "{} != {}".format( + thePoint1.y(), thePoint2.y() + ) model.begin() @@ -66,23 +78,49 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchEllipse_1 = Sketch_1.addEllipse(CENTER.x(), CENTER.y(), CENTER.x() + math.sqrt(MAJOR_RADIUS**2 - MINOR_RADIUS**2), CENTER.y(), MINOR_RADIUS) -SketchLine_1 = Sketch_1.addLine(-16.74176451428603, -15.34869012470842, -16.85909682653373, 35.30399198463829) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchEllipse_1.result()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchEllipse_1.result()) -SketchLine_2 = Sketch_1.addLine(-16.85909682653373, 35.30399198463829, 20.9032928583277, -19.27802168426675) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchEllipse_1.result()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchEllipse_1.result()) -SketchLine_3 = Sketch_1.addLine(34.69765676551338, 36.08465583643841, 35.0422024535432, -17.96612629290852) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchEllipse_1.result()) +SketchEllipse_1 = Sketch_1.addEllipse( + CENTER.x(), + CENTER.y(), + CENTER.x() + math.sqrt(MAJOR_RADIUS**2 - MINOR_RADIUS**2), + CENTER.y(), + MINOR_RADIUS, +) +SketchLine_1 = Sketch_1.addLine( + -16.74176451428603, -15.34869012470842, -16.85909682653373, 35.30399198463829 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchEllipse_1.result() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchEllipse_1.result() +) +SketchLine_2 = Sketch_1.addLine( + -16.85909682653373, 35.30399198463829, 20.9032928583277, -19.27802168426675 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchEllipse_1.result() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchEllipse_1.result() +) +SketchLine_3 = Sketch_1.addLine( + 34.69765676551338, 36.08465583643841, 35.0422024535432, -17.96612629290852 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchEllipse_1.result() +) model.do() checkFeaturesQuantity(Sketch_1) checkEllipticArcs(Sketch_1) # trim the ellipse -SketchSplit = Sketch_1.addTrim(SketchEllipse_1, geom.Pnt2d(CENTER.x() + MAJOR_RADIUS, CENTER.y())) +SketchSplit = Sketch_1.addTrim( + SketchEllipse_1, geom.Pnt2d(CENTER.x() + MAJOR_RADIUS, CENTER.y()) +) model.do() NB_ELLIPSES -= 1 NB_ELLIPTIC_ARCS += 1 @@ -93,8 +131,14 @@ checkEllipticArcs(Sketch_1) # trim the middle arc of ellipse EllipticArc = SketchAPI_EllipticArc(model.lastSubFeature(Sketch_1, "SketchEllipticArc")) -ANGLE = -math.pi/2 - math.pi/10 -SketchSplit = Sketch_1.addTrim(EllipticArc, geom.Pnt2d(CENTER.x() + MAJOR_RADIUS * math.cos(ANGLE), CENTER.y() + MINOR_RADIUS * math.sin(ANGLE))) +ANGLE = -math.pi / 2 - math.pi / 10 +SketchSplit = Sketch_1.addTrim( + EllipticArc, + geom.Pnt2d( + CENTER.x() + MAJOR_RADIUS * math.cos(ANGLE), + CENTER.y() + MINOR_RADIUS * math.sin(ANGLE), + ), +) model.do() NB_ELLIPTIC_ARCS += 1 NB_COINCIDENCES += 1 @@ -105,7 +149,9 @@ checkFeaturesQuantity(Sketch_1) checkEllipticArcs(Sketch_1) # trim the boundary arc of ellipse -SketchSplit = Sketch_1.addTrim(EllipticArc, geom.Pnt2d(CENTER.x() - MAJOR_RADIUS, CENTER.y())) +SketchSplit = Sketch_1.addTrim( + EllipticArc, geom.Pnt2d(CENTER.x() - MAJOR_RADIUS, CENTER.y()) +) model.do() NB_COINCIDENCES -= 1 DOF += 1 @@ -115,4 +161,4 @@ checkEllipticArcs(Sketch_1) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestTrimLine01.py b/src/SketchPlugin/Test/TestTrimLine01.py index bdd368ef8..f5d0be6d3 100644 --- a/src/SketchPlugin/Test/TestTrimLine01.py +++ b/src/SketchPlugin/Test/TestTrimLine01.py @@ -25,10 +25,10 @@ from ModelGeomAlgo import ModelGeomAlgo_Point2D from salome.shaper import geom import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -SketchLineId = 'SketchLine' -SketchConstraintCoincidenceId = 'SketchConstraintCoincidence' +SketchLineId = "SketchLine" +SketchConstraintCoincidenceId = "SketchConstraintCoincidence" aSession = ModelAPI_Session.get() model.begin() @@ -45,46 +45,52 @@ SketchLine_3 = Sketch.addLine(-10, 190, 90, 50) SketchLine_intersecting = Sketch.addLine(-30, 85, 50, 85) -SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_1.results()[0], SketchLine_3.endPoint()) +SketchConstraintCoincidence_1_1 = Sketch.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_1_2 = Sketch.setCoincident( + SketchLine_1.results()[0], SketchLine_3.endPoint() +) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 6) +assert Sketch_features.numberOfSubs() == 6 -Intersection_Point = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_2.feature(), FeatureList([SketchLine_intersecting.feature()])) -assert(len(Intersection_Point) == 1) +Intersection_Point = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_2.feature(), FeatureList([SketchLine_intersecting.feature()]) +) +assert len(Intersection_Point) == 1 ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()])) Sketch_features = featureToCompositeFeature(Sketch.feature()) -assert (Sketch_features.numberOfSubs() == 5) +assert Sketch_features.numberOfSubs() == 5 GeomPoint = Intersection_Point[0] -#check number of features before trim +# check number of features before trim Sketch_feature = featureToCompositeFeature(Sketch.feature()) idList_before = [] for index in range(Sketch_feature.numberOfSubs()): - idList_before.append(Sketch_feature.subFeature(index).getKind()) + idList_before.append(Sketch_feature.subFeature(index).getKind()) -assert(idList_before.count(SketchLineId) == 3) -assert(idList_before.count(SketchConstraintCoincidenceId) == 2) +assert idList_before.count(SketchLineId) == 3 +assert idList_before.count(SketchConstraintCoincidenceId) == 2 -#perform trim +# perform trim SketchTrim = Sketch.addTrim(SketchLine_2, Sketch.to2D(GeomPoint)) SketchTrim.execute() model.do() -#check number of features after trim +# check number of features after trim SketchFeatures = featureToCompositeFeature(Sketch.feature()) idList_after = [] for SubIndex in range(SketchFeatures.numberOfSubs()): SubFeature = SketchFeatures.subFeature(SubIndex) idList_after.append(SubFeature.getKind()) -assert(idList_after.count(SketchLineId) == 3) -assert(idList_after.count(SketchConstraintCoincidenceId) == 2) +assert idList_after.count(SketchLineId) == 3 +assert idList_after.count(SketchConstraintCoincidenceId) == 2 model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestTrimLine02.py b/src/SketchPlugin/Test/TestTrimLine02.py index 899e0e8fa..31635f3c3 100644 --- a/src/SketchPlugin/Test/TestTrimLine02.py +++ b/src/SketchPlugin/Test/TestTrimLine02.py @@ -25,10 +25,10 @@ from ModelGeomAlgo import ModelGeomAlgo_Point2D from salome.shaper import geom import math -TOLERANCE = 1.e-7 +TOLERANCE = 1.0e-7 -SketchLineId = 'SketchLine' -SketchConstraintCoincidenceId = 'SketchConstraintCoincidence' +SketchLineId = "SketchLine" +SketchConstraintCoincidenceId = "SketchConstraintCoincidence" aSession = ModelAPI_Session.get() model.begin() @@ -46,27 +46,33 @@ SketchLine_4 = Sketch.addLine(100, 10, 130, 80) SketchLine_intersecting = Sketch.addLine(10, 50, 130, 50) -SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_1_1 = Sketch.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_1_2 = Sketch.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_1_3 = Sketch.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) GeomPoint = geom.Pnt2d(40, 50) -#check number of features before trim +# check number of features before trim Sketch_feature = featureToCompositeFeature(Sketch.feature()) idList_before = [] for index in range(Sketch_feature.numberOfSubs()): - idList_before.append(Sketch_feature.subFeature(index).getKind()) + idList_before.append(Sketch_feature.subFeature(index).getKind()) -assert(idList_before.count(SketchLineId) == 5) -assert(idList_before.count(SketchConstraintCoincidenceId) == 3) +assert idList_before.count(SketchLineId) == 5 +assert idList_before.count(SketchConstraintCoincidenceId) == 3 -#perform trim +# perform trim SketchTrim = Sketch.addTrim(SketchLine_intersecting, GeomPoint) SketchTrim.execute() model.do() -#check number of features after trim +# check number of features after trim SketchFeatures = featureToCompositeFeature(Sketch.feature()) idList_after = [] @@ -75,33 +81,43 @@ for SubIndex in range(SketchFeatures.numberOfSubs()): SubFeature = SketchFeatures.subFeature(SubIndex) idList_after.append(SubFeature.getKind()) if SubFeature.getKind() == SketchLineId: - LinesList.append(SubFeature) + LinesList.append(SubFeature) -assert(idList_after.count(SketchLineId) == 6) -assert(idList_after.count(SketchConstraintCoincidenceId) == 5) +assert idList_after.count(SketchLineId) == 6 +assert idList_after.count(SketchConstraintCoincidenceId) == 5 -#check lines intersection to the source line +# check lines intersection to the source line SketchLine_intersecting_1 = Sketch.addLine(15, 55, 15, 40) SketchLine_intersecting_2 = Sketch.addLine(40, 55, 40, 40) SketchLine_intersecting_3 = Sketch.addLine(70, 55, 70, 40) SketchLine_intersecting_4 = Sketch.addLine(100, 55, 100, 40) SketchLine_intersecting_5 = Sketch.addLine(125, 55, 125, 40) -Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_1.feature(), LinesList) -Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_2.feature(), LinesList) -Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_3.feature(), LinesList) -Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_4.feature(), LinesList) -Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_5.feature(), LinesList) - -assert(len(Intersection_Points_1) == 1) -assert(len(Intersection_Points_2) == 0) -assert(len(Intersection_Points_3) == 1) -assert(len(Intersection_Points_4) == 1) -assert(len(Intersection_Points_5) == 1) - -#check if line points are the same +Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_1.feature(), LinesList +) +Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_2.feature(), LinesList +) +Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_3.feature(), LinesList +) +Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_4.feature(), LinesList +) +Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape( + SketchLine_intersecting_5.feature(), LinesList +) + +assert len(Intersection_Points_1) == 1 +assert len(Intersection_Points_2) == 0 +assert len(Intersection_Points_3) == 1 +assert len(Intersection_Points_4) == 1 +assert len(Intersection_Points_5) == 1 + +# check if line points are the same model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestTrimLine03.py b/src/SketchPlugin/Test/TestTrimLine03.py index 27196e15a..c78f51feb 100644 --- a/src/SketchPlugin/Test/TestTrimLine03.py +++ b/src/SketchPlugin/Test/TestTrimLine03.py @@ -29,12 +29,20 @@ 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()) +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()) +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()]) +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_2.result(), [SketchLine_1.result(), SketchLine_3.result()] +) [SketchLine_4, SketchLine_5] = SketchConstraintMirror_1.mirrored() model.do() @@ -43,7 +51,7 @@ model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 3) model.testNbSubFeatures(Sketch_1, "SketchConstraintLength", 1) model.testNbSubFeatures(Sketch_1, "SketchConstraintMirror", 1) -#perform trim +# perform trim SketchTrim = Sketch_1.addTrim(SketchLine_1, geom.Pnt2d(-12, -8)) SketchTrim.execute() model.do() @@ -55,4 +63,4 @@ model.testNbSubFeatures(Sketch_1, "SketchConstraintMirror", 0) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/src/SketchPlugin/Test/TestTrimPreview.py b/src/SketchPlugin/Test/TestTrimPreview.py index 3ffa78e4f..c44fafcef 100644 --- a/src/SketchPlugin/Test/TestTrimPreview.py +++ b/src/SketchPlugin/Test/TestTrimPreview.py @@ -23,7 +23,14 @@ 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") + +Config_PropManager().registerProp( + "Visualization", + "operation_remove_feature_color", + "Color of removed feature in operation", + Config_Prop.Color, + "255, 174, 201", +) # base sketch model.begin() @@ -52,7 +59,7 @@ 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) +assert featureToPresentation(aTrim).getAISObject(None) is not None aSession.finishOperation() model.testNbSubFeatures(Sketch, "SketchArc", 0) @@ -71,7 +78,7 @@ 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) +assert featureToPresentation(aTrim).getAISObject(None) is not None aSession.finishOperation() model.testNbSubFeatures(Sketch, "SketchArc", 1) diff --git a/src/SketchPlugin/Test/TestUpdateSketch.py b/src/SketchPlugin/Test/TestUpdateSketch.py index 41f4e09fc..a4a22066a 100644 --- a/src/SketchPlugin/Test/TestUpdateSketch.py +++ b/src/SketchPlugin/Test/TestUpdateSketch.py @@ -25,13 +25,27 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() ParamA = model.addParameter(Part_1_doc, "a", "200") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(19.66215729983772, 107.3479424462301, -0.3378427001622813, 107.3479424462301) -SketchLine_2 = Sketch_1.addLine(-0.3378427001622813, 107.3479424462301, -0.3378427001622813, 467.3479424462301) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(-0.3378427001622813, 467.3479424462301, 49.66215729983772, 467.3479424462301) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(-0.3378427001622813, 307.3479424462301, 29.66215729983772, 307.3479424462301) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_2.result()) +SketchLine_1 = Sketch_1.addLine( + 19.66215729983772, 107.3479424462301, -0.3378427001622813, 107.3479424462301 +) +SketchLine_2 = Sketch_1.addLine( + -0.3378427001622813, 107.3479424462301, -0.3378427001622813, 467.3479424462301 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + -0.3378427001622813, 467.3479424462301, 49.66215729983772, 467.3479424462301 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchLine_4 = Sketch_1.addLine( + -0.3378427001622813, 307.3479424462301, 29.66215729983772, 307.3479424462301 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_4.startPoint(), SketchLine_2.result() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_1.result()) @@ -39,15 +53,35 @@ SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 50) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_4.result(), 30) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_1.result(), 20) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_1.endPoint(), SketchLine_4.startPoint(), "a") -SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchLine_4.startPoint(), SketchLine_2.endPoint(), "a*0.8") +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchLine_1.endPoint(), SketchLine_4.startPoint(), "a" +) +SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance( + SketchLine_4.startPoint(), SketchLine_2.endPoint(), "a*0.8" +) model.do() -Edge_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_1")] +Edge_1_objects = [ + model.selection("EDGE", "Sketch_1/SketchLine_3"), + model.selection("EDGE", "Sketch_1/SketchLine_4"), + model.selection("EDGE", "Sketch_1/SketchLine_1"), +] 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")] -Revolution_1 = model.addRevolution(Part_1_doc, Revolution_1_objects, model.selection("EDGE", "Sketch_1/SketchLine_2"), 360, 0) +Revolution_1_objects = [ + model.selection("EDGE", "Edge_1_1"), + model.selection("EDGE", "Edge_1_2"), + model.selection("EDGE", "Edge_1_3"), +] +Revolution_1 = model.addRevolution( + Part_1_doc, + Revolution_1_objects, + model.selection("EDGE", "Sketch_1/SketchLine_2"), + 360, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_2")) -SketchCircle_1 = Sketch_2.addCircle(-8.007012574805483, 5.997620437244276, 8.148502128958617) +SketchCircle_1 = Sketch_2.addCircle( + -8.007012574805483, 5.997620437244276, 8.148502128958617 +) model.do() # change the height of the second sketch plane ParamA.setValue(50) @@ -55,4 +89,4 @@ model.end() # check that the second sketch result is recomputed: is located in the same plane as base referenceY = Sketch_2.feature().selection("External").value().middlePoint().y() resultY = Sketch_2.feature().results()[0].shape().middlePoint().y() -assert(referenceY == resultY) +assert referenceY == resultY diff --git a/src/SketchPlugin/doc/examples/angle.py b/src/SketchPlugin/doc/examples/angle.py index 5ea8bcbf2..762ba2c4a 100644 --- a/src/SketchPlugin/doc/examples/angle.py +++ b/src/SketchPlugin/doc/examples/angle.py @@ -7,6 +7,8 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(55.1, 13.0, 6.42, 35.5) SketchLine_2 = Sketch_1.addLine(50.2, 22.4, 36.8, 58.8) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_2.result(), SketchLine_1.result(), 45) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_2.result(), SketchLine_1.result(), 45 +) model.do() -model.end() \ No newline at end of file +model.end() diff --git a/src/SketchPlugin/doc/examples/approximation.py b/src/SketchPlugin/doc/examples/approximation.py index f2725583a..28e914150 100644 --- a/src/SketchPlugin/doc/examples/approximation.py +++ b/src/SketchPlugin/doc/examples/approximation.py @@ -17,19 +17,25 @@ SketchPoint_3 = Sketch_1.addPoint(40.08762886597938, 32.27835051546391) SketchPoint_4 = Sketch_1.addPoint(66.46563573883162, -29.8487972508591) ### Create approximating curve -ApproximationPoints = [SketchPoint_1.coordinates(), - SketchPoint_2.coordinates(), - SketchPoint_3.coordinates(), - SketchPoint_4.coordinates()] -SketchBSpline_1 = Sketch_1.addApproximation(ApproximationPoints, precision = 30) +ApproximationPoints = [ + SketchPoint_1.coordinates(), + SketchPoint_2.coordinates(), + SketchPoint_3.coordinates(), + SketchPoint_4.coordinates(), +] +SketchBSpline_1 = Sketch_1.addApproximation(ApproximationPoints, precision=30) Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchBSpline_1.startPoint()) Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchBSpline_1.endPoint()) ### Create periodic approximating curve -SketchBSpline_2 = Sketch_1.addApproximation(ApproximationPoints, precision = 30, periodic = True) +SketchBSpline_2 = Sketch_1.addApproximation( + ApproximationPoints, precision=30, periodic=True +) ### Create closed approximating curve -SketchBSpline_3 = Sketch_1.addApproximation(ApproximationPoints, precision = 30, closed = True) +SketchBSpline_3 = Sketch_1.addApproximation( + ApproximationPoints, precision=30, closed=True +) Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchBSpline_3.startPoint()) Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchBSpline_3.endPoint()) diff --git a/src/SketchPlugin/doc/examples/bspline.py b/src/SketchPlugin/doc/examples/bspline.py index 40f5bb3c2..27147e87b 100644 --- a/src/SketchPlugin/doc/examples/bspline.py +++ b/src/SketchPlugin/doc/examples/bspline.py @@ -5,14 +5,41 @@ partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchBSpline_1_poles = [(-70, -5), (-50, 30), (-40, 3), (-20, 20), (-10, -5)] -SketchBSpline_1 = Sketch_1.addSpline(poles = SketchBSpline_1_poles, weights = [1, 2, 2, 2, 1]) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5] = SketchBSpline_1.controlPoles(auxiliary = [0, 1, 2, 3, 4]) -[SketchLine_1, SketchLine_2, SketchLine_3, SketchLine_4] = SketchBSpline_1.controlPolygon(auxiliary = [0, 1, 2, 3]) +SketchBSpline_1 = Sketch_1.addSpline( + poles=SketchBSpline_1_poles, weights=[1, 2, 2, 2, 1] +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, +] = SketchBSpline_1.controlPoles(auxiliary=[0, 1, 2, 3, 4]) +[ + SketchLine_1, + SketchLine_2, + SketchLine_3, + SketchLine_4, +] = SketchBSpline_1.controlPolygon(auxiliary=[0, 1, 2, 3]) SketchBSplinePeriodic_1_poles = [(10, -5), (30, 30), (40, 3), (60, 20), (70, -5)] -SketchBSplinePeriodic_1 = Sketch_1.addSpline(poles = SketchBSplinePeriodic_1_poles, weights = [3, 2, 1, 1, 1], periodic = True) -[SketchPoint_6, SketchPoint_7, SketchPoint_8, SketchPoint_9, SketchPoint_10] = SketchBSplinePeriodic_1.controlPoles(auxiliary = [0, 1, 2, 3, 4]) -[SketchLine_5, SketchLine_6, SketchLine_7, SketchLine_8, SketchLine_9] = SketchBSplinePeriodic_1.controlPolygon(auxiliary = [0, 1, 2, 3, 4]) +SketchBSplinePeriodic_1 = Sketch_1.addSpline( + poles=SketchBSplinePeriodic_1_poles, weights=[3, 2, 1, 1, 1], periodic=True +) +[ + SketchPoint_6, + SketchPoint_7, + SketchPoint_8, + SketchPoint_9, + SketchPoint_10, +] = SketchBSplinePeriodic_1.controlPoles(auxiliary=[0, 1, 2, 3, 4]) +[ + SketchLine_5, + SketchLine_6, + SketchLine_7, + SketchLine_8, + SketchLine_9, +] = SketchBSplinePeriodic_1.controlPolygon(auxiliary=[0, 1, 2, 3, 4]) model.do() model.end() diff --git a/src/SketchPlugin/doc/examples/coincident.py b/src/SketchPlugin/doc/examples/coincident.py index 74657a80c..e22ae6978 100644 --- a/src/SketchPlugin/doc/examples/coincident.py +++ b/src/SketchPlugin/doc/examples/coincident.py @@ -7,6 +7,8 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(34, 28, 12) SketchLine_1 = Sketch_1.addLine(41, 45, 61, 72) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.results()[1], SketchLine_1.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchCircle_1.results()[1], SketchLine_1.startPoint() +) model.do() model.end() diff --git a/src/SketchPlugin/doc/examples/collinear.py b/src/SketchPlugin/doc/examples/collinear.py index 82b94e46e..b30c2761a 100644 --- a/src/SketchPlugin/doc/examples/collinear.py +++ b/src/SketchPlugin/doc/examples/collinear.py @@ -7,6 +7,8 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(6, 25, 20, 40) SketchLine_2 = Sketch_1.addLine(44, 26, 80, 61) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_1.result(), SketchLine_2.result()) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_1.result(), SketchLine_2.result() +) model.do() model.end() diff --git a/src/SketchPlugin/doc/examples/distance.py b/src/SketchPlugin/doc/examples/distance.py index 5664309c9..971aafe3a 100644 --- a/src/SketchPlugin/doc/examples/distance.py +++ b/src/SketchPlugin/doc/examples/distance.py @@ -7,6 +7,8 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(24.1, 24.5, 18.2) SketchLine_1 = Sketch_1.addLine(54.3, 93.4, 91.2, 56.4) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_1.result(), 70.0, True) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_1.center(), SketchLine_1.result(), 70.0, True +) model.do() -model.end() \ No newline at end of file +model.end() diff --git a/src/SketchPlugin/doc/examples/elliptic_arc.py b/src/SketchPlugin/doc/examples/elliptic_arc.py index 31891b404..4528f0d73 100644 --- a/src/SketchPlugin/doc/examples/elliptic_arc.py +++ b/src/SketchPlugin/doc/examples/elliptic_arc.py @@ -3,7 +3,37 @@ from salome.shaper import model model.begin() partSet = model.moduleDocument() Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) -SketchEllipticArc_1 = Sketch_1.addEllipticArc(-130.9349397590362, 14.84578313253013, -130.1669839639096, 36.73252329363673, -113.8987951807229, 13.87228915662651, -144.7734498958671, 30.30133508641346, False) -[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") +SketchEllipticArc_1 = Sketch_1.addEllipticArc( + -130.9349397590362, + 14.84578313253013, + -130.1669839639096, + 36.73252329363673, + -113.8987951807229, + 13.87228915662651, + -144.7734498958671, + 30.30133508641346, + False, +) +[ + SketchPoint_1, + SketchPoint_2, + SketchPoint_3, + SketchPoint_4, + SketchPoint_5, + SketchPoint_6, + SketchPoint_7, + SketchLine_1, + SketchLine_2, +] = SketchEllipticArc_1.construction( + center="aux", + firstFocus="aux", + secondFocus="aux", + majorAxisStart="aux", + majorAxisEnd="aux", + minorAxisStart="aux", + minorAxisEnd="aux", + majorAxis="aux", + minorAxis="aux", +) model.do() model.end() diff --git a/src/SketchPlugin/doc/examples/equal.py b/src/SketchPlugin/doc/examples/equal.py index 983b93f8f..74a2013f8 100644 --- a/src/SketchPlugin/doc/examples/equal.py +++ b/src/SketchPlugin/doc/examples/equal.py @@ -7,6 +7,8 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(27, 25, 5) SketchArc_1 = Sketch_1.addArc(55.58, 56.8, 70.53, 54.47, 65.76, 67.99, True) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchArc_1.results()[1]) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchCircle_1.results()[1], SketchArc_1.results()[1] +) model.do() model.end() diff --git a/src/SketchPlugin/doc/examples/fillet.py b/src/SketchPlugin/doc/examples/fillet.py index aec0485c1..cc1d3fe88 100644 --- a/src/SketchPlugin/doc/examples/fillet.py +++ b/src/SketchPlugin/doc/examples/fillet.py @@ -7,7 +7,9 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(7, 46, 63, 20) SketchLine_2 = Sketch_1.addLine(63, 20, 55, 85) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) Fillet_1 = Sketch_1.setFillet(SketchLine_1.endPoint()) model.do() model.end() diff --git a/src/SketchPlugin/doc/examples/fixed.py b/src/SketchPlugin/doc/examples/fixed.py index e20f6a5f2..295976bcc 100644 --- a/src/SketchPlugin/doc/examples/fixed.py +++ b/src/SketchPlugin/doc/examples/fixed.py @@ -8,4 +8,4 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(38.7, 43.3, 29.29) SketchConstraintRigid_1 = Sketch_1.setFixed(SketchCircle_1.results()[1]) model.do() -model.end() \ No newline at end of file +model.end() diff --git a/src/SketchPlugin/doc/examples/hdistance.py b/src/SketchPlugin/doc/examples/hdistance.py index 84051a11b..32db05941 100644 --- a/src/SketchPlugin/doc/examples/hdistance.py +++ b/src/SketchPlugin/doc/examples/hdistance.py @@ -7,6 +7,8 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(24.1, 24.5, 18.2) SketchLine_1 = Sketch_1.addLine(54.3, 93.4, 91.2, 56.4) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchCircle_1.center(), SketchLine_1.startPoint(), 30) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchCircle_1.center(), SketchLine_1.startPoint(), 30 +) model.do() -model.end() \ No newline at end of file +model.end() diff --git a/src/SketchPlugin/doc/examples/horizontal.py b/src/SketchPlugin/doc/examples/horizontal.py index 1da05c065..018f9ab40 100644 --- a/src/SketchPlugin/doc/examples/horizontal.py +++ b/src/SketchPlugin/doc/examples/horizontal.py @@ -8,4 +8,4 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(14.5, 16.0, 71.0, 62.0) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) model.do() -model.end() \ No newline at end of file +model.end() diff --git a/src/SketchPlugin/doc/examples/interpolation.py b/src/SketchPlugin/doc/examples/interpolation.py index fc32ac4be..e07b64a9e 100644 --- a/src/SketchPlugin/doc/examples/interpolation.py +++ b/src/SketchPlugin/doc/examples/interpolation.py @@ -17,10 +17,12 @@ SketchPoint_3 = Sketch_1.addPoint(40.08762886597938, 32.27835051546391) SketchPoint_4 = Sketch_1.addPoint(66.46563573883162, -29.8487972508591) ### Create interpolation curve -InterpolationPoints = [SketchPoint_1.coordinates(), - SketchPoint_2.coordinates(), - SketchPoint_3.coordinates(), - SketchPoint_4.coordinates()] +InterpolationPoints = [ + SketchPoint_1.coordinates(), + SketchPoint_2.coordinates(), + SketchPoint_3.coordinates(), + SketchPoint_4.coordinates(), +] SketchBSpline_1 = Sketch_1.addInterpolation(InterpolationPoints) Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchBSpline_1.startPoint()) Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchBSpline_1.result()) @@ -28,14 +30,14 @@ Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchBSpline_1.result()) Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchBSpline_1.endPoint()) ### Create periodic interpolation curve -SketchBSpline_2 = Sketch_1.addInterpolation(InterpolationPoints, periodic = True) +SketchBSpline_2 = Sketch_1.addInterpolation(InterpolationPoints, periodic=True) Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchBSpline_2.result()) Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchBSpline_2.result()) Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchBSpline_2.result()) Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchBSpline_2.result()) ### Create closed interpolation curve -SketchBSpline_3 = Sketch_1.addInterpolation(InterpolationPoints, closed = True) +SketchBSpline_3 = Sketch_1.addInterpolation(InterpolationPoints, closed=True) Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchBSpline_3.startPoint()) Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchBSpline_3.result()) Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchBSpline_3.result()) diff --git a/src/SketchPlugin/doc/examples/intersection.py b/src/SketchPlugin/doc/examples/intersection.py index 70b63633a..242aa104d 100644 --- a/src/SketchPlugin/doc/examples/intersection.py +++ b/src/SketchPlugin/doc/examples/intersection.py @@ -7,10 +7,16 @@ Part_1_doc = Part_1.document() Point_2 = model.addPoint(Part_1_doc, 10, 10, -10) Point_3 = model.addPoint(Part_1_doc, 70, 70, 50) -Polyline_1 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")], False) +Polyline_1 = model.addPolyline3D( + Part_1_doc, + [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")], + False, +) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchIntersectionPoint_1 = Sketch_1.addIntersectionPoint(model.selection("EDGE", "Polyline_1_1/Edge_1"), True) +SketchIntersectionPoint_1 = Sketch_1.addIntersectionPoint( + model.selection("EDGE", "Polyline_1_1/Edge_1"), True +) model.do() model.end() diff --git a/src/SketchPlugin/doc/examples/length.py b/src/SketchPlugin/doc/examples/length.py index fe28cf282..5d50d8167 100644 --- a/src/SketchPlugin/doc/examples/length.py +++ b/src/SketchPlugin/doc/examples/length.py @@ -9,4 +9,4 @@ SketchLine_1 = Sketch_1.addLine(14.6, 14.2, 59.4, 61.9) SketchLine_1.result().setColor(225, 0, 0) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 65.5) model.do() -model.end() \ No newline at end of file +model.end() diff --git a/src/SketchPlugin/doc/examples/middle.py b/src/SketchPlugin/doc/examples/middle.py index b37468fc1..f1c267289 100644 --- a/src/SketchPlugin/doc/examples/middle.py +++ b/src/SketchPlugin/doc/examples/middle.py @@ -7,7 +7,9 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(16, 54, 10) SketchLine_1 = Sketch_1.addLine(10, 10, 80, 80) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchCircle_1.center(), SketchLine_1.result()) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchCircle_1.center(), SketchLine_1.result() +) SketchLine_2 = Sketch_1.addLine(20, 10, 90, 80) SketchPoint_01 = Sketch_1.setMiddlePoint(SketchLine_2.result()) diff --git a/src/SketchPlugin/doc/examples/mirror.py b/src/SketchPlugin/doc/examples/mirror.py index 50b9cf403..38fb44490 100644 --- a/src/SketchPlugin/doc/examples/mirror.py +++ b/src/SketchPlugin/doc/examples/mirror.py @@ -9,7 +9,9 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(25, 25, 11) SketchLine_1 = Sketch_1.addLine(9, 78, 78, 9) -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_1.result(), [SketchCircle_1.results()[1]]) +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_1.result(), [SketchCircle_1.results()[1]] +) model.do() -model.end() \ No newline at end of file +model.end() diff --git a/src/SketchPlugin/doc/examples/offset.py b/src/SketchPlugin/doc/examples/offset.py index 79e8ae9e1..a661b13e9 100644 --- a/src/SketchPlugin/doc/examples/offset.py +++ b/src/SketchPlugin/doc/examples/offset.py @@ -15,7 +15,12 @@ Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.endPoint()) Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.startPoint()) -SketchOffset_1_objects = [SketchLine_1.result(), SketchLine_2.result(), SketchLine_3.result(), SketchLine_4.result()] +SketchOffset_1_objects = [ + SketchLine_1.result(), + SketchLine_2.result(), + SketchLine_3.result(), + SketchLine_4.result(), +] ### KeepDistance (default) mode, not reversed (outside) SketchOffset_1 = Sketch_1.addOffset(SketchOffset_1_objects, 10.0, False) diff --git a/src/SketchPlugin/doc/examples/parallel.py b/src/SketchPlugin/doc/examples/parallel.py index efa704ce3..4b029e6f7 100644 --- a/src/SketchPlugin/doc/examples/parallel.py +++ b/src/SketchPlugin/doc/examples/parallel.py @@ -7,6 +7,8 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(13, 58, 69, 75) SketchLine_2 = Sketch_1.addLine(12, 38, 73, 23) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_1.result(), SketchLine_2.result()) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_1.result(), SketchLine_2.result() +) model.do() -model.end() \ No newline at end of file +model.end() diff --git a/src/SketchPlugin/doc/examples/perpendicular.py b/src/SketchPlugin/doc/examples/perpendicular.py index f2abc71d2..fc56d6fc5 100644 --- a/src/SketchPlugin/doc/examples/perpendicular.py +++ b/src/SketchPlugin/doc/examples/perpendicular.py @@ -7,6 +7,8 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(13, 58, 69, 75) SketchLine_2 = Sketch_1.addLine(12, 38, 73, 23) -SketchConstraintParallel_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_2.result()) +SketchConstraintParallel_1 = Sketch_1.setPerpendicular( + SketchLine_1.result(), SketchLine_2.result() +) model.do() -model.end() \ No newline at end of file +model.end() diff --git a/src/SketchPlugin/doc/examples/point.py b/src/SketchPlugin/doc/examples/point.py index bd4289dc8..32a506112 100644 --- a/src/SketchPlugin/doc/examples/point.py +++ b/src/SketchPlugin/doc/examples/point.py @@ -7,4 +7,4 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(42.6, 19.0) model.do() -model.end() \ No newline at end of file +model.end() diff --git a/src/SketchPlugin/doc/examples/projection.py b/src/SketchPlugin/doc/examples/projection.py index 7913d1714..3da79122f 100644 --- a/src/SketchPlugin/doc/examples/projection.py +++ b/src/SketchPlugin/doc/examples/projection.py @@ -7,10 +7,16 @@ Part_1_doc = Part_1.document() Point_2 = model.addPoint(Part_1_doc, 10, 10, -10) Point_3 = model.addPoint(Part_1_doc, 70, 70, 50) -Polyline_1 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")], False) +Polyline_1 = model.addPolyline3D( + Part_1_doc, + [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")], + False, +) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchIntersectionPoint_1 = Sketch_1.addProjection(model.selection("EDGE", "Polyline_1_1/Edge_1"), True) +SketchIntersectionPoint_1 = Sketch_1.addProjection( + model.selection("EDGE", "Polyline_1_1/Edge_1"), True +) model.do() model.end() diff --git a/src/SketchPlugin/doc/examples/radius.py b/src/SketchPlugin/doc/examples/radius.py index ac25943e7..bf41c19a7 100644 --- a/src/SketchPlugin/doc/examples/radius.py +++ b/src/SketchPlugin/doc/examples/radius.py @@ -8,4 +8,4 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(35, 50, 25) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 25) model.do() -model.end() \ No newline at end of file +model.end() diff --git a/src/SketchPlugin/doc/examples/rotation.py b/src/SketchPlugin/doc/examples/rotation.py index ac4a49549..2072b6f57 100644 --- a/src/SketchPlugin/doc/examples/rotation.py +++ b/src/SketchPlugin/doc/examples/rotation.py @@ -9,7 +9,9 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchPoint_1 = Sketch_1.addPoint(45, 45) SketchCircle_1 = Sketch_1.addCircle(35, 25, 8) -SketchMultiRotation_1 = Sketch_1.addRotation([SketchCircle_1.results()[1]], SketchPoint_1.coordinates(), 270, 4, True) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchCircle_1.results()[1]], SketchPoint_1.coordinates(), 270, 4, True +) [SketchCircle_2, SketchCircle_3, SketchCircle_4] = SketchMultiRotation_1.rotated() model.do() diff --git a/src/SketchPlugin/doc/examples/sketchcopy.py b/src/SketchPlugin/doc/examples/sketchcopy.py index 99eb1881c..28eff0e3e 100644 --- a/src/SketchPlugin/doc/examples/sketchcopy.py +++ b/src/SketchPlugin/doc/examples/sketchcopy.py @@ -7,10 +7,18 @@ SketchLine_1 = Sketch_1.addLine(50, 0, 0, 0) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 50) SketchLine_3 = Sketch_1.addLine(0, 50, 50, 50) SketchLine_4 = Sketch_1.addLine(50, 50, 50, 0) -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()) +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()) @@ -19,4 +27,4 @@ model.do() Sketch_1_Copy = model.copySketch(partSet, Sketch_1) -model.end() \ No newline at end of file +model.end() diff --git a/src/SketchPlugin/doc/examples/split.py b/src/SketchPlugin/doc/examples/split.py index 2b8fbfffb..67e46d378 100644 --- a/src/SketchPlugin/doc/examples/split.py +++ b/src/SketchPlugin/doc/examples/split.py @@ -10,11 +10,17 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(44, 44, 29) SketchPoint_1 = Sketch_1.addPoint(15, 44) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchCircle_1.results()[1] +) SketchPoint_2 = Sketch_1.addPoint(44, 73) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchCircle_1.results()[1] +) SketchPoint_3 = Sketch_1.addPoint(64, 23) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchPoint_3.coordinates(), SketchCircle_1.results()[1] +) GeomPoint = geom.Pnt2d(22, 65) Sketch_1.addSplit(SketchCircle_1, GeomPoint) diff --git a/src/SketchPlugin/doc/examples/tangent.py b/src/SketchPlugin/doc/examples/tangent.py index e590924ce..b1b25d924 100644 --- a/src/SketchPlugin/doc/examples/tangent.py +++ b/src/SketchPlugin/doc/examples/tangent.py @@ -7,6 +7,8 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(30, 30, 15) SketchLine_1 = Sketch_1.addLine(10, 80, 80, 27) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchCircle_1.results()[1], SketchLine_1.result()) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchCircle_1.results()[1], SketchLine_1.result() +) model.do() model.end() diff --git a/src/SketchPlugin/doc/examples/translation.py b/src/SketchPlugin/doc/examples/translation.py index 30d614953..8b30e77eb 100644 --- a/src/SketchPlugin/doc/examples/translation.py +++ b/src/SketchPlugin/doc/examples/translation.py @@ -10,8 +10,13 @@ SketchCircle_1 = Sketch_1.addCircle(12, 12, 6.5) SketchPoint_1 = Sketch_1.addPoint(13, 50) SketchPoint_2 = Sketch_1.addPoint(30, 70) -SketchMultiTranslation_1 = Sketch_1.addTranslation([SketchCircle_1.results()[1]], SketchPoint_1.coordinates(), SketchPoint_2.coordinates(), 4) +SketchMultiTranslation_1 = Sketch_1.addTranslation( + [SketchCircle_1.results()[1]], + SketchPoint_1.coordinates(), + SketchPoint_2.coordinates(), + 4, +) [SketchCircle_2, SketchCircle_3, SketchCircle_4] = SketchMultiTranslation_1.translated() model.do() -model.end() \ No newline at end of file +model.end() diff --git a/src/SketchPlugin/doc/examples/trim.py b/src/SketchPlugin/doc/examples/trim.py index c73cdbac3..f7b77b29a 100644 --- a/src/SketchPlugin/doc/examples/trim.py +++ b/src/SketchPlugin/doc/examples/trim.py @@ -10,7 +10,9 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(40, 45, 30) SketchPoint_1 = Sketch_1.addPoint(20, 70) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchCircle_1.results()[1] +) SketchLine_1 = Sketch_1.addLine(17, 7, 80, 70) diff --git a/src/SketchPlugin/doc/examples/vdistance.py b/src/SketchPlugin/doc/examples/vdistance.py index 5301ac374..5d946e8d7 100644 --- a/src/SketchPlugin/doc/examples/vdistance.py +++ b/src/SketchPlugin/doc/examples/vdistance.py @@ -7,6 +7,8 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(24.1, 24.5, 18.2) SketchLine_1 = Sketch_1.addLine(62.3, 85.1, 91.2, 56.4) -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchCircle_1.center(), SketchLine_1.startPoint(), 75.5) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchCircle_1.center(), SketchLine_1.startPoint(), 75.5 +) model.do() -model.end() \ No newline at end of file +model.end() diff --git a/src/SketchPlugin/doc/examples/vertical.py b/src/SketchPlugin/doc/examples/vertical.py index 9ea44674b..f3a81499c 100644 --- a/src/SketchPlugin/doc/examples/vertical.py +++ b/src/SketchPlugin/doc/examples/vertical.py @@ -8,4 +8,4 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(15.5, 14.5, 71.0, 62.8) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) model.do() -model.end() \ No newline at end of file +model.end() diff --git a/test.API/SHAPER/GDML/TestAPI_ConeSegment.py b/test.API/SHAPER/GDML/TestAPI_ConeSegment.py index 9d7969226..7e94f0632 100644 --- a/test.API/SHAPER/GDML/TestAPI_ConeSegment.py +++ b/test.API/SHAPER/GDML/TestAPI_ConeSegment.py @@ -21,50 +21,50 @@ from GeomAlgoAPI import GeomAlgoAPI_ShapeAPI as shaperpy from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept from GeomAPI import GeomAPI_Pnt as pnt -CS1 = shaperpy.makeConeSegment(7.,11.,5.,8.,12.,0.,270.) -CS2 = shaperpy.makeConeSegment(5.,10.,7.,15.,15.,45.,180.) -CS3 = shaperpy.makeConeSegment(5.,10.,7.,15.,15.,-45.,180.) -CS4 = shaperpy.makeConeSegment(0.,10.,2.,7.,3.,0.,270.) -CS5 = shaperpy.makeConeSegment(5.,8.,0.,6.,10.,45.,270.) -CS6 = shaperpy.makeConeSegment(0.,6.,0.,4.,17.,0.,270.) -CS7 = shaperpy.makeConeSegment(7.,11.,5.,8.,12.,0.,360.) +CS1 = shaperpy.makeConeSegment(7.0, 11.0, 5.0, 8.0, 12.0, 0.0, 270.0) +CS2 = shaperpy.makeConeSegment(5.0, 10.0, 7.0, 15.0, 15.0, 45.0, 180.0) +CS3 = shaperpy.makeConeSegment(5.0, 10.0, 7.0, 15.0, 15.0, -45.0, 180.0) +CS4 = shaperpy.makeConeSegment(0.0, 10.0, 2.0, 7.0, 3.0, 0.0, 270.0) +CS5 = shaperpy.makeConeSegment(5.0, 8.0, 0.0, 6.0, 10.0, 45.0, 270.0) +CS6 = shaperpy.makeConeSegment(0.0, 6.0, 0.0, 4.0, 17.0, 0.0, 270.0) +CS7 = shaperpy.makeConeSegment(7.0, 11.0, 5.0, 8.0, 12.0, 0.0, 360.0) -try : - CS8 = shaperpy.makeConeSegment(-5.,11.,5.,8.,12.,0.,270.) +try: + CS8 = shaperpy.makeConeSegment(-5.0, 11.0, 5.0, 8.0, 12.0, 0.0, 270.0) except myExcept as ec: - assert(ec.what() == "Cone Segment builder :: rmin1 is negative.") + assert ec.what() == "Cone Segment builder :: rmin1 is negative." -try : - CS9 = shaperpy.makeConeSegment(11.,7.,5.,8.,12.,0.,270.) +try: + CS9 = shaperpy.makeConeSegment(11.0, 7.0, 5.0, 8.0, 12.0, 0.0, 270.0) except myExcept as ec: - assert(ec.what() == "Cone Segment builder :: rmin1 is larger than rmax1.") + assert ec.what() == "Cone Segment builder :: rmin1 is larger than rmax1." -try : - CS10 = shaperpy.makeConeSegment(7.,11.,8.,5.,12.,0.,270.) +try: + CS10 = shaperpy.makeConeSegment(7.0, 11.0, 8.0, 5.0, 12.0, 0.0, 270.0) except myExcept as ec: - assert(ec.what() == "Cone Segment builder :: rmin2 is larger than rmax2.") + assert ec.what() == "Cone Segment builder :: rmin2 is larger than rmax2." -try : - CS11 = shaperpy.makeConeSegment(7.,11.,-3.,5.,12.,0.,270.) +try: + CS11 = shaperpy.makeConeSegment(7.0, 11.0, -3.0, 5.0, 12.0, 0.0, 270.0) except myExcept as ec: - assert(ec.what() == "Cone Segment builder :: rmin2 is negative.") + assert ec.what() == "Cone Segment builder :: rmin2 is negative." -try : - CS12 = shaperpy.makeConeSegment(7.,11.,5.,8.,0.,0.,270.) +try: + CS12 = shaperpy.makeConeSegment(7.0, 11.0, 5.0, 8.0, 0.0, 0.0, 270.0) except myExcept as ec: - assert(ec.what() == "Cone Segment builder :: z is negative or null.") + assert ec.what() == "Cone Segment builder :: z is negative or null." -try : - CS13 = shaperpy.makeConeSegment(7.,11.,5.,8.,-10.,0.,270.) +try: + CS13 = shaperpy.makeConeSegment(7.0, 11.0, 5.0, 8.0, -10.0, 0.0, 270.0) except myExcept as ec: - assert(ec.what() == "Cone Segment builder :: z is negative or null.") + assert ec.what() == "Cone Segment builder :: z is negative or null." -try : - CS14 = shaperpy.makeConeSegment(7.,11.,5.,8.,12.,-45.,-45.) +try: + CS14 = shaperpy.makeConeSegment(7.0, 11.0, 5.0, 8.0, 12.0, -45.0, -45.0) except myExcept as ec: - assert(ec.what() == "Cone Segment builder :: deltaphi is negative or null.") + assert ec.what() == "Cone Segment builder :: deltaphi is negative or null." -try : - CS15 = shaperpy.makeConeSegment(7.,11.,5.,8.,12.,45.,450.) +try: + CS15 = shaperpy.makeConeSegment(7.0, 11.0, 5.0, 8.0, 12.0, 45.0, 450.0) except myExcept as ec: - assert(ec.what() == "Cone Segment builder :: deltaphi is larger than 360 degree.") \ No newline at end of file + assert ec.what() == "Cone Segment builder :: deltaphi is larger than 360 degree." diff --git a/test.API/SHAPER/GDML/TestConeSegment.py b/test.API/SHAPER/GDML/TestConeSegment.py index 6aff0f79a..d4a3114b2 100644 --- a/test.API/SHAPER/GDML/TestConeSegment.py +++ b/test.API/SHAPER/GDML/TestConeSegment.py @@ -37,22 +37,24 @@ model.addParameter(Part_1_doc, "z", "12") model.addParameter(Part_1_doc, "startphi", "0") model.addParameter(Part_1_doc, "deltaphi", "270") -CS1 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, 12, 0 , 270) -CS2 = model.addConeSegment(Part_1_doc, 5, 10, 7, 15, 15, 45 , 180) -CS3 = model.addConeSegment(Part_1_doc, 5, 10, 7, 15, 15, -45 , 180) -CS4 = model.addConeSegment(Part_1_doc, 0, 10, 2, 7, 3, 0 , 270) -CS5 = model.addConeSegment(Part_1_doc, 5, 8, 0, 6, 10, 45 , 270) -CS6 = model.addConeSegment(Part_1_doc, 0, 6, 0, 4, 17, 0 , 270) -CS7 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, 12, 0 , 360) -CS8 = model.addConeSegment(Part_1_doc, -5, 11, 5, 8, 12, 0 , 270) -CS9 = model.addConeSegment(Part_1_doc, 11, 7, 5, 8, 12, 0 , 270) -CS10 = model.addConeSegment(Part_1_doc, 7, 11, 8, 5, 12, 0 , 270) -CS11 = model.addConeSegment(Part_1_doc, 7, 11, -3, 5, 12, 0 , 270) -CS12 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, 0, 0 , 270) -CS13 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, -10, 0 , 270) -CS14 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, 12, -45 , -45) -CS15 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, 12, 45 , 450) -CS16 = model.addConeSegment(Part_1_doc, "rmin1", "rmax1", "rmin2", "rmax2", "z", "startphi" , "deltaphi") +CS1 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, 12, 0, 270) +CS2 = model.addConeSegment(Part_1_doc, 5, 10, 7, 15, 15, 45, 180) +CS3 = model.addConeSegment(Part_1_doc, 5, 10, 7, 15, 15, -45, 180) +CS4 = model.addConeSegment(Part_1_doc, 0, 10, 2, 7, 3, 0, 270) +CS5 = model.addConeSegment(Part_1_doc, 5, 8, 0, 6, 10, 45, 270) +CS6 = model.addConeSegment(Part_1_doc, 0, 6, 0, 4, 17, 0, 270) +CS7 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, 12, 0, 360) +CS8 = model.addConeSegment(Part_1_doc, -5, 11, 5, 8, 12, 0, 270) +CS9 = model.addConeSegment(Part_1_doc, 11, 7, 5, 8, 12, 0, 270) +CS10 = model.addConeSegment(Part_1_doc, 7, 11, 8, 5, 12, 0, 270) +CS11 = model.addConeSegment(Part_1_doc, 7, 11, -3, 5, 12, 0, 270) +CS12 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, 0, 0, 270) +CS13 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, -10, 0, 270) +CS14 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, 12, -45, -45) +CS15 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, 12, 45, 450) +CS16 = model.addConeSegment( + Part_1_doc, "rmin1", "rmax1", "rmin2", "rmax2", "z", "startphi", "deltaphi" +) model.do() model.end() @@ -108,25 +110,28 @@ model.testNbSubShapes(CS16, GeomAPI_Shape.FACE, [6]) model.testHaveNamingFaces(CS16, model, Part_1_doc) model.testNbResults(CS8, 0) -assert(CS8.feature().error() == "Cone Segment builder :: rmin1 is negative.") +assert CS8.feature().error() == "Cone Segment builder :: rmin1 is negative." model.testNbResults(CS9, 0) -assert(CS9.feature().error() == "Cone Segment builder :: rmin1 is larger than rmax1.") +assert CS9.feature().error() == "Cone Segment builder :: rmin1 is larger than rmax1." model.testNbResults(CS10, 0) -assert(CS10.feature().error() == "Cone Segment builder :: rmin2 is larger than rmax2.") +assert CS10.feature().error() == "Cone Segment builder :: rmin2 is larger than rmax2." model.testNbResults(CS11, 0) -assert(CS11.feature().error() == "Cone Segment builder :: rmin2 is negative.") +assert CS11.feature().error() == "Cone Segment builder :: rmin2 is negative." model.testNbResults(CS12, 0) -assert(CS12.feature().error() == "Cone Segment builder :: z is negative or null.") +assert CS12.feature().error() == "Cone Segment builder :: z is negative or null." model.testNbResults(CS13, 0) -assert(CS13.feature().error() == "Cone Segment builder :: z is negative or null.") +assert CS13.feature().error() == "Cone Segment builder :: z is negative or null." model.testNbResults(CS14, 0) -assert(CS14.feature().error() == "Cone Segment builder :: deltaphi is negative or null.") +assert CS14.feature().error() == "Cone Segment builder :: deltaphi is negative or null." model.testNbResults(CS15, 0) -assert(CS15.feature().error() == "Cone Segment builder :: deltaphi is larger than 360 degree.") \ No newline at end of file +assert ( + CS15.feature().error() + == "Cone Segment builder :: deltaphi is larger than 360 degree." +) diff --git a/test.API/SHAPER/Primitives/TestAPI_Box.py b/test.API/SHAPER/Primitives/TestAPI_Box.py index dde3dae85..aa3103d9e 100644 --- a/test.API/SHAPER/Primitives/TestAPI_Box.py +++ b/test.API/SHAPER/Primitives/TestAPI_Box.py @@ -22,72 +22,84 @@ from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept from GeomAPI import GeomAPI_Pnt as pnt # Create a box with dimensions -Box_1 = shaperpy.makeBox(10.,10.,10.) +Box_1 = shaperpy.makeBox(10.0, 10.0, 10.0) -try : - Box_2 = shaperpy.makeBox(0.,10.,10.) +try: + Box_2 = shaperpy.makeBox(0.0, 10.0, 10.0) except myExcept as ec: - assert(ec.what() == "Box builder with dimensions :: Dx is null or negative.") + assert ec.what() == "Box builder with dimensions :: Dx is null or negative." -try : - Box_3 = shaperpy.makeBox(10.,0.,10.) +try: + Box_3 = shaperpy.makeBox(10.0, 0.0, 10.0) except myExcept as ec: - assert(ec.what() == "Box builder with dimensions :: Dy is null or negative.") + assert ec.what() == "Box builder with dimensions :: Dy is null or negative." -try : - Box_4 = shaperpy.makeBox(10.,10.,0.) +try: + Box_4 = shaperpy.makeBox(10.0, 10.0, 0.0) except myExcept as ec: - assert(ec.what() == "Box builder with dimensions :: Dz is null or negative.") + assert ec.what() == "Box builder with dimensions :: Dz is null or negative." -try : - Box_5 = shaperpy.makeBox(-10.,10.,10.) +try: + Box_5 = shaperpy.makeBox(-10.0, 10.0, 10.0) except myExcept as ec: - assert(ec.what() == "Box builder with dimensions :: Dx is null or negative.") + assert ec.what() == "Box builder with dimensions :: Dx is null or negative." -try : - Box_6 = shaperpy.makeBox(10.,-10.,10.) +try: + Box_6 = shaperpy.makeBox(10.0, -10.0, 10.0) except myExcept as ec: - assert(ec.what() == "Box builder with dimensions :: Dy is null or negative.") + assert ec.what() == "Box builder with dimensions :: Dy is null or negative." -try : - Box_7 = shaperpy.makeBox(10.,10.,-10.) +try: + Box_7 = shaperpy.makeBox(10.0, 10.0, -10.0) except myExcept as ec: - assert(ec.what() == "Box builder with dimensions :: Dz is null or negative.") + assert ec.what() == "Box builder with dimensions :: Dz is null or negative." # Create a box with two points defining the diagonal -pnt1 = pnt(0.,0.,0.) -pnt2 = pnt(50.,50.,50.) -Box_8 = shaperpy.makeBox(pnt1,pnt2) +pnt1 = pnt(0.0, 0.0, 0.0) +pnt2 = pnt(50.0, 50.0, 50.0) +Box_8 = shaperpy.makeBox(pnt1, pnt2) -try : - Box_9 = shaperpy.makeBox(pnt1,pnt1) +try: + Box_9 = shaperpy.makeBox(pnt1, pnt1) except myExcept as ec: - assert(ec.what() == "Box builder with two points :: the distance between the two points is null.") + assert ( + ec.what() + == "Box builder with two points :: the distance between the two points is null." + ) -try : - pnt3 = pnt(0.,50.,50.) - Box_10 = shaperpy.makeBox(pnt1,pnt3) +try: + pnt3 = pnt(0.0, 50.0, 50.0) + Box_10 = shaperpy.makeBox(pnt1, pnt3) except myExcept as ec: - assert(ec.what() == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes.") + assert ( + ec.what() + == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes." + ) -try : - pnt4 = pnt(50.,0.,50.) - Box_11 = shaperpy.makeBox(pnt1,pnt4) +try: + pnt4 = pnt(50.0, 0.0, 50.0) + Box_11 = shaperpy.makeBox(pnt1, pnt4) except myExcept as ec: - assert(ec.what() == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes.") + assert ( + ec.what() + == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes." + ) -try : - pnt5 = pnt(50.,50.,0.) - Box_12 = shaperpy.makeBox(pnt1,pnt5) +try: + pnt5 = pnt(50.0, 50.0, 0.0) + Box_12 = shaperpy.makeBox(pnt1, pnt5) except myExcept as ec: - assert(ec.what() == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes.") + assert ( + ec.what() + == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes." + ) -try : - Box_13 = shaperpy.makeBox(None, pnt2) +try: + Box_13 = shaperpy.makeBox(None, pnt2) except myExcept as ec: - assert(ec.what() == "Box builder with two points :: the first point is not valid.") + assert ec.what() == "Box builder with two points :: the first point is not valid." -try : - Box_14 = shaperpy.makeBox(pnt2, None) +try: + Box_14 = shaperpy.makeBox(pnt2, None) except myExcept as ec: - assert(ec.what() == "Box builder with two points :: the second point is not valid.") + assert ec.what() == "Box builder with two points :: the second point is not valid." diff --git a/test.API/SHAPER/Primitives/TestAPI_Cone.py b/test.API/SHAPER/Primitives/TestAPI_Cone.py index 753099289..dcf5acbfd 100644 --- a/test.API/SHAPER/Primitives/TestAPI_Cone.py +++ b/test.API/SHAPER/Primitives/TestAPI_Cone.py @@ -25,40 +25,40 @@ from GeomAPI import GeomAPI_Ax1 as axis from GeomAPI import GeomAPI_Dir as direction # Points -pnt1 = pnt(0., 0., 0.) -pnt2 = pnt(10., 10., 10.) +pnt1 = pnt(0.0, 0.0, 0.0) +pnt2 = pnt(10.0, 10.0, 10.0) # Axis -yDir = direction(0.,10.,0.) +yDir = direction(0.0, 10.0, 0.0) ax1 = axis(pnt1, yDir) # Edges edgaxis = edgeBuilder.line(ax1.dir().x(), ax1.dir().y(), ax1.dir().z()) -Cone_1 = shaperpy.makeCone(5., 10., 10.) -Cone_2 = shaperpy.makeCone(0., 10., 10.) -Cone_3 = shaperpy.makeCone(5., 0., 10.) +Cone_1 = shaperpy.makeCone(5.0, 10.0, 10.0) +Cone_2 = shaperpy.makeCone(0.0, 10.0, 10.0) +Cone_3 = shaperpy.makeCone(5.0, 0.0, 10.0) try: - Cone_4 = shaperpy.makeCone(5., 10., 0.) + Cone_4 = shaperpy.makeCone(5.0, 10.0, 0.0) except myExcept as ec: - assert(ec.what() == "Cone builder :: height is negative or null.") + assert ec.what() == "Cone builder :: height is negative or null." -Cone_5 = shaperpy.makeCone(pnt2, edgaxis, 5., 10., 10.) -Cone_6 = shaperpy.makeCone(pnt2, edgaxis, 0., 10., 10.) -Cone_7 = shaperpy.makeCone(pnt2, edgaxis, 5., 0., 10.) +Cone_5 = shaperpy.makeCone(pnt2, edgaxis, 5.0, 10.0, 10.0) +Cone_6 = shaperpy.makeCone(pnt2, edgaxis, 0.0, 10.0, 10.0) +Cone_7 = shaperpy.makeCone(pnt2, edgaxis, 5.0, 0.0, 10.0) try: - Cone_8 = shaperpy.makeCone(None, edgaxis, 5., 10., 10.) + Cone_8 = shaperpy.makeCone(None, edgaxis, 5.0, 10.0, 10.0) except myExcept as ec: - assert(ec.what() == "Cone builder :: the base point is not valid.") + assert ec.what() == "Cone builder :: the base point is not valid." try: - Cone_9 = shaperpy.makeCone(pnt2, None, 5., 10., 10.) + Cone_9 = shaperpy.makeCone(pnt2, None, 5.0, 10.0, 10.0) except myExcept as ec: - assert(ec.what() == "Cone builder :: the axis is not valid.") + assert ec.what() == "Cone builder :: the axis is not valid." try: - Cone_10 = shaperpy.makeCone(pnt2, edgaxis, 5., 10., 0.) + Cone_10 = shaperpy.makeCone(pnt2, edgaxis, 5.0, 10.0, 0.0) except myExcept as ec: - assert(ec.what() == "Cone builder :: height is negative or null.") + assert ec.what() == "Cone builder :: height is negative or null." diff --git a/test.API/SHAPER/Primitives/TestAPI_Cylinder.py b/test.API/SHAPER/Primitives/TestAPI_Cylinder.py index ed8ddb743..1e594afe2 100644 --- a/test.API/SHAPER/Primitives/TestAPI_Cylinder.py +++ b/test.API/SHAPER/Primitives/TestAPI_Cylinder.py @@ -25,100 +25,100 @@ from GeomAPI import GeomAPI_Ax1 as axis from GeomAPI import GeomAPI_Dir as direction # Points -pnt1 = pnt(0., 0., 0.) -pnt2 = pnt(10., 10., 10.) +pnt1 = pnt(0.0, 0.0, 0.0) +pnt2 = pnt(10.0, 10.0, 10.0) # Axis -yDir = direction(0.,10.,0.) +yDir = direction(0.0, 10.0, 0.0) ax1 = axis(pnt1, yDir) # Edges -edgx = edgeBuilder.line(1., 0., 0.) -edgy = edgeBuilder.line(0., 1., 0.) -edgz = edgeBuilder.line(0., 0., 1.) -edg1 = edgeBuilder.line(0., 10., 0.) +edgx = edgeBuilder.line(1.0, 0.0, 0.0) +edgy = edgeBuilder.line(0.0, 1.0, 0.0) +edgz = edgeBuilder.line(0.0, 0.0, 1.0) +edg1 = edgeBuilder.line(0.0, 10.0, 0.0) edgaxis = edgeBuilder.line(ax1.dir().x(), ax1.dir().y(), ax1.dir().z()) -Cylinder_1 = shaperpy.makeCylinder(5., 10.) -Cylinder_2 = shaperpy.makeCylinder(pnt2, edgx, 5., 10.) -Cylinder_3 = shaperpy.makeCylinder(pnt2, edg1, 7., 12.) +Cylinder_1 = shaperpy.makeCylinder(5.0, 10.0) +Cylinder_2 = shaperpy.makeCylinder(pnt2, edgx, 5.0, 10.0) +Cylinder_3 = shaperpy.makeCylinder(pnt2, edg1, 7.0, 12.0) try: - Cylinder_4 = shaperpy.makeCylinder(0., 10.) + Cylinder_4 = shaperpy.makeCylinder(0.0, 10.0) except myExcept as ec: - assert(ec.what() == "Cylinder builder :: radius is negative or null.") + assert ec.what() == "Cylinder builder :: radius is negative or null." try: - Cylinder_5 = shaperpy.makeCylinder(-5., 10.) + Cylinder_5 = shaperpy.makeCylinder(-5.0, 10.0) except myExcept as ec: - assert(ec.what() == "Cylinder builder :: radius is negative or null.") + assert ec.what() == "Cylinder builder :: radius is negative or null." try: - Cylinder_6 = shaperpy.makeCylinder(5., 0.) + Cylinder_6 = shaperpy.makeCylinder(5.0, 0.0) except myExcept as ec: - assert(ec.what() == "Cylinder builder :: height is negative or null.") + assert ec.what() == "Cylinder builder :: height is negative or null." try: - Cylinder_7 = shaperpy.makeCylinder(5., -10.) + Cylinder_7 = shaperpy.makeCylinder(5.0, -10.0) except myExcept as ec: - assert(ec.what() == "Cylinder builder :: height is negative or null.") + assert ec.what() == "Cylinder builder :: height is negative or null." try: - Cylinder_8 = shaperpy.makeCylinder(None, edgz, 5., 10.) + Cylinder_8 = shaperpy.makeCylinder(None, edgz, 5.0, 10.0) except myExcept as ec: - assert(ec.what() == "Cylinder builder :: the base point is not valid.") + assert ec.what() == "Cylinder builder :: the base point is not valid." try: - Cylinder_9 = shaperpy.makeCylinder(pnt1, None, 5., 10.) + Cylinder_9 = shaperpy.makeCylinder(pnt1, None, 5.0, 10.0) except myExcept as ec: - assert(ec.what() == "Cylinder builder :: the axis is not valid.") + assert ec.what() == "Cylinder builder :: the axis is not valid." -Cylinder_14 = shaperpy.makeCylinder(5., 10., 45.) -Cylinder_15 = shaperpy.makeCylinder(pnt2, edgx, 5., 10., 90.) -Cylinder_16 = shaperpy.makeCylinder(pnt2, edgaxis, 7., 12., 120.) -Cylinder_17 = shaperpy.makeCylinder(pnt2, edgy, 5., 10., 360.) +Cylinder_14 = shaperpy.makeCylinder(5.0, 10.0, 45.0) +Cylinder_15 = shaperpy.makeCylinder(pnt2, edgx, 5.0, 10.0, 90.0) +Cylinder_16 = shaperpy.makeCylinder(pnt2, edgaxis, 7.0, 12.0, 120.0) +Cylinder_17 = shaperpy.makeCylinder(pnt2, edgy, 5.0, 10.0, 360.0) try: - Cylinder_18 = shaperpy.makeCylinder(0., 10., 45.) + Cylinder_18 = shaperpy.makeCylinder(0.0, 10.0, 45.0) except myExcept as ec: - assert(ec.what() == "Cylinder builder :: radius is negative or null.") + assert ec.what() == "Cylinder builder :: radius is negative or null." try: - Cylinder_19 = shaperpy.makeCylinder(-5., 10., 45.) + Cylinder_19 = shaperpy.makeCylinder(-5.0, 10.0, 45.0) except myExcept as ec: - assert(ec.what() == "Cylinder builder :: radius is negative or null.") + assert ec.what() == "Cylinder builder :: radius is negative or null." try: - Cylinder_20 = shaperpy.makeCylinder(5., 0., 45.) + Cylinder_20 = shaperpy.makeCylinder(5.0, 0.0, 45.0) except myExcept as ec: - assert(ec.what() == "Cylinder builder :: height is negative or null.") + assert ec.what() == "Cylinder builder :: height is negative or null." try: - Cylinder_21 = shaperpy.makeCylinder(5., -10., 45.) + Cylinder_21 = shaperpy.makeCylinder(5.0, -10.0, 45.0) except myExcept as ec: - assert(ec.what() == "Cylinder builder :: height is negative or null.") + assert ec.what() == "Cylinder builder :: height is negative or null." try: - Cylinder_22 = shaperpy.makeCylinder(5., 10., 0.) + Cylinder_22 = shaperpy.makeCylinder(5.0, 10.0, 0.0) except myExcept as ec: - assert(ec.what() == "Cylinder builder :: angle is negative or null.") + assert ec.what() == "Cylinder builder :: angle is negative or null." try: - Cylinder_23 = shaperpy.makeCylinder(5., 10., -45.) + Cylinder_23 = shaperpy.makeCylinder(5.0, 10.0, -45.0) except myExcept as ec: - assert(ec.what() == "Cylinder builder :: angle is negative or null.") + assert ec.what() == "Cylinder builder :: angle is negative or null." try: - Cylinder_24 = shaperpy.makeCylinder(5., 10., 450.) + Cylinder_24 = shaperpy.makeCylinder(5.0, 10.0, 450.0) except myExcept as ec: - assert(ec.what() == "Cylinder builder :: angle greater than 360 degrees.") + assert ec.what() == "Cylinder builder :: angle greater than 360 degrees." try: - Cylinder_25 = shaperpy.makeCylinder(None, edgz, 5., 10., 90.) + Cylinder_25 = shaperpy.makeCylinder(None, edgz, 5.0, 10.0, 90.0) except myExcept as ec: - assert(ec.what() == "Cylinder builder :: the base point is not valid.") + assert ec.what() == "Cylinder builder :: the base point is not valid." try: - Cylinder_26 = shaperpy.makeCylinder(pnt1, None, 5., 10., 90.) + Cylinder_26 = shaperpy.makeCylinder(pnt1, None, 5.0, 10.0, 90.0) except myExcept as ec: - assert(ec.what() == "Cylinder builder :: the axis is not valid.") \ No newline at end of file + assert ec.what() == "Cylinder builder :: the axis is not valid." diff --git a/test.API/SHAPER/Primitives/TestAPI_Sphere.py b/test.API/SHAPER/Primitives/TestAPI_Sphere.py index 65985e5c7..fdf21741b 100644 --- a/test.API/SHAPER/Primitives/TestAPI_Sphere.py +++ b/test.API/SHAPER/Primitives/TestAPI_Sphere.py @@ -22,22 +22,22 @@ from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept from GeomAPI import GeomAPI_Pnt as pnt # Points -pnt1 = pnt(10., 10., 10.) +pnt1 = pnt(10.0, 10.0, 10.0) -Sphere_1 = shaperpy.makeSphere(pnt1, 10.) -Sphere_2 = shaperpy.makeSphere(10.) +Sphere_1 = shaperpy.makeSphere(pnt1, 10.0) +Sphere_2 = shaperpy.makeSphere(10.0) try: - Sphere_3 = shaperpy.makeSphere(pnt1, 0.) + Sphere_3 = shaperpy.makeSphere(pnt1, 0.0) except myExcept as ec: - assert(ec.what() == "Sphere builder :: radius is negative or null.") + assert ec.what() == "Sphere builder :: radius is negative or null." try: - Sphere_4 = shaperpy.makeSphere(0.) + Sphere_4 = shaperpy.makeSphere(0.0) except myExcept as ec: - assert(ec.what() == "Sphere builder :: radius is negative or null.") + assert ec.what() == "Sphere builder :: radius is negative or null." try: - Sphere_5 = shaperpy.makeSphere(None, 10.) + Sphere_5 = shaperpy.makeSphere(None, 10.0) except myExcept as ec: - assert(ec.what() == "Sphere builder :: center is not valid.") + assert ec.what() == "Sphere builder :: center is not valid." diff --git a/test.API/SHAPER/Primitives/TestAPI_Torus.py b/test.API/SHAPER/Primitives/TestAPI_Torus.py index 4149039eb..6bd84b6a7 100644 --- a/test.API/SHAPER/Primitives/TestAPI_Torus.py +++ b/test.API/SHAPER/Primitives/TestAPI_Torus.py @@ -25,51 +25,51 @@ from GeomAPI import GeomAPI_Ax1 as axis from GeomAPI import GeomAPI_Dir as direction # Points -pnt1 = pnt(0., 0., 0.) -pnt2 = pnt(10., 10., 10.) +pnt1 = pnt(0.0, 0.0, 0.0) +pnt2 = pnt(10.0, 10.0, 10.0) # Axis -yDir = direction(0.,10.,0.) +yDir = direction(0.0, 10.0, 0.0) ax1 = axis(pnt1, yDir) # Edges edgaxis = edgeBuilder.line(ax1.dir().x(), ax1.dir().y(), ax1.dir().z()) -Torus_1 = shaperpy.makeTorus(10., 5.) +Torus_1 = shaperpy.makeTorus(10.0, 5.0) try: - Torus_2 = shaperpy.makeTorus(0., 5.) + Torus_2 = shaperpy.makeTorus(0.0, 5.0) except myExcept as ec: - assert(ec.what() == "Torus builder :: radius is negative or null.") + assert ec.what() == "Torus builder :: radius is negative or null." try: - Torus_3 = shaperpy.makeTorus(10., 0.) + Torus_3 = shaperpy.makeTorus(10.0, 0.0) except myExcept as ec: - assert(ec.what() == "Torus builder :: ring radius is negative or null.") + assert ec.what() == "Torus builder :: ring radius is negative or null." try: - Torus_4 = shaperpy.makeTorus(5., 10.) + Torus_4 = shaperpy.makeTorus(5.0, 10.0) except myExcept as ec: - assert(ec.what() == "Torus builder :: ring radius is greater than the radius.") + assert ec.what() == "Torus builder :: ring radius is greater than the radius." -Torus_5 = shaperpy.makeTorus(pnt2, edgaxis, 10., 5.) +Torus_5 = shaperpy.makeTorus(pnt2, edgaxis, 10.0, 5.0) try: - Torus_6 = shaperpy.makeTorus(None, edgaxis, 10., 5.) + Torus_6 = shaperpy.makeTorus(None, edgaxis, 10.0, 5.0) except myExcept as ec: - assert(ec.what() == "Torus builder :: the base point is not valid.") + assert ec.what() == "Torus builder :: the base point is not valid." try: - Torus_7 = shaperpy.makeTorus(pnt2, None, 10., 5.) + Torus_7 = shaperpy.makeTorus(pnt2, None, 10.0, 5.0) except myExcept as ec: - assert(ec.what() == "Torus builder :: the axis is not valid.") + assert ec.what() == "Torus builder :: the axis is not valid." try: - Torus_8 = shaperpy.makeTorus(pnt2, edgaxis, 0., 5.) + Torus_8 = shaperpy.makeTorus(pnt2, edgaxis, 0.0, 5.0) except myExcept as ec: - assert(ec.what() == "Torus builder :: radius is negative or null.") + assert ec.what() == "Torus builder :: radius is negative or null." try: - Torus_8 = shaperpy.makeTorus(pnt2, edgaxis, 10., 0.) + Torus_8 = shaperpy.makeTorus(pnt2, edgaxis, 10.0, 0.0) except myExcept as ec: - assert(ec.what() == "Torus builder :: ring radius is negative or null.") + assert ec.what() == "Torus builder :: ring radius is negative or null." diff --git a/test.API/SHAPER/Primitives/TestBox.py b/test.API/SHAPER/Primitives/TestBox.py index e06a30f5f..d22b066e5 100644 --- a/test.API/SHAPER/Primitives/TestBox.py +++ b/test.API/SHAPER/Primitives/TestBox.py @@ -41,24 +41,52 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchLine_1 = Sketch_1.addLine(20, 10, 40, 10) SketchLine_2 = Sketch_1.addLine(40, 10, 40, 20) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(40, 20, 20, 20) SketchLine_4 = Sketch_1.addLine(20, 20, 20, 10) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_4.endPoint() +) SketchLine_5 = Sketch_2.addLine(20, 10, 40, 10) SketchLine_6 = Sketch_2.addLine(40, 10, 40, 20) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) 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/SketchLine_1_StartVertex")]) -Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_2/SketchLine_6_EndVertex")]) +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/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) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "PartSet/OX"), 100, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection("EDGE", "PartSet/OZ"), + 100, + 0, +) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_2")], + model.selection("EDGE", "PartSet/OX"), + 100, + 0, +) # Parameters model.addParameter(Part_1_doc, "dx", "10") @@ -80,11 +108,29 @@ 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/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_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") -Box_19 = model.addBox(Part_1_doc, 0, 0, 0, 20, 20 ,20) +Box_19 = model.addBox(Part_1_doc, 0, 0, 0, 20, 20, 20) model.do() model.end() @@ -134,37 +180,61 @@ model.testNbSubShapes(Box_19, GeomAPI_Shape.FACE, [6]) model.testHaveNamingFaces(Box_19, model, Part_1_doc) model.testNbResults(Box_2, 0) -assert(Box_2.feature().error() == "Box builder with dimensions :: Dx is null or negative.") +assert ( + Box_2.feature().error() == "Box builder with dimensions :: Dx is null or negative." +) model.testNbResults(Box_3, 0) -assert(Box_3.feature().error() == "Box builder with dimensions :: Dy is null or negative.") +assert ( + Box_3.feature().error() == "Box builder with dimensions :: Dy is null or negative." +) model.testNbResults(Box_4, 0) -assert(Box_4.feature().error() == "Box builder with dimensions :: Dz is null or negative.") +assert ( + Box_4.feature().error() == "Box builder with dimensions :: Dz is null or negative." +) model.testNbResults(Box_5, 0) -assert(Box_5.feature().error() == "Box builder with dimensions :: Dx is null or negative.") +assert ( + Box_5.feature().error() == "Box builder with dimensions :: Dx is null or negative." +) model.testNbResults(Box_6, 0) -assert(Box_6.feature().error() == "Box builder with dimensions :: Dy is null or negative.") +assert ( + Box_6.feature().error() == "Box builder with dimensions :: Dy is null or negative." +) model.testNbResults(Box_7, 0) -assert(Box_7.feature().error() == "Box builder with dimensions :: Dz is null or negative.") +assert ( + Box_7.feature().error() == "Box builder with dimensions :: Dz is null or negative." +) model.testNbResults(Box_9, 0) -assert(Box_9.feature().error() == "Box builder with two points :: the distance between the two points is null.") +assert ( + Box_9.feature().error() + == "Box builder with two points :: the distance between the two points is null." +) model.testNbResults(Box_10, 0) -assert(Box_10.feature().error() == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes.") +assert ( + Box_10.feature().error() + == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes." +) model.testNbResults(Box_11, 0) -assert(Box_11.feature().error() == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes.") +assert ( + Box_11.feature().error() + == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes." +) model.testNbResults(Box_12, 0) -assert(Box_12.feature().error() == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes.") +assert ( + Box_12.feature().error() + == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes." +) model.testNbResults(Box_13, 0) -assert(Box_13.feature().error() == "Attribute \"FirstPoint\" is not initialized.") +assert Box_13.feature().error() == 'Attribute "FirstPoint" is not initialized.' model.testNbResults(Box_14, 0) -assert(Box_14.feature().error() == "Attribute \"SecondPoint\" is not initialized.") +assert Box_14.feature().error() == 'Attribute "SecondPoint" is not initialized.' diff --git a/test.API/SHAPER/Primitives/TestCone.py b/test.API/SHAPER/Primitives/TestCone.py index 4312c5e69..f4adce537 100644 --- a/test.API/SHAPER/Primitives/TestCone.py +++ b/test.API/SHAPER/Primitives/TestCone.py @@ -35,24 +35,105 @@ model.addParameter(Part_1_doc, "topRadius", "7") model.addParameter(Part_1_doc, "h", "15") # Tests -Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10., 5., 10.) -Cone_2 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5., 10., 10.) -Cone_3 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 0., 5., 10.) -Cone_4 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), -3., 5., 10.) -Cone_5 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10., 0., 10.) -Cone_6 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10., -5., 10.) -Cone_7 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10., 5., 0.) -Cone_8 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10., 5., -10.) -Cone_9 = model.addCone(Part_1_doc, Point_1, model.selection("EDGE", "PartSet/OZ"), 10., 7., 15.) -Cone_10 = model.addCone(Part_1_doc, Point_1, Axis_1, 10., 7., 15.) -Cone_11 = model.addCone(Part_1_doc, Point_2, model.selection("EDGE", "PartSet/OZ"), 10., 7., 15.) -Cone_12= model.addCone(Part_1_doc, Point_1, Axis_2, 10., 7., 15.) -Cone_13 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 0., 0., 15.) -Cone_14 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10., 10., 15.) -Cone_15 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "baseRadius", "topRadius", "h") - -Cone_16 = model.addCone(Part_1_doc, 5., 10., 15.) -Cone_16.setRadius(10., 15.) +Cone_1 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10.0, + 5.0, + 10.0, +) +Cone_2 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5.0, + 10.0, + 10.0, +) +Cone_3 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 0.0, + 5.0, + 10.0, +) +Cone_4 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + -3.0, + 5.0, + 10.0, +) +Cone_5 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10.0, + 0.0, + 10.0, +) +Cone_6 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10.0, + -5.0, + 10.0, +) +Cone_7 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10.0, + 5.0, + 0.0, +) +Cone_8 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10.0, + 5.0, + -10.0, +) +Cone_9 = model.addCone( + Part_1_doc, Point_1, model.selection("EDGE", "PartSet/OZ"), 10.0, 7.0, 15.0 +) +Cone_10 = model.addCone(Part_1_doc, Point_1, Axis_1, 10.0, 7.0, 15.0) +Cone_11 = model.addCone( + Part_1_doc, Point_2, model.selection("EDGE", "PartSet/OZ"), 10.0, 7.0, 15.0 +) +Cone_12 = model.addCone(Part_1_doc, Point_1, Axis_2, 10.0, 7.0, 15.0) +Cone_13 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 0.0, + 0.0, + 15.0, +) +Cone_14 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 10.0, + 10.0, + 15.0, +) +Cone_15 = model.addCone( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "baseRadius", + "topRadius", + "h", +) + +Cone_16 = model.addCone(Part_1_doc, 5.0, 10.0, 15.0) +Cone_16.setRadius(10.0, 15.0) model.do() model.end() @@ -109,25 +190,31 @@ model.testNbSubShapes(Cone_16, GeomAPI_Shape.FACE, [3]) model.testHaveNamingFaces(Cone_16, model, Part_1_doc) model.testNbResults(Cone_4, 0) -assert(Cone_4.feature().error() == "Cone builder :: base radius is negative.") +assert Cone_4.feature().error() == "Cone builder :: base radius is negative." model.testNbResults(Cone_6, 0) -assert(Cone_6.feature().error() == "Cone builder :: top radius is negative.") +assert Cone_6.feature().error() == "Cone builder :: top radius is negative." model.testNbResults(Cone_7, 0) -assert(Cone_7.feature().error() == "Cone builder :: height is negative or null.") +assert Cone_7.feature().error() == "Cone builder :: height is negative or null." model.testNbResults(Cone_8, 0) -assert(Cone_8.feature().error() == "Cone builder :: height is negative or null.") +assert Cone_8.feature().error() == "Cone builder :: height is negative or null." model.testNbResults(Cone_11, 0) -assert(Cone_11.feature().error() == "Attribute \"base_point\" is not initialized.") +assert Cone_11.feature().error() == 'Attribute "base_point" is not initialized.' model.testNbResults(Cone_12, 0) -assert(Cone_12.feature().error() == "Attribute \"axis\" is not initialized.") +assert Cone_12.feature().error() == 'Attribute "axis" is not initialized.' model.testNbResults(Cone_13, 0) -assert(Cone_13.feature().error() == "Cone builder :: base radius and top radius are negative or null.") +assert ( + Cone_13.feature().error() + == "Cone builder :: base radius and top radius are negative or null." +) model.testNbResults(Cone_14, 0) -assert(Cone_14.feature().error() == "Cone builder :: base radius and top radius are too close.") +assert ( + Cone_14.feature().error() + == "Cone builder :: base radius and top radius are too close." +) diff --git a/test.API/SHAPER/Primitives/TestCylinder.py b/test.API/SHAPER/Primitives/TestCylinder.py index 6a240ce88..7eca234ff 100644 --- a/test.API/SHAPER/Primitives/TestCylinder.py +++ b/test.API/SHAPER/Primitives/TestCylinder.py @@ -21,7 +21,7 @@ Test case for Primitive Cylinder feature. Written on High API. """ -#from ModelAPI import * +# from ModelAPI import * from salome.shaper import model @@ -36,17 +36,49 @@ Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_1")]) # Sketch Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(40.1917811348149, 87.63526969661267, 92.63493386188256, 31.1341153558487) -SketchLine_2 = Sketch_1.addLine(92.63493386188256, 31.1341153558487, 44.70109718071649, 32.40093347950982) -SketchLine_3 = Sketch_1.addLine(44.70109718071649, 32.40093347950982, 40.1917811348149, 87.63526969661267) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) +SketchLine_1 = Sketch_1.addLine( + 40.1917811348149, 87.63526969661267, 92.63493386188256, 31.1341153558487 +) +SketchLine_2 = Sketch_1.addLine( + 92.63493386188256, 31.1341153558487, 44.70109718071649, 32.40093347950982 +) +SketchLine_3 = Sketch_1.addLine( + 44.70109718071649, 32.40093347950982, 40.1917811348149, 87.63526969661267 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +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 -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) +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/SketchLine_2")]) @@ -63,24 +95,93 @@ model.addParameter(Part_1_doc, "r2", "6") model.addParameter(Part_1_doc, "h2", "15") model.addParameter(Part_1_doc, "angle", "270") -#Tests +# Tests Cylinder_1 = model.addCylinder(Part_1_doc, 5, 10) -Cylinder_2 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("EDGE", "PartSet/OX"), 5, 10) -Cylinder_3 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("EDGE", "Axis_1"), 7, 12) +Cylinder_2 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "Point_1"), + model.selection("EDGE", "PartSet/OX"), + 5, + 10, +) +Cylinder_3 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "Point_1"), + model.selection("EDGE", "Axis_1"), + 7, + 12, +) Cylinder_4 = model.addCylinder(Part_1_doc, 0, 10) Cylinder_5 = model.addCylinder(Part_1_doc, -5, 10) 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/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&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_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/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&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) -Cylinder_16 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("EDGE", "Axis_1"), 7, 12, 120) -Cylinder_17 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("EDGE", "PartSet/OY"), 5, 10, 360) +Cylinder_15 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "Point_1"), + model.selection("EDGE", "PartSet/OX"), + 5, + 10, + 90, +) +Cylinder_16 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "Point_1"), + model.selection("EDGE", "Axis_1"), + 7, + 12, + 120, +) +Cylinder_17 = model.addCylinder( + Part_1_doc, + model.selection("VERTEX", "Point_1"), + model.selection("EDGE", "PartSet/OY"), + 5, + 10, + 360, +) Cylinder_18 = model.addCylinder(Part_1_doc, 0, 10, 45) Cylinder_19 = model.addCylinder(Part_1_doc, -5, 10, 45) Cylinder_20 = model.addCylinder(Part_1_doc, 5, 0, 45) @@ -88,11 +189,52 @@ Cylinder_21 = model.addCylinder(Part_1_doc, 5, -10, 45) Cylinder_22 = model.addCylinder(Part_1_doc, 5, 10, 0) 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/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&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_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/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&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() @@ -192,50 +334,61 @@ model.testNbSubShapes(Cylinder_30, GeomAPI_Shape.FACE, [5]) model.testHaveNamingFaces(Cylinder_30, model, Part_1_doc) model.testNbResults(Cylinder_4, 0) -assert(Cylinder_4.feature().error() == "Cylinder builder :: radius is negative or null.") +assert Cylinder_4.feature().error() == "Cylinder builder :: radius is negative or null." model.testNbResults(Cylinder_5, 0) -assert(Cylinder_5.feature().error() == "Cylinder builder :: radius is negative or null.") +assert Cylinder_5.feature().error() == "Cylinder builder :: radius is negative or null." model.testNbResults(Cylinder_6, 0) -assert(Cylinder_6.feature().error() == "Cylinder builder :: height is negative or null.") +assert Cylinder_6.feature().error() == "Cylinder builder :: height is negative or null." model.testNbResults(Cylinder_7, 0) -assert(Cylinder_7.feature().error() == "Cylinder builder :: height is negative or null.") +assert Cylinder_7.feature().error() == "Cylinder builder :: height is negative or null." # To uncomment when #2044 will be performed. -#model.testNbResults(Cylinder_8, 0) -#assert(Cylinder_8.feature().error() == "Attribute \"base_point\" is not initialized") +# model.testNbResults(Cylinder_8, 0) +# assert(Cylinder_8.feature().error() == "Attribute \"base_point\" is not initialized") # To uncomment when #2044 will be performed. -#model.testNbResults(Cylinder_9, 0) -#assert(Cylinder_9.feature().error() == "Attribute \"axis\" is not initialized") +# model.testNbResults(Cylinder_9, 0) +# assert(Cylinder_9.feature().error() == "Attribute \"axis\" is not initialized") model.testNbResults(Cylinder_18, 0) -assert(Cylinder_18.feature().error() == "Cylinder builder :: radius is negative or null.") +assert ( + Cylinder_18.feature().error() == "Cylinder builder :: radius is negative or null." +) model.testNbResults(Cylinder_19, 0) -assert(Cylinder_19.feature().error() == "Cylinder builder :: radius is negative or null.") +assert ( + Cylinder_19.feature().error() == "Cylinder builder :: radius is negative or null." +) model.testNbResults(Cylinder_20, 0) -assert(Cylinder_20.feature().error() == "Cylinder builder :: height is negative or null.") +assert ( + Cylinder_20.feature().error() == "Cylinder builder :: height is negative or null." +) model.testNbResults(Cylinder_21, 0) -assert(Cylinder_21.feature().error() == "Cylinder builder :: height is negative or null.") +assert ( + Cylinder_21.feature().error() == "Cylinder builder :: height is negative or null." +) model.testNbResults(Cylinder_22, 0) -assert(Cylinder_22.feature().error() == "Cylinder builder :: angle is negative or null.") +assert Cylinder_22.feature().error() == "Cylinder builder :: angle is negative or null." model.testNbResults(Cylinder_23, 0) -assert(Cylinder_23.feature().error() == "Cylinder builder :: angle is negative or null.") +assert Cylinder_23.feature().error() == "Cylinder builder :: angle is negative or null." model.testNbResults(Cylinder_24, 0) -assert(Cylinder_24.feature().error() == "Cylinder builder :: angle greater than 360 degrees.") +assert ( + Cylinder_24.feature().error() + == "Cylinder builder :: angle greater than 360 degrees." +) # To uncomment when #2044 will be performed. -#model.testNbResults(Cylinder_25, 0) -#assert(Cylinder_25.feature().error() == "Attribute \"base_point\" is not initialized") +# model.testNbResults(Cylinder_25, 0) +# assert(Cylinder_25.feature().error() == "Attribute \"base_point\" is not initialized") # To uncomment when #2044 will be performed. -#model.testNbResults(Cylinder_26, 0) -#assert(Cylinder_26.feature().error() == "Attribute \"axis\" is not initialized") +# model.testNbResults(Cylinder_26, 0) +# assert(Cylinder_26.feature().error() == "Attribute \"axis\" is not initialized") diff --git a/test.API/SHAPER/Primitives/TestSphere.py b/test.API/SHAPER/Primitives/TestSphere.py index 92b324caa..e5a44ea43 100644 --- a/test.API/SHAPER/Primitives/TestSphere.py +++ b/test.API/SHAPER/Primitives/TestSphere.py @@ -41,8 +41,8 @@ Sphere_6 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin Sphere_7 = model.addSphere(Part_1_doc, 10) Sphere_7.setCenterPoint(Point_1) -Sphere_8 = model.addSphere(Part_1_doc,10,40,0,180,0,180) -Sphere_9 = model.addSphere(Part_1_doc,40,10,0,180,0,180) +Sphere_8 = model.addSphere(Part_1_doc, 10, 40, 0, 180, 0, 180) +Sphere_9 = model.addSphere(Part_1_doc, 40, 10, 0, 180, 0, 180) model.do() model.end() @@ -81,13 +81,13 @@ model.testNbSubShapes(Sphere_8, GeomAPI_Shape.FACE, [4]) model.testHaveNamingFaces(Sphere_8, model, Part_1_doc) model.testNbResults(Sphere_2, 0) -assert(Sphere_2.feature().error() == "Sphere builder :: radius is negative or null.") +assert Sphere_2.feature().error() == "Sphere builder :: radius is negative or null." model.testNbResults(Sphere_3, 0) -assert(Sphere_3.feature().error() == "Sphere builder :: radius is negative or null.") +assert Sphere_3.feature().error() == "Sphere builder :: radius is negative or null." model.testNbResults(Sphere_5, 0) -assert(Sphere_5.feature().error() == "Attribute \"center_point\" is not initialized.") +assert Sphere_5.feature().error() == 'Attribute "center_point" is not initialized.' model.testNbResults(Sphere_9, 0) -assert(Sphere_9.feature().error() == "Sphere builder :: RMin is larger than RMax.") +assert Sphere_9.feature().error() == "Sphere builder :: RMin is larger than RMax." diff --git a/test.API/SHAPER/Primitives/TestTorus.py b/test.API/SHAPER/Primitives/TestTorus.py index d7bc45cf1..68feb562a 100644 --- a/test.API/SHAPER/Primitives/TestTorus.py +++ b/test.API/SHAPER/Primitives/TestTorus.py @@ -34,17 +34,65 @@ model.addParameter(Part_1_doc, "r", "10") model.addParameter(Part_1_doc, "ring", "3") # Tests -Torus_1 = model.addTorus(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 15, 3) -Torus_2 = model.addTorus(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Torus_3 = model.addTorus(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 0, 3) -Torus_4 = model.addTorus(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), -10, 3) -Torus_5 = model.addTorus(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 15, 0) -Torus_6 = model.addTorus(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 15, -3) -Torus_7 = model.addTorus(Part_1_doc, Point_1, model.selection("EDGE", "PartSet/OX"), 12, 7) +Torus_1 = model.addTorus( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 15, + 3, +) +Torus_2 = model.addTorus( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) +Torus_3 = model.addTorus( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 0, + 3, +) +Torus_4 = model.addTorus( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + -10, + 3, +) +Torus_5 = model.addTorus( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 15, + 0, +) +Torus_6 = model.addTorus( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 15, + -3, +) +Torus_7 = model.addTorus( + Part_1_doc, Point_1, model.selection("EDGE", "PartSet/OX"), 12, 7 +) Torus_8 = model.addTorus(Part_1_doc, Point_1, Axis_1, 15, 4) -Torus_9 = model.addTorus(Part_1_doc, Point_2, model.selection("EDGE", "PartSet/OZ"), 15, 4) -Torus_10 = model.addTorus(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), Axis_2, 15, 4) -Torus_11 = model.addTorus(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "r", "ring") +Torus_9 = model.addTorus( + Part_1_doc, Point_2, model.selection("EDGE", "PartSet/OZ"), 15, 4 +) +Torus_10 = model.addTorus( + Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), Axis_2, 15, 4 +) +Torus_11 = model.addTorus( + Part_1_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + "r", + "ring", +) Torus_12 = model.addTorus(Part_1_doc, 15, 4) model.do() @@ -84,22 +132,25 @@ model.testNbSubShapes(Torus_12, GeomAPI_Shape.FACE, [1]) model.testHaveNamingFaces(Torus_12, model, Part_1_doc) model.testNbResults(Torus_2, 0) -assert(Torus_2.feature().error() == "Torus builder :: ring radius is greater than the radius.") +assert ( + Torus_2.feature().error() + == "Torus builder :: ring radius is greater than the radius." +) model.testNbResults(Torus_3, 0) -assert(Torus_3.feature().error() == "Torus builder :: radius is negative or null.") +assert Torus_3.feature().error() == "Torus builder :: radius is negative or null." model.testNbResults(Torus_4, 0) -assert(Torus_4.feature().error() == "Torus builder :: radius is negative or null.") +assert Torus_4.feature().error() == "Torus builder :: radius is negative or null." model.testNbResults(Torus_5, 0) -assert(Torus_5.feature().error() == "Torus builder :: ring radius is negative or null.") +assert Torus_5.feature().error() == "Torus builder :: ring radius is negative or null." model.testNbResults(Torus_6, 0) -assert(Torus_6.feature().error() == "Torus builder :: ring radius is negative or null.") +assert Torus_6.feature().error() == "Torus builder :: ring radius is negative or null." model.testNbResults(Torus_9, 0) -assert(Torus_9.feature().error() == "Attribute \"base_point\" is not initialized.") +assert Torus_9.feature().error() == 'Attribute "base_point" is not initialized.' model.testNbResults(Torus_10, 0) -assert(Torus_10.feature().error() == "Attribute \"axis\" is not initialized.") +assert Torus_10.feature().error() == 'Attribute "axis" is not initialized.' diff --git a/test.API/SHAPER/Primitives/TestTube.py b/test.API/SHAPER/Primitives/TestTube.py index f83d0182a..011b02337 100644 --- a/test.API/SHAPER/Primitives/TestTube.py +++ b/test.API/SHAPER/Primitives/TestTube.py @@ -55,12 +55,14 @@ model.testHaveNamingFaces(Tube_2, model, Part_1_doc) model.testNbResults(Tube_3, 0) print(Tube_3.feature().error()) -assert(Tube_3.feature().error() == "Tube builder :: rmin is greater then or equal to rmax.") +assert ( + Tube_3.feature().error() == "Tube builder :: rmin is greater then or equal to rmax." +) model.testNbResults(Tube_4, 0) print(Tube_4.feature().error()) -assert(Tube_4.feature().error() == "Tube builder :: rmin is negative.") +assert Tube_4.feature().error() == "Tube builder :: rmin is negative." model.testNbResults(Tube_5, 0) print(Tube_5.feature().error()) -assert(Tube_5.feature().error() == "Tube builder :: z is negative or null.") +assert Tube_5.feature().error() == "Tube builder :: z is negative or null." diff --git a/test.API/SHAPER/Transformations/TestAPI_MultiRotation.py b/test.API/SHAPER/Transformations/TestAPI_MultiRotation.py index 3a886154e..e7971a896 100644 --- a/test.API/SHAPER/Transformations/TestAPI_MultiRotation.py +++ b/test.API/SHAPER/Transformations/TestAPI_MultiRotation.py @@ -22,54 +22,60 @@ from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept from GeomAPI import GeomAPI_Ax1 as axis, GeomAPI_Pnt as pnt, GeomAPI_Dir as direction # Create Boxes -Box_1 = shaperpy.makeBox(10.,10.,10.) -Box_2 = shaperpy.makeBox(10.,10.,10.) -Box_3 = shaperpy.makeBox(10.,10.,10.) -Box_4 = shaperpy.makeBox(10.,10.,10.) -Box_5 = shaperpy.makeBox(10.,10.,10.) -Box_6 = shaperpy.makeBox(10.,10.,10.) -Box_7 = shaperpy.makeBox(10.,10.,10.) +Box_1 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_2 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_3 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_4 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_5 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_6 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_7 = shaperpy.makeBox(10.0, 10.0, 10.0) # Points -pntOrigin = pnt(0.,0.,0.) -pnt1 = pnt(10.,0.,0.) +pntOrigin = pnt(0.0, 0.0, 0.0) +pnt1 = pnt(10.0, 0.0, 0.0) # Axis -xDir = direction(10., 0., 0.) +xDir = direction(10.0, 0.0, 0.0) ax1 = axis(pntOrigin, xDir) # Create MultiRotations -MultiRotation_1 = shaperpy.makeMultiRotation(Box_1, ax1, 45., 5) -MultiRotation_2 = shaperpy.makeMultiRotation(Box_2, ax1, 0., 5) +MultiRotation_1 = shaperpy.makeMultiRotation(Box_1, ax1, 45.0, 5) +MultiRotation_2 = shaperpy.makeMultiRotation(Box_2, ax1, 0.0, 5) try: - MultiRotation_3 = shaperpy.makeMultiRotation(Box_3, ax1, 45., -5) + MultiRotation_3 = shaperpy.makeMultiRotation(Box_3, ax1, 45.0, -5) except myExcept as ec: - assert(ec.what() == "Multirotation builder :: the number of copies is null or negative.") + assert ( + ec.what() + == "Multirotation builder :: the number of copies is null or negative." + ) try: - MultiRotation_4 = shaperpy.makeMultiRotation(None, ax1, 45., 5) + MultiRotation_4 = shaperpy.makeMultiRotation(None, ax1, 45.0, 5) except myExcept as ec: - assert(ec.what() == "Transformation :: incorrect input data.") + assert ec.what() == "Transformation :: incorrect input data." try: - MultiRotation_5 = shaperpy.makeMultiRotation(Box_4, None, 45., 5) + MultiRotation_5 = shaperpy.makeMultiRotation(Box_4, None, 45.0, 5) except myExcept as ec: - assert(ec.what() == "Multirotation builder :: the axis is not valid") + assert ec.what() == "Multirotation builder :: the axis is not valid" MultiRotation_6 = shaperpy.makeMultiRotation(Box_5, ax1, 5) try: - MultiRotation_7 = shaperpy.makeMultiRotation(Box_6, ax1, -5) + MultiRotation_7 = shaperpy.makeMultiRotation(Box_6, ax1, -5) except myExcept as ec: - assert(ec.what() == "Multirotation builder :: the number of copies is null or negative.") + assert ( + ec.what() + == "Multirotation builder :: the number of copies is null or negative." + ) try: - MultiRotation_8 = shaperpy.makeMultiRotation(None, ax1, 5) + MultiRotation_8 = shaperpy.makeMultiRotation(None, ax1, 5) except myExcept as ec: - assert(ec.what() == "Transformation :: incorrect input data.") + assert ec.what() == "Transformation :: incorrect input data." try: - MultiRotation_9 = shaperpy.makeMultiRotation(Box_7, None, 5) + MultiRotation_9 = shaperpy.makeMultiRotation(Box_7, None, 5) except myExcept as ec: - assert(ec.what() == "Multirotation builder :: the axis is not valid") + assert ec.what() == "Multirotation builder :: the axis is not valid" diff --git a/test.API/SHAPER/Transformations/TestAPI_MultiTranslation.py b/test.API/SHAPER/Transformations/TestAPI_MultiTranslation.py index f93bc375b..2a19f10fc 100644 --- a/test.API/SHAPER/Transformations/TestAPI_MultiTranslation.py +++ b/test.API/SHAPER/Transformations/TestAPI_MultiTranslation.py @@ -22,62 +22,79 @@ from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept from GeomAPI import GeomAPI_Ax1 as axis, GeomAPI_Pnt as pnt, GeomAPI_Dir as direction # Create Boxes -Box_1 = shaperpy.makeBox(10.,10.,10.) -Box_2 = shaperpy.makeBox(10.,10.,10.) -Box_3 = shaperpy.makeBox(10.,10.,10.) -Box_4 = shaperpy.makeBox(10.,10.,10.) -Box_5 = shaperpy.makeBox(10.,10.,10.) -Box_6 = shaperpy.makeBox(10.,10.,10.) -Box_7 = shaperpy.makeBox(10.,10.,10.) -Box_8 = shaperpy.makeBox(10.,10.,10.) +Box_1 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_2 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_3 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_4 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_5 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_6 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_7 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_8 = shaperpy.makeBox(10.0, 10.0, 10.0) # Points -pntOrigin = pnt(0.,0.,0.) -pnt1 = pnt(10.,0.,0.) -pnt2 = pnt(10.,10.,0.) +pntOrigin = pnt(0.0, 0.0, 0.0) +pnt1 = pnt(10.0, 0.0, 0.0) +pnt2 = pnt(10.0, 10.0, 0.0) # Axis -xDir = direction(10., 0., 0.) +xDir = direction(10.0, 0.0, 0.0) ax1 = axis(pntOrigin, xDir) -yDir = direction(0., 10., 0.) +yDir = direction(0.0, 10.0, 0.0) ax2 = axis(pntOrigin, yDir) # Create MultiTranslations -MultiTranslation_1 = shaperpy.makeMultiTranslation(Box_1, ax1, 15., 5) -MultiTranslation_2 = shaperpy.makeMultiTranslation(Box_2, ax1, -15., 5) +MultiTranslation_1 = shaperpy.makeMultiTranslation(Box_1, ax1, 15.0, 5) +MultiTranslation_2 = shaperpy.makeMultiTranslation(Box_2, ax1, -15.0, 5) try: - MultiTranslation_3 = shaperpy.makeMultiTranslation(Box_3, ax1, 15., -2) + MultiTranslation_3 = shaperpy.makeMultiTranslation(Box_3, ax1, 15.0, -2) except myExcept as ec: - assert(ec.what() == "Multitranslation builder :: the number of copies for the first direction is null or negative.") + assert ( + ec.what() + == "Multitranslation builder :: the number of copies for the first direction is null or negative." + ) -MultiTranslation_5 = shaperpy.makeMultiTranslation(Box_5, ax1, 10., 5, ax2, 10., 5) -MultiTranslation_6 = shaperpy.makeMultiTranslation(Box_6, ax1, 15., 5, ax2, -10., 5) +MultiTranslation_5 = shaperpy.makeMultiTranslation(Box_5, ax1, 10.0, 5, ax2, 10.0, 5) +MultiTranslation_6 = shaperpy.makeMultiTranslation(Box_6, ax1, 15.0, 5, ax2, -10.0, 5) # Tests en erreur try: - MultiTranslation_4 = shaperpy.makeMultiTranslation(Box_4, None, 15., 2) + MultiTranslation_4 = shaperpy.makeMultiTranslation(Box_4, None, 15.0, 2) except myExcept as ec: - assert(ec.what() == "Multitranslation builder :: the first axis is not valid") + assert ec.what() == "Multitranslation builder :: the first axis is not valid" # Pas d'exception levee alors qu'une devrait y en avoir une try: - MultiTranslation_7 = shaperpy.makeMultiTranslation(Box_7, ax1, 15., 5, ax2, 10., -2) + MultiTranslation_7 = shaperpy.makeMultiTranslation( + Box_7, ax1, 15.0, 5, ax2, 10.0, -2 + ) except myExcept as ec: - assert(ec.what() == "Multitranslation builder :: the number of copies for the second direction is null or negative.") + assert ( + ec.what() + == "Multitranslation builder :: the number of copies for the second direction is null or negative." + ) try: - MultiTranslation_8 = shaperpy.makeMultiTranslation(Box_7, ax1, 15., -2, ax2, 10., 5) + MultiTranslation_8 = shaperpy.makeMultiTranslation( + Box_7, ax1, 15.0, -2, ax2, 10.0, 5 + ) except myExcept as ec: - assert(ec.what() == "Multitranslation builder :: the number of copies for the first direction is null or negative.") + assert ( + ec.what() + == "Multitranslation builder :: the number of copies for the first direction is null or negative." + ) try: - MultiTranslation_9 = shaperpy.makeMultiTranslation(Box_8, None, 15., 5, ax2, 10., 5) + MultiTranslation_9 = shaperpy.makeMultiTranslation( + Box_8, None, 15.0, 5, ax2, 10.0, 5 + ) except myExcept as ec: - assert(ec.what() == "Multitranslation builder :: the first axis is not valid") + assert ec.what() == "Multitranslation builder :: the first axis is not valid" try: - MultiTranslation_10 = shaperpy.makeMultiTranslation(Box_8, ax1, 15., 5, None, 10., 5) + MultiTranslation_10 = shaperpy.makeMultiTranslation( + Box_8, ax1, 15.0, 5, None, 10.0, 5 + ) except myExcept as ec: - assert(ec.what() == "Multitranslation builder :: the second axis is not valid") + assert ec.what() == "Multitranslation builder :: the second axis is not valid" diff --git a/test.API/SHAPER/Transformations/TestAPI_Rotation.py b/test.API/SHAPER/Transformations/TestAPI_Rotation.py index c88167c86..0937a2e78 100644 --- a/test.API/SHAPER/Transformations/TestAPI_Rotation.py +++ b/test.API/SHAPER/Transformations/TestAPI_Rotation.py @@ -23,30 +23,30 @@ from GeomAPI import GeomAPI_Ax1 as axis, GeomAPI_Pnt as pnt, GeomAPI_Dir as dire from GeomAPI import GeomAPI_Shape as shape # Create Boxes -Box_1 = shaperpy.makeBox(10.,10.,10.) -Box_2 = shaperpy.makeBox(10.,10.,10.) -Box_3 = shaperpy.makeBox(10.,10.,10.) -Box_4 = shaperpy.makeBox(10.,10.,10.) -Box_5 = shaperpy.makeBox(10.,10.,10.) -Box_6 = shaperpy.makeBox(10.,10.,10.) -Box_7 = shaperpy.makeBox(10.,10.,10.) -Box_8 = shaperpy.makeBox(10.,10.,10.) -Box_9 = shaperpy.makeBox(10.,10.,10.) -Box_10 = shaperpy.makeBox(10.,10.,10.) -Box_11 = shaperpy.makeBox(10.,10.,10.) -Box_12 = shaperpy.makeBox(10.,10.,10.) -Box_13 = shaperpy.makeBox(10.,10.,10.) -Box_14 = shaperpy.makeBox(10.,10.,10.) -Box_15 = shaperpy.makeBox(10.,10.,10.) +Box_1 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_2 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_3 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_4 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_5 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_6 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_7 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_8 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_9 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_10 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_11 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_12 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_13 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_14 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_15 = shaperpy.makeBox(10.0, 10.0, 10.0) # Points -pntOrigin = pnt(0.,0.,0.) -pnt1 = pnt(20.,0.,0.) -pnt2 = pnt(20.,20.,0.) -pnt3 = pnt(-10.,0.,0.) +pntOrigin = pnt(0.0, 0.0, 0.0) +pnt1 = pnt(20.0, 0.0, 0.0) +pnt2 = pnt(20.0, 20.0, 0.0) +pnt3 = pnt(-10.0, 0.0, 0.0) # Axis -zDir = direction(0., 0., 10.) +zDir = direction(0.0, 0.0, 10.0) ax1 = axis(pntOrigin, zDir) @@ -59,22 +59,22 @@ Rotation_4 = shaperpy.makeRotation(Box_4, ax1, -360) try: Rotation_5 = shaperpy.makeRotation(Box_5, ax1, 450) except myExcept as ec: - assert(ec.what() == "Rotation builder :: angle greater than 360 degrees.") + assert ec.what() == "Rotation builder :: angle greater than 360 degrees." try: Rotation_6 = shaperpy.makeRotation(Box_6, ax1, -450) except myExcept as ec: - assert(ec.what() == "Rotation builder :: angle smaller than -360 degrees.") + assert ec.what() == "Rotation builder :: angle smaller than -360 degrees." try: Rotation_7 = shaperpy.makeRotation(Box_7, None, 180) except myExcept as ec: - assert(ec.what() == "Rotation builder :: axis is not valid.") + assert ec.what() == "Rotation builder :: axis is not valid." try: Rotation_8 = shaperpy.makeRotation(None, ax1, 180) except myExcept as ec: - assert(ec.what() == "Transformation :: incorrect input data.") + assert ec.what() == "Transformation :: incorrect input data." Rotation_9 = shaperpy.makeRotation(Box_8, pntOrigin, pnt1, pnt2) Rotation_10 = shaperpy.makeRotation(Box_9, pnt3, pnt1, pnt2) @@ -82,39 +82,41 @@ Rotation_10 = shaperpy.makeRotation(Box_9, pnt3, pnt1, pnt2) try: Rotation_11 = shaperpy.makeRotation(Box_10, pnt3, pnt1, pnt1) except myExcept as ec: - assert(ec.what() == "Rotation builder :: start point and end point coincide.") + assert ec.what() == "Rotation builder :: start point and end point coincide." try: Rotation_12 = shaperpy.makeRotation(Box_11, pnt3, pnt3, pnt1) except myExcept as ec: - assert(ec.what() == "Rotation builder :: center point and start point coincide.") + assert ec.what() == "Rotation builder :: center point and start point coincide." try: Rotation_13 = shaperpy.makeRotation(Box_12, pnt3, pnt1, pnt3) except myExcept as ec: - assert(ec.what() == "Rotation builder :: center point and end point coincide.") + assert ec.what() == "Rotation builder :: center point and end point coincide." try: Rotation_14 = shaperpy.makeRotation(Box_13, pntOrigin, pnt1, None) except myExcept as ec: - assert(ec.what() == "Rotation builder :: end point is not valid.") + assert ec.what() == "Rotation builder :: end point is not valid." try: Rotation_15 = shaperpy.makeRotation(Box_14, None, pnt3, pnt2) except myExcept as ec: - assert(ec.what() == "Rotation builder :: center point is not valid.") + assert ec.what() == "Rotation builder :: center point is not valid." try: Rotation_16 = shaperpy.makeRotation(Box_15, pntOrigin, None, pnt1) except myExcept as ec: - assert(ec.what() == "Rotation builder :: start point is not valid.") + assert ec.what() == "Rotation builder :: start point is not valid." try: Rotation_17 = shaperpy.makeRotation(None, pntOrigin, pnt3, pnt2) except myExcept as ec: - assert(ec.what() == "Transformation :: incorrect input data.") + assert ec.what() == "Transformation :: incorrect input data." try: Rotation_18 = shaperpy.makeRotation(shape(), ax1, 450) except myExcept as ec: - assert(ec.what() == "Transformation :: source shape does not contain any actual shape.") + assert ( + ec.what() == "Transformation :: source shape does not contain any actual shape." + ) diff --git a/test.API/SHAPER/Transformations/TestAPI_Scale.py b/test.API/SHAPER/Transformations/TestAPI_Scale.py index f96a14b14..4338431b0 100644 --- a/test.API/SHAPER/Transformations/TestAPI_Scale.py +++ b/test.API/SHAPER/Transformations/TestAPI_Scale.py @@ -22,73 +22,77 @@ from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept from GeomAPI import GeomAPI_Pnt as pnt, GeomAPI_Shape as shape # Create Boxes -Box_1 = shaperpy.makeBox(10.,10.,10.) -Box_2 = shaperpy.makeBox(10.,10.,10.) -Box_3 = shaperpy.makeBox(10.,10.,10.) -Box_4 = shaperpy.makeBox(10.,10.,10.) -Box_5 = shaperpy.makeBox(10.,10.,10.) -Box_6 = shaperpy.makeBox(10.,10.,10.) -Box_7 = shaperpy.makeBox(10.,10.,10.) -Box_8 = shaperpy.makeBox(10.,10.,10.) -Box_9 = shaperpy.makeBox(10.,10.,10.) -Box_10 = shaperpy.makeBox(10.,10.,10.) -Box_11 = shaperpy.makeBox(10.,10.,10.) -Box_12 = shaperpy.makeBox(10.,10.,10.) +Box_1 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_2 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_3 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_4 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_5 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_6 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_7 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_8 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_9 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_10 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_11 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_12 = shaperpy.makeBox(10.0, 10.0, 10.0) # Create Points -pntOrigin = pnt(0., 0., 0.) -pnt1 = pnt(-10., -10., -10.) +pntOrigin = pnt(0.0, 0.0, 0.0) +pnt1 = pnt(-10.0, -10.0, -10.0) # Create Scales -Scale_1 = shaperpy.makeScale(Box_1, pntOrigin, 2.) -Scale_2 = shaperpy.makeScale(Box_2, pnt1, 2.) -try : +Scale_1 = shaperpy.makeScale(Box_1, pntOrigin, 2.0) +Scale_2 = shaperpy.makeScale(Box_2, pnt1, 2.0) +try: Scale_6 = shaperpy.makeScale(Box_3, pntOrigin, 0) -except myExcept as ec : - assert(ec.what() == "Scale builder :: the scale factor is null.") +except myExcept as ec: + assert ec.what() == "Scale builder :: the scale factor is null." -Scale_7 = shaperpy.makeScale(Box_4, pntOrigin, -3.) +Scale_7 = shaperpy.makeScale(Box_4, pntOrigin, -3.0) -try : - Scale_8 = shaperpy.makeScale(Box_5, None, 2.) -except myExcept as ec : - assert(ec.what() == "Scale builder :: center point is not valid.") +try: + Scale_8 = shaperpy.makeScale(Box_5, None, 2.0) +except myExcept as ec: + assert ec.what() == "Scale builder :: center point is not valid." -Scale_9 = shaperpy.makeScale(Box_6, pntOrigin, 2., 3., 1.) -Scale_10 = shaperpy.makeScale(Box_7, pnt1, 2., 3., 1.) +Scale_9 = shaperpy.makeScale(Box_6, pntOrigin, 2.0, 3.0, 1.0) +Scale_10 = shaperpy.makeScale(Box_7, pnt1, 2.0, 3.0, 1.0) -try : - Scale_14 = shaperpy.makeScale(Box_8, pntOrigin, 0., 3., 1.) -except myExcept as ec : - assert(ec.what() == "Scale builder :: the scale factor in X is null.") -try : - Scale_15 = shaperpy.makeScale(Box_9, pntOrigin, 2., 0., 1.) -except myExcept as ec : - assert(ec.what() == "Scale builder :: the scale factor in Y is null.") -try : - Scale_16 = shaperpy.makeScale(Box_10, pntOrigin, 2., 3., 0.) -except myExcept as ec : - assert(ec.what() == "Scale builder :: the scale factor in Z is null.") +try: + Scale_14 = shaperpy.makeScale(Box_8, pntOrigin, 0.0, 3.0, 1.0) +except myExcept as ec: + assert ec.what() == "Scale builder :: the scale factor in X is null." +try: + Scale_15 = shaperpy.makeScale(Box_9, pntOrigin, 2.0, 0.0, 1.0) +except myExcept as ec: + assert ec.what() == "Scale builder :: the scale factor in Y is null." +try: + Scale_16 = shaperpy.makeScale(Box_10, pntOrigin, 2.0, 3.0, 0.0) +except myExcept as ec: + assert ec.what() == "Scale builder :: the scale factor in Z is null." -Scale_17 = shaperpy.makeScale(Box_11, pntOrigin, -2., -3., 0.5) +Scale_17 = shaperpy.makeScale(Box_11, pntOrigin, -2.0, -3.0, 0.5) -try : - Scale_18 = shaperpy.makeScale(Box_12, None, 2., 3., 1.) -except myExcept as ec : - assert(ec.what() == "Scale builder :: center point is not valid.") +try: + Scale_18 = shaperpy.makeScale(Box_12, None, 2.0, 3.0, 1.0) +except myExcept as ec: + assert ec.what() == "Scale builder :: center point is not valid." -try : - Scale_19 = shaperpy.makeScale(None, pntOrigin, 2., 3., 1.) -except myExcept as ec : - assert(ec.what() == "Scale builder :: source shape is not valid.") +try: + Scale_19 = shaperpy.makeScale(None, pntOrigin, 2.0, 3.0, 1.0) +except myExcept as ec: + assert ec.what() == "Scale builder :: source shape is not valid." -try : - Scale_20 = shaperpy.makeScale(shape(), pntOrigin, 2.) -except myExcept as ec : - assert(ec.what() == "Transformation :: source shape does not contain any actual shape.") +try: + Scale_20 = shaperpy.makeScale(shape(), pntOrigin, 2.0) +except myExcept as ec: + assert ( + ec.what() == "Transformation :: source shape does not contain any actual shape." + ) -try : - Scale_21 = shaperpy.makeScale(shape(), pntOrigin, 2., 3., 1.) -except myExcept as ec : - assert(ec.what() == "Scale builder :: source shape does not contain any actual shape.") +try: + Scale_21 = shaperpy.makeScale(shape(), pntOrigin, 2.0, 3.0, 1.0) +except myExcept as ec: + assert ( + ec.what() == "Scale builder :: source shape does not contain any actual shape." + ) diff --git a/test.API/SHAPER/Transformations/TestAPI_Symmetry.py b/test.API/SHAPER/Transformations/TestAPI_Symmetry.py index 59c93b37d..d8857e069 100644 --- a/test.API/SHAPER/Transformations/TestAPI_Symmetry.py +++ b/test.API/SHAPER/Transformations/TestAPI_Symmetry.py @@ -26,34 +26,34 @@ from GeomAPI import GeomAPI_Ax2 as plane from GeomAPI import GeomAPI_Shape as shape # Create boxes -Box_1 = shaperpy.makeBox(10., 10., 10.) -Box_2 = shaperpy.makeBox(10., 10., 10.) -Box_3 = shaperpy.makeBox(10., 10., 10.) -Box_4 = shaperpy.makeBox(10., 10., 10.) -Box_5 = shaperpy.makeBox(10., 10., 10.) -Box_6 = shaperpy.makeBox(10., 10., 10.) -Box_7 = shaperpy.makeBox(10., 10., 10.) -Box_8 = shaperpy.makeBox(10., 10., 10.) -Box_9 = shaperpy.makeBox(10., 10., 10.) -Box_10 = shaperpy.makeBox(10., 10., 10.) -Box_11 = shaperpy.makeBox(10., 10., 10.) -Box_12 = shaperpy.makeBox(10., 10., 10.) -Box_13 = shaperpy.makeBox(10., 10., 10.) -Box_14 = shaperpy.makeBox(10., 10., 10.) -Box_15 = shaperpy.makeBox(10., 10., 10.) -Box_16 = shaperpy.makeBox(10., 10., 10.) -Box_17 = shaperpy.makeBox(10., 10., 10.) -Box_18 = shaperpy.makeBox(10., 10., 10.) +Box_1 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_2 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_3 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_4 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_5 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_6 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_7 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_8 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_9 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_10 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_11 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_12 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_13 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_14 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_15 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_16 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_17 = shaperpy.makeBox(10.0, 10.0, 10.0) +Box_18 = shaperpy.makeBox(10.0, 10.0, 10.0) # Create points -origin = pnt(0., 0., 0.) -pnt1 = pnt(-10., -10., -10) +origin = pnt(0.0, 0.0, 0.0) +pnt1 = pnt(-10.0, -10.0, -10) # Create Axis -dirZ = direction(0., 0., 10.) +dirZ = direction(0.0, 0.0, 10.0) axZ = axis(origin, dirZ) -dir1 = direction(10., 10., 10.) +dir1 = direction(10.0, 10.0, 10.0) ax1 = axis(origin, dir1) # Create Planes @@ -62,31 +62,33 @@ planeXOY = plane(origin, dirZ) Symmetry_1 = shaperpy.makeSymmetry(Box_1, origin) Symmetry_2 = shaperpy.makeSymmetry(Box_2, pnt1) -try : +try: Symmetry_3 = shaperpy.makeSymmetry(Box_3, None) -except myExcept as ec : - assert(ec.what() == "Symmetry builder :: point is not valid.") +except myExcept as ec: + assert ec.what() == "Symmetry builder :: point is not valid." Symmetry_4 = shaperpy.makeSymmetry(Box_4, axZ) Symmetry_5 = shaperpy.makeSymmetry(Box_5, ax1) Symmetry_6 = shaperpy.makeSymmetry(Box_6, planeXOY) -try : +try: Symmetry_7 = shaperpy.makeSymmetry(None, pnt1) -except myExcept as ec : - assert(ec.what() == "Transformation :: incorrect input data.") +except myExcept as ec: + assert ec.what() == "Transformation :: incorrect input data." -try : +try: Symmetry_8 = shaperpy.makeSymmetry(None, axZ) -except myExcept as ec : - assert(ec.what() == "Transformation :: incorrect input data.") +except myExcept as ec: + assert ec.what() == "Transformation :: incorrect input data." -try : +try: Symmetry_9 = shaperpy.makeSymmetry(None, planeXOY) -except myExcept as ec : - assert(ec.what() == "Transformation :: incorrect input data.") +except myExcept as ec: + assert ec.what() == "Transformation :: incorrect input data." -try : +try: Symmetry_10 = shaperpy.makeSymmetry(shape(), pnt1) -except myExcept as ec : - assert(ec.what() == "Transformation :: source shape does not contain any actual shape.") +except myExcept as ec: + assert ( + ec.what() == "Transformation :: source shape does not contain any actual shape." + ) diff --git a/test.API/SHAPER/Transformations/TestAPI_Translation.py b/test.API/SHAPER/Transformations/TestAPI_Translation.py index 9ec0ee70d..a88532bd0 100644 --- a/test.API/SHAPER/Transformations/TestAPI_Translation.py +++ b/test.API/SHAPER/Transformations/TestAPI_Translation.py @@ -25,81 +25,81 @@ from GeomAPI import GeomAPI_Dir as direction from GeomAPI import GeomAPI_Shape as shape # Points -pntOrigin = pnt(0.,0.,0.) -pnt1 = pnt(10.,0.,0.) -pnt2 = pnt(10.,10.,0.) +pntOrigin = pnt(0.0, 0.0, 0.0) +pnt1 = pnt(10.0, 0.0, 0.0) +pnt2 = pnt(10.0, 10.0, 0.0) # Axis -xDir = direction(10., 0., 0.) +xDir = direction(10.0, 0.0, 0.0) ax1 = axis(pntOrigin, xDir) -yDir = direction(0., 10., 0.) +yDir = direction(0.0, 10.0, 0.0) ax2 = axis(pntOrigin, yDir) -zDir = direction(0., 0., 10.) +zDir = direction(0.0, 0.0, 10.0) ax3 = axis(pntOrigin, zDir) -dir1 = direction(10., 10., 10.) +dir1 = direction(10.0, 10.0, 10.0) ax4 = axis(pntOrigin, dir1) # Boxes -Box_1 = shaperpy.makeBox(10., 20., 10.) -Box_2 = shaperpy.makeBox(10., 20., 10.) -Box_3 = shaperpy.makeBox(10., 20., 10.) -Box_4 = shaperpy.makeBox(10., 20., 10.) -Box_5 = shaperpy.makeBox(10., 20., 10.) -Box_6 = shaperpy.makeBox(10., 20., 10.) -Box_7 = shaperpy.makeBox(10., 20., 10.) -Box_8 = shaperpy.makeBox(10., 20., 10.) -Box_9 = shaperpy.makeBox(10., 20., 10.) -Box_10 = shaperpy.makeBox(10., 20., 10.) -Box_11 = shaperpy.makeBox(10., 20., 10.) -Box_12 = shaperpy.makeBox(10., 20., 10.) -Box_13 = shaperpy.makeBox(10., 20., 10.) -Box_14 = shaperpy.makeBox(10., 20., 10.) -Box_15 = shaperpy.makeBox(10., 20., 10.) -Box_16 = shaperpy.makeBox(10., 20., 10.) -Box_17 = shaperpy.makeBox(10., 20., 10.) -Box_18 = shaperpy.makeBox(10., 20., 10.) - -#Translations "By an axis and a distance" -Translation_1 = shaperpy.makeTranslation(Box_1, ax1, 15.) -Translation_2 = shaperpy.makeTranslation(Box_2, ax1, 0.) -Translation_3 = shaperpy.makeTranslation(Box_3, ax1, -15.) +Box_1 = shaperpy.makeBox(10.0, 20.0, 10.0) +Box_2 = shaperpy.makeBox(10.0, 20.0, 10.0) +Box_3 = shaperpy.makeBox(10.0, 20.0, 10.0) +Box_4 = shaperpy.makeBox(10.0, 20.0, 10.0) +Box_5 = shaperpy.makeBox(10.0, 20.0, 10.0) +Box_6 = shaperpy.makeBox(10.0, 20.0, 10.0) +Box_7 = shaperpy.makeBox(10.0, 20.0, 10.0) +Box_8 = shaperpy.makeBox(10.0, 20.0, 10.0) +Box_9 = shaperpy.makeBox(10.0, 20.0, 10.0) +Box_10 = shaperpy.makeBox(10.0, 20.0, 10.0) +Box_11 = shaperpy.makeBox(10.0, 20.0, 10.0) +Box_12 = shaperpy.makeBox(10.0, 20.0, 10.0) +Box_13 = shaperpy.makeBox(10.0, 20.0, 10.0) +Box_14 = shaperpy.makeBox(10.0, 20.0, 10.0) +Box_15 = shaperpy.makeBox(10.0, 20.0, 10.0) +Box_16 = shaperpy.makeBox(10.0, 20.0, 10.0) +Box_17 = shaperpy.makeBox(10.0, 20.0, 10.0) +Box_18 = shaperpy.makeBox(10.0, 20.0, 10.0) + +# Translations "By an axis and a distance" +Translation_1 = shaperpy.makeTranslation(Box_1, ax1, 15.0) +Translation_2 = shaperpy.makeTranslation(Box_2, ax1, 0.0) +Translation_3 = shaperpy.makeTranslation(Box_3, ax1, -15.0) try: - Translation_4 = shaperpy.makeTranslation(Box_4, None, 15.) + Translation_4 = shaperpy.makeTranslation(Box_4, None, 15.0) except myExcept as ec: - assert(ec.what() == "Translation builder :: axis is not valid.") + assert ec.what() == "Translation builder :: axis is not valid." -Translation_5 = shaperpy.makeTranslation(Box_5, ax4, 15.) +Translation_5 = shaperpy.makeTranslation(Box_5, ax4, 15.0) -MultiTranslation_1 = shaperpy.makeMultiTranslation(Box_6, ax1, 15., 3, ax2, 15., 3) -Translation_6 = shaperpy.makeTranslation(MultiTranslation_1, ax3, 15.) +MultiTranslation_1 = shaperpy.makeMultiTranslation(Box_6, ax1, 15.0, 3, ax2, 15.0, 3) +Translation_6 = shaperpy.makeTranslation(MultiTranslation_1, ax3, 15.0) -MultiTranslation_2 = shaperpy.makeMultiTranslation(Box_7, ax1, 15., 3, ax2, 15., 3) -Translation_7 = shaperpy.makeTranslation(MultiTranslation_2, ax3, 0.) +MultiTranslation_2 = shaperpy.makeMultiTranslation(Box_7, ax1, 15.0, 3, ax2, 15.0, 3) +Translation_7 = shaperpy.makeTranslation(MultiTranslation_2, ax3, 0.0) -MultiTranslation_3 = shaperpy.makeMultiTranslation(Box_8, ax1, 15., 3, ax2, 15., 3) -Translation_8 = shaperpy.makeTranslation(MultiTranslation_3, ax3, -15.) +MultiTranslation_3 = shaperpy.makeMultiTranslation(Box_8, ax1, 15.0, 3, ax2, 15.0, 3) +Translation_8 = shaperpy.makeTranslation(MultiTranslation_3, ax3, -15.0) -MultiTranslation_4 = shaperpy.makeMultiTranslation(Box_9, ax1, 15., 3, ax2, 15., 3) +MultiTranslation_4 = shaperpy.makeMultiTranslation(Box_9, ax1, 15.0, 3, ax2, 15.0, 3) try: - Translation_9 = shaperpy.makeTranslation(MultiTranslation_4, None, 15.) + Translation_9 = shaperpy.makeTranslation(MultiTranslation_4, None, 15.0) except myExcept as ec: - assert(ec.what() == "Translation builder :: axis is not valid.") + assert ec.what() == "Translation builder :: axis is not valid." -MultiTranslation_5 = shaperpy.makeMultiTranslation(Box_10, ax1, 15., 3, ax2, 15., 3) -Translation_10 = shaperpy.makeTranslation(MultiTranslation_5, ax4, 15.) +MultiTranslation_5 = shaperpy.makeMultiTranslation(Box_10, ax1, 15.0, 3, ax2, 15.0, 3) +Translation_10 = shaperpy.makeTranslation(MultiTranslation_5, ax4, 15.0) # Translations "By dimensions in X, in Y and in Z" -Translation_11 = shaperpy.makeTranslation(Box_11, 10., 20., 15.) -Translation_12 = shaperpy.makeTranslation(Box_11, 0., 20., 15.) -Translation_13 = shaperpy.makeTranslation(Box_11, 10., 0., 15.) -Translation_14 = shaperpy.makeTranslation(Box_11, 10., 20., 0.) -Translation_15 = shaperpy.makeTranslation(Box_11, -10., 20., 15.) -Translation_16 = shaperpy.makeTranslation(Box_11, 10., -20., 15.) -Translation_17 = shaperpy.makeTranslation(Box_11, 10., 20., -15.) +Translation_11 = shaperpy.makeTranslation(Box_11, 10.0, 20.0, 15.0) +Translation_12 = shaperpy.makeTranslation(Box_11, 0.0, 20.0, 15.0) +Translation_13 = shaperpy.makeTranslation(Box_11, 10.0, 0.0, 15.0) +Translation_14 = shaperpy.makeTranslation(Box_11, 10.0, 20.0, 0.0) +Translation_15 = shaperpy.makeTranslation(Box_11, -10.0, 20.0, 15.0) +Translation_16 = shaperpy.makeTranslation(Box_11, 10.0, -20.0, 15.0) +Translation_17 = shaperpy.makeTranslation(Box_11, 10.0, 20.0, -15.0) # Translations "By two points" Translation_18 = shaperpy.makeTranslation(Box_11, pnt1, pnt2) @@ -107,34 +107,36 @@ Translation_18 = shaperpy.makeTranslation(Box_11, pnt1, pnt2) try: Translation_19 = shaperpy.makeTranslation(Box_11, pnt1, pnt1) except myExcept as ec: - assert(ec.what() == "Translation builder :: start point and end point coincide.") + assert ec.what() == "Translation builder :: start point and end point coincide." try: Translation_20 = shaperpy.makeTranslation(Box_11, None, pnt1) except myExcept as ec: - assert(ec.what() == "Translation builder :: start point is not valid.") + assert ec.what() == "Translation builder :: start point is not valid." try: Translation_21 = shaperpy.makeTranslation(Box_11, pnt1, None) except myExcept as ec: - assert(ec.what() == "Translation builder :: end point is not valid.") + assert ec.what() == "Translation builder :: end point is not valid." try: - Translation_22 = shaperpy.makeTranslation(None, ax1, 15.) + Translation_22 = shaperpy.makeTranslation(None, ax1, 15.0) except myExcept as ec: - assert(ec.what() == "Transformation :: incorrect input data.") + assert ec.what() == "Transformation :: incorrect input data." try: - Translation_23 = shaperpy.makeTranslation(None, 10., 20., 15.) + Translation_23 = shaperpy.makeTranslation(None, 10.0, 20.0, 15.0) except myExcept as ec: - assert(ec.what() == "Transformation :: incorrect input data.") + assert ec.what() == "Transformation :: incorrect input data." try: Translation_24 = shaperpy.makeTranslation(None, pnt1, pnt2) except myExcept as ec: - assert(ec.what() == "Transformation :: incorrect input data.") + assert ec.what() == "Transformation :: incorrect input data." try: - Translation_25 = shaperpy.makeTranslation(shape(), ax1, 15.) + Translation_25 = shaperpy.makeTranslation(shape(), ax1, 15.0) except myExcept as ec: - assert(ec.what() == "Transformation :: source shape does not contain any actual shape.") + assert ( + ec.what() == "Transformation :: source shape does not contain any actual shape." + ) diff --git a/test.API/SHAPER/Transformations/TestMultiRotation.py b/test.API/SHAPER/Transformations/TestMultiRotation.py index 489f34955..1726a7e56 100644 --- a/test.API/SHAPER/Transformations/TestMultiRotation.py +++ b/test.API/SHAPER/Transformations/TestMultiRotation.py @@ -29,7 +29,7 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -#Init +# Init Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Box_2 = model.addBox(Part_1_doc, 10, 10, 10) Box_3 = model.addBox(Part_1_doc, 10, 10, 10) @@ -39,12 +39,41 @@ Box_6 = model.addBox(Part_1_doc, 10, 10, 10) Axis_1 = model.selection("EDGE", "edge") # Tests -MultiRotation_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OZ"), 5) -MultiRotation_2 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("EDGE", "PartSet/OZ"), 0) -MultiRotation_3 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("EDGE", "PartSet/OZ"), -3) -MultiRotation_4 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Box_4_1")], model.selection("EDGE", "PartSet/OY"), 90, 4) -MultiRotation_5 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Box_5_1")], model.selection("EDGE", "PartSet/OY"), -75, 4) -MultiRotation_6 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Box_6_1")], Axis_1, 4) +MultiRotation_1 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 5, +) +MultiRotation_2 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Box_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 0, +) +MultiRotation_3 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OZ"), + -3, +) +MultiRotation_4 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Box_4_1")], + model.selection("EDGE", "PartSet/OY"), + 90, + 4, +) +MultiRotation_5 = model.addMultiRotation( + Part_1_doc, + [model.selection("SOLID", "Box_5_1")], + model.selection("EDGE", "PartSet/OY"), + -75, + 4, +) +MultiRotation_6 = model.addMultiRotation( + Part_1_doc, [model.selection("SOLID", "Box_6_1")], Axis_1, 4 +) model.do() model.end() @@ -74,10 +103,18 @@ model.testNbSubShapes(MultiRotation_5, GeomAPI_Shape.FACE, [24]) model.testHaveNamingFaces(MultiRotation_5, model, Part_1_doc) model.testNbResults(MultiRotation_2, 0) -assert(MultiRotation_2.feature().error() == "Multirotation builder :: the number of copies for the angular direction is null or negative.") +assert ( + MultiRotation_2.feature().error() + == "Multirotation builder :: the number of copies for the angular direction is null or negative." +) model.testNbResults(MultiRotation_3, 0) -assert(MultiRotation_3.feature().error() == "Multirotation builder :: the number of copies for the angular direction is null or negative.") +assert ( + MultiRotation_3.feature().error() + == "Multirotation builder :: the number of copies for the angular direction is null or negative." +) model.testNbResults(MultiRotation_6, 0) -assert(MultiRotation_6.feature().error() == "Attribute \"axis_angular\" is not initialized.") +assert ( + MultiRotation_6.feature().error() == 'Attribute "axis_angular" is not initialized.' +) diff --git a/test.API/SHAPER/Transformations/TestMultiTranslation.py b/test.API/SHAPER/Transformations/TestMultiTranslation.py index cc6c7b88a..8a421a06b 100644 --- a/test.API/SHAPER/Transformations/TestMultiTranslation.py +++ b/test.API/SHAPER/Transformations/TestMultiTranslation.py @@ -42,41 +42,143 @@ Box_9 = model.addBox(Part_1_doc, 10, 10, 10) # Create Sketches # Sketch contenant un contour ferme de 3 lignes Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(20.57127738485033, 88.55774147773481, -110.037034305799, -25.45393392073257) -SketchLine_2 = Sketch_1.addLine(-110.037034305799, -25.45393392073257, 49.43499267560162, -77.40862144408482) -SketchLine_3 = Sketch_1.addLine(49.43499267560162, -77.40862144408482, 68.1964076145899, 55.3644688933709) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_1 = Sketch_1.addLine( + 20.57127738485033, 88.55774147773481, -110.037034305799, -25.45393392073257 +) +SketchLine_2 = Sketch_1.addLine( + -110.037034305799, -25.45393392073257, 49.43499267560162, -77.40862144408482 +) +SketchLine_3 = Sketch_1.addLine( + 49.43499267560162, -77.40862144408482, 68.1964076145899, 55.3644688933709 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) # Sketch creer sur la face de la box confondue avec le plan XOZ contenant un cercle inclus dans la face de la box Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_9_1/Left")) -SketchCircle_1 = Sketch_2.addCircle(3.420516499282639, 6.702654232424678, 2.660489383382409) +SketchCircle_1 = Sketch_2.addCircle( + 3.420516499282639, 6.702654232424678, 2.660489383382409 +) model.do() # Create Wire & Extrusion -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) +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/Face-SketchCircle_1_2r_wire")], 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) -MultiTranslation_2 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("EDGE", "PartSet/OX"), -15, 5) -MultiTranslation_3 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("EDGE", "PartSet/OX"), 15, -2) -MultiTranslation_4 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_4_1")], model.selection("EDGE", "InvalidName"), 15, -2) -MultiTranslation_5 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_5_1")], model.selection("EDGE", "PartSet/OX"), 10, 5, model.selection("EDGE", "PartSet/OY"), 10, 5) -MultiTranslation_6 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_6_1")], model.selection("EDGE", "PartSet/OX"), 10, 5, model.selection("EDGE", "PartSet/OY"), -10, 5) -MultiTranslation_7 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_7_1")], model.selection("EDGE", "PartSet/OX"), 10, 5, model.selection("EDGE", "PartSet/OY"), 10, -2) -MultiTranslation_8 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_8_1")], model.selection("EDGE", "PartSet/OX"), 10, 5, model.selection("EDGE", "InvalidName"), 10, 5) -MultiTranslation_9 = model.addMultiTranslation(Part_1_doc, [model.selection("SHELL", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OZ"), 50, 10) -MultiTranslation_10 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Revolution_1_1"), model.selection("SOLID", "Box_9_1")], model.selection("EDGE", "PartSet/OY"), 20, 3) +MultiTranslation_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 15, + 5, +) +MultiTranslation_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_2_1")], + model.selection("EDGE", "PartSet/OX"), + -15, + 5, +) +MultiTranslation_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OX"), + 15, + -2, +) +MultiTranslation_4 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_4_1")], + model.selection("EDGE", "InvalidName"), + 15, + -2, +) +MultiTranslation_5 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_5_1")], + model.selection("EDGE", "PartSet/OX"), + 10, + 5, + model.selection("EDGE", "PartSet/OY"), + 10, + 5, +) +MultiTranslation_6 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_6_1")], + model.selection("EDGE", "PartSet/OX"), + 10, + 5, + model.selection("EDGE", "PartSet/OY"), + -10, + 5, +) +MultiTranslation_7 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_7_1")], + model.selection("EDGE", "PartSet/OX"), + 10, + 5, + model.selection("EDGE", "PartSet/OY"), + 10, + -2, +) +MultiTranslation_8 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_8_1")], + model.selection("EDGE", "PartSet/OX"), + 10, + 5, + model.selection("EDGE", "InvalidName"), + 10, + 5, +) +MultiTranslation_9 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SHELL", "Extrusion_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 50, + 10, +) +MultiTranslation_10 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Revolution_1_1"), model.selection("SOLID", "Box_9_1")], + model.selection("EDGE", "PartSet/OY"), + 20, + 3, +) model.do() model.end() - # Checks from GeomAPI import GeomAPI_Shape, GeomAPI_ShapeExplorer from GeomAlgoAPI import * @@ -114,7 +216,10 @@ model.testHaveNamingFaces(MultiTranslation_6, model, Part_1_doc) model.testNbResults(MultiTranslation_10, 2) model.testNbSubResults(MultiTranslation_10, [3, 3]) -def testSubResult(theFeature, theModel, thePartDoc, resultIndex, nbSolidsExpected, nbFacesExpected): + +def testSubResult( + theFeature, theModel, thePartDoc, resultIndex, nbSolidsExpected, nbFacesExpected +): result = theFeature.results()[resultIndex].resultSubShapePair()[0] shape = result.shape() shapeExplorer = GeomAPI_ShapeExplorer(shape, GeomAPI_Shape.SOLID) @@ -122,17 +227,19 @@ def testSubResult(theFeature, theModel, thePartDoc, resultIndex, nbSolidsExpecte while shapeExplorer.more(): nbSolids += 1 shapeExplorer.next() - assert(nbSolids == nbSolidsExpected) + assert nbSolids == nbSolidsExpected shapeExplorer = GeomAPI_ShapeExplorer(shape, GeomAPI_Shape.FACE) nbFaces = 0 selectionList = [] while shapeExplorer.more(): nbFaces += 1 - selection = theModel.selection(result, shapeExplorer.current()) # First argument should be result/sub-result, second is sub-shape on this result/sub-result + selection = theModel.selection( + result, shapeExplorer.current() + ) # First argument should be result/sub-result, second is sub-shape on this result/sub-result selectionList.append(selection) shapeExplorer.next() - assert(nbFaces == nbFacesExpected) + assert nbFaces == nbFacesExpected # Create group with this selection list Group_1 = theModel.addGroup(thePartDoc, selectionList) theModel.do() @@ -142,36 +249,49 @@ def testSubResult(theFeature, theModel, thePartDoc, resultIndex, nbSolidsExpecte groupFeature = Group_1.feature() groupSelectionList = groupFeature.selectionList("group_list") theModel.end() - assert(groupSelectionList.size() == len(selectionList)) + assert groupSelectionList.size() == len(selectionList) for index in range(0, groupSelectionList.size()): attrSelection = groupSelectionList.value(index) shape = attrSelection.value() name = attrSelection.namingName() - assert(shape.isFace()) - assert(name != ""), "String empty" + assert shape.isFace() + assert name != "", "String empty" + testSubResult(MultiTranslation_10, model, Part_1_doc, 0, 3, 3) testSubResult(MultiTranslation_10, model, Part_1_doc, 1, 3, 18) #################################################################################################### model.testNbResults(MultiTranslation_3, 0) -assert(MultiTranslation_3.feature().error() == 'Multitranslation builder :: the number of copies for the first direction is null or negative.') +assert ( + MultiTranslation_3.feature().error() + == "Multitranslation builder :: the number of copies for the first direction is null or negative." +) model.testNbResults(MultiTranslation_4, 0) -assert(MultiTranslation_4.feature().error() == 'Attribute "axis_first_dir" is not initialized.') +assert ( + MultiTranslation_4.feature().error() + == 'Attribute "axis_first_dir" is not initialized.' +) model.testNbResults(MultiTranslation_7, 0) -assert(MultiTranslation_7.feature().error() == 'Multitranslation builder :: the number of copies for the second direction is null or negative.') +assert ( + MultiTranslation_7.feature().error() + == "Multitranslation builder :: the number of copies for the second direction is null or negative." +) model.testNbResults(MultiTranslation_8, 0) -assert(MultiTranslation_8.feature().error() == 'Attribute "axis_second_dir" is not initialized.') +assert ( + MultiTranslation_8.feature().error() + == 'Attribute "axis_second_dir" is not initialized.' +) # Multitranslation en erreur -#model.testNbResults(MultiTranslation_9, 1) -#model.testNbSubResults(MultiTranslation_9, [10]) -#model.testNbSubShapes(MultiTranslation_9, GeomAPI_Shape.COMPOUND, [1]) -#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) +# model.testNbResults(MultiTranslation_9, 1) +# model.testNbSubResults(MultiTranslation_9, [10]) +# model.testNbSubShapes(MultiTranslation_9, GeomAPI_Shape.COMPOUND, [1]) +# 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) diff --git a/test.API/SHAPER/Transformations/TestRotation.py b/test.API/SHAPER/Transformations/TestRotation.py index 311a4b7e9..d07678927 100644 --- a/test.API/SHAPER/Transformations/TestRotation.py +++ b/test.API/SHAPER/Transformations/TestRotation.py @@ -54,37 +54,140 @@ Point_3 = model.addPoint(Part_1_doc, -10, 0, 0) Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_16 = model.addBox(Part_2_doc, 10, 10, 10) -Cylinder_1 = model.addCylinder(Part_2_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) +Cylinder_1 = model.addCylinder( + Part_2_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) Part_3 = model.addPart(partSet) Part_3_doc = Part_3.document() Box_17 = model.addBox(Part_3_doc, 10, 10, 10) -Cylinder_1 = model.addCylinder(Part_3_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) +Cylinder_1 = model.addCylinder( + Part_3_doc, + model.selection("VERTEX", "PartSet/Origin"), + model.selection("EDGE", "PartSet/OZ"), + 5, + 10, +) Point_4 = model.addPoint(partSet, -10, 0, 0) Point_5 = model.addPoint(partSet, 20, 20, 0) model.do() # Create Rotations -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OZ"), 45) -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("EDGE", "PartSet/OZ"), 0) -Rotation_3 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("EDGE", "PartSet/OZ"), 360) -Rotation_4 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_4_1")], model.selection("EDGE", "PartSet/OZ"), -360) -Rotation_5 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_5_1")], model.selection("EDGE", "PartSet/OZ"), 450) -Rotation_6 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_6_1")], model.selection("EDGE", "PartSet/OZ"), -450) -Rotation_7 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_7_1")], model.selection("EDGE", "InvalidName"), 180) - -Rotation_9 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_8_1")], model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")) -Rotation_10 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_9_1")], model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")) -Rotation_11 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_10_1")], model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_1")) -Rotation_12 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_11_1")], model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_1")) -Rotation_13 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_12_1")], model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_3")) -Rotation_14 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_13_1")], model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "InvalidName")) -Rotation_15 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_14_1")], model.selection("VERTEX", "InvalidName"), model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_2")) -Rotation_16 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_15_1")], model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "InvalidName"), model.selection("VERTEX", "Point_1")) - -Rotation_18 = model.addRotation(partSet, [model.selection("COMPOUND", "Part_2/")], model.selection("EDGE", "OY"), 90) -Rotation_19 = model.addRotation(partSet, [model.selection("COMPOUND", "Part_3/")], model.selection("VERTEX", "Origin"), model.selection("VERTEX", "Point_2"), model.selection("VERTEX", "Point_3")) +Rotation_1 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OZ"), + 45, +) +Rotation_2 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Box_2_1")], + model.selection("EDGE", "PartSet/OZ"), + 0, +) +Rotation_3 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OZ"), + 360, +) +Rotation_4 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Box_4_1")], + model.selection("EDGE", "PartSet/OZ"), + -360, +) +Rotation_5 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Box_5_1")], + model.selection("EDGE", "PartSet/OZ"), + 450, +) +Rotation_6 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Box_6_1")], + model.selection("EDGE", "PartSet/OZ"), + -450, +) +Rotation_7 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Box_7_1")], + model.selection("EDGE", "InvalidName"), + 180, +) + +Rotation_9 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Box_8_1")], + model.selection("VERTEX", "PartSet/Origin"), + model.selection("VERTEX", "Point_1"), + model.selection("VERTEX", "Point_2"), +) +Rotation_10 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Box_9_1")], + model.selection("VERTEX", "Point_3"), + model.selection("VERTEX", "Point_1"), + model.selection("VERTEX", "Point_2"), +) +Rotation_11 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Box_10_1")], + model.selection("VERTEX", "Point_3"), + model.selection("VERTEX", "Point_1"), + model.selection("VERTEX", "Point_1"), +) +Rotation_12 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Box_11_1")], + model.selection("VERTEX", "Point_3"), + model.selection("VERTEX", "Point_3"), + model.selection("VERTEX", "Point_1"), +) +Rotation_13 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Box_12_1")], + model.selection("VERTEX", "Point_3"), + model.selection("VERTEX", "Point_1"), + model.selection("VERTEX", "Point_3"), +) +Rotation_14 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Box_13_1")], + model.selection("VERTEX", "PartSet/Origin"), + model.selection("VERTEX", "Point_1"), + model.selection("VERTEX", "InvalidName"), +) +Rotation_15 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Box_14_1")], + model.selection("VERTEX", "InvalidName"), + model.selection("VERTEX", "Point_3"), + model.selection("VERTEX", "Point_2"), +) +Rotation_16 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Box_15_1")], + model.selection("VERTEX", "PartSet/Origin"), + model.selection("VERTEX", "InvalidName"), + model.selection("VERTEX", "Point_1"), +) + +Rotation_18 = model.addRotation( + partSet, [model.selection("COMPOUND", "Part_2/")], model.selection("EDGE", "OY"), 90 +) +Rotation_19 = model.addRotation( + partSet, + [model.selection("COMPOUND", "Part_3/")], + model.selection("VERTEX", "Origin"), + model.selection("VERTEX", "Point_2"), + model.selection("VERTEX", "Point_3"), +) model.do() model.end() @@ -148,42 +251,40 @@ model.testNbSubResults(Rotation_19, [0]) # This test is OK because we accept angles greater than 360 -#model.testNbResults(Rotation_5, 0) -#assert(Rotation_5.feature().error() == 'Rotation builder :: angle greater than 360 degrees.') +# model.testNbResults(Rotation_5, 0) +# assert(Rotation_5.feature().error() == 'Rotation builder :: angle greater than 360 degrees.') # This test is OK because we accept angles smaller than 360 -#model.testNbResults(Rotation_6, 0) -#assert(Rotation_6.feature().error() == 'Rotation builder :: angle smaller than -360 degrees.') +# model.testNbResults(Rotation_6, 0) +# assert(Rotation_6.feature().error() == 'Rotation builder :: angle smaller than -360 degrees.') model.testNbResults(Rotation_7, 0) -assert(Rotation_7.feature().error() == 'Attribute "axis_object" is not initialized.') +assert Rotation_7.feature().error() == 'Attribute "axis_object" is not initialized.' model.testNbResults(Rotation_11, 0) -assert(Rotation_11.feature().error() == "The feature uses equal shapes.") +assert Rotation_11.feature().error() == "The feature uses equal shapes." model.testNbResults(Rotation_12, 0) -assert(Rotation_12.feature().error() == "The feature uses equal shapes.") +assert Rotation_12.feature().error() == "The feature uses equal shapes." model.testNbResults(Rotation_13, 0) -assert(Rotation_13.feature().error() == "The feature uses equal shapes.") +assert Rotation_13.feature().error() == "The feature uses equal shapes." model.testNbResults(Rotation_14, 0) -assert(Rotation_14.feature().error() == 'Attribute "end_point" is not initialized.') +assert Rotation_14.feature().error() == 'Attribute "end_point" is not initialized.' model.testNbResults(Rotation_15, 0) -assert(Rotation_15.feature().error() == 'Attribute "center_point" is not initialized.') +assert Rotation_15.feature().error() == 'Attribute "center_point" is not initialized.' model.testNbResults(Rotation_16, 0) -assert(Rotation_16.feature().error() == 'Attribute "start_point" is not initialized.') +assert Rotation_16.feature().error() == 'Attribute "start_point" is not initialized.' +# Rotation_8 = model.addRotation(Part_1_doc, [model.selection("SOLID", "InvalidName")], model.selection("EDGE", "PartSet/OZ"), 180) +# Rotation_17 = model.addRotation(Part_1_doc, [model.selection("SOLID", "InvalidName")], model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_2")) +# model.testNbResults(Rotation_8, 0) +# assert(Rotation_8.feature().error() == 'Attribute "main_object" is not initialized.') -#Rotation_8 = model.addRotation(Part_1_doc, [model.selection("SOLID", "InvalidName")], model.selection("EDGE", "PartSet/OZ"), 180) -#Rotation_17 = model.addRotation(Part_1_doc, [model.selection("SOLID", "InvalidName")], model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_2")) - -#model.testNbResults(Rotation_8, 0) -#assert(Rotation_8.feature().error() == 'Attribute "main_object" is not initialized.') - -#model.testNbResults(Rotation_17, 0) -#assert(Rotation_17.feature().error() == 'Attribute "main_object" is not initialized.') +# model.testNbResults(Rotation_17, 0) +# assert(Rotation_17.feature().error() == 'Attribute "main_object" is not initialized.') diff --git a/test.API/SHAPER/Transformations/TestScale.py b/test.API/SHAPER/Transformations/TestScale.py index 3e81c248f..9d2a5d6b9 100644 --- a/test.API/SHAPER/Transformations/TestScale.py +++ b/test.API/SHAPER/Transformations/TestScale.py @@ -50,51 +50,200 @@ Box_18 = model.addBox(Part_1_doc, 10, 10, 10) # Create Sketches Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(11.50379459310504, -12.39258082761096, 58.75227313132206, 54.23988890577205) +SketchLine_1 = Sketch_1.addLine( + 11.50379459310504, -12.39258082761096, 58.75227313132206, 54.23988890577205 +) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_2 = Sketch_2.addLine(41.58300156386008, 83.65088639460937, -69.84532559339473, 11.87498196448581) -SketchLine_3 = Sketch_2.addLine(-69.84532559339473, 11.87498196448581, -47.25850252097817, -30.78901717230093) -SketchLine_4 = Sketch_2.addLine(-47.25850252097817, -30.78901717230093, 108.3396119778911, -36.812169991612) -SketchLine_5 = Sketch_2.addLine(108.3396119778911, -36.812169991612, 35.05791934293975, 16.39234657896911) -SketchLine_6 = Sketch_2.addLine(35.05791934293975, 16.39234657896911, 41.58300156386008, 83.65088639460937) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchLine_6.endPoint()) +SketchLine_2 = Sketch_2.addLine( + 41.58300156386008, 83.65088639460937, -69.84532559339473, 11.87498196448581 +) +SketchLine_3 = Sketch_2.addLine( + -69.84532559339473, 11.87498196448581, -47.25850252097817, -30.78901717230093 +) +SketchLine_4 = Sketch_2.addLine( + -47.25850252097817, -30.78901717230093, 108.3396119778911, -36.812169991612 +) +SketchLine_5 = Sketch_2.addLine( + 108.3396119778911, -36.812169991612, 35.05791934293975, 16.39234657896911 +) +SketchLine_6 = Sketch_2.addLine( + 35.05791934293975, 16.39234657896911, 41.58300156386008, 83.65088639460937 +) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchLine_2.startPoint(), SketchLine_6.endPoint() +) model.do() # Create Points Point_1 = model.addPoint(Part_1_doc, -10, -10, -10) # Create Vertexes -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex")]) +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/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) +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/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/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) -Scale_16 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_16_1")] , model.selection("VERTEX", "PartSet/Origin"), 2 , 3, 0) -Scale_17 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_17_1")] , model.selection("VERTEX", "PartSet/Origin"), -2 , -3, -0.5) -Scale_18 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_18_1")] , model.selection("VERTEX", "InvalidName"), 2 , 3, 1) -Scale_19 = model.addScale(Part_1_doc, [model.selection("SHELL", "Extrusion_1_1")] , model.selection("VERTEX", "PartSet/Origin"), 5) +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/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/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, +) +Scale_16 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Box_16_1")], + model.selection("VERTEX", "PartSet/Origin"), + 2, + 3, + 0, +) +Scale_17 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Box_17_1")], + model.selection("VERTEX", "PartSet/Origin"), + -2, + -3, + -0.5, +) +Scale_18 = model.addScale( + Part_1_doc, + [model.selection("SOLID", "Box_18_1")], + model.selection("VERTEX", "InvalidName"), + 2, + 3, + 1, +) +Scale_19 = model.addScale( + Part_1_doc, + [model.selection("SHELL", "Extrusion_1_1")], + model.selection("VERTEX", "PartSet/Origin"), + 5, +) model.do() model.end() @@ -177,27 +326,39 @@ model.testHaveNamingFaces(Scale_17, model, Part_1_doc) model.testNbResults(Scale_6, 0) -assert(Scale_6.feature().error() == 'Error: Scale algorithm failed. Scale builder :: the scale factor is null.') +assert ( + Scale_6.feature().error() + == "Error: Scale algorithm failed. Scale builder :: the scale factor is null." +) model.testNbResults(Scale_8, 0) -assert(Scale_8.feature().error() == 'Attribute "center_point" is not initialized.') +assert Scale_8.feature().error() == 'Attribute "center_point" is not initialized.' model.testNbResults(Scale_14, 0) -assert(Scale_14.feature().error() == 'Error: Scale algorithm failed. Scale builder :: the scale factor in X is null.') +assert ( + Scale_14.feature().error() + == "Error: Scale algorithm failed. Scale builder :: the scale factor in X is null." +) model.testNbResults(Scale_15, 0) -assert(Scale_15.feature().error() == 'Error: Scale algorithm failed. Scale builder :: the scale factor in Y is null.') +assert ( + Scale_15.feature().error() + == "Error: Scale algorithm failed. Scale builder :: the scale factor in Y is null." +) model.testNbResults(Scale_16, 0) -assert(Scale_16.feature().error() == 'Error: Scale algorithm failed. Scale builder :: the scale factor in Z is null.') +assert ( + Scale_16.feature().error() + == "Error: Scale algorithm failed. Scale builder :: the scale factor in Z is null." +) model.testNbResults(Scale_18, 0) -assert(Scale_18.feature().error() == 'Attribute "center_point" is not initialized.') +assert Scale_18.feature().error() == 'Attribute "center_point" is not initialized.' # To uncomment when #2046 will be performed -#model.testNbResults(Scale_19, 1) -#model.testNbSubResults(Scale_19, [0]) -#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) +# model.testNbResults(Scale_19, 1) +# model.testNbSubResults(Scale_19, [0]) +# 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) diff --git a/test.API/SHAPER/Transformations/TestSymmetry.py b/test.API/SHAPER/Transformations/TestSymmetry.py index cd7371f0a..0889a3729 100644 --- a/test.API/SHAPER/Transformations/TestSymmetry.py +++ b/test.API/SHAPER/Transformations/TestSymmetry.py @@ -59,76 +59,219 @@ Axis_1 = model.addAxis(Part_1_doc, 10, 10, 20) # Sketches # Sketch comportant une ligne n'ayant dont les extremites ne coincident pas avec l'origine Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(-60.61265429508839, -83.21124437581197, 133.0036727560886, 114.0582209216138) +SketchLine_1 = Sketch_1.addLine( + -60.61265429508839, -83.21124437581197, 133.0036727560886, 114.0582209216138 +) # Sketch comportant une contour ferme de 4 lignes Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_2 = Sketch_2.addLine(82.71019756173548, 167.8442841418389, -114.8596207554555, -2.66979472427181) -SketchLine_3 = Sketch_2.addLine(-114.8596207554555, -2.66979472427181, 102.2154980962352, -58.03968011252918) -SketchLine_4 = Sketch_2.addLine(102.2154980962352, -58.03968011252918, 240.6402115668787, 65.28415552495312) -SketchLine_5 = Sketch_2.addLine(240.6402115668787, 65.28415552495312, 82.71019756173548, 167.8442841418389) -SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchLine_5.endPoint()) +SketchLine_2 = Sketch_2.addLine( + 82.71019756173548, 167.8442841418389, -114.8596207554555, -2.66979472427181 +) +SketchLine_3 = Sketch_2.addLine( + -114.8596207554555, -2.66979472427181, 102.2154980962352, -58.03968011252918 +) +SketchLine_4 = Sketch_2.addLine( + 102.2154980962352, -58.03968011252918, 240.6402115668787, 65.28415552495312 +) +SketchLine_5 = Sketch_2.addLine( + 240.6402115668787, 65.28415552495312, 82.71019756173548, 167.8442841418389 +) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident( + SketchLine_2.startPoint(), SketchLine_5.endPoint() +) # Sketch comportant un contour ferme de 5 lignes Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_6 = Sketch_3.addLine(26.85462764597397, 67.26291526312015, -53.39765785606262, 39.86755675840885) -SketchLine_7 = Sketch_3.addLine(-53.39765785606262, 39.86755675840885, -33.73745939974039, -8.799491879372397) -SketchLine_8 = Sketch_3.addLine(-33.73745939974039, -8.799491879372397, 33.30059435296487, -32.6495686952387) -SketchLine_9 = Sketch_3.addLine(33.30059435296487, -32.6495686952387, 19.44176593293446, 18.5958666253389) -SketchLine_10 = Sketch_3.addLine(19.44176593293446, 18.5958666253389, 26.85462764597397, 67.26291526312015) -SketchConstraintCoincidence_1 = Sketch_3.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_2 = Sketch_3.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_3 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_4 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_6.startPoint(), SketchLine_10.endPoint()) +SketchLine_6 = Sketch_3.addLine( + 26.85462764597397, 67.26291526312015, -53.39765785606262, 39.86755675840885 +) +SketchLine_7 = Sketch_3.addLine( + -53.39765785606262, 39.86755675840885, -33.73745939974039, -8.799491879372397 +) +SketchLine_8 = Sketch_3.addLine( + -33.73745939974039, -8.799491879372397, 33.30059435296487, -32.6495686952387 +) +SketchLine_9 = Sketch_3.addLine( + 33.30059435296487, -32.6495686952387, 19.44176593293446, 18.5958666253389 +) +SketchLine_10 = Sketch_3.addLine( + 19.44176593293446, 18.5958666253389, 26.85462764597397, 67.26291526312015 +) +SketchConstraintCoincidence_1 = Sketch_3.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_3.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_3.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_3.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_3.setCoincident( + SketchLine_6.startPoint(), SketchLine_10.endPoint() +) model.do() # Vertexes -Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex")]) +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/SketchLine_1")]) # Wire & Extrusion -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) +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 Plane_1 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_14_1/Top"), 10, False) 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/Face-SketchLine_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f_wire")]) +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/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/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) - -Symmetry_15 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_15_1")], model.selection("FACE", "PartSet/XOY")) -Symmetry_16 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_16_1")], model.selection("FACE", "Plane_1")) -Symmetry_17 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_17_1")], model.selection("FACE", "Box_15_1/Front")) -Symmetry_18 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_18_1")], model.selection("FACE", "Face_1_1")) -Symmetry_19 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_19_1")], model.selection("FACE", "InvalidName")) -Symmetry_20 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_20_1")], model.selection("FACE", "PartSet/XOY"), False) -Symmetry_21 = model.addSymmetry(Part_1_doc, [model.selection("SHELL", "Extrusion_1_1")], model.selection("FACE", "Plane_2")) +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/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/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, +) + +Symmetry_15 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Box_15_1")], + model.selection("FACE", "PartSet/XOY"), +) +Symmetry_16 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Box_16_1")], + model.selection("FACE", "Plane_1"), +) +Symmetry_17 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Box_17_1")], + model.selection("FACE", "Box_15_1/Front"), +) +Symmetry_18 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Box_18_1")], + model.selection("FACE", "Face_1_1"), +) +Symmetry_19 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Box_19_1")], + model.selection("FACE", "InvalidName"), +) +Symmetry_20 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Box_20_1")], + model.selection("FACE", "PartSet/XOY"), + False, +) +Symmetry_21 = model.addSymmetry( + Part_1_doc, + [model.selection("SHELL", "Extrusion_1_1")], + model.selection("FACE", "Plane_2"), +) model.do() model.end() @@ -239,13 +382,13 @@ model.testNbSubShapes(Symmetry_20, GeomAPI_Shape.FACE, [6]) model.testHaveNamingFaces(Symmetry_20, model, Part_1_doc) model.testNbResults(Symmetry_6, 0) -assert(Symmetry_6.feature().error() == 'Attribute "point_object" is not initialized.') +assert Symmetry_6.feature().error() == 'Attribute "point_object" is not initialized.' model.testNbResults(Symmetry_13, 0) -assert(Symmetry_13.feature().error() == 'Attribute "axis_object" is not initialized.') +assert Symmetry_13.feature().error() == 'Attribute "axis_object" is not initialized.' model.testNbResults(Symmetry_19, 0) -assert(Symmetry_19.feature().error() == 'Attribute "plane_object" is not initialized.') +assert Symmetry_19.feature().error() == 'Attribute "plane_object" is not initialized.' model.testNbResults(Symmetry_21, 1) model.testNbSubResults(Symmetry_21, [2]) diff --git a/test.API/SHAPER/Transformations/TestTranslation.py b/test.API/SHAPER/Transformations/TestTranslation.py index 33dfe66a1..2b382cf4a 100644 --- a/test.API/SHAPER/Transformations/TestTranslation.py +++ b/test.API/SHAPER/Transformations/TestTranslation.py @@ -39,24 +39,33 @@ aSession.finishOperation() # Create a box aSession.startOperation() -aBox = model.addBox(aDocument, 10, 10, 10) +aBox = model.addBox(aDocument, 10, 10, 10) # Perform a translation by an axis and a distance aSession.startOperation() -aTranslation1 = model.addTranslation(aDocument, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "Box_1_1/Front&Box_1_1/Bottom"), 20).result() +aTranslation1 = model.addTranslation( + aDocument, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "Box_1_1/Front&Box_1_1/Bottom"), + 20, +).result() aSession.finishOperation() -assert (aTranslation1 is not None) +assert aTranslation1 is not None # Perform a translation by DX, DY, DZ vector aSession.startOperation() -aTranslation2 = model.addTranslation(aDocument, [model.selection("SOLID", "Box_1_1")], 10, 10, 10).result() +aTranslation2 = model.addTranslation( + aDocument, [model.selection("SOLID", "Box_1_1")], 10, 10, 10 +).result() aSession.finishOperation() -assert (aTranslation2 is not None) +assert aTranslation2 is not None # Perform a translation by two points aSession.startOperation() aPoint1 = model.addPoint(aDocument, 0, 0, 0).result() aPoint2 = model.addPoint(aDocument, 10, 10, 0).result() -aTranslation3 = model.addTranslation(aDocument, [model.selection("SOLID", "Box_1_1")], aPoint1, aPoint2).result() +aTranslation3 = model.addTranslation( + aDocument, [model.selection("SOLID", "Box_1_1")], aPoint1, aPoint2 +).result() aSession.finishOperation() -assert (aTranslation3 is not None) +assert aTranslation3 is not None diff --git a/test.API/SHAPER/Transformations/TestTranslation_1.py b/test.API/SHAPER/Transformations/TestTranslation_1.py index 1906213f0..e94b4da00 100644 --- a/test.API/SHAPER/Transformations/TestTranslation_1.py +++ b/test.API/SHAPER/Transformations/TestTranslation_1.py @@ -84,70 +84,172 @@ Box_26 = model.addBox(Part_9_doc, 10, 20, 10) # Sketches # Sketch contenant un triangle Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(105.8795836373178, 106.9780351893485, -55.30451701345322, -118.6797057217308) -SketchLine_2 = Sketch_1.addLine(-55.30451701345322, -118.6797057217308, -134.9484255703047, 86.11891628160174) -SketchLine_3 = Sketch_1.addLine(-134.9484255703047, 86.11891628160174, 105.8795836373178, 106.9780351893485) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) +SketchLine_1 = Sketch_1.addLine( + 105.8795836373178, 106.9780351893485, -55.30451701345322, -118.6797057217308 +) +SketchLine_2 = Sketch_1.addLine( + -55.30451701345322, -118.6797057217308, -134.9484255703047, 86.11891628160174 +) +SketchLine_3 = Sketch_1.addLine( + -134.9484255703047, 86.11891628160174, 105.8795836373178, 106.9780351893485 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) # Sketch contenant un cercle et une ligne droite ne coupant pas le cercle, tous deux contenus dans l'une des faces de la box 1 Sketch_2 = model.addSketch(Part_2_doc, model.selection("FACE", "Box_1_1/Top")) -SketchCircle_1 = Sketch_2.addCircle(3.625538020086079, 17.57352941176471, 2.190441696184978) -SketchLine_4 = Sketch_2.addLine(2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828) +SketchCircle_1 = Sketch_2.addCircle( + 3.625538020086079, 17.57352941176471, 2.190441696184978 +) +SketchLine_4 = Sketch_2.addLine( + 2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828 +) # Sketch contenant un cercle et une ligne droite ne coupant pas le cercle, tous deux contenus dans l'une des faces de la box 1 Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) -SketchCircle_2 = Sketch_3.addCircle(3.625538020086079, 17.57352941176471, 2.190441696184978) -SketchLine_5 = Sketch_3.addLine(2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828) +SketchCircle_2 = Sketch_3.addCircle( + 3.625538020086079, 17.57352941176471, 2.190441696184978 +) +SketchLine_5 = Sketch_3.addLine( + 2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828 +) # Sketch contenant un cercle et une ligne droite ne coupant pas le cercle, tous deux contenus dans l'une des faces de la box 1 Sketch_4 = model.addSketch(Part_3_doc, model.selection("FACE", "Box_1_1/Top")) -SketchCircle_3 = Sketch_4.addCircle(3.625538020086079, 17.57352941176471, 2.190441696184978) -SketchLine_6 = Sketch_4.addLine(2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828) +SketchCircle_3 = Sketch_4.addCircle( + 3.625538020086079, 17.57352941176471, 2.190441696184978 +) +SketchLine_6 = Sketch_4.addLine( + 2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828 +) # Sketch contenant un cercle et une ligne droite ne coupant pas le cercle, tous deux contenus dans l'une des faces de la box 1 Sketch_5 = model.addSketch(Part_4_doc, model.selection("FACE", "Box_1_1/Top")) -SketchCircle_4 = Sketch_5.addCircle(3.625538020086079, 17.57352941176471, 2.190441696184978) -SketchLine_7 = Sketch_5.addLine(2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828) +SketchCircle_4 = Sketch_5.addCircle( + 3.625538020086079, 17.57352941176471, 2.190441696184978 +) +SketchLine_7 = Sketch_5.addLine( + 2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828 +) # Sketch contenant un cercle et une ligne droite ne coupant pas le cercle, tous deux contenus dans l'une des faces de la box 1 Sketch_6 = model.addSketch(Part_5_doc, model.selection("FACE", "Box_1_1/Top")) -SketchCircle_5 = Sketch_6.addCircle(3.625538020086079, 17.57352941176471, 2.190441696184978) -SketchLine_8 = Sketch_6.addLine(2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828) +SketchCircle_5 = Sketch_6.addCircle( + 3.625538020086079, 17.57352941176471, 2.190441696184978 +) +SketchLine_8 = Sketch_6.addLine( + 2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828 +) # Sketch contenant un cercle et une ligne droite ne coupant pas le cercle, tous deux contenus dans l'une des faces de la box 1 Sketch_7 = model.addSketch(Part_6_doc, model.selection("FACE", "Box_1_1/Top")) -SketchCircle_6 = Sketch_7.addCircle(3.625538020086079, 17.57352941176471, 2.190441696184978) -SketchLine_9 = Sketch_7.addLine(2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828) +SketchCircle_6 = Sketch_7.addCircle( + 3.625538020086079, 17.57352941176471, 2.190441696184978 +) +SketchLine_9 = Sketch_7.addLine( + 2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828 +) # Sketch contenant un cercle et une ligne droite ne coupant pas le cercle, tous deux contenus dans l'une des faces de la box 1 Sketch_8 = model.addSketch(Part_7_doc, model.selection("FACE", "Box_1_1/Top")) -SketchCircle_7 = Sketch_8.addCircle(3.625538020086079, 17.57352941176471, 2.190441696184978) -SketchLine_10 = Sketch_8.addLine(2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828) +SketchCircle_7 = Sketch_8.addCircle( + 3.625538020086079, 17.57352941176471, 2.190441696184978 +) +SketchLine_10 = Sketch_8.addLine( + 2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828 +) # Sketch contenant un cercle et une ligne droite ne coupant pas le cercle, tous deux contenus dans l'une des faces de la box 1 Sketch_9 = model.addSketch(Part_8_doc, model.selection("FACE", "Box_1_1/Top")) -SketchCircle_8 = Sketch_9.addCircle(3.625538020086079, 17.57352941176471, 2.190441696184978) -SketchLine_11 = Sketch_9.addLine(2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828) +SketchCircle_8 = Sketch_9.addCircle( + 3.625538020086079, 17.57352941176471, 2.190441696184978 +) +SketchLine_11 = Sketch_9.addLine( + 2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828 +) # Sketch contenant un cercle et une ligne droite ne coupant pas le cercle, tous deux contenus dans l'une des faces de la box 1 Sketch_10 = model.addSketch(Part_9_doc, model.selection("FACE", "Box_1_1/Top")) -SketchCircle_9 = Sketch_10.addCircle(3.625538020086079, 17.57352941176471, 2.190441696184978) -SketchLine_12 = Sketch_10.addLine(2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828) +SketchCircle_9 = Sketch_10.addCircle( + 3.625538020086079, 17.57352941176471, 2.190441696184978 +) +SketchLine_12 = Sketch_10.addLine( + 2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828 +) model.do() # Extrusions -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) +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/SketchLine_2")]) @@ -160,43 +262,251 @@ Axis_1 = model.addAxis(partSet, 10, 10, 10) model.addParameter(partSet, "d", "15") # Multitranslations -MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_10_1")], model.selection("EDGE", "PartSet/OX"), 15, 3, model.selection("EDGE", "PartSet/OY"), 15, 3) -MultiTranslation_2 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_11_1")], model.selection("EDGE", "PartSet/OX"), 15, 3, model.selection("EDGE", "PartSet/OY"), 15, 3) -MultiTranslation_3 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_12_1")], model.selection("EDGE", "PartSet/OX"), 15, 3, model.selection("EDGE", "PartSet/OY"), 15, 3) -MultiTranslation_4 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_13_1")], model.selection("EDGE", "PartSet/OX"), 15, 3, model.selection("EDGE", "PartSet/OY"), 15, 3) -MultiTranslation_5 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_14_1")], model.selection("EDGE", "PartSet/OX"), 15, 3, model.selection("EDGE", "PartSet/OY"), 15, 3) -MultiTranslation_6 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_15_1")], model.selection("EDGE", "PartSet/OX"), 15, 3, model.selection("EDGE", "PartSet/OY"), 15, 3) -MultiTranslation_7 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_16_1")], model.selection("EDGE", "PartSet/OX"), 15, 3, model.selection("EDGE", "PartSet/OY"), 15, 3) -MultiTranslation_8 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_17_1")], model.selection("EDGE", "PartSet/OX"), 15, 3, model.selection("EDGE", "PartSet/OY"), 15, 3) -MultiTranslation_9 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_18_1")], model.selection("EDGE", "PartSet/OX"), 15, 3, model.selection("EDGE", "PartSet/OY"), 15, 3) +MultiTranslation_1 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_10_1")], + model.selection("EDGE", "PartSet/OX"), + 15, + 3, + model.selection("EDGE", "PartSet/OY"), + 15, + 3, +) +MultiTranslation_2 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_11_1")], + model.selection("EDGE", "PartSet/OX"), + 15, + 3, + model.selection("EDGE", "PartSet/OY"), + 15, + 3, +) +MultiTranslation_3 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_12_1")], + model.selection("EDGE", "PartSet/OX"), + 15, + 3, + model.selection("EDGE", "PartSet/OY"), + 15, + 3, +) +MultiTranslation_4 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_13_1")], + model.selection("EDGE", "PartSet/OX"), + 15, + 3, + model.selection("EDGE", "PartSet/OY"), + 15, + 3, +) +MultiTranslation_5 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_14_1")], + model.selection("EDGE", "PartSet/OX"), + 15, + 3, + model.selection("EDGE", "PartSet/OY"), + 15, + 3, +) +MultiTranslation_6 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_15_1")], + model.selection("EDGE", "PartSet/OX"), + 15, + 3, + model.selection("EDGE", "PartSet/OY"), + 15, + 3, +) +MultiTranslation_7 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_16_1")], + model.selection("EDGE", "PartSet/OX"), + 15, + 3, + model.selection("EDGE", "PartSet/OY"), + 15, + 3, +) +MultiTranslation_8 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_17_1")], + model.selection("EDGE", "PartSet/OX"), + 15, + 3, + model.selection("EDGE", "PartSet/OY"), + 15, + 3, +) +MultiTranslation_9 = model.addMultiTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_18_1")], + model.selection("EDGE", "PartSet/OX"), + 15, + 3, + model.selection("EDGE", "PartSet/OY"), + 15, + 3, +) # Translations -Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 15) -Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("EDGE", "PartSet/OX"), 0) -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/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_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/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_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) -Translation_21 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_4/")], model.selection("EDGE", "OX"), -15) -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_26 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_9/")], model.selection("EDGE", "Axis_4"), 15) +Translation_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 15, +) +Translation_2 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_2_1")], + model.selection("EDGE", "PartSet/OX"), + 0, +) +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/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_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/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_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 +) +Translation_21 = model.addTranslation( + partSet, + [model.selection("COMPOUND", "Part_4/")], + model.selection("EDGE", "OX"), + -15, +) +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_26 = model.addTranslation( + partSet, + [model.selection("COMPOUND", "Part_9/")], + model.selection("EDGE", "Axis_4"), + 15, +) model.do() model.end() @@ -308,70 +618,70 @@ model.testNbSubShapes(Translation_18, GeomAPI_Shape.FACE, [54]) model.testHaveNamingFaces(Translation_18, model, Part_1_doc) model.testNbResults(Translation_4, 0) -assert(Translation_4.feature().error() == 'Attribute "axis_object" is not initialized.') +assert Translation_4.feature().error() == 'Attribute "axis_object" is not initialized.' model.testNbResults(Translation_13, 0) -assert(Translation_13.feature().error() == 'Attribute "axis_object" is not initialized.') +assert Translation_13.feature().error() == 'Attribute "axis_object" is not initialized.' model.testNbResults(Translation_22, 0) -assert(Translation_22.feature().error() == 'Attribute "axis_object" is not initialized.') +assert Translation_22.feature().error() == 'Attribute "axis_object" is not initialized.' # See what we can check on a part model.testNbResults(Translation_19, 1) -#model.testNbSubResults(Translation_19, [0]) -#model.testNbSubShapes(Translation_19, GeomAPI_Shape.COMPOUND, [1]) -#model.testNbSubShapes(Translation_19, GeomAPI_Shape.SOLID, [2]) -#model.testNbSubShapes(Translation_19, GeomAPI_Shape.FACE, [9]) -#model.testHaveNamingFaces(Translation_19, model, Part_2_doc) +# model.testNbSubResults(Translation_19, [0]) +# model.testNbSubShapes(Translation_19, GeomAPI_Shape.COMPOUND, [1]) +# model.testNbSubShapes(Translation_19, GeomAPI_Shape.SOLID, [2]) +# model.testNbSubShapes(Translation_19, GeomAPI_Shape.FACE, [9]) +# model.testHaveNamingFaces(Translation_19, model, Part_2_doc) # See what we can check on a part model.testNbResults(Translation_20, 1) -#model.testNbSubResults(Translation_20, [0]) -#model.testNbSubShapes(Translation_20, GeomAPI_Shape.COMPOUND, [1]) -#model.testNbSubShapes(Translation_20, GeomAPI_Shape.SOLID, [2]) -#model.testNbSubShapes(Translation_20, GeomAPI_Shape.FACE, [9]) -#model.testHaveNamingFaces(Translation_20, model, Part_3_doc) +# model.testNbSubResults(Translation_20, [0]) +# model.testNbSubShapes(Translation_20, GeomAPI_Shape.COMPOUND, [1]) +# model.testNbSubShapes(Translation_20, GeomAPI_Shape.SOLID, [2]) +# model.testNbSubShapes(Translation_20, GeomAPI_Shape.FACE, [9]) +# model.testHaveNamingFaces(Translation_20, model, Part_3_doc) # See what we can check on a part model.testNbResults(Translation_21, 1) -#model.testNbSubResults(Translation_21, [0]) -#model.testNbSubShapes(Translation_21, GeomAPI_Shape.COMPOUND, [1]) -#model.testNbSubShapes(Translation_21, GeomAPI_Shape.SOLID, [2]) -#model.testNbSubShapes(Translation_21, GeomAPI_Shape.FACE, [9]) -#model.testHaveNamingFaces(Translation_21, model, Part_4_doc) +# model.testNbSubResults(Translation_21, [0]) +# model.testNbSubShapes(Translation_21, GeomAPI_Shape.COMPOUND, [1]) +# model.testNbSubShapes(Translation_21, GeomAPI_Shape.SOLID, [2]) +# model.testNbSubShapes(Translation_21, GeomAPI_Shape.FACE, [9]) +# model.testHaveNamingFaces(Translation_21, model, Part_4_doc) # See what we can check on a part model.testNbResults(Translation_23, 1) -#model.testNbSubResults(Translation_23, [0]) -#model.testNbSubShapes(Translation_23, GeomAPI_Shape.COMPOUND, [1]) -#model.testNbSubShapes(Translation_23, GeomAPI_Shape.SOLID, [2]) -#model.testNbSubShapes(Translation_23, GeomAPI_Shape.FACE, [9]) -#model.testHaveNamingFaces(Translation_23, model, Part_6_doc) +# model.testNbSubResults(Translation_23, [0]) +# model.testNbSubShapes(Translation_23, GeomAPI_Shape.COMPOUND, [1]) +# model.testNbSubShapes(Translation_23, GeomAPI_Shape.SOLID, [2]) +# model.testNbSubShapes(Translation_23, GeomAPI_Shape.FACE, [9]) +# model.testHaveNamingFaces(Translation_23, model, Part_6_doc) # See what we can check on a part -#model.testNbResults(Translation_24, 1) -#model.testNbSubResults(Translation_24, [0]) -#model.testNbSubShapes(Translation_24, GeomAPI_Shape.COMPOUND, [1]) -#model.testNbSubShapes(Translation_24, GeomAPI_Shape.SOLID, [2]) -#model.testNbSubShapes(Translation_24, GeomAPI_Shape.FACE, [9]) -#model.testNbSubShapes(Translation_24, GeomAPI_Shape.SOLID, [3]) -#model.testNbSubShapes(Translation_24, GeomAPI_Shape.FACE, [18]) -#model.testHaveNamingFaces(Translation_24, model, Part_7_doc) +# model.testNbResults(Translation_24, 1) +# model.testNbSubResults(Translation_24, [0]) +# model.testNbSubShapes(Translation_24, GeomAPI_Shape.COMPOUND, [1]) +# model.testNbSubShapes(Translation_24, GeomAPI_Shape.SOLID, [2]) +# model.testNbSubShapes(Translation_24, GeomAPI_Shape.FACE, [9]) +# model.testNbSubShapes(Translation_24, GeomAPI_Shape.SOLID, [3]) +# model.testNbSubShapes(Translation_24, GeomAPI_Shape.FACE, [18]) +# model.testHaveNamingFaces(Translation_24, model, Part_7_doc) # See what we can check on a part -#model.testNbResults(Translation_25, 1) -#model.testNbSubResults(Translation_25, [0]) -#model.testNbSubShapes(Translation_25, GeomAPI_Shape.COMPOUND, [1]) -#model.testNbSubShapes(Translation_25, GeomAPI_Shape.SOLID, [2]) -#model.testNbSubShapes(Translation_25, GeomAPI_Shape.FACE, [9]) -#model.testNbSubShapes(Translation_25, GeomAPI_Shape.SOLID, [3]) -#model.testNbSubShapes(Translation_25, GeomAPI_Shape.FACE, [18]) -#model.testHaveNamingFaces(Translation_25, model, Part_8_doc) +# model.testNbResults(Translation_25, 1) +# model.testNbSubResults(Translation_25, [0]) +# model.testNbSubShapes(Translation_25, GeomAPI_Shape.COMPOUND, [1]) +# model.testNbSubShapes(Translation_25, GeomAPI_Shape.SOLID, [2]) +# model.testNbSubShapes(Translation_25, GeomAPI_Shape.FACE, [9]) +# model.testNbSubShapes(Translation_25, GeomAPI_Shape.SOLID, [3]) +# model.testNbSubShapes(Translation_25, GeomAPI_Shape.FACE, [18]) +# model.testHaveNamingFaces(Translation_25, model, Part_8_doc) # See what we can check on a part model.testNbResults(Translation_26, 1) -#model.testNbSubResults(Translation_26, [0]) -#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) +# model.testNbSubResults(Translation_26, [0]) +# 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) diff --git a/test.API/SHAPER/Transformations/TestTranslation_2.py b/test.API/SHAPER/Transformations/TestTranslation_2.py index 35bb5f36c..fbf63c449 100644 --- a/test.API/SHAPER/Transformations/TestTranslation_2.py +++ b/test.API/SHAPER/Transformations/TestTranslation_2.py @@ -70,12 +70,24 @@ Box_36 = model.addBox(Part_1_doc, 10, 10, 10) # Sketches # Sketch contenant un triangle Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(105.8795836373178, 106.9780351893485, -55.30451701345322, -118.6797057217308) -SketchLine_2 = Sketch_1.addLine(-55.30451701345322, -118.6797057217308, -134.9484255703047, 86.11891628160174) -SketchLine_3 = Sketch_1.addLine(-134.9484255703047, 86.11891628160174, 105.8795836373178, 106.9780351893485) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) +SketchLine_1 = Sketch_1.addLine( + 105.8795836373178, 106.9780351893485, -55.30451701345322, -118.6797057217308 +) +SketchLine_2 = Sketch_1.addLine( + -55.30451701345322, -118.6797057217308, -134.9484255703047, 86.11891628160174 +) +SketchLine_3 = Sketch_1.addLine( + -134.9484255703047, 86.11891628160174, 105.8795836373178, 106.9780351893485 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) model.do() @@ -89,94 +101,369 @@ Axis_1 = model.addAxis(Part_1_doc, 10, 10, 10) model.addParameter(Part_1_doc, "d", "15") # Translation 27 -Translation_27_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 5) -Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "Box_2_1"), model.selection("SOLID", "Translation_1_1")]) -Translation_27 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "Intersection_1_1")], model.selection("EDGE", "PartSet/OX"), 15) +Translation_27_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_1_1")], + model.selection("EDGE", "PartSet/OX"), + 5, +) +Intersection_1 = model.addIntersection( + Part_1_doc, + [model.selection("SOLID", "Box_2_1"), model.selection("SOLID", "Translation_1_1")], +) +Translation_27 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "Intersection_1_1")], + model.selection("EDGE", "PartSet/OX"), + 15, +) # Translation 28 -Translation_28_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("EDGE", "PartSet/OX"), 5) -Intersection_2 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "Box_4_1"), model.selection("SOLID", "Translation_3_1")]) -Translation_28 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "Intersection_2_1")], model.selection("EDGE", "PartSet/OX"), 0) +Translation_28_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_3_1")], + model.selection("EDGE", "PartSet/OX"), + 5, +) +Intersection_2 = model.addIntersection( + Part_1_doc, + [model.selection("SOLID", "Box_4_1"), model.selection("SOLID", "Translation_3_1")], +) +Translation_28 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "Intersection_2_1")], + model.selection("EDGE", "PartSet/OX"), + 0, +) # Translation 29 -Translation_29_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_5_1")], model.selection("EDGE", "PartSet/OX"), 5) -Intersection_3 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "Box_6_1"), model.selection("SOLID", "Translation_5_1")]) -Translation_29 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "Intersection_3_1")], model.selection("EDGE", "PartSet/OX"), -15) +Translation_29_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_5_1")], + model.selection("EDGE", "PartSet/OX"), + 5, +) +Intersection_3 = model.addIntersection( + Part_1_doc, + [model.selection("SOLID", "Box_6_1"), model.selection("SOLID", "Translation_5_1")], +) +Translation_29 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "Intersection_3_1")], + model.selection("EDGE", "PartSet/OX"), + -15, +) # Translation 30 -Translation_30_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_7_1")], model.selection("EDGE", "PartSet/OX"), 5) -Intersection_4 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "Box_8_1"), model.selection("SOLID", "Translation_7_1")]) -Translation_30 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "Intersection_4_1")], model.selection("EDGE", "InvalidName"), -15) +Translation_30_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_7_1")], + model.selection("EDGE", "PartSet/OX"), + 5, +) +Intersection_4 = model.addIntersection( + Part_1_doc, + [model.selection("SOLID", "Box_8_1"), model.selection("SOLID", "Translation_7_1")], +) +Translation_30 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "Intersection_4_1")], + model.selection("EDGE", "InvalidName"), + -15, +) # Translation 31 -Translation_31_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_9_1")], model.selection("EDGE", "PartSet/OX"), 5) -Intersection_5 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "Box_10_1"), model.selection("SOLID", "Translation_9_1")]) -Translation_31 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "Intersection_5_1")], model.selection("EDGE", "PartSet/OY"), "d") +Translation_31_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_9_1")], + model.selection("EDGE", "PartSet/OX"), + 5, +) +Intersection_5 = model.addIntersection( + Part_1_doc, + [model.selection("SOLID", "Box_10_1"), model.selection("SOLID", "Translation_9_1")], +) +Translation_31 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "Intersection_5_1")], + model.selection("EDGE", "PartSet/OY"), + "d", +) # 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/SketchLine_1"), 15) +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/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) -Intersection_7 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "Box_14_1"), model.selection("SOLID", "Translation_13_1")]) -Translation_33 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "Intersection_7_1")], model.selection("EDGE", "Edge_1_1"), 15) +Translation_33_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_13_1")], + model.selection("EDGE", "PartSet/OX"), + 5, +) +Intersection_7 = model.addIntersection( + Part_1_doc, + [ + model.selection("SOLID", "Box_14_1"), + model.selection("SOLID", "Translation_13_1"), + ], +) +Translation_33 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "Intersection_7_1")], + model.selection("EDGE", "Edge_1_1"), + 15, +) # Translation 34 -Translation_34_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_15_1")], model.selection("EDGE", "PartSet/OX"), 5) -Intersection_8 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "Box_16_1"), model.selection("SOLID", "Translation_15_1")]) -Translation_34 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "Intersection_8_1")], model.selection("EDGE", "Intersection_8_1_6"), 15) +Translation_34_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_15_1")], + model.selection("EDGE", "PartSet/OX"), + 5, +) +Intersection_8 = model.addIntersection( + Part_1_doc, + [ + model.selection("SOLID", "Box_16_1"), + model.selection("SOLID", "Translation_15_1"), + ], +) +Translation_34 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "Intersection_8_1")], + model.selection("EDGE", "Intersection_8_1_6"), + 15, +) # Translation 35 -Translation_35_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_17_1")], model.selection("EDGE", "PartSet/OX"), 5) -Intersection_9 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "Box_18_1"), model.selection("SOLID", "Translation_17_1")]) -Translation_35 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "Intersection_9_1")], model.selection("EDGE", "Axis_1"), 15) +Translation_35_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_17_1")], + model.selection("EDGE", "PartSet/OX"), + 5, +) +Intersection_9 = model.addIntersection( + Part_1_doc, + [ + model.selection("SOLID", "Box_18_1"), + model.selection("SOLID", "Translation_17_1"), + ], +) +Translation_35 = model.addTranslation( + Part_1_doc, + [model.selection("COMPOUND", "Intersection_9_1")], + model.selection("EDGE", "Axis_1"), + 15, +) -#Translation 36 -Translation_36_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_19_1")], model.selection("EDGE", "PartSet/OX"), 5) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_20_1"), model.selection("SOLID", "Translation_19_1")]) -Translation_36 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("EDGE", "PartSet/OX"), 15) +# Translation 36 +Translation_36_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_19_1")], + model.selection("EDGE", "PartSet/OX"), + 5, +) +Partition_1 = model.addPartition( + Part_1_doc, + [ + model.selection("SOLID", "Box_20_1"), + model.selection("SOLID", "Translation_19_1"), + ], +) +Translation_36 = model.addTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_1_1")], + model.selection("EDGE", "PartSet/OX"), + 15, +) ## Translation 37 -Translation_37_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_21_1")], model.selection("EDGE", "PartSet/OX"), 5) -Partition_2 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_22_1"), model.selection("SOLID", "Translation_21_1")]) -Translation_37 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_2_1")], model.selection("EDGE", "PartSet/OX"), 0) +Translation_37_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_21_1")], + model.selection("EDGE", "PartSet/OX"), + 5, +) +Partition_2 = model.addPartition( + Part_1_doc, + [ + model.selection("SOLID", "Box_22_1"), + model.selection("SOLID", "Translation_21_1"), + ], +) +Translation_37 = model.addTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_2_1")], + model.selection("EDGE", "PartSet/OX"), + 0, +) ## Translation 38 -Translation_38_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_23_1")], model.selection("EDGE", "PartSet/OX"), 5) -Partition_3 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_24_1"), model.selection("SOLID", "Translation_23_1")]) -Translation_38 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_3_1")], model.selection("EDGE", "PartSet/OX"), 0) +Translation_38_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_23_1")], + model.selection("EDGE", "PartSet/OX"), + 5, +) +Partition_3 = model.addPartition( + Part_1_doc, + [ + model.selection("SOLID", "Box_24_1"), + model.selection("SOLID", "Translation_23_1"), + ], +) +Translation_38 = model.addTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_3_1")], + model.selection("EDGE", "PartSet/OX"), + 0, +) ## Translation 39 -Translation_39_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_25_1")], model.selection("EDGE", "PartSet/OX"), 5) -Partition_4 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_26_1"), model.selection("SOLID", "Translation_25_1")]) -Translation_39 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_4_1")], model.selection("EDGE", "InvalidName"), 0) +Translation_39_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_25_1")], + model.selection("EDGE", "PartSet/OX"), + 5, +) +Partition_4 = model.addPartition( + Part_1_doc, + [ + model.selection("SOLID", "Box_26_1"), + model.selection("SOLID", "Translation_25_1"), + ], +) +Translation_39 = model.addTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_4_1")], + model.selection("EDGE", "InvalidName"), + 0, +) ## Translation 40 -Translation_40_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_27_1")], model.selection("EDGE", "PartSet/OX"), 5) -Partition_5 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_28_1"), model.selection("SOLID", "Translation_27_1")]) -Translation_40 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_5_1")], model.selection("EDGE", "PartSet/OX"), "d") +Translation_40_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_27_1")], + model.selection("EDGE", "PartSet/OX"), + 5, +) +Partition_5 = model.addPartition( + Part_1_doc, + [ + model.selection("SOLID", "Box_28_1"), + model.selection("SOLID", "Translation_27_1"), + ], +) +Translation_40 = model.addTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_5_1")], + model.selection("EDGE", "PartSet/OX"), + "d", +) # 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/SketchLine_1"), 15) +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/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) -Partition_7 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_32_1"), model.selection("SOLID", "Translation_31_1")]) -Translation_42 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_7_1")], model.selection("EDGE", "Edge_1_1"), 15) +Translation_42_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_31_1")], + model.selection("EDGE", "PartSet/OX"), + 5, +) +Partition_7 = model.addPartition( + Part_1_doc, + [ + model.selection("SOLID", "Box_32_1"), + model.selection("SOLID", "Translation_31_1"), + ], +) +Translation_42 = model.addTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_7_1")], + model.selection("EDGE", "Edge_1_1"), + 15, +) # Translation 43 -Translation_43_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_33_1")], model.selection("EDGE", "PartSet/OX"), 5) -Partition_8 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_34_1"), model.selection("SOLID", "Translation_33_1")]) -Translation_43 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_8_1")], model.selection("EDGE", "Partition_8_1_1/Modified_Face_2_5&Partition_8_1_1/Modified_Face_2_2"), 15) +Translation_43_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_33_1")], + model.selection("EDGE", "PartSet/OX"), + 5, +) +Partition_8 = model.addPartition( + Part_1_doc, + [ + model.selection("SOLID", "Box_34_1"), + model.selection("SOLID", "Translation_33_1"), + ], +) +Translation_43 = model.addTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_8_1")], + model.selection( + "EDGE", "Partition_8_1_1/Modified_Face_2_5&Partition_8_1_1/Modified_Face_2_2" + ), + 15, +) # Translation 44 -Translation_44_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_35_1")], model.selection("EDGE", "PartSet/OX"), 5) -Partition_9 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_36_1"), model.selection("SOLID", "Translation_35_1")]) -Translation_44 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_9_1")], model.selection("EDGE", "Axis_1"), 15) +Translation_44_1 = model.addTranslation( + Part_1_doc, + [model.selection("SOLID", "Box_35_1")], + model.selection("EDGE", "PartSet/OX"), + 5, +) +Partition_9 = model.addPartition( + Part_1_doc, + [ + model.selection("SOLID", "Box_36_1"), + model.selection("SOLID", "Translation_35_1"), + ], +) +Translation_44 = model.addTranslation( + Part_1_doc, + [model.selection("COMPSOLID", "Partition_9_1")], + model.selection("EDGE", "Axis_1"), + 15, +) model.do() model.end() @@ -289,12 +576,12 @@ model.testHaveNamingFaces(Translation_42, model, Part_1_doc) # Translation 43 # It is concealed by Partition_9 -#model.testNbResults(Translation_43, 1) -#model.testNbSubResults(Translation_43, [3]) -#model.testNbSubShapes(Translation_43, GeomAPI_Shape.COMPSOLID, [1]) -#model.testNbSubShapes(Translation_43, GeomAPI_Shape.SOLID, [3]) -#model.testNbSubShapes(Translation_43, GeomAPI_Shape.FACE, [18]) -#model.testHaveNamingFaces(Translation_43, model, Part_1_doc) +# model.testNbResults(Translation_43, 1) +# model.testNbSubResults(Translation_43, [3]) +# model.testNbSubShapes(Translation_43, GeomAPI_Shape.COMPSOLID, [1]) +# model.testNbSubShapes(Translation_43, GeomAPI_Shape.SOLID, [3]) +# model.testNbSubShapes(Translation_43, GeomAPI_Shape.FACE, [18]) +# model.testHaveNamingFaces(Translation_43, model, Part_1_doc) # Translation 44 model.testNbResults(Translation_44, 1) @@ -306,8 +593,8 @@ model.testHaveNamingFaces(Translation_44, model, Part_1_doc) # Translation 30 model.testNbResults(Translation_30, 0) -assert(Translation_30.feature().error() == 'Attribute "axis_object" is not initialized.') +assert Translation_30.feature().error() == 'Attribute "axis_object" is not initialized.' # Translation 39 model.testNbResults(Translation_39, 0) -assert(Translation_39.feature().error() == 'Attribute "axis_object" is not initialized.') \ No newline at end of file +assert Translation_39.feature().error() == 'Attribute "axis_object" is not initialized.' diff --git a/test.API/SHAPER/Transformations/TestTranslation_3.py b/test.API/SHAPER/Transformations/TestTranslation_3.py index 8b65a55aa..a72403ca8 100644 --- a/test.API/SHAPER/Transformations/TestTranslation_3.py +++ b/test.API/SHAPER/Transformations/TestTranslation_3.py @@ -35,75 +35,171 @@ Box_1 = model.addBox(Part_1_doc, 10, 20, 10) # Sketches # Sketch contenant un triangle Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(105.8795836373178, 106.9780351893485, -55.30451701345322, -118.6797057217308) -SketchLine_2 = Sketch_1.addLine(-55.30451701345322, -118.6797057217308, -134.9484255703047, 86.11891628160174) -SketchLine_3 = Sketch_1.addLine(-134.9484255703047, 86.11891628160174, 105.8795836373178, 106.9780351893485) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) +SketchLine_1 = Sketch_1.addLine( + 105.8795836373178, 106.9780351893485, -55.30451701345322, -118.6797057217308 +) +SketchLine_2 = Sketch_1.addLine( + -55.30451701345322, -118.6797057217308, -134.9484255703047, 86.11891628160174 +) +SketchLine_3 = Sketch_1.addLine( + -134.9484255703047, 86.11891628160174, 105.8795836373178, 106.9780351893485 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) # Sketch contenant un cercle et une ligne droite ne coupant pas le cercle, tous deux contenus dans l'une des faces de la box 1 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) -SketchCircle_1 = Sketch_2.addCircle(3.625538020086079, 17.57352941176471, 2.190441696184978) -SketchLine_4 = Sketch_2.addLine(2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828) +SketchCircle_1 = Sketch_2.addCircle( + 3.625538020086079, 17.57352941176471, 2.190441696184978 +) +SketchLine_4 = Sketch_2.addLine( + 2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828 +) # Sketch contenant une ligne droite Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_5 = Sketch_3.addLine(-42.70592498087446, -19.7671890801643, 76.68536514422158, 72.47712556405142) +SketchLine_5 = Sketch_3.addLine( + -42.70592498087446, -19.7671890801643, 76.68536514422158, 72.47712556405142 +) # Sketch contenant 2 lignes droites independantes Sketch_4 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_6 = Sketch_4.addLine(64.56241032998567, 126.9727403156384, -187.948350071736, -65.2797704447633) -SketchLine_7 = Sketch_4.addLine(147.7761836441895, 78.19225251076045, 2.869440459110503, -194.4045911047346) +SketchLine_6 = Sketch_4.addLine( + 64.56241032998567, 126.9727403156384, -187.948350071736, -65.2797704447633 +) +SketchLine_7 = Sketch_4.addLine( + 147.7761836441895, 78.19225251076045, 2.869440459110503, -194.4045911047346 +) # Sketch contenant un triangle et une ligne droite sans contact avec le triangle Sketch_5 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_8 = Sketch_5.addLine(43.04160688665702, 82.49641319942614, -63.12769010043041, -3.586800573888105) -SketchLine_9 = Sketch_5.addLine(-63.12769010043041, -3.586800573888105, 60.25824964132004, -45.19368723098994) -SketchLine_10 = Sketch_5.addLine(60.25824964132004, -45.19368723098994, 43.04160688665702, 82.49641319942614) -SketchConstraintCoincidence_4 = Sketch_5.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_5 = Sketch_5.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_6 = Sketch_5.setCoincident(SketchLine_8.startPoint(), SketchLine_10.endPoint()) -SketchLine_11 = Sketch_5.addLine(-129.0707731585723, -64.87131938806517, -62.80680259595319, 54.77196079444149) +SketchLine_8 = Sketch_5.addLine( + 43.04160688665702, 82.49641319942614, -63.12769010043041, -3.586800573888105 +) +SketchLine_9 = Sketch_5.addLine( + -63.12769010043041, -3.586800573888105, 60.25824964132004, -45.19368723098994 +) +SketchLine_10 = Sketch_5.addLine( + 60.25824964132004, -45.19368723098994, 43.04160688665702, 82.49641319942614 +) +SketchConstraintCoincidence_4 = Sketch_5.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_5 = Sketch_5.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_5.setCoincident( + SketchLine_8.startPoint(), SketchLine_10.endPoint() +) +SketchLine_11 = Sketch_5.addLine( + -129.0707731585723, -64.87131938806517, -62.80680259595319, 54.77196079444149 +) # Sketch contenant deux triangles ayant un cote en commun Sketch_6 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_12 = Sketch_6.addLine(31.56384505021527, 81.06169296987088, -80.3443328550933, -15.06456241033) -SketchLine_13 = Sketch_6.addLine(-80.3443328550933, -15.06456241033, 58.82352941176466, -35.15064562410331) -SketchLine_14 = Sketch_6.addLine(58.82352941176466, -35.15064562410331, 31.56384505021527, 81.06169296987088) -SketchLine_15 = Sketch_6.addLine(31.56384505021527, 81.06169296987088, 159.2539454806312, 40.88952654232425) -SketchLine_16 = Sketch_6.addLine(159.2539454806312, 40.88952654232425, 58.82352941176466, -35.15064562410331) -SketchConstraintCoincidence_7 = Sketch_6.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_8 = Sketch_6.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_9 = Sketch_6.setCoincident(SketchLine_12.startPoint(), SketchLine_14.endPoint()) -SketchConstraintCoincidence_10 = Sketch_6.setCoincident(SketchLine_12.startPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_11 = Sketch_6.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_12 = Sketch_6.setCoincident(SketchLine_13.endPoint(), SketchLine_16.endPoint()) +SketchLine_12 = Sketch_6.addLine( + 31.56384505021527, 81.06169296987088, -80.3443328550933, -15.06456241033 +) +SketchLine_13 = Sketch_6.addLine( + -80.3443328550933, -15.06456241033, 58.82352941176466, -35.15064562410331 +) +SketchLine_14 = Sketch_6.addLine( + 58.82352941176466, -35.15064562410331, 31.56384505021527, 81.06169296987088 +) +SketchLine_15 = Sketch_6.addLine( + 31.56384505021527, 81.06169296987088, 159.2539454806312, 40.88952654232425 +) +SketchLine_16 = Sketch_6.addLine( + 159.2539454806312, 40.88952654232425, 58.82352941176466, -35.15064562410331 +) +SketchConstraintCoincidence_7 = Sketch_6.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_6.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_6.setCoincident( + SketchLine_12.startPoint(), SketchLine_14.endPoint() +) +SketchConstraintCoincidence_10 = Sketch_6.setCoincident( + SketchLine_12.startPoint(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_6.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_6.setCoincident( + SketchLine_13.endPoint(), SketchLine_16.endPoint() +) # Sketch contenant deux triangles ayant un cote en commun et une ligne droite ne coupant aucun des 2 triangles Sketch_7 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_17 = Sketch_7.addLine(17.21664275466276, 98.27833572453372, -144.906743185079, -46.6284074605452) -SketchLine_18 = Sketch_7.addLine(-144.906743185079, -46.6284074605452, 143.4720229555236, -105.4519368723099) -SketchLine_19 = Sketch_7.addLine(143.4720229555236, -105.4519368723099, 17.21664275466276, 98.27833572453372) -SketchLine_20 = Sketch_7.addLine(17.21664275466276, 98.27833572453372, 272.5968436154949, 99.71305595408899) -SketchLine_21 = Sketch_7.addLine(272.5968436154949, 99.71305595408899, 143.4720229555236, -105.4519368723099) -SketchConstraintCoincidence_13 = Sketch_7.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) -SketchConstraintCoincidence_14 = Sketch_7.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -SketchConstraintCoincidence_15 = Sketch_7.setCoincident(SketchLine_17.startPoint(), SketchLine_19.endPoint()) -SketchConstraintCoincidence_16 = Sketch_7.setCoincident(SketchLine_17.startPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_17 = Sketch_7.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) -SketchConstraintCoincidence_18 = Sketch_7.setCoincident(SketchLine_18.endPoint(), SketchLine_21.endPoint()) -SketchLine_22 = Sketch_7.addLine(-190.8177905308465, 62.41032998565277, -307.0301291248207, -188.6657101865136) +SketchLine_17 = Sketch_7.addLine( + 17.21664275466276, 98.27833572453372, -144.906743185079, -46.6284074605452 +) +SketchLine_18 = Sketch_7.addLine( + -144.906743185079, -46.6284074605452, 143.4720229555236, -105.4519368723099 +) +SketchLine_19 = Sketch_7.addLine( + 143.4720229555236, -105.4519368723099, 17.21664275466276, 98.27833572453372 +) +SketchLine_20 = Sketch_7.addLine( + 17.21664275466276, 98.27833572453372, 272.5968436154949, 99.71305595408899 +) +SketchLine_21 = Sketch_7.addLine( + 272.5968436154949, 99.71305595408899, 143.4720229555236, -105.4519368723099 +) +SketchConstraintCoincidence_13 = Sketch_7.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_7.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_7.setCoincident( + SketchLine_17.startPoint(), SketchLine_19.endPoint() +) +SketchConstraintCoincidence_16 = Sketch_7.setCoincident( + SketchLine_17.startPoint(), SketchLine_20.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_7.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.startPoint() +) +SketchConstraintCoincidence_18 = Sketch_7.setCoincident( + SketchLine_18.endPoint(), SketchLine_21.endPoint() +) +SketchLine_22 = Sketch_7.addLine( + -190.8177905308465, 62.41032998565277, -307.0301291248207, -188.6657101865136 +) # Sketch contenant un cercle Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Front")) -SketchCircle_2 = Sketch_8.addCircle(5.043472022955523, 6.180989956958394, 2.65480068754944) +SketchCircle_2 = Sketch_8.addCircle( + 5.043472022955523, 6.180989956958394, 2.65480068754944 +) model.do() # Extrusions -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) +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/SketchLine_2")]) @@ -123,126 +219,555 @@ Edge_12 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_7/SketchLin Axis_1 = model.addAxis(Part_1_doc, 10, 10, 10) # Vertex -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")]) +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/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")]) +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/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")]) +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")]) +Shell_1 = model.addShell( + Part_1_doc, + [model.selection("FACE", "Face_10_1"), model.selection("FACE", "Face_11_1")], +) Shell_1.result().setName("Shell_1_1") model.addRecover(Part_1_doc, Shell_1, [Face_10.result()]) model.addRecover(Part_1_doc, Shell_1, [Face_11.result()]) -Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Recover_1_1"), model.selection("FACE", "Recover_2_1")]) +Shell_2 = model.addShell( + Part_1_doc, + [model.selection("FACE", "Recover_1_1"), model.selection("FACE", "Recover_2_1")], +) Shell_2.result().setName("Shell_2_1") model.addRecover(Part_1_doc, Shell_1, [Face_10.result()]) model.addRecover(Part_1_doc, Shell_1, [Face_11.result()]) -Shell_3 = model.addShell(Part_1_doc, [model.selection("FACE", "Recover_3_1"), model.selection("FACE", "Recover_4_1")]) +Shell_3 = model.addShell( + Part_1_doc, + [model.selection("FACE", "Recover_3_1"), model.selection("FACE", "Recover_4_1")], +) Shell_3.result().setName("Shell_3_1") model.addRecover(Part_1_doc, Shell_1, [Face_10.result()]) model.addRecover(Part_1_doc, Shell_1, [Face_11.result()]) -Shell_4 = model.addShell(Part_1_doc, [model.selection("FACE", "Recover_5_1"), model.selection("FACE", "Recover_6_1")]) +Shell_4 = model.addShell( + Part_1_doc, + [model.selection("FACE", "Recover_5_1"), model.selection("FACE", "Recover_6_1")], +) Shell_4.result().setName("Shell_4_1") model.addRecover(Part_1_doc, Shell_1, [Face_10.result()]) model.addRecover(Part_1_doc, Shell_1, [Face_11.result()]) -Shell_5 = model.addShell(Part_1_doc, [model.selection("FACE", "Recover_7_1"), model.selection("FACE", "Recover_8_1")]) +Shell_5 = model.addShell( + Part_1_doc, + [model.selection("FACE", "Recover_7_1"), model.selection("FACE", "Recover_8_1")], +) Shell_5.result().setName("Shell_5_1") -Shell_6 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_12_1"), model.selection("FACE", "Face_13_1")]) +Shell_6 = model.addShell( + Part_1_doc, + [model.selection("FACE", "Face_12_1"), model.selection("FACE", "Face_13_1")], +) Shell_6.result().setName("Shell_6_1") model.addRecover(Part_1_doc, Shell_1, [Face_12.result()]) model.addRecover(Part_1_doc, Shell_1, [Face_13.result()]) -Shell_7 = model.addShell(Part_1_doc, [model.selection("FACE", "Recover_9_1"), model.selection("FACE", "Recover_10_1")]) +Shell_7 = model.addShell( + Part_1_doc, + [model.selection("FACE", "Recover_9_1"), model.selection("FACE", "Recover_10_1")], +) Shell_7.result().setName("Shell_7_1") model.addRecover(Part_1_doc, Shell_1, [Face_10.result()]) model.addRecover(Part_1_doc, Shell_1, [Face_11.result()]) -Shell_8 = model.addShell(Part_1_doc, [model.selection("FACE", "Recover_11_1"), model.selection("FACE", "Recover_12_1")]) +Shell_8 = model.addShell( + Part_1_doc, + [model.selection("FACE", "Recover_11_1"), model.selection("FACE", "Recover_12_1")], +) Shell_8.result().setName("Shell_8_1") model.addRecover(Part_1_doc, Shell_1, [Face_10.result()]) model.addRecover(Part_1_doc, Shell_1, [Face_11.result()]) -Shell_9 = model.addShell(Part_1_doc, [model.selection("FACE", "Recover_13_1"), model.selection("FACE", "Recover_14_1")]) +Shell_9 = model.addShell( + Part_1_doc, + [model.selection("FACE", "Recover_13_1"), model.selection("FACE", "Recover_14_1")], +) Shell_9.result().setName("Shell_9_1") # Parameters model.addParameter(Part_1_doc, "d", "15") # Translations -Translation_45 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("EDGE", "PartSet/OX"), 15) -Translation_46 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_2_1")], model.selection("EDGE", "PartSet/OX"), 0) -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/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_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/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_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/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_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/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_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/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_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) +Translation_45 = model.addTranslation( + Part_1_doc, + [model.selection("VERTEX", "Vertex_1_1")], + model.selection("EDGE", "PartSet/OX"), + 15, +) +Translation_46 = model.addTranslation( + Part_1_doc, + [model.selection("VERTEX", "Vertex_2_1")], + model.selection("EDGE", "PartSet/OX"), + 0, +) +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/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_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/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_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/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_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/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_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/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_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() model.end() @@ -529,16 +1054,16 @@ model.testHaveNamingFaces(Translation_90, model, Part_1_doc) model.testNbResults(Translation_48, 0) -assert(Translation_48.feature().error() == 'Attribute "axis_object" is not initialized.') +assert Translation_48.feature().error() == 'Attribute "axis_object" is not initialized.' model.testNbResults(Translation_57, 0) -assert(Translation_57.feature().error() == 'Attribute "axis_object" is not initialized.') +assert Translation_57.feature().error() == 'Attribute "axis_object" is not initialized.' model.testNbResults(Translation_66, 0) -assert(Translation_66.feature().error() == 'Attribute "axis_object" is not initialized.') +assert Translation_66.feature().error() == 'Attribute "axis_object" is not initialized.' model.testNbResults(Translation_75, 0) -assert(Translation_75.feature().error() == 'Attribute "axis_object" is not initialized.') +assert Translation_75.feature().error() == 'Attribute "axis_object" is not initialized.' model.testNbResults(Translation_84, 0) -assert(Translation_84.feature().error() == 'Attribute "axis_object" is not initialized.') +assert Translation_84.feature().error() == 'Attribute "axis_object" is not initialized.' diff --git a/test.API/SHAPER/Transformations/TestTranslation_4.py b/test.API/SHAPER/Transformations/TestTranslation_4.py index 84afa3f4c..d50548dbf 100644 --- a/test.API/SHAPER/Transformations/TestTranslation_4.py +++ b/test.API/SHAPER/Transformations/TestTranslation_4.py @@ -44,14 +44,30 @@ model.addParameter(Part_1_doc, "dy", "15") model.addParameter(Part_1_doc, "dz", "-5") # Translations -Translation_91 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], 10, 20, 15) -Translation_92 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], 0, 20, 15) -Translation_93 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], 10, 0, 15) -Translation_94 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_4_1")], 10, 20, 0) -Translation_95 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_5_1")], -10, 20, 15) -Translation_96 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_6_1")], 10, -20, 15) -Translation_97 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_7_1")], 10, 20, -15) -Translation_98 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_8_1")], "dx", "dy", "dz") +Translation_91 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_1_1")], 10, 20, 15 +) +Translation_92 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_2_1")], 0, 20, 15 +) +Translation_93 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_3_1")], 10, 0, 15 +) +Translation_94 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_4_1")], 10, 20, 0 +) +Translation_95 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_5_1")], -10, 20, 15 +) +Translation_96 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_6_1")], 10, -20, 15 +) +Translation_97 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_7_1")], 10, 20, -15 +) +Translation_98 = model.addTranslation( + Part_1_doc, [model.selection("SOLID", "Box_8_1")], "dx", "dy", "dz" +) model.do() model.end() @@ -104,4 +120,4 @@ model.testNbResults(Translation_98, 1) model.testNbSubResults(Translation_98, [0]) model.testNbSubShapes(Translation_98, GeomAPI_Shape.SOLID, [1]) model.testNbSubShapes(Translation_98, GeomAPI_Shape.FACE, [6]) -model.testHaveNamingFaces(Translation_98, model, Part_1_doc) \ No newline at end of file +model.testHaveNamingFaces(Translation_98, model, Part_1_doc) diff --git a/test.API/SHAPER/Transformations/TestTranslation_5.py b/test.API/SHAPER/Transformations/TestTranslation_5.py index f698051c1..f5242de3b 100644 --- a/test.API/SHAPER/Transformations/TestTranslation_5.py +++ b/test.API/SHAPER/Transformations/TestTranslation_5.py @@ -36,12 +36,24 @@ Box_4 = model.addBox(Part_1_doc, 10, 20, 10) # Sketches Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(47.23370043826552, 82.68004022993115, -80.41547074975036, -6.189635913624215) -SketchLine_2 = Sketch_1.addLine(-80.41547074975036, -6.189635913624215, 57.33252727276048, -26.79124265599387) -SketchLine_3 = Sketch_1.addLine(57.33252727276048, -26.79124265599387, 47.23370043826552, 82.68004022993115) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) +SketchLine_1 = Sketch_1.addLine( + 47.23370043826552, 82.68004022993115, -80.41547074975036, -6.189635913624215 +) +SketchLine_2 = Sketch_1.addLine( + -80.41547074975036, -6.189635913624215, 57.33252727276048, -26.79124265599387 +) +SketchLine_3 = Sketch_1.addLine( + 57.33252727276048, -26.79124265599387, 47.23370043826552, 82.68004022993115 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_3.endPoint() +) model.do() # Points @@ -49,17 +61,56 @@ 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/SketchLine_1_StartVertex")]) -Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex")]) +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", "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_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", "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]"), +) model.do() model.end() @@ -92,10 +143,12 @@ model.testHaveNamingFaces(Translation_105, model, Part_1_doc) model.testNbResults(Translation_100, 0) -assert(Translation_100.feature().error() == 'The feature uses equal shapes.') +assert Translation_100.feature().error() == "The feature uses equal shapes." model.testNbResults(Translation_101, 0) -assert(Translation_101.feature().error() == 'Attribute "start_point" is not initialized.') +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.') +assert Translation_102.feature().error() == 'Attribute "end_point" is not initialized.' diff --git a/test.compatibility/CSWA.py b/test.compatibility/CSWA.py index 8003936f2..1048589db 100644 --- a/test.compatibility/CSWA.py +++ b/test.compatibility/CSWA.py @@ -31,195 +31,499 @@ model.addParameter(Part_1_doc, "c", "100") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(-45, 0, 0, 0) SketchLine_2 = Sketch_1.addLine(0, 0, 23.33965093306752, 8.494938217797719) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(33.83092017818969, 6.16907982180411, 40, 0) SketchLine_4 = Sketch_1.addLine(40, 0, 55, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3") SketchLine_5 = Sketch_1.addLine(55, 0, 55, 48) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_4") SketchLine_6 = Sketch_1.addLine(55, 48, 15, 48) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5") SketchLine_7 = Sketch_1.addLine(15, 48, 15, 63) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_6") SketchLine_8 = Sketch_1.addLine(15, 63, -15, 63) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7") SketchLine_9 = Sketch_1.addLine(-15, 63, -15, 35.00000000000001) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8") SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_8.result()) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_1.result(), SketchLine_4.result()) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_1.result(), SketchLine_4.result() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_4.endPoint(), 15) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_1.endPoint(), 40) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_4.endPoint(), "c") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_8.startPoint(), SketchLine_6.result(), 15) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_8.startPoint(), SketchLine_5.result(), 40) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_4.endPoint(), 15 +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_1.endPoint(), 40 +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_4.endPoint(), "c" +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_8.startPoint(), SketchLine_6.result(), 15 +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_8.startPoint(), SketchLine_5.result(), 40 +) SketchLine_10 = Sketch_1.addLine(-45, 4.999999999999999, -45, 0) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_10.endPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_9") SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_9.startPoint(), SketchLine_1.result(), "a") -SketchArc_1 = Sketch_1.addArc(-45, 35, -45, 4.999999999999999, -15, 35.00000000000001, False) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_10.result()) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_9.startPoint(), SketchLine_1.result(), "a" +) +SketchArc_1 = Sketch_1.addArc( + -45, 35, -45, 4.999999999999999, -15, 35.00000000000001, False +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_10.result() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_10.startPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11") -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_1.result(), 45) -SketchConstraintAngle_2 = Sketch_1.setAngleBackward(SketchLine_2.result(), SketchLine_4.result(), 20) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_9.endPoint()) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_3.result(), SketchLine_1.result(), 45 +) +SketchConstraintAngle_2 = Sketch_1.setAngleBackward( + SketchLine_2.result(), SketchLine_4.result(), 20 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_9.endPoint() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_12") -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_9.result()) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_1.result(), 35) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_9.result() +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_1.result(), 35 +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 30) -SketchArc_2 = Sketch_1.addArc(26.75985236632421, -0.9019879900613652, 33.83092017818969, 6.16907982180411, 23.33965093306752, 8.494938217797719, False) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_3.startPoint()) +SketchArc_2 = Sketch_1.addArc( + 26.75985236632421, + -0.9019879900613652, + 33.83092017818969, + 6.16907982180411, + 23.33965093306752, + 8.494938217797719, + False, +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_13") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_2.endPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_2.endPoint() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_14") -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_2.result()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_3.result()) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_2.result() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_3.result() +) 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()) +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_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") +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]")) +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 = 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/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/Modified_Face&Sketch_1/SketchArc_1_2][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])2([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2([ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])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()) +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/Modified_Face&Sketch_1/SketchArc_1_2][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])2([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2([ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])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 = 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/Modified_Face&Sketch_1/SketchArc_1_2][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])2([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2([ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2")) -SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchArc_3.endPoint(), SketchArc_4.results()[1]) +SketchArc_4 = Sketch_3.addArc( + model.selection( + "EDGE", + "([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])2([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2([ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2", + ) +) +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) -SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchArc_3.startPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_19 = Sketch_3.setCoincident( + SketchArc_3.startPoint(), SketchLine_12.startPoint() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_20") -SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_12.endPoint()) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident( + SketchPoint_3.coordinates(), SketchLine_12.endPoint() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_21") -SketchArc_5 = Sketch_3.addArc(-45, 35, -15, 35.00000000000001, -17.02045759563121, 24.17663606626137, True) -SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchArc_4.result(), SketchArc_5.center()) +SketchArc_5 = Sketch_3.addArc( + -45, 35, -15, 35.00000000000001, -17.02045759563121, 24.17663606626137, True +) +SketchConstraintCoincidence_21 = Sketch_3.setCoincident( + SketchArc_4.result(), SketchArc_5.center() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_22") -SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchArc_5.startPoint()) +SketchConstraintCoincidence_22 = Sketch_3.setCoincident( + SketchPoint_3.coordinates(), SketchArc_5.startPoint() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_23") -SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchArc_3.results()[1], SketchArc_5.endPoint()) +SketchConstraintCoincidence_23 = Sketch_3.setCoincident( + SketchArc_3.results()[1], SketchArc_5.endPoint() +) 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")) -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]")) +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") +) +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 = 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/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()) +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/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/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()) +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") -SketchConstraintCoincidence_27 = Sketch_5.setCoincident(SketchArc_6.endPoint(), SketchArc_8.startPoint()) +SketchConstraintCoincidence_27 = Sketch_5.setCoincident( + SketchArc_6.endPoint(), SketchArc_8.startPoint() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_28") -SketchConstraintCoincidence_28 = Sketch_5.setCoincident(SketchArc_7.endPoint(), SketchArc_8.results()[1]) +SketchConstraintCoincidence_28 = Sketch_5.setCoincident( + SketchArc_7.endPoint(), SketchArc_8.results()[1] +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_29") -SketchConstraintCoincidence_29 = Sketch_5.setCoincident(SketchArc_7.startPoint(), SketchArc_6.startPoint()) +SketchConstraintCoincidence_29 = Sketch_5.setCoincident( + SketchArc_7.startPoint(), SketchArc_6.startPoint() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_30") SketchLine_13 = Sketch_5.addLine(-45, 5, -45, 10) -SketchConstraintCoincidence_30 = Sketch_5.setCoincident(SketchArc_6.startPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_30 = Sketch_5.setCoincident( + SketchArc_6.startPoint(), SketchLine_13.startPoint() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_31") SketchConstraintVertical_5 = Sketch_5.setVertical(SketchLine_13.result()) SketchConstraintLength_1 = Sketch_5.setLength(SketchLine_13.result(), 5) -SketchArc_9 = Sketch_5.addArc(-45, 35, -45, 10, -30.00000000000075, 14.99999999999944, False) -SketchConstraintCoincidence_31 = Sketch_5.setCoincident(SketchArc_6.center(), SketchArc_9.center()) +SketchArc_9 = Sketch_5.addArc( + -45, 35, -45, 10, -30.00000000000075, 14.99999999999944, False +) +SketchConstraintCoincidence_31 = Sketch_5.setCoincident( + SketchArc_6.center(), SketchArc_9.center() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_32") -SketchConstraintCoincidence_32 = Sketch_5.setCoincident(SketchArc_8.endPoint(), SketchArc_9.endPoint()) +SketchConstraintCoincidence_32 = Sketch_5.setCoincident( + SketchArc_8.endPoint(), SketchArc_9.endPoint() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_33") -SketchConstraintCoincidence_33 = Sketch_5.setCoincident(SketchArc_9.startPoint(), SketchLine_13.endPoint()) +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-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]")) +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 = 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 = 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/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_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 = 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/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()) +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]) +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, 47.99999999999999) -SketchConstraintCoincidence_38 = Sketch_6.setCoincident(SketchArc_10.startPoint(), SketchLine_18.startPoint()) +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 = Sketch_6.setCoincident( + SketchLine_14.endPoint(), SketchLine_18.endPoint() +) SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_40") SketchLine_19 = Sketch_6.addLine(35, 47.99999999999999, 55, 47.99999999999999) -SketchConstraintCoincidence_40 = Sketch_6.setCoincident(SketchLine_16.endPoint(), SketchLine_19.startPoint()) +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 = 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/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")) +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/Modified_Face&Sketch_1/SketchLine_5][ExtrusionCut_2_1/From_Face]")) -SketchConstraintDistance_9 = Sketch_7.setDistance(SketchCircle_4.center(), SketchLine_20.result(), 10, False) +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&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()) +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 = 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_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")) +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) SketchLine_25 = Sketch_8.addLine(55, 13, 55, 25) -SketchConstraintCoincidence_44 = Sketch_8.setCoincident(SketchLine_25.endPoint(), SketchLine_22.startPoint()) +SketchConstraintCoincidence_44 = Sketch_8.setCoincident( + SketchLine_25.endPoint(), SketchLine_22.startPoint() +) SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_45") -SketchConstraintCoincidence_45 = Sketch_8.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) +SketchConstraintCoincidence_45 = Sketch_8.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.startPoint() +) SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_46") -SketchConstraintCoincidence_46 = Sketch_8.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) +SketchConstraintCoincidence_46 = Sketch_8.setCoincident( + SketchLine_23.endPoint(), SketchLine_24.startPoint() +) SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_47") -SketchConstraintCoincidence_47 = Sketch_8.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint()) +SketchConstraintCoincidence_47 = Sketch_8.setCoincident( + SketchLine_24.endPoint(), SketchLine_25.startPoint() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_48") SketchConstraintHorizontal_5 = Sketch_8.setHorizontal(SketchLine_22.result()) SketchConstraintVertical_7 = Sketch_8.setVertical(SketchLine_23.result()) @@ -227,46 +531,143 @@ 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/Modified_Face&Sketch_1/SketchLine_5][ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_6]"), False) +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 = 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/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()) +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_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")) +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()) +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/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()) +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.00000000000009) -SketchConstraintDistance_10 = Sketch_9.setDistance(SketchLine_28.startPoint(), SketchLine_29.result(), 18, False) +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 = 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()) +SketchConstraintCoincidence_53 = Sketch_9.setCoincident( + SketchLine_29.startPoint(), SketchLine_31.endPoint() +) SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_54") SketchLine_32 = Sketch_9.addLine(25, -63, 25, -45) -SketchConstraintCoincidence_54 = Sketch_9.setCoincident(SketchLine_29.startPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_54 = Sketch_9.setCoincident( + SketchLine_29.startPoint(), SketchLine_32.startPoint() +) SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_55") -SketchConstraintCoincidence_55 = Sketch_9.setCoincident(SketchLine_28.startPoint(), SketchLine_32.endPoint()) +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_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")) +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/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) +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_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")]) +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 diff --git a/test.compatibility/angle30.py b/test.compatibility/angle30.py index 9e9dbc4f4..56f613d10 100644 --- a/test.compatibility/angle30.py +++ b/test.compatibility/angle30.py @@ -39,112 +39,224 @@ SketchLine_4 = Sketch_1.addLine(50, 0, -53.92304845413265, -60) 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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(44, 9.237604307034037, 44, 70) SketchLine_5.setName("SketchLine_8") SketchLine_5.result().setName("SketchLine_8") -SketchLine_6 = Sketch_1.addLine(-53.92304845413265, -60, -56.92304845413265, -54.80384757729332) +SketchLine_6 = Sketch_1.addLine( + -53.92304845413265, -60, -56.92304845413265, -54.80384757729332 +) SketchLine_6.setName("SketchLine_3") SketchLine_6.result().setName("SketchLine_3") -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_6.startPoint()) -SketchLine_7 = Sketch_1.addLine(-56.92304845413265, -54.80384757729332, 39, 0.5773502691896394) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_6.startPoint() +) +SketchLine_7 = Sketch_1.addLine( + -56.92304845413265, -54.80384757729332, 39, 0.5773502691896394 +) SketchLine_7.setName("SketchLine_9") SketchLine_7.result().setName("SketchLine_9") -SketchLine_8 = Sketch_1.addLine(-56.92304845413265, -54.80384757729332, 44, 3.464101615137764) +SketchLine_8 = Sketch_1.addLine( + -56.92304845413265, -54.80384757729332, 44, 3.464101615137764 +) SketchLine_8.setName("SketchLine_4") SketchLine_8.result().setName("SketchLine_4") SketchLine_8.setAuxiliary(True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(44, 3.464101615137764, 44, 70) SketchLine_9.setName("SketchLine_5") SketchLine_9.result().setName("SketchLine_5") SketchLine_9.setAuxiliary(True) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchLine_10 = Sketch_1.addLine(44, 70, 50, 70) SketchLine_10.setName("SketchLine_6") SketchLine_10.result().setName("SketchLine_6") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_10.endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_10.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.startPoint(), SketchLine_9.result(), "H", False) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.startPoint(), SketchLine_9.result(), "H", False +) SketchLine_11 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_11.setName("SketchLine_7") SketchLine_11.result().setName("SketchLine_7") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.startPoint(), SketchLine_11.result(), 50, False) -SketchArc_1 = Sketch_1.addArc(34, 9.237604307034037, 39, 0.5773502691896394, 44, 9.237604307034037, False) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_7.endPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_5.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_5.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_7.result()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_5.endPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.result()) -SketchArc_2 = Sketch_1.addArc(34, 9.237604307034022, 42, -4.618802153516998, 50, 9.237604307034024, False) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_1.endPoint()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_1.result()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_2.result()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_2.endPoint()) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.result()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_4.result()) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_4.startPoint(), 70, False) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_2.result(), SketchLine_6.result()) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_2.result(), 6, False) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_7.result()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_2.result(), 119.9999999999999) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_4.startPoint(), SketchLine_6.startPoint(), 120, False) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_3.startPoint(), SketchLine_11.result(), 50, False +) +SketchArc_1 = Sketch_1.addArc( + 34, 9.237604307034037, 39, 0.5773502691896394, 44, 9.237604307034037, False +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_7.endPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_5.result() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_7.result() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_5.endPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_8.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.result() +) +SketchArc_2 = Sketch_1.addArc( + 34, 9.237604307034022, 42, -4.618802153516998, 50, 9.237604307034024, False +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_1.endPoint() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_1.result() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_2.result() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_2.endPoint() +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.result() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_4.result() +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_4.startPoint(), 70, False +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_2.result(), SketchLine_6.result() +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_6.endPoint(), SketchLine_2.result(), 6, False +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_2.result(), SketchLine_7.result() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_2.result(), 119.9999999999999 +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_4.startPoint(), SketchLine_6.startPoint(), 120, False +) SketchLine_12 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_12.result()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_4.startPoint(), SketchLine_12.result() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_2.results()[1], 16) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_1.results()[1], 10) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_2.addCircle(0, 0, 17.5) SketchPoint_1 = Sketch_2.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchPoint_1.result()) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchCircle_1.center(), SketchPoint_1.result() +) SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_1.results()[1], 17.5) SketchCircle_2 = Sketch_2.addCircle(0, 0, 14.5) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchCircle_2.center()) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchCircle_2.center()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchCircle_1.center(), SketchCircle_2.center() +) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchPoint_1.coordinates(), SketchCircle_2.center() +) SketchConstraintRadius_4 = Sketch_2.setRadius(SketchCircle_2.results()[1], 14.5) model.do() Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchLine_13 = Sketch_3.addLine(-22, 70, -22, -35.79571668975675) SketchLine_14 = Sketch_3.addLine(-22, -35.79571668975675, 55, 8.660254037844405) -SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_23 = Sketch_3.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchLine_15 = Sketch_3.addLine(55, 8.660254037844405, 55, 70) -SketchConstraintCoincidence_24 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_24 = Sketch_3.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) SketchLine_16 = Sketch_3.addLine(55, 70, -22, 70) -SketchConstraintCoincidence_25 = Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchLine_13.startPoint(), SketchLine_16.endPoint()) +SketchConstraintCoincidence_25 = Sketch_3.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_26 = Sketch_3.setCoincident( + SketchLine_13.startPoint(), SketchLine_16.endPoint() +) 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/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) +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")) -SketchConstraintDistance_7 = Sketch_3.setDistance(SketchLine_16.startPoint(), SketchLine_18.result(), 55, False) -SketchConstraintDistance_8 = Sketch_3.setDistance(SketchLine_13.startPoint(), SketchLine_18.result(), 22, False) +SketchConstraintDistance_7 = Sketch_3.setDistance( + SketchLine_16.startPoint(), SketchLine_18.result(), 55, False +) +SketchConstraintDistance_8 = Sketch_3.setDistance( + SketchLine_13.startPoint(), SketchLine_18.result(), 22, False +) SketchLine_19 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_15.endPoint(), SketchLine_19.result(), 70, False) +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/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")]) +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")) SketchLine_20 = Sketch_4.addLine(-4, 38, -4, 21.26617031813674) SketchLine_20.setName("SketchLine_36") SketchLine_20.result().setName("SketchLine_36") -SketchArc_3 = Sketch_4.addArc(0, 0, -8.5, 15.2970585407786, -7.446808510638298, 15.83650981137842, True) +SketchArc_3 = Sketch_4.addArc( + 0, 0, -8.5, 15.2970585407786, -7.446808510638298, 15.83650981137842, True +) SketchArc_3.setName("SketchArc_6") SketchArc_3.result().setName("SketchArc_6") SketchArc_3.results()[1].setName("SketchArc_6_2") -SketchArc_4 = Sketch_4.addArc(0, 0, 7.446808510638299, 15.83650981137842, 8.5, 15.29705854077835, True) +SketchArc_4 = Sketch_4.addArc( + 0, 0, 7.446808510638299, 15.83650981137842, 8.5, 15.29705854077835, True +) SketchArc_4.setName("SketchArc_8") SketchArc_4.result().setName("SketchArc_8") SketchArc_4.results()[1].setName("SketchArc_8_2") @@ -171,29 +283,41 @@ SketchLine_27 = Sketch_4.addLine(4, 17.03672503740084, 4, 44) SketchLine_27.setName("SketchLine_27") SketchLine_27.result().setName("SketchLine_27") SketchLine_27.setAuxiliary(True) -SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchLine_26.startPoint()) +SketchConstraintCoincidence_27 = Sketch_4.setCoincident( + SketchLine_27.endPoint(), SketchLine_26.startPoint() +) SketchLine_28 = Sketch_4.addLine(10.1, 44, 10.1, 45) SketchLine_28.setName("SketchLine_28") SketchLine_28.result().setName("SketchLine_28") -SketchConstraintCoincidence_28 = Sketch_4.setCoincident(SketchLine_26.endPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_28 = Sketch_4.setCoincident( + SketchLine_26.endPoint(), SketchLine_28.startPoint() +) SketchLine_29 = Sketch_4.addLine(10.1, 45, -10.1, 45) SketchLine_29.setName("SketchLine_29") SketchLine_29.result().setName("SketchLine_29") -SketchConstraintCoincidence_29 = Sketch_4.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_29 = Sketch_4.setCoincident( + SketchLine_28.endPoint(), SketchLine_29.startPoint() +) SketchLine_30 = Sketch_4.addLine(-10.1, 45, -10.1, 44) SketchLine_30.setName("SketchLine_30") SketchLine_30.result().setName("SketchLine_30") -SketchConstraintCoincidence_30 = Sketch_4.setCoincident(SketchLine_29.endPoint(), SketchLine_30.startPoint()) +SketchConstraintCoincidence_30 = Sketch_4.setCoincident( + SketchLine_29.endPoint(), SketchLine_30.startPoint() +) SketchLine_31 = Sketch_4.addLine(-10.1, 44, -4, 44) SketchLine_31.setName("SketchLine_31") SketchLine_31.result().setName("SketchLine_31") SketchLine_31.setAuxiliary(True) -SketchConstraintCoincidence_31 = Sketch_4.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_31 = Sketch_4.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) SketchLine_32 = Sketch_4.addLine(-4, 44, -4, 17.03672503740078) SketchLine_32.setName("SketchLine_20") SketchLine_32.result().setName("SketchLine_20") SketchLine_32.setAuxiliary(True) -SketchConstraintCoincidence_32 = Sketch_4.setCoincident(SketchLine_32.startPoint(), SketchLine_31.endPoint()) +SketchConstraintCoincidence_32 = Sketch_4.setCoincident( + SketchLine_32.startPoint(), SketchLine_31.endPoint() +) SketchConstraintVertical_5 = Sketch_4.setVertical(SketchLine_32.result()) SketchConstraintVertical_6 = Sketch_4.setVertical(SketchLine_27.result()) SketchConstraintHorizontal_3 = Sketch_4.setHorizontal(SketchLine_29.result()) @@ -206,11 +330,15 @@ SketchConstraintVertical_10 = Sketch_4.setVertical(SketchLine_22.result()) SketchLine_33 = Sketch_4.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_33.setName("SketchLine_32") SketchLine_33.result().setName("SketchLine_32") -SketchConstraintDistance_10 = Sketch_4.setDistance(SketchLine_22.startPoint(), SketchLine_32.result(), 4.5, False) +SketchConstraintDistance_10 = Sketch_4.setDistance( + SketchLine_22.startPoint(), SketchLine_32.result(), 4.5, False +) SketchLine_34 = Sketch_4.addLine(-8.5, 12, 8.5, 12) SketchLine_34.setName("SketchLine_33") SketchLine_34.result().setName("SketchLine_33") -SketchConstraintCoincidence_33 = Sketch_4.setCoincident(SketchLine_22.endPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_33 = Sketch_4.setCoincident( + SketchLine_22.endPoint(), SketchLine_34.startPoint() +) SketchConstraintHorizontal_6 = Sketch_4.setHorizontal(SketchLine_34.result()) SketchPoint_2 = Sketch_4.addPoint(model.selection("VERTEX", "PartSet/Origin")) SketchArc_5 = Sketch_4.addArc(0, 0, -8.5, 15.29705854, -4, 17.0367250374, True) @@ -218,37 +346,83 @@ SketchArc_5.setName("SketchArc_4") SketchArc_5.result().setName("SketchArc_4") SketchArc_5.results()[1].setName("SketchArc_4_2") SketchArc_5.setAuxiliary(True) -SketchConstraintCoincidence_34 = Sketch_4.setCoincident(SketchLine_22.startPoint(), SketchArc_5.startPoint()) +SketchConstraintCoincidence_34 = Sketch_4.setCoincident( + SketchLine_22.startPoint(), SketchArc_5.startPoint() +) SketchArc_6 = Sketch_4.addArc(0, 0, 4, 17.0367250374, 8.5, 15.29705854, True) SketchArc_6.setName("SketchArc_5") SketchArc_6.result().setName("SketchArc_5") SketchArc_6.results()[1].setName("SketchArc_5_2") SketchArc_6.setAuxiliary(True) -SketchConstraintCoincidence_35 = Sketch_4.setCoincident(SketchLine_25.endPoint(), SketchArc_6.endPoint()) +SketchConstraintCoincidence_35 = Sketch_4.setCoincident( + SketchLine_25.endPoint(), SketchArc_6.endPoint() +) SketchPoint_3 = Sketch_4.addPoint(-4, 17.03672503740078) SketchPoint_4 = Sketch_4.addPoint(4, 17.03672503740084) -SketchConstraintCoincidence_36 = Sketch_4.setCoincident(SketchArc_5.endPoint(), SketchPoint_3.coordinates()) -SketchConstraintCoincidence_37 = Sketch_4.setCoincident(SketchArc_6.startPoint(), SketchPoint_4.coordinates()) -SketchConstraintCoincidence_38 = Sketch_4.setCoincident(SketchArc_5.endPoint(), SketchLine_32.endPoint()) -SketchConstraintCoincidence_39 = Sketch_4.setCoincident(SketchPoint_4.coordinates(), SketchLine_27.startPoint()) -SketchArc_7 = Sketch_4.addArc(-10, 21.26617031813674, -7.446808510638298, 15.83650981137842, -4, 21.26617031813674, False) +SketchConstraintCoincidence_36 = Sketch_4.setCoincident( + SketchArc_5.endPoint(), SketchPoint_3.coordinates() +) +SketchConstraintCoincidence_37 = Sketch_4.setCoincident( + SketchArc_6.startPoint(), SketchPoint_4.coordinates() +) +SketchConstraintCoincidence_38 = Sketch_4.setCoincident( + SketchArc_5.endPoint(), SketchLine_32.endPoint() +) +SketchConstraintCoincidence_39 = Sketch_4.setCoincident( + SketchPoint_4.coordinates(), SketchLine_27.startPoint() +) +SketchArc_7 = Sketch_4.addArc( + -10, + 21.26617031813674, + -7.446808510638298, + 15.83650981137842, + -4, + 21.26617031813674, + False, +) SketchArc_7.setName("SketchArc_7") SketchArc_7.result().setName("SketchArc_7") SketchArc_7.results()[1].setName("SketchArc_7_2") -SketchConstraintCoincidence_40 = Sketch_4.setCoincident(SketchArc_7.startPoint(), SketchArc_3.endPoint()) +SketchConstraintCoincidence_40 = Sketch_4.setCoincident( + SketchArc_7.startPoint(), SketchArc_3.endPoint() +) SketchLine_35 = Sketch_4.addLine(-4, 44, -4, 21.26617031813674) SketchLine_35.setName("SketchLine_34") SketchLine_35.result().setName("SketchLine_34") SketchLine_35.setAuxiliary(True) -SketchConstraintCoincidence_41 = Sketch_4.setCoincident(SketchArc_7.endPoint(), SketchLine_35.endPoint()) -SketchConstraintTangent_5 = Sketch_4.setTangent(SketchArc_7.results()[1], SketchLine_35.result()) -SketchConstraintTangent_6 = Sketch_4.setTangent(SketchArc_7.results()[1], SketchArc_3.results()[1]) -SketchConstraintCoincidence_42 = Sketch_4.setCoincident(SketchLine_32.startPoint(), SketchLine_35.startPoint()) -SketchConstraintCoincidence_43 = Sketch_4.setCoincident(SketchArc_5.startPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_7 = Sketch_4.setTangent(SketchArc_5.results()[1], SketchArc_3.results()[1]) -SketchConstraintCoincidence_44 = Sketch_4.setCoincident(SketchLine_35.endPoint(), SketchLine_32.result()) -SketchConstraintCoincidence_45 = Sketch_4.setCoincident(SketchArc_3.endPoint(), SketchArc_5.results()[1]) -SketchArc_8 = Sketch_4.addArc(10, 21.26617031813674, 4, 21.26617031813674, 7.446808510638299, 15.83650981137842, False) +SketchConstraintCoincidence_41 = Sketch_4.setCoincident( + SketchArc_7.endPoint(), SketchLine_35.endPoint() +) +SketchConstraintTangent_5 = Sketch_4.setTangent( + SketchArc_7.results()[1], SketchLine_35.result() +) +SketchConstraintTangent_6 = Sketch_4.setTangent( + SketchArc_7.results()[1], SketchArc_3.results()[1] +) +SketchConstraintCoincidence_42 = Sketch_4.setCoincident( + SketchLine_32.startPoint(), SketchLine_35.startPoint() +) +SketchConstraintCoincidence_43 = Sketch_4.setCoincident( + SketchArc_5.startPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_7 = Sketch_4.setTangent( + SketchArc_5.results()[1], SketchArc_3.results()[1] +) +SketchConstraintCoincidence_44 = Sketch_4.setCoincident( + SketchLine_35.endPoint(), SketchLine_32.result() +) +SketchConstraintCoincidence_45 = Sketch_4.setCoincident( + SketchArc_3.endPoint(), SketchArc_5.results()[1] +) +SketchArc_8 = Sketch_4.addArc( + 10, + 21.26617031813674, + 4, + 21.26617031813674, + 7.446808510638299, + 15.83650981137842, + False, +) SketchArc_8.setName("SketchArc_9") SketchArc_8.result().setName("SketchArc_9") SketchArc_8.results()[1].setName("SketchArc_9_2") @@ -256,82 +430,200 @@ SketchLine_36 = Sketch_4.addLine(4, 21.26617031813674, 4, 44) SketchLine_36.setName("SketchLine_35") SketchLine_36.result().setName("SketchLine_35") SketchLine_36.setAuxiliary(True) -SketchConstraintCoincidence_46 = Sketch_4.setCoincident(SketchArc_8.startPoint(), SketchLine_36.startPoint()) -SketchConstraintCoincidence_47 = Sketch_4.setCoincident(SketchArc_8.endPoint(), SketchArc_4.startPoint()) -SketchConstraintTangent_8 = Sketch_4.setTangent(SketchArc_8.results()[1], SketchArc_4.results()[1]) -SketchConstraintTangent_9 = Sketch_4.setTangent(SketchArc_8.results()[1], SketchLine_36.result()) -SketchConstraintCoincidence_48 = Sketch_4.setCoincident(SketchArc_6.endPoint(), SketchArc_4.endPoint()) -SketchConstraintCoincidence_49 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchLine_36.endPoint()) -SketchConstraintTangent_10 = Sketch_4.setTangent(SketchArc_6.results()[1], SketchArc_4.results()[1]) -SketchConstraintCoincidence_50 = Sketch_4.setCoincident(SketchArc_4.startPoint(), SketchArc_6.results()[1]) -SketchConstraintCoincidence_51 = Sketch_4.setCoincident(SketchLine_36.startPoint(), SketchLine_27.result()) -SketchConstraintCoincidence_52 = Sketch_4.setCoincident(SketchLine_25.startPoint(), SketchLine_34.endPoint()) -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_54 = Sketch_4.setCoincident(SketchArc_4.endPoint(), SketchCircle_3.results()[1]) +SketchConstraintCoincidence_46 = Sketch_4.setCoincident( + SketchArc_8.startPoint(), SketchLine_36.startPoint() +) +SketchConstraintCoincidence_47 = Sketch_4.setCoincident( + SketchArc_8.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintTangent_8 = Sketch_4.setTangent( + SketchArc_8.results()[1], SketchArc_4.results()[1] +) +SketchConstraintTangent_9 = Sketch_4.setTangent( + SketchArc_8.results()[1], SketchLine_36.result() +) +SketchConstraintCoincidence_48 = Sketch_4.setCoincident( + SketchArc_6.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintCoincidence_49 = Sketch_4.setCoincident( + SketchLine_27.endPoint(), SketchLine_36.endPoint() +) +SketchConstraintTangent_10 = Sketch_4.setTangent( + SketchArc_6.results()[1], SketchArc_4.results()[1] +) +SketchConstraintCoincidence_50 = Sketch_4.setCoincident( + SketchArc_4.startPoint(), SketchArc_6.results()[1] +) +SketchConstraintCoincidence_51 = Sketch_4.setCoincident( + SketchLine_36.startPoint(), SketchLine_27.result() +) +SketchConstraintCoincidence_52 = Sketch_4.setCoincident( + SketchLine_25.startPoint(), SketchLine_34.endPoint() +) +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_54 = Sketch_4.setCoincident( + SketchArc_4.endPoint(), SketchCircle_3.results()[1] +) SketchConstraintRadius_5 = Sketch_4.setRadius(SketchArc_7.results()[1], 6) SketchConstraintRadius_6 = Sketch_4.setRadius(SketchArc_8.results()[1], 6) -SketchConstraintDistance_11 = Sketch_4.setDistance(SketchLine_25.endPoint(), SketchLine_36.result(), 4.5, False) -SketchConstraintDistance_12 = Sketch_4.setDistance(SketchArc_8.startPoint(), SketchLine_33.result(), 4, False) -SketchConstraintDistance_13 = Sketch_4.setDistance(SketchArc_7.endPoint(), SketchLine_33.result(), 4, False) +SketchConstraintDistance_11 = Sketch_4.setDistance( + SketchLine_25.endPoint(), SketchLine_36.result(), 4.5, False +) +SketchConstraintDistance_12 = Sketch_4.setDistance( + SketchArc_8.startPoint(), SketchLine_33.result(), 4, False +) +SketchConstraintDistance_13 = Sketch_4.setDistance( + SketchArc_7.endPoint(), SketchLine_33.result(), 4, False +) SketchArc_9 = Sketch_4.addArc(-10, 38, -4, 38, -10, 44, False) SketchArc_9.setName("SketchArc_10") SketchArc_9.result().setName("SketchArc_10") SketchArc_9.results()[1].setName("SketchArc_10_2") -SketchConstraintCoincidence_55 = Sketch_4.setCoincident(SketchArc_9.startPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_56 = Sketch_4.setCoincident(SketchArc_9.endPoint(), SketchLine_23.endPoint()) -SketchConstraintTangent_11 = Sketch_4.setTangent(SketchArc_9.results()[1], SketchLine_20.result()) -SketchConstraintTangent_12 = Sketch_4.setTangent(SketchArc_9.results()[1], SketchLine_23.result()) -SketchConstraintCoincidence_57 = Sketch_4.setCoincident(SketchLine_35.endPoint(), SketchLine_20.endPoint()) -SketchConstraintCoincidence_58 = Sketch_4.setCoincident(SketchLine_31.startPoint(), SketchLine_23.startPoint()) -SketchConstraintCoincidence_59 = Sketch_4.setCoincident(SketchLine_20.startPoint(), SketchLine_35.result()) -SketchConstraintCoincidence_60 = Sketch_4.setCoincident(SketchLine_23.endPoint(), SketchLine_31.result()) +SketchConstraintCoincidence_55 = Sketch_4.setCoincident( + SketchArc_9.startPoint(), SketchLine_20.startPoint() +) +SketchConstraintCoincidence_56 = Sketch_4.setCoincident( + SketchArc_9.endPoint(), SketchLine_23.endPoint() +) +SketchConstraintTangent_11 = Sketch_4.setTangent( + SketchArc_9.results()[1], SketchLine_20.result() +) +SketchConstraintTangent_12 = Sketch_4.setTangent( + SketchArc_9.results()[1], SketchLine_23.result() +) +SketchConstraintCoincidence_57 = Sketch_4.setCoincident( + SketchLine_35.endPoint(), SketchLine_20.endPoint() +) +SketchConstraintCoincidence_58 = Sketch_4.setCoincident( + SketchLine_31.startPoint(), SketchLine_23.startPoint() +) +SketchConstraintCoincidence_59 = Sketch_4.setCoincident( + SketchLine_20.startPoint(), SketchLine_35.result() +) +SketchConstraintCoincidence_60 = Sketch_4.setCoincident( + SketchLine_23.endPoint(), SketchLine_31.result() +) SketchArc_10 = Sketch_4.addArc(10, 38, 10, 44, 4, 38, False) SketchArc_10.setName("SketchArc_11") SketchArc_10.result().setName("SketchArc_11") SketchArc_10.results()[1].setName("SketchArc_11_2") -SketchConstraintCoincidence_61 = Sketch_4.setCoincident(SketchArc_10.startPoint(), SketchLine_24.startPoint()) -SketchConstraintCoincidence_62 = Sketch_4.setCoincident(SketchArc_10.endPoint(), SketchLine_21.endPoint()) -SketchConstraintTangent_13 = Sketch_4.setTangent(SketchArc_10.results()[1], SketchLine_21.result()) -SketchConstraintTangent_14 = Sketch_4.setTangent(SketchArc_10.results()[1], SketchLine_24.result()) -SketchConstraintCoincidence_63 = Sketch_4.setCoincident(SketchLine_36.startPoint(), SketchLine_21.startPoint()) -SketchConstraintCoincidence_64 = Sketch_4.setCoincident(SketchLine_26.endPoint(), SketchLine_24.endPoint()) -SketchConstraintCoincidence_65 = Sketch_4.setCoincident(SketchLine_21.endPoint(), SketchLine_36.result()) -SketchConstraintCoincidence_66 = Sketch_4.setCoincident(SketchLine_24.startPoint(), SketchLine_26.result()) +SketchConstraintCoincidence_61 = Sketch_4.setCoincident( + SketchArc_10.startPoint(), SketchLine_24.startPoint() +) +SketchConstraintCoincidence_62 = Sketch_4.setCoincident( + SketchArc_10.endPoint(), SketchLine_21.endPoint() +) +SketchConstraintTangent_13 = Sketch_4.setTangent( + SketchArc_10.results()[1], SketchLine_21.result() +) +SketchConstraintTangent_14 = Sketch_4.setTangent( + SketchArc_10.results()[1], SketchLine_24.result() +) +SketchConstraintCoincidence_63 = Sketch_4.setCoincident( + SketchLine_36.startPoint(), SketchLine_21.startPoint() +) +SketchConstraintCoincidence_64 = Sketch_4.setCoincident( + SketchLine_26.endPoint(), SketchLine_24.endPoint() +) +SketchConstraintCoincidence_65 = Sketch_4.setCoincident( + SketchLine_21.endPoint(), SketchLine_36.result() +) +SketchConstraintCoincidence_66 = Sketch_4.setCoincident( + SketchLine_24.startPoint(), SketchLine_26.result() +) SketchConstraintRadius_7 = Sketch_4.setRadius(SketchArc_9.results()[1], 6) SketchConstraintRadius_8 = Sketch_4.setRadius(SketchArc_10.results()[1], 6) -SketchConstraintDistance_14 = Sketch_4.setDistance(SketchLine_23.startPoint(), SketchLine_29.result(), 1, False) -SketchConstraintDistance_15 = Sketch_4.setDistance(SketchLine_24.endPoint(), SketchLine_29.result(), 1, False) +SketchConstraintDistance_14 = Sketch_4.setDistance( + SketchLine_23.startPoint(), SketchLine_29.result(), 1, False +) +SketchConstraintDistance_15 = Sketch_4.setDistance( + SketchLine_24.endPoint(), SketchLine_29.result(), 1, False +) SketchLine_37 = Sketch_4.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_37.setName("SketchLine_40") SketchLine_37.result().setName("SketchLine_40") -SketchConstraintDistance_16 = Sketch_4.setDistance(SketchArc_10.startPoint(), SketchLine_37.result(), 44, False) -SketchConstraintDistance_17 = Sketch_4.setDistance(SketchLine_21.result(), SketchLine_24.endPoint(), 6.1, False) -SketchConstraintDistance_18 = Sketch_4.setDistance(SketchLine_30.endPoint(), SketchLine_20.result(), 6.1, False) -SketchConstraintCoincidence_67 = Sketch_4.setCoincident(SketchArc_3.center(), SketchCircle_3.center()) -SketchConstraintCoincidence_68 = Sketch_4.setCoincident(SketchArc_4.center(), SketchArc_3.center()) -SketchConstraintDistance_19 = Sketch_4.setDistance(SketchArc_4.center(), SketchLine_34.result(), 12, False) +SketchConstraintDistance_16 = Sketch_4.setDistance( + SketchArc_10.startPoint(), SketchLine_37.result(), 44, False +) +SketchConstraintDistance_17 = Sketch_4.setDistance( + SketchLine_21.result(), SketchLine_24.endPoint(), 6.1, False +) +SketchConstraintDistance_18 = Sketch_4.setDistance( + SketchLine_30.endPoint(), SketchLine_20.result(), 6.1, False +) +SketchConstraintCoincidence_67 = Sketch_4.setCoincident( + SketchArc_3.center(), SketchCircle_3.center() +) +SketchConstraintCoincidence_68 = Sketch_4.setCoincident( + SketchArc_4.center(), SketchArc_3.center() +) +SketchConstraintDistance_19 = Sketch_4.setDistance( + SketchArc_4.center(), SketchLine_34.result(), 12, False +) model.do() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), 50, 30) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 22, 22) -Common_2 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1")], [model.selection("SOLID", "Extrusion_4_1")]) -Extrusion_5 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 22, 22) -Extrusion_6 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 75, 40) -Common_3 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_6_1")], [model.selection("SOLID", "Extrusion_5_1")]) +Extrusion_3 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), 50, 30 +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 22, 22 +) +Common_2 = model.addCommon( + Part_1_doc, + [model.selection("SOLID", "Extrusion_3_1")], + [model.selection("SOLID", "Extrusion_4_1")], +) +Extrusion_5 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 22, 22 +) +Extrusion_6 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], + model.selection(), + 75, + 40, +) +Common_3 = model.addCommon( + Part_1_doc, + [model.selection("SOLID", "Extrusion_6_1")], + [model.selection("SOLID", "Extrusion_5_1")], +) Sketch_5 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchLine_38 = Sketch_5.addLine(44, 3.464101615137764, 16.5, 51.0954988232819) SketchLine_38.setName("SketchLine_41") SketchLine_38.result().setName("SketchLine_41") -SketchPoint_5 = Sketch_5.addPoint(model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex")) -SketchConstraintCoincidence_69 = Sketch_5.setCoincident(SketchLine_38.startPoint(), SketchPoint_5.result()) +SketchPoint_5 = Sketch_5.addPoint( + model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex") +) +SketchConstraintCoincidence_69 = Sketch_5.setCoincident( + SketchLine_38.startPoint(), SketchPoint_5.result() +) 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()) +SketchConstraintPerpendicular_2 = Sketch_5.setPerpendicular( + SketchLine_38.result(), SketchLine_39.result() +) SketchConstraintLength_1 = Sketch_5.setLength(SketchLine_38.result(), 55) model.do() -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) +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(4, 13, 4, 12.9) SketchLine_40.setName("SketchLine_55") @@ -343,7 +635,9 @@ SketchLine_42 = Sketch_6.addLine(4, 19, 4, 12.9) SketchLine_42.setName("SketchLine_43") SketchLine_42.result().setName("SketchLine_43") SketchLine_42.setAuxiliary(True) -SketchConstraintCoincidence_70 = Sketch_6.setCoincident(SketchLine_42.endPoint(), SketchLine_41.startPoint()) +SketchConstraintCoincidence_70 = Sketch_6.setCoincident( + SketchLine_42.endPoint(), SketchLine_41.startPoint() +) SketchLine_43 = Sketch_6.addLine(-4, 12.9, -4, 13) SketchLine_43.setName("SketchLine_52") SketchLine_43.result().setName("SketchLine_52") @@ -354,7 +648,9 @@ SketchLine_45 = Sketch_6.addLine(-4, 12.9, -4, 19) SketchLine_45.setName("SketchLine_45") SketchLine_45.result().setName("SketchLine_45") SketchLine_45.setAuxiliary(True) -SketchConstraintCoincidence_71 = Sketch_6.setCoincident(SketchLine_41.endPoint(), SketchLine_45.startPoint()) +SketchConstraintCoincidence_71 = Sketch_6.setCoincident( + SketchLine_41.endPoint(), SketchLine_45.startPoint() +) SketchLine_46 = Sketch_6.addLine(10.1, 19, 10, 19) SketchLine_46.setName("SketchLine_54") SketchLine_46.result().setName("SketchLine_54") @@ -362,25 +658,37 @@ SketchLine_47 = Sketch_6.addLine(-4, 19, -10.1, 19) SketchLine_47.setName("SketchLine_46") SketchLine_47.result().setName("SketchLine_46") SketchLine_47.setAuxiliary(True) -SketchConstraintCoincidence_72 = Sketch_6.setCoincident(SketchLine_45.endPoint(), SketchLine_47.startPoint()) +SketchConstraintCoincidence_72 = Sketch_6.setCoincident( + SketchLine_45.endPoint(), SketchLine_47.startPoint() +) SketchLine_48 = Sketch_6.addLine(-10.1, 19, -10.1, 19.8) SketchLine_48.setName("SketchLine_47") SketchLine_48.result().setName("SketchLine_47") -SketchConstraintCoincidence_73 = Sketch_6.setCoincident(SketchLine_47.endPoint(), SketchLine_48.startPoint()) +SketchConstraintCoincidence_73 = Sketch_6.setCoincident( + SketchLine_47.endPoint(), SketchLine_48.startPoint() +) SketchLine_49 = Sketch_6.addLine(-10.1, 19.8, 10.1, 19.8) SketchLine_49.setName("SketchLine_48") SketchLine_49.result().setName("SketchLine_48") -SketchConstraintCoincidence_74 = Sketch_6.setCoincident(SketchLine_48.endPoint(), SketchLine_49.startPoint()) +SketchConstraintCoincidence_74 = Sketch_6.setCoincident( + SketchLine_48.endPoint(), SketchLine_49.startPoint() +) SketchLine_50 = Sketch_6.addLine(10.1, 19.8, 10.1, 19) SketchLine_50.setName("SketchLine_49") SketchLine_50.result().setName("SketchLine_49") -SketchConstraintCoincidence_75 = Sketch_6.setCoincident(SketchLine_49.endPoint(), SketchLine_50.startPoint()) +SketchConstraintCoincidence_75 = Sketch_6.setCoincident( + SketchLine_49.endPoint(), SketchLine_50.startPoint() +) SketchLine_51 = Sketch_6.addLine(10.1, 19, 4, 19) SketchLine_51.setName("SketchLine_50") SketchLine_51.result().setName("SketchLine_50") SketchLine_51.setAuxiliary(True) -SketchConstraintCoincidence_76 = Sketch_6.setCoincident(SketchLine_50.endPoint(), SketchLine_51.startPoint()) -SketchConstraintCoincidence_77 = Sketch_6.setCoincident(SketchLine_42.startPoint(), SketchLine_51.endPoint()) +SketchConstraintCoincidence_76 = Sketch_6.setCoincident( + SketchLine_50.endPoint(), SketchLine_51.startPoint() +) +SketchConstraintCoincidence_77 = Sketch_6.setCoincident( + SketchLine_42.startPoint(), SketchLine_51.endPoint() +) SketchConstraintVertical_11 = Sketch_6.setVertical(SketchLine_45.result()) SketchConstraintVertical_12 = Sketch_6.setVertical(SketchLine_42.result()) SketchConstraintHorizontal_7 = Sketch_6.setHorizontal(SketchLine_41.result()) @@ -388,65 +696,164 @@ SketchConstraintHorizontal_8 = Sketch_6.setHorizontal(SketchLine_47.result()) SketchConstraintHorizontal_9 = Sketch_6.setHorizontal(SketchLine_51.result()) SketchConstraintHorizontal_10 = Sketch_6.setHorizontal(SketchLine_49.result()) SketchConstraintVertical_13 = Sketch_6.setVertical(SketchLine_50.result()) -SketchConstraintDistance_20 = Sketch_6.setDistance(SketchLine_48.startPoint(), SketchLine_49.result(), 0.8, False) -SketchConstraintDistance_21 = Sketch_6.setDistance(SketchLine_51.startPoint(), SketchLine_49.result(), 0.8, False) +SketchConstraintDistance_20 = Sketch_6.setDistance( + SketchLine_48.startPoint(), SketchLine_49.result(), 0.8, False +) +SketchConstraintDistance_21 = Sketch_6.setDistance( + SketchLine_51.startPoint(), SketchLine_49.result(), 0.8, False +) 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) -SketchConstraintDistance_23 = Sketch_6.setDistance(SketchLine_42.endPoint(), SketchLine_52.result(), 4, False) +SketchConstraintDistance_22 = Sketch_6.setDistance( + SketchLine_45.startPoint(), SketchLine_52.result(), 4, False +) +SketchConstraintDistance_23 = Sketch_6.setDistance( + SketchLine_42.endPoint(), SketchLine_52.result(), 4, False +) SketchArc_11 = Sketch_6.addArc(-10, 13, -4, 13, -10, 19, False) SketchArc_11.setName("SketchArc_12") SketchArc_11.result().setName("SketchArc_12") SketchArc_11.results()[1].setName("SketchArc_12_2") -SketchConstraintCoincidence_78 = Sketch_6.setCoincident(SketchArc_11.startPoint(), SketchLine_43.endPoint()) -SketchConstraintCoincidence_79 = Sketch_6.setCoincident(SketchArc_11.endPoint(), SketchLine_44.startPoint()) -SketchConstraintTangent_15 = Sketch_6.setTangent(SketchArc_11.results()[1], SketchLine_43.result()) -SketchConstraintTangent_16 = Sketch_6.setTangent(SketchArc_11.results()[1], SketchLine_44.result()) -SketchConstraintCoincidence_80 = Sketch_6.setCoincident(SketchLine_45.startPoint(), SketchLine_43.startPoint()) -SketchConstraintCoincidence_81 = Sketch_6.setCoincident(SketchLine_47.endPoint(), SketchLine_44.endPoint()) -SketchConstraintCoincidence_82 = Sketch_6.setCoincident(SketchLine_43.endPoint(), SketchLine_45.result()) -SketchConstraintCoincidence_83 = Sketch_6.setCoincident(SketchLine_44.startPoint(), SketchLine_47.result()) +SketchConstraintCoincidence_78 = Sketch_6.setCoincident( + SketchArc_11.startPoint(), SketchLine_43.endPoint() +) +SketchConstraintCoincidence_79 = Sketch_6.setCoincident( + SketchArc_11.endPoint(), SketchLine_44.startPoint() +) +SketchConstraintTangent_15 = Sketch_6.setTangent( + SketchArc_11.results()[1], SketchLine_43.result() +) +SketchConstraintTangent_16 = Sketch_6.setTangent( + SketchArc_11.results()[1], SketchLine_44.result() +) +SketchConstraintCoincidence_80 = Sketch_6.setCoincident( + SketchLine_45.startPoint(), SketchLine_43.startPoint() +) +SketchConstraintCoincidence_81 = Sketch_6.setCoincident( + SketchLine_47.endPoint(), SketchLine_44.endPoint() +) +SketchConstraintCoincidence_82 = Sketch_6.setCoincident( + SketchLine_43.endPoint(), SketchLine_45.result() +) +SketchConstraintCoincidence_83 = Sketch_6.setCoincident( + SketchLine_44.startPoint(), SketchLine_47.result() +) SketchArc_12 = Sketch_6.addArc(10, 13, 10, 19, 4, 13, False) SketchArc_12.setName("SketchArc_13") SketchArc_12.result().setName("SketchArc_13") SketchArc_12.results()[1].setName("SketchArc_13_2") -SketchConstraintCoincidence_84 = Sketch_6.setCoincident(SketchArc_12.startPoint(), SketchLine_46.endPoint()) -SketchConstraintCoincidence_85 = Sketch_6.setCoincident(SketchArc_12.endPoint(), SketchLine_40.startPoint()) -SketchConstraintTangent_17 = Sketch_6.setTangent(SketchArc_12.results()[1], SketchLine_46.result()) -SketchConstraintTangent_18 = Sketch_6.setTangent(SketchArc_12.results()[1], SketchLine_40.result()) -SketchConstraintCoincidence_86 = Sketch_6.setCoincident(SketchLine_51.startPoint(), SketchLine_46.startPoint()) -SketchConstraintCoincidence_87 = Sketch_6.setCoincident(SketchLine_42.endPoint(), SketchLine_40.endPoint()) -SketchConstraintCoincidence_88 = Sketch_6.setCoincident(SketchLine_46.endPoint(), SketchLine_51.result()) -SketchConstraintCoincidence_89 = Sketch_6.setCoincident(SketchLine_40.startPoint(), SketchLine_42.result()) +SketchConstraintCoincidence_84 = Sketch_6.setCoincident( + SketchArc_12.startPoint(), SketchLine_46.endPoint() +) +SketchConstraintCoincidence_85 = Sketch_6.setCoincident( + SketchArc_12.endPoint(), SketchLine_40.startPoint() +) +SketchConstraintTangent_17 = Sketch_6.setTangent( + SketchArc_12.results()[1], SketchLine_46.result() +) +SketchConstraintTangent_18 = Sketch_6.setTangent( + SketchArc_12.results()[1], SketchLine_40.result() +) +SketchConstraintCoincidence_86 = Sketch_6.setCoincident( + SketchLine_51.startPoint(), SketchLine_46.startPoint() +) +SketchConstraintCoincidence_87 = Sketch_6.setCoincident( + SketchLine_42.endPoint(), SketchLine_40.endPoint() +) +SketchConstraintCoincidence_88 = Sketch_6.setCoincident( + SketchLine_46.endPoint(), SketchLine_51.result() +) +SketchConstraintCoincidence_89 = Sketch_6.setCoincident( + SketchLine_40.startPoint(), SketchLine_42.result() +) SketchConstraintRadius_9 = Sketch_6.setRadius(SketchArc_11.results()[1], 6) SketchConstraintRadius_10 = Sketch_6.setRadius(SketchArc_12.results()[1], 6) -SketchConstraintDistance_24 = Sketch_6.setDistance(SketchLine_40.result(), SketchLine_46.startPoint(), 6.1, False) -SketchConstraintDistance_25 = Sketch_6.setDistance(SketchLine_48.startPoint(), SketchLine_43.result(), 6.1, False) +SketchConstraintDistance_24 = Sketch_6.setDistance( + SketchLine_40.result(), SketchLine_46.startPoint(), 6.1, False +) +SketchConstraintDistance_25 = Sketch_6.setDistance( + SketchLine_48.startPoint(), SketchLine_43.result(), 6.1, False +) SketchConstraintVertical_14 = Sketch_6.setVertical(SketchLine_48.result()) -SketchConstraintDistance_26 = Sketch_6.setDistance(SketchLine_41.result(), SketchArc_12.startPoint(), 6.1, False) +SketchConstraintDistance_26 = Sketch_6.setDistance( + SketchLine_41.result(), SketchArc_12.startPoint(), 6.1, False +) SketchLine_53 = Sketch_6.addLine(model.selection("EDGE", "Axis_1")) SketchLine_53.setName("SketchLine_56") SketchLine_53.result().setName("SketchLine_56") -SketchConstraintCoincidence_90 = Sketch_6.setCoincident(SketchArc_12.startPoint(), SketchLine_53.result()) +SketchConstraintCoincidence_90 = Sketch_6.setCoincident( + SketchArc_12.startPoint(), SketchLine_53.result() +) model.do() -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/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")) +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/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&Sketch_1/SketchArc_2_2][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_10][Extrusion_8_1/To_Face]")) +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()) -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_91 = Sketch_7.setCoincident( + SketchLine_55.startPoint(), SketchPoint_6.result() +) +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() +) SketchLine_56 = Sketch_7.addLine(45, -70, -45, -70) SketchLine_56.setName("SketchLine_67") SketchLine_56.result().setName("SketchLine_67") @@ -454,9 +861,18 @@ SketchLine_57 = Sketch_7.addLine(55, -70, -55, -70) SketchLine_57.setName("SketchLine_58") SketchLine_57.result().setName("SketchLine_58") SketchLine_57.setAuxiliary(True) -SketchConstraintCoincidence_93 = Sketch_7.setCoincident(SketchLine_55.endPoint(), SketchLine_57.startPoint()) -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_93 = Sketch_7.setCoincident( + SketchLine_55.endPoint(), SketchLine_57.startPoint() +) +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() +) SketchLine_58 = Sketch_7.addLine(-55, -60, -55, -9.237604307034024) SketchLine_58.setName("SketchLine_68") SketchLine_58.result().setName("SketchLine_68") @@ -464,31 +880,54 @@ SketchLine_59 = Sketch_7.addLine(-55, -70, -55, -9.237604307034024) SketchLine_59.setName("SketchLine_59") SketchLine_59.result().setName("SketchLine_59") SketchLine_59.setAuxiliary(True) -SketchConstraintCoincidence_95 = Sketch_7.setCoincident(SketchLine_57.endPoint(), SketchLine_59.startPoint()) -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_95 = Sketch_7.setCoincident( + SketchLine_57.endPoint(), SketchLine_59.startPoint() +) +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() +) SketchLine_60 = Sketch_7.addLine(-55, -9.237604307034024, -60, -9.237604307034024) SketchLine_60.setName("SketchLine_60") SketchLine_60.result().setName("SketchLine_60") -SketchConstraintCoincidence_97 = Sketch_7.setCoincident(SketchLine_59.endPoint(), SketchLine_60.startPoint()) +SketchConstraintCoincidence_97 = Sketch_7.setCoincident( + SketchLine_59.endPoint(), SketchLine_60.startPoint() +) SketchLine_61 = Sketch_7.addLine(-60, -9.237604307034024, -60, -79.23760430703402) SketchLine_61.setName("SketchLine_61") SketchLine_61.result().setName("SketchLine_61") -SketchConstraintCoincidence_98 = Sketch_7.setCoincident(SketchLine_60.endPoint(), SketchLine_61.startPoint()) +SketchConstraintCoincidence_98 = Sketch_7.setCoincident( + SketchLine_60.endPoint(), SketchLine_61.startPoint() +) SketchLine_62 = Sketch_7.addLine(-60, -79.23760430703402, 60, -79.23760430703402) SketchLine_62.setName("SketchLine_62") SketchLine_62.result().setName("SketchLine_62") -SketchConstraintCoincidence_99 = Sketch_7.setCoincident(SketchLine_61.endPoint(), SketchLine_62.startPoint()) +SketchConstraintCoincidence_99 = Sketch_7.setCoincident( + SketchLine_61.endPoint(), SketchLine_62.startPoint() +) SketchLine_63 = Sketch_7.addLine(60, -79.23760430703402, 60, -9.237604307034024) SketchLine_63.setName("SketchLine_63") SketchLine_63.result().setName("SketchLine_63") -SketchConstraintCoincidence_100 = Sketch_7.setCoincident(SketchLine_62.endPoint(), SketchLine_63.startPoint()) +SketchConstraintCoincidence_100 = Sketch_7.setCoincident( + SketchLine_62.endPoint(), SketchLine_63.startPoint() +) SketchLine_64 = Sketch_7.addLine(60, -9.237604307034024, 55, -9.237604307034024) SketchLine_64.setName("SketchLine_64") SketchLine_64.result().setName("SketchLine_64") -SketchConstraintCoincidence_101 = Sketch_7.setCoincident(SketchLine_63.endPoint(), SketchLine_64.startPoint()) -SketchConstraintCoincidence_102 = Sketch_7.setCoincident(SketchLine_55.startPoint(), SketchLine_64.endPoint()) -SketchConstraintCoincidence_103 = Sketch_7.setCoincident(SketchPoint_6.coordinates(), SketchLine_64.endPoint()) +SketchConstraintCoincidence_101 = Sketch_7.setCoincident( + SketchLine_63.endPoint(), SketchLine_64.startPoint() +) +SketchConstraintCoincidence_102 = Sketch_7.setCoincident( + SketchLine_55.startPoint(), SketchLine_64.endPoint() +) +SketchConstraintCoincidence_103 = Sketch_7.setCoincident( + SketchPoint_6.coordinates(), SketchLine_64.endPoint() +) SketchConstraintHorizontal_11 = Sketch_7.setHorizontal(SketchLine_64.result()) SketchConstraintHorizontal_12 = Sketch_7.setHorizontal(SketchLine_60.result()) SketchConstraintHorizontal_13 = Sketch_7.setHorizontal(SketchLine_62.result()) @@ -502,65 +941,153 @@ SketchLine_65 = Sketch_7.addLine(45, -70, -55, -70) SketchLine_65.setName("SketchLine_65") SketchLine_65.result().setName("SketchLine_65") SketchLine_65.setAuxiliary(True) -SketchConstraintCoincidence_104 = Sketch_7.setCoincident(SketchArc_13.startPoint(), SketchLine_65.startPoint()) -SketchConstraintCoincidence_105 = Sketch_7.setCoincident(SketchArc_13.endPoint(), SketchLine_54.endPoint()) -SketchConstraintTangent_19 = Sketch_7.setTangent(SketchArc_13.results()[1], SketchLine_65.result()) -SketchConstraintTangent_20 = Sketch_7.setTangent(SketchArc_13.results()[1], SketchLine_54.result()) -SketchConstraintCoincidence_106 = Sketch_7.setCoincident(SketchLine_57.endPoint(), SketchLine_65.endPoint()) -SketchConstraintCoincidence_107 = Sketch_7.setCoincident(SketchLine_55.startPoint(), SketchLine_54.startPoint()) -SketchConstraintCoincidence_108 = Sketch_7.setCoincident(SketchLine_65.startPoint(), SketchLine_57.result()) -SketchConstraintCoincidence_109 = Sketch_7.setCoincident(SketchLine_54.endPoint(), SketchLine_55.result()) +SketchConstraintCoincidence_104 = Sketch_7.setCoincident( + SketchArc_13.startPoint(), SketchLine_65.startPoint() +) +SketchConstraintCoincidence_105 = Sketch_7.setCoincident( + SketchArc_13.endPoint(), SketchLine_54.endPoint() +) +SketchConstraintTangent_19 = Sketch_7.setTangent( + SketchArc_13.results()[1], SketchLine_65.result() +) +SketchConstraintTangent_20 = Sketch_7.setTangent( + SketchArc_13.results()[1], SketchLine_54.result() +) +SketchConstraintCoincidence_106 = Sketch_7.setCoincident( + SketchLine_57.endPoint(), SketchLine_65.endPoint() +) +SketchConstraintCoincidence_107 = Sketch_7.setCoincident( + SketchLine_55.startPoint(), SketchLine_54.startPoint() +) +SketchConstraintCoincidence_108 = Sketch_7.setCoincident( + SketchLine_65.startPoint(), SketchLine_57.result() +) +SketchConstraintCoincidence_109 = Sketch_7.setCoincident( + SketchLine_54.endPoint(), SketchLine_55.result() +) SketchArc_14 = Sketch_7.addArc(-45, -60, -55, -60, -45, -70, False) SketchArc_14.setName("SketchArc_15") SketchArc_14.result().setName("SketchArc_15") SketchArc_14.results()[1].setName("SketchArc_15_2") -SketchConstraintCoincidence_110 = Sketch_7.setCoincident(SketchArc_14.startPoint(), SketchLine_58.startPoint()) -SketchConstraintCoincidence_111 = Sketch_7.setCoincident(SketchArc_14.endPoint(), SketchLine_56.endPoint()) -SketchConstraintTangent_21 = Sketch_7.setTangent(SketchArc_14.results()[1], SketchLine_56.result()) -SketchConstraintTangent_22 = Sketch_7.setTangent(SketchArc_14.results()[1], SketchLine_58.result()) -SketchConstraintCoincidence_112 = Sketch_7.setCoincident(SketchLine_65.startPoint(), SketchLine_56.startPoint()) -SketchConstraintCoincidence_113 = Sketch_7.setCoincident(SketchLine_59.endPoint(), SketchLine_58.endPoint()) -SketchConstraintCoincidence_114 = Sketch_7.setCoincident(SketchLine_56.endPoint(), SketchLine_65.result()) -SketchConstraintCoincidence_115 = Sketch_7.setCoincident(SketchLine_58.startPoint(), SketchLine_59.result()) +SketchConstraintCoincidence_110 = Sketch_7.setCoincident( + SketchArc_14.startPoint(), SketchLine_58.startPoint() +) +SketchConstraintCoincidence_111 = Sketch_7.setCoincident( + SketchArc_14.endPoint(), SketchLine_56.endPoint() +) +SketchConstraintTangent_21 = Sketch_7.setTangent( + SketchArc_14.results()[1], SketchLine_56.result() +) +SketchConstraintTangent_22 = Sketch_7.setTangent( + SketchArc_14.results()[1], SketchLine_58.result() +) +SketchConstraintCoincidence_112 = Sketch_7.setCoincident( + SketchLine_65.startPoint(), SketchLine_56.startPoint() +) +SketchConstraintCoincidence_113 = Sketch_7.setCoincident( + SketchLine_59.endPoint(), SketchLine_58.endPoint() +) +SketchConstraintCoincidence_114 = Sketch_7.setCoincident( + SketchLine_56.endPoint(), SketchLine_65.result() +) +SketchConstraintCoincidence_115 = Sketch_7.setCoincident( + SketchLine_58.startPoint(), SketchLine_59.result() +) SketchConstraintRadius_11 = Sketch_7.setRadius(SketchArc_13.results()[1], 10) SketchConstraintRadius_12 = Sketch_7.setRadius(SketchArc_14.results()[1], 10) SketchCircle_4 = Sketch_7.addCircle(44, -59, 5) SketchCircle_5 = Sketch_7.addCircle(-44, -59, 5) SketchConstraintRadius_13 = Sketch_7.setRadius(SketchCircle_4.results()[1], 5) SketchConstraintRadius_14 = Sketch_7.setRadius(SketchCircle_5.results()[1], 5) -SketchConstraintDistance_27 = Sketch_7.setDistance(SketchCircle_4.center(), SketchLine_56.result(), 11, False) -SketchConstraintDistance_28 = Sketch_7.setDistance(SketchCircle_4.center(), SketchLine_54.result(), 11, False) -SketchConstraintDistance_29 = Sketch_7.setDistance(SketchCircle_5.center(), SketchLine_56.result(), 11, False) -SketchConstraintDistance_30 = Sketch_7.setDistance(SketchCircle_5.center(), SketchLine_58.result(), 11, False) +SketchConstraintDistance_27 = Sketch_7.setDistance( + SketchCircle_4.center(), SketchLine_56.result(), 11, False +) +SketchConstraintDistance_28 = Sketch_7.setDistance( + SketchCircle_4.center(), SketchLine_54.result(), 11, False +) +SketchConstraintDistance_29 = Sketch_7.setDistance( + SketchCircle_5.center(), SketchLine_56.result(), 11, False +) +SketchConstraintDistance_30 = Sketch_7.setDistance( + SketchCircle_5.center(), SketchLine_58.result(), 11, False +) SketchCircle_6 = Sketch_7.addCircle(44, -20.23760430703402, 5) SketchConstraintRadius_15 = Sketch_7.setRadius(SketchCircle_6.results()[1], 5) 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) -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]")) +SketchConstraintDistance_31 = Sketch_7.setDistance( + SketchCircle_6.center(), SketchLine_54.result(), 11, False +) +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) -SketchConstraintDistance_33 = Sketch_7.setDistance(SketchCircle_7.center(), SketchLine_58.result(), 11, False) -SketchConstraintDistance_34 = Sketch_7.setDistance(SketchCircle_7.center(), SketchLine_66.result(), 11, False) +SketchConstraintDistance_32 = Sketch_7.setDistance( + SketchCircle_6.center(), SketchLine_66.result(), 11, False +) +SketchConstraintDistance_33 = Sketch_7.setDistance( + SketchCircle_7.center(), SketchLine_58.result(), 11, False +) +SketchConstraintDistance_34 = Sketch_7.setDistance( + SketchCircle_7.center(), SketchLine_66.result(), 11, False +) SketchConstraintLength_2 = Sketch_7.setLength(SketchLine_62.result(), 120) SketchConstraintLength_3 = Sketch_7.setLength(SketchLine_61.result(), 70) -SketchConstraintDistanceHorizontal_1 = Sketch_7.setHorizontalDistance(SketchPoint_7.coordinates(), SketchLine_62.endPoint(), 5) +SketchConstraintDistanceHorizontal_1 = Sketch_7.setHorizontalDistance( + SketchPoint_7.coordinates(), SketchLine_62.endPoint(), 5 +) model.do() -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&Sketch_1/SketchLine_11")) +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&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/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)]")) +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()) -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_116 = Sketch_8.setCoincident( + SketchLine_68.startPoint(), SketchPoint_10.result() +) +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() +) SketchLine_69 = Sketch_8.addLine(45, 76.69872981077805, -45, 76.69872981077805) SketchLine_69.setName("SketchLine_80") SketchLine_69.result().setName("SketchLine_80") @@ -568,9 +1095,18 @@ SketchLine_70 = Sketch_8.addLine(55, 76.69872981077803, -55, 76.69872981077803) SketchLine_70.setName("SketchLine_71") SketchLine_70.result().setName("SketchLine_71") SketchLine_70.setAuxiliary(True) -SketchConstraintCoincidence_118 = Sketch_8.setCoincident(SketchLine_68.endPoint(), SketchLine_70.startPoint()) -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_118 = Sketch_8.setCoincident( + SketchLine_68.endPoint(), SketchLine_70.startPoint() +) +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() +) SketchLine_71 = Sketch_8.addLine(-55, 66.69872976783566, -55, -34.06366588218793) SketchLine_71.setName("SketchLine_81") SketchLine_71.result().setName("SketchLine_81") @@ -578,109 +1114,232 @@ SketchLine_72 = Sketch_8.addLine(-55, 76.69872981077803, -55, -34.06366588218793 SketchLine_72.setName("SketchLine_72") SketchLine_72.result().setName("SketchLine_72") SketchLine_72.setAuxiliary(True) -SketchConstraintCoincidence_120 = Sketch_8.setCoincident(SketchLine_70.endPoint(), SketchLine_72.startPoint()) -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()) -SketchLine_73 = Sketch_8.addLine(-55, -34.06366588218793, -83.25521566485324, -34.06366588218793) +SketchConstraintCoincidence_120 = Sketch_8.setCoincident( + SketchLine_70.endPoint(), SketchLine_72.startPoint() +) +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() +) +SketchLine_73 = Sketch_8.addLine( + -55, -34.06366588218793, -83.25521566485324, -34.06366588218793 +) SketchLine_73.setName("SketchLine_73") SketchLine_73.result().setName("SketchLine_73") -SketchConstraintCoincidence_122 = Sketch_8.setCoincident(SketchLine_72.endPoint(), SketchLine_73.startPoint()) -SketchLine_74 = Sketch_8.addLine(-83.25521566485324, -34.06366588218793, -83.25521566485298, 92.00148393088952) +SketchConstraintCoincidence_122 = Sketch_8.setCoincident( + SketchLine_72.endPoint(), SketchLine_73.startPoint() +) +SketchLine_74 = Sketch_8.addLine( + -83.25521566485324, -34.06366588218793, -83.25521566485298, 92.00148393088952 +) SketchLine_74.setName("SketchLine_74") SketchLine_74.result().setName("SketchLine_74") -SketchConstraintCoincidence_123 = Sketch_8.setCoincident(SketchLine_73.endPoint(), SketchLine_74.startPoint()) -SketchLine_75 = Sketch_8.addLine(-83.25521566485298, 92.00148393088952, 87.50975635635101, 92.00148393088952) +SketchConstraintCoincidence_123 = Sketch_8.setCoincident( + SketchLine_73.endPoint(), SketchLine_74.startPoint() +) +SketchLine_75 = Sketch_8.addLine( + -83.25521566485298, 92.00148393088952, 87.50975635635101, 92.00148393088952 +) SketchLine_75.setName("SketchLine_75") SketchLine_75.result().setName("SketchLine_75") -SketchConstraintCoincidence_124 = Sketch_8.setCoincident(SketchLine_74.endPoint(), SketchLine_75.startPoint()) -SketchLine_76 = Sketch_8.addLine(87.50975635635101, 92.00148393088952, 87.50975635635101, -34.06366588218793) +SketchConstraintCoincidence_124 = Sketch_8.setCoincident( + SketchLine_74.endPoint(), SketchLine_75.startPoint() +) +SketchLine_76 = Sketch_8.addLine( + 87.50975635635101, 92.00148393088952, 87.50975635635101, -34.06366588218793 +) SketchLine_76.setName("SketchLine_76") SketchLine_76.result().setName("SketchLine_76") -SketchConstraintCoincidence_125 = Sketch_8.setCoincident(SketchLine_75.endPoint(), SketchLine_76.startPoint()) -SketchLine_77 = Sketch_8.addLine(87.50975635635101, -34.06366588218793, 55, -34.06366588218793) +SketchConstraintCoincidence_125 = Sketch_8.setCoincident( + SketchLine_75.endPoint(), SketchLine_76.startPoint() +) +SketchLine_77 = Sketch_8.addLine( + 87.50975635635101, -34.06366588218793, 55, -34.06366588218793 +) SketchLine_77.setName("SketchLine_77") SketchLine_77.result().setName("SketchLine_77") -SketchConstraintCoincidence_126 = Sketch_8.setCoincident(SketchLine_76.endPoint(), SketchLine_77.startPoint()) -SketchConstraintCoincidence_127 = Sketch_8.setCoincident(SketchLine_68.startPoint(), SketchLine_77.endPoint()) -SketchConstraintCoincidence_128 = Sketch_8.setCoincident(SketchPoint_10.coordinates(), SketchLine_77.endPoint()) +SketchConstraintCoincidence_126 = Sketch_8.setCoincident( + SketchLine_76.endPoint(), SketchLine_77.startPoint() +) +SketchConstraintCoincidence_127 = Sketch_8.setCoincident( + SketchLine_68.startPoint(), SketchLine_77.endPoint() +) +SketchConstraintCoincidence_128 = Sketch_8.setCoincident( + SketchPoint_10.coordinates(), SketchLine_77.endPoint() +) SketchConstraintHorizontal_14 = Sketch_8.setHorizontal(SketchLine_77.result()) SketchConstraintHorizontal_15 = Sketch_8.setHorizontal(SketchLine_73.result()) SketchConstraintHorizontal_16 = Sketch_8.setHorizontal(SketchLine_75.result()) SketchConstraintVertical_17 = Sketch_8.setVertical(SketchLine_74.result()) SketchConstraintVertical_18 = Sketch_8.setVertical(SketchLine_76.result()) -SketchArc_15 = Sketch_8.addArc(45, 66.69872981077805, 55, 66.69872981077805, 45, 76.69872981077805, False) +SketchArc_15 = Sketch_8.addArc( + 45, 66.69872981077805, 55, 66.69872981077805, 45, 76.69872981077805, False +) SketchArc_15.setName("SketchArc_16") SketchArc_15.result().setName("SketchArc_16") SketchArc_15.results()[1].setName("SketchArc_16_2") -SketchConstraintCoincidence_129 = Sketch_8.setCoincident(SketchArc_15.startPoint(), SketchLine_67.endPoint()) +SketchConstraintCoincidence_129 = Sketch_8.setCoincident( + SketchArc_15.startPoint(), SketchLine_67.endPoint() +) SketchLine_78 = Sketch_8.addLine(45, 76.69872981077805, -55, 76.69872981077803) SketchLine_78.setName("SketchLine_78") SketchLine_78.result().setName("SketchLine_78") SketchLine_78.setAuxiliary(True) -SketchConstraintCoincidence_130 = Sketch_8.setCoincident(SketchArc_15.endPoint(), SketchLine_78.startPoint()) -SketchConstraintTangent_23 = Sketch_8.setTangent(SketchArc_15.results()[1], SketchLine_78.result()) -SketchConstraintTangent_24 = Sketch_8.setTangent(SketchArc_15.results()[1], SketchLine_67.result()) -SketchConstraintCoincidence_131 = Sketch_8.setCoincident(SketchLine_70.endPoint(), SketchLine_78.endPoint()) -SketchConstraintCoincidence_132 = Sketch_8.setCoincident(SketchLine_68.startPoint(), SketchLine_67.startPoint()) -SketchConstraintCoincidence_133 = Sketch_8.setCoincident(SketchLine_78.startPoint(), SketchLine_70.result()) -SketchConstraintCoincidence_134 = Sketch_8.setCoincident(SketchLine_67.endPoint(), SketchLine_68.result()) -SketchArc_16 = Sketch_8.addArc(-45, 66.69872976783566, -45, 76.69872981077805, -55, 66.69872976783566, False) +SketchConstraintCoincidence_130 = Sketch_8.setCoincident( + SketchArc_15.endPoint(), SketchLine_78.startPoint() +) +SketchConstraintTangent_23 = Sketch_8.setTangent( + SketchArc_15.results()[1], SketchLine_78.result() +) +SketchConstraintTangent_24 = Sketch_8.setTangent( + SketchArc_15.results()[1], SketchLine_67.result() +) +SketchConstraintCoincidence_131 = Sketch_8.setCoincident( + SketchLine_70.endPoint(), SketchLine_78.endPoint() +) +SketchConstraintCoincidence_132 = Sketch_8.setCoincident( + SketchLine_68.startPoint(), SketchLine_67.startPoint() +) +SketchConstraintCoincidence_133 = Sketch_8.setCoincident( + SketchLine_78.startPoint(), SketchLine_70.result() +) +SketchConstraintCoincidence_134 = Sketch_8.setCoincident( + SketchLine_67.endPoint(), SketchLine_68.result() +) +SketchArc_16 = Sketch_8.addArc( + -45, 66.69872976783566, -45, 76.69872981077805, -55, 66.69872976783566, False +) SketchArc_16.setName("SketchArc_17") SketchArc_16.result().setName("SketchArc_17") SketchArc_16.results()[1].setName("SketchArc_17_2") -SketchConstraintCoincidence_135 = Sketch_8.setCoincident(SketchArc_16.startPoint(), SketchLine_69.endPoint()) -SketchConstraintCoincidence_136 = Sketch_8.setCoincident(SketchArc_16.endPoint(), SketchLine_71.startPoint()) -SketchConstraintTangent_25 = Sketch_8.setTangent(SketchArc_16.results()[1], SketchLine_69.result()) -SketchConstraintTangent_26 = Sketch_8.setTangent(SketchArc_16.results()[1], SketchLine_71.result()) -SketchConstraintCoincidence_137 = Sketch_8.setCoincident(SketchLine_78.startPoint(), SketchLine_69.startPoint()) -SketchConstraintCoincidence_138 = Sketch_8.setCoincident(SketchLine_72.endPoint(), SketchLine_71.endPoint()) -SketchConstraintCoincidence_139 = Sketch_8.setCoincident(SketchLine_69.endPoint(), SketchLine_78.result()) -SketchConstraintCoincidence_140 = Sketch_8.setCoincident(SketchLine_71.startPoint(), SketchLine_72.result()) +SketchConstraintCoincidence_135 = Sketch_8.setCoincident( + SketchArc_16.startPoint(), SketchLine_69.endPoint() +) +SketchConstraintCoincidence_136 = Sketch_8.setCoincident( + SketchArc_16.endPoint(), SketchLine_71.startPoint() +) +SketchConstraintTangent_25 = Sketch_8.setTangent( + SketchArc_16.results()[1], SketchLine_69.result() +) +SketchConstraintTangent_26 = Sketch_8.setTangent( + SketchArc_16.results()[1], SketchLine_71.result() +) +SketchConstraintCoincidence_137 = Sketch_8.setCoincident( + SketchLine_78.startPoint(), SketchLine_69.startPoint() +) +SketchConstraintCoincidence_138 = Sketch_8.setCoincident( + SketchLine_72.endPoint(), SketchLine_71.endPoint() +) +SketchConstraintCoincidence_139 = Sketch_8.setCoincident( + SketchLine_69.endPoint(), SketchLine_78.result() +) +SketchConstraintCoincidence_140 = Sketch_8.setCoincident( + SketchLine_71.startPoint(), SketchLine_72.result() +) SketchConstraintRadius_17 = Sketch_8.setRadius(SketchArc_15.results()[1], 10) SketchConstraintRadius_18 = Sketch_8.setRadius(SketchArc_16.results()[1], 10) SketchCircle_8 = Sketch_8.addCircle(-44, 51.69872981077802, 5) SketchConstraintRadius_19 = Sketch_8.setRadius(SketchCircle_8.results()[1], 5) -SketchConstraintDistance_35 = Sketch_8.setDistance(SketchCircle_8.center(), SketchLine_69.result(), 25, False) -SketchConstraintDistance_36 = Sketch_8.setDistance(SketchCircle_8.center(), SketchLine_71.result(), 11, False) +SketchConstraintDistance_35 = Sketch_8.setDistance( + SketchCircle_8.center(), SketchLine_69.result(), 25, False +) +SketchConstraintDistance_36 = Sketch_8.setDistance( + SketchCircle_8.center(), SketchLine_71.result(), 11, False +) SketchCircle_9 = Sketch_8.addCircle(-44, 16.69872981077805, 5) SketchConstraintRadius_20 = Sketch_8.setRadius(SketchCircle_9.results()[1], 5) -SketchConstraintDistance_37 = Sketch_8.setDistance(SketchCircle_9.center(), SketchLine_71.result(), 11, False) -SketchConstraintDistance_38 = Sketch_8.setDistance(SketchCircle_9.center(), SketchLine_69.result(), 60, False) -SketchArc_17 = Sketch_8.addArc(44, 16.69872981077805, 49, 16.69872981077805, 39, 16.69872981077805, True) +SketchConstraintDistance_37 = Sketch_8.setDistance( + SketchCircle_9.center(), SketchLine_71.result(), 11, False +) +SketchConstraintDistance_38 = Sketch_8.setDistance( + SketchCircle_9.center(), SketchLine_69.result(), 60, False +) +SketchArc_17 = Sketch_8.addArc( + 44, 16.69872981077805, 49, 16.69872981077805, 39, 16.69872981077805, True +) SketchArc_17.setName("SketchArc_19") SketchArc_17.result().setName("SketchArc_19") SketchArc_17.results()[1].setName("SketchArc_19_2") SketchConstraintRadius_21 = Sketch_8.setRadius(SketchArc_17.results()[1], 5) -SketchConstraintDistance_39 = Sketch_8.setDistance(SketchArc_17.center(), SketchLine_69.result(), 60, False) -SketchArc_18 = Sketch_8.addArc(44, 51.69872981077805, 49, 51.69872981077805, 39, 51.69872981077805, False) +SketchConstraintDistance_39 = Sketch_8.setDistance( + SketchArc_17.center(), SketchLine_69.result(), 60, False +) +SketchArc_18 = Sketch_8.addArc( + 44, 51.69872981077805, 49, 51.69872981077805, 39, 51.69872981077805, False +) SketchArc_18.setName("SketchArc_18") SketchArc_18.result().setName("SketchArc_18") SketchArc_18.results()[1].setName("SketchArc_18_2") SketchLine_79 = Sketch_8.addLine(49, 16.69872981077805, 49, 51.69872981077805) SketchLine_79.setName("SketchLine_82") SketchLine_79.result().setName("SketchLine_82") -SketchConstraintCoincidence_141 = Sketch_8.setCoincident(SketchArc_18.startPoint(), SketchLine_79.endPoint()) -SketchConstraintCoincidence_142 = Sketch_8.setCoincident(SketchLine_79.startPoint(), SketchArc_17.startPoint()) +SketchConstraintCoincidence_141 = Sketch_8.setCoincident( + SketchArc_18.startPoint(), SketchLine_79.endPoint() +) +SketchConstraintCoincidence_142 = Sketch_8.setCoincident( + SketchLine_79.startPoint(), SketchArc_17.startPoint() +) SketchLine_80 = Sketch_8.addLine(39, 16.69872981077805, 39, 51.69872981077805) SketchLine_80.setName("SketchLine_83") SketchLine_80.result().setName("SketchLine_83") -SketchConstraintCoincidence_143 = Sketch_8.setCoincident(SketchArc_17.endPoint(), SketchLine_80.startPoint()) -SketchConstraintCoincidence_144 = Sketch_8.setCoincident(SketchArc_18.endPoint(), SketchLine_80.endPoint()) -SketchConstraintDistance_40 = Sketch_8.setDistance(SketchArc_17.center(), SketchLine_67.result(), 11, False) -SketchConstraintDistance_41 = Sketch_8.setDistance(SketchLine_69.result(), SketchArc_18.center(), 25, False) -SketchConstraintDistance_42 = Sketch_8.setDistance(SketchArc_18.center(), SketchLine_67.result(), 11, False) +SketchConstraintCoincidence_143 = Sketch_8.setCoincident( + SketchArc_17.endPoint(), SketchLine_80.startPoint() +) +SketchConstraintCoincidence_144 = Sketch_8.setCoincident( + SketchArc_18.endPoint(), SketchLine_80.endPoint() +) +SketchConstraintDistance_40 = Sketch_8.setDistance( + SketchArc_17.center(), SketchLine_67.result(), 11, False +) +SketchConstraintDistance_41 = Sketch_8.setDistance( + SketchLine_69.result(), SketchArc_18.center(), 25, False +) +SketchConstraintDistance_42 = Sketch_8.setDistance( + SketchArc_18.center(), SketchLine_67.result(), 11, False +) SketchConstraintRadius_22 = Sketch_8.setRadius(SketchArc_18.results()[1], 5) SketchConstraintLength_4 = Sketch_8.setLength(SketchLine_80.result(), 35.000000440932) SketchConstraintLength_5 = Sketch_8.setLength(SketchLine_79.result(), 35) SketchConstraintLength_6 = Sketch_8.setLength(SketchLine_75.result(), 170.764972021204) SketchConstraintLength_7 = Sketch_8.setLength(SketchLine_77.result(), 32.509756356351) SketchConstraintLength_8 = Sketch_8.setLength(SketchLine_76.result(), 126.065149813077) -SketchConstraintDistance_43 = Sketch_8.setDistance(SketchArc_18.endPoint(), SketchLine_69.result(), 24.999999559068, False) -SketchConstraintDistance_44 = Sketch_8.setDistance(SketchArc_18.startPoint(), SketchLine_69.result(), 25, False) +SketchConstraintDistance_43 = Sketch_8.setDistance( + SketchArc_18.endPoint(), SketchLine_69.result(), 24.999999559068, False +) +SketchConstraintDistance_44 = Sketch_8.setDistance( + SketchArc_18.startPoint(), SketchLine_69.result(), 25, False +) model.do() -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")]) +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() # Test reexecution after parameter change diff --git a/test.compatibility/bearing_puller.py b/test.compatibility/bearing_puller.py index 7b082e11a..e79bcb13b 100644 --- a/test.compatibility/bearing_puller.py +++ b/test.compatibility/bearing_puller.py @@ -35,7 +35,9 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(50, 14.61148285474187, 50, 0) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 14.61148285474187) SketchLine_2 = Sketch_1.addLine(50, 0, 6, 0) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(7, 25, 16.13599978860571, 25) SketchLine_3.setName("SketchLine_4") SketchLine_3.result().setName("SketchLine_4") @@ -43,22 +45,54 @@ SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintVertical_1.setName("SketchConstraintVertical_2") -SketchArc_1 = Sketch_1.addArc(16.1359986285606, -59.99999999999999, 16.13599978860571, 25, 46.80399475966571, 19.27467447616896, True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 16.1359986285606, + -59.99999999999999, + 16.13599978860571, + 25, + 46.80399475966571, + 19.27467447616896, + True, +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_1.startPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_4") -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_3.result()) -SketchArc_2 = Sketch_1.addArc(45, 14.61145639129118, 46.80399475966571, 19.27467447616896, 50, 14.61148285474187, True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchArc_1.endPoint()) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_3.result() +) +SketchArc_2 = Sketch_1.addArc( + 45, + 14.61145639129118, + 46.80399475966571, + 19.27467447616896, + 50, + 14.61148285474187, + True, +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchArc_1.endPoint() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_6") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_1.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_7") -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1]) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_1.result()) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchArc_2.results()[1] +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_1.result() +) SketchPoint_1 = Sketch_1.addPoint(50, 17.96300027009704) SketchPoint_1.setAuxiliary(True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_1.result() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_8") -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.results()[1]) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchArc_1.results()[1] +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_9") SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_2.results()[1], 5) SketchPoint_2 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) @@ -67,9 +101,13 @@ SketchConstraintRadius_2.setName("SketchConstraintRadius_4") SketchLine_4 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_4.setName("SketchLine_27") SketchLine_4.result().setName("SketchLine_27") -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_4.result(), SketchLine_2.startPoint(), "Radius") +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_4.result(), SketchLine_2.startPoint(), "Radius" +) SketchConstraintDistance_1.setName("SketchConstraintDistance_13") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.startPoint(), SketchLine_2.result(), "Thickness") +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_3.startPoint(), SketchLine_2.result(), "Thickness" +) SketchConstraintDistance_2.setName("SketchConstraintDistance_14") SketchLine_5 = Sketch_1.addLine(6, 0, 6, 24) SketchLine_5.setName("SketchLine_28") @@ -77,95 +115,225 @@ SketchLine_5.result().setName("SketchLine_28") SketchLine_6 = Sketch_1.addLine(6, 24, 7, 25) SketchLine_6.setName("SketchLine_29") SketchLine_6.result().setName("SketchLine_29") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_32") SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintVertical_2.setName("SketchConstraintVertical_3") -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_5.startPoint(), SketchLine_4.result(), "Rod/2") +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_5.startPoint(), SketchLine_4.result(), "Rod/2" +) SketchConstraintDistance_3.setName("SketchConstraintDistance_15") -SketchConstraintAngle_1 = Sketch_1.setAngleComplementary(SketchLine_6.result(), SketchLine_5.result(), 45.00000000000006) +SketchConstraintAngle_1 = Sketch_1.setAngleComplementary( + SketchLine_6.result(), SketchLine_5.result(), 45.00000000000006 +) SketchConstraintAngle_1.setName("SketchConstraintAngle_3") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_4.result(), SketchLine_6.endPoint(), "Rod/2 + 1") +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_4.result(), SketchLine_6.endPoint(), "Rod/2 + 1" +) SketchConstraintDistance_4.setName("SketchConstraintDistance_16") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_33") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_34") SketchLine_7 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_7.setName("SketchLine_30") SketchLine_7.result().setName("SketchLine_30") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_7.result()) +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-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")) +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&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) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_8.startPoint(), SketchPoint_3.result() +) +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") SketchLine_9.result().setName("SketchLine_10") SketchLine_10 = Sketch_2.addLine(0, 0, 25, -43.30127018922193) 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&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) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_10.startPoint(), SketchPoint_3.result() +) +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") SketchLine_11.result().setName("SketchLine_11") SketchLine_12 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_12.setName("SketchLine_7") SketchLine_12.result().setName("SketchLine_7") -SketchConstraintAngle_2 = Sketch_2.setAngleBackward(SketchLine_12.result(), SketchLine_10.result(), 59.99999999999994) +SketchConstraintAngle_2 = Sketch_2.setAngleBackward( + SketchLine_12.result(), SketchLine_10.result(), 59.99999999999994 +) SketchConstraintAngle_2.setName("SketchConstraintAngle_1") -SketchConstraintAngle_3 = Sketch_2.setAngle(SketchLine_12.result(), SketchLine_8.result(), 59.99999999999999) +SketchConstraintAngle_3 = Sketch_2.setAngle( + SketchLine_12.result(), SketchLine_8.result(), 59.99999999999999 +) SketchConstraintAngle_3.setName("SketchConstraintAngle_2") -SketchLine_13 = Sketch_2.addLine(14.43375672974065, -4.667176185980158e-016, 39.43375672974065, 43.30127018922192) +SketchLine_13 = Sketch_2.addLine( + 14.43375672974065, -4.667176185980158e-016, 39.43375672974065, 43.30127018922192 +) SketchLine_13.setName("SketchLine_9") SketchLine_13.result().setName("SketchLine_9") SketchLine_13.setAuxiliary(True) -SketchLine_14 = Sketch_2.addLine(39.43375672974064, -43.30127018922192, 14.43375672974065, -4.667176185980158e-016) +SketchLine_14 = Sketch_2.addLine( + 39.43375672974064, -43.30127018922192, 14.43375672974065, -4.667176185980158e-016 +) SketchLine_14.setName("SketchLine_8") SketchLine_14.result().setName("SketchLine_8") SketchLine_14.setAuxiliary(True) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_13.startPoint() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_16") -SketchConstraintParallel_1 = Sketch_2.setParallel(SketchLine_14.result(), SketchLine_10.result()) -SketchConstraintParallel_2 = Sketch_2.setParallel(SketchLine_13.result(), SketchLine_8.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_8.result(), SketchLine_14.result()) -SketchConstraintEqual_2 = Sketch_2.setEqual(SketchLine_10.result(), SketchLine_13.result()) -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchLine_13.startPoint(), SketchLine_10.result(), "Width/2") +SketchConstraintParallel_1 = Sketch_2.setParallel( + SketchLine_14.result(), SketchLine_10.result() +) +SketchConstraintParallel_2 = Sketch_2.setParallel( + SketchLine_13.result(), SketchLine_8.result() +) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_8.result(), SketchLine_14.result() +) +SketchConstraintEqual_2 = Sketch_2.setEqual( + SketchLine_10.result(), SketchLine_13.result() +) +SketchConstraintDistance_5 = Sketch_2.setDistance( + SketchLine_13.startPoint(), SketchLine_10.result(), "Width/2" +) SketchConstraintDistance_5.setName("SketchConstraintDistance_4") -SketchArc_3 = Sketch_2.addArc(20.20725942163691, 2.933703812344835e-015, 15.87713238415337, 2.499999967850816, 15.87711932209923, -2.499977343709401, False) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchArc_3.startPoint(), SketchLine_11.startPoint()) +SketchArc_3 = Sketch_2.addArc( + 20.20725942163691, + 2.933703812344835e-015, + 15.87713238415337, + 2.499999967850816, + 15.87711932209923, + -2.499977343709401, + False, +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchArc_3.startPoint(), SketchLine_11.startPoint() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_15") -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchArc_3.endPoint(), SketchLine_9.endPoint()) -SketchConstraintTangent_4 = Sketch_2.setTangent(SketchArc_3.results()[1], SketchLine_9.result()) -SketchConstraintTangent_5 = Sketch_2.setTangent(SketchArc_3.results()[1], SketchLine_11.result()) -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_11.endPoint()) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_14.result()) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchLine_13.result()) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchArc_3.endPoint(), SketchLine_9.endPoint() +) +SketchConstraintTangent_4 = Sketch_2.setTangent( + SketchArc_3.results()[1], SketchLine_9.result() +) +SketchConstraintTangent_5 = Sketch_2.setTangent( + SketchArc_3.results()[1], SketchLine_11.result() +) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_11.endPoint() +) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchLine_14.result() +) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchLine_11.startPoint(), SketchLine_13.result() +) SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_3.results()[1], 5) SketchConstraintRadius_3.setName("SketchConstraintRadius_2") -SketchConstraintDistance_6 = Sketch_2.setDistance(SketchLine_13.startPoint(), SketchLine_8.result(), "Width/2") +SketchConstraintDistance_6 = Sketch_2.setDistance( + SketchLine_13.startPoint(), SketchLine_8.result(), "Width/2" +) SketchConstraintDistance_6.setName("SketchConstraintDistance_5") -SketchArc_4 = Sketch_2.addArc(14.43375672974064, -1.454136002932938e-015, 39.43375672974064, -43.30127018922192, 39.43375672974065, 43.30127018922192, False) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_9.startPoint(), SketchArc_4.startPoint()) -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchArc_4.startPoint()) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchArc_4.endPoint()) -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchArc_4.endPoint()) -SketchConstraintEqual_3 = Sketch_2.setEqual(SketchArc_4.results()[1], SketchCircle_1.results()[1]) -SketchMultiRotation_1_objects = [SketchLine_11.result(), SketchArc_3.results()[1], SketchLine_9.result(), SketchArc_4.results()[1]] -SketchMultiRotation_1 = Sketch_2.addRotation(SketchMultiRotation_1_objects, SketchCircle_2.center(), 120, 3) -[SketchLine_15, SketchLine_16, SketchArc_5, SketchArc_6, SketchLine_17, SketchLine_18, SketchArc_7, SketchArc_8] = SketchMultiRotation_1.rotated() +SketchArc_4 = Sketch_2.addArc( + 14.43375672974064, + -1.454136002932938e-015, + 39.43375672974064, + -43.30127018922192, + 39.43375672974065, + 43.30127018922192, + False, +) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_9.startPoint(), SketchArc_4.startPoint() +) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchArc_4.startPoint() +) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintEqual_3 = Sketch_2.setEqual( + SketchArc_4.results()[1], SketchCircle_1.results()[1] +) +SketchMultiRotation_1_objects = [ + SketchLine_11.result(), + SketchArc_3.results()[1], + SketchLine_9.result(), + SketchArc_4.results()[1], +] +SketchMultiRotation_1 = Sketch_2.addRotation( + SketchMultiRotation_1_objects, SketchCircle_2.center(), 120, 3 +) +[ + SketchLine_15, + SketchLine_16, + SketchArc_5, + SketchArc_6, + SketchLine_17, + SketchLine_18, + SketchArc_7, + SketchArc_8, +] = SketchMultiRotation_1.rotated() SketchArc_7.setName("SketchArc_6") SketchArc_7.result().setName("SketchArc_6") SketchArc_7.results()[1].setName("SketchArc_6_2") @@ -180,39 +348,91 @@ SketchLine_16.setName("SketchLine_14") SketchLine_16.result().setName("SketchLine_14") SketchLine_15.setName("SketchLine_12") SketchLine_15.result().setName("SketchLine_12") -SketchLine_19 = Sketch_2.addLine(7.828185376255509, -23.55881480274223, 31.38482278389692, -64.36010764825475) +SketchLine_19 = Sketch_2.addLine( + 7.828185376255509, -23.55881480274223, 31.38482278389692, -64.36010764825475 +) SketchLine_19.setName("SketchLine_16") SketchLine_19.result().setName("SketchLine_16") -SketchLine_20 = Sketch_2.addLine(31.38482278389692, -64.36010764825475, 40.0450768217413, -59.36010764825475) +SketchLine_20 = Sketch_2.addLine( + 31.38482278389692, -64.36010764825475, 40.0450768217413, -59.36010764825475 +) SketchLine_20.setName("SketchLine_17") SketchLine_20.result().setName("SketchLine_17") -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_28") -SketchLine_21 = Sketch_2.addLine(40.0450768217413, -59.36010764825475, 16.48843941409989, -18.55881480274223) +SketchLine_21 = Sketch_2.addLine( + 40.0450768217413, -59.36010764825475, 16.48843941409989, -18.55881480274223 +) SketchLine_21.setName("SketchLine_18") SketchLine_21.result().setName("SketchLine_18") -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.startPoint() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_29") -SketchConstraintParallel_3 = Sketch_2.setParallel(SketchLine_10.result(), SketchLine_19.result()) -SketchConstraintParallel_4 = Sketch_2.setParallel(SketchLine_10.result(), SketchLine_21.result()) -SketchConstraintEqual_4 = Sketch_2.setEqual(SketchLine_9.result(), SketchLine_21.result()) -SketchConstraintEqual_5 = Sketch_2.setEqual(SketchLine_9.result(), SketchLine_19.result()) -SketchConstraintDistance_7 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_19.result(), "Gap/2") +SketchConstraintParallel_3 = Sketch_2.setParallel( + SketchLine_10.result(), SketchLine_19.result() +) +SketchConstraintParallel_4 = Sketch_2.setParallel( + SketchLine_10.result(), SketchLine_21.result() +) +SketchConstraintEqual_4 = Sketch_2.setEqual( + SketchLine_9.result(), SketchLine_21.result() +) +SketchConstraintEqual_5 = Sketch_2.setEqual( + SketchLine_9.result(), SketchLine_19.result() +) +SketchConstraintDistance_7 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_19.result(), "Gap/2" +) SketchConstraintDistance_7.setName("SketchConstraintDistance_6") -SketchConstraintDistance_8 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_21.result(), "Gap/2") +SketchConstraintDistance_8 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_21.result(), "Gap/2" +) SketchConstraintDistance_8.setName("SketchConstraintDistance_7") -SketchArc_9 = Sketch_2.addArc(10.5, -18.18653347947321, 7.828185376255509, -23.55881480274223, 16.48843941409989, -18.55881480274223, True) -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchArc_9.center(), SketchLine_10.result()) +SketchArc_9 = Sketch_2.addArc( + 10.5, + -18.18653347947321, + 7.828185376255509, + -23.55881480274223, + 16.48843941409989, + -18.55881480274223, + True, +) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchArc_9.center(), SketchLine_10.result() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_27") -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchLine_19.startPoint(), SketchArc_9.startPoint()) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchLine_19.startPoint(), SketchArc_9.startPoint() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_30") -SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchArc_9.endPoint(), SketchLine_21.endPoint()) +SketchConstraintCoincidence_30 = Sketch_2.setCoincident( + SketchArc_9.endPoint(), SketchLine_21.endPoint() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_31") SketchConstraintRadius_4 = Sketch_2.setRadius(SketchArc_9.results()[1], 6) SketchConstraintRadius_4.setName("SketchConstraintRadius_3") -SketchMultiRotation_2_objects = [SketchLine_19.result(), SketchLine_20.result(), SketchLine_21.result(), SketchArc_9.results()[1]] -SketchMultiRotation_2 = Sketch_2.addRotation(SketchMultiRotation_2_objects, SketchCircle_1.center(), 120, 3) -[SketchLine_22, SketchLine_23, SketchLine_24, SketchLine_25, SketchLine_26, SketchLine_27, SketchArc_10, SketchArc_11] = SketchMultiRotation_2.rotated() +SketchMultiRotation_2_objects = [ + SketchLine_19.result(), + SketchLine_20.result(), + SketchLine_21.result(), + SketchArc_9.results()[1], +] +SketchMultiRotation_2 = Sketch_2.addRotation( + SketchMultiRotation_2_objects, SketchCircle_1.center(), 120, 3 +) +[ + SketchLine_22, + SketchLine_23, + SketchLine_24, + SketchLine_25, + SketchLine_26, + SketchLine_27, + SketchArc_10, + SketchArc_11, +] = SketchMultiRotation_2.rotated() SketchLine_27.setName("SketchLine_24") SketchLine_27.result().setName("SketchLine_24") SketchLine_26.setName("SketchLine_21") @@ -225,42 +445,158 @@ SketchLine_23.setName("SketchLine_22") SketchLine_23.result().setName("SketchLine_22") SketchLine_22.setName("SketchLine_19") SketchLine_22.result().setName("SketchLine_19") -SketchConstraintDistance_9 = Sketch_2.setDistance(SketchArc_9.center(), SketchPoint_3.coordinates(), 21) +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/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&Sketch_2/SketchLine_21"), model.selection("FACE", "Cut_2_1/Modified_Face&Sketch_2/SketchLine_19")) +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&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) SketchConstraintRadius_5 = Sketch_3.setRadius(SketchCircle_4.results()[1], 4) -SketchConstraintEqual_6 = Sketch_3.setEqual(SketchCircle_3.results()[1], SketchCircle_4.results()[1]) +SketchConstraintEqual_6 = Sketch_3.setEqual( + SketchCircle_3.results()[1], SketchCircle_4.results()[1] +) SketchLine_28 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_28.setName("SketchLine_25") SketchLine_28.result().setName("SketchLine_25") -SketchConstraintDistance_10 = Sketch_3.setDistance(SketchCircle_3.center(), SketchLine_28.result(), 25) +SketchConstraintDistance_10 = Sketch_3.setDistance( + SketchCircle_3.center(), SketchLine_28.result(), 25 +) SketchConstraintDistance_10.setName("SketchConstraintDistance_9") -SketchConstraintDistance_11 = Sketch_3.setDistance(SketchCircle_4.center(), SketchLine_28.result(), 40) +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/Generated_Edge&Sketch_2/SketchLine_21&Sketch_1/SketchLine_2"), 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") -SketchConstraintDistance_12 = Sketch_3.setDistance(SketchCircle_4.center(), SketchLine_29.result(), 10) +SketchConstraintDistance_12 = Sketch_3.setDistance( + SketchCircle_4.center(), SketchLine_29.result(), 10 +) SketchConstraintDistance_12.setName("SketchConstraintDistance_11") -SketchConstraintDistance_13 = Sketch_3.setDistance(SketchCircle_3.center(), SketchLine_29.result(), 10) +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_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) -Cut_4 = model.addCut(Part_1_doc, [model.selection("SOLID", "Cut_3_1")], [model.selection("SOLID", "Rotation_1_1"), model.selection("SOLID", "Rotation_1_2")]) -Recover_2 = model.addRecover(Part_1_doc, Cut_4, [Rotation_1.results()[1], Rotation_1.result()]) -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_2_1"), model.selection("SOLID", "Recover_2_2")], model.selection("EDGE", "PartSet/OZ"), 120) -Cut_5 = model.addCut(Part_1_doc, [model.selection("SOLID", "Cut_4_1")], [model.selection("SOLID", "Rotation_2_2"), model.selection("SOLID", "Rotation_2_1")]) +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, +) +Cut_4 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Cut_3_1")], + [ + model.selection("SOLID", "Rotation_1_1"), + model.selection("SOLID", "Rotation_1_2"), + ], +) +Recover_2 = model.addRecover( + Part_1_doc, Cut_4, [Rotation_1.results()[1], Rotation_1.result()] +) +Rotation_2 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Recover_2_1"), model.selection("SOLID", "Recover_2_2")], + model.selection("EDGE", "PartSet/OZ"), + 120, +) +Cut_5 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Cut_4_1")], + [ + model.selection("SOLID", "Rotation_2_2"), + model.selection("SOLID", "Rotation_2_1"), + ], +) model.do() Part_2 = model.addPart(partSet) Part_2.setName("Arm 1") @@ -273,66 +609,124 @@ SketchLine_30 = Sketch_4.addLine(-7.563632736215193e-032, -5.762896622594646, 0, SketchLine_30.setAuxiliary(True) SketchLine_31 = Sketch_4.addLine(0, 3.75, 4.894344934278314, 2.394344934278312) SketchLine_31.setAuxiliary(True) -SketchConstraintCoincidence_31 = Sketch_4.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) -SketchLine_32 = Sketch_4.addLine(4.894344934278314, 2.394344934278312, -7.563632736215193e-032, -5.762896622594646) +SketchConstraintCoincidence_31 = Sketch_4.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) +SketchLine_32 = Sketch_4.addLine( + 4.894344934278314, 2.394344934278312, -7.563632736215193e-032, -5.762896622594646 +) SketchLine_32.setAuxiliary(True) -SketchConstraintCoincidence_32 = Sketch_4.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) -SketchConstraintCoincidence_33 = Sketch_4.setCoincident(SketchLine_30.startPoint(), SketchLine_32.endPoint()) +SketchConstraintCoincidence_32 = Sketch_4.setCoincident( + SketchLine_31.endPoint(), SketchLine_32.startPoint() +) +SketchConstraintCoincidence_33 = Sketch_4.setCoincident( + SketchLine_30.startPoint(), SketchLine_32.endPoint() +) SketchConstraintVertical_3 = Sketch_4.setVertical(SketchLine_30.result()) SketchLine_33 = Sketch_4.addLine(0, 3.75, 6.25, 3.75) SketchLine_33.setAuxiliary(True) -SketchConstraintCoincidence_34 = Sketch_4.setCoincident(SketchLine_30.endPoint(), SketchLine_33.startPoint()) -SketchConstraintCoincidence_35 = Sketch_4.setCoincident(SketchLine_31.startPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_34 = Sketch_4.setCoincident( + SketchLine_30.endPoint(), SketchLine_33.startPoint() +) +SketchConstraintCoincidence_35 = Sketch_4.setCoincident( + SketchLine_31.startPoint(), SketchLine_33.startPoint() +) SketchLine_34 = Sketch_4.addLine(6.25, 3.75, 6.25, 0) SketchLine_34.setAuxiliary(True) -SketchConstraintCoincidence_36 = Sketch_4.setCoincident(SketchLine_33.endPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_36 = Sketch_4.setCoincident( + SketchLine_33.endPoint(), SketchLine_34.startPoint() +) SketchLine_35 = Sketch_4.addLine(6.25, 0, 0, 0) SketchLine_35.setAuxiliary(True) -SketchConstraintCoincidence_37 = Sketch_4.setCoincident(SketchLine_34.endPoint(), SketchLine_35.startPoint()) -SketchConstraintCoincidence_38 = Sketch_4.setCoincident(SketchLine_35.endPoint(), SketchLine_30.result()) +SketchConstraintCoincidence_37 = Sketch_4.setCoincident( + SketchLine_34.endPoint(), SketchLine_35.startPoint() +) +SketchConstraintCoincidence_38 = Sketch_4.setCoincident( + SketchLine_35.endPoint(), SketchLine_30.result() +) SketchConstraintHorizontal_3 = Sketch_4.setHorizontal(SketchLine_35.result()) SketchConstraintHorizontal_4 = Sketch_4.setHorizontal(SketchLine_33.result()) SketchConstraintVertical_4 = Sketch_4.setVertical(SketchLine_34.result()) -SketchLine_36 = Sketch_4.addLine(-7.563632736215193e-032, -5.762896622594646, 2.447172467139156, 3.072172467139157) +SketchLine_36 = Sketch_4.addLine( + -7.563632736215193e-032, -5.762896622594646, 2.447172467139156, 3.072172467139157 +) SketchLine_36.setAuxiliary(True) -SketchConstraintCoincidence_39 = Sketch_4.setCoincident(SketchLine_30.startPoint(), SketchLine_36.startPoint()) -SketchConstraintCoincidence_40 = Sketch_4.setCoincident(SketchLine_32.endPoint(), SketchLine_36.startPoint()) -SketchConstraintCoincidence_41 = Sketch_4.setCoincident(SketchLine_36.endPoint(), SketchLine_31.result()) -SketchConstraintPerpendicular_1 = Sketch_4.setPerpendicular(SketchLine_36.result(), SketchLine_31.result()) +SketchConstraintCoincidence_39 = Sketch_4.setCoincident( + SketchLine_30.startPoint(), SketchLine_36.startPoint() +) +SketchConstraintCoincidence_40 = Sketch_4.setCoincident( + SketchLine_32.endPoint(), SketchLine_36.startPoint() +) +SketchConstraintCoincidence_41 = Sketch_4.setCoincident( + SketchLine_36.endPoint(), SketchLine_31.result() +) +SketchConstraintPerpendicular_1 = Sketch_4.setPerpendicular( + SketchLine_36.result(), SketchLine_31.result() +) SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_42 = Sketch_4.setCoincident(SketchLine_35.endPoint(), SketchPoint_4.coordinates()) +SketchConstraintCoincidence_42 = Sketch_4.setCoincident( + SketchLine_35.endPoint(), SketchPoint_4.coordinates() +) SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_20") SketchConstraintLength_1 = Sketch_4.setLength(SketchLine_33.result(), "b/2") SketchConstraintLength_2 = Sketch_4.setLength(SketchLine_34.result(), "a/2") SketchCircle_5 = Sketch_4.addCircle(1.25, -1.25, 1.25) SketchCircle_5.setAuxiliary(True) SketchConstraintRadius_6 = Sketch_4.setRadius(SketchCircle_5.results()[1], "(b-a)/4") -SketchConstraintTangent_6 = Sketch_4.setTangent(SketchCircle_5.results()[1], SketchLine_35.result()) -SketchConstraintTangent_7 = Sketch_4.setTangent(SketchCircle_5.results()[1], SketchLine_30.result()) -SketchConstraintTangent_8 = Sketch_4.setTangent(SketchCircle_5.results()[1], SketchLine_32.result()) +SketchConstraintTangent_6 = Sketch_4.setTangent( + SketchCircle_5.results()[1], SketchLine_35.result() +) +SketchConstraintTangent_7 = Sketch_4.setTangent( + SketchCircle_5.results()[1], SketchLine_30.result() +) +SketchConstraintTangent_8 = Sketch_4.setTangent( + SketchCircle_5.results()[1], SketchLine_32.result() +) SketchLine_37 = Sketch_4.addLine(4.894344934278314, 2.394344934278312, 6.25, 0) SketchLine_37.setAuxiliary(True) -SketchConstraintCoincidence_44 = Sketch_4.setCoincident(SketchLine_31.endPoint(), SketchLine_37.startPoint()) -SketchConstraintCoincidence_45 = Sketch_4.setCoincident(SketchLine_32.startPoint(), SketchLine_37.startPoint()) -SketchConstraintCoincidence_46 = Sketch_4.setCoincident(SketchLine_34.endPoint(), SketchLine_37.endPoint()) -SketchConstraintCoincidence_47 = Sketch_4.setCoincident(SketchLine_35.startPoint(), SketchLine_37.endPoint()) +SketchConstraintCoincidence_44 = Sketch_4.setCoincident( + SketchLine_31.endPoint(), SketchLine_37.startPoint() +) +SketchConstraintCoincidence_45 = Sketch_4.setCoincident( + SketchLine_32.startPoint(), SketchLine_37.startPoint() +) +SketchConstraintCoincidence_46 = Sketch_4.setCoincident( + SketchLine_34.endPoint(), SketchLine_37.endPoint() +) +SketchConstraintCoincidence_47 = Sketch_4.setCoincident( + SketchLine_35.startPoint(), SketchLine_37.endPoint() +) SketchLine_38 = Sketch_4.addLine(0, 3.75, 6.25, 0) SketchLine_38.setName("SketchLine_10") SketchLine_38.result().setName("SketchLine_10") SketchLine_38.setAuxiliary(True) -SketchConstraintCoincidence_48 = Sketch_4.setCoincident(SketchLine_30.endPoint(), SketchLine_38.startPoint()) +SketchConstraintCoincidence_48 = Sketch_4.setCoincident( + SketchLine_30.endPoint(), SketchLine_38.startPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_23") -SketchConstraintCoincidence_49 = Sketch_4.setCoincident(SketchLine_31.startPoint(), SketchLine_38.startPoint()) +SketchConstraintCoincidence_49 = Sketch_4.setCoincident( + SketchLine_31.startPoint(), SketchLine_38.startPoint() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_24") -SketchConstraintCoincidence_50 = Sketch_4.setCoincident(SketchLine_33.startPoint(), SketchLine_38.startPoint()) +SketchConstraintCoincidence_50 = Sketch_4.setCoincident( + SketchLine_33.startPoint(), SketchLine_38.startPoint() +) SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_25") -SketchConstraintCoincidence_51 = Sketch_4.setCoincident(SketchLine_34.endPoint(), SketchLine_38.endPoint()) +SketchConstraintCoincidence_51 = Sketch_4.setCoincident( + SketchLine_34.endPoint(), SketchLine_38.endPoint() +) SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_26") -SketchConstraintCoincidence_52 = Sketch_4.setCoincident(SketchLine_35.startPoint(), SketchLine_38.endPoint()) +SketchConstraintCoincidence_52 = Sketch_4.setCoincident( + SketchLine_35.startPoint(), SketchLine_38.endPoint() +) SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_27") -SketchConstraintCoincidence_53 = Sketch_4.setCoincident(SketchLine_37.endPoint(), SketchLine_38.endPoint()) +SketchConstraintCoincidence_53 = Sketch_4.setCoincident( + SketchLine_37.endPoint(), SketchLine_38.endPoint() +) SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_28") -SketchConstraintPerpendicular_2 = Sketch_4.setPerpendicular(SketchLine_32.result(), SketchLine_38.result()) +SketchConstraintPerpendicular_2 = Sketch_4.setPerpendicular( + SketchLine_32.result(), SketchLine_38.result() +) SketchConstraintPerpendicular_2.setName("SketchConstraintPerpendicular_3") SketchLine_39 = Sketch_4.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_39.setName("SketchLine_11") @@ -340,30 +734,66 @@ SketchLine_39.result().setName("SketchLine_11") SketchLine_40 = Sketch_4.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_40.setName("SketchLine_12") SketchLine_40.result().setName("SketchLine_12") -SketchArc_12 = Sketch_4.addArc(-7.563632736215193e-032, -5.762896622594646, 0, 3.75, 4.894344934278314, 2.394344934278312, True) -SketchConstraintCoincidence_54 = Sketch_4.setCoincident(SketchLine_30.endPoint(), SketchArc_12.startPoint()) +SketchArc_12 = Sketch_4.addArc( + -7.563632736215193e-032, + -5.762896622594646, + 0, + 3.75, + 4.894344934278314, + 2.394344934278312, + True, +) +SketchConstraintCoincidence_54 = Sketch_4.setCoincident( + SketchLine_30.endPoint(), SketchArc_12.startPoint() +) SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_30") -SketchConstraintCoincidence_55 = Sketch_4.setCoincident(SketchLine_31.startPoint(), SketchArc_12.startPoint()) +SketchConstraintCoincidence_55 = Sketch_4.setCoincident( + SketchLine_31.startPoint(), SketchArc_12.startPoint() +) SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_31") -SketchConstraintCoincidence_56 = Sketch_4.setCoincident(SketchLine_33.startPoint(), SketchArc_12.startPoint()) +SketchConstraintCoincidence_56 = Sketch_4.setCoincident( + SketchLine_33.startPoint(), SketchArc_12.startPoint() +) SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_32") -SketchConstraintCoincidence_57 = Sketch_4.setCoincident(SketchLine_38.startPoint(), SketchArc_12.startPoint()) +SketchConstraintCoincidence_57 = Sketch_4.setCoincident( + SketchLine_38.startPoint(), SketchArc_12.startPoint() +) SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_33") -SketchConstraintCoincidence_58 = Sketch_4.setCoincident(SketchArc_12.endPoint(), SketchLine_31.endPoint()) +SketchConstraintCoincidence_58 = Sketch_4.setCoincident( + SketchArc_12.endPoint(), SketchLine_31.endPoint() +) SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_34") -SketchConstraintCoincidence_59 = Sketch_4.setCoincident(SketchArc_12.center(), SketchLine_32.endPoint()) +SketchConstraintCoincidence_59 = Sketch_4.setCoincident( + SketchArc_12.center(), SketchLine_32.endPoint() +) SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_35") -SketchArc_13 = Sketch_4.addArc(3.457737973711348, 3.788069295318559e-014, 6.25, 0, 4.894344934278314, 2.394344934278312, False) +SketchArc_13 = Sketch_4.addArc( + 3.457737973711348, + 3.788069295318559e-014, + 6.25, + 0, + 4.894344934278314, + 2.394344934278312, + False, +) SketchArc_13.setName("SketchArc_4") SketchArc_13.result().setName("SketchArc_4") SketchArc_13.results()[1].setName("SketchArc_4_2") -SketchConstraintCoincidence_60 = Sketch_4.setCoincident(SketchArc_13.startPoint(), SketchLine_35.startPoint()) +SketchConstraintCoincidence_60 = Sketch_4.setCoincident( + SketchArc_13.startPoint(), SketchLine_35.startPoint() +) SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_48") -SketchConstraintCoincidence_61 = Sketch_4.setCoincident(SketchArc_13.endPoint(), SketchArc_12.endPoint()) +SketchConstraintCoincidence_61 = Sketch_4.setCoincident( + SketchArc_13.endPoint(), SketchArc_12.endPoint() +) SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_49") -SketchConstraintCoincidence_43 = Sketch_4.setCoincident(SketchArc_13.center(), SketchLine_32.result()) +SketchConstraintCoincidence_43 = Sketch_4.setCoincident( + SketchArc_13.center(), SketchLine_32.result() +) SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_21") -SketchConstraintMirror_1 = Sketch_4.addMirror(SketchLine_40.result(), [SketchArc_13.results()[1], SketchArc_12.results()[1]]) +SketchConstraintMirror_1 = Sketch_4.addMirror( + SketchLine_40.result(), [SketchArc_13.results()[1], SketchArc_12.results()[1]] +) [SketchArc_14, SketchArc_15] = SketchConstraintMirror_1.mirrored() SketchArc_15.setName("SketchArc_6") SketchArc_15.result().setName("SketchArc_6") @@ -371,9 +801,21 @@ SketchArc_15.results()[1].setName("SketchArc_6_2") SketchArc_14.setName("SketchArc_5") SketchArc_14.result().setName("SketchArc_5") SketchArc_14.results()[1].setName("SketchArc_5_2") -SketchConstraintMirror_2_objects = [SketchArc_12.results()[1], SketchArc_13.results()[1], SketchArc_14.results()[1], SketchArc_15.results()[1]] -SketchConstraintMirror_2 = Sketch_4.addMirror(SketchLine_39.result(), SketchConstraintMirror_2_objects) -[SketchArc_16, SketchArc_17, SketchArc_18, SketchArc_19] = SketchConstraintMirror_2.mirrored() +SketchConstraintMirror_2_objects = [ + SketchArc_12.results()[1], + SketchArc_13.results()[1], + SketchArc_14.results()[1], + SketchArc_15.results()[1], +] +SketchConstraintMirror_2 = Sketch_4.addMirror( + SketchLine_39.result(), SketchConstraintMirror_2_objects +) +[ + SketchArc_16, + SketchArc_17, + SketchArc_18, + SketchArc_19, +] = SketchConstraintMirror_2.mirrored() SketchArc_19.setName("SketchArc_10") SketchArc_19.result().setName("SketchArc_10") SketchArc_19.results()[1].setName("SketchArc_10_2") @@ -388,7 +830,15 @@ SketchArc_16.result().setName("SketchArc_7") SketchArc_16.results()[1].setName("SketchArc_7_2") model.do() Sketch_5 = model.addSketch(Part_2_doc, model.defaultPlane("XOZ")) -SketchArc_20 = Sketch_5.addArc(75, 0, 21.9522369740045, 53.01825004597796, 20.93617039352901, -51.98174995402206, False) +SketchArc_20 = Sketch_5.addArc( + 75, + 0, + 21.9522369740045, + 53.01825004597796, + 20.93617039352901, + -51.98174995402206, + False, +) SketchArc_20.setName("SketchArc_3") SketchArc_20.result().setName("SketchArc_3") SketchArc_20.results()[1].setName("SketchArc_3_2") @@ -397,113 +847,246 @@ SketchConstraintRadius_7 = Sketch_5.setRadius(SketchArc_20.results()[1], 75) SketchLine_41 = Sketch_5.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_41.setName("SketchLine_13") SketchLine_41.result().setName("SketchLine_13") -SketchConstraintCoincidence_73 = Sketch_5.setCoincident(SketchArc_20.center(), SketchLine_41.result()) +SketchConstraintCoincidence_73 = Sketch_5.setCoincident( + SketchArc_20.center(), SketchLine_41.result() +) SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_38") -SketchConstraintCoincidence_74 = Sketch_5.setCoincident(SketchLine_41.startPoint(), SketchArc_20.results()[1]) +SketchConstraintCoincidence_74 = Sketch_5.setCoincident( + SketchLine_41.startPoint(), SketchArc_20.results()[1] +) SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_39") -SketchLine_42 = Sketch_5.addLine(16.9522369740045, -56.98174995402205, 16.9522369740045, -46.98174995402206) +SketchLine_42 = Sketch_5.addLine( + 16.9522369740045, -56.98174995402205, 16.9522369740045, -46.98174995402206 +) SketchLine_42.setName("SketchLine_14") SketchLine_42.result().setName("SketchLine_14") -SketchLine_43 = Sketch_5.addLine(16.9522369740045, -46.98174995402206, 36.95223697400451, -46.98174995402206) +SketchLine_43 = Sketch_5.addLine( + 16.9522369740045, -46.98174995402206, 36.95223697400451, -46.98174995402206 +) SketchLine_43.setName("SketchLine_15") SketchLine_43.result().setName("SketchLine_15") -SketchConstraintCoincidence_75 = Sketch_5.setCoincident(SketchLine_42.endPoint(), SketchLine_43.startPoint()) +SketchConstraintCoincidence_75 = Sketch_5.setCoincident( + SketchLine_42.endPoint(), SketchLine_43.startPoint() +) SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_40") -SketchLine_44 = Sketch_5.addLine(36.95223697400451, -46.98174995402206, 31.17873428210827, -56.98174995402205) +SketchLine_44 = Sketch_5.addLine( + 36.95223697400451, -46.98174995402206, 31.17873428210827, -56.98174995402205 +) SketchLine_44.setName("SketchLine_16") SketchLine_44.result().setName("SketchLine_16") -SketchConstraintCoincidence_76 = Sketch_5.setCoincident(SketchLine_43.endPoint(), SketchLine_44.startPoint()) +SketchConstraintCoincidence_76 = Sketch_5.setCoincident( + SketchLine_43.endPoint(), SketchLine_44.startPoint() +) SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_41") -SketchLine_45 = Sketch_5.addLine(31.17873428210827, -56.98174995402205, 16.9522369740045, -56.98174995402205) +SketchLine_45 = Sketch_5.addLine( + 31.17873428210827, -56.98174995402205, 16.9522369740045, -56.98174995402205 +) SketchLine_45.setName("SketchLine_17") SketchLine_45.result().setName("SketchLine_17") -SketchConstraintCoincidence_77 = Sketch_5.setCoincident(SketchLine_44.endPoint(), SketchLine_45.startPoint()) +SketchConstraintCoincidence_77 = Sketch_5.setCoincident( + SketchLine_44.endPoint(), SketchLine_45.startPoint() +) SketchConstraintCoincidence_77.setName("SketchConstraintCoincidence_42") -SketchConstraintCoincidence_78 = Sketch_5.setCoincident(SketchLine_42.startPoint(), SketchLine_45.endPoint()) +SketchConstraintCoincidence_78 = Sketch_5.setCoincident( + SketchLine_42.startPoint(), SketchLine_45.endPoint() +) SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_43") SketchConstraintHorizontal_5 = Sketch_5.setHorizontal(SketchLine_43.result()) SketchConstraintHorizontal_6 = Sketch_5.setHorizontal(SketchLine_45.result()) SketchConstraintVertical_5 = Sketch_5.setVertical(SketchLine_42.result()) -SketchConstraintAngle_4 = Sketch_5.setAngleComplementary(SketchLine_44.result(), SketchLine_45.result(), 60.00000000000006) -SketchConstraintDistance_14 = Sketch_5.setDistance(SketchLine_43.endPoint(), SketchLine_42.result(), 20) -SketchConstraintDistance_15 = Sketch_5.setDistance(SketchLine_42.startPoint(), SketchLine_43.result(), 10) -SketchLine_46 = Sketch_5.addLine(21.9522369740045, 53.01825004597796, 21.9522369740045, 0) +SketchConstraintAngle_4 = Sketch_5.setAngleComplementary( + SketchLine_44.result(), SketchLine_45.result(), 60.00000000000006 +) +SketchConstraintDistance_14 = Sketch_5.setDistance( + SketchLine_43.endPoint(), SketchLine_42.result(), 20 +) +SketchConstraintDistance_15 = Sketch_5.setDistance( + SketchLine_42.startPoint(), SketchLine_43.result(), 10 +) +SketchLine_46 = Sketch_5.addLine( + 21.9522369740045, 53.01825004597796, 21.9522369740045, 0 +) SketchLine_46.setName("SketchLine_18") SketchLine_46.result().setName("SketchLine_18") SketchLine_46.setAuxiliary(True) -SketchConstraintCoincidence_79 = Sketch_5.setCoincident(SketchArc_20.startPoint(), SketchLine_46.startPoint()) +SketchConstraintCoincidence_79 = Sketch_5.setCoincident( + SketchArc_20.startPoint(), SketchLine_46.startPoint() +) SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_44") -SketchConstraintCoincidence_80 = Sketch_5.setCoincident(SketchLine_46.endPoint(), SketchLine_41.result()) +SketchConstraintCoincidence_80 = Sketch_5.setCoincident( + SketchLine_46.endPoint(), SketchLine_41.result() +) SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_45") SketchConstraintVertical_6 = Sketch_5.setVertical(SketchLine_46.result()) -SketchConstraintDistance_16 = Sketch_5.setDistance(SketchLine_42.endPoint(), SketchLine_46.result(), 5) -SketchConstraintDistance_17 = Sketch_5.setDistance(SketchArc_20.startPoint(), SketchLine_43.result(), 100) +SketchConstraintDistance_16 = Sketch_5.setDistance( + SketchLine_42.endPoint(), SketchLine_46.result(), 5 +) +SketchConstraintDistance_17 = Sketch_5.setDistance( + SketchArc_20.startPoint(), SketchLine_43.result(), 100 +) SketchCircle_6 = Sketch_5.addCircle(21.9522369740045, 53.01825004597796, 8) -SketchConstraintCoincidence_81 = Sketch_5.setCoincident(SketchArc_20.startPoint(), SketchCircle_6.center()) +SketchConstraintCoincidence_81 = Sketch_5.setCoincident( + SketchArc_20.startPoint(), SketchCircle_6.center() +) SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_46") -SketchConstraintCoincidence_82 = Sketch_5.setCoincident(SketchLine_46.startPoint(), SketchCircle_6.center()) +SketchConstraintCoincidence_82 = Sketch_5.setCoincident( + SketchLine_46.startPoint(), SketchCircle_6.center() +) SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_47") SketchConstraintRadius_8 = Sketch_5.setRadius(SketchCircle_6.results()[1], 8) SketchCircle_7 = Sketch_5.addCircle(21.9522369740045, 53.01825004597796, 4) -SketchConstraintCoincidence_83 = Sketch_5.setCoincident(SketchArc_20.startPoint(), SketchCircle_7.center()) +SketchConstraintCoincidence_83 = Sketch_5.setCoincident( + SketchArc_20.startPoint(), SketchCircle_7.center() +) SketchConstraintCoincidence_83.setName("SketchConstraintCoincidence_61") -SketchConstraintCoincidence_84 = Sketch_5.setCoincident(SketchLine_46.startPoint(), SketchCircle_7.center()) +SketchConstraintCoincidence_84 = Sketch_5.setCoincident( + SketchLine_46.startPoint(), SketchCircle_7.center() +) SketchConstraintCoincidence_84.setName("SketchConstraintCoincidence_62") -SketchConstraintCoincidence_85 = Sketch_5.setCoincident(SketchCircle_6.center(), SketchCircle_7.center()) +SketchConstraintCoincidence_85 = Sketch_5.setCoincident( + SketchCircle_6.center(), SketchCircle_7.center() +) SketchConstraintCoincidence_85.setName("SketchConstraintCoincidence_63") SketchConstraintRadius_9 = Sketch_5.setRadius(SketchCircle_7.results()[1], 4) -SketchLine_47 = Sketch_5.addLine(21.9522369740045, 53.01825004597796, 39.68353296044558, 53.01825004597796) +SketchLine_47 = Sketch_5.addLine( + 21.9522369740045, 53.01825004597796, 39.68353296044558, 53.01825004597796 +) SketchLine_47.setName("SketchLine_19") SketchLine_47.result().setName("SketchLine_19") SketchLine_47.setAuxiliary(True) -SketchConstraintCoincidence_86 = Sketch_5.setCoincident(SketchArc_20.startPoint(), SketchLine_47.startPoint()) +SketchConstraintCoincidence_86 = Sketch_5.setCoincident( + SketchArc_20.startPoint(), SketchLine_47.startPoint() +) SketchConstraintCoincidence_86.setName("SketchConstraintCoincidence_64") -SketchConstraintCoincidence_87 = Sketch_5.setCoincident(SketchLine_46.startPoint(), SketchLine_47.startPoint()) +SketchConstraintCoincidence_87 = Sketch_5.setCoincident( + SketchLine_46.startPoint(), SketchLine_47.startPoint() +) SketchConstraintCoincidence_87.setName("SketchConstraintCoincidence_65") -SketchConstraintCoincidence_88 = Sketch_5.setCoincident(SketchCircle_6.center(), SketchLine_47.startPoint()) +SketchConstraintCoincidence_88 = Sketch_5.setCoincident( + SketchCircle_6.center(), SketchLine_47.startPoint() +) SketchConstraintCoincidence_88.setName("SketchConstraintCoincidence_66") -SketchConstraintCoincidence_89 = Sketch_5.setCoincident(SketchCircle_7.center(), SketchLine_47.startPoint()) +SketchConstraintCoincidence_89 = Sketch_5.setCoincident( + SketchCircle_7.center(), SketchLine_47.startPoint() +) SketchConstraintCoincidence_89.setName("SketchConstraintCoincidence_67") SketchConstraintHorizontal_7 = Sketch_5.setHorizontal(SketchLine_47.result()) -SketchConstraintDistance_18 = Sketch_5.setDistance(SketchArc_20.endPoint(), SketchLine_47.result(), 105) +SketchConstraintDistance_18 = Sketch_5.setDistance( + SketchArc_20.endPoint(), SketchLine_47.result(), 105 +) SketchLine_48 = Sketch_5.addLine(75, 0, 20.93617039352901, -51.98174995402206) SketchLine_48.setName("SketchLine_20") SketchLine_48.result().setName("SketchLine_20") SketchLine_48.setAuxiliary(True) -SketchConstraintCoincidence_90 = Sketch_5.setCoincident(SketchArc_20.center(), SketchLine_48.startPoint()) +SketchConstraintCoincidence_90 = Sketch_5.setCoincident( + SketchArc_20.center(), SketchLine_48.startPoint() +) SketchConstraintCoincidence_90.setName("SketchConstraintCoincidence_68") -SketchConstraintCoincidence_91 = Sketch_5.setCoincident(SketchArc_20.endPoint(), SketchLine_48.endPoint()) +SketchConstraintCoincidence_91 = Sketch_5.setCoincident( + SketchArc_20.endPoint(), SketchLine_48.endPoint() +) SketchConstraintCoincidence_91.setName("SketchConstraintCoincidence_69") SketchLine_49 = Sketch_5.addLine(21.9522369740045, 53.01825004597796, 0, 10) SketchLine_49.setName("SketchLine_21") SketchLine_49.result().setName("SketchLine_21") SketchLine_49.setAuxiliary(True) -SketchConstraintCoincidence_92 = Sketch_5.setCoincident(SketchArc_20.startPoint(), SketchLine_49.startPoint()) +SketchConstraintCoincidence_92 = Sketch_5.setCoincident( + SketchArc_20.startPoint(), SketchLine_49.startPoint() +) SketchConstraintCoincidence_92.setName("SketchConstraintCoincidence_70") -SketchConstraintCoincidence_93 = Sketch_5.setCoincident(SketchLine_46.startPoint(), SketchLine_49.startPoint()) +SketchConstraintCoincidence_93 = Sketch_5.setCoincident( + SketchLine_46.startPoint(), SketchLine_49.startPoint() +) SketchConstraintCoincidence_93.setName("SketchConstraintCoincidence_71") -SketchConstraintCoincidence_94 = Sketch_5.setCoincident(SketchCircle_6.center(), SketchLine_49.startPoint()) +SketchConstraintCoincidence_94 = Sketch_5.setCoincident( + SketchCircle_6.center(), SketchLine_49.startPoint() +) SketchConstraintCoincidence_94.setName("SketchConstraintCoincidence_72") -SketchConstraintCoincidence_95 = Sketch_5.setCoincident(SketchCircle_7.center(), SketchLine_49.startPoint()) +SketchConstraintCoincidence_95 = Sketch_5.setCoincident( + SketchCircle_7.center(), SketchLine_49.startPoint() +) SketchConstraintCoincidence_95.setName("SketchConstraintCoincidence_73") -SketchConstraintCoincidence_96 = Sketch_5.setCoincident(SketchLine_47.startPoint(), SketchLine_49.startPoint()) +SketchConstraintCoincidence_96 = Sketch_5.setCoincident( + SketchLine_47.startPoint(), SketchLine_49.startPoint() +) SketchConstraintCoincidence_96.setName("SketchConstraintCoincidence_74") SketchLine_50 = Sketch_5.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_50.setName("SketchLine_22") SketchLine_50.result().setName("SketchLine_22") -SketchConstraintCoincidence_97 = Sketch_5.setCoincident(SketchLine_49.endPoint(), SketchLine_50.result()) +SketchConstraintCoincidence_97 = Sketch_5.setCoincident( + SketchLine_49.endPoint(), SketchLine_50.result() +) SketchConstraintCoincidence_97.setName("SketchConstraintCoincidence_75") -SketchConstraintDistance_19 = Sketch_5.setDistance(SketchLine_49.endPoint(), SketchLine_41.result(), 10) +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/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/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/SketchCircle_2_2__cc"), model.selection("VERTEX", "Sketch_2/SketchLine_21_EndVertex")) +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/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/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") @@ -511,9 +1094,28 @@ model.do() Part_4 = model.duplicatePart(Part_3) Part_4.setName("Arm 3") model.do() -Translation_4 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_2/"), model.selection("COMPOUND", "Part_3/"), model.selection("COMPOUND", "Part_4/")], model.selection("EDGE", "OX"), -40) -Rotation_6 = model.addRotation(partSet, [model.selection("COMPOUND", "Translation_1_2/")], model.selection("EDGE", "OZ"), 120) -Rotation_7 = model.addRotation(partSet, [model.selection("COMPOUND", "Translation_1_3/")], model.selection("EDGE", "OZ"), 240) +Translation_4 = model.addTranslation( + partSet, + [ + model.selection("COMPOUND", "Part_2/"), + model.selection("COMPOUND", "Part_3/"), + model.selection("COMPOUND", "Part_4/"), + ], + model.selection("EDGE", "OX"), + -40, +) +Rotation_6 = model.addRotation( + partSet, + [model.selection("COMPOUND", "Translation_1_2/")], + model.selection("EDGE", "OZ"), + 120, +) +Rotation_7 = model.addRotation( + partSet, + [model.selection("COMPOUND", "Translation_1_3/")], + model.selection("EDGE", "OZ"), + 240, +) Part_5 = model.addPart(partSet) Part_5.setName("Rod part") Part_5_doc = Part_5.document() @@ -521,85 +1123,229 @@ Parameter_H = model.addParameter(partSet, "H", "110") Sketch_10 = model.addSketch(Part_5_doc, model.defaultPlane("YOZ")) SketchLine_93 = Sketch_10.addLine(0, 25, 6, 25) SketchLine_94 = Sketch_10.addLine(6, 25, 6, -75) -SketchConstraintCoincidence_232 = Sketch_10.setCoincident(SketchLine_93.endPoint(), SketchLine_94.startPoint()) +SketchConstraintCoincidence_232 = Sketch_10.setCoincident( + SketchLine_93.endPoint(), SketchLine_94.startPoint() +) SketchLine_95 = Sketch_10.addLine(6, -75, 4, -75) -SketchConstraintCoincidence_233 = Sketch_10.setCoincident(SketchLine_94.endPoint(), SketchLine_95.startPoint()) +SketchConstraintCoincidence_233 = Sketch_10.setCoincident( + SketchLine_94.endPoint(), SketchLine_95.startPoint() +) SketchLine_96 = Sketch_10.addLine(4, -75, 4, -81.00000000054168) -SketchConstraintCoincidence_234 = Sketch_10.setCoincident(SketchLine_95.endPoint(), SketchLine_96.startPoint()) +SketchConstraintCoincidence_234 = Sketch_10.setCoincident( + SketchLine_95.endPoint(), SketchLine_96.startPoint() +) SketchLine_97 = Sketch_10.addLine(4, -81.00000000054168, 0, -85) -SketchConstraintCoincidence_235 = Sketch_10.setCoincident(SketchLine_96.endPoint(), SketchLine_97.startPoint()) +SketchConstraintCoincidence_235 = Sketch_10.setCoincident( + SketchLine_96.endPoint(), SketchLine_97.startPoint() +) SketchLine_98 = Sketch_10.addLine(0, -85, 0, 25) -SketchConstraintCoincidence_236 = Sketch_10.setCoincident(SketchLine_97.endPoint(), SketchLine_98.startPoint()) -SketchConstraintCoincidence_237 = Sketch_10.setCoincident(SketchLine_93.startPoint(), SketchLine_98.endPoint()) +SketchConstraintCoincidence_236 = Sketch_10.setCoincident( + SketchLine_97.endPoint(), SketchLine_98.startPoint() +) +SketchConstraintCoincidence_237 = Sketch_10.setCoincident( + SketchLine_93.startPoint(), SketchLine_98.endPoint() +) SketchConstraintVertical_15 = Sketch_10.setVertical(SketchLine_98.result()) SketchConstraintVertical_16 = Sketch_10.setVertical(SketchLine_94.result()) SketchConstraintVertical_17 = Sketch_10.setVertical(SketchLine_96.result()) SketchConstraintHorizontal_18 = Sketch_10.setHorizontal(SketchLine_93.result()) SketchConstraintHorizontal_19 = Sketch_10.setHorizontal(SketchLine_95.result()) -SketchConstraintAngle_7 = Sketch_10.setAngle(SketchLine_97.result(), SketchLine_98.result(), 45.00000000387975) -SketchConstraintDistance_32 = Sketch_10.setDistance(SketchLine_97.endPoint(), SketchLine_95.result(), 10) -SketchConstraintDistance_33 = Sketch_10.setDistance(SketchLine_97.startPoint(), SketchLine_98.result(), 4) +SketchConstraintAngle_7 = Sketch_10.setAngle( + SketchLine_97.result(), SketchLine_98.result(), 45.00000000387975 +) +SketchConstraintDistance_32 = Sketch_10.setDistance( + SketchLine_97.endPoint(), SketchLine_95.result(), 10 +) +SketchConstraintDistance_33 = Sketch_10.setDistance( + SketchLine_97.startPoint(), SketchLine_98.result(), 4 +) SketchConstraintLength_7 = Sketch_10.setLength(SketchLine_93.result(), "Rod/2") -SketchConstraintDistance_34 = Sketch_10.setDistance(SketchLine_97.endPoint(), SketchLine_93.result(), "H") +SketchConstraintDistance_34 = Sketch_10.setDistance( + SketchLine_97.endPoint(), SketchLine_93.result(), "H" +) SketchPoint_7 = Sketch_10.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_238 = Sketch_10.setCoincident(SketchPoint_7.coordinates(), SketchLine_98.result()) +SketchConstraintCoincidence_238 = Sketch_10.setCoincident( + SketchPoint_7.coordinates(), SketchLine_98.result() +) SketchLine_99 = Sketch_10.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintDistance_35 = Sketch_10.setDistance(SketchLine_98.endPoint(), SketchLine_99.result(), "Thickness") +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_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")) +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/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") +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) -SketchLine_101 = Sketch_11.addLine(-8.5, 4.907477288111821, -2.182790672831509e-014, 9.814954576223595) -SketchConstraintCoincidence_240 = Sketch_11.setCoincident(SketchLine_100.endPoint(), SketchLine_101.startPoint()) -SketchLine_102 = Sketch_11.addLine(-2.182790672831509e-014, 9.814954576223595, 8.5, 4.907477288111624) -SketchConstraintCoincidence_241 = Sketch_11.setCoincident(SketchLine_101.endPoint(), SketchLine_102.startPoint()) +SketchLine_101 = Sketch_11.addLine( + -8.5, 4.907477288111821, -2.182790672831509e-014, 9.814954576223595 +) +SketchConstraintCoincidence_240 = Sketch_11.setCoincident( + SketchLine_100.endPoint(), SketchLine_101.startPoint() +) +SketchLine_102 = Sketch_11.addLine( + -2.182790672831509e-014, 9.814954576223595, 8.5, 4.907477288111624 +) +SketchConstraintCoincidence_241 = Sketch_11.setCoincident( + SketchLine_101.endPoint(), SketchLine_102.startPoint() +) SketchLine_103 = Sketch_11.addLine(8.5, 4.907477288111624, 8.5, -4.907477288111966) -SketchConstraintCoincidence_242 = Sketch_11.setCoincident(SketchLine_102.endPoint(), SketchLine_103.startPoint()) -SketchLine_104 = Sketch_11.addLine(8.5, -4.907477288111966, 4.843087198023196e-015, -9.814954576223641) -SketchConstraintCoincidence_243 = Sketch_11.setCoincident(SketchLine_103.endPoint(), SketchLine_104.startPoint()) -SketchLine_105 = Sketch_11.addLine(4.843087198023196e-015, -9.814954576223641, -8.5, -4.907477288111821) -SketchConstraintCoincidence_244 = Sketch_11.setCoincident(SketchLine_104.endPoint(), SketchLine_105.startPoint()) -SketchConstraintCoincidence_245 = Sketch_11.setCoincident(SketchLine_100.startPoint(), SketchLine_105.endPoint()) +SketchConstraintCoincidence_242 = Sketch_11.setCoincident( + SketchLine_102.endPoint(), SketchLine_103.startPoint() +) +SketchLine_104 = Sketch_11.addLine( + 8.5, -4.907477288111966, 4.843087198023196e-015, -9.814954576223641 +) +SketchConstraintCoincidence_243 = Sketch_11.setCoincident( + SketchLine_103.endPoint(), SketchLine_104.startPoint() +) +SketchLine_105 = Sketch_11.addLine( + 4.843087198023196e-015, -9.814954576223641, -8.5, -4.907477288111821 +) +SketchConstraintCoincidence_244 = Sketch_11.setCoincident( + SketchLine_104.endPoint(), SketchLine_105.startPoint() +) +SketchConstraintCoincidence_245 = Sketch_11.setCoincident( + SketchLine_100.startPoint(), SketchLine_105.endPoint() +) SketchConstraintVertical_18 = Sketch_11.setVertical(SketchLine_100.result()) SketchConstraintVertical_19 = Sketch_11.setVertical(SketchLine_103.result()) -SketchConstraintTangent_15 = Sketch_11.setTangent(SketchCircle_14.results()[1], SketchLine_103.result()) -SketchConstraintTangent_16 = Sketch_11.setTangent(SketchCircle_14.results()[1], SketchLine_100.result()) -SketchConstraintTangent_17 = Sketch_11.setTangent(SketchLine_104.result(), SketchCircle_14.results()[1]) -SketchConstraintTangent_18 = Sketch_11.setTangent(SketchLine_105.result(), SketchCircle_14.results()[1]) -SketchConstraintTangent_19 = Sketch_11.setTangent(SketchLine_101.result(), SketchCircle_14.results()[1]) -SketchConstraintTangent_20 = Sketch_11.setTangent(SketchLine_102.result(), SketchCircle_14.results()[1]) -SketchConstraintEqual_7 = Sketch_11.setEqual(SketchLine_100.result(), SketchLine_101.result()) -SketchConstraintEqual_8 = Sketch_11.setEqual(SketchLine_101.result(), SketchLine_102.result()) -SketchConstraintEqual_9 = Sketch_11.setEqual(SketchLine_102.result(), SketchLine_103.result()) -SketchConstraintEqual_10 = Sketch_11.setEqual(SketchLine_103.result(), SketchLine_104.result()) +SketchConstraintTangent_15 = Sketch_11.setTangent( + SketchCircle_14.results()[1], SketchLine_103.result() +) +SketchConstraintTangent_16 = Sketch_11.setTangent( + SketchCircle_14.results()[1], SketchLine_100.result() +) +SketchConstraintTangent_17 = Sketch_11.setTangent( + SketchLine_104.result(), SketchCircle_14.results()[1] +) +SketchConstraintTangent_18 = Sketch_11.setTangent( + SketchLine_105.result(), SketchCircle_14.results()[1] +) +SketchConstraintTangent_19 = Sketch_11.setTangent( + SketchLine_101.result(), SketchCircle_14.results()[1] +) +SketchConstraintTangent_20 = Sketch_11.setTangent( + SketchLine_102.result(), SketchCircle_14.results()[1] +) +SketchConstraintEqual_7 = Sketch_11.setEqual( + SketchLine_100.result(), SketchLine_101.result() +) +SketchConstraintEqual_8 = Sketch_11.setEqual( + SketchLine_101.result(), SketchLine_102.result() +) +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_13r-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r")], 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) -SketchConstraintCoincidence_246 = Sketch_12.setCoincident(SketchLine_106.endPoint(), SketchLine_107.startPoint()) -SketchLine_108 = Sketch_12.addLine(4, 52.35726558990813, 9.814954576223595, 48.99999999999999) -SketchConstraintCoincidence_247 = Sketch_12.setCoincident(SketchLine_107.endPoint(), SketchLine_108.startPoint()) -SketchConstraintCoincidence_248 = Sketch_12.setCoincident(SketchLine_106.startPoint(), SketchLine_108.endPoint()) +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 +) +SketchConstraintCoincidence_246 = Sketch_12.setCoincident( + SketchLine_106.endPoint(), SketchLine_107.startPoint() +) +SketchLine_108 = Sketch_12.addLine( + 4, 52.35726558990813, 9.814954576223595, 48.99999999999999 +) +SketchConstraintCoincidence_247 = Sketch_12.setCoincident( + SketchLine_107.endPoint(), SketchLine_108.startPoint() +) +SketchConstraintCoincidence_248 = Sketch_12.setCoincident( + SketchLine_106.startPoint(), SketchLine_108.endPoint() +) 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&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&Sketch_2/SketchLine_10][Extrusion_1_1/To_Face]"), False) +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&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&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) +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) +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_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")], []) +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")], + [], +) # Test reexecution after parameter change Parameter_H.setValue(120) @@ -609,7 +1355,7 @@ Parameter_H.setValue(110) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Part_1, 1) model.testNbSubShapes(Part_1, GeomAPI_Shape.SOLID, [1]) diff --git a/test.compatibility/bobine_film_reel.py b/test.compatibility/bobine_film_reel.py index 087b33446..cdc8b7a5f 100644 --- a/test.compatibility/bobine_film_reel.py +++ b/test.compatibility/bobine_film_reel.py @@ -33,85 +33,195 @@ model.addParameter(Part_1_doc, "R3", "25.9") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 40) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchPoint_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchPoint_1.result() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "R") SketchLine_1 = Sketch_1.addLine(0, 0, -20.88093073029438, 34.1172497695333) SketchLine_1.setAuxiliary(True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_1.startPoint() +) +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) +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")) -SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1")) +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") -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchCircle_2.center() +) 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_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")) 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/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()) +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")) -SketchProjection_3 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1")) +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") -SketchConstraintCoincidence_7 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_4).startPoint(), SketchCircle_4.center()) +SketchConstraintCoincidence_7 = Sketch_4.setCoincident( + SketchAPI_Line(SketchLine_4).startPoint(), SketchCircle_4.center() +) 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")) -SketchProjection_4 = Sketch_5.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1")) +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) -SketchConstraintCoincidence_8 = Sketch_5.setCoincident(SketchAPI_Line(SketchLine_5).startPoint(), SketchCircle_5.center()) +SketchConstraintCoincidence_8 = Sketch_5.setCoincident( + SketchAPI_Line(SketchLine_5).startPoint(), SketchCircle_5.center() +) 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"), 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")) +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"), + 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 = 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/Modified_Face&Extrusion_1_1/From_Face")) +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()) +SketchConstraintCoincidence_10 = Sketch_7.setCoincident( + SketchCircle_7.center(), SketchLine_6.result() +) SketchConstraintRadius_7 = Sketch_7.setRadius(SketchCircle_7.results()[1], 66) -SketchConstraintDistance_1 = Sketch_7.setDistance(SketchCircle_7.center(), SketchLine_6.startPoint(), 85) -SketchMultiRotation_1 = Sketch_7.addRotation([SketchCircle_7.results()[1]], SketchLine_6.startPoint(), 120, 3) +SketchConstraintDistance_1 = Sketch_7.setDistance( + SketchCircle_7.center(), SketchLine_6.startPoint(), 85 +) +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/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) +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) -SketchConstraintCoincidence_11 = Sketch_8.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchLine_8 = Sketch_8.addLine( + -7, 11.00000001704673, -6.329882773485103e-016, 30.00000001704673 +) +SketchConstraintCoincidence_11 = Sketch_8.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_8.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintCoincidence_12 = Sketch_8.setCoincident(SketchLine_7.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_13 = Sketch_8.setCoincident(SketchLine_8.endPoint(), SketchLine_9.result()) -SketchConstraintMirror_1 = Sketch_8.addMirror(SketchLine_9.result(), [SketchLine_7.result(), SketchLine_8.result()]) +SketchConstraintCoincidence_12 = Sketch_8.setCoincident( + SketchLine_7.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_13 = Sketch_8.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.result() +) +SketchConstraintMirror_1 = Sketch_8.addMirror( + SketchLine_9.result(), [SketchLine_7.result(), SketchLine_8.result()] +) [SketchLine_10, SketchLine_11] = SketchConstraintMirror_1.mirrored() SketchConstraintLength_1 = Sketch_8.setLength(SketchLine_7.result(), 7) -SketchConstraintDistance_2 = Sketch_8.setDistance(SketchLine_9.startPoint(), SketchLine_7.result(), 11) -SketchConstraintDistance_3 = Sketch_8.setDistance(SketchLine_8.endPoint(), SketchLine_9.startPoint(), 30) -SketchMultiRotation_2_objects = [SketchLine_11.result(), SketchLine_10.result(), SketchLine_8.result(), SketchLine_7.result()] -SketchMultiRotation_2 = Sketch_8.addRotation(SketchMultiRotation_2_objects, SketchLine_9.startPoint(), 120, 3) -[SketchLine_11, SketchLine_12, SketchLine_13, SketchLine_10, SketchLine_14, SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18, SketchLine_19] = SketchMultiRotation_2.rotated() +SketchConstraintDistance_2 = Sketch_8.setDistance( + SketchLine_9.startPoint(), SketchLine_7.result(), 11 +) +SketchConstraintDistance_3 = Sketch_8.setDistance( + SketchLine_8.endPoint(), SketchLine_9.startPoint(), 30 +) +SketchMultiRotation_2_objects = [ + SketchLine_11.result(), + SketchLine_10.result(), + SketchLine_8.result(), + SketchLine_7.result(), +] +SketchMultiRotation_2 = Sketch_8.addRotation( + SketchMultiRotation_2_objects, SketchLine_9.startPoint(), 120, 3 +) +[ + SketchLine_11, + SketchLine_12, + SketchLine_13, + SketchLine_10, + SketchLine_14, + SketchLine_15, + SketchLine_16, + SketchLine_17, + SketchLine_18, + SketchLine_19, +] = SketchMultiRotation_2.rotated() SketchLine_18.setName("SketchLine_15") SketchLine_18.result().setName("SketchLine_15") SketchLine_17.setName("SketchLine_18") @@ -125,8 +235,30 @@ SketchLine_14.result().setName("SketchLine_13") SketchLine_13.setName("SketchLine_16") SketchLine_13.result().setName("SketchLine_16") model.do() -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")]) +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) diff --git a/test.compatibility/bracket32.py b/test.compatibility/bracket32.py index 668795ee8..7ab98e107 100644 --- a/test.compatibility/bracket32.py +++ b/test.compatibility/bracket32.py @@ -38,18 +38,30 @@ model.addParameter(Part_1_doc, "BaseLegFillet", "3") model.addParameter(Part_1_doc, "LegTopFillet", "2") model.addParameter(Part_1_doc, "BottomCutFillet", "2") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchLine_1 = Sketch_1.addLine(56, -3.652030108005817e-032, 20.9106603007908, -1.450725046594067e-032) +SketchLine_1 = Sketch_1.addLine( + 56, -3.652030108005817e-032, 20.9106603007908, -1.450725046594067e-032 +) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) -SketchLine_3 = Sketch_1.addLine(20.9106603007908, -1.450725046594067e-032, 17.67553830650723, 18.34728855042577) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) +SketchLine_3 = Sketch_1.addLine( + 20.9106603007908, -1.450725046594067e-032, 17.67553830650723, 18.34728855042577 +) SketchLine_3.setName("SketchLine_33") SketchLine_3.result().setName("SketchLine_33") -SketchLine_4 = Sketch_1.addLine(20.9106603007908, -1.450725046594067e-032, 17.3841206866215, 20) +SketchLine_4 = Sketch_1.addLine( + 20.9106603007908, -1.450725046594067e-032, 17.3841206866215, 20 +) SketchLine_4.setName("SketchLine_3") SketchLine_4.result().setName("SketchLine_3") SketchLine_4.setAuxiliary(True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(15.70591356041877, 20, 0, 20) SketchLine_5.setName("SketchLine_32") SketchLine_5.result().setName("SketchLine_32") @@ -57,11 +69,15 @@ SketchLine_6 = Sketch_1.addLine(17.3841206866215, 20, 0, 20) SketchLine_6.setName("SketchLine_4") SketchLine_6.result().setName("SketchLine_4") SketchLine_6.setAuxiliary(True) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_7.setName("SketchLine_5") SketchLine_7.result().setName("SketchLine_5") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.result()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.result() +) SketchLine_8 = Sketch_1.addLine(11, 85, 24.49270766728805, 8.479052309092824) SketchLine_8.setName("SketchLine_77") SketchLine_8.result().setName("SketchLine_77") @@ -81,80 +97,148 @@ SketchLine_13 = Sketch_1.addLine(11, 85, 24.92983147596873, 6) SketchLine_13.setName("SketchLine_8") SketchLine_13.result().setName("SketchLine_8") SketchLine_13.setAuxiliary(True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_9") SketchLine_14 = Sketch_1.addLine(24.92983147596873, 6, 56, 6) SketchLine_14.setName("SketchLine_9") SketchLine_14.result().setName("SketchLine_9") SketchLine_14.setAuxiliary(True) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_10") SketchLine_15 = Sketch_1.addLine(56, 6, 56, -3.652030108005817e-032) SketchLine_15.setName("SketchLine_10") SketchLine_15.result().setName("SketchLine_10") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_11") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_15.endPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_15.endPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_12") SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_12.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_14.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_15.result()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_14.result(), SketchLine_13.result(), "Draft") -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_13.result(), SketchLine_4.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_4.endPoint(), SketchLine_13.result(), "LegThick") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_14.endPoint(), SketchLine_1.result(), 6) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_1.result(), 20) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_12.startPoint(), SketchLine_7.result()) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_14.result(), SketchLine_13.result(), "Draft" +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_13.result(), SketchLine_4.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_4.endPoint(), SketchLine_13.result(), "LegThick" +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_14.endPoint(), SketchLine_1.result(), 6 +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.endPoint(), SketchLine_1.result(), 20 +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_12.startPoint(), SketchLine_7.result() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_13") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_13.startPoint(), SketchLine_7.result(), "TDE/2") -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_13.startPoint(), SketchLine_1.result(), 85) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_13.startPoint(), SketchLine_7.result(), "TDE/2" +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_13.startPoint(), SketchLine_1.result(), 85 +) SketchConstraintDistance_5.setName("SketchConstraintDistance_11") -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_7.result(), "Width/2") +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_7.result(), "Width/2" +) SketchConstraintDistance_6.setName("SketchConstraintDistance_12") SketchLine_16 = Sketch_1.addLine(11, 85, 24.92983147596873, 6) SketchLine_16.setName("SketchLine_30") SketchLine_16.result().setName("SketchLine_30") SketchLine_16.setAuxiliary(True) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_13.startPoint(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_13.startPoint(), SketchLine_16.startPoint() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_24") SketchLine_17 = Sketch_1.addLine(24.92983147596873, 6, 56, 6) SketchLine_17.setName("SketchLine_31") SketchLine_17.result().setName("SketchLine_31") SketchLine_17.setAuxiliary(True) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_17.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchLine_17.endPoint() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_25") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_13.result()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_16.endPoint(), SketchLine_13.result() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_26") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_17.startPoint(), SketchLine_14.result()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_17.startPoint(), SketchLine_14.result() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_27") -SketchArc_1 = Sketch_1.addArc(15.70592142426694, 18, 17.67553830650723, 18.34728855042577, 15.70591356041877, 20, False) +SketchArc_1 = Sketch_1.addArc( + 15.70592142426694, + 18, + 17.67553830650723, + 18.34728855042577, + 15.70591356041877, + 20, + False, +) SketchArc_1.setName("SketchArc_2") SketchArc_1.result().setName("SketchArc_2") SketchArc_1.results()[1].setName("SketchArc_2_2") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_3.endPoint() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_28") -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_29") -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_5.result()) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_5.result() +) SketchConstraintTangent_1.setName("SketchConstraintTangent_3") -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_3.result()) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_3.result() +) SketchConstraintTangent_2.setName("SketchConstraintTangent_4") -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_5.endPoint() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_30") -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_4.startPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_31") -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_6.result() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_32") -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.result()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.result() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_33") SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "LegTopFillet") SketchConstraintRadius_1.setName("SketchConstraintRadius_7") -SketchArc_2 = Sketch_1.addArc(-15.70592142426695, 18, -15.70592154309944, 20, -17.67553694121995, 18.34729629335474, False) +SketchArc_2 = Sketch_1.addArc( + -15.70592142426695, + 18, + -15.70592154309944, + 20, + -17.67553694121995, + 18.34729629335474, + False, +) SketchArc_2.setName("SketchArc_3") SketchArc_2.result().setName("SketchArc_3") SketchArc_2.results()[1].setName("SketchArc_3_2") -SketchLine_18 = Sketch_1.addLine(-20.91066030079081, 0, -17.67553694121995, 18.34729629335474) +SketchLine_18 = Sketch_1.addLine( + -20.91066030079081, 0, -17.67553694121995, 18.34729629335474 +) SketchLine_18.setName("SketchLine_34") SketchLine_18.result().setName("SketchLine_34") SketchLine_19 = Sketch_1.addLine(-56, 0, -20.91066030079081, 0) @@ -175,7 +259,9 @@ SketchLine_23 = Sketch_1.addLine(-11, 85, -24.92983147596874, 6) SketchLine_23.setName("SketchLine_37") SketchLine_23.result().setName("SketchLine_37") SketchLine_23.setAuxiliary(True) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_23.startPoint(), SketchLine_7.result(), "TDE/2") +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchLine_23.startPoint(), SketchLine_7.result(), "TDE/2" +) SketchConstraintDistance_7.setName("SketchConstraintDistance_31") SketchLine_24 = Sketch_1.addLine(-24.92983147596874, 6, -56, 6) SketchLine_24.setName("SketchLine_39") @@ -185,89 +271,173 @@ SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_24.result()) SketchConstraintHorizontal_5.setName("SketchConstraintHorizontal_19") SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_19.result()) SketchConstraintHorizontal_6.setName("SketchConstraintHorizontal_20") -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_24.endPoint(), SketchLine_19.result(), "BPS") +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchLine_24.endPoint(), SketchLine_19.result(), "BPS" +) SketchConstraintDistance_8.setName("SketchConstraintDistance_32") -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_23.startPoint(), SketchLine_21.endPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_23.startPoint(), SketchLine_21.endPoint() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_113") -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_20.endPoint(), SketchLine_7.result(), "Width/2") +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_20.endPoint(), SketchLine_7.result(), "Width/2" +) SketchConstraintDistance_9.setName("SketchConstraintDistance_33") -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_24.endPoint(), SketchLine_20.startPoint() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_114") -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_20.endPoint(), SketchLine_19.startPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_115") -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_18.startPoint() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_116") -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_18.endPoint()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_18.endPoint() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_117") SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_20.result()) SketchConstraintVertical_2.setName("SketchConstraintVertical_16") -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_23.result(), SketchLine_18.result()) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchLine_2.result(), SketchLine_19.endPoint()) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_23.result(), SketchLine_18.result() +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchLine_19.endPoint() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_118") -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_22.startPoint(), SketchArc_2.startPoint()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_22.startPoint(), SketchArc_2.startPoint() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_119") SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], "LegTopFillet") SketchConstraintRadius_2.setName("SketchConstraintRadius_16") SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_22.result()) SketchConstraintHorizontal_7.setName("SketchConstraintHorizontal_21") -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchLine_22.endPoint(), SketchLine_5.endPoint() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_120") -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_22.result()) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_22.result() +) SketchConstraintTangent_3.setName("SketchConstraintTangent_19") -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_18.result(), SketchArc_2.results()[1]) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchLine_18.result(), SketchArc_2.results()[1] +) SketchConstraintTangent_4.setName("SketchConstraintTangent_20") -SketchConstraintAngle_2 = Sketch_1.setAngleBackward(SketchLine_19.result(), SketchLine_23.result(), "Draft") -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_17.startPoint(), SketchLine_16.endPoint()) +SketchConstraintAngle_2 = Sketch_1.setAngleBackward( + SketchLine_19.result(), SketchLine_23.result(), "Draft" +) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_17.startPoint(), SketchLine_16.endPoint() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_121") -SketchArc_3 = Sketch_1.addArc(27.44713036950057, 9.000000000000002, 24.49270766728805, 8.479052309092824, 27.44713044942998, 5.999999999999999, False) +SketchArc_3 = Sketch_1.addArc( + 27.44713036950057, + 9.000000000000002, + 24.49270766728805, + 8.479052309092824, + 27.44713044942998, + 5.999999999999999, + False, +) SketchArc_3.setName("SketchArc_12") SketchArc_3.result().setName("SketchArc_12") SketchArc_3.results()[1].setName("SketchArc_12_2") -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchLine_8.endPoint() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_122") -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_9.startPoint() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_123") -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_8.result()) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_8.result() +) SketchConstraintTangent_5.setName("SketchConstraintTangent_21") -SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_9.result()) +SketchConstraintTangent_6 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_9.result() +) SketchConstraintTangent_6.setName("SketchConstraintTangent_22") -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchLine_16.startPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchLine_16.startPoint(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_124") -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_9.endPoint()) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_9.endPoint() +) SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_125") -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_16.result()) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_16.result() +) SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_126") -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchLine_17.result()) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchLine_9.startPoint(), SketchLine_17.result() +) SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_127") SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_3.results()[1], "BaseLegFillet") SketchConstraintRadius_3.setName("SketchConstraintRadius_17") -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchLine_24.startPoint(), SketchLine_23.endPoint()) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchLine_24.startPoint(), SketchLine_23.endPoint() +) SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_128") -SketchArc_4 = Sketch_1.addArc(-27.44713036950059, 9, -27.44713039880284, 6, -24.49270712488033, 8.479055385239919, False) +SketchArc_4 = Sketch_1.addArc( + -27.44713036950059, + 9, + -27.44713039880284, + 6, + -24.49270712488033, + 8.479055385239919, + False, +) SketchArc_4.setName("SketchArc_13") SketchArc_4.result().setName("SketchArc_13") SketchArc_4.results()[1].setName("SketchArc_13_2") -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchArc_4.startPoint(), SketchLine_11.startPoint() +) SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_129") -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_10.endPoint() +) SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_130") -SketchConstraintTangent_7 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_10.result()) +SketchConstraintTangent_7 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchLine_10.result() +) SketchConstraintTangent_7.setName("SketchConstraintTangent_23") -SketchConstraintTangent_8 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_11.result()) +SketchConstraintTangent_8 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchLine_11.result() +) SketchConstraintTangent_8.setName("SketchConstraintTangent_24") -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_23.startPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchLine_23.startPoint(), SketchLine_10.startPoint() +) SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_131") -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchLine_11.endPoint()) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchLine_24.endPoint(), SketchLine_11.endPoint() +) SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_132") -SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_23.result()) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_23.result() +) SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_133") -SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_24.result()) +SketchConstraintCoincidence_42 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_24.result() +) SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_134") SketchConstraintRadius_4 = Sketch_1.setRadius(SketchArc_4.results()[1], "BaseLegFillet") SketchConstraintRadius_4.setName("SketchConstraintRadius_18") -SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchLine_21.startPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_43 = Sketch_1.setCoincident( + SketchLine_21.startPoint(), SketchLine_12.startPoint() +) SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_135") -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchArc_4.endPoint(), SketchLine_18.result(), "LegThick") +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchArc_4.endPoint(), SketchLine_18.result(), "LegThick" +) SketchConstraintDistance_10.setName("SketchConstraintDistance_34") model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) @@ -287,21 +457,29 @@ SketchLine_29 = Sketch_2.addLine(20, 40, 20, -5) SketchLine_29.setName("SketchLine_21") SketchLine_29.result().setName("SketchLine_21") SketchLine_29.setAuxiliary(True) -SketchConstraintCoincidence_44 = Sketch_2.setCoincident(SketchLine_29.endPoint(), SketchLine_26.startPoint()) +SketchConstraintCoincidence_44 = Sketch_2.setCoincident( + SketchLine_29.endPoint(), SketchLine_26.startPoint() +) SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_14") SketchLine_30 = Sketch_2.addLine(-20, -5, -20, 40) SketchLine_30.setName("SketchLine_19") SketchLine_30.result().setName("SketchLine_19") SketchLine_30.setAuxiliary(True) -SketchConstraintCoincidence_45 = Sketch_2.setCoincident(SketchLine_26.endPoint(), SketchLine_30.startPoint()) +SketchConstraintCoincidence_45 = Sketch_2.setCoincident( + SketchLine_26.endPoint(), SketchLine_30.startPoint() +) SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_15") SketchLine_31 = Sketch_2.addLine(-20, 40, 20, 40) SketchLine_31.setName("SketchLine_20") SketchLine_31.result().setName("SketchLine_20") SketchLine_31.setAuxiliary(True) -SketchConstraintCoincidence_46 = Sketch_2.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_46 = Sketch_2.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_16") -SketchConstraintCoincidence_47 = Sketch_2.setCoincident(SketchLine_31.endPoint(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_47 = Sketch_2.setCoincident( + SketchLine_31.endPoint(), SketchLine_29.startPoint() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_17") SketchConstraintHorizontal_8 = Sketch_2.setHorizontal(SketchLine_26.result()) SketchConstraintHorizontal_8.setName("SketchConstraintHorizontal_4") @@ -314,18 +492,28 @@ SketchConstraintVertical_4.setName("SketchConstraintVertical_3") SketchLine_32 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_32.setName("SketchLine_22") SketchLine_32.result().setName("SketchLine_22") -SketchConstraintDistance_11 = Sketch_2.setDistance(SketchLine_26.startPoint(), SketchLine_32.result(), "(TL/2-3)-20") +SketchConstraintDistance_11 = Sketch_2.setDistance( + SketchLine_26.startPoint(), SketchLine_32.result(), "(TL/2-3)-20" +) SketchConstraintDistance_11.setName("SketchConstraintDistance_5") -SketchConstraintDistance_12 = Sketch_2.setDistance(SketchLine_26.endPoint(), SketchLine_32.result(), "(TL/2-3)-20") +SketchConstraintDistance_12 = Sketch_2.setDistance( + SketchLine_26.endPoint(), SketchLine_32.result(), "(TL/2-3)-20" +) SketchConstraintDistance_12.setName("SketchConstraintDistance_6") SketchLine_33 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_33.setName("SketchLine_23") SketchLine_33.result().setName("SketchLine_23") -SketchConstraintDistance_13 = Sketch_2.setDistance(SketchLine_29.startPoint(), SketchLine_33.result(), 40) +SketchConstraintDistance_13 = Sketch_2.setDistance( + SketchLine_29.startPoint(), SketchLine_33.result(), 40 +) SketchConstraintDistance_13.setName("SketchConstraintDistance_7") -SketchConstraintDistance_14 = Sketch_2.setDistance(SketchLine_26.startPoint(), SketchLine_33.result(), 5) +SketchConstraintDistance_14 = Sketch_2.setDistance( + SketchLine_26.startPoint(), SketchLine_33.result(), 5 +) SketchConstraintDistance_14.setName("SketchConstraintDistance_8") -SketchArc_5 = Sketch_2.addArc(-18, 37.99999999999999, -18.00000018312083, 40, -20, 37.99999996287101, False) +SketchArc_5 = Sketch_2.addArc( + -18, 37.99999999999999, -18.00000018312083, 40, -20, 37.99999996287101, False +) SketchArc_5.setName("SketchArc_10") SketchArc_5.result().setName("SketchArc_10") SketchArc_5.results()[1].setName("SketchArc_10_2") @@ -333,45 +521,83 @@ SketchLine_34 = Sketch_2.addLine(-18.00000018312083, 40, 20, 40) SketchLine_34.setName("SketchLine_74") SketchLine_34.result().setName("SketchLine_74") SketchLine_34.setAuxiliary(True) -SketchConstraintCoincidence_48 = Sketch_2.setCoincident(SketchArc_5.startPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_48 = Sketch_2.setCoincident( + SketchArc_5.startPoint(), SketchLine_34.startPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_101") -SketchConstraintCoincidence_49 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_25.endPoint()) +SketchConstraintCoincidence_49 = Sketch_2.setCoincident( + SketchArc_5.endPoint(), SketchLine_25.endPoint() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_102") -SketchConstraintTangent_9 = Sketch_2.setTangent(SketchArc_5.results()[1], SketchLine_25.result()) +SketchConstraintTangent_9 = Sketch_2.setTangent( + SketchArc_5.results()[1], SketchLine_25.result() +) SketchConstraintTangent_9.setName("SketchConstraintTangent_15") -SketchConstraintTangent_10 = Sketch_2.setTangent(SketchArc_5.results()[1], SketchLine_34.result()) +SketchConstraintTangent_10 = Sketch_2.setTangent( + SketchArc_5.results()[1], SketchLine_34.result() +) SketchConstraintTangent_10.setName("SketchConstraintTangent_16") -SketchConstraintCoincidence_50 = Sketch_2.setCoincident(SketchLine_30.startPoint(), SketchLine_25.startPoint()) +SketchConstraintCoincidence_50 = Sketch_2.setCoincident( + SketchLine_30.startPoint(), SketchLine_25.startPoint() +) SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_103") -SketchConstraintCoincidence_51 = Sketch_2.setCoincident(SketchLine_31.endPoint(), SketchLine_34.endPoint()) +SketchConstraintCoincidence_51 = Sketch_2.setCoincident( + SketchLine_31.endPoint(), SketchLine_34.endPoint() +) SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_104") -SketchConstraintCoincidence_52 = Sketch_2.setCoincident(SketchLine_25.endPoint(), SketchLine_30.result()) +SketchConstraintCoincidence_52 = Sketch_2.setCoincident( + SketchLine_25.endPoint(), SketchLine_30.result() +) SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_105") -SketchConstraintCoincidence_53 = Sketch_2.setCoincident(SketchLine_34.startPoint(), SketchLine_31.result()) +SketchConstraintCoincidence_53 = Sketch_2.setCoincident( + SketchLine_34.startPoint(), SketchLine_31.result() +) SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_106") -SketchConstraintRadius_5 = Sketch_2.setRadius(SketchArc_5.results()[1], "BottomCutFillet") +SketchConstraintRadius_5 = Sketch_2.setRadius( + SketchArc_5.results()[1], "BottomCutFillet" +) SketchConstraintRadius_5.setName("SketchConstraintRadius_12") -SketchArc_6 = Sketch_2.addArc(18, 38.00000000000001, 20, 38.00000240162298, 18.00001539129446, 40, False) +SketchArc_6 = Sketch_2.addArc( + 18, 38.00000000000001, 20, 38.00000240162298, 18.00001539129446, 40, False +) SketchArc_6.setName("SketchArc_11") SketchArc_6.result().setName("SketchArc_11") SketchArc_6.results()[1].setName("SketchArc_11_2") -SketchConstraintCoincidence_54 = Sketch_2.setCoincident(SketchArc_6.startPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_54 = Sketch_2.setCoincident( + SketchArc_6.startPoint(), SketchLine_28.startPoint() +) SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_107") -SketchConstraintCoincidence_55 = Sketch_2.setCoincident(SketchArc_6.endPoint(), SketchLine_27.endPoint()) +SketchConstraintCoincidence_55 = Sketch_2.setCoincident( + SketchArc_6.endPoint(), SketchLine_27.endPoint() +) SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_108") -SketchConstraintTangent_11 = Sketch_2.setTangent(SketchArc_6.results()[1], SketchLine_28.result()) +SketchConstraintTangent_11 = Sketch_2.setTangent( + SketchArc_6.results()[1], SketchLine_28.result() +) SketchConstraintTangent_11.setName("SketchConstraintTangent_17") -SketchConstraintTangent_12 = Sketch_2.setTangent(SketchArc_6.results()[1], SketchLine_27.result()) +SketchConstraintTangent_12 = Sketch_2.setTangent( + SketchArc_6.results()[1], SketchLine_27.result() +) SketchConstraintTangent_12.setName("SketchConstraintTangent_18") -SketchConstraintCoincidence_56 = Sketch_2.setCoincident(SketchLine_29.endPoint(), SketchLine_28.endPoint()) +SketchConstraintCoincidence_56 = Sketch_2.setCoincident( + SketchLine_29.endPoint(), SketchLine_28.endPoint() +) SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_109") -SketchConstraintCoincidence_57 = Sketch_2.setCoincident(SketchLine_34.startPoint(), SketchLine_27.startPoint()) +SketchConstraintCoincidence_57 = Sketch_2.setCoincident( + SketchLine_34.startPoint(), SketchLine_27.startPoint() +) SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_110") -SketchConstraintCoincidence_58 = Sketch_2.setCoincident(SketchLine_28.startPoint(), SketchLine_29.result()) +SketchConstraintCoincidence_58 = Sketch_2.setCoincident( + SketchLine_28.startPoint(), SketchLine_29.result() +) SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_111") -SketchConstraintCoincidence_59 = Sketch_2.setCoincident(SketchLine_27.endPoint(), SketchLine_34.result()) +SketchConstraintCoincidence_59 = Sketch_2.setCoincident( + SketchLine_27.endPoint(), SketchLine_34.result() +) SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_112") -SketchConstraintRadius_6 = Sketch_2.setRadius(SketchArc_6.results()[1], "BottomCutFillet") +SketchConstraintRadius_6 = Sketch_2.setRadius( + SketchArc_6.results()[1], "BottomCutFillet" +) SketchConstraintRadius_6.setName("SketchConstraintRadius_13") model.do() Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) @@ -382,85 +608,148 @@ SketchCircle_2 = Sketch_3.addCircle(0, 55, 11) SketchLine_35 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_35.setName("SketchLine_24") SketchLine_35.result().setName("SketchLine_24") -SketchConstraintCoincidence_60 = Sketch_3.setCoincident(SketchCircle_2.center(), SketchLine_35.result()) +SketchConstraintCoincidence_60 = Sketch_3.setCoincident( + SketchCircle_2.center(), SketchLine_35.result() +) SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_18") SketchConstraintRadius_8 = Sketch_3.setRadius(SketchCircle_2.results()[1], "TDE/2") SketchConstraintRadius_8.setName("SketchConstraintRadius_2") -SketchConstraintDistance_15 = Sketch_3.setDistance(SketchCircle_2.center(), SketchCircle_1.center(), 30) +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/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) +SketchConstraintDistance_16 = Sketch_3.setDistance( + SketchCircle_1.center(), SketchLine_36.result(), 85 +) SketchConstraintDistance_16.setName("SketchConstraintDistance_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/SketchCircle_1_2__cc")) -SketchConstraintCoincidence_61 = Sketch_4.setCoincident(SketchPoint_1.coordinates(), SketchCircle_3.center()) +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/SketchCircle_2_2__cc")) -SketchConstraintCoincidence_62 = Sketch_4.setCoincident(SketchPoint_2.coordinates(), SketchCircle_4.center()) +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") SketchConstraintRadius_9.setName("SketchConstraintRadius_3") SketchConstraintRadius_10 = Sketch_4.setRadius(SketchCircle_4.results()[1], "TDI/2") SketchConstraintRadius_10.setName("SketchConstraintRadius_4") model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "TL/2-3", "TL/2-3") -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 100, 100, [model.selection("SOLID", "Extrusion_1_1")]) -ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), "TL/2", "TL/2", [model.selection("SOLID", "ExtrusionCut_1_1")]) -ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), 60, 60, [model.selection("SOLID", "ExtrusionFuse_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + "TL/2-3", + "TL/2-3", +) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_2")], + model.selection(), + 100, + 100, + [model.selection("SOLID", "Extrusion_1_1")], +) +ExtrusionFuse_1 = model.addExtrusionFuse( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_3")], + model.selection(), + "TL/2", + "TL/2", + [model.selection("SOLID", "ExtrusionCut_1_1")], +) +ExtrusionCut_2 = model.addExtrusionCut( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_4")], + model.selection(), + 60, + 60, + [model.selection("SOLID", "ExtrusionFuse_1_1")], +) Sketch_5 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_5 = Sketch_5.addCircle(30, -41, 7.5) SketchLine_37 = Sketch_5.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_37.setName("SketchLine_26") SketchLine_37.result().setName("SketchLine_26") -SketchConstraintDistance_17 = Sketch_5.setDistance(SketchCircle_5.center(), SketchLine_37.result(), 41) +SketchConstraintDistance_17 = Sketch_5.setDistance( + SketchCircle_5.center(), SketchLine_37.result(), 41 +) SketchConstraintDistance_17.setName("SketchConstraintDistance_13") SketchLine_38 = Sketch_5.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_38.setName("SketchLine_27") SketchLine_38.result().setName("SketchLine_27") -SketchConstraintDistance_18 = Sketch_5.setDistance(SketchCircle_5.center(), SketchLine_38.result(), 30) +SketchConstraintDistance_18 = Sketch_5.setDistance( + SketchCircle_5.center(), SketchLine_38.result(), 30 +) SketchConstraintDistance_18.setName("SketchConstraintDistance_14") SketchConstraintRadius_11 = Sketch_5.setRadius(SketchCircle_5.results()[1], 7.5) SketchConstraintRadius_11.setName("SketchConstraintRadius_5") -SketchConstraintMirror_1 = Sketch_5.addMirror(SketchLine_37.result(), [SketchCircle_5.results()[1]]) +SketchConstraintMirror_1 = Sketch_5.addMirror( + SketchLine_37.result(), [SketchCircle_5.results()[1]] +) SketchConstraintMirror_1.setName("SketchConstraintMirror_2") [SketchCircle_6] = SketchConstraintMirror_1.mirrored() -SketchConstraintMirror_2 = Sketch_5.addMirror(SketchLine_38.result(), [SketchCircle_5.results()[1], SketchCircle_6.results()[1]]) +SketchConstraintMirror_2 = Sketch_5.addMirror( + SketchLine_38.result(), [SketchCircle_5.results()[1], SketchCircle_6.results()[1]] +) SketchConstraintMirror_2.setName("SketchConstraintMirror_3") [SketchCircle_7, SketchCircle_8] = SketchConstraintMirror_2.mirrored() 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/SketchCircle_5_2__cc")) -SketchConstraintCoincidence_63 = Sketch_6.setCoincident(SketchPoint_3.coordinates(), SketchCircle_9.center()) +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") SketchConstraintRadius_12.setName("SketchConstraintRadius_6") SketchLine_39 = Sketch_6.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_39.setName("SketchLine_28") SketchLine_39.result().setName("SketchLine_28") -SketchConstraintMirror_3 = Sketch_6.addMirror(SketchLine_39.result(), [SketchCircle_9.results()[1]]) +SketchConstraintMirror_3 = Sketch_6.addMirror( + SketchLine_39.result(), [SketchCircle_9.results()[1]] +) SketchConstraintMirror_3.setName("SketchConstraintMirror_4") [SketchCircle_10] = SketchConstraintMirror_3.mirrored() SketchLine_40 = Sketch_6.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_40.setName("SketchLine_29") SketchLine_40.result().setName("SketchLine_29") -SketchConstraintMirror_4 = Sketch_6.addMirror(SketchLine_40.result(), [SketchCircle_9.results()[1], SketchCircle_10.results()[1]]) +SketchConstraintMirror_4 = Sketch_6.addMirror( + SketchLine_40.result(), [SketchCircle_9.results()[1], SketchCircle_10.results()[1]] +) SketchConstraintMirror_4.setName("SketchConstraintMirror_5") [SketchCircle_11, SketchCircle_12] = SketchConstraintMirror_4.mirrored() 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/SketchCircle_5_2__cc")) -SketchConstraintCoincidence_64 = Sketch_7.setCoincident(SketchLine_41.startPoint(), SketchPoint_4.result()) +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) -SketchConstraintCoincidence_65 = Sketch_7.setCoincident(SketchLine_41.endPoint(), SketchLine_42.startPoint()) +SketchConstraintCoincidence_65 = Sketch_7.setCoincident( + SketchLine_41.endPoint(), SketchLine_42.startPoint() +) SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_35") SketchLine_43 = Sketch_7.addLine(-34, 8, -34, 7.499984403541713) SketchLine_43.setName("SketchLine_47") @@ -472,27 +761,39 @@ SketchLine_45 = Sketch_7.addLine(-34, 8, -34, 6) SketchLine_45.setName("SketchLine_43") SketchLine_45.result().setName("SketchLine_43") SketchLine_45.setAuxiliary(True) -SketchConstraintCoincidence_66 = Sketch_7.setCoincident(SketchLine_42.endPoint(), SketchLine_45.startPoint()) +SketchConstraintCoincidence_66 = Sketch_7.setCoincident( + SketchLine_42.endPoint(), SketchLine_45.startPoint() +) SketchConstraintCoincidence_66.setName("SketchConstraintCoincidence_36") SketchLine_46 = Sketch_7.addLine(-34, 6, -32, 6) SketchLine_46.setName("SketchLine_44") SketchLine_46.result().setName("SketchLine_44") SketchLine_46.setAuxiliary(True) -SketchConstraintCoincidence_67 = Sketch_7.setCoincident(SketchLine_45.endPoint(), SketchLine_46.startPoint()) +SketchConstraintCoincidence_67 = Sketch_7.setCoincident( + SketchLine_45.endPoint(), SketchLine_46.startPoint() +) SketchConstraintCoincidence_67.setName("SketchConstraintCoincidence_37") SketchLine_47 = Sketch_7.addLine(-32, 6, -32, 0) SketchLine_47.setName("SketchLine_45") SketchLine_47.result().setName("SketchLine_45") -SketchConstraintCoincidence_68 = Sketch_7.setCoincident(SketchLine_46.endPoint(), SketchLine_47.startPoint()) +SketchConstraintCoincidence_68 = Sketch_7.setCoincident( + SketchLine_46.endPoint(), SketchLine_47.startPoint() +) SketchConstraintCoincidence_68.setName("SketchConstraintCoincidence_38") SketchLine_48 = Sketch_7.addLine(-32, 0, -41, 0) SketchLine_48.setName("SketchLine_46") SketchLine_48.result().setName("SketchLine_46") -SketchConstraintCoincidence_69 = Sketch_7.setCoincident(SketchLine_47.endPoint(), SketchLine_48.startPoint()) +SketchConstraintCoincidence_69 = Sketch_7.setCoincident( + SketchLine_47.endPoint(), SketchLine_48.startPoint() +) SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_39") -SketchConstraintCoincidence_70 = Sketch_7.setCoincident(SketchLine_41.startPoint(), SketchLine_48.endPoint()) +SketchConstraintCoincidence_70 = Sketch_7.setCoincident( + SketchLine_41.startPoint(), SketchLine_48.endPoint() +) SketchConstraintCoincidence_70.setName("SketchConstraintCoincidence_40") -SketchConstraintCoincidence_71 = Sketch_7.setCoincident(SketchPoint_4.coordinates(), SketchLine_48.endPoint()) +SketchConstraintCoincidence_71 = Sketch_7.setCoincident( + SketchPoint_4.coordinates(), SketchLine_48.endPoint() +) SketchConstraintCoincidence_71.setName("SketchConstraintCoincidence_41") SketchConstraintHorizontal_10 = Sketch_7.setHorizontal(SketchLine_48.result()) SketchConstraintHorizontal_10.setName("SketchConstraintHorizontal_6") @@ -506,38 +807,77 @@ SketchConstraintVertical_7 = Sketch_7.setVertical(SketchLine_45.result()) SketchConstraintVertical_7.setName("SketchConstraintVertical_6") SketchConstraintHorizontal_12 = Sketch_7.setHorizontal(SketchLine_42.result()) SketchConstraintHorizontal_12.setName("SketchConstraintHorizontal_8") -SketchConstraintDistance_19 = Sketch_7.setDistance(SketchLine_41.endPoint(), SketchLine_48.result(), "BPS+BHPS") +SketchConstraintDistance_19 = Sketch_7.setDistance( + SketchLine_41.endPoint(), SketchLine_48.result(), "BPS+BHPS" +) SketchConstraintDistance_19.setName("SketchConstraintDistance_15") -SketchConstraintDistance_20 = Sketch_7.setDistance(SketchLine_47.startPoint(), SketchLine_48.result(), "BPS") +SketchConstraintDistance_20 = Sketch_7.setDistance( + SketchLine_47.startPoint(), SketchLine_48.result(), "BPS" +) SketchConstraintDistance_20.setName("SketchConstraintDistance_16") -SketchConstraintDistance_21 = Sketch_7.setDistance(SketchLine_48.startPoint(), SketchLine_41.result(), "BHPD/2+BHPFR+0.5") +SketchConstraintDistance_21 = Sketch_7.setDistance( + SketchLine_48.startPoint(), SketchLine_41.result(), "BHPD/2+BHPFR+0.5" +) SketchConstraintDistance_21.setName("SketchConstraintDistance_17") -SketchConstraintDistance_22 = Sketch_7.setDistance(SketchLine_42.endPoint(), SketchLine_41.result(), "BHPD/2") +SketchConstraintDistance_22 = Sketch_7.setDistance( + SketchLine_42.endPoint(), SketchLine_41.result(), "BHPD/2" +) SketchConstraintDistance_22.setName("SketchConstraintDistance_18") -SketchArc_7 = Sketch_7.addArc(-32.50000000000004, 7.499999999999999, -34, 7.499984403541713, -32.50001348840178, 5.999999999999995, False) +SketchArc_7 = Sketch_7.addArc( + -32.50000000000004, + 7.499999999999999, + -34, + 7.499984403541713, + -32.50001348840178, + 5.999999999999995, + False, +) SketchArc_7.setName("SketchArc_5") SketchArc_7.result().setName("SketchArc_5") SketchArc_7.results()[1].setName("SketchArc_5_2") -SketchConstraintCoincidence_72 = Sketch_7.setCoincident(SketchArc_7.startPoint(), SketchLine_43.endPoint()) +SketchConstraintCoincidence_72 = Sketch_7.setCoincident( + SketchArc_7.startPoint(), SketchLine_43.endPoint() +) SketchConstraintCoincidence_72.setName("SketchConstraintCoincidence_42") -SketchConstraintCoincidence_73 = Sketch_7.setCoincident(SketchArc_7.endPoint(), SketchLine_44.startPoint()) +SketchConstraintCoincidence_73 = Sketch_7.setCoincident( + SketchArc_7.endPoint(), SketchLine_44.startPoint() +) SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_43") -SketchConstraintTangent_13 = Sketch_7.setTangent(SketchArc_7.results()[1], SketchLine_43.result()) +SketchConstraintTangent_13 = Sketch_7.setTangent( + SketchArc_7.results()[1], SketchLine_43.result() +) SketchConstraintTangent_13.setName("SketchConstraintTangent_5") -SketchConstraintTangent_14 = Sketch_7.setTangent(SketchArc_7.results()[1], SketchLine_44.result()) +SketchConstraintTangent_14 = Sketch_7.setTangent( + SketchArc_7.results()[1], SketchLine_44.result() +) SketchConstraintTangent_14.setName("SketchConstraintTangent_6") -SketchConstraintCoincidence_74 = Sketch_7.setCoincident(SketchLine_45.startPoint(), SketchLine_43.startPoint()) +SketchConstraintCoincidence_74 = Sketch_7.setCoincident( + SketchLine_45.startPoint(), SketchLine_43.startPoint() +) SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_44") -SketchConstraintCoincidence_75 = Sketch_7.setCoincident(SketchLine_46.endPoint(), SketchLine_44.endPoint()) +SketchConstraintCoincidence_75 = Sketch_7.setCoincident( + SketchLine_46.endPoint(), SketchLine_44.endPoint() +) SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_45") -SketchConstraintCoincidence_76 = Sketch_7.setCoincident(SketchLine_43.endPoint(), SketchLine_45.result()) +SketchConstraintCoincidence_76 = Sketch_7.setCoincident( + SketchLine_43.endPoint(), SketchLine_45.result() +) SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_46") -SketchConstraintCoincidence_77 = Sketch_7.setCoincident(SketchLine_44.startPoint(), SketchLine_46.result()) +SketchConstraintCoincidence_77 = Sketch_7.setCoincident( + SketchLine_44.startPoint(), SketchLine_46.result() +) 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/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") @@ -545,8 +885,12 @@ 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/SketchCircle_10_2__cc")) -SketchConstraintCoincidence_78 = Sketch_8.setCoincident(SketchLine_50.endPoint(), SketchPoint_5.result()) +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) SketchLine_51.setName("SketchLine_50") @@ -557,14 +901,20 @@ SketchLine_52.result().setName("SketchLine_56") SketchLine_53 = Sketch_8.addLine(32, 6, 32, 0) SketchLine_53.setName("SketchLine_52") SketchLine_53.result().setName("SketchLine_52") -SketchConstraintCoincidence_79 = Sketch_8.setCoincident(SketchLine_53.endPoint(), SketchLine_50.startPoint()) +SketchConstraintCoincidence_79 = Sketch_8.setCoincident( + SketchLine_53.endPoint(), SketchLine_50.startPoint() +) SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_51") -SketchConstraintCoincidence_80 = Sketch_8.setCoincident(SketchLine_50.endPoint(), SketchLine_51.startPoint()) +SketchConstraintCoincidence_80 = Sketch_8.setCoincident( + SketchLine_50.endPoint(), SketchLine_51.startPoint() +) SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_52") SketchLine_54 = Sketch_8.addLine(41, 8, 34, 8) SketchLine_54.setName("SketchLine_53") SketchLine_54.result().setName("SketchLine_53") -SketchConstraintCoincidence_81 = Sketch_8.setCoincident(SketchLine_51.endPoint(), SketchLine_54.startPoint()) +SketchConstraintCoincidence_81 = Sketch_8.setCoincident( + SketchLine_51.endPoint(), SketchLine_54.startPoint() +) SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_53") SketchConstraintHorizontal_13 = Sketch_8.setHorizontal(SketchLine_50.result()) SketchConstraintHorizontal_13.setName("SketchConstraintHorizontal_9") @@ -573,67 +923,125 @@ SketchConstraintVertical_8.setName("SketchConstraintVertical_7") SketchConstraintVertical_9 = Sketch_8.setVertical(SketchLine_53.result()) SketchConstraintVertical_9.setName("SketchConstraintVertical_8") SketchPoint_6 = Sketch_8.addPoint(32, 6) -SketchConstraintCoincidence_82 = Sketch_8.setCoincident(SketchPoint_6.coordinates(), SketchLine_53.startPoint()) +SketchConstraintCoincidence_82 = Sketch_8.setCoincident( + SketchPoint_6.coordinates(), SketchLine_53.startPoint() +) SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_55") SketchPoint_7 = Sketch_8.addPoint(34, 8) -SketchConstraintCoincidence_83 = Sketch_8.setCoincident(SketchLine_54.endPoint(), SketchPoint_7.coordinates()) +SketchConstraintCoincidence_83 = Sketch_8.setCoincident( + SketchLine_54.endPoint(), SketchPoint_7.coordinates() +) SketchConstraintCoincidence_83.setName("SketchConstraintCoincidence_58") SketchLine_55 = Sketch_8.addLine(32, 6, 34, 6) SketchLine_55.setName("SketchLine_51") SketchLine_55.result().setName("SketchLine_51") SketchLine_55.setAuxiliary(True) -SketchConstraintCoincidence_84 = Sketch_8.setCoincident(SketchLine_53.startPoint(), SketchLine_55.startPoint()) +SketchConstraintCoincidence_84 = Sketch_8.setCoincident( + SketchLine_53.startPoint(), SketchLine_55.startPoint() +) SketchConstraintCoincidence_84.setName("SketchConstraintCoincidence_54") -SketchConstraintCoincidence_85 = Sketch_8.setCoincident(SketchPoint_6.coordinates(), SketchLine_55.startPoint()) +SketchConstraintCoincidence_85 = Sketch_8.setCoincident( + SketchPoint_6.coordinates(), SketchLine_55.startPoint() +) SketchConstraintCoincidence_85.setName("SketchConstraintCoincidence_56") SketchLine_56 = Sketch_8.addLine(34, 6, 34, 8) SketchLine_56.setName("SketchLine_54") SketchLine_56.result().setName("SketchLine_54") SketchLine_56.setAuxiliary(True) -SketchConstraintCoincidence_86 = Sketch_8.setCoincident(SketchLine_55.endPoint(), SketchLine_56.startPoint()) +SketchConstraintCoincidence_86 = Sketch_8.setCoincident( + SketchLine_55.endPoint(), SketchLine_56.startPoint() +) SketchConstraintCoincidence_86.setName("SketchConstraintCoincidence_57") -SketchConstraintCoincidence_87 = Sketch_8.setCoincident(SketchPoint_7.coordinates(), SketchLine_56.endPoint()) +SketchConstraintCoincidence_87 = Sketch_8.setCoincident( + SketchPoint_7.coordinates(), SketchLine_56.endPoint() +) SketchConstraintCoincidence_87.setName("SketchConstraintCoincidence_59") -SketchConstraintCoincidence_88 = Sketch_8.setCoincident(SketchLine_54.endPoint(), SketchLine_56.endPoint()) +SketchConstraintCoincidence_88 = Sketch_8.setCoincident( + SketchLine_54.endPoint(), SketchLine_56.endPoint() +) SketchConstraintCoincidence_88.setName("SketchConstraintCoincidence_60") SketchConstraintHorizontal_14 = Sketch_8.setHorizontal(SketchLine_55.result()) SketchConstraintHorizontal_14.setName("SketchConstraintHorizontal_10") SketchConstraintVertical_10 = Sketch_8.setVertical(SketchLine_56.result()) SketchConstraintVertical_10.setName("SketchConstraintVertical_9") -SketchConstraintDistance_23 = Sketch_8.setDistance(SketchPoint_7.coordinates(), SketchLine_50.result(), 8) +SketchConstraintDistance_23 = Sketch_8.setDistance( + SketchPoint_7.coordinates(), SketchLine_50.result(), 8 +) SketchConstraintDistance_23.setName("SketchConstraintDistance_19") SketchConstraintHorizontal_15 = Sketch_8.setHorizontal(SketchLine_54.result()) SketchConstraintHorizontal_15.setName("SketchConstraintHorizontal_11") -SketchConstraintDistance_24 = Sketch_8.setDistance(SketchLine_53.startPoint(), SketchLine_51.result(), 9) +SketchConstraintDistance_24 = Sketch_8.setDistance( + SketchLine_53.startPoint(), SketchLine_51.result(), 9 +) SketchConstraintDistance_24.setName("SketchConstraintDistance_20") -SketchConstraintDistance_25 = Sketch_8.setDistance(SketchPoint_7.coordinates(), SketchLine_51.result(), 7) +SketchConstraintDistance_25 = Sketch_8.setDistance( + SketchPoint_7.coordinates(), SketchLine_51.result(), 7 +) SketchConstraintDistance_25.setName("SketchConstraintDistance_21") -SketchConstraintDistance_26 = Sketch_8.setDistance(SketchLine_53.startPoint(), SketchLine_50.result(), 6) +SketchConstraintDistance_26 = Sketch_8.setDistance( + SketchLine_53.startPoint(), SketchLine_50.result(), 6 +) SketchConstraintDistance_26.setName("SketchConstraintDistance_22") -SketchArc_8 = Sketch_8.addArc(32.50000000000001, 7.500000000000025, 32.50001476412091, 6.000000000000001, 34, 7.499985233923545, False) +SketchArc_8 = Sketch_8.addArc( + 32.50000000000001, + 7.500000000000025, + 32.50001476412091, + 6.000000000000001, + 34, + 7.499985233923545, + False, +) SketchArc_8.setName("SketchArc_7") SketchArc_8.result().setName("SketchArc_7") SketchArc_8.results()[1].setName("SketchArc_7_2") -SketchConstraintCoincidence_89 = Sketch_8.setCoincident(SketchArc_8.startPoint(), SketchLine_49.endPoint()) +SketchConstraintCoincidence_89 = Sketch_8.setCoincident( + SketchArc_8.startPoint(), SketchLine_49.endPoint() +) SketchConstraintCoincidence_89.setName("SketchConstraintCoincidence_61") -SketchConstraintCoincidence_90 = Sketch_8.setCoincident(SketchArc_8.endPoint(), SketchLine_52.startPoint()) +SketchConstraintCoincidence_90 = Sketch_8.setCoincident( + SketchArc_8.endPoint(), SketchLine_52.startPoint() +) SketchConstraintCoincidence_90.setName("SketchConstraintCoincidence_62") -SketchConstraintTangent_15 = Sketch_8.setTangent(SketchArc_8.results()[1], SketchLine_49.result()) +SketchConstraintTangent_15 = Sketch_8.setTangent( + SketchArc_8.results()[1], SketchLine_49.result() +) SketchConstraintTangent_15.setName("SketchConstraintTangent_9") -SketchConstraintTangent_16 = Sketch_8.setTangent(SketchArc_8.results()[1], SketchLine_52.result()) +SketchConstraintTangent_16 = Sketch_8.setTangent( + SketchArc_8.results()[1], SketchLine_52.result() +) SketchConstraintTangent_16.setName("SketchConstraintTangent_10") -SketchConstraintCoincidence_91 = Sketch_8.setCoincident(SketchLine_55.startPoint(), SketchLine_49.startPoint()) +SketchConstraintCoincidence_91 = Sketch_8.setCoincident( + SketchLine_55.startPoint(), SketchLine_49.startPoint() +) SketchConstraintCoincidence_91.setName("SketchConstraintCoincidence_63") -SketchConstraintCoincidence_92 = Sketch_8.setCoincident(SketchLine_56.endPoint(), SketchLine_52.endPoint()) +SketchConstraintCoincidence_92 = Sketch_8.setCoincident( + SketchLine_56.endPoint(), SketchLine_52.endPoint() +) SketchConstraintCoincidence_92.setName("SketchConstraintCoincidence_64") -SketchConstraintCoincidence_93 = Sketch_8.setCoincident(SketchLine_49.endPoint(), SketchLine_55.result()) +SketchConstraintCoincidence_93 = Sketch_8.setCoincident( + SketchLine_49.endPoint(), SketchLine_55.result() +) SketchConstraintCoincidence_93.setName("SketchConstraintCoincidence_65") -SketchConstraintCoincidence_94 = Sketch_8.setCoincident(SketchLine_52.startPoint(), SketchLine_56.result()) +SketchConstraintCoincidence_94 = Sketch_8.setCoincident( + SketchLine_52.startPoint(), SketchLine_56.result() +) 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_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")]) +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) @@ -642,8 +1050,12 @@ 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/SketchCircle_11_2__cc")) -SketchConstraintCoincidence_95 = Sketch_9.setCoincident(SketchLine_58.endPoint(), SketchPoint_8.result()) +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) SketchLine_59.setName("SketchLine_58") @@ -654,11 +1066,17 @@ SketchLine_60.result().setName("SketchLine_59") SketchLine_61 = Sketch_9.addLine(-32, 6, -32, 0) SketchLine_61.setName("SketchLine_60") SketchLine_61.result().setName("SketchLine_60") -SketchConstraintCoincidence_96 = Sketch_9.setCoincident(SketchLine_61.endPoint(), SketchLine_58.startPoint()) +SketchConstraintCoincidence_96 = Sketch_9.setCoincident( + SketchLine_61.endPoint(), SketchLine_58.startPoint() +) SketchConstraintCoincidence_96.setName("SketchConstraintCoincidence_68") -SketchConstraintCoincidence_97 = Sketch_9.setCoincident(SketchLine_58.endPoint(), SketchLine_59.startPoint()) +SketchConstraintCoincidence_97 = Sketch_9.setCoincident( + SketchLine_58.endPoint(), SketchLine_59.startPoint() +) SketchConstraintCoincidence_97.setName("SketchConstraintCoincidence_69") -SketchConstraintCoincidence_98 = Sketch_9.setCoincident(SketchLine_59.endPoint(), SketchLine_60.startPoint()) +SketchConstraintCoincidence_98 = Sketch_9.setCoincident( + SketchLine_59.endPoint(), SketchLine_60.startPoint() +) SketchConstraintCoincidence_98.setName("SketchConstraintCoincidence_70") SketchLine_62 = Sketch_9.addLine(-34, 8, -33.99999999999999, 7.499985052178464) SketchLine_62.setName("SketchLine_64") @@ -672,88 +1090,148 @@ SketchConstraintHorizontal_17.setName("SketchConstraintHorizontal_13") SketchConstraintVertical_12 = Sketch_9.setVertical(SketchLine_61.result()) SketchConstraintVertical_12.setName("SketchConstraintVertical_11") SketchPoint_9 = Sketch_9.addPoint(-34, 8) -SketchConstraintCoincidence_99 = Sketch_9.setCoincident(SketchPoint_9.coordinates(), SketchLine_60.endPoint()) +SketchConstraintCoincidence_99 = Sketch_9.setCoincident( + SketchPoint_9.coordinates(), SketchLine_60.endPoint() +) SketchConstraintCoincidence_99.setName("SketchConstraintCoincidence_72") SketchPoint_10 = Sketch_9.addPoint(-32, 6) -SketchConstraintCoincidence_100 = Sketch_9.setCoincident(SketchPoint_10.coordinates(), SketchLine_61.startPoint()) +SketchConstraintCoincidence_100 = Sketch_9.setCoincident( + SketchPoint_10.coordinates(), SketchLine_61.startPoint() +) SketchConstraintCoincidence_100.setName("SketchConstraintCoincidence_73") SketchLine_63 = Sketch_9.addLine(-34, 8, -34, 6) SketchLine_63.setName("SketchLine_61") SketchLine_63.result().setName("SketchLine_61") SketchLine_63.setAuxiliary(True) -SketchConstraintCoincidence_101 = Sketch_9.setCoincident(SketchLine_60.endPoint(), SketchLine_63.startPoint()) +SketchConstraintCoincidence_101 = Sketch_9.setCoincident( + SketchLine_60.endPoint(), SketchLine_63.startPoint() +) SketchConstraintCoincidence_101.setName("SketchConstraintCoincidence_71") -SketchConstraintCoincidence_102 = Sketch_9.setCoincident(SketchPoint_9.coordinates(), SketchLine_63.startPoint()) +SketchConstraintCoincidence_102 = Sketch_9.setCoincident( + SketchPoint_9.coordinates(), SketchLine_63.startPoint() +) SketchConstraintCoincidence_102.setName("SketchConstraintCoincidence_74") SketchLine_64 = Sketch_9.addLine(-34, 6, -32, 6) SketchLine_64.setName("SketchLine_62") SketchLine_64.result().setName("SketchLine_62") SketchLine_64.setAuxiliary(True) -SketchConstraintCoincidence_103 = Sketch_9.setCoincident(SketchLine_63.endPoint(), SketchLine_64.startPoint()) +SketchConstraintCoincidence_103 = Sketch_9.setCoincident( + SketchLine_63.endPoint(), SketchLine_64.startPoint() +) SketchConstraintCoincidence_103.setName("SketchConstraintCoincidence_75") -SketchConstraintCoincidence_104 = Sketch_9.setCoincident(SketchLine_61.startPoint(), SketchLine_64.endPoint()) +SketchConstraintCoincidence_104 = Sketch_9.setCoincident( + SketchLine_61.startPoint(), SketchLine_64.endPoint() +) SketchConstraintCoincidence_104.setName("SketchConstraintCoincidence_76") -SketchConstraintCoincidence_105 = Sketch_9.setCoincident(SketchPoint_10.coordinates(), SketchLine_64.endPoint()) +SketchConstraintCoincidence_105 = Sketch_9.setCoincident( + SketchPoint_10.coordinates(), SketchLine_64.endPoint() +) SketchConstraintCoincidence_105.setName("SketchConstraintCoincidence_77") SketchConstraintHorizontal_18 = Sketch_9.setHorizontal(SketchLine_64.result()) SketchConstraintHorizontal_18.setName("SketchConstraintHorizontal_14") SketchConstraintVertical_13 = Sketch_9.setVertical(SketchLine_63.result()) SketchConstraintVertical_13.setName("SketchConstraintVertical_12") -SketchConstraintDistance_27 = Sketch_9.setDistance(SketchLine_61.startPoint(), SketchLine_58.result(), 6) +SketchConstraintDistance_27 = Sketch_9.setDistance( + SketchLine_61.startPoint(), SketchLine_58.result(), 6 +) SketchConstraintDistance_27.setName("SketchConstraintDistance_23") -SketchConstraintDistance_28 = Sketch_9.setDistance(SketchLine_60.endPoint(), SketchLine_58.result(), 8) +SketchConstraintDistance_28 = Sketch_9.setDistance( + SketchLine_60.endPoint(), SketchLine_58.result(), 8 +) SketchConstraintDistance_28.setName("SketchConstraintDistance_24") -SketchConstraintDistance_29 = Sketch_9.setDistance(SketchLine_60.endPoint(), SketchLine_59.result(), 7) +SketchConstraintDistance_29 = Sketch_9.setDistance( + SketchLine_60.endPoint(), SketchLine_59.result(), 7 +) SketchConstraintDistance_29.setName("SketchConstraintDistance_25") -SketchConstraintDistance_30 = Sketch_9.setDistance(SketchLine_61.startPoint(), SketchLine_63.result(), 2) +SketchConstraintDistance_30 = Sketch_9.setDistance( + SketchLine_61.startPoint(), SketchLine_63.result(), 2 +) SketchConstraintDistance_30.setName("SketchConstraintDistance_26") -SketchArc_9 = Sketch_9.addArc(-32.49999999999999, 7.499999999999997, -33.99999999999999, 7.499985052178464, -32.50001494742042, 5.999999999999998, False) +SketchArc_9 = Sketch_9.addArc( + -32.49999999999999, + 7.499999999999997, + -33.99999999999999, + 7.499985052178464, + -32.50001494742042, + 5.999999999999998, + False, +) SketchArc_9.setName("SketchArc_8") SketchArc_9.result().setName("SketchArc_8") SketchArc_9.results()[1].setName("SketchArc_8_2") -SketchConstraintCoincidence_106 = Sketch_9.setCoincident(SketchArc_9.startPoint(), SketchLine_62.endPoint()) +SketchConstraintCoincidence_106 = Sketch_9.setCoincident( + SketchArc_9.startPoint(), SketchLine_62.endPoint() +) SketchConstraintCoincidence_106.setName("SketchConstraintCoincidence_78") -SketchConstraintCoincidence_107 = Sketch_9.setCoincident(SketchArc_9.endPoint(), SketchLine_57.startPoint()) +SketchConstraintCoincidence_107 = Sketch_9.setCoincident( + SketchArc_9.endPoint(), SketchLine_57.startPoint() +) SketchConstraintCoincidence_107.setName("SketchConstraintCoincidence_79") -SketchConstraintTangent_17 = Sketch_9.setTangent(SketchArc_9.results()[1], SketchLine_57.result()) +SketchConstraintTangent_17 = Sketch_9.setTangent( + SketchArc_9.results()[1], SketchLine_57.result() +) SketchConstraintTangent_17.setName("SketchConstraintTangent_11") -SketchConstraintTangent_18 = Sketch_9.setTangent(SketchArc_9.results()[1], SketchLine_62.result()) +SketchConstraintTangent_18 = Sketch_9.setTangent( + SketchArc_9.results()[1], SketchLine_62.result() +) SketchConstraintTangent_18.setName("SketchConstraintTangent_12") -SketchConstraintCoincidence_108 = Sketch_9.setCoincident(SketchLine_64.endPoint(), SketchLine_57.endPoint()) +SketchConstraintCoincidence_108 = Sketch_9.setCoincident( + SketchLine_64.endPoint(), SketchLine_57.endPoint() +) SketchConstraintCoincidence_108.setName("SketchConstraintCoincidence_80") -SketchConstraintCoincidence_109 = Sketch_9.setCoincident(SketchLine_63.startPoint(), SketchLine_62.startPoint()) +SketchConstraintCoincidence_109 = Sketch_9.setCoincident( + SketchLine_63.startPoint(), SketchLine_62.startPoint() +) SketchConstraintCoincidence_109.setName("SketchConstraintCoincidence_81") -SketchConstraintCoincidence_110 = Sketch_9.setCoincident(SketchLine_57.startPoint(), SketchLine_64.result()) +SketchConstraintCoincidence_110 = Sketch_9.setCoincident( + SketchLine_57.startPoint(), SketchLine_64.result() +) SketchConstraintCoincidence_110.setName("SketchConstraintCoincidence_82") -SketchConstraintCoincidence_111 = Sketch_9.setCoincident(SketchLine_62.endPoint(), SketchLine_63.result()) +SketchConstraintCoincidence_111 = Sketch_9.setCoincident( + SketchLine_62.endPoint(), SketchLine_63.result() +) SketchConstraintCoincidence_111.setName("SketchConstraintCoincidence_83") SketchConstraintRadius_15 = Sketch_9.setRadius(SketchArc_9.results()[1], 1.5) SketchConstraintRadius_15.setName("SketchConstraintRadius_10") model.do() Sketch_10 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2")) -SketchLine_65 = Sketch_10.addLine(33.99999999999999, 7.999999999999999, 33.99999999999999, 7.499985050625134) +SketchLine_65 = Sketch_10.addLine( + 33.99999999999999, 7.999999999999999, 33.99999999999999, 7.499985050625134 +) SketchLine_65.setName("SketchLine_71") 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/SketchCircle_12_2__cc")) -SketchConstraintCoincidence_112 = Sketch_10.setCoincident(SketchLine_66.endPoint(), SketchPoint_11.result()) +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) SketchLine_67.setName("SketchLine_66") SketchLine_67.result().setName("SketchLine_66") -SketchLine_68 = Sketch_10.addLine(41, 7.999999999999999, 33.99999999999999, 7.999999999999999) +SketchLine_68 = Sketch_10.addLine( + 41, 7.999999999999999, 33.99999999999999, 7.999999999999999 +) SketchLine_68.setName("SketchLine_67") SketchLine_68.result().setName("SketchLine_67") SketchLine_69 = Sketch_10.addLine(32, 6, 32, 0) SketchLine_69.setName("SketchLine_68") SketchLine_69.result().setName("SketchLine_68") -SketchConstraintCoincidence_113 = Sketch_10.setCoincident(SketchLine_69.endPoint(), SketchLine_66.startPoint()) +SketchConstraintCoincidence_113 = Sketch_10.setCoincident( + SketchLine_69.endPoint(), SketchLine_66.startPoint() +) SketchConstraintCoincidence_113.setName("SketchConstraintCoincidence_85") -SketchConstraintCoincidence_114 = Sketch_10.setCoincident(SketchLine_66.endPoint(), SketchLine_67.startPoint()) +SketchConstraintCoincidence_114 = Sketch_10.setCoincident( + SketchLine_66.endPoint(), SketchLine_67.startPoint() +) SketchConstraintCoincidence_114.setName("SketchConstraintCoincidence_86") -SketchConstraintCoincidence_115 = Sketch_10.setCoincident(SketchLine_67.endPoint(), SketchLine_68.startPoint()) +SketchConstraintCoincidence_115 = Sketch_10.setCoincident( + SketchLine_67.endPoint(), SketchLine_68.startPoint() +) SketchConstraintCoincidence_115.setName("SketchConstraintCoincidence_87") SketchLine_70 = Sketch_10.addLine(32.50001494562209, 6.000000000000006, 32, 6) SketchLine_70.setName("SketchLine_72") @@ -767,67 +1245,139 @@ SketchConstraintHorizontal_20.setName("SketchConstraintHorizontal_16") SketchConstraintVertical_15 = Sketch_10.setVertical(SketchLine_69.result()) SketchConstraintVertical_15.setName("SketchConstraintVertical_14") SketchPoint_12 = Sketch_10.addPoint(33.99999999999999, 7.999999999999999) -SketchConstraintCoincidence_116 = Sketch_10.setCoincident(SketchPoint_12.coordinates(), SketchLine_68.endPoint()) +SketchConstraintCoincidence_116 = Sketch_10.setCoincident( + SketchPoint_12.coordinates(), SketchLine_68.endPoint() +) SketchConstraintCoincidence_116.setName("SketchConstraintCoincidence_89") SketchPoint_13 = Sketch_10.addPoint(32, 6) -SketchConstraintCoincidence_117 = Sketch_10.setCoincident(SketchPoint_13.coordinates(), SketchLine_69.startPoint()) +SketchConstraintCoincidence_117 = Sketch_10.setCoincident( + SketchPoint_13.coordinates(), SketchLine_69.startPoint() +) SketchConstraintCoincidence_117.setName("SketchConstraintCoincidence_90") SketchLine_71 = Sketch_10.addLine(33.99999999999999, 7.999999999999999, 34, 6) SketchLine_71.setName("SketchLine_69") SketchLine_71.result().setName("SketchLine_69") SketchLine_71.setAuxiliary(True) -SketchConstraintCoincidence_118 = Sketch_10.setCoincident(SketchLine_68.endPoint(), SketchLine_71.startPoint()) +SketchConstraintCoincidence_118 = Sketch_10.setCoincident( + SketchLine_68.endPoint(), SketchLine_71.startPoint() +) SketchConstraintCoincidence_118.setName("SketchConstraintCoincidence_88") -SketchConstraintCoincidence_119 = Sketch_10.setCoincident(SketchPoint_12.coordinates(), SketchLine_71.startPoint()) +SketchConstraintCoincidence_119 = Sketch_10.setCoincident( + SketchPoint_12.coordinates(), SketchLine_71.startPoint() +) SketchConstraintCoincidence_119.setName("SketchConstraintCoincidence_91") SketchLine_72 = Sketch_10.addLine(34, 6, 32, 6) SketchLine_72.setName("SketchLine_70") SketchLine_72.result().setName("SketchLine_70") SketchLine_72.setAuxiliary(True) -SketchConstraintCoincidence_120 = Sketch_10.setCoincident(SketchLine_71.endPoint(), SketchLine_72.startPoint()) +SketchConstraintCoincidence_120 = Sketch_10.setCoincident( + SketchLine_71.endPoint(), SketchLine_72.startPoint() +) SketchConstraintCoincidence_120.setName("SketchConstraintCoincidence_92") -SketchConstraintCoincidence_121 = Sketch_10.setCoincident(SketchLine_69.startPoint(), SketchLine_72.endPoint()) +SketchConstraintCoincidence_121 = Sketch_10.setCoincident( + SketchLine_69.startPoint(), SketchLine_72.endPoint() +) SketchConstraintCoincidence_121.setName("SketchConstraintCoincidence_93") -SketchConstraintCoincidence_122 = Sketch_10.setCoincident(SketchPoint_13.coordinates(), SketchLine_72.endPoint()) +SketchConstraintCoincidence_122 = Sketch_10.setCoincident( + SketchPoint_13.coordinates(), SketchLine_72.endPoint() +) SketchConstraintCoincidence_122.setName("SketchConstraintCoincidence_94") SketchConstraintHorizontal_21 = Sketch_10.setHorizontal(SketchLine_72.result()) SketchConstraintHorizontal_21.setName("SketchConstraintHorizontal_17") SketchConstraintVertical_16 = Sketch_10.setVertical(SketchLine_71.result()) SketchConstraintVertical_16.setName("SketchConstraintVertical_15") -SketchConstraintDistance_31 = Sketch_10.setDistance(SketchLine_71.startPoint(), SketchLine_67.result(), 7) +SketchConstraintDistance_31 = Sketch_10.setDistance( + SketchLine_71.startPoint(), SketchLine_67.result(), 7 +) SketchConstraintDistance_31.setName("SketchConstraintDistance_27") -SketchConstraintDistance_32 = Sketch_10.setDistance(SketchLine_69.startPoint(), SketchLine_71.result(), 2) +SketchConstraintDistance_32 = Sketch_10.setDistance( + SketchLine_69.startPoint(), SketchLine_71.result(), 2 +) SketchConstraintDistance_32.setName("SketchConstraintDistance_28") -SketchConstraintDistance_33 = Sketch_10.setDistance(SketchLine_69.startPoint(), SketchLine_66.result(), 6) +SketchConstraintDistance_33 = Sketch_10.setDistance( + SketchLine_69.startPoint(), SketchLine_66.result(), 6 +) SketchConstraintDistance_33.setName("SketchConstraintDistance_29") -SketchConstraintDistance_34 = Sketch_10.setDistance(SketchLine_71.startPoint(), SketchLine_66.result(), 8) +SketchConstraintDistance_34 = Sketch_10.setDistance( + SketchLine_71.startPoint(), SketchLine_66.result(), 8 +) SketchConstraintDistance_34.setName("SketchConstraintDistance_30") -SketchArc_10 = Sketch_10.addArc(32.50000000000002, 7.500000000000033, 32.50001494562209, 6.000000000000006, 33.99999999999999, 7.499985050625134, False) +SketchArc_10 = Sketch_10.addArc( + 32.50000000000002, + 7.500000000000033, + 32.50001494562209, + 6.000000000000006, + 33.99999999999999, + 7.499985050625134, + False, +) SketchArc_10.setName("SketchArc_9") SketchArc_10.result().setName("SketchArc_9") SketchArc_10.results()[1].setName("SketchArc_9_2") -SketchConstraintCoincidence_123 = Sketch_10.setCoincident(SketchArc_10.startPoint(), SketchLine_70.startPoint()) +SketchConstraintCoincidence_123 = Sketch_10.setCoincident( + SketchArc_10.startPoint(), SketchLine_70.startPoint() +) SketchConstraintCoincidence_123.setName("SketchConstraintCoincidence_95") -SketchConstraintCoincidence_124 = Sketch_10.setCoincident(SketchArc_10.endPoint(), SketchLine_65.endPoint()) +SketchConstraintCoincidence_124 = Sketch_10.setCoincident( + SketchArc_10.endPoint(), SketchLine_65.endPoint() +) SketchConstraintCoincidence_124.setName("SketchConstraintCoincidence_96") -SketchConstraintTangent_19 = Sketch_10.setTangent(SketchArc_10.results()[1], SketchLine_65.result()) +SketchConstraintTangent_19 = Sketch_10.setTangent( + SketchArc_10.results()[1], SketchLine_65.result() +) SketchConstraintTangent_19.setName("SketchConstraintTangent_13") -SketchConstraintTangent_20 = Sketch_10.setTangent(SketchArc_10.results()[1], SketchLine_70.result()) +SketchConstraintTangent_20 = Sketch_10.setTangent( + SketchArc_10.results()[1], SketchLine_70.result() +) SketchConstraintTangent_20.setName("SketchConstraintTangent_14") -SketchConstraintCoincidence_125 = Sketch_10.setCoincident(SketchLine_71.startPoint(), SketchLine_65.startPoint()) +SketchConstraintCoincidence_125 = Sketch_10.setCoincident( + SketchLine_71.startPoint(), SketchLine_65.startPoint() +) SketchConstraintCoincidence_125.setName("SketchConstraintCoincidence_97") -SketchConstraintCoincidence_126 = Sketch_10.setCoincident(SketchLine_72.endPoint(), SketchLine_70.endPoint()) +SketchConstraintCoincidence_126 = Sketch_10.setCoincident( + SketchLine_72.endPoint(), SketchLine_70.endPoint() +) SketchConstraintCoincidence_126.setName("SketchConstraintCoincidence_98") -SketchConstraintCoincidence_127 = Sketch_10.setCoincident(SketchLine_65.endPoint(), SketchLine_71.result()) +SketchConstraintCoincidence_127 = Sketch_10.setCoincident( + SketchLine_65.endPoint(), SketchLine_71.result() +) SketchConstraintCoincidence_127.setName("SketchConstraintCoincidence_99") -SketchConstraintCoincidence_128 = Sketch_10.setCoincident(SketchLine_70.startPoint(), SketchLine_72.result()) +SketchConstraintCoincidence_128 = Sketch_10.setCoincident( + SketchLine_70.startPoint(), SketchLine_72.result() +) 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/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")]) +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) diff --git a/test.compatibility/bushing.py b/test.compatibility/bushing.py index a18e955f5..dcadb0ce3 100644 --- a/test.compatibility/bushing.py +++ b/test.compatibility/bushing.py @@ -27,40 +27,64 @@ Parameter_H = model.addParameter(Part_1_doc, "H", "12") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(0, 0, 0, -14) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, -14, 1, -15) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(1, -15, 10, -15) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(10, -15, 11, -14) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(11, -14, 11.00000000000001, -12) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(11.00000000000001, -12, 19, -12) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(19, -4.999999999999999, 6.999999999999999, -5) SketchLine_7.setName("SketchLine_8") SketchLine_7.result().setName("SketchLine_8") SketchLine_8 = Sketch_1.addLine(6.999999999999999, -5, 4.113248654051876, 0) SketchLine_8.setName("SketchLine_9") SketchLine_8.result().setName("SketchLine_9") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_9") SketchLine_9 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_9.setName("SketchLine_10") SketchLine_9.result().setName("SketchLine_10") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.result()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.result() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_10") SketchLine_10 = Sketch_1.addLine(4.113248654051876, 0, 0, 0) SketchLine_10.setName("SketchLine_11") SketchLine_10.result().setName("SketchLine_11") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_10.startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_11") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_10.endPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_12") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_10.endPoint() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_13") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_9.startPoint(), SketchLine_10.endPoint() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_14") SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result()) @@ -69,146 +93,806 @@ SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), "H") SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 14) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.endPoint(), SketchLine_3.result(), 1) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_2.endPoint(), SketchLine_1.result(), 1) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_4.endPoint(), SketchLine_3.result(), 1) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_5.result(), 1) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_10.result(), SketchLine_8.result(), 120) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_7.result(), 5) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_1.endPoint(), SketchLine_3.result(), 1 +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_2.endPoint(), SketchLine_1.result(), 1 +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_4.endPoint(), SketchLine_3.result(), 1 +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_5.result(), 1 +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_10.result(), SketchLine_8.result(), 120 +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_7.result(), 5 +) SketchLine_11 = Sketch_1.addLine(19, -12, 20, -11) SketchLine_11.setName("SketchLine_12") SketchLine_11.result().setName("SketchLine_12") SketchLine_12 = Sketch_1.addLine(20, -11, 20, -5.999999999999999) SketchLine_12.setName("SketchLine_13") SketchLine_12.result().setName("SketchLine_13") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_15") SketchLine_13 = Sketch_1.addLine(20, -5.999999999999999, 19, -4.999999999999999) SketchLine_13.setName("SketchLine_14") SketchLine_13.result().setName("SketchLine_14") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_16") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchLine_13.endPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchLine_13.endPoint() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_17") SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_12.result()) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_12.result(), 1) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_12.endPoint(), SketchLine_7.result(), 1) -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_11.endPoint(), SketchLine_6.result(), 1) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_6.endPoint()) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_7.startPoint(), SketchLine_12.result(), 1 +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchLine_12.endPoint(), SketchLine_7.result(), 1 +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchLine_11.endPoint(), SketchLine_6.result(), 1 +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_6.endPoint() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_18") -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_12.result(), 1) -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchLine_12.result(), SketchLine_1.startPoint(), 20) -SketchConstraintDistance_11 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_12.result(), 10) -SketchConstraintDistance_12 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_6.result(), 12) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_6.endPoint(), SketchLine_12.result(), 1 +) +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchLine_12.result(), SketchLine_1.startPoint(), 20 +) +SketchConstraintDistance_11 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_12.result(), 10 +) +SketchConstraintDistance_12 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_6.result(), 12 +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchCircle_1 = Sketch_2.addCircle(0, 0, 15) SketchCircle_1.setAuxiliary(True) SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchPoint_2.result()) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchCircle_1.center(), SketchPoint_2.result() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_19") SketchLine_14 = Sketch_2.addLine(0, 0, 0, 16.1218227641764) SketchLine_14.setName("SketchLine_15") SketchLine_14.result().setName("SketchLine_15") SketchLine_14.setAuxiliary(True) -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchPoint_2.result()) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchPoint_2.result() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_20") SketchLine_15 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_15.setName("SketchLine_16") SketchLine_15.result().setName("SketchLine_16") -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.result()) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.result() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_21") SketchLine_16 = Sketch_2.addLine(0, 0, -0.2832873010083918, 16.2295186052545) SketchLine_16.setName("SketchLine_17") SketchLine_16.result().setName("SketchLine_17") SketchLine_16.setAuxiliary(True) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchCircle_1.center(), SketchLine_16.startPoint() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_22") -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchPoint_2.coordinates(), SketchLine_16.startPoint() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_23") -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchLine_16.startPoint() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_24") -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_15.startPoint(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_15.startPoint(), SketchLine_16.startPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_25") SketchLine_17 = Sketch_2.addLine(0, 0, 0.2801569326356649, 16.05017992223931) SketchLine_17.setName("SketchLine_18") SketchLine_17.result().setName("SketchLine_18") SketchLine_17.setAuxiliary(True) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchCircle_1.center(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_26") -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchPoint_2.coordinates(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_27") -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_28") -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_15.startPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchLine_15.startPoint(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_29") -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchLine_16.startPoint(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_30") -SketchConstraintAngle_2 = Sketch_2.setAngle(SketchLine_15.result(), SketchLine_16.result(), 1) -SketchConstraintAngle_3 = Sketch_2.setAngle(SketchLine_17.result(), SketchLine_14.result(), 1) +SketchConstraintAngle_2 = Sketch_2.setAngle( + SketchLine_15.result(), SketchLine_16.result(), 1 +) +SketchConstraintAngle_3 = Sketch_2.setAngle( + SketchLine_17.result(), SketchLine_14.result(), 1 +) SketchCircle_2 = Sketch_2.addCircle(0, 0, 14.5) SketchCircle_2.setAuxiliary(True) -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchCircle_2.center()) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchCircle_1.center(), SketchCircle_2.center() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_31") -SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchCircle_2.center()) +SketchConstraintCoincidence_30 = Sketch_2.setCoincident( + SketchPoint_2.coordinates(), SketchCircle_2.center() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_32") -SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_31 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchCircle_2.center() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_33") -SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchLine_15.startPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_32 = Sketch_2.setCoincident( + SketchLine_15.startPoint(), SketchCircle_2.center() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_34") -SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_33 = Sketch_2.setCoincident( + SketchLine_16.startPoint(), SketchCircle_2.center() +) SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_35") -SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchLine_17.startPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_34 = Sketch_2.setCoincident( + SketchLine_17.startPoint(), SketchCircle_2.center() +) SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_36") SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_2.results()[1], 14.5) SketchConstraintRadius_1.setName("SketchConstraintRadius_2") SketchPoint_3 = Sketch_2.addPoint(-0.2530598933406104, 14.49779157976767) SketchPoint_3.setAuxiliary(True) -SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchCircle_2.results()[1]) +SketchConstraintCoincidence_35 = Sketch_2.setCoincident( + SketchPoint_3.coordinates(), SketchCircle_2.results()[1] +) SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_37") SketchPoint_4 = Sketch_2.addPoint(0.2530598933406125, 14.49779157976767) SketchPoint_4.setAuxiliary(True) -SketchConstraintCoincidence_36 = Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchCircle_2.results()[1]) +SketchConstraintCoincidence_36 = Sketch_2.setCoincident( + SketchPoint_4.coordinates(), SketchCircle_2.results()[1] +) SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_38") SketchPoint_5 = Sketch_2.addPoint(0, 15) SketchPoint_5.setAuxiliary(True) -SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchPoint_5.coordinates(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_37 = Sketch_2.setCoincident( + SketchPoint_5.coordinates(), SketchCircle_1.results()[1] +) SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_39") -SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchPoint_5.coordinates(), SketchLine_14.result()) +SketchConstraintCoincidence_38 = Sketch_2.setCoincident( + SketchPoint_5.coordinates(), SketchLine_14.result() +) SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_40") -SketchConstraintCoincidence_39 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_16.result()) +SketchConstraintCoincidence_39 = Sketch_2.setCoincident( + SketchPoint_3.coordinates(), SketchLine_16.result() +) SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_41") -SketchConstraintCoincidence_40 = Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchLine_17.result()) +SketchConstraintCoincidence_40 = Sketch_2.setCoincident( + SketchPoint_4.coordinates(), SketchLine_17.result() +) SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_42") SketchPoint_6 = Sketch_2.addPoint(-0.007888159418852939, 14.98416933181028) SketchPoint_7 = Sketch_2.addPoint(0.008097225251087385, 14.98393070253871) -SketchArc_1 = Sketch_2.addArc(0, 14.9770475280675, -0.007888159418852939, 14.98416933181028, 0.008097225251087385, 14.98393070253871, True) -SketchConstraintCoincidence_41 = Sketch_2.setCoincident(SketchArc_1.center(), SketchLine_15.result()) +SketchArc_1 = Sketch_2.addArc( + 0, + 14.9770475280675, + -0.007888159418852939, + 14.98416933181028, + 0.008097225251087385, + 14.98393070253871, + True, +) +SketchConstraintCoincidence_41 = Sketch_2.setCoincident( + SketchArc_1.center(), SketchLine_15.result() +) SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_50") -SketchConstraintCoincidence_42 = Sketch_2.setCoincident(SketchPoint_6.coordinates(), SketchArc_1.startPoint()) +SketchConstraintCoincidence_42 = Sketch_2.setCoincident( + SketchPoint_6.coordinates(), SketchArc_1.startPoint() +) SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_51") -SketchConstraintCoincidence_43 = Sketch_2.setCoincident(SketchPoint_7.coordinates(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_43 = Sketch_2.setCoincident( + SketchPoint_7.coordinates(), SketchArc_1.endPoint() +) SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_52") -SketchLine_18 = Sketch_2.addLine(-0.2530598933406097, 14.49779157976767, -0.007888159418852939, 14.98416933181028) +SketchLine_18 = Sketch_2.addLine( + -0.2530598933406097, 14.49779157976767, -0.007888159418852939, 14.98416933181028 +) SketchLine_18.setName("SketchLine_382") SketchLine_18.result().setName("SketchLine_382") -SketchConstraintCoincidence_44 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_18.startPoint()) -SketchConstraintCoincidence_45 = Sketch_2.setCoincident(SketchPoint_6.coordinates(), SketchLine_18.endPoint()) +SketchConstraintCoincidence_44 = Sketch_2.setCoincident( + SketchPoint_3.coordinates(), SketchLine_18.startPoint() +) +SketchConstraintCoincidence_45 = Sketch_2.setCoincident( + SketchPoint_6.coordinates(), SketchLine_18.endPoint() +) SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_46") -SketchConstraintCoincidence_46 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_18.endPoint()) +SketchConstraintCoincidence_46 = Sketch_2.setCoincident( + SketchArc_1.startPoint(), SketchLine_18.endPoint() +) SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_47") -SketchLine_19 = Sketch_2.addLine(0.008097225251087385, 14.98393070253871, 0.2530598933406125, 14.49779157976767) +SketchLine_19 = Sketch_2.addLine( + 0.008097225251087385, 14.98393070253871, 0.2530598933406125, 14.49779157976767 +) SketchLine_19.setName("SketchLine_383") SketchLine_19.result().setName("SketchLine_383") -SketchConstraintCoincidence_47 = Sketch_2.setCoincident(SketchPoint_7.coordinates(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_47 = Sketch_2.setCoincident( + SketchPoint_7.coordinates(), SketchLine_19.startPoint() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_48") -SketchConstraintCoincidence_48 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_48 = Sketch_2.setCoincident( + SketchArc_1.endPoint(), SketchLine_19.startPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_49") -SketchConstraintCoincidence_49 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchPoint_4.coordinates()) +SketchConstraintCoincidence_49 = Sketch_2.setCoincident( + SketchLine_19.endPoint(), SketchPoint_4.coordinates() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_54") -SketchMultiRotation_1_objects = [SketchLine_18.result(), SketchArc_1.results()[1], SketchLine_19.result()] -SketchMultiRotation_1 = Sketch_2.addRotation(SketchMultiRotation_1_objects, SketchPoint_2.coordinates(), 2, 180) -[SketchLine_20, SketchLine_21, SketchLine_22, SketchLine_23, SketchLine_24, SketchLine_25, SketchLine_26, SketchLine_27, SketchLine_28, SketchLine_29, SketchLine_30, SketchLine_31, SketchLine_32, SketchLine_33, SketchLine_34, SketchLine_35, SketchLine_36, SketchLine_37, SketchLine_38, SketchLine_39, SketchLine_40, SketchLine_41, SketchLine_42, SketchLine_43, SketchLine_44, SketchLine_45, SketchLine_46, SketchLine_47, SketchLine_48, SketchLine_49, SketchLine_50, SketchLine_51, SketchLine_52, SketchLine_53, SketchLine_54, SketchLine_55, SketchLine_56, SketchLine_57, SketchLine_58, SketchLine_59, SketchLine_60, SketchLine_61, SketchLine_62, SketchLine_63, SketchLine_64, SketchLine_65, SketchLine_66, SketchLine_67, SketchLine_68, SketchLine_69, SketchLine_70, SketchLine_71, SketchLine_72, SketchLine_73, SketchLine_74, SketchLine_75, SketchLine_76, SketchLine_77, SketchLine_78, SketchLine_79, SketchLine_80, SketchLine_81, SketchLine_82, SketchLine_83, SketchLine_84, SketchLine_85, SketchLine_86, SketchLine_87, SketchLine_88, SketchLine_89, SketchLine_90, SketchLine_91, SketchLine_92, SketchLine_93, SketchLine_94, SketchLine_95, SketchLine_96, SketchLine_97, SketchLine_98, SketchLine_99, SketchLine_100, SketchLine_101, SketchLine_102, SketchLine_103, SketchLine_104, SketchLine_105, SketchLine_106, SketchLine_107, SketchLine_108, SketchLine_109, SketchLine_110, SketchLine_111, SketchLine_112, SketchLine_113, SketchLine_114, SketchLine_115, SketchLine_116, SketchLine_117, SketchLine_118, SketchLine_119, SketchLine_120, SketchLine_121, SketchLine_122, SketchLine_123, SketchLine_124, SketchLine_125, SketchLine_126, SketchLine_127, SketchLine_128, SketchLine_129, SketchLine_130, SketchLine_131, SketchLine_132, SketchLine_133, SketchLine_134, SketchLine_135, SketchLine_136, SketchLine_137, SketchLine_138, SketchLine_139, SketchLine_140, SketchLine_141, SketchLine_142, SketchLine_143, SketchLine_144, SketchLine_145, SketchLine_146, SketchLine_147, SketchLine_148, SketchLine_149, SketchLine_150, SketchLine_151, SketchLine_152, SketchLine_153, SketchLine_154, SketchLine_155, SketchLine_156, SketchLine_157, SketchLine_158, SketchLine_159, SketchLine_160, SketchLine_161, SketchLine_162, SketchLine_163, SketchLine_164, SketchLine_165, SketchLine_166, SketchLine_167, SketchLine_168, SketchLine_169, SketchLine_170, SketchLine_171, SketchLine_172, SketchLine_173, SketchLine_174, SketchLine_175, SketchLine_176, SketchLine_177, SketchLine_178, SketchLine_179, SketchLine_180, SketchLine_181, SketchLine_182, SketchLine_183, SketchLine_184, SketchLine_185, SketchLine_186, SketchLine_187, SketchLine_188, SketchLine_189, SketchLine_190, SketchLine_191, SketchLine_192, SketchLine_193, SketchLine_194, SketchLine_195, SketchLine_196, SketchLine_197, SketchLine_198, SketchArc_2, SketchArc_3, SketchArc_4, SketchArc_5, SketchArc_6, SketchArc_7, SketchArc_8, SketchArc_9, SketchArc_10, SketchArc_11, SketchArc_12, SketchArc_13, SketchArc_14, SketchArc_15, SketchArc_16, SketchArc_17, SketchArc_18, SketchArc_19, SketchArc_20, SketchArc_21, SketchArc_22, SketchArc_23, SketchArc_24, SketchArc_25, SketchArc_26, SketchArc_27, SketchArc_28, SketchArc_29, SketchArc_30, SketchArc_31, SketchArc_32, SketchArc_33, SketchArc_34, SketchArc_35, SketchArc_36, SketchArc_37, SketchArc_38, SketchArc_39, SketchArc_40, SketchArc_41, SketchArc_42, SketchArc_43, SketchArc_44, SketchArc_45, SketchArc_46, SketchArc_47, SketchArc_48, SketchArc_49, SketchArc_50, SketchArc_51, SketchArc_52, SketchArc_53, SketchArc_54, SketchArc_55, SketchArc_56, SketchArc_57, SketchArc_58, SketchArc_59, SketchArc_60, SketchArc_61, SketchArc_62, SketchArc_63, SketchArc_64, SketchArc_65, SketchArc_66, SketchArc_67, SketchArc_68, SketchArc_69, SketchArc_70, SketchArc_71, SketchArc_72, SketchArc_73, SketchArc_74, SketchArc_75, SketchArc_76, SketchArc_77, SketchArc_78, SketchArc_79, SketchArc_80, SketchArc_81, SketchArc_82, SketchArc_83, SketchArc_84, SketchArc_85, SketchArc_86, SketchArc_87, SketchArc_88, SketchArc_89, SketchArc_90, SketchArc_91, SketchArc_92, SketchArc_93, SketchArc_94, SketchArc_95, SketchArc_96, SketchArc_97, SketchArc_98, SketchArc_99, SketchArc_100, SketchArc_101, SketchArc_102, SketchArc_103, SketchArc_104, SketchArc_105, SketchArc_106, SketchArc_107, SketchArc_108, SketchArc_109, SketchArc_110, SketchArc_111, SketchArc_112, SketchArc_113, SketchArc_114, SketchArc_115, SketchArc_116, SketchArc_117, SketchArc_118, SketchArc_119, SketchArc_120, SketchArc_121, SketchArc_122, SketchArc_123, SketchArc_124, SketchArc_125, SketchArc_126, SketchArc_127, SketchArc_128, SketchArc_129, SketchArc_130, SketchArc_131, SketchArc_132, SketchArc_133, SketchArc_134, SketchArc_135, SketchArc_136, SketchArc_137, SketchArc_138, SketchArc_139, SketchArc_140, SketchArc_141, SketchArc_142, SketchArc_143, SketchArc_144, SketchArc_145, SketchArc_146, SketchArc_147, SketchArc_148, SketchArc_149, SketchArc_150, SketchArc_151, SketchArc_152, SketchArc_153, SketchArc_154, SketchArc_155, SketchArc_156, SketchArc_157, SketchArc_158, SketchArc_159, SketchArc_160, SketchArc_161, SketchArc_162, SketchArc_163, SketchArc_164, SketchArc_165, SketchArc_166, SketchArc_167, SketchArc_168, SketchArc_169, SketchArc_170, SketchArc_171, SketchArc_172, SketchArc_173, SketchArc_174, SketchArc_175, SketchArc_176, SketchArc_177, SketchArc_178, SketchArc_179, SketchArc_180, SketchLine_199, SketchLine_200, SketchLine_201, SketchLine_202, SketchLine_203, SketchLine_204, SketchLine_205, SketchLine_206, SketchLine_207, SketchLine_208, SketchLine_209, SketchLine_210, SketchLine_211, SketchLine_212, SketchLine_213, SketchLine_214, SketchLine_215, SketchLine_216, SketchLine_217, SketchLine_218, SketchLine_219, SketchLine_220, SketchLine_221, SketchLine_222, SketchLine_223, SketchLine_224, SketchLine_225, SketchLine_226, SketchLine_227, SketchLine_228, SketchLine_229, SketchLine_230, SketchLine_231, SketchLine_232, SketchLine_233, SketchLine_234, SketchLine_235, SketchLine_236, SketchLine_237, SketchLine_238, SketchLine_239, SketchLine_240, SketchLine_241, SketchLine_242, SketchLine_243, SketchLine_244, SketchLine_245, SketchLine_246, SketchLine_247, SketchLine_248, SketchLine_249, SketchLine_250, SketchLine_251, SketchLine_252, SketchLine_253, SketchLine_254, SketchLine_255, SketchLine_256, SketchLine_257, SketchLine_258, SketchLine_259, SketchLine_260, SketchLine_261, SketchLine_262, SketchLine_263, SketchLine_264, SketchLine_265, SketchLine_266, SketchLine_267, SketchLine_268, SketchLine_269, SketchLine_270, SketchLine_271, SketchLine_272, SketchLine_273, SketchLine_274, SketchLine_275, SketchLine_276, SketchLine_277, SketchLine_278, SketchLine_279, SketchLine_280, SketchLine_281, SketchLine_282, SketchLine_283, SketchLine_284, SketchLine_285, SketchLine_286, SketchLine_287, SketchLine_288, SketchLine_289, SketchLine_290, SketchLine_291, SketchLine_292, SketchLine_293, SketchLine_294, SketchLine_295, SketchLine_296, SketchLine_297, SketchLine_298, SketchLine_299, SketchLine_300, SketchLine_301, SketchLine_302, SketchLine_303, SketchLine_304, SketchLine_305, SketchLine_306, SketchLine_307, SketchLine_308, SketchLine_309, SketchLine_310, SketchLine_311, SketchLine_312, SketchLine_313, SketchLine_314, SketchLine_315, SketchLine_316, SketchLine_317, SketchLine_318, SketchLine_319, SketchLine_320, SketchLine_321, SketchLine_322, SketchLine_323, SketchLine_324, SketchLine_325, SketchLine_326, SketchLine_327, SketchLine_328, SketchLine_329, SketchLine_330, SketchLine_331, SketchLine_332, SketchLine_333, SketchLine_334, SketchLine_335, SketchLine_336, SketchLine_337, SketchLine_338, SketchLine_339, SketchLine_340, SketchLine_341, SketchLine_342, SketchLine_343, SketchLine_344, SketchLine_345, SketchLine_346, SketchLine_347, SketchLine_348, SketchLine_349, SketchLine_350, SketchLine_351, SketchLine_352, SketchLine_353, SketchLine_354, SketchLine_355, SketchLine_356, SketchLine_357, SketchLine_358, SketchLine_359, SketchLine_360, SketchLine_361, SketchLine_362, SketchLine_363, SketchLine_364, SketchLine_365, SketchLine_366, SketchLine_367, SketchLine_368, SketchLine_369, SketchLine_370, SketchLine_371, SketchLine_372, SketchLine_373, SketchLine_374, SketchLine_375, SketchLine_376, SketchLine_377] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1_objects = [ + SketchLine_18.result(), + SketchArc_1.results()[1], + SketchLine_19.result(), +] +SketchMultiRotation_1 = Sketch_2.addRotation( + SketchMultiRotation_1_objects, SketchPoint_2.coordinates(), 2, 180 +) +[ + SketchLine_20, + SketchLine_21, + SketchLine_22, + SketchLine_23, + SketchLine_24, + SketchLine_25, + SketchLine_26, + SketchLine_27, + SketchLine_28, + SketchLine_29, + SketchLine_30, + SketchLine_31, + SketchLine_32, + SketchLine_33, + SketchLine_34, + SketchLine_35, + SketchLine_36, + SketchLine_37, + SketchLine_38, + SketchLine_39, + SketchLine_40, + SketchLine_41, + SketchLine_42, + SketchLine_43, + SketchLine_44, + SketchLine_45, + SketchLine_46, + SketchLine_47, + SketchLine_48, + SketchLine_49, + SketchLine_50, + SketchLine_51, + SketchLine_52, + SketchLine_53, + SketchLine_54, + SketchLine_55, + SketchLine_56, + SketchLine_57, + SketchLine_58, + SketchLine_59, + SketchLine_60, + SketchLine_61, + SketchLine_62, + SketchLine_63, + SketchLine_64, + SketchLine_65, + SketchLine_66, + SketchLine_67, + SketchLine_68, + SketchLine_69, + SketchLine_70, + SketchLine_71, + SketchLine_72, + SketchLine_73, + SketchLine_74, + SketchLine_75, + SketchLine_76, + SketchLine_77, + SketchLine_78, + SketchLine_79, + SketchLine_80, + SketchLine_81, + SketchLine_82, + SketchLine_83, + SketchLine_84, + SketchLine_85, + SketchLine_86, + SketchLine_87, + SketchLine_88, + SketchLine_89, + SketchLine_90, + SketchLine_91, + SketchLine_92, + SketchLine_93, + SketchLine_94, + SketchLine_95, + SketchLine_96, + SketchLine_97, + SketchLine_98, + SketchLine_99, + SketchLine_100, + SketchLine_101, + SketchLine_102, + SketchLine_103, + SketchLine_104, + SketchLine_105, + SketchLine_106, + SketchLine_107, + SketchLine_108, + SketchLine_109, + SketchLine_110, + SketchLine_111, + SketchLine_112, + SketchLine_113, + SketchLine_114, + SketchLine_115, + SketchLine_116, + SketchLine_117, + SketchLine_118, + SketchLine_119, + SketchLine_120, + SketchLine_121, + SketchLine_122, + SketchLine_123, + SketchLine_124, + SketchLine_125, + SketchLine_126, + SketchLine_127, + SketchLine_128, + SketchLine_129, + SketchLine_130, + SketchLine_131, + SketchLine_132, + SketchLine_133, + SketchLine_134, + SketchLine_135, + SketchLine_136, + SketchLine_137, + SketchLine_138, + SketchLine_139, + SketchLine_140, + SketchLine_141, + SketchLine_142, + SketchLine_143, + SketchLine_144, + SketchLine_145, + SketchLine_146, + SketchLine_147, + SketchLine_148, + SketchLine_149, + SketchLine_150, + SketchLine_151, + SketchLine_152, + SketchLine_153, + SketchLine_154, + SketchLine_155, + SketchLine_156, + SketchLine_157, + SketchLine_158, + SketchLine_159, + SketchLine_160, + SketchLine_161, + SketchLine_162, + SketchLine_163, + SketchLine_164, + SketchLine_165, + SketchLine_166, + SketchLine_167, + SketchLine_168, + SketchLine_169, + SketchLine_170, + SketchLine_171, + SketchLine_172, + SketchLine_173, + SketchLine_174, + SketchLine_175, + SketchLine_176, + SketchLine_177, + SketchLine_178, + SketchLine_179, + SketchLine_180, + SketchLine_181, + SketchLine_182, + SketchLine_183, + SketchLine_184, + SketchLine_185, + SketchLine_186, + SketchLine_187, + SketchLine_188, + SketchLine_189, + SketchLine_190, + SketchLine_191, + SketchLine_192, + SketchLine_193, + SketchLine_194, + SketchLine_195, + SketchLine_196, + SketchLine_197, + SketchLine_198, + SketchArc_2, + SketchArc_3, + SketchArc_4, + SketchArc_5, + SketchArc_6, + SketchArc_7, + SketchArc_8, + SketchArc_9, + SketchArc_10, + SketchArc_11, + SketchArc_12, + SketchArc_13, + SketchArc_14, + SketchArc_15, + SketchArc_16, + SketchArc_17, + SketchArc_18, + SketchArc_19, + SketchArc_20, + SketchArc_21, + SketchArc_22, + SketchArc_23, + SketchArc_24, + SketchArc_25, + SketchArc_26, + SketchArc_27, + SketchArc_28, + SketchArc_29, + SketchArc_30, + SketchArc_31, + SketchArc_32, + SketchArc_33, + SketchArc_34, + SketchArc_35, + SketchArc_36, + SketchArc_37, + SketchArc_38, + SketchArc_39, + SketchArc_40, + SketchArc_41, + SketchArc_42, + SketchArc_43, + SketchArc_44, + SketchArc_45, + SketchArc_46, + SketchArc_47, + SketchArc_48, + SketchArc_49, + SketchArc_50, + SketchArc_51, + SketchArc_52, + SketchArc_53, + SketchArc_54, + SketchArc_55, + SketchArc_56, + SketchArc_57, + SketchArc_58, + SketchArc_59, + SketchArc_60, + SketchArc_61, + SketchArc_62, + SketchArc_63, + SketchArc_64, + SketchArc_65, + SketchArc_66, + SketchArc_67, + SketchArc_68, + SketchArc_69, + SketchArc_70, + SketchArc_71, + SketchArc_72, + SketchArc_73, + SketchArc_74, + SketchArc_75, + SketchArc_76, + SketchArc_77, + SketchArc_78, + SketchArc_79, + SketchArc_80, + SketchArc_81, + SketchArc_82, + SketchArc_83, + SketchArc_84, + SketchArc_85, + SketchArc_86, + SketchArc_87, + SketchArc_88, + SketchArc_89, + SketchArc_90, + SketchArc_91, + SketchArc_92, + SketchArc_93, + SketchArc_94, + SketchArc_95, + SketchArc_96, + SketchArc_97, + SketchArc_98, + SketchArc_99, + SketchArc_100, + SketchArc_101, + SketchArc_102, + SketchArc_103, + SketchArc_104, + SketchArc_105, + SketchArc_106, + SketchArc_107, + SketchArc_108, + SketchArc_109, + SketchArc_110, + SketchArc_111, + SketchArc_112, + SketchArc_113, + SketchArc_114, + SketchArc_115, + SketchArc_116, + SketchArc_117, + SketchArc_118, + SketchArc_119, + SketchArc_120, + SketchArc_121, + SketchArc_122, + SketchArc_123, + SketchArc_124, + SketchArc_125, + SketchArc_126, + SketchArc_127, + SketchArc_128, + SketchArc_129, + SketchArc_130, + SketchArc_131, + SketchArc_132, + SketchArc_133, + SketchArc_134, + SketchArc_135, + SketchArc_136, + SketchArc_137, + SketchArc_138, + SketchArc_139, + SketchArc_140, + SketchArc_141, + SketchArc_142, + SketchArc_143, + SketchArc_144, + SketchArc_145, + SketchArc_146, + SketchArc_147, + SketchArc_148, + SketchArc_149, + SketchArc_150, + SketchArc_151, + SketchArc_152, + SketchArc_153, + SketchArc_154, + SketchArc_155, + SketchArc_156, + SketchArc_157, + SketchArc_158, + SketchArc_159, + SketchArc_160, + SketchArc_161, + SketchArc_162, + SketchArc_163, + SketchArc_164, + SketchArc_165, + SketchArc_166, + SketchArc_167, + SketchArc_168, + SketchArc_169, + SketchArc_170, + SketchArc_171, + SketchArc_172, + SketchArc_173, + SketchArc_174, + SketchArc_175, + SketchArc_176, + SketchArc_177, + SketchArc_178, + SketchArc_179, + SketchArc_180, + SketchLine_199, + SketchLine_200, + SketchLine_201, + SketchLine_202, + SketchLine_203, + SketchLine_204, + SketchLine_205, + SketchLine_206, + SketchLine_207, + SketchLine_208, + SketchLine_209, + SketchLine_210, + SketchLine_211, + SketchLine_212, + SketchLine_213, + SketchLine_214, + SketchLine_215, + SketchLine_216, + SketchLine_217, + SketchLine_218, + SketchLine_219, + SketchLine_220, + SketchLine_221, + SketchLine_222, + SketchLine_223, + SketchLine_224, + SketchLine_225, + SketchLine_226, + SketchLine_227, + SketchLine_228, + SketchLine_229, + SketchLine_230, + SketchLine_231, + SketchLine_232, + SketchLine_233, + SketchLine_234, + SketchLine_235, + SketchLine_236, + SketchLine_237, + SketchLine_238, + SketchLine_239, + SketchLine_240, + SketchLine_241, + SketchLine_242, + SketchLine_243, + SketchLine_244, + SketchLine_245, + SketchLine_246, + SketchLine_247, + SketchLine_248, + SketchLine_249, + SketchLine_250, + SketchLine_251, + SketchLine_252, + SketchLine_253, + SketchLine_254, + SketchLine_255, + SketchLine_256, + SketchLine_257, + SketchLine_258, + SketchLine_259, + SketchLine_260, + SketchLine_261, + SketchLine_262, + SketchLine_263, + SketchLine_264, + SketchLine_265, + SketchLine_266, + SketchLine_267, + SketchLine_268, + SketchLine_269, + SketchLine_270, + SketchLine_271, + SketchLine_272, + SketchLine_273, + SketchLine_274, + SketchLine_275, + SketchLine_276, + SketchLine_277, + SketchLine_278, + SketchLine_279, + SketchLine_280, + SketchLine_281, + SketchLine_282, + SketchLine_283, + SketchLine_284, + SketchLine_285, + SketchLine_286, + SketchLine_287, + SketchLine_288, + SketchLine_289, + SketchLine_290, + SketchLine_291, + SketchLine_292, + SketchLine_293, + SketchLine_294, + SketchLine_295, + SketchLine_296, + SketchLine_297, + SketchLine_298, + SketchLine_299, + SketchLine_300, + SketchLine_301, + SketchLine_302, + SketchLine_303, + SketchLine_304, + SketchLine_305, + SketchLine_306, + SketchLine_307, + SketchLine_308, + SketchLine_309, + SketchLine_310, + SketchLine_311, + SketchLine_312, + SketchLine_313, + SketchLine_314, + SketchLine_315, + SketchLine_316, + SketchLine_317, + SketchLine_318, + SketchLine_319, + SketchLine_320, + SketchLine_321, + SketchLine_322, + SketchLine_323, + SketchLine_324, + SketchLine_325, + SketchLine_326, + SketchLine_327, + SketchLine_328, + SketchLine_329, + SketchLine_330, + SketchLine_331, + SketchLine_332, + SketchLine_333, + SketchLine_334, + SketchLine_335, + SketchLine_336, + SketchLine_337, + SketchLine_338, + SketchLine_339, + SketchLine_340, + SketchLine_341, + SketchLine_342, + SketchLine_343, + SketchLine_344, + SketchLine_345, + SketchLine_346, + SketchLine_347, + SketchLine_348, + SketchLine_349, + SketchLine_350, + SketchLine_351, + SketchLine_352, + SketchLine_353, + SketchLine_354, + SketchLine_355, + SketchLine_356, + SketchLine_357, + SketchLine_358, + SketchLine_359, + SketchLine_360, + SketchLine_361, + SketchLine_362, + SketchLine_363, + SketchLine_364, + SketchLine_365, + SketchLine_366, + SketchLine_367, + SketchLine_368, + SketchLine_369, + SketchLine_370, + SketchLine_371, + SketchLine_372, + SketchLine_373, + SketchLine_374, + SketchLine_375, + SketchLine_376, + SketchLine_377, +] = SketchMultiRotation_1.rotated() SketchLine_199.setName("SketchLine_21") SketchLine_199.result().setName("SketchLine_21") SketchLine_198.setName("SketchLine_199") @@ -568,7 +1252,9 @@ SketchLine_22.result().setName("SketchLine_23") SketchLine_21.setName("SketchLine_22") SketchLine_21.result().setName("SketchLine_22") SketchCircle_3 = Sketch_2.addCircle(0, 0, 19.22880100399138) -SketchConstraintCoincidence_50 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchPoint_2.result()) +SketchConstraintCoincidence_50 = Sketch_2.setCoincident( + SketchCircle_3.center(), SketchPoint_2.result() +) SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_53") model.do() Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) @@ -576,14 +1262,50 @@ SketchCircle_4 = Sketch_3.addCircle(15, 0, 1) SketchConstraintRadius_2 = Sketch_3.setRadius(SketchCircle_4.results()[1], 1) SketchConstraintRadius_2.setName("SketchConstraintRadius_3") SketchLine_378 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchCircle_4.center(), SketchLine_378.result()) +SketchConstraintCoincidence_51 = Sketch_3.setCoincident( + SketchCircle_4.center(), SketchLine_378.result() +) 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) +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_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")]) +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) diff --git a/test.compatibility/case24.py b/test.compatibility/case24.py index e92da5de6..7b38acaf0 100644 --- a/test.compatibility/case24.py +++ b/test.compatibility/case24.py @@ -45,14 +45,22 @@ SketchLine_5 = Sketch_1.addLine(20, 20, 20, 0) SketchLine_5.setName("SketchLine_4") SketchLine_5.result().setName("SketchLine_4") SketchLine_5.setAuxiliary(True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_6 = Sketch_1.addLine(0, 20, 20, 20) SketchLine_6.setName("SketchLine_3") SketchLine_6.result().setName("SketchLine_3") SketchLine_6.setAuxiliary(True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_5.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_6.result()) @@ -66,21 +74,66 @@ SketchLine_8 = SketchProjection_2.createdFeature() SketchLine_8.setName("SketchLine_6") SketchLine_8.result().setName("SketchLine_6") 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()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_4.result()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_4.endPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_6.result()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_5.result()) +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() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_4.result() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_4.endPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_6.result() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_4.startPoint(), SketchLine_5.result() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "R") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchAPI_Line(SketchLine_7).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) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchAPI_Line(SketchLine_7).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_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")]) +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, 20) SketchLine_9.setName("SketchLine_13") @@ -88,8 +141,12 @@ 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/SketchLine_1_EndVertex")) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchPoint_1.result()) +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") @@ -100,41 +157,93 @@ SketchLine_13 = Sketch_2.addLine(-20, 20, -20, 0) SketchLine_13.setName("SketchLine_12") SketchLine_13.result().setName("SketchLine_12") SketchLine_13.setAuxiliary(True) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchLine_14 = Sketch_2.addLine(0, 20, -20, 20) SketchLine_14.setName("SketchLine_11") SketchLine_14.result().setName("SketchLine_11") SketchLine_14.setAuxiliary(True) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_13.startPoint() +) 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, 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()) -SketchConstraintTangent_4 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_12.result()) -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_12.endPoint()) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_14.result()) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_12.startPoint(), SketchLine_13.result()) +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() +) +SketchConstraintTangent_4 = Sketch_2.setTangent( + SketchArc_2.results()[1], SketchLine_12.result() +) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_12.endPoint() +) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchLine_14.result() +) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_12.startPoint(), SketchLine_13.result() +) 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) +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_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")) +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/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()) +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") @@ -145,36 +254,80 @@ SketchLine_19 = Sketch_3.addLine(-20, -20, -20, 0) SketchLine_19.setName("SketchLine_18") SketchLine_19.result().setName("SketchLine_18") SketchLine_19.setAuxiliary(True) -SketchConstraintCoincidence_24 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_25 = Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_24 = Sketch_3.setCoincident( + SketchLine_19.endPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_25 = Sketch_3.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) SketchLine_20 = Sketch_3.addLine(0, -20, -20, -20) SketchLine_20.setName("SketchLine_17") SketchLine_20.result().setName("SketchLine_17") SketchLine_20.setAuxiliary(True) -SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_27 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_26 = Sketch_3.setCoincident( + SketchLine_17.endPoint(), SketchLine_20.startPoint() +) +SketchConstraintCoincidence_27 = Sketch_3.setCoincident( + SketchLine_20.endPoint(), SketchLine_19.startPoint() +) 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, -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()) -SketchConstraintTangent_6 = Sketch_3.setTangent(SketchArc_3.results()[1], SketchLine_18.result()) -SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchLine_20.startPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchLine_18.endPoint()) -SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchLine_20.result()) -SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchLine_18.startPoint(), SketchLine_19.result()) +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() +) +SketchConstraintTangent_6 = Sketch_3.setTangent( + SketchArc_3.results()[1], SketchLine_18.result() +) +SketchConstraintCoincidence_30 = Sketch_3.setCoincident( + SketchLine_20.startPoint(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_31 = Sketch_3.setCoincident( + SketchLine_19.endPoint(), SketchLine_18.endPoint() +) +SketchConstraintCoincidence_32 = Sketch_3.setCoincident( + SketchLine_15.endPoint(), SketchLine_20.result() +) +SketchConstraintCoincidence_33 = Sketch_3.setCoincident( + SketchLine_18.startPoint(), SketchLine_19.result() +) SketchConstraintRadius_3 = Sketch_3.setRadius(SketchArc_3.results()[1], 3) -SketchConstraintDistance_5 = Sketch_3.setDistance(SketchLine_15.startPoint(), SketchLine_16.result(), 20) -SketchConstraintDistance_6 = Sketch_3.setDistance(SketchLine_18.endPoint(), SketchLine_17.result(), 20) +SketchConstraintDistance_5 = Sketch_3.setDistance( + SketchLine_15.startPoint(), SketchLine_16.result(), 20 +) +SketchConstraintDistance_6 = Sketch_3.setDistance( + SketchLine_18.endPoint(), SketchLine_17.result(), 20 +) SketchLine_21 = Sketch_3.addLine(-23, -0.01462093666115485, -23, -19.98755081419712) -SketchConstraintParallel_1 = Sketch_3.setParallel(SketchLine_17.result(), SketchLine_21.result()) -SketchConstraintDistance_7 = Sketch_3.setDistance(SketchLine_21.startPoint(), SketchLine_18.result(), 3) +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/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")) +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") @@ -191,49 +344,101 @@ SketchLine_26 = Sketch_4.addLine(20, -20, 20, 0) SketchLine_26.setName("SketchLine_25") SketchLine_26.result().setName("SketchLine_25") SketchLine_26.setAuxiliary(True) -SketchConstraintCoincidence_34 = Sketch_4.setCoincident(SketchLine_26.endPoint(), SketchLine_23.startPoint()) -SketchConstraintCoincidence_35 = Sketch_4.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) +SketchConstraintCoincidence_34 = Sketch_4.setCoincident( + SketchLine_26.endPoint(), SketchLine_23.startPoint() +) +SketchConstraintCoincidence_35 = Sketch_4.setCoincident( + SketchLine_23.endPoint(), SketchLine_24.startPoint() +) SketchLine_27 = Sketch_4.addLine(-3, -20, 20, -20) SketchLine_27.setName("SketchLine_24") SketchLine_27.result().setName("SketchLine_24") SketchLine_27.setAuxiliary(True) -SketchConstraintCoincidence_36 = Sketch_4.setCoincident(SketchLine_24.endPoint(), SketchLine_27.startPoint()) -SketchConstraintCoincidence_37 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchLine_26.startPoint()) +SketchConstraintCoincidence_36 = Sketch_4.setCoincident( + SketchLine_24.endPoint(), SketchLine_27.startPoint() +) +SketchConstraintCoincidence_37 = Sketch_4.setCoincident( + SketchLine_27.endPoint(), SketchLine_26.startPoint() +) 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, -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()) -SketchConstraintTangent_8 = Sketch_4.setTangent(SketchArc_4.results()[1], SketchLine_25.result()) -SketchConstraintCoincidence_40 = Sketch_4.setCoincident(SketchLine_27.startPoint(), SketchLine_22.startPoint()) -SketchConstraintCoincidence_41 = Sketch_4.setCoincident(SketchLine_26.endPoint(), SketchLine_25.endPoint()) -SketchConstraintCoincidence_42 = Sketch_4.setCoincident(SketchLine_22.endPoint(), SketchLine_27.result()) -SketchConstraintCoincidence_43 = Sketch_4.setCoincident(SketchLine_25.startPoint(), SketchLine_26.result()) +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() +) +SketchConstraintTangent_8 = Sketch_4.setTangent( + SketchArc_4.results()[1], SketchLine_25.result() +) +SketchConstraintCoincidence_40 = Sketch_4.setCoincident( + SketchLine_27.startPoint(), SketchLine_22.startPoint() +) +SketchConstraintCoincidence_41 = Sketch_4.setCoincident( + SketchLine_26.endPoint(), SketchLine_25.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/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) -SketchConstraintDistance_10 = Sketch_4.setDistance(SketchLine_24.result(), SketchLine_28.endPoint(), 3) +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 +) +SketchConstraintDistance_10 = Sketch_4.setDistance( + SketchLine_24.result(), SketchLine_28.endPoint(), 3 +) 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) +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_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")]) +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()) +SketchConstraintCoincidence_45 = Sketch_5.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.result() +) 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) SketchLine_33.setName("SketchLine_32") SketchLine_33.result().setName("SketchLine_32") -SketchConstraintCoincidence_46 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_46 = Sketch_5.setCoincident( + SketchLine_30.endPoint(), SketchLine_33.startPoint() +) SketchLine_34 = Sketch_5.addLine(65, 70.99999917134223, 65, 0) SketchLine_34.setName("SketchLine_40") SketchLine_34.result().setName("SketchLine_40") @@ -245,65 +450,119 @@ SketchLine_36 = Sketch_5.addLine(65, 77.00000000000001, 65, 0) SketchLine_36.setName("SketchLine_35") SketchLine_36.result().setName("SketchLine_35") SketchLine_36.setAuxiliary(True) -SketchConstraintCoincidence_47 = Sketch_5.setCoincident(SketchLine_35.endPoint(), SketchLine_36.startPoint()) +SketchConstraintCoincidence_47 = Sketch_5.setCoincident( + SketchLine_35.endPoint(), SketchLine_36.startPoint() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_49") SketchLine_37 = Sketch_5.addLine(65, 0, 0, 0) SketchLine_37.setName("SketchLine_38") SketchLine_37.result().setName("SketchLine_38") -SketchConstraintCoincidence_48 = Sketch_5.setCoincident(SketchLine_30.startPoint(), SketchLine_37.endPoint()) +SketchConstraintCoincidence_48 = Sketch_5.setCoincident( + SketchLine_30.startPoint(), SketchLine_37.endPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_53") -SketchConstraintCoincidence_49 = Sketch_5.setCoincident(SketchLine_37.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_49 = Sketch_5.setCoincident( + SketchLine_37.endPoint(), SketchLine_31.startPoint() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_54") SketchConstraintHorizontal_9 = Sketch_5.setHorizontal(SketchLine_37.result()) SketchConstraintVertical_9 = Sketch_5.setVertical(SketchLine_36.result()) SketchConstraintHorizontal_10 = Sketch_5.setHorizontal(SketchLine_33.result()) SketchConstraintHorizontal_11 = Sketch_5.setHorizontal(SketchLine_35.result()) -SketchConstraintDistance_12 = Sketch_5.setDistance(SketchLine_33.endPoint(), SketchLine_35.result(), 5) +SketchConstraintDistance_12 = Sketch_5.setDistance( + SketchLine_33.endPoint(), SketchLine_35.result(), 5 +) SketchConstraintDistance_12.setName("SketchConstraintDistance_14") -SketchConstraintDistance_13 = Sketch_5.setDistance(SketchLine_30.endPoint(), SketchLine_37.result(), 82) +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, 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") -SketchConstraintCoincidence_50 = Sketch_5.setCoincident(SketchArc_5.startPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_50 = Sketch_5.setCoincident( + SketchArc_5.startPoint(), SketchLine_34.startPoint() +) SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_57") -SketchConstraintCoincidence_51 = Sketch_5.setCoincident(SketchArc_5.endPoint(), SketchLine_32.endPoint()) +SketchConstraintCoincidence_51 = Sketch_5.setCoincident( + SketchArc_5.endPoint(), SketchLine_32.endPoint() +) SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_58") -SketchConstraintTangent_9 = Sketch_5.setTangent(SketchArc_5.results()[1], SketchLine_32.result()) +SketchConstraintTangent_9 = Sketch_5.setTangent( + SketchArc_5.results()[1], SketchLine_32.result() +) SketchConstraintTangent_9.setName("SketchConstraintTangent_10") -SketchConstraintTangent_10 = Sketch_5.setTangent(SketchArc_5.results()[1], SketchLine_34.result()) +SketchConstraintTangent_10 = Sketch_5.setTangent( + SketchArc_5.results()[1], SketchLine_34.result() +) SketchConstraintTangent_10.setName("SketchConstraintTangent_11") -SketchConstraintCoincidence_52 = Sketch_5.setCoincident(SketchLine_35.startPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_52 = Sketch_5.setCoincident( + SketchLine_35.startPoint(), SketchLine_32.startPoint() +) SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_59") -SketchConstraintCoincidence_53 = Sketch_5.setCoincident(SketchLine_36.endPoint(), SketchLine_34.endPoint()) +SketchConstraintCoincidence_53 = Sketch_5.setCoincident( + SketchLine_36.endPoint(), SketchLine_34.endPoint() +) SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_60") -SketchConstraintCoincidence_54 = Sketch_5.setCoincident(SketchLine_32.endPoint(), SketchLine_35.result()) +SketchConstraintCoincidence_54 = Sketch_5.setCoincident( + SketchLine_32.endPoint(), SketchLine_35.result() +) SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_61") -SketchConstraintCoincidence_55 = Sketch_5.setCoincident(SketchLine_34.startPoint(), SketchLine_36.result()) +SketchConstraintCoincidence_55 = Sketch_5.setCoincident( + SketchLine_34.startPoint(), SketchLine_36.result() +) 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, 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") -SketchConstraintCoincidence_56 = Sketch_5.setCoincident(SketchArc_6.startPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_56 = Sketch_5.setCoincident( + SketchArc_6.startPoint(), SketchLine_32.startPoint() +) SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_63") -SketchConstraintTangent_11 = Sketch_5.setTangent(SketchArc_6.results()[1], SketchLine_32.result()) +SketchConstraintTangent_11 = Sketch_5.setTangent( + SketchArc_6.results()[1], SketchLine_32.result() +) SketchConstraintTangent_11.setName("SketchConstraintTangent_12") -SketchConstraintCoincidence_57 = Sketch_5.setCoincident(SketchLine_33.endPoint(), SketchArc_6.endPoint()) +SketchConstraintCoincidence_57 = Sketch_5.setCoincident( + SketchLine_33.endPoint(), SketchArc_6.endPoint() +) SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_64") SketchConstraintRadius_6 = Sketch_5.setRadius(SketchArc_6.results()[1], 8) SketchConstraintRadius_6.setName("SketchConstraintRadius_7") -SketchConstraintDistance_14 = Sketch_5.setDistance(SketchLine_33.endPoint(), SketchLine_30.result(), 20) +SketchConstraintDistance_14 = Sketch_5.setDistance( + SketchLine_33.endPoint(), SketchLine_30.result(), 20 +) SketchConstraintDistance_14.setName("SketchConstraintDistance_17") -SketchConstraintCoincidence_59 = Sketch_5.setCoincident(SketchLine_34.endPoint(), SketchLine_37.startPoint()) +SketchConstraintCoincidence_59 = Sketch_5.setCoincident( + SketchLine_34.endPoint(), SketchLine_37.startPoint() +) SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_66") -SketchConstraintDistance_15 = Sketch_5.setDistance(SketchLine_37.startPoint(), SketchLine_30.result(), "DBody") +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/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")]) +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") @@ -325,21 +584,29 @@ SketchLine_42 = Sketch_6.addLine(-20, 60, -20, 30) SketchLine_42.setName("SketchLine_44") SketchLine_42.result().setName("SketchLine_44") SketchLine_42.setAuxiliary(True) -SketchConstraintCoincidence_60 = Sketch_6.setCoincident(SketchLine_42.endPoint(), SketchLine_43.startPoint()) +SketchConstraintCoincidence_60 = Sketch_6.setCoincident( + SketchLine_42.endPoint(), SketchLine_43.startPoint() +) SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_67") SketchLine_44 = Sketch_6.addLine(20, 30.00000000000001, 19.99999999999998, 60) SketchLine_44.setName("SketchLine_42") SketchLine_44.result().setName("SketchLine_42") SketchLine_44.setAuxiliary(True) -SketchConstraintCoincidence_61 = Sketch_6.setCoincident(SketchLine_43.endPoint(), SketchLine_44.startPoint()) +SketchConstraintCoincidence_61 = Sketch_6.setCoincident( + SketchLine_43.endPoint(), SketchLine_44.startPoint() +) SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_68") SketchLine_45 = Sketch_6.addLine(19.99999999999998, 60, -19.99999999999999, 60) SketchLine_45.setName("SketchLine_43") SketchLine_45.result().setName("SketchLine_43") SketchLine_45.setAuxiliary(True) -SketchConstraintCoincidence_62 = Sketch_6.setCoincident(SketchLine_44.endPoint(), SketchLine_45.startPoint()) +SketchConstraintCoincidence_62 = Sketch_6.setCoincident( + SketchLine_44.endPoint(), SketchLine_45.startPoint() +) SketchConstraintCoincidence_62.setName("SketchConstraintCoincidence_69") -SketchConstraintCoincidence_63 = Sketch_6.setCoincident(SketchLine_45.endPoint(), SketchLine_42.startPoint()) +SketchConstraintCoincidence_63 = Sketch_6.setCoincident( + SketchLine_45.endPoint(), SketchLine_42.startPoint() +) SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_70") SketchConstraintHorizontal_12 = Sketch_6.setHorizontal(SketchLine_43.result()) SketchConstraintVertical_10 = Sketch_6.setVertical(SketchLine_44.result()) @@ -349,69 +616,126 @@ SketchLine_46 = Sketch_6.addLine(19.99999999999998, 60, -20, 60) SketchLine_46.setName("SketchLine_45") SketchLine_46.result().setName("SketchLine_45") SketchLine_46.setAuxiliary(True) -SketchConstraintCoincidence_64 = Sketch_6.setCoincident(SketchLine_45.startPoint(), SketchLine_46.startPoint()) +SketchConstraintCoincidence_64 = Sketch_6.setCoincident( + SketchLine_45.startPoint(), SketchLine_46.startPoint() +) SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_73") SketchLine_47 = Sketch_6.addLine(-20, 60, -19.99999999999998, 30.00000000000001) SketchLine_47.setName("SketchLine_46") SketchLine_47.result().setName("SketchLine_46") SketchLine_47.setAuxiliary(True) -SketchConstraintCoincidence_65 = Sketch_6.setCoincident(SketchLine_42.endPoint(), SketchLine_47.endPoint()) +SketchConstraintCoincidence_65 = Sketch_6.setCoincident( + SketchLine_42.endPoint(), SketchLine_47.endPoint() +) SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_74") -SketchConstraintCoincidence_66 = Sketch_6.setCoincident(SketchLine_46.endPoint(), SketchLine_45.result()) +SketchConstraintCoincidence_66 = Sketch_6.setCoincident( + SketchLine_46.endPoint(), SketchLine_45.result() +) SketchConstraintCoincidence_66.setName("SketchConstraintCoincidence_75") -SketchConstraintCoincidence_67 = Sketch_6.setCoincident(SketchLine_47.startPoint(), SketchLine_42.result()) +SketchConstraintCoincidence_67 = Sketch_6.setCoincident( + SketchLine_47.startPoint(), SketchLine_42.result() +) SketchConstraintCoincidence_67.setName("SketchConstraintCoincidence_76") SketchLine_48 = Sketch_6.addLine(20, 30.00000000000001, 19.99999999999999, 60) SketchLine_48.setName("SketchLine_47") SketchLine_48.result().setName("SketchLine_47") SketchLine_48.setAuxiliary(True) -SketchConstraintCoincidence_68 = Sketch_6.setCoincident(SketchLine_44.startPoint(), SketchLine_48.startPoint()) +SketchConstraintCoincidence_68 = Sketch_6.setCoincident( + SketchLine_44.startPoint(), SketchLine_48.startPoint() +) SketchConstraintCoincidence_68.setName("SketchConstraintCoincidence_79") -SketchConstraintCoincidence_69 = Sketch_6.setCoincident(SketchLine_46.endPoint(), SketchLine_38.endPoint()) +SketchConstraintCoincidence_69 = Sketch_6.setCoincident( + SketchLine_46.endPoint(), SketchLine_38.endPoint() +) SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_80") -SketchConstraintCoincidence_70 = Sketch_6.setCoincident(SketchLine_48.endPoint(), SketchLine_44.result()) +SketchConstraintCoincidence_70 = Sketch_6.setCoincident( + SketchLine_48.endPoint(), SketchLine_44.result() +) SketchConstraintCoincidence_70.setName("SketchConstraintCoincidence_81") -SketchConstraintCoincidence_71 = Sketch_6.setCoincident(SketchLine_38.startPoint(), SketchLine_46.result()) +SketchConstraintCoincidence_71 = Sketch_6.setCoincident( + SketchLine_38.startPoint(), SketchLine_46.result() +) SketchConstraintCoincidence_71.setName("SketchConstraintCoincidence_82") SketchLine_49 = Sketch_6.addLine(-19.99999999999998, 30.00000000000001, 20, 30) SketchLine_49.setName("SketchLine_49") SketchLine_49.result().setName("SketchLine_49") SketchLine_49.setAuxiliary(True) -SketchConstraintCoincidence_72 = Sketch_6.setCoincident(SketchLine_43.startPoint(), SketchLine_49.startPoint()) +SketchConstraintCoincidence_72 = Sketch_6.setCoincident( + SketchLine_43.startPoint(), SketchLine_49.startPoint() +) SketchConstraintCoincidence_72.setName("SketchConstraintCoincidence_85") -SketchConstraintCoincidence_73 = Sketch_6.setCoincident(SketchLine_48.endPoint(), SketchLine_41.endPoint()) +SketchConstraintCoincidence_73 = Sketch_6.setCoincident( + SketchLine_48.endPoint(), SketchLine_41.endPoint() +) SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_86") -SketchConstraintCoincidence_74 = Sketch_6.setCoincident(SketchLine_49.endPoint(), SketchLine_43.result()) +SketchConstraintCoincidence_74 = Sketch_6.setCoincident( + SketchLine_49.endPoint(), SketchLine_43.result() +) SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_87") -SketchConstraintCoincidence_75 = Sketch_6.setCoincident(SketchLine_41.startPoint(), SketchLine_48.result()) +SketchConstraintCoincidence_75 = Sketch_6.setCoincident( + SketchLine_41.startPoint(), SketchLine_48.result() +) SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_88") -SketchConstraintCoincidence_76 = Sketch_6.setCoincident(SketchLine_47.startPoint(), SketchLine_40.startPoint()) +SketchConstraintCoincidence_76 = Sketch_6.setCoincident( + SketchLine_47.startPoint(), SketchLine_40.startPoint() +) SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_91") -SketchConstraintCoincidence_77 = Sketch_6.setCoincident(SketchLine_49.endPoint(), SketchLine_39.endPoint()) +SketchConstraintCoincidence_77 = Sketch_6.setCoincident( + SketchLine_49.endPoint(), SketchLine_39.endPoint() +) SketchConstraintCoincidence_77.setName("SketchConstraintCoincidence_92") -SketchConstraintCoincidence_78 = Sketch_6.setCoincident(SketchLine_40.endPoint(), SketchLine_47.result()) +SketchConstraintCoincidence_78 = Sketch_6.setCoincident( + SketchLine_40.endPoint(), SketchLine_47.result() +) SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_93") -SketchConstraintCoincidence_79 = Sketch_6.setCoincident(SketchLine_39.startPoint(), SketchLine_49.result()) +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/SketchLine_30_StartVertex")) -SketchConstraintDistance_16 = Sketch_6.setDistance(SketchLine_40.result(), SketchPoint_3.coordinates(), 20) +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) +SketchConstraintDistance_17 = Sketch_6.setDistance( + SketchPoint_3.coordinates(), SketchLine_41.result(), 20 +) SketchConstraintDistance_17.setName("SketchConstraintDistance_19") -SketchConstraintDistance_18 = Sketch_6.setDistance(SketchLine_39.result(), SketchPoint_3.coordinates(), 30) +SketchConstraintDistance_18 = Sketch_6.setDistance( + SketchLine_39.result(), SketchPoint_3.coordinates(), 30 +) SketchConstraintDistance_18.setName("SketchConstraintDistance_20") -SketchConstraintDistance_19 = Sketch_6.setDistance(SketchLine_39.result(), SketchLine_38.endPoint(), 30) +SketchConstraintDistance_19 = Sketch_6.setDistance( + SketchLine_39.result(), SketchLine_38.endPoint(), 30 +) SketchConstraintDistance_19.setName("SketchConstraintDistance_21") -SketchConstraintCoincidence_80 = Sketch_6.setCoincident(SketchLine_40.startPoint(), SketchLine_38.endPoint()) +SketchConstraintCoincidence_80 = Sketch_6.setCoincident( + SketchLine_40.startPoint(), SketchLine_38.endPoint() +) SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_152") -SketchConstraintCoincidence_81 = Sketch_6.setCoincident(SketchLine_38.startPoint(), SketchLine_41.endPoint()) +SketchConstraintCoincidence_81 = Sketch_6.setCoincident( + SketchLine_38.startPoint(), SketchLine_41.endPoint() +) SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_153") -SketchConstraintCoincidence_82 = Sketch_6.setCoincident(SketchLine_40.endPoint(), SketchLine_39.startPoint()) +SketchConstraintCoincidence_82 = Sketch_6.setCoincident( + SketchLine_40.endPoint(), SketchLine_39.startPoint() +) SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_154") -SketchConstraintCoincidence_84 = Sketch_6.setCoincident(SketchLine_41.startPoint(), SketchLine_39.endPoint()) +SketchConstraintCoincidence_84 = Sketch_6.setCoincident( + SketchLine_41.startPoint(), SketchLine_39.endPoint() +) SketchConstraintCoincidence_84.setName("SketchConstraintCoincidence_156") model.do() -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection(), 100, 0, [model.selection("SOLID", "RevolutionFuse_3_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_6")], + model.selection(), + 100, + 0, + [model.selection("SOLID", "RevolutionFuse_3_1")], +) 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") @@ -423,43 +747,74 @@ SketchLine_52 = Sketch_7.addLine(65, 23.09999999999939, 65, 20) SketchLine_52.setName("SketchLine_53") SketchLine_52.result().setName("SketchLine_53") SketchLine_52.setAuxiliary(True) -SketchConstraintCoincidence_85 = Sketch_7.setCoincident(SketchLine_52.startPoint(), SketchLine_51.result()) +SketchConstraintCoincidence_85 = Sketch_7.setCoincident( + SketchLine_52.startPoint(), SketchLine_51.result() +) SketchConstraintCoincidence_85.setName("SketchConstraintCoincidence_95") -SketchLine_53 = Sketch_7.addLine(68.00001763534438, 19.99999999999997, 68.09999999999999, 20) +SketchLine_53 = Sketch_7.addLine( + 68.00001763534438, 19.99999999999997, 68.09999999999999, 20 +) SketchLine_53.setName("SketchLine_62") SketchLine_53.result().setName("SketchLine_62") SketchLine_54 = Sketch_7.addLine(65, 20, 68.09999999999999, 20) SketchLine_54.setName("SketchLine_55") SketchLine_54.result().setName("SketchLine_55") SketchLine_54.setAuxiliary(True) -SketchConstraintCoincidence_86 = Sketch_7.setCoincident(SketchLine_52.endPoint(), SketchLine_54.startPoint()) +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/Modified_Face&Sketch_2/SketchLine_13][RevolutionFuse_3_1/Modified_Face&Sketch_1/SketchLine_7]")) +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()) +SketchConstraintCoincidence_87 = Sketch_7.setCoincident( + SketchLine_54.endPoint(), SketchLine_55.result() +) SketchConstraintCoincidence_87.setName("SketchConstraintCoincidence_97") -SketchLine_56 = Sketch_7.addLine(68.09999999999999, 20, 68.09999999999999, 18.51336352164785) +SketchLine_56 = Sketch_7.addLine( + 68.09999999999999, 20, 68.09999999999999, 18.51336352164785 +) SketchLine_56.setName("SketchLine_57") SketchLine_56.result().setName("SketchLine_57") -SketchConstraintCoincidence_88 = Sketch_7.setCoincident(SketchLine_54.endPoint(), SketchLine_56.startPoint()) +SketchConstraintCoincidence_88 = Sketch_7.setCoincident( + SketchLine_54.endPoint(), SketchLine_56.startPoint() +) SketchConstraintCoincidence_88.setName("SketchConstraintCoincidence_98") -SketchLine_57 = Sketch_7.addLine(68.09999999999999, 18.51336352164785, 63.35445204813018, 18.51336352164785) +SketchLine_57 = Sketch_7.addLine( + 68.09999999999999, 18.51336352164785, 63.35445204813018, 18.51336352164785 +) SketchLine_57.setName("SketchLine_58") SketchLine_57.result().setName("SketchLine_58") -SketchConstraintCoincidence_89 = Sketch_7.setCoincident(SketchLine_56.endPoint(), SketchLine_57.startPoint()) +SketchConstraintCoincidence_89 = Sketch_7.setCoincident( + SketchLine_56.endPoint(), SketchLine_57.startPoint() +) SketchConstraintCoincidence_89.setName("SketchConstraintCoincidence_99") -SketchLine_58 = Sketch_7.addLine(63.35445204813018, 18.51336352164785, 63.35445204813018, 23.09999999999939) +SketchLine_58 = Sketch_7.addLine( + 63.35445204813018, 18.51336352164785, 63.35445204813018, 23.09999999999939 +) SketchLine_58.setName("SketchLine_59") SketchLine_58.result().setName("SketchLine_59") -SketchConstraintCoincidence_90 = Sketch_7.setCoincident(SketchLine_57.endPoint(), SketchLine_58.startPoint()) +SketchConstraintCoincidence_90 = Sketch_7.setCoincident( + SketchLine_57.endPoint(), SketchLine_58.startPoint() +) SketchConstraintCoincidence_90.setName("SketchConstraintCoincidence_100") -SketchLine_59 = Sketch_7.addLine(63.35445204813018, 23.09999999999939, 65, 23.09999999999939) +SketchLine_59 = Sketch_7.addLine( + 63.35445204813018, 23.09999999999939, 65, 23.09999999999939 +) SketchLine_59.setName("SketchLine_60") SketchLine_59.result().setName("SketchLine_60") -SketchConstraintCoincidence_91 = Sketch_7.setCoincident(SketchLine_58.endPoint(), SketchLine_59.startPoint()) +SketchConstraintCoincidence_91 = Sketch_7.setCoincident( + SketchLine_58.endPoint(), SketchLine_59.startPoint() +) SketchConstraintCoincidence_91.setName("SketchConstraintCoincidence_101") -SketchConstraintCoincidence_92 = Sketch_7.setCoincident(SketchLine_52.startPoint(), SketchLine_59.endPoint()) +SketchConstraintCoincidence_92 = Sketch_7.setCoincident( + SketchLine_52.startPoint(), SketchLine_59.endPoint() +) SketchConstraintCoincidence_92.setName("SketchConstraintCoincidence_102") SketchConstraintVertical_12 = Sketch_7.setVertical(SketchLine_52.result()) SketchConstraintHorizontal_14 = Sketch_7.setHorizontal(SketchLine_54.result()) @@ -467,50 +822,96 @@ SketchConstraintHorizontal_15 = Sketch_7.setHorizontal(SketchLine_57.result()) SketchConstraintHorizontal_16 = Sketch_7.setHorizontal(SketchLine_59.result()) SketchConstraintVertical_13 = Sketch_7.setVertical(SketchLine_56.result()) SketchConstraintVertical_14 = Sketch_7.setVertical(SketchLine_58.result()) -SketchArc_7 = Sketch_7.addArc(68, 22.99999999999999, 65, 23.00000523211526, 68.00001763534438, 19.99999999999997, False) +SketchArc_7 = Sketch_7.addArc( + 68, + 22.99999999999999, + 65, + 23.00000523211526, + 68.00001763534438, + 19.99999999999997, + False, +) SketchArc_7.setName("SketchArc_12") SketchArc_7.result().setName("SketchArc_12") SketchArc_7.results()[1].setName("SketchArc_12_2") -SketchConstraintCoincidence_93 = Sketch_7.setCoincident(SketchArc_7.startPoint(), SketchLine_50.endPoint()) +SketchConstraintCoincidence_93 = Sketch_7.setCoincident( + SketchArc_7.startPoint(), SketchLine_50.endPoint() +) SketchConstraintCoincidence_93.setName("SketchConstraintCoincidence_103") -SketchConstraintCoincidence_94 = Sketch_7.setCoincident(SketchArc_7.endPoint(), SketchLine_53.startPoint()) +SketchConstraintCoincidence_94 = Sketch_7.setCoincident( + SketchArc_7.endPoint(), SketchLine_53.startPoint() +) SketchConstraintCoincidence_94.setName("SketchConstraintCoincidence_104") -SketchConstraintTangent_12 = Sketch_7.setTangent(SketchArc_7.results()[1], SketchLine_50.result()) +SketchConstraintTangent_12 = Sketch_7.setTangent( + SketchArc_7.results()[1], SketchLine_50.result() +) SketchConstraintTangent_12.setName("SketchConstraintTangent_21") -SketchConstraintTangent_13 = Sketch_7.setTangent(SketchArc_7.results()[1], SketchLine_53.result()) +SketchConstraintTangent_13 = Sketch_7.setTangent( + SketchArc_7.results()[1], SketchLine_53.result() +) SketchConstraintTangent_13.setName("SketchConstraintTangent_22") -SketchConstraintCoincidence_95 = Sketch_7.setCoincident(SketchLine_52.startPoint(), SketchLine_50.startPoint()) +SketchConstraintCoincidence_95 = Sketch_7.setCoincident( + SketchLine_52.startPoint(), SketchLine_50.startPoint() +) SketchConstraintCoincidence_95.setName("SketchConstraintCoincidence_105") -SketchConstraintCoincidence_96 = Sketch_7.setCoincident(SketchLine_54.endPoint(), SketchLine_53.endPoint()) +SketchConstraintCoincidence_96 = Sketch_7.setCoincident( + SketchLine_54.endPoint(), SketchLine_53.endPoint() +) SketchConstraintCoincidence_96.setName("SketchConstraintCoincidence_106") -SketchConstraintCoincidence_97 = Sketch_7.setCoincident(SketchLine_50.endPoint(), SketchLine_52.result()) +SketchConstraintCoincidence_97 = Sketch_7.setCoincident( + SketchLine_50.endPoint(), SketchLine_52.result() +) SketchConstraintCoincidence_97.setName("SketchConstraintCoincidence_107") -SketchConstraintCoincidence_98 = Sketch_7.setCoincident(SketchLine_53.startPoint(), SketchLine_54.result()) +SketchConstraintCoincidence_98 = Sketch_7.setCoincident( + SketchLine_53.startPoint(), SketchLine_54.result() +) SketchConstraintCoincidence_98.setName("SketchConstraintCoincidence_108") SketchConstraintRadius_7 = Sketch_7.setRadius(SketchArc_7.results()[1], 3) SketchConstraintRadius_7.setName("SketchConstraintRadius_12") -SketchConstraintDistance_20 = Sketch_7.setDistance(SketchLine_53.endPoint(), SketchLine_50.result(), 3.1) +SketchConstraintDistance_20 = Sketch_7.setDistance( + SketchLine_53.endPoint(), SketchLine_50.result(), 3.1 +) SketchConstraintDistance_20.setName("SketchConstraintDistance_22") -SketchConstraintDistance_21 = Sketch_7.setDistance(SketchLine_50.startPoint(), SketchLine_53.result(), 3.1) +SketchConstraintDistance_21 = Sketch_7.setDistance( + SketchLine_50.startPoint(), SketchLine_53.result(), 3.1 +) SketchConstraintDistance_21.setName("SketchConstraintDistance_23") 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")]) +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/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 = Sketch_8.setCoincident( + SketchCircle_1.center(), SketchLine_60.result() +) SketchConstraintCoincidence_99.setName("SketchConstraintCoincidence_109") 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) +SketchConstraintDistance_22 = Sketch_8.setDistance( + SketchCircle_1.center(), SketchLine_61.result(), 45 +) 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_2r")], 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") @@ -518,9 +919,13 @@ SketchLine_62.result().setName("SketchLine_65") SketchLine_63 = Sketch_9.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_63.setName("SketchLine_66") SketchLine_63.result().setName("SketchLine_66") -SketchConstraintCoincidence_100 = Sketch_9.setCoincident(SketchLine_62.startPoint(), SketchLine_63.result()) +SketchConstraintCoincidence_100 = Sketch_9.setCoincident( + SketchLine_62.startPoint(), SketchLine_63.result() +) SketchConstraintCoincidence_100.setName("SketchConstraintCoincidence_110") -SketchConstraintCoincidence_101 = Sketch_9.setCoincident(SketchLine_62.endPoint(), SketchLine_63.result()) +SketchConstraintCoincidence_101 = Sketch_9.setCoincident( + SketchLine_62.endPoint(), SketchLine_63.result() +) SketchConstraintCoincidence_101.setName("SketchConstraintCoincidence_111") SketchLine_64 = Sketch_9.addLine(50, 8, 50, 63.99999981522573) SketchLine_64.setName("SketchLine_91") @@ -528,7 +933,9 @@ SketchLine_64.result().setName("SketchLine_91") SketchLine_65 = Sketch_9.addLine(0, -2, 58, -2) SketchLine_65.setName("SketchLine_67") SketchLine_65.result().setName("SketchLine_67") -SketchConstraintCoincidence_102 = Sketch_9.setCoincident(SketchLine_62.endPoint(), SketchLine_65.startPoint()) +SketchConstraintCoincidence_102 = Sketch_9.setCoincident( + SketchLine_62.endPoint(), SketchLine_65.startPoint() +) SketchConstraintCoincidence_102.setName("SketchConstraintCoincidence_112") SketchLine_66 = Sketch_9.addLine(44.0000002728486, 70, 15, 70) SketchLine_66.setName("SketchLine_92") @@ -540,7 +947,9 @@ SketchLine_68 = Sketch_9.addLine(58, -2, 58, 8) SketchLine_68.setName("SketchLine_68") SketchLine_68.result().setName("SketchLine_68") SketchLine_68.setAuxiliary(True) -SketchConstraintCoincidence_103 = Sketch_9.setCoincident(SketchLine_65.endPoint(), SketchLine_68.startPoint()) +SketchConstraintCoincidence_103 = Sketch_9.setCoincident( + SketchLine_65.endPoint(), SketchLine_68.startPoint() +) SketchConstraintCoincidence_103.setName("SketchConstraintCoincidence_113") SketchLine_69 = Sketch_9.addLine(53.99999482393354, 8, 50, 8) SketchLine_69.setName("SketchLine_94") @@ -549,38 +958,54 @@ SketchLine_70 = Sketch_9.addLine(58, 8, 50, 8) SketchLine_70.setName("SketchLine_69") SketchLine_70.result().setName("SketchLine_69") SketchLine_70.setAuxiliary(True) -SketchConstraintCoincidence_104 = Sketch_9.setCoincident(SketchLine_68.endPoint(), SketchLine_70.startPoint()) +SketchConstraintCoincidence_104 = Sketch_9.setCoincident( + SketchLine_68.endPoint(), SketchLine_70.startPoint() +) SketchConstraintCoincidence_104.setName("SketchConstraintCoincidence_114") SketchLine_71 = Sketch_9.addLine(50, 8, 49.99999999999999, 70) SketchLine_71.setName("SketchLine_70") SketchLine_71.result().setName("SketchLine_70") SketchLine_71.setAuxiliary(True) -SketchConstraintCoincidence_105 = Sketch_9.setCoincident(SketchLine_70.endPoint(), SketchLine_71.startPoint()) +SketchConstraintCoincidence_105 = Sketch_9.setCoincident( + SketchLine_70.endPoint(), SketchLine_71.startPoint() +) SketchConstraintCoincidence_105.setName("SketchConstraintCoincidence_115") SketchLine_72 = Sketch_9.addLine(49.99999999999999, 70, 15, 70) SketchLine_72.setName("SketchLine_71") SketchLine_72.result().setName("SketchLine_71") SketchLine_72.setAuxiliary(True) -SketchConstraintCoincidence_106 = Sketch_9.setCoincident(SketchLine_71.endPoint(), SketchLine_72.startPoint()) +SketchConstraintCoincidence_106 = Sketch_9.setCoincident( + SketchLine_71.endPoint(), SketchLine_72.startPoint() +) SketchConstraintCoincidence_106.setName("SketchConstraintCoincidence_116") SketchLine_73 = Sketch_9.addLine(15, 70, 15, 84) SketchLine_73.setName("SketchLine_72") SketchLine_73.result().setName("SketchLine_72") -SketchConstraintCoincidence_107 = Sketch_9.setCoincident(SketchLine_72.endPoint(), SketchLine_73.startPoint()) +SketchConstraintCoincidence_107 = Sketch_9.setCoincident( + SketchLine_72.endPoint(), SketchLine_73.startPoint() +) SketchConstraintCoincidence_107.setName("SketchConstraintCoincidence_117") SketchLine_74 = Sketch_9.addLine(15, 84, 0, 84) SketchLine_74.setName("SketchLine_73") SketchLine_74.result().setName("SketchLine_73") -SketchConstraintCoincidence_108 = Sketch_9.setCoincident(SketchLine_73.endPoint(), SketchLine_74.startPoint()) +SketchConstraintCoincidence_108 = Sketch_9.setCoincident( + SketchLine_73.endPoint(), SketchLine_74.startPoint() +) SketchConstraintCoincidence_108.setName("SketchConstraintCoincidence_118") -SketchConstraintCoincidence_109 = Sketch_9.setCoincident(SketchLine_62.startPoint(), SketchLine_74.endPoint()) +SketchConstraintCoincidence_109 = Sketch_9.setCoincident( + SketchLine_62.startPoint(), SketchLine_74.endPoint() +) SketchConstraintCoincidence_109.setName("SketchConstraintCoincidence_119") SketchLine_75 = Sketch_9.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_75.setName("SketchLine_74") SketchLine_75.result().setName("SketchLine_74") -SketchConstraintDistance_23 = Sketch_9.setDistance(SketchLine_65.endPoint(), SketchLine_75.result(), 2) +SketchConstraintDistance_23 = Sketch_9.setDistance( + SketchLine_65.endPoint(), SketchLine_75.result(), 2 +) SketchConstraintDistance_23.setName("SketchConstraintDistance_25") -SketchConstraintDistance_24 = Sketch_9.setDistance(SketchLine_65.endPoint(), SketchLine_63.result(), 58) +SketchConstraintDistance_24 = Sketch_9.setDistance( + SketchLine_65.endPoint(), SketchLine_63.result(), 58 +) SketchConstraintDistance_24.setName("SketchConstraintDistance_26") SketchConstraintHorizontal_17 = Sketch_9.setHorizontal(SketchLine_65.result()) SketchConstraintVertical_15 = Sketch_9.setVertical(SketchLine_71.result()) @@ -589,58 +1014,110 @@ SketchConstraintVertical_17 = Sketch_9.setVertical(SketchLine_68.result()) SketchConstraintHorizontal_18 = Sketch_9.setHorizontal(SketchLine_74.result()) SketchConstraintHorizontal_19 = Sketch_9.setHorizontal(SketchLine_72.result()) SketchConstraintHorizontal_20 = Sketch_9.setHorizontal(SketchLine_70.result()) -SketchConstraintDistance_25 = Sketch_9.setDistance(SketchLine_70.endPoint(), SketchLine_62.result(), 50) +SketchConstraintDistance_25 = Sketch_9.setDistance( + SketchLine_70.endPoint(), SketchLine_62.result(), 50 +) SketchConstraintDistance_25.setName("SketchConstraintDistance_27") -SketchConstraintDistance_26 = Sketch_9.setDistance(SketchLine_71.endPoint(), SketchLine_75.result(), 70) +SketchConstraintDistance_26 = Sketch_9.setDistance( + SketchLine_71.endPoint(), SketchLine_75.result(), 70 +) SketchConstraintDistance_26.setName("SketchConstraintDistance_28") -SketchConstraintDistance_27 = Sketch_9.setDistance(SketchLine_72.endPoint(), SketchLine_63.result(), 15) +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/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) +SketchConstraintDistance_28 = Sketch_9.setDistance( + SketchLine_62.startPoint(), SketchLine_76.result(), 2 +) SketchConstraintDistance_28.setName("SketchConstraintDistance_30") -SketchConstraintDistance_29 = Sketch_9.setDistance(SketchLine_71.startPoint(), SketchLine_75.result(), 8) +SketchConstraintDistance_29 = Sketch_9.setDistance( + SketchLine_71.startPoint(), SketchLine_75.result(), 8 +) SketchConstraintDistance_29.setName("SketchConstraintDistance_31") -SketchArc_8 = Sketch_9.addArc(44.00000000000001, 64.00000000000001, 50, 63.99999981522573, 44.0000002728486, 70, False) +SketchArc_8 = Sketch_9.addArc( + 44.00000000000001, + 64.00000000000001, + 50, + 63.99999981522573, + 44.0000002728486, + 70, + False, +) SketchArc_8.setName("SketchArc_22") SketchArc_8.result().setName("SketchArc_22") SketchArc_8.results()[1].setName("SketchArc_22_2") -SketchConstraintCoincidence_110 = Sketch_9.setCoincident(SketchArc_8.startPoint(), SketchLine_64.endPoint()) +SketchConstraintCoincidence_110 = Sketch_9.setCoincident( + SketchArc_8.startPoint(), SketchLine_64.endPoint() +) SketchConstraintCoincidence_110.setName("SketchConstraintCoincidence_140") -SketchConstraintCoincidence_111 = Sketch_9.setCoincident(SketchArc_8.endPoint(), SketchLine_66.startPoint()) +SketchConstraintCoincidence_111 = Sketch_9.setCoincident( + SketchArc_8.endPoint(), SketchLine_66.startPoint() +) SketchConstraintCoincidence_111.setName("SketchConstraintCoincidence_141") -SketchConstraintTangent_14 = Sketch_9.setTangent(SketchArc_8.results()[1], SketchLine_64.result()) +SketchConstraintTangent_14 = Sketch_9.setTangent( + SketchArc_8.results()[1], SketchLine_64.result() +) SketchConstraintTangent_14.setName("SketchConstraintTangent_26") -SketchConstraintTangent_15 = Sketch_9.setTangent(SketchArc_8.results()[1], SketchLine_66.result()) +SketchConstraintTangent_15 = Sketch_9.setTangent( + SketchArc_8.results()[1], SketchLine_66.result() +) SketchConstraintTangent_15.setName("SketchConstraintTangent_27") -SketchConstraintCoincidence_112 = Sketch_9.setCoincident(SketchLine_71.startPoint(), SketchLine_64.startPoint()) +SketchConstraintCoincidence_112 = Sketch_9.setCoincident( + SketchLine_71.startPoint(), SketchLine_64.startPoint() +) SketchConstraintCoincidence_112.setName("SketchConstraintCoincidence_142") -SketchConstraintCoincidence_113 = Sketch_9.setCoincident(SketchLine_72.endPoint(), SketchLine_66.endPoint()) +SketchConstraintCoincidence_113 = Sketch_9.setCoincident( + SketchLine_72.endPoint(), SketchLine_66.endPoint() +) SketchConstraintCoincidence_113.setName("SketchConstraintCoincidence_143") -SketchConstraintCoincidence_114 = Sketch_9.setCoincident(SketchLine_64.endPoint(), SketchLine_71.result()) +SketchConstraintCoincidence_114 = Sketch_9.setCoincident( + SketchLine_64.endPoint(), SketchLine_71.result() +) SketchConstraintCoincidence_114.setName("SketchConstraintCoincidence_144") -SketchConstraintCoincidence_115 = Sketch_9.setCoincident(SketchLine_66.startPoint(), SketchLine_72.result()) +SketchConstraintCoincidence_115 = Sketch_9.setCoincident( + SketchLine_66.startPoint(), SketchLine_72.result() +) SketchConstraintCoincidence_115.setName("SketchConstraintCoincidence_145") -SketchArc_9 = Sketch_9.addArc(54, 4, 58.00000000000001, 3.999997221073, 53.99999482393354, 8, False) +SketchArc_9 = Sketch_9.addArc( + 54, 4, 58.00000000000001, 3.999997221073, 53.99999482393354, 8, False +) SketchArc_9.setName("SketchArc_23") SketchArc_9.result().setName("SketchArc_23") SketchArc_9.results()[1].setName("SketchArc_23_2") -SketchConstraintCoincidence_116 = Sketch_9.setCoincident(SketchArc_9.startPoint(), SketchLine_67.endPoint()) +SketchConstraintCoincidence_116 = Sketch_9.setCoincident( + SketchArc_9.startPoint(), SketchLine_67.endPoint() +) SketchConstraintCoincidence_116.setName("SketchConstraintCoincidence_146") -SketchConstraintCoincidence_117 = Sketch_9.setCoincident(SketchArc_9.endPoint(), SketchLine_69.startPoint()) +SketchConstraintCoincidence_117 = Sketch_9.setCoincident( + SketchArc_9.endPoint(), SketchLine_69.startPoint() +) SketchConstraintCoincidence_117.setName("SketchConstraintCoincidence_147") -SketchConstraintTangent_16 = Sketch_9.setTangent(SketchArc_9.results()[1], SketchLine_67.result()) +SketchConstraintTangent_16 = Sketch_9.setTangent( + SketchArc_9.results()[1], SketchLine_67.result() +) SketchConstraintTangent_16.setName("SketchConstraintTangent_28") -SketchConstraintTangent_17 = Sketch_9.setTangent(SketchArc_9.results()[1], SketchLine_69.result()) +SketchConstraintTangent_17 = Sketch_9.setTangent( + SketchArc_9.results()[1], SketchLine_69.result() +) SketchConstraintTangent_17.setName("SketchConstraintTangent_29") -SketchConstraintCoincidence_118 = Sketch_9.setCoincident(SketchLine_68.startPoint(), SketchLine_67.startPoint()) +SketchConstraintCoincidence_118 = Sketch_9.setCoincident( + SketchLine_68.startPoint(), SketchLine_67.startPoint() +) SketchConstraintCoincidence_118.setName("SketchConstraintCoincidence_148") -SketchConstraintCoincidence_119 = Sketch_9.setCoincident(SketchLine_70.endPoint(), SketchLine_69.endPoint()) +SketchConstraintCoincidence_119 = Sketch_9.setCoincident( + SketchLine_70.endPoint(), SketchLine_69.endPoint() +) SketchConstraintCoincidence_119.setName("SketchConstraintCoincidence_149") -SketchConstraintCoincidence_120 = Sketch_9.setCoincident(SketchLine_67.endPoint(), SketchLine_68.result()) +SketchConstraintCoincidence_120 = Sketch_9.setCoincident( + SketchLine_67.endPoint(), SketchLine_68.result() +) SketchConstraintCoincidence_120.setName("SketchConstraintCoincidence_150") -SketchConstraintCoincidence_121 = Sketch_9.setCoincident(SketchLine_69.startPoint(), SketchLine_70.result()) +SketchConstraintCoincidence_121 = Sketch_9.setCoincident( + SketchLine_69.startPoint(), SketchLine_70.result() +) SketchConstraintCoincidence_121.setName("SketchConstraintCoincidence_151") SketchConstraintRadius_9 = Sketch_9.setRadius(SketchArc_8.results()[1], 6) SketchConstraintRadius_9.setName("SketchConstraintRadius_16") @@ -651,83 +1128,206 @@ 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_2_1/Modified_Face&Sketch_1/SketchLine_8)(ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)2(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchArc_1_2)2(RevolutionFuse_2_1/Generated_Face&Sketch_4/SketchLine_27)2(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_2_1/From_Face)2_ExtrusionCut_2_1][RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8][(RevolutionFuse_2_1/Generated_Face&Sketch_4/SketchLine_27)(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_2_1/From_Face)(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_3_1/Modified_Face&Sketch_4/SketchArc_4_2)2(ExtrusionCut_2_1/Modified_Face&Sketch_5/SketchLine_40)2][RevolutionFuse_2_1/Generated_Face&Sketch_4/SketchLine_27]")) -SketchConstraintCoincidence_122 = Sketch_10.setCoincident(SketchLine_77.startPoint(), SketchPoint_4.result()) +SketchPoint_4 = Sketch_10.addPoint( + model.selection( + "VERTEX", + "[(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)(ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)2(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchArc_1_2)2(RevolutionFuse_2_1/Generated_Face&Sketch_4/SketchLine_27)2(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_2_1/From_Face)2_ExtrusionCut_2_1][RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8][(RevolutionFuse_2_1/Generated_Face&Sketch_4/SketchLine_27)(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_2_1/From_Face)(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_3_1/Modified_Face&Sketch_4/SketchArc_4_2)2(ExtrusionCut_2_1/Modified_Face&Sketch_5/SketchLine_40)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/SketchLine_1_StartVertex")) -SketchConstraintCoincidence_123 = Sketch_10.setCoincident(SketchLine_77.endPoint(), SketchPoint_5.result()) +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_1_1/Modified_Face&Sketch_2/SketchLine_14)(ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchArc_2_2)2(RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20)2(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_1_1/To_Face)2_ExtrusionCut_2_1][RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14][(RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20)(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_1_1/To_Face)(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)2(RevolutionFuse_3_1/Modified_Face&Sketch_3/SketchArc_3_2)2(ExtrusionCut_2_1/Modified_Face&Sketch_5/SketchLine_40)2][RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20]")) -SketchConstraintCoincidence_124 = Sketch_10.setCoincident(SketchLine_78.startPoint(), SketchPoint_6.result()) +SketchPoint_6 = Sketch_10.addPoint( + model.selection( + "VERTEX", + "[(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)(ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchArc_2_2)2(RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20)2(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_1_1/To_Face)2_ExtrusionCut_2_1][RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14][(RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20)(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_1_1/To_Face)(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)2(RevolutionFuse_3_1/Modified_Face&Sketch_3/SketchArc_3_2)2(ExtrusionCut_2_1/Modified_Face&Sketch_5/SketchLine_40)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/Modified_Face&Sketch_1/SketchLine_8)(ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchArc_1_2)2(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)2(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2_ExtrusionCut_2_1][ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8][(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)(ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchArc_2_2)2(RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20)2(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_1_1/To_Face)2_ExtrusionCut_2_1][RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14]")) -SketchConstraintCoincidence_125 = Sketch_10.setCoincident(SketchLine_78.endPoint(), SketchPoint_7.result()) +SketchPoint_7 = Sketch_10.addPoint( + model.selection( + "VERTEX", + "[(ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)(ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchArc_1_2)2(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)2(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2_ExtrusionCut_2_1][ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8][(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)(ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchArc_2_2)2(RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20)2(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_1_1/To_Face)2_ExtrusionCut_2_1][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, 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") -SketchConstraintCoincidence_126 = Sketch_10.setCoincident(SketchArc_10.startPoint(), SketchLine_78.endPoint()) +SketchConstraintCoincidence_126 = Sketch_10.setCoincident( + SketchArc_10.startPoint(), SketchLine_78.endPoint() +) SketchConstraintCoincidence_126.setName("SketchConstraintCoincidence_124") -SketchConstraintTangent_18 = Sketch_10.setTangent(SketchArc_10.results()[1], SketchLine_78.result()) +SketchConstraintTangent_18 = Sketch_10.setTangent( + SketchArc_10.results()[1], SketchLine_78.result() +) SketchConstraintTangent_18.setName("SketchConstraintTangent_23") -SketchConstraintCoincidence_127 = Sketch_10.setCoincident(SketchLine_77.endPoint(), SketchArc_10.endPoint()) +SketchConstraintCoincidence_127 = Sketch_10.setCoincident( + SketchLine_77.endPoint(), SketchArc_10.endPoint() +) SketchConstraintCoincidence_127.setName("SketchConstraintCoincidence_125") -SketchConstraintCoincidence_128 = Sketch_10.setCoincident(SketchPoint_5.coordinates(), SketchArc_10.endPoint()) +SketchConstraintCoincidence_128 = Sketch_10.setCoincident( + SketchPoint_5.coordinates(), SketchArc_10.endPoint() +) SketchConstraintCoincidence_128.setName("SketchConstraintCoincidence_126") -SketchArc_11 = Sketch_10.addArc(63.9999997725999, -23.01134810362887, 64, -20, 61.15622559702544, -22.02080994708719, False) +SketchArc_11 = Sketch_10.addArc( + 63.9999997725999, + -23.01134810362887, + 64, + -20, + 61.15622559702544, + -22.02080994708719, + False, +) SketchArc_11.setName("SketchArc_14") SketchArc_11.result().setName("SketchArc_14") SketchArc_11.results()[1].setName("SketchArc_14_2") -SketchConstraintCoincidence_129 = Sketch_10.setCoincident(SketchArc_11.startPoint(), SketchLine_78.startPoint()) +SketchConstraintCoincidence_129 = Sketch_10.setCoincident( + SketchArc_11.startPoint(), SketchLine_78.startPoint() +) SketchConstraintCoincidence_129.setName("SketchConstraintCoincidence_127") -SketchConstraintTangent_19 = Sketch_10.setTangent(SketchArc_11.results()[1], SketchLine_78.result()) +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_1_1/Generated_Face&Sketch_3/SketchLine_20)(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_1_1/To_Face)(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)2(RevolutionFuse_3_1/Modified_Face&Sketch_3/SketchArc_3_2)2(ExtrusionCut_2_1/Modified_Face&Sketch_5/SketchLine_40)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()) +SketchPoint_8 = Sketch_10.addPoint( + model.selection( + "VERTEX", + "[(RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20)(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_1_1/To_Face)(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)2(RevolutionFuse_3_1/Modified_Face&Sketch_3/SketchArc_3_2)2(ExtrusionCut_2_1/Modified_Face&Sketch_5/SketchLine_40)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) +SketchArc_12 = Sketch_10.addArc( + 64.00001789135865, + 23.01137360115889, + 64, + 20, + 61.15622559702543, + 22.02080994708722, + True, +) SketchArc_12.setName("SketchArc_15") SketchArc_12.result().setName("SketchArc_15") SketchArc_12.results()[1].setName("SketchArc_15_2") -SketchConstraintCoincidence_131 = Sketch_10.setCoincident(SketchArc_12.startPoint(), SketchLine_77.startPoint()) +SketchConstraintCoincidence_131 = Sketch_10.setCoincident( + SketchArc_12.startPoint(), SketchLine_77.startPoint() +) SketchConstraintCoincidence_131.setName("SketchConstraintCoincidence_129") -SketchConstraintTangent_20 = Sketch_10.setTangent(SketchArc_12.results()[1], SketchLine_77.result()) +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_2_1/Generated_Face&Sketch_4/SketchLine_27)(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_2_1/From_Face)(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_3_1/Modified_Face&Sketch_4/SketchArc_4_2)2(ExtrusionCut_2_1/Modified_Face&Sketch_5/SketchLine_40)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()) +SketchPoint_9 = Sketch_10.addPoint( + model.selection( + "VERTEX", + "[(RevolutionFuse_2_1/Generated_Face&Sketch_4/SketchLine_27)(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_2_1/From_Face)(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_3_1/Modified_Face&Sketch_4/SketchArc_4_2)2(ExtrusionCut_2_1/Modified_Face&Sketch_5/SketchLine_40)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) +SketchLine_79 = Sketch_10.addLine( + 61.15622559702543, 22.02080994708722, 59.81204392543111, 22.0208099470871 +) SketchLine_79.setName("SketchLine_78") SketchLine_79.result().setName("SketchLine_78") -SketchConstraintCoincidence_133 = Sketch_10.setCoincident(SketchArc_12.endPoint(), SketchLine_79.startPoint()) +SketchConstraintCoincidence_133 = Sketch_10.setCoincident( + SketchArc_12.endPoint(), SketchLine_79.startPoint() +) SketchConstraintCoincidence_133.setName("SketchConstraintCoincidence_131") -SketchConstraintCoincidence_134 = Sketch_10.setCoincident(SketchPoint_9.coordinates(), SketchLine_79.startPoint()) +SketchConstraintCoincidence_134 = Sketch_10.setCoincident( + SketchPoint_9.coordinates(), SketchLine_79.startPoint() +) SketchConstraintCoincidence_134.setName("SketchConstraintCoincidence_132") -SketchLine_80 = Sketch_10.addLine(59.81204392543111, 22.0208099470871, 59.81204392543111, -22.02080994708712) +SketchLine_80 = Sketch_10.addLine( + 59.81204392543111, 22.0208099470871, 59.81204392543111, -22.02080994708712 +) SketchLine_80.setName("SketchLine_79") SketchLine_80.result().setName("SketchLine_79") -SketchConstraintCoincidence_135 = Sketch_10.setCoincident(SketchLine_79.endPoint(), SketchLine_80.startPoint()) +SketchConstraintCoincidence_135 = Sketch_10.setCoincident( + SketchLine_79.endPoint(), SketchLine_80.startPoint() +) SketchConstraintCoincidence_135.setName("SketchConstraintCoincidence_133") -SketchLine_81 = Sketch_10.addLine(61.15622559702544, -22.02080994708719, 59.81204392543111, -22.02080994708712) +SketchLine_81 = Sketch_10.addLine( + 61.15622559702544, -22.02080994708719, 59.81204392543111, -22.02080994708712 +) SketchLine_81.setName("SketchLine_80") SketchLine_81.result().setName("SketchLine_80") -SketchConstraintCoincidence_136 = Sketch_10.setCoincident(SketchArc_11.endPoint(), SketchLine_81.startPoint()) +SketchConstraintCoincidence_136 = Sketch_10.setCoincident( + SketchArc_11.endPoint(), SketchLine_81.startPoint() +) SketchConstraintCoincidence_136.setName("SketchConstraintCoincidence_134") -SketchConstraintCoincidence_137 = Sketch_10.setCoincident(SketchPoint_8.coordinates(), SketchLine_81.startPoint()) +SketchConstraintCoincidence_137 = Sketch_10.setCoincident( + SketchPoint_8.coordinates(), SketchLine_81.startPoint() +) SketchConstraintCoincidence_137.setName("SketchConstraintCoincidence_135") -SketchConstraintCoincidence_138 = Sketch_10.setCoincident(SketchLine_80.endPoint(), SketchLine_81.endPoint()) +SketchConstraintCoincidence_138 = Sketch_10.setCoincident( + SketchLine_80.endPoint(), SketchLine_81.endPoint() +) 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()) +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/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() +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() SketchArc_18.setName("SketchArc_21") SketchArc_18.result().setName("SketchArc_21") SketchArc_18.results()[1].setName("SketchArc_21_2") @@ -767,30 +1367,93 @@ 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-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")]) +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/SketchLine_9_EndVertex")) -SketchConstraintCoincidence_139 = Sketch_11.setCoincident(SketchCircle_2.center(), SketchPoint_11.result()) +SketchPoint_11 = Sketch_11.addPoint( + model.selection("VERTEX", "Sketch_2/SketchLine_9_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) SketchConstraintRadius_11.setName("SketchConstraintRadius_14") SketchCircle_3 = Sketch_11.addCircle(89, 0, 12) -SketchConstraintCoincidence_140 = Sketch_11.setCoincident(SketchCircle_2.center(), SketchCircle_3.center()) +SketchConstraintCoincidence_140 = Sketch_11.setCoincident( + SketchCircle_2.center(), SketchCircle_3.center() +) SketchConstraintCoincidence_140.setName("SketchConstraintCoincidence_138") -SketchConstraintCoincidence_141 = Sketch_11.setCoincident(SketchPoint_11.coordinates(), SketchCircle_3.center()) +SketchConstraintCoincidence_141 = Sketch_11.setCoincident( + SketchPoint_11.coordinates(), SketchCircle_3.center() +) SketchConstraintCoincidence_141.setName("SketchConstraintCoincidence_139") SketchConstraintRadius_12 = Sketch_11.setRadius(SketchCircle_3.results()[1], 12) SketchConstraintRadius_12.setName("SketchConstraintRadius_15") SketchPoint_12 = Sketch_11.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchMultiRotation_2 = Sketch_11.addRotation([SketchCircle_3.results()[1], SketchCircle_2.results()[1]], SketchPoint_12.coordinates(), 120, 3) -[SketchCircle_4, SketchCircle_5, SketchCircle_6, SketchCircle_7] = SketchMultiRotation_2.rotated() +SketchMultiRotation_2 = Sketch_11.addRotation( + [SketchCircle_3.results()[1], SketchCircle_2.results()[1]], + SketchPoint_12.coordinates(), + 120, + 3, +) +[ + 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_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")]) +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_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) diff --git a/test.compatibility/clothespin.py b/test.compatibility/clothespin.py index c7bec2e0a..ee4bebd38 100644 --- a/test.compatibility/clothespin.py +++ b/test.compatibility/clothespin.py @@ -27,52 +27,74 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 60, 0) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(60, 0, 60, 1.5) SketchLine_2.setName("SketchLine_3") SketchLine_2.result().setName("SketchLine_3") -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3") SketchLine_3 = Sketch_1.addLine(60, 1.5, 57, 1.5) SketchLine_3.setName("SketchLine_4") SketchLine_3.result().setName("SketchLine_4") -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_4") SketchLine_4 = Sketch_1.addLine(57, 1.5, 29, 7.5) SketchLine_4.setName("SketchLine_5") SketchLine_4.result().setName("SketchLine_5") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5") SketchLine_5 = Sketch_1.addLine(28, 7.5, 28, 8) SketchLine_5.setName("SketchLine_7") SketchLine_5.result().setName("SketchLine_7") -SketchArc_1 = Sketch_1.addArc(25.00007393928819, 7.9789374678129, 28, 8, 22.00014787857639, 8, False) +SketchArc_1 = Sketch_1.addArc( + 25.00007393928819, 7.9789374678129, 28, 8, 22.00014787857639, 8, False +) SketchLine_6 = Sketch_1.addLine(22.00014787857639, 8, 22.00014787857639, 7.5) SketchLine_6.setName("SketchLine_8") SketchLine_6.result().setName("SketchLine_8") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_6.startPoint() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_8") SketchLine_7 = Sketch_1.addLine(22.00014787857639, 7.5, 21.00014787857639, 7.5) SketchLine_7.setName("SketchLine_9") SketchLine_7.result().setName("SketchLine_9") -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_9") SketchLine_8 = Sketch_1.addLine(0, 0, 0, 3.5) SketchLine_8.setName("SketchLine_10") SketchLine_8.result().setName("SketchLine_10") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_10") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_11") SketchLine_9 = Sketch_1.addLine(0, 3.5, 8, 5) SketchLine_9.setName("SketchLine_11") SketchLine_9.result().setName("SketchLine_11") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_13") SketchLine_10 = Sketch_1.addLine(8, 5, 10.426976887961, 4.40018070612629) SketchLine_10.setName("SketchLine_12") SketchLine_10.result().setName("SketchLine_12") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_14") SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 60) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) @@ -82,120 +104,231 @@ SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintHorizontal_3.setName("SketchConstraintHorizontal_4") SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchArc_1.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchArc_1.startPoint() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_15") SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_1.result(), 3.5, False) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_9.endPoint(), SketchLine_8.result(), 8, False) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_1.result(), 3.5, False +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_9.endPoint(), SketchLine_8.result(), 8, False +) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_10.result(), 2.5) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 3) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_6.result(), 0.5) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_7.result(), 1) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_5.result(), 0.5) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_1.result(), 7.5, False) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.endPoint(), SketchLine_1.result(), 7.5, False +) SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_3.result(), 3) SketchConstraintLength_6.setName("SketchConstraintLength_7") SketchConstraintLength_7 = Sketch_1.setLength(SketchLine_2.result(), 1.5) SketchConstraintLength_7.setName("SketchConstraintLength_8") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_9.endPoint(), SketchLine_1.result(), 5, False) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_5.startPoint(), SketchLine_1.result(), 7.5, False) -SketchLine_11 = Sketch_1.addLine(12.81710695710752, 0, 12.81710695710752, 7.765286531476907) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_9.endPoint(), SketchLine_1.result(), 5, False +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_5.startPoint(), SketchLine_1.result(), 7.5, False +) +SketchLine_11 = Sketch_1.addLine( + 12.81710695710752, 0, 12.81710695710752, 7.765286531476907 +) SketchLine_11.setName("SketchLine_13") SketchLine_11.result().setName("SketchLine_13") SketchLine_11.setAuxiliary(True) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_1.result() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_16") SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_11.result()) SketchPoint_2 = Sketch_1.addPoint(12.81710695710752, 3) SketchPoint_2.setAuxiliary(True) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_11.result()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_11.result() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_17") -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_1.result(), 3, False) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchPoint_2.coordinates(), SketchLine_1.result(), 3, False +) SketchLine_12 = Sketch_1.addLine(28, 7.5, 29, 7.5) SketchLine_12.setName("SketchLine_14") SketchLine_12.result().setName("SketchLine_14") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_12.startPoint() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_18") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_12.endPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_12.endPoint() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_19") SketchConstraintLength_8 = Sketch_1.setLength(SketchLine_12.result(), 1) SketchConstraintLength_8.setName("SketchConstraintLength_9") -SketchArc_2 = Sketch_1.addArc(14.78851987160339, 9.105317068618911, 10.426976887961, 4.40018070612629, 21.00014787857639, 7.5, False) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_2.startPoint()) +SketchArc_2 = Sketch_1.addArc( + 14.78851987160339, + 9.105317068618911, + 10.426976887961, + 4.40018070612629, + 21.00014787857639, + 7.5, + False, +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchArc_2.startPoint() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_20") -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchArc_2.endPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchArc_2.endPoint() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_21") -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchArc_2.results()[1]) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchArc_2.results()[1] +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_22") SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_12.result()) SketchConstraintHorizontal_4.setName("SketchConstraintHorizontal_9") -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_5.startPoint(), SketchLine_2.result(), 32, False) +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/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) +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&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]")) +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 = Sketch_2.setCoincident( + SketchArc_3.startPoint(), SketchLine_13.result() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_23") 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 = 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&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]")) +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()) -SketchConstraintDistance_8 = Sketch_2.setDistance(SketchArc_3.startPoint(), SketchLine_15.result(), 6, False) +SketchConstraintTangent_1 = Sketch_2.setTangent( + SketchArc_3.results()[1], SketchLine_15.result() +) +SketchConstraintDistance_8 = Sketch_2.setDistance( + SketchArc_3.startPoint(), SketchLine_15.result(), 6, False +) SketchConstraintDistance_8.setName("SketchConstraintDistance_7") SketchLine_16 = Sketch_2.addLine(54, 12, 53.10174978726379, 13.92603605930655) SketchLine_16.setName("SketchLine_18") SketchLine_16.result().setName("SketchLine_18") -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchArc_3.startPoint(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchArc_3.startPoint(), SketchLine_16.startPoint() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_25") -SketchLine_17 = Sketch_2.addLine(53.10174978726379, 13.92603605930655, 63.82610057919769, 13.82486293862793) +SketchLine_17 = Sketch_2.addLine( + 53.10174978726379, 13.92603605930655, 63.82610057919769, 13.82486293862793 +) SketchLine_17.setName("SketchLine_19") SketchLine_17.result().setName("SketchLine_19") -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_26") -SketchLine_18 = Sketch_2.addLine(63.82610057919769, 13.82486293862793, 62.66260969139353, -3.07104821470189) +SketchLine_18 = Sketch_2.addLine( + 63.82610057919769, 13.82486293862793, 62.66260969139353, -3.07104821470189 +) SketchLine_18.setName("SketchLine_20") SketchLine_18.result().setName("SketchLine_20") -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_27") -SketchLine_19 = Sketch_2.addLine(62.66260969139353, -3.07104821470189, 53.10174978726379, -2.868701973344648) +SketchLine_19 = Sketch_2.addLine( + 62.66260969139353, -3.07104821470189, 53.10174978726379, -2.868701973344648 +) SketchLine_19.setName("SketchLine_21") SketchLine_19.result().setName("SketchLine_21") -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_28") SketchLine_20 = Sketch_2.addLine(53.10174978726379, -2.868701973344648, 54, 0) SketchLine_20.setName("SketchLine_22") SketchLine_20.result().setName("SketchLine_22") -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_29") -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchArc_3.endPoint(), SketchLine_20.endPoint()) +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-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")) +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&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14]")) +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()) +SketchConstraintCoincidence_27 = Sketch_3.setCoincident( + SketchLine_21.startPoint(), SketchLine_22.result() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_31") SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_21.result()) SketchLine_23 = Sketch_3.addLine(28, -6, 63.78468475453244, -6) SketchLine_23.setName("SketchLine_25") SketchLine_23.result().setName("SketchLine_25") SketchLine_23.setAuxiliary(True) -SketchConstraintCoincidence_28 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_23.startPoint()) +SketchConstraintCoincidence_28 = Sketch_3.setCoincident( + SketchLine_21.startPoint(), SketchLine_23.startPoint() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_32") SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_23.result()) SketchLine_24 = Sketch_3.addLine(60, -1.5, 29, -1.5) @@ -210,13 +343,21 @@ SketchLine_26.result().setName("SketchLine_28") SketchLine_27 = Sketch_3.addLine(60, -10.5, 60, -1.5) SketchLine_27.setName("SketchLine_29") SketchLine_27.result().setName("SketchLine_29") -SketchConstraintCoincidence_29 = Sketch_3.setCoincident(SketchLine_27.endPoint(), SketchLine_24.startPoint()) +SketchConstraintCoincidence_29 = Sketch_3.setCoincident( + SketchLine_27.endPoint(), SketchLine_24.startPoint() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_33") -SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint()) +SketchConstraintCoincidence_30 = Sketch_3.setCoincident( + SketchLine_24.endPoint(), SketchLine_25.startPoint() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_34") -SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchLine_25.endPoint(), SketchLine_26.startPoint()) +SketchConstraintCoincidence_31 = Sketch_3.setCoincident( + SketchLine_25.endPoint(), SketchLine_26.startPoint() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_35") -SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchLine_26.endPoint(), SketchLine_27.startPoint()) +SketchConstraintCoincidence_32 = Sketch_3.setCoincident( + SketchLine_26.endPoint(), SketchLine_27.startPoint() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_36") SketchConstraintHorizontal_7 = Sketch_3.setHorizontal(SketchLine_24.result()) SketchConstraintVertical_6 = Sketch_3.setVertical(SketchLine_25.result()) @@ -226,56 +367,96 @@ SketchLine_28 = Sketch_3.addLine(29, -10.5, 60, -1.5) SketchLine_28.setName("SketchLine_30") SketchLine_28.result().setName("SketchLine_30") SketchLine_28.setAuxiliary(True) -SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchLine_25.endPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_33 = Sketch_3.setCoincident( + SketchLine_25.endPoint(), SketchLine_28.startPoint() +) SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_37") -SketchConstraintCoincidence_34 = Sketch_3.setCoincident(SketchLine_26.startPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_34 = Sketch_3.setCoincident( + SketchLine_26.startPoint(), SketchLine_28.startPoint() +) SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_38") -SketchConstraintCoincidence_35 = Sketch_3.setCoincident(SketchLine_24.startPoint(), SketchLine_28.endPoint()) +SketchConstraintCoincidence_35 = Sketch_3.setCoincident( + SketchLine_24.startPoint(), SketchLine_28.endPoint() +) SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_39") -SketchConstraintCoincidence_36 = Sketch_3.setCoincident(SketchLine_27.endPoint(), SketchLine_28.endPoint()) +SketchConstraintCoincidence_36 = Sketch_3.setCoincident( + SketchLine_27.endPoint(), SketchLine_28.endPoint() +) SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_40") SketchLine_29 = Sketch_3.addLine(29, -1.5, 60, -10.5) SketchLine_29.setName("SketchLine_31") SketchLine_29.result().setName("SketchLine_31") SketchLine_29.setAuxiliary(True) -SketchConstraintCoincidence_37 = Sketch_3.setCoincident(SketchLine_24.endPoint(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_37 = Sketch_3.setCoincident( + SketchLine_24.endPoint(), SketchLine_29.startPoint() +) SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_41") -SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchLine_25.startPoint(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_38 = Sketch_3.setCoincident( + SketchLine_25.startPoint(), SketchLine_29.startPoint() +) SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_42") -SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_26.endPoint(), SketchLine_29.endPoint()) +SketchConstraintCoincidence_39 = Sketch_3.setCoincident( + SketchLine_26.endPoint(), SketchLine_29.endPoint() +) SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_43") -SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_27.startPoint(), SketchLine_29.endPoint()) +SketchConstraintCoincidence_40 = Sketch_3.setCoincident( + SketchLine_27.startPoint(), SketchLine_29.endPoint() +) SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_44") SketchPoint_3 = Sketch_3.addPoint(44.5, -6) SketchPoint_3.setAuxiliary(True) -SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_29.result()) +SketchConstraintCoincidence_41 = Sketch_3.setCoincident( + SketchPoint_3.coordinates(), SketchLine_29.result() +) SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_45") -SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchPoint_3.coordinates(), SketchLine_29.result()) -SketchConstraintCoincidence_42 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_23.result()) +SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint( + SketchPoint_3.coordinates(), SketchLine_29.result() +) +SketchConstraintCoincidence_42 = Sketch_3.setCoincident( + SketchPoint_3.coordinates(), SketchLine_23.result() +) SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_46") -SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_22.startPoint(), SketchLine_23.result(), 6, False) +SketchConstraintDistance_9 = Sketch_3.setDistance( + SketchLine_22.startPoint(), SketchLine_23.result(), 6, False +) SketchConstraintDistance_9.setName("SketchConstraintDistance_8") SketchConstraintLength_9 = Sketch_3.setLength(SketchLine_27.result(), 9) SketchConstraintLength_9.setName("SketchConstraintLength_10") -SketchLine_30 = Sketch_3.addLine(21.00014787857639, -1.499999999999981, 12.00014787857639, -1.499999999999981) +SketchLine_30 = Sketch_3.addLine( + 21.00014787857639, -1.499999999999981, 12.00014787857639, -1.499999999999981 +) SketchLine_30.setName("SketchLine_32") SketchLine_30.result().setName("SketchLine_32") -SketchLine_31 = Sketch_3.addLine(12.00014787857639, -1.499999999999981, 12.00014787857639, -10.49999999999998) +SketchLine_31 = Sketch_3.addLine( + 12.00014787857639, -1.499999999999981, 12.00014787857639, -10.49999999999998 +) SketchLine_31.setName("SketchLine_33") SketchLine_31.result().setName("SketchLine_33") -SketchLine_32 = Sketch_3.addLine(12.00014787857639, -10.49999999999998, 21.00014787857639, -10.49999999999998) +SketchLine_32 = Sketch_3.addLine( + 12.00014787857639, -10.49999999999998, 21.00014787857639, -10.49999999999998 +) SketchLine_32.setName("SketchLine_34") SketchLine_32.result().setName("SketchLine_34") -SketchLine_33 = Sketch_3.addLine(21.00014787857639, -10.49999999999998, 21.00014787857639, -1.499999999999981) +SketchLine_33 = Sketch_3.addLine( + 21.00014787857639, -10.49999999999998, 21.00014787857639, -1.499999999999981 +) SketchLine_33.setName("SketchLine_35") SketchLine_33.result().setName("SketchLine_35") -SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchLine_33.endPoint(), SketchLine_30.startPoint()) +SketchConstraintCoincidence_43 = Sketch_3.setCoincident( + SketchLine_33.endPoint(), SketchLine_30.startPoint() +) SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_47") -SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_44 = Sketch_3.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_48") -SketchConstraintCoincidence_45 = Sketch_3.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_45 = Sketch_3.setCoincident( + SketchLine_31.endPoint(), SketchLine_32.startPoint() +) SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_49") -SketchConstraintCoincidence_46 = Sketch_3.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_46 = Sketch_3.setCoincident( + SketchLine_32.endPoint(), SketchLine_33.startPoint() +) SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_50") SketchConstraintHorizontal_9 = Sketch_3.setHorizontal(SketchLine_30.result()) SketchConstraintHorizontal_9.setName("SketchConstraintHorizontal_10") @@ -283,72 +464,174 @@ SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_31.result()) SketchConstraintHorizontal_10 = Sketch_3.setHorizontal(SketchLine_32.result()) SketchConstraintHorizontal_10.setName("SketchConstraintHorizontal_11") SketchConstraintVertical_9 = Sketch_3.setVertical(SketchLine_33.result()) -SketchConstraintEqual_1 = Sketch_3.setEqual(SketchLine_25.result(), SketchLine_33.result()) -SketchLine_34 = Sketch_3.addLine(12.00014787857639, -10.49999999999998, 21.00014787857639, -1.499999999999981) +SketchConstraintEqual_1 = Sketch_3.setEqual( + SketchLine_25.result(), SketchLine_33.result() +) +SketchLine_34 = Sketch_3.addLine( + 12.00014787857639, -10.49999999999998, 21.00014787857639, -1.499999999999981 +) SketchLine_34.setName("SketchLine_36") SketchLine_34.result().setName("SketchLine_36") SketchLine_34.setAuxiliary(True) -SketchConstraintCoincidence_47 = Sketch_3.setCoincident(SketchLine_31.endPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_47 = Sketch_3.setCoincident( + SketchLine_31.endPoint(), SketchLine_34.startPoint() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_51") -SketchConstraintCoincidence_48 = Sketch_3.setCoincident(SketchLine_32.startPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_48 = Sketch_3.setCoincident( + SketchLine_32.startPoint(), SketchLine_34.startPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_52") -SketchConstraintCoincidence_49 = Sketch_3.setCoincident(SketchLine_30.startPoint(), SketchLine_34.endPoint()) +SketchConstraintCoincidence_49 = Sketch_3.setCoincident( + SketchLine_30.startPoint(), SketchLine_34.endPoint() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_53") -SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchLine_33.endPoint(), SketchLine_34.endPoint()) +SketchConstraintCoincidence_50 = Sketch_3.setCoincident( + SketchLine_33.endPoint(), SketchLine_34.endPoint() +) SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_54") SketchPoint_4 = Sketch_3.addPoint(16.50014787857639, -6) SketchPoint_4.setAuxiliary(True) -SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchPoint_4.coordinates(), SketchLine_34.result()) +SketchConstraintCoincidence_51 = Sketch_3.setCoincident( + SketchPoint_4.coordinates(), SketchLine_34.result() +) 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()) +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&Sketch_1/SketchLine_14][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_5]")) +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 = 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&Sketch_1/SketchArc_2_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9]")) +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 = 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()) +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/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) +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/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_11]")) +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()) +SketchConstraintCoincidence_55 = Sketch_4.setCoincident( + SketchLine_37.startPoint(), SketchLine_38.result() +) SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_59") -SketchLine_39 = Sketch_4.addLine(1.55585595716119, 2.812450190483599, 2.324492722099671, 3.935842385393688) +SketchLine_39 = Sketch_4.addLine( + 1.55585595716119, 2.812450190483599, 2.324492722099671, 3.935842385393688 +) SketchLine_39.setName("SketchLine_41") SketchLine_39.result().setName("SketchLine_41") -SketchConstraintCoincidence_56 = Sketch_4.setCoincident(SketchLine_37.endPoint(), SketchLine_39.startPoint()) +SketchConstraintCoincidence_56 = Sketch_4.setCoincident( + SketchLine_37.endPoint(), SketchLine_39.startPoint() +) SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_60") -SketchConstraintCoincidence_57 = Sketch_4.setCoincident(SketchLine_39.endPoint(), SketchLine_38.result()) +SketchConstraintCoincidence_57 = Sketch_4.setCoincident( + SketchLine_39.endPoint(), SketchLine_38.result() +) SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_61") -SketchLine_40 = Sketch_4.addLine(2.324492722099671, 3.935842385393688, 0.4324637622511017, 3.581086955422081) +SketchLine_40 = Sketch_4.addLine( + 2.324492722099671, 3.935842385393688, 0.4324637622511017, 3.581086955422081 +) SketchLine_40.setName("SketchLine_42") SketchLine_40.result().setName("SketchLine_42") -SketchConstraintCoincidence_58 = Sketch_4.setCoincident(SketchLine_39.endPoint(), SketchLine_40.startPoint()) +SketchConstraintCoincidence_58 = Sketch_4.setCoincident( + SketchLine_39.endPoint(), SketchLine_40.startPoint() +) SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_62") -SketchConstraintCoincidence_59 = Sketch_4.setCoincident(SketchLine_37.startPoint(), SketchLine_40.endPoint()) +SketchConstraintCoincidence_59 = Sketch_4.setCoincident( + SketchLine_37.startPoint(), SketchLine_40.endPoint() +) SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_63") SketchConstraintLength_11 = Sketch_4.setLength(SketchLine_40.result(), 1.925) SketchConstraintLength_11.setName("SketchConstraintLength_12") -SketchConstraintEqual_3 = Sketch_4.setEqual(SketchLine_37.result(), SketchLine_39.result()) -SketchConstraintPerpendicular_1 = Sketch_4.setPerpendicular(SketchLine_37.result(), SketchLine_39.result()) -SketchConstraintDistance_10 = Sketch_4.setDistance(SketchLine_38.startPoint(), SketchLine_37.startPoint(), 0.44, False) -SketchMultiTranslation_1_objects = [SketchLine_37.result(), SketchLine_40.result(), SketchLine_39.result()] -SketchMultiTranslation_1 = Sketch_4.addTranslation(SketchMultiTranslation_1_objects, SketchLine_40.startPoint(), SketchLine_38.endPoint(), 4, True) -[SketchLine_41, SketchLine_42, SketchLine_43, SketchLine_44, SketchLine_45, SketchLine_46, SketchLine_47, SketchLine_48, SketchLine_49] = SketchMultiTranslation_1.translated() +SketchConstraintEqual_3 = Sketch_4.setEqual( + SketchLine_37.result(), SketchLine_39.result() +) +SketchConstraintPerpendicular_1 = Sketch_4.setPerpendicular( + SketchLine_37.result(), SketchLine_39.result() +) +SketchConstraintDistance_10 = Sketch_4.setDistance( + SketchLine_38.startPoint(), SketchLine_37.startPoint(), 0.44, False +) +SketchMultiTranslation_1_objects = [ + SketchLine_37.result(), + SketchLine_40.result(), + SketchLine_39.result(), +] +SketchMultiTranslation_1 = Sketch_4.addTranslation( + SketchMultiTranslation_1_objects, + SketchLine_40.startPoint(), + SketchLine_38.endPoint(), + 4, + True, +) +[ + SketchLine_41, + SketchLine_42, + SketchLine_43, + SketchLine_44, + SketchLine_45, + SketchLine_46, + SketchLine_47, + SketchLine_48, + SketchLine_49, +] = SketchMultiTranslation_1.translated() SketchLine_49.setName("SketchLine_51") SketchLine_49.result().setName("SketchLine_51") SketchLine_48.setName("SketchLine_50") @@ -368,84 +651,196 @@ 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/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]")) +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) SketchConstraintRigid_1 = Sketch_5.setFixed(SketchPoint_5.result()) SketchConstraintRigid_1.setName("SketchConstraintRigid_10") -SketchConstraintCoincidence_60 = Sketch_5.setCoincident(SketchArc_4.startPoint(), SketchPoint_5.result()) +SketchConstraintCoincidence_60 = Sketch_5.setCoincident( + SketchArc_4.startPoint(), SketchPoint_5.result() +) SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_64") SketchPoint_6 = Sketch_5.addPoint(28, -7.5) SketchConstraintRigid_2 = Sketch_5.setFixed(SketchPoint_6.result()) SketchConstraintRigid_2.setName("SketchConstraintRigid_11") -SketchConstraintCoincidence_61 = Sketch_5.setCoincident(SketchArc_4.endPoint(), SketchPoint_6.result()) +SketchConstraintCoincidence_61 = Sketch_5.setCoincident( + SketchArc_4.endPoint(), SketchPoint_6.result() +) SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_65") SketchConstraintRadius_2 = Sketch_5.setRadius(SketchArc_4.results()[1], 3) SketchLine_50 = Sketch_5.addLine(22, -7.5, 22, -11.56094005408083) SketchLine_50.setName("SketchLine_52") SketchLine_50.result().setName("SketchLine_52") -SketchConstraintCoincidence_62 = Sketch_5.setCoincident(SketchArc_4.startPoint(), SketchLine_50.startPoint()) +SketchConstraintCoincidence_62 = Sketch_5.setCoincident( + SketchArc_4.startPoint(), SketchLine_50.startPoint() +) SketchConstraintCoincidence_62.setName("SketchConstraintCoincidence_66") -SketchConstraintCoincidence_63 = Sketch_5.setCoincident(SketchPoint_5.coordinates(), SketchLine_50.startPoint()) +SketchConstraintCoincidence_63 = Sketch_5.setCoincident( + SketchPoint_5.coordinates(), SketchLine_50.startPoint() +) SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_67") SketchLine_51 = Sketch_5.addLine(22, -11.56094005408083, 28, -11.56094005408083) SketchLine_51.setName("SketchLine_53") SketchLine_51.result().setName("SketchLine_53") -SketchConstraintCoincidence_64 = Sketch_5.setCoincident(SketchLine_50.endPoint(), SketchLine_51.startPoint()) +SketchConstraintCoincidence_64 = Sketch_5.setCoincident( + SketchLine_50.endPoint(), SketchLine_51.startPoint() +) SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_68") SketchLine_52 = Sketch_5.addLine(28, -11.56094005408083, 28, -7.5) SketchLine_52.setName("SketchLine_54") SketchLine_52.result().setName("SketchLine_54") -SketchConstraintCoincidence_65 = Sketch_5.setCoincident(SketchLine_51.endPoint(), SketchLine_52.startPoint()) +SketchConstraintCoincidence_65 = Sketch_5.setCoincident( + SketchLine_51.endPoint(), SketchLine_52.startPoint() +) SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_69") -SketchConstraintCoincidence_66 = Sketch_5.setCoincident(SketchArc_4.endPoint(), SketchLine_52.endPoint()) +SketchConstraintCoincidence_66 = Sketch_5.setCoincident( + SketchArc_4.endPoint(), SketchLine_52.endPoint() +) SketchConstraintCoincidence_66.setName("SketchConstraintCoincidence_70") -SketchConstraintCoincidence_67 = Sketch_5.setCoincident(SketchPoint_6.coordinates(), SketchLine_52.endPoint()) +SketchConstraintCoincidence_67 = Sketch_5.setCoincident( + SketchPoint_6.coordinates(), SketchLine_52.endPoint() +) SketchConstraintCoincidence_67.setName("SketchConstraintCoincidence_71") SketchConstraintVertical_10 = Sketch_5.setVertical(SketchLine_50.result()) 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/Modified_Face&Extrusion_1_1/To_Face"), 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_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")) +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") SketchLine_53.result().setName("SketchLine_55") SketchConstraintRigid_3 = Sketch_6.setFixed(SketchLine_53.result()) SketchConstraintRigid_3.setName("SketchConstraintRigid_12") -SketchConstraintCoincidence_68 = Sketch_6.setCoincident(SketchArc_5.center(), SketchLine_53.result()) +SketchConstraintCoincidence_68 = Sketch_6.setCoincident( + SketchArc_5.center(), SketchLine_53.result() +) SketchConstraintCoincidence_68.setName("SketchConstraintCoincidence_72") -SketchConstraintCoincidence_69 = Sketch_6.setCoincident(SketchArc_5.startPoint(), SketchLine_53.result()) +SketchConstraintCoincidence_69 = Sketch_6.setCoincident( + SketchArc_5.startPoint(), SketchLine_53.result() +) SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_73") -SketchConstraintCoincidence_70 = Sketch_6.setCoincident(SketchArc_5.endPoint(), SketchLine_53.result()) +SketchConstraintCoincidence_70 = Sketch_6.setCoincident( + SketchArc_5.endPoint(), SketchLine_53.result() +) SketchConstraintCoincidence_70.setName("SketchConstraintCoincidence_74") SketchLine_54 = Sketch_6.addLine(45.5, 0, 46.5, 0) SketchLine_54.setName("SketchLine_56") SketchLine_54.result().setName("SketchLine_56") -SketchConstraintCoincidence_71 = Sketch_6.setCoincident(SketchArc_5.startPoint(), SketchLine_54.startPoint()) +SketchConstraintCoincidence_71 = Sketch_6.setCoincident( + SketchArc_5.startPoint(), SketchLine_54.startPoint() +) SketchConstraintCoincidence_71.setName("SketchConstraintCoincidence_75") -SketchConstraintCoincidence_72 = Sketch_6.setCoincident(SketchArc_5.endPoint(), SketchLine_54.endPoint()) +SketchConstraintCoincidence_72 = Sketch_6.setCoincident( + SketchArc_5.endPoint(), SketchLine_54.endPoint() +) SketchConstraintCoincidence_72.setName("SketchConstraintCoincidence_76") SketchConstraintRadius_3 = Sketch_6.setRadius(SketchArc_5.results()[1], 0.5) SketchLine_55 = Sketch_6.addLine(0, 0, 0, 3.5) SketchLine_55.setName("SketchLine_57") SketchLine_55.result().setName("SketchLine_57") -SketchConstraintDistance_11 = Sketch_6.setDistance(SketchArc_5.center(), SketchLine_55.result(), 46, False) +SketchConstraintDistance_11 = Sketch_6.setDistance( + SketchArc_5.center(), SketchLine_55.result(), 46, False +) SketchConstraintRigid_4 = Sketch_6.setFixed(SketchLine_55.result()) SketchConstraintRigid_4.setName("SketchConstraintRigid_13") SketchPoint_7 = Sketch_6.addPoint(58, 0) -SketchConstraintCoincidence_73 = Sketch_6.setCoincident(SketchPoint_7.coordinates(), SketchLine_53.result()) +SketchConstraintCoincidence_73 = Sketch_6.setCoincident( + SketchPoint_7.coordinates(), SketchLine_53.result() +) SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_77") -SketchConstraintDistance_12 = Sketch_6.setDistance(SketchArc_5.center(), SketchPoint_7.coordinates(), 12, False) -SketchMultiTranslation_2 = Sketch_6.addTranslation([SketchLine_54.result(), SketchArc_5.results()[1]], SketchArc_5.center(), SketchPoint_7.coordinates(), 9, True) -[SketchLine_56, SketchLine_57, SketchLine_58, SketchLine_59, SketchLine_60, SketchLine_61, SketchLine_62, SketchLine_63, SketchArc_6, SketchArc_7, SketchArc_8, SketchArc_9, SketchArc_10, SketchArc_11, SketchArc_12, SketchArc_13] = SketchMultiTranslation_2.translated() +SketchConstraintDistance_12 = Sketch_6.setDistance( + SketchArc_5.center(), SketchPoint_7.coordinates(), 12, False +) +SketchMultiTranslation_2 = Sketch_6.addTranslation( + [SketchLine_54.result(), SketchArc_5.results()[1]], + SketchArc_5.center(), + SketchPoint_7.coordinates(), + 9, + True, +) +[ + SketchLine_56, + SketchLine_57, + SketchLine_58, + SketchLine_59, + SketchLine_60, + SketchLine_61, + SketchLine_62, + SketchLine_63, + SketchArc_6, + SketchArc_7, + SketchArc_8, + SketchArc_9, + SketchArc_10, + SketchArc_11, + SketchArc_12, + SketchArc_13, +] = SketchMultiTranslation_2.translated() SketchLine_63.setName("SketchLine_65") SketchLine_63.result().setName("SketchLine_65") SketchLine_62.setName("SketchLine_64") @@ -463,8 +858,26 @@ 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_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)_ExtrusionFuse_1_1")) +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)_ExtrusionFuse_1_1", + ), +) SketchLine_64 = Sketch_7.addLine(50.25, -4.5, 31.25, -4.5) SketchLine_64.setName("SketchLine_76") SketchLine_64.result().setName("SketchLine_76") @@ -483,21 +896,29 @@ SketchLine_68.result().setName("SketchLine_66") SketchLine_68.setAuxiliary(True) SketchLine_69 = Sketch_7.addLine(51, -7.5, 51, -4.5) SketchLine_69.setAuxiliary(True) -SketchConstraintCoincidence_74 = Sketch_7.setCoincident(SketchLine_69.endPoint(), SketchLine_68.startPoint()) +SketchConstraintCoincidence_74 = Sketch_7.setCoincident( + SketchLine_69.endPoint(), SketchLine_68.startPoint() +) SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_78") SketchLine_70 = Sketch_7.addLine(31, -4.5, 31, -7.5) SketchLine_70.setName("SketchLine_67") SketchLine_70.result().setName("SketchLine_67") SketchLine_70.setAuxiliary(True) -SketchConstraintCoincidence_75 = Sketch_7.setCoincident(SketchLine_68.endPoint(), SketchLine_70.startPoint()) +SketchConstraintCoincidence_75 = Sketch_7.setCoincident( + SketchLine_68.endPoint(), SketchLine_70.startPoint() +) SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_79") SketchLine_71 = Sketch_7.addLine(31, -7.5, 51, -7.5) SketchLine_71.setName("SketchLine_68") SketchLine_71.result().setName("SketchLine_68") SketchLine_71.setAuxiliary(True) -SketchConstraintCoincidence_76 = Sketch_7.setCoincident(SketchLine_70.endPoint(), SketchLine_71.startPoint()) +SketchConstraintCoincidence_76 = Sketch_7.setCoincident( + SketchLine_70.endPoint(), SketchLine_71.startPoint() +) SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_80") -SketchConstraintCoincidence_77 = Sketch_7.setCoincident(SketchLine_71.endPoint(), SketchLine_69.startPoint()) +SketchConstraintCoincidence_77 = Sketch_7.setCoincident( + SketchLine_71.endPoint(), SketchLine_69.startPoint() +) SketchConstraintCoincidence_77.setName("SketchConstraintCoincidence_81") SketchConstraintHorizontal_12 = Sketch_7.setHorizontal(SketchLine_68.result()) SketchConstraintHorizontal_12.setName("SketchConstraintHorizontal_13") @@ -509,20 +930,32 @@ SketchLine_72 = Sketch_7.addLine(31, -7.5, 51, -4.5) SketchLine_72.setName("SketchLine_70") SketchLine_72.result().setName("SketchLine_70") SketchLine_72.setAuxiliary(True) -SketchConstraintCoincidence_78 = Sketch_7.setCoincident(SketchLine_70.endPoint(), SketchLine_72.startPoint()) +SketchConstraintCoincidence_78 = Sketch_7.setCoincident( + SketchLine_70.endPoint(), SketchLine_72.startPoint() +) SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_82") -SketchConstraintCoincidence_79 = Sketch_7.setCoincident(SketchLine_71.startPoint(), SketchLine_72.startPoint()) +SketchConstraintCoincidence_79 = Sketch_7.setCoincident( + SketchLine_71.startPoint(), SketchLine_72.startPoint() +) SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_83") SketchPoint_8 = Sketch_7.addPoint(51, -4.5) -SketchConstraintCoincidence_80 = Sketch_7.setCoincident(SketchLine_68.startPoint(), SketchPoint_8.coordinates()) +SketchConstraintCoincidence_80 = Sketch_7.setCoincident( + SketchLine_68.startPoint(), SketchPoint_8.coordinates() +) SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_84") -SketchConstraintCoincidence_81 = Sketch_7.setCoincident(SketchLine_69.endPoint(), SketchPoint_8.coordinates()) +SketchConstraintCoincidence_81 = Sketch_7.setCoincident( + SketchLine_69.endPoint(), SketchPoint_8.coordinates() +) SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_85") SketchPoint_9 = Sketch_7.addPoint(41, -6) SketchPoint_9.setAuxiliary(True) -SketchConstraintCoincidence_82 = Sketch_7.setCoincident(SketchPoint_9.coordinates(), SketchLine_72.result()) +SketchConstraintCoincidence_82 = Sketch_7.setCoincident( + SketchPoint_9.coordinates(), SketchLine_72.result() +) SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_86") -SketchConstraintMiddle_3 = Sketch_7.setMiddlePoint(SketchLine_72.result(), SketchPoint_9.coordinates()) +SketchConstraintMiddle_3 = Sketch_7.setMiddlePoint( + SketchLine_72.result(), SketchPoint_9.coordinates() +) SketchPoint_10 = Sketch_7.addPoint(21, -6) SketchPoint_10.setAuxiliary(True) SketchLine_73 = Sketch_7.addLine(21, -10.5, 21, -1.5) @@ -530,27 +963,39 @@ SketchLine_73.setName("SketchLine_71") SketchLine_73.result().setName("SketchLine_71") SketchConstraintRigid_5 = Sketch_7.setFixed(SketchLine_73.result()) SketchConstraintRigid_5.setName("SketchConstraintRigid_14") -SketchConstraintCoincidence_83 = Sketch_7.setCoincident(SketchPoint_10.coordinates(), SketchLine_73.result()) +SketchConstraintCoincidence_83 = Sketch_7.setCoincident( + SketchPoint_10.coordinates(), SketchLine_73.result() +) SketchConstraintCoincidence_83.setName("SketchConstraintCoincidence_87") -SketchConstraintMiddle_4 = Sketch_7.setMiddlePoint(SketchPoint_10.coordinates(), SketchLine_73.result()) +SketchConstraintMiddle_4 = Sketch_7.setMiddlePoint( + SketchPoint_10.coordinates(), SketchLine_73.result() +) SketchLine_74 = Sketch_7.addLine(21, -6, 41, -6) SketchLine_74.setName("SketchLine_72") SketchLine_74.result().setName("SketchLine_72") SketchLine_74.setAuxiliary(True) -SketchConstraintCoincidence_84 = Sketch_7.setCoincident(SketchPoint_10.coordinates(), SketchLine_74.startPoint()) +SketchConstraintCoincidence_84 = Sketch_7.setCoincident( + SketchPoint_10.coordinates(), SketchLine_74.startPoint() +) SketchConstraintCoincidence_84.setName("SketchConstraintCoincidence_88") -SketchConstraintCoincidence_85 = Sketch_7.setCoincident(SketchPoint_9.coordinates(), SketchLine_74.endPoint()) +SketchConstraintCoincidence_85 = Sketch_7.setCoincident( + SketchPoint_9.coordinates(), SketchLine_74.endPoint() +) SketchConstraintCoincidence_85.setName("SketchConstraintCoincidence_89") SketchConstraintHorizontal_14 = Sketch_7.setHorizontal(SketchLine_74.result()) SketchConstraintHorizontal_14.setName("SketchConstraintHorizontal_15") -SketchConstraintCoincidence_86 = Sketch_7.setCoincident(SketchLine_72.endPoint(), SketchLine_68.startPoint()) +SketchConstraintCoincidence_86 = Sketch_7.setCoincident( + SketchLine_72.endPoint(), SketchLine_68.startPoint() +) SketchConstraintCoincidence_86.setName("SketchConstraintCoincidence_90") SketchConstraintLength_12 = Sketch_7.setLength(SketchLine_69.result(), 3) SketchConstraintLength_12.setName("SketchConstraintLength_13") SketchConstraintLength_13 = Sketch_7.setLength(SketchLine_68.result(), 20) SketchConstraintLength_13.setName("SketchConstraintLength_14") SketchPoint_11 = Sketch_7.addPoint(29, -10.5) -SketchConstraintDistance_13 = Sketch_7.setDistance(SketchPoint_11.coordinates(), SketchLine_70.result(), 2, False) +SketchConstraintDistance_13 = Sketch_7.setDistance( + SketchPoint_11.coordinates(), SketchLine_70.result(), 2, False +) SketchConstraintRigid_6 = Sketch_7.setFixed(SketchPoint_11.result()) SketchConstraintRigid_6.setName("SketchConstraintRigid_15") SketchArc_14 = Sketch_7.addArc(50.25, -5.25, 51, -5.25, 50.25, -4.5, False) @@ -558,168 +1003,309 @@ SketchLine_75 = Sketch_7.addLine(51, -7.5, 51, -5.25) SketchLine_75.setName("SketchLine_74") SketchLine_75.result().setName("SketchLine_74") SketchLine_75.setAuxiliary(True) -SketchConstraintCoincidence_87 = Sketch_7.setCoincident(SketchArc_14.startPoint(), SketchLine_75.endPoint()) +SketchConstraintCoincidence_87 = Sketch_7.setCoincident( + SketchArc_14.startPoint(), SketchLine_75.endPoint() +) SketchConstraintCoincidence_87.setName("SketchConstraintCoincidence_91") SketchLine_76 = Sketch_7.addLine(50.25, -4.5, 31, -4.5) SketchLine_76.setName("SketchLine_73") SketchLine_76.result().setName("SketchLine_73") SketchLine_76.setAuxiliary(True) -SketchConstraintCoincidence_88 = Sketch_7.setCoincident(SketchArc_14.endPoint(), SketchLine_76.startPoint()) +SketchConstraintCoincidence_88 = Sketch_7.setCoincident( + SketchArc_14.endPoint(), SketchLine_76.startPoint() +) SketchConstraintCoincidence_88.setName("SketchConstraintCoincidence_92") -SketchConstraintTangent_2 = Sketch_7.setTangent(SketchArc_14.results()[1], SketchLine_76.result()) -SketchConstraintTangent_3 = Sketch_7.setTangent(SketchArc_14.results()[1], SketchLine_75.result()) -SketchConstraintCoincidence_89 = Sketch_7.setCoincident(SketchLine_68.endPoint(), SketchLine_76.endPoint()) +SketchConstraintTangent_2 = Sketch_7.setTangent( + SketchArc_14.results()[1], SketchLine_76.result() +) +SketchConstraintTangent_3 = Sketch_7.setTangent( + SketchArc_14.results()[1], SketchLine_75.result() +) +SketchConstraintCoincidence_89 = Sketch_7.setCoincident( + SketchLine_68.endPoint(), SketchLine_76.endPoint() +) SketchConstraintCoincidence_89.setName("SketchConstraintCoincidence_93") -SketchConstraintCoincidence_90 = Sketch_7.setCoincident(SketchLine_69.startPoint(), SketchLine_75.startPoint()) +SketchConstraintCoincidence_90 = Sketch_7.setCoincident( + SketchLine_69.startPoint(), SketchLine_75.startPoint() +) SketchConstraintCoincidence_90.setName("SketchConstraintCoincidence_94") -SketchConstraintCoincidence_91 = Sketch_7.setCoincident(SketchLine_76.startPoint(), SketchLine_68.result()) +SketchConstraintCoincidence_91 = Sketch_7.setCoincident( + SketchLine_76.startPoint(), SketchLine_68.result() +) SketchConstraintCoincidence_91.setName("SketchConstraintCoincidence_95") -SketchConstraintCoincidence_92 = Sketch_7.setCoincident(SketchLine_75.endPoint(), SketchLine_69.result()) +SketchConstraintCoincidence_92 = Sketch_7.setCoincident( + SketchLine_75.endPoint(), SketchLine_69.result() +) SketchConstraintCoincidence_92.setName("SketchConstraintCoincidence_96") -SketchArc_15 = Sketch_7.addArc(31.25, -4.750000000010547, 31.24999999999071, -4.5, 31, -4.750000000010547, False) -SketchConstraintCoincidence_93 = Sketch_7.setCoincident(SketchArc_15.startPoint(), SketchLine_64.endPoint()) +SketchArc_15 = Sketch_7.addArc( + 31.25, -4.750000000010547, 31.24999999999071, -4.5, 31, -4.750000000010547, False +) +SketchConstraintCoincidence_93 = Sketch_7.setCoincident( + SketchArc_15.startPoint(), SketchLine_64.endPoint() +) SketchConstraintCoincidence_93.setName("SketchConstraintCoincidence_97") SketchLine_77 = Sketch_7.addLine(31, -4.75, 31, -7.5) SketchLine_77.setName("SketchLine_75") SketchLine_77.result().setName("SketchLine_75") SketchLine_77.setAuxiliary(True) -SketchConstraintCoincidence_94 = Sketch_7.setCoincident(SketchArc_15.endPoint(), SketchLine_77.startPoint()) +SketchConstraintCoincidence_94 = Sketch_7.setCoincident( + SketchArc_15.endPoint(), SketchLine_77.startPoint() +) SketchConstraintCoincidence_94.setName("SketchConstraintCoincidence_98") -SketchConstraintTangent_4 = Sketch_7.setTangent(SketchArc_15.results()[1], SketchLine_77.result()) -SketchConstraintTangent_5 = Sketch_7.setTangent(SketchArc_15.results()[1], SketchLine_64.result()) -SketchConstraintCoincidence_95 = Sketch_7.setCoincident(SketchLine_70.endPoint(), SketchLine_77.endPoint()) +SketchConstraintTangent_4 = Sketch_7.setTangent( + SketchArc_15.results()[1], SketchLine_77.result() +) +SketchConstraintTangent_5 = Sketch_7.setTangent( + SketchArc_15.results()[1], SketchLine_64.result() +) +SketchConstraintCoincidence_95 = Sketch_7.setCoincident( + SketchLine_70.endPoint(), SketchLine_77.endPoint() +) SketchConstraintCoincidence_95.setName("SketchConstraintCoincidence_99") -SketchConstraintCoincidence_96 = Sketch_7.setCoincident(SketchLine_76.startPoint(), SketchLine_64.startPoint()) +SketchConstraintCoincidence_96 = Sketch_7.setCoincident( + SketchLine_76.startPoint(), SketchLine_64.startPoint() +) SketchConstraintCoincidence_96.setName("SketchConstraintCoincidence_100") -SketchConstraintCoincidence_97 = Sketch_7.setCoincident(SketchLine_77.startPoint(), SketchLine_70.result()) +SketchConstraintCoincidence_97 = Sketch_7.setCoincident( + SketchLine_77.startPoint(), SketchLine_70.result() +) SketchConstraintCoincidence_97.setName("SketchConstraintCoincidence_101") -SketchConstraintCoincidence_98 = Sketch_7.setCoincident(SketchLine_64.endPoint(), SketchLine_76.result()) +SketchConstraintCoincidence_98 = Sketch_7.setCoincident( + SketchLine_64.endPoint(), SketchLine_76.result() +) SketchConstraintCoincidence_98.setName("SketchConstraintCoincidence_102") SketchArc_16 = Sketch_7.addArc(50.25, -6.75, 50.25, -7.5, 51, -6.75, False) SketchLine_78 = Sketch_7.addLine(31, -7.5, 50.25, -7.5) SketchLine_78.setName("SketchLine_77") SketchLine_78.result().setName("SketchLine_77") SketchLine_78.setAuxiliary(True) -SketchConstraintCoincidence_99 = Sketch_7.setCoincident(SketchArc_16.startPoint(), SketchLine_78.endPoint()) +SketchConstraintCoincidence_99 = Sketch_7.setCoincident( + SketchArc_16.startPoint(), SketchLine_78.endPoint() +) SketchConstraintCoincidence_99.setName("SketchConstraintCoincidence_103") -SketchConstraintCoincidence_100 = Sketch_7.setCoincident(SketchArc_16.endPoint(), SketchLine_65.startPoint()) +SketchConstraintCoincidence_100 = Sketch_7.setCoincident( + SketchArc_16.endPoint(), SketchLine_65.startPoint() +) SketchConstraintCoincidence_100.setName("SketchConstraintCoincidence_104") -SketchConstraintTangent_6 = Sketch_7.setTangent(SketchArc_16.results()[1], SketchLine_78.result()) -SketchConstraintTangent_7 = Sketch_7.setTangent(SketchArc_16.results()[1], SketchLine_65.result()) -SketchConstraintCoincidence_101 = Sketch_7.setCoincident(SketchLine_71.startPoint(), SketchLine_78.startPoint()) +SketchConstraintTangent_6 = Sketch_7.setTangent( + SketchArc_16.results()[1], SketchLine_78.result() +) +SketchConstraintTangent_7 = Sketch_7.setTangent( + SketchArc_16.results()[1], SketchLine_65.result() +) +SketchConstraintCoincidence_101 = Sketch_7.setCoincident( + SketchLine_71.startPoint(), SketchLine_78.startPoint() +) SketchConstraintCoincidence_101.setName("SketchConstraintCoincidence_105") -SketchConstraintCoincidence_102 = Sketch_7.setCoincident(SketchLine_75.endPoint(), SketchLine_65.endPoint()) +SketchConstraintCoincidence_102 = Sketch_7.setCoincident( + SketchLine_75.endPoint(), SketchLine_65.endPoint() +) SketchConstraintCoincidence_102.setName("SketchConstraintCoincidence_106") -SketchConstraintCoincidence_103 = Sketch_7.setCoincident(SketchLine_78.endPoint(), SketchLine_71.result()) +SketchConstraintCoincidence_103 = Sketch_7.setCoincident( + SketchLine_78.endPoint(), SketchLine_71.result() +) SketchConstraintCoincidence_103.setName("SketchConstraintCoincidence_107") -SketchConstraintCoincidence_104 = Sketch_7.setCoincident(SketchLine_65.startPoint(), SketchLine_75.result()) +SketchConstraintCoincidence_104 = Sketch_7.setCoincident( + SketchLine_65.startPoint(), SketchLine_75.result() +) SketchConstraintCoincidence_104.setName("SketchConstraintCoincidence_108") -SketchArc_17 = Sketch_7.addArc(31.25000000000166, -7.249999999978784, 31, -7.249999999978425, 31.25000000000632, -7.499999999999999, False) -SketchConstraintCoincidence_105 = Sketch_7.setCoincident(SketchArc_17.startPoint(), SketchLine_66.endPoint()) +SketchArc_17 = Sketch_7.addArc( + 31.25000000000166, + -7.249999999978784, + 31, + -7.249999999978425, + 31.25000000000632, + -7.499999999999999, + False, +) +SketchConstraintCoincidence_105 = Sketch_7.setCoincident( + SketchArc_17.startPoint(), SketchLine_66.endPoint() +) SketchConstraintCoincidence_105.setName("SketchConstraintCoincidence_109") -SketchConstraintCoincidence_106 = Sketch_7.setCoincident(SketchArc_17.endPoint(), SketchLine_67.startPoint()) +SketchConstraintCoincidence_106 = Sketch_7.setCoincident( + SketchArc_17.endPoint(), SketchLine_67.startPoint() +) SketchConstraintCoincidence_106.setName("SketchConstraintCoincidence_110") -SketchConstraintCoincidence_107 = Sketch_7.setCoincident(SketchLine_78.endPoint(), SketchLine_67.endPoint()) +SketchConstraintCoincidence_107 = Sketch_7.setCoincident( + SketchLine_78.endPoint(), SketchLine_67.endPoint() +) SketchConstraintCoincidence_107.setName("SketchConstraintCoincidence_111") -SketchConstraintCoincidence_108 = Sketch_7.setCoincident(SketchLine_77.startPoint(), SketchLine_66.startPoint()) +SketchConstraintCoincidence_108 = Sketch_7.setCoincident( + SketchLine_77.startPoint(), SketchLine_66.startPoint() +) SketchConstraintCoincidence_108.setName("SketchConstraintCoincidence_112") -SketchConstraintCoincidence_109 = Sketch_7.setCoincident(SketchLine_67.startPoint(), SketchLine_78.result()) +SketchConstraintCoincidence_109 = Sketch_7.setCoincident( + SketchLine_67.startPoint(), SketchLine_78.result() +) SketchConstraintCoincidence_109.setName("SketchConstraintCoincidence_113") -SketchConstraintCoincidence_110 = Sketch_7.setCoincident(SketchLine_66.endPoint(), SketchLine_77.result()) +SketchConstraintCoincidence_110 = Sketch_7.setCoincident( + SketchLine_66.endPoint(), SketchLine_77.result() +) SketchConstraintCoincidence_110.setName("SketchConstraintCoincidence_114") SketchConstraintRadius_4 = Sketch_7.setRadius(SketchArc_14.results()[1], 0.75) SketchConstraintRadius_5 = Sketch_7.setRadius(SketchArc_16.results()[1], 0.75) SketchConstraintRadius_6 = Sketch_7.setRadius(SketchArc_15.results()[1], 0.25) -SketchConstraintTangent_8 = Sketch_7.setTangent(SketchArc_17.results()[1], SketchLine_67.result()) +SketchConstraintTangent_8 = Sketch_7.setTangent( + SketchArc_17.results()[1], SketchLine_67.result() +) SketchConstraintTangent_8.setName("SketchConstraintTangent_16") -SketchConstraintTangent_9 = Sketch_7.setTangent(SketchArc_17.results()[1], SketchLine_66.result()) +SketchConstraintTangent_9 = Sketch_7.setTangent( + SketchArc_17.results()[1], SketchLine_66.result() +) SketchConstraintTangent_9.setName("SketchConstraintTangent_17") 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", "(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)")) +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", + "(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()) SketchConstraintRigid_7.setName("SketchConstraintRigid_16") -SketchConstraintCoincidence_111 = Sketch_8.setCoincident(SketchPoint_12.coordinates(), SketchPoint_13.result()) +SketchConstraintCoincidence_111 = Sketch_8.setCoincident( + SketchPoint_12.coordinates(), SketchPoint_13.result() +) SketchConstraintCoincidence_111.setName("SketchConstraintCoincidence_115") SketchPoint_14 = Sketch_8.addPoint(54, 12) SketchLine_79 = Sketch_8.addLine(54, 12, 54, 0) SketchLine_79.setName("SketchLine_81") SketchLine_79.result().setName("SketchLine_81") SketchLine_79.setAuxiliary(True) -SketchConstraintCoincidence_112 = Sketch_8.setCoincident(SketchPoint_14.coordinates(), SketchLine_79.startPoint()) +SketchConstraintCoincidence_112 = Sketch_8.setCoincident( + SketchPoint_14.coordinates(), SketchLine_79.startPoint() +) SketchConstraintCoincidence_112.setName("SketchConstraintCoincidence_116") -SketchConstraintCoincidence_113 = Sketch_8.setCoincident(SketchPoint_12.coordinates(), SketchLine_79.endPoint()) +SketchConstraintCoincidence_113 = Sketch_8.setCoincident( + SketchPoint_12.coordinates(), SketchLine_79.endPoint() +) SketchConstraintCoincidence_113.setName("SketchConstraintCoincidence_117") -SketchConstraintCoincidence_114 = Sketch_8.setCoincident(SketchPoint_13.coordinates(), SketchLine_79.endPoint()) +SketchConstraintCoincidence_114 = Sketch_8.setCoincident( + SketchPoint_13.coordinates(), SketchLine_79.endPoint() +) SketchConstraintCoincidence_114.setName("SketchConstraintCoincidence_118") SketchPoint_15 = Sketch_8.addPoint(54, 11) -SketchConstraintCoincidence_115 = Sketch_8.setCoincident(SketchPoint_15.coordinates(), SketchLine_79.result()) +SketchConstraintCoincidence_115 = Sketch_8.setCoincident( + SketchPoint_15.coordinates(), SketchLine_79.result() +) SketchConstraintCoincidence_115.setName("SketchConstraintCoincidence_119") SketchPoint_16 = Sketch_8.addPoint(54, 1) -SketchConstraintCoincidence_116 = Sketch_8.setCoincident(SketchPoint_16.coordinates(), SketchLine_79.result()) +SketchConstraintCoincidence_116 = Sketch_8.setCoincident( + SketchPoint_16.coordinates(), SketchLine_79.result() +) SketchConstraintCoincidence_116.setName("SketchConstraintCoincidence_120") -SketchConstraintDistance_14 = Sketch_8.setDistance(SketchPoint_12.coordinates(), SketchPoint_16.coordinates(), 1, False) -SketchConstraintDistance_15 = Sketch_8.setDistance(SketchPoint_14.coordinates(), SketchPoint_15.coordinates(), 1, False) +SketchConstraintDistance_14 = Sketch_8.setDistance( + SketchPoint_12.coordinates(), SketchPoint_16.coordinates(), 1, False +) +SketchConstraintDistance_15 = Sketch_8.setDistance( + SketchPoint_14.coordinates(), SketchPoint_15.coordinates(), 1, False +) SketchPoint_17 = Sketch_8.addPoint(54, 12) -SketchConstraintCoincidence_117 = Sketch_8.setCoincident(SketchPoint_14.coordinates(), SketchPoint_17.coordinates()) +SketchConstraintCoincidence_117 = Sketch_8.setCoincident( + SketchPoint_14.coordinates(), SketchPoint_17.coordinates() +) SketchConstraintCoincidence_117.setName("SketchConstraintCoincidence_121") SketchConstraintRigid_8 = Sketch_8.setFixed(SketchPoint_17.result()) SketchConstraintRigid_8.setName("SketchConstraintRigid_17") SketchLine_80 = Sketch_8.addLine(54, 11, 43.82041221793113, 11) SketchLine_80.setName("SketchLine_82") SketchLine_80.result().setName("SketchLine_82") -SketchConstraintCoincidence_118 = Sketch_8.setCoincident(SketchPoint_15.coordinates(), SketchLine_80.startPoint()) +SketchConstraintCoincidence_118 = Sketch_8.setCoincident( + SketchPoint_15.coordinates(), SketchLine_80.startPoint() +) SketchConstraintCoincidence_118.setName("SketchConstraintCoincidence_122") -SketchLine_81 = Sketch_8.addLine(43.82041221793113, 11, 43.82041221793113, 13.36310636658867) +SketchLine_81 = Sketch_8.addLine( + 43.82041221793113, 11, 43.82041221793113, 13.36310636658867 +) SketchLine_81.setName("SketchLine_83") SketchLine_81.result().setName("SketchLine_83") -SketchConstraintCoincidence_119 = Sketch_8.setCoincident(SketchLine_80.endPoint(), SketchLine_81.startPoint()) +SketchConstraintCoincidence_119 = Sketch_8.setCoincident( + SketchLine_80.endPoint(), SketchLine_81.startPoint() +) SketchConstraintCoincidence_119.setName("SketchConstraintCoincidence_123") -SketchLine_82 = Sketch_8.addLine(43.82041221793113, 13.36310636658867, 63.09515214070713, 13.47539228785809) +SketchLine_82 = Sketch_8.addLine( + 43.82041221793113, 13.36310636658867, 63.09515214070713, 13.47539228785809 +) SketchLine_82.setName("SketchLine_84") SketchLine_82.result().setName("SketchLine_84") -SketchConstraintCoincidence_120 = Sketch_8.setCoincident(SketchLine_81.endPoint(), SketchLine_82.startPoint()) +SketchConstraintCoincidence_120 = Sketch_8.setCoincident( + SketchLine_81.endPoint(), SketchLine_82.startPoint() +) SketchConstraintCoincidence_120.setName("SketchConstraintCoincidence_124") -SketchLine_83 = Sketch_8.addLine(63.09515214070713, 13.47539228785809, 63.12349734647592, -1.774328415749978) +SketchLine_83 = Sketch_8.addLine( + 63.09515214070713, 13.47539228785809, 63.12349734647592, -1.774328415749978 +) SketchLine_83.setName("SketchLine_85") SketchLine_83.result().setName("SketchLine_85") -SketchConstraintCoincidence_121 = Sketch_8.setCoincident(SketchLine_82.endPoint(), SketchLine_83.startPoint()) +SketchConstraintCoincidence_121 = Sketch_8.setCoincident( + SketchLine_82.endPoint(), SketchLine_83.startPoint() +) SketchConstraintCoincidence_121.setName("SketchConstraintCoincidence_125") -SketchLine_84 = Sketch_8.addLine(63.12349734647592, -1.774328415749978, 43.82041221793113, -1.802673621518767) +SketchLine_84 = Sketch_8.addLine( + 63.12349734647592, -1.774328415749978, 43.82041221793113, -1.802673621518767 +) SketchLine_84.setName("SketchLine_86") SketchLine_84.result().setName("SketchLine_86") -SketchConstraintCoincidence_122 = Sketch_8.setCoincident(SketchLine_83.endPoint(), SketchLine_84.startPoint()) +SketchConstraintCoincidence_122 = Sketch_8.setCoincident( + SketchLine_83.endPoint(), SketchLine_84.startPoint() +) SketchConstraintCoincidence_122.setName("SketchConstraintCoincidence_126") -SketchLine_85 = Sketch_8.addLine(43.82041221793113, -1.802673621518767, 43.79206701216234, 1) +SketchLine_85 = Sketch_8.addLine( + 43.82041221793113, -1.802673621518767, 43.79206701216234, 1 +) SketchLine_85.setName("SketchLine_87") SketchLine_85.result().setName("SketchLine_87") -SketchConstraintCoincidence_123 = Sketch_8.setCoincident(SketchLine_84.endPoint(), SketchLine_85.startPoint()) +SketchConstraintCoincidence_123 = Sketch_8.setCoincident( + SketchLine_84.endPoint(), SketchLine_85.startPoint() +) SketchConstraintCoincidence_123.setName("SketchConstraintCoincidence_127") SketchLine_86 = Sketch_8.addLine(54, 1, 43.79206701216234, 1) SketchLine_86.setName("SketchLine_88") SketchLine_86.result().setName("SketchLine_88") -SketchConstraintCoincidence_124 = Sketch_8.setCoincident(SketchPoint_16.coordinates(), SketchLine_86.startPoint()) +SketchConstraintCoincidence_124 = Sketch_8.setCoincident( + SketchPoint_16.coordinates(), SketchLine_86.startPoint() +) SketchConstraintCoincidence_124.setName("SketchConstraintCoincidence_128") SketchConstraintHorizontal_15 = Sketch_8.setHorizontal(SketchLine_86.result()) SketchConstraintHorizontal_15.setName("SketchConstraintHorizontal_16") SketchConstraintHorizontal_16 = Sketch_8.setHorizontal(SketchLine_80.result()) SketchConstraintHorizontal_16.setName("SketchConstraintHorizontal_17") -SketchConstraintCoincidence_125 = Sketch_8.setCoincident(SketchLine_85.endPoint(), SketchLine_86.endPoint()) +SketchConstraintCoincidence_125 = Sketch_8.setCoincident( + SketchLine_85.endPoint(), SketchLine_86.endPoint() +) SketchConstraintCoincidence_125.setName("SketchConstraintCoincidence_129") SketchArc_18 = Sketch_8.addArc(54, 6, 54, 11, 54, 1, True) -SketchConstraintCoincidence_126 = Sketch_8.setCoincident(SketchArc_18.center(), SketchLine_79.result()) +SketchConstraintCoincidence_126 = Sketch_8.setCoincident( + SketchArc_18.center(), SketchLine_79.result() +) SketchConstraintCoincidence_126.setName("SketchConstraintCoincidence_130") -SketchConstraintCoincidence_127 = Sketch_8.setCoincident(SketchPoint_15.coordinates(), SketchArc_18.startPoint()) +SketchConstraintCoincidence_127 = Sketch_8.setCoincident( + SketchPoint_15.coordinates(), SketchArc_18.startPoint() +) SketchConstraintCoincidence_127.setName("SketchConstraintCoincidence_130_") -SketchConstraintCoincidence_128 = Sketch_8.setCoincident(SketchLine_80.startPoint(), SketchArc_18.startPoint()) +SketchConstraintCoincidence_128 = Sketch_8.setCoincident( + SketchLine_80.startPoint(), SketchArc_18.startPoint() +) SketchConstraintCoincidence_128.setName("SketchConstraintCoincidence_131") -SketchConstraintCoincidence_129 = Sketch_8.setCoincident(SketchPoint_16.coordinates(), SketchArc_18.endPoint()) +SketchConstraintCoincidence_129 = Sketch_8.setCoincident( + SketchPoint_16.coordinates(), SketchArc_18.endPoint() +) SketchConstraintCoincidence_129.setName("SketchConstraintCoincidence_132") -SketchConstraintCoincidence_130 = Sketch_8.setCoincident(SketchLine_86.startPoint(), SketchArc_18.endPoint()) +SketchConstraintCoincidence_130 = Sketch_8.setCoincident( + SketchLine_86.startPoint(), SketchArc_18.endPoint() +) SketchConstraintCoincidence_130.setName("SketchConstraintCoincidence_133") SketchLine_87 = Sketch_8.addLine(43.50261344273609, 8.25, 43.50261344273609, 3.75) SketchLine_87.setName("SketchLine_90") @@ -728,7 +1314,9 @@ SketchConstraintVertical_14 = Sketch_8.setVertical(SketchLine_87.result()) SketchConstraintLength_14 = Sketch_8.setLength(SketchLine_87.result(), 4.5) SketchConstraintLength_14.setName("SketchConstraintLength_15") SketchPoint_18 = Sketch_8.addPoint(43.50261344273609, 6) -SketchConstraintMiddle_5 = Sketch_8.setMiddlePoint(SketchPoint_18.coordinates(), SketchLine_87.result()) +SketchConstraintMiddle_5 = Sketch_8.setMiddlePoint( + SketchPoint_18.coordinates(), SketchLine_87.result() +) SketchPoint_19 = Sketch_8.addPoint(0, 6) SketchPoint_19.setAuxiliary(True) SketchLine_88 = Sketch_8.addLine(0, 0, 0, 12) @@ -736,58 +1324,96 @@ SketchLine_88.setName("SketchLine_94") SketchLine_88.result().setName("SketchLine_94") SketchConstraintRigid_9 = Sketch_8.setFixed(SketchLine_88.result()) SketchConstraintRigid_9.setName("SketchConstraintRigid_19") -SketchConstraintCoincidence_131 = Sketch_8.setCoincident(SketchPoint_19.coordinates(), SketchLine_88.result()) +SketchConstraintCoincidence_131 = Sketch_8.setCoincident( + SketchPoint_19.coordinates(), SketchLine_88.result() +) SketchConstraintCoincidence_131.setName("SketchConstraintCoincidence_139") -SketchConstraintMiddle_6 = Sketch_8.setMiddlePoint(SketchLine_88.result(), SketchPoint_19.coordinates()) +SketchConstraintMiddle_6 = Sketch_8.setMiddlePoint( + SketchLine_88.result(), SketchPoint_19.coordinates() +) SketchLine_89 = Sketch_8.addLine(0, 6, 68.8619738308997, 6) SketchLine_89.setName("SketchLine_95") SketchLine_89.result().setName("SketchLine_95") SketchLine_89.setAuxiliary(True) -SketchConstraintCoincidence_132 = Sketch_8.setCoincident(SketchPoint_19.coordinates(), SketchLine_89.startPoint()) +SketchConstraintCoincidence_132 = Sketch_8.setCoincident( + SketchPoint_19.coordinates(), SketchLine_89.startPoint() +) SketchConstraintCoincidence_132.setName("SketchConstraintCoincidence_140") SketchConstraintHorizontal_17 = Sketch_8.setHorizontal(SketchLine_89.result()) SketchConstraintHorizontal_17.setName("SketchConstraintHorizontal_20") SketchPoint_20 = Sketch_8.addPoint(48.00130672136804, 6) -SketchConstraintCoincidence_133 = Sketch_8.setCoincident(SketchPoint_20.coordinates(), SketchLine_89.result()) +SketchConstraintCoincidence_133 = Sketch_8.setCoincident( + SketchPoint_20.coordinates(), SketchLine_89.result() +) SketchConstraintCoincidence_133.setName("SketchConstraintCoincidence_146") SketchLine_90 = Sketch_8.addLine(43.50261344273609, 8.25, 51.26978940411676, 8.25) SketchLine_90.setName("SketchLine_92") SketchLine_90.result().setName("SketchLine_92") -SketchConstraintCoincidence_134 = Sketch_8.setCoincident(SketchLine_87.startPoint(), SketchLine_90.startPoint()) +SketchConstraintCoincidence_134 = Sketch_8.setCoincident( + SketchLine_87.startPoint(), SketchLine_90.startPoint() +) SketchConstraintCoincidence_134.setName("SketchConstraintCoincidence_135") SketchLine_91 = Sketch_8.addLine(51.26978940411676, 8.25, 51.26978940411676, 3.75) SketchLine_91.setName("SketchLine_97") SketchLine_91.result().setName("SketchLine_97") -SketchConstraintCoincidence_135 = Sketch_8.setCoincident(SketchLine_90.endPoint(), SketchLine_91.startPoint()) +SketchConstraintCoincidence_135 = Sketch_8.setCoincident( + SketchLine_90.endPoint(), SketchLine_91.startPoint() +) SketchConstraintCoincidence_135.setName("SketchConstraintCoincidence_136") SketchLine_92 = Sketch_8.addLine(51.26978940411676, 3.75, 43.50261344273609, 3.75) SketchLine_92.setName("SketchLine_98") SketchLine_92.result().setName("SketchLine_98") -SketchConstraintCoincidence_136 = Sketch_8.setCoincident(SketchLine_91.endPoint(), SketchLine_92.startPoint()) +SketchConstraintCoincidence_136 = Sketch_8.setCoincident( + SketchLine_91.endPoint(), SketchLine_92.startPoint() +) SketchConstraintCoincidence_136.setName("SketchConstraintCoincidence_137") -SketchConstraintCoincidence_137 = Sketch_8.setCoincident(SketchLine_87.endPoint(), SketchLine_92.endPoint()) +SketchConstraintCoincidence_137 = Sketch_8.setCoincident( + SketchLine_87.endPoint(), SketchLine_92.endPoint() +) SketchConstraintCoincidence_137.setName("SketchConstraintCoincidence_138") SketchConstraintHorizontal_18 = Sketch_8.setHorizontal(SketchLine_92.result()) SketchConstraintHorizontal_19 = Sketch_8.setHorizontal(SketchLine_90.result()) SketchConstraintVertical_15 = Sketch_8.setVertical(SketchLine_91.result()) SketchLine_93 = Sketch_8.addLine(43.50261344273609, 3.75, 51.26978940411676, 8.25) SketchLine_93.setAuxiliary(True) -SketchConstraintCoincidence_138 = Sketch_8.setCoincident(SketchLine_87.endPoint(), SketchLine_93.startPoint()) +SketchConstraintCoincidence_138 = Sketch_8.setCoincident( + SketchLine_87.endPoint(), SketchLine_93.startPoint() +) SketchConstraintCoincidence_138.setName("SketchConstraintCoincidence_141") -SketchConstraintCoincidence_139 = Sketch_8.setCoincident(SketchLine_92.endPoint(), SketchLine_93.startPoint()) +SketchConstraintCoincidence_139 = Sketch_8.setCoincident( + SketchLine_92.endPoint(), SketchLine_93.startPoint() +) SketchConstraintCoincidence_139.setName("SketchConstraintCoincidence_142") -SketchConstraintCoincidence_140 = Sketch_8.setCoincident(SketchLine_91.startPoint(), SketchLine_93.endPoint()) +SketchConstraintCoincidence_140 = Sketch_8.setCoincident( + SketchLine_91.startPoint(), SketchLine_93.endPoint() +) SketchConstraintCoincidence_140.setName("SketchConstraintCoincidence_143") SketchPoint_21 = Sketch_8.addPoint(47.38620142342643, 6) SketchPoint_21.setAuxiliary(True) -SketchConstraintCoincidence_141 = Sketch_8.setCoincident(SketchPoint_21.coordinates(), SketchLine_93.result()) +SketchConstraintCoincidence_141 = Sketch_8.setCoincident( + SketchPoint_21.coordinates(), SketchLine_93.result() +) SketchConstraintCoincidence_141.setName("SketchConstraintCoincidence_144") -SketchConstraintMiddle_7 = Sketch_8.setMiddlePoint(SketchPoint_21.coordinates(), SketchLine_93.result()) -SketchConstraintCoincidence_142 = Sketch_8.setCoincident(SketchPoint_21.coordinates(), SketchLine_89.result()) +SketchConstraintMiddle_7 = Sketch_8.setMiddlePoint( + SketchPoint_21.coordinates(), SketchLine_93.result() +) +SketchConstraintCoincidence_142 = Sketch_8.setCoincident( + SketchPoint_21.coordinates(), SketchLine_89.result() +) 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/Modified_Face&Extrusion_1_1/To_Face")) +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/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") @@ -795,7 +1421,15 @@ SketchLine_95 = Sketch_9.addLine(29, 5, 21, 5) SketchLine_95.setName("SketchLine_96") SketchLine_95.result().setName("SketchLine_96") SketchLine_95.setAuxiliary(True) -SketchArc_19 = Sketch_9.addArc(25, 8, 21.53774043054522, 4.392679848735523, 28.46225956945478, 4.392679848735522, False) +SketchArc_19 = Sketch_9.addArc( + 25, + 8, + 21.53774043054522, + 4.392679848735523, + 28.46225956945478, + 4.392679848735522, + False, +) SketchArc_19.setName("SketchArc_22") SketchArc_19.result().setName("SketchArc_22") SketchArc_19.results()[1].setName("SketchArc_22_2") @@ -809,15 +1443,23 @@ SketchLine_98 = Sketch_9.addLine(29, 0, 29, 5) SketchLine_98.setName("SketchLine_101") SketchLine_98.result().setName("SketchLine_101") SketchLine_98.setAuxiliary(True) -SketchConstraintCoincidence_143 = Sketch_9.setCoincident(SketchLine_98.endPoint(), SketchLine_95.startPoint()) +SketchConstraintCoincidence_143 = Sketch_9.setCoincident( + SketchLine_98.endPoint(), SketchLine_95.startPoint() +) SketchConstraintCoincidence_143.setName("SketchConstraintCoincidence_147") SketchLine_99 = Sketch_9.addLine(21, 5, 21, 0) SketchLine_99.setAuxiliary(True) -SketchConstraintCoincidence_144 = Sketch_9.setCoincident(SketchLine_95.endPoint(), SketchLine_99.startPoint()) +SketchConstraintCoincidence_144 = Sketch_9.setCoincident( + SketchLine_95.endPoint(), SketchLine_99.startPoint() +) SketchConstraintCoincidence_144.setName("SketchConstraintCoincidence_148") -SketchConstraintCoincidence_145 = Sketch_9.setCoincident(SketchLine_99.endPoint(), SketchLine_96.startPoint()) +SketchConstraintCoincidence_145 = Sketch_9.setCoincident( + SketchLine_99.endPoint(), SketchLine_96.startPoint() +) SketchConstraintCoincidence_145.setName("SketchConstraintCoincidence_149") -SketchConstraintCoincidence_146 = Sketch_9.setCoincident(SketchLine_96.endPoint(), SketchLine_98.startPoint()) +SketchConstraintCoincidence_146 = Sketch_9.setCoincident( + SketchLine_96.endPoint(), SketchLine_98.startPoint() +) SketchConstraintCoincidence_146.setName("SketchConstraintCoincidence_150") SketchConstraintHorizontal_20 = Sketch_9.setHorizontal(SketchLine_95.result()) SketchConstraintHorizontal_20.setName("SketchConstraintHorizontal_21") @@ -826,12 +1468,16 @@ SketchConstraintHorizontal_21 = Sketch_9.setHorizontal(SketchLine_96.result()) SketchConstraintHorizontal_21.setName("SketchConstraintHorizontal_22") SketchConstraintVertical_17 = Sketch_9.setVertical(SketchLine_98.result()) SketchPoint_22 = Sketch_9.addPoint(21, 7.5) -SketchConstraintCoincidence_147 = Sketch_9.setCoincident(SketchLine_99.result(), SketchPoint_22.coordinates()) +SketchConstraintCoincidence_147 = Sketch_9.setCoincident( + SketchLine_99.result(), SketchPoint_22.coordinates() +) SketchConstraintCoincidence_147.setName("SketchConstraintCoincidence_151") SketchConstraintRigid_10 = Sketch_9.setFixed(SketchPoint_22.result()) SketchConstraintRigid_10.setName("SketchConstraintRigid_18") SketchPoint_23 = Sketch_9.addPoint(29, 7.5) -SketchConstraintCoincidence_148 = Sketch_9.setCoincident(SketchLine_98.result(), SketchPoint_23.coordinates()) +SketchConstraintCoincidence_148 = Sketch_9.setCoincident( + SketchLine_98.result(), SketchPoint_23.coordinates() +) SketchConstraintCoincidence_148.setName("SketchConstraintCoincidence_152") SketchConstraintRigid_11 = Sketch_9.setFixed(SketchPoint_23.result()) SketchConstraintRigid_11.setName("SketchConstraintRigid_20") @@ -840,7 +1486,9 @@ SketchConstraintLength_15.setName("SketchConstraintLength_16") SketchLine_100 = Sketch_9.addLine(0, 0, 45.5, 0) SketchLine_100.setName("SketchLine_102") SketchLine_100.result().setName("SketchLine_102") -SketchConstraintCoincidence_149 = Sketch_9.setCoincident(SketchLine_99.endPoint(), SketchLine_100.result()) +SketchConstraintCoincidence_149 = Sketch_9.setCoincident( + SketchLine_99.endPoint(), SketchLine_100.result() +) SketchConstraintCoincidence_149.setName("SketchConstraintCoincidence_153") SketchConstraintRigid_12 = Sketch_9.setFixed(SketchLine_100.result()) SketchConstraintRigid_12.setName("SketchConstraintRigid_21") @@ -849,88 +1497,176 @@ SketchArc_20.setName("SketchArc_19") SketchArc_20.result().setName("SketchArc_19") SketchArc_20.results()[1].setName("SketchArc_19_2") SketchArc_20.setAuxiliary(True) -SketchConstraintCoincidence_150 = Sketch_9.setCoincident(SketchLine_95.endPoint(), SketchArc_20.startPoint()) +SketchConstraintCoincidence_150 = Sketch_9.setCoincident( + SketchLine_95.endPoint(), SketchArc_20.startPoint() +) SketchConstraintCoincidence_150.setName("SketchConstraintCoincidence_154") -SketchConstraintCoincidence_151 = Sketch_9.setCoincident(SketchLine_99.startPoint(), SketchArc_20.startPoint()) +SketchConstraintCoincidence_151 = Sketch_9.setCoincident( + SketchLine_99.startPoint(), SketchArc_20.startPoint() +) SketchConstraintCoincidence_151.setName("SketchConstraintCoincidence_155") -SketchConstraintCoincidence_152 = Sketch_9.setCoincident(SketchLine_95.startPoint(), SketchArc_20.endPoint()) +SketchConstraintCoincidence_152 = Sketch_9.setCoincident( + SketchLine_95.startPoint(), SketchArc_20.endPoint() +) SketchConstraintCoincidence_152.setName("SketchConstraintCoincidence_156") -SketchConstraintCoincidence_153 = Sketch_9.setCoincident(SketchLine_98.endPoint(), SketchArc_20.endPoint()) +SketchConstraintCoincidence_153 = Sketch_9.setCoincident( + SketchLine_98.endPoint(), SketchArc_20.endPoint() +) SketchConstraintCoincidence_153.setName("SketchConstraintCoincidence_157") SketchConstraintRadius_8 = Sketch_9.setRadius(SketchArc_20.results()[1], 5) SketchLine_101 = Sketch_9.addLine(1, 0, 1, 1.8) SketchLine_101.setName("SketchLine_103") SketchLine_101.result().setName("SketchLine_103") -SketchConstraintCoincidence_154 = Sketch_9.setCoincident(SketchLine_101.startPoint(), SketchLine_100.result()) +SketchConstraintCoincidence_154 = Sketch_9.setCoincident( + SketchLine_101.startPoint(), SketchLine_100.result() +) SketchConstraintCoincidence_154.setName("SketchConstraintCoincidence_158") SketchLine_102 = Sketch_9.addLine(1, 1.8, 8, 3.389761862250954) SketchLine_102.setName("SketchLine_104") SketchLine_102.result().setName("SketchLine_104") -SketchConstraintCoincidence_155 = Sketch_9.setCoincident(SketchLine_101.endPoint(), SketchLine_102.startPoint()) +SketchConstraintCoincidence_155 = Sketch_9.setCoincident( + SketchLine_101.endPoint(), SketchLine_102.startPoint() +) SketchConstraintCoincidence_155.setName("SketchConstraintCoincidence_159") SketchLine_103 = Sketch_9.addLine(8, 3.389761862250954, 8, 0) SketchLine_103.setName("SketchLine_105") SketchLine_103.result().setName("SketchLine_105") -SketchConstraintCoincidence_156 = Sketch_9.setCoincident(SketchLine_102.endPoint(), SketchLine_103.startPoint()) +SketchConstraintCoincidence_156 = Sketch_9.setCoincident( + SketchLine_102.endPoint(), SketchLine_103.startPoint() +) SketchConstraintCoincidence_156.setName("SketchConstraintCoincidence_160") SketchLine_104 = Sketch_9.addLine(8, 0, 1, 0) SketchLine_104.setName("SketchLine_106") SketchLine_104.result().setName("SketchLine_106") -SketchConstraintCoincidence_157 = Sketch_9.setCoincident(SketchLine_103.endPoint(), SketchLine_104.startPoint()) +SketchConstraintCoincidence_157 = Sketch_9.setCoincident( + SketchLine_103.endPoint(), SketchLine_104.startPoint() +) SketchConstraintCoincidence_157.setName("SketchConstraintCoincidence_161") -SketchConstraintCoincidence_158 = Sketch_9.setCoincident(SketchLine_101.startPoint(), SketchLine_104.endPoint()) +SketchConstraintCoincidence_158 = Sketch_9.setCoincident( + SketchLine_101.startPoint(), SketchLine_104.endPoint() +) SketchConstraintCoincidence_158.setName("SketchConstraintCoincidence_162") -SketchConstraintCoincidence_159 = Sketch_9.setCoincident(SketchLine_104.startPoint(), SketchLine_100.result()) +SketchConstraintCoincidence_159 = Sketch_9.setCoincident( + SketchLine_104.startPoint(), SketchLine_100.result() +) SketchConstraintCoincidence_159.setName("SketchConstraintCoincidence_163") SketchConstraintVertical_18 = Sketch_9.setVertical(SketchLine_103.result()) SketchConstraintVertical_19 = Sketch_9.setVertical(SketchLine_101.result()) SketchConstraintLength_16 = Sketch_9.setLength(SketchLine_104.result(), 7) SketchConstraintLength_16.setName("SketchConstraintLength_17") -SketchConstraintDistance_16 = Sketch_9.setDistance(SketchLine_101.result(), SketchLine_100.startPoint(), 1, False) +SketchConstraintDistance_16 = Sketch_9.setDistance( + SketchLine_101.result(), SketchLine_100.startPoint(), 1, False +) SketchConstraintLength_17 = Sketch_9.setLength(SketchLine_101.result(), 1.8) SketchConstraintLength_17.setName("SketchConstraintLength_18") -SketchArc_21 = Sketch_9.addArc(21.31772863153846, 4.163450069699051, 21.53774043054522, 4.392679848735523, 21, 4.163450069699051, False) -SketchArc_22 = Sketch_9.addArc(25, 8, 21.53774043054522, 4.392679848735523, 29, 5, False) +SketchArc_21 = Sketch_9.addArc( + 21.31772863153846, + 4.163450069699051, + 21.53774043054522, + 4.392679848735523, + 21, + 4.163450069699051, + False, +) +SketchArc_22 = Sketch_9.addArc( + 25, 8, 21.53774043054522, 4.392679848735523, 29, 5, False +) SketchArc_22.setName("SketchArc_20") SketchArc_22.result().setName("SketchArc_20") SketchArc_22.results()[1].setName("SketchArc_20_2") SketchArc_22.setAuxiliary(True) -SketchConstraintCoincidence_160 = Sketch_9.setCoincident(SketchArc_21.startPoint(), SketchArc_22.startPoint()) +SketchConstraintCoincidence_160 = Sketch_9.setCoincident( + SketchArc_21.startPoint(), SketchArc_22.startPoint() +) SketchConstraintCoincidence_160.setName("SketchConstraintCoincidence_164") -SketchConstraintCoincidence_161 = Sketch_9.setCoincident(SketchArc_21.endPoint(), SketchLine_94.startPoint()) +SketchConstraintCoincidence_161 = Sketch_9.setCoincident( + SketchArc_21.endPoint(), SketchLine_94.startPoint() +) SketchConstraintCoincidence_161.setName("SketchConstraintCoincidence_165") -SketchConstraintTangent_10 = Sketch_9.setTangent(SketchArc_21.results()[1], SketchLine_94.result()) -SketchConstraintTangent_11 = Sketch_9.setTangent(SketchArc_21.results()[1], SketchArc_22.results()[1]) -SketchConstraintCoincidence_162 = Sketch_9.setCoincident(SketchLine_99.endPoint(), SketchLine_94.endPoint()) +SketchConstraintTangent_10 = Sketch_9.setTangent( + SketchArc_21.results()[1], SketchLine_94.result() +) +SketchConstraintTangent_11 = Sketch_9.setTangent( + SketchArc_21.results()[1], SketchArc_22.results()[1] +) +SketchConstraintCoincidence_162 = Sketch_9.setCoincident( + SketchLine_99.endPoint(), SketchLine_94.endPoint() +) SketchConstraintCoincidence_162.setName("SketchConstraintCoincidence_166") -SketchConstraintCoincidence_163 = Sketch_9.setCoincident(SketchArc_20.endPoint(), SketchArc_22.endPoint()) +SketchConstraintCoincidence_163 = Sketch_9.setCoincident( + SketchArc_20.endPoint(), SketchArc_22.endPoint() +) SketchConstraintCoincidence_163.setName("SketchConstraintCoincidence_167") -SketchConstraintTangent_12 = Sketch_9.setTangent(SketchArc_20.results()[1], SketchArc_22.results()[1]) -SketchConstraintCoincidence_164 = Sketch_9.setCoincident(SketchLine_94.startPoint(), SketchLine_99.result()) +SketchConstraintTangent_12 = Sketch_9.setTangent( + SketchArc_20.results()[1], SketchArc_22.results()[1] +) +SketchConstraintCoincidence_164 = Sketch_9.setCoincident( + SketchLine_94.startPoint(), SketchLine_99.result() +) SketchConstraintCoincidence_164.setName("SketchConstraintCoincidence_168") -SketchConstraintCoincidence_165 = Sketch_9.setCoincident(SketchArc_22.startPoint(), SketchArc_20.results()[1]) +SketchConstraintCoincidence_165 = Sketch_9.setCoincident( + SketchArc_22.startPoint(), SketchArc_20.results()[1] +) SketchConstraintCoincidence_165.setName("SketchConstraintCoincidence_169") -SketchArc_23 = Sketch_9.addArc(28.68227136846154, 4.163450069699049, 29, 4.163450069699049, 28.46225956945478, 4.392679848735522, False) -SketchConstraintCoincidence_166 = Sketch_9.setCoincident(SketchArc_23.startPoint(), SketchLine_97.endPoint()) +SketchArc_23 = Sketch_9.addArc( + 28.68227136846154, + 4.163450069699049, + 29, + 4.163450069699049, + 28.46225956945478, + 4.392679848735522, + False, +) +SketchConstraintCoincidence_166 = Sketch_9.setCoincident( + SketchArc_23.startPoint(), SketchLine_97.endPoint() +) SketchConstraintCoincidence_166.setName("SketchConstraintCoincidence_170") -SketchConstraintCoincidence_167 = Sketch_9.setCoincident(SketchArc_23.endPoint(), SketchArc_19.endPoint()) +SketchConstraintCoincidence_167 = Sketch_9.setCoincident( + SketchArc_23.endPoint(), SketchArc_19.endPoint() +) SketchConstraintCoincidence_167.setName("SketchConstraintCoincidence_171") -SketchConstraintTangent_13 = Sketch_9.setTangent(SketchArc_23.results()[1], SketchArc_19.results()[1]) -SketchConstraintTangent_14 = Sketch_9.setTangent(SketchArc_23.results()[1], SketchLine_97.result()) -SketchConstraintCoincidence_168 = Sketch_9.setCoincident(SketchArc_22.startPoint(), SketchArc_19.startPoint()) +SketchConstraintTangent_13 = Sketch_9.setTangent( + SketchArc_23.results()[1], SketchArc_19.results()[1] +) +SketchConstraintTangent_14 = Sketch_9.setTangent( + SketchArc_23.results()[1], SketchLine_97.result() +) +SketchConstraintCoincidence_168 = Sketch_9.setCoincident( + SketchArc_22.startPoint(), SketchArc_19.startPoint() +) SketchConstraintCoincidence_168.setName("SketchConstraintCoincidence_172") -SketchConstraintCoincidence_169 = Sketch_9.setCoincident(SketchLine_98.startPoint(), SketchLine_97.startPoint()) +SketchConstraintCoincidence_169 = Sketch_9.setCoincident( + SketchLine_98.startPoint(), SketchLine_97.startPoint() +) SketchConstraintCoincidence_169.setName("SketchConstraintCoincidence_173") -SketchConstraintTangent_15 = Sketch_9.setTangent(SketchArc_22.results()[1], SketchArc_19.results()[1]) -SketchConstraintCoincidence_170 = Sketch_9.setCoincident(SketchArc_19.endPoint(), SketchArc_22.results()[1]) +SketchConstraintTangent_15 = Sketch_9.setTangent( + SketchArc_22.results()[1], SketchArc_19.results()[1] +) +SketchConstraintCoincidence_170 = Sketch_9.setCoincident( + SketchArc_19.endPoint(), SketchArc_22.results()[1] +) SketchConstraintCoincidence_170.setName("SketchConstraintCoincidence_174") -SketchConstraintCoincidence_171 = Sketch_9.setCoincident(SketchLine_97.endPoint(), SketchLine_98.result()) +SketchConstraintCoincidence_171 = Sketch_9.setCoincident( + SketchLine_97.endPoint(), SketchLine_98.result() +) SketchConstraintCoincidence_171.setName("SketchConstraintCoincidence_175") 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/Modified_Face&Sketch_1/SketchLine_1")) +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/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) @@ -940,74 +1676,113 @@ SketchLine_105.setName("SketchLine_109") SketchLine_105.result().setName("SketchLine_109") SketchConstraintRigid_13 = Sketch_10.setFixed(SketchLine_105.result()) SketchConstraintRigid_13.setName("SketchConstraintRigid_22") -SketchConstraintCoincidence_172 = Sketch_10.setCoincident(SketchPoint_24.coordinates(), SketchLine_105.result()) +SketchConstraintCoincidence_172 = Sketch_10.setCoincident( + SketchPoint_24.coordinates(), SketchLine_105.result() +) SketchConstraintCoincidence_172.setName("SketchConstraintCoincidence_176") -SketchConstraintMiddle_8 = Sketch_10.setMiddlePoint(SketchLine_105.result(), SketchPoint_24.coordinates()) +SketchConstraintMiddle_8 = Sketch_10.setMiddlePoint( + SketchLine_105.result(), SketchPoint_24.coordinates() +) SketchLine_106 = Sketch_10.addLine(0, 6, 17.31036191565843, 6) SketchLine_106.setName("SketchLine_110") SketchLine_106.result().setName("SketchLine_110") SketchLine_106.setAuxiliary(True) -SketchConstraintCoincidence_173 = Sketch_10.setCoincident(SketchPoint_24.coordinates(), SketchLine_106.startPoint()) +SketchConstraintCoincidence_173 = Sketch_10.setCoincident( + SketchPoint_24.coordinates(), SketchLine_106.startPoint() +) SketchConstraintCoincidence_173.setName("SketchConstraintCoincidence_177") SketchConstraintHorizontal_22 = Sketch_10.setHorizontal(SketchLine_106.result()) SketchConstraintHorizontal_22.setName("SketchConstraintHorizontal_23") -SketchConstraintCoincidence_174 = Sketch_10.setCoincident(SketchCircle_1.center(), SketchLine_106.result()) +SketchConstraintCoincidence_174 = Sketch_10.setCoincident( + SketchCircle_1.center(), SketchLine_106.result() +) SketchConstraintCoincidence_174.setName("SketchConstraintCoincidence_178") -SketchConstraintDistance_17 = Sketch_10.setDistance(SketchLine_105.result(), SketchCircle_1.center(), 12, False) +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/Face-SketchCircle_1_2r_wire")], 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() Sketch_11 = model.addSketch(Part_2_doc, model.defaultPlane("XOY")) SketchLine_107 = Sketch_11.addLine(0, 0, 60, 0) SketchPoint_25 = Sketch_11.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_175 = Sketch_11.setCoincident(SketchLine_107.startPoint(), SketchPoint_25.result()) +SketchConstraintCoincidence_175 = Sketch_11.setCoincident( + SketchLine_107.startPoint(), SketchPoint_25.result() +) SketchLine_108 = Sketch_11.addLine(60, 0, 60, 1.5) SketchLine_108.setName("SketchLine_3") SketchLine_108.result().setName("SketchLine_3") -SketchConstraintCoincidence_176 = Sketch_11.setCoincident(SketchLine_107.endPoint(), SketchLine_108.startPoint()) +SketchConstraintCoincidence_176 = Sketch_11.setCoincident( + SketchLine_107.endPoint(), SketchLine_108.startPoint() +) SketchConstraintCoincidence_176.setName("SketchConstraintCoincidence_3") SketchLine_109 = Sketch_11.addLine(60, 1.5, 57, 1.5) SketchLine_109.setName("SketchLine_4") SketchLine_109.result().setName("SketchLine_4") -SketchConstraintCoincidence_177 = Sketch_11.setCoincident(SketchLine_108.endPoint(), SketchLine_109.startPoint()) +SketchConstraintCoincidence_177 = Sketch_11.setCoincident( + SketchLine_108.endPoint(), SketchLine_109.startPoint() +) SketchConstraintCoincidence_177.setName("SketchConstraintCoincidence_4") SketchLine_110 = Sketch_11.addLine(57, 1.5, 29, 7.5) SketchLine_110.setName("SketchLine_5") SketchLine_110.result().setName("SketchLine_5") -SketchConstraintCoincidence_178 = Sketch_11.setCoincident(SketchLine_109.endPoint(), SketchLine_110.startPoint()) +SketchConstraintCoincidence_178 = Sketch_11.setCoincident( + SketchLine_109.endPoint(), SketchLine_110.startPoint() +) SketchConstraintCoincidence_178.setName("SketchConstraintCoincidence_5") SketchLine_111 = Sketch_11.addLine(28, 7.5, 28, 8) SketchLine_111.setName("SketchLine_7") SketchLine_111.result().setName("SketchLine_7") -SketchArc_24 = Sketch_11.addArc(25.00007393928819, 7.9789374678129, 28, 8, 22.00014787857639, 8, False) +SketchArc_24 = Sketch_11.addArc( + 25.00007393928819, 7.9789374678129, 28, 8, 22.00014787857639, 8, False +) SketchLine_112 = Sketch_11.addLine(22.00014787857639, 8, 22.00014787857639, 7.5) SketchLine_112.setName("SketchLine_8") SketchLine_112.result().setName("SketchLine_8") -SketchConstraintCoincidence_179 = Sketch_11.setCoincident(SketchArc_24.endPoint(), SketchLine_112.startPoint()) +SketchConstraintCoincidence_179 = Sketch_11.setCoincident( + SketchArc_24.endPoint(), SketchLine_112.startPoint() +) SketchConstraintCoincidence_179.setName("SketchConstraintCoincidence_8") SketchLine_113 = Sketch_11.addLine(22.00014787857639, 7.5, 21.00014787857639, 7.5) SketchLine_113.setName("SketchLine_9") SketchLine_113.result().setName("SketchLine_9") -SketchConstraintCoincidence_180 = Sketch_11.setCoincident(SketchLine_112.endPoint(), SketchLine_113.startPoint()) +SketchConstraintCoincidence_180 = Sketch_11.setCoincident( + SketchLine_112.endPoint(), SketchLine_113.startPoint() +) SketchConstraintCoincidence_180.setName("SketchConstraintCoincidence_9") SketchLine_114 = Sketch_11.addLine(0, 0, 0, 3.5) SketchLine_114.setName("SketchLine_10") SketchLine_114.result().setName("SketchLine_10") -SketchConstraintCoincidence_181 = Sketch_11.setCoincident(SketchLine_107.startPoint(), SketchLine_114.startPoint()) +SketchConstraintCoincidence_181 = Sketch_11.setCoincident( + SketchLine_107.startPoint(), SketchLine_114.startPoint() +) SketchConstraintCoincidence_181.setName("SketchConstraintCoincidence_10") -SketchConstraintCoincidence_182 = Sketch_11.setCoincident(SketchPoint_25.coordinates(), SketchLine_114.startPoint()) +SketchConstraintCoincidence_182 = Sketch_11.setCoincident( + SketchPoint_25.coordinates(), SketchLine_114.startPoint() +) SketchConstraintCoincidence_182.setName("SketchConstraintCoincidence_11") SketchLine_115 = Sketch_11.addLine(0, 3.5, 8, 5) SketchLine_115.setName("SketchLine_11") SketchLine_115.result().setName("SketchLine_11") -SketchConstraintCoincidence_183 = Sketch_11.setCoincident(SketchLine_114.endPoint(), SketchLine_115.startPoint()) +SketchConstraintCoincidence_183 = Sketch_11.setCoincident( + SketchLine_114.endPoint(), SketchLine_115.startPoint() +) SketchConstraintCoincidence_183.setName("SketchConstraintCoincidence_13") SketchLine_116 = Sketch_11.addLine(8, 5, 10.426976887961, 4.40018070612629) SketchLine_116.setName("SketchLine_12") SketchLine_116.result().setName("SketchLine_12") -SketchConstraintCoincidence_184 = Sketch_11.setCoincident(SketchLine_115.endPoint(), SketchLine_116.startPoint()) +SketchConstraintCoincidence_184 = Sketch_11.setCoincident( + SketchLine_115.endPoint(), SketchLine_116.startPoint() +) SketchConstraintCoincidence_184.setName("SketchConstraintCoincidence_14") SketchConstraintLength_18 = Sketch_11.setLength(SketchLine_107.result(), 60) SketchConstraintHorizontal_23 = Sketch_11.setHorizontal(SketchLine_107.result()) @@ -1017,120 +1792,231 @@ SketchConstraintHorizontal_25 = Sketch_11.setHorizontal(SketchLine_113.result()) SketchConstraintHorizontal_25.setName("SketchConstraintHorizontal_4") SketchConstraintVertical_21 = Sketch_11.setVertical(SketchLine_111.result()) SketchConstraintVertical_22 = Sketch_11.setVertical(SketchLine_112.result()) -SketchConstraintCoincidence_185 = Sketch_11.setCoincident(SketchLine_111.endPoint(), SketchArc_24.startPoint()) +SketchConstraintCoincidence_185 = Sketch_11.setCoincident( + SketchLine_111.endPoint(), SketchArc_24.startPoint() +) SketchConstraintCoincidence_185.setName("SketchConstraintCoincidence_15") SketchConstraintVertical_23 = Sketch_11.setVertical(SketchLine_114.result()) -SketchConstraintDistance_18 = Sketch_11.setDistance(SketchLine_114.endPoint(), SketchLine_107.result(), 3.5, False) -SketchConstraintDistance_19 = Sketch_11.setDistance(SketchLine_115.endPoint(), SketchLine_114.result(), 8, False) +SketchConstraintDistance_18 = Sketch_11.setDistance( + SketchLine_114.endPoint(), SketchLine_107.result(), 3.5, False +) +SketchConstraintDistance_19 = Sketch_11.setDistance( + SketchLine_115.endPoint(), SketchLine_114.result(), 8, False +) SketchConstraintLength_19 = Sketch_11.setLength(SketchLine_116.result(), 2.5) SketchConstraintRadius_10 = Sketch_11.setRadius(SketchArc_24.results()[1], 3) SketchConstraintLength_20 = Sketch_11.setLength(SketchLine_112.result(), 0.5) SketchConstraintLength_21 = Sketch_11.setLength(SketchLine_113.result(), 1) SketchConstraintLength_22 = Sketch_11.setLength(SketchLine_111.result(), 0.5) -SketchConstraintDistance_20 = Sketch_11.setDistance(SketchLine_112.endPoint(), SketchLine_107.result(), 7.5, False) +SketchConstraintDistance_20 = Sketch_11.setDistance( + SketchLine_112.endPoint(), SketchLine_107.result(), 7.5, False +) SketchConstraintLength_23 = Sketch_11.setLength(SketchLine_109.result(), 3) SketchConstraintLength_23.setName("SketchConstraintLength_7") SketchConstraintLength_24 = Sketch_11.setLength(SketchLine_108.result(), 1.5) SketchConstraintLength_24.setName("SketchConstraintLength_8") -SketchConstraintDistance_21 = Sketch_11.setDistance(SketchLine_115.endPoint(), SketchLine_107.result(), 5, False) -SketchConstraintDistance_22 = Sketch_11.setDistance(SketchLine_111.startPoint(), SketchLine_107.result(), 7.5, False) -SketchLine_117 = Sketch_11.addLine(12.81710695710752, 0, 12.81710695710752, 7.765286531476907) +SketchConstraintDistance_21 = Sketch_11.setDistance( + SketchLine_115.endPoint(), SketchLine_107.result(), 5, False +) +SketchConstraintDistance_22 = Sketch_11.setDistance( + SketchLine_111.startPoint(), SketchLine_107.result(), 7.5, False +) +SketchLine_117 = Sketch_11.addLine( + 12.81710695710752, 0, 12.81710695710752, 7.765286531476907 +) SketchLine_117.setName("SketchLine_13") SketchLine_117.result().setName("SketchLine_13") SketchLine_117.setAuxiliary(True) -SketchConstraintCoincidence_186 = Sketch_11.setCoincident(SketchLine_117.startPoint(), SketchLine_107.result()) +SketchConstraintCoincidence_186 = Sketch_11.setCoincident( + SketchLine_117.startPoint(), SketchLine_107.result() +) SketchConstraintCoincidence_186.setName("SketchConstraintCoincidence_16") SketchConstraintVertical_24 = Sketch_11.setVertical(SketchLine_117.result()) SketchPoint_26 = Sketch_11.addPoint(12.81710695710752, 3) SketchPoint_26.setAuxiliary(True) -SketchConstraintCoincidence_187 = Sketch_11.setCoincident(SketchPoint_26.coordinates(), SketchLine_117.result()) +SketchConstraintCoincidence_187 = Sketch_11.setCoincident( + SketchPoint_26.coordinates(), SketchLine_117.result() +) SketchConstraintCoincidence_187.setName("SketchConstraintCoincidence_17") -SketchConstraintDistance_23 = Sketch_11.setDistance(SketchPoint_26.coordinates(), SketchLine_107.result(), 3, False) +SketchConstraintDistance_23 = Sketch_11.setDistance( + SketchPoint_26.coordinates(), SketchLine_107.result(), 3, False +) SketchLine_118 = Sketch_11.addLine(28, 7.5, 29, 7.5) SketchLine_118.setName("SketchLine_14") SketchLine_118.result().setName("SketchLine_14") -SketchConstraintCoincidence_188 = Sketch_11.setCoincident(SketchLine_111.startPoint(), SketchLine_118.startPoint()) +SketchConstraintCoincidence_188 = Sketch_11.setCoincident( + SketchLine_111.startPoint(), SketchLine_118.startPoint() +) SketchConstraintCoincidence_188.setName("SketchConstraintCoincidence_18") -SketchConstraintCoincidence_189 = Sketch_11.setCoincident(SketchLine_110.endPoint(), SketchLine_118.endPoint()) +SketchConstraintCoincidence_189 = Sketch_11.setCoincident( + SketchLine_110.endPoint(), SketchLine_118.endPoint() +) SketchConstraintCoincidence_189.setName("SketchConstraintCoincidence_19") SketchConstraintLength_25 = Sketch_11.setLength(SketchLine_118.result(), 1) SketchConstraintLength_25.setName("SketchConstraintLength_9") -SketchArc_25 = Sketch_11.addArc(14.78851987160339, 9.105317068618911, 10.426976887961, 4.40018070612629, 21.00014787857639, 7.5, False) -SketchConstraintCoincidence_190 = Sketch_11.setCoincident(SketchLine_116.endPoint(), SketchArc_25.startPoint()) +SketchArc_25 = Sketch_11.addArc( + 14.78851987160339, + 9.105317068618911, + 10.426976887961, + 4.40018070612629, + 21.00014787857639, + 7.5, + False, +) +SketchConstraintCoincidence_190 = Sketch_11.setCoincident( + SketchLine_116.endPoint(), SketchArc_25.startPoint() +) SketchConstraintCoincidence_190.setName("SketchConstraintCoincidence_20") -SketchConstraintCoincidence_191 = Sketch_11.setCoincident(SketchLine_113.endPoint(), SketchArc_25.endPoint()) +SketchConstraintCoincidence_191 = Sketch_11.setCoincident( + SketchLine_113.endPoint(), SketchArc_25.endPoint() +) SketchConstraintCoincidence_191.setName("SketchConstraintCoincidence_21") -SketchConstraintCoincidence_192 = Sketch_11.setCoincident(SketchPoint_26.coordinates(), SketchArc_25.results()[1]) +SketchConstraintCoincidence_192 = Sketch_11.setCoincident( + SketchPoint_26.coordinates(), SketchArc_25.results()[1] +) SketchConstraintCoincidence_192.setName("SketchConstraintCoincidence_22") SketchConstraintHorizontal_26 = Sketch_11.setHorizontal(SketchLine_118.result()) SketchConstraintHorizontal_26.setName("SketchConstraintHorizontal_9") -SketchConstraintDistance_24 = Sketch_11.setDistance(SketchLine_111.startPoint(), SketchLine_108.result(), 32, False) +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/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) +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&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]")) +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 = Sketch_12.setCoincident( + SketchArc_26.startPoint(), SketchLine_119.result() +) SketchConstraintCoincidence_193.setName("SketchConstraintCoincidence_23") 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 = 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&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]")) +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()) -SketchConstraintDistance_25 = Sketch_12.setDistance(SketchArc_26.startPoint(), SketchLine_121.result(), 6, False) +SketchConstraintTangent_16 = Sketch_12.setTangent( + SketchArc_26.results()[1], SketchLine_121.result() +) +SketchConstraintDistance_25 = Sketch_12.setDistance( + SketchArc_26.startPoint(), SketchLine_121.result(), 6, False +) SketchConstraintDistance_25.setName("SketchConstraintDistance_7") SketchLine_122 = Sketch_12.addLine(54, 12, 53.10174978726379, 13.92603605930655) SketchLine_122.setName("SketchLine_18") SketchLine_122.result().setName("SketchLine_18") -SketchConstraintCoincidence_195 = Sketch_12.setCoincident(SketchArc_26.startPoint(), SketchLine_122.startPoint()) +SketchConstraintCoincidence_195 = Sketch_12.setCoincident( + SketchArc_26.startPoint(), SketchLine_122.startPoint() +) SketchConstraintCoincidence_195.setName("SketchConstraintCoincidence_25") -SketchLine_123 = Sketch_12.addLine(53.10174978726379, 13.92603605930655, 63.82610057919769, 13.82486293862793) +SketchLine_123 = Sketch_12.addLine( + 53.10174978726379, 13.92603605930655, 63.82610057919769, 13.82486293862793 +) SketchLine_123.setName("SketchLine_19") SketchLine_123.result().setName("SketchLine_19") -SketchConstraintCoincidence_196 = Sketch_12.setCoincident(SketchLine_122.endPoint(), SketchLine_123.startPoint()) +SketchConstraintCoincidence_196 = Sketch_12.setCoincident( + SketchLine_122.endPoint(), SketchLine_123.startPoint() +) SketchConstraintCoincidence_196.setName("SketchConstraintCoincidence_26") -SketchLine_124 = Sketch_12.addLine(63.82610057919769, 13.82486293862793, 62.66260969139353, -3.07104821470189) +SketchLine_124 = Sketch_12.addLine( + 63.82610057919769, 13.82486293862793, 62.66260969139353, -3.07104821470189 +) SketchLine_124.setName("SketchLine_20") SketchLine_124.result().setName("SketchLine_20") -SketchConstraintCoincidence_197 = Sketch_12.setCoincident(SketchLine_123.endPoint(), SketchLine_124.startPoint()) +SketchConstraintCoincidence_197 = Sketch_12.setCoincident( + SketchLine_123.endPoint(), SketchLine_124.startPoint() +) SketchConstraintCoincidence_197.setName("SketchConstraintCoincidence_27") -SketchLine_125 = Sketch_12.addLine(62.66260969139353, -3.07104821470189, 53.10174978726379, -2.868701973344648) +SketchLine_125 = Sketch_12.addLine( + 62.66260969139353, -3.07104821470189, 53.10174978726379, -2.868701973344648 +) SketchLine_125.setName("SketchLine_21") SketchLine_125.result().setName("SketchLine_21") -SketchConstraintCoincidence_198 = Sketch_12.setCoincident(SketchLine_124.endPoint(), SketchLine_125.startPoint()) +SketchConstraintCoincidence_198 = Sketch_12.setCoincident( + SketchLine_124.endPoint(), SketchLine_125.startPoint() +) SketchConstraintCoincidence_198.setName("SketchConstraintCoincidence_28") SketchLine_126 = Sketch_12.addLine(53.10174978726379, -2.868701973344648, 54, 0) SketchLine_126.setName("SketchLine_22") SketchLine_126.result().setName("SketchLine_22") -SketchConstraintCoincidence_199 = Sketch_12.setCoincident(SketchLine_125.endPoint(), SketchLine_126.startPoint()) +SketchConstraintCoincidence_199 = Sketch_12.setCoincident( + SketchLine_125.endPoint(), SketchLine_126.startPoint() +) SketchConstraintCoincidence_199.setName("SketchConstraintCoincidence_29") -SketchConstraintCoincidence_200 = Sketch_12.setCoincident(SketchArc_26.endPoint(), SketchLine_126.endPoint()) +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-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")) +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&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14]")) +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()) +SketchConstraintCoincidence_201 = Sketch_13.setCoincident( + SketchLine_127.startPoint(), SketchLine_128.result() +) SketchConstraintCoincidence_201.setName("SketchConstraintCoincidence_31") SketchConstraintHorizontal_27 = Sketch_13.setHorizontal(SketchLine_127.result()) SketchLine_129 = Sketch_13.addLine(28, -6, 63.78468475453244, -6) SketchLine_129.setName("SketchLine_25") SketchLine_129.result().setName("SketchLine_25") SketchLine_129.setAuxiliary(True) -SketchConstraintCoincidence_202 = Sketch_13.setCoincident(SketchLine_127.startPoint(), SketchLine_129.startPoint()) +SketchConstraintCoincidence_202 = Sketch_13.setCoincident( + SketchLine_127.startPoint(), SketchLine_129.startPoint() +) SketchConstraintCoincidence_202.setName("SketchConstraintCoincidence_32") SketchConstraintHorizontal_28 = Sketch_13.setHorizontal(SketchLine_129.result()) SketchLine_130 = Sketch_13.addLine(60, -1.5, 29, -1.5) @@ -1145,13 +2031,21 @@ SketchLine_132.result().setName("SketchLine_28") SketchLine_133 = Sketch_13.addLine(60, -10.5, 60, -1.5) SketchLine_133.setName("SketchLine_29") SketchLine_133.result().setName("SketchLine_29") -SketchConstraintCoincidence_203 = Sketch_13.setCoincident(SketchLine_133.endPoint(), SketchLine_130.startPoint()) +SketchConstraintCoincidence_203 = Sketch_13.setCoincident( + SketchLine_133.endPoint(), SketchLine_130.startPoint() +) SketchConstraintCoincidence_203.setName("SketchConstraintCoincidence_33") -SketchConstraintCoincidence_204 = Sketch_13.setCoincident(SketchLine_130.endPoint(), SketchLine_131.startPoint()) +SketchConstraintCoincidence_204 = Sketch_13.setCoincident( + SketchLine_130.endPoint(), SketchLine_131.startPoint() +) SketchConstraintCoincidence_204.setName("SketchConstraintCoincidence_34") -SketchConstraintCoincidence_205 = Sketch_13.setCoincident(SketchLine_131.endPoint(), SketchLine_132.startPoint()) +SketchConstraintCoincidence_205 = Sketch_13.setCoincident( + SketchLine_131.endPoint(), SketchLine_132.startPoint() +) SketchConstraintCoincidence_205.setName("SketchConstraintCoincidence_35") -SketchConstraintCoincidence_206 = Sketch_13.setCoincident(SketchLine_132.endPoint(), SketchLine_133.startPoint()) +SketchConstraintCoincidence_206 = Sketch_13.setCoincident( + SketchLine_132.endPoint(), SketchLine_133.startPoint() +) SketchConstraintCoincidence_206.setName("SketchConstraintCoincidence_36") SketchConstraintHorizontal_29 = Sketch_13.setHorizontal(SketchLine_130.result()) SketchConstraintVertical_25 = Sketch_13.setVertical(SketchLine_131.result()) @@ -1161,56 +2055,96 @@ SketchLine_134 = Sketch_13.addLine(29, -10.5, 60, -1.5) SketchLine_134.setName("SketchLine_30") SketchLine_134.result().setName("SketchLine_30") SketchLine_134.setAuxiliary(True) -SketchConstraintCoincidence_207 = Sketch_13.setCoincident(SketchLine_131.endPoint(), SketchLine_134.startPoint()) +SketchConstraintCoincidence_207 = Sketch_13.setCoincident( + SketchLine_131.endPoint(), SketchLine_134.startPoint() +) SketchConstraintCoincidence_207.setName("SketchConstraintCoincidence_37") -SketchConstraintCoincidence_208 = Sketch_13.setCoincident(SketchLine_132.startPoint(), SketchLine_134.startPoint()) +SketchConstraintCoincidence_208 = Sketch_13.setCoincident( + SketchLine_132.startPoint(), SketchLine_134.startPoint() +) SketchConstraintCoincidence_208.setName("SketchConstraintCoincidence_38") -SketchConstraintCoincidence_209 = Sketch_13.setCoincident(SketchLine_130.startPoint(), SketchLine_134.endPoint()) +SketchConstraintCoincidence_209 = Sketch_13.setCoincident( + SketchLine_130.startPoint(), SketchLine_134.endPoint() +) SketchConstraintCoincidence_209.setName("SketchConstraintCoincidence_39") -SketchConstraintCoincidence_210 = Sketch_13.setCoincident(SketchLine_133.endPoint(), SketchLine_134.endPoint()) +SketchConstraintCoincidence_210 = Sketch_13.setCoincident( + SketchLine_133.endPoint(), SketchLine_134.endPoint() +) SketchConstraintCoincidence_210.setName("SketchConstraintCoincidence_40") SketchLine_135 = Sketch_13.addLine(29, -1.5, 60, -10.5) SketchLine_135.setName("SketchLine_31") SketchLine_135.result().setName("SketchLine_31") SketchLine_135.setAuxiliary(True) -SketchConstraintCoincidence_211 = Sketch_13.setCoincident(SketchLine_130.endPoint(), SketchLine_135.startPoint()) +SketchConstraintCoincidence_211 = Sketch_13.setCoincident( + SketchLine_130.endPoint(), SketchLine_135.startPoint() +) SketchConstraintCoincidence_211.setName("SketchConstraintCoincidence_41") -SketchConstraintCoincidence_212 = Sketch_13.setCoincident(SketchLine_131.startPoint(), SketchLine_135.startPoint()) +SketchConstraintCoincidence_212 = Sketch_13.setCoincident( + SketchLine_131.startPoint(), SketchLine_135.startPoint() +) SketchConstraintCoincidence_212.setName("SketchConstraintCoincidence_42") -SketchConstraintCoincidence_213 = Sketch_13.setCoincident(SketchLine_132.endPoint(), SketchLine_135.endPoint()) +SketchConstraintCoincidence_213 = Sketch_13.setCoincident( + SketchLine_132.endPoint(), SketchLine_135.endPoint() +) SketchConstraintCoincidence_213.setName("SketchConstraintCoincidence_43") -SketchConstraintCoincidence_214 = Sketch_13.setCoincident(SketchLine_133.startPoint(), SketchLine_135.endPoint()) +SketchConstraintCoincidence_214 = Sketch_13.setCoincident( + SketchLine_133.startPoint(), SketchLine_135.endPoint() +) SketchConstraintCoincidence_214.setName("SketchConstraintCoincidence_44") SketchPoint_27 = Sketch_13.addPoint(44.5, -6) SketchPoint_27.setAuxiliary(True) -SketchConstraintCoincidence_215 = Sketch_13.setCoincident(SketchPoint_27.coordinates(), SketchLine_135.result()) +SketchConstraintCoincidence_215 = Sketch_13.setCoincident( + SketchPoint_27.coordinates(), SketchLine_135.result() +) SketchConstraintCoincidence_215.setName("SketchConstraintCoincidence_45") -SketchConstraintMiddle_9 = Sketch_13.setMiddlePoint(SketchPoint_27.coordinates(), SketchLine_135.result()) -SketchConstraintCoincidence_216 = Sketch_13.setCoincident(SketchPoint_27.coordinates(), SketchLine_129.result()) +SketchConstraintMiddle_9 = Sketch_13.setMiddlePoint( + SketchPoint_27.coordinates(), SketchLine_135.result() +) +SketchConstraintCoincidence_216 = Sketch_13.setCoincident( + SketchPoint_27.coordinates(), SketchLine_129.result() +) SketchConstraintCoincidence_216.setName("SketchConstraintCoincidence_46") -SketchConstraintDistance_26 = Sketch_13.setDistance(SketchLine_128.startPoint(), SketchLine_129.result(), 6, False) +SketchConstraintDistance_26 = Sketch_13.setDistance( + SketchLine_128.startPoint(), SketchLine_129.result(), 6, False +) SketchConstraintDistance_26.setName("SketchConstraintDistance_8") SketchConstraintLength_26 = Sketch_13.setLength(SketchLine_133.result(), 9) SketchConstraintLength_26.setName("SketchConstraintLength_10") -SketchLine_136 = Sketch_13.addLine(21.00014787857639, -1.499999999999981, 12.00014787857639, -1.499999999999981) +SketchLine_136 = Sketch_13.addLine( + 21.00014787857639, -1.499999999999981, 12.00014787857639, -1.499999999999981 +) SketchLine_136.setName("SketchLine_32") SketchLine_136.result().setName("SketchLine_32") -SketchLine_137 = Sketch_13.addLine(12.00014787857639, -1.499999999999981, 12.00014787857639, -10.49999999999998) +SketchLine_137 = Sketch_13.addLine( + 12.00014787857639, -1.499999999999981, 12.00014787857639, -10.49999999999998 +) SketchLine_137.setName("SketchLine_33") SketchLine_137.result().setName("SketchLine_33") -SketchLine_138 = Sketch_13.addLine(12.00014787857639, -10.49999999999998, 21.00014787857639, -10.49999999999998) +SketchLine_138 = Sketch_13.addLine( + 12.00014787857639, -10.49999999999998, 21.00014787857639, -10.49999999999998 +) SketchLine_138.setName("SketchLine_34") SketchLine_138.result().setName("SketchLine_34") -SketchLine_139 = Sketch_13.addLine(21.00014787857639, -10.49999999999998, 21.00014787857639, -1.499999999999981) +SketchLine_139 = Sketch_13.addLine( + 21.00014787857639, -10.49999999999998, 21.00014787857639, -1.499999999999981 +) SketchLine_139.setName("SketchLine_35") SketchLine_139.result().setName("SketchLine_35") -SketchConstraintCoincidence_217 = Sketch_13.setCoincident(SketchLine_139.endPoint(), SketchLine_136.startPoint()) +SketchConstraintCoincidence_217 = Sketch_13.setCoincident( + SketchLine_139.endPoint(), SketchLine_136.startPoint() +) SketchConstraintCoincidence_217.setName("SketchConstraintCoincidence_47") -SketchConstraintCoincidence_218 = Sketch_13.setCoincident(SketchLine_136.endPoint(), SketchLine_137.startPoint()) +SketchConstraintCoincidence_218 = Sketch_13.setCoincident( + SketchLine_136.endPoint(), SketchLine_137.startPoint() +) SketchConstraintCoincidence_218.setName("SketchConstraintCoincidence_48") -SketchConstraintCoincidence_219 = Sketch_13.setCoincident(SketchLine_137.endPoint(), SketchLine_138.startPoint()) +SketchConstraintCoincidence_219 = Sketch_13.setCoincident( + SketchLine_137.endPoint(), SketchLine_138.startPoint() +) SketchConstraintCoincidence_219.setName("SketchConstraintCoincidence_49") -SketchConstraintCoincidence_220 = Sketch_13.setCoincident(SketchLine_138.endPoint(), SketchLine_139.startPoint()) +SketchConstraintCoincidence_220 = Sketch_13.setCoincident( + SketchLine_138.endPoint(), SketchLine_139.startPoint() +) SketchConstraintCoincidence_220.setName("SketchConstraintCoincidence_50") SketchConstraintHorizontal_31 = Sketch_13.setHorizontal(SketchLine_136.result()) SketchConstraintHorizontal_31.setName("SketchConstraintHorizontal_10") @@ -1218,72 +2152,174 @@ SketchConstraintVertical_27 = Sketch_13.setVertical(SketchLine_137.result()) SketchConstraintHorizontal_32 = Sketch_13.setHorizontal(SketchLine_138.result()) SketchConstraintHorizontal_32.setName("SketchConstraintHorizontal_11") SketchConstraintVertical_28 = Sketch_13.setVertical(SketchLine_139.result()) -SketchConstraintEqual_4 = Sketch_13.setEqual(SketchLine_131.result(), SketchLine_139.result()) -SketchLine_140 = Sketch_13.addLine(12.00014787857639, -10.49999999999998, 21.00014787857639, -1.499999999999981) +SketchConstraintEqual_4 = Sketch_13.setEqual( + SketchLine_131.result(), SketchLine_139.result() +) +SketchLine_140 = Sketch_13.addLine( + 12.00014787857639, -10.49999999999998, 21.00014787857639, -1.499999999999981 +) SketchLine_140.setName("SketchLine_36") SketchLine_140.result().setName("SketchLine_36") SketchLine_140.setAuxiliary(True) -SketchConstraintCoincidence_221 = Sketch_13.setCoincident(SketchLine_137.endPoint(), SketchLine_140.startPoint()) +SketchConstraintCoincidence_221 = Sketch_13.setCoincident( + SketchLine_137.endPoint(), SketchLine_140.startPoint() +) SketchConstraintCoincidence_221.setName("SketchConstraintCoincidence_51") -SketchConstraintCoincidence_222 = Sketch_13.setCoincident(SketchLine_138.startPoint(), SketchLine_140.startPoint()) +SketchConstraintCoincidence_222 = Sketch_13.setCoincident( + SketchLine_138.startPoint(), SketchLine_140.startPoint() +) SketchConstraintCoincidence_222.setName("SketchConstraintCoincidence_52") -SketchConstraintCoincidence_223 = Sketch_13.setCoincident(SketchLine_136.startPoint(), SketchLine_140.endPoint()) +SketchConstraintCoincidence_223 = Sketch_13.setCoincident( + SketchLine_136.startPoint(), SketchLine_140.endPoint() +) SketchConstraintCoincidence_223.setName("SketchConstraintCoincidence_53") -SketchConstraintCoincidence_224 = Sketch_13.setCoincident(SketchLine_139.endPoint(), SketchLine_140.endPoint()) +SketchConstraintCoincidence_224 = Sketch_13.setCoincident( + SketchLine_139.endPoint(), SketchLine_140.endPoint() +) SketchConstraintCoincidence_224.setName("SketchConstraintCoincidence_54") SketchPoint_28 = Sketch_13.addPoint(16.50014787857639, -6) SketchPoint_28.setAuxiliary(True) -SketchConstraintCoincidence_225 = Sketch_13.setCoincident(SketchPoint_28.coordinates(), SketchLine_140.result()) +SketchConstraintCoincidence_225 = Sketch_13.setCoincident( + SketchPoint_28.coordinates(), SketchLine_140.result() +) 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()) +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&Sketch_1/SketchLine_14][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_5]")) +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 = 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&Sketch_1/SketchArc_2_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9]")) +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 = 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()) +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/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) +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/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_11]")) +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()) +SketchConstraintCoincidence_229 = Sketch_14.setCoincident( + SketchLine_143.startPoint(), SketchLine_144.result() +) SketchConstraintCoincidence_229.setName("SketchConstraintCoincidence_59") -SketchLine_145 = Sketch_14.addLine(1.55585595716119, 2.812450190483599, 2.324492722099671, 3.935842385393688) +SketchLine_145 = Sketch_14.addLine( + 1.55585595716119, 2.812450190483599, 2.324492722099671, 3.935842385393688 +) SketchLine_145.setName("SketchLine_41") SketchLine_145.result().setName("SketchLine_41") -SketchConstraintCoincidence_230 = Sketch_14.setCoincident(SketchLine_143.endPoint(), SketchLine_145.startPoint()) +SketchConstraintCoincidence_230 = Sketch_14.setCoincident( + SketchLine_143.endPoint(), SketchLine_145.startPoint() +) SketchConstraintCoincidence_230.setName("SketchConstraintCoincidence_60") -SketchConstraintCoincidence_231 = Sketch_14.setCoincident(SketchLine_145.endPoint(), SketchLine_144.result()) +SketchConstraintCoincidence_231 = Sketch_14.setCoincident( + SketchLine_145.endPoint(), SketchLine_144.result() +) SketchConstraintCoincidence_231.setName("SketchConstraintCoincidence_61") -SketchLine_146 = Sketch_14.addLine(2.324492722099671, 3.935842385393688, 0.4324637622511017, 3.581086955422081) +SketchLine_146 = Sketch_14.addLine( + 2.324492722099671, 3.935842385393688, 0.4324637622511017, 3.581086955422081 +) SketchLine_146.setName("SketchLine_42") SketchLine_146.result().setName("SketchLine_42") -SketchConstraintCoincidence_232 = Sketch_14.setCoincident(SketchLine_145.endPoint(), SketchLine_146.startPoint()) +SketchConstraintCoincidence_232 = Sketch_14.setCoincident( + SketchLine_145.endPoint(), SketchLine_146.startPoint() +) SketchConstraintCoincidence_232.setName("SketchConstraintCoincidence_62") -SketchConstraintCoincidence_233 = Sketch_14.setCoincident(SketchLine_143.startPoint(), SketchLine_146.endPoint()) +SketchConstraintCoincidence_233 = Sketch_14.setCoincident( + SketchLine_143.startPoint(), SketchLine_146.endPoint() +) SketchConstraintCoincidence_233.setName("SketchConstraintCoincidence_63") SketchConstraintLength_28 = Sketch_14.setLength(SketchLine_146.result(), 1.925) SketchConstraintLength_28.setName("SketchConstraintLength_12") -SketchConstraintEqual_6 = Sketch_14.setEqual(SketchLine_143.result(), SketchLine_145.result()) -SketchConstraintPerpendicular_2 = Sketch_14.setPerpendicular(SketchLine_143.result(), SketchLine_145.result()) -SketchConstraintDistance_27 = Sketch_14.setDistance(SketchLine_144.startPoint(), SketchLine_143.startPoint(), 0.44, False) -SketchMultiTranslation_3_objects = [SketchLine_143.result(), SketchLine_146.result(), SketchLine_145.result()] -SketchMultiTranslation_3 = Sketch_14.addTranslation(SketchMultiTranslation_3_objects, SketchLine_146.startPoint(), SketchLine_144.endPoint(), 4, True) -[SketchLine_147, SketchLine_148, SketchLine_149, SketchLine_150, SketchLine_151, SketchLine_152, SketchLine_153, SketchLine_154, SketchLine_155] = SketchMultiTranslation_3.translated() +SketchConstraintEqual_6 = Sketch_14.setEqual( + SketchLine_143.result(), SketchLine_145.result() +) +SketchConstraintPerpendicular_2 = Sketch_14.setPerpendicular( + SketchLine_143.result(), SketchLine_145.result() +) +SketchConstraintDistance_27 = Sketch_14.setDistance( + SketchLine_144.startPoint(), SketchLine_143.startPoint(), 0.44, False +) +SketchMultiTranslation_3_objects = [ + SketchLine_143.result(), + SketchLine_146.result(), + SketchLine_145.result(), +] +SketchMultiTranslation_3 = Sketch_14.addTranslation( + SketchMultiTranslation_3_objects, + SketchLine_146.startPoint(), + SketchLine_144.endPoint(), + 4, + True, +) +[ + SketchLine_147, + SketchLine_148, + SketchLine_149, + SketchLine_150, + SketchLine_151, + SketchLine_152, + SketchLine_153, + SketchLine_154, + SketchLine_155, +] = SketchMultiTranslation_3.translated() SketchLine_155.setName("SketchLine_51") SketchLine_155.result().setName("SketchLine_51") SketchLine_154.setName("SketchLine_50") @@ -1303,84 +2339,196 @@ 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/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]")) +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) SketchConstraintRigid_14 = Sketch_15.setFixed(SketchPoint_29.result()) SketchConstraintRigid_14.setName("SketchConstraintRigid_10") -SketchConstraintCoincidence_234 = Sketch_15.setCoincident(SketchArc_27.startPoint(), SketchPoint_29.result()) +SketchConstraintCoincidence_234 = Sketch_15.setCoincident( + SketchArc_27.startPoint(), SketchPoint_29.result() +) SketchConstraintCoincidence_234.setName("SketchConstraintCoincidence_64") SketchPoint_30 = Sketch_15.addPoint(28, -7.5) SketchConstraintRigid_15 = Sketch_15.setFixed(SketchPoint_30.result()) SketchConstraintRigid_15.setName("SketchConstraintRigid_11") -SketchConstraintCoincidence_235 = Sketch_15.setCoincident(SketchArc_27.endPoint(), SketchPoint_30.result()) +SketchConstraintCoincidence_235 = Sketch_15.setCoincident( + SketchArc_27.endPoint(), SketchPoint_30.result() +) SketchConstraintCoincidence_235.setName("SketchConstraintCoincidence_65") SketchConstraintRadius_11 = Sketch_15.setRadius(SketchArc_27.results()[1], 3) SketchLine_156 = Sketch_15.addLine(22, -7.5, 22, -11.56094005408083) SketchLine_156.setName("SketchLine_52") SketchLine_156.result().setName("SketchLine_52") -SketchConstraintCoincidence_236 = Sketch_15.setCoincident(SketchArc_27.startPoint(), SketchLine_156.startPoint()) +SketchConstraintCoincidence_236 = Sketch_15.setCoincident( + SketchArc_27.startPoint(), SketchLine_156.startPoint() +) SketchConstraintCoincidence_236.setName("SketchConstraintCoincidence_66") -SketchConstraintCoincidence_237 = Sketch_15.setCoincident(SketchPoint_29.coordinates(), SketchLine_156.startPoint()) +SketchConstraintCoincidence_237 = Sketch_15.setCoincident( + SketchPoint_29.coordinates(), SketchLine_156.startPoint() +) SketchConstraintCoincidence_237.setName("SketchConstraintCoincidence_67") SketchLine_157 = Sketch_15.addLine(22, -11.56094005408083, 28, -11.56094005408083) SketchLine_157.setName("SketchLine_53") SketchLine_157.result().setName("SketchLine_53") -SketchConstraintCoincidence_238 = Sketch_15.setCoincident(SketchLine_156.endPoint(), SketchLine_157.startPoint()) +SketchConstraintCoincidence_238 = Sketch_15.setCoincident( + SketchLine_156.endPoint(), SketchLine_157.startPoint() +) SketchConstraintCoincidence_238.setName("SketchConstraintCoincidence_68") SketchLine_158 = Sketch_15.addLine(28, -11.56094005408083, 28, -7.5) SketchLine_158.setName("SketchLine_54") SketchLine_158.result().setName("SketchLine_54") -SketchConstraintCoincidence_239 = Sketch_15.setCoincident(SketchLine_157.endPoint(), SketchLine_158.startPoint()) +SketchConstraintCoincidence_239 = Sketch_15.setCoincident( + SketchLine_157.endPoint(), SketchLine_158.startPoint() +) SketchConstraintCoincidence_239.setName("SketchConstraintCoincidence_69") -SketchConstraintCoincidence_240 = Sketch_15.setCoincident(SketchArc_27.endPoint(), SketchLine_158.endPoint()) +SketchConstraintCoincidence_240 = Sketch_15.setCoincident( + SketchArc_27.endPoint(), SketchLine_158.endPoint() +) SketchConstraintCoincidence_240.setName("SketchConstraintCoincidence_70") -SketchConstraintCoincidence_241 = Sketch_15.setCoincident(SketchPoint_30.coordinates(), SketchLine_158.endPoint()) +SketchConstraintCoincidence_241 = Sketch_15.setCoincident( + SketchPoint_30.coordinates(), SketchLine_158.endPoint() +) SketchConstraintCoincidence_241.setName("SketchConstraintCoincidence_71") SketchConstraintVertical_29 = Sketch_15.setVertical(SketchLine_156.result()) 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/Modified_Face&Extrusion_1_1/To_Face"), 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_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")) +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") SketchLine_159.result().setName("SketchLine_55") SketchConstraintRigid_16 = Sketch_16.setFixed(SketchLine_159.result()) SketchConstraintRigid_16.setName("SketchConstraintRigid_12") -SketchConstraintCoincidence_242 = Sketch_16.setCoincident(SketchArc_28.center(), SketchLine_159.result()) +SketchConstraintCoincidence_242 = Sketch_16.setCoincident( + SketchArc_28.center(), SketchLine_159.result() +) SketchConstraintCoincidence_242.setName("SketchConstraintCoincidence_72") -SketchConstraintCoincidence_243 = Sketch_16.setCoincident(SketchArc_28.startPoint(), SketchLine_159.result()) +SketchConstraintCoincidence_243 = Sketch_16.setCoincident( + SketchArc_28.startPoint(), SketchLine_159.result() +) SketchConstraintCoincidence_243.setName("SketchConstraintCoincidence_73") -SketchConstraintCoincidence_244 = Sketch_16.setCoincident(SketchArc_28.endPoint(), SketchLine_159.result()) +SketchConstraintCoincidence_244 = Sketch_16.setCoincident( + SketchArc_28.endPoint(), SketchLine_159.result() +) SketchConstraintCoincidence_244.setName("SketchConstraintCoincidence_74") SketchLine_160 = Sketch_16.addLine(45.5, 0, 46.5, 0) SketchLine_160.setName("SketchLine_56") SketchLine_160.result().setName("SketchLine_56") -SketchConstraintCoincidence_245 = Sketch_16.setCoincident(SketchArc_28.startPoint(), SketchLine_160.startPoint()) +SketchConstraintCoincidence_245 = Sketch_16.setCoincident( + SketchArc_28.startPoint(), SketchLine_160.startPoint() +) SketchConstraintCoincidence_245.setName("SketchConstraintCoincidence_75") -SketchConstraintCoincidence_246 = Sketch_16.setCoincident(SketchArc_28.endPoint(), SketchLine_160.endPoint()) +SketchConstraintCoincidence_246 = Sketch_16.setCoincident( + SketchArc_28.endPoint(), SketchLine_160.endPoint() +) SketchConstraintCoincidence_246.setName("SketchConstraintCoincidence_76") SketchConstraintRadius_12 = Sketch_16.setRadius(SketchArc_28.results()[1], 0.5) SketchLine_161 = Sketch_16.addLine(0, 0, 0, 3.5) SketchLine_161.setName("SketchLine_57") SketchLine_161.result().setName("SketchLine_57") -SketchConstraintDistance_28 = Sketch_16.setDistance(SketchArc_28.center(), SketchLine_161.result(), 46, False) +SketchConstraintDistance_28 = Sketch_16.setDistance( + SketchArc_28.center(), SketchLine_161.result(), 46, False +) SketchConstraintRigid_17 = Sketch_16.setFixed(SketchLine_161.result()) SketchConstraintRigid_17.setName("SketchConstraintRigid_13") SketchPoint_31 = Sketch_16.addPoint(58, 0) -SketchConstraintCoincidence_247 = Sketch_16.setCoincident(SketchPoint_31.coordinates(), SketchLine_159.result()) +SketchConstraintCoincidence_247 = Sketch_16.setCoincident( + SketchPoint_31.coordinates(), SketchLine_159.result() +) SketchConstraintCoincidence_247.setName("SketchConstraintCoincidence_77") -SketchConstraintDistance_29 = Sketch_16.setDistance(SketchArc_28.center(), SketchPoint_31.coordinates(), 12, False) -SketchMultiTranslation_4 = Sketch_16.addTranslation([SketchLine_160.result(), SketchArc_28.results()[1]], SketchArc_28.center(), SketchPoint_31.coordinates(), 9, True) -[SketchLine_162, SketchLine_163, SketchLine_164, SketchLine_165, SketchLine_166, SketchLine_167, SketchLine_168, SketchLine_169, SketchArc_29, SketchArc_30, SketchArc_31, SketchArc_32, SketchArc_33, SketchArc_34, SketchArc_35, SketchArc_36] = SketchMultiTranslation_4.translated() +SketchConstraintDistance_29 = Sketch_16.setDistance( + SketchArc_28.center(), SketchPoint_31.coordinates(), 12, False +) +SketchMultiTranslation_4 = Sketch_16.addTranslation( + [SketchLine_160.result(), SketchArc_28.results()[1]], + SketchArc_28.center(), + SketchPoint_31.coordinates(), + 9, + True, +) +[ + SketchLine_162, + SketchLine_163, + SketchLine_164, + SketchLine_165, + SketchLine_166, + SketchLine_167, + SketchLine_168, + SketchLine_169, + SketchArc_29, + SketchArc_30, + SketchArc_31, + SketchArc_32, + SketchArc_33, + SketchArc_34, + SketchArc_35, + SketchArc_36, +] = SketchMultiTranslation_4.translated() SketchLine_169.setName("SketchLine_65") SketchLine_169.result().setName("SketchLine_65") SketchLine_168.setName("SketchLine_64") @@ -1398,8 +2546,26 @@ 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_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)_ExtrusionFuse_1_1")) +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)_ExtrusionFuse_1_1", + ), +) SketchLine_170 = Sketch_17.addLine(50.25, -4.5, 31.25, -4.5) SketchLine_170.setName("SketchLine_76") SketchLine_170.result().setName("SketchLine_76") @@ -1418,21 +2584,29 @@ SketchLine_174.result().setName("SketchLine_66") SketchLine_174.setAuxiliary(True) SketchLine_175 = Sketch_17.addLine(51, -7.5, 51, -4.5) SketchLine_175.setAuxiliary(True) -SketchConstraintCoincidence_248 = Sketch_17.setCoincident(SketchLine_175.endPoint(), SketchLine_174.startPoint()) +SketchConstraintCoincidence_248 = Sketch_17.setCoincident( + SketchLine_175.endPoint(), SketchLine_174.startPoint() +) SketchConstraintCoincidence_248.setName("SketchConstraintCoincidence_78") SketchLine_176 = Sketch_17.addLine(31, -4.5, 31, -7.5) SketchLine_176.setName("SketchLine_67") SketchLine_176.result().setName("SketchLine_67") SketchLine_176.setAuxiliary(True) -SketchConstraintCoincidence_249 = Sketch_17.setCoincident(SketchLine_174.endPoint(), SketchLine_176.startPoint()) +SketchConstraintCoincidence_249 = Sketch_17.setCoincident( + SketchLine_174.endPoint(), SketchLine_176.startPoint() +) SketchConstraintCoincidence_249.setName("SketchConstraintCoincidence_79") SketchLine_177 = Sketch_17.addLine(31, -7.5, 51, -7.5) SketchLine_177.setName("SketchLine_68") SketchLine_177.result().setName("SketchLine_68") SketchLine_177.setAuxiliary(True) -SketchConstraintCoincidence_250 = Sketch_17.setCoincident(SketchLine_176.endPoint(), SketchLine_177.startPoint()) +SketchConstraintCoincidence_250 = Sketch_17.setCoincident( + SketchLine_176.endPoint(), SketchLine_177.startPoint() +) SketchConstraintCoincidence_250.setName("SketchConstraintCoincidence_80") -SketchConstraintCoincidence_251 = Sketch_17.setCoincident(SketchLine_177.endPoint(), SketchLine_175.startPoint()) +SketchConstraintCoincidence_251 = Sketch_17.setCoincident( + SketchLine_177.endPoint(), SketchLine_175.startPoint() +) SketchConstraintCoincidence_251.setName("SketchConstraintCoincidence_81") SketchConstraintHorizontal_34 = Sketch_17.setHorizontal(SketchLine_174.result()) SketchConstraintHorizontal_34.setName("SketchConstraintHorizontal_13") @@ -1444,20 +2618,32 @@ SketchLine_178 = Sketch_17.addLine(31, -7.5, 51, -4.5) SketchLine_178.setName("SketchLine_70") SketchLine_178.result().setName("SketchLine_70") SketchLine_178.setAuxiliary(True) -SketchConstraintCoincidence_252 = Sketch_17.setCoincident(SketchLine_176.endPoint(), SketchLine_178.startPoint()) +SketchConstraintCoincidence_252 = Sketch_17.setCoincident( + SketchLine_176.endPoint(), SketchLine_178.startPoint() +) SketchConstraintCoincidence_252.setName("SketchConstraintCoincidence_82") -SketchConstraintCoincidence_253 = Sketch_17.setCoincident(SketchLine_177.startPoint(), SketchLine_178.startPoint()) +SketchConstraintCoincidence_253 = Sketch_17.setCoincident( + SketchLine_177.startPoint(), SketchLine_178.startPoint() +) SketchConstraintCoincidence_253.setName("SketchConstraintCoincidence_83") SketchPoint_32 = Sketch_17.addPoint(51, -4.5) -SketchConstraintCoincidence_254 = Sketch_17.setCoincident(SketchLine_174.startPoint(), SketchPoint_32.coordinates()) +SketchConstraintCoincidence_254 = Sketch_17.setCoincident( + SketchLine_174.startPoint(), SketchPoint_32.coordinates() +) SketchConstraintCoincidence_254.setName("SketchConstraintCoincidence_84") -SketchConstraintCoincidence_255 = Sketch_17.setCoincident(SketchLine_175.endPoint(), SketchPoint_32.coordinates()) +SketchConstraintCoincidence_255 = Sketch_17.setCoincident( + SketchLine_175.endPoint(), SketchPoint_32.coordinates() +) SketchConstraintCoincidence_255.setName("SketchConstraintCoincidence_85") SketchPoint_33 = Sketch_17.addPoint(41, -6) SketchPoint_33.setAuxiliary(True) -SketchConstraintCoincidence_256 = Sketch_17.setCoincident(SketchPoint_33.coordinates(), SketchLine_178.result()) +SketchConstraintCoincidence_256 = Sketch_17.setCoincident( + SketchPoint_33.coordinates(), SketchLine_178.result() +) SketchConstraintCoincidence_256.setName("SketchConstraintCoincidence_86") -SketchConstraintMiddle_11 = Sketch_17.setMiddlePoint(SketchLine_178.result(), SketchPoint_33.coordinates()) +SketchConstraintMiddle_11 = Sketch_17.setMiddlePoint( + SketchLine_178.result(), SketchPoint_33.coordinates() +) SketchPoint_34 = Sketch_17.addPoint(21, -6) SketchPoint_34.setAuxiliary(True) SketchLine_179 = Sketch_17.addLine(21, -10.5, 21, -1.5) @@ -1465,27 +2651,39 @@ SketchLine_179.setName("SketchLine_71") SketchLine_179.result().setName("SketchLine_71") SketchConstraintRigid_18 = Sketch_17.setFixed(SketchLine_179.result()) SketchConstraintRigid_18.setName("SketchConstraintRigid_14") -SketchConstraintCoincidence_257 = Sketch_17.setCoincident(SketchPoint_34.coordinates(), SketchLine_179.result()) +SketchConstraintCoincidence_257 = Sketch_17.setCoincident( + SketchPoint_34.coordinates(), SketchLine_179.result() +) SketchConstraintCoincidence_257.setName("SketchConstraintCoincidence_87") -SketchConstraintMiddle_12 = Sketch_17.setMiddlePoint(SketchPoint_34.coordinates(), SketchLine_179.result()) +SketchConstraintMiddle_12 = Sketch_17.setMiddlePoint( + SketchPoint_34.coordinates(), SketchLine_179.result() +) SketchLine_180 = Sketch_17.addLine(21, -6, 41, -6) SketchLine_180.setName("SketchLine_72") SketchLine_180.result().setName("SketchLine_72") SketchLine_180.setAuxiliary(True) -SketchConstraintCoincidence_258 = Sketch_17.setCoincident(SketchPoint_34.coordinates(), SketchLine_180.startPoint()) +SketchConstraintCoincidence_258 = Sketch_17.setCoincident( + SketchPoint_34.coordinates(), SketchLine_180.startPoint() +) SketchConstraintCoincidence_258.setName("SketchConstraintCoincidence_88") -SketchConstraintCoincidence_259 = Sketch_17.setCoincident(SketchPoint_33.coordinates(), SketchLine_180.endPoint()) +SketchConstraintCoincidence_259 = Sketch_17.setCoincident( + SketchPoint_33.coordinates(), SketchLine_180.endPoint() +) SketchConstraintCoincidence_259.setName("SketchConstraintCoincidence_89") SketchConstraintHorizontal_36 = Sketch_17.setHorizontal(SketchLine_180.result()) SketchConstraintHorizontal_36.setName("SketchConstraintHorizontal_15") -SketchConstraintCoincidence_260 = Sketch_17.setCoincident(SketchLine_178.endPoint(), SketchLine_174.startPoint()) +SketchConstraintCoincidence_260 = Sketch_17.setCoincident( + SketchLine_178.endPoint(), SketchLine_174.startPoint() +) SketchConstraintCoincidence_260.setName("SketchConstraintCoincidence_90") SketchConstraintLength_29 = Sketch_17.setLength(SketchLine_175.result(), 3) SketchConstraintLength_29.setName("SketchConstraintLength_13") SketchConstraintLength_30 = Sketch_17.setLength(SketchLine_174.result(), 20) SketchConstraintLength_30.setName("SketchConstraintLength_14") SketchPoint_35 = Sketch_17.addPoint(29, -10.5) -SketchConstraintDistance_30 = Sketch_17.setDistance(SketchPoint_35.coordinates(), SketchLine_176.result(), 2, False) +SketchConstraintDistance_30 = Sketch_17.setDistance( + SketchPoint_35.coordinates(), SketchLine_176.result(), 2, False +) SketchConstraintRigid_19 = Sketch_17.setFixed(SketchPoint_35.result()) SketchConstraintRigid_19.setName("SketchConstraintRigid_15") SketchArc_37 = Sketch_17.addArc(50.25, -5.25, 51, -5.25, 50.25, -4.5, False) @@ -1493,168 +2691,301 @@ SketchLine_181 = Sketch_17.addLine(51, -7.5, 51, -5.25) SketchLine_181.setName("SketchLine_74") SketchLine_181.result().setName("SketchLine_74") SketchLine_181.setAuxiliary(True) -SketchConstraintCoincidence_261 = Sketch_17.setCoincident(SketchArc_37.startPoint(), SketchLine_181.endPoint()) +SketchConstraintCoincidence_261 = Sketch_17.setCoincident( + SketchArc_37.startPoint(), SketchLine_181.endPoint() +) SketchConstraintCoincidence_261.setName("SketchConstraintCoincidence_91") SketchLine_182 = Sketch_17.addLine(50.25, -4.5, 31, -4.5) SketchLine_182.setName("SketchLine_73") SketchLine_182.result().setName("SketchLine_73") SketchLine_182.setAuxiliary(True) -SketchConstraintCoincidence_262 = Sketch_17.setCoincident(SketchArc_37.endPoint(), SketchLine_182.startPoint()) +SketchConstraintCoincidence_262 = Sketch_17.setCoincident( + SketchArc_37.endPoint(), SketchLine_182.startPoint() +) SketchConstraintCoincidence_262.setName("SketchConstraintCoincidence_92") -SketchConstraintTangent_17 = Sketch_17.setTangent(SketchArc_37.results()[1], SketchLine_182.result()) -SketchConstraintTangent_18 = Sketch_17.setTangent(SketchArc_37.results()[1], SketchLine_181.result()) -SketchConstraintCoincidence_263 = Sketch_17.setCoincident(SketchLine_174.endPoint(), SketchLine_182.endPoint()) +SketchConstraintTangent_17 = Sketch_17.setTangent( + SketchArc_37.results()[1], SketchLine_182.result() +) +SketchConstraintTangent_18 = Sketch_17.setTangent( + SketchArc_37.results()[1], SketchLine_181.result() +) +SketchConstraintCoincidence_263 = Sketch_17.setCoincident( + SketchLine_174.endPoint(), SketchLine_182.endPoint() +) SketchConstraintCoincidence_263.setName("SketchConstraintCoincidence_93") -SketchConstraintCoincidence_264 = Sketch_17.setCoincident(SketchLine_175.startPoint(), SketchLine_181.startPoint()) +SketchConstraintCoincidence_264 = Sketch_17.setCoincident( + SketchLine_175.startPoint(), SketchLine_181.startPoint() +) SketchConstraintCoincidence_264.setName("SketchConstraintCoincidence_94") -SketchConstraintCoincidence_265 = Sketch_17.setCoincident(SketchLine_182.startPoint(), SketchLine_174.result()) +SketchConstraintCoincidence_265 = Sketch_17.setCoincident( + SketchLine_182.startPoint(), SketchLine_174.result() +) SketchConstraintCoincidence_265.setName("SketchConstraintCoincidence_95") -SketchConstraintCoincidence_266 = Sketch_17.setCoincident(SketchLine_181.endPoint(), SketchLine_175.result()) +SketchConstraintCoincidence_266 = Sketch_17.setCoincident( + SketchLine_181.endPoint(), SketchLine_175.result() +) SketchConstraintCoincidence_266.setName("SketchConstraintCoincidence_96") SketchArc_38 = Sketch_17.addArc(31.25, -4.75, 31.25, -4.5, 31, -4.75, False) -SketchConstraintCoincidence_267 = Sketch_17.setCoincident(SketchArc_38.startPoint(), SketchLine_170.endPoint()) +SketchConstraintCoincidence_267 = Sketch_17.setCoincident( + SketchArc_38.startPoint(), SketchLine_170.endPoint() +) SketchConstraintCoincidence_267.setName("SketchConstraintCoincidence_97") SketchLine_183 = Sketch_17.addLine(31, -4.75, 31, -7.5) SketchLine_183.setName("SketchLine_75") SketchLine_183.result().setName("SketchLine_75") SketchLine_183.setAuxiliary(True) -SketchConstraintCoincidence_268 = Sketch_17.setCoincident(SketchArc_38.endPoint(), SketchLine_183.startPoint()) +SketchConstraintCoincidence_268 = Sketch_17.setCoincident( + SketchArc_38.endPoint(), SketchLine_183.startPoint() +) SketchConstraintCoincidence_268.setName("SketchConstraintCoincidence_98") -SketchConstraintTangent_19 = Sketch_17.setTangent(SketchArc_38.results()[1], SketchLine_183.result()) -SketchConstraintTangent_20 = Sketch_17.setTangent(SketchArc_38.results()[1], SketchLine_170.result()) -SketchConstraintCoincidence_269 = Sketch_17.setCoincident(SketchLine_176.endPoint(), SketchLine_183.endPoint()) +SketchConstraintTangent_19 = Sketch_17.setTangent( + SketchArc_38.results()[1], SketchLine_183.result() +) +SketchConstraintTangent_20 = Sketch_17.setTangent( + SketchArc_38.results()[1], SketchLine_170.result() +) +SketchConstraintCoincidence_269 = Sketch_17.setCoincident( + SketchLine_176.endPoint(), SketchLine_183.endPoint() +) SketchConstraintCoincidence_269.setName("SketchConstraintCoincidence_99") -SketchConstraintCoincidence_270 = Sketch_17.setCoincident(SketchLine_182.startPoint(), SketchLine_170.startPoint()) +SketchConstraintCoincidence_270 = Sketch_17.setCoincident( + SketchLine_182.startPoint(), SketchLine_170.startPoint() +) SketchConstraintCoincidence_270.setName("SketchConstraintCoincidence_100") -SketchConstraintCoincidence_271 = Sketch_17.setCoincident(SketchLine_183.startPoint(), SketchLine_176.result()) +SketchConstraintCoincidence_271 = Sketch_17.setCoincident( + SketchLine_183.startPoint(), SketchLine_176.result() +) SketchConstraintCoincidence_271.setName("SketchConstraintCoincidence_101") -SketchConstraintCoincidence_272 = Sketch_17.setCoincident(SketchLine_170.endPoint(), SketchLine_182.result()) +SketchConstraintCoincidence_272 = Sketch_17.setCoincident( + SketchLine_170.endPoint(), SketchLine_182.result() +) SketchConstraintCoincidence_272.setName("SketchConstraintCoincidence_102") SketchArc_39 = Sketch_17.addArc(50.25, -6.75, 50.25, -7.5, 51, -6.75, False) SketchLine_184 = Sketch_17.addLine(31, -7.5, 50.25, -7.5) SketchLine_184.setName("SketchLine_77") SketchLine_184.result().setName("SketchLine_77") SketchLine_184.setAuxiliary(True) -SketchConstraintCoincidence_273 = Sketch_17.setCoincident(SketchArc_39.startPoint(), SketchLine_184.endPoint()) +SketchConstraintCoincidence_273 = Sketch_17.setCoincident( + SketchArc_39.startPoint(), SketchLine_184.endPoint() +) SketchConstraintCoincidence_273.setName("SketchConstraintCoincidence_103") -SketchConstraintCoincidence_274 = Sketch_17.setCoincident(SketchArc_39.endPoint(), SketchLine_171.startPoint()) +SketchConstraintCoincidence_274 = Sketch_17.setCoincident( + SketchArc_39.endPoint(), SketchLine_171.startPoint() +) SketchConstraintCoincidence_274.setName("SketchConstraintCoincidence_104") -SketchConstraintTangent_21 = Sketch_17.setTangent(SketchArc_39.results()[1], SketchLine_184.result()) -SketchConstraintTangent_22 = Sketch_17.setTangent(SketchArc_39.results()[1], SketchLine_171.result()) -SketchConstraintCoincidence_275 = Sketch_17.setCoincident(SketchLine_177.startPoint(), SketchLine_184.startPoint()) +SketchConstraintTangent_21 = Sketch_17.setTangent( + SketchArc_39.results()[1], SketchLine_184.result() +) +SketchConstraintTangent_22 = Sketch_17.setTangent( + SketchArc_39.results()[1], SketchLine_171.result() +) +SketchConstraintCoincidence_275 = Sketch_17.setCoincident( + SketchLine_177.startPoint(), SketchLine_184.startPoint() +) SketchConstraintCoincidence_275.setName("SketchConstraintCoincidence_105") -SketchConstraintCoincidence_276 = Sketch_17.setCoincident(SketchLine_181.endPoint(), SketchLine_171.endPoint()) +SketchConstraintCoincidence_276 = Sketch_17.setCoincident( + SketchLine_181.endPoint(), SketchLine_171.endPoint() +) SketchConstraintCoincidence_276.setName("SketchConstraintCoincidence_106") -SketchConstraintCoincidence_277 = Sketch_17.setCoincident(SketchLine_184.endPoint(), SketchLine_177.result()) +SketchConstraintCoincidence_277 = Sketch_17.setCoincident( + SketchLine_184.endPoint(), SketchLine_177.result() +) SketchConstraintCoincidence_277.setName("SketchConstraintCoincidence_107") -SketchConstraintCoincidence_278 = Sketch_17.setCoincident(SketchLine_171.startPoint(), SketchLine_181.result()) +SketchConstraintCoincidence_278 = Sketch_17.setCoincident( + SketchLine_171.startPoint(), SketchLine_181.result() +) SketchConstraintCoincidence_278.setName("SketchConstraintCoincidence_108") -SketchArc_40 = Sketch_17.addArc(31.25, -7.249999999999998, 31, -7.249999999999651, 31.25, -7.499999999999998, False) -SketchConstraintCoincidence_279 = Sketch_17.setCoincident(SketchArc_40.startPoint(), SketchLine_172.endPoint()) +SketchArc_40 = Sketch_17.addArc( + 31.25, -7.249999999999998, 31, -7.249999999999651, 31.25, -7.499999999999998, False +) +SketchConstraintCoincidence_279 = Sketch_17.setCoincident( + SketchArc_40.startPoint(), SketchLine_172.endPoint() +) SketchConstraintCoincidence_279.setName("SketchConstraintCoincidence_109") -SketchConstraintCoincidence_280 = Sketch_17.setCoincident(SketchArc_40.endPoint(), SketchLine_173.startPoint()) +SketchConstraintCoincidence_280 = Sketch_17.setCoincident( + SketchArc_40.endPoint(), SketchLine_173.startPoint() +) SketchConstraintCoincidence_280.setName("SketchConstraintCoincidence_110") -SketchConstraintCoincidence_281 = Sketch_17.setCoincident(SketchLine_184.endPoint(), SketchLine_173.endPoint()) +SketchConstraintCoincidence_281 = Sketch_17.setCoincident( + SketchLine_184.endPoint(), SketchLine_173.endPoint() +) SketchConstraintCoincidence_281.setName("SketchConstraintCoincidence_111") -SketchConstraintCoincidence_282 = Sketch_17.setCoincident(SketchLine_183.startPoint(), SketchLine_172.startPoint()) +SketchConstraintCoincidence_282 = Sketch_17.setCoincident( + SketchLine_183.startPoint(), SketchLine_172.startPoint() +) SketchConstraintCoincidence_282.setName("SketchConstraintCoincidence_112") -SketchConstraintCoincidence_283 = Sketch_17.setCoincident(SketchLine_173.startPoint(), SketchLine_184.result()) +SketchConstraintCoincidence_283 = Sketch_17.setCoincident( + SketchLine_173.startPoint(), SketchLine_184.result() +) SketchConstraintCoincidence_283.setName("SketchConstraintCoincidence_113") -SketchConstraintCoincidence_284 = Sketch_17.setCoincident(SketchLine_172.endPoint(), SketchLine_183.result()) +SketchConstraintCoincidence_284 = Sketch_17.setCoincident( + SketchLine_172.endPoint(), SketchLine_183.result() +) SketchConstraintCoincidence_284.setName("SketchConstraintCoincidence_114") SketchConstraintRadius_13 = Sketch_17.setRadius(SketchArc_37.results()[1], 0.75) SketchConstraintRadius_14 = Sketch_17.setRadius(SketchArc_39.results()[1], 0.75) SketchConstraintRadius_15 = Sketch_17.setRadius(SketchArc_38.results()[1], 0.25) -SketchConstraintTangent_23 = Sketch_17.setTangent(SketchArc_40.results()[1], SketchLine_173.result()) +SketchConstraintTangent_23 = Sketch_17.setTangent( + SketchArc_40.results()[1], SketchLine_173.result() +) SketchConstraintTangent_23.setName("SketchConstraintTangent_16") -SketchConstraintTangent_24 = Sketch_17.setTangent(SketchLine_172.result(), SketchArc_40.results()[1]) +SketchConstraintTangent_24 = Sketch_17.setTangent( + SketchLine_172.result(), SketchArc_40.results()[1] +) SketchConstraintTangent_24.setName("SketchConstraintTangent_17") 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", "(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)")) +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", + "(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()) SketchConstraintRigid_20.setName("SketchConstraintRigid_16") -SketchConstraintCoincidence_285 = Sketch_18.setCoincident(SketchPoint_36.coordinates(), SketchPoint_37.result()) +SketchConstraintCoincidence_285 = Sketch_18.setCoincident( + SketchPoint_36.coordinates(), SketchPoint_37.result() +) SketchConstraintCoincidence_285.setName("SketchConstraintCoincidence_115") SketchPoint_38 = Sketch_18.addPoint(54, 12) SketchLine_185 = Sketch_18.addLine(54, 12, 54, 0) SketchLine_185.setName("SketchLine_81") SketchLine_185.result().setName("SketchLine_81") SketchLine_185.setAuxiliary(True) -SketchConstraintCoincidence_286 = Sketch_18.setCoincident(SketchPoint_38.coordinates(), SketchLine_185.startPoint()) +SketchConstraintCoincidence_286 = Sketch_18.setCoincident( + SketchPoint_38.coordinates(), SketchLine_185.startPoint() +) SketchConstraintCoincidence_286.setName("SketchConstraintCoincidence_116") -SketchConstraintCoincidence_287 = Sketch_18.setCoincident(SketchPoint_36.coordinates(), SketchLine_185.endPoint()) +SketchConstraintCoincidence_287 = Sketch_18.setCoincident( + SketchPoint_36.coordinates(), SketchLine_185.endPoint() +) SketchConstraintCoincidence_287.setName("SketchConstraintCoincidence_117") -SketchConstraintCoincidence_288 = Sketch_18.setCoincident(SketchPoint_37.coordinates(), SketchLine_185.endPoint()) +SketchConstraintCoincidence_288 = Sketch_18.setCoincident( + SketchPoint_37.coordinates(), SketchLine_185.endPoint() +) SketchConstraintCoincidence_288.setName("SketchConstraintCoincidence_118") SketchPoint_39 = Sketch_18.addPoint(54, 11) -SketchConstraintCoincidence_289 = Sketch_18.setCoincident(SketchPoint_39.coordinates(), SketchLine_185.result()) +SketchConstraintCoincidence_289 = Sketch_18.setCoincident( + SketchPoint_39.coordinates(), SketchLine_185.result() +) SketchConstraintCoincidence_289.setName("SketchConstraintCoincidence_119") SketchPoint_40 = Sketch_18.addPoint(54, 1) -SketchConstraintCoincidence_290 = Sketch_18.setCoincident(SketchPoint_40.coordinates(), SketchLine_185.result()) +SketchConstraintCoincidence_290 = Sketch_18.setCoincident( + SketchPoint_40.coordinates(), SketchLine_185.result() +) SketchConstraintCoincidence_290.setName("SketchConstraintCoincidence_120") -SketchConstraintDistance_31 = Sketch_18.setDistance(SketchPoint_36.coordinates(), SketchPoint_40.coordinates(), 1, False) -SketchConstraintDistance_32 = Sketch_18.setDistance(SketchPoint_38.coordinates(), SketchPoint_39.coordinates(), 1, False) +SketchConstraintDistance_31 = Sketch_18.setDistance( + SketchPoint_36.coordinates(), SketchPoint_40.coordinates(), 1, False +) +SketchConstraintDistance_32 = Sketch_18.setDistance( + SketchPoint_38.coordinates(), SketchPoint_39.coordinates(), 1, False +) SketchPoint_41 = Sketch_18.addPoint(54, 12) -SketchConstraintCoincidence_291 = Sketch_18.setCoincident(SketchPoint_38.coordinates(), SketchPoint_41.coordinates()) +SketchConstraintCoincidence_291 = Sketch_18.setCoincident( + SketchPoint_38.coordinates(), SketchPoint_41.coordinates() +) SketchConstraintCoincidence_291.setName("SketchConstraintCoincidence_121") SketchConstraintRigid_21 = Sketch_18.setFixed(SketchPoint_41.result()) SketchConstraintRigid_21.setName("SketchConstraintRigid_17") SketchLine_186 = Sketch_18.addLine(54, 11, 43.82041221793113, 11) SketchLine_186.setName("SketchLine_82") SketchLine_186.result().setName("SketchLine_82") -SketchConstraintCoincidence_292 = Sketch_18.setCoincident(SketchPoint_39.coordinates(), SketchLine_186.startPoint()) +SketchConstraintCoincidence_292 = Sketch_18.setCoincident( + SketchPoint_39.coordinates(), SketchLine_186.startPoint() +) SketchConstraintCoincidence_292.setName("SketchConstraintCoincidence_122") -SketchLine_187 = Sketch_18.addLine(43.82041221793113, 11, 43.82041221793113, 13.36310636658867) +SketchLine_187 = Sketch_18.addLine( + 43.82041221793113, 11, 43.82041221793113, 13.36310636658867 +) SketchLine_187.setName("SketchLine_83") SketchLine_187.result().setName("SketchLine_83") -SketchConstraintCoincidence_293 = Sketch_18.setCoincident(SketchLine_186.endPoint(), SketchLine_187.startPoint()) +SketchConstraintCoincidence_293 = Sketch_18.setCoincident( + SketchLine_186.endPoint(), SketchLine_187.startPoint() +) SketchConstraintCoincidence_293.setName("SketchConstraintCoincidence_123") -SketchLine_188 = Sketch_18.addLine(43.82041221793113, 13.36310636658867, 63.09515214070713, 13.47539228785809) +SketchLine_188 = Sketch_18.addLine( + 43.82041221793113, 13.36310636658867, 63.09515214070713, 13.47539228785809 +) SketchLine_188.setName("SketchLine_84") SketchLine_188.result().setName("SketchLine_84") -SketchConstraintCoincidence_294 = Sketch_18.setCoincident(SketchLine_187.endPoint(), SketchLine_188.startPoint()) +SketchConstraintCoincidence_294 = Sketch_18.setCoincident( + SketchLine_187.endPoint(), SketchLine_188.startPoint() +) SketchConstraintCoincidence_294.setName("SketchConstraintCoincidence_124") -SketchLine_189 = Sketch_18.addLine(63.09515214070713, 13.47539228785809, 63.12349734647592, -1.774328415749978) +SketchLine_189 = Sketch_18.addLine( + 63.09515214070713, 13.47539228785809, 63.12349734647592, -1.774328415749978 +) SketchLine_189.setName("SketchLine_85") SketchLine_189.result().setName("SketchLine_85") -SketchConstraintCoincidence_295 = Sketch_18.setCoincident(SketchLine_188.endPoint(), SketchLine_189.startPoint()) +SketchConstraintCoincidence_295 = Sketch_18.setCoincident( + SketchLine_188.endPoint(), SketchLine_189.startPoint() +) SketchConstraintCoincidence_295.setName("SketchConstraintCoincidence_125") -SketchLine_190 = Sketch_18.addLine(63.12349734647592, -1.774328415749978, 43.82041221793113, -1.802673621518767) +SketchLine_190 = Sketch_18.addLine( + 63.12349734647592, -1.774328415749978, 43.82041221793113, -1.802673621518767 +) SketchLine_190.setName("SketchLine_86") SketchLine_190.result().setName("SketchLine_86") -SketchConstraintCoincidence_296 = Sketch_18.setCoincident(SketchLine_189.endPoint(), SketchLine_190.startPoint()) +SketchConstraintCoincidence_296 = Sketch_18.setCoincident( + SketchLine_189.endPoint(), SketchLine_190.startPoint() +) SketchConstraintCoincidence_296.setName("SketchConstraintCoincidence_126") -SketchLine_191 = Sketch_18.addLine(43.82041221793113, -1.802673621518767, 43.79206701216234, 1) +SketchLine_191 = Sketch_18.addLine( + 43.82041221793113, -1.802673621518767, 43.79206701216234, 1 +) SketchLine_191.setName("SketchLine_87") SketchLine_191.result().setName("SketchLine_87") -SketchConstraintCoincidence_297 = Sketch_18.setCoincident(SketchLine_190.endPoint(), SketchLine_191.startPoint()) +SketchConstraintCoincidence_297 = Sketch_18.setCoincident( + SketchLine_190.endPoint(), SketchLine_191.startPoint() +) SketchConstraintCoincidence_297.setName("SketchConstraintCoincidence_127") SketchLine_192 = Sketch_18.addLine(54, 1, 43.79206701216234, 1) SketchLine_192.setName("SketchLine_88") SketchLine_192.result().setName("SketchLine_88") -SketchConstraintCoincidence_298 = Sketch_18.setCoincident(SketchPoint_40.coordinates(), SketchLine_192.startPoint()) +SketchConstraintCoincidence_298 = Sketch_18.setCoincident( + SketchPoint_40.coordinates(), SketchLine_192.startPoint() +) SketchConstraintCoincidence_298.setName("SketchConstraintCoincidence_128") SketchConstraintHorizontal_37 = Sketch_18.setHorizontal(SketchLine_192.result()) SketchConstraintHorizontal_37.setName("SketchConstraintHorizontal_16") SketchConstraintHorizontal_38 = Sketch_18.setHorizontal(SketchLine_186.result()) SketchConstraintHorizontal_38.setName("SketchConstraintHorizontal_17") -SketchConstraintCoincidence_299 = Sketch_18.setCoincident(SketchLine_191.endPoint(), SketchLine_192.endPoint()) +SketchConstraintCoincidence_299 = Sketch_18.setCoincident( + SketchLine_191.endPoint(), SketchLine_192.endPoint() +) SketchConstraintCoincidence_299.setName("SketchConstraintCoincidence_129") SketchArc_41 = Sketch_18.addArc(54, 6, 54, 11, 54, 1, True) -SketchConstraintCoincidence_300 = Sketch_18.setCoincident(SketchArc_41.center(), SketchLine_185.result()) +SketchConstraintCoincidence_300 = Sketch_18.setCoincident( + SketchArc_41.center(), SketchLine_185.result() +) SketchConstraintCoincidence_300.setName("SketchConstraintCoincidence_130") -SketchConstraintCoincidence_301 = Sketch_18.setCoincident(SketchPoint_39.coordinates(), SketchArc_41.startPoint()) +SketchConstraintCoincidence_301 = Sketch_18.setCoincident( + SketchPoint_39.coordinates(), SketchArc_41.startPoint() +) SketchConstraintCoincidence_301.setName("SketchConstraintCoincidence_130_") -SketchConstraintCoincidence_302 = Sketch_18.setCoincident(SketchLine_186.startPoint(), SketchArc_41.startPoint()) +SketchConstraintCoincidence_302 = Sketch_18.setCoincident( + SketchLine_186.startPoint(), SketchArc_41.startPoint() +) SketchConstraintCoincidence_302.setName("SketchConstraintCoincidence_131") -SketchConstraintCoincidence_303 = Sketch_18.setCoincident(SketchPoint_40.coordinates(), SketchArc_41.endPoint()) +SketchConstraintCoincidence_303 = Sketch_18.setCoincident( + SketchPoint_40.coordinates(), SketchArc_41.endPoint() +) SketchConstraintCoincidence_303.setName("SketchConstraintCoincidence_132") -SketchConstraintCoincidence_304 = Sketch_18.setCoincident(SketchLine_192.startPoint(), SketchArc_41.endPoint()) +SketchConstraintCoincidence_304 = Sketch_18.setCoincident( + SketchLine_192.startPoint(), SketchArc_41.endPoint() +) SketchConstraintCoincidence_304.setName("SketchConstraintCoincidence_133") SketchLine_193 = Sketch_18.addLine(43.50261344273609, 8.25, 43.50261344273609, 3.75) SketchLine_193.setName("SketchLine_90") @@ -1663,7 +2994,9 @@ SketchConstraintVertical_33 = Sketch_18.setVertical(SketchLine_193.result()) SketchConstraintLength_31 = Sketch_18.setLength(SketchLine_193.result(), 4.5) SketchConstraintLength_31.setName("SketchConstraintLength_15") SketchPoint_42 = Sketch_18.addPoint(43.50261344273609, 6) -SketchConstraintMiddle_13 = Sketch_18.setMiddlePoint(SketchPoint_42.coordinates(), SketchLine_193.result()) +SketchConstraintMiddle_13 = Sketch_18.setMiddlePoint( + SketchPoint_42.coordinates(), SketchLine_193.result() +) SketchPoint_43 = Sketch_18.addPoint(0, 6) SketchPoint_43.setAuxiliary(True) SketchLine_194 = Sketch_18.addLine(0, 0, 0, 12) @@ -1671,58 +3004,96 @@ SketchLine_194.setName("SketchLine_94") SketchLine_194.result().setName("SketchLine_94") SketchConstraintRigid_22 = Sketch_18.setFixed(SketchLine_194.result()) SketchConstraintRigid_22.setName("SketchConstraintRigid_19") -SketchConstraintCoincidence_305 = Sketch_18.setCoincident(SketchPoint_43.coordinates(), SketchLine_194.result()) +SketchConstraintCoincidence_305 = Sketch_18.setCoincident( + SketchPoint_43.coordinates(), SketchLine_194.result() +) SketchConstraintCoincidence_305.setName("SketchConstraintCoincidence_139") -SketchConstraintMiddle_14 = Sketch_18.setMiddlePoint(SketchLine_194.result(), SketchPoint_43.coordinates()) +SketchConstraintMiddle_14 = Sketch_18.setMiddlePoint( + SketchLine_194.result(), SketchPoint_43.coordinates() +) SketchLine_195 = Sketch_18.addLine(0, 6, 68.8619738308997, 6) SketchLine_195.setName("SketchLine_95") SketchLine_195.result().setName("SketchLine_95") SketchLine_195.setAuxiliary(True) -SketchConstraintCoincidence_306 = Sketch_18.setCoincident(SketchPoint_43.coordinates(), SketchLine_195.startPoint()) +SketchConstraintCoincidence_306 = Sketch_18.setCoincident( + SketchPoint_43.coordinates(), SketchLine_195.startPoint() +) SketchConstraintCoincidence_306.setName("SketchConstraintCoincidence_140") SketchConstraintHorizontal_39 = Sketch_18.setHorizontal(SketchLine_195.result()) SketchConstraintHorizontal_39.setName("SketchConstraintHorizontal_20") SketchPoint_44 = Sketch_18.addPoint(48.00130672136804, 6) -SketchConstraintCoincidence_307 = Sketch_18.setCoincident(SketchPoint_44.coordinates(), SketchLine_195.result()) +SketchConstraintCoincidence_307 = Sketch_18.setCoincident( + SketchPoint_44.coordinates(), SketchLine_195.result() +) SketchConstraintCoincidence_307.setName("SketchConstraintCoincidence_146") SketchLine_196 = Sketch_18.addLine(43.50261344273609, 8.25, 51.26978940411676, 8.25) SketchLine_196.setName("SketchLine_92") SketchLine_196.result().setName("SketchLine_92") -SketchConstraintCoincidence_308 = Sketch_18.setCoincident(SketchLine_193.startPoint(), SketchLine_196.startPoint()) +SketchConstraintCoincidence_308 = Sketch_18.setCoincident( + SketchLine_193.startPoint(), SketchLine_196.startPoint() +) SketchConstraintCoincidence_308.setName("SketchConstraintCoincidence_135") SketchLine_197 = Sketch_18.addLine(51.26978940411676, 8.25, 51.26978940411676, 3.75) SketchLine_197.setName("SketchLine_97") SketchLine_197.result().setName("SketchLine_97") -SketchConstraintCoincidence_309 = Sketch_18.setCoincident(SketchLine_196.endPoint(), SketchLine_197.startPoint()) +SketchConstraintCoincidence_309 = Sketch_18.setCoincident( + SketchLine_196.endPoint(), SketchLine_197.startPoint() +) SketchConstraintCoincidence_309.setName("SketchConstraintCoincidence_136") SketchLine_198 = Sketch_18.addLine(51.26978940411676, 3.75, 43.50261344273609, 3.75) SketchLine_198.setName("SketchLine_98") SketchLine_198.result().setName("SketchLine_98") -SketchConstraintCoincidence_310 = Sketch_18.setCoincident(SketchLine_197.endPoint(), SketchLine_198.startPoint()) +SketchConstraintCoincidence_310 = Sketch_18.setCoincident( + SketchLine_197.endPoint(), SketchLine_198.startPoint() +) SketchConstraintCoincidence_310.setName("SketchConstraintCoincidence_137") -SketchConstraintCoincidence_311 = Sketch_18.setCoincident(SketchLine_193.endPoint(), SketchLine_198.endPoint()) +SketchConstraintCoincidence_311 = Sketch_18.setCoincident( + SketchLine_193.endPoint(), SketchLine_198.endPoint() +) SketchConstraintCoincidence_311.setName("SketchConstraintCoincidence_138") SketchConstraintHorizontal_40 = Sketch_18.setHorizontal(SketchLine_198.result()) SketchConstraintHorizontal_41 = Sketch_18.setHorizontal(SketchLine_196.result()) SketchConstraintVertical_34 = Sketch_18.setVertical(SketchLine_197.result()) SketchLine_199 = Sketch_18.addLine(43.50261344273609, 3.75, 51.26978940411676, 8.25) SketchLine_199.setAuxiliary(True) -SketchConstraintCoincidence_312 = Sketch_18.setCoincident(SketchLine_193.endPoint(), SketchLine_199.startPoint()) +SketchConstraintCoincidence_312 = Sketch_18.setCoincident( + SketchLine_193.endPoint(), SketchLine_199.startPoint() +) SketchConstraintCoincidence_312.setName("SketchConstraintCoincidence_141") -SketchConstraintCoincidence_313 = Sketch_18.setCoincident(SketchLine_198.endPoint(), SketchLine_199.startPoint()) +SketchConstraintCoincidence_313 = Sketch_18.setCoincident( + SketchLine_198.endPoint(), SketchLine_199.startPoint() +) SketchConstraintCoincidence_313.setName("SketchConstraintCoincidence_142") -SketchConstraintCoincidence_314 = Sketch_18.setCoincident(SketchLine_197.startPoint(), SketchLine_199.endPoint()) +SketchConstraintCoincidence_314 = Sketch_18.setCoincident( + SketchLine_197.startPoint(), SketchLine_199.endPoint() +) SketchConstraintCoincidence_314.setName("SketchConstraintCoincidence_143") SketchPoint_45 = Sketch_18.addPoint(47.38620142342643, 6) SketchPoint_45.setAuxiliary(True) -SketchConstraintCoincidence_315 = Sketch_18.setCoincident(SketchPoint_45.coordinates(), SketchLine_199.result()) +SketchConstraintCoincidence_315 = Sketch_18.setCoincident( + SketchPoint_45.coordinates(), SketchLine_199.result() +) SketchConstraintCoincidence_315.setName("SketchConstraintCoincidence_144") -SketchConstraintMiddle_15 = Sketch_18.setMiddlePoint(SketchPoint_45.coordinates(), SketchLine_199.result()) -SketchConstraintCoincidence_316 = Sketch_18.setCoincident(SketchPoint_45.coordinates(), SketchLine_195.result()) +SketchConstraintMiddle_15 = Sketch_18.setMiddlePoint( + SketchPoint_45.coordinates(), SketchLine_199.result() +) +SketchConstraintCoincidence_316 = Sketch_18.setCoincident( + SketchPoint_45.coordinates(), SketchLine_195.result() +) 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/Modified_Face&Extrusion_1_1/To_Face")) +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/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") @@ -1730,7 +3101,15 @@ SketchLine_201 = Sketch_19.addLine(29, 5, 21, 5) SketchLine_201.setName("SketchLine_96") SketchLine_201.result().setName("SketchLine_96") SketchLine_201.setAuxiliary(True) -SketchArc_42 = Sketch_19.addArc(25, 8, 21.53774043054522, 4.392679848735523, 28.46225956945478, 4.392679848735522, False) +SketchArc_42 = Sketch_19.addArc( + 25, + 8, + 21.53774043054522, + 4.392679848735523, + 28.46225956945478, + 4.392679848735522, + False, +) SketchArc_42.setName("SketchArc_22") SketchArc_42.result().setName("SketchArc_22") SketchArc_42.results()[1].setName("SketchArc_22_2") @@ -1744,15 +3123,23 @@ SketchLine_204 = Sketch_19.addLine(29, 0, 29, 5) SketchLine_204.setName("SketchLine_101") SketchLine_204.result().setName("SketchLine_101") SketchLine_204.setAuxiliary(True) -SketchConstraintCoincidence_317 = Sketch_19.setCoincident(SketchLine_204.endPoint(), SketchLine_201.startPoint()) +SketchConstraintCoincidence_317 = Sketch_19.setCoincident( + SketchLine_204.endPoint(), SketchLine_201.startPoint() +) SketchConstraintCoincidence_317.setName("SketchConstraintCoincidence_147") SketchLine_205 = Sketch_19.addLine(21, 5, 21, 0) SketchLine_205.setAuxiliary(True) -SketchConstraintCoincidence_318 = Sketch_19.setCoincident(SketchLine_201.endPoint(), SketchLine_205.startPoint()) +SketchConstraintCoincidence_318 = Sketch_19.setCoincident( + SketchLine_201.endPoint(), SketchLine_205.startPoint() +) SketchConstraintCoincidence_318.setName("SketchConstraintCoincidence_148") -SketchConstraintCoincidence_319 = Sketch_19.setCoincident(SketchLine_205.endPoint(), SketchLine_202.startPoint()) +SketchConstraintCoincidence_319 = Sketch_19.setCoincident( + SketchLine_205.endPoint(), SketchLine_202.startPoint() +) SketchConstraintCoincidence_319.setName("SketchConstraintCoincidence_149") -SketchConstraintCoincidence_320 = Sketch_19.setCoincident(SketchLine_202.endPoint(), SketchLine_204.startPoint()) +SketchConstraintCoincidence_320 = Sketch_19.setCoincident( + SketchLine_202.endPoint(), SketchLine_204.startPoint() +) SketchConstraintCoincidence_320.setName("SketchConstraintCoincidence_150") SketchConstraintHorizontal_42 = Sketch_19.setHorizontal(SketchLine_201.result()) SketchConstraintHorizontal_42.setName("SketchConstraintHorizontal_21") @@ -1761,12 +3148,16 @@ SketchConstraintHorizontal_43 = Sketch_19.setHorizontal(SketchLine_202.result()) SketchConstraintHorizontal_43.setName("SketchConstraintHorizontal_22") SketchConstraintVertical_36 = Sketch_19.setVertical(SketchLine_204.result()) SketchPoint_46 = Sketch_19.addPoint(21, 7.5) -SketchConstraintCoincidence_321 = Sketch_19.setCoincident(SketchLine_205.result(), SketchPoint_46.coordinates()) +SketchConstraintCoincidence_321 = Sketch_19.setCoincident( + SketchLine_205.result(), SketchPoint_46.coordinates() +) SketchConstraintCoincidence_321.setName("SketchConstraintCoincidence_151") SketchConstraintRigid_23 = Sketch_19.setFixed(SketchPoint_46.result()) SketchConstraintRigid_23.setName("SketchConstraintRigid_18") SketchPoint_47 = Sketch_19.addPoint(29, 7.5) -SketchConstraintCoincidence_322 = Sketch_19.setCoincident(SketchLine_204.result(), SketchPoint_47.coordinates()) +SketchConstraintCoincidence_322 = Sketch_19.setCoincident( + SketchLine_204.result(), SketchPoint_47.coordinates() +) SketchConstraintCoincidence_322.setName("SketchConstraintCoincidence_152") SketchConstraintRigid_24 = Sketch_19.setFixed(SketchPoint_47.result()) SketchConstraintRigid_24.setName("SketchConstraintRigid_20") @@ -1775,7 +3166,9 @@ SketchConstraintLength_32.setName("SketchConstraintLength_16") SketchLine_206 = Sketch_19.addLine(0, 0, 45.5, 0) SketchLine_206.setName("SketchLine_102") SketchLine_206.result().setName("SketchLine_102") -SketchConstraintCoincidence_323 = Sketch_19.setCoincident(SketchLine_205.endPoint(), SketchLine_206.result()) +SketchConstraintCoincidence_323 = Sketch_19.setCoincident( + SketchLine_205.endPoint(), SketchLine_206.result() +) SketchConstraintCoincidence_323.setName("SketchConstraintCoincidence_153") SketchConstraintRigid_25 = Sketch_19.setFixed(SketchLine_206.result()) SketchConstraintRigid_25.setName("SketchConstraintRigid_21") @@ -1784,88 +3177,176 @@ SketchArc_43.setName("SketchArc_19") SketchArc_43.result().setName("SketchArc_19") SketchArc_43.results()[1].setName("SketchArc_19_2") SketchArc_43.setAuxiliary(True) -SketchConstraintCoincidence_324 = Sketch_19.setCoincident(SketchLine_201.endPoint(), SketchArc_43.startPoint()) +SketchConstraintCoincidence_324 = Sketch_19.setCoincident( + SketchLine_201.endPoint(), SketchArc_43.startPoint() +) SketchConstraintCoincidence_324.setName("SketchConstraintCoincidence_154") -SketchConstraintCoincidence_325 = Sketch_19.setCoincident(SketchLine_205.startPoint(), SketchArc_43.startPoint()) +SketchConstraintCoincidence_325 = Sketch_19.setCoincident( + SketchLine_205.startPoint(), SketchArc_43.startPoint() +) SketchConstraintCoincidence_325.setName("SketchConstraintCoincidence_155") -SketchConstraintCoincidence_326 = Sketch_19.setCoincident(SketchLine_201.startPoint(), SketchArc_43.endPoint()) +SketchConstraintCoincidence_326 = Sketch_19.setCoincident( + SketchLine_201.startPoint(), SketchArc_43.endPoint() +) SketchConstraintCoincidence_326.setName("SketchConstraintCoincidence_156") -SketchConstraintCoincidence_327 = Sketch_19.setCoincident(SketchLine_204.endPoint(), SketchArc_43.endPoint()) +SketchConstraintCoincidence_327 = Sketch_19.setCoincident( + SketchLine_204.endPoint(), SketchArc_43.endPoint() +) SketchConstraintCoincidence_327.setName("SketchConstraintCoincidence_157") SketchConstraintRadius_17 = Sketch_19.setRadius(SketchArc_43.results()[1], 5) SketchLine_207 = Sketch_19.addLine(1, 0, 1, 1.8) SketchLine_207.setName("SketchLine_103") SketchLine_207.result().setName("SketchLine_103") -SketchConstraintCoincidence_328 = Sketch_19.setCoincident(SketchLine_207.startPoint(), SketchLine_206.result()) +SketchConstraintCoincidence_328 = Sketch_19.setCoincident( + SketchLine_207.startPoint(), SketchLine_206.result() +) SketchConstraintCoincidence_328.setName("SketchConstraintCoincidence_158") SketchLine_208 = Sketch_19.addLine(1, 1.8, 8, 3.389761862250954) SketchLine_208.setName("SketchLine_104") SketchLine_208.result().setName("SketchLine_104") -SketchConstraintCoincidence_329 = Sketch_19.setCoincident(SketchLine_207.endPoint(), SketchLine_208.startPoint()) +SketchConstraintCoincidence_329 = Sketch_19.setCoincident( + SketchLine_207.endPoint(), SketchLine_208.startPoint() +) SketchConstraintCoincidence_329.setName("SketchConstraintCoincidence_159") SketchLine_209 = Sketch_19.addLine(8, 3.389761862250954, 8, 0) SketchLine_209.setName("SketchLine_105") SketchLine_209.result().setName("SketchLine_105") -SketchConstraintCoincidence_330 = Sketch_19.setCoincident(SketchLine_208.endPoint(), SketchLine_209.startPoint()) +SketchConstraintCoincidence_330 = Sketch_19.setCoincident( + SketchLine_208.endPoint(), SketchLine_209.startPoint() +) SketchConstraintCoincidence_330.setName("SketchConstraintCoincidence_160") SketchLine_210 = Sketch_19.addLine(8, 0, 1, 0) SketchLine_210.setName("SketchLine_106") SketchLine_210.result().setName("SketchLine_106") -SketchConstraintCoincidence_331 = Sketch_19.setCoincident(SketchLine_209.endPoint(), SketchLine_210.startPoint()) +SketchConstraintCoincidence_331 = Sketch_19.setCoincident( + SketchLine_209.endPoint(), SketchLine_210.startPoint() +) SketchConstraintCoincidence_331.setName("SketchConstraintCoincidence_161") -SketchConstraintCoincidence_332 = Sketch_19.setCoincident(SketchLine_207.startPoint(), SketchLine_210.endPoint()) +SketchConstraintCoincidence_332 = Sketch_19.setCoincident( + SketchLine_207.startPoint(), SketchLine_210.endPoint() +) SketchConstraintCoincidence_332.setName("SketchConstraintCoincidence_162") -SketchConstraintCoincidence_333 = Sketch_19.setCoincident(SketchLine_210.startPoint(), SketchLine_206.result()) +SketchConstraintCoincidence_333 = Sketch_19.setCoincident( + SketchLine_210.startPoint(), SketchLine_206.result() +) SketchConstraintCoincidence_333.setName("SketchConstraintCoincidence_163") SketchConstraintVertical_37 = Sketch_19.setVertical(SketchLine_209.result()) SketchConstraintVertical_38 = Sketch_19.setVertical(SketchLine_207.result()) SketchConstraintLength_33 = Sketch_19.setLength(SketchLine_210.result(), 7) SketchConstraintLength_33.setName("SketchConstraintLength_17") -SketchConstraintDistance_33 = Sketch_19.setDistance(SketchLine_207.result(), SketchLine_206.startPoint(), 1, False) +SketchConstraintDistance_33 = Sketch_19.setDistance( + SketchLine_207.result(), SketchLine_206.startPoint(), 1, False +) SketchConstraintLength_34 = Sketch_19.setLength(SketchLine_207.result(), 1.8) SketchConstraintLength_34.setName("SketchConstraintLength_18") -SketchArc_44 = Sketch_19.addArc(21.31772863153846, 4.163450069699051, 21.53774043054522, 4.392679848735523, 21, 4.163450069699051, False) -SketchArc_45 = Sketch_19.addArc(25, 8, 21.53774043054522, 4.392679848735523, 29, 5, False) +SketchArc_44 = Sketch_19.addArc( + 21.31772863153846, + 4.163450069699051, + 21.53774043054522, + 4.392679848735523, + 21, + 4.163450069699051, + False, +) +SketchArc_45 = Sketch_19.addArc( + 25, 8, 21.53774043054522, 4.392679848735523, 29, 5, False +) SketchArc_45.setName("SketchArc_20") SketchArc_45.result().setName("SketchArc_20") SketchArc_45.results()[1].setName("SketchArc_20_2") SketchArc_45.setAuxiliary(True) -SketchConstraintCoincidence_334 = Sketch_19.setCoincident(SketchArc_44.startPoint(), SketchArc_45.startPoint()) +SketchConstraintCoincidence_334 = Sketch_19.setCoincident( + SketchArc_44.startPoint(), SketchArc_45.startPoint() +) SketchConstraintCoincidence_334.setName("SketchConstraintCoincidence_164") -SketchConstraintCoincidence_335 = Sketch_19.setCoincident(SketchArc_44.endPoint(), SketchLine_200.startPoint()) +SketchConstraintCoincidence_335 = Sketch_19.setCoincident( + SketchArc_44.endPoint(), SketchLine_200.startPoint() +) SketchConstraintCoincidence_335.setName("SketchConstraintCoincidence_165") -SketchConstraintTangent_25 = Sketch_19.setTangent(SketchArc_44.results()[1], SketchLine_200.result()) -SketchConstraintTangent_26 = Sketch_19.setTangent(SketchArc_44.results()[1], SketchArc_45.results()[1]) -SketchConstraintCoincidence_336 = Sketch_19.setCoincident(SketchLine_205.endPoint(), SketchLine_200.endPoint()) +SketchConstraintTangent_25 = Sketch_19.setTangent( + SketchArc_44.results()[1], SketchLine_200.result() +) +SketchConstraintTangent_26 = Sketch_19.setTangent( + SketchArc_44.results()[1], SketchArc_45.results()[1] +) +SketchConstraintCoincidence_336 = Sketch_19.setCoincident( + SketchLine_205.endPoint(), SketchLine_200.endPoint() +) SketchConstraintCoincidence_336.setName("SketchConstraintCoincidence_166") -SketchConstraintCoincidence_337 = Sketch_19.setCoincident(SketchArc_43.endPoint(), SketchArc_45.endPoint()) +SketchConstraintCoincidence_337 = Sketch_19.setCoincident( + SketchArc_43.endPoint(), SketchArc_45.endPoint() +) SketchConstraintCoincidence_337.setName("SketchConstraintCoincidence_167") -SketchConstraintTangent_27 = Sketch_19.setTangent(SketchArc_43.results()[1], SketchArc_45.results()[1]) -SketchConstraintCoincidence_338 = Sketch_19.setCoincident(SketchLine_200.startPoint(), SketchLine_205.result()) +SketchConstraintTangent_27 = Sketch_19.setTangent( + SketchArc_43.results()[1], SketchArc_45.results()[1] +) +SketchConstraintCoincidence_338 = Sketch_19.setCoincident( + SketchLine_200.startPoint(), SketchLine_205.result() +) SketchConstraintCoincidence_338.setName("SketchConstraintCoincidence_168") -SketchConstraintCoincidence_339 = Sketch_19.setCoincident(SketchArc_45.startPoint(), SketchArc_43.results()[1]) +SketchConstraintCoincidence_339 = Sketch_19.setCoincident( + SketchArc_45.startPoint(), SketchArc_43.results()[1] +) SketchConstraintCoincidence_339.setName("SketchConstraintCoincidence_169") -SketchArc_46 = Sketch_19.addArc(28.68227136846154, 4.163450069699049, 29, 4.163450069699049, 28.46225956945478, 4.392679848735522, False) -SketchConstraintCoincidence_340 = Sketch_19.setCoincident(SketchArc_46.startPoint(), SketchLine_203.endPoint()) +SketchArc_46 = Sketch_19.addArc( + 28.68227136846154, + 4.163450069699049, + 29, + 4.163450069699049, + 28.46225956945478, + 4.392679848735522, + False, +) +SketchConstraintCoincidence_340 = Sketch_19.setCoincident( + SketchArc_46.startPoint(), SketchLine_203.endPoint() +) SketchConstraintCoincidence_340.setName("SketchConstraintCoincidence_170") -SketchConstraintCoincidence_341 = Sketch_19.setCoincident(SketchArc_46.endPoint(), SketchArc_42.endPoint()) +SketchConstraintCoincidence_341 = Sketch_19.setCoincident( + SketchArc_46.endPoint(), SketchArc_42.endPoint() +) SketchConstraintCoincidence_341.setName("SketchConstraintCoincidence_171") -SketchConstraintTangent_28 = Sketch_19.setTangent(SketchArc_46.results()[1], SketchArc_42.results()[1]) -SketchConstraintTangent_29 = Sketch_19.setTangent(SketchArc_46.results()[1], SketchLine_203.result()) -SketchConstraintCoincidence_342 = Sketch_19.setCoincident(SketchArc_45.startPoint(), SketchArc_42.startPoint()) +SketchConstraintTangent_28 = Sketch_19.setTangent( + SketchArc_46.results()[1], SketchArc_42.results()[1] +) +SketchConstraintTangent_29 = Sketch_19.setTangent( + SketchArc_46.results()[1], SketchLine_203.result() +) +SketchConstraintCoincidence_342 = Sketch_19.setCoincident( + SketchArc_45.startPoint(), SketchArc_42.startPoint() +) SketchConstraintCoincidence_342.setName("SketchConstraintCoincidence_172") -SketchConstraintCoincidence_343 = Sketch_19.setCoincident(SketchLine_204.startPoint(), SketchLine_203.startPoint()) +SketchConstraintCoincidence_343 = Sketch_19.setCoincident( + SketchLine_204.startPoint(), SketchLine_203.startPoint() +) SketchConstraintCoincidence_343.setName("SketchConstraintCoincidence_173") -SketchConstraintTangent_30 = Sketch_19.setTangent(SketchArc_45.results()[1], SketchArc_42.results()[1]) -SketchConstraintCoincidence_344 = Sketch_19.setCoincident(SketchArc_42.endPoint(), SketchArc_45.results()[1]) +SketchConstraintTangent_30 = Sketch_19.setTangent( + SketchArc_45.results()[1], SketchArc_42.results()[1] +) +SketchConstraintCoincidence_344 = Sketch_19.setCoincident( + SketchArc_42.endPoint(), SketchArc_45.results()[1] +) SketchConstraintCoincidence_344.setName("SketchConstraintCoincidence_174") -SketchConstraintCoincidence_345 = Sketch_19.setCoincident(SketchLine_203.endPoint(), SketchLine_204.result()) +SketchConstraintCoincidence_345 = Sketch_19.setCoincident( + SketchLine_203.endPoint(), SketchLine_204.result() +) SketchConstraintCoincidence_345.setName("SketchConstraintCoincidence_175") 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/Modified_Face&Sketch_1/SketchLine_1")) +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/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) @@ -1875,26 +3356,70 @@ SketchLine_211.setName("SketchLine_109") SketchLine_211.result().setName("SketchLine_109") SketchConstraintRigid_26 = Sketch_20.setFixed(SketchLine_211.result()) SketchConstraintRigid_26.setName("SketchConstraintRigid_22") -SketchConstraintCoincidence_346 = Sketch_20.setCoincident(SketchPoint_48.coordinates(), SketchLine_211.result()) +SketchConstraintCoincidence_346 = Sketch_20.setCoincident( + SketchPoint_48.coordinates(), SketchLine_211.result() +) SketchConstraintCoincidence_346.setName("SketchConstraintCoincidence_176") -SketchConstraintMiddle_16 = Sketch_20.setMiddlePoint(SketchLine_211.result(), SketchPoint_48.coordinates()) +SketchConstraintMiddle_16 = Sketch_20.setMiddlePoint( + SketchLine_211.result(), SketchPoint_48.coordinates() +) SketchLine_212 = Sketch_20.addLine(0, 6, 17.31036191565843, 6) SketchLine_212.setName("SketchLine_110") SketchLine_212.result().setName("SketchLine_110") SketchLine_212.setAuxiliary(True) -SketchConstraintCoincidence_347 = Sketch_20.setCoincident(SketchPoint_48.coordinates(), SketchLine_212.startPoint()) +SketchConstraintCoincidence_347 = Sketch_20.setCoincident( + SketchPoint_48.coordinates(), SketchLine_212.startPoint() +) SketchConstraintCoincidence_347.setName("SketchConstraintCoincidence_177") SketchConstraintHorizontal_44 = Sketch_20.setHorizontal(SketchLine_212.result()) SketchConstraintHorizontal_44.setName("SketchConstraintHorizontal_23") -SketchConstraintCoincidence_348 = Sketch_20.setCoincident(SketchCircle_2.center(), SketchLine_212.result()) +SketchConstraintCoincidence_348 = Sketch_20.setCoincident( + SketchCircle_2.center(), SketchLine_212.result() +) SketchConstraintCoincidence_348.setName("SketchConstraintCoincidence_178") -SketchConstraintDistance_34 = Sketch_20.setDistance(SketchLine_211.result(), SketchCircle_2.center(), 12, False) +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/Face-SketchCircle_1_2r_wire")], 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/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_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() diff --git a/test.compatibility/ecran.py b/test.compatibility/ecran.py index fad7bc86a..13668a81e 100644 --- a/test.compatibility/ecran.py +++ b/test.compatibility/ecran.py @@ -35,7 +35,9 @@ SketchLine_3 = Sketch_1.addLine(55.1, 0.3, 0.3, 0.3) SketchLine_3.setName("SketchLine_2") SketchLine_3.result().setName("SketchLine_2") SketchLine_3.setAuxiliary(True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(0.3, 2.3, 0.3, 10.3) SketchLine_4.setName("SketchLine_11") SketchLine_4.result().setName("SketchLine_11") @@ -46,37 +48,53 @@ SketchLine_6 = Sketch_1.addLine(0.3, 0.3, 0.3, 10.3) SketchLine_6.setName("SketchLine_3") SketchLine_6.result().setName("SketchLine_3") SketchLine_6.setAuxiliary(True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(0, 10.3, 0, 2.3) SketchLine_7.setName("SketchLine_13") SketchLine_7.result().setName("SketchLine_13") SketchLine_8 = Sketch_1.addLine(0.3, 10.3, 0, 10.3) SketchLine_8.setName("SketchLine_4") SketchLine_8.result().setName("SketchLine_4") -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_9.setName("SketchLine_5") SketchLine_9.result().setName("SketchLine_5") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.result() +) SketchLine_10 = Sketch_1.addLine(0, 10.3, 0, 0) SketchLine_10.setName("SketchLine_6") SketchLine_10.result().setName("SketchLine_6") SketchLine_10.setAuxiliary(True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_10.startPoint() +) SketchLine_11 = Sketch_1.addLine(0, 0, 55.4, 0) SketchLine_11.setName("SketchLine_7") SketchLine_11.result().setName("SketchLine_7") SketchLine_11.setAuxiliary(True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchLine_12 = Sketch_1.addLine(55.4, 0, 55.4, 10.3) SketchLine_12.setName("SketchLine_8") SketchLine_12.result().setName("SketchLine_8") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchLine_13 = Sketch_1.addLine(55.4, 10.3, 55.1, 10.3) SketchLine_13.setName("SketchLine_9") SketchLine_13.result().setName("SketchLine_9") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_13.endPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_13.endPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_13.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_8.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_3.result()) @@ -86,48 +104,115 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_12.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 10) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_13.result(), 0.3) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.result(), SketchLine_11.endPoint(), 0.3) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_8.result(), SketchLine_1.startPoint()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.result(), SketchLine_11.endPoint(), 0.3 +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_8.result(), SketchLine_1.startPoint() +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_11.result(), 55.4) SketchConstraintLength_3.setName("SketchConstraintLength_5") SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), "H") SketchArc_1 = Sketch_1.addArc(2.3, 2.3, 0.3, 2.3, 2.3, 0.3, False) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.endPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_2.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_4.result()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_4.endPoint()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.result()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_2.endPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_2.result() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_4.result() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_4.endPoint() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.result() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_4.startPoint(), SketchLine_6.result() +) SketchArc_2 = Sketch_1.addArc(2.3, 2.3, 0, 2.3, 2.3, 0, False) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_7.endPoint()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_5.startPoint()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_5.result()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_7.result()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_5.endPoint()) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_10.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_11.result()) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_10.result()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_7.endPoint() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_5.result() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_7.result() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_5.endPoint() +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_10.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_11.result() +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_10.result() +) 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()) +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/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 = 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&Sketch_1/SketchLine_12")) +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&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()) +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) SketchLine_17 = Sketch_2.addLine(149.5, 7.7, 149.5, -2.3) -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchLine_17.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_14.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_15.result()) SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_16.result()) @@ -136,115 +221,222 @@ SketchLine_18 = Sketch_2.addLine(-149.5, -2.3142, -153.5, -2.3142) SketchLine_19 = Sketch_2.addLine(-153.5, -2.3142, -153.5, 7.7) SketchLine_20 = Sketch_2.addLine(-153.5, 7.7, -149.5, 7.7) SketchLine_21 = Sketch_2.addLine(-149.5, 7.7, -149.5, -2.3142) -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchLine_18.startPoint()) -SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchLine_21.endPoint(), SketchLine_18.startPoint() +) +SketchConstraintCoincidence_30 = Sketch_2.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) +SketchConstraintCoincidence_31 = Sketch_2.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) +SketchConstraintCoincidence_32 = Sketch_2.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.startPoint() +) SketchConstraintHorizontal_7 = Sketch_2.setHorizontal(SketchLine_18.result()) SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_19.result()) SketchConstraintHorizontal_8 = Sketch_2.setHorizontal(SketchLine_20.result()) SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_21.result()) -SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_20.result()) +SketchConstraintCoincidence_33 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_20.result() +) 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&Sketch_1/SketchArc_2_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_12][Extrusion_1_1/From_Face]")) +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&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 = 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&Sketch_1/SketchLine_4"), 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&Sketch_1/SketchLine_8")) +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&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 = 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 = 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/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8]")) +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()) +SketchConstraintCoincidence_36 = Sketch_3.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.result() +) SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_41") SketchLine_24 = Sketch_3.addLine(153.5, -8.3, 151.5, -10.3) SketchLine_24.setName("SketchLine_31") SketchLine_24.result().setName("SketchLine_31") -SketchConstraintCoincidence_37 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_24.startPoint()) +SketchConstraintCoincidence_37 = Sketch_3.setCoincident( + SketchLine_22.endPoint(), SketchLine_24.startPoint() +) SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_42") SketchLine_25 = Sketch_3.addLine(151.5, -10.3, 153.5, -10.3) SketchLine_25.setName("SketchLine_33") SketchLine_25.result().setName("SketchLine_33") -SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint()) +SketchConstraintCoincidence_38 = Sketch_3.setCoincident( + SketchLine_24.endPoint(), SketchLine_25.startPoint() +) SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_44") -SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchLine_25.endPoint()) +SketchConstraintCoincidence_39 = Sketch_3.setCoincident( + SketchLine_22.startPoint(), SketchLine_25.endPoint() +) SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_45") -SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_25.endPoint()) +SketchConstraintCoincidence_40 = Sketch_3.setCoincident( + SketchPoint_3.coordinates(), SketchLine_25.endPoint() +) SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_46") -SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_25.endPoint()) +SketchConstraintCoincidence_41 = Sketch_3.setCoincident( + SketchLine_23.endPoint(), SketchLine_25.endPoint() +) SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_47") 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 = 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/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()] -SketchConstraintMirror_1 = Sketch_3.addMirror(SketchLine_26.result(), SketchConstraintMirror_1_objects) +SketchConstraintMirror_1_objects = [ + SketchLine_22.result(), + SketchLine_25.result(), + SketchLine_24.result(), +] +SketchConstraintMirror_1 = Sketch_3.addMirror( + SketchLine_26.result(), SketchConstraintMirror_1_objects +) [SketchLine_27, SketchLine_28, SketchLine_29] = SketchConstraintMirror_1.mirrored() SketchLine_29.setName("SketchLine_32") SketchLine_29.result().setName("SketchLine_32") 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(), 0, 10, [model.selection("SOLID", "ExtrusionCut_1_1")]) +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/Modified_Face&Sketch_1/SketchLine_13")) +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/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 = 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 = 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/Generated_Face&Sketch_2/SketchLine_21][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_13]")) +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()) +SketchConstraintCoincidence_43 = Sketch_4.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.result() +) SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_48") SketchLine_32 = Sketch_4.addLine(-149.5, 8.3, -147.5, 10.3) SketchLine_32.setName("SketchLine_37") SketchLine_32.result().setName("SketchLine_37") -SketchConstraintCoincidence_44 = Sketch_4.setCoincident(SketchLine_30.endPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_44 = Sketch_4.setCoincident( + SketchLine_30.endPoint(), SketchLine_32.startPoint() +) SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_49") SketchLine_33 = Sketch_4.addLine(-147.5, 10.3, -149.5, 10.3) SketchLine_33.setName("SketchLine_38") SketchLine_33.result().setName("SketchLine_38") -SketchConstraintCoincidence_45 = Sketch_4.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_45 = Sketch_4.setCoincident( + SketchLine_32.endPoint(), SketchLine_33.startPoint() +) SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_50") -SketchConstraintCoincidence_46 = Sketch_4.setCoincident(SketchLine_30.startPoint(), SketchLine_33.endPoint()) +SketchConstraintCoincidence_46 = Sketch_4.setCoincident( + SketchLine_30.startPoint(), SketchLine_33.endPoint() +) SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_51") -SketchConstraintCoincidence_47 = Sketch_4.setCoincident(SketchPoint_4.coordinates(), SketchLine_33.endPoint()) +SketchConstraintCoincidence_47 = Sketch_4.setCoincident( + SketchPoint_4.coordinates(), SketchLine_33.endPoint() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_52") -SketchConstraintCoincidence_48 = Sketch_4.setCoincident(SketchLine_31.startPoint(), SketchLine_33.endPoint()) +SketchConstraintCoincidence_48 = Sketch_4.setCoincident( + SketchLine_31.startPoint(), SketchLine_33.endPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_53") SketchConstraintHorizontal_9 = Sketch_4.setHorizontal(SketchLine_33.result()) -SketchConstraintAngle_2 = Sketch_4.setAngleBackward(SketchLine_30.result(), SketchLine_32.result(), 45) +SketchConstraintAngle_2 = Sketch_4.setAngleBackward( + SketchLine_30.result(), SketchLine_32.result(), 45 +) SketchConstraintAngle_2.setName("SketchConstraintAngle_3") SketchConstraintLength_7 = Sketch_4.setLength(SketchLine_33.result(), 2) SketchLine_34 = Sketch_4.addLine(0, 0, 0, 100) SketchLine_34.setName("SketchLine_39") SketchLine_34.result().setName("SketchLine_39") -SketchConstraintMirror_2_objects = [SketchLine_32.result(), SketchLine_33.result(), SketchLine_30.result()] -SketchConstraintMirror_2 = Sketch_4.addMirror(SketchLine_34.result(), SketchConstraintMirror_2_objects) +SketchConstraintMirror_2_objects = [ + SketchLine_32.result(), + SketchLine_33.result(), + SketchLine_30.result(), +] +SketchConstraintMirror_2 = Sketch_4.addMirror( + SketchLine_34.result(), SketchConstraintMirror_2_objects +) [SketchLine_35, SketchLine_36, SketchLine_37] = SketchConstraintMirror_2.mirrored() SketchLine_37.setName("SketchLine_42") SketchLine_37.result().setName("SketchLine_42") @@ -259,53 +451,108 @@ 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/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face]"), False) +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") -SketchConstraintDistance_3 = Sketch_4.setDistance(SketchLine_38.result(), SketchAPI_Line(SketchLine_39).endPoint(), 5.5) -SketchConstraintCoincidence_49 = Sketch_4.setCoincident(SketchLine_38.startPoint(), SketchLine_39.result()) +SketchConstraintDistance_3 = Sketch_4.setDistance( + SketchLine_38.result(), SketchAPI_Line(SketchLine_39).endPoint(), 5.5 +) +SketchConstraintCoincidence_49 = Sketch_4.setCoincident( + SketchLine_38.startPoint(), SketchLine_39.result() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_54") SketchCircle_1 = Sketch_4.addCircle(100.5, 5.5, 1.5) SketchConstraintRadius_3 = Sketch_4.setRadius(SketchCircle_1.results()[1], 1.5) SketchCircle_2 = Sketch_4.addCircle(33.5, 5.5, 1.5) -SketchConstraintCoincidence_50 = Sketch_4.setCoincident(SketchCircle_2.center(), SketchLine_38.result()) +SketchConstraintCoincidence_50 = Sketch_4.setCoincident( + SketchCircle_2.center(), SketchLine_38.result() +) SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_55") SketchCircle_3 = Sketch_4.addCircle(-33.5, 5.5, 1.506545921898) -SketchConstraintCoincidence_51 = Sketch_4.setCoincident(SketchCircle_3.center(), SketchLine_38.result()) +SketchConstraintCoincidence_51 = Sketch_4.setCoincident( + SketchCircle_3.center(), SketchLine_38.result() +) SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_56") SketchCircle_4 = Sketch_4.addCircle(-100.5, 5.5, 1.506545921898) -SketchConstraintCoincidence_52 = Sketch_4.setCoincident(SketchCircle_4.center(), SketchLine_38.result()) +SketchConstraintCoincidence_52 = Sketch_4.setCoincident( + SketchCircle_4.center(), SketchLine_38.result() +) SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_57") -SketchConstraintEqual_2 = Sketch_4.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) -SketchConstraintEqual_3 = Sketch_4.setEqual(SketchCircle_3.results()[1], SketchCircle_4.results()[1]) -SketchConstraintCoincidence_53 = Sketch_4.setCoincident(SketchCircle_1.center(), SketchLine_38.result()) +SketchConstraintEqual_2 = Sketch_4.setEqual( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) +SketchConstraintEqual_3 = Sketch_4.setEqual( + SketchCircle_3.results()[1], SketchCircle_4.results()[1] +) +SketchConstraintCoincidence_53 = Sketch_4.setCoincident( + SketchCircle_1.center(), SketchLine_38.result() +) SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_58") -SketchConstraintDistance_4 = Sketch_4.setDistance(SketchCircle_4.center(), SketchCircle_3.center(), 67) -SketchConstraintDistance_5 = Sketch_4.setDistance(SketchCircle_3.center(), SketchCircle_2.center(), 67) -SketchConstraintDistance_6 = Sketch_4.setDistance(SketchCircle_2.center(), SketchCircle_1.center(), 67) -SketchConstraintDistance_7 = Sketch_4.setDistance(SketchLine_39.result(), SketchCircle_1.center(), 53) -SketchConstraintCoincidence_54 = Sketch_4.setCoincident(SketchLine_38.endPoint(), SketchCircle_4.center()) +SketchConstraintDistance_4 = Sketch_4.setDistance( + SketchCircle_4.center(), SketchCircle_3.center(), 67 +) +SketchConstraintDistance_5 = Sketch_4.setDistance( + SketchCircle_3.center(), SketchCircle_2.center(), 67 +) +SketchConstraintDistance_6 = Sketch_4.setDistance( + SketchCircle_2.center(), SketchCircle_1.center(), 67 +) +SketchConstraintDistance_7 = Sketch_4.setDistance( + SketchLine_39.result(), SketchCircle_1.center(), 53 +) +SketchConstraintCoincidence_54 = Sketch_4.setCoincident( + SketchLine_38.endPoint(), SketchCircle_4.center() +) 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/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) +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 = 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/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_12]")) +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) SketchLine_43.setName("SketchLine_45") SketchLine_43.result().setName("SketchLine_45") SketchLine_43.setAuxiliary(True) -SketchConstraintCoincidence_55 = Sketch_5.setCoincident(SketchLine_43.endPoint(), SketchLine_42.result()) +SketchConstraintCoincidence_55 = Sketch_5.setCoincident( + SketchLine_43.endPoint(), SketchLine_42.result() +) SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_60") SketchLine_44 = Sketch_5.addLine(153.5, -45.04999053274702, 153.5, -37.04999053274702) SketchLine_44.setName("SketchLine_47") @@ -313,28 +560,40 @@ SketchLine_44.result().setName("SketchLine_47") SketchLine_45 = Sketch_5.addLine(150.8, -14.54997391609652, 150.8, -19.54999029833178) SketchLine_45.setName("SketchLine_61") SketchLine_45.result().setName("SketchLine_61") -SketchLine_46 = Sketch_5.addLine(153.5, -13.04999053274714, 152.2999838654776, -13.04999053274697) +SketchLine_46 = Sketch_5.addLine( + 153.5, -13.04999053274714, 152.2999838654776, -13.04999053274697 +) SketchLine_46.setName("SketchLine_60") SketchLine_46.result().setName("SketchLine_60") SketchLine_47 = Sketch_5.addLine(150.8, -37.04999053274702, 150.8, -45.04999053274702) SketchLine_47.setName("SketchLine_49") SketchLine_47.result().setName("SketchLine_49") SketchLine_47.setAuxiliary(True) -SketchConstraintCoincidence_56 = Sketch_5.setCoincident(SketchLine_47.endPoint(), SketchLine_43.startPoint()) +SketchConstraintCoincidence_56 = Sketch_5.setCoincident( + SketchLine_47.endPoint(), SketchLine_43.startPoint() +) SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_61") -SketchConstraintCoincidence_57 = Sketch_5.setCoincident(SketchLine_43.endPoint(), SketchLine_44.startPoint()) +SketchConstraintCoincidence_57 = Sketch_5.setCoincident( + SketchLine_43.endPoint(), SketchLine_44.startPoint() +) SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_62") SketchLine_48 = Sketch_5.addLine(153.5, -37.04999053274702, 150.8, -37.04999053274702) SketchLine_48.setAuxiliary(True) -SketchConstraintCoincidence_58 = Sketch_5.setCoincident(SketchLine_44.endPoint(), SketchLine_48.startPoint()) +SketchConstraintCoincidence_58 = Sketch_5.setCoincident( + SketchLine_44.endPoint(), SketchLine_48.startPoint() +) SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_63") -SketchConstraintCoincidence_59 = Sketch_5.setCoincident(SketchLine_48.endPoint(), SketchLine_47.startPoint()) +SketchConstraintCoincidence_59 = Sketch_5.setCoincident( + SketchLine_48.endPoint(), SketchLine_47.startPoint() +) SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_64") SketchConstraintHorizontal_11 = Sketch_5.setHorizontal(SketchLine_43.result()) SketchConstraintVertical_9 = Sketch_5.setVertical(SketchLine_44.result()) SketchConstraintHorizontal_12 = Sketch_5.setHorizontal(SketchLine_48.result()) SketchConstraintVertical_10 = Sketch_5.setVertical(SketchLine_47.result()) -SketchLine_49 = Sketch_5.addLine(153.5, -37.04999053274702, 152.2999989299055, -37.04999053274738) +SketchLine_49 = Sketch_5.addLine( + 153.5, -37.04999053274702, 152.2999989299055, -37.04999053274738 +) SketchLine_49.setName("SketchLine_62") SketchLine_49.result().setName("SketchLine_62") SketchLine_50 = Sketch_5.addLine(150.8, -38.54997391988981, 150.8, -43.54998998548124) @@ -344,132 +603,287 @@ SketchLine_51 = Sketch_5.addLine(150.8, -21.04999053274714, 153.5, -21.049990532 SketchLine_51.setName("SketchLine_50") SketchLine_51.result().setName("SketchLine_50") SketchLine_51.setAuxiliary(True) -SketchConstraintCoincidence_60 = Sketch_5.setCoincident(SketchLine_51.endPoint(), SketchLine_42.result()) +SketchConstraintCoincidence_60 = Sketch_5.setCoincident( + SketchLine_51.endPoint(), SketchLine_42.result() +) SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_65") SketchLine_52 = Sketch_5.addLine(153.5, -21.04999053274714, 153.5, -13.04999053274714) SketchLine_52.setName("SketchLine_51") SketchLine_52.result().setName("SketchLine_51") SketchLine_53 = Sketch_5.addLine(150.8, -13.04999053274714, 150.8, -21.04999053274714) SketchLine_53.setAuxiliary(True) -SketchConstraintCoincidence_61 = Sketch_5.setCoincident(SketchLine_53.endPoint(), SketchLine_51.startPoint()) +SketchConstraintCoincidence_61 = Sketch_5.setCoincident( + SketchLine_53.endPoint(), SketchLine_51.startPoint() +) SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_66") -SketchConstraintCoincidence_62 = Sketch_5.setCoincident(SketchLine_51.endPoint(), SketchLine_52.startPoint()) +SketchConstraintCoincidence_62 = Sketch_5.setCoincident( + SketchLine_51.endPoint(), SketchLine_52.startPoint() +) SketchConstraintCoincidence_62.setName("SketchConstraintCoincidence_67") SketchLine_54 = Sketch_5.addLine(153.5, -13.04999053274714, 150.8, -13.04999053274714) SketchLine_54.setName("SketchLine_52") SketchLine_54.result().setName("SketchLine_52") SketchLine_54.setAuxiliary(True) -SketchConstraintCoincidence_63 = Sketch_5.setCoincident(SketchLine_52.endPoint(), SketchLine_54.startPoint()) +SketchConstraintCoincidence_63 = Sketch_5.setCoincident( + SketchLine_52.endPoint(), SketchLine_54.startPoint() +) SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_68") -SketchConstraintCoincidence_64 = Sketch_5.setCoincident(SketchLine_54.endPoint(), SketchLine_53.startPoint()) +SketchConstraintCoincidence_64 = Sketch_5.setCoincident( + SketchLine_54.endPoint(), SketchLine_53.startPoint() +) SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_69") SketchConstraintHorizontal_13 = Sketch_5.setHorizontal(SketchLine_51.result()) SketchConstraintVertical_11 = Sketch_5.setVertical(SketchLine_52.result()) SketchConstraintHorizontal_14 = Sketch_5.setHorizontal(SketchLine_54.result()) SketchConstraintVertical_12 = Sketch_5.setVertical(SketchLine_53.result()) -SketchConstraintCoincidence_65 = Sketch_5.setCoincident(SketchLine_47.result(), SketchLine_53.endPoint()) +SketchConstraintCoincidence_65 = Sketch_5.setCoincident( + SketchLine_47.result(), SketchLine_53.endPoint() +) SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_70") SketchConstraintLength_8 = Sketch_5.setLength(SketchLine_43.result(), 2.7) SketchConstraintLength_8.setName("SketchConstraintLength_9") SketchConstraintLength_9 = Sketch_5.setLength(SketchLine_44.result(), 8) SketchConstraintLength_9.setName("SketchConstraintLength_10") -SketchConstraintEqual_4 = Sketch_5.setEqual(SketchLine_47.result(), SketchLine_53.result()) +SketchConstraintEqual_4 = Sketch_5.setEqual( + SketchLine_47.result(), SketchLine_53.result() +) SketchPoint_5 = Sketch_5.addPoint(153.5, -28.85) SketchPoint_5.setName("SketchPoint_7") SketchPoint_5.result().setName("SketchPoint_7") -SketchConstraintMiddle_1 = Sketch_5.setMiddlePoint(SketchPoint_5.coordinates(), SketchLine_42.result()) +SketchConstraintMiddle_1 = Sketch_5.setMiddlePoint( + SketchPoint_5.coordinates(), SketchLine_42.result() +) SketchLine_55 = Sketch_5.addLine(153.5, -28.85, -153.5, -28.85) SketchLine_55.setName("SketchLine_54") SketchLine_55.result().setName("SketchLine_54") SketchLine_55.setAuxiliary(True) -SketchConstraintCoincidence_66 = Sketch_5.setCoincident(SketchPoint_5.coordinates(), SketchLine_55.startPoint()) +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/Modified_Face&Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_10]")) +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()) +SketchConstraintCoincidence_67 = Sketch_5.setCoincident( + SketchLine_55.endPoint(), SketchLine_56.result() +) SketchConstraintCoincidence_67.setName("SketchConstraintCoincidence_72") SketchConstraintHorizontal_15 = Sketch_5.setHorizontal(SketchLine_55.result()) -SketchConstraintDistance_8 = Sketch_5.setDistance(SketchLine_48.result(), SketchPoint_5.coordinates(), 8.2) -SketchConstraintDistance_9 = Sketch_5.setDistance(SketchLine_51.result(), SketchPoint_5.coordinates(), 7.8) -SketchArc_3 = Sketch_5.addArc(152.3, -43.54999053274682, 150.8, -43.54998998548124, 152.2999838292651, -45.04999053274704, False) +SketchConstraintDistance_8 = Sketch_5.setDistance( + SketchLine_48.result(), SketchPoint_5.coordinates(), 8.2 +) +SketchConstraintDistance_9 = Sketch_5.setDistance( + SketchLine_51.result(), SketchPoint_5.coordinates(), 7.8 +) +SketchArc_3 = Sketch_5.addArc( + 152.3, + -43.54999053274682, + 150.8, + -43.54998998548124, + 152.2999838292651, + -45.04999053274704, + False, +) SketchLine_57 = Sketch_5.addLine(150.8, -37.04999053274702, 150.8, -43.54998998548124) SketchLine_57.setName("SketchLine_56") SketchLine_57.result().setName("SketchLine_56") SketchLine_57.setAuxiliary(True) -SketchConstraintCoincidence_68 = Sketch_5.setCoincident(SketchArc_3.startPoint(), SketchLine_57.endPoint()) +SketchConstraintCoincidence_68 = Sketch_5.setCoincident( + SketchArc_3.startPoint(), SketchLine_57.endPoint() +) SketchConstraintCoincidence_68.setName("SketchConstraintCoincidence_73") -SketchConstraintCoincidence_69 = Sketch_5.setCoincident(SketchArc_3.endPoint(), SketchLine_41.startPoint()) +SketchConstraintCoincidence_69 = Sketch_5.setCoincident( + SketchArc_3.endPoint(), SketchLine_41.startPoint() +) SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_74") -SketchConstraintTangent_5 = Sketch_5.setTangent(SketchArc_3.results()[1], SketchLine_57.result()) -SketchConstraintTangent_6 = Sketch_5.setTangent(SketchArc_3.results()[1], SketchLine_41.result()) -SketchConstraintCoincidence_70 = Sketch_5.setCoincident(SketchLine_47.startPoint(), SketchLine_57.startPoint()) +SketchConstraintTangent_5 = Sketch_5.setTangent( + SketchArc_3.results()[1], SketchLine_57.result() +) +SketchConstraintTangent_6 = Sketch_5.setTangent( + SketchArc_3.results()[1], SketchLine_41.result() +) +SketchConstraintCoincidence_70 = Sketch_5.setCoincident( + SketchLine_47.startPoint(), SketchLine_57.startPoint() +) SketchConstraintCoincidence_70.setName("SketchConstraintCoincidence_75") -SketchConstraintCoincidence_71 = Sketch_5.setCoincident(SketchLine_43.endPoint(), SketchLine_41.endPoint()) +SketchConstraintCoincidence_71 = Sketch_5.setCoincident( + SketchLine_43.endPoint(), SketchLine_41.endPoint() +) SketchConstraintCoincidence_71.setName("SketchConstraintCoincidence_76") -SketchConstraintCoincidence_72 = Sketch_5.setCoincident(SketchLine_57.endPoint(), SketchLine_47.result()) +SketchConstraintCoincidence_72 = Sketch_5.setCoincident( + SketchLine_57.endPoint(), SketchLine_47.result() +) SketchConstraintCoincidence_72.setName("SketchConstraintCoincidence_77") -SketchConstraintCoincidence_73 = Sketch_5.setCoincident(SketchLine_41.startPoint(), SketchLine_43.result()) +SketchConstraintCoincidence_73 = Sketch_5.setCoincident( + SketchLine_41.startPoint(), SketchLine_43.result() +) SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_78") -SketchArc_4 = Sketch_5.addArc(152.3, -19.54999053274696, 150.8, -19.54999029833178, 152.2999838762584, -21.04999053274691, False) +SketchArc_4 = Sketch_5.addArc( + 152.3, + -19.54999053274696, + 150.8, + -19.54999029833178, + 152.2999838762584, + -21.04999053274691, + False, +) SketchLine_58 = Sketch_5.addLine(150.8, -13.04999053274714, 150.8, -19.54999029833178) SketchLine_58.setName("SketchLine_59") SketchLine_58.result().setName("SketchLine_59") SketchLine_58.setAuxiliary(True) -SketchConstraintCoincidence_74 = Sketch_5.setCoincident(SketchArc_4.startPoint(), SketchLine_58.endPoint()) +SketchConstraintCoincidence_74 = Sketch_5.setCoincident( + SketchArc_4.startPoint(), SketchLine_58.endPoint() +) SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_79") -SketchConstraintCoincidence_75 = Sketch_5.setCoincident(SketchArc_4.endPoint(), SketchLine_40.startPoint()) +SketchConstraintCoincidence_75 = Sketch_5.setCoincident( + SketchArc_4.endPoint(), SketchLine_40.startPoint() +) SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_80") -SketchConstraintTangent_7 = Sketch_5.setTangent(SketchArc_4.results()[1], SketchLine_40.result()) -SketchConstraintTangent_8 = Sketch_5.setTangent(SketchArc_4.results()[1], SketchLine_58.result()) -SketchConstraintCoincidence_76 = Sketch_5.setCoincident(SketchLine_51.endPoint(), SketchLine_40.endPoint()) +SketchConstraintTangent_7 = Sketch_5.setTangent( + SketchArc_4.results()[1], SketchLine_40.result() +) +SketchConstraintTangent_8 = Sketch_5.setTangent( + SketchArc_4.results()[1], SketchLine_58.result() +) +SketchConstraintCoincidence_76 = Sketch_5.setCoincident( + SketchLine_51.endPoint(), SketchLine_40.endPoint() +) SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_81") -SketchConstraintCoincidence_77 = Sketch_5.setCoincident(SketchLine_53.startPoint(), SketchLine_58.startPoint()) +SketchConstraintCoincidence_77 = Sketch_5.setCoincident( + SketchLine_53.startPoint(), SketchLine_58.startPoint() +) SketchConstraintCoincidence_77.setName("SketchConstraintCoincidence_82") -SketchConstraintCoincidence_78 = Sketch_5.setCoincident(SketchLine_40.startPoint(), SketchLine_51.result()) +SketchConstraintCoincidence_78 = Sketch_5.setCoincident( + SketchLine_40.startPoint(), SketchLine_51.result() +) SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_83") -SketchConstraintCoincidence_79 = Sketch_5.setCoincident(SketchLine_58.endPoint(), SketchLine_53.result()) +SketchConstraintCoincidence_79 = Sketch_5.setCoincident( + SketchLine_58.endPoint(), SketchLine_53.result() +) SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_84") -SketchArc_5 = Sketch_5.addArc(152.3, -14.54999053274707, 152.2999838654776, -13.04999053274697, 150.8, -14.54997391609652, False) -SketchConstraintCoincidence_80 = Sketch_5.setCoincident(SketchArc_5.startPoint(), SketchLine_46.endPoint()) +SketchArc_5 = Sketch_5.addArc( + 152.3, + -14.54999053274707, + 152.2999838654776, + -13.04999053274697, + 150.8, + -14.54997391609652, + False, +) +SketchConstraintCoincidence_80 = Sketch_5.setCoincident( + SketchArc_5.startPoint(), SketchLine_46.endPoint() +) SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_85") -SketchConstraintCoincidence_81 = Sketch_5.setCoincident(SketchArc_5.endPoint(), SketchLine_45.startPoint()) +SketchConstraintCoincidence_81 = Sketch_5.setCoincident( + SketchArc_5.endPoint(), SketchLine_45.startPoint() +) SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_86") -SketchConstraintTangent_9 = Sketch_5.setTangent(SketchArc_5.results()[1], SketchLine_46.result()) -SketchConstraintTangent_10 = Sketch_5.setTangent(SketchArc_5.results()[1], SketchLine_45.result()) -SketchConstraintCoincidence_82 = Sketch_5.setCoincident(SketchLine_54.startPoint(), SketchLine_46.startPoint()) +SketchConstraintTangent_9 = Sketch_5.setTangent( + SketchArc_5.results()[1], SketchLine_46.result() +) +SketchConstraintTangent_10 = Sketch_5.setTangent( + SketchArc_5.results()[1], SketchLine_45.result() +) +SketchConstraintCoincidence_82 = Sketch_5.setCoincident( + SketchLine_54.startPoint(), SketchLine_46.startPoint() +) SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_87") -SketchConstraintCoincidence_83 = Sketch_5.setCoincident(SketchLine_58.endPoint(), SketchLine_45.endPoint()) +SketchConstraintCoincidence_83 = Sketch_5.setCoincident( + SketchLine_58.endPoint(), SketchLine_45.endPoint() +) SketchConstraintCoincidence_83.setName("SketchConstraintCoincidence_88") -SketchConstraintCoincidence_84 = Sketch_5.setCoincident(SketchLine_46.endPoint(), SketchLine_54.result()) +SketchConstraintCoincidence_84 = Sketch_5.setCoincident( + SketchLine_46.endPoint(), SketchLine_54.result() +) SketchConstraintCoincidence_84.setName("SketchConstraintCoincidence_89") -SketchConstraintCoincidence_85 = Sketch_5.setCoincident(SketchLine_45.startPoint(), SketchLine_58.result()) +SketchConstraintCoincidence_85 = Sketch_5.setCoincident( + SketchLine_45.startPoint(), SketchLine_58.result() +) SketchConstraintCoincidence_85.setName("SketchConstraintCoincidence_90") -SketchArc_6 = Sketch_5.addArc(152.3, -38.54999053274739, 152.2999989299055, -37.04999053274738, 150.8, -38.54997391988981, False) -SketchConstraintCoincidence_86 = Sketch_5.setCoincident(SketchArc_6.startPoint(), SketchLine_49.endPoint()) +SketchArc_6 = Sketch_5.addArc( + 152.3, + -38.54999053274739, + 152.2999989299055, + -37.04999053274738, + 150.8, + -38.54997391988981, + False, +) +SketchConstraintCoincidence_86 = Sketch_5.setCoincident( + SketchArc_6.startPoint(), SketchLine_49.endPoint() +) SketchConstraintCoincidence_86.setName("SketchConstraintCoincidence_91") -SketchConstraintCoincidence_87 = Sketch_5.setCoincident(SketchArc_6.endPoint(), SketchLine_50.startPoint()) +SketchConstraintCoincidence_87 = Sketch_5.setCoincident( + SketchArc_6.endPoint(), SketchLine_50.startPoint() +) SketchConstraintCoincidence_87.setName("SketchConstraintCoincidence_92") -SketchConstraintTangent_11 = Sketch_5.setTangent(SketchArc_6.results()[1], SketchLine_49.result()) -SketchConstraintTangent_12 = Sketch_5.setTangent(SketchArc_6.results()[1], SketchLine_50.result()) -SketchConstraintCoincidence_88 = Sketch_5.setCoincident(SketchLine_48.startPoint(), SketchLine_49.startPoint()) +SketchConstraintTangent_11 = Sketch_5.setTangent( + SketchArc_6.results()[1], SketchLine_49.result() +) +SketchConstraintTangent_12 = Sketch_5.setTangent( + SketchArc_6.results()[1], SketchLine_50.result() +) +SketchConstraintCoincidence_88 = Sketch_5.setCoincident( + SketchLine_48.startPoint(), SketchLine_49.startPoint() +) SketchConstraintCoincidence_88.setName("SketchConstraintCoincidence_93") -SketchConstraintCoincidence_89 = Sketch_5.setCoincident(SketchLine_57.endPoint(), SketchLine_50.endPoint()) +SketchConstraintCoincidence_89 = Sketch_5.setCoincident( + SketchLine_57.endPoint(), SketchLine_50.endPoint() +) SketchConstraintCoincidence_89.setName("SketchConstraintCoincidence_94") -SketchConstraintCoincidence_90 = Sketch_5.setCoincident(SketchLine_49.endPoint(), SketchLine_48.result()) +SketchConstraintCoincidence_90 = Sketch_5.setCoincident( + SketchLine_49.endPoint(), SketchLine_48.result() +) SketchConstraintCoincidence_90.setName("SketchConstraintCoincidence_95") -SketchConstraintCoincidence_91 = Sketch_5.setCoincident(SketchLine_50.startPoint(), SketchLine_57.result()) +SketchConstraintCoincidence_91 = Sketch_5.setCoincident( + SketchLine_50.startPoint(), SketchLine_57.result() +) SketchConstraintCoincidence_91.setName("SketchConstraintCoincidence_96") SketchConstraintRadius_4 = Sketch_5.setRadius(SketchArc_3.results()[1], 1.5) -SketchConstraintEqual_5 = Sketch_5.setEqual(SketchArc_6.results()[1], SketchArc_3.results()[1]) -SketchConstraintEqual_6 = Sketch_5.setEqual(SketchArc_3.results()[1], SketchArc_4.results()[1]) -SketchConstraintEqual_7 = Sketch_5.setEqual(SketchArc_4.results()[1], SketchArc_5.results()[1]) +SketchConstraintEqual_5 = Sketch_5.setEqual( + SketchArc_6.results()[1], SketchArc_3.results()[1] +) +SketchConstraintEqual_6 = Sketch_5.setEqual( + SketchArc_3.results()[1], SketchArc_4.results()[1] +) +SketchConstraintEqual_7 = Sketch_5.setEqual( + SketchArc_4.results()[1], SketchArc_5.results()[1] +) SketchLine_59 = Sketch_5.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_59.setName("SketchLine_64") SketchLine_59.result().setName("SketchLine_64") -SketchConstraintMirror_3_objects = [SketchArc_3.results()[1], SketchArc_6.results()[1], SketchLine_49.result(), SketchLine_50.result(), SketchLine_44.result(), SketchLine_41.result(), SketchLine_43.result(), SketchLine_57.result(), SketchLine_48.result(), SketchLine_47.result()] -SketchConstraintMirror_3 = Sketch_5.addMirror(SketchLine_59.result(), SketchConstraintMirror_3_objects) -[SketchArc_7, SketchArc_8, SketchLine_60, SketchLine_61, SketchLine_62, SketchLine_63, SketchLine_64, SketchLine_65, SketchLine_66, SketchLine_67] = SketchConstraintMirror_3.mirrored() +SketchConstraintMirror_3_objects = [ + SketchArc_3.results()[1], + SketchArc_6.results()[1], + SketchLine_49.result(), + SketchLine_50.result(), + SketchLine_44.result(), + SketchLine_41.result(), + SketchLine_43.result(), + SketchLine_57.result(), + SketchLine_48.result(), + SketchLine_47.result(), +] +SketchConstraintMirror_3 = Sketch_5.addMirror( + SketchLine_59.result(), SketchConstraintMirror_3_objects +) +[ + SketchArc_7, + SketchArc_8, + SketchLine_60, + SketchLine_61, + SketchLine_62, + SketchLine_63, + SketchLine_64, + SketchLine_65, + SketchLine_66, + SketchLine_67, +] = SketchConstraintMirror_3.mirrored() SketchLine_67.setName("SketchLine_72") SketchLine_67.result().setName("SketchLine_72") SketchLine_66.setName("SketchLine_71") @@ -486,9 +900,33 @@ SketchLine_61.setName("SketchLine_66") SketchLine_61.result().setName("SketchLine_66") SketchLine_60.setName("SketchLine_65") SketchLine_60.result().setName("SketchLine_65") -SketchConstraintMirror_4_objects = [SketchArc_4.results()[1], SketchArc_5.results()[1], SketchLine_52.result(), SketchLine_45.result(), SketchLine_46.result(), SketchLine_40.result(), SketchLine_54.result(), SketchLine_58.result(), SketchLine_51.result(), SketchLine_53.result()] -SketchConstraintMirror_4 = Sketch_5.addMirror(SketchLine_59.result(), SketchConstraintMirror_4_objects) -[SketchArc_9, SketchArc_10, SketchLine_68, SketchLine_69, SketchLine_70, SketchLine_71, SketchLine_72, SketchLine_73, SketchLine_74, SketchLine_75] = SketchConstraintMirror_4.mirrored() +SketchConstraintMirror_4_objects = [ + SketchArc_4.results()[1], + SketchArc_5.results()[1], + SketchLine_52.result(), + SketchLine_45.result(), + SketchLine_46.result(), + SketchLine_40.result(), + SketchLine_54.result(), + SketchLine_58.result(), + SketchLine_51.result(), + SketchLine_53.result(), +] +SketchConstraintMirror_4 = Sketch_5.addMirror( + SketchLine_59.result(), SketchConstraintMirror_4_objects +) +[ + SketchArc_9, + SketchArc_10, + SketchLine_68, + SketchLine_69, + SketchLine_70, + SketchLine_71, + SketchLine_72, + SketchLine_73, + SketchLine_74, + SketchLine_75, +] = SketchConstraintMirror_4.mirrored() SketchLine_75.setName("SketchLine_80") SketchLine_75.result().setName("SketchLine_80") SketchLine_74.setName("SketchLine_79") @@ -508,9 +946,32 @@ SketchLine_68.result().setName("SketchLine_73") model.do() Sketch_5.setName("Sketch_6") Sketch_5.result().setName("Sketch_6") -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")) +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) @@ -520,70 +981,116 @@ SketchArc_13.results()[1].setName("SketchArc_14_2") SketchLine_76 = Sketch_6.addLine(6.89, -23.55, 43.89, -23.55) SketchLine_76.setName("SketchLine_81") SketchLine_76.result().setName("SketchLine_81") -SketchConstraintCoincidence_92 = Sketch_6.setCoincident(SketchArc_11.startPoint(), SketchLine_76.endPoint()) +SketchConstraintCoincidence_92 = Sketch_6.setCoincident( + SketchArc_11.startPoint(), SketchLine_76.endPoint() +) SketchConstraintCoincidence_92.setName("SketchConstraintCoincidence_98") SketchLine_77 = Sketch_6.addLine(6.89, -13.55, 43.89, -13.55) SketchLine_77.setName("SketchLine_82") SketchLine_77.result().setName("SketchLine_82") -SketchConstraintCoincidence_93 = Sketch_6.setCoincident(SketchArc_13.startPoint(), SketchLine_77.startPoint()) +SketchConstraintCoincidence_93 = Sketch_6.setCoincident( + SketchArc_13.startPoint(), SketchLine_77.startPoint() +) SketchConstraintCoincidence_93.setName("SketchConstraintCoincidence_99") SketchLine_78 = Sketch_6.addLine(44.89, -22.55, 44.89, -14.55) SketchLine_78.setName("SketchLine_83") SketchLine_78.result().setName("SketchLine_83") -SketchConstraintCoincidence_94 = Sketch_6.setCoincident(SketchArc_12.startPoint(), SketchLine_78.endPoint()) +SketchConstraintCoincidence_94 = Sketch_6.setCoincident( + SketchArc_12.startPoint(), SketchLine_78.endPoint() +) SketchConstraintCoincidence_94.setName("SketchConstraintCoincidence_100") SketchLine_79 = Sketch_6.addLine(5.89, -22.55, 5.89, -14.55) SketchLine_79.setName("SketchLine_84") SketchLine_79.result().setName("SketchLine_84") -SketchConstraintCoincidence_95 = Sketch_6.setCoincident(SketchArc_13.endPoint(), SketchLine_79.endPoint()) +SketchConstraintCoincidence_95 = Sketch_6.setCoincident( + SketchArc_13.endPoint(), SketchLine_79.endPoint() +) SketchConstraintCoincidence_95.setName("SketchConstraintCoincidence_101") SketchConstraintHorizontal_16 = Sketch_6.setHorizontal(SketchLine_76.result()) SketchConstraintHorizontal_17 = Sketch_6.setHorizontal(SketchLine_77.result()) SketchConstraintVertical_13 = Sketch_6.setVertical(SketchLine_79.result()) SketchConstraintVertical_14 = Sketch_6.setVertical(SketchLine_78.result()) -SketchConstraintCoincidence_96 = Sketch_6.setCoincident(SketchArc_11.endPoint(), SketchLine_78.startPoint()) +SketchConstraintCoincidence_96 = Sketch_6.setCoincident( + SketchArc_11.endPoint(), SketchLine_78.startPoint() +) SketchConstraintCoincidence_96.setName("SketchConstraintCoincidence_102") -SketchConstraintCoincidence_97 = Sketch_6.setCoincident(SketchArc_12.endPoint(), SketchLine_77.endPoint()) +SketchConstraintCoincidence_97 = Sketch_6.setCoincident( + SketchArc_12.endPoint(), SketchLine_77.endPoint() +) SketchConstraintCoincidence_97.setName("SketchConstraintCoincidence_104") -SketchConstraintCoincidence_98 = Sketch_6.setCoincident(SketchArc_11.center(), SketchLine_78.result()) +SketchConstraintCoincidence_98 = Sketch_6.setCoincident( + SketchArc_11.center(), SketchLine_78.result() +) SketchConstraintCoincidence_98.setName("SketchConstraintCoincidence_105") -SketchConstraintCoincidence_99 = Sketch_6.setCoincident(SketchArc_11.center(), SketchLine_76.result()) +SketchConstraintCoincidence_99 = Sketch_6.setCoincident( + SketchArc_11.center(), SketchLine_76.result() +) SketchConstraintCoincidence_99.setName("SketchConstraintCoincidence_106") SketchConstraintRadius_5 = Sketch_6.setRadius(SketchArc_11.results()[1], 1) -SketchConstraintCoincidence_100 = Sketch_6.setCoincident(SketchArc_12.center(), SketchLine_78.result()) +SketchConstraintCoincidence_100 = Sketch_6.setCoincident( + SketchArc_12.center(), SketchLine_78.result() +) SketchConstraintCoincidence_100.setName("SketchConstraintCoincidence_107") -SketchConstraintCoincidence_101 = Sketch_6.setCoincident(SketchArc_12.center(), SketchLine_77.result()) +SketchConstraintCoincidence_101 = Sketch_6.setCoincident( + SketchArc_12.center(), SketchLine_77.result() +) SketchConstraintCoincidence_101.setName("SketchConstraintCoincidence_108") -SketchConstraintCoincidence_102 = Sketch_6.setCoincident(SketchArc_13.center(), SketchLine_77.result()) +SketchConstraintCoincidence_102 = Sketch_6.setCoincident( + SketchArc_13.center(), SketchLine_77.result() +) SketchConstraintCoincidence_102.setName("SketchConstraintCoincidence_109") -SketchConstraintEqual_8 = Sketch_6.setEqual(SketchArc_11.results()[1], SketchArc_12.results()[1]) -SketchConstraintEqual_9 = Sketch_6.setEqual(SketchArc_13.results()[1], SketchArc_11.results()[1]) +SketchConstraintEqual_8 = Sketch_6.setEqual( + SketchArc_11.results()[1], SketchArc_12.results()[1] +) +SketchConstraintEqual_9 = Sketch_6.setEqual( + SketchArc_13.results()[1], SketchArc_11.results()[1] +) SketchConstraintEqual_9.setName("SketchConstraintEqual_10") -SketchConstraintCoincidence_103 = Sketch_6.setCoincident(SketchArc_13.center(), SketchLine_79.result()) +SketchConstraintCoincidence_103 = Sketch_6.setCoincident( + SketchArc_13.center(), SketchLine_79.result() +) SketchConstraintCoincidence_103.setName("SketchConstraintCoincidence_112") -SketchConstraintDistance_10 = Sketch_6.setDistance(SketchLine_76.result(), SketchArc_13.startPoint(), 10) -SketchConstraintDistance_11 = Sketch_6.setDistance(SketchLine_79.startPoint(), SketchLine_78.result(), 39) +SketchConstraintDistance_10 = Sketch_6.setDistance( + SketchLine_76.result(), SketchArc_13.startPoint(), 10 +) +SketchConstraintDistance_11 = Sketch_6.setDistance( + SketchLine_79.startPoint(), SketchLine_78.result(), 39 +) 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) +SketchConstraintDistance_12 = Sketch_6.setDistance( + SketchLine_79.startPoint(), SketchLine_80.result(), 5.89 +) 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) +SketchConstraintDistance_13 = Sketch_6.setDistance( + SketchLine_76.endPoint(), SketchLine_81.result(), 5.3 +) SketchArc_14 = Sketch_6.addArc(5.89, -23.55, 5.89, -22.55, 6.89, -23.55, False) SketchArc_14.setName("SketchArc_15") SketchArc_14.result().setName("SketchArc_15") SketchArc_14.results()[1].setName("SketchArc_15_2") -SketchConstraintCoincidence_104 = Sketch_6.setCoincident(SketchLine_79.startPoint(), SketchArc_14.startPoint()) +SketchConstraintCoincidence_104 = Sketch_6.setCoincident( + SketchLine_79.startPoint(), SketchArc_14.startPoint() +) SketchConstraintCoincidence_104.setName("SketchConstraintCoincidence_110") -SketchConstraintCoincidence_105 = Sketch_6.setCoincident(SketchArc_14.endPoint(), SketchLine_76.startPoint()) +SketchConstraintCoincidence_105 = Sketch_6.setCoincident( + SketchArc_14.endPoint(), SketchLine_76.startPoint() +) SketchConstraintCoincidence_105.setName("SketchConstraintCoincidence_111") -SketchConstraintCoincidence_106 = Sketch_6.setCoincident(SketchArc_14.center(), SketchLine_76.result()) +SketchConstraintCoincidence_106 = Sketch_6.setCoincident( + SketchArc_14.center(), SketchLine_76.result() +) SketchConstraintCoincidence_106.setName("SketchConstraintCoincidence_113") -SketchConstraintCoincidence_107 = Sketch_6.setCoincident(SketchArc_14.center(), SketchLine_79.result()) +SketchConstraintCoincidence_107 = Sketch_6.setCoincident( + SketchArc_14.center(), SketchLine_79.result() +) SketchConstraintCoincidence_107.setName("SketchConstraintCoincidence_114") -SketchConstraintEqual_10 = Sketch_6.setEqual(SketchArc_11.results()[1], SketchArc_14.results()[1]) +SketchConstraintEqual_10 = Sketch_6.setEqual( + SketchArc_11.results()[1], SketchArc_14.results()[1] +) SketchConstraintEqual_10.setName("SketchConstraintEqual_11") SketchPoint_6 = Sketch_6.addPoint(0, -28.85) SketchPoint_6.setName("SketchPoint_8") @@ -594,19 +1101,54 @@ SketchPoint_7.result().setName("SketchPoint_9") SketchPoint_8 = Sketch_6.addPoint(101.54, -28.85) SketchPoint_8.setName("SketchPoint_10") SketchPoint_8.result().setName("SketchPoint_10") -SketchConstraintCoincidence_108 = Sketch_6.setCoincident(SketchLine_80.result(), SketchPoint_6.coordinates()) +SketchConstraintCoincidence_108 = Sketch_6.setCoincident( + SketchLine_80.result(), SketchPoint_6.coordinates() +) SketchConstraintCoincidence_108.setName("SketchConstraintCoincidence_115") -SketchConstraintCoincidence_109 = Sketch_6.setCoincident(SketchLine_81.result(), SketchPoint_6.coordinates()) +SketchConstraintCoincidence_109 = Sketch_6.setCoincident( + SketchLine_81.result(), SketchPoint_6.coordinates() +) SketchConstraintCoincidence_109.setName("SketchConstraintCoincidence_116") -SketchConstraintCoincidence_110 = Sketch_6.setCoincident(SketchPoint_7.coordinates(), SketchLine_81.result()) +SketchConstraintCoincidence_110 = Sketch_6.setCoincident( + SketchPoint_7.coordinates(), SketchLine_81.result() +) SketchConstraintCoincidence_110.setName("SketchConstraintCoincidence_117") -SketchConstraintCoincidence_111 = Sketch_6.setCoincident(SketchPoint_8.coordinates(), SketchLine_81.result()) +SketchConstraintCoincidence_111 = Sketch_6.setCoincident( + SketchPoint_8.coordinates(), SketchLine_81.result() +) SketchConstraintCoincidence_111.setName("SketchConstraintCoincidence_118") -SketchConstraintDistance_14 = Sketch_6.setDistance(SketchPoint_7.coordinates(), SketchLine_80.result(), "56.66-5.89") -SketchConstraintDistance_15 = Sketch_6.setDistance(SketchLine_80.result(), SketchPoint_8.coordinates(), "107.43-5.89") -SketchMultiTranslation_1_objects = [SketchArc_13.results()[1], SketchArc_14.results()[1], SketchArc_12.results()[1], SketchArc_11.results()[1], SketchLine_78.result(), SketchLine_76.result(), SketchLine_77.result(), SketchLine_79.result()] -SketchMultiTranslation_1 = Sketch_6.addTranslation(SketchMultiTranslation_1_objects, SketchPoint_6.coordinates(), SketchPoint_7.coordinates(), 2) -[SketchArc_15, SketchArc_16, SketchArc_17, SketchArc_18, SketchLine_82, SketchLine_83, SketchLine_84, SketchLine_85] = SketchMultiTranslation_1.translated() +SketchConstraintDistance_14 = Sketch_6.setDistance( + SketchPoint_7.coordinates(), SketchLine_80.result(), "56.66-5.89" +) +SketchConstraintDistance_15 = Sketch_6.setDistance( + SketchLine_80.result(), SketchPoint_8.coordinates(), "107.43-5.89" +) +SketchMultiTranslation_1_objects = [ + SketchArc_13.results()[1], + SketchArc_14.results()[1], + SketchArc_12.results()[1], + SketchArc_11.results()[1], + SketchLine_78.result(), + SketchLine_76.result(), + SketchLine_77.result(), + SketchLine_79.result(), +] +SketchMultiTranslation_1 = Sketch_6.addTranslation( + SketchMultiTranslation_1_objects, + SketchPoint_6.coordinates(), + SketchPoint_7.coordinates(), + 2, +) +[ + SketchArc_15, + SketchArc_16, + SketchArc_17, + SketchArc_18, + SketchLine_82, + SketchLine_83, + SketchLine_84, + SketchLine_85, +] = SketchMultiTranslation_1.translated() SketchLine_85.setName("SketchLine_90") SketchLine_85.result().setName("SketchLine_90") SketchLine_84.setName("SketchLine_89") @@ -627,9 +1169,32 @@ SketchArc_16.results()[1].setName("SketchArc_17_2") SketchArc_15.setName("SketchArc_16") SketchArc_15.result().setName("SketchArc_16") SketchArc_15.results()[1].setName("SketchArc_16_2") -SketchMultiTranslation_2_objects = [SketchArc_12.results()[1], SketchArc_13.results()[1], SketchArc_11.results()[1], SketchArc_14.results()[1], SketchLine_79.result(), SketchLine_78.result(), SketchLine_77.result(), SketchLine_76.result()] -SketchMultiTranslation_2 = Sketch_6.addTranslation(SketchMultiTranslation_2_objects, SketchPoint_6.coordinates(), SketchPoint_8.coordinates(), 2) -[SketchArc_19, SketchArc_20, SketchArc_21, SketchArc_22, SketchLine_86, SketchLine_87, SketchLine_88, SketchLine_89] = SketchMultiTranslation_2.translated() +SketchMultiTranslation_2_objects = [ + SketchArc_12.results()[1], + SketchArc_13.results()[1], + SketchArc_11.results()[1], + SketchArc_14.results()[1], + SketchLine_79.result(), + SketchLine_78.result(), + SketchLine_77.result(), + SketchLine_76.result(), +] +SketchMultiTranslation_2 = Sketch_6.addTranslation( + SketchMultiTranslation_2_objects, + SketchPoint_6.coordinates(), + SketchPoint_8.coordinates(), + 2, +) +[ + SketchArc_19, + SketchArc_20, + SketchArc_21, + SketchArc_22, + SketchLine_86, + SketchLine_87, + SketchLine_88, + SketchLine_89, +] = SketchMultiTranslation_2.translated() SketchLine_89.setName("SketchLine_94") SketchLine_89.result().setName("SketchLine_94") SketchLine_88.setName("SketchLine_93") @@ -650,9 +1215,61 @@ SketchArc_20.results()[1].setName("SketchArc_21_2") SketchArc_19.setName("SketchArc_20") SketchArc_19.result().setName("SketchArc_20") SketchArc_19.results()[1].setName("SketchArc_20_2") -SketchConstraintMirror_5_objects = [SketchArc_18.results()[1], SketchArc_17.results()[1], SketchArc_16.results()[1], SketchArc_15.results()[1], SketchArc_22.results()[1], SketchArc_20.results()[1], SketchArc_11.results()[1], SketchArc_12.results()[1], SketchArc_21.results()[1], SketchArc_19.results()[1], SketchArc_14.results()[1], SketchArc_13.results()[1], SketchLine_77.result(), SketchLine_78.result(), SketchLine_79.result(), SketchLine_85.result(), SketchLine_87.result(), SketchLine_82.result(), SketchLine_84.result(), SketchLine_86.result(), SketchLine_83.result(), SketchLine_88.result(), SketchLine_76.result(), SketchLine_89.result()] -SketchConstraintMirror_5 = Sketch_6.addMirror(SketchLine_80.result(), SketchConstraintMirror_5_objects) -[SketchArc_23, SketchArc_24, SketchArc_25, SketchArc_26, SketchArc_27, SketchArc_28, SketchArc_29, SketchArc_30, SketchArc_31, SketchArc_32, SketchArc_33, SketchArc_34, SketchLine_90, SketchLine_91, SketchLine_92, SketchLine_93, SketchLine_94, SketchLine_95, SketchLine_96, SketchLine_97, SketchLine_98, SketchLine_99, SketchLine_100, SketchLine_101] = SketchConstraintMirror_5.mirrored() +SketchConstraintMirror_5_objects = [ + SketchArc_18.results()[1], + SketchArc_17.results()[1], + SketchArc_16.results()[1], + SketchArc_15.results()[1], + SketchArc_22.results()[1], + SketchArc_20.results()[1], + SketchArc_11.results()[1], + SketchArc_12.results()[1], + SketchArc_21.results()[1], + SketchArc_19.results()[1], + SketchArc_14.results()[1], + SketchArc_13.results()[1], + SketchLine_77.result(), + SketchLine_78.result(), + SketchLine_79.result(), + SketchLine_85.result(), + SketchLine_87.result(), + SketchLine_82.result(), + SketchLine_84.result(), + SketchLine_86.result(), + SketchLine_83.result(), + SketchLine_88.result(), + SketchLine_76.result(), + SketchLine_89.result(), +] +SketchConstraintMirror_5 = Sketch_6.addMirror( + SketchLine_80.result(), SketchConstraintMirror_5_objects +) +[ + SketchArc_23, + SketchArc_24, + SketchArc_25, + SketchArc_26, + SketchArc_27, + SketchArc_28, + SketchArc_29, + SketchArc_30, + SketchArc_31, + SketchArc_32, + SketchArc_33, + SketchArc_34, + SketchLine_90, + SketchLine_91, + SketchLine_92, + SketchLine_93, + SketchLine_94, + SketchLine_95, + SketchLine_96, + SketchLine_97, + SketchLine_98, + SketchLine_99, + SketchLine_100, + SketchLine_101, +] = SketchConstraintMirror_5.mirrored() SketchLine_101.setName("SketchLine_106") SketchLine_101.result().setName("SketchLine_106") SketchLine_100.setName("SketchLine_105") @@ -716,12 +1333,159 @@ SketchArc_23.results()[1].setName("SketchArc_24_2") SketchPoint_9 = Sketch_6.addPoint(0, -49.85) SketchPoint_9.setName("SketchPoint_11") SketchPoint_9.result().setName("SketchPoint_11") -SketchConstraintCoincidence_112 = Sketch_6.setCoincident(SketchPoint_9.coordinates(), SketchLine_80.result()) +SketchConstraintCoincidence_112 = Sketch_6.setCoincident( + SketchPoint_9.coordinates(), SketchLine_80.result() +) SketchConstraintCoincidence_112.setName("SketchConstraintCoincidence_119") -SketchConstraintDistance_16 = Sketch_6.setDistance(SketchPoint_9.coordinates(), SketchLine_81.result(), "10+5.3+5.7") -SketchMultiTranslation_3_objects = [SketchArc_13.results()[1], SketchArc_34.results()[1], SketchArc_14.results()[1], SketchArc_33.results()[1], SketchArc_12.results()[1], SketchArc_11.results()[1], SketchArc_30.results()[1], SketchArc_29.results()[1], SketchArc_15.results()[1], SketchArc_16.results()[1], SketchArc_26.results()[1], SketchArc_25.results()[1], SketchArc_17.results()[1], SketchArc_18.results()[1], SketchArc_24.results()[1], SketchArc_23.results()[1], SketchArc_20.results()[1], SketchArc_22.results()[1], SketchArc_28.results()[1], SketchArc_27.results()[1], SketchArc_19.results()[1], SketchArc_21.results()[1], SketchArc_32.results()[1], SketchArc_31.results()[1], SketchLine_82.result(), SketchLine_77.result(), SketchLine_97.result(), SketchLine_94.result(), SketchLine_101.result(), SketchLine_99.result(), SketchLine_83.result(), SketchLine_88.result(), SketchLine_89.result(), SketchLine_86.result(), SketchLine_85.result(), SketchLine_100.result(), SketchLine_79.result(), SketchLine_92.result(), SketchLine_87.result(), SketchLine_91.result(), SketchLine_84.result(), SketchLine_96.result(), SketchLine_95.result(), SketchLine_93.result(), SketchLine_78.result(), SketchLine_98.result(), SketchLine_76.result(), SketchLine_90.result()] -SketchMultiTranslation_3 = Sketch_6.addTranslation(SketchMultiTranslation_3_objects, SketchPoint_6.coordinates(), SketchPoint_9.coordinates(), 2) -[SketchArc_35, SketchArc_34, SketchArc_36, SketchArc_37, SketchArc_33, SketchArc_38, SketchArc_39, SketchArc_40, SketchArc_30, SketchArc_41, SketchArc_29, SketchArc_42, SketchArc_15, SketchArc_43, SketchArc_16, SketchArc_44, SketchArc_26, SketchArc_45, SketchArc_25, SketchArc_46, SketchArc_17, SketchArc_47, SketchArc_18, SketchArc_48, SketchArc_24, SketchArc_49, SketchArc_23, SketchArc_50, SketchArc_20, SketchArc_51, SketchArc_22, SketchArc_52, SketchArc_28, SketchArc_53, SketchArc_27, SketchArc_54, SketchArc_19, SketchArc_55, SketchArc_21, SketchArc_56, SketchArc_32, SketchArc_57, SketchArc_31, SketchArc_58, SketchLine_82, SketchLine_102, SketchLine_103, SketchLine_97, SketchLine_104, SketchLine_94, SketchLine_105, SketchLine_101, SketchLine_106, SketchLine_99, SketchLine_107, SketchLine_83, SketchLine_108, SketchLine_88, SketchLine_109, SketchLine_89, SketchLine_110, SketchLine_86, SketchLine_111, SketchLine_85, SketchLine_112, SketchLine_100, SketchLine_113, SketchLine_114, SketchLine_92, SketchLine_115, SketchLine_87, SketchLine_116, SketchLine_91, SketchLine_117, SketchLine_84, SketchLine_118, SketchLine_96, SketchLine_119, SketchLine_95, SketchLine_120, SketchLine_93, SketchLine_121, SketchLine_122, SketchLine_98, SketchLine_123, SketchLine_124, SketchLine_90, SketchLine_125] = SketchMultiTranslation_3.translated() +SketchConstraintDistance_16 = Sketch_6.setDistance( + SketchPoint_9.coordinates(), SketchLine_81.result(), "10+5.3+5.7" +) +SketchMultiTranslation_3_objects = [ + SketchArc_13.results()[1], + SketchArc_34.results()[1], + SketchArc_14.results()[1], + SketchArc_33.results()[1], + SketchArc_12.results()[1], + SketchArc_11.results()[1], + SketchArc_30.results()[1], + SketchArc_29.results()[1], + SketchArc_15.results()[1], + SketchArc_16.results()[1], + SketchArc_26.results()[1], + SketchArc_25.results()[1], + SketchArc_17.results()[1], + SketchArc_18.results()[1], + SketchArc_24.results()[1], + SketchArc_23.results()[1], + SketchArc_20.results()[1], + SketchArc_22.results()[1], + SketchArc_28.results()[1], + SketchArc_27.results()[1], + SketchArc_19.results()[1], + SketchArc_21.results()[1], + SketchArc_32.results()[1], + SketchArc_31.results()[1], + SketchLine_82.result(), + SketchLine_77.result(), + SketchLine_97.result(), + SketchLine_94.result(), + SketchLine_101.result(), + SketchLine_99.result(), + SketchLine_83.result(), + SketchLine_88.result(), + SketchLine_89.result(), + SketchLine_86.result(), + SketchLine_85.result(), + SketchLine_100.result(), + SketchLine_79.result(), + SketchLine_92.result(), + SketchLine_87.result(), + SketchLine_91.result(), + SketchLine_84.result(), + SketchLine_96.result(), + SketchLine_95.result(), + SketchLine_93.result(), + SketchLine_78.result(), + SketchLine_98.result(), + SketchLine_76.result(), + SketchLine_90.result(), +] +SketchMultiTranslation_3 = Sketch_6.addTranslation( + SketchMultiTranslation_3_objects, + SketchPoint_6.coordinates(), + SketchPoint_9.coordinates(), + 2, +) +[ + SketchArc_35, + SketchArc_34, + SketchArc_36, + SketchArc_37, + SketchArc_33, + SketchArc_38, + SketchArc_39, + SketchArc_40, + SketchArc_30, + SketchArc_41, + SketchArc_29, + SketchArc_42, + SketchArc_15, + SketchArc_43, + SketchArc_16, + SketchArc_44, + SketchArc_26, + SketchArc_45, + SketchArc_25, + SketchArc_46, + SketchArc_17, + SketchArc_47, + SketchArc_18, + SketchArc_48, + SketchArc_24, + SketchArc_49, + SketchArc_23, + SketchArc_50, + SketchArc_20, + SketchArc_51, + SketchArc_22, + SketchArc_52, + SketchArc_28, + SketchArc_53, + SketchArc_27, + SketchArc_54, + SketchArc_19, + SketchArc_55, + SketchArc_21, + SketchArc_56, + SketchArc_32, + SketchArc_57, + SketchArc_31, + SketchArc_58, + SketchLine_82, + SketchLine_102, + SketchLine_103, + SketchLine_97, + SketchLine_104, + SketchLine_94, + SketchLine_105, + SketchLine_101, + SketchLine_106, + SketchLine_99, + SketchLine_107, + SketchLine_83, + SketchLine_108, + SketchLine_88, + SketchLine_109, + SketchLine_89, + SketchLine_110, + SketchLine_86, + SketchLine_111, + SketchLine_85, + SketchLine_112, + SketchLine_100, + SketchLine_113, + SketchLine_114, + SketchLine_92, + SketchLine_115, + SketchLine_87, + SketchLine_116, + SketchLine_91, + SketchLine_117, + SketchLine_84, + SketchLine_118, + SketchLine_96, + SketchLine_119, + SketchLine_95, + SketchLine_120, + SketchLine_93, + SketchLine_121, + SketchLine_122, + SketchLine_98, + SketchLine_123, + SketchLine_124, + SketchLine_90, + SketchLine_125, +] = SketchMultiTranslation_3.translated() SketchLine_125.setName("SketchLine_130") SketchLine_125.result().setName("SketchLine_130") SketchLine_124.setName("SketchLine_129") @@ -845,23 +1609,86 @@ SketchArc_35.results()[1].setName("SketchArc_36_2") model.do() Sketch_6.setName("Sketch_7") Sketch_6.result().setName("Sketch_7") -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")) +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/SketchLine_67_StartVertex")) +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) SketchLine_128.setName("SketchLine_131") SketchLine_128.result().setName("SketchLine_131") SketchLine_128.setAuxiliary(True) -SketchConstraintCoincidence_113 = Sketch_7.setCoincident(SketchLine_128.endPoint(), SketchPoint_10.result()) +SketchConstraintCoincidence_113 = Sketch_7.setCoincident( + SketchLine_128.endPoint(), SketchPoint_10.result() +) SketchConstraintCoincidence_113.setName("SketchConstraintCoincidence_120") SketchLine_129 = Sketch_7.addLine(-153.5, -45.05, -153.5, -37.05) SketchLine_129.setName("SketchLine_132") @@ -873,28 +1700,42 @@ SketchLine_131 = Sketch_7.addLine(-150.8, -37.05, -150.8, -45.05) SketchLine_131.setName("SketchLine_134") SketchLine_131.result().setName("SketchLine_134") SketchLine_131.setAuxiliary(True) -SketchConstraintCoincidence_114 = Sketch_7.setCoincident(SketchLine_131.endPoint(), SketchLine_128.startPoint()) +SketchConstraintCoincidence_114 = Sketch_7.setCoincident( + SketchLine_131.endPoint(), SketchLine_128.startPoint() +) SketchConstraintCoincidence_114.setName("SketchConstraintCoincidence_121") -SketchConstraintCoincidence_115 = Sketch_7.setCoincident(SketchLine_128.endPoint(), SketchLine_129.startPoint()) +SketchConstraintCoincidence_115 = Sketch_7.setCoincident( + SketchLine_128.endPoint(), SketchLine_129.startPoint() +) SketchConstraintCoincidence_115.setName("SketchConstraintCoincidence_122") SketchLine_132 = Sketch_7.addLine(-153.5, -37.05, -150.8, -37.05) SketchLine_132.setName("SketchLine_133") SketchLine_132.result().setName("SketchLine_133") SketchLine_132.setAuxiliary(True) -SketchConstraintCoincidence_116 = Sketch_7.setCoincident(SketchLine_129.endPoint(), SketchLine_132.startPoint()) +SketchConstraintCoincidence_116 = Sketch_7.setCoincident( + SketchLine_129.endPoint(), SketchLine_132.startPoint() +) SketchConstraintCoincidence_116.setName("SketchConstraintCoincidence_123") -SketchConstraintCoincidence_117 = Sketch_7.setCoincident(SketchLine_132.endPoint(), SketchLine_131.startPoint()) +SketchConstraintCoincidence_117 = Sketch_7.setCoincident( + SketchLine_132.endPoint(), SketchLine_131.startPoint() +) SketchConstraintCoincidence_117.setName("SketchConstraintCoincidence_124") 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/SketchLine_70_StartVertex")) +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()) +SketchConstraintCoincidence_118 = Sketch_7.setCoincident( + SketchLine_132.endPoint(), SketchPoint_11.result() +) SketchConstraintCoincidence_118.setName("SketchConstraintCoincidence_125") -SketchArc_59 = Sketch_7.addArc(-152.3, -38.55, -150.8, -38.55, -152.3000099350335, -37.05, False) +SketchArc_59 = Sketch_7.addArc( + -152.3, -38.55, -150.8, -38.55, -152.3000099350335, -37.05, False +) SketchArc_59.setName("SketchArc_60") SketchArc_59.result().setName("SketchArc_60") SketchArc_59.results()[1].setName("SketchArc_60_2") @@ -902,45 +1743,87 @@ SketchLine_133 = Sketch_7.addLine(-150.8, -38.55, -150.8, -45.05) SketchLine_133.setName("SketchLine_136") SketchLine_133.result().setName("SketchLine_136") SketchLine_133.setAuxiliary(True) -SketchConstraintCoincidence_119 = Sketch_7.setCoincident(SketchArc_59.startPoint(), SketchLine_133.startPoint()) +SketchConstraintCoincidence_119 = Sketch_7.setCoincident( + SketchArc_59.startPoint(), SketchLine_133.startPoint() +) SketchConstraintCoincidence_119.setName("SketchConstraintCoincidence_126") -SketchConstraintCoincidence_120 = Sketch_7.setCoincident(SketchArc_59.endPoint(), SketchLine_126.endPoint()) +SketchConstraintCoincidence_120 = Sketch_7.setCoincident( + SketchArc_59.endPoint(), SketchLine_126.endPoint() +) SketchConstraintCoincidence_120.setName("SketchConstraintCoincidence_127") -SketchConstraintTangent_13 = Sketch_7.setTangent(SketchArc_59.results()[1], SketchLine_126.result()) -SketchConstraintTangent_14 = Sketch_7.setTangent(SketchArc_59.results()[1], SketchLine_133.result()) -SketchConstraintCoincidence_121 = Sketch_7.setCoincident(SketchLine_132.startPoint(), SketchLine_126.startPoint()) +SketchConstraintTangent_13 = Sketch_7.setTangent( + SketchArc_59.results()[1], SketchLine_126.result() +) +SketchConstraintTangent_14 = Sketch_7.setTangent( + SketchArc_59.results()[1], SketchLine_133.result() +) +SketchConstraintCoincidence_121 = Sketch_7.setCoincident( + SketchLine_132.startPoint(), SketchLine_126.startPoint() +) SketchConstraintCoincidence_121.setName("SketchConstraintCoincidence_128") -SketchConstraintCoincidence_122 = Sketch_7.setCoincident(SketchLine_131.endPoint(), SketchLine_133.endPoint()) +SketchConstraintCoincidence_122 = Sketch_7.setCoincident( + SketchLine_131.endPoint(), SketchLine_133.endPoint() +) SketchConstraintCoincidence_122.setName("SketchConstraintCoincidence_129") -SketchConstraintCoincidence_123 = Sketch_7.setCoincident(SketchLine_126.endPoint(), SketchLine_132.result()) +SketchConstraintCoincidence_123 = Sketch_7.setCoincident( + SketchLine_126.endPoint(), SketchLine_132.result() +) SketchConstraintCoincidence_123.setName("SketchConstraintCoincidence_130") -SketchConstraintCoincidence_124 = Sketch_7.setCoincident(SketchLine_133.startPoint(), SketchLine_131.result()) +SketchConstraintCoincidence_124 = Sketch_7.setCoincident( + SketchLine_133.startPoint(), SketchLine_131.result() +) SketchConstraintCoincidence_124.setName("SketchConstraintCoincidence_131") SketchArc_60 = Sketch_7.addArc(-152.3, -43.55, -152.3, -45.05, -150.8, -43.55, False) SketchArc_60.setName("SketchArc_61") SketchArc_60.result().setName("SketchArc_61") SketchArc_60.results()[1].setName("SketchArc_61_2") -SketchConstraintCoincidence_125 = Sketch_7.setCoincident(SketchArc_60.startPoint(), SketchLine_130.startPoint()) +SketchConstraintCoincidence_125 = Sketch_7.setCoincident( + SketchArc_60.startPoint(), SketchLine_130.startPoint() +) SketchConstraintCoincidence_125.setName("SketchConstraintCoincidence_132") -SketchConstraintCoincidence_126 = Sketch_7.setCoincident(SketchArc_60.endPoint(), SketchLine_127.endPoint()) +SketchConstraintCoincidence_126 = Sketch_7.setCoincident( + SketchArc_60.endPoint(), SketchLine_127.endPoint() +) SketchConstraintCoincidence_126.setName("SketchConstraintCoincidence_133") -SketchConstraintTangent_15 = Sketch_7.setTangent(SketchArc_60.results()[1], SketchLine_130.result()) -SketchConstraintTangent_16 = Sketch_7.setTangent(SketchArc_60.results()[1], SketchLine_127.result()) -SketchConstraintCoincidence_127 = Sketch_7.setCoincident(SketchLine_128.endPoint(), SketchLine_130.endPoint()) +SketchConstraintTangent_15 = Sketch_7.setTangent( + SketchArc_60.results()[1], SketchLine_130.result() +) +SketchConstraintTangent_16 = Sketch_7.setTangent( + SketchArc_60.results()[1], SketchLine_127.result() +) +SketchConstraintCoincidence_127 = Sketch_7.setCoincident( + SketchLine_128.endPoint(), SketchLine_130.endPoint() +) SketchConstraintCoincidence_127.setName("SketchConstraintCoincidence_134") -SketchConstraintCoincidence_128 = Sketch_7.setCoincident(SketchLine_133.startPoint(), SketchLine_127.startPoint()) +SketchConstraintCoincidence_128 = Sketch_7.setCoincident( + SketchLine_133.startPoint(), SketchLine_127.startPoint() +) SketchConstraintCoincidence_128.setName("SketchConstraintCoincidence_135") -SketchConstraintCoincidence_129 = Sketch_7.setCoincident(SketchLine_130.startPoint(), SketchLine_128.result()) +SketchConstraintCoincidence_129 = Sketch_7.setCoincident( + SketchLine_130.startPoint(), SketchLine_128.result() +) SketchConstraintCoincidence_129.setName("SketchConstraintCoincidence_136") -SketchConstraintCoincidence_130 = Sketch_7.setCoincident(SketchLine_127.endPoint(), SketchLine_133.result()) +SketchConstraintCoincidence_130 = Sketch_7.setCoincident( + SketchLine_127.endPoint(), SketchLine_133.result() +) SketchConstraintCoincidence_130.setName("SketchConstraintCoincidence_137") SketchConstraintRadius_6 = Sketch_7.setRadius(SketchArc_60.results()[1], 1.5) SketchConstraintRadius_7 = Sketch_7.setRadius(SketchArc_59.results()[1], 1.5) 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/Modified_Face&Sketch_1/SketchLine_10")) +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/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") @@ -953,32 +1836,52 @@ SketchArc_61 = Sketch_8.addArc(0.85, 49.1, 0.85, 47.45, 0.85, 50.75, False) SketchArc_61.setName("SketchArc_63") SketchArc_61.result().setName("SketchArc_63") SketchArc_61.results()[1].setName("SketchArc_63_2") -SketchConstraintCoincidence_131 = Sketch_8.setCoincident(SketchLine_134.startPoint(), SketchArc_61.endPoint()) +SketchConstraintCoincidence_131 = Sketch_8.setCoincident( + SketchLine_134.startPoint(), SketchArc_61.endPoint() +) SketchConstraintCoincidence_131.setName("SketchConstraintCoincidence_146") -SketchConstraintCoincidence_132 = Sketch_8.setCoincident(SketchArc_61.startPoint(), SketchLine_135.endPoint()) +SketchConstraintCoincidence_132 = Sketch_8.setCoincident( + SketchArc_61.startPoint(), SketchLine_135.endPoint() +) SketchConstraintCoincidence_132.setName("SketchConstraintCoincidence_148") -SketchConstraintDistance_17 = Sketch_8.setDistance(SketchLine_134.result(), SketchLine_135.endPoint(), 3.3) +SketchConstraintDistance_17 = Sketch_8.setDistance( + SketchLine_134.result(), SketchLine_135.endPoint(), 3.3 +) SketchLine_136 = Sketch_8.addLine(0.85, 50.75, 0.85, 47.45) SketchLine_136.setName("SketchLine_140") SketchLine_136.result().setName("SketchLine_140") SketchLine_136.setAuxiliary(True) -SketchConstraintCoincidence_133 = Sketch_8.setCoincident(SketchLine_134.startPoint(), SketchLine_136.startPoint()) +SketchConstraintCoincidence_133 = Sketch_8.setCoincident( + SketchLine_134.startPoint(), SketchLine_136.startPoint() +) SketchConstraintCoincidence_133.setName("SketchConstraintCoincidence_138") -SketchConstraintCoincidence_134 = Sketch_8.setCoincident(SketchArc_61.endPoint(), SketchLine_136.startPoint()) +SketchConstraintCoincidence_134 = Sketch_8.setCoincident( + SketchArc_61.endPoint(), SketchLine_136.startPoint() +) SketchConstraintCoincidence_134.setName("SketchConstraintCoincidence_139") -SketchConstraintCoincidence_135 = Sketch_8.setCoincident(SketchLine_135.endPoint(), SketchLine_136.endPoint()) +SketchConstraintCoincidence_135 = Sketch_8.setCoincident( + SketchLine_135.endPoint(), SketchLine_136.endPoint() +) SketchConstraintCoincidence_135.setName("SketchConstraintCoincidence_140") -SketchConstraintCoincidence_136 = Sketch_8.setCoincident(SketchArc_61.startPoint(), SketchLine_136.endPoint()) +SketchConstraintCoincidence_136 = Sketch_8.setCoincident( + SketchArc_61.startPoint(), SketchLine_136.endPoint() +) SketchConstraintCoincidence_136.setName("SketchConstraintCoincidence_141") SketchLine_137 = Sketch_8.addLine(-0.85, 50.75, -0.85, 47.45) SketchLine_137.setName("SketchLine_142") SketchLine_137.result().setName("SketchLine_142") SketchLine_137.setAuxiliary(True) -SketchConstraintCoincidence_137 = Sketch_8.setCoincident(SketchLine_134.endPoint(), SketchLine_137.startPoint()) +SketchConstraintCoincidence_137 = Sketch_8.setCoincident( + SketchLine_134.endPoint(), SketchLine_137.startPoint() +) SketchConstraintCoincidence_137.setName("SketchConstraintCoincidence_143") -SketchConstraintCoincidence_138 = Sketch_8.setCoincident(SketchLine_135.startPoint(), SketchLine_137.endPoint()) +SketchConstraintCoincidence_138 = Sketch_8.setCoincident( + SketchLine_135.startPoint(), SketchLine_137.endPoint() +) SketchConstraintCoincidence_138.setName("SketchConstraintCoincidence_147") -SketchConstraintCoincidence_152 = Sketch_8.setCoincident(SketchArc_61.center(), SketchLine_136.result()) +SketchConstraintCoincidence_152 = Sketch_8.setCoincident( + SketchArc_61.center(), SketchLine_136.result() +) SketchConstraintLength_10 = Sketch_8.setLength(SketchLine_134.result(), 1.7) SketchConstraintLength_10.setName("SketchConstraintLength_11") SketchConstraintVertical_17 = Sketch_8.setVertical(SketchLine_137.result()) @@ -987,55 +1890,105 @@ SketchLine_138 = Sketch_8.addLine(0.85, 50.75, -0.85, 47.45) SketchLine_138.setName("SketchLine_143") SketchLine_138.result().setName("SketchLine_143") SketchLine_138.setAuxiliary(True) -SketchConstraintCoincidence_139 = Sketch_8.setCoincident(SketchLine_134.startPoint(), SketchLine_138.startPoint()) +SketchConstraintCoincidence_139 = Sketch_8.setCoincident( + SketchLine_134.startPoint(), SketchLine_138.startPoint() +) SketchConstraintCoincidence_139.setName("SketchConstraintCoincidence_150") -SketchConstraintCoincidence_140 = Sketch_8.setCoincident(SketchArc_61.endPoint(), SketchLine_138.startPoint()) +SketchConstraintCoincidence_140 = Sketch_8.setCoincident( + SketchArc_61.endPoint(), SketchLine_138.startPoint() +) SketchConstraintCoincidence_140.setName("SketchConstraintCoincidence_151") -SketchConstraintCoincidence_141 = Sketch_8.setCoincident(SketchLine_136.startPoint(), SketchLine_138.startPoint()) +SketchConstraintCoincidence_141 = Sketch_8.setCoincident( + SketchLine_136.startPoint(), SketchLine_138.startPoint() +) SketchConstraintCoincidence_141.setName("SketchConstraintCoincidence_152") -SketchConstraintCoincidence_142 = Sketch_8.setCoincident(SketchLine_135.startPoint(), SketchLine_138.endPoint()) +SketchConstraintCoincidence_142 = Sketch_8.setCoincident( + SketchLine_135.startPoint(), SketchLine_138.endPoint() +) SketchConstraintCoincidence_142.setName("SketchConstraintCoincidence_153") -SketchConstraintCoincidence_143 = Sketch_8.setCoincident(SketchLine_137.endPoint(), SketchLine_138.endPoint()) +SketchConstraintCoincidence_143 = Sketch_8.setCoincident( + SketchLine_137.endPoint(), SketchLine_138.endPoint() +) SketchConstraintCoincidence_143.setName("SketchConstraintCoincidence_155") SketchPoint_12 = Sketch_8.addPoint(0, 49.1) SketchPoint_12.setName("SketchPoint_14") SketchPoint_12.result().setName("SketchPoint_14") -SketchConstraintCoincidence_144 = Sketch_8.setCoincident(SketchPoint_12.coordinates(), SketchLine_138.result()) +SketchConstraintCoincidence_144 = Sketch_8.setCoincident( + SketchPoint_12.coordinates(), SketchLine_138.result() +) SketchConstraintCoincidence_144.setName("SketchConstraintCoincidence_156") -SketchConstraintMiddle_3 = Sketch_8.setMiddlePoint(SketchLine_138.result(), SketchPoint_12.coordinates()) +SketchConstraintMiddle_3 = Sketch_8.setMiddlePoint( + SketchLine_138.result(), SketchPoint_12.coordinates() +) SketchConstraintMiddle_3.setName("SketchConstraintMiddle_4") SketchProjection_2 = Sketch_8.addProjection(model.selection("EDGE", "PartSet/OY")) SketchLine_139 = SketchProjection_2.createdFeature() SketchLine_139.setName("SketchLine_144") SketchLine_139.result().setName("SketchLine_144") -SketchConstraintCoincidence_145 = Sketch_8.setCoincident(SketchPoint_12.coordinates(), SketchLine_139.result()) +SketchConstraintCoincidence_145 = Sketch_8.setCoincident( + SketchPoint_12.coordinates(), SketchLine_139.result() +) SketchConstraintCoincidence_145.setName("SketchConstraintCoincidence_157") SketchArc_62 = Sketch_8.addArc(-0.85, 49.1, -0.85, 50.75, -0.85, 47.45, False) -SketchConstraintCoincidence_146 = Sketch_8.setCoincident(SketchLine_135.startPoint(), SketchArc_62.endPoint()) +SketchConstraintCoincidence_146 = Sketch_8.setCoincident( + SketchLine_135.startPoint(), SketchArc_62.endPoint() +) SketchConstraintCoincidence_146.setName("SketchConstraintCoincidence_149") -SketchConstraintCoincidence_147 = Sketch_8.setCoincident(SketchLine_137.endPoint(), SketchArc_62.endPoint()) +SketchConstraintCoincidence_147 = Sketch_8.setCoincident( + SketchLine_137.endPoint(), SketchArc_62.endPoint() +) SketchConstraintCoincidence_147.setName("SketchConstraintCoincidence_154") -SketchConstraintCoincidence_148 = Sketch_8.setCoincident(SketchLine_138.endPoint(), SketchArc_62.endPoint()) +SketchConstraintCoincidence_148 = Sketch_8.setCoincident( + SketchLine_138.endPoint(), SketchArc_62.endPoint() +) SketchConstraintCoincidence_148.setName("SketchConstraintCoincidence_158") -SketchConstraintCoincidence_149 = Sketch_8.setCoincident(SketchArc_62.startPoint(), SketchLine_134.endPoint()) +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/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_6_1/Modified_Face&Sketch_1/SketchLine_10]")) +SketchConstraintCoincidence_150 = Sketch_8.setCoincident( + SketchArc_62.center(), SketchLine_137.result() +) +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) +SketchConstraintDistance_18 = Sketch_8.setDistance( + SketchLine_140.result(), SketchPoint_12.coordinates(), 6 +) SketchLine_141 = Sketch_8.addLine(0, 49.1, 107.43, 49.1) SketchLine_141.setName("SketchLine_146") SketchLine_141.result().setName("SketchLine_146") SketchLine_141.setAuxiliary(True) -SketchConstraintCoincidence_151 = Sketch_8.setCoincident(SketchPoint_12.coordinates(), SketchLine_141.startPoint()) +SketchConstraintCoincidence_151 = Sketch_8.setCoincident( + SketchPoint_12.coordinates(), SketchLine_141.startPoint() +) SketchConstraintHorizontal_22 = Sketch_8.setHorizontal(SketchLine_141.result()) SketchConstraintLength_11 = Sketch_8.setLength(SketchLine_141.result(), 107.43) SketchConstraintLength_11.setName("SketchConstraintLength_12") -SketchMultiTranslation_4_objects = [SketchLine_134.result(), SketchLine_135.result(), SketchArc_61.results()[1], SketchArc_62.results()[1]] -SketchMultiTranslation_4 = Sketch_8.addTranslation(SketchMultiTranslation_4_objects, SketchPoint_12.coordinates(), SketchLine_141.endPoint(), 2) -[SketchLine_142, SketchLine_143, SketchArc_63, SketchArc_64] = SketchMultiTranslation_4.translated() +SketchMultiTranslation_4_objects = [ + SketchLine_134.result(), + SketchLine_135.result(), + SketchArc_61.results()[1], + SketchArc_62.results()[1], +] +SketchMultiTranslation_4 = Sketch_8.addTranslation( + SketchMultiTranslation_4_objects, + SketchPoint_12.coordinates(), + SketchLine_141.endPoint(), + 2, +) +[ + SketchLine_142, + SketchLine_143, + SketchArc_63, + SketchArc_64, +] = SketchMultiTranslation_4.translated() SketchArc_64.setName("SketchArc_65") SketchArc_64.result().setName("SketchArc_65") SketchArc_64.results()[1].setName("SketchArc_65_2") @@ -1046,9 +1999,21 @@ SketchLine_143.setName("SketchLine_148") SketchLine_143.result().setName("SketchLine_148") SketchLine_142.setName("SketchLine_147") SketchLine_142.result().setName("SketchLine_147") -SketchConstraintMirror_6_objects = [SketchArc_63.results()[1], SketchArc_64.results()[1], SketchLine_142.result(), SketchLine_143.result()] -SketchConstraintMirror_6 = Sketch_8.addMirror(SketchLine_139.result(), SketchConstraintMirror_6_objects) -[SketchArc_65, SketchArc_66, SketchLine_144, SketchLine_145] = SketchConstraintMirror_6.mirrored() +SketchConstraintMirror_6_objects = [ + SketchArc_63.results()[1], + SketchArc_64.results()[1], + SketchLine_142.result(), + SketchLine_143.result(), +] +SketchConstraintMirror_6 = Sketch_8.addMirror( + SketchLine_139.result(), SketchConstraintMirror_6_objects +) +[ + SketchArc_65, + SketchArc_66, + SketchLine_144, + SketchLine_145, +] = SketchConstraintMirror_6.mirrored() SketchLine_145.setName("SketchLine_150") SketchLine_145.result().setName("SketchLine_150") SketchLine_144.setName("SketchLine_149") @@ -1062,7 +2027,27 @@ 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-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")]) +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 diff --git a/test.compatibility/flange.py b/test.compatibility/flange.py index 0e3444968..ab474674d 100644 --- a/test.compatibility/flange.py +++ b/test.compatibility/flange.py @@ -28,90 +28,247 @@ Parameter_thick = model.addParameter(Part_1_doc, "thick", "16") Parameter_length = model.addParameter(Part_1_doc, "length", "172") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OZ")) -SketchArc_1 = Sketch_1.addArc(-1.656176621148808e-020, 61, -36.69142117459658, 34.94736842105263, -1.927105092898643e-024, 106, True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.center()) +SketchArc_1 = Sketch_1.addArc( + -1.656176621148808e-020, + 61, + -36.69142117459658, + 34.94736842105263, + -1.927105092898643e-024, + 106, + True, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.center() +) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_3 = Sketch_1.addLine(-46.47580015448901, 16.00000000000001, -86, 16) SketchLine_4 = Sketch_1.addLine(-86, 16, -86, -1.232595164407831e-032) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(-86, -1.232595164407831e-032, -46.47580015448901, 7.497132070176856e-024) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchArc_2 = Sketch_1.addArc(5.604803279647422e-025, 61, -23.64558253474002, 44.21052631578948, -7.759334428649666e-022, 90, True) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.center(), SketchArc_2.center()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + -86, -1.232595164407831e-032, -46.47580015448901, 7.497132070176856e-024 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchArc_2 = Sketch_1.addArc( + 5.604803279647422e-025, + 61, + -23.64558253474002, + 44.21052631578948, + -7.759334428649666e-022, + 90, + True, +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchArc_2.center() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) -SketchArc_3 = Sketch_1.addArc(-46.47580015448901, 28.00000000000001, -36.69142117459658, 34.94736842105264, -46.47580015448901, 16.00000000000001, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchArc_3.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchArc_3.endPoint()) -SketchArc_4 = Sketch_1.addArc(-46.475800154489, 28, -23.64558253474002, 44.21052631578947, -46.475800154489, -2.594279994652913e-031, True) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchArc_4.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_5.endPoint()) +SketchArc_3 = Sketch_1.addArc( + -46.47580015448901, + 28.00000000000001, + -36.69142117459658, + 34.94736842105264, + -46.47580015448901, + 16.00000000000001, + True, +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchArc_3.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchArc_3.endPoint() +) +SketchArc_4 = Sketch_1.addArc( + -46.475800154489, + 28, + -23.64558253474002, + 44.21052631578947, + -46.475800154489, + -2.594279994652913e-031, + True, +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchArc_4.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_5.endPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_3.results()[1], 12) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_3.results()[1]) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_3.result()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_4.center(), SketchArc_3.center()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_5.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_2.center(), SketchLine_5.result(), 61) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchArc_2.results()[1]) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.result()) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchArc_3.results()[1] +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_3.result() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_4.center(), SketchArc_3.center() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchLine_5.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_2.center(), SketchLine_5.result(), 61 +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchArc_2.results()[1] +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), "thick") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_4.result(), "length/2") -SketchConstraintMirror_1_objects = [SketchArc_2.results()[1], SketchArc_4.results()[1], SketchLine_5.result(), SketchLine_4.result(), SketchLine_3.result(), SketchArc_3.results()[1], SketchArc_1.results()[1]] -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_1.result(), SketchConstraintMirror_1_objects) -[SketchArc_5, SketchArc_6, SketchLine_6, SketchLine_7, SketchLine_8, SketchArc_7, SketchArc_8] = SketchConstraintMirror_1.mirrored() +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_4.result(), "length/2" +) +SketchConstraintMirror_1_objects = [ + SketchArc_2.results()[1], + SketchArc_4.results()[1], + SketchLine_5.result(), + SketchLine_4.result(), + SketchLine_3.result(), + SketchArc_3.results()[1], + SketchArc_1.results()[1], +] +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_1.result(), SketchConstraintMirror_1_objects +) +[ + 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-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) +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) SketchLine_9 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchArc_9.center(), SketchLine_9.result(), "61+dint/2+thick") +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchArc_9.center(), SketchLine_9.result(), "61+dint/2+thick" +) SketchLine_10 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OZ")) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchArc_9.startPoint(), SketchLine_10.result()) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchArc_9.endPoint(), SketchLine_10.result()) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchArc_9.center(), SketchLine_10.result()) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchArc_9.startPoint(), SketchLine_10.result() +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchArc_9.endPoint(), SketchLine_10.result() +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchArc_9.center(), SketchLine_10.result() +) 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()) +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_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")]) +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) SketchLine_13 = Sketch_3.addLine(-4, 106, -4, 67.34428877022477) -SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_18 = Sketch_3.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_12.result()) SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_13.result()) SketchPoint_1 = Sketch_3.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintDistance_4 = Sketch_3.setDistance(SketchPoint_1.coordinates(), SketchLine_12.result(), "61+90/2") +SketchConstraintDistance_4 = Sketch_3.setDistance( + SketchPoint_1.coordinates(), SketchLine_12.result(), "61+90/2" +) SketchLine_14 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_14.setName("SketchLine_15") SketchLine_14.result().setName("SketchLine_15") -SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_12.startPoint(), SketchLine_14.result()) +SketchConstraintCoincidence_19 = Sketch_3.setCoincident( + SketchLine_12.startPoint(), SketchLine_14.result() +) SketchConstraintLength_2 = Sketch_3.setLength(SketchLine_12.result(), "8/2") -SketchArc_10 = Sketch_3.addArc(0, 61, -4, 67.34428877022477, 4, 67.34428877022477, False) -SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_14.result(), SketchArc_10.center()) +SketchArc_10 = Sketch_3.addArc( + 0, 61, -4, 67.34428877022477, 4, 67.34428877022477, False +) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident( + SketchLine_14.result(), SketchArc_10.center() +) SketchConstraintRadius_4 = Sketch_3.setRadius(SketchArc_10.results()[1], "15/2") SketchLine_15 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_15.setName("SketchLine_16") SketchLine_15.result().setName("SketchLine_16") -SketchConstraintDistance_5 = Sketch_3.setDistance(SketchArc_10.center(), SketchLine_15.result(), 61) -SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchArc_10.startPoint()) -SketchConstraintMirror_2 = Sketch_3.addMirror(SketchLine_14.result(), [SketchLine_13.result(), SketchLine_12.result()]) +SketchConstraintDistance_5 = Sketch_3.setDistance( + SketchArc_10.center(), SketchLine_15.result(), 61 +) +SketchConstraintCoincidence_21 = Sketch_3.setCoincident( + SketchLine_13.endPoint(), SketchArc_10.startPoint() +) +SketchConstraintMirror_2 = Sketch_3.addMirror( + SketchLine_14.result(), [SketchLine_13.result(), SketchLine_12.result()] +) [SketchLine_16, SketchLine_17] = SketchConstraintMirror_2.mirrored() SketchLine_17.setName("SketchLine_18") SketchLine_17.result().setName("SketchLine_18") SketchLine_16.setName("SketchLine_17") SketchLine_16.result().setName("SketchLine_17") -SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchArc_10.endPoint(), SketchLine_16.result()) +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/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&Sketch_1/SketchLine_5")) +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&Sketch_1/SketchLine_5"), +) SketchLine_18 = Sketch_4.addLine(-65, 16, -65, -16) SketchLine_18.setName("SketchLine_19") SketchLine_18.result().setName("SketchLine_19") @@ -119,38 +276,88 @@ SketchLine_18.setAuxiliary(True) SketchConstraintVertical_3 = Sketch_4.setVertical(SketchLine_18.result()) SketchConstraintLength_3 = Sketch_4.setLength(SketchLine_18.result(), 32) SketchPoint_2 = Sketch_4.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintDistance_6 = Sketch_4.setDistance(SketchPoint_2.coordinates(), SketchLine_18.result(), "130/2") +SketchConstraintDistance_6 = Sketch_4.setDistance( + SketchPoint_2.coordinates(), SketchLine_18.result(), "130/2" +) SketchPoint_3 = Sketch_4.addPoint(-65, 0) SketchPoint_3.setAuxiliary(True) -SketchConstraintMiddle_1 = Sketch_4.setMiddlePoint(SketchPoint_3.coordinates(), SketchLine_18.result()) +SketchConstraintMiddle_1 = Sketch_4.setMiddlePoint( + SketchPoint_3.coordinates(), SketchLine_18.result() +) SketchLine_19 = Sketch_4.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_19.setName("SketchLine_20") SketchLine_19.result().setName("SketchLine_20") -SketchConstraintCoincidence_23 = Sketch_4.setCoincident(SketchPoint_3.coordinates(), SketchLine_19.result()) +SketchConstraintCoincidence_23 = Sketch_4.setCoincident( + SketchPoint_3.coordinates(), SketchLine_19.result() +) SketchArc_11 = Sketch_4.addArc(-65, 16, -59, 16, -71, 16, False) -SketchConstraintCoincidence_24 = Sketch_4.setCoincident(SketchLine_18.startPoint(), SketchArc_11.center()) +SketchConstraintCoincidence_24 = Sketch_4.setCoincident( + SketchLine_18.startPoint(), SketchArc_11.center() +) SketchArc_12 = Sketch_4.addArc(-65, -16, -59, -16.00003459934639, -71, -16, True) -SketchConstraintCoincidence_25 = Sketch_4.setCoincident(SketchLine_18.endPoint(), SketchArc_12.center()) +SketchConstraintCoincidence_25 = Sketch_4.setCoincident( + SketchLine_18.endPoint(), SketchArc_12.center() +) SketchConstraintRadius_5 = Sketch_4.setRadius(SketchArc_11.results()[1], 6) SketchLine_20 = Sketch_4.addLine(-71, 16, -71, -16) SketchLine_20.setName("SketchLine_21") SketchLine_20.result().setName("SketchLine_21") -SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchArc_11.endPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchArc_12.endPoint(), SketchLine_20.endPoint()) +SketchConstraintCoincidence_26 = Sketch_4.setCoincident( + SketchArc_11.endPoint(), SketchLine_20.startPoint() +) +SketchConstraintCoincidence_27 = Sketch_4.setCoincident( + SketchArc_12.endPoint(), SketchLine_20.endPoint() +) SketchLine_21 = Sketch_4.addLine(-59, 16, -59, -16.00003459934639) SketchLine_21.setName("SketchLine_22") SketchLine_21.result().setName("SketchLine_22") -SketchConstraintCoincidence_28 = Sketch_4.setCoincident(SketchArc_11.startPoint(), SketchLine_21.startPoint()) -SketchConstraintCoincidence_29 = Sketch_4.setCoincident(SketchArc_12.startPoint(), SketchLine_21.endPoint()) +SketchConstraintCoincidence_28 = Sketch_4.setCoincident( + SketchArc_11.startPoint(), SketchLine_21.startPoint() +) +SketchConstraintCoincidence_29 = Sketch_4.setCoincident( + SketchArc_12.startPoint(), SketchLine_21.endPoint() +) SketchConstraintVertical_4 = Sketch_4.setVertical(SketchLine_20.result()) SketchConstraintVertical_5 = Sketch_4.setVertical(SketchLine_21.result()) -SketchConstraintTangent_5 = Sketch_4.setTangent(SketchLine_20.result(), SketchArc_11.results()[1]) -SketchConstraintTangent_6 = Sketch_4.setTangent(SketchLine_21.result(), SketchArc_11.results()[1]) -SketchConstraintTangent_7 = Sketch_4.setTangent(SketchArc_12.results()[1], SketchLine_20.result()) +SketchConstraintTangent_5 = Sketch_4.setTangent( + SketchLine_20.result(), SketchArc_11.results()[1] +) +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/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")]) +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() # Test reexecution after parameter change diff --git a/test.compatibility/gear.py b/test.compatibility/gear.py index 6b4ab594e..f87fb3492 100644 --- a/test.compatibility/gear.py +++ b/test.compatibility/gear.py @@ -27,31 +27,53 @@ Parameter_R = model.addParameter(partSet, "R", "15.5") Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 30, 0) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "Origin")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "OX")) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) SketchLine_3 = Sketch_1.addLine(30, 0, 30, 37.5) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(30, 37.5, 17, 37.5) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(17, 37.5, 17, 15.5) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(17, 15.5, 0, 15.5) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(model.selection("EDGE", "OY")) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.result()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.result() +) SketchLine_8 = Sketch_1.addLine(0, 15.5, 0, 0) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_8.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.endPoint(), SketchLine_8.result(), 30) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_1.endPoint(), SketchLine_8.result(), 30 +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 37.5) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_8.result(), "R") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.coordinates()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchPoint_1.coordinates() +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_4.result(), 13) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_1.startPoint() +) model.do() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() @@ -60,37 +82,83 @@ Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "PartSet/Origin")) SketchLine_9 = Sketch_2.addLine(0, 0, 0, 45.59203984275747) SketchLine_9.setAuxiliary(True) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchPoint_2.coordinates(), SketchLine_9.startPoint() +) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_9.result()) -SketchLine_10 = Sketch_2.addLine(-2.5, 37.41657386773942, -0.9611800001338426, 34.11656372860793) -SketchArc_1 = Sketch_2.addArc(0, 34.39248583236681, -0.9611800001338426, 34.11656372860793, 0, 33.39248583236681, False) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchArc_1.center(), SketchLine_9.result()) -SketchConstraintAngle_1 = Sketch_2.setAngleBackward(SketchLine_10.result(), SketchLine_9.result(), 205) +SketchLine_10 = Sketch_2.addLine( + -2.5, 37.41657386773942, -0.9611800001338426, 34.11656372860793 +) +SketchArc_1 = Sketch_2.addArc( + 0, + 34.39248583236681, + -0.9611800001338426, + 34.11656372860793, + 0, + 33.39248583236681, + False, +) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchArc_1.center(), SketchLine_9.result() +) +SketchConstraintAngle_1 = Sketch_2.setAngleBackward( + SketchLine_10.result(), SketchLine_9.result(), 205 +) SketchConstraintRadius_1 = Sketch_2.setRadius(SketchArc_1.results()[1], 1) -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchLine_10.startPoint(), SketchLine_9.result(), 2.5) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_9.result()) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchLine_10.startPoint(), SketchLine_9.result(), 2.5 +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchArc_1.endPoint(), SketchLine_9.result() +) SketchArc_2 = Sketch_2.addArc(0, 0, -2.5, 37.41657386773942, 0, 37.5, True) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchArc_2.center(), SketchPoint_2.result()) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_9.result(), SketchArc_2.endPoint()) -SketchConstraintMirror_1 = Sketch_2.addMirror(SketchLine_9.result(), [SketchLine_10.result(), SketchArc_1.results()[1], SketchArc_2.results()[1]]) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchArc_2.center(), SketchPoint_2.result() +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_10.startPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchLine_9.result(), SketchArc_2.endPoint() +) +SketchConstraintMirror_1 = Sketch_2.addMirror( + SketchLine_9.result(), + [SketchLine_10.result(), SketchArc_1.results()[1], SketchArc_2.results()[1]], +) [SketchLine_11, SketchArc_3, SketchArc_4] = SketchConstraintMirror_1.mirrored() -SketchMultiRotation_1_objects = [SketchArc_1.results()[1], SketchLine_10.result(), SketchArc_2.results()[1], SketchArc_3.results()[1], SketchLine_11.result(), SketchArc_4.results()[1]] -SketchMultiRotation_1 = Sketch_2.addRotation(SketchMultiRotation_1_objects, SketchArc_2.center(), 12, 30) +SketchMultiRotation_1_objects = [ + SketchArc_1.results()[1], + SketchLine_10.result(), + SketchArc_2.results()[1], + SketchArc_3.results()[1], + SketchLine_11.result(), + SketchArc_4.results()[1], +] +SketchMultiRotation_1 = Sketch_2.addRotation( + SketchMultiRotation_1_objects, SketchArc_2.center(), 12, 30 +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchArc_2.results()[1], 37.5) model.do() Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_70 = Sketch_3.addLine(0, 0, 30, 0) SketchLine_70.setAuxiliary(True) SketchPoint_3 = Sketch_3.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_70.startPoint(), SketchPoint_3.result()) +SketchConstraintCoincidence_18 = Sketch_3.setCoincident( + SketchLine_70.startPoint(), SketchPoint_3.result() +) SketchLine_71 = Sketch_3.addLine(30, 0, 30, 37.5) SketchLine_71.setAuxiliary(True) -SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_70.endPoint(), SketchLine_71.startPoint()) +SketchConstraintCoincidence_19 = Sketch_3.setCoincident( + SketchLine_70.endPoint(), SketchLine_71.startPoint() +) SketchLine_72 = Sketch_3.addLine(30, 37.5, 17, 37.5) SketchLine_72.setAuxiliary(True) -SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_71.endPoint(), SketchLine_72.startPoint()) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident( + SketchLine_71.endPoint(), SketchLine_72.startPoint() +) SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_72.result()) SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_70.result()) SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_71.result()) @@ -98,105 +166,241 @@ SketchConstraintLength_4 = Sketch_3.setLength(SketchLine_70.result(), 30) SketchConstraintLength_5 = Sketch_3.setLength(SketchLine_71.result(), 37.5) SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_72.result(), 13) SketchLine_73 = Sketch_3.addLine(29, 37.49999999999999, 30, 36.49999999999999) -SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_73.startPoint(), SketchLine_72.result()) -SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_73.endPoint(), SketchLine_71.result()) +SketchConstraintCoincidence_21 = Sketch_3.setCoincident( + SketchLine_73.startPoint(), SketchLine_72.result() +) +SketchConstraintCoincidence_22 = Sketch_3.setCoincident( + SketchLine_73.endPoint(), SketchLine_71.result() +) SketchLine_74 = Sketch_3.addLine(17, 37.5, 17, 36.5) SketchLine_75 = Sketch_3.addLine(17, 36.5, 17.99999999999994, 37.5) -SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_74.endPoint(), SketchLine_75.startPoint()) -SketchConstraintCoincidence_24 = Sketch_3.setCoincident(SketchLine_75.endPoint(), SketchLine_72.result()) -SketchConstraintCoincidence_25 = Sketch_3.setCoincident(SketchLine_72.endPoint(), SketchLine_74.startPoint()) +SketchConstraintCoincidence_23 = Sketch_3.setCoincident( + SketchLine_74.endPoint(), SketchLine_75.startPoint() +) +SketchConstraintCoincidence_24 = Sketch_3.setCoincident( + SketchLine_75.endPoint(), SketchLine_72.result() +) +SketchConstraintCoincidence_25 = Sketch_3.setCoincident( + SketchLine_72.endPoint(), SketchLine_74.startPoint() +) SketchConstraintVertical_6 = Sketch_3.setVertical(SketchLine_74.result()) SketchConstraintLength_7 = Sketch_3.setLength(SketchLine_74.result(), 1) -SketchConstraintDistance_3 = Sketch_3.setDistance(SketchLine_75.endPoint(), SketchLine_74.result(), 1) -SketchConstraintDistance_4 = Sketch_3.setDistance(SketchLine_73.startPoint(), SketchLine_71.result(), 1) -SketchConstraintDistance_5 = Sketch_3.setDistance(SketchLine_73.endPoint(), SketchLine_72.result(), 1) +SketchConstraintDistance_3 = Sketch_3.setDistance( + SketchLine_75.endPoint(), SketchLine_74.result(), 1 +) +SketchConstraintDistance_4 = Sketch_3.setDistance( + SketchLine_73.startPoint(), SketchLine_71.result(), 1 +) +SketchConstraintDistance_5 = Sketch_3.setDistance( + SketchLine_73.endPoint(), SketchLine_72.result(), 1 +) SketchLine_76 = Sketch_3.addLine(17, 37.5, 17.99999999999994, 37.5) -SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchLine_72.endPoint(), SketchLine_76.startPoint()) -SketchConstraintCoincidence_27 = Sketch_3.setCoincident(SketchLine_74.startPoint(), SketchLine_76.startPoint()) -SketchConstraintCoincidence_28 = Sketch_3.setCoincident(SketchLine_75.endPoint(), SketchLine_76.endPoint()) +SketchConstraintCoincidence_26 = Sketch_3.setCoincident( + SketchLine_72.endPoint(), SketchLine_76.startPoint() +) +SketchConstraintCoincidence_27 = Sketch_3.setCoincident( + SketchLine_74.startPoint(), SketchLine_76.startPoint() +) +SketchConstraintCoincidence_28 = Sketch_3.setCoincident( + SketchLine_75.endPoint(), SketchLine_76.endPoint() +) SketchLine_77 = Sketch_3.addLine(29, 37.49999999999999, 30, 37.5) -SketchConstraintCoincidence_29 = Sketch_3.setCoincident(SketchLine_73.startPoint(), SketchLine_77.startPoint()) -SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchLine_71.endPoint(), SketchLine_77.endPoint()) -SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchLine_72.startPoint(), SketchLine_77.endPoint()) +SketchConstraintCoincidence_29 = Sketch_3.setCoincident( + SketchLine_73.startPoint(), SketchLine_77.startPoint() +) +SketchConstraintCoincidence_30 = Sketch_3.setCoincident( + SketchLine_71.endPoint(), SketchLine_77.endPoint() +) +SketchConstraintCoincidence_31 = Sketch_3.setCoincident( + SketchLine_72.startPoint(), SketchLine_77.endPoint() +) SketchLine_78 = Sketch_3.addLine(30, 37.5, 30, 36.49999999999999) -SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchLine_71.endPoint(), SketchLine_78.startPoint()) -SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchLine_72.startPoint(), SketchLine_78.startPoint()) -SketchConstraintCoincidence_34 = Sketch_3.setCoincident(SketchLine_77.endPoint(), SketchLine_78.startPoint()) -SketchConstraintCoincidence_35 = Sketch_3.setCoincident(SketchLine_73.endPoint(), SketchLine_78.endPoint()) +SketchConstraintCoincidence_32 = Sketch_3.setCoincident( + SketchLine_71.endPoint(), SketchLine_78.startPoint() +) +SketchConstraintCoincidence_33 = Sketch_3.setCoincident( + SketchLine_72.startPoint(), SketchLine_78.startPoint() +) +SketchConstraintCoincidence_34 = Sketch_3.setCoincident( + SketchLine_77.endPoint(), SketchLine_78.startPoint() +) +SketchConstraintCoincidence_35 = Sketch_3.setCoincident( + SketchLine_73.endPoint(), SketchLine_78.endPoint() +) SketchLine_79 = Sketch_3.addLine(0, 0, 0, 15) SketchLine_79.setAuxiliary(True) -SketchConstraintCoincidence_36 = Sketch_3.setCoincident(SketchLine_79.startPoint(), SketchPoint_3.result()) +SketchConstraintCoincidence_36 = Sketch_3.setCoincident( + SketchLine_79.startPoint(), SketchPoint_3.result() +) SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_79.result()) SketchConstraintLength_8 = Sketch_3.setLength(SketchLine_79.result(), "R-R_fillet") SketchLine_80 = Sketch_3.addLine(0, 15, 0.5, 15) SketchLine_80.setAuxiliary(True) -SketchConstraintCoincidence_37 = Sketch_3.setCoincident(SketchLine_79.endPoint(), SketchLine_80.startPoint()) +SketchConstraintCoincidence_37 = Sketch_3.setCoincident( + SketchLine_79.endPoint(), SketchLine_80.startPoint() +) SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_80.result()) SketchArc_61 = Sketch_3.addArc(0.5, 15, 0, 15, 0.5, 15.5, True) -SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchLine_80.endPoint(), SketchArc_61.center()) -SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_79.endPoint(), SketchArc_61.startPoint()) -SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_80.startPoint(), SketchArc_61.startPoint()) +SketchConstraintCoincidence_38 = Sketch_3.setCoincident( + SketchLine_80.endPoint(), SketchArc_61.center() +) +SketchConstraintCoincidence_39 = Sketch_3.setCoincident( + SketchLine_79.endPoint(), SketchArc_61.startPoint() +) +SketchConstraintCoincidence_40 = Sketch_3.setCoincident( + SketchLine_80.startPoint(), SketchArc_61.startPoint() +) SketchLine_81 = Sketch_3.addLine(0.5, 15, 0.5, 16) SketchLine_81.setAuxiliary(True) -SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_80.endPoint(), SketchLine_81.startPoint()) -SketchConstraintCoincidence_42 = Sketch_3.setCoincident(SketchArc_61.center(), SketchLine_81.startPoint()) +SketchConstraintCoincidence_41 = Sketch_3.setCoincident( + SketchLine_80.endPoint(), SketchLine_81.startPoint() +) +SketchConstraintCoincidence_42 = Sketch_3.setCoincident( + SketchArc_61.center(), SketchLine_81.startPoint() +) SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_81.result()) -SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchArc_61.endPoint(), SketchLine_81.result()) +SketchConstraintCoincidence_43 = Sketch_3.setCoincident( + SketchArc_61.endPoint(), SketchLine_81.result() +) SketchConstraintRadius_3 = Sketch_3.setRadius(SketchArc_61.results()[1], "R_fillet") SketchLine_82 = Sketch_3.addLine(0.5, 15.5, 0.5, 16) -SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchArc_61.endPoint(), SketchLine_82.startPoint()) +SketchConstraintCoincidence_44 = Sketch_3.setCoincident( + SketchArc_61.endPoint(), SketchLine_82.startPoint() +) SketchLine_83 = Sketch_3.addLine(0.5, 16, -0.5, 16) -SketchConstraintCoincidence_45 = Sketch_3.setCoincident(SketchLine_82.endPoint(), SketchLine_83.startPoint()) +SketchConstraintCoincidence_45 = Sketch_3.setCoincident( + SketchLine_82.endPoint(), SketchLine_83.startPoint() +) SketchLine_84 = Sketch_3.addLine(-0.5, 16, -0.5, 15) -SketchConstraintCoincidence_46 = Sketch_3.setCoincident(SketchLine_83.endPoint(), SketchLine_84.startPoint()) +SketchConstraintCoincidence_46 = Sketch_3.setCoincident( + SketchLine_83.endPoint(), SketchLine_84.startPoint() +) SketchLine_85 = Sketch_3.addLine(-0.5, 15, 0, 15) -SketchConstraintCoincidence_47 = Sketch_3.setCoincident(SketchLine_84.endPoint(), SketchLine_85.startPoint()) -SketchConstraintCoincidence_48 = Sketch_3.setCoincident(SketchLine_79.endPoint(), SketchLine_85.endPoint()) -SketchConstraintCoincidence_49 = Sketch_3.setCoincident(SketchLine_80.startPoint(), SketchLine_85.endPoint()) -SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchArc_61.startPoint(), SketchLine_85.endPoint()) -SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchLine_81.endPoint(), SketchLine_83.startPoint()) -SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchLine_85.startPoint(), SketchLine_80.result()) +SketchConstraintCoincidence_47 = Sketch_3.setCoincident( + SketchLine_84.endPoint(), SketchLine_85.startPoint() +) +SketchConstraintCoincidence_48 = Sketch_3.setCoincident( + SketchLine_79.endPoint(), SketchLine_85.endPoint() +) +SketchConstraintCoincidence_49 = Sketch_3.setCoincident( + SketchLine_80.startPoint(), SketchLine_85.endPoint() +) +SketchConstraintCoincidence_50 = Sketch_3.setCoincident( + SketchArc_61.startPoint(), SketchLine_85.endPoint() +) +SketchConstraintCoincidence_51 = Sketch_3.setCoincident( + SketchLine_81.endPoint(), SketchLine_83.startPoint() +) +SketchConstraintCoincidence_52 = Sketch_3.setCoincident( + SketchLine_85.startPoint(), SketchLine_80.result() +) SketchConstraintVertical_9 = Sketch_3.setVertical(SketchLine_84.result()) 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("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")) +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")) -SketchConstraintCoincidence_51 = Sketch_4.setCoincident(SketchLine_86.startPoint(), SketchLine_87.result()) +SketchConstraintCoincidence_51 = Sketch_4.setCoincident( + SketchLine_86.startPoint(), SketchLine_87.result() +) SketchLine_88 = Sketch_4.addLine(3.1, -13.49999999999519, 3.1, -10.55414610473955) -SketchConstraintCoincidence_52 = Sketch_4.setCoincident(SketchLine_86.endPoint(), SketchLine_88.startPoint()) +SketchConstraintCoincidence_52 = Sketch_4.setCoincident( + SketchLine_86.endPoint(), SketchLine_88.startPoint() +) SketchLine_89 = Sketch_4.addLine(0, -10.5290802744499, 0, 12.80434395246332) SketchLine_89.setAuxiliary(True) -SketchConstraintCoincidence_53 = Sketch_4.setCoincident(SketchLine_89.startPoint(), SketchLine_87.result()) +SketchConstraintCoincidence_53 = Sketch_4.setCoincident( + SketchLine_89.startPoint(), SketchLine_87.result() +) SketchConstraintVertical_9 = Sketch_4.setVertical(SketchLine_89.result()) SketchConstraintHorizontal_6 = Sketch_4.setHorizontal(SketchLine_86.result()) SketchConstraintVertical_10 = Sketch_4.setVertical(SketchLine_88.result()) SketchConstraintLength_9 = Sketch_4.setLength(SketchLine_86.result(), 3.1) -SketchConstraintMirror_2 = Sketch_4.addMirror(SketchLine_87.result(), [SketchLine_86.result(), SketchLine_88.result()]) +SketchConstraintMirror_2 = Sketch_4.addMirror( + SketchLine_87.result(), [SketchLine_86.result(), SketchLine_88.result()] +) [SketchLine_90, SketchLine_91] = SketchConstraintMirror_2.mirrored() -SketchArc_62 = Sketch_4.addArc(0, 0, 3.1, -10.55414610473955, -3.100000000000001, -10.55414610473344, False) -SketchConstraintCoincidence_54 = Sketch_4.setCoincident(SketchPoint_4.coordinates(), SketchArc_62.center()) -SketchConstraintCoincidence_55 = Sketch_4.setCoincident(SketchLine_87.startPoint(), SketchArc_62.center()) -SketchConstraintCoincidence_56 = Sketch_4.setCoincident(SketchArc_62.startPoint(), SketchLine_88.result()) -SketchConstraintCoincidence_57 = Sketch_4.setCoincident(SketchArc_62.endPoint(), SketchLine_91.result()) +SketchArc_62 = Sketch_4.addArc( + 0, 0, 3.1, -10.55414610473955, -3.100000000000001, -10.55414610473344, False +) +SketchConstraintCoincidence_54 = Sketch_4.setCoincident( + SketchPoint_4.coordinates(), SketchArc_62.center() +) +SketchConstraintCoincidence_55 = Sketch_4.setCoincident( + SketchLine_87.startPoint(), SketchArc_62.center() +) +SketchConstraintCoincidence_56 = Sketch_4.setCoincident( + SketchArc_62.startPoint(), SketchLine_88.result() +) +SketchConstraintCoincidence_57 = Sketch_4.setCoincident( + SketchArc_62.endPoint(), SketchLine_91.result() +) SketchConstraintRadius_4 = Sketch_4.setRadius(SketchArc_62.results()[1], 11) -SketchConstraintCoincidence_58 = Sketch_4.setCoincident(SketchLine_88.endPoint(), SketchArc_62.startPoint()) +SketchConstraintCoincidence_58 = Sketch_4.setCoincident( + SketchLine_88.endPoint(), SketchArc_62.startPoint() +) SketchPoint_5 = Sketch_4.addPoint(3.1, -10.55414610473955) -SketchConstraintCoincidence_59 = Sketch_4.setCoincident(SketchLine_88.endPoint(), SketchPoint_5.coordinates()) -SketchConstraintCoincidence_60 = Sketch_4.setCoincident(SketchArc_62.startPoint(), SketchPoint_5.coordinates()) +SketchConstraintCoincidence_59 = Sketch_4.setCoincident( + SketchLine_88.endPoint(), SketchPoint_5.coordinates() +) +SketchConstraintCoincidence_60 = Sketch_4.setCoincident( + SketchArc_62.startPoint(), SketchPoint_5.coordinates() +) SketchPoint_6 = Sketch_4.addPoint(0, 11.00000000000481) SketchPoint_6.setAuxiliary(True) -SketchConstraintCoincidence_61 = Sketch_4.setCoincident(SketchPoint_6.coordinates(), SketchArc_62.results()[1]) -SketchConstraintCoincidence_62 = Sketch_4.setCoincident(SketchPoint_6.coordinates(), SketchLine_89.result()) -SketchConstraintDistance_6 = Sketch_4.setDistance(SketchPoint_6.coordinates(), SketchLine_86.result(), 24.5) +SketchConstraintCoincidence_61 = Sketch_4.setCoincident( + SketchPoint_6.coordinates(), SketchArc_62.results()[1] +) +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&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")]) +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() # Test reexecution after parameter change diff --git a/test.compatibility/idler_plate.py b/test.compatibility/idler_plate.py index 5ea06d8e0..bb99328a3 100644 --- a/test.compatibility/idler_plate.py +++ b/test.compatibility/idler_plate.py @@ -31,140 +31,458 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 17.71094752491076, 14.8612495359528) SketchLine_1.setAuxiliary(True) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintAngle_1 = Sketch_1.setAngleBackward(SketchLine_1.result(), SketchLine_2.result(), 40.00000000000006) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.startPoint()) -SketchArc_1 = Sketch_1.addArc(0, 0, 17.71094752491076, 14.8612495359528, 23.12, -6.011798491948799e-033, True) +SketchConstraintAngle_1 = Sketch_1.setAngleBackward( + SketchLine_1.result(), SketchLine_2.result(), 40.00000000000006 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.startPoint() +) +SketchArc_1 = Sketch_1.addArc( + 0, 0, 17.71094752491076, 14.8612495359528, 23.12, -6.011798491948799e-033, True +) SketchArc_1.setAuxiliary(True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.center()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchArc_1.endPoint(), 23.12) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_1.center() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_1.endPoint() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_2.startPoint(), SketchArc_1.endPoint(), 23.12 +) SketchArc_2 = Sketch_1.addArc(23.12, -6.011798491948799e-033, 18.74, 0, 27.5, 0, False) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.center()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_2.endPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchArc_2.center() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_2.endPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_2.results()[1], "ob2") -SketchArc_3 = Sketch_1.addArc(0, 0, 18.74, 0, 14.35567286404965, 12.04583980552575, False) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_3.center()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchArc_3.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_3.endPoint()) +SketchArc_3 = Sketch_1.addArc( + 0, 0, 18.74, 0, 14.35567286404965, 12.04583980552575, False +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_3.center() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchArc_3.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_3.endPoint() +) SketchArc_4 = Sketch_1.addArc(0, 0, 27.5, 0, 21.0662221857694, 17.67665926638303, False) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_4.center()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_4.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_1.result()) -SketchArc_5 = Sketch_1.addArc(17.71094752491078, 14.86124953595279, 14.35567286404965, 12.04583980552575, 21.0662221857694, 17.67665926638303, True) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchArc_5.startPoint()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchArc_5.endPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchArc_3.results()[1]) -SketchArc_6 = Sketch_1.addArc(-34.92, 0, -34.92, 4.370000000000002, -34.91999999999997, -4.370000000000019, False) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_6.center(), SketchLine_2.result()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_4.center() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_1.result() +) +SketchArc_5 = Sketch_1.addArc( + 17.71094752491078, + 14.86124953595279, + 14.35567286404965, + 12.04583980552575, + 21.0662221857694, + 17.67665926638303, + True, +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchArc_5.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchArc_5.endPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_5.results()[1], SketchArc_3.results()[1] +) +SketchArc_6 = Sketch_1.addArc( + -34.92, 0, -34.92, 4.370000000000002, -34.91999999999997, -4.370000000000019, False +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_6.center(), SketchLine_2.result() +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_6.results()[1], "ob1") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchArc_6.center(), SketchArc_2.center(), 58.04) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchArc_6.center(), SketchArc_2.center(), 58.04 +) SketchLine_3 = Sketch_1.addLine(-24.92, 4.37, -34.92, 4.370000000000002) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_6.startPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchArc_6.startPoint(), SketchLine_3.endPoint() +) SketchLine_4 = Sketch_1.addLine(-24.92, -4.37, -34.91999999999997, -4.370000000000019) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_4.endPoint()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchArc_6.endPoint(), SketchLine_4.endPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_6.results()[1]) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_6.results()[1]) -SketchArc_7 = Sketch_1.addArc(-24.92, 1.467818159729891e-016, -24.92, 4.37, -24.92, -4.37, True) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchArc_7.startPoint()) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchArc_7.endPoint()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_7.results()[1]) -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_7.results()[1], SketchLine_4.result()) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchArc_6.center(), SketchArc_7.center(), 10) -SketchCircle_1 = Sketch_1.addCircle(9.498292007139793e-031, -4.263345141625117e-031, 5.625) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.center()) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_6.results()[1] +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchLine_4.result(), SketchArc_6.results()[1] +) +SketchArc_7 = Sketch_1.addArc( + -24.92, 1.467818159729891e-016, -24.92, 4.37, -24.92, -4.37, True +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchArc_7.startPoint() +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_4.startPoint(), SketchArc_7.endPoint() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_7.results()[1] +) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchArc_7.results()[1], SketchLine_4.result() +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchArc_6.center(), SketchArc_7.center(), 10 +) +SketchCircle_1 = Sketch_1.addCircle( + 9.498292007139793e-031, -4.263345141625117e-031, 5.625 +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.center() +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchCircle_1.results()[1], "axe/2") SketchCircle_2 = Sketch_1.addCircle(-7.5, 18.75, 3.75) SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], "trou/2") SketchLine_5 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_5.result(), SketchCircle_2.center(), 7.5) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_2.result(), SketchCircle_2.center(), 18.75) -SketchArc_8 = Sketch_1.addArc(-34.92, -6.497717112746075e-027, -34.91999999999937, 7.500000000006299, -36.26235395189003, -7.378894623711957, False) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_6.center(), SketchArc_8.center()) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_5.result(), SketchCircle_2.center(), 7.5 +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_2.result(), SketchCircle_2.center(), 18.75 +) +SketchArc_8 = Sketch_1.addArc( + -34.92, + -6.497717112746075e-027, + -34.91999999999937, + 7.500000000006299, + -36.26235395189003, + -7.378894623711957, + False, +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchArc_6.center(), SketchArc_8.center() +) SketchConstraintRadius_5 = Sketch_1.setRadius(SketchArc_8.results()[1], 7.5) -SketchArc_9 = Sketch_1.addArc(-7.5, 18.75, 0.0511741035599095, 21.7492323447386, -15.3796231578326, 20.73170731707517, False) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchArc_9.center()) +SketchArc_9 = Sketch_1.addArc( + -7.5, + 18.75, + 0.0511741035599095, + 21.7492323447386, + -15.3796231578326, + 20.73170731707517, + False, +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchCircle_2.center(), SketchArc_9.center() +) SketchConstraintRadius_6 = Sketch_1.setRadius(SketchArc_9.results()[1], "16.25/2") -SketchArc_10 = Sketch_1.addArc(-32.35111919008745, 25.0000000000063, -15.3796231578326, 20.73170731707517, -32.35111919008745, 7.500000000006299, True) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchArc_9.endPoint(), SketchArc_10.startPoint()) -SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_9.results()[1], SketchArc_10.results()[1]) +SketchArc_10 = Sketch_1.addArc( + -32.35111919008745, + 25.0000000000063, + -15.3796231578326, + 20.73170731707517, + -32.35111919008745, + 7.500000000006299, + True, +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchArc_9.endPoint(), SketchArc_10.startPoint() +) +SketchConstraintTangent_6 = Sketch_1.setTangent( + SketchArc_9.results()[1], SketchArc_10.results()[1] +) SketchConstraintRadius_7 = Sketch_1.setRadius(SketchArc_10.results()[1], 17.5) -SketchLine_6 = Sketch_1.addLine(-34.91999999999937, 7.500000000006299, -32.35111919008745, 7.500000000006299) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchArc_8.startPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_10.endPoint(), SketchLine_6.endPoint()) +SketchLine_6 = Sketch_1.addLine( + -34.91999999999937, 7.500000000006299, -32.35111919008745, 7.500000000006299 +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchArc_8.startPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchArc_10.endPoint(), SketchLine_6.endPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) -SketchConstraintTangent_7 = Sketch_1.setTangent(SketchLine_6.result(), SketchArc_10.results()[1]) -SketchArc_11 = Sketch_1.addArc(2.841203857564676e-031, -1.848261526152319e-031, -2.46098224513173, -13.52797347680525, 10.54941392733564, -8.818864200663077, False) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_11.center()) +SketchConstraintTangent_7 = Sketch_1.setTangent( + SketchLine_6.result(), SketchArc_10.results()[1] +) +SketchArc_11 = Sketch_1.addArc( + 2.841203857564676e-031, + -1.848261526152319e-031, + -2.46098224513173, + -13.52797347680525, + 10.54941392733564, + -8.818864200663077, + False, +) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_11.center() +) SketchConstraintRadius_8 = Sketch_1.setRadius(SketchArc_11.results()[1], 13.75) -SketchLine_7 = Sketch_1.addLine(-36.26235395189003, -7.378894623711957, -2.460982245131729, -13.52797347680525) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchArc_11.startPoint(), SketchLine_7.endPoint()) -SketchConstraintTangent_8 = Sketch_1.setTangent(SketchLine_7.result(), SketchArc_8.results()[1]) -SketchConstraintTangent_9 = Sketch_1.setTangent(SketchLine_7.result(), SketchArc_11.results()[1]) -SketchArc_12 = Sketch_1.addArc(23.12, 7.384930033544359e-028, 18.58435121107267, -7.482672655108066, 31.87, -1.068593854246008e-030, False) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_12.center()) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_12.endPoint()) -SketchArc_13 = Sketch_1.addArc(15.34460207612463, -12.82743883732818, 10.5494139273357, -8.818864200663123, 18.58435121107276, -7.482672655108122, True) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_11.endPoint(), SketchArc_13.startPoint()) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_12.startPoint(), SketchArc_13.endPoint()) -SketchConstraintTangent_10 = Sketch_1.setTangent(SketchArc_13.results()[1], SketchArc_12.results()[1]) +SketchLine_7 = Sketch_1.addLine( + -36.26235395189003, -7.378894623711957, -2.460982245131729, -13.52797347680525 +) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchArc_8.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchArc_11.startPoint(), SketchLine_7.endPoint() +) +SketchConstraintTangent_8 = Sketch_1.setTangent( + SketchLine_7.result(), SketchArc_8.results()[1] +) +SketchConstraintTangent_9 = Sketch_1.setTangent( + SketchLine_7.result(), SketchArc_11.results()[1] +) +SketchArc_12 = Sketch_1.addArc( + 23.12, + 7.384930033544359e-028, + 18.58435121107267, + -7.482672655108066, + 31.87, + -1.068593854246008e-030, + False, +) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchArc_12.center() +) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_12.endPoint() +) +SketchArc_13 = Sketch_1.addArc( + 15.34460207612463, + -12.82743883732818, + 10.5494139273357, + -8.818864200663123, + 18.58435121107276, + -7.482672655108122, + True, +) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchArc_11.endPoint(), SketchArc_13.startPoint() +) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchArc_12.startPoint(), SketchArc_13.endPoint() +) +SketchConstraintTangent_10 = Sketch_1.setTangent( + SketchArc_13.results()[1], SketchArc_12.results()[1] +) SketchConstraintRadius_9 = Sketch_1.setRadius(SketchArc_12.results()[1], 8.75) -SketchConstraintTangent_11 = Sketch_1.setTangent(SketchArc_13.results()[1], SketchArc_11.results()[1]) -SketchArc_14 = Sketch_1.addArc(7.217739748128488e-031, -7.397577026331382e-031, 31.87, 1.64056023214913e-033, 24.41383640220182, 20.48564112071002, False) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_14.center()) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_12.endPoint(), SketchArc_14.startPoint()) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchLine_1.result()) -SketchArc_15 = Sketch_1.addArc(17.71094752491077, 14.86124953595279, 24.41383640220183, 20.48564112071001, 10.79776038328427, 20.22504889320414, False) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_15.center()) -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchArc_15.startPoint()) -SketchArc_16 = Sketch_1.addArc(5.859769567836763, 24.05633414838368, 10.79776038328427, 20.22504889320414, 0.05117410355990894, 21.7492323447386, True) -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchArc_15.endPoint(), SketchArc_16.startPoint()) -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchArc_9.startPoint(), SketchArc_16.endPoint()) -SketchConstraintTangent_12 = Sketch_1.setTangent(SketchArc_16.results()[1], SketchArc_15.results()[1]) -SketchConstraintTangent_13 = Sketch_1.setTangent(SketchArc_16.results()[1], SketchArc_9.results()[1]) +SketchConstraintTangent_11 = Sketch_1.setTangent( + SketchArc_13.results()[1], SketchArc_11.results()[1] +) +SketchArc_14 = Sketch_1.addArc( + 7.217739748128488e-031, + -7.397577026331382e-031, + 31.87, + 1.64056023214913e-033, + 24.41383640220182, + 20.48564112071002, + False, +) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_14.center() +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchArc_12.endPoint(), SketchArc_14.startPoint() +) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchArc_14.endPoint(), SketchLine_1.result() +) +SketchArc_15 = Sketch_1.addArc( + 17.71094752491077, + 14.86124953595279, + 24.41383640220183, + 20.48564112071001, + 10.79776038328427, + 20.22504889320414, + False, +) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchArc_15.center() +) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchArc_14.endPoint(), SketchArc_15.startPoint() +) +SketchArc_16 = Sketch_1.addArc( + 5.859769567836763, + 24.05633414838368, + 10.79776038328427, + 20.22504889320414, + 0.05117410355990894, + 21.7492323447386, + True, +) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchArc_15.endPoint(), SketchArc_16.startPoint() +) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchArc_9.startPoint(), SketchArc_16.endPoint() +) +SketchConstraintTangent_12 = Sketch_1.setTangent( + SketchArc_16.results()[1], SketchArc_15.results()[1] +) +SketchConstraintTangent_13 = Sketch_1.setTangent( + SketchArc_16.results()[1], SketchArc_9.results()[1] +) 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]) +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_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) +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/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/SketchArc_8_2_StartVertex")) +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/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()) -SketchLine_8 = Sketch_2.addLine(-34.91999999999937, 7.500000000006299, -24.92, 7.500000000006299) -SketchConstraintCoincidence_44 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_45 = Sketch_2.setCoincident(SketchArc_17.startPoint(), SketchLine_8.endPoint()) -SketchLine_9 = Sketch_2.addLine(-34.92003434105975, -7.500000000006299, -24.92, -7.500000000006299) -SketchConstraintCoincidence_46 = Sketch_2.setCoincident(SketchArc_18.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_47 = Sketch_2.setCoincident(SketchArc_17.endPoint(), SketchLine_9.endPoint()) +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() +) +SketchLine_8 = Sketch_2.addLine( + -34.91999999999937, 7.500000000006299, -24.92, 7.500000000006299 +) +SketchConstraintCoincidence_44 = Sketch_2.setCoincident( + SketchPoint_2.coordinates(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_45 = Sketch_2.setCoincident( + SketchArc_17.startPoint(), SketchLine_8.endPoint() +) +SketchLine_9 = Sketch_2.addLine( + -34.92003434105975, -7.500000000006299, -24.92, -7.500000000006299 +) +SketchConstraintCoincidence_46 = Sketch_2.setCoincident( + SketchArc_18.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_47 = Sketch_2.setCoincident( + SketchArc_17.endPoint(), SketchLine_9.endPoint() +) 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/SketchCircle_2_2__cc")) +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/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()) +SketchConstraintCoincidence_48 = Sketch_2.setCoincident( + SketchPoint_4.result(), SketchCircle_3.center() +) 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/SketchCircle_1_2__cc")) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchCircle_3.results()[1], SketchArc_19.results()[1] +) +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()) +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/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")], []) +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() # Test reexecution after parameter change diff --git a/test.compatibility/piece_02.py b/test.compatibility/piece_02.py index 3e4594854..ff620e251 100644 --- a/test.compatibility/piece_02.py +++ b/test.compatibility/piece_02.py @@ -26,244 +26,576 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(0, 4.99999999998656, 0, 40.99999999998656) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OZ")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) SketchLine_3 = Sketch_1.addLine(4.999999999986844, 0, 36.99999999998685, 0) SketchLine_4 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_4.result()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.result()) -SketchLine_5 = Sketch_1.addLine(4.999999999999999, 45.99999999998655, 37, 45.99999999998655) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_4.result() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.result() +) +SketchLine_5 = Sketch_1.addLine( + 4.999999999999999, 45.99999999998655, 37, 45.99999999998655 +) SketchLine_6 = Sketch_1.addLine(42, 40.99999999998655, 42, 4.999999999986548) -SketchArc_1 = Sketch_1.addArc(5, 40.99999999998656, 0, 40.99999999998656, 4.999999999999999, 45.99999999998656, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_1.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_1.result(), SketchArc_1.results()[1]) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.result(), SketchArc_1.endPoint()) -SketchArc_2 = Sketch_1.addArc(37, 40.99999999998655, 37, 45.99999999998655, 42, 40.99999999998655, True) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchArc_2.startPoint()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_5.result(), SketchArc_2.results()[1]) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.result(), SketchArc_2.endPoint()) -SketchArc_3 = Sketch_1.addArc(4.999999999986827, 4.999999999986823, 0, 4.99999999998656, 4.999999999986844, 0, False) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchLine_1.result(), SketchArc_3.results()[1]) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_3.result(), SketchArc_3.endPoint()) -SketchArc_4 = Sketch_1.addArc(36.99999999998375, 5.000000000004257, 36.99999999998685, 0, 42, 4.999999999986548, False) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_4.startPoint()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_4.results()[1]) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_6.result(), SketchArc_4.endPoint()) +SketchArc_1 = Sketch_1.addArc( + 5, + 40.99999999998656, + 0, + 40.99999999998656, + 4.999999999999999, + 45.99999999998656, + True, +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_1.result(), SketchArc_1.results()[1] +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.result(), SketchArc_1.endPoint() +) +SketchArc_2 = Sketch_1.addArc( + 37, 40.99999999998655, 37, 45.99999999998655, 42, 40.99999999998655, True +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_5.result(), SketchArc_2.results()[1] +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_6.result(), SketchArc_2.endPoint() +) +SketchArc_3 = Sketch_1.addArc( + 4.999999999986827, + 4.999999999986823, + 0, + 4.99999999998656, + 4.999999999986844, + 0, + False, +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchLine_1.result(), SketchArc_3.results()[1] +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchArc_3.endPoint() +) +SketchArc_4 = Sketch_1.addArc( + 36.99999999998375, + 5.000000000004257, + 36.99999999998685, + 0, + 42, + 4.999999999986548, + False, +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_4.results()[1] +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_6.result(), SketchArc_4.endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_6.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_5.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_3.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_6.result(), SketchLine_1.result()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchArc_4.endPoint()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_3.startPoint()) -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_6.result()) -SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_5.result()) -SketchConstraintTangent_7 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_3.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchArc_1.results()[1], SketchArc_2.results()[1]) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_3.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_6.result(), SketchLine_1.result() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_6.result() +) +SketchConstraintTangent_6 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_5.result() +) +SketchConstraintTangent_7 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_3.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchArc_1.results()[1], SketchArc_2.results()[1] +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_2.results()[1], 5) 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()) +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-SketchArc_3_2f-SketchLine_3f-SketchArc_4_2f-SketchLine_6r-SketchArc_2_2f-SketchLine_5r-SketchArc_1_2f-SketchLine_1r")], model.selection(), 76, 0) +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 = 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&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]")) +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 = 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&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]")) +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 = 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&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]")) +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&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) -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchLine_8.result()) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchPoint_1.coordinates(), SketchLine_8.result() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_20") -SketchConstraintMiddle_3 = Sketch_2.setMiddlePoint(SketchPoint_1.coordinates(), SketchLine_8.result()) +SketchConstraintMiddle_3 = Sketch_2.setMiddlePoint( + SketchPoint_1.coordinates(), SketchLine_8.result() +) SketchCircle_1 = Sketch_2.addCircle(20.99999999999342, 22.99999999999327, 19) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchCircle_1.center()) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchPoint_1.coordinates(), SketchCircle_1.center() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_21") SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 19) SketchCircle_2 = Sketch_2.addCircle(12.99999999999342, 22.99999999998655, 2.5) SketchCircle_3 = Sketch_2.addCircle(28.99999999999342, 22.99999999998655, 2.5) SketchCircle_4 = Sketch_2.addCircle(20.99999999999113, 14.99999999998655, 2.5) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_8.result(), SketchCircle_4.center()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchLine_8.result(), SketchCircle_4.center() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_22") -SketchConstraintEqual_4 = Sketch_2.setEqual(SketchCircle_2.results()[1], SketchCircle_3.results()[1]) -SketchConstraintEqual_5 = Sketch_2.setEqual(SketchCircle_3.results()[1], SketchCircle_4.results()[1]) -SketchLine_12 = Sketch_2.addLine(2.465190328815662e-32, 22.99999999998655, 41.99999999999999, 22.99999999998655) +SketchConstraintEqual_4 = Sketch_2.setEqual( + SketchCircle_2.results()[1], SketchCircle_3.results()[1] +) +SketchConstraintEqual_5 = Sketch_2.setEqual( + SketchCircle_3.results()[1], SketchCircle_4.results()[1] +) +SketchLine_12 = Sketch_2.addLine( + 2.465190328815662e-32, 22.99999999998655, 41.99999999999999, 22.99999999998655 +) SketchLine_12.setName("SketchLine_13") SketchLine_12.result().setName("SketchLine_13") SketchLine_12.setAuxiliary(True) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_12.startPoint(), SketchLine_7.result()) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_12.startPoint(), SketchLine_7.result() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_23") -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_11.result()) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_11.result() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_24") SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_12.result()) -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchCircle_2.center(), SketchCircle_3.center(), 16) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchCircle_2.center(), SketchLine_12.result()) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchCircle_2.center(), SketchCircle_3.center(), 16 +) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchCircle_2.center(), SketchLine_12.result() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_25") -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchLine_12.result()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchCircle_3.center(), SketchLine_12.result() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_26") -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_2.center(), SketchLine_8.result(), 8) -SketchConstraintMiddle_4 = Sketch_2.setMiddlePoint(SketchLine_12.endPoint(), SketchLine_11.result()) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_2.center(), SketchLine_8.result(), 8 +) +SketchConstraintMiddle_4 = Sketch_2.setMiddlePoint( + SketchLine_12.endPoint(), SketchLine_11.result() +) SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_2.results()[1], 2.5) -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchLine_12.result(), SketchCircle_4.center(), 8) +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/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")]) +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) -SketchLine_13 = Sketch_3.addLine(41.99999999999999, 22.99999999998655, 0, 22.99999999998656) +SketchLine_13 = Sketch_3.addLine( + 41.99999999999999, 22.99999999998655, 0, 22.99999999998656 +) 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/Modified_Face&Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]")) +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 = 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&Sketch_1/SketchLine_1][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face]")) +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()) +SketchConstraintCoincidence_27 = Sketch_3.setCoincident( + SketchLine_13.endPoint(), SketchLine_15.result() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_28") 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/Modified_Face&Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]")) +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 = Sketch_3.setCoincident( + SketchLine_16.startPoint(), SketchLine_17.result() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_29") 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()) +SketchConstraintCoincidence_29 = Sketch_3.setCoincident( + SketchLine_16.endPoint(), SketchLine_18.result() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_30") -SketchConstraintMiddle_5 = Sketch_3.setMiddlePoint(SketchLine_16.startPoint(), SketchLine_17.result()) -SketchConstraintMiddle_6 = Sketch_3.setMiddlePoint(SketchLine_16.endPoint(), SketchLine_18.result()) -SketchConstraintMiddle_7 = Sketch_3.setMiddlePoint(SketchLine_13.endPoint(), SketchLine_15.result()) -SketchConstraintMiddle_8 = Sketch_3.setMiddlePoint(SketchLine_13.startPoint(), SketchLine_14.result()) +SketchConstraintMiddle_5 = Sketch_3.setMiddlePoint( + SketchLine_16.startPoint(), SketchLine_17.result() +) +SketchConstraintMiddle_6 = Sketch_3.setMiddlePoint( + SketchLine_16.endPoint(), SketchLine_18.result() +) +SketchConstraintMiddle_7 = Sketch_3.setMiddlePoint( + SketchLine_13.endPoint(), SketchLine_15.result() +) +SketchConstraintMiddle_8 = Sketch_3.setMiddlePoint( + SketchLine_13.startPoint(), SketchLine_14.result() +) SketchPoint_2 = Sketch_3.addPoint(20.99999999999342, 22.99999999999327) -SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchPoint_2.coordinates(), SketchLine_16.result()) +SketchConstraintCoincidence_30 = Sketch_3.setCoincident( + SketchPoint_2.coordinates(), SketchLine_16.result() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_31") -SketchConstraintMiddle_9 = Sketch_3.setMiddlePoint(SketchLine_16.result(), SketchPoint_2.coordinates()) -SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchCircle_5.center(), SketchPoint_2.coordinates()) +SketchConstraintMiddle_9 = Sketch_3.setMiddlePoint( + SketchLine_16.result(), SketchPoint_2.coordinates() +) +SketchConstraintCoincidence_31 = Sketch_3.setCoincident( + SketchCircle_5.center(), SketchPoint_2.coordinates() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_32") SketchCircle_6 = Sketch_3.addCircle(28.99999999999342, 22.99999999998655, 2.5) -SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchLine_13.result(), SketchCircle_6.center()) +SketchConstraintCoincidence_32 = Sketch_3.setCoincident( + SketchLine_13.result(), SketchCircle_6.center() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_33") SketchCircle_7 = Sketch_3.addCircle(12.99999999999342, 22.99999999998656, 2.5) -SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchLine_13.result(), SketchCircle_7.center()) +SketchConstraintCoincidence_33 = Sketch_3.setCoincident( + SketchLine_13.result(), SketchCircle_7.center() +) SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_34") -SketchConstraintEqual_6 = Sketch_3.setEqual(SketchCircle_7.results()[1], SketchCircle_6.results()[1]) +SketchConstraintEqual_6 = Sketch_3.setEqual( + SketchCircle_7.results()[1], SketchCircle_6.results()[1] +) 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) +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_2r-SketchCircle_7_2r-SketchCircle_6_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&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) +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&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2]"), False) +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&Sketch_1/SketchArc_1_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]")) +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 = 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&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2]")) +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()) +SketchConstraintCoincidence_35 = Sketch_4.setCoincident( + SketchLine_21.endPoint(), SketchLine_23.result() +) SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_36") SketchLine_24 = Sketch_4.addLine(4.999999999999999, -48, 37, -48) SketchLine_24.setName("SketchLine_25") SketchLine_24.result().setName("SketchLine_25") -SketchConstraintCoincidence_36 = Sketch_4.setCoincident(SketchLine_24.startPoint(), SketchLine_22.result()) +SketchConstraintCoincidence_36 = Sketch_4.setCoincident( + SketchLine_24.startPoint(), SketchLine_22.result() +) SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_37") -SketchConstraintCoincidence_37 = Sketch_4.setCoincident(SketchLine_24.endPoint(), SketchLine_23.result()) +SketchConstraintCoincidence_37 = Sketch_4.setCoincident( + SketchLine_24.endPoint(), SketchLine_23.result() +) SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_38") SketchConstraintHorizontal_3 = Sketch_4.setHorizontal(SketchLine_21.result()) SketchConstraintHorizontal_4 = Sketch_4.setHorizontal(SketchLine_24.result()) SketchLine_25 = Sketch_4.addLine(3.593262427359596e-30, -33, 0, -43) SketchLine_25.setName("SketchLine_26") SketchLine_25.result().setName("SketchLine_26") -SketchConstraintCoincidence_38 = Sketch_4.setCoincident(SketchLine_25.startPoint(), SketchLine_19.result()) +SketchConstraintCoincidence_38 = Sketch_4.setCoincident( + SketchLine_25.startPoint(), SketchLine_19.result() +) SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_39") SketchLine_26 = Sketch_4.addLine(42, -33, 42, -43) SketchLine_26.setName("SketchLine_27") SketchLine_26.result().setName("SketchLine_27") -SketchConstraintCoincidence_40 = Sketch_4.setCoincident(SketchLine_26.startPoint(), SketchLine_20.result()) +SketchConstraintCoincidence_40 = Sketch_4.setCoincident( + SketchLine_26.startPoint(), SketchLine_20.result() +) SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_41") -SketchConstraintCoincidence_41 = Sketch_4.setCoincident(SketchLine_26.endPoint(), SketchLine_20.result()) +SketchConstraintCoincidence_41 = Sketch_4.setCoincident( + SketchLine_26.endPoint(), SketchLine_20.result() +) SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_42") -SketchArc_5 = Sketch_4.addArc(5, -33, 3.593262427359596e-30, -33, 4.999999999999999, -28, True) -SketchConstraintCoincidence_42 = Sketch_4.setCoincident(SketchLine_25.startPoint(), SketchArc_5.startPoint()) +SketchArc_5 = Sketch_4.addArc( + 5, -33, 3.593262427359596e-30, -33, 4.999999999999999, -28, True +) +SketchConstraintCoincidence_42 = Sketch_4.setCoincident( + SketchLine_25.startPoint(), SketchArc_5.startPoint() +) SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_43") -SketchConstraintTangent_9 = Sketch_4.setTangent(SketchLine_25.result(), SketchArc_5.results()[1]) +SketchConstraintTangent_9 = Sketch_4.setTangent( + SketchLine_25.result(), SketchArc_5.results()[1] +) SketchArc_6 = Sketch_4.addArc(5, -43, 0, -43, 4.999999999999999, -48, False) -SketchConstraintCoincidence_43 = Sketch_4.setCoincident(SketchLine_25.endPoint(), SketchArc_6.startPoint()) +SketchConstraintCoincidence_43 = Sketch_4.setCoincident( + SketchLine_25.endPoint(), SketchArc_6.startPoint() +) SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_44") -SketchConstraintTangent_10 = Sketch_4.setTangent(SketchLine_25.result(), SketchArc_6.results()[1]) +SketchConstraintTangent_10 = Sketch_4.setTangent( + SketchLine_25.result(), SketchArc_6.results()[1] +) SketchArc_7 = Sketch_4.addArc(37, -33, 37, -28, 42, -33, True) -SketchConstraintCoincidence_44 = Sketch_4.setCoincident(SketchLine_21.endPoint(), SketchArc_7.startPoint()) +SketchConstraintCoincidence_44 = Sketch_4.setCoincident( + SketchLine_21.endPoint(), SketchArc_7.startPoint() +) SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_45") -SketchConstraintTangent_11 = Sketch_4.setTangent(SketchLine_21.result(), SketchArc_7.results()[1]) +SketchConstraintTangent_11 = Sketch_4.setTangent( + SketchLine_21.result(), SketchArc_7.results()[1] +) SketchArc_8 = Sketch_4.addArc(37, -43, 37, -48, 42, -43, False) -SketchConstraintCoincidence_45 = Sketch_4.setCoincident(SketchLine_24.endPoint(), SketchArc_8.startPoint()) +SketchConstraintCoincidence_45 = Sketch_4.setCoincident( + SketchLine_24.endPoint(), SketchArc_8.startPoint() +) SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_46") -SketchConstraintTangent_12 = Sketch_4.setTangent(SketchLine_24.result(), SketchArc_8.results()[1]) -SketchConstraintDistance_6 = Sketch_4.setDistance(SketchLine_21.startPoint(), SketchLine_24.startPoint(), 20) -SketchConstraintEqual_7 = Sketch_4.setEqual(SketchLine_26.result(), SketchLine_25.result()) -SketchConstraintCoincidence_46 = Sketch_4.setCoincident(SketchArc_5.endPoint(), SketchLine_21.startPoint()) +SketchConstraintTangent_12 = Sketch_4.setTangent( + SketchLine_24.result(), SketchArc_8.results()[1] +) +SketchConstraintDistance_6 = Sketch_4.setDistance( + SketchLine_21.startPoint(), SketchLine_24.startPoint(), 20 +) +SketchConstraintEqual_7 = Sketch_4.setEqual( + SketchLine_26.result(), SketchLine_25.result() +) +SketchConstraintCoincidence_46 = Sketch_4.setCoincident( + SketchArc_5.endPoint(), SketchLine_21.startPoint() +) SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_47") -SketchConstraintCoincidence_47 = Sketch_4.setCoincident(SketchLine_26.startPoint(), SketchArc_7.endPoint()) +SketchConstraintCoincidence_47 = Sketch_4.setCoincident( + SketchLine_26.startPoint(), SketchArc_7.endPoint() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_48") -SketchConstraintCoincidence_48 = Sketch_4.setCoincident(SketchLine_26.endPoint(), SketchArc_8.endPoint()) +SketchConstraintCoincidence_48 = Sketch_4.setCoincident( + SketchLine_26.endPoint(), SketchArc_8.endPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_49") -SketchConstraintCoincidence_49 = Sketch_4.setCoincident(SketchLine_24.startPoint(), SketchArc_6.endPoint()) +SketchConstraintCoincidence_49 = Sketch_4.setCoincident( + SketchLine_24.startPoint(), SketchArc_6.endPoint() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_50") -SketchConstraintTangent_13 = Sketch_4.setTangent(SketchArc_5.results()[1], SketchLine_21.result()) -SketchConstraintTangent_14 = Sketch_4.setTangent(SketchArc_7.results()[1], SketchLine_26.result()) -SketchConstraintTangent_15 = Sketch_4.setTangent(SketchArc_8.results()[1], SketchLine_26.result()) +SketchConstraintTangent_13 = Sketch_4.setTangent( + SketchArc_5.results()[1], SketchLine_21.result() +) +SketchConstraintTangent_14 = Sketch_4.setTangent( + SketchArc_7.results()[1], SketchLine_26.result() +) +SketchConstraintTangent_15 = Sketch_4.setTangent( + SketchArc_8.results()[1], SketchLine_26.result() +) SketchLine_27 = Sketch_4.addLine(0, -38, 42, -38) SketchLine_27.setName("SketchLine_28") SketchLine_27.result().setName("SketchLine_28") SketchLine_27.setAuxiliary(True) -SketchConstraintCoincidence_51 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchLine_20.result()) +SketchConstraintCoincidence_51 = Sketch_4.setCoincident( + SketchLine_27.endPoint(), SketchLine_20.result() +) SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_52") -SketchConstraintMiddle_10 = Sketch_4.setMiddlePoint(SketchLine_27.endPoint(), SketchLine_20.result()) -SketchConstraintMiddle_11 = Sketch_4.setMiddlePoint(SketchLine_27.startPoint(), SketchLine_19.result()) -SketchConstraintMiddle_12 = Sketch_4.setMiddlePoint(SketchLine_25.result(), SketchLine_27.startPoint()) +SketchConstraintMiddle_10 = Sketch_4.setMiddlePoint( + SketchLine_27.endPoint(), SketchLine_20.result() +) +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-SketchArc_5_2f-SketchLine_26f-SketchArc_6_2f-SketchLine_25f-SketchArc_8_2f-SketchLine_27r-SketchArc_7_2f-SketchLine_22r")], model.selection(), 2, 17) +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") @@ -281,87 +613,211 @@ SketchConstraintHorizontal_5 = Sketch_5.setHorizontal(SketchLine_29.result()) SketchConstraintHorizontal_6 = Sketch_5.setHorizontal(SketchLine_28.result()) 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&Sketch_4/SketchLine_26][Extrusion_2_1/To_Face]")) +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&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&Sketch_4/SketchLine_27][Extrusion_2_1/To_Face]")) +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&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&Sketch_4/SketchLine_22][Extrusion_2_1/To_Face]")) +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&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&Sketch_4/SketchLine_25][Extrusion_2_1/To_Face]")) +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&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) +SketchConstraintDistance_10 = Sketch_5.setDistance( + SketchLine_28.startPoint(), SketchLine_35.result(), 2 +) SketchArc_9 = Sketch_5.addArc(5, -33, 2, -33, 5, -30, True) -SketchConstraintCoincidence_52 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchArc_9.startPoint()) +SketchConstraintCoincidence_52 = Sketch_5.setCoincident( + SketchLine_30.endPoint(), SketchArc_9.startPoint() +) SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_53") -SketchConstraintTangent_16 = Sketch_5.setTangent(SketchLine_30.result(), SketchArc_9.results()[1]) +SketchConstraintTangent_16 = Sketch_5.setTangent( + SketchLine_30.result(), SketchArc_9.results()[1] +) SketchArc_10 = Sketch_5.addArc(5, -43, 2, -43, 5.000000000000001, -46, False) -SketchConstraintCoincidence_53 = Sketch_5.setCoincident(SketchLine_30.startPoint(), SketchArc_10.startPoint()) +SketchConstraintCoincidence_53 = Sketch_5.setCoincident( + SketchLine_30.startPoint(), SketchArc_10.startPoint() +) SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_54") -SketchConstraintTangent_17 = Sketch_5.setTangent(SketchLine_30.result(), SketchArc_10.results()[1]) -SketchArc_11 = Sketch_5.addArc(37.00000000000001, -33, 37.00000000000001, -30, 40.00000000000001, -33, True) -SketchConstraintCoincidence_54 = Sketch_5.setCoincident(SketchLine_29.endPoint(), SketchArc_11.startPoint()) +SketchConstraintTangent_17 = Sketch_5.setTangent( + SketchLine_30.result(), SketchArc_10.results()[1] +) +SketchArc_11 = Sketch_5.addArc( + 37.00000000000001, -33, 37.00000000000001, -30, 40.00000000000001, -33, True +) +SketchConstraintCoincidence_54 = Sketch_5.setCoincident( + SketchLine_29.endPoint(), SketchArc_11.startPoint() +) SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_55") -SketchConstraintTangent_18 = Sketch_5.setTangent(SketchLine_29.result(), SketchArc_11.results()[1]) -SketchArc_12 = Sketch_5.addArc(37.00000000000001, -43, 37.00000000000001, -46, 40.00000000000001, -43, False) -SketchConstraintCoincidence_55 = Sketch_5.setCoincident(SketchLine_28.endPoint(), SketchArc_12.startPoint()) +SketchConstraintTangent_18 = Sketch_5.setTangent( + SketchLine_29.result(), SketchArc_11.results()[1] +) +SketchArc_12 = Sketch_5.addArc( + 37.00000000000001, -43, 37.00000000000001, -46, 40.00000000000001, -43, False +) +SketchConstraintCoincidence_55 = Sketch_5.setCoincident( + SketchLine_28.endPoint(), SketchArc_12.startPoint() +) SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_56") -SketchConstraintTangent_19 = Sketch_5.setTangent(SketchLine_28.result(), SketchArc_12.results()[1]) -SketchConstraintCoincidence_56 = Sketch_5.setCoincident(SketchArc_9.endPoint(), SketchLine_29.startPoint()) +SketchConstraintTangent_19 = Sketch_5.setTangent( + SketchLine_28.result(), SketchArc_12.results()[1] +) +SketchConstraintCoincidence_56 = Sketch_5.setCoincident( + SketchArc_9.endPoint(), SketchLine_29.startPoint() +) SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_57") -SketchConstraintCoincidence_57 = Sketch_5.setCoincident(SketchArc_11.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_57 = Sketch_5.setCoincident( + SketchArc_11.endPoint(), SketchLine_31.startPoint() +) SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_58") -SketchConstraintCoincidence_58 = Sketch_5.setCoincident(SketchLine_31.endPoint(), SketchArc_12.endPoint()) +SketchConstraintCoincidence_58 = Sketch_5.setCoincident( + SketchLine_31.endPoint(), SketchArc_12.endPoint() +) SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_59") -SketchConstraintCoincidence_59 = Sketch_5.setCoincident(SketchArc_10.endPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_59 = Sketch_5.setCoincident( + SketchArc_10.endPoint(), SketchLine_28.startPoint() +) SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_60") -SketchConstraintEqual_10 = Sketch_5.setEqual(SketchArc_11.results()[1], SketchArc_9.results()[1]) -SketchConstraintEqual_11 = Sketch_5.setEqual(SketchArc_10.results()[1], SketchArc_12.results()[1]) -SketchConstraintEqual_12 = Sketch_5.setEqual(SketchArc_12.results()[1], SketchArc_11.results()[1]) -SketchConstraintTangent_20 = Sketch_5.setTangent(SketchArc_9.results()[1], SketchLine_29.result()) -SketchConstraintTangent_21 = Sketch_5.setTangent(SketchArc_12.results()[1], SketchLine_31.result()) +SketchConstraintEqual_10 = Sketch_5.setEqual( + SketchArc_11.results()[1], SketchArc_9.results()[1] +) +SketchConstraintEqual_11 = Sketch_5.setEqual( + SketchArc_10.results()[1], SketchArc_12.results()[1] +) +SketchConstraintEqual_12 = Sketch_5.setEqual( + SketchArc_12.results()[1], SketchArc_11.results()[1] +) +SketchConstraintTangent_20 = Sketch_5.setTangent( + SketchArc_9.results()[1], SketchLine_29.result() +) +SketchConstraintTangent_21 = Sketch_5.setTangent( + SketchArc_12.results()[1], SketchLine_31.result() +) SketchConstraintRadius_6 = Sketch_5.setRadius(SketchArc_9.results()[1], 3) SketchLine_36 = Sketch_5.addLine(2, -38, 39.99999999999998, -38) SketchLine_36.setName("SketchLine_37") SketchLine_36.result().setName("SketchLine_37") SketchLine_36.setAuxiliary(True) -SketchConstraintCoincidence_60 = Sketch_5.setCoincident(SketchLine_36.startPoint(), SketchLine_30.result()) +SketchConstraintCoincidence_60 = Sketch_5.setCoincident( + SketchLine_36.startPoint(), SketchLine_30.result() +) SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_61") -SketchConstraintCoincidence_61 = Sketch_5.setCoincident(SketchLine_36.endPoint(), SketchLine_31.result()) +SketchConstraintCoincidence_61 = Sketch_5.setCoincident( + SketchLine_36.endPoint(), SketchLine_31.result() +) SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_62") -SketchConstraintMiddle_13 = Sketch_5.setMiddlePoint(SketchLine_31.result(), SketchLine_36.endPoint()) -SketchConstraintMiddle_14 = Sketch_5.setMiddlePoint(SketchLine_36.startPoint(), SketchLine_30.result()) +SketchConstraintMiddle_13 = Sketch_5.setMiddlePoint( + SketchLine_31.result(), SketchLine_36.endPoint() +) +SketchConstraintMiddle_14 = Sketch_5.setMiddlePoint( + SketchLine_36.startPoint(), SketchLine_30.result() +) SketchCircle_8 = Sketch_5.addCircle(13.00000000000001, -38, 2.5) -SketchConstraintCoincidence_62 = Sketch_5.setCoincident(SketchLine_36.result(), SketchCircle_8.center()) +SketchConstraintCoincidence_62 = Sketch_5.setCoincident( + SketchLine_36.result(), SketchCircle_8.center() +) SketchConstraintCoincidence_62.setName("SketchConstraintCoincidence_63") SketchCircle_9 = Sketch_5.addCircle(29, -38, 2.5) -SketchConstraintCoincidence_63 = Sketch_5.setCoincident(SketchLine_36.result(), SketchCircle_9.center()) +SketchConstraintCoincidence_63 = Sketch_5.setCoincident( + SketchLine_36.result(), SketchCircle_9.center() +) SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_64") -SketchConstraintEqual_13 = Sketch_5.setEqual(SketchCircle_9.results()[1], SketchCircle_8.results()[1]) +SketchConstraintEqual_13 = Sketch_5.setEqual( + SketchCircle_9.results()[1], SketchCircle_8.results()[1] +) SketchConstraintRadius_7 = Sketch_5.setRadius(SketchCircle_9.results()[1], 2.5) -SketchConstraintDistance_11 = Sketch_5.setDistance(SketchCircle_8.center(), SketchCircle_9.center(), 16) +SketchConstraintDistance_11 = Sketch_5.setDistance( + SketchCircle_8.center(), SketchCircle_9.center(), 16 +) SketchLine_37 = Sketch_5.addLine(21, -28, 21, -48) SketchLine_37.setName("SketchLine_38") SketchLine_37.result().setName("SketchLine_38") SketchLine_37.setAuxiliary(True) -SketchConstraintCoincidence_64 = Sketch_5.setCoincident(SketchLine_37.startPoint(), SketchLine_34.result()) +SketchConstraintCoincidence_64 = Sketch_5.setCoincident( + SketchLine_37.startPoint(), SketchLine_34.result() +) SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_65") -SketchConstraintCoincidence_65 = Sketch_5.setCoincident(SketchLine_37.endPoint(), SketchLine_35.result()) +SketchConstraintCoincidence_65 = Sketch_5.setCoincident( + SketchLine_37.endPoint(), SketchLine_35.result() +) SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_66") -SketchConstraintMiddle_15 = Sketch_5.setMiddlePoint(SketchLine_37.startPoint(), SketchLine_34.result()) -SketchConstraintMiddle_16 = Sketch_5.setMiddlePoint(SketchLine_37.endPoint(), SketchLine_35.result()) -SketchConstraintDistance_12 = Sketch_5.setDistance(SketchCircle_8.center(), SketchLine_37.result(), 8) +SketchConstraintMiddle_15 = Sketch_5.setMiddlePoint( + SketchLine_37.startPoint(), SketchLine_34.result() +) +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/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")]) +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) SketchLine_38.setName("SketchLine_39") @@ -369,43 +825,65 @@ SketchLine_38.result().setName("SketchLine_39") SketchLine_39 = Sketch_6.addLine(-59, 2, -17, 2) SketchLine_39.setName("SketchLine_40") SketchLine_39.result().setName("SketchLine_40") -SketchConstraintCoincidence_66 = Sketch_6.setCoincident(SketchLine_38.endPoint(), SketchLine_39.startPoint()) +SketchConstraintCoincidence_66 = Sketch_6.setCoincident( + SketchLine_38.endPoint(), SketchLine_39.startPoint() +) SketchConstraintCoincidence_66.setName("SketchConstraintCoincidence_67") SketchLine_40 = Sketch_6.addLine(-17, 2, -16.99997429885428, 44) SketchLine_40.setName("SketchLine_41") SketchLine_40.result().setName("SketchLine_41") -SketchConstraintCoincidence_67 = Sketch_6.setCoincident(SketchLine_39.endPoint(), SketchLine_40.startPoint()) +SketchConstraintCoincidence_67 = Sketch_6.setCoincident( + SketchLine_39.endPoint(), SketchLine_40.startPoint() +) SketchConstraintCoincidence_67.setName("SketchConstraintCoincidence_68") SketchLine_41 = Sketch_6.addLine(-16.99997429885428, 44, -27.99998714942714, 44) SketchLine_41.setName("SketchLine_42") SketchLine_41.result().setName("SketchLine_42") -SketchConstraintCoincidence_68 = Sketch_6.setCoincident(SketchLine_40.endPoint(), SketchLine_41.startPoint()) +SketchConstraintCoincidence_68 = Sketch_6.setCoincident( + SketchLine_40.endPoint(), SketchLine_41.startPoint() +) SketchConstraintCoincidence_68.setName("SketchConstraintCoincidence_69") SketchLine_42 = Sketch_6.addLine(-27.99998714942714, 44, -27.99998714942714, 29) SketchLine_42.setName("SketchLine_43") SketchLine_42.result().setName("SketchLine_43") -SketchConstraintCoincidence_69 = Sketch_6.setCoincident(SketchLine_41.endPoint(), SketchLine_42.startPoint()) +SketchConstraintCoincidence_69 = Sketch_6.setCoincident( + SketchLine_41.endPoint(), SketchLine_42.startPoint() +) SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_70") SketchLine_43 = Sketch_6.addLine(-27.99998714942714, 29, -47.99998714942714, 29) SketchLine_43.setName("SketchLine_44") SketchLine_43.result().setName("SketchLine_44") -SketchConstraintCoincidence_70 = Sketch_6.setCoincident(SketchLine_42.endPoint(), SketchLine_43.startPoint()) +SketchConstraintCoincidence_70 = Sketch_6.setCoincident( + SketchLine_42.endPoint(), SketchLine_43.startPoint() +) SketchConstraintCoincidence_70.setName("SketchConstraintCoincidence_71") SketchLine_44 = Sketch_6.addLine(-47.99998714942714, 29, -47.99998714942714, 44) SketchLine_44.setName("SketchLine_45") SketchLine_44.result().setName("SketchLine_45") -SketchConstraintCoincidence_71 = Sketch_6.setCoincident(SketchLine_43.endPoint(), SketchLine_44.startPoint()) +SketchConstraintCoincidence_71 = Sketch_6.setCoincident( + SketchLine_43.endPoint(), SketchLine_44.startPoint() +) SketchConstraintCoincidence_71.setName("SketchConstraintCoincidence_72") SketchLine_45 = Sketch_6.addLine(-47.99998714942714, 44, -59, 44) SketchLine_45.setName("SketchLine_46") SketchLine_45.result().setName("SketchLine_46") -SketchConstraintCoincidence_72 = Sketch_6.setCoincident(SketchLine_44.endPoint(), SketchLine_45.startPoint()) +SketchConstraintCoincidence_72 = Sketch_6.setCoincident( + SketchLine_44.endPoint(), SketchLine_45.startPoint() +) SketchConstraintCoincidence_72.setName("SketchConstraintCoincidence_73") -SketchConstraintCoincidence_73 = Sketch_6.setCoincident(SketchLine_38.startPoint(), SketchLine_45.endPoint()) +SketchConstraintCoincidence_73 = Sketch_6.setCoincident( + SketchLine_38.startPoint(), SketchLine_45.endPoint() +) SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_74") -SketchConstraintEqual_14 = Sketch_6.setEqual(SketchLine_38.result(), SketchLine_40.result()) -SketchConstraintEqual_15 = Sketch_6.setEqual(SketchLine_41.result(), SketchLine_45.result()) -SketchConstraintEqual_16 = Sketch_6.setEqual(SketchLine_42.result(), SketchLine_44.result()) +SketchConstraintEqual_14 = Sketch_6.setEqual( + SketchLine_38.result(), SketchLine_40.result() +) +SketchConstraintEqual_15 = Sketch_6.setEqual( + SketchLine_41.result(), SketchLine_45.result() +) +SketchConstraintEqual_16 = Sketch_6.setEqual( + SketchLine_42.result(), SketchLine_44.result() +) SketchConstraintHorizontal_7 = Sketch_6.setHorizontal(SketchLine_45.result()) SketchConstraintHorizontal_8 = Sketch_6.setHorizontal(SketchLine_43.result()) SketchConstraintHorizontal_9 = Sketch_6.setHorizontal(SketchLine_39.result()) @@ -417,68 +895,153 @@ 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&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2]"), False) +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&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)_ExtrusionCut_5_2]"), False) +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)_ExtrusionCut_5_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&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2]"), False) +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) +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&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")) +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&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)_ExtrusionCut_6_1]")) +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)_ExtrusionCut_6_1]", + ) +) SketchLine_50.setName("SketchLine_51") SketchLine_50.result().setName("SketchLine_51") -SketchConstraintCoincidence_74 = Sketch_7.setCoincident(SketchLine_49.startPoint(), SketchLine_50.result()) +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/SketchLine_13_StartVertex")) -SketchConstraintCoincidence_75 = Sketch_7.setCoincident(SketchLine_49.endPoint(), SketchPoint_3.result()) +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()) +SketchConstraintMiddle_17 = Sketch_7.setMiddlePoint( + SketchLine_49.startPoint(), SketchLine_50.result() +) 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&Sketch_1/SketchLine_1][ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_1_2]")) +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 = 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&Sketch_1/SketchArc_3_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_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()) +SketchConstraintCoincidence_77 = Sketch_7.setCoincident( + SketchLine_51.endPoint(), SketchLine_53.result() +) SketchConstraintCoincidence_77.setName("SketchConstraintCoincidence_78") -SketchConstraintMiddle_18 = Sketch_7.setMiddlePoint(SketchLine_51.startPoint(), SketchLine_52.result()) -SketchConstraintMiddle_19 = Sketch_7.setMiddlePoint(SketchLine_51.endPoint(), SketchLine_53.result()) +SketchConstraintMiddle_18 = Sketch_7.setMiddlePoint( + SketchLine_51.startPoint(), SketchLine_52.result() +) +SketchConstraintMiddle_19 = Sketch_7.setMiddlePoint( + SketchLine_51.endPoint(), SketchLine_53.result() +) SketchPoint_4 = Sketch_7.addPoint(-37.99999999999999, -22.99999999998656) -SketchConstraintCoincidence_78 = Sketch_7.setCoincident(SketchPoint_4.coordinates(), SketchLine_51.result()) +SketchConstraintCoincidence_78 = Sketch_7.setCoincident( + SketchPoint_4.coordinates(), SketchLine_51.result() +) SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_79") -SketchConstraintMiddle_20 = Sketch_7.setMiddlePoint(SketchPoint_4.coordinates(), SketchLine_51.result()) +SketchConstraintMiddle_20 = Sketch_7.setMiddlePoint( + SketchPoint_4.coordinates(), SketchLine_51.result() +) SketchCircle_10 = Sketch_7.addCircle(-37.99999999999999, -22.99999999998656, 17) -SketchConstraintCoincidence_79 = Sketch_7.setCoincident(SketchPoint_4.coordinates(), SketchCircle_10.center()) +SketchConstraintCoincidence_79 = Sketch_7.setCoincident( + SketchPoint_4.coordinates(), SketchCircle_10.center() +) 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/Face-SketchCircle_10_2f_wire")], model.selection(), 16, 0) +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) +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&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)_ExtrusionCut_6_1]"), False) +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)_ExtrusionCut_6_1]", + ), + False, +) SketchLine_55 = SketchProjection_7.createdFeature() SketchLine_55.setName("SketchLine_56") SketchLine_55.result().setName("SketchLine_56") @@ -486,48 +1049,109 @@ SketchLine_56 = Sketch_8.addLine(0, -22.99999999998656, -76, -22.99999999999327) SketchLine_56.setName("SketchLine_57") SketchLine_56.result().setName("SketchLine_57") SketchLine_56.setAuxiliary(True) -SketchConstraintCoincidence_80 = Sketch_8.setCoincident(SketchLine_56.startPoint(), SketchLine_55.result()) +SketchConstraintCoincidence_80 = Sketch_8.setCoincident( + SketchLine_56.startPoint(), SketchLine_55.result() +) SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_81") -SketchConstraintCoincidence_81 = Sketch_8.setCoincident(SketchLine_56.endPoint(), SketchLine_54.result()) +SketchConstraintCoincidence_81 = Sketch_8.setCoincident( + SketchLine_56.endPoint(), SketchLine_54.result() +) SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_82") -SketchConstraintMiddle_21 = Sketch_8.setMiddlePoint(SketchLine_56.endPoint(), SketchLine_54.result()) -SketchConstraintMiddle_22 = Sketch_8.setMiddlePoint(SketchLine_55.result(), SketchLine_56.startPoint()) -SketchLine_57 = Sketch_8.addLine(-37.99999999999842, -40.99999999998655, -38.000000000002, 0) +SketchConstraintMiddle_21 = Sketch_8.setMiddlePoint( + SketchLine_56.endPoint(), SketchLine_54.result() +) +SketchConstraintMiddle_22 = Sketch_8.setMiddlePoint( + SketchLine_55.result(), SketchLine_56.startPoint() +) +SketchLine_57 = Sketch_8.addLine( + -37.99999999999842, -40.99999999998655, -38.000000000002, 0 +) SketchLine_57.setName("SketchLine_58") SketchLine_57.result().setName("SketchLine_58") SketchLine_57.setAuxiliary(True) SketchPoint_5 = Sketch_8.addPoint(-38, -22.99999999998992) -SketchConstraintCoincidence_82 = Sketch_8.setCoincident(SketchPoint_5.coordinates(), SketchLine_56.result()) +SketchConstraintCoincidence_82 = Sketch_8.setCoincident( + SketchPoint_5.coordinates(), SketchLine_56.result() +) SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_83") -SketchConstraintMiddle_23 = Sketch_8.setMiddlePoint(SketchLine_56.result(), SketchPoint_5.coordinates()) -SketchConstraintCoincidence_83 = Sketch_8.setCoincident(SketchLine_57.result(), SketchPoint_5.coordinates()) +SketchConstraintMiddle_23 = Sketch_8.setMiddlePoint( + SketchLine_56.result(), SketchPoint_5.coordinates() +) +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&Sketch_1/SketchLine_1][ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_1_2]"), False) +SketchConstraintPerpendicular_1 = Sketch_8.setPerpendicular( + SketchLine_57.result(), SketchLine_56.result() +) +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&Sketch_1/SketchArc_3_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"), False) +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") -SketchConstraintCoincidence_84 = Sketch_8.setCoincident(SketchLine_57.startPoint(), SketchLine_58.result()) +SketchConstraintCoincidence_84 = Sketch_8.setCoincident( + SketchLine_57.startPoint(), SketchLine_58.result() +) SketchConstraintCoincidence_84.setName("SketchConstraintCoincidence_85") -SketchConstraintCoincidence_85 = Sketch_8.setCoincident(SketchLine_57.endPoint(), SketchLine_59.result()) +SketchConstraintCoincidence_85 = Sketch_8.setCoincident( + SketchLine_57.endPoint(), SketchLine_59.result() +) SketchConstraintCoincidence_85.setName("SketchConstraintCoincidence_86") SketchCircle_11 = Sketch_8.addCircle(-30, -22.99999999998921, 2.5) -SketchConstraintCoincidence_86 = Sketch_8.setCoincident(SketchLine_56.result(), SketchCircle_11.center()) +SketchConstraintCoincidence_86 = Sketch_8.setCoincident( + SketchLine_56.result(), SketchCircle_11.center() +) SketchConstraintCoincidence_86.setName("SketchConstraintCoincidence_87") SketchCircle_12 = Sketch_8.addCircle(-46.00000000004985, -22.99999999999062, 2.5) -SketchConstraintCoincidence_87 = Sketch_8.setCoincident(SketchLine_56.result(), SketchCircle_12.center()) +SketchConstraintCoincidence_87 = Sketch_8.setCoincident( + SketchLine_56.result(), SketchCircle_12.center() +) SketchConstraintCoincidence_87.setName("SketchConstraintCoincidence_88") -SketchConstraintEqual_17 = Sketch_8.setEqual(SketchCircle_12.results()[1], SketchCircle_11.results()[1]) +SketchConstraintEqual_17 = Sketch_8.setEqual( + SketchCircle_12.results()[1], SketchCircle_11.results()[1] +) SketchConstraintRadius_9 = Sketch_8.setRadius(SketchCircle_11.results()[1], 2.5) -SketchConstraintDistance_15 = Sketch_8.setDistance(SketchCircle_11.center(), SketchLine_57.result(), 8) -SketchConstraintDistance_16 = Sketch_8.setDistance(SketchCircle_11.center(), SketchCircle_12.center(), 16) +SketchConstraintDistance_15 = Sketch_8.setDistance( + SketchCircle_11.center(), SketchLine_57.result(), 8 +) +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", "(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)_ExtrusionCut_6_1"), 38, True) +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", + "(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)_ExtrusionCut_6_1", + ), + 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") @@ -541,40 +1165,65 @@ SketchLine_62.result().setName("SketchLine_63") SketchLine_63 = Sketch_9.addLine(-14, -22.99999999998992, -14, -36.99999999998992) SketchLine_63.setName("SketchLine_64") SketchLine_63.result().setName("SketchLine_64") -SketchConstraintCoincidence_88 = Sketch_9.setCoincident(SketchLine_63.endPoint(), SketchLine_60.startPoint()) +SketchConstraintCoincidence_88 = Sketch_9.setCoincident( + SketchLine_63.endPoint(), SketchLine_60.startPoint() +) SketchConstraintCoincidence_88.setName("SketchConstraintCoincidence_89") -SketchConstraintCoincidence_89 = Sketch_9.setCoincident(SketchLine_60.endPoint(), SketchLine_61.startPoint()) +SketchConstraintCoincidence_89 = Sketch_9.setCoincident( + SketchLine_60.endPoint(), SketchLine_61.startPoint() +) SketchConstraintCoincidence_89.setName("SketchConstraintCoincidence_90") -SketchConstraintCoincidence_90 = Sketch_9.setCoincident(SketchLine_61.endPoint(), SketchLine_62.startPoint()) +SketchConstraintCoincidence_90 = Sketch_9.setCoincident( + SketchLine_61.endPoint(), SketchLine_62.startPoint() +) SketchConstraintCoincidence_90.setName("SketchConstraintCoincidence_91") -SketchConstraintCoincidence_91 = Sketch_9.setCoincident(SketchLine_62.endPoint(), SketchLine_63.startPoint()) +SketchConstraintCoincidence_91 = Sketch_9.setCoincident( + SketchLine_62.endPoint(), SketchLine_63.startPoint() +) SketchConstraintCoincidence_91.setName("SketchConstraintCoincidence_92") SketchConstraintHorizontal_11 = Sketch_9.setHorizontal(SketchLine_60.result()) SketchConstraintVertical_7 = Sketch_9.setVertical(SketchLine_61.result()) SketchConstraintHorizontal_12 = Sketch_9.setHorizontal(SketchLine_62.result()) SketchConstraintVertical_8 = Sketch_9.setVertical(SketchLine_63.result()) SketchConstraintLength_7 = Sketch_9.setLength(SketchLine_61.result(), 14) -SketchConstraintEqual_18 = Sketch_9.setEqual(SketchLine_61.result(), SketchLine_60.result()) -SketchLine_64 = Sketch_9.addLine(-5.662490896925754, -22.99999999998992, -60.5217691188193, -22.99999999998992) +SketchConstraintEqual_18 = Sketch_9.setEqual( + SketchLine_61.result(), SketchLine_60.result() +) +SketchLine_64 = Sketch_9.addLine( + -5.662490896925754, -22.99999999998992, -60.5217691188193, -22.99999999998992 +) 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/SketchPoint_5")) -SketchConstraintCoincidence_92 = Sketch_9.setCoincident(SketchLine_64.result(), SketchPoint_6.coordinates()) +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 = Sketch_9.setCoincident( + SketchLine_62.startPoint(), SketchLine_64.result() +) SketchConstraintCoincidence_93.setName("SketchConstraintCoincidence_94") 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 = 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/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.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Part_1, 1) model.testNbSubShapes(Part_1, GeomAPI_Shape.SOLID, [5]) diff --git a/test.compatibility/piece_09.py b/test.compatibility/piece_09.py index 893e1e406..862d283c0 100644 --- a/test.compatibility/piece_09.py +++ b/test.compatibility/piece_09.py @@ -56,58 +56,184 @@ model.addParameter(Part_1_doc, "epaisseur_plat", "25") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(0, 0, 13.23223304703355, -2.874692731756102e-26) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) -SketchArc_1 = Sketch_1.addArc(13.23223304703355, 5.51776695296637, 13.23223304703355, -2.874692731756102e-26, 18.74999999999991, 5.51776695296637, False) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_1.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_1.result(), SketchArc_1.results()[1]) -SketchLine_3 = Sketch_1.addLine(18.74999999999991, 5.51776695296637, 18.74999999999991, 29.48223304703358) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_3.startPoint()) -SketchArc_2 = Sketch_1.addArc(21.76776695296633, 29.48223304703358, 18.74999999999991, 29.48223304703358, 21.76776695296638, 32.50000000000001, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_2.startPoint()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_2.results()[1]) -SketchLine_4 = Sketch_1.addLine(21.76776695296638, 32.50000000000001, 88.23223304703366, 32.50000000000001) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_4.startPoint()) -SketchArc_3 = Sketch_1.addArc(88.23223304703366, 29.48223304703358, 88.23223304703366, 32.50000000000001, 91.25000000000009, 29.48223304703358, True) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_3.results()[1]) -SketchLine_5 = Sketch_1.addLine(91.25000000000009, 29.48223304703358, 91.25000000000009, 5.51776695296637) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_5.startPoint()) -SketchArc_4 = Sketch_1.addArc(96.76776695296645, 5.51776695296637, 91.25000000000009, 5.51776695296637, 96.76776695296645, 0, False) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchArc_4.startPoint()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_5.result(), SketchArc_4.results()[1]) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_4.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) +SketchArc_1 = Sketch_1.addArc( + 13.23223304703355, + 5.51776695296637, + 13.23223304703355, + -2.874692731756102e-26, + 18.74999999999991, + 5.51776695296637, + False, +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_1.result(), SketchArc_1.results()[1] +) +SketchLine_3 = Sketch_1.addLine( + 18.74999999999991, 5.51776695296637, 18.74999999999991, 29.48223304703358 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_3.startPoint() +) +SketchArc_2 = Sketch_1.addArc( + 21.76776695296633, + 29.48223304703358, + 18.74999999999991, + 29.48223304703358, + 21.76776695296638, + 32.50000000000001, + True, +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_2.results()[1] +) +SketchLine_4 = Sketch_1.addLine( + 21.76776695296638, 32.50000000000001, 88.23223304703366, 32.50000000000001 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_4.startPoint() +) +SketchArc_3 = Sketch_1.addArc( + 88.23223304703366, + 29.48223304703358, + 88.23223304703366, + 32.50000000000001, + 91.25000000000009, + 29.48223304703358, + True, +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchLine_4.result(), SketchArc_3.results()[1] +) +SketchLine_5 = Sketch_1.addLine( + 91.25000000000009, 29.48223304703358, 91.25000000000009, 5.51776695296637 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_5.startPoint() +) +SketchArc_4 = Sketch_1.addArc( + 96.76776695296645, + 5.51776695296637, + 91.25000000000009, + 5.51776695296637, + 96.76776695296645, + 0, + False, +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchLine_5.result(), SketchArc_4.results()[1] +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_4.endPoint() +) SketchLine_6 = Sketch_1.addLine(96.76776695296645, 0, 110, 0) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_2.result() +) SketchLine_7 = Sketch_1.addLine(0, 0, 0, 2.5) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(0, 2.5, 14.99999999999991, 2.5) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchArc_5 = Sketch_1.addArc(14.99999999999991, 3.75, 14.99999999999991, 2.5, 16.24999999999991, 3.75, False) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchArc_5.startPoint()) -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchLine_8.result(), SketchArc_5.results()[1]) -SketchLine_9 = Sketch_1.addLine(16.24999999999991, 3.75, 16.24999999999991, 31.24999999999991) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_9.startPoint()) -SketchArc_6 = Sketch_1.addArc(19.99999999999991, 31.24999999999991, 16.24999999999991, 31.24999999999991, 19.99999999999996, 35, True) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchArc_6.startPoint()) -SketchConstraintTangent_6 = Sketch_1.setTangent(SketchLine_9.result(), SketchArc_6.results()[1]) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchArc_5 = Sketch_1.addArc( + 14.99999999999991, 3.75, 14.99999999999991, 2.5, 16.24999999999991, 3.75, False +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchArc_5.startPoint() +) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchLine_8.result(), SketchArc_5.results()[1] +) +SketchLine_9 = Sketch_1.addLine( + 16.24999999999991, 3.75, 16.24999999999991, 31.24999999999991 +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchLine_9.startPoint() +) +SketchArc_6 = Sketch_1.addArc( + 19.99999999999991, + 31.24999999999991, + 16.24999999999991, + 31.24999999999991, + 19.99999999999996, + 35, + True, +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchArc_6.startPoint() +) +SketchConstraintTangent_6 = Sketch_1.setTangent( + SketchLine_9.result(), SketchArc_6.results()[1] +) SketchLine_10 = Sketch_1.addLine(19.99999999999996, 35, 89.99999999999997, 35) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_10.startPoint()) -SketchArc_7 = Sketch_1.addArc(90.00000000000009, 31.24999999999977, 89.99999999999997, 35, 93.75000000000009, 31.24999999999977, True) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_7.startPoint()) -SketchConstraintTangent_7 = Sketch_1.setTangent(SketchLine_10.result(), SketchArc_7.results()[1]) -SketchLine_11 = Sketch_1.addLine(93.75000000000009, 31.24999999999977, 93.75000000000009, 3.75) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchArc_7.endPoint(), SketchLine_11.startPoint()) -SketchArc_8 = Sketch_1.addArc(95.00000000000009, 3.75, 93.75000000000009, 3.75, 95.00000000000009, 2.5, False) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchArc_8.startPoint()) -SketchConstraintTangent_8 = Sketch_1.setTangent(SketchLine_11.result(), SketchArc_8.results()[1]) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchArc_6.endPoint(), SketchLine_10.startPoint() +) +SketchArc_7 = Sketch_1.addArc( + 90.00000000000009, + 31.24999999999977, + 89.99999999999997, + 35, + 93.75000000000009, + 31.24999999999977, + True, +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchArc_7.startPoint() +) +SketchConstraintTangent_7 = Sketch_1.setTangent( + SketchLine_10.result(), SketchArc_7.results()[1] +) +SketchLine_11 = Sketch_1.addLine( + 93.75000000000009, 31.24999999999977, 93.75000000000009, 3.75 +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchArc_7.endPoint(), SketchLine_11.startPoint() +) +SketchArc_8 = Sketch_1.addArc( + 95.00000000000009, 3.75, 93.75000000000009, 3.75, 95.00000000000009, 2.5, False +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchArc_8.startPoint() +) +SketchConstraintTangent_8 = Sketch_1.setTangent( + SketchLine_11.result(), SketchArc_8.results()[1] +) SketchLine_12 = Sketch_1.addLine(95.00000000000009, 2.5, 110, 2.5) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchArc_8.endPoint(), SketchLine_12.startPoint() +) SketchLine_13 = Sketch_1.addLine(110, 2.5, 110, 0) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_13.endPoint()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_13.endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_9.result()) @@ -117,69 +243,193 @@ SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_13.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_10.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_12.result()) -SketchConstraintTangent_9 = Sketch_1.setTangent(SketchArc_6.results()[1], SketchLine_10.result()) -SketchConstraintTangent_10 = Sketch_1.setTangent(SketchArc_7.results()[1], SketchLine_11.result()) -SketchConstraintTangent_11 = Sketch_1.setTangent(SketchArc_8.results()[1], SketchLine_12.result()) -SketchConstraintTangent_12 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchLine_9.result()) -SketchConstraintTangent_13 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_3.result()) +SketchConstraintTangent_9 = Sketch_1.setTangent( + SketchArc_6.results()[1], SketchLine_10.result() +) +SketchConstraintTangent_10 = Sketch_1.setTangent( + SketchArc_7.results()[1], SketchLine_11.result() +) +SketchConstraintTangent_11 = Sketch_1.setTangent( + SketchArc_8.results()[1], SketchLine_12.result() +) +SketchConstraintTangent_12 = Sketch_1.setTangent( + SketchArc_5.results()[1], SketchLine_9.result() +) +SketchConstraintTangent_13 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_3.result() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result()) -SketchConstraintTangent_14 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_6.result()) -SketchConstraintTangent_15 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_4.result()) -SketchConstraintTangent_16 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_5.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_5.results()[1], SketchArc_8.results()[1]) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_8.result(), SketchLine_12.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_6.result()) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchArc_1.results()[1], SketchArc_4.results()[1]) -SketchConstraintEqual_5 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_5.result()) -SketchConstraintEqual_6 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_11.result()) -SketchConstraintEqual_7 = Sketch_1.setEqual(SketchLine_7.result(), SketchLine_13.result()) +SketchConstraintTangent_14 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchLine_6.result() +) +SketchConstraintTangent_15 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_4.result() +) +SketchConstraintTangent_16 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_5.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchArc_5.results()[1], SketchArc_8.results()[1] +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_8.result(), SketchLine_12.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_6.result() +) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchArc_1.results()[1], SketchArc_4.results()[1] +) +SketchConstraintEqual_5 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_5.result() +) +SketchConstraintEqual_6 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_11.result() +) +SketchConstraintEqual_7 = Sketch_1.setEqual( + SketchLine_7.result(), SketchLine_13.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), "epaisseur*coeff") -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_5.endPoint(), SketchLine_3.result(), "epaisseur*coeff") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchArc_6.endPoint(), SketchLine_4.result(), "epaisseur*coeff") +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_5.endPoint(), SketchLine_3.result(), "epaisseur*coeff" +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchArc_6.endPoint(), SketchLine_4.result(), "epaisseur*coeff" +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_5.results()[1], "r3*coeff") SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_6.results()[1], "r2*coeff") -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_12.endPoint(), SketchLine_7.result(), "d4*coeff") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchArc_5.center(), SketchArc_1.center(), "epaisseur*coeff") -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchArc_2.center(), SketchArc_6.center(), "epaisseur*coeff") -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_1.result(), SketchArc_6.endPoint(), "(h4-d_diff)*coeff") +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_12.endPoint(), SketchLine_7.result(), "d4*coeff" +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchArc_5.center(), SketchArc_1.center(), "epaisseur*coeff" +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchArc_2.center(), SketchArc_6.center(), "epaisseur*coeff" +) +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/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) +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&Sketch_1/SketchArc_7_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10]"), 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&Sketch_1/SketchLine_11][Extrusion_1_1/To_Face]"), 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()) -SketchArc_9 = Sketch_2.addArc(-31.24999999999999, -31.25000000000001, -31.24999999999999, -35.00000000000001, -34.99999999999999, -31.25000000000001, True) -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchArc_9.startPoint()) -SketchConstraintTangent_17 = Sketch_2.setTangent(SketchLine_16.result(), SketchArc_9.results()[1]) +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() +) +SketchArc_9 = Sketch_2.addArc( + -31.24999999999999, + -31.25000000000001, + -31.24999999999999, + -35.00000000000001, + -34.99999999999999, + -31.25000000000001, + True, +) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchArc_9.startPoint() +) +SketchConstraintTangent_17 = Sketch_2.setTangent( + SketchLine_16.result(), SketchArc_9.results()[1] +) SketchLine_17 = Sketch_2.addLine(-35, -31.24999999999999, -35, 1.250000000000009) -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchArc_9.endPoint(), SketchLine_17.startPoint()) -SketchArc_10 = Sketch_2.addArc(-31.25, 1.249999999999998, -35, 1.249999999999998, -31.25, 4.999999999999998, True) -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchArc_10.startPoint()) -SketchConstraintTangent_18 = Sketch_2.setTangent(SketchLine_17.result(), SketchArc_10.results()[1]) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchArc_9.endPoint(), SketchLine_17.startPoint() +) +SketchArc_10 = Sketch_2.addArc( + -31.25, 1.249999999999998, -35, 1.249999999999998, -31.25, 4.999999999999998, True +) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchLine_17.endPoint(), SketchArc_10.startPoint() +) +SketchConstraintTangent_18 = Sketch_2.setTangent( + SketchLine_17.result(), SketchArc_10.results()[1] +) SketchLine_18 = Sketch_2.addLine(-31.25, 4.999999999999999, -11.25, 4.999999999999999) -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchArc_10.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchArc_10.endPoint(), SketchLine_18.startPoint() +) SketchLine_19 = Sketch_2.addLine(-11.25, 5.000000000000009, -11.25, 2.500000000000009) -SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -SketchLine_20 = Sketch_2.addLine(-11.25, 2.500000000000002, -31.24999999999999, 2.500000000000017) -SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) -SketchArc_11 = Sketch_2.addArc(-31.25, 1.25, -31.25, 2.500000000000002, -32.5, 1.250000000000808, False) -SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchArc_11.startPoint()) -SketchConstraintTangent_19 = Sketch_2.setTangent(SketchLine_20.result(), SketchArc_11.results()[1]) +SketchConstraintCoincidence_30 = Sketch_2.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) +SketchLine_20 = Sketch_2.addLine( + -11.25, 2.500000000000002, -31.24999999999999, 2.500000000000017 +) +SketchConstraintCoincidence_31 = Sketch_2.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) +SketchArc_11 = Sketch_2.addArc( + -31.25, 1.25, -31.25, 2.500000000000002, -32.5, 1.250000000000808, False +) +SketchConstraintCoincidence_32 = Sketch_2.setCoincident( + SketchLine_20.endPoint(), SketchArc_11.startPoint() +) +SketchConstraintTangent_19 = Sketch_2.setTangent( + SketchLine_20.result(), SketchArc_11.results()[1] +) SketchLine_21 = Sketch_2.addLine(-32.5, 1.249999999999992, -32.5, -31.24999999999999) -SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchArc_11.endPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_33 = Sketch_2.setCoincident( + SketchArc_11.endPoint(), SketchLine_21.startPoint() +) SketchArc_12 = Sketch_2.addArc(-31.25, -31.25, -32.5, -31.25, -31.25, -32.5, False) -SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchArc_12.startPoint()) -SketchConstraintTangent_20 = Sketch_2.setTangent(SketchLine_21.result(), SketchArc_12.results()[1]) -SketchLine_22 = Sketch_2.addLine(-31.25, -32.50000000000001, -25.00000000000001, -32.50000000000001) -SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchArc_12.endPoint(), SketchLine_22.startPoint()) -SketchLine_23 = Sketch_2.addLine(-24.99999999999999, -35.00000000000001, -24.99999999999999, -32.50000000000002) -SketchConstraintCoincidence_36 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_14).endPoint(), SketchLine_23.startPoint()) -SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchLine_22.endPoint(), SketchLine_23.endPoint()) +SketchConstraintCoincidence_34 = Sketch_2.setCoincident( + SketchLine_21.endPoint(), SketchArc_12.startPoint() +) +SketchConstraintTangent_20 = Sketch_2.setTangent( + SketchLine_21.result(), SketchArc_12.results()[1] +) +SketchLine_22 = Sketch_2.addLine( + -31.25, -32.50000000000001, -25.00000000000001, -32.50000000000001 +) +SketchConstraintCoincidence_35 = Sketch_2.setCoincident( + SketchArc_12.endPoint(), SketchLine_22.startPoint() +) +SketchLine_23 = Sketch_2.addLine( + -24.99999999999999, -35.00000000000001, -24.99999999999999, -32.50000000000002 +) +SketchConstraintCoincidence_36 = Sketch_2.setCoincident( + SketchAPI_Line(SketchLine_14).endPoint(), SketchLine_23.startPoint() +) +SketchConstraintCoincidence_37 = Sketch_2.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.endPoint() +) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_16.result()) SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_22.result()) SketchConstraintHorizontal_7 = Sketch_2.setHorizontal(SketchLine_20.result()) @@ -188,44 +438,117 @@ SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_17.result()) SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_21.result()) SketchConstraintVertical_9 = Sketch_2.setVertical(SketchLine_23.result()) SketchConstraintVertical_10 = Sketch_2.setVertical(SketchLine_19.result()) -SketchConstraintTangent_21 = Sketch_2.setTangent(SketchArc_9.results()[1], SketchLine_17.result()) -SketchConstraintTangent_22 = Sketch_2.setTangent(SketchArc_10.results()[1], SketchLine_18.result()) -SketchConstraintTangent_23 = Sketch_2.setTangent(SketchArc_11.results()[1], SketchLine_21.result()) -SketchConstraintTangent_24 = Sketch_2.setTangent(SketchArc_12.results()[1], SketchLine_22.result()) -SketchConstraintDistance_7 = Sketch_2.setDistance(SketchLine_23.startPoint(), SketchLine_18.result(), "h4*coeff") -SketchConstraintDistance_8 = Sketch_2.setDistance(SketchLine_16.startPoint(), SketchLine_22.result(), "epaisseur*coeff") -SketchConstraintDistance_9 = Sketch_2.setDistance(SketchLine_21.endPoint(), SketchLine_17.result(), "epaisseur*coeff") -SketchConstraintDistance_10 = Sketch_2.setDistance(SketchArc_11.startPoint(), SketchLine_18.result(), "epaisseur*coeff") -SketchConstraintCoincidence_39 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchAPI_Line(SketchLine_14).endPoint()) +SketchConstraintTangent_21 = Sketch_2.setTangent( + SketchArc_9.results()[1], SketchLine_17.result() +) +SketchConstraintTangent_22 = Sketch_2.setTangent( + SketchArc_10.results()[1], SketchLine_18.result() +) +SketchConstraintTangent_23 = Sketch_2.setTangent( + SketchArc_11.results()[1], SketchLine_21.result() +) +SketchConstraintTangent_24 = Sketch_2.setTangent( + SketchArc_12.results()[1], SketchLine_22.result() +) +SketchConstraintDistance_7 = Sketch_2.setDistance( + SketchLine_23.startPoint(), SketchLine_18.result(), "h4*coeff" +) +SketchConstraintDistance_8 = Sketch_2.setDistance( + SketchLine_16.startPoint(), SketchLine_22.result(), "epaisseur*coeff" +) +SketchConstraintDistance_9 = Sketch_2.setDistance( + SketchLine_21.endPoint(), SketchLine_17.result(), "epaisseur*coeff" +) +SketchConstraintDistance_10 = Sketch_2.setDistance( + SketchArc_11.startPoint(), SketchLine_18.result(), "epaisseur*coeff" +) +SketchConstraintCoincidence_39 = Sketch_2.setCoincident( + SketchLine_16.startPoint(), SketchAPI_Line(SketchLine_14).endPoint() +) SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintDistance_11 = Sketch_2.setDistance(SketchPoint_2.coordinates(), SketchLine_17.result(), "e3*coeff", False) +SketchConstraintDistance_11 = Sketch_2.setDistance( + SketchPoint_2.coordinates(), SketchLine_17.result(), "e3*coeff", False +) SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_9.results()[1], "r2*coeff") -SketchConstraintEqual_9 = Sketch_2.setEqual(SketchArc_9.results()[1], SketchArc_10.results()[1]) -SketchConstraintEqual_10 = Sketch_2.setEqual(SketchArc_11.results()[1], SketchArc_12.results()[1]) +SketchConstraintEqual_9 = Sketch_2.setEqual( + SketchArc_9.results()[1], SketchArc_10.results()[1] +) +SketchConstraintEqual_10 = Sketch_2.setEqual( + SketchArc_11.results()[1], SketchArc_12.results()[1] +) SketchConstraintRadius_4 = Sketch_2.setRadius(SketchArc_12.results()[1], "r3*coeff") -SketchConstraintDistance_13 = Sketch_2.setDistance(SketchArc_10.startPoint(), SketchLine_19.result(), "d8*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/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")) +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&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) -SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchLine_26.endPoint(), SketchLine_27.startPoint()) +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 +) +SketchConstraintCoincidence_43 = Sketch_3.setCoincident( + SketchLine_26.endPoint(), SketchLine_27.startPoint() +) SketchLine_28 = Sketch_3.addLine(62.5, -4.999999999999999, 46.25, -4.999999999999999) -SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchLine_27.endPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_44 = Sketch_3.setCoincident( + SketchLine_27.endPoint(), SketchLine_28.startPoint() +) SketchLine_29 = Sketch_3.addLine(46.25, -4.999999999999999, 46.25, 22.91561885925604) -SketchConstraintCoincidence_45 = Sketch_3.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint()) -SketchLine_30 = Sketch_3.addLine(46.25, 35.00000000000001, 56.25000000000002, 35.00000000000001) -SketchLine_31 = Sketch_3.addLine(56.25000000000002, 35.00000000000001, 56.25000000000002, 27.50000000000001) -SketchConstraintCoincidence_46 = Sketch_3.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) -SketchLine_32 = Sketch_3.addLine(56.25000000000002, 27.50000000000001, 46.25, 27.50000000000001) -SketchConstraintCoincidence_47 = Sketch_3.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) -SketchConstraintCoincidence_48 = Sketch_3.setCoincident(SketchLine_32.endPoint(), SketchLine_25.result()) +SketchConstraintCoincidence_45 = Sketch_3.setCoincident( + SketchLine_28.endPoint(), SketchLine_29.startPoint() +) +SketchLine_30 = Sketch_3.addLine( + 46.25, 35.00000000000001, 56.25000000000002, 35.00000000000001 +) +SketchLine_31 = Sketch_3.addLine( + 56.25000000000002, 35.00000000000001, 56.25000000000002, 27.50000000000001 +) +SketchConstraintCoincidence_46 = Sketch_3.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) +SketchLine_32 = Sketch_3.addLine( + 56.25000000000002, 27.50000000000001, 46.25, 27.50000000000001 +) +SketchConstraintCoincidence_47 = Sketch_3.setCoincident( + SketchLine_31.endPoint(), SketchLine_32.startPoint() +) +SketchConstraintCoincidence_48 = Sketch_3.setCoincident( + SketchLine_32.endPoint(), SketchLine_25.result() +) SketchLine_33 = Sketch_3.addLine(46.25, 27.50000000000001, 46.25, 35.00000000000001) -SketchConstraintCoincidence_49 = Sketch_3.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint()) -SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchLine_30.startPoint(), SketchLine_33.endPoint()) +SketchConstraintCoincidence_49 = Sketch_3.setCoincident( + SketchLine_32.endPoint(), SketchLine_33.startPoint() +) +SketchConstraintCoincidence_50 = Sketch_3.setCoincident( + SketchLine_30.startPoint(), SketchLine_33.endPoint() +) SketchConstraintHorizontal_9 = Sketch_3.setHorizontal(SketchLine_28.result()) SketchConstraintHorizontal_10 = Sketch_3.setHorizontal(SketchLine_26.result()) SketchConstraintHorizontal_11 = Sketch_3.setHorizontal(SketchLine_32.result()) @@ -234,138 +557,454 @@ SketchConstraintVertical_11 = Sketch_3.setVertical(SketchLine_29.result()) 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&Sketch_2/SketchLine_18][Extrusion_2_1/Generated_Face&Sketch_2/SketchArc_10_2]"), False) +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&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&Sketch_2/SketchArc_9_2][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_16]"), False) +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") +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" +) SketchConstraintLength_3 = Sketch_3.setLength(SketchLine_33.result(), "h3*coeff") -SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchLine_30.endPoint(), SketchLine_35.result()) -SketchConstraintDistance_16 = Sketch_3.setDistance(SketchLine_27.result(), SketchLine_28.endPoint(), "(d6-e2)*coeff") -SketchConstraintCoincidence_53 = Sketch_3.setCoincident(SketchLine_28.endPoint(), SketchLine_25.result()) -SketchConstraintCoincidence_54 = Sketch_3.setCoincident(SketchLine_29.endPoint(), SketchLine_24.startPoint()) -SketchConstraintDistance_17 = Sketch_3.setDistance(SketchLine_26.result(), SketchAPI_Line(SketchLine_35).startPoint(), "h2*coeff") +SketchConstraintCoincidence_52 = Sketch_3.setCoincident( + SketchLine_30.endPoint(), SketchLine_35.result() +) +SketchConstraintDistance_16 = Sketch_3.setDistance( + SketchLine_27.result(), SketchLine_28.endPoint(), "(d6-e2)*coeff" +) +SketchConstraintCoincidence_53 = Sketch_3.setCoincident( + SketchLine_28.endPoint(), SketchLine_25.result() +) +SketchConstraintCoincidence_54 = Sketch_3.setCoincident( + SketchLine_29.endPoint(), SketchLine_24.startPoint() +) +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_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) +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&Sketch_1/SketchLine_9][Extrusion_1_1/To_Face]"), False) +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/Modified_Face&Sketch_2/SketchLine_23][ExtrusionCut_2_1/Generated_Face&Sketch_3/SketchLine_31]"), False) +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&Sketch_1/SketchLine_10][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_6_2]"), False) +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()) -SketchArc_13 = Sketch_4.addArc(-31.25, -31.25000000000001, -31.24999999999999, -35.00000000000001, -34.99999999999999, -31.25000000000001, True) -SketchConstraintCoincidence_56 = Sketch_4.setCoincident(SketchLine_39.endPoint(), SketchArc_13.startPoint()) -SketchConstraintTangent_25 = Sketch_4.setTangent(SketchLine_39.result(), SketchArc_13.results()[1]) -SketchLine_40 = Sketch_4.addLine(-34.99999999999999, -31.25000000000001, -34.99999999999999, -20) -SketchConstraintCoincidence_57 = Sketch_4.setCoincident(SketchArc_13.endPoint(), SketchLine_40.startPoint()) +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() +) +SketchArc_13 = Sketch_4.addArc( + -31.25, + -31.25000000000001, + -31.24999999999999, + -35.00000000000001, + -34.99999999999999, + -31.25000000000001, + True, +) +SketchConstraintCoincidence_56 = Sketch_4.setCoincident( + SketchLine_39.endPoint(), SketchArc_13.startPoint() +) +SketchConstraintTangent_25 = Sketch_4.setTangent( + SketchLine_39.result(), SketchArc_13.results()[1] +) +SketchLine_40 = Sketch_4.addLine( + -34.99999999999999, -31.25000000000001, -34.99999999999999, -20 +) +SketchConstraintCoincidence_57 = Sketch_4.setCoincident( + SketchArc_13.endPoint(), SketchLine_40.startPoint() +) SketchLine_41 = Sketch_4.addLine(-34.99999999999999, -20, -32.49999999999999, -20) -SketchConstraintCoincidence_58 = Sketch_4.setCoincident(SketchLine_40.endPoint(), SketchLine_41.startPoint()) -SketchLine_42 = Sketch_4.addLine(-32.49999999999999, -20, -32.49999999999999, -31.24999999999389) -SketchConstraintCoincidence_59 = Sketch_4.setCoincident(SketchLine_41.endPoint(), SketchLine_42.startPoint()) -SketchArc_14 = Sketch_4.addArc(-31.24999999999999, -31.24999999999393, -32.49999999999999, -31.24999999999389, -31.25000000000371, -32.50000000000001, False) -SketchConstraintCoincidence_60 = Sketch_4.setCoincident(SketchLine_42.endPoint(), SketchArc_14.startPoint()) -SketchConstraintTangent_26 = Sketch_4.setTangent(SketchLine_42.result(), SketchArc_14.results()[1]) -SketchLine_43 = Sketch_4.addLine(-31.25000000000371, -32.50000000000001, -25, -32.50000000000001) -SketchConstraintCoincidence_61 = Sketch_4.setCoincident(SketchArc_14.endPoint(), SketchLine_43.startPoint()) -SketchConstraintCoincidence_62 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_37).endPoint(), SketchLine_43.endPoint()) +SketchConstraintCoincidence_58 = Sketch_4.setCoincident( + SketchLine_40.endPoint(), SketchLine_41.startPoint() +) +SketchLine_42 = Sketch_4.addLine( + -32.49999999999999, -20, -32.49999999999999, -31.24999999999389 +) +SketchConstraintCoincidence_59 = Sketch_4.setCoincident( + SketchLine_41.endPoint(), SketchLine_42.startPoint() +) +SketchArc_14 = Sketch_4.addArc( + -31.24999999999999, + -31.24999999999393, + -32.49999999999999, + -31.24999999999389, + -31.25000000000371, + -32.50000000000001, + False, +) +SketchConstraintCoincidence_60 = Sketch_4.setCoincident( + SketchLine_42.endPoint(), SketchArc_14.startPoint() +) +SketchConstraintTangent_26 = Sketch_4.setTangent( + SketchLine_42.result(), SketchArc_14.results()[1] +) +SketchLine_43 = Sketch_4.addLine( + -31.25000000000371, -32.50000000000001, -25, -32.50000000000001 +) +SketchConstraintCoincidence_61 = Sketch_4.setCoincident( + SketchArc_14.endPoint(), SketchLine_43.startPoint() +) +SketchConstraintCoincidence_62 = Sketch_4.setCoincident( + SketchAPI_Line(SketchLine_37).endPoint(), SketchLine_43.endPoint() +) SketchLine_44 = Sketch_4.addLine(-25, -35.00000000000001, -25, -32.50000000000001) -SketchConstraintCoincidence_63 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_37).startPoint(), SketchLine_44.startPoint()) -SketchConstraintCoincidence_64 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_37).endPoint(), SketchLine_44.endPoint()) +SketchConstraintCoincidence_63 = Sketch_4.setCoincident( + SketchAPI_Line(SketchLine_37).startPoint(), SketchLine_44.startPoint() +) +SketchConstraintCoincidence_64 = Sketch_4.setCoincident( + SketchAPI_Line(SketchLine_37).endPoint(), SketchLine_44.endPoint() +) SketchConstraintHorizontal_13 = Sketch_4.setHorizontal(SketchLine_41.result()) SketchConstraintHorizontal_14 = Sketch_4.setHorizontal(SketchLine_43.result()) SketchConstraintHorizontal_15 = Sketch_4.setHorizontal(SketchLine_39.result()) SketchConstraintVertical_15 = Sketch_4.setVertical(SketchLine_42.result()) SketchConstraintVertical_16 = Sketch_4.setVertical(SketchLine_40.result()) -SketchConstraintTangent_27 = Sketch_4.setTangent(SketchArc_13.results()[1], SketchLine_40.result()) -SketchConstraintTangent_28 = Sketch_4.setTangent(SketchArc_14.results()[1], SketchLine_43.result()) -SketchConstraintDistance_18 = Sketch_4.setDistance(SketchLine_40.result(), SketchLine_44.startPoint(), "h1*coeff") +SketchConstraintTangent_27 = Sketch_4.setTangent( + SketchArc_13.results()[1], SketchLine_40.result() +) +SketchConstraintTangent_28 = Sketch_4.setTangent( + SketchArc_14.results()[1], SketchLine_43.result() +) +SketchConstraintDistance_18 = Sketch_4.setDistance( + SketchLine_40.result(), SketchLine_44.startPoint(), "h1*coeff" +) SketchConstraintRadius_5 = Sketch_4.setRadius(SketchArc_13.results()[1], "r2*coeff") SketchConstraintRadius_6 = Sketch_4.setRadius(SketchArc_14.results()[1], "r3*coeff") -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") +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/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")) +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/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&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_13]")) +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&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&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7]"), False) +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") +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_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")) +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&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_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 = 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/SketchLine_10")) -SketchConstraintDistance_24 = Sketch_6.setDistance(SketchCircle_2.center(), SketchLine_50.result(), "d_trou") +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_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")) +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&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][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]) -SketchConstraintCoincidence_68 = Sketch_7.setCoincident(SketchLine_53.result(), SketchArc_15.endPoint()) +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][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] +) +SketchConstraintCoincidence_68 = Sketch_7.setCoincident( + SketchLine_53.result(), SketchArc_15.endPoint() +) SketchConstraintRadius_9 = Sketch_7.setRadius(SketchArc_15.results()[1], "r1") SketchLine_54 = Sketch_7.addLine(104.5, 0, 110, 0) -SketchConstraintCoincidence_69 = Sketch_7.setCoincident(SketchArc_15.endPoint(), SketchLine_54.startPoint()) -SketchConstraintCoincidence_70 = Sketch_7.setCoincident(SketchLine_52.startPoint(), SketchLine_54.endPoint()) +SketchConstraintCoincidence_69 = Sketch_7.setCoincident( + SketchArc_15.endPoint(), SketchLine_54.startPoint() +) +SketchConstraintCoincidence_70 = Sketch_7.setCoincident( + SketchLine_52.startPoint(), SketchLine_54.endPoint() +) SketchPoint_3 = Sketch_7.addPoint(0, 0) SketchLine_55 = Sketch_7.addLine(110, 7.22841614740048, 110, 0) -SketchConstraintCoincidence_71 = Sketch_7.setCoincident(SketchLine_51.endPoint(), SketchLine_55.startPoint()) -SketchConstraintCoincidence_72 = Sketch_7.setCoincident(SketchLine_52.startPoint(), SketchLine_55.endPoint()) +SketchConstraintCoincidence_71 = Sketch_7.setCoincident( + SketchLine_51.endPoint(), SketchLine_55.startPoint() +) +SketchConstraintCoincidence_72 = Sketch_7.setCoincident( + SketchLine_52.startPoint(), SketchLine_55.endPoint() +) 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&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][ExtrusionCut_4_1/Modified_Face&Sketch_1/SketchLine_4]"), False) +SketchConstraintCoincidence_73 = Sketch_7.setCoincident( + SketchLine_56.startPoint(), SketchLine_52.result() +) +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][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) SketchLine_60 = Sketch_7.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintCoincidence_75 = Sketch_7.setCoincident(SketchLine_59.startPoint(), SketchLine_60.result()) -SketchConstraintCoincidence_76 = Sketch_7.setCoincident(SketchLine_59.endPoint(), SketchLine_58.result()) -SketchConstraintMiddle_3 = Sketch_7.setMiddlePoint(SketchLine_59.endPoint(), SketchLine_58.result()) +SketchConstraintCoincidence_75 = Sketch_7.setCoincident( + SketchLine_59.startPoint(), SketchLine_60.result() +) +SketchConstraintCoincidence_76 = Sketch_7.setCoincident( + SketchLine_59.endPoint(), SketchLine_58.result() +) +SketchConstraintMiddle_3 = Sketch_7.setMiddlePoint( + SketchLine_59.endPoint(), SketchLine_58.result() +) SketchConstraintVertical_17 = Sketch_7.setVertical(SketchLine_59.result()) -SketchConstraintMirror_1_objects = [SketchArc_15.results()[1], SketchLine_55.result(), SketchLine_54.result()] -SketchConstraintMirror_1 = Sketch_7.addMirror(SketchLine_56.result(), SketchConstraintMirror_1_objects) +SketchConstraintMirror_1_objects = [ + SketchArc_15.results()[1], + SketchLine_55.result(), + SketchLine_54.result(), +] +SketchConstraintMirror_1 = Sketch_7.addMirror( + SketchLine_56.result(), SketchConstraintMirror_1_objects +) [SketchArc_16, SketchLine_61, SketchLine_62] = SketchConstraintMirror_1.mirrored() -SketchConstraintMirror_2_objects = [SketchArc_15.results()[1], SketchLine_55.result(), SketchLine_54.result(), SketchArc_16.results()[1], SketchLine_62.result(), SketchLine_52.result()] -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() +SketchConstraintMirror_2_objects = [ + SketchArc_15.results()[1], + SketchLine_55.result(), + SketchLine_54.result(), + SketchArc_16.results()[1], + SketchLine_62.result(), + SketchLine_52.result(), +] +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/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")]) +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.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Part_1, 1) model.testNbSubShapes(Part_1, GeomAPI_Shape.SOLID, [1]) diff --git a/test.compatibility/piece_12.py b/test.compatibility/piece_12.py index 46ee895c6..6b4b525fa 100644 --- a/test.compatibility/piece_12.py +++ b/test.compatibility/piece_12.py @@ -56,27 +56,43 @@ model.addParameter(Part_1_doc, "coeff", "1") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 15) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchCircle_2 = Sketch_1.addCircle(80, 0, 15) SketchCircle_3 = Sketch_1.addCircle(0, 0, 12.5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchCircle_3.center()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchCircle_3.center() +) SketchCircle_4 = Sketch_1.addCircle(80, 0, 14) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchCircle_4.center()) -SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_3.results()[1], "r_al1*coeff") -SketchConstraintRadius_2 = Sketch_1.setRadius(SketchCircle_4.results()[1], "r_al2*coeff") +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchCircle_2.center(), SketchCircle_4.center() +) +SketchConstraintRadius_1 = Sketch_1.setRadius( + SketchCircle_3.results()[1], "r_al1*coeff" +) +SketchConstraintRadius_2 = Sketch_1.setRadius( + SketchCircle_4.results()[1], "r_al2*coeff" +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchCircle_1.results()[1], "r4*coeff") SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], "r4*coeff") -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_3.center(), SketchCircle_4.center(), "entraxe*coeff") +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_3.center(), SketchCircle_4.center(), "entraxe*coeff" +) SketchArc_1 = Sketch_1.addArc(0, 0, 13.96424004376894, -17, 13.96424004376894, 17, True) SketchArc_1.setName("SketchArc_4") SketchArc_1.result().setName("SketchArc_4") SketchArc_1.results()[1].setName("SketchArc_4_2") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchCircle_3.center(), SketchArc_1.center()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchCircle_3.center(), SketchArc_1.center() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_7") SketchLine_1 = Sketch_1.addLine(13.96424004376894, 17, 66.03575995620928, 17) SketchLine_1.setName("SketchLine_6") SketchLine_1.result().setName("SketchLine_6") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.startPoint() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_18") SketchLine_2 = Sketch_1.addLine(13.96424004376894, -17, 66.03575995623092, -17) SketchLine_2.setName("SketchLine_10") @@ -88,72 +104,124 @@ SketchConstraintHorizontal_2.setName("SketchConstraintHorizontal_6") SketchLine_3 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_3.setName("SketchLine_11") SketchLine_3.result().setName("SketchLine_11") -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_2.startPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_15") SketchConstraintRadius_5 = Sketch_1.setRadius(SketchArc_1.results()[1], "r2*coeff") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchArc_1.endPoint(), SketchLine_3.result(), "epaisseur/2*coeff") -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchArc_1.endPoint(), SketchLine_2.result(), "epaisseur*coeff") -SketchArc_2 = Sketch_1.addArc(80, 0, 66.03575995623092, -17, 66.03575995620928, 17, False) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchArc_2.center()) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchArc_1.endPoint(), SketchLine_3.result(), "epaisseur/2*coeff" +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchArc_1.endPoint(), SketchLine_2.result(), "epaisseur*coeff" +) +SketchArc_2 = Sketch_1.addArc( + 80, 0, 66.03575995623092, -17, 66.03575995620928, 17, False +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchCircle_2.center(), SketchArc_2.center() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_2.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchArc_2.startPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_9") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_1.endPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_1.endPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchLine_3.result()) +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(0, 0, 15.46247221747307, -11.0413745939477, 18.89444362769119, -2, False) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchArc_1.results()[1], SketchArc_2.results()[1] +) +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 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_3.center() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_54") -SketchArc_4 = Sketch_1.addArc(0, 0, 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") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_4.center()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_4.center() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_55") -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchArc_4.results()[1], SketchArc_3.results()[1]) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchArc_4.results()[1], SketchArc_3.results()[1] +) SketchConstraintEqual_2.setName("SketchConstraintEqual_8") -SketchArc_5 = Sketch_1.addArc(17.5, 12.49632352941176, 15.46247221747308, 11.04137459394768, 17.5, 15, True) +SketchArc_5 = Sketch_1.addArc( + 17.5, 12.49632352941176, 15.46247221747308, 11.04137459394768, 17.5, 15, True +) SketchArc_5.setName("SketchArc_9") SketchArc_5.result().setName("SketchArc_9") SketchArc_5.results()[1].setName("SketchArc_9_2") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchArc_5.startPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchArc_5.startPoint() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_56") -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchArc_5.results()[1]) -SketchArc_6 = Sketch_1.addArc(17.5, -12.49632352941177, 15.46247221747307, -11.0413745939477, 17.5, -15, False) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchArc_5.results()[1] +) +SketchArc_6 = Sketch_1.addArc( + 17.5, -12.49632352941177, 15.46247221747307, -11.0413745939477, 17.5, -15, False +) SketchArc_6.setName("SketchArc_10") SketchArc_6.result().setName("SketchArc_10") SketchArc_6.results()[1].setName("SketchArc_10_2") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchArc_6.startPoint()) +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]) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchArc_6.results()[1] +) 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()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_58") SketchLine_5 = Sketch_1.addLine(18.89444362769119, -2, 34.49444362769118, -2) SketchLine_5.setName("SketchLine_44") SketchLine_5.result().setName("SketchLine_44") -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_60") SketchLine_6 = Sketch_1.addLine(18.89444362769119, 2, 34.49444362769118, 2) SketchLine_6.setName("SketchLine_45") SketchLine_6.result().setName("SketchLine_45") -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchArc_4.startPoint(), SketchLine_6.startPoint() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_61") 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()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_7.startPoint() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_62") -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchArc_5.results()[1], SketchArc_6.results()[1]) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchArc_5.results()[1], SketchArc_6.results()[1] +) SketchConstraintEqual_3.setName("SketchConstraintEqual_9") -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_6.result()) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_6.result() +) SketchConstraintEqual_4.setName("SketchConstraintEqual_11") SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintHorizontal_3.setName("SketchConstraintHorizontal_12") @@ -167,95 +235,165 @@ SketchLine_8 = Sketch_1.addLine(40, 17, 40, -17) SketchLine_8.setName("SketchLine_47") SketchLine_8.result().setName("SketchLine_47") SketchLine_8.setAuxiliary(True) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_8.startPoint(), SketchLine_1.result() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_63") -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_2.result() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_64") -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_8.startPoint(), SketchLine_1.result()) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchLine_8.startPoint(), SketchLine_1.result() +) SketchConstraintMiddle_1.setName("SketchConstraintMiddle_4") -SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint(SketchLine_8.endPoint(), SketchLine_2.result()) +SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint( + SketchLine_8.endPoint(), SketchLine_2.result() +) SketchConstraintMiddle_2.setName("SketchConstraintMiddle_5") SketchPoint_2 = Sketch_1.addPoint(40, 2.220450266386716e-15) SketchPoint_2.setName("SketchPoint_7") SketchPoint_2.result().setName("SketchPoint_7") -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_8.result()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_8.result() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_65") -SketchConstraintMiddle_3 = Sketch_1.setMiddlePoint(SketchLine_8.result(), SketchPoint_2.coordinates()) +SketchConstraintMiddle_3 = Sketch_1.setMiddlePoint( + SketchLine_8.result(), SketchPoint_2.coordinates() +) SketchConstraintMiddle_3.setName("SketchConstraintMiddle_6") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_3.result(), "2*coeff") +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchLine_3.result(), "2*coeff" +) SketchConstraintDistance_4.setName("SketchConstraintDistance_17") -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchArc_3.endPoint(), SketchLine_3.result(), "2*coeff") +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchArc_3.endPoint(), SketchLine_3.result(), "2*coeff" +) SketchConstraintDistance_5.setName("SketchConstraintDistance_18") SketchConstraintRadius_6 = Sketch_1.setRadius(SketchArc_4.results()[1], "(r4+4)*coeff") SketchConstraintRadius_6.setName("SketchConstraintRadius_13") -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_4.endPoint(), SketchLine_8.result(), "2*coeff") +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_4.endPoint(), SketchLine_8.result(), "2*coeff" +) SketchConstraintDistance_6.setName("SketchConstraintDistance_19") 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") -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchArc_7.center()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchArc_7.center() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_66") -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchArc_7.startPoint()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchArc_7.startPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_67") -SketchArc_8 = Sketch_1.addArc(40, 0, 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") -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchArc_8.center()) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchArc_8.center() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_68") -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchArc_8.startPoint()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchArc_8.startPoint() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_69") -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_7.endPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchArc_7.endPoint(), SketchLine_7.endPoint() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_72") -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchArc_5.endPoint(), SketchLine_1.result(), "2*coeff") +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchArc_5.endPoint(), SketchLine_1.result(), "2*coeff" +) SketchConstraintDistance_7.setName("SketchConstraintDistance_21") -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchLine_4.result()) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_5.results()[1], SketchLine_4.result() +) SketchCircle_5 = Sketch_1.addCircle(40, -13, 2.5) SketchCircle_5.setName("SketchCircle_11") SketchCircle_5.result().setName("SketchCircle_11") SketchCircle_5.results()[1].setName("SketchCircle_11_2") -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_8.result(), SketchCircle_5.center()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_8.result(), SketchCircle_5.center() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_70") SketchConstraintRadius_7 = Sketch_1.setRadius(SketchCircle_5.results()[1], "2.5*coeff") SketchConstraintRadius_7.setName("SketchConstraintRadius_14") -SketchArc_9 = Sketch_1.addArc(40, -13, 35.51437699680511, -13.35942492012782, 37.95784774655168, -8.990060577298436, True) +SketchArc_9 = Sketch_1.addArc( + 40, + -13, + 35.51437699680511, + -13.35942492012782, + 37.95784774655168, + -8.990060577298436, + True, +) SketchArc_9.setName("SketchArc_13") SketchArc_9.result().setName("SketchArc_13") SketchArc_9.results()[1].setName("SketchArc_13_2") -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchCircle_5.center(), SketchArc_9.center()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchCircle_5.center(), SketchArc_9.center() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_71") -SketchLine_9 = Sketch_1.addLine(37.95784774655168, -5.490060577298436, 37.95784774655168, -8.990060577298436) +SketchLine_9 = Sketch_1.addLine( + 37.95784774655168, -5.490060577298436, 37.95784774655168, -8.990060577298436 +) SketchLine_9.setName("SketchLine_48") SketchLine_9.result().setName("SketchLine_48") -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchArc_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_74") -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_9.endPoint(), SketchLine_9.endPoint()) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchArc_9.endPoint(), SketchLine_9.endPoint() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_75") SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintVertical_2.setName("SketchConstraintVertical_8") SketchConstraintRadius_8 = Sketch_1.setRadius(SketchArc_9.results()[1], "(2.5+2)*coeff") SketchConstraintRadius_8.setName("SketchConstraintRadius_15") -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchCircle_5.center(), SketchLine_2.result(), "4*coeff") +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, -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 = Sketch_1.setCoincident( + SketchArc_6.endPoint(), SketchLine_10.startPoint() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_73") -SketchArc_10 = Sketch_1.addArc(34, -13.48076923076937, 34, -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") -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_10.startPoint()) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchArc_10.startPoint() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_76") -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_10.result(), SketchArc_10.results()[1]) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_9.results()[1], SketchArc_10.endPoint()) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchLine_10.result(), SketchArc_10.results()[1] +) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchArc_9.results()[1], SketchArc_10.endPoint() +) SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_77") -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_9.results()[1], SketchArc_10.results()[1]) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchArc_9.startPoint(), SketchArc_10.endPoint()) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchArc_9.results()[1], SketchArc_10.results()[1] +) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchArc_9.startPoint(), SketchArc_10.endPoint() +) SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_78") -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_10.endPoint(), SketchLine_2.result(), "2*coeff") +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_10.endPoint(), SketchLine_2.result(), "2*coeff" +) SketchConstraintDistance_9.setName("SketchConstraintDistance_20") SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_10.result()) SketchConstraintHorizontal_6.setName("SketchConstraintHorizontal_15") @@ -267,9 +405,13 @@ SketchLine_11 = Sketch_1.addLine(17.5, 15, 17.5, -15) SketchLine_11.setName("SketchLine_49") SketchLine_11.result().setName("SketchLine_49") SketchLine_11.setAuxiliary(True) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchLine_11.startPoint() +) SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_79") -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_11.endPoint()) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchArc_6.endPoint(), SketchLine_11.endPoint() +) SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_80") SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_11.result()) SketchConstraintVertical_3.setName("SketchConstraintVertical_9") @@ -277,9 +419,41 @@ SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_5.result(), "15.6*coeff SketchConstraintLength_3.setName("SketchConstraintLength_10") SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_9.result(), "3.5*coeff") SketchConstraintLength_4.setName("SketchConstraintLength_11") -SketchConstraintMirror_1_objects = [SketchLine_4.result(), SketchArc_5.results()[1], SketchArc_4.results()[1], SketchLine_6.result(), SketchArc_7.results()[1], SketchLine_7.result(), SketchLine_5.result(), SketchArc_8.results()[1], SketchLine_9.result(), SketchArc_9.results()[1], SketchArc_10.results()[1], SketchLine_10.result(), SketchArc_6.results()[1], SketchArc_3.results()[1]] -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_8.result(), SketchConstraintMirror_1_objects) -[SketchLine_12, SketchArc_11, SketchArc_12, SketchLine_13, SketchArc_13, SketchLine_14, SketchLine_15, SketchArc_14, SketchLine_16, SketchArc_15, SketchArc_16, SketchLine_17, SketchArc_17, SketchArc_18] = SketchConstraintMirror_1.mirrored() +SketchConstraintMirror_1_objects = [ + SketchLine_4.result(), + SketchArc_5.results()[1], + SketchArc_4.results()[1], + SketchLine_6.result(), + SketchArc_7.results()[1], + SketchLine_7.result(), + SketchLine_5.result(), + SketchArc_8.results()[1], + SketchLine_9.result(), + SketchArc_9.results()[1], + SketchArc_10.results()[1], + SketchLine_10.result(), + SketchArc_6.results()[1], + SketchArc_3.results()[1], +] +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_8.result(), SketchConstraintMirror_1_objects +) +[ + SketchLine_12, + SketchArc_11, + SketchArc_12, + SketchLine_13, + SketchArc_13, + SketchLine_14, + SketchLine_15, + SketchArc_14, + SketchLine_16, + SketchArc_15, + SketchArc_16, + SketchLine_17, + SketchArc_17, + SketchArc_18, +] = SketchConstraintMirror_1.mirrored() SketchArc_18.setName("SketchArc_22") SketchArc_18.result().setName("SketchArc_22") SketchArc_18.results()[1].setName("SketchArc_22_2") @@ -317,14 +491,29 @@ 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/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) +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")) +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/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") @@ -333,24 +522,85 @@ SketchCircle_8 = Sketch_2.addCircle(80, 0, 22) SketchCircle_8.setName("SketchCircle_7") SketchCircle_8.result().setName("SketchCircle_7") SketchCircle_8.results()[1].setName("SketchCircle_7_2") -SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchCircle_6.result(), SketchCircle_8.center()) +SketchConstraintCoincidence_37 = Sketch_2.setCoincident( + SketchCircle_6.result(), SketchCircle_8.center() +) SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_12") SketchConstraintRadius_9 = Sketch_2.setRadius(SketchCircle_8.results()[1], "r2*coeff") 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/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/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) +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/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/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&Sketch_1/SketchArc_4_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"), False) +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/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") @@ -365,17 +615,23 @@ SketchLine_21.result().setName("SketchLine_8") SketchLine_22 = Sketch_3.addLine(72.5, 0, 87.5, 0) SketchLine_22.setName("SketchLine_9") SketchLine_22.result().setName("SketchLine_9") -SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchLine_21.result()) +SketchConstraintCoincidence_38 = Sketch_3.setCoincident( + SketchLine_22.startPoint(), SketchLine_21.result() +) SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_13") SketchLine_23 = Sketch_3.addLine(87.5, 0, 87.5, -12) SketchLine_23.setName("SketchLine_12") SketchLine_23.result().setName("SketchLine_12") -SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) +SketchConstraintCoincidence_39 = Sketch_3.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.startPoint() +) SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_14") SketchLine_24 = Sketch_3.addLine(72.5, -12, 72.5, 0) SketchLine_24.setName("SketchLine_14") SketchLine_24.result().setName("SketchLine_14") -SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchLine_24.endPoint()) +SketchConstraintCoincidence_40 = Sketch_3.setCoincident( + SketchLine_22.startPoint(), SketchLine_24.endPoint() +) SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_19") SketchConstraintHorizontal_7 = Sketch_3.setHorizontal(SketchLine_22.result()) SketchConstraintHorizontal_7.setName("SketchConstraintHorizontal_4") @@ -383,7 +639,9 @@ SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_24.result()) SketchConstraintVertical_4.setName("SketchConstraintVertical_1") SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_23.result()) SketchConstraintVertical_5.setName("SketchConstraintVertical_2") -SketchConstraintEqual_5 = Sketch_3.setEqual(SketchLine_24.result(), SketchLine_23.result()) +SketchConstraintEqual_5 = Sketch_3.setEqual( + SketchLine_24.result(), SketchLine_23.result() +) SketchConstraintEqual_5.setName("SketchConstraintEqual_3") SketchConstraintLength_5 = Sketch_3.setLength(SketchLine_22.result(), "15*coeff") SketchConstraintLength_5.setName("SketchConstraintLength_1") @@ -393,13 +651,19 @@ SketchCircle_9 = Sketch_3.addCircle(80, -9, 4) SketchCircle_9.setName("SketchCircle_8") SketchCircle_9.result().setName("SketchCircle_8") SketchCircle_9.results()[1].setName("SketchCircle_8_2") -SketchConstraintDistance_10 = Sketch_3.setDistance(SketchCircle_9.center(), SketchLine_22.result(), "dtrou*coeff") +SketchConstraintDistance_10 = Sketch_3.setDistance( + SketchCircle_9.center(), SketchLine_22.result(), "dtrou*coeff" +) SketchConstraintDistance_10.setName("SketchConstraintDistance_5") SketchConstraintRadius_10 = Sketch_3.setRadius(SketchCircle_9.results()[1], "M8*coeff") SketchConstraintRadius_10.setName("SketchConstraintRadius_7") -SketchConstraintDistance_11 = Sketch_3.setDistance(SketchLine_20.result(), SketchLine_24.endPoint(), "(entraxe-15/2)*coeff") +SketchConstraintDistance_11 = Sketch_3.setDistance( + SketchLine_20.result(), SketchLine_24.endPoint(), "(entraxe-15/2)*coeff" +) SketchConstraintDistance_11.setName("SketchConstraintDistance_7") -SketchConstraintDistance_12 = Sketch_3.setDistance(SketchCircle_9.center(), SketchLine_24.result(), "15/2*coeff") +SketchConstraintDistance_12 = Sketch_3.setDistance( + SketchCircle_9.center(), SketchLine_24.result(), "15/2*coeff" +) SketchConstraintDistance_12.setName("SketchConstraintDistance_8") SketchLine_25 = Sketch_3.addLine(85, -17, 75, -17) SketchLine_25.setName("SketchLine_26") @@ -407,30 +671,75 @@ SketchLine_25.result().setName("SketchLine_26") SketchLine_26 = Sketch_3.addLine(75, -17, 72.5, -12) SketchLine_26.setName("SketchLine_27") SketchLine_26.result().setName("SketchLine_27") -SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_25.endPoint(), SketchLine_26.startPoint()) +SketchConstraintCoincidence_41 = Sketch_3.setCoincident( + SketchLine_25.endPoint(), SketchLine_26.startPoint() +) SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_31") -SketchConstraintCoincidence_42 = Sketch_3.setCoincident(SketchLine_24.startPoint(), SketchLine_26.endPoint()) +SketchConstraintCoincidence_42 = Sketch_3.setCoincident( + SketchLine_24.startPoint(), SketchLine_26.endPoint() +) SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_32") SketchLine_27 = Sketch_3.addLine(87.5, -12, 85, -17) SketchLine_27.setName("SketchLine_28") SketchLine_27.result().setName("SketchLine_28") -SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_27.startPoint()) +SketchConstraintCoincidence_43 = Sketch_3.setCoincident( + SketchLine_23.endPoint(), SketchLine_27.startPoint() +) SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_33") -SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchLine_25.startPoint(), SketchLine_27.endPoint()) +SketchConstraintCoincidence_44 = Sketch_3.setCoincident( + SketchLine_25.startPoint(), SketchLine_27.endPoint() +) SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_34") SketchConstraintHorizontal_8 = Sketch_3.setHorizontal(SketchLine_25.result()) SketchConstraintHorizontal_8.setName("SketchConstraintHorizontal_7") -SketchConstraintEqual_6 = Sketch_3.setEqual(SketchLine_27.result(), SketchLine_26.result()) +SketchConstraintEqual_6 = Sketch_3.setEqual( + SketchLine_27.result(), SketchLine_26.result() +) SketchConstraintEqual_6.setName("SketchConstraintEqual_7") -SketchConstraintDistance_13 = Sketch_3.setDistance(SketchLine_22.endPoint(), SketchLine_25.result(), "17*coeff") +SketchConstraintDistance_13 = Sketch_3.setDistance( + SketchLine_22.endPoint(), SketchLine_25.result(), "17*coeff" +) SketchConstraintDistance_13.setName("SketchConstraintDistance_11") -SketchConstraintDistance_14 = Sketch_3.setDistance(SketchLine_23.result(), SketchLine_25.startPoint(), "2.5*coeff") +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/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/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")]) +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/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")) SketchLine_28 = SketchProjection_7.createdFeature() @@ -443,44 +752,64 @@ SketchLine_29.result().setName("SketchLine_18") SketchLine_30 = Sketch_4.addLine(7.5, 0, -7.5, 0) SketchLine_30.setName("SketchLine_19") SketchLine_30.result().setName("SketchLine_19") -SketchConstraintCoincidence_45 = Sketch_4.setCoincident(SketchLine_30.startPoint(), SketchLine_29.result()) +SketchConstraintCoincidence_45 = Sketch_4.setCoincident( + SketchLine_30.startPoint(), SketchLine_29.result() +) SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_22") SketchLine_31 = Sketch_4.addLine(-7.5, 0, -7.5, -12) SketchLine_31.setName("SketchLine_20") SketchLine_31.result().setName("SketchLine_20") -SketchConstraintCoincidence_46 = Sketch_4.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_46 = Sketch_4.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_23") SketchLine_32 = Sketch_4.addLine(7.5, -12, 7.5, 0) SketchLine_32.setName("SketchLine_24") SketchLine_32.result().setName("SketchLine_24") -SketchConstraintCoincidence_47 = Sketch_4.setCoincident(SketchLine_30.startPoint(), SketchLine_32.endPoint()) +SketchConstraintCoincidence_47 = Sketch_4.setCoincident( + SketchLine_30.startPoint(), SketchLine_32.endPoint() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_28") SketchConstraintVertical_6 = Sketch_4.setVertical(SketchLine_31.result()) SketchConstraintVertical_6.setName("SketchConstraintVertical_3") SketchConstraintVertical_7 = Sketch_4.setVertical(SketchLine_32.result()) SketchConstraintVertical_7.setName("SketchConstraintVertical_4") -SketchConstraintEqual_7 = Sketch_4.setEqual(SketchLine_31.result(), SketchLine_32.result()) +SketchConstraintEqual_7 = Sketch_4.setEqual( + SketchLine_31.result(), SketchLine_32.result() +) SketchConstraintEqual_7.setName("SketchConstraintEqual_5") -SketchConstraintMiddle_4 = Sketch_4.setMiddlePoint(SketchLine_30.result(), SketchAPI_Line(SketchLine_29).startPoint()) +SketchConstraintMiddle_4 = Sketch_4.setMiddlePoint( + SketchLine_30.result(), SketchAPI_Line(SketchLine_29).startPoint() +) SketchConstraintMiddle_4.setName("SketchConstraintMiddle_1") SketchLine_33 = Sketch_4.addLine(-7.5, -12, -5, -17) SketchLine_33.setName("SketchLine_21") SketchLine_33.result().setName("SketchLine_21") -SketchConstraintCoincidence_48 = Sketch_4.setCoincident(SketchLine_31.endPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_48 = Sketch_4.setCoincident( + SketchLine_31.endPoint(), SketchLine_33.startPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_24") SketchLine_34 = Sketch_4.addLine(-5, -17, 5, -17) SketchLine_34.setName("SketchLine_22") SketchLine_34.result().setName("SketchLine_22") -SketchConstraintCoincidence_49 = Sketch_4.setCoincident(SketchLine_33.endPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_49 = Sketch_4.setCoincident( + SketchLine_33.endPoint(), SketchLine_34.startPoint() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_25") SketchLine_35 = Sketch_4.addLine(5, -17, 7.5, -12) SketchLine_35.setName("SketchLine_23") SketchLine_35.result().setName("SketchLine_23") -SketchConstraintCoincidence_50 = Sketch_4.setCoincident(SketchLine_34.endPoint(), SketchLine_35.startPoint()) +SketchConstraintCoincidence_50 = Sketch_4.setCoincident( + SketchLine_34.endPoint(), SketchLine_35.startPoint() +) SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_26") -SketchConstraintCoincidence_51 = Sketch_4.setCoincident(SketchLine_32.startPoint(), SketchLine_35.endPoint()) +SketchConstraintCoincidence_51 = Sketch_4.setCoincident( + SketchLine_32.startPoint(), SketchLine_35.endPoint() +) SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_27") -SketchConstraintEqual_8 = Sketch_4.setEqual(SketchLine_35.result(), SketchLine_33.result()) +SketchConstraintEqual_8 = Sketch_4.setEqual( + SketchLine_35.result(), SketchLine_33.result() +) SketchConstraintEqual_8.setName("SketchConstraintEqual_6") SketchConstraintHorizontal_10 = Sketch_4.setHorizontal(SketchLine_34.result()) SketchConstraintHorizontal_10.setName("SketchConstraintHorizontal_8") @@ -488,7 +817,9 @@ SketchConstraintLength_7 = Sketch_4.setLength(SketchLine_30.result(), "15*coeff" SketchConstraintLength_7.setName("SketchConstraintLength_4") SketchConstraintLength_8 = Sketch_4.setLength(SketchLine_31.result(), "12*coeff") SketchConstraintLength_8.setName("SketchConstraintLength_5") -SketchConstraintDistance_15 = Sketch_4.setDistance(SketchLine_30.result(), SketchLine_34.endPoint(), "17*coeff") +SketchConstraintDistance_15 = Sketch_4.setDistance( + SketchLine_30.result(), SketchLine_34.endPoint(), "17*coeff" +) SketchConstraintDistance_15.setName("SketchConstraintDistance_9") SketchConstraintLength_9 = Sketch_4.setLength(SketchLine_34.result(), "10*coeff") SketchConstraintLength_9.setName("SketchConstraintLength_6") @@ -502,22 +833,62 @@ SketchLine_36 = Sketch_4.addLine(0, 0, 0, -12.97564207914519) SketchLine_36.setName("SketchLine_25") SketchLine_36.result().setName("SketchLine_25") SketchLine_36.setAuxiliary(True) -SketchConstraintCoincidence_52 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_28).startPoint(), SketchLine_36.startPoint()) +SketchConstraintCoincidence_52 = Sketch_4.setCoincident( + SketchAPI_Line(SketchLine_28).startPoint(), SketchLine_36.startPoint() +) SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_29") SketchConstraintVertical_8 = Sketch_4.setVertical(SketchLine_36.result()) SketchConstraintVertical_8.setName("SketchConstraintVertical_5") -SketchConstraintCoincidence_53 = Sketch_4.setCoincident(SketchCircle_10.center(), SketchLine_36.result()) +SketchConstraintCoincidence_53 = Sketch_4.setCoincident( + SketchCircle_10.center(), SketchLine_36.result() +) SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_30") -SketchConstraintDistance_16 = Sketch_4.setDistance(SketchCircle_10.center(), SketchLine_30.result(), "dtrou*coeff") +SketchConstraintDistance_16 = Sketch_4.setDistance( + SketchCircle_10.center(), SketchLine_30.result(), "dtrou*coeff" +) 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/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&Extrusion_1_1/From_Face")) +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&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") @@ -534,53 +905,92 @@ SketchConstraintHorizontal_12.setName("SketchConstraintHorizontal_11") SketchLine_39 = Sketch_5.addLine(model.selection("EDGE", "PartSet/OX")) 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 = Sketch_5.setDistance( + SketchLine_37.result(), SketchLine_38.startPoint(), "epaisseur*coeff" +) SketchConstraintDistance_17.setName("SketchConstraintDistance_13") 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") -SketchConstraintCoincidence_54 = Sketch_5.setCoincident(SketchPoint_3.coordinates(), SketchArc_19.center()) +SketchConstraintCoincidence_54 = Sketch_5.setCoincident( + SketchPoint_3.coordinates(), SketchArc_19.center() +) SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_36") -SketchConstraintCoincidence_55 = Sketch_5.setCoincident(SketchLine_38.endPoint(), SketchArc_19.startPoint()) +SketchConstraintCoincidence_55 = Sketch_5.setCoincident( + SketchLine_38.endPoint(), SketchArc_19.startPoint() +) SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_37") -SketchConstraintCoincidence_56 = Sketch_5.setCoincident(SketchLine_37.result(), SketchArc_19.endPoint()) +SketchConstraintCoincidence_56 = Sketch_5.setCoincident( + SketchLine_37.result(), SketchArc_19.endPoint() +) SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_39") SketchConstraintRadius_12 = Sketch_5.setRadius(SketchArc_19.results()[1], "r2*coeff") SketchConstraintRadius_12.setName("SketchConstraintRadius_11") SketchLine_40 = Sketch_5.addLine(-32, -17, -32, 17) SketchLine_40.setName("SketchLine_32") SketchLine_40.result().setName("SketchLine_32") -SketchConstraintCoincidence_57 = Sketch_5.setCoincident(SketchLine_38.startPoint(), SketchLine_40.endPoint()) +SketchConstraintCoincidence_57 = Sketch_5.setCoincident( + SketchLine_38.startPoint(), SketchLine_40.endPoint() +) SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_35") -SketchConstraintCoincidence_58 = Sketch_5.setCoincident(SketchLine_40.startPoint(), SketchLine_37.endPoint()) +SketchConstraintCoincidence_58 = Sketch_5.setCoincident( + SketchLine_40.startPoint(), SketchLine_37.endPoint() +) SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_38") -SketchConstraintDistance_18 = Sketch_5.setDistance(SketchLine_40.result(), SketchArc_19.center(), "d1*coeff-entraxe*coeff") +SketchConstraintDistance_18 = Sketch_5.setDistance( + SketchLine_40.result(), SketchArc_19.center(), "d1*coeff-entraxe*coeff" +) SketchConstraintDistance_18.setName("SketchConstraintDistance_14") SketchConstraintVertical_9 = Sketch_5.setVertical(SketchLine_40.result()) SketchConstraintVertical_9.setName("SketchConstraintVertical_6") -SketchConstraintDistance_19 = Sketch_5.setDistance(SketchLine_37.result(), SketchArc_19.center(), "epaisseur/2*coeff") +SketchConstraintDistance_19 = Sketch_5.setDistance( + SketchLine_37.result(), SketchArc_19.center(), "epaisseur/2*coeff" +) SketchConstraintDistance_19.setName("SketchConstraintDistance_15") -SketchConstraintCoincidence_59 = Sketch_5.setCoincident(SketchArc_19.endPoint(), SketchLine_37.startPoint()) +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-SketchArc_5_2r-SketchLine_30r-SketchLine_32r-SketchLine_29r")], 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) -Sketch_6 = model.addSketch(Part_1_doc, GeomAPI_Ax3(Sketch_6_origin, Sketch_6_dirx, Sketch_6_norm)) +Sketch_6 = model.addSketch( + Part_1_doc, GeomAPI_Ax3(Sketch_6_origin, Sketch_6_dirx, Sketch_6_norm) +) 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/SketchLine_29_EndVertex")) +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 = Sketch_6.setCoincident( + SketchLine_41.startPoint(), SketchPoint_4.result() +) SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_41") -SketchPoint_5 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/SketchLine_30_StartVertex")) +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 = Sketch_6.setCoincident( + SketchLine_41.endPoint(), SketchPoint_5.result() +) SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_42") SketchPoint_6 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/SketchPoint_2")) SketchPoint_6.setName("SketchPoint_5") @@ -591,122 +1001,249 @@ SketchLine_42.result().setName("SketchLine_34") 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) +SketchArc_20 = Sketch_6.addArc( + 0, 0, -20.32855135026245, 17, -20.32855135026245, -17, False +) SketchArc_20.setName("SketchArc_6") SketchArc_20.result().setName("SketchArc_6") SketchArc_20.results()[1].setName("SketchArc_6_2") -SketchConstraintCoincidence_62 = Sketch_6.setCoincident(SketchPoint_6.result(), SketchArc_20.center()) +SketchConstraintCoincidence_62 = Sketch_6.setCoincident( + SketchPoint_6.result(), SketchArc_20.center() +) SketchConstraintCoincidence_62.setName("SketchConstraintCoincidence_43") -SketchConstraintCoincidence_63 = Sketch_6.setCoincident(SketchLine_42.result(), SketchArc_20.startPoint()) +SketchConstraintCoincidence_63 = Sketch_6.setCoincident( + SketchLine_42.result(), SketchArc_20.startPoint() +) SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_44") -SketchConstraintCoincidence_64 = Sketch_6.setCoincident(SketchLine_43.result(), SketchArc_20.endPoint()) +SketchConstraintCoincidence_64 = Sketch_6.setCoincident( + SketchLine_43.result(), SketchArc_20.endPoint() +) SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_45") SketchLine_44 = Sketch_6.addLine(-20.32855135026245, -17, -32, -17) SketchLine_44.setName("SketchLine_36") SketchLine_44.result().setName("SketchLine_36") -SketchConstraintCoincidence_65 = Sketch_6.setCoincident(SketchArc_20.endPoint(), SketchLine_44.startPoint()) +SketchConstraintCoincidence_65 = Sketch_6.setCoincident( + SketchArc_20.endPoint(), SketchLine_44.startPoint() +) SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_46") -SketchConstraintCoincidence_66 = Sketch_6.setCoincident(SketchLine_41.startPoint(), SketchLine_44.endPoint()) +SketchConstraintCoincidence_66 = Sketch_6.setCoincident( + SketchLine_41.startPoint(), SketchLine_44.endPoint() +) SketchConstraintCoincidence_66.setName("SketchConstraintCoincidence_47") SketchLine_45 = Sketch_6.addLine(-20.32855135026245, 17, -32, 17) SketchLine_45.setName("SketchLine_37") SketchLine_45.result().setName("SketchLine_37") -SketchConstraintCoincidence_67 = Sketch_6.setCoincident(SketchArc_20.startPoint(), SketchLine_45.startPoint()) +SketchConstraintCoincidence_67 = Sketch_6.setCoincident( + SketchArc_20.startPoint(), SketchLine_45.startPoint() +) SketchConstraintCoincidence_67.setName("SketchConstraintCoincidence_48") -SketchConstraintCoincidence_68 = Sketch_6.setCoincident(SketchLine_41.endPoint(), SketchLine_45.endPoint()) +SketchConstraintCoincidence_68 = Sketch_6.setCoincident( + SketchLine_41.endPoint(), SketchLine_45.endPoint() +) 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_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")) +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&Sketch_6/SketchLine_33][Extrusion_6_1/To_Face]")) +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 = 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&Sketch_5/SketchLine_32][Extrusion_5_1/From_Face]")) +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()) +SketchConstraintCoincidence_70 = Sketch_7.setCoincident( + SketchLine_46.endPoint(), SketchLine_48.result() +) SketchConstraintCoincidence_70.setName("SketchConstraintCoincidence_51") -SketchConstraintMiddle_5 = Sketch_7.setMiddlePoint(SketchLine_46.startPoint(), SketchLine_47.result()) +SketchConstraintMiddle_5 = Sketch_7.setMiddlePoint( + SketchLine_46.startPoint(), SketchLine_47.result() +) SketchConstraintMiddle_5.setName("SketchConstraintMiddle_2") -SketchConstraintMiddle_6 = Sketch_7.setMiddlePoint(SketchLine_48.result(), SketchLine_46.endPoint()) +SketchConstraintMiddle_6 = Sketch_7.setMiddlePoint( + SketchLine_48.result(), SketchLine_46.endPoint() +) SketchConstraintMiddle_6.setName("SketchConstraintMiddle_3") SketchPoint_7 = Sketch_7.addPoint(17, -1.95597787542754e-16) SketchPoint_7.setName("SketchPoint_6") SketchPoint_7.result().setName("SketchPoint_6") -SketchConstraintCoincidence_71 = Sketch_7.setCoincident(SketchPoint_7.coordinates(), SketchLine_46.result()) +SketchConstraintCoincidence_71 = Sketch_7.setCoincident( + SketchPoint_7.coordinates(), SketchLine_46.result() +) SketchConstraintCoincidence_71.setName("SketchConstraintCoincidence_52") SketchProjection_9 = Sketch_7.addProjection(model.selection("EDGE", "PartSet/OZ")) SketchLine_49 = SketchProjection_9.createdFeature() SketchLine_49.setName("SketchLine_41") SketchLine_49.result().setName("SketchLine_41") -SketchConstraintDistance_20 = Sketch_7.setDistance(SketchLine_49.result(), SketchPoint_7.coordinates(), "(h_o-h_p)*coeff") +SketchConstraintDistance_20 = Sketch_7.setDistance( + SketchLine_49.result(), SketchPoint_7.coordinates(), "(h_o-h_p)*coeff" +) SketchConstraintDistance_20.setName("SketchConstraintDistance_16") SketchCircle_11 = Sketch_7.addCircle(17, -1.95597787542754e-16, 2.5) SketchCircle_11.setName("SketchCircle_10") SketchCircle_11.result().setName("SketchCircle_10") SketchCircle_11.results()[1].setName("SketchCircle_10_2") -SketchConstraintCoincidence_72 = Sketch_7.setCoincident(SketchPoint_7.coordinates(), SketchCircle_11.center()) +SketchConstraintCoincidence_72 = Sketch_7.setCoincident( + SketchPoint_7.coordinates(), SketchCircle_11.center() +) 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/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")) +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/Modified_Face&Sketch_6/SketchLine_33][Extrusion_6_1/To_Face]")) +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 = 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 = 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&Sketch_6/SketchLine_36][ExtrusionCut_9_1/Modified_Face&Sketch_6/SketchLine_33]")) +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, 33.9999999583228, -17, True) SketchArc_21.setName("SketchArc_23") SketchArc_21.result().setName("SketchArc_23") SketchArc_21.results()[1].setName("SketchArc_23_2") -SketchConstraintCoincidence_75 = Sketch_8.setCoincident(SketchLine_50.endPoint(), SketchArc_21.startPoint()) +SketchConstraintCoincidence_75 = Sketch_8.setCoincident( + SketchLine_50.endPoint(), SketchArc_21.startPoint() +) SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_83") -SketchConstraintTangent_6 = Sketch_8.setTangent(SketchLine_50.result(), SketchArc_21.results()[1]) -SketchConstraintCoincidence_76 = Sketch_8.setCoincident(SketchLine_52.result(), SketchArc_21.endPoint()) +SketchConstraintTangent_6 = Sketch_8.setTangent( + SketchLine_50.result(), SketchArc_21.results()[1] +) +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()) +SketchConstraintTangent_7 = Sketch_8.setTangent( + SketchArc_21.results()[1], SketchLine_52.result() +) 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()) +SketchConstraintCoincidence_77 = Sketch_8.setCoincident( + SketchArc_21.endPoint(), SketchLine_53.startPoint() +) SketchConstraintCoincidence_77.setName("SketchConstraintCoincidence_85") -SketchConstraintCoincidence_78 = Sketch_8.setCoincident(SketchLine_51.startPoint(), SketchLine_53.endPoint()) +SketchConstraintCoincidence_78 = Sketch_8.setCoincident( + SketchLine_51.startPoint(), SketchLine_53.endPoint() +) SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_86") SketchLine_54 = Sketch_8.addLine(37, -14, 37, -17) SketchLine_54.setName("SketchLine_60") SketchLine_54.result().setName("SketchLine_60") -SketchConstraintCoincidence_79 = Sketch_8.setCoincident(SketchLine_50.endPoint(), SketchLine_54.startPoint()) +SketchConstraintCoincidence_79 = Sketch_8.setCoincident( + SketchLine_50.endPoint(), SketchLine_54.startPoint() +) SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_87") -SketchConstraintCoincidence_80 = Sketch_8.setCoincident(SketchLine_51.startPoint(), SketchLine_54.endPoint()) +SketchConstraintCoincidence_80 = Sketch_8.setCoincident( + SketchLine_51.startPoint(), SketchLine_54.endPoint() +) 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/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()] -SketchConstraintMirror_2 = Sketch_8.addMirror(SketchLine_55.result(), SketchConstraintMirror_2_objects) +SketchConstraintMirror_2_objects = [ + SketchArc_21.results()[1], + SketchLine_54.result(), + SketchLine_53.result(), +] +SketchConstraintMirror_2 = Sketch_8.addMirror( + SketchLine_55.result(), SketchConstraintMirror_2_objects +) [SketchArc_22, SketchLine_56, SketchLine_57] = SketchConstraintMirror_2.mirrored() SketchLine_57.setName("SketchLine_63") SketchLine_57.result().setName("SketchLine_63") @@ -716,53 +1253,111 @@ 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-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")) +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&Sketch_5/SketchLine_32][Extrusion_5_1/Generated_Face&Sketch_5/SketchLine_29]")) +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 = 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 = 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&Sketch_5/SketchLine_29][Extrusion_5_1/From_Face]")) +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) SketchArc_23.setName("SketchArc_25") SketchArc_23.result().setName("SketchArc_25") SketchArc_23.results()[1].setName("SketchArc_25_2") -SketchConstraintCoincidence_83 = Sketch_9.setCoincident(SketchLine_58.startPoint(), SketchArc_23.startPoint()) +SketchConstraintCoincidence_83 = Sketch_9.setCoincident( + SketchLine_58.startPoint(), SketchArc_23.startPoint() +) SketchConstraintCoincidence_83.setName("SketchConstraintCoincidence_91") -SketchConstraintTangent_8 = Sketch_9.setTangent(SketchLine_58.result(), SketchArc_23.results()[1]) -SketchConstraintCoincidence_84 = Sketch_9.setCoincident(SketchLine_60.result(), SketchArc_23.endPoint()) +SketchConstraintTangent_8 = Sketch_9.setTangent( + SketchLine_58.result(), SketchArc_23.results()[1] +) +SketchConstraintCoincidence_84 = Sketch_9.setCoincident( + SketchLine_60.result(), SketchArc_23.endPoint() +) SketchConstraintCoincidence_84.setName("SketchConstraintCoincidence_92") -SketchConstraintTangent_9 = Sketch_9.setTangent(SketchArc_23.results()[1], SketchLine_60.result()) +SketchConstraintTangent_9 = Sketch_9.setTangent( + SketchArc_23.results()[1], SketchLine_60.result() +) SketchLine_61 = Sketch_9.addLine(-32, -19, -32, -22) SketchLine_61.setName("SketchLine_67") SketchLine_61.result().setName("SketchLine_67") -SketchConstraintCoincidence_85 = Sketch_9.setCoincident(SketchLine_58.startPoint(), SketchLine_61.startPoint()) +SketchConstraintCoincidence_85 = Sketch_9.setCoincident( + SketchLine_58.startPoint(), SketchLine_61.startPoint() +) SketchConstraintCoincidence_85.setName("SketchConstraintCoincidence_93") -SketchConstraintCoincidence_86 = Sketch_9.setCoincident(SketchLine_59.startPoint(), SketchLine_61.endPoint()) +SketchConstraintCoincidence_86 = Sketch_9.setCoincident( + SketchLine_59.startPoint(), SketchLine_61.endPoint() +) SketchConstraintCoincidence_86.setName("SketchConstraintCoincidence_94") SketchLine_62 = Sketch_9.addLine(-32, -22, -29.00002201340376, -22) SketchLine_62.setName("SketchLine_68") SketchLine_62.result().setName("SketchLine_68") -SketchConstraintCoincidence_87 = Sketch_9.setCoincident(SketchLine_59.startPoint(), SketchLine_62.startPoint()) +SketchConstraintCoincidence_87 = Sketch_9.setCoincident( + SketchLine_59.startPoint(), SketchLine_62.startPoint() +) SketchConstraintCoincidence_87.setName("SketchConstraintCoincidence_95") -SketchConstraintCoincidence_88 = Sketch_9.setCoincident(SketchArc_23.endPoint(), SketchLine_62.endPoint()) +SketchConstraintCoincidence_88 = Sketch_9.setCoincident( + SketchArc_23.endPoint(), SketchLine_62.endPoint() +) 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-SketchLine_67f-SketchLine_68f-SketchArc_25_2r")], 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.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Part_1, 1) model.testNbSubShapes(Part_1, GeomAPI_Shape.SOLID, [6]) diff --git a/test.compatibility/plug.py b/test.compatibility/plug.py index d749a1bb7..c6007a247 100644 --- a/test.compatibility/plug.py +++ b/test.compatibility/plug.py @@ -54,224 +54,515 @@ Param_SlotWidth = model.addParameter(Part_1_doc, "Slot_Width", "8") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 3, 0.5, 2.5) SketchLine_2 = Sketch_1.addLine(0.5, 2.5, 9.5, 2.5) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(9.5, 2.5, 9.5, 3.1) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(9.5, 3.1, 24.86574363608673, 3.1) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(24.86574363608673, 3.1, 26, 3.3) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(26, 3.3, 26, 5.5) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(31, 10.5, 64, 10.5) SketchLine_8 = Sketch_1.addLine(64, 10.5, 64, 15) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(64, 15, 61, 15) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchLine_10 = Sketch_1.addLine(61, 15, 61, 12.75) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchLine_11 = Sketch_1.addLine(61, 12.75, 58, 12.75) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchLine_12 = Sketch_1.addLine(58, 12.75, 58, 14) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchLine_13 = Sketch_1.addLine(58, 14, 57, 15) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchLine_14 = Sketch_1.addLine(57, 15, 54, 15) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchLine_15 = Sketch_1.addLine(54, 15, 52.5, 16.5) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) SketchLine_16 = Sketch_1.addLine(52.5, 16.5, 35, 16.5) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) SketchLine_17 = Sketch_1.addLine(35, 16.5, 34, 15.5) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) SketchLine_18 = Sketch_1.addLine(34, 15.5, 32, 15.5) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) SketchLine_19 = Sketch_1.addLine(32, 15.5, 32, 19) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) SketchLine_20 = Sketch_1.addLine(32, 19, 22.5, 19) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) SketchLine_21 = Sketch_1.addLine(22.5, 19, 22.5, 13) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.startPoint() +) SketchLine_22 = Sketch_1.addLine(22.5, 13, 22, 12.5) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchLine_22.startPoint() +) SketchLine_23 = Sketch_1.addLine(22, 12.5, 22, 10) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.startPoint() +) SketchLine_24 = Sketch_1.addLine(22, 10, 20, 10) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_23.endPoint(), SketchLine_24.startPoint() +) SketchLine_25 = Sketch_1.addLine(20, 10, 20, 8.7) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_24.endPoint(), SketchLine_25.startPoint() +) SketchLine_26 = Sketch_1.addLine(20, 8.7, 18.5, 8.7) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_26.startPoint()) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_25.endPoint(), SketchLine_26.startPoint() +) SketchLine_27 = Sketch_1.addLine(18.5, 8.7, 18.5, 10) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_26.endPoint(), SketchLine_27.startPoint()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_26.endPoint(), SketchLine_27.startPoint() +) SketchLine_28 = Sketch_1.addLine(18.5, 10, 10.5, 10) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchLine_27.endPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchLine_27.endPoint(), SketchLine_28.startPoint() +) SketchLine_29 = Sketch_1.addLine(10.5, 10, 10.5, 8.7) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_28.endPoint(), SketchLine_29.startPoint() +) SketchLine_30 = Sketch_1.addLine(10.5, 8.7, 9, 8.7) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchLine_29.endPoint(), SketchLine_30.startPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchLine_29.endPoint(), SketchLine_30.startPoint() +) SketchLine_31 = Sketch_1.addLine(9, 8.7, 9, 10) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) SketchLine_32 = Sketch_1.addLine(9, 10, 0.5, 10) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchLine_31.endPoint(), SketchLine_32.startPoint() +) SketchLine_33 = Sketch_1.addLine(0.5, 10, 0, 9.5) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchLine_32.endPoint(), SketchLine_33.startPoint() +) SketchLine_34 = Sketch_1.addLine(0, 9.5, 0, 3) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchLine_33.endPoint(), SketchLine_34.startPoint()) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_34.endPoint()) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchLine_33.endPoint(), SketchLine_34.startPoint() +) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_34.endPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) -SketchConstraintAngle_1 = Sketch_1.setAngleComplementary(SketchLine_4.result(), SketchLine_5.result(), 10) +SketchConstraintAngle_1 = Sketch_1.setAngleComplementary( + SketchLine_4.result(), SketchLine_5.result(), 10 +) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.endPoint(), "D2_in/2") +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.endPoint(), "D2_in/2" +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_16.result(), SketchLine_7.result()) -SketchConstraintAngle_2 = Sketch_1.setAngleComplementary(SketchLine_15.result(), SketchLine_16.result(), 45) -SketchConstraintAngle_3 = Sketch_1.setAngleComplementary(SketchLine_13.result(), SketchLine_14.result(), 45) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_16.result(), SketchLine_7.result() +) +SketchConstraintAngle_2 = Sketch_1.setAngleComplementary( + SketchLine_15.result(), SketchLine_16.result(), 45 +) +SketchConstraintAngle_3 = Sketch_1.setAngleComplementary( + SketchLine_13.result(), SketchLine_14.result(), 45 +) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_12.result()) SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_10.result()) SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_11.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_17.result(), SketchLine_15.result()) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_17.result(), SketchLine_15.result() +) SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_19.result()) SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_18.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_20.result(), SketchLine_7.result()) -SketchConstraintParallel_3 = Sketch_1.setParallel(SketchLine_21.result(), SketchLine_19.result()) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_20.result(), SketchLine_7.result() +) +SketchConstraintParallel_3 = Sketch_1.setParallel( + SketchLine_21.result(), SketchLine_19.result() +) SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_23.result()) SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_24.result()) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_28.result(), SketchLine_24.result()) -SketchConstraintCollinear_2 = Sketch_1.setCollinear(SketchLine_32.result(), SketchLine_28.result()) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_28.result(), SketchLine_24.result() +) +SketchConstraintCollinear_2 = Sketch_1.setCollinear( + SketchLine_32.result(), SketchLine_28.result() +) SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_34.result()) SketchConstraintHorizontal_8 = Sketch_1.setHorizontal(SketchLine_30.result()) -SketchConstraintCollinear_3 = Sketch_1.setCollinear(SketchLine_26.result(), SketchLine_30.result()) +SketchConstraintCollinear_3 = Sketch_1.setCollinear( + SketchLine_26.result(), SketchLine_30.result() +) SketchConstraintVertical_9 = Sketch_1.setVertical(SketchLine_31.result()) SketchConstraintVertical_10 = Sketch_1.setVertical(SketchLine_29.result()) SketchConstraintVertical_11 = Sketch_1.setVertical(SketchLine_27.result()) SketchConstraintVertical_12 = Sketch_1.setVertical(SketchLine_25.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_24.result(), "D4_out/2", True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_30.result(), "D4_out/2-Channel_Depth", True) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_34.endPoint(), SketchLine_1.endPoint(), "Chamfer") -SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchLine_1.endPoint(), SketchLine_1.startPoint(), "Chamfer") -SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_34.startPoint(), SketchLine_33.startPoint(), "Chamfer") -SketchConstraintDistanceVertical_3 = Sketch_1.setVerticalDistance(SketchLine_34.startPoint(), SketchLine_33.startPoint(), "Chamfer") -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), + SketchLine_24.result(), + "D4_out/2", + True, +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), + SketchLine_30.result(), + "D4_out/2-Channel_Depth", + True, +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_34.endPoint(), SketchLine_1.endPoint(), "Chamfer" +) +SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance( + SketchLine_1.endPoint(), SketchLine_1.startPoint(), "Chamfer" +) +SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance( + SketchLine_34.startPoint(), SketchLine_33.startPoint(), "Chamfer" +) +SketchConstraintDistanceVertical_3 = Sketch_1.setVerticalDistance( + SketchLine_34.startPoint(), SketchLine_33.startPoint(), "Chamfer" +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_35 = SketchProjection_2.createdFeature() -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_35.result(), "D2_in/2+0.6", True) -SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance(SketchLine_3.endPoint(), SketchLine_5.endPoint(), "Depth/2") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_5.endPoint(), SketchLine_35.result(), "D2_in/2+0.8", True) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_35.result(), "D2_in/2+0.6", True +) +SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance( + SketchLine_3.endPoint(), SketchLine_5.endPoint(), "Depth/2" +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_5.endPoint(), SketchLine_35.result(), "D2_in/2+0.8", True +) SketchArc_1 = Sketch_1.addArc(31, 5.5, 31, 10.5, 26, 5.5, False) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_6.endPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_7.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_6.result()) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_6.endPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_7.result() +) +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(), 45) -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") -SketchConstraintDistanceHorizontal_6 = Sketch_1.setHorizontalDistance(SketchLine_15.startPoint(), SketchLine_8.endPoint(), 10) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_35.result(), "D3_out/2", True) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_11.startPoint(), SketchLine_35.result(), "(D3_out+D1_in)/4", True) -SketchConstraintDistanceHorizontal_7 = Sketch_1.setHorizontalDistance(SketchLine_10.startPoint(), SketchLine_8.endPoint(), 3) -SketchConstraintDistanceHorizontal_8 = Sketch_1.setHorizontalDistance(SketchLine_12.endPoint(), SketchLine_10.startPoint(), 3) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_30.result(), SketchLine_26.result()) +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(), 45 +) +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" +) +SketchConstraintDistanceHorizontal_6 = Sketch_1.setHorizontalDistance( + SketchLine_15.startPoint(), SketchLine_8.endPoint(), 10 +) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_35.result(), "D3_out/2", True +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchLine_11.startPoint(), SketchLine_35.result(), "(D3_out+D1_in)/4", True +) +SketchConstraintDistanceHorizontal_7 = Sketch_1.setHorizontalDistance( + SketchLine_10.startPoint(), SketchLine_8.endPoint(), 3 +) +SketchConstraintDistanceHorizontal_8 = Sketch_1.setHorizontalDistance( + SketchLine_12.endPoint(), SketchLine_10.startPoint(), 3 +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_30.result(), SketchLine_26.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_26.result(), "Channel_Width") -SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_28.result(), "Drill1Holder_Width") -SketchConstraintDistanceHorizontal_9 = Sketch_1.setHorizontalDistance(SketchArc_1.center(), SketchLine_7.endPoint(), "Depth") -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_16.startPoint(), SketchLine_35.result(), "D2_out/2", True) -SketchConstraintDistanceHorizontal_10 = Sketch_1.setHorizontalDistance(SketchLine_20.startPoint(), SketchLine_8.endPoint(), "Width/2") -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_17.endPoint(), SketchLine_35.result(), "D2_out/2-1", True) -SketchConstraintDistanceHorizontal_11 = Sketch_1.setHorizontalDistance(SketchLine_20.startPoint(), SketchLine_17.endPoint(), 2) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_35).startPoint(), SketchLine_34.result()) -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_35).startPoint(), SketchLine_20.result(), "D1_out/2", True) +SketchConstraintLength_2 = Sketch_1.setLength( + SketchLine_28.result(), "Drill1Holder_Width" +) +SketchConstraintDistanceHorizontal_9 = Sketch_1.setHorizontalDistance( + SketchArc_1.center(), SketchLine_7.endPoint(), "Depth" +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchLine_16.startPoint(), SketchLine_35.result(), "D2_out/2", True +) +SketchConstraintDistanceHorizontal_10 = Sketch_1.setHorizontalDistance( + SketchLine_20.startPoint(), SketchLine_8.endPoint(), "Width/2" +) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_17.endPoint(), SketchLine_35.result(), "D2_out/2-1", True +) +SketchConstraintDistanceHorizontal_11 = Sketch_1.setHorizontalDistance( + SketchLine_20.startPoint(), SketchLine_17.endPoint(), 2 +) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_35).startPoint(), SketchLine_34.result() +) +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_35).startPoint(), SketchLine_20.result(), "D1_out/2", True +) SketchPoint_2 = Sketch_1.addPoint(14.5, 10) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_28.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchPoint_2.coordinates(), SketchLine_28.result()) -SketchConstraintDistanceHorizontal_12 = Sketch_1.setHorizontalDistance(SketchPoint_2.coordinates(), SketchLine_24.startPoint(), "Drill1_Loc") -SketchConstraintDistanceHorizontal_13 = Sketch_1.setHorizontalDistance(SketchLine_34.startPoint(), SketchLine_9.startPoint(), "Width") -SketchConstraintDistanceHorizontal_14 = Sketch_1.setHorizontalDistance(SketchLine_14.startPoint(), SketchLine_12.endPoint(), 1) -SketchConstraintDistance_11 = Sketch_1.setDistance(SketchLine_23.startPoint(), SketchLine_35.result(), "(D4_out+D2_in)/2", True) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_28.result() +) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchPoint_2.coordinates(), SketchLine_28.result() +) +SketchConstraintDistanceHorizontal_12 = Sketch_1.setHorizontalDistance( + SketchPoint_2.coordinates(), SketchLine_24.startPoint(), "Drill1_Loc" +) +SketchConstraintDistanceHorizontal_13 = Sketch_1.setHorizontalDistance( + SketchLine_34.startPoint(), SketchLine_9.startPoint(), "Width" +) +SketchConstraintDistanceHorizontal_14 = Sketch_1.setHorizontalDistance( + SketchLine_14.startPoint(), SketchLine_12.endPoint(), 1 +) +SketchConstraintDistance_11 = Sketch_1.setDistance( + SketchLine_23.startPoint(), SketchLine_35.result(), "(D4_out+D2_in)/2", True +) model.do() # check Sketch_1 model.checkSketch(Sketch_1, 0) -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "PartSet/OX"), 360, 0) +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/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/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&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) +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") +SketchConstraintCoincidence_38 = Sketch_2.setCoincident( + SketchPoint_3.result(), SketchCircle_1.center() +) +SketchConstraintRadius_2 = Sketch_2.setRadius( + SketchCircle_1.results()[1], "Drill1_Radius" +) model.do() # check Sketch_2 model.checkSketch(Sketch_2, 0) -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")]) +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&Sketch_1/SketchLine_21][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20]")], "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", +) -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") +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", +) -Fillet_3 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19")], "Fillet3") +Fillet_3 = model.addFillet( + Part_1_doc, + [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19")], + "Fillet3", +) -Fillet_4 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_11")], "Fillet3") +Fillet_4 = model.addFillet( + Part_1_doc, + [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_11")], + "Fillet3", +) -Fillet_5 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_9")], "Fillet2") +Fillet_5 = model.addFillet( + Part_1_doc, + [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_9")], + "Fillet2", +) -ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [], model.selection(), "D4_out/2", "D4_out/2", [model.selection("SOLID", "Fillet_5_1")]) +ExtrusionCut_2 = model.addExtrusionCut( + Part_1_doc, + [], + model.selection(), + "D4_out/2", + "D4_out/2", + [model.selection("SOLID", "Fillet_5_1")], +) Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchLine_37 = Sketch_3.addLine(9, -9.914857089637437, 9, -18.52898094212539) SketchLine_38 = Sketch_3.addLine(9, -18.52898094212539, -2.5, -18.52898094212539) -SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_37.endPoint(), SketchLine_38.startPoint()) +SketchConstraintCoincidence_39 = Sketch_3.setCoincident( + SketchLine_37.endPoint(), SketchLine_38.startPoint() +) SketchLine_39 = Sketch_3.addLine(-2.5, -18.52898094212539, -2.5, -10.52898094212539) -SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_38.endPoint(), SketchLine_39.startPoint()) -SketchLine_40 = Sketch_3.addLine(-2.5, -10.52898094212539, 7.788407623149843, -8.714857089637437) -SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_39.endPoint(), SketchLine_40.startPoint()) -SketchLine_41 = Sketch_3.addLine(7.788407623149843, -8.714857089637437, 8, -9.914857089637437) -SketchConstraintCoincidence_42 = Sketch_3.setCoincident(SketchLine_40.endPoint(), SketchLine_41.startPoint()) +SketchConstraintCoincidence_40 = Sketch_3.setCoincident( + SketchLine_38.endPoint(), SketchLine_39.startPoint() +) +SketchLine_40 = Sketch_3.addLine( + -2.5, -10.52898094212539, 7.788407623149843, -8.714857089637437 +) +SketchConstraintCoincidence_41 = Sketch_3.setCoincident( + SketchLine_39.endPoint(), SketchLine_40.startPoint() +) +SketchLine_41 = Sketch_3.addLine( + 7.788407623149843, -8.714857089637437, 8, -9.914857089637437 +) +SketchConstraintCoincidence_42 = Sketch_3.setCoincident( + SketchLine_40.endPoint(), SketchLine_41.startPoint() +) SketchLine_42 = Sketch_3.addLine(8, -9.914857089637437, 9, -9.914857089637437) -SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchLine_41.endPoint(), SketchLine_42.startPoint()) -SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchLine_42.endPoint(), SketchLine_37.startPoint()) -SketchProjection_5 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_43 = Sketch_3.setCoincident( + SketchLine_41.endPoint(), SketchLine_42.startPoint() +) +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/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/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/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/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/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/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()) SketchConstraintHorizontal_9 = Sketch_3.setHorizontal(SketchLine_38.result()) SketchConstraintHorizontal_10 = Sketch_3.setHorizontal(SketchLine_42.result()) -SketchConstraintPerpendicular_2 = Sketch_3.setPerpendicular(SketchLine_40.result(), SketchLine_41.result()) -SketchConstraintDistanceVertical_4 = Sketch_3.setVerticalDistance(SketchLine_42.startPoint(), SketchLine_40.endPoint(), 1.2) -SketchConstraintMirror_1 = Sketch_3.addMirror(SketchLine_43.result(), [SketchLine_46.result(), SketchLine_49.result()]) +SketchConstraintPerpendicular_2 = Sketch_3.setPerpendicular( + SketchLine_40.result(), SketchLine_41.result() +) +SketchConstraintDistanceVertical_4 = Sketch_3.setVerticalDistance( + SketchLine_42.startPoint(), SketchLine_40.endPoint(), 1.2 +) +SketchConstraintMirror_1 = Sketch_3.addMirror( + SketchLine_43.result(), [SketchLine_46.result(), SketchLine_49.result()] +) [SketchLine_50, SketchLine_51] = SketchConstraintMirror_1.mirrored() SketchLine_50.setAuxiliary(True) SketchLine_51.setAuxiliary(True) -SketchConstraintCoincidence_45 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_51).startPoint(), SketchLine_37.result()) -SketchConstraintCoincidence_46 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_50).startPoint(), SketchLine_40.result()) -SketchConstraintAngle_5 = Sketch_3.setAngle(SketchLine_51.result(), SketchLine_40.result(), 10) -SketchConstraintDistanceHorizontal_15 = Sketch_3.setHorizontalDistance(SketchAPI_Line(SketchLine_50).endPoint(), SketchLine_42.startPoint(), "Slot_Width") -SketchConstraintDistanceVertical_5 = Sketch_3.setVerticalDistance(SketchLine_39.startPoint(), SketchLine_39.endPoint(), 8) -SketchConstraintDistanceHorizontal_16 = Sketch_3.setHorizontalDistance(SketchLine_39.endPoint(), SketchAPI_Line(SketchLine_50).startPoint(), 3) +SketchConstraintCoincidence_45 = Sketch_3.setCoincident( + SketchAPI_Line(SketchLine_51).startPoint(), SketchLine_37.result() +) +SketchConstraintCoincidence_46 = Sketch_3.setCoincident( + SketchAPI_Line(SketchLine_50).startPoint(), SketchLine_40.result() +) +SketchConstraintAngle_5 = Sketch_3.setAngle( + SketchLine_51.result(), SketchLine_40.result(), 10 +) +SketchConstraintDistanceHorizontal_15 = Sketch_3.setHorizontalDistance( + SketchAPI_Line(SketchLine_50).endPoint(), SketchLine_42.startPoint(), "Slot_Width" +) +SketchConstraintDistanceVertical_5 = Sketch_3.setVerticalDistance( + SketchLine_39.startPoint(), SketchLine_39.endPoint(), 8 +) +SketchConstraintDistanceHorizontal_16 = Sketch_3.setHorizontalDistance( + SketchLine_39.endPoint(), SketchAPI_Line(SketchLine_50).startPoint(), 3 +) ExtrusionCut_2.setNestedSketch(Sketch_3) model.do() # check Sketch_3 @@ -281,82 +572,174 @@ Folder_1 = model.addFolder(Part_1_doc, Fillet_1, Fillet_5) Sketch_4 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchLine_52 = Sketch_4.addLine(28.5, -19.5, 28.5, 0) -SketchProjection_12 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_12 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_53 = SketchProjection_12.createdFeature() -SketchConstraintCoincidence_47 = Sketch_4.setCoincident(SketchLine_52.endPoint(), SketchLine_53.result()) +SketchConstraintCoincidence_47 = Sketch_4.setCoincident( + SketchLine_52.endPoint(), SketchLine_53.result() +) SketchLine_54 = Sketch_4.addLine(28.5, 0, 29, 0) -SketchConstraintCoincidence_48 = Sketch_4.setCoincident(SketchLine_52.endPoint(), SketchLine_54.startPoint()) -SketchConstraintCoincidence_49 = Sketch_4.setCoincident(SketchLine_54.endPoint(), SketchLine_53.result()) +SketchConstraintCoincidence_48 = Sketch_4.setCoincident( + SketchLine_52.endPoint(), SketchLine_54.startPoint() +) +SketchConstraintCoincidence_49 = Sketch_4.setCoincident( + SketchLine_54.endPoint(), SketchLine_53.result() +) SketchLine_55 = Sketch_4.addLine(29, 0, 29, -11.5) -SketchConstraintCoincidence_50 = Sketch_4.setCoincident(SketchLine_54.endPoint(), SketchLine_55.startPoint()) +SketchConstraintCoincidence_50 = Sketch_4.setCoincident( + SketchLine_54.endPoint(), SketchLine_55.startPoint() +) SketchLine_56 = Sketch_4.addLine(28.5, -19.5, 30.4, -19.5) -SketchConstraintCoincidence_51 = Sketch_4.setCoincident(SketchLine_52.startPoint(), SketchLine_56.startPoint()) +SketchConstraintCoincidence_51 = Sketch_4.setCoincident( + SketchLine_52.startPoint(), SketchLine_56.startPoint() +) SketchLine_57 = Sketch_4.addLine(30.4, -19.5, 29.4, -18.5) -SketchConstraintCoincidence_52 = Sketch_4.setCoincident(SketchLine_56.endPoint(), SketchLine_57.startPoint()) +SketchConstraintCoincidence_52 = Sketch_4.setCoincident( + SketchLine_56.endPoint(), SketchLine_57.startPoint() +) SketchLine_58 = Sketch_4.addLine(29.4, -18.5, 29.4, -12.5) -SketchConstraintCoincidence_53 = Sketch_4.setCoincident(SketchLine_57.endPoint(), SketchLine_58.startPoint()) +SketchConstraintCoincidence_53 = Sketch_4.setCoincident( + SketchLine_57.endPoint(), SketchLine_58.startPoint() +) SketchArc_2 = Sketch_4.addArc(27.95, -12.5, 29.4, -12.5, 29, -11.5, False) -SketchConstraintCoincidence_54 = Sketch_4.setCoincident(SketchLine_58.endPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_55 = Sketch_4.setCoincident(SketchLine_55.endPoint(), SketchArc_2.endPoint()) +SketchConstraintCoincidence_54 = Sketch_4.setCoincident( + SketchLine_58.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_55 = Sketch_4.setCoincident( + SketchLine_55.endPoint(), SketchArc_2.endPoint() +) 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/SketchLine_23_EndVertex"), 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/SketchLine_20"), False) +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/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()]) +SketchConstraintAngle_6 = Sketch_4.setAngle( + SketchLine_57.result(), SketchLine_56.result(), 45 +) +SketchConstraintMirror_2 = Sketch_4.addMirror( + SketchLine_53.result(), [SketchLine_59.result()] +) [SketchLine_60] = SketchConstraintMirror_2.mirrored() SketchLine_60.setAuxiliary(True) -SketchConstraintDistance_12 = Sketch_4.setDistance(SketchArc_2.endPoint(), SketchLine_60.result(), "Drill2_DepthMax", True) -SketchConstraintDistance_13 = Sketch_4.setDistance(SketchLine_58.endPoint(), SketchLine_60.result(), "Drill2_DepthMin", True) -SketchConstraintDistance_14 = Sketch_4.setDistance(SketchLine_57.endPoint(), SketchLine_60.result(), 0.5, True) -SketchConstraintTangent_3 = Sketch_4.setTangent(SketchLine_58.result(), SketchArc_2.results()[1]) +SketchConstraintDistance_12 = Sketch_4.setDistance( + SketchArc_2.endPoint(), SketchLine_60.result(), "Drill2_DepthMax", True +) +SketchConstraintDistance_13 = Sketch_4.setDistance( + SketchLine_58.endPoint(), SketchLine_60.result(), "Drill2_DepthMin", True +) +SketchConstraintDistance_14 = Sketch_4.setDistance( + SketchLine_57.endPoint(), SketchLine_60.result(), 0.5, True +) +SketchConstraintTangent_3 = Sketch_4.setTangent( + SketchLine_58.result(), SketchArc_2.results()[1] +) SketchPoint_5 = Sketch_4.addPoint(29.9, -19) -SketchConstraintCoincidence_56 = Sketch_4.setCoincident(SketchPoint_5.coordinates(), SketchLine_60.result()) -SketchConstraintCoincidence_57 = Sketch_4.setCoincident(SketchPoint_5.coordinates(), SketchLine_57.result()) -SketchConstraintDistance_15 = Sketch_4.setDistance(SketchPoint_5.coordinates(), SketchLine_52.result(), "Drill2_Radius", True) -SketchConstraintDistanceVertical_6 = Sketch_4.setVerticalDistance(SketchLine_56.endPoint(), SketchPoint_5.coordinates(), 0.5) +SketchConstraintCoincidence_56 = Sketch_4.setCoincident( + SketchPoint_5.coordinates(), SketchLine_60.result() +) +SketchConstraintCoincidence_57 = Sketch_4.setCoincident( + SketchPoint_5.coordinates(), SketchLine_57.result() +) +SketchConstraintDistance_15 = Sketch_4.setDistance( + SketchPoint_5.coordinates(), SketchLine_52.result(), "Drill2_Radius", True +) +SketchConstraintDistanceVertical_6 = Sketch_4.setVerticalDistance( + SketchLine_56.endPoint(), SketchPoint_5.coordinates(), 0.5 +) model.do() # check Sketch_4 model.checkSketch(Sketch_4, 0) -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")]) +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")], +) -RevolutionCut_2 = model.addRevolutionCut(Part_1_doc, [], model.selection("EDGE", "PartSet/OX"), 360, 0, [model.selection("SOLID", "RevolutionCut_1_1")]) +RevolutionCut_2 = model.addRevolutionCut( + Part_1_doc, + [], + model.selection("EDGE", "PartSet/OX"), + 360, + 0, + [model.selection("SOLID", "RevolutionCut_1_1")], +) 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/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()) +SketchConstraintCoincidence_58 = Sketch_5.setCoincident( + SketchLine_61.startPoint(), SketchLine_62.result() +) +SketchConstraintCoincidence_59 = Sketch_5.setCoincident( + SketchAPI_Line(SketchLine_62).endPoint(), SketchLine_61.endPoint() +) SketchLine_63 = Sketch_5.addLine(64.25, 10.25, 64.25, 11.25) SketchLine_64 = Sketch_5.addLine(64.25, 11.25, 63.25, 10.25) -SketchConstraintCoincidence_60 = Sketch_5.setCoincident(SketchLine_63.endPoint(), SketchLine_64.startPoint()) +SketchConstraintCoincidence_60 = Sketch_5.setCoincident( + SketchLine_63.endPoint(), SketchLine_64.startPoint() +) SketchConstraintLength_3 = Sketch_5.setLength(SketchLine_61.result(), "Chamfer") -SketchConstraintCoincidence_61 = Sketch_5.setCoincident(SketchLine_61.startPoint(), SketchLine_64.result()) +SketchConstraintCoincidence_61 = Sketch_5.setCoincident( + SketchLine_61.startPoint(), SketchLine_64.result() +) SketchLine_65 = Sketch_5.addLine(63.25, 10.25, 64.25, 10.25) -SketchConstraintCoincidence_62 = Sketch_5.setCoincident(SketchLine_64.endPoint(), SketchLine_65.startPoint()) -SketchConstraintCoincidence_63 = Sketch_5.setCoincident(SketchLine_63.startPoint(), SketchLine_65.endPoint()) -SketchConstraintEqual_2 = Sketch_5.setEqual(SketchLine_65.result(), SketchLine_63.result()) +SketchConstraintCoincidence_62 = Sketch_5.setCoincident( + SketchLine_64.endPoint(), SketchLine_65.startPoint() +) +SketchConstraintCoincidence_63 = Sketch_5.setCoincident( + SketchLine_63.startPoint(), SketchLine_65.endPoint() +) +SketchConstraintEqual_2 = Sketch_5.setEqual( + SketchLine_65.result(), SketchLine_63.result() +) SketchConstraintVertical_18 = Sketch_5.setVertical(SketchLine_63.result()) SketchConstraintHorizontal_12 = Sketch_5.setHorizontal(SketchLine_65.result()) -SketchConstraintDistanceVertical_7 = Sketch_5.setVerticalDistance(SketchLine_65.startPoint(), SketchLine_61.startPoint(), "Chamfer/2") -SketchConstraintDistanceVertical_8 = Sketch_5.setVerticalDistance(SketchLine_61.startPoint(), SketchLine_63.endPoint(), "Chamfer*1.5") +SketchConstraintDistanceVertical_7 = Sketch_5.setVerticalDistance( + SketchLine_65.startPoint(), SketchLine_61.startPoint(), "Chamfer/2" +) +SketchConstraintDistanceVertical_8 = Sketch_5.setVerticalDistance( + SketchLine_61.startPoint(), SketchLine_63.endPoint(), "Chamfer*1.5" +) RevolutionCut_2.setNestedSketch(Sketch_5) model.do() # check Sketch_5 model.checkSketch(Sketch_5, 0) Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 0, False) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "RevolutionCut_2_1"), model.selection("FACE", "Plane_2")]) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "RevolutionCut_2_1"), model.selection("FACE", "Plane_2")], +) -Result = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPSOLID", "Partition_1_1")) +Result = model.addRemoveSubShapes( + Part_1_doc, model.selection("COMPSOLID", "Partition_1_1") +) Result.setSubShapesToRemove([model.selection("SOLID", "Partition_1_1_2")]) Result.result().setName("Plug") # check Remove_SubShapes_1 diff --git a/test.compatibility/sprocket.py b/test.compatibility/sprocket.py index 8a97edcd2..7bab0bf8e 100644 --- a/test.compatibility/sprocket.py +++ b/test.compatibility/sprocket.py @@ -48,63 +48,332 @@ model.addParameter(Part_1_doc, "angle_2", "21") Param_NB = model.addParameter(Part_1_doc, "NB", "6") Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) SketchCircle_1.setAuxiliary(True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "d") -SketchLine_1 = Sketch_1.addLine(-1.83495963955651, 27.43871212577585, -1.570078687288315, 29.95888604263722) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) -SketchLine_2 = Sketch_1.addLine(-1.570078687288315, 29.95888604263722, -0.7903152816259503, 31.99023916377664) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(1.834959639556546, 27.43871212577585, 1.570078687288318, 29.95888604263721) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchCircle_1.results()[1]) -SketchLine_4 = Sketch_1.addLine(1.570078687288318, 29.95888604263721, 0.7903152816259467, 31.99023916377664) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_1 = Sketch_1.addLine( + -1.83495963955651, 27.43871212577585, -1.570078687288315, 29.95888604263722 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) +SketchLine_2 = Sketch_1.addLine( + -1.570078687288315, 29.95888604263722, -0.7903152816259503, 31.99023916377664 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 1.834959639556546, 27.43871212577585, 1.570078687288318, 29.95888604263721 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchCircle_1.results()[1] +) +SketchLine_4 = Sketch_1.addLine( + 1.570078687288318, 29.95888604263721, 0.7903152816259467, 31.99023916377664 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchCircle_2 = Sketch_1.addCircle(0, 0, 27.5) SketchCircle_2.setAuxiliary(True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_2.center()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_2.results()[1]) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchCircle_2.results()[1]) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_4.result()) -SketchArc_1 = Sketch_1.addArc(0, 0, 0.7903152816259467, 31.99023916377664, -0.7903152816259503, 31.99023916377664, False) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_1.center()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.endPoint()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_2.center() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_2.results()[1] +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchCircle_2.results()[1] +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_4.result() +) +SketchArc_1 = Sketch_1.addArc( + 0, + 0, + 0.7903152816259467, + 31.99023916377664, + -0.7903152816259503, + 31.99023916377664, + False, +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_1.center() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchArc_1.endPoint() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_5 = SketchProjection_2.createdFeature() -SketchConstraintAngle_1 = Sketch_1.setAngleComplementary(SketchLine_2.result(), SketchLine_5.result(), "angle_2") -SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_4.result(), "180+angle_1") -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_1.result()) +SketchConstraintAngle_1 = Sketch_1.setAngleComplementary( + SketchLine_2.result(), SketchLine_5.result(), "angle_2" +) +SketchConstraintAngle_2 = Sketch_1.setAngle( + SketchLine_3.result(), SketchLine_4.result(), "180+angle_1" +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_1.result() +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_1.results()[1], "da") SketchConstraintRadius_3 = Sketch_1.setRadius(SketchCircle_2.results()[1], "df") SketchLine_6 = Sketch_1.addLine(1.570078687288318, 29.95888604263721, 0, 0) SketchLine_6.setAuxiliary(True) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_6.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_6.endPoint() +) SketchLine_7 = Sketch_1.addLine(-1.570078687288315, 29.95888604263722, 0, 0) SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_7.endPoint()) -SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_6.result(), SketchLine_5.result(), "angle_L/2") -SketchConstraintAngle_4 = Sketch_1.setAngle(SketchLine_5.result(), SketchLine_7.result(), "angle_L/2") -SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_3.result()], SketchAPI_Line(SketchLine_5).startPoint(), "360/Z", 2) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_7.endPoint() +) +SketchConstraintAngle_3 = Sketch_1.setAngle( + SketchLine_6.result(), SketchLine_5.result(), "angle_L/2" +) +SketchConstraintAngle_4 = Sketch_1.setAngle( + SketchLine_5.result(), SketchLine_7.result(), "angle_L/2" +) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchLine_3.result()], SketchAPI_Line(SketchLine_5).startPoint(), "360/Z", 2 +) [SketchLine_8] = SketchMultiRotation_1.rotated() SketchLine_8.setAuxiliary(True) -SketchArc_2 = Sketch_1.addArc(0, 0, -1.83495963955651, 27.43871212577585, -3.909967663056207, 27.22061999429577, False) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_2.center()) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_8.result(), SketchArc_2.endPoint()) -SketchProjection_3 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchArc_2 = Sketch_1.addArc( + 0, + 0, + -1.83495963955651, + 27.43871212577585, + -3.909967663056207, + 27.22061999429577, + False, +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_2.center() +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_8.result(), SketchArc_2.endPoint() +) +SketchProjection_3 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_3.createdFeature() -SketchMultiRotation_2_objects = [SketchArc_2.results()[1], SketchLine_1.result(), SketchLine_2.result(), SketchArc_1.results()[1], SketchLine_4.result(), SketchLine_3.result()] -SketchMultiRotation_2 = Sketch_1.addRotation(SketchMultiRotation_2_objects, SketchAPI_Point(SketchPoint_2).coordinates(), "360/Z", "Z") -[SketchArc_3, SketchArc_4, SketchArc_5, SketchArc_6, SketchArc_7, SketchArc_8, SketchArc_9, SketchArc_10, SketchArc_11, SketchArc_12, SketchArc_13, SketchArc_14, SketchArc_15, SketchArc_16, SketchArc_17, SketchArc_18, SketchArc_19, SketchArc_20, SketchArc_21, SketchArc_22, SketchArc_23, SketchArc_24, SketchArc_25, SketchArc_26, SketchArc_27, SketchArc_28, SketchArc_29, SketchArc_30, SketchArc_31, SketchLine_9, SketchLine_10, SketchLine_11, SketchLine_12, SketchLine_13, SketchLine_14, SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18, SketchLine_19, SketchLine_20, SketchLine_21, SketchLine_22, SketchLine_23, SketchLine_24, SketchLine_25, SketchLine_26, SketchLine_27, SketchLine_28, SketchLine_29, SketchLine_30, SketchLine_31, SketchLine_32, SketchLine_33, SketchLine_34, SketchLine_35, SketchLine_36, SketchLine_37, SketchLine_38, SketchLine_39, SketchLine_40, SketchLine_41, SketchLine_42, SketchLine_43, SketchLine_44, SketchLine_45, SketchLine_46, SketchLine_47, SketchLine_48, SketchLine_49, SketchLine_50, SketchLine_51, SketchLine_52, SketchLine_53, SketchLine_54, SketchLine_55, SketchLine_56, SketchLine_57, SketchLine_58, SketchLine_59, SketchLine_60, SketchLine_61, SketchLine_62, SketchLine_63, SketchLine_64, SketchLine_65, SketchLine_66, SketchArc_32, SketchArc_33, SketchArc_34, SketchArc_35, SketchArc_36, SketchArc_37, SketchArc_38, SketchArc_39, SketchArc_40, SketchArc_41, SketchArc_42, SketchArc_43, SketchArc_44, SketchArc_45, SketchArc_46, SketchArc_47, SketchArc_48, SketchArc_49, SketchArc_50, SketchArc_51, SketchArc_52, SketchArc_53, SketchArc_54, SketchArc_55, SketchArc_56, SketchArc_57, SketchArc_58, SketchArc_59, SketchArc_60, SketchLine_67, SketchLine_68, SketchLine_69, SketchLine_70, SketchLine_71, SketchLine_72, SketchLine_73, SketchLine_74, SketchLine_75, SketchLine_76, SketchLine_77, SketchLine_78, SketchLine_79, SketchLine_80, SketchLine_81, SketchLine_82, SketchLine_83, SketchLine_84, SketchLine_85, SketchLine_86, SketchLine_87, SketchLine_88, SketchLine_89, SketchLine_90, SketchLine_91, SketchLine_92, SketchLine_93, SketchLine_94, SketchLine_95, SketchLine_96, SketchLine_97, SketchLine_98, SketchLine_99, SketchLine_100, SketchLine_101, SketchLine_102, SketchLine_103, SketchLine_104, SketchLine_105, SketchLine_106, SketchLine_107, SketchLine_108, SketchLine_109, SketchLine_110, SketchLine_111, SketchLine_112, SketchLine_113, SketchLine_114, SketchLine_115, SketchLine_116, SketchLine_117, SketchLine_118, SketchLine_119, SketchLine_120, SketchLine_121, SketchLine_122, SketchLine_123, SketchLine_124] = SketchMultiRotation_2.rotated() +SketchMultiRotation_2_objects = [ + SketchArc_2.results()[1], + SketchLine_1.result(), + SketchLine_2.result(), + SketchArc_1.results()[1], + SketchLine_4.result(), + SketchLine_3.result(), +] +SketchMultiRotation_2 = Sketch_1.addRotation( + SketchMultiRotation_2_objects, + SketchAPI_Point(SketchPoint_2).coordinates(), + "360/Z", + "Z", +) +[ + SketchArc_3, + SketchArc_4, + SketchArc_5, + SketchArc_6, + SketchArc_7, + SketchArc_8, + SketchArc_9, + SketchArc_10, + SketchArc_11, + SketchArc_12, + SketchArc_13, + SketchArc_14, + SketchArc_15, + SketchArc_16, + SketchArc_17, + SketchArc_18, + SketchArc_19, + SketchArc_20, + SketchArc_21, + SketchArc_22, + SketchArc_23, + SketchArc_24, + SketchArc_25, + SketchArc_26, + SketchArc_27, + SketchArc_28, + SketchArc_29, + SketchArc_30, + SketchArc_31, + SketchLine_9, + SketchLine_10, + SketchLine_11, + SketchLine_12, + SketchLine_13, + SketchLine_14, + SketchLine_15, + SketchLine_16, + SketchLine_17, + SketchLine_18, + SketchLine_19, + SketchLine_20, + SketchLine_21, + SketchLine_22, + SketchLine_23, + SketchLine_24, + SketchLine_25, + SketchLine_26, + SketchLine_27, + SketchLine_28, + SketchLine_29, + SketchLine_30, + SketchLine_31, + SketchLine_32, + SketchLine_33, + SketchLine_34, + SketchLine_35, + SketchLine_36, + SketchLine_37, + SketchLine_38, + SketchLine_39, + SketchLine_40, + SketchLine_41, + SketchLine_42, + SketchLine_43, + SketchLine_44, + SketchLine_45, + SketchLine_46, + SketchLine_47, + SketchLine_48, + SketchLine_49, + SketchLine_50, + SketchLine_51, + SketchLine_52, + SketchLine_53, + SketchLine_54, + SketchLine_55, + SketchLine_56, + SketchLine_57, + SketchLine_58, + SketchLine_59, + SketchLine_60, + SketchLine_61, + SketchLine_62, + SketchLine_63, + SketchLine_64, + SketchLine_65, + SketchLine_66, + SketchArc_32, + SketchArc_33, + SketchArc_34, + SketchArc_35, + SketchArc_36, + SketchArc_37, + SketchArc_38, + SketchArc_39, + SketchArc_40, + SketchArc_41, + SketchArc_42, + SketchArc_43, + SketchArc_44, + SketchArc_45, + SketchArc_46, + SketchArc_47, + SketchArc_48, + SketchArc_49, + SketchArc_50, + SketchArc_51, + SketchArc_52, + SketchArc_53, + SketchArc_54, + SketchArc_55, + SketchArc_56, + SketchArc_57, + SketchArc_58, + SketchArc_59, + SketchArc_60, + SketchLine_67, + SketchLine_68, + SketchLine_69, + SketchLine_70, + SketchLine_71, + SketchLine_72, + SketchLine_73, + SketchLine_74, + SketchLine_75, + SketchLine_76, + SketchLine_77, + SketchLine_78, + SketchLine_79, + SketchLine_80, + SketchLine_81, + SketchLine_82, + SketchLine_83, + SketchLine_84, + SketchLine_85, + SketchLine_86, + SketchLine_87, + SketchLine_88, + SketchLine_89, + SketchLine_90, + SketchLine_91, + SketchLine_92, + SketchLine_93, + SketchLine_94, + SketchLine_95, + SketchLine_96, + SketchLine_97, + SketchLine_98, + SketchLine_99, + SketchLine_100, + SketchLine_101, + SketchLine_102, + SketchLine_103, + SketchLine_104, + SketchLine_105, + SketchLine_106, + SketchLine_107, + SketchLine_108, + SketchLine_109, + SketchLine_110, + SketchLine_111, + SketchLine_112, + SketchLine_113, + SketchLine_114, + SketchLine_115, + SketchLine_116, + SketchLine_117, + SketchLine_118, + SketchLine_119, + SketchLine_120, + SketchLine_121, + SketchLine_122, + SketchLine_123, + SketchLine_124, +] = SketchMultiRotation_2.rotated() model.do() model.checkSketch(Sketch_1, 0) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "e", 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "e", 0 +) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) SketchCircle_3 = Sketch_2.addCircle(0, 0, 4.5) @@ -112,84 +381,266 @@ SketchLine_125 = Sketch_2.addLine(0, 0, -24.375, 0) SketchLine_125.setAuxiliary(True) SketchLine_126 = Sketch_2.addLine(0, 0, -12.18750000000149, 21.10936921724762) SketchLine_126.setAuxiliary(True) -SketchLine_127 = Sketch_2.addLine(-5.267665072275066, 6.123863542435089, -11.74701189249443, 17.34642143491413) -SketchConstraintParallel_1 = Sketch_2.setParallel(SketchLine_127.result(), SketchLine_126.result()) +SketchLine_127 = Sketch_2.addLine( + -5.267665072275066, 6.123863542435089, -11.74701189249443, 17.34642143491413 +) +SketchConstraintParallel_1 = Sketch_2.setParallel( + SketchLine_127.result(), SketchLine_126.result() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_125.result()) -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_125.startPoint(), SketchLine_126.startPoint()) -SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_125.startPoint(), SketchLine_126.startPoint() +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_3 = SketchProjection_4.createdFeature() -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_125.startPoint(), SketchAPI_Point(SketchPoint_3).coordinates()) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchLine_125.startPoint(), SketchAPI_Point(SketchPoint_3).coordinates() +) SketchCircle_4 = Sketch_2.addCircle(0, 0, 7.5) SketchCircle_4.setAuxiliary(True) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchCircle_4.center()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchCircle_3.center(), SketchCircle_4.center() +) SketchCircle_5 = Sketch_2.addCircle(0, 0, 24.375) SketchCircle_5.setAuxiliary(True) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchCircle_5.center()) -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_126.endPoint(), SketchCircle_5.results()[1]) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_125.endPoint(), SketchCircle_5.results()[1]) -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchAPI_Point(SketchPoint_3).coordinates()) -SketchArc_61 = Sketch_2.addArc(0, 0, -5.379258295557134, 5.22623958403169, -7.21568539381252, 2.045454545454545, False) -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchArc_61.center()) -SketchArc_62 = Sketch_2.addArc(0, 0, -16.35843380263332, 18.07048058367397, -23.82871214537519, 5.131578947350746, False) -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchArc_62.center()) -SketchArc_63 = Sketch_2.addArc(-14.34508810384774, 15.8464214349141, -11.74701189249443, 17.34642143491413, -16.35843380263332, 18.07048058367397, False) -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchArc_63.startPoint(), SketchLine_127.endPoint()) -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchArc_63.endPoint(), SketchArc_62.startPoint()) -SketchConstraintTangent_1 = Sketch_2.setTangent(SketchArc_63.results()[1], SketchLine_127.result()) -SketchConstraintTangent_2 = Sketch_2.setTangent(SketchArc_63.results()[1], SketchArc_62.results()[1]) -SketchArc_64 = Sketch_2.addArc(-5.917184125113392, 5.74886354243508, -5.379258295557134, 5.22623958403169, -5.267665072275066, 6.123863542435089, False) -SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchArc_64.startPoint(), SketchArc_61.startPoint()) -SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchArc_64.endPoint(), SketchLine_127.startPoint()) -SketchConstraintTangent_3 = Sketch_2.setTangent(SketchArc_64.results()[1], SketchArc_61.results()[1]) -SketchConstraintTangent_4 = Sketch_2.setTangent(SketchArc_64.results()[1], SketchLine_127.result()) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchCircle_5.center() +) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_126.endPoint(), SketchCircle_5.results()[1] +) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchLine_125.endPoint(), SketchCircle_5.results()[1] +) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchCircle_3.center(), SketchAPI_Point(SketchPoint_3).coordinates() +) +SketchArc_61 = Sketch_2.addArc( + 0, + 0, + -5.379258295557134, + 5.22623958403169, + -7.21568539381252, + 2.045454545454545, + False, +) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchCircle_3.center(), SketchArc_61.center() +) +SketchArc_62 = Sketch_2.addArc( + 0, + 0, + -16.35843380263332, + 18.07048058367397, + -23.82871214537519, + 5.131578947350746, + False, +) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchCircle_3.center(), SketchArc_62.center() +) +SketchArc_63 = Sketch_2.addArc( + -14.34508810384774, + 15.8464214349141, + -11.74701189249443, + 17.34642143491413, + -16.35843380263332, + 18.07048058367397, + False, +) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchArc_63.startPoint(), SketchLine_127.endPoint() +) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchArc_63.endPoint(), SketchArc_62.startPoint() +) +SketchConstraintTangent_1 = Sketch_2.setTangent( + SketchArc_63.results()[1], SketchLine_127.result() +) +SketchConstraintTangent_2 = Sketch_2.setTangent( + SketchArc_63.results()[1], SketchArc_62.results()[1] +) +SketchArc_64 = Sketch_2.addArc( + -5.917184125113392, + 5.74886354243508, + -5.379258295557134, + 5.22623958403169, + -5.267665072275066, + 6.123863542435089, + False, +) +SketchConstraintCoincidence_30 = Sketch_2.setCoincident( + SketchArc_64.startPoint(), SketchArc_61.startPoint() +) +SketchConstraintCoincidence_31 = Sketch_2.setCoincident( + SketchArc_64.endPoint(), SketchLine_127.startPoint() +) +SketchConstraintTangent_3 = Sketch_2.setTangent( + SketchArc_64.results()[1], SketchArc_61.results()[1] +) +SketchConstraintTangent_4 = Sketch_2.setTangent( + SketchArc_64.results()[1], SketchLine_127.result() +) SketchLine_128 = Sketch_2.addLine(-20.8959475736328, 1.5, -7.937253933193772, 1.5) -SketchArc_65 = Sketch_2.addArc(-20.89594757363278, 4.500000000000018, -23.82871214537519, 5.131578947350746, -20.8959475736328, 1.5, False) -SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchArc_65.startPoint(), SketchArc_62.endPoint()) -SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchArc_65.endPoint(), SketchLine_128.startPoint()) -SketchConstraintTangent_5 = Sketch_2.setTangent(SketchArc_65.results()[1], SketchLine_128.result()) -SketchConstraintTangent_6 = Sketch_2.setTangent(SketchArc_65.results()[1], SketchArc_62.results()[1]) -SketchArc_66 = Sketch_2.addArc(-7.937253933193772, 2.25, -7.937253933193772, 1.5, -7.21568539381252, 2.045454545454545, False) -SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchArc_66.startPoint(), SketchLine_128.endPoint()) -SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchArc_66.endPoint(), SketchArc_61.endPoint()) -SketchConstraintTangent_7 = Sketch_2.setTangent(SketchArc_66.results()[1], SketchLine_128.result()) -SketchConstraintTangent_8 = Sketch_2.setTangent(SketchArc_66.results()[1], SketchArc_61.results()[1]) -SketchConstraintParallel_2 = Sketch_2.setParallel(SketchLine_128.result(), SketchLine_125.result()) +SketchArc_65 = Sketch_2.addArc( + -20.89594757363278, + 4.500000000000018, + -23.82871214537519, + 5.131578947350746, + -20.8959475736328, + 1.5, + False, +) +SketchConstraintCoincidence_32 = Sketch_2.setCoincident( + SketchArc_65.startPoint(), SketchArc_62.endPoint() +) +SketchConstraintCoincidence_33 = Sketch_2.setCoincident( + SketchArc_65.endPoint(), SketchLine_128.startPoint() +) +SketchConstraintTangent_5 = Sketch_2.setTangent( + SketchArc_65.results()[1], SketchLine_128.result() +) +SketchConstraintTangent_6 = Sketch_2.setTangent( + SketchArc_65.results()[1], SketchArc_62.results()[1] +) +SketchArc_66 = Sketch_2.addArc( + -7.937253933193772, + 2.25, + -7.937253933193772, + 1.5, + -7.21568539381252, + 2.045454545454545, + False, +) +SketchConstraintCoincidence_34 = Sketch_2.setCoincident( + SketchArc_66.startPoint(), SketchLine_128.endPoint() +) +SketchConstraintCoincidence_35 = Sketch_2.setCoincident( + SketchArc_66.endPoint(), SketchArc_61.endPoint() +) +SketchConstraintTangent_7 = Sketch_2.setTangent( + SketchArc_66.results()[1], SketchLine_128.result() +) +SketchConstraintTangent_8 = Sketch_2.setTangent( + SketchArc_66.results()[1], SketchArc_61.results()[1] +) +SketchConstraintParallel_2 = Sketch_2.setParallel( + SketchLine_128.result(), SketchLine_125.result() +) SketchConstraintRadius_4 = Sketch_2.setRadius(SketchCircle_3.results()[1], "R_1") SketchConstraintRadius_5 = Sketch_2.setRadius(SketchArc_61.results()[1], "r_1") -SketchConstraintEqual_3 = Sketch_2.setEqual(SketchArc_64.results()[1], SketchArc_66.results()[1]) -SketchConstraintEqual_4 = Sketch_2.setEqual(SketchArc_63.results()[1], SketchArc_65.results()[1]) +SketchConstraintEqual_3 = Sketch_2.setEqual( + SketchArc_64.results()[1], SketchArc_66.results()[1] +) +SketchConstraintEqual_4 = Sketch_2.setEqual( + SketchArc_63.results()[1], SketchArc_65.results()[1] +) SketchConstraintRadius_6 = Sketch_2.setRadius(SketchArc_64.results()[1], "r_3") SketchConstraintRadius_7 = Sketch_2.setRadius(SketchArc_63.results()[1], "r_2") -SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance(SketchArc_65.endPoint(), SketchLine_125.endPoint(), "ep") +SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance( + SketchArc_65.endPoint(), SketchLine_125.endPoint(), "ep" +) SketchConstraintRadius_8 = Sketch_2.setRadius(SketchArc_62.results()[1], "R") -SketchConstraintAngle_5 = Sketch_2.setAngle(SketchLine_126.result(), SketchLine_125.result(), "360/NB") +SketchConstraintAngle_5 = Sketch_2.setAngle( + SketchLine_126.result(), SketchLine_125.result(), "360/NB" +) SketchConstraintRadius_9 = Sketch_2.setRadius(SketchCircle_5.results()[1], "R") SketchConstraintRadius_10 = Sketch_2.setRadius(SketchCircle_4.results()[1], "r_1") -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchLine_127.endPoint(), SketchLine_126.result(), "ep", True) -SketchMultiRotation_3_objects = [SketchArc_61.results()[1], SketchArc_64.results()[1], SketchLine_127.result(), SketchArc_63.results()[1], SketchArc_62.results()[1], SketchArc_65.results()[1], SketchLine_128.result(), SketchArc_66.results()[1]] -SketchMultiRotation_3 = Sketch_2.addRotation(SketchMultiRotation_3_objects, SketchCircle_5.center(), "360/NB", "NB") -[SketchArc_67, SketchArc_68, SketchArc_69, SketchArc_70, SketchArc_71, SketchArc_72, SketchArc_73, SketchArc_74, SketchArc_75, SketchArc_76, SketchLine_129, SketchLine_130, SketchLine_131, SketchLine_132, SketchLine_133, SketchArc_77, SketchArc_78, SketchArc_79, SketchArc_80, SketchArc_81, SketchArc_82, SketchArc_83, SketchArc_84, SketchArc_85, SketchArc_86, SketchArc_87, SketchArc_88, SketchArc_89, SketchArc_90, SketchArc_91, SketchLine_134, SketchLine_135, SketchLine_136, SketchLine_137, SketchLine_138, SketchArc_92, SketchArc_93, SketchArc_94, SketchArc_95, SketchArc_96] = SketchMultiRotation_3.rotated() +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchLine_127.endPoint(), SketchLine_126.result(), "ep", True +) +SketchMultiRotation_3_objects = [ + SketchArc_61.results()[1], + SketchArc_64.results()[1], + SketchLine_127.result(), + SketchArc_63.results()[1], + SketchArc_62.results()[1], + SketchArc_65.results()[1], + SketchLine_128.result(), + SketchArc_66.results()[1], +] +SketchMultiRotation_3 = Sketch_2.addRotation( + SketchMultiRotation_3_objects, SketchCircle_5.center(), "360/NB", "NB" +) +[ + SketchArc_67, + SketchArc_68, + SketchArc_69, + SketchArc_70, + SketchArc_71, + SketchArc_72, + SketchArc_73, + SketchArc_74, + SketchArc_75, + SketchArc_76, + SketchLine_129, + SketchLine_130, + SketchLine_131, + SketchLine_132, + SketchLine_133, + SketchArc_77, + SketchArc_78, + SketchArc_79, + SketchArc_80, + SketchArc_81, + SketchArc_82, + SketchArc_83, + SketchArc_84, + SketchArc_85, + SketchArc_86, + SketchArc_87, + SketchArc_88, + SketchArc_89, + SketchArc_90, + SketchArc_91, + SketchLine_134, + SketchLine_135, + SketchLine_136, + SketchLine_137, + SketchLine_138, + SketchArc_92, + SketchArc_93, + SketchArc_94, + SketchArc_95, + SketchArc_96, +] = SketchMultiRotation_3.rotated() model.do() model.checkSketch(Sketch_2, 0) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 0, "e") +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 0, "e" +) NB_SUBRES = 0 NB_SUBSH = 1 NB_F = [3, 10] NB_E = [6, 48] VOL = [238.564692131974851463382947259, 844.585236664367812409182079136] -Boolean_1_objects_2 = [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2"), model.selection("SOLID", "Extrusion_2_3"), model.selection("SOLID", "Extrusion_2_4"), model.selection("SOLID", "Extrusion_2_5"), model.selection("SOLID", "Extrusion_2_6"), model.selection("SOLID", "Extrusion_2_7")] -Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], Boolean_1_objects_2) +Boolean_1_objects_2 = [ + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "Extrusion_2_2"), + model.selection("SOLID", "Extrusion_2_3"), + model.selection("SOLID", "Extrusion_2_4"), + model.selection("SOLID", "Extrusion_2_5"), + model.selection("SOLID", "Extrusion_2_6"), + model.selection("SOLID", "Extrusion_2_7"), +] +Boolean_1 = model.addCut( + Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], Boolean_1_objects_2 +) model.do() # Change parameter 'Z' and check validity of result -Z_REF_DATA = [(20, 171, 1014, 2028, 1667.562983801989503263030201197), - (22, 183, 1086, 2172, 2160.297076967755856458097696304), - (25, 201, 1194, 2388, 3068.115476944114561774767935276), - (40, 291, 1734, 3468, 11471.942563079033789108507335186), - (34, 255, 1518, 3036, 7238.123725381414260482415556908), - (30, 231, 1374, 2748, 5092.377854112805835029575973749)] +Z_REF_DATA = [ + (20, 171, 1014, 2028, 1667.562983801989503263030201197), + (22, 183, 1086, 2172, 2160.297076967755856458097696304), + (25, 201, 1194, 2388, 3068.115476944114561774767935276), + (40, 291, 1734, 3468, 11471.942563079033789108507335186), + (34, 255, 1518, 3036, 7238.123725381414260482415556908), + (30, 231, 1374, 2748, 5092.377854112805835029575973749), +] for z in Z_REF_DATA: Param_Z.setValue(z[0]) model.do() @@ -197,18 +648,22 @@ for z in Z_REF_DATA: model.do() # Change parameter 'm' and check validity of result -M_REF_DATA = [(1.5, 14094.989002197671652538701891899), - (1.2, 8007.778784522399291745387017727), - (1.0, 5092.377854113199646235443651676)] +M_REF_DATA = [ + (1.5, 14094.989002197671652538701891899), + (1.2, 8007.778784522399291745387017727), + (1.0, 5092.377854113199646235443651676), +] for m in M_REF_DATA: Param_m.setValue(m[0]) model.do() # change parameter 'NB' and check validity of result -NB_REF_DATA = [(4, 215, 1278, 2556, 4669.256782562274565862026065588), - (8, 247, 1470, 2940, 5515.498925714943652565125375986), - (7, 239, 1422, 2844, 5303.938389925016963388770818710), - (6, 231, 1374, 2748, 5092.377854112805835029575973749)] +NB_REF_DATA = [ + (4, 215, 1278, 2556, 4669.256782562274565862026065588), + (8, 247, 1470, 2940, 5515.498925714943652565125375986), + (7, 239, 1422, 2844, 5303.938389925016963388770818710), + (6, 231, 1374, 2748, 5092.377854112805835029575973749), +] for n in NB_REF_DATA: Param_NB.setValue(n[0]) model.do() diff --git a/test.compatibility/wheel_rim.py b/test.compatibility/wheel_rim.py index 5abf2c82f..593543b55 100644 --- a/test.compatibility/wheel_rim.py +++ b/test.compatibility/wheel_rim.py @@ -28,181 +28,429 @@ SketchLine_1 = Sketch_1.addLine(-70.81663645026607, 190, 229.1833635497339, 190) SketchLine_1.setAuxiliary(True) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchLine_2 = Sketch_1.addLine(16.64097565470627, 190, 22.64097565470627, 190) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_1.result() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_1.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 6) -SketchArc_1 = Sketch_1.addArc(32.64097565470627, 190, 42.64097565470627, 190, 22.64097565470627, 190, True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_1.result()) +SketchArc_1 = Sketch_1.addArc( + 32.64097565470627, 190, 42.64097565470627, 190, 22.64097565470627, 190, True +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_1.result() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_1.result() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 10) SketchLine_3 = Sketch_1.addLine(42.64097565470627, 190, 147.6409756547063, 190) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_1.result() +) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_3.result(), 105) SketchLine_4 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_4.result(), 190) -SketchLine_5 = Sketch_1.addLine(167.6409756547062, 232.4170641625502, 167.6409756547062, 155.6475648742598) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_4.result(), 190 +) +SketchLine_5 = Sketch_1.addLine( + 167.6409756547062, 232.4170641625502, 167.6409756547062, 155.6475648742598 +) SketchLine_5.setAuxiliary(True) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result()) -SketchArc_2 = Sketch_1.addArc(147.6409756547063, 202.5, 147.6409756547063, 190, 160.1409756547063, 202.5, False) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_2.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_2.results()[1]) +SketchArc_2 = Sketch_1.addArc( + 147.6409756547063, 202.5, 147.6409756547063, 190, 160.1409756547063, 202.5, False +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_2.results()[1] +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 12.5) SketchLine_6 = Sketch_1.addLine(147.6409756547063, 202.5, 147.6409756547063, 190) SketchLine_6.setAuxiliary(True) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_6.endPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_6.endPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_6.endPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_6.endPoint() +) SketchLine_7 = Sketch_1.addLine(160.1409756547063, 202.5, 147.6409756547063, 202.5) SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_7.endPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_7.endPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_6.result(), SketchLine_7.result(), 90) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_2.endPoint(), SketchLine_5.result(), 145) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_7.endPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchLine_7.endPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_6.result(), SketchLine_7.result(), 90 +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_2.endPoint(), SketchLine_5.result(), 145 +) SketchPoint_1 = Sketch_1.addPoint(167.6409756547062, 218.5857086760099) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_5.result()) -SketchArc_3 = Sketch_1.addArc(181.1409756547063, 202.5, 167.6409756547062, 218.5857086760099, 160.1409756547063, 202.5, False) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_3.startPoint()) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.endPoint()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchArc_3.endPoint()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1]) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchArc_2.results()[1]) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_5.result() +) +SketchArc_3 = Sketch_1.addArc( + 181.1409756547063, + 202.5, + 167.6409756547062, + 218.5857086760099, + 160.1409756547063, + 202.5, + False, +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_3.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_3.endPoint() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchArc_3.endPoint() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchArc_2.results()[1] +) model.do() # check overconstraint message appears -assert Sketch_1.solverError().value() != "", "FAILED: Sketch should report over-constrained situation" +assert ( + Sketch_1.solverError().value() != "" +), "FAILED: Sketch should report over-constrained situation" # remove duplicated Tangent constraint Part_1_doc.removeFeature(SketchConstraintTangent_3.feature()) model.do() -assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation" +assert ( + Sketch_1.solverError().value() == "" +), "FAILED: Sketch should NOT report over-constrained situation" # continue creating model SketchLine_8 = Sketch_1.addLine(16.64097565470627, 190, 16.64097565470627, 184) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_8.startPoint() +) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_8.result(), 6) SketchLine_9 = Sketch_1.addLine(16.64097565470627, 184, 169.1531000589648, 184) SketchLine_9.setAuxiliary(True) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchLine_10 = Sketch_1.addLine(16.64097565470627, 184, 18.2409756547065, 184) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_10.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_10.startPoint(), SketchLine_8.endPoint() +) SketchLine_11 = Sketch_1.addLine(147.6409756547063, 190, 147.6409756547063, 184) SketchLine_11.setAuxiliary(True) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_9.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_11.result(), SketchLine_9.result()) -SketchArc_4 = Sketch_1.addArc(147.6409756547063, 202.5, 147.6409756547063, 184, 166.1409756547063, 202.5, False) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_9.result() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_11.result(), SketchLine_9.result() +) +SketchArc_4 = Sketch_1.addArc( + 147.6409756547063, 202.5, 147.6409756547063, 184, 166.1409756547063, 202.5, False +) SketchArc_4.setName("SketchArc_5") SketchArc_4.result().setName("SketchArc_5") SketchArc_4.results()[1].setName("SketchArc_5_2") -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_2.center(), SketchArc_4.center()) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchArc_4.center()) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchArc_4.center()) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchArc_4.startPoint()) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_7.result()) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchArc_4.center() +) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchArc_4.center() +) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchArc_4.center() +) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_7.result() +) SketchLine_12 = Sketch_1.addLine(47.47337262898633, 184, 147.6409756547063, 184) -SketchArc_5 = Sketch_1.addArc(32.64097565470627, 190, 32.64097565470627, 174, 47.47337262898633, 184, False) +SketchArc_5 = Sketch_1.addArc( + 32.64097565470627, 190, 32.64097565470627, 174, 47.47337262898633, 184, False +) SketchArc_5.setName("SketchArc_10") SketchArc_5.result().setName("SketchArc_10") SketchArc_5.results()[1].setName("SketchArc_10_2") -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.endPoint()) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchLine_12.endPoint()) -SketchArc_6 = Sketch_1.addArc(181.1409756547063, 202.5, 166.1409756547063, 202.5, 171.498118511849, 213.9897921211111, True) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchArc_6.startPoint()) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_6.center(), SketchArc_3.center()) -SketchLine_13 = Sketch_1.addLine(181.1409756547063, 202.5, 167.6409756547062, 218.5857086760099) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.endPoint() +) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchArc_4.startPoint(), SketchLine_12.endPoint() +) +SketchArc_6 = Sketch_1.addArc( + 181.1409756547063, + 202.5, + 166.1409756547063, + 202.5, + 171.498118511849, + 213.9897921211111, + True, +) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchArc_6.startPoint() +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchArc_6.center(), SketchArc_3.center() +) +SketchLine_13 = Sketch_1.addLine( + 181.1409756547063, 202.5, 167.6409756547062, 218.5857086760099 +) SketchLine_13.setAuxiliary(True) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchArc_6.center(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_13.endPoint()) -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_13.endPoint()) -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_13.result(), SketchArc_6.endPoint()) -SketchLine_14 = Sketch_1.addLine(167.6409756547062, 218.5857086760099, 171.498118511849, 213.9897921211111) -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_14.endPoint()) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchArc_6.center(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_13.endPoint() +) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchLine_13.endPoint() +) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchLine_13.result(), SketchArc_6.endPoint() +) +SketchLine_14 = Sketch_1.addLine( + 167.6409756547062, 218.5857086760099, 171.498118511849, 213.9897921211111 +) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_42 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_43 = Sketch_1.setCoincident( + SketchArc_6.endPoint(), SketchLine_14.endPoint() +) SketchLine_15 = Sketch_1.addLine(32.64097565470627, 190, 32.64097565470627, 174) SketchLine_15.setAuxiliary(True) -SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchArc_5.startPoint()) +SketchConstraintCoincidence_44 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_45 = Sketch_1.setCoincident( + SketchLine_15.endPoint(), SketchArc_5.startPoint() +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_15.result()) SketchLine_16 = Sketch_1.addLine(32.64097565470627, 174, 12.64097565470628, 174) -SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) -SketchArc_7 = Sketch_1.addArc(12.64097565470628, 165, 12.64097565470628, 174, 3.640975654706275, 165, False) -SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchArc_7.startPoint()) +SketchConstraintCoincidence_46 = Sketch_1.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) +SketchArc_7 = Sketch_1.addArc( + 12.64097565470628, 165, 12.64097565470628, 174, 3.640975654706275, 165, False +) +SketchConstraintCoincidence_47 = Sketch_1.setCoincident( + SketchLine_16.endPoint(), SketchArc_7.startPoint() +) SketchLine_17 = Sketch_1.addLine(3.640975654706275, 165, 3.640975654706275, 100) -SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchArc_7.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_48 = Sketch_1.setCoincident( + SketchArc_7.endPoint(), SketchLine_17.startPoint() +) SketchLine_18 = Sketch_1.addLine(3.640975654706275, 100, -5.359024345293726, 100) -SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_49 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) SketchLine_19 = Sketch_1.addLine(-5.359024345293726, 100, -5.359024345293726, 165) -SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_50 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) SketchLine_20 = Sketch_1.addLine(-5.359024345293726, 165, -5.359024345293726, 100) -SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_52 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_20.endPoint()) -SketchConstraintCoincidence_53 = Sketch_1.setCoincident(SketchLine_19.startPoint(), SketchLine_20.endPoint()) +SketchConstraintCoincidence_51 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) +SketchConstraintCoincidence_52 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchLine_20.endPoint() +) +SketchConstraintCoincidence_53 = Sketch_1.setCoincident( + SketchLine_19.startPoint(), SketchLine_20.endPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_16.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_18.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_17.result()) SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_20.result()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_16.result(), SketchArc_7.results()[1]) -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchLine_17.result(), SketchArc_7.results()[1]) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchLine_16.result(), SketchArc_7.results()[1] +) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchLine_17.result(), SketchArc_7.results()[1] +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_7.results()[1], 9) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_20.result(), 65) -SketchLine_21 = Sketch_1.addLine(12.64097565470628, 174, 12.64097565470628, 192.2067667108204) +SketchLine_21 = Sketch_1.addLine( + 12.64097565470628, 174, 12.64097565470628, 192.2067667108204 +) SketchLine_21.setName("SketchLine_22") SketchLine_21.result().setName("SketchLine_22") SketchLine_21.setAuxiliary(True) -SketchConstraintCoincidence_54 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_21.startPoint()) -SketchConstraintCoincidence_55 = Sketch_1.setCoincident(SketchArc_7.startPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_54 = Sketch_1.setCoincident( + SketchLine_16.endPoint(), SketchLine_21.startPoint() +) +SketchConstraintCoincidence_55 = Sketch_1.setCoincident( + SketchArc_7.startPoint(), SketchLine_21.startPoint() +) SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_21.result()) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_16.result(), 20) -SketchArc_8 = Sketch_1.addArc(12.64097565470628, 165, -5.359024345293726, 165, 12.64097565470625, 183, True) -SketchConstraintCoincidence_56 = Sketch_1.setCoincident(SketchArc_7.center(), SketchArc_8.center()) -SketchConstraintCoincidence_57 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchArc_8.startPoint()) -SketchConstraintCoincidence_58 = Sketch_1.setCoincident(SketchLine_20.startPoint(), SketchArc_8.startPoint()) -SketchConstraintCoincidence_59 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchLine_21.result()) +SketchArc_8 = Sketch_1.addArc( + 12.64097565470628, 165, -5.359024345293726, 165, 12.64097565470625, 183, True +) +SketchConstraintCoincidence_56 = Sketch_1.setCoincident( + SketchArc_7.center(), SketchArc_8.center() +) +SketchConstraintCoincidence_57 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchArc_8.startPoint() +) +SketchConstraintCoincidence_58 = Sketch_1.setCoincident( + SketchLine_20.startPoint(), SketchArc_8.startPoint() +) +SketchConstraintCoincidence_59 = Sketch_1.setCoincident( + SketchArc_8.endPoint(), SketchLine_21.result() +) SketchLine_22 = Sketch_1.addLine(12.64097565470625, 183, 18.2409756547065, 183) SketchLine_22.setName("SketchLine_23") SketchLine_22.result().setName("SketchLine_23") -SketchConstraintCoincidence_60 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchLine_22.startPoint()) +SketchConstraintCoincidence_60 = Sketch_1.setCoincident( + SketchArc_8.endPoint(), SketchLine_22.startPoint() +) SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_22.result()) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_18.startPoint(), SketchLine_19.result(), 9) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_18.startPoint(), SketchLine_19.result(), 9 +) SketchLine_23 = Sketch_1.addLine(18.2409756547065, 183, 18.2409756547065, 184) SketchLine_23.setName("SketchLine_24") SketchLine_23.result().setName("SketchLine_24") -SketchConstraintCoincidence_61 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) -SketchConstraintCoincidence_62 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_23.endPoint()) +SketchConstraintCoincidence_61 = Sketch_1.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.startPoint() +) +SketchConstraintCoincidence_62 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_23.endPoint() +) SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_23.result()) -SketchConstraintCoincidence_63 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_64 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_65 = Sketch_1.setCoincident(SketchArc_5.center(), SketchLine_15.startPoint()) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_10.startPoint(), SketchLine_23.result(), 1.6, True) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_10.startPoint(), SketchLine_22.result(), 1, True) +SketchConstraintCoincidence_63 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_64 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_65 = Sketch_1.setCoincident( + SketchArc_5.center(), SketchLine_15.startPoint() +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_10.startPoint(), SketchLine_23.result(), 1.6, True +) +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_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) +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")) SketchLine_24.setName("SketchLine_25") SketchLine_24.result().setName("SketchLine_25") -SketchConstraintCoincidence_66 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchLine_24.result()) +SketchConstraintCoincidence_66 = Sketch_2.setCoincident( + SketchCircle_1.center(), SketchLine_24.result() +) SketchLine_25 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_25.setName("SketchLine_26") SketchLine_25.result().setName("SketchLine_26") -SketchConstraintDistance_6 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_25.result(), 120) +SketchConstraintDistance_6 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_25.result(), 120 +) SketchConstraintRadius_5 = Sketch_2.setRadius(SketchCircle_1.results()[1], 7.5) -SketchMultiRotation_1 = Sketch_2.addRotation([SketchCircle_1.results()[1]], SketchLine_24.startPoint(), 24, 15) -[SketchCircle_2, SketchCircle_3, SketchCircle_4, SketchCircle_5, SketchCircle_6, SketchCircle_7, SketchCircle_8, SketchCircle_9, SketchCircle_10, SketchCircle_11, SketchCircle_12, SketchCircle_13, SketchCircle_14, SketchCircle_15] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_2.addRotation( + [SketchCircle_1.results()[1]], SketchLine_24.startPoint(), 24, 15 +) +[ + SketchCircle_2, + SketchCircle_3, + SketchCircle_4, + SketchCircle_5, + SketchCircle_6, + SketchCircle_7, + SketchCircle_8, + SketchCircle_9, + SketchCircle_10, + SketchCircle_11, + SketchCircle_12, + SketchCircle_13, + SketchCircle_14, + SketchCircle_15, +] = SketchMultiRotation_1.rotated() model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 10, 10) -Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_6"), model.selection("SOLID", "Extrusion_1_8"), model.selection("SOLID", "Extrusion_1_9"), model.selection("SOLID", "Extrusion_1_3"), model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_4"), model.selection("SOLID", "Extrusion_1_14"), model.selection("SOLID", "Extrusion_1_5"), model.selection("SOLID", "Extrusion_1_15"), model.selection("SOLID", "Extrusion_1_11"), model.selection("SOLID", "Extrusion_1_10"), model.selection("SOLID", "Extrusion_1_12"), model.selection("SOLID", "Extrusion_1_13"), model.selection("SOLID", "Extrusion_1_7")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 10, 10 +) +Boolean_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Revolution_1_1")], + [ + model.selection("SOLID", "Extrusion_1_6"), + model.selection("SOLID", "Extrusion_1_8"), + model.selection("SOLID", "Extrusion_1_9"), + model.selection("SOLID", "Extrusion_1_3"), + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_1_4"), + model.selection("SOLID", "Extrusion_1_14"), + model.selection("SOLID", "Extrusion_1_5"), + model.selection("SOLID", "Extrusion_1_15"), + model.selection("SOLID", "Extrusion_1_11"), + model.selection("SOLID", "Extrusion_1_10"), + model.selection("SOLID", "Extrusion_1_12"), + model.selection("SOLID", "Extrusion_1_13"), + model.selection("SOLID", "Extrusion_1_7"), + ], +) model.end() from GeomAPI import GeomAPI_Shape diff --git a/test.hdfs/BearingSeparator.py b/test.hdfs/BearingSeparator.py index 41e9b5d1c..5654bb75b 100644 --- a/test.hdfs/BearingSeparator.py +++ b/test.hdfs/BearingSeparator.py @@ -18,14 +18,14 @@ # if __name__ == "__main__": - aPartFeature = locals()["Part_1"] - model.testNbResults(aPartFeature, 1) - model.testNbSubResults(aPartFeature, [0]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [1]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [115]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [890]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [1780]) - model.testResultsVolumes(aPartFeature, [1311.87963636394]) - model.testResultsAreas(aPartFeature, [3765.24411189]) + aPartFeature = locals()["Part_1"] + model.testNbResults(aPartFeature, 1) + model.testNbSubResults(aPartFeature, [0]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [1]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [115]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [890]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [1780]) + model.testResultsVolumes(aPartFeature, [1311.87963636394]) + model.testResultsAreas(aPartFeature, [3765.24411189]) - assert(model.checkPythonDump()) + assert model.checkPythonDump() diff --git a/test.hdfs/CuveN4_Tubulures.py b/test.hdfs/CuveN4_Tubulures.py index 2f16e19cc..7f4eb98e4 100644 --- a/test.hdfs/CuveN4_Tubulures.py +++ b/test.hdfs/CuveN4_Tubulures.py @@ -18,11 +18,11 @@ # if __name__ == "__main__": - aPartFeature = locals()["Part_1"] - model.testNbResults(aPartFeature, 1) - model.testNbSubResults(aPartFeature, [0]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [553]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [4089]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [17094]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [34188]) - model.testResultsVolumes(aPartFeature, [55.64517345856]) + aPartFeature = locals()["Part_1"] + model.testNbResults(aPartFeature, 1) + model.testNbSubResults(aPartFeature, [0]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [553]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [4089]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [17094]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [34188]) + model.testResultsVolumes(aPartFeature, [55.64517345856]) diff --git a/test.hdfs/Sketch_MiddlePoint_9_10.py b/test.hdfs/Sketch_MiddlePoint_9_10.py index caa50bdc9..6cd38b551 100644 --- a/test.hdfs/Sketch_MiddlePoint_9_10.py +++ b/test.hdfs/Sketch_MiddlePoint_9_10.py @@ -18,9 +18,9 @@ # if __name__ == "__main__": - aPartFeature = locals()["Part_1"] - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [4]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [20]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [72]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [144]) - model.testResultsVolumes(aPartFeature, [21030.9799879214]) + aPartFeature = locals()["Part_1"] + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [4]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [20]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [72]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [144]) + model.testResultsVolumes(aPartFeature, [21030.9799879214]) diff --git a/test.hdfs/Test20456.py b/test.hdfs/Test20456.py index 0d34053ec..f9a22d8ab 100644 --- a/test.hdfs/Test20456.py +++ b/test.hdfs/Test20456.py @@ -18,13 +18,13 @@ # if __name__ == "__main__": - aPartFeature = locals()["Part_1"] - model.testNbResults(aPartFeature, 1) - model.testNbSubResults(aPartFeature, [0]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [2]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [22]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [88]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [176]) - model.testResultsVolumes(aPartFeature, [55179.3113664]) + aPartFeature = locals()["Part_1"] + model.testNbResults(aPartFeature, 1) + model.testNbSubResults(aPartFeature, [0]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [2]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [22]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [88]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [176]) + model.testResultsVolumes(aPartFeature, [55179.3113664]) - assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) + assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/test.hdfs/Test2971.py b/test.hdfs/Test2971.py index 9a7eb59ef..20c48da89 100644 --- a/test.hdfs/Test2971.py +++ b/test.hdfs/Test2971.py @@ -18,16 +18,16 @@ # if __name__ == "__main__": - parts = locals() - for key in list(parts.keys()): - if key.startswith("Part_"): - part = parts[key] - model.testNbResults(part, 1) - model.testNbSubResults(part, [0]) - model.testNbSubShapes(part, GeomAPI_Shape.SOLID, [12]) - model.testNbSubShapes(part, GeomAPI_Shape.FACE, [103]) - model.testNbSubShapes(part, GeomAPI_Shape.EDGE, [475]) - model.testNbSubShapes(part, GeomAPI_Shape.VERTEX, [950]) - model.testResultsVolumes(part, [6487764903.02328777]) + parts = locals() + for key in list(parts.keys()): + if key.startswith("Part_"): + part = parts[key] + model.testNbResults(part, 1) + model.testNbSubResults(part, [0]) + model.testNbSubShapes(part, GeomAPI_Shape.SOLID, [12]) + model.testNbSubShapes(part, GeomAPI_Shape.FACE, [103]) + model.testNbSubShapes(part, GeomAPI_Shape.EDGE, [475]) + model.testNbSubShapes(part, GeomAPI_Shape.VERTEX, [950]) + model.testResultsVolumes(part, [6487764903.02328777]) - assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING)) + assert model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING) diff --git a/test.hdfs/Test3061.py b/test.hdfs/Test3061.py index 29e7d965f..3568d473f 100644 --- a/test.hdfs/Test3061.py +++ b/test.hdfs/Test3061.py @@ -18,11 +18,11 @@ # if __name__ == "__main__": - aPartFeature = locals()["Part_1"] - model.testNbResults(aPartFeature, 1) - model.testNbSubResults(aPartFeature, [0]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [3]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [33]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [162]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [324]) - model.testResultsVolumes(aPartFeature, [75056.139056284388]) + aPartFeature = locals()["Part_1"] + model.testNbResults(aPartFeature, 1) + model.testNbSubResults(aPartFeature, [0]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [3]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [33]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [162]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [324]) + model.testResultsVolumes(aPartFeature, [75056.139056284388]) diff --git a/test.hdfs/Test3139.py b/test.hdfs/Test3139.py index 84ace4f46..39a926b75 100644 --- a/test.hdfs/Test3139.py +++ b/test.hdfs/Test3139.py @@ -18,20 +18,20 @@ # if __name__ == "__main__": - aPartFeature = locals()["Part_1"] - model.testNbResults(aPartFeature, 1) - model.testNbSubResults(aPartFeature, [0]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [2]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [16]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [74]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [148]) - model.testResultsVolumes(aPartFeature, [23407.60956]) + aPartFeature = locals()["Part_1"] + model.testNbResults(aPartFeature, 1) + model.testNbSubResults(aPartFeature, [0]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [2]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [16]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [74]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [148]) + model.testResultsVolumes(aPartFeature, [23407.60956]) - aPartFeature = locals()["Part_2"] - model.testNbResults(aPartFeature, 1) - model.testNbSubResults(aPartFeature, [0]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [3]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [19]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [80]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [160]) - model.testResultsVolumes(aPartFeature, [39403.873983562]) + aPartFeature = locals()["Part_2"] + model.testNbResults(aPartFeature, 1) + model.testNbSubResults(aPartFeature, [0]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [3]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [19]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [80]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [160]) + model.testResultsVolumes(aPartFeature, [39403.873983562]) diff --git a/test.hdfs/delta_p.py b/test.hdfs/delta_p.py index fbad941b1..0d52e9206 100644 --- a/test.hdfs/delta_p.py +++ b/test.hdfs/delta_p.py @@ -18,11 +18,11 @@ # if __name__ == "__main__": - aPartFeature = locals()["Part_1"] - model.testNbResults(aPartFeature, 1) - model.testNbSubResults(aPartFeature, [0]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [319]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [2138]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [9022]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [18044]) - model.testResultsVolumes(aPartFeature, [0.0837941287]) + aPartFeature = locals()["Part_1"] + model.testNbResults(aPartFeature, 1) + model.testNbSubResults(aPartFeature, [0]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [319]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [2138]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [9022]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [18044]) + model.testResultsVolumes(aPartFeature, [0.0837941287]) diff --git a/test.hdfs/horseshoe.py b/test.hdfs/horseshoe.py index 316997d22..6317d0e12 100644 --- a/test.hdfs/horseshoe.py +++ b/test.hdfs/horseshoe.py @@ -18,92 +18,92 @@ # if __name__ == "__main__": - Part_1 = locals()["Part_1"] - model.testNbResults(Part_1, 1) - model.testNbSubResults(Part_1, [0]) - model.testNbSubShapes(Part_1, GeomAPI_Shape.SOLID, [1]) - model.testNbSubShapes(Part_1, GeomAPI_Shape.FACE, [20]) - model.testNbSubShapes(Part_1, GeomAPI_Shape.EDGE, [104]) - model.testNbSubShapes(Part_1, GeomAPI_Shape.VERTEX, [208]) - model.testResultsVolumes(Part_1, [937708.6935593]) + Part_1 = locals()["Part_1"] + model.testNbResults(Part_1, 1) + model.testNbSubResults(Part_1, [0]) + model.testNbSubShapes(Part_1, GeomAPI_Shape.SOLID, [1]) + model.testNbSubShapes(Part_1, GeomAPI_Shape.FACE, [20]) + model.testNbSubShapes(Part_1, GeomAPI_Shape.EDGE, [104]) + model.testNbSubShapes(Part_1, GeomAPI_Shape.VERTEX, [208]) + model.testResultsVolumes(Part_1, [937708.6935593]) - Part_2 = locals()["Part_2"] - model.testNbResults(Part_2, 1) - model.testNbSubResults(Part_2, [0]) - model.testNbSubShapes(Part_2, GeomAPI_Shape.SOLID, [1]) - model.testNbSubShapes(Part_2, GeomAPI_Shape.FACE, [12]) - model.testNbSubShapes(Part_2, GeomAPI_Shape.EDGE, [60]) - model.testNbSubShapes(Part_2, GeomAPI_Shape.VERTEX, [120]) - model.testResultsVolumes(Part_2, [256665.8235477]) + Part_2 = locals()["Part_2"] + model.testNbResults(Part_2, 1) + model.testNbSubResults(Part_2, [0]) + model.testNbSubShapes(Part_2, GeomAPI_Shape.SOLID, [1]) + model.testNbSubShapes(Part_2, GeomAPI_Shape.FACE, [12]) + model.testNbSubShapes(Part_2, GeomAPI_Shape.EDGE, [60]) + model.testNbSubShapes(Part_2, GeomAPI_Shape.VERTEX, [120]) + model.testResultsVolumes(Part_2, [256665.8235477]) - Part_3 = locals()["Part_3"] - model.testNbResults(Part_3, 1) - model.testNbSubResults(Part_3, [0]) - model.testNbSubShapes(Part_3, GeomAPI_Shape.SOLID, [1]) - model.testNbSubShapes(Part_3, GeomAPI_Shape.FACE, [12]) - model.testNbSubShapes(Part_3, GeomAPI_Shape.EDGE, [60]) - model.testNbSubShapes(Part_3, GeomAPI_Shape.VERTEX, [120]) - model.testResultsVolumes(Part_3, [2719045.0529109]) + Part_3 = locals()["Part_3"] + model.testNbResults(Part_3, 1) + model.testNbSubResults(Part_3, [0]) + model.testNbSubShapes(Part_3, GeomAPI_Shape.SOLID, [1]) + model.testNbSubShapes(Part_3, GeomAPI_Shape.FACE, [12]) + model.testNbSubShapes(Part_3, GeomAPI_Shape.EDGE, [60]) + model.testNbSubShapes(Part_3, GeomAPI_Shape.VERTEX, [120]) + model.testResultsVolumes(Part_3, [2719045.0529109]) - Part_4 = locals()["Part_4"] - model.testNbResults(Part_4, 1) - model.testNbSubResults(Part_4, [0]) - model.testNbSubShapes(Part_4, GeomAPI_Shape.SOLID, [1]) - model.testNbSubShapes(Part_4, GeomAPI_Shape.FACE, [6]) - model.testNbSubShapes(Part_4, GeomAPI_Shape.EDGE, [24]) - model.testNbSubShapes(Part_4, GeomAPI_Shape.VERTEX, [48]) - model.testResultsVolumes(Part_4, [534313.7153742]) + Part_4 = locals()["Part_4"] + model.testNbResults(Part_4, 1) + model.testNbSubResults(Part_4, [0]) + model.testNbSubShapes(Part_4, GeomAPI_Shape.SOLID, [1]) + model.testNbSubShapes(Part_4, GeomAPI_Shape.FACE, [6]) + model.testNbSubShapes(Part_4, GeomAPI_Shape.EDGE, [24]) + model.testNbSubShapes(Part_4, GeomAPI_Shape.VERTEX, [48]) + model.testResultsVolumes(Part_4, [534313.7153742]) - Part_5 = locals()["Part_5"] - model.testNbResults(Part_5, 1) - model.testNbSubResults(Part_5, [0]) - model.testNbSubShapes(Part_5, GeomAPI_Shape.SOLID, [1]) - model.testNbSubShapes(Part_5, GeomAPI_Shape.FACE, [19]) - model.testNbSubShapes(Part_5, GeomAPI_Shape.EDGE, [96]) - model.testNbSubShapes(Part_5, GeomAPI_Shape.VERTEX, [192]) - model.testResultsVolumes(Part_5, [1111187.2858512]) + Part_5 = locals()["Part_5"] + model.testNbResults(Part_5, 1) + model.testNbSubResults(Part_5, [0]) + model.testNbSubShapes(Part_5, GeomAPI_Shape.SOLID, [1]) + model.testNbSubShapes(Part_5, GeomAPI_Shape.FACE, [19]) + model.testNbSubShapes(Part_5, GeomAPI_Shape.EDGE, [96]) + model.testNbSubShapes(Part_5, GeomAPI_Shape.VERTEX, [192]) + model.testResultsVolumes(Part_5, [1111187.2858512]) - Part_6 = locals()["Part_6"] - model.testNbResults(Part_6, 1) - model.testNbSubResults(Part_6, [0]) - model.testNbSubShapes(Part_6, GeomAPI_Shape.SOLID, [1]) - model.testNbSubShapes(Part_6, GeomAPI_Shape.FACE, [12]) - model.testNbSubShapes(Part_6, GeomAPI_Shape.EDGE, [60]) - model.testNbSubShapes(Part_6, GeomAPI_Shape.VERTEX, [120]) - model.testResultsVolumes(Part_6, [124567.8141964]) + Part_6 = locals()["Part_6"] + model.testNbResults(Part_6, 1) + model.testNbSubResults(Part_6, [0]) + model.testNbSubShapes(Part_6, GeomAPI_Shape.SOLID, [1]) + model.testNbSubShapes(Part_6, GeomAPI_Shape.FACE, [12]) + model.testNbSubShapes(Part_6, GeomAPI_Shape.EDGE, [60]) + model.testNbSubShapes(Part_6, GeomAPI_Shape.VERTEX, [120]) + model.testResultsVolumes(Part_6, [124567.8141964]) - Part_7 = locals()["Part_7"] - model.testNbResults(Part_7, 1) - model.testNbSubResults(Part_7, [0]) - model.testNbSubShapes(Part_7, GeomAPI_Shape.SOLID, [1]) - model.testNbSubShapes(Part_7, GeomAPI_Shape.FACE, [12]) - model.testNbSubShapes(Part_7, GeomAPI_Shape.EDGE, [60]) - model.testNbSubShapes(Part_7, GeomAPI_Shape.VERTEX, [120]) - model.testResultsVolumes(Part_7, [3106355.9518294]) + Part_7 = locals()["Part_7"] + model.testNbResults(Part_7, 1) + model.testNbSubResults(Part_7, [0]) + model.testNbSubShapes(Part_7, GeomAPI_Shape.SOLID, [1]) + model.testNbSubShapes(Part_7, GeomAPI_Shape.FACE, [12]) + model.testNbSubShapes(Part_7, GeomAPI_Shape.EDGE, [60]) + model.testNbSubShapes(Part_7, GeomAPI_Shape.VERTEX, [120]) + model.testResultsVolumes(Part_7, [3106355.9518294]) - Part_8 = locals()["Part_8"] - model.testNbResults(Part_8, 1) - model.testNbSubResults(Part_8, [0]) - model.testNbSubShapes(Part_8, GeomAPI_Shape.SOLID, [1]) - model.testNbSubShapes(Part_8, GeomAPI_Shape.FACE, [6]) - model.testNbSubShapes(Part_8, GeomAPI_Shape.EDGE, [24]) - model.testNbSubShapes(Part_8, GeomAPI_Shape.VERTEX, [48]) - model.testResultsVolumes(Part_8, [570471.5090269]) + Part_8 = locals()["Part_8"] + model.testNbResults(Part_8, 1) + model.testNbSubResults(Part_8, [0]) + model.testNbSubShapes(Part_8, GeomAPI_Shape.SOLID, [1]) + model.testNbSubShapes(Part_8, GeomAPI_Shape.FACE, [6]) + model.testNbSubShapes(Part_8, GeomAPI_Shape.EDGE, [24]) + model.testNbSubShapes(Part_8, GeomAPI_Shape.VERTEX, [48]) + model.testResultsVolumes(Part_8, [570471.5090269]) - Part_9 = locals()["Part_9"] - model.testNbResults(Part_9, 1) - model.testNbSubResults(Part_9, [0]) - model.testNbSubShapes(Part_9, GeomAPI_Shape.SOLID, [1]) - model.testNbSubShapes(Part_9, GeomAPI_Shape.FACE, [7]) - model.testNbSubShapes(Part_9, GeomAPI_Shape.EDGE, [30]) - model.testNbSubShapes(Part_9, GeomAPI_Shape.VERTEX, [60]) - model.testResultsVolumes(Part_9, [1688917.3777022]) + Part_9 = locals()["Part_9"] + model.testNbResults(Part_9, 1) + model.testNbSubResults(Part_9, [0]) + model.testNbSubShapes(Part_9, GeomAPI_Shape.SOLID, [1]) + model.testNbSubShapes(Part_9, GeomAPI_Shape.FACE, [7]) + model.testNbSubShapes(Part_9, GeomAPI_Shape.EDGE, [30]) + model.testNbSubShapes(Part_9, GeomAPI_Shape.VERTEX, [60]) + model.testResultsVolumes(Part_9, [1688917.3777022]) - Part_10 = locals()["Part_10"] - model.testNbResults(Part_10, 1) - model.testNbSubResults(Part_10, [0]) - model.testNbSubShapes(Part_10, GeomAPI_Shape.SOLID, [1]) - model.testNbSubShapes(Part_10, GeomAPI_Shape.FACE, [10]) - model.testNbSubShapes(Part_10, GeomAPI_Shape.EDGE, [48]) - model.testNbSubShapes(Part_10, GeomAPI_Shape.VERTEX, [96]) - model.testResultsVolumes(Part_10, [6604147.6151849]) + Part_10 = locals()["Part_10"] + model.testNbResults(Part_10, 1) + model.testNbSubResults(Part_10, [0]) + model.testNbSubShapes(Part_10, GeomAPI_Shape.SOLID, [1]) + model.testNbSubShapes(Part_10, GeomAPI_Shape.FACE, [10]) + model.testNbSubShapes(Part_10, GeomAPI_Shape.EDGE, [48]) + model.testNbSubShapes(Part_10, GeomAPI_Shape.VERTEX, [96]) + model.testResultsVolumes(Part_10, [6604147.6151849]) diff --git a/test.hdfs/roselend.py b/test.hdfs/roselend.py index 5a1ab3f89..ea3406363 100644 --- a/test.hdfs/roselend.py +++ b/test.hdfs/roselend.py @@ -18,11 +18,11 @@ # if __name__ == "__main__": - aPartFeature = locals()["Part_1"] - model.testNbResults(aPartFeature, 1) - model.testNbSubResults(aPartFeature, [0]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [32]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [875]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [4659]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [9318]) - model.testResultsVolumes(aPartFeature, [145241798.70546785]) + aPartFeature = locals()["Part_1"] + model.testNbResults(aPartFeature, 1) + model.testNbSubResults(aPartFeature, [0]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [32]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [875]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [4659]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [9318]) + model.testResultsVolumes(aPartFeature, [145241798.70546785]) diff --git a/test.hdfs/te_fluide.py b/test.hdfs/te_fluide.py index aa20bd44f..af7d203e6 100644 --- a/test.hdfs/te_fluide.py +++ b/test.hdfs/te_fluide.py @@ -18,11 +18,11 @@ # if __name__ == "__main__": - aPartFeature = locals()["Part_1"] - model.testNbResults(aPartFeature, 1) - model.testNbSubResults(aPartFeature, [0]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [30]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [231]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [968]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [1936]) - model.testResultsVolumes(aPartFeature, [1429610.103267467]) + aPartFeature = locals()["Part_1"] + model.testNbResults(aPartFeature, 1) + model.testNbSubResults(aPartFeature, [0]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [30]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [231]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [968]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [1936]) + model.testResultsVolumes(aPartFeature, [1429610.103267467]) diff --git a/test.hdfs/te_solide.py b/test.hdfs/te_solide.py index c196d1d89..bba07dc4f 100644 --- a/test.hdfs/te_solide.py +++ b/test.hdfs/te_solide.py @@ -18,11 +18,11 @@ # if __name__ == "__main__": - aPartFeature = locals()["Part_1"] - model.testNbResults(aPartFeature, 1) - model.testNbSubResults(aPartFeature, [0]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [48]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [292]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [1176]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [2352]) - model.testResultsVolumes(aPartFeature, [6468345.48144548386]) + aPartFeature = locals()["Part_1"] + model.testNbResults(aPartFeature, 1) + model.testNbSubResults(aPartFeature, [0]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [48]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [292]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [1176]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [2352]) + model.testResultsVolumes(aPartFeature, [6468345.48144548386]) diff --git a/test.hdfs/test_hdf.py b/test.hdfs/test_hdf.py index 8911735b3..896333eb0 100644 --- a/test.hdfs/test_hdf.py +++ b/test.hdfs/test_hdf.py @@ -27,68 +27,71 @@ import ModelHighAPI, ModelAPI, PartSetAPI from GeomAPI import GeomAPI_Shape from salome.shaper import model + class TestHDF(unittest.TestCase): - testfile = "" - reffile = "" - - def setUp(self): - salome.standalone() - salome.salome_init(self.testfile, embedded=1, forced=True) - myStudyName = salome.myStudy._get_Name() - self.session = salome.naming_service.Resolve('/Kernel/Session') - self.session.emitMessage("connect_to_study") - - self.sg = SalomePyQt.SalomePyQt() - self.sg.activateModule("Shaper") - self.session = ModelAPI.ModelAPI_Session.get() - self.partSet = self.session.moduleDocument() - - def tearDown(self): - salome.sg.UpdateView() - self.sg.processEvents() - salome.sg.FitAll() - - def test_hdf_file(self): - self.assertTrue(self.partSet.size("Parts") > 0) - aPartsList = dict() - for aPartIndex in range(self.partSet.size("Parts")): - self.session.startOperation() - aPart = ModelAPI.modelAPI_ResultPart(ModelAPI.objectToResult(self.partSet.object("Parts", aPartIndex))) - aPart.activate() - self.session.finishOperation() - - aPartFeature = PartSetAPI.PartSetAPI_Part(self.partSet.currentFeature(True)) - aPartsList["Part_{}".format(aPartIndex+1)] = aPartFeature - - self.session.startOperation() - self.session.setActiveDocument(self.partSet) - self.session.finishOperation() - - # Check that the features are not in error - Part_1_doc = aPart.partDoc() - - model.checkFeaturesValidity(Part_1_doc) - # check reference data - exec(open(self.reffile, "rb").read(), globals(), aPartsList) + testfile = "" + reffile = "" + + def setUp(self): + salome.standalone() + salome.salome_init(self.testfile, embedded=1, forced=True) + myStudyName = salome.myStudy._get_Name() + self.session = salome.naming_service.Resolve("/Kernel/Session") + self.session.emitMessage("connect_to_study") + + self.sg = SalomePyQt.SalomePyQt() + self.sg.activateModule("Shaper") + self.session = ModelAPI.ModelAPI_Session.get() + self.partSet = self.session.moduleDocument() + + def tearDown(self): + salome.sg.UpdateView() + self.sg.processEvents() + salome.sg.FitAll() + + def test_hdf_file(self): + self.assertTrue(self.partSet.size("Parts") > 0) + aPartsList = dict() + for aPartIndex in range(self.partSet.size("Parts")): + self.session.startOperation() + aPart = ModelAPI.modelAPI_ResultPart( + ModelAPI.objectToResult(self.partSet.object("Parts", aPartIndex)) + ) + aPart.activate() + self.session.finishOperation() + + aPartFeature = PartSetAPI.PartSetAPI_Part(self.partSet.currentFeature(True)) + aPartsList["Part_{}".format(aPartIndex + 1)] = aPartFeature + + self.session.startOperation() + self.session.setActiveDocument(self.partSet) + self.session.finishOperation() + + # Check that the features are not in error + Part_1_doc = aPart.partDoc() + + model.checkFeaturesValidity(Part_1_doc) + # check reference data + exec(open(self.reffile, "rb").read(), globals(), aPartsList) if __name__ == "__main__": - if len(sys.argv) > 1: - TestHDF.testfile = sys.argv[1] - if len(sys.argv) > 2: - TestHDF.reffile = sys.argv[2] - if len(sys.argv) > 3: - errFile = open(sys.argv[3], 'w') - else: - # to ease debugging, display the log in embedded python console if no log file is provided - # when calling salome in command line for instance - # runSalome.py --splash 0 test_hdf.py args:BearingSeparator.hdf,BearingSeparator.py - errFile = None - - aTest = unittest.TestLoader().loadTestsFromTestCase(TestHDF) - unittest.TextTestRunner(stream=errFile).run(aTest) - if errFile: - errFile.close() - - # Quit SALOME the clean way - sys.exit() + if len(sys.argv) > 1: + TestHDF.testfile = sys.argv[1] + if len(sys.argv) > 2: + TestHDF.reffile = sys.argv[2] + if len(sys.argv) > 3: + errFile = open(sys.argv[3], "w") + else: + # to ease debugging, display the log in embedded python console if no log file is provided + # when calling salome in command line for instance + # runSalome.py --splash 0 test_hdf.py args:BearingSeparator.hdf,BearingSeparator.py + errFile = None + + aTest = unittest.TestLoader().loadTestsFromTestCase(TestHDF) + unittest.TextTestRunner(stream=errFile).run(aTest) + if errFile: + errFile.close() + + # Quit SALOME the clean way + sys.exit() diff --git a/test.hdfs/testme.py b/test.hdfs/testme.py index 3a8965943..62f44ae52 100644 --- a/test.hdfs/testme.py +++ b/test.hdfs/testme.py @@ -19,62 +19,76 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -if __name__ == '__main__': +if __name__ == "__main__": + import subprocess + from time import sleep + import sys, os + import tempfile - import subprocess - from time import sleep - import sys, os - import tempfile + testTimeout = 600 + if len(sys.argv) > 3: + testTimeout = int(sys.argv[1]) + hdffile = sys.argv[2] + testdatafile = sys.argv[3] + else: + hdffile = sys.argv[1] + testdatafile = sys.argv[2] - testTimeout = 600 - if len(sys.argv) > 3: - testTimeout = int(sys.argv[1]) - hdffile = sys.argv[2] - testdatafile = sys.argv[3] - else: - hdffile = sys.argv[1] - testdatafile = sys.argv[2] - - tempfile = tempfile.NamedTemporaryFile() - hdffile_basename = os.path.basename(hdffile) - test_hdfpy = "test_hdf.py" - if not os.path.exists(test_hdfpy): - # add absolute path in SHAPER install directory - test_hdfpy = os.path.join(os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "test", "HDFs", test_hdfpy) + tempfile = tempfile.NamedTemporaryFile() + hdffile_basename = os.path.basename(hdffile) + test_hdfpy = "test_hdf.py" if not os.path.exists(test_hdfpy): - raise Exception("test_hdf.py could not be found. Check your environment.") - testlogfile = tempfile.name + "_" + hdffile_basename.replace(".", "_") - tempfile.close() + # add absolute path in SHAPER install directory + test_hdfpy = os.path.join( + os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "test", "HDFs", test_hdfpy + ) + if not os.path.exists(test_hdfpy): + raise Exception("test_hdf.py could not be found. Check your environment.") + testlogfile = tempfile.name + "_" + hdffile_basename.replace(".", "_") + tempfile.close() + + isOk = True + error = "" + + proc = subprocess.Popen( + [ + "runSalome.py", + "--modules", + "SHAPER,GEOM,SHAPERSTUDY", + "--gui", + "--splash", + "0", + test_hdfpy, + "args:" + hdffile + "," + testdatafile + "," + testlogfile, + ] + ) + try: + proc.communicate(timeout=testTimeout) + except subprocess.TimeoutExpired: + isOk = False + import salome_utils - isOk = True - error = "" + port = salome_utils.getPortNumber() + import killSalomeWithPort - proc = subprocess.Popen(["runSalome.py", "--modules", "SHAPER,GEOM,SHAPERSTUDY", "--gui", "--splash", "0", test_hdfpy, "args:" + hdffile + "," + testdatafile + "," + testlogfile]) - try: - proc.communicate(timeout = testTimeout) - except subprocess.TimeoutExpired: - isOk = False - import salome_utils - port = salome_utils.getPortNumber() - import killSalomeWithPort - killSalomeWithPort.killMyPort(port) - error = "Killed by CPU limit." + killSalomeWithPort.killMyPort(port) + error = "Killed by CPU limit." - assert isOk, "Test failed. {}".format(error) + assert isOk, "Test failed. {}".format(error) - with open(testlogfile, 'r') as inputFile: - s = inputFile.read() - #print("logfile: ", s) - if s.find("FAIL") > 0: - isOk = False - error = s - elif s.find("OK") < 0: - isOk = False - error = "Test not ended until OK. Maybe a SIGSEGV." + with open(testlogfile, "r") as inputFile: + s = inputFile.read() + # print("logfile: ", s) + if s.find("FAIL") > 0: + isOk = False + error = s + elif s.find("OK") < 0: + isOk = False + error = "Test not ended until OK. Maybe a SIGSEGV." - try: - os.remove(testlogfile) - except: - pass + try: + os.remove(testlogfile) + except: + pass - assert isOk, "Test failed. {}".format(error) + assert isOk, "Test failed. {}".format(error) diff --git a/test.hdfs/usine.py b/test.hdfs/usine.py index 1d399442a..f5dd8ca15 100644 --- a/test.hdfs/usine.py +++ b/test.hdfs/usine.py @@ -18,11 +18,11 @@ # if __name__ == "__main__": - aPartFeature = locals()["Part_1"] - model.testNbResults(aPartFeature, 1) - model.testNbSubResults(aPartFeature, [0]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [186]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [4573]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [25474]) - model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [50980]) - model.testResultsVolumes(aPartFeature, [2688153.285910513252]) + aPartFeature = locals()["Part_1"] + model.testNbResults(aPartFeature, 1) + model.testNbSubResults(aPartFeature, [0]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [186]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [4573]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [25474]) + model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [50980]) + model.testResultsVolumes(aPartFeature, [2688153.285910513252]) diff --git a/test.models/CSWA.py b/test.models/CSWA.py index 13fe2f1df..dbf7fca16 100644 --- a/test.models/CSWA.py +++ b/test.models/CSWA.py @@ -31,195 +31,499 @@ model.addParameter(Part_1_doc, "c", "100") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(-45, 0, 0, 0) SketchLine_2 = Sketch_1.addLine(0, 0, 23.33965093306752, 8.494938217797719) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(33.83092017818969, 6.16907982180411, 40, 0) SketchLine_4 = Sketch_1.addLine(40, 0, 55, 0) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3") SketchLine_5 = Sketch_1.addLine(55, 0, 55, 48) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_4") SketchLine_6 = Sketch_1.addLine(55, 48, 15, 48) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5") SketchLine_7 = Sketch_1.addLine(15, 48, 15, 63) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_6") SketchLine_8 = Sketch_1.addLine(15, 63, -15, 63) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7") SketchLine_9 = Sketch_1.addLine(-15, 63, -15, 35.00000000000001) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8") SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_8.result()) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_1.result(), SketchLine_4.result()) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_1.result(), SketchLine_4.result() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_4.endPoint(), 15) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_1.endPoint(), 40) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_4.endPoint(), "c") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_8.startPoint(), SketchLine_6.result(), 15) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_8.startPoint(), SketchLine_5.result(), 40) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_4.endPoint(), 15 +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_1.endPoint(), 40 +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_4.endPoint(), "c" +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_8.startPoint(), SketchLine_6.result(), 15 +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_8.startPoint(), SketchLine_5.result(), 40 +) SketchLine_10 = Sketch_1.addLine(-45, 4.999999999999999, -45, 0) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_10.endPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_9") SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_9.startPoint(), SketchLine_1.result(), "a") -SketchArc_1 = Sketch_1.addArc(-45, 35, -45, 4.999999999999999, -15, 35.00000000000001, False) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_10.result()) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_9.startPoint(), SketchLine_1.result(), "a" +) +SketchArc_1 = Sketch_1.addArc( + -45, 35, -45, 4.999999999999999, -15, 35.00000000000001, False +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_10.result() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_10.startPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11") -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_1.result(), 45) -SketchConstraintAngle_2 = Sketch_1.setAngleBackward(SketchLine_2.result(), SketchLine_4.result(), 20) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_9.endPoint()) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_3.result(), SketchLine_1.result(), 45 +) +SketchConstraintAngle_2 = Sketch_1.setAngleBackward( + SketchLine_2.result(), SketchLine_4.result(), 20 +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_9.endPoint() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_12") -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_9.result()) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_1.result(), 35) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_9.result() +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchArc_1.center(), SketchLine_1.result(), 35 +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 30) -SketchArc_2 = Sketch_1.addArc(26.75985236632421, -0.9019879900613652, 33.83092017818969, 6.16907982180411, 23.33965093306752, 8.494938217797719, False) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_3.startPoint()) +SketchArc_2 = Sketch_1.addArc( + 26.75985236632421, + -0.9019879900613652, + 33.83092017818969, + 6.16907982180411, + 23.33965093306752, + 8.494938217797719, + False, +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_13") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_2.endPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_2.endPoint() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_14") -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_2.result()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_3.result()) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_2.result() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_3.result() +) 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()) +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_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") +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]")) +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 = 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/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/Modified_Face&Sketch_1/SketchArc_1_2][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])2([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2([ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])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()) +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/Modified_Face&Sketch_1/SketchArc_1_2][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])2([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2([ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])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 = 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/Modified_Face&Sketch_1/SketchArc_1_2][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])2([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2([ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2")) -SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchArc_3.endPoint(), SketchArc_4.results()[1]) +SketchArc_4 = Sketch_3.addArc( + model.selection( + "EDGE", + "([ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9])2([Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2([ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2])2", + ) +) +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) -SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchArc_3.startPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_19 = Sketch_3.setCoincident( + SketchArc_3.startPoint(), SketchLine_12.startPoint() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_20") -SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_12.endPoint()) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident( + SketchPoint_3.coordinates(), SketchLine_12.endPoint() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_21") -SketchArc_5 = Sketch_3.addArc(-45, 35, -15, 35.00000000000001, -17.02045759563121, 24.17663606626137, True) -SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchArc_4.result(), SketchArc_5.center()) +SketchArc_5 = Sketch_3.addArc( + -45, 35, -15, 35.00000000000001, -17.02045759563121, 24.17663606626137, True +) +SketchConstraintCoincidence_21 = Sketch_3.setCoincident( + SketchArc_4.result(), SketchArc_5.center() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_22") -SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchArc_5.startPoint()) +SketchConstraintCoincidence_22 = Sketch_3.setCoincident( + SketchPoint_3.coordinates(), SketchArc_5.startPoint() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_23") -SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchArc_3.results()[1], SketchArc_5.endPoint()) +SketchConstraintCoincidence_23 = Sketch_3.setCoincident( + SketchArc_3.results()[1], SketchArc_5.endPoint() +) 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")) -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]")) +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") +) +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 = 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/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()) +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/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/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()) +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") -SketchConstraintCoincidence_27 = Sketch_5.setCoincident(SketchArc_6.endPoint(), SketchArc_8.startPoint()) +SketchConstraintCoincidence_27 = Sketch_5.setCoincident( + SketchArc_6.endPoint(), SketchArc_8.startPoint() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_28") -SketchConstraintCoincidence_28 = Sketch_5.setCoincident(SketchArc_7.endPoint(), SketchArc_8.results()[1]) +SketchConstraintCoincidence_28 = Sketch_5.setCoincident( + SketchArc_7.endPoint(), SketchArc_8.results()[1] +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_29") -SketchConstraintCoincidence_29 = Sketch_5.setCoincident(SketchArc_7.startPoint(), SketchArc_6.startPoint()) +SketchConstraintCoincidence_29 = Sketch_5.setCoincident( + SketchArc_7.startPoint(), SketchArc_6.startPoint() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_30") SketchLine_13 = Sketch_5.addLine(-45, 5, -45, 10) -SketchConstraintCoincidence_30 = Sketch_5.setCoincident(SketchArc_6.startPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_30 = Sketch_5.setCoincident( + SketchArc_6.startPoint(), SketchLine_13.startPoint() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_31") SketchConstraintVertical_5 = Sketch_5.setVertical(SketchLine_13.result()) SketchConstraintLength_1 = Sketch_5.setLength(SketchLine_13.result(), 5) -SketchArc_9 = Sketch_5.addArc(-45, 35, -45, 10, -30.00000000000075, 14.99999999999944, False) -SketchConstraintCoincidence_31 = Sketch_5.setCoincident(SketchArc_6.center(), SketchArc_9.center()) +SketchArc_9 = Sketch_5.addArc( + -45, 35, -45, 10, -30.00000000000075, 14.99999999999944, False +) +SketchConstraintCoincidence_31 = Sketch_5.setCoincident( + SketchArc_6.center(), SketchArc_9.center() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_32") -SketchConstraintCoincidence_32 = Sketch_5.setCoincident(SketchArc_8.endPoint(), SketchArc_9.endPoint()) +SketchConstraintCoincidence_32 = Sketch_5.setCoincident( + SketchArc_8.endPoint(), SketchArc_9.endPoint() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_33") -SketchConstraintCoincidence_33 = Sketch_5.setCoincident(SketchArc_9.startPoint(), SketchLine_13.endPoint()) +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-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]")) +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 = 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 = 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/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_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 = 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/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()) +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]) +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, 47.99999999999999) -SketchConstraintCoincidence_38 = Sketch_6.setCoincident(SketchArc_10.startPoint(), SketchLine_18.startPoint()) +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 = Sketch_6.setCoincident( + SketchLine_14.endPoint(), SketchLine_18.endPoint() +) SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_40") SketchLine_19 = Sketch_6.addLine(35, 47.99999999999999, 55, 47.99999999999999) -SketchConstraintCoincidence_40 = Sketch_6.setCoincident(SketchLine_16.endPoint(), SketchLine_19.startPoint()) +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 = 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/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")) +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/Modified_Face&Sketch_1/SketchLine_5][ExtrusionCut_2_1/From_Face]")) -SketchConstraintDistance_9 = Sketch_7.setDistance(SketchCircle_4.center(), SketchLine_20.result(), 10, False) +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&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()) +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 = 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_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")) +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) SketchLine_25 = Sketch_8.addLine(55, 13, 55, 25) -SketchConstraintCoincidence_44 = Sketch_8.setCoincident(SketchLine_25.endPoint(), SketchLine_22.startPoint()) +SketchConstraintCoincidence_44 = Sketch_8.setCoincident( + SketchLine_25.endPoint(), SketchLine_22.startPoint() +) SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_45") -SketchConstraintCoincidence_45 = Sketch_8.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) +SketchConstraintCoincidence_45 = Sketch_8.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.startPoint() +) SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_46") -SketchConstraintCoincidence_46 = Sketch_8.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) +SketchConstraintCoincidence_46 = Sketch_8.setCoincident( + SketchLine_23.endPoint(), SketchLine_24.startPoint() +) SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_47") -SketchConstraintCoincidence_47 = Sketch_8.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint()) +SketchConstraintCoincidence_47 = Sketch_8.setCoincident( + SketchLine_24.endPoint(), SketchLine_25.startPoint() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_48") SketchConstraintHorizontal_5 = Sketch_8.setHorizontal(SketchLine_22.result()) SketchConstraintVertical_7 = Sketch_8.setVertical(SketchLine_23.result()) @@ -227,46 +531,143 @@ 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/Modified_Face&Sketch_1/SketchLine_5][ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_6]"), False) +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 = 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/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()) +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_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")) +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()) +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/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()) +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.00000000000009) -SketchConstraintDistance_10 = Sketch_9.setDistance(SketchLine_28.startPoint(), SketchLine_29.result(), 18, False) +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 = 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()) +SketchConstraintCoincidence_53 = Sketch_9.setCoincident( + SketchLine_29.startPoint(), SketchLine_31.endPoint() +) SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_54") SketchLine_32 = Sketch_9.addLine(25, -63, 25, -45) -SketchConstraintCoincidence_54 = Sketch_9.setCoincident(SketchLine_29.startPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_54 = Sketch_9.setCoincident( + SketchLine_29.startPoint(), SketchLine_32.startPoint() +) SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_55") -SketchConstraintCoincidence_55 = Sketch_9.setCoincident(SketchLine_28.startPoint(), SketchLine_32.endPoint()) +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_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")) +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/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) +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_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")]) +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 @@ -288,4 +689,4 @@ model.testResultsVolumes(ExtrusionCut_6, [144033.64842978157685]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.models/angle30.py b/test.models/angle30.py index a4ef21796..e12858287 100644 --- a/test.models/angle30.py +++ b/test.models/angle30.py @@ -39,112 +39,224 @@ SketchLine_4 = Sketch_1.addLine(50, 0, -53.92304845413265, -60) 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()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(44, 9.237604307034037, 44, 70) SketchLine_5.setName("SketchLine_8") SketchLine_5.result().setName("SketchLine_8") -SketchLine_6 = Sketch_1.addLine(-53.92304845413265, -60, -56.92304845413265, -54.80384757729332) +SketchLine_6 = Sketch_1.addLine( + -53.92304845413265, -60, -56.92304845413265, -54.80384757729332 +) SketchLine_6.setName("SketchLine_3") SketchLine_6.result().setName("SketchLine_3") -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_6.startPoint()) -SketchLine_7 = Sketch_1.addLine(-56.92304845413265, -54.80384757729332, 39, 0.5773502691896394) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_6.startPoint() +) +SketchLine_7 = Sketch_1.addLine( + -56.92304845413265, -54.80384757729332, 39, 0.5773502691896394 +) SketchLine_7.setName("SketchLine_9") SketchLine_7.result().setName("SketchLine_9") -SketchLine_8 = Sketch_1.addLine(-56.92304845413265, -54.80384757729332, 44, 3.464101615137764) +SketchLine_8 = Sketch_1.addLine( + -56.92304845413265, -54.80384757729332, 44, 3.464101615137764 +) SketchLine_8.setName("SketchLine_4") SketchLine_8.result().setName("SketchLine_4") SketchLine_8.setAuxiliary(True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(44, 3.464101615137764, 44, 70) SketchLine_9.setName("SketchLine_5") SketchLine_9.result().setName("SketchLine_5") SketchLine_9.setAuxiliary(True) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchLine_10 = Sketch_1.addLine(44, 70, 50, 70) SketchLine_10.setName("SketchLine_6") SketchLine_10.result().setName("SketchLine_6") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_10.endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_10.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.startPoint(), SketchLine_9.result(), "H", False) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.startPoint(), SketchLine_9.result(), "H", False +) SketchLine_11 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_11.setName("SketchLine_7") SketchLine_11.result().setName("SketchLine_7") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.startPoint(), SketchLine_11.result(), 50, False) -SketchArc_1 = Sketch_1.addArc(34, 9.237604307034037, 39, 0.5773502691896394, 44, 9.237604307034037, False) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_7.endPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_5.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_5.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_7.result()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_5.endPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.result()) -SketchArc_2 = Sketch_1.addArc(34, 9.237604307034022, 42, -4.618802153516998, 50, 9.237604307034024, False) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_1.endPoint()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_1.result()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_2.result()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_2.endPoint()) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.result()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_4.result()) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_4.startPoint(), 70, False) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_2.result(), SketchLine_6.result()) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_2.result(), 6, False) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_7.result()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_2.result(), 119.9999999999999) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_4.startPoint(), SketchLine_6.startPoint(), 120, False) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_3.startPoint(), SketchLine_11.result(), 50, False +) +SketchArc_1 = Sketch_1.addArc( + 34, 9.237604307034037, 39, 0.5773502691896394, 44, 9.237604307034037, False +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_7.endPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_5.result() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_7.result() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_5.endPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_8.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.result() +) +SketchArc_2 = Sketch_1.addArc( + 34, 9.237604307034022, 42, -4.618802153516998, 50, 9.237604307034024, False +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_1.endPoint() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_1.result() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_2.result() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_2.endPoint() +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.result() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_4.result() +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_4.startPoint(), 70, False +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_2.result(), SketchLine_6.result() +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_6.endPoint(), SketchLine_2.result(), 6, False +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_2.result(), SketchLine_7.result() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_1.result(), SketchLine_2.result(), 119.9999999999999 +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_4.startPoint(), SketchLine_6.startPoint(), 120, False +) SketchLine_12 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_12.result()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_4.startPoint(), SketchLine_12.result() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_2.results()[1], 16) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_1.results()[1], 10) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_2.addCircle(0, 0, 17.5) SketchPoint_1 = Sketch_2.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchPoint_1.result()) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchCircle_1.center(), SketchPoint_1.result() +) SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_1.results()[1], 17.5) SketchCircle_2 = Sketch_2.addCircle(0, 0, 14.5) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchCircle_2.center()) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchCircle_2.center()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchCircle_1.center(), SketchCircle_2.center() +) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchPoint_1.coordinates(), SketchCircle_2.center() +) SketchConstraintRadius_4 = Sketch_2.setRadius(SketchCircle_2.results()[1], 14.5) model.do() Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchLine_13 = Sketch_3.addLine(-22, 70, -22, -35.79571668975675) SketchLine_14 = Sketch_3.addLine(-22, -35.79571668975675, 55, 8.660254037844405) -SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_23 = Sketch_3.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchLine_15 = Sketch_3.addLine(55, 8.660254037844405, 55, 70) -SketchConstraintCoincidence_24 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_24 = Sketch_3.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) SketchLine_16 = Sketch_3.addLine(55, 70, -22, 70) -SketchConstraintCoincidence_25 = Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchLine_13.startPoint(), SketchLine_16.endPoint()) +SketchConstraintCoincidence_25 = Sketch_3.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_26 = Sketch_3.setCoincident( + SketchLine_13.startPoint(), SketchLine_16.endPoint() +) 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/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) +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")) -SketchConstraintDistance_7 = Sketch_3.setDistance(SketchLine_16.startPoint(), SketchLine_18.result(), 55, False) -SketchConstraintDistance_8 = Sketch_3.setDistance(SketchLine_13.startPoint(), SketchLine_18.result(), 22, False) +SketchConstraintDistance_7 = Sketch_3.setDistance( + SketchLine_16.startPoint(), SketchLine_18.result(), 55, False +) +SketchConstraintDistance_8 = Sketch_3.setDistance( + SketchLine_13.startPoint(), SketchLine_18.result(), 22, False +) SketchLine_19 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_15.endPoint(), SketchLine_19.result(), 70, False) +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/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")]) +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")) SketchLine_20 = Sketch_4.addLine(-4, 38, -4, 21.26617031813674) SketchLine_20.setName("SketchLine_36") SketchLine_20.result().setName("SketchLine_36") -SketchArc_3 = Sketch_4.addArc(0, 0, -8.5, 15.2970585407786, -7.446808510638298, 15.83650981137842, True) +SketchArc_3 = Sketch_4.addArc( + 0, 0, -8.5, 15.2970585407786, -7.446808510638298, 15.83650981137842, True +) SketchArc_3.setName("SketchArc_6") SketchArc_3.result().setName("SketchArc_6") SketchArc_3.results()[1].setName("SketchArc_6_2") -SketchArc_4 = Sketch_4.addArc(0, 0, 7.446808510638299, 15.83650981137842, 8.5, 15.29705854077835, True) +SketchArc_4 = Sketch_4.addArc( + 0, 0, 7.446808510638299, 15.83650981137842, 8.5, 15.29705854077835, True +) SketchArc_4.setName("SketchArc_8") SketchArc_4.result().setName("SketchArc_8") SketchArc_4.results()[1].setName("SketchArc_8_2") @@ -171,29 +283,41 @@ SketchLine_27 = Sketch_4.addLine(4, 17.03672503740084, 4, 44) SketchLine_27.setName("SketchLine_27") SketchLine_27.result().setName("SketchLine_27") SketchLine_27.setAuxiliary(True) -SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchLine_26.startPoint()) +SketchConstraintCoincidence_27 = Sketch_4.setCoincident( + SketchLine_27.endPoint(), SketchLine_26.startPoint() +) SketchLine_28 = Sketch_4.addLine(10.1, 44, 10.1, 45) SketchLine_28.setName("SketchLine_28") SketchLine_28.result().setName("SketchLine_28") -SketchConstraintCoincidence_28 = Sketch_4.setCoincident(SketchLine_26.endPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_28 = Sketch_4.setCoincident( + SketchLine_26.endPoint(), SketchLine_28.startPoint() +) SketchLine_29 = Sketch_4.addLine(10.1, 45, -10.1, 45) SketchLine_29.setName("SketchLine_29") SketchLine_29.result().setName("SketchLine_29") -SketchConstraintCoincidence_29 = Sketch_4.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_29 = Sketch_4.setCoincident( + SketchLine_28.endPoint(), SketchLine_29.startPoint() +) SketchLine_30 = Sketch_4.addLine(-10.1, 45, -10.1, 44) SketchLine_30.setName("SketchLine_30") SketchLine_30.result().setName("SketchLine_30") -SketchConstraintCoincidence_30 = Sketch_4.setCoincident(SketchLine_29.endPoint(), SketchLine_30.startPoint()) +SketchConstraintCoincidence_30 = Sketch_4.setCoincident( + SketchLine_29.endPoint(), SketchLine_30.startPoint() +) SketchLine_31 = Sketch_4.addLine(-10.1, 44, -4, 44) SketchLine_31.setName("SketchLine_31") SketchLine_31.result().setName("SketchLine_31") SketchLine_31.setAuxiliary(True) -SketchConstraintCoincidence_31 = Sketch_4.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_31 = Sketch_4.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) SketchLine_32 = Sketch_4.addLine(-4, 44, -4, 17.03672503740078) SketchLine_32.setName("SketchLine_20") SketchLine_32.result().setName("SketchLine_20") SketchLine_32.setAuxiliary(True) -SketchConstraintCoincidence_32 = Sketch_4.setCoincident(SketchLine_32.startPoint(), SketchLine_31.endPoint()) +SketchConstraintCoincidence_32 = Sketch_4.setCoincident( + SketchLine_32.startPoint(), SketchLine_31.endPoint() +) SketchConstraintVertical_5 = Sketch_4.setVertical(SketchLine_32.result()) SketchConstraintVertical_6 = Sketch_4.setVertical(SketchLine_27.result()) SketchConstraintHorizontal_3 = Sketch_4.setHorizontal(SketchLine_29.result()) @@ -206,11 +330,15 @@ SketchConstraintVertical_10 = Sketch_4.setVertical(SketchLine_22.result()) SketchLine_33 = Sketch_4.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_33.setName("SketchLine_32") SketchLine_33.result().setName("SketchLine_32") -SketchConstraintDistance_10 = Sketch_4.setDistance(SketchLine_22.startPoint(), SketchLine_32.result(), 4.5, False) +SketchConstraintDistance_10 = Sketch_4.setDistance( + SketchLine_22.startPoint(), SketchLine_32.result(), 4.5, False +) SketchLine_34 = Sketch_4.addLine(-8.5, 12, 8.5, 12) SketchLine_34.setName("SketchLine_33") SketchLine_34.result().setName("SketchLine_33") -SketchConstraintCoincidence_33 = Sketch_4.setCoincident(SketchLine_22.endPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_33 = Sketch_4.setCoincident( + SketchLine_22.endPoint(), SketchLine_34.startPoint() +) SketchConstraintHorizontal_6 = Sketch_4.setHorizontal(SketchLine_34.result()) SketchPoint_2 = Sketch_4.addPoint(model.selection("VERTEX", "PartSet/Origin")) SketchArc_5 = Sketch_4.addArc(0, 0, -8.5, 15.29705854, -4, 17.0367250374, True) @@ -218,37 +346,83 @@ SketchArc_5.setName("SketchArc_4") SketchArc_5.result().setName("SketchArc_4") SketchArc_5.results()[1].setName("SketchArc_4_2") SketchArc_5.setAuxiliary(True) -SketchConstraintCoincidence_34 = Sketch_4.setCoincident(SketchLine_22.startPoint(), SketchArc_5.startPoint()) +SketchConstraintCoincidence_34 = Sketch_4.setCoincident( + SketchLine_22.startPoint(), SketchArc_5.startPoint() +) SketchArc_6 = Sketch_4.addArc(0, 0, 4, 17.0367250374, 8.5, 15.29705854, True) SketchArc_6.setName("SketchArc_5") SketchArc_6.result().setName("SketchArc_5") SketchArc_6.results()[1].setName("SketchArc_5_2") SketchArc_6.setAuxiliary(True) -SketchConstraintCoincidence_35 = Sketch_4.setCoincident(SketchLine_25.endPoint(), SketchArc_6.endPoint()) +SketchConstraintCoincidence_35 = Sketch_4.setCoincident( + SketchLine_25.endPoint(), SketchArc_6.endPoint() +) SketchPoint_3 = Sketch_4.addPoint(-4, 17.03672503740078) SketchPoint_4 = Sketch_4.addPoint(4, 17.03672503740084) -SketchConstraintCoincidence_36 = Sketch_4.setCoincident(SketchArc_5.endPoint(), SketchPoint_3.coordinates()) -SketchConstraintCoincidence_37 = Sketch_4.setCoincident(SketchArc_6.startPoint(), SketchPoint_4.coordinates()) -SketchConstraintCoincidence_38 = Sketch_4.setCoincident(SketchArc_5.endPoint(), SketchLine_32.endPoint()) -SketchConstraintCoincidence_39 = Sketch_4.setCoincident(SketchPoint_4.coordinates(), SketchLine_27.startPoint()) -SketchArc_7 = Sketch_4.addArc(-10, 21.26617031813674, -7.446808510638298, 15.83650981137842, -4, 21.26617031813674, False) +SketchConstraintCoincidence_36 = Sketch_4.setCoincident( + SketchArc_5.endPoint(), SketchPoint_3.coordinates() +) +SketchConstraintCoincidence_37 = Sketch_4.setCoincident( + SketchArc_6.startPoint(), SketchPoint_4.coordinates() +) +SketchConstraintCoincidence_38 = Sketch_4.setCoincident( + SketchArc_5.endPoint(), SketchLine_32.endPoint() +) +SketchConstraintCoincidence_39 = Sketch_4.setCoincident( + SketchPoint_4.coordinates(), SketchLine_27.startPoint() +) +SketchArc_7 = Sketch_4.addArc( + -10, + 21.26617031813674, + -7.446808510638298, + 15.83650981137842, + -4, + 21.26617031813674, + False, +) SketchArc_7.setName("SketchArc_7") SketchArc_7.result().setName("SketchArc_7") SketchArc_7.results()[1].setName("SketchArc_7_2") -SketchConstraintCoincidence_40 = Sketch_4.setCoincident(SketchArc_7.startPoint(), SketchArc_3.endPoint()) +SketchConstraintCoincidence_40 = Sketch_4.setCoincident( + SketchArc_7.startPoint(), SketchArc_3.endPoint() +) SketchLine_35 = Sketch_4.addLine(-4, 44, -4, 21.26617031813674) SketchLine_35.setName("SketchLine_34") SketchLine_35.result().setName("SketchLine_34") SketchLine_35.setAuxiliary(True) -SketchConstraintCoincidence_41 = Sketch_4.setCoincident(SketchArc_7.endPoint(), SketchLine_35.endPoint()) -SketchConstraintTangent_5 = Sketch_4.setTangent(SketchArc_7.results()[1], SketchLine_35.result()) -SketchConstraintTangent_6 = Sketch_4.setTangent(SketchArc_7.results()[1], SketchArc_3.results()[1]) -SketchConstraintCoincidence_42 = Sketch_4.setCoincident(SketchLine_32.startPoint(), SketchLine_35.startPoint()) -SketchConstraintCoincidence_43 = Sketch_4.setCoincident(SketchArc_5.startPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_7 = Sketch_4.setTangent(SketchArc_5.results()[1], SketchArc_3.results()[1]) -SketchConstraintCoincidence_44 = Sketch_4.setCoincident(SketchLine_35.endPoint(), SketchLine_32.result()) -SketchConstraintCoincidence_45 = Sketch_4.setCoincident(SketchArc_3.endPoint(), SketchArc_5.results()[1]) -SketchArc_8 = Sketch_4.addArc(10, 21.26617031813674, 4, 21.26617031813674, 7.446808510638299, 15.83650981137842, False) +SketchConstraintCoincidence_41 = Sketch_4.setCoincident( + SketchArc_7.endPoint(), SketchLine_35.endPoint() +) +SketchConstraintTangent_5 = Sketch_4.setTangent( + SketchArc_7.results()[1], SketchLine_35.result() +) +SketchConstraintTangent_6 = Sketch_4.setTangent( + SketchArc_7.results()[1], SketchArc_3.results()[1] +) +SketchConstraintCoincidence_42 = Sketch_4.setCoincident( + SketchLine_32.startPoint(), SketchLine_35.startPoint() +) +SketchConstraintCoincidence_43 = Sketch_4.setCoincident( + SketchArc_5.startPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_7 = Sketch_4.setTangent( + SketchArc_5.results()[1], SketchArc_3.results()[1] +) +SketchConstraintCoincidence_44 = Sketch_4.setCoincident( + SketchLine_35.endPoint(), SketchLine_32.result() +) +SketchConstraintCoincidence_45 = Sketch_4.setCoincident( + SketchArc_3.endPoint(), SketchArc_5.results()[1] +) +SketchArc_8 = Sketch_4.addArc( + 10, + 21.26617031813674, + 4, + 21.26617031813674, + 7.446808510638299, + 15.83650981137842, + False, +) SketchArc_8.setName("SketchArc_9") SketchArc_8.result().setName("SketchArc_9") SketchArc_8.results()[1].setName("SketchArc_9_2") @@ -256,82 +430,200 @@ SketchLine_36 = Sketch_4.addLine(4, 21.26617031813674, 4, 44) SketchLine_36.setName("SketchLine_35") SketchLine_36.result().setName("SketchLine_35") SketchLine_36.setAuxiliary(True) -SketchConstraintCoincidence_46 = Sketch_4.setCoincident(SketchArc_8.startPoint(), SketchLine_36.startPoint()) -SketchConstraintCoincidence_47 = Sketch_4.setCoincident(SketchArc_8.endPoint(), SketchArc_4.startPoint()) -SketchConstraintTangent_8 = Sketch_4.setTangent(SketchArc_8.results()[1], SketchArc_4.results()[1]) -SketchConstraintTangent_9 = Sketch_4.setTangent(SketchArc_8.results()[1], SketchLine_36.result()) -SketchConstraintCoincidence_48 = Sketch_4.setCoincident(SketchArc_6.endPoint(), SketchArc_4.endPoint()) -SketchConstraintCoincidence_49 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchLine_36.endPoint()) -SketchConstraintTangent_10 = Sketch_4.setTangent(SketchArc_6.results()[1], SketchArc_4.results()[1]) -SketchConstraintCoincidence_50 = Sketch_4.setCoincident(SketchArc_4.startPoint(), SketchArc_6.results()[1]) -SketchConstraintCoincidence_51 = Sketch_4.setCoincident(SketchLine_36.startPoint(), SketchLine_27.result()) -SketchConstraintCoincidence_52 = Sketch_4.setCoincident(SketchLine_25.startPoint(), SketchLine_34.endPoint()) -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_54 = Sketch_4.setCoincident(SketchArc_4.endPoint(), SketchCircle_3.results()[1]) +SketchConstraintCoincidence_46 = Sketch_4.setCoincident( + SketchArc_8.startPoint(), SketchLine_36.startPoint() +) +SketchConstraintCoincidence_47 = Sketch_4.setCoincident( + SketchArc_8.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintTangent_8 = Sketch_4.setTangent( + SketchArc_8.results()[1], SketchArc_4.results()[1] +) +SketchConstraintTangent_9 = Sketch_4.setTangent( + SketchArc_8.results()[1], SketchLine_36.result() +) +SketchConstraintCoincidence_48 = Sketch_4.setCoincident( + SketchArc_6.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintCoincidence_49 = Sketch_4.setCoincident( + SketchLine_27.endPoint(), SketchLine_36.endPoint() +) +SketchConstraintTangent_10 = Sketch_4.setTangent( + SketchArc_6.results()[1], SketchArc_4.results()[1] +) +SketchConstraintCoincidence_50 = Sketch_4.setCoincident( + SketchArc_4.startPoint(), SketchArc_6.results()[1] +) +SketchConstraintCoincidence_51 = Sketch_4.setCoincident( + SketchLine_36.startPoint(), SketchLine_27.result() +) +SketchConstraintCoincidence_52 = Sketch_4.setCoincident( + SketchLine_25.startPoint(), SketchLine_34.endPoint() +) +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_54 = Sketch_4.setCoincident( + SketchArc_4.endPoint(), SketchCircle_3.results()[1] +) SketchConstraintRadius_5 = Sketch_4.setRadius(SketchArc_7.results()[1], 6) SketchConstraintRadius_6 = Sketch_4.setRadius(SketchArc_8.results()[1], 6) -SketchConstraintDistance_11 = Sketch_4.setDistance(SketchLine_25.endPoint(), SketchLine_36.result(), 4.5, False) -SketchConstraintDistance_12 = Sketch_4.setDistance(SketchArc_8.startPoint(), SketchLine_33.result(), 4, False) -SketchConstraintDistance_13 = Sketch_4.setDistance(SketchArc_7.endPoint(), SketchLine_33.result(), 4, False) +SketchConstraintDistance_11 = Sketch_4.setDistance( + SketchLine_25.endPoint(), SketchLine_36.result(), 4.5, False +) +SketchConstraintDistance_12 = Sketch_4.setDistance( + SketchArc_8.startPoint(), SketchLine_33.result(), 4, False +) +SketchConstraintDistance_13 = Sketch_4.setDistance( + SketchArc_7.endPoint(), SketchLine_33.result(), 4, False +) SketchArc_9 = Sketch_4.addArc(-10, 38, -4, 38, -10, 44, False) SketchArc_9.setName("SketchArc_10") SketchArc_9.result().setName("SketchArc_10") SketchArc_9.results()[1].setName("SketchArc_10_2") -SketchConstraintCoincidence_55 = Sketch_4.setCoincident(SketchArc_9.startPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_56 = Sketch_4.setCoincident(SketchArc_9.endPoint(), SketchLine_23.endPoint()) -SketchConstraintTangent_11 = Sketch_4.setTangent(SketchArc_9.results()[1], SketchLine_20.result()) -SketchConstraintTangent_12 = Sketch_4.setTangent(SketchArc_9.results()[1], SketchLine_23.result()) -SketchConstraintCoincidence_57 = Sketch_4.setCoincident(SketchLine_35.endPoint(), SketchLine_20.endPoint()) -SketchConstraintCoincidence_58 = Sketch_4.setCoincident(SketchLine_31.startPoint(), SketchLine_23.startPoint()) -SketchConstraintCoincidence_59 = Sketch_4.setCoincident(SketchLine_20.startPoint(), SketchLine_35.result()) -SketchConstraintCoincidence_60 = Sketch_4.setCoincident(SketchLine_23.endPoint(), SketchLine_31.result()) +SketchConstraintCoincidence_55 = Sketch_4.setCoincident( + SketchArc_9.startPoint(), SketchLine_20.startPoint() +) +SketchConstraintCoincidence_56 = Sketch_4.setCoincident( + SketchArc_9.endPoint(), SketchLine_23.endPoint() +) +SketchConstraintTangent_11 = Sketch_4.setTangent( + SketchArc_9.results()[1], SketchLine_20.result() +) +SketchConstraintTangent_12 = Sketch_4.setTangent( + SketchArc_9.results()[1], SketchLine_23.result() +) +SketchConstraintCoincidence_57 = Sketch_4.setCoincident( + SketchLine_35.endPoint(), SketchLine_20.endPoint() +) +SketchConstraintCoincidence_58 = Sketch_4.setCoincident( + SketchLine_31.startPoint(), SketchLine_23.startPoint() +) +SketchConstraintCoincidence_59 = Sketch_4.setCoincident( + SketchLine_20.startPoint(), SketchLine_35.result() +) +SketchConstraintCoincidence_60 = Sketch_4.setCoincident( + SketchLine_23.endPoint(), SketchLine_31.result() +) SketchArc_10 = Sketch_4.addArc(10, 38, 10, 44, 4, 38, False) SketchArc_10.setName("SketchArc_11") SketchArc_10.result().setName("SketchArc_11") SketchArc_10.results()[1].setName("SketchArc_11_2") -SketchConstraintCoincidence_61 = Sketch_4.setCoincident(SketchArc_10.startPoint(), SketchLine_24.startPoint()) -SketchConstraintCoincidence_62 = Sketch_4.setCoincident(SketchArc_10.endPoint(), SketchLine_21.endPoint()) -SketchConstraintTangent_13 = Sketch_4.setTangent(SketchArc_10.results()[1], SketchLine_21.result()) -SketchConstraintTangent_14 = Sketch_4.setTangent(SketchArc_10.results()[1], SketchLine_24.result()) -SketchConstraintCoincidence_63 = Sketch_4.setCoincident(SketchLine_36.startPoint(), SketchLine_21.startPoint()) -SketchConstraintCoincidence_64 = Sketch_4.setCoincident(SketchLine_26.endPoint(), SketchLine_24.endPoint()) -SketchConstraintCoincidence_65 = Sketch_4.setCoincident(SketchLine_21.endPoint(), SketchLine_36.result()) -SketchConstraintCoincidence_66 = Sketch_4.setCoincident(SketchLine_24.startPoint(), SketchLine_26.result()) +SketchConstraintCoincidence_61 = Sketch_4.setCoincident( + SketchArc_10.startPoint(), SketchLine_24.startPoint() +) +SketchConstraintCoincidence_62 = Sketch_4.setCoincident( + SketchArc_10.endPoint(), SketchLine_21.endPoint() +) +SketchConstraintTangent_13 = Sketch_4.setTangent( + SketchArc_10.results()[1], SketchLine_21.result() +) +SketchConstraintTangent_14 = Sketch_4.setTangent( + SketchArc_10.results()[1], SketchLine_24.result() +) +SketchConstraintCoincidence_63 = Sketch_4.setCoincident( + SketchLine_36.startPoint(), SketchLine_21.startPoint() +) +SketchConstraintCoincidence_64 = Sketch_4.setCoincident( + SketchLine_26.endPoint(), SketchLine_24.endPoint() +) +SketchConstraintCoincidence_65 = Sketch_4.setCoincident( + SketchLine_21.endPoint(), SketchLine_36.result() +) +SketchConstraintCoincidence_66 = Sketch_4.setCoincident( + SketchLine_24.startPoint(), SketchLine_26.result() +) SketchConstraintRadius_7 = Sketch_4.setRadius(SketchArc_9.results()[1], 6) SketchConstraintRadius_8 = Sketch_4.setRadius(SketchArc_10.results()[1], 6) -SketchConstraintDistance_14 = Sketch_4.setDistance(SketchLine_23.startPoint(), SketchLine_29.result(), 1, False) -SketchConstraintDistance_15 = Sketch_4.setDistance(SketchLine_24.endPoint(), SketchLine_29.result(), 1, False) +SketchConstraintDistance_14 = Sketch_4.setDistance( + SketchLine_23.startPoint(), SketchLine_29.result(), 1, False +) +SketchConstraintDistance_15 = Sketch_4.setDistance( + SketchLine_24.endPoint(), SketchLine_29.result(), 1, False +) SketchLine_37 = Sketch_4.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_37.setName("SketchLine_40") SketchLine_37.result().setName("SketchLine_40") -SketchConstraintDistance_16 = Sketch_4.setDistance(SketchArc_10.startPoint(), SketchLine_37.result(), 44, False) -SketchConstraintDistance_17 = Sketch_4.setDistance(SketchLine_21.result(), SketchLine_24.endPoint(), 6.1, False) -SketchConstraintDistance_18 = Sketch_4.setDistance(SketchLine_30.endPoint(), SketchLine_20.result(), 6.1, False) -SketchConstraintCoincidence_67 = Sketch_4.setCoincident(SketchArc_3.center(), SketchCircle_3.center()) -SketchConstraintCoincidence_68 = Sketch_4.setCoincident(SketchArc_4.center(), SketchArc_3.center()) -SketchConstraintDistance_19 = Sketch_4.setDistance(SketchArc_4.center(), SketchLine_34.result(), 12, False) +SketchConstraintDistance_16 = Sketch_4.setDistance( + SketchArc_10.startPoint(), SketchLine_37.result(), 44, False +) +SketchConstraintDistance_17 = Sketch_4.setDistance( + SketchLine_21.result(), SketchLine_24.endPoint(), 6.1, False +) +SketchConstraintDistance_18 = Sketch_4.setDistance( + SketchLine_30.endPoint(), SketchLine_20.result(), 6.1, False +) +SketchConstraintCoincidence_67 = Sketch_4.setCoincident( + SketchArc_3.center(), SketchCircle_3.center() +) +SketchConstraintCoincidence_68 = Sketch_4.setCoincident( + SketchArc_4.center(), SketchArc_3.center() +) +SketchConstraintDistance_19 = Sketch_4.setDistance( + SketchArc_4.center(), SketchLine_34.result(), 12, False +) model.do() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), 50, 30) -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 22, 22) -Common_2 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1")], [model.selection("SOLID", "Extrusion_4_1")]) -Extrusion_5 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 22, 22) -Extrusion_6 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 75, 40) -Common_3 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_6_1")], [model.selection("SOLID", "Extrusion_5_1")]) +Extrusion_3 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), 50, 30 +) +Extrusion_4 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 22, 22 +) +Common_2 = model.addCommon( + Part_1_doc, + [model.selection("SOLID", "Extrusion_3_1")], + [model.selection("SOLID", "Extrusion_4_1")], +) +Extrusion_5 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 22, 22 +) +Extrusion_6 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], + model.selection(), + 75, + 40, +) +Common_3 = model.addCommon( + Part_1_doc, + [model.selection("SOLID", "Extrusion_6_1")], + [model.selection("SOLID", "Extrusion_5_1")], +) Sketch_5 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchLine_38 = Sketch_5.addLine(44, 3.464101615137764, 16.5, 51.0954988232819) SketchLine_38.setName("SketchLine_41") SketchLine_38.result().setName("SketchLine_41") -SketchPoint_5 = Sketch_5.addPoint(model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex")) -SketchConstraintCoincidence_69 = Sketch_5.setCoincident(SketchLine_38.startPoint(), SketchPoint_5.result()) +SketchPoint_5 = Sketch_5.addPoint( + model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex") +) +SketchConstraintCoincidence_69 = Sketch_5.setCoincident( + SketchLine_38.startPoint(), SketchPoint_5.result() +) 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()) +SketchConstraintPerpendicular_2 = Sketch_5.setPerpendicular( + SketchLine_38.result(), SketchLine_39.result() +) SketchConstraintLength_1 = Sketch_5.setLength(SketchLine_38.result(), 55) model.do() -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) +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(4, 13, 4, 12.9) SketchLine_40.setName("SketchLine_55") @@ -343,7 +635,9 @@ SketchLine_42 = Sketch_6.addLine(4, 19, 4, 12.9) SketchLine_42.setName("SketchLine_43") SketchLine_42.result().setName("SketchLine_43") SketchLine_42.setAuxiliary(True) -SketchConstraintCoincidence_70 = Sketch_6.setCoincident(SketchLine_42.endPoint(), SketchLine_41.startPoint()) +SketchConstraintCoincidence_70 = Sketch_6.setCoincident( + SketchLine_42.endPoint(), SketchLine_41.startPoint() +) SketchLine_43 = Sketch_6.addLine(-4, 12.9, -4, 13) SketchLine_43.setName("SketchLine_52") SketchLine_43.result().setName("SketchLine_52") @@ -354,7 +648,9 @@ SketchLine_45 = Sketch_6.addLine(-4, 12.9, -4, 19) SketchLine_45.setName("SketchLine_45") SketchLine_45.result().setName("SketchLine_45") SketchLine_45.setAuxiliary(True) -SketchConstraintCoincidence_71 = Sketch_6.setCoincident(SketchLine_41.endPoint(), SketchLine_45.startPoint()) +SketchConstraintCoincidence_71 = Sketch_6.setCoincident( + SketchLine_41.endPoint(), SketchLine_45.startPoint() +) SketchLine_46 = Sketch_6.addLine(10.1, 19, 10, 19) SketchLine_46.setName("SketchLine_54") SketchLine_46.result().setName("SketchLine_54") @@ -362,25 +658,37 @@ SketchLine_47 = Sketch_6.addLine(-4, 19, -10.1, 19) SketchLine_47.setName("SketchLine_46") SketchLine_47.result().setName("SketchLine_46") SketchLine_47.setAuxiliary(True) -SketchConstraintCoincidence_72 = Sketch_6.setCoincident(SketchLine_45.endPoint(), SketchLine_47.startPoint()) +SketchConstraintCoincidence_72 = Sketch_6.setCoincident( + SketchLine_45.endPoint(), SketchLine_47.startPoint() +) SketchLine_48 = Sketch_6.addLine(-10.1, 19, -10.1, 19.8) SketchLine_48.setName("SketchLine_47") SketchLine_48.result().setName("SketchLine_47") -SketchConstraintCoincidence_73 = Sketch_6.setCoincident(SketchLine_47.endPoint(), SketchLine_48.startPoint()) +SketchConstraintCoincidence_73 = Sketch_6.setCoincident( + SketchLine_47.endPoint(), SketchLine_48.startPoint() +) SketchLine_49 = Sketch_6.addLine(-10.1, 19.8, 10.1, 19.8) SketchLine_49.setName("SketchLine_48") SketchLine_49.result().setName("SketchLine_48") -SketchConstraintCoincidence_74 = Sketch_6.setCoincident(SketchLine_48.endPoint(), SketchLine_49.startPoint()) +SketchConstraintCoincidence_74 = Sketch_6.setCoincident( + SketchLine_48.endPoint(), SketchLine_49.startPoint() +) SketchLine_50 = Sketch_6.addLine(10.1, 19.8, 10.1, 19) SketchLine_50.setName("SketchLine_49") SketchLine_50.result().setName("SketchLine_49") -SketchConstraintCoincidence_75 = Sketch_6.setCoincident(SketchLine_49.endPoint(), SketchLine_50.startPoint()) +SketchConstraintCoincidence_75 = Sketch_6.setCoincident( + SketchLine_49.endPoint(), SketchLine_50.startPoint() +) SketchLine_51 = Sketch_6.addLine(10.1, 19, 4, 19) SketchLine_51.setName("SketchLine_50") SketchLine_51.result().setName("SketchLine_50") SketchLine_51.setAuxiliary(True) -SketchConstraintCoincidence_76 = Sketch_6.setCoincident(SketchLine_50.endPoint(), SketchLine_51.startPoint()) -SketchConstraintCoincidence_77 = Sketch_6.setCoincident(SketchLine_42.startPoint(), SketchLine_51.endPoint()) +SketchConstraintCoincidence_76 = Sketch_6.setCoincident( + SketchLine_50.endPoint(), SketchLine_51.startPoint() +) +SketchConstraintCoincidence_77 = Sketch_6.setCoincident( + SketchLine_42.startPoint(), SketchLine_51.endPoint() +) SketchConstraintVertical_11 = Sketch_6.setVertical(SketchLine_45.result()) SketchConstraintVertical_12 = Sketch_6.setVertical(SketchLine_42.result()) SketchConstraintHorizontal_7 = Sketch_6.setHorizontal(SketchLine_41.result()) @@ -388,65 +696,164 @@ SketchConstraintHorizontal_8 = Sketch_6.setHorizontal(SketchLine_47.result()) SketchConstraintHorizontal_9 = Sketch_6.setHorizontal(SketchLine_51.result()) SketchConstraintHorizontal_10 = Sketch_6.setHorizontal(SketchLine_49.result()) SketchConstraintVertical_13 = Sketch_6.setVertical(SketchLine_50.result()) -SketchConstraintDistance_20 = Sketch_6.setDistance(SketchLine_48.startPoint(), SketchLine_49.result(), 0.8, False) -SketchConstraintDistance_21 = Sketch_6.setDistance(SketchLine_51.startPoint(), SketchLine_49.result(), 0.8, False) +SketchConstraintDistance_20 = Sketch_6.setDistance( + SketchLine_48.startPoint(), SketchLine_49.result(), 0.8, False +) +SketchConstraintDistance_21 = Sketch_6.setDistance( + SketchLine_51.startPoint(), SketchLine_49.result(), 0.8, False +) 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) -SketchConstraintDistance_23 = Sketch_6.setDistance(SketchLine_42.endPoint(), SketchLine_52.result(), 4, False) +SketchConstraintDistance_22 = Sketch_6.setDistance( + SketchLine_45.startPoint(), SketchLine_52.result(), 4, False +) +SketchConstraintDistance_23 = Sketch_6.setDistance( + SketchLine_42.endPoint(), SketchLine_52.result(), 4, False +) SketchArc_11 = Sketch_6.addArc(-10, 13, -4, 13, -10, 19, False) SketchArc_11.setName("SketchArc_12") SketchArc_11.result().setName("SketchArc_12") SketchArc_11.results()[1].setName("SketchArc_12_2") -SketchConstraintCoincidence_78 = Sketch_6.setCoincident(SketchArc_11.startPoint(), SketchLine_43.endPoint()) -SketchConstraintCoincidence_79 = Sketch_6.setCoincident(SketchArc_11.endPoint(), SketchLine_44.startPoint()) -SketchConstraintTangent_15 = Sketch_6.setTangent(SketchArc_11.results()[1], SketchLine_43.result()) -SketchConstraintTangent_16 = Sketch_6.setTangent(SketchArc_11.results()[1], SketchLine_44.result()) -SketchConstraintCoincidence_80 = Sketch_6.setCoincident(SketchLine_45.startPoint(), SketchLine_43.startPoint()) -SketchConstraintCoincidence_81 = Sketch_6.setCoincident(SketchLine_47.endPoint(), SketchLine_44.endPoint()) -SketchConstraintCoincidence_82 = Sketch_6.setCoincident(SketchLine_43.endPoint(), SketchLine_45.result()) -SketchConstraintCoincidence_83 = Sketch_6.setCoincident(SketchLine_44.startPoint(), SketchLine_47.result()) +SketchConstraintCoincidence_78 = Sketch_6.setCoincident( + SketchArc_11.startPoint(), SketchLine_43.endPoint() +) +SketchConstraintCoincidence_79 = Sketch_6.setCoincident( + SketchArc_11.endPoint(), SketchLine_44.startPoint() +) +SketchConstraintTangent_15 = Sketch_6.setTangent( + SketchArc_11.results()[1], SketchLine_43.result() +) +SketchConstraintTangent_16 = Sketch_6.setTangent( + SketchArc_11.results()[1], SketchLine_44.result() +) +SketchConstraintCoincidence_80 = Sketch_6.setCoincident( + SketchLine_45.startPoint(), SketchLine_43.startPoint() +) +SketchConstraintCoincidence_81 = Sketch_6.setCoincident( + SketchLine_47.endPoint(), SketchLine_44.endPoint() +) +SketchConstraintCoincidence_82 = Sketch_6.setCoincident( + SketchLine_43.endPoint(), SketchLine_45.result() +) +SketchConstraintCoincidence_83 = Sketch_6.setCoincident( + SketchLine_44.startPoint(), SketchLine_47.result() +) SketchArc_12 = Sketch_6.addArc(10, 13, 10, 19, 4, 13, False) SketchArc_12.setName("SketchArc_13") SketchArc_12.result().setName("SketchArc_13") SketchArc_12.results()[1].setName("SketchArc_13_2") -SketchConstraintCoincidence_84 = Sketch_6.setCoincident(SketchArc_12.startPoint(), SketchLine_46.endPoint()) -SketchConstraintCoincidence_85 = Sketch_6.setCoincident(SketchArc_12.endPoint(), SketchLine_40.startPoint()) -SketchConstraintTangent_17 = Sketch_6.setTangent(SketchArc_12.results()[1], SketchLine_46.result()) -SketchConstraintTangent_18 = Sketch_6.setTangent(SketchArc_12.results()[1], SketchLine_40.result()) -SketchConstraintCoincidence_86 = Sketch_6.setCoincident(SketchLine_51.startPoint(), SketchLine_46.startPoint()) -SketchConstraintCoincidence_87 = Sketch_6.setCoincident(SketchLine_42.endPoint(), SketchLine_40.endPoint()) -SketchConstraintCoincidence_88 = Sketch_6.setCoincident(SketchLine_46.endPoint(), SketchLine_51.result()) -SketchConstraintCoincidence_89 = Sketch_6.setCoincident(SketchLine_40.startPoint(), SketchLine_42.result()) +SketchConstraintCoincidence_84 = Sketch_6.setCoincident( + SketchArc_12.startPoint(), SketchLine_46.endPoint() +) +SketchConstraintCoincidence_85 = Sketch_6.setCoincident( + SketchArc_12.endPoint(), SketchLine_40.startPoint() +) +SketchConstraintTangent_17 = Sketch_6.setTangent( + SketchArc_12.results()[1], SketchLine_46.result() +) +SketchConstraintTangent_18 = Sketch_6.setTangent( + SketchArc_12.results()[1], SketchLine_40.result() +) +SketchConstraintCoincidence_86 = Sketch_6.setCoincident( + SketchLine_51.startPoint(), SketchLine_46.startPoint() +) +SketchConstraintCoincidence_87 = Sketch_6.setCoincident( + SketchLine_42.endPoint(), SketchLine_40.endPoint() +) +SketchConstraintCoincidence_88 = Sketch_6.setCoincident( + SketchLine_46.endPoint(), SketchLine_51.result() +) +SketchConstraintCoincidence_89 = Sketch_6.setCoincident( + SketchLine_40.startPoint(), SketchLine_42.result() +) SketchConstraintRadius_9 = Sketch_6.setRadius(SketchArc_11.results()[1], 6) SketchConstraintRadius_10 = Sketch_6.setRadius(SketchArc_12.results()[1], 6) -SketchConstraintDistance_24 = Sketch_6.setDistance(SketchLine_40.result(), SketchLine_46.startPoint(), 6.1, False) -SketchConstraintDistance_25 = Sketch_6.setDistance(SketchLine_48.startPoint(), SketchLine_43.result(), 6.1, False) +SketchConstraintDistance_24 = Sketch_6.setDistance( + SketchLine_40.result(), SketchLine_46.startPoint(), 6.1, False +) +SketchConstraintDistance_25 = Sketch_6.setDistance( + SketchLine_48.startPoint(), SketchLine_43.result(), 6.1, False +) SketchConstraintVertical_14 = Sketch_6.setVertical(SketchLine_48.result()) -SketchConstraintDistance_26 = Sketch_6.setDistance(SketchLine_41.result(), SketchArc_12.startPoint(), 6.1, False) +SketchConstraintDistance_26 = Sketch_6.setDistance( + SketchLine_41.result(), SketchArc_12.startPoint(), 6.1, False +) SketchLine_53 = Sketch_6.addLine(model.selection("EDGE", "Axis_1")) SketchLine_53.setName("SketchLine_56") SketchLine_53.result().setName("SketchLine_56") -SketchConstraintCoincidence_90 = Sketch_6.setCoincident(SketchArc_12.startPoint(), SketchLine_53.result()) +SketchConstraintCoincidence_90 = Sketch_6.setCoincident( + SketchArc_12.startPoint(), SketchLine_53.result() +) model.do() -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/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")) +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/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&Sketch_1/SketchArc_2_2][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_10][Extrusion_8_1/To_Face]")) +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()) -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_91 = Sketch_7.setCoincident( + SketchLine_55.startPoint(), SketchPoint_6.result() +) +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() +) SketchLine_56 = Sketch_7.addLine(45, -70, -45, -70) SketchLine_56.setName("SketchLine_67") SketchLine_56.result().setName("SketchLine_67") @@ -454,9 +861,18 @@ SketchLine_57 = Sketch_7.addLine(55, -70, -55, -70) SketchLine_57.setName("SketchLine_58") SketchLine_57.result().setName("SketchLine_58") SketchLine_57.setAuxiliary(True) -SketchConstraintCoincidence_93 = Sketch_7.setCoincident(SketchLine_55.endPoint(), SketchLine_57.startPoint()) -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_93 = Sketch_7.setCoincident( + SketchLine_55.endPoint(), SketchLine_57.startPoint() +) +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() +) SketchLine_58 = Sketch_7.addLine(-55, -60, -55, -9.237604307034024) SketchLine_58.setName("SketchLine_68") SketchLine_58.result().setName("SketchLine_68") @@ -464,31 +880,54 @@ SketchLine_59 = Sketch_7.addLine(-55, -70, -55, -9.237604307034024) SketchLine_59.setName("SketchLine_59") SketchLine_59.result().setName("SketchLine_59") SketchLine_59.setAuxiliary(True) -SketchConstraintCoincidence_95 = Sketch_7.setCoincident(SketchLine_57.endPoint(), SketchLine_59.startPoint()) -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_95 = Sketch_7.setCoincident( + SketchLine_57.endPoint(), SketchLine_59.startPoint() +) +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() +) SketchLine_60 = Sketch_7.addLine(-55, -9.237604307034024, -60, -9.237604307034024) SketchLine_60.setName("SketchLine_60") SketchLine_60.result().setName("SketchLine_60") -SketchConstraintCoincidence_97 = Sketch_7.setCoincident(SketchLine_59.endPoint(), SketchLine_60.startPoint()) +SketchConstraintCoincidence_97 = Sketch_7.setCoincident( + SketchLine_59.endPoint(), SketchLine_60.startPoint() +) SketchLine_61 = Sketch_7.addLine(-60, -9.237604307034024, -60, -79.23760430703402) SketchLine_61.setName("SketchLine_61") SketchLine_61.result().setName("SketchLine_61") -SketchConstraintCoincidence_98 = Sketch_7.setCoincident(SketchLine_60.endPoint(), SketchLine_61.startPoint()) +SketchConstraintCoincidence_98 = Sketch_7.setCoincident( + SketchLine_60.endPoint(), SketchLine_61.startPoint() +) SketchLine_62 = Sketch_7.addLine(-60, -79.23760430703402, 60, -79.23760430703402) SketchLine_62.setName("SketchLine_62") SketchLine_62.result().setName("SketchLine_62") -SketchConstraintCoincidence_99 = Sketch_7.setCoincident(SketchLine_61.endPoint(), SketchLine_62.startPoint()) +SketchConstraintCoincidence_99 = Sketch_7.setCoincident( + SketchLine_61.endPoint(), SketchLine_62.startPoint() +) SketchLine_63 = Sketch_7.addLine(60, -79.23760430703402, 60, -9.237604307034024) SketchLine_63.setName("SketchLine_63") SketchLine_63.result().setName("SketchLine_63") -SketchConstraintCoincidence_100 = Sketch_7.setCoincident(SketchLine_62.endPoint(), SketchLine_63.startPoint()) +SketchConstraintCoincidence_100 = Sketch_7.setCoincident( + SketchLine_62.endPoint(), SketchLine_63.startPoint() +) SketchLine_64 = Sketch_7.addLine(60, -9.237604307034024, 55, -9.237604307034024) SketchLine_64.setName("SketchLine_64") SketchLine_64.result().setName("SketchLine_64") -SketchConstraintCoincidence_101 = Sketch_7.setCoincident(SketchLine_63.endPoint(), SketchLine_64.startPoint()) -SketchConstraintCoincidence_102 = Sketch_7.setCoincident(SketchLine_55.startPoint(), SketchLine_64.endPoint()) -SketchConstraintCoincidence_103 = Sketch_7.setCoincident(SketchPoint_6.coordinates(), SketchLine_64.endPoint()) +SketchConstraintCoincidence_101 = Sketch_7.setCoincident( + SketchLine_63.endPoint(), SketchLine_64.startPoint() +) +SketchConstraintCoincidence_102 = Sketch_7.setCoincident( + SketchLine_55.startPoint(), SketchLine_64.endPoint() +) +SketchConstraintCoincidence_103 = Sketch_7.setCoincident( + SketchPoint_6.coordinates(), SketchLine_64.endPoint() +) SketchConstraintHorizontal_11 = Sketch_7.setHorizontal(SketchLine_64.result()) SketchConstraintHorizontal_12 = Sketch_7.setHorizontal(SketchLine_60.result()) SketchConstraintHorizontal_13 = Sketch_7.setHorizontal(SketchLine_62.result()) @@ -502,65 +941,153 @@ SketchLine_65 = Sketch_7.addLine(45, -70, -55, -70) SketchLine_65.setName("SketchLine_65") SketchLine_65.result().setName("SketchLine_65") SketchLine_65.setAuxiliary(True) -SketchConstraintCoincidence_104 = Sketch_7.setCoincident(SketchArc_13.startPoint(), SketchLine_65.startPoint()) -SketchConstraintCoincidence_105 = Sketch_7.setCoincident(SketchArc_13.endPoint(), SketchLine_54.endPoint()) -SketchConstraintTangent_19 = Sketch_7.setTangent(SketchArc_13.results()[1], SketchLine_65.result()) -SketchConstraintTangent_20 = Sketch_7.setTangent(SketchArc_13.results()[1], SketchLine_54.result()) -SketchConstraintCoincidence_106 = Sketch_7.setCoincident(SketchLine_57.endPoint(), SketchLine_65.endPoint()) -SketchConstraintCoincidence_107 = Sketch_7.setCoincident(SketchLine_55.startPoint(), SketchLine_54.startPoint()) -SketchConstraintCoincidence_108 = Sketch_7.setCoincident(SketchLine_65.startPoint(), SketchLine_57.result()) -SketchConstraintCoincidence_109 = Sketch_7.setCoincident(SketchLine_54.endPoint(), SketchLine_55.result()) +SketchConstraintCoincidence_104 = Sketch_7.setCoincident( + SketchArc_13.startPoint(), SketchLine_65.startPoint() +) +SketchConstraintCoincidence_105 = Sketch_7.setCoincident( + SketchArc_13.endPoint(), SketchLine_54.endPoint() +) +SketchConstraintTangent_19 = Sketch_7.setTangent( + SketchArc_13.results()[1], SketchLine_65.result() +) +SketchConstraintTangent_20 = Sketch_7.setTangent( + SketchArc_13.results()[1], SketchLine_54.result() +) +SketchConstraintCoincidence_106 = Sketch_7.setCoincident( + SketchLine_57.endPoint(), SketchLine_65.endPoint() +) +SketchConstraintCoincidence_107 = Sketch_7.setCoincident( + SketchLine_55.startPoint(), SketchLine_54.startPoint() +) +SketchConstraintCoincidence_108 = Sketch_7.setCoincident( + SketchLine_65.startPoint(), SketchLine_57.result() +) +SketchConstraintCoincidence_109 = Sketch_7.setCoincident( + SketchLine_54.endPoint(), SketchLine_55.result() +) SketchArc_14 = Sketch_7.addArc(-45, -60, -55, -60, -45, -70, False) SketchArc_14.setName("SketchArc_15") SketchArc_14.result().setName("SketchArc_15") SketchArc_14.results()[1].setName("SketchArc_15_2") -SketchConstraintCoincidence_110 = Sketch_7.setCoincident(SketchArc_14.startPoint(), SketchLine_58.startPoint()) -SketchConstraintCoincidence_111 = Sketch_7.setCoincident(SketchArc_14.endPoint(), SketchLine_56.endPoint()) -SketchConstraintTangent_21 = Sketch_7.setTangent(SketchArc_14.results()[1], SketchLine_56.result()) -SketchConstraintTangent_22 = Sketch_7.setTangent(SketchArc_14.results()[1], SketchLine_58.result()) -SketchConstraintCoincidence_112 = Sketch_7.setCoincident(SketchLine_65.startPoint(), SketchLine_56.startPoint()) -SketchConstraintCoincidence_113 = Sketch_7.setCoincident(SketchLine_59.endPoint(), SketchLine_58.endPoint()) -SketchConstraintCoincidence_114 = Sketch_7.setCoincident(SketchLine_56.endPoint(), SketchLine_65.result()) -SketchConstraintCoincidence_115 = Sketch_7.setCoincident(SketchLine_58.startPoint(), SketchLine_59.result()) +SketchConstraintCoincidence_110 = Sketch_7.setCoincident( + SketchArc_14.startPoint(), SketchLine_58.startPoint() +) +SketchConstraintCoincidence_111 = Sketch_7.setCoincident( + SketchArc_14.endPoint(), SketchLine_56.endPoint() +) +SketchConstraintTangent_21 = Sketch_7.setTangent( + SketchArc_14.results()[1], SketchLine_56.result() +) +SketchConstraintTangent_22 = Sketch_7.setTangent( + SketchArc_14.results()[1], SketchLine_58.result() +) +SketchConstraintCoincidence_112 = Sketch_7.setCoincident( + SketchLine_65.startPoint(), SketchLine_56.startPoint() +) +SketchConstraintCoincidence_113 = Sketch_7.setCoincident( + SketchLine_59.endPoint(), SketchLine_58.endPoint() +) +SketchConstraintCoincidence_114 = Sketch_7.setCoincident( + SketchLine_56.endPoint(), SketchLine_65.result() +) +SketchConstraintCoincidence_115 = Sketch_7.setCoincident( + SketchLine_58.startPoint(), SketchLine_59.result() +) SketchConstraintRadius_11 = Sketch_7.setRadius(SketchArc_13.results()[1], 10) SketchConstraintRadius_12 = Sketch_7.setRadius(SketchArc_14.results()[1], 10) SketchCircle_4 = Sketch_7.addCircle(44, -59, 5) SketchCircle_5 = Sketch_7.addCircle(-44, -59, 5) SketchConstraintRadius_13 = Sketch_7.setRadius(SketchCircle_4.results()[1], 5) SketchConstraintRadius_14 = Sketch_7.setRadius(SketchCircle_5.results()[1], 5) -SketchConstraintDistance_27 = Sketch_7.setDistance(SketchCircle_4.center(), SketchLine_56.result(), 11, False) -SketchConstraintDistance_28 = Sketch_7.setDistance(SketchCircle_4.center(), SketchLine_54.result(), 11, False) -SketchConstraintDistance_29 = Sketch_7.setDistance(SketchCircle_5.center(), SketchLine_56.result(), 11, False) -SketchConstraintDistance_30 = Sketch_7.setDistance(SketchCircle_5.center(), SketchLine_58.result(), 11, False) +SketchConstraintDistance_27 = Sketch_7.setDistance( + SketchCircle_4.center(), SketchLine_56.result(), 11, False +) +SketchConstraintDistance_28 = Sketch_7.setDistance( + SketchCircle_4.center(), SketchLine_54.result(), 11, False +) +SketchConstraintDistance_29 = Sketch_7.setDistance( + SketchCircle_5.center(), SketchLine_56.result(), 11, False +) +SketchConstraintDistance_30 = Sketch_7.setDistance( + SketchCircle_5.center(), SketchLine_58.result(), 11, False +) SketchCircle_6 = Sketch_7.addCircle(44, -20.23760430703402, 5) SketchConstraintRadius_15 = Sketch_7.setRadius(SketchCircle_6.results()[1], 5) 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) -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]")) +SketchConstraintDistance_31 = Sketch_7.setDistance( + SketchCircle_6.center(), SketchLine_54.result(), 11, False +) +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) -SketchConstraintDistance_33 = Sketch_7.setDistance(SketchCircle_7.center(), SketchLine_58.result(), 11, False) -SketchConstraintDistance_34 = Sketch_7.setDistance(SketchCircle_7.center(), SketchLine_66.result(), 11, False) +SketchConstraintDistance_32 = Sketch_7.setDistance( + SketchCircle_6.center(), SketchLine_66.result(), 11, False +) +SketchConstraintDistance_33 = Sketch_7.setDistance( + SketchCircle_7.center(), SketchLine_58.result(), 11, False +) +SketchConstraintDistance_34 = Sketch_7.setDistance( + SketchCircle_7.center(), SketchLine_66.result(), 11, False +) SketchConstraintLength_2 = Sketch_7.setLength(SketchLine_62.result(), 120) SketchConstraintLength_3 = Sketch_7.setLength(SketchLine_61.result(), 70) -SketchConstraintDistanceHorizontal_1 = Sketch_7.setHorizontalDistance(SketchPoint_7.coordinates(), SketchLine_62.endPoint(), 5) +SketchConstraintDistanceHorizontal_1 = Sketch_7.setHorizontalDistance( + SketchPoint_7.coordinates(), SketchLine_62.endPoint(), 5 +) model.do() -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&Sketch_1/SketchLine_11")) +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&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/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)]")) +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()) -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_116 = Sketch_8.setCoincident( + SketchLine_68.startPoint(), SketchPoint_10.result() +) +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() +) SketchLine_69 = Sketch_8.addLine(45, 76.69872981077805, -45, 76.69872981077805) SketchLine_69.setName("SketchLine_80") SketchLine_69.result().setName("SketchLine_80") @@ -568,9 +1095,18 @@ SketchLine_70 = Sketch_8.addLine(55, 76.69872981077803, -55, 76.69872981077803) SketchLine_70.setName("SketchLine_71") SketchLine_70.result().setName("SketchLine_71") SketchLine_70.setAuxiliary(True) -SketchConstraintCoincidence_118 = Sketch_8.setCoincident(SketchLine_68.endPoint(), SketchLine_70.startPoint()) -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_118 = Sketch_8.setCoincident( + SketchLine_68.endPoint(), SketchLine_70.startPoint() +) +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() +) SketchLine_71 = Sketch_8.addLine(-55, 66.69872976783566, -55, -34.06366588218793) SketchLine_71.setName("SketchLine_81") SketchLine_71.result().setName("SketchLine_81") @@ -578,109 +1114,232 @@ SketchLine_72 = Sketch_8.addLine(-55, 76.69872981077803, -55, -34.06366588218793 SketchLine_72.setName("SketchLine_72") SketchLine_72.result().setName("SketchLine_72") SketchLine_72.setAuxiliary(True) -SketchConstraintCoincidence_120 = Sketch_8.setCoincident(SketchLine_70.endPoint(), SketchLine_72.startPoint()) -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()) -SketchLine_73 = Sketch_8.addLine(-55, -34.06366588218793, -83.25521566485324, -34.06366588218793) +SketchConstraintCoincidence_120 = Sketch_8.setCoincident( + SketchLine_70.endPoint(), SketchLine_72.startPoint() +) +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() +) +SketchLine_73 = Sketch_8.addLine( + -55, -34.06366588218793, -83.25521566485324, -34.06366588218793 +) SketchLine_73.setName("SketchLine_73") SketchLine_73.result().setName("SketchLine_73") -SketchConstraintCoincidence_122 = Sketch_8.setCoincident(SketchLine_72.endPoint(), SketchLine_73.startPoint()) -SketchLine_74 = Sketch_8.addLine(-83.25521566485324, -34.06366588218793, -83.25521566485298, 92.00148393088952) +SketchConstraintCoincidence_122 = Sketch_8.setCoincident( + SketchLine_72.endPoint(), SketchLine_73.startPoint() +) +SketchLine_74 = Sketch_8.addLine( + -83.25521566485324, -34.06366588218793, -83.25521566485298, 92.00148393088952 +) SketchLine_74.setName("SketchLine_74") SketchLine_74.result().setName("SketchLine_74") -SketchConstraintCoincidence_123 = Sketch_8.setCoincident(SketchLine_73.endPoint(), SketchLine_74.startPoint()) -SketchLine_75 = Sketch_8.addLine(-83.25521566485298, 92.00148393088952, 87.50975635635101, 92.00148393088952) +SketchConstraintCoincidence_123 = Sketch_8.setCoincident( + SketchLine_73.endPoint(), SketchLine_74.startPoint() +) +SketchLine_75 = Sketch_8.addLine( + -83.25521566485298, 92.00148393088952, 87.50975635635101, 92.00148393088952 +) SketchLine_75.setName("SketchLine_75") SketchLine_75.result().setName("SketchLine_75") -SketchConstraintCoincidence_124 = Sketch_8.setCoincident(SketchLine_74.endPoint(), SketchLine_75.startPoint()) -SketchLine_76 = Sketch_8.addLine(87.50975635635101, 92.00148393088952, 87.50975635635101, -34.06366588218793) +SketchConstraintCoincidence_124 = Sketch_8.setCoincident( + SketchLine_74.endPoint(), SketchLine_75.startPoint() +) +SketchLine_76 = Sketch_8.addLine( + 87.50975635635101, 92.00148393088952, 87.50975635635101, -34.06366588218793 +) SketchLine_76.setName("SketchLine_76") SketchLine_76.result().setName("SketchLine_76") -SketchConstraintCoincidence_125 = Sketch_8.setCoincident(SketchLine_75.endPoint(), SketchLine_76.startPoint()) -SketchLine_77 = Sketch_8.addLine(87.50975635635101, -34.06366588218793, 55, -34.06366588218793) +SketchConstraintCoincidence_125 = Sketch_8.setCoincident( + SketchLine_75.endPoint(), SketchLine_76.startPoint() +) +SketchLine_77 = Sketch_8.addLine( + 87.50975635635101, -34.06366588218793, 55, -34.06366588218793 +) SketchLine_77.setName("SketchLine_77") SketchLine_77.result().setName("SketchLine_77") -SketchConstraintCoincidence_126 = Sketch_8.setCoincident(SketchLine_76.endPoint(), SketchLine_77.startPoint()) -SketchConstraintCoincidence_127 = Sketch_8.setCoincident(SketchLine_68.startPoint(), SketchLine_77.endPoint()) -SketchConstraintCoincidence_128 = Sketch_8.setCoincident(SketchPoint_10.coordinates(), SketchLine_77.endPoint()) +SketchConstraintCoincidence_126 = Sketch_8.setCoincident( + SketchLine_76.endPoint(), SketchLine_77.startPoint() +) +SketchConstraintCoincidence_127 = Sketch_8.setCoincident( + SketchLine_68.startPoint(), SketchLine_77.endPoint() +) +SketchConstraintCoincidence_128 = Sketch_8.setCoincident( + SketchPoint_10.coordinates(), SketchLine_77.endPoint() +) SketchConstraintHorizontal_14 = Sketch_8.setHorizontal(SketchLine_77.result()) SketchConstraintHorizontal_15 = Sketch_8.setHorizontal(SketchLine_73.result()) SketchConstraintHorizontal_16 = Sketch_8.setHorizontal(SketchLine_75.result()) SketchConstraintVertical_17 = Sketch_8.setVertical(SketchLine_74.result()) SketchConstraintVertical_18 = Sketch_8.setVertical(SketchLine_76.result()) -SketchArc_15 = Sketch_8.addArc(45, 66.69872981077805, 55, 66.69872981077805, 45, 76.69872981077805, False) +SketchArc_15 = Sketch_8.addArc( + 45, 66.69872981077805, 55, 66.69872981077805, 45, 76.69872981077805, False +) SketchArc_15.setName("SketchArc_16") SketchArc_15.result().setName("SketchArc_16") SketchArc_15.results()[1].setName("SketchArc_16_2") -SketchConstraintCoincidence_129 = Sketch_8.setCoincident(SketchArc_15.startPoint(), SketchLine_67.endPoint()) +SketchConstraintCoincidence_129 = Sketch_8.setCoincident( + SketchArc_15.startPoint(), SketchLine_67.endPoint() +) SketchLine_78 = Sketch_8.addLine(45, 76.69872981077805, -55, 76.69872981077803) SketchLine_78.setName("SketchLine_78") SketchLine_78.result().setName("SketchLine_78") SketchLine_78.setAuxiliary(True) -SketchConstraintCoincidence_130 = Sketch_8.setCoincident(SketchArc_15.endPoint(), SketchLine_78.startPoint()) -SketchConstraintTangent_23 = Sketch_8.setTangent(SketchArc_15.results()[1], SketchLine_78.result()) -SketchConstraintTangent_24 = Sketch_8.setTangent(SketchArc_15.results()[1], SketchLine_67.result()) -SketchConstraintCoincidence_131 = Sketch_8.setCoincident(SketchLine_70.endPoint(), SketchLine_78.endPoint()) -SketchConstraintCoincidence_132 = Sketch_8.setCoincident(SketchLine_68.startPoint(), SketchLine_67.startPoint()) -SketchConstraintCoincidence_133 = Sketch_8.setCoincident(SketchLine_78.startPoint(), SketchLine_70.result()) -SketchConstraintCoincidence_134 = Sketch_8.setCoincident(SketchLine_67.endPoint(), SketchLine_68.result()) -SketchArc_16 = Sketch_8.addArc(-45, 66.69872976783566, -45, 76.69872981077805, -55, 66.69872976783566, False) +SketchConstraintCoincidence_130 = Sketch_8.setCoincident( + SketchArc_15.endPoint(), SketchLine_78.startPoint() +) +SketchConstraintTangent_23 = Sketch_8.setTangent( + SketchArc_15.results()[1], SketchLine_78.result() +) +SketchConstraintTangent_24 = Sketch_8.setTangent( + SketchArc_15.results()[1], SketchLine_67.result() +) +SketchConstraintCoincidence_131 = Sketch_8.setCoincident( + SketchLine_70.endPoint(), SketchLine_78.endPoint() +) +SketchConstraintCoincidence_132 = Sketch_8.setCoincident( + SketchLine_68.startPoint(), SketchLine_67.startPoint() +) +SketchConstraintCoincidence_133 = Sketch_8.setCoincident( + SketchLine_78.startPoint(), SketchLine_70.result() +) +SketchConstraintCoincidence_134 = Sketch_8.setCoincident( + SketchLine_67.endPoint(), SketchLine_68.result() +) +SketchArc_16 = Sketch_8.addArc( + -45, 66.69872976783566, -45, 76.69872981077805, -55, 66.69872976783566, False +) SketchArc_16.setName("SketchArc_17") SketchArc_16.result().setName("SketchArc_17") SketchArc_16.results()[1].setName("SketchArc_17_2") -SketchConstraintCoincidence_135 = Sketch_8.setCoincident(SketchArc_16.startPoint(), SketchLine_69.endPoint()) -SketchConstraintCoincidence_136 = Sketch_8.setCoincident(SketchArc_16.endPoint(), SketchLine_71.startPoint()) -SketchConstraintTangent_25 = Sketch_8.setTangent(SketchArc_16.results()[1], SketchLine_69.result()) -SketchConstraintTangent_26 = Sketch_8.setTangent(SketchArc_16.results()[1], SketchLine_71.result()) -SketchConstraintCoincidence_137 = Sketch_8.setCoincident(SketchLine_78.startPoint(), SketchLine_69.startPoint()) -SketchConstraintCoincidence_138 = Sketch_8.setCoincident(SketchLine_72.endPoint(), SketchLine_71.endPoint()) -SketchConstraintCoincidence_139 = Sketch_8.setCoincident(SketchLine_69.endPoint(), SketchLine_78.result()) -SketchConstraintCoincidence_140 = Sketch_8.setCoincident(SketchLine_71.startPoint(), SketchLine_72.result()) +SketchConstraintCoincidence_135 = Sketch_8.setCoincident( + SketchArc_16.startPoint(), SketchLine_69.endPoint() +) +SketchConstraintCoincidence_136 = Sketch_8.setCoincident( + SketchArc_16.endPoint(), SketchLine_71.startPoint() +) +SketchConstraintTangent_25 = Sketch_8.setTangent( + SketchArc_16.results()[1], SketchLine_69.result() +) +SketchConstraintTangent_26 = Sketch_8.setTangent( + SketchArc_16.results()[1], SketchLine_71.result() +) +SketchConstraintCoincidence_137 = Sketch_8.setCoincident( + SketchLine_78.startPoint(), SketchLine_69.startPoint() +) +SketchConstraintCoincidence_138 = Sketch_8.setCoincident( + SketchLine_72.endPoint(), SketchLine_71.endPoint() +) +SketchConstraintCoincidence_139 = Sketch_8.setCoincident( + SketchLine_69.endPoint(), SketchLine_78.result() +) +SketchConstraintCoincidence_140 = Sketch_8.setCoincident( + SketchLine_71.startPoint(), SketchLine_72.result() +) SketchConstraintRadius_17 = Sketch_8.setRadius(SketchArc_15.results()[1], 10) SketchConstraintRadius_18 = Sketch_8.setRadius(SketchArc_16.results()[1], 10) SketchCircle_8 = Sketch_8.addCircle(-44, 51.69872981077802, 5) SketchConstraintRadius_19 = Sketch_8.setRadius(SketchCircle_8.results()[1], 5) -SketchConstraintDistance_35 = Sketch_8.setDistance(SketchCircle_8.center(), SketchLine_69.result(), 25, False) -SketchConstraintDistance_36 = Sketch_8.setDistance(SketchCircle_8.center(), SketchLine_71.result(), 11, False) +SketchConstraintDistance_35 = Sketch_8.setDistance( + SketchCircle_8.center(), SketchLine_69.result(), 25, False +) +SketchConstraintDistance_36 = Sketch_8.setDistance( + SketchCircle_8.center(), SketchLine_71.result(), 11, False +) SketchCircle_9 = Sketch_8.addCircle(-44, 16.69872981077805, 5) SketchConstraintRadius_20 = Sketch_8.setRadius(SketchCircle_9.results()[1], 5) -SketchConstraintDistance_37 = Sketch_8.setDistance(SketchCircle_9.center(), SketchLine_71.result(), 11, False) -SketchConstraintDistance_38 = Sketch_8.setDistance(SketchCircle_9.center(), SketchLine_69.result(), 60, False) -SketchArc_17 = Sketch_8.addArc(44, 16.69872981077805, 49, 16.69872981077805, 39, 16.69872981077805, True) +SketchConstraintDistance_37 = Sketch_8.setDistance( + SketchCircle_9.center(), SketchLine_71.result(), 11, False +) +SketchConstraintDistance_38 = Sketch_8.setDistance( + SketchCircle_9.center(), SketchLine_69.result(), 60, False +) +SketchArc_17 = Sketch_8.addArc( + 44, 16.69872981077805, 49, 16.69872981077805, 39, 16.69872981077805, True +) SketchArc_17.setName("SketchArc_19") SketchArc_17.result().setName("SketchArc_19") SketchArc_17.results()[1].setName("SketchArc_19_2") SketchConstraintRadius_21 = Sketch_8.setRadius(SketchArc_17.results()[1], 5) -SketchConstraintDistance_39 = Sketch_8.setDistance(SketchArc_17.center(), SketchLine_69.result(), 60, False) -SketchArc_18 = Sketch_8.addArc(44, 51.69872981077805, 49, 51.69872981077805, 39, 51.69872981077805, False) +SketchConstraintDistance_39 = Sketch_8.setDistance( + SketchArc_17.center(), SketchLine_69.result(), 60, False +) +SketchArc_18 = Sketch_8.addArc( + 44, 51.69872981077805, 49, 51.69872981077805, 39, 51.69872981077805, False +) SketchArc_18.setName("SketchArc_18") SketchArc_18.result().setName("SketchArc_18") SketchArc_18.results()[1].setName("SketchArc_18_2") SketchLine_79 = Sketch_8.addLine(49, 16.69872981077805, 49, 51.69872981077805) SketchLine_79.setName("SketchLine_82") SketchLine_79.result().setName("SketchLine_82") -SketchConstraintCoincidence_141 = Sketch_8.setCoincident(SketchArc_18.startPoint(), SketchLine_79.endPoint()) -SketchConstraintCoincidence_142 = Sketch_8.setCoincident(SketchLine_79.startPoint(), SketchArc_17.startPoint()) +SketchConstraintCoincidence_141 = Sketch_8.setCoincident( + SketchArc_18.startPoint(), SketchLine_79.endPoint() +) +SketchConstraintCoincidence_142 = Sketch_8.setCoincident( + SketchLine_79.startPoint(), SketchArc_17.startPoint() +) SketchLine_80 = Sketch_8.addLine(39, 16.69872981077805, 39, 51.69872981077805) SketchLine_80.setName("SketchLine_83") SketchLine_80.result().setName("SketchLine_83") -SketchConstraintCoincidence_143 = Sketch_8.setCoincident(SketchArc_17.endPoint(), SketchLine_80.startPoint()) -SketchConstraintCoincidence_144 = Sketch_8.setCoincident(SketchArc_18.endPoint(), SketchLine_80.endPoint()) -SketchConstraintDistance_40 = Sketch_8.setDistance(SketchArc_17.center(), SketchLine_67.result(), 11, False) -SketchConstraintDistance_41 = Sketch_8.setDistance(SketchLine_69.result(), SketchArc_18.center(), 25, False) -SketchConstraintDistance_42 = Sketch_8.setDistance(SketchArc_18.center(), SketchLine_67.result(), 11, False) +SketchConstraintCoincidence_143 = Sketch_8.setCoincident( + SketchArc_17.endPoint(), SketchLine_80.startPoint() +) +SketchConstraintCoincidence_144 = Sketch_8.setCoincident( + SketchArc_18.endPoint(), SketchLine_80.endPoint() +) +SketchConstraintDistance_40 = Sketch_8.setDistance( + SketchArc_17.center(), SketchLine_67.result(), 11, False +) +SketchConstraintDistance_41 = Sketch_8.setDistance( + SketchLine_69.result(), SketchArc_18.center(), 25, False +) +SketchConstraintDistance_42 = Sketch_8.setDistance( + SketchArc_18.center(), SketchLine_67.result(), 11, False +) SketchConstraintRadius_22 = Sketch_8.setRadius(SketchArc_18.results()[1], 5) SketchConstraintLength_4 = Sketch_8.setLength(SketchLine_80.result(), 35.000000440932) SketchConstraintLength_5 = Sketch_8.setLength(SketchLine_79.result(), 35) SketchConstraintLength_6 = Sketch_8.setLength(SketchLine_75.result(), 170.764972021204) SketchConstraintLength_7 = Sketch_8.setLength(SketchLine_77.result(), 32.509756356351) SketchConstraintLength_8 = Sketch_8.setLength(SketchLine_76.result(), 126.065149813077) -SketchConstraintDistance_43 = Sketch_8.setDistance(SketchArc_18.endPoint(), SketchLine_69.result(), 24.999999559068, False) -SketchConstraintDistance_44 = Sketch_8.setDistance(SketchArc_18.startPoint(), SketchLine_69.result(), 25, False) +SketchConstraintDistance_43 = Sketch_8.setDistance( + SketchArc_18.endPoint(), SketchLine_69.result(), 24.999999559068, False +) +SketchConstraintDistance_44 = Sketch_8.setDistance( + SketchArc_18.startPoint(), SketchLine_69.result(), 25, False +) model.do() -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")]) +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() # Test reexecution after parameter change @@ -697,8 +1356,8 @@ model.testNbSubResults(Fuse_3, [0]) model.testNbSubShapes(Fuse_3, GeomAPI_Shape.SOLID, [1]) model.testNbSubShapes(Fuse_3, GeomAPI_Shape.FACE, [50]) # unstable numbers -#model.testNbSubShapes(Fuse_3, GeomAPI_Shape.EDGE, [266]) -#model.testNbSubShapes(Fuse_3, GeomAPI_Shape.VERTEX, [532]) +# model.testNbSubShapes(Fuse_3, GeomAPI_Shape.EDGE, [266]) +# model.testNbSubShapes(Fuse_3, GeomAPI_Shape.VERTEX, [532]) model.testResultsVolumes(Fuse_3, [156999.196618517889874055981636]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.models/bearing_puller.py b/test.models/bearing_puller.py index 5ecfe25b9..da81eddf6 100644 --- a/test.models/bearing_puller.py +++ b/test.models/bearing_puller.py @@ -35,7 +35,9 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(50, 14.61148285474187, 50, 0) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 14.61148285474187) SketchLine_2 = Sketch_1.addLine(50, 0, 6, 0) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(7, 25, 16.13599978860571, 25) SketchLine_3.setName("SketchLine_4") SketchLine_3.result().setName("SketchLine_4") @@ -43,22 +45,54 @@ SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintVertical_1.setName("SketchConstraintVertical_2") -SketchArc_1 = Sketch_1.addArc(16.1359986285606, -59.99999999999999, 16.13599978860571, 25, 46.80399475966571, 19.27467447616896, True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.startPoint()) +SketchArc_1 = Sketch_1.addArc( + 16.1359986285606, + -59.99999999999999, + 16.13599978860571, + 25, + 46.80399475966571, + 19.27467447616896, + True, +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_1.startPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_4") -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_3.result()) -SketchArc_2 = Sketch_1.addArc(45, 14.61145639129118, 46.80399475966571, 19.27467447616896, 50, 14.61148285474187, True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchArc_1.endPoint()) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_3.result() +) +SketchArc_2 = Sketch_1.addArc( + 45, + 14.61145639129118, + 46.80399475966571, + 19.27467447616896, + 50, + 14.61148285474187, + True, +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchArc_1.endPoint() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_6") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_1.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_7") -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1]) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_1.result()) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchArc_2.results()[1] +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_1.result() +) SketchPoint_1 = Sketch_1.addPoint(50, 17.96300027009704) SketchPoint_1.setAuxiliary(True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_1.result() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_8") -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.results()[1]) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchArc_1.results()[1] +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_9") SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_2.results()[1], 5) SketchPoint_2 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) @@ -67,9 +101,13 @@ SketchConstraintRadius_2.setName("SketchConstraintRadius_4") SketchLine_4 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_4.setName("SketchLine_27") SketchLine_4.result().setName("SketchLine_27") -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_4.result(), SketchLine_2.startPoint(), "Radius") +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_4.result(), SketchLine_2.startPoint(), "Radius" +) SketchConstraintDistance_1.setName("SketchConstraintDistance_13") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.startPoint(), SketchLine_2.result(), "Thickness") +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_3.startPoint(), SketchLine_2.result(), "Thickness" +) SketchConstraintDistance_2.setName("SketchConstraintDistance_14") SketchLine_5 = Sketch_1.addLine(6, 0, 6, 24) SketchLine_5.setName("SketchLine_28") @@ -77,95 +115,225 @@ SketchLine_5.result().setName("SketchLine_28") SketchLine_6 = Sketch_1.addLine(6, 24, 7, 25) SketchLine_6.setName("SketchLine_29") SketchLine_6.result().setName("SketchLine_29") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_32") SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintVertical_2.setName("SketchConstraintVertical_3") -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_5.startPoint(), SketchLine_4.result(), "Rod/2") +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_5.startPoint(), SketchLine_4.result(), "Rod/2" +) SketchConstraintDistance_3.setName("SketchConstraintDistance_15") -SketchConstraintAngle_1 = Sketch_1.setAngleComplementary(SketchLine_6.result(), SketchLine_5.result(), 45.00000000000006) +SketchConstraintAngle_1 = Sketch_1.setAngleComplementary( + SketchLine_6.result(), SketchLine_5.result(), 45.00000000000006 +) SketchConstraintAngle_1.setName("SketchConstraintAngle_3") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_4.result(), SketchLine_6.endPoint(), "Rod/2 + 1") +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_4.result(), SketchLine_6.endPoint(), "Rod/2 + 1" +) SketchConstraintDistance_4.setName("SketchConstraintDistance_16") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_33") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_34") SketchLine_7 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_7.setName("SketchLine_30") SketchLine_7.result().setName("SketchLine_30") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_7.result()) +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-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")) +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&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) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchLine_8.startPoint(), SketchPoint_3.result() +) +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") SketchLine_9.result().setName("SketchLine_10") SketchLine_10 = Sketch_2.addLine(0, 0, 25, -43.30127018922193) 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&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) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_10.startPoint(), SketchPoint_3.result() +) +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") SketchLine_11.result().setName("SketchLine_11") SketchLine_12 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_12.setName("SketchLine_7") SketchLine_12.result().setName("SketchLine_7") -SketchConstraintAngle_2 = Sketch_2.setAngleBackward(SketchLine_12.result(), SketchLine_10.result(), 59.99999999999994) +SketchConstraintAngle_2 = Sketch_2.setAngleBackward( + SketchLine_12.result(), SketchLine_10.result(), 59.99999999999994 +) SketchConstraintAngle_2.setName("SketchConstraintAngle_1") -SketchConstraintAngle_3 = Sketch_2.setAngle(SketchLine_12.result(), SketchLine_8.result(), 59.99999999999999) +SketchConstraintAngle_3 = Sketch_2.setAngle( + SketchLine_12.result(), SketchLine_8.result(), 59.99999999999999 +) SketchConstraintAngle_3.setName("SketchConstraintAngle_2") -SketchLine_13 = Sketch_2.addLine(14.43375672974065, -4.667176185980158e-016, 39.43375672974065, 43.30127018922192) +SketchLine_13 = Sketch_2.addLine( + 14.43375672974065, -4.667176185980158e-016, 39.43375672974065, 43.30127018922192 +) SketchLine_13.setName("SketchLine_9") SketchLine_13.result().setName("SketchLine_9") SketchLine_13.setAuxiliary(True) -SketchLine_14 = Sketch_2.addLine(39.43375672974064, -43.30127018922192, 14.43375672974065, -4.667176185980158e-016) +SketchLine_14 = Sketch_2.addLine( + 39.43375672974064, -43.30127018922192, 14.43375672974065, -4.667176185980158e-016 +) SketchLine_14.setName("SketchLine_8") SketchLine_14.result().setName("SketchLine_8") SketchLine_14.setAuxiliary(True) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_13.startPoint() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_16") -SketchConstraintParallel_1 = Sketch_2.setParallel(SketchLine_14.result(), SketchLine_10.result()) -SketchConstraintParallel_2 = Sketch_2.setParallel(SketchLine_13.result(), SketchLine_8.result()) -SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_8.result(), SketchLine_14.result()) -SketchConstraintEqual_2 = Sketch_2.setEqual(SketchLine_10.result(), SketchLine_13.result()) -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchLine_13.startPoint(), SketchLine_10.result(), "Width/2") +SketchConstraintParallel_1 = Sketch_2.setParallel( + SketchLine_14.result(), SketchLine_10.result() +) +SketchConstraintParallel_2 = Sketch_2.setParallel( + SketchLine_13.result(), SketchLine_8.result() +) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchLine_8.result(), SketchLine_14.result() +) +SketchConstraintEqual_2 = Sketch_2.setEqual( + SketchLine_10.result(), SketchLine_13.result() +) +SketchConstraintDistance_5 = Sketch_2.setDistance( + SketchLine_13.startPoint(), SketchLine_10.result(), "Width/2" +) SketchConstraintDistance_5.setName("SketchConstraintDistance_4") -SketchArc_3 = Sketch_2.addArc(20.20725942163691, 2.933703812344835e-015, 15.87713238415337, 2.499999967850816, 15.87711932209923, -2.499977343709401, False) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchArc_3.startPoint(), SketchLine_11.startPoint()) +SketchArc_3 = Sketch_2.addArc( + 20.20725942163691, + 2.933703812344835e-015, + 15.87713238415337, + 2.499999967850816, + 15.87711932209923, + -2.499977343709401, + False, +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchArc_3.startPoint(), SketchLine_11.startPoint() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_15") -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchArc_3.endPoint(), SketchLine_9.endPoint()) -SketchConstraintTangent_4 = Sketch_2.setTangent(SketchArc_3.results()[1], SketchLine_9.result()) -SketchConstraintTangent_5 = Sketch_2.setTangent(SketchArc_3.results()[1], SketchLine_11.result()) -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_11.endPoint()) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_14.result()) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchLine_13.result()) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchArc_3.endPoint(), SketchLine_9.endPoint() +) +SketchConstraintTangent_4 = Sketch_2.setTangent( + SketchArc_3.results()[1], SketchLine_9.result() +) +SketchConstraintTangent_5 = Sketch_2.setTangent( + SketchArc_3.results()[1], SketchLine_11.result() +) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_11.endPoint() +) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchLine_14.result() +) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchLine_11.startPoint(), SketchLine_13.result() +) SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_3.results()[1], 5) SketchConstraintRadius_3.setName("SketchConstraintRadius_2") -SketchConstraintDistance_6 = Sketch_2.setDistance(SketchLine_13.startPoint(), SketchLine_8.result(), "Width/2") +SketchConstraintDistance_6 = Sketch_2.setDistance( + SketchLine_13.startPoint(), SketchLine_8.result(), "Width/2" +) SketchConstraintDistance_6.setName("SketchConstraintDistance_5") -SketchArc_4 = Sketch_2.addArc(14.43375672974064, -1.454136002932938e-015, 39.43375672974064, -43.30127018922192, 39.43375672974065, 43.30127018922192, False) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_9.startPoint(), SketchArc_4.startPoint()) -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchArc_4.startPoint()) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchArc_4.endPoint()) -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchArc_4.endPoint()) -SketchConstraintEqual_3 = Sketch_2.setEqual(SketchArc_4.results()[1], SketchCircle_1.results()[1]) -SketchMultiRotation_1_objects = [SketchLine_11.result(), SketchArc_3.results()[1], SketchLine_9.result(), SketchArc_4.results()[1]] -SketchMultiRotation_1 = Sketch_2.addRotation(SketchMultiRotation_1_objects, SketchCircle_2.center(), 120, 3) -[SketchLine_15, SketchLine_16, SketchArc_5, SketchArc_6, SketchLine_17, SketchLine_18, SketchArc_7, SketchArc_8] = SketchMultiRotation_1.rotated() +SketchArc_4 = Sketch_2.addArc( + 14.43375672974064, + -1.454136002932938e-015, + 39.43375672974064, + -43.30127018922192, + 39.43375672974065, + 43.30127018922192, + False, +) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_9.startPoint(), SketchArc_4.startPoint() +) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchArc_4.startPoint() +) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintEqual_3 = Sketch_2.setEqual( + SketchArc_4.results()[1], SketchCircle_1.results()[1] +) +SketchMultiRotation_1_objects = [ + SketchLine_11.result(), + SketchArc_3.results()[1], + SketchLine_9.result(), + SketchArc_4.results()[1], +] +SketchMultiRotation_1 = Sketch_2.addRotation( + SketchMultiRotation_1_objects, SketchCircle_2.center(), 120, 3 +) +[ + SketchLine_15, + SketchLine_16, + SketchArc_5, + SketchArc_6, + SketchLine_17, + SketchLine_18, + SketchArc_7, + SketchArc_8, +] = SketchMultiRotation_1.rotated() SketchArc_7.setName("SketchArc_6") SketchArc_7.result().setName("SketchArc_6") SketchArc_7.results()[1].setName("SketchArc_6_2") @@ -180,39 +348,91 @@ SketchLine_16.setName("SketchLine_14") SketchLine_16.result().setName("SketchLine_14") SketchLine_15.setName("SketchLine_12") SketchLine_15.result().setName("SketchLine_12") -SketchLine_19 = Sketch_2.addLine(7.828185376255509, -23.55881480274223, 31.38482278389692, -64.36010764825475) +SketchLine_19 = Sketch_2.addLine( + 7.828185376255509, -23.55881480274223, 31.38482278389692, -64.36010764825475 +) SketchLine_19.setName("SketchLine_16") SketchLine_19.result().setName("SketchLine_16") -SketchLine_20 = Sketch_2.addLine(31.38482278389692, -64.36010764825475, 40.0450768217413, -59.36010764825475) +SketchLine_20 = Sketch_2.addLine( + 31.38482278389692, -64.36010764825475, 40.0450768217413, -59.36010764825475 +) SketchLine_20.setName("SketchLine_17") SketchLine_20.result().setName("SketchLine_17") -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_28") -SketchLine_21 = Sketch_2.addLine(40.0450768217413, -59.36010764825475, 16.48843941409989, -18.55881480274223) +SketchLine_21 = Sketch_2.addLine( + 40.0450768217413, -59.36010764825475, 16.48843941409989, -18.55881480274223 +) SketchLine_21.setName("SketchLine_18") SketchLine_21.result().setName("SketchLine_18") -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.startPoint() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_29") -SketchConstraintParallel_3 = Sketch_2.setParallel(SketchLine_10.result(), SketchLine_19.result()) -SketchConstraintParallel_4 = Sketch_2.setParallel(SketchLine_10.result(), SketchLine_21.result()) -SketchConstraintEqual_4 = Sketch_2.setEqual(SketchLine_9.result(), SketchLine_21.result()) -SketchConstraintEqual_5 = Sketch_2.setEqual(SketchLine_9.result(), SketchLine_19.result()) -SketchConstraintDistance_7 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_19.result(), "Gap/2") +SketchConstraintParallel_3 = Sketch_2.setParallel( + SketchLine_10.result(), SketchLine_19.result() +) +SketchConstraintParallel_4 = Sketch_2.setParallel( + SketchLine_10.result(), SketchLine_21.result() +) +SketchConstraintEqual_4 = Sketch_2.setEqual( + SketchLine_9.result(), SketchLine_21.result() +) +SketchConstraintEqual_5 = Sketch_2.setEqual( + SketchLine_9.result(), SketchLine_19.result() +) +SketchConstraintDistance_7 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_19.result(), "Gap/2" +) SketchConstraintDistance_7.setName("SketchConstraintDistance_6") -SketchConstraintDistance_8 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_21.result(), "Gap/2") +SketchConstraintDistance_8 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_21.result(), "Gap/2" +) SketchConstraintDistance_8.setName("SketchConstraintDistance_7") -SketchArc_9 = Sketch_2.addArc(10.5, -18.18653347947321, 7.828185376255509, -23.55881480274223, 16.48843941409989, -18.55881480274223, True) -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchArc_9.center(), SketchLine_10.result()) +SketchArc_9 = Sketch_2.addArc( + 10.5, + -18.18653347947321, + 7.828185376255509, + -23.55881480274223, + 16.48843941409989, + -18.55881480274223, + True, +) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchArc_9.center(), SketchLine_10.result() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_27") -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchLine_19.startPoint(), SketchArc_9.startPoint()) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchLine_19.startPoint(), SketchArc_9.startPoint() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_30") -SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchArc_9.endPoint(), SketchLine_21.endPoint()) +SketchConstraintCoincidence_30 = Sketch_2.setCoincident( + SketchArc_9.endPoint(), SketchLine_21.endPoint() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_31") SketchConstraintRadius_4 = Sketch_2.setRadius(SketchArc_9.results()[1], 6) SketchConstraintRadius_4.setName("SketchConstraintRadius_3") -SketchMultiRotation_2_objects = [SketchLine_19.result(), SketchLine_20.result(), SketchLine_21.result(), SketchArc_9.results()[1]] -SketchMultiRotation_2 = Sketch_2.addRotation(SketchMultiRotation_2_objects, SketchCircle_1.center(), 120, 3) -[SketchLine_22, SketchLine_23, SketchLine_24, SketchLine_25, SketchLine_26, SketchLine_27, SketchArc_10, SketchArc_11] = SketchMultiRotation_2.rotated() +SketchMultiRotation_2_objects = [ + SketchLine_19.result(), + SketchLine_20.result(), + SketchLine_21.result(), + SketchArc_9.results()[1], +] +SketchMultiRotation_2 = Sketch_2.addRotation( + SketchMultiRotation_2_objects, SketchCircle_1.center(), 120, 3 +) +[ + SketchLine_22, + SketchLine_23, + SketchLine_24, + SketchLine_25, + SketchLine_26, + SketchLine_27, + SketchArc_10, + SketchArc_11, +] = SketchMultiRotation_2.rotated() SketchLine_27.setName("SketchLine_24") SketchLine_27.result().setName("SketchLine_24") SketchLine_26.setName("SketchLine_21") @@ -225,42 +445,158 @@ SketchLine_23.setName("SketchLine_22") SketchLine_23.result().setName("SketchLine_22") SketchLine_22.setName("SketchLine_19") SketchLine_22.result().setName("SketchLine_19") -SketchConstraintDistance_9 = Sketch_2.setDistance(SketchArc_9.center(), SketchPoint_3.coordinates(), 21) +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/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&Sketch_2/SketchLine_21"), model.selection("FACE", "Cut_2_1/Modified_Face&Sketch_2/SketchLine_19")) +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&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) SketchConstraintRadius_5 = Sketch_3.setRadius(SketchCircle_4.results()[1], 4) -SketchConstraintEqual_6 = Sketch_3.setEqual(SketchCircle_3.results()[1], SketchCircle_4.results()[1]) +SketchConstraintEqual_6 = Sketch_3.setEqual( + SketchCircle_3.results()[1], SketchCircle_4.results()[1] +) SketchLine_28 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_28.setName("SketchLine_25") SketchLine_28.result().setName("SketchLine_25") -SketchConstraintDistance_10 = Sketch_3.setDistance(SketchCircle_3.center(), SketchLine_28.result(), 25) +SketchConstraintDistance_10 = Sketch_3.setDistance( + SketchCircle_3.center(), SketchLine_28.result(), 25 +) SketchConstraintDistance_10.setName("SketchConstraintDistance_9") -SketchConstraintDistance_11 = Sketch_3.setDistance(SketchCircle_4.center(), SketchLine_28.result(), 40) +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/Generated_Edge&Sketch_2/SketchLine_21&Sketch_1/SketchLine_2"), 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") -SketchConstraintDistance_12 = Sketch_3.setDistance(SketchCircle_4.center(), SketchLine_29.result(), 10) +SketchConstraintDistance_12 = Sketch_3.setDistance( + SketchCircle_4.center(), SketchLine_29.result(), 10 +) SketchConstraintDistance_12.setName("SketchConstraintDistance_11") -SketchConstraintDistance_13 = Sketch_3.setDistance(SketchCircle_3.center(), SketchLine_29.result(), 10) +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_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) -Cut_4 = model.addCut(Part_1_doc, [model.selection("SOLID", "Cut_3_1")], [model.selection("SOLID", "Rotation_1_1"), model.selection("SOLID", "Rotation_1_2")]) -Recover_2 = model.addRecover(Part_1_doc, Cut_4, [Rotation_1.results()[1], Rotation_1.result()]) -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_2_1"), model.selection("SOLID", "Recover_2_2")], model.selection("EDGE", "PartSet/OZ"), 120) -Cut_5 = model.addCut(Part_1_doc, [model.selection("SOLID", "Cut_4_1")], [model.selection("SOLID", "Rotation_2_2"), model.selection("SOLID", "Rotation_2_1")]) +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, +) +Cut_4 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Cut_3_1")], + [ + model.selection("SOLID", "Rotation_1_1"), + model.selection("SOLID", "Rotation_1_2"), + ], +) +Recover_2 = model.addRecover( + Part_1_doc, Cut_4, [Rotation_1.results()[1], Rotation_1.result()] +) +Rotation_2 = model.addRotation( + Part_1_doc, + [model.selection("SOLID", "Recover_2_1"), model.selection("SOLID", "Recover_2_2")], + model.selection("EDGE", "PartSet/OZ"), + 120, +) +Cut_5 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Cut_4_1")], + [ + model.selection("SOLID", "Rotation_2_2"), + model.selection("SOLID", "Rotation_2_1"), + ], +) model.do() Part_2 = model.addPart(partSet) Part_2.setName("Arm 1") @@ -273,66 +609,124 @@ SketchLine_30 = Sketch_4.addLine(-7.563632736215193e-032, -5.762896622594646, 0, SketchLine_30.setAuxiliary(True) SketchLine_31 = Sketch_4.addLine(0, 3.75, 4.894344934278314, 2.394344934278312) SketchLine_31.setAuxiliary(True) -SketchConstraintCoincidence_31 = Sketch_4.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) -SketchLine_32 = Sketch_4.addLine(4.894344934278314, 2.394344934278312, -7.563632736215193e-032, -5.762896622594646) +SketchConstraintCoincidence_31 = Sketch_4.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) +SketchLine_32 = Sketch_4.addLine( + 4.894344934278314, 2.394344934278312, -7.563632736215193e-032, -5.762896622594646 +) SketchLine_32.setAuxiliary(True) -SketchConstraintCoincidence_32 = Sketch_4.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) -SketchConstraintCoincidence_33 = Sketch_4.setCoincident(SketchLine_30.startPoint(), SketchLine_32.endPoint()) +SketchConstraintCoincidence_32 = Sketch_4.setCoincident( + SketchLine_31.endPoint(), SketchLine_32.startPoint() +) +SketchConstraintCoincidence_33 = Sketch_4.setCoincident( + SketchLine_30.startPoint(), SketchLine_32.endPoint() +) SketchConstraintVertical_3 = Sketch_4.setVertical(SketchLine_30.result()) SketchLine_33 = Sketch_4.addLine(0, 3.75, 6.25, 3.75) SketchLine_33.setAuxiliary(True) -SketchConstraintCoincidence_34 = Sketch_4.setCoincident(SketchLine_30.endPoint(), SketchLine_33.startPoint()) -SketchConstraintCoincidence_35 = Sketch_4.setCoincident(SketchLine_31.startPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_34 = Sketch_4.setCoincident( + SketchLine_30.endPoint(), SketchLine_33.startPoint() +) +SketchConstraintCoincidence_35 = Sketch_4.setCoincident( + SketchLine_31.startPoint(), SketchLine_33.startPoint() +) SketchLine_34 = Sketch_4.addLine(6.25, 3.75, 6.25, 0) SketchLine_34.setAuxiliary(True) -SketchConstraintCoincidence_36 = Sketch_4.setCoincident(SketchLine_33.endPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_36 = Sketch_4.setCoincident( + SketchLine_33.endPoint(), SketchLine_34.startPoint() +) SketchLine_35 = Sketch_4.addLine(6.25, 0, 0, 0) SketchLine_35.setAuxiliary(True) -SketchConstraintCoincidence_37 = Sketch_4.setCoincident(SketchLine_34.endPoint(), SketchLine_35.startPoint()) -SketchConstraintCoincidence_38 = Sketch_4.setCoincident(SketchLine_35.endPoint(), SketchLine_30.result()) +SketchConstraintCoincidence_37 = Sketch_4.setCoincident( + SketchLine_34.endPoint(), SketchLine_35.startPoint() +) +SketchConstraintCoincidence_38 = Sketch_4.setCoincident( + SketchLine_35.endPoint(), SketchLine_30.result() +) SketchConstraintHorizontal_3 = Sketch_4.setHorizontal(SketchLine_35.result()) SketchConstraintHorizontal_4 = Sketch_4.setHorizontal(SketchLine_33.result()) SketchConstraintVertical_4 = Sketch_4.setVertical(SketchLine_34.result()) -SketchLine_36 = Sketch_4.addLine(-7.563632736215193e-032, -5.762896622594646, 2.447172467139156, 3.072172467139157) +SketchLine_36 = Sketch_4.addLine( + -7.563632736215193e-032, -5.762896622594646, 2.447172467139156, 3.072172467139157 +) SketchLine_36.setAuxiliary(True) -SketchConstraintCoincidence_39 = Sketch_4.setCoincident(SketchLine_30.startPoint(), SketchLine_36.startPoint()) -SketchConstraintCoincidence_40 = Sketch_4.setCoincident(SketchLine_32.endPoint(), SketchLine_36.startPoint()) -SketchConstraintCoincidence_41 = Sketch_4.setCoincident(SketchLine_36.endPoint(), SketchLine_31.result()) -SketchConstraintPerpendicular_1 = Sketch_4.setPerpendicular(SketchLine_36.result(), SketchLine_31.result()) +SketchConstraintCoincidence_39 = Sketch_4.setCoincident( + SketchLine_30.startPoint(), SketchLine_36.startPoint() +) +SketchConstraintCoincidence_40 = Sketch_4.setCoincident( + SketchLine_32.endPoint(), SketchLine_36.startPoint() +) +SketchConstraintCoincidence_41 = Sketch_4.setCoincident( + SketchLine_36.endPoint(), SketchLine_31.result() +) +SketchConstraintPerpendicular_1 = Sketch_4.setPerpendicular( + SketchLine_36.result(), SketchLine_31.result() +) SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_42 = Sketch_4.setCoincident(SketchLine_35.endPoint(), SketchPoint_4.coordinates()) +SketchConstraintCoincidence_42 = Sketch_4.setCoincident( + SketchLine_35.endPoint(), SketchPoint_4.coordinates() +) SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_20") SketchConstraintLength_1 = Sketch_4.setLength(SketchLine_33.result(), "b/2") SketchConstraintLength_2 = Sketch_4.setLength(SketchLine_34.result(), "a/2") SketchCircle_5 = Sketch_4.addCircle(1.25, -1.25, 1.25) SketchCircle_5.setAuxiliary(True) SketchConstraintRadius_6 = Sketch_4.setRadius(SketchCircle_5.results()[1], "(b-a)/4") -SketchConstraintTangent_6 = Sketch_4.setTangent(SketchCircle_5.results()[1], SketchLine_35.result()) -SketchConstraintTangent_7 = Sketch_4.setTangent(SketchCircle_5.results()[1], SketchLine_30.result()) -SketchConstraintTangent_8 = Sketch_4.setTangent(SketchCircle_5.results()[1], SketchLine_32.result()) +SketchConstraintTangent_6 = Sketch_4.setTangent( + SketchCircle_5.results()[1], SketchLine_35.result() +) +SketchConstraintTangent_7 = Sketch_4.setTangent( + SketchCircle_5.results()[1], SketchLine_30.result() +) +SketchConstraintTangent_8 = Sketch_4.setTangent( + SketchCircle_5.results()[1], SketchLine_32.result() +) SketchLine_37 = Sketch_4.addLine(4.894344934278314, 2.394344934278312, 6.25, 0) SketchLine_37.setAuxiliary(True) -SketchConstraintCoincidence_44 = Sketch_4.setCoincident(SketchLine_31.endPoint(), SketchLine_37.startPoint()) -SketchConstraintCoincidence_45 = Sketch_4.setCoincident(SketchLine_32.startPoint(), SketchLine_37.startPoint()) -SketchConstraintCoincidence_46 = Sketch_4.setCoincident(SketchLine_34.endPoint(), SketchLine_37.endPoint()) -SketchConstraintCoincidence_47 = Sketch_4.setCoincident(SketchLine_35.startPoint(), SketchLine_37.endPoint()) +SketchConstraintCoincidence_44 = Sketch_4.setCoincident( + SketchLine_31.endPoint(), SketchLine_37.startPoint() +) +SketchConstraintCoincidence_45 = Sketch_4.setCoincident( + SketchLine_32.startPoint(), SketchLine_37.startPoint() +) +SketchConstraintCoincidence_46 = Sketch_4.setCoincident( + SketchLine_34.endPoint(), SketchLine_37.endPoint() +) +SketchConstraintCoincidence_47 = Sketch_4.setCoincident( + SketchLine_35.startPoint(), SketchLine_37.endPoint() +) SketchLine_38 = Sketch_4.addLine(0, 3.75, 6.25, 0) SketchLine_38.setName("SketchLine_10") SketchLine_38.result().setName("SketchLine_10") SketchLine_38.setAuxiliary(True) -SketchConstraintCoincidence_48 = Sketch_4.setCoincident(SketchLine_30.endPoint(), SketchLine_38.startPoint()) +SketchConstraintCoincidence_48 = Sketch_4.setCoincident( + SketchLine_30.endPoint(), SketchLine_38.startPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_23") -SketchConstraintCoincidence_49 = Sketch_4.setCoincident(SketchLine_31.startPoint(), SketchLine_38.startPoint()) +SketchConstraintCoincidence_49 = Sketch_4.setCoincident( + SketchLine_31.startPoint(), SketchLine_38.startPoint() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_24") -SketchConstraintCoincidence_50 = Sketch_4.setCoincident(SketchLine_33.startPoint(), SketchLine_38.startPoint()) +SketchConstraintCoincidence_50 = Sketch_4.setCoincident( + SketchLine_33.startPoint(), SketchLine_38.startPoint() +) SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_25") -SketchConstraintCoincidence_51 = Sketch_4.setCoincident(SketchLine_34.endPoint(), SketchLine_38.endPoint()) +SketchConstraintCoincidence_51 = Sketch_4.setCoincident( + SketchLine_34.endPoint(), SketchLine_38.endPoint() +) SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_26") -SketchConstraintCoincidence_52 = Sketch_4.setCoincident(SketchLine_35.startPoint(), SketchLine_38.endPoint()) +SketchConstraintCoincidence_52 = Sketch_4.setCoincident( + SketchLine_35.startPoint(), SketchLine_38.endPoint() +) SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_27") -SketchConstraintCoincidence_53 = Sketch_4.setCoincident(SketchLine_37.endPoint(), SketchLine_38.endPoint()) +SketchConstraintCoincidence_53 = Sketch_4.setCoincident( + SketchLine_37.endPoint(), SketchLine_38.endPoint() +) SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_28") -SketchConstraintPerpendicular_2 = Sketch_4.setPerpendicular(SketchLine_32.result(), SketchLine_38.result()) +SketchConstraintPerpendicular_2 = Sketch_4.setPerpendicular( + SketchLine_32.result(), SketchLine_38.result() +) SketchConstraintPerpendicular_2.setName("SketchConstraintPerpendicular_3") SketchLine_39 = Sketch_4.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_39.setName("SketchLine_11") @@ -340,30 +734,66 @@ SketchLine_39.result().setName("SketchLine_11") SketchLine_40 = Sketch_4.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_40.setName("SketchLine_12") SketchLine_40.result().setName("SketchLine_12") -SketchArc_12 = Sketch_4.addArc(-7.563632736215193e-032, -5.762896622594646, 0, 3.75, 4.894344934278314, 2.394344934278312, True) -SketchConstraintCoincidence_54 = Sketch_4.setCoincident(SketchLine_30.endPoint(), SketchArc_12.startPoint()) +SketchArc_12 = Sketch_4.addArc( + -7.563632736215193e-032, + -5.762896622594646, + 0, + 3.75, + 4.894344934278314, + 2.394344934278312, + True, +) +SketchConstraintCoincidence_54 = Sketch_4.setCoincident( + SketchLine_30.endPoint(), SketchArc_12.startPoint() +) SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_30") -SketchConstraintCoincidence_55 = Sketch_4.setCoincident(SketchLine_31.startPoint(), SketchArc_12.startPoint()) +SketchConstraintCoincidence_55 = Sketch_4.setCoincident( + SketchLine_31.startPoint(), SketchArc_12.startPoint() +) SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_31") -SketchConstraintCoincidence_56 = Sketch_4.setCoincident(SketchLine_33.startPoint(), SketchArc_12.startPoint()) +SketchConstraintCoincidence_56 = Sketch_4.setCoincident( + SketchLine_33.startPoint(), SketchArc_12.startPoint() +) SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_32") -SketchConstraintCoincidence_57 = Sketch_4.setCoincident(SketchLine_38.startPoint(), SketchArc_12.startPoint()) +SketchConstraintCoincidence_57 = Sketch_4.setCoincident( + SketchLine_38.startPoint(), SketchArc_12.startPoint() +) SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_33") -SketchConstraintCoincidence_58 = Sketch_4.setCoincident(SketchArc_12.endPoint(), SketchLine_31.endPoint()) +SketchConstraintCoincidence_58 = Sketch_4.setCoincident( + SketchArc_12.endPoint(), SketchLine_31.endPoint() +) SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_34") -SketchConstraintCoincidence_59 = Sketch_4.setCoincident(SketchArc_12.center(), SketchLine_32.endPoint()) +SketchConstraintCoincidence_59 = Sketch_4.setCoincident( + SketchArc_12.center(), SketchLine_32.endPoint() +) SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_35") -SketchArc_13 = Sketch_4.addArc(3.457737973711348, 3.788069295318559e-014, 6.25, 0, 4.894344934278314, 2.394344934278312, False) +SketchArc_13 = Sketch_4.addArc( + 3.457737973711348, + 3.788069295318559e-014, + 6.25, + 0, + 4.894344934278314, + 2.394344934278312, + False, +) SketchArc_13.setName("SketchArc_4") SketchArc_13.result().setName("SketchArc_4") SketchArc_13.results()[1].setName("SketchArc_4_2") -SketchConstraintCoincidence_60 = Sketch_4.setCoincident(SketchArc_13.startPoint(), SketchLine_35.startPoint()) +SketchConstraintCoincidence_60 = Sketch_4.setCoincident( + SketchArc_13.startPoint(), SketchLine_35.startPoint() +) SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_48") -SketchConstraintCoincidence_61 = Sketch_4.setCoincident(SketchArc_13.endPoint(), SketchArc_12.endPoint()) +SketchConstraintCoincidence_61 = Sketch_4.setCoincident( + SketchArc_13.endPoint(), SketchArc_12.endPoint() +) SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_49") -SketchConstraintCoincidence_43 = Sketch_4.setCoincident(SketchArc_13.center(), SketchLine_32.result()) +SketchConstraintCoincidence_43 = Sketch_4.setCoincident( + SketchArc_13.center(), SketchLine_32.result() +) SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_21") -SketchConstraintMirror_1 = Sketch_4.addMirror(SketchLine_40.result(), [SketchArc_13.results()[1], SketchArc_12.results()[1]]) +SketchConstraintMirror_1 = Sketch_4.addMirror( + SketchLine_40.result(), [SketchArc_13.results()[1], SketchArc_12.results()[1]] +) [SketchArc_14, SketchArc_15] = SketchConstraintMirror_1.mirrored() SketchArc_15.setName("SketchArc_6") SketchArc_15.result().setName("SketchArc_6") @@ -371,9 +801,21 @@ SketchArc_15.results()[1].setName("SketchArc_6_2") SketchArc_14.setName("SketchArc_5") SketchArc_14.result().setName("SketchArc_5") SketchArc_14.results()[1].setName("SketchArc_5_2") -SketchConstraintMirror_2_objects = [SketchArc_12.results()[1], SketchArc_13.results()[1], SketchArc_14.results()[1], SketchArc_15.results()[1]] -SketchConstraintMirror_2 = Sketch_4.addMirror(SketchLine_39.result(), SketchConstraintMirror_2_objects) -[SketchArc_16, SketchArc_17, SketchArc_18, SketchArc_19] = SketchConstraintMirror_2.mirrored() +SketchConstraintMirror_2_objects = [ + SketchArc_12.results()[1], + SketchArc_13.results()[1], + SketchArc_14.results()[1], + SketchArc_15.results()[1], +] +SketchConstraintMirror_2 = Sketch_4.addMirror( + SketchLine_39.result(), SketchConstraintMirror_2_objects +) +[ + SketchArc_16, + SketchArc_17, + SketchArc_18, + SketchArc_19, +] = SketchConstraintMirror_2.mirrored() SketchArc_19.setName("SketchArc_10") SketchArc_19.result().setName("SketchArc_10") SketchArc_19.results()[1].setName("SketchArc_10_2") @@ -388,7 +830,15 @@ SketchArc_16.result().setName("SketchArc_7") SketchArc_16.results()[1].setName("SketchArc_7_2") model.do() Sketch_5 = model.addSketch(Part_2_doc, model.defaultPlane("XOZ")) -SketchArc_20 = Sketch_5.addArc(75, 0, 21.9522369740045, 53.01825004597796, 20.93617039352901, -51.98174995402206, False) +SketchArc_20 = Sketch_5.addArc( + 75, + 0, + 21.9522369740045, + 53.01825004597796, + 20.93617039352901, + -51.98174995402206, + False, +) SketchArc_20.setName("SketchArc_3") SketchArc_20.result().setName("SketchArc_3") SketchArc_20.results()[1].setName("SketchArc_3_2") @@ -397,113 +847,246 @@ SketchConstraintRadius_7 = Sketch_5.setRadius(SketchArc_20.results()[1], 75) SketchLine_41 = Sketch_5.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_41.setName("SketchLine_13") SketchLine_41.result().setName("SketchLine_13") -SketchConstraintCoincidence_73 = Sketch_5.setCoincident(SketchArc_20.center(), SketchLine_41.result()) +SketchConstraintCoincidence_73 = Sketch_5.setCoincident( + SketchArc_20.center(), SketchLine_41.result() +) SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_38") -SketchConstraintCoincidence_74 = Sketch_5.setCoincident(SketchLine_41.startPoint(), SketchArc_20.results()[1]) +SketchConstraintCoincidence_74 = Sketch_5.setCoincident( + SketchLine_41.startPoint(), SketchArc_20.results()[1] +) SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_39") -SketchLine_42 = Sketch_5.addLine(16.9522369740045, -56.98174995402205, 16.9522369740045, -46.98174995402206) +SketchLine_42 = Sketch_5.addLine( + 16.9522369740045, -56.98174995402205, 16.9522369740045, -46.98174995402206 +) SketchLine_42.setName("SketchLine_14") SketchLine_42.result().setName("SketchLine_14") -SketchLine_43 = Sketch_5.addLine(16.9522369740045, -46.98174995402206, 36.95223697400451, -46.98174995402206) +SketchLine_43 = Sketch_5.addLine( + 16.9522369740045, -46.98174995402206, 36.95223697400451, -46.98174995402206 +) SketchLine_43.setName("SketchLine_15") SketchLine_43.result().setName("SketchLine_15") -SketchConstraintCoincidence_75 = Sketch_5.setCoincident(SketchLine_42.endPoint(), SketchLine_43.startPoint()) +SketchConstraintCoincidence_75 = Sketch_5.setCoincident( + SketchLine_42.endPoint(), SketchLine_43.startPoint() +) SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_40") -SketchLine_44 = Sketch_5.addLine(36.95223697400451, -46.98174995402206, 31.17873428210827, -56.98174995402205) +SketchLine_44 = Sketch_5.addLine( + 36.95223697400451, -46.98174995402206, 31.17873428210827, -56.98174995402205 +) SketchLine_44.setName("SketchLine_16") SketchLine_44.result().setName("SketchLine_16") -SketchConstraintCoincidence_76 = Sketch_5.setCoincident(SketchLine_43.endPoint(), SketchLine_44.startPoint()) +SketchConstraintCoincidence_76 = Sketch_5.setCoincident( + SketchLine_43.endPoint(), SketchLine_44.startPoint() +) SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_41") -SketchLine_45 = Sketch_5.addLine(31.17873428210827, -56.98174995402205, 16.9522369740045, -56.98174995402205) +SketchLine_45 = Sketch_5.addLine( + 31.17873428210827, -56.98174995402205, 16.9522369740045, -56.98174995402205 +) SketchLine_45.setName("SketchLine_17") SketchLine_45.result().setName("SketchLine_17") -SketchConstraintCoincidence_77 = Sketch_5.setCoincident(SketchLine_44.endPoint(), SketchLine_45.startPoint()) +SketchConstraintCoincidence_77 = Sketch_5.setCoincident( + SketchLine_44.endPoint(), SketchLine_45.startPoint() +) SketchConstraintCoincidence_77.setName("SketchConstraintCoincidence_42") -SketchConstraintCoincidence_78 = Sketch_5.setCoincident(SketchLine_42.startPoint(), SketchLine_45.endPoint()) +SketchConstraintCoincidence_78 = Sketch_5.setCoincident( + SketchLine_42.startPoint(), SketchLine_45.endPoint() +) SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_43") SketchConstraintHorizontal_5 = Sketch_5.setHorizontal(SketchLine_43.result()) SketchConstraintHorizontal_6 = Sketch_5.setHorizontal(SketchLine_45.result()) SketchConstraintVertical_5 = Sketch_5.setVertical(SketchLine_42.result()) -SketchConstraintAngle_4 = Sketch_5.setAngleComplementary(SketchLine_44.result(), SketchLine_45.result(), 60.00000000000006) -SketchConstraintDistance_14 = Sketch_5.setDistance(SketchLine_43.endPoint(), SketchLine_42.result(), 20) -SketchConstraintDistance_15 = Sketch_5.setDistance(SketchLine_42.startPoint(), SketchLine_43.result(), 10) -SketchLine_46 = Sketch_5.addLine(21.9522369740045, 53.01825004597796, 21.9522369740045, 0) +SketchConstraintAngle_4 = Sketch_5.setAngleComplementary( + SketchLine_44.result(), SketchLine_45.result(), 60.00000000000006 +) +SketchConstraintDistance_14 = Sketch_5.setDistance( + SketchLine_43.endPoint(), SketchLine_42.result(), 20 +) +SketchConstraintDistance_15 = Sketch_5.setDistance( + SketchLine_42.startPoint(), SketchLine_43.result(), 10 +) +SketchLine_46 = Sketch_5.addLine( + 21.9522369740045, 53.01825004597796, 21.9522369740045, 0 +) SketchLine_46.setName("SketchLine_18") SketchLine_46.result().setName("SketchLine_18") SketchLine_46.setAuxiliary(True) -SketchConstraintCoincidence_79 = Sketch_5.setCoincident(SketchArc_20.startPoint(), SketchLine_46.startPoint()) +SketchConstraintCoincidence_79 = Sketch_5.setCoincident( + SketchArc_20.startPoint(), SketchLine_46.startPoint() +) SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_44") -SketchConstraintCoincidence_80 = Sketch_5.setCoincident(SketchLine_46.endPoint(), SketchLine_41.result()) +SketchConstraintCoincidence_80 = Sketch_5.setCoincident( + SketchLine_46.endPoint(), SketchLine_41.result() +) SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_45") SketchConstraintVertical_6 = Sketch_5.setVertical(SketchLine_46.result()) -SketchConstraintDistance_16 = Sketch_5.setDistance(SketchLine_42.endPoint(), SketchLine_46.result(), 5) -SketchConstraintDistance_17 = Sketch_5.setDistance(SketchArc_20.startPoint(), SketchLine_43.result(), 100) +SketchConstraintDistance_16 = Sketch_5.setDistance( + SketchLine_42.endPoint(), SketchLine_46.result(), 5 +) +SketchConstraintDistance_17 = Sketch_5.setDistance( + SketchArc_20.startPoint(), SketchLine_43.result(), 100 +) SketchCircle_6 = Sketch_5.addCircle(21.9522369740045, 53.01825004597796, 8) -SketchConstraintCoincidence_81 = Sketch_5.setCoincident(SketchArc_20.startPoint(), SketchCircle_6.center()) +SketchConstraintCoincidence_81 = Sketch_5.setCoincident( + SketchArc_20.startPoint(), SketchCircle_6.center() +) SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_46") -SketchConstraintCoincidence_82 = Sketch_5.setCoincident(SketchLine_46.startPoint(), SketchCircle_6.center()) +SketchConstraintCoincidence_82 = Sketch_5.setCoincident( + SketchLine_46.startPoint(), SketchCircle_6.center() +) SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_47") SketchConstraintRadius_8 = Sketch_5.setRadius(SketchCircle_6.results()[1], 8) SketchCircle_7 = Sketch_5.addCircle(21.9522369740045, 53.01825004597796, 4) -SketchConstraintCoincidence_83 = Sketch_5.setCoincident(SketchArc_20.startPoint(), SketchCircle_7.center()) +SketchConstraintCoincidence_83 = Sketch_5.setCoincident( + SketchArc_20.startPoint(), SketchCircle_7.center() +) SketchConstraintCoincidence_83.setName("SketchConstraintCoincidence_61") -SketchConstraintCoincidence_84 = Sketch_5.setCoincident(SketchLine_46.startPoint(), SketchCircle_7.center()) +SketchConstraintCoincidence_84 = Sketch_5.setCoincident( + SketchLine_46.startPoint(), SketchCircle_7.center() +) SketchConstraintCoincidence_84.setName("SketchConstraintCoincidence_62") -SketchConstraintCoincidence_85 = Sketch_5.setCoincident(SketchCircle_6.center(), SketchCircle_7.center()) +SketchConstraintCoincidence_85 = Sketch_5.setCoincident( + SketchCircle_6.center(), SketchCircle_7.center() +) SketchConstraintCoincidence_85.setName("SketchConstraintCoincidence_63") SketchConstraintRadius_9 = Sketch_5.setRadius(SketchCircle_7.results()[1], 4) -SketchLine_47 = Sketch_5.addLine(21.9522369740045, 53.01825004597796, 39.68353296044558, 53.01825004597796) +SketchLine_47 = Sketch_5.addLine( + 21.9522369740045, 53.01825004597796, 39.68353296044558, 53.01825004597796 +) SketchLine_47.setName("SketchLine_19") SketchLine_47.result().setName("SketchLine_19") SketchLine_47.setAuxiliary(True) -SketchConstraintCoincidence_86 = Sketch_5.setCoincident(SketchArc_20.startPoint(), SketchLine_47.startPoint()) +SketchConstraintCoincidence_86 = Sketch_5.setCoincident( + SketchArc_20.startPoint(), SketchLine_47.startPoint() +) SketchConstraintCoincidence_86.setName("SketchConstraintCoincidence_64") -SketchConstraintCoincidence_87 = Sketch_5.setCoincident(SketchLine_46.startPoint(), SketchLine_47.startPoint()) +SketchConstraintCoincidence_87 = Sketch_5.setCoincident( + SketchLine_46.startPoint(), SketchLine_47.startPoint() +) SketchConstraintCoincidence_87.setName("SketchConstraintCoincidence_65") -SketchConstraintCoincidence_88 = Sketch_5.setCoincident(SketchCircle_6.center(), SketchLine_47.startPoint()) +SketchConstraintCoincidence_88 = Sketch_5.setCoincident( + SketchCircle_6.center(), SketchLine_47.startPoint() +) SketchConstraintCoincidence_88.setName("SketchConstraintCoincidence_66") -SketchConstraintCoincidence_89 = Sketch_5.setCoincident(SketchCircle_7.center(), SketchLine_47.startPoint()) +SketchConstraintCoincidence_89 = Sketch_5.setCoincident( + SketchCircle_7.center(), SketchLine_47.startPoint() +) SketchConstraintCoincidence_89.setName("SketchConstraintCoincidence_67") SketchConstraintHorizontal_7 = Sketch_5.setHorizontal(SketchLine_47.result()) -SketchConstraintDistance_18 = Sketch_5.setDistance(SketchArc_20.endPoint(), SketchLine_47.result(), 105) +SketchConstraintDistance_18 = Sketch_5.setDistance( + SketchArc_20.endPoint(), SketchLine_47.result(), 105 +) SketchLine_48 = Sketch_5.addLine(75, 0, 20.93617039352901, -51.98174995402206) SketchLine_48.setName("SketchLine_20") SketchLine_48.result().setName("SketchLine_20") SketchLine_48.setAuxiliary(True) -SketchConstraintCoincidence_90 = Sketch_5.setCoincident(SketchArc_20.center(), SketchLine_48.startPoint()) +SketchConstraintCoincidence_90 = Sketch_5.setCoincident( + SketchArc_20.center(), SketchLine_48.startPoint() +) SketchConstraintCoincidence_90.setName("SketchConstraintCoincidence_68") -SketchConstraintCoincidence_91 = Sketch_5.setCoincident(SketchArc_20.endPoint(), SketchLine_48.endPoint()) +SketchConstraintCoincidence_91 = Sketch_5.setCoincident( + SketchArc_20.endPoint(), SketchLine_48.endPoint() +) SketchConstraintCoincidence_91.setName("SketchConstraintCoincidence_69") SketchLine_49 = Sketch_5.addLine(21.9522369740045, 53.01825004597796, 0, 10) SketchLine_49.setName("SketchLine_21") SketchLine_49.result().setName("SketchLine_21") SketchLine_49.setAuxiliary(True) -SketchConstraintCoincidence_92 = Sketch_5.setCoincident(SketchArc_20.startPoint(), SketchLine_49.startPoint()) +SketchConstraintCoincidence_92 = Sketch_5.setCoincident( + SketchArc_20.startPoint(), SketchLine_49.startPoint() +) SketchConstraintCoincidence_92.setName("SketchConstraintCoincidence_70") -SketchConstraintCoincidence_93 = Sketch_5.setCoincident(SketchLine_46.startPoint(), SketchLine_49.startPoint()) +SketchConstraintCoincidence_93 = Sketch_5.setCoincident( + SketchLine_46.startPoint(), SketchLine_49.startPoint() +) SketchConstraintCoincidence_93.setName("SketchConstraintCoincidence_71") -SketchConstraintCoincidence_94 = Sketch_5.setCoincident(SketchCircle_6.center(), SketchLine_49.startPoint()) +SketchConstraintCoincidence_94 = Sketch_5.setCoincident( + SketchCircle_6.center(), SketchLine_49.startPoint() +) SketchConstraintCoincidence_94.setName("SketchConstraintCoincidence_72") -SketchConstraintCoincidence_95 = Sketch_5.setCoincident(SketchCircle_7.center(), SketchLine_49.startPoint()) +SketchConstraintCoincidence_95 = Sketch_5.setCoincident( + SketchCircle_7.center(), SketchLine_49.startPoint() +) SketchConstraintCoincidence_95.setName("SketchConstraintCoincidence_73") -SketchConstraintCoincidence_96 = Sketch_5.setCoincident(SketchLine_47.startPoint(), SketchLine_49.startPoint()) +SketchConstraintCoincidence_96 = Sketch_5.setCoincident( + SketchLine_47.startPoint(), SketchLine_49.startPoint() +) SketchConstraintCoincidence_96.setName("SketchConstraintCoincidence_74") SketchLine_50 = Sketch_5.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_50.setName("SketchLine_22") SketchLine_50.result().setName("SketchLine_22") -SketchConstraintCoincidence_97 = Sketch_5.setCoincident(SketchLine_49.endPoint(), SketchLine_50.result()) +SketchConstraintCoincidence_97 = Sketch_5.setCoincident( + SketchLine_49.endPoint(), SketchLine_50.result() +) SketchConstraintCoincidence_97.setName("SketchConstraintCoincidence_75") -SketchConstraintDistance_19 = Sketch_5.setDistance(SketchLine_49.endPoint(), SketchLine_41.result(), 10) +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/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/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/SketchCircle_2_2__cc"), model.selection("VERTEX", "Sketch_2/SketchLine_21_EndVertex")) +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/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/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") @@ -511,9 +1094,28 @@ model.do() Part_4 = model.duplicatePart(Part_3) Part_4.setName("Arm 3") model.do() -Translation_4 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_2/"), model.selection("COMPOUND", "Part_3/"), model.selection("COMPOUND", "Part_4/")], model.selection("EDGE", "OX"), -40) -Rotation_6 = model.addRotation(partSet, [model.selection("COMPOUND", "Translation_1_2/")], model.selection("EDGE", "OZ"), 120) -Rotation_7 = model.addRotation(partSet, [model.selection("COMPOUND", "Translation_1_3/")], model.selection("EDGE", "OZ"), 240) +Translation_4 = model.addTranslation( + partSet, + [ + model.selection("COMPOUND", "Part_2/"), + model.selection("COMPOUND", "Part_3/"), + model.selection("COMPOUND", "Part_4/"), + ], + model.selection("EDGE", "OX"), + -40, +) +Rotation_6 = model.addRotation( + partSet, + [model.selection("COMPOUND", "Translation_1_2/")], + model.selection("EDGE", "OZ"), + 120, +) +Rotation_7 = model.addRotation( + partSet, + [model.selection("COMPOUND", "Translation_1_3/")], + model.selection("EDGE", "OZ"), + 240, +) Part_5 = model.addPart(partSet) Part_5.setName("Rod part") Part_5_doc = Part_5.document() @@ -521,85 +1123,229 @@ Parameter_H = model.addParameter(partSet, "H", "110") Sketch_10 = model.addSketch(Part_5_doc, model.defaultPlane("YOZ")) SketchLine_93 = Sketch_10.addLine(0, 25, 6, 25) SketchLine_94 = Sketch_10.addLine(6, 25, 6, -75) -SketchConstraintCoincidence_232 = Sketch_10.setCoincident(SketchLine_93.endPoint(), SketchLine_94.startPoint()) +SketchConstraintCoincidence_232 = Sketch_10.setCoincident( + SketchLine_93.endPoint(), SketchLine_94.startPoint() +) SketchLine_95 = Sketch_10.addLine(6, -75, 4, -75) -SketchConstraintCoincidence_233 = Sketch_10.setCoincident(SketchLine_94.endPoint(), SketchLine_95.startPoint()) +SketchConstraintCoincidence_233 = Sketch_10.setCoincident( + SketchLine_94.endPoint(), SketchLine_95.startPoint() +) SketchLine_96 = Sketch_10.addLine(4, -75, 4, -81.00000000054168) -SketchConstraintCoincidence_234 = Sketch_10.setCoincident(SketchLine_95.endPoint(), SketchLine_96.startPoint()) +SketchConstraintCoincidence_234 = Sketch_10.setCoincident( + SketchLine_95.endPoint(), SketchLine_96.startPoint() +) SketchLine_97 = Sketch_10.addLine(4, -81.00000000054168, 0, -85) -SketchConstraintCoincidence_235 = Sketch_10.setCoincident(SketchLine_96.endPoint(), SketchLine_97.startPoint()) +SketchConstraintCoincidence_235 = Sketch_10.setCoincident( + SketchLine_96.endPoint(), SketchLine_97.startPoint() +) SketchLine_98 = Sketch_10.addLine(0, -85, 0, 25) -SketchConstraintCoincidence_236 = Sketch_10.setCoincident(SketchLine_97.endPoint(), SketchLine_98.startPoint()) -SketchConstraintCoincidence_237 = Sketch_10.setCoincident(SketchLine_93.startPoint(), SketchLine_98.endPoint()) +SketchConstraintCoincidence_236 = Sketch_10.setCoincident( + SketchLine_97.endPoint(), SketchLine_98.startPoint() +) +SketchConstraintCoincidence_237 = Sketch_10.setCoincident( + SketchLine_93.startPoint(), SketchLine_98.endPoint() +) SketchConstraintVertical_15 = Sketch_10.setVertical(SketchLine_98.result()) SketchConstraintVertical_16 = Sketch_10.setVertical(SketchLine_94.result()) SketchConstraintVertical_17 = Sketch_10.setVertical(SketchLine_96.result()) SketchConstraintHorizontal_18 = Sketch_10.setHorizontal(SketchLine_93.result()) SketchConstraintHorizontal_19 = Sketch_10.setHorizontal(SketchLine_95.result()) -SketchConstraintAngle_7 = Sketch_10.setAngle(SketchLine_97.result(), SketchLine_98.result(), 45.00000000387975) -SketchConstraintDistance_32 = Sketch_10.setDistance(SketchLine_97.endPoint(), SketchLine_95.result(), 10) -SketchConstraintDistance_33 = Sketch_10.setDistance(SketchLine_97.startPoint(), SketchLine_98.result(), 4) +SketchConstraintAngle_7 = Sketch_10.setAngle( + SketchLine_97.result(), SketchLine_98.result(), 45.00000000387975 +) +SketchConstraintDistance_32 = Sketch_10.setDistance( + SketchLine_97.endPoint(), SketchLine_95.result(), 10 +) +SketchConstraintDistance_33 = Sketch_10.setDistance( + SketchLine_97.startPoint(), SketchLine_98.result(), 4 +) SketchConstraintLength_7 = Sketch_10.setLength(SketchLine_93.result(), "Rod/2") -SketchConstraintDistance_34 = Sketch_10.setDistance(SketchLine_97.endPoint(), SketchLine_93.result(), "H") +SketchConstraintDistance_34 = Sketch_10.setDistance( + SketchLine_97.endPoint(), SketchLine_93.result(), "H" +) SketchPoint_7 = Sketch_10.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_238 = Sketch_10.setCoincident(SketchPoint_7.coordinates(), SketchLine_98.result()) +SketchConstraintCoincidence_238 = Sketch_10.setCoincident( + SketchPoint_7.coordinates(), SketchLine_98.result() +) SketchLine_99 = Sketch_10.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintDistance_35 = Sketch_10.setDistance(SketchLine_98.endPoint(), SketchLine_99.result(), "Thickness") +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_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")) +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/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") +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) -SketchLine_101 = Sketch_11.addLine(-8.5, 4.907477288111821, -2.182790672831509e-014, 9.814954576223595) -SketchConstraintCoincidence_240 = Sketch_11.setCoincident(SketchLine_100.endPoint(), SketchLine_101.startPoint()) -SketchLine_102 = Sketch_11.addLine(-2.182790672831509e-014, 9.814954576223595, 8.5, 4.907477288111624) -SketchConstraintCoincidence_241 = Sketch_11.setCoincident(SketchLine_101.endPoint(), SketchLine_102.startPoint()) +SketchLine_101 = Sketch_11.addLine( + -8.5, 4.907477288111821, -2.182790672831509e-014, 9.814954576223595 +) +SketchConstraintCoincidence_240 = Sketch_11.setCoincident( + SketchLine_100.endPoint(), SketchLine_101.startPoint() +) +SketchLine_102 = Sketch_11.addLine( + -2.182790672831509e-014, 9.814954576223595, 8.5, 4.907477288111624 +) +SketchConstraintCoincidence_241 = Sketch_11.setCoincident( + SketchLine_101.endPoint(), SketchLine_102.startPoint() +) SketchLine_103 = Sketch_11.addLine(8.5, 4.907477288111624, 8.5, -4.907477288111966) -SketchConstraintCoincidence_242 = Sketch_11.setCoincident(SketchLine_102.endPoint(), SketchLine_103.startPoint()) -SketchLine_104 = Sketch_11.addLine(8.5, -4.907477288111966, 4.843087198023196e-015, -9.814954576223641) -SketchConstraintCoincidence_243 = Sketch_11.setCoincident(SketchLine_103.endPoint(), SketchLine_104.startPoint()) -SketchLine_105 = Sketch_11.addLine(4.843087198023196e-015, -9.814954576223641, -8.5, -4.907477288111821) -SketchConstraintCoincidence_244 = Sketch_11.setCoincident(SketchLine_104.endPoint(), SketchLine_105.startPoint()) -SketchConstraintCoincidence_245 = Sketch_11.setCoincident(SketchLine_100.startPoint(), SketchLine_105.endPoint()) +SketchConstraintCoincidence_242 = Sketch_11.setCoincident( + SketchLine_102.endPoint(), SketchLine_103.startPoint() +) +SketchLine_104 = Sketch_11.addLine( + 8.5, -4.907477288111966, 4.843087198023196e-015, -9.814954576223641 +) +SketchConstraintCoincidence_243 = Sketch_11.setCoincident( + SketchLine_103.endPoint(), SketchLine_104.startPoint() +) +SketchLine_105 = Sketch_11.addLine( + 4.843087198023196e-015, -9.814954576223641, -8.5, -4.907477288111821 +) +SketchConstraintCoincidence_244 = Sketch_11.setCoincident( + SketchLine_104.endPoint(), SketchLine_105.startPoint() +) +SketchConstraintCoincidence_245 = Sketch_11.setCoincident( + SketchLine_100.startPoint(), SketchLine_105.endPoint() +) SketchConstraintVertical_18 = Sketch_11.setVertical(SketchLine_100.result()) SketchConstraintVertical_19 = Sketch_11.setVertical(SketchLine_103.result()) -SketchConstraintTangent_15 = Sketch_11.setTangent(SketchCircle_14.results()[1], SketchLine_103.result()) -SketchConstraintTangent_16 = Sketch_11.setTangent(SketchCircle_14.results()[1], SketchLine_100.result()) -SketchConstraintTangent_17 = Sketch_11.setTangent(SketchLine_104.result(), SketchCircle_14.results()[1]) -SketchConstraintTangent_18 = Sketch_11.setTangent(SketchLine_105.result(), SketchCircle_14.results()[1]) -SketchConstraintTangent_19 = Sketch_11.setTangent(SketchLine_101.result(), SketchCircle_14.results()[1]) -SketchConstraintTangent_20 = Sketch_11.setTangent(SketchLine_102.result(), SketchCircle_14.results()[1]) -SketchConstraintEqual_7 = Sketch_11.setEqual(SketchLine_100.result(), SketchLine_101.result()) -SketchConstraintEqual_8 = Sketch_11.setEqual(SketchLine_101.result(), SketchLine_102.result()) -SketchConstraintEqual_9 = Sketch_11.setEqual(SketchLine_102.result(), SketchLine_103.result()) -SketchConstraintEqual_10 = Sketch_11.setEqual(SketchLine_103.result(), SketchLine_104.result()) +SketchConstraintTangent_15 = Sketch_11.setTangent( + SketchCircle_14.results()[1], SketchLine_103.result() +) +SketchConstraintTangent_16 = Sketch_11.setTangent( + SketchCircle_14.results()[1], SketchLine_100.result() +) +SketchConstraintTangent_17 = Sketch_11.setTangent( + SketchLine_104.result(), SketchCircle_14.results()[1] +) +SketchConstraintTangent_18 = Sketch_11.setTangent( + SketchLine_105.result(), SketchCircle_14.results()[1] +) +SketchConstraintTangent_19 = Sketch_11.setTangent( + SketchLine_101.result(), SketchCircle_14.results()[1] +) +SketchConstraintTangent_20 = Sketch_11.setTangent( + SketchLine_102.result(), SketchCircle_14.results()[1] +) +SketchConstraintEqual_7 = Sketch_11.setEqual( + SketchLine_100.result(), SketchLine_101.result() +) +SketchConstraintEqual_8 = Sketch_11.setEqual( + SketchLine_101.result(), SketchLine_102.result() +) +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_13r-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r")], 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) -SketchConstraintCoincidence_246 = Sketch_12.setCoincident(SketchLine_106.endPoint(), SketchLine_107.startPoint()) -SketchLine_108 = Sketch_12.addLine(4, 52.35726558990813, 9.814954576223595, 48.99999999999999) -SketchConstraintCoincidence_247 = Sketch_12.setCoincident(SketchLine_107.endPoint(), SketchLine_108.startPoint()) -SketchConstraintCoincidence_248 = Sketch_12.setCoincident(SketchLine_106.startPoint(), SketchLine_108.endPoint()) +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 +) +SketchConstraintCoincidence_246 = Sketch_12.setCoincident( + SketchLine_106.endPoint(), SketchLine_107.startPoint() +) +SketchLine_108 = Sketch_12.addLine( + 4, 52.35726558990813, 9.814954576223595, 48.99999999999999 +) +SketchConstraintCoincidence_247 = Sketch_12.setCoincident( + SketchLine_107.endPoint(), SketchLine_108.startPoint() +) +SketchConstraintCoincidence_248 = Sketch_12.setCoincident( + SketchLine_106.startPoint(), SketchLine_108.endPoint() +) 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&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&Sketch_2/SketchLine_10][Extrusion_1_1/To_Face]"), False) +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&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&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) +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) +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_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")], []) +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")], + [], +) # Test reexecution after parameter change Parameter_H.setValue(120) @@ -609,7 +1355,7 @@ Parameter_H.setValue(110) model.do() model.end() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Part_1, 1) model.testNbSubResults(Part_1, [0]) @@ -625,7 +1371,14 @@ model.testNbSubShapes(Translation_4, GeomAPI_Shape.SOLID, [1, 1, 1]) model.testNbSubShapes(Translation_4, GeomAPI_Shape.FACE, [19, 19, 19]) model.testNbSubShapes(Translation_4, GeomAPI_Shape.EDGE, [102, 102, 102]) model.testNbSubShapes(Translation_4, GeomAPI_Shape.VERTEX, [204, 204, 204]) -model.testResultsVolumes(Translation_4, [11018.354015402081131469458341599, 11018.354015402081131469458341599, 11018.354015402081131469458341599]) +model.testResultsVolumes( + Translation_4, + [ + 11018.354015402081131469458341599, + 11018.354015402081131469458341599, + 11018.354015402081131469458341599, + ], +) model.testNbResults(Rotation_6, 1) model.testNbSubResults(Rotation_6, [0]) @@ -651,4 +1404,4 @@ model.testNbSubShapes(Part_5, GeomAPI_Shape.EDGE, [55]) model.testNbSubShapes(Part_5, GeomAPI_Shape.VERTEX, [110]) model.testResultsVolumes(Part_5, [17921.797961347954696975648403168]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.models/bobine_film_reel.py b/test.models/bobine_film_reel.py index 7d2855a84..cb4d9615d 100644 --- a/test.models/bobine_film_reel.py +++ b/test.models/bobine_film_reel.py @@ -33,85 +33,193 @@ model.addParameter(Part_1_doc, "R3", "25.9") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 40) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchPoint_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchPoint_1.result() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "R") SketchLine_1 = Sketch_1.addLine(0, 0, -20.88093073029438, 34.1172497695333) SketchLine_1.setAuxiliary(True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchCircle_1.center(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_1.startPoint() +) +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) +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")) -SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1")) +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") -SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident( + SketchAPI_Line(SketchLine_2).startPoint(), SketchCircle_2.center() +) 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_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")) 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/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()) +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")) -SketchProjection_3 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1")) +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") -SketchConstraintCoincidence_7 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_4).startPoint(), SketchCircle_4.center()) +SketchConstraintCoincidence_7 = Sketch_4.setCoincident( + SketchAPI_Line(SketchLine_4).startPoint(), SketchCircle_4.center() +) 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")) -SketchProjection_4 = Sketch_5.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1")) +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) -SketchConstraintCoincidence_8 = Sketch_5.setCoincident(SketchAPI_Line(SketchLine_5).startPoint(), SketchCircle_5.center()) +SketchConstraintCoincidence_8 = Sketch_5.setCoincident( + SketchAPI_Line(SketchLine_5).startPoint(), SketchCircle_5.center() +) 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"), 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")) +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"), + 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 = 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/Modified_Face&Extrusion_1_1/From_Face")) +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()) +SketchConstraintCoincidence_10 = Sketch_7.setCoincident( + SketchCircle_7.center(), SketchLine_6.result() +) SketchConstraintRadius_7 = Sketch_7.setRadius(SketchCircle_7.results()[1], 66) -SketchConstraintDistance_1 = Sketch_7.setDistance(SketchCircle_7.center(), SketchLine_6.startPoint(), 85) -SketchMultiRotation_1 = Sketch_7.addRotation([SketchCircle_7.results()[1]], SketchLine_6.startPoint(), 120, 3) +SketchConstraintDistance_1 = Sketch_7.setDistance( + SketchCircle_7.center(), SketchLine_6.startPoint(), 85 +) +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/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) +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) -SketchConstraintCoincidence_11 = Sketch_8.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchLine_8 = Sketch_8.addLine( + -7, 11.00000001704673, -6.329882773485103e-016, 30.00000001704673 +) +SketchConstraintCoincidence_11 = Sketch_8.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_8.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintCoincidence_12 = Sketch_8.setCoincident(SketchLine_7.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_13 = Sketch_8.setCoincident(SketchLine_8.endPoint(), SketchLine_9.result()) -SketchConstraintMirror_1 = Sketch_8.addMirror(SketchLine_9.result(), [SketchLine_7.result(), SketchLine_8.result()]) +SketchConstraintCoincidence_12 = Sketch_8.setCoincident( + SketchLine_7.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_13 = Sketch_8.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.result() +) +SketchConstraintMirror_1 = Sketch_8.addMirror( + SketchLine_9.result(), [SketchLine_7.result(), SketchLine_8.result()] +) [SketchLine_10, SketchLine_11] = SketchConstraintMirror_1.mirrored() SketchConstraintLength_1 = Sketch_8.setLength(SketchLine_7.result(), 7) -SketchConstraintDistance_2 = Sketch_8.setDistance(SketchLine_9.startPoint(), SketchLine_7.result(), 11) -SketchConstraintDistance_3 = Sketch_8.setDistance(SketchLine_8.endPoint(), SketchLine_9.startPoint(), 30) -SketchMultiRotation_2_objects = [SketchLine_11.result(), SketchLine_10.result(), SketchLine_8.result(), SketchLine_7.result()] -SketchMultiRotation_2 = Sketch_8.addRotation(SketchMultiRotation_2_objects, SketchLine_9.startPoint(), 120, 3) -[SketchLine_12, SketchLine_13, SketchLine_14, SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18, SketchLine_19] = SketchMultiRotation_2.rotatedList() +SketchConstraintDistance_2 = Sketch_8.setDistance( + SketchLine_9.startPoint(), SketchLine_7.result(), 11 +) +SketchConstraintDistance_3 = Sketch_8.setDistance( + SketchLine_8.endPoint(), SketchLine_9.startPoint(), 30 +) +SketchMultiRotation_2_objects = [ + SketchLine_11.result(), + SketchLine_10.result(), + SketchLine_8.result(), + SketchLine_7.result(), +] +SketchMultiRotation_2 = Sketch_8.addRotation( + SketchMultiRotation_2_objects, SketchLine_9.startPoint(), 120, 3 +) +[ + SketchLine_12, + SketchLine_13, + SketchLine_14, + SketchLine_15, + SketchLine_16, + SketchLine_17, + SketchLine_18, + SketchLine_19, +] = SketchMultiRotation_2.rotatedList() SketchLine_18.setName("SketchLine_15") SketchLine_18.result().setName("SketchLine_15") SketchLine_17.setName("SketchLine_18") @@ -125,8 +233,30 @@ SketchLine_14.result().setName("SketchLine_13") SketchLine_13.setName("SketchLine_16") SketchLine_13.result().setName("SketchLine_16") model.do() -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")]) +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) @@ -145,4 +275,4 @@ model.testNbSubShapes(ExtrusionCut_3, GeomAPI_Shape.EDGE, [300]) model.testNbSubShapes(ExtrusionCut_3, GeomAPI_Shape.VERTEX, [600]) model.testResultsVolumes(ExtrusionCut_3, [34439.077343526856566313654184341]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.models/bracket32.py b/test.models/bracket32.py index bdcfb3099..5a95faa45 100644 --- a/test.models/bracket32.py +++ b/test.models/bracket32.py @@ -38,18 +38,30 @@ model.addParameter(Part_1_doc, "BaseLegFillet", "3") model.addParameter(Part_1_doc, "LegTopFillet", "2") model.addParameter(Part_1_doc, "BottomCutFillet", "2") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchLine_1 = Sketch_1.addLine(56, -3.652030108005817e-032, 20.9106603007908, -1.450725046594067e-032) +SketchLine_1 = Sketch_1.addLine( + 56, -3.652030108005817e-032, 20.9106603007908, -1.450725046594067e-032 +) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) -SketchLine_3 = Sketch_1.addLine(20.9106603007908, -1.450725046594067e-032, 17.67553830650723, 18.34728855042577) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) +SketchLine_3 = Sketch_1.addLine( + 20.9106603007908, -1.450725046594067e-032, 17.67553830650723, 18.34728855042577 +) SketchLine_3.setName("SketchLine_33") SketchLine_3.result().setName("SketchLine_33") -SketchLine_4 = Sketch_1.addLine(20.9106603007908, -1.450725046594067e-032, 17.3841206866215, 20) +SketchLine_4 = Sketch_1.addLine( + 20.9106603007908, -1.450725046594067e-032, 17.3841206866215, 20 +) SketchLine_4.setName("SketchLine_3") SketchLine_4.result().setName("SketchLine_3") SketchLine_4.setAuxiliary(True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(15.70591356041877, 20, 0, 20) SketchLine_5.setName("SketchLine_32") SketchLine_5.result().setName("SketchLine_32") @@ -57,11 +69,15 @@ SketchLine_6 = Sketch_1.addLine(17.3841206866215, 20, 0, 20) SketchLine_6.setName("SketchLine_4") SketchLine_6.result().setName("SketchLine_4") SketchLine_6.setAuxiliary(True) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_7.setName("SketchLine_5") SketchLine_7.result().setName("SketchLine_5") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.result()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.result() +) SketchLine_8 = Sketch_1.addLine(11, 85, 24.49270766728805, 8.479052309092824) SketchLine_8.setName("SketchLine_77") SketchLine_8.result().setName("SketchLine_77") @@ -81,80 +97,148 @@ SketchLine_13 = Sketch_1.addLine(11, 85, 24.92983147596873, 6) SketchLine_13.setName("SketchLine_8") SketchLine_13.result().setName("SketchLine_8") SketchLine_13.setAuxiliary(True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_9") SketchLine_14 = Sketch_1.addLine(24.92983147596873, 6, 56, 6) SketchLine_14.setName("SketchLine_9") SketchLine_14.result().setName("SketchLine_9") SketchLine_14.setAuxiliary(True) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_10") SketchLine_15 = Sketch_1.addLine(56, 6, 56, -3.652030108005817e-032) SketchLine_15.setName("SketchLine_10") SketchLine_15.result().setName("SketchLine_10") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_11") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_15.endPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_15.endPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_12") SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_12.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_14.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_15.result()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_14.result(), SketchLine_13.result(), "Draft") -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_13.result(), SketchLine_4.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_4.endPoint(), SketchLine_13.result(), "LegThick") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_14.endPoint(), SketchLine_1.result(), 6) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_1.result(), 20) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_12.startPoint(), SketchLine_7.result()) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_14.result(), SketchLine_13.result(), "Draft" +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_13.result(), SketchLine_4.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_4.endPoint(), SketchLine_13.result(), "LegThick" +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_14.endPoint(), SketchLine_1.result(), 6 +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.endPoint(), SketchLine_1.result(), 20 +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_12.startPoint(), SketchLine_7.result() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_13") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_13.startPoint(), SketchLine_7.result(), "TDE/2") -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_13.startPoint(), SketchLine_1.result(), 85) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_13.startPoint(), SketchLine_7.result(), "TDE/2" +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_13.startPoint(), SketchLine_1.result(), 85 +) SketchConstraintDistance_5.setName("SketchConstraintDistance_11") -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_7.result(), "Width/2") +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_7.result(), "Width/2" +) SketchConstraintDistance_6.setName("SketchConstraintDistance_12") SketchLine_16 = Sketch_1.addLine(11, 85, 24.92983147596873, 6) SketchLine_16.setName("SketchLine_30") SketchLine_16.result().setName("SketchLine_30") SketchLine_16.setAuxiliary(True) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_13.startPoint(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_13.startPoint(), SketchLine_16.startPoint() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_24") SketchLine_17 = Sketch_1.addLine(24.92983147596873, 6, 56, 6) SketchLine_17.setName("SketchLine_31") SketchLine_17.result().setName("SketchLine_31") SketchLine_17.setAuxiliary(True) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_17.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchLine_17.endPoint() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_25") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_13.result()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_16.endPoint(), SketchLine_13.result() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_26") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_17.startPoint(), SketchLine_14.result()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_17.startPoint(), SketchLine_14.result() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_27") -SketchArc_1 = Sketch_1.addArc(15.70592142426694, 18, 17.67553830650723, 18.34728855042577, 15.70591356041877, 20, False) +SketchArc_1 = Sketch_1.addArc( + 15.70592142426694, + 18, + 17.67553830650723, + 18.34728855042577, + 15.70591356041877, + 20, + False, +) SketchArc_1.setName("SketchArc_2") SketchArc_1.result().setName("SketchArc_2") SketchArc_1.results()[1].setName("SketchArc_2_2") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_3.endPoint() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_28") -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_29") -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_5.result()) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_5.result() +) SketchConstraintTangent_1.setName("SketchConstraintTangent_3") -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_3.result()) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_3.result() +) SketchConstraintTangent_2.setName("SketchConstraintTangent_4") -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_5.endPoint() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_30") -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_4.startPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_31") -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_6.result() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_32") -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.result()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.result() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_33") SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "LegTopFillet") SketchConstraintRadius_1.setName("SketchConstraintRadius_7") -SketchArc_2 = Sketch_1.addArc(-15.70592142426695, 18, -15.70592154309944, 20, -17.67553694121995, 18.34729629335474, False) +SketchArc_2 = Sketch_1.addArc( + -15.70592142426695, + 18, + -15.70592154309944, + 20, + -17.67553694121995, + 18.34729629335474, + False, +) SketchArc_2.setName("SketchArc_3") SketchArc_2.result().setName("SketchArc_3") SketchArc_2.results()[1].setName("SketchArc_3_2") -SketchLine_18 = Sketch_1.addLine(-20.91066030079081, 0, -17.67553694121995, 18.34729629335474) +SketchLine_18 = Sketch_1.addLine( + -20.91066030079081, 0, -17.67553694121995, 18.34729629335474 +) SketchLine_18.setName("SketchLine_34") SketchLine_18.result().setName("SketchLine_34") SketchLine_19 = Sketch_1.addLine(-56, 0, -20.91066030079081, 0) @@ -175,7 +259,9 @@ SketchLine_23 = Sketch_1.addLine(-11, 85, -24.92983147596874, 6) SketchLine_23.setName("SketchLine_37") SketchLine_23.result().setName("SketchLine_37") SketchLine_23.setAuxiliary(True) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_23.startPoint(), SketchLine_7.result(), "TDE/2") +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchLine_23.startPoint(), SketchLine_7.result(), "TDE/2" +) SketchConstraintDistance_7.setName("SketchConstraintDistance_31") SketchLine_24 = Sketch_1.addLine(-24.92983147596874, 6, -56, 6) SketchLine_24.setName("SketchLine_39") @@ -185,89 +271,173 @@ SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_24.result()) SketchConstraintHorizontal_5.setName("SketchConstraintHorizontal_19") SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_19.result()) SketchConstraintHorizontal_6.setName("SketchConstraintHorizontal_20") -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_24.endPoint(), SketchLine_19.result(), "BPS") +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchLine_24.endPoint(), SketchLine_19.result(), "BPS" +) SketchConstraintDistance_8.setName("SketchConstraintDistance_32") -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_23.startPoint(), SketchLine_21.endPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_23.startPoint(), SketchLine_21.endPoint() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_113") -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_20.endPoint(), SketchLine_7.result(), "Width/2") +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_20.endPoint(), SketchLine_7.result(), "Width/2" +) SketchConstraintDistance_9.setName("SketchConstraintDistance_33") -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_24.endPoint(), SketchLine_20.startPoint() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_114") -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_20.endPoint(), SketchLine_19.startPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_115") -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_18.startPoint() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_116") -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_18.endPoint()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_18.endPoint() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_117") SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_20.result()) SketchConstraintVertical_2.setName("SketchConstraintVertical_16") -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_23.result(), SketchLine_18.result()) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchLine_2.result(), SketchLine_19.endPoint()) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_23.result(), SketchLine_18.result() +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchLine_19.endPoint() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_118") -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_22.startPoint(), SketchArc_2.startPoint()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_22.startPoint(), SketchArc_2.startPoint() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_119") SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], "LegTopFillet") SketchConstraintRadius_2.setName("SketchConstraintRadius_16") SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_22.result()) SketchConstraintHorizontal_7.setName("SketchConstraintHorizontal_21") -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchLine_22.endPoint(), SketchLine_5.endPoint() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_120") -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_22.result()) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_22.result() +) SketchConstraintTangent_3.setName("SketchConstraintTangent_19") -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_18.result(), SketchArc_2.results()[1]) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchLine_18.result(), SketchArc_2.results()[1] +) SketchConstraintTangent_4.setName("SketchConstraintTangent_20") -SketchConstraintAngle_2 = Sketch_1.setAngleBackward(SketchLine_19.result(), SketchLine_23.result(), "Draft") -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_17.startPoint(), SketchLine_16.endPoint()) +SketchConstraintAngle_2 = Sketch_1.setAngleBackward( + SketchLine_19.result(), SketchLine_23.result(), "Draft" +) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_17.startPoint(), SketchLine_16.endPoint() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_121") -SketchArc_3 = Sketch_1.addArc(27.44713036950057, 9.000000000000002, 24.49270766728805, 8.479052309092824, 27.44713044942998, 5.999999999999999, False) +SketchArc_3 = Sketch_1.addArc( + 27.44713036950057, + 9.000000000000002, + 24.49270766728805, + 8.479052309092824, + 27.44713044942998, + 5.999999999999999, + False, +) SketchArc_3.setName("SketchArc_12") SketchArc_3.result().setName("SketchArc_12") SketchArc_3.results()[1].setName("SketchArc_12_2") -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchLine_8.endPoint() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_122") -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_9.startPoint() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_123") -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_8.result()) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_8.result() +) SketchConstraintTangent_5.setName("SketchConstraintTangent_21") -SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_9.result()) +SketchConstraintTangent_6 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_9.result() +) SketchConstraintTangent_6.setName("SketchConstraintTangent_22") -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchLine_16.startPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchLine_16.startPoint(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_124") -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_9.endPoint()) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_9.endPoint() +) SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_125") -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_16.result()) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_16.result() +) SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_126") -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchLine_17.result()) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchLine_9.startPoint(), SketchLine_17.result() +) SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_127") SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_3.results()[1], "BaseLegFillet") SketchConstraintRadius_3.setName("SketchConstraintRadius_17") -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchLine_24.startPoint(), SketchLine_23.endPoint()) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchLine_24.startPoint(), SketchLine_23.endPoint() +) SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_128") -SketchArc_4 = Sketch_1.addArc(-27.44713036950059, 9, -27.44713039880284, 6, -24.49270712488033, 8.479055385239919, False) +SketchArc_4 = Sketch_1.addArc( + -27.44713036950059, + 9, + -27.44713039880284, + 6, + -24.49270712488033, + 8.479055385239919, + False, +) SketchArc_4.setName("SketchArc_13") SketchArc_4.result().setName("SketchArc_13") SketchArc_4.results()[1].setName("SketchArc_13_2") -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchArc_4.startPoint(), SketchLine_11.startPoint() +) SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_129") -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_10.endPoint() +) SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_130") -SketchConstraintTangent_7 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_10.result()) +SketchConstraintTangent_7 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchLine_10.result() +) SketchConstraintTangent_7.setName("SketchConstraintTangent_23") -SketchConstraintTangent_8 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_11.result()) +SketchConstraintTangent_8 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchLine_11.result() +) SketchConstraintTangent_8.setName("SketchConstraintTangent_24") -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_23.startPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchLine_23.startPoint(), SketchLine_10.startPoint() +) SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_131") -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchLine_11.endPoint()) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchLine_24.endPoint(), SketchLine_11.endPoint() +) SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_132") -SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_23.result()) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_23.result() +) SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_133") -SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_24.result()) +SketchConstraintCoincidence_42 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_24.result() +) SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_134") SketchConstraintRadius_4 = Sketch_1.setRadius(SketchArc_4.results()[1], "BaseLegFillet") SketchConstraintRadius_4.setName("SketchConstraintRadius_18") -SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchLine_21.startPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_43 = Sketch_1.setCoincident( + SketchLine_21.startPoint(), SketchLine_12.startPoint() +) SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_135") -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchArc_4.endPoint(), SketchLine_18.result(), "LegThick") +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchArc_4.endPoint(), SketchLine_18.result(), "LegThick" +) SketchConstraintDistance_10.setName("SketchConstraintDistance_34") model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) @@ -287,21 +457,29 @@ SketchLine_29 = Sketch_2.addLine(20, 40, 20, -5) SketchLine_29.setName("SketchLine_21") SketchLine_29.result().setName("SketchLine_21") SketchLine_29.setAuxiliary(True) -SketchConstraintCoincidence_44 = Sketch_2.setCoincident(SketchLine_29.endPoint(), SketchLine_26.startPoint()) +SketchConstraintCoincidence_44 = Sketch_2.setCoincident( + SketchLine_29.endPoint(), SketchLine_26.startPoint() +) SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_14") SketchLine_30 = Sketch_2.addLine(-20, -5, -20, 40) SketchLine_30.setName("SketchLine_19") SketchLine_30.result().setName("SketchLine_19") SketchLine_30.setAuxiliary(True) -SketchConstraintCoincidence_45 = Sketch_2.setCoincident(SketchLine_26.endPoint(), SketchLine_30.startPoint()) +SketchConstraintCoincidence_45 = Sketch_2.setCoincident( + SketchLine_26.endPoint(), SketchLine_30.startPoint() +) SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_15") SketchLine_31 = Sketch_2.addLine(-20, 40, 20, 40) SketchLine_31.setName("SketchLine_20") SketchLine_31.result().setName("SketchLine_20") SketchLine_31.setAuxiliary(True) -SketchConstraintCoincidence_46 = Sketch_2.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_46 = Sketch_2.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_16") -SketchConstraintCoincidence_47 = Sketch_2.setCoincident(SketchLine_31.endPoint(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_47 = Sketch_2.setCoincident( + SketchLine_31.endPoint(), SketchLine_29.startPoint() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_17") SketchConstraintHorizontal_8 = Sketch_2.setHorizontal(SketchLine_26.result()) SketchConstraintHorizontal_8.setName("SketchConstraintHorizontal_4") @@ -314,18 +492,28 @@ SketchConstraintVertical_4.setName("SketchConstraintVertical_3") SketchLine_32 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_32.setName("SketchLine_22") SketchLine_32.result().setName("SketchLine_22") -SketchConstraintDistance_11 = Sketch_2.setDistance(SketchLine_26.startPoint(), SketchLine_32.result(), "(TL/2-3)-20") +SketchConstraintDistance_11 = Sketch_2.setDistance( + SketchLine_26.startPoint(), SketchLine_32.result(), "(TL/2-3)-20" +) SketchConstraintDistance_11.setName("SketchConstraintDistance_5") -SketchConstraintDistance_12 = Sketch_2.setDistance(SketchLine_26.endPoint(), SketchLine_32.result(), "(TL/2-3)-20") +SketchConstraintDistance_12 = Sketch_2.setDistance( + SketchLine_26.endPoint(), SketchLine_32.result(), "(TL/2-3)-20" +) SketchConstraintDistance_12.setName("SketchConstraintDistance_6") SketchLine_33 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_33.setName("SketchLine_23") SketchLine_33.result().setName("SketchLine_23") -SketchConstraintDistance_13 = Sketch_2.setDistance(SketchLine_29.startPoint(), SketchLine_33.result(), 40) +SketchConstraintDistance_13 = Sketch_2.setDistance( + SketchLine_29.startPoint(), SketchLine_33.result(), 40 +) SketchConstraintDistance_13.setName("SketchConstraintDistance_7") -SketchConstraintDistance_14 = Sketch_2.setDistance(SketchLine_26.startPoint(), SketchLine_33.result(), 5) +SketchConstraintDistance_14 = Sketch_2.setDistance( + SketchLine_26.startPoint(), SketchLine_33.result(), 5 +) SketchConstraintDistance_14.setName("SketchConstraintDistance_8") -SketchArc_5 = Sketch_2.addArc(-18, 37.99999999999999, -18.00000018312083, 40, -20, 37.99999996287101, False) +SketchArc_5 = Sketch_2.addArc( + -18, 37.99999999999999, -18.00000018312083, 40, -20, 37.99999996287101, False +) SketchArc_5.setName("SketchArc_10") SketchArc_5.result().setName("SketchArc_10") SketchArc_5.results()[1].setName("SketchArc_10_2") @@ -333,45 +521,83 @@ SketchLine_34 = Sketch_2.addLine(-18.00000018312083, 40, 20, 40) SketchLine_34.setName("SketchLine_74") SketchLine_34.result().setName("SketchLine_74") SketchLine_34.setAuxiliary(True) -SketchConstraintCoincidence_48 = Sketch_2.setCoincident(SketchArc_5.startPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_48 = Sketch_2.setCoincident( + SketchArc_5.startPoint(), SketchLine_34.startPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_101") -SketchConstraintCoincidence_49 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_25.endPoint()) +SketchConstraintCoincidence_49 = Sketch_2.setCoincident( + SketchArc_5.endPoint(), SketchLine_25.endPoint() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_102") -SketchConstraintTangent_9 = Sketch_2.setTangent(SketchArc_5.results()[1], SketchLine_25.result()) +SketchConstraintTangent_9 = Sketch_2.setTangent( + SketchArc_5.results()[1], SketchLine_25.result() +) SketchConstraintTangent_9.setName("SketchConstraintTangent_15") -SketchConstraintTangent_10 = Sketch_2.setTangent(SketchArc_5.results()[1], SketchLine_34.result()) +SketchConstraintTangent_10 = Sketch_2.setTangent( + SketchArc_5.results()[1], SketchLine_34.result() +) SketchConstraintTangent_10.setName("SketchConstraintTangent_16") -SketchConstraintCoincidence_50 = Sketch_2.setCoincident(SketchLine_30.startPoint(), SketchLine_25.startPoint()) +SketchConstraintCoincidence_50 = Sketch_2.setCoincident( + SketchLine_30.startPoint(), SketchLine_25.startPoint() +) SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_103") -SketchConstraintCoincidence_51 = Sketch_2.setCoincident(SketchLine_31.endPoint(), SketchLine_34.endPoint()) +SketchConstraintCoincidence_51 = Sketch_2.setCoincident( + SketchLine_31.endPoint(), SketchLine_34.endPoint() +) SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_104") -SketchConstraintCoincidence_52 = Sketch_2.setCoincident(SketchLine_25.endPoint(), SketchLine_30.result()) +SketchConstraintCoincidence_52 = Sketch_2.setCoincident( + SketchLine_25.endPoint(), SketchLine_30.result() +) SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_105") -SketchConstraintCoincidence_53 = Sketch_2.setCoincident(SketchLine_34.startPoint(), SketchLine_31.result()) +SketchConstraintCoincidence_53 = Sketch_2.setCoincident( + SketchLine_34.startPoint(), SketchLine_31.result() +) SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_106") -SketchConstraintRadius_5 = Sketch_2.setRadius(SketchArc_5.results()[1], "BottomCutFillet") +SketchConstraintRadius_5 = Sketch_2.setRadius( + SketchArc_5.results()[1], "BottomCutFillet" +) SketchConstraintRadius_5.setName("SketchConstraintRadius_12") -SketchArc_6 = Sketch_2.addArc(18, 38.00000000000001, 20, 38.00000240162298, 18.00001539129446, 40, False) +SketchArc_6 = Sketch_2.addArc( + 18, 38.00000000000001, 20, 38.00000240162298, 18.00001539129446, 40, False +) SketchArc_6.setName("SketchArc_11") SketchArc_6.result().setName("SketchArc_11") SketchArc_6.results()[1].setName("SketchArc_11_2") -SketchConstraintCoincidence_54 = Sketch_2.setCoincident(SketchArc_6.startPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_54 = Sketch_2.setCoincident( + SketchArc_6.startPoint(), SketchLine_28.startPoint() +) SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_107") -SketchConstraintCoincidence_55 = Sketch_2.setCoincident(SketchArc_6.endPoint(), SketchLine_27.endPoint()) +SketchConstraintCoincidence_55 = Sketch_2.setCoincident( + SketchArc_6.endPoint(), SketchLine_27.endPoint() +) SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_108") -SketchConstraintTangent_11 = Sketch_2.setTangent(SketchArc_6.results()[1], SketchLine_28.result()) +SketchConstraintTangent_11 = Sketch_2.setTangent( + SketchArc_6.results()[1], SketchLine_28.result() +) SketchConstraintTangent_11.setName("SketchConstraintTangent_17") -SketchConstraintTangent_12 = Sketch_2.setTangent(SketchArc_6.results()[1], SketchLine_27.result()) +SketchConstraintTangent_12 = Sketch_2.setTangent( + SketchArc_6.results()[1], SketchLine_27.result() +) SketchConstraintTangent_12.setName("SketchConstraintTangent_18") -SketchConstraintCoincidence_56 = Sketch_2.setCoincident(SketchLine_29.endPoint(), SketchLine_28.endPoint()) +SketchConstraintCoincidence_56 = Sketch_2.setCoincident( + SketchLine_29.endPoint(), SketchLine_28.endPoint() +) SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_109") -SketchConstraintCoincidence_57 = Sketch_2.setCoincident(SketchLine_34.startPoint(), SketchLine_27.startPoint()) +SketchConstraintCoincidence_57 = Sketch_2.setCoincident( + SketchLine_34.startPoint(), SketchLine_27.startPoint() +) SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_110") -SketchConstraintCoincidence_58 = Sketch_2.setCoincident(SketchLine_28.startPoint(), SketchLine_29.result()) +SketchConstraintCoincidence_58 = Sketch_2.setCoincident( + SketchLine_28.startPoint(), SketchLine_29.result() +) SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_111") -SketchConstraintCoincidence_59 = Sketch_2.setCoincident(SketchLine_27.endPoint(), SketchLine_34.result()) +SketchConstraintCoincidence_59 = Sketch_2.setCoincident( + SketchLine_27.endPoint(), SketchLine_34.result() +) SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_112") -SketchConstraintRadius_6 = Sketch_2.setRadius(SketchArc_6.results()[1], "BottomCutFillet") +SketchConstraintRadius_6 = Sketch_2.setRadius( + SketchArc_6.results()[1], "BottomCutFillet" +) SketchConstraintRadius_6.setName("SketchConstraintRadius_13") model.do() Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) @@ -382,85 +608,148 @@ SketchCircle_2 = Sketch_3.addCircle(0, 55, 11) SketchLine_35 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_35.setName("SketchLine_24") SketchLine_35.result().setName("SketchLine_24") -SketchConstraintCoincidence_60 = Sketch_3.setCoincident(SketchCircle_2.center(), SketchLine_35.result()) +SketchConstraintCoincidence_60 = Sketch_3.setCoincident( + SketchCircle_2.center(), SketchLine_35.result() +) SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_18") SketchConstraintRadius_8 = Sketch_3.setRadius(SketchCircle_2.results()[1], "TDE/2") SketchConstraintRadius_8.setName("SketchConstraintRadius_2") -SketchConstraintDistance_15 = Sketch_3.setDistance(SketchCircle_2.center(), SketchCircle_1.center(), 30) +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/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) +SketchConstraintDistance_16 = Sketch_3.setDistance( + SketchCircle_1.center(), SketchLine_36.result(), 85 +) SketchConstraintDistance_16.setName("SketchConstraintDistance_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/SketchCircle_1_2__cc")) -SketchConstraintCoincidence_61 = Sketch_4.setCoincident(SketchPoint_1.coordinates(), SketchCircle_3.center()) +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/SketchCircle_2_2__cc")) -SketchConstraintCoincidence_62 = Sketch_4.setCoincident(SketchPoint_2.coordinates(), SketchCircle_4.center()) +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") SketchConstraintRadius_9.setName("SketchConstraintRadius_3") SketchConstraintRadius_10 = Sketch_4.setRadius(SketchCircle_4.results()[1], "TDI/2") SketchConstraintRadius_10.setName("SketchConstraintRadius_4") model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "TL/2-3", "TL/2-3") -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 100, 100, [model.selection("SOLID", "Extrusion_1_1")]) -ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), "TL/2", "TL/2", [model.selection("SOLID", "ExtrusionCut_1_1")]) -ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), 60, 60, [model.selection("SOLID", "ExtrusionFuse_1_1")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + "TL/2-3", + "TL/2-3", +) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_2")], + model.selection(), + 100, + 100, + [model.selection("SOLID", "Extrusion_1_1")], +) +ExtrusionFuse_1 = model.addExtrusionFuse( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_3")], + model.selection(), + "TL/2", + "TL/2", + [model.selection("SOLID", "ExtrusionCut_1_1")], +) +ExtrusionCut_2 = model.addExtrusionCut( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_4")], + model.selection(), + 60, + 60, + [model.selection("SOLID", "ExtrusionFuse_1_1")], +) Sketch_5 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_5 = Sketch_5.addCircle(30, -41, 7.5) SketchLine_37 = Sketch_5.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_37.setName("SketchLine_26") SketchLine_37.result().setName("SketchLine_26") -SketchConstraintDistance_17 = Sketch_5.setDistance(SketchCircle_5.center(), SketchLine_37.result(), 41) +SketchConstraintDistance_17 = Sketch_5.setDistance( + SketchCircle_5.center(), SketchLine_37.result(), 41 +) SketchConstraintDistance_17.setName("SketchConstraintDistance_13") SketchLine_38 = Sketch_5.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_38.setName("SketchLine_27") SketchLine_38.result().setName("SketchLine_27") -SketchConstraintDistance_18 = Sketch_5.setDistance(SketchCircle_5.center(), SketchLine_38.result(), 30) +SketchConstraintDistance_18 = Sketch_5.setDistance( + SketchCircle_5.center(), SketchLine_38.result(), 30 +) SketchConstraintDistance_18.setName("SketchConstraintDistance_14") SketchConstraintRadius_11 = Sketch_5.setRadius(SketchCircle_5.results()[1], 7.5) SketchConstraintRadius_11.setName("SketchConstraintRadius_5") -SketchConstraintMirror_1 = Sketch_5.addMirror(SketchLine_37.result(), [SketchCircle_5.results()[1]]) +SketchConstraintMirror_1 = Sketch_5.addMirror( + SketchLine_37.result(), [SketchCircle_5.results()[1]] +) SketchConstraintMirror_1.setName("SketchConstraintMirror_2") [SketchCircle_6] = SketchConstraintMirror_1.mirrored() -SketchConstraintMirror_2 = Sketch_5.addMirror(SketchLine_38.result(), [SketchCircle_5.results()[1], SketchCircle_6.results()[1]]) +SketchConstraintMirror_2 = Sketch_5.addMirror( + SketchLine_38.result(), [SketchCircle_5.results()[1], SketchCircle_6.results()[1]] +) SketchConstraintMirror_2.setName("SketchConstraintMirror_3") [SketchCircle_7, SketchCircle_8] = SketchConstraintMirror_2.mirrored() 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/SketchCircle_5_2__cc")) -SketchConstraintCoincidence_63 = Sketch_6.setCoincident(SketchPoint_3.coordinates(), SketchCircle_9.center()) +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") SketchConstraintRadius_12.setName("SketchConstraintRadius_6") SketchLine_39 = Sketch_6.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_39.setName("SketchLine_28") SketchLine_39.result().setName("SketchLine_28") -SketchConstraintMirror_3 = Sketch_6.addMirror(SketchLine_39.result(), [SketchCircle_9.results()[1]]) +SketchConstraintMirror_3 = Sketch_6.addMirror( + SketchLine_39.result(), [SketchCircle_9.results()[1]] +) SketchConstraintMirror_3.setName("SketchConstraintMirror_4") [SketchCircle_10] = SketchConstraintMirror_3.mirrored() SketchLine_40 = Sketch_6.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_40.setName("SketchLine_29") SketchLine_40.result().setName("SketchLine_29") -SketchConstraintMirror_4 = Sketch_6.addMirror(SketchLine_40.result(), [SketchCircle_9.results()[1], SketchCircle_10.results()[1]]) +SketchConstraintMirror_4 = Sketch_6.addMirror( + SketchLine_40.result(), [SketchCircle_9.results()[1], SketchCircle_10.results()[1]] +) SketchConstraintMirror_4.setName("SketchConstraintMirror_5") [SketchCircle_11, SketchCircle_12] = SketchConstraintMirror_4.mirrored() 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/SketchCircle_5_2__cc")) -SketchConstraintCoincidence_64 = Sketch_7.setCoincident(SketchLine_41.startPoint(), SketchPoint_4.result()) +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) -SketchConstraintCoincidence_65 = Sketch_7.setCoincident(SketchLine_41.endPoint(), SketchLine_42.startPoint()) +SketchConstraintCoincidence_65 = Sketch_7.setCoincident( + SketchLine_41.endPoint(), SketchLine_42.startPoint() +) SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_35") SketchLine_43 = Sketch_7.addLine(-34, 8, -34, 7.499984403541713) SketchLine_43.setName("SketchLine_47") @@ -472,27 +761,39 @@ SketchLine_45 = Sketch_7.addLine(-34, 8, -34, 6) SketchLine_45.setName("SketchLine_43") SketchLine_45.result().setName("SketchLine_43") SketchLine_45.setAuxiliary(True) -SketchConstraintCoincidence_66 = Sketch_7.setCoincident(SketchLine_42.endPoint(), SketchLine_45.startPoint()) +SketchConstraintCoincidence_66 = Sketch_7.setCoincident( + SketchLine_42.endPoint(), SketchLine_45.startPoint() +) SketchConstraintCoincidence_66.setName("SketchConstraintCoincidence_36") SketchLine_46 = Sketch_7.addLine(-34, 6, -32, 6) SketchLine_46.setName("SketchLine_44") SketchLine_46.result().setName("SketchLine_44") SketchLine_46.setAuxiliary(True) -SketchConstraintCoincidence_67 = Sketch_7.setCoincident(SketchLine_45.endPoint(), SketchLine_46.startPoint()) +SketchConstraintCoincidence_67 = Sketch_7.setCoincident( + SketchLine_45.endPoint(), SketchLine_46.startPoint() +) SketchConstraintCoincidence_67.setName("SketchConstraintCoincidence_37") SketchLine_47 = Sketch_7.addLine(-32, 6, -32, 0) SketchLine_47.setName("SketchLine_45") SketchLine_47.result().setName("SketchLine_45") -SketchConstraintCoincidence_68 = Sketch_7.setCoincident(SketchLine_46.endPoint(), SketchLine_47.startPoint()) +SketchConstraintCoincidence_68 = Sketch_7.setCoincident( + SketchLine_46.endPoint(), SketchLine_47.startPoint() +) SketchConstraintCoincidence_68.setName("SketchConstraintCoincidence_38") SketchLine_48 = Sketch_7.addLine(-32, 0, -41, 0) SketchLine_48.setName("SketchLine_46") SketchLine_48.result().setName("SketchLine_46") -SketchConstraintCoincidence_69 = Sketch_7.setCoincident(SketchLine_47.endPoint(), SketchLine_48.startPoint()) +SketchConstraintCoincidence_69 = Sketch_7.setCoincident( + SketchLine_47.endPoint(), SketchLine_48.startPoint() +) SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_39") -SketchConstraintCoincidence_70 = Sketch_7.setCoincident(SketchLine_41.startPoint(), SketchLine_48.endPoint()) +SketchConstraintCoincidence_70 = Sketch_7.setCoincident( + SketchLine_41.startPoint(), SketchLine_48.endPoint() +) SketchConstraintCoincidence_70.setName("SketchConstraintCoincidence_40") -SketchConstraintCoincidence_71 = Sketch_7.setCoincident(SketchPoint_4.coordinates(), SketchLine_48.endPoint()) +SketchConstraintCoincidence_71 = Sketch_7.setCoincident( + SketchPoint_4.coordinates(), SketchLine_48.endPoint() +) SketchConstraintCoincidence_71.setName("SketchConstraintCoincidence_41") SketchConstraintHorizontal_10 = Sketch_7.setHorizontal(SketchLine_48.result()) SketchConstraintHorizontal_10.setName("SketchConstraintHorizontal_6") @@ -506,38 +807,77 @@ SketchConstraintVertical_7 = Sketch_7.setVertical(SketchLine_45.result()) SketchConstraintVertical_7.setName("SketchConstraintVertical_6") SketchConstraintHorizontal_12 = Sketch_7.setHorizontal(SketchLine_42.result()) SketchConstraintHorizontal_12.setName("SketchConstraintHorizontal_8") -SketchConstraintDistance_19 = Sketch_7.setDistance(SketchLine_41.endPoint(), SketchLine_48.result(), "BPS+BHPS") +SketchConstraintDistance_19 = Sketch_7.setDistance( + SketchLine_41.endPoint(), SketchLine_48.result(), "BPS+BHPS" +) SketchConstraintDistance_19.setName("SketchConstraintDistance_15") -SketchConstraintDistance_20 = Sketch_7.setDistance(SketchLine_47.startPoint(), SketchLine_48.result(), "BPS") +SketchConstraintDistance_20 = Sketch_7.setDistance( + SketchLine_47.startPoint(), SketchLine_48.result(), "BPS" +) SketchConstraintDistance_20.setName("SketchConstraintDistance_16") -SketchConstraintDistance_21 = Sketch_7.setDistance(SketchLine_48.startPoint(), SketchLine_41.result(), "BHPD/2+BHPFR+0.5") +SketchConstraintDistance_21 = Sketch_7.setDistance( + SketchLine_48.startPoint(), SketchLine_41.result(), "BHPD/2+BHPFR+0.5" +) SketchConstraintDistance_21.setName("SketchConstraintDistance_17") -SketchConstraintDistance_22 = Sketch_7.setDistance(SketchLine_42.endPoint(), SketchLine_41.result(), "BHPD/2") +SketchConstraintDistance_22 = Sketch_7.setDistance( + SketchLine_42.endPoint(), SketchLine_41.result(), "BHPD/2" +) SketchConstraintDistance_22.setName("SketchConstraintDistance_18") -SketchArc_7 = Sketch_7.addArc(-32.50000000000004, 7.499999999999999, -34, 7.499984403541713, -32.50001348840178, 5.999999999999995, False) +SketchArc_7 = Sketch_7.addArc( + -32.50000000000004, + 7.499999999999999, + -34, + 7.499984403541713, + -32.50001348840178, + 5.999999999999995, + False, +) SketchArc_7.setName("SketchArc_5") SketchArc_7.result().setName("SketchArc_5") SketchArc_7.results()[1].setName("SketchArc_5_2") -SketchConstraintCoincidence_72 = Sketch_7.setCoincident(SketchArc_7.startPoint(), SketchLine_43.endPoint()) +SketchConstraintCoincidence_72 = Sketch_7.setCoincident( + SketchArc_7.startPoint(), SketchLine_43.endPoint() +) SketchConstraintCoincidence_72.setName("SketchConstraintCoincidence_42") -SketchConstraintCoincidence_73 = Sketch_7.setCoincident(SketchArc_7.endPoint(), SketchLine_44.startPoint()) +SketchConstraintCoincidence_73 = Sketch_7.setCoincident( + SketchArc_7.endPoint(), SketchLine_44.startPoint() +) SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_43") -SketchConstraintTangent_13 = Sketch_7.setTangent(SketchArc_7.results()[1], SketchLine_43.result()) +SketchConstraintTangent_13 = Sketch_7.setTangent( + SketchArc_7.results()[1], SketchLine_43.result() +) SketchConstraintTangent_13.setName("SketchConstraintTangent_5") -SketchConstraintTangent_14 = Sketch_7.setTangent(SketchArc_7.results()[1], SketchLine_44.result()) +SketchConstraintTangent_14 = Sketch_7.setTangent( + SketchArc_7.results()[1], SketchLine_44.result() +) SketchConstraintTangent_14.setName("SketchConstraintTangent_6") -SketchConstraintCoincidence_74 = Sketch_7.setCoincident(SketchLine_45.startPoint(), SketchLine_43.startPoint()) +SketchConstraintCoincidence_74 = Sketch_7.setCoincident( + SketchLine_45.startPoint(), SketchLine_43.startPoint() +) SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_44") -SketchConstraintCoincidence_75 = Sketch_7.setCoincident(SketchLine_46.endPoint(), SketchLine_44.endPoint()) +SketchConstraintCoincidence_75 = Sketch_7.setCoincident( + SketchLine_46.endPoint(), SketchLine_44.endPoint() +) SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_45") -SketchConstraintCoincidence_76 = Sketch_7.setCoincident(SketchLine_43.endPoint(), SketchLine_45.result()) +SketchConstraintCoincidence_76 = Sketch_7.setCoincident( + SketchLine_43.endPoint(), SketchLine_45.result() +) SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_46") -SketchConstraintCoincidence_77 = Sketch_7.setCoincident(SketchLine_44.startPoint(), SketchLine_46.result()) +SketchConstraintCoincidence_77 = Sketch_7.setCoincident( + SketchLine_44.startPoint(), SketchLine_46.result() +) 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/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") @@ -545,8 +885,12 @@ 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/SketchCircle_10_2__cc")) -SketchConstraintCoincidence_78 = Sketch_8.setCoincident(SketchLine_50.endPoint(), SketchPoint_5.result()) +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) SketchLine_51.setName("SketchLine_50") @@ -557,14 +901,20 @@ SketchLine_52.result().setName("SketchLine_56") SketchLine_53 = Sketch_8.addLine(32, 6, 32, 0) SketchLine_53.setName("SketchLine_52") SketchLine_53.result().setName("SketchLine_52") -SketchConstraintCoincidence_79 = Sketch_8.setCoincident(SketchLine_53.endPoint(), SketchLine_50.startPoint()) +SketchConstraintCoincidence_79 = Sketch_8.setCoincident( + SketchLine_53.endPoint(), SketchLine_50.startPoint() +) SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_51") -SketchConstraintCoincidence_80 = Sketch_8.setCoincident(SketchLine_50.endPoint(), SketchLine_51.startPoint()) +SketchConstraintCoincidence_80 = Sketch_8.setCoincident( + SketchLine_50.endPoint(), SketchLine_51.startPoint() +) SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_52") SketchLine_54 = Sketch_8.addLine(41, 8, 34, 8) SketchLine_54.setName("SketchLine_53") SketchLine_54.result().setName("SketchLine_53") -SketchConstraintCoincidence_81 = Sketch_8.setCoincident(SketchLine_51.endPoint(), SketchLine_54.startPoint()) +SketchConstraintCoincidence_81 = Sketch_8.setCoincident( + SketchLine_51.endPoint(), SketchLine_54.startPoint() +) SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_53") SketchConstraintHorizontal_13 = Sketch_8.setHorizontal(SketchLine_50.result()) SketchConstraintHorizontal_13.setName("SketchConstraintHorizontal_9") @@ -573,67 +923,125 @@ SketchConstraintVertical_8.setName("SketchConstraintVertical_7") SketchConstraintVertical_9 = Sketch_8.setVertical(SketchLine_53.result()) SketchConstraintVertical_9.setName("SketchConstraintVertical_8") SketchPoint_6 = Sketch_8.addPoint(32, 6) -SketchConstraintCoincidence_82 = Sketch_8.setCoincident(SketchPoint_6.coordinates(), SketchLine_53.startPoint()) +SketchConstraintCoincidence_82 = Sketch_8.setCoincident( + SketchPoint_6.coordinates(), SketchLine_53.startPoint() +) SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_55") SketchPoint_7 = Sketch_8.addPoint(34, 8) -SketchConstraintCoincidence_83 = Sketch_8.setCoincident(SketchLine_54.endPoint(), SketchPoint_7.coordinates()) +SketchConstraintCoincidence_83 = Sketch_8.setCoincident( + SketchLine_54.endPoint(), SketchPoint_7.coordinates() +) SketchConstraintCoincidence_83.setName("SketchConstraintCoincidence_58") SketchLine_55 = Sketch_8.addLine(32, 6, 34, 6) SketchLine_55.setName("SketchLine_51") SketchLine_55.result().setName("SketchLine_51") SketchLine_55.setAuxiliary(True) -SketchConstraintCoincidence_84 = Sketch_8.setCoincident(SketchLine_53.startPoint(), SketchLine_55.startPoint()) +SketchConstraintCoincidence_84 = Sketch_8.setCoincident( + SketchLine_53.startPoint(), SketchLine_55.startPoint() +) SketchConstraintCoincidence_84.setName("SketchConstraintCoincidence_54") -SketchConstraintCoincidence_85 = Sketch_8.setCoincident(SketchPoint_6.coordinates(), SketchLine_55.startPoint()) +SketchConstraintCoincidence_85 = Sketch_8.setCoincident( + SketchPoint_6.coordinates(), SketchLine_55.startPoint() +) SketchConstraintCoincidence_85.setName("SketchConstraintCoincidence_56") SketchLine_56 = Sketch_8.addLine(34, 6, 34, 8) SketchLine_56.setName("SketchLine_54") SketchLine_56.result().setName("SketchLine_54") SketchLine_56.setAuxiliary(True) -SketchConstraintCoincidence_86 = Sketch_8.setCoincident(SketchLine_55.endPoint(), SketchLine_56.startPoint()) +SketchConstraintCoincidence_86 = Sketch_8.setCoincident( + SketchLine_55.endPoint(), SketchLine_56.startPoint() +) SketchConstraintCoincidence_86.setName("SketchConstraintCoincidence_57") -SketchConstraintCoincidence_87 = Sketch_8.setCoincident(SketchPoint_7.coordinates(), SketchLine_56.endPoint()) +SketchConstraintCoincidence_87 = Sketch_8.setCoincident( + SketchPoint_7.coordinates(), SketchLine_56.endPoint() +) SketchConstraintCoincidence_87.setName("SketchConstraintCoincidence_59") -SketchConstraintCoincidence_88 = Sketch_8.setCoincident(SketchLine_54.endPoint(), SketchLine_56.endPoint()) +SketchConstraintCoincidence_88 = Sketch_8.setCoincident( + SketchLine_54.endPoint(), SketchLine_56.endPoint() +) SketchConstraintCoincidence_88.setName("SketchConstraintCoincidence_60") SketchConstraintHorizontal_14 = Sketch_8.setHorizontal(SketchLine_55.result()) SketchConstraintHorizontal_14.setName("SketchConstraintHorizontal_10") SketchConstraintVertical_10 = Sketch_8.setVertical(SketchLine_56.result()) SketchConstraintVertical_10.setName("SketchConstraintVertical_9") -SketchConstraintDistance_23 = Sketch_8.setDistance(SketchPoint_7.coordinates(), SketchLine_50.result(), 8) +SketchConstraintDistance_23 = Sketch_8.setDistance( + SketchPoint_7.coordinates(), SketchLine_50.result(), 8 +) SketchConstraintDistance_23.setName("SketchConstraintDistance_19") SketchConstraintHorizontal_15 = Sketch_8.setHorizontal(SketchLine_54.result()) SketchConstraintHorizontal_15.setName("SketchConstraintHorizontal_11") -SketchConstraintDistance_24 = Sketch_8.setDistance(SketchLine_53.startPoint(), SketchLine_51.result(), 9) +SketchConstraintDistance_24 = Sketch_8.setDistance( + SketchLine_53.startPoint(), SketchLine_51.result(), 9 +) SketchConstraintDistance_24.setName("SketchConstraintDistance_20") -SketchConstraintDistance_25 = Sketch_8.setDistance(SketchPoint_7.coordinates(), SketchLine_51.result(), 7) +SketchConstraintDistance_25 = Sketch_8.setDistance( + SketchPoint_7.coordinates(), SketchLine_51.result(), 7 +) SketchConstraintDistance_25.setName("SketchConstraintDistance_21") -SketchConstraintDistance_26 = Sketch_8.setDistance(SketchLine_53.startPoint(), SketchLine_50.result(), 6) +SketchConstraintDistance_26 = Sketch_8.setDistance( + SketchLine_53.startPoint(), SketchLine_50.result(), 6 +) SketchConstraintDistance_26.setName("SketchConstraintDistance_22") -SketchArc_8 = Sketch_8.addArc(32.50000000000001, 7.500000000000025, 32.50001476412091, 6.000000000000001, 34, 7.499985233923545, False) +SketchArc_8 = Sketch_8.addArc( + 32.50000000000001, + 7.500000000000025, + 32.50001476412091, + 6.000000000000001, + 34, + 7.499985233923545, + False, +) SketchArc_8.setName("SketchArc_7") SketchArc_8.result().setName("SketchArc_7") SketchArc_8.results()[1].setName("SketchArc_7_2") -SketchConstraintCoincidence_89 = Sketch_8.setCoincident(SketchArc_8.startPoint(), SketchLine_49.endPoint()) +SketchConstraintCoincidence_89 = Sketch_8.setCoincident( + SketchArc_8.startPoint(), SketchLine_49.endPoint() +) SketchConstraintCoincidence_89.setName("SketchConstraintCoincidence_61") -SketchConstraintCoincidence_90 = Sketch_8.setCoincident(SketchArc_8.endPoint(), SketchLine_52.startPoint()) +SketchConstraintCoincidence_90 = Sketch_8.setCoincident( + SketchArc_8.endPoint(), SketchLine_52.startPoint() +) SketchConstraintCoincidence_90.setName("SketchConstraintCoincidence_62") -SketchConstraintTangent_15 = Sketch_8.setTangent(SketchArc_8.results()[1], SketchLine_49.result()) +SketchConstraintTangent_15 = Sketch_8.setTangent( + SketchArc_8.results()[1], SketchLine_49.result() +) SketchConstraintTangent_15.setName("SketchConstraintTangent_9") -SketchConstraintTangent_16 = Sketch_8.setTangent(SketchArc_8.results()[1], SketchLine_52.result()) +SketchConstraintTangent_16 = Sketch_8.setTangent( + SketchArc_8.results()[1], SketchLine_52.result() +) SketchConstraintTangent_16.setName("SketchConstraintTangent_10") -SketchConstraintCoincidence_91 = Sketch_8.setCoincident(SketchLine_55.startPoint(), SketchLine_49.startPoint()) +SketchConstraintCoincidence_91 = Sketch_8.setCoincident( + SketchLine_55.startPoint(), SketchLine_49.startPoint() +) SketchConstraintCoincidence_91.setName("SketchConstraintCoincidence_63") -SketchConstraintCoincidence_92 = Sketch_8.setCoincident(SketchLine_56.endPoint(), SketchLine_52.endPoint()) +SketchConstraintCoincidence_92 = Sketch_8.setCoincident( + SketchLine_56.endPoint(), SketchLine_52.endPoint() +) SketchConstraintCoincidence_92.setName("SketchConstraintCoincidence_64") -SketchConstraintCoincidence_93 = Sketch_8.setCoincident(SketchLine_49.endPoint(), SketchLine_55.result()) +SketchConstraintCoincidence_93 = Sketch_8.setCoincident( + SketchLine_49.endPoint(), SketchLine_55.result() +) SketchConstraintCoincidence_93.setName("SketchConstraintCoincidence_65") -SketchConstraintCoincidence_94 = Sketch_8.setCoincident(SketchLine_52.startPoint(), SketchLine_56.result()) +SketchConstraintCoincidence_94 = Sketch_8.setCoincident( + SketchLine_52.startPoint(), SketchLine_56.result() +) 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_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")]) +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) @@ -642,8 +1050,12 @@ 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/SketchCircle_11_2__cc")) -SketchConstraintCoincidence_95 = Sketch_9.setCoincident(SketchLine_58.endPoint(), SketchPoint_8.result()) +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) SketchLine_59.setName("SketchLine_58") @@ -654,11 +1066,17 @@ SketchLine_60.result().setName("SketchLine_59") SketchLine_61 = Sketch_9.addLine(-32, 6, -32, 0) SketchLine_61.setName("SketchLine_60") SketchLine_61.result().setName("SketchLine_60") -SketchConstraintCoincidence_96 = Sketch_9.setCoincident(SketchLine_61.endPoint(), SketchLine_58.startPoint()) +SketchConstraintCoincidence_96 = Sketch_9.setCoincident( + SketchLine_61.endPoint(), SketchLine_58.startPoint() +) SketchConstraintCoincidence_96.setName("SketchConstraintCoincidence_68") -SketchConstraintCoincidence_97 = Sketch_9.setCoincident(SketchLine_58.endPoint(), SketchLine_59.startPoint()) +SketchConstraintCoincidence_97 = Sketch_9.setCoincident( + SketchLine_58.endPoint(), SketchLine_59.startPoint() +) SketchConstraintCoincidence_97.setName("SketchConstraintCoincidence_69") -SketchConstraintCoincidence_98 = Sketch_9.setCoincident(SketchLine_59.endPoint(), SketchLine_60.startPoint()) +SketchConstraintCoincidence_98 = Sketch_9.setCoincident( + SketchLine_59.endPoint(), SketchLine_60.startPoint() +) SketchConstraintCoincidence_98.setName("SketchConstraintCoincidence_70") SketchLine_62 = Sketch_9.addLine(-34, 8, -33.99999999999999, 7.499985052178464) SketchLine_62.setName("SketchLine_64") @@ -672,88 +1090,148 @@ SketchConstraintHorizontal_17.setName("SketchConstraintHorizontal_13") SketchConstraintVertical_12 = Sketch_9.setVertical(SketchLine_61.result()) SketchConstraintVertical_12.setName("SketchConstraintVertical_11") SketchPoint_9 = Sketch_9.addPoint(-34, 8) -SketchConstraintCoincidence_99 = Sketch_9.setCoincident(SketchPoint_9.coordinates(), SketchLine_60.endPoint()) +SketchConstraintCoincidence_99 = Sketch_9.setCoincident( + SketchPoint_9.coordinates(), SketchLine_60.endPoint() +) SketchConstraintCoincidence_99.setName("SketchConstraintCoincidence_72") SketchPoint_10 = Sketch_9.addPoint(-32, 6) -SketchConstraintCoincidence_100 = Sketch_9.setCoincident(SketchPoint_10.coordinates(), SketchLine_61.startPoint()) +SketchConstraintCoincidence_100 = Sketch_9.setCoincident( + SketchPoint_10.coordinates(), SketchLine_61.startPoint() +) SketchConstraintCoincidence_100.setName("SketchConstraintCoincidence_73") SketchLine_63 = Sketch_9.addLine(-34, 8, -34, 6) SketchLine_63.setName("SketchLine_61") SketchLine_63.result().setName("SketchLine_61") SketchLine_63.setAuxiliary(True) -SketchConstraintCoincidence_101 = Sketch_9.setCoincident(SketchLine_60.endPoint(), SketchLine_63.startPoint()) +SketchConstraintCoincidence_101 = Sketch_9.setCoincident( + SketchLine_60.endPoint(), SketchLine_63.startPoint() +) SketchConstraintCoincidence_101.setName("SketchConstraintCoincidence_71") -SketchConstraintCoincidence_102 = Sketch_9.setCoincident(SketchPoint_9.coordinates(), SketchLine_63.startPoint()) +SketchConstraintCoincidence_102 = Sketch_9.setCoincident( + SketchPoint_9.coordinates(), SketchLine_63.startPoint() +) SketchConstraintCoincidence_102.setName("SketchConstraintCoincidence_74") SketchLine_64 = Sketch_9.addLine(-34, 6, -32, 6) SketchLine_64.setName("SketchLine_62") SketchLine_64.result().setName("SketchLine_62") SketchLine_64.setAuxiliary(True) -SketchConstraintCoincidence_103 = Sketch_9.setCoincident(SketchLine_63.endPoint(), SketchLine_64.startPoint()) +SketchConstraintCoincidence_103 = Sketch_9.setCoincident( + SketchLine_63.endPoint(), SketchLine_64.startPoint() +) SketchConstraintCoincidence_103.setName("SketchConstraintCoincidence_75") -SketchConstraintCoincidence_104 = Sketch_9.setCoincident(SketchLine_61.startPoint(), SketchLine_64.endPoint()) +SketchConstraintCoincidence_104 = Sketch_9.setCoincident( + SketchLine_61.startPoint(), SketchLine_64.endPoint() +) SketchConstraintCoincidence_104.setName("SketchConstraintCoincidence_76") -SketchConstraintCoincidence_105 = Sketch_9.setCoincident(SketchPoint_10.coordinates(), SketchLine_64.endPoint()) +SketchConstraintCoincidence_105 = Sketch_9.setCoincident( + SketchPoint_10.coordinates(), SketchLine_64.endPoint() +) SketchConstraintCoincidence_105.setName("SketchConstraintCoincidence_77") SketchConstraintHorizontal_18 = Sketch_9.setHorizontal(SketchLine_64.result()) SketchConstraintHorizontal_18.setName("SketchConstraintHorizontal_14") SketchConstraintVertical_13 = Sketch_9.setVertical(SketchLine_63.result()) SketchConstraintVertical_13.setName("SketchConstraintVertical_12") -SketchConstraintDistance_27 = Sketch_9.setDistance(SketchLine_61.startPoint(), SketchLine_58.result(), 6) +SketchConstraintDistance_27 = Sketch_9.setDistance( + SketchLine_61.startPoint(), SketchLine_58.result(), 6 +) SketchConstraintDistance_27.setName("SketchConstraintDistance_23") -SketchConstraintDistance_28 = Sketch_9.setDistance(SketchLine_60.endPoint(), SketchLine_58.result(), 8) +SketchConstraintDistance_28 = Sketch_9.setDistance( + SketchLine_60.endPoint(), SketchLine_58.result(), 8 +) SketchConstraintDistance_28.setName("SketchConstraintDistance_24") -SketchConstraintDistance_29 = Sketch_9.setDistance(SketchLine_60.endPoint(), SketchLine_59.result(), 7) +SketchConstraintDistance_29 = Sketch_9.setDistance( + SketchLine_60.endPoint(), SketchLine_59.result(), 7 +) SketchConstraintDistance_29.setName("SketchConstraintDistance_25") -SketchConstraintDistance_30 = Sketch_9.setDistance(SketchLine_61.startPoint(), SketchLine_63.result(), 2) +SketchConstraintDistance_30 = Sketch_9.setDistance( + SketchLine_61.startPoint(), SketchLine_63.result(), 2 +) SketchConstraintDistance_30.setName("SketchConstraintDistance_26") -SketchArc_9 = Sketch_9.addArc(-32.49999999999999, 7.499999999999997, -33.99999999999999, 7.499985052178464, -32.50001494742042, 5.999999999999998, False) +SketchArc_9 = Sketch_9.addArc( + -32.49999999999999, + 7.499999999999997, + -33.99999999999999, + 7.499985052178464, + -32.50001494742042, + 5.999999999999998, + False, +) SketchArc_9.setName("SketchArc_8") SketchArc_9.result().setName("SketchArc_8") SketchArc_9.results()[1].setName("SketchArc_8_2") -SketchConstraintCoincidence_106 = Sketch_9.setCoincident(SketchArc_9.startPoint(), SketchLine_62.endPoint()) +SketchConstraintCoincidence_106 = Sketch_9.setCoincident( + SketchArc_9.startPoint(), SketchLine_62.endPoint() +) SketchConstraintCoincidence_106.setName("SketchConstraintCoincidence_78") -SketchConstraintCoincidence_107 = Sketch_9.setCoincident(SketchArc_9.endPoint(), SketchLine_57.startPoint()) +SketchConstraintCoincidence_107 = Sketch_9.setCoincident( + SketchArc_9.endPoint(), SketchLine_57.startPoint() +) SketchConstraintCoincidence_107.setName("SketchConstraintCoincidence_79") -SketchConstraintTangent_17 = Sketch_9.setTangent(SketchArc_9.results()[1], SketchLine_57.result()) +SketchConstraintTangent_17 = Sketch_9.setTangent( + SketchArc_9.results()[1], SketchLine_57.result() +) SketchConstraintTangent_17.setName("SketchConstraintTangent_11") -SketchConstraintTangent_18 = Sketch_9.setTangent(SketchArc_9.results()[1], SketchLine_62.result()) +SketchConstraintTangent_18 = Sketch_9.setTangent( + SketchArc_9.results()[1], SketchLine_62.result() +) SketchConstraintTangent_18.setName("SketchConstraintTangent_12") -SketchConstraintCoincidence_108 = Sketch_9.setCoincident(SketchLine_64.endPoint(), SketchLine_57.endPoint()) +SketchConstraintCoincidence_108 = Sketch_9.setCoincident( + SketchLine_64.endPoint(), SketchLine_57.endPoint() +) SketchConstraintCoincidence_108.setName("SketchConstraintCoincidence_80") -SketchConstraintCoincidence_109 = Sketch_9.setCoincident(SketchLine_63.startPoint(), SketchLine_62.startPoint()) +SketchConstraintCoincidence_109 = Sketch_9.setCoincident( + SketchLine_63.startPoint(), SketchLine_62.startPoint() +) SketchConstraintCoincidence_109.setName("SketchConstraintCoincidence_81") -SketchConstraintCoincidence_110 = Sketch_9.setCoincident(SketchLine_57.startPoint(), SketchLine_64.result()) +SketchConstraintCoincidence_110 = Sketch_9.setCoincident( + SketchLine_57.startPoint(), SketchLine_64.result() +) SketchConstraintCoincidence_110.setName("SketchConstraintCoincidence_82") -SketchConstraintCoincidence_111 = Sketch_9.setCoincident(SketchLine_62.endPoint(), SketchLine_63.result()) +SketchConstraintCoincidence_111 = Sketch_9.setCoincident( + SketchLine_62.endPoint(), SketchLine_63.result() +) SketchConstraintCoincidence_111.setName("SketchConstraintCoincidence_83") SketchConstraintRadius_15 = Sketch_9.setRadius(SketchArc_9.results()[1], 1.5) SketchConstraintRadius_15.setName("SketchConstraintRadius_10") model.do() Sketch_10 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2")) -SketchLine_65 = Sketch_10.addLine(33.99999999999999, 7.999999999999999, 33.99999999999999, 7.499985050625134) +SketchLine_65 = Sketch_10.addLine( + 33.99999999999999, 7.999999999999999, 33.99999999999999, 7.499985050625134 +) SketchLine_65.setName("SketchLine_71") 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/SketchCircle_12_2__cc")) -SketchConstraintCoincidence_112 = Sketch_10.setCoincident(SketchLine_66.endPoint(), SketchPoint_11.result()) +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) SketchLine_67.setName("SketchLine_66") SketchLine_67.result().setName("SketchLine_66") -SketchLine_68 = Sketch_10.addLine(41, 7.999999999999999, 33.99999999999999, 7.999999999999999) +SketchLine_68 = Sketch_10.addLine( + 41, 7.999999999999999, 33.99999999999999, 7.999999999999999 +) SketchLine_68.setName("SketchLine_67") SketchLine_68.result().setName("SketchLine_67") SketchLine_69 = Sketch_10.addLine(32, 6, 32, 0) SketchLine_69.setName("SketchLine_68") SketchLine_69.result().setName("SketchLine_68") -SketchConstraintCoincidence_113 = Sketch_10.setCoincident(SketchLine_69.endPoint(), SketchLine_66.startPoint()) +SketchConstraintCoincidence_113 = Sketch_10.setCoincident( + SketchLine_69.endPoint(), SketchLine_66.startPoint() +) SketchConstraintCoincidence_113.setName("SketchConstraintCoincidence_85") -SketchConstraintCoincidence_114 = Sketch_10.setCoincident(SketchLine_66.endPoint(), SketchLine_67.startPoint()) +SketchConstraintCoincidence_114 = Sketch_10.setCoincident( + SketchLine_66.endPoint(), SketchLine_67.startPoint() +) SketchConstraintCoincidence_114.setName("SketchConstraintCoincidence_86") -SketchConstraintCoincidence_115 = Sketch_10.setCoincident(SketchLine_67.endPoint(), SketchLine_68.startPoint()) +SketchConstraintCoincidence_115 = Sketch_10.setCoincident( + SketchLine_67.endPoint(), SketchLine_68.startPoint() +) SketchConstraintCoincidence_115.setName("SketchConstraintCoincidence_87") SketchLine_70 = Sketch_10.addLine(32.50001494562209, 6.000000000000006, 32, 6) SketchLine_70.setName("SketchLine_72") @@ -767,67 +1245,139 @@ SketchConstraintHorizontal_20.setName("SketchConstraintHorizontal_16") SketchConstraintVertical_15 = Sketch_10.setVertical(SketchLine_69.result()) SketchConstraintVertical_15.setName("SketchConstraintVertical_14") SketchPoint_12 = Sketch_10.addPoint(33.99999999999999, 7.999999999999999) -SketchConstraintCoincidence_116 = Sketch_10.setCoincident(SketchPoint_12.coordinates(), SketchLine_68.endPoint()) +SketchConstraintCoincidence_116 = Sketch_10.setCoincident( + SketchPoint_12.coordinates(), SketchLine_68.endPoint() +) SketchConstraintCoincidence_116.setName("SketchConstraintCoincidence_89") SketchPoint_13 = Sketch_10.addPoint(32, 6) -SketchConstraintCoincidence_117 = Sketch_10.setCoincident(SketchPoint_13.coordinates(), SketchLine_69.startPoint()) +SketchConstraintCoincidence_117 = Sketch_10.setCoincident( + SketchPoint_13.coordinates(), SketchLine_69.startPoint() +) SketchConstraintCoincidence_117.setName("SketchConstraintCoincidence_90") SketchLine_71 = Sketch_10.addLine(33.99999999999999, 7.999999999999999, 34, 6) SketchLine_71.setName("SketchLine_69") SketchLine_71.result().setName("SketchLine_69") SketchLine_71.setAuxiliary(True) -SketchConstraintCoincidence_118 = Sketch_10.setCoincident(SketchLine_68.endPoint(), SketchLine_71.startPoint()) +SketchConstraintCoincidence_118 = Sketch_10.setCoincident( + SketchLine_68.endPoint(), SketchLine_71.startPoint() +) SketchConstraintCoincidence_118.setName("SketchConstraintCoincidence_88") -SketchConstraintCoincidence_119 = Sketch_10.setCoincident(SketchPoint_12.coordinates(), SketchLine_71.startPoint()) +SketchConstraintCoincidence_119 = Sketch_10.setCoincident( + SketchPoint_12.coordinates(), SketchLine_71.startPoint() +) SketchConstraintCoincidence_119.setName("SketchConstraintCoincidence_91") SketchLine_72 = Sketch_10.addLine(34, 6, 32, 6) SketchLine_72.setName("SketchLine_70") SketchLine_72.result().setName("SketchLine_70") SketchLine_72.setAuxiliary(True) -SketchConstraintCoincidence_120 = Sketch_10.setCoincident(SketchLine_71.endPoint(), SketchLine_72.startPoint()) +SketchConstraintCoincidence_120 = Sketch_10.setCoincident( + SketchLine_71.endPoint(), SketchLine_72.startPoint() +) SketchConstraintCoincidence_120.setName("SketchConstraintCoincidence_92") -SketchConstraintCoincidence_121 = Sketch_10.setCoincident(SketchLine_69.startPoint(), SketchLine_72.endPoint()) +SketchConstraintCoincidence_121 = Sketch_10.setCoincident( + SketchLine_69.startPoint(), SketchLine_72.endPoint() +) SketchConstraintCoincidence_121.setName("SketchConstraintCoincidence_93") -SketchConstraintCoincidence_122 = Sketch_10.setCoincident(SketchPoint_13.coordinates(), SketchLine_72.endPoint()) +SketchConstraintCoincidence_122 = Sketch_10.setCoincident( + SketchPoint_13.coordinates(), SketchLine_72.endPoint() +) SketchConstraintCoincidence_122.setName("SketchConstraintCoincidence_94") SketchConstraintHorizontal_21 = Sketch_10.setHorizontal(SketchLine_72.result()) SketchConstraintHorizontal_21.setName("SketchConstraintHorizontal_17") SketchConstraintVertical_16 = Sketch_10.setVertical(SketchLine_71.result()) SketchConstraintVertical_16.setName("SketchConstraintVertical_15") -SketchConstraintDistance_31 = Sketch_10.setDistance(SketchLine_71.startPoint(), SketchLine_67.result(), 7) +SketchConstraintDistance_31 = Sketch_10.setDistance( + SketchLine_71.startPoint(), SketchLine_67.result(), 7 +) SketchConstraintDistance_31.setName("SketchConstraintDistance_27") -SketchConstraintDistance_32 = Sketch_10.setDistance(SketchLine_69.startPoint(), SketchLine_71.result(), 2) +SketchConstraintDistance_32 = Sketch_10.setDistance( + SketchLine_69.startPoint(), SketchLine_71.result(), 2 +) SketchConstraintDistance_32.setName("SketchConstraintDistance_28") -SketchConstraintDistance_33 = Sketch_10.setDistance(SketchLine_69.startPoint(), SketchLine_66.result(), 6) +SketchConstraintDistance_33 = Sketch_10.setDistance( + SketchLine_69.startPoint(), SketchLine_66.result(), 6 +) SketchConstraintDistance_33.setName("SketchConstraintDistance_29") -SketchConstraintDistance_34 = Sketch_10.setDistance(SketchLine_71.startPoint(), SketchLine_66.result(), 8) +SketchConstraintDistance_34 = Sketch_10.setDistance( + SketchLine_71.startPoint(), SketchLine_66.result(), 8 +) SketchConstraintDistance_34.setName("SketchConstraintDistance_30") -SketchArc_10 = Sketch_10.addArc(32.50000000000002, 7.500000000000033, 32.50001494562209, 6.000000000000006, 33.99999999999999, 7.499985050625134, False) +SketchArc_10 = Sketch_10.addArc( + 32.50000000000002, + 7.500000000000033, + 32.50001494562209, + 6.000000000000006, + 33.99999999999999, + 7.499985050625134, + False, +) SketchArc_10.setName("SketchArc_9") SketchArc_10.result().setName("SketchArc_9") SketchArc_10.results()[1].setName("SketchArc_9_2") -SketchConstraintCoincidence_123 = Sketch_10.setCoincident(SketchArc_10.startPoint(), SketchLine_70.startPoint()) +SketchConstraintCoincidence_123 = Sketch_10.setCoincident( + SketchArc_10.startPoint(), SketchLine_70.startPoint() +) SketchConstraintCoincidence_123.setName("SketchConstraintCoincidence_95") -SketchConstraintCoincidence_124 = Sketch_10.setCoincident(SketchArc_10.endPoint(), SketchLine_65.endPoint()) +SketchConstraintCoincidence_124 = Sketch_10.setCoincident( + SketchArc_10.endPoint(), SketchLine_65.endPoint() +) SketchConstraintCoincidence_124.setName("SketchConstraintCoincidence_96") -SketchConstraintTangent_19 = Sketch_10.setTangent(SketchArc_10.results()[1], SketchLine_65.result()) +SketchConstraintTangent_19 = Sketch_10.setTangent( + SketchArc_10.results()[1], SketchLine_65.result() +) SketchConstraintTangent_19.setName("SketchConstraintTangent_13") -SketchConstraintTangent_20 = Sketch_10.setTangent(SketchArc_10.results()[1], SketchLine_70.result()) +SketchConstraintTangent_20 = Sketch_10.setTangent( + SketchArc_10.results()[1], SketchLine_70.result() +) SketchConstraintTangent_20.setName("SketchConstraintTangent_14") -SketchConstraintCoincidence_125 = Sketch_10.setCoincident(SketchLine_71.startPoint(), SketchLine_65.startPoint()) +SketchConstraintCoincidence_125 = Sketch_10.setCoincident( + SketchLine_71.startPoint(), SketchLine_65.startPoint() +) SketchConstraintCoincidence_125.setName("SketchConstraintCoincidence_97") -SketchConstraintCoincidence_126 = Sketch_10.setCoincident(SketchLine_72.endPoint(), SketchLine_70.endPoint()) +SketchConstraintCoincidence_126 = Sketch_10.setCoincident( + SketchLine_72.endPoint(), SketchLine_70.endPoint() +) SketchConstraintCoincidence_126.setName("SketchConstraintCoincidence_98") -SketchConstraintCoincidence_127 = Sketch_10.setCoincident(SketchLine_65.endPoint(), SketchLine_71.result()) +SketchConstraintCoincidence_127 = Sketch_10.setCoincident( + SketchLine_65.endPoint(), SketchLine_71.result() +) SketchConstraintCoincidence_127.setName("SketchConstraintCoincidence_99") -SketchConstraintCoincidence_128 = Sketch_10.setCoincident(SketchLine_70.startPoint(), SketchLine_72.result()) +SketchConstraintCoincidence_128 = Sketch_10.setCoincident( + SketchLine_70.startPoint(), SketchLine_72.result() +) 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/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")]) +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) @@ -846,4 +1396,4 @@ model.testNbSubShapes(ExtrusionCut_3, GeomAPI_Shape.EDGE, [326]) model.testNbSubShapes(ExtrusionCut_3, GeomAPI_Shape.VERTEX, [652]) model.testResultsVolumes(ExtrusionCut_3, [156878.517351274640532210469245911]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.models/bushing.py b/test.models/bushing.py index a38e300b5..bb51aff21 100644 --- a/test.models/bushing.py +++ b/test.models/bushing.py @@ -27,40 +27,64 @@ Parameter_H = model.addParameter(Part_1_doc, "H", "12") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(0, 0, 0, -14) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(0, -14, 1, -15) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(1, -15, 10, -15) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(10, -15, 11, -14) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(11, -14, 11.00000000000001, -12) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(11.00000000000001, -12, 19, -12) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(19, -4.999999999999999, 6.999999999999999, -5) SketchLine_7.setName("SketchLine_8") SketchLine_7.result().setName("SketchLine_8") SketchLine_8 = Sketch_1.addLine(6.999999999999999, -5, 4.113248654051876, 0) SketchLine_8.setName("SketchLine_9") SketchLine_8.result().setName("SketchLine_9") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_9") SketchLine_9 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_9.setName("SketchLine_10") SketchLine_9.result().setName("SketchLine_10") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.result()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.result() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_10") SketchLine_10 = Sketch_1.addLine(4.113248654051876, 0, 0, 0) SketchLine_10.setName("SketchLine_11") SketchLine_10.result().setName("SketchLine_11") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_10.startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_11") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_10.endPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_12") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_10.endPoint() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_13") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_9.startPoint(), SketchLine_10.endPoint() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_14") SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result()) @@ -69,146 +93,806 @@ SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), "H") SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 14) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.endPoint(), SketchLine_3.result(), 1) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_2.endPoint(), SketchLine_1.result(), 1) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_4.endPoint(), SketchLine_3.result(), 1) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_5.result(), 1) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_10.result(), SketchLine_8.result(), 120) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_7.result(), 5) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_1.endPoint(), SketchLine_3.result(), 1 +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_2.endPoint(), SketchLine_1.result(), 1 +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_4.endPoint(), SketchLine_3.result(), 1 +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_5.result(), 1 +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_10.result(), SketchLine_8.result(), 120 +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_7.result(), 5 +) SketchLine_11 = Sketch_1.addLine(19, -12, 20, -11) SketchLine_11.setName("SketchLine_12") SketchLine_11.result().setName("SketchLine_12") SketchLine_12 = Sketch_1.addLine(20, -11, 20, -5.999999999999999) SketchLine_12.setName("SketchLine_13") SketchLine_12.result().setName("SketchLine_13") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_15") SketchLine_13 = Sketch_1.addLine(20, -5.999999999999999, 19, -4.999999999999999) SketchLine_13.setName("SketchLine_14") SketchLine_13.result().setName("SketchLine_14") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_16") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchLine_13.endPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchLine_13.endPoint() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_17") SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_12.result()) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_12.result(), 1) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_12.endPoint(), SketchLine_7.result(), 1) -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_11.endPoint(), SketchLine_6.result(), 1) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_6.endPoint()) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_7.startPoint(), SketchLine_12.result(), 1 +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchLine_12.endPoint(), SketchLine_7.result(), 1 +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchLine_11.endPoint(), SketchLine_6.result(), 1 +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_6.endPoint() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_18") -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_12.result(), 1) -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchLine_12.result(), SketchLine_1.startPoint(), 20) -SketchConstraintDistance_11 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_12.result(), 10) -SketchConstraintDistance_12 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_6.result(), 12) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_6.endPoint(), SketchLine_12.result(), 1 +) +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchLine_12.result(), SketchLine_1.startPoint(), 20 +) +SketchConstraintDistance_11 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_12.result(), 10 +) +SketchConstraintDistance_12 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_6.result(), 12 +) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchCircle_1 = Sketch_2.addCircle(0, 0, 15) SketchCircle_1.setAuxiliary(True) SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchPoint_2.result()) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchCircle_1.center(), SketchPoint_2.result() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_19") SketchLine_14 = Sketch_2.addLine(0, 0, 0, 16.1218227641764) SketchLine_14.setName("SketchLine_15") SketchLine_14.result().setName("SketchLine_15") SketchLine_14.setAuxiliary(True) -SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchPoint_2.result()) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchPoint_2.result() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_20") SketchLine_15 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_15.setName("SketchLine_16") SketchLine_15.result().setName("SketchLine_16") -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.result()) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.result() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_21") SketchLine_16 = Sketch_2.addLine(0, 0, -0.2832873010083918, 16.2295186052545) SketchLine_16.setName("SketchLine_17") SketchLine_16.result().setName("SketchLine_17") SketchLine_16.setAuxiliary(True) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchCircle_1.center(), SketchLine_16.startPoint() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_22") -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchPoint_2.coordinates(), SketchLine_16.startPoint() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_23") -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchLine_16.startPoint() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_24") -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_15.startPoint(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_15.startPoint(), SketchLine_16.startPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_25") SketchLine_17 = Sketch_2.addLine(0, 0, 0.2801569326356649, 16.05017992223931) SketchLine_17.setName("SketchLine_18") SketchLine_17.result().setName("SketchLine_18") SketchLine_17.setAuxiliary(True) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchCircle_1.center(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_26") -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchPoint_2.coordinates(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_27") -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_28") -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_15.startPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchLine_15.startPoint(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_29") -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchLine_16.startPoint(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_30") -SketchConstraintAngle_2 = Sketch_2.setAngle(SketchLine_15.result(), SketchLine_16.result(), 1) -SketchConstraintAngle_3 = Sketch_2.setAngle(SketchLine_17.result(), SketchLine_14.result(), 1) +SketchConstraintAngle_2 = Sketch_2.setAngle( + SketchLine_15.result(), SketchLine_16.result(), 1 +) +SketchConstraintAngle_3 = Sketch_2.setAngle( + SketchLine_17.result(), SketchLine_14.result(), 1 +) SketchCircle_2 = Sketch_2.addCircle(0, 0, 14.5) SketchCircle_2.setAuxiliary(True) -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchCircle_2.center()) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchCircle_1.center(), SketchCircle_2.center() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_31") -SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchCircle_2.center()) +SketchConstraintCoincidence_30 = Sketch_2.setCoincident( + SketchPoint_2.coordinates(), SketchCircle_2.center() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_32") -SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_31 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchCircle_2.center() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_33") -SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchLine_15.startPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_32 = Sketch_2.setCoincident( + SketchLine_15.startPoint(), SketchCircle_2.center() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_34") -SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_33 = Sketch_2.setCoincident( + SketchLine_16.startPoint(), SketchCircle_2.center() +) SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_35") -SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchLine_17.startPoint(), SketchCircle_2.center()) +SketchConstraintCoincidence_34 = Sketch_2.setCoincident( + SketchLine_17.startPoint(), SketchCircle_2.center() +) SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_36") SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_2.results()[1], 14.5) SketchConstraintRadius_1.setName("SketchConstraintRadius_2") SketchPoint_3 = Sketch_2.addPoint(-0.2530598933406104, 14.49779157976767) SketchPoint_3.setAuxiliary(True) -SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchCircle_2.results()[1]) +SketchConstraintCoincidence_35 = Sketch_2.setCoincident( + SketchPoint_3.coordinates(), SketchCircle_2.results()[1] +) SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_37") SketchPoint_4 = Sketch_2.addPoint(0.2530598933406125, 14.49779157976767) SketchPoint_4.setAuxiliary(True) -SketchConstraintCoincidence_36 = Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchCircle_2.results()[1]) +SketchConstraintCoincidence_36 = Sketch_2.setCoincident( + SketchPoint_4.coordinates(), SketchCircle_2.results()[1] +) SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_38") SketchPoint_5 = Sketch_2.addPoint(0, 15) SketchPoint_5.setAuxiliary(True) -SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchPoint_5.coordinates(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_37 = Sketch_2.setCoincident( + SketchPoint_5.coordinates(), SketchCircle_1.results()[1] +) SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_39") -SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchPoint_5.coordinates(), SketchLine_14.result()) +SketchConstraintCoincidence_38 = Sketch_2.setCoincident( + SketchPoint_5.coordinates(), SketchLine_14.result() +) SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_40") -SketchConstraintCoincidence_39 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_16.result()) +SketchConstraintCoincidence_39 = Sketch_2.setCoincident( + SketchPoint_3.coordinates(), SketchLine_16.result() +) SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_41") -SketchConstraintCoincidence_40 = Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchLine_17.result()) +SketchConstraintCoincidence_40 = Sketch_2.setCoincident( + SketchPoint_4.coordinates(), SketchLine_17.result() +) SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_42") SketchPoint_6 = Sketch_2.addPoint(-0.007888159418852939, 14.98416933181028) SketchPoint_7 = Sketch_2.addPoint(0.008097225251087385, 14.98393070253871) -SketchArc_1 = Sketch_2.addArc(0, 14.9770475280675, -0.007888159418852939, 14.98416933181028, 0.008097225251087385, 14.98393070253871, True) -SketchConstraintCoincidence_41 = Sketch_2.setCoincident(SketchArc_1.center(), SketchLine_15.result()) +SketchArc_1 = Sketch_2.addArc( + 0, + 14.9770475280675, + -0.007888159418852939, + 14.98416933181028, + 0.008097225251087385, + 14.98393070253871, + True, +) +SketchConstraintCoincidence_41 = Sketch_2.setCoincident( + SketchArc_1.center(), SketchLine_15.result() +) SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_50") -SketchConstraintCoincidence_42 = Sketch_2.setCoincident(SketchPoint_6.coordinates(), SketchArc_1.startPoint()) +SketchConstraintCoincidence_42 = Sketch_2.setCoincident( + SketchPoint_6.coordinates(), SketchArc_1.startPoint() +) SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_51") -SketchConstraintCoincidence_43 = Sketch_2.setCoincident(SketchPoint_7.coordinates(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_43 = Sketch_2.setCoincident( + SketchPoint_7.coordinates(), SketchArc_1.endPoint() +) SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_52") -SketchLine_18 = Sketch_2.addLine(-0.2530598933406097, 14.49779157976767, -0.007888159418852939, 14.98416933181028) +SketchLine_18 = Sketch_2.addLine( + -0.2530598933406097, 14.49779157976767, -0.007888159418852939, 14.98416933181028 +) SketchLine_18.setName("SketchLine_382") SketchLine_18.result().setName("SketchLine_382") -SketchConstraintCoincidence_44 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_18.startPoint()) -SketchConstraintCoincidence_45 = Sketch_2.setCoincident(SketchPoint_6.coordinates(), SketchLine_18.endPoint()) +SketchConstraintCoincidence_44 = Sketch_2.setCoincident( + SketchPoint_3.coordinates(), SketchLine_18.startPoint() +) +SketchConstraintCoincidence_45 = Sketch_2.setCoincident( + SketchPoint_6.coordinates(), SketchLine_18.endPoint() +) SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_46") -SketchConstraintCoincidence_46 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_18.endPoint()) +SketchConstraintCoincidence_46 = Sketch_2.setCoincident( + SketchArc_1.startPoint(), SketchLine_18.endPoint() +) SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_47") -SketchLine_19 = Sketch_2.addLine(0.008097225251087385, 14.98393070253871, 0.2530598933406125, 14.49779157976767) +SketchLine_19 = Sketch_2.addLine( + 0.008097225251087385, 14.98393070253871, 0.2530598933406125, 14.49779157976767 +) SketchLine_19.setName("SketchLine_383") SketchLine_19.result().setName("SketchLine_383") -SketchConstraintCoincidence_47 = Sketch_2.setCoincident(SketchPoint_7.coordinates(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_47 = Sketch_2.setCoincident( + SketchPoint_7.coordinates(), SketchLine_19.startPoint() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_48") -SketchConstraintCoincidence_48 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_48 = Sketch_2.setCoincident( + SketchArc_1.endPoint(), SketchLine_19.startPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_49") -SketchConstraintCoincidence_49 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchPoint_4.coordinates()) +SketchConstraintCoincidence_49 = Sketch_2.setCoincident( + SketchLine_19.endPoint(), SketchPoint_4.coordinates() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_54") -SketchMultiRotation_1_objects = [SketchLine_18.result(), SketchArc_1.results()[1], SketchLine_19.result()] -SketchMultiRotation_1 = Sketch_2.addRotation(SketchMultiRotation_1_objects, SketchPoint_2.coordinates(), 2, 180) -[SketchLine_20, SketchLine_21, SketchLine_22, SketchLine_23, SketchLine_24, SketchLine_25, SketchLine_26, SketchLine_27, SketchLine_28, SketchLine_29, SketchLine_30, SketchLine_31, SketchLine_32, SketchLine_33, SketchLine_34, SketchLine_35, SketchLine_36, SketchLine_37, SketchLine_38, SketchLine_39, SketchLine_40, SketchLine_41, SketchLine_42, SketchLine_43, SketchLine_44, SketchLine_45, SketchLine_46, SketchLine_47, SketchLine_48, SketchLine_49, SketchLine_50, SketchLine_51, SketchLine_52, SketchLine_53, SketchLine_54, SketchLine_55, SketchLine_56, SketchLine_57, SketchLine_58, SketchLine_59, SketchLine_60, SketchLine_61, SketchLine_62, SketchLine_63, SketchLine_64, SketchLine_65, SketchLine_66, SketchLine_67, SketchLine_68, SketchLine_69, SketchLine_70, SketchLine_71, SketchLine_72, SketchLine_73, SketchLine_74, SketchLine_75, SketchLine_76, SketchLine_77, SketchLine_78, SketchLine_79, SketchLine_80, SketchLine_81, SketchLine_82, SketchLine_83, SketchLine_84, SketchLine_85, SketchLine_86, SketchLine_87, SketchLine_88, SketchLine_89, SketchLine_90, SketchLine_91, SketchLine_92, SketchLine_93, SketchLine_94, SketchLine_95, SketchLine_96, SketchLine_97, SketchLine_98, SketchLine_99, SketchLine_100, SketchLine_101, SketchLine_102, SketchLine_103, SketchLine_104, SketchLine_105, SketchLine_106, SketchLine_107, SketchLine_108, SketchLine_109, SketchLine_110, SketchLine_111, SketchLine_112, SketchLine_113, SketchLine_114, SketchLine_115, SketchLine_116, SketchLine_117, SketchLine_118, SketchLine_119, SketchLine_120, SketchLine_121, SketchLine_122, SketchLine_123, SketchLine_124, SketchLine_125, SketchLine_126, SketchLine_127, SketchLine_128, SketchLine_129, SketchLine_130, SketchLine_131, SketchLine_132, SketchLine_133, SketchLine_134, SketchLine_135, SketchLine_136, SketchLine_137, SketchLine_138, SketchLine_139, SketchLine_140, SketchLine_141, SketchLine_142, SketchLine_143, SketchLine_144, SketchLine_145, SketchLine_146, SketchLine_147, SketchLine_148, SketchLine_149, SketchLine_150, SketchLine_151, SketchLine_152, SketchLine_153, SketchLine_154, SketchLine_155, SketchLine_156, SketchLine_157, SketchLine_158, SketchLine_159, SketchLine_160, SketchLine_161, SketchLine_162, SketchLine_163, SketchLine_164, SketchLine_165, SketchLine_166, SketchLine_167, SketchLine_168, SketchLine_169, SketchLine_170, SketchLine_171, SketchLine_172, SketchLine_173, SketchLine_174, SketchLine_175, SketchLine_176, SketchLine_177, SketchLine_178, SketchLine_179, SketchLine_180, SketchLine_181, SketchLine_182, SketchLine_183, SketchLine_184, SketchLine_185, SketchLine_186, SketchLine_187, SketchLine_188, SketchLine_189, SketchLine_190, SketchLine_191, SketchLine_192, SketchLine_193, SketchLine_194, SketchLine_195, SketchLine_196, SketchLine_197, SketchLine_198, SketchArc_2, SketchArc_3, SketchArc_4, SketchArc_5, SketchArc_6, SketchArc_7, SketchArc_8, SketchArc_9, SketchArc_10, SketchArc_11, SketchArc_12, SketchArc_13, SketchArc_14, SketchArc_15, SketchArc_16, SketchArc_17, SketchArc_18, SketchArc_19, SketchArc_20, SketchArc_21, SketchArc_22, SketchArc_23, SketchArc_24, SketchArc_25, SketchArc_26, SketchArc_27, SketchArc_28, SketchArc_29, SketchArc_30, SketchArc_31, SketchArc_32, SketchArc_33, SketchArc_34, SketchArc_35, SketchArc_36, SketchArc_37, SketchArc_38, SketchArc_39, SketchArc_40, SketchArc_41, SketchArc_42, SketchArc_43, SketchArc_44, SketchArc_45, SketchArc_46, SketchArc_47, SketchArc_48, SketchArc_49, SketchArc_50, SketchArc_51, SketchArc_52, SketchArc_53, SketchArc_54, SketchArc_55, SketchArc_56, SketchArc_57, SketchArc_58, SketchArc_59, SketchArc_60, SketchArc_61, SketchArc_62, SketchArc_63, SketchArc_64, SketchArc_65, SketchArc_66, SketchArc_67, SketchArc_68, SketchArc_69, SketchArc_70, SketchArc_71, SketchArc_72, SketchArc_73, SketchArc_74, SketchArc_75, SketchArc_76, SketchArc_77, SketchArc_78, SketchArc_79, SketchArc_80, SketchArc_81, SketchArc_82, SketchArc_83, SketchArc_84, SketchArc_85, SketchArc_86, SketchArc_87, SketchArc_88, SketchArc_89, SketchArc_90, SketchArc_91, SketchArc_92, SketchArc_93, SketchArc_94, SketchArc_95, SketchArc_96, SketchArc_97, SketchArc_98, SketchArc_99, SketchArc_100, SketchArc_101, SketchArc_102, SketchArc_103, SketchArc_104, SketchArc_105, SketchArc_106, SketchArc_107, SketchArc_108, SketchArc_109, SketchArc_110, SketchArc_111, SketchArc_112, SketchArc_113, SketchArc_114, SketchArc_115, SketchArc_116, SketchArc_117, SketchArc_118, SketchArc_119, SketchArc_120, SketchArc_121, SketchArc_122, SketchArc_123, SketchArc_124, SketchArc_125, SketchArc_126, SketchArc_127, SketchArc_128, SketchArc_129, SketchArc_130, SketchArc_131, SketchArc_132, SketchArc_133, SketchArc_134, SketchArc_135, SketchArc_136, SketchArc_137, SketchArc_138, SketchArc_139, SketchArc_140, SketchArc_141, SketchArc_142, SketchArc_143, SketchArc_144, SketchArc_145, SketchArc_146, SketchArc_147, SketchArc_148, SketchArc_149, SketchArc_150, SketchArc_151, SketchArc_152, SketchArc_153, SketchArc_154, SketchArc_155, SketchArc_156, SketchArc_157, SketchArc_158, SketchArc_159, SketchArc_160, SketchArc_161, SketchArc_162, SketchArc_163, SketchArc_164, SketchArc_165, SketchArc_166, SketchArc_167, SketchArc_168, SketchArc_169, SketchArc_170, SketchArc_171, SketchArc_172, SketchArc_173, SketchArc_174, SketchArc_175, SketchArc_176, SketchArc_177, SketchArc_178, SketchArc_179, SketchArc_180, SketchLine_199, SketchLine_200, SketchLine_201, SketchLine_202, SketchLine_203, SketchLine_204, SketchLine_205, SketchLine_206, SketchLine_207, SketchLine_208, SketchLine_209, SketchLine_210, SketchLine_211, SketchLine_212, SketchLine_213, SketchLine_214, SketchLine_215, SketchLine_216, SketchLine_217, SketchLine_218, SketchLine_219, SketchLine_220, SketchLine_221, SketchLine_222, SketchLine_223, SketchLine_224, SketchLine_225, SketchLine_226, SketchLine_227, SketchLine_228, SketchLine_229, SketchLine_230, SketchLine_231, SketchLine_232, SketchLine_233, SketchLine_234, SketchLine_235, SketchLine_236, SketchLine_237, SketchLine_238, SketchLine_239, SketchLine_240, SketchLine_241, SketchLine_242, SketchLine_243, SketchLine_244, SketchLine_245, SketchLine_246, SketchLine_247, SketchLine_248, SketchLine_249, SketchLine_250, SketchLine_251, SketchLine_252, SketchLine_253, SketchLine_254, SketchLine_255, SketchLine_256, SketchLine_257, SketchLine_258, SketchLine_259, SketchLine_260, SketchLine_261, SketchLine_262, SketchLine_263, SketchLine_264, SketchLine_265, SketchLine_266, SketchLine_267, SketchLine_268, SketchLine_269, SketchLine_270, SketchLine_271, SketchLine_272, SketchLine_273, SketchLine_274, SketchLine_275, SketchLine_276, SketchLine_277, SketchLine_278, SketchLine_279, SketchLine_280, SketchLine_281, SketchLine_282, SketchLine_283, SketchLine_284, SketchLine_285, SketchLine_286, SketchLine_287, SketchLine_288, SketchLine_289, SketchLine_290, SketchLine_291, SketchLine_292, SketchLine_293, SketchLine_294, SketchLine_295, SketchLine_296, SketchLine_297, SketchLine_298, SketchLine_299, SketchLine_300, SketchLine_301, SketchLine_302, SketchLine_303, SketchLine_304, SketchLine_305, SketchLine_306, SketchLine_307, SketchLine_308, SketchLine_309, SketchLine_310, SketchLine_311, SketchLine_312, SketchLine_313, SketchLine_314, SketchLine_315, SketchLine_316, SketchLine_317, SketchLine_318, SketchLine_319, SketchLine_320, SketchLine_321, SketchLine_322, SketchLine_323, SketchLine_324, SketchLine_325, SketchLine_326, SketchLine_327, SketchLine_328, SketchLine_329, SketchLine_330, SketchLine_331, SketchLine_332, SketchLine_333, SketchLine_334, SketchLine_335, SketchLine_336, SketchLine_337, SketchLine_338, SketchLine_339, SketchLine_340, SketchLine_341, SketchLine_342, SketchLine_343, SketchLine_344, SketchLine_345, SketchLine_346, SketchLine_347, SketchLine_348, SketchLine_349, SketchLine_350, SketchLine_351, SketchLine_352, SketchLine_353, SketchLine_354, SketchLine_355, SketchLine_356, SketchLine_357, SketchLine_358, SketchLine_359, SketchLine_360, SketchLine_361, SketchLine_362, SketchLine_363, SketchLine_364, SketchLine_365, SketchLine_366, SketchLine_367, SketchLine_368, SketchLine_369, SketchLine_370, SketchLine_371, SketchLine_372, SketchLine_373, SketchLine_374, SketchLine_375, SketchLine_376, SketchLine_377] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1_objects = [ + SketchLine_18.result(), + SketchArc_1.results()[1], + SketchLine_19.result(), +] +SketchMultiRotation_1 = Sketch_2.addRotation( + SketchMultiRotation_1_objects, SketchPoint_2.coordinates(), 2, 180 +) +[ + SketchLine_20, + SketchLine_21, + SketchLine_22, + SketchLine_23, + SketchLine_24, + SketchLine_25, + SketchLine_26, + SketchLine_27, + SketchLine_28, + SketchLine_29, + SketchLine_30, + SketchLine_31, + SketchLine_32, + SketchLine_33, + SketchLine_34, + SketchLine_35, + SketchLine_36, + SketchLine_37, + SketchLine_38, + SketchLine_39, + SketchLine_40, + SketchLine_41, + SketchLine_42, + SketchLine_43, + SketchLine_44, + SketchLine_45, + SketchLine_46, + SketchLine_47, + SketchLine_48, + SketchLine_49, + SketchLine_50, + SketchLine_51, + SketchLine_52, + SketchLine_53, + SketchLine_54, + SketchLine_55, + SketchLine_56, + SketchLine_57, + SketchLine_58, + SketchLine_59, + SketchLine_60, + SketchLine_61, + SketchLine_62, + SketchLine_63, + SketchLine_64, + SketchLine_65, + SketchLine_66, + SketchLine_67, + SketchLine_68, + SketchLine_69, + SketchLine_70, + SketchLine_71, + SketchLine_72, + SketchLine_73, + SketchLine_74, + SketchLine_75, + SketchLine_76, + SketchLine_77, + SketchLine_78, + SketchLine_79, + SketchLine_80, + SketchLine_81, + SketchLine_82, + SketchLine_83, + SketchLine_84, + SketchLine_85, + SketchLine_86, + SketchLine_87, + SketchLine_88, + SketchLine_89, + SketchLine_90, + SketchLine_91, + SketchLine_92, + SketchLine_93, + SketchLine_94, + SketchLine_95, + SketchLine_96, + SketchLine_97, + SketchLine_98, + SketchLine_99, + SketchLine_100, + SketchLine_101, + SketchLine_102, + SketchLine_103, + SketchLine_104, + SketchLine_105, + SketchLine_106, + SketchLine_107, + SketchLine_108, + SketchLine_109, + SketchLine_110, + SketchLine_111, + SketchLine_112, + SketchLine_113, + SketchLine_114, + SketchLine_115, + SketchLine_116, + SketchLine_117, + SketchLine_118, + SketchLine_119, + SketchLine_120, + SketchLine_121, + SketchLine_122, + SketchLine_123, + SketchLine_124, + SketchLine_125, + SketchLine_126, + SketchLine_127, + SketchLine_128, + SketchLine_129, + SketchLine_130, + SketchLine_131, + SketchLine_132, + SketchLine_133, + SketchLine_134, + SketchLine_135, + SketchLine_136, + SketchLine_137, + SketchLine_138, + SketchLine_139, + SketchLine_140, + SketchLine_141, + SketchLine_142, + SketchLine_143, + SketchLine_144, + SketchLine_145, + SketchLine_146, + SketchLine_147, + SketchLine_148, + SketchLine_149, + SketchLine_150, + SketchLine_151, + SketchLine_152, + SketchLine_153, + SketchLine_154, + SketchLine_155, + SketchLine_156, + SketchLine_157, + SketchLine_158, + SketchLine_159, + SketchLine_160, + SketchLine_161, + SketchLine_162, + SketchLine_163, + SketchLine_164, + SketchLine_165, + SketchLine_166, + SketchLine_167, + SketchLine_168, + SketchLine_169, + SketchLine_170, + SketchLine_171, + SketchLine_172, + SketchLine_173, + SketchLine_174, + SketchLine_175, + SketchLine_176, + SketchLine_177, + SketchLine_178, + SketchLine_179, + SketchLine_180, + SketchLine_181, + SketchLine_182, + SketchLine_183, + SketchLine_184, + SketchLine_185, + SketchLine_186, + SketchLine_187, + SketchLine_188, + SketchLine_189, + SketchLine_190, + SketchLine_191, + SketchLine_192, + SketchLine_193, + SketchLine_194, + SketchLine_195, + SketchLine_196, + SketchLine_197, + SketchLine_198, + SketchArc_2, + SketchArc_3, + SketchArc_4, + SketchArc_5, + SketchArc_6, + SketchArc_7, + SketchArc_8, + SketchArc_9, + SketchArc_10, + SketchArc_11, + SketchArc_12, + SketchArc_13, + SketchArc_14, + SketchArc_15, + SketchArc_16, + SketchArc_17, + SketchArc_18, + SketchArc_19, + SketchArc_20, + SketchArc_21, + SketchArc_22, + SketchArc_23, + SketchArc_24, + SketchArc_25, + SketchArc_26, + SketchArc_27, + SketchArc_28, + SketchArc_29, + SketchArc_30, + SketchArc_31, + SketchArc_32, + SketchArc_33, + SketchArc_34, + SketchArc_35, + SketchArc_36, + SketchArc_37, + SketchArc_38, + SketchArc_39, + SketchArc_40, + SketchArc_41, + SketchArc_42, + SketchArc_43, + SketchArc_44, + SketchArc_45, + SketchArc_46, + SketchArc_47, + SketchArc_48, + SketchArc_49, + SketchArc_50, + SketchArc_51, + SketchArc_52, + SketchArc_53, + SketchArc_54, + SketchArc_55, + SketchArc_56, + SketchArc_57, + SketchArc_58, + SketchArc_59, + SketchArc_60, + SketchArc_61, + SketchArc_62, + SketchArc_63, + SketchArc_64, + SketchArc_65, + SketchArc_66, + SketchArc_67, + SketchArc_68, + SketchArc_69, + SketchArc_70, + SketchArc_71, + SketchArc_72, + SketchArc_73, + SketchArc_74, + SketchArc_75, + SketchArc_76, + SketchArc_77, + SketchArc_78, + SketchArc_79, + SketchArc_80, + SketchArc_81, + SketchArc_82, + SketchArc_83, + SketchArc_84, + SketchArc_85, + SketchArc_86, + SketchArc_87, + SketchArc_88, + SketchArc_89, + SketchArc_90, + SketchArc_91, + SketchArc_92, + SketchArc_93, + SketchArc_94, + SketchArc_95, + SketchArc_96, + SketchArc_97, + SketchArc_98, + SketchArc_99, + SketchArc_100, + SketchArc_101, + SketchArc_102, + SketchArc_103, + SketchArc_104, + SketchArc_105, + SketchArc_106, + SketchArc_107, + SketchArc_108, + SketchArc_109, + SketchArc_110, + SketchArc_111, + SketchArc_112, + SketchArc_113, + SketchArc_114, + SketchArc_115, + SketchArc_116, + SketchArc_117, + SketchArc_118, + SketchArc_119, + SketchArc_120, + SketchArc_121, + SketchArc_122, + SketchArc_123, + SketchArc_124, + SketchArc_125, + SketchArc_126, + SketchArc_127, + SketchArc_128, + SketchArc_129, + SketchArc_130, + SketchArc_131, + SketchArc_132, + SketchArc_133, + SketchArc_134, + SketchArc_135, + SketchArc_136, + SketchArc_137, + SketchArc_138, + SketchArc_139, + SketchArc_140, + SketchArc_141, + SketchArc_142, + SketchArc_143, + SketchArc_144, + SketchArc_145, + SketchArc_146, + SketchArc_147, + SketchArc_148, + SketchArc_149, + SketchArc_150, + SketchArc_151, + SketchArc_152, + SketchArc_153, + SketchArc_154, + SketchArc_155, + SketchArc_156, + SketchArc_157, + SketchArc_158, + SketchArc_159, + SketchArc_160, + SketchArc_161, + SketchArc_162, + SketchArc_163, + SketchArc_164, + SketchArc_165, + SketchArc_166, + SketchArc_167, + SketchArc_168, + SketchArc_169, + SketchArc_170, + SketchArc_171, + SketchArc_172, + SketchArc_173, + SketchArc_174, + SketchArc_175, + SketchArc_176, + SketchArc_177, + SketchArc_178, + SketchArc_179, + SketchArc_180, + SketchLine_199, + SketchLine_200, + SketchLine_201, + SketchLine_202, + SketchLine_203, + SketchLine_204, + SketchLine_205, + SketchLine_206, + SketchLine_207, + SketchLine_208, + SketchLine_209, + SketchLine_210, + SketchLine_211, + SketchLine_212, + SketchLine_213, + SketchLine_214, + SketchLine_215, + SketchLine_216, + SketchLine_217, + SketchLine_218, + SketchLine_219, + SketchLine_220, + SketchLine_221, + SketchLine_222, + SketchLine_223, + SketchLine_224, + SketchLine_225, + SketchLine_226, + SketchLine_227, + SketchLine_228, + SketchLine_229, + SketchLine_230, + SketchLine_231, + SketchLine_232, + SketchLine_233, + SketchLine_234, + SketchLine_235, + SketchLine_236, + SketchLine_237, + SketchLine_238, + SketchLine_239, + SketchLine_240, + SketchLine_241, + SketchLine_242, + SketchLine_243, + SketchLine_244, + SketchLine_245, + SketchLine_246, + SketchLine_247, + SketchLine_248, + SketchLine_249, + SketchLine_250, + SketchLine_251, + SketchLine_252, + SketchLine_253, + SketchLine_254, + SketchLine_255, + SketchLine_256, + SketchLine_257, + SketchLine_258, + SketchLine_259, + SketchLine_260, + SketchLine_261, + SketchLine_262, + SketchLine_263, + SketchLine_264, + SketchLine_265, + SketchLine_266, + SketchLine_267, + SketchLine_268, + SketchLine_269, + SketchLine_270, + SketchLine_271, + SketchLine_272, + SketchLine_273, + SketchLine_274, + SketchLine_275, + SketchLine_276, + SketchLine_277, + SketchLine_278, + SketchLine_279, + SketchLine_280, + SketchLine_281, + SketchLine_282, + SketchLine_283, + SketchLine_284, + SketchLine_285, + SketchLine_286, + SketchLine_287, + SketchLine_288, + SketchLine_289, + SketchLine_290, + SketchLine_291, + SketchLine_292, + SketchLine_293, + SketchLine_294, + SketchLine_295, + SketchLine_296, + SketchLine_297, + SketchLine_298, + SketchLine_299, + SketchLine_300, + SketchLine_301, + SketchLine_302, + SketchLine_303, + SketchLine_304, + SketchLine_305, + SketchLine_306, + SketchLine_307, + SketchLine_308, + SketchLine_309, + SketchLine_310, + SketchLine_311, + SketchLine_312, + SketchLine_313, + SketchLine_314, + SketchLine_315, + SketchLine_316, + SketchLine_317, + SketchLine_318, + SketchLine_319, + SketchLine_320, + SketchLine_321, + SketchLine_322, + SketchLine_323, + SketchLine_324, + SketchLine_325, + SketchLine_326, + SketchLine_327, + SketchLine_328, + SketchLine_329, + SketchLine_330, + SketchLine_331, + SketchLine_332, + SketchLine_333, + SketchLine_334, + SketchLine_335, + SketchLine_336, + SketchLine_337, + SketchLine_338, + SketchLine_339, + SketchLine_340, + SketchLine_341, + SketchLine_342, + SketchLine_343, + SketchLine_344, + SketchLine_345, + SketchLine_346, + SketchLine_347, + SketchLine_348, + SketchLine_349, + SketchLine_350, + SketchLine_351, + SketchLine_352, + SketchLine_353, + SketchLine_354, + SketchLine_355, + SketchLine_356, + SketchLine_357, + SketchLine_358, + SketchLine_359, + SketchLine_360, + SketchLine_361, + SketchLine_362, + SketchLine_363, + SketchLine_364, + SketchLine_365, + SketchLine_366, + SketchLine_367, + SketchLine_368, + SketchLine_369, + SketchLine_370, + SketchLine_371, + SketchLine_372, + SketchLine_373, + SketchLine_374, + SketchLine_375, + SketchLine_376, + SketchLine_377, +] = SketchMultiRotation_1.rotated() SketchLine_199.setName("SketchLine_21") SketchLine_199.result().setName("SketchLine_21") SketchLine_198.setName("SketchLine_199") @@ -568,7 +1252,9 @@ SketchLine_22.result().setName("SketchLine_23") SketchLine_21.setName("SketchLine_22") SketchLine_21.result().setName("SketchLine_22") SketchCircle_3 = Sketch_2.addCircle(0, 0, 19.22880100399138) -SketchConstraintCoincidence_50 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchPoint_2.result()) +SketchConstraintCoincidence_50 = Sketch_2.setCoincident( + SketchCircle_3.center(), SketchPoint_2.result() +) SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_53") model.do() Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) @@ -576,14 +1262,50 @@ SketchCircle_4 = Sketch_3.addCircle(15, 0, 1) SketchConstraintRadius_2 = Sketch_3.setRadius(SketchCircle_4.results()[1], 1) SketchConstraintRadius_2.setName("SketchConstraintRadius_3") SketchLine_378 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchCircle_4.center(), SketchLine_378.result()) +SketchConstraintCoincidence_51 = Sketch_3.setCoincident( + SketchCircle_4.center(), SketchLine_378.result() +) 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) +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_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")]) +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) @@ -602,4 +1324,4 @@ model.testNbSubShapes(ExtrusionCut_2, GeomAPI_Shape.EDGE, [3481]) model.testNbSubShapes(ExtrusionCut_2, GeomAPI_Shape.VERTEX, [6962]) model.testResultsVolumes(ExtrusionCut_2, [10362.3368]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.models/case24.py b/test.models/case24.py index 980f97e15..db0daef91 100644 --- a/test.models/case24.py +++ b/test.models/case24.py @@ -45,14 +45,22 @@ SketchLine_5 = Sketch_1.addLine(20, 20, 20, 0) SketchLine_5.setName("SketchLine_4") SketchLine_5.result().setName("SketchLine_4") SketchLine_5.setAuxiliary(True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_6 = Sketch_1.addLine(0, 20, 20, 20) SketchLine_6.setName("SketchLine_3") SketchLine_6.result().setName("SketchLine_3") SketchLine_6.setAuxiliary(True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_5.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_6.result()) @@ -66,21 +74,66 @@ SketchLine_8 = SketchProjection_2.createdFeature() SketchLine_8.setName("SketchLine_6") SketchLine_8.result().setName("SketchLine_6") 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()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_4.result()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_1.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_4.endPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_6.result()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_5.result()) +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() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_4.result() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchLine_1.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_4.endPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_6.result() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_4.startPoint(), SketchLine_5.result() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "R") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchAPI_Line(SketchLine_7).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) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchAPI_Line(SketchLine_7).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_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")]) +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, 20) SketchLine_9.setName("SketchLine_13") @@ -88,8 +141,12 @@ 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/SketchLine_1_EndVertex")) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchPoint_1.result()) +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") @@ -100,41 +157,93 @@ SketchLine_13 = Sketch_2.addLine(-20, 20, -20, 0) SketchLine_13.setName("SketchLine_12") SketchLine_13.result().setName("SketchLine_12") SketchLine_13.setAuxiliary(True) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_10.startPoint()) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_10.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchLine_14 = Sketch_2.addLine(0, 20, -20, 20) SketchLine_14.setName("SketchLine_11") SketchLine_14.result().setName("SketchLine_11") SketchLine_14.setAuxiliary(True) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_13.startPoint() +) 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, 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()) -SketchConstraintTangent_4 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_12.result()) -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_12.endPoint()) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_14.result()) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_12.startPoint(), SketchLine_13.result()) +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() +) +SketchConstraintTangent_4 = Sketch_2.setTangent( + SketchArc_2.results()[1], SketchLine_12.result() +) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchLine_13.endPoint(), SketchLine_12.endPoint() +) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchLine_9.endPoint(), SketchLine_14.result() +) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_12.startPoint(), SketchLine_13.result() +) 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) +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_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")) +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/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()) +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") @@ -145,36 +254,80 @@ SketchLine_19 = Sketch_3.addLine(-20, -20, -20, 0) SketchLine_19.setName("SketchLine_18") SketchLine_19.result().setName("SketchLine_18") SketchLine_19.setAuxiliary(True) -SketchConstraintCoincidence_24 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_25 = Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_24 = Sketch_3.setCoincident( + SketchLine_19.endPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_25 = Sketch_3.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) SketchLine_20 = Sketch_3.addLine(0, -20, -20, -20) SketchLine_20.setName("SketchLine_17") SketchLine_20.result().setName("SketchLine_17") SketchLine_20.setAuxiliary(True) -SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_27 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_26 = Sketch_3.setCoincident( + SketchLine_17.endPoint(), SketchLine_20.startPoint() +) +SketchConstraintCoincidence_27 = Sketch_3.setCoincident( + SketchLine_20.endPoint(), SketchLine_19.startPoint() +) 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, -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()) -SketchConstraintTangent_6 = Sketch_3.setTangent(SketchArc_3.results()[1], SketchLine_18.result()) -SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchLine_20.startPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchLine_18.endPoint()) -SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchLine_20.result()) -SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchLine_18.startPoint(), SketchLine_19.result()) +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() +) +SketchConstraintTangent_6 = Sketch_3.setTangent( + SketchArc_3.results()[1], SketchLine_18.result() +) +SketchConstraintCoincidence_30 = Sketch_3.setCoincident( + SketchLine_20.startPoint(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_31 = Sketch_3.setCoincident( + SketchLine_19.endPoint(), SketchLine_18.endPoint() +) +SketchConstraintCoincidence_32 = Sketch_3.setCoincident( + SketchLine_15.endPoint(), SketchLine_20.result() +) +SketchConstraintCoincidence_33 = Sketch_3.setCoincident( + SketchLine_18.startPoint(), SketchLine_19.result() +) SketchConstraintRadius_3 = Sketch_3.setRadius(SketchArc_3.results()[1], 3) -SketchConstraintDistance_5 = Sketch_3.setDistance(SketchLine_15.startPoint(), SketchLine_16.result(), 20) -SketchConstraintDistance_6 = Sketch_3.setDistance(SketchLine_18.endPoint(), SketchLine_17.result(), 20) +SketchConstraintDistance_5 = Sketch_3.setDistance( + SketchLine_15.startPoint(), SketchLine_16.result(), 20 +) +SketchConstraintDistance_6 = Sketch_3.setDistance( + SketchLine_18.endPoint(), SketchLine_17.result(), 20 +) SketchLine_21 = Sketch_3.addLine(-23, -0.01462093666115485, -23, -19.98755081419712) -SketchConstraintParallel_1 = Sketch_3.setParallel(SketchLine_17.result(), SketchLine_21.result()) -SketchConstraintDistance_7 = Sketch_3.setDistance(SketchLine_21.startPoint(), SketchLine_18.result(), 3) +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/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")) +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") @@ -191,49 +344,101 @@ SketchLine_26 = Sketch_4.addLine(20, -20, 20, 0) SketchLine_26.setName("SketchLine_25") SketchLine_26.result().setName("SketchLine_25") SketchLine_26.setAuxiliary(True) -SketchConstraintCoincidence_34 = Sketch_4.setCoincident(SketchLine_26.endPoint(), SketchLine_23.startPoint()) -SketchConstraintCoincidence_35 = Sketch_4.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) +SketchConstraintCoincidence_34 = Sketch_4.setCoincident( + SketchLine_26.endPoint(), SketchLine_23.startPoint() +) +SketchConstraintCoincidence_35 = Sketch_4.setCoincident( + SketchLine_23.endPoint(), SketchLine_24.startPoint() +) SketchLine_27 = Sketch_4.addLine(-3, -20, 20, -20) SketchLine_27.setName("SketchLine_24") SketchLine_27.result().setName("SketchLine_24") SketchLine_27.setAuxiliary(True) -SketchConstraintCoincidence_36 = Sketch_4.setCoincident(SketchLine_24.endPoint(), SketchLine_27.startPoint()) -SketchConstraintCoincidence_37 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchLine_26.startPoint()) +SketchConstraintCoincidence_36 = Sketch_4.setCoincident( + SketchLine_24.endPoint(), SketchLine_27.startPoint() +) +SketchConstraintCoincidence_37 = Sketch_4.setCoincident( + SketchLine_27.endPoint(), SketchLine_26.startPoint() +) 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, -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()) -SketchConstraintTangent_8 = Sketch_4.setTangent(SketchArc_4.results()[1], SketchLine_25.result()) -SketchConstraintCoincidence_40 = Sketch_4.setCoincident(SketchLine_27.startPoint(), SketchLine_22.startPoint()) -SketchConstraintCoincidence_41 = Sketch_4.setCoincident(SketchLine_26.endPoint(), SketchLine_25.endPoint()) -SketchConstraintCoincidence_42 = Sketch_4.setCoincident(SketchLine_22.endPoint(), SketchLine_27.result()) -SketchConstraintCoincidence_43 = Sketch_4.setCoincident(SketchLine_25.startPoint(), SketchLine_26.result()) +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() +) +SketchConstraintTangent_8 = Sketch_4.setTangent( + SketchArc_4.results()[1], SketchLine_25.result() +) +SketchConstraintCoincidence_40 = Sketch_4.setCoincident( + SketchLine_27.startPoint(), SketchLine_22.startPoint() +) +SketchConstraintCoincidence_41 = Sketch_4.setCoincident( + SketchLine_26.endPoint(), SketchLine_25.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/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) -SketchConstraintDistance_10 = Sketch_4.setDistance(SketchLine_24.result(), SketchLine_28.endPoint(), 3) +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 +) +SketchConstraintDistance_10 = Sketch_4.setDistance( + SketchLine_24.result(), SketchLine_28.endPoint(), 3 +) 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) +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_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")]) +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()) +SketchConstraintCoincidence_45 = Sketch_5.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.result() +) 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) SketchLine_33.setName("SketchLine_32") SketchLine_33.result().setName("SketchLine_32") -SketchConstraintCoincidence_46 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_46 = Sketch_5.setCoincident( + SketchLine_30.endPoint(), SketchLine_33.startPoint() +) SketchLine_34 = Sketch_5.addLine(65, 70.99999917134223, 65, 0) SketchLine_34.setName("SketchLine_40") SketchLine_34.result().setName("SketchLine_40") @@ -245,65 +450,119 @@ SketchLine_36 = Sketch_5.addLine(65, 77.00000000000001, 65, 0) SketchLine_36.setName("SketchLine_35") SketchLine_36.result().setName("SketchLine_35") SketchLine_36.setAuxiliary(True) -SketchConstraintCoincidence_47 = Sketch_5.setCoincident(SketchLine_35.endPoint(), SketchLine_36.startPoint()) +SketchConstraintCoincidence_47 = Sketch_5.setCoincident( + SketchLine_35.endPoint(), SketchLine_36.startPoint() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_49") SketchLine_37 = Sketch_5.addLine(65, 0, 0, 0) SketchLine_37.setName("SketchLine_38") SketchLine_37.result().setName("SketchLine_38") -SketchConstraintCoincidence_48 = Sketch_5.setCoincident(SketchLine_30.startPoint(), SketchLine_37.endPoint()) +SketchConstraintCoincidence_48 = Sketch_5.setCoincident( + SketchLine_30.startPoint(), SketchLine_37.endPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_53") -SketchConstraintCoincidence_49 = Sketch_5.setCoincident(SketchLine_37.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_49 = Sketch_5.setCoincident( + SketchLine_37.endPoint(), SketchLine_31.startPoint() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_54") SketchConstraintHorizontal_9 = Sketch_5.setHorizontal(SketchLine_37.result()) SketchConstraintVertical_9 = Sketch_5.setVertical(SketchLine_36.result()) SketchConstraintHorizontal_10 = Sketch_5.setHorizontal(SketchLine_33.result()) SketchConstraintHorizontal_11 = Sketch_5.setHorizontal(SketchLine_35.result()) -SketchConstraintDistance_12 = Sketch_5.setDistance(SketchLine_33.endPoint(), SketchLine_35.result(), 5) +SketchConstraintDistance_12 = Sketch_5.setDistance( + SketchLine_33.endPoint(), SketchLine_35.result(), 5 +) SketchConstraintDistance_12.setName("SketchConstraintDistance_14") -SketchConstraintDistance_13 = Sketch_5.setDistance(SketchLine_30.endPoint(), SketchLine_37.result(), 82) +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, 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") -SketchConstraintCoincidence_50 = Sketch_5.setCoincident(SketchArc_5.startPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_50 = Sketch_5.setCoincident( + SketchArc_5.startPoint(), SketchLine_34.startPoint() +) SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_57") -SketchConstraintCoincidence_51 = Sketch_5.setCoincident(SketchArc_5.endPoint(), SketchLine_32.endPoint()) +SketchConstraintCoincidence_51 = Sketch_5.setCoincident( + SketchArc_5.endPoint(), SketchLine_32.endPoint() +) SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_58") -SketchConstraintTangent_9 = Sketch_5.setTangent(SketchArc_5.results()[1], SketchLine_32.result()) +SketchConstraintTangent_9 = Sketch_5.setTangent( + SketchArc_5.results()[1], SketchLine_32.result() +) SketchConstraintTangent_9.setName("SketchConstraintTangent_10") -SketchConstraintTangent_10 = Sketch_5.setTangent(SketchArc_5.results()[1], SketchLine_34.result()) +SketchConstraintTangent_10 = Sketch_5.setTangent( + SketchArc_5.results()[1], SketchLine_34.result() +) SketchConstraintTangent_10.setName("SketchConstraintTangent_11") -SketchConstraintCoincidence_52 = Sketch_5.setCoincident(SketchLine_35.startPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_52 = Sketch_5.setCoincident( + SketchLine_35.startPoint(), SketchLine_32.startPoint() +) SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_59") -SketchConstraintCoincidence_53 = Sketch_5.setCoincident(SketchLine_36.endPoint(), SketchLine_34.endPoint()) +SketchConstraintCoincidence_53 = Sketch_5.setCoincident( + SketchLine_36.endPoint(), SketchLine_34.endPoint() +) SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_60") -SketchConstraintCoincidence_54 = Sketch_5.setCoincident(SketchLine_32.endPoint(), SketchLine_35.result()) +SketchConstraintCoincidence_54 = Sketch_5.setCoincident( + SketchLine_32.endPoint(), SketchLine_35.result() +) SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_61") -SketchConstraintCoincidence_55 = Sketch_5.setCoincident(SketchLine_34.startPoint(), SketchLine_36.result()) +SketchConstraintCoincidence_55 = Sketch_5.setCoincident( + SketchLine_34.startPoint(), SketchLine_36.result() +) 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, 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") -SketchConstraintCoincidence_56 = Sketch_5.setCoincident(SketchArc_6.startPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_56 = Sketch_5.setCoincident( + SketchArc_6.startPoint(), SketchLine_32.startPoint() +) SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_63") -SketchConstraintTangent_11 = Sketch_5.setTangent(SketchArc_6.results()[1], SketchLine_32.result()) +SketchConstraintTangent_11 = Sketch_5.setTangent( + SketchArc_6.results()[1], SketchLine_32.result() +) SketchConstraintTangent_11.setName("SketchConstraintTangent_12") -SketchConstraintCoincidence_57 = Sketch_5.setCoincident(SketchLine_33.endPoint(), SketchArc_6.endPoint()) +SketchConstraintCoincidence_57 = Sketch_5.setCoincident( + SketchLine_33.endPoint(), SketchArc_6.endPoint() +) SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_64") SketchConstraintRadius_6 = Sketch_5.setRadius(SketchArc_6.results()[1], 8) SketchConstraintRadius_6.setName("SketchConstraintRadius_7") -SketchConstraintDistance_14 = Sketch_5.setDistance(SketchLine_33.endPoint(), SketchLine_30.result(), 20) +SketchConstraintDistance_14 = Sketch_5.setDistance( + SketchLine_33.endPoint(), SketchLine_30.result(), 20 +) SketchConstraintDistance_14.setName("SketchConstraintDistance_17") -SketchConstraintCoincidence_59 = Sketch_5.setCoincident(SketchLine_34.endPoint(), SketchLine_37.startPoint()) +SketchConstraintCoincidence_59 = Sketch_5.setCoincident( + SketchLine_34.endPoint(), SketchLine_37.startPoint() +) SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_66") -SketchConstraintDistance_15 = Sketch_5.setDistance(SketchLine_37.startPoint(), SketchLine_30.result(), "DBody") +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/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")]) +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") @@ -325,21 +584,29 @@ SketchLine_42 = Sketch_6.addLine(-20, 60, -20, 30) SketchLine_42.setName("SketchLine_44") SketchLine_42.result().setName("SketchLine_44") SketchLine_42.setAuxiliary(True) -SketchConstraintCoincidence_60 = Sketch_6.setCoincident(SketchLine_42.endPoint(), SketchLine_43.startPoint()) +SketchConstraintCoincidence_60 = Sketch_6.setCoincident( + SketchLine_42.endPoint(), SketchLine_43.startPoint() +) SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_67") SketchLine_44 = Sketch_6.addLine(20, 30.00000000000001, 19.99999999999998, 60) SketchLine_44.setName("SketchLine_42") SketchLine_44.result().setName("SketchLine_42") SketchLine_44.setAuxiliary(True) -SketchConstraintCoincidence_61 = Sketch_6.setCoincident(SketchLine_43.endPoint(), SketchLine_44.startPoint()) +SketchConstraintCoincidence_61 = Sketch_6.setCoincident( + SketchLine_43.endPoint(), SketchLine_44.startPoint() +) SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_68") SketchLine_45 = Sketch_6.addLine(19.99999999999998, 60, -19.99999999999999, 60) SketchLine_45.setName("SketchLine_43") SketchLine_45.result().setName("SketchLine_43") SketchLine_45.setAuxiliary(True) -SketchConstraintCoincidence_62 = Sketch_6.setCoincident(SketchLine_44.endPoint(), SketchLine_45.startPoint()) +SketchConstraintCoincidence_62 = Sketch_6.setCoincident( + SketchLine_44.endPoint(), SketchLine_45.startPoint() +) SketchConstraintCoincidence_62.setName("SketchConstraintCoincidence_69") -SketchConstraintCoincidence_63 = Sketch_6.setCoincident(SketchLine_45.endPoint(), SketchLine_42.startPoint()) +SketchConstraintCoincidence_63 = Sketch_6.setCoincident( + SketchLine_45.endPoint(), SketchLine_42.startPoint() +) SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_70") SketchConstraintHorizontal_12 = Sketch_6.setHorizontal(SketchLine_43.result()) SketchConstraintVertical_10 = Sketch_6.setVertical(SketchLine_44.result()) @@ -349,69 +616,126 @@ SketchLine_46 = Sketch_6.addLine(19.99999999999998, 60, -20, 60) SketchLine_46.setName("SketchLine_45") SketchLine_46.result().setName("SketchLine_45") SketchLine_46.setAuxiliary(True) -SketchConstraintCoincidence_64 = Sketch_6.setCoincident(SketchLine_45.startPoint(), SketchLine_46.startPoint()) +SketchConstraintCoincidence_64 = Sketch_6.setCoincident( + SketchLine_45.startPoint(), SketchLine_46.startPoint() +) SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_73") SketchLine_47 = Sketch_6.addLine(-20, 60, -19.99999999999998, 30.00000000000001) SketchLine_47.setName("SketchLine_46") SketchLine_47.result().setName("SketchLine_46") SketchLine_47.setAuxiliary(True) -SketchConstraintCoincidence_65 = Sketch_6.setCoincident(SketchLine_42.endPoint(), SketchLine_47.endPoint()) +SketchConstraintCoincidence_65 = Sketch_6.setCoincident( + SketchLine_42.endPoint(), SketchLine_47.endPoint() +) SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_74") -SketchConstraintCoincidence_66 = Sketch_6.setCoincident(SketchLine_46.endPoint(), SketchLine_45.result()) +SketchConstraintCoincidence_66 = Sketch_6.setCoincident( + SketchLine_46.endPoint(), SketchLine_45.result() +) SketchConstraintCoincidence_66.setName("SketchConstraintCoincidence_75") -SketchConstraintCoincidence_67 = Sketch_6.setCoincident(SketchLine_47.startPoint(), SketchLine_42.result()) +SketchConstraintCoincidence_67 = Sketch_6.setCoincident( + SketchLine_47.startPoint(), SketchLine_42.result() +) SketchConstraintCoincidence_67.setName("SketchConstraintCoincidence_76") SketchLine_48 = Sketch_6.addLine(20, 30.00000000000001, 19.99999999999999, 60) SketchLine_48.setName("SketchLine_47") SketchLine_48.result().setName("SketchLine_47") SketchLine_48.setAuxiliary(True) -SketchConstraintCoincidence_68 = Sketch_6.setCoincident(SketchLine_44.startPoint(), SketchLine_48.startPoint()) +SketchConstraintCoincidence_68 = Sketch_6.setCoincident( + SketchLine_44.startPoint(), SketchLine_48.startPoint() +) SketchConstraintCoincidence_68.setName("SketchConstraintCoincidence_79") -SketchConstraintCoincidence_69 = Sketch_6.setCoincident(SketchLine_46.endPoint(), SketchLine_38.endPoint()) +SketchConstraintCoincidence_69 = Sketch_6.setCoincident( + SketchLine_46.endPoint(), SketchLine_38.endPoint() +) SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_80") -SketchConstraintCoincidence_70 = Sketch_6.setCoincident(SketchLine_48.endPoint(), SketchLine_44.result()) +SketchConstraintCoincidence_70 = Sketch_6.setCoincident( + SketchLine_48.endPoint(), SketchLine_44.result() +) SketchConstraintCoincidence_70.setName("SketchConstraintCoincidence_81") -SketchConstraintCoincidence_71 = Sketch_6.setCoincident(SketchLine_38.startPoint(), SketchLine_46.result()) +SketchConstraintCoincidence_71 = Sketch_6.setCoincident( + SketchLine_38.startPoint(), SketchLine_46.result() +) SketchConstraintCoincidence_71.setName("SketchConstraintCoincidence_82") SketchLine_49 = Sketch_6.addLine(-19.99999999999998, 30.00000000000001, 20, 30) SketchLine_49.setName("SketchLine_49") SketchLine_49.result().setName("SketchLine_49") SketchLine_49.setAuxiliary(True) -SketchConstraintCoincidence_72 = Sketch_6.setCoincident(SketchLine_43.startPoint(), SketchLine_49.startPoint()) +SketchConstraintCoincidence_72 = Sketch_6.setCoincident( + SketchLine_43.startPoint(), SketchLine_49.startPoint() +) SketchConstraintCoincidence_72.setName("SketchConstraintCoincidence_85") -SketchConstraintCoincidence_73 = Sketch_6.setCoincident(SketchLine_48.endPoint(), SketchLine_41.endPoint()) +SketchConstraintCoincidence_73 = Sketch_6.setCoincident( + SketchLine_48.endPoint(), SketchLine_41.endPoint() +) SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_86") -SketchConstraintCoincidence_74 = Sketch_6.setCoincident(SketchLine_49.endPoint(), SketchLine_43.result()) +SketchConstraintCoincidence_74 = Sketch_6.setCoincident( + SketchLine_49.endPoint(), SketchLine_43.result() +) SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_87") -SketchConstraintCoincidence_75 = Sketch_6.setCoincident(SketchLine_41.startPoint(), SketchLine_48.result()) +SketchConstraintCoincidence_75 = Sketch_6.setCoincident( + SketchLine_41.startPoint(), SketchLine_48.result() +) SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_88") -SketchConstraintCoincidence_76 = Sketch_6.setCoincident(SketchLine_47.startPoint(), SketchLine_40.startPoint()) +SketchConstraintCoincidence_76 = Sketch_6.setCoincident( + SketchLine_47.startPoint(), SketchLine_40.startPoint() +) SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_91") -SketchConstraintCoincidence_77 = Sketch_6.setCoincident(SketchLine_49.endPoint(), SketchLine_39.endPoint()) +SketchConstraintCoincidence_77 = Sketch_6.setCoincident( + SketchLine_49.endPoint(), SketchLine_39.endPoint() +) SketchConstraintCoincidence_77.setName("SketchConstraintCoincidence_92") -SketchConstraintCoincidence_78 = Sketch_6.setCoincident(SketchLine_40.endPoint(), SketchLine_47.result()) +SketchConstraintCoincidence_78 = Sketch_6.setCoincident( + SketchLine_40.endPoint(), SketchLine_47.result() +) SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_93") -SketchConstraintCoincidence_79 = Sketch_6.setCoincident(SketchLine_39.startPoint(), SketchLine_49.result()) +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/SketchLine_30_StartVertex")) -SketchConstraintDistance_16 = Sketch_6.setDistance(SketchLine_40.result(), SketchPoint_3.coordinates(), 20) +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) +SketchConstraintDistance_17 = Sketch_6.setDistance( + SketchPoint_3.coordinates(), SketchLine_41.result(), 20 +) SketchConstraintDistance_17.setName("SketchConstraintDistance_19") -SketchConstraintDistance_18 = Sketch_6.setDistance(SketchLine_39.result(), SketchPoint_3.coordinates(), 30) +SketchConstraintDistance_18 = Sketch_6.setDistance( + SketchLine_39.result(), SketchPoint_3.coordinates(), 30 +) SketchConstraintDistance_18.setName("SketchConstraintDistance_20") -SketchConstraintDistance_19 = Sketch_6.setDistance(SketchLine_39.result(), SketchLine_38.endPoint(), 30) +SketchConstraintDistance_19 = Sketch_6.setDistance( + SketchLine_39.result(), SketchLine_38.endPoint(), 30 +) SketchConstraintDistance_19.setName("SketchConstraintDistance_21") -SketchConstraintCoincidence_80 = Sketch_6.setCoincident(SketchLine_40.startPoint(), SketchLine_38.endPoint()) +SketchConstraintCoincidence_80 = Sketch_6.setCoincident( + SketchLine_40.startPoint(), SketchLine_38.endPoint() +) SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_152") -SketchConstraintCoincidence_81 = Sketch_6.setCoincident(SketchLine_38.startPoint(), SketchLine_41.endPoint()) +SketchConstraintCoincidence_81 = Sketch_6.setCoincident( + SketchLine_38.startPoint(), SketchLine_41.endPoint() +) SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_153") -SketchConstraintCoincidence_82 = Sketch_6.setCoincident(SketchLine_40.endPoint(), SketchLine_39.startPoint()) +SketchConstraintCoincidence_82 = Sketch_6.setCoincident( + SketchLine_40.endPoint(), SketchLine_39.startPoint() +) SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_154") -SketchConstraintCoincidence_84 = Sketch_6.setCoincident(SketchLine_41.startPoint(), SketchLine_39.endPoint()) +SketchConstraintCoincidence_84 = Sketch_6.setCoincident( + SketchLine_41.startPoint(), SketchLine_39.endPoint() +) SketchConstraintCoincidence_84.setName("SketchConstraintCoincidence_156") model.do() -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection(), 100, 0, [model.selection("SOLID", "RevolutionFuse_3_1")]) +ExtrusionCut_1 = model.addExtrusionCut( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_6")], + model.selection(), + 100, + 0, + [model.selection("SOLID", "RevolutionFuse_3_1")], +) 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") @@ -423,43 +747,74 @@ SketchLine_52 = Sketch_7.addLine(65, 23.09999999999939, 65, 20) SketchLine_52.setName("SketchLine_53") SketchLine_52.result().setName("SketchLine_53") SketchLine_52.setAuxiliary(True) -SketchConstraintCoincidence_85 = Sketch_7.setCoincident(SketchLine_52.startPoint(), SketchLine_51.result()) +SketchConstraintCoincidence_85 = Sketch_7.setCoincident( + SketchLine_52.startPoint(), SketchLine_51.result() +) SketchConstraintCoincidence_85.setName("SketchConstraintCoincidence_95") -SketchLine_53 = Sketch_7.addLine(68.00001763534438, 19.99999999999997, 68.09999999999999, 20) +SketchLine_53 = Sketch_7.addLine( + 68.00001763534438, 19.99999999999997, 68.09999999999999, 20 +) SketchLine_53.setName("SketchLine_62") SketchLine_53.result().setName("SketchLine_62") SketchLine_54 = Sketch_7.addLine(65, 20, 68.09999999999999, 20) SketchLine_54.setName("SketchLine_55") SketchLine_54.result().setName("SketchLine_55") SketchLine_54.setAuxiliary(True) -SketchConstraintCoincidence_86 = Sketch_7.setCoincident(SketchLine_52.endPoint(), SketchLine_54.startPoint()) +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/Modified_Face&Sketch_2/SketchLine_13][RevolutionFuse_3_1/Modified_Face&Sketch_1/SketchLine_7]")) +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()) +SketchConstraintCoincidence_87 = Sketch_7.setCoincident( + SketchLine_54.endPoint(), SketchLine_55.result() +) SketchConstraintCoincidence_87.setName("SketchConstraintCoincidence_97") -SketchLine_56 = Sketch_7.addLine(68.09999999999999, 20, 68.09999999999999, 18.51336352164785) +SketchLine_56 = Sketch_7.addLine( + 68.09999999999999, 20, 68.09999999999999, 18.51336352164785 +) SketchLine_56.setName("SketchLine_57") SketchLine_56.result().setName("SketchLine_57") -SketchConstraintCoincidence_88 = Sketch_7.setCoincident(SketchLine_54.endPoint(), SketchLine_56.startPoint()) +SketchConstraintCoincidence_88 = Sketch_7.setCoincident( + SketchLine_54.endPoint(), SketchLine_56.startPoint() +) SketchConstraintCoincidence_88.setName("SketchConstraintCoincidence_98") -SketchLine_57 = Sketch_7.addLine(68.09999999999999, 18.51336352164785, 63.35445204813018, 18.51336352164785) +SketchLine_57 = Sketch_7.addLine( + 68.09999999999999, 18.51336352164785, 63.35445204813018, 18.51336352164785 +) SketchLine_57.setName("SketchLine_58") SketchLine_57.result().setName("SketchLine_58") -SketchConstraintCoincidence_89 = Sketch_7.setCoincident(SketchLine_56.endPoint(), SketchLine_57.startPoint()) +SketchConstraintCoincidence_89 = Sketch_7.setCoincident( + SketchLine_56.endPoint(), SketchLine_57.startPoint() +) SketchConstraintCoincidence_89.setName("SketchConstraintCoincidence_99") -SketchLine_58 = Sketch_7.addLine(63.35445204813018, 18.51336352164785, 63.35445204813018, 23.09999999999939) +SketchLine_58 = Sketch_7.addLine( + 63.35445204813018, 18.51336352164785, 63.35445204813018, 23.09999999999939 +) SketchLine_58.setName("SketchLine_59") SketchLine_58.result().setName("SketchLine_59") -SketchConstraintCoincidence_90 = Sketch_7.setCoincident(SketchLine_57.endPoint(), SketchLine_58.startPoint()) +SketchConstraintCoincidence_90 = Sketch_7.setCoincident( + SketchLine_57.endPoint(), SketchLine_58.startPoint() +) SketchConstraintCoincidence_90.setName("SketchConstraintCoincidence_100") -SketchLine_59 = Sketch_7.addLine(63.35445204813018, 23.09999999999939, 65, 23.09999999999939) +SketchLine_59 = Sketch_7.addLine( + 63.35445204813018, 23.09999999999939, 65, 23.09999999999939 +) SketchLine_59.setName("SketchLine_60") SketchLine_59.result().setName("SketchLine_60") -SketchConstraintCoincidence_91 = Sketch_7.setCoincident(SketchLine_58.endPoint(), SketchLine_59.startPoint()) +SketchConstraintCoincidence_91 = Sketch_7.setCoincident( + SketchLine_58.endPoint(), SketchLine_59.startPoint() +) SketchConstraintCoincidence_91.setName("SketchConstraintCoincidence_101") -SketchConstraintCoincidence_92 = Sketch_7.setCoincident(SketchLine_52.startPoint(), SketchLine_59.endPoint()) +SketchConstraintCoincidence_92 = Sketch_7.setCoincident( + SketchLine_52.startPoint(), SketchLine_59.endPoint() +) SketchConstraintCoincidence_92.setName("SketchConstraintCoincidence_102") SketchConstraintVertical_12 = Sketch_7.setVertical(SketchLine_52.result()) SketchConstraintHorizontal_14 = Sketch_7.setHorizontal(SketchLine_54.result()) @@ -467,50 +822,96 @@ SketchConstraintHorizontal_15 = Sketch_7.setHorizontal(SketchLine_57.result()) SketchConstraintHorizontal_16 = Sketch_7.setHorizontal(SketchLine_59.result()) SketchConstraintVertical_13 = Sketch_7.setVertical(SketchLine_56.result()) SketchConstraintVertical_14 = Sketch_7.setVertical(SketchLine_58.result()) -SketchArc_7 = Sketch_7.addArc(68, 22.99999999999999, 65, 23.00000523211526, 68.00001763534438, 19.99999999999997, False) +SketchArc_7 = Sketch_7.addArc( + 68, + 22.99999999999999, + 65, + 23.00000523211526, + 68.00001763534438, + 19.99999999999997, + False, +) SketchArc_7.setName("SketchArc_12") SketchArc_7.result().setName("SketchArc_12") SketchArc_7.results()[1].setName("SketchArc_12_2") -SketchConstraintCoincidence_93 = Sketch_7.setCoincident(SketchArc_7.startPoint(), SketchLine_50.endPoint()) +SketchConstraintCoincidence_93 = Sketch_7.setCoincident( + SketchArc_7.startPoint(), SketchLine_50.endPoint() +) SketchConstraintCoincidence_93.setName("SketchConstraintCoincidence_103") -SketchConstraintCoincidence_94 = Sketch_7.setCoincident(SketchArc_7.endPoint(), SketchLine_53.startPoint()) +SketchConstraintCoincidence_94 = Sketch_7.setCoincident( + SketchArc_7.endPoint(), SketchLine_53.startPoint() +) SketchConstraintCoincidence_94.setName("SketchConstraintCoincidence_104") -SketchConstraintTangent_12 = Sketch_7.setTangent(SketchArc_7.results()[1], SketchLine_50.result()) +SketchConstraintTangent_12 = Sketch_7.setTangent( + SketchArc_7.results()[1], SketchLine_50.result() +) SketchConstraintTangent_12.setName("SketchConstraintTangent_21") -SketchConstraintTangent_13 = Sketch_7.setTangent(SketchArc_7.results()[1], SketchLine_53.result()) +SketchConstraintTangent_13 = Sketch_7.setTangent( + SketchArc_7.results()[1], SketchLine_53.result() +) SketchConstraintTangent_13.setName("SketchConstraintTangent_22") -SketchConstraintCoincidence_95 = Sketch_7.setCoincident(SketchLine_52.startPoint(), SketchLine_50.startPoint()) +SketchConstraintCoincidence_95 = Sketch_7.setCoincident( + SketchLine_52.startPoint(), SketchLine_50.startPoint() +) SketchConstraintCoincidence_95.setName("SketchConstraintCoincidence_105") -SketchConstraintCoincidence_96 = Sketch_7.setCoincident(SketchLine_54.endPoint(), SketchLine_53.endPoint()) +SketchConstraintCoincidence_96 = Sketch_7.setCoincident( + SketchLine_54.endPoint(), SketchLine_53.endPoint() +) SketchConstraintCoincidence_96.setName("SketchConstraintCoincidence_106") -SketchConstraintCoincidence_97 = Sketch_7.setCoincident(SketchLine_50.endPoint(), SketchLine_52.result()) +SketchConstraintCoincidence_97 = Sketch_7.setCoincident( + SketchLine_50.endPoint(), SketchLine_52.result() +) SketchConstraintCoincidence_97.setName("SketchConstraintCoincidence_107") -SketchConstraintCoincidence_98 = Sketch_7.setCoincident(SketchLine_53.startPoint(), SketchLine_54.result()) +SketchConstraintCoincidence_98 = Sketch_7.setCoincident( + SketchLine_53.startPoint(), SketchLine_54.result() +) SketchConstraintCoincidence_98.setName("SketchConstraintCoincidence_108") SketchConstraintRadius_7 = Sketch_7.setRadius(SketchArc_7.results()[1], 3) SketchConstraintRadius_7.setName("SketchConstraintRadius_12") -SketchConstraintDistance_20 = Sketch_7.setDistance(SketchLine_53.endPoint(), SketchLine_50.result(), 3.1) +SketchConstraintDistance_20 = Sketch_7.setDistance( + SketchLine_53.endPoint(), SketchLine_50.result(), 3.1 +) SketchConstraintDistance_20.setName("SketchConstraintDistance_22") -SketchConstraintDistance_21 = Sketch_7.setDistance(SketchLine_50.startPoint(), SketchLine_53.result(), 3.1) +SketchConstraintDistance_21 = Sketch_7.setDistance( + SketchLine_50.startPoint(), SketchLine_53.result(), 3.1 +) SketchConstraintDistance_21.setName("SketchConstraintDistance_23") 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")]) +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/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 = Sketch_8.setCoincident( + SketchCircle_1.center(), SketchLine_60.result() +) SketchConstraintCoincidence_99.setName("SketchConstraintCoincidence_109") 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) +SketchConstraintDistance_22 = Sketch_8.setDistance( + SketchCircle_1.center(), SketchLine_61.result(), 45 +) 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_2r")], 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") @@ -518,9 +919,13 @@ SketchLine_62.result().setName("SketchLine_65") SketchLine_63 = Sketch_9.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_63.setName("SketchLine_66") SketchLine_63.result().setName("SketchLine_66") -SketchConstraintCoincidence_100 = Sketch_9.setCoincident(SketchLine_62.startPoint(), SketchLine_63.result()) +SketchConstraintCoincidence_100 = Sketch_9.setCoincident( + SketchLine_62.startPoint(), SketchLine_63.result() +) SketchConstraintCoincidence_100.setName("SketchConstraintCoincidence_110") -SketchConstraintCoincidence_101 = Sketch_9.setCoincident(SketchLine_62.endPoint(), SketchLine_63.result()) +SketchConstraintCoincidence_101 = Sketch_9.setCoincident( + SketchLine_62.endPoint(), SketchLine_63.result() +) SketchConstraintCoincidence_101.setName("SketchConstraintCoincidence_111") SketchLine_64 = Sketch_9.addLine(50, 8, 50, 63.99999981522573) SketchLine_64.setName("SketchLine_91") @@ -528,7 +933,9 @@ SketchLine_64.result().setName("SketchLine_91") SketchLine_65 = Sketch_9.addLine(0, -2, 58, -2) SketchLine_65.setName("SketchLine_67") SketchLine_65.result().setName("SketchLine_67") -SketchConstraintCoincidence_102 = Sketch_9.setCoincident(SketchLine_62.endPoint(), SketchLine_65.startPoint()) +SketchConstraintCoincidence_102 = Sketch_9.setCoincident( + SketchLine_62.endPoint(), SketchLine_65.startPoint() +) SketchConstraintCoincidence_102.setName("SketchConstraintCoincidence_112") SketchLine_66 = Sketch_9.addLine(44.0000002728486, 70, 15, 70) SketchLine_66.setName("SketchLine_92") @@ -540,7 +947,9 @@ SketchLine_68 = Sketch_9.addLine(58, -2, 58, 8) SketchLine_68.setName("SketchLine_68") SketchLine_68.result().setName("SketchLine_68") SketchLine_68.setAuxiliary(True) -SketchConstraintCoincidence_103 = Sketch_9.setCoincident(SketchLine_65.endPoint(), SketchLine_68.startPoint()) +SketchConstraintCoincidence_103 = Sketch_9.setCoincident( + SketchLine_65.endPoint(), SketchLine_68.startPoint() +) SketchConstraintCoincidence_103.setName("SketchConstraintCoincidence_113") SketchLine_69 = Sketch_9.addLine(53.99999482393354, 8, 50, 8) SketchLine_69.setName("SketchLine_94") @@ -549,38 +958,54 @@ SketchLine_70 = Sketch_9.addLine(58, 8, 50, 8) SketchLine_70.setName("SketchLine_69") SketchLine_70.result().setName("SketchLine_69") SketchLine_70.setAuxiliary(True) -SketchConstraintCoincidence_104 = Sketch_9.setCoincident(SketchLine_68.endPoint(), SketchLine_70.startPoint()) +SketchConstraintCoincidence_104 = Sketch_9.setCoincident( + SketchLine_68.endPoint(), SketchLine_70.startPoint() +) SketchConstraintCoincidence_104.setName("SketchConstraintCoincidence_114") SketchLine_71 = Sketch_9.addLine(50, 8, 49.99999999999999, 70) SketchLine_71.setName("SketchLine_70") SketchLine_71.result().setName("SketchLine_70") SketchLine_71.setAuxiliary(True) -SketchConstraintCoincidence_105 = Sketch_9.setCoincident(SketchLine_70.endPoint(), SketchLine_71.startPoint()) +SketchConstraintCoincidence_105 = Sketch_9.setCoincident( + SketchLine_70.endPoint(), SketchLine_71.startPoint() +) SketchConstraintCoincidence_105.setName("SketchConstraintCoincidence_115") SketchLine_72 = Sketch_9.addLine(49.99999999999999, 70, 15, 70) SketchLine_72.setName("SketchLine_71") SketchLine_72.result().setName("SketchLine_71") SketchLine_72.setAuxiliary(True) -SketchConstraintCoincidence_106 = Sketch_9.setCoincident(SketchLine_71.endPoint(), SketchLine_72.startPoint()) +SketchConstraintCoincidence_106 = Sketch_9.setCoincident( + SketchLine_71.endPoint(), SketchLine_72.startPoint() +) SketchConstraintCoincidence_106.setName("SketchConstraintCoincidence_116") SketchLine_73 = Sketch_9.addLine(15, 70, 15, 84) SketchLine_73.setName("SketchLine_72") SketchLine_73.result().setName("SketchLine_72") -SketchConstraintCoincidence_107 = Sketch_9.setCoincident(SketchLine_72.endPoint(), SketchLine_73.startPoint()) +SketchConstraintCoincidence_107 = Sketch_9.setCoincident( + SketchLine_72.endPoint(), SketchLine_73.startPoint() +) SketchConstraintCoincidence_107.setName("SketchConstraintCoincidence_117") SketchLine_74 = Sketch_9.addLine(15, 84, 0, 84) SketchLine_74.setName("SketchLine_73") SketchLine_74.result().setName("SketchLine_73") -SketchConstraintCoincidence_108 = Sketch_9.setCoincident(SketchLine_73.endPoint(), SketchLine_74.startPoint()) +SketchConstraintCoincidence_108 = Sketch_9.setCoincident( + SketchLine_73.endPoint(), SketchLine_74.startPoint() +) SketchConstraintCoincidence_108.setName("SketchConstraintCoincidence_118") -SketchConstraintCoincidence_109 = Sketch_9.setCoincident(SketchLine_62.startPoint(), SketchLine_74.endPoint()) +SketchConstraintCoincidence_109 = Sketch_9.setCoincident( + SketchLine_62.startPoint(), SketchLine_74.endPoint() +) SketchConstraintCoincidence_109.setName("SketchConstraintCoincidence_119") SketchLine_75 = Sketch_9.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_75.setName("SketchLine_74") SketchLine_75.result().setName("SketchLine_74") -SketchConstraintDistance_23 = Sketch_9.setDistance(SketchLine_65.endPoint(), SketchLine_75.result(), 2) +SketchConstraintDistance_23 = Sketch_9.setDistance( + SketchLine_65.endPoint(), SketchLine_75.result(), 2 +) SketchConstraintDistance_23.setName("SketchConstraintDistance_25") -SketchConstraintDistance_24 = Sketch_9.setDistance(SketchLine_65.endPoint(), SketchLine_63.result(), 58) +SketchConstraintDistance_24 = Sketch_9.setDistance( + SketchLine_65.endPoint(), SketchLine_63.result(), 58 +) SketchConstraintDistance_24.setName("SketchConstraintDistance_26") SketchConstraintHorizontal_17 = Sketch_9.setHorizontal(SketchLine_65.result()) SketchConstraintVertical_15 = Sketch_9.setVertical(SketchLine_71.result()) @@ -589,58 +1014,110 @@ SketchConstraintVertical_17 = Sketch_9.setVertical(SketchLine_68.result()) SketchConstraintHorizontal_18 = Sketch_9.setHorizontal(SketchLine_74.result()) SketchConstraintHorizontal_19 = Sketch_9.setHorizontal(SketchLine_72.result()) SketchConstraintHorizontal_20 = Sketch_9.setHorizontal(SketchLine_70.result()) -SketchConstraintDistance_25 = Sketch_9.setDistance(SketchLine_70.endPoint(), SketchLine_62.result(), 50) +SketchConstraintDistance_25 = Sketch_9.setDistance( + SketchLine_70.endPoint(), SketchLine_62.result(), 50 +) SketchConstraintDistance_25.setName("SketchConstraintDistance_27") -SketchConstraintDistance_26 = Sketch_9.setDistance(SketchLine_71.endPoint(), SketchLine_75.result(), 70) +SketchConstraintDistance_26 = Sketch_9.setDistance( + SketchLine_71.endPoint(), SketchLine_75.result(), 70 +) SketchConstraintDistance_26.setName("SketchConstraintDistance_28") -SketchConstraintDistance_27 = Sketch_9.setDistance(SketchLine_72.endPoint(), SketchLine_63.result(), 15) +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/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) +SketchConstraintDistance_28 = Sketch_9.setDistance( + SketchLine_62.startPoint(), SketchLine_76.result(), 2 +) SketchConstraintDistance_28.setName("SketchConstraintDistance_30") -SketchConstraintDistance_29 = Sketch_9.setDistance(SketchLine_71.startPoint(), SketchLine_75.result(), 8) +SketchConstraintDistance_29 = Sketch_9.setDistance( + SketchLine_71.startPoint(), SketchLine_75.result(), 8 +) SketchConstraintDistance_29.setName("SketchConstraintDistance_31") -SketchArc_8 = Sketch_9.addArc(44.00000000000001, 64.00000000000001, 50, 63.99999981522573, 44.0000002728486, 70, False) +SketchArc_8 = Sketch_9.addArc( + 44.00000000000001, + 64.00000000000001, + 50, + 63.99999981522573, + 44.0000002728486, + 70, + False, +) SketchArc_8.setName("SketchArc_22") SketchArc_8.result().setName("SketchArc_22") SketchArc_8.results()[1].setName("SketchArc_22_2") -SketchConstraintCoincidence_110 = Sketch_9.setCoincident(SketchArc_8.startPoint(), SketchLine_64.endPoint()) +SketchConstraintCoincidence_110 = Sketch_9.setCoincident( + SketchArc_8.startPoint(), SketchLine_64.endPoint() +) SketchConstraintCoincidence_110.setName("SketchConstraintCoincidence_140") -SketchConstraintCoincidence_111 = Sketch_9.setCoincident(SketchArc_8.endPoint(), SketchLine_66.startPoint()) +SketchConstraintCoincidence_111 = Sketch_9.setCoincident( + SketchArc_8.endPoint(), SketchLine_66.startPoint() +) SketchConstraintCoincidence_111.setName("SketchConstraintCoincidence_141") -SketchConstraintTangent_14 = Sketch_9.setTangent(SketchArc_8.results()[1], SketchLine_64.result()) +SketchConstraintTangent_14 = Sketch_9.setTangent( + SketchArc_8.results()[1], SketchLine_64.result() +) SketchConstraintTangent_14.setName("SketchConstraintTangent_26") -SketchConstraintTangent_15 = Sketch_9.setTangent(SketchArc_8.results()[1], SketchLine_66.result()) +SketchConstraintTangent_15 = Sketch_9.setTangent( + SketchArc_8.results()[1], SketchLine_66.result() +) SketchConstraintTangent_15.setName("SketchConstraintTangent_27") -SketchConstraintCoincidence_112 = Sketch_9.setCoincident(SketchLine_71.startPoint(), SketchLine_64.startPoint()) +SketchConstraintCoincidence_112 = Sketch_9.setCoincident( + SketchLine_71.startPoint(), SketchLine_64.startPoint() +) SketchConstraintCoincidence_112.setName("SketchConstraintCoincidence_142") -SketchConstraintCoincidence_113 = Sketch_9.setCoincident(SketchLine_72.endPoint(), SketchLine_66.endPoint()) +SketchConstraintCoincidence_113 = Sketch_9.setCoincident( + SketchLine_72.endPoint(), SketchLine_66.endPoint() +) SketchConstraintCoincidence_113.setName("SketchConstraintCoincidence_143") -SketchConstraintCoincidence_114 = Sketch_9.setCoincident(SketchLine_64.endPoint(), SketchLine_71.result()) +SketchConstraintCoincidence_114 = Sketch_9.setCoincident( + SketchLine_64.endPoint(), SketchLine_71.result() +) SketchConstraintCoincidence_114.setName("SketchConstraintCoincidence_144") -SketchConstraintCoincidence_115 = Sketch_9.setCoincident(SketchLine_66.startPoint(), SketchLine_72.result()) +SketchConstraintCoincidence_115 = Sketch_9.setCoincident( + SketchLine_66.startPoint(), SketchLine_72.result() +) SketchConstraintCoincidence_115.setName("SketchConstraintCoincidence_145") -SketchArc_9 = Sketch_9.addArc(54, 4, 58.00000000000001, 3.999997221073, 53.99999482393354, 8, False) +SketchArc_9 = Sketch_9.addArc( + 54, 4, 58.00000000000001, 3.999997221073, 53.99999482393354, 8, False +) SketchArc_9.setName("SketchArc_23") SketchArc_9.result().setName("SketchArc_23") SketchArc_9.results()[1].setName("SketchArc_23_2") -SketchConstraintCoincidence_116 = Sketch_9.setCoincident(SketchArc_9.startPoint(), SketchLine_67.endPoint()) +SketchConstraintCoincidence_116 = Sketch_9.setCoincident( + SketchArc_9.startPoint(), SketchLine_67.endPoint() +) SketchConstraintCoincidence_116.setName("SketchConstraintCoincidence_146") -SketchConstraintCoincidence_117 = Sketch_9.setCoincident(SketchArc_9.endPoint(), SketchLine_69.startPoint()) +SketchConstraintCoincidence_117 = Sketch_9.setCoincident( + SketchArc_9.endPoint(), SketchLine_69.startPoint() +) SketchConstraintCoincidence_117.setName("SketchConstraintCoincidence_147") -SketchConstraintTangent_16 = Sketch_9.setTangent(SketchArc_9.results()[1], SketchLine_67.result()) +SketchConstraintTangent_16 = Sketch_9.setTangent( + SketchArc_9.results()[1], SketchLine_67.result() +) SketchConstraintTangent_16.setName("SketchConstraintTangent_28") -SketchConstraintTangent_17 = Sketch_9.setTangent(SketchArc_9.results()[1], SketchLine_69.result()) +SketchConstraintTangent_17 = Sketch_9.setTangent( + SketchArc_9.results()[1], SketchLine_69.result() +) SketchConstraintTangent_17.setName("SketchConstraintTangent_29") -SketchConstraintCoincidence_118 = Sketch_9.setCoincident(SketchLine_68.startPoint(), SketchLine_67.startPoint()) +SketchConstraintCoincidence_118 = Sketch_9.setCoincident( + SketchLine_68.startPoint(), SketchLine_67.startPoint() +) SketchConstraintCoincidence_118.setName("SketchConstraintCoincidence_148") -SketchConstraintCoincidence_119 = Sketch_9.setCoincident(SketchLine_70.endPoint(), SketchLine_69.endPoint()) +SketchConstraintCoincidence_119 = Sketch_9.setCoincident( + SketchLine_70.endPoint(), SketchLine_69.endPoint() +) SketchConstraintCoincidence_119.setName("SketchConstraintCoincidence_149") -SketchConstraintCoincidence_120 = Sketch_9.setCoincident(SketchLine_67.endPoint(), SketchLine_68.result()) +SketchConstraintCoincidence_120 = Sketch_9.setCoincident( + SketchLine_67.endPoint(), SketchLine_68.result() +) SketchConstraintCoincidence_120.setName("SketchConstraintCoincidence_150") -SketchConstraintCoincidence_121 = Sketch_9.setCoincident(SketchLine_69.startPoint(), SketchLine_70.result()) +SketchConstraintCoincidence_121 = Sketch_9.setCoincident( + SketchLine_69.startPoint(), SketchLine_70.result() +) SketchConstraintCoincidence_121.setName("SketchConstraintCoincidence_151") SketchConstraintRadius_9 = Sketch_9.setRadius(SketchArc_8.results()[1], 6) SketchConstraintRadius_9.setName("SketchConstraintRadius_16") @@ -651,83 +1128,206 @@ 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_2_1/Modified_Face&Sketch_1/SketchLine_8)(ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)2(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchArc_1_2)2(RevolutionFuse_2_1/Generated_Face&Sketch_4/SketchLine_27)2(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_2_1/From_Face)2_ExtrusionCut_2_1][RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8][(RevolutionFuse_2_1/Generated_Face&Sketch_4/SketchLine_27)(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_2_1/From_Face)(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_3_1/Modified_Face&Sketch_4/SketchArc_4_2)2(ExtrusionCut_2_1/Modified_Face&Sketch_5/SketchLine_40)2][RevolutionFuse_2_1/Generated_Face&Sketch_4/SketchLine_27]")) -SketchConstraintCoincidence_122 = Sketch_10.setCoincident(SketchLine_77.startPoint(), SketchPoint_4.result()) +SketchPoint_4 = Sketch_10.addPoint( + model.selection( + "VERTEX", + "[(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)(ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)2(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchArc_1_2)2(RevolutionFuse_2_1/Generated_Face&Sketch_4/SketchLine_27)2(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_2_1/From_Face)2_ExtrusionCut_2_1][RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8][(RevolutionFuse_2_1/Generated_Face&Sketch_4/SketchLine_27)(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_2_1/From_Face)(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_3_1/Modified_Face&Sketch_4/SketchArc_4_2)2(ExtrusionCut_2_1/Modified_Face&Sketch_5/SketchLine_40)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/SketchLine_1_StartVertex")) -SketchConstraintCoincidence_123 = Sketch_10.setCoincident(SketchLine_77.endPoint(), SketchPoint_5.result()) +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_1_1/Modified_Face&Sketch_2/SketchLine_14)(ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchArc_2_2)2(RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20)2(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_1_1/To_Face)2_ExtrusionCut_2_1][RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14][(RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20)(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_1_1/To_Face)(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)2(RevolutionFuse_3_1/Modified_Face&Sketch_3/SketchArc_3_2)2(ExtrusionCut_2_1/Modified_Face&Sketch_5/SketchLine_40)2][RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20]")) -SketchConstraintCoincidence_124 = Sketch_10.setCoincident(SketchLine_78.startPoint(), SketchPoint_6.result()) +SketchPoint_6 = Sketch_10.addPoint( + model.selection( + "VERTEX", + "[(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)(ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchArc_2_2)2(RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20)2(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_1_1/To_Face)2_ExtrusionCut_2_1][RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14][(RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20)(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_1_1/To_Face)(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)2(RevolutionFuse_3_1/Modified_Face&Sketch_3/SketchArc_3_2)2(ExtrusionCut_2_1/Modified_Face&Sketch_5/SketchLine_40)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/Modified_Face&Sketch_1/SketchLine_8)(ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchArc_1_2)2(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)2(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2_ExtrusionCut_2_1][ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8][(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)(ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchArc_2_2)2(RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20)2(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_1_1/To_Face)2_ExtrusionCut_2_1][RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14]")) -SketchConstraintCoincidence_125 = Sketch_10.setCoincident(SketchLine_78.endPoint(), SketchPoint_7.result()) +SketchPoint_7 = Sketch_10.addPoint( + model.selection( + "VERTEX", + "[(ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)(ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchArc_1_2)2(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)2(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2_ExtrusionCut_2_1][ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8][(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)(ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchArc_2_2)2(RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20)2(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_1_1/To_Face)2_ExtrusionCut_2_1][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, 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") -SketchConstraintCoincidence_126 = Sketch_10.setCoincident(SketchArc_10.startPoint(), SketchLine_78.endPoint()) +SketchConstraintCoincidence_126 = Sketch_10.setCoincident( + SketchArc_10.startPoint(), SketchLine_78.endPoint() +) SketchConstraintCoincidence_126.setName("SketchConstraintCoincidence_124") -SketchConstraintTangent_18 = Sketch_10.setTangent(SketchArc_10.results()[1], SketchLine_78.result()) +SketchConstraintTangent_18 = Sketch_10.setTangent( + SketchArc_10.results()[1], SketchLine_78.result() +) SketchConstraintTangent_18.setName("SketchConstraintTangent_23") -SketchConstraintCoincidence_127 = Sketch_10.setCoincident(SketchLine_77.endPoint(), SketchArc_10.endPoint()) +SketchConstraintCoincidence_127 = Sketch_10.setCoincident( + SketchLine_77.endPoint(), SketchArc_10.endPoint() +) SketchConstraintCoincidence_127.setName("SketchConstraintCoincidence_125") -SketchConstraintCoincidence_128 = Sketch_10.setCoincident(SketchPoint_5.coordinates(), SketchArc_10.endPoint()) +SketchConstraintCoincidence_128 = Sketch_10.setCoincident( + SketchPoint_5.coordinates(), SketchArc_10.endPoint() +) SketchConstraintCoincidence_128.setName("SketchConstraintCoincidence_126") -SketchArc_11 = Sketch_10.addArc(63.9999997725999, -23.01134810362887, 64, -20, 61.15622559702544, -22.02080994708719, False) +SketchArc_11 = Sketch_10.addArc( + 63.9999997725999, + -23.01134810362887, + 64, + -20, + 61.15622559702544, + -22.02080994708719, + False, +) SketchArc_11.setName("SketchArc_14") SketchArc_11.result().setName("SketchArc_14") SketchArc_11.results()[1].setName("SketchArc_14_2") -SketchConstraintCoincidence_129 = Sketch_10.setCoincident(SketchArc_11.startPoint(), SketchLine_78.startPoint()) +SketchConstraintCoincidence_129 = Sketch_10.setCoincident( + SketchArc_11.startPoint(), SketchLine_78.startPoint() +) SketchConstraintCoincidence_129.setName("SketchConstraintCoincidence_127") -SketchConstraintTangent_19 = Sketch_10.setTangent(SketchArc_11.results()[1], SketchLine_78.result()) +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_1_1/Generated_Face&Sketch_3/SketchLine_20)(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_1_1/To_Face)(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)2(RevolutionFuse_3_1/Modified_Face&Sketch_3/SketchArc_3_2)2(ExtrusionCut_2_1/Modified_Face&Sketch_5/SketchLine_40)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()) +SketchPoint_8 = Sketch_10.addPoint( + model.selection( + "VERTEX", + "[(RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20)(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_1_1/To_Face)(RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14)2(RevolutionFuse_3_1/Modified_Face&Sketch_3/SketchArc_3_2)2(ExtrusionCut_2_1/Modified_Face&Sketch_5/SketchLine_40)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) +SketchArc_12 = Sketch_10.addArc( + 64.00001789135865, + 23.01137360115889, + 64, + 20, + 61.15622559702543, + 22.02080994708722, + True, +) SketchArc_12.setName("SketchArc_15") SketchArc_12.result().setName("SketchArc_15") SketchArc_12.results()[1].setName("SketchArc_15_2") -SketchConstraintCoincidence_131 = Sketch_10.setCoincident(SketchArc_12.startPoint(), SketchLine_77.startPoint()) +SketchConstraintCoincidence_131 = Sketch_10.setCoincident( + SketchArc_12.startPoint(), SketchLine_77.startPoint() +) SketchConstraintCoincidence_131.setName("SketchConstraintCoincidence_129") -SketchConstraintTangent_20 = Sketch_10.setTangent(SketchArc_12.results()[1], SketchLine_77.result()) +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_2_1/Generated_Face&Sketch_4/SketchLine_27)(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_2_1/From_Face)(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_3_1/Modified_Face&Sketch_4/SketchArc_4_2)2(ExtrusionCut_2_1/Modified_Face&Sketch_5/SketchLine_40)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()) +SketchPoint_9 = Sketch_10.addPoint( + model.selection( + "VERTEX", + "[(RevolutionFuse_2_1/Generated_Face&Sketch_4/SketchLine_27)(RevolutionFuse_3_1/Modified_Face&RevolutionFuse_2_1/From_Face)(RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8)2(RevolutionFuse_3_1/Modified_Face&Sketch_4/SketchArc_4_2)2(ExtrusionCut_2_1/Modified_Face&Sketch_5/SketchLine_40)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) +SketchLine_79 = Sketch_10.addLine( + 61.15622559702543, 22.02080994708722, 59.81204392543111, 22.0208099470871 +) SketchLine_79.setName("SketchLine_78") SketchLine_79.result().setName("SketchLine_78") -SketchConstraintCoincidence_133 = Sketch_10.setCoincident(SketchArc_12.endPoint(), SketchLine_79.startPoint()) +SketchConstraintCoincidence_133 = Sketch_10.setCoincident( + SketchArc_12.endPoint(), SketchLine_79.startPoint() +) SketchConstraintCoincidence_133.setName("SketchConstraintCoincidence_131") -SketchConstraintCoincidence_134 = Sketch_10.setCoincident(SketchPoint_9.coordinates(), SketchLine_79.startPoint()) +SketchConstraintCoincidence_134 = Sketch_10.setCoincident( + SketchPoint_9.coordinates(), SketchLine_79.startPoint() +) SketchConstraintCoincidence_134.setName("SketchConstraintCoincidence_132") -SketchLine_80 = Sketch_10.addLine(59.81204392543111, 22.0208099470871, 59.81204392543111, -22.02080994708712) +SketchLine_80 = Sketch_10.addLine( + 59.81204392543111, 22.0208099470871, 59.81204392543111, -22.02080994708712 +) SketchLine_80.setName("SketchLine_79") SketchLine_80.result().setName("SketchLine_79") -SketchConstraintCoincidence_135 = Sketch_10.setCoincident(SketchLine_79.endPoint(), SketchLine_80.startPoint()) +SketchConstraintCoincidence_135 = Sketch_10.setCoincident( + SketchLine_79.endPoint(), SketchLine_80.startPoint() +) SketchConstraintCoincidence_135.setName("SketchConstraintCoincidence_133") -SketchLine_81 = Sketch_10.addLine(61.15622559702544, -22.02080994708719, 59.81204392543111, -22.02080994708712) +SketchLine_81 = Sketch_10.addLine( + 61.15622559702544, -22.02080994708719, 59.81204392543111, -22.02080994708712 +) SketchLine_81.setName("SketchLine_80") SketchLine_81.result().setName("SketchLine_80") -SketchConstraintCoincidence_136 = Sketch_10.setCoincident(SketchArc_11.endPoint(), SketchLine_81.startPoint()) +SketchConstraintCoincidence_136 = Sketch_10.setCoincident( + SketchArc_11.endPoint(), SketchLine_81.startPoint() +) SketchConstraintCoincidence_136.setName("SketchConstraintCoincidence_134") -SketchConstraintCoincidence_137 = Sketch_10.setCoincident(SketchPoint_8.coordinates(), SketchLine_81.startPoint()) +SketchConstraintCoincidence_137 = Sketch_10.setCoincident( + SketchPoint_8.coordinates(), SketchLine_81.startPoint() +) SketchConstraintCoincidence_137.setName("SketchConstraintCoincidence_135") -SketchConstraintCoincidence_138 = Sketch_10.setCoincident(SketchLine_80.endPoint(), SketchLine_81.endPoint()) +SketchConstraintCoincidence_138 = Sketch_10.setCoincident( + SketchLine_80.endPoint(), SketchLine_81.endPoint() +) 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()) +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/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() +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() SketchArc_18.setName("SketchArc_21") SketchArc_18.result().setName("SketchArc_21") SketchArc_18.results()[1].setName("SketchArc_21_2") @@ -767,30 +1367,93 @@ 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-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")]) +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/SketchLine_9_EndVertex")) -SketchConstraintCoincidence_139 = Sketch_11.setCoincident(SketchCircle_2.center(), SketchPoint_11.result()) +SketchPoint_11 = Sketch_11.addPoint( + model.selection("VERTEX", "Sketch_2/SketchLine_9_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) SketchConstraintRadius_11.setName("SketchConstraintRadius_14") SketchCircle_3 = Sketch_11.addCircle(89, 0, 12) -SketchConstraintCoincidence_140 = Sketch_11.setCoincident(SketchCircle_2.center(), SketchCircle_3.center()) +SketchConstraintCoincidence_140 = Sketch_11.setCoincident( + SketchCircle_2.center(), SketchCircle_3.center() +) SketchConstraintCoincidence_140.setName("SketchConstraintCoincidence_138") -SketchConstraintCoincidence_141 = Sketch_11.setCoincident(SketchPoint_11.coordinates(), SketchCircle_3.center()) +SketchConstraintCoincidence_141 = Sketch_11.setCoincident( + SketchPoint_11.coordinates(), SketchCircle_3.center() +) SketchConstraintCoincidence_141.setName("SketchConstraintCoincidence_139") SketchConstraintRadius_12 = Sketch_11.setRadius(SketchCircle_3.results()[1], 12) SketchConstraintRadius_12.setName("SketchConstraintRadius_15") SketchPoint_12 = Sketch_11.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchMultiRotation_2 = Sketch_11.addRotation([SketchCircle_3.results()[1], SketchCircle_2.results()[1]], SketchPoint_12.coordinates(), 120, 3) -[SketchCircle_4, SketchCircle_5, SketchCircle_6, SketchCircle_7] = SketchMultiRotation_2.rotated() +SketchMultiRotation_2 = Sketch_11.addRotation( + [SketchCircle_3.results()[1], SketchCircle_2.results()[1]], + SketchPoint_12.coordinates(), + 120, + 3, +) +[ + 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_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")]) +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_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) @@ -809,4 +1472,4 @@ model.testNbSubShapes(ExtrusionCut_4, GeomAPI_Shape.EDGE, [406]) model.testNbSubShapes(ExtrusionCut_4, GeomAPI_Shape.VERTEX, [812]) model.testResultsVolumes(ExtrusionCut_4, [502903.236060981987975537776947021]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.models/clothespin.py b/test.models/clothespin.py index 92b8f49df..3abbb89e6 100644 --- a/test.models/clothespin.py +++ b/test.models/clothespin.py @@ -27,52 +27,74 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 60, 0) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(60, 0, 60, 1.5) SketchLine_2.setName("SketchLine_3") SketchLine_2.result().setName("SketchLine_3") -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3") SketchLine_3 = Sketch_1.addLine(60, 1.5, 57, 1.5) SketchLine_3.setName("SketchLine_4") SketchLine_3.result().setName("SketchLine_4") -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_4") SketchLine_4 = Sketch_1.addLine(57, 1.5, 29, 7.5) SketchLine_4.setName("SketchLine_5") SketchLine_4.result().setName("SketchLine_5") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5") SketchLine_5 = Sketch_1.addLine(28, 7.5, 28, 8) SketchLine_5.setName("SketchLine_7") SketchLine_5.result().setName("SketchLine_7") -SketchArc_1 = Sketch_1.addArc(25.00007393928819, 7.9789374678129, 28, 8, 22.00014787857639, 8, False) +SketchArc_1 = Sketch_1.addArc( + 25.00007393928819, 7.9789374678129, 28, 8, 22.00014787857639, 8, False +) SketchLine_6 = Sketch_1.addLine(22.00014787857639, 8, 22.00014787857639, 7.5) SketchLine_6.setName("SketchLine_8") SketchLine_6.result().setName("SketchLine_8") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_6.startPoint() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_8") SketchLine_7 = Sketch_1.addLine(22.00014787857639, 7.5, 21.00014787857639, 7.5) SketchLine_7.setName("SketchLine_9") SketchLine_7.result().setName("SketchLine_9") -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.startPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_9") SketchLine_8 = Sketch_1.addLine(0, 0, 0, 3.5) SketchLine_8.setName("SketchLine_10") SketchLine_8.result().setName("SketchLine_10") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_10") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_8.startPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_11") SketchLine_9 = Sketch_1.addLine(0, 3.5, 8, 5) SketchLine_9.setName("SketchLine_11") SketchLine_9.result().setName("SketchLine_11") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_13") SketchLine_10 = Sketch_1.addLine(8, 5, 10.426976887961, 4.40018070612629) SketchLine_10.setName("SketchLine_12") SketchLine_10.result().setName("SketchLine_12") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_14") SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 60) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) @@ -82,120 +104,231 @@ SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintHorizontal_3.setName("SketchConstraintHorizontal_4") SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchArc_1.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchArc_1.startPoint() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_15") SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_1.result(), 3.5, False) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_9.endPoint(), SketchLine_8.result(), 8, False) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_1.result(), 3.5, False +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_9.endPoint(), SketchLine_8.result(), 8, False +) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_10.result(), 2.5) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 3) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_6.result(), 0.5) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_7.result(), 1) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_5.result(), 0.5) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_1.result(), 7.5, False) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_6.endPoint(), SketchLine_1.result(), 7.5, False +) SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_3.result(), 3) SketchConstraintLength_6.setName("SketchConstraintLength_7") SketchConstraintLength_7 = Sketch_1.setLength(SketchLine_2.result(), 1.5) SketchConstraintLength_7.setName("SketchConstraintLength_8") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_9.endPoint(), SketchLine_1.result(), 5, False) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_5.startPoint(), SketchLine_1.result(), 7.5, False) -SketchLine_11 = Sketch_1.addLine(12.81710695710752, 0, 12.81710695710752, 7.765286531476907) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_9.endPoint(), SketchLine_1.result(), 5, False +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_5.startPoint(), SketchLine_1.result(), 7.5, False +) +SketchLine_11 = Sketch_1.addLine( + 12.81710695710752, 0, 12.81710695710752, 7.765286531476907 +) SketchLine_11.setName("SketchLine_13") SketchLine_11.result().setName("SketchLine_13") SketchLine_11.setAuxiliary(True) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_11.startPoint(), SketchLine_1.result() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_16") SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_11.result()) SketchPoint_2 = Sketch_1.addPoint(12.81710695710752, 3) SketchPoint_2.setAuxiliary(True) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_11.result()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_11.result() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_17") -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_1.result(), 3, False) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchPoint_2.coordinates(), SketchLine_1.result(), 3, False +) SketchLine_12 = Sketch_1.addLine(28, 7.5, 29, 7.5) SketchLine_12.setName("SketchLine_14") SketchLine_12.result().setName("SketchLine_14") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_12.startPoint() +) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_18") -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_12.endPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_12.endPoint() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_19") SketchConstraintLength_8 = Sketch_1.setLength(SketchLine_12.result(), 1) SketchConstraintLength_8.setName("SketchConstraintLength_9") -SketchArc_2 = Sketch_1.addArc(14.78851987160339, 9.105317068618911, 10.426976887961, 4.40018070612629, 21.00014787857639, 7.5, False) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_2.startPoint()) +SketchArc_2 = Sketch_1.addArc( + 14.78851987160339, + 9.105317068618911, + 10.426976887961, + 4.40018070612629, + 21.00014787857639, + 7.5, + False, +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchArc_2.startPoint() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_20") -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchArc_2.endPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchArc_2.endPoint() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_21") -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchArc_2.results()[1]) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchArc_2.results()[1] +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_22") SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_12.result()) SketchConstraintHorizontal_4.setName("SketchConstraintHorizontal_9") -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_5.startPoint(), SketchLine_2.result(), 32, False) +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/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) +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&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]")) +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 = Sketch_2.setCoincident( + SketchArc_3.startPoint(), SketchLine_13.result() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_23") 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 = 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&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]")) +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()) -SketchConstraintDistance_8 = Sketch_2.setDistance(SketchArc_3.startPoint(), SketchLine_15.result(), 6, False) +SketchConstraintTangent_1 = Sketch_2.setTangent( + SketchArc_3.results()[1], SketchLine_15.result() +) +SketchConstraintDistance_8 = Sketch_2.setDistance( + SketchArc_3.startPoint(), SketchLine_15.result(), 6, False +) SketchConstraintDistance_8.setName("SketchConstraintDistance_7") SketchLine_16 = Sketch_2.addLine(54, 12, 53.10174978726379, 13.92603605930655) SketchLine_16.setName("SketchLine_18") SketchLine_16.result().setName("SketchLine_18") -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchArc_3.startPoint(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchArc_3.startPoint(), SketchLine_16.startPoint() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_25") -SketchLine_17 = Sketch_2.addLine(53.10174978726379, 13.92603605930655, 63.82610057919769, 13.82486293862793) +SketchLine_17 = Sketch_2.addLine( + 53.10174978726379, 13.92603605930655, 63.82610057919769, 13.82486293862793 +) SketchLine_17.setName("SketchLine_19") SketchLine_17.result().setName("SketchLine_19") -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_26") -SketchLine_18 = Sketch_2.addLine(63.82610057919769, 13.82486293862793, 62.66260969139353, -3.07104821470189) +SketchLine_18 = Sketch_2.addLine( + 63.82610057919769, 13.82486293862793, 62.66260969139353, -3.07104821470189 +) SketchLine_18.setName("SketchLine_20") SketchLine_18.result().setName("SketchLine_20") -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_27") -SketchLine_19 = Sketch_2.addLine(62.66260969139353, -3.07104821470189, 53.10174978726379, -2.868701973344648) +SketchLine_19 = Sketch_2.addLine( + 62.66260969139353, -3.07104821470189, 53.10174978726379, -2.868701973344648 +) SketchLine_19.setName("SketchLine_21") SketchLine_19.result().setName("SketchLine_21") -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_28") SketchLine_20 = Sketch_2.addLine(53.10174978726379, -2.868701973344648, 54, 0) SketchLine_20.setName("SketchLine_22") SketchLine_20.result().setName("SketchLine_22") -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_29") -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchArc_3.endPoint(), SketchLine_20.endPoint()) +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-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")) +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&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14]")) +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()) +SketchConstraintCoincidence_27 = Sketch_3.setCoincident( + SketchLine_21.startPoint(), SketchLine_22.result() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_31") SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_21.result()) SketchLine_23 = Sketch_3.addLine(28, -6, 63.78468475453244, -6) SketchLine_23.setName("SketchLine_25") SketchLine_23.result().setName("SketchLine_25") SketchLine_23.setAuxiliary(True) -SketchConstraintCoincidence_28 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_23.startPoint()) +SketchConstraintCoincidence_28 = Sketch_3.setCoincident( + SketchLine_21.startPoint(), SketchLine_23.startPoint() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_32") SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_23.result()) SketchLine_24 = Sketch_3.addLine(60, -1.5, 29, -1.5) @@ -210,13 +343,21 @@ SketchLine_26.result().setName("SketchLine_28") SketchLine_27 = Sketch_3.addLine(60, -10.5, 60, -1.5) SketchLine_27.setName("SketchLine_29") SketchLine_27.result().setName("SketchLine_29") -SketchConstraintCoincidence_29 = Sketch_3.setCoincident(SketchLine_27.endPoint(), SketchLine_24.startPoint()) +SketchConstraintCoincidence_29 = Sketch_3.setCoincident( + SketchLine_27.endPoint(), SketchLine_24.startPoint() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_33") -SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint()) +SketchConstraintCoincidence_30 = Sketch_3.setCoincident( + SketchLine_24.endPoint(), SketchLine_25.startPoint() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_34") -SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchLine_25.endPoint(), SketchLine_26.startPoint()) +SketchConstraintCoincidence_31 = Sketch_3.setCoincident( + SketchLine_25.endPoint(), SketchLine_26.startPoint() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_35") -SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchLine_26.endPoint(), SketchLine_27.startPoint()) +SketchConstraintCoincidence_32 = Sketch_3.setCoincident( + SketchLine_26.endPoint(), SketchLine_27.startPoint() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_36") SketchConstraintHorizontal_7 = Sketch_3.setHorizontal(SketchLine_24.result()) SketchConstraintVertical_6 = Sketch_3.setVertical(SketchLine_25.result()) @@ -226,56 +367,96 @@ SketchLine_28 = Sketch_3.addLine(29, -10.5, 60, -1.5) SketchLine_28.setName("SketchLine_30") SketchLine_28.result().setName("SketchLine_30") SketchLine_28.setAuxiliary(True) -SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchLine_25.endPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_33 = Sketch_3.setCoincident( + SketchLine_25.endPoint(), SketchLine_28.startPoint() +) SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_37") -SketchConstraintCoincidence_34 = Sketch_3.setCoincident(SketchLine_26.startPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_34 = Sketch_3.setCoincident( + SketchLine_26.startPoint(), SketchLine_28.startPoint() +) SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_38") -SketchConstraintCoincidence_35 = Sketch_3.setCoincident(SketchLine_24.startPoint(), SketchLine_28.endPoint()) +SketchConstraintCoincidence_35 = Sketch_3.setCoincident( + SketchLine_24.startPoint(), SketchLine_28.endPoint() +) SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_39") -SketchConstraintCoincidence_36 = Sketch_3.setCoincident(SketchLine_27.endPoint(), SketchLine_28.endPoint()) +SketchConstraintCoincidence_36 = Sketch_3.setCoincident( + SketchLine_27.endPoint(), SketchLine_28.endPoint() +) SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_40") SketchLine_29 = Sketch_3.addLine(29, -1.5, 60, -10.5) SketchLine_29.setName("SketchLine_31") SketchLine_29.result().setName("SketchLine_31") SketchLine_29.setAuxiliary(True) -SketchConstraintCoincidence_37 = Sketch_3.setCoincident(SketchLine_24.endPoint(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_37 = Sketch_3.setCoincident( + SketchLine_24.endPoint(), SketchLine_29.startPoint() +) SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_41") -SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchLine_25.startPoint(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_38 = Sketch_3.setCoincident( + SketchLine_25.startPoint(), SketchLine_29.startPoint() +) SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_42") -SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_26.endPoint(), SketchLine_29.endPoint()) +SketchConstraintCoincidence_39 = Sketch_3.setCoincident( + SketchLine_26.endPoint(), SketchLine_29.endPoint() +) SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_43") -SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_27.startPoint(), SketchLine_29.endPoint()) +SketchConstraintCoincidence_40 = Sketch_3.setCoincident( + SketchLine_27.startPoint(), SketchLine_29.endPoint() +) SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_44") SketchPoint_3 = Sketch_3.addPoint(44.5, -6) SketchPoint_3.setAuxiliary(True) -SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_29.result()) +SketchConstraintCoincidence_41 = Sketch_3.setCoincident( + SketchPoint_3.coordinates(), SketchLine_29.result() +) SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_45") -SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchPoint_3.coordinates(), SketchLine_29.result()) -SketchConstraintCoincidence_42 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_23.result()) +SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint( + SketchPoint_3.coordinates(), SketchLine_29.result() +) +SketchConstraintCoincidence_42 = Sketch_3.setCoincident( + SketchPoint_3.coordinates(), SketchLine_23.result() +) SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_46") -SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_22.startPoint(), SketchLine_23.result(), 6, False) +SketchConstraintDistance_9 = Sketch_3.setDistance( + SketchLine_22.startPoint(), SketchLine_23.result(), 6, False +) SketchConstraintDistance_9.setName("SketchConstraintDistance_8") SketchConstraintLength_9 = Sketch_3.setLength(SketchLine_27.result(), 9) SketchConstraintLength_9.setName("SketchConstraintLength_10") -SketchLine_30 = Sketch_3.addLine(21.00014787857639, -1.499999999999981, 12.00014787857639, -1.499999999999981) +SketchLine_30 = Sketch_3.addLine( + 21.00014787857639, -1.499999999999981, 12.00014787857639, -1.499999999999981 +) SketchLine_30.setName("SketchLine_32") SketchLine_30.result().setName("SketchLine_32") -SketchLine_31 = Sketch_3.addLine(12.00014787857639, -1.499999999999981, 12.00014787857639, -10.49999999999998) +SketchLine_31 = Sketch_3.addLine( + 12.00014787857639, -1.499999999999981, 12.00014787857639, -10.49999999999998 +) SketchLine_31.setName("SketchLine_33") SketchLine_31.result().setName("SketchLine_33") -SketchLine_32 = Sketch_3.addLine(12.00014787857639, -10.49999999999998, 21.00014787857639, -10.49999999999998) +SketchLine_32 = Sketch_3.addLine( + 12.00014787857639, -10.49999999999998, 21.00014787857639, -10.49999999999998 +) SketchLine_32.setName("SketchLine_34") SketchLine_32.result().setName("SketchLine_34") -SketchLine_33 = Sketch_3.addLine(21.00014787857639, -10.49999999999998, 21.00014787857639, -1.499999999999981) +SketchLine_33 = Sketch_3.addLine( + 21.00014787857639, -10.49999999999998, 21.00014787857639, -1.499999999999981 +) SketchLine_33.setName("SketchLine_35") SketchLine_33.result().setName("SketchLine_35") -SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchLine_33.endPoint(), SketchLine_30.startPoint()) +SketchConstraintCoincidence_43 = Sketch_3.setCoincident( + SketchLine_33.endPoint(), SketchLine_30.startPoint() +) SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_47") -SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_44 = Sketch_3.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_48") -SketchConstraintCoincidence_45 = Sketch_3.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_45 = Sketch_3.setCoincident( + SketchLine_31.endPoint(), SketchLine_32.startPoint() +) SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_49") -SketchConstraintCoincidence_46 = Sketch_3.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_46 = Sketch_3.setCoincident( + SketchLine_32.endPoint(), SketchLine_33.startPoint() +) SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_50") SketchConstraintHorizontal_9 = Sketch_3.setHorizontal(SketchLine_30.result()) SketchConstraintHorizontal_9.setName("SketchConstraintHorizontal_10") @@ -283,72 +464,174 @@ SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_31.result()) SketchConstraintHorizontal_10 = Sketch_3.setHorizontal(SketchLine_32.result()) SketchConstraintHorizontal_10.setName("SketchConstraintHorizontal_11") SketchConstraintVertical_9 = Sketch_3.setVertical(SketchLine_33.result()) -SketchConstraintEqual_1 = Sketch_3.setEqual(SketchLine_25.result(), SketchLine_33.result()) -SketchLine_34 = Sketch_3.addLine(12.00014787857639, -10.49999999999998, 21.00014787857639, -1.499999999999981) +SketchConstraintEqual_1 = Sketch_3.setEqual( + SketchLine_25.result(), SketchLine_33.result() +) +SketchLine_34 = Sketch_3.addLine( + 12.00014787857639, -10.49999999999998, 21.00014787857639, -1.499999999999981 +) SketchLine_34.setName("SketchLine_36") SketchLine_34.result().setName("SketchLine_36") SketchLine_34.setAuxiliary(True) -SketchConstraintCoincidence_47 = Sketch_3.setCoincident(SketchLine_31.endPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_47 = Sketch_3.setCoincident( + SketchLine_31.endPoint(), SketchLine_34.startPoint() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_51") -SketchConstraintCoincidence_48 = Sketch_3.setCoincident(SketchLine_32.startPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_48 = Sketch_3.setCoincident( + SketchLine_32.startPoint(), SketchLine_34.startPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_52") -SketchConstraintCoincidence_49 = Sketch_3.setCoincident(SketchLine_30.startPoint(), SketchLine_34.endPoint()) +SketchConstraintCoincidence_49 = Sketch_3.setCoincident( + SketchLine_30.startPoint(), SketchLine_34.endPoint() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_53") -SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchLine_33.endPoint(), SketchLine_34.endPoint()) +SketchConstraintCoincidence_50 = Sketch_3.setCoincident( + SketchLine_33.endPoint(), SketchLine_34.endPoint() +) SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_54") SketchPoint_4 = Sketch_3.addPoint(16.50014787857639, -6) SketchPoint_4.setAuxiliary(True) -SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchPoint_4.coordinates(), SketchLine_34.result()) +SketchConstraintCoincidence_51 = Sketch_3.setCoincident( + SketchPoint_4.coordinates(), SketchLine_34.result() +) 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()) +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&Sketch_1/SketchLine_14][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_5]")) +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 = 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&Sketch_1/SketchArc_2_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9]")) +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 = 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()) +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/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) +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/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_11]")) +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()) +SketchConstraintCoincidence_55 = Sketch_4.setCoincident( + SketchLine_37.startPoint(), SketchLine_38.result() +) SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_59") -SketchLine_39 = Sketch_4.addLine(1.55585595716119, 2.812450190483599, 2.324492722099671, 3.935842385393688) +SketchLine_39 = Sketch_4.addLine( + 1.55585595716119, 2.812450190483599, 2.324492722099671, 3.935842385393688 +) SketchLine_39.setName("SketchLine_41") SketchLine_39.result().setName("SketchLine_41") -SketchConstraintCoincidence_56 = Sketch_4.setCoincident(SketchLine_37.endPoint(), SketchLine_39.startPoint()) +SketchConstraintCoincidence_56 = Sketch_4.setCoincident( + SketchLine_37.endPoint(), SketchLine_39.startPoint() +) SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_60") -SketchConstraintCoincidence_57 = Sketch_4.setCoincident(SketchLine_39.endPoint(), SketchLine_38.result()) +SketchConstraintCoincidence_57 = Sketch_4.setCoincident( + SketchLine_39.endPoint(), SketchLine_38.result() +) SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_61") -SketchLine_40 = Sketch_4.addLine(2.324492722099671, 3.935842385393688, 0.4324637622511017, 3.581086955422081) +SketchLine_40 = Sketch_4.addLine( + 2.324492722099671, 3.935842385393688, 0.4324637622511017, 3.581086955422081 +) SketchLine_40.setName("SketchLine_42") SketchLine_40.result().setName("SketchLine_42") -SketchConstraintCoincidence_58 = Sketch_4.setCoincident(SketchLine_39.endPoint(), SketchLine_40.startPoint()) +SketchConstraintCoincidence_58 = Sketch_4.setCoincident( + SketchLine_39.endPoint(), SketchLine_40.startPoint() +) SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_62") -SketchConstraintCoincidence_59 = Sketch_4.setCoincident(SketchLine_37.startPoint(), SketchLine_40.endPoint()) +SketchConstraintCoincidence_59 = Sketch_4.setCoincident( + SketchLine_37.startPoint(), SketchLine_40.endPoint() +) SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_63") SketchConstraintLength_11 = Sketch_4.setLength(SketchLine_40.result(), 1.925) SketchConstraintLength_11.setName("SketchConstraintLength_12") -SketchConstraintEqual_3 = Sketch_4.setEqual(SketchLine_37.result(), SketchLine_39.result()) -SketchConstraintPerpendicular_1 = Sketch_4.setPerpendicular(SketchLine_37.result(), SketchLine_39.result()) -SketchConstraintDistance_10 = Sketch_4.setDistance(SketchLine_38.startPoint(), SketchLine_37.startPoint(), 0.44, False) -SketchMultiTranslation_1_objects = [SketchLine_37.result(), SketchLine_40.result(), SketchLine_39.result()] -SketchMultiTranslation_1 = Sketch_4.addTranslation(SketchMultiTranslation_1_objects, SketchLine_40.startPoint(), SketchLine_38.endPoint(), 4, True) -[SketchLine_41, SketchLine_42, SketchLine_43, SketchLine_44, SketchLine_45, SketchLine_46, SketchLine_47, SketchLine_48, SketchLine_49] = SketchMultiTranslation_1.translated() +SketchConstraintEqual_3 = Sketch_4.setEqual( + SketchLine_37.result(), SketchLine_39.result() +) +SketchConstraintPerpendicular_1 = Sketch_4.setPerpendicular( + SketchLine_37.result(), SketchLine_39.result() +) +SketchConstraintDistance_10 = Sketch_4.setDistance( + SketchLine_38.startPoint(), SketchLine_37.startPoint(), 0.44, False +) +SketchMultiTranslation_1_objects = [ + SketchLine_37.result(), + SketchLine_40.result(), + SketchLine_39.result(), +] +SketchMultiTranslation_1 = Sketch_4.addTranslation( + SketchMultiTranslation_1_objects, + SketchLine_40.startPoint(), + SketchLine_38.endPoint(), + 4, + True, +) +[ + SketchLine_41, + SketchLine_42, + SketchLine_43, + SketchLine_44, + SketchLine_45, + SketchLine_46, + SketchLine_47, + SketchLine_48, + SketchLine_49, +] = SketchMultiTranslation_1.translated() SketchLine_49.setName("SketchLine_51") SketchLine_49.result().setName("SketchLine_51") SketchLine_48.setName("SketchLine_50") @@ -368,84 +651,196 @@ 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/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]")) +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) SketchConstraintRigid_1 = Sketch_5.setFixed(SketchPoint_5.result()) SketchConstraintRigid_1.setName("SketchConstraintRigid_10") -SketchConstraintCoincidence_60 = Sketch_5.setCoincident(SketchArc_4.startPoint(), SketchPoint_5.result()) +SketchConstraintCoincidence_60 = Sketch_5.setCoincident( + SketchArc_4.startPoint(), SketchPoint_5.result() +) SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_64") SketchPoint_6 = Sketch_5.addPoint(28, -7.5) SketchConstraintRigid_2 = Sketch_5.setFixed(SketchPoint_6.result()) SketchConstraintRigid_2.setName("SketchConstraintRigid_11") -SketchConstraintCoincidence_61 = Sketch_5.setCoincident(SketchArc_4.endPoint(), SketchPoint_6.result()) +SketchConstraintCoincidence_61 = Sketch_5.setCoincident( + SketchArc_4.endPoint(), SketchPoint_6.result() +) SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_65") SketchConstraintRadius_2 = Sketch_5.setRadius(SketchArc_4.results()[1], 3) SketchLine_50 = Sketch_5.addLine(22, -7.5, 22, -11.56094005408083) SketchLine_50.setName("SketchLine_52") SketchLine_50.result().setName("SketchLine_52") -SketchConstraintCoincidence_62 = Sketch_5.setCoincident(SketchArc_4.startPoint(), SketchLine_50.startPoint()) +SketchConstraintCoincidence_62 = Sketch_5.setCoincident( + SketchArc_4.startPoint(), SketchLine_50.startPoint() +) SketchConstraintCoincidence_62.setName("SketchConstraintCoincidence_66") -SketchConstraintCoincidence_63 = Sketch_5.setCoincident(SketchPoint_5.coordinates(), SketchLine_50.startPoint()) +SketchConstraintCoincidence_63 = Sketch_5.setCoincident( + SketchPoint_5.coordinates(), SketchLine_50.startPoint() +) SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_67") SketchLine_51 = Sketch_5.addLine(22, -11.56094005408083, 28, -11.56094005408083) SketchLine_51.setName("SketchLine_53") SketchLine_51.result().setName("SketchLine_53") -SketchConstraintCoincidence_64 = Sketch_5.setCoincident(SketchLine_50.endPoint(), SketchLine_51.startPoint()) +SketchConstraintCoincidence_64 = Sketch_5.setCoincident( + SketchLine_50.endPoint(), SketchLine_51.startPoint() +) SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_68") SketchLine_52 = Sketch_5.addLine(28, -11.56094005408083, 28, -7.5) SketchLine_52.setName("SketchLine_54") SketchLine_52.result().setName("SketchLine_54") -SketchConstraintCoincidence_65 = Sketch_5.setCoincident(SketchLine_51.endPoint(), SketchLine_52.startPoint()) +SketchConstraintCoincidence_65 = Sketch_5.setCoincident( + SketchLine_51.endPoint(), SketchLine_52.startPoint() +) SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_69") -SketchConstraintCoincidence_66 = Sketch_5.setCoincident(SketchArc_4.endPoint(), SketchLine_52.endPoint()) +SketchConstraintCoincidence_66 = Sketch_5.setCoincident( + SketchArc_4.endPoint(), SketchLine_52.endPoint() +) SketchConstraintCoincidence_66.setName("SketchConstraintCoincidence_70") -SketchConstraintCoincidence_67 = Sketch_5.setCoincident(SketchPoint_6.coordinates(), SketchLine_52.endPoint()) +SketchConstraintCoincidence_67 = Sketch_5.setCoincident( + SketchPoint_6.coordinates(), SketchLine_52.endPoint() +) SketchConstraintCoincidence_67.setName("SketchConstraintCoincidence_71") SketchConstraintVertical_10 = Sketch_5.setVertical(SketchLine_50.result()) 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/Modified_Face&Extrusion_1_1/To_Face"), 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_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")) +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") SketchLine_53.result().setName("SketchLine_55") SketchConstraintRigid_3 = Sketch_6.setFixed(SketchLine_53.result()) SketchConstraintRigid_3.setName("SketchConstraintRigid_12") -SketchConstraintCoincidence_68 = Sketch_6.setCoincident(SketchArc_5.center(), SketchLine_53.result()) +SketchConstraintCoincidence_68 = Sketch_6.setCoincident( + SketchArc_5.center(), SketchLine_53.result() +) SketchConstraintCoincidence_68.setName("SketchConstraintCoincidence_72") -SketchConstraintCoincidence_69 = Sketch_6.setCoincident(SketchArc_5.startPoint(), SketchLine_53.result()) +SketchConstraintCoincidence_69 = Sketch_6.setCoincident( + SketchArc_5.startPoint(), SketchLine_53.result() +) SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_73") -SketchConstraintCoincidence_70 = Sketch_6.setCoincident(SketchArc_5.endPoint(), SketchLine_53.result()) +SketchConstraintCoincidence_70 = Sketch_6.setCoincident( + SketchArc_5.endPoint(), SketchLine_53.result() +) SketchConstraintCoincidence_70.setName("SketchConstraintCoincidence_74") SketchLine_54 = Sketch_6.addLine(45.5, 0, 46.5, 0) SketchLine_54.setName("SketchLine_56") SketchLine_54.result().setName("SketchLine_56") -SketchConstraintCoincidence_71 = Sketch_6.setCoincident(SketchArc_5.startPoint(), SketchLine_54.startPoint()) +SketchConstraintCoincidence_71 = Sketch_6.setCoincident( + SketchArc_5.startPoint(), SketchLine_54.startPoint() +) SketchConstraintCoincidence_71.setName("SketchConstraintCoincidence_75") -SketchConstraintCoincidence_72 = Sketch_6.setCoincident(SketchArc_5.endPoint(), SketchLine_54.endPoint()) +SketchConstraintCoincidence_72 = Sketch_6.setCoincident( + SketchArc_5.endPoint(), SketchLine_54.endPoint() +) SketchConstraintCoincidence_72.setName("SketchConstraintCoincidence_76") SketchConstraintRadius_3 = Sketch_6.setRadius(SketchArc_5.results()[1], 0.5) SketchLine_55 = Sketch_6.addLine(0, 0, 0, 3.5) SketchLine_55.setName("SketchLine_57") SketchLine_55.result().setName("SketchLine_57") -SketchConstraintDistance_11 = Sketch_6.setDistance(SketchArc_5.center(), SketchLine_55.result(), 46, False) +SketchConstraintDistance_11 = Sketch_6.setDistance( + SketchArc_5.center(), SketchLine_55.result(), 46, False +) SketchConstraintRigid_4 = Sketch_6.setFixed(SketchLine_55.result()) SketchConstraintRigid_4.setName("SketchConstraintRigid_13") SketchPoint_7 = Sketch_6.addPoint(58, 0) -SketchConstraintCoincidence_73 = Sketch_6.setCoincident(SketchPoint_7.coordinates(), SketchLine_53.result()) +SketchConstraintCoincidence_73 = Sketch_6.setCoincident( + SketchPoint_7.coordinates(), SketchLine_53.result() +) SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_77") -SketchConstraintDistance_12 = Sketch_6.setDistance(SketchArc_5.center(), SketchPoint_7.coordinates(), 12, False) -SketchMultiTranslation_2 = Sketch_6.addTranslation([SketchLine_54.result(), SketchArc_5.results()[1]], SketchArc_5.center(), SketchPoint_7.coordinates(), 9, True) -[SketchLine_56, SketchLine_57, SketchLine_58, SketchLine_59, SketchLine_60, SketchLine_61, SketchLine_62, SketchLine_63, SketchArc_6, SketchArc_7, SketchArc_8, SketchArc_9, SketchArc_10, SketchArc_11, SketchArc_12, SketchArc_13] = SketchMultiTranslation_2.translated() +SketchConstraintDistance_12 = Sketch_6.setDistance( + SketchArc_5.center(), SketchPoint_7.coordinates(), 12, False +) +SketchMultiTranslation_2 = Sketch_6.addTranslation( + [SketchLine_54.result(), SketchArc_5.results()[1]], + SketchArc_5.center(), + SketchPoint_7.coordinates(), + 9, + True, +) +[ + SketchLine_56, + SketchLine_57, + SketchLine_58, + SketchLine_59, + SketchLine_60, + SketchLine_61, + SketchLine_62, + SketchLine_63, + SketchArc_6, + SketchArc_7, + SketchArc_8, + SketchArc_9, + SketchArc_10, + SketchArc_11, + SketchArc_12, + SketchArc_13, +] = SketchMultiTranslation_2.translated() SketchLine_63.setName("SketchLine_65") SketchLine_63.result().setName("SketchLine_65") SketchLine_62.setName("SketchLine_64") @@ -463,8 +858,26 @@ 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_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)_ExtrusionFuse_1_1")) +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)_ExtrusionFuse_1_1", + ), +) SketchLine_64 = Sketch_7.addLine(50.25, -4.5, 31.25, -4.5) SketchLine_64.setName("SketchLine_76") SketchLine_64.result().setName("SketchLine_76") @@ -483,21 +896,29 @@ SketchLine_68.result().setName("SketchLine_66") SketchLine_68.setAuxiliary(True) SketchLine_69 = Sketch_7.addLine(51, -7.5, 51, -4.5) SketchLine_69.setAuxiliary(True) -SketchConstraintCoincidence_74 = Sketch_7.setCoincident(SketchLine_69.endPoint(), SketchLine_68.startPoint()) +SketchConstraintCoincidence_74 = Sketch_7.setCoincident( + SketchLine_69.endPoint(), SketchLine_68.startPoint() +) SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_78") SketchLine_70 = Sketch_7.addLine(31, -4.5, 31, -7.5) SketchLine_70.setName("SketchLine_67") SketchLine_70.result().setName("SketchLine_67") SketchLine_70.setAuxiliary(True) -SketchConstraintCoincidence_75 = Sketch_7.setCoincident(SketchLine_68.endPoint(), SketchLine_70.startPoint()) +SketchConstraintCoincidence_75 = Sketch_7.setCoincident( + SketchLine_68.endPoint(), SketchLine_70.startPoint() +) SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_79") SketchLine_71 = Sketch_7.addLine(31, -7.5, 51, -7.5) SketchLine_71.setName("SketchLine_68") SketchLine_71.result().setName("SketchLine_68") SketchLine_71.setAuxiliary(True) -SketchConstraintCoincidence_76 = Sketch_7.setCoincident(SketchLine_70.endPoint(), SketchLine_71.startPoint()) +SketchConstraintCoincidence_76 = Sketch_7.setCoincident( + SketchLine_70.endPoint(), SketchLine_71.startPoint() +) SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_80") -SketchConstraintCoincidence_77 = Sketch_7.setCoincident(SketchLine_71.endPoint(), SketchLine_69.startPoint()) +SketchConstraintCoincidence_77 = Sketch_7.setCoincident( + SketchLine_71.endPoint(), SketchLine_69.startPoint() +) SketchConstraintCoincidence_77.setName("SketchConstraintCoincidence_81") SketchConstraintHorizontal_12 = Sketch_7.setHorizontal(SketchLine_68.result()) SketchConstraintHorizontal_12.setName("SketchConstraintHorizontal_13") @@ -509,20 +930,32 @@ SketchLine_72 = Sketch_7.addLine(31, -7.5, 51, -4.5) SketchLine_72.setName("SketchLine_70") SketchLine_72.result().setName("SketchLine_70") SketchLine_72.setAuxiliary(True) -SketchConstraintCoincidence_78 = Sketch_7.setCoincident(SketchLine_70.endPoint(), SketchLine_72.startPoint()) +SketchConstraintCoincidence_78 = Sketch_7.setCoincident( + SketchLine_70.endPoint(), SketchLine_72.startPoint() +) SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_82") -SketchConstraintCoincidence_79 = Sketch_7.setCoincident(SketchLine_71.startPoint(), SketchLine_72.startPoint()) +SketchConstraintCoincidence_79 = Sketch_7.setCoincident( + SketchLine_71.startPoint(), SketchLine_72.startPoint() +) SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_83") SketchPoint_8 = Sketch_7.addPoint(51, -4.5) -SketchConstraintCoincidence_80 = Sketch_7.setCoincident(SketchLine_68.startPoint(), SketchPoint_8.coordinates()) +SketchConstraintCoincidence_80 = Sketch_7.setCoincident( + SketchLine_68.startPoint(), SketchPoint_8.coordinates() +) SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_84") -SketchConstraintCoincidence_81 = Sketch_7.setCoincident(SketchLine_69.endPoint(), SketchPoint_8.coordinates()) +SketchConstraintCoincidence_81 = Sketch_7.setCoincident( + SketchLine_69.endPoint(), SketchPoint_8.coordinates() +) SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_85") SketchPoint_9 = Sketch_7.addPoint(41, -6) SketchPoint_9.setAuxiliary(True) -SketchConstraintCoincidence_82 = Sketch_7.setCoincident(SketchPoint_9.coordinates(), SketchLine_72.result()) +SketchConstraintCoincidence_82 = Sketch_7.setCoincident( + SketchPoint_9.coordinates(), SketchLine_72.result() +) SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_86") -SketchConstraintMiddle_3 = Sketch_7.setMiddlePoint(SketchLine_72.result(), SketchPoint_9.coordinates()) +SketchConstraintMiddle_3 = Sketch_7.setMiddlePoint( + SketchLine_72.result(), SketchPoint_9.coordinates() +) SketchPoint_10 = Sketch_7.addPoint(21, -6) SketchPoint_10.setAuxiliary(True) SketchLine_73 = Sketch_7.addLine(21, -10.5, 21, -1.5) @@ -530,27 +963,39 @@ SketchLine_73.setName("SketchLine_71") SketchLine_73.result().setName("SketchLine_71") SketchConstraintRigid_5 = Sketch_7.setFixed(SketchLine_73.result()) SketchConstraintRigid_5.setName("SketchConstraintRigid_14") -SketchConstraintCoincidence_83 = Sketch_7.setCoincident(SketchPoint_10.coordinates(), SketchLine_73.result()) +SketchConstraintCoincidence_83 = Sketch_7.setCoincident( + SketchPoint_10.coordinates(), SketchLine_73.result() +) SketchConstraintCoincidence_83.setName("SketchConstraintCoincidence_87") -SketchConstraintMiddle_4 = Sketch_7.setMiddlePoint(SketchPoint_10.coordinates(), SketchLine_73.result()) +SketchConstraintMiddle_4 = Sketch_7.setMiddlePoint( + SketchPoint_10.coordinates(), SketchLine_73.result() +) SketchLine_74 = Sketch_7.addLine(21, -6, 41, -6) SketchLine_74.setName("SketchLine_72") SketchLine_74.result().setName("SketchLine_72") SketchLine_74.setAuxiliary(True) -SketchConstraintCoincidence_84 = Sketch_7.setCoincident(SketchPoint_10.coordinates(), SketchLine_74.startPoint()) +SketchConstraintCoincidence_84 = Sketch_7.setCoincident( + SketchPoint_10.coordinates(), SketchLine_74.startPoint() +) SketchConstraintCoincidence_84.setName("SketchConstraintCoincidence_88") -SketchConstraintCoincidence_85 = Sketch_7.setCoincident(SketchPoint_9.coordinates(), SketchLine_74.endPoint()) +SketchConstraintCoincidence_85 = Sketch_7.setCoincident( + SketchPoint_9.coordinates(), SketchLine_74.endPoint() +) SketchConstraintCoincidence_85.setName("SketchConstraintCoincidence_89") SketchConstraintHorizontal_14 = Sketch_7.setHorizontal(SketchLine_74.result()) SketchConstraintHorizontal_14.setName("SketchConstraintHorizontal_15") -SketchConstraintCoincidence_86 = Sketch_7.setCoincident(SketchLine_72.endPoint(), SketchLine_68.startPoint()) +SketchConstraintCoincidence_86 = Sketch_7.setCoincident( + SketchLine_72.endPoint(), SketchLine_68.startPoint() +) SketchConstraintCoincidence_86.setName("SketchConstraintCoincidence_90") SketchConstraintLength_12 = Sketch_7.setLength(SketchLine_69.result(), 3) SketchConstraintLength_12.setName("SketchConstraintLength_13") SketchConstraintLength_13 = Sketch_7.setLength(SketchLine_68.result(), 20) SketchConstraintLength_13.setName("SketchConstraintLength_14") SketchPoint_11 = Sketch_7.addPoint(29, -10.5) -SketchConstraintDistance_13 = Sketch_7.setDistance(SketchPoint_11.coordinates(), SketchLine_70.result(), 2, False) +SketchConstraintDistance_13 = Sketch_7.setDistance( + SketchPoint_11.coordinates(), SketchLine_70.result(), 2, False +) SketchConstraintRigid_6 = Sketch_7.setFixed(SketchPoint_11.result()) SketchConstraintRigid_6.setName("SketchConstraintRigid_15") SketchArc_14 = Sketch_7.addArc(50.25, -5.25, 51, -5.25, 50.25, -4.5, False) @@ -558,168 +1003,309 @@ SketchLine_75 = Sketch_7.addLine(51, -7.5, 51, -5.25) SketchLine_75.setName("SketchLine_74") SketchLine_75.result().setName("SketchLine_74") SketchLine_75.setAuxiliary(True) -SketchConstraintCoincidence_87 = Sketch_7.setCoincident(SketchArc_14.startPoint(), SketchLine_75.endPoint()) +SketchConstraintCoincidence_87 = Sketch_7.setCoincident( + SketchArc_14.startPoint(), SketchLine_75.endPoint() +) SketchConstraintCoincidence_87.setName("SketchConstraintCoincidence_91") SketchLine_76 = Sketch_7.addLine(50.25, -4.5, 31, -4.5) SketchLine_76.setName("SketchLine_73") SketchLine_76.result().setName("SketchLine_73") SketchLine_76.setAuxiliary(True) -SketchConstraintCoincidence_88 = Sketch_7.setCoincident(SketchArc_14.endPoint(), SketchLine_76.startPoint()) +SketchConstraintCoincidence_88 = Sketch_7.setCoincident( + SketchArc_14.endPoint(), SketchLine_76.startPoint() +) SketchConstraintCoincidence_88.setName("SketchConstraintCoincidence_92") -SketchConstraintTangent_2 = Sketch_7.setTangent(SketchArc_14.results()[1], SketchLine_76.result()) -SketchConstraintTangent_3 = Sketch_7.setTangent(SketchArc_14.results()[1], SketchLine_75.result()) -SketchConstraintCoincidence_89 = Sketch_7.setCoincident(SketchLine_68.endPoint(), SketchLine_76.endPoint()) +SketchConstraintTangent_2 = Sketch_7.setTangent( + SketchArc_14.results()[1], SketchLine_76.result() +) +SketchConstraintTangent_3 = Sketch_7.setTangent( + SketchArc_14.results()[1], SketchLine_75.result() +) +SketchConstraintCoincidence_89 = Sketch_7.setCoincident( + SketchLine_68.endPoint(), SketchLine_76.endPoint() +) SketchConstraintCoincidence_89.setName("SketchConstraintCoincidence_93") -SketchConstraintCoincidence_90 = Sketch_7.setCoincident(SketchLine_69.startPoint(), SketchLine_75.startPoint()) +SketchConstraintCoincidence_90 = Sketch_7.setCoincident( + SketchLine_69.startPoint(), SketchLine_75.startPoint() +) SketchConstraintCoincidence_90.setName("SketchConstraintCoincidence_94") -SketchConstraintCoincidence_91 = Sketch_7.setCoincident(SketchLine_76.startPoint(), SketchLine_68.result()) +SketchConstraintCoincidence_91 = Sketch_7.setCoincident( + SketchLine_76.startPoint(), SketchLine_68.result() +) SketchConstraintCoincidence_91.setName("SketchConstraintCoincidence_95") -SketchConstraintCoincidence_92 = Sketch_7.setCoincident(SketchLine_75.endPoint(), SketchLine_69.result()) +SketchConstraintCoincidence_92 = Sketch_7.setCoincident( + SketchLine_75.endPoint(), SketchLine_69.result() +) SketchConstraintCoincidence_92.setName("SketchConstraintCoincidence_96") -SketchArc_15 = Sketch_7.addArc(31.25, -4.750000000010547, 31.24999999999071, -4.5, 31, -4.750000000010547, False) -SketchConstraintCoincidence_93 = Sketch_7.setCoincident(SketchArc_15.startPoint(), SketchLine_64.endPoint()) +SketchArc_15 = Sketch_7.addArc( + 31.25, -4.750000000010547, 31.24999999999071, -4.5, 31, -4.750000000010547, False +) +SketchConstraintCoincidence_93 = Sketch_7.setCoincident( + SketchArc_15.startPoint(), SketchLine_64.endPoint() +) SketchConstraintCoincidence_93.setName("SketchConstraintCoincidence_97") SketchLine_77 = Sketch_7.addLine(31, -4.75, 31, -7.5) SketchLine_77.setName("SketchLine_75") SketchLine_77.result().setName("SketchLine_75") SketchLine_77.setAuxiliary(True) -SketchConstraintCoincidence_94 = Sketch_7.setCoincident(SketchArc_15.endPoint(), SketchLine_77.startPoint()) +SketchConstraintCoincidence_94 = Sketch_7.setCoincident( + SketchArc_15.endPoint(), SketchLine_77.startPoint() +) SketchConstraintCoincidence_94.setName("SketchConstraintCoincidence_98") -SketchConstraintTangent_4 = Sketch_7.setTangent(SketchArc_15.results()[1], SketchLine_77.result()) -SketchConstraintTangent_5 = Sketch_7.setTangent(SketchArc_15.results()[1], SketchLine_64.result()) -SketchConstraintCoincidence_95 = Sketch_7.setCoincident(SketchLine_70.endPoint(), SketchLine_77.endPoint()) +SketchConstraintTangent_4 = Sketch_7.setTangent( + SketchArc_15.results()[1], SketchLine_77.result() +) +SketchConstraintTangent_5 = Sketch_7.setTangent( + SketchArc_15.results()[1], SketchLine_64.result() +) +SketchConstraintCoincidence_95 = Sketch_7.setCoincident( + SketchLine_70.endPoint(), SketchLine_77.endPoint() +) SketchConstraintCoincidence_95.setName("SketchConstraintCoincidence_99") -SketchConstraintCoincidence_96 = Sketch_7.setCoincident(SketchLine_76.startPoint(), SketchLine_64.startPoint()) +SketchConstraintCoincidence_96 = Sketch_7.setCoincident( + SketchLine_76.startPoint(), SketchLine_64.startPoint() +) SketchConstraintCoincidence_96.setName("SketchConstraintCoincidence_100") -SketchConstraintCoincidence_97 = Sketch_7.setCoincident(SketchLine_77.startPoint(), SketchLine_70.result()) +SketchConstraintCoincidence_97 = Sketch_7.setCoincident( + SketchLine_77.startPoint(), SketchLine_70.result() +) SketchConstraintCoincidence_97.setName("SketchConstraintCoincidence_101") -SketchConstraintCoincidence_98 = Sketch_7.setCoincident(SketchLine_64.endPoint(), SketchLine_76.result()) +SketchConstraintCoincidence_98 = Sketch_7.setCoincident( + SketchLine_64.endPoint(), SketchLine_76.result() +) SketchConstraintCoincidence_98.setName("SketchConstraintCoincidence_102") SketchArc_16 = Sketch_7.addArc(50.25, -6.75, 50.25, -7.5, 51, -6.75, False) SketchLine_78 = Sketch_7.addLine(31, -7.5, 50.25, -7.5) SketchLine_78.setName("SketchLine_77") SketchLine_78.result().setName("SketchLine_77") SketchLine_78.setAuxiliary(True) -SketchConstraintCoincidence_99 = Sketch_7.setCoincident(SketchArc_16.startPoint(), SketchLine_78.endPoint()) +SketchConstraintCoincidence_99 = Sketch_7.setCoincident( + SketchArc_16.startPoint(), SketchLine_78.endPoint() +) SketchConstraintCoincidence_99.setName("SketchConstraintCoincidence_103") -SketchConstraintCoincidence_100 = Sketch_7.setCoincident(SketchArc_16.endPoint(), SketchLine_65.startPoint()) +SketchConstraintCoincidence_100 = Sketch_7.setCoincident( + SketchArc_16.endPoint(), SketchLine_65.startPoint() +) SketchConstraintCoincidence_100.setName("SketchConstraintCoincidence_104") -SketchConstraintTangent_6 = Sketch_7.setTangent(SketchArc_16.results()[1], SketchLine_78.result()) -SketchConstraintTangent_7 = Sketch_7.setTangent(SketchArc_16.results()[1], SketchLine_65.result()) -SketchConstraintCoincidence_101 = Sketch_7.setCoincident(SketchLine_71.startPoint(), SketchLine_78.startPoint()) +SketchConstraintTangent_6 = Sketch_7.setTangent( + SketchArc_16.results()[1], SketchLine_78.result() +) +SketchConstraintTangent_7 = Sketch_7.setTangent( + SketchArc_16.results()[1], SketchLine_65.result() +) +SketchConstraintCoincidence_101 = Sketch_7.setCoincident( + SketchLine_71.startPoint(), SketchLine_78.startPoint() +) SketchConstraintCoincidence_101.setName("SketchConstraintCoincidence_105") -SketchConstraintCoincidence_102 = Sketch_7.setCoincident(SketchLine_75.endPoint(), SketchLine_65.endPoint()) +SketchConstraintCoincidence_102 = Sketch_7.setCoincident( + SketchLine_75.endPoint(), SketchLine_65.endPoint() +) SketchConstraintCoincidence_102.setName("SketchConstraintCoincidence_106") -SketchConstraintCoincidence_103 = Sketch_7.setCoincident(SketchLine_78.endPoint(), SketchLine_71.result()) +SketchConstraintCoincidence_103 = Sketch_7.setCoincident( + SketchLine_78.endPoint(), SketchLine_71.result() +) SketchConstraintCoincidence_103.setName("SketchConstraintCoincidence_107") -SketchConstraintCoincidence_104 = Sketch_7.setCoincident(SketchLine_65.startPoint(), SketchLine_75.result()) +SketchConstraintCoincidence_104 = Sketch_7.setCoincident( + SketchLine_65.startPoint(), SketchLine_75.result() +) SketchConstraintCoincidence_104.setName("SketchConstraintCoincidence_108") -SketchArc_17 = Sketch_7.addArc(31.25000000000166, -7.249999999978784, 31, -7.249999999978425, 31.25000000000632, -7.499999999999999, False) -SketchConstraintCoincidence_105 = Sketch_7.setCoincident(SketchArc_17.startPoint(), SketchLine_66.endPoint()) +SketchArc_17 = Sketch_7.addArc( + 31.25000000000166, + -7.249999999978784, + 31, + -7.249999999978425, + 31.25000000000632, + -7.499999999999999, + False, +) +SketchConstraintCoincidence_105 = Sketch_7.setCoincident( + SketchArc_17.startPoint(), SketchLine_66.endPoint() +) SketchConstraintCoincidence_105.setName("SketchConstraintCoincidence_109") -SketchConstraintCoincidence_106 = Sketch_7.setCoincident(SketchArc_17.endPoint(), SketchLine_67.startPoint()) +SketchConstraintCoincidence_106 = Sketch_7.setCoincident( + SketchArc_17.endPoint(), SketchLine_67.startPoint() +) SketchConstraintCoincidence_106.setName("SketchConstraintCoincidence_110") -SketchConstraintCoincidence_107 = Sketch_7.setCoincident(SketchLine_78.endPoint(), SketchLine_67.endPoint()) +SketchConstraintCoincidence_107 = Sketch_7.setCoincident( + SketchLine_78.endPoint(), SketchLine_67.endPoint() +) SketchConstraintCoincidence_107.setName("SketchConstraintCoincidence_111") -SketchConstraintCoincidence_108 = Sketch_7.setCoincident(SketchLine_77.startPoint(), SketchLine_66.startPoint()) +SketchConstraintCoincidence_108 = Sketch_7.setCoincident( + SketchLine_77.startPoint(), SketchLine_66.startPoint() +) SketchConstraintCoincidence_108.setName("SketchConstraintCoincidence_112") -SketchConstraintCoincidence_109 = Sketch_7.setCoincident(SketchLine_67.startPoint(), SketchLine_78.result()) +SketchConstraintCoincidence_109 = Sketch_7.setCoincident( + SketchLine_67.startPoint(), SketchLine_78.result() +) SketchConstraintCoincidence_109.setName("SketchConstraintCoincidence_113") -SketchConstraintCoincidence_110 = Sketch_7.setCoincident(SketchLine_66.endPoint(), SketchLine_77.result()) +SketchConstraintCoincidence_110 = Sketch_7.setCoincident( + SketchLine_66.endPoint(), SketchLine_77.result() +) SketchConstraintCoincidence_110.setName("SketchConstraintCoincidence_114") SketchConstraintRadius_4 = Sketch_7.setRadius(SketchArc_14.results()[1], 0.75) SketchConstraintRadius_5 = Sketch_7.setRadius(SketchArc_16.results()[1], 0.75) SketchConstraintRadius_6 = Sketch_7.setRadius(SketchArc_15.results()[1], 0.25) -SketchConstraintTangent_8 = Sketch_7.setTangent(SketchArc_17.results()[1], SketchLine_67.result()) +SketchConstraintTangent_8 = Sketch_7.setTangent( + SketchArc_17.results()[1], SketchLine_67.result() +) SketchConstraintTangent_8.setName("SketchConstraintTangent_16") -SketchConstraintTangent_9 = Sketch_7.setTangent(SketchArc_17.results()[1], SketchLine_66.result()) +SketchConstraintTangent_9 = Sketch_7.setTangent( + SketchArc_17.results()[1], SketchLine_66.result() +) SketchConstraintTangent_9.setName("SketchConstraintTangent_17") 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", "(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)")) +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", + "(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()) SketchConstraintRigid_7.setName("SketchConstraintRigid_16") -SketchConstraintCoincidence_111 = Sketch_8.setCoincident(SketchPoint_12.coordinates(), SketchPoint_13.result()) +SketchConstraintCoincidence_111 = Sketch_8.setCoincident( + SketchPoint_12.coordinates(), SketchPoint_13.result() +) SketchConstraintCoincidence_111.setName("SketchConstraintCoincidence_115") SketchPoint_14 = Sketch_8.addPoint(54, 12) SketchLine_79 = Sketch_8.addLine(54, 12, 54, 0) SketchLine_79.setName("SketchLine_81") SketchLine_79.result().setName("SketchLine_81") SketchLine_79.setAuxiliary(True) -SketchConstraintCoincidence_112 = Sketch_8.setCoincident(SketchPoint_14.coordinates(), SketchLine_79.startPoint()) +SketchConstraintCoincidence_112 = Sketch_8.setCoincident( + SketchPoint_14.coordinates(), SketchLine_79.startPoint() +) SketchConstraintCoincidence_112.setName("SketchConstraintCoincidence_116") -SketchConstraintCoincidence_113 = Sketch_8.setCoincident(SketchPoint_12.coordinates(), SketchLine_79.endPoint()) +SketchConstraintCoincidence_113 = Sketch_8.setCoincident( + SketchPoint_12.coordinates(), SketchLine_79.endPoint() +) SketchConstraintCoincidence_113.setName("SketchConstraintCoincidence_117") -SketchConstraintCoincidence_114 = Sketch_8.setCoincident(SketchPoint_13.coordinates(), SketchLine_79.endPoint()) +SketchConstraintCoincidence_114 = Sketch_8.setCoincident( + SketchPoint_13.coordinates(), SketchLine_79.endPoint() +) SketchConstraintCoincidence_114.setName("SketchConstraintCoincidence_118") SketchPoint_15 = Sketch_8.addPoint(54, 11) -SketchConstraintCoincidence_115 = Sketch_8.setCoincident(SketchPoint_15.coordinates(), SketchLine_79.result()) +SketchConstraintCoincidence_115 = Sketch_8.setCoincident( + SketchPoint_15.coordinates(), SketchLine_79.result() +) SketchConstraintCoincidence_115.setName("SketchConstraintCoincidence_119") SketchPoint_16 = Sketch_8.addPoint(54, 1) -SketchConstraintCoincidence_116 = Sketch_8.setCoincident(SketchPoint_16.coordinates(), SketchLine_79.result()) +SketchConstraintCoincidence_116 = Sketch_8.setCoincident( + SketchPoint_16.coordinates(), SketchLine_79.result() +) SketchConstraintCoincidence_116.setName("SketchConstraintCoincidence_120") -SketchConstraintDistance_14 = Sketch_8.setDistance(SketchPoint_12.coordinates(), SketchPoint_16.coordinates(), 1, False) -SketchConstraintDistance_15 = Sketch_8.setDistance(SketchPoint_14.coordinates(), SketchPoint_15.coordinates(), 1, False) +SketchConstraintDistance_14 = Sketch_8.setDistance( + SketchPoint_12.coordinates(), SketchPoint_16.coordinates(), 1, False +) +SketchConstraintDistance_15 = Sketch_8.setDistance( + SketchPoint_14.coordinates(), SketchPoint_15.coordinates(), 1, False +) SketchPoint_17 = Sketch_8.addPoint(54, 12) -SketchConstraintCoincidence_117 = Sketch_8.setCoincident(SketchPoint_14.coordinates(), SketchPoint_17.coordinates()) +SketchConstraintCoincidence_117 = Sketch_8.setCoincident( + SketchPoint_14.coordinates(), SketchPoint_17.coordinates() +) SketchConstraintCoincidence_117.setName("SketchConstraintCoincidence_121") SketchConstraintRigid_8 = Sketch_8.setFixed(SketchPoint_17.result()) SketchConstraintRigid_8.setName("SketchConstraintRigid_17") SketchLine_80 = Sketch_8.addLine(54, 11, 43.82041221793113, 11) SketchLine_80.setName("SketchLine_82") SketchLine_80.result().setName("SketchLine_82") -SketchConstraintCoincidence_118 = Sketch_8.setCoincident(SketchPoint_15.coordinates(), SketchLine_80.startPoint()) +SketchConstraintCoincidence_118 = Sketch_8.setCoincident( + SketchPoint_15.coordinates(), SketchLine_80.startPoint() +) SketchConstraintCoincidence_118.setName("SketchConstraintCoincidence_122") -SketchLine_81 = Sketch_8.addLine(43.82041221793113, 11, 43.82041221793113, 13.36310636658867) +SketchLine_81 = Sketch_8.addLine( + 43.82041221793113, 11, 43.82041221793113, 13.36310636658867 +) SketchLine_81.setName("SketchLine_83") SketchLine_81.result().setName("SketchLine_83") -SketchConstraintCoincidence_119 = Sketch_8.setCoincident(SketchLine_80.endPoint(), SketchLine_81.startPoint()) +SketchConstraintCoincidence_119 = Sketch_8.setCoincident( + SketchLine_80.endPoint(), SketchLine_81.startPoint() +) SketchConstraintCoincidence_119.setName("SketchConstraintCoincidence_123") -SketchLine_82 = Sketch_8.addLine(43.82041221793113, 13.36310636658867, 63.09515214070713, 13.47539228785809) +SketchLine_82 = Sketch_8.addLine( + 43.82041221793113, 13.36310636658867, 63.09515214070713, 13.47539228785809 +) SketchLine_82.setName("SketchLine_84") SketchLine_82.result().setName("SketchLine_84") -SketchConstraintCoincidence_120 = Sketch_8.setCoincident(SketchLine_81.endPoint(), SketchLine_82.startPoint()) +SketchConstraintCoincidence_120 = Sketch_8.setCoincident( + SketchLine_81.endPoint(), SketchLine_82.startPoint() +) SketchConstraintCoincidence_120.setName("SketchConstraintCoincidence_124") -SketchLine_83 = Sketch_8.addLine(63.09515214070713, 13.47539228785809, 63.12349734647592, -1.774328415749978) +SketchLine_83 = Sketch_8.addLine( + 63.09515214070713, 13.47539228785809, 63.12349734647592, -1.774328415749978 +) SketchLine_83.setName("SketchLine_85") SketchLine_83.result().setName("SketchLine_85") -SketchConstraintCoincidence_121 = Sketch_8.setCoincident(SketchLine_82.endPoint(), SketchLine_83.startPoint()) +SketchConstraintCoincidence_121 = Sketch_8.setCoincident( + SketchLine_82.endPoint(), SketchLine_83.startPoint() +) SketchConstraintCoincidence_121.setName("SketchConstraintCoincidence_125") -SketchLine_84 = Sketch_8.addLine(63.12349734647592, -1.774328415749978, 43.82041221793113, -1.802673621518767) +SketchLine_84 = Sketch_8.addLine( + 63.12349734647592, -1.774328415749978, 43.82041221793113, -1.802673621518767 +) SketchLine_84.setName("SketchLine_86") SketchLine_84.result().setName("SketchLine_86") -SketchConstraintCoincidence_122 = Sketch_8.setCoincident(SketchLine_83.endPoint(), SketchLine_84.startPoint()) +SketchConstraintCoincidence_122 = Sketch_8.setCoincident( + SketchLine_83.endPoint(), SketchLine_84.startPoint() +) SketchConstraintCoincidence_122.setName("SketchConstraintCoincidence_126") -SketchLine_85 = Sketch_8.addLine(43.82041221793113, -1.802673621518767, 43.79206701216234, 1) +SketchLine_85 = Sketch_8.addLine( + 43.82041221793113, -1.802673621518767, 43.79206701216234, 1 +) SketchLine_85.setName("SketchLine_87") SketchLine_85.result().setName("SketchLine_87") -SketchConstraintCoincidence_123 = Sketch_8.setCoincident(SketchLine_84.endPoint(), SketchLine_85.startPoint()) +SketchConstraintCoincidence_123 = Sketch_8.setCoincident( + SketchLine_84.endPoint(), SketchLine_85.startPoint() +) SketchConstraintCoincidence_123.setName("SketchConstraintCoincidence_127") SketchLine_86 = Sketch_8.addLine(54, 1, 43.79206701216234, 1) SketchLine_86.setName("SketchLine_88") SketchLine_86.result().setName("SketchLine_88") -SketchConstraintCoincidence_124 = Sketch_8.setCoincident(SketchPoint_16.coordinates(), SketchLine_86.startPoint()) +SketchConstraintCoincidence_124 = Sketch_8.setCoincident( + SketchPoint_16.coordinates(), SketchLine_86.startPoint() +) SketchConstraintCoincidence_124.setName("SketchConstraintCoincidence_128") SketchConstraintHorizontal_15 = Sketch_8.setHorizontal(SketchLine_86.result()) SketchConstraintHorizontal_15.setName("SketchConstraintHorizontal_16") SketchConstraintHorizontal_16 = Sketch_8.setHorizontal(SketchLine_80.result()) SketchConstraintHorizontal_16.setName("SketchConstraintHorizontal_17") -SketchConstraintCoincidence_125 = Sketch_8.setCoincident(SketchLine_85.endPoint(), SketchLine_86.endPoint()) +SketchConstraintCoincidence_125 = Sketch_8.setCoincident( + SketchLine_85.endPoint(), SketchLine_86.endPoint() +) SketchConstraintCoincidence_125.setName("SketchConstraintCoincidence_129") SketchArc_18 = Sketch_8.addArc(54, 6, 54, 11, 54, 1, True) -SketchConstraintCoincidence_126 = Sketch_8.setCoincident(SketchArc_18.center(), SketchLine_79.result()) +SketchConstraintCoincidence_126 = Sketch_8.setCoincident( + SketchArc_18.center(), SketchLine_79.result() +) SketchConstraintCoincidence_126.setName("SketchConstraintCoincidence_130") -SketchConstraintCoincidence_127 = Sketch_8.setCoincident(SketchPoint_15.coordinates(), SketchArc_18.startPoint()) +SketchConstraintCoincidence_127 = Sketch_8.setCoincident( + SketchPoint_15.coordinates(), SketchArc_18.startPoint() +) SketchConstraintCoincidence_127.setName("SketchConstraintCoincidence_130_") -SketchConstraintCoincidence_128 = Sketch_8.setCoincident(SketchLine_80.startPoint(), SketchArc_18.startPoint()) +SketchConstraintCoincidence_128 = Sketch_8.setCoincident( + SketchLine_80.startPoint(), SketchArc_18.startPoint() +) SketchConstraintCoincidence_128.setName("SketchConstraintCoincidence_131") -SketchConstraintCoincidence_129 = Sketch_8.setCoincident(SketchPoint_16.coordinates(), SketchArc_18.endPoint()) +SketchConstraintCoincidence_129 = Sketch_8.setCoincident( + SketchPoint_16.coordinates(), SketchArc_18.endPoint() +) SketchConstraintCoincidence_129.setName("SketchConstraintCoincidence_132") -SketchConstraintCoincidence_130 = Sketch_8.setCoincident(SketchLine_86.startPoint(), SketchArc_18.endPoint()) +SketchConstraintCoincidence_130 = Sketch_8.setCoincident( + SketchLine_86.startPoint(), SketchArc_18.endPoint() +) SketchConstraintCoincidence_130.setName("SketchConstraintCoincidence_133") SketchLine_87 = Sketch_8.addLine(43.50261344273609, 8.25, 43.50261344273609, 3.75) SketchLine_87.setName("SketchLine_90") @@ -728,7 +1314,9 @@ SketchConstraintVertical_14 = Sketch_8.setVertical(SketchLine_87.result()) SketchConstraintLength_14 = Sketch_8.setLength(SketchLine_87.result(), 4.5) SketchConstraintLength_14.setName("SketchConstraintLength_15") SketchPoint_18 = Sketch_8.addPoint(43.50261344273609, 6) -SketchConstraintMiddle_5 = Sketch_8.setMiddlePoint(SketchPoint_18.coordinates(), SketchLine_87.result()) +SketchConstraintMiddle_5 = Sketch_8.setMiddlePoint( + SketchPoint_18.coordinates(), SketchLine_87.result() +) SketchPoint_19 = Sketch_8.addPoint(0, 6) SketchPoint_19.setAuxiliary(True) SketchLine_88 = Sketch_8.addLine(0, 0, 0, 12) @@ -736,58 +1324,96 @@ SketchLine_88.setName("SketchLine_94") SketchLine_88.result().setName("SketchLine_94") SketchConstraintRigid_9 = Sketch_8.setFixed(SketchLine_88.result()) SketchConstraintRigid_9.setName("SketchConstraintRigid_19") -SketchConstraintCoincidence_131 = Sketch_8.setCoincident(SketchPoint_19.coordinates(), SketchLine_88.result()) +SketchConstraintCoincidence_131 = Sketch_8.setCoincident( + SketchPoint_19.coordinates(), SketchLine_88.result() +) SketchConstraintCoincidence_131.setName("SketchConstraintCoincidence_139") -SketchConstraintMiddle_6 = Sketch_8.setMiddlePoint(SketchLine_88.result(), SketchPoint_19.coordinates()) +SketchConstraintMiddle_6 = Sketch_8.setMiddlePoint( + SketchLine_88.result(), SketchPoint_19.coordinates() +) SketchLine_89 = Sketch_8.addLine(0, 6, 68.8619738308997, 6) SketchLine_89.setName("SketchLine_95") SketchLine_89.result().setName("SketchLine_95") SketchLine_89.setAuxiliary(True) -SketchConstraintCoincidence_132 = Sketch_8.setCoincident(SketchPoint_19.coordinates(), SketchLine_89.startPoint()) +SketchConstraintCoincidence_132 = Sketch_8.setCoincident( + SketchPoint_19.coordinates(), SketchLine_89.startPoint() +) SketchConstraintCoincidence_132.setName("SketchConstraintCoincidence_140") SketchConstraintHorizontal_17 = Sketch_8.setHorizontal(SketchLine_89.result()) SketchConstraintHorizontal_17.setName("SketchConstraintHorizontal_20") SketchPoint_20 = Sketch_8.addPoint(48.00130672136804, 6) -SketchConstraintCoincidence_133 = Sketch_8.setCoincident(SketchPoint_20.coordinates(), SketchLine_89.result()) +SketchConstraintCoincidence_133 = Sketch_8.setCoincident( + SketchPoint_20.coordinates(), SketchLine_89.result() +) SketchConstraintCoincidence_133.setName("SketchConstraintCoincidence_146") SketchLine_90 = Sketch_8.addLine(43.50261344273609, 8.25, 51.26978940411676, 8.25) SketchLine_90.setName("SketchLine_92") SketchLine_90.result().setName("SketchLine_92") -SketchConstraintCoincidence_134 = Sketch_8.setCoincident(SketchLine_87.startPoint(), SketchLine_90.startPoint()) +SketchConstraintCoincidence_134 = Sketch_8.setCoincident( + SketchLine_87.startPoint(), SketchLine_90.startPoint() +) SketchConstraintCoincidence_134.setName("SketchConstraintCoincidence_135") SketchLine_91 = Sketch_8.addLine(51.26978940411676, 8.25, 51.26978940411676, 3.75) SketchLine_91.setName("SketchLine_97") SketchLine_91.result().setName("SketchLine_97") -SketchConstraintCoincidence_135 = Sketch_8.setCoincident(SketchLine_90.endPoint(), SketchLine_91.startPoint()) +SketchConstraintCoincidence_135 = Sketch_8.setCoincident( + SketchLine_90.endPoint(), SketchLine_91.startPoint() +) SketchConstraintCoincidence_135.setName("SketchConstraintCoincidence_136") SketchLine_92 = Sketch_8.addLine(51.26978940411676, 3.75, 43.50261344273609, 3.75) SketchLine_92.setName("SketchLine_98") SketchLine_92.result().setName("SketchLine_98") -SketchConstraintCoincidence_136 = Sketch_8.setCoincident(SketchLine_91.endPoint(), SketchLine_92.startPoint()) +SketchConstraintCoincidence_136 = Sketch_8.setCoincident( + SketchLine_91.endPoint(), SketchLine_92.startPoint() +) SketchConstraintCoincidence_136.setName("SketchConstraintCoincidence_137") -SketchConstraintCoincidence_137 = Sketch_8.setCoincident(SketchLine_87.endPoint(), SketchLine_92.endPoint()) +SketchConstraintCoincidence_137 = Sketch_8.setCoincident( + SketchLine_87.endPoint(), SketchLine_92.endPoint() +) SketchConstraintCoincidence_137.setName("SketchConstraintCoincidence_138") SketchConstraintHorizontal_18 = Sketch_8.setHorizontal(SketchLine_92.result()) SketchConstraintHorizontal_19 = Sketch_8.setHorizontal(SketchLine_90.result()) SketchConstraintVertical_15 = Sketch_8.setVertical(SketchLine_91.result()) SketchLine_93 = Sketch_8.addLine(43.50261344273609, 3.75, 51.26978940411676, 8.25) SketchLine_93.setAuxiliary(True) -SketchConstraintCoincidence_138 = Sketch_8.setCoincident(SketchLine_87.endPoint(), SketchLine_93.startPoint()) +SketchConstraintCoincidence_138 = Sketch_8.setCoincident( + SketchLine_87.endPoint(), SketchLine_93.startPoint() +) SketchConstraintCoincidence_138.setName("SketchConstraintCoincidence_141") -SketchConstraintCoincidence_139 = Sketch_8.setCoincident(SketchLine_92.endPoint(), SketchLine_93.startPoint()) +SketchConstraintCoincidence_139 = Sketch_8.setCoincident( + SketchLine_92.endPoint(), SketchLine_93.startPoint() +) SketchConstraintCoincidence_139.setName("SketchConstraintCoincidence_142") -SketchConstraintCoincidence_140 = Sketch_8.setCoincident(SketchLine_91.startPoint(), SketchLine_93.endPoint()) +SketchConstraintCoincidence_140 = Sketch_8.setCoincident( + SketchLine_91.startPoint(), SketchLine_93.endPoint() +) SketchConstraintCoincidence_140.setName("SketchConstraintCoincidence_143") SketchPoint_21 = Sketch_8.addPoint(47.38620142342643, 6) SketchPoint_21.setAuxiliary(True) -SketchConstraintCoincidence_141 = Sketch_8.setCoincident(SketchPoint_21.coordinates(), SketchLine_93.result()) +SketchConstraintCoincidence_141 = Sketch_8.setCoincident( + SketchPoint_21.coordinates(), SketchLine_93.result() +) SketchConstraintCoincidence_141.setName("SketchConstraintCoincidence_144") -SketchConstraintMiddle_7 = Sketch_8.setMiddlePoint(SketchPoint_21.coordinates(), SketchLine_93.result()) -SketchConstraintCoincidence_142 = Sketch_8.setCoincident(SketchPoint_21.coordinates(), SketchLine_89.result()) +SketchConstraintMiddle_7 = Sketch_8.setMiddlePoint( + SketchPoint_21.coordinates(), SketchLine_93.result() +) +SketchConstraintCoincidence_142 = Sketch_8.setCoincident( + SketchPoint_21.coordinates(), SketchLine_89.result() +) 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/Modified_Face&Extrusion_1_1/To_Face")) +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/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") @@ -795,7 +1421,15 @@ SketchLine_95 = Sketch_9.addLine(29, 5, 21, 5) SketchLine_95.setName("SketchLine_96") SketchLine_95.result().setName("SketchLine_96") SketchLine_95.setAuxiliary(True) -SketchArc_19 = Sketch_9.addArc(25, 8, 21.53774043054522, 4.392679848735523, 28.46225956945478, 4.392679848735522, False) +SketchArc_19 = Sketch_9.addArc( + 25, + 8, + 21.53774043054522, + 4.392679848735523, + 28.46225956945478, + 4.392679848735522, + False, +) SketchArc_19.setName("SketchArc_22") SketchArc_19.result().setName("SketchArc_22") SketchArc_19.results()[1].setName("SketchArc_22_2") @@ -809,15 +1443,23 @@ SketchLine_98 = Sketch_9.addLine(29, 0, 29, 5) SketchLine_98.setName("SketchLine_101") SketchLine_98.result().setName("SketchLine_101") SketchLine_98.setAuxiliary(True) -SketchConstraintCoincidence_143 = Sketch_9.setCoincident(SketchLine_98.endPoint(), SketchLine_95.startPoint()) +SketchConstraintCoincidence_143 = Sketch_9.setCoincident( + SketchLine_98.endPoint(), SketchLine_95.startPoint() +) SketchConstraintCoincidence_143.setName("SketchConstraintCoincidence_147") SketchLine_99 = Sketch_9.addLine(21, 5, 21, 0) SketchLine_99.setAuxiliary(True) -SketchConstraintCoincidence_144 = Sketch_9.setCoincident(SketchLine_95.endPoint(), SketchLine_99.startPoint()) +SketchConstraintCoincidence_144 = Sketch_9.setCoincident( + SketchLine_95.endPoint(), SketchLine_99.startPoint() +) SketchConstraintCoincidence_144.setName("SketchConstraintCoincidence_148") -SketchConstraintCoincidence_145 = Sketch_9.setCoincident(SketchLine_99.endPoint(), SketchLine_96.startPoint()) +SketchConstraintCoincidence_145 = Sketch_9.setCoincident( + SketchLine_99.endPoint(), SketchLine_96.startPoint() +) SketchConstraintCoincidence_145.setName("SketchConstraintCoincidence_149") -SketchConstraintCoincidence_146 = Sketch_9.setCoincident(SketchLine_96.endPoint(), SketchLine_98.startPoint()) +SketchConstraintCoincidence_146 = Sketch_9.setCoincident( + SketchLine_96.endPoint(), SketchLine_98.startPoint() +) SketchConstraintCoincidence_146.setName("SketchConstraintCoincidence_150") SketchConstraintHorizontal_20 = Sketch_9.setHorizontal(SketchLine_95.result()) SketchConstraintHorizontal_20.setName("SketchConstraintHorizontal_21") @@ -826,12 +1468,16 @@ SketchConstraintHorizontal_21 = Sketch_9.setHorizontal(SketchLine_96.result()) SketchConstraintHorizontal_21.setName("SketchConstraintHorizontal_22") SketchConstraintVertical_17 = Sketch_9.setVertical(SketchLine_98.result()) SketchPoint_22 = Sketch_9.addPoint(21, 7.5) -SketchConstraintCoincidence_147 = Sketch_9.setCoincident(SketchLine_99.result(), SketchPoint_22.coordinates()) +SketchConstraintCoincidence_147 = Sketch_9.setCoincident( + SketchLine_99.result(), SketchPoint_22.coordinates() +) SketchConstraintCoincidence_147.setName("SketchConstraintCoincidence_151") SketchConstraintRigid_10 = Sketch_9.setFixed(SketchPoint_22.result()) SketchConstraintRigid_10.setName("SketchConstraintRigid_18") SketchPoint_23 = Sketch_9.addPoint(29, 7.5) -SketchConstraintCoincidence_148 = Sketch_9.setCoincident(SketchLine_98.result(), SketchPoint_23.coordinates()) +SketchConstraintCoincidence_148 = Sketch_9.setCoincident( + SketchLine_98.result(), SketchPoint_23.coordinates() +) SketchConstraintCoincidence_148.setName("SketchConstraintCoincidence_152") SketchConstraintRigid_11 = Sketch_9.setFixed(SketchPoint_23.result()) SketchConstraintRigid_11.setName("SketchConstraintRigid_20") @@ -840,7 +1486,9 @@ SketchConstraintLength_15.setName("SketchConstraintLength_16") SketchLine_100 = Sketch_9.addLine(0, 0, 45.5, 0) SketchLine_100.setName("SketchLine_102") SketchLine_100.result().setName("SketchLine_102") -SketchConstraintCoincidence_149 = Sketch_9.setCoincident(SketchLine_99.endPoint(), SketchLine_100.result()) +SketchConstraintCoincidence_149 = Sketch_9.setCoincident( + SketchLine_99.endPoint(), SketchLine_100.result() +) SketchConstraintCoincidence_149.setName("SketchConstraintCoincidence_153") SketchConstraintRigid_12 = Sketch_9.setFixed(SketchLine_100.result()) SketchConstraintRigid_12.setName("SketchConstraintRigid_21") @@ -849,88 +1497,176 @@ SketchArc_20.setName("SketchArc_19") SketchArc_20.result().setName("SketchArc_19") SketchArc_20.results()[1].setName("SketchArc_19_2") SketchArc_20.setAuxiliary(True) -SketchConstraintCoincidence_150 = Sketch_9.setCoincident(SketchLine_95.endPoint(), SketchArc_20.startPoint()) +SketchConstraintCoincidence_150 = Sketch_9.setCoincident( + SketchLine_95.endPoint(), SketchArc_20.startPoint() +) SketchConstraintCoincidence_150.setName("SketchConstraintCoincidence_154") -SketchConstraintCoincidence_151 = Sketch_9.setCoincident(SketchLine_99.startPoint(), SketchArc_20.startPoint()) +SketchConstraintCoincidence_151 = Sketch_9.setCoincident( + SketchLine_99.startPoint(), SketchArc_20.startPoint() +) SketchConstraintCoincidence_151.setName("SketchConstraintCoincidence_155") -SketchConstraintCoincidence_152 = Sketch_9.setCoincident(SketchLine_95.startPoint(), SketchArc_20.endPoint()) +SketchConstraintCoincidence_152 = Sketch_9.setCoincident( + SketchLine_95.startPoint(), SketchArc_20.endPoint() +) SketchConstraintCoincidence_152.setName("SketchConstraintCoincidence_156") -SketchConstraintCoincidence_153 = Sketch_9.setCoincident(SketchLine_98.endPoint(), SketchArc_20.endPoint()) +SketchConstraintCoincidence_153 = Sketch_9.setCoincident( + SketchLine_98.endPoint(), SketchArc_20.endPoint() +) SketchConstraintCoincidence_153.setName("SketchConstraintCoincidence_157") SketchConstraintRadius_8 = Sketch_9.setRadius(SketchArc_20.results()[1], 5) SketchLine_101 = Sketch_9.addLine(1, 0, 1, 1.8) SketchLine_101.setName("SketchLine_103") SketchLine_101.result().setName("SketchLine_103") -SketchConstraintCoincidence_154 = Sketch_9.setCoincident(SketchLine_101.startPoint(), SketchLine_100.result()) +SketchConstraintCoincidence_154 = Sketch_9.setCoincident( + SketchLine_101.startPoint(), SketchLine_100.result() +) SketchConstraintCoincidence_154.setName("SketchConstraintCoincidence_158") SketchLine_102 = Sketch_9.addLine(1, 1.8, 8, 3.389761862250954) SketchLine_102.setName("SketchLine_104") SketchLine_102.result().setName("SketchLine_104") -SketchConstraintCoincidence_155 = Sketch_9.setCoincident(SketchLine_101.endPoint(), SketchLine_102.startPoint()) +SketchConstraintCoincidence_155 = Sketch_9.setCoincident( + SketchLine_101.endPoint(), SketchLine_102.startPoint() +) SketchConstraintCoincidence_155.setName("SketchConstraintCoincidence_159") SketchLine_103 = Sketch_9.addLine(8, 3.389761862250954, 8, 0) SketchLine_103.setName("SketchLine_105") SketchLine_103.result().setName("SketchLine_105") -SketchConstraintCoincidence_156 = Sketch_9.setCoincident(SketchLine_102.endPoint(), SketchLine_103.startPoint()) +SketchConstraintCoincidence_156 = Sketch_9.setCoincident( + SketchLine_102.endPoint(), SketchLine_103.startPoint() +) SketchConstraintCoincidence_156.setName("SketchConstraintCoincidence_160") SketchLine_104 = Sketch_9.addLine(8, 0, 1, 0) SketchLine_104.setName("SketchLine_106") SketchLine_104.result().setName("SketchLine_106") -SketchConstraintCoincidence_157 = Sketch_9.setCoincident(SketchLine_103.endPoint(), SketchLine_104.startPoint()) +SketchConstraintCoincidence_157 = Sketch_9.setCoincident( + SketchLine_103.endPoint(), SketchLine_104.startPoint() +) SketchConstraintCoincidence_157.setName("SketchConstraintCoincidence_161") -SketchConstraintCoincidence_158 = Sketch_9.setCoincident(SketchLine_101.startPoint(), SketchLine_104.endPoint()) +SketchConstraintCoincidence_158 = Sketch_9.setCoincident( + SketchLine_101.startPoint(), SketchLine_104.endPoint() +) SketchConstraintCoincidence_158.setName("SketchConstraintCoincidence_162") -SketchConstraintCoincidence_159 = Sketch_9.setCoincident(SketchLine_104.startPoint(), SketchLine_100.result()) +SketchConstraintCoincidence_159 = Sketch_9.setCoincident( + SketchLine_104.startPoint(), SketchLine_100.result() +) SketchConstraintCoincidence_159.setName("SketchConstraintCoincidence_163") SketchConstraintVertical_18 = Sketch_9.setVertical(SketchLine_103.result()) SketchConstraintVertical_19 = Sketch_9.setVertical(SketchLine_101.result()) SketchConstraintLength_16 = Sketch_9.setLength(SketchLine_104.result(), 7) SketchConstraintLength_16.setName("SketchConstraintLength_17") -SketchConstraintDistance_16 = Sketch_9.setDistance(SketchLine_101.result(), SketchLine_100.startPoint(), 1, False) +SketchConstraintDistance_16 = Sketch_9.setDistance( + SketchLine_101.result(), SketchLine_100.startPoint(), 1, False +) SketchConstraintLength_17 = Sketch_9.setLength(SketchLine_101.result(), 1.8) SketchConstraintLength_17.setName("SketchConstraintLength_18") -SketchArc_21 = Sketch_9.addArc(21.31772863153846, 4.163450069699051, 21.53774043054522, 4.392679848735523, 21, 4.163450069699051, False) -SketchArc_22 = Sketch_9.addArc(25, 8, 21.53774043054522, 4.392679848735523, 29, 5, False) +SketchArc_21 = Sketch_9.addArc( + 21.31772863153846, + 4.163450069699051, + 21.53774043054522, + 4.392679848735523, + 21, + 4.163450069699051, + False, +) +SketchArc_22 = Sketch_9.addArc( + 25, 8, 21.53774043054522, 4.392679848735523, 29, 5, False +) SketchArc_22.setName("SketchArc_20") SketchArc_22.result().setName("SketchArc_20") SketchArc_22.results()[1].setName("SketchArc_20_2") SketchArc_22.setAuxiliary(True) -SketchConstraintCoincidence_160 = Sketch_9.setCoincident(SketchArc_21.startPoint(), SketchArc_22.startPoint()) +SketchConstraintCoincidence_160 = Sketch_9.setCoincident( + SketchArc_21.startPoint(), SketchArc_22.startPoint() +) SketchConstraintCoincidence_160.setName("SketchConstraintCoincidence_164") -SketchConstraintCoincidence_161 = Sketch_9.setCoincident(SketchArc_21.endPoint(), SketchLine_94.startPoint()) +SketchConstraintCoincidence_161 = Sketch_9.setCoincident( + SketchArc_21.endPoint(), SketchLine_94.startPoint() +) SketchConstraintCoincidence_161.setName("SketchConstraintCoincidence_165") -SketchConstraintTangent_10 = Sketch_9.setTangent(SketchArc_21.results()[1], SketchLine_94.result()) -SketchConstraintTangent_11 = Sketch_9.setTangent(SketchArc_21.results()[1], SketchArc_22.results()[1]) -SketchConstraintCoincidence_162 = Sketch_9.setCoincident(SketchLine_99.endPoint(), SketchLine_94.endPoint()) +SketchConstraintTangent_10 = Sketch_9.setTangent( + SketchArc_21.results()[1], SketchLine_94.result() +) +SketchConstraintTangent_11 = Sketch_9.setTangent( + SketchArc_21.results()[1], SketchArc_22.results()[1] +) +SketchConstraintCoincidence_162 = Sketch_9.setCoincident( + SketchLine_99.endPoint(), SketchLine_94.endPoint() +) SketchConstraintCoincidence_162.setName("SketchConstraintCoincidence_166") -SketchConstraintCoincidence_163 = Sketch_9.setCoincident(SketchArc_20.endPoint(), SketchArc_22.endPoint()) +SketchConstraintCoincidence_163 = Sketch_9.setCoincident( + SketchArc_20.endPoint(), SketchArc_22.endPoint() +) SketchConstraintCoincidence_163.setName("SketchConstraintCoincidence_167") -SketchConstraintTangent_12 = Sketch_9.setTangent(SketchArc_20.results()[1], SketchArc_22.results()[1]) -SketchConstraintCoincidence_164 = Sketch_9.setCoincident(SketchLine_94.startPoint(), SketchLine_99.result()) +SketchConstraintTangent_12 = Sketch_9.setTangent( + SketchArc_20.results()[1], SketchArc_22.results()[1] +) +SketchConstraintCoincidence_164 = Sketch_9.setCoincident( + SketchLine_94.startPoint(), SketchLine_99.result() +) SketchConstraintCoincidence_164.setName("SketchConstraintCoincidence_168") -SketchConstraintCoincidence_165 = Sketch_9.setCoincident(SketchArc_22.startPoint(), SketchArc_20.results()[1]) +SketchConstraintCoincidence_165 = Sketch_9.setCoincident( + SketchArc_22.startPoint(), SketchArc_20.results()[1] +) SketchConstraintCoincidence_165.setName("SketchConstraintCoincidence_169") -SketchArc_23 = Sketch_9.addArc(28.68227136846154, 4.163450069699049, 29, 4.163450069699049, 28.46225956945478, 4.392679848735522, False) -SketchConstraintCoincidence_166 = Sketch_9.setCoincident(SketchArc_23.startPoint(), SketchLine_97.endPoint()) +SketchArc_23 = Sketch_9.addArc( + 28.68227136846154, + 4.163450069699049, + 29, + 4.163450069699049, + 28.46225956945478, + 4.392679848735522, + False, +) +SketchConstraintCoincidence_166 = Sketch_9.setCoincident( + SketchArc_23.startPoint(), SketchLine_97.endPoint() +) SketchConstraintCoincidence_166.setName("SketchConstraintCoincidence_170") -SketchConstraintCoincidence_167 = Sketch_9.setCoincident(SketchArc_23.endPoint(), SketchArc_19.endPoint()) +SketchConstraintCoincidence_167 = Sketch_9.setCoincident( + SketchArc_23.endPoint(), SketchArc_19.endPoint() +) SketchConstraintCoincidence_167.setName("SketchConstraintCoincidence_171") -SketchConstraintTangent_13 = Sketch_9.setTangent(SketchArc_23.results()[1], SketchArc_19.results()[1]) -SketchConstraintTangent_14 = Sketch_9.setTangent(SketchArc_23.results()[1], SketchLine_97.result()) -SketchConstraintCoincidence_168 = Sketch_9.setCoincident(SketchArc_22.startPoint(), SketchArc_19.startPoint()) +SketchConstraintTangent_13 = Sketch_9.setTangent( + SketchArc_23.results()[1], SketchArc_19.results()[1] +) +SketchConstraintTangent_14 = Sketch_9.setTangent( + SketchArc_23.results()[1], SketchLine_97.result() +) +SketchConstraintCoincidence_168 = Sketch_9.setCoincident( + SketchArc_22.startPoint(), SketchArc_19.startPoint() +) SketchConstraintCoincidence_168.setName("SketchConstraintCoincidence_172") -SketchConstraintCoincidence_169 = Sketch_9.setCoincident(SketchLine_98.startPoint(), SketchLine_97.startPoint()) +SketchConstraintCoincidence_169 = Sketch_9.setCoincident( + SketchLine_98.startPoint(), SketchLine_97.startPoint() +) SketchConstraintCoincidence_169.setName("SketchConstraintCoincidence_173") -SketchConstraintTangent_15 = Sketch_9.setTangent(SketchArc_22.results()[1], SketchArc_19.results()[1]) -SketchConstraintCoincidence_170 = Sketch_9.setCoincident(SketchArc_19.endPoint(), SketchArc_22.results()[1]) +SketchConstraintTangent_15 = Sketch_9.setTangent( + SketchArc_22.results()[1], SketchArc_19.results()[1] +) +SketchConstraintCoincidence_170 = Sketch_9.setCoincident( + SketchArc_19.endPoint(), SketchArc_22.results()[1] +) SketchConstraintCoincidence_170.setName("SketchConstraintCoincidence_174") -SketchConstraintCoincidence_171 = Sketch_9.setCoincident(SketchLine_97.endPoint(), SketchLine_98.result()) +SketchConstraintCoincidence_171 = Sketch_9.setCoincident( + SketchLine_97.endPoint(), SketchLine_98.result() +) SketchConstraintCoincidence_171.setName("SketchConstraintCoincidence_175") 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/Modified_Face&Sketch_1/SketchLine_1")) +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/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) @@ -940,74 +1676,113 @@ SketchLine_105.setName("SketchLine_109") SketchLine_105.result().setName("SketchLine_109") SketchConstraintRigid_13 = Sketch_10.setFixed(SketchLine_105.result()) SketchConstraintRigid_13.setName("SketchConstraintRigid_22") -SketchConstraintCoincidence_172 = Sketch_10.setCoincident(SketchPoint_24.coordinates(), SketchLine_105.result()) +SketchConstraintCoincidence_172 = Sketch_10.setCoincident( + SketchPoint_24.coordinates(), SketchLine_105.result() +) SketchConstraintCoincidence_172.setName("SketchConstraintCoincidence_176") -SketchConstraintMiddle_8 = Sketch_10.setMiddlePoint(SketchLine_105.result(), SketchPoint_24.coordinates()) +SketchConstraintMiddle_8 = Sketch_10.setMiddlePoint( + SketchLine_105.result(), SketchPoint_24.coordinates() +) SketchLine_106 = Sketch_10.addLine(0, 6, 17.31036191565843, 6) SketchLine_106.setName("SketchLine_110") SketchLine_106.result().setName("SketchLine_110") SketchLine_106.setAuxiliary(True) -SketchConstraintCoincidence_173 = Sketch_10.setCoincident(SketchPoint_24.coordinates(), SketchLine_106.startPoint()) +SketchConstraintCoincidence_173 = Sketch_10.setCoincident( + SketchPoint_24.coordinates(), SketchLine_106.startPoint() +) SketchConstraintCoincidence_173.setName("SketchConstraintCoincidence_177") SketchConstraintHorizontal_22 = Sketch_10.setHorizontal(SketchLine_106.result()) SketchConstraintHorizontal_22.setName("SketchConstraintHorizontal_23") -SketchConstraintCoincidence_174 = Sketch_10.setCoincident(SketchCircle_1.center(), SketchLine_106.result()) +SketchConstraintCoincidence_174 = Sketch_10.setCoincident( + SketchCircle_1.center(), SketchLine_106.result() +) SketchConstraintCoincidence_174.setName("SketchConstraintCoincidence_178") -SketchConstraintDistance_17 = Sketch_10.setDistance(SketchLine_105.result(), SketchCircle_1.center(), 12, False) +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/Face-SketchCircle_1_2r_wire")], 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() Sketch_11 = model.addSketch(Part_2_doc, model.defaultPlane("XOY")) SketchLine_107 = Sketch_11.addLine(0, 0, 60, 0) SketchPoint_25 = Sketch_11.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_175 = Sketch_11.setCoincident(SketchLine_107.startPoint(), SketchPoint_25.result()) +SketchConstraintCoincidence_175 = Sketch_11.setCoincident( + SketchLine_107.startPoint(), SketchPoint_25.result() +) SketchLine_108 = Sketch_11.addLine(60, 0, 60, 1.5) SketchLine_108.setName("SketchLine_3") SketchLine_108.result().setName("SketchLine_3") -SketchConstraintCoincidence_176 = Sketch_11.setCoincident(SketchLine_107.endPoint(), SketchLine_108.startPoint()) +SketchConstraintCoincidence_176 = Sketch_11.setCoincident( + SketchLine_107.endPoint(), SketchLine_108.startPoint() +) SketchConstraintCoincidence_176.setName("SketchConstraintCoincidence_3") SketchLine_109 = Sketch_11.addLine(60, 1.5, 57, 1.5) SketchLine_109.setName("SketchLine_4") SketchLine_109.result().setName("SketchLine_4") -SketchConstraintCoincidence_177 = Sketch_11.setCoincident(SketchLine_108.endPoint(), SketchLine_109.startPoint()) +SketchConstraintCoincidence_177 = Sketch_11.setCoincident( + SketchLine_108.endPoint(), SketchLine_109.startPoint() +) SketchConstraintCoincidence_177.setName("SketchConstraintCoincidence_4") SketchLine_110 = Sketch_11.addLine(57, 1.5, 29, 7.5) SketchLine_110.setName("SketchLine_5") SketchLine_110.result().setName("SketchLine_5") -SketchConstraintCoincidence_178 = Sketch_11.setCoincident(SketchLine_109.endPoint(), SketchLine_110.startPoint()) +SketchConstraintCoincidence_178 = Sketch_11.setCoincident( + SketchLine_109.endPoint(), SketchLine_110.startPoint() +) SketchConstraintCoincidence_178.setName("SketchConstraintCoincidence_5") SketchLine_111 = Sketch_11.addLine(28, 7.5, 28, 8) SketchLine_111.setName("SketchLine_7") SketchLine_111.result().setName("SketchLine_7") -SketchArc_24 = Sketch_11.addArc(25.00007393928819, 7.9789374678129, 28, 8, 22.00014787857639, 8, False) +SketchArc_24 = Sketch_11.addArc( + 25.00007393928819, 7.9789374678129, 28, 8, 22.00014787857639, 8, False +) SketchLine_112 = Sketch_11.addLine(22.00014787857639, 8, 22.00014787857639, 7.5) SketchLine_112.setName("SketchLine_8") SketchLine_112.result().setName("SketchLine_8") -SketchConstraintCoincidence_179 = Sketch_11.setCoincident(SketchArc_24.endPoint(), SketchLine_112.startPoint()) +SketchConstraintCoincidence_179 = Sketch_11.setCoincident( + SketchArc_24.endPoint(), SketchLine_112.startPoint() +) SketchConstraintCoincidence_179.setName("SketchConstraintCoincidence_8") SketchLine_113 = Sketch_11.addLine(22.00014787857639, 7.5, 21.00014787857639, 7.5) SketchLine_113.setName("SketchLine_9") SketchLine_113.result().setName("SketchLine_9") -SketchConstraintCoincidence_180 = Sketch_11.setCoincident(SketchLine_112.endPoint(), SketchLine_113.startPoint()) +SketchConstraintCoincidence_180 = Sketch_11.setCoincident( + SketchLine_112.endPoint(), SketchLine_113.startPoint() +) SketchConstraintCoincidence_180.setName("SketchConstraintCoincidence_9") SketchLine_114 = Sketch_11.addLine(0, 0, 0, 3.5) SketchLine_114.setName("SketchLine_10") SketchLine_114.result().setName("SketchLine_10") -SketchConstraintCoincidence_181 = Sketch_11.setCoincident(SketchLine_107.startPoint(), SketchLine_114.startPoint()) +SketchConstraintCoincidence_181 = Sketch_11.setCoincident( + SketchLine_107.startPoint(), SketchLine_114.startPoint() +) SketchConstraintCoincidence_181.setName("SketchConstraintCoincidence_10") -SketchConstraintCoincidence_182 = Sketch_11.setCoincident(SketchPoint_25.coordinates(), SketchLine_114.startPoint()) +SketchConstraintCoincidence_182 = Sketch_11.setCoincident( + SketchPoint_25.coordinates(), SketchLine_114.startPoint() +) SketchConstraintCoincidence_182.setName("SketchConstraintCoincidence_11") SketchLine_115 = Sketch_11.addLine(0, 3.5, 8, 5) SketchLine_115.setName("SketchLine_11") SketchLine_115.result().setName("SketchLine_11") -SketchConstraintCoincidence_183 = Sketch_11.setCoincident(SketchLine_114.endPoint(), SketchLine_115.startPoint()) +SketchConstraintCoincidence_183 = Sketch_11.setCoincident( + SketchLine_114.endPoint(), SketchLine_115.startPoint() +) SketchConstraintCoincidence_183.setName("SketchConstraintCoincidence_13") SketchLine_116 = Sketch_11.addLine(8, 5, 10.426976887961, 4.40018070612629) SketchLine_116.setName("SketchLine_12") SketchLine_116.result().setName("SketchLine_12") -SketchConstraintCoincidence_184 = Sketch_11.setCoincident(SketchLine_115.endPoint(), SketchLine_116.startPoint()) +SketchConstraintCoincidence_184 = Sketch_11.setCoincident( + SketchLine_115.endPoint(), SketchLine_116.startPoint() +) SketchConstraintCoincidence_184.setName("SketchConstraintCoincidence_14") SketchConstraintLength_18 = Sketch_11.setLength(SketchLine_107.result(), 60) SketchConstraintHorizontal_23 = Sketch_11.setHorizontal(SketchLine_107.result()) @@ -1017,120 +1792,231 @@ SketchConstraintHorizontal_25 = Sketch_11.setHorizontal(SketchLine_113.result()) SketchConstraintHorizontal_25.setName("SketchConstraintHorizontal_4") SketchConstraintVertical_21 = Sketch_11.setVertical(SketchLine_111.result()) SketchConstraintVertical_22 = Sketch_11.setVertical(SketchLine_112.result()) -SketchConstraintCoincidence_185 = Sketch_11.setCoincident(SketchLine_111.endPoint(), SketchArc_24.startPoint()) +SketchConstraintCoincidence_185 = Sketch_11.setCoincident( + SketchLine_111.endPoint(), SketchArc_24.startPoint() +) SketchConstraintCoincidence_185.setName("SketchConstraintCoincidence_15") SketchConstraintVertical_23 = Sketch_11.setVertical(SketchLine_114.result()) -SketchConstraintDistance_18 = Sketch_11.setDistance(SketchLine_114.endPoint(), SketchLine_107.result(), 3.5, False) -SketchConstraintDistance_19 = Sketch_11.setDistance(SketchLine_115.endPoint(), SketchLine_114.result(), 8, False) +SketchConstraintDistance_18 = Sketch_11.setDistance( + SketchLine_114.endPoint(), SketchLine_107.result(), 3.5, False +) +SketchConstraintDistance_19 = Sketch_11.setDistance( + SketchLine_115.endPoint(), SketchLine_114.result(), 8, False +) SketchConstraintLength_19 = Sketch_11.setLength(SketchLine_116.result(), 2.5) SketchConstraintRadius_10 = Sketch_11.setRadius(SketchArc_24.results()[1], 3) SketchConstraintLength_20 = Sketch_11.setLength(SketchLine_112.result(), 0.5) SketchConstraintLength_21 = Sketch_11.setLength(SketchLine_113.result(), 1) SketchConstraintLength_22 = Sketch_11.setLength(SketchLine_111.result(), 0.5) -SketchConstraintDistance_20 = Sketch_11.setDistance(SketchLine_112.endPoint(), SketchLine_107.result(), 7.5, False) +SketchConstraintDistance_20 = Sketch_11.setDistance( + SketchLine_112.endPoint(), SketchLine_107.result(), 7.5, False +) SketchConstraintLength_23 = Sketch_11.setLength(SketchLine_109.result(), 3) SketchConstraintLength_23.setName("SketchConstraintLength_7") SketchConstraintLength_24 = Sketch_11.setLength(SketchLine_108.result(), 1.5) SketchConstraintLength_24.setName("SketchConstraintLength_8") -SketchConstraintDistance_21 = Sketch_11.setDistance(SketchLine_115.endPoint(), SketchLine_107.result(), 5, False) -SketchConstraintDistance_22 = Sketch_11.setDistance(SketchLine_111.startPoint(), SketchLine_107.result(), 7.5, False) -SketchLine_117 = Sketch_11.addLine(12.81710695710752, 0, 12.81710695710752, 7.765286531476907) +SketchConstraintDistance_21 = Sketch_11.setDistance( + SketchLine_115.endPoint(), SketchLine_107.result(), 5, False +) +SketchConstraintDistance_22 = Sketch_11.setDistance( + SketchLine_111.startPoint(), SketchLine_107.result(), 7.5, False +) +SketchLine_117 = Sketch_11.addLine( + 12.81710695710752, 0, 12.81710695710752, 7.765286531476907 +) SketchLine_117.setName("SketchLine_13") SketchLine_117.result().setName("SketchLine_13") SketchLine_117.setAuxiliary(True) -SketchConstraintCoincidence_186 = Sketch_11.setCoincident(SketchLine_117.startPoint(), SketchLine_107.result()) +SketchConstraintCoincidence_186 = Sketch_11.setCoincident( + SketchLine_117.startPoint(), SketchLine_107.result() +) SketchConstraintCoincidence_186.setName("SketchConstraintCoincidence_16") SketchConstraintVertical_24 = Sketch_11.setVertical(SketchLine_117.result()) SketchPoint_26 = Sketch_11.addPoint(12.81710695710752, 3) SketchPoint_26.setAuxiliary(True) -SketchConstraintCoincidence_187 = Sketch_11.setCoincident(SketchPoint_26.coordinates(), SketchLine_117.result()) +SketchConstraintCoincidence_187 = Sketch_11.setCoincident( + SketchPoint_26.coordinates(), SketchLine_117.result() +) SketchConstraintCoincidence_187.setName("SketchConstraintCoincidence_17") -SketchConstraintDistance_23 = Sketch_11.setDistance(SketchPoint_26.coordinates(), SketchLine_107.result(), 3, False) +SketchConstraintDistance_23 = Sketch_11.setDistance( + SketchPoint_26.coordinates(), SketchLine_107.result(), 3, False +) SketchLine_118 = Sketch_11.addLine(28, 7.5, 29, 7.5) SketchLine_118.setName("SketchLine_14") SketchLine_118.result().setName("SketchLine_14") -SketchConstraintCoincidence_188 = Sketch_11.setCoincident(SketchLine_111.startPoint(), SketchLine_118.startPoint()) +SketchConstraintCoincidence_188 = Sketch_11.setCoincident( + SketchLine_111.startPoint(), SketchLine_118.startPoint() +) SketchConstraintCoincidence_188.setName("SketchConstraintCoincidence_18") -SketchConstraintCoincidence_189 = Sketch_11.setCoincident(SketchLine_110.endPoint(), SketchLine_118.endPoint()) +SketchConstraintCoincidence_189 = Sketch_11.setCoincident( + SketchLine_110.endPoint(), SketchLine_118.endPoint() +) SketchConstraintCoincidence_189.setName("SketchConstraintCoincidence_19") SketchConstraintLength_25 = Sketch_11.setLength(SketchLine_118.result(), 1) SketchConstraintLength_25.setName("SketchConstraintLength_9") -SketchArc_25 = Sketch_11.addArc(14.78851987160339, 9.105317068618911, 10.426976887961, 4.40018070612629, 21.00014787857639, 7.5, False) -SketchConstraintCoincidence_190 = Sketch_11.setCoincident(SketchLine_116.endPoint(), SketchArc_25.startPoint()) +SketchArc_25 = Sketch_11.addArc( + 14.78851987160339, + 9.105317068618911, + 10.426976887961, + 4.40018070612629, + 21.00014787857639, + 7.5, + False, +) +SketchConstraintCoincidence_190 = Sketch_11.setCoincident( + SketchLine_116.endPoint(), SketchArc_25.startPoint() +) SketchConstraintCoincidence_190.setName("SketchConstraintCoincidence_20") -SketchConstraintCoincidence_191 = Sketch_11.setCoincident(SketchLine_113.endPoint(), SketchArc_25.endPoint()) +SketchConstraintCoincidence_191 = Sketch_11.setCoincident( + SketchLine_113.endPoint(), SketchArc_25.endPoint() +) SketchConstraintCoincidence_191.setName("SketchConstraintCoincidence_21") -SketchConstraintCoincidence_192 = Sketch_11.setCoincident(SketchPoint_26.coordinates(), SketchArc_25.results()[1]) +SketchConstraintCoincidence_192 = Sketch_11.setCoincident( + SketchPoint_26.coordinates(), SketchArc_25.results()[1] +) SketchConstraintCoincidence_192.setName("SketchConstraintCoincidence_22") SketchConstraintHorizontal_26 = Sketch_11.setHorizontal(SketchLine_118.result()) SketchConstraintHorizontal_26.setName("SketchConstraintHorizontal_9") -SketchConstraintDistance_24 = Sketch_11.setDistance(SketchLine_111.startPoint(), SketchLine_108.result(), 32, False) +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/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) +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&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]")) +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 = Sketch_12.setCoincident( + SketchArc_26.startPoint(), SketchLine_119.result() +) SketchConstraintCoincidence_193.setName("SketchConstraintCoincidence_23") 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 = 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&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]")) +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()) -SketchConstraintDistance_25 = Sketch_12.setDistance(SketchArc_26.startPoint(), SketchLine_121.result(), 6, False) +SketchConstraintTangent_16 = Sketch_12.setTangent( + SketchArc_26.results()[1], SketchLine_121.result() +) +SketchConstraintDistance_25 = Sketch_12.setDistance( + SketchArc_26.startPoint(), SketchLine_121.result(), 6, False +) SketchConstraintDistance_25.setName("SketchConstraintDistance_7") SketchLine_122 = Sketch_12.addLine(54, 12, 53.10174978726379, 13.92603605930655) SketchLine_122.setName("SketchLine_18") SketchLine_122.result().setName("SketchLine_18") -SketchConstraintCoincidence_195 = Sketch_12.setCoincident(SketchArc_26.startPoint(), SketchLine_122.startPoint()) +SketchConstraintCoincidence_195 = Sketch_12.setCoincident( + SketchArc_26.startPoint(), SketchLine_122.startPoint() +) SketchConstraintCoincidence_195.setName("SketchConstraintCoincidence_25") -SketchLine_123 = Sketch_12.addLine(53.10174978726379, 13.92603605930655, 63.82610057919769, 13.82486293862793) +SketchLine_123 = Sketch_12.addLine( + 53.10174978726379, 13.92603605930655, 63.82610057919769, 13.82486293862793 +) SketchLine_123.setName("SketchLine_19") SketchLine_123.result().setName("SketchLine_19") -SketchConstraintCoincidence_196 = Sketch_12.setCoincident(SketchLine_122.endPoint(), SketchLine_123.startPoint()) +SketchConstraintCoincidence_196 = Sketch_12.setCoincident( + SketchLine_122.endPoint(), SketchLine_123.startPoint() +) SketchConstraintCoincidence_196.setName("SketchConstraintCoincidence_26") -SketchLine_124 = Sketch_12.addLine(63.82610057919769, 13.82486293862793, 62.66260969139353, -3.07104821470189) +SketchLine_124 = Sketch_12.addLine( + 63.82610057919769, 13.82486293862793, 62.66260969139353, -3.07104821470189 +) SketchLine_124.setName("SketchLine_20") SketchLine_124.result().setName("SketchLine_20") -SketchConstraintCoincidence_197 = Sketch_12.setCoincident(SketchLine_123.endPoint(), SketchLine_124.startPoint()) +SketchConstraintCoincidence_197 = Sketch_12.setCoincident( + SketchLine_123.endPoint(), SketchLine_124.startPoint() +) SketchConstraintCoincidence_197.setName("SketchConstraintCoincidence_27") -SketchLine_125 = Sketch_12.addLine(62.66260969139353, -3.07104821470189, 53.10174978726379, -2.868701973344648) +SketchLine_125 = Sketch_12.addLine( + 62.66260969139353, -3.07104821470189, 53.10174978726379, -2.868701973344648 +) SketchLine_125.setName("SketchLine_21") SketchLine_125.result().setName("SketchLine_21") -SketchConstraintCoincidence_198 = Sketch_12.setCoincident(SketchLine_124.endPoint(), SketchLine_125.startPoint()) +SketchConstraintCoincidence_198 = Sketch_12.setCoincident( + SketchLine_124.endPoint(), SketchLine_125.startPoint() +) SketchConstraintCoincidence_198.setName("SketchConstraintCoincidence_28") SketchLine_126 = Sketch_12.addLine(53.10174978726379, -2.868701973344648, 54, 0) SketchLine_126.setName("SketchLine_22") SketchLine_126.result().setName("SketchLine_22") -SketchConstraintCoincidence_199 = Sketch_12.setCoincident(SketchLine_125.endPoint(), SketchLine_126.startPoint()) +SketchConstraintCoincidence_199 = Sketch_12.setCoincident( + SketchLine_125.endPoint(), SketchLine_126.startPoint() +) SketchConstraintCoincidence_199.setName("SketchConstraintCoincidence_29") -SketchConstraintCoincidence_200 = Sketch_12.setCoincident(SketchArc_26.endPoint(), SketchLine_126.endPoint()) +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-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")) +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&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14]")) +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()) +SketchConstraintCoincidence_201 = Sketch_13.setCoincident( + SketchLine_127.startPoint(), SketchLine_128.result() +) SketchConstraintCoincidence_201.setName("SketchConstraintCoincidence_31") SketchConstraintHorizontal_27 = Sketch_13.setHorizontal(SketchLine_127.result()) SketchLine_129 = Sketch_13.addLine(28, -6, 63.78468475453244, -6) SketchLine_129.setName("SketchLine_25") SketchLine_129.result().setName("SketchLine_25") SketchLine_129.setAuxiliary(True) -SketchConstraintCoincidence_202 = Sketch_13.setCoincident(SketchLine_127.startPoint(), SketchLine_129.startPoint()) +SketchConstraintCoincidence_202 = Sketch_13.setCoincident( + SketchLine_127.startPoint(), SketchLine_129.startPoint() +) SketchConstraintCoincidence_202.setName("SketchConstraintCoincidence_32") SketchConstraintHorizontal_28 = Sketch_13.setHorizontal(SketchLine_129.result()) SketchLine_130 = Sketch_13.addLine(60, -1.5, 29, -1.5) @@ -1145,13 +2031,21 @@ SketchLine_132.result().setName("SketchLine_28") SketchLine_133 = Sketch_13.addLine(60, -10.5, 60, -1.5) SketchLine_133.setName("SketchLine_29") SketchLine_133.result().setName("SketchLine_29") -SketchConstraintCoincidence_203 = Sketch_13.setCoincident(SketchLine_133.endPoint(), SketchLine_130.startPoint()) +SketchConstraintCoincidence_203 = Sketch_13.setCoincident( + SketchLine_133.endPoint(), SketchLine_130.startPoint() +) SketchConstraintCoincidence_203.setName("SketchConstraintCoincidence_33") -SketchConstraintCoincidence_204 = Sketch_13.setCoincident(SketchLine_130.endPoint(), SketchLine_131.startPoint()) +SketchConstraintCoincidence_204 = Sketch_13.setCoincident( + SketchLine_130.endPoint(), SketchLine_131.startPoint() +) SketchConstraintCoincidence_204.setName("SketchConstraintCoincidence_34") -SketchConstraintCoincidence_205 = Sketch_13.setCoincident(SketchLine_131.endPoint(), SketchLine_132.startPoint()) +SketchConstraintCoincidence_205 = Sketch_13.setCoincident( + SketchLine_131.endPoint(), SketchLine_132.startPoint() +) SketchConstraintCoincidence_205.setName("SketchConstraintCoincidence_35") -SketchConstraintCoincidence_206 = Sketch_13.setCoincident(SketchLine_132.endPoint(), SketchLine_133.startPoint()) +SketchConstraintCoincidence_206 = Sketch_13.setCoincident( + SketchLine_132.endPoint(), SketchLine_133.startPoint() +) SketchConstraintCoincidence_206.setName("SketchConstraintCoincidence_36") SketchConstraintHorizontal_29 = Sketch_13.setHorizontal(SketchLine_130.result()) SketchConstraintVertical_25 = Sketch_13.setVertical(SketchLine_131.result()) @@ -1161,56 +2055,96 @@ SketchLine_134 = Sketch_13.addLine(29, -10.5, 60, -1.5) SketchLine_134.setName("SketchLine_30") SketchLine_134.result().setName("SketchLine_30") SketchLine_134.setAuxiliary(True) -SketchConstraintCoincidence_207 = Sketch_13.setCoincident(SketchLine_131.endPoint(), SketchLine_134.startPoint()) +SketchConstraintCoincidence_207 = Sketch_13.setCoincident( + SketchLine_131.endPoint(), SketchLine_134.startPoint() +) SketchConstraintCoincidence_207.setName("SketchConstraintCoincidence_37") -SketchConstraintCoincidence_208 = Sketch_13.setCoincident(SketchLine_132.startPoint(), SketchLine_134.startPoint()) +SketchConstraintCoincidence_208 = Sketch_13.setCoincident( + SketchLine_132.startPoint(), SketchLine_134.startPoint() +) SketchConstraintCoincidence_208.setName("SketchConstraintCoincidence_38") -SketchConstraintCoincidence_209 = Sketch_13.setCoincident(SketchLine_130.startPoint(), SketchLine_134.endPoint()) +SketchConstraintCoincidence_209 = Sketch_13.setCoincident( + SketchLine_130.startPoint(), SketchLine_134.endPoint() +) SketchConstraintCoincidence_209.setName("SketchConstraintCoincidence_39") -SketchConstraintCoincidence_210 = Sketch_13.setCoincident(SketchLine_133.endPoint(), SketchLine_134.endPoint()) +SketchConstraintCoincidence_210 = Sketch_13.setCoincident( + SketchLine_133.endPoint(), SketchLine_134.endPoint() +) SketchConstraintCoincidence_210.setName("SketchConstraintCoincidence_40") SketchLine_135 = Sketch_13.addLine(29, -1.5, 60, -10.5) SketchLine_135.setName("SketchLine_31") SketchLine_135.result().setName("SketchLine_31") SketchLine_135.setAuxiliary(True) -SketchConstraintCoincidence_211 = Sketch_13.setCoincident(SketchLine_130.endPoint(), SketchLine_135.startPoint()) +SketchConstraintCoincidence_211 = Sketch_13.setCoincident( + SketchLine_130.endPoint(), SketchLine_135.startPoint() +) SketchConstraintCoincidence_211.setName("SketchConstraintCoincidence_41") -SketchConstraintCoincidence_212 = Sketch_13.setCoincident(SketchLine_131.startPoint(), SketchLine_135.startPoint()) +SketchConstraintCoincidence_212 = Sketch_13.setCoincident( + SketchLine_131.startPoint(), SketchLine_135.startPoint() +) SketchConstraintCoincidence_212.setName("SketchConstraintCoincidence_42") -SketchConstraintCoincidence_213 = Sketch_13.setCoincident(SketchLine_132.endPoint(), SketchLine_135.endPoint()) +SketchConstraintCoincidence_213 = Sketch_13.setCoincident( + SketchLine_132.endPoint(), SketchLine_135.endPoint() +) SketchConstraintCoincidence_213.setName("SketchConstraintCoincidence_43") -SketchConstraintCoincidence_214 = Sketch_13.setCoincident(SketchLine_133.startPoint(), SketchLine_135.endPoint()) +SketchConstraintCoincidence_214 = Sketch_13.setCoincident( + SketchLine_133.startPoint(), SketchLine_135.endPoint() +) SketchConstraintCoincidence_214.setName("SketchConstraintCoincidence_44") SketchPoint_27 = Sketch_13.addPoint(44.5, -6) SketchPoint_27.setAuxiliary(True) -SketchConstraintCoincidence_215 = Sketch_13.setCoincident(SketchPoint_27.coordinates(), SketchLine_135.result()) +SketchConstraintCoincidence_215 = Sketch_13.setCoincident( + SketchPoint_27.coordinates(), SketchLine_135.result() +) SketchConstraintCoincidence_215.setName("SketchConstraintCoincidence_45") -SketchConstraintMiddle_9 = Sketch_13.setMiddlePoint(SketchPoint_27.coordinates(), SketchLine_135.result()) -SketchConstraintCoincidence_216 = Sketch_13.setCoincident(SketchPoint_27.coordinates(), SketchLine_129.result()) +SketchConstraintMiddle_9 = Sketch_13.setMiddlePoint( + SketchPoint_27.coordinates(), SketchLine_135.result() +) +SketchConstraintCoincidence_216 = Sketch_13.setCoincident( + SketchPoint_27.coordinates(), SketchLine_129.result() +) SketchConstraintCoincidence_216.setName("SketchConstraintCoincidence_46") -SketchConstraintDistance_26 = Sketch_13.setDistance(SketchLine_128.startPoint(), SketchLine_129.result(), 6, False) +SketchConstraintDistance_26 = Sketch_13.setDistance( + SketchLine_128.startPoint(), SketchLine_129.result(), 6, False +) SketchConstraintDistance_26.setName("SketchConstraintDistance_8") SketchConstraintLength_26 = Sketch_13.setLength(SketchLine_133.result(), 9) SketchConstraintLength_26.setName("SketchConstraintLength_10") -SketchLine_136 = Sketch_13.addLine(21.00014787857639, -1.499999999999981, 12.00014787857639, -1.499999999999981) +SketchLine_136 = Sketch_13.addLine( + 21.00014787857639, -1.499999999999981, 12.00014787857639, -1.499999999999981 +) SketchLine_136.setName("SketchLine_32") SketchLine_136.result().setName("SketchLine_32") -SketchLine_137 = Sketch_13.addLine(12.00014787857639, -1.499999999999981, 12.00014787857639, -10.49999999999998) +SketchLine_137 = Sketch_13.addLine( + 12.00014787857639, -1.499999999999981, 12.00014787857639, -10.49999999999998 +) SketchLine_137.setName("SketchLine_33") SketchLine_137.result().setName("SketchLine_33") -SketchLine_138 = Sketch_13.addLine(12.00014787857639, -10.49999999999998, 21.00014787857639, -10.49999999999998) +SketchLine_138 = Sketch_13.addLine( + 12.00014787857639, -10.49999999999998, 21.00014787857639, -10.49999999999998 +) SketchLine_138.setName("SketchLine_34") SketchLine_138.result().setName("SketchLine_34") -SketchLine_139 = Sketch_13.addLine(21.00014787857639, -10.49999999999998, 21.00014787857639, -1.499999999999981) +SketchLine_139 = Sketch_13.addLine( + 21.00014787857639, -10.49999999999998, 21.00014787857639, -1.499999999999981 +) SketchLine_139.setName("SketchLine_35") SketchLine_139.result().setName("SketchLine_35") -SketchConstraintCoincidence_217 = Sketch_13.setCoincident(SketchLine_139.endPoint(), SketchLine_136.startPoint()) +SketchConstraintCoincidence_217 = Sketch_13.setCoincident( + SketchLine_139.endPoint(), SketchLine_136.startPoint() +) SketchConstraintCoincidence_217.setName("SketchConstraintCoincidence_47") -SketchConstraintCoincidence_218 = Sketch_13.setCoincident(SketchLine_136.endPoint(), SketchLine_137.startPoint()) +SketchConstraintCoincidence_218 = Sketch_13.setCoincident( + SketchLine_136.endPoint(), SketchLine_137.startPoint() +) SketchConstraintCoincidence_218.setName("SketchConstraintCoincidence_48") -SketchConstraintCoincidence_219 = Sketch_13.setCoincident(SketchLine_137.endPoint(), SketchLine_138.startPoint()) +SketchConstraintCoincidence_219 = Sketch_13.setCoincident( + SketchLine_137.endPoint(), SketchLine_138.startPoint() +) SketchConstraintCoincidence_219.setName("SketchConstraintCoincidence_49") -SketchConstraintCoincidence_220 = Sketch_13.setCoincident(SketchLine_138.endPoint(), SketchLine_139.startPoint()) +SketchConstraintCoincidence_220 = Sketch_13.setCoincident( + SketchLine_138.endPoint(), SketchLine_139.startPoint() +) SketchConstraintCoincidence_220.setName("SketchConstraintCoincidence_50") SketchConstraintHorizontal_31 = Sketch_13.setHorizontal(SketchLine_136.result()) SketchConstraintHorizontal_31.setName("SketchConstraintHorizontal_10") @@ -1218,72 +2152,174 @@ SketchConstraintVertical_27 = Sketch_13.setVertical(SketchLine_137.result()) SketchConstraintHorizontal_32 = Sketch_13.setHorizontal(SketchLine_138.result()) SketchConstraintHorizontal_32.setName("SketchConstraintHorizontal_11") SketchConstraintVertical_28 = Sketch_13.setVertical(SketchLine_139.result()) -SketchConstraintEqual_4 = Sketch_13.setEqual(SketchLine_131.result(), SketchLine_139.result()) -SketchLine_140 = Sketch_13.addLine(12.00014787857639, -10.49999999999998, 21.00014787857639, -1.499999999999981) +SketchConstraintEqual_4 = Sketch_13.setEqual( + SketchLine_131.result(), SketchLine_139.result() +) +SketchLine_140 = Sketch_13.addLine( + 12.00014787857639, -10.49999999999998, 21.00014787857639, -1.499999999999981 +) SketchLine_140.setName("SketchLine_36") SketchLine_140.result().setName("SketchLine_36") SketchLine_140.setAuxiliary(True) -SketchConstraintCoincidence_221 = Sketch_13.setCoincident(SketchLine_137.endPoint(), SketchLine_140.startPoint()) +SketchConstraintCoincidence_221 = Sketch_13.setCoincident( + SketchLine_137.endPoint(), SketchLine_140.startPoint() +) SketchConstraintCoincidence_221.setName("SketchConstraintCoincidence_51") -SketchConstraintCoincidence_222 = Sketch_13.setCoincident(SketchLine_138.startPoint(), SketchLine_140.startPoint()) +SketchConstraintCoincidence_222 = Sketch_13.setCoincident( + SketchLine_138.startPoint(), SketchLine_140.startPoint() +) SketchConstraintCoincidence_222.setName("SketchConstraintCoincidence_52") -SketchConstraintCoincidence_223 = Sketch_13.setCoincident(SketchLine_136.startPoint(), SketchLine_140.endPoint()) +SketchConstraintCoincidence_223 = Sketch_13.setCoincident( + SketchLine_136.startPoint(), SketchLine_140.endPoint() +) SketchConstraintCoincidence_223.setName("SketchConstraintCoincidence_53") -SketchConstraintCoincidence_224 = Sketch_13.setCoincident(SketchLine_139.endPoint(), SketchLine_140.endPoint()) +SketchConstraintCoincidence_224 = Sketch_13.setCoincident( + SketchLine_139.endPoint(), SketchLine_140.endPoint() +) SketchConstraintCoincidence_224.setName("SketchConstraintCoincidence_54") SketchPoint_28 = Sketch_13.addPoint(16.50014787857639, -6) SketchPoint_28.setAuxiliary(True) -SketchConstraintCoincidence_225 = Sketch_13.setCoincident(SketchPoint_28.coordinates(), SketchLine_140.result()) +SketchConstraintCoincidence_225 = Sketch_13.setCoincident( + SketchPoint_28.coordinates(), SketchLine_140.result() +) 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()) +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&Sketch_1/SketchLine_14][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_5]")) +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 = 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&Sketch_1/SketchArc_2_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9]")) +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 = 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()) +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/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) +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/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_11]")) +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()) +SketchConstraintCoincidence_229 = Sketch_14.setCoincident( + SketchLine_143.startPoint(), SketchLine_144.result() +) SketchConstraintCoincidence_229.setName("SketchConstraintCoincidence_59") -SketchLine_145 = Sketch_14.addLine(1.55585595716119, 2.812450190483599, 2.324492722099671, 3.935842385393688) +SketchLine_145 = Sketch_14.addLine( + 1.55585595716119, 2.812450190483599, 2.324492722099671, 3.935842385393688 +) SketchLine_145.setName("SketchLine_41") SketchLine_145.result().setName("SketchLine_41") -SketchConstraintCoincidence_230 = Sketch_14.setCoincident(SketchLine_143.endPoint(), SketchLine_145.startPoint()) +SketchConstraintCoincidence_230 = Sketch_14.setCoincident( + SketchLine_143.endPoint(), SketchLine_145.startPoint() +) SketchConstraintCoincidence_230.setName("SketchConstraintCoincidence_60") -SketchConstraintCoincidence_231 = Sketch_14.setCoincident(SketchLine_145.endPoint(), SketchLine_144.result()) +SketchConstraintCoincidence_231 = Sketch_14.setCoincident( + SketchLine_145.endPoint(), SketchLine_144.result() +) SketchConstraintCoincidence_231.setName("SketchConstraintCoincidence_61") -SketchLine_146 = Sketch_14.addLine(2.324492722099671, 3.935842385393688, 0.4324637622511017, 3.581086955422081) +SketchLine_146 = Sketch_14.addLine( + 2.324492722099671, 3.935842385393688, 0.4324637622511017, 3.581086955422081 +) SketchLine_146.setName("SketchLine_42") SketchLine_146.result().setName("SketchLine_42") -SketchConstraintCoincidence_232 = Sketch_14.setCoincident(SketchLine_145.endPoint(), SketchLine_146.startPoint()) +SketchConstraintCoincidence_232 = Sketch_14.setCoincident( + SketchLine_145.endPoint(), SketchLine_146.startPoint() +) SketchConstraintCoincidence_232.setName("SketchConstraintCoincidence_62") -SketchConstraintCoincidence_233 = Sketch_14.setCoincident(SketchLine_143.startPoint(), SketchLine_146.endPoint()) +SketchConstraintCoincidence_233 = Sketch_14.setCoincident( + SketchLine_143.startPoint(), SketchLine_146.endPoint() +) SketchConstraintCoincidence_233.setName("SketchConstraintCoincidence_63") SketchConstraintLength_28 = Sketch_14.setLength(SketchLine_146.result(), 1.925) SketchConstraintLength_28.setName("SketchConstraintLength_12") -SketchConstraintEqual_6 = Sketch_14.setEqual(SketchLine_143.result(), SketchLine_145.result()) -SketchConstraintPerpendicular_2 = Sketch_14.setPerpendicular(SketchLine_143.result(), SketchLine_145.result()) -SketchConstraintDistance_27 = Sketch_14.setDistance(SketchLine_144.startPoint(), SketchLine_143.startPoint(), 0.44, False) -SketchMultiTranslation_3_objects = [SketchLine_143.result(), SketchLine_146.result(), SketchLine_145.result()] -SketchMultiTranslation_3 = Sketch_14.addTranslation(SketchMultiTranslation_3_objects, SketchLine_146.startPoint(), SketchLine_144.endPoint(), 4, True) -[SketchLine_147, SketchLine_148, SketchLine_149, SketchLine_150, SketchLine_151, SketchLine_152, SketchLine_153, SketchLine_154, SketchLine_155] = SketchMultiTranslation_3.translated() +SketchConstraintEqual_6 = Sketch_14.setEqual( + SketchLine_143.result(), SketchLine_145.result() +) +SketchConstraintPerpendicular_2 = Sketch_14.setPerpendicular( + SketchLine_143.result(), SketchLine_145.result() +) +SketchConstraintDistance_27 = Sketch_14.setDistance( + SketchLine_144.startPoint(), SketchLine_143.startPoint(), 0.44, False +) +SketchMultiTranslation_3_objects = [ + SketchLine_143.result(), + SketchLine_146.result(), + SketchLine_145.result(), +] +SketchMultiTranslation_3 = Sketch_14.addTranslation( + SketchMultiTranslation_3_objects, + SketchLine_146.startPoint(), + SketchLine_144.endPoint(), + 4, + True, +) +[ + SketchLine_147, + SketchLine_148, + SketchLine_149, + SketchLine_150, + SketchLine_151, + SketchLine_152, + SketchLine_153, + SketchLine_154, + SketchLine_155, +] = SketchMultiTranslation_3.translated() SketchLine_155.setName("SketchLine_51") SketchLine_155.result().setName("SketchLine_51") SketchLine_154.setName("SketchLine_50") @@ -1303,84 +2339,196 @@ 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/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]")) +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) SketchConstraintRigid_14 = Sketch_15.setFixed(SketchPoint_29.result()) SketchConstraintRigid_14.setName("SketchConstraintRigid_10") -SketchConstraintCoincidence_234 = Sketch_15.setCoincident(SketchArc_27.startPoint(), SketchPoint_29.result()) +SketchConstraintCoincidence_234 = Sketch_15.setCoincident( + SketchArc_27.startPoint(), SketchPoint_29.result() +) SketchConstraintCoincidence_234.setName("SketchConstraintCoincidence_64") SketchPoint_30 = Sketch_15.addPoint(28, -7.5) SketchConstraintRigid_15 = Sketch_15.setFixed(SketchPoint_30.result()) SketchConstraintRigid_15.setName("SketchConstraintRigid_11") -SketchConstraintCoincidence_235 = Sketch_15.setCoincident(SketchArc_27.endPoint(), SketchPoint_30.result()) +SketchConstraintCoincidence_235 = Sketch_15.setCoincident( + SketchArc_27.endPoint(), SketchPoint_30.result() +) SketchConstraintCoincidence_235.setName("SketchConstraintCoincidence_65") SketchConstraintRadius_11 = Sketch_15.setRadius(SketchArc_27.results()[1], 3) SketchLine_156 = Sketch_15.addLine(22, -7.5, 22, -11.56094005408083) SketchLine_156.setName("SketchLine_52") SketchLine_156.result().setName("SketchLine_52") -SketchConstraintCoincidence_236 = Sketch_15.setCoincident(SketchArc_27.startPoint(), SketchLine_156.startPoint()) +SketchConstraintCoincidence_236 = Sketch_15.setCoincident( + SketchArc_27.startPoint(), SketchLine_156.startPoint() +) SketchConstraintCoincidence_236.setName("SketchConstraintCoincidence_66") -SketchConstraintCoincidence_237 = Sketch_15.setCoincident(SketchPoint_29.coordinates(), SketchLine_156.startPoint()) +SketchConstraintCoincidence_237 = Sketch_15.setCoincident( + SketchPoint_29.coordinates(), SketchLine_156.startPoint() +) SketchConstraintCoincidence_237.setName("SketchConstraintCoincidence_67") SketchLine_157 = Sketch_15.addLine(22, -11.56094005408083, 28, -11.56094005408083) SketchLine_157.setName("SketchLine_53") SketchLine_157.result().setName("SketchLine_53") -SketchConstraintCoincidence_238 = Sketch_15.setCoincident(SketchLine_156.endPoint(), SketchLine_157.startPoint()) +SketchConstraintCoincidence_238 = Sketch_15.setCoincident( + SketchLine_156.endPoint(), SketchLine_157.startPoint() +) SketchConstraintCoincidence_238.setName("SketchConstraintCoincidence_68") SketchLine_158 = Sketch_15.addLine(28, -11.56094005408083, 28, -7.5) SketchLine_158.setName("SketchLine_54") SketchLine_158.result().setName("SketchLine_54") -SketchConstraintCoincidence_239 = Sketch_15.setCoincident(SketchLine_157.endPoint(), SketchLine_158.startPoint()) +SketchConstraintCoincidence_239 = Sketch_15.setCoincident( + SketchLine_157.endPoint(), SketchLine_158.startPoint() +) SketchConstraintCoincidence_239.setName("SketchConstraintCoincidence_69") -SketchConstraintCoincidence_240 = Sketch_15.setCoincident(SketchArc_27.endPoint(), SketchLine_158.endPoint()) +SketchConstraintCoincidence_240 = Sketch_15.setCoincident( + SketchArc_27.endPoint(), SketchLine_158.endPoint() +) SketchConstraintCoincidence_240.setName("SketchConstraintCoincidence_70") -SketchConstraintCoincidence_241 = Sketch_15.setCoincident(SketchPoint_30.coordinates(), SketchLine_158.endPoint()) +SketchConstraintCoincidence_241 = Sketch_15.setCoincident( + SketchPoint_30.coordinates(), SketchLine_158.endPoint() +) SketchConstraintCoincidence_241.setName("SketchConstraintCoincidence_71") SketchConstraintVertical_29 = Sketch_15.setVertical(SketchLine_156.result()) 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/Modified_Face&Extrusion_1_1/To_Face"), 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_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")) +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") SketchLine_159.result().setName("SketchLine_55") SketchConstraintRigid_16 = Sketch_16.setFixed(SketchLine_159.result()) SketchConstraintRigid_16.setName("SketchConstraintRigid_12") -SketchConstraintCoincidence_242 = Sketch_16.setCoincident(SketchArc_28.center(), SketchLine_159.result()) +SketchConstraintCoincidence_242 = Sketch_16.setCoincident( + SketchArc_28.center(), SketchLine_159.result() +) SketchConstraintCoincidence_242.setName("SketchConstraintCoincidence_72") -SketchConstraintCoincidence_243 = Sketch_16.setCoincident(SketchArc_28.startPoint(), SketchLine_159.result()) +SketchConstraintCoincidence_243 = Sketch_16.setCoincident( + SketchArc_28.startPoint(), SketchLine_159.result() +) SketchConstraintCoincidence_243.setName("SketchConstraintCoincidence_73") -SketchConstraintCoincidence_244 = Sketch_16.setCoincident(SketchArc_28.endPoint(), SketchLine_159.result()) +SketchConstraintCoincidence_244 = Sketch_16.setCoincident( + SketchArc_28.endPoint(), SketchLine_159.result() +) SketchConstraintCoincidence_244.setName("SketchConstraintCoincidence_74") SketchLine_160 = Sketch_16.addLine(45.5, 0, 46.5, 0) SketchLine_160.setName("SketchLine_56") SketchLine_160.result().setName("SketchLine_56") -SketchConstraintCoincidence_245 = Sketch_16.setCoincident(SketchArc_28.startPoint(), SketchLine_160.startPoint()) +SketchConstraintCoincidence_245 = Sketch_16.setCoincident( + SketchArc_28.startPoint(), SketchLine_160.startPoint() +) SketchConstraintCoincidence_245.setName("SketchConstraintCoincidence_75") -SketchConstraintCoincidence_246 = Sketch_16.setCoincident(SketchArc_28.endPoint(), SketchLine_160.endPoint()) +SketchConstraintCoincidence_246 = Sketch_16.setCoincident( + SketchArc_28.endPoint(), SketchLine_160.endPoint() +) SketchConstraintCoincidence_246.setName("SketchConstraintCoincidence_76") SketchConstraintRadius_12 = Sketch_16.setRadius(SketchArc_28.results()[1], 0.5) SketchLine_161 = Sketch_16.addLine(0, 0, 0, 3.5) SketchLine_161.setName("SketchLine_57") SketchLine_161.result().setName("SketchLine_57") -SketchConstraintDistance_28 = Sketch_16.setDistance(SketchArc_28.center(), SketchLine_161.result(), 46, False) +SketchConstraintDistance_28 = Sketch_16.setDistance( + SketchArc_28.center(), SketchLine_161.result(), 46, False +) SketchConstraintRigid_17 = Sketch_16.setFixed(SketchLine_161.result()) SketchConstraintRigid_17.setName("SketchConstraintRigid_13") SketchPoint_31 = Sketch_16.addPoint(58, 0) -SketchConstraintCoincidence_247 = Sketch_16.setCoincident(SketchPoint_31.coordinates(), SketchLine_159.result()) +SketchConstraintCoincidence_247 = Sketch_16.setCoincident( + SketchPoint_31.coordinates(), SketchLine_159.result() +) SketchConstraintCoincidence_247.setName("SketchConstraintCoincidence_77") -SketchConstraintDistance_29 = Sketch_16.setDistance(SketchArc_28.center(), SketchPoint_31.coordinates(), 12, False) -SketchMultiTranslation_4 = Sketch_16.addTranslation([SketchLine_160.result(), SketchArc_28.results()[1]], SketchArc_28.center(), SketchPoint_31.coordinates(), 9, True) -[SketchLine_162, SketchLine_163, SketchLine_164, SketchLine_165, SketchLine_166, SketchLine_167, SketchLine_168, SketchLine_169, SketchArc_29, SketchArc_30, SketchArc_31, SketchArc_32, SketchArc_33, SketchArc_34, SketchArc_35, SketchArc_36] = SketchMultiTranslation_4.translated() +SketchConstraintDistance_29 = Sketch_16.setDistance( + SketchArc_28.center(), SketchPoint_31.coordinates(), 12, False +) +SketchMultiTranslation_4 = Sketch_16.addTranslation( + [SketchLine_160.result(), SketchArc_28.results()[1]], + SketchArc_28.center(), + SketchPoint_31.coordinates(), + 9, + True, +) +[ + SketchLine_162, + SketchLine_163, + SketchLine_164, + SketchLine_165, + SketchLine_166, + SketchLine_167, + SketchLine_168, + SketchLine_169, + SketchArc_29, + SketchArc_30, + SketchArc_31, + SketchArc_32, + SketchArc_33, + SketchArc_34, + SketchArc_35, + SketchArc_36, +] = SketchMultiTranslation_4.translated() SketchLine_169.setName("SketchLine_65") SketchLine_169.result().setName("SketchLine_65") SketchLine_168.setName("SketchLine_64") @@ -1398,8 +2546,26 @@ 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_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)_ExtrusionFuse_1_1")) +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)_ExtrusionFuse_1_1", + ), +) SketchLine_170 = Sketch_17.addLine(50.25, -4.5, 31.25, -4.5) SketchLine_170.setName("SketchLine_76") SketchLine_170.result().setName("SketchLine_76") @@ -1418,21 +2584,29 @@ SketchLine_174.result().setName("SketchLine_66") SketchLine_174.setAuxiliary(True) SketchLine_175 = Sketch_17.addLine(51, -7.5, 51, -4.5) SketchLine_175.setAuxiliary(True) -SketchConstraintCoincidence_248 = Sketch_17.setCoincident(SketchLine_175.endPoint(), SketchLine_174.startPoint()) +SketchConstraintCoincidence_248 = Sketch_17.setCoincident( + SketchLine_175.endPoint(), SketchLine_174.startPoint() +) SketchConstraintCoincidence_248.setName("SketchConstraintCoincidence_78") SketchLine_176 = Sketch_17.addLine(31, -4.5, 31, -7.5) SketchLine_176.setName("SketchLine_67") SketchLine_176.result().setName("SketchLine_67") SketchLine_176.setAuxiliary(True) -SketchConstraintCoincidence_249 = Sketch_17.setCoincident(SketchLine_174.endPoint(), SketchLine_176.startPoint()) +SketchConstraintCoincidence_249 = Sketch_17.setCoincident( + SketchLine_174.endPoint(), SketchLine_176.startPoint() +) SketchConstraintCoincidence_249.setName("SketchConstraintCoincidence_79") SketchLine_177 = Sketch_17.addLine(31, -7.5, 51, -7.5) SketchLine_177.setName("SketchLine_68") SketchLine_177.result().setName("SketchLine_68") SketchLine_177.setAuxiliary(True) -SketchConstraintCoincidence_250 = Sketch_17.setCoincident(SketchLine_176.endPoint(), SketchLine_177.startPoint()) +SketchConstraintCoincidence_250 = Sketch_17.setCoincident( + SketchLine_176.endPoint(), SketchLine_177.startPoint() +) SketchConstraintCoincidence_250.setName("SketchConstraintCoincidence_80") -SketchConstraintCoincidence_251 = Sketch_17.setCoincident(SketchLine_177.endPoint(), SketchLine_175.startPoint()) +SketchConstraintCoincidence_251 = Sketch_17.setCoincident( + SketchLine_177.endPoint(), SketchLine_175.startPoint() +) SketchConstraintCoincidence_251.setName("SketchConstraintCoincidence_81") SketchConstraintHorizontal_34 = Sketch_17.setHorizontal(SketchLine_174.result()) SketchConstraintHorizontal_34.setName("SketchConstraintHorizontal_13") @@ -1444,20 +2618,32 @@ SketchLine_178 = Sketch_17.addLine(31, -7.5, 51, -4.5) SketchLine_178.setName("SketchLine_70") SketchLine_178.result().setName("SketchLine_70") SketchLine_178.setAuxiliary(True) -SketchConstraintCoincidence_252 = Sketch_17.setCoincident(SketchLine_176.endPoint(), SketchLine_178.startPoint()) +SketchConstraintCoincidence_252 = Sketch_17.setCoincident( + SketchLine_176.endPoint(), SketchLine_178.startPoint() +) SketchConstraintCoincidence_252.setName("SketchConstraintCoincidence_82") -SketchConstraintCoincidence_253 = Sketch_17.setCoincident(SketchLine_177.startPoint(), SketchLine_178.startPoint()) +SketchConstraintCoincidence_253 = Sketch_17.setCoincident( + SketchLine_177.startPoint(), SketchLine_178.startPoint() +) SketchConstraintCoincidence_253.setName("SketchConstraintCoincidence_83") SketchPoint_32 = Sketch_17.addPoint(51, -4.5) -SketchConstraintCoincidence_254 = Sketch_17.setCoincident(SketchLine_174.startPoint(), SketchPoint_32.coordinates()) +SketchConstraintCoincidence_254 = Sketch_17.setCoincident( + SketchLine_174.startPoint(), SketchPoint_32.coordinates() +) SketchConstraintCoincidence_254.setName("SketchConstraintCoincidence_84") -SketchConstraintCoincidence_255 = Sketch_17.setCoincident(SketchLine_175.endPoint(), SketchPoint_32.coordinates()) +SketchConstraintCoincidence_255 = Sketch_17.setCoincident( + SketchLine_175.endPoint(), SketchPoint_32.coordinates() +) SketchConstraintCoincidence_255.setName("SketchConstraintCoincidence_85") SketchPoint_33 = Sketch_17.addPoint(41, -6) SketchPoint_33.setAuxiliary(True) -SketchConstraintCoincidence_256 = Sketch_17.setCoincident(SketchPoint_33.coordinates(), SketchLine_178.result()) +SketchConstraintCoincidence_256 = Sketch_17.setCoincident( + SketchPoint_33.coordinates(), SketchLine_178.result() +) SketchConstraintCoincidence_256.setName("SketchConstraintCoincidence_86") -SketchConstraintMiddle_11 = Sketch_17.setMiddlePoint(SketchLine_178.result(), SketchPoint_33.coordinates()) +SketchConstraintMiddle_11 = Sketch_17.setMiddlePoint( + SketchLine_178.result(), SketchPoint_33.coordinates() +) SketchPoint_34 = Sketch_17.addPoint(21, -6) SketchPoint_34.setAuxiliary(True) SketchLine_179 = Sketch_17.addLine(21, -10.5, 21, -1.5) @@ -1465,27 +2651,39 @@ SketchLine_179.setName("SketchLine_71") SketchLine_179.result().setName("SketchLine_71") SketchConstraintRigid_18 = Sketch_17.setFixed(SketchLine_179.result()) SketchConstraintRigid_18.setName("SketchConstraintRigid_14") -SketchConstraintCoincidence_257 = Sketch_17.setCoincident(SketchPoint_34.coordinates(), SketchLine_179.result()) +SketchConstraintCoincidence_257 = Sketch_17.setCoincident( + SketchPoint_34.coordinates(), SketchLine_179.result() +) SketchConstraintCoincidence_257.setName("SketchConstraintCoincidence_87") -SketchConstraintMiddle_12 = Sketch_17.setMiddlePoint(SketchPoint_34.coordinates(), SketchLine_179.result()) +SketchConstraintMiddle_12 = Sketch_17.setMiddlePoint( + SketchPoint_34.coordinates(), SketchLine_179.result() +) SketchLine_180 = Sketch_17.addLine(21, -6, 41, -6) SketchLine_180.setName("SketchLine_72") SketchLine_180.result().setName("SketchLine_72") SketchLine_180.setAuxiliary(True) -SketchConstraintCoincidence_258 = Sketch_17.setCoincident(SketchPoint_34.coordinates(), SketchLine_180.startPoint()) +SketchConstraintCoincidence_258 = Sketch_17.setCoincident( + SketchPoint_34.coordinates(), SketchLine_180.startPoint() +) SketchConstraintCoincidence_258.setName("SketchConstraintCoincidence_88") -SketchConstraintCoincidence_259 = Sketch_17.setCoincident(SketchPoint_33.coordinates(), SketchLine_180.endPoint()) +SketchConstraintCoincidence_259 = Sketch_17.setCoincident( + SketchPoint_33.coordinates(), SketchLine_180.endPoint() +) SketchConstraintCoincidence_259.setName("SketchConstraintCoincidence_89") SketchConstraintHorizontal_36 = Sketch_17.setHorizontal(SketchLine_180.result()) SketchConstraintHorizontal_36.setName("SketchConstraintHorizontal_15") -SketchConstraintCoincidence_260 = Sketch_17.setCoincident(SketchLine_178.endPoint(), SketchLine_174.startPoint()) +SketchConstraintCoincidence_260 = Sketch_17.setCoincident( + SketchLine_178.endPoint(), SketchLine_174.startPoint() +) SketchConstraintCoincidence_260.setName("SketchConstraintCoincidence_90") SketchConstraintLength_29 = Sketch_17.setLength(SketchLine_175.result(), 3) SketchConstraintLength_29.setName("SketchConstraintLength_13") SketchConstraintLength_30 = Sketch_17.setLength(SketchLine_174.result(), 20) SketchConstraintLength_30.setName("SketchConstraintLength_14") SketchPoint_35 = Sketch_17.addPoint(29, -10.5) -SketchConstraintDistance_30 = Sketch_17.setDistance(SketchPoint_35.coordinates(), SketchLine_176.result(), 2, False) +SketchConstraintDistance_30 = Sketch_17.setDistance( + SketchPoint_35.coordinates(), SketchLine_176.result(), 2, False +) SketchConstraintRigid_19 = Sketch_17.setFixed(SketchPoint_35.result()) SketchConstraintRigid_19.setName("SketchConstraintRigid_15") SketchArc_37 = Sketch_17.addArc(50.25, -5.25, 51, -5.25, 50.25, -4.5, False) @@ -1493,168 +2691,301 @@ SketchLine_181 = Sketch_17.addLine(51, -7.5, 51, -5.25) SketchLine_181.setName("SketchLine_74") SketchLine_181.result().setName("SketchLine_74") SketchLine_181.setAuxiliary(True) -SketchConstraintCoincidence_261 = Sketch_17.setCoincident(SketchArc_37.startPoint(), SketchLine_181.endPoint()) +SketchConstraintCoincidence_261 = Sketch_17.setCoincident( + SketchArc_37.startPoint(), SketchLine_181.endPoint() +) SketchConstraintCoincidence_261.setName("SketchConstraintCoincidence_91") SketchLine_182 = Sketch_17.addLine(50.25, -4.5, 31, -4.5) SketchLine_182.setName("SketchLine_73") SketchLine_182.result().setName("SketchLine_73") SketchLine_182.setAuxiliary(True) -SketchConstraintCoincidence_262 = Sketch_17.setCoincident(SketchArc_37.endPoint(), SketchLine_182.startPoint()) +SketchConstraintCoincidence_262 = Sketch_17.setCoincident( + SketchArc_37.endPoint(), SketchLine_182.startPoint() +) SketchConstraintCoincidence_262.setName("SketchConstraintCoincidence_92") -SketchConstraintTangent_17 = Sketch_17.setTangent(SketchArc_37.results()[1], SketchLine_182.result()) -SketchConstraintTangent_18 = Sketch_17.setTangent(SketchArc_37.results()[1], SketchLine_181.result()) -SketchConstraintCoincidence_263 = Sketch_17.setCoincident(SketchLine_174.endPoint(), SketchLine_182.endPoint()) +SketchConstraintTangent_17 = Sketch_17.setTangent( + SketchArc_37.results()[1], SketchLine_182.result() +) +SketchConstraintTangent_18 = Sketch_17.setTangent( + SketchArc_37.results()[1], SketchLine_181.result() +) +SketchConstraintCoincidence_263 = Sketch_17.setCoincident( + SketchLine_174.endPoint(), SketchLine_182.endPoint() +) SketchConstraintCoincidence_263.setName("SketchConstraintCoincidence_93") -SketchConstraintCoincidence_264 = Sketch_17.setCoincident(SketchLine_175.startPoint(), SketchLine_181.startPoint()) +SketchConstraintCoincidence_264 = Sketch_17.setCoincident( + SketchLine_175.startPoint(), SketchLine_181.startPoint() +) SketchConstraintCoincidence_264.setName("SketchConstraintCoincidence_94") -SketchConstraintCoincidence_265 = Sketch_17.setCoincident(SketchLine_182.startPoint(), SketchLine_174.result()) +SketchConstraintCoincidence_265 = Sketch_17.setCoincident( + SketchLine_182.startPoint(), SketchLine_174.result() +) SketchConstraintCoincidence_265.setName("SketchConstraintCoincidence_95") -SketchConstraintCoincidence_266 = Sketch_17.setCoincident(SketchLine_181.endPoint(), SketchLine_175.result()) +SketchConstraintCoincidence_266 = Sketch_17.setCoincident( + SketchLine_181.endPoint(), SketchLine_175.result() +) SketchConstraintCoincidence_266.setName("SketchConstraintCoincidence_96") SketchArc_38 = Sketch_17.addArc(31.25, -4.75, 31.25, -4.5, 31, -4.75, False) -SketchConstraintCoincidence_267 = Sketch_17.setCoincident(SketchArc_38.startPoint(), SketchLine_170.endPoint()) +SketchConstraintCoincidence_267 = Sketch_17.setCoincident( + SketchArc_38.startPoint(), SketchLine_170.endPoint() +) SketchConstraintCoincidence_267.setName("SketchConstraintCoincidence_97") SketchLine_183 = Sketch_17.addLine(31, -4.75, 31, -7.5) SketchLine_183.setName("SketchLine_75") SketchLine_183.result().setName("SketchLine_75") SketchLine_183.setAuxiliary(True) -SketchConstraintCoincidence_268 = Sketch_17.setCoincident(SketchArc_38.endPoint(), SketchLine_183.startPoint()) +SketchConstraintCoincidence_268 = Sketch_17.setCoincident( + SketchArc_38.endPoint(), SketchLine_183.startPoint() +) SketchConstraintCoincidence_268.setName("SketchConstraintCoincidence_98") -SketchConstraintTangent_19 = Sketch_17.setTangent(SketchArc_38.results()[1], SketchLine_183.result()) -SketchConstraintTangent_20 = Sketch_17.setTangent(SketchArc_38.results()[1], SketchLine_170.result()) -SketchConstraintCoincidence_269 = Sketch_17.setCoincident(SketchLine_176.endPoint(), SketchLine_183.endPoint()) +SketchConstraintTangent_19 = Sketch_17.setTangent( + SketchArc_38.results()[1], SketchLine_183.result() +) +SketchConstraintTangent_20 = Sketch_17.setTangent( + SketchArc_38.results()[1], SketchLine_170.result() +) +SketchConstraintCoincidence_269 = Sketch_17.setCoincident( + SketchLine_176.endPoint(), SketchLine_183.endPoint() +) SketchConstraintCoincidence_269.setName("SketchConstraintCoincidence_99") -SketchConstraintCoincidence_270 = Sketch_17.setCoincident(SketchLine_182.startPoint(), SketchLine_170.startPoint()) +SketchConstraintCoincidence_270 = Sketch_17.setCoincident( + SketchLine_182.startPoint(), SketchLine_170.startPoint() +) SketchConstraintCoincidence_270.setName("SketchConstraintCoincidence_100") -SketchConstraintCoincidence_271 = Sketch_17.setCoincident(SketchLine_183.startPoint(), SketchLine_176.result()) +SketchConstraintCoincidence_271 = Sketch_17.setCoincident( + SketchLine_183.startPoint(), SketchLine_176.result() +) SketchConstraintCoincidence_271.setName("SketchConstraintCoincidence_101") -SketchConstraintCoincidence_272 = Sketch_17.setCoincident(SketchLine_170.endPoint(), SketchLine_182.result()) +SketchConstraintCoincidence_272 = Sketch_17.setCoincident( + SketchLine_170.endPoint(), SketchLine_182.result() +) SketchConstraintCoincidence_272.setName("SketchConstraintCoincidence_102") SketchArc_39 = Sketch_17.addArc(50.25, -6.75, 50.25, -7.5, 51, -6.75, False) SketchLine_184 = Sketch_17.addLine(31, -7.5, 50.25, -7.5) SketchLine_184.setName("SketchLine_77") SketchLine_184.result().setName("SketchLine_77") SketchLine_184.setAuxiliary(True) -SketchConstraintCoincidence_273 = Sketch_17.setCoincident(SketchArc_39.startPoint(), SketchLine_184.endPoint()) +SketchConstraintCoincidence_273 = Sketch_17.setCoincident( + SketchArc_39.startPoint(), SketchLine_184.endPoint() +) SketchConstraintCoincidence_273.setName("SketchConstraintCoincidence_103") -SketchConstraintCoincidence_274 = Sketch_17.setCoincident(SketchArc_39.endPoint(), SketchLine_171.startPoint()) +SketchConstraintCoincidence_274 = Sketch_17.setCoincident( + SketchArc_39.endPoint(), SketchLine_171.startPoint() +) SketchConstraintCoincidence_274.setName("SketchConstraintCoincidence_104") -SketchConstraintTangent_21 = Sketch_17.setTangent(SketchArc_39.results()[1], SketchLine_184.result()) -SketchConstraintTangent_22 = Sketch_17.setTangent(SketchArc_39.results()[1], SketchLine_171.result()) -SketchConstraintCoincidence_275 = Sketch_17.setCoincident(SketchLine_177.startPoint(), SketchLine_184.startPoint()) +SketchConstraintTangent_21 = Sketch_17.setTangent( + SketchArc_39.results()[1], SketchLine_184.result() +) +SketchConstraintTangent_22 = Sketch_17.setTangent( + SketchArc_39.results()[1], SketchLine_171.result() +) +SketchConstraintCoincidence_275 = Sketch_17.setCoincident( + SketchLine_177.startPoint(), SketchLine_184.startPoint() +) SketchConstraintCoincidence_275.setName("SketchConstraintCoincidence_105") -SketchConstraintCoincidence_276 = Sketch_17.setCoincident(SketchLine_181.endPoint(), SketchLine_171.endPoint()) +SketchConstraintCoincidence_276 = Sketch_17.setCoincident( + SketchLine_181.endPoint(), SketchLine_171.endPoint() +) SketchConstraintCoincidence_276.setName("SketchConstraintCoincidence_106") -SketchConstraintCoincidence_277 = Sketch_17.setCoincident(SketchLine_184.endPoint(), SketchLine_177.result()) +SketchConstraintCoincidence_277 = Sketch_17.setCoincident( + SketchLine_184.endPoint(), SketchLine_177.result() +) SketchConstraintCoincidence_277.setName("SketchConstraintCoincidence_107") -SketchConstraintCoincidence_278 = Sketch_17.setCoincident(SketchLine_171.startPoint(), SketchLine_181.result()) +SketchConstraintCoincidence_278 = Sketch_17.setCoincident( + SketchLine_171.startPoint(), SketchLine_181.result() +) SketchConstraintCoincidence_278.setName("SketchConstraintCoincidence_108") -SketchArc_40 = Sketch_17.addArc(31.25, -7.249999999999998, 31, -7.249999999999651, 31.25, -7.499999999999998, False) -SketchConstraintCoincidence_279 = Sketch_17.setCoincident(SketchArc_40.startPoint(), SketchLine_172.endPoint()) +SketchArc_40 = Sketch_17.addArc( + 31.25, -7.249999999999998, 31, -7.249999999999651, 31.25, -7.499999999999998, False +) +SketchConstraintCoincidence_279 = Sketch_17.setCoincident( + SketchArc_40.startPoint(), SketchLine_172.endPoint() +) SketchConstraintCoincidence_279.setName("SketchConstraintCoincidence_109") -SketchConstraintCoincidence_280 = Sketch_17.setCoincident(SketchArc_40.endPoint(), SketchLine_173.startPoint()) +SketchConstraintCoincidence_280 = Sketch_17.setCoincident( + SketchArc_40.endPoint(), SketchLine_173.startPoint() +) SketchConstraintCoincidence_280.setName("SketchConstraintCoincidence_110") -SketchConstraintCoincidence_281 = Sketch_17.setCoincident(SketchLine_184.endPoint(), SketchLine_173.endPoint()) +SketchConstraintCoincidence_281 = Sketch_17.setCoincident( + SketchLine_184.endPoint(), SketchLine_173.endPoint() +) SketchConstraintCoincidence_281.setName("SketchConstraintCoincidence_111") -SketchConstraintCoincidence_282 = Sketch_17.setCoincident(SketchLine_183.startPoint(), SketchLine_172.startPoint()) +SketchConstraintCoincidence_282 = Sketch_17.setCoincident( + SketchLine_183.startPoint(), SketchLine_172.startPoint() +) SketchConstraintCoincidence_282.setName("SketchConstraintCoincidence_112") -SketchConstraintCoincidence_283 = Sketch_17.setCoincident(SketchLine_173.startPoint(), SketchLine_184.result()) +SketchConstraintCoincidence_283 = Sketch_17.setCoincident( + SketchLine_173.startPoint(), SketchLine_184.result() +) SketchConstraintCoincidence_283.setName("SketchConstraintCoincidence_113") -SketchConstraintCoincidence_284 = Sketch_17.setCoincident(SketchLine_172.endPoint(), SketchLine_183.result()) +SketchConstraintCoincidence_284 = Sketch_17.setCoincident( + SketchLine_172.endPoint(), SketchLine_183.result() +) SketchConstraintCoincidence_284.setName("SketchConstraintCoincidence_114") SketchConstraintRadius_13 = Sketch_17.setRadius(SketchArc_37.results()[1], 0.75) SketchConstraintRadius_14 = Sketch_17.setRadius(SketchArc_39.results()[1], 0.75) SketchConstraintRadius_15 = Sketch_17.setRadius(SketchArc_38.results()[1], 0.25) -SketchConstraintTangent_23 = Sketch_17.setTangent(SketchArc_40.results()[1], SketchLine_173.result()) +SketchConstraintTangent_23 = Sketch_17.setTangent( + SketchArc_40.results()[1], SketchLine_173.result() +) SketchConstraintTangent_23.setName("SketchConstraintTangent_16") -SketchConstraintTangent_24 = Sketch_17.setTangent(SketchLine_172.result(), SketchArc_40.results()[1]) +SketchConstraintTangent_24 = Sketch_17.setTangent( + SketchLine_172.result(), SketchArc_40.results()[1] +) SketchConstraintTangent_24.setName("SketchConstraintTangent_17") 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", "(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)")) +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", + "(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()) SketchConstraintRigid_20.setName("SketchConstraintRigid_16") -SketchConstraintCoincidence_285 = Sketch_18.setCoincident(SketchPoint_36.coordinates(), SketchPoint_37.result()) +SketchConstraintCoincidence_285 = Sketch_18.setCoincident( + SketchPoint_36.coordinates(), SketchPoint_37.result() +) SketchConstraintCoincidence_285.setName("SketchConstraintCoincidence_115") SketchPoint_38 = Sketch_18.addPoint(54, 12) SketchLine_185 = Sketch_18.addLine(54, 12, 54, 0) SketchLine_185.setName("SketchLine_81") SketchLine_185.result().setName("SketchLine_81") SketchLine_185.setAuxiliary(True) -SketchConstraintCoincidence_286 = Sketch_18.setCoincident(SketchPoint_38.coordinates(), SketchLine_185.startPoint()) +SketchConstraintCoincidence_286 = Sketch_18.setCoincident( + SketchPoint_38.coordinates(), SketchLine_185.startPoint() +) SketchConstraintCoincidence_286.setName("SketchConstraintCoincidence_116") -SketchConstraintCoincidence_287 = Sketch_18.setCoincident(SketchPoint_36.coordinates(), SketchLine_185.endPoint()) +SketchConstraintCoincidence_287 = Sketch_18.setCoincident( + SketchPoint_36.coordinates(), SketchLine_185.endPoint() +) SketchConstraintCoincidence_287.setName("SketchConstraintCoincidence_117") -SketchConstraintCoincidence_288 = Sketch_18.setCoincident(SketchPoint_37.coordinates(), SketchLine_185.endPoint()) +SketchConstraintCoincidence_288 = Sketch_18.setCoincident( + SketchPoint_37.coordinates(), SketchLine_185.endPoint() +) SketchConstraintCoincidence_288.setName("SketchConstraintCoincidence_118") SketchPoint_39 = Sketch_18.addPoint(54, 11) -SketchConstraintCoincidence_289 = Sketch_18.setCoincident(SketchPoint_39.coordinates(), SketchLine_185.result()) +SketchConstraintCoincidence_289 = Sketch_18.setCoincident( + SketchPoint_39.coordinates(), SketchLine_185.result() +) SketchConstraintCoincidence_289.setName("SketchConstraintCoincidence_119") SketchPoint_40 = Sketch_18.addPoint(54, 1) -SketchConstraintCoincidence_290 = Sketch_18.setCoincident(SketchPoint_40.coordinates(), SketchLine_185.result()) +SketchConstraintCoincidence_290 = Sketch_18.setCoincident( + SketchPoint_40.coordinates(), SketchLine_185.result() +) SketchConstraintCoincidence_290.setName("SketchConstraintCoincidence_120") -SketchConstraintDistance_31 = Sketch_18.setDistance(SketchPoint_36.coordinates(), SketchPoint_40.coordinates(), 1, False) -SketchConstraintDistance_32 = Sketch_18.setDistance(SketchPoint_38.coordinates(), SketchPoint_39.coordinates(), 1, False) +SketchConstraintDistance_31 = Sketch_18.setDistance( + SketchPoint_36.coordinates(), SketchPoint_40.coordinates(), 1, False +) +SketchConstraintDistance_32 = Sketch_18.setDistance( + SketchPoint_38.coordinates(), SketchPoint_39.coordinates(), 1, False +) SketchPoint_41 = Sketch_18.addPoint(54, 12) -SketchConstraintCoincidence_291 = Sketch_18.setCoincident(SketchPoint_38.coordinates(), SketchPoint_41.coordinates()) +SketchConstraintCoincidence_291 = Sketch_18.setCoincident( + SketchPoint_38.coordinates(), SketchPoint_41.coordinates() +) SketchConstraintCoincidence_291.setName("SketchConstraintCoincidence_121") SketchConstraintRigid_21 = Sketch_18.setFixed(SketchPoint_41.result()) SketchConstraintRigid_21.setName("SketchConstraintRigid_17") SketchLine_186 = Sketch_18.addLine(54, 11, 43.82041221793113, 11) SketchLine_186.setName("SketchLine_82") SketchLine_186.result().setName("SketchLine_82") -SketchConstraintCoincidence_292 = Sketch_18.setCoincident(SketchPoint_39.coordinates(), SketchLine_186.startPoint()) +SketchConstraintCoincidence_292 = Sketch_18.setCoincident( + SketchPoint_39.coordinates(), SketchLine_186.startPoint() +) SketchConstraintCoincidence_292.setName("SketchConstraintCoincidence_122") -SketchLine_187 = Sketch_18.addLine(43.82041221793113, 11, 43.82041221793113, 13.36310636658867) +SketchLine_187 = Sketch_18.addLine( + 43.82041221793113, 11, 43.82041221793113, 13.36310636658867 +) SketchLine_187.setName("SketchLine_83") SketchLine_187.result().setName("SketchLine_83") -SketchConstraintCoincidence_293 = Sketch_18.setCoincident(SketchLine_186.endPoint(), SketchLine_187.startPoint()) +SketchConstraintCoincidence_293 = Sketch_18.setCoincident( + SketchLine_186.endPoint(), SketchLine_187.startPoint() +) SketchConstraintCoincidence_293.setName("SketchConstraintCoincidence_123") -SketchLine_188 = Sketch_18.addLine(43.82041221793113, 13.36310636658867, 63.09515214070713, 13.47539228785809) +SketchLine_188 = Sketch_18.addLine( + 43.82041221793113, 13.36310636658867, 63.09515214070713, 13.47539228785809 +) SketchLine_188.setName("SketchLine_84") SketchLine_188.result().setName("SketchLine_84") -SketchConstraintCoincidence_294 = Sketch_18.setCoincident(SketchLine_187.endPoint(), SketchLine_188.startPoint()) +SketchConstraintCoincidence_294 = Sketch_18.setCoincident( + SketchLine_187.endPoint(), SketchLine_188.startPoint() +) SketchConstraintCoincidence_294.setName("SketchConstraintCoincidence_124") -SketchLine_189 = Sketch_18.addLine(63.09515214070713, 13.47539228785809, 63.12349734647592, -1.774328415749978) +SketchLine_189 = Sketch_18.addLine( + 63.09515214070713, 13.47539228785809, 63.12349734647592, -1.774328415749978 +) SketchLine_189.setName("SketchLine_85") SketchLine_189.result().setName("SketchLine_85") -SketchConstraintCoincidence_295 = Sketch_18.setCoincident(SketchLine_188.endPoint(), SketchLine_189.startPoint()) +SketchConstraintCoincidence_295 = Sketch_18.setCoincident( + SketchLine_188.endPoint(), SketchLine_189.startPoint() +) SketchConstraintCoincidence_295.setName("SketchConstraintCoincidence_125") -SketchLine_190 = Sketch_18.addLine(63.12349734647592, -1.774328415749978, 43.82041221793113, -1.802673621518767) +SketchLine_190 = Sketch_18.addLine( + 63.12349734647592, -1.774328415749978, 43.82041221793113, -1.802673621518767 +) SketchLine_190.setName("SketchLine_86") SketchLine_190.result().setName("SketchLine_86") -SketchConstraintCoincidence_296 = Sketch_18.setCoincident(SketchLine_189.endPoint(), SketchLine_190.startPoint()) +SketchConstraintCoincidence_296 = Sketch_18.setCoincident( + SketchLine_189.endPoint(), SketchLine_190.startPoint() +) SketchConstraintCoincidence_296.setName("SketchConstraintCoincidence_126") -SketchLine_191 = Sketch_18.addLine(43.82041221793113, -1.802673621518767, 43.79206701216234, 1) +SketchLine_191 = Sketch_18.addLine( + 43.82041221793113, -1.802673621518767, 43.79206701216234, 1 +) SketchLine_191.setName("SketchLine_87") SketchLine_191.result().setName("SketchLine_87") -SketchConstraintCoincidence_297 = Sketch_18.setCoincident(SketchLine_190.endPoint(), SketchLine_191.startPoint()) +SketchConstraintCoincidence_297 = Sketch_18.setCoincident( + SketchLine_190.endPoint(), SketchLine_191.startPoint() +) SketchConstraintCoincidence_297.setName("SketchConstraintCoincidence_127") SketchLine_192 = Sketch_18.addLine(54, 1, 43.79206701216234, 1) SketchLine_192.setName("SketchLine_88") SketchLine_192.result().setName("SketchLine_88") -SketchConstraintCoincidence_298 = Sketch_18.setCoincident(SketchPoint_40.coordinates(), SketchLine_192.startPoint()) +SketchConstraintCoincidence_298 = Sketch_18.setCoincident( + SketchPoint_40.coordinates(), SketchLine_192.startPoint() +) SketchConstraintCoincidence_298.setName("SketchConstraintCoincidence_128") SketchConstraintHorizontal_37 = Sketch_18.setHorizontal(SketchLine_192.result()) SketchConstraintHorizontal_37.setName("SketchConstraintHorizontal_16") SketchConstraintHorizontal_38 = Sketch_18.setHorizontal(SketchLine_186.result()) SketchConstraintHorizontal_38.setName("SketchConstraintHorizontal_17") -SketchConstraintCoincidence_299 = Sketch_18.setCoincident(SketchLine_191.endPoint(), SketchLine_192.endPoint()) +SketchConstraintCoincidence_299 = Sketch_18.setCoincident( + SketchLine_191.endPoint(), SketchLine_192.endPoint() +) SketchConstraintCoincidence_299.setName("SketchConstraintCoincidence_129") SketchArc_41 = Sketch_18.addArc(54, 6, 54, 11, 54, 1, True) -SketchConstraintCoincidence_300 = Sketch_18.setCoincident(SketchArc_41.center(), SketchLine_185.result()) +SketchConstraintCoincidence_300 = Sketch_18.setCoincident( + SketchArc_41.center(), SketchLine_185.result() +) SketchConstraintCoincidence_300.setName("SketchConstraintCoincidence_130") -SketchConstraintCoincidence_301 = Sketch_18.setCoincident(SketchPoint_39.coordinates(), SketchArc_41.startPoint()) +SketchConstraintCoincidence_301 = Sketch_18.setCoincident( + SketchPoint_39.coordinates(), SketchArc_41.startPoint() +) SketchConstraintCoincidence_301.setName("SketchConstraintCoincidence_130_") -SketchConstraintCoincidence_302 = Sketch_18.setCoincident(SketchLine_186.startPoint(), SketchArc_41.startPoint()) +SketchConstraintCoincidence_302 = Sketch_18.setCoincident( + SketchLine_186.startPoint(), SketchArc_41.startPoint() +) SketchConstraintCoincidence_302.setName("SketchConstraintCoincidence_131") -SketchConstraintCoincidence_303 = Sketch_18.setCoincident(SketchPoint_40.coordinates(), SketchArc_41.endPoint()) +SketchConstraintCoincidence_303 = Sketch_18.setCoincident( + SketchPoint_40.coordinates(), SketchArc_41.endPoint() +) SketchConstraintCoincidence_303.setName("SketchConstraintCoincidence_132") -SketchConstraintCoincidence_304 = Sketch_18.setCoincident(SketchLine_192.startPoint(), SketchArc_41.endPoint()) +SketchConstraintCoincidence_304 = Sketch_18.setCoincident( + SketchLine_192.startPoint(), SketchArc_41.endPoint() +) SketchConstraintCoincidence_304.setName("SketchConstraintCoincidence_133") SketchLine_193 = Sketch_18.addLine(43.50261344273609, 8.25, 43.50261344273609, 3.75) SketchLine_193.setName("SketchLine_90") @@ -1663,7 +2994,9 @@ SketchConstraintVertical_33 = Sketch_18.setVertical(SketchLine_193.result()) SketchConstraintLength_31 = Sketch_18.setLength(SketchLine_193.result(), 4.5) SketchConstraintLength_31.setName("SketchConstraintLength_15") SketchPoint_42 = Sketch_18.addPoint(43.50261344273609, 6) -SketchConstraintMiddle_13 = Sketch_18.setMiddlePoint(SketchPoint_42.coordinates(), SketchLine_193.result()) +SketchConstraintMiddle_13 = Sketch_18.setMiddlePoint( + SketchPoint_42.coordinates(), SketchLine_193.result() +) SketchPoint_43 = Sketch_18.addPoint(0, 6) SketchPoint_43.setAuxiliary(True) SketchLine_194 = Sketch_18.addLine(0, 0, 0, 12) @@ -1671,58 +3004,96 @@ SketchLine_194.setName("SketchLine_94") SketchLine_194.result().setName("SketchLine_94") SketchConstraintRigid_22 = Sketch_18.setFixed(SketchLine_194.result()) SketchConstraintRigid_22.setName("SketchConstraintRigid_19") -SketchConstraintCoincidence_305 = Sketch_18.setCoincident(SketchPoint_43.coordinates(), SketchLine_194.result()) +SketchConstraintCoincidence_305 = Sketch_18.setCoincident( + SketchPoint_43.coordinates(), SketchLine_194.result() +) SketchConstraintCoincidence_305.setName("SketchConstraintCoincidence_139") -SketchConstraintMiddle_14 = Sketch_18.setMiddlePoint(SketchLine_194.result(), SketchPoint_43.coordinates()) +SketchConstraintMiddle_14 = Sketch_18.setMiddlePoint( + SketchLine_194.result(), SketchPoint_43.coordinates() +) SketchLine_195 = Sketch_18.addLine(0, 6, 68.8619738308997, 6) SketchLine_195.setName("SketchLine_95") SketchLine_195.result().setName("SketchLine_95") SketchLine_195.setAuxiliary(True) -SketchConstraintCoincidence_306 = Sketch_18.setCoincident(SketchPoint_43.coordinates(), SketchLine_195.startPoint()) +SketchConstraintCoincidence_306 = Sketch_18.setCoincident( + SketchPoint_43.coordinates(), SketchLine_195.startPoint() +) SketchConstraintCoincidence_306.setName("SketchConstraintCoincidence_140") SketchConstraintHorizontal_39 = Sketch_18.setHorizontal(SketchLine_195.result()) SketchConstraintHorizontal_39.setName("SketchConstraintHorizontal_20") SketchPoint_44 = Sketch_18.addPoint(48.00130672136804, 6) -SketchConstraintCoincidence_307 = Sketch_18.setCoincident(SketchPoint_44.coordinates(), SketchLine_195.result()) +SketchConstraintCoincidence_307 = Sketch_18.setCoincident( + SketchPoint_44.coordinates(), SketchLine_195.result() +) SketchConstraintCoincidence_307.setName("SketchConstraintCoincidence_146") SketchLine_196 = Sketch_18.addLine(43.50261344273609, 8.25, 51.26978940411676, 8.25) SketchLine_196.setName("SketchLine_92") SketchLine_196.result().setName("SketchLine_92") -SketchConstraintCoincidence_308 = Sketch_18.setCoincident(SketchLine_193.startPoint(), SketchLine_196.startPoint()) +SketchConstraintCoincidence_308 = Sketch_18.setCoincident( + SketchLine_193.startPoint(), SketchLine_196.startPoint() +) SketchConstraintCoincidence_308.setName("SketchConstraintCoincidence_135") SketchLine_197 = Sketch_18.addLine(51.26978940411676, 8.25, 51.26978940411676, 3.75) SketchLine_197.setName("SketchLine_97") SketchLine_197.result().setName("SketchLine_97") -SketchConstraintCoincidence_309 = Sketch_18.setCoincident(SketchLine_196.endPoint(), SketchLine_197.startPoint()) +SketchConstraintCoincidence_309 = Sketch_18.setCoincident( + SketchLine_196.endPoint(), SketchLine_197.startPoint() +) SketchConstraintCoincidence_309.setName("SketchConstraintCoincidence_136") SketchLine_198 = Sketch_18.addLine(51.26978940411676, 3.75, 43.50261344273609, 3.75) SketchLine_198.setName("SketchLine_98") SketchLine_198.result().setName("SketchLine_98") -SketchConstraintCoincidence_310 = Sketch_18.setCoincident(SketchLine_197.endPoint(), SketchLine_198.startPoint()) +SketchConstraintCoincidence_310 = Sketch_18.setCoincident( + SketchLine_197.endPoint(), SketchLine_198.startPoint() +) SketchConstraintCoincidence_310.setName("SketchConstraintCoincidence_137") -SketchConstraintCoincidence_311 = Sketch_18.setCoincident(SketchLine_193.endPoint(), SketchLine_198.endPoint()) +SketchConstraintCoincidence_311 = Sketch_18.setCoincident( + SketchLine_193.endPoint(), SketchLine_198.endPoint() +) SketchConstraintCoincidence_311.setName("SketchConstraintCoincidence_138") SketchConstraintHorizontal_40 = Sketch_18.setHorizontal(SketchLine_198.result()) SketchConstraintHorizontal_41 = Sketch_18.setHorizontal(SketchLine_196.result()) SketchConstraintVertical_34 = Sketch_18.setVertical(SketchLine_197.result()) SketchLine_199 = Sketch_18.addLine(43.50261344273609, 3.75, 51.26978940411676, 8.25) SketchLine_199.setAuxiliary(True) -SketchConstraintCoincidence_312 = Sketch_18.setCoincident(SketchLine_193.endPoint(), SketchLine_199.startPoint()) +SketchConstraintCoincidence_312 = Sketch_18.setCoincident( + SketchLine_193.endPoint(), SketchLine_199.startPoint() +) SketchConstraintCoincidence_312.setName("SketchConstraintCoincidence_141") -SketchConstraintCoincidence_313 = Sketch_18.setCoincident(SketchLine_198.endPoint(), SketchLine_199.startPoint()) +SketchConstraintCoincidence_313 = Sketch_18.setCoincident( + SketchLine_198.endPoint(), SketchLine_199.startPoint() +) SketchConstraintCoincidence_313.setName("SketchConstraintCoincidence_142") -SketchConstraintCoincidence_314 = Sketch_18.setCoincident(SketchLine_197.startPoint(), SketchLine_199.endPoint()) +SketchConstraintCoincidence_314 = Sketch_18.setCoincident( + SketchLine_197.startPoint(), SketchLine_199.endPoint() +) SketchConstraintCoincidence_314.setName("SketchConstraintCoincidence_143") SketchPoint_45 = Sketch_18.addPoint(47.38620142342643, 6) SketchPoint_45.setAuxiliary(True) -SketchConstraintCoincidence_315 = Sketch_18.setCoincident(SketchPoint_45.coordinates(), SketchLine_199.result()) +SketchConstraintCoincidence_315 = Sketch_18.setCoincident( + SketchPoint_45.coordinates(), SketchLine_199.result() +) SketchConstraintCoincidence_315.setName("SketchConstraintCoincidence_144") -SketchConstraintMiddle_15 = Sketch_18.setMiddlePoint(SketchPoint_45.coordinates(), SketchLine_199.result()) -SketchConstraintCoincidence_316 = Sketch_18.setCoincident(SketchPoint_45.coordinates(), SketchLine_195.result()) +SketchConstraintMiddle_15 = Sketch_18.setMiddlePoint( + SketchPoint_45.coordinates(), SketchLine_199.result() +) +SketchConstraintCoincidence_316 = Sketch_18.setCoincident( + SketchPoint_45.coordinates(), SketchLine_195.result() +) 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/Modified_Face&Extrusion_1_1/To_Face")) +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/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") @@ -1730,7 +3101,15 @@ SketchLine_201 = Sketch_19.addLine(29, 5, 21, 5) SketchLine_201.setName("SketchLine_96") SketchLine_201.result().setName("SketchLine_96") SketchLine_201.setAuxiliary(True) -SketchArc_42 = Sketch_19.addArc(25, 8, 21.53774043054522, 4.392679848735523, 28.46225956945478, 4.392679848735522, False) +SketchArc_42 = Sketch_19.addArc( + 25, + 8, + 21.53774043054522, + 4.392679848735523, + 28.46225956945478, + 4.392679848735522, + False, +) SketchArc_42.setName("SketchArc_22") SketchArc_42.result().setName("SketchArc_22") SketchArc_42.results()[1].setName("SketchArc_22_2") @@ -1744,15 +3123,23 @@ SketchLine_204 = Sketch_19.addLine(29, 0, 29, 5) SketchLine_204.setName("SketchLine_101") SketchLine_204.result().setName("SketchLine_101") SketchLine_204.setAuxiliary(True) -SketchConstraintCoincidence_317 = Sketch_19.setCoincident(SketchLine_204.endPoint(), SketchLine_201.startPoint()) +SketchConstraintCoincidence_317 = Sketch_19.setCoincident( + SketchLine_204.endPoint(), SketchLine_201.startPoint() +) SketchConstraintCoincidence_317.setName("SketchConstraintCoincidence_147") SketchLine_205 = Sketch_19.addLine(21, 5, 21, 0) SketchLine_205.setAuxiliary(True) -SketchConstraintCoincidence_318 = Sketch_19.setCoincident(SketchLine_201.endPoint(), SketchLine_205.startPoint()) +SketchConstraintCoincidence_318 = Sketch_19.setCoincident( + SketchLine_201.endPoint(), SketchLine_205.startPoint() +) SketchConstraintCoincidence_318.setName("SketchConstraintCoincidence_148") -SketchConstraintCoincidence_319 = Sketch_19.setCoincident(SketchLine_205.endPoint(), SketchLine_202.startPoint()) +SketchConstraintCoincidence_319 = Sketch_19.setCoincident( + SketchLine_205.endPoint(), SketchLine_202.startPoint() +) SketchConstraintCoincidence_319.setName("SketchConstraintCoincidence_149") -SketchConstraintCoincidence_320 = Sketch_19.setCoincident(SketchLine_202.endPoint(), SketchLine_204.startPoint()) +SketchConstraintCoincidence_320 = Sketch_19.setCoincident( + SketchLine_202.endPoint(), SketchLine_204.startPoint() +) SketchConstraintCoincidence_320.setName("SketchConstraintCoincidence_150") SketchConstraintHorizontal_42 = Sketch_19.setHorizontal(SketchLine_201.result()) SketchConstraintHorizontal_42.setName("SketchConstraintHorizontal_21") @@ -1761,12 +3148,16 @@ SketchConstraintHorizontal_43 = Sketch_19.setHorizontal(SketchLine_202.result()) SketchConstraintHorizontal_43.setName("SketchConstraintHorizontal_22") SketchConstraintVertical_36 = Sketch_19.setVertical(SketchLine_204.result()) SketchPoint_46 = Sketch_19.addPoint(21, 7.5) -SketchConstraintCoincidence_321 = Sketch_19.setCoincident(SketchLine_205.result(), SketchPoint_46.coordinates()) +SketchConstraintCoincidence_321 = Sketch_19.setCoincident( + SketchLine_205.result(), SketchPoint_46.coordinates() +) SketchConstraintCoincidence_321.setName("SketchConstraintCoincidence_151") SketchConstraintRigid_23 = Sketch_19.setFixed(SketchPoint_46.result()) SketchConstraintRigid_23.setName("SketchConstraintRigid_18") SketchPoint_47 = Sketch_19.addPoint(29, 7.5) -SketchConstraintCoincidence_322 = Sketch_19.setCoincident(SketchLine_204.result(), SketchPoint_47.coordinates()) +SketchConstraintCoincidence_322 = Sketch_19.setCoincident( + SketchLine_204.result(), SketchPoint_47.coordinates() +) SketchConstraintCoincidence_322.setName("SketchConstraintCoincidence_152") SketchConstraintRigid_24 = Sketch_19.setFixed(SketchPoint_47.result()) SketchConstraintRigid_24.setName("SketchConstraintRigid_20") @@ -1775,7 +3166,9 @@ SketchConstraintLength_32.setName("SketchConstraintLength_16") SketchLine_206 = Sketch_19.addLine(0, 0, 45.5, 0) SketchLine_206.setName("SketchLine_102") SketchLine_206.result().setName("SketchLine_102") -SketchConstraintCoincidence_323 = Sketch_19.setCoincident(SketchLine_205.endPoint(), SketchLine_206.result()) +SketchConstraintCoincidence_323 = Sketch_19.setCoincident( + SketchLine_205.endPoint(), SketchLine_206.result() +) SketchConstraintCoincidence_323.setName("SketchConstraintCoincidence_153") SketchConstraintRigid_25 = Sketch_19.setFixed(SketchLine_206.result()) SketchConstraintRigid_25.setName("SketchConstraintRigid_21") @@ -1784,88 +3177,176 @@ SketchArc_43.setName("SketchArc_19") SketchArc_43.result().setName("SketchArc_19") SketchArc_43.results()[1].setName("SketchArc_19_2") SketchArc_43.setAuxiliary(True) -SketchConstraintCoincidence_324 = Sketch_19.setCoincident(SketchLine_201.endPoint(), SketchArc_43.startPoint()) +SketchConstraintCoincidence_324 = Sketch_19.setCoincident( + SketchLine_201.endPoint(), SketchArc_43.startPoint() +) SketchConstraintCoincidence_324.setName("SketchConstraintCoincidence_154") -SketchConstraintCoincidence_325 = Sketch_19.setCoincident(SketchLine_205.startPoint(), SketchArc_43.startPoint()) +SketchConstraintCoincidence_325 = Sketch_19.setCoincident( + SketchLine_205.startPoint(), SketchArc_43.startPoint() +) SketchConstraintCoincidence_325.setName("SketchConstraintCoincidence_155") -SketchConstraintCoincidence_326 = Sketch_19.setCoincident(SketchLine_201.startPoint(), SketchArc_43.endPoint()) +SketchConstraintCoincidence_326 = Sketch_19.setCoincident( + SketchLine_201.startPoint(), SketchArc_43.endPoint() +) SketchConstraintCoincidence_326.setName("SketchConstraintCoincidence_156") -SketchConstraintCoincidence_327 = Sketch_19.setCoincident(SketchLine_204.endPoint(), SketchArc_43.endPoint()) +SketchConstraintCoincidence_327 = Sketch_19.setCoincident( + SketchLine_204.endPoint(), SketchArc_43.endPoint() +) SketchConstraintCoincidence_327.setName("SketchConstraintCoincidence_157") SketchConstraintRadius_17 = Sketch_19.setRadius(SketchArc_43.results()[1], 5) SketchLine_207 = Sketch_19.addLine(1, 0, 1, 1.8) SketchLine_207.setName("SketchLine_103") SketchLine_207.result().setName("SketchLine_103") -SketchConstraintCoincidence_328 = Sketch_19.setCoincident(SketchLine_207.startPoint(), SketchLine_206.result()) +SketchConstraintCoincidence_328 = Sketch_19.setCoincident( + SketchLine_207.startPoint(), SketchLine_206.result() +) SketchConstraintCoincidence_328.setName("SketchConstraintCoincidence_158") SketchLine_208 = Sketch_19.addLine(1, 1.8, 8, 3.389761862250954) SketchLine_208.setName("SketchLine_104") SketchLine_208.result().setName("SketchLine_104") -SketchConstraintCoincidence_329 = Sketch_19.setCoincident(SketchLine_207.endPoint(), SketchLine_208.startPoint()) +SketchConstraintCoincidence_329 = Sketch_19.setCoincident( + SketchLine_207.endPoint(), SketchLine_208.startPoint() +) SketchConstraintCoincidence_329.setName("SketchConstraintCoincidence_159") SketchLine_209 = Sketch_19.addLine(8, 3.389761862250954, 8, 0) SketchLine_209.setName("SketchLine_105") SketchLine_209.result().setName("SketchLine_105") -SketchConstraintCoincidence_330 = Sketch_19.setCoincident(SketchLine_208.endPoint(), SketchLine_209.startPoint()) +SketchConstraintCoincidence_330 = Sketch_19.setCoincident( + SketchLine_208.endPoint(), SketchLine_209.startPoint() +) SketchConstraintCoincidence_330.setName("SketchConstraintCoincidence_160") SketchLine_210 = Sketch_19.addLine(8, 0, 1, 0) SketchLine_210.setName("SketchLine_106") SketchLine_210.result().setName("SketchLine_106") -SketchConstraintCoincidence_331 = Sketch_19.setCoincident(SketchLine_209.endPoint(), SketchLine_210.startPoint()) +SketchConstraintCoincidence_331 = Sketch_19.setCoincident( + SketchLine_209.endPoint(), SketchLine_210.startPoint() +) SketchConstraintCoincidence_331.setName("SketchConstraintCoincidence_161") -SketchConstraintCoincidence_332 = Sketch_19.setCoincident(SketchLine_207.startPoint(), SketchLine_210.endPoint()) +SketchConstraintCoincidence_332 = Sketch_19.setCoincident( + SketchLine_207.startPoint(), SketchLine_210.endPoint() +) SketchConstraintCoincidence_332.setName("SketchConstraintCoincidence_162") -SketchConstraintCoincidence_333 = Sketch_19.setCoincident(SketchLine_210.startPoint(), SketchLine_206.result()) +SketchConstraintCoincidence_333 = Sketch_19.setCoincident( + SketchLine_210.startPoint(), SketchLine_206.result() +) SketchConstraintCoincidence_333.setName("SketchConstraintCoincidence_163") SketchConstraintVertical_37 = Sketch_19.setVertical(SketchLine_209.result()) SketchConstraintVertical_38 = Sketch_19.setVertical(SketchLine_207.result()) SketchConstraintLength_33 = Sketch_19.setLength(SketchLine_210.result(), 7) SketchConstraintLength_33.setName("SketchConstraintLength_17") -SketchConstraintDistance_33 = Sketch_19.setDistance(SketchLine_207.result(), SketchLine_206.startPoint(), 1, False) +SketchConstraintDistance_33 = Sketch_19.setDistance( + SketchLine_207.result(), SketchLine_206.startPoint(), 1, False +) SketchConstraintLength_34 = Sketch_19.setLength(SketchLine_207.result(), 1.8) SketchConstraintLength_34.setName("SketchConstraintLength_18") -SketchArc_44 = Sketch_19.addArc(21.31772863153846, 4.163450069699051, 21.53774043054522, 4.392679848735523, 21, 4.163450069699051, False) -SketchArc_45 = Sketch_19.addArc(25, 8, 21.53774043054522, 4.392679848735523, 29, 5, False) +SketchArc_44 = Sketch_19.addArc( + 21.31772863153846, + 4.163450069699051, + 21.53774043054522, + 4.392679848735523, + 21, + 4.163450069699051, + False, +) +SketchArc_45 = Sketch_19.addArc( + 25, 8, 21.53774043054522, 4.392679848735523, 29, 5, False +) SketchArc_45.setName("SketchArc_20") SketchArc_45.result().setName("SketchArc_20") SketchArc_45.results()[1].setName("SketchArc_20_2") SketchArc_45.setAuxiliary(True) -SketchConstraintCoincidence_334 = Sketch_19.setCoincident(SketchArc_44.startPoint(), SketchArc_45.startPoint()) +SketchConstraintCoincidence_334 = Sketch_19.setCoincident( + SketchArc_44.startPoint(), SketchArc_45.startPoint() +) SketchConstraintCoincidence_334.setName("SketchConstraintCoincidence_164") -SketchConstraintCoincidence_335 = Sketch_19.setCoincident(SketchArc_44.endPoint(), SketchLine_200.startPoint()) +SketchConstraintCoincidence_335 = Sketch_19.setCoincident( + SketchArc_44.endPoint(), SketchLine_200.startPoint() +) SketchConstraintCoincidence_335.setName("SketchConstraintCoincidence_165") -SketchConstraintTangent_25 = Sketch_19.setTangent(SketchArc_44.results()[1], SketchLine_200.result()) -SketchConstraintTangent_26 = Sketch_19.setTangent(SketchArc_44.results()[1], SketchArc_45.results()[1]) -SketchConstraintCoincidence_336 = Sketch_19.setCoincident(SketchLine_205.endPoint(), SketchLine_200.endPoint()) +SketchConstraintTangent_25 = Sketch_19.setTangent( + SketchArc_44.results()[1], SketchLine_200.result() +) +SketchConstraintTangent_26 = Sketch_19.setTangent( + SketchArc_44.results()[1], SketchArc_45.results()[1] +) +SketchConstraintCoincidence_336 = Sketch_19.setCoincident( + SketchLine_205.endPoint(), SketchLine_200.endPoint() +) SketchConstraintCoincidence_336.setName("SketchConstraintCoincidence_166") -SketchConstraintCoincidence_337 = Sketch_19.setCoincident(SketchArc_43.endPoint(), SketchArc_45.endPoint()) +SketchConstraintCoincidence_337 = Sketch_19.setCoincident( + SketchArc_43.endPoint(), SketchArc_45.endPoint() +) SketchConstraintCoincidence_337.setName("SketchConstraintCoincidence_167") -SketchConstraintTangent_27 = Sketch_19.setTangent(SketchArc_43.results()[1], SketchArc_45.results()[1]) -SketchConstraintCoincidence_338 = Sketch_19.setCoincident(SketchLine_200.startPoint(), SketchLine_205.result()) +SketchConstraintTangent_27 = Sketch_19.setTangent( + SketchArc_43.results()[1], SketchArc_45.results()[1] +) +SketchConstraintCoincidence_338 = Sketch_19.setCoincident( + SketchLine_200.startPoint(), SketchLine_205.result() +) SketchConstraintCoincidence_338.setName("SketchConstraintCoincidence_168") -SketchConstraintCoincidence_339 = Sketch_19.setCoincident(SketchArc_45.startPoint(), SketchArc_43.results()[1]) +SketchConstraintCoincidence_339 = Sketch_19.setCoincident( + SketchArc_45.startPoint(), SketchArc_43.results()[1] +) SketchConstraintCoincidence_339.setName("SketchConstraintCoincidence_169") -SketchArc_46 = Sketch_19.addArc(28.68227136846154, 4.163450069699049, 29, 4.163450069699049, 28.46225956945478, 4.392679848735522, False) -SketchConstraintCoincidence_340 = Sketch_19.setCoincident(SketchArc_46.startPoint(), SketchLine_203.endPoint()) +SketchArc_46 = Sketch_19.addArc( + 28.68227136846154, + 4.163450069699049, + 29, + 4.163450069699049, + 28.46225956945478, + 4.392679848735522, + False, +) +SketchConstraintCoincidence_340 = Sketch_19.setCoincident( + SketchArc_46.startPoint(), SketchLine_203.endPoint() +) SketchConstraintCoincidence_340.setName("SketchConstraintCoincidence_170") -SketchConstraintCoincidence_341 = Sketch_19.setCoincident(SketchArc_46.endPoint(), SketchArc_42.endPoint()) +SketchConstraintCoincidence_341 = Sketch_19.setCoincident( + SketchArc_46.endPoint(), SketchArc_42.endPoint() +) SketchConstraintCoincidence_341.setName("SketchConstraintCoincidence_171") -SketchConstraintTangent_28 = Sketch_19.setTangent(SketchArc_46.results()[1], SketchArc_42.results()[1]) -SketchConstraintTangent_29 = Sketch_19.setTangent(SketchArc_46.results()[1], SketchLine_203.result()) -SketchConstraintCoincidence_342 = Sketch_19.setCoincident(SketchArc_45.startPoint(), SketchArc_42.startPoint()) +SketchConstraintTangent_28 = Sketch_19.setTangent( + SketchArc_46.results()[1], SketchArc_42.results()[1] +) +SketchConstraintTangent_29 = Sketch_19.setTangent( + SketchArc_46.results()[1], SketchLine_203.result() +) +SketchConstraintCoincidence_342 = Sketch_19.setCoincident( + SketchArc_45.startPoint(), SketchArc_42.startPoint() +) SketchConstraintCoincidence_342.setName("SketchConstraintCoincidence_172") -SketchConstraintCoincidence_343 = Sketch_19.setCoincident(SketchLine_204.startPoint(), SketchLine_203.startPoint()) +SketchConstraintCoincidence_343 = Sketch_19.setCoincident( + SketchLine_204.startPoint(), SketchLine_203.startPoint() +) SketchConstraintCoincidence_343.setName("SketchConstraintCoincidence_173") -SketchConstraintTangent_30 = Sketch_19.setTangent(SketchArc_45.results()[1], SketchArc_42.results()[1]) -SketchConstraintCoincidence_344 = Sketch_19.setCoincident(SketchArc_42.endPoint(), SketchArc_45.results()[1]) +SketchConstraintTangent_30 = Sketch_19.setTangent( + SketchArc_45.results()[1], SketchArc_42.results()[1] +) +SketchConstraintCoincidence_344 = Sketch_19.setCoincident( + SketchArc_42.endPoint(), SketchArc_45.results()[1] +) SketchConstraintCoincidence_344.setName("SketchConstraintCoincidence_174") -SketchConstraintCoincidence_345 = Sketch_19.setCoincident(SketchLine_203.endPoint(), SketchLine_204.result()) +SketchConstraintCoincidence_345 = Sketch_19.setCoincident( + SketchLine_203.endPoint(), SketchLine_204.result() +) SketchConstraintCoincidence_345.setName("SketchConstraintCoincidence_175") 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/Modified_Face&Sketch_1/SketchLine_1")) +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/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) @@ -1875,26 +3356,70 @@ SketchLine_211.setName("SketchLine_109") SketchLine_211.result().setName("SketchLine_109") SketchConstraintRigid_26 = Sketch_20.setFixed(SketchLine_211.result()) SketchConstraintRigid_26.setName("SketchConstraintRigid_22") -SketchConstraintCoincidence_346 = Sketch_20.setCoincident(SketchPoint_48.coordinates(), SketchLine_211.result()) +SketchConstraintCoincidence_346 = Sketch_20.setCoincident( + SketchPoint_48.coordinates(), SketchLine_211.result() +) SketchConstraintCoincidence_346.setName("SketchConstraintCoincidence_176") -SketchConstraintMiddle_16 = Sketch_20.setMiddlePoint(SketchLine_211.result(), SketchPoint_48.coordinates()) +SketchConstraintMiddle_16 = Sketch_20.setMiddlePoint( + SketchLine_211.result(), SketchPoint_48.coordinates() +) SketchLine_212 = Sketch_20.addLine(0, 6, 17.31036191565843, 6) SketchLine_212.setName("SketchLine_110") SketchLine_212.result().setName("SketchLine_110") SketchLine_212.setAuxiliary(True) -SketchConstraintCoincidence_347 = Sketch_20.setCoincident(SketchPoint_48.coordinates(), SketchLine_212.startPoint()) +SketchConstraintCoincidence_347 = Sketch_20.setCoincident( + SketchPoint_48.coordinates(), SketchLine_212.startPoint() +) SketchConstraintCoincidence_347.setName("SketchConstraintCoincidence_177") SketchConstraintHorizontal_44 = Sketch_20.setHorizontal(SketchLine_212.result()) SketchConstraintHorizontal_44.setName("SketchConstraintHorizontal_23") -SketchConstraintCoincidence_348 = Sketch_20.setCoincident(SketchCircle_2.center(), SketchLine_212.result()) +SketchConstraintCoincidence_348 = Sketch_20.setCoincident( + SketchCircle_2.center(), SketchLine_212.result() +) SketchConstraintCoincidence_348.setName("SketchConstraintCoincidence_178") -SketchConstraintDistance_34 = Sketch_20.setDistance(SketchLine_211.result(), SketchCircle_2.center(), 12, False) +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/Face-SketchCircle_1_2r_wire")], 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/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_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() @@ -1916,4 +3441,4 @@ model.testNbSubShapes(Rotation_2, GeomAPI_Shape.EDGE, [796]) model.testNbSubShapes(Rotation_2, GeomAPI_Shape.VERTEX, [1592]) model.testResultsVolumes(Rotation_2, [1875.575358102468499055248685181]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.models/coronavirus.py b/test.models/coronavirus.py index 211d412b0..5d4e7d672 100644 --- a/test.models/coronavirus.py +++ b/test.models/coronavirus.py @@ -1,10 +1,10 @@ #!/usr/bin/env python -#============================================================================= +# ============================================================================= # This script was written in march and april 2020 during the beginning in France # of the coronavirus pandemia. It's generating a parametric geometric model of the virus # in Shaper. # Author : Raphaël MARC, EDF R&D France, with the precious help of Artem ZHIDKOV from OpenCascade company. -#============================================================================= +# ============================================================================= import numpy as np from salome.shaper import model from SketchAPI import * @@ -14,11 +14,11 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -#============================================================================= +# ============================================================================= # Paramètres du modèle SHAPER : -#============================================================================= +# ============================================================================= Rext = model.addParameter(Part_1_doc, "Rext", "10") -#print(Rext.value()) +# print(Rext.value()) model.addParameter(Part_1_doc, "eps", "0.5") Rint = model.addParameter(Part_1_doc, "Rint", "Rext-eps") model.addParameter(Part_1_doc, "marge", "0.3") @@ -33,43 +33,53 @@ coef2 = model.addParameter(Part_1_doc, "coef2", "1.2") fillet_radius_top = model.addParameter(Part_1_doc, "fillet_radius_top", "0.12") fillet_radius_bottom = model.addParameter(Part_1_doc, "fillet_radius_bottom", "0.8") # méthodes dispo sur les paramètres : .value() et .setValue() -bruit = 0.012 # bruit dans la position des tubes (qui est régulière si pas de bruit) +bruit = 0.012 # bruit dans la position des tubes (qui est régulière si pas de bruit) -#============================================================================= +# ============================================================================= # Début réel de la création du modèle géométrique SHAPER : -#============================================================================= -Sphere_ext = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "Rext") +# ============================================================================= +Sphere_ext = model.addSphere( + Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "Rext" +) Sphere_ext.setName("Sphere_ext") # Création de num_pts points uniformément répartis sur la sphère, qui serviront à positionner les tubes : num_pts = 50 indices = np.arange(0, num_pts, dtype=float) + 0.5 -phi0 = np.arccos(1 - 2*indices/num_pts) +phi0 = np.arccos(1 - 2 * indices / num_pts) theta0 = np.pi * (1 + 5**0.5) * indices # ajout de bruit Gaussien pour rendre légèrement aléatoire les positions des tubes : -bruit=np.pi*np.random.normal(0, bruit, num_pts) # std = np.pi*0.05 -phi = phi0+bruit -theta = theta0+bruit -#print(max(np.abs((phi-phi0)/phi0))) -#print(max(np.abs((theta-theta0)/theta0))) - -listeX, listeY, listeZ = Rint_m.value()*np.cos(theta) * np.sin(phi), \ - Rint_m.value()*np.sin(theta) * np.sin(phi), \ - Rint_m.value()*np.cos(phi); -x,y,z = (listeX[0], listeY[0], listeZ[0]) -#============================================================================= +bruit = np.pi * np.random.normal(0, bruit, num_pts) # std = np.pi*0.05 +phi = phi0 + bruit +theta = theta0 + bruit +# print(max(np.abs((phi-phi0)/phi0))) +# print(max(np.abs((theta-theta0)/theta0))) + +listeX, listeY, listeZ = ( + Rint_m.value() * np.cos(theta) * np.sin(phi), + Rint_m.value() * np.sin(theta) * np.sin(phi), + Rint_m.value() * np.cos(phi), +) +x, y, z = (listeX[0], listeY[0], listeZ[0]) +# ============================================================================= # On construit le premier tube que l'on copiera puis rotations ensuite : # 3 sketchs successifs composés de 2 cercles // puis un filling (remplissage) -#============================================================================= -Point_init = model.addPoint(Part_1_doc, x,y,z) -Axis = model.addAxis(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), Point_init.result()) +# ============================================================================= +Point_init = model.addPoint(Part_1_doc, x, y, z) +Axis = model.addAxis( + Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), Point_init.result() +) Plane_1 = model.addPlane(Part_1_doc, Axis.result(), Point_init.result(), True) Sketch_1 = model.addSketch(Part_1_doc, Plane_1.result()) SketchProjection_1 = Sketch_1.addProjection(Point_init.result(), False) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1_int = Sketch_1.addCircle(0, 0, 1.1) -Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1_int.center()) -SketchCircle_1_ext = Sketch_1.addCircle(0, 0, 1.) -Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1_ext.center()) +Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1_int.center() +) +SketchCircle_1_ext = Sketch_1.addCircle(0, 0, 1.0) +Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1_ext.center() +) Sketch_1.setRadius(SketchCircle_1_int.results()[1], "Rtube") Sketch_1.setRadius(SketchCircle_1_ext.results()[1], "Rtube+ep_tube") model.do() @@ -79,9 +89,13 @@ Sketch_2 = model.addSketch(Part_1_doc, Plane_2.result()) SketchProjection_2 = Sketch_2.addProjection(Point_init.result(), False) SketchPoint_2 = SketchProjection_2.createdFeature() SketchCircle_2_int = Sketch_2.addCircle(0, 0, 0.4) -Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchCircle_2_int.center()) +Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchCircle_2_int.center() +) SketchCircle_2_ext = Sketch_2.addCircle(0, 0, 0.7) -Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchCircle_2_ext.center()) +Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_2).coordinates(), SketchCircle_2_ext.center() +) Sketch_2.setRadius(SketchCircle_2_int.results()[1], "Rtube*coef1") Sketch_2.setRadius(SketchCircle_2_ext.results()[1], "(Rtube+ep_tube)*coef1") model.do() @@ -94,57 +108,131 @@ SketchCircle_3_int = Sketch_3.addCircle(0, 0, 0.8) SketchCircle_3_ext = Sketch_3.addCircle(0, 0, 1.1) Sketch_3.setRadius(SketchCircle_3_int.results()[1], "Rtube*coef2") Sketch_3.setRadius(SketchCircle_3_ext.results()[1], "(Rtube+ep_tube)*coef2") -Sketch_3.setCoincident(SketchCircle_3_ext.center(), SketchAPI_Point(SketchPoint_3).coordinates()) -Sketch_3.setCoincident(SketchCircle_3_int.center(), SketchAPI_Point(SketchPoint_3).coordinates()) +Sketch_3.setCoincident( + SketchCircle_3_ext.center(), SketchAPI_Point(SketchPoint_3).coordinates() +) +Sketch_3.setCoincident( + SketchCircle_3_int.center(), SketchAPI_Point(SketchPoint_3).coordinates() +) model.do() -Filling_1_objects = \ - [model.selection(Sketch_1.defaultResult(), SketchCircle_1_int.defaultResult().shape()), \ - model.selection(Sketch_2.defaultResult(), SketchCircle_2_int.defaultResult().shape()), \ - model.selection(Sketch_3.defaultResult(), SketchCircle_3_int.defaultResult().shape())] -Filling_1 = model.addFilling(Part_1_doc, Filling_1_objects, "curve_info", 2, 5, 0, 0.0001, 0.0001, False) +Filling_1_objects = [ + model.selection( + Sketch_1.defaultResult(), SketchCircle_1_int.defaultResult().shape() + ), + model.selection( + Sketch_2.defaultResult(), SketchCircle_2_int.defaultResult().shape() + ), + model.selection( + Sketch_3.defaultResult(), SketchCircle_3_int.defaultResult().shape() + ), +] +Filling_1 = model.addFilling( + Part_1_doc, Filling_1_objects, "curve_info", 2, 5, 0, 0.0001, 0.0001, False +) Copy_filling_1 = model.addCopy(Part_1_doc, [Filling_1.result()], 1) Copy_filling_1.result().setName("Filling_1_copie") -Filling_2_objects = \ - [model.selection(Sketch_1.defaultResult(), SketchCircle_1_ext.defaultResult().shape()), \ - model.selection(Sketch_2.defaultResult(), SketchCircle_2_ext.defaultResult().shape()), \ - model.selection(Sketch_3.defaultResult(), SketchCircle_3_ext.defaultResult().shape())] -Filling_2 = model.addFilling(Part_1_doc, Filling_2_objects, "curve_info", 2, 5, 0, 0.0001, 0.0001, False) +Filling_2_objects = [ + model.selection( + Sketch_1.defaultResult(), SketchCircle_1_ext.defaultResult().shape() + ), + model.selection( + Sketch_2.defaultResult(), SketchCircle_2_ext.defaultResult().shape() + ), + model.selection( + Sketch_3.defaultResult(), SketchCircle_3_ext.defaultResult().shape() + ), +] +Filling_2 = model.addFilling( + Part_1_doc, Filling_2_objects, "curve_info", 2, 5, 0, 0.0001, 0.0001, False +) -Filling_3 = model.addFilling(Part_1_doc, \ - [model.selection(Sketch_1.defaultResult(), SketchCircle_1_int.defaultResult().shape()), \ - model.selection(Sketch_1.defaultResult(), SketchCircle_1_ext.defaultResult().shape())], \ - "curve_info", 2, 5, 0, 0.0001, 0.0001, False) +Filling_3 = model.addFilling( + Part_1_doc, + [ + model.selection( + Sketch_1.defaultResult(), SketchCircle_1_int.defaultResult().shape() + ), + model.selection( + Sketch_1.defaultResult(), SketchCircle_1_ext.defaultResult().shape() + ), + ], + "curve_info", + 2, + 5, + 0, + 0.0001, + 0.0001, + False, +) -Filling_4 = model.addFilling(Part_1_doc, \ - [model.selection(Sketch_3.defaultResult(), SketchCircle_3_int.defaultResult().shape()), \ - model.selection(Sketch_3.defaultResult(), SketchCircle_3_ext.defaultResult().shape())], \ - "curve_info", 2, 5, 0, 0.0001, 0.0001, False) +Filling_4 = model.addFilling( + Part_1_doc, + [ + model.selection( + Sketch_3.defaultResult(), SketchCircle_3_int.defaultResult().shape() + ), + model.selection( + Sketch_3.defaultResult(), SketchCircle_3_ext.defaultResult().shape() + ), + ], + "curve_info", + 2, + 5, + 0, + 0.0001, + 0.0001, + False, +) -Face_inf = model.addFace(Part_1_doc, [model.selection(Sketch_1.defaultResult(), SketchCircle_1_int.defaultResult().shape())]) +Face_inf = model.addFace( + Part_1_doc, + [ + model.selection( + Sketch_1.defaultResult(), SketchCircle_1_int.defaultResult().shape() + ) + ], +) -Face_sup = model.addFace(Part_1_doc, [model.selection(Sketch_3.defaultResult(), SketchCircle_3_int.defaultResult().shape())]) +Face_sup = model.addFace( + Part_1_doc, + [ + model.selection( + Sketch_3.defaultResult(), SketchCircle_3_int.defaultResult().shape() + ) + ], +) -liste_tube_ext = [Filling_1.result(), Filling_2.result(), Filling_3.result(), Filling_4.result()] +liste_tube_ext = [ + Filling_1.result(), + Filling_2.result(), + Filling_3.result(), + Filling_4.result(), +] Solid_tube_ext = model.addSolid(Part_1_doc, liste_tube_ext) # Recherche de la face du tube sur laquelle faire un congé de raccordement (fillet) : face = Filling_4.defaultResult().shape().face() exp = GeomAPI_ShapeExplorer(Solid_tube_ext.defaultResult().shape(), GeomAPI_Shape.FACE) while exp.more(): - cur = exp.current().face() - if face.isEqual(cur) : # and face.isSameGeometry(cur): - res = cur - break - exp.next() -#print(type(res)) -Fillet_1 = model.addFillet(Part_1_doc, [model.selection(Solid_tube_ext.defaultResult(), res)], "fillet_radius_top", keepSubResults = False) + cur = exp.current().face() + if face.isEqual(cur): # and face.isSameGeometry(cur): + res = cur + break + exp.next() +# print(type(res)) +Fillet_1 = model.addFillet( + Part_1_doc, + [model.selection(Solid_tube_ext.defaultResult(), res)], + "fillet_radius_top", + keepSubResults=False, +) Solid_tube_ext = Fillet_1 -#============================================================================= +# ============================================================================= # Création du tube intérieur avec lequel on va couper la sphère extérieure : -#============================================================================= +# ============================================================================= liste_tube_int = [Copy_filling_1.result(), Face_inf.result(), Face_sup.result()] Solid_tube_int = model.addSolid(Part_1_doc, liste_tube_int) model.do() @@ -159,27 +247,41 @@ Copie_tube_ext.result().setName("Tube_ext_1") Copie_tube_int = model.addCopy(Part_1_doc, [Solid_tube_int.result()], 1) Copie_tube_int.result().setName("Tube_int_1") -#============================================================================= +# ============================================================================= # Création d'un congé de raccordement à la base du premier tube : -#============================================================================= +# ============================================================================= # Calcul de l'intersection entre tube ext. et sphère de manière à identifier l'arête sur # laquelle on va faire un congé (fillet) : -Intersection_1 = model.addIntersection(Part_1_doc, \ - [model.selection("SOLID", "Sphere_ext"), model.selection("SOLID", "Solid_tube_ext")], keepSubResults = True) -Recover_1 = model.addRecover(Part_1_doc, Intersection_1, [Sphere_ext.result(), Solid_tube_ext.result()]) -Solid_tube_ext = Recover_1.results()[0] #.setName("Tube_ext_1") -Sphere_ext = Recover_1.results()[1] #.setName("Sphere_ext") +Intersection_1 = model.addIntersection( + Part_1_doc, + [ + model.selection("SOLID", "Sphere_ext"), + model.selection("SOLID", "Solid_tube_ext"), + ], + keepSubResults=True, +) +Recover_1 = model.addRecover( + Part_1_doc, Intersection_1, [Sphere_ext.result(), Solid_tube_ext.result()] +) +Solid_tube_ext = Recover_1.results()[0] # .setName("Tube_ext_1") +Sphere_ext = Recover_1.results()[1] # .setName("Sphere_ext") # Coupe de la sphère par tube int. et fusion avec tube ext. : -Cut_1 = model.addCut(Part_1_doc, [Sphere_ext], [Solid_tube_int.result()], keepSubResults = False) -Fuse_1 = model.addFuse(Part_1_doc, [Solid_tube_ext, Cut_1.result()], [], keepSubResults = False) +Cut_1 = model.addCut( + Part_1_doc, [Sphere_ext], [Solid_tube_int.result()], keepSubResults=False +) +Fuse_1 = model.addFuse( + Part_1_doc, [Solid_tube_ext, Cut_1.result()], [], keepSubResults=False +) model.do() -#======================================= + + +# ======================================= # Fonction de calcul d'un rayon sur un cercle ou arc de cercle à partir de 3 points : # 2 points extrêmes et point milieu. Elle nous sert à sélectionner le cercle extérieur # de l'intersection tube-sphère, qui correspond au cercle sur lequel on veut faire # un congé de raccordement (fillet). def radius(theEdge): -#======================================= + # ======================================= p1 = theEdge.firstPoint() p2 = theEdge.middlePoint() p3 = theEdge.lastPoint() @@ -187,111 +289,129 @@ def radius(theEdge): dir32 = GeomAPI_Dir(p3.xyz().decreased(p2.xyz())) ang = 0.5 * dir12.angle(dir32) return 0.5 * p1.distance(p2) / cos(ang) -#======================================= -maxRad=-999 + +# ======================================= + +maxRad = -999 for i in range(Intersection_1.result().numberOfSubs()): - # The shapes are not circles, but rather NURBS : - rad = radius(GeomAPI_Edge(Intersection_1.result().subResult(i).resultSubShapePair()[1])) - if rad > maxRad: - imax=i - maxRad = rad -#print(Intersection_1.result().subResult(imax).name()) + # The shapes are not circles, but rather NURBS : + rad = radius( + GeomAPI_Edge(Intersection_1.result().subResult(i).resultSubShapePair()[1]) + ) + if rad > maxRad: + imax = i + maxRad = rad +# print(Intersection_1.result().subResult(imax).name()) edge = GeomAPI_Edge(Intersection_1.result().subResult(imax).resultSubShapePair()[1]) exp = GeomAPI_ShapeExplorer(Fuse_1.defaultResult().shape(), GeomAPI_Shape.EDGE) while exp.more(): - cur = exp.current().edge() - if edge.isEqual(cur) : # and edge.isSameGeometry(cur): - resEdge = cur - break - exp.next() -#print(type(res)) -Sphere_ext = model.addFillet(Part_1_doc, [model.selection(Fuse_1.defaultResult(), resEdge)], "fillet_radius_bottom", keepSubResults = False) -#Sphere_ext = Fillet_2 + cur = exp.current().edge() + if edge.isEqual(cur): # and edge.isSameGeometry(cur): + resEdge = cur + break + exp.next() +# print(type(res)) +Sphere_ext = model.addFillet( + Part_1_doc, + [model.selection(Fuse_1.defaultResult(), resEdge)], + "fillet_radius_bottom", + keepSubResults=False, +) +# Sphere_ext = Fillet_2 Sphere_ext.result().setName("Sphere_ext") model.do() -#============================================================================= +# ============================================================================= # Fin création congé de racc. à la base du premier tube. -#============================================================================= -f2=Sphere_ext # mémorisation pour rangement dans folder à la fin du script +# ============================================================================= +f2 = Sphere_ext # mémorisation pour rangement dans folder à la fin du script RemoveResults_1 = model.addRemoveResults(Part_1_doc, [Fillet_1.result()]) RemoveResults_2 = model.addRemoveResults(Part_1_doc, [Intersection_1.result()]) model.do() -#============================================================================= +# ============================================================================= # Boucle de répétition des tubes autour de la sphère : -#============================================================================= -i=1 -CutTools = [] # liste pour accumulation des tubes int. et cut de la sphère ext. par tous ces tubes int. -IntTools = [Sphere_ext.result()] # liste pour accumulation de la sphère ext. et de tous les tubes ext. et calcul d'intersection entre tous ces objets (pour déterminer les arêtes sur lesquelles on mettra des fillets). -for x,y,z in zip(listeX[1:], listeY[1:], listeZ[1:]): - i += 1 -# on parcourt les listes à partir du 2ème élément car le premier point (Point_init) a déjà été créé. - CurPoint = model.addPoint(Part_1_doc, x,y,z) - if i==2: - f3 = CurPoint # mémorisation de la feature pour insertion ultérieure dans les dossiers (folders) -# print("Boucle",i,":") #," : (",round(x,1), round(y,1), round(z,1),")") - Copie_tube_ext = model.addCopy(Part_1_doc, [Solid_tube_ext], 1) - Copie_tube_ext.result().setName("Tube_ext_"+str(i)) - Copie_tube_int = model.addCopy(Part_1_doc, [Solid_tube_int.result()], 1) - Copie_tube_int.result().setName("Tube_int_"+str(i)) - Rotation = model.addRotation(Part_1_doc, \ - [Copie_tube_ext.result(), Copie_tube_int.result()], \ - center = model.selection("VERTEX", "PartSet/Origin"), \ - start = Point_init.result(), \ - end = CurPoint.result(), keepSubResults = True) - Copie_tube_ext = Rotation.results()[0] - Copie_tube_int = Rotation.results()[1] - - model.do() - - CutTools.append(model.selection("SOLID", "Tube_int_"+str(i))) - IntTools.append(Copie_tube_ext) - -#====================================================================== +# ============================================================================= +i = 1 +CutTools = ( + [] +) # liste pour accumulation des tubes int. et cut de la sphère ext. par tous ces tubes int. +IntTools = [ + Sphere_ext.result() +] # liste pour accumulation de la sphère ext. et de tous les tubes ext. et calcul d'intersection entre tous ces objets (pour déterminer les arêtes sur lesquelles on mettra des fillets). +for x, y, z in zip(listeX[1:], listeY[1:], listeZ[1:]): + i += 1 + # on parcourt les listes à partir du 2ème élément car le premier point (Point_init) a déjà été créé. + CurPoint = model.addPoint(Part_1_doc, x, y, z) + if i == 2: + f3 = CurPoint # mémorisation de la feature pour insertion ultérieure dans les dossiers (folders) + # print("Boucle",i,":") #," : (",round(x,1), round(y,1), round(z,1),")") + Copie_tube_ext = model.addCopy(Part_1_doc, [Solid_tube_ext], 1) + Copie_tube_ext.result().setName("Tube_ext_" + str(i)) + Copie_tube_int = model.addCopy(Part_1_doc, [Solid_tube_int.result()], 1) + Copie_tube_int.result().setName("Tube_int_" + str(i)) + Rotation = model.addRotation( + Part_1_doc, + [Copie_tube_ext.result(), Copie_tube_int.result()], + center=model.selection("VERTEX", "PartSet/Origin"), + start=Point_init.result(), + end=CurPoint.result(), + keepSubResults=True, + ) + Copie_tube_ext = Rotation.results()[0] + Copie_tube_int = Rotation.results()[1] + + model.do() + + CutTools.append(model.selection("SOLID", "Tube_int_" + str(i))) + IntTools.append(Copie_tube_ext) + +# ====================================================================== # Création d'un congé de raccordement à la base du tube courant (n°i) : -#====================================================================== +# ====================================================================== # Calcul de l'intersection entre tous les tubes ext. et la sphère extérieure # de manière à identifier l'arête sur laquelle on va faire un congé (fillet) : -Intersection_1 = model.addIntersection(Part_1_doc, IntTools, keepSubResults = True) -maxRad=-999 -#print("=============================================================") -TOLERANCE = 1.e-5 +Intersection_1 = model.addIntersection(Part_1_doc, IntTools, keepSubResults=True) +maxRad = -999 +# print("=============================================================") +TOLERANCE = 1.0e-5 EdgesForFillet = [] for j in range(Intersection_1.result().numberOfSubs()): - edge = GeomAPI_Edge(Intersection_1.result().subResult(j).resultSubShapePair()[1]) - rad = radius(edge) -# print("Edge ",j,":",Intersection_1.result().subResult(j).name(),"-- rayon =",rad) - if rad > maxRad + TOLERANCE: - jmax=j - maxRad = rad - EdgesForFillet = [edge] - elif rad + TOLERANCE > maxRad: - EdgesForFillet.append(edge) + edge = GeomAPI_Edge(Intersection_1.result().subResult(j).resultSubShapePair()[1]) + rad = radius(edge) + # print("Edge ",j,":",Intersection_1.result().subResult(j).name(),"-- rayon =",rad) + if rad > maxRad + TOLERANCE: + jmax = j + maxRad = rad + EdgesForFillet = [edge] + elif rad + TOLERANCE > maxRad: + EdgesForFillet.append(edge) # Restauration de la sphère ext. et de tous les tubes ext. : Recover_1 = model.addRecover(Part_1_doc, Intersection_1, IntTools) Sphere_ext = Recover_1.results()[0] FuseTools = Recover_1.results()[1:] # Coupe de la sphère par tous les tubes int. et fusion du résultat avec tous les tubes ext. : -Cut_2 = model.addCut(Part_1_doc, [Sphere_ext], CutTools, keepSubResults = False) -Fuse_2 = model.addFuse(Part_1_doc, [Cut_2.result()], FuseTools, keepSubResults = False) +Cut_2 = model.addCut(Part_1_doc, [Sphere_ext], CutTools, keepSubResults=False) +Fuse_2 = model.addFuse(Part_1_doc, [Cut_2.result()], FuseTools, keepSubResults=False) model.do() # Détermination des arêtes du bas des tubes sur lesquelles mettre des "fillets" : -#print("Edge n°",jmax,"avec le plus grand rayon :",Intersection_1.result().subResult(jmax).name(),"-- rayon=",maxRad) +# print("Edge n°",jmax,"avec le plus grand rayon :",Intersection_1.result().subResult(jmax).name(),"-- rayon=",maxRad) FilletEdges = [] exp = GeomAPI_ShapeExplorer(Fuse_2.defaultResult().shape(), GeomAPI_Shape.EDGE) while exp.more(): - cur = exp.current().edge() - for edge in EdgesForFillet: - if edge.isEqual(cur) : # and edge.isSameGeometry(cur): - FilletEdges.append(model.selection(Fuse_2.defaultResult(), cur)) - EdgesForFillet.remove(edge) - break - exp.next() -#print(type(res)) -Fillet_2 = model.addFillet(Part_1_doc, FilletEdges, "fillet_radius_bottom", keepSubResults = False) + cur = exp.current().edge() + for edge in EdgesForFillet: + if edge.isEqual(cur): # and edge.isSameGeometry(cur): + FilletEdges.append(model.selection(Fuse_2.defaultResult(), cur)) + EdgesForFillet.remove(edge) + break + exp.next() +# print(type(res)) +Fillet_2 = model.addFillet( + Part_1_doc, FilletEdges, "fillet_radius_bottom", keepSubResults=False +) Fillet_2.setName("Fillets_bottom_tubes") Fillet_2.result().setName("Resultat_1_tube") Sphere_ext = Fillet_2 @@ -315,50 +435,70 @@ model.addRemoveResults(Part_1_doc, [model.selection("SOLID", "Tube_int_1")]) ## Finalement, on crée la sphère intérieure avec laquelle on va creuser (cut) la sphère fusionnée ## avec les num_pts tubes : -Sphere_int = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "Rint") +Sphere_int = model.addSphere( + Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), "Rint" +) Sphere_int.setName("Sphere_int") -Cut_2 = model.addCut(Part_1_doc, [Sphere_ext.result()], [Sphere_int.result()], keepSubResults = False) +Cut_2 = model.addCut( + Part_1_doc, [Sphere_ext.result()], [Sphere_int.result()], keepSubResults=False +) Cut_2.result().setName("Resultat_final") -Cut_2.result().setColor(0,0,150) -#Cut_2.result().setTransparency(0.5) +Cut_2.result().setColor(0, 0, 150) +# Cut_2.result().setTransparency(0.5) model.do() ## Création de répertoires pour y ranger les features (et compacter l'OB) : Folder_1 = model.addFolder(Part_1_doc, Point_init, f2) Folder_1.setName("Tube_initial") Folder_2 = model.addFolder(Part_1_doc, f3, Fillet_2) -Folder_2.setName("Boucle_copie_"+str(num_pts)+"_tubes") +Folder_2.setName("Boucle_copie_" + str(num_pts) + "_tubes") model.do() model.end() -#===================================================== +# ===================================================== # Tests divers (paramétrage, vérification nombre de solides, faces) : -#===================================================== +# ===================================================== model.begin() -Rext.setValue(11);model.do() # 10 -longueur.setValue(6);model.do() # 4 -Rtube.setValue(0.4);model.do() # 0.8 -coef1.setValue(0.3);model.do() # 0.5 -coef2.setValue(2);model.do() # 1.2 -ep_tube.setValue(0.2);model.do() # 0.3 -fillet_radius_top.setValue(0.06);model.do() # 0.12 -fillet_radius_bottom.setValue(1);model.do() # 0.8 +Rext.setValue(11) +model.do() # 10 +longueur.setValue(6) +model.do() # 4 +Rtube.setValue(0.4) +model.do() # 0.8 +coef1.setValue(0.3) +model.do() # 0.5 +coef2.setValue(2) +model.do() # 1.2 +ep_tube.setValue(0.2) +model.do() # 0.3 +fillet_radius_top.setValue(0.06) +model.do() # 0.12 +fillet_radius_bottom.setValue(1) +model.do() # 0.8 # Retour aux valeurs initiales sauf coef2 et fillet_radius_bottom : -Rext.setValue(10);model.do() # 10 -longueur.setValue(4);model.do() # 4 -Rtube.setValue(0.8);model.do() # 0.8 -coef1.setValue(0.5);model.do() # 0.5 -coef2.setValue(1.5);model.do() # 1.2 -ep_tube.setValue(0.3);model.do() # 0.3 -fillet_radius_top.setValue(0.12);model.do() # 0.12 -fillet_radius_bottom.setValue(0.7);model.do() # 0.8 +Rext.setValue(10) +model.do() # 10 +longueur.setValue(4) +model.do() # 4 +Rtube.setValue(0.8) +model.do() # 0.8 +coef1.setValue(0.5) +model.do() # 0.5 +coef2.setValue(1.5) +model.do() # 1.2 +ep_tube.setValue(0.3) +model.do() # 0.3 +fillet_radius_top.setValue(0.12) +model.do() # 0.12 +fillet_radius_bottom.setValue(0.7) +model.do() # 0.8 model.end() -#model.generateTests(Part_1, "Part_1") +# model.generateTests(Part_1, "Part_1") model.testNbResults(Part_1, 1) model.testNbSubResults(Part_1, [0]) model.testNbSubShapes(Part_1, GeomAPI_Shape.SOLID, [1]) -#model.testNbSubShapes(Part_1, GeomAPI_Shape.FACE, [358]) +# model.testNbSubShapes(Part_1, GeomAPI_Shape.FACE, [358]) model.testResultsVolumes(Part_1, [1000.4175], 5) diff --git a/test.models/ecran.py b/test.models/ecran.py index 4b93eefce..d00675462 100644 --- a/test.models/ecran.py +++ b/test.models/ecran.py @@ -35,7 +35,9 @@ SketchLine_3 = Sketch_1.addLine(55.1, 0.3, 0.3, 0.3) SketchLine_3.setName("SketchLine_2") SketchLine_3.result().setName("SketchLine_2") SketchLine_3.setAuxiliary(True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(0.3, 2.3, 0.3, 10.3) SketchLine_4.setName("SketchLine_11") SketchLine_4.result().setName("SketchLine_11") @@ -46,37 +48,53 @@ SketchLine_6 = Sketch_1.addLine(0.3, 0.3, 0.3, 10.3) SketchLine_6.setName("SketchLine_3") SketchLine_6.result().setName("SketchLine_3") SketchLine_6.setAuxiliary(True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(0, 10.3, 0, 2.3) SketchLine_7.setName("SketchLine_13") SketchLine_7.result().setName("SketchLine_13") SketchLine_8 = Sketch_1.addLine(0.3, 10.3, 0, 10.3) SketchLine_8.setName("SketchLine_4") SketchLine_8.result().setName("SketchLine_4") -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_9.setName("SketchLine_5") SketchLine_9.result().setName("SketchLine_5") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.result() +) SketchLine_10 = Sketch_1.addLine(0, 10.3, 0, 0) SketchLine_10.setName("SketchLine_6") SketchLine_10.result().setName("SketchLine_6") SketchLine_10.setAuxiliary(True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_10.startPoint() +) SketchLine_11 = Sketch_1.addLine(0, 0, 55.4, 0) SketchLine_11.setName("SketchLine_7") SketchLine_11.result().setName("SketchLine_7") SketchLine_11.setAuxiliary(True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchLine_12 = Sketch_1.addLine(55.4, 0, 55.4, 10.3) SketchLine_12.setName("SketchLine_8") SketchLine_12.result().setName("SketchLine_8") -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchLine_13 = Sketch_1.addLine(55.4, 10.3, 55.1, 10.3) SketchLine_13.setName("SketchLine_9") SketchLine_13.result().setName("SketchLine_9") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_13.endPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_13.endPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_13.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_8.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_3.result()) @@ -86,48 +104,115 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_12.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 10) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_13.result(), 0.3) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.result(), SketchLine_11.endPoint(), 0.3) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_8.result(), SketchLine_1.startPoint()) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_3.result(), SketchLine_11.endPoint(), 0.3 +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_8.result(), SketchLine_1.startPoint() +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_11.result(), 55.4) SketchConstraintLength_3.setName("SketchConstraintLength_5") SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result()) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), "H") SketchArc_1 = Sketch_1.addArc(2.3, 2.3, 0.3, 2.3, 2.3, 0.3, False) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.endPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_2.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_4.result()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_2.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_4.endPoint()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.result()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_2.endPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_2.result() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_4.result() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_2.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_4.endPoint() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.result() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_4.startPoint(), SketchLine_6.result() +) SketchArc_2 = Sketch_1.addArc(2.3, 2.3, 0, 2.3, 2.3, 0, False) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_7.endPoint()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_5.startPoint()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_5.result()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_7.result()) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_5.endPoint()) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_10.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_11.result()) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_10.result()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_7.endPoint() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_5.result() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_7.result() +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_5.endPoint() +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_10.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_5.startPoint(), SketchLine_11.result() +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_10.result() +) 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()) +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/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 = 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&Sketch_1/SketchLine_12")) +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&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()) +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) SketchLine_17 = Sketch_2.addLine(149.5, 7.7, 149.5, -2.3) -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchLine_17.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_14.result()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_15.result()) SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_16.result()) @@ -136,115 +221,222 @@ SketchLine_18 = Sketch_2.addLine(-149.5, -2.3142, -153.5, -2.3142) SketchLine_19 = Sketch_2.addLine(-153.5, -2.3142, -153.5, 7.7) SketchLine_20 = Sketch_2.addLine(-153.5, 7.7, -149.5, 7.7) SketchLine_21 = Sketch_2.addLine(-149.5, 7.7, -149.5, -2.3142) -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchLine_18.startPoint()) -SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchLine_21.endPoint(), SketchLine_18.startPoint() +) +SketchConstraintCoincidence_30 = Sketch_2.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) +SketchConstraintCoincidence_31 = Sketch_2.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) +SketchConstraintCoincidence_32 = Sketch_2.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.startPoint() +) SketchConstraintHorizontal_7 = Sketch_2.setHorizontal(SketchLine_18.result()) SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_19.result()) SketchConstraintHorizontal_8 = Sketch_2.setHorizontal(SketchLine_20.result()) SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_21.result()) -SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_20.result()) +SketchConstraintCoincidence_33 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchLine_20.result() +) 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&Sketch_1/SketchArc_2_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_12][Extrusion_1_1/From_Face]")) +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&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 = 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&Sketch_1/SketchLine_4"), 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&Sketch_1/SketchLine_8")) +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&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 = 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 = 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/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8]")) +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()) +SketchConstraintCoincidence_36 = Sketch_3.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.result() +) SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_41") SketchLine_24 = Sketch_3.addLine(153.5, -8.3, 151.5, -10.3) SketchLine_24.setName("SketchLine_31") SketchLine_24.result().setName("SketchLine_31") -SketchConstraintCoincidence_37 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_24.startPoint()) +SketchConstraintCoincidence_37 = Sketch_3.setCoincident( + SketchLine_22.endPoint(), SketchLine_24.startPoint() +) SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_42") SketchLine_25 = Sketch_3.addLine(151.5, -10.3, 153.5, -10.3) SketchLine_25.setName("SketchLine_33") SketchLine_25.result().setName("SketchLine_33") -SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint()) +SketchConstraintCoincidence_38 = Sketch_3.setCoincident( + SketchLine_24.endPoint(), SketchLine_25.startPoint() +) SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_44") -SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchLine_25.endPoint()) +SketchConstraintCoincidence_39 = Sketch_3.setCoincident( + SketchLine_22.startPoint(), SketchLine_25.endPoint() +) SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_45") -SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_25.endPoint()) +SketchConstraintCoincidence_40 = Sketch_3.setCoincident( + SketchPoint_3.coordinates(), SketchLine_25.endPoint() +) SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_46") -SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_25.endPoint()) +SketchConstraintCoincidence_41 = Sketch_3.setCoincident( + SketchLine_23.endPoint(), SketchLine_25.endPoint() +) SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_47") 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 = 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/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()] -SketchConstraintMirror_1 = Sketch_3.addMirror(SketchLine_26.result(), SketchConstraintMirror_1_objects) +SketchConstraintMirror_1_objects = [ + SketchLine_22.result(), + SketchLine_25.result(), + SketchLine_24.result(), +] +SketchConstraintMirror_1 = Sketch_3.addMirror( + SketchLine_26.result(), SketchConstraintMirror_1_objects +) [SketchLine_27, SketchLine_28, SketchLine_29] = SketchConstraintMirror_1.mirrored() SketchLine_29.setName("SketchLine_32") SketchLine_29.result().setName("SketchLine_32") 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(), 0, 10, [model.selection("SOLID", "ExtrusionCut_1_1")]) +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/Modified_Face&Sketch_1/SketchLine_13")) +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/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 = 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 = 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/Generated_Face&Sketch_2/SketchLine_21][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_13]")) +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()) +SketchConstraintCoincidence_43 = Sketch_4.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.result() +) SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_48") SketchLine_32 = Sketch_4.addLine(-149.5, 8.3, -147.5, 10.3) SketchLine_32.setName("SketchLine_37") SketchLine_32.result().setName("SketchLine_37") -SketchConstraintCoincidence_44 = Sketch_4.setCoincident(SketchLine_30.endPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_44 = Sketch_4.setCoincident( + SketchLine_30.endPoint(), SketchLine_32.startPoint() +) SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_49") SketchLine_33 = Sketch_4.addLine(-147.5, 10.3, -149.5, 10.3) SketchLine_33.setName("SketchLine_38") SketchLine_33.result().setName("SketchLine_38") -SketchConstraintCoincidence_45 = Sketch_4.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_45 = Sketch_4.setCoincident( + SketchLine_32.endPoint(), SketchLine_33.startPoint() +) SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_50") -SketchConstraintCoincidence_46 = Sketch_4.setCoincident(SketchLine_30.startPoint(), SketchLine_33.endPoint()) +SketchConstraintCoincidence_46 = Sketch_4.setCoincident( + SketchLine_30.startPoint(), SketchLine_33.endPoint() +) SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_51") -SketchConstraintCoincidence_47 = Sketch_4.setCoincident(SketchPoint_4.coordinates(), SketchLine_33.endPoint()) +SketchConstraintCoincidence_47 = Sketch_4.setCoincident( + SketchPoint_4.coordinates(), SketchLine_33.endPoint() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_52") -SketchConstraintCoincidence_48 = Sketch_4.setCoincident(SketchLine_31.startPoint(), SketchLine_33.endPoint()) +SketchConstraintCoincidence_48 = Sketch_4.setCoincident( + SketchLine_31.startPoint(), SketchLine_33.endPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_53") SketchConstraintHorizontal_9 = Sketch_4.setHorizontal(SketchLine_33.result()) -SketchConstraintAngle_2 = Sketch_4.setAngleBackward(SketchLine_30.result(), SketchLine_32.result(), 45) +SketchConstraintAngle_2 = Sketch_4.setAngleBackward( + SketchLine_30.result(), SketchLine_32.result(), 45 +) SketchConstraintAngle_2.setName("SketchConstraintAngle_3") SketchConstraintLength_7 = Sketch_4.setLength(SketchLine_33.result(), 2) SketchLine_34 = Sketch_4.addLine(0, 0, 0, 100) SketchLine_34.setName("SketchLine_39") SketchLine_34.result().setName("SketchLine_39") -SketchConstraintMirror_2_objects = [SketchLine_32.result(), SketchLine_33.result(), SketchLine_30.result()] -SketchConstraintMirror_2 = Sketch_4.addMirror(SketchLine_34.result(), SketchConstraintMirror_2_objects) +SketchConstraintMirror_2_objects = [ + SketchLine_32.result(), + SketchLine_33.result(), + SketchLine_30.result(), +] +SketchConstraintMirror_2 = Sketch_4.addMirror( + SketchLine_34.result(), SketchConstraintMirror_2_objects +) [SketchLine_35, SketchLine_36, SketchLine_37] = SketchConstraintMirror_2.mirrored() SketchLine_37.setName("SketchLine_42") SketchLine_37.result().setName("SketchLine_42") @@ -259,53 +451,108 @@ 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/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face]"), False) +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") -SketchConstraintDistance_3 = Sketch_4.setDistance(SketchLine_38.result(), SketchAPI_Line(SketchLine_39).endPoint(), 5.5) -SketchConstraintCoincidence_49 = Sketch_4.setCoincident(SketchLine_38.startPoint(), SketchLine_39.result()) +SketchConstraintDistance_3 = Sketch_4.setDistance( + SketchLine_38.result(), SketchAPI_Line(SketchLine_39).endPoint(), 5.5 +) +SketchConstraintCoincidence_49 = Sketch_4.setCoincident( + SketchLine_38.startPoint(), SketchLine_39.result() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_54") SketchCircle_1 = Sketch_4.addCircle(100.5, 5.5, 1.5) SketchConstraintRadius_3 = Sketch_4.setRadius(SketchCircle_1.results()[1], 1.5) SketchCircle_2 = Sketch_4.addCircle(33.5, 5.5, 1.5) -SketchConstraintCoincidence_50 = Sketch_4.setCoincident(SketchCircle_2.center(), SketchLine_38.result()) +SketchConstraintCoincidence_50 = Sketch_4.setCoincident( + SketchCircle_2.center(), SketchLine_38.result() +) SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_55") SketchCircle_3 = Sketch_4.addCircle(-33.5, 5.5, 1.506545921898) -SketchConstraintCoincidence_51 = Sketch_4.setCoincident(SketchCircle_3.center(), SketchLine_38.result()) +SketchConstraintCoincidence_51 = Sketch_4.setCoincident( + SketchCircle_3.center(), SketchLine_38.result() +) SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_56") SketchCircle_4 = Sketch_4.addCircle(-100.5, 5.5, 1.506545921898) -SketchConstraintCoincidence_52 = Sketch_4.setCoincident(SketchCircle_4.center(), SketchLine_38.result()) +SketchConstraintCoincidence_52 = Sketch_4.setCoincident( + SketchCircle_4.center(), SketchLine_38.result() +) SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_57") -SketchConstraintEqual_2 = Sketch_4.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) -SketchConstraintEqual_3 = Sketch_4.setEqual(SketchCircle_3.results()[1], SketchCircle_4.results()[1]) -SketchConstraintCoincidence_53 = Sketch_4.setCoincident(SketchCircle_1.center(), SketchLine_38.result()) +SketchConstraintEqual_2 = Sketch_4.setEqual( + SketchCircle_1.results()[1], SketchCircle_2.results()[1] +) +SketchConstraintEqual_3 = Sketch_4.setEqual( + SketchCircle_3.results()[1], SketchCircle_4.results()[1] +) +SketchConstraintCoincidence_53 = Sketch_4.setCoincident( + SketchCircle_1.center(), SketchLine_38.result() +) SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_58") -SketchConstraintDistance_4 = Sketch_4.setDistance(SketchCircle_4.center(), SketchCircle_3.center(), 67) -SketchConstraintDistance_5 = Sketch_4.setDistance(SketchCircle_3.center(), SketchCircle_2.center(), 67) -SketchConstraintDistance_6 = Sketch_4.setDistance(SketchCircle_2.center(), SketchCircle_1.center(), 67) -SketchConstraintDistance_7 = Sketch_4.setDistance(SketchLine_39.result(), SketchCircle_1.center(), 53) -SketchConstraintCoincidence_54 = Sketch_4.setCoincident(SketchLine_38.endPoint(), SketchCircle_4.center()) +SketchConstraintDistance_4 = Sketch_4.setDistance( + SketchCircle_4.center(), SketchCircle_3.center(), 67 +) +SketchConstraintDistance_5 = Sketch_4.setDistance( + SketchCircle_3.center(), SketchCircle_2.center(), 67 +) +SketchConstraintDistance_6 = Sketch_4.setDistance( + SketchCircle_2.center(), SketchCircle_1.center(), 67 +) +SketchConstraintDistance_7 = Sketch_4.setDistance( + SketchLine_39.result(), SketchCircle_1.center(), 53 +) +SketchConstraintCoincidence_54 = Sketch_4.setCoincident( + SketchLine_38.endPoint(), SketchCircle_4.center() +) 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/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) +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 = 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/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_12]")) +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) SketchLine_43.setName("SketchLine_45") SketchLine_43.result().setName("SketchLine_45") SketchLine_43.setAuxiliary(True) -SketchConstraintCoincidence_55 = Sketch_5.setCoincident(SketchLine_43.endPoint(), SketchLine_42.result()) +SketchConstraintCoincidence_55 = Sketch_5.setCoincident( + SketchLine_43.endPoint(), SketchLine_42.result() +) SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_60") SketchLine_44 = Sketch_5.addLine(153.5, -45.04999053274702, 153.5, -37.04999053274702) SketchLine_44.setName("SketchLine_47") @@ -313,28 +560,40 @@ SketchLine_44.result().setName("SketchLine_47") SketchLine_45 = Sketch_5.addLine(150.8, -14.54997391609652, 150.8, -19.54999029833178) SketchLine_45.setName("SketchLine_61") SketchLine_45.result().setName("SketchLine_61") -SketchLine_46 = Sketch_5.addLine(153.5, -13.04999053274714, 152.2999838654776, -13.04999053274697) +SketchLine_46 = Sketch_5.addLine( + 153.5, -13.04999053274714, 152.2999838654776, -13.04999053274697 +) SketchLine_46.setName("SketchLine_60") SketchLine_46.result().setName("SketchLine_60") SketchLine_47 = Sketch_5.addLine(150.8, -37.04999053274702, 150.8, -45.04999053274702) SketchLine_47.setName("SketchLine_49") SketchLine_47.result().setName("SketchLine_49") SketchLine_47.setAuxiliary(True) -SketchConstraintCoincidence_56 = Sketch_5.setCoincident(SketchLine_47.endPoint(), SketchLine_43.startPoint()) +SketchConstraintCoincidence_56 = Sketch_5.setCoincident( + SketchLine_47.endPoint(), SketchLine_43.startPoint() +) SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_61") -SketchConstraintCoincidence_57 = Sketch_5.setCoincident(SketchLine_43.endPoint(), SketchLine_44.startPoint()) +SketchConstraintCoincidence_57 = Sketch_5.setCoincident( + SketchLine_43.endPoint(), SketchLine_44.startPoint() +) SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_62") SketchLine_48 = Sketch_5.addLine(153.5, -37.04999053274702, 150.8, -37.04999053274702) SketchLine_48.setAuxiliary(True) -SketchConstraintCoincidence_58 = Sketch_5.setCoincident(SketchLine_44.endPoint(), SketchLine_48.startPoint()) +SketchConstraintCoincidence_58 = Sketch_5.setCoincident( + SketchLine_44.endPoint(), SketchLine_48.startPoint() +) SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_63") -SketchConstraintCoincidence_59 = Sketch_5.setCoincident(SketchLine_48.endPoint(), SketchLine_47.startPoint()) +SketchConstraintCoincidence_59 = Sketch_5.setCoincident( + SketchLine_48.endPoint(), SketchLine_47.startPoint() +) SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_64") SketchConstraintHorizontal_11 = Sketch_5.setHorizontal(SketchLine_43.result()) SketchConstraintVertical_9 = Sketch_5.setVertical(SketchLine_44.result()) SketchConstraintHorizontal_12 = Sketch_5.setHorizontal(SketchLine_48.result()) SketchConstraintVertical_10 = Sketch_5.setVertical(SketchLine_47.result()) -SketchLine_49 = Sketch_5.addLine(153.5, -37.04999053274702, 152.2999989299055, -37.04999053274738) +SketchLine_49 = Sketch_5.addLine( + 153.5, -37.04999053274702, 152.2999989299055, -37.04999053274738 +) SketchLine_49.setName("SketchLine_62") SketchLine_49.result().setName("SketchLine_62") SketchLine_50 = Sketch_5.addLine(150.8, -38.54997391988981, 150.8, -43.54998998548124) @@ -344,132 +603,287 @@ SketchLine_51 = Sketch_5.addLine(150.8, -21.04999053274714, 153.5, -21.049990532 SketchLine_51.setName("SketchLine_50") SketchLine_51.result().setName("SketchLine_50") SketchLine_51.setAuxiliary(True) -SketchConstraintCoincidence_60 = Sketch_5.setCoincident(SketchLine_51.endPoint(), SketchLine_42.result()) +SketchConstraintCoincidence_60 = Sketch_5.setCoincident( + SketchLine_51.endPoint(), SketchLine_42.result() +) SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_65") SketchLine_52 = Sketch_5.addLine(153.5, -21.04999053274714, 153.5, -13.04999053274714) SketchLine_52.setName("SketchLine_51") SketchLine_52.result().setName("SketchLine_51") SketchLine_53 = Sketch_5.addLine(150.8, -13.04999053274714, 150.8, -21.04999053274714) SketchLine_53.setAuxiliary(True) -SketchConstraintCoincidence_61 = Sketch_5.setCoincident(SketchLine_53.endPoint(), SketchLine_51.startPoint()) +SketchConstraintCoincidence_61 = Sketch_5.setCoincident( + SketchLine_53.endPoint(), SketchLine_51.startPoint() +) SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_66") -SketchConstraintCoincidence_62 = Sketch_5.setCoincident(SketchLine_51.endPoint(), SketchLine_52.startPoint()) +SketchConstraintCoincidence_62 = Sketch_5.setCoincident( + SketchLine_51.endPoint(), SketchLine_52.startPoint() +) SketchConstraintCoincidence_62.setName("SketchConstraintCoincidence_67") SketchLine_54 = Sketch_5.addLine(153.5, -13.04999053274714, 150.8, -13.04999053274714) SketchLine_54.setName("SketchLine_52") SketchLine_54.result().setName("SketchLine_52") SketchLine_54.setAuxiliary(True) -SketchConstraintCoincidence_63 = Sketch_5.setCoincident(SketchLine_52.endPoint(), SketchLine_54.startPoint()) +SketchConstraintCoincidence_63 = Sketch_5.setCoincident( + SketchLine_52.endPoint(), SketchLine_54.startPoint() +) SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_68") -SketchConstraintCoincidence_64 = Sketch_5.setCoincident(SketchLine_54.endPoint(), SketchLine_53.startPoint()) +SketchConstraintCoincidence_64 = Sketch_5.setCoincident( + SketchLine_54.endPoint(), SketchLine_53.startPoint() +) SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_69") SketchConstraintHorizontal_13 = Sketch_5.setHorizontal(SketchLine_51.result()) SketchConstraintVertical_11 = Sketch_5.setVertical(SketchLine_52.result()) SketchConstraintHorizontal_14 = Sketch_5.setHorizontal(SketchLine_54.result()) SketchConstraintVertical_12 = Sketch_5.setVertical(SketchLine_53.result()) -SketchConstraintCoincidence_65 = Sketch_5.setCoincident(SketchLine_47.result(), SketchLine_53.endPoint()) +SketchConstraintCoincidence_65 = Sketch_5.setCoincident( + SketchLine_47.result(), SketchLine_53.endPoint() +) SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_70") SketchConstraintLength_8 = Sketch_5.setLength(SketchLine_43.result(), 2.7) SketchConstraintLength_8.setName("SketchConstraintLength_9") SketchConstraintLength_9 = Sketch_5.setLength(SketchLine_44.result(), 8) SketchConstraintLength_9.setName("SketchConstraintLength_10") -SketchConstraintEqual_4 = Sketch_5.setEqual(SketchLine_47.result(), SketchLine_53.result()) +SketchConstraintEqual_4 = Sketch_5.setEqual( + SketchLine_47.result(), SketchLine_53.result() +) SketchPoint_5 = Sketch_5.addPoint(153.5, -28.85) SketchPoint_5.setName("SketchPoint_7") SketchPoint_5.result().setName("SketchPoint_7") -SketchConstraintMiddle_1 = Sketch_5.setMiddlePoint(SketchPoint_5.coordinates(), SketchLine_42.result()) +SketchConstraintMiddle_1 = Sketch_5.setMiddlePoint( + SketchPoint_5.coordinates(), SketchLine_42.result() +) SketchLine_55 = Sketch_5.addLine(153.5, -28.85, -153.5, -28.85) SketchLine_55.setName("SketchLine_54") SketchLine_55.result().setName("SketchLine_54") SketchLine_55.setAuxiliary(True) -SketchConstraintCoincidence_66 = Sketch_5.setCoincident(SketchPoint_5.coordinates(), SketchLine_55.startPoint()) +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/Modified_Face&Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_10]")) +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()) +SketchConstraintCoincidence_67 = Sketch_5.setCoincident( + SketchLine_55.endPoint(), SketchLine_56.result() +) SketchConstraintCoincidence_67.setName("SketchConstraintCoincidence_72") SketchConstraintHorizontal_15 = Sketch_5.setHorizontal(SketchLine_55.result()) -SketchConstraintDistance_8 = Sketch_5.setDistance(SketchLine_48.result(), SketchPoint_5.coordinates(), 8.2) -SketchConstraintDistance_9 = Sketch_5.setDistance(SketchLine_51.result(), SketchPoint_5.coordinates(), 7.8) -SketchArc_3 = Sketch_5.addArc(152.3, -43.54999053274682, 150.8, -43.54998998548124, 152.2999838292651, -45.04999053274704, False) +SketchConstraintDistance_8 = Sketch_5.setDistance( + SketchLine_48.result(), SketchPoint_5.coordinates(), 8.2 +) +SketchConstraintDistance_9 = Sketch_5.setDistance( + SketchLine_51.result(), SketchPoint_5.coordinates(), 7.8 +) +SketchArc_3 = Sketch_5.addArc( + 152.3, + -43.54999053274682, + 150.8, + -43.54998998548124, + 152.2999838292651, + -45.04999053274704, + False, +) SketchLine_57 = Sketch_5.addLine(150.8, -37.04999053274702, 150.8, -43.54998998548124) SketchLine_57.setName("SketchLine_56") SketchLine_57.result().setName("SketchLine_56") SketchLine_57.setAuxiliary(True) -SketchConstraintCoincidence_68 = Sketch_5.setCoincident(SketchArc_3.startPoint(), SketchLine_57.endPoint()) +SketchConstraintCoincidence_68 = Sketch_5.setCoincident( + SketchArc_3.startPoint(), SketchLine_57.endPoint() +) SketchConstraintCoincidence_68.setName("SketchConstraintCoincidence_73") -SketchConstraintCoincidence_69 = Sketch_5.setCoincident(SketchArc_3.endPoint(), SketchLine_41.startPoint()) +SketchConstraintCoincidence_69 = Sketch_5.setCoincident( + SketchArc_3.endPoint(), SketchLine_41.startPoint() +) SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_74") -SketchConstraintTangent_5 = Sketch_5.setTangent(SketchArc_3.results()[1], SketchLine_57.result()) -SketchConstraintTangent_6 = Sketch_5.setTangent(SketchArc_3.results()[1], SketchLine_41.result()) -SketchConstraintCoincidence_70 = Sketch_5.setCoincident(SketchLine_47.startPoint(), SketchLine_57.startPoint()) +SketchConstraintTangent_5 = Sketch_5.setTangent( + SketchArc_3.results()[1], SketchLine_57.result() +) +SketchConstraintTangent_6 = Sketch_5.setTangent( + SketchArc_3.results()[1], SketchLine_41.result() +) +SketchConstraintCoincidence_70 = Sketch_5.setCoincident( + SketchLine_47.startPoint(), SketchLine_57.startPoint() +) SketchConstraintCoincidence_70.setName("SketchConstraintCoincidence_75") -SketchConstraintCoincidence_71 = Sketch_5.setCoincident(SketchLine_43.endPoint(), SketchLine_41.endPoint()) +SketchConstraintCoincidence_71 = Sketch_5.setCoincident( + SketchLine_43.endPoint(), SketchLine_41.endPoint() +) SketchConstraintCoincidence_71.setName("SketchConstraintCoincidence_76") -SketchConstraintCoincidence_72 = Sketch_5.setCoincident(SketchLine_57.endPoint(), SketchLine_47.result()) +SketchConstraintCoincidence_72 = Sketch_5.setCoincident( + SketchLine_57.endPoint(), SketchLine_47.result() +) SketchConstraintCoincidence_72.setName("SketchConstraintCoincidence_77") -SketchConstraintCoincidence_73 = Sketch_5.setCoincident(SketchLine_41.startPoint(), SketchLine_43.result()) +SketchConstraintCoincidence_73 = Sketch_5.setCoincident( + SketchLine_41.startPoint(), SketchLine_43.result() +) SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_78") -SketchArc_4 = Sketch_5.addArc(152.3, -19.54999053274696, 150.8, -19.54999029833178, 152.2999838762584, -21.04999053274691, False) +SketchArc_4 = Sketch_5.addArc( + 152.3, + -19.54999053274696, + 150.8, + -19.54999029833178, + 152.2999838762584, + -21.04999053274691, + False, +) SketchLine_58 = Sketch_5.addLine(150.8, -13.04999053274714, 150.8, -19.54999029833178) SketchLine_58.setName("SketchLine_59") SketchLine_58.result().setName("SketchLine_59") SketchLine_58.setAuxiliary(True) -SketchConstraintCoincidence_74 = Sketch_5.setCoincident(SketchArc_4.startPoint(), SketchLine_58.endPoint()) +SketchConstraintCoincidence_74 = Sketch_5.setCoincident( + SketchArc_4.startPoint(), SketchLine_58.endPoint() +) SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_79") -SketchConstraintCoincidence_75 = Sketch_5.setCoincident(SketchArc_4.endPoint(), SketchLine_40.startPoint()) +SketchConstraintCoincidence_75 = Sketch_5.setCoincident( + SketchArc_4.endPoint(), SketchLine_40.startPoint() +) SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_80") -SketchConstraintTangent_7 = Sketch_5.setTangent(SketchArc_4.results()[1], SketchLine_40.result()) -SketchConstraintTangent_8 = Sketch_5.setTangent(SketchArc_4.results()[1], SketchLine_58.result()) -SketchConstraintCoincidence_76 = Sketch_5.setCoincident(SketchLine_51.endPoint(), SketchLine_40.endPoint()) +SketchConstraintTangent_7 = Sketch_5.setTangent( + SketchArc_4.results()[1], SketchLine_40.result() +) +SketchConstraintTangent_8 = Sketch_5.setTangent( + SketchArc_4.results()[1], SketchLine_58.result() +) +SketchConstraintCoincidence_76 = Sketch_5.setCoincident( + SketchLine_51.endPoint(), SketchLine_40.endPoint() +) SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_81") -SketchConstraintCoincidence_77 = Sketch_5.setCoincident(SketchLine_53.startPoint(), SketchLine_58.startPoint()) +SketchConstraintCoincidence_77 = Sketch_5.setCoincident( + SketchLine_53.startPoint(), SketchLine_58.startPoint() +) SketchConstraintCoincidence_77.setName("SketchConstraintCoincidence_82") -SketchConstraintCoincidence_78 = Sketch_5.setCoincident(SketchLine_40.startPoint(), SketchLine_51.result()) +SketchConstraintCoincidence_78 = Sketch_5.setCoincident( + SketchLine_40.startPoint(), SketchLine_51.result() +) SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_83") -SketchConstraintCoincidence_79 = Sketch_5.setCoincident(SketchLine_58.endPoint(), SketchLine_53.result()) +SketchConstraintCoincidence_79 = Sketch_5.setCoincident( + SketchLine_58.endPoint(), SketchLine_53.result() +) SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_84") -SketchArc_5 = Sketch_5.addArc(152.3, -14.54999053274707, 152.2999838654776, -13.04999053274697, 150.8, -14.54997391609652, False) -SketchConstraintCoincidence_80 = Sketch_5.setCoincident(SketchArc_5.startPoint(), SketchLine_46.endPoint()) +SketchArc_5 = Sketch_5.addArc( + 152.3, + -14.54999053274707, + 152.2999838654776, + -13.04999053274697, + 150.8, + -14.54997391609652, + False, +) +SketchConstraintCoincidence_80 = Sketch_5.setCoincident( + SketchArc_5.startPoint(), SketchLine_46.endPoint() +) SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_85") -SketchConstraintCoincidence_81 = Sketch_5.setCoincident(SketchArc_5.endPoint(), SketchLine_45.startPoint()) +SketchConstraintCoincidence_81 = Sketch_5.setCoincident( + SketchArc_5.endPoint(), SketchLine_45.startPoint() +) SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_86") -SketchConstraintTangent_9 = Sketch_5.setTangent(SketchArc_5.results()[1], SketchLine_46.result()) -SketchConstraintTangent_10 = Sketch_5.setTangent(SketchArc_5.results()[1], SketchLine_45.result()) -SketchConstraintCoincidence_82 = Sketch_5.setCoincident(SketchLine_54.startPoint(), SketchLine_46.startPoint()) +SketchConstraintTangent_9 = Sketch_5.setTangent( + SketchArc_5.results()[1], SketchLine_46.result() +) +SketchConstraintTangent_10 = Sketch_5.setTangent( + SketchArc_5.results()[1], SketchLine_45.result() +) +SketchConstraintCoincidence_82 = Sketch_5.setCoincident( + SketchLine_54.startPoint(), SketchLine_46.startPoint() +) SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_87") -SketchConstraintCoincidence_83 = Sketch_5.setCoincident(SketchLine_58.endPoint(), SketchLine_45.endPoint()) +SketchConstraintCoincidence_83 = Sketch_5.setCoincident( + SketchLine_58.endPoint(), SketchLine_45.endPoint() +) SketchConstraintCoincidence_83.setName("SketchConstraintCoincidence_88") -SketchConstraintCoincidence_84 = Sketch_5.setCoincident(SketchLine_46.endPoint(), SketchLine_54.result()) +SketchConstraintCoincidence_84 = Sketch_5.setCoincident( + SketchLine_46.endPoint(), SketchLine_54.result() +) SketchConstraintCoincidence_84.setName("SketchConstraintCoincidence_89") -SketchConstraintCoincidence_85 = Sketch_5.setCoincident(SketchLine_45.startPoint(), SketchLine_58.result()) +SketchConstraintCoincidence_85 = Sketch_5.setCoincident( + SketchLine_45.startPoint(), SketchLine_58.result() +) SketchConstraintCoincidence_85.setName("SketchConstraintCoincidence_90") -SketchArc_6 = Sketch_5.addArc(152.3, -38.54999053274739, 152.2999989299055, -37.04999053274738, 150.8, -38.54997391988981, False) -SketchConstraintCoincidence_86 = Sketch_5.setCoincident(SketchArc_6.startPoint(), SketchLine_49.endPoint()) +SketchArc_6 = Sketch_5.addArc( + 152.3, + -38.54999053274739, + 152.2999989299055, + -37.04999053274738, + 150.8, + -38.54997391988981, + False, +) +SketchConstraintCoincidence_86 = Sketch_5.setCoincident( + SketchArc_6.startPoint(), SketchLine_49.endPoint() +) SketchConstraintCoincidence_86.setName("SketchConstraintCoincidence_91") -SketchConstraintCoincidence_87 = Sketch_5.setCoincident(SketchArc_6.endPoint(), SketchLine_50.startPoint()) +SketchConstraintCoincidence_87 = Sketch_5.setCoincident( + SketchArc_6.endPoint(), SketchLine_50.startPoint() +) SketchConstraintCoincidence_87.setName("SketchConstraintCoincidence_92") -SketchConstraintTangent_11 = Sketch_5.setTangent(SketchArc_6.results()[1], SketchLine_49.result()) -SketchConstraintTangent_12 = Sketch_5.setTangent(SketchArc_6.results()[1], SketchLine_50.result()) -SketchConstraintCoincidence_88 = Sketch_5.setCoincident(SketchLine_48.startPoint(), SketchLine_49.startPoint()) +SketchConstraintTangent_11 = Sketch_5.setTangent( + SketchArc_6.results()[1], SketchLine_49.result() +) +SketchConstraintTangent_12 = Sketch_5.setTangent( + SketchArc_6.results()[1], SketchLine_50.result() +) +SketchConstraintCoincidence_88 = Sketch_5.setCoincident( + SketchLine_48.startPoint(), SketchLine_49.startPoint() +) SketchConstraintCoincidence_88.setName("SketchConstraintCoincidence_93") -SketchConstraintCoincidence_89 = Sketch_5.setCoincident(SketchLine_57.endPoint(), SketchLine_50.endPoint()) +SketchConstraintCoincidence_89 = Sketch_5.setCoincident( + SketchLine_57.endPoint(), SketchLine_50.endPoint() +) SketchConstraintCoincidence_89.setName("SketchConstraintCoincidence_94") -SketchConstraintCoincidence_90 = Sketch_5.setCoincident(SketchLine_49.endPoint(), SketchLine_48.result()) +SketchConstraintCoincidence_90 = Sketch_5.setCoincident( + SketchLine_49.endPoint(), SketchLine_48.result() +) SketchConstraintCoincidence_90.setName("SketchConstraintCoincidence_95") -SketchConstraintCoincidence_91 = Sketch_5.setCoincident(SketchLine_50.startPoint(), SketchLine_57.result()) +SketchConstraintCoincidence_91 = Sketch_5.setCoincident( + SketchLine_50.startPoint(), SketchLine_57.result() +) SketchConstraintCoincidence_91.setName("SketchConstraintCoincidence_96") SketchConstraintRadius_4 = Sketch_5.setRadius(SketchArc_3.results()[1], 1.5) -SketchConstraintEqual_5 = Sketch_5.setEqual(SketchArc_6.results()[1], SketchArc_3.results()[1]) -SketchConstraintEqual_6 = Sketch_5.setEqual(SketchArc_3.results()[1], SketchArc_4.results()[1]) -SketchConstraintEqual_7 = Sketch_5.setEqual(SketchArc_4.results()[1], SketchArc_5.results()[1]) +SketchConstraintEqual_5 = Sketch_5.setEqual( + SketchArc_6.results()[1], SketchArc_3.results()[1] +) +SketchConstraintEqual_6 = Sketch_5.setEqual( + SketchArc_3.results()[1], SketchArc_4.results()[1] +) +SketchConstraintEqual_7 = Sketch_5.setEqual( + SketchArc_4.results()[1], SketchArc_5.results()[1] +) SketchLine_59 = Sketch_5.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_59.setName("SketchLine_64") SketchLine_59.result().setName("SketchLine_64") -SketchConstraintMirror_3_objects = [SketchArc_3.results()[1], SketchArc_6.results()[1], SketchLine_49.result(), SketchLine_50.result(), SketchLine_44.result(), SketchLine_41.result(), SketchLine_43.result(), SketchLine_57.result(), SketchLine_48.result(), SketchLine_47.result()] -SketchConstraintMirror_3 = Sketch_5.addMirror(SketchLine_59.result(), SketchConstraintMirror_3_objects) -[SketchArc_7, SketchArc_8, SketchLine_60, SketchLine_61, SketchLine_62, SketchLine_63, SketchLine_64, SketchLine_65, SketchLine_66, SketchLine_67] = SketchConstraintMirror_3.mirrored() +SketchConstraintMirror_3_objects = [ + SketchArc_3.results()[1], + SketchArc_6.results()[1], + SketchLine_49.result(), + SketchLine_50.result(), + SketchLine_44.result(), + SketchLine_41.result(), + SketchLine_43.result(), + SketchLine_57.result(), + SketchLine_48.result(), + SketchLine_47.result(), +] +SketchConstraintMirror_3 = Sketch_5.addMirror( + SketchLine_59.result(), SketchConstraintMirror_3_objects +) +[ + SketchArc_7, + SketchArc_8, + SketchLine_60, + SketchLine_61, + SketchLine_62, + SketchLine_63, + SketchLine_64, + SketchLine_65, + SketchLine_66, + SketchLine_67, +] = SketchConstraintMirror_3.mirrored() SketchLine_67.setName("SketchLine_72") SketchLine_67.result().setName("SketchLine_72") SketchLine_66.setName("SketchLine_71") @@ -486,9 +900,33 @@ SketchLine_61.setName("SketchLine_66") SketchLine_61.result().setName("SketchLine_66") SketchLine_60.setName("SketchLine_65") SketchLine_60.result().setName("SketchLine_65") -SketchConstraintMirror_4_objects = [SketchArc_4.results()[1], SketchArc_5.results()[1], SketchLine_52.result(), SketchLine_45.result(), SketchLine_46.result(), SketchLine_40.result(), SketchLine_54.result(), SketchLine_58.result(), SketchLine_51.result(), SketchLine_53.result()] -SketchConstraintMirror_4 = Sketch_5.addMirror(SketchLine_59.result(), SketchConstraintMirror_4_objects) -[SketchArc_9, SketchArc_10, SketchLine_68, SketchLine_69, SketchLine_70, SketchLine_71, SketchLine_72, SketchLine_73, SketchLine_74, SketchLine_75] = SketchConstraintMirror_4.mirrored() +SketchConstraintMirror_4_objects = [ + SketchArc_4.results()[1], + SketchArc_5.results()[1], + SketchLine_52.result(), + SketchLine_45.result(), + SketchLine_46.result(), + SketchLine_40.result(), + SketchLine_54.result(), + SketchLine_58.result(), + SketchLine_51.result(), + SketchLine_53.result(), +] +SketchConstraintMirror_4 = Sketch_5.addMirror( + SketchLine_59.result(), SketchConstraintMirror_4_objects +) +[ + SketchArc_9, + SketchArc_10, + SketchLine_68, + SketchLine_69, + SketchLine_70, + SketchLine_71, + SketchLine_72, + SketchLine_73, + SketchLine_74, + SketchLine_75, +] = SketchConstraintMirror_4.mirrored() SketchLine_75.setName("SketchLine_80") SketchLine_75.result().setName("SketchLine_80") SketchLine_74.setName("SketchLine_79") @@ -508,9 +946,32 @@ SketchLine_68.result().setName("SketchLine_73") model.do() Sketch_5.setName("Sketch_6") Sketch_5.result().setName("Sketch_6") -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")) +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) @@ -520,70 +981,116 @@ SketchArc_13.results()[1].setName("SketchArc_14_2") SketchLine_76 = Sketch_6.addLine(6.89, -23.55, 43.89, -23.55) SketchLine_76.setName("SketchLine_81") SketchLine_76.result().setName("SketchLine_81") -SketchConstraintCoincidence_92 = Sketch_6.setCoincident(SketchArc_11.startPoint(), SketchLine_76.endPoint()) +SketchConstraintCoincidence_92 = Sketch_6.setCoincident( + SketchArc_11.startPoint(), SketchLine_76.endPoint() +) SketchConstraintCoincidence_92.setName("SketchConstraintCoincidence_98") SketchLine_77 = Sketch_6.addLine(6.89, -13.55, 43.89, -13.55) SketchLine_77.setName("SketchLine_82") SketchLine_77.result().setName("SketchLine_82") -SketchConstraintCoincidence_93 = Sketch_6.setCoincident(SketchArc_13.startPoint(), SketchLine_77.startPoint()) +SketchConstraintCoincidence_93 = Sketch_6.setCoincident( + SketchArc_13.startPoint(), SketchLine_77.startPoint() +) SketchConstraintCoincidence_93.setName("SketchConstraintCoincidence_99") SketchLine_78 = Sketch_6.addLine(44.89, -22.55, 44.89, -14.55) SketchLine_78.setName("SketchLine_83") SketchLine_78.result().setName("SketchLine_83") -SketchConstraintCoincidence_94 = Sketch_6.setCoincident(SketchArc_12.startPoint(), SketchLine_78.endPoint()) +SketchConstraintCoincidence_94 = Sketch_6.setCoincident( + SketchArc_12.startPoint(), SketchLine_78.endPoint() +) SketchConstraintCoincidence_94.setName("SketchConstraintCoincidence_100") SketchLine_79 = Sketch_6.addLine(5.89, -22.55, 5.89, -14.55) SketchLine_79.setName("SketchLine_84") SketchLine_79.result().setName("SketchLine_84") -SketchConstraintCoincidence_95 = Sketch_6.setCoincident(SketchArc_13.endPoint(), SketchLine_79.endPoint()) +SketchConstraintCoincidence_95 = Sketch_6.setCoincident( + SketchArc_13.endPoint(), SketchLine_79.endPoint() +) SketchConstraintCoincidence_95.setName("SketchConstraintCoincidence_101") SketchConstraintHorizontal_16 = Sketch_6.setHorizontal(SketchLine_76.result()) SketchConstraintHorizontal_17 = Sketch_6.setHorizontal(SketchLine_77.result()) SketchConstraintVertical_13 = Sketch_6.setVertical(SketchLine_79.result()) SketchConstraintVertical_14 = Sketch_6.setVertical(SketchLine_78.result()) -SketchConstraintCoincidence_96 = Sketch_6.setCoincident(SketchArc_11.endPoint(), SketchLine_78.startPoint()) +SketchConstraintCoincidence_96 = Sketch_6.setCoincident( + SketchArc_11.endPoint(), SketchLine_78.startPoint() +) SketchConstraintCoincidence_96.setName("SketchConstraintCoincidence_102") -SketchConstraintCoincidence_97 = Sketch_6.setCoincident(SketchArc_12.endPoint(), SketchLine_77.endPoint()) +SketchConstraintCoincidence_97 = Sketch_6.setCoincident( + SketchArc_12.endPoint(), SketchLine_77.endPoint() +) SketchConstraintCoincidence_97.setName("SketchConstraintCoincidence_104") -SketchConstraintCoincidence_98 = Sketch_6.setCoincident(SketchArc_11.center(), SketchLine_78.result()) +SketchConstraintCoincidence_98 = Sketch_6.setCoincident( + SketchArc_11.center(), SketchLine_78.result() +) SketchConstraintCoincidence_98.setName("SketchConstraintCoincidence_105") -SketchConstraintCoincidence_99 = Sketch_6.setCoincident(SketchArc_11.center(), SketchLine_76.result()) +SketchConstraintCoincidence_99 = Sketch_6.setCoincident( + SketchArc_11.center(), SketchLine_76.result() +) SketchConstraintCoincidence_99.setName("SketchConstraintCoincidence_106") SketchConstraintRadius_5 = Sketch_6.setRadius(SketchArc_11.results()[1], 1) -SketchConstraintCoincidence_100 = Sketch_6.setCoincident(SketchArc_12.center(), SketchLine_78.result()) +SketchConstraintCoincidence_100 = Sketch_6.setCoincident( + SketchArc_12.center(), SketchLine_78.result() +) SketchConstraintCoincidence_100.setName("SketchConstraintCoincidence_107") -SketchConstraintCoincidence_101 = Sketch_6.setCoincident(SketchArc_12.center(), SketchLine_77.result()) +SketchConstraintCoincidence_101 = Sketch_6.setCoincident( + SketchArc_12.center(), SketchLine_77.result() +) SketchConstraintCoincidence_101.setName("SketchConstraintCoincidence_108") -SketchConstraintCoincidence_102 = Sketch_6.setCoincident(SketchArc_13.center(), SketchLine_77.result()) +SketchConstraintCoincidence_102 = Sketch_6.setCoincident( + SketchArc_13.center(), SketchLine_77.result() +) SketchConstraintCoincidence_102.setName("SketchConstraintCoincidence_109") -SketchConstraintEqual_8 = Sketch_6.setEqual(SketchArc_11.results()[1], SketchArc_12.results()[1]) -SketchConstraintEqual_9 = Sketch_6.setEqual(SketchArc_13.results()[1], SketchArc_11.results()[1]) +SketchConstraintEqual_8 = Sketch_6.setEqual( + SketchArc_11.results()[1], SketchArc_12.results()[1] +) +SketchConstraintEqual_9 = Sketch_6.setEqual( + SketchArc_13.results()[1], SketchArc_11.results()[1] +) SketchConstraintEqual_9.setName("SketchConstraintEqual_10") -SketchConstraintCoincidence_103 = Sketch_6.setCoincident(SketchArc_13.center(), SketchLine_79.result()) +SketchConstraintCoincidence_103 = Sketch_6.setCoincident( + SketchArc_13.center(), SketchLine_79.result() +) SketchConstraintCoincidence_103.setName("SketchConstraintCoincidence_112") -SketchConstraintDistance_10 = Sketch_6.setDistance(SketchLine_76.result(), SketchArc_13.startPoint(), 10) -SketchConstraintDistance_11 = Sketch_6.setDistance(SketchLine_79.startPoint(), SketchLine_78.result(), 39) +SketchConstraintDistance_10 = Sketch_6.setDistance( + SketchLine_76.result(), SketchArc_13.startPoint(), 10 +) +SketchConstraintDistance_11 = Sketch_6.setDistance( + SketchLine_79.startPoint(), SketchLine_78.result(), 39 +) 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) +SketchConstraintDistance_12 = Sketch_6.setDistance( + SketchLine_79.startPoint(), SketchLine_80.result(), 5.89 +) 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) +SketchConstraintDistance_13 = Sketch_6.setDistance( + SketchLine_76.endPoint(), SketchLine_81.result(), 5.3 +) SketchArc_14 = Sketch_6.addArc(5.89, -23.55, 5.89, -22.55, 6.89, -23.55, False) SketchArc_14.setName("SketchArc_15") SketchArc_14.result().setName("SketchArc_15") SketchArc_14.results()[1].setName("SketchArc_15_2") -SketchConstraintCoincidence_104 = Sketch_6.setCoincident(SketchLine_79.startPoint(), SketchArc_14.startPoint()) +SketchConstraintCoincidence_104 = Sketch_6.setCoincident( + SketchLine_79.startPoint(), SketchArc_14.startPoint() +) SketchConstraintCoincidence_104.setName("SketchConstraintCoincidence_110") -SketchConstraintCoincidence_105 = Sketch_6.setCoincident(SketchArc_14.endPoint(), SketchLine_76.startPoint()) +SketchConstraintCoincidence_105 = Sketch_6.setCoincident( + SketchArc_14.endPoint(), SketchLine_76.startPoint() +) SketchConstraintCoincidence_105.setName("SketchConstraintCoincidence_111") -SketchConstraintCoincidence_106 = Sketch_6.setCoincident(SketchArc_14.center(), SketchLine_76.result()) +SketchConstraintCoincidence_106 = Sketch_6.setCoincident( + SketchArc_14.center(), SketchLine_76.result() +) SketchConstraintCoincidence_106.setName("SketchConstraintCoincidence_113") -SketchConstraintCoincidence_107 = Sketch_6.setCoincident(SketchArc_14.center(), SketchLine_79.result()) +SketchConstraintCoincidence_107 = Sketch_6.setCoincident( + SketchArc_14.center(), SketchLine_79.result() +) SketchConstraintCoincidence_107.setName("SketchConstraintCoincidence_114") -SketchConstraintEqual_10 = Sketch_6.setEqual(SketchArc_11.results()[1], SketchArc_14.results()[1]) +SketchConstraintEqual_10 = Sketch_6.setEqual( + SketchArc_11.results()[1], SketchArc_14.results()[1] +) SketchConstraintEqual_10.setName("SketchConstraintEqual_11") SketchPoint_6 = Sketch_6.addPoint(0, -28.85) SketchPoint_6.setName("SketchPoint_8") @@ -594,19 +1101,54 @@ SketchPoint_7.result().setName("SketchPoint_9") SketchPoint_8 = Sketch_6.addPoint(101.54, -28.85) SketchPoint_8.setName("SketchPoint_10") SketchPoint_8.result().setName("SketchPoint_10") -SketchConstraintCoincidence_108 = Sketch_6.setCoincident(SketchLine_80.result(), SketchPoint_6.coordinates()) +SketchConstraintCoincidence_108 = Sketch_6.setCoincident( + SketchLine_80.result(), SketchPoint_6.coordinates() +) SketchConstraintCoincidence_108.setName("SketchConstraintCoincidence_115") -SketchConstraintCoincidence_109 = Sketch_6.setCoincident(SketchLine_81.result(), SketchPoint_6.coordinates()) +SketchConstraintCoincidence_109 = Sketch_6.setCoincident( + SketchLine_81.result(), SketchPoint_6.coordinates() +) SketchConstraintCoincidence_109.setName("SketchConstraintCoincidence_116") -SketchConstraintCoincidence_110 = Sketch_6.setCoincident(SketchPoint_7.coordinates(), SketchLine_81.result()) +SketchConstraintCoincidence_110 = Sketch_6.setCoincident( + SketchPoint_7.coordinates(), SketchLine_81.result() +) SketchConstraintCoincidence_110.setName("SketchConstraintCoincidence_117") -SketchConstraintCoincidence_111 = Sketch_6.setCoincident(SketchPoint_8.coordinates(), SketchLine_81.result()) +SketchConstraintCoincidence_111 = Sketch_6.setCoincident( + SketchPoint_8.coordinates(), SketchLine_81.result() +) SketchConstraintCoincidence_111.setName("SketchConstraintCoincidence_118") -SketchConstraintDistance_14 = Sketch_6.setDistance(SketchPoint_7.coordinates(), SketchLine_80.result(), "56.66-5.89") -SketchConstraintDistance_15 = Sketch_6.setDistance(SketchLine_80.result(), SketchPoint_8.coordinates(), "107.43-5.89") -SketchMultiTranslation_1_objects = [SketchArc_13.results()[1], SketchArc_14.results()[1], SketchArc_12.results()[1], SketchArc_11.results()[1], SketchLine_78.result(), SketchLine_76.result(), SketchLine_77.result(), SketchLine_79.result()] -SketchMultiTranslation_1 = Sketch_6.addTranslation(SketchMultiTranslation_1_objects, SketchPoint_6.coordinates(), SketchPoint_7.coordinates(), 2) -[SketchArc_15, SketchArc_16, SketchArc_17, SketchArc_18, SketchLine_82, SketchLine_83, SketchLine_84, SketchLine_85] = SketchMultiTranslation_1.translated() +SketchConstraintDistance_14 = Sketch_6.setDistance( + SketchPoint_7.coordinates(), SketchLine_80.result(), "56.66-5.89" +) +SketchConstraintDistance_15 = Sketch_6.setDistance( + SketchLine_80.result(), SketchPoint_8.coordinates(), "107.43-5.89" +) +SketchMultiTranslation_1_objects = [ + SketchArc_13.results()[1], + SketchArc_14.results()[1], + SketchArc_12.results()[1], + SketchArc_11.results()[1], + SketchLine_78.result(), + SketchLine_76.result(), + SketchLine_77.result(), + SketchLine_79.result(), +] +SketchMultiTranslation_1 = Sketch_6.addTranslation( + SketchMultiTranslation_1_objects, + SketchPoint_6.coordinates(), + SketchPoint_7.coordinates(), + 2, +) +[ + SketchArc_15, + SketchArc_16, + SketchArc_17, + SketchArc_18, + SketchLine_82, + SketchLine_83, + SketchLine_84, + SketchLine_85, +] = SketchMultiTranslation_1.translated() SketchLine_85.setName("SketchLine_90") SketchLine_85.result().setName("SketchLine_90") SketchLine_84.setName("SketchLine_89") @@ -627,9 +1169,32 @@ SketchArc_16.results()[1].setName("SketchArc_17_2") SketchArc_15.setName("SketchArc_16") SketchArc_15.result().setName("SketchArc_16") SketchArc_15.results()[1].setName("SketchArc_16_2") -SketchMultiTranslation_2_objects = [SketchArc_12.results()[1], SketchArc_13.results()[1], SketchArc_11.results()[1], SketchArc_14.results()[1], SketchLine_79.result(), SketchLine_78.result(), SketchLine_77.result(), SketchLine_76.result()] -SketchMultiTranslation_2 = Sketch_6.addTranslation(SketchMultiTranslation_2_objects, SketchPoint_6.coordinates(), SketchPoint_8.coordinates(), 2) -[SketchArc_19, SketchArc_20, SketchArc_21, SketchArc_22, SketchLine_86, SketchLine_87, SketchLine_88, SketchLine_89] = SketchMultiTranslation_2.translated() +SketchMultiTranslation_2_objects = [ + SketchArc_12.results()[1], + SketchArc_13.results()[1], + SketchArc_11.results()[1], + SketchArc_14.results()[1], + SketchLine_79.result(), + SketchLine_78.result(), + SketchLine_77.result(), + SketchLine_76.result(), +] +SketchMultiTranslation_2 = Sketch_6.addTranslation( + SketchMultiTranslation_2_objects, + SketchPoint_6.coordinates(), + SketchPoint_8.coordinates(), + 2, +) +[ + SketchArc_19, + SketchArc_20, + SketchArc_21, + SketchArc_22, + SketchLine_86, + SketchLine_87, + SketchLine_88, + SketchLine_89, +] = SketchMultiTranslation_2.translated() SketchLine_89.setName("SketchLine_94") SketchLine_89.result().setName("SketchLine_94") SketchLine_88.setName("SketchLine_93") @@ -650,9 +1215,61 @@ SketchArc_20.results()[1].setName("SketchArc_21_2") SketchArc_19.setName("SketchArc_20") SketchArc_19.result().setName("SketchArc_20") SketchArc_19.results()[1].setName("SketchArc_20_2") -SketchConstraintMirror_5_objects = [SketchArc_18.results()[1], SketchArc_17.results()[1], SketchArc_16.results()[1], SketchArc_15.results()[1], SketchArc_22.results()[1], SketchArc_20.results()[1], SketchArc_11.results()[1], SketchArc_12.results()[1], SketchArc_21.results()[1], SketchArc_19.results()[1], SketchArc_14.results()[1], SketchArc_13.results()[1], SketchLine_77.result(), SketchLine_78.result(), SketchLine_79.result(), SketchLine_85.result(), SketchLine_87.result(), SketchLine_82.result(), SketchLine_84.result(), SketchLine_86.result(), SketchLine_83.result(), SketchLine_88.result(), SketchLine_76.result(), SketchLine_89.result()] -SketchConstraintMirror_5 = Sketch_6.addMirror(SketchLine_80.result(), SketchConstraintMirror_5_objects) -[SketchArc_23, SketchArc_24, SketchArc_25, SketchArc_26, SketchArc_27, SketchArc_28, SketchArc_29, SketchArc_30, SketchArc_31, SketchArc_32, SketchArc_33, SketchArc_34, SketchLine_90, SketchLine_91, SketchLine_92, SketchLine_93, SketchLine_94, SketchLine_95, SketchLine_96, SketchLine_97, SketchLine_98, SketchLine_99, SketchLine_100, SketchLine_101] = SketchConstraintMirror_5.mirrored() +SketchConstraintMirror_5_objects = [ + SketchArc_18.results()[1], + SketchArc_17.results()[1], + SketchArc_16.results()[1], + SketchArc_15.results()[1], + SketchArc_22.results()[1], + SketchArc_20.results()[1], + SketchArc_11.results()[1], + SketchArc_12.results()[1], + SketchArc_21.results()[1], + SketchArc_19.results()[1], + SketchArc_14.results()[1], + SketchArc_13.results()[1], + SketchLine_77.result(), + SketchLine_78.result(), + SketchLine_79.result(), + SketchLine_85.result(), + SketchLine_87.result(), + SketchLine_82.result(), + SketchLine_84.result(), + SketchLine_86.result(), + SketchLine_83.result(), + SketchLine_88.result(), + SketchLine_76.result(), + SketchLine_89.result(), +] +SketchConstraintMirror_5 = Sketch_6.addMirror( + SketchLine_80.result(), SketchConstraintMirror_5_objects +) +[ + SketchArc_23, + SketchArc_24, + SketchArc_25, + SketchArc_26, + SketchArc_27, + SketchArc_28, + SketchArc_29, + SketchArc_30, + SketchArc_31, + SketchArc_32, + SketchArc_33, + SketchArc_34, + SketchLine_90, + SketchLine_91, + SketchLine_92, + SketchLine_93, + SketchLine_94, + SketchLine_95, + SketchLine_96, + SketchLine_97, + SketchLine_98, + SketchLine_99, + SketchLine_100, + SketchLine_101, +] = SketchConstraintMirror_5.mirrored() SketchLine_101.setName("SketchLine_106") SketchLine_101.result().setName("SketchLine_106") SketchLine_100.setName("SketchLine_105") @@ -716,12 +1333,119 @@ SketchArc_23.results()[1].setName("SketchArc_24_2") SketchPoint_9 = Sketch_6.addPoint(0, -49.85) SketchPoint_9.setName("SketchPoint_11") SketchPoint_9.result().setName("SketchPoint_11") -SketchConstraintCoincidence_112 = Sketch_6.setCoincident(SketchPoint_9.coordinates(), SketchLine_80.result()) +SketchConstraintCoincidence_112 = Sketch_6.setCoincident( + SketchPoint_9.coordinates(), SketchLine_80.result() +) SketchConstraintCoincidence_112.setName("SketchConstraintCoincidence_119") -SketchConstraintDistance_16 = Sketch_6.setDistance(SketchPoint_9.coordinates(), SketchLine_81.result(), "10+5.3+5.7") -SketchMultiTranslation_3_objects = [SketchArc_13.results()[1], SketchArc_34.results()[1], SketchArc_14.results()[1], SketchArc_33.results()[1], SketchArc_12.results()[1], SketchArc_11.results()[1], SketchArc_30.results()[1], SketchArc_29.results()[1], SketchArc_15.results()[1], SketchArc_16.results()[1], SketchArc_26.results()[1], SketchArc_25.results()[1], SketchArc_17.results()[1], SketchArc_18.results()[1], SketchArc_24.results()[1], SketchArc_23.results()[1], SketchArc_20.results()[1], SketchArc_22.results()[1], SketchArc_28.results()[1], SketchArc_27.results()[1], SketchArc_19.results()[1], SketchArc_21.results()[1], SketchArc_32.results()[1], SketchArc_31.results()[1], SketchLine_82.result(), SketchLine_77.result(), SketchLine_97.result(), SketchLine_94.result(), SketchLine_101.result(), SketchLine_99.result(), SketchLine_83.result(), SketchLine_88.result(), SketchLine_89.result(), SketchLine_86.result(), SketchLine_85.result(), SketchLine_100.result(), SketchLine_79.result(), SketchLine_92.result(), SketchLine_87.result(), SketchLine_91.result(), SketchLine_84.result(), SketchLine_96.result(), SketchLine_95.result(), SketchLine_93.result(), SketchLine_78.result(), SketchLine_98.result(), SketchLine_76.result(), SketchLine_90.result()] -SketchMultiTranslation_3 = Sketch_6.addTranslation(SketchMultiTranslation_3_objects, SketchPoint_6.coordinates(), SketchPoint_9.coordinates(), 2) -[SketchArc_35, SketchArc_36, SketchArc_37, SketchArc_38, SketchArc_39, SketchArc_40, SketchArc_41, SketchArc_42, SketchArc_43, SketchArc_44, SketchArc_45, SketchArc_46, SketchArc_47, SketchArc_48, SketchArc_49, SketchArc_50, SketchArc_51, SketchArc_52, SketchArc_53, SketchArc_54, SketchArc_55, SketchArc_56, SketchArc_57, SketchArc_58, SketchLine_102, SketchLine_103, SketchLine_104, SketchLine_105, SketchLine_106, SketchLine_107, SketchLine_108, SketchLine_109, SketchLine_110, SketchLine_111, SketchLine_112, SketchLine_113, SketchLine_114, SketchLine_115, SketchLine_116, SketchLine_117, SketchLine_118, SketchLine_119, SketchLine_120, SketchLine_121, SketchLine_122, SketchLine_123, SketchLine_124, SketchLine_125] = SketchMultiTranslation_3.translatedList() +SketchConstraintDistance_16 = Sketch_6.setDistance( + SketchPoint_9.coordinates(), SketchLine_81.result(), "10+5.3+5.7" +) +SketchMultiTranslation_3_objects = [ + SketchArc_13.results()[1], + SketchArc_34.results()[1], + SketchArc_14.results()[1], + SketchArc_33.results()[1], + SketchArc_12.results()[1], + SketchArc_11.results()[1], + SketchArc_30.results()[1], + SketchArc_29.results()[1], + SketchArc_15.results()[1], + SketchArc_16.results()[1], + SketchArc_26.results()[1], + SketchArc_25.results()[1], + SketchArc_17.results()[1], + SketchArc_18.results()[1], + SketchArc_24.results()[1], + SketchArc_23.results()[1], + SketchArc_20.results()[1], + SketchArc_22.results()[1], + SketchArc_28.results()[1], + SketchArc_27.results()[1], + SketchArc_19.results()[1], + SketchArc_21.results()[1], + SketchArc_32.results()[1], + SketchArc_31.results()[1], + SketchLine_82.result(), + SketchLine_77.result(), + SketchLine_97.result(), + SketchLine_94.result(), + SketchLine_101.result(), + SketchLine_99.result(), + SketchLine_83.result(), + SketchLine_88.result(), + SketchLine_89.result(), + SketchLine_86.result(), + SketchLine_85.result(), + SketchLine_100.result(), + SketchLine_79.result(), + SketchLine_92.result(), + SketchLine_87.result(), + SketchLine_91.result(), + SketchLine_84.result(), + SketchLine_96.result(), + SketchLine_95.result(), + SketchLine_93.result(), + SketchLine_78.result(), + SketchLine_98.result(), + SketchLine_76.result(), + SketchLine_90.result(), +] +SketchMultiTranslation_3 = Sketch_6.addTranslation( + SketchMultiTranslation_3_objects, + SketchPoint_6.coordinates(), + SketchPoint_9.coordinates(), + 2, +) +[ + SketchArc_35, + SketchArc_36, + SketchArc_37, + SketchArc_38, + SketchArc_39, + SketchArc_40, + SketchArc_41, + SketchArc_42, + SketchArc_43, + SketchArc_44, + SketchArc_45, + SketchArc_46, + SketchArc_47, + SketchArc_48, + SketchArc_49, + SketchArc_50, + SketchArc_51, + SketchArc_52, + SketchArc_53, + SketchArc_54, + SketchArc_55, + SketchArc_56, + SketchArc_57, + SketchArc_58, + SketchLine_102, + SketchLine_103, + SketchLine_104, + SketchLine_105, + SketchLine_106, + SketchLine_107, + SketchLine_108, + SketchLine_109, + SketchLine_110, + SketchLine_111, + SketchLine_112, + SketchLine_113, + SketchLine_114, + SketchLine_115, + SketchLine_116, + SketchLine_117, + SketchLine_118, + SketchLine_119, + SketchLine_120, + SketchLine_121, + SketchLine_122, + SketchLine_123, + SketchLine_124, + SketchLine_125, +] = SketchMultiTranslation_3.translatedList() SketchLine_125.setName("SketchLine_130") SketchLine_125.result().setName("SketchLine_130") SketchLine_124.setName("SketchLine_129") @@ -845,23 +1569,86 @@ SketchArc_35.results()[1].setName("SketchArc_36_2") model.do() Sketch_6.setName("Sketch_7") Sketch_6.result().setName("Sketch_7") -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")) +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/SketchLine_67_StartVertex")) +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) SketchLine_128.setName("SketchLine_131") SketchLine_128.result().setName("SketchLine_131") SketchLine_128.setAuxiliary(True) -SketchConstraintCoincidence_113 = Sketch_7.setCoincident(SketchLine_128.endPoint(), SketchPoint_10.result()) +SketchConstraintCoincidence_113 = Sketch_7.setCoincident( + SketchLine_128.endPoint(), SketchPoint_10.result() +) SketchConstraintCoincidence_113.setName("SketchConstraintCoincidence_120") SketchLine_129 = Sketch_7.addLine(-153.5, -45.05, -153.5, -37.05) SketchLine_129.setName("SketchLine_132") @@ -873,28 +1660,42 @@ SketchLine_131 = Sketch_7.addLine(-150.8, -37.05, -150.8, -45.05) SketchLine_131.setName("SketchLine_134") SketchLine_131.result().setName("SketchLine_134") SketchLine_131.setAuxiliary(True) -SketchConstraintCoincidence_114 = Sketch_7.setCoincident(SketchLine_131.endPoint(), SketchLine_128.startPoint()) +SketchConstraintCoincidence_114 = Sketch_7.setCoincident( + SketchLine_131.endPoint(), SketchLine_128.startPoint() +) SketchConstraintCoincidence_114.setName("SketchConstraintCoincidence_121") -SketchConstraintCoincidence_115 = Sketch_7.setCoincident(SketchLine_128.endPoint(), SketchLine_129.startPoint()) +SketchConstraintCoincidence_115 = Sketch_7.setCoincident( + SketchLine_128.endPoint(), SketchLine_129.startPoint() +) SketchConstraintCoincidence_115.setName("SketchConstraintCoincidence_122") SketchLine_132 = Sketch_7.addLine(-153.5, -37.05, -150.8, -37.05) SketchLine_132.setName("SketchLine_133") SketchLine_132.result().setName("SketchLine_133") SketchLine_132.setAuxiliary(True) -SketchConstraintCoincidence_116 = Sketch_7.setCoincident(SketchLine_129.endPoint(), SketchLine_132.startPoint()) +SketchConstraintCoincidence_116 = Sketch_7.setCoincident( + SketchLine_129.endPoint(), SketchLine_132.startPoint() +) SketchConstraintCoincidence_116.setName("SketchConstraintCoincidence_123") -SketchConstraintCoincidence_117 = Sketch_7.setCoincident(SketchLine_132.endPoint(), SketchLine_131.startPoint()) +SketchConstraintCoincidence_117 = Sketch_7.setCoincident( + SketchLine_132.endPoint(), SketchLine_131.startPoint() +) SketchConstraintCoincidence_117.setName("SketchConstraintCoincidence_124") 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/SketchLine_70_StartVertex")) +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()) +SketchConstraintCoincidence_118 = Sketch_7.setCoincident( + SketchLine_132.endPoint(), SketchPoint_11.result() +) SketchConstraintCoincidence_118.setName("SketchConstraintCoincidence_125") -SketchArc_59 = Sketch_7.addArc(-152.3, -38.55, -150.8, -38.55, -152.3000099350335, -37.05, False) +SketchArc_59 = Sketch_7.addArc( + -152.3, -38.55, -150.8, -38.55, -152.3000099350335, -37.05, False +) SketchArc_59.setName("SketchArc_60") SketchArc_59.result().setName("SketchArc_60") SketchArc_59.results()[1].setName("SketchArc_60_2") @@ -902,45 +1703,87 @@ SketchLine_133 = Sketch_7.addLine(-150.8, -38.55, -150.8, -45.05) SketchLine_133.setName("SketchLine_136") SketchLine_133.result().setName("SketchLine_136") SketchLine_133.setAuxiliary(True) -SketchConstraintCoincidence_119 = Sketch_7.setCoincident(SketchArc_59.startPoint(), SketchLine_133.startPoint()) +SketchConstraintCoincidence_119 = Sketch_7.setCoincident( + SketchArc_59.startPoint(), SketchLine_133.startPoint() +) SketchConstraintCoincidence_119.setName("SketchConstraintCoincidence_126") -SketchConstraintCoincidence_120 = Sketch_7.setCoincident(SketchArc_59.endPoint(), SketchLine_126.endPoint()) +SketchConstraintCoincidence_120 = Sketch_7.setCoincident( + SketchArc_59.endPoint(), SketchLine_126.endPoint() +) SketchConstraintCoincidence_120.setName("SketchConstraintCoincidence_127") -SketchConstraintTangent_13 = Sketch_7.setTangent(SketchArc_59.results()[1], SketchLine_126.result()) -SketchConstraintTangent_14 = Sketch_7.setTangent(SketchArc_59.results()[1], SketchLine_133.result()) -SketchConstraintCoincidence_121 = Sketch_7.setCoincident(SketchLine_132.startPoint(), SketchLine_126.startPoint()) +SketchConstraintTangent_13 = Sketch_7.setTangent( + SketchArc_59.results()[1], SketchLine_126.result() +) +SketchConstraintTangent_14 = Sketch_7.setTangent( + SketchArc_59.results()[1], SketchLine_133.result() +) +SketchConstraintCoincidence_121 = Sketch_7.setCoincident( + SketchLine_132.startPoint(), SketchLine_126.startPoint() +) SketchConstraintCoincidence_121.setName("SketchConstraintCoincidence_128") -SketchConstraintCoincidence_122 = Sketch_7.setCoincident(SketchLine_131.endPoint(), SketchLine_133.endPoint()) +SketchConstraintCoincidence_122 = Sketch_7.setCoincident( + SketchLine_131.endPoint(), SketchLine_133.endPoint() +) SketchConstraintCoincidence_122.setName("SketchConstraintCoincidence_129") -SketchConstraintCoincidence_123 = Sketch_7.setCoincident(SketchLine_126.endPoint(), SketchLine_132.result()) +SketchConstraintCoincidence_123 = Sketch_7.setCoincident( + SketchLine_126.endPoint(), SketchLine_132.result() +) SketchConstraintCoincidence_123.setName("SketchConstraintCoincidence_130") -SketchConstraintCoincidence_124 = Sketch_7.setCoincident(SketchLine_133.startPoint(), SketchLine_131.result()) +SketchConstraintCoincidence_124 = Sketch_7.setCoincident( + SketchLine_133.startPoint(), SketchLine_131.result() +) SketchConstraintCoincidence_124.setName("SketchConstraintCoincidence_131") SketchArc_60 = Sketch_7.addArc(-152.3, -43.55, -152.3, -45.05, -150.8, -43.55, False) SketchArc_60.setName("SketchArc_61") SketchArc_60.result().setName("SketchArc_61") SketchArc_60.results()[1].setName("SketchArc_61_2") -SketchConstraintCoincidence_125 = Sketch_7.setCoincident(SketchArc_60.startPoint(), SketchLine_130.startPoint()) +SketchConstraintCoincidence_125 = Sketch_7.setCoincident( + SketchArc_60.startPoint(), SketchLine_130.startPoint() +) SketchConstraintCoincidence_125.setName("SketchConstraintCoincidence_132") -SketchConstraintCoincidence_126 = Sketch_7.setCoincident(SketchArc_60.endPoint(), SketchLine_127.endPoint()) +SketchConstraintCoincidence_126 = Sketch_7.setCoincident( + SketchArc_60.endPoint(), SketchLine_127.endPoint() +) SketchConstraintCoincidence_126.setName("SketchConstraintCoincidence_133") -SketchConstraintTangent_15 = Sketch_7.setTangent(SketchArc_60.results()[1], SketchLine_130.result()) -SketchConstraintTangent_16 = Sketch_7.setTangent(SketchArc_60.results()[1], SketchLine_127.result()) -SketchConstraintCoincidence_127 = Sketch_7.setCoincident(SketchLine_128.endPoint(), SketchLine_130.endPoint()) +SketchConstraintTangent_15 = Sketch_7.setTangent( + SketchArc_60.results()[1], SketchLine_130.result() +) +SketchConstraintTangent_16 = Sketch_7.setTangent( + SketchArc_60.results()[1], SketchLine_127.result() +) +SketchConstraintCoincidence_127 = Sketch_7.setCoincident( + SketchLine_128.endPoint(), SketchLine_130.endPoint() +) SketchConstraintCoincidence_127.setName("SketchConstraintCoincidence_134") -SketchConstraintCoincidence_128 = Sketch_7.setCoincident(SketchLine_133.startPoint(), SketchLine_127.startPoint()) +SketchConstraintCoincidence_128 = Sketch_7.setCoincident( + SketchLine_133.startPoint(), SketchLine_127.startPoint() +) SketchConstraintCoincidence_128.setName("SketchConstraintCoincidence_135") -SketchConstraintCoincidence_129 = Sketch_7.setCoincident(SketchLine_130.startPoint(), SketchLine_128.result()) +SketchConstraintCoincidence_129 = Sketch_7.setCoincident( + SketchLine_130.startPoint(), SketchLine_128.result() +) SketchConstraintCoincidence_129.setName("SketchConstraintCoincidence_136") -SketchConstraintCoincidence_130 = Sketch_7.setCoincident(SketchLine_127.endPoint(), SketchLine_133.result()) +SketchConstraintCoincidence_130 = Sketch_7.setCoincident( + SketchLine_127.endPoint(), SketchLine_133.result() +) SketchConstraintCoincidence_130.setName("SketchConstraintCoincidence_137") SketchConstraintRadius_6 = Sketch_7.setRadius(SketchArc_60.results()[1], 1.5) SketchConstraintRadius_7 = Sketch_7.setRadius(SketchArc_59.results()[1], 1.5) 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/Modified_Face&Sketch_1/SketchLine_10")) +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/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") @@ -953,32 +1796,52 @@ SketchArc_61 = Sketch_8.addArc(0.85, 49.1, 0.85, 47.45, 0.85, 50.75, False) SketchArc_61.setName("SketchArc_63") SketchArc_61.result().setName("SketchArc_63") SketchArc_61.results()[1].setName("SketchArc_63_2") -SketchConstraintCoincidence_131 = Sketch_8.setCoincident(SketchLine_134.startPoint(), SketchArc_61.endPoint()) +SketchConstraintCoincidence_131 = Sketch_8.setCoincident( + SketchLine_134.startPoint(), SketchArc_61.endPoint() +) SketchConstraintCoincidence_131.setName("SketchConstraintCoincidence_146") -SketchConstraintCoincidence_132 = Sketch_8.setCoincident(SketchArc_61.startPoint(), SketchLine_135.endPoint()) +SketchConstraintCoincidence_132 = Sketch_8.setCoincident( + SketchArc_61.startPoint(), SketchLine_135.endPoint() +) SketchConstraintCoincidence_132.setName("SketchConstraintCoincidence_148") -SketchConstraintDistance_17 = Sketch_8.setDistance(SketchLine_134.result(), SketchLine_135.endPoint(), 3.3) +SketchConstraintDistance_17 = Sketch_8.setDistance( + SketchLine_134.result(), SketchLine_135.endPoint(), 3.3 +) SketchLine_136 = Sketch_8.addLine(0.85, 50.75, 0.85, 47.45) SketchLine_136.setName("SketchLine_140") SketchLine_136.result().setName("SketchLine_140") SketchLine_136.setAuxiliary(True) -SketchConstraintCoincidence_133 = Sketch_8.setCoincident(SketchLine_134.startPoint(), SketchLine_136.startPoint()) +SketchConstraintCoincidence_133 = Sketch_8.setCoincident( + SketchLine_134.startPoint(), SketchLine_136.startPoint() +) SketchConstraintCoincidence_133.setName("SketchConstraintCoincidence_138") -SketchConstraintCoincidence_134 = Sketch_8.setCoincident(SketchArc_61.endPoint(), SketchLine_136.startPoint()) +SketchConstraintCoincidence_134 = Sketch_8.setCoincident( + SketchArc_61.endPoint(), SketchLine_136.startPoint() +) SketchConstraintCoincidence_134.setName("SketchConstraintCoincidence_139") -SketchConstraintCoincidence_135 = Sketch_8.setCoincident(SketchLine_135.endPoint(), SketchLine_136.endPoint()) +SketchConstraintCoincidence_135 = Sketch_8.setCoincident( + SketchLine_135.endPoint(), SketchLine_136.endPoint() +) SketchConstraintCoincidence_135.setName("SketchConstraintCoincidence_140") -SketchConstraintCoincidence_136 = Sketch_8.setCoincident(SketchArc_61.startPoint(), SketchLine_136.endPoint()) +SketchConstraintCoincidence_136 = Sketch_8.setCoincident( + SketchArc_61.startPoint(), SketchLine_136.endPoint() +) SketchConstraintCoincidence_136.setName("SketchConstraintCoincidence_141") SketchLine_137 = Sketch_8.addLine(-0.85, 50.75, -0.85, 47.45) SketchLine_137.setName("SketchLine_142") SketchLine_137.result().setName("SketchLine_142") SketchLine_137.setAuxiliary(True) -SketchConstraintCoincidence_137 = Sketch_8.setCoincident(SketchLine_134.endPoint(), SketchLine_137.startPoint()) +SketchConstraintCoincidence_137 = Sketch_8.setCoincident( + SketchLine_134.endPoint(), SketchLine_137.startPoint() +) SketchConstraintCoincidence_137.setName("SketchConstraintCoincidence_143") -SketchConstraintCoincidence_138 = Sketch_8.setCoincident(SketchLine_135.startPoint(), SketchLine_137.endPoint()) +SketchConstraintCoincidence_138 = Sketch_8.setCoincident( + SketchLine_135.startPoint(), SketchLine_137.endPoint() +) SketchConstraintCoincidence_138.setName("SketchConstraintCoincidence_147") -SketchConstraintCoincidence_152 = Sketch_8.setCoincident(SketchArc_61.center(), SketchLine_136.result()) +SketchConstraintCoincidence_152 = Sketch_8.setCoincident( + SketchArc_61.center(), SketchLine_136.result() +) SketchConstraintLength_10 = Sketch_8.setLength(SketchLine_134.result(), 1.7) SketchConstraintLength_10.setName("SketchConstraintLength_11") SketchConstraintVertical_17 = Sketch_8.setVertical(SketchLine_137.result()) @@ -987,55 +1850,105 @@ SketchLine_138 = Sketch_8.addLine(0.85, 50.75, -0.85, 47.45) SketchLine_138.setName("SketchLine_143") SketchLine_138.result().setName("SketchLine_143") SketchLine_138.setAuxiliary(True) -SketchConstraintCoincidence_139 = Sketch_8.setCoincident(SketchLine_134.startPoint(), SketchLine_138.startPoint()) +SketchConstraintCoincidence_139 = Sketch_8.setCoincident( + SketchLine_134.startPoint(), SketchLine_138.startPoint() +) SketchConstraintCoincidence_139.setName("SketchConstraintCoincidence_150") -SketchConstraintCoincidence_140 = Sketch_8.setCoincident(SketchArc_61.endPoint(), SketchLine_138.startPoint()) +SketchConstraintCoincidence_140 = Sketch_8.setCoincident( + SketchArc_61.endPoint(), SketchLine_138.startPoint() +) SketchConstraintCoincidence_140.setName("SketchConstraintCoincidence_151") -SketchConstraintCoincidence_141 = Sketch_8.setCoincident(SketchLine_136.startPoint(), SketchLine_138.startPoint()) +SketchConstraintCoincidence_141 = Sketch_8.setCoincident( + SketchLine_136.startPoint(), SketchLine_138.startPoint() +) SketchConstraintCoincidence_141.setName("SketchConstraintCoincidence_152") -SketchConstraintCoincidence_142 = Sketch_8.setCoincident(SketchLine_135.startPoint(), SketchLine_138.endPoint()) +SketchConstraintCoincidence_142 = Sketch_8.setCoincident( + SketchLine_135.startPoint(), SketchLine_138.endPoint() +) SketchConstraintCoincidence_142.setName("SketchConstraintCoincidence_153") -SketchConstraintCoincidence_143 = Sketch_8.setCoincident(SketchLine_137.endPoint(), SketchLine_138.endPoint()) +SketchConstraintCoincidence_143 = Sketch_8.setCoincident( + SketchLine_137.endPoint(), SketchLine_138.endPoint() +) SketchConstraintCoincidence_143.setName("SketchConstraintCoincidence_155") SketchPoint_12 = Sketch_8.addPoint(0, 49.1) SketchPoint_12.setName("SketchPoint_14") SketchPoint_12.result().setName("SketchPoint_14") -SketchConstraintCoincidence_144 = Sketch_8.setCoincident(SketchPoint_12.coordinates(), SketchLine_138.result()) +SketchConstraintCoincidence_144 = Sketch_8.setCoincident( + SketchPoint_12.coordinates(), SketchLine_138.result() +) SketchConstraintCoincidence_144.setName("SketchConstraintCoincidence_156") -SketchConstraintMiddle_3 = Sketch_8.setMiddlePoint(SketchLine_138.result(), SketchPoint_12.coordinates()) +SketchConstraintMiddle_3 = Sketch_8.setMiddlePoint( + SketchLine_138.result(), SketchPoint_12.coordinates() +) SketchConstraintMiddle_3.setName("SketchConstraintMiddle_4") SketchProjection_2 = Sketch_8.addProjection(model.selection("EDGE", "PartSet/OY")) SketchLine_139 = SketchProjection_2.createdFeature() SketchLine_139.setName("SketchLine_144") SketchLine_139.result().setName("SketchLine_144") -SketchConstraintCoincidence_145 = Sketch_8.setCoincident(SketchPoint_12.coordinates(), SketchLine_139.result()) +SketchConstraintCoincidence_145 = Sketch_8.setCoincident( + SketchPoint_12.coordinates(), SketchLine_139.result() +) SketchConstraintCoincidence_145.setName("SketchConstraintCoincidence_157") SketchArc_62 = Sketch_8.addArc(-0.85, 49.1, -0.85, 50.75, -0.85, 47.45, False) -SketchConstraintCoincidence_146 = Sketch_8.setCoincident(SketchLine_135.startPoint(), SketchArc_62.endPoint()) +SketchConstraintCoincidence_146 = Sketch_8.setCoincident( + SketchLine_135.startPoint(), SketchArc_62.endPoint() +) SketchConstraintCoincidence_146.setName("SketchConstraintCoincidence_149") -SketchConstraintCoincidence_147 = Sketch_8.setCoincident(SketchLine_137.endPoint(), SketchArc_62.endPoint()) +SketchConstraintCoincidence_147 = Sketch_8.setCoincident( + SketchLine_137.endPoint(), SketchArc_62.endPoint() +) SketchConstraintCoincidence_147.setName("SketchConstraintCoincidence_154") -SketchConstraintCoincidence_148 = Sketch_8.setCoincident(SketchLine_138.endPoint(), SketchArc_62.endPoint()) +SketchConstraintCoincidence_148 = Sketch_8.setCoincident( + SketchLine_138.endPoint(), SketchArc_62.endPoint() +) SketchConstraintCoincidence_148.setName("SketchConstraintCoincidence_158") -SketchConstraintCoincidence_149 = Sketch_8.setCoincident(SketchArc_62.startPoint(), SketchLine_134.endPoint()) +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/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_6_1/Modified_Face&Sketch_1/SketchLine_10]")) +SketchConstraintCoincidence_150 = Sketch_8.setCoincident( + SketchArc_62.center(), SketchLine_137.result() +) +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) +SketchConstraintDistance_18 = Sketch_8.setDistance( + SketchLine_140.result(), SketchPoint_12.coordinates(), 6 +) SketchLine_141 = Sketch_8.addLine(0, 49.1, 107.43, 49.1) SketchLine_141.setName("SketchLine_146") SketchLine_141.result().setName("SketchLine_146") SketchLine_141.setAuxiliary(True) -SketchConstraintCoincidence_151 = Sketch_8.setCoincident(SketchPoint_12.coordinates(), SketchLine_141.startPoint()) +SketchConstraintCoincidence_151 = Sketch_8.setCoincident( + SketchPoint_12.coordinates(), SketchLine_141.startPoint() +) SketchConstraintHorizontal_22 = Sketch_8.setHorizontal(SketchLine_141.result()) SketchConstraintLength_11 = Sketch_8.setLength(SketchLine_141.result(), 107.43) SketchConstraintLength_11.setName("SketchConstraintLength_12") -SketchMultiTranslation_4_objects = [SketchLine_134.result(), SketchLine_135.result(), SketchArc_61.results()[1], SketchArc_62.results()[1]] -SketchMultiTranslation_4 = Sketch_8.addTranslation(SketchMultiTranslation_4_objects, SketchPoint_12.coordinates(), SketchLine_141.endPoint(), 2) -[SketchLine_142, SketchLine_143, SketchArc_63, SketchArc_64] = SketchMultiTranslation_4.translated() +SketchMultiTranslation_4_objects = [ + SketchLine_134.result(), + SketchLine_135.result(), + SketchArc_61.results()[1], + SketchArc_62.results()[1], +] +SketchMultiTranslation_4 = Sketch_8.addTranslation( + SketchMultiTranslation_4_objects, + SketchPoint_12.coordinates(), + SketchLine_141.endPoint(), + 2, +) +[ + SketchLine_142, + SketchLine_143, + SketchArc_63, + SketchArc_64, +] = SketchMultiTranslation_4.translated() SketchArc_64.setName("SketchArc_65") SketchArc_64.result().setName("SketchArc_65") SketchArc_64.results()[1].setName("SketchArc_65_2") @@ -1046,9 +1959,21 @@ SketchLine_143.setName("SketchLine_148") SketchLine_143.result().setName("SketchLine_148") SketchLine_142.setName("SketchLine_147") SketchLine_142.result().setName("SketchLine_147") -SketchConstraintMirror_6_objects = [SketchArc_63.results()[1], SketchArc_64.results()[1], SketchLine_142.result(), SketchLine_143.result()] -SketchConstraintMirror_6 = Sketch_8.addMirror(SketchLine_139.result(), SketchConstraintMirror_6_objects) -[SketchArc_65, SketchArc_66, SketchLine_144, SketchLine_145] = SketchConstraintMirror_6.mirrored() +SketchConstraintMirror_6_objects = [ + SketchArc_63.results()[1], + SketchArc_64.results()[1], + SketchLine_142.result(), + SketchLine_143.result(), +] +SketchConstraintMirror_6 = Sketch_8.addMirror( + SketchLine_139.result(), SketchConstraintMirror_6_objects +) +[ + SketchArc_65, + SketchArc_66, + SketchLine_144, + SketchLine_145, +] = SketchConstraintMirror_6.mirrored() SketchLine_145.setName("SketchLine_150") SketchLine_145.result().setName("SketchLine_150") SketchLine_144.setName("SketchLine_149") @@ -1062,7 +1987,27 @@ 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-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")]) +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 @@ -1082,4 +2027,4 @@ model.testNbSubShapes(ExtrusionCut_7, GeomAPI_Shape.EDGE, [916]) model.testNbSubShapes(ExtrusionCut_7, GeomAPI_Shape.VERTEX, [1832]) model.testResultsVolumes(ExtrusionCut_7, [5345.689484659372283203992992640]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.models/flange.py b/test.models/flange.py index d2b134a7e..fccf2bc1b 100644 --- a/test.models/flange.py +++ b/test.models/flange.py @@ -28,90 +28,247 @@ Parameter_thick = model.addParameter(Part_1_doc, "thick", "16") Parameter_length = model.addParameter(Part_1_doc, "length", "172") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OZ")) -SketchArc_1 = Sketch_1.addArc(-1.656176621148808e-020, 61, -36.69142117459658, 34.94736842105263, -1.927105092898643e-024, 106, True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.center()) +SketchArc_1 = Sketch_1.addArc( + -1.656176621148808e-020, + 61, + -36.69142117459658, + 34.94736842105263, + -1.927105092898643e-024, + 106, + True, +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.center() +) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_3 = Sketch_1.addLine(-46.47580015448901, 16.00000000000001, -86, 16) SketchLine_4 = Sketch_1.addLine(-86, 16, -86, -1.232595164407831e-032) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(-86, -1.232595164407831e-032, -46.47580015448901, 7.497132070176856e-024) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchArc_2 = Sketch_1.addArc(5.604803279647422e-025, 61, -23.64558253474002, 44.21052631578948, -7.759334428649666e-022, 90, True) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.center(), SketchArc_2.center()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) +SketchLine_5 = Sketch_1.addLine( + -86, -1.232595164407831e-032, -46.47580015448901, 7.497132070176856e-024 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) +SketchArc_2 = Sketch_1.addArc( + 5.604803279647422e-025, + 61, + -23.64558253474002, + 44.21052631578948, + -7.759334428649666e-022, + 90, + True, +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchArc_2.center() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result()) -SketchArc_3 = Sketch_1.addArc(-46.47580015448901, 28.00000000000001, -36.69142117459658, 34.94736842105264, -46.47580015448901, 16.00000000000001, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchArc_3.startPoint()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchArc_3.endPoint()) -SketchArc_4 = Sketch_1.addArc(-46.475800154489, 28, -23.64558253474002, 44.21052631578947, -46.475800154489, -2.594279994652913e-031, True) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchArc_4.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_5.endPoint()) +SketchArc_3 = Sketch_1.addArc( + -46.47580015448901, + 28.00000000000001, + -36.69142117459658, + 34.94736842105264, + -46.47580015448901, + 16.00000000000001, + True, +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchArc_3.startPoint() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchArc_3.endPoint() +) +SketchArc_4 = Sketch_1.addArc( + -46.475800154489, + 28, + -23.64558253474002, + 44.21052631578947, + -46.475800154489, + -2.594279994652913e-031, + True, +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchArc_4.startPoint() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_5.endPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_3.results()[1], 12) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_3.results()[1]) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_3.result()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_4.center(), SketchArc_3.center()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_5.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_2.center(), SketchLine_5.result(), 61) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchArc_2.results()[1]) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.result()) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchArc_3.results()[1] +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_3.result() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_4.center(), SketchArc_3.center() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchLine_5.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_2.center(), SketchLine_5.result(), 61 +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchArc_2.results()[1] +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_5.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), "thick") -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_4.result(), "length/2") -SketchConstraintMirror_1_objects = [SketchArc_2.results()[1], SketchArc_4.results()[1], SketchLine_5.result(), SketchLine_4.result(), SketchLine_3.result(), SketchArc_3.results()[1], SketchArc_1.results()[1]] -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_1.result(), SketchConstraintMirror_1_objects) -[SketchArc_5, SketchArc_6, SketchLine_6, SketchLine_7, SketchLine_8, SketchArc_7, SketchArc_8] = SketchConstraintMirror_1.mirrored() +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.result() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_4.result(), "length/2" +) +SketchConstraintMirror_1_objects = [ + SketchArc_2.results()[1], + SketchArc_4.results()[1], + SketchLine_5.result(), + SketchLine_4.result(), + SketchLine_3.result(), + SketchArc_3.results()[1], + SketchArc_1.results()[1], +] +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_1.result(), SketchConstraintMirror_1_objects +) +[ + 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-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) +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) SketchLine_9 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchArc_9.center(), SketchLine_9.result(), "61+dint/2+thick") +SketchConstraintDistance_3 = Sketch_2.setDistance( + SketchArc_9.center(), SketchLine_9.result(), "61+dint/2+thick" +) SketchLine_10 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OZ")) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchArc_9.startPoint(), SketchLine_10.result()) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchArc_9.endPoint(), SketchLine_10.result()) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchArc_9.center(), SketchLine_10.result()) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchArc_9.startPoint(), SketchLine_10.result() +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchArc_9.endPoint(), SketchLine_10.result() +) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchArc_9.center(), SketchLine_10.result() +) 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()) +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_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")]) +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) SketchLine_13 = Sketch_3.addLine(-4, 106, -4, 67.34428877022477) -SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_18 = Sketch_3.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_12.result()) SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_13.result()) SketchPoint_1 = Sketch_3.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintDistance_4 = Sketch_3.setDistance(SketchPoint_1.coordinates(), SketchLine_12.result(), "61+90/2") +SketchConstraintDistance_4 = Sketch_3.setDistance( + SketchPoint_1.coordinates(), SketchLine_12.result(), "61+90/2" +) SketchLine_14 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_14.setName("SketchLine_15") SketchLine_14.result().setName("SketchLine_15") -SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_12.startPoint(), SketchLine_14.result()) +SketchConstraintCoincidence_19 = Sketch_3.setCoincident( + SketchLine_12.startPoint(), SketchLine_14.result() +) SketchConstraintLength_2 = Sketch_3.setLength(SketchLine_12.result(), "8/2") -SketchArc_10 = Sketch_3.addArc(0, 61, -4, 67.34428877022477, 4, 67.34428877022477, False) -SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_14.result(), SketchArc_10.center()) +SketchArc_10 = Sketch_3.addArc( + 0, 61, -4, 67.34428877022477, 4, 67.34428877022477, False +) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident( + SketchLine_14.result(), SketchArc_10.center() +) SketchConstraintRadius_4 = Sketch_3.setRadius(SketchArc_10.results()[1], "15/2") SketchLine_15 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_15.setName("SketchLine_16") SketchLine_15.result().setName("SketchLine_16") -SketchConstraintDistance_5 = Sketch_3.setDistance(SketchArc_10.center(), SketchLine_15.result(), 61) -SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchArc_10.startPoint()) -SketchConstraintMirror_2 = Sketch_3.addMirror(SketchLine_14.result(), [SketchLine_13.result(), SketchLine_12.result()]) +SketchConstraintDistance_5 = Sketch_3.setDistance( + SketchArc_10.center(), SketchLine_15.result(), 61 +) +SketchConstraintCoincidence_21 = Sketch_3.setCoincident( + SketchLine_13.endPoint(), SketchArc_10.startPoint() +) +SketchConstraintMirror_2 = Sketch_3.addMirror( + SketchLine_14.result(), [SketchLine_13.result(), SketchLine_12.result()] +) [SketchLine_16, SketchLine_17] = SketchConstraintMirror_2.mirrored() SketchLine_17.setName("SketchLine_18") SketchLine_17.result().setName("SketchLine_18") SketchLine_16.setName("SketchLine_17") SketchLine_16.result().setName("SketchLine_17") -SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchArc_10.endPoint(), SketchLine_16.result()) +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/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&Sketch_1/SketchLine_5")) +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&Sketch_1/SketchLine_5"), +) SketchLine_18 = Sketch_4.addLine(-65, 16, -65, -16) SketchLine_18.setName("SketchLine_19") SketchLine_18.result().setName("SketchLine_19") @@ -119,38 +276,88 @@ SketchLine_18.setAuxiliary(True) SketchConstraintVertical_3 = Sketch_4.setVertical(SketchLine_18.result()) SketchConstraintLength_3 = Sketch_4.setLength(SketchLine_18.result(), 32) SketchPoint_2 = Sketch_4.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintDistance_6 = Sketch_4.setDistance(SketchPoint_2.coordinates(), SketchLine_18.result(), "130/2") +SketchConstraintDistance_6 = Sketch_4.setDistance( + SketchPoint_2.coordinates(), SketchLine_18.result(), "130/2" +) SketchPoint_3 = Sketch_4.addPoint(-65, 0) SketchPoint_3.setAuxiliary(True) -SketchConstraintMiddle_1 = Sketch_4.setMiddlePoint(SketchPoint_3.coordinates(), SketchLine_18.result()) +SketchConstraintMiddle_1 = Sketch_4.setMiddlePoint( + SketchPoint_3.coordinates(), SketchLine_18.result() +) SketchLine_19 = Sketch_4.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_19.setName("SketchLine_20") SketchLine_19.result().setName("SketchLine_20") -SketchConstraintCoincidence_23 = Sketch_4.setCoincident(SketchPoint_3.coordinates(), SketchLine_19.result()) +SketchConstraintCoincidence_23 = Sketch_4.setCoincident( + SketchPoint_3.coordinates(), SketchLine_19.result() +) SketchArc_11 = Sketch_4.addArc(-65, 16, -59, 16, -71, 16, False) -SketchConstraintCoincidence_24 = Sketch_4.setCoincident(SketchLine_18.startPoint(), SketchArc_11.center()) +SketchConstraintCoincidence_24 = Sketch_4.setCoincident( + SketchLine_18.startPoint(), SketchArc_11.center() +) SketchArc_12 = Sketch_4.addArc(-65, -16, -59, -16.00003459934639, -71, -16, True) -SketchConstraintCoincidence_25 = Sketch_4.setCoincident(SketchLine_18.endPoint(), SketchArc_12.center()) +SketchConstraintCoincidence_25 = Sketch_4.setCoincident( + SketchLine_18.endPoint(), SketchArc_12.center() +) SketchConstraintRadius_5 = Sketch_4.setRadius(SketchArc_11.results()[1], 6) SketchLine_20 = Sketch_4.addLine(-71, 16, -71, -16) SketchLine_20.setName("SketchLine_21") SketchLine_20.result().setName("SketchLine_21") -SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchArc_11.endPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchArc_12.endPoint(), SketchLine_20.endPoint()) +SketchConstraintCoincidence_26 = Sketch_4.setCoincident( + SketchArc_11.endPoint(), SketchLine_20.startPoint() +) +SketchConstraintCoincidence_27 = Sketch_4.setCoincident( + SketchArc_12.endPoint(), SketchLine_20.endPoint() +) SketchLine_21 = Sketch_4.addLine(-59, 16, -59, -16.00003459934639) SketchLine_21.setName("SketchLine_22") SketchLine_21.result().setName("SketchLine_22") -SketchConstraintCoincidence_28 = Sketch_4.setCoincident(SketchArc_11.startPoint(), SketchLine_21.startPoint()) -SketchConstraintCoincidence_29 = Sketch_4.setCoincident(SketchArc_12.startPoint(), SketchLine_21.endPoint()) +SketchConstraintCoincidence_28 = Sketch_4.setCoincident( + SketchArc_11.startPoint(), SketchLine_21.startPoint() +) +SketchConstraintCoincidence_29 = Sketch_4.setCoincident( + SketchArc_12.startPoint(), SketchLine_21.endPoint() +) SketchConstraintVertical_4 = Sketch_4.setVertical(SketchLine_20.result()) SketchConstraintVertical_5 = Sketch_4.setVertical(SketchLine_21.result()) -SketchConstraintTangent_5 = Sketch_4.setTangent(SketchLine_20.result(), SketchArc_11.results()[1]) -SketchConstraintTangent_6 = Sketch_4.setTangent(SketchLine_21.result(), SketchArc_11.results()[1]) -SketchConstraintTangent_7 = Sketch_4.setTangent(SketchArc_12.results()[1], SketchLine_20.result()) +SketchConstraintTangent_5 = Sketch_4.setTangent( + SketchLine_20.result(), SketchArc_11.results()[1] +) +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/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")]) +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() # Test reexecution after parameter change @@ -175,4 +382,4 @@ model.testNbSubShapes(Cut_3, GeomAPI_Shape.EDGE, [192]) model.testNbSubShapes(Cut_3, GeomAPI_Shape.VERTEX, [384]) model.testResultsVolumes(Cut_3, [307084.534467286430299282073974609]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.models/gear.py b/test.models/gear.py index f47df1b17..d1d02f76a 100644 --- a/test.models/gear.py +++ b/test.models/gear.py @@ -27,31 +27,53 @@ Parameter_R = model.addParameter(partSet, "R", "15.5") Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 30, 0) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "Origin")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "OX")) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) SketchLine_3 = Sketch_1.addLine(30, 0, 30, 37.5) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(30, 37.5, 17, 37.5) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(17, 37.5, 17, 15.5) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(17, 15.5, 0, 15.5) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(model.selection("EDGE", "OY")) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.result()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_7.result() +) SketchLine_8 = Sketch_1.addLine(0, 15.5, 0, 0) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_8.startPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_6.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.endPoint(), SketchLine_8.result(), 30) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_1.endPoint(), SketchLine_8.result(), 30 +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 37.5) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_8.result(), "R") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.coordinates()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchPoint_1.coordinates() +) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_4.result(), 13) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_1.startPoint() +) model.do() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() @@ -60,37 +82,83 @@ Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "PartSet/Origin")) SketchLine_9 = Sketch_2.addLine(0, 0, 0, 45.59203984275747) SketchLine_9.setAuxiliary(True) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident( + SketchPoint_2.coordinates(), SketchLine_9.startPoint() +) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_9.result()) -SketchLine_10 = Sketch_2.addLine(-2.5, 37.41657386773942, -0.9611800001338426, 34.11656372860793) -SketchArc_1 = Sketch_2.addArc(0, 34.39248583236681, -0.9611800001338426, 34.11656372860793, 0, 33.39248583236681, False) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchArc_1.center(), SketchLine_9.result()) -SketchConstraintAngle_1 = Sketch_2.setAngleBackward(SketchLine_10.result(), SketchLine_9.result(), 205) +SketchLine_10 = Sketch_2.addLine( + -2.5, 37.41657386773942, -0.9611800001338426, 34.11656372860793 +) +SketchArc_1 = Sketch_2.addArc( + 0, + 34.39248583236681, + -0.9611800001338426, + 34.11656372860793, + 0, + 33.39248583236681, + False, +) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident( + SketchArc_1.center(), SketchLine_9.result() +) +SketchConstraintAngle_1 = Sketch_2.setAngleBackward( + SketchLine_10.result(), SketchLine_9.result(), 205 +) SketchConstraintRadius_1 = Sketch_2.setRadius(SketchArc_1.results()[1], 1) -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchLine_10.startPoint(), SketchLine_9.result(), 2.5) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_9.result()) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchLine_10.startPoint(), SketchLine_9.result(), 2.5 +) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident( + SketchArc_1.endPoint(), SketchLine_9.result() +) SketchArc_2 = Sketch_2.addArc(0, 0, -2.5, 37.41657386773942, 0, 37.5, True) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchArc_2.center(), SketchPoint_2.result()) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_9.result(), SketchArc_2.endPoint()) -SketchConstraintMirror_1 = Sketch_2.addMirror(SketchLine_9.result(), [SketchLine_10.result(), SketchArc_1.results()[1], SketchArc_2.results()[1]]) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident( + SketchArc_2.center(), SketchPoint_2.result() +) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident( + SketchLine_10.startPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident( + SketchLine_9.result(), SketchArc_2.endPoint() +) +SketchConstraintMirror_1 = Sketch_2.addMirror( + SketchLine_9.result(), + [SketchLine_10.result(), SketchArc_1.results()[1], SketchArc_2.results()[1]], +) [SketchLine_11, SketchArc_3, SketchArc_4] = SketchConstraintMirror_1.mirrored() -SketchMultiRotation_1_objects = [SketchArc_1.results()[1], SketchLine_10.result(), SketchArc_2.results()[1], SketchArc_3.results()[1], SketchLine_11.result(), SketchArc_4.results()[1]] -SketchMultiRotation_1 = Sketch_2.addRotation(SketchMultiRotation_1_objects, SketchArc_2.center(), 12, 30) +SketchMultiRotation_1_objects = [ + SketchArc_1.results()[1], + SketchLine_10.result(), + SketchArc_2.results()[1], + SketchArc_3.results()[1], + SketchLine_11.result(), + SketchArc_4.results()[1], +] +SketchMultiRotation_1 = Sketch_2.addRotation( + SketchMultiRotation_1_objects, SketchArc_2.center(), 12, 30 +) SketchConstraintRadius_2 = Sketch_2.setRadius(SketchArc_2.results()[1], 37.5) model.do() Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_70 = Sketch_3.addLine(0, 0, 30, 0) SketchLine_70.setAuxiliary(True) SketchPoint_3 = Sketch_3.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_70.startPoint(), SketchPoint_3.result()) +SketchConstraintCoincidence_18 = Sketch_3.setCoincident( + SketchLine_70.startPoint(), SketchPoint_3.result() +) SketchLine_71 = Sketch_3.addLine(30, 0, 30, 37.5) SketchLine_71.setAuxiliary(True) -SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_70.endPoint(), SketchLine_71.startPoint()) +SketchConstraintCoincidence_19 = Sketch_3.setCoincident( + SketchLine_70.endPoint(), SketchLine_71.startPoint() +) SketchLine_72 = Sketch_3.addLine(30, 37.5, 17, 37.5) SketchLine_72.setAuxiliary(True) -SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_71.endPoint(), SketchLine_72.startPoint()) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident( + SketchLine_71.endPoint(), SketchLine_72.startPoint() +) SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_72.result()) SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_70.result()) SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_71.result()) @@ -98,105 +166,241 @@ SketchConstraintLength_4 = Sketch_3.setLength(SketchLine_70.result(), 30) SketchConstraintLength_5 = Sketch_3.setLength(SketchLine_71.result(), 37.5) SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_72.result(), 13) SketchLine_73 = Sketch_3.addLine(29, 37.49999999999999, 30, 36.49999999999999) -SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_73.startPoint(), SketchLine_72.result()) -SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_73.endPoint(), SketchLine_71.result()) +SketchConstraintCoincidence_21 = Sketch_3.setCoincident( + SketchLine_73.startPoint(), SketchLine_72.result() +) +SketchConstraintCoincidence_22 = Sketch_3.setCoincident( + SketchLine_73.endPoint(), SketchLine_71.result() +) SketchLine_74 = Sketch_3.addLine(17, 37.5, 17, 36.5) SketchLine_75 = Sketch_3.addLine(17, 36.5, 17.99999999999994, 37.5) -SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_74.endPoint(), SketchLine_75.startPoint()) -SketchConstraintCoincidence_24 = Sketch_3.setCoincident(SketchLine_75.endPoint(), SketchLine_72.result()) -SketchConstraintCoincidence_25 = Sketch_3.setCoincident(SketchLine_72.endPoint(), SketchLine_74.startPoint()) +SketchConstraintCoincidence_23 = Sketch_3.setCoincident( + SketchLine_74.endPoint(), SketchLine_75.startPoint() +) +SketchConstraintCoincidence_24 = Sketch_3.setCoincident( + SketchLine_75.endPoint(), SketchLine_72.result() +) +SketchConstraintCoincidence_25 = Sketch_3.setCoincident( + SketchLine_72.endPoint(), SketchLine_74.startPoint() +) SketchConstraintVertical_6 = Sketch_3.setVertical(SketchLine_74.result()) SketchConstraintLength_7 = Sketch_3.setLength(SketchLine_74.result(), 1) -SketchConstraintDistance_3 = Sketch_3.setDistance(SketchLine_75.endPoint(), SketchLine_74.result(), 1) -SketchConstraintDistance_4 = Sketch_3.setDistance(SketchLine_73.startPoint(), SketchLine_71.result(), 1) -SketchConstraintDistance_5 = Sketch_3.setDistance(SketchLine_73.endPoint(), SketchLine_72.result(), 1) +SketchConstraintDistance_3 = Sketch_3.setDistance( + SketchLine_75.endPoint(), SketchLine_74.result(), 1 +) +SketchConstraintDistance_4 = Sketch_3.setDistance( + SketchLine_73.startPoint(), SketchLine_71.result(), 1 +) +SketchConstraintDistance_5 = Sketch_3.setDistance( + SketchLine_73.endPoint(), SketchLine_72.result(), 1 +) SketchLine_76 = Sketch_3.addLine(17, 37.5, 17.99999999999994, 37.5) -SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchLine_72.endPoint(), SketchLine_76.startPoint()) -SketchConstraintCoincidence_27 = Sketch_3.setCoincident(SketchLine_74.startPoint(), SketchLine_76.startPoint()) -SketchConstraintCoincidence_28 = Sketch_3.setCoincident(SketchLine_75.endPoint(), SketchLine_76.endPoint()) +SketchConstraintCoincidence_26 = Sketch_3.setCoincident( + SketchLine_72.endPoint(), SketchLine_76.startPoint() +) +SketchConstraintCoincidence_27 = Sketch_3.setCoincident( + SketchLine_74.startPoint(), SketchLine_76.startPoint() +) +SketchConstraintCoincidence_28 = Sketch_3.setCoincident( + SketchLine_75.endPoint(), SketchLine_76.endPoint() +) SketchLine_77 = Sketch_3.addLine(29, 37.49999999999999, 30, 37.5) -SketchConstraintCoincidence_29 = Sketch_3.setCoincident(SketchLine_73.startPoint(), SketchLine_77.startPoint()) -SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchLine_71.endPoint(), SketchLine_77.endPoint()) -SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchLine_72.startPoint(), SketchLine_77.endPoint()) +SketchConstraintCoincidence_29 = Sketch_3.setCoincident( + SketchLine_73.startPoint(), SketchLine_77.startPoint() +) +SketchConstraintCoincidence_30 = Sketch_3.setCoincident( + SketchLine_71.endPoint(), SketchLine_77.endPoint() +) +SketchConstraintCoincidence_31 = Sketch_3.setCoincident( + SketchLine_72.startPoint(), SketchLine_77.endPoint() +) SketchLine_78 = Sketch_3.addLine(30, 37.5, 30, 36.49999999999999) -SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchLine_71.endPoint(), SketchLine_78.startPoint()) -SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchLine_72.startPoint(), SketchLine_78.startPoint()) -SketchConstraintCoincidence_34 = Sketch_3.setCoincident(SketchLine_77.endPoint(), SketchLine_78.startPoint()) -SketchConstraintCoincidence_35 = Sketch_3.setCoincident(SketchLine_73.endPoint(), SketchLine_78.endPoint()) +SketchConstraintCoincidence_32 = Sketch_3.setCoincident( + SketchLine_71.endPoint(), SketchLine_78.startPoint() +) +SketchConstraintCoincidence_33 = Sketch_3.setCoincident( + SketchLine_72.startPoint(), SketchLine_78.startPoint() +) +SketchConstraintCoincidence_34 = Sketch_3.setCoincident( + SketchLine_77.endPoint(), SketchLine_78.startPoint() +) +SketchConstraintCoincidence_35 = Sketch_3.setCoincident( + SketchLine_73.endPoint(), SketchLine_78.endPoint() +) SketchLine_79 = Sketch_3.addLine(0, 0, 0, 15) SketchLine_79.setAuxiliary(True) -SketchConstraintCoincidence_36 = Sketch_3.setCoincident(SketchLine_79.startPoint(), SketchPoint_3.result()) +SketchConstraintCoincidence_36 = Sketch_3.setCoincident( + SketchLine_79.startPoint(), SketchPoint_3.result() +) SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_79.result()) SketchConstraintLength_8 = Sketch_3.setLength(SketchLine_79.result(), "R-R_fillet") SketchLine_80 = Sketch_3.addLine(0, 15, 0.5, 15) SketchLine_80.setAuxiliary(True) -SketchConstraintCoincidence_37 = Sketch_3.setCoincident(SketchLine_79.endPoint(), SketchLine_80.startPoint()) +SketchConstraintCoincidence_37 = Sketch_3.setCoincident( + SketchLine_79.endPoint(), SketchLine_80.startPoint() +) SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_80.result()) SketchArc_61 = Sketch_3.addArc(0.5, 15, 0, 15, 0.5, 15.5, True) -SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchLine_80.endPoint(), SketchArc_61.center()) -SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_79.endPoint(), SketchArc_61.startPoint()) -SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_80.startPoint(), SketchArc_61.startPoint()) +SketchConstraintCoincidence_38 = Sketch_3.setCoincident( + SketchLine_80.endPoint(), SketchArc_61.center() +) +SketchConstraintCoincidence_39 = Sketch_3.setCoincident( + SketchLine_79.endPoint(), SketchArc_61.startPoint() +) +SketchConstraintCoincidence_40 = Sketch_3.setCoincident( + SketchLine_80.startPoint(), SketchArc_61.startPoint() +) SketchLine_81 = Sketch_3.addLine(0.5, 15, 0.5, 16) SketchLine_81.setAuxiliary(True) -SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_80.endPoint(), SketchLine_81.startPoint()) -SketchConstraintCoincidence_42 = Sketch_3.setCoincident(SketchArc_61.center(), SketchLine_81.startPoint()) +SketchConstraintCoincidence_41 = Sketch_3.setCoincident( + SketchLine_80.endPoint(), SketchLine_81.startPoint() +) +SketchConstraintCoincidence_42 = Sketch_3.setCoincident( + SketchArc_61.center(), SketchLine_81.startPoint() +) SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_81.result()) -SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchArc_61.endPoint(), SketchLine_81.result()) +SketchConstraintCoincidence_43 = Sketch_3.setCoincident( + SketchArc_61.endPoint(), SketchLine_81.result() +) SketchConstraintRadius_3 = Sketch_3.setRadius(SketchArc_61.results()[1], "R_fillet") SketchLine_82 = Sketch_3.addLine(0.5, 15.5, 0.5, 16) -SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchArc_61.endPoint(), SketchLine_82.startPoint()) +SketchConstraintCoincidence_44 = Sketch_3.setCoincident( + SketchArc_61.endPoint(), SketchLine_82.startPoint() +) SketchLine_83 = Sketch_3.addLine(0.5, 16, -0.5, 16) -SketchConstraintCoincidence_45 = Sketch_3.setCoincident(SketchLine_82.endPoint(), SketchLine_83.startPoint()) +SketchConstraintCoincidence_45 = Sketch_3.setCoincident( + SketchLine_82.endPoint(), SketchLine_83.startPoint() +) SketchLine_84 = Sketch_3.addLine(-0.5, 16, -0.5, 15) -SketchConstraintCoincidence_46 = Sketch_3.setCoincident(SketchLine_83.endPoint(), SketchLine_84.startPoint()) +SketchConstraintCoincidence_46 = Sketch_3.setCoincident( + SketchLine_83.endPoint(), SketchLine_84.startPoint() +) SketchLine_85 = Sketch_3.addLine(-0.5, 15, 0, 15) -SketchConstraintCoincidence_47 = Sketch_3.setCoincident(SketchLine_84.endPoint(), SketchLine_85.startPoint()) -SketchConstraintCoincidence_48 = Sketch_3.setCoincident(SketchLine_79.endPoint(), SketchLine_85.endPoint()) -SketchConstraintCoincidence_49 = Sketch_3.setCoincident(SketchLine_80.startPoint(), SketchLine_85.endPoint()) -SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchArc_61.startPoint(), SketchLine_85.endPoint()) -SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchLine_81.endPoint(), SketchLine_83.startPoint()) -SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchLine_85.startPoint(), SketchLine_80.result()) +SketchConstraintCoincidence_47 = Sketch_3.setCoincident( + SketchLine_84.endPoint(), SketchLine_85.startPoint() +) +SketchConstraintCoincidence_48 = Sketch_3.setCoincident( + SketchLine_79.endPoint(), SketchLine_85.endPoint() +) +SketchConstraintCoincidence_49 = Sketch_3.setCoincident( + SketchLine_80.startPoint(), SketchLine_85.endPoint() +) +SketchConstraintCoincidence_50 = Sketch_3.setCoincident( + SketchArc_61.startPoint(), SketchLine_85.endPoint() +) +SketchConstraintCoincidence_51 = Sketch_3.setCoincident( + SketchLine_81.endPoint(), SketchLine_83.startPoint() +) +SketchConstraintCoincidence_52 = Sketch_3.setCoincident( + SketchLine_85.startPoint(), SketchLine_80.result() +) SketchConstraintVertical_9 = Sketch_3.setVertical(SketchLine_84.result()) 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("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")) +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")) -SketchConstraintCoincidence_51 = Sketch_4.setCoincident(SketchLine_86.startPoint(), SketchLine_87.result()) +SketchConstraintCoincidence_51 = Sketch_4.setCoincident( + SketchLine_86.startPoint(), SketchLine_87.result() +) SketchLine_88 = Sketch_4.addLine(3.1, -13.49999999999519, 3.1, -10.55414610473955) -SketchConstraintCoincidence_52 = Sketch_4.setCoincident(SketchLine_86.endPoint(), SketchLine_88.startPoint()) +SketchConstraintCoincidence_52 = Sketch_4.setCoincident( + SketchLine_86.endPoint(), SketchLine_88.startPoint() +) SketchLine_89 = Sketch_4.addLine(0, -10.5290802744499, 0, 12.80434395246332) SketchLine_89.setAuxiliary(True) -SketchConstraintCoincidence_53 = Sketch_4.setCoincident(SketchLine_89.startPoint(), SketchLine_87.result()) +SketchConstraintCoincidence_53 = Sketch_4.setCoincident( + SketchLine_89.startPoint(), SketchLine_87.result() +) SketchConstraintVertical_9 = Sketch_4.setVertical(SketchLine_89.result()) SketchConstraintHorizontal_6 = Sketch_4.setHorizontal(SketchLine_86.result()) SketchConstraintVertical_10 = Sketch_4.setVertical(SketchLine_88.result()) SketchConstraintLength_9 = Sketch_4.setLength(SketchLine_86.result(), 3.1) -SketchConstraintMirror_2 = Sketch_4.addMirror(SketchLine_87.result(), [SketchLine_86.result(), SketchLine_88.result()]) +SketchConstraintMirror_2 = Sketch_4.addMirror( + SketchLine_87.result(), [SketchLine_86.result(), SketchLine_88.result()] +) [SketchLine_90, SketchLine_91] = SketchConstraintMirror_2.mirrored() -SketchArc_62 = Sketch_4.addArc(0, 0, 3.1, -10.55414610473955, -3.100000000000001, -10.55414610473344, False) -SketchConstraintCoincidence_54 = Sketch_4.setCoincident(SketchPoint_4.coordinates(), SketchArc_62.center()) -SketchConstraintCoincidence_55 = Sketch_4.setCoincident(SketchLine_87.startPoint(), SketchArc_62.center()) -SketchConstraintCoincidence_56 = Sketch_4.setCoincident(SketchArc_62.startPoint(), SketchLine_88.result()) -SketchConstraintCoincidence_57 = Sketch_4.setCoincident(SketchArc_62.endPoint(), SketchLine_91.result()) +SketchArc_62 = Sketch_4.addArc( + 0, 0, 3.1, -10.55414610473955, -3.100000000000001, -10.55414610473344, False +) +SketchConstraintCoincidence_54 = Sketch_4.setCoincident( + SketchPoint_4.coordinates(), SketchArc_62.center() +) +SketchConstraintCoincidence_55 = Sketch_4.setCoincident( + SketchLine_87.startPoint(), SketchArc_62.center() +) +SketchConstraintCoincidence_56 = Sketch_4.setCoincident( + SketchArc_62.startPoint(), SketchLine_88.result() +) +SketchConstraintCoincidence_57 = Sketch_4.setCoincident( + SketchArc_62.endPoint(), SketchLine_91.result() +) SketchConstraintRadius_4 = Sketch_4.setRadius(SketchArc_62.results()[1], 11) -SketchConstraintCoincidence_58 = Sketch_4.setCoincident(SketchLine_88.endPoint(), SketchArc_62.startPoint()) +SketchConstraintCoincidence_58 = Sketch_4.setCoincident( + SketchLine_88.endPoint(), SketchArc_62.startPoint() +) SketchPoint_5 = Sketch_4.addPoint(3.1, -10.55414610473955) -SketchConstraintCoincidence_59 = Sketch_4.setCoincident(SketchLine_88.endPoint(), SketchPoint_5.coordinates()) -SketchConstraintCoincidence_60 = Sketch_4.setCoincident(SketchArc_62.startPoint(), SketchPoint_5.coordinates()) +SketchConstraintCoincidence_59 = Sketch_4.setCoincident( + SketchLine_88.endPoint(), SketchPoint_5.coordinates() +) +SketchConstraintCoincidence_60 = Sketch_4.setCoincident( + SketchArc_62.startPoint(), SketchPoint_5.coordinates() +) SketchPoint_6 = Sketch_4.addPoint(0, 11.00000000000481) SketchPoint_6.setAuxiliary(True) -SketchConstraintCoincidence_61 = Sketch_4.setCoincident(SketchPoint_6.coordinates(), SketchArc_62.results()[1]) -SketchConstraintCoincidence_62 = Sketch_4.setCoincident(SketchPoint_6.coordinates(), SketchLine_89.result()) -SketchConstraintDistance_6 = Sketch_4.setDistance(SketchPoint_6.coordinates(), SketchLine_86.result(), 24.5) +SketchConstraintCoincidence_61 = Sketch_4.setCoincident( + SketchPoint_6.coordinates(), SketchArc_62.results()[1] +) +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&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")]) +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() # Test reexecution after parameter change @@ -216,4 +420,4 @@ model.testNbSubShapes(ExtrusionCut_2, GeomAPI_Shape.EDGE, [1314]) model.testNbSubShapes(ExtrusionCut_2, GeomAPI_Shape.VERTEX, [2628]) model.testResultsVolumes(ExtrusionCut_2, [62405.392187037912663072347640991]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.models/idler_plate.py b/test.models/idler_plate.py index fdd2e67ac..500304550 100644 --- a/test.models/idler_plate.py +++ b/test.models/idler_plate.py @@ -31,140 +31,458 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 17.71094752491076, 14.8612495359528) SketchLine_1.setAuxiliary(True) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintAngle_1 = Sketch_1.setAngleBackward(SketchLine_1.result(), SketchLine_2.result(), 40.00000000000006) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.startPoint()) -SketchArc_1 = Sketch_1.addArc(0, 0, 17.71094752491076, 14.8612495359528, 23.12, -6.011798491948799e-033, True) +SketchConstraintAngle_1 = Sketch_1.setAngleBackward( + SketchLine_1.result(), SketchLine_2.result(), 40.00000000000006 +) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.startPoint() +) +SketchArc_1 = Sketch_1.addArc( + 0, 0, 17.71094752491076, 14.8612495359528, 23.12, -6.011798491948799e-033, True +) SketchArc_1.setAuxiliary(True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.center()) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchArc_1.endPoint(), 23.12) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_1.center() +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_1.endPoint() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_2.startPoint(), SketchArc_1.endPoint(), 23.12 +) SketchArc_2 = Sketch_1.addArc(23.12, -6.011798491948799e-033, 18.74, 0, 27.5, 0, False) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.center()) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_2.endPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchArc_2.center() +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_2.endPoint() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_2.results()[1], "ob2") -SketchArc_3 = Sketch_1.addArc(0, 0, 18.74, 0, 14.35567286404965, 12.04583980552575, False) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_3.center()) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchArc_3.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_3.endPoint()) +SketchArc_3 = Sketch_1.addArc( + 0, 0, 18.74, 0, 14.35567286404965, 12.04583980552575, False +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_3.center() +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchArc_3.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_3.endPoint() +) SketchArc_4 = Sketch_1.addArc(0, 0, 27.5, 0, 21.0662221857694, 17.67665926638303, False) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_4.center()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_4.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_1.result()) -SketchArc_5 = Sketch_1.addArc(17.71094752491078, 14.86124953595279, 14.35567286404965, 12.04583980552575, 21.0662221857694, 17.67665926638303, True) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchArc_5.startPoint()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchArc_5.endPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchArc_3.results()[1]) -SketchArc_6 = Sketch_1.addArc(-34.92, 0, -34.92, 4.370000000000002, -34.91999999999997, -4.370000000000019, False) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_6.center(), SketchLine_2.result()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_4.center() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_1.result() +) +SketchArc_5 = Sketch_1.addArc( + 17.71094752491078, + 14.86124953595279, + 14.35567286404965, + 12.04583980552575, + 21.0662221857694, + 17.67665926638303, + True, +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchArc_5.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchArc_5.endPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_5.results()[1], SketchArc_3.results()[1] +) +SketchArc_6 = Sketch_1.addArc( + -34.92, 0, -34.92, 4.370000000000002, -34.91999999999997, -4.370000000000019, False +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_6.center(), SketchLine_2.result() +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_6.results()[1], "ob1") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchArc_6.center(), SketchArc_2.center(), 58.04) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchArc_6.center(), SketchArc_2.center(), 58.04 +) SketchLine_3 = Sketch_1.addLine(-24.92, 4.37, -34.92, 4.370000000000002) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_6.startPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchArc_6.startPoint(), SketchLine_3.endPoint() +) SketchLine_4 = Sketch_1.addLine(-24.92, -4.37, -34.91999999999997, -4.370000000000019) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_4.endPoint()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchArc_6.endPoint(), SketchLine_4.endPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_6.results()[1]) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_6.results()[1]) -SketchArc_7 = Sketch_1.addArc(-24.92, 1.467818159729891e-016, -24.92, 4.37, -24.92, -4.37, True) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchArc_7.startPoint()) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchArc_7.endPoint()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_7.results()[1]) -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_7.results()[1], SketchLine_4.result()) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchArc_6.center(), SketchArc_7.center(), 10) -SketchCircle_1 = Sketch_1.addCircle(9.498292007139793e-031, -4.263345141625117e-031, 5.625) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.center()) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_6.results()[1] +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchLine_4.result(), SketchArc_6.results()[1] +) +SketchArc_7 = Sketch_1.addArc( + -24.92, 1.467818159729891e-016, -24.92, 4.37, -24.92, -4.37, True +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchArc_7.startPoint() +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_4.startPoint(), SketchArc_7.endPoint() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_7.results()[1] +) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchArc_7.results()[1], SketchLine_4.result() +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchArc_6.center(), SketchArc_7.center(), 10 +) +SketchCircle_1 = Sketch_1.addCircle( + 9.498292007139793e-031, -4.263345141625117e-031, 5.625 +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_1.center() +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchCircle_1.results()[1], "axe/2") SketchCircle_2 = Sketch_1.addCircle(-7.5, 18.75, 3.75) SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], "trou/2") SketchLine_5 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OY")) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_5.result(), SketchCircle_2.center(), 7.5) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_2.result(), SketchCircle_2.center(), 18.75) -SketchArc_8 = Sketch_1.addArc(-34.92, -6.497717112746075e-027, -34.91999999999937, 7.500000000006299, -36.26235395189003, -7.378894623711957, False) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_6.center(), SketchArc_8.center()) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_5.result(), SketchCircle_2.center(), 7.5 +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_2.result(), SketchCircle_2.center(), 18.75 +) +SketchArc_8 = Sketch_1.addArc( + -34.92, + -6.497717112746075e-027, + -34.91999999999937, + 7.500000000006299, + -36.26235395189003, + -7.378894623711957, + False, +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchArc_6.center(), SketchArc_8.center() +) SketchConstraintRadius_5 = Sketch_1.setRadius(SketchArc_8.results()[1], 7.5) -SketchArc_9 = Sketch_1.addArc(-7.5, 18.75, 0.0511741035599095, 21.7492323447386, -15.3796231578326, 20.73170731707517, False) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchArc_9.center()) +SketchArc_9 = Sketch_1.addArc( + -7.5, + 18.75, + 0.0511741035599095, + 21.7492323447386, + -15.3796231578326, + 20.73170731707517, + False, +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchCircle_2.center(), SketchArc_9.center() +) SketchConstraintRadius_6 = Sketch_1.setRadius(SketchArc_9.results()[1], "16.25/2") -SketchArc_10 = Sketch_1.addArc(-32.35111919008745, 25.0000000000063, -15.3796231578326, 20.73170731707517, -32.35111919008745, 7.500000000006299, True) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchArc_9.endPoint(), SketchArc_10.startPoint()) -SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_9.results()[1], SketchArc_10.results()[1]) +SketchArc_10 = Sketch_1.addArc( + -32.35111919008745, + 25.0000000000063, + -15.3796231578326, + 20.73170731707517, + -32.35111919008745, + 7.500000000006299, + True, +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchArc_9.endPoint(), SketchArc_10.startPoint() +) +SketchConstraintTangent_6 = Sketch_1.setTangent( + SketchArc_9.results()[1], SketchArc_10.results()[1] +) SketchConstraintRadius_7 = Sketch_1.setRadius(SketchArc_10.results()[1], 17.5) -SketchLine_6 = Sketch_1.addLine(-34.91999999999937, 7.500000000006299, -32.35111919008745, 7.500000000006299) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchArc_8.startPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_10.endPoint(), SketchLine_6.endPoint()) +SketchLine_6 = Sketch_1.addLine( + -34.91999999999937, 7.500000000006299, -32.35111919008745, 7.500000000006299 +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchArc_8.startPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchArc_10.endPoint(), SketchLine_6.endPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) -SketchConstraintTangent_7 = Sketch_1.setTangent(SketchLine_6.result(), SketchArc_10.results()[1]) -SketchArc_11 = Sketch_1.addArc(2.841203857564676e-031, -1.848261526152319e-031, -2.46098224513173, -13.52797347680525, 10.54941392733564, -8.818864200663077, False) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_11.center()) +SketchConstraintTangent_7 = Sketch_1.setTangent( + SketchLine_6.result(), SketchArc_10.results()[1] +) +SketchArc_11 = Sketch_1.addArc( + 2.841203857564676e-031, + -1.848261526152319e-031, + -2.46098224513173, + -13.52797347680525, + 10.54941392733564, + -8.818864200663077, + False, +) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_11.center() +) SketchConstraintRadius_8 = Sketch_1.setRadius(SketchArc_11.results()[1], 13.75) -SketchLine_7 = Sketch_1.addLine(-36.26235395189003, -7.378894623711957, -2.460982245131729, -13.52797347680525) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchArc_11.startPoint(), SketchLine_7.endPoint()) -SketchConstraintTangent_8 = Sketch_1.setTangent(SketchLine_7.result(), SketchArc_8.results()[1]) -SketchConstraintTangent_9 = Sketch_1.setTangent(SketchLine_7.result(), SketchArc_11.results()[1]) -SketchArc_12 = Sketch_1.addArc(23.12, 7.384930033544359e-028, 18.58435121107267, -7.482672655108066, 31.87, -1.068593854246008e-030, False) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_12.center()) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_12.endPoint()) -SketchArc_13 = Sketch_1.addArc(15.34460207612463, -12.82743883732818, 10.5494139273357, -8.818864200663123, 18.58435121107276, -7.482672655108122, True) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_11.endPoint(), SketchArc_13.startPoint()) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_12.startPoint(), SketchArc_13.endPoint()) -SketchConstraintTangent_10 = Sketch_1.setTangent(SketchArc_13.results()[1], SketchArc_12.results()[1]) +SketchLine_7 = Sketch_1.addLine( + -36.26235395189003, -7.378894623711957, -2.460982245131729, -13.52797347680525 +) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchArc_8.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchArc_11.startPoint(), SketchLine_7.endPoint() +) +SketchConstraintTangent_8 = Sketch_1.setTangent( + SketchLine_7.result(), SketchArc_8.results()[1] +) +SketchConstraintTangent_9 = Sketch_1.setTangent( + SketchLine_7.result(), SketchArc_11.results()[1] +) +SketchArc_12 = Sketch_1.addArc( + 23.12, + 7.384930033544359e-028, + 18.58435121107267, + -7.482672655108066, + 31.87, + -1.068593854246008e-030, + False, +) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchArc_12.center() +) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_12.endPoint() +) +SketchArc_13 = Sketch_1.addArc( + 15.34460207612463, + -12.82743883732818, + 10.5494139273357, + -8.818864200663123, + 18.58435121107276, + -7.482672655108122, + True, +) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchArc_11.endPoint(), SketchArc_13.startPoint() +) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchArc_12.startPoint(), SketchArc_13.endPoint() +) +SketchConstraintTangent_10 = Sketch_1.setTangent( + SketchArc_13.results()[1], SketchArc_12.results()[1] +) SketchConstraintRadius_9 = Sketch_1.setRadius(SketchArc_12.results()[1], 8.75) -SketchConstraintTangent_11 = Sketch_1.setTangent(SketchArc_13.results()[1], SketchArc_11.results()[1]) -SketchArc_14 = Sketch_1.addArc(7.217739748128488e-031, -7.397577026331382e-031, 31.87, 1.64056023214913e-033, 24.41383640220182, 20.48564112071002, False) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_14.center()) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_12.endPoint(), SketchArc_14.startPoint()) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchLine_1.result()) -SketchArc_15 = Sketch_1.addArc(17.71094752491077, 14.86124953595279, 24.41383640220183, 20.48564112071001, 10.79776038328427, 20.22504889320414, False) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_15.center()) -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchArc_15.startPoint()) -SketchArc_16 = Sketch_1.addArc(5.859769567836763, 24.05633414838368, 10.79776038328427, 20.22504889320414, 0.05117410355990894, 21.7492323447386, True) -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchArc_15.endPoint(), SketchArc_16.startPoint()) -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchArc_9.startPoint(), SketchArc_16.endPoint()) -SketchConstraintTangent_12 = Sketch_1.setTangent(SketchArc_16.results()[1], SketchArc_15.results()[1]) -SketchConstraintTangent_13 = Sketch_1.setTangent(SketchArc_16.results()[1], SketchArc_9.results()[1]) +SketchConstraintTangent_11 = Sketch_1.setTangent( + SketchArc_13.results()[1], SketchArc_11.results()[1] +) +SketchArc_14 = Sketch_1.addArc( + 7.217739748128488e-031, + -7.397577026331382e-031, + 31.87, + 1.64056023214913e-033, + 24.41383640220182, + 20.48564112071002, + False, +) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_14.center() +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchArc_12.endPoint(), SketchArc_14.startPoint() +) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchArc_14.endPoint(), SketchLine_1.result() +) +SketchArc_15 = Sketch_1.addArc( + 17.71094752491077, + 14.86124953595279, + 24.41383640220183, + 20.48564112071001, + 10.79776038328427, + 20.22504889320414, + False, +) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchArc_15.center() +) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchArc_14.endPoint(), SketchArc_15.startPoint() +) +SketchArc_16 = Sketch_1.addArc( + 5.859769567836763, + 24.05633414838368, + 10.79776038328427, + 20.22504889320414, + 0.05117410355990894, + 21.7492323447386, + True, +) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchArc_15.endPoint(), SketchArc_16.startPoint() +) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchArc_9.startPoint(), SketchArc_16.endPoint() +) +SketchConstraintTangent_12 = Sketch_1.setTangent( + SketchArc_16.results()[1], SketchArc_15.results()[1] +) +SketchConstraintTangent_13 = Sketch_1.setTangent( + SketchArc_16.results()[1], SketchArc_9.results()[1] +) 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]) +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_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) +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/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/SketchArc_8_2_StartVertex")) +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/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()) -SketchLine_8 = Sketch_2.addLine(-34.91999999999937, 7.500000000006299, -24.92, 7.500000000006299) -SketchConstraintCoincidence_44 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_45 = Sketch_2.setCoincident(SketchArc_17.startPoint(), SketchLine_8.endPoint()) -SketchLine_9 = Sketch_2.addLine(-34.92003434105975, -7.500000000006299, -24.92, -7.500000000006299) -SketchConstraintCoincidence_46 = Sketch_2.setCoincident(SketchArc_18.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_47 = Sketch_2.setCoincident(SketchArc_17.endPoint(), SketchLine_9.endPoint()) +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() +) +SketchLine_8 = Sketch_2.addLine( + -34.91999999999937, 7.500000000006299, -24.92, 7.500000000006299 +) +SketchConstraintCoincidence_44 = Sketch_2.setCoincident( + SketchPoint_2.coordinates(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_45 = Sketch_2.setCoincident( + SketchArc_17.startPoint(), SketchLine_8.endPoint() +) +SketchLine_9 = Sketch_2.addLine( + -34.92003434105975, -7.500000000006299, -24.92, -7.500000000006299 +) +SketchConstraintCoincidence_46 = Sketch_2.setCoincident( + SketchArc_18.endPoint(), SketchLine_9.startPoint() +) +SketchConstraintCoincidence_47 = Sketch_2.setCoincident( + SketchArc_17.endPoint(), SketchLine_9.endPoint() +) 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/SketchCircle_2_2__cc")) +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/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()) +SketchConstraintCoincidence_48 = Sketch_2.setCoincident( + SketchPoint_4.result(), SketchCircle_3.center() +) 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/SketchArc_3_2__cc")) +SketchConstraintEqual_1 = Sketch_2.setEqual( + SketchCircle_3.results()[1], SketchArc_19.results()[1] +) +SketchPoint_5 = Sketch_2.addPoint( + model.selection("VERTEX", "Sketch_1/SketchArc_3_2__cc") +) SketchCircle_4 = Sketch_2.addCircle(0, 0, 8.75) -SketchConstraintCoincidence_49 = Sketch_2.setCoincident(SketchPoint_5.result(), SketchCircle_4.center()) +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/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")], []) +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() # Test reexecution after parameter change @@ -184,4 +502,4 @@ model.testNbSubShapes(Boolean_1, GeomAPI_Shape.EDGE, [188]) model.testNbSubShapes(Boolean_1, GeomAPI_Shape.VERTEX, [376]) model.testResultsVolumes(Boolean_1, [3900.882496393901419651228934526]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.models/piece_02.py b/test.models/piece_02.py index 2c3135015..af1da08dc 100644 --- a/test.models/piece_02.py +++ b/test.models/piece_02.py @@ -26,244 +26,576 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(0, 4.99999999998656, 0, 40.99999999998656) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OZ")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_2.result() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) SketchLine_3 = Sketch_1.addLine(4.999999999986844, 0, 36.99999999998685, 0) SketchLine_4 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_4.result()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.result()) -SketchLine_5 = Sketch_1.addLine(4.999999999999999, 45.99999999998655, 37, 45.99999999998655) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchLine_4.result() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.result() +) +SketchLine_5 = Sketch_1.addLine( + 4.999999999999999, 45.99999999998655, 37, 45.99999999998655 +) SketchLine_6 = Sketch_1.addLine(42, 40.99999999998655, 42, 4.999999999986548) -SketchArc_1 = Sketch_1.addArc(5, 40.99999999998656, 0, 40.99999999998656, 4.999999999999999, 45.99999999998656, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_1.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_1.result(), SketchArc_1.results()[1]) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.result(), SketchArc_1.endPoint()) -SketchArc_2 = Sketch_1.addArc(37, 40.99999999998655, 37, 45.99999999998655, 42, 40.99999999998655, True) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchArc_2.startPoint()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_5.result(), SketchArc_2.results()[1]) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.result(), SketchArc_2.endPoint()) -SketchArc_3 = Sketch_1.addArc(4.999999999986827, 4.999999999986823, 0, 4.99999999998656, 4.999999999986844, 0, False) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchLine_1.result(), SketchArc_3.results()[1]) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_3.result(), SketchArc_3.endPoint()) -SketchArc_4 = Sketch_1.addArc(36.99999999998375, 5.000000000004257, 36.99999999998685, 0, 42, 4.999999999986548, False) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_4.startPoint()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_4.results()[1]) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_6.result(), SketchArc_4.endPoint()) +SketchArc_1 = Sketch_1.addArc( + 5, + 40.99999999998656, + 0, + 40.99999999998656, + 4.999999999999999, + 45.99999999998656, + True, +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_1.result(), SketchArc_1.results()[1] +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_5.result(), SketchArc_1.endPoint() +) +SketchArc_2 = Sketch_1.addArc( + 37, 40.99999999998655, 37, 45.99999999998655, 42, 40.99999999998655, True +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_5.result(), SketchArc_2.results()[1] +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_6.result(), SketchArc_2.endPoint() +) +SketchArc_3 = Sketch_1.addArc( + 4.999999999986827, + 4.999999999986823, + 0, + 4.99999999998656, + 4.999999999986844, + 0, + False, +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchLine_1.result(), SketchArc_3.results()[1] +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchArc_3.endPoint() +) +SketchArc_4 = Sketch_1.addArc( + 36.99999999998375, + 5.000000000004257, + 36.99999999998685, + 0, + 42, + 4.999999999986548, + False, +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_4.results()[1] +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_6.result(), SketchArc_4.endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_6.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_5.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_3.result()) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_6.result(), SketchLine_1.result()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchArc_4.endPoint()) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_3.startPoint()) -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_6.result()) -SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_5.result()) -SketchConstraintTangent_7 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_3.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchArc_1.results()[1], SketchArc_2.results()[1]) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_3.result() +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_6.result(), SketchLine_1.result() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchArc_4.endPoint() +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_3.startPoint() +) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_6.result() +) +SketchConstraintTangent_6 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_5.result() +) +SketchConstraintTangent_7 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_3.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchArc_1.results()[1], SketchArc_2.results()[1] +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_2.results()[1], 5) 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()) +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-SketchArc_3_2f-SketchLine_3f-SketchArc_4_2f-SketchLine_6r-SketchArc_2_2f-SketchLine_5r-SketchArc_1_2f-SketchLine_1r")], model.selection(), 76, 0) +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 = 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&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]")) +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 = 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&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]")) +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 = 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&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]")) +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&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) -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchLine_8.result()) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchPoint_1.coordinates(), SketchLine_8.result() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_20") -SketchConstraintMiddle_3 = Sketch_2.setMiddlePoint(SketchPoint_1.coordinates(), SketchLine_8.result()) +SketchConstraintMiddle_3 = Sketch_2.setMiddlePoint( + SketchPoint_1.coordinates(), SketchLine_8.result() +) SketchCircle_1 = Sketch_2.addCircle(20.99999999999342, 22.99999999999327, 19) -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchCircle_1.center()) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchPoint_1.coordinates(), SketchCircle_1.center() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_21") SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 19) SketchCircle_2 = Sketch_2.addCircle(12.99999999999342, 22.99999999998655, 2.5) SketchCircle_3 = Sketch_2.addCircle(28.99999999999342, 22.99999999998655, 2.5) SketchCircle_4 = Sketch_2.addCircle(20.99999999999113, 14.99999999998655, 2.5) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_8.result(), SketchCircle_4.center()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchLine_8.result(), SketchCircle_4.center() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_22") -SketchConstraintEqual_4 = Sketch_2.setEqual(SketchCircle_2.results()[1], SketchCircle_3.results()[1]) -SketchConstraintEqual_5 = Sketch_2.setEqual(SketchCircle_3.results()[1], SketchCircle_4.results()[1]) -SketchLine_12 = Sketch_2.addLine(2.465190328815662e-32, 22.99999999998655, 41.99999999999999, 22.99999999998655) +SketchConstraintEqual_4 = Sketch_2.setEqual( + SketchCircle_2.results()[1], SketchCircle_3.results()[1] +) +SketchConstraintEqual_5 = Sketch_2.setEqual( + SketchCircle_3.results()[1], SketchCircle_4.results()[1] +) +SketchLine_12 = Sketch_2.addLine( + 2.465190328815662e-32, 22.99999999998655, 41.99999999999999, 22.99999999998655 +) SketchLine_12.setName("SketchLine_13") SketchLine_12.result().setName("SketchLine_13") SketchLine_12.setAuxiliary(True) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_12.startPoint(), SketchLine_7.result()) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchLine_12.startPoint(), SketchLine_7.result() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_23") -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_11.result()) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_12.endPoint(), SketchLine_11.result() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_24") SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_12.result()) -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchCircle_2.center(), SketchCircle_3.center(), 16) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchCircle_2.center(), SketchLine_12.result()) +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchCircle_2.center(), SketchCircle_3.center(), 16 +) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchCircle_2.center(), SketchLine_12.result() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_25") -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchLine_12.result()) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchCircle_3.center(), SketchLine_12.result() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_26") -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_2.center(), SketchLine_8.result(), 8) -SketchConstraintMiddle_4 = Sketch_2.setMiddlePoint(SketchLine_12.endPoint(), SketchLine_11.result()) +SketchConstraintDistance_2 = Sketch_2.setDistance( + SketchCircle_2.center(), SketchLine_8.result(), 8 +) +SketchConstraintMiddle_4 = Sketch_2.setMiddlePoint( + SketchLine_12.endPoint(), SketchLine_11.result() +) SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_2.results()[1], 2.5) -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchLine_12.result(), SketchCircle_4.center(), 8) +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/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")]) +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) -SketchLine_13 = Sketch_3.addLine(41.99999999999999, 22.99999999998655, 0, 22.99999999998656) +SketchLine_13 = Sketch_3.addLine( + 41.99999999999999, 22.99999999998655, 0, 22.99999999998656 +) 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/Modified_Face&Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]")) +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 = 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&Sketch_1/SketchLine_1][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face]")) +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()) +SketchConstraintCoincidence_27 = Sketch_3.setCoincident( + SketchLine_13.endPoint(), SketchLine_15.result() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_28") 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/Modified_Face&Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]")) +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 = Sketch_3.setCoincident( + SketchLine_16.startPoint(), SketchLine_17.result() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_29") 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()) +SketchConstraintCoincidence_29 = Sketch_3.setCoincident( + SketchLine_16.endPoint(), SketchLine_18.result() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_30") -SketchConstraintMiddle_5 = Sketch_3.setMiddlePoint(SketchLine_16.startPoint(), SketchLine_17.result()) -SketchConstraintMiddle_6 = Sketch_3.setMiddlePoint(SketchLine_16.endPoint(), SketchLine_18.result()) -SketchConstraintMiddle_7 = Sketch_3.setMiddlePoint(SketchLine_13.endPoint(), SketchLine_15.result()) -SketchConstraintMiddle_8 = Sketch_3.setMiddlePoint(SketchLine_13.startPoint(), SketchLine_14.result()) +SketchConstraintMiddle_5 = Sketch_3.setMiddlePoint( + SketchLine_16.startPoint(), SketchLine_17.result() +) +SketchConstraintMiddle_6 = Sketch_3.setMiddlePoint( + SketchLine_16.endPoint(), SketchLine_18.result() +) +SketchConstraintMiddle_7 = Sketch_3.setMiddlePoint( + SketchLine_13.endPoint(), SketchLine_15.result() +) +SketchConstraintMiddle_8 = Sketch_3.setMiddlePoint( + SketchLine_13.startPoint(), SketchLine_14.result() +) SketchPoint_2 = Sketch_3.addPoint(20.99999999999342, 22.99999999999327) -SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchPoint_2.coordinates(), SketchLine_16.result()) +SketchConstraintCoincidence_30 = Sketch_3.setCoincident( + SketchPoint_2.coordinates(), SketchLine_16.result() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_31") -SketchConstraintMiddle_9 = Sketch_3.setMiddlePoint(SketchLine_16.result(), SketchPoint_2.coordinates()) -SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchCircle_5.center(), SketchPoint_2.coordinates()) +SketchConstraintMiddle_9 = Sketch_3.setMiddlePoint( + SketchLine_16.result(), SketchPoint_2.coordinates() +) +SketchConstraintCoincidence_31 = Sketch_3.setCoincident( + SketchCircle_5.center(), SketchPoint_2.coordinates() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_32") SketchCircle_6 = Sketch_3.addCircle(28.99999999999342, 22.99999999998655, 2.5) -SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchLine_13.result(), SketchCircle_6.center()) +SketchConstraintCoincidence_32 = Sketch_3.setCoincident( + SketchLine_13.result(), SketchCircle_6.center() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_33") SketchCircle_7 = Sketch_3.addCircle(12.99999999999342, 22.99999999998656, 2.5) -SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchLine_13.result(), SketchCircle_7.center()) +SketchConstraintCoincidence_33 = Sketch_3.setCoincident( + SketchLine_13.result(), SketchCircle_7.center() +) SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_34") -SketchConstraintEqual_6 = Sketch_3.setEqual(SketchCircle_7.results()[1], SketchCircle_6.results()[1]) +SketchConstraintEqual_6 = Sketch_3.setEqual( + SketchCircle_7.results()[1], SketchCircle_6.results()[1] +) 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) +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_2r-SketchCircle_7_2r-SketchCircle_6_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&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) +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&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2]"), False) +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&Sketch_1/SketchArc_1_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]")) +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 = 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&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2]")) +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()) +SketchConstraintCoincidence_35 = Sketch_4.setCoincident( + SketchLine_21.endPoint(), SketchLine_23.result() +) SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_36") SketchLine_24 = Sketch_4.addLine(4.999999999999999, -48, 37, -48) SketchLine_24.setName("SketchLine_25") SketchLine_24.result().setName("SketchLine_25") -SketchConstraintCoincidence_36 = Sketch_4.setCoincident(SketchLine_24.startPoint(), SketchLine_22.result()) +SketchConstraintCoincidence_36 = Sketch_4.setCoincident( + SketchLine_24.startPoint(), SketchLine_22.result() +) SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_37") -SketchConstraintCoincidence_37 = Sketch_4.setCoincident(SketchLine_24.endPoint(), SketchLine_23.result()) +SketchConstraintCoincidence_37 = Sketch_4.setCoincident( + SketchLine_24.endPoint(), SketchLine_23.result() +) SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_38") SketchConstraintHorizontal_3 = Sketch_4.setHorizontal(SketchLine_21.result()) SketchConstraintHorizontal_4 = Sketch_4.setHorizontal(SketchLine_24.result()) SketchLine_25 = Sketch_4.addLine(3.593262427359596e-30, -33, 0, -43) SketchLine_25.setName("SketchLine_26") SketchLine_25.result().setName("SketchLine_26") -SketchConstraintCoincidence_38 = Sketch_4.setCoincident(SketchLine_25.startPoint(), SketchLine_19.result()) +SketchConstraintCoincidence_38 = Sketch_4.setCoincident( + SketchLine_25.startPoint(), SketchLine_19.result() +) SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_39") SketchLine_26 = Sketch_4.addLine(42, -33, 42, -43) SketchLine_26.setName("SketchLine_27") SketchLine_26.result().setName("SketchLine_27") -SketchConstraintCoincidence_40 = Sketch_4.setCoincident(SketchLine_26.startPoint(), SketchLine_20.result()) +SketchConstraintCoincidence_40 = Sketch_4.setCoincident( + SketchLine_26.startPoint(), SketchLine_20.result() +) SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_41") -SketchConstraintCoincidence_41 = Sketch_4.setCoincident(SketchLine_26.endPoint(), SketchLine_20.result()) +SketchConstraintCoincidence_41 = Sketch_4.setCoincident( + SketchLine_26.endPoint(), SketchLine_20.result() +) SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_42") -SketchArc_5 = Sketch_4.addArc(5, -33, 3.593262427359596e-30, -33, 4.999999999999999, -28, True) -SketchConstraintCoincidence_42 = Sketch_4.setCoincident(SketchLine_25.startPoint(), SketchArc_5.startPoint()) +SketchArc_5 = Sketch_4.addArc( + 5, -33, 3.593262427359596e-30, -33, 4.999999999999999, -28, True +) +SketchConstraintCoincidence_42 = Sketch_4.setCoincident( + SketchLine_25.startPoint(), SketchArc_5.startPoint() +) SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_43") -SketchConstraintTangent_9 = Sketch_4.setTangent(SketchLine_25.result(), SketchArc_5.results()[1]) +SketchConstraintTangent_9 = Sketch_4.setTangent( + SketchLine_25.result(), SketchArc_5.results()[1] +) SketchArc_6 = Sketch_4.addArc(5, -43, 0, -43, 4.999999999999999, -48, False) -SketchConstraintCoincidence_43 = Sketch_4.setCoincident(SketchLine_25.endPoint(), SketchArc_6.startPoint()) +SketchConstraintCoincidence_43 = Sketch_4.setCoincident( + SketchLine_25.endPoint(), SketchArc_6.startPoint() +) SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_44") -SketchConstraintTangent_10 = Sketch_4.setTangent(SketchLine_25.result(), SketchArc_6.results()[1]) +SketchConstraintTangent_10 = Sketch_4.setTangent( + SketchLine_25.result(), SketchArc_6.results()[1] +) SketchArc_7 = Sketch_4.addArc(37, -33, 37, -28, 42, -33, True) -SketchConstraintCoincidence_44 = Sketch_4.setCoincident(SketchLine_21.endPoint(), SketchArc_7.startPoint()) +SketchConstraintCoincidence_44 = Sketch_4.setCoincident( + SketchLine_21.endPoint(), SketchArc_7.startPoint() +) SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_45") -SketchConstraintTangent_11 = Sketch_4.setTangent(SketchLine_21.result(), SketchArc_7.results()[1]) +SketchConstraintTangent_11 = Sketch_4.setTangent( + SketchLine_21.result(), SketchArc_7.results()[1] +) SketchArc_8 = Sketch_4.addArc(37, -43, 37, -48, 42, -43, False) -SketchConstraintCoincidence_45 = Sketch_4.setCoincident(SketchLine_24.endPoint(), SketchArc_8.startPoint()) +SketchConstraintCoincidence_45 = Sketch_4.setCoincident( + SketchLine_24.endPoint(), SketchArc_8.startPoint() +) SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_46") -SketchConstraintTangent_12 = Sketch_4.setTangent(SketchLine_24.result(), SketchArc_8.results()[1]) -SketchConstraintDistance_6 = Sketch_4.setDistance(SketchLine_21.startPoint(), SketchLine_24.startPoint(), 20) -SketchConstraintEqual_7 = Sketch_4.setEqual(SketchLine_26.result(), SketchLine_25.result()) -SketchConstraintCoincidence_46 = Sketch_4.setCoincident(SketchArc_5.endPoint(), SketchLine_21.startPoint()) +SketchConstraintTangent_12 = Sketch_4.setTangent( + SketchLine_24.result(), SketchArc_8.results()[1] +) +SketchConstraintDistance_6 = Sketch_4.setDistance( + SketchLine_21.startPoint(), SketchLine_24.startPoint(), 20 +) +SketchConstraintEqual_7 = Sketch_4.setEqual( + SketchLine_26.result(), SketchLine_25.result() +) +SketchConstraintCoincidence_46 = Sketch_4.setCoincident( + SketchArc_5.endPoint(), SketchLine_21.startPoint() +) SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_47") -SketchConstraintCoincidence_47 = Sketch_4.setCoincident(SketchLine_26.startPoint(), SketchArc_7.endPoint()) +SketchConstraintCoincidence_47 = Sketch_4.setCoincident( + SketchLine_26.startPoint(), SketchArc_7.endPoint() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_48") -SketchConstraintCoincidence_48 = Sketch_4.setCoincident(SketchLine_26.endPoint(), SketchArc_8.endPoint()) +SketchConstraintCoincidence_48 = Sketch_4.setCoincident( + SketchLine_26.endPoint(), SketchArc_8.endPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_49") -SketchConstraintCoincidence_49 = Sketch_4.setCoincident(SketchLine_24.startPoint(), SketchArc_6.endPoint()) +SketchConstraintCoincidence_49 = Sketch_4.setCoincident( + SketchLine_24.startPoint(), SketchArc_6.endPoint() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_50") -SketchConstraintTangent_13 = Sketch_4.setTangent(SketchArc_5.results()[1], SketchLine_21.result()) -SketchConstraintTangent_14 = Sketch_4.setTangent(SketchArc_7.results()[1], SketchLine_26.result()) -SketchConstraintTangent_15 = Sketch_4.setTangent(SketchArc_8.results()[1], SketchLine_26.result()) +SketchConstraintTangent_13 = Sketch_4.setTangent( + SketchArc_5.results()[1], SketchLine_21.result() +) +SketchConstraintTangent_14 = Sketch_4.setTangent( + SketchArc_7.results()[1], SketchLine_26.result() +) +SketchConstraintTangent_15 = Sketch_4.setTangent( + SketchArc_8.results()[1], SketchLine_26.result() +) SketchLine_27 = Sketch_4.addLine(0, -38, 42, -38) SketchLine_27.setName("SketchLine_28") SketchLine_27.result().setName("SketchLine_28") SketchLine_27.setAuxiliary(True) -SketchConstraintCoincidence_51 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchLine_20.result()) +SketchConstraintCoincidence_51 = Sketch_4.setCoincident( + SketchLine_27.endPoint(), SketchLine_20.result() +) SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_52") -SketchConstraintMiddle_10 = Sketch_4.setMiddlePoint(SketchLine_27.endPoint(), SketchLine_20.result()) -SketchConstraintMiddle_11 = Sketch_4.setMiddlePoint(SketchLine_27.startPoint(), SketchLine_19.result()) -SketchConstraintMiddle_12 = Sketch_4.setMiddlePoint(SketchLine_25.result(), SketchLine_27.startPoint()) +SketchConstraintMiddle_10 = Sketch_4.setMiddlePoint( + SketchLine_27.endPoint(), SketchLine_20.result() +) +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-SketchArc_5_2f-SketchLine_26f-SketchArc_6_2f-SketchLine_25f-SketchArc_8_2f-SketchLine_27r-SketchArc_7_2f-SketchLine_22r")], model.selection(), 2, 17) +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") @@ -281,87 +613,211 @@ SketchConstraintHorizontal_5 = Sketch_5.setHorizontal(SketchLine_29.result()) SketchConstraintHorizontal_6 = Sketch_5.setHorizontal(SketchLine_28.result()) 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&Sketch_4/SketchLine_26][Extrusion_2_1/To_Face]")) +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&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&Sketch_4/SketchLine_27][Extrusion_2_1/To_Face]")) +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&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&Sketch_4/SketchLine_22][Extrusion_2_1/To_Face]")) +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&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&Sketch_4/SketchLine_25][Extrusion_2_1/To_Face]")) +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&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) +SketchConstraintDistance_10 = Sketch_5.setDistance( + SketchLine_28.startPoint(), SketchLine_35.result(), 2 +) SketchArc_9 = Sketch_5.addArc(5, -33, 2, -33, 5, -30, True) -SketchConstraintCoincidence_52 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchArc_9.startPoint()) +SketchConstraintCoincidence_52 = Sketch_5.setCoincident( + SketchLine_30.endPoint(), SketchArc_9.startPoint() +) SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_53") -SketchConstraintTangent_16 = Sketch_5.setTangent(SketchLine_30.result(), SketchArc_9.results()[1]) +SketchConstraintTangent_16 = Sketch_5.setTangent( + SketchLine_30.result(), SketchArc_9.results()[1] +) SketchArc_10 = Sketch_5.addArc(5, -43, 2, -43, 5.000000000000001, -46, False) -SketchConstraintCoincidence_53 = Sketch_5.setCoincident(SketchLine_30.startPoint(), SketchArc_10.startPoint()) +SketchConstraintCoincidence_53 = Sketch_5.setCoincident( + SketchLine_30.startPoint(), SketchArc_10.startPoint() +) SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_54") -SketchConstraintTangent_17 = Sketch_5.setTangent(SketchLine_30.result(), SketchArc_10.results()[1]) -SketchArc_11 = Sketch_5.addArc(37.00000000000001, -33, 37.00000000000001, -30, 40.00000000000001, -33, True) -SketchConstraintCoincidence_54 = Sketch_5.setCoincident(SketchLine_29.endPoint(), SketchArc_11.startPoint()) +SketchConstraintTangent_17 = Sketch_5.setTangent( + SketchLine_30.result(), SketchArc_10.results()[1] +) +SketchArc_11 = Sketch_5.addArc( + 37.00000000000001, -33, 37.00000000000001, -30, 40.00000000000001, -33, True +) +SketchConstraintCoincidence_54 = Sketch_5.setCoincident( + SketchLine_29.endPoint(), SketchArc_11.startPoint() +) SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_55") -SketchConstraintTangent_18 = Sketch_5.setTangent(SketchLine_29.result(), SketchArc_11.results()[1]) -SketchArc_12 = Sketch_5.addArc(37.00000000000001, -43, 37.00000000000001, -46, 40.00000000000001, -43, False) -SketchConstraintCoincidence_55 = Sketch_5.setCoincident(SketchLine_28.endPoint(), SketchArc_12.startPoint()) +SketchConstraintTangent_18 = Sketch_5.setTangent( + SketchLine_29.result(), SketchArc_11.results()[1] +) +SketchArc_12 = Sketch_5.addArc( + 37.00000000000001, -43, 37.00000000000001, -46, 40.00000000000001, -43, False +) +SketchConstraintCoincidence_55 = Sketch_5.setCoincident( + SketchLine_28.endPoint(), SketchArc_12.startPoint() +) SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_56") -SketchConstraintTangent_19 = Sketch_5.setTangent(SketchLine_28.result(), SketchArc_12.results()[1]) -SketchConstraintCoincidence_56 = Sketch_5.setCoincident(SketchArc_9.endPoint(), SketchLine_29.startPoint()) +SketchConstraintTangent_19 = Sketch_5.setTangent( + SketchLine_28.result(), SketchArc_12.results()[1] +) +SketchConstraintCoincidence_56 = Sketch_5.setCoincident( + SketchArc_9.endPoint(), SketchLine_29.startPoint() +) SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_57") -SketchConstraintCoincidence_57 = Sketch_5.setCoincident(SketchArc_11.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_57 = Sketch_5.setCoincident( + SketchArc_11.endPoint(), SketchLine_31.startPoint() +) SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_58") -SketchConstraintCoincidence_58 = Sketch_5.setCoincident(SketchLine_31.endPoint(), SketchArc_12.endPoint()) +SketchConstraintCoincidence_58 = Sketch_5.setCoincident( + SketchLine_31.endPoint(), SketchArc_12.endPoint() +) SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_59") -SketchConstraintCoincidence_59 = Sketch_5.setCoincident(SketchArc_10.endPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_59 = Sketch_5.setCoincident( + SketchArc_10.endPoint(), SketchLine_28.startPoint() +) SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_60") -SketchConstraintEqual_10 = Sketch_5.setEqual(SketchArc_11.results()[1], SketchArc_9.results()[1]) -SketchConstraintEqual_11 = Sketch_5.setEqual(SketchArc_10.results()[1], SketchArc_12.results()[1]) -SketchConstraintEqual_12 = Sketch_5.setEqual(SketchArc_12.results()[1], SketchArc_11.results()[1]) -SketchConstraintTangent_20 = Sketch_5.setTangent(SketchArc_9.results()[1], SketchLine_29.result()) -SketchConstraintTangent_21 = Sketch_5.setTangent(SketchArc_12.results()[1], SketchLine_31.result()) +SketchConstraintEqual_10 = Sketch_5.setEqual( + SketchArc_11.results()[1], SketchArc_9.results()[1] +) +SketchConstraintEqual_11 = Sketch_5.setEqual( + SketchArc_10.results()[1], SketchArc_12.results()[1] +) +SketchConstraintEqual_12 = Sketch_5.setEqual( + SketchArc_12.results()[1], SketchArc_11.results()[1] +) +SketchConstraintTangent_20 = Sketch_5.setTangent( + SketchArc_9.results()[1], SketchLine_29.result() +) +SketchConstraintTangent_21 = Sketch_5.setTangent( + SketchArc_12.results()[1], SketchLine_31.result() +) SketchConstraintRadius_6 = Sketch_5.setRadius(SketchArc_9.results()[1], 3) SketchLine_36 = Sketch_5.addLine(2, -38, 39.99999999999998, -38) SketchLine_36.setName("SketchLine_37") SketchLine_36.result().setName("SketchLine_37") SketchLine_36.setAuxiliary(True) -SketchConstraintCoincidence_60 = Sketch_5.setCoincident(SketchLine_36.startPoint(), SketchLine_30.result()) +SketchConstraintCoincidence_60 = Sketch_5.setCoincident( + SketchLine_36.startPoint(), SketchLine_30.result() +) SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_61") -SketchConstraintCoincidence_61 = Sketch_5.setCoincident(SketchLine_36.endPoint(), SketchLine_31.result()) +SketchConstraintCoincidence_61 = Sketch_5.setCoincident( + SketchLine_36.endPoint(), SketchLine_31.result() +) SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_62") -SketchConstraintMiddle_13 = Sketch_5.setMiddlePoint(SketchLine_31.result(), SketchLine_36.endPoint()) -SketchConstraintMiddle_14 = Sketch_5.setMiddlePoint(SketchLine_36.startPoint(), SketchLine_30.result()) +SketchConstraintMiddle_13 = Sketch_5.setMiddlePoint( + SketchLine_31.result(), SketchLine_36.endPoint() +) +SketchConstraintMiddle_14 = Sketch_5.setMiddlePoint( + SketchLine_36.startPoint(), SketchLine_30.result() +) SketchCircle_8 = Sketch_5.addCircle(13.00000000000001, -38, 2.5) -SketchConstraintCoincidence_62 = Sketch_5.setCoincident(SketchLine_36.result(), SketchCircle_8.center()) +SketchConstraintCoincidence_62 = Sketch_5.setCoincident( + SketchLine_36.result(), SketchCircle_8.center() +) SketchConstraintCoincidence_62.setName("SketchConstraintCoincidence_63") SketchCircle_9 = Sketch_5.addCircle(29, -38, 2.5) -SketchConstraintCoincidence_63 = Sketch_5.setCoincident(SketchLine_36.result(), SketchCircle_9.center()) +SketchConstraintCoincidence_63 = Sketch_5.setCoincident( + SketchLine_36.result(), SketchCircle_9.center() +) SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_64") -SketchConstraintEqual_13 = Sketch_5.setEqual(SketchCircle_9.results()[1], SketchCircle_8.results()[1]) +SketchConstraintEqual_13 = Sketch_5.setEqual( + SketchCircle_9.results()[1], SketchCircle_8.results()[1] +) SketchConstraintRadius_7 = Sketch_5.setRadius(SketchCircle_9.results()[1], 2.5) -SketchConstraintDistance_11 = Sketch_5.setDistance(SketchCircle_8.center(), SketchCircle_9.center(), 16) +SketchConstraintDistance_11 = Sketch_5.setDistance( + SketchCircle_8.center(), SketchCircle_9.center(), 16 +) SketchLine_37 = Sketch_5.addLine(21, -28, 21, -48) SketchLine_37.setName("SketchLine_38") SketchLine_37.result().setName("SketchLine_38") SketchLine_37.setAuxiliary(True) -SketchConstraintCoincidence_64 = Sketch_5.setCoincident(SketchLine_37.startPoint(), SketchLine_34.result()) +SketchConstraintCoincidence_64 = Sketch_5.setCoincident( + SketchLine_37.startPoint(), SketchLine_34.result() +) SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_65") -SketchConstraintCoincidence_65 = Sketch_5.setCoincident(SketchLine_37.endPoint(), SketchLine_35.result()) +SketchConstraintCoincidence_65 = Sketch_5.setCoincident( + SketchLine_37.endPoint(), SketchLine_35.result() +) SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_66") -SketchConstraintMiddle_15 = Sketch_5.setMiddlePoint(SketchLine_37.startPoint(), SketchLine_34.result()) -SketchConstraintMiddle_16 = Sketch_5.setMiddlePoint(SketchLine_37.endPoint(), SketchLine_35.result()) -SketchConstraintDistance_12 = Sketch_5.setDistance(SketchCircle_8.center(), SketchLine_37.result(), 8) +SketchConstraintMiddle_15 = Sketch_5.setMiddlePoint( + SketchLine_37.startPoint(), SketchLine_34.result() +) +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/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")]) +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) SketchLine_38.setName("SketchLine_39") @@ -369,43 +825,65 @@ SketchLine_38.result().setName("SketchLine_39") SketchLine_39 = Sketch_6.addLine(-59, 2, -17, 2) SketchLine_39.setName("SketchLine_40") SketchLine_39.result().setName("SketchLine_40") -SketchConstraintCoincidence_66 = Sketch_6.setCoincident(SketchLine_38.endPoint(), SketchLine_39.startPoint()) +SketchConstraintCoincidence_66 = Sketch_6.setCoincident( + SketchLine_38.endPoint(), SketchLine_39.startPoint() +) SketchConstraintCoincidence_66.setName("SketchConstraintCoincidence_67") SketchLine_40 = Sketch_6.addLine(-17, 2, -16.99997429885428, 44) SketchLine_40.setName("SketchLine_41") SketchLine_40.result().setName("SketchLine_41") -SketchConstraintCoincidence_67 = Sketch_6.setCoincident(SketchLine_39.endPoint(), SketchLine_40.startPoint()) +SketchConstraintCoincidence_67 = Sketch_6.setCoincident( + SketchLine_39.endPoint(), SketchLine_40.startPoint() +) SketchConstraintCoincidence_67.setName("SketchConstraintCoincidence_68") SketchLine_41 = Sketch_6.addLine(-16.99997429885428, 44, -27.99998714942714, 44) SketchLine_41.setName("SketchLine_42") SketchLine_41.result().setName("SketchLine_42") -SketchConstraintCoincidence_68 = Sketch_6.setCoincident(SketchLine_40.endPoint(), SketchLine_41.startPoint()) +SketchConstraintCoincidence_68 = Sketch_6.setCoincident( + SketchLine_40.endPoint(), SketchLine_41.startPoint() +) SketchConstraintCoincidence_68.setName("SketchConstraintCoincidence_69") SketchLine_42 = Sketch_6.addLine(-27.99998714942714, 44, -27.99998714942714, 29) SketchLine_42.setName("SketchLine_43") SketchLine_42.result().setName("SketchLine_43") -SketchConstraintCoincidence_69 = Sketch_6.setCoincident(SketchLine_41.endPoint(), SketchLine_42.startPoint()) +SketchConstraintCoincidence_69 = Sketch_6.setCoincident( + SketchLine_41.endPoint(), SketchLine_42.startPoint() +) SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_70") SketchLine_43 = Sketch_6.addLine(-27.99998714942714, 29, -47.99998714942714, 29) SketchLine_43.setName("SketchLine_44") SketchLine_43.result().setName("SketchLine_44") -SketchConstraintCoincidence_70 = Sketch_6.setCoincident(SketchLine_42.endPoint(), SketchLine_43.startPoint()) +SketchConstraintCoincidence_70 = Sketch_6.setCoincident( + SketchLine_42.endPoint(), SketchLine_43.startPoint() +) SketchConstraintCoincidence_70.setName("SketchConstraintCoincidence_71") SketchLine_44 = Sketch_6.addLine(-47.99998714942714, 29, -47.99998714942714, 44) SketchLine_44.setName("SketchLine_45") SketchLine_44.result().setName("SketchLine_45") -SketchConstraintCoincidence_71 = Sketch_6.setCoincident(SketchLine_43.endPoint(), SketchLine_44.startPoint()) +SketchConstraintCoincidence_71 = Sketch_6.setCoincident( + SketchLine_43.endPoint(), SketchLine_44.startPoint() +) SketchConstraintCoincidence_71.setName("SketchConstraintCoincidence_72") SketchLine_45 = Sketch_6.addLine(-47.99998714942714, 44, -59, 44) SketchLine_45.setName("SketchLine_46") SketchLine_45.result().setName("SketchLine_46") -SketchConstraintCoincidence_72 = Sketch_6.setCoincident(SketchLine_44.endPoint(), SketchLine_45.startPoint()) +SketchConstraintCoincidence_72 = Sketch_6.setCoincident( + SketchLine_44.endPoint(), SketchLine_45.startPoint() +) SketchConstraintCoincidence_72.setName("SketchConstraintCoincidence_73") -SketchConstraintCoincidence_73 = Sketch_6.setCoincident(SketchLine_38.startPoint(), SketchLine_45.endPoint()) +SketchConstraintCoincidence_73 = Sketch_6.setCoincident( + SketchLine_38.startPoint(), SketchLine_45.endPoint() +) SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_74") -SketchConstraintEqual_14 = Sketch_6.setEqual(SketchLine_38.result(), SketchLine_40.result()) -SketchConstraintEqual_15 = Sketch_6.setEqual(SketchLine_41.result(), SketchLine_45.result()) -SketchConstraintEqual_16 = Sketch_6.setEqual(SketchLine_42.result(), SketchLine_44.result()) +SketchConstraintEqual_14 = Sketch_6.setEqual( + SketchLine_38.result(), SketchLine_40.result() +) +SketchConstraintEqual_15 = Sketch_6.setEqual( + SketchLine_41.result(), SketchLine_45.result() +) +SketchConstraintEqual_16 = Sketch_6.setEqual( + SketchLine_42.result(), SketchLine_44.result() +) SketchConstraintHorizontal_7 = Sketch_6.setHorizontal(SketchLine_45.result()) SketchConstraintHorizontal_8 = Sketch_6.setHorizontal(SketchLine_43.result()) SketchConstraintHorizontal_9 = Sketch_6.setHorizontal(SketchLine_39.result()) @@ -417,68 +895,153 @@ 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&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2]"), False) +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&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)_ExtrusionCut_5_2]"), False) +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)_ExtrusionCut_5_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&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2]"), False) +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) +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&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")) +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&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)_ExtrusionCut_6_1]")) +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)_ExtrusionCut_6_1]", + ) +) SketchLine_50.setName("SketchLine_51") SketchLine_50.result().setName("SketchLine_51") -SketchConstraintCoincidence_74 = Sketch_7.setCoincident(SketchLine_49.startPoint(), SketchLine_50.result()) +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/SketchLine_13_StartVertex")) -SketchConstraintCoincidence_75 = Sketch_7.setCoincident(SketchLine_49.endPoint(), SketchPoint_3.result()) +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()) +SketchConstraintMiddle_17 = Sketch_7.setMiddlePoint( + SketchLine_49.startPoint(), SketchLine_50.result() +) 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&Sketch_1/SketchLine_1][ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_1_2]")) +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 = 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&Sketch_1/SketchArc_3_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_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()) +SketchConstraintCoincidence_77 = Sketch_7.setCoincident( + SketchLine_51.endPoint(), SketchLine_53.result() +) SketchConstraintCoincidence_77.setName("SketchConstraintCoincidence_78") -SketchConstraintMiddle_18 = Sketch_7.setMiddlePoint(SketchLine_51.startPoint(), SketchLine_52.result()) -SketchConstraintMiddle_19 = Sketch_7.setMiddlePoint(SketchLine_51.endPoint(), SketchLine_53.result()) +SketchConstraintMiddle_18 = Sketch_7.setMiddlePoint( + SketchLine_51.startPoint(), SketchLine_52.result() +) +SketchConstraintMiddle_19 = Sketch_7.setMiddlePoint( + SketchLine_51.endPoint(), SketchLine_53.result() +) SketchPoint_4 = Sketch_7.addPoint(-37.99999999999999, -22.99999999998656) -SketchConstraintCoincidence_78 = Sketch_7.setCoincident(SketchPoint_4.coordinates(), SketchLine_51.result()) +SketchConstraintCoincidence_78 = Sketch_7.setCoincident( + SketchPoint_4.coordinates(), SketchLine_51.result() +) SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_79") -SketchConstraintMiddle_20 = Sketch_7.setMiddlePoint(SketchPoint_4.coordinates(), SketchLine_51.result()) +SketchConstraintMiddle_20 = Sketch_7.setMiddlePoint( + SketchPoint_4.coordinates(), SketchLine_51.result() +) SketchCircle_10 = Sketch_7.addCircle(-37.99999999999999, -22.99999999998656, 17) -SketchConstraintCoincidence_79 = Sketch_7.setCoincident(SketchPoint_4.coordinates(), SketchCircle_10.center()) +SketchConstraintCoincidence_79 = Sketch_7.setCoincident( + SketchPoint_4.coordinates(), SketchCircle_10.center() +) 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/Face-SketchCircle_10_2f_wire")], model.selection(), 16, 0) +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) +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&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)_ExtrusionCut_6_1]"), False) +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)_ExtrusionCut_6_1]", + ), + False, +) SketchLine_55 = SketchProjection_7.createdFeature() SketchLine_55.setName("SketchLine_56") SketchLine_55.result().setName("SketchLine_56") @@ -486,48 +1049,109 @@ SketchLine_56 = Sketch_8.addLine(0, -22.99999999998656, -76, -22.99999999999327) SketchLine_56.setName("SketchLine_57") SketchLine_56.result().setName("SketchLine_57") SketchLine_56.setAuxiliary(True) -SketchConstraintCoincidence_80 = Sketch_8.setCoincident(SketchLine_56.startPoint(), SketchLine_55.result()) +SketchConstraintCoincidence_80 = Sketch_8.setCoincident( + SketchLine_56.startPoint(), SketchLine_55.result() +) SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_81") -SketchConstraintCoincidence_81 = Sketch_8.setCoincident(SketchLine_56.endPoint(), SketchLine_54.result()) +SketchConstraintCoincidence_81 = Sketch_8.setCoincident( + SketchLine_56.endPoint(), SketchLine_54.result() +) SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_82") -SketchConstraintMiddle_21 = Sketch_8.setMiddlePoint(SketchLine_56.endPoint(), SketchLine_54.result()) -SketchConstraintMiddle_22 = Sketch_8.setMiddlePoint(SketchLine_55.result(), SketchLine_56.startPoint()) -SketchLine_57 = Sketch_8.addLine(-37.99999999999842, -40.99999999998655, -38.000000000002, 0) +SketchConstraintMiddle_21 = Sketch_8.setMiddlePoint( + SketchLine_56.endPoint(), SketchLine_54.result() +) +SketchConstraintMiddle_22 = Sketch_8.setMiddlePoint( + SketchLine_55.result(), SketchLine_56.startPoint() +) +SketchLine_57 = Sketch_8.addLine( + -37.99999999999842, -40.99999999998655, -38.000000000002, 0 +) SketchLine_57.setName("SketchLine_58") SketchLine_57.result().setName("SketchLine_58") SketchLine_57.setAuxiliary(True) SketchPoint_5 = Sketch_8.addPoint(-38, -22.99999999998992) -SketchConstraintCoincidence_82 = Sketch_8.setCoincident(SketchPoint_5.coordinates(), SketchLine_56.result()) +SketchConstraintCoincidence_82 = Sketch_8.setCoincident( + SketchPoint_5.coordinates(), SketchLine_56.result() +) SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_83") -SketchConstraintMiddle_23 = Sketch_8.setMiddlePoint(SketchLine_56.result(), SketchPoint_5.coordinates()) -SketchConstraintCoincidence_83 = Sketch_8.setCoincident(SketchLine_57.result(), SketchPoint_5.coordinates()) +SketchConstraintMiddle_23 = Sketch_8.setMiddlePoint( + SketchLine_56.result(), SketchPoint_5.coordinates() +) +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&Sketch_1/SketchLine_1][ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_1_2]"), False) +SketchConstraintPerpendicular_1 = Sketch_8.setPerpendicular( + SketchLine_57.result(), SketchLine_56.result() +) +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&Sketch_1/SketchArc_3_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"), False) +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") -SketchConstraintCoincidence_84 = Sketch_8.setCoincident(SketchLine_57.startPoint(), SketchLine_58.result()) +SketchConstraintCoincidence_84 = Sketch_8.setCoincident( + SketchLine_57.startPoint(), SketchLine_58.result() +) SketchConstraintCoincidence_84.setName("SketchConstraintCoincidence_85") -SketchConstraintCoincidence_85 = Sketch_8.setCoincident(SketchLine_57.endPoint(), SketchLine_59.result()) +SketchConstraintCoincidence_85 = Sketch_8.setCoincident( + SketchLine_57.endPoint(), SketchLine_59.result() +) SketchConstraintCoincidence_85.setName("SketchConstraintCoincidence_86") SketchCircle_11 = Sketch_8.addCircle(-30, -22.99999999998921, 2.5) -SketchConstraintCoincidence_86 = Sketch_8.setCoincident(SketchLine_56.result(), SketchCircle_11.center()) +SketchConstraintCoincidence_86 = Sketch_8.setCoincident( + SketchLine_56.result(), SketchCircle_11.center() +) SketchConstraintCoincidence_86.setName("SketchConstraintCoincidence_87") SketchCircle_12 = Sketch_8.addCircle(-46.00000000004985, -22.99999999999062, 2.5) -SketchConstraintCoincidence_87 = Sketch_8.setCoincident(SketchLine_56.result(), SketchCircle_12.center()) +SketchConstraintCoincidence_87 = Sketch_8.setCoincident( + SketchLine_56.result(), SketchCircle_12.center() +) SketchConstraintCoincidence_87.setName("SketchConstraintCoincidence_88") -SketchConstraintEqual_17 = Sketch_8.setEqual(SketchCircle_12.results()[1], SketchCircle_11.results()[1]) +SketchConstraintEqual_17 = Sketch_8.setEqual( + SketchCircle_12.results()[1], SketchCircle_11.results()[1] +) SketchConstraintRadius_9 = Sketch_8.setRadius(SketchCircle_11.results()[1], 2.5) -SketchConstraintDistance_15 = Sketch_8.setDistance(SketchCircle_11.center(), SketchLine_57.result(), 8) -SketchConstraintDistance_16 = Sketch_8.setDistance(SketchCircle_11.center(), SketchCircle_12.center(), 16) +SketchConstraintDistance_15 = Sketch_8.setDistance( + SketchCircle_11.center(), SketchLine_57.result(), 8 +) +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", "(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)_ExtrusionCut_6_1"), 38, True) +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", + "(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)_ExtrusionCut_6_1", + ), + 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") @@ -541,40 +1165,65 @@ SketchLine_62.result().setName("SketchLine_63") SketchLine_63 = Sketch_9.addLine(-14, -22.99999999998992, -14, -36.99999999998992) SketchLine_63.setName("SketchLine_64") SketchLine_63.result().setName("SketchLine_64") -SketchConstraintCoincidence_88 = Sketch_9.setCoincident(SketchLine_63.endPoint(), SketchLine_60.startPoint()) +SketchConstraintCoincidence_88 = Sketch_9.setCoincident( + SketchLine_63.endPoint(), SketchLine_60.startPoint() +) SketchConstraintCoincidence_88.setName("SketchConstraintCoincidence_89") -SketchConstraintCoincidence_89 = Sketch_9.setCoincident(SketchLine_60.endPoint(), SketchLine_61.startPoint()) +SketchConstraintCoincidence_89 = Sketch_9.setCoincident( + SketchLine_60.endPoint(), SketchLine_61.startPoint() +) SketchConstraintCoincidence_89.setName("SketchConstraintCoincidence_90") -SketchConstraintCoincidence_90 = Sketch_9.setCoincident(SketchLine_61.endPoint(), SketchLine_62.startPoint()) +SketchConstraintCoincidence_90 = Sketch_9.setCoincident( + SketchLine_61.endPoint(), SketchLine_62.startPoint() +) SketchConstraintCoincidence_90.setName("SketchConstraintCoincidence_91") -SketchConstraintCoincidence_91 = Sketch_9.setCoincident(SketchLine_62.endPoint(), SketchLine_63.startPoint()) +SketchConstraintCoincidence_91 = Sketch_9.setCoincident( + SketchLine_62.endPoint(), SketchLine_63.startPoint() +) SketchConstraintCoincidence_91.setName("SketchConstraintCoincidence_92") SketchConstraintHorizontal_11 = Sketch_9.setHorizontal(SketchLine_60.result()) SketchConstraintVertical_7 = Sketch_9.setVertical(SketchLine_61.result()) SketchConstraintHorizontal_12 = Sketch_9.setHorizontal(SketchLine_62.result()) SketchConstraintVertical_8 = Sketch_9.setVertical(SketchLine_63.result()) SketchConstraintLength_7 = Sketch_9.setLength(SketchLine_61.result(), 14) -SketchConstraintEqual_18 = Sketch_9.setEqual(SketchLine_61.result(), SketchLine_60.result()) -SketchLine_64 = Sketch_9.addLine(-5.662490896925754, -22.99999999998992, -60.5217691188193, -22.99999999998992) +SketchConstraintEqual_18 = Sketch_9.setEqual( + SketchLine_61.result(), SketchLine_60.result() +) +SketchLine_64 = Sketch_9.addLine( + -5.662490896925754, -22.99999999998992, -60.5217691188193, -22.99999999998992 +) 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/SketchPoint_5")) -SketchConstraintCoincidence_92 = Sketch_9.setCoincident(SketchLine_64.result(), SketchPoint_6.coordinates()) +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 = Sketch_9.setCoincident( + SketchLine_62.startPoint(), SketchLine_64.result() +) SketchConstraintCoincidence_93.setName("SketchConstraintCoincidence_94") 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 = 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/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 +from GeomAPI import GeomAPI_Shape model.testNbResults(Part_1, 1) model.testNbSubResults(Part_1, [0]) @@ -585,4 +1234,4 @@ model.testNbSubShapes(Part_1, GeomAPI_Shape.VERTEX, [680]) model.testResultsVolumes(Part_1, [61675.12443110236]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.models/piece_09.py b/test.models/piece_09.py index 787666f9e..49a1398f0 100644 --- a/test.models/piece_09.py +++ b/test.models/piece_09.py @@ -56,58 +56,184 @@ model.addParameter(Part_1_doc, "epaisseur_plat", "25") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(0, 0, 13.23223304703355, -2.874692731756102e-26) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchPoint_1.result() +) SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) -SketchArc_1 = Sketch_1.addArc(13.23223304703355, 5.51776695296637, 13.23223304703355, -2.874692731756102e-26, 18.74999999999991, 5.51776695296637, False) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_1.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_1.result(), SketchArc_1.results()[1]) -SketchLine_3 = Sketch_1.addLine(18.74999999999991, 5.51776695296637, 18.74999999999991, 29.48223304703358) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_3.startPoint()) -SketchArc_2 = Sketch_1.addArc(21.76776695296633, 29.48223304703358, 18.74999999999991, 29.48223304703358, 21.76776695296638, 32.50000000000001, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_2.startPoint()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_2.results()[1]) -SketchLine_4 = Sketch_1.addLine(21.76776695296638, 32.50000000000001, 88.23223304703366, 32.50000000000001) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_4.startPoint()) -SketchArc_3 = Sketch_1.addArc(88.23223304703366, 29.48223304703358, 88.23223304703366, 32.50000000000001, 91.25000000000009, 29.48223304703358, True) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_3.results()[1]) -SketchLine_5 = Sketch_1.addLine(91.25000000000009, 29.48223304703358, 91.25000000000009, 5.51776695296637) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_5.startPoint()) -SketchArc_4 = Sketch_1.addArc(96.76776695296645, 5.51776695296637, 91.25000000000009, 5.51776695296637, 96.76776695296645, 0, False) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchArc_4.startPoint()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_5.result(), SketchArc_4.results()[1]) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_4.endPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.result() +) +SketchArc_1 = Sketch_1.addArc( + 13.23223304703355, + 5.51776695296637, + 13.23223304703355, + -2.874692731756102e-26, + 18.74999999999991, + 5.51776695296637, + False, +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_1.result(), SketchArc_1.results()[1] +) +SketchLine_3 = Sketch_1.addLine( + 18.74999999999991, 5.51776695296637, 18.74999999999991, 29.48223304703358 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_3.startPoint() +) +SketchArc_2 = Sketch_1.addArc( + 21.76776695296633, + 29.48223304703358, + 18.74999999999991, + 29.48223304703358, + 21.76776695296638, + 32.50000000000001, + True, +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_2.results()[1] +) +SketchLine_4 = Sketch_1.addLine( + 21.76776695296638, 32.50000000000001, 88.23223304703366, 32.50000000000001 +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_4.startPoint() +) +SketchArc_3 = Sketch_1.addArc( + 88.23223304703366, + 29.48223304703358, + 88.23223304703366, + 32.50000000000001, + 91.25000000000009, + 29.48223304703358, + True, +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchLine_4.result(), SketchArc_3.results()[1] +) +SketchLine_5 = Sketch_1.addLine( + 91.25000000000009, 29.48223304703358, 91.25000000000009, 5.51776695296637 +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_5.startPoint() +) +SketchArc_4 = Sketch_1.addArc( + 96.76776695296645, + 5.51776695296637, + 91.25000000000009, + 5.51776695296637, + 96.76776695296645, + 0, + False, +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchLine_5.result(), SketchArc_4.results()[1] +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_2.result(), SketchArc_4.endPoint() +) SketchLine_6 = Sketch_1.addLine(96.76776695296645, 0, 110, 0) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_2.result() +) SketchLine_7 = Sketch_1.addLine(0, 0, 0, 2.5) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_7.startPoint() +) SketchLine_8 = Sketch_1.addLine(0, 2.5, 14.99999999999991, 2.5) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchArc_5 = Sketch_1.addArc(14.99999999999991, 3.75, 14.99999999999991, 2.5, 16.24999999999991, 3.75, False) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchArc_5.startPoint()) -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchLine_8.result(), SketchArc_5.results()[1]) -SketchLine_9 = Sketch_1.addLine(16.24999999999991, 3.75, 16.24999999999991, 31.24999999999991) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_9.startPoint()) -SketchArc_6 = Sketch_1.addArc(19.99999999999991, 31.24999999999991, 16.24999999999991, 31.24999999999991, 19.99999999999996, 35, True) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchArc_6.startPoint()) -SketchConstraintTangent_6 = Sketch_1.setTangent(SketchLine_9.result(), SketchArc_6.results()[1]) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) +SketchArc_5 = Sketch_1.addArc( + 14.99999999999991, 3.75, 14.99999999999991, 2.5, 16.24999999999991, 3.75, False +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchArc_5.startPoint() +) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchLine_8.result(), SketchArc_5.results()[1] +) +SketchLine_9 = Sketch_1.addLine( + 16.24999999999991, 3.75, 16.24999999999991, 31.24999999999991 +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchLine_9.startPoint() +) +SketchArc_6 = Sketch_1.addArc( + 19.99999999999991, + 31.24999999999991, + 16.24999999999991, + 31.24999999999991, + 19.99999999999996, + 35, + True, +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchArc_6.startPoint() +) +SketchConstraintTangent_6 = Sketch_1.setTangent( + SketchLine_9.result(), SketchArc_6.results()[1] +) SketchLine_10 = Sketch_1.addLine(19.99999999999996, 35, 89.99999999999997, 35) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_10.startPoint()) -SketchArc_7 = Sketch_1.addArc(90.00000000000009, 31.24999999999977, 89.99999999999997, 35, 93.75000000000009, 31.24999999999977, True) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_7.startPoint()) -SketchConstraintTangent_7 = Sketch_1.setTangent(SketchLine_10.result(), SketchArc_7.results()[1]) -SketchLine_11 = Sketch_1.addLine(93.75000000000009, 31.24999999999977, 93.75000000000009, 3.75) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchArc_7.endPoint(), SketchLine_11.startPoint()) -SketchArc_8 = Sketch_1.addArc(95.00000000000009, 3.75, 93.75000000000009, 3.75, 95.00000000000009, 2.5, False) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchArc_8.startPoint()) -SketchConstraintTangent_8 = Sketch_1.setTangent(SketchLine_11.result(), SketchArc_8.results()[1]) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchArc_6.endPoint(), SketchLine_10.startPoint() +) +SketchArc_7 = Sketch_1.addArc( + 90.00000000000009, + 31.24999999999977, + 89.99999999999997, + 35, + 93.75000000000009, + 31.24999999999977, + True, +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchArc_7.startPoint() +) +SketchConstraintTangent_7 = Sketch_1.setTangent( + SketchLine_10.result(), SketchArc_7.results()[1] +) +SketchLine_11 = Sketch_1.addLine( + 93.75000000000009, 31.24999999999977, 93.75000000000009, 3.75 +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchArc_7.endPoint(), SketchLine_11.startPoint() +) +SketchArc_8 = Sketch_1.addArc( + 95.00000000000009, 3.75, 93.75000000000009, 3.75, 95.00000000000009, 2.5, False +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchArc_8.startPoint() +) +SketchConstraintTangent_8 = Sketch_1.setTangent( + SketchLine_11.result(), SketchArc_8.results()[1] +) SketchLine_12 = Sketch_1.addLine(95.00000000000009, 2.5, 110, 2.5) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchArc_8.endPoint(), SketchLine_12.startPoint() +) SketchLine_13 = Sketch_1.addLine(110, 2.5, 110, 0) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_13.endPoint()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_13.endPoint() +) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_7.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_9.result()) @@ -117,69 +243,193 @@ SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_13.result()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_10.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_12.result()) -SketchConstraintTangent_9 = Sketch_1.setTangent(SketchArc_6.results()[1], SketchLine_10.result()) -SketchConstraintTangent_10 = Sketch_1.setTangent(SketchArc_7.results()[1], SketchLine_11.result()) -SketchConstraintTangent_11 = Sketch_1.setTangent(SketchArc_8.results()[1], SketchLine_12.result()) -SketchConstraintTangent_12 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchLine_9.result()) -SketchConstraintTangent_13 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_3.result()) +SketchConstraintTangent_9 = Sketch_1.setTangent( + SketchArc_6.results()[1], SketchLine_10.result() +) +SketchConstraintTangent_10 = Sketch_1.setTangent( + SketchArc_7.results()[1], SketchLine_11.result() +) +SketchConstraintTangent_11 = Sketch_1.setTangent( + SketchArc_8.results()[1], SketchLine_12.result() +) +SketchConstraintTangent_12 = Sketch_1.setTangent( + SketchArc_5.results()[1], SketchLine_9.result() +) +SketchConstraintTangent_13 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_3.result() +) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result()) -SketchConstraintTangent_14 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_6.result()) -SketchConstraintTangent_15 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_4.result()) -SketchConstraintTangent_16 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_5.result()) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_5.results()[1], SketchArc_8.results()[1]) -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_8.result(), SketchLine_12.result()) -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_6.result()) -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchArc_1.results()[1], SketchArc_4.results()[1]) -SketchConstraintEqual_5 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_5.result()) -SketchConstraintEqual_6 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_11.result()) -SketchConstraintEqual_7 = Sketch_1.setEqual(SketchLine_7.result(), SketchLine_13.result()) +SketchConstraintTangent_14 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchLine_6.result() +) +SketchConstraintTangent_15 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_4.result() +) +SketchConstraintTangent_16 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchLine_5.result() +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchArc_5.results()[1], SketchArc_8.results()[1] +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_8.result(), SketchLine_12.result() +) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchLine_1.result(), SketchLine_6.result() +) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchArc_1.results()[1], SketchArc_4.results()[1] +) +SketchConstraintEqual_5 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_5.result() +) +SketchConstraintEqual_6 = Sketch_1.setEqual( + SketchLine_9.result(), SketchLine_11.result() +) +SketchConstraintEqual_7 = Sketch_1.setEqual( + SketchLine_7.result(), SketchLine_13.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), "epaisseur*coeff") -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_5.endPoint(), SketchLine_3.result(), "epaisseur*coeff") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchArc_6.endPoint(), SketchLine_4.result(), "epaisseur*coeff") +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_5.endPoint(), SketchLine_3.result(), "epaisseur*coeff" +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchArc_6.endPoint(), SketchLine_4.result(), "epaisseur*coeff" +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_5.results()[1], "r3*coeff") SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_6.results()[1], "r2*coeff") -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_12.endPoint(), SketchLine_7.result(), "d4*coeff") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchArc_5.center(), SketchArc_1.center(), "epaisseur*coeff") -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchArc_2.center(), SketchArc_6.center(), "epaisseur*coeff") -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_1.result(), SketchArc_6.endPoint(), "(h4-d_diff)*coeff") +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_12.endPoint(), SketchLine_7.result(), "d4*coeff" +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchArc_5.center(), SketchArc_1.center(), "epaisseur*coeff" +) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchArc_2.center(), SketchArc_6.center(), "epaisseur*coeff" +) +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/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) +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&Sketch_1/SketchArc_7_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10]"), 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&Sketch_1/SketchLine_11][Extrusion_1_1/To_Face]"), 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()) -SketchArc_9 = Sketch_2.addArc(-31.24999999999999, -31.25000000000001, -31.24999999999999, -35.00000000000001, -34.99999999999999, -31.25000000000001, True) -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchArc_9.startPoint()) -SketchConstraintTangent_17 = Sketch_2.setTangent(SketchLine_16.result(), SketchArc_9.results()[1]) +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() +) +SketchArc_9 = Sketch_2.addArc( + -31.24999999999999, + -31.25000000000001, + -31.24999999999999, + -35.00000000000001, + -34.99999999999999, + -31.25000000000001, + True, +) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchLine_16.endPoint(), SketchArc_9.startPoint() +) +SketchConstraintTangent_17 = Sketch_2.setTangent( + SketchLine_16.result(), SketchArc_9.results()[1] +) SketchLine_17 = Sketch_2.addLine(-35, -31.24999999999999, -35, 1.250000000000009) -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchArc_9.endPoint(), SketchLine_17.startPoint()) -SketchArc_10 = Sketch_2.addArc(-31.25, 1.249999999999998, -35, 1.249999999999998, -31.25, 4.999999999999998, True) -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchArc_10.startPoint()) -SketchConstraintTangent_18 = Sketch_2.setTangent(SketchLine_17.result(), SketchArc_10.results()[1]) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchArc_9.endPoint(), SketchLine_17.startPoint() +) +SketchArc_10 = Sketch_2.addArc( + -31.25, 1.249999999999998, -35, 1.249999999999998, -31.25, 4.999999999999998, True +) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchLine_17.endPoint(), SketchArc_10.startPoint() +) +SketchConstraintTangent_18 = Sketch_2.setTangent( + SketchLine_17.result(), SketchArc_10.results()[1] +) SketchLine_18 = Sketch_2.addLine(-31.25, 4.999999999999999, -11.25, 4.999999999999999) -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchArc_10.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchArc_10.endPoint(), SketchLine_18.startPoint() +) SketchLine_19 = Sketch_2.addLine(-11.25, 5.000000000000009, -11.25, 2.500000000000009) -SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -SketchLine_20 = Sketch_2.addLine(-11.25, 2.500000000000002, -31.24999999999999, 2.500000000000017) -SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) -SketchArc_11 = Sketch_2.addArc(-31.25, 1.25, -31.25, 2.500000000000002, -32.5, 1.250000000000808, False) -SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchArc_11.startPoint()) -SketchConstraintTangent_19 = Sketch_2.setTangent(SketchLine_20.result(), SketchArc_11.results()[1]) +SketchConstraintCoincidence_30 = Sketch_2.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) +SketchLine_20 = Sketch_2.addLine( + -11.25, 2.500000000000002, -31.24999999999999, 2.500000000000017 +) +SketchConstraintCoincidence_31 = Sketch_2.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) +SketchArc_11 = Sketch_2.addArc( + -31.25, 1.25, -31.25, 2.500000000000002, -32.5, 1.250000000000808, False +) +SketchConstraintCoincidence_32 = Sketch_2.setCoincident( + SketchLine_20.endPoint(), SketchArc_11.startPoint() +) +SketchConstraintTangent_19 = Sketch_2.setTangent( + SketchLine_20.result(), SketchArc_11.results()[1] +) SketchLine_21 = Sketch_2.addLine(-32.5, 1.249999999999992, -32.5, -31.24999999999999) -SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchArc_11.endPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_33 = Sketch_2.setCoincident( + SketchArc_11.endPoint(), SketchLine_21.startPoint() +) SketchArc_12 = Sketch_2.addArc(-31.25, -31.25, -32.5, -31.25, -31.25, -32.5, False) -SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchArc_12.startPoint()) -SketchConstraintTangent_20 = Sketch_2.setTangent(SketchLine_21.result(), SketchArc_12.results()[1]) -SketchLine_22 = Sketch_2.addLine(-31.25, -32.50000000000001, -25.00000000000001, -32.50000000000001) -SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchArc_12.endPoint(), SketchLine_22.startPoint()) -SketchLine_23 = Sketch_2.addLine(-24.99999999999999, -35.00000000000001, -24.99999999999999, -32.50000000000002) -SketchConstraintCoincidence_36 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_14).endPoint(), SketchLine_23.startPoint()) -SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchLine_22.endPoint(), SketchLine_23.endPoint()) +SketchConstraintCoincidence_34 = Sketch_2.setCoincident( + SketchLine_21.endPoint(), SketchArc_12.startPoint() +) +SketchConstraintTangent_20 = Sketch_2.setTangent( + SketchLine_21.result(), SketchArc_12.results()[1] +) +SketchLine_22 = Sketch_2.addLine( + -31.25, -32.50000000000001, -25.00000000000001, -32.50000000000001 +) +SketchConstraintCoincidence_35 = Sketch_2.setCoincident( + SketchArc_12.endPoint(), SketchLine_22.startPoint() +) +SketchLine_23 = Sketch_2.addLine( + -24.99999999999999, -35.00000000000001, -24.99999999999999, -32.50000000000002 +) +SketchConstraintCoincidence_36 = Sketch_2.setCoincident( + SketchAPI_Line(SketchLine_14).endPoint(), SketchLine_23.startPoint() +) +SketchConstraintCoincidence_37 = Sketch_2.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.endPoint() +) SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_16.result()) SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_22.result()) SketchConstraintHorizontal_7 = Sketch_2.setHorizontal(SketchLine_20.result()) @@ -188,44 +438,117 @@ SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_17.result()) SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_21.result()) SketchConstraintVertical_9 = Sketch_2.setVertical(SketchLine_23.result()) SketchConstraintVertical_10 = Sketch_2.setVertical(SketchLine_19.result()) -SketchConstraintTangent_21 = Sketch_2.setTangent(SketchArc_9.results()[1], SketchLine_17.result()) -SketchConstraintTangent_22 = Sketch_2.setTangent(SketchArc_10.results()[1], SketchLine_18.result()) -SketchConstraintTangent_23 = Sketch_2.setTangent(SketchArc_11.results()[1], SketchLine_21.result()) -SketchConstraintTangent_24 = Sketch_2.setTangent(SketchArc_12.results()[1], SketchLine_22.result()) -SketchConstraintDistance_7 = Sketch_2.setDistance(SketchLine_23.startPoint(), SketchLine_18.result(), "h4*coeff") -SketchConstraintDistance_8 = Sketch_2.setDistance(SketchLine_16.startPoint(), SketchLine_22.result(), "epaisseur*coeff") -SketchConstraintDistance_9 = Sketch_2.setDistance(SketchLine_21.endPoint(), SketchLine_17.result(), "epaisseur*coeff") -SketchConstraintDistance_10 = Sketch_2.setDistance(SketchArc_11.startPoint(), SketchLine_18.result(), "epaisseur*coeff") -SketchConstraintCoincidence_39 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchAPI_Line(SketchLine_14).endPoint()) +SketchConstraintTangent_21 = Sketch_2.setTangent( + SketchArc_9.results()[1], SketchLine_17.result() +) +SketchConstraintTangent_22 = Sketch_2.setTangent( + SketchArc_10.results()[1], SketchLine_18.result() +) +SketchConstraintTangent_23 = Sketch_2.setTangent( + SketchArc_11.results()[1], SketchLine_21.result() +) +SketchConstraintTangent_24 = Sketch_2.setTangent( + SketchArc_12.results()[1], SketchLine_22.result() +) +SketchConstraintDistance_7 = Sketch_2.setDistance( + SketchLine_23.startPoint(), SketchLine_18.result(), "h4*coeff" +) +SketchConstraintDistance_8 = Sketch_2.setDistance( + SketchLine_16.startPoint(), SketchLine_22.result(), "epaisseur*coeff" +) +SketchConstraintDistance_9 = Sketch_2.setDistance( + SketchLine_21.endPoint(), SketchLine_17.result(), "epaisseur*coeff" +) +SketchConstraintDistance_10 = Sketch_2.setDistance( + SketchArc_11.startPoint(), SketchLine_18.result(), "epaisseur*coeff" +) +SketchConstraintCoincidence_39 = Sketch_2.setCoincident( + SketchLine_16.startPoint(), SketchAPI_Line(SketchLine_14).endPoint() +) SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "PartSet/Origin")) -SketchConstraintDistance_11 = Sketch_2.setDistance(SketchPoint_2.coordinates(), SketchLine_17.result(), "e3*coeff", False) +SketchConstraintDistance_11 = Sketch_2.setDistance( + SketchPoint_2.coordinates(), SketchLine_17.result(), "e3*coeff", False +) SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_9.results()[1], "r2*coeff") -SketchConstraintEqual_9 = Sketch_2.setEqual(SketchArc_9.results()[1], SketchArc_10.results()[1]) -SketchConstraintEqual_10 = Sketch_2.setEqual(SketchArc_11.results()[1], SketchArc_12.results()[1]) +SketchConstraintEqual_9 = Sketch_2.setEqual( + SketchArc_9.results()[1], SketchArc_10.results()[1] +) +SketchConstraintEqual_10 = Sketch_2.setEqual( + SketchArc_11.results()[1], SketchArc_12.results()[1] +) SketchConstraintRadius_4 = Sketch_2.setRadius(SketchArc_12.results()[1], "r3*coeff") -SketchConstraintDistance_13 = Sketch_2.setDistance(SketchArc_10.startPoint(), SketchLine_19.result(), "d8*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/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")) +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&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) -SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchLine_26.endPoint(), SketchLine_27.startPoint()) +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 +) +SketchConstraintCoincidence_43 = Sketch_3.setCoincident( + SketchLine_26.endPoint(), SketchLine_27.startPoint() +) SketchLine_28 = Sketch_3.addLine(62.5, -4.999999999999999, 46.25, -4.999999999999999) -SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchLine_27.endPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_44 = Sketch_3.setCoincident( + SketchLine_27.endPoint(), SketchLine_28.startPoint() +) SketchLine_29 = Sketch_3.addLine(46.25, -4.999999999999999, 46.25, 22.91561885925604) -SketchConstraintCoincidence_45 = Sketch_3.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint()) -SketchLine_30 = Sketch_3.addLine(46.25, 35.00000000000001, 56.25000000000002, 35.00000000000001) -SketchLine_31 = Sketch_3.addLine(56.25000000000002, 35.00000000000001, 56.25000000000002, 27.50000000000001) -SketchConstraintCoincidence_46 = Sketch_3.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) -SketchLine_32 = Sketch_3.addLine(56.25000000000002, 27.50000000000001, 46.25, 27.50000000000001) -SketchConstraintCoincidence_47 = Sketch_3.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) -SketchConstraintCoincidence_48 = Sketch_3.setCoincident(SketchLine_32.endPoint(), SketchLine_25.result()) +SketchConstraintCoincidence_45 = Sketch_3.setCoincident( + SketchLine_28.endPoint(), SketchLine_29.startPoint() +) +SketchLine_30 = Sketch_3.addLine( + 46.25, 35.00000000000001, 56.25000000000002, 35.00000000000001 +) +SketchLine_31 = Sketch_3.addLine( + 56.25000000000002, 35.00000000000001, 56.25000000000002, 27.50000000000001 +) +SketchConstraintCoincidence_46 = Sketch_3.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) +SketchLine_32 = Sketch_3.addLine( + 56.25000000000002, 27.50000000000001, 46.25, 27.50000000000001 +) +SketchConstraintCoincidence_47 = Sketch_3.setCoincident( + SketchLine_31.endPoint(), SketchLine_32.startPoint() +) +SketchConstraintCoincidence_48 = Sketch_3.setCoincident( + SketchLine_32.endPoint(), SketchLine_25.result() +) SketchLine_33 = Sketch_3.addLine(46.25, 27.50000000000001, 46.25, 35.00000000000001) -SketchConstraintCoincidence_49 = Sketch_3.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint()) -SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchLine_30.startPoint(), SketchLine_33.endPoint()) +SketchConstraintCoincidence_49 = Sketch_3.setCoincident( + SketchLine_32.endPoint(), SketchLine_33.startPoint() +) +SketchConstraintCoincidence_50 = Sketch_3.setCoincident( + SketchLine_30.startPoint(), SketchLine_33.endPoint() +) SketchConstraintHorizontal_9 = Sketch_3.setHorizontal(SketchLine_28.result()) SketchConstraintHorizontal_10 = Sketch_3.setHorizontal(SketchLine_26.result()) SketchConstraintHorizontal_11 = Sketch_3.setHorizontal(SketchLine_32.result()) @@ -234,138 +557,454 @@ SketchConstraintVertical_11 = Sketch_3.setVertical(SketchLine_29.result()) 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&Sketch_2/SketchLine_18][Extrusion_2_1/Generated_Face&Sketch_2/SketchArc_10_2]"), False) +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&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&Sketch_2/SketchArc_9_2][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_16]"), False) +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") +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" +) SketchConstraintLength_3 = Sketch_3.setLength(SketchLine_33.result(), "h3*coeff") -SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchLine_30.endPoint(), SketchLine_35.result()) -SketchConstraintDistance_16 = Sketch_3.setDistance(SketchLine_27.result(), SketchLine_28.endPoint(), "(d6-e2)*coeff") -SketchConstraintCoincidence_53 = Sketch_3.setCoincident(SketchLine_28.endPoint(), SketchLine_25.result()) -SketchConstraintCoincidence_54 = Sketch_3.setCoincident(SketchLine_29.endPoint(), SketchLine_24.startPoint()) -SketchConstraintDistance_17 = Sketch_3.setDistance(SketchLine_26.result(), SketchAPI_Line(SketchLine_35).startPoint(), "h2*coeff") +SketchConstraintCoincidence_52 = Sketch_3.setCoincident( + SketchLine_30.endPoint(), SketchLine_35.result() +) +SketchConstraintDistance_16 = Sketch_3.setDistance( + SketchLine_27.result(), SketchLine_28.endPoint(), "(d6-e2)*coeff" +) +SketchConstraintCoincidence_53 = Sketch_3.setCoincident( + SketchLine_28.endPoint(), SketchLine_25.result() +) +SketchConstraintCoincidence_54 = Sketch_3.setCoincident( + SketchLine_29.endPoint(), SketchLine_24.startPoint() +) +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_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) +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&Sketch_1/SketchLine_9][Extrusion_1_1/To_Face]"), False) +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/Modified_Face&Sketch_2/SketchLine_23][ExtrusionCut_2_1/Generated_Face&Sketch_3/SketchLine_31]"), False) +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&Sketch_1/SketchLine_10][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_6_2]"), False) +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()) -SketchArc_13 = Sketch_4.addArc(-31.25, -31.25000000000001, -31.24999999999999, -35.00000000000001, -34.99999999999999, -31.25000000000001, True) -SketchConstraintCoincidence_56 = Sketch_4.setCoincident(SketchLine_39.endPoint(), SketchArc_13.startPoint()) -SketchConstraintTangent_25 = Sketch_4.setTangent(SketchLine_39.result(), SketchArc_13.results()[1]) -SketchLine_40 = Sketch_4.addLine(-34.99999999999999, -31.25000000000001, -34.99999999999999, -20) -SketchConstraintCoincidence_57 = Sketch_4.setCoincident(SketchArc_13.endPoint(), SketchLine_40.startPoint()) +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() +) +SketchArc_13 = Sketch_4.addArc( + -31.25, + -31.25000000000001, + -31.24999999999999, + -35.00000000000001, + -34.99999999999999, + -31.25000000000001, + True, +) +SketchConstraintCoincidence_56 = Sketch_4.setCoincident( + SketchLine_39.endPoint(), SketchArc_13.startPoint() +) +SketchConstraintTangent_25 = Sketch_4.setTangent( + SketchLine_39.result(), SketchArc_13.results()[1] +) +SketchLine_40 = Sketch_4.addLine( + -34.99999999999999, -31.25000000000001, -34.99999999999999, -20 +) +SketchConstraintCoincidence_57 = Sketch_4.setCoincident( + SketchArc_13.endPoint(), SketchLine_40.startPoint() +) SketchLine_41 = Sketch_4.addLine(-34.99999999999999, -20, -32.49999999999999, -20) -SketchConstraintCoincidence_58 = Sketch_4.setCoincident(SketchLine_40.endPoint(), SketchLine_41.startPoint()) -SketchLine_42 = Sketch_4.addLine(-32.49999999999999, -20, -32.49999999999999, -31.24999999999389) -SketchConstraintCoincidence_59 = Sketch_4.setCoincident(SketchLine_41.endPoint(), SketchLine_42.startPoint()) -SketchArc_14 = Sketch_4.addArc(-31.24999999999999, -31.24999999999393, -32.49999999999999, -31.24999999999389, -31.25000000000371, -32.50000000000001, False) -SketchConstraintCoincidence_60 = Sketch_4.setCoincident(SketchLine_42.endPoint(), SketchArc_14.startPoint()) -SketchConstraintTangent_26 = Sketch_4.setTangent(SketchLine_42.result(), SketchArc_14.results()[1]) -SketchLine_43 = Sketch_4.addLine(-31.25000000000371, -32.50000000000001, -25, -32.50000000000001) -SketchConstraintCoincidence_61 = Sketch_4.setCoincident(SketchArc_14.endPoint(), SketchLine_43.startPoint()) -SketchConstraintCoincidence_62 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_37).endPoint(), SketchLine_43.endPoint()) +SketchConstraintCoincidence_58 = Sketch_4.setCoincident( + SketchLine_40.endPoint(), SketchLine_41.startPoint() +) +SketchLine_42 = Sketch_4.addLine( + -32.49999999999999, -20, -32.49999999999999, -31.24999999999389 +) +SketchConstraintCoincidence_59 = Sketch_4.setCoincident( + SketchLine_41.endPoint(), SketchLine_42.startPoint() +) +SketchArc_14 = Sketch_4.addArc( + -31.24999999999999, + -31.24999999999393, + -32.49999999999999, + -31.24999999999389, + -31.25000000000371, + -32.50000000000001, + False, +) +SketchConstraintCoincidence_60 = Sketch_4.setCoincident( + SketchLine_42.endPoint(), SketchArc_14.startPoint() +) +SketchConstraintTangent_26 = Sketch_4.setTangent( + SketchLine_42.result(), SketchArc_14.results()[1] +) +SketchLine_43 = Sketch_4.addLine( + -31.25000000000371, -32.50000000000001, -25, -32.50000000000001 +) +SketchConstraintCoincidence_61 = Sketch_4.setCoincident( + SketchArc_14.endPoint(), SketchLine_43.startPoint() +) +SketchConstraintCoincidence_62 = Sketch_4.setCoincident( + SketchAPI_Line(SketchLine_37).endPoint(), SketchLine_43.endPoint() +) SketchLine_44 = Sketch_4.addLine(-25, -35.00000000000001, -25, -32.50000000000001) -SketchConstraintCoincidence_63 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_37).startPoint(), SketchLine_44.startPoint()) -SketchConstraintCoincidence_64 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_37).endPoint(), SketchLine_44.endPoint()) +SketchConstraintCoincidence_63 = Sketch_4.setCoincident( + SketchAPI_Line(SketchLine_37).startPoint(), SketchLine_44.startPoint() +) +SketchConstraintCoincidence_64 = Sketch_4.setCoincident( + SketchAPI_Line(SketchLine_37).endPoint(), SketchLine_44.endPoint() +) SketchConstraintHorizontal_13 = Sketch_4.setHorizontal(SketchLine_41.result()) SketchConstraintHorizontal_14 = Sketch_4.setHorizontal(SketchLine_43.result()) SketchConstraintHorizontal_15 = Sketch_4.setHorizontal(SketchLine_39.result()) SketchConstraintVertical_15 = Sketch_4.setVertical(SketchLine_42.result()) SketchConstraintVertical_16 = Sketch_4.setVertical(SketchLine_40.result()) -SketchConstraintTangent_27 = Sketch_4.setTangent(SketchArc_13.results()[1], SketchLine_40.result()) -SketchConstraintTangent_28 = Sketch_4.setTangent(SketchArc_14.results()[1], SketchLine_43.result()) -SketchConstraintDistance_18 = Sketch_4.setDistance(SketchLine_40.result(), SketchLine_44.startPoint(), "h1*coeff") +SketchConstraintTangent_27 = Sketch_4.setTangent( + SketchArc_13.results()[1], SketchLine_40.result() +) +SketchConstraintTangent_28 = Sketch_4.setTangent( + SketchArc_14.results()[1], SketchLine_43.result() +) +SketchConstraintDistance_18 = Sketch_4.setDistance( + SketchLine_40.result(), SketchLine_44.startPoint(), "h1*coeff" +) SketchConstraintRadius_5 = Sketch_4.setRadius(SketchArc_13.results()[1], "r2*coeff") SketchConstraintRadius_6 = Sketch_4.setRadius(SketchArc_14.results()[1], "r3*coeff") -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") +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/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")) +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/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&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_13]")) +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&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&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7]"), False) +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") +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_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")) +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&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_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 = 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/SketchLine_10")) -SketchConstraintDistance_24 = Sketch_6.setDistance(SketchCircle_2.center(), SketchLine_50.result(), "d_trou") +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_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")) +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&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][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]) -SketchConstraintCoincidence_68 = Sketch_7.setCoincident(SketchLine_53.result(), SketchArc_15.endPoint()) +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][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] +) +SketchConstraintCoincidence_68 = Sketch_7.setCoincident( + SketchLine_53.result(), SketchArc_15.endPoint() +) SketchConstraintRadius_9 = Sketch_7.setRadius(SketchArc_15.results()[1], "r1") SketchLine_54 = Sketch_7.addLine(104.5, 0, 110, 0) -SketchConstraintCoincidence_69 = Sketch_7.setCoincident(SketchArc_15.endPoint(), SketchLine_54.startPoint()) -SketchConstraintCoincidence_70 = Sketch_7.setCoincident(SketchLine_52.startPoint(), SketchLine_54.endPoint()) +SketchConstraintCoincidence_69 = Sketch_7.setCoincident( + SketchArc_15.endPoint(), SketchLine_54.startPoint() +) +SketchConstraintCoincidence_70 = Sketch_7.setCoincident( + SketchLine_52.startPoint(), SketchLine_54.endPoint() +) SketchPoint_3 = Sketch_7.addPoint(0, 0) SketchLine_55 = Sketch_7.addLine(110, 7.22841614740048, 110, 0) -SketchConstraintCoincidence_71 = Sketch_7.setCoincident(SketchLine_51.endPoint(), SketchLine_55.startPoint()) -SketchConstraintCoincidence_72 = Sketch_7.setCoincident(SketchLine_52.startPoint(), SketchLine_55.endPoint()) +SketchConstraintCoincidence_71 = Sketch_7.setCoincident( + SketchLine_51.endPoint(), SketchLine_55.startPoint() +) +SketchConstraintCoincidence_72 = Sketch_7.setCoincident( + SketchLine_52.startPoint(), SketchLine_55.endPoint() +) 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&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][ExtrusionCut_4_1/Modified_Face&Sketch_1/SketchLine_4]"), False) +SketchConstraintCoincidence_73 = Sketch_7.setCoincident( + SketchLine_56.startPoint(), SketchLine_52.result() +) +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][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) SketchLine_60 = Sketch_7.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintCoincidence_75 = Sketch_7.setCoincident(SketchLine_59.startPoint(), SketchLine_60.result()) -SketchConstraintCoincidence_76 = Sketch_7.setCoincident(SketchLine_59.endPoint(), SketchLine_58.result()) -SketchConstraintMiddle_3 = Sketch_7.setMiddlePoint(SketchLine_59.endPoint(), SketchLine_58.result()) +SketchConstraintCoincidence_75 = Sketch_7.setCoincident( + SketchLine_59.startPoint(), SketchLine_60.result() +) +SketchConstraintCoincidence_76 = Sketch_7.setCoincident( + SketchLine_59.endPoint(), SketchLine_58.result() +) +SketchConstraintMiddle_3 = Sketch_7.setMiddlePoint( + SketchLine_59.endPoint(), SketchLine_58.result() +) SketchConstraintVertical_17 = Sketch_7.setVertical(SketchLine_59.result()) -SketchConstraintMirror_1_objects = [SketchArc_15.results()[1], SketchLine_55.result(), SketchLine_54.result()] -SketchConstraintMirror_1 = Sketch_7.addMirror(SketchLine_56.result(), SketchConstraintMirror_1_objects) +SketchConstraintMirror_1_objects = [ + SketchArc_15.results()[1], + SketchLine_55.result(), + SketchLine_54.result(), +] +SketchConstraintMirror_1 = Sketch_7.addMirror( + SketchLine_56.result(), SketchConstraintMirror_1_objects +) [SketchArc_16, SketchLine_61, SketchLine_62] = SketchConstraintMirror_1.mirrored() -SketchConstraintMirror_2_objects = [SketchArc_15.results()[1], SketchLine_55.result(), SketchLine_54.result(), SketchArc_16.results()[1], SketchLine_62.result(), SketchLine_52.result()] -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() +SketchConstraintMirror_2_objects = [ + SketchArc_15.results()[1], + SketchLine_55.result(), + SketchLine_54.result(), + SketchArc_16.results()[1], + SketchLine_62.result(), + SketchLine_52.result(), +] +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/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")]) +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() -from GeomAPI import GeomAPI_Shape +from GeomAPI import GeomAPI_Shape model.testNbResults(Part_1, 1) model.testNbSubResults(Part_1, [0]) @@ -376,4 +1015,4 @@ model.testNbSubShapes(Part_1, GeomAPI_Shape.VERTEX, [628]) model.testResultsVolumes(Part_1, [13531.037990141923728515394]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.models/piece_12.py b/test.models/piece_12.py index 30781f93b..3dd7ebb31 100644 --- a/test.models/piece_12.py +++ b/test.models/piece_12.py @@ -56,27 +56,43 @@ model.addParameter(Part_1_doc, "coeff", "1") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) SketchCircle_1 = Sketch_1.addCircle(0, 0, 15) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchCircle_2 = Sketch_1.addCircle(80, 0, 15) SketchCircle_3 = Sketch_1.addCircle(0, 0, 12.5) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchCircle_3.center()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchCircle_3.center() +) SketchCircle_4 = Sketch_1.addCircle(80, 0, 14) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchCircle_4.center()) -SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_3.results()[1], "r_al1*coeff") -SketchConstraintRadius_2 = Sketch_1.setRadius(SketchCircle_4.results()[1], "r_al2*coeff") +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchCircle_2.center(), SketchCircle_4.center() +) +SketchConstraintRadius_1 = Sketch_1.setRadius( + SketchCircle_3.results()[1], "r_al1*coeff" +) +SketchConstraintRadius_2 = Sketch_1.setRadius( + SketchCircle_4.results()[1], "r_al2*coeff" +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchCircle_1.results()[1], "r4*coeff") SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], "r4*coeff") -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_3.center(), SketchCircle_4.center(), "entraxe*coeff") +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchCircle_3.center(), SketchCircle_4.center(), "entraxe*coeff" +) SketchArc_1 = Sketch_1.addArc(0, 0, 13.96424004376894, -17, 13.96424004376894, 17, True) SketchArc_1.setName("SketchArc_4") SketchArc_1.result().setName("SketchArc_4") SketchArc_1.results()[1].setName("SketchArc_4_2") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchCircle_3.center(), SketchArc_1.center()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchCircle_3.center(), SketchArc_1.center() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_7") SketchLine_1 = Sketch_1.addLine(13.96424004376894, 17, 66.03575995620928, 17) SketchLine_1.setName("SketchLine_6") SketchLine_1.result().setName("SketchLine_6") -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_1.startPoint() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_18") SketchLine_2 = Sketch_1.addLine(13.96424004376894, -17, 66.03575995623092, -17) SketchLine_2.setName("SketchLine_10") @@ -88,72 +104,124 @@ SketchConstraintHorizontal_2.setName("SketchConstraintHorizontal_6") SketchLine_3 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_3.setName("SketchLine_11") SketchLine_3.result().setName("SketchLine_11") -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_2.startPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_15") SketchConstraintRadius_5 = Sketch_1.setRadius(SketchArc_1.results()[1], "r2*coeff") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchArc_1.endPoint(), SketchLine_3.result(), "epaisseur/2*coeff") -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchArc_1.endPoint(), SketchLine_2.result(), "epaisseur*coeff") -SketchArc_2 = Sketch_1.addArc(80, 0, 66.03575995623092, -17, 66.03575995620928, 17, False) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchArc_2.center()) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchArc_1.endPoint(), SketchLine_3.result(), "epaisseur/2*coeff" +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchArc_1.endPoint(), SketchLine_2.result(), "epaisseur*coeff" +) +SketchArc_2 = Sketch_1.addArc( + 80, 0, 66.03575995623092, -17, 66.03575995620928, 17, False +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchCircle_2.center(), SketchArc_2.center() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8") -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_2.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchArc_2.startPoint() +) SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_9") -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_1.endPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_1.endPoint() +) SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10") -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchLine_3.result()) +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(0, 0, 15.46247221747307, -11.0413745939477, 18.89444362769119, -2, False) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchArc_1.results()[1], SketchArc_2.results()[1] +) +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 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_3.center() +) SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_54") -SketchArc_4 = Sketch_1.addArc(0, 0, 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") -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_4.center()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_4.center() +) SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_55") -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchArc_4.results()[1], SketchArc_3.results()[1]) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchArc_4.results()[1], SketchArc_3.results()[1] +) SketchConstraintEqual_2.setName("SketchConstraintEqual_8") -SketchArc_5 = Sketch_1.addArc(17.5, 12.49632352941176, 15.46247221747308, 11.04137459394768, 17.5, 15, True) +SketchArc_5 = Sketch_1.addArc( + 17.5, 12.49632352941176, 15.46247221747308, 11.04137459394768, 17.5, 15, True +) SketchArc_5.setName("SketchArc_9") SketchArc_5.result().setName("SketchArc_9") SketchArc_5.results()[1].setName("SketchArc_9_2") -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchArc_5.startPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchArc_5.startPoint() +) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_56") -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchArc_5.results()[1]) -SketchArc_6 = Sketch_1.addArc(17.5, -12.49632352941177, 15.46247221747307, -11.0413745939477, 17.5, -15, False) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchArc_5.results()[1] +) +SketchArc_6 = Sketch_1.addArc( + 17.5, -12.49632352941177, 15.46247221747307, -11.0413745939477, 17.5, -15, False +) SketchArc_6.setName("SketchArc_10") SketchArc_6.result().setName("SketchArc_10") SketchArc_6.results()[1].setName("SketchArc_10_2") -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchArc_6.startPoint()) +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]) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchArc_6.results()[1] +) 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()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchLine_4.startPoint() +) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_58") SketchLine_5 = Sketch_1.addLine(18.89444362769119, -2, 34.49444362769118, -2) SketchLine_5.setName("SketchLine_44") SketchLine_5.result().setName("SketchLine_44") -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchLine_5.startPoint() +) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_60") SketchLine_6 = Sketch_1.addLine(18.89444362769119, 2, 34.49444362769118, 2) SketchLine_6.setName("SketchLine_45") SketchLine_6.result().setName("SketchLine_45") -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchArc_4.startPoint(), SketchLine_6.startPoint() +) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_61") 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()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_7.startPoint() +) SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_62") -SketchConstraintEqual_3 = Sketch_1.setEqual(SketchArc_5.results()[1], SketchArc_6.results()[1]) +SketchConstraintEqual_3 = Sketch_1.setEqual( + SketchArc_5.results()[1], SketchArc_6.results()[1] +) SketchConstraintEqual_3.setName("SketchConstraintEqual_9") -SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_6.result()) +SketchConstraintEqual_4 = Sketch_1.setEqual( + SketchLine_5.result(), SketchLine_6.result() +) SketchConstraintEqual_4.setName("SketchConstraintEqual_11") SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintHorizontal_3.setName("SketchConstraintHorizontal_12") @@ -167,95 +235,165 @@ SketchLine_8 = Sketch_1.addLine(40, 17, 40, -17) SketchLine_8.setName("SketchLine_47") SketchLine_8.result().setName("SketchLine_47") SketchLine_8.setAuxiliary(True) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_8.startPoint(), SketchLine_1.result() +) SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_63") -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_2.result() +) SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_64") -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_8.startPoint(), SketchLine_1.result()) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchLine_8.startPoint(), SketchLine_1.result() +) SketchConstraintMiddle_1.setName("SketchConstraintMiddle_4") -SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint(SketchLine_8.endPoint(), SketchLine_2.result()) +SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint( + SketchLine_8.endPoint(), SketchLine_2.result() +) SketchConstraintMiddle_2.setName("SketchConstraintMiddle_5") SketchPoint_2 = Sketch_1.addPoint(40, 2.220450266386716e-15) SketchPoint_2.setName("SketchPoint_7") SketchPoint_2.result().setName("SketchPoint_7") -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_8.result()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_8.result() +) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_65") -SketchConstraintMiddle_3 = Sketch_1.setMiddlePoint(SketchLine_8.result(), SketchPoint_2.coordinates()) +SketchConstraintMiddle_3 = Sketch_1.setMiddlePoint( + SketchLine_8.result(), SketchPoint_2.coordinates() +) SketchConstraintMiddle_3.setName("SketchConstraintMiddle_6") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_3.result(), "2*coeff") +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_6.startPoint(), SketchLine_3.result(), "2*coeff" +) SketchConstraintDistance_4.setName("SketchConstraintDistance_17") -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchArc_3.endPoint(), SketchLine_3.result(), "2*coeff") +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchArc_3.endPoint(), SketchLine_3.result(), "2*coeff" +) SketchConstraintDistance_5.setName("SketchConstraintDistance_18") SketchConstraintRadius_6 = Sketch_1.setRadius(SketchArc_4.results()[1], "(r4+4)*coeff") SketchConstraintRadius_6.setName("SketchConstraintRadius_13") -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_4.endPoint(), SketchLine_8.result(), "2*coeff") +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_4.endPoint(), SketchLine_8.result(), "2*coeff" +) SketchConstraintDistance_6.setName("SketchConstraintDistance_19") 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") -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchArc_7.center()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchArc_7.center() +) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_66") -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchArc_7.startPoint()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchArc_7.startPoint() +) SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_67") -SketchArc_8 = Sketch_1.addArc(40, 0, 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") -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchArc_8.center()) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchArc_8.center() +) SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_68") -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchArc_8.startPoint()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchArc_8.startPoint() +) SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_69") -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_7.endPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchArc_7.endPoint(), SketchLine_7.endPoint() +) SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_72") -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchArc_5.endPoint(), SketchLine_1.result(), "2*coeff") +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchArc_5.endPoint(), SketchLine_1.result(), "2*coeff" +) SketchConstraintDistance_7.setName("SketchConstraintDistance_21") -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchLine_4.result()) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_5.results()[1], SketchLine_4.result() +) SketchCircle_5 = Sketch_1.addCircle(40, -13, 2.5) SketchCircle_5.setName("SketchCircle_11") SketchCircle_5.result().setName("SketchCircle_11") SketchCircle_5.results()[1].setName("SketchCircle_11_2") -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_8.result(), SketchCircle_5.center()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_8.result(), SketchCircle_5.center() +) SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_70") SketchConstraintRadius_7 = Sketch_1.setRadius(SketchCircle_5.results()[1], "2.5*coeff") SketchConstraintRadius_7.setName("SketchConstraintRadius_14") -SketchArc_9 = Sketch_1.addArc(40, -13, 35.51437699680511, -13.35942492012782, 37.95784774655168, -8.990060577298436, True) +SketchArc_9 = Sketch_1.addArc( + 40, + -13, + 35.51437699680511, + -13.35942492012782, + 37.95784774655168, + -8.990060577298436, + True, +) SketchArc_9.setName("SketchArc_13") SketchArc_9.result().setName("SketchArc_13") SketchArc_9.results()[1].setName("SketchArc_13_2") -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchCircle_5.center(), SketchArc_9.center()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchCircle_5.center(), SketchArc_9.center() +) SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_71") -SketchLine_9 = Sketch_1.addLine(37.95784774655168, -5.490060577298436, 37.95784774655168, -8.990060577298436) +SketchLine_9 = Sketch_1.addLine( + 37.95784774655168, -5.490060577298436, 37.95784774655168, -8.990060577298436 +) SketchLine_9.setName("SketchLine_48") SketchLine_9.result().setName("SketchLine_48") -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchArc_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_74") -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_9.endPoint(), SketchLine_9.endPoint()) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchArc_9.endPoint(), SketchLine_9.endPoint() +) SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_75") SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_9.result()) SketchConstraintVertical_2.setName("SketchConstraintVertical_8") SketchConstraintRadius_8 = Sketch_1.setRadius(SketchArc_9.results()[1], "(2.5+2)*coeff") SketchConstraintRadius_8.setName("SketchConstraintRadius_15") -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchCircle_5.center(), SketchLine_2.result(), "4*coeff") +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, -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 = Sketch_1.setCoincident( + SketchArc_6.endPoint(), SketchLine_10.startPoint() +) SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_73") -SketchArc_10 = Sketch_1.addArc(34, -13.48076923076937, 34, -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") -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_10.startPoint()) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchArc_10.startPoint() +) SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_76") -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_10.result(), SketchArc_10.results()[1]) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_9.results()[1], SketchArc_10.endPoint()) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchLine_10.result(), SketchArc_10.results()[1] +) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchArc_9.results()[1], SketchArc_10.endPoint() +) SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_77") -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_9.results()[1], SketchArc_10.results()[1]) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchArc_9.startPoint(), SketchArc_10.endPoint()) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchArc_9.results()[1], SketchArc_10.results()[1] +) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchArc_9.startPoint(), SketchArc_10.endPoint() +) SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_78") -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_10.endPoint(), SketchLine_2.result(), "2*coeff") +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_10.endPoint(), SketchLine_2.result(), "2*coeff" +) SketchConstraintDistance_9.setName("SketchConstraintDistance_20") SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_10.result()) SketchConstraintHorizontal_6.setName("SketchConstraintHorizontal_15") @@ -267,9 +405,13 @@ SketchLine_11 = Sketch_1.addLine(17.5, 15, 17.5, -15) SketchLine_11.setName("SketchLine_49") SketchLine_11.result().setName("SketchLine_49") SketchLine_11.setAuxiliary(True) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchLine_11.startPoint() +) SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_79") -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_11.endPoint()) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchArc_6.endPoint(), SketchLine_11.endPoint() +) SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_80") SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_11.result()) SketchConstraintVertical_3.setName("SketchConstraintVertical_9") @@ -277,9 +419,41 @@ SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_5.result(), "15.6*coeff SketchConstraintLength_3.setName("SketchConstraintLength_10") SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_9.result(), "3.5*coeff") SketchConstraintLength_4.setName("SketchConstraintLength_11") -SketchConstraintMirror_1_objects = [SketchLine_4.result(), SketchArc_5.results()[1], SketchArc_4.results()[1], SketchLine_6.result(), SketchArc_7.results()[1], SketchLine_7.result(), SketchLine_5.result(), SketchArc_8.results()[1], SketchLine_9.result(), SketchArc_9.results()[1], SketchArc_10.results()[1], SketchLine_10.result(), SketchArc_6.results()[1], SketchArc_3.results()[1]] -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_8.result(), SketchConstraintMirror_1_objects) -[SketchLine_12, SketchArc_11, SketchArc_12, SketchLine_13, SketchArc_13, SketchLine_14, SketchLine_15, SketchArc_14, SketchLine_16, SketchArc_15, SketchArc_16, SketchLine_17, SketchArc_17, SketchArc_18] = SketchConstraintMirror_1.mirrored() +SketchConstraintMirror_1_objects = [ + SketchLine_4.result(), + SketchArc_5.results()[1], + SketchArc_4.results()[1], + SketchLine_6.result(), + SketchArc_7.results()[1], + SketchLine_7.result(), + SketchLine_5.result(), + SketchArc_8.results()[1], + SketchLine_9.result(), + SketchArc_9.results()[1], + SketchArc_10.results()[1], + SketchLine_10.result(), + SketchArc_6.results()[1], + SketchArc_3.results()[1], +] +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_8.result(), SketchConstraintMirror_1_objects +) +[ + SketchLine_12, + SketchArc_11, + SketchArc_12, + SketchLine_13, + SketchArc_13, + SketchLine_14, + SketchLine_15, + SketchArc_14, + SketchLine_16, + SketchArc_15, + SketchArc_16, + SketchLine_17, + SketchArc_17, + SketchArc_18, +] = SketchConstraintMirror_1.mirrored() SketchArc_18.setName("SketchArc_22") SketchArc_18.result().setName("SketchArc_22") SketchArc_18.results()[1].setName("SketchArc_22_2") @@ -317,14 +491,29 @@ 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/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) +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")) +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/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") @@ -333,24 +522,75 @@ SketchCircle_8 = Sketch_2.addCircle(80, 0, 22) SketchCircle_8.setName("SketchCircle_7") SketchCircle_8.result().setName("SketchCircle_7") SketchCircle_8.results()[1].setName("SketchCircle_7_2") -SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchCircle_6.result(), SketchCircle_8.center()) +SketchConstraintCoincidence_37 = Sketch_2.setCoincident( + SketchCircle_6.result(), SketchCircle_8.center() +) SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_12") SketchConstraintRadius_9 = Sketch_2.setRadius(SketchCircle_8.results()[1], "r2*coeff") 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/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-SketchCircle_1_2f-SketchCircle_3_2r_wire")], 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/Face-SketchCircle_2_2f-SketchCircle_4_2r_wire")], 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) +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/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-SketchCircle_1_2f-SketchCircle_3_2r_wire")], + 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/Face-SketchCircle_2_2f-SketchCircle_4_2r_wire")], + 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&Sketch_1/SketchArc_4_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"), False) +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/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") @@ -365,17 +605,23 @@ SketchLine_21.result().setName("SketchLine_8") SketchLine_22 = Sketch_3.addLine(72.5, 0, 87.5, 0) SketchLine_22.setName("SketchLine_9") SketchLine_22.result().setName("SketchLine_9") -SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchLine_21.result()) +SketchConstraintCoincidence_38 = Sketch_3.setCoincident( + SketchLine_22.startPoint(), SketchLine_21.result() +) SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_13") SketchLine_23 = Sketch_3.addLine(87.5, 0, 87.5, -12) SketchLine_23.setName("SketchLine_12") SketchLine_23.result().setName("SketchLine_12") -SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) +SketchConstraintCoincidence_39 = Sketch_3.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.startPoint() +) SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_14") SketchLine_24 = Sketch_3.addLine(72.5, -12, 72.5, 0) SketchLine_24.setName("SketchLine_14") SketchLine_24.result().setName("SketchLine_14") -SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchLine_24.endPoint()) +SketchConstraintCoincidence_40 = Sketch_3.setCoincident( + SketchLine_22.startPoint(), SketchLine_24.endPoint() +) SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_19") SketchConstraintHorizontal_7 = Sketch_3.setHorizontal(SketchLine_22.result()) SketchConstraintHorizontal_7.setName("SketchConstraintHorizontal_4") @@ -383,7 +629,9 @@ SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_24.result()) SketchConstraintVertical_4.setName("SketchConstraintVertical_1") SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_23.result()) SketchConstraintVertical_5.setName("SketchConstraintVertical_2") -SketchConstraintEqual_5 = Sketch_3.setEqual(SketchLine_24.result(), SketchLine_23.result()) +SketchConstraintEqual_5 = Sketch_3.setEqual( + SketchLine_24.result(), SketchLine_23.result() +) SketchConstraintEqual_5.setName("SketchConstraintEqual_3") SketchConstraintLength_5 = Sketch_3.setLength(SketchLine_22.result(), "15*coeff") SketchConstraintLength_5.setName("SketchConstraintLength_1") @@ -393,13 +641,19 @@ SketchCircle_9 = Sketch_3.addCircle(80, -9, 4) SketchCircle_9.setName("SketchCircle_8") SketchCircle_9.result().setName("SketchCircle_8") SketchCircle_9.results()[1].setName("SketchCircle_8_2") -SketchConstraintDistance_10 = Sketch_3.setDistance(SketchCircle_9.center(), SketchLine_22.result(), "dtrou*coeff") +SketchConstraintDistance_10 = Sketch_3.setDistance( + SketchCircle_9.center(), SketchLine_22.result(), "dtrou*coeff" +) SketchConstraintDistance_10.setName("SketchConstraintDistance_5") SketchConstraintRadius_10 = Sketch_3.setRadius(SketchCircle_9.results()[1], "M8*coeff") SketchConstraintRadius_10.setName("SketchConstraintRadius_7") -SketchConstraintDistance_11 = Sketch_3.setDistance(SketchLine_20.result(), SketchLine_24.endPoint(), "(entraxe-15/2)*coeff") +SketchConstraintDistance_11 = Sketch_3.setDistance( + SketchLine_20.result(), SketchLine_24.endPoint(), "(entraxe-15/2)*coeff" +) SketchConstraintDistance_11.setName("SketchConstraintDistance_7") -SketchConstraintDistance_12 = Sketch_3.setDistance(SketchCircle_9.center(), SketchLine_24.result(), "15/2*coeff") +SketchConstraintDistance_12 = Sketch_3.setDistance( + SketchCircle_9.center(), SketchLine_24.result(), "15/2*coeff" +) SketchConstraintDistance_12.setName("SketchConstraintDistance_8") SketchLine_25 = Sketch_3.addLine(85, -17, 75, -17) SketchLine_25.setName("SketchLine_26") @@ -407,30 +661,75 @@ SketchLine_25.result().setName("SketchLine_26") SketchLine_26 = Sketch_3.addLine(75, -17, 72.5, -12) SketchLine_26.setName("SketchLine_27") SketchLine_26.result().setName("SketchLine_27") -SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_25.endPoint(), SketchLine_26.startPoint()) +SketchConstraintCoincidence_41 = Sketch_3.setCoincident( + SketchLine_25.endPoint(), SketchLine_26.startPoint() +) SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_31") -SketchConstraintCoincidence_42 = Sketch_3.setCoincident(SketchLine_24.startPoint(), SketchLine_26.endPoint()) +SketchConstraintCoincidence_42 = Sketch_3.setCoincident( + SketchLine_24.startPoint(), SketchLine_26.endPoint() +) SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_32") SketchLine_27 = Sketch_3.addLine(87.5, -12, 85, -17) SketchLine_27.setName("SketchLine_28") SketchLine_27.result().setName("SketchLine_28") -SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_27.startPoint()) +SketchConstraintCoincidence_43 = Sketch_3.setCoincident( + SketchLine_23.endPoint(), SketchLine_27.startPoint() +) SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_33") -SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchLine_25.startPoint(), SketchLine_27.endPoint()) +SketchConstraintCoincidence_44 = Sketch_3.setCoincident( + SketchLine_25.startPoint(), SketchLine_27.endPoint() +) SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_34") SketchConstraintHorizontal_8 = Sketch_3.setHorizontal(SketchLine_25.result()) SketchConstraintHorizontal_8.setName("SketchConstraintHorizontal_7") -SketchConstraintEqual_6 = Sketch_3.setEqual(SketchLine_27.result(), SketchLine_26.result()) +SketchConstraintEqual_6 = Sketch_3.setEqual( + SketchLine_27.result(), SketchLine_26.result() +) SketchConstraintEqual_6.setName("SketchConstraintEqual_7") -SketchConstraintDistance_13 = Sketch_3.setDistance(SketchLine_22.endPoint(), SketchLine_25.result(), "17*coeff") +SketchConstraintDistance_13 = Sketch_3.setDistance( + SketchLine_22.endPoint(), SketchLine_25.result(), "17*coeff" +) SketchConstraintDistance_13.setName("SketchConstraintDistance_11") -SketchConstraintDistance_14 = Sketch_3.setDistance(SketchLine_23.result(), SketchLine_25.startPoint(), "2.5*coeff") +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/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/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")]) +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/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")) SketchLine_28 = SketchProjection_7.createdFeature() @@ -443,44 +742,64 @@ SketchLine_29.result().setName("SketchLine_18") SketchLine_30 = Sketch_4.addLine(7.5, 0, -7.5, 0) SketchLine_30.setName("SketchLine_19") SketchLine_30.result().setName("SketchLine_19") -SketchConstraintCoincidence_45 = Sketch_4.setCoincident(SketchLine_30.startPoint(), SketchLine_29.result()) +SketchConstraintCoincidence_45 = Sketch_4.setCoincident( + SketchLine_30.startPoint(), SketchLine_29.result() +) SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_22") SketchLine_31 = Sketch_4.addLine(-7.5, 0, -7.5, -12) SketchLine_31.setName("SketchLine_20") SketchLine_31.result().setName("SketchLine_20") -SketchConstraintCoincidence_46 = Sketch_4.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_46 = Sketch_4.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_23") SketchLine_32 = Sketch_4.addLine(7.5, -12, 7.5, 0) SketchLine_32.setName("SketchLine_24") SketchLine_32.result().setName("SketchLine_24") -SketchConstraintCoincidence_47 = Sketch_4.setCoincident(SketchLine_30.startPoint(), SketchLine_32.endPoint()) +SketchConstraintCoincidence_47 = Sketch_4.setCoincident( + SketchLine_30.startPoint(), SketchLine_32.endPoint() +) SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_28") SketchConstraintVertical_6 = Sketch_4.setVertical(SketchLine_31.result()) SketchConstraintVertical_6.setName("SketchConstraintVertical_3") SketchConstraintVertical_7 = Sketch_4.setVertical(SketchLine_32.result()) SketchConstraintVertical_7.setName("SketchConstraintVertical_4") -SketchConstraintEqual_7 = Sketch_4.setEqual(SketchLine_31.result(), SketchLine_32.result()) +SketchConstraintEqual_7 = Sketch_4.setEqual( + SketchLine_31.result(), SketchLine_32.result() +) SketchConstraintEqual_7.setName("SketchConstraintEqual_5") -SketchConstraintMiddle_4 = Sketch_4.setMiddlePoint(SketchLine_30.result(), SketchAPI_Line(SketchLine_29).startPoint()) +SketchConstraintMiddle_4 = Sketch_4.setMiddlePoint( + SketchLine_30.result(), SketchAPI_Line(SketchLine_29).startPoint() +) SketchConstraintMiddle_4.setName("SketchConstraintMiddle_1") SketchLine_33 = Sketch_4.addLine(-7.5, -12, -5, -17) SketchLine_33.setName("SketchLine_21") SketchLine_33.result().setName("SketchLine_21") -SketchConstraintCoincidence_48 = Sketch_4.setCoincident(SketchLine_31.endPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_48 = Sketch_4.setCoincident( + SketchLine_31.endPoint(), SketchLine_33.startPoint() +) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_24") SketchLine_34 = Sketch_4.addLine(-5, -17, 5, -17) SketchLine_34.setName("SketchLine_22") SketchLine_34.result().setName("SketchLine_22") -SketchConstraintCoincidence_49 = Sketch_4.setCoincident(SketchLine_33.endPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_49 = Sketch_4.setCoincident( + SketchLine_33.endPoint(), SketchLine_34.startPoint() +) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_25") SketchLine_35 = Sketch_4.addLine(5, -17, 7.5, -12) SketchLine_35.setName("SketchLine_23") SketchLine_35.result().setName("SketchLine_23") -SketchConstraintCoincidence_50 = Sketch_4.setCoincident(SketchLine_34.endPoint(), SketchLine_35.startPoint()) +SketchConstraintCoincidence_50 = Sketch_4.setCoincident( + SketchLine_34.endPoint(), SketchLine_35.startPoint() +) SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_26") -SketchConstraintCoincidence_51 = Sketch_4.setCoincident(SketchLine_32.startPoint(), SketchLine_35.endPoint()) +SketchConstraintCoincidence_51 = Sketch_4.setCoincident( + SketchLine_32.startPoint(), SketchLine_35.endPoint() +) SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_27") -SketchConstraintEqual_8 = Sketch_4.setEqual(SketchLine_35.result(), SketchLine_33.result()) +SketchConstraintEqual_8 = Sketch_4.setEqual( + SketchLine_35.result(), SketchLine_33.result() +) SketchConstraintEqual_8.setName("SketchConstraintEqual_6") SketchConstraintHorizontal_10 = Sketch_4.setHorizontal(SketchLine_34.result()) SketchConstraintHorizontal_10.setName("SketchConstraintHorizontal_8") @@ -488,7 +807,9 @@ SketchConstraintLength_7 = Sketch_4.setLength(SketchLine_30.result(), "15*coeff" SketchConstraintLength_7.setName("SketchConstraintLength_4") SketchConstraintLength_8 = Sketch_4.setLength(SketchLine_31.result(), "12*coeff") SketchConstraintLength_8.setName("SketchConstraintLength_5") -SketchConstraintDistance_15 = Sketch_4.setDistance(SketchLine_30.result(), SketchLine_34.endPoint(), "17*coeff") +SketchConstraintDistance_15 = Sketch_4.setDistance( + SketchLine_30.result(), SketchLine_34.endPoint(), "17*coeff" +) SketchConstraintDistance_15.setName("SketchConstraintDistance_9") SketchConstraintLength_9 = Sketch_4.setLength(SketchLine_34.result(), "10*coeff") SketchConstraintLength_9.setName("SketchConstraintLength_6") @@ -502,22 +823,62 @@ SketchLine_36 = Sketch_4.addLine(0, 0, 0, -12.97564207914519) SketchLine_36.setName("SketchLine_25") SketchLine_36.result().setName("SketchLine_25") SketchLine_36.setAuxiliary(True) -SketchConstraintCoincidence_52 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_28).startPoint(), SketchLine_36.startPoint()) +SketchConstraintCoincidence_52 = Sketch_4.setCoincident( + SketchAPI_Line(SketchLine_28).startPoint(), SketchLine_36.startPoint() +) SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_29") SketchConstraintVertical_8 = Sketch_4.setVertical(SketchLine_36.result()) SketchConstraintVertical_8.setName("SketchConstraintVertical_5") -SketchConstraintCoincidence_53 = Sketch_4.setCoincident(SketchCircle_10.center(), SketchLine_36.result()) +SketchConstraintCoincidence_53 = Sketch_4.setCoincident( + SketchCircle_10.center(), SketchLine_36.result() +) SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_30") -SketchConstraintDistance_16 = Sketch_4.setDistance(SketchCircle_10.center(), SketchLine_30.result(), "dtrou*coeff") +SketchConstraintDistance_16 = Sketch_4.setDistance( + SketchCircle_10.center(), SketchLine_30.result(), "dtrou*coeff" +) 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/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&Extrusion_1_1/From_Face")) +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&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") @@ -534,53 +895,92 @@ SketchConstraintHorizontal_12.setName("SketchConstraintHorizontal_11") SketchLine_39 = Sketch_5.addLine(model.selection("EDGE", "PartSet/OX")) 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 = Sketch_5.setDistance( + SketchLine_37.result(), SketchLine_38.startPoint(), "epaisseur*coeff" +) SketchConstraintDistance_17.setName("SketchConstraintDistance_13") 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") -SketchConstraintCoincidence_54 = Sketch_5.setCoincident(SketchPoint_3.coordinates(), SketchArc_19.center()) +SketchConstraintCoincidence_54 = Sketch_5.setCoincident( + SketchPoint_3.coordinates(), SketchArc_19.center() +) SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_36") -SketchConstraintCoincidence_55 = Sketch_5.setCoincident(SketchLine_38.endPoint(), SketchArc_19.startPoint()) +SketchConstraintCoincidence_55 = Sketch_5.setCoincident( + SketchLine_38.endPoint(), SketchArc_19.startPoint() +) SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_37") -SketchConstraintCoincidence_56 = Sketch_5.setCoincident(SketchLine_37.result(), SketchArc_19.endPoint()) +SketchConstraintCoincidence_56 = Sketch_5.setCoincident( + SketchLine_37.result(), SketchArc_19.endPoint() +) SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_39") SketchConstraintRadius_12 = Sketch_5.setRadius(SketchArc_19.results()[1], "r2*coeff") SketchConstraintRadius_12.setName("SketchConstraintRadius_11") SketchLine_40 = Sketch_5.addLine(-32, -17, -32, 17) SketchLine_40.setName("SketchLine_32") SketchLine_40.result().setName("SketchLine_32") -SketchConstraintCoincidence_57 = Sketch_5.setCoincident(SketchLine_38.startPoint(), SketchLine_40.endPoint()) +SketchConstraintCoincidence_57 = Sketch_5.setCoincident( + SketchLine_38.startPoint(), SketchLine_40.endPoint() +) SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_35") -SketchConstraintCoincidence_58 = Sketch_5.setCoincident(SketchLine_40.startPoint(), SketchLine_37.endPoint()) +SketchConstraintCoincidence_58 = Sketch_5.setCoincident( + SketchLine_40.startPoint(), SketchLine_37.endPoint() +) SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_38") -SketchConstraintDistance_18 = Sketch_5.setDistance(SketchLine_40.result(), SketchArc_19.center(), "d1*coeff-entraxe*coeff") +SketchConstraintDistance_18 = Sketch_5.setDistance( + SketchLine_40.result(), SketchArc_19.center(), "d1*coeff-entraxe*coeff" +) SketchConstraintDistance_18.setName("SketchConstraintDistance_14") SketchConstraintVertical_9 = Sketch_5.setVertical(SketchLine_40.result()) SketchConstraintVertical_9.setName("SketchConstraintVertical_6") -SketchConstraintDistance_19 = Sketch_5.setDistance(SketchLine_37.result(), SketchArc_19.center(), "epaisseur/2*coeff") +SketchConstraintDistance_19 = Sketch_5.setDistance( + SketchLine_37.result(), SketchArc_19.center(), "epaisseur/2*coeff" +) SketchConstraintDistance_19.setName("SketchConstraintDistance_15") -SketchConstraintCoincidence_59 = Sketch_5.setCoincident(SketchArc_19.endPoint(), SketchLine_37.startPoint()) +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-SketchArc_5_2r-SketchLine_30r-SketchLine_32r-SketchLine_29r")], 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) -Sketch_6 = model.addSketch(Part_1_doc, GeomAPI_Ax3(Sketch_6_origin, Sketch_6_dirx, Sketch_6_norm)) +Sketch_6 = model.addSketch( + Part_1_doc, GeomAPI_Ax3(Sketch_6_origin, Sketch_6_dirx, Sketch_6_norm) +) 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/SketchLine_29_EndVertex")) +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 = Sketch_6.setCoincident( + SketchLine_41.startPoint(), SketchPoint_4.result() +) SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_41") -SketchPoint_5 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/SketchLine_30_StartVertex")) +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 = Sketch_6.setCoincident( + SketchLine_41.endPoint(), SketchPoint_5.result() +) SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_42") SketchPoint_6 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/SketchPoint_2")) SketchPoint_6.setName("SketchPoint_5") @@ -591,122 +991,249 @@ SketchLine_42.result().setName("SketchLine_34") 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) +SketchArc_20 = Sketch_6.addArc( + 0, 0, -20.32855135026245, 17, -20.32855135026245, -17, False +) SketchArc_20.setName("SketchArc_6") SketchArc_20.result().setName("SketchArc_6") SketchArc_20.results()[1].setName("SketchArc_6_2") -SketchConstraintCoincidence_62 = Sketch_6.setCoincident(SketchPoint_6.result(), SketchArc_20.center()) +SketchConstraintCoincidence_62 = Sketch_6.setCoincident( + SketchPoint_6.result(), SketchArc_20.center() +) SketchConstraintCoincidence_62.setName("SketchConstraintCoincidence_43") -SketchConstraintCoincidence_63 = Sketch_6.setCoincident(SketchLine_42.result(), SketchArc_20.startPoint()) +SketchConstraintCoincidence_63 = Sketch_6.setCoincident( + SketchLine_42.result(), SketchArc_20.startPoint() +) SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_44") -SketchConstraintCoincidence_64 = Sketch_6.setCoincident(SketchLine_43.result(), SketchArc_20.endPoint()) +SketchConstraintCoincidence_64 = Sketch_6.setCoincident( + SketchLine_43.result(), SketchArc_20.endPoint() +) SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_45") SketchLine_44 = Sketch_6.addLine(-20.32855135026245, -17, -32, -17) SketchLine_44.setName("SketchLine_36") SketchLine_44.result().setName("SketchLine_36") -SketchConstraintCoincidence_65 = Sketch_6.setCoincident(SketchArc_20.endPoint(), SketchLine_44.startPoint()) +SketchConstraintCoincidence_65 = Sketch_6.setCoincident( + SketchArc_20.endPoint(), SketchLine_44.startPoint() +) SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_46") -SketchConstraintCoincidence_66 = Sketch_6.setCoincident(SketchLine_41.startPoint(), SketchLine_44.endPoint()) +SketchConstraintCoincidence_66 = Sketch_6.setCoincident( + SketchLine_41.startPoint(), SketchLine_44.endPoint() +) SketchConstraintCoincidence_66.setName("SketchConstraintCoincidence_47") SketchLine_45 = Sketch_6.addLine(-20.32855135026245, 17, -32, 17) SketchLine_45.setName("SketchLine_37") SketchLine_45.result().setName("SketchLine_37") -SketchConstraintCoincidence_67 = Sketch_6.setCoincident(SketchArc_20.startPoint(), SketchLine_45.startPoint()) +SketchConstraintCoincidence_67 = Sketch_6.setCoincident( + SketchArc_20.startPoint(), SketchLine_45.startPoint() +) SketchConstraintCoincidence_67.setName("SketchConstraintCoincidence_48") -SketchConstraintCoincidence_68 = Sketch_6.setCoincident(SketchLine_41.endPoint(), SketchLine_45.endPoint()) +SketchConstraintCoincidence_68 = Sketch_6.setCoincident( + SketchLine_41.endPoint(), SketchLine_45.endPoint() +) 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_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")) +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&Sketch_6/SketchLine_33][Extrusion_6_1/To_Face]")) +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 = 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&Sketch_5/SketchLine_32][Extrusion_5_1/From_Face]")) +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()) +SketchConstraintCoincidence_70 = Sketch_7.setCoincident( + SketchLine_46.endPoint(), SketchLine_48.result() +) SketchConstraintCoincidence_70.setName("SketchConstraintCoincidence_51") -SketchConstraintMiddle_5 = Sketch_7.setMiddlePoint(SketchLine_46.startPoint(), SketchLine_47.result()) +SketchConstraintMiddle_5 = Sketch_7.setMiddlePoint( + SketchLine_46.startPoint(), SketchLine_47.result() +) SketchConstraintMiddle_5.setName("SketchConstraintMiddle_2") -SketchConstraintMiddle_6 = Sketch_7.setMiddlePoint(SketchLine_48.result(), SketchLine_46.endPoint()) +SketchConstraintMiddle_6 = Sketch_7.setMiddlePoint( + SketchLine_48.result(), SketchLine_46.endPoint() +) SketchConstraintMiddle_6.setName("SketchConstraintMiddle_3") SketchPoint_7 = Sketch_7.addPoint(17, -1.95597787542754e-16) SketchPoint_7.setName("SketchPoint_6") SketchPoint_7.result().setName("SketchPoint_6") -SketchConstraintCoincidence_71 = Sketch_7.setCoincident(SketchPoint_7.coordinates(), SketchLine_46.result()) +SketchConstraintCoincidence_71 = Sketch_7.setCoincident( + SketchPoint_7.coordinates(), SketchLine_46.result() +) SketchConstraintCoincidence_71.setName("SketchConstraintCoincidence_52") SketchProjection_9 = Sketch_7.addProjection(model.selection("EDGE", "PartSet/OZ")) SketchLine_49 = SketchProjection_9.createdFeature() SketchLine_49.setName("SketchLine_41") SketchLine_49.result().setName("SketchLine_41") -SketchConstraintDistance_20 = Sketch_7.setDistance(SketchLine_49.result(), SketchPoint_7.coordinates(), "(h_o-h_p)*coeff") +SketchConstraintDistance_20 = Sketch_7.setDistance( + SketchLine_49.result(), SketchPoint_7.coordinates(), "(h_o-h_p)*coeff" +) SketchConstraintDistance_20.setName("SketchConstraintDistance_16") SketchCircle_11 = Sketch_7.addCircle(17, -1.95597787542754e-16, 2.5) SketchCircle_11.setName("SketchCircle_10") SketchCircle_11.result().setName("SketchCircle_10") SketchCircle_11.results()[1].setName("SketchCircle_10_2") -SketchConstraintCoincidence_72 = Sketch_7.setCoincident(SketchPoint_7.coordinates(), SketchCircle_11.center()) +SketchConstraintCoincidence_72 = Sketch_7.setCoincident( + SketchPoint_7.coordinates(), SketchCircle_11.center() +) 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/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")) +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/Modified_Face&Sketch_6/SketchLine_33][Extrusion_6_1/To_Face]")) +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 = 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 = 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&Sketch_6/SketchLine_36][ExtrusionCut_9_1/Modified_Face&Sketch_6/SketchLine_33]")) +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, 33.9999999583228, -17, True) SketchArc_21.setName("SketchArc_23") SketchArc_21.result().setName("SketchArc_23") SketchArc_21.results()[1].setName("SketchArc_23_2") -SketchConstraintCoincidence_75 = Sketch_8.setCoincident(SketchLine_50.endPoint(), SketchArc_21.startPoint()) +SketchConstraintCoincidence_75 = Sketch_8.setCoincident( + SketchLine_50.endPoint(), SketchArc_21.startPoint() +) SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_83") -SketchConstraintTangent_6 = Sketch_8.setTangent(SketchLine_50.result(), SketchArc_21.results()[1]) -SketchConstraintCoincidence_76 = Sketch_8.setCoincident(SketchLine_52.result(), SketchArc_21.endPoint()) +SketchConstraintTangent_6 = Sketch_8.setTangent( + SketchLine_50.result(), SketchArc_21.results()[1] +) +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()) +SketchConstraintTangent_7 = Sketch_8.setTangent( + SketchArc_21.results()[1], SketchLine_52.result() +) 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()) +SketchConstraintCoincidence_77 = Sketch_8.setCoincident( + SketchArc_21.endPoint(), SketchLine_53.startPoint() +) SketchConstraintCoincidence_77.setName("SketchConstraintCoincidence_85") -SketchConstraintCoincidence_78 = Sketch_8.setCoincident(SketchLine_51.startPoint(), SketchLine_53.endPoint()) +SketchConstraintCoincidence_78 = Sketch_8.setCoincident( + SketchLine_51.startPoint(), SketchLine_53.endPoint() +) SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_86") SketchLine_54 = Sketch_8.addLine(37, -14, 37, -17) SketchLine_54.setName("SketchLine_60") SketchLine_54.result().setName("SketchLine_60") -SketchConstraintCoincidence_79 = Sketch_8.setCoincident(SketchLine_50.endPoint(), SketchLine_54.startPoint()) +SketchConstraintCoincidence_79 = Sketch_8.setCoincident( + SketchLine_50.endPoint(), SketchLine_54.startPoint() +) SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_87") -SketchConstraintCoincidence_80 = Sketch_8.setCoincident(SketchLine_51.startPoint(), SketchLine_54.endPoint()) +SketchConstraintCoincidence_80 = Sketch_8.setCoincident( + SketchLine_51.startPoint(), SketchLine_54.endPoint() +) 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/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()] -SketchConstraintMirror_2 = Sketch_8.addMirror(SketchLine_55.result(), SketchConstraintMirror_2_objects) +SketchConstraintMirror_2_objects = [ + SketchArc_21.results()[1], + SketchLine_54.result(), + SketchLine_53.result(), +] +SketchConstraintMirror_2 = Sketch_8.addMirror( + SketchLine_55.result(), SketchConstraintMirror_2_objects +) [SketchArc_22, SketchLine_56, SketchLine_57] = SketchConstraintMirror_2.mirrored() SketchLine_57.setName("SketchLine_63") SketchLine_57.result().setName("SketchLine_63") @@ -716,53 +1243,111 @@ 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-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")) +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&Sketch_5/SketchLine_32][Extrusion_5_1/Generated_Face&Sketch_5/SketchLine_29]")) +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 = 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 = 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&Sketch_5/SketchLine_29][Extrusion_5_1/From_Face]")) +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) SketchArc_23.setName("SketchArc_25") SketchArc_23.result().setName("SketchArc_25") SketchArc_23.results()[1].setName("SketchArc_25_2") -SketchConstraintCoincidence_83 = Sketch_9.setCoincident(SketchLine_58.startPoint(), SketchArc_23.startPoint()) +SketchConstraintCoincidence_83 = Sketch_9.setCoincident( + SketchLine_58.startPoint(), SketchArc_23.startPoint() +) SketchConstraintCoincidence_83.setName("SketchConstraintCoincidence_91") -SketchConstraintTangent_8 = Sketch_9.setTangent(SketchLine_58.result(), SketchArc_23.results()[1]) -SketchConstraintCoincidence_84 = Sketch_9.setCoincident(SketchLine_60.result(), SketchArc_23.endPoint()) +SketchConstraintTangent_8 = Sketch_9.setTangent( + SketchLine_58.result(), SketchArc_23.results()[1] +) +SketchConstraintCoincidence_84 = Sketch_9.setCoincident( + SketchLine_60.result(), SketchArc_23.endPoint() +) SketchConstraintCoincidence_84.setName("SketchConstraintCoincidence_92") -SketchConstraintTangent_9 = Sketch_9.setTangent(SketchArc_23.results()[1], SketchLine_60.result()) +SketchConstraintTangent_9 = Sketch_9.setTangent( + SketchArc_23.results()[1], SketchLine_60.result() +) SketchLine_61 = Sketch_9.addLine(-32, -19, -32, -22) SketchLine_61.setName("SketchLine_67") SketchLine_61.result().setName("SketchLine_67") -SketchConstraintCoincidence_85 = Sketch_9.setCoincident(SketchLine_58.startPoint(), SketchLine_61.startPoint()) +SketchConstraintCoincidence_85 = Sketch_9.setCoincident( + SketchLine_58.startPoint(), SketchLine_61.startPoint() +) SketchConstraintCoincidence_85.setName("SketchConstraintCoincidence_93") -SketchConstraintCoincidence_86 = Sketch_9.setCoincident(SketchLine_59.startPoint(), SketchLine_61.endPoint()) +SketchConstraintCoincidence_86 = Sketch_9.setCoincident( + SketchLine_59.startPoint(), SketchLine_61.endPoint() +) SketchConstraintCoincidence_86.setName("SketchConstraintCoincidence_94") SketchLine_62 = Sketch_9.addLine(-32, -22, -29.00002201340376, -22) SketchLine_62.setName("SketchLine_68") SketchLine_62.result().setName("SketchLine_68") -SketchConstraintCoincidence_87 = Sketch_9.setCoincident(SketchLine_59.startPoint(), SketchLine_62.startPoint()) +SketchConstraintCoincidence_87 = Sketch_9.setCoincident( + SketchLine_59.startPoint(), SketchLine_62.startPoint() +) SketchConstraintCoincidence_87.setName("SketchConstraintCoincidence_95") -SketchConstraintCoincidence_88 = Sketch_9.setCoincident(SketchArc_23.endPoint(), SketchLine_62.endPoint()) +SketchConstraintCoincidence_88 = Sketch_9.setCoincident( + SketchArc_23.endPoint(), SketchLine_62.endPoint() +) 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-SketchLine_67f-SketchLine_68f-SketchArc_25_2r")], 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 +from GeomAPI import GeomAPI_Shape model.testNbResults(Part_1, 1) model.testNbSubResults(Part_1, [0]) @@ -781,4 +1366,4 @@ model.do() model.testResultsVolumes(Part_1, [118190.673218984]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.models/plug.py b/test.models/plug.py index d7552f012..6b12c9e00 100644 --- a/test.models/plug.py +++ b/test.models/plug.py @@ -54,153 +54,331 @@ Param_SlotWidth = model.addParameter(Part_1_doc, "Slot_Width", "8") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 3, 0.5, 2.5) SketchLine_2 = Sketch_1.addLine(0.5, 2.5, 9.5, 2.5) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) SketchLine_3 = Sketch_1.addLine(9.5, 2.5, 9.5, 3.1) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.startPoint() +) SketchLine_4 = Sketch_1.addLine(9.5, 3.1, 24.86574363608673, 3.1) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchLine_5 = Sketch_1.addLine(24.86574363608673, 3.1, 26, 3.3) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchLine_5.startPoint() +) SketchLine_6 = Sketch_1.addLine(26, 3.3, 26, 5.5) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_5.endPoint(), SketchLine_6.startPoint() +) SketchLine_7 = Sketch_1.addLine(31, 10.5, 64, 10.5) SketchLine_8 = Sketch_1.addLine(64, 10.5, 64, 15) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchLine_8.startPoint() +) SketchLine_9 = Sketch_1.addLine(64, 15, 61, 15) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchLine_10 = Sketch_1.addLine(61, 15, 61, 12.75) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_9.endPoint(), SketchLine_10.startPoint() +) SketchLine_11 = Sketch_1.addLine(61, 12.75, 58, 12.75) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_11.startPoint() +) SketchLine_12 = Sketch_1.addLine(58, 12.75, 58, 14) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.startPoint() +) SketchLine_13 = Sketch_1.addLine(58, 14, 57, 15) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_12.endPoint(), SketchLine_13.startPoint() +) SketchLine_14 = Sketch_1.addLine(57, 15, 54, 15) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) SketchLine_15 = Sketch_1.addLine(54, 15, 52.5, 16.5) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchLine_14.endPoint(), SketchLine_15.startPoint() +) SketchLine_16 = Sketch_1.addLine(52.5, 16.5, 35, 16.5) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) SketchLine_17 = Sketch_1.addLine(35, 16.5, 34, 15.5) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchLine_16.endPoint(), SketchLine_17.startPoint() +) SketchLine_18 = Sketch_1.addLine(34, 15.5, 32, 15.5) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) SketchLine_19 = Sketch_1.addLine(32, 15.5, 32, 19) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) SketchLine_20 = Sketch_1.addLine(32, 19, 22.5, 19) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) SketchLine_21 = Sketch_1.addLine(22.5, 19, 22.5, 13) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_20.endPoint(), SketchLine_21.startPoint() +) SketchLine_22 = Sketch_1.addLine(22.5, 13, 22, 12.5) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_21.endPoint(), SketchLine_22.startPoint() +) SketchLine_23 = Sketch_1.addLine(22, 12.5, 22, 10) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.startPoint() +) SketchLine_24 = Sketch_1.addLine(22, 10, 20, 10) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_23.endPoint(), SketchLine_24.startPoint() +) SketchLine_25 = Sketch_1.addLine(20, 10, 20, 8.7) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint()) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchLine_24.endPoint(), SketchLine_25.startPoint() +) SketchLine_26 = Sketch_1.addLine(20, 8.7, 18.5, 8.7) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_26.startPoint()) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_25.endPoint(), SketchLine_26.startPoint() +) SketchLine_27 = Sketch_1.addLine(18.5, 8.7, 18.5, 10) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_26.endPoint(), SketchLine_27.startPoint()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_26.endPoint(), SketchLine_27.startPoint() +) SketchLine_28 = Sketch_1.addLine(18.5, 10, 10.5, 10) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchLine_27.endPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchLine_27.endPoint(), SketchLine_28.startPoint() +) SketchLine_29 = Sketch_1.addLine(10.5, 10, 10.5, 8.7) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_28.endPoint(), SketchLine_29.startPoint() +) SketchLine_30 = Sketch_1.addLine(10.5, 8.7, 9, 8.7) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchLine_29.endPoint(), SketchLine_30.startPoint()) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchLine_29.endPoint(), SketchLine_30.startPoint() +) SketchLine_31 = Sketch_1.addLine(9, 8.7, 9, 10) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) SketchLine_32 = Sketch_1.addLine(9, 10, 0.5, 10) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchLine_31.endPoint(), SketchLine_32.startPoint() +) SketchLine_33 = Sketch_1.addLine(0.5, 10, 0, 9.5) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchLine_32.endPoint(), SketchLine_33.startPoint() +) SketchLine_34 = Sketch_1.addLine(0, 9.5, 0, 3) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchLine_33.endPoint(), SketchLine_34.startPoint()) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_34.endPoint()) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchLine_33.endPoint(), SketchLine_34.startPoint() +) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchLine_34.endPoint() +) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) -SketchConstraintAngle_1 = Sketch_1.setAngleComplementary(SketchLine_4.result(), SketchLine_5.result(), 10) +SketchConstraintAngle_1 = Sketch_1.setAngleComplementary( + SketchLine_4.result(), SketchLine_5.result(), 10 +) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.endPoint(), "D2_in/2") +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.endPoint(), "D2_in/2" +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_16.result(), SketchLine_7.result()) -SketchConstraintAngle_2 = Sketch_1.setAngleComplementary(SketchLine_15.result(), SketchLine_16.result(), 45) -SketchConstraintAngle_3 = Sketch_1.setAngleComplementary(SketchLine_13.result(), SketchLine_14.result(), 45) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_16.result(), SketchLine_7.result() +) +SketchConstraintAngle_2 = Sketch_1.setAngleComplementary( + SketchLine_15.result(), SketchLine_16.result(), 45 +) +SketchConstraintAngle_3 = Sketch_1.setAngleComplementary( + SketchLine_13.result(), SketchLine_14.result(), 45 +) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_12.result()) SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_10.result()) SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_11.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_17.result(), SketchLine_15.result()) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_17.result(), SketchLine_15.result() +) SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_19.result()) SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_18.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_20.result(), SketchLine_7.result()) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_20.result(), SketchLine_7.result() +) SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_21.result()) SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_23.result()) SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_24.result()) -SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_28.result(), SketchLine_24.result()) -SketchConstraintCollinear_2 = Sketch_1.setCollinear(SketchLine_32.result(), SketchLine_28.result()) +SketchConstraintCollinear_1 = Sketch_1.setCollinear( + SketchLine_28.result(), SketchLine_24.result() +) +SketchConstraintCollinear_2 = Sketch_1.setCollinear( + SketchLine_32.result(), SketchLine_28.result() +) SketchConstraintVertical_9 = Sketch_1.setVertical(SketchLine_34.result()) SketchConstraintHorizontal_8 = Sketch_1.setHorizontal(SketchLine_30.result()) -SketchConstraintCollinear_3 = Sketch_1.setCollinear(SketchLine_26.result(), SketchLine_30.result()) +SketchConstraintCollinear_3 = Sketch_1.setCollinear( + SketchLine_26.result(), SketchLine_30.result() +) SketchConstraintVertical_10 = Sketch_1.setVertical(SketchLine_31.result()) SketchConstraintVertical_11 = Sketch_1.setVertical(SketchLine_29.result()) SketchConstraintVertical_12 = Sketch_1.setVertical(SketchLine_27.result()) SketchConstraintVertical_13 = Sketch_1.setVertical(SketchLine_25.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_24.result(), "D4_out/2", True) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_30.result(), "D4_out/2-Channel_Depth", True) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_34.endPoint(), SketchLine_1.endPoint(), "Chamfer") -SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchLine_1.endPoint(), SketchLine_1.startPoint(), "Chamfer") -SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_34.startPoint(), SketchLine_33.startPoint(), "Chamfer") -SketchConstraintDistanceVertical_3 = Sketch_1.setVerticalDistance(SketchLine_34.startPoint(), SketchLine_33.startPoint(), "Chamfer") -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), + SketchLine_24.result(), + "D4_out/2", + True, +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchAPI_Point(SketchPoint_1).coordinates(), + SketchLine_30.result(), + "D4_out/2-Channel_Depth", + True, +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchLine_34.endPoint(), SketchLine_1.endPoint(), "Chamfer" +) +SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance( + SketchLine_1.endPoint(), SketchLine_1.startPoint(), "Chamfer" +) +SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance( + SketchLine_34.startPoint(), SketchLine_33.startPoint(), "Chamfer" +) +SketchConstraintDistanceVertical_3 = Sketch_1.setVerticalDistance( + SketchLine_34.startPoint(), SketchLine_33.startPoint(), "Chamfer" +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_35 = SketchProjection_2.createdFeature() -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_35.result(), "D2_in/2+0.6", True) -SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance(SketchLine_3.endPoint(), SketchLine_5.endPoint(), "Depth/2") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_5.endPoint(), SketchLine_35.result(), "D2_in/2+0.8", True) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_3.endPoint(), SketchLine_35.result(), "D2_in/2+0.6", True +) +SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance( + SketchLine_3.endPoint(), SketchLine_5.endPoint(), "Depth/2" +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_5.endPoint(), SketchLine_35.result(), "D2_in/2+0.8", True +) SketchArc_1 = Sketch_1.addArc(31, 5.5, 31, 10.5, 26, 5.5, False) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_6.endPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_7.result()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_6.result()) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchLine_6.endPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchLine_7.result() +) +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) -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") -SketchConstraintDistanceVertical_4 = Sketch_1.setVerticalDistance(SketchLine_23.startPoint(), SketchLine_22.startPoint(), "Chamfer") -SketchConstraintDistanceHorizontal_6 = Sketch_1.setHorizontalDistance(SketchLine_15.startPoint(), SketchLine_8.endPoint(), 10) -SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_35.result(), "D3_out/2", True) -SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_11.startPoint(), SketchLine_35.result(), "(D3_out+D1_in)/4", True) -SketchConstraintDistanceHorizontal_7 = Sketch_1.setHorizontalDistance(SketchLine_10.startPoint(), SketchLine_8.endPoint(), 3) -SketchConstraintDistanceHorizontal_8 = Sketch_1.setHorizontalDistance(SketchLine_12.endPoint(), SketchLine_10.startPoint(), 3) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_30.result(), SketchLine_26.result()) +SketchConstraintDistance_5 = Sketch_1.setDistance( + SketchLine_7.endPoint(), SketchLine_35.result(), "D1_in/2", True +) +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" +) +SketchConstraintDistanceVertical_4 = Sketch_1.setVerticalDistance( + SketchLine_23.startPoint(), SketchLine_22.startPoint(), "Chamfer" +) +SketchConstraintDistanceHorizontal_6 = Sketch_1.setHorizontalDistance( + SketchLine_15.startPoint(), SketchLine_8.endPoint(), 10 +) +SketchConstraintDistance_6 = Sketch_1.setDistance( + SketchLine_8.endPoint(), SketchLine_35.result(), "D3_out/2", True +) +SketchConstraintDistance_7 = Sketch_1.setDistance( + SketchLine_11.startPoint(), SketchLine_35.result(), "(D3_out+D1_in)/4", True +) +SketchConstraintDistanceHorizontal_7 = Sketch_1.setHorizontalDistance( + SketchLine_10.startPoint(), SketchLine_8.endPoint(), 3 +) +SketchConstraintDistanceHorizontal_8 = Sketch_1.setHorizontalDistance( + SketchLine_12.endPoint(), SketchLine_10.startPoint(), 3 +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_30.result(), SketchLine_26.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_26.result(), "Channel_Width") -SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_28.result(), "Drill1Holder_Width") -SketchConstraintDistanceHorizontal_9 = Sketch_1.setHorizontalDistance(SketchArc_1.center(), SketchLine_7.endPoint(), "Depth") -SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_16.startPoint(), SketchLine_35.result(), "D2_out/2", True) -SketchConstraintDistanceHorizontal_10 = Sketch_1.setHorizontalDistance(SketchLine_20.startPoint(), SketchLine_8.endPoint(), "Width/2") -SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_17.endPoint(), SketchLine_35.result(), "D2_out/2-1", True) -SketchConstraintDistanceHorizontal_11 = Sketch_1.setHorizontalDistance(SketchLine_20.startPoint(), SketchLine_17.endPoint(), 2) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_35).startPoint(), SketchLine_34.result()) -SketchConstraintDistance_10 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_35).startPoint(), SketchLine_20.result(), "D1_out/2", True) +SketchConstraintLength_2 = Sketch_1.setLength( + SketchLine_28.result(), "Drill1Holder_Width" +) +SketchConstraintDistanceHorizontal_9 = Sketch_1.setHorizontalDistance( + SketchArc_1.center(), SketchLine_7.endPoint(), "Depth" +) +SketchConstraintDistance_8 = Sketch_1.setDistance( + SketchLine_16.startPoint(), SketchLine_35.result(), "D2_out/2", True +) +SketchConstraintDistanceHorizontal_10 = Sketch_1.setHorizontalDistance( + SketchLine_20.startPoint(), SketchLine_8.endPoint(), "Width/2" +) +SketchConstraintDistance_9 = Sketch_1.setDistance( + SketchLine_17.endPoint(), SketchLine_35.result(), "D2_out/2-1", True +) +SketchConstraintDistanceHorizontal_11 = Sketch_1.setHorizontalDistance( + SketchLine_20.startPoint(), SketchLine_17.endPoint(), 2 +) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchAPI_Line(SketchLine_35).startPoint(), SketchLine_34.result() +) +SketchConstraintDistance_10 = Sketch_1.setDistance( + SketchAPI_Line(SketchLine_35).startPoint(), SketchLine_20.result(), "D1_out/2", True +) SketchPoint_2 = Sketch_1.addPoint(14.5, 10) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_28.result()) -SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchPoint_2.coordinates(), SketchLine_28.result()) -SketchConstraintDistanceHorizontal_12 = Sketch_1.setHorizontalDistance(SketchPoint_2.coordinates(), SketchLine_24.startPoint(), "Drill1_Loc") -SketchConstraintDistanceHorizontal_13 = Sketch_1.setHorizontalDistance(SketchLine_34.startPoint(), SketchLine_9.startPoint(), "Width") -SketchConstraintDistanceHorizontal_14 = Sketch_1.setHorizontalDistance(SketchLine_14.startPoint(), SketchLine_12.endPoint(), 1) -SketchConstraintDistance_11 = Sketch_1.setDistance(SketchLine_23.startPoint(), SketchLine_35.result(), "(D4_out+D2_in)/2", True) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchPoint_2.coordinates(), SketchLine_28.result() +) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint( + SketchPoint_2.coordinates(), SketchLine_28.result() +) +SketchConstraintDistanceHorizontal_12 = Sketch_1.setHorizontalDistance( + SketchPoint_2.coordinates(), SketchLine_24.startPoint(), "Drill1_Loc" +) +SketchConstraintDistanceHorizontal_13 = Sketch_1.setHorizontalDistance( + SketchLine_34.startPoint(), SketchLine_9.startPoint(), "Width" +) +SketchConstraintDistanceHorizontal_14 = Sketch_1.setHorizontalDistance( + SketchLine_14.startPoint(), SketchLine_12.endPoint(), 1 +) +SketchConstraintDistance_11 = Sketch_1.setDistance( + SketchLine_23.startPoint(), SketchLine_35.result(), "(D4_out+D2_in)/2", True +) model.do() # check Sketch_1 model.checkSketch(Sketch_1, 0) -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "PartSet/OX"), 360, 0) +Revolution_1 = model.addRevolution( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection("EDGE", "PartSet/OX"), + 360, + 0, +) # check Revolution_1 model.testNbResults(Revolution_1, 1) model.testNbSubResults(Revolution_1, [0]) @@ -210,21 +388,47 @@ 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/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/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&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) +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") +SketchConstraintCoincidence_38 = Sketch_2.setCoincident( + SketchPoint_3.result(), SketchCircle_1.center() +) +SketchConstraintRadius_2 = Sketch_2.setRadius( + SketchCircle_1.results()[1], "Drill1_Radius" +) model.do() # check Sketch_2 model.checkSketch(Sketch_2, 0) -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")]) +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")], +) # check ExtrusionCut_1 model.testNbResults(ExtrusionCut_1, 1) model.testNbSubResults(ExtrusionCut_1, [0]) @@ -234,7 +438,16 @@ 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&Sketch_1/SketchLine_21][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20]")], "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]) @@ -244,7 +457,16 @@ 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&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") +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]) @@ -254,7 +476,11 @@ 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&Sketch_1/SketchLine_19")], "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]) @@ -264,7 +490,11 @@ 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&Sketch_1/SketchLine_11")], "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]) @@ -274,7 +504,11 @@ 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&Sketch_1/SketchLine_9")], "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]) @@ -284,41 +518,88 @@ model.testNbSubShapes(Fillet_5, GeomAPI_Shape.EDGE, [192]) model.testNbSubShapes(Fillet_5, GeomAPI_Shape.VERTEX, [384]) model.testResultsVolumes(Fillet_5, [28343.655816829603281803429126740]) -ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [], model.selection(), "D4_out/2", "D4_out/2", [model.selection("SOLID", "Fillet_5_1")]) +ExtrusionCut_2 = model.addExtrusionCut( + Part_1_doc, + [], + model.selection(), + "D4_out/2", + "D4_out/2", + [model.selection("SOLID", "Fillet_5_1")], +) Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchLine_37 = Sketch_3.addLine(9, -9.914857089637437, 9, -18) SketchLine_38 = Sketch_3.addLine(9, -18, 0.5, -18) -SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_37.endPoint(), SketchLine_38.startPoint()) +SketchConstraintCoincidence_39 = Sketch_3.setCoincident( + SketchLine_37.endPoint(), SketchLine_38.startPoint() +) SketchLine_39 = Sketch_3.addLine(0.5, -18, 0.5, -10) -SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_38.endPoint(), SketchLine_39.startPoint()) +SketchConstraintCoincidence_40 = Sketch_3.setCoincident( + SketchLine_38.endPoint(), SketchLine_39.startPoint() +) SketchLine_40 = Sketch_3.addLine(0.5, -10, 7.788407623149843, -8.714857089637437) -SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_39.endPoint(), SketchLine_40.startPoint()) -SketchLine_41 = Sketch_3.addLine(7.788407623149843, -8.714857089637437, 8, -9.914857089637437) -SketchConstraintCoincidence_42 = Sketch_3.setCoincident(SketchLine_40.endPoint(), SketchLine_41.startPoint()) +SketchConstraintCoincidence_41 = Sketch_3.setCoincident( + SketchLine_39.endPoint(), SketchLine_40.startPoint() +) +SketchLine_41 = Sketch_3.addLine( + 7.788407623149843, -8.714857089637437, 8, -9.914857089637437 +) +SketchConstraintCoincidence_42 = Sketch_3.setCoincident( + SketchLine_40.endPoint(), SketchLine_41.startPoint() +) SketchLine_42 = Sketch_3.addLine(8, -9.914857089637437, 9, -9.914857089637437) -SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchLine_41.endPoint(), SketchLine_42.startPoint()) -SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchLine_42.endPoint(), SketchLine_37.startPoint()) -SketchProjection_5 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchConstraintCoincidence_43 = Sketch_3.setCoincident( + SketchLine_41.endPoint(), SketchLine_42.startPoint() +) +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", "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_34][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_33])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_33][Fillet_2_1/MF:Fillet&Sketch_1/SketchLine_32])_Fillet_5_1"), False) +SketchProjection_6 = Sketch_3.addProjection( + model.selection( + "EDGE", + "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_34][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_33])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_33][Fillet_2_1/MF:Fillet&Sketch_1/SketchLine_32])_Fillet_5_1", + ), + False, +) SketchLine_44 = SketchProjection_6.createdFeature() -SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_32"), False) +SketchProjection_9 = Sketch_3.addProjection( + model.selection("EDGE", "Sketch_1/SketchLine_32"), False +) SketchLine_47 = SketchProjection_9.createdFeature() SketchConstraintVertical_14 = Sketch_3.setVertical(SketchLine_37.result()) SketchConstraintVertical_15 = Sketch_3.setVertical(SketchLine_39.result()) SketchConstraintHorizontal_9 = Sketch_3.setHorizontal(SketchLine_38.result()) SketchConstraintHorizontal_10 = Sketch_3.setHorizontal(SketchLine_42.result()) -SketchConstraintPerpendicular_2 = Sketch_3.setPerpendicular(SketchLine_40.result(), SketchLine_41.result()) -SketchConstraintDistanceVertical_5 = Sketch_3.setVerticalDistance(SketchLine_42.startPoint(), SketchLine_40.endPoint(), 1.2) -SketchConstraintMirror_1 = Sketch_3.addMirror(SketchLine_43.result(), [SketchLine_44.result(), SketchLine_47.result()]) +SketchConstraintPerpendicular_2 = Sketch_3.setPerpendicular( + SketchLine_40.result(), SketchLine_41.result() +) +SketchConstraintDistanceVertical_5 = Sketch_3.setVerticalDistance( + SketchLine_42.startPoint(), SketchLine_40.endPoint(), 1.2 +) +SketchConstraintMirror_1 = Sketch_3.addMirror( + SketchLine_43.result(), [SketchLine_44.result(), SketchLine_47.result()] +) [SketchLine_50, SketchLine_51] = SketchConstraintMirror_1.mirrored() SketchLine_50.setAuxiliary(True) SketchLine_51.setAuxiliary(True) -SketchConstraintCoincidence_45 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_51).startPoint(), SketchLine_37.result()) -SketchConstraintCoincidence_46 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_50).startPoint(), SketchLine_39.endPoint()) -SketchConstraintAngle_4 = Sketch_3.setAngle(SketchLine_51.result(), SketchLine_40.result(), 10) -SketchConstraintDistanceHorizontal_15 = Sketch_3.setHorizontalDistance(SketchAPI_Line(SketchLine_50).endPoint(), SketchLine_42.startPoint(), "Slot_Width") -SketchConstraintDistanceVertical_6 = Sketch_3.setVerticalDistance(SketchLine_39.startPoint(), SketchLine_39.endPoint(), 8) +SketchConstraintCoincidence_45 = Sketch_3.setCoincident( + SketchAPI_Line(SketchLine_51).startPoint(), SketchLine_37.result() +) +SketchConstraintCoincidence_46 = Sketch_3.setCoincident( + SketchAPI_Line(SketchLine_50).startPoint(), SketchLine_39.endPoint() +) +SketchConstraintAngle_4 = Sketch_3.setAngle( + SketchLine_51.result(), SketchLine_40.result(), 10 +) +SketchConstraintDistanceHorizontal_15 = Sketch_3.setHorizontalDistance( + SketchAPI_Line(SketchLine_50).endPoint(), SketchLine_42.startPoint(), "Slot_Width" +) +SketchConstraintDistanceVertical_6 = Sketch_3.setVerticalDistance( + SketchLine_39.startPoint(), SketchLine_39.endPoint(), 8 +) ExtrusionCut_2.setNestedSketch(Sketch_3) model.do() # check Sketch_3 @@ -336,51 +617,106 @@ Folder_1 = model.addFolder(Part_1_doc, Fillet_1, Fillet_5) Sketch_4 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchLine_52 = Sketch_4.addLine(28.5, -19.5, 28.5, 0) -SketchProjection_12 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchProjection_12 = Sketch_4.addProjection( + model.selection("EDGE", "PartSet/OX"), False +) SketchLine_53 = SketchProjection_12.createdFeature() -SketchConstraintCoincidence_47 = Sketch_4.setCoincident(SketchLine_52.endPoint(), SketchLine_53.result()) +SketchConstraintCoincidence_47 = Sketch_4.setCoincident( + SketchLine_52.endPoint(), SketchLine_53.result() +) SketchLine_54 = Sketch_4.addLine(28.5, 0, 29, 0) -SketchConstraintCoincidence_48 = Sketch_4.setCoincident(SketchLine_52.endPoint(), SketchLine_54.startPoint()) -SketchConstraintCoincidence_49 = Sketch_4.setCoincident(SketchLine_54.endPoint(), SketchLine_53.result()) +SketchConstraintCoincidence_48 = Sketch_4.setCoincident( + SketchLine_52.endPoint(), SketchLine_54.startPoint() +) +SketchConstraintCoincidence_49 = Sketch_4.setCoincident( + SketchLine_54.endPoint(), SketchLine_53.result() +) SketchLine_55 = Sketch_4.addLine(29, 0, 29, -11.5) -SketchConstraintCoincidence_50 = Sketch_4.setCoincident(SketchLine_54.endPoint(), SketchLine_55.startPoint()) +SketchConstraintCoincidence_50 = Sketch_4.setCoincident( + SketchLine_54.endPoint(), SketchLine_55.startPoint() +) SketchLine_56 = Sketch_4.addLine(28.5, -19.5, 30.4, -19.5) -SketchConstraintCoincidence_51 = Sketch_4.setCoincident(SketchLine_52.startPoint(), SketchLine_56.startPoint()) +SketchConstraintCoincidence_51 = Sketch_4.setCoincident( + SketchLine_52.startPoint(), SketchLine_56.startPoint() +) SketchLine_57 = Sketch_4.addLine(30.4, -19.5, 29.4, -18.5) -SketchConstraintCoincidence_52 = Sketch_4.setCoincident(SketchLine_56.endPoint(), SketchLine_57.startPoint()) +SketchConstraintCoincidence_52 = Sketch_4.setCoincident( + SketchLine_56.endPoint(), SketchLine_57.startPoint() +) SketchLine_58 = Sketch_4.addLine(29.4, -18.5, 29.4, -12.5) -SketchConstraintCoincidence_53 = Sketch_4.setCoincident(SketchLine_57.endPoint(), SketchLine_58.startPoint()) +SketchConstraintCoincidence_53 = Sketch_4.setCoincident( + SketchLine_57.endPoint(), SketchLine_58.startPoint() +) SketchArc_2 = Sketch_4.addArc(27.95, -12.5, 29.4, -12.5, 29, -11.5, False) -SketchConstraintCoincidence_54 = Sketch_4.setCoincident(SketchLine_58.endPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_55 = Sketch_4.setCoincident(SketchLine_55.endPoint(), SketchArc_2.endPoint()) +SketchConstraintCoincidence_54 = Sketch_4.setCoincident( + SketchLine_58.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_55 = Sketch_4.setCoincident( + SketchLine_55.endPoint(), SketchArc_2.endPoint() +) SketchConstraintVertical_16 = Sketch_4.setVertical(SketchLine_52.result()) SketchConstraintVertical_17 = Sketch_4.setVertical(SketchLine_55.result()) SketchConstraintVertical_18 = Sketch_4.setVertical(SketchLine_58.result()) SketchConstraintHorizontal_11 = Sketch_4.setHorizontal(SketchLine_56.result()) -SketchProjection_13 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_23_EndVertex"), 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/SketchLine_20"), False) +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/SketchLine_20"), False +) SketchLine_59 = SketchProjection_14.createdFeature() -SketchConstraintAngle_5 = Sketch_4.setAngle(SketchLine_57.result(), SketchLine_56.result(), 45) -SketchConstraintMirror_2 = Sketch_4.addMirror(SketchLine_53.result(), [SketchLine_59.result()]) +SketchConstraintAngle_5 = Sketch_4.setAngle( + SketchLine_57.result(), SketchLine_56.result(), 45 +) +SketchConstraintMirror_2 = Sketch_4.addMirror( + SketchLine_53.result(), [SketchLine_59.result()] +) [SketchLine_60] = SketchConstraintMirror_2.mirrored() SketchLine_60.setAuxiliary(True) -SketchConstraintDistance_12 = Sketch_4.setDistance(SketchArc_2.endPoint(), SketchLine_60.result(), "Drill2_DepthMax", True) -SketchConstraintDistance_13 = Sketch_4.setDistance(SketchLine_58.endPoint(), SketchLine_60.result(), "Drill2_DepthMin", True) -SketchConstraintDistance_14 = Sketch_4.setDistance(SketchLine_57.endPoint(), SketchLine_60.result(), 0.5, True) -SketchConstraintTangent_3 = Sketch_4.setTangent(SketchLine_58.result(), SketchArc_2.results()[1]) +SketchConstraintDistance_12 = Sketch_4.setDistance( + SketchArc_2.endPoint(), SketchLine_60.result(), "Drill2_DepthMax", True +) +SketchConstraintDistance_13 = Sketch_4.setDistance( + SketchLine_58.endPoint(), SketchLine_60.result(), "Drill2_DepthMin", True +) +SketchConstraintDistance_14 = Sketch_4.setDistance( + SketchLine_57.endPoint(), SketchLine_60.result(), 0.5, True +) +SketchConstraintTangent_3 = Sketch_4.setTangent( + SketchLine_58.result(), SketchArc_2.results()[1] +) SketchPoint_5 = Sketch_4.addPoint(29.9, -19) -SketchConstraintCoincidence_56 = Sketch_4.setCoincident(SketchPoint_5.coordinates(), SketchLine_60.result()) -SketchConstraintCoincidence_57 = Sketch_4.setCoincident(SketchPoint_5.coordinates(), SketchLine_57.result()) -SketchConstraintDistance_15 = Sketch_4.setDistance(SketchPoint_5.coordinates(), SketchLine_52.result(), "Drill2_Radius", True) -SketchConstraintDistanceVertical_7 = Sketch_4.setVerticalDistance(SketchLine_56.endPoint(), SketchPoint_5.coordinates(), 0.5) +SketchConstraintCoincidence_56 = Sketch_4.setCoincident( + SketchPoint_5.coordinates(), SketchLine_60.result() +) +SketchConstraintCoincidence_57 = Sketch_4.setCoincident( + SketchPoint_5.coordinates(), SketchLine_57.result() +) +SketchConstraintDistance_15 = Sketch_4.setDistance( + SketchPoint_5.coordinates(), SketchLine_52.result(), "Drill2_Radius", True +) +SketchConstraintDistanceVertical_7 = Sketch_4.setVerticalDistance( + SketchLine_56.endPoint(), SketchPoint_5.coordinates(), 0.5 +) model.do() # check Sketch_4 model.checkSketch(Sketch_4, 0) -RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection("EDGE", "Sketch_4/SketchLine_48"), 360, 0, [model.selection("SOLID", "ExtrusionCut_2_1")]) +RevolutionCut_1 = model.addRevolutionCut( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_4")], + model.selection("EDGE", "Sketch_4/SketchLine_48"), + 360, + 0, + [model.selection("SOLID", "ExtrusionCut_2_1")], +) # check RevolutionCut_1 model.testNbResults(RevolutionCut_1, 1) model.testNbSubResults(RevolutionCut_1, [0]) @@ -390,27 +726,54 @@ model.testNbSubShapes(RevolutionCut_1, GeomAPI_Shape.EDGE, [242]) model.testNbSubShapes(RevolutionCut_1, GeomAPI_Shape.VERTEX, [484]) model.testResultsVolumes(RevolutionCut_1, [28297.246041844206047244369983673]) -RevolutionCut_2 = model.addRevolutionCut(Part_1_doc, [], model.selection("EDGE", "PartSet/OX"), 360, 0, [model.selection("SOLID", "RevolutionCut_1_1")]) +RevolutionCut_2 = model.addRevolutionCut( + Part_1_doc, + [], + model.selection("EDGE", "PartSet/OX"), + 360, + 0, + [model.selection("SOLID", "RevolutionCut_1_1")], +) 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/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()) +SketchConstraintCoincidence_58 = Sketch_5.setCoincident( + SketchLine_61.startPoint(), SketchLine_62.result() +) +SketchConstraintCoincidence_59 = Sketch_5.setCoincident( + SketchAPI_Line(SketchLine_62).endPoint(), SketchLine_61.endPoint() +) SketchLine_63 = Sketch_5.addLine(64.25, 10.25, 64.25, 11.25) SketchLine_64 = Sketch_5.addLine(64.25, 11.25, 63.25, 10.25) -SketchConstraintCoincidence_60 = Sketch_5.setCoincident(SketchLine_63.endPoint(), SketchLine_64.startPoint()) +SketchConstraintCoincidence_60 = Sketch_5.setCoincident( + SketchLine_63.endPoint(), SketchLine_64.startPoint() +) SketchConstraintLength_3 = Sketch_5.setLength(SketchLine_61.result(), "Chamfer") -SketchConstraintCoincidence_61 = Sketch_5.setCoincident(SketchLine_61.startPoint(), SketchLine_64.result()) +SketchConstraintCoincidence_61 = Sketch_5.setCoincident( + SketchLine_61.startPoint(), SketchLine_64.result() +) SketchLine_65 = Sketch_5.addLine(63.25, 10.25, 64.25, 10.25) -SketchConstraintCoincidence_62 = Sketch_5.setCoincident(SketchLine_64.endPoint(), SketchLine_65.startPoint()) -SketchConstraintCoincidence_63 = Sketch_5.setCoincident(SketchLine_63.startPoint(), SketchLine_65.endPoint()) -SketchConstraintEqual_2 = Sketch_5.setEqual(SketchLine_65.result(), SketchLine_63.result()) +SketchConstraintCoincidence_62 = Sketch_5.setCoincident( + SketchLine_64.endPoint(), SketchLine_65.startPoint() +) +SketchConstraintCoincidence_63 = Sketch_5.setCoincident( + SketchLine_63.startPoint(), SketchLine_65.endPoint() +) +SketchConstraintEqual_2 = Sketch_5.setEqual( + SketchLine_65.result(), SketchLine_63.result() +) SketchConstraintVertical_19 = Sketch_5.setVertical(SketchLine_63.result()) SketchConstraintHorizontal_12 = Sketch_5.setHorizontal(SketchLine_65.result()) -SketchConstraintDistanceVertical_8 = Sketch_5.setVerticalDistance(SketchLine_65.startPoint(), SketchLine_61.startPoint(), "Chamfer/2") -SketchConstraintDistanceVertical_9 = Sketch_5.setVerticalDistance(SketchLine_61.startPoint(), SketchLine_63.endPoint(), "Chamfer*1.5") +SketchConstraintDistanceVertical_8 = Sketch_5.setVerticalDistance( + SketchLine_65.startPoint(), SketchLine_61.startPoint(), "Chamfer/2" +) +SketchConstraintDistanceVertical_9 = Sketch_5.setVerticalDistance( + SketchLine_61.startPoint(), SketchLine_63.endPoint(), "Chamfer*1.5" +) RevolutionCut_2.setNestedSketch(Sketch_5) model.do() # check Sketch_5 @@ -425,7 +788,10 @@ model.testNbSubShapes(RevolutionCut_2, GeomAPI_Shape.VERTEX, [492]) model.testResultsVolumes(RevolutionCut_2, [28288.868184623894194373860955238]) Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 0, False) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "RevolutionCut_2_1"), model.selection("FACE", "Plane_2")]) +Partition_1 = model.addPartition( + Part_1_doc, + [model.selection("SOLID", "RevolutionCut_2_1"), model.selection("FACE", "Plane_2")], +) # check Partition_1 model.testNbResults(Partition_1, 1) model.testNbSubResults(Partition_1, [2]) @@ -435,7 +801,9 @@ model.testNbSubShapes(Partition_1, GeomAPI_Shape.EDGE, [738]) model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [1476]) model.testResultsVolumes(Partition_1, [28288.886256640704232268035411835]) -Result = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPSOLID", "Partition_1_1")) +Result = model.addRemoveSubShapes( + Part_1_doc, model.selection("COMPSOLID", "Partition_1_1") +) Result.setSubShapesToRemove([model.selection("SOLID", "Partition_1_1_2")]) Result.result().setName("Plug") # check Remove_SubShapes_1 @@ -526,4 +894,4 @@ model.testResultsVolumes(Result, [23373.503259112552768783643841743]) model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.models/sprocket.py b/test.models/sprocket.py index 0d4056295..8792a40f2 100644 --- a/test.models/sprocket.py +++ b/test.models/sprocket.py @@ -48,63 +48,332 @@ model.addParameter(Part_1_doc, "angle_2", "21") Param_NB = model.addParameter(Part_1_doc, "NB", "6") Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 30) SketchCircle_1.setAuxiliary(True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "d") -SketchLine_1 = Sketch_1.addLine(-1.83495963955651, 27.43871212577585, -1.570078687288315, 29.95888604263722) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1]) -SketchLine_2 = Sketch_1.addLine(-1.570078687288315, 29.95888604263722, -0.7903152816259503, 31.99023916377664) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) -SketchLine_3 = Sketch_1.addLine(1.834959639556546, 27.43871212577585, 1.570078687288318, 29.95888604263721) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchCircle_1.results()[1]) -SketchLine_4 = Sketch_1.addLine(1.570078687288318, 29.95888604263721, 0.7903152816259467, 31.99023916377664) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_1 = Sketch_1.addLine( + -1.83495963955651, 27.43871212577585, -1.570078687288315, 29.95888604263722 +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchCircle_1.results()[1] +) +SketchLine_2 = Sketch_1.addLine( + -1.570078687288315, 29.95888604263722, -0.7903152816259503, 31.99023916377664 +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_2.startPoint() +) +SketchLine_3 = Sketch_1.addLine( + 1.834959639556546, 27.43871212577585, 1.570078687288318, 29.95888604263721 +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchCircle_1.results()[1] +) +SketchLine_4 = Sketch_1.addLine( + 1.570078687288318, 29.95888604263721, 0.7903152816259467, 31.99023916377664 +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_4.startPoint() +) SketchCircle_2 = Sketch_1.addCircle(0, 0, 27.5) SketchCircle_2.setAuxiliary(True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_2.center()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_2.results()[1]) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchCircle_2.results()[1]) -SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_4.result()) -SketchArc_1 = Sketch_1.addArc(0, 0, 0.7903152816259467, 31.99023916377664, -0.7903152816259503, 31.99023916377664, False) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_1.center()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.endPoint()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_2.center() +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchCircle_2.results()[1] +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchCircle_2.results()[1] +) +SketchConstraintEqual_1 = Sketch_1.setEqual( + SketchLine_2.result(), SketchLine_4.result() +) +SketchArc_1 = Sketch_1.addArc( + 0, + 0, + 0.7903152816259467, + 31.99023916377664, + -0.7903152816259503, + 31.99023916377664, + False, +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_1.center() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_4.endPoint(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchArc_1.endPoint() +) +SketchProjection_2 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OZ"), False +) SketchLine_5 = SketchProjection_2.createdFeature() -SketchConstraintAngle_1 = Sketch_1.setAngleComplementary(SketchLine_2.result(), SketchLine_5.result(), "angle_2") -SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_4.result(), "180+angle_1") -SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_1.result()) +SketchConstraintAngle_1 = Sketch_1.setAngleComplementary( + SketchLine_2.result(), SketchLine_5.result(), "angle_2" +) +SketchConstraintAngle_2 = Sketch_1.setAngle( + SketchLine_3.result(), SketchLine_4.result(), "180+angle_1" +) +SketchConstraintEqual_2 = Sketch_1.setEqual( + SketchLine_3.result(), SketchLine_1.result() +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_1.results()[1], "da") SketchConstraintRadius_3 = Sketch_1.setRadius(SketchCircle_2.results()[1], "df") SketchLine_6 = Sketch_1.addLine(1.570078687288318, 29.95888604263721, 0, 0) SketchLine_6.setAuxiliary(True) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_6.endPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_6.endPoint() +) SketchLine_7 = Sketch_1.addLine(-1.570078687288315, 29.95888604263722, 0, 0) SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_7.endPoint()) -SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_6.result(), SketchLine_5.result(), "angle_L/2") -SketchConstraintAngle_4 = Sketch_1.setAngle(SketchLine_5.result(), SketchLine_7.result(), "angle_L/2") -SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_3.result()], SketchAPI_Line(SketchLine_5).startPoint(), "360/Z", 2) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_1.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_7.endPoint() +) +SketchConstraintAngle_3 = Sketch_1.setAngle( + SketchLine_6.result(), SketchLine_5.result(), "angle_L/2" +) +SketchConstraintAngle_4 = Sketch_1.setAngle( + SketchLine_5.result(), SketchLine_7.result(), "angle_L/2" +) +SketchMultiRotation_1 = Sketch_1.addRotation( + [SketchLine_3.result()], SketchAPI_Line(SketchLine_5).startPoint(), "360/Z", 2 +) [SketchLine_8] = SketchMultiRotation_1.rotated() SketchLine_8.setAuxiliary(True) -SketchArc_2 = Sketch_1.addArc(0, 0, -1.83495963955651, 27.43871212577585, -3.909967663056207, 27.22061999429577, False) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_2.center()) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_2.startPoint()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_8.result(), SketchArc_2.endPoint()) -SketchProjection_3 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchArc_2 = Sketch_1.addArc( + 0, + 0, + -1.83495963955651, + 27.43871212577585, + -3.909967663056207, + 27.22061999429577, + False, +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_2.center() +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_2.startPoint() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_8.result(), SketchArc_2.endPoint() +) +SketchProjection_3 = Sketch_1.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_2 = SketchProjection_3.createdFeature() -SketchMultiRotation_2_objects = [SketchArc_2.results()[1], SketchLine_1.result(), SketchLine_2.result(), SketchArc_1.results()[1], SketchLine_4.result(), SketchLine_3.result()] -SketchMultiRotation_2 = Sketch_1.addRotation(SketchMultiRotation_2_objects, SketchAPI_Point(SketchPoint_2).coordinates(), "360/Z", "Z") -[SketchArc_3, SketchArc_4, SketchArc_5, SketchArc_6, SketchArc_7, SketchArc_8, SketchArc_9, SketchArc_10, SketchArc_11, SketchArc_12, SketchArc_13, SketchArc_14, SketchArc_15, SketchArc_16, SketchArc_17, SketchArc_18, SketchArc_19, SketchArc_20, SketchArc_21, SketchArc_22, SketchArc_23, SketchArc_24, SketchArc_25, SketchArc_26, SketchArc_27, SketchArc_28, SketchArc_29, SketchArc_30, SketchArc_31, SketchLine_9, SketchLine_10, SketchLine_11, SketchLine_12, SketchLine_13, SketchLine_14, SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18, SketchLine_19, SketchLine_20, SketchLine_21, SketchLine_22, SketchLine_23, SketchLine_24, SketchLine_25, SketchLine_26, SketchLine_27, SketchLine_28, SketchLine_29, SketchLine_30, SketchLine_31, SketchLine_32, SketchLine_33, SketchLine_34, SketchLine_35, SketchLine_36, SketchLine_37, SketchLine_38, SketchLine_39, SketchLine_40, SketchLine_41, SketchLine_42, SketchLine_43, SketchLine_44, SketchLine_45, SketchLine_46, SketchLine_47, SketchLine_48, SketchLine_49, SketchLine_50, SketchLine_51, SketchLine_52, SketchLine_53, SketchLine_54, SketchLine_55, SketchLine_56, SketchLine_57, SketchLine_58, SketchLine_59, SketchLine_60, SketchLine_61, SketchLine_62, SketchLine_63, SketchLine_64, SketchLine_65, SketchLine_66, SketchArc_32, SketchArc_33, SketchArc_34, SketchArc_35, SketchArc_36, SketchArc_37, SketchArc_38, SketchArc_39, SketchArc_40, SketchArc_41, SketchArc_42, SketchArc_43, SketchArc_44, SketchArc_45, SketchArc_46, SketchArc_47, SketchArc_48, SketchArc_49, SketchArc_50, SketchArc_51, SketchArc_52, SketchArc_53, SketchArc_54, SketchArc_55, SketchArc_56, SketchArc_57, SketchArc_58, SketchArc_59, SketchArc_60, SketchLine_67, SketchLine_68, SketchLine_69, SketchLine_70, SketchLine_71, SketchLine_72, SketchLine_73, SketchLine_74, SketchLine_75, SketchLine_76, SketchLine_77, SketchLine_78, SketchLine_79, SketchLine_80, SketchLine_81, SketchLine_82, SketchLine_83, SketchLine_84, SketchLine_85, SketchLine_86, SketchLine_87, SketchLine_88, SketchLine_89, SketchLine_90, SketchLine_91, SketchLine_92, SketchLine_93, SketchLine_94, SketchLine_95, SketchLine_96, SketchLine_97, SketchLine_98, SketchLine_99, SketchLine_100, SketchLine_101, SketchLine_102, SketchLine_103, SketchLine_104, SketchLine_105, SketchLine_106, SketchLine_107, SketchLine_108, SketchLine_109, SketchLine_110, SketchLine_111, SketchLine_112, SketchLine_113, SketchLine_114, SketchLine_115, SketchLine_116, SketchLine_117, SketchLine_118, SketchLine_119, SketchLine_120, SketchLine_121, SketchLine_122, SketchLine_123, SketchLine_124] = SketchMultiRotation_2.rotated() +SketchMultiRotation_2_objects = [ + SketchArc_2.results()[1], + SketchLine_1.result(), + SketchLine_2.result(), + SketchArc_1.results()[1], + SketchLine_4.result(), + SketchLine_3.result(), +] +SketchMultiRotation_2 = Sketch_1.addRotation( + SketchMultiRotation_2_objects, + SketchAPI_Point(SketchPoint_2).coordinates(), + "360/Z", + "Z", +) +[ + SketchArc_3, + SketchArc_4, + SketchArc_5, + SketchArc_6, + SketchArc_7, + SketchArc_8, + SketchArc_9, + SketchArc_10, + SketchArc_11, + SketchArc_12, + SketchArc_13, + SketchArc_14, + SketchArc_15, + SketchArc_16, + SketchArc_17, + SketchArc_18, + SketchArc_19, + SketchArc_20, + SketchArc_21, + SketchArc_22, + SketchArc_23, + SketchArc_24, + SketchArc_25, + SketchArc_26, + SketchArc_27, + SketchArc_28, + SketchArc_29, + SketchArc_30, + SketchArc_31, + SketchLine_9, + SketchLine_10, + SketchLine_11, + SketchLine_12, + SketchLine_13, + SketchLine_14, + SketchLine_15, + SketchLine_16, + SketchLine_17, + SketchLine_18, + SketchLine_19, + SketchLine_20, + SketchLine_21, + SketchLine_22, + SketchLine_23, + SketchLine_24, + SketchLine_25, + SketchLine_26, + SketchLine_27, + SketchLine_28, + SketchLine_29, + SketchLine_30, + SketchLine_31, + SketchLine_32, + SketchLine_33, + SketchLine_34, + SketchLine_35, + SketchLine_36, + SketchLine_37, + SketchLine_38, + SketchLine_39, + SketchLine_40, + SketchLine_41, + SketchLine_42, + SketchLine_43, + SketchLine_44, + SketchLine_45, + SketchLine_46, + SketchLine_47, + SketchLine_48, + SketchLine_49, + SketchLine_50, + SketchLine_51, + SketchLine_52, + SketchLine_53, + SketchLine_54, + SketchLine_55, + SketchLine_56, + SketchLine_57, + SketchLine_58, + SketchLine_59, + SketchLine_60, + SketchLine_61, + SketchLine_62, + SketchLine_63, + SketchLine_64, + SketchLine_65, + SketchLine_66, + SketchArc_32, + SketchArc_33, + SketchArc_34, + SketchArc_35, + SketchArc_36, + SketchArc_37, + SketchArc_38, + SketchArc_39, + SketchArc_40, + SketchArc_41, + SketchArc_42, + SketchArc_43, + SketchArc_44, + SketchArc_45, + SketchArc_46, + SketchArc_47, + SketchArc_48, + SketchArc_49, + SketchArc_50, + SketchArc_51, + SketchArc_52, + SketchArc_53, + SketchArc_54, + SketchArc_55, + SketchArc_56, + SketchArc_57, + SketchArc_58, + SketchArc_59, + SketchArc_60, + SketchLine_67, + SketchLine_68, + SketchLine_69, + SketchLine_70, + SketchLine_71, + SketchLine_72, + SketchLine_73, + SketchLine_74, + SketchLine_75, + SketchLine_76, + SketchLine_77, + SketchLine_78, + SketchLine_79, + SketchLine_80, + SketchLine_81, + SketchLine_82, + SketchLine_83, + SketchLine_84, + SketchLine_85, + SketchLine_86, + SketchLine_87, + SketchLine_88, + SketchLine_89, + SketchLine_90, + SketchLine_91, + SketchLine_92, + SketchLine_93, + SketchLine_94, + SketchLine_95, + SketchLine_96, + SketchLine_97, + SketchLine_98, + SketchLine_99, + SketchLine_100, + SketchLine_101, + SketchLine_102, + SketchLine_103, + SketchLine_104, + SketchLine_105, + SketchLine_106, + SketchLine_107, + SketchLine_108, + SketchLine_109, + SketchLine_110, + SketchLine_111, + SketchLine_112, + SketchLine_113, + SketchLine_114, + SketchLine_115, + SketchLine_116, + SketchLine_117, + SketchLine_118, + SketchLine_119, + SketchLine_120, + SketchLine_121, + SketchLine_122, + SketchLine_123, + SketchLine_124, +] = SketchMultiRotation_2.rotated() model.do() model.checkSketch(Sketch_1, 0) -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "e", 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "e", 0 +) model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [0]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [1]) @@ -119,82 +388,291 @@ SketchLine_125 = Sketch_2.addLine(0, 0, -24.375, 0) SketchLine_125.setAuxiliary(True) SketchLine_126 = Sketch_2.addLine(0, 0, -12.18750000000149, 21.10936921724762) SketchLine_126.setAuxiliary(True) -SketchLine_127 = Sketch_2.addLine(-5.267665072275066, 6.123863542435089, -11.74701189249443, 17.34642143491413) -SketchConstraintParallel_1 = Sketch_2.setParallel(SketchLine_127.result(), SketchLine_126.result()) +SketchLine_127 = Sketch_2.addLine( + -5.267665072275066, 6.123863542435089, -11.74701189249443, 17.34642143491413 +) +SketchConstraintParallel_1 = Sketch_2.setParallel( + SketchLine_127.result(), SketchLine_126.result() +) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_125.result()) -SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_125.startPoint(), SketchLine_126.startPoint()) -SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident( + SketchLine_125.startPoint(), SketchLine_126.startPoint() +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("VERTEX", "PartSet/Origin"), False +) SketchPoint_3 = SketchProjection_4.createdFeature() -SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_125.startPoint(), SketchAPI_Point(SketchPoint_3).coordinates()) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident( + SketchLine_125.startPoint(), SketchAPI_Point(SketchPoint_3).coordinates() +) SketchCircle_4 = Sketch_2.addCircle(0, 0, 7.5) SketchCircle_4.setAuxiliary(True) -SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchCircle_4.center()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident( + SketchCircle_3.center(), SketchCircle_4.center() +) SketchCircle_5 = Sketch_2.addCircle(0, 0, 24.375) SketchCircle_5.setAuxiliary(True) -SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchCircle_5.center()) -SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_126.endPoint(), SketchCircle_5.results()[1]) -SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_125.endPoint(), SketchCircle_5.results()[1]) -SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchAPI_Point(SketchPoint_3).coordinates()) -SketchArc_61 = Sketch_2.addArc(0, 0, -5.379258295557134, 5.22623958403169, -7.21568539381252, 2.045454545454545, False) -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchArc_61.center()) -SketchArc_62 = Sketch_2.addArc(0, 0, -16.35843380263332, 18.07048058367397, -23.82871214537519, 5.131578947350746, False) -SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchArc_62.center()) -SketchArc_63 = Sketch_2.addArc(-14.34508810384774, 15.8464214349141, -11.74701189249443, 17.34642143491413, -16.35843380263332, 18.07048058367397, False) -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchArc_63.startPoint(), SketchLine_127.endPoint()) -SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchArc_63.endPoint(), SketchArc_62.startPoint()) -SketchConstraintTangent_1 = Sketch_2.setTangent(SketchArc_63.results()[1], SketchLine_127.result()) -SketchConstraintTangent_2 = Sketch_2.setTangent(SketchArc_63.results()[1], SketchArc_62.results()[1]) -SketchArc_64 = Sketch_2.addArc(-5.917184125113392, 5.74886354243508, -5.379258295557134, 5.22623958403169, -5.267665072275066, 6.123863542435089, False) -SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchArc_64.startPoint(), SketchArc_61.startPoint()) -SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchArc_64.endPoint(), SketchLine_127.startPoint()) -SketchConstraintTangent_3 = Sketch_2.setTangent(SketchArc_64.results()[1], SketchArc_61.results()[1]) -SketchConstraintTangent_4 = Sketch_2.setTangent(SketchArc_64.results()[1], SketchLine_127.result()) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchCircle_5.center() +) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident( + SketchLine_126.endPoint(), SketchCircle_5.results()[1] +) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident( + SketchLine_125.endPoint(), SketchCircle_5.results()[1] +) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident( + SketchCircle_3.center(), SketchAPI_Point(SketchPoint_3).coordinates() +) +SketchArc_61 = Sketch_2.addArc( + 0, + 0, + -5.379258295557134, + 5.22623958403169, + -7.21568539381252, + 2.045454545454545, + False, +) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident( + SketchCircle_3.center(), SketchArc_61.center() +) +SketchArc_62 = Sketch_2.addArc( + 0, + 0, + -16.35843380263332, + 18.07048058367397, + -23.82871214537519, + 5.131578947350746, + False, +) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident( + SketchCircle_3.center(), SketchArc_62.center() +) +SketchArc_63 = Sketch_2.addArc( + -14.34508810384774, + 15.8464214349141, + -11.74701189249443, + 17.34642143491413, + -16.35843380263332, + 18.07048058367397, + False, +) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident( + SketchArc_63.startPoint(), SketchLine_127.endPoint() +) +SketchConstraintCoincidence_29 = Sketch_2.setCoincident( + SketchArc_63.endPoint(), SketchArc_62.startPoint() +) +SketchConstraintTangent_1 = Sketch_2.setTangent( + SketchArc_63.results()[1], SketchLine_127.result() +) +SketchConstraintTangent_2 = Sketch_2.setTangent( + SketchArc_63.results()[1], SketchArc_62.results()[1] +) +SketchArc_64 = Sketch_2.addArc( + -5.917184125113392, + 5.74886354243508, + -5.379258295557134, + 5.22623958403169, + -5.267665072275066, + 6.123863542435089, + False, +) +SketchConstraintCoincidence_30 = Sketch_2.setCoincident( + SketchArc_64.startPoint(), SketchArc_61.startPoint() +) +SketchConstraintCoincidence_31 = Sketch_2.setCoincident( + SketchArc_64.endPoint(), SketchLine_127.startPoint() +) +SketchConstraintTangent_3 = Sketch_2.setTangent( + SketchArc_64.results()[1], SketchArc_61.results()[1] +) +SketchConstraintTangent_4 = Sketch_2.setTangent( + SketchArc_64.results()[1], SketchLine_127.result() +) SketchLine_128 = Sketch_2.addLine(-20.8959475736328, 1.5, -7.937253933193772, 1.5) -SketchArc_65 = Sketch_2.addArc(-20.89594757363278, 4.500000000000018, -23.82871214537519, 5.131578947350746, -20.8959475736328, 1.5, False) -SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchArc_65.startPoint(), SketchArc_62.endPoint()) -SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchArc_65.endPoint(), SketchLine_128.startPoint()) -SketchConstraintTangent_5 = Sketch_2.setTangent(SketchArc_65.results()[1], SketchLine_128.result()) -SketchConstraintTangent_6 = Sketch_2.setTangent(SketchArc_65.results()[1], SketchArc_62.results()[1]) -SketchArc_66 = Sketch_2.addArc(-7.937253933193772, 2.25, -7.937253933193772, 1.5, -7.21568539381252, 2.045454545454545, False) -SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchArc_66.startPoint(), SketchLine_128.endPoint()) -SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchArc_66.endPoint(), SketchArc_61.endPoint()) -SketchConstraintTangent_7 = Sketch_2.setTangent(SketchArc_66.results()[1], SketchLine_128.result()) -SketchConstraintTangent_8 = Sketch_2.setTangent(SketchArc_66.results()[1], SketchArc_61.results()[1]) -SketchConstraintParallel_2 = Sketch_2.setParallel(SketchLine_128.result(), SketchLine_125.result()) +SketchArc_65 = Sketch_2.addArc( + -20.89594757363278, + 4.500000000000018, + -23.82871214537519, + 5.131578947350746, + -20.8959475736328, + 1.5, + False, +) +SketchConstraintCoincidence_32 = Sketch_2.setCoincident( + SketchArc_65.startPoint(), SketchArc_62.endPoint() +) +SketchConstraintCoincidence_33 = Sketch_2.setCoincident( + SketchArc_65.endPoint(), SketchLine_128.startPoint() +) +SketchConstraintTangent_5 = Sketch_2.setTangent( + SketchArc_65.results()[1], SketchLine_128.result() +) +SketchConstraintTangent_6 = Sketch_2.setTangent( + SketchArc_65.results()[1], SketchArc_62.results()[1] +) +SketchArc_66 = Sketch_2.addArc( + -7.937253933193772, + 2.25, + -7.937253933193772, + 1.5, + -7.21568539381252, + 2.045454545454545, + False, +) +SketchConstraintCoincidence_34 = Sketch_2.setCoincident( + SketchArc_66.startPoint(), SketchLine_128.endPoint() +) +SketchConstraintCoincidence_35 = Sketch_2.setCoincident( + SketchArc_66.endPoint(), SketchArc_61.endPoint() +) +SketchConstraintTangent_7 = Sketch_2.setTangent( + SketchArc_66.results()[1], SketchLine_128.result() +) +SketchConstraintTangent_8 = Sketch_2.setTangent( + SketchArc_66.results()[1], SketchArc_61.results()[1] +) +SketchConstraintParallel_2 = Sketch_2.setParallel( + SketchLine_128.result(), SketchLine_125.result() +) SketchConstraintRadius_4 = Sketch_2.setRadius(SketchCircle_3.results()[1], "R_1") SketchConstraintRadius_5 = Sketch_2.setRadius(SketchArc_61.results()[1], "r_1") -SketchConstraintEqual_3 = Sketch_2.setEqual(SketchArc_64.results()[1], SketchArc_66.results()[1]) -SketchConstraintEqual_4 = Sketch_2.setEqual(SketchArc_63.results()[1], SketchArc_65.results()[1]) +SketchConstraintEqual_3 = Sketch_2.setEqual( + SketchArc_64.results()[1], SketchArc_66.results()[1] +) +SketchConstraintEqual_4 = Sketch_2.setEqual( + SketchArc_63.results()[1], SketchArc_65.results()[1] +) SketchConstraintRadius_6 = Sketch_2.setRadius(SketchArc_64.results()[1], "r_3") SketchConstraintRadius_7 = Sketch_2.setRadius(SketchArc_63.results()[1], "r_2") -SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance(SketchArc_65.endPoint(), SketchLine_125.endPoint(), "ep") +SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance( + SketchArc_65.endPoint(), SketchLine_125.endPoint(), "ep" +) SketchConstraintRadius_8 = Sketch_2.setRadius(SketchArc_62.results()[1], "R") -SketchConstraintAngle_5 = Sketch_2.setAngle(SketchLine_126.result(), SketchLine_125.result(), "360/NB") +SketchConstraintAngle_5 = Sketch_2.setAngle( + SketchLine_126.result(), SketchLine_125.result(), "360/NB" +) SketchConstraintRadius_9 = Sketch_2.setRadius(SketchCircle_5.results()[1], "R") SketchConstraintRadius_10 = Sketch_2.setRadius(SketchCircle_4.results()[1], "r_1") -SketchConstraintDistance_1 = Sketch_2.setDistance(SketchLine_127.endPoint(), SketchLine_126.result(), "ep", True) -SketchMultiRotation_3_objects = [SketchArc_61.results()[1], SketchArc_64.results()[1], SketchLine_127.result(), SketchArc_63.results()[1], SketchArc_62.results()[1], SketchArc_65.results()[1], SketchLine_128.result(), SketchArc_66.results()[1]] -SketchMultiRotation_3 = Sketch_2.addRotation(SketchMultiRotation_3_objects, SketchCircle_5.center(), "360/NB", "NB") -[SketchArc_67, SketchArc_68, SketchArc_69, SketchArc_70, SketchArc_71, SketchArc_72, SketchArc_73, SketchArc_74, SketchArc_75, SketchArc_76, SketchLine_129, SketchLine_130, SketchLine_131, SketchLine_132, SketchLine_133, SketchArc_77, SketchArc_78, SketchArc_79, SketchArc_80, SketchArc_81, SketchArc_82, SketchArc_83, SketchArc_84, SketchArc_85, SketchArc_86, SketchArc_87, SketchArc_88, SketchArc_89, SketchArc_90, SketchArc_91, SketchLine_134, SketchLine_135, SketchLine_136, SketchLine_137, SketchLine_138, SketchArc_92, SketchArc_93, SketchArc_94, SketchArc_95, SketchArc_96] = SketchMultiRotation_3.rotated() +SketchConstraintDistance_1 = Sketch_2.setDistance( + SketchLine_127.endPoint(), SketchLine_126.result(), "ep", True +) +SketchMultiRotation_3_objects = [ + SketchArc_61.results()[1], + SketchArc_64.results()[1], + SketchLine_127.result(), + SketchArc_63.results()[1], + SketchArc_62.results()[1], + SketchArc_65.results()[1], + SketchLine_128.result(), + SketchArc_66.results()[1], +] +SketchMultiRotation_3 = Sketch_2.addRotation( + SketchMultiRotation_3_objects, SketchCircle_5.center(), "360/NB", "NB" +) +[ + SketchArc_67, + SketchArc_68, + SketchArc_69, + SketchArc_70, + SketchArc_71, + SketchArc_72, + SketchArc_73, + SketchArc_74, + SketchArc_75, + SketchArc_76, + SketchLine_129, + SketchLine_130, + SketchLine_131, + SketchLine_132, + SketchLine_133, + SketchArc_77, + SketchArc_78, + SketchArc_79, + SketchArc_80, + SketchArc_81, + SketchArc_82, + SketchArc_83, + SketchArc_84, + SketchArc_85, + SketchArc_86, + SketchArc_87, + SketchArc_88, + SketchArc_89, + SketchArc_90, + SketchArc_91, + SketchLine_134, + SketchLine_135, + SketchLine_136, + SketchLine_137, + SketchLine_138, + SketchArc_92, + SketchArc_93, + SketchArc_94, + SketchArc_95, + SketchArc_96, +] = SketchMultiRotation_3.rotated() model.do() model.checkSketch(Sketch_2, 0) -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 0, "e") +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 0, "e" +) model.testNbResults(Extrusion_2, 7) NB_SUBRES = 0 -model.testNbSubResults(Extrusion_2, [NB_SUBRES, NB_SUBRES, NB_SUBRES, NB_SUBRES, NB_SUBRES, NB_SUBRES, NB_SUBRES]) +model.testNbSubResults( + Extrusion_2, + [NB_SUBRES, NB_SUBRES, NB_SUBRES, NB_SUBRES, NB_SUBRES, NB_SUBRES, NB_SUBRES], +) NB_SUBSH = 1 -model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.SOLID, [NB_SUBSH, NB_SUBSH, NB_SUBSH, NB_SUBSH, NB_SUBSH, NB_SUBSH, NB_SUBSH]) +model.testNbSubShapes( + Extrusion_2, + GeomAPI_Shape.SOLID, + [NB_SUBSH, NB_SUBSH, NB_SUBSH, NB_SUBSH, NB_SUBSH, NB_SUBSH, NB_SUBSH], +) NB_F = [3, 10] -model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.FACE, [NB_F[0], NB_F[1], NB_F[1], NB_F[1], NB_F[1], NB_F[1], NB_F[1]]) +model.testNbSubShapes( + Extrusion_2, + GeomAPI_Shape.FACE, + [NB_F[0], NB_F[1], NB_F[1], NB_F[1], NB_F[1], NB_F[1], NB_F[1]], +) NB_E = [6, 48] -model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.EDGE, [NB_E[0], NB_E[1], NB_E[1], NB_E[1], NB_E[1], NB_E[1], NB_E[1]]) -model.testNbSubShapes(Extrusion_2, GeomAPI_Shape.VERTEX, [2*NB_E[0], 2*NB_E[1], 2*NB_E[1], 2*NB_E[1], 2*NB_E[1], 2*NB_E[1], 2*NB_E[1]]) +model.testNbSubShapes( + Extrusion_2, + GeomAPI_Shape.EDGE, + [NB_E[0], NB_E[1], NB_E[1], NB_E[1], NB_E[1], NB_E[1], NB_E[1]], +) +model.testNbSubShapes( + Extrusion_2, + GeomAPI_Shape.VERTEX, + [ + 2 * NB_E[0], + 2 * NB_E[1], + 2 * NB_E[1], + 2 * NB_E[1], + 2 * NB_E[1], + 2 * NB_E[1], + 2 * NB_E[1], + ], +) VOL = [238.564692131974851463382947259, 844.585236664367812409182079136] -model.testResultsVolumes(Extrusion_2, [VOL[0], VOL[1], VOL[1], VOL[1], VOL[1], VOL[1], VOL[1]]) +model.testResultsVolumes( + Extrusion_2, [VOL[0], VOL[1], VOL[1], VOL[1], VOL[1], VOL[1], VOL[1]] +) -Boolean_1_objects_2 = [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2"), model.selection("SOLID", "Extrusion_2_3"), model.selection("SOLID", "Extrusion_2_4"), model.selection("SOLID", "Extrusion_2_5"), model.selection("SOLID", "Extrusion_2_6"), model.selection("SOLID", "Extrusion_2_7")] -Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], Boolean_1_objects_2) +Boolean_1_objects_2 = [ + model.selection("SOLID", "Extrusion_2_1"), + model.selection("SOLID", "Extrusion_2_2"), + model.selection("SOLID", "Extrusion_2_3"), + model.selection("SOLID", "Extrusion_2_4"), + model.selection("SOLID", "Extrusion_2_5"), + model.selection("SOLID", "Extrusion_2_6"), + model.selection("SOLID", "Extrusion_2_7"), +] +Boolean_1 = model.addCut( + Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], Boolean_1_objects_2 +) model.do() model.testNbResults(Boolean_1, 1) model.testNbSubResults(Boolean_1, [0]) @@ -205,12 +683,14 @@ model.testNbSubShapes(Boolean_1, GeomAPI_Shape.VERTEX, [2748]) model.testResultsVolumes(Boolean_1, [5092.377854112805835029575973749]) # Change parameter 'Z' and check validity of result -Z_REF_DATA = [(20, 171, 1014, 2028, 1667.562983801989503263030201197), - (22, 183, 1086, 2172, 2160.297076967755856458097696304), - (25, 201, 1194, 2388, 3068.115476944114561774767935276), - (40, 291, 1734, 3468, 11471.942563079033789108507335186), - (34, 255, 1518, 3036, 7238.122819170104776276275515556), - (30, 231, 1374, 2748, 5092.377854112805835029575973749)] +Z_REF_DATA = [ + (20, 171, 1014, 2028, 1667.562983801989503263030201197), + (22, 183, 1086, 2172, 2160.297076967755856458097696304), + (25, 201, 1194, 2388, 3068.115476944114561774767935276), + (40, 291, 1734, 3468, 11471.942563079033789108507335186), + (34, 255, 1518, 3036, 7238.122819170104776276275515556), + (30, 231, 1374, 2748, 5092.377854112805835029575973749), +] for z in Z_REF_DATA: Param_Z.setValue(z[0]) model.do() @@ -226,9 +706,11 @@ for z in Z_REF_DATA: model.testResultsVolumes(Boolean_1, [z[4]]) # Change parameter 'm' and check validity of result -M_REF_DATA = [(1.5, 14094.989002197671652538701891899), - (1.2, 8007.778784522399291745387017727), - (1.0, 5092.377854113199646235443651676)] +M_REF_DATA = [ + (1.5, 14094.989002197671652538701891899), + (1.2, 8007.778784522399291745387017727), + (1.0, 5092.377854113199646235443651676), +] for m in M_REF_DATA: Param_m.setValue(m[0]) model.do() @@ -242,10 +724,12 @@ for m in M_REF_DATA: model.testResultsVolumes(Boolean_1, [m[1]]) # change parameter 'NB' and check validity of result -NB_REF_DATA = [(4, 215, 1278, 2556, 4669.256782562274565862026065588), - (8, 247, 1470, 2940, 5515.498925714943652565125375986), - (7, 239, 1422, 2844, 5303.938389925016963388770818710), - (6, 231, 1374, 2748, 5092.377854112805835029575973749)] +NB_REF_DATA = [ + (4, 215, 1278, 2556, 4669.256782562274565862026065588), + (8, 247, 1470, 2940, 5515.498925714943652565125375986), + (7, 239, 1422, 2844, 5303.938389925016963388770818710), + (6, 231, 1374, 2748, 5092.377854112805835029575973749), +] for n in NB_REF_DATA: Param_NB.setValue(n[0]) model.do() @@ -267,4 +751,4 @@ for n in NB_REF_DATA: model.end() -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.models/stair_with_cycle.py b/test.models/stair_with_cycle.py index 2b6d3058d..bf880e032 100644 --- a/test.models/stair_with_cycle.py +++ b/test.models/stair_with_cycle.py @@ -23,67 +23,142 @@ model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -h_marche=18 +h_marche = 18 model.addParameter(Part_1_doc, "h_marche", str(h_marche)) model.addParameter(Part_1_doc, "angle", "35") -nb_marches=25 -h_totale=nb_marches*(h_marche+1) +nb_marches = 25 +h_totale = nb_marches * (h_marche + 1) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchLine_1 = Sketch_1.addLine(13.86513942972648, 15.13114452817127, 113.484609238901, 23.84671880293715) +SketchLine_1 = Sketch_1.addLine( + 13.86513942972648, 15.13114452817127, 113.484609238901, 23.84671880293715 +) SketchLine_2 = Sketch_1.addLine(124.230417176185, 14, 124.230417176185, 0) SketchLine_3 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_3.result() +) SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_2") SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) -SketchArc_1 = Sketch_1.addArc(15.1889430421138, 0, 0, 0, 13.86513942972648, 15.13114452817127, True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.result(), SketchArc_1.center()) +SketchArc_1 = Sketch_1.addArc( + 15.1889430421138, 0, 0, 0, 13.86513942972648, 15.13114452817127, True +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_3.result(), SketchArc_1.center() +) SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3") -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchArc_1.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchLine_3.startPoint(), SketchArc_1.startPoint() +) SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_4") -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_1.startPoint(), SketchArc_1.endPoint() +) SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5") -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_1.result(), SketchArc_1.results()[1]) -SketchArc_2 = Sketch_1.addArc(114.3460855070856, 14, 124.230417176185, 14, 113.484609238901, 23.84671880293715, False) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_2.startPoint()) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_1.result(), SketchArc_1.results()[1] +) +SketchArc_2 = Sketch_1.addArc( + 114.3460855070856, + 14, + 124.230417176185, + 14, + 113.484609238901, + 23.84671880293715, + False, +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_2.startPoint() +) SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_6") -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_1.endPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_1.endPoint() +) SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7") -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_2.result()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_1.result()) -SketchConstraintMirror_1_objects = [SketchArc_1.results()[1], SketchLine_1.result(), SketchArc_2.results()[1], SketchLine_2.result()] -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_3.result(), SketchConstraintMirror_1_objects) -[SketchArc_3, SketchLine_4, SketchArc_4, SketchLine_5] = SketchConstraintMirror_1.mirrored() -SketchConstraintAngle_1 = Sketch_1.setAngleBackward(SketchLine_1.result(), SketchLine_3.result(), 5) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_2.result() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchLine_1.result() +) +SketchConstraintMirror_1_objects = [ + SketchArc_1.results()[1], + SketchLine_1.result(), + SketchArc_2.results()[1], + SketchLine_2.result(), +] +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_3.result(), SketchConstraintMirror_1_objects +) +[ + SketchArc_3, + SketchLine_4, + SketchArc_4, + SketchLine_5, +] = SketchConstraintMirror_1.mirrored() +SketchConstraintAngle_1 = Sketch_1.setAngleBackward( + SketchLine_1.result(), SketchLine_3.result(), 5 +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 100) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 14) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchArc_3_2f-SketchLine_4f-SketchArc_4_2f-SketchLine_5f-SketchLine_2r-SketchArc_2_2f-SketchLine_1r")], model.selection(), 5, 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_1/Face-SketchArc_1_2f-SketchArc_3_2f-SketchLine_4f-SketchArc_4_2f-SketchLine_5f-SketchLine_2r-SketchArc_2_2f-SketchLine_1r", + ) + ], + model.selection(), + 5, + 0, +) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchArc_1"), True) +SketchProjection_1 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchArc_1"), True +) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_2.addCircle(15.1889430421138, 0, 9.469961851384218) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident( + SketchPoint_1.result(), SketchCircle_1.center() +) SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8") model.do() # 1st step : -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], model.selection(), h_totale, 0) -Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2")) +Extrusion_2 = model.addExtrusion( + Part_1_doc, + [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], + model.selection(), + h_totale, + 0, +) +Axis_4 = model.addAxis( + Part_1_doc, + model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_1_2"), +) model.do() # Cycle : use previous step to get the next one, translated and rotated stairFeature = Extrusion_1 # 15 steps now to fille the whole cylinder, but it may be changed for step in range(nb_marches): - Translation = model.addTranslation(Part_1_doc, [stairFeature.result()], model.selection("EDGE", "PartSet/OZ"), "h_marche") - Recover = model.addRecover(Part_1_doc, Translation, [stairFeature.result()]) - Rotation = model.addRotation(Part_1_doc, [Translation.result()], model.selection("EDGE", "Axis_1"), "angle") - model.do() # next transaction - stairFeature = Rotation # store the next step feature to translate/rotate it in the next iteration + Translation = model.addTranslation( + Part_1_doc, + [stairFeature.result()], + model.selection("EDGE", "PartSet/OZ"), + "h_marche", + ) + Recover = model.addRecover(Part_1_doc, Translation, [stairFeature.result()]) + Rotation = model.addRotation( + Part_1_doc, [Translation.result()], model.selection("EDGE", "Axis_1"), "angle" + ) + model.do() # next transaction + stairFeature = Rotation # store the next step feature to translate/rotate it in the next iteration -#==================================================================================== +# ==================================================================================== model.end() -assert(Part_1_doc.size("Bodies") == nb_marches + 2) +assert Part_1_doc.size("Bodies") == nb_marches + 2 model.testResultsVolumes(stairFeature, [23382.6888388]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.models/visor_support.py b/test.models/visor_support.py index 5be3c90b9..d9982cfc8 100644 --- a/test.models/visor_support.py +++ b/test.models/visor_support.py @@ -34,116 +34,417 @@ model.addParameter(Part_1_doc, "chamfer", "0.8") model.addParameter(Part_1_doc, "thickness", "4") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_1 = Sketch_1.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_1 = SketchProjection_1.createdFeature() SketchArc_1 = Sketch_1.addArc(0, -145, 0, 30, 50, 22.70509831248424, True) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_1.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchAPI_Line(SketchLine_1).startPoint(), "size_y-35", True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_1.result(), SketchArc_1.startPoint() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_1.result() +) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchArc_1.center(), SketchAPI_Line(SketchLine_1).startPoint(), "size_y-35", True +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "size_y-5") -SketchArc_2 = Sketch_1.addArc(47.42857142857143, 14.08026468498505, 50, 22.70509831248424, 56.4024789026646, 13.39544014803082, True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1]) +SketchArc_2 = Sketch_1.addArc( + 47.42857142857143, + 14.08026468498505, + 50, + 22.70509831248424, + 56.4024789026646, + 13.39544014803082, + True, +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchArc_1.results()[1], SketchArc_2.results()[1] +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 9) -SketchArc_3 = Sketch_1.addArc(66.37348720721259, 12.63452399585945, 56.4024789026646, 13.39544014803082, 65.54400934016748, 2.668985050670266, False) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.startPoint()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1]) +SketchArc_3 = Sketch_1.addArc( + 66.37348720721259, + 12.63452399585945, + 56.4024789026646, + 13.39544014803082, + 65.54400934016748, + 2.668985050670266, + False, +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_3.startPoint() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_3.results()[1], 10) -SketchArc_4 = Sketch_1.addArc(64.79747925982687, -6.3, 65.54400934016748, 2.668985050670266, 73.72335126899428, -5.147260273972602, True) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchArc_4.startPoint()) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchArc_4.results()[1]) +SketchArc_4 = Sketch_1.addArc( + 64.79747925982687, + -6.3, + 65.54400934016748, + 2.668985050670266, + 73.72335126899428, + -5.147260273972602, + True, +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_3.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchArc_4.results()[1] +) SketchConstraintRadius_4 = Sketch_1.setRadius(SketchArc_4.results()[1], 9) -SketchArc_5 = Sketch_1.addArc(-80, -25, 73.72335126899428, -5.147260273972602, 28.47740289468357, -135.7142857142857, True) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchArc_5.startPoint()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchArc_5.results()[1]) +SketchArc_5 = Sketch_1.addArc( + -80, + -25, + 73.72335126899428, + -5.147260273972602, + 28.47740289468357, + -135.7142857142857, + True, +) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchArc_5.startPoint() +) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchArc_4.results()[1], SketchArc_5.results()[1] +) SketchConstraintRadius_5 = Sketch_1.setRadius(SketchArc_5.results()[1], "size_x+5") -SketchArc_6 = Sketch_1.addArc(32.67652816802617, -140, 28.47740289468357, -135.7142857142857, 36.96224245374191, -135.8008747266572, False) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchArc_6.startPoint()) -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchArc_6.results()[1]) +SketchArc_6 = Sketch_1.addArc( + 32.67652816802617, + -140, + 28.47740289468357, + -135.7142857142857, + 36.96224245374191, + -135.8008747266572, + False, +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchArc_6.startPoint() +) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchArc_5.results()[1], SketchArc_6.results()[1] +) SketchConstraintRadius_6 = Sketch_1.setRadius(SketchArc_6.results()[1], 6) -SketchArc_7 = Sketch_1.addArc(38.39081388227633, -134.4011663021575, 36.96224245374191, -135.8008747266572, 39.81938531083141, -133.0014578776889, True) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchArc_7.startPoint()) -SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_6.results()[1], SketchArc_7.results()[1]) +SketchArc_7 = Sketch_1.addArc( + 38.39081388227633, + -134.4011663021575, + 36.96224245374191, + -135.8008747266572, + 39.81938531083141, + -133.0014578776889, + True, +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchArc_6.endPoint(), SketchArc_7.startPoint() +) +SketchConstraintTangent_6 = Sketch_1.setTangent( + SketchArc_6.results()[1], SketchArc_7.results()[1] +) SketchConstraintRadius_7 = Sketch_1.setRadius(SketchArc_7.results()[1], "thickness/2") -SketchArc_8 = Sketch_1.addArc(32.67652816802617, -140, 39.81938531083141, -133.0014578776889, 25.67798604578851, -132.8571428571429, True) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_7.endPoint(), SketchArc_8.startPoint()) -SketchConstraintTangent_7 = Sketch_1.setTangent(SketchArc_7.results()[1], SketchArc_8.results()[1]) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_8.center(), SketchArc_6.center()) -SketchArc_9 = Sketch_1.addArc(-80, -25, 25.67798604578851, -132.8571428571429, 69.75629704269767, -5.659589041095889, False) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchArc_9.startPoint()) -SketchConstraintTangent_8 = Sketch_1.setTangent(SketchArc_8.results()[1], SketchArc_9.results()[1]) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_9.center(), SketchArc_5.center()) -SketchArc_10 = Sketch_1.addArc(64.79747925982687, -6.3, 69.75629704269767, -5.659589041095889, 65.21221819334943, -1.317230527405396, False) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_9.endPoint(), SketchArc_10.startPoint()) -SketchConstraintTangent_9 = Sketch_1.setTangent(SketchArc_9.results()[1], SketchArc_10.results()[1]) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_4.center(), SketchArc_10.center()) -SketchArc_11 = Sketch_1.addArc(66.37348720721259, 12.63452399585945, 65.21221819334943, -1.317230527405396, 52.41407558084543, 13.69980660889937, True) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_10.endPoint(), SketchArc_11.startPoint()) -SketchConstraintTangent_10 = Sketch_1.setTangent(SketchArc_10.results()[1], SketchArc_11.results()[1]) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_11.center(), SketchArc_3.center()) -SketchArc_12 = Sketch_1.addArc(47.42857142857143, 14.08026468498505, 52.41407558084543, 13.69980660889937, 52.31556879671711, 15.13726833859206, False) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_11.endPoint(), SketchArc_12.startPoint()) -SketchConstraintTangent_11 = Sketch_1.setTangent(SketchArc_11.results()[1], SketchArc_12.results()[1]) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_12.center(), SketchArc_2.center()) -SketchArc_13 = Sketch_1.addArc(51.92460900726545, 15.0527080463035, 52.31556879671711, 15.13726833859206, 51.52598744945789, 15.0858871609853, False) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchArc_12.endPoint(), SketchArc_13.startPoint()) -SketchConstraintTangent_12 = Sketch_1.setTangent(SketchArc_12.results()[1], SketchArc_13.results()[1]) +SketchArc_8 = Sketch_1.addArc( + 32.67652816802617, + -140, + 39.81938531083141, + -133.0014578776889, + 25.67798604578851, + -132.8571428571429, + True, +) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_7.endPoint(), SketchArc_8.startPoint() +) +SketchConstraintTangent_7 = Sketch_1.setTangent( + SketchArc_7.results()[1], SketchArc_8.results()[1] +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchArc_8.center(), SketchArc_6.center() +) +SketchArc_9 = Sketch_1.addArc( + -80, + -25, + 25.67798604578851, + -132.8571428571429, + 69.75629704269767, + -5.659589041095889, + False, +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_8.endPoint(), SketchArc_9.startPoint() +) +SketchConstraintTangent_8 = Sketch_1.setTangent( + SketchArc_8.results()[1], SketchArc_9.results()[1] +) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_9.center(), SketchArc_5.center() +) +SketchArc_10 = Sketch_1.addArc( + 64.79747925982687, + -6.3, + 69.75629704269767, + -5.659589041095889, + 65.21221819334943, + -1.317230527405396, + False, +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_9.endPoint(), SketchArc_10.startPoint() +) +SketchConstraintTangent_9 = Sketch_1.setTangent( + SketchArc_9.results()[1], SketchArc_10.results()[1] +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchArc_4.center(), SketchArc_10.center() +) +SketchArc_11 = Sketch_1.addArc( + 66.37348720721259, + 12.63452399585945, + 65.21221819334943, + -1.317230527405396, + 52.41407558084543, + 13.69980660889937, + True, +) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchArc_10.endPoint(), SketchArc_11.startPoint() +) +SketchConstraintTangent_10 = Sketch_1.setTangent( + SketchArc_10.results()[1], SketchArc_11.results()[1] +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchArc_11.center(), SketchArc_3.center() +) +SketchArc_12 = Sketch_1.addArc( + 47.42857142857143, + 14.08026468498505, + 52.41407558084543, + 13.69980660889937, + 52.31556879671711, + 15.13726833859206, + False, +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchArc_11.endPoint(), SketchArc_12.startPoint() +) +SketchConstraintTangent_11 = Sketch_1.setTangent( + SketchArc_11.results()[1], SketchArc_12.results()[1] +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchArc_12.center(), SketchArc_2.center() +) +SketchArc_13 = Sketch_1.addArc( + 51.92460900726545, + 15.0527080463035, + 52.31556879671711, + 15.13726833859206, + 51.52598744945789, + 15.0858871609853, + False, +) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchArc_12.endPoint(), SketchArc_13.startPoint() +) +SketchConstraintTangent_12 = Sketch_1.setTangent( + SketchArc_12.results()[1], SketchArc_13.results()[1] +) SketchConstraintRadius_8 = Sketch_1.setRadius(SketchArc_13.results()[1], 0.4) -SketchLine_2 = Sketch_1.addLine(51.52598744945789, 15.0858871609853, 50.80630122186367, 6.439410365943716) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchArc_13.endPoint(), SketchLine_2.startPoint()) -SketchConstraintTangent_13 = Sketch_1.setTangent(SketchLine_2.result(), SketchArc_13.results()[1]) -SketchArc_14 = Sketch_1.addArc(47.81663953830692, 6.68825372605725, 50.80630122186367, 6.439410365943716, 47.56779617819338, 3.698592042500495, True) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_14.startPoint()) -SketchConstraintTangent_14 = Sketch_1.setTangent(SketchLine_2.result(), SketchArc_14.results()[1]) +SketchLine_2 = Sketch_1.addLine( + 51.52598744945789, 15.0858871609853, 50.80630122186367, 6.439410365943716 +) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchArc_13.endPoint(), SketchLine_2.startPoint() +) +SketchConstraintTangent_13 = Sketch_1.setTangent( + SketchLine_2.result(), SketchArc_13.results()[1] +) +SketchArc_14 = Sketch_1.addArc( + 47.81663953830692, + 6.68825372605725, + 50.80630122186367, + 6.439410365943716, + 47.56779617819338, + 3.698592042500495, + True, +) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchArc_14.startPoint() +) +SketchConstraintTangent_14 = Sketch_1.setTangent( + SketchLine_2.result(), SketchArc_14.results()[1] +) SketchConstraintRadius_9 = Sketch_1.setRadius(SketchArc_14.results()[1], 3) -SketchArc_15 = Sketch_1.addArc(47.73369175160241, 5.691699831538332, 47.56779617819338, 3.698592042500495, 46.66684983267853, 4, True) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchArc_15.startPoint()) -SketchConstraintTangent_15 = Sketch_1.setTangent(SketchArc_14.results()[1], SketchArc_15.results()[1]) +SketchArc_15 = Sketch_1.addArc( + 47.73369175160241, + 5.691699831538332, + 47.56779617819338, + 3.698592042500495, + 46.66684983267853, + 4, + True, +) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchArc_14.endPoint(), SketchArc_15.startPoint() +) +SketchConstraintTangent_15 = Sketch_1.setTangent( + SketchArc_14.results()[1], SketchArc_15.results()[1] +) SketchConstraintRadius_10 = Sketch_1.setRadius(SketchArc_15.results()[1], 2) -SketchArc_16 = Sketch_1.addArc(0, -70, 46.66684983267853, 4, 0, 17.48596957973185, False) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchArc_15.endPoint(), SketchArc_16.startPoint()) -SketchConstraintTangent_16 = Sketch_1.setTangent(SketchArc_15.results()[1], SketchArc_16.results()[1]) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchArc_16.endPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchArc_16.center(), SketchLine_1.result()) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchArc_16.center(), SketchAPI_Line(SketchLine_1).startPoint(), "size_y/2-20", True) -SketchLine_3 = Sketch_1.addLine(64.79747925982687, -6.3, 66.37348720721259, 12.63452399585945) +SketchArc_16 = Sketch_1.addArc( + 0, -70, 46.66684983267853, 4, 0, 17.48596957973185, False +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchArc_15.endPoint(), SketchArc_16.startPoint() +) +SketchConstraintTangent_16 = Sketch_1.setTangent( + SketchArc_15.results()[1], SketchArc_16.results()[1] +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchArc_16.endPoint(), SketchLine_1.result() +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchArc_16.center(), SketchLine_1.result() +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchArc_16.center(), + SketchAPI_Line(SketchLine_1).startPoint(), + "size_y/2-20", + True, +) +SketchLine_3 = Sketch_1.addLine( + 64.79747925982687, -6.3, 66.37348720721259, 12.63452399585945 +) SketchLine_3.setAuxiliary(True) -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_4.center(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_3.endPoint()) -SketchLine_4 = Sketch_1.addLine(47.73369175160241, 5.691699831538332, 47.81663953830692, 6.68825372605725) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchArc_4.center(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchArc_3.center(), SketchLine_3.endPoint() +) +SketchLine_4 = Sketch_1.addLine( + 47.73369175160241, 5.691699831538332, 47.81663953830692, 6.68825372605725 +) SketchLine_4.setAuxiliary(True) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_15.center(), SketchLine_4.startPoint()) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchArc_14.center(), SketchLine_4.endPoint()) -SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_3.result()) -SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_4.result()) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_5.center(), SketchAPI_Line(SketchLine_1).startPoint(), "size_x/2+5") -SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchArc_5.center(), SketchAPI_Line(SketchLine_1).startPoint(), 25) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchArc_11.endPoint(), SketchLine_2.result(), 1, True) -SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchArc_8.center(), SketchAPI_Line(SketchLine_1).startPoint(), "size_y-40") -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchArc_1.endPoint(), SketchLine_1.result(), 50, True) -SketchLine_5 = Sketch_1.addLine(28.47740289468357, -135.7142857142857, 32.67652816802617, -140) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchArc_15.center(), SketchLine_4.startPoint() +) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchArc_14.center(), SketchLine_4.endPoint() +) +SketchConstraintParallel_1 = Sketch_1.setParallel( + SketchLine_2.result(), SketchLine_3.result() +) +SketchConstraintParallel_2 = Sketch_1.setParallel( + SketchLine_2.result(), SketchLine_4.result() +) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance( + SketchArc_5.center(), SketchAPI_Line(SketchLine_1).startPoint(), "size_x/2+5" +) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance( + SketchArc_5.center(), SketchAPI_Line(SketchLine_1).startPoint(), 25 +) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchArc_11.endPoint(), SketchLine_2.result(), 1, True +) +SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance( + SketchArc_8.center(), SketchAPI_Line(SketchLine_1).startPoint(), "size_y-40" +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchArc_1.endPoint(), SketchLine_1.result(), 50, True +) +SketchLine_5 = Sketch_1.addLine( + 28.47740289468357, -135.7142857142857, 32.67652816802617, -140 +) SketchLine_5.setAuxiliary(True) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_5.startPoint()) -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_6.center(), SketchLine_5.endPoint()) -SketchLine_6 = Sketch_1.addLine(32.67652816802617, -140, 36.96224245374191, -135.8008747266572) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchLine_5.startPoint() +) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchArc_6.center(), SketchLine_5.endPoint() +) +SketchLine_6 = Sketch_1.addLine( + 32.67652816802617, -140, 36.96224245374191, -135.8008747266572 +) SketchLine_6.setAuxiliary(True) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_6.center(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_6.endPoint()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_5.result(), SketchLine_6.result()) -SketchConstraintDistanceVertical_3 = Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchArc_16.startPoint(), 4) -SketchConstraintDistanceVertical_4 = Sketch_1.setVerticalDistance(SketchArc_4.center(), SketchAPI_Line(SketchLine_1).startPoint(), 6.3) -SketchConstraintMirror_1_objects = [SketchArc_1.results()[1], SketchArc_2.results()[1], SketchArc_3.results()[1], SketchArc_4.results()[1], SketchArc_5.results()[1], SketchArc_6.results()[1], SketchArc_7.results()[1], SketchArc_8.results()[1], SketchArc_9.results()[1], SketchArc_10.results()[1], SketchArc_11.results()[1], SketchArc_12.results()[1], SketchArc_13.results()[1], SketchLine_2.result(), SketchArc_14.results()[1], SketchArc_15.results()[1], SketchArc_16.results()[1]] -SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_1.result(), SketchConstraintMirror_1_objects) -[SketchArc_17, SketchArc_18, SketchArc_19, SketchArc_20, SketchArc_21, SketchArc_22, SketchArc_23, SketchArc_24, SketchArc_25, SketchArc_26, SketchArc_27, SketchArc_28, SketchArc_29, SketchLine_7, SketchArc_30, SketchArc_31, SketchArc_32] = SketchConstraintMirror_1.mirrored() +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchArc_6.center(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchArc_6.endPoint(), SketchLine_6.endPoint() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_5.result(), SketchLine_6.result() +) +SketchConstraintDistanceVertical_3 = Sketch_1.setVerticalDistance( + SketchAPI_Line(SketchLine_1).startPoint(), SketchArc_16.startPoint(), 4 +) +SketchConstraintDistanceVertical_4 = Sketch_1.setVerticalDistance( + SketchArc_4.center(), SketchAPI_Line(SketchLine_1).startPoint(), 6.3 +) +SketchConstraintMirror_1_objects = [ + SketchArc_1.results()[1], + SketchArc_2.results()[1], + SketchArc_3.results()[1], + SketchArc_4.results()[1], + SketchArc_5.results()[1], + SketchArc_6.results()[1], + SketchArc_7.results()[1], + SketchArc_8.results()[1], + SketchArc_9.results()[1], + SketchArc_10.results()[1], + SketchArc_11.results()[1], + SketchArc_12.results()[1], + SketchArc_13.results()[1], + SketchLine_2.result(), + SketchArc_14.results()[1], + SketchArc_15.results()[1], + SketchArc_16.results()[1], +] +SketchConstraintMirror_1 = Sketch_1.addMirror( + SketchLine_1.result(), SketchConstraintMirror_1_objects +) +[ + SketchArc_17, + SketchArc_18, + SketchArc_19, + SketchArc_20, + SketchArc_21, + SketchArc_22, + SketchArc_23, + SketchArc_24, + SketchArc_25, + SketchArc_26, + SketchArc_27, + SketchArc_28, + SketchArc_29, + SketchLine_7, + SketchArc_30, + SketchArc_31, + SketchArc_32, +] = SketchConstraintMirror_1.mirrored() SketchLine_8 = Sketch_1.addLine(0, -145, 31.89121696112821, 27.06960882369163) SketchLine_8.setName("SketchLine_43") SketchLine_8.result().setName("SketchLine_43") SketchLine_8.setAuxiliary(True) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchArc_1.results()[1]) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_8.result(), SketchLine_1.result(), 10.5, type = "Direct") +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_8.startPoint() +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchArc_1.results()[1] +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_8.result(), SketchLine_1.result(), 10.5, type="Direct" +) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "size_z", 0) +Extrusion_1 = model.addExtrusion( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_1")], + model.selection(), + "size_z", + 0, +) model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [0]) @@ -154,74 +455,185 @@ model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [408]) model.testResultsVolumes(Extrusion_1, [16403.0029]) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchProjection_2 = Sketch_2.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_9 = SketchProjection_2.createdFeature() SketchLine_9.setName("SketchLine_8") SketchLine_9.result().setName("SketchLine_8") SketchArc_33 = Sketch_2.addArc(0, -145, 0, 26, 48.1858267258401, 19.0704912613701, True) -SketchConstraintCoincidence_36 = Sketch_2.setCoincident(SketchLine_9.result(), SketchArc_33.startPoint()) -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchArc_1_2__cc"), False) +SketchConstraintCoincidence_36 = Sketch_2.setCoincident( + SketchLine_9.result(), SketchArc_33.startPoint() +) +SketchProjection_3 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchArc_1_2__cc"), False +) SketchPoint_1 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_33.center()) -SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchArc_17_2_StartVertex"), False) +SketchConstraintCoincidence_37 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_1).coordinates(), SketchArc_33.center() +) +SketchProjection_4 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchArc_17_2_StartVertex"), False +) SketchPoint_2 = SketchProjection_4.createdFeature() -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchArc_33.startPoint(), SketchAPI_Point(SketchPoint_2).coordinates(), 4, True) -SketchLine_10 = Sketch_2.addLine(48.1858267258401, 19.0704912613701, 49.7056919497355, 16.28668032699112) +SketchConstraintDistance_5 = Sketch_2.setDistance( + SketchArc_33.startPoint(), SketchAPI_Point(SketchPoint_2).coordinates(), 4, True +) +SketchLine_10 = Sketch_2.addLine( + 48.1858267258401, 19.0704912613701, 49.7056919497355, 16.28668032699112 +) SketchLine_10.setName("SketchLine_9") SketchLine_10.result().setName("SketchLine_9") -SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchArc_33.endPoint(), SketchLine_10.startPoint()) -SketchArc_34 = Sketch_2.addArc(48.03804881864168, 15.3762044144511, 49.7056919497355, 16.28668032699112, 49.93150121822762, 15.21860361971252, True) -SketchConstraintCoincidence_39 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchArc_34.startPoint()) -SketchConstraintTangent_17 = Sketch_2.setTangent(SketchLine_10.result(), SketchArc_34.results()[1]) -SketchLine_11 = Sketch_2.addLine(49.93150121822762, 15.21860361971252, 49.21181499063341, 6.57212682467093) +SketchConstraintCoincidence_38 = Sketch_2.setCoincident( + SketchArc_33.endPoint(), SketchLine_10.startPoint() +) +SketchArc_34 = Sketch_2.addArc( + 48.03804881864168, + 15.3762044144511, + 49.7056919497355, + 16.28668032699112, + 49.93150121822762, + 15.21860361971252, + True, +) +SketchConstraintCoincidence_39 = Sketch_2.setCoincident( + SketchLine_10.endPoint(), SketchArc_34.startPoint() +) +SketchConstraintTangent_17 = Sketch_2.setTangent( + SketchLine_10.result(), SketchArc_34.results()[1] +) +SketchLine_11 = Sketch_2.addLine( + 49.93150121822762, 15.21860361971252, 49.21181499063341, 6.57212682467093 +) SketchLine_11.setName("SketchLine_10") SketchLine_11.result().setName("SketchLine_10") -SketchConstraintCoincidence_40 = Sketch_2.setCoincident(SketchArc_34.endPoint(), SketchLine_11.startPoint()) -SketchConstraintTangent_18 = Sketch_2.setTangent(SketchLine_11.result(), SketchArc_34.results()[1]) -SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_2"), False) +SketchConstraintCoincidence_40 = Sketch_2.setCoincident( + SketchArc_34.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintTangent_18 = Sketch_2.setTangent( + SketchLine_11.result(), SketchArc_34.results()[1] +) +SketchProjection_5 = Sketch_2.addProjection( + model.selection("EDGE", "Sketch_1/SketchLine_2"), False +) SketchLine_12 = SketchProjection_5.createdFeature() SketchLine_12.setName("SketchLine_11") SketchLine_12.result().setName("SketchLine_11") -SketchConstraintParallel_3 = Sketch_2.setParallel(SketchLine_12.result(), SketchLine_11.result()) -SketchConstraintDistance_6 = Sketch_2.setDistance(SketchLine_11.startPoint(), SketchLine_12.result(), 1.6, True) -SketchArc_35 = Sketch_2.addArc(47.81663953830692, 6.68825372605725, 49.21181499063341, 6.57212682467093, 47.07590600961045, 5.500266419952984, True) -SketchConstraintCoincidence_41 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchArc_35.startPoint()) -SketchConstraintTangent_19 = Sketch_2.setTangent(SketchLine_11.result(), SketchArc_35.results()[1]) -SketchProjection_6 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchArc_14_2__cc"), False) +SketchConstraintParallel_3 = Sketch_2.setParallel( + SketchLine_12.result(), SketchLine_11.result() +) +SketchConstraintDistance_6 = Sketch_2.setDistance( + SketchLine_11.startPoint(), SketchLine_12.result(), 1.6, True +) +SketchArc_35 = Sketch_2.addArc( + 47.81663953830692, + 6.68825372605725, + 49.21181499063341, + 6.57212682467093, + 47.07590600961045, + 5.500266419952984, + True, +) +SketchConstraintCoincidence_41 = Sketch_2.setCoincident( + SketchLine_11.endPoint(), SketchArc_35.startPoint() +) +SketchConstraintTangent_19 = Sketch_2.setTangent( + SketchLine_11.result(), SketchArc_35.results()[1] +) +SketchProjection_6 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchArc_14_2__cc"), False +) SketchPoint_3 = SketchProjection_6.createdFeature() -SketchConstraintCoincidence_42 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchArc_35.center()) -SketchArc_36 = Sketch_2.addArc(0, -70, 47.07590600961045, 5.500266419952984, 0, 18.97432863534041, False) -SketchConstraintCoincidence_43 = Sketch_2.setCoincident(SketchArc_35.endPoint(), SketchArc_36.startPoint()) -SketchConstraintTangent_20 = Sketch_2.setTangent(SketchArc_35.results()[1], SketchArc_36.results()[1]) -SketchConstraintCoincidence_44 = Sketch_2.setCoincident(SketchArc_36.endPoint(), SketchLine_9.result()) -SketchProjection_7 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchArc_32_2__cc"), False) +SketchConstraintCoincidence_42 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_3).coordinates(), SketchArc_35.center() +) +SketchArc_36 = Sketch_2.addArc( + 0, -70, 47.07590600961045, 5.500266419952984, 0, 18.97432863534041, False +) +SketchConstraintCoincidence_43 = Sketch_2.setCoincident( + SketchArc_35.endPoint(), SketchArc_36.startPoint() +) +SketchConstraintTangent_20 = Sketch_2.setTangent( + SketchArc_35.results()[1], SketchArc_36.results()[1] +) +SketchConstraintCoincidence_44 = Sketch_2.setCoincident( + SketchArc_36.endPoint(), SketchLine_9.result() +) +SketchProjection_7 = Sketch_2.addProjection( + model.selection("VERTEX", "Sketch_1/SketchArc_32_2__cc"), False +) SketchPoint_4 = SketchProjection_7.createdFeature() -SketchConstraintCoincidence_45 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_4).coordinates(), SketchArc_36.center()) -SketchLine_13 = Sketch_2.addLine(51.52598744945789, 15.0858871609853, 49.93150121822762, 15.21860361971252) +SketchConstraintCoincidence_45 = Sketch_2.setCoincident( + SketchAPI_Point(SketchPoint_4).coordinates(), SketchArc_36.center() +) +SketchLine_13 = Sketch_2.addLine( + 51.52598744945789, 15.0858871609853, 49.93150121822762, 15.21860361971252 +) SketchLine_13.setName("SketchLine_12") SketchLine_13.result().setName("SketchLine_12") SketchLine_13.setAuxiliary(True) -SketchConstraintCoincidence_46 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_47 = Sketch_2.setCoincident(SketchArc_34.endPoint(), SketchLine_13.endPoint()) -SketchConstraintPerpendicular_2 = Sketch_2.setPerpendicular(SketchLine_11.result(), SketchLine_13.result()) -SketchLine_14 = Sketch_2.addLine(0, 33.22217618290702, 48.1858267258401, 19.0704912613701) +SketchConstraintCoincidence_46 = Sketch_2.setCoincident( + SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_47 = Sketch_2.setCoincident( + SketchArc_34.endPoint(), SketchLine_13.endPoint() +) +SketchConstraintPerpendicular_2 = Sketch_2.setPerpendicular( + SketchLine_11.result(), SketchLine_13.result() +) +SketchLine_14 = Sketch_2.addLine( + 0, 33.22217618290702, 48.1858267258401, 19.0704912613701 +) SketchLine_14.setName("SketchLine_13") SketchLine_14.result().setName("SketchLine_13") SketchLine_14.setAuxiliary(True) -SketchConstraintCoincidence_48 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_49 = Sketch_2.setCoincident(SketchArc_33.endPoint(), SketchLine_14.endPoint()) -SketchConstraintTangent_21 = Sketch_2.setTangent(SketchArc_33.results()[1], SketchLine_14.result()) -SketchConstraintAngle_2 = Sketch_2.setAngle(SketchLine_14.result(), SketchLine_10.result(), 135, type = "Direct") +SketchConstraintCoincidence_48 = Sketch_2.setCoincident( + SketchLine_14.startPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_49 = Sketch_2.setCoincident( + SketchArc_33.endPoint(), SketchLine_14.endPoint() +) +SketchConstraintTangent_21 = Sketch_2.setTangent( + SketchArc_33.results()[1], SketchLine_14.result() +) +SketchConstraintAngle_2 = Sketch_2.setAngle( + SketchLine_14.result(), SketchLine_10.result(), 135, type="Direct" +) SketchConstraintRadius_11 = Sketch_2.setRadius(SketchArc_34.results()[1], 1.9) -SketchConstraintMirror_2_objects = [SketchArc_33.results()[1], SketchLine_10.result(), SketchArc_34.results()[1], SketchLine_11.result(), SketchArc_35.results()[1], SketchArc_36.results()[1]] -SketchConstraintMirror_2 = Sketch_2.addMirror(SketchLine_9.result(), SketchConstraintMirror_2_objects) -[SketchArc_37, SketchLine_15, SketchArc_38, SketchLine_16, SketchArc_39, SketchArc_40] = SketchConstraintMirror_2.mirrored() +SketchConstraintMirror_2_objects = [ + SketchArc_33.results()[1], + SketchLine_10.result(), + SketchArc_34.results()[1], + SketchLine_11.result(), + SketchArc_35.results()[1], + SketchArc_36.results()[1], +] +SketchConstraintMirror_2 = Sketch_2.addMirror( + SketchLine_9.result(), SketchConstraintMirror_2_objects +) +[ + SketchArc_37, + SketchLine_15, + SketchArc_38, + SketchLine_16, + SketchArc_39, + SketchArc_40, +] = SketchConstraintMirror_2.mirrored() SketchLine_16.setName("SketchLine_15") SketchLine_16.result().setName("SketchLine_15") SketchLine_15.setName("SketchLine_14") SketchLine_15.result().setName("SketchLine_14") model.do() -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face"), 0, model.selection("FACE", "Extrusion_1_1/To_Face"), 4.4, [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/To_Face"), + 0, + model.selection("FACE", "Extrusion_1_1/To_Face"), + 4.4, + [model.selection("SOLID", "Extrusion_1_1")], +) model.testNbResults(ExtrusionCut_1, 1) model.testNbSubResults(ExtrusionCut_1, [0]) @@ -231,7 +643,14 @@ model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.EDGE, [276]) model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.VERTEX, [552]) model.testResultsVolumes(ExtrusionCut_1, [12313.7939]) -Chamfer_1 = model.addChamfer(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/From_Face")], True, "chamfer", "chamfer", keepSubResults = True) +Chamfer_1 = model.addChamfer( + Part_1_doc, + [model.selection("FACE", "Extrusion_1_1/From_Face")], + True, + "chamfer", + "chamfer", + keepSubResults=True, +) model.testNbResults(Chamfer_1, 1) model.testNbSubResults(Chamfer_1, [0]) @@ -241,107 +660,275 @@ model.testNbSubShapes(Chamfer_1, GeomAPI_Shape.EDGE, [412]) model.testNbSubShapes(Chamfer_1, GeomAPI_Shape.VERTEX, [824]) model.testResultsVolumes(Chamfer_1, [11962.2801]) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), "chamfer", True) +Plane_4 = model.addPlane( + Part_1_doc, model.selection("FACE", "PartSet/XOY"), "chamfer", True +) Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchArc_12_2"), False) +SketchProjection_8 = Sketch_3.addProjection( + model.selection("EDGE", "Sketch_1/SketchArc_12_2"), False +) SketchArc_41 = SketchProjection_8.createdFeature() -SketchArc_42 = Sketch_3.addArc(47.42857142857143, 14.08026468498505, 53.87940795452356, 15.47550950774626, 42.38734178332437, 18.34007731747046, False) -SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchAPI_Arc(SketchArc_41).center(), SketchArc_42.center()) +SketchArc_42 = Sketch_3.addArc( + 47.42857142857143, + 14.08026468498505, + 53.87940795452356, + 15.47550950774626, + 42.38734178332437, + 18.34007731747046, + False, +) +SketchConstraintCoincidence_50 = Sketch_3.setCoincident( + SketchAPI_Arc(SketchArc_41).center(), SketchArc_42.center() +) SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_48") -SketchLine_17 = Sketch_3.addLine(47.42857142857143, 14.08026468498505, 52.31556879671699, 15.13726833859203) +SketchLine_17 = Sketch_3.addLine( + 47.42857142857143, 14.08026468498505, 52.31556879671699, 15.13726833859203 +) SketchLine_17.setName("SketchLine_16") SketchLine_17.result().setName("SketchLine_16") SketchLine_17.setAuxiliary(True) -SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchAPI_Arc(SketchArc_41).center(), SketchLine_17.startPoint()) -SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchAPI_Arc(SketchArc_41).endPoint(), SketchLine_17.endPoint()) -SketchConstraintCoincidence_53 = Sketch_3.setCoincident(SketchArc_42.startPoint(), SketchLine_17.result()) -SketchConstraintDistance_7 = Sketch_3.setDistance(SketchLine_17.endPoint(), SketchArc_42.startPoint(), "2*chamfer", True) -SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_2/SketchArc_34_2"), False) +SketchConstraintCoincidence_51 = Sketch_3.setCoincident( + SketchAPI_Arc(SketchArc_41).center(), SketchLine_17.startPoint() +) +SketchConstraintCoincidence_52 = Sketch_3.setCoincident( + SketchAPI_Arc(SketchArc_41).endPoint(), SketchLine_17.endPoint() +) +SketchConstraintCoincidence_53 = Sketch_3.setCoincident( + SketchArc_42.startPoint(), SketchLine_17.result() +) +SketchConstraintDistance_7 = Sketch_3.setDistance( + SketchLine_17.endPoint(), SketchArc_42.startPoint(), "2*chamfer", True +) +SketchProjection_9 = Sketch_3.addProjection( + model.selection("EDGE", "Sketch_2/SketchArc_34_2"), False +) SketchArc_43 = SketchProjection_9.createdFeature() -SketchArc_44 = Sketch_3.addArc(45.66073233717504, 15.57407945314024, 49.93150121822762, 15.21860361971246, 42.38734178332437, 18.34007731747046, False) -SketchProjection_10 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_2/SketchLine_12"), False) +SketchArc_44 = Sketch_3.addArc( + 45.66073233717504, + 15.57407945314024, + 49.93150121822762, + 15.21860361971246, + 42.38734178332437, + 18.34007731747046, + False, +) +SketchProjection_10 = Sketch_3.addProjection( + model.selection("EDGE", "Sketch_2/SketchLine_12"), False +) SketchLine_18 = SketchProjection_10.createdFeature() SketchLine_18.setName("SketchLine_17") SketchLine_18.result().setName("SketchLine_17") -SketchConstraintCoincidence_54 = Sketch_3.setCoincident(SketchArc_44.startPoint(), SketchLine_18.result()) -SketchConstraintDistance_8 = Sketch_3.setDistance(SketchArc_44.startPoint(), SketchAPI_Line(SketchLine_18).startPoint(), "2*chamfer", True) -SketchLine_19 = Sketch_3.addLine(47.42857142857143, 14.08026468498505, 42.38734178332437, 18.34007731747046) +SketchConstraintCoincidence_54 = Sketch_3.setCoincident( + SketchArc_44.startPoint(), SketchLine_18.result() +) +SketchConstraintDistance_8 = Sketch_3.setDistance( + SketchArc_44.startPoint(), + SketchAPI_Line(SketchLine_18).startPoint(), + "2*chamfer", + True, +) +SketchLine_19 = Sketch_3.addLine( + 47.42857142857143, 14.08026468498505, 42.38734178332437, 18.34007731747046 +) SketchLine_19.setName("SketchLine_18") SketchLine_19.result().setName("SketchLine_18") SketchLine_19.setAuxiliary(True) -SketchConstraintCoincidence_55 = Sketch_3.setCoincident(SketchAPI_Arc(SketchArc_41).center(), SketchLine_19.startPoint()) -SketchConstraintCoincidence_56 = Sketch_3.setCoincident(SketchArc_42.endPoint(), SketchLine_19.endPoint()) -SketchConstraintPerpendicular_3 = Sketch_3.setPerpendicular(SketchArc_44.results()[1], SketchLine_18.result()) -SketchConstraintCoincidence_57 = Sketch_3.setCoincident(SketchArc_44.endPoint(), SketchLine_19.endPoint()) -SketchLine_20 = Sketch_3.addLine(49.93150121822762, 15.21860361971252, 53.87940795452356, 15.47550950774626) +SketchConstraintCoincidence_55 = Sketch_3.setCoincident( + SketchAPI_Arc(SketchArc_41).center(), SketchLine_19.startPoint() +) +SketchConstraintCoincidence_56 = Sketch_3.setCoincident( + SketchArc_42.endPoint(), SketchLine_19.endPoint() +) +SketchConstraintPerpendicular_3 = Sketch_3.setPerpendicular( + SketchArc_44.results()[1], SketchLine_18.result() +) +SketchConstraintCoincidence_57 = Sketch_3.setCoincident( + SketchArc_44.endPoint(), SketchLine_19.endPoint() +) +SketchLine_20 = Sketch_3.addLine( + 49.93150121822762, 15.21860361971252, 53.87940795452356, 15.47550950774626 +) SketchLine_20.setName("SketchLine_22") SketchLine_20.result().setName("SketchLine_22") -SketchConstraintCoincidence_58 = Sketch_3.setCoincident(SketchAPI_Arc(SketchArc_43).startPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_59 = Sketch_3.setCoincident(SketchArc_42.startPoint(), SketchLine_20.endPoint()) -SketchConstraintCoincidence_60 = Sketch_3.setCoincident(SketchArc_44.center(), SketchLine_19.result()) +SketchConstraintCoincidence_58 = Sketch_3.setCoincident( + SketchAPI_Arc(SketchArc_43).startPoint(), SketchLine_20.startPoint() +) +SketchConstraintCoincidence_59 = Sketch_3.setCoincident( + SketchArc_42.startPoint(), SketchLine_20.endPoint() +) +SketchConstraintCoincidence_60 = Sketch_3.setCoincident( + SketchArc_44.center(), SketchLine_19.result() +) model.do() -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), "2*chamfer", False) +Plane_5 = model.addPlane( + Part_1_doc, model.selection("FACE", "PartSet/XOY"), "2*chamfer", False +) Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2")) -SketchProjection_11 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_3/SketchArc_42_2"), False) +SketchProjection_11 = Sketch_4.addProjection( + model.selection("EDGE", "Sketch_3/SketchArc_42_2"), False +) SketchArc_45 = SketchProjection_11.createdFeature() -SketchArc_46 = Sketch_4.addArc(47.42857142857143, 14.08026468498505, 51.5336492178137, 14.96814775401492, 44.22051619977783, 16.79105454202122, False) -SketchConstraintCoincidence_61 = Sketch_4.setCoincident(SketchAPI_Arc(SketchArc_45).center(), SketchArc_46.center()) -SketchProjection_12 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_3/SketchLine_16"), False) +SketchArc_46 = Sketch_4.addArc( + 47.42857142857143, + 14.08026468498505, + 51.5336492178137, + 14.96814775401492, + 44.22051619977783, + 16.79105454202122, + False, +) +SketchConstraintCoincidence_61 = Sketch_4.setCoincident( + SketchAPI_Arc(SketchArc_45).center(), SketchArc_46.center() +) +SketchProjection_12 = Sketch_4.addProjection( + model.selection("EDGE", "Sketch_3/SketchLine_16"), False +) SketchLine_21 = SketchProjection_12.createdFeature() SketchLine_21.setName("SketchLine_19") SketchLine_21.result().setName("SketchLine_19") -SketchProjection_13 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_3/SketchLine_18"), False) +SketchProjection_13 = Sketch_4.addProjection( + model.selection("EDGE", "Sketch_3/SketchLine_18"), False +) SketchLine_22 = SketchProjection_13.createdFeature() SketchLine_22.setName("SketchLine_20") SketchLine_22.result().setName("SketchLine_20") -SketchConstraintCoincidence_62 = Sketch_4.setCoincident(SketchArc_46.startPoint(), SketchLine_21.result()) -SketchConstraintCoincidence_63 = Sketch_4.setCoincident(SketchArc_46.endPoint(), SketchLine_22.result()) -SketchConstraintDistance_9 = Sketch_4.setDistance(SketchArc_46.startPoint(), SketchAPI_Arc(SketchArc_45).startPoint(), "3*chamfer", True) -SketchProjection_14 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_3/SketchArc_44_2"), False) +SketchConstraintCoincidence_62 = Sketch_4.setCoincident( + SketchArc_46.startPoint(), SketchLine_21.result() +) +SketchConstraintCoincidence_63 = Sketch_4.setCoincident( + SketchArc_46.endPoint(), SketchLine_22.result() +) +SketchConstraintDistance_9 = Sketch_4.setDistance( + SketchArc_46.startPoint(), + SketchAPI_Arc(SketchArc_45).startPoint(), + "3*chamfer", + True, +) +SketchProjection_14 = Sketch_4.addProjection( + model.selection("EDGE", "Sketch_3/SketchArc_44_2"), False +) SketchArc_47 = SketchProjection_14.createdFeature() -SketchArc_48 = Sketch_4.addArc(45.66073233717504, 15.57407945314024, 52.32323056507302, 15.01952893162158, 40.55416736687089, 19.8891000929197, False) -SketchConstraintCoincidence_64 = Sketch_4.setCoincident(SketchAPI_Arc(SketchArc_47).center(), SketchArc_48.center()) -SketchLine_23 = Sketch_4.addLine(45.66073233717504, 15.57407945314024, 49.93150121822762, 15.21860361971246) +SketchArc_48 = Sketch_4.addArc( + 45.66073233717504, + 15.57407945314024, + 52.32323056507302, + 15.01952893162158, + 40.55416736687089, + 19.8891000929197, + False, +) +SketchConstraintCoincidence_64 = Sketch_4.setCoincident( + SketchAPI_Arc(SketchArc_47).center(), SketchArc_48.center() +) +SketchLine_23 = Sketch_4.addLine( + 45.66073233717504, 15.57407945314024, 49.93150121822762, 15.21860361971246 +) SketchLine_23.setName("SketchLine_21") SketchLine_23.result().setName("SketchLine_21") SketchLine_23.setAuxiliary(True) -SketchConstraintCoincidence_65 = Sketch_4.setCoincident(SketchAPI_Arc(SketchArc_47).center(), SketchLine_23.startPoint()) -SketchConstraintCoincidence_66 = Sketch_4.setCoincident(SketchAPI_Arc(SketchArc_47).startPoint(), SketchLine_23.endPoint()) -SketchConstraintCoincidence_67 = Sketch_4.setCoincident(SketchArc_48.startPoint(), SketchLine_23.result()) -SketchConstraintCoincidence_68 = Sketch_4.setCoincident(SketchArc_48.endPoint(), SketchLine_22.result()) -SketchConstraintDistance_10 = Sketch_4.setDistance(SketchLine_23.endPoint(), SketchArc_48.startPoint(), "3*chamfer", True) +SketchConstraintCoincidence_65 = Sketch_4.setCoincident( + SketchAPI_Arc(SketchArc_47).center(), SketchLine_23.startPoint() +) +SketchConstraintCoincidence_66 = Sketch_4.setCoincident( + SketchAPI_Arc(SketchArc_47).startPoint(), SketchLine_23.endPoint() +) +SketchConstraintCoincidence_67 = Sketch_4.setCoincident( + SketchArc_48.startPoint(), SketchLine_23.result() +) +SketchConstraintCoincidence_68 = Sketch_4.setCoincident( + SketchArc_48.endPoint(), SketchLine_22.result() +) +SketchConstraintDistance_10 = Sketch_4.setDistance( + SketchLine_23.endPoint(), SketchArc_48.startPoint(), "3*chamfer", True +) model.do() -Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchArc_42_2"), model.selection("EDGE", "Sketch_4/SketchArc_46_2")]) -Filling_2 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchArc_44_2"), model.selection("EDGE", "Sketch_4/SketchArc_48_2")]) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchArc_42_2f-SketchArc_44_2r-SketchLine_22f")]) +Filling_1 = model.addFilling( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_3/SketchArc_42_2"), + model.selection("EDGE", "Sketch_4/SketchArc_46_2"), + ], +) +Filling_2 = model.addFilling( + Part_1_doc, + [ + model.selection("EDGE", "Sketch_3/SketchArc_44_2"), + model.selection("EDGE", "Sketch_4/SketchArc_48_2"), + ], +) +Face_1 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_3/Face-SketchArc_42_2f-SketchArc_44_2r-SketchLine_22f" + ) + ], +) -Plane_6 = model.addPlane(Part_1_doc, model.selection("EDGE", "Sketch_3/SketchLine_22"), model.selection("VERTEX", "[Filling_2_1/Edge_0_1]e[Filling_2_1/Edge_0_4]e"), False) +Plane_6 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "Sketch_3/SketchLine_22"), + model.selection("VERTEX", "[Filling_2_1/Edge_0_1]e[Filling_2_1/Edge_0_4]e"), + False, +) Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_3")) -SketchProjection_15 = Sketch_5.addProjection(model.selection("EDGE", "Sketch_3/SketchLine_22"), True) +SketchProjection_15 = Sketch_5.addProjection( + model.selection("EDGE", "Sketch_3/SketchLine_22"), True +) SketchLine_24 = SketchProjection_15.createdFeature() SketchLine_24.setName("SketchLine_23") SketchLine_24.result().setName("SketchLine_23") -SketchProjection_16 = Sketch_5.addProjection(model.selection("EDGE", "Filling_1_1/Edge_0_1"), False) +SketchProjection_16 = Sketch_5.addProjection( + model.selection("EDGE", "Filling_1_1/Edge_0_1"), False +) SketchBSpline_1 = SketchProjection_16.createdFeature() -SketchProjection_17 = Sketch_5.addProjection(model.selection("EDGE", "Filling_2_1/Edge_0_1"), False) +SketchProjection_17 = Sketch_5.addProjection( + model.selection("EDGE", "Filling_2_1/Edge_0_1"), False +) SketchBSpline_2 = SketchProjection_17.createdFeature() -SketchLine_25 = Sketch_5.addLine(54.7440877920758, -3.054064947639794, 52.78524259618538, -1.013740096412265) +SketchLine_25 = Sketch_5.addLine( + 54.7440877920758, -3.054064947639794, 52.78524259618538, -1.013740096412265 +) SketchLine_25.setName("SketchLine_24") SketchLine_25.result().setName("SketchLine_24") -SketchConstraintCoincidence_69 = Sketch_5.setCoincident(SketchAPI_Line(SketchLine_24).endPoint(), SketchLine_25.startPoint()) -SketchLine_26 = Sketch_5.addLine(52.78524259618538, -1.013740096412265, 50.78800926284204, -3.016502941130004) +SketchConstraintCoincidence_69 = Sketch_5.setCoincident( + SketchAPI_Line(SketchLine_24).endPoint(), SketchLine_25.startPoint() +) +SketchLine_26 = Sketch_5.addLine( + 52.78524259618538, -1.013740096412265, 50.78800926284204, -3.016502941130004 +) SketchLine_26.setName("SketchLine_25") SketchLine_26.result().setName("SketchLine_25") -SketchConstraintCoincidence_70 = Sketch_5.setCoincident(SketchLine_25.endPoint(), SketchLine_26.startPoint()) -SketchConstraintCoincidence_71 = Sketch_5.setCoincident(SketchAPI_Line(SketchLine_24).startPoint(), SketchLine_26.endPoint()) -SketchConstraintCoincidence_72 = Sketch_5.setCoincident(SketchLine_26.startPoint(), SketchBSpline_1.result()) -SketchConstraintCoincidence_73 = Sketch_5.setCoincident(SketchLine_26.startPoint(), SketchBSpline_2.result()) +SketchConstraintCoincidence_70 = Sketch_5.setCoincident( + SketchLine_25.endPoint(), SketchLine_26.startPoint() +) +SketchConstraintCoincidence_71 = Sketch_5.setCoincident( + SketchAPI_Line(SketchLine_24).startPoint(), SketchLine_26.endPoint() +) +SketchConstraintCoincidence_72 = Sketch_5.setCoincident( + SketchLine_26.startPoint(), SketchBSpline_1.result() +) +SketchConstraintCoincidence_73 = Sketch_5.setCoincident( + SketchLine_26.startPoint(), SketchBSpline_2.result() +) model.do() -Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchProjection_15r-SketchLine_24f-SketchLine_25f")]) +Face_2 = model.addFace( + Part_1_doc, + [ + model.selection( + "FACE", "Sketch_5/Face-SketchProjection_15r-SketchLine_24f-SketchLine_25f" + ) + ], +) -Solid_1_objects = [model.selection("FACE", "Filling_1_1"), model.selection("FACE", "Filling_2_1"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")] +Solid_1_objects = [ + model.selection("FACE", "Filling_1_1"), + model.selection("FACE", "Filling_2_1"), + model.selection("FACE", "Face_1_1"), + model.selection("FACE", "Face_2_1"), +] Solid_1 = model.addSolid(Part_1_doc, Solid_1_objects) model.testNbResults(Solid_1, 1) @@ -352,7 +939,17 @@ model.testNbSubShapes(Solid_1, GeomAPI_Shape.EDGE, [12]) model.testNbSubShapes(Solid_1, GeomAPI_Shape.VERTEX, [24]) model.testResultsVolumes(Solid_1, [13.6834876]) -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Solid_1_1/Modified_Face&Filling_1_1/Filling_1_1][Solid_1_1/Modified_Face&Filling_2_1/Filling_2_1]")], 0.4, keepSubResults = True) +Fillet_1 = model.addFillet( + Part_1_doc, + [ + model.selection( + "EDGE", + "[Solid_1_1/Modified_Face&Filling_1_1/Filling_1_1][Solid_1_1/Modified_Face&Filling_2_1/Filling_2_1]", + ) + ], + 0.4, + keepSubResults=True, +) model.testNbResults(Fillet_1, 1) model.testNbSubResults(Fillet_1, [0]) @@ -362,8 +959,19 @@ model.testNbSubShapes(Fillet_1, GeomAPI_Shape.EDGE, [18]) model.testNbSubShapes(Fillet_1, GeomAPI_Shape.VERTEX, [36]) model.testResultsVolumes(Fillet_1, [13.34526088678]) -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Fillet_1_1")], model.selection("FACE", "PartSet/YOZ"), keepOriginal = True, keepSubResults = True) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Chamfer_1_1")], [model.selection("COMPOUND", "Symmetry_1_1")], keepSubResults = True) +Symmetry_1 = model.addSymmetry( + Part_1_doc, + [model.selection("SOLID", "Fillet_1_1")], + model.selection("FACE", "PartSet/YOZ"), + keepOriginal=True, + keepSubResults=True, +) +Cut_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Chamfer_1_1")], + [model.selection("COMPOUND", "Symmetry_1_1")], + keepSubResults=True, +) model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [0]) @@ -380,98 +988,181 @@ SketchLine_27.result().setName("SketchLine_26") SketchLine_28 = Sketch_6.addLine(-29, 0, -28, 1) SketchLine_28.setName("SketchLine_27") SketchLine_28.result().setName("SketchLine_27") -SketchConstraintCoincidence_74 = Sketch_6.setCoincident(SketchLine_27.endPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_74 = Sketch_6.setCoincident( + SketchLine_27.endPoint(), SketchLine_28.startPoint() +) SketchLine_29 = Sketch_6.addLine(-28, 1, -28, 4) SketchLine_29.setName("SketchLine_28") SketchLine_29.result().setName("SketchLine_28") -SketchConstraintCoincidence_75 = Sketch_6.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_75 = Sketch_6.setCoincident( + SketchLine_28.endPoint(), SketchLine_29.startPoint() +) SketchConstraintVertical_1 = Sketch_6.setVertical(SketchLine_29.result()) SketchLine_30 = Sketch_6.addLine(-28, 4, -29, 5) SketchLine_30.setName("SketchLine_29") SketchLine_30.result().setName("SketchLine_29") -SketchConstraintCoincidence_76 = Sketch_6.setCoincident(SketchLine_29.endPoint(), SketchLine_30.startPoint()) +SketchConstraintCoincidence_76 = Sketch_6.setCoincident( + SketchLine_29.endPoint(), SketchLine_30.startPoint() +) SketchLine_31 = Sketch_6.addLine(-29, 5, -32, 5) SketchLine_31.setName("SketchLine_30") SketchLine_31.result().setName("SketchLine_30") -SketchConstraintCoincidence_77 = Sketch_6.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_77 = Sketch_6.setCoincident( + SketchLine_30.endPoint(), SketchLine_31.startPoint() +) SketchConstraintHorizontal_1 = Sketch_6.setHorizontal(SketchLine_31.result()) SketchLine_32 = Sketch_6.addLine(-32, 5, -33, 4) SketchLine_32.setName("SketchLine_31") SketchLine_32.result().setName("SketchLine_31") -SketchConstraintCoincidence_78 = Sketch_6.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_78 = Sketch_6.setCoincident( + SketchLine_31.endPoint(), SketchLine_32.startPoint() +) SketchLine_33 = Sketch_6.addLine(-33, 4, -33, 1) SketchLine_33.setName("SketchLine_32") SketchLine_33.result().setName("SketchLine_32") -SketchConstraintCoincidence_79 = Sketch_6.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_79 = Sketch_6.setCoincident( + SketchLine_32.endPoint(), SketchLine_33.startPoint() +) SketchConstraintVertical_2 = Sketch_6.setVertical(SketchLine_33.result()) SketchLine_34 = Sketch_6.addLine(-33, 1, -32, 0) SketchLine_34.setName("SketchLine_33") SketchLine_34.result().setName("SketchLine_33") -SketchConstraintCoincidence_80 = Sketch_6.setCoincident(SketchLine_33.endPoint(), SketchLine_34.startPoint()) -SketchConstraintCoincidence_81 = Sketch_6.setCoincident(SketchLine_27.startPoint(), SketchLine_34.endPoint()) -SketchProjection_18 = Sketch_6.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchConstraintCoincidence_80 = Sketch_6.setCoincident( + SketchLine_33.endPoint(), SketchLine_34.startPoint() +) +SketchConstraintCoincidence_81 = Sketch_6.setCoincident( + SketchLine_27.startPoint(), SketchLine_34.endPoint() +) +SketchProjection_18 = Sketch_6.addProjection( + model.selection("EDGE", "PartSet/OY"), False +) SketchLine_35 = SketchProjection_18.createdFeature() SketchLine_35.setName("SketchLine_34") SketchLine_35.result().setName("SketchLine_34") -SketchConstraintCollinear_1 = Sketch_6.setCollinear(SketchLine_35.result(), SketchLine_27.result()) +SketchConstraintCollinear_1 = Sketch_6.setCollinear( + SketchLine_35.result(), SketchLine_27.result() +) SketchConstraintLength_1 = Sketch_6.setLength(SketchLine_27.result(), "size_z-2") -SketchConstraintEqual_1 = Sketch_6.setEqual(SketchLine_27.result(), SketchLine_29.result()) -SketchConstraintEqual_2 = Sketch_6.setEqual(SketchLine_29.result(), SketchLine_31.result()) -SketchConstraintEqual_3 = Sketch_6.setEqual(SketchLine_31.result(), SketchLine_33.result()) -SketchConstraintEqual_4 = Sketch_6.setEqual(SketchLine_28.result(), SketchLine_30.result()) -SketchConstraintEqual_5 = Sketch_6.setEqual(SketchLine_30.result(), SketchLine_32.result()) -SketchConstraintEqual_6 = Sketch_6.setEqual(SketchLine_32.result(), SketchLine_34.result()) -SketchConstraintDistanceHorizontal_2 = Sketch_6.setHorizontalDistance(SketchLine_27.endPoint(), SketchLine_28.endPoint(), 1) -SketchConstraintDistanceHorizontal_3 = Sketch_6.setHorizontalDistance(SketchLine_31.startPoint(), SketchLine_29.endPoint(), 1) -SketchConstraintDistanceVertical_5 = Sketch_6.setVerticalDistance(SketchLine_27.endPoint(), SketchLine_28.endPoint(), 1) -SketchConstraintDistance_11 = Sketch_6.setDistance(SketchAPI_Line(SketchLine_35).startPoint(), SketchLine_29.result(), 28, True) +SketchConstraintEqual_1 = Sketch_6.setEqual( + SketchLine_27.result(), SketchLine_29.result() +) +SketchConstraintEqual_2 = Sketch_6.setEqual( + SketchLine_29.result(), SketchLine_31.result() +) +SketchConstraintEqual_3 = Sketch_6.setEqual( + SketchLine_31.result(), SketchLine_33.result() +) +SketchConstraintEqual_4 = Sketch_6.setEqual( + SketchLine_28.result(), SketchLine_30.result() +) +SketchConstraintEqual_5 = Sketch_6.setEqual( + SketchLine_30.result(), SketchLine_32.result() +) +SketchConstraintEqual_6 = Sketch_6.setEqual( + SketchLine_32.result(), SketchLine_34.result() +) +SketchConstraintDistanceHorizontal_2 = Sketch_6.setHorizontalDistance( + SketchLine_27.endPoint(), SketchLine_28.endPoint(), 1 +) +SketchConstraintDistanceHorizontal_3 = Sketch_6.setHorizontalDistance( + SketchLine_31.startPoint(), SketchLine_29.endPoint(), 1 +) +SketchConstraintDistanceVertical_5 = Sketch_6.setVerticalDistance( + SketchLine_27.endPoint(), SketchLine_28.endPoint(), 1 +) +SketchConstraintDistance_11 = Sketch_6.setDistance( + SketchAPI_Line(SketchLine_35).startPoint(), SketchLine_29.result(), 28, True +) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection(), 79, -76.5) +Extrusion_2 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection(), 79, -76.5 +) -Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_6/Face-SketchLine_26r-SketchLine_27f-SketchLine_28f-SketchLine_29f-SketchLine_30f-SketchLine_31f-SketchLine_32f-SketchLine_33f")) -SketchProjection_19 = Sketch_7.addProjection(model.selection("EDGE", "Sketch_6/SketchLine_27"), True) +Sketch_7 = model.addSketch( + Part_1_doc, + model.selection( + "FACE", + "Sketch_6/Face-SketchLine_26r-SketchLine_27f-SketchLine_28f-SketchLine_29f-SketchLine_30f-SketchLine_31f-SketchLine_32f-SketchLine_33f", + ), +) +SketchProjection_19 = Sketch_7.addProjection( + model.selection("EDGE", "Sketch_6/SketchLine_27"), True +) SketchLine_36 = SketchProjection_19.createdFeature() SketchLine_36.setName("SketchLine_35") SketchLine_36.result().setName("SketchLine_35") -SketchProjection_20 = Sketch_7.addProjection(model.selection("EDGE", "Sketch_6/SketchLine_28"), True) +SketchProjection_20 = Sketch_7.addProjection( + model.selection("EDGE", "Sketch_6/SketchLine_28"), True +) SketchLine_37 = SketchProjection_20.createdFeature() SketchLine_37.setName("SketchLine_36") SketchLine_37.result().setName("SketchLine_36") -SketchProjection_21 = Sketch_7.addProjection(model.selection("EDGE", "Sketch_6/SketchLine_29"), True) +SketchProjection_21 = Sketch_7.addProjection( + model.selection("EDGE", "Sketch_6/SketchLine_29"), True +) SketchLine_38 = SketchProjection_21.createdFeature() SketchLine_38.setName("SketchLine_37") SketchLine_38.result().setName("SketchLine_37") SketchLine_39 = Sketch_7.addLine(-29, 5, -31, 5) SketchLine_39.setName("SketchLine_38") SketchLine_39.result().setName("SketchLine_38") -SketchConstraintCoincidence_82 = Sketch_7.setCoincident(SketchAPI_Line(SketchLine_38).endPoint(), SketchLine_39.startPoint()) +SketchConstraintCoincidence_82 = Sketch_7.setCoincident( + SketchAPI_Line(SketchLine_38).endPoint(), SketchLine_39.startPoint() +) SketchLine_40 = Sketch_7.addLine(-31, 5, -32, 4) SketchLine_40.setName("SketchLine_39") SketchLine_40.result().setName("SketchLine_39") -SketchConstraintCoincidence_83 = Sketch_7.setCoincident(SketchLine_39.endPoint(), SketchLine_40.startPoint()) +SketchConstraintCoincidence_83 = Sketch_7.setCoincident( + SketchLine_39.endPoint(), SketchLine_40.startPoint() +) SketchLine_41 = Sketch_7.addLine(-32, 4, -32, 1) SketchLine_41.setName("SketchLine_40") SketchLine_41.result().setName("SketchLine_40") -SketchConstraintCoincidence_84 = Sketch_7.setCoincident(SketchLine_40.endPoint(), SketchLine_41.startPoint()) +SketchConstraintCoincidence_84 = Sketch_7.setCoincident( + SketchLine_40.endPoint(), SketchLine_41.startPoint() +) SketchConstraintVertical_3 = Sketch_7.setVertical(SketchLine_41.result()) SketchLine_42 = Sketch_7.addLine(-32, 1, -31, 0) SketchLine_42.setName("SketchLine_41") SketchLine_42.result().setName("SketchLine_41") -SketchConstraintCoincidence_85 = Sketch_7.setCoincident(SketchLine_41.endPoint(), SketchLine_42.startPoint()) +SketchConstraintCoincidence_85 = Sketch_7.setCoincident( + SketchLine_41.endPoint(), SketchLine_42.startPoint() +) SketchLine_43 = Sketch_7.addLine(-31, 0, -29, 0) SketchLine_43.setName("SketchLine_42") SketchLine_43.result().setName("SketchLine_42") -SketchConstraintCoincidence_86 = Sketch_7.setCoincident(SketchLine_42.endPoint(), SketchLine_43.startPoint()) -SketchConstraintCoincidence_87 = Sketch_7.setCoincident(SketchAPI_Line(SketchLine_36).startPoint(), SketchLine_43.endPoint()) +SketchConstraintCoincidence_86 = Sketch_7.setCoincident( + SketchLine_42.endPoint(), SketchLine_43.startPoint() +) +SketchConstraintCoincidence_87 = Sketch_7.setCoincident( + SketchAPI_Line(SketchLine_36).startPoint(), SketchLine_43.endPoint() +) SketchConstraintHorizontal_2 = Sketch_7.setHorizontal(SketchLine_43.result()) SketchConstraintHorizontal_3 = Sketch_7.setHorizontal(SketchLine_39.result()) -SketchConstraintEqual_7 = Sketch_7.setEqual(SketchLine_40.result(), SketchLine_42.result()) -SketchConstraintEqual_8 = Sketch_7.setEqual(SketchLine_42.result(), SketchLine_36.result()) -SketchConstraintEqual_9 = Sketch_7.setEqual(SketchLine_37.result(), SketchLine_41.result()) -SketchConstraintEqual_10 = Sketch_7.setEqual(SketchLine_39.result(), SketchLine_43.result()) +SketchConstraintEqual_7 = Sketch_7.setEqual( + SketchLine_40.result(), SketchLine_42.result() +) +SketchConstraintEqual_8 = Sketch_7.setEqual( + SketchLine_42.result(), SketchLine_36.result() +) +SketchConstraintEqual_9 = Sketch_7.setEqual( + SketchLine_37.result(), SketchLine_41.result() +) +SketchConstraintEqual_10 = Sketch_7.setEqual( + SketchLine_39.result(), SketchLine_43.result() +) SketchConstraintLength_2 = Sketch_7.setLength(SketchLine_39.result(), 2) model.do() -ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_7")], model.selection(), model.selection("FACE", "Extrusion_2_1/From_Face"), 0, model.selection("FACE", "Extrusion_2_1/From_Face"), "1.6+2*chamfer", [model.selection("SOLID", "Extrusion_2_1")]) +ExtrusionFuse_1 = model.addExtrusionFuse( + Part_1_doc, + [model.selection("COMPOUND", "Sketch_7")], + model.selection(), + model.selection("FACE", "Extrusion_2_1/From_Face"), + 0, + model.selection("FACE", "Extrusion_2_1/From_Face"), + "1.6+2*chamfer", + [model.selection("SOLID", "Extrusion_2_1")], +) model.testNbResults(ExtrusionFuse_1, 1) model.testNbSubResults(ExtrusionFuse_1, [0]) @@ -481,44 +1172,100 @@ model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.EDGE, [90]) model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.VERTEX, [180]) model.testResultsVolumes(ExtrusionFuse_1, [115.1]) -Plane_7 = model.addPlane(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchLine_43"), model.selection("VERTEX", "Sketch_1/SketchArc_1"), True) +Plane_7 = model.addPlane( + Part_1_doc, + model.selection("EDGE", "Sketch_1/SketchLine_43"), + model.selection("VERTEX", "Sketch_1/SketchArc_1"), + True, +) Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_4")) SketchLine_44 = Sketch_8.addLine(30.42415119636338, 0, 27.42415119636338, 0) SketchConstraintHorizontal_4 = Sketch_8.setHorizontal(SketchLine_44.result()) SketchLine_45 = Sketch_8.addLine(27.42415119636338, 0, 26.42415119636338, -1) -SketchConstraintCoincidence_88 = Sketch_8.setCoincident(SketchLine_44.endPoint(), SketchLine_45.startPoint()) +SketchConstraintCoincidence_88 = Sketch_8.setCoincident( + SketchLine_44.endPoint(), SketchLine_45.startPoint() +) SketchLine_46 = Sketch_8.addLine(26.42415119636338, -1, 26.42415119636338, -4) -SketchConstraintCoincidence_89 = Sketch_8.setCoincident(SketchLine_45.endPoint(), SketchLine_46.startPoint()) +SketchConstraintCoincidence_89 = Sketch_8.setCoincident( + SketchLine_45.endPoint(), SketchLine_46.startPoint() +) SketchConstraintVertical_4 = Sketch_8.setVertical(SketchLine_46.result()) SketchLine_47 = Sketch_8.addLine(26.42415119636338, -4, 27.42415119636338, -5) -SketchConstraintCoincidence_90 = Sketch_8.setCoincident(SketchLine_46.endPoint(), SketchLine_47.startPoint()) +SketchConstraintCoincidence_90 = Sketch_8.setCoincident( + SketchLine_46.endPoint(), SketchLine_47.startPoint() +) SketchLine_48 = Sketch_8.addLine(27.42415119636338, -5, 30.42415119636338, -5) -SketchConstraintCoincidence_91 = Sketch_8.setCoincident(SketchLine_47.endPoint(), SketchLine_48.startPoint()) +SketchConstraintCoincidence_91 = Sketch_8.setCoincident( + SketchLine_47.endPoint(), SketchLine_48.startPoint() +) SketchConstraintHorizontal_5 = Sketch_8.setHorizontal(SketchLine_48.result()) SketchLine_49 = Sketch_8.addLine(30.42415119636338, -5, 31.4241511964612, -4) -SketchConstraintCoincidence_92 = Sketch_8.setCoincident(SketchLine_48.endPoint(), SketchLine_49.startPoint()) +SketchConstraintCoincidence_92 = Sketch_8.setCoincident( + SketchLine_48.endPoint(), SketchLine_49.startPoint() +) SketchLine_50 = Sketch_8.addLine(31.4241511964612, -4, 31.4241511964612, -1) -SketchConstraintCoincidence_93 = Sketch_8.setCoincident(SketchLine_49.endPoint(), SketchLine_50.startPoint()) +SketchConstraintCoincidence_93 = Sketch_8.setCoincident( + SketchLine_49.endPoint(), SketchLine_50.startPoint() +) SketchConstraintVertical_5 = Sketch_8.setVertical(SketchLine_50.result()) SketchLine_51 = Sketch_8.addLine(31.4241511964612, -1, 30.42415119636338, 0) -SketchConstraintCoincidence_94 = Sketch_8.setCoincident(SketchLine_50.endPoint(), SketchLine_51.startPoint()) -SketchConstraintCoincidence_95 = Sketch_8.setCoincident(SketchLine_44.startPoint(), SketchLine_51.endPoint()) -SketchProjection_22 = Sketch_8.addProjection(model.selection("VERTEX", "Sketch_1/SketchArc_1"), False) +SketchConstraintCoincidence_94 = Sketch_8.setCoincident( + SketchLine_50.endPoint(), SketchLine_51.startPoint() +) +SketchConstraintCoincidence_95 = Sketch_8.setCoincident( + SketchLine_44.startPoint(), SketchLine_51.endPoint() +) +SketchProjection_22 = Sketch_8.addProjection( + model.selection("VERTEX", "Sketch_1/SketchArc_1"), False +) SketchPoint_5 = SketchProjection_22.createdFeature() SketchConstraintLength_3 = Sketch_8.setLength(SketchLine_44.result(), "size_z-2") -SketchConstraintEqual_11 = Sketch_8.setEqual(SketchLine_44.result(), SketchLine_46.result()) -SketchConstraintEqual_12 = Sketch_8.setEqual(SketchLine_46.result(), SketchLine_48.result()) -SketchConstraintEqual_13 = Sketch_8.setEqual(SketchLine_48.result(), SketchLine_50.result()) -SketchConstraintEqual_14 = Sketch_8.setEqual(SketchLine_45.result(), SketchLine_47.result()) -SketchConstraintEqual_15 = Sketch_8.setEqual(SketchLine_47.result(), SketchLine_49.result()) -SketchConstraintEqual_16 = Sketch_8.setEqual(SketchLine_49.result(), SketchLine_51.result()) -SketchConstraintDistanceHorizontal_4 = Sketch_8.setHorizontalDistance(SketchLine_45.startPoint(), SketchLine_45.endPoint(), 1) -SketchConstraintDistanceHorizontal_5 = Sketch_8.setHorizontalDistance(SketchLine_47.endPoint(), SketchLine_46.endPoint(), 1) -SketchConstraintDistanceVertical_6 = Sketch_8.setVerticalDistance(SketchLine_44.endPoint(), SketchLine_46.startPoint(), 1) -SketchConstraintCoincidence_96 = Sketch_8.setCoincident(SketchAPI_Point(SketchPoint_5).coordinates(), SketchLine_44.result()) -SketchConstraintCoincidence_97 = Sketch_8.setCoincident(SketchAPI_Point(SketchPoint_5).coordinates(), SketchLine_46.result()) +SketchConstraintEqual_11 = Sketch_8.setEqual( + SketchLine_44.result(), SketchLine_46.result() +) +SketchConstraintEqual_12 = Sketch_8.setEqual( + SketchLine_46.result(), SketchLine_48.result() +) +SketchConstraintEqual_13 = Sketch_8.setEqual( + SketchLine_48.result(), SketchLine_50.result() +) +SketchConstraintEqual_14 = Sketch_8.setEqual( + SketchLine_45.result(), SketchLine_47.result() +) +SketchConstraintEqual_15 = Sketch_8.setEqual( + SketchLine_47.result(), SketchLine_49.result() +) +SketchConstraintEqual_16 = Sketch_8.setEqual( + SketchLine_49.result(), SketchLine_51.result() +) +SketchConstraintDistanceHorizontal_4 = Sketch_8.setHorizontalDistance( + SketchLine_45.startPoint(), SketchLine_45.endPoint(), 1 +) +SketchConstraintDistanceHorizontal_5 = Sketch_8.setHorizontalDistance( + SketchLine_47.endPoint(), SketchLine_46.endPoint(), 1 +) +SketchConstraintDistanceVertical_6 = Sketch_8.setVerticalDistance( + SketchLine_44.endPoint(), SketchLine_46.startPoint(), 1 +) +SketchConstraintCoincidence_96 = Sketch_8.setCoincident( + SketchAPI_Point(SketchPoint_5).coordinates(), SketchLine_44.result() +) +SketchConstraintCoincidence_97 = Sketch_8.setCoincident( + SketchAPI_Point(SketchPoint_5).coordinates(), SketchLine_46.result() +) model.do() -Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchLine_44r-SketchLine_45f-SketchLine_46f-SketchLine_47f-SketchLine_48f-SketchLine_49f-SketchLine_50f-SketchLine_51f")], model.selection(), "size_y-5+3.8", "-size_y+5+2*chamfer") +Extrusion_3 = model.addExtrusion( + Part_1_doc, + [ + model.selection( + "FACE", + "Sketch_8/Face-SketchLine_44r-SketchLine_45f-SketchLine_46f-SketchLine_47f-SketchLine_48f-SketchLine_49f-SketchLine_50f-SketchLine_51f", + ) + ], + model.selection(), + "size_y-5+3.8", + "-size_y+5+2*chamfer", +) model.testNbResults(Extrusion_3, 1) model.testNbSubResults(Extrusion_3, [0]) @@ -528,9 +1275,24 @@ model.testNbSubShapes(Extrusion_3, GeomAPI_Shape.EDGE, [48]) model.testNbSubShapes(Extrusion_3, GeomAPI_Shape.VERTEX, [96]) model.testResultsVolumes(Extrusion_3, [124.2]) -Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "ExtrusionFuse_1_1"), model.selection("SOLID", "Extrusion_3_1")], model.selection("FACE", "PartSet/YOZ"), keepOriginal = True, keepSubResults = True) -Fuse_1_objects_1 = [model.selection("SOLID", "Cut_1_1"), model.selection("COMPOUND", "Symmetry_2_1"), model.selection("COMPOUND", "Symmetry_2_2")] -Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1, removeEdges = True, keepSubResults = True) +Symmetry_2 = model.addSymmetry( + Part_1_doc, + [ + model.selection("SOLID", "ExtrusionFuse_1_1"), + model.selection("SOLID", "Extrusion_3_1"), + ], + model.selection("FACE", "PartSet/YOZ"), + keepOriginal=True, + keepSubResults=True, +) +Fuse_1_objects_1 = [ + model.selection("SOLID", "Cut_1_1"), + model.selection("COMPOUND", "Symmetry_2_1"), + model.selection("COMPOUND", "Symmetry_2_2"), +] +Fuse_1 = model.addFuse( + Part_1_doc, Fuse_1_objects_1, removeEdges=True, keepSubResults=True +) Fuse_1.result().setName("Visor") model.testNbResults(Fuse_1, 1) diff --git a/test.models/wheel_rim.py b/test.models/wheel_rim.py index fad997c12..9b741c077 100644 --- a/test.models/wheel_rim.py +++ b/test.models/wheel_rim.py @@ -28,181 +28,429 @@ SketchLine_1 = Sketch_1.addLine(-70.81663645026607, 190, 229.1833635497339, 190) SketchLine_1.setAuxiliary(True) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchLine_2 = Sketch_1.addLine(16.64097565470627, 190, 22.64097565470627, 190) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_1.result() +) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchLine_1.result() +) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 6) -SketchArc_1 = Sketch_1.addArc(32.64097565470627, 190, 42.64097565470627, 190, 22.64097565470627, 190, True) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.result()) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.endPoint()) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_1.result()) +SketchArc_1 = Sketch_1.addArc( + 32.64097565470627, 190, 42.64097565470627, 190, 22.64097565470627, 190, True +) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_1.result() +) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident( + SketchLine_2.endPoint(), SketchArc_1.endPoint() +) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_1.result() +) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 10) SketchLine_3 = Sketch_1.addLine(42.64097565470627, 190, 147.6409756547063, 190) -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.startPoint()) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident( + SketchArc_1.startPoint(), SketchLine_3.startPoint() +) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_1.result() +) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_3.result(), 105) SketchLine_4 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX")) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_4.result(), 190) -SketchLine_5 = Sketch_1.addLine(167.6409756547062, 232.4170641625502, 167.6409756547062, 155.6475648742598) +SketchConstraintDistance_1 = Sketch_1.setDistance( + SketchLine_1.startPoint(), SketchLine_4.result(), 190 +) +SketchLine_5 = Sketch_1.addLine( + 167.6409756547062, 232.4170641625502, 167.6409756547062, 155.6475648742598 +) SketchLine_5.setAuxiliary(True) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result()) -SketchArc_2 = Sketch_1.addArc(147.6409756547063, 202.5, 147.6409756547063, 190, 160.1409756547063, 202.5, False) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_2.startPoint()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_2.results()[1]) +SketchArc_2 = Sketch_1.addArc( + 147.6409756547063, 202.5, 147.6409756547063, 190, 160.1409756547063, 202.5, False +) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchArc_2.startPoint() +) +SketchConstraintTangent_1 = Sketch_1.setTangent( + SketchLine_3.result(), SketchArc_2.results()[1] +) SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 12.5) SketchLine_6 = Sketch_1.addLine(147.6409756547063, 202.5, 147.6409756547063, 190) SketchLine_6.setAuxiliary(True) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_6.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_6.endPoint()) -SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_6.endPoint()) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_6.startPoint() +) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_6.endPoint() +) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_6.endPoint() +) SketchLine_7 = Sketch_1.addLine(160.1409756547063, 202.5, 147.6409756547063, 202.5) SketchLine_7.setAuxiliary(True) -SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_7.endPoint()) -SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_7.endPoint()) -SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_6.result(), SketchLine_7.result(), 90) -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_2.endPoint(), SketchLine_5.result(), 145) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchLine_7.startPoint() +) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchLine_7.endPoint() +) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchLine_7.endPoint() +) +SketchConstraintAngle_1 = Sketch_1.setAngle( + SketchLine_6.result(), SketchLine_7.result(), 90 +) +SketchConstraintDistance_2 = Sketch_1.setDistance( + SketchLine_2.endPoint(), SketchLine_5.result(), 145 +) SketchPoint_1 = Sketch_1.addPoint(167.6409756547062, 218.5857086760099) -SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_5.result()) -SketchArc_3 = Sketch_1.addArc(181.1409756547063, 202.5, 167.6409756547062, 218.5857086760099, 160.1409756547063, 202.5, False) -SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_3.startPoint()) -SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.endPoint()) -SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchArc_3.endPoint()) -SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1]) -SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchArc_2.results()[1]) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_5.result() +) +SketchArc_3 = Sketch_1.addArc( + 181.1409756547063, + 202.5, + 167.6409756547062, + 218.5857086760099, + 160.1409756547063, + 202.5, + False, +) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchArc_3.startPoint() +) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident( + SketchArc_2.endPoint(), SketchArc_3.endPoint() +) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident( + SketchLine_7.startPoint(), SketchArc_3.endPoint() +) +SketchConstraintTangent_2 = Sketch_1.setTangent( + SketchArc_2.results()[1], SketchArc_3.results()[1] +) +SketchConstraintTangent_3 = Sketch_1.setTangent( + SketchArc_3.results()[1], SketchArc_2.results()[1] +) model.do() # check overconstraint message appears -assert Sketch_1.solverError().value() != "", "FAILED: Sketch should report over-constrained situation" +assert ( + Sketch_1.solverError().value() != "" +), "FAILED: Sketch should report over-constrained situation" # remove duplicated Tangent constraint Part_1_doc.removeFeature(SketchConstraintTangent_3.feature()) model.do() -assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation" +assert ( + Sketch_1.solverError().value() == "" +), "FAILED: Sketch should NOT report over-constrained situation" # continue creating model SketchLine_8 = Sketch_1.addLine(16.64097565470627, 190, 16.64097565470627, 184) -SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident( + SketchLine_2.startPoint(), SketchLine_8.startPoint() +) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_8.result(), 6) SketchLine_9 = Sketch_1.addLine(16.64097565470627, 184, 169.1531000589648, 184) SketchLine_9.setAuxiliary(True) -SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident( + SketchLine_8.endPoint(), SketchLine_9.startPoint() +) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_9.result()) SketchLine_10 = Sketch_1.addLine(16.64097565470627, 184, 18.2409756547065, 184) -SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_10.startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident( + SketchLine_10.startPoint(), SketchLine_8.endPoint() +) SketchLine_11 = Sketch_1.addLine(147.6409756547063, 190, 147.6409756547063, 184) SketchLine_11.setAuxiliary(True) -SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_9.result()) -SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_11.result(), SketchLine_9.result()) -SketchArc_4 = Sketch_1.addArc(147.6409756547063, 202.5, 147.6409756547063, 184, 166.1409756547063, 202.5, False) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident( + SketchLine_3.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident( + SketchArc_2.startPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident( + SketchLine_6.endPoint(), SketchLine_11.startPoint() +) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_9.result() +) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular( + SketchLine_11.result(), SketchLine_9.result() +) +SketchArc_4 = Sketch_1.addArc( + 147.6409756547063, 202.5, 147.6409756547063, 184, 166.1409756547063, 202.5, False +) SketchArc_4.setName("SketchArc_5") SketchArc_4.result().setName("SketchArc_5") SketchArc_4.results()[1].setName("SketchArc_5_2") -SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_2.center(), SketchArc_4.center()) -SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchArc_4.center()) -SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchArc_4.center()) -SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchArc_4.startPoint()) -SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_7.result()) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident( + SketchArc_2.center(), SketchArc_4.center() +) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident( + SketchLine_6.startPoint(), SketchArc_4.center() +) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident( + SketchLine_7.endPoint(), SketchArc_4.center() +) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchArc_4.startPoint() +) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchLine_7.result() +) SketchLine_12 = Sketch_1.addLine(47.47337262898633, 184, 147.6409756547063, 184) -SketchArc_5 = Sketch_1.addArc(32.64097565470627, 190, 32.64097565470627, 174, 47.47337262898633, 184, False) +SketchArc_5 = Sketch_1.addArc( + 32.64097565470627, 190, 32.64097565470627, 174, 47.47337262898633, 184, False +) SketchArc_5.setName("SketchArc_10") SketchArc_5.result().setName("SketchArc_10") SketchArc_5.results()[1].setName("SketchArc_10_2") -SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_12.startPoint()) -SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.endPoint()) -SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchLine_12.endPoint()) -SketchArc_6 = Sketch_1.addArc(181.1409756547063, 202.5, 166.1409756547063, 202.5, 171.498118511849, 213.9897921211111, True) -SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchArc_6.startPoint()) -SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_6.center(), SketchArc_3.center()) -SketchLine_13 = Sketch_1.addLine(181.1409756547063, 202.5, 167.6409756547062, 218.5857086760099) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchLine_12.startPoint() +) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident( + SketchLine_11.endPoint(), SketchLine_12.endPoint() +) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident( + SketchArc_4.startPoint(), SketchLine_12.endPoint() +) +SketchArc_6 = Sketch_1.addArc( + 181.1409756547063, + 202.5, + 166.1409756547063, + 202.5, + 171.498118511849, + 213.9897921211111, + True, +) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident( + SketchArc_4.endPoint(), SketchArc_6.startPoint() +) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident( + SketchArc_6.center(), SketchArc_3.center() +) +SketchLine_13 = Sketch_1.addLine( + 181.1409756547063, 202.5, 167.6409756547062, 218.5857086760099 +) SketchLine_13.setAuxiliary(True) -SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchArc_6.center(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_13.endPoint()) -SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_13.endPoint()) -SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_13.result(), SketchArc_6.endPoint()) -SketchLine_14 = Sketch_1.addLine(167.6409756547062, 218.5857086760099, 171.498118511849, 213.9897921211111) -SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) -SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_14.endPoint()) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident( + SketchArc_6.center(), SketchLine_13.startPoint() +) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_13.endPoint() +) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchLine_13.endPoint() +) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident( + SketchLine_13.result(), SketchArc_6.endPoint() +) +SketchLine_14 = Sketch_1.addLine( + 167.6409756547062, 218.5857086760099, 171.498118511849, 213.9897921211111 +) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident( + SketchPoint_1.coordinates(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident( + SketchArc_3.startPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_42 = Sketch_1.setCoincident( + SketchLine_13.endPoint(), SketchLine_14.startPoint() +) +SketchConstraintCoincidence_43 = Sketch_1.setCoincident( + SketchArc_6.endPoint(), SketchLine_14.endPoint() +) SketchLine_15 = Sketch_1.addLine(32.64097565470627, 190, 32.64097565470627, 174) SketchLine_15.setAuxiliary(True) -SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchArc_5.startPoint()) +SketchConstraintCoincidence_44 = Sketch_1.setCoincident( + SketchArc_1.center(), SketchLine_15.startPoint() +) +SketchConstraintCoincidence_45 = Sketch_1.setCoincident( + SketchLine_15.endPoint(), SketchArc_5.startPoint() +) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_15.result()) SketchLine_16 = Sketch_1.addLine(32.64097565470627, 174, 12.64097565470628, 174) -SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) -SketchArc_7 = Sketch_1.addArc(12.64097565470628, 165, 12.64097565470628, 174, 3.640975654706275, 165, False) -SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchArc_7.startPoint()) +SketchConstraintCoincidence_46 = Sketch_1.setCoincident( + SketchLine_15.endPoint(), SketchLine_16.startPoint() +) +SketchArc_7 = Sketch_1.addArc( + 12.64097565470628, 165, 12.64097565470628, 174, 3.640975654706275, 165, False +) +SketchConstraintCoincidence_47 = Sketch_1.setCoincident( + SketchLine_16.endPoint(), SketchArc_7.startPoint() +) SketchLine_17 = Sketch_1.addLine(3.640975654706275, 165, 3.640975654706275, 100) -SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchArc_7.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_48 = Sketch_1.setCoincident( + SketchArc_7.endPoint(), SketchLine_17.startPoint() +) SketchLine_18 = Sketch_1.addLine(3.640975654706275, 100, -5.359024345293726, 100) -SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_49 = Sketch_1.setCoincident( + SketchLine_17.endPoint(), SketchLine_18.startPoint() +) SketchLine_19 = Sketch_1.addLine(-5.359024345293726, 100, -5.359024345293726, 165) -SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_50 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchLine_19.startPoint() +) SketchLine_20 = Sketch_1.addLine(-5.359024345293726, 165, -5.359024345293726, 100) -SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_52 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_20.endPoint()) -SketchConstraintCoincidence_53 = Sketch_1.setCoincident(SketchLine_19.startPoint(), SketchLine_20.endPoint()) +SketchConstraintCoincidence_51 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchLine_20.startPoint() +) +SketchConstraintCoincidence_52 = Sketch_1.setCoincident( + SketchLine_18.endPoint(), SketchLine_20.endPoint() +) +SketchConstraintCoincidence_53 = Sketch_1.setCoincident( + SketchLine_19.startPoint(), SketchLine_20.endPoint() +) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_16.result()) SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_18.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_17.result()) SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_20.result()) -SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_16.result(), SketchArc_7.results()[1]) -SketchConstraintTangent_5 = Sketch_1.setTangent(SketchLine_17.result(), SketchArc_7.results()[1]) +SketchConstraintTangent_4 = Sketch_1.setTangent( + SketchLine_16.result(), SketchArc_7.results()[1] +) +SketchConstraintTangent_5 = Sketch_1.setTangent( + SketchLine_17.result(), SketchArc_7.results()[1] +) SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_7.results()[1], 9) SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_20.result(), 65) -SketchLine_21 = Sketch_1.addLine(12.64097565470628, 174, 12.64097565470628, 192.2067667108204) +SketchLine_21 = Sketch_1.addLine( + 12.64097565470628, 174, 12.64097565470628, 192.2067667108204 +) SketchLine_21.setName("SketchLine_22") SketchLine_21.result().setName("SketchLine_22") SketchLine_21.setAuxiliary(True) -SketchConstraintCoincidence_54 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_21.startPoint()) -SketchConstraintCoincidence_55 = Sketch_1.setCoincident(SketchArc_7.startPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_54 = Sketch_1.setCoincident( + SketchLine_16.endPoint(), SketchLine_21.startPoint() +) +SketchConstraintCoincidence_55 = Sketch_1.setCoincident( + SketchArc_7.startPoint(), SketchLine_21.startPoint() +) SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_21.result()) SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_16.result(), 20) -SketchArc_8 = Sketch_1.addArc(12.64097565470628, 165, -5.359024345293726, 165, 12.64097565470625, 183, True) -SketchConstraintCoincidence_56 = Sketch_1.setCoincident(SketchArc_7.center(), SketchArc_8.center()) -SketchConstraintCoincidence_57 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchArc_8.startPoint()) -SketchConstraintCoincidence_58 = Sketch_1.setCoincident(SketchLine_20.startPoint(), SketchArc_8.startPoint()) -SketchConstraintCoincidence_59 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchLine_21.result()) +SketchArc_8 = Sketch_1.addArc( + 12.64097565470628, 165, -5.359024345293726, 165, 12.64097565470625, 183, True +) +SketchConstraintCoincidence_56 = Sketch_1.setCoincident( + SketchArc_7.center(), SketchArc_8.center() +) +SketchConstraintCoincidence_57 = Sketch_1.setCoincident( + SketchLine_19.endPoint(), SketchArc_8.startPoint() +) +SketchConstraintCoincidence_58 = Sketch_1.setCoincident( + SketchLine_20.startPoint(), SketchArc_8.startPoint() +) +SketchConstraintCoincidence_59 = Sketch_1.setCoincident( + SketchArc_8.endPoint(), SketchLine_21.result() +) SketchLine_22 = Sketch_1.addLine(12.64097565470625, 183, 18.2409756547065, 183) SketchLine_22.setName("SketchLine_23") SketchLine_22.result().setName("SketchLine_23") -SketchConstraintCoincidence_60 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchLine_22.startPoint()) +SketchConstraintCoincidence_60 = Sketch_1.setCoincident( + SketchArc_8.endPoint(), SketchLine_22.startPoint() +) SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_22.result()) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_18.startPoint(), SketchLine_19.result(), 9) +SketchConstraintDistance_3 = Sketch_1.setDistance( + SketchLine_18.startPoint(), SketchLine_19.result(), 9 +) SketchLine_23 = Sketch_1.addLine(18.2409756547065, 183, 18.2409756547065, 184) SketchLine_23.setName("SketchLine_24") SketchLine_23.result().setName("SketchLine_24") -SketchConstraintCoincidence_61 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) -SketchConstraintCoincidence_62 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_23.endPoint()) +SketchConstraintCoincidence_61 = Sketch_1.setCoincident( + SketchLine_22.endPoint(), SketchLine_23.startPoint() +) +SketchConstraintCoincidence_62 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_23.endPoint() +) SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_23.result()) -SketchConstraintCoincidence_63 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_64 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_9.result()) -SketchConstraintCoincidence_65 = Sketch_1.setCoincident(SketchArc_5.center(), SketchLine_15.startPoint()) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_10.startPoint(), SketchLine_23.result(), 1.6, True) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_10.startPoint(), SketchLine_22.result(), 1, True) +SketchConstraintCoincidence_63 = Sketch_1.setCoincident( + SketchArc_5.endPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_64 = Sketch_1.setCoincident( + SketchLine_10.endPoint(), SketchLine_9.result() +) +SketchConstraintCoincidence_65 = Sketch_1.setCoincident( + SketchArc_5.center(), SketchLine_15.startPoint() +) +SketchConstraintDistance_4 = Sketch_1.setDistance( + SketchLine_10.startPoint(), SketchLine_23.result(), 1.6, True +) +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_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) +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")) SketchLine_24.setName("SketchLine_25") SketchLine_24.result().setName("SketchLine_25") -SketchConstraintCoincidence_66 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchLine_24.result()) +SketchConstraintCoincidence_66 = Sketch_2.setCoincident( + SketchCircle_1.center(), SketchLine_24.result() +) SketchLine_25 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_25.setName("SketchLine_26") SketchLine_25.result().setName("SketchLine_26") -SketchConstraintDistance_6 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_25.result(), 120) +SketchConstraintDistance_6 = Sketch_2.setDistance( + SketchCircle_1.center(), SketchLine_25.result(), 120 +) SketchConstraintRadius_5 = Sketch_2.setRadius(SketchCircle_1.results()[1], 7.5) -SketchMultiRotation_1 = Sketch_2.addRotation([SketchCircle_1.results()[1]], SketchLine_24.startPoint(), 24, 15) -[SketchCircle_2, SketchCircle_3, SketchCircle_4, SketchCircle_5, SketchCircle_6, SketchCircle_7, SketchCircle_8, SketchCircle_9, SketchCircle_10, SketchCircle_11, SketchCircle_12, SketchCircle_13, SketchCircle_14, SketchCircle_15] = SketchMultiRotation_1.rotated() +SketchMultiRotation_1 = Sketch_2.addRotation( + [SketchCircle_1.results()[1]], SketchLine_24.startPoint(), 24, 15 +) +[ + SketchCircle_2, + SketchCircle_3, + SketchCircle_4, + SketchCircle_5, + SketchCircle_6, + SketchCircle_7, + SketchCircle_8, + SketchCircle_9, + SketchCircle_10, + SketchCircle_11, + SketchCircle_12, + SketchCircle_13, + SketchCircle_14, + SketchCircle_15, +] = SketchMultiRotation_1.rotated() model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 10, 10) -Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_6"), model.selection("SOLID", "Extrusion_1_8"), model.selection("SOLID", "Extrusion_1_9"), model.selection("SOLID", "Extrusion_1_3"), model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_4"), model.selection("SOLID", "Extrusion_1_14"), model.selection("SOLID", "Extrusion_1_5"), model.selection("SOLID", "Extrusion_1_15"), model.selection("SOLID", "Extrusion_1_11"), model.selection("SOLID", "Extrusion_1_10"), model.selection("SOLID", "Extrusion_1_12"), model.selection("SOLID", "Extrusion_1_13"), model.selection("SOLID", "Extrusion_1_7")]) +Extrusion_1 = model.addExtrusion( + Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 10, 10 +) +Boolean_1 = model.addCut( + Part_1_doc, + [model.selection("SOLID", "Revolution_1_1")], + [ + model.selection("SOLID", "Extrusion_1_6"), + model.selection("SOLID", "Extrusion_1_8"), + model.selection("SOLID", "Extrusion_1_9"), + model.selection("SOLID", "Extrusion_1_3"), + model.selection("SOLID", "Extrusion_1_2"), + model.selection("SOLID", "Extrusion_1_1"), + model.selection("SOLID", "Extrusion_1_4"), + model.selection("SOLID", "Extrusion_1_14"), + model.selection("SOLID", "Extrusion_1_5"), + model.selection("SOLID", "Extrusion_1_15"), + model.selection("SOLID", "Extrusion_1_11"), + model.selection("SOLID", "Extrusion_1_10"), + model.selection("SOLID", "Extrusion_1_12"), + model.selection("SOLID", "Extrusion_1_13"), + model.selection("SOLID", "Extrusion_1_7"), + ], +) model.end() from GeomAPI import GeomAPI_Shape @@ -215,4 +463,4 @@ model.testNbSubShapes(Boolean_1, GeomAPI_Shape.EDGE, [162]) model.testNbSubShapes(Boolean_1, GeomAPI_Shape.VERTEX, [324]) model.testResultsVolumes(Boolean_1, [2052731.260104598477482795715332031]) -assert(model.checkPythonDump()) +assert model.checkPythonDump() diff --git a/test.squish/shared/scripts/common.py b/test.squish/shared/scripts/common.py index d9b195a46..c4e6e4d8e 100644 --- a/test.squish/shared/scripts/common.py +++ b/test.squish/shared/scripts/common.py @@ -24,14 +24,20 @@ import shutil testSettings.logScreenshotOnError = True testSettings.logScreenshotOnFail = True # RESULTS_PATH = "/dn48/SHAPER/eso/sources/test.squish/shared/testresults/" -DATA_PATH = os.getenv('TEST_DATA_DIR') -TMP_DIR = os.path.join(DATA_PATH, 'tmp') +DATA_PATH = os.getenv("TEST_DATA_DIR") +TMP_DIR = os.path.join(DATA_PATH, "tmp") + +g_points = { + "XY_plane": (332, 250), + "XZ_plane": (355, 207), +} # one of the construction planes + -g_points = {"XY_plane": (332, 250), "XZ_plane": (355, 207)} # one of the construction planes def help_points(name): return g_points[name] -#--------------------------------------------------------------------------------------------- + +# --------------------------------------------------------------------------------------------- # Tools def findMenuItem(menuObject, item): for child in object.children(menuObject): @@ -39,58 +45,78 @@ def findMenuItem(menuObject, item): return child return None -#--------------------------------------------------------------------------------------------- + +# --------------------------------------------------------------------------------------------- # Tools for Property Panel def getPropertyPanelRealName(): return "{name='property_panel_dock' type='XGUI_PropertyPanel' visible='1' window=':SALOME*_STD_TabDesktop'}" + def getSpinBoxRealName(name): - return "{container=%s name='%s' type='ModuleBase_ParamSpinBox' visible='1'}" % (getPropertyPanelRealName(), name) + return "{container=%s name='%s' type='ModuleBase_ParamSpinBox' visible='1'}" % ( + getPropertyPanelRealName(), + name, + ) + -#--------------------------------------------------------------------------------------------- +# --------------------------------------------------------------------------------------------- def create_tmp(): remove_tmp() os.makedirs(TMP_DIR) + def remove_tmp(): if os.path.exists(TMP_DIR): shutil.rmtree(TMP_DIR) -#--------------------------------------------------------------------------------------------- + +# --------------------------------------------------------------------------------------------- def set_defaults(): waitForObject(":SALOME*_STD_TabDesktop").resize(1024, 768) create_tmp() + def activate_SHAPER(): clickButton(waitForObject(":SALOME*.Shaper_QToolButton")) clickButton(waitForObject(":Activate module.New_QPushButton")) + def close_application(): sendEvent("QCloseEvent", waitForObject(":SALOME*_STD_TabDesktop")) clickButton(waitForObject(":Exit.Ok_QPushButton")) clickButton(waitForObject(":Close active study.Close w/o saving_QPushButton")) -# snooze(10) + # snooze(10) remove_tmp() + def close_application_wo_saving(): sendEvent("QCloseEvent", waitForObject(":SALOME*_STD_TabDesktop")) clickButton(waitForObject(":Exit.Ok_QPushButton")) clickButton(waitForObject(":Close active study.Close w/o saving_QPushButton")) remove_tmp() + def part_create(): activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part")) activateItem(waitForObjectItem(":Part_QMenu", "New part")) + def sketch_create(point, actions): clickButton(waitForObject(":SALOME*.Sketch_QToolButton")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point[0], point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point[0], + point[1], + 0, + Qt.LeftButton, + ) activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) actions() clickButton(waitForObject(":Sketch.property_panel_ok_QToolButton")) + def point_create_in_view(point, aux=0): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Point")) @@ -98,9 +124,16 @@ def point_create_in_view(point, aux=0): if aux == 1: clickButton(waitForObject(":Point.Auxiliary_QCheckBox")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point[0], point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point[0], + point[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Point.property_panel_cancel_QToolButton")) + def point_create(point, aux=0): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Point")) @@ -116,6 +149,7 @@ def point_create(point, aux=0): clickButton(waitForObject(":Point.property_panel_ok_QToolButton")) + def line_create_in_view(start_point, end_point, aux=0): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Line")) @@ -123,11 +157,24 @@ def line_create_in_view(start_point, end_point, aux=0): if aux == 1: clickButton(waitForObject(":Line.Auxiliary_QCheckBox")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), start_point[0], start_point[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), end_point[0], end_point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + start_point[0], + start_point[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + end_point[0], + end_point[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Line.property_panel_cancel_QToolButton")) + def closing_line_create_in_view(start_point, end_point, aux=0): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Line")) @@ -135,8 +182,21 @@ def closing_line_create_in_view(start_point, end_point, aux=0): if aux == 1: clickButton(waitForObject(":Line.Auxiliary_QCheckBox")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), start_point[0], start_point[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), end_point[0], end_point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + start_point[0], + start_point[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + end_point[0], + end_point[1], + 0, + Qt.LeftButton, + ) + def lines_create_in_view(points, aux=0): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) @@ -146,11 +206,19 @@ def lines_create_in_view(points, aux=0): clickButton(waitForObject(":Line.Auxiliary_QCheckBox")) for point in points: - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point[0], point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point[0], + point[1], + 0, + Qt.LeftButton, + ) + def lines_close(): clickButton(waitForObject(":Line.property_panel_cancel_QToolButton")) + def line_create(start_point, end_point, aux=0): # Set aux=1 to create auxiliary line mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Line")) @@ -172,6 +240,7 @@ def line_create(start_point, end_point, aux=0): # Set aux=1 to create auxiliary clickButton(waitForObject(":Line.property_panel_ok_QToolButton")) + def circle_create_in_view(center, radius, aux=0): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Circle")) @@ -179,11 +248,24 @@ def circle_create_in_view(center, radius, aux=0): if aux == 1: clickButton(waitForObject(":Circle.Auxiliary_QCheckBox")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), center[0], center[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), radius[0], radius[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + center[0], + center[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + radius[0], + radius[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Circle.property_panel_cancel_QToolButton")) + def circle_create(center, radius, aux=0): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Circle")) @@ -202,6 +284,7 @@ def circle_create(center, radius, aux=0): clickButton(waitForObject(":Circle.property_panel_ok_QToolButton")) + def arc_create(center, start_point, end_point, aux=0): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Arc")) @@ -229,6 +312,7 @@ def arc_create(center, start_point, end_point, aux=0): clickButton(waitForObject(":Arc.property_panel_ok_QToolButton")) + def arc_create_in_view(center, start_point, end_point, aux=0): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Arc")) @@ -236,12 +320,31 @@ def arc_create_in_view(center, start_point, end_point, aux=0): if aux == 1: clickButton(waitForObject(":Arc.Auxiliary_QCheckBox")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), center[0], center[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), start_point[0], start_point[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), end_point[0], end_point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + center[0], + center[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + start_point[0], + start_point[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + end_point[0], + end_point[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Arc.property_panel_cancel_QToolButton")) + def save(filename): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "File")) mouseClick(waitForObjectItem(":_QMenu", "Save As...")) @@ -249,11 +352,18 @@ def save(filename): type(waitForObject(":fileNameEdit_QLineEdit"), filename) clickButton(waitForObject(":Save File.Save_QPushButton")) + def extrusion(point, to_size, from_size): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Features")) mouseClick(waitForObjectItem(":_QMenu", "Extrusion")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point[0], point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point[0], + point[1], + 0, + Qt.LeftButton, + ) type(waitForObject(":Extrusion.to_size_ModuleBase_ParamSpinBox"), "") type(waitForObject(":Extrusion.to_size_ModuleBase_ParamSpinBox"), to_size) @@ -263,187 +373,417 @@ def extrusion(point, to_size, from_size): clickButton(waitForObject(":Extrusion.property_panel_ok_QToolButton")) + def open(filename): clickButton(waitForObject(":SALOME*.Open_QToolButton")) waitForObject(":fileNameEdit_QLineEdit_2").setText(filename) type(waitForObject(":fileNameEdit_QLineEdit_2"), "") + def point_fixe(point): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Fixed")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point[0], point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point[0], + point[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Fixed.property_panel_cancel_QToolButton")) def distance(start_point, end_point, annotation_point): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Distance")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), start_point[0], start_point[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), end_point[0], end_point[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), annotation_point[0], annotation_point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + start_point[0], + start_point[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + end_point[0], + end_point[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + annotation_point[0], + annotation_point[1], + 0, + Qt.LeftButton, + ) # if length!=0: - # type(waitForObject(":_ModuleBase_ParamSpinBox"), "") - # type(waitForObject(":_ModuleBase_ParamSpinBox"), length) + # type(waitForObject(":_ModuleBase_ParamSpinBox"), "") + # type(waitForObject(":_ModuleBase_ParamSpinBox"), length) clickButton(waitForObject(":Distance.property_panel_cancel_QToolButton")) + def change_distance(point, value): - doubleClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point[0], point[1], 0, Qt.LeftButton) + doubleClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point[0], + point[1], + 0, + Qt.LeftButton, + ) type(waitForObject(":Distance.ConstraintValue_ModuleBase_ParamSpinBox"), "") type(waitForObject(":Distance.ConstraintValue_ModuleBase_ParamSpinBox"), value) clickButton(waitForObject(":Distance.property_panel_ok_QToolButton")) + def parallel(point_1, point_2): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Parallel")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point_1[0], point_1[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point_2[0], point_2[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point_1[0], + point_1[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point_2[0], + point_2[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Parallel.property_panel_cancel_QToolButton_2")) + def perpendicular(point_1, point_2): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Perpendicular")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point_1[0], point_1[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point_2[0], point_2[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point_1[0], + point_1[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point_2[0], + point_2[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Perpendicular.property_panel_cancel_QToolButton")) + def coincident(point_1, point_2): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Coincident")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point_1[0], point_1[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point_2[0], point_2[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point_1[0], + point_1[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point_2[0], + point_2[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Coincident.property_panel_cancel_QToolButton")) + def equal(point_1, point_2): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Equal")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point_1[0], point_1[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point_2[0], point_2[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point_1[0], + point_1[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point_2[0], + point_2[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Equal.property_panel_cancel_QToolButton")) + def vertical(point): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Vertical")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point[0], point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point[0], + point[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Vertical.property_panel_cancel_QToolButton")) + def horizontal(point): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Horizontal")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point[0], point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point[0], + point[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Horizontal.property_panel_cancel_QToolButton")) + def fit_all(): clickButton(waitForObject(":SALOME*.Fit All_QToolButton")) + def boolean_select_operation_type(type): - real_name = "{container=':property_panel_dock.Operation type_QGroupBox' toolTip='%s' type='QToolButton' unnamed='1' visible='1'}" % type + real_name = ( + "{container=':property_panel_dock.Operation type_QGroupBox' toolTip='%s' type='QToolButton' unnamed='1' visible='1'}" + % type + ) clickButton(waitForObject(real_name)) + def boolean_cut(main_object, tool_object): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Features")) mouseClick(waitForObjectItem(":_QMenu", "Boolean")) boolean_select_operation_type("Cut") - mouseClick(waitForObject(":Boolean.Main objects_QListWidget"), 89, 62, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), main_object[0], main_object[1], 0, Qt.LeftButton) - - mouseClick(waitForObject(":Boolean.Tool object_QListWidget"), 98, 87, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), tool_object[0], tool_object[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":Boolean.Main objects_QListWidget"), 89, 62, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + main_object[0], + main_object[1], + 0, + Qt.LeftButton, + ) + + mouseClick( + waitForObject(":Boolean.Tool object_QListWidget"), 98, 87, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + tool_object[0], + tool_object[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) + def boolean_fuse(main_object, tool_object): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Features")) mouseClick(waitForObjectItem(":_QMenu", "Boolean")) boolean_select_operation_type("Fuse") - mouseClick(waitForObject(":Boolean.Main objects_QListWidget"), 89, 62, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), main_object[0], main_object[1], 0, Qt.LeftButton) - - mouseClick(waitForObject(":Boolean.Tool object_QListWidget"), 98, 87, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), tool_object[0], tool_object[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":Boolean.Main objects_QListWidget"), 89, 62, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + main_object[0], + main_object[1], + 0, + Qt.LeftButton, + ) + + mouseClick( + waitForObject(":Boolean.Tool object_QListWidget"), 98, 87, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + tool_object[0], + tool_object[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) + def boolean_common(main_object, tool_object): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Features")) mouseClick(waitForObjectItem(":_QMenu", "Boolean")) boolean_select_operation_type("Common") - mouseClick(waitForObject(":Boolean.Main objects_QListWidget"), 89, 62, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), main_object[0], main_object[1], 0, Qt.LeftButton) - - mouseClick(waitForObject(":Boolean.Tool object_QListWidget"), 98, 87, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), tool_object[0], tool_object[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":Boolean.Main objects_QListWidget"), 89, 62, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + main_object[0], + main_object[1], + 0, + Qt.LeftButton, + ) + + mouseClick( + waitForObject(":Boolean.Tool object_QListWidget"), 98, 87, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + tool_object[0], + tool_object[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) + def length(point, annotation_point): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Length")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point[0], point[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), annotation_point[0], annotation_point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point[0], + point[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + annotation_point[0], + annotation_point[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Length.property_panel_cancel_QToolButton")) + def change_length(point, value): - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point[0], point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point[0], + point[1], + 0, + Qt.LeftButton, + ) type(waitForObject(":Length.ConstraintValue_ModuleBase_ParamSpinBox"), "") type(waitForObject(":Length.ConstraintValue_ModuleBase_ParamSpinBox"), value) clickButton(waitForObject(":Length.property_panel_ok_QToolButton")) + def radius(point, annotation_point): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Radius")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point[0], point[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), annotation_point[0], annotation_point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point[0], + point[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + annotation_point[0], + annotation_point[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Radius.property_panel_cancel_QToolButton")) + def change_radius(point, value): - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point[0], point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point[0], + point[1], + 0, + Qt.LeftButton, + ) type(waitForObject(":Radius.ConstraintValue_ModuleBase_ParamSpinBox"), "") type(waitForObject(":Radius.ConstraintValue_ModuleBase_ParamSpinBox"), value) clickButton(waitForObject(":Radius.property_panel_ok_QToolButton")) + def tangent(point_1, point_2): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Tangent")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point_1[0], point_1[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point_2[0], point_2[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point_1[0], + point_1[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point_2[0], + point_2[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Tangent.property_panel_cancel_QToolButton")) + def partition(main_objects, tool_object): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Features")) mouseClick(waitForObjectItem(":_QMenu", "Partition")) for main_object in main_objects: - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), main_object[0], main_object[1], 33554432, Qt.LeftButton) - - mouseClick(waitForObject(":Boolean.Tool object_QListWidget"), 83, 132, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), tool_object[0], tool_object[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + main_object[0], + main_object[1], + 33554432, + Qt.LeftButton, + ) + + mouseClick( + waitForObject(":Boolean.Tool object_QListWidget"), 83, 132, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + tool_object[0], + tool_object[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) + def plane(point, distance): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Construction")) mouseClick(waitForObjectItem(":_QMenu", "Plane")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point[0], point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point[0], + point[1], + 0, + Qt.LeftButton, + ) type(waitForObject(":Plane.distance_ModuleBase_ParamSpinBox"), "") type(waitForObject(":Plane.distance_ModuleBase_ParamSpinBox"), 100) @@ -451,6 +791,7 @@ def plane(point, distance): clickButton(waitForObject(":Plane.property_panel_ok_QToolButton")) + def point(x, y, z): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Construction")) mouseClick(waitForObjectItem(":_QMenu", "Point")) @@ -467,19 +808,28 @@ def point(x, y, z): clickButton(waitForObject(":Point.property_panel_ok_QToolButton")) + def axis(point_1, point_2): mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Construction")) mouseClick(waitForObjectItem(":_QMenu", "Axis")) - mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point_1[0] - 40, point_1[1] - 40, 80, 80, 1, Qt.LeftButton) - mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point_2[0] - 40, point_2[1] - 40, 80, 80, 1, Qt.LeftButton) + mouseDrag( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point_1[0] - 40, + point_1[1] - 40, + 80, + 80, + 1, + Qt.LeftButton, + ) + mouseDrag( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point_2[0] - 40, + point_2[1] - 40, + 80, + 80, + 1, + Qt.LeftButton, + ) clickButton(waitForObject(":Axis.property_panel_ok_QToolButton")) - - - - - - - - diff --git a/test.squish/suite_ERROR_NOTIFICATION/tst_679/test.py b/test.squish/suite_ERROR_NOTIFICATION/tst_679/test.py index db5d64ce0..9cb2b6db3 100644 --- a/test.squish/suite_ERROR_NOTIFICATION/tst_679/test.py +++ b/test.squish/suite_ERROR_NOTIFICATION/tst_679/test.py @@ -17,7 +17,8 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#[tested functionality] 1. Add parameter 2. Use wrong parameter name 3. Error notification in header 3. Error notification in widget +# [tested functionality] 1. Add parameter 2. Use wrong parameter name 3. Error notification in header 3. Error notification in widget + def main(): source(findFile("scripts", "common.py")) @@ -38,16 +39,23 @@ def main(): type(waitForObject(":Point.x_ModuleBase_ParamSpinBox"), "") waitFor("object.exists(':Point.x_ModuleBase_ParamSpinBox')", 20000) - test.compare(str(findObject(":Point.x_ModuleBase_ParamSpinBox").toolTip), "X coordinate") + test.compare( + str(findObject(":Point.x_ModuleBase_ParamSpinBox").toolTip), "X coordinate" + ) type(waitForObject(":Point.x_ModuleBase_ParamSpinBox"), "") type(waitForObject(":Point.x_ModuleBase_ParamSpinBox"), "b") type(waitForObject(":Point.x_ModuleBase_ParamSpinBox"), "") waitFor("object.exists(':Point_QFrame')", 20000) - test.compare(str(findObject(":Point_QFrame").toolTip), "ModelAPI_StateInvalidArgument") + test.compare( + str(findObject(":Point_QFrame").toolTip), "ModelAPI_StateInvalidArgument" + ) waitFor("object.exists(':Point.x_ModuleBase_ParamSpinBox')", 20000) - test.compare(str(findObject(":Point.x_ModuleBase_ParamSpinBox").toolTip), "X coordinate\nErrors:\nx - Model_AttributeValidator: name 'b' is not defined") + test.compare( + str(findObject(":Point.x_ModuleBase_ParamSpinBox").toolTip), + "X coordinate\nErrors:\nx - Model_AttributeValidator: name 'b' is not defined", + ) close_application() diff --git a/test.squish/suite_FEATURE_BOOLEAN/tst_boolean_001/test.py b/test.squish/suite_FEATURE_BOOLEAN/tst_boolean_001/test.py index d8e90ec84..d4f4500de 100644 --- a/test.squish/suite_FEATURE_BOOLEAN/tst_boolean_001/test.py +++ b/test.squish/suite_FEATURE_BOOLEAN/tst_boolean_001/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): # [project] SHAPER # [Scenario] Boolean_001 @@ -42,8 +43,21 @@ def main(): # [step] Activate Part_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 48, 10, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 48, 10, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1 (Not loaded)", + 48, + 10, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 48, + 10, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) # [step] Fit all diff --git a/test.squish/suite_FEATURE_BOOLEAN/tst_boolean_002/test.py b/test.squish/suite_FEATURE_BOOLEAN/tst_boolean_002/test.py index 4f63a91e7..b27409793 100644 --- a/test.squish/suite_FEATURE_BOOLEAN/tst_boolean_002/test.py +++ b/test.squish/suite_FEATURE_BOOLEAN/tst_boolean_002/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): # [project] SHAPER # [Scenario] Boolean_002 @@ -42,8 +43,21 @@ def main(): # [step] Activate Part_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 48, 10, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 48, 10, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1 (Not loaded)", + 48, + 10, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 48, + 10, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) # [step] Fit all diff --git a/test.squish/suite_FEATURE_BOOLEAN/tst_boolean_003/test.py b/test.squish/suite_FEATURE_BOOLEAN/tst_boolean_003/test.py index bbb07bbb9..92d460e28 100644 --- a/test.squish/suite_FEATURE_BOOLEAN/tst_boolean_003/test.py +++ b/test.squish/suite_FEATURE_BOOLEAN/tst_boolean_003/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): # [project] SHAPER # [Scenario] Boolean_003 @@ -42,8 +43,21 @@ def main(): # [step] Activate Part_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 48, 10, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 48, 10, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1 (Not loaded)", + 48, + 10, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 48, + 10, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) # [step] Fit all diff --git a/test.squish/suite_FEATURE_CONSTRUCTION/tst_construction_001/test.py b/test.squish/suite_FEATURE_CONSTRUCTION/tst_construction_001/test.py index b5e0e698e..79b58401b 100644 --- a/test.squish/suite_FEATURE_CONSTRUCTION/tst_construction_001/test.py +++ b/test.squish/suite_FEATURE_CONSTRUCTION/tst_construction_001/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): # [project] SHAPER # [Scenario] Construction_001 @@ -42,8 +43,21 @@ def main(): # [step] Activate Part_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 71, 10, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 70, 9, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1 (Not loaded)", + 71, + 10, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 70, + 9, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) # [step] Fit all diff --git a/test.squish/suite_FEATURE_EXCHANGE/tst_STL-import/import.py b/test.squish/suite_FEATURE_EXCHANGE/tst_STL-import/import.py index a184a0b1e..ec17ef4b8 100644 --- a/test.squish/suite_FEATURE_EXCHANGE/tst_STL-import/import.py +++ b/test.squish/suite_FEATURE_EXCHANGE/tst_STL-import/import.py @@ -1,14 +1,17 @@ from salome.shaper import model import os -stlDataDir = os.environ.get('SALOME_SRC_DIR')+ "/../SHAPER/test.squish/shared/testdata/exchange/stl-examples" +stlDataDir = ( + os.environ.get("SALOME_SRC_DIR") + + "/../SHAPER/test.squish/shared/testdata/exchange/stl-examples" +) model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Import_1 = model.addImport(Part_1_doc, stlDataDir+"/cubeCylinder_BIN.stl") -Import_2 = model.addImport(Part_1_doc, stlDataDir+"/cubeCylinder_ASCII.stl") +Import_1 = model.addImport(Part_1_doc, stlDataDir + "/cubeCylinder_BIN.stl") +Import_2 = model.addImport(Part_1_doc, stlDataDir + "/cubeCylinder_ASCII.stl") model.do() Import_1.setName("Compound_1") Import_1.result().setName("Compound_1_1") diff --git a/test.squish/suite_FEATURE_EXCHANGE/tst_XAO-export/test.py b/test.squish/suite_FEATURE_EXCHANGE/tst_XAO-export/test.py index c6ae79343..3f9d149f7 100644 --- a/test.squish/suite_FEATURE_EXCHANGE/tst_XAO-export/test.py +++ b/test.squish/suite_FEATURE_EXCHANGE/tst_XAO-export/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): # [project] NewGEOM # [Scenario] XAO-export @@ -41,12 +42,23 @@ def main(): activateItem(waitForObjectItem(":Part_QMenu", "New part")) # [step] Import file 'exchange/xao/Box_1.brep' - export_file_path = os.path.join(DATA_PATH, 'exchange', 'xao', 'Box_1.brep'); + export_file_path = os.path.join(DATA_PATH, "exchange", "xao", "Box_1.brep") activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part")) activateItem(waitForObjectItem(":Part_QMenu", "Import")) - mouseClick(waitForObject(":property_panel_dock...._QPushButton"), 10, 10, 0, Qt.LeftButton) - mouseClick(waitForObjectItem(":property_panel_dock.fileTypeCombo_QComboBox", "BREP files (*\\.BREP *\\.BRP)"), 10, 10, 0, Qt.LeftButton) + mouseClick( + waitForObject(":property_panel_dock...._QPushButton"), 10, 10, 0, Qt.LeftButton + ) + mouseClick( + waitForObjectItem( + ":property_panel_dock.fileTypeCombo_QComboBox", + "BREP files (*\\.BREP *\\.BRP)", + ), + 10, + 10, + 0, + Qt.LeftButton, + ) type(waitForObject(":fileNameEdit_QLineEdit_3"), export_file_path) type(waitForObject(":fileNameEdit_QLineEdit_3"), "") clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) @@ -60,11 +72,29 @@ def main(): activateItem(waitForObjectItem(":_QMenu", "Group")) # [step] Select type: Solids - mouseClick(waitForObjectItem(":property_panel_dock.Type_QComboBox", "Solids"), 10, 10, 0, Qt.LeftButton) + mouseClick( + waitForObjectItem(":property_panel_dock.Type_QComboBox", "Solids"), + 10, + 10, + 0, + Qt.LeftButton, + ) # [step] Select the imported box [vp SELECTED_SOLIDS] - mouseClick(waitForObject(":property_panel_dock.Selected objects:_QListWidget"), 10, 10, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 310, 147, 0, Qt.LeftButton) + mouseClick( + waitForObject(":property_panel_dock.Selected objects:_QListWidget"), + 10, + 10, + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 310, + 147, + 0, + Qt.LeftButton, + ) test.vp("SELECTED_SOLIDS") # [step] Apply the feature @@ -72,17 +102,30 @@ def main(): # [step] Rename the Group_1 result to: boite_1 # rename feature -# waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Group\\_1") -# clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Group\\_1", 10, 10, 0, Qt.LeftButton) -# openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Group\\_1", 49, 7, 0) -# activateItem(waitForObjectItem(":_QMenu", "Rename")) -# type(waitForObject(":_QExpandingLineEdit_2"), "boite_1") -# type(waitForObject(":_QExpandingLineEdit_2"), "") + # waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Group\\_1") + # clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Group\\_1", 10, 10, 0, Qt.LeftButton) + # openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Group\\_1", 49, 7, 0) + # activateItem(waitForObjectItem(":_QMenu", "Rename")) + # type(waitForObject(":_QExpandingLineEdit_2"), "boite_1") + # type(waitForObject(":_QExpandingLineEdit_2"), "") # rename result waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Groups (1)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Groups (1)", -10, 10, 0, Qt.LeftButton) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1.Groups (1)", + -10, + 10, + 0, + Qt.LeftButton, + ) waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Groups (1).Group\\_1") - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Groups (1).Group\\_1", 10, 10, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1.Groups (1).Group\\_1", + 10, + 10, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Rename")) type(waitForObject(":_QExpandingLineEdit"), "boite_1") type(waitForObject(":_QExpandingLineEdit"), "") @@ -92,13 +135,37 @@ def main(): activateItem(waitForObjectItem(":_QMenu", "Group")) # [step] Select type: Faces - mouseClick(waitForObjectItem(":property_panel_dock.Type_QComboBox", "Faces"), 10, 10, 0, Qt.LeftButton) + mouseClick( + waitForObjectItem(":property_panel_dock.Type_QComboBox", "Faces"), + 10, + 10, + 0, + Qt.LeftButton, + ) # [step] Select the two faces [vp SELECTED_FACES] - mouseClick(waitForObject(":property_panel_dock.Selected objects:_QListWidget"), 10, 10, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 469, 292, 0, Qt.LeftButton) + mouseClick( + waitForObject(":property_panel_dock.Selected objects:_QListWidget"), + 10, + 10, + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 469, + 292, + 0, + Qt.LeftButton, + ) type(waitForObject(":property_panel_dock.Selected objects:_QListWidget"), "") - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 306, 296, 33554432, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 306, + 296, + 33554432, + Qt.LeftButton, + ) test.vp("SELECTED_FACES") # [step] Apply the feature @@ -112,10 +179,16 @@ def main(): activateItem(waitForObjectItem(":Part_QMenu", "Export")) # [step] Select export type: XAO - mouseClick(waitForObjectItem(":property_panel_dock_QComboBox", "XAO"), 10, 10, 0, Qt.LeftButton) + mouseClick( + waitForObjectItem(":property_panel_dock_QComboBox", "XAO"), + 10, + 10, + 0, + Qt.LeftButton, + ) # [step] Set the file name 'Box-export.xao' - export_file_path = os.path.join(TMP_DIR, 'Box-export.xao') + export_file_path = os.path.join(TMP_DIR, "Box-export.xao") clickButton(waitForObject(":property_panel_dock...._QPushButton")) mouseClick(waitForObject(":fileNameEdit_QLineEdit_3"), 64, 7, 0, Qt.LeftButton) type(waitForObject(":fileNameEdit_QLineEdit_3"), export_file_path) @@ -133,7 +206,9 @@ def main(): snooze(1) # [step] Check that the exported file exists: 'exchange/xao/results/Box-export.xao' - example_file_path = os.path.join(DATA_PATH, 'exchange', 'xao-examples', 'Box-export.xao') + example_file_path = os.path.join( + DATA_PATH, "exchange", "xao-examples", "Box-export.xao" + ) files = (export_file_path, example_file_path) if filecmp.cmp(*files): test.passes("File comparison of '%s' and '%s' passed" % files) @@ -157,8 +232,18 @@ def main(): activateItem(waitForObjectItem(":Part_QMenu", "Import")) # [step] Select the exported file - mouseClick(waitForObject(":property_panel_dock...._QPushButton"), 10, 10, 0, Qt.LeftButton) - mouseClick(waitForObjectItem(":property_panel_dock.fileTypeCombo_QComboBox", "XAO files (*\\.XAO)"), 10, 10, 0, Qt.LeftButton) + mouseClick( + waitForObject(":property_panel_dock...._QPushButton"), 10, 10, 0, Qt.LeftButton + ) + mouseClick( + waitForObjectItem( + ":property_panel_dock.fileTypeCombo_QComboBox", "XAO files (*\\.XAO)" + ), + 10, + 10, + 0, + Qt.LeftButton, + ) type(waitForObject(":fileNameEdit_QLineEdit_3"), export_file_path) type(waitForObject(":fileNameEdit_QLineEdit_3"), "") @@ -166,7 +251,13 @@ def main(): clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) # [step] Check that the body is visible in the view [vp BODY] - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Bodies (1).mygeom\\_1", 10, 10, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1.Bodies (1).mygeom\\_1", + 10, + 10, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Show only")) fit_all() test.vp("BODY_IMPORT") @@ -181,13 +272,25 @@ def main(): waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Groups (2).Group\\_2") # [step] Check the group boite_1 is a solid [vp GROUP_1] - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Groups (2).boite\\_1", 10, 10, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1.Groups (2).boite\\_1", + 10, + 10, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Show only")) fit_all() test.vp("GROUP_1") # [step] Check the group Group_2 is a list of 2 faces [vp GROUP_2] - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Groups (2).Group\\_2", 10, 10, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1.Groups (2).Group\\_2", + 10, + 10, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Show only")) fit_all() test.vp("GROUP_2") diff --git a/test.squish/suite_FEATURE_EXCHANGE/tst_XAO-import/test.py b/test.squish/suite_FEATURE_EXCHANGE/tst_XAO-import/test.py index bf8315eae..3165d4bd3 100644 --- a/test.squish/suite_FEATURE_EXCHANGE/tst_XAO-import/test.py +++ b/test.squish/suite_FEATURE_EXCHANGE/tst_XAO-import/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): # [project] NewGEOM # [Scenario] XAO-import @@ -45,15 +46,31 @@ def main(): activateItem(waitForObjectItem(":Part_QMenu", "Import")) # [step] Select file 'exchange/xao/test.xao' and apply the feature - file_path = os.path.join(DATA_PATH, 'exchange', 'xao', 'test.xao'); - mouseClick(waitForObject(":property_panel_dock...._QPushButton"), 10, 10, 0, Qt.LeftButton) - mouseClick(waitForObjectItem(":property_panel_dock.fileTypeCombo_QComboBox", "XAO files (*\\.XAO)"), 10, 10, 0, Qt.LeftButton) + file_path = os.path.join(DATA_PATH, "exchange", "xao", "test.xao") + mouseClick( + waitForObject(":property_panel_dock...._QPushButton"), 10, 10, 0, Qt.LeftButton + ) + mouseClick( + waitForObjectItem( + ":property_panel_dock.fileTypeCombo_QComboBox", "XAO files (*\\.XAO)" + ), + 10, + 10, + 0, + Qt.LeftButton, + ) type(waitForObject(":fileNameEdit_QLineEdit_3"), file_path) type(waitForObject(":fileNameEdit_QLineEdit_3"), "") clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) # [step] Check that the body is visible in the view [vp BODY] - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Bodies (1).mygeom\\_1", 10, 10, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1.Bodies (1).mygeom\\_1", + 10, + 10, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Show only")) fit_all() test.vp("BODY") @@ -68,13 +85,25 @@ def main(): waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Groups (2).Group\\_2") # [step] Check the group boite_1 is a solid [vp GROUP_1] - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Groups (2).boite\\_1", 10, 10, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1.Groups (2).boite\\_1", + 10, + 10, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Show only")) fit_all() test.vp("GROUP_1") # [step] Check the group Group_2 is a list of 2 faces [vp GROUP_2] - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Groups (2).Group\\_2", 10, 10, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1.Groups (2).Group\\_2", + 10, + 10, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Show only")) fit_all() test.vp("GROUP_2") diff --git a/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_001/test.py b/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_001/test.py index 4369b3e04..277b1ae13 100644 --- a/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_001/test.py +++ b/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_001/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): # [project] SHAPER # [Scenario] Extrusion_001 @@ -42,8 +43,21 @@ def main(): # [step] Activate Part_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 48, 10, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 48, 10, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1 (Not loaded)", + 48, + 10, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 48, + 10, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) # [step] Fit all @@ -53,7 +67,13 @@ def main(): # [step] Execute extrusion for sketch_1 mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Features")) mouseClick(waitForObjectItem(":_QMenu", "Extrusion")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 347, 228, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 347, + 228, + 0, + Qt.LeftButton, + ) type(waitForObject(getSpinBoxRealName("to_size")), "") type(waitForObject(getSpinBoxRealName("to_size")), 50) diff --git a/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_002/test.py b/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_002/test.py index 1e976e80b..da5d02413 100644 --- a/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_002/test.py +++ b/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_002/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): # [project] SHAPER # [Scenario] Extrusion_002 @@ -42,8 +43,21 @@ def main(): # [step] Activate Part_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 48, 10, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 48, 10, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1 (Not loaded)", + 48, + 10, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 48, + 10, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) # [step] Fit all @@ -55,7 +69,13 @@ def main(): mouseClick(waitForObjectItem(":_QMenu", "Extrusion")) # [step] Select sketch_1 as base - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 324, 222, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 324, + 222, + 0, + Qt.LeftButton, + ) # [step] Select 'By boarding planes and offsets' button clickButton(waitForObject(":Extrusion_QToolButton")) @@ -65,10 +85,28 @@ def main(): test.vp("NO_PREVIEW") # [step] Select upper face as face 'To' - mouseClick(waitForObject(":Extrusion.Select a sketch face_QListWidget"), 80, 47, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 350, 231, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Extrusion.Select a sketch face_QListWidget"), + 80, + 47, + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 350, + 231, + 0, + Qt.LeftButton, + ) mouseClick(waitForObject(":To_QLineEdit"), 31, 11, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 369, 87, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 369, + 87, + 0, + Qt.LeftButton, + ) # [check] Check that preview is updated [vp PREVIEW_TO] fit_all() @@ -76,7 +114,13 @@ def main(): # [step] Select lower face as face 'From' mouseClick(waitForObject(":From_QLineEdit"), 80, 11, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 350, 413, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 350, + 413, + 0, + Qt.LeftButton, + ) # [check] Check that preview is updated [vp PREVIEW_FROM] test.vp("PREVIEW_FROM") diff --git a/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_003/test.py b/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_003/test.py index c0609f6a8..c18635622 100644 --- a/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_003/test.py +++ b/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_003/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): # [project] SHAPER # [Scenario] Extrusion_003 @@ -42,8 +43,21 @@ def main(): # [step] Activate Part_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 71, 10, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 70, 9, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1 (Not loaded)", + 71, + 10, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 70, + 9, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) # [step] Fit all @@ -55,7 +69,13 @@ def main(): mouseClick(waitForObjectItem(":_QMenu", "ExtrusionCut")) # [step] Select the upper face for sketching - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 243, 171, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 243, + 171, + 0, + Qt.LeftButton, + ) # [step] Click "Set plane view" in property panel [vp PLANE] clickButton(waitForObject(":Sketcher plane.Set plane view_QPushButton")) @@ -94,7 +114,9 @@ def main(): # [step] Click 'Reset view' toolbar button clickButton(waitForObject(":SALOME*.Reset_QToolButton_2")) - mouseClick(waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton) # close tool bar extension bar + mouseClick( + waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton + ) # close tool bar extension bar # [check] Check that extrusionCut operation has been executed successfully [vp EXTRUSION_CUT] test.vp("EXTRUSION_CUT") diff --git a/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_004/test.py b/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_004/test.py index c1a8be22f..3200ce857 100644 --- a/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_004/test.py +++ b/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_004/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): # [project] SHAPER # [Scenario] Extrusion_004 @@ -42,8 +43,21 @@ def main(): # [step] Activate Part_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 71, 10, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 70, 9, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1 (Not loaded)", + 71, + 10, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 70, + 9, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) # [step] Fit all @@ -55,7 +69,13 @@ def main(): mouseClick(waitForObjectItem(":_QMenu", "ExtrusionFuse")) # [step] Select the upper face for sketching - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 243, 171, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 243, + 171, + 0, + Qt.LeftButton, + ) # [step] Click "Set plane view" in property panel [vp PLANE] clickButton(waitForObject(":Sketcher plane.Set plane view_QPushButton")) @@ -94,7 +114,9 @@ def main(): # [step] Click 'Reset view' toolbar button clickButton(waitForObject(":SALOME*.Reset_QToolButton_2")) - mouseClick(waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton) # close tool bar extension bar + mouseClick( + waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton + ) # close tool bar extension bar # [check] Check that extrusionCut operation has been executed successfully [vp EXTRUSION_FUSE] test.vp("EXTRUSION_FUSE") diff --git a/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_006/test.py b/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_006/test.py index 75dae6139..c060d118f 100644 --- a/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_006/test.py +++ b/test.squish/suite_FEATURE_EXTRUSION/tst_extrusion_006/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): # [project] SHAPER # [Scenario] Extrusion_006 @@ -42,8 +43,21 @@ def main(): # [step] Activate Part_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 71, 10, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 70, 9, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1 (Not loaded)", + 71, + 10, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 70, + 9, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) # [step] Fit all @@ -55,7 +69,13 @@ def main(): mouseClick(waitForObjectItem(":_QMenu", "ExtrusionCut")) # [step] Select the upper face for sketching - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 243, 171, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 243, + 171, + 0, + Qt.LeftButton, + ) # [step] Click "Set plane view" in property panel [vp PLANE] clickButton(waitForObject(":Sketcher plane.Set plane view_QPushButton")) @@ -76,7 +96,13 @@ def main(): mouseClick(waitForObject(":To_QLineEdit_5"), 46, 15, 0, Qt.LeftButton) # [step] Select Plane_1 as face 'To' - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 35, 220, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 35, + 220, + 0, + Qt.LeftButton, + ) # [check] Check that preview has been updated [cp PREVIEW] fit_all() @@ -87,7 +113,9 @@ def main(): # [step] Click 'Reset view' toolbar button clickButton(waitForObject(":SALOME*.Reset_QToolButton_2")) - mouseClick(waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton) # close tool bar extension bar + mouseClick( + waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton + ) # close tool bar extension bar # [check] Check that extrusionCut operation has been executed successfully [vp EXTRUSION_FUSE] test.vp("EXTRUSION_CUT") diff --git a/test.squish/suite_FEATURE_PARAMETERS/shared/scripts/bdd_hooks.py b/test.squish/suite_FEATURE_PARAMETERS/shared/scripts/bdd_hooks.py index 96587b8a8..8887e9393 100644 --- a/test.squish/suite_FEATURE_PARAMETERS/shared/scripts/bdd_hooks.py +++ b/test.squish/suite_FEATURE_PARAMETERS/shared/scripts/bdd_hooks.py @@ -35,6 +35,7 @@ import builtins + # Detach (i.e. potentially terminate) all AUTs at the end of a scenario @OnScenarioEnd def hook(context): @@ -43,4 +44,3 @@ def hook(context): for ctx in applicationContextList(): ctx.detach() - diff --git a/test.squish/suite_FEATURE_PARAMETERS/shared/steps/steps.py b/test.squish/suite_FEATURE_PARAMETERS/shared/steps/steps.py index e814aa945..b4978172b 100644 --- a/test.squish/suite_FEATURE_PARAMETERS/shared/steps/steps.py +++ b/test.squish/suite_FEATURE_PARAMETERS/shared/steps/steps.py @@ -47,12 +47,14 @@ import builtins + @Given("Launch application in salome mode") def step(context): startApplication("salome_run.sh") clickButton(waitForObject(":SALOME*.Shaper_QToolButton")) clickButton(waitForObject(":Activate module.New_QPushButton")) + @When("Create parameter a=30") def step(context): activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part")) @@ -63,11 +65,13 @@ def step(context): type(waitForObject(":Parameter_ExpressionEditor"), "30") clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) + @When("Create part") def step(context): activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part")) activateItem(waitForObjectItem(":Part_QMenu", "New part")) + @When("Create parameter a=a+2") def step(context): activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part")) @@ -78,28 +82,48 @@ def step(context): type(waitForObject(":Parameter_ExpressionEditor"), "a+2") clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) + @Then("the parameter in the part should exist") def step(context): waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Parameters (1)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Parameters (1)", -10, 10, 0, Qt.LeftButton) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1.Parameters (1)", + -10, + 10, + 0, + Qt.LeftButton, + ) waitFor("object.exists(':Parameters (1).a = 32_QModelIndex')", 20000) test.compare(findObject(":Parameters (1).a = 32_QModelIndex").text, "a = 32") + @When("Create sketch") def step(context): clickButton(waitForObject(":SALOME*.Sketch_QToolButton")) clickButton(waitForObject(":SALOME*.-OZ_QToolButton")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 247, 126, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 247, + 126, + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Sketcher plane.Set plane view_QPushButton")) + @Then("Check that Point does not allow using expressions") def step(context): activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) activateItem(waitForObjectItem(":Sketch_QMenu", "Point")) - mouseClick(waitForObject(":Point.qt_spinbox_lineedit_QLineEdit"), 41, 6, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Point.qt_spinbox_lineedit_QLineEdit"), 41, 6, 0, Qt.LeftButton + ) type(waitForObject(":Point.X _ModuleBase_ParamSpinBox"), "") type(waitForObject(":Point.X _ModuleBase_ParamSpinBox"), "a") - mouseClick(waitForObject(":Point.qt_spinbox_lineedit_QLineEdit_2"), 40, 9, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Point.qt_spinbox_lineedit_QLineEdit_2"), 40, 9, 0, Qt.LeftButton + ) type(waitForObject(":Point.Y _ModuleBase_ParamSpinBox"), "") type(waitForObject(":Point.Y _ModuleBase_ParamSpinBox"), "a") waitFor("object.exists(':Point.qt_spinbox_lineedit_QLineEdit')", 20000) @@ -108,42 +132,86 @@ def step(context): test.compare(str(findObject(":Point.qt_spinbox_lineedit_QLineEdit_2").text), "0") clickButton(waitForObject(":Point.property_panel_cancel_QToolButton")) + @Then("Check that Line does not allow using expressions") def step(context): clickButton(waitForObject(":SALOME*.Line_QToolButton")) - mouseClick(waitForObject(":Start point.qt_spinbox_lineedit_QLineEdit_2"), 89, 9, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Start point.qt_spinbox_lineedit_QLineEdit_2"), + 89, + 9, + 0, + Qt.LeftButton, + ) type(waitForObject(":Start point.X _ModuleBase_ParamSpinBox"), "") type(waitForObject(":Start point.X _ModuleBase_ParamSpinBox"), "a") - mouseClick(waitForObject(":Start point.qt_spinbox_lineedit_QLineEdit_3"), 72, 10, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Start point.qt_spinbox_lineedit_QLineEdit_3"), + 72, + 10, + 0, + Qt.LeftButton, + ) type(waitForObject(":Start point.Y _ModuleBase_ParamSpinBox"), "") type(waitForObject(":Start point.Y _ModuleBase_ParamSpinBox"), "a") - mouseClick(waitForObject(":End point.qt_spinbox_lineedit_QLineEdit_2"), 62, 8, 0, Qt.LeftButton) + mouseClick( + waitForObject(":End point.qt_spinbox_lineedit_QLineEdit_2"), + 62, + 8, + 0, + Qt.LeftButton, + ) type(waitForObject(":End point.X _ModuleBase_ParamSpinBox"), "") type(waitForObject(":End point.X _ModuleBase_ParamSpinBox"), "a") - mouseClick(waitForObject(":End point.qt_spinbox_lineedit_QLineEdit_3"), 59, 6, 0, Qt.LeftButton) + mouseClick( + waitForObject(":End point.qt_spinbox_lineedit_QLineEdit_3"), + 59, + 6, + 0, + Qt.LeftButton, + ) type(waitForObject(":End point.Y _ModuleBase_ParamSpinBox"), "") type(waitForObject(":End point.Y _ModuleBase_ParamSpinBox"), "a") waitFor("object.exists(':Start point.qt_spinbox_lineedit_QLineEdit_2')", 20000) - test.compare(str(findObject(":Start point.qt_spinbox_lineedit_QLineEdit_2").text), "0") + test.compare( + str(findObject(":Start point.qt_spinbox_lineedit_QLineEdit_2").text), "0" + ) waitFor("object.exists(':Start point.qt_spinbox_lineedit_QLineEdit_3')", 20000) - test.compare(str(findObject(":Start point.qt_spinbox_lineedit_QLineEdit_3").text), "0") + test.compare( + str(findObject(":Start point.qt_spinbox_lineedit_QLineEdit_3").text), "0" + ) waitFor("object.exists(':End point.qt_spinbox_lineedit_QLineEdit_2')", 20000) - test.compare(str(findObject(":End point.qt_spinbox_lineedit_QLineEdit_2").text), "0") + test.compare( + str(findObject(":End point.qt_spinbox_lineedit_QLineEdit_2").text), "0" + ) waitFor("object.exists(':End point.qt_spinbox_lineedit_QLineEdit_3')", 20000) - test.compare(str(findObject(":End point.qt_spinbox_lineedit_QLineEdit_3").text), "0") + test.compare( + str(findObject(":End point.qt_spinbox_lineedit_QLineEdit_3").text), "0" + ) clickButton(waitForObject(":Line.property_panel_cancel_QToolButton")) + @Then("Check that Circle does not allow using expressions") def step(context): activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) activateItem(waitForObjectItem(":Sketch_QMenu", "Circle")) - mouseClick(waitForObject(":Center.qt_spinbox_lineedit_QLineEdit"), 90, 4, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Center.qt_spinbox_lineedit_QLineEdit"), 90, 4, 0, Qt.LeftButton + ) type(waitForObject(":Center.X _ModuleBase_ParamSpinBox"), "") type(waitForObject(":Center.X _ModuleBase_ParamSpinBox"), "a") - mouseClick(waitForObject(":Center.qt_spinbox_lineedit_QLineEdit_2"), 71, 8, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Center.qt_spinbox_lineedit_QLineEdit_2"), + 71, + 8, + 0, + Qt.LeftButton, + ) type(waitForObject(":Center.Y _ModuleBase_ParamSpinBox"), "") type(waitForObject(":Center.Y _ModuleBase_ParamSpinBox"), "a") - mouseClick(waitForObject(":Circle.qt_spinbox_lineedit_QLineEdit"), 58, 6, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Circle.qt_spinbox_lineedit_QLineEdit"), 58, 6, 0, Qt.LeftButton + ) type(waitForObject(":Circle.CircleRadius_ModuleBase_ParamSpinBox"), "") type(waitForObject(":Circle.CircleRadius_ModuleBase_ParamSpinBox"), "a") waitFor("object.exists(':Center.qt_spinbox_lineedit_QLineEdit')", 20000) @@ -154,28 +222,65 @@ def step(context): test.compare(str(findObject(":Circle.qt_spinbox_lineedit_QLineEdit").text), "0") clickButton(waitForObject(":Circle.property_panel_cancel_QToolButton")) + @Then("Check that Arc does not allow using expressions") def step(context): activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) activateItem(waitForObjectItem(":Sketch_QMenu", "Arc")) - mouseClick(waitForObject(":Center.qt_spinbox_lineedit_QLineEdit_3"), 156, 6, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Center.qt_spinbox_lineedit_QLineEdit_3"), + 156, + 6, + 0, + Qt.LeftButton, + ) type(waitForObject(":Center.X _ModuleBase_ParamSpinBox_2"), "A") type(waitForObject(":Center.X _ModuleBase_ParamSpinBox_2"), "") type(waitForObject(":Center.X _ModuleBase_ParamSpinBox_2"), "a") mouseClick(waitForObject(":Arc.Center_QGroupBox"), 135, 41, 0, Qt.LeftButton) - mouseClick(waitForObject(":Center.qt_spinbox_lineedit_QLineEdit_4"), 115, 3, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Center.qt_spinbox_lineedit_QLineEdit_4"), + 115, + 3, + 0, + Qt.LeftButton, + ) type(waitForObject(":Center.Y _ModuleBase_ParamSpinBox_2"), "") type(waitForObject(":Center.Y _ModuleBase_ParamSpinBox_2"), "a") - mouseClick(waitForObject(":Start point.qt_spinbox_lineedit_QLineEdit_4"), 103, 9, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Start point.qt_spinbox_lineedit_QLineEdit_4"), + 103, + 9, + 0, + Qt.LeftButton, + ) type(waitForObject(":Start point.X _ModuleBase_ParamSpinBox_2"), "") type(waitForObject(":Start point.X _ModuleBase_ParamSpinBox_2"), "a") - mouseClick(waitForObject(":Start point.qt_spinbox_lineedit_QLineEdit_5"), 99, 8, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Start point.qt_spinbox_lineedit_QLineEdit_5"), + 99, + 8, + 0, + Qt.LeftButton, + ) type(waitForObject(":Start point.Y _ModuleBase_ParamSpinBox_2"), "") type(waitForObject(":Start point.Y _ModuleBase_ParamSpinBox_2"), "a") - mouseClick(waitForObject(":End point.qt_spinbox_lineedit_QLineEdit_4"), 99, 1, 0, Qt.LeftButton) + mouseClick( + waitForObject(":End point.qt_spinbox_lineedit_QLineEdit_4"), + 99, + 1, + 0, + Qt.LeftButton, + ) type(waitForObject(":End point.X _ModuleBase_ParamSpinBox_2"), "") type(waitForObject(":End point.X _ModuleBase_ParamSpinBox_2"), "a") - mouseClick(waitForObject(":End point.qt_spinbox_lineedit_QLineEdit_5"), 99, 1, 0, Qt.LeftButton) + mouseClick( + waitForObject(":End point.qt_spinbox_lineedit_QLineEdit_5"), + 99, + 1, + 0, + Qt.LeftButton, + ) type(waitForObject(":End point.Y _ModuleBase_ParamSpinBox_2"), "") type(waitForObject(":End point.Y _ModuleBase_ParamSpinBox_2"), "a") waitFor("object.exists(':Center.qt_spinbox_lineedit_QLineEdit_3')", 20000) @@ -183,33 +288,71 @@ def step(context): waitFor("object.exists(':Center.qt_spinbox_lineedit_QLineEdit_4')", 20000) test.compare(str(findObject(":Center.qt_spinbox_lineedit_QLineEdit_4").text), "0") waitFor("object.exists(':Start point.qt_spinbox_lineedit_QLineEdit_4')", 20000) - test.compare(str(findObject(":Start point.qt_spinbox_lineedit_QLineEdit_4").text), "0") + test.compare( + str(findObject(":Start point.qt_spinbox_lineedit_QLineEdit_4").text), "0" + ) waitFor("object.exists(':Start point.qt_spinbox_lineedit_QLineEdit_5')", 20000) - test.compare(str(findObject(":Start point.qt_spinbox_lineedit_QLineEdit_5").text), "0") + test.compare( + str(findObject(":Start point.qt_spinbox_lineedit_QLineEdit_5").text), "0" + ) waitFor("object.exists(':End point.qt_spinbox_lineedit_QLineEdit_4')", 20000) - test.compare(str(findObject(":End point.qt_spinbox_lineedit_QLineEdit_4").text), "0") + test.compare( + str(findObject(":End point.qt_spinbox_lineedit_QLineEdit_4").text), "0" + ) waitFor("object.exists(':End point.qt_spinbox_lineedit_QLineEdit_5')", 20000) - test.compare(str(findObject(":End point.qt_spinbox_lineedit_QLineEdit_5").text), "0") + test.compare( + str(findObject(":End point.qt_spinbox_lineedit_QLineEdit_5").text), "0" + ) clickButton(waitForObject(":Arc.property_panel_cancel_QToolButton")) + @Then("Check that Fillet does not allow using expressions") def step(context): activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) activateItem(waitForObjectItem(":Sketch_QMenu", "Line")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 131, 282, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 209, 98, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 283, 275, 0, Qt.LeftButton) - #TODO_1 clickButton(waitForObject(":Line.property_panel_cancel_QToolButton")) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 131, + 282, + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 209, + 98, + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 283, + 275, + 0, + Qt.LeftButton, + ) + # TODO_1 clickButton(waitForObject(":Line.property_panel_cancel_QToolButton")) activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) activateItem(waitForObjectItem(":Sketch_QMenu", "Fillet")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 211, 99, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 211, + 99, + 0, + Qt.LeftButton, + ) type(waitForObject(":Fillet.ConstraintValue_ModuleBase_ParamSpinBox"), "") type(waitForObject(":Fillet.ConstraintValue_ModuleBase_ParamSpinBox"), "") type(waitForObject(":Fillet.ConstraintValue_ModuleBase_ParamSpinBox"), "") - type(waitForObject(":Fillet.ConstraintValue_ModuleBase_ParamSpinBox"), "") + type( + waitForObject(":Fillet.ConstraintValue_ModuleBase_ParamSpinBox"), + "", + ) waitFor("object.exists(':Fillet.qt_spinbox_lineedit_QLineEdit')", 20000) test.compare(str(findObject(":Fillet.qt_spinbox_lineedit_QLineEdit").text), "10") - mouseClick(waitForObject(":Fillet.qt_spinbox_lineedit_QLineEdit"), 48, 6, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Fillet.qt_spinbox_lineedit_QLineEdit"), 48, 6, 0, Qt.LeftButton + ) type(waitForObject(":Fillet.ConstraintValue_ModuleBase_ParamSpinBox"), "") type(waitForObject(":Fillet.ConstraintValue_ModuleBase_ParamSpinBox"), "a") waitFor("object.exists(':Fillet.qt_spinbox_lineedit_QLineEdit')", 20000) diff --git a/test.squish/suite_FEATURE_PARAMETERS/tst_1127/test.py b/test.squish/suite_FEATURE_PARAMETERS/tst_1127/test.py index 929c81327..37c6571c4 100644 --- a/test.squish/suite_FEATURE_PARAMETERS/tst_1127/test.py +++ b/test.squish/suite_FEATURE_PARAMETERS/tst_1127/test.py @@ -17,11 +17,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -source(findFile('scripts', 'python/bdd.py')) +source(findFile("scripts", "python/bdd.py")) + +setupHooks("../shared/scripts/bdd_hooks.py") +collectStepDefinitions("./steps", "../shared/steps") -setupHooks('../shared/scripts/bdd_hooks.py') -collectStepDefinitions('./steps', '../shared/steps') def main(): testSettings.throwOnFailure = True - runFeatureFile('test.feature') + runFeatureFile("test.feature") diff --git a/test.squish/suite_FEATURE_PARAMETERS/tst_1157/test.py b/test.squish/suite_FEATURE_PARAMETERS/tst_1157/test.py index 929c81327..37c6571c4 100644 --- a/test.squish/suite_FEATURE_PARAMETERS/tst_1157/test.py +++ b/test.squish/suite_FEATURE_PARAMETERS/tst_1157/test.py @@ -17,11 +17,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -source(findFile('scripts', 'python/bdd.py')) +source(findFile("scripts", "python/bdd.py")) + +setupHooks("../shared/scripts/bdd_hooks.py") +collectStepDefinitions("./steps", "../shared/steps") -setupHooks('../shared/scripts/bdd_hooks.py') -collectStepDefinitions('./steps', '../shared/steps') def main(): testSettings.throwOnFailure = True - runFeatureFile('test.feature') + runFeatureFile("test.feature") diff --git a/test.squish/suite_FEATURE_PARAMETERS/tst_474/test.py b/test.squish/suite_FEATURE_PARAMETERS/tst_474/test.py index 436beadf6..9c0dee3be 100644 --- a/test.squish/suite_FEATURE_PARAMETERS/tst_474/test.py +++ b/test.squish/suite_FEATURE_PARAMETERS/tst_474/test.py @@ -17,7 +17,8 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#[tested functionality] 1. Add parameter 2. Calculate parameter 3. Delete parameter +# [tested functionality] 1. Add parameter 2. Calculate parameter 3. Delete parameter + def main(): source(findFile("scripts", "common.py")) @@ -26,7 +27,7 @@ def main(): activate_SHAPER() - #[step] Create parameter 'aa = 4' + # [step] Create parameter 'aa = 4' activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part")) activateItem(waitForObjectItem(":Part_QMenu", "Parameter")) type(waitForObject(":Parameter_QLineEdit"), "aa") @@ -49,10 +50,18 @@ def main(): # check the new parameter waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Parameters (1).bb = 5") - openContextMenu(waitForObject(":Object browser.Part set_XGUI_ActiveDocLbl"), 10, 10, 0) + openContextMenu( + waitForObject(":Object browser.Part set_XGUI_ActiveDocLbl"), 10, 10, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Parameters (1).aa = 4", 10, 10, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Parameters (1).aa = 4", + 10, + 10, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Delete")) waitFor("object.exists(':Delete features._QLabel')", 20000) diff --git a/test.squish/suite_FEATURE_PARAMETERS/tst_576/test.py b/test.squish/suite_FEATURE_PARAMETERS/tst_576/test.py index 1cd58e5aa..3571dce2d 100644 --- a/test.squish/suite_FEATURE_PARAMETERS/tst_576/test.py +++ b/test.squish/suite_FEATURE_PARAMETERS/tst_576/test.py @@ -17,7 +17,8 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#[tested functionality] 1. Add parameter 2. Rename parameter +# [tested functionality] 1. Add parameter 2. Rename parameter + def main(): source(findFile("scripts", "common.py")) @@ -32,14 +33,29 @@ def main(): type(waitForObject(":Parameter_ExpressionEditor"), "") clickButton(waitForObject(":Parameter.property_panel_ok_QToolButton")) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Parameters (1).a = 3", 10, 10, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Parameters (1).a = 3", + 10, + 10, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Rename")) type(waitForObject(":_QExpandingLineEdit"), "b") type(waitForObject(":_QExpandingLineEdit"), "") - test.compare(waitForObjectItem(":Object browser_XGUI_DataTree", "Parameters (1).b = 3").text, "b = 3") + test.compare( + waitForObjectItem(":Object browser_XGUI_DataTree", "Parameters (1).b = 3").text, + "b = 3", + ) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Parameters (1).b = 3", 111, 5, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Parameters (1).b = 3", + 111, + 5, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Edit...")) waitFor("object.exists(':Parameter_QLineEdit')", 20000) test.compare(str(findObject(":Parameter_QLineEdit").text), "b") diff --git a/test.squish/suite_FEATURE_PARAMETERS/tst_903/test.py b/test.squish/suite_FEATURE_PARAMETERS/tst_903/test.py index 560154895..3d0b210b6 100644 --- a/test.squish/suite_FEATURE_PARAMETERS/tst_903/test.py +++ b/test.squish/suite_FEATURE_PARAMETERS/tst_903/test.py @@ -17,10 +17,11 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#[tested functionality] Add parameter -#[tested functionality] Use wrong parameter name -#[tested functionality] Error notification in header -#[tested functionality] Error notification in widget +# [tested functionality] Add parameter +# [tested functionality] Use wrong parameter name +# [tested functionality] Error notification in header +# [tested functionality] Error notification in widget + def main(): source(findFile("scripts", "common.py")) @@ -29,40 +30,58 @@ def main(): activate_SHAPER() - #[step] Click menu Part->Parameter + # [step] Click menu Part->Parameter activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part")) activateItem(waitForObjectItem(":Part_QMenu", "Parameter")) mouseClick(waitForObject(":Parameter_QLineEdit"), 79, 8, 0, Qt.LeftButton) - #[step] Check that feature ToolTip is: Model_FeatureValidator: Attribute "expression" is not initialized. + # [step] Check that feature ToolTip is: Model_FeatureValidator: Attribute "expression" is not initialized. waitFor("object.exists(':Parameter_QFrame')", 20000) - test.compare(str(findObject(":Parameter_QFrame").toolTip), "Model_FeatureValidator: Attribute \"expression\" is not initialized.") - #[step] Check that name tooltip is: Errors:\nvariable - Parameters_VariableValidator: Incorrect variable name. + test.compare( + str(findObject(":Parameter_QFrame").toolTip), + 'Model_FeatureValidator: Attribute "expression" is not initialized.', + ) + # [step] Check that name tooltip is: Errors:\nvariable - Parameters_VariableValidator: Incorrect variable name. waitFor("object.exists(':Parameter_QLineEdit')", 20000) - test.compare(str(findObject(":Parameter_QLineEdit").toolTip), 'Errors:\nvariable - Parameters_VariableValidator: Attribute "variable" value is empty.') - #[step] Check that expression tooltip is: Errors:\nexpression - Parameters_ExpressionValidator: Expression is empty. + test.compare( + str(findObject(":Parameter_QLineEdit").toolTip), + 'Errors:\nvariable - Parameters_VariableValidator: Attribute "variable" value is empty.', + ) + # [step] Check that expression tooltip is: Errors:\nexpression - Parameters_ExpressionValidator: Expression is empty. waitFor("object.exists(':Parameter_ExpressionEditor')", 20000) - test.compare(str(findObject(":Parameter_ExpressionEditor").toolTip), 'Errors:\nexpression - Parameters_ExpressionValidator: Attribute "expression" is not initialized.') + test.compare( + str(findObject(":Parameter_ExpressionEditor").toolTip), + 'Errors:\nexpression - Parameters_ExpressionValidator: Attribute "expression" is not initialized.', + ) - #[step] Enter variable name 'a' + # [step] Enter variable name 'a' type(waitForObject(":Parameter_QLineEdit"), "a") mouseClick(waitForObject(":Parameter_ExpressionEditor"), 97, 31, 0, Qt.LeftButton) - #[step] Enter variable expression '100+b' + # [step] Enter variable expression '100+b' type(waitForObject(":Parameter_ExpressionEditor"), "100+b") type(waitForObject(":Parameter_ExpressionEditor"), "") - #[step] Check that expression tooltip is: Errors:\nexpression - Parameters_ExpressionValidator: name 'b' is not defined + # [step] Check that expression tooltip is: Errors:\nexpression - Parameters_ExpressionValidator: name 'b' is not defined waitFor("object.exists(':Parameter_ExpressionEditor')", 20000) - test.compare(str(findObject(":Parameter_ExpressionEditor").toolTip), "Errors:\nexpression - Parameters_ExpressionValidator: Result is empty.") - #[step] Check that result message is: Error: unexpected EOF while parsing (, line 0) + test.compare( + str(findObject(":Parameter_ExpressionEditor").toolTip), + "Errors:\nexpression - Parameters_ExpressionValidator: Result is empty.", + ) + # [step] Check that result message is: Error: unexpected EOF while parsing (, line 0) waitFor("object.exists(':Parameter.Result_QLabel')", 20000) - test.compare(str(findObject(":Parameter.Result_QLabel").text), "Error: name 'b' is not defined") + test.compare( + str(findObject(":Parameter.Result_QLabel").text), + "Error: name 'b' is not defined", + ) - #[step] Check that feature ToolTip is: expression - Parameters_ExpressionValidator: name 'b' is not defined + # [step] Check that feature ToolTip is: expression - Parameters_ExpressionValidator: name 'b' is not defined waitFor("object.exists(':Parameter_QFrame')", 20000) - test.compare(str(findObject(":Parameter_QFrame").toolTip), "expression - Parameters_ExpressionValidator: Result is empty.") + test.compare( + str(findObject(":Parameter_QFrame").toolTip), + "expression - Parameters_ExpressionValidator: Result is empty.", + ) - #[step] Check that apply button is grey [vp VP_APPLY_GREY] + # [step] Check that apply button is grey [vp VP_APPLY_GREY] test.vp("VP_APPLY_GREY") close_application() diff --git a/test.squish/suite_FEATURE_PARTITION/tst_partition_001/test.py b/test.squish/suite_FEATURE_PARTITION/tst_partition_001/test.py index d79c61601..df8173229 100644 --- a/test.squish/suite_FEATURE_PARTITION/tst_partition_001/test.py +++ b/test.squish/suite_FEATURE_PARTITION/tst_partition_001/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): # [project] SHAPER # [Scenario] Partition_001 @@ -40,7 +41,13 @@ def main(): # [step] Activate SHAPER clickButton(waitForObject(":SALOME*.Shaper_QToolButton")) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 95, 7, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 95, + 7, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) clickButton(waitForObject(":SALOME*.Fit All_QToolButton")) @@ -58,9 +65,21 @@ def main(): test.vp("VP_PARTITION_2") - #[step] Hide one of parts obtained in the viewer: select it, call context menu - Hide - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 291, 198, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 291, 198, 0, Qt.RightButton) + # [step] Hide one of parts obtained in the viewer: select it, call context menu - Hide + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 291, + 198, + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 291, + 198, + 0, + Qt.RightButton, + ) activateItem(waitForObjectItem(":_QtxMenu", "Hide")) # [check] Check that partition has been executed successfully [vp VP_HIDE] diff --git a/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_001/test.py b/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_001/test.py index d0cf2eda1..1f47e01b6 100644 --- a/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_001/test.py +++ b/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_001/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): # [project] SHAPER # [Scenario] Revolution_001 @@ -42,8 +43,21 @@ def main(): # [step] Activate Part_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 71, 10, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 70, 9, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1 (Not loaded)", + 71, + 10, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 70, + 9, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) # [step] Fit all [vp INIT] @@ -62,12 +76,30 @@ def main(): test.vp("+OY") # [step] Select sketch for revolution - mouseClick(waitForObject(":Revolution.Select a sketch face_QListWidget"), 10, 10, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 431, 180, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Revolution.Select a sketch face_QListWidget"), + 10, + 10, + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 431, + 180, + 0, + Qt.LeftButton, + ) # [step] Select vector mouseClick(waitForObject(":Revolution_QLineEdit"), 186, 8, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 307, 328, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 307, + 328, + 0, + Qt.LeftButton, + ) # [step] Fit all [vp AFTER_SELECTION] fit_all() @@ -75,7 +107,9 @@ def main(): # [step] Click 'Reset view' toolbar button clickButton(waitForObject(":SALOME*.Reset_QToolButton_2")) - mouseClick(waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton) # close tool bar extension bar + mouseClick( + waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton + ) # close tool bar extension bar test.vp("AFTER_SELECTION_RESET") @@ -93,12 +127,24 @@ def main(): test.vp("AFTER_ANGLE_90_120") # [step] Clear the angle 'To' - mouseClick(waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit"), 10, 10, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit"), + 10, + 10, + 0, + Qt.LeftButton, + ) type(waitForObject(":Revolution.to_angle_ModuleBase_ParamSpinBox"), "") type(waitForObject(":Revolution.to_angle_ModuleBase_ParamSpinBox"), "") # [step] Input new angle 'From': 360 - mouseClick(waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_2"), 10, 10, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_2"), + 10, + 10, + 0, + Qt.LeftButton, + ) type(waitForObject(":Revolution.from_angle_ModuleBase_ParamSpinBox"), "") type(waitForObject(":Revolution.from_angle_ModuleBase_ParamSpinBox"), 360) type(waitForObject(":Revolution.from_angle_ModuleBase_ParamSpinBox"), "") diff --git a/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_003/test.py b/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_003/test.py index 95e3ce861..175f2ea77 100644 --- a/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_003/test.py +++ b/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_003/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): # [project] SHAPER # [Scenario] Revolution_003 @@ -42,8 +43,21 @@ def main(): # [step] Activate Part_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 71, 10, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 70, 9, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1 (Not loaded)", + 71, + 10, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 70, + 9, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) # [step] Fit all [vp INIT] @@ -52,8 +66,12 @@ def main(): # TODO(spo): remove: workaround for the bug given RevolutionCut sketch created when select axis_object then apply is disabled waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1", 10, 10, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Sketch\\_1", 10, 10, 0) + clickItem( + ":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1", 10, 10, 0, Qt.LeftButton + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Sketch\\_1", 10, 10, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Edit...")) clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) @@ -62,7 +80,13 @@ def main(): mouseClick(waitForObjectItem(":_QMenu", "RevolutionCut")) # [step] Select sketch face - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 287, 236, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 287, + 236, + 0, + Qt.LeftButton, + ) # [step] Click "Set plane view" in property panel [vp PLANE] clickButton(waitForObject(":Sketcher plane.Set plane view_QPushButton")) @@ -71,14 +95,38 @@ def main(): # [step] Create 2 circles on the plane [vp CIRCLES] activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) activateItem(waitForObjectItem(":Sketch_QMenu", "Circle")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 650, 350, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 690, 350, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 650, + 350, + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 690, + 350, + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) activateItem(waitForObjectItem(":Sketch_QMenu", "Circle")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 650, 110, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 700, 110, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 650, + 110, + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 700, + 110, + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) test.vp("CIRCLES") @@ -88,15 +136,33 @@ def main(): # [step] Select axis for revolution mouseClick(waitForObject(":Revolution_QLineEdit_3"), 10, 10, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 750, 237, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 750, + 237, + 0, + Qt.LeftButton, + ) # [step] Define angle 'To' - mouseClick(waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_5"), 10, 10, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_5"), + 10, + 10, + 0, + Qt.LeftButton, + ) type(waitForObject(":Revolution.to_angle_ModuleBase_ParamSpinBox_3"), "") type(waitForObject(":Revolution.to_angle_ModuleBase_ParamSpinBox_3"), 90) # [step] Define angle 'From' - mouseClick(waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_6"), 10, 10, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_6"), + 10, + 10, + 0, + Qt.LeftButton, + ) type(waitForObject(":Revolution.from_angle_ModuleBase_ParamSpinBox_3"), "") type(waitForObject(":Revolution.from_angle_ModuleBase_ParamSpinBox_3"), 90) type(waitForObject(":Revolution.from_angle_ModuleBase_ParamSpinBox_3"), "") @@ -106,7 +172,9 @@ def main(): # [step] Click 'Reset view' toolbar button clickButton(waitForObject(":SALOME*.Reset_QToolButton_2")) - mouseClick(waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton) # close tool bar extension bar + mouseClick( + waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton + ) # close tool bar extension bar # [check] Check that operation has been executed successfully test.vp("REVOLUTION_CUT") diff --git a/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_004/test.py b/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_004/test.py index 469eadd05..c3e60f8a2 100644 --- a/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_004/test.py +++ b/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_004/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): # [project] SHAPER # [Scenario] Revolution_004 @@ -42,8 +43,21 @@ def main(): # [step] Activate Part_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 71, 10, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 70, 9, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1 (Not loaded)", + 71, + 10, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 70, + 9, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) # [step] Fit all [vp INIT] @@ -52,8 +66,12 @@ def main(): # TODO(spo): remove: workaround for the bug given RevolutionCut sketch created when select axis_object then apply is disabled waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1", 10, 10, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Sketch\\_1", 10, 10, 0) + clickItem( + ":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1", 10, 10, 0, Qt.LeftButton + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Sketch\\_1", 10, 10, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Edit...")) clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) @@ -62,7 +80,13 @@ def main(): mouseClick(waitForObjectItem(":_QMenu", "RevolutionFuse")) # [step] Select sketch face - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 287, 236, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 287, + 236, + 0, + Qt.LeftButton, + ) # [step] Click "Set plane view" in property panel [vp PLANE] clickButton(waitForObject(":Sketcher plane.Set plane view_QPushButton")) @@ -71,14 +95,38 @@ def main(): # [step] Create 2 circles on the plane [vp CIRCLES] activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) activateItem(waitForObjectItem(":Sketch_QMenu", "Circle")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 650, 350, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 690, 350, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 650, + 350, + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 690, + 350, + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) activateItem(waitForObjectItem(":Sketch_QMenu", "Circle")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 650, 110, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 700, 110, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 650, + 110, + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 700, + 110, + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) test.vp("CIRCLES") @@ -88,23 +136,43 @@ def main(): # [step] Select axis for revolution mouseClick(waitForObject(":Revolution_QLineEdit_2"), 10, 10, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 750, 203, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 750, + 203, + 0, + Qt.LeftButton, + ) # [step] Click 'Reset view' toolbar button clickButton(waitForObject(":SALOME*.Reset_QToolButton_2")) - mouseClick(waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton) # close tool bar extension bar + mouseClick( + waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton + ) # close tool bar extension bar # [step] Select revolution method 'By angles' clickButton(waitForObject(":Revolution_QToolButton_2")) # [step] Set angle 'To': 0 - mouseClick(waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_3"), 10, 10, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_3"), + 10, + 10, + 0, + Qt.LeftButton, + ) type(waitForObject(":Revolution.to_angle_ModuleBase_ParamSpinBox_2"), "") type(waitForObject(":Revolution.to_angle_ModuleBase_ParamSpinBox_2"), 0) -# type(waitForObject(":Revolution.to_angle_ModuleBase_ParamSpinBox_2"), "") + # type(waitForObject(":Revolution.to_angle_ModuleBase_ParamSpinBox_2"), "") # [step] Define angle 'From': 350 - mouseClick(waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_4"), 10, 10, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_4"), + 10, + 10, + 0, + Qt.LeftButton, + ) type(waitForObject(":Revolution.from_angle_ModuleBase_ParamSpinBox_2"), "") type(waitForObject(":Revolution.from_angle_ModuleBase_ParamSpinBox_2"), 350) type(waitForObject(":Revolution.from_angle_ModuleBase_ParamSpinBox_2"), "") diff --git a/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_005/test.py b/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_005/test.py index 8b8fc60c6..e9e5a95bf 100644 --- a/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_005/test.py +++ b/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_005/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): # [project] SHAPER # [Scenario] Revolution_005 @@ -42,8 +43,21 @@ def main(): # [step] Activate Part_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 71, 10, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 70, 9, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1 (Not loaded)", + 71, + 10, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 70, + 9, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) # [step] Fit all [vp INIT] @@ -55,7 +69,13 @@ def main(): mouseClick(waitForObjectItem(":_QMenu", "RevolutionFuse")) # [step] Select sketch face - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 287, 236, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 287, + 236, + 0, + Qt.LeftButton, + ) # [step] Click "Set plane view" in property panel [vp PLANE] clickButton(waitForObject(":Sketcher plane.Set plane view_QPushButton")) @@ -64,14 +84,38 @@ def main(): # [step] Create 2 circles on the plane [vp CIRCLES] activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) activateItem(waitForObjectItem(":Sketch_QMenu", "Circle")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 400, 340, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 400, 370, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 400, + 340, + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 400, + 370, + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) activateItem(waitForObjectItem(":Sketch_QMenu", "Circle")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 400, 130, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 400, 150, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 400, + 130, + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 400, + 150, + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) test.vp("CIRCLES") @@ -81,11 +125,19 @@ def main(): # [step] Select axis for revolution mouseClick(waitForObject(":Revolution_QLineEdit_2"), 10, 10, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 651, 219, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 651, + 219, + 0, + Qt.LeftButton, + ) # [step] Click 'Reset view' toolbar button [vp RESET] clickButton(waitForObject(":SALOME*.Reset_QToolButton_2")) - mouseClick(waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton) # close tool bar extension bar + mouseClick( + waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton + ) # close tool bar extension bar fit_all() test.vp("RESET") @@ -96,7 +148,13 @@ def main(): # [step] Select face 'To' (biggest one) mouseClick(waitForObject(":To_QLineEdit_3"), 56, 5, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 209, 30, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 209, + 30, + 0, + Qt.LeftButton, + ) # [step] Fit all @@ -105,7 +163,13 @@ def main(): test.vp("PLANE_TO") # [step] Define offset for face 'To' - mouseClick(waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_3"), 10, 10, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_3"), + 10, + 10, + 0, + Qt.LeftButton, + ) type(waitForObject(":To.to_offset_ModuleBase_ParamSpinBox_3"), "") type(waitForObject(":To.to_offset_ModuleBase_ParamSpinBox_3"), 30) type(waitForObject(":To.to_offset_ModuleBase_ParamSpinBox_3"), "") @@ -117,15 +181,39 @@ def main(): # [step] Select face 'From' (smallest one) mouseClick(waitForObject(":From_QLineEdit_3"), 32, 10, 0, Qt.LeftButton) - sendEvent("QMouseEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), QEvent.MouseButtonPress, 518, 361, Qt.LeftButton, 1, 0) - sendEvent("QMouseEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), QEvent.MouseButtonRelease, 518, 361, Qt.LeftButton, 0, 0) + sendEvent( + "QMouseEvent", + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + QEvent.MouseButtonPress, + 518, + 361, + Qt.LeftButton, + 1, + 0, + ) + sendEvent( + "QMouseEvent", + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + QEvent.MouseButtonRelease, + 518, + 361, + Qt.LeftButton, + 0, + 0, + ) # [check] Check that preview is updated [vp PLANE_FROM] fit_all() test.vp("PLANE_FROM") # [step] Define offset for face 'From' - mouseClick(waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_4"), 38, 4, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_4"), + 38, + 4, + 0, + Qt.LeftButton, + ) type(waitForObject(":From.from_offset_ModuleBase_ParamSpinBox_3"), "") type(waitForObject(":From.from_offset_ModuleBase_ParamSpinBox_3"), 45) type(waitForObject(":From.from_offset_ModuleBase_ParamSpinBox_3"), "") diff --git a/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_006/test.py b/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_006/test.py index 5ca4b2e01..f90176264 100644 --- a/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_006/test.py +++ b/test.squish/suite_FEATURE_REVOLUTION/tst_revolution_006/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): # [project] SHAPER # [Scenario] Revolution_006 @@ -42,8 +43,21 @@ def main(): # [step] Activate Part_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 71, 10, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 70, 9, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1 (Not loaded)", + 71, + 10, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 70, + 9, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) # [step] Fit all [vp INIT] @@ -52,8 +66,12 @@ def main(): # TODO(spo): remove: workaround for the bug given RevolutionCut sketch created when select axis_object then apply is disabled waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1", 10, 10, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Sketch\\_1", 10, 10, 0) + clickItem( + ":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1", 10, 10, 0, Qt.LeftButton + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Sketch\\_1", 10, 10, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Edit...")) clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) @@ -62,7 +80,13 @@ def main(): mouseClick(waitForObjectItem(":_QMenu", "RevolutionCut")) # [step] Select sketch face - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 287, 236, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 287, + 236, + 0, + Qt.LeftButton, + ) # [step] Click "Set plane view" in property panel [vp PLANE] clickButton(waitForObject(":Sketcher plane.Set plane view_QPushButton")) @@ -71,14 +95,38 @@ def main(): # [step] Create 2 circles on the plane [vp CIRCLES] activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) activateItem(waitForObjectItem(":Sketch_QMenu", "Circle")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 650, 350, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 690, 350, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 650, + 350, + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 690, + 350, + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) activateItem(waitForObjectItem(":Sketch_QMenu", "Circle")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 650, 110, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 700, 110, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 650, + 110, + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 700, + 110, + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) test.vp("CIRCLES") @@ -88,30 +136,50 @@ def main(): # [step] Select axis for revolution mouseClick(waitForObject(":Revolution_QLineEdit_3"), 10, 10, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 750, 237, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 750, + 237, + 0, + Qt.LeftButton, + ) # [step] Select method 'by planes and offsets' clickButton(waitForObject(":Revolution_QToolButton_5")) # [step] Select face 'To': front face mouseClick(waitForObject(":To_QLineEdit_4"), 10, 10, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 334, 352, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 334, + 352, + 0, + Qt.LeftButton, + ) # [step] Select face 'From': back face mouseClick(waitForObject(":From_QLineEdit_4"), 117, 10, 0, Qt.LeftButton) clickButton(waitForObject(":SALOME*.-OY_QToolButton")) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 334, 352, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 334, + 352, + 0, + Qt.LeftButton, + ) # [step] Apply the feature clickButton(waitForObject(":RevolutionCut.property_panel_ok_QToolButton")) # [step] Click 'Reset view' toolbar button clickButton(waitForObject(":SALOME*.Reset_QToolButton_2")) - mouseClick(waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton) # close tool bar extension bar + mouseClick( + waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton + ) # close tool bar extension bar # [check] Check that operation has been executed successfully - #fit_all() + # fit_all() test.vp("REVOLUTION_CUT") # [step] Close application without saving diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_001/test.py b/test.squish/suite_FEATURE_SKETCH/tst_sketch_001/test.py index a53ce32d8..dadbf6745 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_001/test.py +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_001/test.py @@ -17,62 +17,63 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def sketch(): - #[step] Click 'Create sketch' toolbar button - #[step] Select XY plane for sketching - #[step] Sketch - Point - #[step] Create point via clicking inside viewer + # [step] Click 'Create sketch' toolbar button + # [step] Select XY plane for sketching + # [step] Sketch - Point + # [step] Create point via clicking inside viewer point_create_in_view((329, 255)) - #[step] Check 'Auxiliary' check-box - #[step] Create point via clicking inside viewer + # [step] Check 'Auxiliary' check-box + # [step] Create point via clicking inside viewer point_create_in_view((429, 300), 1) - #[step] Finish creation of points via viewer - #[step] Create point via direct input of coordinates. Use coordinates (50, 60) + # [step] Finish creation of points via viewer + # [step] Create point via direct input of coordinates. Use coordinates (50, 60) point_create((50, 60)) - #[step] Check 'Auxiliary' check-box - #[step] Create point via direct input of coordinates. Use coordinates (150, 60) + # [step] Check 'Auxiliary' check-box + # [step] Create point via direct input of coordinates. Use coordinates (150, 60) point_create((150, 60), 1) - #[step] Finish creation of points - #[step] Sketch - Line - #[step] Create line via direct input of coordinates. Use coordinates (0, 0) for start point and (100, 100) - for end point - line_create((0,0), (100, 100)) - #[step] Check 'Auxiliary' check-box - #[step] Create line via direct input of coordinates. Use coordinates (100, 100) for start point and (100, 100) - for end point + # [step] Finish creation of points + # [step] Sketch - Line + # [step] Create line via direct input of coordinates. Use coordinates (0, 0) for start point and (100, 100) - for end point + line_create((0, 0), (100, 100)) + # [step] Check 'Auxiliary' check-box + # [step] Create line via direct input of coordinates. Use coordinates (100, 100) for start point and (100, 100) - for end point line_create((100, 100), (200, 200), 1) - #[step] Create line via clicking inside viewer + # [step] Create line via clicking inside viewer line_create_in_view((400, 200), (600, 150)) - #[step] Check 'Auxiliary' check-box - #[step] Create line via clicking inside viewer + # [step] Check 'Auxiliary' check-box + # [step] Create line via clicking inside viewer line_create_in_view((600, 150), (500, 450), 1) - #[step] Finish creation of lines - #[step] Sketch - Circle - #[step] Create circle via direct input of coordinates. Use coordinates (0, 0) for center and 200 - for radius + # [step] Finish creation of lines + # [step] Sketch - Circle + # [step] Create circle via direct input of coordinates. Use coordinates (0, 0) for center and 200 - for radius circle_create((0, 0), 200) - #[step] Check 'Auxiliary' check-box - #[step] Create circle via direct input of coordinates. Use coordinates (0, 0) for center and 300 - for radius + # [step] Check 'Auxiliary' check-box + # [step] Create circle via direct input of coordinates. Use coordinates (0, 0) for center and 300 - for radius circle_create((0, 0), 300, 1) - #[step] Create circle via clicking inside viewer + # [step] Create circle via clicking inside viewer circle_create_in_view((400, 200), (260, 0)) - #[step] Check 'Auxiliary' check-box - #[step] Create circle via clicking inside viewer + # [step] Check 'Auxiliary' check-box + # [step] Create circle via clicking inside viewer circle_create_in_view((400, 200), (300, 100), 1) - #[step] Finish creation of circles - #[step] Sketch - Arc - #[step] Create arc via direct input of coordinates. Use coordinates (0, 0) for center, (100, 50) - for start point and (80, 90) - for end point + # [step] Finish creation of circles + # [step] Sketch - Arc + # [step] Create arc via direct input of coordinates. Use coordinates (0, 0) for center, (100, 50) - for start point and (80, 90) - for end point arc_create((0, 0), (100, 50), (80, 90)) - #[step] Check 'Auxiliary' check-box - #[step] Create arc via direct input of coordinates. Use coordinates (0, 0) for center, (200, 50) - for start point and (80, 90) - for end point + # [step] Check 'Auxiliary' check-box + # [step] Create arc via direct input of coordinates. Use coordinates (0, 0) for center, (200, 50) - for start point and (80, 90) - for end point arc_create((0, 0), (200, 50), (80, 90), 1) - #[step] Create arc via clicking inside viewer + # [step] Create arc via clicking inside viewer arc_create_in_view((218, 183), (102, 135), (128, 271)) - #[step] Check 'Auxiliary' check-box - #[step] Create arc via clicking inside viewer + # [step] Check 'Auxiliary' check-box + # [step] Create arc via clicking inside viewer arc_create_in_view((203, 185), (51, 134), (104, 282), 1) - #[step] CLick 'Fit all' button + # [step] CLick 'Fit all' button clickButton(waitForObject(":SALOME*.Fit All_QToolButton")) - #[check] All objects have been created. Check that objects of both types are shown (main and auxiliary) + # [check] All objects have been created. Check that objects of both types are shown (main and auxiliary) test.vp("VP1") - #[step] Finish sketching + # [step] Finish sketching def main(): @@ -80,30 +81,28 @@ def main(): # [project] SHAPER # [Scenario] Sketch_001 - #[Topic] Creation of objects in sketch - #[Tested functionality] Creation of objects during sketching by 2 ways: direct input of coordinates and clicking in viewer. Creation of auxiliary objects - #[Summary description] - #[Expected results] + # [Topic] Creation of objects in sketch + # [Tested functionality] Creation of objects during sketching by 2 ways: direct input of coordinates and clicking in viewer. Creation of auxiliary objects + # [Summary description] + # [Expected results] - #[section] Application start - #[step] Launch SALOME + # [section] Application start + # [step] Launch SALOME startApplication("salome_run.sh") set_defaults() - #[step] Activate SHAPER - #[step]Click 'New' button + # [step] Activate SHAPER + # [step]Click 'New' button activate_SHAPER() - #[section] Creation of sketch and objects inside it - #[step] Part - New part + # [section] Creation of sketch and objects inside it + # [step] Part - New part part_create() # clickButton(waitForObject(":Arc.Auxiliary_QCheckBox")) sketch_create(help_points("XY_plane"), lambda: sketch()) - #[check] Check that only main objects are shown + # [check] Check that only main objects are shown test.vp("VP2") - #[step] Close application without saving + # [step] Close application without saving close_application_wo_saving() - - diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_002/test.py b/test.squish/suite_FEATURE_SKETCH/tst_sketch_002/test.py index 2848826d0..86c9a891a 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_002/test.py +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_002/test.py @@ -17,24 +17,25 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def sketch(): - #[step] Click 'Create sketch' toolbar button - #[step] Select XY plane for sketching - #[step] Create random closed contour - line_create_in_view((101, 183),(265, 107)) + # [step] Click 'Create sketch' toolbar button + # [step] Select XY plane for sketching + # [step] Create random closed contour + line_create_in_view((101, 183), (265, 107)) line_create_in_view((265, 107), (520, 192)) line_create_in_view((520, 192), (443, 411)) closing_line_create_in_view((443, 411), (101, 183)) - #[step] Create one more closed contour inside previous, not parallel to it - line_create_in_view((219, 198),(269, 166)) + # [step] Create one more closed contour inside previous, not parallel to it + line_create_in_view((219, 198), (269, 166)) line_create_in_view((269, 166), (451, 230)) line_create_in_view((451, 230), (410, 334)) closing_line_create_in_view((410, 334), (219, 199)) - #[check] Check that lines are not parallel and there are no icons near lines + # [check] Check that lines are not parallel and there are no icons near lines test.vp("VP1") - #[step] Make according lines parallel + # [step] Make according lines parallel parallel((394, 151), (361, 199)) parallel((201, 137), (244, 182)) parallel((245, 278), (292, 249)) @@ -42,27 +43,28 @@ def sketch(): # [check] Check that lines are parallel and there are icons near lines test.vp("VP2") + def main(): # [project] SHAPER - #[Scenario] Sketch_002 - #[Topic] Parallel objects - #[Tested functionality]Parallelism between main lines + # [Scenario] Sketch_002 + # [Topic] Parallel objects + # [Tested functionality]Parallelism between main lines source(findFile("scripts", "common.py")) - #[section] Application start - #[step] Launch SALOME + # [section] Application start + # [step] Launch SALOME startApplication("salome_run.sh") set_defaults() - #[step] Activate SHAPER - #[step]Click 'New' button + # [step] Activate SHAPER + # [step]Click 'New' button activate_SHAPER() - #[section] Creation of main lines and make them parallel + # [section] Creation of main lines and make them parallel sketch_create(help_points("XY_plane"), lambda: sketch()) - #[step] Save study + # [step] Save study save("RESULTS_PATH + sketch_002") if object.exists(":Warning.Yes_QPushButton"): clickButton(waitForObject(":Warning.Yes_QPushButton")) diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_003/test.py b/test.squish/suite_FEATURE_SKETCH/tst_sketch_003/test.py index 2baacc7ca..ca4f29057 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_003/test.py +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_003/test.py @@ -17,70 +17,101 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def sketch(): circle_create_in_view((302, 221), (436, 287)) + def main(): - #[project] SHAPER - #[Scenario] Sketch_003 - #[Topic] - #[Tested functionality] Saving and opening studies - #[Summary description] - #[Expected results] - #[General comments] + # [project] SHAPER + # [Scenario] Sketch_003 + # [Topic] + # [Tested functionality] Saving and opening studies + # [Summary description] + # [Expected results] + # [General comments] source(findFile("scripts", "common.py")) - #[section] Application start - #[step] Launch SALOME + # [section] Application start + # [step] Launch SALOME startApplication("salome_run.sh") set_defaults() - #[section] Creation of 3D model - #[step] Activate SHAPER - #[step]Click 'New' button + # [section] Creation of 3D model + # [step] Activate SHAPER + # [step]Click 'New' button activate_SHAPER() - #[step] Create new part + # [step] Create new part part_create() - #[step] Create sketch, consisting from one circle + # [step] Create sketch, consisting from one circle sketch_create(help_points("XZ_plane"), lambda: sketch()) - #[step] Execute extrusion. Use parameters to size = 100 and from size = 50 + # [step] Execute extrusion. Use parameters to size = 100 and from size = 50 extrusion((182, 140), 100, 50) - #[step] Rotate obtained model + # [step] Rotate obtained model type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "") - mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 425, 422, 20, -23, 67108865, Qt.LeftButton) + mouseDrag( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 425, + 422, + 20, + -23, + 67108865, + Qt.LeftButton, + ) type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "") - mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 446, 411, -13, -137, 67108866, Qt.RightButton) + mouseDrag( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 446, + 411, + -13, + -137, + 67108866, + Qt.RightButton, + ) test.vp("VP1") - #[section] Save file - #[step] File - Save as - #[step] 'Save as' dialog appears - #[step] Type name of file - #[step] Click 'Save' button + # [section] Save file + # [step] File - Save as + # [step] 'Save as' dialog appears + # [step] Type name of file + # [step] Click 'Save' button save("RESULTS_PATH + sketch_003") if object.exists(":Warning.Yes_QPushButton"): clickButton(waitForObject(":Warning.Yes_QPushButton")) - #[step] Close document + # [step] Close document clickButton(waitForObject(":SALOME*.Close_QToolButton")) - #[step] File - Open - #[step} Open just saved file + # [step] File - Open + # [step} Open just saved file open("RESULTS_PATH + sketch_003.hdf") - #[step] Activate SHAPER + # [step] Activate SHAPER clickButton(waitForObject(":SALOME*.Shaper_QToolButton")) - #[step] Activate Part_1 + # [step] Activate Part_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 50, 11, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 50, 11, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1 (Not loaded)", + 50, + 11, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 50, + 11, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) - #[check] Check that file was loaded correct + # [check] Check that file was loaded correct test.vp("VP2") - #[step] Close application + # [step] Close application close_application() diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_004/test.py b/test.squish/suite_FEATURE_SKETCH/tst_sketch_004/test.py index 01d31d8ec..18dca0f6d 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_004/test.py +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_004/test.py @@ -19,65 +19,94 @@ import os + def main(): - #[project] SHAPER - #[Scenario] Sketch_004 - #[Topic] 'Distance' constraint - #[Tested functionality] - #[Summary description] - #[Expected results] - #[General comments] + # [project] SHAPER + # [Scenario] Sketch_004 + # [Topic] 'Distance' constraint + # [Tested functionality] + # [Summary description] + # [Expected results] + # [General comments] source(findFile("scripts", "common.py")) - #[section] Application start - #[step] Launch SALOME + # [section] Application start + # [step] Launch SALOME startApplication("salome_run.sh") set_defaults() - #[step] Open 'for_sketch_004.hdf' + # [step] Open 'for_sketch_004.hdf' open(os.path.join(DATA_PATH, "for_sketch_004.hdf")) - #[step] Activate SHAPER + # [step] Activate SHAPER clickButton(waitForObject(":SALOME*.Shaper_QToolButton")) - #[step] Activate Part_1 + # [step] Activate Part_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 51, 7, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 51, 7, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1 (Not loaded)", + 51, + 7, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 51, + 7, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) - #[step] Edit Sketch_1 + # [step] Edit Sketch_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1", 54, 11, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Sketch\\_1", 54, 11, 0) + clickItem( + ":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1", 54, 11, 0, Qt.LeftButton + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Sketch\\_1", 54, 11, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Edit...")) - #[step] Click '+OY' view button + # [step] Click '+OY' view button clickButton(waitForObject(":SALOME*.+OY_QToolButton")) - #[step] Set constraint 'Distance' between circle and point + # [step] Set constraint 'Distance' between circle and point distance((44, 224), (601, 259), (561, 195)) - #[check] Check that constraint has been set + # [check] Check that constraint has been set test.vp("VP1") - #[step] Change distance to 500 + # [step] Change distance to 500 change_distance((324, 176), 500) - #[check] Check that distance is 500 + # [check] Check that distance is 500 test.vp("VP2") - #[step] Delete constraint - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 302, 270, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 326, 181, 0, Qt.LeftButton) + # [step] Delete constraint + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 302, + 270, + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 326, + 181, + 0, + Qt.LeftButton, + ) type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "") - #[check] Check that constraint has been removed + # [check] Check that constraint has been removed test.vp("VP3") - #[step] Close application + # [step] Close application close_application() - #[section] - #[step] - #[step] - #[comment] - #[check] - + # [section] + # [step] + # [step] + # [comment] + # [check] diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_005/test.py b/test.squish/suite_FEATURE_SKETCH/tst_sketch_005/test.py index c880244cb..2f16b57a2 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_005/test.py +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_005/test.py @@ -17,58 +17,59 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def sketch(): - #[step] Click 'Create sketch' toolbar button - #[step] Select XY plane for sketching - #[step] Sketch - Point - #[step] Create point via clicking inside viewer + # [step] Click 'Create sketch' toolbar button + # [step] Select XY plane for sketching + # [step] Sketch - Point + # [step] Create point via clicking inside viewer point_create_in_view((340, 205)) - #[step] Check 'Auxiliary' check-box - #[step] Create point via clicking inside viewer + # [step] Check 'Auxiliary' check-box + # [step] Create point via clicking inside viewer point_create_in_view((489, 380), 1) - #[step] Finish creation of points via viewer - #[step] Create point via direct input of coordinates. Use coordinates (50, 60) + # [step] Finish creation of points via viewer + # [step] Create point via direct input of coordinates. Use coordinates (50, 60) point_create((80, 160)) - #[step] Check 'Auxiliary' check-box - #[step] Create point via direct input of coordinates. Use coordinates (150, 60) + # [step] Check 'Auxiliary' check-box + # [step] Create point via direct input of coordinates. Use coordinates (150, 60) point_create((250, 50), 1) - #[step] Fix positions of 2 points + # [step] Fix positions of 2 points point_fixe((340, 205)) point_fixe((504, 227)) - #[check] Check that 2 points have 'anchor' icons near themselves + # [check] Check that 2 points have 'anchor' icons near themselves test.vp("VP1") - #[step] Define distance between fixed and free points + # [step] Define distance between fixed and free points distance((340, 205), (490, 381), (201, 320)) # [step] Change distance set change_distance((275, 407), 200) # [step] Check that distance has been modified, free point moved test.vp("VP3") -def main(): +def main(): # [project] SHAPER # [Scenario] Sketch_005 - #[Topic] Fixed point - #[Tested functionality] - #[Summary description] - #[Expected results] + # [Topic] Fixed point + # [Tested functionality] + # [Summary description] + # [Expected results] source(findFile("scripts", "common.py")) - #[section] Application start - #[step] Launch SALOME + # [section] Application start + # [step] Launch SALOME startApplication("salome_run.sh") set_defaults() - #[step] Activate SHAPER - #[step]Click 'New' button + # [step] Activate SHAPER + # [step]Click 'New' button activate_SHAPER() - #[section] Creation of sketch and objects inside it - #[step] Part - New part + # [section] Creation of sketch and objects inside it + # [step] Part - New part part_create() sketch_create(help_points("XY_plane"), lambda: sketch()) - #[step] Close application without saving + # [step] Close application without saving close_application() diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_006/test.py b/test.squish/suite_FEATURE_SKETCH/tst_sketch_006/test.py index 05d0d2b77..67df3724b 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_006/test.py +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_006/test.py @@ -17,60 +17,86 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): - #[project] SHAPER - #[Scenario] Sketch_006 - #[Topic] Parallel lines - #[Tested functionality] 'Parallel' constraint - #[Summary description] - #[Expected results] - #[General comments] + # [project] SHAPER + # [Scenario] Sketch_006 + # [Topic] Parallel lines + # [Tested functionality] 'Parallel' constraint + # [Summary description] + # [Expected results] + # [General comments] source(findFile("scripts", "common.py")) - #[section] Application start - #[step] Launch SALOME + # [section] Application start + # [step] Launch SALOME startApplication("salome_run.sh") set_defaults() - #[step] Open 'for_sketch_006.hdf' + # [step] Open 'for_sketch_006.hdf' open(DATA_PATH + "/for_sketch_006.hdf") - #[step] Activate SHAPER + # [step] Activate SHAPER clickButton(waitForObject(":SALOME*.Shaper_QToolButton")) - #[step] Activate Part_1 + # [step] Activate Part_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 51, 7, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 51, 7, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1 (Not loaded)", + 51, + 7, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 51, + 7, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) - #[step] Edit Sketch_1 + # [step] Edit Sketch_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1", 54, 11, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Sketch\\_1", 54, 11, 0) + clickItem( + ":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1", 54, 11, 0, Qt.LeftButton + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Sketch\\_1", 54, 11, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Edit...")) - #[step] Click '+OZ' view button + # [step] Click '+OZ' view button clickButton(waitForObject(":SALOME*.+OZ_QToolButton")) - #[step] Make lines parallel + # [step] Make lines parallel parallel((77, 174), (580, 284)) - #[check] Check that lines are parallel + # [check] Check that lines are parallel test.vp("VP1") - #[step] Select 'Parallel' icon near the line - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 103, 255, 0, Qt.LeftButton) - #[check] Check that Input panel 'Parallel' appears, there are the names of lines in text boxes + # [step] Select 'Parallel' icon near the line + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 103, + 255, + 0, + Qt.LeftButton, + ) + # [check] Check that Input panel 'Parallel' appears, there are the names of lines in text boxes waitFor("object.exists(':Parallel.First line_QLineEdit')", 20000) test.compare(str(findObject(":Parallel.First line_QLineEdit").text), "SketchLine_1") waitFor("object.exists(':Parallel.Second line_QLineEdit')", 20000) - test.compare(str(findObject(":Parallel.Second line_QLineEdit").text), "SketchLine_2") - #[check] Check that lines are selected and highlighted in viewer + test.compare( + str(findObject(":Parallel.Second line_QLineEdit").text), "SketchLine_2" + ) + # [check] Check that lines are selected and highlighted in viewer test.vp("VP3") - #[step] Confirm 'Parallel' operation + # [step] Confirm 'Parallel' operation clickButton(waitForObject(":Parallel.property_panel_ok_QToolButton")) - #[step] Confirm edition of the sketch + # [step] Confirm edition of the sketch clickButton(waitForObject(":Sketch.property_panel_ok_QToolButton")) - #[step] Close application + # [step] Close application close_application() diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_007/test.py b/test.squish/suite_FEATURE_SKETCH/tst_sketch_007/test.py index 5f55daad6..8a760fee0 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_007/test.py +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_007/test.py @@ -17,70 +17,97 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): - #[project] SHAPER - #[Scenario] Sketch_007 - #[Topic] Perpendicular lines - #[Tested functionality] 'Perpendicular' constraint - #[Summary description] - #[Expected results] - #[General comments] + # [project] SHAPER + # [Scenario] Sketch_007 + # [Topic] Perpendicular lines + # [Tested functionality] 'Perpendicular' constraint + # [Summary description] + # [Expected results] + # [General comments] source(findFile("scripts", "common.py")) - #[section] Application start - #[step] Launch SALOME + # [section] Application start + # [step] Launch SALOME startApplication("salome_run.sh") set_defaults() - #[step] Open 'for_sketch_006.hdf' + # [step] Open 'for_sketch_006.hdf' open(DATA_PATH + "/for_sketch_007.hdf") - #[step] Activate SHAPER + # [step] Activate SHAPER clickButton(waitForObject(":SALOME*.Shaper_QToolButton")) - #[step] Activate Part_1 + # [step] Activate Part_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 51, 7, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 51, 7, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1 (Not loaded)", + 51, + 7, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Part\\_1 (Not loaded)", + 51, + 7, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) - #[step] Edit Sketch_1 + # [step] Edit Sketch_1 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1", 54, 11, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Sketch\\_1", 54, 11, 0) + clickItem( + ":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1", 54, 11, 0, Qt.LeftButton + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Sketch\\_1", 54, 11, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Edit...")) - #[step] Click '+OZ' view button + # [step] Click '+OZ' view button clickButton(waitForObject(":SALOME*.+OZ_QToolButton")) - #[step] Make lines perpendicular + # [step] Make lines perpendicular perpendicular((331, 155), (386, 169)) - #[step] Fit all + # [step] Fit all clickButton(waitForObject(":SALOME*.Fit All_QToolButton")) - #[check] that lines are perpendicular + # [check] that lines are perpendicular test.vp("VP1") - #[step] Select the 'perpendicular' icon near the line - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 372, 263, 0, Qt.LeftButton) + # [step] Select the 'perpendicular' icon near the line + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 372, + 263, + 0, + Qt.LeftButton, + ) - #[check] Check that Input panel 'Perpendicular' appears, there are the names of lines in text boxes + # [check] Check that Input panel 'Perpendicular' appears, there are the names of lines in text boxes waitFor("object.exists(':Perpendicular.First line_QLineEdit')", 20000) - test.compare(str(findObject(":Perpendicular.First line_QLineEdit").text), "SketchLine_1") + test.compare( + str(findObject(":Perpendicular.First line_QLineEdit").text), "SketchLine_1" + ) waitFor("object.exists(':Perpendicular.Second line_QLineEdit')", 20000) - test.compare(str(findObject(":Perpendicular.Second line_QLineEdit").text), "SketchLine_2") + test.compare( + str(findObject(":Perpendicular.Second line_QLineEdit").text), "SketchLine_2" + ) # [check] Check that lines are selected and highlighted in viewer test.vp("VP3") - #[step] Confirm 'Perpendicular' operation + # [step] Confirm 'Perpendicular' operation clickButton(waitForObject(":Perpendicular.property_panel_ok_QToolButton")) - #[step] Confirm edition of the sketch + # [step] Confirm edition of the sketch clickButton(waitForObject(":Sketch.property_panel_ok_QToolButton")) - #[step] Close application + # [step] Close application close_application() - diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_008/test.py b/test.squish/suite_FEATURE_SKETCH/tst_sketch_008/test.py index 0a89e7735..f0eb5f444 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_008/test.py +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_008/test.py @@ -17,47 +17,48 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def sketch(): - #[step] Click 'Create sketch' toolbar button - #[step] Select XY plane for sketching - #[step] Create point + # [step] Click 'Create sketch' toolbar button + # [step] Select XY plane for sketching + # [step] Create point point_create_in_view((340, 205)) - #[step] Create line + # [step] Create line line_create_in_view((274, 367), (554, 189)) - #[step] Make them coincident + # [step] Make them coincident coincident((340, 205), (390, 293)) - #[check] Check that objects are coincident + # [check] Check that objects are coincident test.vp("VP1") - #[step] Uncheck 'Show constraints' check-box + # [step] Uncheck 'Show constraints' check-box clickButton(waitForObject(":Sketch.Show constraints_QCheckBox")) - #[check] Check that 'Coincident' icon disappears + # [check] Check that 'Coincident' icon disappears test.vp("VP2") -def main(): +def main(): # [project] SHAPER # [Scenario] Sketch_008 - #[Topic] 'Coincident' functionality - #[Tested functionality] - #[Summary description] - #[Expected results] + # [Topic] 'Coincident' functionality + # [Tested functionality] + # [Summary description] + # [Expected results] source(findFile("scripts", "common.py")) - #[section] Application start - #[step] Launch SALOME + # [section] Application start + # [step] Launch SALOME startApplication("salome_run.sh") set_defaults() - #[step] Activate SHAPER - #[step]Click 'New' button + # [step] Activate SHAPER + # [step]Click 'New' button activate_SHAPER() - #[section] Creation of sketch and objects inside it - #[step] Part - New part + # [section] Creation of sketch and objects inside it + # [step] Part - New part part_create() sketch_create(help_points("XY_plane"), lambda: sketch()) - #[step] Close application without saving + # [step] Close application without saving close_application() diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_009/test.py b/test.squish/suite_FEATURE_SKETCH/tst_sketch_009/test.py index 848e3e36f..6dd0ae677 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_009/test.py +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_009/test.py @@ -17,36 +17,39 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): - #[project] SHAPER - #[Scenario] Sketch_009 - #[Topic] 'Equal' functionality - #[Tested functionality] - #[Summary description] - #[Expected results] - #[General comments] + # [project] SHAPER + # [Scenario] Sketch_009 + # [Topic] 'Equal' functionality + # [Tested functionality] + # [Summary description] + # [Expected results] + # [General comments] source(findFile("scripts", "common.py")) - #[section] Application start - #[step] Launch SALOME + # [section] Application start + # [step] Launch SALOME startApplication("salome_run.sh") set_defaults() - #[step] Open 'for_sketch_006.hdf' + # [step] Open 'for_sketch_006.hdf' open(DATA_PATH + "/for_sketch_009.hdf") - #[step] Activate SHAPER + # [step] Activate SHAPER clickButton(waitForObject(":SALOME*.Shaper_QToolButton")) - #[step] Edit 'Sketch_1' + # [step] Edit 'Sketch_1' waitForObjectItem(":Object browser_XGUI_DataTree", "Sketch\\_1") clickItem(":Object browser_XGUI_DataTree", "Sketch\\_1", 43, 12, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Edit...")) - #[step] Click '+OZ' button + # [step] Click '+OZ' button clickButton(waitForObject(":SALOME*.+OZ_QToolButton")) # [check] Make lines equal @@ -55,17 +58,23 @@ def main(): # [step] Fit all clickButton(waitForObject(":SALOME*.Fit All_QToolButton")) - #[check] Check that lines are equal + # [check] Check that lines are equal test.vp("VP1") # [step] Select 'Equal' icon in viewer near any objects - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 451, 186, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 451, + 186, + 0, + Qt.LeftButton, + ) - #[check] Check that input panel 'Equal' appears + # [check] Check that input panel 'Equal' appears waitFor("object.exists(':Equal.First object_QLineEdit')", 20000) test.compare(str(findObject(":Equal.First object_QLineEdit").text), "SketchLine_1") waitFor("object.exists(':Equal.Second object_QLineEdit')", 20000) test.compare(str(findObject(":Equal.Second object_QLineEdit").text), "SketchLine_2") - #[step] Close application without saving + # [step] Close application without saving close_application() diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_010/test.py b/test.squish/suite_FEATURE_SKETCH/tst_sketch_010/test.py index 14da326eb..f2abd3f60 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_010/test.py +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_010/test.py @@ -17,52 +17,55 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): - #[project] SHAPER - #[Scenario] Sketch_010 - #[Topic] 'Vertical' functionality - #[Tested functionality] - #[Summary description] - #[Expected results] - #[General comments] + # [project] SHAPER + # [Scenario] Sketch_010 + # [Topic] 'Vertical' functionality + # [Tested functionality] + # [Summary description] + # [Expected results] + # [General comments] source(findFile("scripts", "common.py")) - #[section] Application start - #[step] Launch SALOME + # [section] Application start + # [step] Launch SALOME startApplication("salome_run.sh") set_defaults() - #[step] Open 'for_sketch_006.hdf' + # [step] Open 'for_sketch_006.hdf' open(DATA_PATH + "/for_sketch_010.hdf") - #[step] Activate SHAPER + # [step] Activate SHAPER clickButton(waitForObject(":SALOME*.Shaper_QToolButton")) - #[step] Edit 'Sketch_1' + # [step] Edit 'Sketch_1' waitForObjectItem(":Object browser_XGUI_DataTree", "Sketch\\_1") clickItem(":Object browser_XGUI_DataTree", "Sketch\\_1", 43, 12, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Edit...")) - #[step] Click '+OZ' button + # [step] Click '+OZ' button clickButton(waitForObject(":SALOME*.+OZ_QToolButton")) - #[step] Make one of lines vertical + # [step] Make one of lines vertical vertical((129, 346)) - #[step] Fit all + # [step] Fit all fit_all() - #[check] Check that one of lines became vertical + # [check] Check that one of lines became vertical test.vp("VP1") - #[step] Uncheck 'Show constraint' check-box + # [step] Uncheck 'Show constraint' check-box clickButton(waitForObject(":Sketch.Show constraints_QCheckBox")) - #[check] Check that icon disappears + # [check] Check that icon disappears test.vp("VP3") - #[step] Close application without saving + # [step] Close application without saving close_application() diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_011/test.py b/test.squish/suite_FEATURE_SKETCH/tst_sketch_011/test.py index 31ee70224..7e8680267 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_011/test.py +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_011/test.py @@ -17,52 +17,55 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): - #[project] SHAPER - #[Scenario] Sketch_010 - #[Topic] 'Horizontal' functionality - #[Tested functionality] - #[Summary description] - #[Expected results] - #[General comments] + # [project] SHAPER + # [Scenario] Sketch_010 + # [Topic] 'Horizontal' functionality + # [Tested functionality] + # [Summary description] + # [Expected results] + # [General comments] source(findFile("scripts", "common.py")) - #[section] Application start - #[step] Launch SALOME + # [section] Application start + # [step] Launch SALOME startApplication("salome_run.sh") set_defaults() - #[step] Open 'for_sketch_006.hdf' + # [step] Open 'for_sketch_006.hdf' open(DATA_PATH + "/for_sketch_010.hdf") - #[step] Activate SHAPER + # [step] Activate SHAPER clickButton(waitForObject(":SALOME*.Shaper_QToolButton")) - #[step] Edit 'Sketch_1' + # [step] Edit 'Sketch_1' waitForObjectItem(":Object browser_XGUI_DataTree", "Sketch\\_1") clickItem(":Object browser_XGUI_DataTree", "Sketch\\_1", 43, 12, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Edit...")) - #[step] Click '+OZ' button + # [step] Click '+OZ' button clickButton(waitForObject(":SALOME*.+OZ_QToolButton")) # [step] Make second line horizontal horizontal((465, 173)) - #[step] Fit all + # [step] Fit all fit_all() - #[check] Check that second line became horizontal + # [check] Check that second line became horizontal test.vp("VP1") - #[step] Uncheck 'Show constraint' check-box + # [step] Uncheck 'Show constraint' check-box clickButton(waitForObject(":Sketch.Show constraints_QCheckBox")) - #[check] Check that icon disappears + # [check] Check that icon disappears test.vp("VP2") - #[step] Close application without saving + # [step] Close application without saving close_application() diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_012/test.py b/test.squish/suite_FEATURE_SKETCH/tst_sketch_012/test.py index 3d5554969..3a3c0c67e 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_012/test.py +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_012/test.py @@ -17,63 +17,80 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): - #[project] SHAPER - #[Scenario] Sketch_012 - #[Topic] 'Length' functionality - #[Tested functionality] - #[Summary description] - #[Expected results] - #[General comments] + # [project] SHAPER + # [Scenario] Sketch_012 + # [Topic] 'Length' functionality + # [Tested functionality] + # [Summary description] + # [Expected results] + # [General comments] source(findFile("scripts", "common.py")) - #[section] Application start - #[step] Launch SALOME + # [section] Application start + # [step] Launch SALOME startApplication("salome_run.sh") set_defaults() - #[step] Open 'for_sketch_012.hdf' + # [step] Open 'for_sketch_012.hdf' open(DATA_PATH + "/for_sketch_012.hdf") - #[step] Activate SHAPER + # [step] Activate SHAPER clickButton(waitForObject(":SALOME*.Shaper_QToolButton")) - #[step] Edit 'Sketch_1' + # [step] Edit 'Sketch_1' waitForObjectItem(":Object browser_XGUI_DataTree", "Sketch\\_1") clickItem(":Object browser_XGUI_DataTree", "Sketch\\_1", 43, 12, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Edit...")) - #[step] Click '+OZ' button + # [step] Click '+OZ' button clickButton(waitForObject(":SALOME*.+OZ_QToolButton")) - #[step] Define length for main line + # [step] Define length for main line length((78, 376), (130, 341)) - #[step] Define length for auxilliary line + # [step] Define length for auxilliary line mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Length")) - mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 435, 443, 331, -417, 1, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 546, 169, 0, Qt.LeftButton) - #clickButton(waitForObject(":Length.property_panel_ok_QToolButton")) + mouseDrag( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 435, + 443, + 331, + -417, + 1, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 546, + 169, + 0, + Qt.LeftButton, + ) + # clickButton(waitForObject(":Length.property_panel_ok_QToolButton")) clickButton(waitForObject(":Length.property_panel_cancel_QToolButton")) - #[check] Check that lengths have been defined successfully + # [check] Check that lengths have been defined successfully test.vp("VP1") # [step] Change length of main line to 200 change_length((125, 336), 200) - #[step] Change length of auxilliary line to 500 + # [step] Change length of auxilliary line to 500 change_length((542, 169), 500) - #[step] Click 'Fit all' button + # [step] Click 'Fit all' button fit_all() - #[check] Check that modifications have been executed successfully + # [check] Check that modifications have been executed successfully test.vp("VP2") - #[step] Close application without saving + # [step] Close application without saving close_application() diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_013/test.py b/test.squish/suite_FEATURE_SKETCH/tst_sketch_013/test.py index a1bf3bb5c..f3ffe9e8f 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_013/test.py +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_013/test.py @@ -17,58 +17,61 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): - #[project] SHAPER - #[Scenario] Sketch_013 - #[Topic] 'Radius' functionality - #[Tested functionality] - #[Summary description] - #[Expected results] - #[General comments] + # [project] SHAPER + # [Scenario] Sketch_013 + # [Topic] 'Radius' functionality + # [Tested functionality] + # [Summary description] + # [Expected results] + # [General comments] source(findFile("scripts", "common.py")) - #[section] Application start - #[step] Launch SALOME + # [section] Application start + # [step] Launch SALOME startApplication("salome_run.sh") set_defaults() - #[step] Open 'for_sketch_013.hdf' + # [step] Open 'for_sketch_013.hdf' open(DATA_PATH + "/for_sketch_013.hdf") - #[step] Activate SHAPER + # [step] Activate SHAPER clickButton(waitForObject(":SALOME*.Shaper_QToolButton")) - #[step] Edit 'Sketch_1' + # [step] Edit 'Sketch_1' waitForObjectItem(":Object browser_XGUI_DataTree", "Sketch\\_1") clickItem(":Object browser_XGUI_DataTree", "Sketch\\_1", 43, 12, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Edit...")) - #[step] Click '+OZ' button + # [step] Click '+OZ' button clickButton(waitForObject(":SALOME*.+OZ_QToolButton")) - #[step] Define radius for circle + # [step] Define radius for circle radius((270, 252), (205, 224)) - #[step] Define radius for arc + # [step] Define radius for arc radius((718, 168), (677, 203)) - #[check] Check that constraints have been set successfully + # [check] Check that constraints have been set successfully test.vp("VP1") - #[step] Change radius of the circle to 150: select constraint and type '150' in 'Radius' field + # [step] Change radius of the circle to 150: select constraint and type '150' in 'Radius' field change_radius((192, 228), 150) - #[step] Change radius of the arc to 100: select constraint and type '100' in 'Radius' field + # [step] Change radius of the arc to 100: select constraint and type '100' in 'Radius' field change_radius((674, 200), 100) - #[step] Click 'Fit all' button + # [step] Click 'Fit all' button fit_all() - #[check] Check that radiuses have been changed successfully + # [check] Check that radiuses have been changed successfully test.vp("VP2") - #[step] Close application without saving + # [step] Close application without saving close_application() diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_014/test.py b/test.squish/suite_FEATURE_SKETCH/tst_sketch_014/test.py index f73c4b660..a98f8c216 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_014/test.py +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_014/test.py @@ -17,57 +17,76 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): - #[project] SHAPER - #[Scenario] Sketch_014 - #[Topic] 'Mirror' functionality - #[Tested functionality] - #[Summary description] - #[Expected results] - #[General comments] + # [project] SHAPER + # [Scenario] Sketch_014 + # [Topic] 'Mirror' functionality + # [Tested functionality] + # [Summary description] + # [Expected results] + # [General comments] source(findFile("scripts", "common.py")) - #[section] Application start - #[step] Launch SALOME + # [section] Application start + # [step] Launch SALOME startApplication("salome_run.sh") set_defaults() - #[step] Open 'for_sketch_014.hdf' + # [step] Open 'for_sketch_014.hdf' open(DATA_PATH + "/for_sketch_014.hdf") - #[step] Activate SHAPER + # [step] Activate SHAPER clickButton(waitForObject(":SALOME*.Shaper_QToolButton")) - #[step] Edit 'Sketch_1' + # [step] Edit 'Sketch_1' waitForObjectItem(":Object browser_XGUI_DataTree", "Sketch\\_1") clickItem(":Object browser_XGUI_DataTree", "Sketch\\_1", 43, 12, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Edit...")) - #[step] Click '+OZ' button + # [step] Click '+OZ' button clickButton(waitForObject(":SALOME*.+OZ_QToolButton")) - #[step] Sketch - Mirror + # [step] Sketch - Mirror mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Mirror")) - #[step] Select long line as mirror line + # [step] Select long line as mirror line mouseClick(waitForObject(":Mirror.Mirror line_QLineEdit"), 122, 5, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 256, 193, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 256, + 193, + 0, + Qt.LeftButton, + ) - #[step] Select other objects as objects for mirror - mouseClick(waitForObject(":Mirror.Segments:_QListWidget"), 147, 69, 0, Qt.LeftButton) - mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 45, 277, 689, 219, 1, Qt.LeftButton) + # [step] Select other objects as objects for mirror + mouseClick( + waitForObject(":Mirror.Segments:_QListWidget"), 147, 69, 0, Qt.LeftButton + ) + mouseDrag( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 45, + 277, + 689, + 219, + 1, + Qt.LeftButton, + ) - #[step] Ok + # [step] Ok clickButton(waitForObject(":Mirror.property_panel_ok_QToolButton")) - #[step] Click Fit all button + # [step] Click Fit all button fit_all() - #[check] Check that mirroring has been executed successfully + # [check] Check that mirroring has been executed successfully test.vp("VP1") # [step] Close application without saving diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_015/test.py b/test.squish/suite_FEATURE_SKETCH/tst_sketch_015/test.py index ce9b410b1..ffa252999 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_015/test.py +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_015/test.py @@ -17,59 +17,74 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): - #[project] SHAPER - #[Scenario] Sketch_015 - #[Topic] 'Fillet' functionality - #[Tested functionality] - #[Summary description] - #[Expected results] - #[General comments] + # [project] SHAPER + # [Scenario] Sketch_015 + # [Topic] 'Fillet' functionality + # [Tested functionality] + # [Summary description] + # [Expected results] + # [General comments] source(findFile("scripts", "common.py")) - #[section] Application start - #[step] Launch SALOME + # [section] Application start + # [step] Launch SALOME startApplication("salome_run.sh") set_defaults() - #[step] Open 'for_sketch_015.hdf' + # [step] Open 'for_sketch_015.hdf' open(DATA_PATH + "/for_sketch_015.hdf") - #[step] Activate SHAPER + # [step] Activate SHAPER clickButton(waitForObject(":SALOME*.Shaper_QToolButton")) - #[step] Edit 'Sketch_1' + # [step] Edit 'Sketch_1' waitForObjectItem(":Object browser_XGUI_DataTree", "Sketch\\_1") clickItem(":Object browser_XGUI_DataTree", "Sketch\\_1", 43, 12, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Edit...")) - #[step] Click '+OZ' button + # [step] Click '+OZ' button clickButton(waitForObject(":SALOME*.+OZ_QToolButton")) - #[step] Sketch - Fillet + # [step] Sketch - Fillet mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Fillet")) - #[step] Select first line in viewer - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 99, 222, 0, Qt.LeftButton) - - #[step] Select first line in viewer - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 277, 479, 0, Qt.LeftButton) - - #[step] Input value equal to 50 + # [step] Select first line in viewer + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 99, + 222, + 0, + Qt.LeftButton, + ) + + # [step] Select first line in viewer + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 277, + 479, + 0, + Qt.LeftButton, + ) + + # [step] Input value equal to 50 type(waitForObject(":Fillet.ConstraintValue_ModuleBase_ParamSpinBox"), "") type(waitForObject(":Fillet.ConstraintValue_ModuleBase_ParamSpinBox"), 50) - #[check] Check that preview is updated + # [check] Check that preview is updated test.vp("VP1") - #[step] Ok + # [step] Ok clickButton(waitForObject(":Fillet.property_panel_ok_QToolButton")) - #[check] Check that fillet has been executed successfully + # [check] Check that fillet has been executed successfully test.vp("VP2") # [step] Close application without saving diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_016/test.py b/test.squish/suite_FEATURE_SKETCH/tst_sketch_016/test.py index 025cf3be6..0149372f1 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_016/test.py +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_016/test.py @@ -17,78 +17,170 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): - #[project] SHAPER - #[Scenario] Sketch_016 - #[Topic] 'Translation' functionality - #[Tested functionality] - #[Summary description] - #[Expected results] - #[General comments] + # [project] SHAPER + # [Scenario] Sketch_016 + # [Topic] 'Translation' functionality + # [Tested functionality] + # [Summary description] + # [Expected results] + # [General comments] source(findFile("scripts", "common.py")) - #[section] Application start - #[step] Launch SALOME + # [section] Application start + # [step] Launch SALOME startApplication("salome_run.sh") set_defaults() - #[step] Open 'for_sketch_016.hdf' + # [step] Open 'for_sketch_016.hdf' open(DATA_PATH + "/for_sketch_016.hdf") - #[step] Activate SHAPER + # [step] Activate SHAPER clickButton(waitForObject(":SALOME*.Shaper_QToolButton")) - #[step] Edit 'Sketch_1' + # [step] Edit 'Sketch_1' waitForObjectItem(":Object browser_XGUI_DataTree", "Sketch\\_1") clickItem(":Object browser_XGUI_DataTree", "Sketch\\_1", 43, 12, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Edit...")) - #[step] Click '+OZ' button + # [step] Click '+OZ' button clickButton(waitForObject(":SALOME*.+OZ_QToolButton")) - #[step] Sketch - Translation + # [step] Sketch - Translation activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) activateItem(waitForObjectItem(":Sketch_QMenu", "Translation")) - mouseClick(waitForObject(":Translation.Segments:_QListWidget"), 115, 35, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Translation.Segments:_QListWidget"), 115, 35, 0, Qt.LeftButton + ) - #[step] Select all objects for translation + # [step] Select all objects for translation type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "") - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 90, 130, 33554432, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 440, 132, 33554432, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 573, 199, 33554432, Qt.LeftButton) - - #[step] Click in viewer to define start point - mouseClick(waitForObject(":Start point.qt_spinbox_lineedit_QLineEdit"), 53, 7, 0, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 112, 453, 0, Qt.LeftButton) - - #[step] Click in viewer to define end point, for this zoom out preview - mouseClick(waitForObject(":End point.qt_spinbox_lineedit_QLineEdit"), 154, 9, 0, Qt.LeftButton) - sendEvent("QWheelEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 451, 434, -120, 0, 2) - sendEvent("QWheelEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 451, 434, -120, 0, 2) - sendEvent("QWheelEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 451, 434, -120, 0, 2) - sendEvent("QWheelEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 451, 434, -120, 0, 2) - sendEvent("QWheelEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 451, 434, -120, 0, 2) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 426, 256, 0, Qt.LeftButton) - - #[step] Define the number of copies - mouseClick(waitForObject(":Translation.qt_spinbox_lineedit_QLineEdit"), 41, 9, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 90, + 130, + 33554432, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 440, + 132, + 33554432, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 573, + 199, + 33554432, + Qt.LeftButton, + ) + + # [step] Click in viewer to define start point + mouseClick( + waitForObject(":Start point.qt_spinbox_lineedit_QLineEdit"), + 53, + 7, + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 112, + 453, + 0, + Qt.LeftButton, + ) + + # [step] Click in viewer to define end point, for this zoom out preview + mouseClick( + waitForObject(":End point.qt_spinbox_lineedit_QLineEdit"), + 154, + 9, + 0, + Qt.LeftButton, + ) + sendEvent( + "QWheelEvent", + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 451, + 434, + -120, + 0, + 2, + ) + sendEvent( + "QWheelEvent", + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 451, + 434, + -120, + 0, + 2, + ) + sendEvent( + "QWheelEvent", + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 451, + 434, + -120, + 0, + 2, + ) + sendEvent( + "QWheelEvent", + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 451, + 434, + -120, + 0, + 2, + ) + sendEvent( + "QWheelEvent", + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 451, + 434, + -120, + 0, + 2, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 426, + 256, + 0, + Qt.LeftButton, + ) + + # [step] Define the number of copies + mouseClick( + waitForObject(":Translation.qt_spinbox_lineedit_QLineEdit"), + 41, + 9, + 0, + Qt.LeftButton, + ) type(waitForObject(":Translation.MultiTranslationCopies_QSpinBox"), "") type(waitForObject(":Translation.MultiTranslationCopies_QSpinBox"), 3) - - #[step] Fit all + # [step] Fit all fit_all() - #[check] that preview is updated + # [check] that preview is updated test.vp("VP1") - #[step] Ok + # [step] Ok clickButton(waitForObject(":Translation.property_panel_ok_QToolButton")) - #[check] Check that translation has been executed successfully + # [check] Check that translation has been executed successfully test.vp("VP2") # [step] Close application without saving diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_017/test.py b/test.squish/suite_FEATURE_SKETCH/tst_sketch_017/test.py index 693150e50..ca0dae714 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_017/test.py +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_017/test.py @@ -17,81 +17,181 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): - #[project] SHAPER - #[Scenario] Sketch_017 - #[Topic] 'Rotation' functionality - #[Tested functionality] - #[Summary description] - #[Expected results] - #[General comments] + # [project] SHAPER + # [Scenario] Sketch_017 + # [Topic] 'Rotation' functionality + # [Tested functionality] + # [Summary description] + # [Expected results] + # [General comments] source(findFile("scripts", "common.py")) - #[section] Application start - #[step] Launch SALOME + # [section] Application start + # [step] Launch SALOME startApplication("salome_run.sh") set_defaults() - #[step] Open 'for_sketch_016.hdf' + # [step] Open 'for_sketch_016.hdf' open(DATA_PATH + "/for_sketch_016.hdf") - #[step] Activate SHAPER + # [step] Activate SHAPER clickButton(waitForObject(":SALOME*.Shaper_QToolButton")) - #[step] Edit 'Sketch_1' + # [step] Edit 'Sketch_1' waitForObjectItem(":Object browser_XGUI_DataTree", "Sketch\\_1") clickItem(":Object browser_XGUI_DataTree", "Sketch\\_1", 43, 12, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Edit...")) - #[step] Click '+OZ' button + # [step] Click '+OZ' button clickButton(waitForObject(":SALOME*.+OZ_QToolButton")) - #[step] Sketch - Rotation + # [step] Sketch - Rotation mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Sketch")) mouseClick(waitForObjectItem(":Sketch_QMenu", "Rotation")) - #[step] Select all object for rotation - mouseClick(waitForObject(":Rotation.Segments:_QListWidget"), 59, 66, 0, Qt.LeftButton) + # [step] Select all object for rotation + mouseClick( + waitForObject(":Rotation.Segments:_QListWidget"), 59, 66, 0, Qt.LeftButton + ) type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "") - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 135, 116, 33554432, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 447, 187, 33554432, Qt.LeftButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 573, 209, 33554432, Qt.LeftButton) - - #[step] Click on the viewer to select center of rotation - mouseClick(waitForObject(":Center of rotation.qt_spinbox_lineedit_QLineEdit"), 107, 8, 0, Qt.LeftButton) - sendEvent("QWheelEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 387, 328, -120, 0, 2) - sendEvent("QWheelEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 387, 328, -120, 0, 2) - sendEvent("QWheelEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 387, 328, -120, 0, 2) - sendEvent("QWheelEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 387, 325, -120, 0, 2) - sendEvent("QWheelEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 387, 325, -120, 0, 2) - sendEvent("QWheelEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 387, 325, -120, 0, 2) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 605, 257, 0, Qt.LeftButton) - - #[step] Input angle of rotation - mouseClick(waitForObject(":Rotation.qt_spinbox_lineedit_QLineEdit"), 146, 5, 0, Qt.LeftButton) - type(waitForObject(":Rotation.MultiRotationAngle_ModuleBase_ParamSpinBox"), "") + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 135, + 116, + 33554432, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 447, + 187, + 33554432, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 573, + 209, + 33554432, + Qt.LeftButton, + ) + + # [step] Click on the viewer to select center of rotation + mouseClick( + waitForObject(":Center of rotation.qt_spinbox_lineedit_QLineEdit"), + 107, + 8, + 0, + Qt.LeftButton, + ) + sendEvent( + "QWheelEvent", + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 387, + 328, + -120, + 0, + 2, + ) + sendEvent( + "QWheelEvent", + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 387, + 328, + -120, + 0, + 2, + ) + sendEvent( + "QWheelEvent", + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 387, + 328, + -120, + 0, + 2, + ) + sendEvent( + "QWheelEvent", + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 387, + 325, + -120, + 0, + 2, + ) + sendEvent( + "QWheelEvent", + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 387, + 325, + -120, + 0, + 2, + ) + sendEvent( + "QWheelEvent", + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 387, + 325, + -120, + 0, + 2, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 605, + 257, + 0, + Qt.LeftButton, + ) + + # [step] Input angle of rotation + mouseClick( + waitForObject(":Rotation.qt_spinbox_lineedit_QLineEdit"), + 146, + 5, + 0, + Qt.LeftButton, + ) + type( + waitForObject(":Rotation.MultiRotationAngle_ModuleBase_ParamSpinBox"), + "", + ) type(waitForObject(":Rotation.MultiRotationAngle_ModuleBase_ParamSpinBox"), 45) - #[step] Input number of copies - mouseClick(waitForObject(":Rotation.qt_spinbox_lineedit_QLineEdit_2"), 13, 5, 0, Qt.LeftButton) + # [step] Input number of copies + mouseClick( + waitForObject(":Rotation.qt_spinbox_lineedit_QLineEdit_2"), + 13, + 5, + 0, + Qt.LeftButton, + ) type(waitForObject(":Rotation.MultiRotationCopies_QSpinBox"), "") type(waitForObject(":Rotation.MultiRotationCopies_QSpinBox"), 7) - mouseClick(waitForObject(":Rotation.Segments:_QListWidget"), 59, 66, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Rotation.Segments:_QListWidget"), 59, 66, 0, Qt.LeftButton + ) - #[step] Click Fit all button + # [step] Click Fit all button fit_all() - #[check] Check that preview is updated + # [check] Check that preview is updated test.vp("VP1") - #[step] Ok + # [step] Ok clickButton(waitForObject(":Rotation.property_panel_ok_QToolButton")) - #[check] Check that rotation has been executed successfully + # [check] Check that rotation has been executed successfully test.vp("VP2") # [step] Close application without saving diff --git a/test.squish/suite_FEATURE_SKETCH/tst_sketch_018/test.py b/test.squish/suite_FEATURE_SKETCH/tst_sketch_018/test.py index 31e382301..02ce6932e 100644 --- a/test.squish/suite_FEATURE_SKETCH/tst_sketch_018/test.py +++ b/test.squish/suite_FEATURE_SKETCH/tst_sketch_018/test.py @@ -17,48 +17,51 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): - #[project] SHAPER - #[Scenario] Sketch_018 - #[Topic] 'Tangency' functionality - #[Tested functionality] - #[Summary description] - #[Expected results] - #[General comments] + # [project] SHAPER + # [Scenario] Sketch_018 + # [Topic] 'Tangency' functionality + # [Tested functionality] + # [Summary description] + # [Expected results] + # [General comments] source(findFile("scripts", "common.py")) - #[section] Application start - #[step] Launch SALOME + # [section] Application start + # [step] Launch SALOME startApplication("salome_run.sh") set_defaults() - #[step] Open 'for_sketch_018.hdf' + # [step] Open 'for_sketch_018.hdf' open(DATA_PATH + "/for_sketch_018.hdf") - #[step] Activate SHAPER + # [step] Activate SHAPER clickButton(waitForObject(":SALOME*.Shaper_QToolButton")) - #[step] Edit 'Sketch_1' + # [step] Edit 'Sketch_1' waitForObjectItem(":Object browser_XGUI_DataTree", "Sketch\\_1") clickItem(":Object browser_XGUI_DataTree", "Sketch\\_1", 43, 12, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), "Sketch\\_1", 43, 12, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Edit...")) - #[step] Click '+OZ' button + # [step] Click '+OZ' button clickButton(waitForObject(":SALOME*.+OZ_QToolButton")) - #[step] Make 2 arcs tangent + # [step] Make 2 arcs tangent tangent((142, 237), (55, 223)) - #[step] Make arc and line tangent + # [step] Make arc and line tangent tangent((580, 343), (605, 403)) - #[step] Click Fit all button + # [step] Click Fit all button fit_all() - #[check] Check that tangency has been executed successfully + # [check] Check that tangency has been executed successfully test.vp("VP1") # [step] Close application without saving diff --git a/test.squish/suite_ISSUES_SALOME/tst_532/test.py b/test.squish/suite_ISSUES_SALOME/tst_532/test.py index e396005ab..e7b86afd6 100644 --- a/test.squish/suite_ISSUES_SALOME/tst_532/test.py +++ b/test.squish/suite_ISSUES_SALOME/tst_532/test.py @@ -17,14 +17,23 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def sketch_circle(): circle_create((0, 0), 300) + def sketch_lines(): clickButton(waitForObject(":SALOME*.Line_QToolButton")) points = [(647, 441), (419, 214), (725, 140), (578, 243), (647, 441)] for point in points: - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point[0], point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + point[0], + point[1], + 0, + Qt.LeftButton, + ) + def main(): source(findFile("scripts", "common.py")) @@ -40,52 +49,130 @@ def main(): part_create() - #[step] Create circle sketch + # [step] Create circle sketch extrusion((299, 159), 10, 0) - #[step] Create V-shape sketch + # [step] Create V-shape sketch extrusion((642, 176), 10, 0) test.vp("VP_EXTRUSIONS") - #[step] Create plane: inner right for V-shape + # [step] Create plane: inner right for V-shape activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Construction")) activateItem(waitForObjectItem(":_QMenu", "Plane")) type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "") - mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 305, 263, -2, -165, 67108866, Qt.RightButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 651, 229, 0, Qt.LeftButton) + mouseDrag( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 305, + 263, + -2, + -165, + 67108866, + Qt.RightButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 651, + 229, + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Plane.property_panel_ok_QToolButton")) test.vp("VP_INNER_RIGHT_PLANE") - #[step] Create plane: outer right for V-shape + # [step] Create plane: outer right for V-shape activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Construction")) activateItem(waitForObjectItem(":_QMenu", "Plane")) type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "") - mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 467, 171, -6, 319, 67108866, Qt.RightButton) - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 641, 209, 0, Qt.LeftButton) + mouseDrag( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 467, + 171, + -6, + 319, + 67108866, + Qt.RightButton, + ) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 641, + 209, + 0, + Qt.LeftButton, + ) type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "") - mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 515, 402, -7, -305, 67108866, Qt.RightButton) + mouseDrag( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 515, + 402, + -7, + -305, + 67108866, + Qt.RightButton, + ) clickButton(waitForObject(":Plane.property_panel_ok_QToolButton")) test.vp("VP_OUTER_RIGHT_PLANE") - #[step] Activate Partition feature + # [step] Activate Partition feature activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Features")) activateItem(waitForObjectItem(":_QMenu", "Partition")) - #[step] Select circle and V-shape - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 304, 293, 0, Qt.LeftButton) + # [step] Select circle and V-shape + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 304, + 293, + 0, + Qt.LeftButton, + ) type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "") - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 541, 265, 33554432, Qt.LeftButton) - #[step] Select inner right and outer right V-shape planes - mouseClick(waitForObject(":Partition.Tool object_QListWidget"), 201, 90, 0, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 541, + 265, + 33554432, + Qt.LeftButton, + ) + # [step] Select inner right and outer right V-shape planes + mouseClick( + waitForObject(":Partition.Tool object_QListWidget"), 201, 90, 0, Qt.LeftButton + ) type(waitForObject(":Partition.Tool object_QListWidget"), "") - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 667, 217, 33554432, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 667, + 217, + 33554432, + Qt.LeftButton, + ) type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "") - mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 655, 270, 8, 353, 67108866, Qt.RightButton) + mouseDrag( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 655, + 270, + 8, + 353, + 67108866, + Qt.RightButton, + ) type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "") - mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 639, 210, 33554432, Qt.LeftButton) + mouseClick( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 639, + 210, + 33554432, + Qt.LeftButton, + ) type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "") - mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 567, 436, -11, -351, 67108866, Qt.RightButton) + mouseDrag( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), + 567, + 436, + -11, + -351, + 67108866, + Qt.RightButton, + ) - #[step] Apply Partition + # [step] Apply Partition clickButton(waitForObject(":Partition.property_panel_ok_QToolButton")) test.vp("VP_PARTITION") diff --git a/test.squish/suite_OBJECT_BROWSER/tst_ACTIVE_DOC_MANAGEMENT/test.py b/test.squish/suite_OBJECT_BROWSER/tst_ACTIVE_DOC_MANAGEMENT/test.py index 082876ee5..6e119b492 100644 --- a/test.squish/suite_OBJECT_BROWSER/tst_ACTIVE_DOC_MANAGEMENT/test.py +++ b/test.squish/suite_OBJECT_BROWSER/tst_ACTIVE_DOC_MANAGEMENT/test.py @@ -17,59 +17,94 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#[tested functionality] +# [tested functionality] + +ENABLE_COLOR = "#FF000000" +DISABLE_COLOR = "#FFC0C0C0" -ENABLE_COLOR='#FF000000' -DISABLE_COLOR='#FFC0C0C0' def checkPartActivatedState(scenario): - #[step] Check that Part is activated + # [step] Check that Part is activated allPartSetElements = [ - "Parameters (0)", - "Constructions (4)", - "Constructions (4).Origin", - "Constructions (4).YOZ", - "Constructions (4).XOZ", - "Constructions (4).XOY", - "Parts (1)", - "Parts (1).Part\\_1"] + "Parameters (0)", + "Constructions (4)", + "Constructions (4).Origin", + "Constructions (4).YOZ", + "Constructions (4).XOZ", + "Constructions (4).XOY", + "Parts (1)", + "Parts (1).Part\\_1", + ] for element in allPartSetElements: - test.compare(DISABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is disabled after: %s" % (element, scenario)) + test.compare( + DISABLE_COLOR, + waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, + "%s is disabled after: %s" % (element, scenario), + ) partElements = [ - "Part\\_1", - "Part\\_1.Parameters (0)", - "Part\\_1.Constructions (0)", - "Part\\_1.Bodies (0)"] + "Part\\_1", + "Part\\_1.Parameters (0)", + "Part\\_1.Constructions (0)", + "Part\\_1.Bodies (0)", + ] for element in partElements: - test.compare(ENABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is enabled after: %s" % (element, scenario)) + test.compare( + ENABLE_COLOR, + waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, + "%s is enabled after: %s" % (element, scenario), + ) + + # [step] Check that Part tree is unfolded + test.compare( + False, + waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1").collapsed, + "Part is unfolded after: %s" % scenario, + ) - #[step] Check that Part tree is unfolded - test.compare(False, waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1").collapsed, "Part is unfolded after: %s" % scenario) def checkPartDeactivatedState(scenario): - #[step] Check that Part id disabled and folded + # [step] Check that Part id disabled and folded partElements = [ - "Part\\_1.Parameters (0)", - "Part\\_1.Constructions (0)", - "Part\\_1.Bodies (0)"] + "Part\\_1.Parameters (0)", + "Part\\_1.Constructions (0)", + "Part\\_1.Bodies (0)", + ] for element in partElements: - test.compare(DISABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is disabled after: %s" % (element, scenario)) - test.compare(ENABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1").foregroundColor, "Part is enable after: %s" % scenario) - test.compare(True, waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1").collapsed, "Part is unfolded after: %s" % scenario) - - #[step] Check that PartSet is enabled + test.compare( + DISABLE_COLOR, + waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, + "%s is disabled after: %s" % (element, scenario), + ) + test.compare( + ENABLE_COLOR, + waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1").foregroundColor, + "Part is enable after: %s" % scenario, + ) + test.compare( + True, + waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1").collapsed, + "Part is unfolded after: %s" % scenario, + ) + + # [step] Check that PartSet is enabled allPartSetElements = [ - "Parameters (0)", - "Constructions (4)", - "Constructions (4).Origin", - "Constructions (4).YOZ", - "Constructions (4).XOZ", - "Constructions (4).XOY", - "Parts (1)", - "Parts (1).Part\\_1"] + "Parameters (0)", + "Constructions (4)", + "Constructions (4).Origin", + "Constructions (4).YOZ", + "Constructions (4).XOZ", + "Constructions (4).XOY", + "Parts (1)", + "Parts (1).Part\\_1", + ] for element in allPartSetElements: - test.compare(ENABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is enabled after: %s" % (element, scenario)) + test.compare( + ENABLE_COLOR, + waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, + "%s is enabled after: %s" % (element, scenario), + ) + def main(): source(findFile("scripts", "common.py")) @@ -77,55 +112,82 @@ def main(): startApplication("salome_run.sh") activate_SHAPER() - #[step] Check that default elements are enabled: Parameters (0), Constructions (4), Parts (0) + # [step] Check that default elements are enabled: Parameters (0), Constructions (4), Parts (0) waitForObjectItem(":Object browser_XGUI_DataTree", "Constructions (4)") - clickItem(":Object browser_XGUI_DataTree", "Constructions (4)", -10, 10, 0, Qt.LeftButton) + clickItem( + ":Object browser_XGUI_DataTree", "Constructions (4)", -10, 10, 0, Qt.LeftButton + ) allPartSetElements = [ - "Parameters (0)", - "Constructions (4)", - "Constructions (4).Origin", - "Constructions (4).YOZ", - "Constructions (4).XOZ", - "Constructions (4).XOY", - "Parts (0)"] + "Parameters (0)", + "Constructions (4)", + "Constructions (4).Origin", + "Constructions (4).YOZ", + "Constructions (4).XOZ", + "Constructions (4).XOY", + "Parts (0)", + ] for element in allPartSetElements: - test.compare(ENABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is enabled by default" % element) + test.compare( + ENABLE_COLOR, + waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, + "%s is enabled by default" % element, + ) - #[step] Create Part + # [step] Create Part activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part")) activateItem(waitForObjectItem(":Part_QMenu", "New part")) checkPartActivatedState("Part creation") - #[step] Deactivate part by double click + # [step] Deactivate part by double click waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1") - doubleClickItem(":Object browser_XGUI_DataTree", "Part\\_1", 10, 10, 0, Qt.LeftButton) + doubleClickItem( + ":Object browser_XGUI_DataTree", "Part\\_1", 10, 10, 0, Qt.LeftButton + ) checkPartDeactivatedState("Part deactivation by double click") - #[step] Activate part by double click + # [step] Activate part by double click waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1") - doubleClickItem(":Object browser_XGUI_DataTree", "Part\\_1", 10, 10, 0, Qt.LeftButton) + doubleClickItem( + ":Object browser_XGUI_DataTree", "Part\\_1", 10, 10, 0, Qt.LeftButton + ) checkPartActivatedState("Part activation by double click") - #[step] Check that Activate is disabled in Part context menu - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1", 10, 10, 0) - test.compare(False, findMenuItem(waitForObject(":_QMenu"), "Activate").enabled, "Activate is disabled on active Part") - - #[step] Deactivate part by context menu on PartSet - openContextMenu(waitForObject(":Object browser.Part set_XGUI_ActiveDocLbl"), 10, 10, 0) + # [step] Check that Activate is disabled in Part context menu + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1", 10, 10, 0 + ) + test.compare( + False, + findMenuItem(waitForObject(":_QMenu"), "Activate").enabled, + "Activate is disabled on active Part", + ) + + # [step] Deactivate part by context menu on PartSet + openContextMenu( + waitForObject(":Object browser.Part set_XGUI_ActiveDocLbl"), 10, 10, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) checkPartDeactivatedState("Part deactivation by context menu on PartSet") - #[step] Check that Activate is disabled in PartSet context menu - openContextMenu(waitForObject(":Object browser.Part set_XGUI_ActiveDocLbl"), 10, 10, 0) - test.compare(False, findMenuItem(waitForObject(":_QMenu"), "Activate").enabled, "Activate is disabled on active PartSet") - - #[step] Activate part by context menu on Part - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1", 104, 6, 0) + # [step] Check that Activate is disabled in PartSet context menu + openContextMenu( + waitForObject(":Object browser.Part set_XGUI_ActiveDocLbl"), 10, 10, 0 + ) + test.compare( + False, + findMenuItem(waitForObject(":_QMenu"), "Activate").enabled, + "Activate is disabled on active PartSet", + ) + + # [step] Activate part by context menu on Part + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1", 104, 6, 0 + ) activateItem(waitForObjectItem(":_QMenu", "Activate")) checkPartActivatedState("Part activation by context menu on Part") diff --git a/test.squish/suite_PYTHONAPI_SALOME/tst_Platine/test.py b/test.squish/suite_PYTHONAPI_SALOME/tst_Platine/test.py index 6368f9824..f7c2791a6 100644 --- a/test.squish/suite_PYTHONAPI_SALOME/tst_Platine/test.py +++ b/test.squish/suite_PYTHONAPI_SALOME/tst_Platine/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def set_parameter_value(name, value): openContextMenu(waitForObject(":Parameters.%s = _QModelIndex" % name), 10, 10, 0) activateItem(waitForObjectItem(":_QMenu", "Edit...")) @@ -26,6 +27,7 @@ def set_parameter_value(name, value): type(waitForObject(":Parameter_ExpressionEditor"), "") clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton")) + def main(): # [project] SHAPER # [Scenario] 'Platine' model created by PythonAPI @@ -47,7 +49,9 @@ def main(): activate_SHAPER() # [step] In Python console type: import examples.Platine - type(waitForObject(":Python Console_PyConsole_EnhEditor"), "import examples.Platine") + type( + waitForObject(":Python Console_PyConsole_EnhEditor"), "import examples.Platine" + ) type(waitForObject(":Python Console_PyConsole_EnhEditor"), "") # [step] Check that the model is correct [vp VP_PLATINE] @@ -56,21 +60,44 @@ def main(): # [step] Check that the object browser contains all objects from the model [vp VP_TREE] waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Parameters (3)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Parameters (3)", -10, 10, 0, Qt.LeftButton) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1.Parameters (3)", + -10, + 10, + 0, + Qt.LeftButton, + ) waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Constructions (3)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Constructions (3)", -10, 10, 0, Qt.LeftButton) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1.Constructions (3)", + -10, + 10, + 0, + Qt.LeftButton, + ) waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Bodies (1)") - clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Bodies (1)", -10, 10, 0, Qt.LeftButton) + clickItem( + ":Object browser_XGUI_DataTree", + "Part\\_1.Bodies (1)", + -10, + 10, + 0, + Qt.LeftButton, + ) # Tree is under modification, so it can not be checked by a picture # Moreover a mask for a text should be provided to check it on different platforms - #test.vp("VP_TREE") + # test.vp("VP_TREE") # [step] Change parameter values: L = 64, E = 5, P = 80 set_parameter_value("L", 64) set_parameter_value("E", 5) set_parameter_value("P", 80) clickButton(waitForObject(":SALOME*.Fit All_QToolButton")) - mouseMove(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 320, 240) + mouseMove( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 320, 240 + ) test.vp("VP_PLATINE_E") # [step] Change parameter values: L = 90, E = 20, P = 80 @@ -78,7 +105,9 @@ def main(): set_parameter_value("E", 20) set_parameter_value("P", 80) clickButton(waitForObject(":SALOME*.Fit All_QToolButton")) - mouseMove(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 320, 240) + mouseMove( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 320, 240 + ) test.vp("VP_PLATINE_L") # [step] Change parameter values: L = 64, E = 20, P = 120 @@ -86,7 +115,9 @@ def main(): set_parameter_value("E", 20) set_parameter_value("P", 120) clickButton(waitForObject(":SALOME*.Fit All_QToolButton")) - mouseMove(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 320, 240) + mouseMove( + waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 320, 240 + ) test.vp("VP_PLATINE_P") # [step] Close application diff --git a/test.squish/suite_STANDALONE/shared/scripts/common.py b/test.squish/suite_STANDALONE/shared/scripts/common.py index 281eba584..26417a7f5 100644 --- a/test.squish/suite_STANDALONE/shared/scripts/common.py +++ b/test.squish/suite_STANDALONE/shared/scripts/common.py @@ -19,37 +19,51 @@ testSettings.logScreenshotOnError = True testSettings.logScreenshotOnFail = True -g_points = {"XY_plane": (320, 320)} # one of the construction planes +g_points = {"XY_plane": (320, 320)} # one of the construction planes + + def help_points(name): return g_points[name] + def set_defaults(): waitForObject(":OpenParts*_AppElements_MainWindow").resize(1024, 768) + def close_application(): sendEvent("QCloseEvent", waitForObject(":OpenParts*_AppElements_MainWindow")) if object.exists(":Save current file.Discard_QPushButton"): clickButton(waitForObject(":Save current file.Discard_QPushButton")) + def parameter_create(name, expression): clickButton(waitForObject(":Parameters.Parameter_AppElements_Button")) type(waitForObject(":Parameter_QLineEdit"), name) type(waitForObject(":Parameter_ExpressionEditor"), expression) clickButton(waitForObject(":Parameter.property_panel_ok_QToolButton")) + def part_create(): clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Part") clickButton(waitForObject(":Operations.New part_AppElements_Button")) + def sketch_create(point, actions): clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Sketch") clickButton(waitForObject(":Basic.Sketch_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point[0], point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + point[0], + point[1], + 0, + Qt.LeftButton, + ) actions() clickButton(waitForObject(":Sketch.Ok_QToolButton")) + def point_create(point): clickButton(waitForObject(":Basic.Point_AppElements_Button")) @@ -60,6 +74,7 @@ def point_create(point): clickButton(waitForObject(":Point.property_panel_ok_QToolButton")) + def line_create(start_point, end_point): clickButton(waitForObject(":Basic.Line_AppElements_Button")) @@ -75,11 +90,25 @@ def line_create(start_point, end_point): clickButton(waitForObject(":Line.property_panel_ok_QToolButton")) + def line_create_in_view(start_point, end_point): clickButton(waitForObject(":Basic.Line_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), start_point[0], start_point[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), end_point[0], end_point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + start_point[0], + start_point[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + end_point[0], + end_point[1], + 0, + Qt.LeftButton, + ) + def auxiliary_line_create(start_point, end_point): clickButton(waitForObject(":Basic.Line_AppElements_Button")) @@ -95,7 +124,8 @@ def auxiliary_line_create(start_point, end_point): type(waitForObject(":End point.Y:_ModuleBase_ParamSpinBox"), "") type(waitForObject(":End point.Y:_ModuleBase_ParamSpinBox"), end_point[1]) - #clickButton(waitForObject(":Line.property_panel_ok_QToolButton")) + # clickButton(waitForObject(":Line.property_panel_ok_QToolButton")) + def circle_create(x, y, radius): clickButton(waitForObject(":Basic.Circle_AppElements_Button")) @@ -110,20 +140,52 @@ def circle_create(x, y, radius): clickButton(waitForObject(":Circle.property_panel_ok_QToolButton")) + def circle_create_in_view(point_1, point_2): clickButton(waitForObject(":Basic.Circle_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_1[0], point_1[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_2[0], point_2[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + point_1[0], + point_1[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + point_2[0], + point_2[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Basic.Circle_AppElements_Button")) + def distance_create(point_1, point_2, annotaion_point, distance): clickButton(waitForObject(":Constraints.Distance_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_1[0], point_1[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_2[0], point_2[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), annotaion_point[0], annotaion_point[1], 0, Qt.LeftButton) # move annotation + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + point_1[0], + point_1[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + point_2[0], + point_2[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + annotaion_point[0], + annotaion_point[1], + 0, + Qt.LeftButton, + ) # move annotation type(waitForObject(":_ModuleBase_ParamSpinBox"), "") type(waitForObject(":_ModuleBase_ParamSpinBox"), distance) @@ -131,58 +193,125 @@ def distance_create(point_1, point_2, annotaion_point, distance): clickButton(waitForObject(":Constraints.Distance_AppElements_Button")) + def parallel_create(point_1, point_2): clickButton(waitForObject(":Constraints.Parallel_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_1[0], point_1[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_2[0], point_2[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + point_1[0], + point_1[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + point_2[0], + point_2[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Constraints.Parallel_AppElements_Button")) + def perpendicular_create(point_1, point_2): clickButton(waitForObject(":Constraints.Perpendicular_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_1[0], point_1[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_2[0], point_2[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + point_1[0], + point_1[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + point_2[0], + point_2[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Perpendicular.property_panel_cancel_QToolButton")) + def horizontal_create(point_1): clickButton(waitForObject(":Constraints.Horizontal_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_1[0], point_1[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + point_1[0], + point_1[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Constraints.Horizontal_AppElements_Button")) + def vertical_create(point_1): cclickButton(waitForObject(":Constraints.Vertical_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_1[0], point_1[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + point_1[0], + point_1[1], + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Constraints.Vertical_AppElements_Button")) + def radius_create(point_1, point_2, radius): clickButton(waitForObject(":Constraints.Radius_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_1[0], point_1[1], 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_2[0], point_2[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + point_1[0], + point_1[1], + 0, + Qt.LeftButton, + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + point_2[0], + point_2[1], + 0, + Qt.LeftButton, + ) type(waitForObject(":_ModuleBase_ParamSpinBox"), "") type(waitForObject(":_ModuleBase_ParamSpinBox"), radius) type(waitForObject(":_ModuleBase_ParamSpinBox"), "") clickButton(waitForObject(":Constraints.Radius_AppElements_Button")) + def part_create(): clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Part") clickButton(waitForObject(":Operations.New part_AppElements_Button")) + def extrusion_feature(points, to_size=0, from_size=0): clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Features") clickButton(waitForObject(":Extrusion.Extrusion_AppElements_Button")) - mouseClick(waitForObject(":Extrusion.Select a sketch face_QListWidget"), 10, 10, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Extrusion.Select a sketch face_QListWidget"), + 10, + 10, + 0, + Qt.LeftButton, + ) for point in points: - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point[0], point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + point[0], + point[1], + 0, + Qt.LeftButton, + ) type(waitForObject(":to_size_ModuleBase_ParamSpinBox"), "") type(waitForObject(":to_size_ModuleBase_ParamSpinBox"), to_size) @@ -192,11 +321,18 @@ def extrusion_feature(points, to_size=0, from_size=0): clickButton(waitForObject(":Extrusion.property_panel_ok_QToolButton")) + def extrusion_cut_by_sizes_feature(point, actions, to_size, from_size): clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Features") clickButton(waitForObject(":Extrusion.ExtrusionCut_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point[0], point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + point[0], + point[1], + 0, + Qt.LeftButton, + ) actions() @@ -209,14 +345,20 @@ def extrusion_cut_by_sizes_feature(point, actions, to_size, from_size): type(waitForObject(":Extrusion.from_size_ModuleBase_ParamSpinBox_2"), from_size) clickButton(waitForObject(":ExtrusionCut.property_panel_ok_QToolButton")) - #clickButton(waitForObject(":Sketch.property_panel_cancel_QToolButton")) + # clickButton(waitForObject(":Sketch.property_panel_cancel_QToolButton")) -def extrusion_fuse_by_sizes_feature(point, actions, to_size, from_size): +def extrusion_fuse_by_sizes_feature(point, actions, to_size, from_size): clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Features") clickButton(waitForObject(":Extrusion.ExtrusionFuse_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point[0], point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + point[0], + point[1], + 0, + Qt.LeftButton, + ) actions() @@ -229,6 +371,4 @@ def extrusion_fuse_by_sizes_feature(point, actions, to_size, from_size): type(waitForObject(":Extrusion.from_size_ModuleBase_ParamSpinBox_3"), from_size) clickButton(waitForObject(":ExtrusionFuse.property_panel_ok_QToolButton")) - #clickButton(waitForObject(":Sketch.property_panel_cancel_QToolButton")) - - + # clickButton(waitForObject(":Sketch.property_panel_cancel_QToolButton")) diff --git a/test.squish/suite_STANDALONE/tst_532/test.py b/test.squish/suite_STANDALONE/tst_532/test.py index 08b90f368..a432411d6 100644 --- a/test.squish/suite_STANDALONE/tst_532/test.py +++ b/test.squish/suite_STANDALONE/tst_532/test.py @@ -17,13 +17,25 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def sketch(): clickButton(waitForObject(":Basic.Line_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 230, 140, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 128, 399, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 307, 317, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 473, 347, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 230, 140, 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 230, 140, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 128, 399, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 307, 317, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 473, 347, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 230, 140, 0, Qt.LeftButton + ) + def main(): source(findFile("scripts", "common.py")) @@ -35,23 +47,41 @@ def main(): part_create() - extrusion_feature([(266, 251)], 10) # on the sketch + extrusion_feature([(266, 251)], 10) # on the sketch clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Construction") clickButton(waitForObject(":Basic.Plane_AppElements_Button")) type(waitForObject(":OpenParts*_AppElements_ViewPort"), "") - mouseDrag(waitForObject(":OpenParts*_AppElements_ViewPort"), 353, 364, -37, -171, 67108866, Qt.RightButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 274, 316, 0, Qt.LeftButton) # inner left face + mouseDrag( + waitForObject(":OpenParts*_AppElements_ViewPort"), + 353, + 364, + -37, + -171, + 67108866, + Qt.RightButton, + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 274, 316, 0, Qt.LeftButton + ) # inner left face clickButton(waitForObject(":Plane.property_panel_ok_QToolButton")) test.vp("VP_EXTRUSION") clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Features") clickButton(waitForObject(":Boolean.Partition_AppElements_Button")) - mouseClick(waitForObject(":Partition.Main objects_QListWidget"), 10, 10, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 227, 263, 0, Qt.LeftButton) # extrusion object - mouseClick(waitForObject(":Partition.Tool object_QListWidget"), 10, 10, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 212, 344, 0, Qt.LeftButton) # construction plane + mouseClick( + waitForObject(":Partition.Main objects_QListWidget"), 10, 10, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 227, 263, 0, Qt.LeftButton + ) # extrusion object + mouseClick( + waitForObject(":Partition.Tool object_QListWidget"), 10, 10, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 212, 344, 0, Qt.LeftButton + ) # construction plane clickButton(waitForObject(":Partition.property_panel_ok_QToolButton")) test.vp("VP_PARTITION") diff --git a/test.squish/suite_STANDALONE/tst_818/test.py b/test.squish/suite_STANDALONE/tst_818/test.py index f172364dd..621d46e97 100644 --- a/test.squish/suite_STANDALONE/tst_818/test.py +++ b/test.squish/suite_STANDALONE/tst_818/test.py @@ -19,28 +19,44 @@ import re + def main(): source(findFile("scripts", "common.py")) startApplication("linux_run.sh") set_defaults() - #[step] Create parameter 'a = 100' + # [step] Create parameter 'a = 100' parameter_create("a", "100") - #[step] Create sketch with line (0,0) - (a, 0) + # [step] Create sketch with line (0,0) - (a, 0) sketch_create(help_points("XY_plane"), lambda: line_create((0, 0), ("a", 0))) - #[step] Activate context menu for parameter 'a' and click 'Delete' + # [step] Activate context menu for parameter 'a' and click 'Delete' waitForObjectItem(":Object browser_XGUI_DataTree", "Parameters (1)") - clickItem(":Object browser_XGUI_DataTree", "Parameters (1)", -10, 10, 0, Qt.LeftButton) + clickItem( + ":Object browser_XGUI_DataTree", "Parameters (1)", -10, 10, 0, Qt.LeftButton + ) waitForObjectItem(":Object browser_XGUI_DataTree", "Parameters (1).a = 100") - clickItem(":Object browser_XGUI_DataTree", "Parameters (1).a = 100", 10, 10, 0, Qt.LeftButton) - openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Parameters (1).a = 100", 10, 10, 0) + clickItem( + ":Object browser_XGUI_DataTree", + "Parameters (1).a = 100", + 10, + 10, + 0, + Qt.LeftButton, + ) + openItemContextMenu( + waitForObject(":Object browser_XGUI_DataTree"), + "Parameters (1).a = 100", + 10, + 10, + 0, + ) activateItem(waitForObjectItem(":_QMenu", "Delete")) - #[check] Message box with "Selected features are used in the following features: SketchLine_1. These features will be deleted.\nAlso these features will be deleted: Sketch_1.\nWould you like to continue?" should appear + # [check] Message box with "Selected features are used in the following features: SketchLine_1. These features will be deleted.\nAlso these features will be deleted: Sketch_1.\nWould you like to continue?" should appear waitFor("object.exists(':Delete features.Label_QLabel')", 20000) an_expected = """Selected parameters are used in the following features: SketchLine_1. @@ -50,5 +66,5 @@ Or parameters could be replaced by their values. Would you like to continue?""" test.compare(str(findObject(":Delete features.Label_QLabel").text), an_expected) - #[step] Click 'Yes' and close application + # [step] Click 'Yes' and close application clickButton(waitForObject(":Delete features.Yes_QPushButton")) diff --git a/test.squish/suite_STANDALONE/tst_BASE/test.py b/test.squish/suite_STANDALONE/tst_BASE/test.py index 500b38b79..76a5f0397 100644 --- a/test.squish/suite_STANDALONE/tst_BASE/test.py +++ b/test.squish/suite_STANDALONE/tst_BASE/test.py @@ -17,20 +17,21 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): source(findFile("scripts", "common.py")) startApplication("linux_run.sh") set_defaults() - #[step] Create parameter a=100 + # [step] Create parameter a=100 parameter_create("a", "100") - #[step] Create new parts + # [step] Create new parts part_create() - #[step] Create sketch with circle center=(0,0) radius="a" + # [step] Create sketch with circle center=(0,0) radius="a" sketch_create(help_points("XY_plane"), lambda: circle_create(0, 0, "a")) - #[step] Crete extrusion with the circle and to_size="a" - points = [(313, 336)] # circle + # [step] Crete extrusion with the circle and to_size="a" + points = [(313, 336)] # circle extrusion_feature(points, "a") - #[step] Close application - close_application() \ No newline at end of file + # [step] Close application + close_application() diff --git a/test.squish/suite_STANDALONE/tst_DISTANCE/test.py b/test.squish/suite_STANDALONE/tst_DISTANCE/test.py index db104766f..c1575c2c0 100644 --- a/test.squish/suite_STANDALONE/tst_DISTANCE/test.py +++ b/test.squish/suite_STANDALONE/tst_DISTANCE/test.py @@ -17,22 +17,37 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def sketch(): line_create((0, 0), (100, 0)) point_create((50, 50)) - point_1 = (412, 293) # point - point_2 = (412, 324) # line + point_1 = (412, 293) # point + point_2 = (412, 324) # line annotaion_point = (262, 319) distance_create(point_1, point_2, annotaion_point, 100) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), annotaion_point[0], annotaion_point[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + annotaion_point[0], + annotaion_point[1], + 0, + Qt.LeftButton, + ) waitFor("object.exists(':Distance.First object_QLineEdit')", 20000) - test.compare(str(findObject(":Distance.First object_QLineEdit").text), "SketchPoint_1/PointCoordinates") + test.compare( + str(findObject(":Distance.First object_QLineEdit").text), + "SketchPoint_1/PointCoordinates", + ) waitFor("object.exists(':Distance.Second object_QLineEdit')", 20000) - test.compare(str(findObject(":Distance.Second object_QLineEdit").text), "SketchLine_1") + test.compare( + str(findObject(":Distance.Second object_QLineEdit").text), "SketchLine_1" + ) waitFor("object.exists(':Distance.ConstraintValue_ModuleBase_ParamSpinBox')", 20000) - test.compare(str(findObject(":Distance.ConstraintValue_ModuleBase_ParamSpinBox").text), "100") + test.compare( + str(findObject(":Distance.ConstraintValue_ModuleBase_ParamSpinBox").text), "100" + ) + def main(): source(findFile("scripts", "common.py")) diff --git a/test.squish/suite_STANDALONE/tst_PARALLEL_1/test.py b/test.squish/suite_STANDALONE/tst_PARALLEL_1/test.py index 5dc404f65..eee6ef822 100644 --- a/test.squish/suite_STANDALONE/tst_PARALLEL_1/test.py +++ b/test.squish/suite_STANDALONE/tst_PARALLEL_1/test.py @@ -17,20 +17,26 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def sketch(): line_create((244, 279), (226, 282)) line_create((200, 290), (250, 300)) - #fit all + # fit all clickButton(waitForObject(":OpenParts*.Fit all_QToolButton")) - #parallel + # parallel clickButton(waitForObject(":Constraints.Parallel_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 308, 255, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 417, 440, 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 308, 255, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 417, 440, 0, Qt.LeftButton + ) clickButton(waitForObject(":Constraints.Parallel_AppElements_Button")) test.vp("VP1") + def main(): source(findFile("scripts", "common.py")) @@ -40,4 +46,3 @@ def main(): sketch_create(help_points("XY_plane"), lambda: sketch()) sendEvent("QCloseEvent", waitForObject(":OpenParts*_AppElements_MainWindow")) - diff --git a/test.squish/suite_STANDALONE/tst_PARALLEL_2/test.py b/test.squish/suite_STANDALONE/tst_PARALLEL_2/test.py index ebf838057..0731330a6 100644 --- a/test.squish/suite_STANDALONE/tst_PARALLEL_2/test.py +++ b/test.squish/suite_STANDALONE/tst_PARALLEL_2/test.py @@ -17,26 +17,38 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def sketch(): - #[step] Create lines [vp VP_SKETCH] + # [step] Create lines [vp VP_SKETCH] clickButton(waitForObject(":Basic.Line_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 123, 417, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 175, 132, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 477, 63, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 739, 397, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 123, 417, 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 123, 417, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 175, 132, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 477, 63, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 739, 397, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 123, 417, 0, Qt.LeftButton + ) test.vp("VP_SKETCH") - #[step] Create 2 lines parallel + # [step] Create 2 lines parallel parallel_create((355, 91), (445, 407)) # [check] Check that lines are parallel [vp VP_PARALLEL_1] test.vp("VP_PARALLEL_1") - #[step] Create 2 other lines parallel + # [step] Create 2 other lines parallel parallel_create((155, 225), (589, 216)) - #[check] Check that lines are parallel [vp VP_PARALLEL_2] + # [check] Check that lines are parallel [vp VP_PARALLEL_2] test.vp("VP_PARALLEL_2") + def main(): source(findFile("scripts", "common.py")) diff --git a/test.squish/suite_STANDALONE/tst_PERPENDICULAR_1/test.py b/test.squish/suite_STANDALONE/tst_PERPENDICULAR_1/test.py index 85dc4de67..dd88579dc 100644 --- a/test.squish/suite_STANDALONE/tst_PERPENDICULAR_1/test.py +++ b/test.squish/suite_STANDALONE/tst_PERPENDICULAR_1/test.py @@ -17,15 +17,17 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def sketch(): line_create((145, 205), (305, 118)) line_create((221, 60), (195, 322)) clickButton(waitForObject(":OpenParts*.Fit all_QToolButton")) - perpendicular_create((323, 193),(246, 326)) + perpendicular_create((323, 193), (246, 326)) test.vp("VP1") + def main(): source(findFile("scripts", "common.py")) diff --git a/test.squish/suite_STANDALONE/tst_RADIUS/test.py b/test.squish/suite_STANDALONE/tst_RADIUS/test.py index fa84a42c2..ce9b49435 100644 --- a/test.squish/suite_STANDALONE/tst_RADIUS/test.py +++ b/test.squish/suite_STANDALONE/tst_RADIUS/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def sketch(): circle_center = (300, 400) circle_border = (500, 400) @@ -26,9 +27,18 @@ def sketch(): # check circle_border = (200, 400) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), circle_border[0], circle_border[1], 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), + circle_border[0], + circle_border[1], + 0, + Qt.LeftButton, + ) waitFor("object.exists(':Circle.CircleRadius_ModuleBase_ParamSpinBox')", 20000) - test.compare(str(findObject(":Circle.CircleRadius_ModuleBase_ParamSpinBox").text), "150") + test.compare( + str(findObject(":Circle.CircleRadius_ModuleBase_ParamSpinBox").text), "150" + ) + def main(): source(findFile("scripts", "common.py")) diff --git a/test.squish/suite_STANDALONE/tst_c/test.py b/test.squish/suite_STANDALONE/tst_c/test.py index b3150052c..36ba92c23 100644 --- a/test.squish/suite_STANDALONE/tst_c/test.py +++ b/test.squish/suite_STANDALONE/tst_c/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): source(findFile("scripts", "common.py")) @@ -27,40 +28,76 @@ def main(): clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Sketch") clickButton(waitForObject(":Basic.Sketch_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 351, 267, 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 351, 267, 0, Qt.LeftButton + ) clickButton(waitForObject(":Basic.Line_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 242, 169, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 140, 394, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 531, 537, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 241, 169, 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 242, 169, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 140, 394, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 531, 537, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 241, 169, 0, Qt.LeftButton + ) clickButton(waitForObject(":Sketch.property_panel_ok_QToolButton")) test.vp("VP_SKETCH") clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Features") clickButton(waitForObject(":Extrusion.Extrusion_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 216, 270, 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 216, 270, 0, Qt.LeftButton + ) clickButton(waitForObject(":Extrusion.property_panel_ok_QToolButton")) test.vp("VP_EXTRUSION") clickButton(waitForObject(":Extrusion.ExtrusionFuse_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 290, 316, 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 290, 316, 0, Qt.LeftButton + ) clickButton(waitForObject(":OpenParts*.Fit all_QToolButton")) test.vp("VP_EXTRUSIONFUSE") - mouseClick(waitForObject(":Sketch.Basic_AppElements_MenuGroupPanel"), 143, 56, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Sketch.Basic_AppElements_MenuGroupPanel"), + 143, + 56, + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Basic.Circle_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 259, 248, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 281, 285, 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 259, 248, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 281, 285, 0, Qt.LeftButton + ) clickButton(waitForObject(":Sketch.Ok_QToolButton")) - mouseClick(waitForObject(":Extrusion.qt_spinbox_lineedit_QLineEdit_5"), 42, 9, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Extrusion.qt_spinbox_lineedit_QLineEdit_5"), + 42, + 9, + 0, + Qt.LeftButton, + ) type(waitForObject(":Extrusion.to_size_ModuleBase_ParamSpinBox_2"), "") type(waitForObject(":Extrusion.to_size_ModuleBase_ParamSpinBox_2"), "3") type(waitForObject(":Extrusion.to_size_ModuleBase_ParamSpinBox_2"), "3") - mouseClick(waitForObject(":Extrusion.qt_spinbox_lineedit_QLineEdit_6"), 93, 7, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Extrusion.qt_spinbox_lineedit_QLineEdit_6"), + 93, + 7, + 0, + Qt.LeftButton, + ) type(waitForObject(":Extrusion.from_size_ModuleBase_ParamSpinBox_3"), "") type(waitForObject(":Extrusion.from_size_ModuleBase_ParamSpinBox_3"), "4") type(waitForObject(":Extrusion.from_size_ModuleBase_ParamSpinBox_3"), "4") @@ -68,34 +105,70 @@ def main(): clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Sketch") clickButton(waitForObject(":Basic.Sketch_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 351, 267, 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 351, 267, 0, Qt.LeftButton + ) clickButton(waitForObject(":Basic.Line_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 242, 169, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 140, 394, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 531, 537, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 241, 169, 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 242, 169, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 140, 394, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 531, 537, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 241, 169, 0, Qt.LeftButton + ) clickButton(waitForObject(":Sketch.property_panel_ok_QToolButton")) clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Features") mouseDrag(waitForObject(":Features_QScrollArea"), 31, 1, -2, -2, 1, Qt.LeftButton) clickButton(waitForObject(":Extrusion.Extrusion_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 216, 270, 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 216, 270, 0, Qt.LeftButton + ) clickButton(waitForObject(":Extrusion.property_panel_ok_QToolButton")) clickButton(waitForObject(":Extrusion.ExtrusionCut_AppElements_Button")) clickButton(waitForObject(":Basic_QToolButton")) clickButton(waitForObject(":Abort operation.OK_QPushButton")) clickButton(waitForObject(":Extrusion.ExtrusionFuse_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 290, 316, 0, Qt.LeftButton) - mouseClick(waitForObject(":Sketch.Basic_AppElements_MenuGroupPanel"), 143, 56, 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 290, 316, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":Sketch.Basic_AppElements_MenuGroupPanel"), + 143, + 56, + 0, + Qt.LeftButton, + ) clickButton(waitForObject(":Basic.Circle_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 259, 248, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 281, 285, 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 259, 248, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 281, 285, 0, Qt.LeftButton + ) clickButton(waitForObject(":Sketch.Ok_QToolButton")) - mouseClick(waitForObject(":Extrusion.qt_spinbox_lineedit_QLineEdit_5"), 42, 9, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Extrusion.qt_spinbox_lineedit_QLineEdit_5"), + 42, + 9, + 0, + Qt.LeftButton, + ) type(waitForObject(":Extrusion.to_size_ModuleBase_ParamSpinBox_2"), "") type(waitForObject(":Extrusion.to_size_ModuleBase_ParamSpinBox_2"), "33") - mouseClick(waitForObject(":Extrusion.qt_spinbox_lineedit_QLineEdit_6"), 93, 7, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Extrusion.qt_spinbox_lineedit_QLineEdit_6"), + 93, + 7, + 0, + Qt.LeftButton, + ) type(waitForObject(":Extrusion.from_size_ModuleBase_ParamSpinBox_3"), "") type(waitForObject(":Extrusion.from_size_ModuleBase_ParamSpinBox_3"), "44") clickButton(waitForObject(":ExtrusionFuse.property_panel_ok_QToolButton")) diff --git a/test.squish/suite_STANDALONE/tst_common_1/test.py b/test.squish/suite_STANDALONE/tst_common_1/test.py index 3575d00a9..fde1b21be 100644 --- a/test.squish/suite_STANDALONE/tst_common_1/test.py +++ b/test.squish/suite_STANDALONE/tst_common_1/test.py @@ -17,27 +17,39 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -def sketch(): +def sketch(): clickButton(waitForObject(":Basic.Line_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 256, 202, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 256, 462, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 472, 466, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 467, 205, 0, Qt.LeftButton) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 256, 202, 0, Qt.LeftButton) - - perpendicular_create((354, 204),(469, 309)) - perpendicular_create((470, 314),(357, 464)) - perpendicular_create((354, 463),(255, 321)) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 256, 202, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 256, 462, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 472, 466, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 467, 205, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 256, 202, 0, Qt.LeftButton + ) + + perpendicular_create((354, 204), (469, 309)) + perpendicular_create((470, 314), (357, 464)) + perpendicular_create((354, 463), (255, 321)) horizontal_create((358, 203)) distance_create((256, 205), (473, 202), (446, 141), 330) distance_create((258, 205), (256, 470), (208, 459), 400) -def sketch_1(): - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 365, 324, 0, Qt.LeftButton) +def sketch_1(): + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 365, 324, 0, Qt.LeftButton + ) circle_create_in_view((265, 190), (278, 205)) circle_create_in_view((460, 194), (476, 209)) @@ -49,7 +61,7 @@ def sketch_1(): radius_create((284, 454), (304, 438), 15) radius_create((467, 484), (472, 486), 15) - distance_create((269, 191), (463,198), (433, 101), 170) + distance_create((269, 191), (463, 198), (433, 101), 170) distance_create((265, 463), (445, 404), (328, 545), 170) distance_create((223, 193), (220, 483), (153, 457), 240) distance_create((496, 196), (467, 394), (564, 375), 240) @@ -59,9 +71,11 @@ def sketch_1(): distance_create((509, 64), (643, 63), (579, 160), 80) distance_create((512, 62), (529, 3), (443, 119), 80) -def sketch_2(): - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 365, 324, 0, Qt.LeftButton) +def sketch_2(): + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 365, 324, 0, Qt.LeftButton + ) line_create_in_view((112, 185), (643, 193)) line_create_in_view((643, 193), (641, 288)) @@ -78,7 +92,8 @@ def main(): startApplication("linux_run.sh") set_defaults() - test.log("TODO: Make test more stable."); return + test.log("TODO: Make test more stable.") + return part_create() waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1") @@ -86,34 +101,90 @@ def main(): sketch_create(help_points("XY_plane"), lambda: sketch()) - #extrusion + # extrusion clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Features") clickButton(waitForObject(":Extrusion.Extrusion_AppElements_Button")) - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 295, 253, 0, Qt.LeftButton) - mouseClick(waitForObject(":Extrusion.qt_spinbox_lineedit_QLineEdit"), 28, 8, 0, Qt.LeftButton) + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 295, 253, 0, Qt.LeftButton + ) + mouseClick( + waitForObject(":Extrusion.qt_spinbox_lineedit_QLineEdit"), + 28, + 8, + 0, + Qt.LeftButton, + ) type(waitForObject(":to_size_ModuleBase_ParamSpinBox"), "") type(waitForObject(":to_size_ModuleBase_ParamSpinBox"), "50") - mouseClick(waitForObject(":Extrusion.qt_spinbox_lineedit_QLineEdit_2"), 29, 10, 0, Qt.LeftButton) + mouseClick( + waitForObject(":Extrusion.qt_spinbox_lineedit_QLineEdit_2"), + 29, + 10, + 0, + Qt.LeftButton, + ) type(waitForObject(":Extrusion.from_size_ModuleBase_ParamSpinBox"), "") type(waitForObject(":Extrusion.from_size_ModuleBase_ParamSpinBox"), "50") clickButton(waitForObject(":Extrusion.property_panel_ok_QToolButton")) - #extrusion_feature((361, 391), 50, 50) - #sketch_create(help_points("XY_plane"), lambda: sketch_1()) + # extrusion_feature((361, 391), 50, 50) + # sketch_create(help_points("XY_plane"), lambda: sketch_1()) extrusion_cut_by_sizes_feature((365, 324), lambda: sketch_1(), 100, 150) extrusion_fuse_by_sizes_feature((185, 213), lambda: sketch_2(), 150, 0) - mouseDrag(waitForObject(":OpenParts*_AppElements_ViewPort"), 89, 518, 13, -86, 67108865, Qt.LeftButton) - mouseDrag(waitForObject(":OpenParts*_AppElements_ViewPort"), 181, 514, -21, -144, 67108866, Qt.RightButton) - mouseDrag(waitForObject(":OpenParts*_AppElements_ViewPort"), 662, 541, -368, -221, 67108866, Qt.RightButton) - mouseDrag(waitForObject(":OpenParts*_AppElements_ViewPort"), 609, 270, -48, 320, 67108866, Qt.RightButton) - mouseDrag(waitForObject(":OpenParts*_AppElements_ViewPort"), 483, 423, 123, 11, 67108866, Qt.RightButton) + mouseDrag( + waitForObject(":OpenParts*_AppElements_ViewPort"), + 89, + 518, + 13, + -86, + 67108865, + Qt.LeftButton, + ) + mouseDrag( + waitForObject(":OpenParts*_AppElements_ViewPort"), + 181, + 514, + -21, + -144, + 67108866, + Qt.RightButton, + ) + mouseDrag( + waitForObject(":OpenParts*_AppElements_ViewPort"), + 662, + 541, + -368, + -221, + 67108866, + Qt.RightButton, + ) + mouseDrag( + waitForObject(":OpenParts*_AppElements_ViewPort"), + 609, + 270, + -48, + 320, + 67108866, + Qt.RightButton, + ) + mouseDrag( + waitForObject(":OpenParts*_AppElements_ViewPort"), + 483, + 423, + 123, + 11, + 67108866, + Qt.RightButton, + ) clickButton(waitForObject(":OpenParts*.Fit all_QToolButton")) - test.vp("VP1")#Detail in axonometric view + test.vp("VP1") # Detail in axonometric view - mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 391, 374, 0, Qt.LeftButton) - test.vp("VP2")#Detail is selected + mouseClick( + waitForObject(":OpenParts*_AppElements_ViewPort"), 391, 374, 0, Qt.LeftButton + ) + test.vp("VP2") # Detail is selected sendEvent("QCloseEvent", waitForObject(":OpenParts*_AppElements_MainWindow")) diff --git a/test.squish/suite_STANDALONE/tst_crash_1/test.py b/test.squish/suite_STANDALONE/tst_crash_1/test.py index 216caf681..d508abb09 100644 --- a/test.squish/suite_STANDALONE/tst_crash_1/test.py +++ b/test.squish/suite_STANDALONE/tst_crash_1/test.py @@ -17,6 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def main(): source(findFile("scripts", "common.py")) diff --git a/utils.py b/utils.py index ee321140f..4ae306e85 100644 --- a/utils.py +++ b/utils.py @@ -19,72 +19,81 @@ import os, os.path -#SHAPER_SRC = os.environ['SHAPER_SRC'] -SHAPER_SRC = os.environ['PWD'] +# SHAPER_SRC = os.environ['SHAPER_SRC'] +SHAPER_SRC = os.environ["PWD"] # VERBOSE_FLAG = os.environ['VERBOSE_FLAG'] VERBOSE_FLAG = "" ENCODING = "utf-8" -OPERATORS=[">", "<", "+", "=", "-", "*", "/"] +OPERATORS = [">", "<", "+", "=", "-", "*", "/"] + def create_warning_generator(fichier): - """ - fichier est le fichier de log cpplint ouvert à la position courante. - Un trou dans le fichier résulte en l'arrêt de la génération - """ - ligne = "-" - ligne = fichier.readline() - i = 1 - while ligne.strip("\n") : - ligne = ligne.decode(ENCODING) - liste = ligne.split(":") - print("Size of liste = ", len(liste)) - print("ligne = ", ligne) - print("n° ligne = ", i) - print("XXX : ", ligne.find('Done processing ')) + """ + fichier est le fichier de log cpplint ouvert à la position courante. + Un trou dans le fichier résulte en l'arrêt de la génération + """ + ligne = "-" + ligne = fichier.readline() + i = 1 + while ligne.strip("\n"): + ligne = ligne.decode(ENCODING) + liste = ligne.split(":") + print("Size of liste = ", len(liste)) + print("ligne = ", ligne) + print("n° ligne = ", i) + print("XXX : ", ligne.find("Done processing ")) + + if len(liste) < 3: + if ( + ligne.find("Done processing ") == -1 + and ligne.find("Category ") == -1 + and ligne.find("Total errors found: ") == -1 + ): + raise Exception("Fichier de log mal formé") + else: + ligne = fichier.readline() + i += 1 + continue + elif len(liste) != 3: + item1 = liste[0] + item2 = liste[1] + merge = "" + sep = "" + for item in liste[2:]: + merge += sep + merge += item + sep = ":" + liste = [item1, item2, merge] + ligne = fichier.readline() + i += 1 + yield liste[0], int(liste[1]), liste[2] - if len(liste) < 3: - if ligne.find('Done processing ') == -1 and ligne.find('Category ') == -1 and ligne.find('Total errors found: ') == -1: - raise Exception("Fichier de log mal formé") - else: - ligne = fichier.readline() - i += 1 - continue - elif len(liste) != 3: - item1=liste[0] - item2=liste[1] - merge = "" - sep = "" - for item in liste[2:]: - merge += sep - merge += item - sep = ":" - liste = [item1, item2, merge] - ligne = fichier.readline() - i += 1 - yield liste[0], int(liste[1]), liste[2] def get_src_path(path): - return os.path.normpath(os.path.join(SHAPER_SRC, path)) + return os.path.normpath(os.path.join(SHAPER_SRC, path)) + def get_line_no(path, nol): - """retourne la ligne No nol du fichier path (relatif à DST_SRC_PARENT) sous forme d'un unicode""" - ligne = "" - fic = open(get_src_path(path), "r") - for i in range(nol): - ligne = fic .readline() - fic.close() - ligne_u = ligne.decode(ENCODING) - return ligne_u + """retourne la ligne No nol du fichier path (relatif à DST_SRC_PARENT) sous forme d'un unicode""" + ligne = "" + fic = open(get_src_path(path), "r") + for i in range(nol): + ligne = fic.readline() + fic.close() + ligne_u = ligne.decode(ENCODING) + return ligne_u + def fic_readlines(fic): - tmp=fic.readlines() - liste=[] - for ligne in tmp: - liste.append(ligne.decode(ENCODING)) - return liste + tmp = fic.readlines() + liste = [] + for ligne in tmp: + liste.append(ligne.decode(ENCODING)) + return liste + def fic_writelines(liste): - liste2=[] - for ligne in liste: - liste2.append(ligne.encode(ENCODING)) - return liste2 + liste2 = [] + for ligne in liste: + liste2.append(ligne.encode(ENCODING)) + return liste2 -- 2.39.2